useblocks 1.1.102 → 1.1.103
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/iframe/.vite/manifest.json +4 -4
- package/iframe/{iframe-eblock.1c4e77a0.html → iframe-eblock.b65837b7.html} +2 -2
- package/iframe/{iframe.1c4e77a0.html → iframe.b65837b7.html} +2 -2
- package/iframe/js/{discussHandlers.Xh4-JUcT.js → discussHandlers.B36tbVEC.js} +44 -44
- package/iframe/js/{iframe-eblock.body.1c4e77a0.js → iframe-eblock.body.b65837b7.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.1c4e77a0.js → iframe.body.b65837b7.js} +3 -3
- package/iframe/js/iframe.js +2 -2
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{b7aa9fec.js → 20098caa.js} +1 -1
- package/static/core/{1b68c0f0.js → 29993987.js} +1 -1
- package/static/core/{6a671446.js → 2a85f6f1.js} +1 -1
- package/static/core/{edf450a1.js → 348ec5fd.js} +1 -1
- package/static/core/{26cc947d.js → 3501b0a6.js} +1 -1
- package/static/core/{11b821ed.js → 36448ec6.js} +1 -1
- package/static/core/{5e7c221f.js → 41dd8b28.js} +13 -13
- package/static/core/{44d2c046.js → 47bde21f.js} +1 -1
- package/static/core/{f1ee2bef.js → 50c87f51.js} +1 -1
- package/static/core/{a98b6879.js → 5c36eb62.js} +1 -1
- package/static/core/{f323e60e.js → 5d7aff4e.js} +1 -1
- package/static/core/{5d849eef.js → 63f26591.js} +1 -1
- package/static/core/{3ec42945.js → 68650ff2.js} +1 -1
- package/static/core/{cc180859.js → 69cf8e2c.js} +1 -1
- package/static/core/{ca4dad9b.js → 6b904901.js} +2 -2
- package/static/core/{3fb172c7.js → 8288f720.js} +1 -1
- package/static/core/{91e07171.js → a013bc08.js} +1 -1
- package/static/core/{a2e57e5f.js → aa3448fe.js} +1 -1
- package/static/core/{448f03f8.js → b7d1fefc.js} +1 -1
- package/static/core/{53103851.js → c9a4d1ef.js} +2 -2
- package/static/core/{ae22b7f6.js → d74756b9.js} +1 -1
- package/static/core/{b653f9c5.js → defdbce4.js} +1 -1
- package/static/core/{64be048b.js → ed8a3337.js} +1 -1
- package/static/core/{847338a8.js → f8819751.js} +1 -1
- package/static/core/{d7666ad0.js → fd8197a8.js} +1 -1
- package/static/umd-runtime/{runtime.2paN090q.js → runtime.D3aKaKTc.js} +1 -1
- package/useblocks-core.b65837b7.js +859 -0
- package/useblocks-esm.js +6 -6
- package/{useblocks-po.1c4e77a0.js → useblocks-po.b65837b7.js} +1 -1
- package/useblocks.d.ts +31 -6
- package/useblocks.js +6 -6
- package/vendor/useblocks-ui-kit/package.json +1 -1
- package/useblocks-core.1c4e77a0.js +0 -859
package/useblocks-esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as Go,r as bl}from"./static/esm/971f1b2c.js";import{A as Vo,At as rn,B as Cr,C as gi,Ct as Yn,D as yl,Dt as El,E as Tr,Et as _l,F as Ar,Ft as Se,G as Ot,H as Ht,I as wl,It as Sl,J as Il,K as Cl,L as qo,Lt as Tl,M as Al,Mt as Rl,N as Pl,Nt as nt,O as Dl,Ot as pe,P as Ol,Pt as F,Q as xt,R as xl,Rt as ie,S as Ml,St as kl,T as Ll,Tt as vi,U as Nl,V as Fl,W as jl,X as Rr,Y as Xe,Z as bi,_ as Pr,_t as j,a as Bl,at as U,b as Ce,bt as Ze,c as zo,ct as Dr,d as $,dt as Te,et as Wo,f as Ul,ft as Hl,g as $l,gt as Gl,h as Vl,ht as ql,i as zl,it as oe,j as Wl,jt as Y,k as Kl,kt as Or,l as Yl,lt as se,m as Xl,mt as yi,n as Jl,nt as Ko,o as Ql,ot as Ae,p as Mt,pt as Zl,q as ec,r as tc,rt as Yo,s as ot,st as hn,t as he,tt as xe,u as nc,ut as xr,v as rc,vt as kt,w as ic,wt as oc,x as sc,xt as Me,y as Mr,yt as ue,z as Xo}from"./static/esm/668ee399.js";import{t as ac}from"./static/esm/f76c9d9d.js";(function(){"use strict";var e=window.__useblocks__=window.__useblocks__||{};e.__facadeSentinel="@shared-runtime:init-complete",e.publicPath||(e.publicPath=(function(){var m=(function(){if(typeof document<"u"&&document.querySelector)try{var D=document.querySelector('script[src*="useblocks-esm.js"]')||document.querySelector('script[src*="useblocks.js"]');if(D&&D.src)return D.src.substring(0,D.src.lastIndexOf("/")+1)}catch{}try{var L=import.meta.url;if(L)return L.substring(0,L.lastIndexOf("/")+1)}catch{}return"./"})();m||(m="./");try{var l=String(m);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(l)||l.indexOf("//")===0)return l.charAt(l.length-1)==="/"?l:l+"/";var u=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",p=u?new URL(l,u).href:l;return p.charAt(p.length-1)==="/"?p:p+"/"}catch{var R=String(m);return R.charAt(R.length-1)==="/"?R:R+"/"}})()),typeof e.setPublicPath!="function"&&(e.setPublicPath=function(m){return e.publicPath=(function(){var l=m==null?"":String(m);l||(l="./");try{var u=String(l);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(u)||u.indexOf("//")===0)return u.charAt(u.length-1)==="/"?u:u+"/";var p=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",R=p?new URL(u,p).href:u;return R.charAt(R.length-1)==="/"?R:R+"/"}catch{var D=String(l);return D.charAt(D.length-1)==="/"?D:D+"/"}})(),e.publicPath}),e.__publicPathDiagnosticsLogged||(e.__publicPathDiagnosticsLogged=!0,(function(){var m=String(e.publicPath||"");if(m.indexOf("file:")!==0&&!(m&&m!=="./")){var l="";try{if(typeof window<"u"){for(var u in window)if(!(u==="__useblocks__"||!/^__[^_].*__$/.test(u))){var p;try{p=window[u]}catch{continue}if(p&&typeof p=="object"&&p.publicPath){l=" Another product namespace ("+u+") has publicPath set — verify the host bundler plugin matches the installed npm brand.";break}}}}catch{}}})()),e.assetUrl||(e.assetUrl=function(m){function l(I){try{var O=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"";return O?new URL(String(I||""),O).href:String(I||"")}catch{return String(I||"")}}var u=String(m||"");if(!u)return"";if(/^(?:data:|blob:)/.test(u))return u;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(u)||u.indexOf("//")===0||u.charAt(0)==="/")return l(u);var p=u.replace(/^\.\/+/,"").replace(/^\/+/,""),R="static/media".replace(/^\.\/+/,"").replace(/^\/+/,"").replace(/\/+$/,""),D=R&&p.indexOf(R+"/")!==0?R+"/"+p:p,L=e.publicPath||"./";try{return new URL(D,L).href}catch{return L.slice(-1)!=="/"&&(L+="/"),l(L+D)}}),e.version||(e.version="1.1.
|
|
1
|
+
import{n as Go,r as bl}from"./static/esm/971f1b2c.js";import{A as Vo,At as rn,B as Cr,C as gi,Ct as Yn,D as yl,Dt as El,E as Tr,Et as _l,F as Ar,Ft as Se,G as Ot,H as Ht,I as wl,It as Sl,J as Il,K as Cl,L as qo,Lt as Tl,M as Al,Mt as Rl,N as Pl,Nt as nt,O as Dl,Ot as pe,P as Ol,Pt as F,Q as xt,R as xl,Rt as ie,S as Ml,St as kl,T as Ll,Tt as vi,U as Nl,V as Fl,W as jl,X as Rr,Y as Xe,Z as bi,_ as Pr,_t as j,a as Bl,at as U,b as Ce,bt as Ze,c as zo,ct as Dr,d as $,dt as Te,et as Wo,f as Ul,ft as Hl,g as $l,gt as Gl,h as Vl,ht as ql,i as zl,it as oe,j as Wl,jt as Y,k as Kl,kt as Or,l as Yl,lt as se,m as Xl,mt as yi,n as Jl,nt as Ko,o as Ql,ot as Ae,p as Mt,pt as Zl,q as ec,r as tc,rt as Yo,s as ot,st as hn,t as he,tt as xe,u as nc,ut as xr,v as rc,vt as kt,w as ic,wt as oc,x as sc,xt as Me,y as Mr,yt as ue,z as Xo}from"./static/esm/668ee399.js";import{t as ac}from"./static/esm/f76c9d9d.js";(function(){"use strict";var e=window.__useblocks__=window.__useblocks__||{};e.__facadeSentinel="@shared-runtime:init-complete",e.publicPath||(e.publicPath=(function(){var m=(function(){if(typeof document<"u"&&document.querySelector)try{var D=document.querySelector('script[src*="useblocks-esm.js"]')||document.querySelector('script[src*="useblocks.js"]');if(D&&D.src)return D.src.substring(0,D.src.lastIndexOf("/")+1)}catch{}try{var L=import.meta.url;if(L)return L.substring(0,L.lastIndexOf("/")+1)}catch{}return"./"})();m||(m="./");try{var l=String(m);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(l)||l.indexOf("//")===0)return l.charAt(l.length-1)==="/"?l:l+"/";var u=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",p=u?new URL(l,u).href:l;return p.charAt(p.length-1)==="/"?p:p+"/"}catch{var R=String(m);return R.charAt(R.length-1)==="/"?R:R+"/"}})()),typeof e.setPublicPath!="function"&&(e.setPublicPath=function(m){return e.publicPath=(function(){var l=m==null?"":String(m);l||(l="./");try{var u=String(l);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(u)||u.indexOf("//")===0)return u.charAt(u.length-1)==="/"?u:u+"/";var p=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",R=p?new URL(u,p).href:u;return R.charAt(R.length-1)==="/"?R:R+"/"}catch{var D=String(l);return D.charAt(D.length-1)==="/"?D:D+"/"}})(),e.publicPath}),e.__publicPathDiagnosticsLogged||(e.__publicPathDiagnosticsLogged=!0,(function(){var m=String(e.publicPath||"");if(m.indexOf("file:")!==0&&!(m&&m!=="./")){var l="";try{if(typeof window<"u"){for(var u in window)if(!(u==="__useblocks__"||!/^__[^_].*__$/.test(u))){var p;try{p=window[u]}catch{continue}if(p&&typeof p=="object"&&p.publicPath){l=" Another product namespace ("+u+") has publicPath set — verify the host bundler plugin matches the installed npm brand.";break}}}}catch{}}})()),e.assetUrl||(e.assetUrl=function(m){function l(I){try{var O=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"";return O?new URL(String(I||""),O).href:String(I||"")}catch{return String(I||"")}}var u=String(m||"");if(!u)return"";if(/^(?:data:|blob:)/.test(u))return u;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(u)||u.indexOf("//")===0||u.charAt(0)==="/")return l(u);var p=u.replace(/^\.\/+/,"").replace(/^\/+/,""),R="static/media".replace(/^\.\/+/,"").replace(/^\/+/,"").replace(/\/+$/,""),D=R&&p.indexOf(R+"/")!==0?R+"/"+p:p,L=e.publicPath||"./";try{return new URL(D,L).href}catch{return L.slice(-1)!=="/"&&(L+="/"),l(L+D)}}),e.version||(e.version="1.1.103");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,13 +993,13 @@ import{n as Go,r as bl}from"./static/esm/971f1b2c.js";import{A as Vo,At as rn,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.
|
|
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.b65837b7.js",po:"useblocks-po.b65837b7.js",monaco:"static/monaco/index.CO7s5UdA.js"}})}e.define("__delivery__/libs",[],function(){return import("./static/esm/delivery-libs.js")});var i=function(m){var l,u=function(){return l||(l=Promise.resolve().then(m))};return{then:function(p,R){return u().then(p,R)},catch:function(p){return u().catch(p)},finally:function(p){return u().finally(p)}}},o=i(function(){return e.require(["__delivery__/libs"]).then(function(m){return m[0]})});t.React=i(function(){return o.then(function(m){return m.React})}),t.ReactDom=i(function(){return o.then(function(m){return m.ReactDom})}),t.ReactDomClient=i(function(){return o.then(function(m){return m.ReactDomClient})}),t.ReactJsxRuntime=i(function(){return o.then(function(m){return m.ReactJsxRuntime})}),t.ReactJsxDevRuntime=i(function(){return o.then(function(m){return m.ReactJsxDevRuntime})}),t.AntDesignIconBase=i(function(){return o.then(function(m){return m.AntDesignIconBase})}),t.AntDesignCssinjs=i(function(){return o.then(function(m){return m.AntDesignCssinjs})}),t.Classnames=i(function(){return o.then(function(m){return m.Classnames})}),t.Dayjs=i(function(){return o.then(function(m){return m.Dayjs})});var s=i(function(){return Promise.all([o]).then(function(m){var l=m[0]||Object.create(null),u=Object.create(null);for(var p in l)Object.prototype.hasOwnProperty.call(l,p)&&(u[p]=l[p]);for(var R in u)Object.prototype.hasOwnProperty.call(u,R)&&(t[R]=u[R]);return u})}),a={Uuid:"the shared `uuid` package was removed from the editor runtime; bundle `uuid` into the plugin or use `crypto.randomUUID()`"},c=["then","toString","valueOf","constructor","inspect","$$typeof"];for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&t[d]===void 0&&(t[d]=(function(m,l){return new Proxy(Object.create(null),{get:function(u,p){if(!(typeof p=="symbol"||c.indexOf(p)!==-1))throw new Error("[shared-runtime] "+m+"."+String(p)+" is not available: "+l+".")}})})(d,a[d]));var f={},h={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.",UiKit:"[runtime] `useblocks-ui-kit` 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.",UiKitIcons:"[runtime] `useblocks-ui-kit/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."},y={Antd:"[runtime] `antd` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version.",AntDesignIcons:"[runtime] `@ant-design/icons` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version.",UiKit:"[runtime] `useblocks-ui-kit` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version.",UiKitIcons:"[runtime] `useblocks-ui-kit/icons` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version."},b=Object.create(null),T=function(m){for(var l=String(m&&m.stack||"").split(`
|
|
997
997
|
`),u="",p=0;p<l.length;p+=1){var R=/((?:https?|file|blob):\/\/[^\s()]+?)(?::\d+){1,2}\)?\s*$/.exec(l[p]);if(R){if(!u){u=R[1];continue}if(R[1]!==u)return R[1]}}return""},w=function(m){var l=T(new Error(m)),u=l?m+" Requested by: "+l+".":m;return e.__compatMissingReason=u,u};if(e.registerCompat=function(m){if(!(!m||typeof m!="object"))for(var l in m)Object.prototype.hasOwnProperty.call(m,l)&&(b[l]=m[l])},e.__compatPending){for(var g=0;g<e.__compatPending.length;g+=1)e.registerCompat(e.__compatPending[g]);e.__compatPending=void 0}for(var C in h)Object.prototype.hasOwnProperty.call(h,C)&&(function(m,l,u){var p=!1,R=function(){if(!(m in b))throw new Error(w(l));return b[m]};Object.defineProperty(t,m,{configurable:!0,enumerable:!0,get:function(){var D=R();return p||(p=!0),D},set:function(D){b[m]=D}}),Object.defineProperty(f,m,{configurable:!0,enumerable:!0,get:R,set:function(D){b[m]=D}})})(C,h[C],y[C]);var _=t;for(var P in f)Object.prototype.hasOwnProperty.call(f,P)&&(_===t&&(_=Object.create(t)),Object.defineProperty(_,P,Object.getOwnPropertyDescriptor(f,P)));var S=s,M=[],v=function(){for(var m=[],l=0;l<M.length;l+=1)(function(u){var p=t[u];p&&typeof p.then=="function"&&m.push(Promise.resolve(p).then(function(R){t[u]=R}))})(M[l]);return Promise.all(m)},E=typeof e.prefetch=="function"?e.prefetch:void 0;if(e.prefetch=function(){return s.then(v).then(function(){if(typeof E=="function")return E.call(e)})},typeof e.define=="function"){let m=function(l){if(!l||typeof l!="object"&&typeof l!="function"||l.__esModule)return l;if(A){var u=A.get(l);if(u)return u}var p=Object.create(null);Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});for(var R=Reflect.ownKeys(l),D=0;D<R.length;D++){var L=R[D];if(L!=="__esModule"){var I=Object.getOwnPropertyDescriptor(l,L);I&&Object.defineProperty(p,L,I)}}return Object.prototype.hasOwnProperty.call(p,"default")||Object.defineProperty(p,"default",{enumerable:!0,value:l,writable:!1}),A&&A.set(l,p),p};var A=typeof WeakMap<"u"?new WeakMap:null;e.define("react",[],function(){var l=_.React;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.React)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.React;return m(p)})}),e.define("useblocks/runtime/react",[],function(){var l=_.React;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.React)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.React;return m(p)})}),e.define("react-dom",[],function(){var l=_.ReactDom;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.ReactDom)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.ReactDom;return m(p)})}),e.define("useblocks/runtime/react-dom",[],function(){var l=_.ReactDom;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.ReactDom)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.ReactDom;return m(p)})}),e.define("react-dom/client",[],function(){var l=_.ReactDomClient;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.ReactDomClient)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.ReactDomClient;return m(p)})}),e.define("useblocks/runtime/react-dom/client",[],function(){var l=_.ReactDomClient;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.ReactDomClient)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.ReactDomClient;return m(p)})}),e.define("react/jsx-runtime",[],function(){var l=_.ReactJsxRuntime;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.ReactJsxRuntime)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.ReactJsxRuntime;return m(p)})}),e.define("useblocks/runtime/react/jsx-runtime",[],function(){var l=_.ReactJsxRuntime;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.ReactJsxRuntime)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.ReactJsxRuntime;return m(p)})}),e.define("react/jsx-dev-runtime",[],function(){var l=_.ReactJsxDevRuntime;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.ReactJsxDevRuntime)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.ReactJsxDevRuntime;return m(p)})}),e.define("useblocks/runtime/react/jsx-dev-runtime",[],function(){var l=_.ReactJsxDevRuntime;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.ReactJsxDevRuntime)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.ReactJsxDevRuntime;return m(p)})}),e.define("antd",[],function(){var l=_.Antd;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.Antd)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.Antd;return m(p)})}),e.define("useblocks/runtime/antd",[],function(){var l=_.Antd;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.Antd)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.Antd;return m(p)})}),e.define("@ant-design/icons/es/components/AntdIcon",[],function(){var l=_.AntDesignIconBase;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.AntDesignIconBase)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.AntDesignIconBase;return m(p)})}),e.define("useblocks/runtime/@ant-design/icons/es/components/AntdIcon",[],function(){var l=_.AntDesignIconBase;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.AntDesignIconBase)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.AntDesignIconBase;return m(p)})}),e.define("@ant-design/icons",[],function(){var l=_.AntDesignIcons;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.AntDesignIcons)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.AntDesignIcons;return m(p)})}),e.define("useblocks/runtime/@ant-design/icons",[],function(){var l=_.AntDesignIcons;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.AntDesignIcons)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.AntDesignIcons;return m(p)})}),e.define("@ant-design/cssinjs",[],function(){var l=_.AntDesignCssinjs;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.AntDesignCssinjs)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.AntDesignCssinjs;return m(p)})}),e.define("useblocks/runtime/@ant-design/cssinjs",[],function(){var l=_.AntDesignCssinjs;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.AntDesignCssinjs)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.AntDesignCssinjs;return m(p)})}),e.define("classnames",[],function(){var l=_.Classnames;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.Classnames)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.Classnames;return m(p)})}),e.define("useblocks/runtime/classnames",[],function(){var l=_.Classnames;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.Classnames)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.Classnames;return m(p)})}),e.define("dayjs",[],function(){var l=_.Dayjs;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.Dayjs)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.Dayjs;return m(p)})}),e.define("useblocks/runtime/dayjs",[],function(){var l=_.Dayjs;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.Dayjs)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.Dayjs;return m(p)})}),e.define("useblocks-ui-kit",[],function(){var l=_.UiKit;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.UiKit)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.UiKit;return m(p)})}),e.define("useblocks/ui-kit",[],function(){var l=_.UiKit;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.UiKit)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.UiKit;return m(p)})}),e.define("useblocks/ui-kit/icons",[],function(){var l=_.UiKitIcons;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.UiKitIcons)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.UiKitIcons;return m(p)})}),e.define("useblocks-ui-kit/icons",[],function(){var l=_.UiKitIcons;return l&&typeof l.then=="function"?l.then(function(u){return u===void 0?S.then(function(p){return m(p.UiKitIcons)}):m(u)}):l!==void 0?m(l):S.then(function(u){var p=u.UiKitIcons;return m(p)})})}globalThis.__SHARED_RUNTIME_INIT_SENTINEL__="@shared-runtime:init-complete"})();var lc=new Function("url","return import(url)");function cc(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function kr(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Jo(e){return e.type==="umd"||e.resolve==="registry"}var dc="If the plugin is built on globals, enable the compatibility layer: the `compatGlobals` option of the bundler plugin or `import '<package>/compat-globals'` before creating the editor.";function uc(e){const t=Array.isArray(e)?e[0]:e;return kr(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function fc(e,t){const n=uc(e),r=kr(e)?e:void 0,i=t instanceof Error?t.message:String(t),o=r&&Jo(r)&&!/compat/iu.test(i)?` ${dc}`:"",s=new Error(`Plugin "${n}" was skipped: it failed to load. ${i}${o}`);return s.cause=t,{name:n,url:r?.url,error:s}}function pc(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}var hc=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(kr(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(Jo(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await lc(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,this._options.explainScriptFailure?.();let i;const o=a=>{i||(a.filename===r.src?i=this._scriptExecutionError(e,a.error??a.message):pc(a)&&(i=this._scriptExecutionError(e,this._options.explainScriptFailure?.()??a.message)))},s=()=>window.removeEventListener("error",o);window.addEventListener("error",o),r.onload=()=>{if(s(),i){n(i);return}t()},r.onerror=()=>{s(),n(new Error(`Failed to load script: ${e}`))},document.head.appendChild(r)})}_scriptExecutionError(e,t){const n=t instanceof Error?t.message:String(t),r=new Error(`Plugin script "${e}" threw while executing: ${n}`);return r.cause=t,r}initSync(e){const t=[];for(const n of e){const r=this._createOrSkip(n,void 0);r&&t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const i=await this._resolveOrSkip(r);if(!i)continue;const o=this._createOrSkip(i.ctor,i.options);o&&!n.has(o)&&(n.add(o),t.push(o))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const s of e){const a=await this._resolveOrSkip(s);a&&(t.add(a.ctor),n.push(a))}const r=[];this._map.forEach((s,a)=>{t.has(a)||r.push({key:a,plugin:s})});for(let s=r.length-1;s>=0;s--){const{key:a,plugin:c}=r[s];await this._initializingPlugins.get(c),await this._disposePlugin(c,c.constructor.name),this._map.delete(a),this._optionsMap.delete(a),this._readyMap.delete(c),this._resolveMap.delete(c),this._initializingPlugins.delete(c),this._initializedPlugins.delete(c);const d=this._creationOrder.indexOf(c);d>=0&&this._creationOrder.splice(d,1)}const i=[],o=new Set;for(const{ctor:s,options:a}of n){const c=this._createOrSkip(s,a);c&&!o.has(c)&&(o.add(c),i.push(c))}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 a=()=>{s||(s=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,a),r())};this._pluginRegistry.on(e,a),n!==void 0&&n>0&&(o=setTimeout(()=>{s||(s=!0,this._pluginRegistry.off(e,a),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)}async _resolveOrSkip(e){try{return await this._resolveEntry(e)}catch(t){const n=fc(e,t);try{this._options.reportLoadFailure?.(n)}catch{}return}}_createOrSkip(e,t){try{return this._getOrCreate(e,t)}catch(n){const r=e.name||"anonymous plugin";this._emitLifecycle({type:"create:error",ctor:e,name:r,error:n});return}}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);const r=this._options.openEarlyWindow?.();try{return cc(e)?new e(this._context,t):e(this._context,t)||{}}finally{r?.(),this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const 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});const i=this._options.openEarlyWindow?.();try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(o){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:o})}finally{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)}))}},mc=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)}}}},gc=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()}},Ei=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 vc(e,t){return t+e}function bc(){return typeof performance>"u"?Date.now():vc(performance.now(),performance.timeOrigin)}var yc="emailmaker:diagnostics",Ec="diagnostics",_c="diagnostics";function _i(e,t){return t?`${e}${e.includes("?")?"&":"?"}${_c}=1`:e}var _n;function wc(){try{const e=new URLSearchParams(window.location.search).get(Ec);return e===null?void 0:e!=="0"}catch{return}}function Sc(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function Ic(){try{const e=window.localStorage.getItem(yc);return e===null?void 0:e==="1"}catch{return}}function wt(){return _n===void 0&&(_n=typeof window>"u"?!1:wc()??Sc()??Ic()??!1),_n}function Cc(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var le={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"},RE=Object.values(le),PE=[le.canvasPainted,le.canvasSettled,le.appVisible,le.editorVisible],Tc=5e3,Ac=3e3,wi="diagnosticsStore",$t,at;function Si(){return{marks:new Ei(Tc),resources:new Ei(Ac)}}function Qo(){if(at)return at;const e=Lr();return e?(at=e[wi]??$t??Si(),e[wi]=at,$t=void 0,at):($t??=Si(),$t)}function Z(e,t){wt()&&Qo().marks.push({phase:e,at:bc(),...t})}function Lr(){if(typeof window.__useblocks__<"u"&&window.__useblocks__)return window.__useblocks__;if(typeof window>"u")return;const e=window[Cc()];return e!==null&&typeof e=="object"?e:void 0}function Rc(e){const t=e.length,n=Qo();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function Pc(){const e=Lr();return!e||!Array.isArray(e.diagnosticsBuffer)?0:Rc(e.diagnosticsBuffer)}var Dc="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function Oe(){const e=new Error(Dc);return e.name="DestroyedInstanceError",e}function Oc(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function Xn(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((a,c)=>Xn(a,s[c]))}const r=Object.keys(e),i=Object.keys(t);return r.length!==i.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Xn(e[o],t[o]))}function Zo(e,t){const n={watch(r){let i,o=!1;return e.watch(s=>{const a=t(s);o&&Xn(i,a)||(i=a,o=!0,r(a))})},select(r){return Zo(n,r)}};return n}function Ee(...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 Zo(i,o)}};return i}var xc=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:xl.UrlEncoded,...t})},es=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 Mc(e){return String(e||"").trim()||void 0}var kc=class extends ie{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=Mc(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)}},Nr=F("AppInitService");function Lc(e){return async()=>{const t=await e();return(await new xc(t).app_init_create({})).data}}function Nc(e){e.injectFactory(Nr,(t,n)=>{if(n)return n;const r=new kc({options:e.getInstance(se),isStandalone:()=>!!e.getInstance(Te),resolveRestBaseUrl:i=>i?gi(i):gi()||void 0,setRestBaseUrl:i=>{e.getInstance(sc)?.setOptions(i?{baseUrl:i}:{})},fallbackAppInit:Lc(()=>e.getInstanceAsync(wl)),publish:i=>{e.inject(xe,i)}});return e.getInstance(U)?.addDisposable(r),r},!0)}var Fr=F("documentSession.emailDocuments");function Je(e){return e?.getInstance(Fr)}var Fc=F("RevisionServiceFlag");function ts(e){return e.getOrCreateInstance(Fc,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function ns(e){return ts(e).isEnabled()}var jc=F("EmailRightsResolver");function Bc(e,t){const n=e.getInstance(jc);return n?n(t):!0}var rs=F("EmailHistoryAvailabilityResolver");function Uc(e){return e.getInstance(rs)!==void 0}async function Hc(e){const t=e.getInstance(rs);if(!t)return!0;try{return await t()}catch{return!1}}var jr={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},is=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],os=2e4,$c=is.reduce((e,t)=>e+jr[t],0),ss=os+$c+3e3;function Gc(e){return is.reduce((t,n)=>t+as(n,e),0)}function as(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:jr[e]}function ls(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:ss}function cs(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:os}function Br(e=ss){return e+3e3}function ds(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}var Vc=()=>Br();function qc(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function zc(e){return t=>qc(e.getOrCreateInstance(j.BEFORE_SAVE_EMAIL,()=>new Me).fire(t),Vc())}function Wc(e){return e!=null&&e!==""}var us;function St(e,t){return us?.capture(e,t)}function Kc(e,t){return us?.captureMessage(e,t)}function Yc(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function Gt(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var ge=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} "${Gt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${Gt(this.oldText)}")`:`(replace@${this.oldPosition} "${Gt(this.oldText)}" with "${Gt(this.newText)}")`}};function Ii(e,t){return e===null||e.length===0?t:new Xc(e,t).compress()}var Xc=class _e{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,n){this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),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[c,d]=_e._splitCurr(i,r.newPosition-i.oldPosition);this._acceptCurr(c),i=d;continue}if(r.newPosition<i.oldPosition){const[c,d]=_e._splitPrev(r,i.oldPosition-r.newPosition);this._acceptPrev(c),r=d;continue}let s,a;if(i.oldEnd===r.newEnd)s=r,a=i,r=this._getPrev(++t),i=this._getCurr(++n);else if(i.oldEnd<r.newEnd){const[c,d]=_e._splitPrev(r,i.oldLength);s=c,a=i,r=d,i=this._getCurr(++n)}else{const[c,d]=_e._splitCurr(i,r.newLength);s=r,a=c,r=this._getPrev(++t),i=d}this._result[this._resultLen++]=new ge(s.oldPosition,s.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const o=_e._merge(this._result);return _e._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=_e._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=_e._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new ge(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new ge(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 ge(t.oldPosition,t.oldText,t.newPosition,r),new ge(t.oldEnd,"",t.newPosition+n,i)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),i=t.oldText.substr(n);return[new ge(t.oldPosition,r,t.newPosition,t.newText),new ge(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 ge(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 Jc(e){return new ge(e.newPosition,e.newText,e.oldPosition,e.oldText)}function Qc(e){return e.map(Jc)}function Ci(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function Zc(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 ed(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 a=o.oldPosition;if(i&&a===e.start)r+=n==="after"?s:0;else{if(e.start<a&&a<e.end)return null;a<=e.start&&(r+=s)}continue}if(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 It=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},Ti=0,td=Math.random().toString(36).slice(2,8);function nd(){return Ti+=1,`doc-${td}-${Ti}`}function rd(e){const t=e.createBuffer(),n=e.docId??nd();let r=e.serverId??null,i=0,o=null,s=e.attributes??{};const a=new Set;let c=!1,d=!1,f;const h=new Set;let y=null;const b=()=>(y?.version!==i&&(y={version:i,value:t.read()}),y.value),T=w=>Object.entries(w).some(([g,C])=>s[g]!==C);return{get:()=>({docId:n,serverId:r,version:i,savedVersion:o,attributes:s}),getContent:b,mutate(w,{source:g}){if(c)return i;const C=w.changes?.length?w.changes:void 0,_=C?Zc(b(),C):w.content!==void 0?w.content:void 0,P=_!==void 0&&_!==b(),S=w.attributes!==void 0&&T(w.attributes);if(!P&&!S)return i;const M=!(i>(o??-1)),v=S?Object.keys(w.attributes).filter(A=>s[A]!==w.attributes[A]):[];P&&t.write(_),S&&(s={...s,...w.attributes}),i+=1,g!=="user"&&M&&(o=i);const E={source:g,version:i,changes:C,...P?{content:!0}:{},...v.length>0?{attributes:v}:{}};return a.forEach(A=>A(E)),i},markSaved(w,g){const C={serverId:r,savedVersion:o};g!==void 0&&(r=g),(o===null||w>o)&&(o=w),(C.serverId!==r||C.savedVersion!==o)&&a.forEach(_=>_({source:"system",version:i}))},markUnsaved(){c||o===null||o<i||(o=i-1,a.forEach(w=>w({source:"system",version:i})))},markReady(){d||f!==void 0||(d=!0,h.forEach(w=>w.resolve()),h.clear(),a.forEach(w=>w({source:"system",version:i})))},isReady:()=>d,markFailed(w){d||f!==void 0||c||(f=w,h.forEach(g=>g.reject(new It(w))),h.clear(),a.forEach(g=>g({source:"system",version:i})))},failure:()=>f,whenReady(){return d?Promise.resolve():f!==void 0?Promise.reject(new It(f)):c?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((w,g)=>{h.add({resolve:w,reject:g})})},subscribe(w){return a.add(w),()=>a.delete(w)},isNew:()=>r===null,isDirty:()=>i>(o??-1),isDisposed:()=>c,dispose(){c=!0,h.forEach(w=>w.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),h.clear(),a.clear(),t.dispose()}}}var id=500,od=100,wn=0;function sd(e,t={}){const n=t.groupIntervalMs??id,r=t.maxSteps??od,i=t.now??(()=>0);let o=[],s=0,a=wn+=1,c=null,d=!1,f=!1,h=!1;const y=new Set,b=()=>y.forEach(v=>v()),T=(v,E)=>{if(v.length){f=!0;try{e.mutate({changes:v},{source:E})}finally{f=!1}}},w=v=>T(v,"user"),g=v=>{const E=i();d&&c!==null&&E-c<n?o[s-1]=Ii(o[s-1],v):(o=o.slice(0,s),o.push(v),s=o.length,d=!0,o.length>r&&(o=o.slice(o.length-r),s=o.length,a=wn+=1)),c=E,b()},C=()=>{d=!1,c=null},_=v=>{if(!v.length)return;const E=o.length>s;E&&(o=o.slice(0,s)),s>0&&(o[s-1]=Ii(o[s-1],v)),C(),E&&b()},P=e.subscribe(({source:v,changes:E})=>{if(!(h||f||!E?.length)){if(v==="remote"){S();return}if(v!=="user"){_(E);return}g(E)}}),S=()=>{o=[],s=0,C(),a=wn+=1,b()},M=()=>{if(s===0)return!1;const v=Qc(o[s-1]);return Ci(e.getContent(),v)?(w(v),s-=1,C(),!0):(o=o.slice(0,s-1),s=o.length,C(),b(),!1)};return{canUndo:()=>s>0,canRedo:()=>s<o.length,undo(){M()&&b()},redo(){if(!(s>=o.length)){if(!Ci(e.getContent(),o[s])){o=o.slice(0,s),C(),b();return}w(o[s]),s+=1,C(),b()}},clear:S,applyWithoutHistory(v){const E=e.get().version;if(T(v,"system"),e.get().version===E){C();return}_(v)},getPast:v=>o.slice(0,s).reverse().slice(0,v),getFuture:v=>o.slice(s).reverse().slice(0,v),createSnapshot:()=>({stackId:a,index:s}),restoreSnapshot(v){if(v.stackId!==a||v.index>s)return!1;for(;s>v.index;)if(!M())return b(),!1;return b(),!0},subscribe(v){return y.add(v),()=>y.delete(v)},dispose(){h=!0,P(),y.clear(),o=[],s=0}}}var ad=["edit","move","resize","insert"];function Sn(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function ld(e){return typeof e=="string"?e:null}function cd(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function dd(e){return ad.includes(e)?e:null}function ud(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:ld(t.originId),changeId:Sn(t.changeId),rev:Sn(t.rev),baseRev:Sn(t.baseRev),expected:cd(t.expected),intent:dd(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var vt=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},fs=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleEmailAutosave did not respond within ${e}ms — the autosave was not written`),this.timeoutMs=e,this.name="IntegratorAutosaveTimeoutError"}},Ur=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleSaveEmail did not respond within ${e}ms — the email was not saved`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}};function fd(){return typeof navigator<"u"&&navigator.onLine===!1}function pd(e){if(e==null)return[];const t=[e];if(typeof e!="object")return t;const n=e;if(n.error!=null&&(t.push(n.error),typeof n.error=="object")){const r=n.error;r.data!=null&&t.push(r.data),r.error!=null&&t.push(r.error)}if(n.data!=null&&(t.push(n.data),typeof n.data=="object")){const r=n.data;r.error!=null&&t.push(r.error)}return n.innerException!=null&&t.push(n.innerException),t}function ps(e){if(!e)return!1;if(typeof e=="string"){const n=e.toLowerCase();return n.includes("fetch")||n.includes("network")||n.includes("timeout")||n.includes("failed to fetch")||n.includes("load failed")||n.includes("networkerror")}if(e instanceof Error)return ps(e.message);if(typeof e!="object")return!1;const t=e;return t.status==="FETCH_ERROR"||t.status==="TIMEOUT_ERROR"||t.status==="PARSING_ERROR"?!0:typeof t.status=="number"?t.status===0||t.status===408||t.status>=500:!1}function hd(e){return fd()?!0:pd(e).some(ps)}var hs=new WeakSet,ms=new WeakMap;function gs(e){typeof e=="object"&&e!==null&&hs.add(e)}function md(e,t){typeof e=="object"&&e!==null&&ms.set(e,t)}function gd(e){return typeof e=="object"&&e!==null?ms.get(e):void 0}function vd(e){return e instanceof Ur||e instanceof fs||typeof e=="object"&&e!==null&&hs.has(e)}function bd(e){return e instanceof vt||vd(e)}function yd(e){return!bd(e)&&hd(e)}var vs="draft";function Ke(e){return e==null||e===""?vs:String(e)}function Ed(e){return e==null||e===""?`${Jn}${vs}`:`${Jn}${String(e)}`}var Jn="block:";function ye(e){return e?.startsWith(Jn)===!0}function dt(e){return ye(e.sessionKey())?void 0:e.current()}function bt(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 Or(i)?(`${e}`,{...n}):(`${e}`,{error:ds(i),...n},void 0),i})}var _d=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function wd(e){const t=e?.trim()??"";if(!_d.test(t))return Date.parse(t);const n=t.replace(" ","T");return Math.max(Date.parse(n),Date.parse(`${n}Z`))}function yt(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function Hr(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function Sd(e,t={}){const n=yt((e??[]).filter(r=>r?.html?.trim()));return Hr(n,t)?n:null}function Id(e,t){const n=Date.parse(yt(e)?.modified??""),r=Sd(e),i=Date.parse(r?.modified??""),o=t===void 0||Number.isFinite(i)&&i>t,s=[n,t??NaN].filter(a=>Number.isFinite(a));return{autosave:o?r:null,...s.length?{latestAt:Math.max(...s)}:{}}}function Ai(e,t,n){const r=yt((e??[]).filter(c=>c?.html?.trim())),i=Date.parse(r?.modified??""),o=Date.parse(yt((n??[]).filter(c=>c?.html?.trim()))?.modified??""),s=r&&Number.isFinite(i)&&(t===void 0||i>t)&&!(o>i),a=[Date.parse(yt(e??[])?.modified??""),t??NaN].filter(c=>Number.isFinite(c));return{autosave:s&&Hr(r)?r:null,...a.length?{latestAt:Math.max(...a)}:{}}}function Cd({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var bs=e=>e.replace(/\r\n?/g,`
|
|
998
998
|
`),Ri=["recovery","plugin","rest"],Td=["subject","preheader"];function Ad(e){let t={},n;for(let i=Ri.length-1;i>=0;i--){const o=e.get(Ri[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 Td){const o=r?.[i];typeof o=="string"&&o!==""&&(t={...t,[i]:o})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function $r(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?bs(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 ge(0,n,0,r)]}:{}},{source:"remote"})}var In=e=>typeof e=="string"?e.trim():"";function Rd(e,t,n,r){const{version:i,attributes:o}=e.get(),s=o,a=r==="snapshot"||r==="anchor",c=a?s.author:void 0,d=a?s.date_gmt:void 0,f=In(s.title)||In(s.subject)||In(t.fallbackTitle);return{version:i,payload:{html:e.getContent(),title:f,subject:s.subject,preheader:s.preheader,description:s.description,common_styles:s.common_styles||"",meta:s.meta,utm_parameters:s.utm_parameters,parent_email:s.parent_email,is_template:s.is_template||!1,is_inited:s.is_inited,tags:s.tags,emailtags:s.emailtags,group:s.group,renderGuid:e.get().docId,project:t.project??s.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source,...c!=null&&c!==""?{author:c}:{},...d?{excerpt:d}:{}}}}var Pd=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function Dd(e){const t={};for(const n of Pd)e[n]!==void 0&&(t[n]=e[n]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function Od(e,t,n,r,i){if(n==="materialize"&&r!=null)throw new Error("Письмо уже создано на сервере");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 ke(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=ke(i)),n[r]=i)}return n}function xd(e){return typeof e=="string"&&e.includes("autosave")}var Md=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function ys(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!Md.has(t))):{}}function Ct(e,t,n={}){e&&e.mutate({attributes:kd(e.get().attributes,t)},{source:n.source??"user"})}function kd(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function Gr(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function Ld(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function Es(e){if(!e)return null;const t=ys(e);return e.common_styles!==void 0&&(t.common_styles=Ld(e.common_styles)),Gr(e.html,t)}function _s(e){return e?Gr(e.html,ke(ys(e))):null}var Nd=["common_styles","subject","preheader","meta"];function Pi(e){if(!e?.html?.trim())return null;const t={};for(const n of Nd)Fd(n,e[n])&&(t[n]=e[n]);return Gr(e.html,t)}function Fd(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 jd=["modified","lock"];function Bd(e){if(!e)return null;const t={};for(const n of jd)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var Ud=10,Hd=(e,t)=>e.key===t.key&&$d(e.serverId,t.serverId),$d=(e,t)=>e==null||e===t;function Gd(e){return typeof e?.then=="function"}var Di=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},ws=e=>{e.request.serverId!=null&&!Vr(e)&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent())},Vd=e=>e.document.get().serverId!=null&&!e.document.getContent().trim()&&!!(e.savedContent??e.lastMerged?.content??"").trim(),Vr=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),Oi=(e,t)=>t?.content!==void 0&&Cd({hasUnsavedUserEdit:Vr(e)})==="skip",qd=e=>e.document.subscribe(t=>{t.source==="user"&&(t.content&&e.userTouched.add("content"),t.attributes?.forEach(n=>e.userTouched.add(n))),e.document.isDirty()||e.userTouched.clear()}),zd=(e,t)=>{!e.ready||t.content===void 0||e.document.get().serverId==null||(e.contentShown=!0,!(![...e.userTouched].every(n=>n==="content"||n in(t.attributes??{}))||!e.document.isDirty())&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent(),e.userTouched.clear(),e.document.get().docId))},Wd=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([i,o])=>e.attributes[i]!==o)),r=t.content!==void 0&&t.content!==e.content?t.content:void 0;return r===void 0&&Object.keys(n).length===0?null:r===void 0?{attributes:n}:{content:r,attributes:n}},Kd=e=>{const t=Ad(e.reports),n=Wd(e.lastMerged,t);e.lastMerged=t,n&&($r(e.document,n),ws(e))},Cn=(e,t)=>{if(!e.ready&&!Vr(e)){Kd(e);return}$r(e.document,t)},Yd=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 Xd(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:i,resolveTerms:o,canEdit:s,notifyBeforeSave:a,onAdapterError:c,onTimeout:d}=e;let f;const h=new Set,y=new Set,b=()=>h.forEach(l=>l()),T=(l,u)=>{if(!(l.closed||l.ready)){if(l.error!==void 0){l.document.markFailed(l.error),l.document.get().docId;return}ws(l),l.ready=!0,l.document.markReady(),l.document.get().docId,[...l.reports.keys()]}},w=(l,u,p)=>{c?.(u.id,p),!(!u.required||l.closed)&&(l.error=p,l.document.get().docId,u.id,b())},g=(l,u)=>{const p=new Set(u.map(I=>I.id));u.forEach(I=>{I.watch&&l.watchers.push(I.watch(O=>l.closed?!1:l.ready&&(Oi(l,O)||l.contentShown===!0&&O?.content!==void 0)?(l.document.get().docId,I.id,!1):(O&&l.reports.set(I.id,O),Cn(l,O),!0)))});const R=(I,O)=>{if(!l.closed){if(!I.required&&Oi(l,O)){l.document.get().docId,I.id,I.loaded?.(!1);return}O&&l.reports.set(I.id,O),Cn(l,O),I.loaded?.(O!==null)}},D=()=>{p.size>0||l.closed||(Di(l),T(l,[]))},L=[];if(u.forEach(I=>{let O;try{O=I.load()}catch(k){w(l,I,k),p.delete(I.id);return}if(Gd(O)){L.push({id:I.id,required:I.required,load:()=>O,...I.loaded?{loaded:k=>I.loaded?.(k)}:{}});return}R(I,O),p.delete(I.id)}),L.length===0){D();return}l.timer=setTimeout(()=>{l.timer=void 0,d?.([...p]),l.document.get().docId,[...p],T(l,[...p])},n),l.timer.unref?.(),L.forEach(I=>{I.load().then(O=>R(I,O)).catch(O=>{w(l,I,O)}).finally(()=>{p.delete(I.id),D()})})},C=async(l,u,p)=>{if(p==="snapshot"||p==="anchor")return;const R=o?.();if(R)return R.resolve({project:u.project??l.project,tags:(l.tags??[]).map(D=>({name:D}))})},_=l=>{if(l.lock===!0&&s?.(l)===!1)return new vt("locked");const u=l.tags?.length??0,p=l.emailtags?.length??0;if(Math.max(u,p)>Ud)return new vt("too-many-tags")},P=(l,u)=>{const p=l.document.get().serverId;u||p==null||(l.recoveryFacts={emailId:p,historyLoaded:!0,isRecovering:!1},ye(l.request.key)||(l.request={...l.request,key:Ke(p),serverId:p}))},S=(l,u,p)=>{if(l.closed||p?.id==null)return;const R=l.document.get().serverId,D=R!=null;D&&R!==String(p.id)||(l.document.markSaved(u,String(p.id)),P(l,D),l.document.get().serverId,b())},M=async(l,u,p)=>{try{await l.document.whenReady()}catch(O){return l.saveError=O,l.saveFailures+=1,l.failedIntent=u,l.saveFailures,!1}if(l.closed)return!1;const R=_(l.document.get().attributes);if(R)return l.saveError=R,l.saveFailures+=1,l.failedIntent=u,R.reason,b(),!1;if(a&&(await a(Yd(l)).catch(()=>{}),l.closed))return!1;if(Vd(l))return u==="snapshot"||(l.saveError=new vt("empty-content"),l.saveFailures+=1,l.failedIntent=u,b()),!1;let D;try{D=await C(l.document.get().attributes,p,u)}catch(O){return l.saveError=O,l.saveFailures+=1,l.failedIntent=u,l.saveFailures,b(),!1}if(l.closed)return!1;const{payload:L,version:I}=Rd(l.document,p,D,u);l.document.get().docId;try{const O=l.document.get().serverId!=null,k=await Od(r(),i(l.request.key),u,l.document.get().serverId,L);if(l.closed)return!0;let ee;if(u==="snapshot"||u==="anchor"){const X=k?.modified!=null?Date.parse(k.modified):NaN;ee=Number.isFinite(X)?X:Date.now(),l.snapshotVersion=I,l.lastRevisionAt=ee}else l.document.markSaved(I,k?.id!=null?String(k.id):void 0),l.savedContent=L.html;P(l,O),l.saveError=void 0,l.saveFailures=0,l.failedIntent=void 0,l.document.get().serverId,b();const ce={intent:u,serverId:l.document.get().serverId,created:!O,...ee!==void 0?{revisionAt:ee}:{}};return y.forEach(X=>X(ce)),!0}catch(O){return(u==="publish"||u==="materialize")&&gd(O)?.then(k=>S(l,I,k)),l.saveError=O,l.saveFailures+=1,l.failedIntent=u,l.saveFailures,b(),!1}},v=()=>{f&&(f.closed=!0,f.watchers.forEach(l=>l()),f.watchers=[],Di(f),f.history.dispose(),f.document.dispose(),f=void 0)},E=(l,u,p)=>{let R=!1;u.show&&(l.show?.id!==u.show.id||l.show.token!==u.show.token)&&(l.show=u.show,R=!0,{docId:l.document.get().docId,...u.show});const D=p==="show"?_s(u.patch):null;D&&(l.reports.set("plugin",D),Cn(l,D),zd(l,D)),R&&b()},A=(l,u={})=>{const p=f;return!p||p.closed||l==="materialize"&&p.document.get().serverId!=null?Promise.resolve(!1):p.saving?l==="snapshot"||l==="materialize"?Promise.resolve(!1):(p.inFlight??Promise.resolve(!1)).then(()=>A(l,u)):(p.saving=!0,b(),p.inFlight=M(p,l,u).finally(()=>{p.saving=!1,p.inFlight=void 0,f===p&&!p.closed&&b()}),p.inFlight)},m=(l,u="open")=>{if(f&&!f.closed&&u!=="new"&&Hd(f.request,l))return E(f,l,u),f.document;v();const p=rd({createBuffer:()=>Yc(""),serverId:l.serverId??null}),R={request:l,show:l.show,document:p,history:sd(p,{now:Date.now}),watchers:[],userTouched:new Set,saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return f=R,R.watchers.push(qd(R)),p.get().docId,l.serverId,g(R,t(l,{publishRecoveryFacts(D){R.closed||(R.recoveryFacts=D,b())},readShownContent:()=>R.closed?null:R.document.getContent()})),b(),p};return{openWith:m,open:(l,u={})=>m({key:Ke(l),serverId:l,email:u.email,patch:u.patch,show:u.show},"open"),openDraft:(l,u={})=>m({key:Ke(void 0),serverId:null,email:l,patch:u.patch,show:u.show},"open"),startNewDraft:(l,u={})=>m({key:Ke(void 0),serverId:null,email:l,patch:u.patch,show:u.show},"new"),reload:(l,u={})=>m({key:Ke(l),serverId:l,email:u.email,patch:u.patch,show:u.show},"new"),openBlock:(l,u)=>m({key:ye(l)?l:Ed(l),serverId:u?.id!=null?String(u.id):null,email:u},"open"),show:(l,u)=>{const p=f;if(!(!p||p.closed))return m({...p.request,patch:l,show:u},"show")},current:()=>f?.document,noteServerFacts:({serverId:l,block:u},p)=>{const R=f;!R||R.closed||R.request.serverId!==l||ye(R.request.key??"")===u&&$r(R.document,Bd(p))},save:A,saveState:()=>({error:f?.saveError,failures:f?.saveFailures??0,saving:f?.saving===!0,failedIntent:f?.failedIntent}),revisionFacts(){if(!f)return;const l=f.revisionFactsSnapshot;return l&&l.snapshotVersion===f.snapshotVersion&&l.lastRevisionAt===f.lastRevisionAt?l:(f.revisionFactsSnapshot={snapshotVersion:f.snapshotVersion,lastRevisionAt:f.lastRevisionAt},f.revisionFactsSnapshot)},recoveryFacts:()=>f?.recoveryFacts,history:()=>f?.history,forcedHeaders:()=>f?.forcedHeaders,beginForcedHeaders(l){f&&!f.closed&&(f.forcedHeaders=l)},endForcedHeaders(){f&&(f.forcedHeaders=void 0)},onSaved(l){return y.add(l),()=>y.delete(l)},showFacts:()=>f?.show,sessionKey:()=>f?.request.key,openError:()=>f?.error,subscribe(l){return h.add(l),()=>h.delete(l)},close(){f&&(v(),b())}}}var qr=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function zr(e){if(e instanceof qr)return e.reason;if(e instanceof It)return zr(e.reason)}function Jd(e){const t=e instanceof It?e.reason:e;return t instanceof qr&&t.reason==="unavailable"&&t.cause instanceof TypeError}function Qd(e){const t=zr(e);return t==="forbidden"||t==="not-found"}function Zd(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new qr("not-found");return Es(n)}}}var Ss=F("EmailPort");function eu(e){return e.getInstance(Ss)}function tu(e,t){e.inject(Ss,t)}var Is=F("documentSession.restEmailPortFactories");function Cs(e){return e.getInstance(Is)!==void 0}function Ve(e){const t=e.getInstance(Is);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var nu=F("EmailTermsResolver");function ru(e){return e.getInstance(nu)}var Ts=F("EmailHistoryPort"),iu=F("BlockHistoryPort");function As(e){return e.getInstance(iu)}function Rs(e){return e.getInstance(Ts)}function ou(e,t){e.inject(Ts,t)}var su="em_autosave_pending";function on(e){return`${su}_${e}`}function au(e,t){try{sessionStorage.setItem(on(e),JSON.stringify(t))}catch{}}function Ps(e){try{const t=sessionStorage.getItem(on(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(on(e)),null):n}catch{return null}}function ut(e){try{sessionStorage.removeItem(on(e))}catch{}}var lu=2e3,cu=5e3,du=5,uu=5e3,fu=4;function pu(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function hu(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
999
999
|
`,`
|
|
1000
1000
|
`)===t.replaceAll(`\r
|
|
1001
1001
|
`,`
|
|
1002
|
-
`)}function Tn(e,t){return Hr(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function mu({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:i,onFacts:o,onLate:s,onError:a,pageLoadTs:c=pu()}){let d=null,f=!1,h=!1,y=0,b={emailId:e,historyLoaded:!1,isRecovering:!1},T=null;const w=new Promise(D=>{T=D}),g=D=>{b={...b,...D},o(b)};let C;const _=D=>{y+=1,g({applied:{phase:D,seq:y}})},P=()=>{d?.timer&&clearTimeout(d.timer),d=null},S=D=>{if(!h){if(T){const L=T;T=null,L(D),C=D.revision?D.phase:void 0;return}s(D)&&D.revision&&_(D.phase)}},M=()=>{if(!d||h)return;const D=d.phase==="fast",L=D?lu:uu,I=D?du:fu;d.timer=setTimeout(()=>{const O=d;if(!(!O||h)){if(O.attempts+=1,m(),D&&O.attempts>=I){const{pending:k}=O;ut(e),g({isRecovering:!1}),S({revision:{html:k.html,common_styles:k.common_styles,subject:k.subject,preheader:k.preheader},phase:"timeout"}),f=!0,O.phase="bg",O.attempts=0,M();return}if(!D&&O.attempts>=I){ut(e),P(),g({isRecovering:!1}),f=!0;return}M()}},L),d.timer.unref?.()},v=D=>{d={phase:"fast",attempts:0,pending:D,timer:null},g({isRecovering:!0}),M()},E=D=>{if(h)return;if(g({historyLoaded:!0,latestRevisionAt:D.latestAt!==void 0&&Number.isFinite(D.latestAt)?D.latestAt:void 0}),n&&d){const O=Tn(D,d.pending.sentAt);if(!O)return;const k=d.phase==="fast"?"found":"bg";ut(e),P(),g({isRecovering:!1}),f=!0,S({revision:O,phase:k});return}if(f)return;const L=n?Ps(e):null,I=L&&(L.sentAt<c||!hu(L.html,i()))?L:null;if(I){const O=Tn(D,I.sentAt);if(O){ut(e),f=!0,S({revision:O,phase:"found"});return}v(I);return}f=!0,S({revision:Tn(D),phase:"normal"})},A=D=>{h||(a?.(D),b.historyLoaded||(g({historyLoaded:!1,latestRevisionAt:void 0}),p()),!d&&S({revision:null,phase:"normal"}))},m=()=>t(e).then(E).catch(A);let l,u=!1;const p=()=>{u||d||h||(u=!0,l=setTimeout(()=>{l=void 0,!h&&!b.historyLoaded&&m()},cu))},R=()=>{h||(g({historyLoaded:!1,latestRevisionAt:void 0}),S({revision:null,phase:"normal"}))};return r?r().then(D=>D?m():R()):m(),{verdict:()=>w,confirmVerdict(D){const L=C;C=void 0,D&&L!==void 0&&!h&&_(L)},dispose(){h=!0,l!==void 0&&(clearTimeout(l),l=void 0),P()}}}function gu({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:i,onFacts:o}){let s=null;const a=mu({emailId:r,readAutosave:c=>e.readAutosave(c),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:i,onFacts:o,onLate:({revision:c,phase:d})=>{const f=Pi(c);return s?.(f)??!1},onError:c=>{c instanceof Error&&c.message}});return{id:"recovery",load:()=>a.verdict().then(({revision:c})=>Pi(c)),loaded(c){a.confirmVerdict(c)},watch(c){return s=c,()=>{s=null,a.dispose()}}}}function Ds(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){au(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 vu(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const i=Date.now(),o=await t.updateEmail(n,r);return await e.updateEmail(n,r),(Ps(n)?.sentAt??Number.POSITIVE_INFINITY)<=i&&ut(n),o}}}var Os=F("CurrentUser"),xs={};function Wr(e){return e.getOrCreateInstance(Os,()=>Ee(xs))}function Ms(e){return e?.getInstance(Os)?.get()??xs}var ks=F("HeadlessMode");function Ls(e){return e.getOrCreateInstance(ks,()=>Ee(!1))}function bu(e){return e?.getInstance(ks)?.get()??!1}var yu=F("HiddenMount");function Eu(e){return e.getOrCreateInstance(yu,()=>Ee(!1))}function _u(e){if(!e)return!1;try{return!!Mr(e).data?.act_as}catch{return!1}}function wu(e){return _u(e?.getInstance(Xo)?.get(Yl.em_token))}function Ns(e){return e?.getInstance(oe)?.get()??{}}function mn(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Su(e,t){return t.modeDefaults(mn(e,t.fallbackMode))}function Fs(e,t){const n=mn(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function js(e,t){const n=mn(e,t),r=e.user?.advancedConfigs?.[n],i=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...i}}function Iu(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function Cu(e){return Dl(e.map(t=>t?.resourceProxy))}function Tu(e){return Kl(e.map(t=>t?.resourceProxyPolicy))}function Au(e){return yl(e.map(t=>t?.backendProxy))}function Ru(e){return Vo(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Pu(e,t){return[e.base,Su(e,t),e.profile,e.serverSide,Fs(e,t.fallbackMode),e.local,e.user,js(e,t.fallbackMode)]}function An(e,t){const n=Pu(e,t),r=Vo(n),i=Iu(n);i!==void 0&&(r.fileManager=i);const o=Cu(n);o!==void 0&&(r.resourceProxy=o);const s=Tu(n);s&&Object.keys(s).length>0&&(r.resourceProxyPolicy=s);const a=Au(n);a!==void 0&&(r.backendProxy=a);const c=Ru(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}function Du(e,t,n){const r=Fs(e,n),i=js(e,n);return Wl([i,e.user,r,e.serverSide],t)}var Ou=1.5;function xu(e){return e.isHeadless||!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=Ou*e.autosaveTimeoutMs?"none":"revision"}function Mu(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:i}=e,o=e.readFailures??(()=>0),s=e.readFailureRetryable??(()=>!0);let a;const c=E=>a!==void 0&&a.version===E.get().version?o()-a.failuresAtStart:0,d=E=>{const A=c(E);if(A<=0)return!1;const m=n().retryMaxAttempts??5;return!s()||A>m},f=()=>{const{autosaveTimeoutMs:E,retryIntervalMs:A}=n(),m=t();return m!==void 0&&c(m)>0&&A!==void 0&&A>0?A:E},h=E=>E.isNew()&&o()>=3,y=()=>{const E=t();if(!E||E.isDisposed()||d(E))return"none";const{latestRevisionAt:A,snapshotVersion:m,...l}=n(),u=Date.now(),p=xu({...l,isDirty:E.isDirty(),isNew:E.isNew(),isReady:E.isReady(),latestRevisionAgeMs:A!=null&&A<=u?u-A:void 0,isSnapshotSent:m!=null&&m===E.get().version});return p==="create"&&h(E)?"none":p},b=()=>{const E=t();if(!E||E.isDisposed()||h(E)||d(E)||n().isHeadless)return!1;if(!E.isDirty())return E.isNew();const{snapshotVersion:A}=n();return!(A!=null&&A===E.get().version)};let T,w,g,C,_=!1;const P=()=>{w=void 0;const E=t();if(!E||E.isDisposed())return;if(E.get().docId!==T){S();return}const A=y();A!=="none"&&a?.version!==E.get().version&&(a={version:E.get().version,failuresAtStart:o()}),A==="create"?r():A==="revision"?i():b()&&(T=E.get().docId,w=setTimeout(P,f()))},S=()=>{const E=t();_||!E||w!==void 0||y()==="none"&&!b()||(T=E.get().docId,w=setTimeout(P,f()))},M=E=>{E.source==="user"&&w!==void 0&&(clearTimeout(w),w=void 0),S()},v=()=>{const E=t();E!==g&&(C?.(),g=E,a=void 0,C=E?.subscribe(M),w!==void 0&&(clearTimeout(w),w=void 0))};return v(),S(),{refresh:()=>{_||(v(),S())},stop:()=>{_=!0,C?.(),C=void 0,g=void 0,w!==void 0&&(clearTimeout(w),w=void 0)}}}var Bs=F("documentSession.autosaveUiFacts"),Us={isUserBusy:!1,saveContext:{}};function ku(e){return e.getOrCreateInstance(Bs,()=>Ee(Us))}function Qn(e){return e?.getInstance(Bs)?.get()??Us}function Hs(e){return Qn(e).saveContext.fallbackTitle||"Untitled email."}var Lu=1e4,Nu=3e4;function Fu(e,t){const n=f=>{const h=e.getInstance(oe)?.layers?.(),y=h?Du(h,f):void 0;return typeof y=="number"&&y>=0?y:void 0},r=()=>{const f=t.current(),h=f?.get().serverId??void 0,y=ye(t.sessionKey()),b=t.recoveryFacts(),T=b?.emailId===h?b:void 0,w=t.revisionFacts(),g=T?.latestRevisionAt,C=w?.lastRevisionAt,_=Ms(e).profile;return{isInited:y||f?.get().attributes.is_inited===!0,isEnabled:!!_?.autosaves&&!wu(e),isHistoryLoaded:T?.historyLoaded===!0,isUserBusy:Qn(e).isUserBusy,isHeadless:bu(e),autosaveTimeoutMs:Ns(e).autosaveTimeout||Lu,latestRevisionAt:g!==void 0||C!==void 0?Math.max(g??0,C??0):void 0,snapshotVersion:w?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??Nu,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},i=()=>{const f=Qn(e).saveContext;return{...f,project:f.project??t.current()?.get().attributes.project,fallbackTitle:Hs(e)}},o=Mu({readDocument:()=>t.current(),readEnvironment:r,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>yd(t.saveState().error),onCreate:()=>{ye(t.sessionKey())||t.save("materialize",i())},onRevision:()=>{t.save("snapshot",{project:i().project})}}),s=t.subscribe(o.refresh),a=Wr(e).watch(()=>o.refresh()),c=ku(e).watch(()=>o.refresh()),d=Ls(e).watch(()=>o.refresh());return()=>{s(),a.dispose(),c.dispose(),d.dispose(),o.stop()}}var xi=12e3;function Le(e){return e.getOrCreateInstance(Fr,()=>{const t=Xd({resolveAdapters:(r,i)=>Uu(r,e,i),resolveWritePort:()=>$s(e),resolveHistoryPort:r=>ye(r)?Vs(e):Gs(e),resolveTerms:()=>ru(e),canEdit:r=>Bc(e,r),notifyBeforeSave:zc(e),timeoutMs:xi,onAdapterError:(r,i)=>{i instanceof Error&&i.message;const o=Qd(i),s=Jd(i);St(i,{origin:"email-source-adapter",tags:{source:r,expected_refusal:String(o),network_failure:String(s)},level:o||s?"warning":"error"})},onTimeout:r=>{}}),n=Fu(e,t);return e.getInstance(U)?.addDispose(n),t})}function Kr(e){return e?.getInstance(Fr)}function $s(e){const t=eu(e);return t?Yr(e)?vu(t,Ve(e).email(e)):t:Ve(e).email(e)}function ju(e){return Rs(e)!==void 0||Cs(e)}function Gs(e){const t=Rs(e);return t?Yr(e)?(Z("port:history:server-backed"),Ds(t,Ve(e).history(e))):(Z("port:history:integrator"),t):(Z("port:history:rest (порт не зарегистрирован)"),Ve(e).history(e))}function Vs(e){const t=As(e);return t?Yr(e)?(Z("port:block-history:server-backed"),Ds(t,Ve(e).blockHistory(e))):(Z("port:block-history:integrator"),t):(Z("port:block-history:rest (порт не зарегистрирован)"),Ve(e).blockHistory(e))}function Bu(e){return As(e)!==void 0||Cs(e)}function Yr(e){return ns(e)}function Uu({email:e,patch:t,serverId:n,key:r},i,o){const s=[];e?s.push({id:"rest",load:()=>Es(e),required:!0}):n&&s.push(Zd($s(i),n)),t&&s.push({id:"plugin",load:()=>_s(t)});const a=ye(r);return Wc(n)&&(a?Bu(i):ju(i))&&s.push(gu({port:a?Vs(i):Gs(i),revisionServiceEnabled:ns(i),...!a&&Uc(i)?{isHistoryAvailable:()=>Hc(i)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:c=>o.publishRecoveryFacts(c)})),s}function ae(e){return e.getOrCreateInstance(Ot,()=>new xt)}var qs=new WeakMap,Zn=new WeakMap;function be(e){return qs.get(e)??0}function er(e,t){let n=Zn.get(e);return n||(n=new Set,Zn.set(e,n)),n.add(t),()=>{n?.delete(t)}}function Hu(e){qs.set(e,be(e)+1),Zn.get(e)?.forEach(t=>t())}function $u(e){const t=Le(e),n=ae(e).addListener($.APPLICATION_HAS_AMP,r=>{dt(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(U)?.addDispose(()=>n.dispose())}function Gu(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Vu(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 a=await t(o,{mode:"cors",credentials:"omit",cache:s?"no-cache":"default"});if(!a.ok)return;const c=await a.blob();return Gu(c)?c:void 0}catch{return}}}}var Ge={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function qu(e){const t={maxBytes:e.maxBytes??Ge.maxBytes,maxImageBytes:e.maxImageBytes??Ge.maxImageBytes,ttlMs:e.ttlMs??Ge.ttlMs},n=e.now??(()=>Date.now()),r=new Map,i=new Map,o={hits:0,loads:0,failures:0};let s=0;const a=h=>{const y=r.get(h);y&&(s-=y.bytes,r.delete(h))},c=h=>t.ttlMs<=0||n()-h.storedAt<t.ttlMs,d=()=>{if(s<=t.maxBytes)return;const h=[...r.entries()].sort((y,b)=>y[1].usedAt-b[1].usedAt);for(const[y]of h){if(s<=t.maxBytes)return;a(y)}},f=(h,y)=>{y.size>t.maxImageBytes||(r.set(h,{blob:y,bytes:y.size,storedAt:n(),usedAt:n()}),s+=y.size,d())};return{async get(h){const y=r.get(h);if(y&&c(y))return y.usedAt=n(),o.hits+=1,y.blob;y&&a(h);const b=i.get(h);if(b!==void 0)return b;o.loads+=1;const T=(async()=>{try{const w=await e.load(h);return w?f(h,w):o.failures+=1,w}catch{o.failures+=1;return}finally{i.delete(h)}})();return i.set(h,T),T},forget(h){a(h),i.delete(h)},configure(h){Object.assign(t,{maxBytes:h.maxBytes??t.maxBytes,maxImageBytes:h.maxImageBytes??t.maxImageBytes,ttlMs:h.ttlMs??t.ttlMs});for(const[y,b]of r)b.bytes>t.maxImageBytes&&a(y);d()},clear(){r.clear(),i.clear(),s=0},stats(){return{entries:r.size,bytes:s,...o}}}}var zu=["emcdn.ru","scr.emcdn.ru"];function Wu(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 Ku(e,t){const n=(r,i)=>{const o=new Set(i?t:[]);for(const s of r){const a=Wu(s);a&&o.add(a)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function Yu(e){const t=e??{},n=t.isPlugin!==!0?zu:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...Ge};const i=r===!0||r===void 0?{}:r;return{enabled:i.enabled!==!1,sourceHosts:Ku(i.sourceHosts,n),maxBytes:i.maxBytes??Ge.maxBytes,maxImageBytes:i.maxImageBytes??Ge.maxImageBytes,ttlMs:i.ttlMs??Ge.ttlMs}}function Xu(e){const t=ae(e),n=e.getInstance(oe),r=()=>Yu({...n?.get(),isPlugin:!0});let i=r();const o=Vu({sourceHosts:()=>i.sourceHosts}),s=qu({load:w=>o.load(w),maxBytes:i.maxBytes,maxImageBytes:i.maxImageBytes,ttlMs:i.ttlMs}),a=()=>{t.send($.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:i.enabled,sourceHosts:[...i.sourceHosts]})},c=t.onInit(()=>a()),d=n?.watch(()=>{const w=r(),g=JSON.stringify(w)!==JSON.stringify(i);i=w,s.configure(w),w.enabled||s.clear(),g&&t.isInited()&&a()}),f={asked:0,served:0,refused:0},h=[],y=(w,g)=>(f.refused+=1,h.push({url:w,reason:g}),h.length>20&&h.shift(),{refused:!0}),b=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:i,counters:{...f},refusals:[...h],store:s.stats()})}),T=t.addListenerAsync($.APPLICATION_CANVAS_IMAGE_GET,async w=>{const g=w?.url??"";if(f.asked+=1,!i.enabled||!g)return y(g,"disabled");if(!o.accepts(g))return y(g,"host");w.fresh&&s.forget(g);const C=await s.get(g);return C?(f.served+=1,{blob:C}):y(g,"load-failed")});e.getInstance(U)?.addDispose(()=>{c.dispose(),d?.dispose(),T.dispose(),s.clear(),delete b.__emmCanvasImages__})}var Ju=2e3;function Qu(e){const t=ae(e),n=new Map,r=()=>{const s=t.getTarget();if(!s||t.hasPort(s))return;clearTimeout(n.get(s));const a=new MessageChannel;let c=!1,d=!1;const f=y=>{y.data?.operationId==="em:port-ready"&&(c=!0,a.port1.removeEventListener("message",f),d&&t.resumePort(s),t.drainWindow(s))};a.port1.addEventListener("message",f),t.sendPort(s,a.port2),t.usePort(a.port1,!1,s);const h=setTimeout(()=>{n.get(s)===h&&n.delete(s),!(c||!t.hasPort(s,a.port1))&&(St(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d=!0,t.holdPort(s))},Ju);n.set(s,h)},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(U)?.addDispose(()=>{for(const s of n.values())clearTimeout(s);o.dispose(),delete i.__emmCanvasPort__})}var Zu=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function ef(e){return Zu.test(e)||e.indexOf("//")===0}function Vt(e){return e&&(e.endsWith("/")?e:`${e}/`)}function tf(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Mi(e,t){const n=e==null||e===""?"./":String(e);if(ef(n))return Vt(n);const r=t??tf();if(!r)return Vt(n);try{return Vt(new URL(n,r).href)}catch{return Vt(n)}}function nf(){return typeof window.__useblocks__<"u"&&window.__useblocks__?.publicPath?Mi(window.__useblocks__.publicPath):Mi("/")}var rf=()=>"",of=()=>"1c4e77a0";function zs(e){const t=e?"iframe-eblock":"iframe",n=rf();if(n){const o=n.replace(/\/?$/,"/");return _i(`${o}${t}.html`,wt())}const r=of(),i=`${nf().replace(/\/?$/,"/")}iframe/`;return _i(`${i}${t}${r?`.${r}`:""}.html`,wt())}var ki="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function tr(e){return/^file:/i.test(String(e||"").trim())}function sf(e){return tr(e)?`${ki} allow-same-origin`:ki}var af="em:module-body-ack";function lf(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 Xr(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.([0-9a-f]{6,}))?\.html$/.exec(t);return n?{name:n[1],hash:n[2]}:void 0}function cf(e){const t=Xr(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function df(e,t){const n=Xr(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(i=>e[i]?.file).filter(i=>!!i):[]}function uf(e,t){const n=Xr(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const i=new Set([r]),o=[r],s=[];for(;o.length>0;)for(const a of e[o.shift()]??[])i.has(a)||(i.add(a),s.push(a),o.push(a));return s}var ff=/^(?=[\w-]{8}$)(?:.*\d|(?=.*[a-z]).*[A-Z])/;function pf(e){const t=(e.split(/[?#]/)[0].split("/").pop()??"").split(".");return t.length>=3&&ff.test(t[t.length-2])}async function hf(e,t){const n=pf(e)?{}:{cache:"no-cache"};t?.priority&&(n.priority=t.priority);try{const r=await fetch(e,n);return r.ok?await r.blob():void 0}catch{return}}function mf(e){const t=new Map,n=(r,i)=>{const o=lf(r,e.canvasSrc,e.origin);if(!o)return;const s=t.get(o);if(s!==void 0)return s;const a=e.fetchBody(o,i);return t.set(o,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,i){for(const o of r)n(o,i)},reset(){t.clear()},get size(){return t.size}}}var Ie;function gf(e){try{return tr(new URL(e,window.location.href).href)}catch{return tr(window.location.href)}}function Ws(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof window.__useblocks__<"u"&&window.__useblocks__?.preload?.canvasCrossOrigin===!0}var vf=()=>Promise.resolve(void 0);function Ks(){const e=zs(!1);if(!gf(e)){if(!Ie||Ie.canvasSrc!==e){const t=Ws(e)?hf:vf;Ie={canvasSrc:e,store:mf({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return Ie.store}}async function bf(e,t){try{const n=new URL(".vite/manifest.json",new URL("./",new URL(e,window.location.href))).href,r=await fetch(n,{cache:"no-cache"});if(!r.ok)return;const i=await r.json();t(df(i,e))}catch{}}function Jr(e){const t=Ks();if(!t||!Ie||Ie.warmed||!Ws(Ie.canvasSrc))return;Ie.warmed=!0;const{canvasSrc:n}=Ie,r=cf(n);r&&t.warm([r],e);const i={"js/iframe-eblock.js":["js/discussHandlers.Xh4-JUcT.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.Xh4-JUcT.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.Xh4-JUcT.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?t.warm(uf(i,n),e):bf(n,o=>t.warm(o,e))}function yf(e){const t=Ks();if(!t)return;Jr();const n=r=>{const i=r.data;if(!i||i.operationId!=="em:module-body"||!i.result)return;const o=r.source;o&&(o.postMessage({operationId:af,for:i.result},"*"),t.take(i.data?.url??"").then(s=>{o.postMessage({operationId:i.result,data:s??null},"*")}))};window.addEventListener("message",n),e.getInstance(U)?.addDispose(()=>{window.removeEventListener("message",n)})}var Qe=/<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,Ef=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,rt=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Li=/display:\s*none\s*!important/gi,_f=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,wf=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Sf=/height\s*:\s*100%\s*!important/i,If=[".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 Cf(e){return Li.lastIndex=0,(e.match(Li)||[]).length}function Ys(e){const t=e.trim(),n=Cf(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=If.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 Tf(e){rt.lastIndex=0;for(const t of e.matchAll(rt))if(Ys(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function Af(e){let t=!1;return rt.lastIndex=0,{html:e.replace(rt,n=>Ys(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Rf(e){return Qe.lastIndex=0,Qe.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||Tf(e)}function Pf(e){if(!Rf(e))return{html:e,found:!1};let t=!1,n=e;Qe.lastIndex=0,Qe.test(n)&&(Qe.lastIndex=0,n=n.replace(Qe,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(Ef,""),t=!0);const r=Af(n);return n=r.html,t=t||r.found,{html:n,found:t}}function Df(e){return!e||!Sf.test(e)?e:(rt.lastIndex=0,e.replace(rt,t=>t.replace(_f,(n,r,i,o)=>`${r}${i.replace(wf,"")}${o}`)))}function Xs(e){const t=Pf(e.replaceAll(`\r
|
|
1002
|
+
`)}function Tn(e,t){return Hr(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function mu({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:i,onFacts:o,onLate:s,onError:a,pageLoadTs:c=pu()}){let d=null,f=!1,h=!1,y=0,b={emailId:e,historyLoaded:!1,isRecovering:!1},T=null;const w=new Promise(D=>{T=D}),g=D=>{b={...b,...D},o(b)};let C;const _=D=>{y+=1,g({applied:{phase:D,seq:y}})},P=()=>{d?.timer&&clearTimeout(d.timer),d=null},S=D=>{if(!h){if(T){const L=T;T=null,L(D),C=D.revision?D.phase:void 0;return}s(D)&&D.revision&&_(D.phase)}},M=()=>{if(!d||h)return;const D=d.phase==="fast",L=D?lu:uu,I=D?du:fu;d.timer=setTimeout(()=>{const O=d;if(!(!O||h)){if(O.attempts+=1,m(),D&&O.attempts>=I){const{pending:k}=O;ut(e),g({isRecovering:!1}),S({revision:{html:k.html,common_styles:k.common_styles,subject:k.subject,preheader:k.preheader},phase:"timeout"}),f=!0,O.phase="bg",O.attempts=0,M();return}if(!D&&O.attempts>=I){ut(e),P(),g({isRecovering:!1}),f=!0;return}M()}},L),d.timer.unref?.()},v=D=>{d={phase:"fast",attempts:0,pending:D,timer:null},g({isRecovering:!0}),M()},E=D=>{if(h)return;if(g({historyLoaded:!0,latestRevisionAt:D.latestAt!==void 0&&Number.isFinite(D.latestAt)?D.latestAt:void 0}),n&&d){const O=Tn(D,d.pending.sentAt);if(!O)return;const k=d.phase==="fast"?"found":"bg";ut(e),P(),g({isRecovering:!1}),f=!0,S({revision:O,phase:k});return}if(f)return;const L=n?Ps(e):null,I=L&&(L.sentAt<c||!hu(L.html,i()))?L:null;if(I){const O=Tn(D,I.sentAt);if(O){ut(e),f=!0,S({revision:O,phase:"found"});return}v(I);return}f=!0,S({revision:Tn(D),phase:"normal"})},A=D=>{h||(a?.(D),b.historyLoaded||(g({historyLoaded:!1,latestRevisionAt:void 0}),p()),!d&&S({revision:null,phase:"normal"}))},m=()=>t(e).then(E).catch(A);let l,u=!1;const p=()=>{u||d||h||(u=!0,l=setTimeout(()=>{l=void 0,!h&&!b.historyLoaded&&m()},cu))},R=()=>{h||(g({historyLoaded:!1,latestRevisionAt:void 0}),S({revision:null,phase:"normal"}))};return r?r().then(D=>D?m():R()):m(),{verdict:()=>w,confirmVerdict(D){const L=C;C=void 0,D&&L!==void 0&&!h&&_(L)},dispose(){h=!0,l!==void 0&&(clearTimeout(l),l=void 0),P()}}}function gu({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:i,onFacts:o}){let s=null;const a=mu({emailId:r,readAutosave:c=>e.readAutosave(c),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:i,onFacts:o,onLate:({revision:c,phase:d})=>{const f=Pi(c);return s?.(f)??!1},onError:c=>{c instanceof Error&&c.message}});return{id:"recovery",load:()=>a.verdict().then(({revision:c})=>Pi(c)),loaded(c){a.confirmVerdict(c)},watch(c){return s=c,()=>{s=null,a.dispose()}}}}function Ds(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){au(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 vu(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const i=Date.now(),o=await t.updateEmail(n,r);return await e.updateEmail(n,r),(Ps(n)?.sentAt??Number.POSITIVE_INFINITY)<=i&&ut(n),o}}}var Os=F("CurrentUser"),xs={};function Wr(e){return e.getOrCreateInstance(Os,()=>Ee(xs))}function Ms(e){return e?.getInstance(Os)?.get()??xs}var ks=F("HeadlessMode");function Ls(e){return e.getOrCreateInstance(ks,()=>Ee(!1))}function bu(e){return e?.getInstance(ks)?.get()??!1}var yu=F("HiddenMount");function Eu(e){return e.getOrCreateInstance(yu,()=>Ee(!1))}function _u(e){if(!e)return!1;try{return!!Mr(e).data?.act_as}catch{return!1}}function wu(e){return _u(e?.getInstance(Xo)?.get(Yl.em_token))}function Ns(e){return e?.getInstance(oe)?.get()??{}}function mn(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Su(e,t){return t.modeDefaults(mn(e,t.fallbackMode))}function Fs(e,t){const n=mn(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function js(e,t){const n=mn(e,t),r=e.user?.advancedConfigs?.[n],i=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...i}}function Iu(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function Cu(e){return Dl(e.map(t=>t?.resourceProxy))}function Tu(e){return Kl(e.map(t=>t?.resourceProxyPolicy))}function Au(e){return yl(e.map(t=>t?.backendProxy))}function Ru(e){return Vo(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Pu(e,t){return[e.base,Su(e,t),e.profile,e.serverSide,Fs(e,t.fallbackMode),e.local,e.user,js(e,t.fallbackMode)]}function An(e,t){const n=Pu(e,t),r=Vo(n),i=Iu(n);i!==void 0&&(r.fileManager=i);const o=Cu(n);o!==void 0&&(r.resourceProxy=o);const s=Tu(n);s&&Object.keys(s).length>0&&(r.resourceProxyPolicy=s);const a=Au(n);a!==void 0&&(r.backendProxy=a);const c=Ru(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}function Du(e,t,n){const r=Fs(e,n),i=js(e,n);return Wl([i,e.user,r,e.serverSide],t)}var Ou=1.5;function xu(e){return e.isHeadless||!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=Ou*e.autosaveTimeoutMs?"none":"revision"}function Mu(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:i}=e,o=e.readFailures??(()=>0),s=e.readFailureRetryable??(()=>!0);let a;const c=E=>a!==void 0&&a.version===E.get().version?o()-a.failuresAtStart:0,d=E=>{const A=c(E);if(A<=0)return!1;const m=n().retryMaxAttempts??5;return!s()||A>m},f=()=>{const{autosaveTimeoutMs:E,retryIntervalMs:A}=n(),m=t();return m!==void 0&&c(m)>0&&A!==void 0&&A>0?A:E},h=E=>E.isNew()&&o()>=3,y=()=>{const E=t();if(!E||E.isDisposed()||d(E))return"none";const{latestRevisionAt:A,snapshotVersion:m,...l}=n(),u=Date.now(),p=xu({...l,isDirty:E.isDirty(),isNew:E.isNew(),isReady:E.isReady(),latestRevisionAgeMs:A!=null&&A<=u?u-A:void 0,isSnapshotSent:m!=null&&m===E.get().version});return p==="create"&&h(E)?"none":p},b=()=>{const E=t();if(!E||E.isDisposed()||h(E)||d(E)||n().isHeadless)return!1;if(!E.isDirty())return E.isNew();const{snapshotVersion:A}=n();return!(A!=null&&A===E.get().version)};let T,w,g,C,_=!1;const P=()=>{w=void 0;const E=t();if(!E||E.isDisposed())return;if(E.get().docId!==T){S();return}const A=y();A!=="none"&&a?.version!==E.get().version&&(a={version:E.get().version,failuresAtStart:o()}),A==="create"?r():A==="revision"?i():b()&&(T=E.get().docId,w=setTimeout(P,f()))},S=()=>{const E=t();_||!E||w!==void 0||y()==="none"&&!b()||(T=E.get().docId,w=setTimeout(P,f()))},M=E=>{E.source==="user"&&w!==void 0&&(clearTimeout(w),w=void 0),S()},v=()=>{const E=t();E!==g&&(C?.(),g=E,a=void 0,C=E?.subscribe(M),w!==void 0&&(clearTimeout(w),w=void 0))};return v(),S(),{refresh:()=>{_||(v(),S())},stop:()=>{_=!0,C?.(),C=void 0,g=void 0,w!==void 0&&(clearTimeout(w),w=void 0)}}}var Bs=F("documentSession.autosaveUiFacts"),Us={isUserBusy:!1,saveContext:{}};function ku(e){return e.getOrCreateInstance(Bs,()=>Ee(Us))}function Qn(e){return e?.getInstance(Bs)?.get()??Us}function Hs(e){return Qn(e).saveContext.fallbackTitle||"Untitled email."}var Lu=1e4,Nu=3e4;function Fu(e,t){const n=f=>{const h=e.getInstance(oe)?.layers?.(),y=h?Du(h,f):void 0;return typeof y=="number"&&y>=0?y:void 0},r=()=>{const f=t.current(),h=f?.get().serverId??void 0,y=ye(t.sessionKey()),b=t.recoveryFacts(),T=b?.emailId===h?b:void 0,w=t.revisionFacts(),g=T?.latestRevisionAt,C=w?.lastRevisionAt,_=Ms(e).profile;return{isInited:y||f?.get().attributes.is_inited===!0,isEnabled:!!_?.autosaves&&!wu(e),isHistoryLoaded:T?.historyLoaded===!0,isUserBusy:Qn(e).isUserBusy,isHeadless:bu(e),autosaveTimeoutMs:Ns(e).autosaveTimeout||Lu,latestRevisionAt:g!==void 0||C!==void 0?Math.max(g??0,C??0):void 0,snapshotVersion:w?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??Nu,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},i=()=>{const f=Qn(e).saveContext;return{...f,project:f.project??t.current()?.get().attributes.project,fallbackTitle:Hs(e)}},o=Mu({readDocument:()=>t.current(),readEnvironment:r,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>yd(t.saveState().error),onCreate:()=>{ye(t.sessionKey())||t.save("materialize",i())},onRevision:()=>{t.save("snapshot",{project:i().project})}}),s=t.subscribe(o.refresh),a=Wr(e).watch(()=>o.refresh()),c=ku(e).watch(()=>o.refresh()),d=Ls(e).watch(()=>o.refresh());return()=>{s(),a.dispose(),c.dispose(),d.dispose(),o.stop()}}var xi=12e3;function Le(e){return e.getOrCreateInstance(Fr,()=>{const t=Xd({resolveAdapters:(r,i)=>Uu(r,e,i),resolveWritePort:()=>$s(e),resolveHistoryPort:r=>ye(r)?Vs(e):Gs(e),resolveTerms:()=>ru(e),canEdit:r=>Bc(e,r),notifyBeforeSave:zc(e),timeoutMs:xi,onAdapterError:(r,i)=>{i instanceof Error&&i.message;const o=Qd(i),s=Jd(i);St(i,{origin:"email-source-adapter",tags:{source:r,expected_refusal:String(o),network_failure:String(s)},level:o||s?"warning":"error"})},onTimeout:r=>{}}),n=Fu(e,t);return e.getInstance(U)?.addDispose(n),t})}function Kr(e){return e?.getInstance(Fr)}function $s(e){const t=eu(e);return t?Yr(e)?vu(t,Ve(e).email(e)):t:Ve(e).email(e)}function ju(e){return Rs(e)!==void 0||Cs(e)}function Gs(e){const t=Rs(e);return t?Yr(e)?(Z("port:history:server-backed"),Ds(t,Ve(e).history(e))):(Z("port:history:integrator"),t):(Z("port:history:rest (порт не зарегистрирован)"),Ve(e).history(e))}function Vs(e){const t=As(e);return t?Yr(e)?(Z("port:block-history:server-backed"),Ds(t,Ve(e).blockHistory(e))):(Z("port:block-history:integrator"),t):(Z("port:block-history:rest (порт не зарегистрирован)"),Ve(e).blockHistory(e))}function Bu(e){return As(e)!==void 0||Cs(e)}function Yr(e){return ns(e)}function Uu({email:e,patch:t,serverId:n,key:r},i,o){const s=[];e?s.push({id:"rest",load:()=>Es(e),required:!0}):n&&s.push(Zd($s(i),n)),t&&s.push({id:"plugin",load:()=>_s(t)});const a=ye(r);return Wc(n)&&(a?Bu(i):ju(i))&&s.push(gu({port:a?Vs(i):Gs(i),revisionServiceEnabled:ns(i),...!a&&Uc(i)?{isHistoryAvailable:()=>Hc(i)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:c=>o.publishRecoveryFacts(c)})),s}function ae(e){return e.getOrCreateInstance(Ot,()=>new xt)}var qs=new WeakMap,Zn=new WeakMap;function be(e){return qs.get(e)??0}function er(e,t){let n=Zn.get(e);return n||(n=new Set,Zn.set(e,n)),n.add(t),()=>{n?.delete(t)}}function Hu(e){qs.set(e,be(e)+1),Zn.get(e)?.forEach(t=>t())}function $u(e){const t=Le(e),n=ae(e).addListener($.APPLICATION_HAS_AMP,r=>{dt(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(U)?.addDispose(()=>n.dispose())}function Gu(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Vu(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 a=await t(o,{mode:"cors",credentials:"omit",cache:s?"no-cache":"default"});if(!a.ok)return;const c=await a.blob();return Gu(c)?c:void 0}catch{return}}}}var Ge={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function qu(e){const t={maxBytes:e.maxBytes??Ge.maxBytes,maxImageBytes:e.maxImageBytes??Ge.maxImageBytes,ttlMs:e.ttlMs??Ge.ttlMs},n=e.now??(()=>Date.now()),r=new Map,i=new Map,o={hits:0,loads:0,failures:0};let s=0;const a=h=>{const y=r.get(h);y&&(s-=y.bytes,r.delete(h))},c=h=>t.ttlMs<=0||n()-h.storedAt<t.ttlMs,d=()=>{if(s<=t.maxBytes)return;const h=[...r.entries()].sort((y,b)=>y[1].usedAt-b[1].usedAt);for(const[y]of h){if(s<=t.maxBytes)return;a(y)}},f=(h,y)=>{y.size>t.maxImageBytes||(r.set(h,{blob:y,bytes:y.size,storedAt:n(),usedAt:n()}),s+=y.size,d())};return{async get(h){const y=r.get(h);if(y&&c(y))return y.usedAt=n(),o.hits+=1,y.blob;y&&a(h);const b=i.get(h);if(b!==void 0)return b;o.loads+=1;const T=(async()=>{try{const w=await e.load(h);return w?f(h,w):o.failures+=1,w}catch{o.failures+=1;return}finally{i.delete(h)}})();return i.set(h,T),T},forget(h){a(h),i.delete(h)},configure(h){Object.assign(t,{maxBytes:h.maxBytes??t.maxBytes,maxImageBytes:h.maxImageBytes??t.maxImageBytes,ttlMs:h.ttlMs??t.ttlMs});for(const[y,b]of r)b.bytes>t.maxImageBytes&&a(y);d()},clear(){r.clear(),i.clear(),s=0},stats(){return{entries:r.size,bytes:s,...o}}}}var zu=["emcdn.ru","scr.emcdn.ru"];function Wu(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 Ku(e,t){const n=(r,i)=>{const o=new Set(i?t:[]);for(const s of r){const a=Wu(s);a&&o.add(a)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function Yu(e){const t=e??{},n=t.isPlugin!==!0?zu:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...Ge};const i=r===!0||r===void 0?{}:r;return{enabled:i.enabled!==!1,sourceHosts:Ku(i.sourceHosts,n),maxBytes:i.maxBytes??Ge.maxBytes,maxImageBytes:i.maxImageBytes??Ge.maxImageBytes,ttlMs:i.ttlMs??Ge.ttlMs}}function Xu(e){const t=ae(e),n=e.getInstance(oe),r=()=>Yu({...n?.get(),isPlugin:!0});let i=r();const o=Vu({sourceHosts:()=>i.sourceHosts}),s=qu({load:w=>o.load(w),maxBytes:i.maxBytes,maxImageBytes:i.maxImageBytes,ttlMs:i.ttlMs}),a=()=>{t.send($.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:i.enabled,sourceHosts:[...i.sourceHosts]})},c=t.onInit(()=>a()),d=n?.watch(()=>{const w=r(),g=JSON.stringify(w)!==JSON.stringify(i);i=w,s.configure(w),w.enabled||s.clear(),g&&t.isInited()&&a()}),f={asked:0,served:0,refused:0},h=[],y=(w,g)=>(f.refused+=1,h.push({url:w,reason:g}),h.length>20&&h.shift(),{refused:!0}),b=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:i,counters:{...f},refusals:[...h],store:s.stats()})}),T=t.addListenerAsync($.APPLICATION_CANVAS_IMAGE_GET,async w=>{const g=w?.url??"";if(f.asked+=1,!i.enabled||!g)return y(g,"disabled");if(!o.accepts(g))return y(g,"host");w.fresh&&s.forget(g);const C=await s.get(g);return C?(f.served+=1,{blob:C}):y(g,"load-failed")});e.getInstance(U)?.addDispose(()=>{c.dispose(),d?.dispose(),T.dispose(),s.clear(),delete b.__emmCanvasImages__})}var Ju=2e3;function Qu(e){const t=ae(e),n=new Map,r=()=>{const s=t.getTarget();if(!s||t.hasPort(s))return;clearTimeout(n.get(s));const a=new MessageChannel;let c=!1,d=!1;const f=y=>{y.data?.operationId==="em:port-ready"&&(c=!0,a.port1.removeEventListener("message",f),d&&t.resumePort(s),t.drainWindow(s))};a.port1.addEventListener("message",f),t.sendPort(s,a.port2),t.usePort(a.port1,!1,s);const h=setTimeout(()=>{n.get(s)===h&&n.delete(s),!(c||!t.hasPort(s,a.port1))&&(St(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d=!0,t.holdPort(s))},Ju);n.set(s,h)},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(U)?.addDispose(()=>{for(const s of n.values())clearTimeout(s);o.dispose(),delete i.__emmCanvasPort__})}var Zu=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function ef(e){return Zu.test(e)||e.indexOf("//")===0}function Vt(e){return e&&(e.endsWith("/")?e:`${e}/`)}function tf(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Mi(e,t){const n=e==null||e===""?"./":String(e);if(ef(n))return Vt(n);const r=t??tf();if(!r)return Vt(n);try{return Vt(new URL(n,r).href)}catch{return Vt(n)}}function nf(){return typeof window.__useblocks__<"u"&&window.__useblocks__?.publicPath?Mi(window.__useblocks__.publicPath):Mi("/")}var rf=()=>"",of=()=>"b65837b7";function zs(e){const t=e?"iframe-eblock":"iframe",n=rf();if(n){const o=n.replace(/\/?$/,"/");return _i(`${o}${t}.html`,wt())}const r=of(),i=`${nf().replace(/\/?$/,"/")}iframe/`;return _i(`${i}${t}${r?`.${r}`:""}.html`,wt())}var ki="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function tr(e){return/^file:/i.test(String(e||"").trim())}function sf(e){return tr(e)?`${ki} allow-same-origin`:ki}var af="em:module-body-ack";function lf(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 Xr(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.([0-9a-f]{6,}))?\.html$/.exec(t);return n?{name:n[1],hash:n[2]}:void 0}function cf(e){const t=Xr(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function df(e,t){const n=Xr(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(i=>e[i]?.file).filter(i=>!!i):[]}function uf(e,t){const n=Xr(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const i=new Set([r]),o=[r],s=[];for(;o.length>0;)for(const a of e[o.shift()]??[])i.has(a)||(i.add(a),s.push(a),o.push(a));return s}var ff=/^(?=[\w-]{8}$)(?:.*\d|(?=.*[a-z]).*[A-Z])/;function pf(e){const t=(e.split(/[?#]/)[0].split("/").pop()??"").split(".");return t.length>=3&&ff.test(t[t.length-2])}async function hf(e,t){const n=pf(e)?{}:{cache:"no-cache"};t?.priority&&(n.priority=t.priority);try{const r=await fetch(e,n);return r.ok?await r.blob():void 0}catch{return}}function mf(e){const t=new Map,n=(r,i)=>{const o=lf(r,e.canvasSrc,e.origin);if(!o)return;const s=t.get(o);if(s!==void 0)return s;const a=e.fetchBody(o,i);return t.set(o,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,i){for(const o of r)n(o,i)},reset(){t.clear()},get size(){return t.size}}}var Ie;function gf(e){try{return tr(new URL(e,window.location.href).href)}catch{return tr(window.location.href)}}function Ws(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof window.__useblocks__<"u"&&window.__useblocks__?.preload?.canvasCrossOrigin===!0}var vf=()=>Promise.resolve(void 0);function Ks(){const e=zs(!1);if(!gf(e)){if(!Ie||Ie.canvasSrc!==e){const t=Ws(e)?hf:vf;Ie={canvasSrc:e,store:mf({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return Ie.store}}async function bf(e,t){try{const n=new URL(".vite/manifest.json",new URL("./",new URL(e,window.location.href))).href,r=await fetch(n,{cache:"no-cache"});if(!r.ok)return;const i=await r.json();t(df(i,e))}catch{}}function Jr(e){const t=Ks();if(!t||!Ie||Ie.warmed||!Ws(Ie.canvasSrc))return;Ie.warmed=!0;const{canvasSrc:n}=Ie,r=cf(n);r&&t.warm([r],e);const i={"js/iframe-eblock.js":["js/discussHandlers.B36tbVEC.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.B36tbVEC.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.B36tbVEC.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?t.warm(uf(i,n),e):bf(n,o=>t.warm(o,e))}function yf(e){const t=Ks();if(!t)return;Jr();const n=r=>{const i=r.data;if(!i||i.operationId!=="em:module-body"||!i.result)return;const o=r.source;o&&(o.postMessage({operationId:af,for:i.result},"*"),t.take(i.data?.url??"").then(s=>{o.postMessage({operationId:i.result,data:s??null},"*")}))};window.addEventListener("message",n),e.getInstance(U)?.addDispose(()=>{window.removeEventListener("message",n)})}var Qe=/<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,Ef=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,rt=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Li=/display:\s*none\s*!important/gi,_f=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,wf=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Sf=/height\s*:\s*100%\s*!important/i,If=[".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 Cf(e){return Li.lastIndex=0,(e.match(Li)||[]).length}function Ys(e){const t=e.trim(),n=Cf(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=If.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 Tf(e){rt.lastIndex=0;for(const t of e.matchAll(rt))if(Ys(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function Af(e){let t=!1;return rt.lastIndex=0,{html:e.replace(rt,n=>Ys(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Rf(e){return Qe.lastIndex=0,Qe.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||Tf(e)}function Pf(e){if(!Rf(e))return{html:e,found:!1};let t=!1,n=e;Qe.lastIndex=0,Qe.test(n)&&(Qe.lastIndex=0,n=n.replace(Qe,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(Ef,""),t=!0);const r=Af(n);return n=r.html,t=t||r.found,{html:n,found:t}}function Df(e){return!e||!Sf.test(e)?e:(rt.lastIndex=0,e.replace(rt,t=>t.replace(_f,(n,r,i,o)=>`${r}${i.replace(wf,"")}${o}`)))}function Xs(e){const t=Pf(e.replaceAll(`\r
|
|
1003
1003
|
`,`
|
|
1004
1004
|
`));return{html:Df(t.html),hasBrowserExtensionArtifacts:t.found}}function sn(e){return e?.getContent()??""}function Js(e,t){e?.mutate({content:bs(t)},{source:"remote"})}function Qr(e){return F(e)}function fe(e,t){return e.getOrCreateInstance(t,()=>new Me)}function te(e,t){return e.getOrCreateInstance(t,()=>new Me).event}function an(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var Of=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}},xf=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(pe("Superseded by newer show()")),n.aborted?Promise.reject(pe(n.reason)):(this._activeRequest=e,new Promise((r,i)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{i(new Of(e.showId,t))})},t);o.unref?.();const s=()=>{this._settle(e.showId,()=>{i(pe(n.reason))})};n.addEventListener("abort",s,{once:!0});const a=()=>{clearTimeout(o),n.removeEventListener("abort",s)};this._pending.set(e.showId,{request:e,resolve:r,reject:i,timeoutId:o,dispose:a});for(const c of this._listeners)c(e)}))}completeShow(e){this._settle(e,t=>{t.resolve()})}hasPendingShow(e){return this._pending.has(e)}failShow(e,t){this._settle(e,n=>{n.reject(t)})}rejectAll(e){this._rejectPending(e),this._activeRequest=null}_settle(e,t){const n=this._pending.get(e);n&&(n.dispose(),this._pending.delete(e),this._activeRequest?.showId===e&&(this._activeRequest=null),t(n))}_rejectPending(e){for(const[,t]of this._pending)t.dispose(),t.reject(e);this._pending.clear()}};function Mf(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function kf(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=ls(e),n=cs(e),r=Gc(e.sandbox);t<n+r}var Qs=class{_controller=new AbortController;_externalSignalDisposable=new ie;_sessionChangeListeners=new Set;_showRegistry=new xf;_timeouts;_generation=0;_sessionStarted=!1;_externalSignal;get signal(){return this._controller.signal}get externalSignal(){return this._externalSignal}get generation(){return this._generation}get contentReadyTimeoutMs(){return ls(this._timeouts)}getSandboxTimeoutMs(e){return as(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return cs(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=Mf(this._timeouts,e.timeouts),kf(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,e.signal!==void 0&&(this._externalSignal=e.signal),t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}relinkExternalSignal(e){this._externalSignal=e,this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new ie,this._linkExternalSignal(e)}abort(e){const t=e??pe("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new ie}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new ie,this._showRegistry.rejectAll(pe("Init session replaced")),this._controller.signal.aborted||this._controller.abort(pe("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??pe()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??pe()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},Zr=(()=>{const e=new Qs;return e.configure({}),e})(),Lf=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 Nf(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 Ff(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(Y(n),new Promise((r,i)=>{let o=!1,s,a;const c=f=>{o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),a?.dispose(),n?.removeEventListener("abort",d),f())},d=()=>{c(()=>i(pe(n?.reason)))};if(a=e.onInit(()=>{e.isInited()&&e.getTarget()&&c(()=>r())}),e.isInited()&&e.getTarget()){c(()=>r());return}t>0&&(s=setTimeout(()=>{c(()=>i(new Lf(t)))},t)),n?.addEventListener("abort",d)}))}var jf=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 Bf(e,t,n){return t<=0?e:new Promise((r,i)=>{let o=!1,s;const a=c=>{o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),c())};s=setTimeout(()=>{a(()=>i(new jf(n,t)))},t),e.then(c=>{a(()=>r(c))},c=>{a(()=>i(c))})})}var Uf=2,ft=Symbol("sandbox:frame-replaced");function Ni(e){return e===ft}function we(e,t,n,r,i,o,s){const a=`sandbox:${t}`,c=o?.getSandboxTimeoutMs(t)??jr[t],d=()=>{let T=Bf(e.sendAsync(n,r),c,a);return T=rn(T,o?.signal),bt(a,T,i)};if(t==="INIT_START"&&Nf(e)){const T=o?.getSandboxReadyTimeoutMs()??2e4,w=e,g=C=>{const _=Ff(w,T,o?.signal);return bt("sandbox:INIT_START:ready-wait",_,i).then(()=>{if(!s||C<=0)return d();const P=s.getGeneration();let S;const M=new Promise((E,A)=>{S=s.onChange(()=>{s.getGeneration()!==P&&A(ft)})}),v=d();return v.catch(()=>{}),Promise.race([v,M]).finally(()=>S?.()).catch(E=>{if(E!==ft)throw E;return{...i},g(C-1)})})};return g(Uf)}if(!s)return d();const f=s.getGeneration();let h;const y=new Promise((T,w)=>{h=s.onChange(()=>{s.getGeneration()!==f&&w(ft)})}),b=d();return b.catch(()=>{}),Promise.race([b,y]).finally(()=>h?.()).catch(T=>{throw T===ft&&{...i},T})}var Hf=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],$f=200;function Zs(e=new Set){const t=new Set;return(n,r)=>{if(!Hf.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>=$f&&t.clear(),t.add(i))}}function ea(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:Zs()}}var Gf=ea();function ze(e){return e?.getInstance(Cr)??Gf}function Vf(e){const t=Le(e),n=ae(e),r=()=>e.getInstance(Ae)??Zr;let i,o,s=!1,a=!1;const c=async(_,P,S)=>{const M=S.generation,v=()=>S.generation!==M||S.signal.aborted||t.current()!==_||a,E=be(n);s=!0;try{if(await we(n,"INIT_START",$.SANDBOX_INIT_START,{guid:P},void 0,S),v())return;const{html:A,hasBrowserExtensionArtifacts:m}=Xs(sn(_));if(m&&fe(e,j.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),Js(_,A),await we(n,"SET_ENTITY",$.SANDBOX_SET_ENTITY,an(sn(_),P,ze(e).editorPolicy,_.get().version),void 0,S),v())return;await we(n,"INITED",$.SANDBOX_INITED,{guid:P},void 0,S),i=P,o=E}finally{s=!1}},d=()=>ye(t.sessionKey())?t.current():void 0,f=()=>{if(a||s)return;const _=d(),P=_?.get().docId;if(!_||!P||i===P&&o===be(n)||!_.isReady())return;const S=r();S.signal.aborted||c(_,P,S).catch(()=>{})};let h=!1;const y=()=>{h||a||(h=!0,queueMicrotask(()=>{h=!1,f()}))};let b,T;const w=()=>{const _=d(),P=_?.get().docId;P!==T&&(b?.(),T=P,b=_?.subscribe(y)),y()},g=t.subscribe(w),C=er(n,y);w(),e.getInstance(U)?.addDispose(()=>{a=!0,C(),b?.(),g()})}var qf=200;function zf({startVersion:e,limit:t=qf}){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 a=n.filter(d=>d.version>s);i(s);let c=o;for(const d of a){if(d.contentReplaced||!d.changes)return null;const f=d.changes,h=[];for(const y of c){if(d.fromCanvas&&f.some(T=>y.range.start<=T.oldEnd&&y.range.end>=T.oldPosition))return null;const b=ed(y.range,f,"after");if(!b)return null;h.push({range:b,text:y.text})}c=h}return c}}}function Wf(e,t){let n=0;return e.map(({start:r,end:i,text:o})=>{const s=new ge(r,t.slice(r,i),r+n,o);return n+=o.length-(i-r),s})}function Kf(e,t){const n=[...e].sort((r,i)=>r.range.start-i.range.start);return Wf(n.map(({range:r,text:i})=>({start:r.start,end:r.end,text:i})),t)}function Yf(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var ei=F("canvas.sandboxFill");function ta(e){return e.getInstance(ei)?.pipeline.isEventsLocked()===!0}function qt(e){St(e,{origin:"canvas-channel"})}function Xf(e){const t=Le(e),n=ae(e);let r;const i=(c,d)=>{const f=c.get().docId;let h=!1,y=null,b=null;const T=zf({startVersion:c.get().version});let w=c.getContent(),g=!0;const C=(E,A)=>{!g||t.current()!==c||(St(A,{origin:"canvas-channel"}),n.sendAsync($.SANDBOX_SET_ENTITY,an(sn(c),f,ze(e).editorPolicy,c.get().version)).catch(qt))},_=async(E,A)=>{if(b){b.push({edits:E,rev:A});return}b=[{edits:E,rev:A}];try{do{const m=b.splice(0,b.length);await n.sendAsync($.SANDBOX_UPDATE_ENTITY,{edits:m.map(l=>l.edits),guid:f,rev:m[m.length-1].rev})}while(b.length)}catch(m){C("app edits failed to reach the canvas",m)}finally{b=null}},P=(E,A)=>{const m=b?.splice(0,b.length)??[];m.length&&n.sendAsync($.SANDBOX_UPDATE_ENTITY,{edits:m.map(l=>l.edits),guid:f,rev:m[m.length-1].rev}).catch(qt),n.sendAsync($.SANDBOX_UPDATE_ENTITY,{edits:[E],guid:f,rev:c.get().version,...A!==null?{changeId:A}:{}}).catch(qt)},S=E=>{const{guid:A,pushUndoStop:m}=E;if(A!==f)return;const l=ud(E);let{edits:u}=E;if(l.baseRev!==null){const R=T.rebase(u,l.baseRev);if(!R){St(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),P([],l.changeId);return}u=R}const p=c.get().version;try{h=!0,y=l.changeId;const R=Kf(u,c.getContent());m===!1?d.applyWithoutHistory(R):c.mutate({changes:R},{source:ta(e)?"system":"user"})}catch(R){C("canvas batch failed to apply",R);return}finally{h=!1,y=null}c.get().version===p&&l.baseRev!==null&&P([],l.changeId)},M=c.subscribe(({changes:E,version:A})=>{const m=c.getContent(),l=!E?.length&&m!==w;if(w=m,T.record({version:A,changes:E,contentReplaced:l,fromCanvas:h}),!E?.length)return;const u=Yf(E);h?P(u,y):_(u,A).catch(qt)}),v=n.addListener($.APPLICATION_UPDATE_ENTITY,S);return()=>{g=!1,M(),v.dispose()}};let o;const s=()=>{const c=t.current(),d=t.history(),f=c?.get().docId;f!==o&&(r?.(),r=void 0,o=f,c&&d&&(r=i(c,d)))},a=t.subscribe(s);s(),e.getInstance(U)?.addDispose(()=>{r?.(),a()})}var Jf=/^(?:ant|vscode|monaco|docs)-/;function Qf(e){return Jf.test(e)}function Zf(){const e="ub".trim();if(!/^[a-z][a-z0-9]*$/i.test(e))throw new Error(`[cssVars] REACT_APP_CSS_VAR_PREFIX="${e}" is not a valid CSS identifier fragment.`);return e}var ep=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function tp(){return ep}var np=new Set;function rp(e,t,n=np){return e.startsWith(`${t}-`)?!1:!Qf(e)&&!n.has(e)}function ip(e,t){return`--${t}-${e}`}function na(e){const t=Zf();return rp(e,t,tp())?ip(e,t):`--${e}`}function op(e,t){const n=na(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function sp(e,t){return op(e,t)}function qe(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.parentNode;return n instanceof ShadowRoot&&n.host instanceof HTMLElement?n.host:null}function Ue(e){return!e||e==="none"}function ap(e){const t=e.contain??"",n=e.willChange??"";return!Ue(e.transform)||!Ue(e.perspective)||!Ue(e.filter)||!Ue(e.backdropFilter)||!Ue(e.translate)||!Ue(e.rotate)||!Ue(e.scale)||/transform|perspective|filter/.test(n)||/paint|layout|strict|content/.test(t)||!!e.containerType&&e.containerType!=="normal"}function Fi(e){const t=/paint|strict|content/.test(e.contain??"");return{x:t||!!e.overflowX&&e.overflowX!=="visible",y:t||!!e.overflowY&&e.overflowY!=="visible"}}function lp(e){const t=[],n=document.documentElement,r=Fi(getComputedStyle(n)),i=r.x||r.y;let o="none";const s=getComputedStyle(e).position;(s==="absolute"||s==="fixed")&&(o=s);for(let a=qe(e);a&&a!==n;a=qe(a)){const c=getComputedStyle(a),d=o==="none"||ap(c)||o==="absolute"&&!!c.position&&c.position!=="static",f=a===document.body&&!i;if(d){o="none";const h=f?{x:!1,y:!1}:Fi(c);(h.x||h.y)&&t.push({node:a,...h})}(c.position==="absolute"||c.position==="fixed")&&(o==="none"||c.position==="fixed")&&(o=c.position==="fixed"?"fixed":"absolute")}return t}function ra(e){const t=e.getBoundingClientRect(),n=e.offsetWidth>0&&t.width>0?t.width/e.offsetWidth:1;return{x:n,y:e.offsetHeight>0&&t.height>0?t.height/e.offsetHeight:n}}function zt(e){return Number.parseFloat(e)||0}function nr(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=ra(e),i=zt(n.borderLeftWidth),o=zt(n.borderTopWidth),s=zt(n.borderRightWidth),a=zt(n.borderBottomWidth),c=e.offsetWidth>0?Math.max(0,e.offsetWidth-e.clientWidth-i-s):0,d=e.offsetHeight>0?Math.max(0,e.offsetHeight-e.clientHeight-o-a):0;return{left:t.left+i*r.x,top:t.top+o*r.y,right:t.right-(s+c)*r.x,bottom:t.bottom-(a+d)*r.y}}function cp(e,t,n){const r={left:e.left,top:e.top,right:e.right,bottom:e.bottom},i=(o,s,a)=>{s&&(r.left=Math.max(r.left,o.left),r.right=Math.min(r.right,o.right)),a&&(r.top=Math.max(r.top,o.top),r.bottom=Math.min(r.bottom,o.bottom))};return t.forEach(o=>i(nr(o.node),o.x,o.y)),n&&i(nr(n),!0,!0),r}var rr={originX:0,originY:0,scaleX:1,scaleY:1};function ln(e,t){return{left:(e.left-t.originX)/t.scaleX,top:(e.top-t.originY)/t.scaleY,width:Math.max(0,e.right-e.left)/t.scaleX,height:Math.max(0,e.bottom-e.top)/t.scaleY}}function ia(e,t,n){const r=t.width>0&&e.width>0?e.width/t.width:n.scaleX,i=t.height>0&&e.height>0?e.height/t.height:r;return{originX:e.left-t.left*r,originY:e.top-t.top*i,scaleX:r,scaleY:i}}function oa(e,t){return Math.abs(e.left-t.left)<=.5&&Math.abs(e.top-t.top)<=.5&&Math.abs(e.width-(t.right-t.left))<=.5&&Math.abs(e.height-(t.bottom-t.top))<=.5}var dp=1e3;function up(e){const{slot:t,own:n}=e;let r,i=0,o=!1;const s=()=>{if(r=void 0,!o){if(!t.isConnected||!n.isConnected){e.onDetached();return}(e.measure()||performance.now()<i)&&(r=window.requestAnimationFrame(s))}},a=()=>{!o&&r===void 0&&(r=window.requestAnimationFrame(s))},c=()=>{i=performance.now()+dp,a()},d=[window],f=[document.documentElement];for(let g=t;g;g=qe(g)){const C=g.getRootNode();C instanceof ShadowRoot&&!d.includes(C)&&(d.push(C),f.push(C))}const h=[["scroll",a],["load",a],["transitionrun",c],["transitionend",a],["transitioncancel",a],["animationstart",c],["animationend",a],["animationcancel",a]];d.forEach(g=>h.forEach(([C,_])=>g.addEventListener(C,_,{capture:!0,passive:!0}))),window.addEventListener("resize",a),document.fonts?.addEventListener?.("loadingdone",a);const y=typeof MutationObserver=="function"?new MutationObserver(g=>{g.some(C=>!n.contains(C.target))&&a()}):void 0;f.forEach(g=>y?.observe(g,{attributes:!0,childList:!0,subtree:!0,characterData:!0}));let b;try{if(typeof ResizeObserver=="function"){const g=new ResizeObserver(a);typeof g.observe=="function"&&(b=g)}}catch{b=void 0}let T=[];return{schedule:a,observe:g=>{!b||g.length===T.length&&g.every((C,_)=>C===T[_])||(b.disconnect(),T=g,g.forEach(C=>b?.observe(C)))},dispose(){o=!0,r!==void 0&&(window.cancelAnimationFrame(r),r=void 0),d.forEach(g=>h.forEach(([C,_])=>g.removeEventListener(C,_,{capture:!0}))),window.removeEventListener("resize",a),document.fonts?.removeEventListener?.("loadingdone",a),y?.disconnect(),b?.disconnect()}}}var sa=300,ji=15e3,fp=5e3,Bi="em-canvas-busy-style";function pp(){if(document.getElementById(Bi))return;const e=document.createElement("style");e.id=Bi,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var hp="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z";function mp(e){const t=sp("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(na("colorPrimary")).trim()||t}function aa(e){pp();const t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("viewBox","0 0 1024 1024"),n.setAttribute("width","48"),n.setAttribute("height","48"),n.setAttribute("fill","currentColor"),n.setAttribute("aria-hidden","true");const r=document.createElementNS(t,"path");r.setAttribute("d",hp),n.appendChild(r);const i=document.createElement("span");return i.setAttribute("role","img"),i.setAttribute("aria-label","loading"),i.setAttribute("style",`display:inline-flex;color:${mp(e)};animation:em-canvas-busy-spin 1s linear infinite`),i.appendChild(n),i}function gp(e,t,n){const r=t??e,i=Math.max(r.left,e.left,0),o=Math.min(r.right,e.right,n.width),s=Math.max(r.top,e.top,0),a=Math.min(r.bottom,e.bottom,n.height);return o<=i||a<=s?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(i+o)/2-e.left,y:(s+a)/2-e.top}}function vp(e,t){const n=e.getBoundingClientRect(),r=document.createElement("div");r.setAttribute("aria-busy","true"),Object.assign(r.style,{position:"fixed",left:`${n.left}px`,top:`${n.top}px`,width:`${n.width}px`,height:`${n.height}px`,cursor:"progress"}),e.appendChild(r);const i={left:n.left,top:n.top,right:n.right,bottom:n.bottom},o=r.getBoundingClientRect();if(o.width>0&&!oa({left:o.left,top:o.top,width:o.width,height:o.height},i)){const s=ln(i,ia(o,ln(i,rr),rr));Object.assign(r.style,{left:`${s.left}px`,top:`${s.top}px`,width:`${s.width}px`,height:`${s.height}px`})}return{showSpinner(){r.style.background="rgba(128, 128, 128, 0.15)";const s=gp(n,t(),{width:window.innerWidth,height:window.innerHeight}),a=document.createElement("div");Object.assign(a.style,{position:"absolute",left:`${s.x}px`,top:`${s.y}px`,transform:"translate(-50%, -50%)",lineHeight:"0"}),a.appendChild(aa(e.querySelector(".ant-app")??e)),r.appendChild(a)},remove:()=>r.remove()}}function Rn(e){const t=document.createElement("div");t.setAttribute("aria-busy","true"),Object.assign(t.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"progress"});const n=getComputedStyle(e).position!=="static";n||(e.style.position="relative"),e.appendChild(t);const r=setTimeout(()=>{t.appendChild(aa(e))},sa);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var bp=8e3;function yp(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),followReload:()=>{},moveTo:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,slot:null,whenShown:()=>Promise.resolve(),filled:void 0,noteFilled:()=>{},alignTo:()=>{},resize:()=>{},dispose:()=>{}}}function Ep(e,t){for(let n=qe(e);n;n=qe(n)){const r=getComputedStyle(n),i=r.overflowX!=="visible"||r.overflowY!=="visible",o=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(s=>Ye(s)>0);if(i&&o)return n;if(n===t)return null}return null}function Ye(e){return Number.parseFloat(e)||0}function Wt(e,t){return Math.abs(e-t)<=1}function _p(e){const t=getComputedStyle(e),n=Ye(t.borderTopWidth),r=Ye(t.borderRightWidth),i=Ye(t.borderBottomWidth),o=Ye(t.borderLeftWidth),s=(a,c,d)=>Math.max(0,Ye(a)-Math.max(c,d));return{...nr(e),radii:[s(t.borderTopLeftRadius,n,o),s(t.borderTopRightRadius,n,r),s(t.borderBottomRightRadius,i,r),s(t.borderBottomLeftRadius,i,o)]}}function wp(e,t){const n=Wt(t.top,e.top),r=Wt(t.bottom,e.bottom),i=Wt(t.left,e.left),o=Wt(t.right,e.right),s=[n&&i?e.radii[0]:0,n&&o?e.radii[1]:0,r&&o?e.radii[2]:0,r&&i?e.radii[3]:0];return s.every(a=>a===0)?"":s.map(a=>`${a}px`).join(" ")}function Sp(e,t,n,r,i,o){const s=n.readyTimeoutMs??bp,a=document.createElement("div");a.dataset.canvasHost=e,r&&(a.dataset.canvasPlace=r),a.style.position="fixed",a.style.overflow="hidden",a.style.visibility="hidden";const c=n.resolveSrc(e),d=document.createElement("iframe");d.setAttribute("sandbox",n.resolveSandbox(c)),d.setAttribute("allow","clipboard-read; clipboard-write"),d.setAttribute("title","Email content"),d.style.width="100%",d.style.border="0",d.style.display="block",d.style.minHeight="600px",d.src=c,a.appendChild(d),t.appendChild(a),n.mark?.("created"),i||n.onCreated?.(d);const f=new ie;let h=!1,y,b=!1,T,w,g,C;const _=()=>{clearTimeout(C),C=setTimeout(()=>{b||(b=!0,w?.(new Error(`[canvas] ${e}: документ не загрузился за ${s} мс`)))},s)},P=()=>h?(g=Promise.resolve(),b=!0,g):(b=!1,g=new Promise((N,H)=>{T=N,w=H}),_(),g),S=()=>{if(clearTimeout(C),h=!0,b){g=Promise.resolve();return}b=!0,n.mark?.("loaded"),T?.()};d.addEventListener("load",S),f.addDispose(()=>{clearTimeout(C),d.removeEventListener("load",S)});let M;const v=()=>{M??=n.bindResizer?.(d)},E=()=>{M?.dispose(),M=void 0};let A=null,m=null,l,u=rr,p="",R="",D=0;const L=N=>{const H=JSON.stringify(N);return H===p?!1:(p=H,a.style.visibility=N.visibility,a.style.left=`${N.css.left}px`,a.style.top=`${N.css.top}px`,a.style.width=`${N.css.width}px`,a.style.height=`${N.css.height}px`,a.style.borderRadius=N.radius,d.style.width=N.elementWidth>0?`${N.elementWidth}px`:"100%",d.style.transform=N.shiftX!==0?`translate(${N.shiftX}px, ${N.shiftY}px)`:`translateY(${N.shiftY}px)`,!0)},I=()=>{if(!A)return p="",a.style.visibility="hidden",d.removeAttribute("id"),!1;n.elementId&&(d.id=n.elementId);const N=A.getBoundingClientRect(),H=lp(A),W=m?.isConnected?m:null;l?.observe([A,d,...H.map(q=>q.node),...W?[W]:[]]);const z=cp(N,H,W),ne=Math.max(0,z.right-z.left),Re=Math.max(0,z.bottom-z.top),st=getComputedStyle(A).visibility==="visible",Fe=ne<=0||Re<=0,Pe=Fe?{left:z.left,top:z.top,right:z.left,bottom:z.top}:z,Ut=Fe?null:Ep(A,W??H[0]?.node??null),x=Ut?wp(_p(Ut),Pe):"",V=q=>L({visibility:st?"":"hidden",css:ln(Pe,q),elementWidth:N.width/q.scaleX,shiftX:(N.left-Pe.left)/q.scaleX,shiftY:(N.top-Pe.top)/q.scaleY,radius:x});let G=V(u);if(!Fe){const q=a.getBoundingClientRect();q.width>0&&!oa({left:q.left,top:q.top,width:q.width,height:q.height},Pe)&&(u=ia(q,ln(Pe,u),u),G=V(u)||G)}return G},O=()=>{if(!A)return!1;let N=I();const H=d.getBoundingClientRect().height;H>0&&H!==D&&(D=H,A.style.height=`${H/ra(A).y}px`,N=!0);const W=getComputedStyle(A).pointerEvents;return W!==R&&(R=W,a.style.pointerEvents=W),N},k=()=>{l?.dispose(),l=void 0},ee=N=>{l=up({slot:N,own:a,measure:O,onDetached:k})};let ce=[];const X=(N,H)=>{if(m=H,N&&ce.length>0){const W=ce;ce=[],W.forEach(z=>z())}if(N===A){N&&!l&&ee(N),O();return}if(k(),A&&A.style.removeProperty("height"),p="",D=0,R="",A=N,!N){I(),E();return}n.onShown?.(d),ee(N),O(),v()};f.addDispose(k);const J=N=>{h=!1,y=void 0,o?.(),N&&n.onReload?.(d);let H;b||g===void 0?H=P():(_(),H=g);try{d.contentWindow?.location.reload()}catch{d.src=c}return H};return{element:d,ready(){return g??P()},reload:()=>J(!0),reloadQuietly:()=>J(!1),followReload:()=>{y=void 0,o?.(),n.onReload?.(d)},moveTo(N){if(a.parentNode===N)return g??P();h=!1,y=void 0,o?.();let H;return b||g===void 0?H=P():(_(),H=g),N.appendChild(a),n.onReload?.(d),p="",l?.schedule(),H},get shown(){return A!==null},get slot(){return A},whenShown(){return A!==null?Promise.resolve():new Promise(N=>{ce.push(N)})},get filled(){return y},noteFilled(N){y=N},alignTo(N,H){X(N,H??null)},scrollBy(N,H){let W=N,z=H;for(let ne=A?qe(A):null;ne;ne=qe(ne)){if(Math.abs(W)<1&&Math.abs(z)<1)return;const Re=getComputedStyle(ne);if((Re.overflowY==="auto"||Re.overflowY==="scroll")&&ne.scrollHeight>ne.clientHeight){const st=ne.scrollTop,Fe=ne.scrollLeft;ne.scrollBy({left:W,top:z,behavior:"instant"}),W-=ne.scrollLeft-Fe,z-=ne.scrollTop-st}}(Math.abs(W)>=1||Math.abs(z)>=1)&&window.scrollBy({left:W,top:z,behavior:"instant"})},resize(){M?.resize()},dispose(){X(null,null),E(),f.dispose(),a.remove()}}}function Ip(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",i=(u,p)=>u==="email"?`email:${p??n}`:u,o=new Map;let s,a=[],c=!1,d,f,h=!1,y,b,T="shown",w=0,g,C,_;const P=u=>f!==void 0&&u.filled!==void 0&&u.filled!==f,S=()=>{g=void 0;const u=y;!h||!u||f===void 0||C===f||!P(u)||(C=f,e.onForeignDocument?.({wanted:f,filled:u.filled,role:T,heldMs:Date.now()-w}))},M=()=>{h=!1,y=void 0,b=void 0,clearTimeout(g),g=void 0},v=(u,p)=>{const R=o.get("email"),D=R?.slot??null;return u&&D&&P(u)?(u.alignTo(null),h||(h=!0,w=Date.now(),g=setTimeout(S,fp)),T=p,y=u,!(s!==void 0||c)&&b!==u&&(b=u,e.onShown?.(u.element)),!d&&!s&&(d=Rn(D)),!1):(h&&(M(),d?.remove(),d=void 0),u?.alignTo(D,R?.clip??null),!0)},E=()=>{h&&!c&&v(t.get(i("email")),"shown")},A=()=>{a.forEach(u=>clearTimeout(u)),a=[],s?.remove(),s=void 0,d?.remove(),d=void 0,(c||h)&&(c=!1,v(t.get(i("email")),"shown"))},m=(u,p,R)=>{const D=i(u,p),L=t.get(D);if(L)return L;const I=e.resolveMount();if(!I)return yp();const O=Sp(u,I,e,u==="email"?p??n:void 0,R,u==="email"?()=>E():void 0);return t.set(D,O),O},l={get:u=>m(u),current:u=>m(u),peek:u=>t.get(i(u)),spare:()=>t.get(i("email",r())),ensureSpare:()=>m("email",r(),!0),promote(){const u=t.get(i("email",r()));if(!u)return;const p=t.get(i("email"));n=r(),_=void 0,v(u,"spare"),p?.alignTo(null)},alignSurface(u,p,R){const D=o.get(u);if(o.set(u,{slot:p,clip:R??null}),u==="email"&&c){d?.remove(),d=p?Rn(p):void 0;return}const L=p?m(u):t.get(i(u));if(u!=="email"){L?.alignTo(p,R??null);return}if(!p){_=D?.slot&&L?.shown?{slot:D.slot,handle:L}:void 0,h&&(M(),d?.remove(),d=void 0),L?.alignTo(null);return}const I=_?.slot===p&&_.handle===L;if(_=void 0,D?.slot===p&&L?.shown||I){L?.alignTo(p,R??null);return}v(L,"shown")},want(u){f=u,u!==void 0&&E()},noteFilled(u,p){const R=l.byWindow(u);R&&(R.noteFilled(p),R===t.get(i("email"))&&E())},visible(){for(const u of t.values())if(u.shown)return u},byWindow(u){if(u){for(const p of t.values())if(p.element.contentWindow===u)return p}},busy(u){if(A(),!u)return;if(!l.visible()){c=!0,d?.remove(),d=void 0;const D=o.get("email");D?.slot&&(d=Rn(D.slot)),a=[setTimeout(A,ji)];return}const p=e.resolveMount();if(!p)return;const R=vp(p,()=>l.visible()?.element.parentElement?.getBoundingClientRect()??null);s=R,a=[setTimeout(()=>R.showSpinner(),sa),setTimeout(A,ji)]},remount(u){A();const p=i("email");t.forEach((R,D)=>{if(D===p){R.moveTo(u).catch(()=>{});return}R.dispose(),t.delete(D)})},dispose(){f=void 0,c=!1,M(),_=void 0,A(),t.forEach(u=>u.dispose()),t.clear(),o.clear(),n="a",f=void 0,C=void 0}};return l}var Cp=F("canvas.resizerBinder"),ir=F("canvas.service"),Tp={created:le.canvasCreated,loaded:le.canvasLoaded},la=new WeakMap;function or(e){return la.get(e)??0}function Ap(e,t){if(e.getInstance(ir))return;const n=Ip({resolveMount:()=>t.resolveMount(),resolveSrc:i=>t.resolveSrc(i),resolveSandbox:sf,elementId:t.elementId,bindResizer:i=>e.getInstance(Cp)?.(i),onCreated:i=>Qt(e,i,"fresh"),onReload:i=>{la.set(i,or(i)+1),Qt(e,i,"fresh")},onShown:i=>Qt(e,i,"switch"),mark:i=>t.mark?.(Tp[i]),onForeignDocument:i=>{({...i},Kc("canvas identity: place held, frame has another document",{origin:"canvas-identity",level:"warning",tags:{role:i.role},contexts:{canvasIdentity:{...i,path:window.location.pathname}}}))}}),r=ae(e).addListener($.SANDBOX_WHEEL,i=>{n.visible()?.scrollBy(i?.deltaX??0,i?.deltaY??0)});e.inject(ir,n),e.getInstance(U)?.addDispose(()=>{r.dispose(),n.dispose()})}function Qt(e,t,n){const r=ae(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),Hu(r))}function Rp(e,t){Qt(e,t,"promote")}function Pp(e,t){const n=t.contentWindow;n&&ae(e).greet(n)}function ca(e,t){const n=t.contentWindow;n&&ae(e).forget(n)}function Dp(e,t){const n=re(e)?.byWindow(t)?.element;if(!n)return;const r=or(n);return()=>or(n)!==r}function re(e){return e.getInstance(ir)}function Op(e){const t=ae(e),n=()=>re(e)?.byWindow(t.getTarget()),r=t.addListenerAsync($.RELOAD,()=>{n()?.followReload()}),i=t.addOffTargetListener($.RELOAD,a=>{const c=re(e)?.byWindow(a);c&&ca(e,c.element)}),o=t.addListener(a=>{a.data?.operation===$.SANDBOX_RESIZED&&n()?.resize()}),s=te(e,j.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(U)?.addDispose(()=>{r.dispose(),i.dispose(),o.dispose(),s.dispose()})}function Ui(){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 xp(e){const t=e.getInstance(se);let n,r;e.getInstance(U)?.addDispose(()=>{r?.remove(),r=void 0}),Ap(e,{resolveMount:()=>n,resolveSrc:o=>zs(o==="block"),elementId:"email_iframe",mark:o=>Z(o)}),t?.watch(o=>{const s=o?.element;if(n&&s instanceof HTMLElement&&s!==n){n=s,re(e)?.remount(s),r?.remove(),r=void 0;return}if(!n){if(s instanceof HTMLElement)n=s;else if(o!==void 0){n=r??=Ui(),re(e)?.alignSurface("email",r,r);return}else return;re(e)?.get("email")}});let i;e.getInstance(U)?.addDispose(()=>{i?.remove(),i=void 0}),Eu(e).watch(o=>{const s=re(e);if(s){if(o){i??=Ui(),s.alignSurface("email",i,i);return}i&&(s.alignSurface("email",null),i.remove(),i=void 0)}})}var da=F("canvas.headerFlow"),Hi=["subject","preheader"],Mp=3e3,kp={subject:$.SANDBOX_SUBJECT_UPDATE,preheader:$.SANDBOX_PREHEADER_UPDATE};function Lp(e){const t=Le(e),n=ae(e),r=g=>g?"remote":ta(e)?"system":"user",i=(g,{guid:C,value:_,forced:P})=>{const S=dt(t);if(!S||typeof _!="string"||C&&C!==S.get().docId)return;const M=t.forcedHeaders();if(M?.[g]&&!P&&_!==M[g])return;P&&(h.delete(g),h.size===0&&t.endForcedHeaders());const v=S.get().attributes[g]??"";a=!0;try{Ct(S,{[g]:_},{source:r(P)})}finally{a=!1}o[g]=_,fe(e,j.ON_HEADER_APPLIED_ID).fire({field:g,value:_,forced:!!P,isGenerated:_!==v&&!!_})};let o={},s,a=!1,c=Promise.resolve();const d=(g,C,_,P=!1)=>{c=n.sendAsync(kp[g],{value:C,guid:dt(t)?.get().docId,..._?{force:!0,echo:!0}:{},...P?{undoStep:!0}:{}}).catch(S=>{})};let f;const h=new Set;e.inject(da,{whenDelivered:async()=>{await c},reassert:g=>{const C=dt(t),_=Hi.filter(P=>g[P]);if(!(!C||_.length===0)){a=!0;try{Ct(C,Object.fromEntries(_.map(P=>[P,g[P]])),{source:"system"})}finally{a=!1}t.beginForcedHeaders({subject:g.subject??"",preheader:g.preheader??""}),clearTimeout(f),f=setTimeout(()=>{h.clear(),t.endForcedHeaders()},Mp),h.clear();for(const P of _)h.add(P);for(const P of _)o[P]=g[P],d(P,g[P],!0)}}});const y=()=>{s?.(),s=void 0;const g=dt(t);if(!g){o={};return}const C=g.get().attributes;o={subject:C.subject,preheader:C.preheader},s=g.subscribe(({source:_})=>{if(a)return;const P=g.get().attributes,S=t.forcedHeaders();for(const M of Hi){const v=P[M];v!==o[M]&&(o[M]=v,d(M,v??"",_==="system"&&S?.[M]!==void 0,_==="user"))}})};y();const b=t.subscribe(y),T=n.addListenerAsync($.APPLICATION_SUBJECT_UPDATE,g=>i("subject",g)),w=n.addListenerAsync($.APPLICATION_PREHEADER_UPDATE,g=>i("preheader",g));e.getInstance(U)?.addDispose(()=>{T.dispose(),w.dispose(),b(),s?.(),clearTimeout(f)})}function $i(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function sr(e,t){const n={...e};for(const r of Object.keys(t)){const i=t[r],o=e[r];$i(i)&&$i(o)?n[r]=sr(o,i):i!==void 0&&(n[r]=i)}return n}function Np(e,t){const n=Pr;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 sr(n,i)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?sr(n,t):n}function Fp(){const e=window.localStorage.getItem(Mt.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?nc:Ul;return e&&e!=="system"?e:t}function jp(){const e=window.localStorage.getItem(Mt.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 Bp(e){const{config:t}=e;return{operation:$.UPDATE_PREVIEW,theme:e.theme,commonStyles:Np(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}}var Up=F("DefaultCommonStyles");function ua(e){return e.getOrCreateInstance(Up,()=>Ee(void 0))}function Hp(e,t){ua(e).set(t)}function $p(e){const t=ae(e),n=e.getInstance(oe),r=e.getInstance(se),i=Le(e);let o,s="";const a=()=>{const _=n?.get()??{},P=Bp({config:_,emailCommonStyles:i.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:Fp(),codeMode:jp(),appName:"useblocks"}),S=JSON.stringify(P);S!==s&&(s=S,t.send(P))},c=t.onInit(()=>{s="",a()}),d=()=>{t.isInited()&&a()},f=n?.watch(d),h=ua(e).watch(_=>{o=_,d()}),y=r?.watch(_=>{_&&"commonStyles"in _&&(o=_.commonStyles),d()});let b;const T=()=>{b?.(),b=i.current()?.subscribe(d),d()};T();const w=i.subscribe(T),g=matchMedia(Vl),C=()=>d();g.addEventListener("change",C),e.getInstance(U)?.addDispose(()=>{c.dispose(),f?.dispose(),h.dispose(),y?.dispose(),b?.(),w(),g.removeEventListener("change",C)})}var ar;(function(e){function t(i,o,s=(a,c)=>a===c){if(i===o)return!0;if(i.length!==o.length)return!1;for(let a=0;a<i.length;a++)if(!s(i[a],o[a]))return!1;return!0}e.isEqual=t;function n(i,o=s=>s){const s=new Set;return i.filter(a=>{const c=o(a);return s.has(c)?!1:(s.add(c),!0)})}e.unique=n;function r(i=[],o=[],s=(a,c)=>a===c){const a=[],c=[],d=[];for(const f of i){const h=o.find(y=>s(f,y));h?d.push({prev:f,next:h}):c.push(f)}for(const f of o)i.find(h=>s(f,h))||a.push(f);return{added:a,removed:c,exists:d}}e.diff=r})(ar||(ar={}));function Gp(e,t){return e.type===t.type&&e.key===t.key}function Vp(e){const t=ae(e),n=()=>e.getServices(Xe)??[];let r=[];const i=t.onInit(()=>{r=n(),t.send($.SANDBOX_ADD_EXTENSIONS,r)}),o=Tl(Xe),s=e.onInject(a=>{if(a!==o)return;const c=n();if(!t.isInited()){r=c;return}const{added:d,removed:f}=ar.diff(r,c,Gp);if(r=c,f.length){if(f.some(h=>h.type==="script")){t.send($.RELOAD);return}t.send($.SANDBOX_REMOVE_EXTENSIONS,f.map(h=>h.key))}d.length&&t.send($.SANDBOX_ADD_EXTENSIONS,d)});e.getInstance(U)?.addDispose(()=>{i.dispose(),s?.dispose()})}var qp=new Set([...Object.values($).map(e=>String(e)),"INIT_MESSAGE","FETCH_USER","USER_LOGGED_IN",String(Rr)]);function zp(e){return e.length>0&&!e.startsWith("em:")&&!qp.has(e)}function Wp(e){const t=ae(e),n=new Map;let r=!1,i=-1,o=new Set;const s=d=>(d!==i&&(i=d,o=new Set),o),a=t.observeOutgoing((d,f)=>{if(!r||!zp(d))return;const h=be(t);n.set(d,{data:f,generation:h,scripts:new Set(s(h))})}),c=t.addListener(Rr,d=>{if(d.phase!=="ready"||d.status!=="success")return;r=!0;const f=be(t),h=s(f);h.add(d.key);for(const[y,b]of n)b.generation===f||![...b.scripts].every(T=>h.has(T))||(b.generation=f,t.send(Wo(y),b.data))});e.getInstance(U)?.addDispose(()=>{a.dispose(),c.dispose()})}var Kp=F("prewarm.editorVisible");function Yp(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function Xp(e={}){const t=e.paint??Yp;let n=!1,r=!1,i=!1,o=!1,s=!1;const a=[],c=()=>{s||o||!n||!r||!i||(o=!0,t(()=>{s=!0,Z(le.editorVisible);for(const d of a.splice(0))d()}))};return{noteShellVisible(){n=!0,c()},notePagePainted(){r=!0,c()},noteContentShown(){i=!0,c()},whenVisible(d){if(s){d();return}a.push(d)},contentShown:()=>i}}function Jp(e){return e.getOrCreateInstance(Kp,()=>Xp())}var Qp=500,Zp=500,eh=5e3;function th(e){const t=e.quietMs??Qp,n=e.floorMs??Zp,r=e.ceilingMs??eh;let i,o,s=0;const a=()=>{clearTimeout(i),clearTimeout(o),i=void 0,o=void 0},c=()=>{a(),e.run()},d=()=>{clearTimeout(i);const f=n-(Date.now()-s);i=setTimeout(c,Math.max(t,f))};return{start(){a(),s=Date.now(),o=setTimeout(c,r),d()},notify(){i!==void 0&&d()},cancel:a}}function nh({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},a={...e,...s};return Object.defineProperty(a,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),a}var fa="self-init:";function rh(e){return e.startsWith(fa)}function pa(e,t){const n=e.getActiveShowRequest();return rh(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function ih(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t(),i=()=>e.frameWatch?.();let o="",s;const a=T=>{s={target:e.readTarget?.(),docId:T}},c=()=>e.readDocument()?sn(e.readDocument()):o,d=()=>ze(e.container).editorPolicy,f=()=>e.readEmail(),h=()=>{const T=f();return{...T,id:e.isTemplate()||T.isNew?void 0:T.id,html:c()}};let y=!1;const b={readContent:c,publicEmail:h,sendInitStart:()=>we(n,"INIT_START",$.SANDBOX_INIT_START,{guid:f().renderGuid},void 0,r()),sendInited:()=>we(n,"INITED",$.SANDBOX_INITED,{guid:f().renderGuid},void 0,r(),i()),async sendContent(){const T=f(),{html:w,hasBrowserExtensionArtifacts:g}=Xs(T?.html||"");g&&e.events.browserExtensionDetected(),Js(e.readDocument(),w),o=w,a(T.renderGuid),await we(n,"SET_ENTITY",$.SANDBOX_SET_ENTITY,an(c(),T.renderGuid,d(),e.readDocument()?.get().version),{guid:T.renderGuid,emailId:T.id??null},r(),i())},refreshContent:()=>(a(f().renderGuid),we(n,"SET_ENTITY",$.SANDBOX_SET_ENTITY,an(c(),f().renderGuid,d(),e.readDocument()?.get().version),void 0,r(),i())),sendPreheader:async()=>{const T=f();if(T.preheader!==void 0)return we(n,"PREHEADER",$.SANDBOX_PREHEADER_UPDATE,{value:T.preheader,guid:T.renderGuid,force:!0},void 0,r(),i())},sendSubject:async()=>{const T=f();if(T.subject!==void 0)return we(n,"SUBJECT",$.SANDBOX_SUBJECT_UPDATE,{value:T.subject,guid:T.renderGuid,force:!0},void 0,r(),i())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:T=>e.showFilled?.(T),noteFilled:(T,w)=>e.noteFilled?.(T,w),contentSent:()=>s,readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(h()),fireInit(T,w){if(!pa(t(),T)){t().getActiveShowRequest()?.showId;return}const g=f();g.id,g.renderGuid,t().completeShow(T);const C=e.readDocument();Ct(C,{is_inited:!0},{source:"system"});const _=()=>{const S=h();w&&(S.reset=!0);const M=e.events.inited(S);return w||(y&&b.fireEmailChanged(),y=!0),M};if(!C||C.isReady())return _();const{docId:P}=C.get();return C.whenReady().then(()=>e.readDocument()?.get().docId===P?_():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(h())},fireContentChanged(){e.events.contentChanged(c())}};return b}var oh=2;function Gi(){return new Error("[sandbox] document reloaded during fill")}function sh(e,t,n){return{showId:e,reset:t,emailId:n?.id,renderGuid:n?.renderGuid}}function Pn(e){try{e()}catch{}}function ah(e){let t;return Pn(()=>{t=e()}),{stage:n=>Pn(()=>t?.stage(n)),end:(n,r)=>Pn(()=>t?.end(n,r))}}function lh(e){const t=()=>e.initPipeline();let n=!1,r,i,o,s=0,a,c;const d=()=>{const v=e.readTarget?.(),E=e.readSandboxGeneration?.();return v===void 0||E===void 0?void 0:{target:v,generation:E}},f=()=>{const v=d();return v&&{...v,canvasReplaced:e.trackDocument?.(v.target)}},h=v=>{if(v?.canvasReplaced?.())return!0;const E=d();return v!==void 0&&E?.target===v.target&&E.generation!==v.generation},b=ih({...e,waitScope:()=>({getSandboxTimeoutMs:v=>t().getSandboxTimeoutMs(v),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:a?.signal??t().signal}),frameWatch:()=>{const v=c;if(!(!v||!e.onSandboxGenerationChange))return{getGeneration:()=>d()?.generation??v.generation,onChange:E=>e.onSandboxGenerationChange?.(()=>{(e.readTarget?.()===v.target||v.canvasReplaced?.())&&E()})??(()=>{})}}});let T;const w=(v,E)=>{if(T===v)return;T=v;const A=s;setTimeout(()=>{s!==A||t().signal.aborted||P(v,E).catch(()=>{})},0)},g=()=>{a?.abort(),a=void 0};let C;const _=()=>{const v=t().signal;v!==C&&(C?.removeEventListener("abort",g),C=v,v.addEventListener("abort",g))};async function P(v,E,A=0){const m=++s;g(),a=new AbortController,c=void 0,_();const l=()=>s!==m,u=b.readTarget(),p=t().generation,R=()=>p===t().generation&&!t().signal.aborted,D=E?"init:reset-":"init:",L=ah(()=>e.observeShow?.(sh(v,E,e.readEmail())));if(!E){const X=b.publicEmail();X?.id,X?.renderGuid,X?.preheader}let I=!1,O=!1,k,ee=!1;const ce=()=>{if(h(k))throw Gi()};try{n=!0,await b.sendInitStart(),l()||(k=f(),c=k),A===0&&b.fireWillInit(),await(E||A>0?b.refreshContent():b.sendContent()),I=!0,ce();const X=b.contentSent();b.noteFilled(X?.target,X?.docId),L.stage("content"),E||b.publicEmail()?.id;try{await b.sendPreheader()}catch(J){if(Ni(J))throw J;`${D}`,String(J)}try{await b.sendSubject()}catch(J){if(Ni(J))throw J;`${D}`,String(J)}if(ce(),l()||b.showFilled(u),await b.sendInited(),ce(),O=!0,i===v){const J=e.readSandboxGeneration?.()??o;J!==void 0&&(r=J)}L.stage("reveal"),await b.revealFilled(),ce(),L.end("revealed")}catch(X){const J=!l()&&R()&&h(k),N=J?Gi():void 0,H=N??X,W=J&&A<oh?M(v,E,A+1):void 0;ee=J&&W===void 0;const z=l()?void 0:{showId:v,contentApplied:I,sandboxInitedAcked:O,superseded:!1,...e.describeSurface?.(),error:String(N??X)};z&&(`${D}`,void 0);const ne=!l()&&e.recoverFailedFill?.(u)===!0;if(L.end(l()?"superseded":ne?"recovered":Or(H)||!R()?"aborted":"failed",z),!ne&&!l()&&pa(t(),v)&&t().failShow(v,H),W!==void 0)return W;throw H}finally{S(v,E,D,{superseded:l(),sessionGeneration:p,contentApplied:I,sandboxInitedAcked:O&&!ee,retry:!ee,commit:R()})}}function S(v,E,A,m){const{superseded:l,contentApplied:u,sandboxInitedAcked:p}=m;if(l){`${A}`;return}p&&m.commit?b.fireInit(v,E||void 0):p?(`${A}`,m.sessionGeneration,t().generation,t().signal.aborted,void 0):u?(`${A}`,void 0):(`${A}`,void 0),n=!1,a=void 0,!p&&i===v&&(i=void 0,r===o&&(r=void 0)),!p&&u&&m.retry&&w(v,E)}function M(v,E,A){return P(v,E,A)}return{channel:b,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:v=>{r=v},lastCorrelation:()=>i,markCorrelation:v=>{i=v},bumpRunSeq:()=>{s+=1},noteSandboxGeneration:v=>{o=v},fill:v=>P(v,!1),refill:v=>P(v,!0),stop:()=>{s+=1,g(),n=!1,C?.removeEventListener("abort",g),C=void 0}}}function ch(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:ha(e,n)}function ha(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function dh(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:i,readSandboxGeneration:o}=e,s=f=>{const h=n(),y=i();if(!ch(h,f,y)){f.showId,f.navId,f.emailId,h?.id,h?.showId,h?.renderGuid;return}f.showId,h?.id,h?.renderGuid,t.markFilled(o()),t.markCorrelation(f.showId),t.fill(f.showId).catch(()=>{})};return{showRequested:f=>{s(f)},showRequestIdentityChanged:()=>{const f=e.initPipeline().getActiveShowRequest();f&&s(f)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const f=o();if(t.filledGeneration()===f)return;const h=n(),y=i();if(!h?.renderGuid||!ha(h,y))return;const b=`${fa}${h.renderGuid}`;t.markFilled(f),t.markCorrelation(b);const T=r()?.isReady()===!0;h.id,h.renderGuid,(T?w=>t.refill(w):w=>t.fill(w))(b).catch(()=>{t.lastCorrelation()===b&&t.markFilled(void 0)})},saasChanged:()=>{const f=n();f?.renderGuid,f?.showToken,f?.id,r()}}}var uh=F("canvas.health");function fh(e){return e??""}function ph(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Vi(e){return e.length>0}function hh(e){const t=Le(e),n=ae(e),r=()=>ye(t.sessionKey())?void 0:t.current(),i=()=>{const x=r();return nh({attributes:x?.get().attributes??{},readContent:()=>x?.getContent(),docId:x?.get().docId,hasSession:!!x,serverId:x?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(Ae)??Zr;let s={},a=!1;const c=e.getInstance(se)?.watch(x=>{a=!!x?.element});let d=!1,f=!1,h=!1,y=0;const b=()=>{const x=re(e);if(!x)return;const V=++y,G=x.spare();return G&&ca(e,G.element),(G?G.reloadQuietly():x.ensureSpare()?.ready())?.then(()=>{if(V!==y)return;d=!0;const q=x.spare();q&&Pp(e,q.element),h&&(h=!1,p(),N())})},T=th({run:()=>{h||b()?.catch(()=>{})}}),w=()=>{Jp(e).noteContentShown(),!d&&!h&&T.start()};let g=!1;const C=x=>{const V=re(e),G=V?.spare()?.element.contentWindow;f&&V&&G&&x===G&&(f=!1,V.promote(),V.busy(!1),g=!0)};let _=!1;const M=lh({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:i,revealFilled:()=>{const x=re(e);return g&&x&&(g=!1,T.start()),a?x?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:C,noteFilled:(x,V)=>re(e)?.noteFilled(x,V),recoverFailedFill:x=>{const V=re(e),G=V?.spare()?.element.contentWindow;return!f||!V||!G||x!==G?!1:(f=!1,d=!1,l="reload",V.busy(!1),V.peek("email")?.reload(),_=!0,N(),!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!s.isTemplate,readSandboxGeneration:()=>be(n),onSandboxGenerationChange:x=>er(n,x),trackDocument:x=>Dp(e,x),observeShow:x=>e.getInstance(uh)?.begin(x),describeSurface:()=>({canvasPath:l,promoted:f,spareClean:d,handshake:n.isInited(),generation:be(n)}),events:{willInit:x=>{fe(e,j.WILL_EMAIL_INIT_ID).fire(x)},inited:x=>{w(),fe(e,j.ON_EMAIL_INIT_ID).fire(x)},contentChanged:x=>{fe(e,j.ON_CONTENT_CHANGED_ID).fire(x)},emailChanged:x=>{fe(e,j.ON_EMAIL_CHANGED_ID).fire(x)},browserExtensionDetected:()=>{fe(e,j.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),v=dh({pipeline:M,initPipeline:o,readEmail:i,readDocument:r,readRouteEmailId:()=>s.emailId,readSandboxGeneration:()=>be(n)});let E="",A="",m="",l="none";const u=()=>{const x=re(e)?.spare()?.element.contentWindow;x&&n.getTarget()===x||n.sendNow({operation:$.SANDBOX_LOCK_EDIT,data:!0})},p=()=>{const x=re(e)?.spare();x&&(u(),d=!1,f=!0,Rp(e,x.element))},R=(x,V)=>{const G=re(e);if(!G)return!0;const q=G.spare(),je=q&&d?"spare":"prepare";if(l=je,G.busy(!0),q&&d)return p(),!0;T.cancel(),u();const Be=b();if(Be===void 0)return l="reload",G.busy(!1),G.peek("email")?.reload(),!0;h=!0;const De=y;return Be.catch(()=>{!h||De!==y||(h=!1,l="reload",G.busy(!1),G.peek("email")?.reload())}),!1},D=()=>{st(),M.noteSandboxGeneration(be(n));const x=i(),V=ph(x?.renderGuid,x?.showId,x?.id,s.emailId),G=fh(x?.renderGuid);if(G!==A){const Be=A;A=G;const De=re(e)?.peek("email")?.filled,vl=De!==void 0&&De!==G;Vi(G)&&(Vi(Be)||vl)&&R(Be||(De??""),G)}if(h)return;(V!==E||_)&&(_=!1,E=V,v.showRequestIdentityChanged());const q=r(),je=`${V}|${q?.get().docId??""}|${be(n)}`;je!==m&&q?.isReady()===!0&&(m=je,v.selfInitChanged()),v.saasChanged(),X()};let L=!1,I="",O="",k=!1,ee=!1;const ce=x=>{x.source==="user"?ee=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(k=!0),N()},X=()=>{const x=i();if(!x?.renderGuid)return;const V=M.channel.readContent(),G=JSON.stringify([x.preheader,x.common_styles,x.meta,x.subject,x.utm_parameters?.utm_campaign??"",x.utm_parameters?.utm_content??"",x.utm_parameters?.utm_medium??"",x.utm_parameters?.utm_source??"",x.utm_parameters?.utm_term??""]),q=L&&V!==O,je=L&&G!==I;L=!0,O=V,I=G;const Be=k&&!ee;if(k=!1,ee=!1,M.isEventsLocked()||Be)return;const De={...x,id:s.isTemplate||x.isNew?void 0:x.id,html:V};if(q){fe(e,j.ON_CONTENT_CHANGED_ID).fire(V),fe(e,j.ON_EMAIL_CHANGED_ID).fire(De);return}je&&x.is_inited&&fe(e,j.ON_EMAIL_CHANGED_ID).fire(De)};let J=!1;const N=()=>{J||(J=!0,queueMicrotask(()=>{J=!1,D()}))};e.inject(ei,{pipeline:M,setRoute:x=>{x.emailId===s.emailId&&!!x.isTemplate==!!s.isTemplate||(s=x,N())}});let H,W;const z=()=>{const x=r()?.get().docId;x!==W&&(H?.(),W=x,H=r()?.subscribe(ce)),N()};let ne,Re;const st=()=>{const x=e.getInstance(Ae);!x||x===ne||(Re?.(),ne=x,Re=x.onShowRequested(V=>v.showRequested(V)))},Fe=n.addListener(x=>{x.data?.operation===$.SANDBOX_RESIZED&&T.notify()}),Pe=t.subscribe(z),Ut=er(n,N);z(),e.getInstance(U)?.addDispose(()=>{c?.dispose(),Re?.(),Ut(),Pe(),H?.(),Fe.dispose(),T.cancel(),M.stop()})}function mh(){return $l!=="useblocks"}var ma={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},gh={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}},qi=ma,vh=["freeUserBlocks","blocks"],lr={};function bh(e){lr=e}var ga=e=>vh.includes(e)?qi:lr[e]??lr.editor??qi,cr={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},yh={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},Eh={...cr,config:{...cr.config,imageCenterFileManagerView:!1}};bh({pro:gh,editor:yh,simple:mh()?cr:Eh,blocks:ma});var va=F("CodeMode");function ba(){let e;try{const t=window.localStorage?.getItem(Mt.em_code_mode_settings);e=t?JSON.parse(t):void 0}catch{e=void 0}return{isCodeMode:!!(e?.isCodeMode||e?.isCodeMode===void 0),direction:e?.codeModeDirection||"left"}}function _h(e){try{window.localStorage?.setItem(Mt.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function ya(e){return e.getOrCreateInstance(va,()=>{const t=Ee(ba());return t.watch(_h),t})}function Ea(e){return e?.getInstance(va)?.get()??ba()}function dr(e,t){const n=ya(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function wh(e,t){const n=ya(e);n.set({...n.get(),direction:t})}function Sh(e,t,n=e.getInstance(oe)){n?.setMode(t),n?.get()?.codeEnabled===!1&&Ea(e).isCodeMode&&dr(e,!1)}function Ih(e){e.getInstance(Hl)||e.inject(Te,void 0)}function gn(e){return String(e.standaloneKey||"").trim()||void 0}function Ch(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function ti(e){return Ch(e)?!!gn(e):!1}function Lt(e){return!!gn(e)&&!ti(e)}var Th=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function zi(e){return e==="server"?"serverSide":e}function Ah({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},i=Ee();let o={kind:"pending"},s;const a=new Promise(y=>{s=y}),c=n===void 0?void 0:setTimeout(()=>{f({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function d(){o.kind!=="pending"&&i.set(An(r,e))}function f(y){if(o.kind!=="pending")return;clearTimeout(c),o=y;const b=An(r,e);i.set(b),s(b)}function h(y,b){r[zi(y)]=b,y==="server"&&o.kind==="pending"?f({kind:"applied"}):d()}return{watch:y=>i.watch(y),select:y=>i.select(y),get:()=>i.get(),ready:()=>a,state:()=>o,layers:()=>({...r}),bootstrap(){const y=An(r,e);return Object.fromEntries(Th.map(b=>[b,y[b]]))},merge(y,b){h(b,{...r[zi(b)],...y})},replace(y,b){h(b,y)},setMode(y){r.user={...r.user,mode:y},d()},setAdvancedConfigs(y){r.advancedConfigs=y,d()},serverAbsent(y){f({kind:"absent",reason:y})},applyServerResponse(y){o.kind==="pending"&&h("server",{...r.serverSide,...y})},dispose(){clearTimeout(c)}}}var Rh=5e3,Ph="blocks";function Dh(){return{...ga(Ph)?.config,mergeTags:void 0}}function Oh(e,t){e.getInstance(se)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function xh(e,t){let n;Wr(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 Mh(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function kh(e,t){let n,r=!1,i;const o=a=>{i??=mn(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==a&&Sh(e,a,t)},s=Wr(e).watch(({profile:a})=>{const c=a?.email_builder_config,d=Mh(c);if(d===void 0||c===n)return;const f=n===void 0;n=c,!(f&&r)&&o(d)});e.getInstance(U)?.addDisposable(s),t.ready().then(a=>{if(!a.configSwither)return;const c=localStorage.getItem("configSwither")||(n===void 0?a.mode:i)||"editor";localStorage.setItem("configSwither",c),r=n===void 0,o(c)})}var Wi="замкнутый контур: app_init не выполняется";function Lh(e,t){if(e.getInstance(Te)){t.serverAbsent(Wi);return}const n=e.getInstance(se)?.watch(r=>{Lt(r)&&t.serverAbsent(Wi)});n&&e.getInstance(U)?.addDisposable(n)}async function Nh(e,t){if(e.getInstance(Nr)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(xe);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function Fh(e){e.injectFactory(oe,(t,n)=>{if(n)return n;const r=Ah({base:Dh(),env:{modeDefaults:i=>ga(i)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:Rh});return Oh(e,r),xh(e,r),kh(e,r),Lh(e,r),Nh(e,r),e.getInstance(U)?.addDisposable(r),r},!0)}var et=class extends ie{_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 B(e,t,n){const r=El(e);return(i,o,s)=>{const a=r(async c=>{const d=t?t(c):c;s&&i.bind(s);const f=await i(d);return n?n(f):f},o,s);return()=>a.dispose()}}var jh=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new Yn;this.handleDestroy=B(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new et(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{}}},ni=F("DestroyableService");function Bh(e){e.injectFactory(ni,(t,n)=>{if(n)return n;const r=e.getInstance(U);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new jh({lifetime:r,options:e.getInstance(se),getInstance:()=>e.getInstance(hn),release:()=>Al(e.getInstance(Gl)??e)})},!0)}function Uh(e){const t=e.getInstance(ni);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var Hh=1e3;function _a(e,t,n=Hh,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(!_a(e[s],t[s],n,r+1))return!1;return!0}return!1}function Et(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];_a(i,o)||(n[r]=i)}return n}var $h=({source:e,emailtags:t,group:n,tags:r,...i})=>i;async function Gh(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function Vh({emails:e,saveTimeoutMs:t},n,r){const i=t?.()??Br();let o;try{const s=e.notifySave(n);return await Promise.race([s,new Promise((a,c)=>{o=setTimeout(()=>{const d=new Ur(i);n.value.id,md(d,Gh(s,r)),c(d)},i)})])}catch(s){throw gs(s),s}finally{o!==void 0&&clearTimeout(o)}}function qh(e){const{emails:t}=e,n=async(r,i)=>{const o=$h(i),s=r===void 0?void 0:await t.cache.getIfPresent(r),a=s?{...s,...o}:o,c=s?Et(s,o):o,d=f=>{const h=String(f.id??r??Se()),y=f.id===void 0?{...f,id:h}:f;return t.cache.addOrUpdate(h,()=>y)};return await d(await Vh(e,{prev:s,patch:c,value:a,source:i.source??""},d))};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:Se()}},async updateEmail(r,i){return await n(r,i)}}}var Dn=20;function zh(e){const t=Wh(e);return e.saveTimeoutMs?Kh(t,e.saveTimeoutMs):t}function Wh({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r,emailAuthor:i,integratorProject:o}){const s=async(a,c)=>(t.clear(),await t.get(a,{page:c}),(await e.cache.values()??[]).filter(d=>String(d?.parent)===String(a)));return{async readRevisions(a,c=1){const d=await s(a,c);return{revisions:d.slice(Dn*(c-1),Dn*c),page:c,hasMore:d.length>Dn*c}},async readAutosave(a){const c=await r?.(a)??NaN,d=Number.isFinite(c)?c:void 0,f=await n?.(a);if(!f?.asked)return Id(await s(a,1),d);if(!f.revision)return Ai([],d);const h={...f.revision,parent:a,isAutosave:!0};return Ai([h],d,await s(a,1))},async saveAutosave(a,c){const d=await i?.(a),f=o?.();return await e.create({...Dd(c),...d!==void 0?{author:d}:{},...f!==void 0?{project:f}:{},parent:a,isAutosave:!0,modified:new Date().toString()})}}}function Kh(e,t){return{...e,async saveAutosave(n,r){const i=t();let o;try{return await Promise.race([e.saveAutosave(n,r),new Promise((s,a)=>{o=setTimeout(()=>a(new fs(i)),i)})])}catch(s){throw gs(s),s}finally{o!==void 0&&clearTimeout(o)}}}}var Yh=class extends kl{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}},Xh=class extends Me{};var Ki=class extends ie{_items=new Map;_onChangeEmitter=new oc;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 Ce(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 Jh(e,{filter:t,order:n="asc",orderBy:r,page:i,pageSize:o=20}={}){const s=e.length;let a=e.length;if(t!==void 0){const c=Object.keys(t);e=e.filter(d=>{for(const f of c){const h=d[f],y=t[f];return f==="id"||typeof h!="string"?h===y:typeof y=="string"&&h.startsWith(y)}return!0}),a=e.length}return r&&(e=e.sort((c,d)=>(c[r]>d[r]?1:d[r]>c[r]?-1:0)*(n==="asc"?1:-1))),i!==void 0&&(e=e.slice(o*(i-1),o*i)),{data:e,filteredTotal:a,total:s,totalPages:Math.ceil(a/o)}}function Qh(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 Zh(e,t){return Yi(e)&&Yi(t)?String(e)===String(t):e===t}function Yi(e){return typeof e=="string"||typeof e=="number"}var em=class extends ie{_cache=new Ki;_readEmitter=new Me;_saveEmitter=this.addDisposable(new Yh);_removeEmitter=this.addDisposable(new Xh);_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 ie);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new Ki),i=n.addDisposable(new Me);t=this._foreignCache[e]={get:async(o,s={})=>{await r.getOrCreate(o,async()=>{try{const c=Qh(await i.fire(o))||[];for(const d of c)d[e]=o,await this._cache.add(d.id,d);return c}catch{return[]}});const a=(await this._cache.values()||[]).filter(c=>{const d=c[e];return d==null||Zh(d,o)});return Jh(a,s)},first(o,s={}){return t.get(o,{...s,page:1,pageSize:1}).then(({data:a})=>a[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=Se()),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?Et(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 Nt(e){const t=F(e);return n=>n.getOrCreateInstance(t,()=>new em)}function wa(e){const t=e.getInstance(U);if(!t)throw new Error("Failed");return t}function Xi(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function On(e,t){const n={...e};return t===void 0?(delete n.meta,n):(n.meta={...e.meta??{},...t},n)}function tm(e,t,n){return e&&!Xi(t)&&Xi(e)?{...n,meta:e.meta}:n}var nm=F("CurrentProject"),rm={};function Ft(e){return e?.getInstance(nm)?.get()??rm}function ri(e){const t=Ft(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var Sa=Nt("plugin.dataSource.emails"),Ia=Nt("plugin.dataSource.emailRevisions"),Ca=Qr("plugin.readEmailAutosave"),Ji=F("emailDocuments.provided");function im(e){const t=Sa(e),n=Ia(e),r=n.byForeignKey("parent");if(e.getInstance(Ji))return{emails:t,emailRevisions:n};e.inject(Ji,!0);const i=()=>Br(e.getInstance(Ae)?.contentReadyTimeoutMs),o=qh({emails:t,saveTimeoutMs:i}),s=new Map,a=(c,d)=>f=>{const h=f?.id??d;return(typeof h=="string"||typeof h=="number")&&s.set(String(h),c),f};return tu(e,{...o,createEmail:c=>o.createEmail(c).then(a(Date.now())),updateEmail:(c,d)=>o.updateEmail(c,d).then(a(Date.now(),c))}),ou(e,zh({revisions:n,revisionsByEmail:r,readAutosave:async c=>{const d=await fe(e,Ca).fire(c);return d.length===0?{asked:!1}:{asked:!0,revision:d[0]??null}},savedAt:async c=>{const d=wd((await t.cache.getIfPresent(c))?.modified),f=s.get(String(c))??NaN;return Number.isFinite(f)&&!(d>=f)?f:d},emailAuthor:async c=>(await t.cache.getIfPresent(c))?.author,saveTimeoutMs:i,integratorProject:()=>Ft(e).requested})),wa(e).addDisposable(t.onSave(({prev:c,patch:d,value:f})=>tm(c,d,f),Number.MIN_VALUE)),{emails:t,emailRevisions:n}}function Qi(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 om(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var sm="po",Kt=null;function am(){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([sm],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function lm(){return Kt===null&&(Kt=am().catch(e=>{throw Kt=null,e})),Kt}async function Ta(e){if(typeof e=="object")return ii(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?cm(t):dm(t)}function ii(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function cm(e){try{return ii(JSON.parse(e))}catch{return}}var Zi=!1;async function dm(e){try{return ii((await lm()).parsePoCatalog(e))}catch{Zi||(Zi=!0);return}}var um="em_locale",fm="em_ant_locale",pm="locale",hm="ant_locale";function oi(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function Aa(e,t){const n=oi(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function mm(){return oi("em_locale")??Aa(pm,"em_locale")}function eo(e){try{localStorage.setItem(um,JSON.stringify(e))}catch{}}function gm(){return oi("em_ant_locale")??Aa(hm,"em_ant_locale")}function vm(e,t){try{localStorage.setItem(fm,JSON.stringify({id:e,data:t}))}catch{}}var bm=8e3;function ym(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 Em(e){const t=mm(),n=gm();let r={ready:!1},i;const o=Ee(r);let s=0;const a=g=>{r={...r,...g},o.set(r)},c=()=>{r.ready||a({ready:!0})},d=setTimeout(c,e.unlockAfterMs??bm),f=g=>g!==s;let h;async function y(g,C){if(n?.id===g&&n.data&&a({antd:n.data}),!h)return;const _=await h(g).catch(()=>{});!_||f(C)||(a({antd:_}),vm(g,_))}async function b(g,C){const _=await e.askHost(g).catch(()=>null);if(f(C))return!0;if(_==null)return!1;const P=await Ta(_);return f(C)||(P&&a({catalog:P}),c()),!0}async function T(g,C){const _=await e.readList();if(f(C))return;if("error"in _){a({failure:{kind:"GET_LOCALES_ERROR",error:_.error}}),c();return}const P=_.data.find(M=>M.locale===g);if(!P){om("em_locale")&&a({catalog:void 0}),c();return}if(Qi(t,P)&&(!i||i.catalog===t?.data)){c();return}if(i?.entry&&r.catalog===i.catalog&&Qi(i.entry,P)){eo(i.entry),c();return}const S=await e.readCatalog(g);if(!f(C)){if("error"in S){a({failure:{kind:"GET_LOCALE_ERROR",error:S.error}}),c();return}S.data&&(i?.id===g&&r.catalog===i.catalog&&ym(i.catalog,S.data)||a({catalog:S.data}),eo({id:g,time:P.updatedAt||Math.floor(Date.now()/1e3),hash:P.contentHash,data:S.data})),c()}}async function w(g,C){if(!await b(g,C)){if(!f(C)&&(i?.id===g&&r.catalog===i.catalog||g==="en_US")&&c(),e.canUseNetwork&&!e.canUseNetwork()){c();return}await T(g,C)}}return{set(g){if(!g||g===r.id)return;const C=s+=1;a({id:g,failure:void 0});const _=i?.id===g&&r.catalog===i.catalog;(i&&!_&&r.catalog===i.catalog||g==="en_US"&&r.catalog)&&a({catalog:void 0}),t?.id===g&&t.data&&(a({catalog:t.data}),c()),y(g,C),w(g,C)},prime(g,C,_){r.id&&r.id!==g||r.catalog||!C||(i=t?.id===g&&t.data&&(!_||t.time>=_.time)?{id:g,catalog:t.data}:{id:g,catalog:C,entry:_?{id:g,time:_.time,hash:_.hash,data:C}:void 0},a({catalog:i.catalog}))},useAntdLoader(g){h=g,r.id&&y(r.id,s)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(d)}}var _m=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})},wm=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:a,...c})=>{const d=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},f=this.mergeRequestParams(c,d),h=i&&this.toQueryString(i),y=this.contentFormatters[r||"application/json"],b=o||f.format;return this.customFetch(`${s||this.baseUrl||""}${n}${h?`?${h}`:""}`,{...f,headers:{...f.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(a?this.createAbortSignal(a):f.signal)||null,body:typeof e>"u"||e===null?null:y(e)}).then(async T=>{const w=T;w.data=null,w.error=null;const g=b?T.clone():T,C=b?await g[b]().then(_=>(w.ok?w.data=_:w.error=_,w)).catch(_=>(w.error=_,w)):w;return a&&this.abortControllers.delete(a),C})}},Sm=F("rest.v2.transport"),to=Symbol("rest.v2.secureRequest");function Im(e){return e.getOrCreateInstance(Sm,()=>{const t=e.getInstance(Pl)?.execute||fetch;return new wm({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[to]:!0}),customFetch:(n,r={})=>{const{[to]:i,...o}=r;return t(n,{...o,[Ol]:i!==!0})}})})}function Cm(e,t){const n=Im(e);return Object.assign({},...t.map(r=>new r(n)))}function no(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function Ra(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:no(n.details,"wp_code")??n.code,message:no(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 Pa(e){return!e.ok||!!e.error}function Tm(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function Da(){return Tm(Mt.em_translations_v2)??!0}function Am(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Rm(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function Pm(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:Am(r[1])}),t},[]):[]}function Dm(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:Rm(n.updated_at),contentHash:n.content_hash}),t),[])}function Oa(e){return Cm(e,[_m])}function cn(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function ur(e){return!e.ok||e.error!=null}function fr(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function xn(e){return{data:await Ta(e)??null}}async function Om(e){if(Da())try{const n=await Oa(e).localesList();return Pa(n)?{error:Ra(n)}:{data:Dm(n.data)}}catch(n){return cn(n)}const t=qo(e,[es]);try{const n=await t.get_translations2({file:"react_app"});return ur(n)?fr(n):{data:Pm(n.data)}}catch(n){return cn(n)}}async function xm(e,t){if(Da())try{const r=await Oa(e).jsonList({locale:t});return Pa(r)?{error:Ra(r)}:xn(r.data)}catch(r){return cn(r)}const n=qo(e,[es]);try{const r=await n.get_translations3({id:t,file:"react_app"});return ur(r)?fr(r):xn(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return ur(r)?fr(r):xn(r.data)}catch(r){return cn(r)}}}var Yt=new WeakMap;function Mm(e){const t=Yt.get(e);if(t!==void 0)return t;const n=Om(e).then(r=>("error"in r&&Yt.delete(e),r),r=>{throw Yt.delete(e),r});return Yt.set(e,n),n}var Tt=F("locale.service");function km(e){if(e.getInstance(Tt))return;const t=Em({readList:()=>Mm(e),readCatalog:n=>xm(e,n),askHost:async n=>(await fe(e,j.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(Te)});e.inject(Tt,t),e.getInstance(U)?.addDispose(()=>t.dispose())}function Lm(e){const t=e.getInstance(oe);if(!t)return;const n=e.getInstance(Tt);if(!n)return;const r=t.select(i=>i.locale).watch(i=>n.set(i||"en_US"));e.getInstance(U)?.addDisposable(r)}var Nm="user_id",Fm="project_id",ro=F("rest.identityHeadersProvided");function jm(e){if(e.getInstance(ro))return;e.inject(ro,!0);let t;e.getInstance(se)?.watch(n=>{t=n}),e.addService(Ar,{execute(n,r){if(r?.public)return;const i=t?.user?.id??Ms(e).profile?.id;i!=null&&i!==""&&n.headers.set(Nm,String(i));const o=t?.project;o!=null&&o!==""&&n.headers.set(Fm,String(o))}})}function Bm(e){if(!e)return!1;try{return e.getInstance(Te)!==void 0}catch{return!1}}var Um="Invalid standaloneKey.",DE=F("StandaloneMockGuard");function Hm(){const e=new Error(Um);return e.name="InvalidStandaloneKeyError",e}function $m(e){e.addService(Ar,{execute:()=>{if(Bm(e))throw Hm()}})}function Gm(e){Ml(e),$m(e)}function Vm(e){const t=new Qs;e.inject(Ae,t);const n=e.getInstance(se)?.watch(i=>{if(!i)return;const o=i.signal??t.externalSignal;t.configure({replaceSession:!0,...i.timeouts!==void 0?{timeouts:i.timeouts}:{},...o!==void 0?{signal:o}:{}})}),r=e.getInstance(U);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var qm=Nt("plugin.dataSource.blocks"),zm=Nt("plugin.dataSource.blockRevisions"),Wm=Nt("plugin.dataSource.comments"),Km=Qr(),Ym=Qr(),xa=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
1005
1005
|
<html>
|
|
@@ -1045,7 +1045,7 @@ import{n as Go,r as bl}from"./static/esm/971f1b2c.js";import{A as Vo,At as rn,B
|
|
|
1045
1045
|
</html>`;function Xm(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:xa,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 Ma=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function Jm(e){return!Object.keys(e).some(t=>Ma.has(t))}function Qm(e){const t={},n={};for(const[r,i]of Object.entries(e))Ma.has(r)?t[r]=i:n[r]=i;return{showOptions:t,misplacedEmailFields:n}}function io(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function jt(e){return{emails:Sa(e),blocks:qm(e),emailRevisions:Ia(e),blocksRevision:zm(e),comments:Wm(e)}}function Zm(e){const t=Object.values(jt(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function vn(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(Jm(e))return{email:io(e)};{const{showOptions:n,misplacedEmailFields:r}=Qm(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:io({...r,...o})}}}function si(e){return Kr(e)?.current()}function Zt(e){return si(e)?.getContent()}function ka(e,t){const n=t??Xm(),r=si(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:Zt(e)??n.html}:n}async function en(e){return(await e.getInstanceAsync(xe))?.project}async function eg(e){return ri(e)??await en(e)}function oo(e){if(!e)return;const t=vn(e,!1).email.id;return t==null?void 0:String(t)}function tg(e,t){return e.ticket===t.ticket?!1:e.emailId===void 0||e.emailId!==t.emailId}function ng(e){return typeof e=="object"&&e!==null&&"reload"in e&&e.reload===!0}function it({code:e,project:t,...n},r){const i=ke(n),o=ri(r),s=ze(r);return e&&s.warnAboutUnconfiguredInput(e,n.id),{...i,...e?{html:s.toEditorForm(e)}:{},...o===void 0?{}:{project:o},..."utm_parameters"in i?{utm_parameters:i.utm_parameters||{}}:{},_embedded:void 0}}function de({html:e,renderGuid:t,showToken:n,showId:r,...i},o){const{requested:s}=Ft(o),a=Ns(o);return ke({...i,code:ze(o).toOutputForm(e),project:s===void 0?i.project:s,utm_parameters:a.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 pr(e){return e==null?"":e.replaceAll(`\r
|
|
1046
1046
|
`,`
|
|
1047
1047
|
`)}function so(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function rg(e,t,n,r){const i=ig(e,t,n,r);return i===void 0}function ig(e,t,n,r){const{email:i}=vn(t,!1),o=it(i,e),s=o.id;if(s===void 0)return"no-id";if(r!==void 0&&r!==s)return"other-id-shown";const a=Kr(e)?.current();if(!a)return"no-session";const c=a.get(),d=c.attributes;if(c.serverId!==s)return"document-id";if(d.is_inited!==!0)return"not-inited";const f=so(pr(n??a.getContent()));if(o.html!==void 0&&so(pr(o.html))!==f)return"html";if(o.subject!==void 0&&o.subject!==d.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==d.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==d.common_styles)return"common_styles"}function ao(e,t){const{email:n}=vn(t,!1),r=it(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:pr(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function og(e,t){const n={...e};return delete n.id,{...n,...t}}function sg(e){return e.html?e:{...e,html:xa}}function pt({code:e,project:t,...n},r,i){const o=i??ri(r);return{...n,...e?{html:ze(r).toEditorForm(e)}:{},renderGuid:Se(),...o===void 0?{}:{project:o}}}function ht({html:e,renderGuid:t,...n},r){const{requested:i}=Ft(r);return ke({...n,code:ze(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 La(e){return Kr(e)?.current()?.get().serverId??void 0}function hr(e,t,n){return n===void 0&&(n=e.post===void 0?La(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function mt(e,t){return ke({...e,link:void 0,comment_status:void 0})}function tn({code:e,autosave:t,...n},r,i){return i===void 0&&(i=n.parent===void 0?La(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0||xd(n.slug),parent:i}}function mr({html:e,isAutosave:t,...n},r){return ke({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:ke({html:e,ampHtml:e&&""})})}var tt=F("NotificationService"),ag=F("emailTemplate.reads");async function lg(e,t){try{return await Ve(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,dg(e,t,n);return}}var cg=F("emailTemplate.notifiedFailures");function dg(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(cg,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(tt).then(()=>{kt(e,j.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function ug(e,t){const n=e.getOrCreateInstance(ag,()=>new Map),r=n.get(t);if(r!==void 0)return r;const i=lg(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,i),i}var fg="EXTERNAL",lo=Symbol("supersededShow");function pg(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var hg="email_id",mg=class extends ie{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_latestShowEmailId;_latestShow=Promise.resolve();_dataSources;_eventLock;_queue=zo();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=jt(t),this._eventLock=Zm(t);const n=te(e,j.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(Ar,{execute:(r,i)=>{!i?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(hg,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(Ae)??Zr}_throwIfDestroyed(){if(this.isDisposed())throw Oe()}async getTemplateEmail(e){const t=await ug(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 en(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,pt(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,tn(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,hr(i,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,i){const o=this._dataSources.emails,s=o.cache,a=await en(this._container),c=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let d=it(e,this._container);const f=d.id;let h=f;if(f!==void 0){const y=await o.get(f);d={...y??{},...d,utm_parameters:d.utm_parameters??y?.utm_parameters??{},renderGuid:y?.renderGuid??Se(),...c>0?{showToken:c}:{},...i?{showId:i}:{},project:a}}else{h=n??Se();const y=await o.get(h);d={...d,utm_parameters:d.utm_parameters??{},renderGuid:y?.renderGuid??Se(),...c>0?{showToken:c}:{},...i?{showId:i}:{},project:a},delete d.project}if(t){const y=await this.getTemplateEmail(String(t));y&&(d=og(y,d))}return f===void 0&&(d=sg(d)),await s.setAll([[h,d]]),d}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==ao(this._container,e))return!1;const n=Zt(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=ao(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:Zt(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&tg({ticket:t,emailId:oo(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId}))return this._showRequests,lo;if(!e)return;const n=this._getInitPipeline();Y(n.signal);const r=ng(e);if(!r&&rg(this._container,e,Zt(this._container),this._prevCommand?.id)||!r&&this._isRepeatOfLastShow(e))return;const i=vn(e);i.email.id,this._prevCommand?.id;let o,s="",a=0,c=!1,d,f=Promise.resolve(),h,y=!1;try{this._eventLock.suspendChange();const{email:b,blocks:T,autosaves:w,comments:g,templateId:C,reload:_}=i;o=b.id;const P=it(b,this._container),S=P.id,M=S??Se(),v=await bt("getProject",en(this._container));Y(n.signal),s=Se();const E={isNew:S===void 0,id:String(M),project:v},A=_===!0&&S!==void 0;A&&(await this._dataSources.emails.remove(String(S),{silent:!0}),String(S)),a=++this._showToken,String(M);const m=[];m.push(this.setBlocks(T)),b.id!==void 0&&(m.push(this.setComments(g)),m.push(this.setEmailRevisions(w,String(b.id)))),m.push(this.setEmail(b,Number(C),S===void 0?String(M):void 0,a,s)),await bt("setEmail+blocks+revisions",Promise.all(m),{emailId:S??String(M),showId:s,targetShowToken:a}),Y(n.signal);const l=await this._dataSources.emails.get(String(M)),u=Le(this._container),p={id:s,token:a};S===void 0?h=u.startNewDraft(l??P,{patch:P,show:p}):A?h=u.reload(S,{email:l??P,patch:P,show:p}):u.sessionKey()===Ke(S)?h=u.show(P,p):h=u.open(S,{email:l??P,patch:P,show:p});const R=!!this._prevCommand&&Ce(this._prevCommand,E);E.id,!this._prevCommand||Ce(this._prevCommand,E),this._prevCommand?.id,this._rememberShow(E),f=n.requestShow({showId:s,navId:String(M),emailId:S,isNew:S===void 0}),y=!0,String(M),c=!0}catch(b){d=b,y&&s&&n.failShow(s,b),Or(b)||(ds(b),void 0)}finally{this._eventLock.resumeChange()}if(!c)throw d instanceof Error?d:new Error(`[useblocks] show() setup failed: ${String(d??"unknown error")}`);return bt("show-init-deferred",Promise.all([f,h?.whenReady().catch(b=>{if(b instanceof It){const T=zr(b);throw T?new Error(`[useblocks] show(): email open failed (${T})`,{cause:b}):b}})??Promise.resolve()]).then(()=>{}),{showId:s,emailId:o??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();Y(e.signal);const t=Le(this._container),n=await t.save("publish",{source:fg,fallbackTitle:Hs(this._container)});if(Y(e.signal),!n)throw pg(t.saveState().error);return de(ka(this._container,this._currentEmail),this._container)}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;this._latestShowEmailId=oo(e);const n=this._queuedShow(e,t).then(r=>r===lo?this._latestShow.catch(()=>{}):void 0);return this._latestShow=n,n};save=this._queue.decorate(this._save,this)};function gg(e){return String(e).replace(/"/g,""")}function vg(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 bg(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 co(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),i=gg(n);return r.test(e)?e.replace(r,`${t}="${i}"`):e.replace(/>$/,` ${t}="${i}">`)}function yg(e,t,n){if(!e?.trim()||!t)return e;const r=bg(e);if(!r)return e;const i=String(t),o=vg(n??new Date);let{full:s,index:a}=r;const c=s.length;return/\bem-block-id\s*=/.test(s)||(s=co(s,"em-block-id",i)),s=co(s,"em-block-version",o),e.slice(0,a)+s+e.slice(a+c)}function Eg(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 _g(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:Eg(e)}}function Mn(e,t){return t?_g(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var Na=["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"],wg=[...Na,"html","id","project","password"],OE=new Set(["html",...Na,"global_block","project"]);function Sg(e){if(!e||typeof e!="object")return{};const t={};e.id!=null&&e.id!==""&&(t.id=String(e.id)),e.title!=null&&e.title!==""&&(t.title=e.title),e.slug!=null&&e.slug!==""&&(t.slug=e.slug),e.type!=null&&e.type!==""&&(t.type=e.type),e.tags!=null&&(t.tags=e.tags),e.blocktags!=null&&(t.blocktags=e.blocktags),e.modified!=null&&e.modified!==""&&(t.modified=e.modified),e.author!=null&&e.author!==""&&(t.author=String(e.author)),e.lock!=null&&(t.lock=e.lock),e.subject!=null&&e.subject!==""&&(t.subject=e.subject),e.description!=null&&e.description!==""&&(t.description=e.description),e.excerpt!=null&&e.excerpt!==""&&(t.excerpt=e.excerpt),e.status!=null&&e.status!==""&&(t.status=e.status),e.is_template!=null&&(t.is_template=e.is_template),e.link!=null&&e.link!==""&&(t.link=e.link),e.renderGuid!=null&&e.renderGuid!==""&&(t.renderGuid=e.renderGuid),e.date!=null&&e.date!==""&&(t.date=e.date),e.date_gmt!=null&&e.date_gmt!==""&&(t.date_gmt=e.date_gmt),e.modified_gmt!=null&&e.modified_gmt!==""&&(t.modified_gmt=e.modified_gmt),e.comment_status!=null&&e.comment_status!==""&&(t.comment_status=e.comment_status),e.ping_status!=null&&e.ping_status!==""&&(t.ping_status=e.ping_status),e.template!=null&&e.template!==""&&(t.template=e.template),e.related_email!=null&&e.related_email!==""&&(t.related_email=e.related_email),e.project_title!=null&&e.project_title!==""&&(t.project_title=e.project_title),e.project_author!=null&&e.project_author!==""&&(t.project_author=e.project_author),e.isAmp!=null&&(t.isAmp=e.isAmp),e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object"&&(t.meta=e.meta);const n=new Set(wg),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 Ig(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...Sg(e),html:typeof e.html=="string"?e.html:"",insertFrom:t.type,name:t.name,project:t.project??e.project,id:e.id!=null&&e.id!==""?String(e.id):t.blockId}}var gr=new WeakMap;function Cg(e){let t=gr.get(e);return t||(t={byId:new Map,fallback:[]},gr.set(e,t)),t}function Tg(e){gr.delete(e)}function Ag(e,t){const{byId:n,fallback:r}=Cg(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,a=e.type!=null&&e.type!==""&&o.insertFrom===e.type;if(s&&a)return r.splice(i,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function Rg(e,t){const{blocks:n}=jt(e);return await n.cache.getIfPresent(t)??void 0}async function Pg(e,t){if(!t.blockId)return;const n=await Rg(e,t.blockId);if(n)return Ig(n,t)}async function Dg(e,t){const n=Ag(e,t);if(n)return Mn(e,n);const r=await Pg(t,e);return r?Mn(e,r):Mn(e,void 0)}var Og=Wo("application_block_inserted"),xg=-1e3,uo=new WeakSet;function Mg(e){if(e===null||typeof e!="object")return!1;const t=e;return typeof t.type=="string"||typeof t.name=="string"||typeof t.blockId=="string"||typeof t.project=="string"||typeof t.project=="number"}function kg(e){if(!e||uo.has(e))return;uo.add(e);const t=new ie,n=ae(e);return t.addDisposable(n.addListenerAsyncPipe(Og,async(r,i)=>{const o=Mg(r)?await Dg(r,e):r;return i?i(o):o},xg)),t.addDisposable({dispose:()=>{Tg(e)}}),t}var Fa=F("plugin.earlyWindow");function Lg(e){return e.getOrCreateInstance(Fa,()=>({depth:0}))}function Ng(e){const t=Lg(e);t.depth+=1;let n=!1;return()=>{n||(n=!0,t.depth-=1)}}function ja(e){return(e?.getInstance(Fa)?.depth??0)>0}function Ba(e,t){let n,r=!1;return e(i=>{n=i,r=!0}),(i,o,s)=>{const a=e(i,o,s);if(r&&ja(t)){const c=n;queueMicrotask(()=>{i.call(s,c)})}return a}}var fo=100,Fg=class extends ie{_container;_events;constructor(e){super(),this._container=e;const t=kg(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:i}=jt(e),o=te(e,j.ON_SHARE_ID),s=te(e,j.ON_SHOW_PREVIEW_ID),a=te(e,j.ON_EMAIL_CLONE_ID),c=te(e,j.ON_CODE_VALIDATE_ID),d=te(e,j.ON_SUBJECT_CHANGED_ID),f=te(e,j.ON_EMAIL_CHANGED_ID),h=te(e,j.ON_PREHEADER_CHANGED_ID),y=te(e,j.ON_SAVEBUTTON_CLICK_ID),b=te(e,j.ON_NEXTBUTTON_CLICK_ID),T=te(e,j.ON_SEND_LIVEPREVIEW_ID),w=te(e,j.ON_SEND_TESTEMAIL_ID),g=te(e,Ym),C=te(e,j.ON_CONTENT_CHANGED_ID),_=te(e,Km),P=te(e,j.ON_PREVIOUSBUTTON_CLICK_ID),S=te(e,j.ON_SEND_EMAIL_MODAL_ID),M=_l(te(e,j.ON_EMAIL_INIT_ID),v=>!v.reset);return{handlePreheaderChanged:B(h),handleSubjectChanged:B(d),handleValidate:B(c),handleReadEmail:B(n.handlerRead,v=>v,v=>v&&it(v,e)),handleSaveEmail:B(n.onSave,function({prev:v,patch:E,value:A,source:m}){const l=v?de(v,e):void 0;return{prev:l,patch:Et(l,de(E,e)),value:de(A,e),source:m}},v=>v?it(v,e):void 0),handleRemoveEmail:B(n.onRemove,({value:v,source:E})=>({value:de(v,e),source:E}),()=>{}),handleReadCommonBlocks:B(g,v=>v.project,v=>v?.map(E=>pt(E,e))),handleReadTemplateBlocks:B(_,v=>v,v=>v?.map(E=>pt(E,e))),handleReadBlocks:B(t.byForeignKey("project").handleRead,v=>Ft(e).requested||String(v),v=>v?.map(E=>pt(E,e))),handleSaveBlock:B(t.onSave,function({prev:v,patch:E,value:A,source:m}){const l=A.global_block===!0&&A.id&&typeof A.html=="string"?{...A,html:yg(A.html,String(A.id))}:A,u=v?ht(v,e):void 0;return{prev:u,patch:Et(u,ht(E,e)),value:ht(l,e),source:m}},v=>v?pt(v,e):void 0),handleRemoveBlock:B(t.onRemove,({value:v,source:E})=>({value:ht(v,e),source:E}),()=>{}),handleReadComments:B(r.byForeignKey("post").handleRead,v=>v,v=>v?.map(E=>hr(E,e))),handleSaveComment:B(r.onSave,function({prev:v,patch:E,value:A,source:m}){const l=v?mt(v,e):void 0;return{prev:l,patch:Et(l,mt(E,e)),value:mt(A,e),source:m}},v=>v?hr(v,e):void 0),handleRemoveComment:B(r.onRemove,({value:v,source:E})=>({value:mt(v,e),source:E}),()=>{}),handleReadEmailRevisions:B(i.byForeignKey("parent").handleRead,v=>v,v=>v?.map(E=>tn(E,e))),handleReadEmailAutosave:B(te(e,Ca),v=>v,v=>v?tn(v,e):null),handleEmailAutosave:B(i.onSave,function({prev:v,patch:E,value:A,source:m}){return{value:mr(A,e),source:m}},v=>v?tn(v,e):void 0),handleRemoveEmailAutoSave:B(i.onRemove,({value:v,source:E})=>({value:mr(v,e),source:E}),()=>{}),handleEmailChanged:B(vi(f,fo),v=>de(v,e)),handleEmailInit:Ba(B(M,v=>de(v,e)),e),handlePreviousButtonClick:B(P,v=>de(v,e)),handleNextButtonClick:B(b,v=>de(v,e)),handleSaveButtonClick:B(y,v=>de(v,e)),handleHtmlChanged:B(vi(C,fo)),handleTestEmailSend:B(w,({html:v,...E})=>({...E,code:v,compiled:{html:v,ampHtml:""}})),handleTestEmailModal:B(S,v=>de(v,e)),handleCloneEmail:B(a,v=>de(v,e)),handleShareEmail:B(o),handlePreviewEmail:B(s),handleLivePreviewEmail:B(T)}}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 et(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},jg=F("DataController"),Bg=F("DataEvents");function Ua(e){return e.getOrCreateInstance(jg,()=>{const t=new mg(e);return e.getInstance(U)?.addDisposable(t),t})}function Ha(e){return e.getOrCreateInstance(Bg,()=>new Fg(e))}var Ug=F("plugin.pluginStart");function $a(e){return e.getOrCreateInstance(Ug,()=>{let t;const n=new Promise(r=>{t=r});return e.getInstance(U)?.addDispose(()=>t()),{done:n,finish:t}})}function Hg(e){return $a(e).done}function $g(e){const t=$a(e);return t.run===void 0&&(t.run=(e.getInstance(xr)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var Gg=F("plugin.startupShow");function Vg(e){const t=Ua(e),n=Ha(e),r=e.getInstance(se),i=e.getInstance(U),o={current:Promise.resolve()};e.inject(Gg,o);let s=!1;const a=r?.watch(d=>{d&&n.setOptions(d),s=(d?.plugins?.length??0)>0,o.current=o.current.catch(()=>{})}),c=r?.select(d=>d?.content).watch(d=>{if(d===void 0)return;const f=()=>(Z(le.showStart),t.show(d).finally(()=>Z(le.showEnd))),h=s?Hg(e).then(f):f();h.catch(()=>{}),o.current=h});a&&i?.addDisposable(a),c&&i?.addDisposable(c)}function qg(e){const t=Ua(e);return{...Ha(e).get(),show(n){return Z(le.showStart),t.show(n).finally(()=>Z(le.showEnd))},save(){return t.save()}}}function Ga(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function bn(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",i=!1;for(let o=t;o<e.length;o++){const s=e[o];if(i){i=!1;continue}if(s==="\\"){i=!0;continue}if(r){s===r&&(r="");continue}if(s==='"'||s==="'"){r=s;continue}if(s==="("){n++;continue}if(s===")"&&(n--,n<0))return!1}return n===0}function zg(e){return(t,n,r)=>bn(t)?e(t,n,r):!1}function Wg(e){return t=>bn(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function Kg(e){return(t,n,r)=>bn(t)?Ga(t)?e(t,n,r):t:!1}function Yg(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return bn(n)?Ga(n)?e(t):t:!1}}function Xg(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function ai(e,t){const n=e.length;for(let r=0;r<n;r++){const i=e.charCodeAt(r);if(i===0||t==='"'&&i===34||t==="'"&&i===39||t===""&&(i===32||i===9||i===10||i===13||i===12||i===34||i===39||i===60||i===62||i===61||i===96))return!1}return!0}function Jg(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let i="";for(let o=0;o<e;o++){const s=r[o]%62;i+=t.charAt(s)}return i}var Qg=8,Zg=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=Jg(Qg),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},yn=new Zg;function po(e,t){return t!==void 0&&!ai(e,t)?`%|{${yn.getOrCreateByKey(e)}}|%`:e}function ev(e){const t=yn.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function Q(e,t,n){return t!==void 0?ai(e,t)?e:`%|{${yn.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function tv(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function K(e){return e.startsWith("<!--")&&e.endsWith("-->")?tv(e.slice(4,-3)):e}function nv(e){const t=/^(IF|ELSE|ELSIF|ELSEIF|END|FOREACH|WHILE|NEXT|LAST|BREAK|DO|UNLESS|CONTINUE|SET|UNSET|DEFINE|INCLUDE)\b/i,n=/\w+\s*\(/;let r=e;const i=e.match(/\[%\s*([^%]*?)\s*%\]/);i&&(r=i[1]);const o=r.trim();return t.test(o)||n.test(o)}function rv(e,t,n){return t!==void 0?ai(e,t)?e:`%|{${yn.getOrCreateByKey(e)}}|%`:n||Xg(e)||nv(e)?`<!--${e}-->`:e}var He=zg(Q),$e=Wg(K),iv=Kg(Q),ov=Yg(K),Va=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",ev),e.escape("@{","}",Q,!0).unescape("<!--@{","}-->",K,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",po,!0),e.escape("{{","}}",po,!0),e.createSyntax("brace-percent").escape("{%","%}",Q).unescape("<!--{%","%}-->",K),e.createSyntax("brace-hash").escape("{#","#}",Q).unescape("<!--{#","#}-->",K),e.createSyntax("proscript").escape("[%","%]",rv,!0).unescape("<!--[%","%]-->",K,!0),e.createSyntax("getresponse").escape("[[IF","]]",Q).escape("[[if","]]",Q).escape("[[ELSE]]","",Q).escape("[[else]]","",Q).escape("[[ENDIF]]","",Q).escape("[[endif]]","",Q).unescape("<!--[[IF","]]-->",K).unescape("<!--[[if","]]-->",K).unescape("<!--[[ELSE]]","-->",K).unescape("<!--[[else]]","-->",K).unescape("<!--[[ENDIF]]","-->",K).unescape("<!--[[endif]]","-->",K),e.createSyntax("expert-sender").escape("<if",">",Q).escape("</if",">",Q).escape("<else",">",Q).escape("</else",">",Q).escape("<var ",">",Q,!0).unescape("<!--<if ",">-->",K).unescape("<!--</if",">-->",K).unescape("<!--<else ",">-->",K).unescape("<!--</else",">-->",K).unescape("<!--<var",">-->",K,!0),e.createSyntax("velocity").escape("#if",")",He).escape("#elseif",")",He).escape("#else","",Q).escape("#foreach",")",He).escape("#macro",")",He).escape("#set",")",iv,!0).escape("#parse",")",He).escape("#include",")",He).escape("#evaluate",")",He).escape("#end","",Q).escape("#break","",Q).escape("#stop","",Q).unescape("<!--#macro","-->",$e).unescape("<!--#if","-->",$e).unescape("<!--#elseif","-->",$e).unescape("<!--#else","-->",K).unescape("<!--#foreach","-->",$e).unescape("<!--#parse","-->",$e).unescape("<!--#include","-->",$e).unescape("<!--#evaluate","-->",$e).unescape("<!--#end","-->",K).unescape("<!--#break","-->",K).unescape("<!--#stop","-->",K).unescape("<!--#set","-->",ov,!0),e.createSyntax("mailchimp").escape("*|","|*",Q).unescape("<!--*|","|*-->",K)},vr="bare",sv=new Map;function av(e){return e?sv.get(e)??vr:vr}var qa=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function ho(e){return qa.includes(e)}function lt(e){return e==="bare"||e==="html-comment"}function kn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function lv(e,t=n=>{}){const n={output:{},editor:{}};if(e==null)return n;let r;if(typeof e=="string"){if(!lt(e))return t(`templateDirectives: unknown form "${String(e)}", falling back to the default ("bare").`),n;r={output:e}}else if(typeof e=="object"&&!Array.isArray(e))r=e;else return t(`templateDirectives: expected a string or an object, got ${typeof e}. Ignored.`),n;for(const[d,f]of[["output",r.output],["editor",r.editor]])if(f!==void 0&&!lt(f))return t(`templateDirectives.${d}: unknown form "${String(f)}", configuration ignored.`),n;if(r.syntaxes!==void 0&&!kn(r.syntaxes))return t("templateDirectives.syntaxes: expected an object, configuration ignored."),n;if(r.syntaxes){for(const[d,f]of Object.entries(r.syntaxes))if(!(!ho(d)||f===void 0||lt(f))){if(!kn(f))return t(`templateDirectives.syntaxes.${d}: expected a form or an object, configuration ignored.`),n;for(const h of["output","editor"]){const y=f[h];if(y!==void 0&&!lt(y))return t(`templateDirectives.syntaxes.${d}.${h}: unknown form "${String(y)}", configuration ignored.`),n}}}if(r.output===void 0&&r.editor===void 0&&r.syntaxes===void 0)return n;const i=r.output??vr;let o=r.editor;i==="bare"&&r.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),o=void 0);const s=[];if(r.syntaxes)for(const d of Object.keys(r.syntaxes)){if(!ho(d)){t(`templateDirectives.syntaxes: unknown syntax id "${d}", entry ignored.`);continue}s.push(d)}else s.push(...qa);const a={},c={};for(const d of s){const f=r.syntaxes?.[d],h=kn(f)?f:void 0,y=(lt(f)?f:h?.output)??i;let b=h?.editor??o??y;y==="bare"&&b==="html-comment"&&(t(`templateDirectives.syntaxes.${d}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),b="bare"),a[d]=y,c[d]=b}return{output:a,editor:c}}function za(e,t,n,r){for(let i=t;i<n;i++){const o=e[i];r.insideAttributeValue?r.attributeQuoteChar==='"'||r.attributeQuoteChar==="'"?o===r.attributeQuoteChar&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0):r.unquotedAttr&&/[\s>]/.test(o)&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0,r.unquotedAttr=!1):o==="<"?r.insideTag=!0:o===">"?r.insideTag=!1:r.insideTag&&(o==='"'||o==="'")?(r.insideAttributeValue=!0,r.attributeQuoteChar=o,r.unquotedAttr=!1):r.insideTag&&/\S/.test(o)&&r.attributeQuoteChar===void 0&&e[i-1]==="="&&!['"',"'","`"].includes(o)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function gt(e,t){return e.start<t.end&&t.start<e.end}function mo(e,t,n,r,i=[]){if(n&&(t=t.filter(f=>f.isVariable)),!t.length)return[];const o=t.flatMap(f=>f.match(e).flatMap(h=>!Number.isInteger(h.start)||!Number.isInteger(h.end)||h.start<0||h.end>e.length||h.start>=h.end?[]:[{range:h,mapFn:f.mapFn,overrideBuiltins:f.overrideBuiltins,syntax:f.syntax,isVariable:f.isVariable}])).sort((f,h)=>f.range.start-h.range.start||f.range.end-h.range.end),s=[],a=i.slice().sort((f,h)=>f.start-h.start),c={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let d=0;for(const{range:f,mapFn:h,overrideBuiltins:y,syntax:b,isVariable:T}of o){if(r?(c.insideAttributeValue=!0,c.attributeQuoteChar='"'):za(e,d,f.start,c),d=f.end,a.some(_=>gt(_,f)))continue;const w=c.insideAttributeValue?c.attributeQuoteChar??"":void 0,g=e.substring(f.start,f.end),C=h(g,w,c.insideTag);C!==!1&&C!==g&&(s.push({range:f,text:C,overrideBuiltins:y,syntax:b,isVariable:T}),a.push(f))}return s.sort((f,h)=>f.range.start-h.range.start||f.range.end-h.range.end)}function cv(e,t){const n=t.reduce((a,{mapFn:c,start:d,end:f,syntax:h,isVariable:y})=>(a[d]||(a[d]=[]),a[d].push({value:f,mapFn:c,syntax:h,isVariable:y}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),i=new RegExp(r,"g"),o=[];let s;for(;(s=i.exec(e))!==null;){const a=s[0];o.push({start:s.index,startToken:a,endTokens:n[a]})}return o}function Ln(e,t,n,r,i=!1){const o=[];if(n&&(t=t.filter(d=>d.isVariable)),!t.length)return o;const s=cv(e,t),a={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let c=0;for(let d=0;d<s.length;d++){const{start:f,startToken:h,endTokens:y}=s[d];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):za(e,c,f,a),c=f;const b=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let T=!1;for(const{mapFn:w,value:g,syntax:C,isVariable:_}of y){let P=f+h.length,S=e.indexOf(g,P);for(;S!==-1;){let M=S,v=f+h.length,E=0;for(;M!==-1;){const p=e.indexOf(h,v);if(p!==-1&&p<M)E++,v=p+h.length,M=e.indexOf(g,v);else if(E>0)E--,v=M+g.length,M=e.indexOf(g,v);else break}if(M<0)break;const A=M+g.length,m=e.substring(f,A),l=w(m,b,a.insideTag);if(l===!1){P=S+Math.max(g.length,1),S=e.indexOf(g,P);continue}(i||l!==m)&&o.push({range:{start:f,end:A},text:i?m:l,syntax:C,isVariable:_});const u=s.findIndex(({start:p})=>p>=A);u>d?d=u-1:d=s.length,T=!0;break}if(T)break}}return o}function Xt(e,t){if(!t.length)return e;const n=t.slice().sort((i,o)=>o.range.start-i.range.start);let r=e;for(const{text:i,range:o}of n)r=r.slice(0,o.start)+i+r.slice(o.end);return r}var dv=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=Va){const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,i,o,s){return t.push({start:r,end:i,mapFn:o,isVariable:s,syntax:this.syntax||r}),this},unescape(r,i,o,s){return n.push({start:r,end:i,mapFn:o,isVariable:s,syntax:this.syntax||r}),this}})}registerMatcherPair(e){const t=e.syntax||"matcher",n={syntax:t,match:e.escape.match,mapFn:e.escape.mapFn,isVariable:e.escape.isVariable,overrideBuiltins:e.escape.overrideBuiltins},r={syntax:t,match:e.unescape.match,mapFn:e.unescape.mapFn,isVariable:e.unescape.isVariable,overrideBuiltins:e.unescape.overrideBuiltins};this._escapeMatchers.push(n),this._unescapeMatchers.push(r);let i=!1;const o={dispose:()=>{i||(i=!0,this._escapeMatchers=this._escapeMatchers.filter(s=>s!==n),this._unescapeMatchers=this._unescapeMatchers.filter(s=>s!==r))}};return this.addDisposable(o),o}_collectMappings(e,t,n){const r=Ln(e,this._escapes,t,n),i=mo(e,this._escapeMatchers,t,n),o=i.filter(c=>c.overrideBuiltins).map(c=>c.range),s=r.filter(c=>!o.some(d=>gt(d,c.range))),a=i.filter(c=>c.overrideBuiltins||!s.some(d=>gt(c.range,d.range)));return[...s,...a].sort((c,d)=>c.range.start-d.range.start||c.range.end-d.range.end)}getMappings(e,t,n){return this._collectMappings(e,t,n)}_collectRevertMappings(e,t){const n=Ln(e,this._unescapes,t),r=mo(e,this._unescapeMatchers,t,!1),i=r.filter(a=>a.overrideBuiltins).map(a=>a.range),o=n.filter(a=>!i.some(c=>gt(c,a.range))),s=r.filter(a=>a.overrideBuiltins||!o.some(c=>gt(a.range,c.range)));return[...o,...s].sort((a,c)=>a.range.start-c.range.start||a.range.end-c.range.end)}getRevertMappings(e,t,n){const r=n?i=>i!==void 0&&n.has(i):i=>av(i)==="html-comment";return this._collectRevertMappings(e,t).filter(i=>i.isVariable||!r(i.syntax))}getDetectedMappings(e,t,n){return Ln(e,this._escapes,t,n,!0)}getEscapedText(e,t){return Xt(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return Xt(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=o=>o===void 0?void 0:t[o],r=Object.values(t);let i=e;return r.includes("bare")&&(i=Xt(i,this._collectRevertMappings(i).filter(o=>n(o.syntax)==="bare"))),r.includes("html-comment")&&(i=Xt(i,this._collectMappings(i).filter(o=>!o.isVariable&&n(o.syntax)==="html-comment"&&o.text.startsWith("<!--")&&o.text.endsWith("-->")))),i}hasDetectedMappings(e,t,n){return this.getDetectedMappings(e,t,n).length>0}addDisposable(e){this._disposables.push(e)}dispose(){for(const e of this._disposables)e.dispose()}};function go(e){return e.replace("<script","<___script").replace("<\/script>","</___script>")}var vo=new dv(e=>{e.escape("<script","<\/script>",t=>go(t)).unescape("<___script","</___script>",t=>t.replace("<___script","<script").replace("</___script>","<\/script>")),e.escape("<script","/>",t=>go(t)).unescape("<___script","/>",t=>t.replace("<___script","<script")),Va(e)});function uv(e){const t=lv(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return ea();const n=new Set(Object.keys(t.output).filter(i=>t.output[i]==="html-comment")),r=new Set(Object.keys(t.output));return{isConfigured:()=>!0,toEditorForm:i=>vo.normalizeToPolicy(i,t.editor),toOutputForm:i=>vo.normalizeToPolicy(i,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:Zs(r)}}function fv(e){let t;e.injectFactory(Cr,()=>{const n=e.getInstance(oe)?.layers().user.templateDirectives;return(!t||t.raw!==n)&&(t={raw:n,policy:uv(n)}),t.policy})}var pv=[{name:"rest.client",setup:Gm},{name:"auth.oauth",setup:rc},{name:"rest.identityHeaders",setup:jm},{name:"lifetime.destroyable",provides:[ni],setup:Bh},{name:"appInit",provides:[xe,Nr],setup:Nc},{name:"config",provides:[oe],setup:Fh},{name:"templateDirectives",provides:[Cr],setup:fv},{name:"email.documents",setup:im},{name:"show.initPipeline",provides:[Ae],setup:Vm},{name:"show",setup:Vg},{name:"locale.service",provides:[Tt],setup:km},{name:"locale.fromConfig",awaits:{services:[oe,Tt]},setup:Lm},{name:"canvas.early",setup:xp},{name:"canvas.previewSettings",setup:$p},{name:"canvas.sandboxExtensions",setup:Vp},{name:"canvas.sandboxScriptRelay",setup:Wp},{name:"canvas.headerSync",provides:[da],setup:Lp},{name:"canvas.ampSync",setup:$u},{name:"canvas.moduleBridge",setup:yf},{name:"canvas.port",setup:Qu},{name:"canvas.images",setup:Xu},{name:"canvas.edits",setup:Xf},{name:"canvas.blockContent",setup:Vf},{name:"canvas.sandboxFill",provides:[ei],setup:hh},{name:"canvas.reactions",setup:Op}],hv=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function mv(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 gv(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 Wa(e){const t=mv(e),n=[],r=new Set,i=[],o=new Set,s=a=>{if(!r.has(a)){if(o.has(a)){const c=i.indexOf(a);throw new hv([...i.slice(c),a].map(d=>d.name))}o.add(a),i.push(a);for(const c of gv(a,t))s(c);i.pop(),o.delete(a),r.add(a),n.push(a)}};for(const a of e)s(a);return n}var bo;function li(e){const t=e.getInstance(se);if(t)return t;e.getInstance(U)||e.inject(U,new ie);const n=Ee();e.inject(se,n),bo??=Wa(pv);for(const r of bo)r.setup(e);return n}function vv(e){}var bv=[{name:"save.previewFollow",setup:vv}],yo=F("plugin.lateUnitsInstalled");function yv(e){if(!e.getInstance(yo)){e.inject(yo,!0);for(const t of Wa(bv))t.setup(e)}}function Ev(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function _v(e){if(!e)return;const t=Mr(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 wv=ot(e=>{let t,n,r;return{async setOptions(i){const o=r!==i.getAuthToken,s=!Ce(t,i.user),a=n!==i.project;if(r=i.getAuthToken,t=i.user,n=i.project,!(!e.getInstance(Te)||!i.getAuthToken)&&!(!o&&!s&&!a))try{const c=await i.getAuthToken(i.user,i.project);e.inject(Zl,Promise.resolve(c||""));const d=_v(c);if(!d)return;e.inject(ql,d);const f=e.getInstance(xe),h=f?await f.catch(()=>{}):void 0;e.inject(xe,Promise.resolve(Ev(d,h)))}catch{}}}});function Sv(e,t){if(e.getInstance(yi))return;e.inject(yi,!0);const n=ue(e,j.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}var Iv=ot(e=>{let t,n=!1;return{setOptions(r){const i=n;if(n=!0,!Lt(r)){t&&(Ih(e),ti(r)),t=void 0;return}const o=gn(r);if(!o||t===o&&e.getInstance(Te))return;t=o,e.inject(Te,o);const s=e.getInstance(U);s&&Sv(e,s)}}}),Cv=ot(e=>{const t=e.getInstance(U),n=ue(e,Ko),r=B(n),i=t.addDisposable(new et(r));return{setOptions({handleLoad:o}){i.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}});function Ka(e,t,n=!0){const r=e,i=t;for(const o of Object.keys(i)){const s=i[o];s!=null&&(n&&typeof s=="object"?r[o]=Ka(r[o]||{},s,!0):r[o]=s)}return e}async function Tv(e){const t=(await ac(()=>import("./static/esm/2490dab8.js").then(n=>bl(n.default)),[],import.meta.url)).default;return new Promise((n,r)=>{t.load({google:{families:[e]},classes:!1,active:()=>n(),inactive:()=>r(new Error(`Шрифт не загрузился: ${e}`))})})}var Ya=F("EditorOptions"),br=Xl;function Av(e){const t=typeof e.font_family=="string"?`${e.font_family}, sans-serif`:void 0,n=e.word_wrap===void 0?void 0:e.word_wrap?"on":"off";return{tabSize:e.tab_size,fontFamily:t,fontSize:e.font_size,wordWrap:n,insertSpaces:e.insert_spaces,minimap:{enabled:e.minimap}}}function Rv(e){return e.getOrCreateInstance(Ya,()=>{const t=Ee(br);let n=br.fontFamily;return t.watch(r=>{!r.fontFamily||r.fontFamily===n||(n=r.fontFamily,Promise.resolve(Tv(r.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function Pv(e){return e?.getInstance(Ya)?.get()??br}function Dv(e,t={}){const n=Rv(e);n.set(Ka({...n.get()},Av(t)))}function Ov(e){return{font_size:e.fontSize,font_family:e.fontFamily,tab_size:e.tabSize,word_wrap:e.wordWrap,minimap:e.minimap,insert_spaces:e.insertSpaces}}function xv(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var Mv=F("plugin.publicConfig");function yr(e){return e.getInstance(oe)?.get()??{}}function Eo(e){return e.getInstance(oe)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function _o(e){const t=Ea(e),n=yr(e);return{...n,locale:n.locale||"en_US",theme:n.theme||"light",editor:xv(Pv(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function wo(e){return e.getInstance(oe)?.get()!==void 0}function kv(e){const t=zo(),n=fe(e,Yo);let r,i,o=!1;const s=async()=>{try{return e.getInstance(xe)===void 0?{}:(await e.getInstanceAsync(xe))?.app_config||{}}catch{return{}}},a=async({onlyChangedCodeMode:h=!1}={})=>{await e.getInstance(oe)?.ready(),ts(e).set(yr(e).revisionService===!0);const{codeModeDirection:y,editor:b}=yr(e);b&&Dv(e,Ov(b)),y!==void 0&&!(h&&y===i)&&(i=y,y==="none"?dr(e,!1):(dr(e,!0),wh(e,y)))},c=async()=>{if(!wo(e))return;const h=_o(e),y=JSON.stringify(h);y!==r&&(r=y,await n.fire(h))},d=async h=>{const y=e.getInstance(oe),b={advancedConfigs:Eo(e).advancedConfigs,serverSide:await s(),user:h};y?.setAdvancedConfigs({...b.advancedConfigs,...b.user?.advancedConfigs}),y?.replace(b.user,"user"),y?.replace(b.serverSide,"server"),await a(),await c()},f=h=>{const{commonStyles:y,...b}=h;return"commonStyles"in h&&Hp(e,y===void 0?void 0:y),b};return{queue:t,reactToConfig:a,emitConfigChanged:c,resolveServerSideConfig:s,getConfig:()=>wo(e)?_o(e):{},setConfig:t.decorate(async h=>{await d(f(h))}),updateConfig:t.decorate(async h=>{const y=f(h);await d({...Eo(e).user,...y})}),announceAssembled(){o||(o=!0,e.getInstance(oe)?.ready().then(t.decorate(async()=>{await a({onlyChangedCodeMode:!0}),await c()})))}}}function Xa(e){return e.getOrCreateInstance(Mv,()=>kv(e))}function Lv(e){const t=Xa(e);return{getConfig:()=>t.getConfig(),setConfig:n=>t.setConfig(n),updateConfig:n=>t.updateConfig(n)}}var Nv=ot(e=>{const t=e.getInstance(U),n=t.addDisposable(new Me),r=t.addDisposable(new Me),i=kt(e,Yo),o=B(n.event),s=B(r.event),a=Ba(B(i.event),e),c=t.addDisposable(new et(o)),d=t.addDisposable(new et(s)),f=t.addDisposable(new et(a));return{instance:{handleSetOptions:o,handleOptionsChanged:s,handleConfigChanged:a},async setOptions(h){c.setListener(h.handleSetOptions),d.setListener(h.handleOptionsChanged),f.setListener(h.handleConfigChanged),Xa(e).announceAssembled(),await n.fire(h),await r.fire(h)},dispose(){}}}),Nn,Ja="core";function Fv(){const e=window.__useblocks__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([Ja],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function jv(e){const t=window.__useblocks__?.require?.warm;return typeof t!="function"?Bt().then(()=>{}):t([Ja],e)}function Bt(){return Nn===void 0&&(Nn=Fv().then(e=>(wt()&&e.installDiagnostics().catch(t=>{}),e))),Nn}var Fn=null,jn=null;async function Bv(e){typeof e?.prefetch=="function"&&await e.prefetch()}function ci(){return Fn||(Fn=Bt().then(()=>{})),Fn}function Qa(e){return jn||(jn=Bv(e)),jn}function Uv(){return Qa(typeof window.__useblocks__<"u"?window.__useblocks__:void 0)}function Hv(){const e=typeof window.__useblocks__<"u"?window.__useblocks__:void 0,t=e?.__compatMissingReason;return e&&(e.__compatMissingReason=void 0),typeof t=="string"?t:void 0}function $v(e){return Promise.all([ci(),Qa(e)]).then(()=>{})}function Gv(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function So(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>jv(t?{priority:t}:void 0)).then(()=>(Jr(t?{priority:t}:void 0),n?ci():void 0)).catch(()=>{})}function Vv(e){const t=Gv(e);if(t==="eager")So(e);else if(t==="idle"){const n=()=>So(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var Za="PluginRegistry";function qv(e=Sl()){return e.getOrCreateInstance(Za,()=>new mc)}var zv=new gc(()=>qv()),Wv=["handleAIImageRequest","handleAITextRequest","handleCloneEmail","handleConfigChanged","handleDestroy","handleEmailAutosave","handleEmailChanged","handleEmailInit","handleError","handleFileProxy","handleHtmlChanged","handleLimitUsage","handleLivePreviewEmail","handleLoad","handleLoadImage","handleNextButtonClick","handleNotify","handleOptionsChanged","handlePreheaderChanged","handlePreviewEmail","handlePreviousButtonClick","handleReadBlocks","handleReadComments","handleReadCommonBlocks","handleReadEmail","handleReadEmailAutosave","handleReadEmailRevisions","handleReadLocale","handleReadTemplateBlocks","handleRemoveBlock","handleRemoveComment","handleRemoveEmail","handleRemoveEmailAutoSave","handleSaveBlock","handleSaveButtonClick","handleSaveComment","handleSaveEmail","handleSetOptions","handleShareEmail","handleSubjectChanged","handleSuccess","handleTestEmailModal","handleTestEmailSend","handleTranslate","handleUrlProxy","handleValidate"],Kv=["compileEmail","getBlocks","getComments","getEmail","getEmailRevisions","getEmailSnapshot","save","setConfig","show","updateConfig","useAsync","validateCode","waitPlugin"],dn=new Map([...Wv.map(e=>[e,"event"]),...Kv.map(e=>[e,"async"]),["setEmailMeta","queued"],["setBlockMeta","queued"],["notify","queued"],["getConfig","sync"],["use","sync"],["getElement","element"],["getCodeErrors","codeErrors"],["container","field"],["undoRedoService","field"]]),Yv=new Map([["use","use `useAsync()` or await `ready` first"]]);function Xv(e){return Yv.get(e)??"await `ready` first"}var Jv=new Set(["async","queued"]),Qv=Symbol.for("emailmaker.earlyCtxPlaceholder");function Io(e){return e[Qv]=!0,e}function Zv(e){return new Error(`[emailmaker] ${e}() is not available in a plugin constructor: the editor core is still loading. Call it from init() or later (${Xv(e)}).`)}function eb(e){return new Error(`[emailmaker] ${e}() is missing from the editor instance after the core has loaded.`)}function tb(e){return[...dn].filter(([t,n])=>n!=="field"&&e[t]===void 0).map(([t])=>t).sort((t,n)=>t.localeCompare(n))}function nb(e,t){for(const n of tb(e)){const r=dn.get(n);if(r!==void 0&&Jv.has(r)){const i=async(...o)=>{await t;const s=e[n];if(typeof s!="function"||s===i)throw eb(n);return s.apply(e,o)};e[n]=Io(i);continue}e[n]=Io(()=>{throw Zv(n)})}}function rb(e,t,n){e.getInstanceAsync(tt).then(()=>{kt(e,j.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_CREATE_ERROR",data:{plugin:t},innerException:n})},()=>{})}function ib(e,t){e.getInstanceAsync(tt).then(()=>{kt(e,j.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_LOAD_ERROR",data:{plugin:t.name,url:t.url,message:t.error.message},innerException:t.error})},()=>{})}var ob=ot(e=>{let t;function n(){return new Promise(i=>{const o=e.getOrCreateInstance(Dr,()=>new Set),s=()=>{o.delete(s),i()};o.add(s)})}function r(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(i){const o=e.getInstance(hn),s=e.getInstance(Za);if(!t){t=new hc(o,s,{ensureHostRuntimeReady:Uv,explainScriptFailure:Hv,openEarlyWindow:()=>Ng(e),reportLoadFailure:d=>ib(e,d)}),e.inject(xr,t);const c=t.onLifecycle(d=>{d.type==="create:error"&&rb(e,d.name,d.error)});e.getInstance(U)?.addDisposable(c)}const a=i?.plugins||[];o&&(Ls(e),a.length>0&&nb(o,n()),await t.setPlugins(a))},instance:{use(i){return typeof i=="function"?r().useByCtor(i):r().useByKey(i)},useAsync(i){return r().useAsync(i)},waitPlugin(i){return r().waitFor(i)}},dispose(){t?.dispose(),t=void 0}}}),el=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}},sb=F("ELEMENT_INSERT_HTML_PIPELINE"),ab=F("BLOCK_INSERT_HTML_PIPELINE"),lb="application_block_inserted",cb=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(ab,()=>new el).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(Ot,()=>new xt),i=n?e.bind(n):e;return r.addListener(lb,i,t)}},di=F("ComponentRegistry"),db=F("ComponentRegistryGate");function ui(){return nt.getOrCreateInstance(db,()=>({pending:[]}))}function ub(e=di){return ui().factory!==void 0||nt.getInstance(e)!==void 0}function Er(e,t,n=di){if(ub(n)){t(un(e,n));return}ui().pending.push(()=>t(un(e,n)))}function un(e,t=di){const n=nt.getInstance(t);if(n)return n;const r=ui().factory;if(!r)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return nt.getOrCreateInstance(t,r)}var fb=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=[];let n=!1;const r=o=>{if(!n){n=!0;for(const s of t)s.dispose();e(o)}};t.push(this._container.addService(Ht,{execute:o=>{r(o.value.map(s=>({name:s.name,html:s.html})))}}));const i=this._container.getInstance(jl)?.watch(o=>{o&&r([])});i&&(n?i.dispose():t.push(i))})}update(e,t){const n=this._container;return n.addService(Ht,{execute:r=>{const i=un(n),o=r.value.find(s=>s.name===e);if(o){const{icon:s,title:a,fallbackTooltip:c,...d}=t;s&&(o.icon=i.getReactNode(s)),a&&(o.title=i.getReactNode(a)),c&&(o.fallbackTooltip=i.getReactNode(c)),Object.assign(o,d)}}})}delete(e){this._container.addService(Ht,{execute:t=>{const n=t.value.findIndex(r=>r.name===e);n>=0&&t.value.splice(n,1)}})}insert(e,t){const n=this._container;return n.addService(Ht,{execute:r=>{const i=un(n);r.value.splice(t??r.value.length,0,{...e,title:i.getReactNode(e.title),icon:i.getReactNode(e.icon),fallbackTooltip:i.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(sb,()=>new el).add(e,t??0,n)}handleInject(e,t,n){return Ze(this._container,Nl).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},pb=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(Ot,()=>new xt)}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 hb(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}function Co(e,t){if(!t)return;const n=r=>r===void 0?void 0:e.getReactNode(r);return{...t,footer:n(t.footer),okText:n(t.okText),cancelText:n(t.cancelText),closeIcon:n(t.closeIcon)}}var mb=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=Ze(t,ec),this._closeModalEmitter=Ze(t,Cl),this._updateModalEmitter=Ze(t,Il)}get _container(){return this._context.container}show(e){const t=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,n=e.modalProps;return Er(this._container,r=>{this._showModalEmitter.fire({...e,content:r.getReactNode(e.content),title:r.getReactNode(e.title),id:t,modalProps:Co(r,n)})}),t}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=t.modalProps;Er(this._container,r=>{this._updateModalEmitter.fire(hb({...t,content:r.getReactNode(t.content),title:r.getReactNode(t.title),id:e,modalProps:Co(r,n)}))})}},gb=class{_registration;_loadedDisposable;loaded;ready;_loadedSettled=!1;_readySettled=!1;_readyListeners=new Set;constructor(e,t){this._registration=e,this._loadedDisposable=t,this.loaded=new Promise((n,r)=>{this._resolveLoaded=()=>{this._loadedSettled||(this._loadedSettled=!0,n())},this._rejectLoaded=i=>{this._loadedSettled||(this._loadedSettled=!0,r(i))}}),this.ready=new Promise((n,r)=>{this._resolveReady=()=>{this._readySettled||(this._readySettled=!0,n())},this._rejectReady=i=>{this._readySettled||(this._readySettled=!0,r(i))}})}_resolveLoaded=()=>{};_rejectLoaded=()=>{};_resolveReady=()=>{};_rejectReady=()=>{};resolveLoaded(){this._resolveLoaded()}resolveReady(){this._resolveReady();for(const e of Array.from(this._readyListeners))try{e()}catch{}}onReady(e){return this._readyListeners.add(e),this._readySettled&&e(),{dispose:()=>{this._readyListeners.delete(e)}}}rejectLoad(e){this._rejectLoaded(e),this._rejectReady(e)}rejectReady(e){this._rejectReady(e)}dispose(){this._registration.dispose(),this._loadedDisposable.dispose(),this._readyListeners.clear();const e=new Error("Sandbox script registration disposed before completion.");this.rejectLoad(e),this.rejectReady(e)}},vb=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(Ot,()=>new xt)}_createScriptHandle(e,t){const n=this._messageService.addListener(Rr,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 gb(t,n);return r}registerSandboxCSS(e){return this._container.addService(Xe,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(Xe,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(Xe,{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(Xe,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},bb=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function _r(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&bb.has(t)}function tl(){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 Bn(){return`__settingsPanel:${tl()}`}function Un(e,t){return{type:e,props:t}}function yb(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!_r(e)}function To(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(_r(t)){const r=Bn();return n(e.add(r,t)),Un(r,{})}if(typeof t=="function"){const r=Bn();return n(e.add(r,t)),Un(r,{})}if(yb(t)){const r=t.type;if(typeof r=="string")return t;if(_r(r)||typeof r=="function"){const i=Bn();return n(e.add(i,r)),Un(i,t.props)}return t}return t}var Eb=class{_context;_panelRegistrationDisposables=[];constructor(e){this._context=e}get _container(){return this._context.container}_clearPanelRegistrations(){for(const e of this._panelRegistrationDisposables)e.dispose();this._panelRegistrationDisposables.length=0}_trackRegistration(e){this._panelRegistrationDisposables.push(e)}showSettingsPanel(e){this._clearPanelRegistrations();const t=e.instanceKey??tl();Er(this._container,n=>{const r=s=>this._trackRegistration(s),i=To(n,e.content,r),o=e.advancedTabs?.map(s=>({...s,content:To(n,s.content,r)}));Ze(this._container,bi).fire({...e,content:i,advancedTabs:o,instanceKey:t,type:Fl})})}closeSettingsPanel(){this._clearPanelRegistrations(),Ze(this._container,bi).fire(null)}},nl={SandboxScriptApi:vb,ElementsApi:fb,BlocksApi:cb,MessageService:pb,SettingsPanelApi:Eb,ModalApi:mb};function Hn(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 a=i[o],c=r[o]??{};i[o]=Object.assign({},typeof a=="object"&&a!==null?a:c,s)}else i[o]=s;return i}var me={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}},_b={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"},$n={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},Ao={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},We={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:me.border,borderRadius:me.borderRadius,textAlign:"center",padding:me.padding},Ro={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:me.padding},Gn={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:me.border,borderRadius:me.borderRadiusCards};function wb(e){return{..._b,...e}}function Sb(e){return{...$n,...e,bold:e?.bold??$n.bold,italic:e?.italic??$n.italic}}function Ib(e){return{...Ao,...e,underline:e?.underline??Ao.underline}}function Cb(e){return{...We,...e,bold:e?.bold??We.bold,italic:e?.italic??We.italic,border:{...We.border,...e?.border},borderRadius:{...We.borderRadius,...e?.borderRadius},padding:{...We.padding,...e?.padding}}}function Tb(e){return{...Ro,...e,padding:{...Ro.padding,...e?.padding}}}function Ab(e){return{...Gn,...e,border:{...Gn.border,...e?.border},borderRadius:{...Gn.borderRadius,...e?.borderRadius}}}function Vn(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 Po(e){let t={...Pr};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function qn(e){return{text:wb(e.text),headings:Sb(e.headings),links:Ib(e.links),buttons:Cb(e.buttons),block:Tb(e.block),cards:Ab(e.cards)}}var Do=F("EmailSettingsPort"),Rb=1e4,rl=class{_editor;_layoutSettingsChanged=new Yn;_contentStylesChanged=new Yn;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){const t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),this._replayToEarlyPlugin(e,()=>this._getCurrentLayoutSettings()),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){const t=this._contentStylesChanged.event(e);return this._ensureMessageSubscription(),this._replayToEarlyPlugin(e,()=>this._getCurrentContentStyles()),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}_replayToEarlyPlugin(e,t){if(!ja(this._editor.container)||!Je(this._editor.container)?.current()?.get().attributes.is_inited)return;const n=t();queueMicrotask(()=>e(n))}_disposeMessageSubscriptionIfUnused(){this._layoutSettingsChanged.hasListeners()||this._contentStylesChanged.hasListeners()||(this._messageSubscription?.dispose(),this._messageSubscription=void 0)}_settings(e=this._editor.container){const t=e.getInstance(Do);if(!t)throw new Error("[extensions] email settings are not loaded yet — UI work starts at init()");return t}_getCurrentLayoutSettings(){return Vn(this._settings().read())}_getCurrentContentStyles(){const e=Je(this._editor.container)?.current()?.get().attributes.common_styles;return qn(Po(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(Do),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(Ot,()=>new xt),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===$.APPLICATION_EMAIL_SETTINGS_SET){const c=Vn(i?.settings),d=this._getLayoutSnapshot(c);d!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=d,this._layoutSettingsChanged.fire(c));return}if(o!==$.APPLICATION_COMMON_STYLES_UPDATE)return;const s=qn(r.data?.settings?.commonStyles??{...Pr}),a=this._getContentSnapshot(s);a!==this._prevContentSnapshot&&(this._prevContentSnapshot=a,this._contentStylesChanged.fire(s))})})();try{await this._messageSubscriptionPromise}finally{this._messageSubscriptionPromise=void 0}}}async getEmailLayoutSettings(){return await this._waitForEmailSettingsFromIframe(),this._getCurrentLayoutSettings()}async setEmailLayoutSettings(e){await this._waitForEmailSettingsFromIframe();const t=this._settings(),n={...t.read(),...e};t.write(n);const r=Vn(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=Rb){const t=Je(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=ue(r,j.ON_EMAIL_INIT_ID);return new Promise(o=>{let s=!1,a;const c=()=>{a&&(clearTimeout(a),a=void 0)},d=i(()=>{s||(s=!0,c(),d.dispose(),o())});a=setTimeout(()=>{s||(s=!0,d.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Je(this._editor.container)?.current();if(!t)return;const n=Po(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=Hn(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:me.border,borderRadius:me.borderRadius,padding:me.padding})),e.block!==void 0&&(n.block=Hn(n.block||{},e.block,["padding"],{padding:me.padding})),e.cards!==void 0&&(n.cards=Hn(n.cards||{},e.cards,["border","borderRadius"],{border:me.border,borderRadius:me.borderRadiusCards}));const r=JSON.stringify(n);Ct(t,{common_styles:r},{source:"system"}),this._settings().markAppearanceChanged();const i=qn(n);this._prevContentSnapshot=this._getContentSnapshot(i),this._contentStylesChanged.fire(i)}},Pb={...nl,EmailSettingsApi:rl},Db={...nl},xE={...Db,EmailSettingsApi:rl},Ob={...Pb};function xb(){zv.addAll(Ob)}var Mb=[ot(()=>{xb()}),Cv,Nv,Iv,zl,wv,tc];async function kb(){return(await Bt()).asyncMixins}var Lb=ob,Nb=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let i;try{i=await kb()}catch(s){throw e.failPendingWaits(s),s}t=i(e);const o=await e.getInstanceAsync(hn);Object.assign(o,t.instance||{});for(const s of e.getInstance(Dr)??[])s()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},Fb=Ql([...Mb]);function zn(){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,a){const c=Symbol("subscription");return t||(n.set(c,{listener:o,priority:s,thisArg:a}),e&&r.set(c,e(o,s,a))),()=>{n.delete(c),r.get(c)?.(),r.delete(c)}},attach(o){i(),e=o;for(const[s,{listener:a,priority:c,thisArg:d}]of n)r.set(s,o(a,c,d))},dispose(){t=!0,i(),n.clear(),e=void 0}}}function jb(e){const t=zn(),n=zn(),r=zn();return e.getInstance(U)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(tt).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(tt);if(o){o.notify(i);return}e.getInstanceAsync(tt).then(s=>s.notify(i),()=>{})}}}var il=F("CodeErrors"),Bb=[];function Ub(e){return e?.getInstance(il)?.get()??Bb}function Hb(e){return e?.getInstance(il)!==void 0}var $b=class extends ie{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=jt(e),this.addDisposable(ue(e,j.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}openEmail(){return ka(this._container,this._currentEmail)}async getBlocks(){const e=await this._readProjectBlocks();return await this._blockMetaWrites,(await this._dataSources.blocks.cache.values()).filter(t=>String(t.project)===String(e)).map(t=>ht(t,this._container))}async _readProjectBlocks(){const e=await eg(this._container);return await this._dataSources.blocks.byForeignKey("project").get(e),e}async getComments(){const{cache:e}=this._dataSources.comments,t=await this.getEmailSnapshot();return(await e.values()).filter(n=>n.post===t.id).map(n=>mt(n,this._container))}async getEmailRevisions(){const{cache:e}=this._dataSources.emailRevisions,t=await this.getEmailSnapshot();return(await e.values()).filter(n=>n.parent===t.id).map(n=>mr(n,this._container))}async getEmailSnapshot(){return de(this.openEmail(),this._container)}setEmailMeta(e){const t=si(this._container);if(!t)return;const n=t.get().attributes.meta;Ct(t,{meta:On({meta:n},e).meta});const r=t.get().serverId;r!=null&&this._dataSources.emails.cache.addOrUpdate(r,i=>i&&On(i,e))}setBlockMeta(e,t){const n=async()=>{await this._readProjectBlocks();const{cache:r}=this._dataSources.blocks;await r.getIfPresent(e)&&await r.addOrUpdate(e,i=>i&&On(i,t))};this._blockMetaWrites=this._blockMetaWrites.then(n).catch(()=>{})}getCodeErrors(){return Hb(this._container)?Ub(this._container):void 0}},Gb=F("EmailDataController");function Vb(e){return e.getOrCreateInstance(Gb,()=>{const t=new $b(e);return e.getInstance(U)?.addDisposable(t),t})}function qb(e){const t=Vb(e);return{getEmailSnapshot:()=>t.getEmailSnapshot(),getCodeErrors:()=>t.getCodeErrors(),getBlocks:()=>t.getBlocks(),getComments:()=>t.getComments(),getEmailRevisions:()=>t.getEmailRevisions(),setEmailMeta:n=>t.setEmailMeta(n),setBlockMeta:(n,r)=>t.setBlockMeta(n,r)}}function zb(e){return{undo:()=>e.undo(),redo:()=>e.redo(),clear:()=>e.clear(),canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo(),createSnapshot:()=>e.createSnapshot(),restoreSnapshot:t=>{e.restoreSnapshot(t)},getPast:t=>e.getPast(t).map(n=>({changes:n})),getFuture:t=>e.getFuture(t).map(n=>({changes:n}))}}function Wb(e){let t;const n=wa(e),r=ue(e,j.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(r(({history:o})=>{t=o}));const i=()=>t?zb(t):void 0;return{undoRedoService:{undo:()=>i()?.undo(),redo:()=>i()?.redo(),clear:()=>i()?.clear(),getPast:o=>i()?.getPast(o)??[],getFuture:o=>i()?.getFuture(o)??[],canUndo:()=>i()?.canUndo()??!1,canRedo:()=>i()?.canRedo()??!1,createSnapshot:()=>i()?.createSnapshot(),restoreSnapshot:o=>i()?.restoreSnapshot(o)}}}var Kb=F("plugin.mountElement");function Yb(e){const t=e.getInstance(se)?.get()?.element;if(typeof Element<"u"&&t instanceof Element||typeof DocumentFragment<"u"&&t instanceof DocumentFragment)return t}function Xb(e){return e.getOrCreateInstance(Kb,()=>{let t=!1,n;return{get:()=>t?n:Yb(e),set(r){t=!0,n=r}}})}function Jb(e){const t=Xb(e);return{getElement:()=>t.get()}}function Qb(e){return{handleLoadImage:B(ue(e,j.UPLOAD_EVENT_ID)),handleFileProxy:B(ue(e,j.FILE_PROXY_EVENT_ID)),handleUrlProxy:B(ue(e,j.PROXY_URL_EVENT_ID)),handleAITextRequest:B(ue(e,j.AI_TEXT_REQUEST_ID)),handleAIImageRequest:B(ue(e,j.AI_IMAGE_REQUEST_ID)),handleReadLocale:B(ue(e,j.READ_LOCALE)),handleLimitUsage:B(ue(e,j.ON_LIMIT_ID)),handleTranslate:B(ue(e,j.ON_TRANSLATE_ID))}}var Zb=[Uh,qg,jb,Lv,qb,Wb,Jb,Qb];function ey(e,t=Zb){const n=li(e);yv(e);const r=Fb(e),i=Lb(e),o=Nb(e),s={...r.instance,...i.instance,...o.instance};for(const c of t)Object.assign(s,c(e));let a=!0;return{instance:s,async setOptions(c){await r.setOptions(c);const d=a&&n.get()===c;a=!1,d||n.set(c),await i.setOptions(c),await o.setOptions(c)}}}function ty(e){return{get:t=>e.get(t),remove:(t,n)=>e.remove(t,n),set:(t,n,r)=>{if(n==null){e.get(t),e.remove(t,r);return}e.set(t,n,r)}}}var ny=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]}},ry="editor-runtime.react.copies",Wn=8;function At(e){return e&&typeof e=="object"?e:void 0}function Oo(e){const t=At(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=At(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function iy(e){const t=At(e),n=t&&typeof t.version=="string"?t.version:void 0,r=At(t?.default),i=r&&typeof r.version=="string"?r.version:void 0;return n??i??"unknown"}function oy(e,t,n){return e.package===t&&e.version===n}function sy({ourReact:e,entries:t,packageName:n,version:r}){const i=Oo(e);if(!i||!Array.isArray(t))return[];const o=[],s=new Set;for(const a of t){const c=At(a);if(!c||!oy(c,n,r))continue;const d=Oo(c.react);!d||d===i||s.has(d)||(s.add(d),o.push({package:n,version:r,reactVersion:iy(c.react),react:c.react}))}return o}function ay({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,Wn))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>Wn&&n.push(` …and ${t.length-Wn} more`),n.push("","Likely root cause: the editor is loaded from its UMD entry (a <script> on the page), while the","plugin was built as an ESM package by the host bundler. Those two never share a React.","","Fix it either way:"," • build the plugin on globals — it then takes React from the page registry, or"," • load the editor from its ESM entry and build both with the same bundler."),n.join(`
|
|
1048
|
-
`)}var xo=new Set;function ly({packageName:e="useblocks",version:t="1.1.
|
|
1048
|
+
`)}var xo=new Set;function ly({packageName:e="useblocks",version:t="1.1.103",log:n=r=>{}}={}){const r=i=>{try{const o=globalThis[Symbol.for(ry)],s=sy({ourReact:i,entries:o,packageName:e,version:t}).filter(a=>!xo.has(a.react));if(!s.length)return;s.forEach(a=>xo.add(a.react)),n(ay({packageName:e,copies:s}))}catch{}};try{const i=Lr()?.modules?.React;if(i&&typeof i.then=="function"){i.then(r,()=>{});return}r(i)}catch{}}async function cy(e,t,n){Y(e.signal);const r=t??nt.createChild();li(r);const i=r.getInstance(U);let o;async function s(){r.inject(Xo,ty(new ny)),ly();const a=ey(r),c={...a.instance,container:r,get ready(){return o??Promise.resolve(c)},async reset(d){if(Y(d.signal),i.isDisposed())throw Oe();return await a.setOptions(d),c}};r.inject(hn,c);try{if(n?.onInstance?.(c),await a.setOptions(e),Y(e.signal),i.isDisposed()||await $g(r),e.devTools)try{const d=r.getInstance(xr);d&&await(await Bt()).initDevTools(r,d)}catch{}return Y(e.signal),kt(r,Ko).fire(c),c}catch(d){throw i.dispose(),d}}try{return o=rn(s(),e.signal),o.catch(()=>{}),await o}catch(a){throw i.isDisposed()||i.dispose(),a}}var Rt=new WeakMap;function dy(e){return e?Rt.get(e):void 0}function ol(e){try{e.getInstance(U)?.dispose()}catch{}try{e.dispose()}catch{}}function uy(e,t){if(!e)return;const n=Rt.get(e);n&&n!==t&&ol(n),Rt.set(e,t)}function fy(e,t){e&&Rt.get(e)===t&&Rt.delete(e)}function py(e){const t=nt.createChild();return Lt(e)&&t.inject(Te,gn(e)),t}var _t=new WeakMap,hy="data-useblocks-config-styles";function my(e){return typeof e=="string"?e.trim():""}function Mo(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function gy(e,t,n){if(!e||typeof document>"u")return null;const r=my(t),i=_t.get(e),o=n||e;if(!r)return i&&(i.remove(),_t.delete(e)),null;if(i)return i.textContent!==r&&(i.textContent=r),(i.parentNode!==o||i!==o.firstChild)&&Mo(o,i),i;const s=document.createElement("style");return s.setAttribute(hy,"true"),s.textContent=r,Mo(o,s),_t.set(e,s),s}function vy(e){if(!e)return;const t=_t.get(e);t&&(t.remove(),_t.delete(e))}function sl(){return!1}var by=`
|
|
1049
1049
|
.blocks-app-initial-spinner-wrapper {
|
|
1050
1050
|
width: 100%;
|
|
1051
1051
|
height: 100%;
|
|
@@ -1074,7 +1074,7 @@ import{n as Go,r as bl}from"./static/esm/971f1b2c.js";import{A as Vo,At as rn,B
|
|
|
1074
1074
|
100% {
|
|
1075
1075
|
transform: rotate(360deg);
|
|
1076
1076
|
}
|
|
1077
|
-
}`;function yy(){return()=>{}}function Ey(e,t){if(!sl()||!e||typeof document>"u")return yy();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=by,document.head?.appendChild(i),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),i.remove())}}function _y(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function wy({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 a=o().catch(c=>{throw n.has(i)||(n.add(i),r(c)),_y(c)||t.delete(i),c});return t.set(i,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var fi=wy();function al(){fi.clear()}Ll(()=>fi.clear());var ko=new WeakMap;function pi(e){return ic(e)}function Sy(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function Iy(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function Cy(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 hi=new WeakMap;function Kn(e,t){hi.set(e,t)}function Ty(e){return hi.get(e)}function Ay(e,t){return async({baseUrl:n})=>{const r=t(),i=r&&hi.get(r)||e,o=pi(n);if(!o)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const s=new Headers({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),a=await Cy(i);if(i.getAuthToken&&!a)throw Iy();a&&s.set("authorization",a);const c=await Bl("/app/v1/app_init",{method:"POST",headers:s,body:new URLSearchParams,credentials:"same-origin"},o,{attemptTimeout:ti(i)||void 0});if(!c.ok)throw Sy(c.status,c.statusText);return await c.json()}}function Ry(e){return JSON.stringify({baseUrl:pi(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function Py(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function Dy(e){return t=>fi.run(Ry(t),()=>(Z("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>Z("appInit:end",{kind:"network"}))))}function Oy(e,t){if(Lt(e)||!e.appInit&&!pi(e.baseUrl)||!Py(e))return e;const n=e.appInit??Ay(e,t);let r=ko.get(n);return r||(r=Dy(n),ko.set(n,r)),{...e,appInit:r}}var ll=0;function xy(){return ll}function My(){ll+=1,al()}var Lo=new WeakMap,No=new WeakMap,ky=3e4;function Ly(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function Ny(e,t){try{const n=Mr(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+ky}function Fy(e){const t=new Map,n=new Map;return async(r,i,o)=>{const s=Ly(r,i);if(o)return n.delete(s),t.delete(s),al(),e(r,i,o);const a=n.get(s);if(a&&!t.has(s)){if(a.expiresAtMs>Date.now())return a.token;n.delete(s)}let c=t.get(s);return c===void 0&&(Z("authToken:start",{kind:"network"}),c=Promise.resolve(e(r,i,o)).then(d=>{const f=String(d||"").trim();return f&&n.set(s,{token:d,expiresAtMs:Ny(f,Date.now())}),d}).finally(()=>{Z("authToken:end",{kind:"network"}),t.delete(s)}),t.set(s,c)),c}}function jy(e){if(Lt(e))return e;const t=e.getAuthToken;if(!t)return e;let n=Lo.get(t);const r=xy();return(!n||No.get(t)!==r)&&(n=Fy(t),Lo.set(t,n),No.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(i=>{}),{...e,getAuthToken:n}}var By="[emailmaker] This editor was destroyed: a later init()/create() into the same element failed to start, and the editor could not be handed back. Call init() again; the reason is in `cause`.";function Uy(e){const t=new Error(By,{cause:e});return t.name="EditorStartFailedError",t}var Hy={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function Fo(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var cl=["handleLoad","handleDestroy"];function dl(e,t){let n=e;for(const r of cl){const i=e?.[r];typeof i=="function"&&(n={...n,[r]:(o,...s)=>i(t,...s)})}return n}function $y(e){let t,n="pending",r,i,o,s;const a=new Set,c=[],d=new Set;let f,h;const y=new Promise((I,O)=>{f=I,h=O});y.catch(()=>{});const b={},T=I=>t?.[I],w=()=>r??Oe(),g=(I,O)=>{const k=T(I);if(typeof k!="function")throw Fo(I);return k.apply(t,O)},C=(I,O)=>{try{return Promise.resolve(g(I,O))}catch(k){return Promise.reject(k)}},_=()=>{const I=t?.container?.getInstance?.(U);if(!(n!=="ready"||I?.isDisposed()||typeof T("getConfig")!="function"))try{s=g("getConfig",[])}catch{}},P=()=>n==="dead"?Promise.reject(w()):n==="ready"?Promise.resolve():y,S=()=>{for(const[I,O]of dn)O==="field"&&(b[I]=T(I))},M=I=>{const O=T(I.name);I.dispose||typeof O!="function"||n==="dead"||(I.dispose=O.apply(t,I.args))},v=()=>a.forEach(M),E=()=>{for(const I of a){try{I.dispose?.()}catch{}I.dispose=void 0}},A=()=>{S(),v()},m=()=>{o?.delete(A),o=void 0},l=(I,O)=>{const[k,...ee]=O;return!cl.includes(I)||typeof k!="function"?O:[(ce,...X)=>k(b,...X),...ee]},u=(I,O)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof T(I)!="function")throw Fo(I);const k={name:I,args:l(I,O)};return a.add(k),M(k),()=>{a.delete(k),k.dispose?.(),k.dispose=void 0}},p=()=>t?.container?.getInstance(se)?.get()?.content,R=()=>{const I=e.element();return I!==void 0&&typeof I!="string"?I:void 0},D=(I,O)=>{switch(O){case"event":return(...k)=>u(I,k);case"async":return(...k)=>(I==="show"&&k[0]!==void 0&&e.shown?.(k[0]),n!=="dead"&&typeof T(I)=="function"?C(I,k):P().then(()=>g(I,k)));case"queued":return(...k)=>{if(n==="dead"){if(I==="notify")return;throw w()}if(n==="pending"){c.push({name:I,args:k});return}return g(I,k)};case"sync":return(...k)=>{if(n==="dead"){if(I==="getConfig")return s;throw w()}if(typeof T(I)!="function")throw new Error(`[emailmaker] \`${I}\` is not available before the editor is ready: ${Hy[I]??"await `ready` first"}`);const ee=g(I,k);return I==="getConfig"&&(s=ee),ee};case"element":return()=>{if(typeof T(I)!="function")return R();try{return g(I,[])}catch{return R()}};case"codeErrors":return()=>n==="ready"&&typeof T(I)=="function"?g(I,[]):[];case"field":return}};for(const[I,O]of dn)b[I]=D(I,O);b.reset=I=>(I?.content!==void 0&&e.shown?.(I.content),P().then(async()=>{const O=I?.content!==void 0&&Ce(I.content,p());await g("reset",[dl(I,L)]),O&&await g("show",[I.content])}).then(()=>b)),b.destroy=()=>{if(n==="dead")return;const I=pe("[emailmaker] editor was destroyed before it was ready");i?.catch(()=>{}),d.forEach(O=>O(I)),_(),e.destroy()},Object.defineProperty(b,"ready",{get:()=>i,enumerable:!0,configurable:!0});const L=b;return{object:L,get state(){return n},get editor(){return t},bind:I=>{n==="dead"||t===I||(E(),m(),t=I,S(),v(),n==="pending"&&(o=I.container.getOrCreateInstance(Dr,()=>new Set),o.add(A)))},settle:()=>{if(n==="pending"){n="ready",m(),S(),v();for(const I of c.splice(0))try{g(I.name,I.args)}catch(O){queueMicrotask(()=>{throw O})}f()}},kill:(I,O)=>{n!=="dead"&&(_(),n="dead",r=I,c.length=0,d.forEach(k=>k(I)),m(),O?.keepSubscriptions||(E(),a.clear()),h(I))},detach:()=>{E(),a.clear()},setReady:I=>{i=I},trackCall:I=>(d.add(I),()=>d.delete(I)),hasCalls:()=>d.size>0}}var ul="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function Gy(){return pe(ul)}function Vy(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===ul}function qy(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 a=e.parentNode;for(;a;)i.observe(a,{childList:!0}),a=a.parentNode}function zy(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 qy(n,()=>{n.id,o.abort(Gy())},i),Tr(r,o.signal)}var fl="Superseded by newer init() on the same mount element";function jo(){return pe(fl)}function Wy(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===fl}var ct=new Map,Bo=new WeakMap,Jt=new WeakMap;function Ky(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function Yy(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=Ky(e);(n?ct.get(n):void 0)?.forEach(f=>{f.element!==e&&f.controller.abort(jo())});const r=Bo.get(e)??new Set;t&&r.forEach(f=>{f.supersedable&&f.controller.abort(jo())});const i=Jt.get(e)??Promise.resolve();let o;const s=new Promise(f=>{o=f}),a=i.then(()=>s);Jt.set(e,a),a.then(()=>{Jt.get(e)===a&&Jt.delete(e)});const c=new AbortController,d={element:e,controller:c,supersedable:t};if(r.add(d),Bo.set(e,r),n){const f=ct.get(n)??new Set;f.add(d),ct.set(n,f)}return{signal:c.signal,previous:i,release:()=>{o(),r.delete(d);const f=n?ct.get(n):void 0;n&&f?.delete(d)&&f.size===0&&ct.delete(n)}}}var Pt=new WeakMap;function mi(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function wr(e){return Object.entries(e).filter(([t,n])=>mi(t,n)).map(([t])=>t).sort()}function Uo(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!mi(n,r)&&(t[n]=r);return t}function Sr(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:Pt.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},Pt.set(e,r));const{current:i,trampolines:o}=r;i.clear();const s={...t};for(const a of wr(t)){i.set(a,t[a]);let c=o.get(a);c||(c=(...d)=>i.get(a)?.(...d),o.set(a,c)),s[a]=c}return r.lastOptions=t,s}function pl(e,t){const n=e?Pt.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const i=t[r];mi(r,i)?n.current.set(r,i):n.current.delete(r)}}function Xy(e){const t=e?Pt.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((i,o)=>t.current.set(o,i)),t.lastOptions=r}}function Jy(e,t,n){const r=e?Pt.get(e):void 0;if(!r||!n)return!1;const i=wr(t),o=Ce(i,wr(r.lastOptions)),s=i.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!o||!s||!Ce(Uo(t),Uo(r.lastOptions))?!1:(Sr(e,t),!0)}var ve=new WeakMap;function En(e){let t=ve.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},ve.set(e,t)),t}var Ne=e=>e!==void 0&&e.state!=="dead";function Qy(e){const t=ve.get(e)?.shared;return Ne(t)?t:void 0}function Zy(e,t){En(e).shared=t}function eE(e,t){!(Ne(e.shared)&&[...e.counted].some(Ne))||e.warned||!t.devTools||(e.warned=!0)}function tE(e,t,n,r){const i=En(e);return i.latestCall+=1,i.releaseTimer!==void 0&&(clearTimeout(i.releaseTimer),i.releaseTimer=void 0),i.leaving.forEach(o=>o.detach()),i.leaving.clear(),n==="single"?i.shared=t:i.counted.add(t),i.options.set(t,r),i.order=[...i.order.filter(o=>o!==t&&Ne(o)),t],eE(i,r),i.latestCall}function nE(e,t){return ve.get(e)?.latestCall===t}function rE(e){const t=ve.get(e);if(t)return t.order=t.order.filter(Ne),t.order.at(-1)?.object}function Dt(e,t){const n=ve.get(e);return n?Ne(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&Ne(r)):!1}function iE(e,t){const n=ve.get(e),r=n?.order.filter(i=>i!==t&&Ne(i)).at(-1);return r?n?.options.get(r):void 0}function hl(e,t){En(e).content={value:t}}function oE(e){return ve.get(e)?.content}function sE(e,t,n,r){const i=En(e);if(i.counted.delete(t),i.options.delete(t),Dt(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),i.leaving.add(t),ml(e,r)}function ml(e,t){const n=ve.get(e);!n||Dt(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!Dt(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function aE(e,t){const n=ve.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);ve.delete(e)}}var ME=Go({FileManagerApiError:()=>lE,IntegratorSaveTimeoutError:()=>Ur,SaveRefusedError:()=>vt}),lE=class gl 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,gl)}},kE=Go({mapHttpStatusToErrorCode:()=>Rl});function cE(e,t){return{...e,element:t}}function Ir(){return()=>{}}function dE(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?Ir():(gy(t,e.config?.styles,t),()=>{vy(t)})}function uE(e){if(!sl()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:Ir()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:Ir()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.remove()});const n=Ey(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function fE(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function fn(e){try{e.destroy()}catch{}}function nn(e,...t){const n=he.get(e);t.some(r=>r!==void 0&&r===n)&&he.delete(e)}var LE="1.1.102";async function NE(e){Jr(),await $v(typeof window.__useblocks__<"u"?window.__useblocks__:void 0)}async function FE(e){return vE(e).ready}function pE(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function hE(e){const t=he.get(e);return t&&!(t instanceof Promise)?t:void 0}function pn(e,t,n){const r=t??hE(e);r&&(nn(e,r),fn(r)),aE(e,n)}function mE(e){const{control:t,mode:n,ref:r}=e,i=r.host;if(!i){const s=t.editor;gE(s),t.kill(Oe());return}if(n==="single"){pn(i,t.editor,Oe());return}const o=iE(i,t);sE(i,t,Oe(),()=>pn(i,t.editor,Oe())),o&&Dt(i)&&pl(i,o)}function gE(e){e&&fn(e)}function vE(e){Z(le.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=Tr(e.signal,n.signal),i=t==="single"?pE(e.element):void 0,o=i?Qy(i):void 0;let s;if(o)s={control:o,mode:t,ref:{host:i}};else{const f={},h=$y({element:()=>f.host??e.element,destroy:()=>mE(s),shown:y=>{f.host&&hl(f.host,y)}});s={control:h,mode:t,ref:f},i&&Zy(i,h)}const{control:a}=s,c=a.trackCall(f=>n.abort(f)),d=wE(dl({...e,signal:r},a.object),s).then(()=>(c(),Z(le.initEnd),a.settle(),a.object),f=>{c(),a.state==="pending"&&!a.hasCalls()&&a.kill(f);const h=s.ref.host;throw h&&ml(h,()=>pn(h,void 0,Oe())),f});return a.setReady(d),a.object}function jE(e){const t=typeof e=="string"?document.querySelector(e):e;return t?rE(t):void 0}function bE(e){let t,n,r=!1;try{t=e.container.getInstance(se)?.get(),n=e.container.getInstance(Ae)?.externalSignal;const i=Je(e.container)?.current();r=i!==void 0&&i.get().savedVersion!==null&&i.isDirty()}catch{t=void 0}return{options:t,signal:n,email:yE(e),dirty:r}}async function yE(e){try{return await e.getEmailSnapshot()}catch{return}}function EE(e){const t=Je(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function Ho(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||Dt(e,n)}async function _E(e,t,n,r,i){if(r.mode==="counted"&&r.control.detach(),Wy(i)||Vy(i))return;const o=()=>pn(t,e,Uy(i)),{options:s}=n;if(!s||!Ho(t,r)){o();return}const a=await n.email,c=a&&(s.content!==void 0||a.id!==void 0)?a:void 0,d=typeof s.content=="object"&&"email"in s.content?s.content:void 0;try{await e.reset({...s,signal:s.signal??n.signal,content:c?{...d,email:c}:s.content}),n.dirty&&c&&EE(e),Ho(t,r)?he.set(t,e):o()}catch{o()}}async function wE(e,t){Y(e.signal);const n=new ie;let r,i,o,s,a=0;try{const c=await Jl(e.element,n,e.signal);c&&(s=c,t.ref.host=c,a=tE(c,t.control,t.mode,e));const d=zy({hostElementOption:e.element,resolvedElement:c,externalSignal:e.signal,disposable:n}),f=Yy(c,{supersede:t.mode==="single"});r=f.release;const h=Tr(d,f.signal);Y(h),o=Xy(c),pl(c,e),await rn(f.previous,h),i=SE(e,c,t,h,o);const y=await rn(i,h);return c&&e.content!==void 0&&hl(c,e.content),y}catch(c){throw s&&o&&nE(s,a)&&o(),c}finally{const c=r;i!==void 0&&c?i.then(c,c):c?.(),n.dispose()}}async function $o(e,t,n,r){const i=oE(t);n===void 0||r||!i||Ce(n,i.value)||await e.show(n)}async function SE(e,t,n,r,i){const{control:o}=n,s=w=>o.bind(w);Y(r);let a;const c=w=>{My();const g=jy(cE(w,t)),C=Oy(g,()=>a);return{preparedOptions:C,preparedOptionsWithSignal:r!=null?{...C,signal:r}:C}};let d;if(t){const w=he.get(t);if(w){let g;try{g=await w,Y(r)}catch{Y(r),nn(t,w),g=void 0}if(g)if(g.getElement()===t){const C=dy(t);a=C;const _=g.container.getInstance(se)?.get();if(Jy(t,e,_))return s(g),r&&g.container.getInstance(Ae)?.relinkExternalSignal(r),he.set(t,g),await $o(g,t,e.content,!1),g;const P=!Ce(e.content,_?.content);d=c(Sr(t,e));const{preparedOptions:S,preparedOptionsWithSignal:M}=d,v=C&&Ty(C),E=bE(g);try{C&&Kn(C,S),s(g);const A=await g.reset(fE(e,M));return Y(r),he.set(t,g),await $o(g,t,e.content,P),A}catch(A){if(C&&v&&Kn(C,v),!Oc(A))throw i(),await _E(g,t,E,n,A),A;nn(t,w,g),fn(g),Y(r)}}else nn(t,w,g),fn(g)}}Y(r),d??=c(Sr(t,e,{fresh:!0}));const{preparedOptions:f}=d,h=dE(f),y=uE(f),b=r!=null?{...y.options,signal:r}:y.options;let T;try{a=py(b),uy(t,a),Kn(a,f),li(a).set(b),await ci(),Z(le.coreReady),Y(r),Y(r),T=cy(b,a,{onInstance:s}),t&&he.set(t,T);const w=await T;if(r?.aborted&&(w.destroy(),Y(r)),t)if(he.get(t)===T)he.set(t,w);else throw w.destroy(),Y(r),pe(r?.reason);return w}catch(w){throw h(),y.cleanup(),a&&(ol(a),fy(t,a)),t&&T&&he.get(t)===T&&he.delete(t),w}}async function BE(e){return(await Bt()).parseAMP(e)}typeof window<"u"&&(wt()&&Pc(),Vv(typeof window.__useblocks__<"u"?window.__useblocks__:void 0));export{ul as ELEMENT_DETACHED_ABORT_MESSAGE,fl as SUPERSEDED_INIT_ABORT_MESSAGE,vE as create,ME as errors,jE as getInstance,kE as helpers,FE as init,Vy as isElementDetachedError,Wy as isSupersededInitError,BE as parseAMP,zv as pluginRegistry,NE as preload,LE as version};
|
|
1077
|
+
}`;function yy(){return()=>{}}function Ey(e,t){if(!sl()||!e||typeof document>"u")return yy();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=by,document.head?.appendChild(i),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),i.remove())}}function _y(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function wy({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 a=o().catch(c=>{throw n.has(i)||(n.add(i),r(c)),_y(c)||t.delete(i),c});return t.set(i,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var fi=wy();function al(){fi.clear()}Ll(()=>fi.clear());var ko=new WeakMap;function pi(e){return ic(e)}function Sy(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function Iy(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function Cy(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 hi=new WeakMap;function Kn(e,t){hi.set(e,t)}function Ty(e){return hi.get(e)}function Ay(e,t){return async({baseUrl:n})=>{const r=t(),i=r&&hi.get(r)||e,o=pi(n);if(!o)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const s=new Headers({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),a=await Cy(i);if(i.getAuthToken&&!a)throw Iy();a&&s.set("authorization",a);const c=await Bl("/app/v1/app_init",{method:"POST",headers:s,body:new URLSearchParams,credentials:"same-origin"},o,{attemptTimeout:ti(i)||void 0});if(!c.ok)throw Sy(c.status,c.statusText);return await c.json()}}function Ry(e){return JSON.stringify({baseUrl:pi(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function Py(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function Dy(e){return t=>fi.run(Ry(t),()=>(Z("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>Z("appInit:end",{kind:"network"}))))}function Oy(e,t){if(Lt(e)||!e.appInit&&!pi(e.baseUrl)||!Py(e))return e;const n=e.appInit??Ay(e,t);let r=ko.get(n);return r||(r=Dy(n),ko.set(n,r)),{...e,appInit:r}}var ll=0;function xy(){return ll}function My(){ll+=1,al()}var Lo=new WeakMap,No=new WeakMap,ky=3e4;function Ly(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function Ny(e,t){try{const n=Mr(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+ky}function Fy(e){const t=new Map,n=new Map;return async(r,i,o)=>{const s=Ly(r,i);if(o)return n.delete(s),t.delete(s),al(),e(r,i,o);const a=n.get(s);if(a&&!t.has(s)){if(a.expiresAtMs>Date.now())return a.token;n.delete(s)}let c=t.get(s);return c===void 0&&(Z("authToken:start",{kind:"network"}),c=Promise.resolve(e(r,i,o)).then(d=>{const f=String(d||"").trim();return f&&n.set(s,{token:d,expiresAtMs:Ny(f,Date.now())}),d}).finally(()=>{Z("authToken:end",{kind:"network"}),t.delete(s)}),t.set(s,c)),c}}function jy(e){if(Lt(e))return e;const t=e.getAuthToken;if(!t)return e;let n=Lo.get(t);const r=xy();return(!n||No.get(t)!==r)&&(n=Fy(t),Lo.set(t,n),No.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(i=>{}),{...e,getAuthToken:n}}var By="[emailmaker] This editor was destroyed: a later init()/create() into the same element failed to start, and the editor could not be handed back. Call init() again; the reason is in `cause`.";function Uy(e){const t=new Error(By,{cause:e});return t.name="EditorStartFailedError",t}var Hy={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function Fo(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var cl=["handleLoad","handleDestroy"];function dl(e,t){let n=e;for(const r of cl){const i=e?.[r];typeof i=="function"&&(n={...n,[r]:(o,...s)=>i(t,...s)})}return n}function $y(e){let t,n="pending",r,i,o,s;const a=new Set,c=[],d=new Set;let f,h;const y=new Promise((I,O)=>{f=I,h=O});y.catch(()=>{});const b={},T=I=>t?.[I],w=()=>r??Oe(),g=(I,O)=>{const k=T(I);if(typeof k!="function")throw Fo(I);return k.apply(t,O)},C=(I,O)=>{try{return Promise.resolve(g(I,O))}catch(k){return Promise.reject(k)}},_=()=>{const I=t?.container?.getInstance?.(U);if(!(n!=="ready"||I?.isDisposed()||typeof T("getConfig")!="function"))try{s=g("getConfig",[])}catch{}},P=()=>n==="dead"?Promise.reject(w()):n==="ready"?Promise.resolve():y,S=()=>{for(const[I,O]of dn)O==="field"&&(b[I]=T(I))},M=I=>{const O=T(I.name);I.dispose||typeof O!="function"||n==="dead"||(I.dispose=O.apply(t,I.args))},v=()=>a.forEach(M),E=()=>{for(const I of a){try{I.dispose?.()}catch{}I.dispose=void 0}},A=()=>{S(),v()},m=()=>{o?.delete(A),o=void 0},l=(I,O)=>{const[k,...ee]=O;return!cl.includes(I)||typeof k!="function"?O:[(ce,...X)=>k(b,...X),...ee]},u=(I,O)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof T(I)!="function")throw Fo(I);const k={name:I,args:l(I,O)};return a.add(k),M(k),()=>{a.delete(k),k.dispose?.(),k.dispose=void 0}},p=()=>t?.container?.getInstance(se)?.get()?.content,R=()=>{const I=e.element();return I!==void 0&&typeof I!="string"?I:void 0},D=(I,O)=>{switch(O){case"event":return(...k)=>u(I,k);case"async":return(...k)=>(I==="show"&&k[0]!==void 0&&e.shown?.(k[0]),n!=="dead"&&typeof T(I)=="function"?C(I,k):P().then(()=>g(I,k)));case"queued":return(...k)=>{if(n==="dead"){if(I==="notify")return;throw w()}if(n==="pending"){c.push({name:I,args:k});return}return g(I,k)};case"sync":return(...k)=>{if(n==="dead"){if(I==="getConfig")return s;throw w()}if(typeof T(I)!="function")throw new Error(`[emailmaker] \`${I}\` is not available before the editor is ready: ${Hy[I]??"await `ready` first"}`);const ee=g(I,k);return I==="getConfig"&&(s=ee),ee};case"element":return()=>{if(typeof T(I)!="function")return R();try{return g(I,[])}catch{return R()}};case"codeErrors":return()=>n==="ready"&&typeof T(I)=="function"?g(I,[]):[];case"field":return}};for(const[I,O]of dn)b[I]=D(I,O);b.reset=I=>(I?.content!==void 0&&e.shown?.(I.content),P().then(async()=>{const O=I?.content!==void 0&&Ce(I.content,p());await g("reset",[dl(I,L)]),O&&await g("show",[I.content])}).then(()=>b)),b.destroy=()=>{if(n==="dead")return;const I=pe("[emailmaker] editor was destroyed before it was ready");i?.catch(()=>{}),d.forEach(O=>O(I)),_(),e.destroy()},Object.defineProperty(b,"ready",{get:()=>i,enumerable:!0,configurable:!0});const L=b;return{object:L,get state(){return n},get editor(){return t},bind:I=>{n==="dead"||t===I||(E(),m(),t=I,S(),v(),n==="pending"&&(o=I.container.getOrCreateInstance(Dr,()=>new Set),o.add(A)))},settle:()=>{if(n==="pending"){n="ready",m(),S(),v();for(const I of c.splice(0))try{g(I.name,I.args)}catch(O){queueMicrotask(()=>{throw O})}f()}},kill:(I,O)=>{n!=="dead"&&(_(),n="dead",r=I,c.length=0,d.forEach(k=>k(I)),m(),O?.keepSubscriptions||(E(),a.clear()),h(I))},detach:()=>{E(),a.clear()},setReady:I=>{i=I},trackCall:I=>(d.add(I),()=>d.delete(I)),hasCalls:()=>d.size>0}}var ul="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function Gy(){return pe(ul)}function Vy(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===ul}function qy(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 a=e.parentNode;for(;a;)i.observe(a,{childList:!0}),a=a.parentNode}function zy(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 qy(n,()=>{n.id,o.abort(Gy())},i),Tr(r,o.signal)}var fl="Superseded by newer init() on the same mount element";function jo(){return pe(fl)}function Wy(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===fl}var ct=new Map,Bo=new WeakMap,Jt=new WeakMap;function Ky(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function Yy(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=Ky(e);(n?ct.get(n):void 0)?.forEach(f=>{f.element!==e&&f.controller.abort(jo())});const r=Bo.get(e)??new Set;t&&r.forEach(f=>{f.supersedable&&f.controller.abort(jo())});const i=Jt.get(e)??Promise.resolve();let o;const s=new Promise(f=>{o=f}),a=i.then(()=>s);Jt.set(e,a),a.then(()=>{Jt.get(e)===a&&Jt.delete(e)});const c=new AbortController,d={element:e,controller:c,supersedable:t};if(r.add(d),Bo.set(e,r),n){const f=ct.get(n)??new Set;f.add(d),ct.set(n,f)}return{signal:c.signal,previous:i,release:()=>{o(),r.delete(d);const f=n?ct.get(n):void 0;n&&f?.delete(d)&&f.size===0&&ct.delete(n)}}}var Pt=new WeakMap;function mi(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function wr(e){return Object.entries(e).filter(([t,n])=>mi(t,n)).map(([t])=>t).sort()}function Uo(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!mi(n,r)&&(t[n]=r);return t}function Sr(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:Pt.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},Pt.set(e,r));const{current:i,trampolines:o}=r;i.clear();const s={...t};for(const a of wr(t)){i.set(a,t[a]);let c=o.get(a);c||(c=(...d)=>i.get(a)?.(...d),o.set(a,c)),s[a]=c}return r.lastOptions=t,s}function pl(e,t){const n=e?Pt.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const i=t[r];mi(r,i)?n.current.set(r,i):n.current.delete(r)}}function Xy(e){const t=e?Pt.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((i,o)=>t.current.set(o,i)),t.lastOptions=r}}function Jy(e,t,n){const r=e?Pt.get(e):void 0;if(!r||!n)return!1;const i=wr(t),o=Ce(i,wr(r.lastOptions)),s=i.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!o||!s||!Ce(Uo(t),Uo(r.lastOptions))?!1:(Sr(e,t),!0)}var ve=new WeakMap;function En(e){let t=ve.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},ve.set(e,t)),t}var Ne=e=>e!==void 0&&e.state!=="dead";function Qy(e){const t=ve.get(e)?.shared;return Ne(t)?t:void 0}function Zy(e,t){En(e).shared=t}function eE(e,t){!(Ne(e.shared)&&[...e.counted].some(Ne))||e.warned||!t.devTools||(e.warned=!0)}function tE(e,t,n,r){const i=En(e);return i.latestCall+=1,i.releaseTimer!==void 0&&(clearTimeout(i.releaseTimer),i.releaseTimer=void 0),i.leaving.forEach(o=>o.detach()),i.leaving.clear(),n==="single"?i.shared=t:i.counted.add(t),i.options.set(t,r),i.order=[...i.order.filter(o=>o!==t&&Ne(o)),t],eE(i,r),i.latestCall}function nE(e,t){return ve.get(e)?.latestCall===t}function rE(e){const t=ve.get(e);if(t)return t.order=t.order.filter(Ne),t.order.at(-1)?.object}function Dt(e,t){const n=ve.get(e);return n?Ne(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&Ne(r)):!1}function iE(e,t){const n=ve.get(e),r=n?.order.filter(i=>i!==t&&Ne(i)).at(-1);return r?n?.options.get(r):void 0}function hl(e,t){En(e).content={value:t}}function oE(e){return ve.get(e)?.content}function sE(e,t,n,r){const i=En(e);if(i.counted.delete(t),i.options.delete(t),Dt(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),i.leaving.add(t),ml(e,r)}function ml(e,t){const n=ve.get(e);!n||Dt(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!Dt(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function aE(e,t){const n=ve.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);ve.delete(e)}}var ME=Go({FileManagerApiError:()=>lE,IntegratorSaveTimeoutError:()=>Ur,SaveRefusedError:()=>vt}),lE=class gl 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,gl)}},kE=Go({mapHttpStatusToErrorCode:()=>Rl});function cE(e,t){return{...e,element:t}}function Ir(){return()=>{}}function dE(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?Ir():(gy(t,e.config?.styles,t),()=>{vy(t)})}function uE(e){if(!sl()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:Ir()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:Ir()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.remove()});const n=Ey(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function fE(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function fn(e){try{e.destroy()}catch{}}function nn(e,...t){const n=he.get(e);t.some(r=>r!==void 0&&r===n)&&he.delete(e)}var LE="1.1.103";async function NE(e){Jr(),await $v(typeof window.__useblocks__<"u"?window.__useblocks__:void 0)}async function FE(e){return vE(e).ready}function pE(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function hE(e){const t=he.get(e);return t&&!(t instanceof Promise)?t:void 0}function pn(e,t,n){const r=t??hE(e);r&&(nn(e,r),fn(r)),aE(e,n)}function mE(e){const{control:t,mode:n,ref:r}=e,i=r.host;if(!i){const s=t.editor;gE(s),t.kill(Oe());return}if(n==="single"){pn(i,t.editor,Oe());return}const o=iE(i,t);sE(i,t,Oe(),()=>pn(i,t.editor,Oe())),o&&Dt(i)&&pl(i,o)}function gE(e){e&&fn(e)}function vE(e){Z(le.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=Tr(e.signal,n.signal),i=t==="single"?pE(e.element):void 0,o=i?Qy(i):void 0;let s;if(o)s={control:o,mode:t,ref:{host:i}};else{const f={},h=$y({element:()=>f.host??e.element,destroy:()=>mE(s),shown:y=>{f.host&&hl(f.host,y)}});s={control:h,mode:t,ref:f},i&&Zy(i,h)}const{control:a}=s,c=a.trackCall(f=>n.abort(f)),d=wE(dl({...e,signal:r},a.object),s).then(()=>(c(),Z(le.initEnd),a.settle(),a.object),f=>{c(),a.state==="pending"&&!a.hasCalls()&&a.kill(f);const h=s.ref.host;throw h&&ml(h,()=>pn(h,void 0,Oe())),f});return a.setReady(d),a.object}function jE(e){const t=typeof e=="string"?document.querySelector(e):e;return t?rE(t):void 0}function bE(e){let t,n,r=!1;try{t=e.container.getInstance(se)?.get(),n=e.container.getInstance(Ae)?.externalSignal;const i=Je(e.container)?.current();r=i!==void 0&&i.get().savedVersion!==null&&i.isDirty()}catch{t=void 0}return{options:t,signal:n,email:yE(e),dirty:r}}async function yE(e){try{return await e.getEmailSnapshot()}catch{return}}function EE(e){const t=Je(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function Ho(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||Dt(e,n)}async function _E(e,t,n,r,i){if(r.mode==="counted"&&r.control.detach(),Wy(i)||Vy(i))return;const o=()=>pn(t,e,Uy(i)),{options:s}=n;if(!s||!Ho(t,r)){o();return}const a=await n.email,c=a&&(s.content!==void 0||a.id!==void 0)?a:void 0,d=typeof s.content=="object"&&"email"in s.content?s.content:void 0;try{await e.reset({...s,signal:s.signal??n.signal,content:c?{...d,email:c}:s.content}),n.dirty&&c&&EE(e),Ho(t,r)?he.set(t,e):o()}catch{o()}}async function wE(e,t){Y(e.signal);const n=new ie;let r,i,o,s,a=0;try{const c=await Jl(e.element,n,e.signal);c&&(s=c,t.ref.host=c,a=tE(c,t.control,t.mode,e));const d=zy({hostElementOption:e.element,resolvedElement:c,externalSignal:e.signal,disposable:n}),f=Yy(c,{supersede:t.mode==="single"});r=f.release;const h=Tr(d,f.signal);Y(h),o=Xy(c),pl(c,e),await rn(f.previous,h),i=SE(e,c,t,h,o);const y=await rn(i,h);return c&&e.content!==void 0&&hl(c,e.content),y}catch(c){throw s&&o&&nE(s,a)&&o(),c}finally{const c=r;i!==void 0&&c?i.then(c,c):c?.(),n.dispose()}}async function $o(e,t,n,r){const i=oE(t);n===void 0||r||!i||Ce(n,i.value)||await e.show(n)}async function SE(e,t,n,r,i){const{control:o}=n,s=w=>o.bind(w);Y(r);let a;const c=w=>{My();const g=jy(cE(w,t)),C=Oy(g,()=>a);return{preparedOptions:C,preparedOptionsWithSignal:r!=null?{...C,signal:r}:C}};let d;if(t){const w=he.get(t);if(w){let g;try{g=await w,Y(r)}catch{Y(r),nn(t,w),g=void 0}if(g)if(g.getElement()===t){const C=dy(t);a=C;const _=g.container.getInstance(se)?.get();if(Jy(t,e,_))return s(g),r&&g.container.getInstance(Ae)?.relinkExternalSignal(r),he.set(t,g),await $o(g,t,e.content,!1),g;const P=!Ce(e.content,_?.content);d=c(Sr(t,e));const{preparedOptions:S,preparedOptionsWithSignal:M}=d,v=C&&Ty(C),E=bE(g);try{C&&Kn(C,S),s(g);const A=await g.reset(fE(e,M));return Y(r),he.set(t,g),await $o(g,t,e.content,P),A}catch(A){if(C&&v&&Kn(C,v),!Oc(A))throw i(),await _E(g,t,E,n,A),A;nn(t,w,g),fn(g),Y(r)}}else nn(t,w,g),fn(g)}}Y(r),d??=c(Sr(t,e,{fresh:!0}));const{preparedOptions:f}=d,h=dE(f),y=uE(f),b=r!=null?{...y.options,signal:r}:y.options;let T;try{a=py(b),uy(t,a),Kn(a,f),li(a).set(b),await ci(),Z(le.coreReady),Y(r),Y(r),T=cy(b,a,{onInstance:s}),t&&he.set(t,T);const w=await T;if(r?.aborted&&(w.destroy(),Y(r)),t)if(he.get(t)===T)he.set(t,w);else throw w.destroy(),Y(r),pe(r?.reason);return w}catch(w){throw h(),y.cleanup(),a&&(ol(a),fy(t,a)),t&&T&&he.get(t)===T&&he.delete(t),w}}async function BE(e){return(await Bt()).parseAMP(e)}typeof window<"u"&&(wt()&&Pc(),Vv(typeof window.__useblocks__<"u"?window.__useblocks__:void 0));export{ul as ELEMENT_DETACHED_ABORT_MESSAGE,fl as SUPERSEDED_INIT_ABORT_MESSAGE,vE as create,ME as errors,jE as getInstance,kE as helpers,FE as init,Vy as isElementDetachedError,Wy as isSupersededInitError,BE as parseAMP,zv as pluginRegistry,NE as preload,LE as version};
|
|
1078
1078
|
|
|
1079
1079
|
|
|
1080
|
-
window.__useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/
|
|
1080
|
+
window.__useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/160bf060.js":[],"static/core/1ed86ed3.js":[],"static/core/20098caa.js":["static/core/63f26591.js","static/core/defdbce4.js","static/core/5c36eb62.js"],"static/core/29993987.js":[],"static/core/2a85f6f1.js":["static/core/63f26591.js"],"static/core/348ec5fd.js":["static/core/41dd8b28.js","__delivery__/libs"],"static/core/3501b0a6.js":[],"static/core/36448ec6.js":[],"static/core/3fd50a29.js":[],"static/core/41dd8b28.js":["__delivery__/libs"],"static/core/47bde21f.js":[],"static/core/48da14fd.js":[],"static/core/4c8d0155.js":[],"static/core/50c87f51.js":[],"static/core/5c36eb62.js":["static/core/defdbce4.js"],"static/core/5d7aff4e.js":["static/core/defdbce4.js"],"static/core/63f26591.js":[],"static/core/6561b34a.js":[],"static/core/68650ff2.js":[],"static/core/69cf8e2c.js":[],"static/core/6b904901.js":["static/core/c9a4d1ef.js","static/core/41dd8b28.js","__delivery__/libs","static/core/d74756b9.js"],"static/core/756874c6.js":[],"static/core/7b850506.js":[],"static/core/8288f720.js":[],"static/core/a013bc08.js":["static/core/d74756b9.js","static/core/c9a4d1ef.js","static/core/fd8197a8.js","static/core/348ec5fd.js","__delivery__/libs"],"static/core/a6303cb2.js":["static/core/ff7d14e8.js"],"static/core/aa3448fe.js":[],"static/core/b7d1fefc.js":[],"static/core/c9a4d1ef.js":["static/core/d74756b9.js","__delivery__/libs"],"static/core/d74756b9.js":["static/core/e7620593.js","static/core/ff7d14e8.js","__delivery__/libs"],"static/core/dcc37768.js":[],"static/core/defdbce4.js":[],"static/core/e47dcbb0.js":[],"static/core/e50befab.js":[],"static/core/e7620593.js":[],"static/core/ed8a3337.js":["static/core/e47dcbb0.js","__delivery__/libs","monaco"],"static/core/f8819751.js":["static/core/d74756b9.js","static/core/ff7d14e8.js","__delivery__/libs"],"static/core/fb2fe2db.js":[],"static/core/fd8197a8.js":["static/core/d74756b9.js","__delivery__/libs"],"static/core/ff7d14e8.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/971f1b2c.js"],"static/esm/delivery-libs.js":[],"useblocks-esm.js":["static/esm/971f1b2c.js","static/esm/668ee399.js","static/esm/f76c9d9d.js"],"static/esm/2490dab8.js":["static/esm/971f1b2c.js"],"static/esm/668ee399.js":[],"static/esm/971f1b2c.js":[],"static/esm/f76c9d9d.js":[]},"bundles":{"static/core/41dd8b28.js":["static/core/46571be7.js","static/core/de822f7e.js","static/core/edfcbabd.js"],"static/core/2a85f6f1.js":["static/core/a71c4cd8.js"],"static/core/f8819751.js":["static/core/8daf15a4.js"],"static/core/348ec5fd.js":["static/core/a73da823.js"],"static/core/6b904901.js":["static/core/82a243fb.js"],"core":["static/core/2ff39ddf.js","static/core/c1dc75d5.js","static/core/c81e0921.js","static/core/381d4d5b.js","static/core/bce6ca28.js"]}});
|