useblocks 1.1.85-dev.6 → 1.1.85-dev.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -3
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/js/{discussHandlers.Ced_gtP0.js → discussHandlers.BuuVtU3Y.js} +5 -5
- package/iframe/js/iframe-eblock.body.js +1 -1
- package/iframe/js/iframe-eblock.js +1 -1
- package/iframe/js/iframe.body.js +2 -2
- package/iframe/js/iframe.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Custom/FormPanel/FormSection/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Custom/Inputs/ColorPickerInput/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Custom/Inputs/ControlFontFamily/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Custom/Inputs/InputSelect/index.js +34 -31
- package/node_modules/useblocks-ui-kit/es/components/Custom/PanelForm/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataDisplay/Card/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataDisplay/Skeleton/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/Cascader/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/Checkbox/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/ColorPicker/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/DatePicker/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/Form/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/Input/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/InputNumber/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/InputOTP/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/Password/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/Radio/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/SearchInput/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/Switch/index.js +2 -2
- package/node_modules/useblocks-ui-kit/es/components/DataEntry/TextArea/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Feedback/Alert/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Feedback/Popconfirm/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Feedback/Spin/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Feedback/Tooltip/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/General/Button/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Layout/Divider/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Layout/Row/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Layout/Space/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Navigation/FloatButton/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Navigation/Segmented/index.js +1 -1
- package/node_modules/useblocks-ui-kit/es/components/Navigation/Tabs/index.js +1 -1
- package/node_modules/useblocks-ui-kit/package.json +1 -1
- package/package.json +2 -2
- package/runtime/react/index.js +1 -1
- package/static/core/{9600caf9.js → 06d19668.js} +2 -2
- package/static/core/{51a46897.js → 13c7b13a.js} +1 -1
- package/static/core/{fdfb1e94.js → 1afe0f9c.js} +1 -1
- package/static/core/{8035d07f.js → 28160edc.js} +1 -1
- package/static/core/{6a939bac.js → 3d7934fb.js} +1 -1
- package/static/core/{6741eb70.js → 3df10afa.js} +8 -8
- package/static/core/{e2699a48.js → 41028939.js} +1 -1
- package/static/core/{7f91ed03.js → 45eb9af1.js} +1 -1
- package/static/core/{60f7aa8d.js → 48a8ba9d.js} +1 -1
- package/static/core/{740a4f32.js → 49a8dc9c.js} +1 -1
- package/static/core/{284b592e.js → 59cfe4a0.js} +1 -1
- package/static/core/{ec4827f1.js → 778aee63.js} +1 -1
- package/static/core/{c28968c1.js → 799f4d8e.js} +1 -1
- package/static/core/{d0eece8b.js → 7c047ede.js} +1 -1
- package/static/core/{9ea82ab5.js → 982730aa.js} +1 -1
- package/static/core/{23f020c5.js → a46eae76.js} +1 -1
- package/static/core/{fc390885.js → b165db74.js} +1 -1
- package/static/core/{991b35ff.js → cb42ad65.js} +1 -1
- package/static/core/{7d627bff.js → db82c42b.js} +1 -1
- package/static/core/{1bdeb37f.js → df189a9d.js} +1 -1
- package/static/core/{74c1d64b.js → f1478faf.js} +1 -1
- package/static/core/{6ff64eea.js → f1498d3c.js} +1 -1
- package/static/core/{b6c5e3be.js → f8d889a1.js} +2 -2
- package/static/core/{3a252a3c.js → fa60c7fb.js} +1 -1
- package/static/core/{d2bb1c0d.js → ff43365e.js} +1 -1
- package/static/esm/349f9e2c.js +1 -0
- package/static/umd-runtime/runtime.js +1 -1
- package/static/umd-runtime/ui-kit.js +2 -2
- package/{useblocks-core.d62ebebc.js → useblocks-core.ee20cf1c.js} +42 -42
- package/useblocks-esm.js +10 -10
- package/{useblocks-po.d62ebebc.js → useblocks-po.ee20cf1c.js} +1 -1
- package/useblocks.d.ts +33 -6
- package/useblocks.js +12 -12
- package/vite/index.cjs +38 -0
- package/vite/index.js +38 -0
- package/static/esm/ff1698e6.js +0 -1
- /package/iframe/{iframe-eblock.d62ebebc.html → iframe-eblock.ee20cf1c.html} +0 -0
- /package/iframe/{iframe.d62ebebc.html → iframe.ee20cf1c.html} +0 -0
package/useblocks-esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as
|
|
1
|
+
import{t as fi}from"./static/esm/50fbfdf6.js";import{$ as os,A as ss,At as L,B as as,C as ls,Ct as ds,D as cs,Dt as $,E as us,Et as pt,F as Ye,G as pi,H as Xe,I as fs,J as ps,K as hs,L as ms,M as gs,Mt as vs,N as tt,Nt as bs,O as hi,Ot as Es,P as ys,Pt as ee,Q as mi,R as _s,S as ws,St as Ss,T as Is,Tt as An,V as er,W as Ts,X as As,Y as gi,Z as Pe,_ as ht,_t as pe,a as Cs,at as se,b as Rs,bt as Ps,c as Ds,ct as Os,d as yt,dt as xs,et as we,f as Ls,ft as Ms,g as vi,gt as Ce,h as ks,ht as Cn,i as Ns,it as bi,j as Fs,jt as ce,k as js,kt as mt,l as F,lt as Bs,m as Rn,mt as Pn,n as Us,nt as De,o as Le,ot as tn,p as Hs,pt as B,q as Dn,r as Gs,rt as _t,s as qs,st as he,t as le,tt as j,u as $s,ut as tr,v as zs,vt as Vs,w as On,wt as Z,x as nr,xt as rr,y as Ks,yt as nn,z as Te}from"./static/esm/349f9e2c.js";(function(){"use strict";var e=window.__useblocks__=window.__useblocks__||{};e.__facadeSentinel="@shared-runtime:init-complete",e.publicPath||(e.publicPath=(function(){var h=(function(){if(typeof document<"u"&&document.querySelector)try{var w=document.querySelector('script[src*="useblocks-esm.js"]')||document.querySelector('script[src*="useblocks.js"]');if(w&&w.src)return w.src.substring(0,w.src.lastIndexOf("/")+1)}catch{}try{var T=import.meta.url;if(T)return T.substring(0,T.lastIndexOf("/")+1)}catch{}return"./"})();h||(h="./");try{var c=String(h);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(c)||c.indexOf("//")===0)return c.charAt(c.length-1)==="/"?c:c+"/";var l=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",p=l?new URL(c,l).href:c;return p.charAt(p.length-1)==="/"?p:p+"/"}catch{var m=String(h);return m.charAt(m.length-1)==="/"?m:m+"/"}})()),typeof e.setPublicPath!="function"&&(e.setPublicPath=function(h){return e.publicPath=(function(){var c=h==null?"":String(h);c||(c="./");try{var l=String(c);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(l)||l.indexOf("//")===0)return l.charAt(l.length-1)==="/"?l:l+"/";var p=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",m=p?new URL(l,p).href:l;return m.charAt(m.length-1)==="/"?m:m+"/"}catch{var w=String(c);return w.charAt(w.length-1)==="/"?w:w+"/"}})(),e.publicPath}),e.__publicPathDiagnosticsLogged||(e.__publicPathDiagnosticsLogged=!0,(function(){var h=String(e.publicPath||"");if(h.indexOf("file:")!==0&&!(h&&h!=="./")){var c="";try{if(typeof window<"u"){for(var l in window)if(!(l==="__useblocks__"||!/^__[^_].*__$/.test(l))){var p;try{p=window[l]}catch{continue}if(p&&typeof p=="object"&&p.publicPath){c=" Another product namespace ("+l+") has publicPath set — verify the host bundler plugin matches the installed npm brand.";break}}}}catch{}}})()),e.assetUrl||(e.assetUrl=function(h){function c(O){try{var k=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"";return k?new URL(String(O||""),k).href:String(O||"")}catch{return String(O||"")}}var l=String(h||"");if(!l)return"";if(/^(?:data:|blob:)/.test(l))return l;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(l)||l.indexOf("//")===0||l.charAt(0)==="/")return c(l);var p=l.replace(/^\.\/+/,"").replace(/^\/+/,""),m="static/media".replace(/^\.\/+/,"").replace(/^\/+/,"").replace(/\/+$/,""),w=m&&p.indexOf(m+"/")!==0?m+"/"+p:p,T=e.publicPath||"./";try{return new URL(w,T).href}catch{return T.slice(-1)!=="/"&&(T+="/"),c(T+w)}}),e.version||(e.version="1.1.85-dev.8");var t=e.modules=Object.create(null);if(typeof e.define!="function"){var n=`/**
|
|
2
2
|
* Async AMD Loader (IIFE version for injection)
|
|
3
3
|
*
|
|
4
4
|
* This file is injected at the beginning of iframe entry points.
|
|
@@ -993,14 +993,14 @@ import{t as si}from"./static/esm/50fbfdf6.js";import{$ as Qo,A as Zo,At as le,B
|
|
|
993
993
|
__amdEnv.syncRequire = syncRequire;
|
|
994
994
|
__amdEnv.diagnosticsBuffer = diagBuffer;
|
|
995
995
|
})();
|
|
996
|
-
`,r=new Function("__amdEnv",n);r(e),typeof e.require=="function"&&typeof e.require.config=="function"&&e.require.config({baseUrl:"./",paths:{core:"useblocks-core.d62ebebc.js",po:"useblocks-po.d62ebebc.js",monaco:"static/monaco/index.js"}})}e.define("__delivery__/libs",[],function(){return import("./static/esm/delivery-libs.js")});var i=function(h){var c,a=function(){return c||(c=Promise.resolve().then(h))};return{then:function(p,m){return a().then(p,m)},catch:function(p){return a().catch(p)},finally:function(p){return a().finally(p)}}},o=i(function(){return e.require(["__delivery__/libs"]).then(function(h){return h[0]})});t.React=i(function(){return o.then(function(h){return h.React})}),t.ReactDom=i(function(){return o.then(function(h){return h.ReactDom})}),t.ReactDomClient=i(function(){return o.then(function(h){return h.ReactDomClient})}),t.ReactJsxRuntime=i(function(){return o.then(function(h){return h.ReactJsxRuntime})}),t.ReactJsxDevRuntime=i(function(){return o.then(function(h){return h.ReactJsxDevRuntime})}),t.AntDesignIconBase=i(function(){return o.then(function(h){return h.AntDesignIconBase})}),t.AntDesignCssinjs=i(function(){return o.then(function(h){return h.AntDesignCssinjs})}),t.Classnames=i(function(){return o.then(function(h){return h.Classnames})}),t.Dayjs=i(function(){return o.then(function(h){return h.Dayjs})});var s=i(function(){return Promise.all([o]).then(function(h){var c=h[0]||Object.create(null),a=Object.create(null);for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(a[p]=c[p]);for(var m in a)Object.prototype.hasOwnProperty.call(a,m)&&(t[m]=a[m]);return a})}),d={},l={Antd:"[runtime] `antd` is not available: the compatibility layer for global plugins is not enabled. Add `import 'useblocks/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",AntDesignIcons:"[runtime] `@ant-design/icons` is not available: the compatibility layer for global plugins is not enabled. Add `import 'useblocks/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator."},f={Antd:"[runtime] `antd` is served from the host runtime for backward compatibility. Rebuild the plugin with the current CLI to bundle it from its own copy of the package. This compatibility layer is deprecated.",AntDesignIcons:"[runtime] `@ant-design/icons` is served from the host runtime for backward compatibility. Rebuild the plugin with the current CLI to bundle it from its own copy of the package. This compatibility layer is deprecated."},u=Object.create(null);if(e.registerCompat=function(h){if(!(!h||typeof h!="object"))for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(u[c]=h[c])},e.__compatPending){for(var v=0;v<e.__compatPending.length;v+=1)e.registerCompat(e.__compatPending[v]);e.__compatPending=void 0}for(var b in l)Object.prototype.hasOwnProperty.call(l,b)&&(function(h,c,a){var p=!1,m=function(){if(!(h in u))throw new Error(c);return u[h]};Object.defineProperty(t,h,{configurable:!0,enumerable:!0,get:function(){var _=m();return p||(p=!0),_},set:function(_){u[h]=_}}),Object.defineProperty(d,h,{configurable:!0,enumerable:!0,get:m,set:function(_){u[h]=_}})})(b,l[b],f[b]);var E=t;for(var I in d)Object.prototype.hasOwnProperty.call(d,I)&&(E===t&&(E=Object.create(t)),Object.defineProperty(E,I,Object.getOwnPropertyDescriptor(d,I)));var g=s,y=[],w=function(){for(var h=[],c=0;c<y.length;c+=1)(function(a){var p=t[a];p&&typeof p.then=="function"&&h.push(Promise.resolve(p).then(function(m){t[a]=m}))})(y[c]);return Promise.all(h)},S=typeof e.prefetch=="function"?e.prefetch:void 0;if(e.prefetch=function(){return s.then(w).then(function(){if(typeof S=="function")return S.call(e)})},typeof e.define=="function"){let h=function(c){if(!c||typeof c!="object"&&typeof c!="function"||c.__esModule)return c;if(A){var a=A.get(c);if(a)return a}var p=Object.create(null);Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});for(var m=Reflect.ownKeys(c),_=0;_<m.length;_++){var T=m[_];if(T!=="__esModule"){var C=Object.getOwnPropertyDescriptor(c,T);C&&Object.defineProperty(p,T,C)}}return Object.prototype.hasOwnProperty.call(p,"default")||Object.defineProperty(p,"default",{enumerable:!0,value:c,writable:!1}),A&&A.set(c,p),p};var A=typeof WeakMap<"u"?new WeakMap:null;e.define("react",[],function(){var c=E.React;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.React)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.React;return h(p)})}),e.define("useblocks/runtime/react",[],function(){var c=E.React;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.React)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.React;return h(p)})}),e.define("react-dom",[],function(){var c=E.ReactDom;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.ReactDom)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.ReactDom;return h(p)})}),e.define("useblocks/runtime/react-dom",[],function(){var c=E.ReactDom;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.ReactDom)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.ReactDom;return h(p)})}),e.define("react-dom/client",[],function(){var c=E.ReactDomClient;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.ReactDomClient)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.ReactDomClient;return h(p)})}),e.define("useblocks/runtime/react-dom/client",[],function(){var c=E.ReactDomClient;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.ReactDomClient)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.ReactDomClient;return h(p)})}),e.define("react/jsx-runtime",[],function(){var c=E.ReactJsxRuntime;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.ReactJsxRuntime)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.ReactJsxRuntime;return h(p)})}),e.define("useblocks/runtime/react/jsx-runtime",[],function(){var c=E.ReactJsxRuntime;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.ReactJsxRuntime)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.ReactJsxRuntime;return h(p)})}),e.define("react/jsx-dev-runtime",[],function(){var c=E.ReactJsxDevRuntime;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.ReactJsxDevRuntime)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.ReactJsxDevRuntime;return h(p)})}),e.define("useblocks/runtime/react/jsx-dev-runtime",[],function(){var c=E.ReactJsxDevRuntime;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.ReactJsxDevRuntime)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.ReactJsxDevRuntime;return h(p)})}),e.define("antd",[],function(){var c=E.Antd;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.Antd)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.Antd;return h(p)})}),e.define("useblocks/runtime/antd",[],function(){var c=E.Antd;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.Antd)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.Antd;return h(p)})}),e.define("@ant-design/icons/es/components/AntdIcon",[],function(){var c=E.AntDesignIconBase;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.AntDesignIconBase)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.AntDesignIconBase;return h(p)})}),e.define("useblocks/runtime/@ant-design/icons/es/components/AntdIcon",[],function(){var c=E.AntDesignIconBase;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.AntDesignIconBase)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.AntDesignIconBase;return h(p)})}),e.define("@ant-design/icons",[],function(){var c=E.AntDesignIcons;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.AntDesignIcons)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.AntDesignIcons;return h(p)})}),e.define("useblocks/runtime/@ant-design/icons",[],function(){var c=E.AntDesignIcons;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.AntDesignIcons)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.AntDesignIcons;return h(p)})}),e.define("@ant-design/cssinjs",[],function(){var c=E.AntDesignCssinjs;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.AntDesignCssinjs)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.AntDesignCssinjs;return h(p)})}),e.define("useblocks/runtime/@ant-design/cssinjs",[],function(){var c=E.AntDesignCssinjs;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.AntDesignCssinjs)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.AntDesignCssinjs;return h(p)})}),e.define("classnames",[],function(){var c=E.Classnames;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.Classnames)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.Classnames;return h(p)})}),e.define("useblocks/runtime/classnames",[],function(){var c=E.Classnames;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.Classnames)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.Classnames;return h(p)})}),e.define("dayjs",[],function(){var c=E.Dayjs;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.Dayjs)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.Dayjs;return h(p)})}),e.define("useblocks/runtime/dayjs",[],function(){var c=E.Dayjs;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.Dayjs)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.Dayjs;return h(p)})}),e.define("useblocks-ui-kit",[],function(){var c=E.UiKit;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.UiKit)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.UiKit;return h(p)})}),e.define("useblocks/ui-kit",[],function(){var c=E.UiKit;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.UiKit)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.UiKit;return h(p)})}),e.define("useblocks/ui-kit/icons",[],function(){var c=E.UiKitIcons;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.UiKitIcons)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.UiKitIcons;return h(p)})}),e.define("useblocks-ui-kit/icons",[],function(){var c=E.UiKitIcons;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?g.then(function(p){return h(p.UiKitIcons)}):h(a)}):c!==void 0?h(c):g.then(function(a){var p=a.UiKitIcons;return h(p)})})}globalThis.__SHARED_RUNTIME_INIT_SENTINEL__="@shared-runtime:init-complete"})();var Hs=new Function("url","return import(url)");function Gs(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function qs(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function $s(e){return e.type==="umd"||e.resolve==="registry"}var zs=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(qs(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if($s(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Hs(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,r.onload=()=>t(),r.onerror=()=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(r)})}initSync(e){const t=[];for(const n of e){const r=this._getOrCreate(n,void 0);t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const{ctor:i,options:o}=await this._resolveEntry(r),s=this._getOrCreate(i,o);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 s of e){const d=await this._resolveEntry(s);t.add(d.ctor),n.push(d)}const r=[];this._map.forEach((s,d)=>{t.has(d)||r.push({key:d,plugin:s})});for(let s=r.length-1;s>=0;s--){const{key:d,plugin:l}=r[s];await this._initializingPlugins.get(l),await this._disposePlugin(l,l.constructor.name),this._map.delete(d),this._optionsMap.delete(d),this._readyMap.delete(l),this._resolveMap.delete(l),this._initializingPlugins.delete(l),this._initializedPlugins.delete(l);const f=this._creationOrder.indexOf(l);f>=0&&this._creationOrder.splice(f,1)}const i=[],o=new Set;for(const{ctor:s,options:d}of n){const l=this._getOrCreate(s,d);o.has(l)||(o.add(l),i.push(l))}this._activated&&await this._startPluginsBatch(i)}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,i)=>{let o,s=!1;const d=()=>{s||(s=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,d),r())};this._pluginRegistry.on(e,d),n!==void 0&&n>0&&(o=setTimeout(()=>{s||(s=!0,this._pluginRegistry.off(e,d),i(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),i=this._createPluginInstance(e,r),o=i.constructor.name;this._emitLifecycle({type:"created",plugin:i,name:o}),i.required?.(),this._map.set(n,i),this._creationOrder.push(i),this._setupReadyPromise(i)}return this._map.get(n)}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);try{return Gs(e)?new e(this._context,t):e(this._context,t)||{}}finally{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 i of t){if(this._initializedPlugins.has(i))continue;const o=this._initializingPlugins.get(i);if(o){n.add(o);continue}r.push(i)}if(r.length>0){const i=this._runBatchLifecycle(r);for(const o of r)this._initializingPlugins.set(o,i);n.add(i),i.finally(()=>{for(const o of r)this._initializingPlugins.get(o)===i&&this._initializingPlugins.delete(o)})}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});try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(i){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:i})}}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(i){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:i})}}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)}))}},Vs=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 i of n)try{i.callback(t)}catch{}const r=n.filter(i=>!i.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(i=>(t.ctor=i,t.loading=void 0,this._notifyListeners(e,i),i));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 i={callback:t,once:!1};return r.push(i),{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 i={callback:t,once:!0};return r.push(i),{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(i=>i.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)}}}},Ks=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()}},Yn=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 Ws(e,t){return t+e}function Ys(){return typeof performance>"u"?Date.now():Ws(performance.now(),performance.timeOrigin)}var Xs="emailmaker:diagnostics",Js="diagnostics",Qs="diagnostics";function Xn(e,t){return t?`${e}${e.includes("?")?"&":"?"}${Qs}=1`:e}var At;function Zs(){try{const e=new URLSearchParams(window.location.search).get(Js);return e===null?void 0:e!=="0"}catch{return}}function ea(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function ta(){try{const e=window.localStorage.getItem(Xs);return e===null?void 0:e==="1"}catch{return}}function qe(){return At===void 0&&(At=typeof window>"u"?!1:Zs()??ea()??ta()??!1),At}function na(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var J={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"},ym=Object.values(J),_m=[J.canvasPainted,J.canvasSettled,J.appVisible,J.editorVisible],ra=5e3,ia=3e3,Jn="diagnosticsStore",et,Ne;function Qn(){return{marks:new Yn(ra),resources:new Yn(ia)}}function hi(){if(Ne)return Ne;const e=In();return e?(Ne=e[Jn]??et??Qn(),e[Jn]=Ne,et=void 0,Ne):(et??=Qn(),et)}function $(e,t){qe()&&hi().marks.push({phase:e,at:Ys(),...t})}function In(){if(typeof window.__useblocks__<"u"&&window.__useblocks__)return window.__useblocks__;if(typeof window>"u")return;const e=window[na()];return e!==null&&typeof e=="object"?e:void 0}function oa(e){const t=e.length,n=hi();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function sa(){const e=In();return!e||!Array.isArray(e.diagnosticsBuffer)?0:oa(e.diagnosticsBuffer)}var aa="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function Tn(){const e=new Error(aa);return e.name="DestroyedInstanceError",e}function Qt(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 o=e,s=t;return o.length===s.length&&o.every((d,l)=>Qt(d,s[l]))}const r=Object.keys(e),i=Object.keys(t);return r.length!==i.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Qt(e[o],t[o]))}function mi(e,t){const n={watch(r){let i,o=!1;return e.watch(s=>{const d=t(s);o&&Qt(i,d)||(i=d,o=!0,r(d))})},select(r){return mi(n,r)}};return n}function Me(...e){let t=e[0],n=e.length>0;const r=new Set,i={get(){return n?t:void 0},set(o){t=o,n=!0;for(const s of Array.from(r))s(o)},watch(o){return r.add(o),n&&o(t),{dispose:()=>r.delete(o)}},select(o){return mi(i,o)}};return i}var gi=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:bs.UrlEncoded,...t})},vi=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 la(e){return String(e||"").trim()||void 0}var da=class extends Z{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=la(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)}},An=x("AppInitService");function ca(e){return async()=>{const t=await e();return(await new gi(t).app_init_create({})).data}}function ua(e){e.injectFactory(An,()=>{const t=new da({options:e.getInstance(oe),isStandalone:()=>!!e.getInstance(he),resolveRestBaseUrl:n=>n?Kn(n):Kn()||void 0,setRestBaseUrl:n=>{e.getInstance(js)?.setOptions(n?{baseUrl:n}:{})},fallbackAppInit:ca(()=>e.getInstanceAsync(as)),publish:n=>{e.inject(Pe,n)}});return e.getInstance(N)?.addDisposable(t),t},!0)}var Cn=x("documentSession.emailDocuments");function Ct(e){return e?.getInstance(Cn)}var fa=x("RevisionServiceFlag");function pa(e){return e.getOrCreateInstance(fa,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function bi(e){return pa(e).isEnabled()}var ha=x("EmailRightsResolver");function ma(e,t){const n=e.getInstance(ha);return n?n(t):!0}var Ei=x("EmailHistoryAvailabilityResolver");function ga(e){return e.getInstance(Ei)!==void 0}async function va(e){const t=e.getInstance(Ei);if(!t)return!0;try{return await t()}catch{return!1}}var Rn={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},yi=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],_i=2e4,ba=yi.reduce((e,t)=>e+Rn[t],0),wi=_i+ba+3e3;function Ea(e){return yi.reduce((t,n)=>t+Si(n,e),0)}function Si(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:Rn[e]}function Ii(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:wi}function Ti(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:_i}function Ai(e=wi){return e+3e3}var ya=()=>Ai();function _a(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function wa(e){return t=>_a(e.getOrCreateInstance(F.BEFORE_SAVE_EMAIL,()=>new pe).fire(t),ya())}function Sa(e){return e!=null&&e!==""}var Ia;function yt(e,t){return Ia?.capture(e,t)}function Ta(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 re=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${tt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${tt(this.oldText)}")`:`(replace@${this.oldPosition} "${tt(this.oldText)}" with "${tt(this.newText)}")`}};function Zn(e,t){return e===null||e.length===0?t:new Aa(e,t).compress()}var Aa=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),i=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(i===null)break;this._acceptCurr(i),i=this._getCurr(++n);continue}if(i===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(i.oldEnd<=r.newPosition){this._acceptCurr(i),i=this._getCurr(++n);continue}if(r.newEnd<=i.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(i.oldPosition<r.newPosition){const[l,f]=se._splitCurr(i,r.newPosition-i.oldPosition);this._acceptCurr(l),i=f;continue}if(r.newPosition<i.oldPosition){const[l,f]=se._splitPrev(r,i.oldPosition-r.newPosition);this._acceptPrev(l),r=f;continue}let s,d;if(i.oldEnd===r.newEnd)s=r,d=i,r=this._getPrev(++t),i=this._getCurr(++n);else if(i.oldEnd<r.newEnd){const[l,f]=se._splitPrev(r,i.oldLength);s=l,d=i,r=f,i=this._getCurr(++n)}else{const[l,f]=se._splitCurr(i,r.newLength);s=r,d=l,r=this._getPrev(++t),i=f}this._result[this._resultLen++]=new re(s.oldPosition,s.oldText,d.newPosition,d.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=d.newLength-d.oldLength}const o=se._merge(this._result);return se._removeNoOps(o)}_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 re(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new re(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),i=t.newText.substr(n);return[new re(t.oldPosition,t.oldText,t.newPosition,r),new re(t.oldEnd,"",t.newPosition+n,i)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),i=t.oldText.substr(n);return[new re(t.oldPosition,r,t.newPosition,t.newText),new re(t.oldPosition+n,i,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,i=t[0];for(let o=1;o<t.length;o++){const s=t[o];i.oldEnd===s.oldPosition?i=new re(i.oldPosition,i.oldText+s.oldText,i.newPosition,i.newText+s.newText):(n[r++]=i,i=s)}return n[r++]=i,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let i=0;i<t.length;i++){const o=t[i];o.oldText!==o.newText&&(n[r++]=o)}return n}};function Ca(e){return new re(e.newPosition,e.newText,e.oldPosition,e.oldText)}function Ra(e){return e.map(Ca)}function er(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function Pa(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const i=t[r];n=n.slice(0,i.oldPosition)+i.newText+n.slice(i.oldEnd)}return n}function Da(e,t,n){let r=0;const i=e.start===e.end;for(const o of t){const s=o.newLength-o.oldLength;if(o.oldLength===0){const d=o.oldPosition;if(i&&d===e.start)r+=n==="after"?s:0;else{if(e.start<d&&d<e.end)return null;d<=e.start&&(r+=s)}continue}if(i){if(e.start>=o.oldEnd)r+=s;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)r+=s;else if(e.end>o.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var ht=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},tr=0,Oa=Math.random().toString(36).slice(2,8);function xa(){return tr+=1,`doc-${Oa}-${tr}`}function La(e){const t=e.createBuffer(),n=e.docId??xa();let r=e.serverId??null,i=0,o=null,s=e.attributes??{};const d=new Set;let l=!1,f=!1,u;const v=new Set;let b=null;const E=()=>(b?.version!==i&&(b={version:i,value:t.read()}),b.value),I=g=>Object.entries(g).some(([y,w])=>s[y]!==w);return{get:()=>({docId:n,serverId:r,version:i,savedVersion:o,attributes:s}),getContent:E,mutate(g,{source:y}){if(l)return i;const w=g.changes?.length?g.changes:void 0,S=w?Pa(E(),w):g.content!==void 0?g.content:void 0,A=S!==void 0&&S!==E(),h=g.attributes!==void 0&&I(g.attributes);if(!A&&!h)return i;const c=!(i>(o??-1));return A&&t.write(S),h&&(s={...s,...g.attributes}),i+=1,y!=="user"&&c&&(o=i),d.forEach(a=>a({source:y,version:i,changes:w})),i},markSaved(g,y){const w={serverId:r,savedVersion:o};y!==void 0&&(r=y),(o===null||g>o)&&(o=g),(w.serverId!==r||w.savedVersion!==o)&&d.forEach(S=>S({source:"system",version:i}))},markReady(){f||u!==void 0||(f=!0,v.forEach(g=>g.resolve()),v.clear(),d.forEach(g=>g({source:"system",version:i})))},isReady:()=>f,markFailed(g){f||u!==void 0||l||(u=g,v.forEach(y=>y.reject(new ht(g))),v.clear(),d.forEach(y=>y({source:"system",version:i})))},failure:()=>u,whenReady(){return f?Promise.resolve():u!==void 0?Promise.reject(new ht(u)):l?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((g,y)=>{v.add({resolve:g,reject:y})})},subscribe(g){return d.add(g),()=>d.delete(g)},isNew:()=>r===null,isDirty:()=>i>(o??-1),isDisposed:()=>l,dispose(){l=!0,v.forEach(g=>g.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),v.clear(),d.clear(),t.dispose()}}}var Ma=500,ka=100,Rt=0;function Na(e,t={}){const n=t.groupIntervalMs??Ma,r=t.maxSteps??ka,i=t.now??(()=>0);let o=[],s=0,d=Rt+=1,l=null,f=!1,u=!1,v=!1;const b=new Set,E=()=>b.forEach(a=>a()),I=(a,p)=>{if(a.length){u=!0;try{e.mutate({changes:a},{source:p})}finally{u=!1}}},g=a=>I(a,"user"),y=a=>{const p=i();f&&l!==null&&p-l<n?o[s-1]=Zn(o[s-1],a):(o=o.slice(0,s),o.push(a),s=o.length,f=!0,o.length>r&&(o=o.slice(o.length-r),s=o.length,d=Rt+=1)),l=p,E()},w=()=>{f=!1,l=null},S=a=>{if(!a.length)return;const p=o.length>s;p&&(o=o.slice(0,s)),s>0&&(o[s-1]=Zn(o[s-1],a)),w(),p&&E()},A=e.subscribe(({source:a,changes:p})=>{if(!(v||u||!p?.length)){if(a==="remote"){h();return}if(a!=="user"){S(p);return}y(p)}}),h=()=>{o=[],s=0,w(),d=Rt+=1,E()},c=()=>{if(s===0)return!1;const a=Ra(o[s-1]);return er(e.getContent(),a)?(g(a),s-=1,w(),!0):(o=o.slice(0,s-1),s=o.length,w(),E(),!1)};return{canUndo:()=>s>0,canRedo:()=>s<o.length,undo(){c()&&E()},redo(){if(!(s>=o.length)){if(!er(e.getContent(),o[s])){o=o.slice(0,s),w(),E();return}g(o[s]),s+=1,w(),E()}},clear:h,applyWithoutHistory(a){const p=e.get().version;if(I(a,"system"),e.get().version===p){w();return}S(a)},getPast:a=>o.slice(0,s).reverse().slice(0,a),getFuture:a=>o.slice(s).reverse().slice(0,a),createSnapshot:()=>({stackId:d,index:s}),restoreSnapshot(a){if(a.stackId!==d||a.index>s)return!1;for(;s>a.index;)if(!c())return E(),!1;return E(),!0},subscribe(a){return b.add(a),()=>b.delete(a)},dispose(){v=!0,A(),b.clear(),o=[],s=0}}}var Fa=["edit","move","resize","insert"];function Pt(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function ja(e){return typeof e=="string"?e:null}function Ba(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function Ua(e){return Fa.includes(e)?e:null}function Ha(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:ja(t.originId),changeId:Pt(t.changeId),rev:Pt(t.rev),baseRev:Pt(t.baseRev),expected:Ba(t.expected),intent:Ua(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var nr=class extends Error{reason;constructor(e){super(`сохранение не состоялось: ${e}`),this.name="SaveRefusedError",this.reason=e}},Ci="draft";function Fe(e){return e==null||e===""?Ci:String(e)}function Ga(e){return e==null||e===""?`${Zt}${Ci}`:`${Zt}${String(e)}`}var Zt="block:";function me(e){return e?.startsWith(Zt)===!0}function je(e){return me(e.sessionKey())?void 0:e.current()}function Ue(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return $(`show:gate:${e}`,{kind:"wait"}),t.then(i=>($(`show:gate:${e}:end`,{kind:"wait"}),i),i=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw`${e}`,{error:String(i),...n},i})}function Ri(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function Pi(e,{freshSince:t}={}){return!(!e?.slug?.includes("autosave")||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function qa(e,t={}){const n=Ri((e??[]).filter(r=>r?.html?.trim()));return Pi(n,t)?n:null}function $a(e){const t=Date.parse(Ri(e)?.modified??"");return{autosave:qa(e),...Number.isFinite(t)?{latestAt:t}:{}}}function za({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var Di=e=>e.replace(/\r\n?/g,`
|
|
997
|
-
`),rr=["recovery","plugin","rest"],Va=["subject","preheader"];function Ka(e){let t={},n;for(let i=rr.length-1;i>=0;i--){const o=e.get(rr[i]);o&&(o.attributes&&(t={...t,...o.attributes}),o.content!==void 0&&(n=o.content))}const r=e.get("plugin")?.attributes;for(const i of Va){const o=r?.[i];typeof o=="string"&&o!==""&&(t={...t,[i]:o})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function Oi(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?Di(t.content):void 0,i=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...i?{changes:[new re(0,n,0,r)]}:{}},{source:"remote"})}var ir=e=>typeof e=="string"?e.trim():"";function Wa(e,t,n){const{version:r,attributes:i}=e.get(),o=i,s=ir(o.title)||ir(o.subject);return{version:r,payload:{html:e.getContent(),title:s,subject:o.subject,preheader:o.preheader,description:o.description,common_styles:o.common_styles||"",meta:o.meta,utm_parameters:o.utm_parameters,parent_email:o.parent_email,is_template:o.is_template||!1,is_inited:o.is_inited,tags:o.tags,emailtags:o.emailtags,group:o.group,renderGuid:e.get().docId,project:t.project??o.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source}}}async function Ya(e,t,n,r,i){if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(i);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,i):t.saveAutosave(r,i)}function ge(e,t=!1){const n={};for(const r of Object.keys(e)){let i=e[r];i!==void 0&&!(typeof i=="number"&&Number.isNaN(i))&&(t&&typeof i=="object"&&i!==null&&(i=ge(i)),n[r]=i)}return n}var Xa=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function xi(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!Xa.has(t))):{}}function mt(e,t,n={}){e&&e.mutate({attributes:Ja(e.get().attributes,t)},{source:n.source??"user"})}function Ja(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function Pn(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function Qa(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function Li(e){if(!e)return null;const t=xi(e);return e.common_styles!==void 0&&(t.common_styles=Qa(e.common_styles)),Pn(e.html,t)}function Mi(e){return e?Pn(e.html,ge(xi(e))):null}var Za=["common_styles","subject","preheader","meta"];function or(e){if(!e?.html?.trim())return null;const t={};for(const n of Za)el(n,e[n])&&(t[n]=e[n]);return Pn(e.html,t)}function el(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 tl=10,nl=(e,t)=>e.key===t.key&&rl(e.serverId,t.serverId),rl=(e,t)=>e==null||e===t;function il(e){return typeof e?.then=="function"}var sr=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},ki=e=>{e.request.serverId!=null&&e.document.markSaved(e.document.get().version)},ol=e=>{Oi(e.document,Ka(e.reports)),ki(e)},Dt=(e,t)=>{if(!e.ready){ol(e);return}Oi(e.document,t)},sl=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 al(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:i,resolveTerms:o,canEdit:s,notifyBeforeSave:d,onAdapterError:l,onTimeout:f}=e;let u;const v=new Set,b=new Set,E=()=>v.forEach(m=>m()),I=(m,_)=>{if(!(m.closed||m.ready)){if(m.error!==void 0){m.document.markFailed(m.error),m.document.get().docId;return}ki(m),m.ready=!0,m.document.markReady(),m.document.get().docId,[...m.reports.keys()]}},g=(m,_,T)=>{l?.(_.id,T),!(!_.required||m.closed)&&(m.error=T,m.document.get().docId,_.id,E())},y=(m,_)=>{const T=new Set(_.map(R=>R.id));_.forEach(R=>{R.watch&&m.watchers.push(R.watch(O=>m.closed?!1:m.ready&&O?.content!==void 0&&za({hasUnsavedUserEdit:m.document.isDirty()})==="skip"?(m.document.get().docId,R.id,!1):(O&&m.reports.set(R.id,O),Dt(m,O),!0)))});const C=(R,O)=>{m.closed||(O&&m.reports.set(R.id,O),Dt(m,O))},P=()=>{T.size>0||m.closed||(sr(m),I(m,[]))},j=[];if(_.forEach(R=>{let O;try{O=R.load()}catch(z){g(m,R,z),T.delete(R.id);return}if(il(O)){j.push({id:R.id,required:R.required,load:()=>O});return}C(R,O),T.delete(R.id)}),j.length===0){P();return}m.timer=setTimeout(()=>{m.timer=void 0,f?.([...T]),m.document.get().docId,[...T],I(m,[...T])},n),m.timer.unref?.(),j.forEach(R=>{R.load().then(O=>C(R,O)).catch(O=>{g(m,R,O)}).finally(()=>{T.delete(R.id),P()})})},w=async(m,_,T)=>{if(T==="snapshot"||T==="anchor")return;const C=o?.();if(C)return C.resolve({project:_.project??m.project,tags:(m.tags??[]).map(P=>({name:P}))})},S=m=>{if(m.lock===!0&&s?.(m)===!1)return new nr("locked");const _=m.tags?.length??0,T=m.emailtags?.length??0;if(Math.max(_,T)>tl)return new nr("too-many-tags")},A=async(m,_,T)=>{try{await m.document.whenReady()}catch(O){return m.saveError=O,m.saveFailures+=1,m.saveFailures,!1}if(m.closed)return!1;const C=S(m.document.get().attributes);if(C)return m.saveError=C,m.saveFailures+=1,C.reason,E(),!1;if(d&&(await d(sl(m)).catch(()=>{}),m.closed))return!1;let P;try{P=await w(m.document.get().attributes,T,_)}catch(O){return m.saveError=O,m.saveFailures+=1,m.saveFailures,E(),!1}if(m.closed)return!1;const{payload:j,version:R}=Wa(m.document,T,P);m.document.get().docId;try{const O=m.document.get().serverId!=null,z=await Ya(r(),i(m.request.key),_,m.document.get().serverId,j);if(m.closed)return!0;let B;if(_==="snapshot"||_==="anchor"){const L=z?.modified!=null?Date.parse(z.modified):NaN;B=Number.isFinite(L)?L:Date.now(),m.snapshotVersion=R,m.lastRevisionAt=B}else m.document.markSaved(R,z?.id!=null?String(z.id):void 0);const W=m.document.get().serverId;!O&&W!=null&&(m.recoveryFacts={emailId:W,historyLoaded:!0,isRecovering:!1}),m.saveError=void 0,m.saveFailures=0,m.document.get().serverId,E();const de={intent:_,serverId:m.document.get().serverId,created:!O,...B!==void 0?{revisionAt:B}:{}};return b.forEach(L=>L(de)),!0}catch(O){return m.saveError=O,m.saveFailures+=1,m.saveFailures,E(),!1}},h=()=>{u&&(u.closed=!0,u.watchers.forEach(m=>m()),u.watchers=[],sr(u),u.history.dispose(),u.document.dispose(),u=void 0)},c=(m,_,T)=>{let C=!1;_.show&&(m.show?.id!==_.show.id||m.show.token!==_.show.token)&&(m.show=_.show,C=!0,{docId:m.document.get().docId,..._.show});const P=T==="show"?Mi(_.patch):null;P&&(m.reports.set("plugin",P),Dt(m,P)),C&&E()},a=(m,_={})=>{const T=u;return!T||T.closed?Promise.resolve(!1):T.saving?m==="snapshot"?Promise.resolve(!1):(T.inFlight??Promise.resolve(!1)).then(()=>a(m,_)):(T.saving=!0,T.inFlight=A(T,m,_).finally(()=>{T.saving=!1,T.inFlight=void 0}),T.inFlight)},p=(m,_="open")=>{if(u&&!u.closed&&_!=="new"&&nl(u.request,m))return c(u,m,_),u.document;h();const T=La({createBuffer:()=>Ta(""),serverId:m.serverId??null}),C={request:m,show:m.show,document:T,history:Na(T,{now:Date.now}),watchers:[],saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return u=C,T.get().docId,m.serverId,y(C,t(m,{publishRecoveryFacts(P){C.closed||(C.recoveryFacts=P,E())},readShownContent:()=>C.closed?null:C.document.getContent()})),E(),T};return{openWith:p,open:(m,_={})=>p({key:Fe(m),serverId:m,email:_.email,patch:_.patch,show:_.show},"open"),openDraft:(m,_={})=>p({key:Fe(void 0),serverId:null,email:m,patch:_.patch,show:_.show},"open"),startNewDraft:(m,_={})=>p({key:Fe(void 0),serverId:null,email:m,patch:_.patch,show:_.show},"new"),reload:(m,_={})=>p({key:Fe(m),serverId:m,email:_.email,patch:_.patch,show:_.show},"new"),openBlock:(m,_)=>p({key:me(m)?m:Ga(m),serverId:_?.id!=null?String(_.id):null,email:_},"open"),show:(m,_)=>{const T=u;if(!(!T||T.closed))return p({...T.request,patch:m,show:_},"show")},current:()=>u?.document,save:a,saveState:()=>({error:u?.saveError,failures:u?.saveFailures??0,saving:u?.saving===!0}),revisionFacts(){if(!u)return;const m=u.revisionFactsSnapshot;return m&&m.snapshotVersion===u.snapshotVersion&&m.lastRevisionAt===u.lastRevisionAt?m:(u.revisionFactsSnapshot={snapshotVersion:u.snapshotVersion,lastRevisionAt:u.lastRevisionAt},u.revisionFactsSnapshot)},recoveryFacts:()=>u?.recoveryFacts,history:()=>u?.history,forcedHeaders:()=>u?.forcedHeaders,beginForcedHeaders(m){u&&!u.closed&&(u.forcedHeaders=m)},endForcedHeaders(){u&&(u.forcedHeaders=void 0)},onSaved(m){return b.add(m),()=>b.delete(m)},showFacts:()=>u?.show,sessionKey:()=>u?.request.key,openError:()=>u?.error,subscribe(m){return v.add(m),()=>v.delete(m)},close(){u&&(h(),E())}}}var Ni=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function Fi(e){if(e instanceof Ni)return e.reason;if(e instanceof ht)return Fi(e.reason)}function ll(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new Ni("not-found");return Li(n)}}}var ji=x("EmailPort");function dl(e){return e.getInstance(ji)}function cl(e,t){e.inject(ji,t)}var Bi=x("documentSession.restEmailPortFactories");function Ui(e){return e.getInstance(Bi)!==void 0}function Se(e){const t=e.getInstance(Bi);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var ul=x("EmailTermsResolver");function fl(e){return e.getInstance(ul)}var Hi=x("EmailHistoryPort"),pl=x("BlockHistoryPort");function Gi(e){return e.getInstance(pl)}function qi(e){return e.getInstance(Hi)}function hl(e,t){e.inject(Hi,t)}var ml="em_autosave_pending";function gt(e){return`${ml}_${e}`}function gl(e,t){try{sessionStorage.setItem(gt(e),JSON.stringify(t))}catch{}}function vl(e){try{const t=sessionStorage.getItem(gt(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(gt(e)),null):n}catch{return null}}function nt(e){try{sessionStorage.removeItem(gt(e))}catch{}}var bl=2e3,El=5e3,yl=5,_l=5e3,wl=4;function Sl(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function Il(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
996
|
+
`,r=new Function("__amdEnv",n);r(e),typeof e.require=="function"&&typeof e.require.config=="function"&&e.require.config({baseUrl:"./",paths:{core:"useblocks-core.ee20cf1c.js",po:"useblocks-po.ee20cf1c.js",monaco:"static/monaco/index.js"}})}e.define("__delivery__/libs",[],function(){return import("./static/esm/delivery-libs.js")});var i=function(h){var c,l=function(){return c||(c=Promise.resolve().then(h))};return{then:function(p,m){return l().then(p,m)},catch:function(p){return l().catch(p)},finally:function(p){return l().finally(p)}}},o=i(function(){return e.require(["__delivery__/libs"]).then(function(h){return h[0]})});t.React=i(function(){return o.then(function(h){return h.React})}),t.ReactDom=i(function(){return o.then(function(h){return h.ReactDom})}),t.ReactDomClient=i(function(){return o.then(function(h){return h.ReactDomClient})}),t.ReactJsxRuntime=i(function(){return o.then(function(h){return h.ReactJsxRuntime})}),t.ReactJsxDevRuntime=i(function(){return o.then(function(h){return h.ReactJsxDevRuntime})}),t.AntDesignIconBase=i(function(){return o.then(function(h){return h.AntDesignIconBase})}),t.AntDesignCssinjs=i(function(){return o.then(function(h){return h.AntDesignCssinjs})}),t.Classnames=i(function(){return o.then(function(h){return h.Classnames})}),t.Dayjs=i(function(){return o.then(function(h){return h.Dayjs})});var s=i(function(){return Promise.all([o]).then(function(h){var c=h[0]||Object.create(null),l=Object.create(null);for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(l[p]=c[p]);for(var m in l)Object.prototype.hasOwnProperty.call(l,m)&&(t[m]=l[m]);return l})}),d={},a={Antd:"[runtime] `antd` is not available: the compatibility layer for global plugins is not enabled. Add `import 'useblocks/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",AntDesignIcons:"[runtime] `@ant-design/icons` is not available: the compatibility layer for global plugins is not enabled. Add `import 'useblocks/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator."},f={Antd:"[runtime] `antd` is served from the host runtime for backward compatibility. Rebuild the plugin with the current CLI to bundle it from its own copy of the package. This compatibility layer is deprecated.",AntDesignIcons:"[runtime] `@ant-design/icons` is served from the host runtime for backward compatibility. Rebuild the plugin with the current CLI to bundle it from its own copy of the package. This compatibility layer is deprecated."},u=Object.create(null);if(e.registerCompat=function(h){if(!(!h||typeof h!="object"))for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(u[c]=h[c])},e.__compatPending){for(var v=0;v<e.__compatPending.length;v+=1)e.registerCompat(e.__compatPending[v]);e.__compatPending=void 0}for(var b in a)Object.prototype.hasOwnProperty.call(a,b)&&(function(h,c,l){var p=!1,m=function(){if(!(h in u))throw new Error(c);return u[h]};Object.defineProperty(t,h,{configurable:!0,enumerable:!0,get:function(){var w=m();return p||(p=!0),w},set:function(w){u[h]=w}}),Object.defineProperty(d,h,{configurable:!0,enumerable:!0,get:m,set:function(w){u[h]=w}})})(b,a[b],f[b]);var E=t;for(var I in d)Object.prototype.hasOwnProperty.call(d,I)&&(E===t&&(E=Object.create(t)),Object.defineProperty(E,I,Object.getOwnPropertyDescriptor(d,I)));var g=s,y=[],_=function(){for(var h=[],c=0;c<y.length;c+=1)(function(l){var p=t[l];p&&typeof p.then=="function"&&h.push(Promise.resolve(p).then(function(m){t[l]=m}))})(y[c]);return Promise.all(h)},S=typeof e.prefetch=="function"?e.prefetch:void 0;if(e.prefetch=function(){return s.then(_).then(function(){if(typeof S=="function")return S.call(e)})},typeof e.define=="function"){let h=function(c){if(!c||typeof c!="object"&&typeof c!="function"||c.__esModule)return c;if(A){var l=A.get(c);if(l)return l}var p=Object.create(null);Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});for(var m=Reflect.ownKeys(c),w=0;w<m.length;w++){var T=m[w];if(T!=="__esModule"){var O=Object.getOwnPropertyDescriptor(c,T);O&&Object.defineProperty(p,T,O)}}return Object.prototype.hasOwnProperty.call(p,"default")||Object.defineProperty(p,"default",{enumerable:!0,value:c,writable:!1}),A&&A.set(c,p),p};var A=typeof WeakMap<"u"?new WeakMap:null;e.define("react",[],function(){var c=E.React;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.React)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.React;return h(p)})}),e.define("useblocks/runtime/react",[],function(){var c=E.React;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.React)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.React;return h(p)})}),e.define("react-dom",[],function(){var c=E.ReactDom;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.ReactDom)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.ReactDom;return h(p)})}),e.define("useblocks/runtime/react-dom",[],function(){var c=E.ReactDom;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.ReactDom)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.ReactDom;return h(p)})}),e.define("react-dom/client",[],function(){var c=E.ReactDomClient;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.ReactDomClient)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.ReactDomClient;return h(p)})}),e.define("useblocks/runtime/react-dom/client",[],function(){var c=E.ReactDomClient;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.ReactDomClient)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.ReactDomClient;return h(p)})}),e.define("react/jsx-runtime",[],function(){var c=E.ReactJsxRuntime;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.ReactJsxRuntime)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.ReactJsxRuntime;return h(p)})}),e.define("useblocks/runtime/react/jsx-runtime",[],function(){var c=E.ReactJsxRuntime;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.ReactJsxRuntime)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.ReactJsxRuntime;return h(p)})}),e.define("react/jsx-dev-runtime",[],function(){var c=E.ReactJsxDevRuntime;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.ReactJsxDevRuntime)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.ReactJsxDevRuntime;return h(p)})}),e.define("useblocks/runtime/react/jsx-dev-runtime",[],function(){var c=E.ReactJsxDevRuntime;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.ReactJsxDevRuntime)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.ReactJsxDevRuntime;return h(p)})}),e.define("antd",[],function(){var c=E.Antd;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.Antd)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.Antd;return h(p)})}),e.define("useblocks/runtime/antd",[],function(){var c=E.Antd;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.Antd)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.Antd;return h(p)})}),e.define("@ant-design/icons/es/components/AntdIcon",[],function(){var c=E.AntDesignIconBase;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.AntDesignIconBase)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.AntDesignIconBase;return h(p)})}),e.define("useblocks/runtime/@ant-design/icons/es/components/AntdIcon",[],function(){var c=E.AntDesignIconBase;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.AntDesignIconBase)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.AntDesignIconBase;return h(p)})}),e.define("@ant-design/icons",[],function(){var c=E.AntDesignIcons;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.AntDesignIcons)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.AntDesignIcons;return h(p)})}),e.define("useblocks/runtime/@ant-design/icons",[],function(){var c=E.AntDesignIcons;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.AntDesignIcons)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.AntDesignIcons;return h(p)})}),e.define("@ant-design/cssinjs",[],function(){var c=E.AntDesignCssinjs;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.AntDesignCssinjs)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.AntDesignCssinjs;return h(p)})}),e.define("useblocks/runtime/@ant-design/cssinjs",[],function(){var c=E.AntDesignCssinjs;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.AntDesignCssinjs)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.AntDesignCssinjs;return h(p)})}),e.define("classnames",[],function(){var c=E.Classnames;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.Classnames)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.Classnames;return h(p)})}),e.define("useblocks/runtime/classnames",[],function(){var c=E.Classnames;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.Classnames)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.Classnames;return h(p)})}),e.define("dayjs",[],function(){var c=E.Dayjs;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.Dayjs)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.Dayjs;return h(p)})}),e.define("useblocks/runtime/dayjs",[],function(){var c=E.Dayjs;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.Dayjs)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.Dayjs;return h(p)})}),e.define("useblocks-ui-kit",[],function(){var c=E.UiKit;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.UiKit)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.UiKit;return h(p)})}),e.define("useblocks/ui-kit",[],function(){var c=E.UiKit;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.UiKit)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.UiKit;return h(p)})}),e.define("useblocks/ui-kit/icons",[],function(){var c=E.UiKitIcons;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.UiKitIcons)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.UiKitIcons;return h(p)})}),e.define("useblocks-ui-kit/icons",[],function(){var c=E.UiKitIcons;return c&&typeof c.then=="function"?c.then(function(l){return l===void 0?g.then(function(p){return h(p.UiKitIcons)}):h(l)}):c!==void 0?h(c):g.then(function(l){var p=l.UiKitIcons;return h(p)})})}globalThis.__SHARED_RUNTIME_INIT_SENTINEL__="@shared-runtime:init-complete"})();var Ws=new Function("url","return import(url)");function Ys(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function Xs(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Js(e){return e.type==="umd"||e.resolve==="registry"}var Qs=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(Xs(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(Js(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Ws(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,r.onload=()=>t(),r.onerror=()=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(r)})}initSync(e){const t=[];for(const n of e){const r=this._getOrCreate(n,void 0);t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const{ctor:i,options:o}=await this._resolveEntry(r),s=this._getOrCreate(i,o);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 s of e){const d=await this._resolveEntry(s);t.add(d.ctor),n.push(d)}const r=[];this._map.forEach((s,d)=>{t.has(d)||r.push({key:d,plugin:s})});for(let s=r.length-1;s>=0;s--){const{key:d,plugin:a}=r[s];await this._initializingPlugins.get(a),await this._disposePlugin(a,a.constructor.name),this._map.delete(d),this._optionsMap.delete(d),this._readyMap.delete(a),this._resolveMap.delete(a),this._initializingPlugins.delete(a),this._initializedPlugins.delete(a);const f=this._creationOrder.indexOf(a);f>=0&&this._creationOrder.splice(f,1)}const i=[],o=new Set;for(const{ctor:s,options:d}of n){const a=this._getOrCreate(s,d);o.has(a)||(o.add(a),i.push(a))}this._activated&&await this._startPluginsBatch(i)}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,i)=>{let o,s=!1;const d=()=>{s||(s=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,d),r())};this._pluginRegistry.on(e,d),n!==void 0&&n>0&&(o=setTimeout(()=>{s||(s=!0,this._pluginRegistry.off(e,d),i(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),i=this._createPluginInstance(e,r),o=i.constructor.name;this._emitLifecycle({type:"created",plugin:i,name:o}),i.required?.(),this._map.set(n,i),this._creationOrder.push(i),this._setupReadyPromise(i)}return this._map.get(n)}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);try{return Ys(e)?new e(this._context,t):e(this._context,t)||{}}finally{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 i of t){if(this._initializedPlugins.has(i))continue;const o=this._initializingPlugins.get(i);if(o){n.add(o);continue}r.push(i)}if(r.length>0){const i=this._runBatchLifecycle(r);for(const o of r)this._initializingPlugins.set(o,i);n.add(i),i.finally(()=>{for(const o of r)this._initializingPlugins.get(o)===i&&this._initializingPlugins.delete(o)})}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});try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(i){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:i})}}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(i){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:i})}}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)}))}},Zs=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 i of n)try{i.callback(t)}catch{}const r=n.filter(i=>!i.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(i=>(t.ctor=i,t.loading=void 0,this._notifyListeners(e,i),i));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 i={callback:t,once:!1};return r.push(i),{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 i={callback:t,once:!0};return r.push(i),{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(i=>i.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)}}}},ea=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()}},ir=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 ta(e,t){return t+e}function na(){return typeof performance>"u"?Date.now():ta(performance.now(),performance.timeOrigin)}var ra="emailmaker:diagnostics",ia="diagnostics",oa="diagnostics";function or(e,t){return t?`${e}${e.includes("?")?"&":"?"}${oa}=1`:e}var Rt;function sa(){try{const e=new URLSearchParams(window.location.search).get(ia);return e===null?void 0:e!=="0"}catch{return}}function aa(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function la(){try{const e=window.localStorage.getItem(ra);return e===null?void 0:e==="1"}catch{return}}function $e(){return Rt===void 0&&(Rt=typeof window>"u"?!1:sa()??aa()??la()??!1),Rt}function da(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var Q={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"},Mm=Object.values(Q),km=[Q.canvasPainted,Q.canvasSettled,Q.appVisible,Q.editorVisible],ca=5e3,ua=3e3,sr="diagnosticsStore",nt,Ne;function ar(){return{marks:new ir(ca),resources:new ir(ua)}}function Ei(){if(Ne)return Ne;const e=xn();return e?(Ne=e[sr]??nt??ar(),e[sr]=Ne,nt=void 0,Ne):(nt??=ar(),nt)}function z(e,t){$e()&&Ei().marks.push({phase:e,at:na(),...t})}function xn(){if(typeof window.__useblocks__<"u"&&window.__useblocks__)return window.__useblocks__;if(typeof window>"u")return;const e=window[da()];return e!==null&&typeof e=="object"?e:void 0}function fa(e){const t=e.length,n=Ei();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function pa(){const e=xn();return!e||!Array.isArray(e.diagnosticsBuffer)?0:fa(e.diagnosticsBuffer)}var ha="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function Ln(){const e=new Error(ha);return e.name="DestroyedInstanceError",e}function rn(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 o=e,s=t;return o.length===s.length&&o.every((d,a)=>rn(d,s[a]))}const r=Object.keys(e),i=Object.keys(t);return r.length!==i.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&rn(e[o],t[o]))}function yi(e,t){const n={watch(r){let i,o=!1;return e.watch(s=>{const d=t(s);o&&rn(i,d)||(i=d,o=!0,r(d))})},select(r){return yi(n,r)}};return n}function Me(...e){let t=e[0],n=e.length>0;const r=new Set,i={get(){return n?t:void 0},set(o){t=o,n=!0;for(const s of Array.from(r))s(o)},watch(o){return r.add(o),n&&o(t),{dispose:()=>r.delete(o)}},select(o){return yi(i,o)}};return i}var _i=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:As.UrlEncoded,...t})},wi=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 ma(e){return String(e||"").trim()||void 0}var ga=class extends ee{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=ma(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("AppInitService");function va(e){return async()=>{const t=await e();return(await new _i(t).app_init_create({})).data}}function ba(e){e.injectFactory(Mn,()=>{const t=new ga({options:e.getInstance(se),isStandalone:()=>!!e.getInstance(he),resolveRestBaseUrl:n=>n?nr(n):nr()||void 0,setRestBaseUrl:n=>{e.getInstance(zs)?.setOptions(n?{baseUrl:n}:{})},fallbackAppInit:va(()=>e.getInstanceAsync(ps)),publish:n=>{e.inject(Pe,n)}});return e.getInstance(j)?.addDisposable(t),t},!0)}var kn=L("documentSession.emailDocuments");function Pt(e){return e?.getInstance(kn)}var Ea=L("RevisionServiceFlag");function ya(e){return e.getOrCreateInstance(Ea,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function Si(e){return ya(e).isEnabled()}var _a=L("EmailRightsResolver");function wa(e,t){const n=e.getInstance(_a);return n?n(t):!0}var Ii=L("EmailHistoryAvailabilityResolver");function Sa(e){return e.getInstance(Ii)!==void 0}async function Ia(e){const t=e.getInstance(Ii);if(!t)return!0;try{return await t()}catch{return!1}}var Nn={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},Ti=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],Ai=2e4,Ta=Ti.reduce((e,t)=>e+Nn[t],0),Ci=Ai+Ta+3e3;function Aa(e){return Ti.reduce((t,n)=>t+Ri(n,e),0)}function Ri(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:Nn[e]}function Pi(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:Ci}function Di(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:Ai}function Oi(e=Ci){return e+3e3}function xi(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}var Ca=()=>Oi();function Ra(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function Pa(e){return t=>Ra(e.getOrCreateInstance(B.BEFORE_SAVE_EMAIL,()=>new pe).fire(t),Ca())}function Da(e){return e!=null&&e!==""}var Oa;function wt(e,t){return Oa?.capture(e,t)}function xa(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function rt(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var ie=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${rt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${rt(this.oldText)}")`:`(replace@${this.oldPosition} "${rt(this.oldText)}" with "${rt(this.newText)}")`}};function lr(e,t){return e===null||e.length===0?t:new La(e,t).compress()}var La=class ae{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,n){this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),i=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(i===null)break;this._acceptCurr(i),i=this._getCurr(++n);continue}if(i===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(i.oldEnd<=r.newPosition){this._acceptCurr(i),i=this._getCurr(++n);continue}if(r.newEnd<=i.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(i.oldPosition<r.newPosition){const[a,f]=ae._splitCurr(i,r.newPosition-i.oldPosition);this._acceptCurr(a),i=f;continue}if(r.newPosition<i.oldPosition){const[a,f]=ae._splitPrev(r,i.oldPosition-r.newPosition);this._acceptPrev(a),r=f;continue}let s,d;if(i.oldEnd===r.newEnd)s=r,d=i,r=this._getPrev(++t),i=this._getCurr(++n);else if(i.oldEnd<r.newEnd){const[a,f]=ae._splitPrev(r,i.oldLength);s=a,d=i,r=f,i=this._getCurr(++n)}else{const[a,f]=ae._splitCurr(i,r.newLength);s=r,d=a,r=this._getPrev(++t),i=f}this._result[this._resultLen++]=new ie(s.oldPosition,s.oldText,d.newPosition,d.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=d.newLength-d.oldLength}const o=ae._merge(this._result);return ae._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=ae._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=ae._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new ie(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new ie(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),i=t.newText.substr(n);return[new ie(t.oldPosition,t.oldText,t.newPosition,r),new ie(t.oldEnd,"",t.newPosition+n,i)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),i=t.oldText.substr(n);return[new ie(t.oldPosition,r,t.newPosition,t.newText),new ie(t.oldPosition+n,i,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,i=t[0];for(let o=1;o<t.length;o++){const s=t[o];i.oldEnd===s.oldPosition?i=new ie(i.oldPosition,i.oldText+s.oldText,i.newPosition,i.newText+s.newText):(n[r++]=i,i=s)}return n[r++]=i,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let i=0;i<t.length;i++){const o=t[i];o.oldText!==o.newText&&(n[r++]=o)}return n}};function Ma(e){return new ie(e.newPosition,e.newText,e.oldPosition,e.oldText)}function ka(e){return e.map(Ma)}function dr(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function Na(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const i=t[r];n=n.slice(0,i.oldPosition)+i.newText+n.slice(i.oldEnd)}return n}function Fa(e,t,n){let r=0;const i=e.start===e.end;for(const o of t){const s=o.newLength-o.oldLength;if(o.oldLength===0){const d=o.oldPosition;if(i&&d===e.start)r+=n==="after"?s:0;else{if(e.start<d&&d<e.end)return null;d<=e.start&&(r+=s)}continue}if(i){if(e.start>=o.oldEnd)r+=s;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)r+=s;else if(e.end>o.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var gt=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},cr=0,ja=Math.random().toString(36).slice(2,8);function Ba(){return cr+=1,`doc-${ja}-${cr}`}function Ua(e){const t=e.createBuffer(),n=e.docId??Ba();let r=e.serverId??null,i=0,o=null,s=e.attributes??{};const d=new Set;let a=!1,f=!1,u;const v=new Set;let b=null;const E=()=>(b?.version!==i&&(b={version:i,value:t.read()}),b.value),I=g=>Object.entries(g).some(([y,_])=>s[y]!==_);return{get:()=>({docId:n,serverId:r,version:i,savedVersion:o,attributes:s}),getContent:E,mutate(g,{source:y}){if(a)return i;const _=g.changes?.length?g.changes:void 0,S=_?Na(E(),_):g.content!==void 0?g.content:void 0,A=S!==void 0&&S!==E(),h=g.attributes!==void 0&&I(g.attributes);if(!A&&!h)return i;const c=!(i>(o??-1));return A&&t.write(S),h&&(s={...s,...g.attributes}),i+=1,y!=="user"&&c&&(o=i),d.forEach(l=>l({source:y,version:i,changes:_})),i},markSaved(g,y){const _={serverId:r,savedVersion:o};y!==void 0&&(r=y),(o===null||g>o)&&(o=g),(_.serverId!==r||_.savedVersion!==o)&&d.forEach(S=>S({source:"system",version:i}))},markReady(){f||u!==void 0||(f=!0,v.forEach(g=>g.resolve()),v.clear(),d.forEach(g=>g({source:"system",version:i})))},isReady:()=>f,markFailed(g){f||u!==void 0||a||(u=g,v.forEach(y=>y.reject(new gt(g))),v.clear(),d.forEach(y=>y({source:"system",version:i})))},failure:()=>u,whenReady(){return f?Promise.resolve():u!==void 0?Promise.reject(new gt(u)):a?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((g,y)=>{v.add({resolve:g,reject:y})})},subscribe(g){return d.add(g),()=>d.delete(g)},isNew:()=>r===null,isDirty:()=>i>(o??-1),isDisposed:()=>a,dispose(){a=!0,v.forEach(g=>g.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),v.clear(),d.clear(),t.dispose()}}}var Ha=500,Ga=100,Dt=0;function qa(e,t={}){const n=t.groupIntervalMs??Ha,r=t.maxSteps??Ga,i=t.now??(()=>0);let o=[],s=0,d=Dt+=1,a=null,f=!1,u=!1,v=!1;const b=new Set,E=()=>b.forEach(l=>l()),I=(l,p)=>{if(l.length){u=!0;try{e.mutate({changes:l},{source:p})}finally{u=!1}}},g=l=>I(l,"user"),y=l=>{const p=i();f&&a!==null&&p-a<n?o[s-1]=lr(o[s-1],l):(o=o.slice(0,s),o.push(l),s=o.length,f=!0,o.length>r&&(o=o.slice(o.length-r),s=o.length,d=Dt+=1)),a=p,E()},_=()=>{f=!1,a=null},S=l=>{if(!l.length)return;const p=o.length>s;p&&(o=o.slice(0,s)),s>0&&(o[s-1]=lr(o[s-1],l)),_(),p&&E()},A=e.subscribe(({source:l,changes:p})=>{if(!(v||u||!p?.length)){if(l==="remote"){h();return}if(l!=="user"){S(p);return}y(p)}}),h=()=>{o=[],s=0,_(),d=Dt+=1,E()},c=()=>{if(s===0)return!1;const l=ka(o[s-1]);return dr(e.getContent(),l)?(g(l),s-=1,_(),!0):(o=o.slice(0,s-1),s=o.length,_(),E(),!1)};return{canUndo:()=>s>0,canRedo:()=>s<o.length,undo(){c()&&E()},redo(){if(!(s>=o.length)){if(!dr(e.getContent(),o[s])){o=o.slice(0,s),_(),E();return}g(o[s]),s+=1,_(),E()}},clear:h,applyWithoutHistory(l){const p=e.get().version;if(I(l,"system"),e.get().version===p){_();return}S(l)},getPast:l=>o.slice(0,s).reverse().slice(0,l),getFuture:l=>o.slice(s).reverse().slice(0,l),createSnapshot:()=>({stackId:d,index:s}),restoreSnapshot(l){if(l.stackId!==d||l.index>s)return!1;for(;s>l.index;)if(!c())return E(),!1;return E(),!0},subscribe(l){return b.add(l),()=>b.delete(l)},dispose(){v=!0,A(),b.clear(),o=[],s=0}}}var $a=["edit","move","resize","insert"];function Ot(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function za(e){return typeof e=="string"?e:null}function Va(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function Ka(e){return $a.includes(e)?e:null}function Wa(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:za(t.originId),changeId:Ot(t.changeId),rev:Ot(t.rev),baseRev:Ot(t.baseRev),expected:Va(t.expected),intent:Ka(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var ur=class extends Error{reason;constructor(e){super(`сохранение не состоялось: ${e}`),this.name="SaveRefusedError",this.reason=e}},Li="draft";function je(e){return e==null||e===""?Li:String(e)}function Ya(e){return e==null||e===""?`${on}${Li}`:`${on}${String(e)}`}var on="block:";function me(e){return e?.startsWith(on)===!0}function Be(e){return me(e.sessionKey())?void 0:e.current()}function He(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return z(`show:gate:${e}`,{kind:"wait"}),t.then(i=>(z(`show:gate:${e}:end`,{kind:"wait"}),i),i=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw An(i)?(`${e}`,{...n}):(`${e}`,{error:xi(i),...n},void 0),i})}function Mi(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function ki(e,{freshSince:t}={}){return!(!e?.slug?.includes("autosave")||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function Xa(e,t={}){const n=Mi((e??[]).filter(r=>r?.html?.trim()));return ki(n,t)?n:null}function Ja(e){const t=Date.parse(Mi(e)?.modified??"");return{autosave:Xa(e),...Number.isFinite(t)?{latestAt:t}:{}}}function Qa({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var Ni=e=>e.replace(/\r\n?/g,`
|
|
997
|
+
`),fr=["recovery","plugin","rest"],Za=["subject","preheader"];function el(e){let t={},n;for(let i=fr.length-1;i>=0;i--){const o=e.get(fr[i]);o&&(o.attributes&&(t={...t,...o.attributes}),o.content!==void 0&&(n=o.content))}const r=e.get("plugin")?.attributes;for(const i of Za){const o=r?.[i];typeof o=="string"&&o!==""&&(t={...t,[i]:o})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function Fi(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?Ni(t.content):void 0,i=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...i?{changes:[new ie(0,n,0,r)]}:{}},{source:"remote"})}var pr=e=>typeof e=="string"?e.trim():"";function tl(e,t,n){const{version:r,attributes:i}=e.get(),o=i,s=pr(o.title)||pr(o.subject);return{version:r,payload:{html:e.getContent(),title:s,subject:o.subject,preheader:o.preheader,description:o.description,common_styles:o.common_styles||"",meta:o.meta,utm_parameters:o.utm_parameters,parent_email:o.parent_email,is_template:o.is_template||!1,is_inited:o.is_inited,tags:o.tags,emailtags:o.emailtags,group:o.group,renderGuid:e.get().docId,project:t.project??o.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source}}}async function nl(e,t,n,r,i){if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(i);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,i):t.saveAutosave(r,i)}function ge(e,t=!1){const n={};for(const r of Object.keys(e)){let i=e[r];i!==void 0&&!(typeof i=="number"&&Number.isNaN(i))&&(t&&typeof i=="object"&&i!==null&&(i=ge(i)),n[r]=i)}return n}var rl=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function ji(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!rl.has(t))):{}}function vt(e,t,n={}){e&&e.mutate({attributes:il(e.get().attributes,t)},{source:n.source??"user"})}function il(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function Fn(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function ol(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function Bi(e){if(!e)return null;const t=ji(e);return e.common_styles!==void 0&&(t.common_styles=ol(e.common_styles)),Fn(e.html,t)}function Ui(e){return e?Fn(e.html,ge(ji(e))):null}var sl=["common_styles","subject","preheader","meta"];function hr(e){if(!e?.html?.trim())return null;const t={};for(const n of sl)al(n,e[n])&&(t[n]=e[n]);return Fn(e.html,t)}function al(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 ll=10,dl=(e,t)=>e.key===t.key&&cl(e.serverId,t.serverId),cl=(e,t)=>e==null||e===t;function ul(e){return typeof e?.then=="function"}var mr=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},Hi=e=>{e.request.serverId!=null&&e.document.markSaved(e.document.get().version)},fl=e=>{Fi(e.document,el(e.reports)),Hi(e)},xt=(e,t)=>{if(!e.ready){fl(e);return}Fi(e.document,t)},pl=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 hl(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:i,resolveTerms:o,canEdit:s,notifyBeforeSave:d,onAdapterError:a,onTimeout:f}=e;let u;const v=new Set,b=new Set,E=()=>v.forEach(m=>m()),I=(m,w)=>{if(!(m.closed||m.ready)){if(m.error!==void 0){m.document.markFailed(m.error),m.document.get().docId;return}Hi(m),m.ready=!0,m.document.markReady(),m.document.get().docId,[...m.reports.keys()]}},g=(m,w,T)=>{a?.(w.id,T),!(!w.required||m.closed)&&(m.error=T,m.document.get().docId,w.id,E())},y=(m,w)=>{const T=new Set(w.map(R=>R.id));w.forEach(R=>{R.watch&&m.watchers.push(R.watch(C=>m.closed?!1:m.ready&&C?.content!==void 0&&Qa({hasUnsavedUserEdit:m.document.isDirty()})==="skip"?(m.document.get().docId,R.id,!1):(C&&m.reports.set(R.id,C),xt(m,C),!0)))});const O=(R,C)=>{m.closed||(C&&m.reports.set(R.id,C),xt(m,C))},k=()=>{T.size>0||m.closed||(mr(m),I(m,[]))},W=[];if(w.forEach(R=>{let C;try{C=R.load()}catch(D){g(m,R,D),T.delete(R.id);return}if(ul(C)){W.push({id:R.id,required:R.required,load:()=>C});return}O(R,C),T.delete(R.id)}),W.length===0){k();return}m.timer=setTimeout(()=>{m.timer=void 0,f?.([...T]),m.document.get().docId,[...T],I(m,[...T])},n),m.timer.unref?.(),W.forEach(R=>{R.load().then(C=>O(R,C)).catch(C=>{g(m,R,C)}).finally(()=>{T.delete(R.id),k()})})},_=async(m,w,T)=>{if(T==="snapshot"||T==="anchor")return;const O=o?.();if(O)return O.resolve({project:w.project??m.project,tags:(m.tags??[]).map(k=>({name:k}))})},S=m=>{if(m.lock===!0&&s?.(m)===!1)return new ur("locked");const w=m.tags?.length??0,T=m.emailtags?.length??0;if(Math.max(w,T)>ll)return new ur("too-many-tags")},A=async(m,w,T)=>{try{await m.document.whenReady()}catch(C){return m.saveError=C,m.saveFailures+=1,m.saveFailures,!1}if(m.closed)return!1;const O=S(m.document.get().attributes);if(O)return m.saveError=O,m.saveFailures+=1,O.reason,E(),!1;if(d&&(await d(pl(m)).catch(()=>{}),m.closed))return!1;let k;try{k=await _(m.document.get().attributes,T,w)}catch(C){return m.saveError=C,m.saveFailures+=1,m.saveFailures,E(),!1}if(m.closed)return!1;const{payload:W,version:R}=tl(m.document,T,k);m.document.get().docId;try{const C=m.document.get().serverId!=null,D=await nl(r(),i(m.request.key),w,m.document.get().serverId,W);if(m.closed)return!0;let x;if(w==="snapshot"||w==="anchor"){const M=D?.modified!=null?Date.parse(D.modified):NaN;x=Number.isFinite(M)?M:Date.now(),m.snapshotVersion=R,m.lastRevisionAt=x}else m.document.markSaved(R,D?.id!=null?String(D.id):void 0);const U=m.document.get().serverId;!C&&U!=null&&(m.recoveryFacts={emailId:U,historyLoaded:!0,isRecovering:!1}),m.saveError=void 0,m.saveFailures=0,m.document.get().serverId,E();const J={intent:w,serverId:m.document.get().serverId,created:!C,...x!==void 0?{revisionAt:x}:{}};return b.forEach(M=>M(J)),!0}catch(C){return m.saveError=C,m.saveFailures+=1,m.saveFailures,E(),!1}},h=()=>{u&&(u.closed=!0,u.watchers.forEach(m=>m()),u.watchers=[],mr(u),u.history.dispose(),u.document.dispose(),u=void 0)},c=(m,w,T)=>{let O=!1;w.show&&(m.show?.id!==w.show.id||m.show.token!==w.show.token)&&(m.show=w.show,O=!0,{docId:m.document.get().docId,...w.show});const k=T==="show"?Ui(w.patch):null;k&&(m.reports.set("plugin",k),xt(m,k)),O&&E()},l=(m,w={})=>{const T=u;return!T||T.closed?Promise.resolve(!1):T.saving?m==="snapshot"?Promise.resolve(!1):(T.inFlight??Promise.resolve(!1)).then(()=>l(m,w)):(T.saving=!0,T.inFlight=A(T,m,w).finally(()=>{T.saving=!1,T.inFlight=void 0}),T.inFlight)},p=(m,w="open")=>{if(u&&!u.closed&&w!=="new"&&dl(u.request,m))return c(u,m,w),u.document;h();const T=Ua({createBuffer:()=>xa(""),serverId:m.serverId??null}),O={request:m,show:m.show,document:T,history:qa(T,{now:Date.now}),watchers:[],saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return u=O,T.get().docId,m.serverId,y(O,t(m,{publishRecoveryFacts(k){O.closed||(O.recoveryFacts=k,E())},readShownContent:()=>O.closed?null:O.document.getContent()})),E(),T};return{openWith:p,open:(m,w={})=>p({key:je(m),serverId:m,email:w.email,patch:w.patch,show:w.show},"open"),openDraft:(m,w={})=>p({key:je(void 0),serverId:null,email:m,patch:w.patch,show:w.show},"open"),startNewDraft:(m,w={})=>p({key:je(void 0),serverId:null,email:m,patch:w.patch,show:w.show},"new"),reload:(m,w={})=>p({key:je(m),serverId:m,email:w.email,patch:w.patch,show:w.show},"new"),openBlock:(m,w)=>p({key:me(m)?m:Ya(m),serverId:w?.id!=null?String(w.id):null,email:w},"open"),show:(m,w)=>{const T=u;if(!(!T||T.closed))return p({...T.request,patch:m,show:w},"show")},current:()=>u?.document,save:l,saveState:()=>({error:u?.saveError,failures:u?.saveFailures??0,saving:u?.saving===!0}),revisionFacts(){if(!u)return;const m=u.revisionFactsSnapshot;return m&&m.snapshotVersion===u.snapshotVersion&&m.lastRevisionAt===u.lastRevisionAt?m:(u.revisionFactsSnapshot={snapshotVersion:u.snapshotVersion,lastRevisionAt:u.lastRevisionAt},u.revisionFactsSnapshot)},recoveryFacts:()=>u?.recoveryFacts,history:()=>u?.history,forcedHeaders:()=>u?.forcedHeaders,beginForcedHeaders(m){u&&!u.closed&&(u.forcedHeaders=m)},endForcedHeaders(){u&&(u.forcedHeaders=void 0)},onSaved(m){return b.add(m),()=>b.delete(m)},showFacts:()=>u?.show,sessionKey:()=>u?.request.key,openError:()=>u?.error,subscribe(m){return v.add(m),()=>v.delete(m)},close(){u&&(h(),E())}}}var Gi=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function qi(e){if(e instanceof Gi)return e.reason;if(e instanceof gt)return qi(e.reason)}function ml(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new Gi("not-found");return Bi(n)}}}var $i=L("EmailPort");function gl(e){return e.getInstance($i)}function vl(e,t){e.inject($i,t)}var zi=L("documentSession.restEmailPortFactories");function Vi(e){return e.getInstance(zi)!==void 0}function Se(e){const t=e.getInstance(zi);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var bl=L("EmailTermsResolver");function El(e){return e.getInstance(bl)}var Ki=L("EmailHistoryPort"),yl=L("BlockHistoryPort");function Wi(e){return e.getInstance(yl)}function Yi(e){return e.getInstance(Ki)}function _l(e,t){e.inject(Ki,t)}var wl="em_autosave_pending";function bt(e){return`${wl}_${e}`}function Sl(e,t){try{sessionStorage.setItem(bt(e),JSON.stringify(t))}catch{}}function Il(e){try{const t=sessionStorage.getItem(bt(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(bt(e)),null):n}catch{return null}}function it(e){try{sessionStorage.removeItem(bt(e))}catch{}}var Tl=2e3,Al=5e3,Cl=5,Rl=5e3,Pl=4;function Dl(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function Ol(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
998
998
|
`,`
|
|
999
999
|
`)===t.replaceAll(`\r
|
|
1000
1000
|
`,`
|
|
1001
|
-
`)}function Tl({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:i,onFacts:o,onLate:s,onError:d,pageLoadTs:l=Sl()}){let f=null,u=!1,v=!1,b=0,E={emailId:e,historyLoaded:!1,isRecovering:!1},I=null;const g=new Promise(R=>{I=R}),y=R=>{E={...E,...R},o(E)},w=R=>{b+=1,y({applied:{phase:R,seq:b}})},S=()=>{f?.timer&&clearTimeout(f.timer),f=null},A=R=>{if(!v){if(I){const O=I;I=null,O(R),R.revision&&w(R.phase);return}s(R)&&R.revision&&w(R.phase)}},h=()=>{if(!f||v)return;const R=f.phase==="fast",O=R?bl:_l,z=R?yl:wl;f.timer=setTimeout(()=>{const B=f;if(!(!B||v)){if(B.attempts+=1,_(),R&&B.attempts>=z){const{pending:W}=B;nt(e),y({isRecovering:!1}),A({revision:{html:W.html,common_styles:W.common_styles,subject:W.subject,preheader:W.preheader},phase:"timeout"}),u=!0,B.phase="bg",B.attempts=0,h();return}if(!R&&B.attempts>=z){nt(e),S(),y({isRecovering:!1}),u=!0;return}h()}},O),f.timer.unref?.()},c=R=>{f={phase:"fast",attempts:0,pending:R,timer:null},y({isRecovering:!0}),h()},a=(R,O)=>Pi(R.autosave,O===void 0?{}:{freshSince:O})?R.autosave:null,p=R=>{if(v)return;if(y({historyLoaded:!0,latestRevisionAt:R.latestAt!==void 0&&Number.isFinite(R.latestAt)?R.latestAt:void 0}),n&&f){const B=a(R,f.pending.sentAt);if(!B)return;const W=f.phase==="fast"?"found":"bg";nt(e),S(),y({isRecovering:!1}),u=!0,A({revision:B,phase:W});return}if(u)return;const O=n?vl(e):null,z=O&&(O.sentAt<l||!Il(O.html,i()))?O:null;if(z){const B=a(R,z.sentAt);if(B){nt(e),u=!0,A({revision:B,phase:"found"});return}c(z);return}u=!0,A({revision:a(R),phase:"normal"})},m=R=>{v||(d?.(R),E.historyLoaded||(y({historyLoaded:!1,latestRevisionAt:void 0}),P()),!f&&A({revision:null,phase:"normal"}))},_=()=>t(e).then(p).catch(m);let T,C=!1;const P=()=>{C||f||v||(C=!0,T=setTimeout(()=>{T=void 0,!v&&!E.historyLoaded&&_()},El))},j=()=>{v||(y({historyLoaded:!1,latestRevisionAt:void 0}),A({revision:null,phase:"normal"}))};return r?r().then(R=>R?_():j()):_(),{verdict:()=>g,dispose(){v=!0,T!==void 0&&(clearTimeout(T),T=void 0),S()}}}function Al({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:i,onFacts:o}){let s=null;const d=Tl({emailId:r,readAutosave:l=>e.readAutosave(l),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:i,onFacts:o,onLate:({revision:l,phase:f})=>{const u=or(l);return s?.(u)??!1},onError:l=>{l instanceof Error&&l.message}});return{id:"recovery",load:()=>d.verdict().then(({revision:l})=>or(l)),watch(l){return s=l,()=>{s=null,d.dispose()}}}}function $i(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){gl(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const i=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),i}}}function Cl(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const i=await t.updateEmail(n,r);return await e.updateEmail(n,r),i}}}var zi=x("CurrentUser"),Vi={};function Ki(e){return e.getOrCreateInstance(zi,()=>Me(Vi))}function Wi(e){return e?.getInstance(zi)?.get()??Vi}function Yi(e){return e?.getInstance(we)?.get()??{}}var Rl=1.5;function Pl(e){return!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=Rl*e.autosaveTimeoutMs?"none":"revision"}var Dl=4;function Ol(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:i}=e,o=e.readFailures??(()=>0),s=()=>n().autosaveTimeoutMs*2**Math.min(o(),Dl),d=()=>{const w=t();if(!w||w.isDisposed())return"none";const{latestRevisionAt:S,snapshotVersion:A,...h}=n();return Pl({...h,isDirty:w.isDirty(),isNew:w.isNew(),isReady:w.isReady(),latestRevisionAgeMs:S!=null?Date.now()-S:void 0,isSnapshotSent:A!=null&&A===w.get().version})},l=()=>{const w=t();if(!w||w.isDisposed())return!1;if(!w.isDirty())return w.isNew();const{snapshotVersion:S}=n();return!(S!=null&&S===w.get().version)};let f,u,v,b,E=!1;const I=()=>{u=void 0;const w=t();if(!w||w.isDisposed())return;if(w.get().docId!==f){g();return}const S=d();S==="create"?r():S==="revision"?i():l()&&(f=w.get().docId,u=setTimeout(I,s()))},g=()=>{const w=t();E||!w||u!==void 0||d()==="none"&&!l()||(f=w.get().docId,u=setTimeout(I,s()))},y=()=>{const w=t();w!==v&&(b?.(),v=w,b=w?.subscribe(g),u!==void 0&&(clearTimeout(u),u=void 0))};return y(),g(),{refresh:()=>{E||(y(),g())},stop:()=>{E=!0,b?.(),b=void 0,v=void 0,u!==void 0&&(clearTimeout(u),u=void 0)}}}var Xi=x("documentSession.autosaveUiFacts"),Ji={isUserBusy:!1,saveContext:{}};function xl(e){return e.getOrCreateInstance(Xi,()=>Me(Ji))}function ar(e){return e?.getInstance(Xi)?.get()??Ji}var Ll=1e4;function Ml(e,t){const n=()=>{const l=t.current(),f=l?.get().serverId??void 0,u=me(t.sessionKey()),v=t.recoveryFacts(),b=v?.emailId===f?v:void 0,E=t.revisionFacts(),I=b?.latestRevisionAt,g=E?.lastRevisionAt,y=Wi(e).profile;return{isInited:u||l?.get().attributes.is_inited===!0,isEnabled:!!y?.autosaves,isHistoryLoaded:b?.historyLoaded===!0,isUserBusy:ar(e).isUserBusy,autosaveTimeoutMs:Yi(e).autosaveTimeout||Ll,latestRevisionAt:I!==void 0||g!==void 0?Math.max(I??0,g??0):void 0,snapshotVersion:E?.snapshotVersion}},r=()=>{const l=ar(e).saveContext;return{...l,project:l.project??t.current()?.get().attributes.project}},i=Ol({readDocument:()=>t.current(),readEnvironment:n,readFailures:()=>t.saveState().failures,onCreate:()=>{me(t.sessionKey())||t.save("materialize",r())},onRevision:()=>{t.save("snapshot",{project:r().project})}}),o=t.subscribe(i.refresh),s=Ki(e).watch(()=>i.refresh()),d=xl(e).watch(()=>i.refresh());return()=>{o(),s.dispose(),d.dispose(),i.stop()}}var lr=12e3;function ve(e){return e.getOrCreateInstance(Cn,()=>{const t=al({resolveAdapters:(r,i)=>Fl(r,e,i),resolveWritePort:()=>Qi(e),resolveHistoryPort:r=>me(r)?eo(e):Zi(e),resolveTerms:()=>fl(e),canEdit:r=>ma(e,r),notifyBeforeSave:wa(e),timeoutMs:lr,onAdapterError:(r,i)=>{i instanceof Error&&i.message,yt(i,{origin:"email-source-adapter",tags:{source:r}})},onTimeout:r=>{}}),n=Ml(e,t);return e.getInstance(N)?.addDispose(n),t})}function Dn(e){return e?.getInstance(Cn)}function Qi(e){const t=dl(e);return t?On(e)?Cl(t,Se(e).email(e)):t:Se(e).email(e)}function kl(e){return qi(e)!==void 0||Ui(e)}function Zi(e){const t=qi(e);return t?On(e)?($("port:history:server-backed"),$i(t,Se(e).history(e))):($("port:history:integrator"),t):($("port:history:rest (порт не зарегистрирован)"),Se(e).history(e))}function eo(e){const t=Gi(e);return t?On(e)?($("port:block-history:server-backed"),$i(t,Se(e).blockHistory(e))):($("port:block-history:integrator"),t):($("port:block-history:rest (порт не зарегистрирован)"),Se(e).blockHistory(e))}function Nl(e){return Gi(e)!==void 0||Ui(e)}function On(e){return bi(e)}function Fl({email:e,patch:t,serverId:n,key:r},i,o){const s=[];e?s.push({id:"rest",load:()=>Li(e),required:!0}):n&&s.push(ll(Qi(i),n)),t&&s.push({id:"plugin",load:()=>Mi(t)});const d=me(r);return Sa(n)&&(d?Nl(i):kl(i))&&s.push(Al({port:d?eo(i):Zi(i),revisionServiceEnabled:bi(i),...!d&&ga(i)?{isHistoryAvailable:()=>va(i)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:l=>o.publishRecoveryFacts(l)})),s}function X(e){return e.getOrCreateInstance(We,()=>new Ye)}var to=new WeakMap,en=new WeakMap;function ue(e){return to.get(e)??0}function no(e,t){let n=en.get(e);return n||(n=new Set,en.set(e,n)),n.add(t),()=>{n?.delete(t)}}function jl(e){to.set(e,ue(e)+1),en.get(e)?.forEach(t=>t())}function Bl(e){const t=ve(e),n=X(e).addListener(k.APPLICATION_HAS_AMP,r=>{je(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(N)?.addDispose(()=>n.dispose())}function Ul(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Hl(e){const t=e.fetchImpl??((o,s)=>fetch(o,s)),n=e.pageHost??(()=>window.location.hostname),r=new Set,i=o=>{try{const s=new URL(o,window.location.href);return s.protocol!=="https:"&&s.protocol!=="http:"?!1:s.hostname===n()||e.sourceHosts().includes(s.hostname)}catch{return!1}};return{accepts:i,async load(o){if(!i(o))return;const s=!r.has(o);r.add(o);try{const d=await t(o,{mode:"cors",credentials:"omit",cache:s?"no-cache":"default"});if(!d.ok)return;const l=await d.blob();return Ul(l)?l:void 0}catch{return}}}}var _e={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function Gl(e){const t={maxBytes:e.maxBytes??_e.maxBytes,maxImageBytes:e.maxImageBytes??_e.maxImageBytes,ttlMs:e.ttlMs??_e.ttlMs},n=e.now??(()=>Date.now()),r=new Map,i=new Map,o={hits:0,loads:0,failures:0};let s=0;const d=v=>{const b=r.get(v);b&&(s-=b.bytes,r.delete(v))},l=v=>t.ttlMs<=0||n()-v.storedAt<t.ttlMs,f=()=>{if(s<=t.maxBytes)return;const v=[...r.entries()].sort((b,E)=>b[1].usedAt-E[1].usedAt);for(const[b]of v){if(s<=t.maxBytes)return;d(b)}},u=(v,b)=>{b.size>t.maxImageBytes||(r.set(v,{blob:b,bytes:b.size,storedAt:n(),usedAt:n()}),s+=b.size,f())};return{async get(v){const b=r.get(v);if(b&&l(b))return b.usedAt=n(),o.hits+=1,b.blob;b&&d(v);const E=i.get(v);if(E!==void 0)return E;o.loads+=1;const I=(async()=>{try{const g=await e.load(v);return g?u(v,g):o.failures+=1,g}catch{o.failures+=1;return}finally{i.delete(v)}})();return i.set(v,I),I},forget(v){d(v),i.delete(v)},clear(){r.clear(),i.clear(),s=0},stats(){return{entries:r.size,bytes:s,...o}}}}var ql=["emcdn.ru","scr.emcdn.ru"];function $l(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 zl(e,t){const n=(r,i)=>{const o=new Set(i?t:[]);for(const s of r){const d=$l(s);d&&o.add(d)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function dr(e){const t=e??{},n=t.isPlugin!==!0?ql:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],..._e};const i=r===!0||r===void 0?{}:r;return{enabled:i.enabled!==!1,sourceHosts:zl(i.sourceHosts,n),maxBytes:i.maxBytes??_e.maxBytes,maxImageBytes:i.maxImageBytes??_e.maxImageBytes,ttlMs:i.ttlMs??_e.ttlMs}}function Vl(e){const t=X(e),n=e.getInstance(we);let r=dr(n?.get());const i=Hl({sourceHosts:()=>r.sourceHosts}),o=Gl({load:I=>i.load(I),maxBytes:r.maxBytes,maxImageBytes:r.maxImageBytes,ttlMs:r.ttlMs}),s=()=>{t.send(k.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:r.enabled,sourceHosts:[...r.sourceHosts]})},d=t.onInit(()=>s()),l=n?.watch(()=>{const I=dr(n.get()),g=JSON.stringify(I)!==JSON.stringify(r);r=I,I.enabled||o.clear(),g&&t.isInited()&&s()}),f={asked:0,served:0,refused:0},u=[],v=(I,g)=>(f.refused+=1,u.push({url:I,reason:g}),u.length>20&&u.shift(),{refused:!0}),b=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:r,counters:{...f},refusals:[...u],store:o.stats()})}),E=t.addListenerAsync(k.APPLICATION_CANVAS_IMAGE_GET,async I=>{const g=I?.url??"";if(f.asked+=1,!r.enabled||!g)return v(g,"disabled");if(!i.accepts(g))return v(g,"host");I.fresh&&o.forget(g);const y=await o.get(g);return y?(f.served+=1,{blob:y}):v(g,"load-failed")});e.getInstance(N)?.addDispose(()=>{d.dispose(),l?.dispose(),E.dispose(),o.clear(),delete b.__emmCanvasImages__})}var Kl=2e3;function Wl(e){const t=X(e),n=new Set,r=()=>{const s=t.getTarget();if(!s||t.hasPort(s))return;const d=new MessageChannel;let l=!1;const f=v=>{v.data?.operationId==="em:port-ready"&&(l=!0,d.port1.removeEventListener("message",f),t.drainWindow(s))};d.port1.addEventListener("message",f),t.sendPort(s,d.port2),t.usePort(d.port1,!1,s);const u=setTimeout(()=>{n.delete(u),!l&&(yt(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d.port1.removeEventListener("message",f),t.useWindow(s))},Kl);n.add(u)},i=Object.assign(globalThis,{__emmCanvasPort__:()=>{const s=t.getTarget();return{usesPort:t.usesPort,windowDrained:s?t.isWindowDrained(s):!1}}}),o=t.onInit(()=>r());e.getInstance(N)?.addDispose(()=>{for(const s of n)clearTimeout(s);o.dispose(),delete i.__emmCanvasPort__})}var Yl=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Xl(e){return Yl.test(e)||e.indexOf("//")===0}function rt(e){return e&&(e.endsWith("/")?e:`${e}/`)}function Jl(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function cr(e,t){const n=e==null||e===""?"./":String(e);if(Xl(n))return rt(n);const r=t??Jl();if(!r)return rt(n);try{return rt(new URL(n,r).href)}catch{return rt(n)}}function Ql(){return typeof window.__useblocks__<"u"&&window.__useblocks__?.publicPath?cr(window.__useblocks__.publicPath):cr("/")}var Zl=()=>"",ed=()=>"d62ebebc";function ro(e){const t=e?"iframe-eblock":"iframe",n=Zl();if(n){const o=n.replace(/\/?$/,"/");return Xn(`${o}${t}.html`,qe())}const r=ed(),i=`${Ql().replace(/\/?$/,"/")}iframe/`;return Xn(`${i}${t}${r?`.${r}`:""}.html`,qe())}var ur="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function tn(e){return/^file:/i.test(String(e||"").trim())}function td(e){return tn(e)?`${ur} allow-same-origin`:ur}var nd="em:module-body-ack";function rd(e,t,n){try{const r=new URL("./",new URL(t,n)).href,i=new URL(e,r).href;return i.startsWith(r)?i:void 0}catch{return}}function xn(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.[0-9a-f]{6,})?\.html$/.exec(t);return n?`js/${n[1]}.body.js`:void 0}function id(e,t){const n=xn(t)?.replace(/^js\/|\.body\.js$/g,""),r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(i=>e[i]?.file).filter(i=>!!i):[]}function od(e,t){const n=xn(t)?.replace(/\.body\.js$/,".js");if(!n||!(n in e))return[];const r=new Set([n]),i=[n],o=[];for(;i.length>0;)for(const s of e[i.shift()]??[])r.has(s)||(r.add(s),o.push(s),i.push(s));return o}async function sd(e){try{const t=await fetch(e);return t.ok?await t.blob():void 0}catch{return}}function ad(e){const t=new Map,n=r=>{const i=rd(r,e.canvasSrc,e.origin);if(!i)return;const o=t.get(i);if(o!==void 0)return o;const s=e.fetchBody(i);return t.set(i,s),s};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r){for(const i of r)n(i)},reset(){t.clear()},get size(){return t.size}}}async function ld(e,t,n){try{const r=new URL(".vite/manifest.json",new URL("./",new URL(e,t))).href,i=await fetch(r);if(!i.ok)return;const o=await i.json();n(id(o,e))}catch{}}function dd(e){try{return tn(new URL(e,window.location.href).href)}catch{return tn(window.location.href)}}function cd(e){X(e);const t=ro(!1);if(dd(t))return;const n=ad({canvasSrc:t,origin:window.location.href,fetchBody:sd}),r=xn(t);r&&n.warm([r]);const i={"js/iframe-eblock.js":["js/discussHandlers.Ced_gtP0.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.Ced_gtP0.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.Ced_gtP0.js":["js/rolldown-runtime.BRlIiq3h.js"],"js/rolldown-runtime.BRlIiq3h.js":[],"js/rules.CL_BitCE.js":[],"js/typograf.all.BbXdyfMT.js":["js/rolldown-runtime.BRlIiq3h.js"]};i?n.warm(od(i,t)):ld(t,window.location.href,s=>n.warm(s));const o=s=>{const d=s.data;if(!d||d.operationId!=="em:module-body"||!d.result)return;const l=s.source;l&&(l.postMessage({operationId:nd,for:d.result},"*"),n.take(d.data?.url??"").then(f=>{l.postMessage({operationId:d.result,data:f??null},"*")}))};window.addEventListener("message",o),e.getInstance(N)?.addDispose(()=>{window.removeEventListener("message",o),n.reset()})}var Ae=/<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,ud=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Oe=/<style\b[^>]*>[\s\S]*?<\/style>/gi,fr=/display:\s*none\s*!important/gi,fd=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,pd=/\s*height\s*:\s*100%\s*!important\s*;?/gi,hd=/height\s*:\s*100%\s*!important/i,md=[".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 gd(e){return fr.lastIndex=0,(e.match(fr)||[]).length}function io(e){const t=e.trim(),n=gd(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=md.filter(i=>t.includes(i)).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 vd(e){Oe.lastIndex=0;for(const t of e.matchAll(Oe))if(io(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function bd(e){let t=!1;return Oe.lastIndex=0,{html:e.replace(Oe,n=>io(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Ed(e){return Ae.lastIndex=0,Ae.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||vd(e)}function yd(e){if(!Ed(e))return{html:e,found:!1};let t=!1,n=e;Ae.lastIndex=0,Ae.test(n)&&(Ae.lastIndex=0,n=n.replace(Ae,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(ud,""),t=!0);const r=bd(n);return n=r.html,t=t||r.found,{html:n,found:t}}function _d(e){return!e||!hd.test(e)?e:(Oe.lastIndex=0,e.replace(Oe,t=>t.replace(fd,(n,r,i,o)=>`${r}${i.replace(pd,"")}${o}`)))}function oo(e){const t=yd(e.replaceAll(`\r
|
|
1001
|
+
`)}function xl({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:i,onFacts:o,onLate:s,onError:d,pageLoadTs:a=Dl()}){let f=null,u=!1,v=!1,b=0,E={emailId:e,historyLoaded:!1,isRecovering:!1},I=null;const g=new Promise(R=>{I=R}),y=R=>{E={...E,...R},o(E)},_=R=>{b+=1,y({applied:{phase:R,seq:b}})},S=()=>{f?.timer&&clearTimeout(f.timer),f=null},A=R=>{if(!v){if(I){const C=I;I=null,C(R),R.revision&&_(R.phase);return}s(R)&&R.revision&&_(R.phase)}},h=()=>{if(!f||v)return;const R=f.phase==="fast",C=R?Tl:Rl,D=R?Cl:Pl;f.timer=setTimeout(()=>{const x=f;if(!(!x||v)){if(x.attempts+=1,w(),R&&x.attempts>=D){const{pending:U}=x;it(e),y({isRecovering:!1}),A({revision:{html:U.html,common_styles:U.common_styles,subject:U.subject,preheader:U.preheader},phase:"timeout"}),u=!0,x.phase="bg",x.attempts=0,h();return}if(!R&&x.attempts>=D){it(e),S(),y({isRecovering:!1}),u=!0;return}h()}},C),f.timer.unref?.()},c=R=>{f={phase:"fast",attempts:0,pending:R,timer:null},y({isRecovering:!0}),h()},l=(R,C)=>ki(R.autosave,C===void 0?{}:{freshSince:C})?R.autosave:null,p=R=>{if(v)return;if(y({historyLoaded:!0,latestRevisionAt:R.latestAt!==void 0&&Number.isFinite(R.latestAt)?R.latestAt:void 0}),n&&f){const x=l(R,f.pending.sentAt);if(!x)return;const U=f.phase==="fast"?"found":"bg";it(e),S(),y({isRecovering:!1}),u=!0,A({revision:x,phase:U});return}if(u)return;const C=n?Il(e):null,D=C&&(C.sentAt<a||!Ol(C.html,i()))?C:null;if(D){const x=l(R,D.sentAt);if(x){it(e),u=!0,A({revision:x,phase:"found"});return}c(D);return}u=!0,A({revision:l(R),phase:"normal"})},m=R=>{v||(d?.(R),E.historyLoaded||(y({historyLoaded:!1,latestRevisionAt:void 0}),k()),!f&&A({revision:null,phase:"normal"}))},w=()=>t(e).then(p).catch(m);let T,O=!1;const k=()=>{O||f||v||(O=!0,T=setTimeout(()=>{T=void 0,!v&&!E.historyLoaded&&w()},Al))},W=()=>{v||(y({historyLoaded:!1,latestRevisionAt:void 0}),A({revision:null,phase:"normal"}))};return r?r().then(R=>R?w():W()):w(),{verdict:()=>g,dispose(){v=!0,T!==void 0&&(clearTimeout(T),T=void 0),S()}}}function Ll({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:i,onFacts:o}){let s=null;const d=xl({emailId:r,readAutosave:a=>e.readAutosave(a),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:i,onFacts:o,onLate:({revision:a,phase:f})=>{const u=hr(a);return s?.(u)??!1},onError:a=>{a instanceof Error&&a.message}});return{id:"recovery",load:()=>d.verdict().then(({revision:a})=>hr(a)),watch(a){return s=a,()=>{s=null,d.dispose()}}}}function Xi(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){Sl(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const i=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),i}}}function Ml(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const i=await t.updateEmail(n,r);return await e.updateEmail(n,r),i}}}var Ji=L("CurrentUser"),Qi={};function Zi(e){return e.getOrCreateInstance(Ji,()=>Me(Qi))}function eo(e){return e?.getInstance(Ji)?.get()??Qi}function to(e){return e?.getInstance(we)?.get()??{}}var kl=1.5;function Nl(e){return!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=kl*e.autosaveTimeoutMs?"none":"revision"}var Fl=4;function jl(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:i}=e,o=e.readFailures??(()=>0),s=()=>n().autosaveTimeoutMs*2**Math.min(o(),Fl),d=()=>{const _=t();if(!_||_.isDisposed())return"none";const{latestRevisionAt:S,snapshotVersion:A,...h}=n();return Nl({...h,isDirty:_.isDirty(),isNew:_.isNew(),isReady:_.isReady(),latestRevisionAgeMs:S!=null?Date.now()-S:void 0,isSnapshotSent:A!=null&&A===_.get().version})},a=()=>{const _=t();if(!_||_.isDisposed())return!1;if(!_.isDirty())return _.isNew();const{snapshotVersion:S}=n();return!(S!=null&&S===_.get().version)};let f,u,v,b,E=!1;const I=()=>{u=void 0;const _=t();if(!_||_.isDisposed())return;if(_.get().docId!==f){g();return}const S=d();S==="create"?r():S==="revision"?i():a()&&(f=_.get().docId,u=setTimeout(I,s()))},g=()=>{const _=t();E||!_||u!==void 0||d()==="none"&&!a()||(f=_.get().docId,u=setTimeout(I,s()))},y=()=>{const _=t();_!==v&&(b?.(),v=_,b=_?.subscribe(g),u!==void 0&&(clearTimeout(u),u=void 0))};return y(),g(),{refresh:()=>{E||(y(),g())},stop:()=>{E=!0,b?.(),b=void 0,v=void 0,u!==void 0&&(clearTimeout(u),u=void 0)}}}var no=L("documentSession.autosaveUiFacts"),ro={isUserBusy:!1,saveContext:{}};function Bl(e){return e.getOrCreateInstance(no,()=>Me(ro))}function gr(e){return e?.getInstance(no)?.get()??ro}var Ul=1e4;function Hl(e,t){const n=()=>{const a=t.current(),f=a?.get().serverId??void 0,u=me(t.sessionKey()),v=t.recoveryFacts(),b=v?.emailId===f?v:void 0,E=t.revisionFacts(),I=b?.latestRevisionAt,g=E?.lastRevisionAt,y=eo(e).profile;return{isInited:u||a?.get().attributes.is_inited===!0,isEnabled:!!y?.autosaves,isHistoryLoaded:b?.historyLoaded===!0,isUserBusy:gr(e).isUserBusy,autosaveTimeoutMs:to(e).autosaveTimeout||Ul,latestRevisionAt:I!==void 0||g!==void 0?Math.max(I??0,g??0):void 0,snapshotVersion:E?.snapshotVersion}},r=()=>{const a=gr(e).saveContext;return{...a,project:a.project??t.current()?.get().attributes.project}},i=jl({readDocument:()=>t.current(),readEnvironment:n,readFailures:()=>t.saveState().failures,onCreate:()=>{me(t.sessionKey())||t.save("materialize",r())},onRevision:()=>{t.save("snapshot",{project:r().project})}}),o=t.subscribe(i.refresh),s=Zi(e).watch(()=>i.refresh()),d=Bl(e).watch(()=>i.refresh());return()=>{o(),s.dispose(),d.dispose(),i.stop()}}var vr=12e3;function ve(e){return e.getOrCreateInstance(kn,()=>{const t=hl({resolveAdapters:(r,i)=>$l(r,e,i),resolveWritePort:()=>io(e),resolveHistoryPort:r=>me(r)?so(e):oo(e),resolveTerms:()=>El(e),canEdit:r=>wa(e,r),notifyBeforeSave:Pa(e),timeoutMs:vr,onAdapterError:(r,i)=>{i instanceof Error&&i.message,wt(i,{origin:"email-source-adapter",tags:{source:r}})},onTimeout:r=>{}}),n=Hl(e,t);return e.getInstance(j)?.addDispose(n),t})}function jn(e){return e?.getInstance(kn)}function io(e){const t=gl(e);return t?Bn(e)?Ml(t,Se(e).email(e)):t:Se(e).email(e)}function Gl(e){return Yi(e)!==void 0||Vi(e)}function oo(e){const t=Yi(e);return t?Bn(e)?(z("port:history:server-backed"),Xi(t,Se(e).history(e))):(z("port:history:integrator"),t):(z("port:history:rest (порт не зарегистрирован)"),Se(e).history(e))}function so(e){const t=Wi(e);return t?Bn(e)?(z("port:block-history:server-backed"),Xi(t,Se(e).blockHistory(e))):(z("port:block-history:integrator"),t):(z("port:block-history:rest (порт не зарегистрирован)"),Se(e).blockHistory(e))}function ql(e){return Wi(e)!==void 0||Vi(e)}function Bn(e){return Si(e)}function $l({email:e,patch:t,serverId:n,key:r},i,o){const s=[];e?s.push({id:"rest",load:()=>Bi(e),required:!0}):n&&s.push(ml(io(i),n)),t&&s.push({id:"plugin",load:()=>Ui(t)});const d=me(r);return Da(n)&&(d?ql(i):Gl(i))&&s.push(Ll({port:d?so(i):oo(i),revisionServiceEnabled:Si(i),...!d&&Sa(i)?{isHistoryAvailable:()=>Ia(i)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:a=>o.publishRecoveryFacts(a)})),s}function X(e){return e.getOrCreateInstance(Ye,()=>new Xe)}var ao=new WeakMap,sn=new WeakMap;function ue(e){return ao.get(e)??0}function lo(e,t){let n=sn.get(e);return n||(n=new Set,sn.set(e,n)),n.add(t),()=>{n?.delete(t)}}function zl(e){ao.set(e,ue(e)+1),sn.get(e)?.forEach(t=>t())}function Vl(e){const t=ve(e),n=X(e).addListener(F.APPLICATION_HAS_AMP,r=>{Be(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(j)?.addDispose(()=>n.dispose())}function Kl(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Wl(e){const t=e.fetchImpl??((o,s)=>fetch(o,s)),n=e.pageHost??(()=>window.location.hostname),r=new Set,i=o=>{try{const s=new URL(o,window.location.href);return s.protocol!=="https:"&&s.protocol!=="http:"?!1:s.hostname===n()||e.sourceHosts().includes(s.hostname)}catch{return!1}};return{accepts:i,async load(o){if(!i(o))return;const s=!r.has(o);r.add(o);try{const d=await t(o,{mode:"cors",credentials:"omit",cache:s?"no-cache":"default"});if(!d.ok)return;const a=await d.blob();return Kl(a)?a:void 0}catch{return}}}}var _e={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function Yl(e){const t={maxBytes:e.maxBytes??_e.maxBytes,maxImageBytes:e.maxImageBytes??_e.maxImageBytes,ttlMs:e.ttlMs??_e.ttlMs},n=e.now??(()=>Date.now()),r=new Map,i=new Map,o={hits:0,loads:0,failures:0};let s=0;const d=v=>{const b=r.get(v);b&&(s-=b.bytes,r.delete(v))},a=v=>t.ttlMs<=0||n()-v.storedAt<t.ttlMs,f=()=>{if(s<=t.maxBytes)return;const v=[...r.entries()].sort((b,E)=>b[1].usedAt-E[1].usedAt);for(const[b]of v){if(s<=t.maxBytes)return;d(b)}},u=(v,b)=>{b.size>t.maxImageBytes||(r.set(v,{blob:b,bytes:b.size,storedAt:n(),usedAt:n()}),s+=b.size,f())};return{async get(v){const b=r.get(v);if(b&&a(b))return b.usedAt=n(),o.hits+=1,b.blob;b&&d(v);const E=i.get(v);if(E!==void 0)return E;o.loads+=1;const I=(async()=>{try{const g=await e.load(v);return g?u(v,g):o.failures+=1,g}catch{o.failures+=1;return}finally{i.delete(v)}})();return i.set(v,I),I},forget(v){d(v),i.delete(v)},clear(){r.clear(),i.clear(),s=0},stats(){return{entries:r.size,bytes:s,...o}}}}var Xl=["emcdn.ru","scr.emcdn.ru"];function Jl(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 Ql(e,t){const n=(r,i)=>{const o=new Set(i?t:[]);for(const s of r){const d=Jl(s);d&&o.add(d)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function br(e){const t=e??{},n=t.isPlugin!==!0?Xl:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],..._e};const i=r===!0||r===void 0?{}:r;return{enabled:i.enabled!==!1,sourceHosts:Ql(i.sourceHosts,n),maxBytes:i.maxBytes??_e.maxBytes,maxImageBytes:i.maxImageBytes??_e.maxImageBytes,ttlMs:i.ttlMs??_e.ttlMs}}function Zl(e){const t=X(e),n=e.getInstance(we);let r=br(n?.get());const i=Wl({sourceHosts:()=>r.sourceHosts}),o=Yl({load:I=>i.load(I),maxBytes:r.maxBytes,maxImageBytes:r.maxImageBytes,ttlMs:r.ttlMs}),s=()=>{t.send(F.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:r.enabled,sourceHosts:[...r.sourceHosts]})},d=t.onInit(()=>s()),a=n?.watch(()=>{const I=br(n.get()),g=JSON.stringify(I)!==JSON.stringify(r);r=I,I.enabled||o.clear(),g&&t.isInited()&&s()}),f={asked:0,served:0,refused:0},u=[],v=(I,g)=>(f.refused+=1,u.push({url:I,reason:g}),u.length>20&&u.shift(),{refused:!0}),b=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:r,counters:{...f},refusals:[...u],store:o.stats()})}),E=t.addListenerAsync(F.APPLICATION_CANVAS_IMAGE_GET,async I=>{const g=I?.url??"";if(f.asked+=1,!r.enabled||!g)return v(g,"disabled");if(!i.accepts(g))return v(g,"host");I.fresh&&o.forget(g);const y=await o.get(g);return y?(f.served+=1,{blob:y}):v(g,"load-failed")});e.getInstance(j)?.addDispose(()=>{d.dispose(),a?.dispose(),E.dispose(),o.clear(),delete b.__emmCanvasImages__})}var ed=2e3;function td(e){const t=X(e),n=new Set,r=()=>{const s=t.getTarget();if(!s||t.hasPort(s))return;const d=new MessageChannel;let a=!1;const f=v=>{v.data?.operationId==="em:port-ready"&&(a=!0,d.port1.removeEventListener("message",f),t.drainWindow(s))};d.port1.addEventListener("message",f),t.sendPort(s,d.port2),t.usePort(d.port1,!1,s);const u=setTimeout(()=>{n.delete(u),!a&&(wt(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d.port1.removeEventListener("message",f),t.useWindow(s))},ed);n.add(u)},i=Object.assign(globalThis,{__emmCanvasPort__:()=>{const s=t.getTarget();return{usesPort:t.usesPort,windowDrained:s?t.isWindowDrained(s):!1}}}),o=t.onInit(()=>r());e.getInstance(j)?.addDispose(()=>{for(const s of n)clearTimeout(s);o.dispose(),delete i.__emmCanvasPort__})}var nd=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function rd(e){return nd.test(e)||e.indexOf("//")===0}function ot(e){return e&&(e.endsWith("/")?e:`${e}/`)}function id(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Er(e,t){const n=e==null||e===""?"./":String(e);if(rd(n))return ot(n);const r=t??id();if(!r)return ot(n);try{return ot(new URL(n,r).href)}catch{return ot(n)}}function od(){return typeof window.__useblocks__<"u"&&window.__useblocks__?.publicPath?Er(window.__useblocks__.publicPath):Er("/")}var sd=()=>"",ad=()=>"ee20cf1c";function co(e){const t=e?"iframe-eblock":"iframe",n=sd();if(n){const o=n.replace(/\/?$/,"/");return or(`${o}${t}.html`,$e())}const r=ad(),i=`${od().replace(/\/?$/,"/")}iframe/`;return or(`${i}${t}${r?`.${r}`:""}.html`,$e())}var yr="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function an(e){return/^file:/i.test(String(e||"").trim())}function ld(e){return an(e)?`${yr} allow-same-origin`:yr}var dd="em:module-body-ack";function cd(e,t,n){try{const r=new URL("./",new URL(t,n)).href,i=new URL(e,r).href;return i.startsWith(r)?i:void 0}catch{return}}function Un(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.[0-9a-f]{6,})?\.html$/.exec(t);return n?`js/${n[1]}.body.js`:void 0}function ud(e,t){const n=Un(t)?.replace(/^js\/|\.body\.js$/g,""),r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(i=>e[i]?.file).filter(i=>!!i):[]}function fd(e,t){const n=Un(t)?.replace(/\.body\.js$/,".js");if(!n||!(n in e))return[];const r=new Set([n]),i=[n],o=[];for(;i.length>0;)for(const s of e[i.shift()]??[])r.has(s)||(r.add(s),o.push(s),i.push(s));return o}async function pd(e){try{const t=await fetch(e);return t.ok?await t.blob():void 0}catch{return}}function hd(e){const t=new Map,n=r=>{const i=cd(r,e.canvasSrc,e.origin);if(!i)return;const o=t.get(i);if(o!==void 0)return o;const s=e.fetchBody(i);return t.set(i,s),s};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r){for(const i of r)n(i)},reset(){t.clear()},get size(){return t.size}}}async function md(e,t,n){try{const r=new URL(".vite/manifest.json",new URL("./",new URL(e,t))).href,i=await fetch(r);if(!i.ok)return;const o=await i.json();n(ud(o,e))}catch{}}function gd(e){try{return an(new URL(e,window.location.href).href)}catch{return an(window.location.href)}}function vd(e){X(e);const t=co(!1);if(gd(t))return;const n=hd({canvasSrc:t,origin:window.location.href,fetchBody:pd}),r=Un(t);r&&n.warm([r]);const i={"js/iframe-eblock.js":["js/discussHandlers.BuuVtU3Y.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.BuuVtU3Y.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.BuuVtU3Y.js":["js/rolldown-runtime.BRlIiq3h.js"],"js/rolldown-runtime.BRlIiq3h.js":[],"js/rules.CL_BitCE.js":[],"js/typograf.all.BbXdyfMT.js":["js/rolldown-runtime.BRlIiq3h.js"]};i?n.warm(fd(i,t)):md(t,window.location.href,s=>n.warm(s));const o=s=>{const d=s.data;if(!d||d.operationId!=="em:module-body"||!d.result)return;const a=s.source;a&&(a.postMessage({operationId:dd,for:d.result},"*"),n.take(d.data?.url??"").then(f=>{a.postMessage({operationId:d.result,data:f??null},"*")}))};window.addEventListener("message",o),e.getInstance(j)?.addDispose(()=>{window.removeEventListener("message",o),n.reset()})}var Ae=/<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,bd=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Oe=/<style\b[^>]*>[\s\S]*?<\/style>/gi,_r=/display:\s*none\s*!important/gi,Ed=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,yd=/\s*height\s*:\s*100%\s*!important\s*;?/gi,_d=/height\s*:\s*100%\s*!important/i,wd=[".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 Sd(e){return _r.lastIndex=0,(e.match(_r)||[]).length}function uo(e){const t=e.trim(),n=Sd(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=wd.filter(i=>t.includes(i)).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 Id(e){Oe.lastIndex=0;for(const t of e.matchAll(Oe))if(uo(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function Td(e){let t=!1;return Oe.lastIndex=0,{html:e.replace(Oe,n=>uo(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Ad(e){return Ae.lastIndex=0,Ae.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||Id(e)}function Cd(e){if(!Ad(e))return{html:e,found:!1};let t=!1,n=e;Ae.lastIndex=0,Ae.test(n)&&(Ae.lastIndex=0,n=n.replace(Ae,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(bd,""),t=!0);const r=Td(n);return n=r.html,t=t||r.found,{html:n,found:t}}function Rd(e){return!e||!_d.test(e)?e:(Oe.lastIndex=0,e.replace(Oe,t=>t.replace(Ed,(n,r,i,o)=>`${r}${i.replace(yd,"")}${o}`)))}function fo(e){const t=Cd(e.replaceAll(`\r
|
|
1002
1002
|
`,`
|
|
1003
|
-
`));return{html:_d(t.html),hasBrowserExtensionArtifacts:t.found}}function nn(e){return e?.getContent()??""}function so(e,t){e?.mutate({content:Di(t)},{source:"remote"})}function ao(e){return x(e)}function ie(e,t){return e.getOrCreateInstance(t,()=>new pe)}function K(e,t){return e.getOrCreateInstance(t,()=>new pe).event}function rn(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var wd=class extends Error{showId;constructor(e,t){super(`[useblocks] 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}},Sd=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(Q("Superseded by newer show()")),n.aborted?Promise.reject(Q(n.reason)):(this._activeRequest=e,new Promise((r,i)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{i(new wd(e.showId,t))})},t);o.unref?.();const s=()=>{this._settle(e.showId,()=>{i(Q(n.reason))})};n.addEventListener("abort",s,{once:!0});const d=()=>{clearTimeout(o),n.removeEventListener("abort",s)};this._pending.set(e.showId,{request:e,resolve:r,reject:i,timeoutId:o,dispose:d});for(const l of this._listeners)l(e)}))}completeShow(e){this._settle(e,t=>{t.resolve()})}hasPendingShow(e){return this._pending.has(e)}failShow(e,t){this._settle(e,n=>{n.reject(t)})}rejectAll(e){this._rejectPending(e),this._activeRequest=null}_settle(e,t){const n=this._pending.get(e);n&&(n.dispose(),this._pending.delete(e),this._activeRequest?.showId===e&&(this._activeRequest=null),t(n))}_rejectPending(e){for(const[,t]of this._pending)t.dispose(),t.reject(e);this._pending.clear()}};function Id(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function Td(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=Ii(e),n=Ti(e),r=Ea(e.sandbox);t<n+r}var lo=class{_controller=new AbortController;_externalSignalDisposable=new Z;_sessionChangeListeners=new Set;_showRegistry=new Sd;_timeouts;_generation=0;_sessionStarted=!1;get signal(){return this._controller.signal}get generation(){return this._generation}get contentReadyTimeoutMs(){return Ii(this._timeouts)}getSandboxTimeoutMs(e){return Si(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return Ti(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=Id(this._timeouts,e.timeouts),Td(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}abort(e){const t=e??Q("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new Z}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new Z,this._showRegistry.rejectAll(Q("Init session replaced")),this._controller.signal.aborted||this._controller.abort(Q("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??Q()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??Q()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},Ln=(()=>{const e=new lo;return e.configure({}),e})(),Ad=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 Cd(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 Rd(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(q(n),new Promise((r,i)=>{let o=!1,s,d;const l=u=>{o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),d?.dispose(),n?.removeEventListener("abort",f),u())},f=()=>{l(()=>i(Q(n?.reason)))};if(d=e.onInit(()=>{e.isInited()&&e.getTarget()&&l(()=>r())}),e.isInited()&&e.getTarget()){l(()=>r());return}t>0&&(s=setTimeout(()=>{l(()=>i(new Ad(t)))},t)),n?.addEventListener("abort",f)}))}var Pd=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 Dd(e,t,n){return t<=0?e:new Promise((r,i)=>{let o=!1,s;const d=l=>{o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),l())};s=setTimeout(()=>{d(()=>i(new Pd(n,t)))},t),e.then(l=>{d(()=>r(l))},l=>{d(()=>i(l))})})}var Od=2,it=Symbol("sandbox:frame-replaced");function ae(e,t,n,r,i,o,s){const d=`sandbox:${t}`,l=o?.getSandboxTimeoutMs(t)??Rn[t],f=()=>{let I=Dd(e.sendAsync(n,r),l,d);return I=En(I,o?.signal),Ue(d,I,i)};if(t==="INIT_START"&&Cd(e)){const I=o?.getSandboxReadyTimeoutMs()??2e4,g=e,y=w=>{const S=Rd(g,I,o?.signal);return Ue("sandbox:INIT_START:ready-wait",S,i).then(()=>{if(!s||w<=0)return f();const A=s.getGeneration();let h;const c=new Promise((p,m)=>{h=s.onChange(()=>{s.getGeneration()!==A&&m(it)})}),a=f();return a.catch(()=>{}),Promise.race([a,c]).finally(()=>h?.()).catch(p=>{if(p!==it)throw p;return{...i},y(w-1)})})};return y(Od)}if(!s)return f();const u=s.getGeneration();let v;const b=new Promise((I,g)=>{v=s.onChange(()=>{s.getGeneration()!==u&&g(it)})}),E=f();return E.catch(()=>{}),Promise.race([E,b]).finally(()=>v?.()).catch(I=>{throw I===it&&{...i},I})}var xd=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],Ld=200;function Md(e=new Set){const t=new Set;return(n,r)=>{if(!xd.some(([o,s])=>!e.has(o)&&s.test(n)))return;const i=r??`new:${n.length}:${n.slice(0,200)}`;t.has(i)||(t.size>=Ld&&t.clear(),t.add(i))}}function kd(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:Md()}}var Nd=kd();function ke(e){return e?.getInstance(Ps)??Nd}function Fd(e){const t=ve(e),n=X(e),r=()=>e.getInstance(De)??Ln;let i,o,s=!1,d=!1;const l=async(S,A,h)=>{const c=h.generation,a=()=>h.generation!==c||h.signal.aborted||t.current()!==S||d,p=ue(n);s=!0;try{if(await ae(n,"INIT_START",k.SANDBOX_INIT_START,{guid:A},void 0,h),a())return;const{html:m,hasBrowserExtensionArtifacts:_}=oo(nn(S));if(_&&ie(e,F.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),so(S,m),await ae(n,"SET_ENTITY",k.SANDBOX_SET_ENTITY,rn(nn(S),A,ke(e).editorPolicy,S.get().version),void 0,h),a())return;await ae(n,"INITED",k.SANDBOX_INITED,{guid:A},void 0,h),i=A,o=p}finally{s=!1}},f=()=>me(t.sessionKey())?t.current():void 0,u=()=>{if(d||s)return;const S=f(),A=S?.get().docId;if(!S||!A||i===A&&o===ue(n)||!S.isReady())return;const h=r();h.signal.aborted||l(S,A,h).catch(()=>{})};let v=!1;const b=()=>{v||d||(v=!0,queueMicrotask(()=>{v=!1,u()}))};let E,I;const g=()=>{const S=f(),A=S?.get().docId;A!==I&&(E?.(),I=A,E=S?.subscribe(b)),b()},y=t.subscribe(g),w=no(n,b);g(),e.getInstance(N)?.addDispose(()=>{d=!0,w(),E?.(),y()})}var jd=200;function Bd({startVersion:e,limit:t=jd}){let n=[],r=e;const i=o=>{n=n.filter(s=>s.version>o),r=Math.max(r,o)};return{record(o){!o.changes?.length&&!o.contentReplaced||(n.push(o),n.length>t&&i(n[n.length-t-1].version))},rebase(o,s){if(s<r)return null;const d=n.filter(f=>f.version>s);i(s);let l=o;for(const f of d){if(f.fromCanvas||f.contentReplaced||!f.changes)return null;const u=f.changes,v=[];for(const b of l){const E=Da(b.range,u,"after");if(!E)return null;v.push({range:E,text:b.text})}l=v}return l}}}function Ud(e,t){let n=0;return e.map(({start:r,end:i,text:o})=>{const s=new re(r,t.slice(r,i),r+n,o);return n+=o.length-(i-r),s})}function Hd(e,t){const n=[...e].sort((r,i)=>r.range.start-i.range.start);return Ud(n.map(({range:r,text:i})=>({start:r.start,end:r.end,text:i})),t)}function Gd(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var Mn=x("canvas.sandboxFill");function co(e){return e.getInstance(Mn)?.pipeline.isEventsLocked()===!0}function Ot(e){yt(e,{origin:"canvas-channel"})}function qd(e){const t=ve(e),n=X(e);let r;const i=(l,f)=>{const u=l.get().docId;let v=!1,b=null,E=null;const I=Bd({startVersion:l.get().version});let g=l.getContent();const y=async(c,a)=>{if(E){E.push({edits:c,rev:a});return}E=[{edits:c,rev:a}];try{do{const p=E.splice(0,E.length);await n.sendAsync(k.SANDBOX_UPDATE_ENTITY,{edits:p.map(m=>m.edits),guid:u,rev:p[p.length-1].rev})}while(E.length)}finally{E=null}},w=(c,a)=>{const p=E?.splice(0,E.length)??[];p.length&&n.sendAsync(k.SANDBOX_UPDATE_ENTITY,{edits:p.map(m=>m.edits),guid:u,rev:p[p.length-1].rev}).catch(Ot),n.sendAsync(k.SANDBOX_UPDATE_ENTITY,{edits:[c],guid:u,rev:l.get().version,...a!==null?{changeId:a}:{}}).catch(Ot)},S=c=>{const{guid:a,pushUndoStop:p}=c;if(a!==u)return;const m=Ha(c);let{edits:_}=c;if(m.baseRev!==null){const C=I.rebase(_,m.baseRev);if(!C){yt(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),w([],m.changeId);return}_=C}const T=l.get().version;try{v=!0,b=m.changeId;const C=Hd(_,l.getContent());p===!1?f.applyWithoutHistory(C):l.mutate({changes:C},{source:co(e)?"system":"user"})}finally{v=!1,b=null}l.get().version===T&&m.baseRev!==null&&w([],m.changeId)},A=l.subscribe(({changes:c,version:a})=>{const p=l.getContent(),m=!c?.length&&p!==g;if(g=p,I.record({version:a,changes:c,contentReplaced:m,fromCanvas:v}),!c?.length)return;const _=Gd(c);v?w(_,b):y(_,a).catch(Ot)}),h=n.addListener(k.APPLICATION_UPDATE_ENTITY,S);return()=>{A(),h.dispose()}};let o;const s=()=>{const l=t.current(),f=t.history(),u=l?.get().docId;u!==o&&(r?.(),r=void 0,o=u,l&&f&&(r=i(l,f)))},d=t.subscribe(s);s(),e.getInstance(N)?.addDispose(()=>{r?.(),d()})}var $d=300,zd=15e3,pr="em-canvas-busy-style";function Vd(){if(document.getElementById(pr))return;const e=document.createElement("style");e.id=pr,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}function Kd(e){const t=e.getBoundingClientRect(),n=document.createElement("div");return n.setAttribute("aria-busy","true"),Object.assign(n.style,{position:"fixed",left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`,cursor:"progress",display:"flex",alignItems:"center",justifyContent:"center"}),e.appendChild(n),{showSpinner(){Vd(),n.style.background="rgba(128, 128, 128, 0.15)";const r=document.createElement("div");Object.assign(r.style,{width:"32px",height:"32px",borderRadius:"50%",border:"3px solid rgba(128, 128, 128, 0.35)",borderTopColor:"rgba(80, 80, 80, 0.9)",animation:"em-canvas-busy-spin 0.8s linear infinite"}),n.appendChild(r)},remove:()=>n.remove()}}var Wd=8e3;function Yd(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,whenShown:()=>Promise.resolve(),alignTo:()=>{},resize:()=>{},dispose:()=>{}}}var Xd=e=>{for(let t=e?.parentElement??null;t;t=t.parentElement){const n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="hidden")return t}return null};function Jd(e,t,n,r,i){const o=n.readyTimeoutMs??Wd,s=document.createElement("div");s.dataset.canvasHost=e,r&&(s.dataset.canvasPlace=r),s.style.position="fixed",s.style.overflow="hidden",s.style.visibility="hidden";const d=n.resolveSrc(e),l=document.createElement("iframe");l.setAttribute("sandbox",n.resolveSandbox(d)),l.setAttribute("allow","clipboard-read; clipboard-write"),l.setAttribute("title","Email content"),l.style.width="100%",l.style.border="0",l.style.display="block",l.style.minHeight="600px",l.src=d,s.appendChild(l),t.appendChild(s),n.mark?.("created"),i||n.onCreated?.(l);const f=new Z;let u=!1,v=!1,b,E,I,g;const y=()=>{clearTimeout(g),g=setTimeout(()=>{v||(v=!0,E?.(new Error(`[canvas] ${e}: документ не загрузился за ${o} мс`)))},o)},w=()=>u?(I=Promise.resolve(),v=!0,I):(v=!1,I=new Promise((L,H)=>{b=L,E=H}),y(),I),S=()=>{if(clearTimeout(g),u=!0,v){I=Promise.resolve();return}v=!0,n.mark?.("loaded"),b?.()};l.addEventListener("load",S),f.addDispose(()=>{clearTimeout(g),l.removeEventListener("load",S)});let A;const h=()=>{A??=n.bindResizer?.(l)};let c=null,a=null,p;const m=()=>{if(!c){s.style.visibility="hidden",l.removeAttribute("id");return}n.elementId&&(l.id=n.elementId);const L=c.getBoundingClientRect(),H=a?.isConnected?a:Xd(c),U=H?H.getBoundingClientRect():null,Y=U?Math.max(L.top,U.top):L.top,be=U?Math.min(L.bottom,U.bottom):L.bottom,Qe=Math.max(0,be-Y);s.style.visibility=Qe>0?"visible":"hidden",s.style.left=`${L.left}px`,s.style.top=`${Y}px`,s.style.width=`${L.width}px`,s.style.height=`${Qe}px`,l.style.transform=`translateY(${L.top-Y}px)`};let _="",T="",C=0,P;const j=()=>{if(!c){P=void 0;return}P=window.requestAnimationFrame(j);const L=c.getBoundingClientRect(),H=a?.isConnected?a.getBoundingClientRect():void 0,U=`${Math.round(L.left)}:${Math.round(L.top)}:${Math.round(L.width)}:${Math.round(L.height)}:${H?`${Math.round(H.top)}:${Math.round(H.height)}`:"-"}`;U!==_&&(_=U,m());const Y=l.getBoundingClientRect().height;Y>0&&Y!==C&&(C=Y,c.style.height=`${Y}px`);const be=getComputedStyle(c).pointerEvents;be!==T&&(T=be,s.style.pointerEvents=be)},R=()=>{P===void 0&&c&&(P=window.requestAnimationFrame(j))},O=()=>{P!==void 0&&(window.cancelAnimationFrame(P),P=void 0)},z=()=>m();let B=[];const W=(L,H)=>{if(a=H,L&&B.length>0){const U=B;B=[],U.forEach(Y=>Y())}if(L===c){m();return}if(p?.disconnect(),p=void 0,c&&c.style.removeProperty("height"),_="",C=0,T="",c=L,!L){O(),m();return}n.onShown?.(l);try{if(typeof ResizeObserver=="function"){const U=new ResizeObserver(m);typeof U.observe=="function"&&(p=U,p.observe(L))}}catch{p=void 0}m(),h(),R()};window.addEventListener("scroll",z,!0),window.addEventListener("resize",z),f.addDispose(()=>{p?.disconnect(),P!==void 0&&window.cancelAnimationFrame(P),window.removeEventListener("scroll",z,!0),window.removeEventListener("resize",z)});const de=L=>{u=!1,L&&n.onReload?.(l);let H;v||I===void 0?H=w():(y(),H=I);try{l.contentWindow?.location.reload()}catch{l.src=d}return H};return{element:l,ready(){return I??w()},reload:()=>de(!0),reloadQuietly:()=>de(!1),get shown(){return c!==null},whenShown(){return c!==null?Promise.resolve():new Promise(L=>{B.push(L)})},alignTo(L,H){W(L,H??null)},scrollBy(L,H){for(let U=c?.parentElement??null;U;U=U.parentElement){const Y=getComputedStyle(U);if((Y.overflowY==="auto"||Y.overflowY==="scroll")&&U.scrollHeight>U.clientHeight){U.scrollBy({left:L,top:H,behavior:"instant"});return}}window.scrollBy({left:L,top:H,behavior:"instant"})},resize(){A?.resize()},dispose(){W(null,null),A?.dispose(),f.dispose(),s.remove()}}}function Qd(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",i=(u,v)=>u==="email"?`email:${v??n}`:u;let o,s=[];const d=()=>{s.forEach(u=>clearTimeout(u)),s=[],o?.remove(),o=void 0},l=new Map,f=(u,v,b)=>{const E=i(u,v),I=t.get(E);if(I)return I;const g=e.resolveMount();if(!g)return Yd();const y=Jd(u,g,e,u==="email"?v??n:void 0,b);return t.set(E,y),y};return{get:u=>f(u),current:u=>f(u),peek:u=>t.get(i(u)),spare:()=>t.get(i("email",r())),ensureSpare:()=>f("email",r(),!0),promote(){const u=t.get(i("email",r()));if(!u)return;const v=t.get(i("email"));n=r();const b=l.get("email");u.alignTo(b?.slot??null,b?.clip??null),v?.alignTo(null)},alignSurface(u,v,b){l.set(u,{slot:v,clip:b??null}),(v?f(u):t.get(i(u)))?.alignTo(v,b??null)},visible(){for(const u of t.values())if(u.shown)return u},byWindow(u){if(u){for(const v of t.values())if(v.element.contentWindow===u)return v}},busy(u){d();const v=u?e.resolveMount():void 0;if(!v)return;const b=Kd(v);o=b,s=[setTimeout(()=>b.showSpinner(),$d),setTimeout(d,zd)]},dispose(){d(),t.forEach(u=>u.dispose()),t.clear(),l.clear(),n="a"}}}var Zd=x("canvas.resizerBinder"),on=x("canvas.service"),ec={created:J.canvasCreated,loaded:J.canvasLoaded};function tc(e,t){if(e.getInstance(on))return;const n=Qd({resolveMount:()=>t.resolveMount(),resolveSrc:i=>t.resolveSrc(i),resolveSandbox:td,elementId:t.elementId,bindResizer:i=>e.getInstance(Zd)?.(i),onCreated:i=>ct(e,i,"fresh"),onReload:i=>ct(e,i,"fresh"),onShown:i=>ct(e,i,"switch"),mark:i=>t.mark?.(ec[i])}),r=X(e).addListener(k.SANDBOX_WHEEL,i=>{n.visible()?.scrollBy(i?.deltaX??0,i?.deltaY??0)});e.inject(on,n),e.getInstance(N)?.addDispose(()=>{r.dispose(),n.dispose()})}function ct(e,t,n){const r=X(e),i=t.contentWindow;if(!i)return;const o=r.getTarget()===i;o&&n==="switch"||(n==="fresh"&&(r.forget(i),o&&r.setTarget(void 0)),r.setTarget(i),jl(r))}function nc(e,t){ct(e,t,"promote")}function rc(e,t){const n=t.contentWindow;n&&X(e).greet(n)}function ic(e,t){const n=t.contentWindow;n&&X(e).forget(n)}function fe(e){return e.getInstance(on)}function oc(e){const t=X(e),n=()=>fe(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(k.RELOAD,async()=>{await n()?.reload()}),i=t.addListener(s=>{s.data?.operation===k.SANDBOX_RESIZED&&n()?.resize()}),o=K(e,F.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(N)?.addDispose(()=>{r.dispose(),i.dispose(),o.dispose()})}var wm=x("HeadlessMode"),sc=x("HiddenMount");function ac(e){return e.getOrCreateInstance(sc,()=>Me(!1))}function hr(){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 lc(e){const t=e.getInstance(oe);let n,r;e.getInstance(N)?.addDispose(()=>{r?.remove(),r=void 0}),tc(e,{resolveMount:()=>n,resolveSrc:o=>ro(o==="block"),elementId:"email_iframe",mark:o=>$(o)}),t?.watch(o=>{if(n)return;const s=o?.element;if(s instanceof HTMLElement)n=s;else if(o!==void 0)n=r??=hr();else return;fe(e)?.get("email")});let i;e.getInstance(N)?.addDispose(()=>{i?.remove(),i=void 0}),ac(e).watch(o=>{const s=fe(e);if(s){if(o){i??=hr(),s.alignSurface("email",i,i);return}i&&(s.alignSurface("email",null),i.remove(),i=void 0)}})}var uo=x("canvas.headerFlow"),mr=["subject","preheader"],dc=3e3,cc={subject:k.SANDBOX_SUBJECT_UPDATE,preheader:k.SANDBOX_PREHEADER_UPDATE};function uc(e){const t=ve(e),n=X(e),r=g=>g?"remote":co(e)?"system":"user",i=(g,{guid:y,value:w,forced:S})=>{const A=je(t);if(!A||typeof w!="string"||y&&y!==A.get().docId)return;const h=t.forcedHeaders();if(h?.[g]&&!S&&w!==h[g])return;S&&t.endForcedHeaders();const c=A.get().attributes[g]??"";d=!0;try{mt(A,{[g]:w},{source:r(S)})}finally{d=!1}o[g]=w,ie(e,F.ON_HEADER_APPLIED_ID).fire({field:g,value:w,forced:!!S,isGenerated:w!==c&&!!w})};let o={},s,d=!1,l=Promise.resolve();const f=(g,y,w)=>{l=n.sendAsync(cc[g],{value:y,guid:je(t)?.get().docId,...w?{force:!0,echo:!0}:{}}).catch(S=>{})};let u;e.inject(uo,{whenDelivered:async()=>{await l},reassert:g=>{const y=je(t),w=mr.filter(S=>g[S]);if(!(!y||w.length===0)){d=!0;try{mt(y,Object.fromEntries(w.map(S=>[S,g[S]])),{source:"system"})}finally{d=!1}t.beginForcedHeaders({subject:g.subject??"",preheader:g.preheader??""}),clearTimeout(u),u=setTimeout(()=>t.endForcedHeaders(),dc);for(const S of w)o[S]=g[S],f(S,g[S],!0)}}});const v=()=>{s?.(),s=void 0;const g=je(t);if(!g){o={};return}const y=g.get().attributes;o={subject:y.subject,preheader:y.preheader},s=g.subscribe(({source:w})=>{if(d)return;const S=g.get().attributes,A=t.forcedHeaders();for(const h of mr){const c=S[h];c!==o[h]&&(o[h]=c,f(h,c??"",w==="system"&&A?.[h]!==void 0))}})};v();const b=t.subscribe(v),E=n.addListenerAsync(k.APPLICATION_SUBJECT_UPDATE,g=>i("subject",g)),I=n.addListenerAsync(k.APPLICATION_PREHEADER_UPDATE,g=>i("preheader",g));e.getInstance(N)?.addDispose(()=>{E.dispose(),I.dispose(),b(),s?.(),clearTimeout(u)})}function gr(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function sn(e,t){const n={...e};for(const r of Object.keys(t)){const i=t[r],o=e[r];gr(i)&&gr(o)?n[r]=sn(o,i):i!==void 0&&(n[r]=i)}return n}function fc(e,t){const n=_n;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const i=JSON.parse(r);if(i&&typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length>0)return sn(n,i)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?sn(n,t):n}function pc(){const e=window.localStorage.getItem(bt.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?ws:Fs;return e&&e!=="system"?e:t}function hc(){const e=window.localStorage.getItem(bt.em_code_mode_settings);if(!e)return!1;try{const t=JSON.parse(e);return!!(t?.isCodeMode&&(t.codeModeDirection==="left"||t.codeModeDirection==="right"))}catch{return!1}}function mc(e){const{config:t}=e;return{operation:k.UPDATE_PREVIEW,theme:e.theme,commonStyles:fc(e.emailCommonStyles,e.defaultCommonStyles),pathEnabled:t.pathEnabled,copyPasteEnabled:t.copyPasteEnabled,saveBlockEnabled:t.saveBlockEnabled,editImageControlEnabled:t.editImageControlEnabled,codeMode:e.codeMode,elementAIimageEnabled:t.elementAIimageEnabled,imageCenterStockEnabled:t.imageCenterStockEnabled,imageCenterGifEnabled:t.imageCenterGifEnabled,imageCenterEditorEnabled:t.imageCenterEditorEnabled,blocksAddPanelEnabled:t.blocksAddPanelEnabled!==!1&&t.blocksSectionsShow!==!1,lockEditor:t.lockEditor,appName:e.appName}}function gc(e){const t=X(e),n=e.getInstance(we),r=e.getInstance(oe),i=ve(e);let o,s="";const d=()=>{const w=n?.get()??{},S=mc({config:w,emailCommonStyles:i.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:pc(),codeMode:hc(),appName:"useblocks"}),A=JSON.stringify(S);A!==s&&(s=A,t.send(S))},l=t.onInit(()=>{s="",d()}),f=()=>{t.isInited()&&d()},u=n?.watch(f),v=r?.watch(w=>{o=w?.commonStyles,f()});let b;const E=()=>{b?.(),b=i.current()?.subscribe(f),f()};E();const I=i.subscribe(E),g=matchMedia(Ts),y=()=>f();g.addEventListener("change",y),e.getInstance(N)?.addDispose(()=>{l.dispose(),u?.dispose(),v?.dispose(),b?.(),I(),g.removeEventListener("change",y)})}var an;(function(e){function t(i,o,s=(d,l)=>d===l){if(i===o)return!0;if(i.length!==o.length)return!1;for(let d=0;d<i.length;d++)if(!s(i[d],o[d]))return!1;return!0}e.isEqual=t;function n(i,o=s=>s){const s=new Set;return i.filter(d=>{const l=o(d);return s.has(l)?!1:(s.add(l),!0)})}e.unique=n;function r(i=[],o=[],s=(d,l)=>d===l){const d=[],l=[],f=[];for(const u of i){const v=o.find(b=>s(u,b));v?f.push({prev:u,next:v}):l.push(u)}for(const u of o)i.find(v=>s(u,v))||d.push(u);return{added:d,removed:l,exists:f}}e.diff=r})(an||(an={}));function vc(e,t){return e.type===t.type&&e.key===t.key}function bc(e){const t=X(e),n=()=>e.getServices(Te)??[];let r=[];const i=t.onInit(()=>{r=n(),t.send(k.SANDBOX_ADD_EXTENSIONS,r)}),o=us(Te),s=e.onInject(d=>{if(d!==o)return;const l=n();if(!t.isInited()){r=l;return}const{added:f,removed:u}=an.diff(r,l,vc);if(r=l,u.length){if(u.some(v=>v.type==="script")){t.send(k.RELOAD);return}t.send(k.SANDBOX_REMOVE_EXTENSIONS,u.map(v=>v.key))}f.length&&t.send(k.SANDBOX_ADD_EXTENSIONS,f)});e.getInstance(N)?.addDispose(()=>{i.dispose(),s?.dispose()})}var Ec=x("prewarm.editorVisible");function yc(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function _c(e={}){const t=e.paint??yc;let n=!1,r=!1,i=!1,o=!1,s=!1;const d=[],l=()=>{s||o||!n||!r||!i||(o=!0,t(()=>{s=!0,$(J.editorVisible);for(const f of d.splice(0))f()}))};return{noteShellVisible(){n=!0,l()},notePagePainted(){r=!0,l()},noteContentShown(){i=!0,l()},whenVisible(f){if(s){f();return}d.push(f)},contentShown:()=>i}}function wc(e){return e.getOrCreateInstance(Ec,()=>_c())}var Sc=500,Ic=500,Tc=5e3;function Ac(e){const t=e.quietMs??Sc,n=e.floorMs??Ic,r=e.ceilingMs??Tc;let i,o,s=0;const d=()=>{clearTimeout(i),clearTimeout(o),i=void 0,o=void 0},l=()=>{d(),e.run()},f=()=>{clearTimeout(i);const u=n-(Date.now()-s);i=setTimeout(l,Math.max(t,u))};return{start(){d(),s=Date.now(),o=setTimeout(l,r),f()},notify(){i!==void 0&&f()},cancel:d}}function Cc({attributes:e,readContent:t,docId:n,hasSession:r,serverId:i,show:o}){if(!r)return;const s={id:i??void 0,renderGuid:n,showId:o?.id,isNew:i==null,showToken:o?.token},d={...e,...s};return Object.defineProperty(d,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),d}var fo="self-init:";function Rc(e){return e.startsWith(fo)}function po(e,t){const n=e.getActiveShowRequest();return Rc(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Pc(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t();let i="";const o=()=>e.readDocument()?nn(e.readDocument()):i,s=()=>ke(e.container).editorPolicy,d=()=>e.readEmail(),l=()=>{const f=d();return{...f,id:e.isTemplate()||f.isNew?void 0:f.id,html:o()}};return{readContent:o,publicEmail:l,sendInitStart:()=>ae(n,"INIT_START",k.SANDBOX_INIT_START,{guid:d().renderGuid},void 0,r()),sendInited:()=>ae(n,"INITED",k.SANDBOX_INITED,{guid:d().renderGuid},void 0,r()),async sendContent(){const f=d(),{html:u,hasBrowserExtensionArtifacts:v}=oo(f?.html||"");v&&e.events.browserExtensionDetected(),so(e.readDocument(),u),i=u,await ae(n,"SET_ENTITY",k.SANDBOX_SET_ENTITY,rn(o(),f.renderGuid,s(),e.readDocument()?.get().version),{guid:f.renderGuid,emailId:f.id??null},r())},refreshContent:()=>ae(n,"SET_ENTITY",k.SANDBOX_SET_ENTITY,rn(o(),d().renderGuid,s(),e.readDocument()?.get().version),void 0,r()),sendPreheader:async()=>{const f=d();if(f.preheader!==void 0)return ae(n,"PREHEADER",k.SANDBOX_PREHEADER_UPDATE,{value:f.preheader,guid:f.renderGuid,force:!0},void 0,r())},sendSubject:async()=>{const f=d();if(f.subject!==void 0)return ae(n,"SUBJECT",k.SANDBOX_SUBJECT_UPDATE,{value:f.subject,guid:f.renderGuid,force:!0},void 0,r())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:f=>e.showFilled?.(f),readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(l()),fireInit(f,u){if(!po(t(),f)){t().getActiveShowRequest()?.showId;return}const v=d();v.id,v.renderGuid,t().completeShow(f),mt(e.readDocument(),{is_inited:!0},{source:"system"});const b=l();return u&&(b.reset=!0),e.events.inited(b)},fireEmailChanged(){e.events.emailChanged(l())},fireContentChanged(){e.events.contentChanged(o())}}}function Dc(e){const t=()=>e.initPipeline();let n=!1,r,i,o,s=0,d;const l=Pc({...e,waitScope:()=>({getSandboxTimeoutMs:y=>t().getSandboxTimeoutMs(y),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:d?.signal??t().signal})});let f;const u=(y,w)=>{if(f===y)return;f=y;const S=s;setTimeout(()=>{s!==S||t().signal.aborted||I(y,w).catch(()=>{})},0)},v=()=>{d?.abort(),d=void 0};let b;const E=()=>{const y=t().signal;y!==b&&(b?.removeEventListener("abort",v),b=y,y.addEventListener("abort",v))};async function I(y,w){const S=++s;v(),d=new AbortController,E();const A=()=>s!==S,h=l.readTarget(),c=t().generation,a=()=>c===t().generation&&!t().signal.aborted,p=w?"init:reset-":"init:";if(!w){const T=l.publicEmail();T?.id,T?.renderGuid,T?.preheader}let m=!1,_=!1;try{n=!0,await l.sendInitStart(),l.fireWillInit(),await(w?l.refreshContent():l.sendContent()),m=!0,w||l.publicEmail()?.id;try{await l.sendPreheader()}catch(T){`${p}`,String(T)}try{await l.sendSubject()}catch(T){`${p}`,String(T)}if(A()||l.showFilled(h),await l.sendInited(),_=!0,i===y){const T=e.readSandboxGeneration?.()??o;T!==void 0&&(r=T)}await l.revealFilled()}catch(T){throw A()||(`${p}`,{...e.describeSurface?.(),error:String(T)},void 0),!A()&&po(t(),y)&&t().failShow(y,T),T}finally{g(y,w,p,{superseded:A(),sessionGeneration:c,contentApplied:m,sandboxInitedAcked:_,commit:a()})}}function g(y,w,S,A){const{superseded:h,contentApplied:c,sandboxInitedAcked:a}=A;if(h){`${S}`;return}a&&A.commit?l.fireInit(y,w||void 0):a?(`${S}`,A.sessionGeneration,t().generation,t().signal.aborted,void 0):c?(`${S}`,void 0):(`${S}`,void 0),n=!1,d=void 0,!a&&i===y&&(i=void 0,r===o&&(r=void 0)),!a&&c&&u(y,w)}return{channel:l,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:y=>{r=y},lastCorrelation:()=>i,markCorrelation:y=>{i=y},bumpRunSeq:()=>{s+=1},noteSandboxGeneration:y=>{o=y},fill:y=>I(y,!1),refill:y=>I(y,!0),stop:()=>{s+=1,v(),n=!1,b?.removeEventListener("abort",v),b=void 0}}}function Oc(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:ho(e,n)}function ho(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function xc(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:i,readSandboxGeneration:o}=e,s=u=>{const v=n(),b=i();if(!Oc(v,u,b)){u.showId,u.navId,u.emailId,v?.id,v?.showId,v?.renderGuid;return}u.showId,v?.id,v?.renderGuid,t.markFilled(o()),t.markCorrelation(u.showId),t.fill(u.showId).catch(()=>{})};return{showRequested:u=>{s(u)},showRequestIdentityChanged:()=>{const u=e.initPipeline().getActiveShowRequest();u&&s(u)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const u=o();if(t.filledGeneration()===u)return;const v=n(),b=i();if(!v?.renderGuid||!ho(v,b))return;const E=`${fo}${v.renderGuid}`;t.markFilled(u),t.markCorrelation(E);const I=r()?.isReady()===!0;v.id,v.renderGuid,(I?g=>t.refill(g):g=>t.fill(g))(E).catch(()=>{t.lastCorrelation()===E&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id}}}function Lc(e){return e??""}function Mc(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function kc(e){const t=ve(e),n=X(e),r=()=>me(t.sessionKey())?void 0:t.current(),i=()=>{const D=r();return Cc({attributes:D?.get().attributes??{},readContent:()=>D?.getContent(),docId:D?.get().docId,hasSession:!!D,serverId:D?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(De)??Ln;let s={},d=!1;const l=e.getInstance(oe)?.watch(D=>{d=!!D?.element});let f=!1,u=!1,v=!1,b=0;const E=()=>{const D=fe(e);if(!D)return;const V=++b,G=D.spare();return G&&ic(e,G.element),(G?G.reloadQuietly():D.ensureSpare()?.ready())?.then(()=>{if(V!==b)return;f=!0;const ne=D.spare();ne&&rc(e,ne.element),v&&(v=!1,T(),W())})},I=Ac({run:()=>{v||E()?.catch(()=>{})}}),g=()=>{wc(e).noteContentShown(),!f&&!v&&I.start()};let y=!1;const A=Dc({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:i,revealFilled:()=>{const D=fe(e);return y&&D&&(y=!1,I.start()),d?D?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:D=>{const V=fe(e),G=V?.spare()?.element.contentWindow;u&&V&&G&&D===G&&(u=!1,V.promote(),V.busy(!1),y=!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!s.isTemplate,readSandboxGeneration:()=>ue(n),describeSurface:()=>({canvasPath:_,promoted:u,spareClean:f,handshake:n.isInited(),generation:ue(n)}),events:{willInit:D=>{ie(e,F.WILL_EMAIL_INIT_ID).fire(D)},inited:D=>{g(),ie(e,F.ON_EMAIL_INIT_ID).fire(D)},contentChanged:D=>{ie(e,F.ON_CONTENT_CHANGED_ID).fire(D)},emailChanged:D=>{ie(e,F.ON_EMAIL_CHANGED_ID).fire(D)},browserExtensionDetected:()=>{ie(e,F.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),h=xc({pipeline:A,initPipeline:o,readEmail:i,readDocument:r,readRouteEmailId:()=>s.emailId,readSandboxGeneration:()=>ue(n)});let c="",a="",p="";const m=D=>D.length>0;let _="none";const T=()=>{const D=fe(e)?.spare();D&&(n.send({operation:k.SANDBOX_LOCK_EDIT,data:!0}),f=!1,u=!0,nc(e,D.element))},C=(D,V)=>{const G=fe(e);if(!G)return!0;const ne=G.spare(),Ee=ne&&f?"spare":"prepare";if(_=Ee,G.busy(!0),ne&&f)return T(),!0;I.cancel(),n.send({operation:k.SANDBOX_LOCK_EDIT,data:!0});const ye=E();if(ye===void 0)return _="reload",G.busy(!1),G.peek("email")?.reload(),!0;v=!0;const Tt=b;return ye.catch(()=>{!v||Tt!==b||(v=!1,_="reload",G.busy(!1),G.peek("email")?.reload())}),!1},P=()=>{be(),A.noteSandboxGeneration(ue(n));const D=i(),V=Mc(D?.renderGuid,D?.showId,D?.id,s.emailId),G=Lc(D?.renderGuid);if(G!==a){const ye=m(a),Tt=a;a=G,ye&&C(Tt,G)}if(v)return;V!==c&&(c=V,h.showRequestIdentityChanged());const ne=r(),Ee=`${V}|${ne?.get().docId??""}|${ue(n)}`;Ee!==p&&ne?.isReady()===!0&&(p=Ee,h.selfInitChanged()),h.saasChanged(),z()};let j=!1,R="",O="";const z=()=>{const D=i();if(!D?.renderGuid)return;const V=A.channel.readContent(),G=JSON.stringify([D.preheader,D.common_styles,D.meta,D.subject,D.utm_parameters?.utm_campaign??"",D.utm_parameters?.utm_content??"",D.utm_parameters?.utm_medium??"",D.utm_parameters?.utm_source??"",D.utm_parameters?.utm_term??""]),ne=j&&V!==O,Ee=j&&G!==R;if(j=!0,O=V,R=G,A.isEventsLocked())return;const ye={...D,id:s.isTemplate||D.isNew?void 0:D.id,html:V};if(ne){ie(e,F.ON_CONTENT_CHANGED_ID).fire(V),ie(e,F.ON_EMAIL_CHANGED_ID).fire(ye);return}Ee&&D.is_inited&&ie(e,F.ON_EMAIL_CHANGED_ID).fire(ye)};let B=!1;const W=()=>{B||(B=!0,queueMicrotask(()=>{B=!1,P()}))};e.inject(Mn,{pipeline:A,setRoute:D=>{D.emailId===s.emailId&&!!D.isTemplate==!!s.isTemplate||(s=D,W())}});let de,L;const H=()=>{const D=r()?.get().docId;D!==L&&(de?.(),L=D,de=r()?.subscribe(W)),W()};let U,Y;const be=()=>{const D=e.getInstance(De);!D||D===U||(Y?.(),U=D,Y=D.onShowRequested(V=>h.showRequested(V)))},Qe=n.addListener(D=>{D.data?.operation===k.SANDBOX_RESIZED&&I.notify()}),Xo=t.subscribe(H),Jo=no(n,W);H(),e.getInstance(N)?.addDispose(()=>{l?.dispose(),Y?.(),Jo(),Xo(),de?.(),Qe.dispose(),I.cancel(),A.stop()})}function Nc(){return Ms!=="useblocks"}var ln={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:"",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},Fc={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:"",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}},vr=ln,jc=["freeUserBlocks","blocks"],mo={};function Bc(e){mo=e}var go=e=>jc.includes(e)?vr:mo[e]??vr,dn={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:"",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},Uc={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:"",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},Hc={...dn,config:{...dn.config,imageCenterFileManagerView:!1}};Bc({pro:Fc,editor:Uc,simple:Nc()?dn:Hc,freeUserBlocks:ln,blocks:ln});var br=new Set;function Gc(){return window.localStorage.getItem(bt.em_color_scheme)??void 0}function qc(e){return br.add(e),e(Gc()),{dispose(){br.delete(e)}}}function kn(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function $c(e,t){return t.modeDefaults(kn(e,t.fallbackMode))}function zc(e,t){const n=kn(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Vc(e,t){const n=kn(e,t),r=e.user?.advancedConfigs?.[n],i=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...i}}function Kc(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function Wc(e){return os(e.map(t=>t?.resourceProxy))}function Yc(e){return rs(e.map(t=>t?.resourceProxyPolicy))}function Xc(e){return gs(e.map(t=>t?.backendProxy))}function Jc(e){return li(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Qc(e,t){return[e.base,$c(e,t),e.profile,e.serverSide,zc(e,t.fallbackMode),e.user,Vc(e,t.fallbackMode),e.local]}function xt(e,t){const n=Qc(e,t),r=li(n),i=Kc(n);i!==void 0&&(r.fileManager=i);const o=Wc(n);o!==void 0&&(r.resourceProxy=o);const s=Yc(n);s&&Object.keys(s).length>0&&(r.resourceProxyPolicy=s);const d=Xc(n);d!==void 0&&(r.backendProxy=d);const l=Jc(n);return l&&Object.keys(l).length>0&&(r.backendProxyPolicy=l),r}var Zc=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function Er(e){return e==="server"?"serverSide":e}function eu({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},i=Me();let o={kind:"pending"},s;const d=new Promise(b=>{s=b}),l=n===void 0?void 0:setTimeout(()=>{u({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function f(){o.kind!=="pending"&&i.set(xt(r,e))}function u(b){if(o.kind!=="pending")return;clearTimeout(l),o=b;const E=xt(r,e);i.set(E),s(E)}function v(b,E){r[Er(b)]=E,b==="server"&&o.kind==="pending"?u({kind:"applied"}):f()}return{watch:b=>i.watch(b),select:b=>i.select(b),get:()=>i.get(),ready:()=>d,state:()=>o,layers:()=>({...r}),bootstrap(){const b=xt(r,e);return Object.fromEntries(Zc.map(E=>[E,b[E]]))},merge(b,E){v(E,{...r[Er(E)],...b})},replace(b,E){v(E,b)},setMode(b){r.user={...r.user,mode:b},f()},setAdvancedConfigs(b){r.advancedConfigs=b,f()},serverAbsent(b){u({kind:"absent",reason:b})},applyServerResponse(b){o.kind==="pending"&&v("server",{...r.serverSide,...b})},dispose(){clearTimeout(l)}}}var tu=5e3,nu="blocks";function ru(){return{...go(nu)?.config,mergeTags:void 0}}function iu(e,t){e.getInstance(oe)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function ou(e,t){let n;Ki(e).watch(({profile:r})=>{const i=`${r?.theme??""}|${r?.locale??""}`;if(i===n)return;n=i;const o={};r?.theme&&(o.theme=r.theme),r?.locale&&(o.locale=r.locale),t.replace(o,"profile")})}function su(e,t){let n=null;const r=qc(i=>{const o=typeof i=="string"&&i?i:void 0;o!==n&&(n=o,t.replace(o?{theme:o}:{},"local"))});e.getInstance(N)?.addDisposable(r)}async function au(e,t){if(e.getInstance(An)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(Pe);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function lu(e){e.injectFactory(we,(t,n)=>{if(n)return n;const r=eu({base:ru(),env:{modeDefaults:i=>go(i)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:tu});return iu(e,r),ou(e,r),su(e,r),au(e,r),e.getInstance(N)?.addDisposable(r),r},!0)}var Re=class extends Z{_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 M(e,t,n){const r=ns(e);return(i,o,s)=>{const d=r(async l=>{const f=t?t(l):l;s&&i.bind(s);const u=await i(f);return n?n(u):u},o,s);return()=>d.dispose()}}var du=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new Jt;this.handleDestroy=M(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Re(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{}}},Nn=x("DestroyableService");function cu(e){e.injectFactory(Nn,()=>{const t=e.getInstance(N);if(!t)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new du({lifetime:t,options:e.getInstance(oe),getInstance:()=>e.getInstance(Et),release:()=>Os(e.getInstance(As)??e)})},!0)}function uu(e){const t=e.getInstance(Nn);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var fu=1e3;function vo(e,t,n=fu,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 i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(const s of i)if(!vo(e[s],t[s],n,r+1))return!1;return!0}return!1}function He(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 i=t[r],o=e[r];vo(i,o)||(n[r]=i)}return n}var pu=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleSaveEmail не ответил за ${e}ms — письмо не сохранено`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}},hu=({source:e,emailtags:t,group:n,tags:r,...i})=>i,mu=()=>Ai();async function gu({emails:e},t){const n=mu();let r;try{return await Promise.race([e.notifySave(t),new Promise((i,o)=>{r=setTimeout(()=>{const s=new pu(n);t.value.id,o(s)},n)})])}finally{r!==void 0&&clearTimeout(r)}}function vu(e){const{emails:t}=e,n=async(r,i)=>{const o=hu(i),s=r===void 0?void 0:await t.cache.getIfPresent(r),d=s?{...s,...o}:o,l=await gu(e,{prev:s,patch:s?He(s,o):o,value:d,source:i.source??""}),f=String(l.id??r??le()),u=l.id===void 0?{...l,id:f}:l;return await t.cache.addOrUpdate(f,()=>u)};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const i=await n(void 0,r);return i?.renderGuid?i:{...i,renderGuid:le()}},async updateEmail(r,i){return await n(r,i)}}}var Lt=20,bu=({source:e,emailtags:t,group:n,tags:r,...i})=>i;function Eu({revisions:e,revisionsByEmail:t}){const n=async(r,i)=>(t.clear(),await t.get(r,{page:i}),(await e.cache.values()??[]).filter(o=>String(o?.parent)===String(r)));return{async readRevisions(r,i=1){const o=await n(r,i);return{revisions:o.slice(Lt*(i-1),Lt*i),page:i,hasMore:o.length>Lt*i}},async readAutosave(r){return $a(await n(r,1))},async saveAutosave(r,i){const o=bu(i);return await e.create({...o,parent:r,modified:new Date().toString()})}}}var yu=class extends Bs{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}},_u=class extends pe{};var yr=class extends Z{_items=new Map;_onChangeEmitter=new _s;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 i=await t(n);return pt(n,i)||this._onChangeEmitter.fire(),i}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(([i,o])=>i)),r=(await this.entries()).filter(([i,o])=>!n.has(i));for(const[i,o]of e)t.push(this.addOrUpdate(i,()=>o)),n.add(i);for(const[i]of r)t.push(this.remove(i));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 wu(e,{filter:t,order:n="asc",orderBy:r,page:i,pageSize:o=20}={}){const s=e.length;let d=e.length;if(t!==void 0){const l=Object.keys(t);e=e.filter(f=>{for(const u of l){const v=f[u],b=t[u];return u==="id"||typeof v!="string"?v===b:typeof b=="string"&&v.startsWith(b)}return!0}),d=e.length}return r&&(e=e.sort((l,f)=>(l[r]>f[r]?1:f[r]>l[r]?-1:0)*(n==="asc"?1:-1))),i!==void 0&&(e=e.slice(o*(i-1),o*i)),{data:e,filteredTotal:d,total:s,totalPages:Math.ceil(d/o)}}function Su(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 i=t.get(r.id)||{};t.set(r.id,{...i,...r})}return[...t].map(([n,r])=>r)}function Iu(e,t){return _r(e)&&_r(t)?String(e)===String(t):e===t}function _r(e){return typeof e=="string"||typeof e=="number"}var Tu=class extends Z{_cache=new yr;_readEmitter=new pe;_saveEmitter=this.addDisposable(new yu);_removeEmitter=this.addDisposable(new _u);_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)))}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const n=this.addDisposable(new Z);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new yr),i=n.addDisposable(new pe);t=this._foreignCache[e]={get:async(o,s={})=>{await r.getOrCreate(o,async()=>{try{const l=Su(await i.fire(o))||[];for(const f of l)f[e]=o,await this._cache.add(f.id,f);return l}catch{return[]}});const d=(await this._cache.values()||[]).filter(l=>{const f=l[e];return f==null||Iu(f,o)});return wu(d,s)},first(o,s={}){return t.get(o,{...s,page:1,pageSize:1}).then(({data:d})=>d[0])},handleRead:i.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=le()),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 i=>{const o=i?{...i,...t}:t;if(!r)return t=i?He(i,t):t,await this._saveEmitter.fire({prev:i,patch:t,value:o,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 Xe(e){const t=x(e);return n=>n.getOrCreateInstance(t,()=>new Tu)}function Au(e){const t=e.getInstance(N);if(!t)throw new Error("Failed");return t}function wr(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Cu(e,t,n){return e&&!wr(t)&&wr(e)?{...n,meta:e.meta}:n}var bo=Xe("plugin.dataSource.emails"),Eo=Xe("plugin.dataSource.emailRevisions"),Sr=x("emailDocuments.provided");function Ru(e){const t=bo(e),n=Eo(e),r=n.byForeignKey("parent");return e.getInstance(Sr)?{emails:t,emailRevisions:n}:(e.inject(Sr,!0),cl(e,vu({emails:t})),hl(e,Eu({revisions:n,revisionsByEmail:r})),Au(e).addDisposable(t.onSave(({prev:i,patch:o,value:s})=>Cu(i,o,s),Number.MIN_VALUE)),{emails:t,emailRevisions:n})}function Ir(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 Pu(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var Du="po",ot=null;function Ou(){const e=typeof window.__useblocks__<"u"?window.__useblocks__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([Du],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function xu(){return ot===null&&(ot=Ou().catch(e=>{throw ot=null,e})),ot}async function yo(e){if(typeof e=="object")return Fn(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?Lu(t):Mu(t)}function Fn(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function Lu(e){try{return Fn(JSON.parse(e))}catch{return}}var Tr=!1;async function Mu(e){try{return Fn((await xu()).parsePoCatalog(e))}catch{Tr||(Tr=!0);return}}var ku="em_locale",Nu="em_ant_locale",Fu="locale",ju="ant_locale";function jn(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function _o(e,t){const n=jn(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function Bu(){return jn("em_locale")??_o(Fu,"em_locale")}function Ar(e){try{localStorage.setItem(ku,JSON.stringify(e))}catch{}}function Uu(){return jn("em_ant_locale")??_o(ju,"em_ant_locale")}function Hu(e,t){try{localStorage.setItem(Nu,JSON.stringify({id:e,data:t}))}catch{}}var Gu=8e3;function qu(e,t){const n=e,r=t,i=Object.keys(n).filter(o=>o!=="");return i.length!==Object.keys(r).filter(o=>o!=="").length?!1:i.every(o=>JSON.stringify(n[o])===JSON.stringify(r[o]))}function $u(e){const t=Bu(),n=Uu();let r={ready:!1},i;const o=Me(r);let s=0;const d=y=>{r={...r,...y},o.set(r)},l=()=>{r.ready||d({ready:!0})},f=setTimeout(l,e.unlockAfterMs??Gu),u=y=>y!==s;let v;async function b(y,w){if(n?.id===y&&n.data&&d({antd:n.data}),!v)return;const S=await v(y).catch(()=>{});!S||u(w)||(d({antd:S}),Hu(y,S))}async function E(y,w){const S=await e.askHost(y).catch(()=>null);if(u(w))return!0;if(S==null)return!1;const A=await yo(S);return u(w)||(A&&d({catalog:A}),l()),!0}async function I(y,w){const S=await e.readList();if(u(w))return;if("error"in S){d({failure:{kind:"GET_LOCALES_ERROR",error:S.error}}),l();return}const A=S.data.find(c=>c.locale===y);if(!A){Pu("em_locale")&&d({catalog:void 0}),l();return}if(Ir(t,A)&&(!i||i.catalog===t?.data)){l();return}if(i?.entry&&r.catalog===i.catalog&&Ir(i.entry,A)){Ar(i.entry),l();return}const h=await e.readCatalog(y);if(!u(w)){if("error"in h){d({failure:{kind:"GET_LOCALE_ERROR",error:h.error}}),l();return}h.data&&(i?.id===y&&r.catalog===i.catalog&&qu(i.catalog,h.data)||d({catalog:h.data}),Ar({id:y,time:A.updatedAt||Math.floor(Date.now()/1e3),hash:A.contentHash,data:h.data})),l()}}async function g(y,w){if(!await E(y,w)){if(!u(w)&&(i?.id===y&&r.catalog===i.catalog||y==="en_US")&&l(),e.canUseNetwork&&!e.canUseNetwork()){l();return}await I(y,w)}}return{set(y){if(!y||y===r.id)return;const w=s+=1;d({id:y,failure:void 0});const S=i?.id===y&&r.catalog===i.catalog;(i&&!S&&r.catalog===i.catalog||y==="en_US"&&r.catalog)&&d({catalog:void 0}),t?.id===y&&t.data&&(d({catalog:t.data}),l()),b(y,w),g(y,w)},prime(y,w,S){r.id||r.catalog||!w||(i=t?.id===y&&t.data&&(!S||t.time>=S.time)?{id:y,catalog:t.data}:{id:y,catalog:w,entry:S?{id:y,time:S.time,hash:S.hash,data:w}:void 0},d({catalog:i.catalog}))},useAntdLoader(y){v=y,r.id&&b(r.id,s)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(f)}}var zu=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})},Vu=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:i,format:o,baseUrl:s,cancelToken:d,...l})=>{const f=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(l,f),v=i&&this.toQueryString(i),b=this.contentFormatters[r||"application/json"],E=o||u.format;return this.customFetch(`${s||this.baseUrl||""}${n}${v?`?${v}`:""}`,{...u,headers:{...u.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(d?this.createAbortSignal(d):u.signal)||null,body:typeof e>"u"||e===null?null:b(e)}).then(async I=>{const g=I;g.data=null,g.error=null;const y=E?I.clone():I,w=E?await y[E]().then(S=>(g.ok?g.data=S:g.error=S,g)).catch(S=>(g.error=S,g)):g;return d&&this.abortControllers.delete(d),w})}},Ku=x("rest.v2.transport"),Cr=Symbol("rest.v2.secureRequest");function Wu(e){return e.getOrCreateInstance(Ku,()=>{const t=e.getInstance(ai)?.execute||fetch;return new Vu({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[Cr]:!0}),customFetch:(n,r={})=>{const{[Cr]:i,...o}=r;return t(n,{...o,[ls]:i!==!0})}})})}function Yu(e,t){const n=Wu(e);return Object.assign({},...t.map(r=>new r(n)))}function Rr(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function wo(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Rr(n.details,"wp_code")??n.code,message:Rr(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 So(e){return!e.ok||!!e.error}function Xu(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function Io(){return Xu(bt.em_translations_v2)??!0}function Ju(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Qu(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function Zu(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],i=r[0];return typeof i=="string"&&i!==""&&t.push({locale:i,updatedAt:Ju(r[1])}),t},[]):[]}function ef(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:Qu(n.updated_at),contentHash:n.content_hash}),t),[])}function To(e){return Yu(e,[zu])}function vt(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function cn(e){return!e.ok||e.error!=null}function un(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function Mt(e){return{data:await yo(e)??null}}async function tf(e){if(Io())try{const n=await To(e).localesList();return So(n)?{error:wo(n)}:{data:ef(n.data)}}catch(n){return vt(n)}const t=ci(e,[vi]);try{const n=await t.get_translations2({file:"react_app"});return cn(n)?un(n):{data:Zu(n.data)}}catch(n){return vt(n)}}async function nf(e,t){if(Io())try{const r=await To(e).jsonList({locale:t});return So(r)?{error:wo(r)}:Mt(r.data)}catch(r){return vt(r)}const n=ci(e,[vi]);try{const r=await n.get_translations3({id:t,file:"react_app"});return cn(r)?un(r):Mt(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return cn(r)?un(r):Mt(r.data)}catch(r){return vt(r)}}}var $e=x("locale.service");function rf(e){if(e.getInstance($e))return;const t=$u({readList:()=>tf(e),readCatalog:n=>nf(e,n),askHost:async n=>(await ie(e,F.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(he)});e.inject($e,t),e.getInstance(N)?.addDispose(()=>t.dispose())}function of(e){const t=e.getInstance(we);if(!t)return;const n=e.getInstance($e);if(!n)return;const r=t.select(i=>i.locale).watch(i=>n.set(i));e.getInstance(N)?.addDisposable(r)}var sf="user_id",af="project_id",Pr=x("rest.identityHeadersProvided");function lf(e){if(e.getInstance(Pr))return;e.inject(Pr,!0);let t;e.getInstance(oe)?.watch(n=>{t=n}),e.addService(wn,{execute(n,r){if(r?.public)return;const i=t?.user?.id??Wi(e).profile?.id;i!=null&&i!==""&&n.headers.set(sf,String(i));const o=t?.project;o!=null&&o!==""&&n.headers.set(af,String(o))}})}function df(e){if(!e)return!1;try{return e.getInstance(he)!==void 0}catch{return!1}}var cf="Invalid standaloneKey.",Sm=x("StandaloneMockGuard");function uf(){const e=new Error(cf);return e.name="InvalidStandaloneKeyError",e}function ff(e){e.addService(wn,{execute:()=>{if(df(e))throw uf()}})}function pf(e){ys(e),ff(e)}function hf(e){const t=new lo;e.inject(De,t);let n;const r=e.getInstance(oe)?.watch(o=>{o&&(o.signal!==void 0&&(n=o.signal),t.configure({replaceSession:!0,...o.timeouts!==void 0?{timeouts:o.timeouts}:{},...n!==void 0?{signal:n}:{}}))}),i=e.getInstance(N);r&&i?.addDisposable(r),i?.addDispose(()=>{t.abort()})}var mf=Xe("plugin.dataSource.blocks"),gf=Xe("plugin.dataSource.blockRevisions"),vf=Xe("plugin.dataSource.comments"),bf=ao(),Ef=ao(),Ao=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
1003
|
+
`));return{html:Rd(t.html),hasBrowserExtensionArtifacts:t.found}}function ln(e){return e?.getContent()??""}function po(e,t){e?.mutate({content:Ni(t)},{source:"remote"})}function ho(e){return L(e)}function oe(e,t){return e.getOrCreateInstance(t,()=>new pe)}function K(e,t){return e.getOrCreateInstance(t,()=>new pe).event}function dn(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var Pd=class extends Error{showId;constructor(e,t){super(`[useblocks] 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}},Dd=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(Z("Superseded by newer show()")),n.aborted?Promise.reject(Z(n.reason)):(this._activeRequest=e,new Promise((r,i)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{i(new Pd(e.showId,t))})},t);o.unref?.();const s=()=>{this._settle(e.showId,()=>{i(Z(n.reason))})};n.addEventListener("abort",s,{once:!0});const d=()=>{clearTimeout(o),n.removeEventListener("abort",s)};this._pending.set(e.showId,{request:e,resolve:r,reject:i,timeoutId:o,dispose:d});for(const a of this._listeners)a(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 Od(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function xd(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=Pi(e),n=Di(e),r=Aa(e.sandbox);t<n+r}var mo=class{_controller=new AbortController;_externalSignalDisposable=new ee;_sessionChangeListeners=new Set;_showRegistry=new Dd;_timeouts;_generation=0;_sessionStarted=!1;get signal(){return this._controller.signal}get generation(){return this._generation}get contentReadyTimeoutMs(){return Pi(this._timeouts)}getSandboxTimeoutMs(e){return Ri(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return Di(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=Od(this._timeouts,e.timeouts),xd(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}abort(e){const t=e??Z("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new ee}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new ee,this._showRegistry.rejectAll(Z("Init session replaced")),this._controller.signal.aborted||this._controller.abort(Z("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??Z()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??Z()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},Hn=(()=>{const e=new mo;return e.configure({}),e})(),Ld=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 Md(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 kd(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():($(n),new Promise((r,i)=>{let o=!1,s,d;const a=u=>{o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),d?.dispose(),n?.removeEventListener("abort",f),u())},f=()=>{a(()=>i(Z(n?.reason)))};if(d=e.onInit(()=>{e.isInited()&&e.getTarget()&&a(()=>r())}),e.isInited()&&e.getTarget()){a(()=>r());return}t>0&&(s=setTimeout(()=>{a(()=>i(new Ld(t)))},t)),n?.addEventListener("abort",f)}))}var Nd=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 Fd(e,t,n){return t<=0?e:new Promise((r,i)=>{let o=!1,s;const d=a=>{o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),a())};s=setTimeout(()=>{d(()=>i(new Nd(n,t)))},t),e.then(a=>{d(()=>r(a))},a=>{d(()=>i(a))})})}var jd=2,st=Symbol("sandbox:frame-replaced");function de(e,t,n,r,i,o,s){const d=`sandbox:${t}`,a=o?.getSandboxTimeoutMs(t)??Nn[t],f=()=>{let I=Fd(e.sendAsync(n,r),a,d);return I=pt(I,o?.signal),He(d,I,i)};if(t==="INIT_START"&&Md(e)){const I=o?.getSandboxReadyTimeoutMs()??2e4,g=e,y=_=>{const S=kd(g,I,o?.signal);return He("sandbox:INIT_START:ready-wait",S,i).then(()=>{if(!s||_<=0)return f();const A=s.getGeneration();let h;const c=new Promise((p,m)=>{h=s.onChange(()=>{s.getGeneration()!==A&&m(st)})}),l=f();return l.catch(()=>{}),Promise.race([l,c]).finally(()=>h?.()).catch(p=>{if(p!==st)throw p;return{...i},y(_-1)})})};return y(jd)}if(!s)return f();const u=s.getGeneration();let v;const b=new Promise((I,g)=>{v=s.onChange(()=>{s.getGeneration()!==u&&g(st)})}),E=f();return E.catch(()=>{}),Promise.race([E,b]).finally(()=>v?.()).catch(I=>{throw I===st&&{...i},I})}var Bd=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],Ud=200;function Hd(e=new Set){const t=new Set;return(n,r)=>{if(!Bd.some(([o,s])=>!e.has(o)&&s.test(n)))return;const i=r??`new:${n.length}:${n.slice(0,200)}`;t.has(i)||(t.size>=Ud&&t.clear(),t.add(i))}}function Gd(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:Hd()}}var qd=Gd();function ke(e){return e?.getInstance(Fs)??qd}function $d(e){const t=ve(e),n=X(e),r=()=>e.getInstance(De)??Hn;let i,o,s=!1,d=!1;const a=async(S,A,h)=>{const c=h.generation,l=()=>h.generation!==c||h.signal.aborted||t.current()!==S||d,p=ue(n);s=!0;try{if(await de(n,"INIT_START",F.SANDBOX_INIT_START,{guid:A},void 0,h),l())return;const{html:m,hasBrowserExtensionArtifacts:w}=fo(ln(S));if(w&&oe(e,B.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),po(S,m),await de(n,"SET_ENTITY",F.SANDBOX_SET_ENTITY,dn(ln(S),A,ke(e).editorPolicy,S.get().version),void 0,h),l())return;await de(n,"INITED",F.SANDBOX_INITED,{guid:A},void 0,h),i=A,o=p}finally{s=!1}},f=()=>me(t.sessionKey())?t.current():void 0,u=()=>{if(d||s)return;const S=f(),A=S?.get().docId;if(!S||!A||i===A&&o===ue(n)||!S.isReady())return;const h=r();h.signal.aborted||a(S,A,h).catch(()=>{})};let v=!1;const b=()=>{v||d||(v=!0,queueMicrotask(()=>{v=!1,u()}))};let E,I;const g=()=>{const S=f(),A=S?.get().docId;A!==I&&(E?.(),I=A,E=S?.subscribe(b)),b()},y=t.subscribe(g),_=lo(n,b);g(),e.getInstance(j)?.addDispose(()=>{d=!0,_(),E?.(),y()})}var zd=200;function Vd({startVersion:e,limit:t=zd}){let n=[],r=e;const i=o=>{n=n.filter(s=>s.version>o),r=Math.max(r,o)};return{record(o){!o.changes?.length&&!o.contentReplaced||(n.push(o),n.length>t&&i(n[n.length-t-1].version))},rebase(o,s){if(s<r)return null;const d=n.filter(f=>f.version>s);i(s);let a=o;for(const f of d){if(f.fromCanvas||f.contentReplaced||!f.changes)return null;const u=f.changes,v=[];for(const b of a){const E=Fa(b.range,u,"after");if(!E)return null;v.push({range:E,text:b.text})}a=v}return a}}}function Kd(e,t){let n=0;return e.map(({start:r,end:i,text:o})=>{const s=new ie(r,t.slice(r,i),r+n,o);return n+=o.length-(i-r),s})}function Wd(e,t){const n=[...e].sort((r,i)=>r.range.start-i.range.start);return Kd(n.map(({range:r,text:i})=>({start:r.start,end:r.end,text:i})),t)}function Yd(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var Gn=L("canvas.sandboxFill");function go(e){return e.getInstance(Gn)?.pipeline.isEventsLocked()===!0}function Lt(e){wt(e,{origin:"canvas-channel"})}function Xd(e){const t=ve(e),n=X(e);let r;const i=(a,f)=>{const u=a.get().docId;let v=!1,b=null,E=null;const I=Vd({startVersion:a.get().version});let g=a.getContent();const y=async(c,l)=>{if(E){E.push({edits:c,rev:l});return}E=[{edits:c,rev:l}];try{do{const p=E.splice(0,E.length);await n.sendAsync(F.SANDBOX_UPDATE_ENTITY,{edits:p.map(m=>m.edits),guid:u,rev:p[p.length-1].rev})}while(E.length)}finally{E=null}},_=(c,l)=>{const p=E?.splice(0,E.length)??[];p.length&&n.sendAsync(F.SANDBOX_UPDATE_ENTITY,{edits:p.map(m=>m.edits),guid:u,rev:p[p.length-1].rev}).catch(Lt),n.sendAsync(F.SANDBOX_UPDATE_ENTITY,{edits:[c],guid:u,rev:a.get().version,...l!==null?{changeId:l}:{}}).catch(Lt)},S=c=>{const{guid:l,pushUndoStop:p}=c;if(l!==u)return;const m=Wa(c);let{edits:w}=c;if(m.baseRev!==null){const O=I.rebase(w,m.baseRev);if(!O){wt(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),_([],m.changeId);return}w=O}const T=a.get().version;try{v=!0,b=m.changeId;const O=Wd(w,a.getContent());p===!1?f.applyWithoutHistory(O):a.mutate({changes:O},{source:go(e)?"system":"user"})}finally{v=!1,b=null}a.get().version===T&&m.baseRev!==null&&_([],m.changeId)},A=a.subscribe(({changes:c,version:l})=>{const p=a.getContent(),m=!c?.length&&p!==g;if(g=p,I.record({version:l,changes:c,contentReplaced:m,fromCanvas:v}),!c?.length)return;const w=Yd(c);v?_(w,b):y(w,l).catch(Lt)}),h=n.addListener(F.APPLICATION_UPDATE_ENTITY,S);return()=>{A(),h.dispose()}};let o;const s=()=>{const a=t.current(),f=t.history(),u=a?.get().docId;u!==o&&(r?.(),r=void 0,o=u,a&&f&&(r=i(a,f)))},d=t.subscribe(s);s(),e.getInstance(j)?.addDispose(()=>{r?.(),d()})}var Jd=300,Qd=15e3,wr="em-canvas-busy-style";function Zd(){if(document.getElementById(wr))return;const e=document.createElement("style");e.id=wr,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}function ec(e){const t=e.getBoundingClientRect(),n=document.createElement("div");return n.setAttribute("aria-busy","true"),Object.assign(n.style,{position:"fixed",left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`,cursor:"progress",display:"flex",alignItems:"center",justifyContent:"center"}),e.appendChild(n),{showSpinner(){Zd(),n.style.background="rgba(128, 128, 128, 0.15)";const r=document.createElement("div");Object.assign(r.style,{width:"32px",height:"32px",borderRadius:"50%",border:"3px solid rgba(128, 128, 128, 0.35)",borderTopColor:"rgba(80, 80, 80, 0.9)",animation:"em-canvas-busy-spin 0.8s linear infinite"}),n.appendChild(r)},remove:()=>n.remove()}}var tc=8e3;function nc(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,whenShown:()=>Promise.resolve(),alignTo:()=>{},resize:()=>{},dispose:()=>{}}}var rc=e=>{for(let t=e?.parentElement??null;t;t=t.parentElement){const n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="hidden")return t}return null};function ic(e,t,n,r,i){const o=n.readyTimeoutMs??tc,s=document.createElement("div");s.dataset.canvasHost=e,r&&(s.dataset.canvasPlace=r),s.style.position="fixed",s.style.overflow="hidden",s.style.visibility="hidden";const d=n.resolveSrc(e),a=document.createElement("iframe");a.setAttribute("sandbox",n.resolveSandbox(d)),a.setAttribute("allow","clipboard-read; clipboard-write"),a.setAttribute("title","Email content"),a.style.width="100%",a.style.border="0",a.style.display="block",a.style.minHeight="600px",a.src=d,s.appendChild(a),t.appendChild(s),n.mark?.("created"),i||n.onCreated?.(a);const f=new ee;let u=!1,v=!1,b,E,I,g;const y=()=>{clearTimeout(g),g=setTimeout(()=>{v||(v=!0,E?.(new Error(`[canvas] ${e}: документ не загрузился за ${o} мс`)))},o)},_=()=>u?(I=Promise.resolve(),v=!0,I):(v=!1,I=new Promise((M,G)=>{b=M,E=G}),y(),I),S=()=>{if(clearTimeout(g),u=!0,v){I=Promise.resolve();return}v=!0,n.mark?.("loaded"),b?.()};a.addEventListener("load",S),f.addDispose(()=>{clearTimeout(g),a.removeEventListener("load",S)});let A;const h=()=>{A??=n.bindResizer?.(a)};let c=null,l=null,p;const m=()=>{if(!c){s.style.visibility="hidden",a.removeAttribute("id");return}n.elementId&&(a.id=n.elementId);const M=c.getBoundingClientRect(),G=l?.isConnected?l:rc(c),H=G?G.getBoundingClientRect():null,Y=H?Math.max(M.top,H.top):M.top,be=H?Math.min(M.bottom,H.bottom):M.bottom,et=Math.max(0,be-Y);s.style.visibility=et>0?"visible":"hidden",s.style.left=`${M.left}px`,s.style.top=`${Y}px`,s.style.width=`${M.width}px`,s.style.height=`${et}px`,a.style.transform=`translateY(${M.top-Y}px)`};let w="",T="",O=0,k;const W=()=>{if(!c){k=void 0;return}k=window.requestAnimationFrame(W);const M=c.getBoundingClientRect(),G=l?.isConnected?l.getBoundingClientRect():void 0,H=`${Math.round(M.left)}:${Math.round(M.top)}:${Math.round(M.width)}:${Math.round(M.height)}:${G?`${Math.round(G.top)}:${Math.round(G.height)}`:"-"}`;H!==w&&(w=H,m());const Y=a.getBoundingClientRect().height;Y>0&&Y!==O&&(O=Y,c.style.height=`${Y}px`);const be=getComputedStyle(c).pointerEvents;be!==T&&(T=be,s.style.pointerEvents=be)},R=()=>{k===void 0&&c&&(k=window.requestAnimationFrame(W))},C=()=>{k!==void 0&&(window.cancelAnimationFrame(k),k=void 0)},D=()=>m();let x=[];const U=(M,G)=>{if(l=G,M&&x.length>0){const H=x;x=[],H.forEach(Y=>Y())}if(M===c){m();return}if(p?.disconnect(),p=void 0,c&&c.style.removeProperty("height"),w="",O=0,T="",c=M,!M){C(),m();return}n.onShown?.(a);try{if(typeof ResizeObserver=="function"){const H=new ResizeObserver(m);typeof H.observe=="function"&&(p=H,p.observe(M))}}catch{p=void 0}m(),h(),R()};window.addEventListener("scroll",D,!0),window.addEventListener("resize",D),f.addDispose(()=>{p?.disconnect(),k!==void 0&&window.cancelAnimationFrame(k),window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D)});const J=M=>{u=!1,M&&n.onReload?.(a);let G;v||I===void 0?G=_():(y(),G=I);try{a.contentWindow?.location.reload()}catch{a.src=d}return G};return{element:a,ready(){return I??_()},reload:()=>J(!0),reloadQuietly:()=>J(!1),get shown(){return c!==null},whenShown(){return c!==null?Promise.resolve():new Promise(M=>{x.push(M)})},alignTo(M,G){U(M,G??null)},scrollBy(M,G){for(let H=c?.parentElement??null;H;H=H.parentElement){const Y=getComputedStyle(H);if((Y.overflowY==="auto"||Y.overflowY==="scroll")&&H.scrollHeight>H.clientHeight){H.scrollBy({left:M,top:G,behavior:"instant"});return}}window.scrollBy({left:M,top:G,behavior:"instant"})},resize(){A?.resize()},dispose(){U(null,null),A?.dispose(),f.dispose(),s.remove()}}}function oc(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",i=(u,v)=>u==="email"?`email:${v??n}`:u;let o,s=[];const d=()=>{s.forEach(u=>clearTimeout(u)),s=[],o?.remove(),o=void 0},a=new Map,f=(u,v,b)=>{const E=i(u,v),I=t.get(E);if(I)return I;const g=e.resolveMount();if(!g)return nc();const y=ic(u,g,e,u==="email"?v??n:void 0,b);return t.set(E,y),y};return{get:u=>f(u),current:u=>f(u),peek:u=>t.get(i(u)),spare:()=>t.get(i("email",r())),ensureSpare:()=>f("email",r(),!0),promote(){const u=t.get(i("email",r()));if(!u)return;const v=t.get(i("email"));n=r();const b=a.get("email");u.alignTo(b?.slot??null,b?.clip??null),v?.alignTo(null)},alignSurface(u,v,b){a.set(u,{slot:v,clip:b??null}),(v?f(u):t.get(i(u)))?.alignTo(v,b??null)},visible(){for(const u of t.values())if(u.shown)return u},byWindow(u){if(u){for(const v of t.values())if(v.element.contentWindow===u)return v}},busy(u){d();const v=u?e.resolveMount():void 0;if(!v)return;const b=ec(v);o=b,s=[setTimeout(()=>b.showSpinner(),Jd),setTimeout(d,Qd)]},dispose(){d(),t.forEach(u=>u.dispose()),t.clear(),a.clear(),n="a"}}}var sc=L("canvas.resizerBinder"),cn=L("canvas.service"),ac={created:Q.canvasCreated,loaded:Q.canvasLoaded};function lc(e,t){if(e.getInstance(cn))return;const n=oc({resolveMount:()=>t.resolveMount(),resolveSrc:i=>t.resolveSrc(i),resolveSandbox:ld,elementId:t.elementId,bindResizer:i=>e.getInstance(sc)?.(i),onCreated:i=>ut(e,i,"fresh"),onReload:i=>ut(e,i,"fresh"),onShown:i=>ut(e,i,"switch"),mark:i=>t.mark?.(ac[i])}),r=X(e).addListener(F.SANDBOX_WHEEL,i=>{n.visible()?.scrollBy(i?.deltaX??0,i?.deltaY??0)});e.inject(cn,n),e.getInstance(j)?.addDispose(()=>{r.dispose(),n.dispose()})}function ut(e,t,n){const r=X(e),i=t.contentWindow;if(!i)return;const o=r.getTarget()===i;o&&n==="switch"||(n==="fresh"&&(r.forget(i),o&&r.setTarget(void 0)),r.setTarget(i),zl(r))}function dc(e,t){ut(e,t,"promote")}function cc(e,t){const n=t.contentWindow;n&&X(e).greet(n)}function uc(e,t){const n=t.contentWindow;n&&X(e).forget(n)}function fe(e){return e.getInstance(cn)}function fc(e){const t=X(e),n=()=>fe(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(F.RELOAD,async()=>{await n()?.reload()}),i=t.addListener(s=>{s.data?.operation===F.SANDBOX_RESIZED&&n()?.resize()}),o=K(e,B.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(j)?.addDispose(()=>{r.dispose(),i.dispose(),o.dispose()})}var Nm=L("HeadlessMode"),pc=L("HiddenMount");function hc(e){return e.getOrCreateInstance(pc,()=>Me(!1))}function Sr(){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 mc(e){const t=e.getInstance(se);let n,r;e.getInstance(j)?.addDispose(()=>{r?.remove(),r=void 0}),lc(e,{resolveMount:()=>n,resolveSrc:o=>co(o==="block"),elementId:"email_iframe",mark:o=>z(o)}),t?.watch(o=>{if(n)return;const s=o?.element;if(s instanceof HTMLElement)n=s;else if(o!==void 0)n=r??=Sr();else return;fe(e)?.get("email")});let i;e.getInstance(j)?.addDispose(()=>{i?.remove(),i=void 0}),hc(e).watch(o=>{const s=fe(e);if(s){if(o){i??=Sr(),s.alignSurface("email",i,i);return}i&&(s.alignSurface("email",null),i.remove(),i=void 0)}})}var vo=L("canvas.headerFlow"),Ir=["subject","preheader"],gc=3e3,vc={subject:F.SANDBOX_SUBJECT_UPDATE,preheader:F.SANDBOX_PREHEADER_UPDATE};function bc(e){const t=ve(e),n=X(e),r=g=>g?"remote":go(e)?"system":"user",i=(g,{guid:y,value:_,forced:S})=>{const A=Be(t);if(!A||typeof _!="string"||y&&y!==A.get().docId)return;const h=t.forcedHeaders();if(h?.[g]&&!S&&_!==h[g])return;S&&t.endForcedHeaders();const c=A.get().attributes[g]??"";d=!0;try{vt(A,{[g]:_},{source:r(S)})}finally{d=!1}o[g]=_,oe(e,B.ON_HEADER_APPLIED_ID).fire({field:g,value:_,forced:!!S,isGenerated:_!==c&&!!_})};let o={},s,d=!1,a=Promise.resolve();const f=(g,y,_)=>{a=n.sendAsync(vc[g],{value:y,guid:Be(t)?.get().docId,..._?{force:!0,echo:!0}:{}}).catch(S=>{})};let u;e.inject(vo,{whenDelivered:async()=>{await a},reassert:g=>{const y=Be(t),_=Ir.filter(S=>g[S]);if(!(!y||_.length===0)){d=!0;try{vt(y,Object.fromEntries(_.map(S=>[S,g[S]])),{source:"system"})}finally{d=!1}t.beginForcedHeaders({subject:g.subject??"",preheader:g.preheader??""}),clearTimeout(u),u=setTimeout(()=>t.endForcedHeaders(),gc);for(const S of _)o[S]=g[S],f(S,g[S],!0)}}});const v=()=>{s?.(),s=void 0;const g=Be(t);if(!g){o={};return}const y=g.get().attributes;o={subject:y.subject,preheader:y.preheader},s=g.subscribe(({source:_})=>{if(d)return;const S=g.get().attributes,A=t.forcedHeaders();for(const h of Ir){const c=S[h];c!==o[h]&&(o[h]=c,f(h,c??"",_==="system"&&A?.[h]!==void 0))}})};v();const b=t.subscribe(v),E=n.addListenerAsync(F.APPLICATION_SUBJECT_UPDATE,g=>i("subject",g)),I=n.addListenerAsync(F.APPLICATION_PREHEADER_UPDATE,g=>i("preheader",g));e.getInstance(j)?.addDispose(()=>{E.dispose(),I.dispose(),b(),s?.(),clearTimeout(u)})}function Tr(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function un(e,t){const n={...e};for(const r of Object.keys(t)){const i=t[r],o=e[r];Tr(i)&&Tr(o)?n[r]=un(o,i):i!==void 0&&(n[r]=i)}return n}function Ec(e,t){const n=Rn;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const i=JSON.parse(r);if(i&&typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length>0)return un(n,i)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?un(n,t):n}function yc(){const e=window.localStorage.getItem(yt.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?Ds:$s;return e&&e!=="system"?e:t}function _c(){const e=window.localStorage.getItem(yt.em_code_mode_settings);if(!e)return!1;try{const t=JSON.parse(e);return!!(t?.isCodeMode&&(t.codeModeDirection==="left"||t.codeModeDirection==="right"))}catch{return!1}}function wc(e){const{config:t}=e;return{operation:F.UPDATE_PREVIEW,theme:e.theme,commonStyles:Ec(e.emailCommonStyles,e.defaultCommonStyles),pathEnabled:t.pathEnabled,copyPasteEnabled:t.copyPasteEnabled,saveBlockEnabled:t.saveBlockEnabled,editImageControlEnabled:t.editImageControlEnabled,codeMode:e.codeMode,elementAIimageEnabled:t.elementAIimageEnabled,imageCenterStockEnabled:t.imageCenterStockEnabled,imageCenterGifEnabled:t.imageCenterGifEnabled,imageCenterEditorEnabled:t.imageCenterEditorEnabled,blocksAddPanelEnabled:t.blocksAddPanelEnabled!==!1&&t.blocksSectionsShow!==!1,lockEditor:t.lockEditor,appName:e.appName}}function Sc(e){const t=X(e),n=e.getInstance(we),r=e.getInstance(se),i=ve(e);let o,s="";const d=()=>{const _=n?.get()??{},S=wc({config:_,emailCommonStyles:i.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:yc(),codeMode:_c(),appName:"useblocks"}),A=JSON.stringify(S);A!==s&&(s=A,t.send(S))},a=t.onInit(()=>{s="",d()}),f=()=>{t.isInited()&&d()},u=n?.watch(f),v=r?.watch(_=>{o=_?.commonStyles,f()});let b;const E=()=>{b?.(),b=i.current()?.subscribe(f),f()};E();const I=i.subscribe(E),g=matchMedia(Ls),y=()=>f();g.addEventListener("change",y),e.getInstance(j)?.addDispose(()=>{a.dispose(),u?.dispose(),v?.dispose(),b?.(),I(),g.removeEventListener("change",y)})}var fn;(function(e){function t(i,o,s=(d,a)=>d===a){if(i===o)return!0;if(i.length!==o.length)return!1;for(let d=0;d<i.length;d++)if(!s(i[d],o[d]))return!1;return!0}e.isEqual=t;function n(i,o=s=>s){const s=new Set;return i.filter(d=>{const a=o(d);return s.has(a)?!1:(s.add(a),!0)})}e.unique=n;function r(i=[],o=[],s=(d,a)=>d===a){const d=[],a=[],f=[];for(const u of i){const v=o.find(b=>s(u,b));v?f.push({prev:u,next:v}):a.push(u)}for(const u of o)i.find(v=>s(u,v))||d.push(u);return{added:d,removed:a,exists:f}}e.diff=r})(fn||(fn={}));function Ic(e,t){return e.type===t.type&&e.key===t.key}function Tc(e){const t=X(e),n=()=>e.getServices(Te)??[];let r=[];const i=t.onInit(()=>{r=n(),t.send(F.SANDBOX_ADD_EXTENSIONS,r)}),o=bs(Te),s=e.onInject(d=>{if(d!==o)return;const a=n();if(!t.isInited()){r=a;return}const{added:f,removed:u}=fn.diff(r,a,Ic);if(r=a,u.length){if(u.some(v=>v.type==="script")){t.send(F.RELOAD);return}t.send(F.SANDBOX_REMOVE_EXTENSIONS,u.map(v=>v.key))}f.length&&t.send(F.SANDBOX_ADD_EXTENSIONS,f)});e.getInstance(j)?.addDispose(()=>{i.dispose(),s?.dispose()})}var Ac=L("prewarm.editorVisible");function Cc(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function Rc(e={}){const t=e.paint??Cc;let n=!1,r=!1,i=!1,o=!1,s=!1;const d=[],a=()=>{s||o||!n||!r||!i||(o=!0,t(()=>{s=!0,z(Q.editorVisible);for(const f of d.splice(0))f()}))};return{noteShellVisible(){n=!0,a()},notePagePainted(){r=!0,a()},noteContentShown(){i=!0,a()},whenVisible(f){if(s){f();return}d.push(f)},contentShown:()=>i}}function Pc(e){return e.getOrCreateInstance(Ac,()=>Rc())}var Dc=500,Oc=500,xc=5e3;function Lc(e){const t=e.quietMs??Dc,n=e.floorMs??Oc,r=e.ceilingMs??xc;let i,o,s=0;const d=()=>{clearTimeout(i),clearTimeout(o),i=void 0,o=void 0},a=()=>{d(),e.run()},f=()=>{clearTimeout(i);const u=n-(Date.now()-s);i=setTimeout(a,Math.max(t,u))};return{start(){d(),s=Date.now(),o=setTimeout(a,r),f()},notify(){i!==void 0&&f()},cancel:d}}function Mc({attributes:e,readContent:t,docId:n,hasSession:r,serverId:i,show:o}){if(!r)return;const s={id:i??void 0,renderGuid:n,showId:o?.id,isNew:i==null,showToken:o?.token},d={...e,...s};return Object.defineProperty(d,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),d}var bo="self-init:";function kc(e){return e.startsWith(bo)}function Eo(e,t){const n=e.getActiveShowRequest();return kc(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Nc(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t();let i="";const o=()=>e.readDocument()?ln(e.readDocument()):i,s=()=>ke(e.container).editorPolicy,d=()=>e.readEmail(),a=()=>{const f=d();return{...f,id:e.isTemplate()||f.isNew?void 0:f.id,html:o()}};return{readContent:o,publicEmail:a,sendInitStart:()=>de(n,"INIT_START",F.SANDBOX_INIT_START,{guid:d().renderGuid},void 0,r()),sendInited:()=>de(n,"INITED",F.SANDBOX_INITED,{guid:d().renderGuid},void 0,r()),async sendContent(){const f=d(),{html:u,hasBrowserExtensionArtifacts:v}=fo(f?.html||"");v&&e.events.browserExtensionDetected(),po(e.readDocument(),u),i=u,await de(n,"SET_ENTITY",F.SANDBOX_SET_ENTITY,dn(o(),f.renderGuid,s(),e.readDocument()?.get().version),{guid:f.renderGuid,emailId:f.id??null},r())},refreshContent:()=>de(n,"SET_ENTITY",F.SANDBOX_SET_ENTITY,dn(o(),d().renderGuid,s(),e.readDocument()?.get().version),void 0,r()),sendPreheader:async()=>{const f=d();if(f.preheader!==void 0)return de(n,"PREHEADER",F.SANDBOX_PREHEADER_UPDATE,{value:f.preheader,guid:f.renderGuid,force:!0},void 0,r())},sendSubject:async()=>{const f=d();if(f.subject!==void 0)return de(n,"SUBJECT",F.SANDBOX_SUBJECT_UPDATE,{value:f.subject,guid:f.renderGuid,force:!0},void 0,r())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:f=>e.showFilled?.(f),readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(a()),fireInit(f,u){if(!Eo(t(),f)){t().getActiveShowRequest()?.showId;return}const v=d();v.id,v.renderGuid,t().completeShow(f),vt(e.readDocument(),{is_inited:!0},{source:"system"});const b=a();return u&&(b.reset=!0),e.events.inited(b)},fireEmailChanged(){e.events.emailChanged(a())},fireContentChanged(){e.events.contentChanged(o())}}}function Fc(e){const t=()=>e.initPipeline();let n=!1,r,i,o,s=0,d;const a=Nc({...e,waitScope:()=>({getSandboxTimeoutMs:y=>t().getSandboxTimeoutMs(y),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:d?.signal??t().signal})});let f;const u=(y,_)=>{if(f===y)return;f=y;const S=s;setTimeout(()=>{s!==S||t().signal.aborted||I(y,_).catch(()=>{})},0)},v=()=>{d?.abort(),d=void 0};let b;const E=()=>{const y=t().signal;y!==b&&(b?.removeEventListener("abort",v),b=y,y.addEventListener("abort",v))};async function I(y,_){const S=++s;v(),d=new AbortController,E();const A=()=>s!==S,h=a.readTarget(),c=t().generation,l=()=>c===t().generation&&!t().signal.aborted,p=_?"init:reset-":"init:";if(!_){const T=a.publicEmail();T?.id,T?.renderGuid,T?.preheader}let m=!1,w=!1;try{n=!0,await a.sendInitStart(),a.fireWillInit(),await(_?a.refreshContent():a.sendContent()),m=!0,_||a.publicEmail()?.id;try{await a.sendPreheader()}catch(T){`${p}`,String(T)}try{await a.sendSubject()}catch(T){`${p}`,String(T)}if(A()||a.showFilled(h),await a.sendInited(),w=!0,i===y){const T=e.readSandboxGeneration?.()??o;T!==void 0&&(r=T)}await a.revealFilled()}catch(T){throw A()||(`${p}`,{...e.describeSurface?.(),error:String(T)},void 0),!A()&&Eo(t(),y)&&t().failShow(y,T),T}finally{g(y,_,p,{superseded:A(),sessionGeneration:c,contentApplied:m,sandboxInitedAcked:w,commit:l()})}}function g(y,_,S,A){const{superseded:h,contentApplied:c,sandboxInitedAcked:l}=A;if(h){`${S}`;return}l&&A.commit?a.fireInit(y,_||void 0):l?(`${S}`,A.sessionGeneration,t().generation,t().signal.aborted,void 0):c?(`${S}`,void 0):(`${S}`,void 0),n=!1,d=void 0,!l&&i===y&&(i=void 0,r===o&&(r=void 0)),!l&&c&&u(y,_)}return{channel:a,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:y=>{r=y},lastCorrelation:()=>i,markCorrelation:y=>{i=y},bumpRunSeq:()=>{s+=1},noteSandboxGeneration:y=>{o=y},fill:y=>I(y,!1),refill:y=>I(y,!0),stop:()=>{s+=1,v(),n=!1,b?.removeEventListener("abort",v),b=void 0}}}function jc(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:yo(e,n)}function yo(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Bc(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:i,readSandboxGeneration:o}=e,s=u=>{const v=n(),b=i();if(!jc(v,u,b)){u.showId,u.navId,u.emailId,v?.id,v?.showId,v?.renderGuid;return}u.showId,v?.id,v?.renderGuid,t.markFilled(o()),t.markCorrelation(u.showId),t.fill(u.showId).catch(()=>{})};return{showRequested:u=>{s(u)},showRequestIdentityChanged:()=>{const u=e.initPipeline().getActiveShowRequest();u&&s(u)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const u=o();if(t.filledGeneration()===u)return;const v=n(),b=i();if(!v?.renderGuid||!yo(v,b))return;const E=`${bo}${v.renderGuid}`;t.markFilled(u),t.markCorrelation(E);const I=r()?.isReady()===!0;v.id,v.renderGuid,(I?g=>t.refill(g):g=>t.fill(g))(E).catch(()=>{t.lastCorrelation()===E&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id}}}function Uc(e){return e??""}function Hc(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Gc(e){const t=ve(e),n=X(e),r=()=>me(t.sessionKey())?void 0:t.current(),i=()=>{const P=r();return Mc({attributes:P?.get().attributes??{},readContent:()=>P?.getContent(),docId:P?.get().docId,hasSession:!!P,serverId:P?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(De)??Hn;let s={},d=!1;const a=e.getInstance(se)?.watch(P=>{d=!!P?.element});let f=!1,u=!1,v=!1,b=0;const E=()=>{const P=fe(e);if(!P)return;const V=++b,q=P.spare();return q&&uc(e,q.element),(q?q.reloadQuietly():P.ensureSpare()?.ready())?.then(()=>{if(V!==b)return;f=!0;const re=P.spare();re&&cc(e,re.element),v&&(v=!1,T(),U())})},I=Lc({run:()=>{v||E()?.catch(()=>{})}}),g=()=>{Pc(e).noteContentShown(),!f&&!v&&I.start()};let y=!1;const A=Fc({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:i,revealFilled:()=>{const P=fe(e);return y&&P&&(y=!1,I.start()),d?P?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:P=>{const V=fe(e),q=V?.spare()?.element.contentWindow;u&&V&&q&&P===q&&(u=!1,V.promote(),V.busy(!1),y=!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!s.isTemplate,readSandboxGeneration:()=>ue(n),describeSurface:()=>({canvasPath:w,promoted:u,spareClean:f,handshake:n.isInited(),generation:ue(n)}),events:{willInit:P=>{oe(e,B.WILL_EMAIL_INIT_ID).fire(P)},inited:P=>{g(),oe(e,B.ON_EMAIL_INIT_ID).fire(P)},contentChanged:P=>{oe(e,B.ON_CONTENT_CHANGED_ID).fire(P)},emailChanged:P=>{oe(e,B.ON_EMAIL_CHANGED_ID).fire(P)},browserExtensionDetected:()=>{oe(e,B.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),h=Bc({pipeline:A,initPipeline:o,readEmail:i,readDocument:r,readRouteEmailId:()=>s.emailId,readSandboxGeneration:()=>ue(n)});let c="",l="",p="";const m=P=>P.length>0;let w="none";const T=()=>{const P=fe(e)?.spare();P&&(n.sendNow({operation:F.SANDBOX_LOCK_EDIT,data:!0}),f=!1,u=!0,dc(e,P.element))},O=(P,V)=>{const q=fe(e);if(!q)return!0;const re=q.spare(),Ee=re&&f?"spare":"prepare";if(w=Ee,q.busy(!0),re&&f)return T(),!0;I.cancel(),n.sendNow({operation:F.SANDBOX_LOCK_EDIT,data:!0});const ye=E();if(ye===void 0)return w="reload",q.busy(!1),q.peek("email")?.reload(),!0;v=!0;const Ct=b;return ye.catch(()=>{!v||Ct!==b||(v=!1,w="reload",q.busy(!1),q.peek("email")?.reload())}),!1},k=()=>{be(),A.noteSandboxGeneration(ue(n));const P=i(),V=Hc(P?.renderGuid,P?.showId,P?.id,s.emailId),q=Uc(P?.renderGuid);if(q!==l){const ye=m(l),Ct=l;l=q,ye&&O(Ct,q)}if(v)return;V!==c&&(c=V,h.showRequestIdentityChanged());const re=r(),Ee=`${V}|${re?.get().docId??""}|${ue(n)}`;Ee!==p&&re?.isReady()===!0&&(p=Ee,h.selfInitChanged()),h.saasChanged(),D()};let W=!1,R="",C="";const D=()=>{const P=i();if(!P?.renderGuid)return;const V=A.channel.readContent(),q=JSON.stringify([P.preheader,P.common_styles,P.meta,P.subject,P.utm_parameters?.utm_campaign??"",P.utm_parameters?.utm_content??"",P.utm_parameters?.utm_medium??"",P.utm_parameters?.utm_source??"",P.utm_parameters?.utm_term??""]),re=W&&V!==C,Ee=W&&q!==R;if(W=!0,C=V,R=q,A.isEventsLocked())return;const ye={...P,id:s.isTemplate||P.isNew?void 0:P.id,html:V};if(re){oe(e,B.ON_CONTENT_CHANGED_ID).fire(V),oe(e,B.ON_EMAIL_CHANGED_ID).fire(ye);return}Ee&&P.is_inited&&oe(e,B.ON_EMAIL_CHANGED_ID).fire(ye)};let x=!1;const U=()=>{x||(x=!0,queueMicrotask(()=>{x=!1,k()}))};e.inject(Gn,{pipeline:A,setRoute:P=>{P.emailId===s.emailId&&!!P.isTemplate==!!s.isTemplate||(s=P,U())}});let J,M;const G=()=>{const P=r()?.get().docId;P!==M&&(J?.(),M=P,J=r()?.subscribe(U)),U()};let H,Y;const be=()=>{const P=e.getInstance(De);!P||P===H||(Y?.(),H=P,Y=P.onShowRequested(V=>h.showRequested(V)))},et=n.addListener(P=>{P.data?.operation===F.SANDBOX_RESIZED&&I.notify()}),rs=t.subscribe(G),is=lo(n,U);G(),e.getInstance(j)?.addDispose(()=>{a?.dispose(),Y?.(),is(),rs(),J?.(),et.dispose(),I.cancel(),A.stop()})}function qc(){return Hs!=="useblocks"}var pn={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:"",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},$c={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:"",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}},Ar=pn,zc=["freeUserBlocks","blocks"],_o={};function Vc(e){_o=e}var wo=e=>zc.includes(e)?Ar:_o[e]??Ar,hn={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:"",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},Kc={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:"",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},Wc={...hn,config:{...hn.config,imageCenterFileManagerView:!1}};Vc({pro:$c,editor:Kc,simple:qc()?hn:Wc,freeUserBlocks:pn,blocks:pn});var Cr=new Set;function Yc(){return window.localStorage.getItem(yt.em_color_scheme)??void 0}function Xc(e){return Cr.add(e),e(Yc()),{dispose(){Cr.delete(e)}}}function qn(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Jc(e,t){return t.modeDefaults(qn(e,t.fallbackMode))}function Qc(e,t){const n=qn(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Zc(e,t){const n=qn(e,t),r=e.user?.advancedConfigs?.[n],i=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...i}}function eu(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function tu(e){return us(e.map(t=>t?.resourceProxy))}function nu(e){return cs(e.map(t=>t?.resourceProxyPolicy))}function ru(e){return Is(e.map(t=>t?.backendProxy))}function iu(e){return hi(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function ou(e,t){return[e.base,Jc(e,t),e.profile,e.serverSide,Qc(e,t.fallbackMode),e.user,Zc(e,t.fallbackMode),e.local]}function Mt(e,t){const n=ou(e,t),r=hi(n),i=eu(n);i!==void 0&&(r.fileManager=i);const o=tu(n);o!==void 0&&(r.resourceProxy=o);const s=nu(n);s&&Object.keys(s).length>0&&(r.resourceProxyPolicy=s);const d=ru(n);d!==void 0&&(r.backendProxy=d);const a=iu(n);return a&&Object.keys(a).length>0&&(r.backendProxyPolicy=a),r}var su=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function Rr(e){return e==="server"?"serverSide":e}function au({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},i=Me();let o={kind:"pending"},s;const d=new Promise(b=>{s=b}),a=n===void 0?void 0:setTimeout(()=>{u({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function f(){o.kind!=="pending"&&i.set(Mt(r,e))}function u(b){if(o.kind!=="pending")return;clearTimeout(a),o=b;const E=Mt(r,e);i.set(E),s(E)}function v(b,E){r[Rr(b)]=E,b==="server"&&o.kind==="pending"?u({kind:"applied"}):f()}return{watch:b=>i.watch(b),select:b=>i.select(b),get:()=>i.get(),ready:()=>d,state:()=>o,layers:()=>({...r}),bootstrap(){const b=Mt(r,e);return Object.fromEntries(su.map(E=>[E,b[E]]))},merge(b,E){v(E,{...r[Rr(E)],...b})},replace(b,E){v(E,b)},setMode(b){r.user={...r.user,mode:b},f()},setAdvancedConfigs(b){r.advancedConfigs=b,f()},serverAbsent(b){u({kind:"absent",reason:b})},applyServerResponse(b){o.kind==="pending"&&v("server",{...r.serverSide,...b})},dispose(){clearTimeout(a)}}}var lu=5e3,du="blocks";function cu(){return{...wo(du)?.config,mergeTags:void 0}}function uu(e,t){e.getInstance(se)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function fu(e,t){let n;Zi(e).watch(({profile:r})=>{const i=`${r?.theme??""}|${r?.locale??""}`;if(i===n)return;n=i;const o={};r?.theme&&(o.theme=r.theme),r?.locale&&(o.locale=r.locale),t.replace(o,"profile")})}function pu(e,t){let n=null;const r=Xc(i=>{const o=typeof i=="string"&&i?i:void 0;o!==n&&(n=o,t.replace(o?{theme:o}:{},"local"))});e.getInstance(j)?.addDisposable(r)}async function hu(e,t){if(e.getInstance(Mn)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(Pe);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function mu(e){e.injectFactory(we,(t,n)=>{if(n)return n;const r=au({base:cu(),env:{modeDefaults:i=>wo(i)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:lu});return uu(e,r),fu(e,r),pu(e,r),hu(e,r),e.getInstance(j)?.addDisposable(r),r},!0)}var Re=class extends ee{_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 N(e,t,n){const r=ds(e);return(i,o,s)=>{const d=r(async a=>{const f=t?t(a):a;s&&i.bind(s);const u=await i(f);return n?n(u):u},o,s);return()=>d.dispose()}}var gu=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new nn;this.handleDestroy=N(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Re(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{}}},$n=L("DestroyableService");function vu(e){e.injectFactory($n,()=>{const t=e.getInstance(j);if(!t)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new gu({lifetime:t,options:e.getInstance(se),getInstance:()=>e.getInstance(_t),release:()=>js(e.getInstance(Ms)??e)})},!0)}function bu(e){const t=e.getInstance($n);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var Eu=1e3;function So(e,t,n=Eu,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 i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(const s of i)if(!So(e[s],t[s],n,r+1))return!1;return!0}return!1}function Ge(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 i=t[r],o=e[r];So(i,o)||(n[r]=i)}return n}var yu=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleSaveEmail не ответил за ${e}ms — письмо не сохранено`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}},_u=({source:e,emailtags:t,group:n,tags:r,...i})=>i,wu=()=>Oi();async function Su({emails:e},t){const n=wu();let r;try{return await Promise.race([e.notifySave(t),new Promise((i,o)=>{r=setTimeout(()=>{const s=new yu(n);t.value.id,o(s)},n)})])}finally{r!==void 0&&clearTimeout(r)}}function Iu(e){const{emails:t}=e,n=async(r,i)=>{const o=_u(i),s=r===void 0?void 0:await t.cache.getIfPresent(r),d=s?{...s,...o}:o,a=await Su(e,{prev:s,patch:s?Ge(s,o):o,value:d,source:i.source??""}),f=String(a.id??r??ce()),u=a.id===void 0?{...a,id:f}:a;return await t.cache.addOrUpdate(f,()=>u)};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const i=await n(void 0,r);return i?.renderGuid?i:{...i,renderGuid:ce()}},async updateEmail(r,i){return await n(r,i)}}}var kt=20,Tu=({source:e,emailtags:t,group:n,tags:r,...i})=>i;function Au({revisions:e,revisionsByEmail:t}){const n=async(r,i)=>(t.clear(),await t.get(r,{page:i}),(await e.cache.values()??[]).filter(o=>String(o?.parent)===String(r)));return{async readRevisions(r,i=1){const o=await n(r,i);return{revisions:o.slice(kt*(i-1),kt*i),page:i,hasMore:o.length>kt*i}},async readAutosave(r){return Ja(await n(r,1))},async saveAutosave(r,i){const o=Tu(i);return await e.create({...o,parent:r,modified:new Date().toString()})}}}var Cu=class extends Vs{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}},Ru=class extends pe{};var Pr=class extends ee{_items=new Map;_onChangeEmitter=new Ps;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 i=await t(n);return ht(n,i)||this._onChangeEmitter.fire(),i}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(([i,o])=>i)),r=(await this.entries()).filter(([i,o])=>!n.has(i));for(const[i,o]of e)t.push(this.addOrUpdate(i,()=>o)),n.add(i);for(const[i]of r)t.push(this.remove(i));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 Pu(e,{filter:t,order:n="asc",orderBy:r,page:i,pageSize:o=20}={}){const s=e.length;let d=e.length;if(t!==void 0){const a=Object.keys(t);e=e.filter(f=>{for(const u of a){const v=f[u],b=t[u];return u==="id"||typeof v!="string"?v===b:typeof b=="string"&&v.startsWith(b)}return!0}),d=e.length}return r&&(e=e.sort((a,f)=>(a[r]>f[r]?1:f[r]>a[r]?-1:0)*(n==="asc"?1:-1))),i!==void 0&&(e=e.slice(o*(i-1),o*i)),{data:e,filteredTotal:d,total:s,totalPages:Math.ceil(d/o)}}function Du(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 i=t.get(r.id)||{};t.set(r.id,{...i,...r})}return[...t].map(([n,r])=>r)}function Ou(e,t){return Dr(e)&&Dr(t)?String(e)===String(t):e===t}function Dr(e){return typeof e=="string"||typeof e=="number"}var xu=class extends ee{_cache=new Pr;_readEmitter=new pe;_saveEmitter=this.addDisposable(new Cu);_removeEmitter=this.addDisposable(new Ru);_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)))}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const n=this.addDisposable(new ee);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new Pr),i=n.addDisposable(new pe);t=this._foreignCache[e]={get:async(o,s={})=>{await r.getOrCreate(o,async()=>{try{const a=Du(await i.fire(o))||[];for(const f of a)f[e]=o,await this._cache.add(f.id,f);return a}catch{return[]}});const d=(await this._cache.values()||[]).filter(a=>{const f=a[e];return f==null||Ou(f,o)});return Pu(d,s)},first(o,s={}){return t.get(o,{...s,page:1,pageSize:1}).then(({data:d})=>d[0])},handleRead:i.event,clear(){r.clear()},dispose(){n.dispose()}}}return t}async create(e,{source:t="",silent:n}={}){let r=e;return n||(r=await this._saveEmitter.fire({prev:void 0,patch:e,value:r,source:t})),r.id===void 0&&(r.id=ce()),await this._cache.addOrUpdate(r.id,()=>r)}notifySave(e){return this._saveEmitter.fire(e)}async update(e,t,{source:n="",silent:r}={}){return this._cache.addOrUpdate(e,async i=>{const o=i?{...i,...t}:t;if(!r)return t=i?Ge(i,t):t,await this._saveEmitter.fire({prev:i,patch:t,value:o,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 Je(e){const t=L(e);return n=>n.getOrCreateInstance(t,()=>new xu)}function Lu(e){const t=e.getInstance(j);if(!t)throw new Error("Failed");return t}function Or(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Mu(e,t,n){return e&&!Or(t)&&Or(e)?{...n,meta:e.meta}:n}var Io=Je("plugin.dataSource.emails"),To=Je("plugin.dataSource.emailRevisions"),xr=L("emailDocuments.provided");function ku(e){const t=Io(e),n=To(e),r=n.byForeignKey("parent");return e.getInstance(xr)?{emails:t,emailRevisions:n}:(e.inject(xr,!0),vl(e,Iu({emails:t})),_l(e,Au({revisions:n,revisionsByEmail:r})),Lu(e).addDisposable(t.onSave(({prev:i,patch:o,value:s})=>Mu(i,o,s),Number.MIN_VALUE)),{emails:t,emailRevisions:n})}function Lr(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 Nu(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var Fu="po",at=null;function ju(){const e=typeof window.__useblocks__<"u"?window.__useblocks__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([Fu],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function Bu(){return at===null&&(at=ju().catch(e=>{throw at=null,e})),at}async function Ao(e){if(typeof e=="object")return zn(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?Uu(t):Hu(t)}function zn(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function Uu(e){try{return zn(JSON.parse(e))}catch{return}}var Mr=!1;async function Hu(e){try{return zn((await Bu()).parsePoCatalog(e))}catch{Mr||(Mr=!0);return}}var Gu="em_locale",qu="em_ant_locale",$u="locale",zu="ant_locale";function Vn(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function Co(e,t){const n=Vn(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function Vu(){return Vn("em_locale")??Co($u,"em_locale")}function kr(e){try{localStorage.setItem(Gu,JSON.stringify(e))}catch{}}function Ku(){return Vn("em_ant_locale")??Co(zu,"em_ant_locale")}function Wu(e,t){try{localStorage.setItem(qu,JSON.stringify({id:e,data:t}))}catch{}}var Yu=8e3;function Xu(e,t){const n=e,r=t,i=Object.keys(n).filter(o=>o!=="");return i.length!==Object.keys(r).filter(o=>o!=="").length?!1:i.every(o=>JSON.stringify(n[o])===JSON.stringify(r[o]))}function Ju(e){const t=Vu(),n=Ku();let r={ready:!1},i;const o=Me(r);let s=0;const d=y=>{r={...r,...y},o.set(r)},a=()=>{r.ready||d({ready:!0})},f=setTimeout(a,e.unlockAfterMs??Yu),u=y=>y!==s;let v;async function b(y,_){if(n?.id===y&&n.data&&d({antd:n.data}),!v)return;const S=await v(y).catch(()=>{});!S||u(_)||(d({antd:S}),Wu(y,S))}async function E(y,_){const S=await e.askHost(y).catch(()=>null);if(u(_))return!0;if(S==null)return!1;const A=await Ao(S);return u(_)||(A&&d({catalog:A}),a()),!0}async function I(y,_){const S=await e.readList();if(u(_))return;if("error"in S){d({failure:{kind:"GET_LOCALES_ERROR",error:S.error}}),a();return}const A=S.data.find(c=>c.locale===y);if(!A){Nu("em_locale")&&d({catalog:void 0}),a();return}if(Lr(t,A)&&(!i||i.catalog===t?.data)){a();return}if(i?.entry&&r.catalog===i.catalog&&Lr(i.entry,A)){kr(i.entry),a();return}const h=await e.readCatalog(y);if(!u(_)){if("error"in h){d({failure:{kind:"GET_LOCALE_ERROR",error:h.error}}),a();return}h.data&&(i?.id===y&&r.catalog===i.catalog&&Xu(i.catalog,h.data)||d({catalog:h.data}),kr({id:y,time:A.updatedAt||Math.floor(Date.now()/1e3),hash:A.contentHash,data:h.data})),a()}}async function g(y,_){if(!await E(y,_)){if(!u(_)&&(i?.id===y&&r.catalog===i.catalog||y==="en_US")&&a(),e.canUseNetwork&&!e.canUseNetwork()){a();return}await I(y,_)}}return{set(y){if(!y||y===r.id)return;const _=s+=1;d({id:y,failure:void 0});const S=i?.id===y&&r.catalog===i.catalog;(i&&!S&&r.catalog===i.catalog||y==="en_US"&&r.catalog)&&d({catalog:void 0}),t?.id===y&&t.data&&(d({catalog:t.data}),a()),b(y,_),g(y,_)},prime(y,_,S){r.id||r.catalog||!_||(i=t?.id===y&&t.data&&(!S||t.time>=S.time)?{id:y,catalog:t.data}:{id:y,catalog:_,entry:S?{id:y,time:S.time,hash:S.hash,data:_}:void 0},d({catalog:i.catalog}))},useAntdLoader(y){v=y,r.id&&b(r.id,s)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(f)}}var Qu=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})},Zu=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:i,format:o,baseUrl:s,cancelToken:d,...a})=>{const f=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(a,f),v=i&&this.toQueryString(i),b=this.contentFormatters[r||"application/json"],E=o||u.format;return this.customFetch(`${s||this.baseUrl||""}${n}${v?`?${v}`:""}`,{...u,headers:{...u.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(d?this.createAbortSignal(d):u.signal)||null,body:typeof e>"u"||e===null?null:b(e)}).then(async I=>{const g=I;g.data=null,g.error=null;const y=E?I.clone():I,_=E?await y[E]().then(S=>(g.ok?g.data=S:g.error=S,g)).catch(S=>(g.error=S,g)):g;return d&&this.abortControllers.delete(d),_})}},ef=L("rest.v2.transport"),Nr=Symbol("rest.v2.secureRequest");function tf(e){return e.getOrCreateInstance(ef,()=>{const t=e.getInstance(pi)?.execute||fetch;return new Zu({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[Nr]:!0}),customFetch:(n,r={})=>{const{[Nr]:i,...o}=r;return t(n,{...o,[hs]:i!==!0})}})})}function nf(e,t){const n=tf(e);return Object.assign({},...t.map(r=>new r(n)))}function Fr(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function Ro(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Fr(n.details,"wp_code")??n.code,message:Fr(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 Po(e){return!e.ok||!!e.error}function rf(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function Do(){return rf(yt.em_translations_v2)??!0}function of(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function sf(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function af(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],i=r[0];return typeof i=="string"&&i!==""&&t.push({locale:i,updatedAt:of(r[1])}),t},[]):[]}function lf(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:sf(n.updated_at),contentHash:n.content_hash}),t),[])}function Oo(e){return nf(e,[Qu])}function Et(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function mn(e){return!e.ok||e.error!=null}function gn(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function Nt(e){return{data:await Ao(e)??null}}async function df(e){if(Do())try{const n=await Oo(e).localesList();return Po(n)?{error:Ro(n)}:{data:lf(n.data)}}catch(n){return Et(n)}const t=gi(e,[wi]);try{const n=await t.get_translations2({file:"react_app"});return mn(n)?gn(n):{data:af(n.data)}}catch(n){return Et(n)}}async function cf(e,t){if(Do())try{const r=await Oo(e).jsonList({locale:t});return Po(r)?{error:Ro(r)}:Nt(r.data)}catch(r){return Et(r)}const n=gi(e,[wi]);try{const r=await n.get_translations3({id:t,file:"react_app"});return mn(r)?gn(r):Nt(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return mn(r)?gn(r):Nt(r.data)}catch(r){return Et(r)}}}var ze=L("locale.service");function uf(e){if(e.getInstance(ze))return;const t=Ju({readList:()=>df(e),readCatalog:n=>cf(e,n),askHost:async n=>(await oe(e,B.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(he)});e.inject(ze,t),e.getInstance(j)?.addDispose(()=>t.dispose())}function ff(e){const t=e.getInstance(we);if(!t)return;const n=e.getInstance(ze);if(!n)return;const r=t.select(i=>i.locale).watch(i=>n.set(i));e.getInstance(j)?.addDisposable(r)}var pf="user_id",hf="project_id",jr=L("rest.identityHeadersProvided");function mf(e){if(e.getInstance(jr))return;e.inject(jr,!0);let t;e.getInstance(se)?.watch(n=>{t=n}),e.addService(Dn,{execute(n,r){if(r?.public)return;const i=t?.user?.id??eo(e).profile?.id;i!=null&&i!==""&&n.headers.set(pf,String(i));const o=t?.project;o!=null&&o!==""&&n.headers.set(hf,String(o))}})}function gf(e){if(!e)return!1;try{return e.getInstance(he)!==void 0}catch{return!1}}var vf="Invalid standaloneKey.",Fm=L("StandaloneMockGuard");function bf(){const e=new Error(vf);return e.name="InvalidStandaloneKeyError",e}function Ef(e){e.addService(Dn,{execute:()=>{if(gf(e))throw bf()}})}function yf(e){Rs(e),Ef(e)}function _f(e){const t=new mo;e.inject(De,t);let n;const r=e.getInstance(se)?.watch(o=>{o&&(o.signal!==void 0&&(n=o.signal),t.configure({replaceSession:!0,...o.timeouts!==void 0?{timeouts:o.timeouts}:{},...n!==void 0?{signal:n}:{}}))}),i=e.getInstance(j);r&&i?.addDisposable(r),i?.addDispose(()=>{t.abort()})}var wf=Je("plugin.dataSource.blocks"),Sf=Je("plugin.dataSource.blockRevisions"),If=Je("plugin.dataSource.comments"),Tf=ho(),Af=ho(),xo=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
1004
1004
|
<html>
|
|
1005
1005
|
<head>
|
|
1006
1006
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
@@ -1041,10 +1041,10 @@ import{t as si}from"./static/esm/50fbfdf6.js";import{$ as Qo,A as Zo,At as le,B
|
|
|
1041
1041
|
</tr>
|
|
1042
1042
|
</table>
|
|
1043
1043
|
</body>
|
|
1044
|
-
</html>`;function
|
|
1044
|
+
</html>`;function Cf(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:xo,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 Rf=L("CurrentProject"),Pf={};function St(e){return e?.getInstance(Rf)?.get()??Pf}function Lo(e){const t=St(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var Mo=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function Df(e){return!Object.keys(e).some(t=>Mo.has(t))}function Of(e){const t={},n={};for(const[r,i]of Object.entries(e))Mo.has(r)?t[r]=i:n[r]=i;return{showOptions:t,misplacedEmailFields:n}}function Br(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function It(e){return{emails:Io(e),blocks:wf(e),emailRevisions:To(e),blocksRevision:Sf(e),comments:If(e)}}function xf(e){const t=Object.values(It(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function Kn(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(Df(e))return{email:Br(e)};{const{showOptions:n,misplacedEmailFields:r}=Of(e),i=Object.keys(r);t&&i.length>0&&void 0;const o=typeof e.email=="string"?{code:e.email}:e.email;return{...n,email:Br({...r,...o})}}}function ko(e){return jn(e)?.current()}function ft(e){return ko(e)?.getContent()}function Lf(e,t){const n=t??Cf(),r=ko(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:ft(e)??n.html}:n}async function Ft(e){return(await e.getInstanceAsync(Pe))?.project}function xe({code:e,project:t,...n},r){const i=ge(n),o=Lo(r),s=ke(r);return e&&s.warnAboutUnconfiguredInput(e,n.id),{...i,...e?{html:s.toEditorForm(e)}:{},...o===void 0?{}:{project:o},utm_parameters:i.utm_parameters||{},_embedded:void 0}}function te({html:e,renderGuid:t,showToken:n,showId:r,...i},o){const{requested:s}=St(o),d=to(o);return ge({...i,code:ke(o).toOutputForm(e),project:s===void 0?i.project:s,utm_parameters:d.UTMEnabled?i.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 vn(e){return e==null?"":e.replaceAll(`\r
|
|
1045
1045
|
`,`
|
|
1046
|
-
`)}function Or(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function Cf(e,t,n,r){const i=Rf(e,t,n,r);return i===void 0}function Rf(e,t,n,r){const{email:i}=Bn(t,!1),o=xe(i,e),s=o.id;if(s===void 0)return"no-id";if(r!==void 0&&r!==s)return"other-id-shown";const d=Dn(e)?.current();if(!d)return"no-session";const l=d.get(),f=l.attributes;if(l.serverId!==s)return"document-id";if(f.is_inited!==!0)return"not-inited";const u=Or(fn(n??d.getContent()));if(o.html!==void 0&&Or(fn(o.html))!==u)return"html";if(o.subject!==void 0&&o.subject!==f.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==f.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==f.common_styles)return"common_styles"}function xr(e,t){const{email:n}=Bn(t,!1),r=xe(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:fn(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function Pf(e,t){const n={...e};return delete n.id,{...n,...t}}function Df(e){return e.html?e:{...e,html:Ao}}function Be({code:e,project:t,...n},r,i){const o=i??Co(r);return{...n,...e?{html:ke(r).toEditorForm(e)}:{},renderGuid:le(),...o===void 0?{}:{project:o}}}function st({html:e,renderGuid:t,...n},r){const{requested:i}=_t(r);return ge({...n,code:ke(r).toOutputForm(e),project:i===void 0?n.project:i,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 Do(e){return Dn(e)?.current()?.get().serverId??void 0}function pn(e,t,n){return n===void 0&&(n=e.post===void 0?Do(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function at(e,t){return ge({...e,link:void 0,comment_status:void 0})}function hn({code:e,...t},n,r){return r===void 0&&(r=t.parent===void 0?Do(n):t.parent),{...t,...e?{html:e}:{},parent:r}}function Lr({html:e,...t},n){return ge({...t,code:e,guid:void 0,compiled:ge({html:e,ampHtml:e&&""})})}var Of=x("emailTemplate.reads");async function xf(e,t){try{return await Se(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message;return}}function Lf(e,t){const n=e.getOrCreateInstance(Of,()=>new Map),r=n.get(t);if(r!==void 0)return r;const i=xf(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,i),i}var Mf="EXTERNAL";function kf(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"сохранение не состоялось")}var Nf="email_id",Ff=class extends Z{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_dataSources;_eventLock;_queue=Ns();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=wt(t),this._eventLock=Tf(t);const n=K(e,F.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(wn,{execute:(r,i)=>{!i?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(Nf,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(De)??Ln}_throwIfDestroyed(){if(this.isDisposed())throw Tn()}async getTemplateEmail(e){const t=await Lf(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 kt(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(i=>i.id!==void 0).map(i=>[i.id,hn(i,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(i=>i.id!==void 0).map(i=>[i.id,pn(i,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,i){const o=this._dataSources.emails,s=o.cache,d=await kt(this._container),l=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let f=xe(e,this._container);const u=f.id;let v=u;if(u!==void 0){const b=await o.get(u);f={...b??{},...f,renderGuid:b?.renderGuid??le(),...l>0?{showToken:l}:{},...i?{showId:i}:{},project:d}}else{v=n??le();const b=await o.get(v);f={...f,renderGuid:b?.renderGuid??le(),...l>0?{showToken:l}:{},...i?{showId:i}:{},project:d},delete f.project}if(t){const b=await this.getTemplateEmail(String(t));b&&(f=Pf(b,f))}return u===void 0&&(f=Df(f)),await s.addOrUpdate(v,()=>f),f}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==xr(this._container,e))return!1;const n=ut(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=xr(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:ut(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&t!==this._showRequests){this._showRequests;return}if(!e)return;const n=this._getInitPipeline();if(q(n.signal),Cf(this._container,e,ut(this._container),this._prevCommand?.id)||this._isRepeatOfLastShow(e))return;const r=Bn(e);r.email.id,this._prevCommand?.id;let i,o="",s=0,d=!1,l,f=Promise.resolve(),u,v=!1;try{this._eventLock.suspendChange();const{email:b,blocks:E,autosaves:I,comments:g,templateId:y,reload:w}=r;i=b.id;const S=xe(b,this._container),A=S.id,h=A??le(),c=await Ue("getProject",kt(this._container));q(n.signal),o=le();const a={isNew:A===void 0,id:String(h),project:c},p=w===!0&&A!==void 0;p&&(await this._dataSources.emails.remove(String(A),{silent:!0}),String(A)),s=++this._showToken,String(h);const m=[];m.push(this.setBlocks(E)),b.id!==void 0&&(m.push(this.setComments(g)),m.push(this.setEmailRevisions(I,String(b.id)))),m.push(this.setEmail(b,Number(y),A===void 0?String(h):void 0,s,o)),await Ue("setEmail+blocks+revisions",Promise.all(m),{emailId:A??String(h),showId:o,targetShowToken:s}),q(n.signal);const _=await this._dataSources.emails.get(String(h)),T=ve(this._container),C={id:o,token:s};A===void 0?u=T.startNewDraft(_??S,{patch:S,show:C}):p?u=T.reload(A,{email:_??S,patch:S,show:C}):T.sessionKey()===Fe(A)?u=T.show(S,C):u=T.open(A,{email:_??S,patch:S,show:C});const P=!!this._prevCommand&&pt(this._prevCommand,a);a.id,!this._prevCommand||pt(this._prevCommand,a),this._prevCommand?.id,this._rememberShow(a),f=n.requestShow({showId:o,navId:String(h),emailId:A,isNew:A===void 0}),v=!0,String(h),d=!0}catch(b){l=b,v&&o&&n.failShow(o,b),String(b)}finally{this._eventLock.resumeChange()}if(!d)throw l instanceof Error?l:new Error(`[useblocks] show() setup failed: ${String(l??"unknown error")}`);return Ue("show-init-deferred",Promise.all([f,u?.whenReady().catch(b=>{if(b instanceof ht){const E=Fi(b);throw E?new Error(`[useblocks] show(): email open failed (${E})`,{cause:b}):b}})??Promise.resolve()]).then(()=>{}),{showId:o,emailId:i??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();q(e.signal);const t=ve(this._container),n=await t.save("publish",{source:Mf});if(q(e.signal),!n)throw kf(t.saveState().error);return ee(Af(this._container,this._currentEmail),this._container)}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;return this._queuedShow(e,t)};save=this._queue.decorate(this._save,this)};function jf(e){return String(e).replace(/"/g,""")}function Bf(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 Uf(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 Mr(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),i=jf(n);return r.test(e)?e.replace(r,`${t}="${i}"`):e.replace(/>$/,` ${t}="${i}">`)}function Hf(e,t,n){if(!e?.trim()||!t)return e;const r=Uf(e);if(!r)return e;const i=String(t),o=Bf(n??new Date);let{full:s,index:d}=r;const l=s.length;return/\bem-block-id\s*=/.test(s)||(s=Mr(s,"em-block-id",i)),s=Mr(s,"em-block-version",o),e.slice(0,d)+s+e.slice(d+l)}function Gf(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 qf(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),i=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:i,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:Gf(e)}}function Nt(e,t){return t?qf(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var Oo=["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"],$f=[...Oo,"html","id","project","password"],Im=new Set(["html",...Oo,"global_block","project"]);function zf(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($f),r={};for(const i of Object.keys(e))n.has(i)||(r[i]=e[i]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function Vf(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...zf(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 mn=new WeakMap;function Kf(e){let t=mn.get(e);return t||(t={byId:new Map,fallback:[]},mn.set(e,t)),t}function Wf(e){mn.delete(e)}function Yf(e,t){const{byId:n,fallback:r}=Kf(t);if(e.blockId){const i=n.get(e.blockId);if(i){n.delete(e.blockId);const o=r.indexOf(i);return o>=0&&r.splice(o,1),i}return}for(let i=r.length-1;i>=0;i--){const o=r[i],s=e.name!=null&&e.name!==""&&o.name!=null&&o.name!==""&&o.name===e.name,d=e.type!=null&&e.type!==""&&o.insertFrom===e.type;if(s&&d)return r.splice(i,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function Xf(e,t){const{blocks:n}=wt(e);return await n.cache.getIfPresent(t)??void 0}async function Jf(e,t){if(!t.blockId)return;const n=await Xf(e,t.blockId);if(n)return Vf(n,t)}async function Qf(e,t){const n=Yf(e,t);if(n)return Nt(e,n);const r=await Jf(t,e);return r?Nt(e,r):Nt(e,void 0)}var Zf=vs("application_block_inserted"),ep=-1e3,kr=new WeakSet;function tp(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 np(e){if(!e||kr.has(e))return;kr.add(e);const t=new Z,n=X(e);return t.addDisposable(n.addListenerAsyncPipe(Zf,async(r,i)=>{const o=tp(r)?await Qf(r,e):r;return i?i(o):o},ep)),t.addDisposable({dispose:()=>{Wf(e)}}),t}var Nr=100,rp=class extends Z{_container;_events;constructor(e){super(),this._container=e;const t=np(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:i}=wt(e),o=K(e,F.ON_SHARE_ID),s=K(e,F.ON_SHOW_PREVIEW_ID),d=K(e,F.ON_EMAIL_CLONE_ID),l=K(e,F.ON_CODE_VALIDATE_ID),f=K(e,F.ON_SUBJECT_CHANGED_ID),u=K(e,F.ON_EMAIL_CHANGED_ID),v=K(e,F.ON_PREHEADER_CHANGED_ID),b=K(e,F.ON_SAVEBUTTON_CLICK_ID),E=K(e,F.ON_NEXTBUTTON_CLICK_ID),I=K(e,F.ON_SEND_LIVEPREVIEW_ID),g=K(e,F.ON_SEND_TESTEMAIL_ID),y=K(e,Ef),w=K(e,F.ON_CONTENT_CHANGED_ID),S=K(e,bf),A=K(e,F.ON_PREVIOUSBUTTON_CLICK_ID),h=K(e,F.ON_SEND_EMAIL_MODAL_ID),c=ms(K(e,F.ON_EMAIL_INIT_ID),a=>!a.reset);return{handlePreheaderChanged:M(v),handleSubjectChanged:M(f),handleValidate:M(l),handleReadEmail:M(n.handlerRead,a=>a,a=>a&&xe(a,e)),handleSaveEmail:M(n.onSave,function({prev:a,patch:p,value:m,source:_}){const T=a?ee(a,e):void 0;return{prev:T,patch:He(T,ee(p,e)),value:ee(m,e),source:_}},a=>a?xe(a,e):void 0),handleRemoveEmail:M(n.onRemove,({value:a,source:p})=>({value:ee(a,e),source:p}),()=>{}),handleReadCommonBlocks:M(y,a=>a.project,a=>a?.map(p=>Be(p,e))),handleReadTemplateBlocks:M(S,a=>a,a=>a?.map(p=>Be(p,e))),handleReadBlocks:M(t.byForeignKey("project").handleRead,a=>_t(e).requested||String(a),a=>a?.map(p=>Be(p,e))),handleSaveBlock:M(t.onSave,function({prev:a,patch:p,value:m,source:_}){const T=m.global_block===!0&&m.id&&typeof m.html=="string"?{...m,html:Hf(m.html,String(m.id))}:m,C=a?st(a,e):void 0;return{prev:C,patch:He(C,st(p,e)),value:st(T,e),source:_}},a=>a?Be(a,e):void 0),handleRemoveBlock:M(t.onRemove,({value:a,source:p})=>({value:st(a,e),source:p}),()=>{}),handleReadComments:M(r.byForeignKey("post").handleRead,a=>a,a=>a?.map(p=>pn(p,e))),handleSaveComment:M(r.onSave,function({prev:a,patch:p,value:m,source:_}){const T=a?at(a,e):void 0;return{prev:T,patch:He(T,at(p,e)),value:at(m,e),source:_}},a=>a?pn(a,e):void 0),handleRemoveComment:M(r.onRemove,({value:a,source:p})=>({value:at(a,e),source:p}),()=>{}),handleReadEmailRevisions:M(i.byForeignKey("parent").handleRead,a=>a,a=>a?.map(p=>hn(p,e))),handleEmailAutosave:M(i.onSave,function({prev:a,patch:p,value:m,source:_}){return{value:Lr(m,e),source:_}},a=>a?hn(a,e):void 0),handleRemoveEmailAutoSave:M(i.onRemove,({value:a,source:p})=>({value:Lr(a,e),source:p}),()=>{}),handleEmailChanged:M(Wn(u,Nr),a=>ee(a,e)),handleEmailInit:M(c,a=>ee(a,e)),handlePreviousButtonClick:M(A,a=>ee(a,e)),handleNextButtonClick:M(E,a=>ee(a,e)),handleSaveButtonClick:M(b,a=>ee(a,e)),handleHtmlChanged:M(Wn(w,Nr)),handleTestEmailSend:M(g,({html:a,...p})=>({...p,code:a,compiled:{html:a,ampHtml:""}})),handleTestEmailModal:M(h,a=>ee(a,e)),handleCloneEmail:M(d,a=>ee(a,e)),handleShareEmail:M(o),handlePreviewEmail:M(s),handleLivePreviewEmail:M(I)}}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 Re(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},ip=x("DataController"),op=x("DataEvents");function xo(e){return e.getOrCreateInstance(ip,()=>{const t=new Ff(e);return e.getInstance(N)?.addDisposable(t),t})}function Lo(e){return e.getOrCreateInstance(op,()=>new rp(e))}var sp=x("plugin.startupShow");function ap(e){const t=xo(e),n=Lo(e),r=e.getInstance(oe),i=e.getInstance(N),o={current:Promise.resolve()};e.inject(sp,o);const s=r?.watch(l=>{l&&n.setOptions(l)}),d=r?.select(l=>l?.content).watch(l=>{l!==void 0&&($(J.showStart),o.current=(async()=>{try{await t.show(l)}catch{}finally{$(J.showEnd)}})())});s&&i?.addDisposable(s),d&&i?.addDisposable(d)}function lp(e){const t=xo(e);return{...Lo(e).get(),show(n){return $(J.showStart),t.show(n).finally(()=>$(J.showEnd))},save(){return t.save()}}}var dp=[{name:"rest.client",setup:pf},{name:"auth.oauth",setup:Cs},{name:"rest.identityHeaders",setup:lf},{name:"lifetime.destroyable",provides:[Nn],setup:cu},{name:"appInit",provides:[Pe,An],setup:ua},{name:"config",provides:[we],setup:lu},{name:"email.documents",setup:Ru},{name:"show.initPipeline",provides:[De],setup:hf},{name:"show",setup:ap},{name:"locale.service",provides:[$e],setup:rf},{name:"locale.fromConfig",awaits:{services:[we,$e]},setup:of},{name:"canvas.early",setup:lc},{name:"canvas.previewSettings",setup:gc},{name:"canvas.sandboxExtensions",setup:bc},{name:"canvas.headerSync",provides:[uo],setup:uc},{name:"canvas.ampSync",setup:Bl},{name:"canvas.moduleBridge",setup:cd},{name:"canvas.port",setup:Wl},{name:"canvas.images",setup:Vl},{name:"canvas.edits",setup:qd},{name:"canvas.blockContent",setup:Fd},{name:"canvas.sandboxFill",provides:[Mn],setup:kc},{name:"canvas.reactions",setup:oc}],cp=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function up(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const i=t.get(r)??[];i.push(n),t.set(r,i)}return t}function fp(e,t){const n=[];for(const r of e.awaits?.services??[])for(const i of t.get(r)??[])i!==e&&n.push(i);return n}function Mo(e){const t=up(e),n=[],r=new Set,i=[],o=new Set,s=d=>{if(!r.has(d)){if(o.has(d)){const l=i.indexOf(d);throw new cp([...i.slice(l),d].map(f=>f.name))}o.add(d),i.push(d);for(const l of fp(d,t))s(l);i.pop(),o.delete(d),r.add(d),n.push(d)}};for(const d of e)s(d);return n}var Fr;function Un(e){const t=e.getInstance(oe);if(t)return t;e.getInstance(N)||e.inject(N,new Z);const n=Me();e.inject(oe,n),Fr??=Mo(dp);for(const r of Fr)r.setup(e);return n}function pp(e){}var hp=[{name:"save.previewFollow",setup:pp}],jr=x("plugin.lateUnitsInstalled");function mp(e){if(!e.getInstance(jr)){e.inject(jr,!0);for(const t of Mo(hp))t.setup(e)}}function gp(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function vp(e){if(!e)return;const t=ui(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 bp=Le(e=>{let t,n,r;return{async setOptions(i){const o=r!==i.getAuthToken,s=!pt(t,i.user),d=n!==i.project;if(r=i.getAuthToken,t=i.user,n=i.project,!(!e.getInstance(he)||!i.getAuthToken)&&!(!o&&!s&&!d))try{const l=await i.getAuthToken(i.user,i.project);e.inject(xs,Promise.resolve(l||""));const f=vp(l);if(!f)return;e.inject(Is,f);const u=e.getInstance(Pe),v=u?await u.catch(()=>{}):void 0;e.inject(Pe,Promise.resolve(gp(f,v)))}catch{}}}});function Ep(e,t){if(e.getInstance(Vn))return;e.inject(Vn,!0);const n=yn(e,F.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}function yp(e){e.getInstance(Ss)||e.inject(he,void 0)}function St(e){return String(e.standaloneKey||"").trim()||void 0}function _p(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function Hn(e){return _p(e)?!!St(e):!1}function It(e){return!!St(e)&&!Hn(e)}var wp=Le(e=>{let t,n=!1;return{setOptions(r){const i=n;if(n=!0,!It(r)){t&&(yp(e),Hn(r)),t=void 0;return}const o=St(r);if(!o||t===o&&e.getInstance(he))return;t=o,e.inject(he,o);const s=e.getInstance(N);s&&Ep(e,s)}}}),Sp=Le(e=>{const t=e.getInstance(N),n=yn(e,di),r=M(n),i=t.addDisposable(new Re(r));return{setOptions({handleLoad:o}){i.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}}),Ip=Le(e=>{const t=e.getInstance(N),n=t.addDisposable(new pe),r=t.addDisposable(new pe),i=pi(e,Qo),o=M(n.event),s=M(r.event),d=M(i.event),l=t.addDisposable(new Re(o)),f=t.addDisposable(new Re(s)),u=t.addDisposable(new Re(d));return{instance:{handleSetOptions:o,handleOptionsChanged:s,handleConfigChanged:d},async setOptions(v){l.setListener(v.handleSetOptions),f.setListener(v.handleOptionsChanged),u.setListener(v.handleConfigChanged),await n.fire(v),await r.fire(v)},dispose(){}}}),Ft,ko="core";function Tp(){const e=window.__useblocks__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([ko],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function Ap(e){const t=window.__useblocks__?.require?.warm;return typeof t!="function"?Je().then(()=>{}):t([ko],e)}function Je(){return Ft===void 0&&(Ft=Tp().then(e=>(qe()&&e.installDiagnostics().catch(t=>{}),e))),Ft}var jt=null,Bt=null;async function Cp(e){typeof e?.prefetch=="function"&&await e.prefetch()}function Gn(){return jt||(jt=Je().then(()=>{})),jt}function No(e){return Bt||(Bt=Cp(e)),Bt}function Rp(){return No(typeof window.__useblocks__<"u"?window.__useblocks__:void 0)}function Pp(e){return Promise.all([Gn(),No(e)]).then(()=>{})}function Dp(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function Br(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>Ap(t?{priority:t}:void 0)).then(()=>n?Gn():void 0).catch(()=>{})}function Op(e){const t=Dp(e);if(t==="eager")Br(e);else if(t==="idle"){const n=()=>Br(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var Fo="PluginRegistry";function xp(e=Ds()){return e.getOrCreateInstance(Fo,()=>new Vs)}var Lp=new Ks(()=>xp()),Mp=Le(e=>{let t;function n(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(r){const i=e.getInstance(Et),o=e.getInstance(Fo);t||(t=new zs(i,o,{ensureHostRuntimeReady:Rp}),e.inject(Xt,t));const s=r?.plugins||[];i&&await t.setPlugins(s)},instance:{use(r){return typeof r=="function"?n().useByCtor(r):n().useByKey(r)},useAsync(r){return n().useAsync(r)},waitPlugin(r){return n().waitFor(r)}},dispose(){t?.dispose(),t=void 0}}}),jo=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const i=this._listeners.indexOf(r);i>=0&&this._listeners.splice(i,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}},kp=x("ELEMENT_INSERT_HTML_PIPELINE"),Np=x("BLOCK_INSERT_HTML_PIPELINE"),Fp="application_block_inserted",jp=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Np,()=>new jo).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(We,()=>new Ye),i=n?e.bind(n):e;return r.addListener(Fp,i,t)}},Bp=x("ComponentRegistry"),Ur;function ze(e,t=Bp){const n=ft.getInstance(t);if(n)return n;if(!Ur)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return ft.getOrCreateInstance(t,Ur)}var Up=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=this._container.addService(Ze,{execute:n=>{t.dispose(),e(n.value.map(r=>({name:r.name,html:r.html})))}})})}update(e,t){const n=this._container,r=ze(n);return n.addService(Ze,{execute:i=>{const o=i.value.find(s=>s.name===e);if(o){const{icon:s,title:d,fallbackTooltip:l,...f}=t;s&&(o.icon=r.getReactNode(s)),d&&(o.title=r.getReactNode(d)),l&&(o.fallbackTooltip=r.getReactNode(l)),Object.assign(o,f)}}})}delete(e){this._container.addService(Ze,{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,r=ze(n);return n.addService(Ze,{execute:i=>{i.value.splice(t??i.value.length,0,{...e,title:r.getReactNode(e.title),icon:r.getReactNode(e.icon),fallbackTooltip:r.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(kp,()=>new jo).add(e,t??0,n)}handleInject(e,t,n){return Ce(this._container,fs).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},Hp=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(We,()=>new Ye)}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 Gp(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}var qp=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=Ce(t,ds),this._closeModalEmitter=Ce(t,ss),this._updateModalEmitter=Ce(t,ps)}get _container(){return this._context.container}show(e){const t=ze(this._container),n=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,r=e.modalProps;return this._showModalEmitter.fire({...e,content:t.getReactNode(e.content),title:t.getReactNode(e.title),id:n,modalProps:r?{...r,footer:t.getReactNode(r.footer),okText:t.getReactNode(r.okText),cancelText:t.getReactNode(r.cancelText),closeIcon:t.getReactNode(r.closeIcon)}:void 0}),n}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=ze(this._container),r=t.modalProps;this._updateModalEmitter.fire(Gp({...t,content:n.getReactNode(t.content),title:n.getReactNode(t.title),id:e,modalProps:r?{...r,footer:n.getReactNode(r.footer),okText:n.getReactNode(r.okText),cancelText:n.getReactNode(r.cancelText),closeIcon:n.getReactNode(r.closeIcon)}:void 0}))}},$p=class{_registration;_loadedDisposable;loaded;ready;_loadedSettled=!1;_readySettled=!1;constructor(e,t){this._registration=e,this._loadedDisposable=t,this.loaded=new Promise((n,r)=>{const i=()=>this._loadedDisposable.dispose(),o=()=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&i(),n())},s=d=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&i(),r(d))};this._resolveLoaded=o,this._rejectLoaded=s}),this.ready=new Promise((n,r)=>{const i=()=>this._loadedDisposable.dispose(),o=()=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&i(),n())},s=d=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&i(),r(d))};this._resolveReady=o,this._rejectReady=s})}_resolveLoaded=()=>{};_rejectLoaded=()=>{};_resolveReady=()=>{};_rejectReady=()=>{};resolveLoaded(){this._resolveLoaded()}resolveReady(){this._resolveReady()}rejectLoad(e){this._rejectLoaded(e),this._rejectReady(e)}rejectReady(e){this._rejectReady(e)}dispose(){this._registration.dispose();const e=new Error("Sandbox script registration disposed before completion.");this.rejectLoad(e),this.rejectReady(e)}},zp=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(We,()=>new Ye)}_createScriptHandle(e,t){const n=this._messageService.addListener(es,i=>{if(i.key===e){if(i.phase==="load"&&i.status==="success"){r.resolveLoaded();return}if(i.phase==="ready"&&i.status==="success"){r.resolveReady();return}if(i.phase==="load"){r.rejectLoad(new Error(i.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(i.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new $p(t,n);return r}registerSandboxCSS(e){return this._container.addService(Te,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(Te,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(Te,{type:"script",key:e,parent:"head",attributes:{src:e,type:"text/javascript"}});return this._createScriptHandle(e,t)}registerSandboxScriptCode(e,t){const n=this._container.addService(Te,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},Vp=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function gn(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&Vp.has(t)}function Bo(){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 Ut(){return`__settingsPanel:${Bo()}`}function Ht(e,t){return{type:e,props:t}}function Kp(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!gn(e)}function Hr(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(gn(t)){const r=Ut();return n(e.add(r,t)),Ht(r,{})}if(typeof t=="function"){const r=Ut();return n(e.add(r,t)),Ht(r,{})}if(Kp(t)){const r=t.type;if(typeof r=="string")return t;if(gn(r)||typeof r=="function"){const i=Ut();return n(e.add(i,r)),Ht(i,t.props)}return t}return t}var Wp=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=ze(this._container),n=s=>this._trackRegistration(s),r=Hr(t,e.content,n),i=e.advancedTabs?.map(s=>({...s,content:Hr(t,s.content,n)})),o=e.instanceKey??Bo();Ce(this._container,zn).fire({...e,content:r,advancedTabs:i,instanceKey:o,type:cs})}closeSettingsPanel(){this._clearPanelRegistrations(),Ce(this._container,zn).fire(null)}},Uo={SandboxScriptApi:zp,ElementsApi:Up,BlocksApi:jp,MessageService:Hp,SettingsPanelApi:Wp,ModalApi:qp};function Gt(e,t,n,r={}){const i=Object.assign({},e);for(const[o,s]of Object.entries(t))if(s!==void 0)if(n.includes(o)&&typeof s=="object"&&s!==null){const d=i[o],l=r[o]??{};i[o]=Object.assign({},typeof d=="object"&&d!==null?d:l,s)}else i[o]=s;return i}var te={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}},Yp={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"},qt={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},Gr={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},Ie={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:te.border,borderRadius:te.borderRadius,textAlign:"center",padding:te.padding},qr={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:te.padding},$t={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:te.border,borderRadius:te.borderRadiusCards};function Xp(e){return{...Yp,...e}}function Jp(e){return{...qt,...e,bold:e?.bold??qt.bold,italic:e?.italic??qt.italic}}function Qp(e){return{...Gr,...e,underline:e?.underline??Gr.underline}}function Zp(e){return{...Ie,...e,bold:e?.bold??Ie.bold,italic:e?.italic??Ie.italic,border:{...Ie.border,...e?.border},borderRadius:{...Ie.borderRadius,...e?.borderRadius},padding:{...Ie.padding,...e?.padding}}}function eh(e){return{...qr,...e,padding:{...qr.padding,...e?.padding}}}function th(e){return{...$t,...e,border:{...$t.border,...e?.border},borderRadius:{...$t.borderRadius,...e?.borderRadius}}}function zt(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 $r(e){let t={..._n};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function Vt(e){return{text:Xp(e.text),headings:Jp(e.headings),links:Qp(e.links),buttons:Zp(e.buttons),block:eh(e.block),cards:th(e.cards)}}var zr=x("EmailSettingsPort"),nh=1e4,Ho=class{_editor;_layoutSettingsChanged=new Jt;_contentStylesChanged=new Jt;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){const t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){const t=this._contentStylesChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}_disposeMessageSubscriptionIfUnused(){this._layoutSettingsChanged.hasListeners()||this._contentStylesChanged.hasListeners()||(this._messageSubscription?.dispose(),this._messageSubscription=void 0)}_settings(e=this._editor.container){const t=e.getInstance(zr);if(!t)throw new Error("[extensions] настройки письма ещё не загружены — работа с UI начинается с init()");return t}_getCurrentLayoutSettings(){return zt(this._settings().read())}_getCurrentContentStyles(){const e=Ct(this._editor.container)?.current()?.get().attributes.common_styles;return Vt($r(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(zr),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(We,()=>new Ye),t=this._getCurrentLayoutSettings(),n=this._getCurrentContentStyles();this._prevLayoutSnapshot=this._getLayoutSnapshot(t),this._prevContentSnapshot=this._getContentSnapshot(n),this._messageSubscription=e.addListener(r=>{const i=r?.data,o=i?.operation;if(o===k.APPLICATION_EMAIL_SETTINGS_SET){const l=zt(i?.settings),f=this._getLayoutSnapshot(l);f!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=f,this._layoutSettingsChanged.fire(l));return}if(o!==k.APPLICATION_COMMON_STYLES_UPDATE)return;const s=Vt(r.data?.settings?.commonStyles??{..._n}),d=this._getContentSnapshot(s);d!==this._prevContentSnapshot&&(this._prevContentSnapshot=d,this._contentStylesChanged.fire(s))})})();try{await this._messageSubscriptionPromise}finally{this._messageSubscriptionPromise=void 0}}}async getEmailLayoutSettings(){return await this._waitForEmailSettingsFromIframe(),this._getCurrentLayoutSettings()}async setEmailLayoutSettings(e){await this._waitForEmailSettingsFromIframe();const t=this._settings(),n={...t.read(),...e};t.write(n);const r=zt(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=nh){const t=Ct(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,i=yn(r,F.ON_EMAIL_INIT_ID);return new Promise(o=>{let s=!1,d;const l=()=>{d&&(clearTimeout(d),d=void 0)},f=i(()=>{s||(s=!0,l(),f.dispose(),o())});d=setTimeout(()=>{s||(s=!0,f.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Ct(this._editor.container)?.current();if(!t)return;const n=$r(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=Gt(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:te.border,borderRadius:te.borderRadius,padding:te.padding})),e.block!==void 0&&(n.block=Gt(n.block||{},e.block,["padding"],{padding:te.padding})),e.cards!==void 0&&(n.cards=Gt(n.cards||{},e.cards,["border","borderRadius"],{border:te.border,borderRadius:te.borderRadiusCards}));const r=JSON.stringify(n);mt(t,{common_styles:r}),this._settings().markAppearanceChanged();const i=Vt(n);this._prevContentSnapshot=this._getContentSnapshot(i),this._contentStylesChanged.fire(i)}},rh={...Uo,EmailSettingsApi:Ho},ih={...Uo},Tm={...ih,EmailSettingsApi:Ho},oh={...rh};function sh(){Lp.addAll(oh)}var ah=[Le(()=>{sh()}),Sp,Ip,wp,Rs,bp,ks];async function lh(){return(await Je()).asyncMixins}var dh=Mp,ch=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let i;try{i=await lh()}catch(s){throw e.failPendingWaits(s),s}t=i(e);const o=await e.getInstanceAsync(Et);Object.assign(o,t.instance||{});for(const s of e.getInstance(fi)??[])s()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},uh=Es([...ah]);function Kt(){let e,t=!1;const n=new Map,r=new Map;function i(){for(const o of r.values())o();r.clear()}return{event(o,s,d){const l=Symbol("subscription");return t||(n.set(l,{listener:o,priority:s,thisArg:d}),e&&r.set(l,e(o,s,d))),()=>{n.delete(l),r.get(l)?.(),r.delete(l)}},attach(o){i(),e=o;for(const[s,{listener:d,priority:l,thisArg:f}]of n)r.set(s,o(d,l,f))},dispose(){t=!0,i(),n.clear(),e=void 0}}}var Vr=x("NotificationService");function fh(e){const t=Kt(),n=Kt(),r=Kt();return e.getInstance(N)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(Vr).then(i=>{t.attach(i.onNotify),n.attach(i.onError),r.attach(i.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(i){const o=e.getInstance(Vr);if(!o)throw new Error("[plugin] notify() вызван до загрузки редактора");o.notify(i)}}}var ph=[uu,lp,fh];function hh(e,t=ph){const n=Un(e);mp(e);const r=uh(e),i=dh(e),o=ch(e),s={...r.instance,...i.instance,...o.instance};for(const l of t)Object.assign(s,l(e));let d=!0;return{instance:s,async setOptions(l){await r.setOptions(l);const f=d&&n.get()===l;d=!1,f||n.set(l),await i.setOptions(l),await o.setOptions(l)}}}var mh=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]}},gh="editor-runtime.react.copies",Wt=8;function Ve(e){return e&&typeof e=="object"?e:void 0}function Kr(e){const t=Ve(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=Ve(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function vh(e){const t=Ve(e),n=t&&typeof t.version=="string"?t.version:void 0,r=Ve(t?.default),i=r&&typeof r.version=="string"?r.version:void 0;return n??i??"unknown"}function bh(e,t,n){return e.package===t&&e.version===n}function Eh({ourReact:e,entries:t,packageName:n,version:r}){const i=Kr(e);if(!i||!Array.isArray(t))return[];const o=[],s=new Set;for(const d of t){const l=Ve(d);if(!l||!bh(l,n,r))continue;const f=Kr(l.react);!f||f===i||s.has(f)||(s.add(f),o.push({package:n,version:r,reactVersion:vh(l.react),react:l.react}))}return o}function yh({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,Wt))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>Wt&&n.push(` …and ${t.length-Wt} 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(`
|
|
1047
|
-
`)}var
|
|
1046
|
+
`)}function Ur(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function Mf(e,t,n,r){const i=kf(e,t,n,r);return i===void 0}function kf(e,t,n,r){const{email:i}=Kn(t,!1),o=xe(i,e),s=o.id;if(s===void 0)return"no-id";if(r!==void 0&&r!==s)return"other-id-shown";const d=jn(e)?.current();if(!d)return"no-session";const a=d.get(),f=a.attributes;if(a.serverId!==s)return"document-id";if(f.is_inited!==!0)return"not-inited";const u=Ur(vn(n??d.getContent()));if(o.html!==void 0&&Ur(vn(o.html))!==u)return"html";if(o.subject!==void 0&&o.subject!==f.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==f.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==f.common_styles)return"common_styles"}function Hr(e,t){const{email:n}=Kn(t,!1),r=xe(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:vn(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function Nf(e,t){const n={...e};return delete n.id,{...n,...t}}function Ff(e){return e.html?e:{...e,html:xo}}function Ue({code:e,project:t,...n},r,i){const o=i??Lo(r);return{...n,...e?{html:ke(r).toEditorForm(e)}:{},renderGuid:ce(),...o===void 0?{}:{project:o}}}function lt({html:e,renderGuid:t,...n},r){const{requested:i}=St(r);return ge({...n,code:ke(r).toOutputForm(e),project:i===void 0?n.project:i,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 No(e){return jn(e)?.current()?.get().serverId??void 0}function bn(e,t,n){return n===void 0&&(n=e.post===void 0?No(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function dt(e,t){return ge({...e,link:void 0,comment_status:void 0})}function En({code:e,...t},n,r){return r===void 0&&(r=t.parent===void 0?No(n):t.parent),{...t,...e?{html:e}:{},parent:r}}function Gr({html:e,...t},n){return ge({...t,code:e,guid:void 0,compiled:ge({html:e,ampHtml:e&&""})})}var yn=L("NotificationService"),jf=L("emailTemplate.reads");async function Bf(e,t){try{return await Se(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,Hf(e,t,n);return}}var Uf=L("emailTemplate.notifiedFailures");function Hf(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(Uf,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(yn).then(()=>{Pn(e,B.ON_NOTIFICATION).fire({type:"error",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function Gf(e,t){const n=e.getOrCreateInstance(jf,()=>new Map),r=n.get(t);if(r!==void 0)return r;const i=Bf(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,i),i}var qf="EXTERNAL";function $f(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"сохранение не состоялось")}var zf="email_id",Vf=class extends ee{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_dataSources;_eventLock;_queue=qs();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=It(t),this._eventLock=xf(t);const n=K(e,B.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(Dn,{execute:(r,i)=>{!i?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(zf,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(De)??Hn}_throwIfDestroyed(){if(this.isDisposed())throw Ln()}async getTemplateEmail(e){const t=await Gf(this._container,String(e));if(!t)return;const n={...t,lock:!1,parent_email:String(e)};return delete n.id,n}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks,n=await Ft(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,Ue(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(i=>i.id!==void 0).map(i=>[i.id,En(i,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(i=>i.id!==void 0).map(i=>[i.id,bn(i,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,i){const o=this._dataSources.emails,s=o.cache,d=await Ft(this._container),a=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let f=xe(e,this._container);const u=f.id;let v=u;if(u!==void 0){const b=await o.get(u);f={...b??{},...f,renderGuid:b?.renderGuid??ce(),...a>0?{showToken:a}:{},...i?{showId:i}:{},project:d}}else{v=n??ce();const b=await o.get(v);f={...f,renderGuid:b?.renderGuid??ce(),...a>0?{showToken:a}:{},...i?{showId:i}:{},project:d},delete f.project}if(t){const b=await this.getTemplateEmail(String(t));b&&(f=Nf(b,f))}return u===void 0&&(f=Ff(f)),await s.addOrUpdate(v,()=>f),f}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==Hr(this._container,e))return!1;const n=ft(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=Hr(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:ft(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&t!==this._showRequests){this._showRequests;return}if(!e)return;const n=this._getInitPipeline();if($(n.signal),Mf(this._container,e,ft(this._container),this._prevCommand?.id)||this._isRepeatOfLastShow(e))return;const r=Kn(e);r.email.id,this._prevCommand?.id;let i,o="",s=0,d=!1,a,f=Promise.resolve(),u,v=!1;try{this._eventLock.suspendChange();const{email:b,blocks:E,autosaves:I,comments:g,templateId:y,reload:_}=r;i=b.id;const S=xe(b,this._container),A=S.id,h=A??ce(),c=await He("getProject",Ft(this._container));$(n.signal),o=ce();const l={isNew:A===void 0,id:String(h),project:c},p=_===!0&&A!==void 0;p&&(await this._dataSources.emails.remove(String(A),{silent:!0}),String(A)),s=++this._showToken,String(h);const m=[];m.push(this.setBlocks(E)),b.id!==void 0&&(m.push(this.setComments(g)),m.push(this.setEmailRevisions(I,String(b.id)))),m.push(this.setEmail(b,Number(y),A===void 0?String(h):void 0,s,o)),await He("setEmail+blocks+revisions",Promise.all(m),{emailId:A??String(h),showId:o,targetShowToken:s}),$(n.signal);const w=await this._dataSources.emails.get(String(h)),T=ve(this._container),O={id:o,token:s};A===void 0?u=T.startNewDraft(w??S,{patch:S,show:O}):p?u=T.reload(A,{email:w??S,patch:S,show:O}):T.sessionKey()===je(A)?u=T.show(S,O):u=T.open(A,{email:w??S,patch:S,show:O});const k=!!this._prevCommand&&ht(this._prevCommand,l);l.id,!this._prevCommand||ht(this._prevCommand,l),this._prevCommand?.id,this._rememberShow(l),f=n.requestShow({showId:o,navId:String(h),emailId:A,isNew:A===void 0}),v=!0,String(h),d=!0}catch(b){a=b,v&&o&&n.failShow(o,b),An(b)||(xi(b),void 0)}finally{this._eventLock.resumeChange()}if(!d)throw a instanceof Error?a:new Error(`[useblocks] show() setup failed: ${String(a??"unknown error")}`);return He("show-init-deferred",Promise.all([f,u?.whenReady().catch(b=>{if(b instanceof gt){const E=qi(b);throw E?new Error(`[useblocks] show(): email open failed (${E})`,{cause:b}):b}})??Promise.resolve()]).then(()=>{}),{showId:o,emailId:i??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();$(e.signal);const t=ve(this._container),n=await t.save("publish",{source:qf});if($(e.signal),!n)throw $f(t.saveState().error);return te(Lf(this._container,this._currentEmail),this._container)}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;return this._queuedShow(e,t)};save=this._queue.decorate(this._save,this)};function Kf(e){return String(e).replace(/"/g,""")}function Wf(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 Yf(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 qr(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),i=Kf(n);return r.test(e)?e.replace(r,`${t}="${i}"`):e.replace(/>$/,` ${t}="${i}">`)}function Xf(e,t,n){if(!e?.trim()||!t)return e;const r=Yf(e);if(!r)return e;const i=String(t),o=Wf(n??new Date);let{full:s,index:d}=r;const a=s.length;return/\bem-block-id\s*=/.test(s)||(s=qr(s,"em-block-id",i)),s=qr(s,"em-block-version",o),e.slice(0,d)+s+e.slice(d+a)}function Jf(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 Qf(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),i=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:i,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:Jf(e)}}function jt(e,t){return t?Qf(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var Fo=["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"],Zf=[...Fo,"html","id","project","password"],jm=new Set(["html",...Fo,"global_block","project"]);function ep(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(Zf),r={};for(const i of Object.keys(e))n.has(i)||(r[i]=e[i]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function tp(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...ep(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 _n=new WeakMap;function np(e){let t=_n.get(e);return t||(t={byId:new Map,fallback:[]},_n.set(e,t)),t}function rp(e){_n.delete(e)}function ip(e,t){const{byId:n,fallback:r}=np(t);if(e.blockId){const i=n.get(e.blockId);if(i){n.delete(e.blockId);const o=r.indexOf(i);return o>=0&&r.splice(o,1),i}return}for(let i=r.length-1;i>=0;i--){const o=r[i],s=e.name!=null&&e.name!==""&&o.name!=null&&o.name!==""&&o.name===e.name,d=e.type!=null&&e.type!==""&&o.insertFrom===e.type;if(s&&d)return r.splice(i,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function op(e,t){const{blocks:n}=It(e);return await n.cache.getIfPresent(t)??void 0}async function sp(e,t){if(!t.blockId)return;const n=await op(e,t.blockId);if(n)return tp(n,t)}async function ap(e,t){const n=ip(e,t);if(n)return jt(e,n);const r=await sp(t,e);return r?jt(e,r):jt(e,void 0)}var lp=Ts("application_block_inserted"),dp=-1e3,$r=new WeakSet;function cp(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 up(e){if(!e||$r.has(e))return;$r.add(e);const t=new ee,n=X(e);return t.addDisposable(n.addListenerAsyncPipe(lp,async(r,i)=>{const o=cp(r)?await ap(r,e):r;return i?i(o):o},dp)),t.addDisposable({dispose:()=>{rp(e)}}),t}var zr=100,fp=class extends ee{_container;_events;constructor(e){super(),this._container=e;const t=up(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:i}=It(e),o=K(e,B.ON_SHARE_ID),s=K(e,B.ON_SHOW_PREVIEW_ID),d=K(e,B.ON_EMAIL_CLONE_ID),a=K(e,B.ON_CODE_VALIDATE_ID),f=K(e,B.ON_SUBJECT_CHANGED_ID),u=K(e,B.ON_EMAIL_CHANGED_ID),v=K(e,B.ON_PREHEADER_CHANGED_ID),b=K(e,B.ON_SAVEBUTTON_CLICK_ID),E=K(e,B.ON_NEXTBUTTON_CLICK_ID),I=K(e,B.ON_SEND_LIVEPREVIEW_ID),g=K(e,B.ON_SEND_TESTEMAIL_ID),y=K(e,Af),_=K(e,B.ON_CONTENT_CHANGED_ID),S=K(e,Tf),A=K(e,B.ON_PREVIOUSBUTTON_CLICK_ID),h=K(e,B.ON_SEND_EMAIL_MODAL_ID),c=Ss(K(e,B.ON_EMAIL_INIT_ID),l=>!l.reset);return{handlePreheaderChanged:N(v),handleSubjectChanged:N(f),handleValidate:N(a),handleReadEmail:N(n.handlerRead,l=>l,l=>l&&xe(l,e)),handleSaveEmail:N(n.onSave,function({prev:l,patch:p,value:m,source:w}){const T=l?te(l,e):void 0;return{prev:T,patch:Ge(T,te(p,e)),value:te(m,e),source:w}},l=>l?xe(l,e):void 0),handleRemoveEmail:N(n.onRemove,({value:l,source:p})=>({value:te(l,e),source:p}),()=>{}),handleReadCommonBlocks:N(y,l=>l.project,l=>l?.map(p=>Ue(p,e))),handleReadTemplateBlocks:N(S,l=>l,l=>l?.map(p=>Ue(p,e))),handleReadBlocks:N(t.byForeignKey("project").handleRead,l=>St(e).requested||String(l),l=>l?.map(p=>Ue(p,e))),handleSaveBlock:N(t.onSave,function({prev:l,patch:p,value:m,source:w}){const T=m.global_block===!0&&m.id&&typeof m.html=="string"?{...m,html:Xf(m.html,String(m.id))}:m,O=l?lt(l,e):void 0;return{prev:O,patch:Ge(O,lt(p,e)),value:lt(T,e),source:w}},l=>l?Ue(l,e):void 0),handleRemoveBlock:N(t.onRemove,({value:l,source:p})=>({value:lt(l,e),source:p}),()=>{}),handleReadComments:N(r.byForeignKey("post").handleRead,l=>l,l=>l?.map(p=>bn(p,e))),handleSaveComment:N(r.onSave,function({prev:l,patch:p,value:m,source:w}){const T=l?dt(l,e):void 0;return{prev:T,patch:Ge(T,dt(p,e)),value:dt(m,e),source:w}},l=>l?bn(l,e):void 0),handleRemoveComment:N(r.onRemove,({value:l,source:p})=>({value:dt(l,e),source:p}),()=>{}),handleReadEmailRevisions:N(i.byForeignKey("parent").handleRead,l=>l,l=>l?.map(p=>En(p,e))),handleEmailAutosave:N(i.onSave,function({prev:l,patch:p,value:m,source:w}){return{value:Gr(m,e),source:w}},l=>l?En(l,e):void 0),handleRemoveEmailAutoSave:N(i.onRemove,({value:l,source:p})=>({value:Gr(l,e),source:p}),()=>{}),handleEmailChanged:N(rr(u,zr),l=>te(l,e)),handleEmailInit:N(c,l=>te(l,e)),handlePreviousButtonClick:N(A,l=>te(l,e)),handleNextButtonClick:N(E,l=>te(l,e)),handleSaveButtonClick:N(b,l=>te(l,e)),handleHtmlChanged:N(rr(_,zr)),handleTestEmailSend:N(g,({html:l,...p})=>({...p,code:l,compiled:{html:l,ampHtml:""}})),handleTestEmailModal:N(h,l=>te(l,e)),handleCloneEmail:N(d,l=>te(l,e)),handleShareEmail:N(o),handlePreviewEmail:N(s),handleLivePreviewEmail:N(I)}}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 Re(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},pp=L("DataController"),hp=L("DataEvents");function jo(e){return e.getOrCreateInstance(pp,()=>{const t=new Vf(e);return e.getInstance(j)?.addDisposable(t),t})}function Bo(e){return e.getOrCreateInstance(hp,()=>new fp(e))}var mp=L("plugin.startupShow");function gp(e){const t=jo(e),n=Bo(e),r=e.getInstance(se),i=e.getInstance(j),o={current:Promise.resolve()};e.inject(mp,o);const s=r?.watch(a=>{a&&n.setOptions(a)}),d=r?.select(a=>a?.content).watch(a=>{a!==void 0&&(z(Q.showStart),o.current=(async()=>{try{await t.show(a)}catch{}finally{z(Q.showEnd)}})())});s&&i?.addDisposable(s),d&&i?.addDisposable(d)}function vp(e){const t=jo(e);return{...Bo(e).get(),show(n){return z(Q.showStart),t.show(n).finally(()=>z(Q.showEnd))},save(){return t.save()}}}var bp=[{name:"rest.client",setup:yf},{name:"auth.oauth",setup:ks},{name:"rest.identityHeaders",setup:mf},{name:"lifetime.destroyable",provides:[$n],setup:vu},{name:"appInit",provides:[Pe,Mn],setup:ba},{name:"config",provides:[we],setup:mu},{name:"email.documents",setup:ku},{name:"show.initPipeline",provides:[De],setup:_f},{name:"show",setup:gp},{name:"locale.service",provides:[ze],setup:uf},{name:"locale.fromConfig",awaits:{services:[we,ze]},setup:ff},{name:"canvas.early",setup:mc},{name:"canvas.previewSettings",setup:Sc},{name:"canvas.sandboxExtensions",setup:Tc},{name:"canvas.headerSync",provides:[vo],setup:bc},{name:"canvas.ampSync",setup:Vl},{name:"canvas.moduleBridge",setup:vd},{name:"canvas.port",setup:td},{name:"canvas.images",setup:Zl},{name:"canvas.edits",setup:Xd},{name:"canvas.blockContent",setup:$d},{name:"canvas.sandboxFill",provides:[Gn],setup:Gc},{name:"canvas.reactions",setup:fc}],Ep=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function yp(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const i=t.get(r)??[];i.push(n),t.set(r,i)}return t}function _p(e,t){const n=[];for(const r of e.awaits?.services??[])for(const i of t.get(r)??[])i!==e&&n.push(i);return n}function Uo(e){const t=yp(e),n=[],r=new Set,i=[],o=new Set,s=d=>{if(!r.has(d)){if(o.has(d)){const a=i.indexOf(d);throw new Ep([...i.slice(a),d].map(f=>f.name))}o.add(d),i.push(d);for(const a of _p(d,t))s(a);i.pop(),o.delete(d),r.add(d),n.push(d)}};for(const d of e)s(d);return n}var Vr;function Wn(e){const t=e.getInstance(se);if(t)return t;e.getInstance(j)||e.inject(j,new ee);const n=Me();e.inject(se,n),Vr??=Uo(bp);for(const r of Vr)r.setup(e);return n}function wp(e){}var Sp=[{name:"save.previewFollow",setup:wp}],Kr=L("plugin.lateUnitsInstalled");function Ip(e){if(!e.getInstance(Kr)){e.inject(Kr,!0);for(const t of Uo(Sp))t.setup(e)}}function Tp(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function Ap(e){if(!e)return;const t=vi(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 Cp=Le(e=>{let t,n,r;return{async setOptions(i){const o=r!==i.getAuthToken,s=!ht(t,i.user),d=n!==i.project;if(r=i.getAuthToken,t=i.user,n=i.project,!(!e.getInstance(he)||!i.getAuthToken)&&!(!o&&!s&&!d))try{const a=await i.getAuthToken(i.user,i.project);e.inject(Bs,Promise.resolve(a||""));const f=Ap(a);if(!f)return;e.inject(xs,f);const u=e.getInstance(Pe),v=u?await u.catch(()=>{}):void 0;e.inject(Pe,Promise.resolve(Tp(f,v)))}catch{}}}});function Rp(e,t){if(e.getInstance(tr))return;e.inject(tr,!0);const n=Cn(e,B.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}function Pp(e){e.getInstance(Os)||e.inject(he,void 0)}function Tt(e){return String(e.standaloneKey||"").trim()||void 0}function Dp(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function Yn(e){return Dp(e)?!!Tt(e):!1}function At(e){return!!Tt(e)&&!Yn(e)}var Op=Le(e=>{let t,n=!1;return{setOptions(r){const i=n;if(n=!0,!At(r)){t&&(Pp(e),Yn(r)),t=void 0;return}const o=Tt(r);if(!o||t===o&&e.getInstance(he))return;t=o,e.inject(he,o);const s=e.getInstance(j);s&&Rp(e,s)}}}),xp=Le(e=>{const t=e.getInstance(j),n=Cn(e,mi),r=N(n),i=t.addDisposable(new Re(r));return{setOptions({handleLoad:o}){i.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}}),Lp=Le(e=>{const t=e.getInstance(j),n=t.addDisposable(new pe),r=t.addDisposable(new pe),i=Pn(e,os),o=N(n.event),s=N(r.event),d=N(i.event),a=t.addDisposable(new Re(o)),f=t.addDisposable(new Re(s)),u=t.addDisposable(new Re(d));return{instance:{handleSetOptions:o,handleOptionsChanged:s,handleConfigChanged:d},async setOptions(v){a.setListener(v.handleSetOptions),f.setListener(v.handleOptionsChanged),u.setListener(v.handleConfigChanged),await n.fire(v),await r.fire(v)},dispose(){}}}),Bt,Ho="core";function Mp(){const e=window.__useblocks__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([Ho],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function kp(e){const t=window.__useblocks__?.require?.warm;return typeof t!="function"?Qe().then(()=>{}):t([Ho],e)}function Qe(){return Bt===void 0&&(Bt=Mp().then(e=>($e()&&e.installDiagnostics().catch(t=>{}),e))),Bt}var Ut=null,Ht=null;async function Np(e){typeof e?.prefetch=="function"&&await e.prefetch()}function Xn(){return Ut||(Ut=Qe().then(()=>{})),Ut}function Go(e){return Ht||(Ht=Np(e)),Ht}function Fp(){return Go(typeof window.__useblocks__<"u"?window.__useblocks__:void 0)}function jp(e){return Promise.all([Xn(),Go(e)]).then(()=>{})}function Bp(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function Wr(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>kp(t?{priority:t}:void 0)).then(()=>n?Xn():void 0).catch(()=>{})}function Up(e){const t=Bp(e);if(t==="eager")Wr(e);else if(t==="idle"){const n=()=>Wr(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var qo="PluginRegistry";function Hp(e=vs()){return e.getOrCreateInstance(qo,()=>new Zs)}var Gp=new ea(()=>Hp()),qp=Le(e=>{let t;function n(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(r){const i=e.getInstance(_t),o=e.getInstance(qo);t||(t=new Qs(i,o,{ensureHostRuntimeReady:Fp}),e.inject(tn,t));const s=r?.plugins||[];i&&await t.setPlugins(s)},instance:{use(r){return typeof r=="function"?n().useByCtor(r):n().useByKey(r)},useAsync(r){return n().useAsync(r)},waitPlugin(r){return n().waitFor(r)}},dispose(){t?.dispose(),t=void 0}}}),$o=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const i=this._listeners.indexOf(r);i>=0&&this._listeners.splice(i,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}},$p=L("ELEMENT_INSERT_HTML_PIPELINE"),zp=L("BLOCK_INSERT_HTML_PIPELINE"),Vp="application_block_inserted",Kp=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(zp,()=>new $o).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(Ye,()=>new Xe),i=n?e.bind(n):e;return r.addListener(Vp,i,t)}},Wp=L("ComponentRegistry"),Yr;function Ve(e,t=Wp){const n=mt.getInstance(t);if(n)return n;if(!Yr)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return mt.getOrCreateInstance(t,Yr)}var Yp=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=this._container.addService(tt,{execute:n=>{t.dispose(),e(n.value.map(r=>({name:r.name,html:r.html})))}})})}update(e,t){const n=this._container,r=Ve(n);return n.addService(tt,{execute:i=>{const o=i.value.find(s=>s.name===e);if(o){const{icon:s,title:d,fallbackTooltip:a,...f}=t;s&&(o.icon=r.getReactNode(s)),d&&(o.title=r.getReactNode(d)),a&&(o.fallbackTooltip=r.getReactNode(a)),Object.assign(o,f)}}})}delete(e){this._container.addService(tt,{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,r=Ve(n);return n.addService(tt,{execute:i=>{i.value.splice(t??i.value.length,0,{...e,title:r.getReactNode(e.title),icon:r.getReactNode(e.icon),fallbackTooltip:r.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance($p,()=>new $o).add(e,t??0,n)}handleInject(e,t,n){return Ce(this._container,ys).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},Xp=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(Ye,()=>new Xe)}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 Jp(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}var Qp=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=Ce(t,ms),this._closeModalEmitter=Ce(t,fs),this._updateModalEmitter=Ce(t,_s)}get _container(){return this._context.container}show(e){const t=Ve(this._container),n=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,r=e.modalProps;return this._showModalEmitter.fire({...e,content:t.getReactNode(e.content),title:t.getReactNode(e.title),id:n,modalProps:r?{...r,footer:t.getReactNode(r.footer),okText:t.getReactNode(r.okText),cancelText:t.getReactNode(r.cancelText),closeIcon:t.getReactNode(r.closeIcon)}:void 0}),n}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=Ve(this._container),r=t.modalProps;this._updateModalEmitter.fire(Jp({...t,content:n.getReactNode(t.content),title:n.getReactNode(t.title),id:e,modalProps:r?{...r,footer:n.getReactNode(r.footer),okText:n.getReactNode(r.okText),cancelText:n.getReactNode(r.cancelText),closeIcon:n.getReactNode(r.closeIcon)}:void 0}))}},Zp=class{_registration;_loadedDisposable;loaded;ready;_loadedSettled=!1;_readySettled=!1;constructor(e,t){this._registration=e,this._loadedDisposable=t,this.loaded=new Promise((n,r)=>{const i=()=>this._loadedDisposable.dispose(),o=()=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&i(),n())},s=d=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&i(),r(d))};this._resolveLoaded=o,this._rejectLoaded=s}),this.ready=new Promise((n,r)=>{const i=()=>this._loadedDisposable.dispose(),o=()=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&i(),n())},s=d=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&i(),r(d))};this._resolveReady=o,this._rejectReady=s})}_resolveLoaded=()=>{};_rejectLoaded=()=>{};_resolveReady=()=>{};_rejectReady=()=>{};resolveLoaded(){this._resolveLoaded()}resolveReady(){this._resolveReady()}rejectLoad(e){this._rejectLoaded(e),this._rejectReady(e)}rejectReady(e){this._rejectReady(e)}dispose(){this._registration.dispose();const e=new Error("Sandbox script registration disposed before completion.");this.rejectLoad(e),this.rejectReady(e)}},eh=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(Ye,()=>new Xe)}_createScriptHandle(e,t){const n=this._messageService.addListener(as,i=>{if(i.key===e){if(i.phase==="load"&&i.status==="success"){r.resolveLoaded();return}if(i.phase==="ready"&&i.status==="success"){r.resolveReady();return}if(i.phase==="load"){r.rejectLoad(new Error(i.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(i.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new Zp(t,n);return r}registerSandboxCSS(e){return this._container.addService(Te,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(Te,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(Te,{type:"script",key:e,parent:"head",attributes:{src:e,type:"text/javascript"}});return this._createScriptHandle(e,t)}registerSandboxScriptCode(e,t){const n=this._container.addService(Te,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},th=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function wn(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&th.has(t)}function zo(){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 Gt(){return`__settingsPanel:${zo()}`}function qt(e,t){return{type:e,props:t}}function nh(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!wn(e)}function Xr(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(wn(t)){const r=Gt();return n(e.add(r,t)),qt(r,{})}if(typeof t=="function"){const r=Gt();return n(e.add(r,t)),qt(r,{})}if(nh(t)){const r=t.type;if(typeof r=="string")return t;if(wn(r)||typeof r=="function"){const i=Gt();return n(e.add(i,r)),qt(i,t.props)}return t}return t}var rh=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=Ve(this._container),n=s=>this._trackRegistration(s),r=Xr(t,e.content,n),i=e.advancedTabs?.map(s=>({...s,content:Xr(t,s.content,n)})),o=e.instanceKey??zo();Ce(this._container,er).fire({...e,content:r,advancedTabs:i,instanceKey:o,type:gs})}closeSettingsPanel(){this._clearPanelRegistrations(),Ce(this._container,er).fire(null)}},Vo={SandboxScriptApi:eh,ElementsApi:Yp,BlocksApi:Kp,MessageService:Xp,SettingsPanelApi:rh,ModalApi:Qp};function $t(e,t,n,r={}){const i=Object.assign({},e);for(const[o,s]of Object.entries(t))if(s!==void 0)if(n.includes(o)&&typeof s=="object"&&s!==null){const d=i[o],a=r[o]??{};i[o]=Object.assign({},typeof d=="object"&&d!==null?d:a,s)}else i[o]=s;return i}var ne={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}},ih={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"},zt={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},Jr={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},Ie={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:ne.border,borderRadius:ne.borderRadius,textAlign:"center",padding:ne.padding},Qr={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:ne.padding},Vt={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:ne.border,borderRadius:ne.borderRadiusCards};function oh(e){return{...ih,...e}}function sh(e){return{...zt,...e,bold:e?.bold??zt.bold,italic:e?.italic??zt.italic}}function ah(e){return{...Jr,...e,underline:e?.underline??Jr.underline}}function lh(e){return{...Ie,...e,bold:e?.bold??Ie.bold,italic:e?.italic??Ie.italic,border:{...Ie.border,...e?.border},borderRadius:{...Ie.borderRadius,...e?.borderRadius},padding:{...Ie.padding,...e?.padding}}}function dh(e){return{...Qr,...e,padding:{...Qr.padding,...e?.padding}}}function ch(e){return{...Vt,...e,border:{...Vt.border,...e?.border},borderRadius:{...Vt.borderRadius,...e?.borderRadius}}}function Kt(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 Zr(e){let t={...Rn};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function Wt(e){return{text:oh(e.text),headings:sh(e.headings),links:ah(e.links),buttons:lh(e.buttons),block:dh(e.block),cards:ch(e.cards)}}var ei=L("EmailSettingsPort"),uh=1e4,Ko=class{_editor;_layoutSettingsChanged=new nn;_contentStylesChanged=new nn;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){const t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){const t=this._contentStylesChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}_disposeMessageSubscriptionIfUnused(){this._layoutSettingsChanged.hasListeners()||this._contentStylesChanged.hasListeners()||(this._messageSubscription?.dispose(),this._messageSubscription=void 0)}_settings(e=this._editor.container){const t=e.getInstance(ei);if(!t)throw new Error("[extensions] настройки письма ещё не загружены — работа с UI начинается с init()");return t}_getCurrentLayoutSettings(){return Kt(this._settings().read())}_getCurrentContentStyles(){const e=Pt(this._editor.container)?.current()?.get().attributes.common_styles;return Wt(Zr(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(ei),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(Ye,()=>new Xe),t=this._getCurrentLayoutSettings(),n=this._getCurrentContentStyles();this._prevLayoutSnapshot=this._getLayoutSnapshot(t),this._prevContentSnapshot=this._getContentSnapshot(n),this._messageSubscription=e.addListener(r=>{const i=r?.data,o=i?.operation;if(o===F.APPLICATION_EMAIL_SETTINGS_SET){const a=Kt(i?.settings),f=this._getLayoutSnapshot(a);f!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=f,this._layoutSettingsChanged.fire(a));return}if(o!==F.APPLICATION_COMMON_STYLES_UPDATE)return;const s=Wt(r.data?.settings?.commonStyles??{...Rn}),d=this._getContentSnapshot(s);d!==this._prevContentSnapshot&&(this._prevContentSnapshot=d,this._contentStylesChanged.fire(s))})})();try{await this._messageSubscriptionPromise}finally{this._messageSubscriptionPromise=void 0}}}async getEmailLayoutSettings(){return await this._waitForEmailSettingsFromIframe(),this._getCurrentLayoutSettings()}async setEmailLayoutSettings(e){await this._waitForEmailSettingsFromIframe();const t=this._settings(),n={...t.read(),...e};t.write(n);const r=Kt(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=uh){const t=Pt(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,i=Cn(r,B.ON_EMAIL_INIT_ID);return new Promise(o=>{let s=!1,d;const a=()=>{d&&(clearTimeout(d),d=void 0)},f=i(()=>{s||(s=!0,a(),f.dispose(),o())});d=setTimeout(()=>{s||(s=!0,f.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Pt(this._editor.container)?.current();if(!t)return;const n=Zr(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=$t(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:ne.border,borderRadius:ne.borderRadius,padding:ne.padding})),e.block!==void 0&&(n.block=$t(n.block||{},e.block,["padding"],{padding:ne.padding})),e.cards!==void 0&&(n.cards=$t(n.cards||{},e.cards,["border","borderRadius"],{border:ne.border,borderRadius:ne.borderRadiusCards}));const r=JSON.stringify(n);vt(t,{common_styles:r}),this._settings().markAppearanceChanged();const i=Wt(n);this._prevContentSnapshot=this._getContentSnapshot(i),this._contentStylesChanged.fire(i)}},fh={...Vo,EmailSettingsApi:Ko},ph={...Vo},Bm={...ph,EmailSettingsApi:Ko},hh={...fh};function mh(){Gp.addAll(hh)}var gh=[Le(()=>{mh()}),xp,Lp,Op,Ns,Cp,Gs];async function vh(){return(await Qe()).asyncMixins}var bh=qp,Eh=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let i;try{i=await vh()}catch(s){throw e.failPendingWaits(s),s}t=i(e);const o=await e.getInstanceAsync(_t);Object.assign(o,t.instance||{});for(const s of e.getInstance(bi)??[])s()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},yh=Cs([...gh]);function Yt(){let e,t=!1;const n=new Map,r=new Map;function i(){for(const o of r.values())o();r.clear()}return{event(o,s,d){const a=Symbol("subscription");return t||(n.set(a,{listener:o,priority:s,thisArg:d}),e&&r.set(a,e(o,s,d))),()=>{n.delete(a),r.get(a)?.(),r.delete(a)}},attach(o){i(),e=o;for(const[s,{listener:d,priority:a,thisArg:f}]of n)r.set(s,o(d,a,f))},dispose(){t=!0,i(),n.clear(),e=void 0}}}function _h(e){const t=Yt(),n=Yt(),r=Yt();return e.getInstance(j)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(yn).then(i=>{t.attach(i.onNotify),n.attach(i.onError),r.attach(i.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(i){const o=e.getInstance(yn);if(!o)throw new Error("[plugin] notify() вызван до загрузки редактора");o.notify(i)}}}var wh=[bu,vp,_h];function Sh(e,t=wh){const n=Wn(e);Ip(e);const r=yh(e),i=bh(e),o=Eh(e),s={...r.instance,...i.instance,...o.instance};for(const a of t)Object.assign(s,a(e));let d=!0;return{instance:s,async setOptions(a){await r.setOptions(a);const f=d&&n.get()===a;d=!1,f||n.set(a),await i.setOptions(a),await o.setOptions(a)}}}var Ih=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]}},Th="editor-runtime.react.copies",Xt=8;function Ke(e){return e&&typeof e=="object"?e:void 0}function ti(e){const t=Ke(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=Ke(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function Ah(e){const t=Ke(e),n=t&&typeof t.version=="string"?t.version:void 0,r=Ke(t?.default),i=r&&typeof r.version=="string"?r.version:void 0;return n??i??"unknown"}function Ch(e,t,n){return e.package===t&&e.version===n}function Rh({ourReact:e,entries:t,packageName:n,version:r}){const i=ti(e);if(!i||!Array.isArray(t))return[];const o=[],s=new Set;for(const d of t){const a=Ke(d);if(!a||!Ch(a,n,r))continue;const f=ti(a.react);!f||f===i||s.has(f)||(s.add(f),o.push({package:n,version:r,reactVersion:Ah(a.react),react:a.react}))}return o}function Ph({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,Xt))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>Xt&&n.push(` …and ${t.length-Xt} 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(`
|
|
1047
|
+
`)}var ni=new Set;function Dh({packageName:e="useblocks",version:t="1.1.85-dev.8",log:n=r=>{}}={}){const r=i=>{try{const o=globalThis[Symbol.for(Th)],s=Rh({ourReact:i,entries:o,packageName:e,version:t}).filter(d=>!ni.has(d.react));if(!s.length)return;s.forEach(d=>ni.add(d.react)),n(Ph({packageName:e,copies:s}))}catch{}};try{const i=xn()?.modules?.React;if(i&&typeof i.then=="function"){i.then(r,()=>{});return}r(i)}catch{}}async function Oh(e,t,n){$(e.signal);const r=t??mt.createChild();Wn(r);const i=r.getInstance(j);async function o(){r.inject(ss,new Ih),Dh();const s=Sh(r),d={...s.instance,container:r,async reset(a){if($(a.signal),i.isDisposed())throw Ln();return await s.setOptions(a),d}};r.inject(_t,d);try{if(n?.onInstance?.(d),await s.setOptions(e),$(e.signal),i.isDisposed()||await r.getInstance(tn)?.activate(),e.devTools)try{const a=r.getInstance(tn);a&&await(await Qe()).initDevTools(r,a)}catch{}return $(e.signal),Pn(r,mi).fire(d),d}catch(a){throw i.dispose(),a}}try{return await pt(o(),e.signal)}catch(s){throw i.isDisposed()||i.dispose(),s}}var We=new WeakMap;function xh(e){return e?We.get(e):void 0}function Wo(e){try{e.getInstance(j)?.dispose()}catch{}try{e.dispose()}catch{}}function Lh(e,t){if(!e)return;const n=We.get(e);n&&n!==t&&Wo(n),We.set(e,t)}function Mh(e,t){e&&We.get(e)===t&&We.delete(e)}function kh(e){const t=mt.createChild();return At(e)&&t.inject(he,Tt(e)),t}var qe=new WeakMap,Nh="data-useblocks-config-styles";function Fh(e){return typeof e=="string"?e.trim():""}function ri(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function jh(e,t,n){if(!e||typeof document>"u")return null;const r=Fh(t),i=qe.get(e),o=n||e;if(!r)return i&&(i.remove(),qe.delete(e)),null;if(i)return i.textContent!==r&&(i.textContent=r),(i.parentNode!==o||i!==o.firstChild)&&ri(o,i),i;const s=document.createElement("style");return s.setAttribute(Nh,"true"),s.textContent=r,ri(o,s),qe.set(e,s),s}function Bh(e){if(!e)return;const t=qe.get(e);t&&(t.remove(),qe.delete(e))}function Yo(){return!1}var Uh=`
|
|
1048
1048
|
.blocks-app-initial-spinner-wrapper {
|
|
1049
1049
|
width: 100%;
|
|
1050
1050
|
height: 100%;
|
|
@@ -1073,7 +1073,7 @@ import{t as si}from"./static/esm/50fbfdf6.js";import{$ as Qo,A as Zo,At as le,B
|
|
|
1073
1073
|
100% {
|
|
1074
1074
|
transform: rotate(360deg);
|
|
1075
1075
|
}
|
|
1076
|
-
}`;function xh(){return()=>{}}function Lh(e,t){if(!qo()||!e||typeof document>"u")return xh();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=document.createElement("div");n.classList.add("blocks-app-initial-spinner-wrapper");const r=document.createElement("div");r.classList.add("blocks-app-initial-spinner"),n.appendChild(r);const i=document.createElement("style");i.setAttribute(t,"true"),i.textContent=Oh,document.head?.appendChild(i),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),i.remove())}}function Mh(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function kh({report:e}={}){const t=new Map,n=new Set,r=e??(i=>{});return{run(i,o){const s=t.get(i);if(s!==void 0)return s;const d=o().catch(l=>{throw n.has(i)||(n.add(i),r(l)),Mh(l)||t.delete(i),l});return t.set(i,d),d},clear(){t.clear(),n.clear()},size(){return t.size}}}var qn=kh();function $o(){qn.clear()}ts(()=>qn.clear());var Xr=new WeakMap,Jr=new WeakMap;function Nh(e,t){let n=Jr.get(t);n||(n=new Map,Jr.set(t,n));const r=n.get(e);if(r!==void 0)return r;const i=t.getInstance(ai),o=Us({baseUrl:e,customFetch:i?.execute??fetch},t);return n.set(e,o),o}function $n(e){return hs(e)}function Fh(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function jh(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function Bh(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}function Uh(e,t){return async({baseUrl:n})=>{const r=$n(n);if(!r)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const i=new Headers({Accept:"application/json"});if(e.getAuthToken&&!await Bh(e))throw jh();const o=t();if(!o)throw new Error("[Loader] appInit requires the instance container");const s=new gi(Nh(r,o)),d={headers:Object.fromEntries(i.entries()),credentials:"same-origin",failoverAttemptTimeout:Hn(e)||void 0},l=await s.app_init_create({},d);if(!l.ok)throw Fh(l.status,l.statusText);return l.data}}function Hh(e){return JSON.stringify({baseUrl:$n(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function Gh(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function qh(e){return t=>qn.run(Hh(t),()=>($("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>$("appInit:end",{kind:"network"}))))}function $h(e,t){if(It(e)||!e.appInit&&!$n(e.baseUrl)||!Gh(e))return e;const n=e.appInit??Uh(e,t);let r=Xr.get(n);return r||(r=qh(n),Xr.set(n,r)),{...e,appInit:r}}var zo=0;function zh(){return zo}function Vh(){zo+=1,$o()}var Qr=new WeakMap,Zr=new WeakMap,Kh=3e4;function Wh(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function Yh(e,t){try{const n=ui(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+Kh}function Xh(e){const t=new Map,n=new Map;return async(r,i,o)=>{const s=Wh(r,i);if(o)return n.delete(s),t.delete(s),$o(),e(r,i,o);const d=n.get(s);if(d&&!t.has(s)){if(d.expiresAtMs>Date.now())return d.token;n.delete(s)}let l=t.get(s);return l===void 0&&($("authToken:start",{kind:"network"}),l=Promise.resolve(e(r,i,o)).then(f=>{const u=String(f||"").trim();return u&&n.set(s,{token:f,expiresAtMs:Yh(u,Date.now())}),f}).finally(()=>{$("authToken:end",{kind:"network"}),t.delete(s)}),t.set(s,l)),l}}function Jh(e){if(It(e))return e;const t=e.getAuthToken;if(!t)return e;let n=Qr.get(t);const r=zh();return(!n||Zr.get(t)!==r)&&(n=Xh(t),Qr.set(t,n),Zr.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(i=>{}),{...e,getAuthToken:n}}var vn=new WeakMap;function ei(e){const t=(vn.get(e)??0)+1;return vn.set(e,t),t}function Qh(e,t){return vn.get(e)===t}var Zh=new Set(["setConfig","updateConfig","show","save","getEmailSnapshot","getEmail","compileEmail","getBlocks","getEmailRevisions","getComments","validateCode","reset","useAsync"]),em=new Set(["setEmailMeta","setBlockMeta","notify"]),Vo=new Map([["getConfig","await `ready` first"],["use","use `useAsync()` or await `ready` first"],["container","await `ready` first"],["undoRedoService","await `ready` first"]]);function ti(e){if(/^handle[A-Z]/.test(e))return"event";if(Zh.has(e))return"async";if(em.has(e))return"queued";if(e==="getElement")return"element";if(e==="getCodeErrors")return"codeErrors";if(Vo.has(e))return"notReady"}function tm(e){return Vo.get(e)??"await `ready` first"}function ni(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}function nm(e,t){let n,r=0,i="pending",o,s,d;const l=new Set,f=[];let u,v;const b=new Promise((C,P)=>{u=C,v=P});b.catch(()=>{});const E=C=>n?.[C],I=C=>{const P=E(C.name);C.dispose||typeof P!="function"||(C.dispose=P(...C.args))},g=()=>l.forEach(I),y=()=>{for(const C of l)C.dispose?.(),C.dispose=void 0},w=()=>g(),S=()=>{d?.delete(w),d=void 0},A=()=>{y(),l.clear(),S(),f.length=0,n=void 0},h=()=>i==="failed"?o:Tn(),c=(C,P,j)=>{if(i==="failed"||i==="destroyed")throw h();const R=E(C);if(typeof R!="function")throw ni(C);return R.apply(j,P)},a=()=>i==="ready"?Promise.resolve():i==="pending"?b:Promise.reject(h()),p=(C,P)=>{if(i==="failed"||i==="destroyed")throw h();if(i==="ready"&&typeof E(C)!="function")throw ni(C);const j={name:C,args:P};return l.add(j),I(j),()=>{l.delete(j),j.dispose?.(),j.dispose=void 0}},m=()=>{const C=e.element;return C!==void 0&&typeof C!="string"?C:void 0},_=new Proxy({},{get(C,P,j){if(typeof P!="string"||P==="then")return;const R=ti(P);if(R==="event")return(...O)=>p(P,O);if(n&&P in n)return Reflect.get(n,P,j);switch(R){case"async":return(...O)=>a().then(()=>c(P,O,j));case"queued":return(...O)=>{if(i!=="pending")return c(P,O,j);f.push({name:P,args:O})};case"element":return m;case"codeErrors":return()=>[];case"notReady":throw new Error(`[emailmaker] \`${P}\` is not available before the editor is ready: ${tm(P)}`);default:return P in Object.prototype?Reflect.get(Object.prototype,P,j):void 0}},has(C,P){return typeof P!="string"?!1:n!==void 0&&P in n||ti(P)!==void 0}}),T=Object.create(_);return Object.defineProperty(T,"ready",{get:()=>s,enumerable:!0}),Object.defineProperty(T,"destroy",{enumerable:!0,value:()=>{if(i==="destroyed"||i==="failed")return;if(i==="pending"){i="destroyed",s?.catch(()=>{}),t(Q("[emailmaker] editor was destroyed before it was ready"));return}const C=n!==void 0&&Qh(n,r),P=n;i="destroyed",A(),C&&P?.destroy()}}),{handle:T,bind:C=>{n!==C&&(y(),S(),n=C,g(),i==="pending"&&(d=C.container.getOrCreateInstance(fi,()=>new Set),d.add(w)))},settle:()=>{const C=n;if(i==="destroyed"){A(),C&&(ei(C),C.destroy());const P=Q("[emailmaker] editor was destroyed before it was ready");throw o=P,v(P),P}C&&(r=ei(C)),i="ready",S();for(const P of f.splice(0))try{c(P.name,P.args,T)}catch(j){queueMicrotask(()=>{throw j})}u()},fail:C=>{i!=="destroyed"&&(i="failed",o=C),A(),v(C)},setReady:C=>{s=C}}}var Ko="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function rm(){return Q(Ko)}function im(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Ko}function om(e,t,n){if(typeof document>"u")return;let r=!1,i;const o=()=>{r=!0,i?.disconnect(),i=void 0},s=()=>{r||(o(),t())};if(n.addDispose(o),!e.isConnected){queueMicrotask(s);return}i=new MutationObserver(()=>{e.isConnected||s()});let d=e.parentNode;for(;d;)i.observe(d,{childList:!0}),d=d.parentNode}function sm(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:i}=e;if(t===void 0||!(n instanceof Element))return r;const o=new AbortController;return om(n,()=>{n.id,o.abort(rm())},i),Sn(r,o.signal)}var Wo="Superseded by newer init() on the same mount element";function ri(){return Q(Wo)}function am(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Wo}var lt=new Map,dt=new WeakMap;function lm(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function dm(e){if(!e)return{release:()=>{}};const t=lm(e);dt.get(e)?.abort(ri()),t&<.get(t)?.abort(ri());const n=new AbortController;return dt.set(e,n),t&<.set(t,n),{signal:n.signal,release:()=>{dt.get(e)===n&&dt.delete(e),t&<.get(t)===n&<.delete(t)}}}var Am=si({FileManagerApiError:()=>cm}),cm=class Yo extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,i){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=i,Error.captureStackTrace&&Error.captureStackTrace(this,Yo)}},Cm=si({mapHttpStatusToErrorCode:()=>is});function um(e,t){return{...e,element:t}}function bn(){return()=>{}}function fm(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?bn():(Ph(t,e.config?.styles,t),()=>{Dh(t)})}function pm(e){if(!qo()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:bn()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:bn()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.remove()});const n=Lh(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function ii(e){return e instanceof DOMException&&e.name==="AbortError"}function oi(e){try{e.destroy()}catch{}}function Yt(e,...t){const n=ce.get(e);t.some(r=>r!==void 0&&r===n)&&ce.delete(e)}var Rm="1.1.85-dev.6";async function Pm(e){await Pp(typeof window.__useblocks__<"u"?window.__useblocks__:void 0)}async function Dm(e){return hm(e).ready}function hm(e){$(J.initStart);const t=new AbortController,n=Sn(e.signal,t.signal),r=nm(e,o=>t.abort(o)),i=mm({...e,signal:n},r.bind).then(()=>($(J.initEnd),r.settle(),r.handle),o=>{throw r.fail(o),o});return r.setReady(i),r.handle}async function mm(e,t){q(e.signal);const n=new Z;let r;try{const i=await Ls(e.element,n,e.signal),o=sm({hostElementOption:e.element,resolvedElement:i,externalSignal:e.signal,disposable:n}),s=dm(i);r=s.release;const d=Sn(o,s.signal);return q(d),await En(gm(e,i,t,d),d)}finally{r?.(),n.dispose()}}async function gm(e,t,n,r){q(r),Vh();const i=um(e,t),o=Jh(i);let s;const d=$h(o,()=>s),l=r!=null?{...d,signal:r}:d;if(t){const E=ce.get(t);if(E){let I;try{I=await E,q(r)}catch(g){if(q(r),Yt(t,E),ii(g))throw g;I=void 0}if(I)if(I.getElement()===t)try{return s=Sh(t),n(I),await I.reset(l)}catch(g){if(q(r),am(g)||im(g)||ii(g)&&r?.aborted)throw g;Yt(t,E,I),oi(I)}else Yt(t,E,I),oi(I)}}q(r);const f=fm(d),u=pm(d),v=r!=null?{...u.options,signal:r}:u.options;let b;try{s=Ah(v),Ih(t,s),Un(s).set(v),await Gn(),$(J.coreReady),q(r),q(r),b=wh(v,s,{onInstance:n}),t&&ce.set(t,b);const E=await b;if(r?.aborted&&(E.destroy(),q(r)),t)if(ce.get(t)===b)ce.set(t,E);else throw E.destroy(),q(r),Q(r?.reason);return E}catch(E){throw f(),u.cleanup(),s&&(Go(s),Th(t,s)),t&&b&&ce.get(t)===b&&ce.delete(t),E}}async function Om(e){return(await Je()).parseAMP(e)}typeof window<"u"&&(qe()&&sa(),Op(typeof window.__useblocks__<"u"?window.__useblocks__:void 0));export{Ko as ELEMENT_DETACHED_ABORT_MESSAGE,Wo as SUPERSEDED_INIT_ABORT_MESSAGE,hm as create,Am as errors,Cm as helpers,Dm as init,im as isElementDetachedError,am as isSupersededInitError,Om as parseAMP,Lp as pluginRegistry,Pm as preload,Rm as version};
|
|
1076
|
+
}`;function Hh(){return()=>{}}function Gh(e,t){if(!Yo()||!e||typeof document>"u")return Hh();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=document.createElement("div");n.classList.add("blocks-app-initial-spinner-wrapper");const r=document.createElement("div");r.classList.add("blocks-app-initial-spinner"),n.appendChild(r);const i=document.createElement("style");i.setAttribute(t,"true"),i.textContent=Uh,document.head?.appendChild(i),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),i.remove())}}function qh(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function $h({report:e}={}){const t=new Map,n=new Set,r=e??(i=>{});return{run(i,o){const s=t.get(i);if(s!==void 0)return s;const d=o().catch(a=>{throw n.has(i)||(n.add(i),r(a)),qh(a)||t.delete(i),a});return t.set(i,d),d},clear(){t.clear(),n.clear()},size(){return t.size}}}var Jn=$h();function Xo(){Jn.clear()}ls(()=>Jn.clear());var ii=new WeakMap,oi=new WeakMap;function zh(e,t){let n=oi.get(t);n||(n=new Map,oi.set(t,n));const r=n.get(e);if(r!==void 0)return r;const i=t.getInstance(pi),o=Ks({baseUrl:e,customFetch:i?.execute??fetch},t);return n.set(e,o),o}function Qn(e){return ws(e)}function Vh(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function Kh(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function Wh(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 Zn=new WeakMap;function Jt(e,t){Zn.set(e,t)}function Yh(e){return Zn.get(e)}function Xh(e,t){return async({baseUrl:n})=>{const r=t();if(!r)throw new Error("[Loader] appInit requires the instance container");const i=Zn.get(r)??e,o=Qn(n);if(!o)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const s=new Headers({Accept:"application/json"});if(i.getAuthToken&&!await Wh(i))throw Kh();const d=new _i(zh(o,r)),a={headers:Object.fromEntries(s.entries()),credentials:"same-origin",failoverAttemptTimeout:Yn(i)||void 0},f=await d.app_init_create({},a);if(!f.ok)throw Vh(f.status,f.statusText);return f.data}}function Jh(e){return JSON.stringify({baseUrl:Qn(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function Qh(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function Zh(e){return t=>Jn.run(Jh(t),()=>(z("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>z("appInit:end",{kind:"network"}))))}function em(e,t){if(At(e)||!e.appInit&&!Qn(e.baseUrl)||!Qh(e))return e;const n=e.appInit??Xh(e,t);let r=ii.get(n);return r||(r=Zh(n),ii.set(n,r)),{...e,appInit:r}}var Jo=0;function tm(){return Jo}function nm(){Jo+=1,Xo()}var si=new WeakMap,ai=new WeakMap,rm=3e4;function im(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function om(e,t){try{const n=vi(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+rm}function sm(e){const t=new Map,n=new Map;return async(r,i,o)=>{const s=im(r,i);if(o)return n.delete(s),t.delete(s),Xo(),e(r,i,o);const d=n.get(s);if(d&&!t.has(s)){if(d.expiresAtMs>Date.now())return d.token;n.delete(s)}let a=t.get(s);return a===void 0&&(z("authToken:start",{kind:"network"}),a=Promise.resolve(e(r,i,o)).then(f=>{const u=String(f||"").trim();return u&&n.set(s,{token:f,expiresAtMs:om(u,Date.now())}),f}).finally(()=>{z("authToken:end",{kind:"network"}),t.delete(s)}),t.set(s,a)),a}}function am(e){if(At(e))return e;const t=e.getAuthToken;if(!t)return e;let n=si.get(t);const r=tm();return(!n||ai.get(t)!==r)&&(n=sm(t),si.set(t,n),ai.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(i=>{}),{...e,getAuthToken:n}}var Ze=new WeakMap,Sn=new WeakMap;function Qo(e,t){Ze.set(e,t),Sn.get(e)?.forEach(n=>n())}function lm(e,t){const n=Sn.get(e)??new Set;return n.add(t),Sn.set(e,n),()=>n.delete(t)}function Qt(e){const t=(Ze.get(e)??0)+1;return Qo(e,t),t}var In=new WeakMap;function dm(e,t){const n=In.get(e)??new Set;n.add(t),In.set(e,n)}function cm(e,t,n){return Ze.get(e)!==t?!0:In.get(e)?.has(n)?!1:(Qo(e,n),!0)}function Zt(e,t){return Ze.get(e)===t}function li(e){return Ze.get(e)??0}var um=new Set(["setConfig","updateConfig","show","save","getEmailSnapshot","getEmail","compileEmail","getBlocks","getEmailRevisions","getComments","validateCode","reset","useAsync"]),fm=new Set(["setEmailMeta","setBlockMeta","notify"]),Zo=new Map([["getConfig","await `ready` first"],["use","use `useAsync()` or await `ready` first"],["container","await `ready` first"],["undoRedoService","await `ready` first"]]);function di(e){if(/^handle[A-Z]/.test(e))return"event";if(um.has(e))return"async";if(fm.has(e))return"queued";if(e==="getElement")return"element";if(e==="getCodeErrors")return"codeErrors";if(Zo.has(e))return"notReady"}function pm(e){return Zo.get(e)??"await `ready` first"}function ci(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}function hm(e,t){let n,r=0,i,o="pending",s,d,a,f;const u=new Set,v=[];let b,E;const I=new Promise((C,D)=>{b=C,E=D});I.catch(()=>{});const g=C=>n?.[C],y=()=>o==="pending"||n!==void 0&&Zt(n,r),_=C=>{const D=g(C.name);C.dispose||typeof D!="function"||!y()||(C.dispose=D(...C.args))},S=()=>u.forEach(_),A=()=>{for(const C of u)C.dispose?.(),C.dispose=void 0},h=()=>S(),c=()=>{o==="ready"&&(y()?S():A())},l=()=>{a?.delete(h),a=void 0},p=()=>{f?.(),f=void 0,A(),u.clear(),l(),v.length=0,n=void 0},m=()=>o==="failed"?s:Ln(),w=(C,D,x)=>{if(o==="failed"||o==="destroyed")throw m();const U=g(C);if(typeof U!="function")throw ci(C);return U.apply(x,D)},T=()=>o==="ready"?Promise.resolve():o==="pending"?I:Promise.reject(m()),O=(C,D)=>{if(o==="failed"||o==="destroyed")throw m();if(o==="ready"&&typeof g(C)!="function")throw ci(C);const x={name:C,args:D};return u.add(x),_(x),()=>{u.delete(x),x.dispose?.(),x.dispose=void 0}},k=()=>{const C=e.element;return C!==void 0&&typeof C!="string"?C:void 0},W=new Proxy({},{get(C,D,x){if(typeof D!="string"||D==="then")return;const U=di(D);if(U==="event")return(...J)=>O(D,J);if(n&&D in n)return Reflect.get(n,D,x);switch(U){case"async":return(...J)=>T().then(()=>w(D,J,x));case"queued":return(...J)=>{if(o!=="pending")return w(D,J,x);v.push({name:D,args:J})};case"element":return k;case"codeErrors":return()=>[];case"notReady":throw new Error(`[emailmaker] \`${D}\` is not available before the editor is ready: ${pm(D)}`);default:return D in Object.prototype?Reflect.get(Object.prototype,D,x):void 0}},has(C,D){return typeof D!="string"?!1:n!==void 0&&D in n||di(D)!==void 0}}),R=Object.create(W);return Object.defineProperty(R,"ready",{get:()=>d,enumerable:!0}),Object.defineProperty(R,"destroy",{enumerable:!0,value:()=>{if(o==="destroyed"||o==="failed")return;if(o==="pending"){const x=i!==void 0&&n!==void 0&&Zt(n,r),U=n;o="destroyed",d?.catch(()=>{}),t(Z("[emailmaker] editor was destroyed before it was ready")),x&&(p(),U?.destroy());return}const C=n!==void 0&&Zt(n,r),D=n;o="destroyed",p(),C?D?.destroy():D&&dm(D,r)}}),{handle:R,bind:(C,D)=>{D?.adopt&&o==="pending"&&i===void 0?(i=li(C),r=Qt(C)):!D?.adopt&&n!==C&&(i=void 0),n!==C&&(A(),l(),n=C,S(),o==="pending"&&(a=C.container.getOrCreateInstance(bi,()=>new Set),a.add(h)))},settle:()=>{const C=n;if(o==="destroyed"){p(),C&&(Qt(C),C.destroy());const D=Z("[emailmaker] editor was destroyed before it was ready");throw s=D,E(D),D}C&&i===void 0&&li(C)===0&&(r=Qt(C)),o="ready",C&&(f=lm(C,c),c()),l();for(const D of v.splice(0))try{w(D.name,D.args,R)}catch(x){queueMicrotask(()=>{throw x})}b()},fail:C=>{o!=="destroyed"&&(o="failed",s=C,n&&i!==void 0&&!cm(n,r,i)&&n.destroy()),p(),E(C)},setReady:C=>{d=C}}}var es="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function mm(){return Z(es)}function gm(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===es}function vm(e,t,n){if(typeof document>"u")return;let r=!1,i;const o=()=>{r=!0,i?.disconnect(),i=void 0},s=()=>{r||(o(),t())};if(n.addDispose(o),!e.isConnected){queueMicrotask(s);return}i=new MutationObserver(()=>{e.isConnected||s()});let d=e.parentNode;for(;d;)i.observe(d,{childList:!0}),d=d.parentNode}function bm(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:i}=e;if(t===void 0||!(n instanceof Element))return r;const o=new AbortController;return vm(n,()=>{n.id,o.abort(mm())},i),On(r,o.signal)}var ts="Superseded by newer init() on the same mount element";function Em(){return Z(ts)}function ym(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===ts}var Fe=new Map,ct=new WeakMap;function _m(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function wm(e){if(!e)return{previous:Promise.resolve(),release:()=>{}};const t=_m(e);(t?Fe.get(t):void 0)?.forEach(a=>{a.element!==e&&a.controller.abort(Em())});const n=ct.get(e)??Promise.resolve();let r;const i=new Promise(a=>{r=a}),o=n.then(()=>i);ct.set(e,o),o.then(()=>{ct.get(e)===o&&ct.delete(e)});const s=new AbortController,d={element:e,controller:s};if(t){const a=Fe.get(t)??new Set;a.add(d),Fe.set(t,a)}return{signal:s.signal,previous:n,release:()=>{r();const a=t?Fe.get(t):void 0;t&&a?.delete(d)&&a.size===0&&Fe.delete(t)}}}var Um=fi({FileManagerApiError:()=>Sm}),Sm=class ns extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,i){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=i,Error.captureStackTrace&&Error.captureStackTrace(this,ns)}},Hm=fi({mapHttpStatusToErrorCode:()=>Es});function Im(e,t){return{...e,element:t}}function Tn(){return()=>{}}function Tm(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?Tn():(jh(t,e.config?.styles,t),()=>{Bh(t)})}function Am(e){if(!Yo()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:Tn()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:Tn()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.remove()});const n=Gh(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function Cm(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function ui(e){try{e.destroy()}catch{}}function en(e,...t){const n=le.get(e);t.some(r=>r!==void 0&&r===n)&&le.delete(e)}var Gm="1.1.85-dev.8";async function qm(e){await jp(typeof window.__useblocks__<"u"?window.__useblocks__:void 0)}async function $m(e){return Rm(e).ready}function Rm(e){z(Q.initStart);const t=new AbortController,n=On(e.signal,t.signal),r=hm(e,o=>t.abort(o)),i=Pm({...e,signal:n},r.bind).then(()=>(z(Q.initEnd),r.settle(),r.handle),o=>{throw r.fail(o),o});return r.setReady(i),r.handle}async function Pm(e,t){$(e.signal);const n=new ee;let r,i;try{const o=await Us(e.element,n,e.signal),s=bm({hostElementOption:e.element,resolvedElement:o,externalSignal:e.signal,disposable:n}),d=wm(o);r=d.release;const a=On(s,d.signal);return $(a),await pt(d.previous,a),i=Dm(e,o,t,a),await pt(i,a)}finally{const o=r;i!==void 0&&o?i.then(o,o):o?.(),n.dispose()}}async function Dm(e,t,n,r){$(r),nm();const i=Im(e,t),o=am(i);let s;const d=em(o,()=>s),a=r!=null?{...d,signal:r}:d;if(t){const E=le.get(t);if(E){let I;try{I=await E,$(r)}catch{$(r),en(t,E),I=void 0}if(I)if(I.getElement()===t){const g=xh(t);s=g;const y=g&&Yh(g);try{g&&Jt(g,d),n(I,{adopt:!0});const _=await I.reset(Cm(e,a));return le.set(t,I),_}catch(_){if(g&&y&&Jt(g,y),$(r),ym(_)||gm(_)||An(_)&&r?.aborted)throw _;en(t,E,I),ui(I)}}else en(t,E,I),ui(I)}}$(r);const f=Tm(d),u=Am(d),v=r!=null?{...u.options,signal:r}:u.options;let b;try{s=kh(v),Lh(t,s),Jt(s,d),Wn(s).set(v),await Xn(),z(Q.coreReady),$(r),$(r),b=Oh(v,s,{onInstance:n}),t&&le.set(t,b);const E=await b;if(r?.aborted&&(E.destroy(),$(r)),t)if(le.get(t)===b)le.set(t,E);else throw E.destroy(),$(r),Z(r?.reason);return E}catch(E){throw f(),u.cleanup(),s&&(Wo(s),Mh(t,s)),t&&b&&le.get(t)===b&&le.delete(t),E}}async function zm(e){return(await Qe()).parseAMP(e)}typeof window<"u"&&($e()&&pa(),Up(typeof window.__useblocks__<"u"?window.__useblocks__:void 0));export{es as ELEMENT_DETACHED_ABORT_MESSAGE,ts as SUPERSEDED_INIT_ABORT_MESSAGE,Rm as create,Um as errors,Hm as helpers,$m as init,gm as isElementDetachedError,ym as isSupersededInitError,zm as parseAMP,Gp as pluginRegistry,qm as preload,Gm as version};
|
|
1077
1077
|
|
|
1078
1078
|
|
|
1079
|
-
window.__useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/
|
|
1079
|
+
window.__useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/06d19668.js":["static/core/5db1f013.js","__delivery__/libs"],"static/core/13c7b13a.js":["static/core/e47dcbb0.js","__delivery__/libs","monaco"],"static/core/175b5b0f.js":[],"static/core/1afe0f9c.js":["static/core/ff43365e.js","static/core/5db1f013.js","__delivery__/libs"],"static/core/28160edc.js":[],"static/core/3d7934fb.js":[],"static/core/3df10afa.js":["__delivery__/libs"],"static/core/3fd50a29.js":[],"static/core/41028939.js":[],"static/core/45eb9af1.js":["static/core/41028939.js","static/core/3d7934fb.js","static/core/799f4d8e.js"],"static/core/48a8ba9d.js":[],"static/core/48da14fd.js":[],"static/core/49a8dc9c.js":[],"static/core/4c8d0155.js":[],"static/core/59cfe4a0.js":[],"static/core/5db1f013.js":["static/core/175b5b0f.js","__delivery__/libs"],"static/core/60aa31a3.js":[],"static/core/6561b34a.js":[],"static/core/778aee63.js":[],"static/core/799f4d8e.js":["static/core/3d7934fb.js"],"static/core/7b850506.js":[],"static/core/7c047ede.js":["static/core/3df10afa.js","__delivery__/libs"],"static/core/982730aa.js":["static/core/3d7934fb.js"],"static/core/a46eae76.js":[],"static/core/a5996860.js":["static/core/175b5b0f.js"],"static/core/ac50dfd1.js":[],"static/core/b165db74.js":[],"static/core/cb42ad65.js":[],"static/core/db82c42b.js":[],"static/core/df189a9d.js":[],"static/core/e47dcbb0.js":[],"static/core/e50befab.js":[],"static/core/ec93b234.js":["static/core/175b5b0f.js","static/core/5db1f013.js","__delivery__/libs"],"static/core/f1478faf.js":["static/core/41028939.js"],"static/core/f1498d3c.js":[],"static/core/f8d889a1.js":["static/core/06d19668.js","static/core/3df10afa.js","__delivery__/libs","static/core/5db1f013.js"],"static/core/fa60c7fb.js":["static/core/ff43365e.js","static/core/5db1f013.js","static/core/06d19668.js","static/core/7c047ede.js","__delivery__/libs"],"static/core/fb2fe2db.js":[],"static/core/ff43365e.js":[],"static/monaco/editor.api-C9c1WLns.js":[],"monaco":["static/monaco/editor.api-C9c1WLns.js","static/monaco/lspLanguageFeatures-DY3n8M13.js"],"static/monaco/lspLanguageFeatures-DY3n8M13.js":["static/monaco/editor.api-C9c1WLns.js"],"compat-globals.js":["static/esm/50fbfdf6.js"],"static/esm/delivery-libs.js":[],"useblocks-esm.js":["static/esm/50fbfdf6.js","static/esm/349f9e2c.js"],"static/esm/349f9e2c.js":[],"static/esm/50fbfdf6.js":[]},"bundles":{"static/core/3df10afa.js":["static/core/5cf8c192.js","static/core/4cda85e3.js","static/core/b6d27bcf.js","static/core/e02ef34c.js"],"static/core/f1478faf.js":["static/core/a71c4cd8.js"],"static/core/ec93b234.js":["static/core/4d436d7d.js"],"static/core/7c047ede.js":["static/core/a73da823.js"],"static/core/f8d889a1.js":["static/core/94d4ae45.js"],"core":["static/core/2ff39ddf.js","static/core/ca13058e.js","static/core/b2b19022.js","static/core/f72a1b7d.js","static/core/4d23db03.js"]}});
|