useblocks 1.1.85-dev.2 → 1.1.85-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/js/{discussHandlers.BtCUuj58.js → discussHandlers.Cyqpdj2X.js} +2 -2
- package/iframe/js/iframe-eblock.body.js +1 -1
- package/iframe/js/iframe-eblock.js +1 -1
- package/iframe/js/iframe.body.js +2 -2
- package/iframe/js/iframe.js +1 -1
- package/node_modules/useblocks-ui-kit/package.json +1 -1
- package/package.json +2 -2
- package/runtime/react/index.js +1 -1
- package/static/core/{ef3477dd.js → 14a79b09.js} +1 -1
- package/static/core/{6c7df338.js → 199dc589.js} +1 -1
- package/static/core/{ca873214.js → 230f23ec.js} +1 -1
- package/static/core/{181088a9.js → 30f16e98.js} +1 -1
- package/static/core/{6fdfa46d.js → 34730be9.js} +1 -1
- package/static/core/{9b7f52a5.js → 364dcebf.js} +1 -1
- package/static/core/{43affb86.js → 4916b3a1.js} +1 -1
- package/static/core/{c789db17.js → 4f790fdc.js} +1 -1
- package/static/core/{d74b0853.js → 520ec797.js} +3 -3
- package/static/core/{2639f789.js → 57c114f0.js} +1 -1
- package/static/core/{cab426fa.js → 5bf994b4.js} +1 -1
- package/static/core/{13563d2c.js → 6541580a.js} +1 -1
- package/static/core/{a72f1f53.js → 79431a89.js} +1 -1
- package/static/core/{b502ca96.js → 8fb0fe48.js} +1 -1
- package/static/core/{fad0a613.js → 9a70cc1e.js} +1 -1
- package/static/core/{6589e3b8.js → a15ab67d.js} +1 -1
- package/static/core/{576452f9.js → adf6e008.js} +1 -1
- package/static/core/{f0f90842.js → b743a76d.js} +1 -1
- package/static/core/{c6d342f2.js → b97bd382.js} +6 -6
- package/static/core/{92e10a15.js → ddb5a35d.js} +1 -1
- package/static/core/{70b2c337.js → dfddbd68.js} +1 -1
- package/static/core/{6eeae572.js → f3eda1c7.js} +1 -1
- package/static/core/{5f0c0e3a.js → ffb36e93.js} +1 -1
- package/static/umd-runtime/runtime.js +1 -1
- package/{useblocks-core.4865197d.js → useblocks-core.fc97f6e8.js} +8 -8
- package/useblocks-esm.js +10 -10
- package/{useblocks-po.4865197d.js → useblocks-po.fc97f6e8.js} +1 -1
- package/useblocks.js +11 -11
- package/vite/index.cjs +100 -5
- package/vite/index.js +100 -5
- package/webpack/index.cjs +93 -0
- package/webpack/index.js +93 -0
- /package/iframe/{iframe-eblock.4865197d.html → iframe-eblock.fc97f6e8.html} +0 -0
- /package/iframe/{iframe.4865197d.html → iframe.fc97f6e8.html} +0 -0
|
@@ -3,11 +3,11 @@ __useblocks__.define("static/core/2ff39ddf.js",["require","exports","module"],fu
|
|
|
3
3
|
__useblocks__.define("static/core/fe480726.js",["require","exports","module"],function(uo,u,lo){function Ie(e){return function(t){return{setOptions:()=>{},instance:{},dispose:()=>{},...e(t)||{}}}}function $t(e){return t=>{const r={},n=[];for(const i of e)n.push(i(t));for(const i of n)Object.assign(r,i.instance);return{instance:r,setOptions:async i=>{for(const c of n)await c.setOptions(i)},dispose:()=>{for(const i of n)i.dispose()}}}}var v=class kt{_inner;_isDisposed=!1;constructor(t=[]){this._inner=t}addDisposable(t){return this._inner.push(t),t instanceof kt&&t.addDispose(()=>{this.removeDisposable(t)}),t}addDispose(t){this.addDisposable({dispose:t})}removeDisposable(t){const r=this._inner.indexOf(t);r>=0&&this._inner.splice(r,1)}isDisposed(){return this._isDisposed}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const t of[...this._inner])t.dispose()}}};function B(e){return`service_container_${e}`}var R=new Set,Q;function Mt(){if(!Q)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,ee.prototype.getInstanceAsync),e.stack}function Z(e){R.delete(e)&&Q?.end(e)}var ee=class Te extends v{_parent;_injectCallbacks=[];_injections=Object.create(null);_runCallbacks(t){this._injectCallbacks.forEach(r=>r(t))}constructor(t=null){super(),this._parent=t,t&&this.addDisposable(t.onInject(r=>this._runCallbacks(r)))}onInject=t=>(this._injectCallbacks.push(t),{dispose:()=>{const r=this._injectCallbacks.indexOf(t);r>=0&&this._injectCallbacks.splice(r,1)}});inject(t,r){this._injections[t]=()=>r,this._runCallbacks(t)}injectFactory(t,r,n){const s=this._injections[t];let o=typeof s=="function"?s():s;const i=this._injections[t]=()=>(o=r(this,o),o);n&&i(),this._runCallbacks(t)}_find(t,r=!0){return this._injections[t]||r&&this._parent?._find(t)}_onInject(t,r,n=new v){return n.addDisposable(this.onInject(s=>{t===s&&(n.dispose(),r(this.getInstance(s)))})),this._parent&&n.addDisposable(this._parent._onInject(t,r,n)),this.addDisposable(n),n}getInstance(t,r=!0){const n=this._find(t,r);if(typeof n=="function")return n()}getOrCreateInstance(t,r){const n=this._find(t);if(typeof n=="function")return n();const s=r(this);return this.inject(t,s),s}getInstanceAsync(t){const r=this._find(t);if(typeof r=="function")return Promise.resolve(r());const n=Mt();return new Promise((s,o)=>{const i={id:String(t),startedAt:Date.now(),origin:n,container:this,reject:o};R.add(i),Q?.start(i),this._onInject(t,()=>{Z(i),s(this.getInstance(t))})})}failPendingWaits(t){for(const r of Array.from(R))r.container===this&&(Z(r),r.reject(t))}pendingWaits(){return[...R].filter(t=>t.container===this)}addService(t,r){const n=B(t);this.injectFactory(n,(o,i=[])=>i.indexOf(r)<0?[...i,r]:i);const s=new v;return s.addDispose(()=>{this.injectFactory(n,(o,i=[])=>i.filter(c=>c!==r))}),s}addServiceFactory(t,r,n){const s=B(t);let o;this.injectFactory(s,(c,a=[])=>(o=r(c,o),o===void 0?a:a.indexOf(o)<0?[...a,o]:a),n);const i=new v;return i.addDispose(()=>{this.injectFactory(s,(c,a=[])=>o===void 0?a:a.filter(l=>l!==o))}),i}getServices(t){const r=B(t);return[...this.getInstance(r,!1)||[],...this._parent?.getServices(t)||[]]}createChild(){return new Te(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{const r=this._parent?.getOrCreateIsolatedContainer(t);return new Te(r)})}remove(t){const r=this._injections;delete r[String(t)]}injectListenerCount(){return this._injectCallbacks.length}dispose(){for(const t of Array.from(R))t.container===this&&Z(t);this._injections=Object.create(null),this._injectCallbacks=[],super.dispose()}};function te(e){return e.startsWith("__")?e:`__${e}__`}function Ft(e){if(typeof globalThis>"u")throw new Error("[di] globalThis is required for namespace container access.");const t=te(e),r=globalThis;return r[t]??={}}function Bt(e){return e!=null&&typeof e=="object"&&typeof e.inject=="function"&&typeof e.getInstance=="function"}function Gt(e){if(e)return te(e);const t="useblocks".trim();if(!t)throw new Error("[di] REACT_APP_NAME is required for resolveContainer().");return te(t)}function Ae(e){const t=Gt(e),r=Ft(t);if(Bt(r.container))return r.container;const n=new ee(null);return r.container=n,n}function Ht(e){return Ae(e)}function Wt(){let e=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){let n=Math.random()*16;return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),(r==="x"?n:n&3|8).toString(16)})}function Pe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Wt()}function _(e=Pe()){return e}function Se(){return"core".trim()||"unknown"}function Vt(e){if(typeof globalThis>"u")return;const t=Se(),r=globalThis[e]??{};globalThis[e]=r;const n=r.__diagnostics??={},s=n.diModuleEval??={evalCount:0,records:[]};s.records.push({buildSource:t,timestamp:Date.now(),stack:new Error().stack}),s.evalCount+=1}function Kt(){const e="useblocks".trim();if(!e)throw new Error("[di] REACT_APP_NAME is required for DependencyResolver diagnostics.");return`__${e}__`}function Yt(e,t){if(Vt(t),typeof globalThis>"u")return e;const r=Se(),n=globalThis,s=n[t]=n[t]||{},o=s.__diagnostics=s.__diagnostics||{},i=o.dependencyResolver=o.dependencyResolver||{entries:[]},c={container:e,source:"packages/runtime-core/di/index.ts",buildSource:r,timestamp:Date.now(),stack:new Error().stack};return i.entries.push(c),e}var G;function Xt(){if(G)return G;const e=Kt();return G=Yt(Ae(e),e),G}var re=new Proxy({},{get(e,t,r){const n=Xt(),s=Reflect.get(n,t,r);return typeof s=="function"?s.bind(n):s}}),De=class extends v{_options;_listeners=[];constructor(e={}){super(),this._options=e}getListeners(e){return this._listeners.flatMap(([t])=>typeof t=="function"?t:t.getListeners(e))}hasListeners(){for(const[e]of this._listeners){if(typeof e=="function")return!0;const t=e;if(typeof t.hasListeners=="function"){if(t.hasListeners())return!0;continue}return!0}return!1}_addListener(e,t=0,r){if(this.isDisposed())return{dispose:()=>{}};const n=this._listeners,s=this._options;r&&typeof e=="function"&&(e=e.bind(r));const o=n.findIndex(([,c])=>c<t),i=[e,t];return n.splice(o>=0?o:n.length,0,i),n.length===1&&s.onFirstListenerAdd&&s.onFirstListenerAdd(),{dispose:()=>{const c=n.indexOf(i);c>=0&&(n.splice(c,1),!n.length&&s.onLastListenerRemove&&s.onLastListenerRemove())}}}on=this._addListener.bind(this);event=this._addListener.bind(this);once=(e,t=0,r)=>{const n=this._addListener((...s)=>(n?.dispose(),r?e.call(r,...s):e(...s)),t);return n};un=e=>{const t=this._listeners.findIndex(([r])=>r===e);t>=0&&(this._listeners.splice(t,1),this._listeners.length===0&&this._options.onLastListenerRemove&&this._options.onLastListenerRemove())};dispose(){this._listeners.splice(0,this._listeners.length),this._options.onLastListenerRemove&&this._options.onLastListenerRemove(),super.dispose()}},N=class extends De{execute(e,t){for(const r of t)try{r(...e)}catch{}}fire(...e){if(!this.isDisposed()){const t=this.execute(e,this.getListeners(e));return t===void 0?void 0:t}}},Jt=class extends N{execute([e],t){for(const r of t)try{r(e)}catch{}}},zt=class extends N{_suspendCounter=0;_wasFired=!1;execute([e],t){if(this._suspendCounter)this._wasFired=!0;else for(const r of t)try{r(e)}catch{}}suspend(){this._suspendCounter++}resume(){--this._suspendCounter===0&&this._wasFired&&(this.fire(),this._wasFired=!1)}},ne=class extends N{async execute([e],t){const r=[];for(const n of t)try{r.push(await n(e))}catch{}return r}async fireSettled(e){const t={results:[],errors:[]};if(this.isDisposed())return t;for(const r of this.getListeners([e]))try{t.results.push(await r(e))}catch(n){t.errors.push(n)}return t}};function Qt(e,t=0){const r=new De,n=e(r,t);return n&&r.addDisposable(n),r.event}function Zt(e,t,r=0){const n=new N,s=e((...o)=>{if(t(...o))return n.fire(...o)},r);return s&&n.addDisposable(s),n.event}function p(e){return _(e)}var se;(function(e){e.BEFORE_SAVE_EMAIL=p("events.BEFORE_SAVE_EMAIL"),e.ON_SAVEBUTTON_CLICK_ID=p("events.ON_SAVEBUTTON_CLICK_ID"),e.ON_NEXTBUTTON_CLICK_ID=p("events.ON_NEXTBUTTON_CLICK_ID"),e.ON_PREVIOUSBUTTON_CLICK_ID=p("events.ON_PREVIOUSBUTTON_CLICK_ID"),e.ON_DOCUMENT_SESSION_CHANGE=p("events.ON_DOCUMENT_SESSION_CHANGE"),e.WILL_EMAIL_INIT_ID=p("events.WILL_EMAIL_INIT_ID"),e.ON_EMAIL_INIT_ID=p("events.ON_EMAIL_INIT_ID"),e.ON_BLOCK_INIT_ID=p("events.ON_BLOCK_INIT_ID"),e.ON_CONTENT_CHANGED_ID=p("events.ON_CONTENT_CHANGED_ID"),e.ON_PREHEADER_CHANGED_ID=p("events.ON_PREHEADER_CHANGED_ID"),e.ON_SUBJECT_CHANGED_ID=p("events.ON_SUBJECT_CHANGED_ID"),e.ON_EMAIL_CHANGED_ID=p("events.ON_EMAIL_CHANGED_ID"),e.ON_HEADER_APPLIED_ID=p("events.ON_HEADER_APPLIED_ID"),e.ON_BLOCK_CHANGED_ID=p("events.ON_BLOCK_CHANGED_ID"),e.ON_CHUNKS_LOADED=p("events.ON_CHUNKS_LOADED"),e.ON_SEND_TESTEMAIL_ID=p("events.ON_SEND_TESTEMAIL_ID"),e.ON_SEND_LIVEPREVIEW_ID=p("events.ON_SEND_LIVEPREVIEW_ID"),e.ON_SHARE_ID=p("events.ON_SHARE_ID"),e.ON_SHOW_PREVIEW_ID=p("events.ON_SHOW_PREVIEW_ID"),e.ON_EMAIL_CLONE_ID=p("events.ON_EMAIL_CLONE_ID"),e.ON_SEND_EMAIL_MODAL_ID=p("events.ON_SEND_EMAIL_MODAL_ID"),e.ON_NOTIFICATION=p("events.ON_NOTIFICATION"),e.READ_LOCALE=p("events.READ_LOCALE"),e.ON_TRANSLATE_ID=p("events.ON_TRANSLATE_ID"),e.ON_CODE_VALIDATE_ID=p("events.ON_CODE_VALIDATE_ID"),e.UPLOAD_EVENT_ID=p("events.UPLOAD_EVENT_ID"),e.PROXY_URL_EVENT_ID=p("events.PROXY_URL_EVENT_ID"),e.FILE_PROXY_EVENT_ID=p("events.FILE_PROXY_EVENT_ID"),e.ON_LIMIT_ID=p("events.ON_LIMIT_ID"),e.ON_BROWSER_EXTENSION_DETECTED_ID=p("events.ON_BROWSER_EXTENSION_DETECTED_ID"),e.ON_LAYOUT_CONVERT_REQUEST_ID=p("events.ON_LAYOUT_CONVERT_REQUEST_ID"),e.ON_BROWSER_TRANSLATE_DETECTED_ID=p("events.ON_BROWSER_TRANSLATE_DETECTED_ID"),e.AI_TEXT_REQUEST_ID=p("events.AI_TEXT_REQUEST_ID"),e.AI_IMAGE_REQUEST_ID=p("events.AI_IMAGE_REQUEST_ID"),e.AI_TEXT_PROGRESS_ID=p("events.AI_TEXT_PROGRESS_ID"),e.AI_IMAGE_PROGRESS_ID=p("events.AI_IMAGE_PROGRESS_ID"),e.AI_TEXT_STREAM_ID=p("events.AI_TEXT_STREAM_ID")})(se||(se={}));function er(e,t){return e.getOrCreateInstance(t,()=>new ne).event}function tr(e,t){return e.getOrCreateInstance(t,()=>new ne)}var rr="Not implemented in plugin",nr=_("plugin.app"),sr=_("plugin.disposable"),or=_("InitPipelineContext"),ir=_("plugin.instance"),we=_("plugin.optionsSource"),ar=_("plugin.store"),Ce=_("ConfigSource"),cr=_("plugin.standalone.project"),je=_("plugin.standalone.bootstrapToken"),ho=_("plugin.element"),Re=_("plugin.securityModule"),ur=_("plugin.standalone.activated"),dr=_("plugin.standalone.fileProxyRegistered"),lr=_("plugin.jwt.token"),hr=_("plugin.jwt.error"),po=_("PluginCollection"),fo=p("APP_LOAD_EVENT"),pr=p("CONFIG_CHANGED_EVENT");function w(e){if(e instanceof DOMException&&e.name==="AbortError")return e;const t=e===void 0?"The operation was aborted.":typeof e=="string"?e:e instanceof Error?e.message:String(e);return new DOMException(t,"AbortError")}function oe(e){if(e?.aborted)throw w(e.reason)}function fr(e,t){return t?(oe(t),new Promise((r,n)=>{const s=()=>{o(),n(w(t.reason))},o=()=>{t.removeEventListener("abort",s)};t.addEventListener("abort",s),e.then(i=>{o(),r(i)},i=>{o(),n(i)})})):e}function _r(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/([^a-zA-Z0-9_-])/g,"\\$1")}function ie(e,t=document){try{const n=t.querySelector(e);if(n)return n}catch{return null}const r=t.querySelectorAll("*");for(let n=0;n<r.length;n++){const s=r[n]?.shadowRoot;if(!s)continue;const o=ie(e,s);if(o)return o}return null}function Ne(e,t=[]){const r=e.querySelectorAll("*");for(let n=0;n<r.length;n++){const s=r[n]?.shadowRoot;s&&(t.push(s),Ne(s,t))}return t}function mr(e,t,r){if(e.isConnected)return e;const n=e.id?.trim();return n?Le(`#${_r(n)}`,t,r):Promise.reject(w("Editor mount element was disconnected and has no id — pass a CSS selector or call init() again after the host remounts the container."))}function Le(e,t,r){if(oe(r),typeof e<"u"){if(typeof e=="string"){const n=e,s=ie(n);if(s)return s;const o=t.addDisposable(new v);return new Promise((i,c)=>{const a=E=>{o.dispose(),E()},l=()=>{a(()=>c(w(r?.reason)))};if(r?.aborted){l();return}r?.addEventListener("abort",l),o.addDispose(()=>r?.removeEventListener("abort",l));const h=document.body??document.documentElement;if(!h){a(()=>c(w("Document is not ready to observe mount element")));return}const f=new Set,y=new MutationObserver(()=>{const E=ie(n);if(E){a(()=>i(E));return}b()}),m=E=>{f.has(E)||(f.add(E),y.observe(E,{attributes:!0,childList:!0,subtree:!0}))},b=()=>{const E=document.documentElement;if(E)for(const P of Ne(E))m(P)};m(h),b(),o.addDispose(()=>y.disconnect())})}return e instanceof Element?mr(e,t,r):e}return e}var yr=new Map;function Er(e,t=window){return{peer:e,send(r){e.postMessage(r,"*")},subscribe(r){const n=s=>{r({data:s.data,source:s.source,ports:s.ports})};return t.addEventListener("message",n),{dispose:()=>t.removeEventListener("message",n)}},close(){}}}function gr(e){let t=!1;return{peer:e,send(r){e.postMessage(r)},subscribe(r){const n=s=>{r({data:s.data,source:e})};return e.addEventListener("message",n),t||(t=!0,e.start()),{dispose:()=>e.removeEventListener("message",n)}},close(){e.close()}}}function br(e){return e}function vr(e){return e&&typeof e=="object"}function qe(e,t){return e&&typeof e=="object"&&e.operationId===t}var T="INIT_MESSAGE",Or="em:port-ready",Tr="em:window-drained",ae="";function Ue(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}var Ir=class extends v{_listeners=Object.create(null);addListenerAsync=(e,t,r=0,n)=>{const s=this._listeners[e]||(this._listeners[e]=[]);n&&typeof t=="function"&&(t=t.bind(n));const o=s.findIndex(([c,a])=>r<=a),i=[t,r];return this.isDisposed()||s.splice(o>=0?o:s.length,0,i),{dispose(){const c=s.indexOf(i);c>=0&&s.splice(c,1)}}};fireAsync=(e,t)=>{if(!this.isDisposed()){const r=this._listeners[e]||(this._listeners[e]=[]);let n;for(let s=0;s<r.length;s++){const o=r[s][0],i=n;n=c=>o(c,i)}if(n)return n(t)}};addListener=(e,t,r=0)=>this.addListenerAsync(e,(n,s)=>{try{t(n)}catch{}return s&&s(n)},r)},Ar=class extends v{_singleton;_target;_transport;_transportSubscription;_ports=new Map;_drained=new WeakSet;_inited=!1;_emitter=this.addDisposable(new Ir);_handshaken=new WeakSet;_greeted=new WeakSet;_outgoingFilter;constructor(e,t){super(),this._singleton=t,this._transport=Er({postMessage:()=>{}},window),this._transportSubscription=this.addDisposable(this._transport.subscribe(this._onTransportMessage)),this.addListener(T,()=>{this._inited||(this._inited=!0,this._target&&this._handshaken.add(this._target),this.send(T))}),e&&this.setTarget(e)}_onTransportMessage=e=>{const t=e,r=t.data,n=t.source,s=r?.port===!0?t.ports?.[0]:void 0,o=!this._isPortSource(t.source);if(o&&n&&r?.operationId==="em:window-drained"){this._drained.add(n);return}if(!(o&&n&&this._drained.has(n))){if(n&&n!==this._target&&this._greeted.has(n)&&qe(r,T)){this._greeted.delete(n),this._handshaken.add(n),this._postMessage(n,{operationId:T,data:{}}),s&&this.usePort(s,!0,n);return}if(vr(r)&&(t.source===this.target||this._isCurrentPort(t.source))||this._singleton&&qe(r,T)){if(s){const l=this._target;Promise.resolve().then(()=>this.usePort(s,!0,l))}const i=this._emitter.fireAsync(r.operationId||ae,r.operationId===void 0?t:r.data),c=r.result,a=r.error;c&&a&&Promise.resolve(i).then(l=>this._sendMessage(c,l),l=>this._sendMessage(a,l))}}};setTarget(e){if(this._target!==e){if(this._target=e,!e){this._inited=!1;return}if(this._handshaken.has(e)){this._inited=!0,this._emitter.fireAsync(T,void 0);return}this._inited=!1,this._postMessage(e,{operationId:T,data:{}})}}sendPort(e,t){this._postMessage(e,{operationId:T,data:{},port:!0},[t])}setOutgoingFilter(e){return this._outgoingFilter=e,()=>{this._outgoingFilter===e&&(this._outgoingFilter=void 0)}}greet(e){this._handshaken.has(e)||this._greeted.has(e)||this._target===e||(this._greeted.add(e),this._postMessage(e,{operationId:T,data:{}}))}forget(e){this._handshaken.delete(e),this._greeted.delete(e),this._closePort(e),this._drained.delete(e),this._target===e&&(this._inited=!1)}usePort(e,t=!1,r=this._target){if(!r||this._ports.has(r))return;const n=gr(e),s=n.subscribe(this._onTransportMessage);this._ports.set(r,{transport:n,subscription:s}),t&&(n.send({operationId:Or,data:{}}),this.drainWindow(r))}useWindow(e=this._target){e&&(this._closePort(e),this._drained.delete(e))}get usesPort(){return this._target!==void 0&&this._ports.has(this._target)}hasPort(e){return this._ports.has(e)}_closePort(e){const t=this._ports.get(e);t&&(t.subscription.dispose(),t.transport.close(),this._ports.delete(e))}drainWindow(e){this._ports.has(e)&&e.postMessage({operationId:Tr,data:{}},"*")}isWindowDrained(e){return this._drained.has(e)}_isPortSource(e){for(const t of this._ports.values())if(t.transport.peer===e)return!0;return!1}_isCurrentPort(e){return this._target!==void 0&&this._ports.get(this._target)?.transport.peer===e}getTarget(){return this._target}get target(){return this._target}_postMessage(e,t,r){let n=t;this._outgoingFilter&&!r?.length&&(n="data"in t?{...t,data:this._outgoingFilter(t.data)}:this._outgoingFilter(t));try{const s=this._ports.get(e);if(s){s.transport.send(n);return}if(r?.length){e.postMessage(n,"*",r);return}e.postMessage(n,"*")}catch(s){if(s?.name==="DataCloneError"){const o=typeof n?.data=="object"&&n?.data!==null?n.data:void 0}throw s}}_sendMessage(e,t,r=!0){if(!r&&!this.isInited())return;const n=this.addDisposable(this.onInit(s=>{const o=e?{operationId:e,data:t}:t;try{this._postMessage(s,{...o})}finally{n.dispose()}}))}send(e,t,r){return typeof e=="string"?this._sendMessage(e,t,r):this._sendMessage(ae,e,t)}sendAsync(e,t,r=!0){if(!r&&!this.isInited())return Promise.resolve();const n=Ue(),s=Ue();return new Promise((o,i)=>{const c=this.addDisposable(new v);c.addDisposable(this.onInit(a=>{try{this._postMessage(a,{operationId:e,data:t,result:n,error:s})}catch(l){c.dispose(),i(l);return}c.addDisposable(this._onMessage(n,l=>{o(l),c.dispose()})),c.addDisposable(this._onMessage(s,l=>{i(l),c.dispose()}))}))})}_onMessage(e,t,r=0){return this._emitter.addListener(e,t,r)}addListener(e,t,r){return t?this._onMessage(e,t,r):this._onMessage(ae,e)}addListenerAsyncPipe(e,t,r=0){return this._emitter.addListenerAsync(e,t,r)}addListenerAsync(e,t,r=0){return this._emitter.addListenerAsync(e,async(n,s)=>{const o=await t(n);return s?s(n):o},r)}isInited(){return this._inited}get inited(){return this._inited}onInit(e,t=!0,r=0){const n=this.addDisposable(new v);return this._inited&&this._target?t&&Promise.resolve().then(()=>{!this._inited||!this._target?n.addDisposable(this.onInit(e,t,r)):e(this._target)}):n.addDisposable(this._onMessage(T,()=>{e(this._target)},r)),n}dispose(){for(const e of Array.from(this._ports.keys()))this._closePort(e);this._transport.close(),super.dispose()}},xe="INJECTION";function ce(e){return e.getState}function ke(e){if(ce(e)){const t=e.getState()[xe];return t&&re.getOrCreateInstance(t,()=>re.createChild())}else return e}function L(e){return _(e)}var Pr=_("extensions.atomsHandlers"),Sr=L("HANDLE_ATOM_INSERT"),_o=_("extensions.sandboxExtensions"),mo="SANDBOX_EXTENSION_SCRIPT_STATUS",Dr=_("MESSAGE_SERVICE"),wr=L("SETTINGS_PANEL_EVENT"),Cr="advanced",jr=L("MODAL_SHOW_EVENT"),Rr=L("MODAL_CLOSE_EVENT"),Nr=L("MODAL_UPDATE_EVENT"),ue=_("client"),Lr=_("v2_client"),qr=_("ai_client"),Ur=_("app.cookieManager"),xr=_("app.storageProvider"),kr=_("image-blob-resolver"),$r=_("template-directives");function Mr(e,t){for(const r of e)if(r&&t in r)return r[t]}var $e=["generic","stockImages","emFiles","cdn"];function Me(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Fe(e){return!Me(e)||"match"in e||"rewrite"in e||"proxyBase"in e?!1:Object.keys(e).some(t=>$e.includes(t))}function Be(e){return e.length===0?[]:e.length===1?e[0]:e}function Fr(e){let t=!1,r=[];for(const n of e)if(n!==void 0){if(t=!0,Array.isArray(n)){r=[...n,...r];continue}r=[n,...r]}if(t)return Be(r)}function Br(e){return Me(e)&&("value"in e||"replace"in e)}function Ge(e,t){return t===void 0?e:Array.isArray(t)?[...t,...e]:[t,...e]}function Gr(e){let t=!1,r=[],n=!1;for(const o of e)if(o!==void 0){if(Br(o)){t=!0,o.replace&&(r=[],n=!0),o.value!==void 0&&(r=Ge(r,o.value),n=!0);continue}r=Ge(r,o),n=!0}const s=n?Be(r):void 0;if(!t)return s;if(s!==void 0)return{value:s}}function Hr(e){const t=e.filter(n=>n!==void 0);if(t.length===0)return;if(!t.some(n=>Fe(n)))return Fr(t);const r={};for(const n of $e){const s=Gr(e.map(o=>{if(o!==void 0)return Fe(o)?o[n]:n==="generic"?o:void 0}));s!==void 0&&(r[n]=s)}return Object.keys(r).length>0?r:void 0}function He(e){if(typeof e=="object"&&e){const t={};for(const r of Object.keys(e)){const n=e[r];n&&typeof n=="object"?t[r]=He(n):t[r]=n}return t}return e}function H(e,t){if(e!==t){if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const r=Array.isArray(e),n=Array.isArray(t);if(r){if(!n)return!1;const c=e.length;if(t.length!==c)return!1;for(let a=0;a<c;a++)if(!H(e[a],t[a]))return!1}else if(n)return!1;const s=Object.keys(e),o=Object.keys(t),i=s.length;if(i!==o.length)return!1;for(let c=0;c<i;c++){const a=s[c];if(!t.hasOwnProperty(a)||!H(e[a],t[a]))return!1}}return!0}var d=(function(e){return e.Json="application/json",e.FormData="multipart/form-data",e.UrlEncoded="application/x-www-form-urlencoded",e.Text="text/plain",e})({}),Wr=class{baseUrl="https://api.emailmaker.ru/wp-json";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(r=>this.encodeQueryParam(t,r)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(r=>typeof t[r]<"u").map(r=>Array.isArray(t[r])?this.addArrayQueryParam(t,r):this.addQueryParam(t,r)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>Object.keys(e||{}).reduce((t,r)=>{const n=e[r];return t.append(r,n instanceof Blob?n:typeof n=="object"&&n!==null?JSON.stringify(n):`${n}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const r=this.abortControllers.get(e);return r?r.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};async request({body:e,secure:t,path:r,type:n,query:s,format:o,baseUrl:i,cancelToken:c,extraQuery:a,proxyHandler:l,...h}){const f=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},y=this.mergeRequestParams(h,f);a&&(s=s?{...s,...a}:a);const m=s&&this.toQueryString(s),b=this.contentFormatters[n||"application/json"],E=o||y.format,P=`${i||this.baseUrl||""}${r}${m?`?${m}`:""}`,j=l?l(P,{body:e,secure:t,path:r,type:n,query:s,format:o,baseUrl:i,cancelToken:c,extraQuery:a,proxyHandler:l,...h}):P,Ut=new Request(j,{...y,headers:{...y.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(c?this.createAbortSignal(c):y.signal)||null,body:typeof e>"u"||e===null?null:b(e)});return this.customFetch(Ut).then(async xt=>{const O=xt;O.data=null,O.error=null,O.meta={request:Ut,response:O};const co=E?await xt[E]().then(z=>(O.ok?O.data=z:O.error={data:z},O)).catch(z=>(O.error=z,O)):O;return c&&this.abortControllers.delete(c),co})}},Vr=class{http;constructor(e){this.http=e}ai_create=(e,t={})=>this.http.request({path:"/ai-generator/v1/ai",method:"POST",body:e,type:d.UrlEncoded,...t})},Kr=class{http;constructor(e){this.http=e}ai_status_list=(e,t={})=>this.http.request({path:"/ai-generator/v1/ai-status",method:"GET",query:e,...t})},Yr=class{http;constructor(e){this.http=e}clear_history_list=(e,t={})=>this.http.request({path:"/ai-generator/v1/clear-history",method:"GET",query:e,...t})},Xr=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:d.UrlEncoded,...t})},Jr=class{http;constructor(e){this.http=e}get_list=(e,t={})=>this.http.request({path:"/cors-proxy/V1/get",method:"GET",query:e,...t})},zr=class{http;constructor(e){this.http=e}token_create=(e={})=>this.http.request({path:"/jwt-auth/v1/token",method:"POST",...e});token_validate_create=(e={})=>this.http.request({path:"/jwt-auth/v1/token/validate",method:"POST",...e})},Qr=class{http;constructor(e){this.http=e}top_used_list=(e,t={})=>this.http.request({path:"/projects/v1/top-used",method:"GET",query:e,...t})},Zr=class{http;constructor(e){this.http=e}get_code_info_list=(e,t={})=>this.http.request({path:"/promo/v1/get_code_info",method:"GET",query:e,...t})},en=class{http;constructor(e){this.http=e}set_code_create=(e,t={})=>this.http.request({path:"/promo/v1/set_code",method:"POST",body:e,type:d.UrlEncoded,...t})},tn=class{http;constructor(e){this.http=e}ai_create=(e,t={})=>this.http.request({path:"/save-file/v1/ai",method:"POST",body:e,type:d.UrlEncoded,...t})},rn=class{http;constructor(e){this.http=e}ai_status_list=(e,t={})=>this.http.request({path:"/save-file/v1/ai-status",method:"GET",query:e,...t})},nn=class{http;constructor(e){this.http=e}get_link_create=(e,t={})=>this.http.request({path:"/save-file/v1/get-link",method:"POST",body:e,type:d.UrlEncoded,...t})},sn=class{http;constructor(e){this.http=e}send_email_create=(e,t={})=>this.http.request({path:"/save-file/v1/send-email",method:"POST",body:e,type:d.UrlEncoded,...t})},on=class{http;constructor(e){this.http=e}shortener_create=(e,t={})=>this.http.request({path:"/save-file/v1/shortener",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t})},an=class{http;constructor(e){this.http=e}upload_create=(e,t={})=>this.http.request({path:"/save-file/v1/upload",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t})},cn=class{http;constructor(e){this.http=e}get_translations2=({file:e,...t},r={})=>this.http.request({path:`/translations/v1/${e}`,method:"GET",...r});get_translations3=({id:e,file:t,...r},n={})=>this.http.request({path:`/translations/v1/${t}/${e}`,method:"GET",...n})},un=class{http;constructor(e){this.http=e}add_user_create=(e,t={})=>this.http.request({path:"/user_to_project/v1/add_user",method:"POST",body:e,type:d.UrlEncoded,...t})},dn=class{http;constructor(e){this.http=e}blocktags_list=(e,t={})=>this.http.request({path:"/wp/v2/blocktags",method:"GET",query:e,format:"json",...t});blocktags_create=(e,t={})=>this.http.request({path:"/wp/v2/blocktags",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t});blocktags_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/blocktags/${e}`,method:"GET",query:t,format:"json",...r});blocktags_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/blocktags/${e}`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});blocktags_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/blocktags/${e}`,method:"PUT",body:r,type:d.UrlEncoded,format:"json",...n});blocktags_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/blocktags/${e}`,method:"PATCH",body:r,type:d.UrlEncoded,format:"json",...n});blocktags_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/blocktags/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n})},ln=class{http;constructor(e){this.http=e}comments_list=(e,t={})=>this.http.request({path:"/wp/v2/comments",method:"GET",query:e,format:"json",...t});comments_create=(e,t={})=>this.http.request({path:"/wp/v2/comments",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t});comments_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/comments/${e}`,method:"GET",query:t,format:"json",...r});comments_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/comments/${e}`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});comments_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/comments/${e}`,method:"PUT",body:r,type:d.UrlEncoded,format:"json",...n});comments_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/comments/${e}`,method:"PATCH",body:r,type:d.UrlEncoded,format:"json",...n});comments_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/comments/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n})},hn=class{http;constructor(e){this.http=e}confirmation_list=(e,t={})=>this.http.request({path:"/wp/v2/confirmation",method:"GET",query:e,...t})},We=class{http;constructor(e){this.http=e}eblock_list=(e,t={})=>this.http.request({path:"/wp/v2/eblock",method:"GET",query:e,format:"json",...t});eblock_create=(e,t={})=>this.http.request({path:"/wp/v2/eblock",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t});eblock_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/eblock/${e}`,method:"GET",query:t,format:"json",...r});eblock_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/eblock/${e}`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});eblock_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/eblock/${e}`,method:"PUT",body:r,type:d.UrlEncoded,format:"json",...n});eblock_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/eblock/${e}`,method:"PATCH",body:r,type:d.UrlEncoded,format:"json",...n});eblock_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/eblock/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n});eblock_revisions_list=({parent:e,...t},r={})=>this.http.request({path:`/wp/v2/eblock/${e}/revisions`,method:"GET",query:t,format:"json",...r});eblock_revisions_detail=({parent:e,id:t,...r},n={})=>this.http.request({path:`/wp/v2/eblock/${e}/revisions/${t}`,method:"GET",query:r,format:"json",...n});eblock_revisions_delete=({parent:e,id:t,...r},n,s={})=>this.http.request({path:`/wp/v2/eblock/${e}/revisions/${t}`,method:"DELETE",body:n,type:d.UrlEncoded,format:"json",...s});eblock_autosaves_list=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/eblock/${e}/autosaves`,method:"GET",query:t,format:"json",...r});eblock_autosaves_create=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/eblock/${e}/autosaves`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});eblock_autosaves_detail=({parent:e,id:t,...r},n={})=>this.http.request({path:`/wp/v2/eblock/${e}/autosaves/${t}`,method:"GET",query:r,format:"json",...n})},Ve=class{http;constructor(e){this.http=e}email_list=(e,t={})=>this.http.request({path:"/wp/v2/email",method:"GET",query:e,format:"json",...t});email_create=(e,t={})=>this.http.request({path:"/wp/v2/email",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t});email_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/email/${e}`,method:"GET",query:t,format:"json",...r});email_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/email/${e}`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});email_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/email/${e}`,method:"PUT",body:r,type:d.UrlEncoded,format:"json",...n});email_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/email/${e}`,method:"PATCH",body:r,type:d.UrlEncoded,format:"json",...n});email_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/email/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n});email_revisions_list=({parent:e,...t},r={})=>this.http.request({path:`/wp/v2/email/${e}/revisions`,method:"GET",query:t,format:"json",...r});email_revisions_detail=({parent:e,id:t,...r},n={})=>this.http.request({path:`/wp/v2/email/${e}/revisions/${t}`,method:"GET",query:r,format:"json",...n});email_revisions_delete=({parent:e,id:t,...r},n,s={})=>this.http.request({path:`/wp/v2/email/${e}/revisions/${t}`,method:"DELETE",body:n,type:d.UrlEncoded,format:"json",...s});email_autosaves_list=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/email/${e}/autosaves`,method:"GET",query:t,format:"json",...r});email_autosaves_create=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/email/${e}/autosaves`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});email_autosaves_detail=({parent:e,id:t,...r},n={})=>this.http.request({path:`/wp/v2/email/${e}/autosaves/${t}`,method:"GET",query:r,format:"json",...n})},pn=class{http;constructor(e){this.http=e}emailtags_list=(e,t={})=>this.http.request({path:"/wp/v2/emailtags",method:"GET",query:e,format:"json",...t});emailtags_create=(e,t={})=>this.http.request({path:"/wp/v2/emailtags",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t});emailtags_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/emailtags/${e}`,method:"GET",query:t,format:"json",...r});emailtags_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/emailtags/${e}`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});emailtags_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/emailtags/${e}`,method:"PUT",body:r,type:d.UrlEncoded,format:"json",...n});emailtags_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/emailtags/${e}`,method:"PATCH",body:r,type:d.UrlEncoded,format:"json",...n});emailtags_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/emailtags/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n})},fn=class{http;constructor(e){this.http=e}group_list=(e,t={})=>this.http.request({path:"/wp/v2/group",method:"GET",query:e,format:"json",...t});group_create=(e,t={})=>this.http.request({path:"/wp/v2/group",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t});group_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/group/${e}`,method:"GET",query:t,format:"json",...r});group_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/group/${e}`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});group_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/group/${e}`,method:"PUT",body:r,type:d.UrlEncoded,format:"json",...n});group_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/group/${e}`,method:"PATCH",body:r,type:d.UrlEncoded,format:"json",...n});group_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/group/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n})},_n=class{http;constructor(e){this.http=e}notification_list=(e,t={})=>this.http.request({path:"/wp/v2/notification",method:"GET",query:e,format:"json",...t});notification_create=(e,t={})=>this.http.request({path:"/wp/v2/notification",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t});notification_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/notification/${e}`,method:"GET",query:t,format:"json",...r});notification_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/notification/${e}`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});notification_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/notification/${e}`,method:"PUT",body:r,type:d.UrlEncoded,format:"json",...n});notification_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/notification/${e}`,method:"PATCH",body:r,type:d.UrlEncoded,format:"json",...n});notification_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/notification/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n});notification_autosaves_list=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/notification/${e}/autosaves`,method:"GET",query:t,format:"json",...r});notification_autosaves_create=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/notification/${e}/autosaves`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});notification_autosaves_detail=({parent:e,id:t,...r},n={})=>this.http.request({path:`/wp/v2/notification/${e}/autosaves/${t}`,method:"GET",query:r,format:"json",...n})},mn=class{http;constructor(e){this.http=e}project_list=(e,t={})=>this.http.request({path:"/wp/v2/project",method:"GET",query:e,format:"json",...t});project_create=(e,t={})=>this.http.request({path:"/wp/v2/project",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t});project_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/project/${e}`,method:"GET",query:t,format:"json",...r});project_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/project/${e}`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});project_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/project/${e}`,method:"PUT",body:r,type:d.UrlEncoded,format:"json",...n});project_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/project/${e}`,method:"PATCH",body:r,type:d.UrlEncoded,format:"json",...n});project_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/project/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n});project_revisions_list=({parent:e,...t},r={})=>this.http.request({path:`/wp/v2/project/${e}/revisions`,method:"GET",query:t,format:"json",...r});project_revisions_detail=({parent:e,id:t,...r},n={})=>this.http.request({path:`/wp/v2/project/${e}/revisions/${t}`,method:"GET",query:r,format:"json",...n});project_revisions_delete=({parent:e,id:t,...r},n,s={})=>this.http.request({path:`/wp/v2/project/${e}/revisions/${t}`,method:"DELETE",body:n,type:d.UrlEncoded,format:"json",...s})},yn=class{http;constructor(e){this.http=e}subscription_list=(e,t={})=>this.http.request({path:"/wp/v2/subscription",method:"GET",query:e,format:"json",...t});subscription_create=(e,t={})=>this.http.request({path:"/wp/v2/subscription",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t});subscription_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/subscription/${e}`,method:"GET",query:t,format:"json",...r});subscription_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/subscription/${e}`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});subscription_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/subscription/${e}`,method:"PUT",body:r,type:d.UrlEncoded,format:"json",...n});subscription_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/subscription/${e}`,method:"PATCH",body:r,type:d.UrlEncoded,format:"json",...n});subscription_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/subscription/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n})},En=class{http;constructor(e){this.http=e}users_register_create=(e={})=>this.http.request({path:"/wp/v2/users/register",method:"POST",...e});users_lostpassword_create=(e={})=>this.http.request({path:"/wp/v2/users/lostpassword",method:"POST",...e});users_lost_password_create=(e={})=>this.http.request({path:"/wp/v2/users/lost-password",method:"POST",...e});users_list=(e,t={})=>this.http.request({path:"/wp/v2/users",method:"GET",query:e,format:"json",...t});users_create=(e,t={})=>this.http.request({path:"/wp/v2/users",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t});users_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/users/${e}`,method:"GET",query:t,format:"json",...r});users_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/users/${e}`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});users_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/users/${e}`,method:"PUT",body:r,type:d.UrlEncoded,format:"json",...n});users_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/users/${e}`,method:"PATCH",body:r,type:d.UrlEncoded,format:"json",...n});users_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/users/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n});users_me_list=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"GET",query:e,format:"json",...t});users_me_create=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t});users_me_update=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"PUT",body:e,type:d.UrlEncoded,format:"json",...t});users_me_partial_update=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"PATCH",body:e,type:d.UrlEncoded,format:"json",...t});users_me_delete=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"DELETE",body:e,type:d.UrlEncoded,format:"json",...t});users_application_passwords_list=({userId:e,...t},r={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords`,method:"GET",query:t,format:"json",...r});users_application_passwords_create=({userId:e,...t},r,n={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords`,method:"POST",body:r,type:d.UrlEncoded,format:"json",...n});users_application_passwords_delete=({userId:e,...t},r={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords`,method:"DELETE",format:"json",...r});users_application_passwords_introspect_list=({userId:e,...t},r={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/introspect`,method:"GET",query:t,format:"json",...r});users_application_passwords_detail=({userId:e,uuid:t,...r},n={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"GET",query:r,format:"json",...n});users_application_passwords_create2=({userId:e,uuid:t,...r},n,s={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"POST",body:n,type:d.UrlEncoded,format:"json",...s});users_application_passwords_update=({userId:e,uuid:t,...r},n,s={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"PUT",body:n,type:d.UrlEncoded,format:"json",...s});users_application_passwords_partial_update=({userId:e,uuid:t,...r},n,s={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"PATCH",body:n,type:d.UrlEncoded,format:"json",...s});users_application_passwords_delete2=({userId:e,uuid:t,...r},n={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"DELETE",format:"json",...n})},gn={aiGenerator:[Vr,Kr,Yr],app:[Xr],corsProxy:[Jr],jwtAuth:[zr],projects:[Qr],promo:[Zr,en],saveFile:[tn,rn,nn,sn,on,an],translations:[cn],userToProject:[un],wp:[dn,ln,hn,We,Ve,pn,fn,_n,mn,yn,En]},bn=_("prewarm.networkActivity");function vn(){let e=0;const t=new Set,r=()=>{t.forEach(n=>n())};return{begin(){e+=1,r();let n=!1;return()=>{n||(n=!0,e-=1,r())}},inFlight:()=>e,watch(n){return t.add(n),()=>t.delete(n)}}}function Ke(e){return e.getOrCreateInstance(bn,()=>vn())}var On=Symbol("rest.publicRequest"),Ye=_("rest.requestHandler"),Tn=_("rest.responseHandler"),de=_("rest.customFetch"),le=_("rest_transport"),In=e=>{e.inject(de,{execute:async(t,r={})=>{const n=e.getServices(Ye),s={public:r[On]===!0},o=Ke(e).begin();try{let i=t instanceof Request?t:new Request(t,r);for(const l of n){const h=await l.execute(i,s);h instanceof Request&&(i=h)}let c=await fetch(i);const a=e.getServices(Tn);for(const l of a)c=await l.execute(c);return c}finally{o()}}})};function An(e,t){const r=e.getInstance(le);if(!r)throw new Error("[restApi] транспорт не зарегистрирован в контейнере");return Object.assign({},...t.map(n=>new n(r)))}var Pn=3e5,S=new Map,q=new Map,Xe=new Set(["generic","stockImages","emFiles","cdn"]),Sn=/^https:\/\/(?:media\d*|i)\.giphy\.com\/media/i,Dn=/^https:\/\/api\.giphy\.com\/v1\/gifs/i,wn=/^https:\/\/images\.unsplash\.com/i,Cn=/^https:\/\/api\.unsplash\.com/i,jn=/^https:\/\/assets\.streamlinehq\.com/i,Rn=/^https:\/\/public-api\.streamlinehq\.com/i;function W(e){return typeof e=="string"&&e.trim().length>0}function Nn(){const e="https://px0.useblocks.io/";if(W(e))return e;const t={}.REACT_APP_UNSPLASH_PROXY;return W(t)?t:void 0}function Je(){return{stockImagesProxyUrl:{}.REACT_APP_STOCK_IMAGES_PROXY,stockImagesProxyUrlApi:{}.REACT_APP_STOCK_IMAGES_PROXY_API,genericProxyUrl:Nn()}}function Ln(e){const t=[],{stockImagesProxyUrl:r,stockImagesProxyUrlApi:n,genericProxyUrl:s}=Je();return n&&t.push({id:"mode-default-stock-images-api",match:"https://api.unsplash.com/{path}",proxyBase:n,rewrite:"{path}?proxy_url={origin}{search}{hash}"}),r&&t.push({id:"mode-default-stock-images-cdn",match:"https://images.unsplash.com/{path}",proxyBase:r,rewrite:"{path}?proxy_url={origin}{search}{hash}"}),s&&t.push({id:"mode-default-generic",proxyBase:s,rewrite:"{path}?proxy_url={origin}{search}{hash}"}),t.length>0?t:void 0}function ze(e){return!!e}var qn=()=>{if(!(typeof window>"u"))return window.location.origin};function Un(e){const t=qn();if(!t)return!1;try{return new URL(e).origin===t}catch{return!1}}function xn(e,t){try{const r=new URL(e).hostname.toLowerCase();return t.find(n=>n.toLowerCase()===r)??null}catch{return null}}function kn(e,t){return t?!1:e==="downloadBlob"||e==="display"}function $n(e){const t=e.trim();return t?t.replace(/:\d+$/,""):""}function Mn(e,t){if(!t.proxySameOrigin&&Un(e))try{return{skipReason:"same-origin",matchedHost:new URL(e).hostname}}catch{return null}const r=xn(e,t.directHosts);return r?{skipReason:"direct-host",matchedHost:r}:null}function Fn(e){const t=[];for(const r of e){if(Array.isArray(r)){for(const n of r)t.push(n);continue}t.push(r)}return t}function Bn(e){const t=new Set,r=[];for(const n of e){const s=I(typeof n=="string"?n:n.proxyBase||"");s&&t.has(s)||(s&&t.add(s),r.push(n))}return r}function he(e){return e?.backendProxy}function I(e){return e.replace(/\/$/,"")}function pe(e){return/^https?:\/\//i.test(e)}function Gn(e){return e==="/"?"":e.replace(/\/$/,"")}function U(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function fe(e){const t=new Set;return e.filter(r=>!r.url||t.has(r.url)?!1:(t.add(r.url),!0))}function _e(){return"https://cdn.useblocks.io"}function Qe(e){return!U(e)||"match"in e||"rewrite"in e||"proxyBase"in e?!1:Object.keys(e).some(t=>Xe.has(t))}function Ze(e){if(e!=null)return U(e)&&("value"in e||"replace"in e)?e.value:e}function et(e,t="generic",r=!1){const n=st(e,r);if(n)return Qe(n)?Ze(n[t]??n.generic):n}function tt(e,t=!1){const r=st(e,t);return r?Qe(r)?Object.keys(r).filter(n=>Xe.has(n)).map(n=>Ze(r[n])).filter(Boolean):[r]:[]}function Hn(e){const t=he(e);return t?[t]:[]}function Wn(e,t=!1){if(ze(t))return{proxyBlobFetch:!0,proxyImgSrc:!0,proxyCdn:!0,proxyEmFiles:!0,proxyStockImages:!0};const{stockImagesProxyUrl:r,stockImagesProxyUrlApi:n}=Je();return{proxyBlobFetch:!0,proxyImgSrc:!1,proxyCdn:!1,proxyEmFiles:!1,proxyStockImages:W(r)||W(n)}}function rt(e){const t=[],r=new Set;for(const n of e){const s=$n(n);if(!s)continue;const o=s.toLowerCase();r.has(o)||(r.add(o),t.push(s))}return t}function nt(e){return e?Array.isArray(e)?rt(e):rt(e.value??[]):[]}function Vn(e,t){return[...new Set([...e,...t])]}function Kn(e){const t=e?.canvasImageCache;if(t===!1)return[];const r=t===!0||t===void 0?{}:t;return r.enabled===!1?[]:r.sourceHosts===void 0?[]:nt(r.sourceHosts)}function Yn(e,t){return{inheritDefaults:!e,proxySameOrigin:!1,directHosts:[],...Wn(t,e)}}function x(e,t=!1){const r=Yn(t,e),n=e?.resourceProxyPolicy??{};return{inheritDefaults:n.inheritDefaults??r.inheritDefaults,proxySameOrigin:n.proxySameOrigin??r.proxySameOrigin,directHosts:Vn(Kn(e),n.directHosts!==void 0?nt(n.directHosts):r.directHosts),proxyBlobFetch:n.proxyBlobFetch??r.proxyBlobFetch,proxyImgSrc:n.proxyImgSrc??r.proxyImgSrc,proxyCdn:n.proxyCdn??r.proxyCdn,proxyEmFiles:n.proxyEmFiles??r.proxyEmFiles,proxyStockImages:n.proxyStockImages??r.proxyStockImages,recoveryTtlMs:n.recoveryTtlMs??r.recoveryTtlMs}}function Xn(e,t=!1){return x(e,t).inheritDefaults}function Jn(e,t=!1){const r=x(e,t).recoveryTtlMs;return typeof r=="number"&&r>0?r:Pn}function st(e,t=!1){const r=e?.resourceProxy;if(!Xn(e,t))return r;const n=Ln(e);if(r===void 0)return n;const s=Hr([n,r]);return Array.isArray(s)?Bn(Fn(s)):s}function zn(e){return{proxyEmFiles:!0,proxyAi:!1}}function me(e,t,r,n=!1){const s=x(r,n);if(t==="display")return e==="stockImages"?s.proxyStockImages:s.proxyImgSrc;switch(e){case"cdn":return s.proxyCdn;case"emFiles":return s.proxyEmFiles;case"stockImages":return s.proxyStockImages;default:return s.proxyBlobFetch}}function Qn(e,t,r,n=!1){return e==="stockImages"&&me("stockImages",t,r,n)}function Zn(e,t){const r=zn(t),n=t?.backendProxyPolicy;switch(e){case"emFiles":return n?.proxyEmFiles??r.proxyEmFiles;case"ai":return n?.proxyAi??r.proxyAi;default:return!0}}var es={url:".+",url_encoded:".+",origin:"https?:\\/\\/[^\\/?#]+",origin_encoded:".+",proxy_url:"https?:\\/\\/[^\\/?#]+",proxy_url_encoded:".+",path:"[^?#]*",pathname:"[^?#]*",path_with_slash:"\\/[^?#]*",pathname_with_slash:"\\/[^?#]*",query:"[^#]*",search:"\\?[^#]*",hash:"#.*",fragment:".*",pathname_after_wp_json:"[^?#]*",pathname_after_wp_json_with_slash:"\\/[^?#]*",rest_namespace:"[^/?#]*",rest_version:"[^/?#]*",rest_route:"[^?#]*",rest_route_with_slash:"\\/[^?#]*"};function ts(e){const t=[],r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\{([a-z_]+)\\\}/gi,(n,s)=>(t.push(s),`(${es[s]||".+"})`));return{regex:new RegExp(`^${r}$`,"i"),tokens:t}}function rs(e){return/[?#]/.test(e)||/\{(?:url|url_encoded|query|search|hash|fragment)\}/i.test(e)}function ns(e,t){if(rs(t))return e;try{const r=new URL(e);return`${r.origin}${r.pathname}`}catch{return e.split(/[?#]/)[0]||e}}function ss(e,t,r){if(r.endsWith("_encoded"))return!0;const n=e.slice(0,t),s=n.lastIndexOf("#"),o=n.lastIndexOf("?"),i=n.lastIndexOf("&"),c=n.lastIndexOf("=");return c>Math.max(o,i)&&c>s}function os(e){try{const t=new URL(e),r=t.pathname.replace(/^\/+/,""),n=t.search.replace(/^\?/,""),s=t.hash.replace(/^#/,""),o=r.replace(/^wp-json\/?/i,""),i=o?`/${o}`:"/",c=o.match(/^([^/]+)(?:\/([^/]+))?(?:\/(.*))?$/),a=c?.[1]||"",l=c?.[2]||"",h=c?.[3]||"";return{url:e,url_encoded:encodeURIComponent(e),origin:t.origin,origin_encoded:encodeURIComponent(t.origin),proxy_url:t.origin,proxy_url_encoded:encodeURIComponent(t.origin),path:r,pathname:r,path_with_slash:t.pathname||"/",pathname_with_slash:t.pathname||"/",query:n,search:t.search,hash:t.hash,fragment:s,pathname_after_wp_json:o,pathname_after_wp_json_with_slash:i,rest_namespace:a,rest_version:l,rest_route:h,rest_route_with_slash:h?`/${h}`:"/"}}catch{return}}function k(e,t){if(!e)return{};if(Array.isArray(e)){for(const c of e){const a=k(c,t);if(a!==void 0)return a}return}if(e==="*")return{};const r=ns(t,e),{regex:n,tokens:s}=ts(e),o=n.exec(r);if(!o)return;const i={};return s.forEach((c,a)=>{i[`matched_${c}`]=o[a+1]||""}),i}function A(e,t,r={}){const n=os(t);if(!n)return t;const s={...n,...r};let o="",i=0;const c=/\{([a-z_]+)\}/gi;let a;for(;a=c.exec(e);){o+=e.slice(i,a.index);const l=s[a[1]]??"",h=ss(e,a.index,a[1])?encodeURIComponent(l):l;o+=h,i=a.index+a[0].length}o+=e.slice(i);try{const l=new URL(o),h=new URL(t);return!o.includes("{search}")&&!o.includes("{query}")&&h.search&&h.searchParams.forEach((f,y)=>{l.searchParams.has(y)||l.searchParams.append(y,f)}),!o.includes("{hash}")&&!o.includes("{fragment}")&&h.hash&&!l.hash&&(l.hash=h.hash),l.toString()}catch{return o}}function V(e,t){try{const r=new URL(t);return`${I(e)}/${r.pathname.replace(/^\//,"")}${r.search}${r.hash}`}catch{return t}}function K(e,t){const r=I(e);return t?pe(t)?t:t.startsWith("?")||t.startsWith("#")?`${r}${t}`:`${r}${t.startsWith("/")?"":"/"}${t}`:r}function ot(e,t,r,n){const s=e.match;return s?Array.isArray(s)?s.some(o=>ot({...e,match:o},t,r,n)):typeof s=="function"?!!s({url:t,resourceType:r,intent:n}):s==="*"?!0:k(s,t)!==void 0:!0}function is(e,t,r,n,s,o){if(e==null)return[];const i=Array.isArray(e)?e:[e],c=[];return i.forEach((a,l)=>{if(!a)return;if(typeof a=="string"){const m=a.includes("{")&&a.includes("}")?A(a,t):V(a,t);c.push({key:`${r}:${l}`,url:m,source:n});return}if(!U(a)||!("rewrite"in a))return;const h=a;if(!ot(h,t,s,o))return;const f=typeof h.match=="string"||Array.isArray(h.match)?k(h.match,t)||{}:{},y=typeof h.proxyBase=="string"&&h.proxyBase.trim()?h.proxyBase.trim():void 0;(Array.isArray(h.rewrite)?h.rewrite:[h.rewrite]).filter(Boolean).forEach((m,b)=>{const E=typeof m=="function"?(()=>{const P=m({url:t,proxyBase:y,resourceType:s,intent:o,...f}),j=y&&!pe(P)?K(y,P):P;return j.includes("{")&&j.includes("}")?A(j,t,f):j})():y?A(K(y,m),t,f):m.includes("{")&&m.includes("}")?A(m,t,f):V(m,t);c.push({key:`${r}:${h.id||"rule"}:${l}:${b}`,url:E,source:n})})}),fe(c)}function it(e,t,r,n){const s=e.match;return s?Array.isArray(s)?s.some(o=>it({...e,match:o},t,r,n)):typeof s=="function"?!!s({url:t,method:n,requestType:r}):s==="*"?!0:k(s,t)!==void 0:!0}function as(e,t,r,n="generic"){if(e==null)return[];const s=Array.isArray(e)?e:[e],o=[];return s.forEach((i,c)=>{if(!i)return;if(typeof i=="string"){const f=i.includes("{")&&i.includes("}")?A(i,t):V(i,t);o.push({key:`backend:${c}`,url:f,source:"resource"});return}if(!U(i)||!("rewrite"in i))return;const a=i;if(!it(a,t,n,r))return;const l=typeof a.match=="string"||Array.isArray(a.match)?k(a.match,t)||{}:{},h=typeof a.proxyBase=="string"&&a.proxyBase.trim()?a.proxyBase.trim():void 0;(Array.isArray(a.rewrite)?a.rewrite:[a.rewrite]).filter(Boolean).forEach((f,y)=>{const m=typeof f=="function"?(()=>{const b=f({url:t,proxyBase:h,method:r,requestType:n,...l}),E=h&&!pe(b)?K(h,b):b;return E.includes("{")&&E.includes("}")?A(E,t,l):E})():h?A(K(h,f),t,l):f.includes("{")&&f.includes("}")?A(f,t,l):V(f,t);o.push({key:`backend:${a.id||"rule"}:${c}:${y}`,url:m,source:"resource"})})}),fe(o)}function cs(e,t,r){return[e,...r.map(n=>n.url)].join("|")}function us(e,t){if(!e||t.length<2)return t;const r=S.get(e);if(!r?.activeUrl)return t;const n=t.find(s=>s.url===r.activeUrl);return n?[n,...t.filter(s=>s.url!==r.activeUrl)]:t}function at(e){e&&q.get(e)?.forEach(t=>{try{t()}catch{}})}function ds(e,t){if(!e)return()=>{};const r=q.get(e)||new Set;return r.add(t),q.set(e,r),()=>{const n=q.get(e);n&&(n.delete(t),n.size===0&&q.delete(e))}}function ct(e,t){if(!e)return!1;const r=S.get(e);return!!r?.failedUntil&&r.activeUrl===t.url&&r.failedUntil>Date.now()}function ls(e,t){const r=us(e,t);if(!e||r.length<2)return r;const n=[],s=[];return r.forEach(o=>{ct(e,o)?s.push(o):n.push(o)}),[...n,...s]}function ut(e,t){if(!e)return;const r=S.get(e);S.set(e,{activeUrl:t.url}),(r?.activeUrl!==t.url||r?.failedUntil)&&at(e)}function dt(e,t,r,n=!1){if(!e)return;const s=Jn(r,n),o={activeUrl:t.url,failedUntil:Date.now()+s},i=S.get(e);S.set(e,o),(i?.activeUrl!==o.activeUrl||i?.failedUntil!==o.failedUntil)&&at(e)}function hs(e){return jn.test(e)||Rn.test(e)}function ps(e){return Sn.test(e)||Dn.test(e)}function ye(e){return hs(e)||ps(e)}function Ee(e,t){const r=_e();return r&&e.startsWith(I(r))?"cdn":wn.test(e)||Cn.test(e)?"stockImages":"generic"}function fs(e){try{const t=new URL(e);return/(?:^|\/)wp-json\/em-files\/v\d+(?:\/|$)/i.test(t.pathname)?"emFiles":/(?:^|\/)wp-json\/ai-generator\/v\d+(?:\/|$)/i.test(t.pathname)?"ai":"generic"}catch{return"generic"}}function _s(e,t){try{const r=new URL(e),n=new URL(t),s=Gn(n.pathname),o=s===""?!0:r.pathname===s||r.pathname.startsWith(`${s}/`);if(r.origin!==n.origin||!o)return null;const i=r.searchParams.get("url");if(i)return i;const c=r.searchParams.get("proxy_url");if(!c)return null;const a=new URL(c),l=s===""?r.pathname.replace(/^\/+/,""):r.pathname.slice(s.length).replace(/^\/+/,"");return a.pathname=l?`/${l}`:"/",r.searchParams.forEach((h,f)=>{f==="proxy_url"||f==="url"||a.searchParams.has(f)||a.searchParams.append(f,h)}),r.hash&&!a.hash&&(a.hash=r.hash),a.toString()}catch{return null}}function ge(e,t=[]){return e==null||(Array.isArray(e)?e:[e]).forEach(r=>{if(r){if(typeof r=="string"){const n=r.split("{")[0]?.trim();n&&t.push(I(n));return}!U(r)||!("rewrite"in r)||(typeof r.proxyBase=="string"&&r.proxyBase.trim()&&t.push(I(r.proxyBase.trim())),(Array.isArray(r.rewrite)?r.rewrite:[r.rewrite]).forEach(n=>{if(typeof n!="string")return;const s=n.split("{")[0]?.trim();s&&t.push(I(s))}))}}),t}function ms(e,t,r=!1){return tt(t,r).flatMap(n=>ge(n)).filter(Boolean).some(n=>n&&e.startsWith(n))}function ys(e,t){return Hn(t).flatMap(r=>ge(r)).filter(Boolean).some(r=>r&&e.startsWith(r))}function Es(e,t,r=!1){const n=tt(t,r).flatMap(s=>ge(s)).filter(Boolean);for(const s of n){const o=_s(e,s);if(o)return o}return null}function lt(e,t,r=!1){return ms(e,t,r)}function $(e,t,r=!1){return Es(e,t,r)||e}function gs(e,t,r,n=!1){return!!et(r,e,n)&&me(e,t,r,n)}function bs(e,t){return!!he(t)&&Zn(e,t)}function vs(e,t,r,n=!1){return ze(n)||t==="downloadBlob"?!1:e==="stockImages"?me(e,t,r,n):!1}function Os(e,t={}){const r=t.config,n=$(e,r,t.standalone),s=t.resourceType||Ee(n,r),o=t.intent||"display";if(ye(n))return{resourceType:"generic",intent:o,candidates:[]};const i=gs(s,o,r,t.standalone)?is(et(r,s,t.standalone),n,s,"resource",s,o):[];return{resourceType:s,intent:o,candidates:i,stabilityKey:i.length?cs(s,o,i):void 0}}function Ts(e,t={}){const r=t.requestType||fs(e);return bs(r,t.config)?as(he(t.config),e,t.method,r):[]}function M(e,t={},r){const n=t.intent||r;if(lt(e,t.config,t.standalone)){const a=$(e,t.config,t.standalone),l=t.resourceType||Ee(a,t.config),h={key:"already-proxied",url:e,source:"direct"};return{chain:{resourceType:l,intent:n,candidates:[h]},candidates:[h]}}const s=$(e,t.config,t.standalone),o=t.resourceType||Ee(s,t.config),i=vs(o,n,t.config,t.standalone);if(kn(n,i)&&!ye(s)&&!Qn(o,n,t.config,t.standalone)){const a=Mn(s,x(t.config,t.standalone));if(a){const l={key:`direct-${a.skipReason}`,url:s,source:"direct"};return{chain:{resourceType:o,intent:n,candidates:[l],directShortCircuit:a},candidates:[l]}}}const c=Os(s,{...t,intent:n,resourceType:o});return{chain:c,candidates:fe([...ls(c.stabilityKey,c.candidates),...i?[]:[{key:"direct",url:s,source:"direct"}]])}}function ht(e,t,r={},n){const{chain:s,candidates:o}=M(e,r,n),i=o.find(c=>c.url===t);return!i||i.source!=="resource"?null:{chain:s,candidate:i}}function Is(e,t,r={}){const n=ht(e,t,r,"display");n&&ut(n.chain.stabilityKey,n.candidate)}function As(e,t,r={}){const n=ht(e,t,r,"display");n&&dt(n.chain.stabilityKey,n.candidate,r.config,r.standalone)}function Y(e,t,r,n=!1){return{src:e,changed:r,exhausted:n,reason:t}}var Ps=class extends Error{final=!0;skipReason;hostname;constructor(e,t){super(`Direct resource fetch failed (${e}: ${t}). ${e==="same-origin"?"The same-origin asset is unreachable; check that the resource exists and is served by the editor origin.":"Add CORS headers for the editor origin or remove the host from directHosts."}`),this.name="DirectResourceFetchError",this.skipReason=e,this.hostname=t}};function Ss(e,t){return new Ps(e,t)}function Ds(e){if(e instanceof Error&&e.name==="AbortError")return!1;if(e instanceof TypeError)return!0;if(e instanceof Error){if(e.message==="Proxy validation failed")return!1;if(e.message.startsWith("Proxy fetch failed with status"))return!0}return!0}function ws(e,t=!1){const r=x(e,t);return{inheritDefaults:r.inheritDefaults,proxySameOrigin:r.proxySameOrigin,directHosts:[...r.directHosts]}}function Cs(e){return e.length>0&&e.every(t=>t.source==="direct")}function js(e,t,r){return e.directShortCircuit?e.directShortCircuit.skipReason:t.length===1&&t[0]?.source==="direct"&&ye(r)?"direct-only-vendor":null}function Rs(e,t,r){return e.directShortCircuit||r==="direct-only-vendor"||Cs(t)?"direct":"proxy"}function Ns(e,t={}){const{chain:r,candidates:n}=M(e,t,t.intent||"display"),s=r.stabilityKey?S.get(r.stabilityKey):void 0,o=n[0]?.url||e,i=js(r,n,$(e,t.config,t.standalone)),c=ws(t.config,t.standalone);return{originalUrl:e,resourceType:r.resourceType,intent:r.intent,stabilityKey:r.stabilityKey,currentSrc:o,runtimeState:s?{...s}:void 0,decision:Rs(r,n,i),skipReason:i,matchedHost:r.directShortCircuit?.matchedHost,policy:c,candidates:n.map(a=>({...a,isCurrent:a.url===o,isFailed:ct(r.stabilityKey,a),failedUntil:s?.activeUrl===a.url?s?.failedUntil:void 0}))}}function Ls(e,t={}){let r=M(e,t,"display"),n=r.candidates,s=n[0]?.url||e,o=Math.max(0,n.findIndex(c=>c.url===s));const i=()=>{const c=M(e,t,"display"),a=c.candidates,l=a[0]?.url||e;return!l||l===s?(r=c,n=a,o=Math.max(0,a.findIndex(h=>h.url===s)),Y(s,"unchanged",!1)):(r=c,n=a,s=l,o=Math.max(0,a.findIndex(h=>h.url===s)),Y(s,"runtime-update",!0))};return{get src(){return s},get stabilityKey(){return r.chain.stabilityKey},handleChangeSrc:()=>i(),handleSuccess:()=>{Is(e,s,t)},handleError:()=>{As(e,s,t);const c=i();if(c.changed&&c.src)return c;const a=n[o+1];return!a||a.url===s?Y(null,"exhausted",!1,!0):(s=a.url,o+=1,Y(s,"candidate-fallback",!0))},subscribeToSrcChange:c=>{const a=()=>{const l=i();l.changed&&c(l)};return ds(r.chain.stabilityKey,a)},getDebugSnapshot:()=>Ns(e,t)}}async function qs(e,t={}){if(lt(e,t.config,t.standalone))return fetch(e,t.init);const r=t.config,{chain:n,candidates:s}=M(e,t,t.intent||"downloadBlob");let o;for(const i of s)try{const c=await fetch(i.url,t.init);if(!c.ok)throw new Error(`Proxy fetch failed with status ${c.status}`);if(t.validateBlob){const a=await c.clone().blob();if(!await t.validateBlob(a))throw new Error("Proxy validation failed")}return i.source==="resource"&&ut(n.stabilityKey,i),c}catch(c){o=c,i.source==="resource"&&dt(n.stabilityKey,i,r,t.standalone)}throw n.directShortCircuit&&s.length===1&&s[0]?.source==="direct"&&Ds(o)?Ss(n.directShortCircuit.skipReason,n.directShortCircuit.matchedHost):o instanceof Error?o:new Error("Failed to fetch resource through proxy chain")}function pt(e,t={}){return ys(e,t.config)?[e]:Ts(e,t).map(r=>r.url)}function Us(e,t){const r=_e(),n=t.filter(Boolean).map(s=>String(s).replace(/^\/+|\/+$/g,""));return r?`${I(r)}/${n.join("/")}`:n.join("/")}function xs(e,t){const r=_e();return!!r&&e.startsWith(I(r))}function D(e){for(;e.endsWith("/");)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}function ks(...e){const t=e.filter(o=>o!=null);if(t.length===0)return;if(t.length===1)return t[0];const r=t.find(o=>o.aborted);if(r)return r;if(typeof AbortSignal<"u"&&typeof AbortSignal.any=="function")return AbortSignal.any(t);const n=new AbortController,s=o=>{n.signal.aborted||n.abort(o.reason)};for(const o of t)o.addEventListener("abort",()=>s(o),{once:!0});return n.signal}var ft=3e5,_t=15e3,g=null,mt=!1;function $s(){return!0}function Ms(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_TTL_MS||"").trim();if(!e)return ft;const t=Number(e);return Number.isFinite(t)&&t>0?t:ft}function yt(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_ATTEMPT_TIMEOUT_MS||"").trim();if(!e)return _t;const t=Number(e);return Number.isFinite(t)&&t>0?t:_t}function Fs(){const e="https://app.useblocks.io/api".trim();return e?D(e):void 0}function Bs(e){const t=e.trim();if(!t)return[];if(t.startsWith("["))try{const r=JSON.parse(t);if(!Array.isArray(r))throw new Error("expected JSON array");return r.map(n=>String(n).trim()).filter(Boolean)}catch{return mt||(mt=!0),[]}return t.split(",").map(r=>r.trim()).filter(Boolean)}function Gs(e){const t=new Set,r=[];for(const n of e){const s=D(n);t.has(s)||(t.add(s),r.push(s))}return r}function Et(e){const t=String(e||"").trim();return t?D(t):Fs()}function gt(e,t=[]){return e?Gs([e,...t]).slice(0,3):[]}function bt(){return Bs(String({}.REACT_APP_OPENAPI_FAILOVER_BASE_URLS||"").trim())}function Hs(e=Date.now()){return g?e-g.switchedAt>=Ms():!0}function vt(e=Date.now()){g&&Hs(e)&&(g=null)}function X(e){if(!$s())return!1;const t=Et(e);if(!t)return!1;const r=bt();return r.length===0?!1:gt(t,r).length>1}function F(e){const t=Et(e);if(!t)return[];const r=bt();return r.length===0?[t]:gt(t,r)}function be(e){const t=F(e);if(t.length===0)return"";if(vt(),g){const r=t.indexOf(g.activeUrl);if(r>=0)return t[r]}return t[0]}function Ot(e){const t=F(e);if(t.length<=1||(vt(),!g||!t.includes(g.activeUrl)))return t;const r=g.activeUrl;return[r,...t.filter(n=>n!==r)]}function Ws(){return yt()}function Vs(e){return be(e)||void 0}function Tt(e){const t=e||void 0;if(typeof AbortController>"u")return{signal:t,timeoutError:()=>{},done:()=>{}};const r=yt(),n=new AbortController;let s;const o=setTimeout(()=>{s=Ks(r),n.abort(s)},r);return{signal:ks(t,n.signal),timeoutError:()=>s,done:()=>clearTimeout(o)}}function Ks(e){const t=`[apiOriginFailover] origin attempt timed out after ${e}ms`;if(typeof DOMException=="function")return new DOMException(t,"TimeoutError");const r=new Error(t);return r.name="TimeoutError",r}function It(e){return e===502||e===503||e===504}function At(e){return!(e instanceof Error)&&!(e instanceof DOMException)?!1:e.name==="TimeoutError"?!0:e instanceof TypeError}var Ys;function ve(e,t){if(!X(t))return;const r=F(t);if(r.length<=1)return;const n=r.indexOf(D(e));if(n<0)return;const s=n+1;if(s>=r.length)return;const o=r[s],i=g?.activeUrl;g={activeUrl:o,switchedAt:Date.now()},i!==o&&Ys?.()}function Pt(e,t){if(!X(t))return;const r=D(e),n=F(t);if(n.includes(r)){if(r===n[0]){g=null;return}g?.activeUrl!==r&&(g={activeUrl:r,switchedAt:Date.now()})}}function St(){g=null}var Xs=e=>{const t=new FormData,r=(n,s,o)=>{if(s!=null){if(s instanceof Blob){n.append(o,s);return}if(Array.isArray(s)){s.forEach((i,c)=>{const a=o?`${o}[${c}]`:`${c}`;r(n,i,a)});return}if(typeof s=="object"){Object.keys(s).forEach(i=>{const c=s[i],a=o?`${o}[${i}]`:i;r(n,c,a)});return}n.append(o,String(s))}};return r(t,e),t},Js={baseUrl:D("https://app.useblocks.io/api"),baseApiParams:{secure:!0,credentials:"same-origin",format:"json"},securityWorker:()=>({credentials:"same-origin"})},C=new Map;function zs(e){const t=e?.getInstance(Ce);return t?t.get()??t.bootstrap():void 0}var Qs=class extends Wr{container;constructor(e={},t){super(e),this.container=t}buildRequestUrl(e){const{path:t,baseUrl:r,extraQuery:n}=e;let{query:s}=e;n&&(s=s?{...s,...n}:n);const o=s&&this.toQueryString(s);return`${r||this.baseUrl||""}${t}${o?`?${o}`:""}`}buildRequestKey(e,t){return`${t.toUpperCase()} ${e}`}getBackendProxyCandidates(e,t){const r=zs(this.container),n=this.container?.getInstance(Re)!==void 0,s=pt(e,{config:r,method:t,standalone:n}),o=s.length>0?s:[e],i=this.buildRequestKey(e,t),c=C.get(i);return!c||!o.includes(c)?o:[c,...o.filter(a=>a!==c)]}shouldRetryResponse(e){return e.status===502||e.status===503||e.status===504}resolveFailoverBaseUrl(){return String(this.baseUrl||"").trim()||void 0}async requestOnOrigin(e,t,r=!1){const n={...e,baseUrl:t},s=this.buildRequestUrl(n),o=n.method||"GET",i=this.buildRequestKey(s,o),c=this.getBackendProxyCandidates(s,o);let a,l;for(const h of c){const f=m=>m===s?h:m,y=r?Tt(e.signal):void 0;try{const m=await super.request({...n,proxyHandler:f,...y?{signal:y.signal}:{}});if(!m.ok&&this.shouldRetryResponse(m)&&h!==c[c.length-1]){l=m,C.get(i)===h&&C.delete(i);continue}return C.set(i,h),m}catch(m){C.get(i)===h&&C.delete(i);const b=y?.timeoutError();if(b)throw b;if(a=m,(m instanceof DOMException||m instanceof Error)&&m.name==="AbortError")throw m}finally{y?.done()}}if(l)return l;throw a instanceof Error?a:new Error("Backend proxy chain failed")}async request(e){const t=String(e.baseUrl||"").trim();if(t)return this.requestOnOrigin(e,t);const r=this.resolveFailoverBaseUrl(),n=X(r),s=e.failoverAttemptTimeout??n,o=n?Ot(r):r?[be(r)]:[this.baseUrl].filter(Boolean);if(o.length===0)return this.requestOnOrigin(e,this.baseUrl);let i,c;for(let a=0;a<o.length;a++){const l=o[a],h=a===o.length-1;try{const f=await this.requestOnOrigin(e,l,s);if(!f.ok&&It(f.status)){if(c=f,!h){ve(l,r);continue}break}return f.ok&&Pt(l,r),f}catch(f){if(!At(f))throw f;i=f,h||ve(l,r)}}if(n&&St(),c)return c;throw i instanceof Error?i:new Error("API origin failover chain failed")}};function Dt(e){for(const[t,r]of Object.entries(gn)){const n=r.map(o=>new o(e)),s=Object.assign({},...n);Object.assign(e,{[t]:s})}}function Zs(e=Js){const t=new Map;return{create(r,n){const s=new Qs({...e,...r},n);return s.contentFormatters["multipart/form-data"]=Xs,Dt(s),t.set(s,{options:r,container:n}),s},getOptions(){return e},setOptions(r){e=r;for(const[n,s]of t)Object.assign(n,{...e,...s.options})}}}var wt=_("rest.clientFactory");function eo(e){return e.getOrCreateInstance(wt,()=>Zs())}function to(e,t={}){const r=ce(e)?ke(e):e;return eo(r).create(t,r)}var ro=e=>{const t=e.getInstance(le);if(!t){no(e);return}Dt(t),e.inject(ue,t)},no=e=>{In(e);const t=to(e,{customFetch:e.getInstance(de)?.execute||fetch});e.inject(ue,t),e.inject(le,t)},Oe;(function(e){const t="https://racs.rest/v3";function r(s,o){const i={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)};return fetch(`${t}?resource=${s}&dataset=${document.location.hostname}`,i)}e.post=r;async function n(s,o=0){const i={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:`{"filter":{},"limit":${o}}`};return await(await fetch(`${t}/get?resource=${s}&dataset=${document.location.hostname}`,i)).json()}e.getAll=n})(Oe||(Oe={}));function so(e){const t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),r=atob(t),n=new Uint8Array(r.length);for(let s=0;s<r.length;s++)n[s]=r.charCodeAt(s);return new TextDecoder().decode(n)}function Ct(e){const[t,r,n]=e.split("."),s=JSON.parse(so(r));return{exp:s.exp,createdAt:s.iat,data:s}}var J=_("plugin.auth.token"),jt=new WeakMap,oo=3e4;function io(e){let t;try{t=Ct(e).exp}catch{return!0}return typeof t!="number"||!Number.isFinite(t)?!0:t*1e3<=Date.now()+oo}function Rt(e,t,r,n){const s=jt.get(e);s&&(s.stale=!0);const o={stale:!1};jt.set(e,o),e.injectFactory(J,async(i,c)=>{if(o.stale)return"";try{let a=await c||void 0;if(!a){const l=e.getInstance(je);l&&(a=await l)}return t?!a||io(a)?await t(r,n,a):a:""}catch{return""}},!0)}var Nt=_("auth.oauthProvided"),Lt=new WeakMap;function qt(e,t){const r=Lt.get(e)??{applied:!1};(!r.applied||r.getAuthToken!==t.getAuthToken||!H(r.user,t.user)||r.project!==t.project)&&(Lt.set(e,{applied:!0,getAuthToken:t.getAuthToken,user:t.user,project:t.project}),Rt(e,t.getAuthToken,t.user,t.project))}function ao(e){if(e.getInstance(Nt))return;e.inject(Nt,!0);let t;e.getInstance(we)?.watch(r=>{t=r}),e.addService(Ye,{execute:async(r,n)=>{if(n?.public||!t?.getAuthToken)return;e.getInstance(J)===void 0&&qt(e,t);const s=await e.getInstanceAsync(J);s&&r.headers.set("authorization",`Bearer ${s}`)}})}var yo=Ie(e=>(ao(e),{setOptions(t){qt(e,t)}}));Object.defineProperty(u,"ADVANCED_SETTINGS_PANEL",{enumerable:!0,get:function(){return Cr}}),Object.defineProperty(u,"AIREST_CLIENT_ID",{enumerable:!0,get:function(){return qr}}),Object.defineProperty(u,"APP_ID",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(u,"ATOMS_HANDLERS_ID",{enumerable:!0,get:function(){return Pr}}),Object.defineProperty(u,"AsyncEmitter",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(u,"BaseEmitter",{enumerable:!0,get:function(){return N}}),Object.defineProperty(u,"CONFIG_CHANGED_EVENT_ID",{enumerable:!0,get:function(){return pr}}),Object.defineProperty(u,"CONFIG_SOURCE_ID",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(u,"COOKIE_MANAGER_ID",{enumerable:!0,get:function(){return Ur}}),Object.defineProperty(u,"CUSTOM_FETCH_ID",{enumerable:!0,get:function(){return de}}),Object.defineProperty(u,"Container",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(u,"ContentType",{enumerable:!0,get:function(){return d}}),Object.defineProperty(u,"DISPOSABLE_ID",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(u,"DependencyResolver",{enumerable:!0,get:function(){return re}}),Object.defineProperty(u,"Disposable",{enumerable:!0,get:function(){return v}}),Object.defineProperty(u,"ELEMENT_MAP",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(u,"Emitter",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(u,"HANDLE_ATOM_INSERT_ID",{enumerable:!0,get:function(){return Sr}}),Object.defineProperty(u,"IMAGE_BLOB_RESOLVER_ID",{enumerable:!0,get:function(){return kr}}),Object.defineProperty(u,"INIT_PIPELINE_ID",{enumerable:!0,get:function(){return or}}),Object.defineProperty(u,"INJECTION",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(u,"INSTANCE_ID",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(u,"JWT_ERROR_ID",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(u,"JWT_TOKEN_ID",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(u,"MESSAGE_SERVICE_ID",{enumerable:!0,get:function(){return Dr}}),Object.defineProperty(u,"MODAL_CLOSE_EVENT",{enumerable:!0,get:function(){return Rr}}),Object.defineProperty(u,"MODAL_SHOW_EVENT",{enumerable:!0,get:function(){return jr}}),Object.defineProperty(u,"MODAL_UPDATE_EVENT",{enumerable:!0,get:function(){return Nr}}),Object.defineProperty(u,"MessageService",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(u,"NOT_IMPLEMENTED_IN_PLUGIN",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(u,"OPTIONS_SOURCE_ID",{enumerable:!0,get:function(){return we}}),Object.defineProperty(u,"RACS",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(u,"REST_CLIENT_FACTORY_ID",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(u,"REST_CLIENT_ID",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(u,"SECURITY_MODULE_ID",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(u,"SETTINGS_PANEL_EVENT",{enumerable:!0,get:function(){return wr}}),Object.defineProperty(u,"STANDALONE_ACTIVATED_ID",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(u,"STANDALONE_BOOTSTRAP_TOKEN_ID",{enumerable:!0,get:function(){return je}}),Object.defineProperty(u,"STANDALONE_FILE_PROXY_REGISTERED_ID",{enumerable:!0,get:function(){return dr}}),Object.defineProperty(u,"STANDALONE_PROJECT_ID",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(u,"STORAGE_PROVIDER_ID",{enumerable:!0,get:function(){return xr}}),Object.defineProperty(u,"STORE_ID",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(u,"Signal",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(u,"TEMPLATE_DIRECTIVES_ID",{enumerable:!0,get:function(){return $r}}),Object.defineProperty(u,"TOKEN_ID",{enumerable:!0,get:function(){return J}}),Object.defineProperty(u,"V2REST_CLIENT_ID",{enumerable:!0,get:function(){return Lr}}),Object.defineProperty(u,"WpEblockApi",{enumerable:!0,get:function(){return We}}),Object.defineProperty(u,"WpEmailApi",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(u,"abandonStickyOrigin",{enumerable:!0,get:function(){return St}}),Object.defineProperty(u,"beginFailoverAttempt",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(u,"buildCdnFileUrl",{enumerable:!0,get:function(){return Us}}),Object.defineProperty(u,"combineMixins",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(u,"createAbortError",{enumerable:!0,get:function(){return w}}),Object.defineProperty(u,"createIdentifier",{enumerable:!0,get:function(){return br}}),Object.defineProperty(u,"createIdentifier$1",{enumerable:!0,get:function(){return _}}),Object.defineProperty(u,"decodeJwt",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(u,"deepClone",{enumerable:!0,get:function(){return He}}),Object.defineProperty(u,"deepEqual",{enumerable:!0,get:function(){return H}}),Object.defineProperty(u,"defineMixin",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(u,"events",{enumerable:!0,get:function(){return se}}),Object.defineProperty(u,"fetchWithResourceProxy",{enumerable:!0,get:function(){return qs}}),Object.defineProperty(u,"filter",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(u,"generateUUID",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(u,"getActiveBaseUrl",{enumerable:!0,get:function(){return be}}),Object.defineProperty(u,"getApi",{enumerable:!0,get:function(){return An}}),Object.defineProperty(u,"getContainer",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(u,"getEmitter",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(u,"getEvent",{enumerable:!0,get:function(){return er}}),Object.defineProperty(u,"getFailoverAttemptTimeoutMs",{enumerable:!0,get:function(){return Ws}}),Object.defineProperty(u,"getNetworkActivity",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(u,"getOrderedOriginCandidates",{enumerable:!0,get:function(){return Ot}}),Object.defineProperty(u,"getOriginChain",{enumerable:!0,get:function(){return F}}),Object.defineProperty(u,"getProxiedUrl",{enumerable:!0,get:function(){return Ls}}),Object.defineProperty(u,"getServiceContainerId",{enumerable:!0,get:function(){return B}}),Object.defineProperty(u,"isCdnUrl",{enumerable:!0,get:function(){return xs}}),Object.defineProperty(u,"isFailoverEnabled",{enumerable:!0,get:function(){return X}}),Object.defineProperty(u,"isStateContainer",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(u,"normalizeBaseUrl",{enumerable:!0,get:function(){return D}}),Object.defineProperty(u,"pickKey",{enumerable:!0,get:function(){return Mr}}),Object.defineProperty(u,"provideLegacyRestSections",{enumerable:!0,get:function(){return ro}}),Object.defineProperty(u,"raceWithAbortSignal",{enumerable:!0,get:function(){return fr}}),Object.defineProperty(u,"recreateTokenProvider",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(u,"reportOriginFailure",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(u,"reportOriginSuccess",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(u,"resolveBackendProxyRequestCandidates",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(u,"resolveContainer",{enumerable:!0,get:function(){return Ht}}),Object.defineProperty(u,"resolveExplicitApiBaseUrl",{enumerable:!0,get:function(){return Vs}}),Object.defineProperty(u,"shouldFailoverError",{enumerable:!0,get:function(){return At}}),Object.defineProperty(u,"shouldFailoverResponse",{enumerable:!0,get:function(){return It}}),Object.defineProperty(u,"snapshot",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(u,"throwIfAborted",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(u,"unwrapResourceProxyUrl",{enumerable:!0,get:function(){return $}}),Object.defineProperty(u,"waitForElement",{enumerable:!0,get:function(){return Le}})});
|
|
4
4
|
|
|
5
5
|
(function(){try{if(typeof document<"u"){var t='.blocks-app .ant-modal.premium-features-modal .ant-modal-container{border-radius:calc(var(--ub-borderRadiusXL) * 2px);padding:20px 19px}.blocks-app .premium-features-modal .modal-title{text-align:center;margin-bottom:0;font-size:32px}.blocks-app .premium-features-modal .ant-carousel .slick-dots li button{opacity:.5;background:#fff}.blocks-app .premium-features-modal .ant-carousel .slick-dots li.slick-active button{opacity:1}.blocks-app .premium-features-modal .modal-subtitle{text-align:center;margin-bottom:20px;font-size:18px}.blocks-app .premium-features-modal .carousel-slider{margin-bottom:20px}.blocks-app .premium-features-modal .slick-list{border-radius:calc(var(--ub-borderRadiusXL) * 1.5px)}.blocks-app .premium-features-modal .slick-slide{padding:0 5px}.blocks-app .premium-features-modal .carousel-slide{border-radius:calc(var(--ub-borderRadiusXL) * 1.5px);justify-content:flex-end;align-items:center;height:480px;display:flex}.blocks-app .premium-features-modal .slide-item-image{width:50%;padding:24px 0 24px 32px}.blocks-app .premium-features-modal .slide-item-image img{border-radius:calc(var(--ub-borderRadiusXL) * 1.3px);width:100%}.blocks-app .premium-features-modal .slide-item-content{width:50%;padding:48px}.blocks-app .premium-features-modal .slide-title{margin-bottom:48px;font-size:50px;font-weight:700;line-height:1}.blocks-app .premium-features-modal .slide-description{font-size:22px}.blocks-app .premium-features-modal .modal-buttons{justify-content:center;gap:10px;display:flex}.blocks-app .premium-features-modal .modal-buttons button{padding:0 30px}.blocks-app .trial-suggest-modal{max-width:calc(100vw - 24px)}.blocks-app .trial-suggest-modal .ant-modal-container{border-radius:16px;padding:0;overflow:hidden}.blocks-app .trial-suggest-modal__layout{align-items:stretch;display:flex}.blocks-app .trial-suggest-modal__gallery{background:var(--ub-colorFillQuaternary);flex:0 0 300px;width:300px;max-width:300px;position:relative;overflow:hidden}.blocks-app .trial-suggest-modal__slide-image{border-right:1px solid var(--ub-colorFillSecondary);background-repeat:no-repeat;background-size:cover;transition:opacity .4s;position:absolute;inset:0}.blocks-app .trial-suggest-modal__content{flex:auto;min-width:0;max-width:100%;padding:32px}.blocks-app .trial-suggest-modal__badge{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary);border-radius:12px;margin-bottom:12px;padding:2px 10px;font-size:12px;font-weight:600;line-height:20px;display:inline-block}.blocks-app .trial-suggest-modal__title{color:var(--ub-colorText);margin:0 0 8px;font-size:22px;font-weight:600;line-height:1.25}.blocks-app .trial-suggest-modal__intro{color:var(--ub-colorTextSecondary);margin:0 0 16px}.blocks-app .trial-suggest-modal__features{margin:0 0 20px;padding:0;list-style:none}.blocks-app .trial-suggest-modal__features li{color:var(--ub-colorText);align-items:flex-start;gap:10px;margin-bottom:10px;display:flex}.blocks-app .trial-suggest-modal__feature-icon,.blocks-app .trial-suggest-modal__promise-icon{flex:none;width:20px;height:20px;margin-top:2px;font-size:20px;line-height:20px}.blocks-app .trial-suggest-modal__feature-icon svg,.blocks-app .trial-suggest-modal__promise-icon svg{width:100%;height:100%}.blocks-app .trial-suggest-modal__feature-icon{color:var(--ub-colorPrimary)}.blocks-app .trial-suggest-modal__promise{background:var(--ub-colorFillQuaternary);color:var(--ub-colorText);border-radius:8px;align-items:flex-start;gap:10px;margin:0 0 8px;padding:12px;display:flex}.blocks-app .trial-suggest-modal__promise-icon{color:var(--ub-colorSuccess)}.blocks-app .trial-suggest-modal__note{color:var(--ub-colorTextTertiary);margin:0 0 24px;font-size:12px;line-height:140%}.blocks-app .trial-suggest-modal__buttons{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .trial-suggest-modal__decline.ant-btn{box-shadow:none;color:var(--ub-colorTextSecondary);border:1px solid #0000}.blocks-app .trial-suggest-modal__decline.ant-btn:hover,.blocks-app .trial-suggest-modal__decline.ant-btn:focus,.blocks-app .trial-suggest-modal__decline.ant-btn:focus-visible,.blocks-app .trial-suggest-modal__decline.ant-btn:active{box-shadow:none;border:1px solid #0000;transform:none}.blocks-app .trial-suggest-modal__decline.ant-btn:hover:not(:disabled){background:var(--ub-colorFillTertiary);color:var(--ub-colorText)}@media (width<=720px){.blocks-app .trial-suggest-modal__layout{flex-direction:column}.blocks-app .trial-suggest-modal__gallery{flex:none;width:auto;max-width:none;height:180px}.blocks-app .trial-suggest-modal__content{padding:24px}}.blocks-app .user-list{z-index:10;background:#fff0;padding:1px;display:flex;position:absolute;bottom:10px;left:10px}.blocks-app .user{text-align:center;align-items:center;width:0;height:35px;margin-left:20px;transition:all .4s cubic-bezier(.645,.045,.355,1);display:flex;position:relative}.blocks-app .user:first-child{margin-left:0}.blocks-app .user-list.open .user:not(:first-child){margin-left:38px}.blocks-app .user:before{content:"";background:var(--ub-user-color,white);border:1.5px solid var(--ub-border-color,white);border-radius:50%;width:34px;height:34px;transition:all .2s cubic-bezier(.645,.045,.355,1);display:block;position:absolute}.blocks-app .user div{width:34px;color:var(--ub-text-color,white);cursor:default;border-radius:50%;font-weight:600;line-height:40px;text-decoration:none;position:absolute}',e=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),a=t;if(!e.sheets[a]){var l=!1;try{if(typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&document.adoptedStyleSheets){var i=new CSSStyleSheet;i.replaceSync(t),document.adoptedStyleSheets=document.adoptedStyleSheets.concat([i]),e.sheets[a]=i,e.order.push(a),l=!0}}catch{l=!1}if(!l){var o=document.createElement("style");o.setAttribute("data-useblocks","true"),o.appendChild(document.createTextNode(t)),document.head.appendChild(o),e.sheets[a]=o,e.order.push(a)}}}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
6
|
-
__useblocks__.define("static/core/6c10ee28.js",["require","exports","module","static/core/2ff39ddf.js","static/core/fe480726.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper"],function(fe,p,H0){const Z=fe("./2ff39ddf.js"),M=fe("./fe480726.js");let N=fe("react"),V=Z.__toESM(N,1);N=Z.__toESM(N);let G=fe("react/jsx-runtime"),_e=fe("__delivery__/libs"),Ze=fe("react-dom");Ze=Z.__toESM(Ze);let et=fe("vite/preload-helper");var xa=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 Ha(e,t){return t+e}function Cp(){return typeof performance>"u"?Date.now():Ha(performance.now(),performance.timeOrigin)}var Ap="emailmaker:diagnostics",Ip="diagnostics",yi;function wp(){try{const e=new URLSearchParams(window.location.search).get(Ip);return e===null?void 0:e!=="0"}catch{return}}function Mp(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function Rp(){try{const e=window.localStorage.getItem(Ap);return e===null?void 0:e==="1"}catch{return}}function Va(){return yi===void 0&&(yi=typeof window>"u"?!1:wp()??Mp()??Rp()??!1),yi}function za(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var St={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"},Dp="app:mount:headless";function Qa(e){return e.some(t=>t.phase==="app:mount:headless")?"headless":"element"}var Wa=Object.values(St),Np=[St.canvasPainted,St.canvasSettled,St.appVisible,St.editorVisible];function Ka(e){return e==="headless"?Wa.filter(t=>!Np.includes(t)):Wa}function jp(e){const t=new Set(e.map(r=>r.phase));return Ka(Qa(e)).filter(r=>!t.has(r))}var Lp=5e3,kp=3e3,Ya="diagnosticsStore",xr,xt;function Xa(){return{marks:new xa(Lp),resources:new xa(kp)}}function Pt(){if(xt)return xt;const e=vi();return e?(xt=e[Ya]??xr??Xa(),e[Ya]=xt,xr=void 0,xt):(xr??=Xa(),xr)}function De(e,t){Va()&&Pt().marks.push({phase:e,at:Cp(),...t})}function Fp(){return Ja(),Pt().marks.snapshot()}function Up(){return Pt().resources.snapshot()}function Bp(){const e=Pt();e.marks.clear(),e.resources.clear()}function vi(){if(typeof window.__useblocks__<"u"&&window.__useblocks__)return window.__useblocks__;if(typeof window>"u")return;const e=window[za()];return e!==null&&typeof e=="object"?e:void 0}function $p(e){const t=e.length,r=Pt();return e.forEach(n=>r.marks.push(n)),e.length=0,t}function Ja(){const e=vi();return!e||!Array.isArray(e.diagnosticsBuffer)?0:$p(e.diagnosticsBuffer)}var V0="[show-pipeline]";function Gp(e,t){}var ue=(function(e){return e[e.HTML=0]="HTML",e[e.ELEMENT=1]="ELEMENT",e[e.ROOT=2]="ROOT",e[e.COMMENT=3]="COMMENT",e[e.DOCTYPE=4]="DOCTYPE",e[e.ADVANCED=5]="ADVANCED",e})({}),Hr=e=>e.type===0?e.start-1:e.start,qp=e=>e.type===0?e.end+1:e.end,tt=class Tp{start;end;children;parent;content;type=1;tag;closed=!1;startTagEnd;endTagStart;attributes;get attributeNames(){return this.attributes?Object.keys(this.attributes):[]}createdBy;isDirty;get root(){return this.parent?this.parent.root:this}constructor(t,r,n,i){this.start=t,this.end=r,this.children=n,this.parent=i}isSameTag(t){return this.tag===void 0?t===void 0:t!==void 0&&this.tag.length===t.length&&this.tag.toLowerCase()===t}get firstChild(){return this.children[0]}get lastChild(){return this.children.length?this.children[this.children.length-1]:void 0}findNodeBefore(t){const r=es(this.children,n=>t<=Hr(n))-1;if(r>=0){const n=this.children[r];if(t>Hr(n)){if(t<n.end)return n.findNodeBefore(t);const i=n.lastChild;return i&&i.end===n.end?n.findNodeBefore(t):n}}return this}findNodeAt(t){const r=es(this.children,n=>t<=Hr(n))-1;if(r>=0){const n=this.children[r];if(t>=Hr(n)&&t<=qp(n))return n.findNodeAt(t)}return this}find(t){if(t(this))return this;for(const r of this.children){const n=r.find(t);if(n)return n}}closest(t){let r=this;do if(t(r))return r;while(r=r.parent)}parents(){return this.parent?[this.parent,...this.parent.parents()]:[]}closestFromRoot(t,r=!0){const n=r?[this,...this.parents()]:this.parents();for(let i=n.length-1;i>=0;i--){const o=n[i];if(t(o))return o}}contains(t){return!!t.closest(r=>r===this)}clone(t=this.parent,r=this.start,n=!0){const i=this.start-r,o=new Tp(r,this.end-i,[],t);return o.children=n?this.children.map(a=>a.clone(o,a.start-i)):[],o.attributes={...this.attributes},o.closed=this.closed,o.content=this.content,o.startTagEnd=this.startTagEnd,o.endTagStart=this.endTagStart,o.tag=this.tag,o.type=this.type,o}},xp=new Set(["area","br","col","embed","hr","img","input","link","meta","param","vk-snippet-end"]);function Hp(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,r)=>r.toUpperCase())}var Za=Object.create(null);function Vp(e,t){const r=Za[e]||(Za[e]=Object.create(null));let n=r[t];if(typeof n!="boolean"){const i=document.createElement(e)[Hp(t)];n=r[t]=typeof i<"u"&&typeof i!="boolean"}return n}function zp(e){const t=e.tag?.toLowerCase();let r="";if(t){const n=e.attributes;if(n){const i=Object.keys(n);for(const o of i){const a=n[o]===null?"":n[o];typeof a=="string"&&(r+=a===""&&o!=="em"&&!Vp(t,o)?` ${o}`:` ${o}="${a.replaceAll('"',"'")}"`)}}}return r}function Qp(e,t){if(e.start!==e.startTagEnd||t){const r=e.tag?.toLowerCase()||"div",n=zp(e);return r==="vk-snippet-end"?`<${r}${n}/>`:`<${r}${n}>`}return""}function es(e,t){let r=0,n=e.length;if(n===0)return 0;for(;r<n;){const i=Math.floor((r+n)/2);t(e[i])?n=i:r=i+1}return r}function Wp(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,r)=>r.toUpperCase())}function ts(e){return"<!DOCTYPE "+e.name+(e.publicId?' PUBLIC "'+e.publicId+'"':"")+(!e.publicId&&e.systemId?" SYSTEM":"")+(e.systemId?' "'+e.systemId+'"':"")+">"}var rs=Object.create(null);function Kp(e,t){const r=rs[e]||(rs[e]=Object.create(null));let n=r[t];if(typeof n!="boolean"){const i=document.createElement(e)[Wp(t)];n=r[t]=typeof i<"u"&&typeof i!="boolean"}return n}function Vr(e){return e.nodeType===Node.ELEMENT_NODE}function Yp(e){return Vr(e)&&!e.ownerSVGElement}function Xp(e){return e.tagName==="IMG"}function Jp(e){return e.tagName==="AMP-IMG"}function Zp(e){return e.tagName==="BODY"}function em(e){return e.tagName==="FORM"}function tm(e){return e.tagName==="HTML"}function rm(e){return e.tagName==="SCRIPT"}function ns(e){return e.tagName==="STYLE"}function is(e){return e.nodeType===Node.DOCUMENT_NODE}function nm(e){return e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function im(e){return e.nodeType===Node.DOCUMENT_TYPE_NODE}var _i;(function(e){function t(y){return y.constructor.name==="CSSStyleRule"}e.isStyleRule=t;function r(y){return y.constructor.name==="CSSImportRule"}e.isImportRule=r;function n(y){return y.constructor.name==="CSSMediaRule"}e.isMediaRule=n;function i(y){return y.constructor.name==="CSSFontFaceRule"}e.isFontFaceRule=i;function o(y){return y.constructor.name==="CSSPageRule"}e.isPageRule=o;function a(y){return y.constructor.name==="CSSKeyframesRule"}e.isKeyframesRule=a;function s(y){return y.constructor.name==="CSSKeyframeRule"}e.isKeyframeRuleRule=s;function c(y){return y.constructor.name==="CSSNamespaceRule"}e.isNamespaceRule=c;function u(y){return y.constructor.name==="CSSCounterStyleRule"}e.isCounterStyleRule=u;function h(y){return y.constructor.name==="CSSSupportsRule"}e.isSupportsRule=h;function f(y){return y.constructor.name==="CSSFontFeatureValuesRule"}e.isFontFeatureValuesRuleRule=f})(_i||(_i={}));function Ei(e){return e.nodeType===Node.COMMENT_NODE}function om(e){return e&&!!e.host&&!!e.mode}function Si(e){const t=e.getRootNode()||window.document;return om(t)?t:null}var am=/(<!(--)?\[if\s[()\w\s|&!]+\]>(?:<!--+>)?)((?:.|\r|\n)*?)((?:<!--)?<!\[endif\]\2>)/gi;function sm(e){const t=Ht(e).matchAll(am);if(t)for(const r of t){const[,n,,i,o]=r;return{open:n,close:o,content:i}}}function Pi(e){return e.nodeType===Node.TEXT_NODE}function um(e){return e.tagName==="TABLE"}async function cm(e,t=5e3){return typeof e.complete<"u"&&!e.complete?new Promise((r,n)=>{setTimeout(r,t),e.onload=()=>r(getComputedStyle(e)),e.onerror=i=>{}}):getComputedStyle(e)}function Ht(e){if(Vr(e))return dm(e);if(is(e))return[...e.childNodes].map(r=>Ht(r)).join("");if(im(e))return ts(e);const t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}function lm(e){const t=e.tagName.toLowerCase();let r="";for(const n of e.attributes){const i=n.name,o=n.value;r+=o===""&&i!=="em"&&!Kp(t,i)?` ${i}`:` ${i}="${o.replaceAll('"',"'")}"`}return r}function os(e){let t="";for(const r of e.childNodes)t+=Ht(r);return t}function dm(e){const t=Object.getOwnPropertyDescriptor(e,"$$tagName")?.value||e.tagName.toLowerCase(),r=lm(e);return xp.has(t.toLowerCase())?t==="vk-snippet-end"?`<${t}${r}/>`:`<${t}${r}>`:ns(e)?`<${t}${r}>${e.innerHTML}</${t}>`:`<${t}${r}>${os(e)}</${t}>`}function as(e,t){for(const o of[...e.childNodes])o.remove();let r=t.find(o=>tm(o)),n=t.find(o=>Zp(o)),i=e;r||(r=document.createElement("html"),e.appendChild(r),i=r,n||(n=document.createElement("body"),r.appendChild(n),i=n));for(const o of t){if(i===e){if(Pi(o)){i.appendChild(document.createComment(`%%%{{{${o.data}}}}%%%`));continue}if(Vr(o)&&o!==r){(r.querySelector("body")??r).appendChild(o);continue}}i.appendChild(o)}}function Oi(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){const o=e,a=t;return o.length===a.length&&o.every((s,c)=>Oi(s,a[c]))}const n=Object.keys(e),i=Object.keys(t);return n.length!==i.length?!1:n.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Oi(e[o],t[o]))}function ss(e,t){const r={watch(n){let i,o=!1;return e.watch(a=>{const s=t(a);o&&Oi(i,s)||(i=s,o=!0,n(s))})},select(n){return ss(r,n)}};return r}function Le(...e){let t=e[0],r=e.length>0;const n=new Set,i={get(){return r?t:void 0},set(o){t=o,r=!0;for(const a of Array.from(n))a(o)},watch(o){return n.add(o),r&&o(t),{dispose:()=>n.delete(o)}},select(o){return ss(i,o)}};return i}var us=M.createIdentifier$1("HeadlessMode");function Ti(e){return e.getOrCreateInstance(us,()=>Le(!1))}function fm(e){return e?.getInstance(us)?.get()??!1}function pm(e,t){Ti(e).set(t)}var mm=M.createIdentifier$1("HiddenMount");function hm(e){return e.getOrCreateInstance(mm,()=>Le(!1))}function gm(e,t){hm(e).set(t)}var bm=Z.__commonJSMin(((e,t)=>{var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";t.exports=r})),ym=Z.__commonJSMin(((e,t)=>{var r=bm();function n(){}function i(){}i.resetWarningCache=n,t.exports=function(){function o(c,u,h,f,y,E){if(E!==r){var S=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw S.name="Invariant Violation",S}}o.isRequired=o;function a(){return o}var s={array:o,bigint:o,bool:o,func:o,number:o,object:o,string:o,symbol:o,any:o,arrayOf:a,element:o,elementType:o,instanceOf:a,node:o,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:i,resetWarningCache:n};return s.PropTypes=s,s}})),vm=Z.__commonJSMin(((e,t)=>{t.exports=ym()()})),rt=N.default.createContext(null);function _m(e){e()}var cs=_m,Em=function(t){return cs=t},Sm=function(){return cs},ls={notify:function(){}};function Pm(){var e=Sm(),t=null,r=null;return{clear:function(){t=null,r=null},notify:function(){e(function(){for(var i=t;i;)i.callback(),i=i.next})},get:function(){for(var i=[],o=t;o;)i.push(o),o=o.next;return i},subscribe:function(i){var o=!0,a=r={callback:i,next:null,prev:r};return a.prev?a.prev.next=a:t=a,function(){!o||t===null||(o=!1,a.next?a.next.prev=a.prev:r=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}var ds=(function(){function e(r,n){this.store=r,this.parentSub=n,this.unsubscribe=null,this.listeners=ls,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(n){return this.trySubscribe(),this.listeners.subscribe(n)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return!!this.unsubscribe},t.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=Pm())},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=ls)},e})(),Ci=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?N.useLayoutEffect:N.useEffect;function Om(e){var t=e.store,r=e.context,n=e.children,i=(0,N.useMemo)(function(){var s=new ds(t);return s.onStateChange=s.notifyNestedSubs,{store:t,subscription:s}},[t]),o=(0,N.useMemo)(function(){return t.getState()},[t]);Ci(function(){var s=i.subscription;return s.trySubscribe(),o!==t.getState()&&s.notifyNestedSubs(),function(){s.tryUnsubscribe(),s.onStateChange=null}},[i,o]);var a=r||rt;return N.default.createElement(a.Provider,{value:i},n)}function Ai(){return Ai=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ai.apply(null,arguments)}function fs(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Tm=Z.__commonJSMin((e=>{var t=typeof Symbol=="function"&&Symbol.for,r=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,i=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,a=t?Symbol.for("react.profiler"):60114,s=t?Symbol.for("react.provider"):60109,c=t?Symbol.for("react.context"):60110,u=t?Symbol.for("react.async_mode"):60111,h=t?Symbol.for("react.concurrent_mode"):60111,f=t?Symbol.for("react.forward_ref"):60112,y=t?Symbol.for("react.suspense"):60113,E=t?Symbol.for("react.suspense_list"):60120,S=t?Symbol.for("react.memo"):60115,v=t?Symbol.for("react.lazy"):60116,C=t?Symbol.for("react.block"):60121,A=t?Symbol.for("react.fundamental"):60117,I=t?Symbol.for("react.responder"):60118,T=t?Symbol.for("react.scope"):60119;function g(l){if(typeof l=="object"&&l!==null){var b=l.$$typeof;switch(b){case r:switch(l=l.type,l){case u:case h:case i:case a:case o:case y:return l;default:switch(l=l&&l.$$typeof,l){case c:case f:case v:case S:case s:return l;default:return b}}case n:return b}}}function m(l){return g(l)===h}e.AsyncMode=u,e.ConcurrentMode=h,e.ContextConsumer=c,e.ContextProvider=s,e.Element=r,e.ForwardRef=f,e.Fragment=i,e.Lazy=v,e.Memo=S,e.Portal=n,e.Profiler=a,e.StrictMode=o,e.Suspense=y,e.isAsyncMode=function(l){return m(l)||g(l)===u},e.isConcurrentMode=m,e.isContextConsumer=function(l){return g(l)===c},e.isContextProvider=function(l){return g(l)===s},e.isElement=function(l){return typeof l=="object"&&l!==null&&l.$$typeof===r},e.isForwardRef=function(l){return g(l)===f},e.isFragment=function(l){return g(l)===i},e.isLazy=function(l){return g(l)===v},e.isMemo=function(l){return g(l)===S},e.isPortal=function(l){return g(l)===n},e.isProfiler=function(l){return g(l)===a},e.isStrictMode=function(l){return g(l)===o},e.isSuspense=function(l){return g(l)===y},e.isValidElementType=function(l){return typeof l=="string"||typeof l=="function"||l===i||l===h||l===a||l===o||l===y||l===E||typeof l=="object"&&l!==null&&(l.$$typeof===v||l.$$typeof===S||l.$$typeof===s||l.$$typeof===c||l.$$typeof===f||l.$$typeof===A||l.$$typeof===I||l.$$typeof===T||l.$$typeof===C)},e.typeOf=g})),Cm=Z.__commonJSMin(((e,t)=>{t.exports=Tm()})),Am=Z.__commonJSMin(((e,t)=>{var r=Cm(),n={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},o={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};s[r.ForwardRef]=o,s[r.Memo]=a;function c(C){return r.isMemo(C)?a:s[C.$$typeof]||n}var u=Object.defineProperty,h=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,y=Object.getOwnPropertyDescriptor,E=Object.getPrototypeOf,S=Object.prototype;function v(C,A,I){if(typeof A!="string"){if(S){var T=E(A);T&&T!==S&&v(C,T,I)}var g=h(A);f&&(g=g.concat(f(A)));for(var m=c(C),l=c(A),b=0;b<g.length;++b){var d=g[b];if(!i[d]&&!(I&&I[d])&&!(l&&l[d])&&!(m&&m[d])){var _=y(A,d);try{u(C,d,_)}catch{}}}}return C}t.exports=v})),Im=Z.__commonJSMin((e=>{var t=typeof Symbol=="function"&&Symbol.for})),wm=Z.__commonJSMin(((e,t)=>{t.exports=Im()})),z0=Z.__toESM(Am()),Q0=wm();function ps(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Vt(e,t){if(ps(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(t,r[i])||!ps(e[r[i]],t[r[i]]))return!1;return!0}function oe(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var ms=typeof Symbol=="function"&&Symbol.observable||"@@observable",Ii=()=>Math.random().toString(36).substring(7).split("").join("."),zr={INIT:`@@redux/INIT${Ii()}`,REPLACE:`@@redux/REPLACE${Ii()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ii()}`};function nt(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function hs(e,t,r){if(typeof e!="function")throw new Error(oe(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(oe(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(oe(1));return r(hs)(e,t)}let n=e,i=t,o=new Map,a=o,s=0,c=!1;function u(){a===o&&(a=new Map,o.forEach((v,C)=>{a.set(C,v)}))}function h(){if(c)throw new Error(oe(3));return i}function f(v){if(typeof v!="function")throw new Error(oe(4));if(c)throw new Error(oe(5));let C=!0;u();const A=s++;return a.set(A,v),function(){if(C){if(c)throw new Error(oe(6));C=!1,u(),a.delete(A),o=null}}}function y(v){if(!nt(v))throw new Error(oe(7));if(typeof v.type>"u")throw new Error(oe(8));if(typeof v.type!="string")throw new Error(oe(17));if(c)throw new Error(oe(9));try{c=!0,i=n(i,v)}finally{c=!1}return(o=a).forEach(C=>{C()}),v}function E(v){if(typeof v!="function")throw new Error(oe(10));n=v,y({type:zr.REPLACE})}function S(){const v=f;return{subscribe(C){if(typeof C!="object"||C===null)throw new Error(oe(11));function A(){const I=C;I.next&&I.next(h())}return A(),{unsubscribe:v(A)}},[ms](){return this}}}return y({type:zr.INIT}),{dispatch:y,subscribe:f,getState:h,replaceReducer:E,[ms]:S}}function Mm(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:zr.INIT})>"u")throw new Error(oe(12));if(typeof r(void 0,{type:zr.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(oe(13))})}function wi(e){const t=Object.keys(e),r={};for(let o=0;o<t.length;o++){const a=t[o];typeof e[a]=="function"&&(r[a]=e[a])}const n=Object.keys(r);let i;try{Mm(r)}catch(o){i=o}return function(a={},s){if(i)throw i;let c=!1;const u={};for(let h=0;h<n.length;h++){const f=n[h],y=r[f],E=a[f],S=y(E,s);if(typeof S>"u")throw s&&s.type,new Error(oe(14));u[f]=S,c=c||S!==E}return c=c||n.length!==Object.keys(a).length,c?u:a}}function Qr(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Rm(...e){return t=>(r,n)=>{const i=t(r,n);let o=()=>{throw new Error(oe(15))};const a={getState:i.getState,dispatch:(s,...c)=>o(s,...c)};return o=Qr(...e.map(s=>s(a)))(i.dispatch),{...i,dispatch:o}}}function gs(e){return nt(e)&&"type"in e&&typeof e.type=="string"}function bs(){return(0,N.useContext)(rt)}function ys(e){e===void 0&&(e=rt);var t=e===rt?bs:function(){return(0,N.useContext)(e)};return function(){return t().store}}var pe=ys();function Dm(e){e===void 0&&(e=rt);var t=e===rt?pe:ys(e);return function(){return t().dispatch}}var qe=Dm(),Nm=function(t,r){return t===r};function jm(e,t,r,n){var i=(0,N.useReducer)(function(E){return E+1},0)[1],o=(0,N.useMemo)(function(){return new ds(r,n)},[r,n]),a=(0,N.useRef)(),s=(0,N.useRef)(),c=(0,N.useRef)(),u=(0,N.useRef)(),h=r.getState(),f;try{if(e!==s.current||h!==c.current||a.current){var y=e(h);u.current===void 0||!t(y,u.current)?f=y:f=u.current}else f=u.current}catch(E){throw a.current&&(E.message+=`
|
|
6
|
+
__useblocks__.define("static/core/c00a8e02.js",["require","exports","module","static/core/2ff39ddf.js","static/core/fe480726.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper"],function(fe,p,H0){const Z=fe("./2ff39ddf.js"),M=fe("./fe480726.js");let N=fe("react"),V=Z.__toESM(N,1);N=Z.__toESM(N);let G=fe("react/jsx-runtime"),_e=fe("__delivery__/libs"),Ze=fe("react-dom");Ze=Z.__toESM(Ze);let et=fe("vite/preload-helper");var xa=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 Ha(e,t){return t+e}function Cp(){return typeof performance>"u"?Date.now():Ha(performance.now(),performance.timeOrigin)}var Ap="emailmaker:diagnostics",Ip="diagnostics",yi;function wp(){try{const e=new URLSearchParams(window.location.search).get(Ip);return e===null?void 0:e!=="0"}catch{return}}function Mp(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function Rp(){try{const e=window.localStorage.getItem(Ap);return e===null?void 0:e==="1"}catch{return}}function Va(){return yi===void 0&&(yi=typeof window>"u"?!1:wp()??Mp()??Rp()??!1),yi}function za(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var St={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"},Dp="app:mount:headless";function Qa(e){return e.some(t=>t.phase==="app:mount:headless")?"headless":"element"}var Wa=Object.values(St),Np=[St.canvasPainted,St.canvasSettled,St.appVisible,St.editorVisible];function Ka(e){return e==="headless"?Wa.filter(t=>!Np.includes(t)):Wa}function jp(e){const t=new Set(e.map(r=>r.phase));return Ka(Qa(e)).filter(r=>!t.has(r))}var Lp=5e3,kp=3e3,Ya="diagnosticsStore",xr,xt;function Xa(){return{marks:new xa(Lp),resources:new xa(kp)}}function Pt(){if(xt)return xt;const e=vi();return e?(xt=e[Ya]??xr??Xa(),e[Ya]=xt,xr=void 0,xt):(xr??=Xa(),xr)}function De(e,t){Va()&&Pt().marks.push({phase:e,at:Cp(),...t})}function Fp(){return Ja(),Pt().marks.snapshot()}function Up(){return Pt().resources.snapshot()}function Bp(){const e=Pt();e.marks.clear(),e.resources.clear()}function vi(){if(typeof window.__useblocks__<"u"&&window.__useblocks__)return window.__useblocks__;if(typeof window>"u")return;const e=window[za()];return e!==null&&typeof e=="object"?e:void 0}function $p(e){const t=e.length,r=Pt();return e.forEach(n=>r.marks.push(n)),e.length=0,t}function Ja(){const e=vi();return!e||!Array.isArray(e.diagnosticsBuffer)?0:$p(e.diagnosticsBuffer)}var V0="[show-pipeline]";function Gp(e,t){}var ue=(function(e){return e[e.HTML=0]="HTML",e[e.ELEMENT=1]="ELEMENT",e[e.ROOT=2]="ROOT",e[e.COMMENT=3]="COMMENT",e[e.DOCTYPE=4]="DOCTYPE",e[e.ADVANCED=5]="ADVANCED",e})({}),Hr=e=>e.type===0?e.start-1:e.start,qp=e=>e.type===0?e.end+1:e.end,tt=class Tp{start;end;children;parent;content;type=1;tag;closed=!1;startTagEnd;endTagStart;attributes;get attributeNames(){return this.attributes?Object.keys(this.attributes):[]}createdBy;isDirty;get root(){return this.parent?this.parent.root:this}constructor(t,r,n,i){this.start=t,this.end=r,this.children=n,this.parent=i}isSameTag(t){return this.tag===void 0?t===void 0:t!==void 0&&this.tag.length===t.length&&this.tag.toLowerCase()===t}get firstChild(){return this.children[0]}get lastChild(){return this.children.length?this.children[this.children.length-1]:void 0}findNodeBefore(t){const r=es(this.children,n=>t<=Hr(n))-1;if(r>=0){const n=this.children[r];if(t>Hr(n)){if(t<n.end)return n.findNodeBefore(t);const i=n.lastChild;return i&&i.end===n.end?n.findNodeBefore(t):n}}return this}findNodeAt(t){const r=es(this.children,n=>t<=Hr(n))-1;if(r>=0){const n=this.children[r];if(t>=Hr(n)&&t<=qp(n))return n.findNodeAt(t)}return this}find(t){if(t(this))return this;for(const r of this.children){const n=r.find(t);if(n)return n}}closest(t){let r=this;do if(t(r))return r;while(r=r.parent)}parents(){return this.parent?[this.parent,...this.parent.parents()]:[]}closestFromRoot(t,r=!0){const n=r?[this,...this.parents()]:this.parents();for(let i=n.length-1;i>=0;i--){const o=n[i];if(t(o))return o}}contains(t){return!!t.closest(r=>r===this)}clone(t=this.parent,r=this.start,n=!0){const i=this.start-r,o=new Tp(r,this.end-i,[],t);return o.children=n?this.children.map(a=>a.clone(o,a.start-i)):[],o.attributes={...this.attributes},o.closed=this.closed,o.content=this.content,o.startTagEnd=this.startTagEnd,o.endTagStart=this.endTagStart,o.tag=this.tag,o.type=this.type,o}},xp=new Set(["area","br","col","embed","hr","img","input","link","meta","param","vk-snippet-end"]);function Hp(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,r)=>r.toUpperCase())}var Za=Object.create(null);function Vp(e,t){const r=Za[e]||(Za[e]=Object.create(null));let n=r[t];if(typeof n!="boolean"){const i=document.createElement(e)[Hp(t)];n=r[t]=typeof i<"u"&&typeof i!="boolean"}return n}function zp(e){const t=e.tag?.toLowerCase();let r="";if(t){const n=e.attributes;if(n){const i=Object.keys(n);for(const o of i){const a=n[o]===null?"":n[o];typeof a=="string"&&(r+=a===""&&o!=="em"&&!Vp(t,o)?` ${o}`:` ${o}="${a.replaceAll('"',"'")}"`)}}}return r}function Qp(e,t){if(e.start!==e.startTagEnd||t){const r=e.tag?.toLowerCase()||"div",n=zp(e);return r==="vk-snippet-end"?`<${r}${n}/>`:`<${r}${n}>`}return""}function es(e,t){let r=0,n=e.length;if(n===0)return 0;for(;r<n;){const i=Math.floor((r+n)/2);t(e[i])?n=i:r=i+1}return r}function Wp(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,r)=>r.toUpperCase())}function ts(e){return"<!DOCTYPE "+e.name+(e.publicId?' PUBLIC "'+e.publicId+'"':"")+(!e.publicId&&e.systemId?" SYSTEM":"")+(e.systemId?' "'+e.systemId+'"':"")+">"}var rs=Object.create(null);function Kp(e,t){const r=rs[e]||(rs[e]=Object.create(null));let n=r[t];if(typeof n!="boolean"){const i=document.createElement(e)[Wp(t)];n=r[t]=typeof i<"u"&&typeof i!="boolean"}return n}function Vr(e){return e.nodeType===Node.ELEMENT_NODE}function Yp(e){return Vr(e)&&!e.ownerSVGElement}function Xp(e){return e.tagName==="IMG"}function Jp(e){return e.tagName==="AMP-IMG"}function Zp(e){return e.tagName==="BODY"}function em(e){return e.tagName==="FORM"}function tm(e){return e.tagName==="HTML"}function rm(e){return e.tagName==="SCRIPT"}function ns(e){return e.tagName==="STYLE"}function is(e){return e.nodeType===Node.DOCUMENT_NODE}function nm(e){return e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function im(e){return e.nodeType===Node.DOCUMENT_TYPE_NODE}var _i;(function(e){function t(y){return y.constructor.name==="CSSStyleRule"}e.isStyleRule=t;function r(y){return y.constructor.name==="CSSImportRule"}e.isImportRule=r;function n(y){return y.constructor.name==="CSSMediaRule"}e.isMediaRule=n;function i(y){return y.constructor.name==="CSSFontFaceRule"}e.isFontFaceRule=i;function o(y){return y.constructor.name==="CSSPageRule"}e.isPageRule=o;function a(y){return y.constructor.name==="CSSKeyframesRule"}e.isKeyframesRule=a;function s(y){return y.constructor.name==="CSSKeyframeRule"}e.isKeyframeRuleRule=s;function c(y){return y.constructor.name==="CSSNamespaceRule"}e.isNamespaceRule=c;function u(y){return y.constructor.name==="CSSCounterStyleRule"}e.isCounterStyleRule=u;function h(y){return y.constructor.name==="CSSSupportsRule"}e.isSupportsRule=h;function f(y){return y.constructor.name==="CSSFontFeatureValuesRule"}e.isFontFeatureValuesRuleRule=f})(_i||(_i={}));function Ei(e){return e.nodeType===Node.COMMENT_NODE}function om(e){return e&&!!e.host&&!!e.mode}function Si(e){const t=e.getRootNode()||window.document;return om(t)?t:null}var am=/(<!(--)?\[if\s[()\w\s|&!]+\]>(?:<!--+>)?)((?:.|\r|\n)*?)((?:<!--)?<!\[endif\]\2>)/gi;function sm(e){const t=Ht(e).matchAll(am);if(t)for(const r of t){const[,n,,i,o]=r;return{open:n,close:o,content:i}}}function Pi(e){return e.nodeType===Node.TEXT_NODE}function um(e){return e.tagName==="TABLE"}async function cm(e,t=5e3){return typeof e.complete<"u"&&!e.complete?new Promise((r,n)=>{setTimeout(r,t),e.onload=()=>r(getComputedStyle(e)),e.onerror=i=>{}}):getComputedStyle(e)}function Ht(e){if(Vr(e))return dm(e);if(is(e))return[...e.childNodes].map(r=>Ht(r)).join("");if(im(e))return ts(e);const t=document.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}function lm(e){const t=e.tagName.toLowerCase();let r="";for(const n of e.attributes){const i=n.name,o=n.value;r+=o===""&&i!=="em"&&!Kp(t,i)?` ${i}`:` ${i}="${o.replaceAll('"',"'")}"`}return r}function os(e){let t="";for(const r of e.childNodes)t+=Ht(r);return t}function dm(e){const t=Object.getOwnPropertyDescriptor(e,"$$tagName")?.value||e.tagName.toLowerCase(),r=lm(e);return xp.has(t.toLowerCase())?t==="vk-snippet-end"?`<${t}${r}/>`:`<${t}${r}>`:ns(e)?`<${t}${r}>${e.innerHTML}</${t}>`:`<${t}${r}>${os(e)}</${t}>`}function as(e,t){for(const o of[...e.childNodes])o.remove();let r=t.find(o=>tm(o)),n=t.find(o=>Zp(o)),i=e;r||(r=document.createElement("html"),e.appendChild(r),i=r,n||(n=document.createElement("body"),r.appendChild(n),i=n));for(const o of t){if(i===e){if(Pi(o)){i.appendChild(document.createComment(`%%%{{{${o.data}}}}%%%`));continue}if(Vr(o)&&o!==r){(r.querySelector("body")??r).appendChild(o);continue}}i.appendChild(o)}}function Oi(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){const o=e,a=t;return o.length===a.length&&o.every((s,c)=>Oi(s,a[c]))}const n=Object.keys(e),i=Object.keys(t);return n.length!==i.length?!1:n.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Oi(e[o],t[o]))}function ss(e,t){const r={watch(n){let i,o=!1;return e.watch(a=>{const s=t(a);o&&Oi(i,s)||(i=s,o=!0,n(s))})},select(n){return ss(r,n)}};return r}function Le(...e){let t=e[0],r=e.length>0;const n=new Set,i={get(){return r?t:void 0},set(o){t=o,r=!0;for(const a of Array.from(n))a(o)},watch(o){return n.add(o),r&&o(t),{dispose:()=>n.delete(o)}},select(o){return ss(i,o)}};return i}var us=M.createIdentifier$1("HeadlessMode");function Ti(e){return e.getOrCreateInstance(us,()=>Le(!1))}function fm(e){return e?.getInstance(us)?.get()??!1}function pm(e,t){Ti(e).set(t)}var mm=M.createIdentifier$1("HiddenMount");function hm(e){return e.getOrCreateInstance(mm,()=>Le(!1))}function gm(e,t){hm(e).set(t)}var bm=Z.__commonJSMin(((e,t)=>{var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";t.exports=r})),ym=Z.__commonJSMin(((e,t)=>{var r=bm();function n(){}function i(){}i.resetWarningCache=n,t.exports=function(){function o(c,u,h,f,y,E){if(E!==r){var S=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw S.name="Invariant Violation",S}}o.isRequired=o;function a(){return o}var s={array:o,bigint:o,bool:o,func:o,number:o,object:o,string:o,symbol:o,any:o,arrayOf:a,element:o,elementType:o,instanceOf:a,node:o,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:i,resetWarningCache:n};return s.PropTypes=s,s}})),vm=Z.__commonJSMin(((e,t)=>{t.exports=ym()()})),rt=N.default.createContext(null);function _m(e){e()}var cs=_m,Em=function(t){return cs=t},Sm=function(){return cs},ls={notify:function(){}};function Pm(){var e=Sm(),t=null,r=null;return{clear:function(){t=null,r=null},notify:function(){e(function(){for(var i=t;i;)i.callback(),i=i.next})},get:function(){for(var i=[],o=t;o;)i.push(o),o=o.next;return i},subscribe:function(i){var o=!0,a=r={callback:i,next:null,prev:r};return a.prev?a.prev.next=a:t=a,function(){!o||t===null||(o=!1,a.next?a.next.prev=a.prev:r=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}var ds=(function(){function e(r,n){this.store=r,this.parentSub=n,this.unsubscribe=null,this.listeners=ls,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(n){return this.trySubscribe(),this.listeners.subscribe(n)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return!!this.unsubscribe},t.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=Pm())},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=ls)},e})(),Ci=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?N.useLayoutEffect:N.useEffect;function Om(e){var t=e.store,r=e.context,n=e.children,i=(0,N.useMemo)(function(){var s=new ds(t);return s.onStateChange=s.notifyNestedSubs,{store:t,subscription:s}},[t]),o=(0,N.useMemo)(function(){return t.getState()},[t]);Ci(function(){var s=i.subscription;return s.trySubscribe(),o!==t.getState()&&s.notifyNestedSubs(),function(){s.tryUnsubscribe(),s.onStateChange=null}},[i,o]);var a=r||rt;return N.default.createElement(a.Provider,{value:i},n)}function Ai(){return Ai=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ai.apply(null,arguments)}function fs(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Tm=Z.__commonJSMin((e=>{var t=typeof Symbol=="function"&&Symbol.for,r=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,i=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,a=t?Symbol.for("react.profiler"):60114,s=t?Symbol.for("react.provider"):60109,c=t?Symbol.for("react.context"):60110,u=t?Symbol.for("react.async_mode"):60111,h=t?Symbol.for("react.concurrent_mode"):60111,f=t?Symbol.for("react.forward_ref"):60112,y=t?Symbol.for("react.suspense"):60113,E=t?Symbol.for("react.suspense_list"):60120,S=t?Symbol.for("react.memo"):60115,v=t?Symbol.for("react.lazy"):60116,C=t?Symbol.for("react.block"):60121,A=t?Symbol.for("react.fundamental"):60117,I=t?Symbol.for("react.responder"):60118,T=t?Symbol.for("react.scope"):60119;function g(l){if(typeof l=="object"&&l!==null){var b=l.$$typeof;switch(b){case r:switch(l=l.type,l){case u:case h:case i:case a:case o:case y:return l;default:switch(l=l&&l.$$typeof,l){case c:case f:case v:case S:case s:return l;default:return b}}case n:return b}}}function m(l){return g(l)===h}e.AsyncMode=u,e.ConcurrentMode=h,e.ContextConsumer=c,e.ContextProvider=s,e.Element=r,e.ForwardRef=f,e.Fragment=i,e.Lazy=v,e.Memo=S,e.Portal=n,e.Profiler=a,e.StrictMode=o,e.Suspense=y,e.isAsyncMode=function(l){return m(l)||g(l)===u},e.isConcurrentMode=m,e.isContextConsumer=function(l){return g(l)===c},e.isContextProvider=function(l){return g(l)===s},e.isElement=function(l){return typeof l=="object"&&l!==null&&l.$$typeof===r},e.isForwardRef=function(l){return g(l)===f},e.isFragment=function(l){return g(l)===i},e.isLazy=function(l){return g(l)===v},e.isMemo=function(l){return g(l)===S},e.isPortal=function(l){return g(l)===n},e.isProfiler=function(l){return g(l)===a},e.isStrictMode=function(l){return g(l)===o},e.isSuspense=function(l){return g(l)===y},e.isValidElementType=function(l){return typeof l=="string"||typeof l=="function"||l===i||l===h||l===a||l===o||l===y||l===E||typeof l=="object"&&l!==null&&(l.$$typeof===v||l.$$typeof===S||l.$$typeof===s||l.$$typeof===c||l.$$typeof===f||l.$$typeof===A||l.$$typeof===I||l.$$typeof===T||l.$$typeof===C)},e.typeOf=g})),Cm=Z.__commonJSMin(((e,t)=>{t.exports=Tm()})),Am=Z.__commonJSMin(((e,t)=>{var r=Cm(),n={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},o={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};s[r.ForwardRef]=o,s[r.Memo]=a;function c(C){return r.isMemo(C)?a:s[C.$$typeof]||n}var u=Object.defineProperty,h=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,y=Object.getOwnPropertyDescriptor,E=Object.getPrototypeOf,S=Object.prototype;function v(C,A,I){if(typeof A!="string"){if(S){var T=E(A);T&&T!==S&&v(C,T,I)}var g=h(A);f&&(g=g.concat(f(A)));for(var m=c(C),l=c(A),b=0;b<g.length;++b){var d=g[b];if(!i[d]&&!(I&&I[d])&&!(l&&l[d])&&!(m&&m[d])){var _=y(A,d);try{u(C,d,_)}catch{}}}}return C}t.exports=v})),Im=Z.__commonJSMin((e=>{var t=typeof Symbol=="function"&&Symbol.for})),wm=Z.__commonJSMin(((e,t)=>{t.exports=Im()})),z0=Z.__toESM(Am()),Q0=wm();function ps(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Vt(e,t){if(ps(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(t,r[i])||!ps(e[r[i]],t[r[i]]))return!1;return!0}function oe(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var ms=typeof Symbol=="function"&&Symbol.observable||"@@observable",Ii=()=>Math.random().toString(36).substring(7).split("").join("."),zr={INIT:`@@redux/INIT${Ii()}`,REPLACE:`@@redux/REPLACE${Ii()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ii()}`};function nt(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function hs(e,t,r){if(typeof e!="function")throw new Error(oe(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(oe(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(oe(1));return r(hs)(e,t)}let n=e,i=t,o=new Map,a=o,s=0,c=!1;function u(){a===o&&(a=new Map,o.forEach((v,C)=>{a.set(C,v)}))}function h(){if(c)throw new Error(oe(3));return i}function f(v){if(typeof v!="function")throw new Error(oe(4));if(c)throw new Error(oe(5));let C=!0;u();const A=s++;return a.set(A,v),function(){if(C){if(c)throw new Error(oe(6));C=!1,u(),a.delete(A),o=null}}}function y(v){if(!nt(v))throw new Error(oe(7));if(typeof v.type>"u")throw new Error(oe(8));if(typeof v.type!="string")throw new Error(oe(17));if(c)throw new Error(oe(9));try{c=!0,i=n(i,v)}finally{c=!1}return(o=a).forEach(C=>{C()}),v}function E(v){if(typeof v!="function")throw new Error(oe(10));n=v,y({type:zr.REPLACE})}function S(){const v=f;return{subscribe(C){if(typeof C!="object"||C===null)throw new Error(oe(11));function A(){const I=C;I.next&&I.next(h())}return A(),{unsubscribe:v(A)}},[ms](){return this}}}return y({type:zr.INIT}),{dispatch:y,subscribe:f,getState:h,replaceReducer:E,[ms]:S}}function Mm(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:zr.INIT})>"u")throw new Error(oe(12));if(typeof r(void 0,{type:zr.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(oe(13))})}function wi(e){const t=Object.keys(e),r={};for(let o=0;o<t.length;o++){const a=t[o];typeof e[a]=="function"&&(r[a]=e[a])}const n=Object.keys(r);let i;try{Mm(r)}catch(o){i=o}return function(a={},s){if(i)throw i;let c=!1;const u={};for(let h=0;h<n.length;h++){const f=n[h],y=r[f],E=a[f],S=y(E,s);if(typeof S>"u")throw s&&s.type,new Error(oe(14));u[f]=S,c=c||S!==E}return c=c||n.length!==Object.keys(a).length,c?u:a}}function Qr(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Rm(...e){return t=>(r,n)=>{const i=t(r,n);let o=()=>{throw new Error(oe(15))};const a={getState:i.getState,dispatch:(s,...c)=>o(s,...c)};return o=Qr(...e.map(s=>s(a)))(i.dispatch),{...i,dispatch:o}}}function gs(e){return nt(e)&&"type"in e&&typeof e.type=="string"}function bs(){return(0,N.useContext)(rt)}function ys(e){e===void 0&&(e=rt);var t=e===rt?bs:function(){return(0,N.useContext)(e)};return function(){return t().store}}var pe=ys();function Dm(e){e===void 0&&(e=rt);var t=e===rt?pe:ys(e);return function(){return t().dispatch}}var qe=Dm(),Nm=function(t,r){return t===r};function jm(e,t,r,n){var i=(0,N.useReducer)(function(E){return E+1},0)[1],o=(0,N.useMemo)(function(){return new ds(r,n)},[r,n]),a=(0,N.useRef)(),s=(0,N.useRef)(),c=(0,N.useRef)(),u=(0,N.useRef)(),h=r.getState(),f;try{if(e!==s.current||h!==c.current||a.current){var y=e(h);u.current===void 0||!t(y,u.current)?f=y:f=u.current}else f=u.current}catch(E){throw a.current&&(E.message+=`
|
|
7
7
|
The error may be correlated with this previous error:
|
|
8
8
|
`+a.current.stack+`
|
|
9
9
|
|
|
10
|
-
`),E}return Ci(function(){s.current=e,c.current=h,u.current=f,a.current=void 0}),Ci(function(){function E(){try{var S=s.current(r.getState());if(t(S,u.current))return;u.current=S}catch(v){a.current=v}i()}return o.onStateChange=E,o.trySubscribe(),E(),function(){return o.tryUnsubscribe()}},[r,o]),f}function Lm(e){e===void 0&&(e=rt);var t=e===rt?bs:function(){return(0,N.useContext)(e)};return function(n,i){i===void 0&&(i=Nm);var o=t(),a=o.store,s=o.subscription,c=jm(n,i,a,s);return(0,N.useDebugValue)(c),c}}var zt=Lm();Em(Ze.unstable_batchedUpdates);var Wr,vs=Z.__esmMin((()=>{vs(),Wr=typeof Wr<"u"?Wr:typeof self<"u"?self:typeof window<"u"?window:{}})),Mi=Symbol.for("immer-nothing"),Qt=Symbol.for("immer-draftable"),ne=Symbol.for("immer-state");function ae(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ee=Object,ct=Ee.getPrototypeOf,Wt="constructor",Kt="prototype",Ri="configurable",Kr="enumerable",Yr="writable",Yt="value",Se=e=>!!e&&!!e[ne];function me(e){return e?Es(e)||Jt(e)||!!e[Qt]||!!e[Wt]?.[Qt]||Zt(e)||er(e):!1}var km=Ee[Kt][Wt].toString(),_s=new WeakMap;function Es(e){if(!e||!Tt(e))return!1;const t=ct(e);if(t===null||t===Ee[Kt])return!0;const r=Ee.hasOwnProperty.call(t,Wt)&&t[Wt];if(r===Object)return!0;if(!dt(r))return!1;let n=_s.get(r);return n===void 0&&(n=Function.toString.call(r),_s.set(r,n)),n===km}function Fm(e){return Se(e)||ae(15,e),e[ne].base_}function Xt(e,t,r=!0){lt(e)===0?(r?Reflect.ownKeys(e):Ee.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,i)=>t(i,n,e))}function lt(e){const t=e[ne];return t?t.type_:Jt(e)?1:Zt(e)?2:er(e)?3:0}var Ot=(e,t,r=lt(e))=>r===2?e.has(t):Ee[Kt].hasOwnProperty.call(e,t),xe=(e,t,r=lt(e))=>r===2?e.get(t):e[t],Xr=(e,t,r,n=lt(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Um(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Jt=Array.isArray,Zt=e=>e instanceof Map,er=e=>e instanceof Set,Tt=e=>typeof e=="object",dt=e=>typeof e=="function",Di=e=>typeof e=="boolean";function Bm(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var $m=e=>Tt(e)?e?.[ne]:null,He=e=>e.copy_||e.base_,Ni=e=>e.modified_?e.copy_:e.base_;function ji(e,t){if(Zt(e))return new Map(e);if(er(e))return new Set(e);if(Jt(e))return Array[Kt].slice.call(e);const r=Es(e);if(t===!0||t==="class_only"&&!r){const n=Ee.getOwnPropertyDescriptors(e);delete n[ne];let i=Reflect.ownKeys(n);for(let o=0;o<i.length;o++){const a=i[o],s=n[a];s[Yr]===!1&&(s[Yr]=!0,s[Ri]=!0),(s.get||s.set)&&(n[a]={[Ri]:!0,[Yr]:!0,[Kr]:s[Kr],[Yt]:e[a]})}return Ee.create(ct(e),n)}else{const n=ct(e);if(n!==null&&r)return{...e};const i=Ee.create(n);return Ee.assign(i,e)}}function Li(e,t=!1){return Zr(e)||Se(e)||!me(e)||(lt(e)>1&&Ee.defineProperties(e,{set:Jr,add:Jr,clear:Jr,delete:Jr}),Ee.freeze(e),t&&Xt(e,(r,n)=>{Li(n,!0)},!1)),e}function Gm(){ae(2)}var Jr={[Yt]:Gm};function Zr(e){return e===null||!Tt(e)?!0:Ee.isFrozen(e)}var en="MapSet",tn="Patches",Ss="ArrayMethods",rn={};function ft(e){const t=rn[e];return t||ae(0,e),t}var Ps=e=>!!rn[e];function qm(e,t){rn[e]||(rn[e]=t)}var tr,Os=()=>tr,xm=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ps(en)?ft(en):void 0,arrayMethodsPlugin_:Ps(Ss)?ft(Ss):void 0});function Ts(e,t){t&&(e.patchPlugin_=ft(tn),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ki(e){Fi(e),e.drafts_.forEach(Hm),e.drafts_=null}function Fi(e){e===tr&&(tr=e.parent_)}var Cs=e=>tr=xm(tr,e);function Hm(e){const t=e[ne];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function As(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[ne].modified_&&(ki(t),ae(4)),me(e)&&(e=Is(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[ne].base_,e,t)}else e=Is(t,r);return Vm(t,e,!0),ki(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Mi?e:void 0}function Is(e,t){if(Zr(t))return t;const r=t[ne];if(!r)return on(t,e.handledSet_,e);if(!nn(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);Rs(r,e)}return r.copy_}function Vm(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Li(t,r)}function ws(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var nn=(e,t)=>e.scope_===t,zm=[];function Ms(e,t,r,n){const i=He(e),o=e.type_;if(n!==void 0&&xe(i,n,o)===t){Xr(i,n,r,o);return}if(!e.draftLocations_){const s=e.draftLocations_=new Map;Xt(i,(c,u)=>{if(Se(u)){const h=s.get(u)||[];h.push(c),s.set(u,h)}})}const a=e.draftLocations_.get(t)??zm;for(const s of a)Xr(i,s,r,o)}function Qm(e,t,r){e.callbacks_.push(function(i){const o=t;if(!o||!nn(o,i))return;i.mapSetPlugin_?.fixSetContents(o);const a=Ni(o);Ms(e,o.draft_??o,a,r),Rs(o,i)})}function Rs(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:r}=t;if(r){const n=r.getPath(e);n&&r.generatePatches_(e,n,t)}ws(e)}}function Wm(e,t,r){const{scope_:n}=e;if(Se(r)){const i=r[ne];nn(i,n)&&i.callbacks_.push(function(){sn(e),Ms(e,r,Ni(i),t)})}else me(r)&&e.callbacks_.push(function(){const o=He(e);e.type_===3?o.has(r)&&on(r,n.handledSet_,n):xe(o,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&on(xe(e.copy_,t,e.type_),n.handledSet_,n)})}function on(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Se(e)||t.has(e)||!me(e)||Zr(e)||(t.add(e),Xt(e,(n,i)=>{if(Se(i)){const o=i[ne];nn(o,r)&&(Xr(e,n,Ni(o),e.type_),ws(o))}else me(i)&&on(i,t,r)})),e}function Km(e,t){const r=Jt(e),n={type_:r?1:0,scope_:t?t.scope_:Os(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=n,o=an;r&&(i=[n],o=rr);const{revoke:a,proxy:s}=Proxy.revocable(i,o);return n.draft_=s,n.revoke_=a,[s,n]}var an={get(e,t){if(t===ne)return e;let r=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const i=He(e);if(!Ot(i,t,e.type_))return Xm(e,i,t);const o=i[t];if(e.finalized_||!me(o)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Bm(t))return o;if(o===Ui(e.base_,t)||Ym(e,t,o)){sn(e);const a=e.type_===1?+t:t,s=$i(e.scope_,o,e,a);return e.copy_[a]=s}return o},has(e,t){return t in He(e)},ownKeys(e){return Reflect.ownKeys(He(e))},set(e,t,r){const n=Ds(He(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Ui(He(e),t),o=i?.[ne];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Um(r,i)&&(r!==void 0||Ot(e.base_,t,e.type_)))return!0;sn(e),Bi(e)}return e.copy_[t]===r&&(r!==void 0||Ot(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Wm(e,t,r)),!0},deleteProperty(e,t){return sn(e),Ui(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Bi(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=He(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Yr]:!0,[Ri]:e.type_!==1||t!=="length",[Kr]:n[Kr],[Yt]:r[t]}},defineProperty(){ae(11)},getPrototypeOf(e){return ct(e.base_)},setPrototypeOf(){ae(12)}},rr={};for(let e in an){let t=an[e];rr[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}rr.deleteProperty=function(e,t){return rr.set.call(this,e,t,void 0)},rr.set=function(e,t,r){return an.set.call(this,e[0],t,r,e[0])};function Ui(e,t){const r=e[ne];return(r?He(r):e)[t]}function Ym(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!me(r)||r[ne]?!1:e.baseRefs_.has(r)}function Xm(e,t,r){const n=Ds(t,r);return n?Yt in n?n[Yt]:n.get?.call(e.draft_):void 0}function Ds(e,t){if(!(t in e))return;let r=ct(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=ct(r)}}function Bi(e){e.modified_||(e.modified_=!0,e.parent_&&Bi(e.parent_))}function sn(e){e.copy_||(e.assigned_=new Map,e.copy_=ji(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Jm=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(dt(t)&&!dt(r)){const o=r;r=t;const a=this;return function(c=o,...u){return a.produce(c,h=>r.call(this,h,...u))}}dt(r)||ae(6),n!==void 0&&!dt(n)&&ae(7);let i;if(me(t)){const o=Cs(this),a=$i(o,t,void 0);let s=!0;try{i=r(a),s=!1}finally{s?ki(o):Fi(o)}return Ts(o,n),As(i,o)}else if(!t||!Tt(t)){if(i=r(t),i===void 0&&(i=t),i===Mi&&(i=void 0),this.autoFreeze_&&Li(i,!0),n){const o=[],a=[];ft(tn).generateReplacementPatches_(t,i,{patches_:o,inversePatches_:a}),n(o,a)}return i}else ae(1,t)},this.produceWithPatches=(t,r)=>{if(dt(t))return(o,...a)=>this.produceWithPatches(o,s=>t(s,...a));let n,i;return[this.produce(t,r,(o,a)=>{n=o,i=a}),n,i]},Di(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Di(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Di(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){me(e)||ae(8),Se(e)&&(e=Ns(e));const t=Cs(this),r=$i(t,e,void 0);return r[ne].isManual_=!0,Fi(t),r}finishDraft(e,t){const r=e&&e[ne];(!r||!r.isManual_)&&ae(9);const{scope_:n}=r;return Ts(n,t),As(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=ft(tn).applyPatches_;return Se(e)?n(e,t):this.produce(e,i=>n(i,t))}};function $i(e,t,r,n){const[i,o]=Zt(t)?ft(en).proxyMap_(t,r):er(t)?ft(en).proxySet_(t,r):Km(t,r);return(r?.scope_??Os()).drafts_.push(i),o.callbacks_=r?.callbacks_??[],o.key_=n,r&&n!==void 0?Qm(r,o,n):o.callbacks_.push(function(s){s.mapSetPlugin_?.fixSetContents(o);const{patchPlugin_:c}=s;o.modified_&&c&&c.generatePatches_(o,[],s)}),i}function Ns(e){return Se(e)||ae(10,e),js(e)}function js(e){if(!me(e)||Zr(e))return e;const t=e[ne];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=ji(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=ji(e,!0);return Xt(r,(i,o)=>{Xr(r,i,js(o))},n),t&&(t.finalized_=!1),r}function Zm(){function t(S,v=[]){if(S.key_!==void 0){const C=S.parent_.copy_??S.parent_.base_,A=$m(xe(C,S.key_)),I=xe(C,S.key_);if(I===void 0||I!==S.draft_&&I!==S.base_&&I!==S.copy_||A!=null&&A.base_!==S.base_)return null;const T=S.parent_.type_===3;let g;if(T){const m=S.parent_;g=Array.from(m.drafts_.keys()).indexOf(S.key_)}else g=S.key_;if(!(T&&C.size>g||Ot(C,g)))return null;v.push(g)}if(S.parent_)return t(S.parent_,v);v.reverse();try{r(S.copy_,v)}catch{return null}return v}function r(S,v){let C=S;for(let A=0;A<v.length-1;A++){const I=v[A];if(C=xe(C,I),!Tt(C)||C===null)throw new Error(`Cannot resolve path at '${v.join("/")}'`)}return C}const n="replace",i="add",o="remove";function a(S,v,C){if(S.scope_.processedForPatches_.has(S))return;S.scope_.processedForPatches_.add(S);const{patches_:A,inversePatches_:I}=C;switch(S.type_){case 0:case 2:return c(S,v,A,I);case 1:return s(S,v,A,I);case 3:return u(S,v,A,I)}}function s(S,v,C,A){let{base_:I,assigned_:T}=S,g=S.copy_;g.length<I.length&&([I,g]=[g,I],[C,A]=[A,C]);const m=S.allIndicesReassigned_===!0;for(let l=0;l<I.length;l++){const b=g[l],d=I[l];if((m||T?.get(l.toString()))&&b!==d){const _=b?.[ne];if(_&&_.modified_)continue;const P=v.concat([l]);C.push({op:n,path:P,value:E(b)}),A.push({op:n,path:P,value:E(d)})}}for(let l=I.length;l<g.length;l++){const b=v.concat([l]);C.push({op:i,path:b,value:E(g[l])})}for(let l=g.length-1;I.length<=l;--l){const b=v.concat([l]);A.push({op:o,path:b})}}function c(S,v,C,A){const{base_:I,copy_:T,type_:g}=S;Xt(S.assigned_,(m,l)=>{const b=xe(I,m,g),d=xe(T,m,g),_=l?Ot(I,m)?n:i:o;if(b===d&&_===n)return;const P=v.concat(m);C.push(_===o?{op:_,path:P}:{op:_,path:P,value:E(d)}),A.push(_===i?{op:o,path:P}:_===o?{op:i,path:P,value:E(b)}:{op:n,path:P,value:E(b)})})}function u(S,v,C,A){let{base_:I,copy_:T}=S,g=0;I.forEach(m=>{if(!T.has(m)){const l=v.concat([g]);C.push({op:o,path:l,value:m}),A.unshift({op:i,path:l,value:m})}g++}),g=0,T.forEach(m=>{if(!I.has(m)){const l=v.concat([g]);C.push({op:i,path:l,value:m}),A.unshift({op:o,path:l,value:m})}g++})}function h(S,v,C){const{patches_:A,inversePatches_:I}=C;A.push({op:n,path:[],value:v===Mi?void 0:v}),I.push({op:n,path:[],value:S})}function f(S,v){return v.forEach(C=>{const{path:A,op:I}=C;let T=S;for(let b=0;b<A.length-1;b++){const d=lt(T);let _=A[b];typeof _!="string"&&typeof _!="number"&&(_=""+_),(d===0||d===1)&&(_==="__proto__"||_===Wt)&&ae(19),dt(T)&&_===Kt&&ae(19),T=xe(T,_),(T===null||!Tt(T))&&ae(18,A.join("/"))}const g=lt(T),m=y(C.value),l=A[A.length-1];switch(I){case n:switch(g){case 2:return T.set(l,m);case 3:ae(16);default:return T[l]=m}case i:switch(g){case 1:return l==="-"?T.push(m):T.splice(l,0,m);case 2:return T.set(l,m);case 3:return T.add(m);default:return T[l]=m}case o:switch(g){case 1:return T.splice(l,1);case 2:return T.delete(l);case 3:return T.delete(C.value);default:return delete T[l]}default:ae(17,I)}}),S}function y(S){if(!me(S))return S;if(Jt(S))return S.map(y);if(Zt(S))return new Map(Array.from(S.entries()).map(([C,A])=>[C,y(A)]));if(er(S))return new Set(Array.from(S).map(y));const v=Object.create(ct(S));for(const C in S)v[C]=y(S[C]);return Ot(S,Qt)&&(v[Qt]=S[Qt]),v}function E(S){return Se(S)?y(S):S}qm(tn,{applyPatches_:f,generatePatches_:a,generateReplacementPatches_:h,getPath:t})}var nr=new Jm,ir=nr.produce,Ls=nr.produceWithPatches.bind(nr),ks=nr.applyPatches.bind(nr);function eh(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function th(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Fs=e=>Array.isArray(e)?e:[e];function rh(e){const t=Array.isArray(e[0])?e[0]:e;return th(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function nh(e,t){const r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var ih=class{constructor(e){this.value=e}deref(){return this.value}},oh=()=>typeof WeakRef>"u"?ih:WeakRef,Us=oh(),ah=0,Bs=1;function un(){return{s:ah,v:void 0,o:null,p:null}}function sh(e){return e instanceof Us?e.deref():e}function cn(e,t={}){let r=un();const{resultEqualityCheck:n}=t;let i,o=0;function a(){let s=r;const{length:c}=arguments;for(let f=0,y=c;f<y;f++){const E=arguments[f];if(typeof E=="function"||typeof E=="object"&&E!==null){let S=s.o;S===null&&(s.o=S=new WeakMap);const v=S.get(E);v===void 0?(s=un(),S.set(E,s)):s=v}else{let S=s.p;S===null&&(s.p=S=new Map);const v=S.get(E);v===void 0?(s=un(),S.set(E,s)):s=v}}const u=s;let h;if(s.s===Bs)h=s.v;else if(h=e.apply(null,arguments),o++,n){const f=sh(i);f!=null&&n(f,h)&&(h=f,o!==0&&o--),i=typeof h=="object"&&h!==null||typeof h=="function"?new Us(h):h}return u.s=Bs,u.v=h,h}return a.clearCache=()=>{r=un(),a.resetResultsCount()},a.resultsCount=()=>o,a.resetResultsCount=()=>{o=0},a}function uh(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let o=0,a=0,s,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),eh(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const{memoize:h,memoizeOptions:f=[],argsMemoize:y=cn,argsMemoizeOptions:E=[]}={...r,...c},S=Fs(f),v=Fs(E),C=rh(i),A=h(function(){return o++,u.apply(null,arguments)},...S),I=y(function(){a++;const g=nh(C,arguments);return s=A.apply(null,g),s},...v);return Object.assign(I,{resultFunc:u,memoizedResultFunc:A,dependencies:C,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:h,argsMemoize:y})};return Object.assign(n,{withTypes:()=>n}),n}var $s=uh(cn);function Gs(e){return({dispatch:r,getState:n})=>i=>o=>typeof o=="function"?o(r,n,e):i(o)}var ch=Gs(),lh=Gs,dh=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Qr:Qr.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var fh=e=>e&&typeof e.match=="function";function he(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(we(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>gs(n)&&n.type===e,r}var qs=class qr extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,qr.prototype)}static get[Symbol.species](){return qr}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new qr(...t[0].concat(this)):new qr(...t.concat(this))}};function xs(e){return me(e)?ir(e,()=>{}):e}function ln(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function ph(e){return typeof e=="boolean"}var mh=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=t??{};let a=new qs;return r&&(ph(r)?a.push(ch):a.push(lh(r.extraArgument))),a},dn="RTK_autoBatch",or=()=>e=>({payload:e,meta:{[dn]:!0}}),Hs=e=>t=>{setTimeout(t,e)},hh=(e,t)=>r=>{let n=!1;const i=()=>{n||(n=!0,cancelAnimationFrame(o),clearTimeout(a),r())},o=e(i),a=setTimeout(i,t)},gh=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,o=!1,a=!1;const s=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?hh(window.requestAnimationFrame,100):Hs(10):e.type==="callback"?e.queueNotification:Hs(e.timeout),u=()=>{a=!1,o&&(o=!1,s.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){const f=()=>i&&h(),y=n.subscribe(f);return s.add(h),()=>{y(),s.delete(h)}},dispatch(h){try{return i=!h?.meta?.[dn],o=!i,o&&(a||(a=!0,c(u))),n.dispatch(h)}finally{i=!0}}})},bh=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new qs(e);return n&&i.push(gh(typeof n=="object"?n:void 0)),i};function yh(e){const t=mh(),{reducer:r=void 0,middleware:n,devTools:i=!0,duplicateMiddlewareCheck:o=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{};let c;if(typeof r=="function")c=r;else if(nt(r))c=wi(r);else throw new Error(we(1));let u;typeof n=="function"?u=n(t):u=t();let h=Qr;i&&(h=dh({trace:!1,...typeof i=="object"&&i}));const f=bh(Rm(...u));let y=typeof s=="function"?s(f):f();const E=h(...y);return hs(c,a,E)}function Vs(e){const t={},r=[];let n;const i={addCase(o,a){const s=typeof o=="string"?o:o.type;if(!s)throw new Error(we(28));if(s in t)throw new Error(we(29));return t[s]=a,i},addAsyncThunk(o,a){return a.pending&&(t[o.pending.type]=a.pending),a.rejected&&(t[o.rejected.type]=a.rejected),a.fulfilled&&(t[o.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:o.settled,reducer:a.settled}),i},addMatcher(o,a){return r.push({matcher:o,reducer:a}),i},addDefaultCase(o){return n=o,i}};return e(i),[t,r,n]}function vh(e){return typeof e=="function"}function _h(e,t){let[r,n,i]=Vs(t),o;if(vh(e))o=()=>xs(e());else{const s=xs(e);o=()=>s}function a(s=o(),c){let u=[r[c.type],...n.filter(({matcher:h})=>h(c)).map(({reducer:h})=>h)];return u.filter(h=>!!h).length===0&&(u=[i]),u.reduce((h,f)=>{if(f)if(Se(h)){const y=f(h,c);return y===void 0?h:y}else{if(me(h))return ir(h,y=>f(y,c));{const y=f(h,c);if(y===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return y}}return h},s)}return a.getInitialState=o,a}var zs=(e,t)=>fh(e)?e.match(t):e(t);function Ve(...e){return t=>e.some(r=>zs(r,t))}function ar(...e){return t=>e.every(r=>zs(r,t))}function fn(e,t){if(!e||!e.meta)return!1;const r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function sr(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Gi(...e){return e.length===0?t=>fn(t,["pending"]):sr(e)?Ve(...e.map(t=>t.pending)):Gi()(e[0])}function Ct(...e){return e.length===0?t=>fn(t,["rejected"]):sr(e)?Ve(...e.map(t=>t.rejected)):Ct()(e[0])}function pn(...e){const t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?ar(Ct(...e),t):sr(e)?ar(Ct(...e),t):pn()(e[0])}function it(...e){return e.length===0?t=>fn(t,["fulfilled"]):sr(e)?Ve(...e.map(t=>t.fulfilled)):it()(e[0])}function qi(...e){return e.length===0?t=>fn(t,["pending","fulfilled","rejected"]):sr(e)?Ve(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):qi()(e[0])}var Eh="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",xi=(e=21)=>{let t="",r=e;for(;r--;)t+=Eh[Math.random()*64|0];return t},Sh=["name","message","stack","code"],Hi=class{constructor(e,t){this.payload=e,this.meta=t}payload;meta;_type},Qs=class{constructor(e,t){this.payload=e,this.meta=t}payload;meta;_type},Ph=e=>{if(typeof e=="object"&&e!==null){const t={};for(const r of Sh)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Ws="External signal was aborted",Vi=(()=>{function e(t,r,n){const i=he(t+"/fulfilled",(c,u,h,f)=>({payload:c,meta:{...f||{},arg:h,requestId:u,requestStatus:"fulfilled"}})),o=he(t+"/pending",(c,u,h)=>({payload:void 0,meta:{...h||{},arg:u,requestId:c,requestStatus:"pending"}})),a=he(t+"/rejected",(c,u,h,f,y)=>({payload:f,error:(n&&n.serializeError||Ph)(c||"Rejected"),meta:{...y||{},arg:h,requestId:u,rejectedWithValue:!!f,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function s(c,{signal:u}={}){return(h,f,y)=>{const E=n?.idGenerator?n.idGenerator(c):xi(),S=new AbortController;let v,C;function A(T){C=T,S.abort()}u&&(u.aborted?A(Ws):u.addEventListener("abort",()=>A(Ws),{once:!0}));const I=(async function(){let T;try{let g=n?.condition?.(c,{getState:f,extra:y});if(Th(g)&&(g=await g),g===!1||S.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise((l,b)=>{v=()=>{b({name:"AbortError",message:C||"Aborted"})},S.signal.addEventListener("abort",v,{once:!0})});h(o(E,c,n?.getPendingMeta?.({requestId:E,arg:c},{getState:f,extra:y}))),T=await Promise.race([m,Promise.resolve(r(c,{dispatch:h,getState:f,extra:y,requestId:E,signal:S.signal,abort:A,rejectWithValue:((l,b)=>new Hi(l,b)),fulfillWithValue:((l,b)=>new Qs(l,b))})).then(l=>{if(l instanceof Hi)throw l;return l instanceof Qs?i(l.payload,E,c,l.meta):i(l,E,c)})])}catch(g){T=g instanceof Hi?a(null,E,c,g.payload,g.meta):a(g,E,c)}finally{v&&S.signal.removeEventListener("abort",v)}return n&&!n.dispatchConditionRejection&&a.match(T)&&T.meta.condition||h(T),T})();return Object.assign(I,{abort:A,requestId:E,arg:c,unwrap(){return I.then(Oh)}})}}return Object.assign(s,{pending:o,rejected:a,fulfilled:i,settled:Ve(a,i),typePrefix:t})}return e.withTypes=()=>e,e})();function Oh(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Th(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Ch=Symbol.for("rtk-slice-createasyncthunk");function Ah(e,t){return`${e}/${t}`}function Ih({creators:e}={}){const t=e?.asyncThunk?.[Ch];return function(n){const{name:i,reducerPath:o=i}=n;if(!i)throw new Error(we(11));const a=(typeof n.reducers=="function"?n.reducers(Mh()):n.reducers)||{},s=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(T,g){const m=typeof T=="string"?T:T.type;if(!m)throw new Error(we(12));if(m in c.sliceCaseReducersByType)throw new Error(we(13));return c.sliceCaseReducersByType[m]=g,u},addMatcher(T,g){return c.sliceMatchers.push({matcher:T,reducer:g}),u},exposeAction(T,g){return c.actionCreators[T]=g,u},exposeCaseReducer(T,g){return c.sliceCaseReducersByName[T]=g,u}};s.forEach(T=>{const g=a[T],m={reducerName:T,type:Ah(i,T),createNotation:typeof n.reducers=="function"};Dh(g)?jh(m,g,u,t):Rh(m,g,u)});function h(){const[T={},g=[],m=void 0]=typeof n.extraReducers=="function"?Vs(n.extraReducers):[n.extraReducers],l={...T,...c.sliceCaseReducersByType};return _h(n.initialState,b=>{for(let d in l)b.addCase(d,l[d]);for(let d of c.sliceMatchers)b.addMatcher(d.matcher,d.reducer);for(let d of g)b.addMatcher(d.matcher,d.reducer);m&&b.addDefaultCase(m)})}const f=T=>T,y=new Map,E=new WeakMap;let S;function v(T,g){return S||(S=h()),S(T,g)}function C(){return S||(S=h()),S.getInitialState()}function A(T,g=!1){function m(b){let d=b[T];return typeof d>"u"&&g&&(d=ln(E,m,C)),d}function l(b=f){return ln(ln(y,g,()=>new WeakMap),b,()=>{const d={};for(const[_,P]of Object.entries(n.selectors??{}))d[_]=wh(P,b,()=>ln(E,b,C),g);return d})}return{reducerPath:T,getSelectors:l,get selectors(){return l(m)},selectSlice:m}}const I={name:i,reducer:v,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:C,...A(o),injectInto(T,{reducerPath:g,...m}={}){const l=g??o;return T.inject({reducerPath:l,reducer:v},m),{...I,...A(l,!0)}}};return I}}function wh(e,t,r,n){function i(o,...a){let s=t(o);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return i.unwrapped=e,i}var ge=Ih();function Mh(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function Rh({type:e,reducerName:t,createNotation:r},n,i){let o,a;if("reducer"in n){if(r&&!Nh(n))throw new Error(we(17));o=n.reducer,a=n.prepare}else o=n;i.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,a?he(e,a):he(e))}function Dh(e){return e._reducerDefinitionType==="asyncThunk"}function Nh(e){return e._reducerDefinitionType==="reducerWithPrepare"}function jh({type:e,reducerName:t},r,n,i){if(!i)throw new Error(we(18));const{payloadCreator:o,fulfilled:a,pending:s,rejected:c,settled:u,options:h}=r,f=i(e,o,h);n.exposeAction(t,f),a&&n.addCase(f.fulfilled,a),s&&n.addCase(f.pending,s),c&&n.addCase(f.rejected,c),u&&n.addMatcher(f.settled,u),n.exposeCaseReducer(t,{fulfilled:a||mn,pending:s||mn,rejected:c||mn,settled:u||mn})}function mn(){}var Ks="listener",Ys="completed",Xs="cancelled",W0=`task-${Xs}`,K0=`task-${Ys}`,Y0=`${Ks}-${Xs}`,X0=`${Ks}-${Ys}`,{assign:Js}=Object,zi="listenerMiddleware",Lh=Js(he(`${zi}/add`),{withTypes:()=>Lh}),J0=he(`${zi}/removeAll`),kh=Js(he(`${zi}/remove`),{withTypes:()=>kh});function we(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}function Fh(e){return e}function Zs({data:e,...t},r){return t.error?t:{data:r(e,t.meta),...t}}function Uh({data:e,...t},r){return t.error?t:{data:e.map(n=>r(n,t.meta)),...t}}function ce(e){return t=>Zs(t,e)}function Bh(e){return!e.hasOwnProperty("previous")}function hn(e){return t=>Zs(t,(r,n)=>Bh(r)?e(r,n):e(r.previous,n))}function Pe(e){return t=>Uh(t,e)}var eu={editorThemeColor:"light",isSettingsDisabled:!1,emailAutosaveTimestamps:{},settings:{backgroundColor:"",backgroundImage:[{type:"url",value:""}],backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",textStrong:!1,textItalic:!1,textUnderline:!1},elementSettings:{},searchFilters:{},emailCommonStyles:"",saveTime:null,mobileViewActive:{shutdown:!0,styles:!0},isCodeMode:!1,codeModeDirection:void 0,emailViewType:void 0,changeKey:null,problemsList:[],codeErrors:[],activeProblemRange:null,emailGroups:{},projectGroups:[],isNeedUpdateAppearance:!1,isNeedUpdateContentAppearance:!1},ke="emailSlice",tu=ge({name:ke,initialState:eu,reducers:{setEditorThemeColor:(e,t)=>{e.editorThemeColor=t.payload},setEmailSettings:(e,{payload:t})=>{Object.assign(e,{...e,settings:{...t},isSettingsDisabled:!1})},setEmailSettingsDisable:(e,t)=>{e.isSettingsDisabled=t.payload},setElementSettings:(e,{payload:t})=>{e.elementSettings=t},setSearchFilters:(e,t)=>{e.searchFilters=t.payload},updateSearchFilters:(e,t)=>{e.searchFilters={...e.searchFilters,...t.payload}},resetEmailSlice:e=>{const t=e.emailAutosaveTimestamps;return{...eu,emailAutosaveTimestamps:t}},rememberAutosaveTime:(e,{payload:t})=>{e.emailAutosaveTimestamps[t.emailId]=t.modified},applyProjectGroups:(e,{payload:t})=>{const r=t.projectGroups;e.projectGroups=r;const n=t.emailGroup;if(!n)return;const i={};n.length&&r.length&&n.forEach(o=>{r.forEach(a=>{const s=(a.children||[]).find(c=>c.id===o);s&&(i.hasOwnProperty(a.id)||(i[a.id]=[]),i[a.id].push({label:s.name,value:s.id}))})}),e.emailGroups=i},setCodeErrors:(e,t)=>{e.codeErrors=t.payload},setProblemsList:(e,t)=>{e.problemsList=t.payload},setActiveProblemRange:(e,t)=>{e.activeProblemRange=t.payload},markAppearanceNeedsUpdate:e=>{e.isNeedUpdateAppearance=!0,e.isNeedUpdateContentAppearance=!0},setIsNeedUpdateContentAppearance:(e,t)=>{e.isNeedUpdateContentAppearance=t.payload},setIsNeedUpdateAppearance:(e,t)=>{e.isNeedUpdateAppearance=t.payload},setEmailGroups:(e,{payload:t})=>{const r=Object.keys(t)[0],n=e.emailGroups,i=e.projectGroups,o={};i.length&&(t[r]?.forEach(a=>{const s=i.find(u=>u.id===+r),c=(s?.children||[]).find(u=>u.id===+a);c?(o.hasOwnProperty(s.id)||(o[s.id]=[]),o[s.id].push({label:c.name,value:c.id})):(o.hasOwnProperty(r)||(o[r]=[]),o[r].push({label:a,value:null}))}),t[r].length===0&&(o[r]=[])),e.emailGroups={...n,...o}}}}),{setEditorThemeColor:$h,setEmailSettings:Gh,setElementSettings:qh,setEmailSettingsDisable:xh,setSearchFilters:Z0,updateSearchFilters:eM,resetEmailSlice:Hh,rememberAutosaveTime:Vh,applyProjectGroups:zh,setProblemsList:Qh,setCodeErrors:tM,setActiveProblemRange:Wh,setEmailGroups:Kh,markAppearanceNeedsUpdate:Yh,setIsNeedUpdateAppearance:Xh,setIsNeedUpdateContentAppearance:Jh}=tu.actions;function Zh(e,t){return zh({projectGroups:e??[],emailGroup:Array.isArray(t)?t:void 0})}var eg=e=>e[ke].isNeedUpdateContentAppearance,tg=e=>e[ke].settings,rg=e=>e[ke].problemsList,ng=e=>e[ke].projectGroups,ig=e=>e[ke].elementSettings,og=e=>e[ke].editorThemeColor,ag=e=>e[ke].isSettingsDisabled,sg=e=>e[ke].activeProblemRange,ug=e=>e[ke].isNeedUpdateAppearance,cg={text:{fontFamily:["Google Fonts","Sans Serif","Mulish","Regular"],fontSize:16,fontSizeDim:"px",lineHeight:24,lineHeightDim:"px",color:"#595959",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},headings:{fontFamily:["Google Fonts","Sans Serif","Mulish","Bold"],fontSize:28,fontSizeDim:"px",lineHeight:34,lineHeightDim:"px",color:"#000000",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},links:{color:"#1890ff",contrastColor:"#FFFFFF",underline:!0},buttons:{fontFamily:["Google Fonts","Sans Serif","Mulish","Medium"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1890ff",bold:!1,italic:!1,backgroundColor:"#1890ff",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:6,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},textAlign:"center",padding:{all:null,top:null,right:null,bottom:null,left:null}},block:{backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1890ff",padding:{all:null,top:null,right:null,bottom:null,left:null}},cards:{contrastBackgroundColor:"#1890ff",contrastTextColor:"#ffffff",baseBackgroundColor:"#f8f8f8",baseTextColor:"#333333",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}}},lg="ERROR",dg="useblocks",Qi={em_token:"em_access_token",em_refresh_token:"em_refresh_token",em_elements_view:"em_elements_view",em_new_block:"em_new_block",em_new_email:"em_new_email",em_id:"em_id",em_name:"em_name",em_email:"em_email",em_locale:"em_locale",em_carrotquest_hash:"em_carrotquest_hash",em_ducalis_hash:"em_ducalis_hash",em_email_subscription_consent:"em_email_subscription_consent",em_folder:"em_folder",promocode:"promocode",em_active_tab:"em_active_tab"},pt={em_color_scheme:"em_color_scheme",em_code_mode_pane_sizes:"em_code_mode_pane_sizes",em_preview_pane_sizes:"em_preview_pane_sizes",em_default_sizes:"em_default_sizes",em_pane_sizes:"em_pane_sizes",em_test_emails:"em_test_emails",em_menu_is_locked:"em_menu_is_locked",em_code_mode_settings:"em_code_mode_settings",em_folder_is_open:"em_folder_is_open",em_active_tab:"em_active_tab",em_ai_settings:"em_ai_settings",em_last_active_page:"em_last_active_page",em_layout_convert_never_suggest:"em_layout_convert_never_suggest",em_filemanager_v2:"em_filemanager_v2",em_projects_v2:"em_projects_v2",em_translations_v2:"em_translations_v2",em_defer_chrome:"em_defer_chrome",em_stripo_import:"em_stripo_import",em_guest_locale:"em_guest_locale"},fg="not all",pg="light",mg="dark",hg="system",gg="(prefers-color-scheme: light)",bg="(prefers-color-scheme: dark)",yg={auth:"/auth",projects_index:"/",projects:"/projects",project:"/projects/:projectId/emails",email:"/projects/:projectId/emails/:emailId",create_email:"/projects/:projectId/emails/new",blocks:"/projects/:projectId/blocks",block:"/projects/:projectId/blocks/:blockId",create_block:"/projects/:projectId/blocks/new",billing:"/billing"},le={ADD_NEW_PROJECT_MODAL:"ADD_NEW_PROJECT_MODAL",BLOCKS_MODAL:"BLOCKS_MODAL",EDIT_PROFILE_MODAL:"EDIT_PROFILE_MODAL",SEND_TEST_EMAIL:"SEND_TEST_EMAIL",ADD_NEW_EBLOCK_MODAL:"ADD_NEW_EBLOCK_MODAL",UPDATE_GLOBAL_BLOCKS_MODAL:"UPDATE_GLOBAL_BLOCKS_MODAL",SAVE_GLOBAL_BLOCK_CHOICE_MODAL:"SAVE_GLOBAL_BLOCK_CHOICE_MODAL",ADD_NEW_EMAIL_MODAL:"ADD_NEW_EMAIL_MODAL",ADD_NEW_AI_EMAIL:"ADD_NEW_AI_EMAIL",STRIPO_IMPORT:"STRIPO_IMPORT",STRIPO_IMPORT_RESULT:"STRIPO_IMPORT_RESULT",SWITCH_TO_PLAN_MODAL:"SWITCH_TO_PLAN_MODAL",IMAGE_EDITOR_MODAL:"IMAGE_EDITOR_MODAL",ADD_NEW_FOLDER_MODAL:"ADD_NEW_FOLDER_MODAL",EDIT_FOLDER_NAME_MODAL:"EDIT_FOLDER_NAME_MODAL",ADD_NEW_GROUP_MODAL:"ADD_NEW_GROUP_MODAL",EDIT_GROUP_NAME_MODAL:"EDIT_GROUP_NAME_MODAL",RENAME_EMAIL_MODAL:"RENAME_EMAIL_MODAL",RENAME_BLOCK_MODAL:"RENAME_BLOCK_MODAL",UPLOAD_IMAGE_MODAL:"UPLOAD_IMAGE_MODAL",UPLOAD_BACKGROUND_MODAL:"UPLOAD_BACKGROUND_MODAL",UPLOAD_IMAGE_MODAL_AI:"UPLOAD_IMAGE_MODAL_AI",UPLOAD_BACKGROUND_MODAL_AI:"UPLOAD_BACKGROUND_MODAL_AI",UPLOAD_IMAGE_MODAL_STOCK:"UPLOAD_IMAGE_MODAL_STOCK",UPLOAD_BACKGROUND_MODAL_STOCK:"UPLOAD_BACKGROUND_MODAL_STOCK",UPLOAD_IMAGE_MODAL_GIF:"UPLOAD_IMAGE_MODAL_GIF",UPLOAD_BACKGROUND_MODAL_GIF:"UPLOAD_BACKGROUND_MODAL_GIF",UPLOAD_IMAGE_MODAL_EDIT:"UPLOAD_IMAGE_MODAL_EDIT",UPLOAD_BACKGROUND_MODAL_EDIT:"UPLOAD_BACKGROUND_MODAL_EDIT",UPLOAD_IMAGE_MODAL_UPLOAD:"UPLOAD_IMAGE_MODAL_UPLOAD",UPLOAD_BACKGROUND_MODAL_UPLOAD:"UPLOAD_BACKGROUND_MODAL_UPLOAD"},vg="application/x-emailmaker-social-reorder",ru="fonts.googleapis.com",nu=e=>{try{const t=new URL(String(e??"").trim());return t.protocol==="https:"?t:null}catch{return null}},_g=e=>{const t=nu(String(e??""));return t?t.hostname===ru&&t.pathname.startsWith("/css")&&!!t.searchParams.get("family"):!1},Eg=e=>{const t=nu(String(e??""));if(!t||t.hostname!==ru)return"";const r=t.searchParams.get("family");return r?r.split(":")[0].trim():""},ur={MESSAGE:"message",INIT_PREVIEW:"init_preview",UPDATE_PREVIEW:"update_preview",UPDATE_EDITOR:"update_editor",UPDATE_EDITOR_POSITION:"update_editor_position",UPDATE_SIDE_MENU_EDITOR:"update_side_menu_editor",SAVE_EMAIL:"saveEmail",SANDBOX_ELEMENT_SETTINGS_SET:"sandbox_element_settings_set",SANDBOX_IMAGE_RESET:M.createIdentifier("sandbox_image_reset"),SANDBOX_NATIVE_IMAGE_DROP_CLEAR:"sandbox_native-image-drop-clear",SANDBOX_EMAIL_SETTINGS_SET:"sandbox_email_settings_set",SANDBOX_BLOCK_SETTINGS_SET:"sandbox_block_settings_set",SANDBOX_ELEMENT_PARENT_GET:"sandbox_element_parent_get",SANDBOX_ELEMENT_PARENT_TABLE_GET:"sandbox_element_parent_table_get",SANDBOX_ELEMENT_PREV_GET:"sandbox_element_prev_get",SANDBOX_ELEMENT_NEXT_GET:"sandbox_element_next_get",SANDBOX_ELEMENT_REMOVE:"sandbox_element_remove",SANDBOX_ELEMENT_ACTIVE_RESET:"sandbox_element_active_reset",SANDBOX_ELEMENT_ACTIVE_SET:"sandbox_element_active_set",SANDBOX_ELEMENT_HOVER_SET:"sandbox_element_hover_set",SANDBOX_ELEMENT_IMG_LINK:"sandbox_element_img_link",SANDBOX_ELEMENT_TEXT:"sandbox_element_text",SANDBOX_EMAIL_CONTENT_GET:"sandbox_email_content_get",SANDBOX_SET_POSITION_TO_IMG:"sandbox_set_position_to_img",SANDBOX_SET_POSITION_TO_LINK:"sandbox_set_position_to_link",SANDBOX_ACCORDION_ADD_SECTION:"sandbox_accordion_add_section",SANDBOX_ACCORDION_REMOVE_SECTION:"sandbox_accordion_remove_section",APPLICATION_FOCUS_IN_IFRAME:"application_focus_in_iframe",APPLICATION_EMAIL_SETTINGS_SET:"application_email_settings_set",APPLICATION_BLOCK_SETTINGS_SET:"application_block_settings_set",APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",_APPLICATION_ELEMENT_SETTINGS_SET:M.createIdentifier("application_element_settings_set"),APPLICATION_ELEMENT_SETTINGS_CLOSE:"application_element_settings_close",APPLICATION_ACTION:"application_action",APPLICATION_EBLOCK_ADD:"application_eblock_add",SANDBOX_EBLOCK_SET_EM_BLOCK_ID:"sandbox_eblock_set_em_block_id",SANDBOX_GLOBAL_BLOCK_REPLACE:"sandbox_global_block_replace",APPLICATION_SCROLL_TO:"application_scroll-to",APPLICATION_SCROLL_BLOCK_SHOW:"application_scroll-block-show",APPLICATION_SCROLL_BLOCK_HIDE:"application_scroll-block-hide",APPLICATION_DISCUSS_SET_ID:"application_discuss_set_id",APPLICATION_DISCUSS_GET_COMMENT:"application_discuss_get_comment",APPLICATION_DISCUSS_NO_COMMENT:"application_discuss_no_comment",APPLICATION_DISCUSS_SAVE_TARGET:"application_discuss_save_target",APPLICATION_IFRAME_SET_HEIGHT:"application_iframe_set_height",APPLICATION_COMMON_STYLES_UPDATE:"application_commonStyles_update",APPLICATION_EMAIL_CONTENT_GET:"application_email_content_get",APPLICATION_OPEN_IMAGE_AI_POPUP:"application_open-image-ai-popup",APPLICATION_OPEN_IMAGE_UPLOAD_POPUP:"application_open-image-upload-popup",APPLICATION_OPEN_IMAGE_EDIT_POPUP:"application_open-image-edit-popup",APPLICATION_OPEN_IMAGE_GIF_POPUP:"application_open-image-gif-popup",APPLICATION_OPEN_IMAGE_STOCK_POPUP:"application_open-image-stock-popup",APPLICATION_CLOSE_IMAGE_EDIT_POPUP:"application_close-image-edit-popup",APPLICATION_NATIVE_IMAGE_DROP:"application_native-image-drop",APPLICATION_SUBJECT_UPDATE:M.createIdentifier("application_subject_update"),APPLICATION_PREHEADER_UPDATE:M.createIdentifier("application_preheader_update"),APPLICATION_DOMPARSER_ERROR:M.createIdentifier("application_domparser_error"),APPLICATION_UPDATE_ENTITY:M.createIdentifier("application_update_entity"),APPLICATION_IFRAME_DRAG_EVENT:M.createIdentifier("application_iframe_drag_event"),APPLICATION_HAS_AMP:M.createIdentifier("application_has_amp"),APPLICATION_CANVAS_IMAGE_GET:M.createIdentifier("application_canvas_image_get"),APPLICATION_PREVIEW_ALERT_SHOW:"application_preview_alert_show",APPLICATION_ATOM_INSERTED:M.createIdentifier("application_atom_inserted"),APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW:"application_template_not_em_alert_show",SANDBOX_WINDOW_CHARACTERISTIC:"sandbox_window-characteristic",SANDBOX_IFRAME_SETSIZE:"sandbox_iframe-setsize",SANDBOX_BLOCK_INSERT:"sandbox_block-insert",SANDBOX_ATOM_INSERT:"sandbox_atom-insert",SANDBOX_DRAG_CANCEL:"sandbox_drag-cancel",UPDATE_EDITOR_POSITION_FROM_EDITOR:"update_position_from_editor",UPDATE_EDITOR_POSITION_FROM_IFRAME:"update_position_from_iframe",SANDBOX_CHANGE_PREVIEW:"sandbox_change_preview",APPLICATION_CHANGE_PREVIEW:"application_change_preview",SANDBOX_LOCK_EDIT:"sandbox_lock_edit",SANDBOX_FLOATBLOCK_ADD:"sandbox_floatBlock_add",SANDBOX_FLOATBLOCK_REMOVE:"sandbox_floatBlock_remove",SANDBOX_FLOATBLOCK_COPY:"sandbox_floatBlock_copy",SANDBOX_FLOATBLOCK_SWAP:"sandbox_floatBlock_swap",EDITOR_CHANGE_FOCUS:"editor_change_focus",SANDBOX_RESIZED:"sandbox_resized",SANDBOX_LOCK_DISCUSS:"sandbox_lock_discuss",SANDBOX_DISCUSS_SET_TARGET:"sandbox_discuss_set_target",SANDBOX_DISCUSS_REMOVE_TARGET:"sandbox_discuss_remove_target",SANDBOX_DISCUSS_RESET:"sandbox_discuss_reset",SANDBOX_DISCUSS_GET_TARGET:"sandbox_discuss_get_target",SANDBOX_READY:M.createIdentifier("SANDBOX_READY"),SANDBOX_FLOATBLOCK_WRAP:"sandbox_floatblock_wrap",SANDBOX_FLOATBLOCK_DIR:"sandbox_floatblock_dir",SANDBOX_SUBJECT_UPDATE:M.createIdentifier("sandbox_subject_update"),SANDBOX_PREHEADER_UPDATE:M.createIdentifier("sandbox_preheader_update"),SANDBOX_DRAG_EVENT:M.createIdentifier("sandbox_drag_event"),SANDBOX_WHEEL:M.createIdentifier("sandbox_wheel"),SANDBOX_ADD_MERGETAG:M.createIdentifier("sandbox_add_mergetag"),SANDBOX_TRANSLATIONS:M.createIdentifier("sandbox_send_translations"),SANDBOX_SET_THEME_VARIABLES:M.createIdentifier("sandbox_send_theme_variables"),SANDBOX_SET_PROJECT_FONTS:M.createIdentifier("sandbox_set_project_fonts"),SANDBOX_CANVAS_IMAGE_CACHE_SETUP:M.createIdentifier("sandbox_canvas_image_cache_setup"),SANDBOX_SET_ENTITY:M.createIdentifier("sandbox_set_entity"),SANDBOX_INIT_START:M.createIdentifier("sandbox_init_start"),SANDBOX_INITED:M.createIdentifier("sandbox_inited"),SANDBOX_UPDATE_ENTITY:M.createIdentifier("sandbox_update_entity"),RELOAD:M.createIdentifier("reload"),SANDBOX_ADD_EXTENSIONS:M.createIdentifier("sandbox_add_extensions"),SANDBOX_REMOVE_EXTENSIONS:M.createIdentifier("sandbox_remove_extensions"),SANDBOX_ADD_SCRIPT:M.createIdentifier("sandbox_add_script"),SANDBOX_IS_EMAIL_EMPTY:M.createIdentifier("sandbox_is_email_empty"),SANDBOX_SWITCH_THEME:M.createIdentifier("sandbox_switch_theme")},Sg={language:"html",detectIndentation:!1,wordWrap:"on",wrappingIndent:"same",smoothScrolling:!0,automaticLayout:!0,tabSize:2,indentSize:2},Pg=(function(e){return e.IMG="img",e.TEXT="text",e.LINK="a",e.TABLE="table",e.VINDENT="vindent",e.TD="td",e.STRUCTURE="structure",e.GROUP="group",e.BUTTON="button",e.DIV="div",e.FLOAT_BLOCK="floatBlock",e.VAR="var",e.EMPTY_TABLE="emptyTable",e.EMPTY_TD="emptyTd",e.COUNTDOWN="countdown",e.VIDEO="video",e.COLUMN="column",e.CAROUSEL="carousel",e.ACCORDION="accordion",e.CUSTOM_TABLE="customTable",e.SOCIAL="social",e})({}),Og={ALL:"All",STANDARD:"Standard",PROJECT:"Project"},Tg="Appearance",Cg="Structure",Ag="Settings",Ig="Properties",wg="History",Mg="Disabled_tab",iu="Edit selected element",Rg="UTM parameters",Dg="Annotations parameters",Ng="Table properties",jg="Edit selected table cells",Lg="#b9b1b1",kg="Edit",Fg="AiChat",Wi="Build",Ug="Styles",Bg="Discuss",$g="Blocks",Gg="Atoms",qg="Optimise",xg={top:{width:null,style:null,color:null},right:{width:null,style:null,color:null},bottom:{width:null,style:null,color:null},left:{width:null,style:null,color:null},all:{width:null,style:null,color:null}},Hg="block",ou="email",Vg="cards",zg="pending",Qg="d41d8",Wg="valid",Kg="warnings",Yg="errors",Xg={LINKS:"Links",IMAGES:"Images",SPAM_ASSASSIN:"Spam assassin",PROBLEMS:"Problems"},Jg="1865",au=6892,su="desktop",uu="mobile",Zg="emailtags",eb="blocktags",tb=e=>({REORDER_ATOM:e("Reorder element"),CLONE_ATOM:e("Clone element"),REMOVE_ATOM:e("Remove element"),EDIT_ATOM:e("Edit element"),CHANGE_IMAGE:e("Change image"),CHANGE_IMAGE_EDIT:e("Edit"),CHANGE_IMAGE_STOCK:e("Stock"),CHANGE_IMAGE_CHANGETO:e("Upload"),CHANGE_IMAGE_GIF:e("GIF"),CHANGE_IMAGE_AI:e("Generate"),REORDER_BLOCK:e("Reorder block"),REORDER_BLOCK_UP:e("Move up"),REORDER_BLOCK_DOWN:e("Move down"),EDIT_BLOCK:e("Edit block"),CLONE_BLOCK:e("Clone block"),MERGE_BLOCK:e("Merge with the chosen block"),UNMERGE_BLOCK:e("Split blocks"),COPY_BLOCK_TO_CLIPBOARD:e("Copy block to clipboard"),PASTE_BLOCK_FROM_CLIPBOARD:e("Paste block from clipboard"),REMOVE_BLOCK:e("Remove block"),SAVE_TO_BLOCKS:e("Save to Blocks"),UPDATE_GLOBAL_BLOCK_IN_TEMPLATES:e("Push block update to all templates"),ADD_BLOCK:e("Add block"),ADD_EMPTY_BLOCK:e("Add an empty block"),ADD_SAVED_BLOCK:e("Add a saved block"),ADD_COMMON_BLOCK:e("Add a common block"),ADD_TEMPLATE_BLOCK:e("Add a template block"),ADD_SEARCH_BLOCK:e("Search a block"),REORDER_GROUP:e("Reorder group"),EDIT_GROUP:e("Edit group"),CLONE_GROUP:e("Clone group"),REMOVE_GROUP:e("Remove group"),ADD_GROUP:e("Add group"),LINK:e("link"),TABLE_COLUMN:e("cell"),TABLE:e("table"),FLOAT_BLOCK:e("column"),CONTAINER:e("container"),PICTURE:e("picture"),CAROUSEL:e("carousel"),ACCORDION:e("accordion"),SOCIAL:e("Social media"),VERTICAL_INDENT:e("indent"),TEXT:e("text"),BUTTON:e("button"),VAR:e("variable"),STRUCTURE:e("block"),EMAIL:e("email"),GROUP:e("group"),TYPOGRAF:e("Typograf"),COUNTDOWN:e("countdown"),ELEMENT:e("element"),VIDEO:e("video"),ELEMENT_PATH_LINK:e("Link"),ELEMENT_PATH_BLOCK:e("Block"),ELEMENT_PATH_ATOM:e("Element"),ELEMENT_PATH_TD:e("Cell"),ELEMENT_PATH_TABLE:e("Table"),ELEMENT_PATH_FLOATBLOCK:e("Column"),ELEMENT_PATH_TEXT:e("Text"),ELEMENT_PATH_DIV:e("Container"),ELEMENT_PATH_GROUP:e("Group"),ELEMENT_PATH_EMAIL:e("Email"),ELEMENT_PATH_IMG:e("Picture"),ELEMENT_PATH_VINDENT:e("Indent"),ELEMENT_PATH_BUTTON:e("Button"),ELEMENT_PATH_CAROUSEL:e("Carousel"),ELEMENT_PATH_ACCORDION:e("Accordion"),ELEMENT_PATH_SOCIAL:e("Social media"),ELEMENT_PATH_SECTION:e("Section"),TINYMCE_CHANGECASE:e("Case Change"),TINYMCE_UPPERCASE:e("Uppercase"),TINYMCE_LOWERCASE:e("Lowercase"),PASTE_HERE:e("Drop here"),INSERT_COLUMN_BEFORE_TABLE:e("Insert column before"),INSERT_COLUMN_AFTER_TABLE:e("Insert column after"),INSERT_ROW_BEFORE_TABLE:e("Insert row before"),INSERT_ROW_AFTER_TABLE:e("Insert row after"),MERGE_RIGHT_CELL_TABLE:e("Merge right cell"),MERGE_LEFT_CELL_TABLE:e("Merge left cell"),MERGE_TOP_CELL_TABLE:e("Merge top cell"),MERGE_BOTTOM_CELL_TABLE:e("Merge bottom cell"),SPLIT_CELL_TABLE:e("Split cell"),REMOVE_COLUMN_TABLE:e("Remove column"),REMOVE_ROW_TABLE:e("Remove row"),DROP_BLOCK_HINT:e("Click or drag a block")}),rb={Applications:"Apps",Articles:"Article",Banners:"Banners",Buttons:"Buttons","Call to Action":"Call to Action",Contacts:"Contacts",Content:"Content","E-Commerce":"E-Commerce",Feature:"Features",Footer:"Footers",Header:"Headers",Lists:"Lists",Menu:"Menus",Other:"Others",Polls:"Polls",Promocodes:"Promocodes",Separators:"Separators"},cu={maker:"https://ai-mail.emcdn.ru",blocks:"https://ai-mail.useblocks.io"},nb=/^(?:ant|vscode|monaco|docs)-/;function ib(e){return nb.test(e)}function ob(){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 ab=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function sb(){return ab}var ub=new Set;function cb(e,t,r=ub){return e.startsWith(`${t}-`)?!1:!ib(e)&&!r.has(e)}function lb(e,t){return`--${t}-${e}`}function cr(e){const t=ob();return cb(e,t,sb())?lb(e,t):`--${e}`}function db(e,t){const r=cr(e);return t!==void 0?`var(${r}, ${t})`:`var(${r})`}function fb(e,t){return db(e,t)}function pb(e){return cr(e)}function lu(e){return e.getOrCreateInstance(M.MESSAGE_SERVICE_ID,()=>new M.MessageService)}var mb=new WeakMap,du=new WeakMap;function hb(e){return mb.get(e)??0}function gb(e,t){let r=du.get(e);return r||(r=new Set,du.set(e,r)),r.add(t),()=>{r?.delete(t)}}var fu=M.INJECTION,bb=e=>e??M.createIdentifier$1();function ze(){const e=pe();return(0,N.useMemo)(()=>M.getContainer(e),[e])}function yb(e,t){const r=pe(),n=(0,N.useMemo)(()=>t||M.getContainer(r),[r,t]),[i,o]=(0,N.useState)(()=>n?.getInstance(e));return(0,N.useEffect)(()=>{const a=n?.onInject(s=>{s===e&&o(n.getInstance(e))});return()=>a?.dispose()},[e,n]),i}function vb(e,t){const r=pe(),n=(0,N.useMemo)(()=>t||M.getContainer(r),[r,t]),[i,o]=(0,N.useState)(()=>n?.getServices(e)||[]);return(0,N.useEffect)(()=>{if(!n)return;const a=n.onInject(s=>{s===M.getServiceContainerId(e)&&o(n.getServices(e))});return()=>{a?.dispose()}},[e,n]),i}function pu(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function _b(e,t){const r=pu(e,t);return e.serverSide.advancedConfigs?.[r]||{}}function Eb(e,t){const r=pu(e,t),n=e.user?.advancedConfigs?.[r],i=n!==void 0?n:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[r],...i}}function Sb(e,t,r){const n=_b(e,r),i=Eb(e,r);return M.pickKey([i,e.user,n,e.serverSide],t)}var Pb=M.createIdentifier$1("planFeatures.source");function Ob(e){return e.getOrCreateInstance(Pb,()=>Le(void 0))}function Tb(e,t){if(e&&Object.prototype.hasOwnProperty.call(e,t))return!!e[t]}function ot(e){return e?.getInstance(M.CONFIG_SOURCE_ID)?.get()??{}}function Ki(){const e=ze().getInstance(M.CONFIG_SOURCE_ID);if(!e)throw new Error("[config] источник конфигурации не зарегистрирован: нет provideConfig");return e}function gn(){const e=Ki();(0,N.use)(e.ready());const t=(0,N.useCallback)(i=>{const o=e.watch(i);return()=>o.dispose()},[e]),r=(0,N.useSyncExternalStore)(t,()=>e.get()),n=Cb();return(0,N.useMemo)(()=>r,[r,n])}function Cb(){const e=ze(),t=Ob(e),r=(0,N.useCallback)(n=>{const i=t.watch(n);return()=>i.dispose()},[t]);return(0,N.useSyncExternalStore)(r,()=>t.get())}function Ab(e){const t=Ki();return gn(),Sb(t.layers(),e)}function Ib(){const e=ze(),t=(0,N.useCallback)(n=>{if(!e)return()=>{};const i=Ti(e).watch(n);return()=>i.dispose()},[e]),r=(0,N.useCallback)(()=>fm(e),[e]);return(0,N.useSyncExternalStore)(t,r,r)}function wb(e){return e.hasOwnProperty("children")}function mu(e,t,r){return e?.length?e.map((n,i)=>wb(n)?{key:M.generateUUID(),value:n.value,label:n.label,children:mu(n.children,t,r),type:"group"}:{key:M.generateUUID(),label:n.label,value:n.value,onClick:o=>{r(n.value,o.domEvent)}}):void 0}var Mb=(e,t)=>{const r=()=>{try{const n={...e,appLabel:"blocks_app"};window.dataLayer&&typeof window.dataLayer.push=="function"&&window.dataLayer.push(n);const i=typeof n.event=="string"&&n.event.trim()?n.event.trim():null,o=(typeof n.action=="string"&&n.action.trim()?n.action.trim():null)||(typeof n.event_action=="string"&&n.event_action.trim()?n.event_action.trim():null);let a;i&&o?a=`${i}_${o}`:i?a=i:o?a=o:a="event";const{event:s,action:c,...u}=n;"event_action"in u&&delete u.event_action;const h={...u,...i?{event:i}:{},...o?{action:o}:{}};typeof window<"u"&&window.amplitude&&typeof window.amplitude.track=="function"&&window.amplitude.track(a,h)}catch{}};t?setTimeout(r,t):r()},lr=()=>{const e=gn();return(0,N.useCallback)((t,r)=>{e.pushToGTM!==!1&&Mb(t,r)},[e.pushToGTM])},Rb="change",Db="element_setting",Nb={textStrong:"bold",textItalic:"italic",textUnderline:"underline",textStrikethrough:"strikethrough",textSuperscript:"superscript",textSubscript:"subscript",widthDim:"width_unit",heightDim:"height_unit",fontSizeDim:"font_size_unit",lineHeightDim:"line_height_unit",letterSpacingDim:"letter_spacing_unit"},jb=new Set(["width","height","padding","margin","font_size","line_height","letter_spacing","border_radius","border","box_shadow","opacity","color","background_color","border_color","text_color"]),Lb=new Set(["activateSection","changeKey","classNamePrefix","parent","path","type","caption","deletable","nextElem","prevElem","floatBlocks","usedColors"]),kb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").toLowerCase(),Fb=e=>Nb[e]??kb(e),Yi=e=>e.length>100?e.slice(0,100):e,Ub=e=>{if(e==null)return null;const t=typeof e;if(t==="boolean"||t==="number")return e;if(t==="string")return Yi(e);if(t==="object"){const r=e;if("value"in r){const n=typeof r.dim=="string"?r.dim:"",i=r.value===null||r.value===void 0?"":String(r.value);return Yi(`${i}${n}`)}try{return Yi(JSON.stringify(r))}catch{return null}}return null},Bb=(e,t)=>{if(!e||!t||typeof t!="object")return[];const r=[];for(const[n,i]of Object.entries(t))Lb.has(n)||i===void 0||r.push({event:Rb,action:Db,element_type:e,property:Fb(n),property_value:Ub(i)});return r},$b=e=>jb.has(e),Gb=(e,t=600)=>{const r=new Map,n=new Map,i=s=>{const c=r.get(s);c&&(clearTimeout(c),r.delete(s));const u=n.get(s);u&&(n.delete(s),e(u))};return{track:(s,c)=>{const u=Bb(s,c);for(const h of u){if(!$b(h.property)){e(h);continue}const f=`${h.element_type}:${h.property}`,y=r.get(f);y&&clearTimeout(y),n.set(f,h),r.set(f,setTimeout(()=>i(f),t))}},flush:()=>{Array.from(r.keys()).forEach(s=>i(s))}}};function bn(){const e=pe();return(0,N.useMemo)(()=>lu(M.getContainer(e)),[e])}function qb(){const e=bn(),t=lr(),r=(0,N.useRef)(t);r.current=t;const n=(0,N.useRef)(void 0);return n.current||(n.current=Gb(i=>r.current(i))),(0,N.useCallback)(function(i){e.send(i),i?.operation===ur.SANDBOX_ELEMENT_SETTINGS_SET&&i.type&&i.settings&&typeof i.settings=="object"&&n.current?.track(i.type,i.settings)},[e])}function xb(){const e=bn();return(0,N.useCallback)(function(t,r){e.send(t,r)},[e])}var hu=(0,N.createContext)({element:void 0}),Hb=()=>(0,N.useContext)(hu)?.element,gu=(0,N.createContext)(void 0),Vb=()=>(0,N.useContext)(gu),bu=(0,N.createContext)(!1),zb=()=>(0,N.useContext)(bu);function yu(e){return M.createIdentifier$1(e)}function vu(e,t){return e.getOrCreateInstance(t,()=>new M.AsyncEmitter)}function Qb(e,t){return e.getOrCreateInstance(t,()=>new M.AsyncEmitter).event}function Wb(e){return Xi(e).event}function Xi(e){const t=pe();return(0,N.useMemo)(()=>vu(M.getContainer(t),e),[t,e])}var _u=class{_listeners=[];add(e,t=0,r){const n={fn:r?e.bind(r):e,priority:t};return this._listeners.push(n),{dispose:()=>{const i=this._listeners.indexOf(n);i>=0&&this._listeners.splice(i,1)}}}async run(e){const t=[...this._listeners].sort((r,n)=>n.priority-r.priority);for(const{fn:r}of t){const n=await r(e);n!==null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof RegExp)&&Object.assign(e,n)}return e}},Kb=M.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),Yb=M.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE");function Xb(e){return e.getOrCreateInstance(Kb,()=>new _u)}function Jb(e){return e.getOrCreateInstance(Yb,()=>new _u)}async function Zb(e,t){return e?Xb(e).run({...t}):t}async function ey(e,t){return e?Jb(e).run({...t}):t}var ty=M.createIdentifier$1("ComponentRegistry"),Ji;function ry(e){Ji=e}function ny(e,t=ty){const r=M.DependencyResolver.getInstance(t);if(r)return r;if(!Ji)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return M.DependencyResolver.getOrCreateInstance(t,Ji)}var iy=class{_factories=new Map;add(e,t){const r=e;return this._factories.set(r,t),{dispose:()=>{this._factories.get(r)===t&&this._factories.delete(r)}}}get(e){return this._factories.get(e)}},Eu=M.createIdentifier$1("DomComponentRegistry");function oy(e,t=Eu){return M.DependencyResolver.getOrCreateInstance(t,()=>new iy)}function ay(e){return typeof e=="function"}function At(e){return(0,N.isValidElement)(e)}function sy(e){return typeof e=="function"||At(e)}function uy(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!At(e)}function Zi(e,t){return(0,N.createElement)(e,t)}function cy(e){return class extends N.Component{_ref=(0,N.createRef)();_instance;componentDidMount(){this._ref.current&&(this._instance=e(this.props),this._ref.current.appendChild(this._instance.node))}componentDidUpdate(r){this._instance?.update&&this._instance.update(this.props)}componentWillUnmount(){this._instance?.dispose&&this._instance.dispose()}render(){return(0,N.createElement)("div",{ref:this._ref})}}}var ly=class{_domComponentRegistry;_components=new Map;_domAdapters=new Map;constructor(e){this._domComponentRegistry=e}add(e,t){return this.override(e,()=>t)}addDom(e,t){const r=e;this._domAdapters.delete(r);const n=this._domComponentRegistry.add(e,t);return{dispose:()=>{this._domAdapters.delete(r),n.dispose()}}}override(e,t){const r=e;let n=this._components.get(r);n||(n={replacers:[]},this._components.set(r,n));const i=()=>{const o=n.replacers.findIndex(a=>a.replacer===t);o>=0&&(n.replacers.splice(o,1),this._recomputeComponent(r,n))};return n.replacers.push({replacer:t,dispose:i}),this._recomputeComponent(r,n),{dispose:i}}_recomputeComponent(e,t){t.component=t.replacers.reduce((r,{replacer:n})=>n(r),void 0)}get(e){if(sy(e))return e;const t=e,r=this._components.get(t);if(r?.component)return r.component;const n=this._domComponentRegistry.get(e);if(n){let i=this._domAdapters.get(t);return i||(i=cy(n),this._domAdapters.set(t,i)),i}}_resolveComponentInput(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean"||At(e))return e;if(typeof e=="string"){const t=this.get(e);return At(t)?t:t?Zi(t):e}if(ay(e))return Zi(e);if(uy(e)){const t=this.get(e.type);return At(t)?t:t?Zi(t,e.props):null}return null}getReactNode(e){return this._resolveComponentInput(e)}getReactElement(e){const t=this._resolveComponentInput(e);return At(t)?t:typeof t=="string"||t==null||typeof t=="boolean"||typeof t=="number"?(0,N.createElement)(N.Fragment,null,t):(0,N.createElement)(N.Fragment,null)}};ry(()=>new ly(oy(M.DependencyResolver,Eu)));function Su(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}var dy=365.2425,fy=Math.pow(10,8)*24*60*60*1e3,Pu=6e4,Ou=36e5,rM=-fy,py=3600,Tu=py*24,nM=Tu*7,my=Tu*dy,hy=my/12,iM=hy*3;function gy(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function by(e,t){var r;Su(1,arguments);var n=gy((r=t?.additionalDigits)!==null&&r!==void 0?r:2);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var i=Ey(e),o;if(i.date){var a=Sy(i.date,n);o=Py(a.restDateString,a.year)}if(!o||isNaN(o.getTime()))return new Date(NaN);var s=o.getTime(),c=0,u;if(i.time&&(c=Oy(i.time),isNaN(c)))return new Date(NaN);if(i.timezone){if(u=Ty(i.timezone),isNaN(u))return new Date(NaN)}else{var h=new Date(s+c),f=new Date(0);return f.setFullYear(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate()),f.setHours(h.getUTCHours(),h.getUTCMinutes(),h.getUTCSeconds(),h.getUTCMilliseconds()),f}return new Date(s+c+u)}var yn={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},yy=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,vy=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,_y=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Ey(e){var t={},r=e.split(yn.dateTimeDelimiter),n;if(r.length>2)return t;if(/:/.test(r[0])?n=r[0]:(t.date=r[0],n=r[1],yn.timeZoneDelimiter.test(t.date)&&(t.date=e.split(yn.timeZoneDelimiter)[0],n=e.substr(t.date.length,e.length))),n){var i=yn.timezone.exec(n);i?(t.time=n.replace(i[1],""),t.timezone=i[1]):t.time=n}return t}function Sy(e,t){var r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),n=e.match(r);if(!n)return{year:NaN,restDateString:""};var i=n[1]?parseInt(n[1]):null,o=n[2]?parseInt(n[2]):null;return{year:o===null?i:o*100,restDateString:e.slice((n[1]||n[2]).length)}}function Py(e,t){if(t===null)return new Date(NaN);var r=e.match(yy);if(!r)return new Date(NaN);var n=!!r[4],i=dr(r[1]),o=dr(r[2])-1,a=dr(r[3]),s=dr(r[4]),c=dr(r[5])-1;if(n)return My(t,s,c)?Cy(t,s,c):new Date(NaN);var u=new Date(0);return!Iy(t,o,a)||!wy(t,i)?new Date(NaN):(u.setUTCFullYear(t,o,Math.max(i,a)),u)}function dr(e){return e?parseInt(e):1}function Oy(e){var t=e.match(vy);if(!t)return NaN;var r=eo(t[1]),n=eo(t[2]),i=eo(t[3]);return Ry(r,n,i)?r*Ou+n*Pu+i*1e3:NaN}function eo(e){return e&&parseFloat(e.replace(",","."))||0}function Ty(e){if(e==="Z")return 0;var t=e.match(_y);if(!t)return 0;var r=t[1]==="+"?-1:1,n=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return Dy(n,i)?r*(n*Ou+i*Pu):NaN}function Cy(e,t,r){var n=new Date(0);n.setUTCFullYear(e,0,4);var i=n.getUTCDay()||7,o=(t-1)*7+r+1-i;return n.setUTCDate(n.getUTCDate()+o),n}var Ay=[31,null,31,30,31,30,31,31,30,31,30,31];function Cu(e){return e%400===0||e%4===0&&e%100!==0}function Iy(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(Ay[t]||(Cu(e)?29:28))}function wy(e,t){return t>=1&&t<=(Cu(e)?366:365)}function My(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}function Ry(e,t,r){return e===24?t===0&&r===0:r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}function Dy(e,t){return t>=0&&t<=59}var Ny=Object.freeze({});function jy(){return null}function to(){return Ny}function Ly(){return""}function ro(){return ky}function ky(){}function Fy(){return(0,N.useMemo)(()=>({get:()=>null,set:()=>{}}),[])}var Au=["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"],Uy=[...Au,"html","id","project","password"],no=new Set(["html",...Au,"global_block","project"]),By=new Set(["title","slug","type","modified","author","subject","description","excerpt","status","link","renderGuid","date","date_gmt","modified_gmt","comment_status","ping_status","template","related_email","project_title","project_author"]),$y=new Set(["tags","blocktags","lock","is_template","isAmp","global_block"]);function Iu(e,t){return no.has(e)?e==="html"?typeof t=="string":e==="meta"?t!=null&&typeof t=="object":e==="project"?t!=null:By.has(e)?t!=null&&t!=="":$y.has(e)?t!=null:t!==void 0:!1}function Gy(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 r=new Set(Uy),n={};for(const i of Object.keys(e))r.has(i)||(n[i]=e[i]);return Object.keys(n).length>0&&(t.catalogExtra=n),t}function qy(e,t){return{...Gy(e),html:t.html||"",insertFrom:t.insertFrom,fragmentRole:t.fragmentRole,name:t.name,project:t.project}}var xy=class extends M.BaseEmitter{async execute([e],t){for(const r of t){const n=await r(e);n&&(n.id===void 0&&(n.id=e.value.id),e.value=n)}return e.value}},Hy=class extends M.AsyncEmitter{};function oM(e){return e}var wu=class extends M.Disposable{_items=new Map;_onChangeEmitter=new M.Signal;async _getOrCreate(e,t){const r=this._items;let n;if(r.has(e))try{n=await r.get(e)}catch{t&&(n=await t())}else t&&(n=await t(),n&&this._onChangeEmitter.fire());return n}async _addOrUpdate(e,t){let r;const n=this._items;if(n.has(e))try{r=await n.get(e)}catch{}const i=await t(r);return M.deepEqual(r,i)||this._onChangeEmitter.fire(),i}entries(){return Promise.all([...this._items.entries()].map(([e,t])=>t.then(r=>[e,r]))).then(e=>e.filter(([t,r])=>!!r))}values(){return Promise.all([...this._items.values()].map(e=>e).filter(e=>!!e))}getOrCreate(e,t){const r=this._getOrCreate(e,()=>t(e));return this._items.set(e,r),r}addOrUpdate(e,t){const r=this._addOrUpdate(e,t);return this._items.set(e,r),r}async getIfPresent(e){if(this._items.has(e))try{return await this._items.get(e)}catch{return}}add(e,t){const r=Promise.resolve(t);return this._items.set(e,r),r}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=[],r=new Set(Array.from(e).map(([i,o])=>i)),n=(await this.entries()).filter(([i,o])=>!r.has(i));for(const[i,o]of e)t.push(this.addOrUpdate(i,()=>o)),r.add(i);for(const[i]of n)t.push(this.remove(i));return await Promise.all(t),n}finally{this.resumeChange()}}clear(){this._items.clear(),this._onChangeEmitter.fire()}suspendChange(){this._onChangeEmitter.suspend()}resumeChange(){this._onChangeEmitter.resume()}onChange=this._onChangeEmitter.event};function Vy(e,{filter:t,order:r="asc",orderBy:n,page:i,pageSize:o=20}={}){const a=e.length;let s=e.length;if(t!==void 0){const c=Object.keys(t);e=e.filter(u=>{for(const h of c){const f=u[h],y=t[h];return h==="id"||typeof f!="string"?f===y:typeof y=="string"&&f.startsWith(y)}return!0}),s=e.length}return n&&(e=e.sort((c,u)=>(c[n]>u[n]?1:u[n]>c[n]?-1:0)*(r==="asc"?1:-1))),i!==void 0&&(e=e.slice(o*(i-1),o*i)),{data:e,filteredTotal:s,total:a,totalPages:Math.ceil(s/o)}}var zy=1e3;function Mu(e,t,r=zy,n=0){if(n>r||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 a of i)if(!Mu(e[a],t[a],r,n+1))return!1;return!0}return!1}function Ru(e,t){if(!e||typeof e!="object")return t;if(!t||typeof t!="object")return{};const r={};for(const n of Object.keys(t)){const i=t[n],o=e[n];Mu(i,o)||(r[n]=i)}return r}function Qy(e=[]){if(e=e.filter(r=>r),e.length<=1)return e[0];const t=new Map;for(const r of e)for(const n of r)if(n.id!==void 0){const i=t.get(n.id)||{};t.set(n.id,{...i,...n})}return[...t].map(([r,n])=>n)}function Wy(e,t){return Du(e)&&Du(t)?String(e)===String(t):e===t}function Du(e){return typeof e=="string"||typeof e=="number"}var Ky=class extends M.Disposable{_cache=new wu;_readEmitter=new M.AsyncEmitter;_saveEmitter=this.addDisposable(new xy);_removeEmitter=this.addDisposable(new Hy);_foreignCache=Object.create(null);async get(e){return this._cache.getOrCreate(e,async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter(r=>!!r)))}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const r=this.addDisposable(new M.Disposable);r.addDispose(()=>delete this._foreignCache[e]);const n=r.addDisposable(new wu),i=r.addDisposable(new M.AsyncEmitter);t=this._foreignCache[e]={get:async(o,a={})=>{await n.getOrCreate(o,async()=>{try{const c=Qy(await i.fire(o))||[];for(const u of c)u[e]=o,await this._cache.add(u.id,u);return c}catch{return[]}});const s=(await this._cache.values()||[]).filter(c=>{const u=c[e];return u==null||Wy(u,o)});return Vy(s,a)},first(o,a={}){return t.get(o,{...a,page:1,pageSize:1}).then(({data:s})=>s[0])},handleRead:i.event,clear(){n.clear()},dispose(){r.dispose()}}}return t}async create(e,{source:t="",silent:r}={}){let n=e;return r||(n=await this._saveEmitter.fire({prev:void 0,patch:e,value:n,source:t})),n.id===void 0&&(n.id=M.generateUUID()),await this._cache.addOrUpdate(n.id,()=>n)}notifySave(e){return this._saveEmitter.fire(e)}async update(e,t,{source:r="",silent:n}={}){return this._cache.addOrUpdate(e,async i=>{const o=i?{...i,...t}:t;if(!n)return t=i?Ru(i,t):t,await this._saveEmitter.fire({prev:i,patch:t,value:o,source:r})})}async remove(e,{source:t="",silent:r}={}){const n=await this._cache.remove(e);return r||await this._removeEmitter.fire({value:n,source:t}),n}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 fr(e){const t=M.createIdentifier$1(e);return r=>r.getOrCreateInstance(t,()=>new Ky)}function Yy(e){const t=e.getInstance(M.STORE_ID);if(!t)throw new Error("Failed");return t}function Nu(e){const t=e.getInstance(M.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}var ju=fr("plugin.dataSource.blocks"),Lu=fr("plugin.dataSource.blockRevisions"),ku=fr("plugin.dataSource.comments"),Xy=yu(),Jy=yu(),Fu=M.createIdentifier$1("EmailPort");function Zy(e){return e.getInstance(Fu)}function ev(e,t){e.inject(Fu,t)}var Uu=M.createIdentifier$1("EmailHistoryPort"),Bu=M.createIdentifier$1("BlockHistoryPort");function $u(e){return e.getInstance(Bu)}function tv(e,t){e.inject(Bu,t)}function Gu(e){return e.getInstance(Uu)}function rv(e,t){e.inject(Uu,t)}var io={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},qu=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],oo=2e4,nv=qu.reduce((e,t)=>e+io[t],0),xu=oo+nv+3e3;function iv(e){return qu.reduce((t,r)=>t+Hu(r,e),0)}function Hu(e,t){const r=t?.[e];return typeof r=="number"&&r>0?r:io[e]}function ov(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:xu}function av(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:oo}function Vu(e=xu){return e+3e3}var sv=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleSaveEmail не ответил за ${e}ms — письмо не сохранено`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}},uv=({source:e,emailtags:t,group:r,tags:n,...i})=>i,cv=()=>Vu();async function lv({emails:e},t){const r=cv();let n;try{return await Promise.race([e.notifySave(t),new Promise((i,o)=>{n=setTimeout(()=>{const a=new sv(r);t.value.id,o(a)},r)})])}finally{n!==void 0&&clearTimeout(n)}}function dv(e){const{emails:t}=e,r=async(n,i)=>{const o=uv(i),a=n===void 0?void 0:await t.cache.getIfPresent(n),s=a?{...a,...o}:o,c=await lv(e,{prev:a,patch:a?Ru(a,o):o,value:s,source:i.source??""}),u=String(c.id??n??M.generateUUID()),h=c.id===void 0?{...c,id:u}:c;return await t.cache.addOrUpdate(u,()=>h)};return{async readEmail(n){return await t.get(n)??null},async createEmail(n){const i=await r(void 0,n);return i?.renderGuid?i:{...i,renderGuid:M.generateUUID()}},async updateEmail(n,i){return await r(n,i)}}}var aM=5e3;function vn(e){return e?.length?[...e].sort((t,r)=>Date.parse(r.modified)-Date.parse(t.modified))[0]:null}function ao(e,{freshSince:t}={}){return!(!e?.slug?.includes("autosave")||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function fv(e,t={}){const r=vn((e??[]).filter(n=>n?.html?.trim()));return ao(r,t)?r:null}function zu(e){const t=Date.parse(vn(e)?.modified??"");return{autosave:fv(e),...Number.isFinite(t)?{latestAt:t}:{}}}function pv(e,t){const r=vn((e??[]).filter(a=>a?.html?.trim())),n=Date.parse(r?.modified??""),i=r&&Number.isFinite(n)&&(t===void 0||n>t),o=[Date.parse(vn(e??[])?.modified??""),t??NaN].filter(a=>Number.isFinite(a));return{autosave:i&&ao(r)?r:null,...o.length?{latestAt:Math.max(...o)}:{}}}function mv({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var so=20,hv=({source:e,emailtags:t,group:r,tags:n,...i})=>i;function gv({revisions:e,revisionsByEmail:t}){const r=async(n,i)=>(t.clear(),await t.get(n,{page:i}),(await e.cache.values()??[]).filter(o=>String(o?.parent)===String(n)));return{async readRevisions(n,i=1){const o=await r(n,i);return{revisions:o.slice(so*(i-1),so*i),page:i,hasMore:o.length>so*i}},async readAutosave(n){return zu(await r(n,1))},async saveAutosave(n,i){const o=hv(i);return await e.create({...o,parent:n,modified:new Date().toString()})}}}function uo(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Qu(e,t){const r={...e};return t===void 0?(delete r.meta,r):(r.meta={...e.meta??{},...t},r)}function Wu(e,t,r){return e&&!uo(t)&&uo(e)?{...r,meta:e.meta}:r}var Ku=fr("plugin.dataSource.emails"),Yu=fr("plugin.dataSource.emailRevisions"),Xu=M.createIdentifier$1("emailDocuments.provided");function bv(e){const t=Ku(e),r=Yu(e),n=r.byForeignKey("parent");return e.getInstance(Xu)?{emails:t,emailRevisions:r}:(e.inject(Xu,!0),ev(e,dv({emails:t})),rv(e,gv({revisions:r,revisionsByEmail:n})),Nu(e).addDisposable(t.onSave(({prev:i,patch:o,value:a})=>Wu(i,o,a),Number.MIN_VALUE)),{emails:t,emailRevisions:r})}var yv=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
10
|
+
`),E}return Ci(function(){s.current=e,c.current=h,u.current=f,a.current=void 0}),Ci(function(){function E(){try{var S=s.current(r.getState());if(t(S,u.current))return;u.current=S}catch(v){a.current=v}i()}return o.onStateChange=E,o.trySubscribe(),E(),function(){return o.tryUnsubscribe()}},[r,o]),f}function Lm(e){e===void 0&&(e=rt);var t=e===rt?bs:function(){return(0,N.useContext)(e)};return function(n,i){i===void 0&&(i=Nm);var o=t(),a=o.store,s=o.subscription,c=jm(n,i,a,s);return(0,N.useDebugValue)(c),c}}var zt=Lm();Em(Ze.unstable_batchedUpdates);var Wr,vs=Z.__esmMin((()=>{vs(),Wr=typeof Wr<"u"?Wr:typeof self<"u"?self:typeof window<"u"?window:{}})),Mi=Symbol.for("immer-nothing"),Qt=Symbol.for("immer-draftable"),ne=Symbol.for("immer-state");function ae(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ee=Object,ct=Ee.getPrototypeOf,Wt="constructor",Kt="prototype",Ri="configurable",Kr="enumerable",Yr="writable",Yt="value",Se=e=>!!e&&!!e[ne];function me(e){return e?Es(e)||Jt(e)||!!e[Qt]||!!e[Wt]?.[Qt]||Zt(e)||er(e):!1}var km=Ee[Kt][Wt].toString(),_s=new WeakMap;function Es(e){if(!e||!Tt(e))return!1;const t=ct(e);if(t===null||t===Ee[Kt])return!0;const r=Ee.hasOwnProperty.call(t,Wt)&&t[Wt];if(r===Object)return!0;if(!dt(r))return!1;let n=_s.get(r);return n===void 0&&(n=Function.toString.call(r),_s.set(r,n)),n===km}function Fm(e){return Se(e)||ae(15,e),e[ne].base_}function Xt(e,t,r=!0){lt(e)===0?(r?Reflect.ownKeys(e):Ee.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,i)=>t(i,n,e))}function lt(e){const t=e[ne];return t?t.type_:Jt(e)?1:Zt(e)?2:er(e)?3:0}var Ot=(e,t,r=lt(e))=>r===2?e.has(t):Ee[Kt].hasOwnProperty.call(e,t),xe=(e,t,r=lt(e))=>r===2?e.get(t):e[t],Xr=(e,t,r,n=lt(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Um(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Jt=Array.isArray,Zt=e=>e instanceof Map,er=e=>e instanceof Set,Tt=e=>typeof e=="object",dt=e=>typeof e=="function",Di=e=>typeof e=="boolean";function Bm(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var $m=e=>Tt(e)?e?.[ne]:null,He=e=>e.copy_||e.base_,Ni=e=>e.modified_?e.copy_:e.base_;function ji(e,t){if(Zt(e))return new Map(e);if(er(e))return new Set(e);if(Jt(e))return Array[Kt].slice.call(e);const r=Es(e);if(t===!0||t==="class_only"&&!r){const n=Ee.getOwnPropertyDescriptors(e);delete n[ne];let i=Reflect.ownKeys(n);for(let o=0;o<i.length;o++){const a=i[o],s=n[a];s[Yr]===!1&&(s[Yr]=!0,s[Ri]=!0),(s.get||s.set)&&(n[a]={[Ri]:!0,[Yr]:!0,[Kr]:s[Kr],[Yt]:e[a]})}return Ee.create(ct(e),n)}else{const n=ct(e);if(n!==null&&r)return{...e};const i=Ee.create(n);return Ee.assign(i,e)}}function Li(e,t=!1){return Zr(e)||Se(e)||!me(e)||(lt(e)>1&&Ee.defineProperties(e,{set:Jr,add:Jr,clear:Jr,delete:Jr}),Ee.freeze(e),t&&Xt(e,(r,n)=>{Li(n,!0)},!1)),e}function Gm(){ae(2)}var Jr={[Yt]:Gm};function Zr(e){return e===null||!Tt(e)?!0:Ee.isFrozen(e)}var en="MapSet",tn="Patches",Ss="ArrayMethods",rn={};function ft(e){const t=rn[e];return t||ae(0,e),t}var Ps=e=>!!rn[e];function qm(e,t){rn[e]||(rn[e]=t)}var tr,Os=()=>tr,xm=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ps(en)?ft(en):void 0,arrayMethodsPlugin_:Ps(Ss)?ft(Ss):void 0});function Ts(e,t){t&&(e.patchPlugin_=ft(tn),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ki(e){Fi(e),e.drafts_.forEach(Hm),e.drafts_=null}function Fi(e){e===tr&&(tr=e.parent_)}var Cs=e=>tr=xm(tr,e);function Hm(e){const t=e[ne];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function As(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[ne].modified_&&(ki(t),ae(4)),me(e)&&(e=Is(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[ne].base_,e,t)}else e=Is(t,r);return Vm(t,e,!0),ki(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Mi?e:void 0}function Is(e,t){if(Zr(t))return t;const r=t[ne];if(!r)return on(t,e.handledSet_,e);if(!nn(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);Rs(r,e)}return r.copy_}function Vm(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Li(t,r)}function ws(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var nn=(e,t)=>e.scope_===t,zm=[];function Ms(e,t,r,n){const i=He(e),o=e.type_;if(n!==void 0&&xe(i,n,o)===t){Xr(i,n,r,o);return}if(!e.draftLocations_){const s=e.draftLocations_=new Map;Xt(i,(c,u)=>{if(Se(u)){const h=s.get(u)||[];h.push(c),s.set(u,h)}})}const a=e.draftLocations_.get(t)??zm;for(const s of a)Xr(i,s,r,o)}function Qm(e,t,r){e.callbacks_.push(function(i){const o=t;if(!o||!nn(o,i))return;i.mapSetPlugin_?.fixSetContents(o);const a=Ni(o);Ms(e,o.draft_??o,a,r),Rs(o,i)})}function Rs(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:r}=t;if(r){const n=r.getPath(e);n&&r.generatePatches_(e,n,t)}ws(e)}}function Wm(e,t,r){const{scope_:n}=e;if(Se(r)){const i=r[ne];nn(i,n)&&i.callbacks_.push(function(){sn(e),Ms(e,r,Ni(i),t)})}else me(r)&&e.callbacks_.push(function(){const o=He(e);e.type_===3?o.has(r)&&on(r,n.handledSet_,n):xe(o,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&on(xe(e.copy_,t,e.type_),n.handledSet_,n)})}function on(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Se(e)||t.has(e)||!me(e)||Zr(e)||(t.add(e),Xt(e,(n,i)=>{if(Se(i)){const o=i[ne];nn(o,r)&&(Xr(e,n,Ni(o),e.type_),ws(o))}else me(i)&&on(i,t,r)})),e}function Km(e,t){const r=Jt(e),n={type_:r?1:0,scope_:t?t.scope_:Os(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=n,o=an;r&&(i=[n],o=rr);const{revoke:a,proxy:s}=Proxy.revocable(i,o);return n.draft_=s,n.revoke_=a,[s,n]}var an={get(e,t){if(t===ne)return e;let r=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const i=He(e);if(!Ot(i,t,e.type_))return Xm(e,i,t);const o=i[t];if(e.finalized_||!me(o)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Bm(t))return o;if(o===Ui(e.base_,t)||Ym(e,t,o)){sn(e);const a=e.type_===1?+t:t,s=$i(e.scope_,o,e,a);return e.copy_[a]=s}return o},has(e,t){return t in He(e)},ownKeys(e){return Reflect.ownKeys(He(e))},set(e,t,r){const n=Ds(He(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Ui(He(e),t),o=i?.[ne];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Um(r,i)&&(r!==void 0||Ot(e.base_,t,e.type_)))return!0;sn(e),Bi(e)}return e.copy_[t]===r&&(r!==void 0||Ot(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Wm(e,t,r)),!0},deleteProperty(e,t){return sn(e),Ui(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Bi(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=He(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Yr]:!0,[Ri]:e.type_!==1||t!=="length",[Kr]:n[Kr],[Yt]:r[t]}},defineProperty(){ae(11)},getPrototypeOf(e){return ct(e.base_)},setPrototypeOf(){ae(12)}},rr={};for(let e in an){let t=an[e];rr[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}rr.deleteProperty=function(e,t){return rr.set.call(this,e,t,void 0)},rr.set=function(e,t,r){return an.set.call(this,e[0],t,r,e[0])};function Ui(e,t){const r=e[ne];return(r?He(r):e)[t]}function Ym(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!me(r)||r[ne]?!1:e.baseRefs_.has(r)}function Xm(e,t,r){const n=Ds(t,r);return n?Yt in n?n[Yt]:n.get?.call(e.draft_):void 0}function Ds(e,t){if(!(t in e))return;let r=ct(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=ct(r)}}function Bi(e){e.modified_||(e.modified_=!0,e.parent_&&Bi(e.parent_))}function sn(e){e.copy_||(e.assigned_=new Map,e.copy_=ji(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Jm=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(dt(t)&&!dt(r)){const o=r;r=t;const a=this;return function(c=o,...u){return a.produce(c,h=>r.call(this,h,...u))}}dt(r)||ae(6),n!==void 0&&!dt(n)&&ae(7);let i;if(me(t)){const o=Cs(this),a=$i(o,t,void 0);let s=!0;try{i=r(a),s=!1}finally{s?ki(o):Fi(o)}return Ts(o,n),As(i,o)}else if(!t||!Tt(t)){if(i=r(t),i===void 0&&(i=t),i===Mi&&(i=void 0),this.autoFreeze_&&Li(i,!0),n){const o=[],a=[];ft(tn).generateReplacementPatches_(t,i,{patches_:o,inversePatches_:a}),n(o,a)}return i}else ae(1,t)},this.produceWithPatches=(t,r)=>{if(dt(t))return(o,...a)=>this.produceWithPatches(o,s=>t(s,...a));let n,i;return[this.produce(t,r,(o,a)=>{n=o,i=a}),n,i]},Di(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Di(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Di(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){me(e)||ae(8),Se(e)&&(e=Ns(e));const t=Cs(this),r=$i(t,e,void 0);return r[ne].isManual_=!0,Fi(t),r}finishDraft(e,t){const r=e&&e[ne];(!r||!r.isManual_)&&ae(9);const{scope_:n}=r;return Ts(n,t),As(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=ft(tn).applyPatches_;return Se(e)?n(e,t):this.produce(e,i=>n(i,t))}};function $i(e,t,r,n){const[i,o]=Zt(t)?ft(en).proxyMap_(t,r):er(t)?ft(en).proxySet_(t,r):Km(t,r);return(r?.scope_??Os()).drafts_.push(i),o.callbacks_=r?.callbacks_??[],o.key_=n,r&&n!==void 0?Qm(r,o,n):o.callbacks_.push(function(s){s.mapSetPlugin_?.fixSetContents(o);const{patchPlugin_:c}=s;o.modified_&&c&&c.generatePatches_(o,[],s)}),i}function Ns(e){return Se(e)||ae(10,e),js(e)}function js(e){if(!me(e)||Zr(e))return e;const t=e[ne];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=ji(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=ji(e,!0);return Xt(r,(i,o)=>{Xr(r,i,js(o))},n),t&&(t.finalized_=!1),r}function Zm(){function t(S,v=[]){if(S.key_!==void 0){const C=S.parent_.copy_??S.parent_.base_,A=$m(xe(C,S.key_)),I=xe(C,S.key_);if(I===void 0||I!==S.draft_&&I!==S.base_&&I!==S.copy_||A!=null&&A.base_!==S.base_)return null;const T=S.parent_.type_===3;let g;if(T){const m=S.parent_;g=Array.from(m.drafts_.keys()).indexOf(S.key_)}else g=S.key_;if(!(T&&C.size>g||Ot(C,g)))return null;v.push(g)}if(S.parent_)return t(S.parent_,v);v.reverse();try{r(S.copy_,v)}catch{return null}return v}function r(S,v){let C=S;for(let A=0;A<v.length-1;A++){const I=v[A];if(C=xe(C,I),!Tt(C)||C===null)throw new Error(`Cannot resolve path at '${v.join("/")}'`)}return C}const n="replace",i="add",o="remove";function a(S,v,C){if(S.scope_.processedForPatches_.has(S))return;S.scope_.processedForPatches_.add(S);const{patches_:A,inversePatches_:I}=C;switch(S.type_){case 0:case 2:return c(S,v,A,I);case 1:return s(S,v,A,I);case 3:return u(S,v,A,I)}}function s(S,v,C,A){let{base_:I,assigned_:T}=S,g=S.copy_;g.length<I.length&&([I,g]=[g,I],[C,A]=[A,C]);const m=S.allIndicesReassigned_===!0;for(let l=0;l<I.length;l++){const b=g[l],d=I[l];if((m||T?.get(l.toString()))&&b!==d){const _=b?.[ne];if(_&&_.modified_)continue;const P=v.concat([l]);C.push({op:n,path:P,value:E(b)}),A.push({op:n,path:P,value:E(d)})}}for(let l=I.length;l<g.length;l++){const b=v.concat([l]);C.push({op:i,path:b,value:E(g[l])})}for(let l=g.length-1;I.length<=l;--l){const b=v.concat([l]);A.push({op:o,path:b})}}function c(S,v,C,A){const{base_:I,copy_:T,type_:g}=S;Xt(S.assigned_,(m,l)=>{const b=xe(I,m,g),d=xe(T,m,g),_=l?Ot(I,m)?n:i:o;if(b===d&&_===n)return;const P=v.concat(m);C.push(_===o?{op:_,path:P}:{op:_,path:P,value:E(d)}),A.push(_===i?{op:o,path:P}:_===o?{op:i,path:P,value:E(b)}:{op:n,path:P,value:E(b)})})}function u(S,v,C,A){let{base_:I,copy_:T}=S,g=0;I.forEach(m=>{if(!T.has(m)){const l=v.concat([g]);C.push({op:o,path:l,value:m}),A.unshift({op:i,path:l,value:m})}g++}),g=0,T.forEach(m=>{if(!I.has(m)){const l=v.concat([g]);C.push({op:i,path:l,value:m}),A.unshift({op:o,path:l,value:m})}g++})}function h(S,v,C){const{patches_:A,inversePatches_:I}=C;A.push({op:n,path:[],value:v===Mi?void 0:v}),I.push({op:n,path:[],value:S})}function f(S,v){return v.forEach(C=>{const{path:A,op:I}=C;let T=S;for(let b=0;b<A.length-1;b++){const d=lt(T);let _=A[b];typeof _!="string"&&typeof _!="number"&&(_=""+_),(d===0||d===1)&&(_==="__proto__"||_===Wt)&&ae(19),dt(T)&&_===Kt&&ae(19),T=xe(T,_),(T===null||!Tt(T))&&ae(18,A.join("/"))}const g=lt(T),m=y(C.value),l=A[A.length-1];switch(I){case n:switch(g){case 2:return T.set(l,m);case 3:ae(16);default:return T[l]=m}case i:switch(g){case 1:return l==="-"?T.push(m):T.splice(l,0,m);case 2:return T.set(l,m);case 3:return T.add(m);default:return T[l]=m}case o:switch(g){case 1:return T.splice(l,1);case 2:return T.delete(l);case 3:return T.delete(C.value);default:return delete T[l]}default:ae(17,I)}}),S}function y(S){if(!me(S))return S;if(Jt(S))return S.map(y);if(Zt(S))return new Map(Array.from(S.entries()).map(([C,A])=>[C,y(A)]));if(er(S))return new Set(Array.from(S).map(y));const v=Object.create(ct(S));for(const C in S)v[C]=y(S[C]);return Ot(S,Qt)&&(v[Qt]=S[Qt]),v}function E(S){return Se(S)?y(S):S}qm(tn,{applyPatches_:f,generatePatches_:a,generateReplacementPatches_:h,getPath:t})}var nr=new Jm,ir=nr.produce,Ls=nr.produceWithPatches.bind(nr),ks=nr.applyPatches.bind(nr);function eh(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function th(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Fs=e=>Array.isArray(e)?e:[e];function rh(e){const t=Array.isArray(e[0])?e[0]:e;return th(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function nh(e,t){const r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var ih=class{constructor(e){this.value=e}deref(){return this.value}},oh=()=>typeof WeakRef>"u"?ih:WeakRef,Us=oh(),ah=0,Bs=1;function un(){return{s:ah,v:void 0,o:null,p:null}}function sh(e){return e instanceof Us?e.deref():e}function cn(e,t={}){let r=un();const{resultEqualityCheck:n}=t;let i,o=0;function a(){let s=r;const{length:c}=arguments;for(let f=0,y=c;f<y;f++){const E=arguments[f];if(typeof E=="function"||typeof E=="object"&&E!==null){let S=s.o;S===null&&(s.o=S=new WeakMap);const v=S.get(E);v===void 0?(s=un(),S.set(E,s)):s=v}else{let S=s.p;S===null&&(s.p=S=new Map);const v=S.get(E);v===void 0?(s=un(),S.set(E,s)):s=v}}const u=s;let h;if(s.s===Bs)h=s.v;else if(h=e.apply(null,arguments),o++,n){const f=sh(i);f!=null&&n(f,h)&&(h=f,o!==0&&o--),i=typeof h=="object"&&h!==null||typeof h=="function"?new Us(h):h}return u.s=Bs,u.v=h,h}return a.clearCache=()=>{r=un(),a.resetResultsCount()},a.resultsCount=()=>o,a.resetResultsCount=()=>{o=0},a}function uh(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let o=0,a=0,s,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),eh(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const{memoize:h,memoizeOptions:f=[],argsMemoize:y=cn,argsMemoizeOptions:E=[]}={...r,...c},S=Fs(f),v=Fs(E),C=rh(i),A=h(function(){return o++,u.apply(null,arguments)},...S),I=y(function(){a++;const g=nh(C,arguments);return s=A.apply(null,g),s},...v);return Object.assign(I,{resultFunc:u,memoizedResultFunc:A,dependencies:C,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:h,argsMemoize:y})};return Object.assign(n,{withTypes:()=>n}),n}var $s=uh(cn);function Gs(e){return({dispatch:r,getState:n})=>i=>o=>typeof o=="function"?o(r,n,e):i(o)}var ch=Gs(),lh=Gs,dh=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Qr:Qr.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var fh=e=>e&&typeof e.match=="function";function he(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(we(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>gs(n)&&n.type===e,r}var qs=class qr extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,qr.prototype)}static get[Symbol.species](){return qr}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new qr(...t[0].concat(this)):new qr(...t.concat(this))}};function xs(e){return me(e)?ir(e,()=>{}):e}function ln(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function ph(e){return typeof e=="boolean"}var mh=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=t??{};let a=new qs;return r&&(ph(r)?a.push(ch):a.push(lh(r.extraArgument))),a},dn="RTK_autoBatch",or=()=>e=>({payload:e,meta:{[dn]:!0}}),Hs=e=>t=>{setTimeout(t,e)},hh=(e,t)=>r=>{let n=!1;const i=()=>{n||(n=!0,cancelAnimationFrame(o),clearTimeout(a),r())},o=e(i),a=setTimeout(i,t)},gh=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,o=!1,a=!1;const s=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?hh(window.requestAnimationFrame,100):Hs(10):e.type==="callback"?e.queueNotification:Hs(e.timeout),u=()=>{a=!1,o&&(o=!1,s.forEach(h=>h()))};return Object.assign({},n,{subscribe(h){const f=()=>i&&h(),y=n.subscribe(f);return s.add(h),()=>{y(),s.delete(h)}},dispatch(h){try{return i=!h?.meta?.[dn],o=!i,o&&(a||(a=!0,c(u))),n.dispatch(h)}finally{i=!0}}})},bh=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new qs(e);return n&&i.push(gh(typeof n=="object"?n:void 0)),i};function yh(e){const t=mh(),{reducer:r=void 0,middleware:n,devTools:i=!0,duplicateMiddlewareCheck:o=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{};let c;if(typeof r=="function")c=r;else if(nt(r))c=wi(r);else throw new Error(we(1));let u;typeof n=="function"?u=n(t):u=t();let h=Qr;i&&(h=dh({trace:!1,...typeof i=="object"&&i}));const f=bh(Rm(...u));let y=typeof s=="function"?s(f):f();const E=h(...y);return hs(c,a,E)}function Vs(e){const t={},r=[];let n;const i={addCase(o,a){const s=typeof o=="string"?o:o.type;if(!s)throw new Error(we(28));if(s in t)throw new Error(we(29));return t[s]=a,i},addAsyncThunk(o,a){return a.pending&&(t[o.pending.type]=a.pending),a.rejected&&(t[o.rejected.type]=a.rejected),a.fulfilled&&(t[o.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:o.settled,reducer:a.settled}),i},addMatcher(o,a){return r.push({matcher:o,reducer:a}),i},addDefaultCase(o){return n=o,i}};return e(i),[t,r,n]}function vh(e){return typeof e=="function"}function _h(e,t){let[r,n,i]=Vs(t),o;if(vh(e))o=()=>xs(e());else{const s=xs(e);o=()=>s}function a(s=o(),c){let u=[r[c.type],...n.filter(({matcher:h})=>h(c)).map(({reducer:h})=>h)];return u.filter(h=>!!h).length===0&&(u=[i]),u.reduce((h,f)=>{if(f)if(Se(h)){const y=f(h,c);return y===void 0?h:y}else{if(me(h))return ir(h,y=>f(y,c));{const y=f(h,c);if(y===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return y}}return h},s)}return a.getInitialState=o,a}var zs=(e,t)=>fh(e)?e.match(t):e(t);function Ve(...e){return t=>e.some(r=>zs(r,t))}function ar(...e){return t=>e.every(r=>zs(r,t))}function fn(e,t){if(!e||!e.meta)return!1;const r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function sr(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Gi(...e){return e.length===0?t=>fn(t,["pending"]):sr(e)?Ve(...e.map(t=>t.pending)):Gi()(e[0])}function Ct(...e){return e.length===0?t=>fn(t,["rejected"]):sr(e)?Ve(...e.map(t=>t.rejected)):Ct()(e[0])}function pn(...e){const t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?ar(Ct(...e),t):sr(e)?ar(Ct(...e),t):pn()(e[0])}function it(...e){return e.length===0?t=>fn(t,["fulfilled"]):sr(e)?Ve(...e.map(t=>t.fulfilled)):it()(e[0])}function qi(...e){return e.length===0?t=>fn(t,["pending","fulfilled","rejected"]):sr(e)?Ve(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):qi()(e[0])}var Eh="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",xi=(e=21)=>{let t="",r=e;for(;r--;)t+=Eh[Math.random()*64|0];return t},Sh=["name","message","stack","code"],Hi=class{constructor(e,t){this.payload=e,this.meta=t}payload;meta;_type},Qs=class{constructor(e,t){this.payload=e,this.meta=t}payload;meta;_type},Ph=e=>{if(typeof e=="object"&&e!==null){const t={};for(const r of Sh)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Ws="External signal was aborted",Vi=(()=>{function e(t,r,n){const i=he(t+"/fulfilled",(c,u,h,f)=>({payload:c,meta:{...f||{},arg:h,requestId:u,requestStatus:"fulfilled"}})),o=he(t+"/pending",(c,u,h)=>({payload:void 0,meta:{...h||{},arg:u,requestId:c,requestStatus:"pending"}})),a=he(t+"/rejected",(c,u,h,f,y)=>({payload:f,error:(n&&n.serializeError||Ph)(c||"Rejected"),meta:{...y||{},arg:h,requestId:u,rejectedWithValue:!!f,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function s(c,{signal:u}={}){return(h,f,y)=>{const E=n?.idGenerator?n.idGenerator(c):xi(),S=new AbortController;let v,C;function A(T){C=T,S.abort()}u&&(u.aborted?A(Ws):u.addEventListener("abort",()=>A(Ws),{once:!0}));const I=(async function(){let T;try{let g=n?.condition?.(c,{getState:f,extra:y});if(Th(g)&&(g=await g),g===!1||S.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const m=new Promise((l,b)=>{v=()=>{b({name:"AbortError",message:C||"Aborted"})},S.signal.addEventListener("abort",v,{once:!0})});h(o(E,c,n?.getPendingMeta?.({requestId:E,arg:c},{getState:f,extra:y}))),T=await Promise.race([m,Promise.resolve(r(c,{dispatch:h,getState:f,extra:y,requestId:E,signal:S.signal,abort:A,rejectWithValue:((l,b)=>new Hi(l,b)),fulfillWithValue:((l,b)=>new Qs(l,b))})).then(l=>{if(l instanceof Hi)throw l;return l instanceof Qs?i(l.payload,E,c,l.meta):i(l,E,c)})])}catch(g){T=g instanceof Hi?a(null,E,c,g.payload,g.meta):a(g,E,c)}finally{v&&S.signal.removeEventListener("abort",v)}return n&&!n.dispatchConditionRejection&&a.match(T)&&T.meta.condition||h(T),T})();return Object.assign(I,{abort:A,requestId:E,arg:c,unwrap(){return I.then(Oh)}})}}return Object.assign(s,{pending:o,rejected:a,fulfilled:i,settled:Ve(a,i),typePrefix:t})}return e.withTypes=()=>e,e})();function Oh(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Th(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var Ch=Symbol.for("rtk-slice-createasyncthunk");function Ah(e,t){return`${e}/${t}`}function Ih({creators:e}={}){const t=e?.asyncThunk?.[Ch];return function(n){const{name:i,reducerPath:o=i}=n;if(!i)throw new Error(we(11));const a=(typeof n.reducers=="function"?n.reducers(Mh()):n.reducers)||{},s=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(T,g){const m=typeof T=="string"?T:T.type;if(!m)throw new Error(we(12));if(m in c.sliceCaseReducersByType)throw new Error(we(13));return c.sliceCaseReducersByType[m]=g,u},addMatcher(T,g){return c.sliceMatchers.push({matcher:T,reducer:g}),u},exposeAction(T,g){return c.actionCreators[T]=g,u},exposeCaseReducer(T,g){return c.sliceCaseReducersByName[T]=g,u}};s.forEach(T=>{const g=a[T],m={reducerName:T,type:Ah(i,T),createNotation:typeof n.reducers=="function"};Dh(g)?jh(m,g,u,t):Rh(m,g,u)});function h(){const[T={},g=[],m=void 0]=typeof n.extraReducers=="function"?Vs(n.extraReducers):[n.extraReducers],l={...T,...c.sliceCaseReducersByType};return _h(n.initialState,b=>{for(let d in l)b.addCase(d,l[d]);for(let d of c.sliceMatchers)b.addMatcher(d.matcher,d.reducer);for(let d of g)b.addMatcher(d.matcher,d.reducer);m&&b.addDefaultCase(m)})}const f=T=>T,y=new Map,E=new WeakMap;let S;function v(T,g){return S||(S=h()),S(T,g)}function C(){return S||(S=h()),S.getInitialState()}function A(T,g=!1){function m(b){let d=b[T];return typeof d>"u"&&g&&(d=ln(E,m,C)),d}function l(b=f){return ln(ln(y,g,()=>new WeakMap),b,()=>{const d={};for(const[_,P]of Object.entries(n.selectors??{}))d[_]=wh(P,b,()=>ln(E,b,C),g);return d})}return{reducerPath:T,getSelectors:l,get selectors(){return l(m)},selectSlice:m}}const I={name:i,reducer:v,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:C,...A(o),injectInto(T,{reducerPath:g,...m}={}){const l=g??o;return T.inject({reducerPath:l,reducer:v},m),{...I,...A(l,!0)}}};return I}}function wh(e,t,r,n){function i(o,...a){let s=t(o);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return i.unwrapped=e,i}var ge=Ih();function Mh(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function Rh({type:e,reducerName:t,createNotation:r},n,i){let o,a;if("reducer"in n){if(r&&!Nh(n))throw new Error(we(17));o=n.reducer,a=n.prepare}else o=n;i.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,a?he(e,a):he(e))}function Dh(e){return e._reducerDefinitionType==="asyncThunk"}function Nh(e){return e._reducerDefinitionType==="reducerWithPrepare"}function jh({type:e,reducerName:t},r,n,i){if(!i)throw new Error(we(18));const{payloadCreator:o,fulfilled:a,pending:s,rejected:c,settled:u,options:h}=r,f=i(e,o,h);n.exposeAction(t,f),a&&n.addCase(f.fulfilled,a),s&&n.addCase(f.pending,s),c&&n.addCase(f.rejected,c),u&&n.addMatcher(f.settled,u),n.exposeCaseReducer(t,{fulfilled:a||mn,pending:s||mn,rejected:c||mn,settled:u||mn})}function mn(){}var Ks="listener",Ys="completed",Xs="cancelled",W0=`task-${Xs}`,K0=`task-${Ys}`,Y0=`${Ks}-${Xs}`,X0=`${Ks}-${Ys}`,{assign:Js}=Object,zi="listenerMiddleware",Lh=Js(he(`${zi}/add`),{withTypes:()=>Lh}),J0=he(`${zi}/removeAll`),kh=Js(he(`${zi}/remove`),{withTypes:()=>kh});function we(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}function Fh(e){return e}function Zs({data:e,...t},r){return t.error?t:{data:r(e,t.meta),...t}}function Uh({data:e,...t},r){return t.error?t:{data:e.map(n=>r(n,t.meta)),...t}}function ce(e){return t=>Zs(t,e)}function Bh(e){return!e.hasOwnProperty("previous")}function hn(e){return t=>Zs(t,(r,n)=>Bh(r)?e(r,n):e(r.previous,n))}function Pe(e){return t=>Uh(t,e)}var eu={editorThemeColor:"light",isSettingsDisabled:!1,emailAutosaveTimestamps:{},settings:{backgroundColor:"",backgroundImage:[{type:"url",value:""}],backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",textStrong:!1,textItalic:!1,textUnderline:!1},elementSettings:{},searchFilters:{},emailCommonStyles:"",saveTime:null,mobileViewActive:{shutdown:!0,styles:!0},isCodeMode:!1,codeModeDirection:void 0,emailViewType:void 0,changeKey:null,problemsList:[],codeErrors:[],activeProblemRange:null,emailGroups:{},projectGroups:[],isNeedUpdateAppearance:!1,isNeedUpdateContentAppearance:!1},ke="emailSlice",tu=ge({name:ke,initialState:eu,reducers:{setEditorThemeColor:(e,t)=>{e.editorThemeColor=t.payload},setEmailSettings:(e,{payload:t})=>{Object.assign(e,{...e,settings:{...t},isSettingsDisabled:!1})},setEmailSettingsDisable:(e,t)=>{e.isSettingsDisabled=t.payload},setElementSettings:(e,{payload:t})=>{e.elementSettings=t},setSearchFilters:(e,t)=>{e.searchFilters=t.payload},updateSearchFilters:(e,t)=>{e.searchFilters={...e.searchFilters,...t.payload}},resetEmailSlice:e=>{const t=e.emailAutosaveTimestamps;return{...eu,emailAutosaveTimestamps:t}},rememberAutosaveTime:(e,{payload:t})=>{e.emailAutosaveTimestamps[t.emailId]=t.modified},applyProjectGroups:(e,{payload:t})=>{const r=t.projectGroups;e.projectGroups=r;const n=t.emailGroup;if(!n)return;const i={};n.length&&r.length&&n.forEach(o=>{r.forEach(a=>{const s=(a.children||[]).find(c=>c.id===o);s&&(i.hasOwnProperty(a.id)||(i[a.id]=[]),i[a.id].push({label:s.name,value:s.id}))})}),e.emailGroups=i},setCodeErrors:(e,t)=>{e.codeErrors=t.payload},setProblemsList:(e,t)=>{e.problemsList=t.payload},setActiveProblemRange:(e,t)=>{e.activeProblemRange=t.payload},markAppearanceNeedsUpdate:e=>{e.isNeedUpdateAppearance=!0,e.isNeedUpdateContentAppearance=!0},setIsNeedUpdateContentAppearance:(e,t)=>{e.isNeedUpdateContentAppearance=t.payload},setIsNeedUpdateAppearance:(e,t)=>{e.isNeedUpdateAppearance=t.payload},setEmailGroups:(e,{payload:t})=>{const r=Object.keys(t)[0],n=e.emailGroups,i=e.projectGroups,o={};i.length&&(t[r]?.forEach(a=>{const s=i.find(u=>u.id===+r),c=(s?.children||[]).find(u=>u.id===+a);c?(o.hasOwnProperty(s.id)||(o[s.id]=[]),o[s.id].push({label:c.name,value:c.id})):(o.hasOwnProperty(r)||(o[r]=[]),o[r].push({label:a,value:null}))}),t[r].length===0&&(o[r]=[])),e.emailGroups={...n,...o}}}}),{setEditorThemeColor:$h,setEmailSettings:Gh,setElementSettings:qh,setEmailSettingsDisable:xh,setSearchFilters:Z0,updateSearchFilters:eM,resetEmailSlice:Hh,rememberAutosaveTime:Vh,applyProjectGroups:zh,setProblemsList:Qh,setCodeErrors:tM,setActiveProblemRange:Wh,setEmailGroups:Kh,markAppearanceNeedsUpdate:Yh,setIsNeedUpdateAppearance:Xh,setIsNeedUpdateContentAppearance:Jh}=tu.actions;function Zh(e,t){return zh({projectGroups:e??[],emailGroup:Array.isArray(t)?t:void 0})}var eg=e=>e[ke].isNeedUpdateContentAppearance,tg=e=>e[ke].settings,rg=e=>e[ke].problemsList,ng=e=>e[ke].projectGroups,ig=e=>e[ke].elementSettings,og=e=>e[ke].editorThemeColor,ag=e=>e[ke].isSettingsDisabled,sg=e=>e[ke].activeProblemRange,ug=e=>e[ke].isNeedUpdateAppearance,cg={text:{fontFamily:["Google Fonts","Sans Serif","Mulish","Regular"],fontSize:16,fontSizeDim:"px",lineHeight:24,lineHeightDim:"px",color:"#595959",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},headings:{fontFamily:["Google Fonts","Sans Serif","Mulish","Bold"],fontSize:28,fontSizeDim:"px",lineHeight:34,lineHeightDim:"px",color:"#000000",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},links:{color:"#1890ff",contrastColor:"#FFFFFF",underline:!0},buttons:{fontFamily:["Google Fonts","Sans Serif","Mulish","Medium"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1890ff",bold:!1,italic:!1,backgroundColor:"#1890ff",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:6,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},textAlign:"center",padding:{all:null,top:null,right:null,bottom:null,left:null}},block:{backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1890ff",padding:{all:null,top:null,right:null,bottom:null,left:null}},cards:{contrastBackgroundColor:"#1890ff",contrastTextColor:"#ffffff",baseBackgroundColor:"#f8f8f8",baseTextColor:"#333333",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}}},lg="ERROR",dg="useblocks",Qi={em_token:"em_access_token",em_refresh_token:"em_refresh_token",em_elements_view:"em_elements_view",em_new_block:"em_new_block",em_new_email:"em_new_email",em_id:"em_id",em_name:"em_name",em_email:"em_email",em_locale:"em_locale",em_carrotquest_hash:"em_carrotquest_hash",em_ducalis_hash:"em_ducalis_hash",em_email_subscription_consent:"em_email_subscription_consent",em_folder:"em_folder",promocode:"promocode",em_active_tab:"em_active_tab"},pt={em_color_scheme:"em_color_scheme",em_code_mode_pane_sizes:"em_code_mode_pane_sizes",em_preview_pane_sizes:"em_preview_pane_sizes",em_default_sizes:"em_default_sizes",em_pane_sizes:"em_pane_sizes",em_test_emails:"em_test_emails",em_menu_is_locked:"em_menu_is_locked",em_code_mode_settings:"em_code_mode_settings",em_folder_is_open:"em_folder_is_open",em_active_tab:"em_active_tab",em_ai_settings:"em_ai_settings",em_last_active_page:"em_last_active_page",em_layout_convert_never_suggest:"em_layout_convert_never_suggest",em_filemanager_v2:"em_filemanager_v2",em_projects_v2:"em_projects_v2",em_translations_v2:"em_translations_v2",em_defer_chrome:"em_defer_chrome",em_stripo_import:"em_stripo_import",em_guest_locale:"em_guest_locale"},fg="not all",pg="light",mg="dark",hg="system",gg="(prefers-color-scheme: light)",bg="(prefers-color-scheme: dark)",yg={auth:"/auth",projects_index:"/",projects:"/projects",project:"/projects/:projectId/emails",email:"/projects/:projectId/emails/:emailId",create_email:"/projects/:projectId/emails/new",blocks:"/projects/:projectId/blocks",block:"/projects/:projectId/blocks/:blockId",create_block:"/projects/:projectId/blocks/new",billing:"/billing"},le={ADD_NEW_PROJECT_MODAL:"ADD_NEW_PROJECT_MODAL",BLOCKS_MODAL:"BLOCKS_MODAL",EDIT_PROFILE_MODAL:"EDIT_PROFILE_MODAL",SEND_TEST_EMAIL:"SEND_TEST_EMAIL",ADD_NEW_EBLOCK_MODAL:"ADD_NEW_EBLOCK_MODAL",UPDATE_GLOBAL_BLOCKS_MODAL:"UPDATE_GLOBAL_BLOCKS_MODAL",SAVE_GLOBAL_BLOCK_CHOICE_MODAL:"SAVE_GLOBAL_BLOCK_CHOICE_MODAL",ADD_NEW_EMAIL_MODAL:"ADD_NEW_EMAIL_MODAL",ADD_NEW_AI_EMAIL:"ADD_NEW_AI_EMAIL",STRIPO_IMPORT:"STRIPO_IMPORT",STRIPO_IMPORT_RESULT:"STRIPO_IMPORT_RESULT",SWITCH_TO_PLAN_MODAL:"SWITCH_TO_PLAN_MODAL",IMAGE_EDITOR_MODAL:"IMAGE_EDITOR_MODAL",ADD_NEW_FOLDER_MODAL:"ADD_NEW_FOLDER_MODAL",EDIT_FOLDER_NAME_MODAL:"EDIT_FOLDER_NAME_MODAL",ADD_NEW_GROUP_MODAL:"ADD_NEW_GROUP_MODAL",EDIT_GROUP_NAME_MODAL:"EDIT_GROUP_NAME_MODAL",RENAME_EMAIL_MODAL:"RENAME_EMAIL_MODAL",RENAME_BLOCK_MODAL:"RENAME_BLOCK_MODAL",UPLOAD_IMAGE_MODAL:"UPLOAD_IMAGE_MODAL",UPLOAD_BACKGROUND_MODAL:"UPLOAD_BACKGROUND_MODAL",UPLOAD_IMAGE_MODAL_AI:"UPLOAD_IMAGE_MODAL_AI",UPLOAD_BACKGROUND_MODAL_AI:"UPLOAD_BACKGROUND_MODAL_AI",UPLOAD_IMAGE_MODAL_STOCK:"UPLOAD_IMAGE_MODAL_STOCK",UPLOAD_BACKGROUND_MODAL_STOCK:"UPLOAD_BACKGROUND_MODAL_STOCK",UPLOAD_IMAGE_MODAL_GIF:"UPLOAD_IMAGE_MODAL_GIF",UPLOAD_BACKGROUND_MODAL_GIF:"UPLOAD_BACKGROUND_MODAL_GIF",UPLOAD_IMAGE_MODAL_EDIT:"UPLOAD_IMAGE_MODAL_EDIT",UPLOAD_BACKGROUND_MODAL_EDIT:"UPLOAD_BACKGROUND_MODAL_EDIT",UPLOAD_IMAGE_MODAL_UPLOAD:"UPLOAD_IMAGE_MODAL_UPLOAD",UPLOAD_BACKGROUND_MODAL_UPLOAD:"UPLOAD_BACKGROUND_MODAL_UPLOAD"},vg="application/x-emailmaker-social-reorder",ru="fonts.googleapis.com",nu=e=>{try{const t=new URL(String(e??"").trim());return t.protocol==="https:"?t:null}catch{return null}},_g=e=>{const t=nu(String(e??""));return t?t.hostname===ru&&t.pathname.startsWith("/css")&&!!t.searchParams.get("family"):!1},Eg=e=>{const t=nu(String(e??""));if(!t||t.hostname!==ru)return"";const r=t.searchParams.get("family");return r?r.split(":")[0].trim():""},ur={MESSAGE:"message",INIT_PREVIEW:"init_preview",UPDATE_PREVIEW:"update_preview",UPDATE_EDITOR:"update_editor",UPDATE_EDITOR_POSITION:"update_editor_position",UPDATE_SIDE_MENU_EDITOR:"update_side_menu_editor",SAVE_EMAIL:"saveEmail",SANDBOX_ELEMENT_SETTINGS_SET:"sandbox_element_settings_set",SANDBOX_IMAGE_RESET:M.createIdentifier("sandbox_image_reset"),SANDBOX_NATIVE_IMAGE_DROP_CLEAR:"sandbox_native-image-drop-clear",SANDBOX_EMAIL_SETTINGS_SET:"sandbox_email_settings_set",SANDBOX_BLOCK_SETTINGS_SET:"sandbox_block_settings_set",SANDBOX_ELEMENT_PARENT_GET:"sandbox_element_parent_get",SANDBOX_ELEMENT_PARENT_TABLE_GET:"sandbox_element_parent_table_get",SANDBOX_ELEMENT_PREV_GET:"sandbox_element_prev_get",SANDBOX_ELEMENT_NEXT_GET:"sandbox_element_next_get",SANDBOX_ELEMENT_REMOVE:"sandbox_element_remove",SANDBOX_ELEMENT_ACTIVE_RESET:"sandbox_element_active_reset",SANDBOX_ELEMENT_ACTIVE_SET:"sandbox_element_active_set",SANDBOX_ELEMENT_HOVER_SET:"sandbox_element_hover_set",SANDBOX_ELEMENT_IMG_LINK:"sandbox_element_img_link",SANDBOX_ELEMENT_TEXT:"sandbox_element_text",SANDBOX_EMAIL_CONTENT_GET:"sandbox_email_content_get",SANDBOX_SET_POSITION_TO_IMG:"sandbox_set_position_to_img",SANDBOX_SET_POSITION_TO_LINK:"sandbox_set_position_to_link",SANDBOX_ACCORDION_ADD_SECTION:"sandbox_accordion_add_section",SANDBOX_ACCORDION_REMOVE_SECTION:"sandbox_accordion_remove_section",APPLICATION_FOCUS_IN_IFRAME:"application_focus_in_iframe",APPLICATION_EMAIL_SETTINGS_SET:"application_email_settings_set",APPLICATION_BLOCK_SETTINGS_SET:"application_block_settings_set",APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",_APPLICATION_ELEMENT_SETTINGS_SET:M.createIdentifier("application_element_settings_set"),APPLICATION_ELEMENT_SETTINGS_CLOSE:"application_element_settings_close",APPLICATION_ACTION:"application_action",APPLICATION_EBLOCK_ADD:"application_eblock_add",SANDBOX_EBLOCK_SET_EM_BLOCK_ID:"sandbox_eblock_set_em_block_id",SANDBOX_GLOBAL_BLOCK_REPLACE:"sandbox_global_block_replace",APPLICATION_SCROLL_TO:"application_scroll-to",APPLICATION_SCROLL_BLOCK_SHOW:"application_scroll-block-show",APPLICATION_SCROLL_BLOCK_HIDE:"application_scroll-block-hide",APPLICATION_DISCUSS_SET_ID:"application_discuss_set_id",APPLICATION_DISCUSS_GET_COMMENT:"application_discuss_get_comment",APPLICATION_DISCUSS_NO_COMMENT:"application_discuss_no_comment",APPLICATION_DISCUSS_SAVE_TARGET:"application_discuss_save_target",APPLICATION_IFRAME_SET_HEIGHT:"application_iframe_set_height",APPLICATION_COMMON_STYLES_UPDATE:"application_commonStyles_update",APPLICATION_EMAIL_CONTENT_GET:"application_email_content_get",APPLICATION_OPEN_IMAGE_AI_POPUP:"application_open-image-ai-popup",APPLICATION_OPEN_IMAGE_UPLOAD_POPUP:"application_open-image-upload-popup",APPLICATION_OPEN_IMAGE_EDIT_POPUP:"application_open-image-edit-popup",APPLICATION_OPEN_IMAGE_GIF_POPUP:"application_open-image-gif-popup",APPLICATION_OPEN_IMAGE_STOCK_POPUP:"application_open-image-stock-popup",APPLICATION_CLOSE_IMAGE_EDIT_POPUP:"application_close-image-edit-popup",APPLICATION_NATIVE_IMAGE_DROP:"application_native-image-drop",APPLICATION_SUBJECT_UPDATE:M.createIdentifier("application_subject_update"),APPLICATION_PREHEADER_UPDATE:M.createIdentifier("application_preheader_update"),APPLICATION_DOMPARSER_ERROR:M.createIdentifier("application_domparser_error"),APPLICATION_UPDATE_ENTITY:M.createIdentifier("application_update_entity"),APPLICATION_IFRAME_DRAG_EVENT:M.createIdentifier("application_iframe_drag_event"),APPLICATION_HAS_AMP:M.createIdentifier("application_has_amp"),APPLICATION_CANVAS_IMAGE_GET:M.createIdentifier("application_canvas_image_get"),APPLICATION_PREVIEW_ALERT_SHOW:"application_preview_alert_show",APPLICATION_ATOM_INSERTED:M.createIdentifier("application_atom_inserted"),APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW:"application_template_not_em_alert_show",SANDBOX_WINDOW_CHARACTERISTIC:"sandbox_window-characteristic",SANDBOX_IFRAME_SETSIZE:"sandbox_iframe-setsize",SANDBOX_BLOCK_INSERT:"sandbox_block-insert",SANDBOX_ATOM_INSERT:"sandbox_atom-insert",SANDBOX_DRAG_CANCEL:"sandbox_drag-cancel",UPDATE_EDITOR_POSITION_FROM_EDITOR:"update_position_from_editor",UPDATE_EDITOR_POSITION_FROM_IFRAME:"update_position_from_iframe",SANDBOX_CHANGE_PREVIEW:"sandbox_change_preview",APPLICATION_CHANGE_PREVIEW:"application_change_preview",SANDBOX_LOCK_EDIT:"sandbox_lock_edit",SANDBOX_FLOATBLOCK_ADD:"sandbox_floatBlock_add",SANDBOX_FLOATBLOCK_REMOVE:"sandbox_floatBlock_remove",SANDBOX_FLOATBLOCK_COPY:"sandbox_floatBlock_copy",SANDBOX_FLOATBLOCK_SWAP:"sandbox_floatBlock_swap",EDITOR_CHANGE_FOCUS:"editor_change_focus",SANDBOX_RESIZED:"sandbox_resized",SANDBOX_LOCK_DISCUSS:"sandbox_lock_discuss",SANDBOX_DISCUSS_SET_TARGET:"sandbox_discuss_set_target",SANDBOX_DISCUSS_REMOVE_TARGET:"sandbox_discuss_remove_target",SANDBOX_DISCUSS_RESET:"sandbox_discuss_reset",SANDBOX_DISCUSS_GET_TARGET:"sandbox_discuss_get_target",SANDBOX_READY:M.createIdentifier("SANDBOX_READY"),SANDBOX_FLOATBLOCK_WRAP:"sandbox_floatblock_wrap",SANDBOX_FLOATBLOCK_DIR:"sandbox_floatblock_dir",SANDBOX_SUBJECT_UPDATE:M.createIdentifier("sandbox_subject_update"),SANDBOX_PREHEADER_UPDATE:M.createIdentifier("sandbox_preheader_update"),SANDBOX_DRAG_EVENT:M.createIdentifier("sandbox_drag_event"),SANDBOX_WHEEL:M.createIdentifier("sandbox_wheel"),SANDBOX_ADD_MERGETAG:M.createIdentifier("sandbox_add_mergetag"),SANDBOX_TRANSLATIONS:M.createIdentifier("sandbox_send_translations"),SANDBOX_SET_THEME_VARIABLES:M.createIdentifier("sandbox_send_theme_variables"),SANDBOX_SET_PROJECT_FONTS:M.createIdentifier("sandbox_set_project_fonts"),SANDBOX_CANVAS_IMAGE_CACHE_SETUP:M.createIdentifier("sandbox_canvas_image_cache_setup"),SANDBOX_SET_ENTITY:M.createIdentifier("sandbox_set_entity"),SANDBOX_INIT_START:M.createIdentifier("sandbox_init_start"),SANDBOX_INITED:M.createIdentifier("sandbox_inited"),SANDBOX_UPDATE_ENTITY:M.createIdentifier("sandbox_update_entity"),RELOAD:M.createIdentifier("reload"),SANDBOX_ADD_EXTENSIONS:M.createIdentifier("sandbox_add_extensions"),SANDBOX_REMOVE_EXTENSIONS:M.createIdentifier("sandbox_remove_extensions"),SANDBOX_ADD_SCRIPT:M.createIdentifier("sandbox_add_script"),SANDBOX_IS_EMAIL_EMPTY:M.createIdentifier("sandbox_is_email_empty"),SANDBOX_SWITCH_THEME:M.createIdentifier("sandbox_switch_theme")},Sg={language:"html",detectIndentation:!1,wordWrap:"on",wrappingIndent:"same",smoothScrolling:!0,automaticLayout:!0,tabSize:2,indentSize:2},Pg=(function(e){return e.IMG="img",e.TEXT="text",e.LINK="a",e.TABLE="table",e.VINDENT="vindent",e.TD="td",e.STRUCTURE="structure",e.GROUP="group",e.BUTTON="button",e.DIV="div",e.FLOAT_BLOCK="floatBlock",e.VAR="var",e.EMPTY_TABLE="emptyTable",e.EMPTY_TD="emptyTd",e.COUNTDOWN="countdown",e.VIDEO="video",e.COLUMN="column",e.CAROUSEL="carousel",e.ACCORDION="accordion",e.CUSTOM_TABLE="customTable",e.SOCIAL="social",e})({}),Og={ALL:"All",STANDARD:"Standard",PROJECT:"Project"},Tg="Appearance",Cg="Structure",Ag="Settings",Ig="Properties",wg="History",Mg="Disabled_tab",iu="Edit selected element",Rg="UTM parameters",Dg="Annotations parameters",Ng="Table properties",jg="Edit selected table cells",Lg="#b9b1b1",kg="Edit",Fg="AiChat",Wi="Build",Ug="Styles",Bg="Discuss",$g="Blocks",Gg="Atoms",qg="Optimise",xg={top:{width:null,style:null,color:null},right:{width:null,style:null,color:null},bottom:{width:null,style:null,color:null},left:{width:null,style:null,color:null},all:{width:null,style:null,color:null}},Hg="block",ou="email",Vg="cards",zg="pending",Qg="d41d8",Wg="valid",Kg="warnings",Yg="errors",Xg={LINKS:"Links",IMAGES:"Images",SPAM_ASSASSIN:"Spam assassin",PROBLEMS:"Problems"},Jg="1865",au=6892,su="desktop",uu="mobile",Zg="emailtags",eb="blocktags",tb=e=>({REORDER_ATOM:e("Reorder element"),CLONE_ATOM:e("Clone element"),REMOVE_ATOM:e("Remove element"),EDIT_ATOM:e("Edit element"),CHANGE_IMAGE:e("Change image"),CHANGE_IMAGE_EDIT:e("Edit"),CHANGE_IMAGE_STOCK:e("Stock"),CHANGE_IMAGE_CHANGETO:e("Upload"),CHANGE_IMAGE_GIF:e("GIF"),CHANGE_IMAGE_AI:e("Generate"),REORDER_BLOCK:e("Reorder block"),REORDER_BLOCK_UP:e("Move up"),REORDER_BLOCK_DOWN:e("Move down"),EDIT_BLOCK:e("Edit block"),CLONE_BLOCK:e("Clone block"),MERGE_BLOCK:e("Merge with the chosen block"),UNMERGE_BLOCK:e("Split blocks"),COPY_BLOCK_TO_CLIPBOARD:e("Copy block to clipboard"),PASTE_BLOCK_FROM_CLIPBOARD:e("Paste block from clipboard"),REMOVE_BLOCK:e("Remove block"),SAVE_TO_BLOCKS:e("Save to Blocks"),UPDATE_GLOBAL_BLOCK_IN_TEMPLATES:e("Push block update to all templates"),ADD_BLOCK:e("Add block"),ADD_EMPTY_BLOCK:e("Add an empty block"),ADD_SAVED_BLOCK:e("Add a saved block"),ADD_COMMON_BLOCK:e("Add a common block"),ADD_TEMPLATE_BLOCK:e("Add a template block"),ADD_SEARCH_BLOCK:e("Search a block"),REORDER_GROUP:e("Reorder group"),EDIT_GROUP:e("Edit group"),CLONE_GROUP:e("Clone group"),REMOVE_GROUP:e("Remove group"),ADD_GROUP:e("Add group"),LINK:e("link"),TABLE_COLUMN:e("cell"),TABLE:e("table"),FLOAT_BLOCK:e("column"),CONTAINER:e("container"),PICTURE:e("picture"),CAROUSEL:e("carousel"),ACCORDION:e("accordion"),SOCIAL:e("Social media"),VERTICAL_INDENT:e("indent"),TEXT:e("text"),BUTTON:e("button"),VAR:e("variable"),STRUCTURE:e("block"),EMAIL:e("email"),GROUP:e("group"),TYPOGRAF:e("Typograf"),COUNTDOWN:e("countdown"),ELEMENT:e("element"),VIDEO:e("video"),ELEMENT_PATH_LINK:e("Link"),ELEMENT_PATH_BLOCK:e("Block"),ELEMENT_PATH_ATOM:e("Element"),ELEMENT_PATH_TD:e("Cell"),ELEMENT_PATH_TABLE:e("Table"),ELEMENT_PATH_FLOATBLOCK:e("Column"),ELEMENT_PATH_TEXT:e("Text"),ELEMENT_PATH_DIV:e("Container"),ELEMENT_PATH_GROUP:e("Group"),ELEMENT_PATH_EMAIL:e("Email"),ELEMENT_PATH_IMG:e("Picture"),ELEMENT_PATH_VINDENT:e("Indent"),ELEMENT_PATH_BUTTON:e("Button"),ELEMENT_PATH_CAROUSEL:e("Carousel"),ELEMENT_PATH_ACCORDION:e("Accordion"),ELEMENT_PATH_SOCIAL:e("Social media"),ELEMENT_PATH_SECTION:e("Section"),TINYMCE_CHANGECASE:e("Case Change"),TINYMCE_UPPERCASE:e("Uppercase"),TINYMCE_LOWERCASE:e("Lowercase"),PASTE_HERE:e("Drop here"),INSERT_COLUMN_BEFORE_TABLE:e("Insert column before"),INSERT_COLUMN_AFTER_TABLE:e("Insert column after"),INSERT_ROW_BEFORE_TABLE:e("Insert row before"),INSERT_ROW_AFTER_TABLE:e("Insert row after"),MERGE_RIGHT_CELL_TABLE:e("Merge right cell"),MERGE_LEFT_CELL_TABLE:e("Merge left cell"),MERGE_TOP_CELL_TABLE:e("Merge top cell"),MERGE_BOTTOM_CELL_TABLE:e("Merge bottom cell"),SPLIT_CELL_TABLE:e("Split cell"),REMOVE_COLUMN_TABLE:e("Remove column"),REMOVE_ROW_TABLE:e("Remove row"),DROP_BLOCK_HINT:e("Click or drag a block")}),rb={Applications:"Apps",Articles:"Article",Banners:"Banners",Buttons:"Buttons","Call to Action":"Call to Action",Contacts:"Contacts",Content:"Content","E-Commerce":"E-Commerce",Feature:"Features",Footer:"Footers",Header:"Headers",Lists:"Lists",Menu:"Menus",Other:"Others",Polls:"Polls",Promocodes:"Promocodes",Separators:"Separators"},cu={maker:"https://ai-mail.emcdn.ru",blocks:"https://ai-mail.useblocks.io"},nb=/^(?:ant|vscode|monaco|docs)-/;function ib(e){return nb.test(e)}function ob(){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 ab=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function sb(){return ab}var ub=new Set;function cb(e,t,r=ub){return e.startsWith(`${t}-`)?!1:!ib(e)&&!r.has(e)}function lb(e,t){return`--${t}-${e}`}function cr(e){const t=ob();return cb(e,t,sb())?lb(e,t):`--${e}`}function db(e,t){const r=cr(e);return t!==void 0?`var(${r}, ${t})`:`var(${r})`}function fb(e,t){return db(e,t)}function pb(e){return cr(e)}function lu(e){return e.getOrCreateInstance(M.MESSAGE_SERVICE_ID,()=>new M.MessageService)}var mb=new WeakMap,du=new WeakMap;function hb(e){return mb.get(e)??0}function gb(e,t){let r=du.get(e);return r||(r=new Set,du.set(e,r)),r.add(t),()=>{r?.delete(t)}}var fu=M.INJECTION,bb=e=>e??M.createIdentifier$1();function ze(){const e=pe();return(0,N.useMemo)(()=>M.getContainer(e),[e])}function yb(e,t){const r=pe(),n=(0,N.useMemo)(()=>t||M.getContainer(r),[r,t]),[i,o]=(0,N.useState)(()=>n?.getInstance(e));return(0,N.useEffect)(()=>{const a=n?.onInject(s=>{s===e&&o(n.getInstance(e))});return()=>a?.dispose()},[e,n]),i}function vb(e,t){const r=pe(),n=(0,N.useMemo)(()=>t||M.getContainer(r),[r,t]),[i,o]=(0,N.useState)(()=>n?.getServices(e)||[]);return(0,N.useEffect)(()=>{if(!n)return;const a=n.onInject(s=>{s===M.getServiceContainerId(e)&&o(n.getServices(e))});return()=>{a?.dispose()}},[e,n]),i}function pu(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function _b(e,t){const r=pu(e,t);return e.serverSide.advancedConfigs?.[r]||{}}function Eb(e,t){const r=pu(e,t),n=e.user?.advancedConfigs?.[r],i=n!==void 0?n:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[r],...i}}function Sb(e,t,r){const n=_b(e,r),i=Eb(e,r);return M.pickKey([i,e.user,n,e.serverSide],t)}var Pb=M.createIdentifier$1("planFeatures.source");function Ob(e){return e.getOrCreateInstance(Pb,()=>Le(void 0))}function Tb(e,t){if(e&&Object.prototype.hasOwnProperty.call(e,t))return!!e[t]}function ot(e){return e?.getInstance(M.CONFIG_SOURCE_ID)?.get()??{}}function Ki(){const e=ze().getInstance(M.CONFIG_SOURCE_ID);if(!e)throw new Error("[config] источник конфигурации не зарегистрирован: нет provideConfig");return e}function gn(){const e=Ki();if(e.get()===void 0)throw e.ready();const t=(0,N.useCallback)(i=>{const o=e.watch(i);return()=>o.dispose()},[e]),r=(0,N.useSyncExternalStore)(t,()=>e.get()),n=Cb();return(0,N.useMemo)(()=>r,[r,n])}function Cb(){const e=ze(),t=Ob(e),r=(0,N.useCallback)(n=>{const i=t.watch(n);return()=>i.dispose()},[t]);return(0,N.useSyncExternalStore)(r,()=>t.get())}function Ab(e){const t=Ki();return gn(),Sb(t.layers(),e)}function Ib(){const e=ze(),t=(0,N.useCallback)(n=>{if(!e)return()=>{};const i=Ti(e).watch(n);return()=>i.dispose()},[e]),r=(0,N.useCallback)(()=>fm(e),[e]);return(0,N.useSyncExternalStore)(t,r,r)}function wb(e){return e.hasOwnProperty("children")}function mu(e,t,r){return e?.length?e.map((n,i)=>wb(n)?{key:M.generateUUID(),value:n.value,label:n.label,children:mu(n.children,t,r),type:"group"}:{key:M.generateUUID(),label:n.label,value:n.value,onClick:o=>{r(n.value,o.domEvent)}}):void 0}var Mb=(e,t)=>{const r=()=>{try{const n={...e,appLabel:"blocks_app"};window.dataLayer&&typeof window.dataLayer.push=="function"&&window.dataLayer.push(n);const i=typeof n.event=="string"&&n.event.trim()?n.event.trim():null,o=(typeof n.action=="string"&&n.action.trim()?n.action.trim():null)||(typeof n.event_action=="string"&&n.event_action.trim()?n.event_action.trim():null);let a;i&&o?a=`${i}_${o}`:i?a=i:o?a=o:a="event";const{event:s,action:c,...u}=n;"event_action"in u&&delete u.event_action;const h={...u,...i?{event:i}:{},...o?{action:o}:{}};typeof window<"u"&&window.amplitude&&typeof window.amplitude.track=="function"&&window.amplitude.track(a,h)}catch{}};t?setTimeout(r,t):r()},lr=()=>{const e=gn();return(0,N.useCallback)((t,r)=>{e.pushToGTM!==!1&&Mb(t,r)},[e.pushToGTM])},Rb="change",Db="element_setting",Nb={textStrong:"bold",textItalic:"italic",textUnderline:"underline",textStrikethrough:"strikethrough",textSuperscript:"superscript",textSubscript:"subscript",widthDim:"width_unit",heightDim:"height_unit",fontSizeDim:"font_size_unit",lineHeightDim:"line_height_unit",letterSpacingDim:"letter_spacing_unit"},jb=new Set(["width","height","padding","margin","font_size","line_height","letter_spacing","border_radius","border","box_shadow","opacity","color","background_color","border_color","text_color"]),Lb=new Set(["activateSection","changeKey","classNamePrefix","parent","path","type","caption","deletable","nextElem","prevElem","floatBlocks","usedColors"]),kb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").toLowerCase(),Fb=e=>Nb[e]??kb(e),Yi=e=>e.length>100?e.slice(0,100):e,Ub=e=>{if(e==null)return null;const t=typeof e;if(t==="boolean"||t==="number")return e;if(t==="string")return Yi(e);if(t==="object"){const r=e;if("value"in r){const n=typeof r.dim=="string"?r.dim:"",i=r.value===null||r.value===void 0?"":String(r.value);return Yi(`${i}${n}`)}try{return Yi(JSON.stringify(r))}catch{return null}}return null},Bb=(e,t)=>{if(!e||!t||typeof t!="object")return[];const r=[];for(const[n,i]of Object.entries(t))Lb.has(n)||i===void 0||r.push({event:Rb,action:Db,element_type:e,property:Fb(n),property_value:Ub(i)});return r},$b=e=>jb.has(e),Gb=(e,t=600)=>{const r=new Map,n=new Map,i=s=>{const c=r.get(s);c&&(clearTimeout(c),r.delete(s));const u=n.get(s);u&&(n.delete(s),e(u))};return{track:(s,c)=>{const u=Bb(s,c);for(const h of u){if(!$b(h.property)){e(h);continue}const f=`${h.element_type}:${h.property}`,y=r.get(f);y&&clearTimeout(y),n.set(f,h),r.set(f,setTimeout(()=>i(f),t))}},flush:()=>{Array.from(r.keys()).forEach(s=>i(s))}}};function bn(){const e=pe();return(0,N.useMemo)(()=>lu(M.getContainer(e)),[e])}function qb(){const e=bn(),t=lr(),r=(0,N.useRef)(t);r.current=t;const n=(0,N.useRef)(void 0);return n.current||(n.current=Gb(i=>r.current(i))),(0,N.useCallback)(function(i){e.send(i),i?.operation===ur.SANDBOX_ELEMENT_SETTINGS_SET&&i.type&&i.settings&&typeof i.settings=="object"&&n.current?.track(i.type,i.settings)},[e])}function xb(){const e=bn();return(0,N.useCallback)(function(t,r){e.send(t,r)},[e])}var hu=(0,N.createContext)({element:void 0}),Hb=()=>(0,N.useContext)(hu)?.element,gu=(0,N.createContext)(void 0),Vb=()=>(0,N.useContext)(gu),bu=(0,N.createContext)(!1),zb=()=>(0,N.useContext)(bu);function yu(e){return M.createIdentifier$1(e)}function vu(e,t){return e.getOrCreateInstance(t,()=>new M.AsyncEmitter)}function Qb(e,t){return e.getOrCreateInstance(t,()=>new M.AsyncEmitter).event}function Wb(e){return Xi(e).event}function Xi(e){const t=pe();return(0,N.useMemo)(()=>vu(M.getContainer(t),e),[t,e])}var _u=class{_listeners=[];add(e,t=0,r){const n={fn:r?e.bind(r):e,priority:t};return this._listeners.push(n),{dispose:()=>{const i=this._listeners.indexOf(n);i>=0&&this._listeners.splice(i,1)}}}async run(e){const t=[...this._listeners].sort((r,n)=>n.priority-r.priority);for(const{fn:r}of t){const n=await r(e);n!==null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof RegExp)&&Object.assign(e,n)}return e}},Kb=M.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),Yb=M.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE");function Xb(e){return e.getOrCreateInstance(Kb,()=>new _u)}function Jb(e){return e.getOrCreateInstance(Yb,()=>new _u)}async function Zb(e,t){return e?Xb(e).run({...t}):t}async function ey(e,t){return e?Jb(e).run({...t}):t}var ty=M.createIdentifier$1("ComponentRegistry"),Ji;function ry(e){Ji=e}function ny(e,t=ty){const r=M.DependencyResolver.getInstance(t);if(r)return r;if(!Ji)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return M.DependencyResolver.getOrCreateInstance(t,Ji)}var iy=class{_factories=new Map;add(e,t){const r=e;return this._factories.set(r,t),{dispose:()=>{this._factories.get(r)===t&&this._factories.delete(r)}}}get(e){return this._factories.get(e)}},Eu=M.createIdentifier$1("DomComponentRegistry");function oy(e,t=Eu){return M.DependencyResolver.getOrCreateInstance(t,()=>new iy)}function ay(e){return typeof e=="function"}function At(e){return(0,N.isValidElement)(e)}function sy(e){return typeof e=="function"||At(e)}function uy(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!At(e)}function Zi(e,t){return(0,N.createElement)(e,t)}function cy(e){return class extends N.Component{_ref=(0,N.createRef)();_instance;componentDidMount(){this._ref.current&&(this._instance=e(this.props),this._ref.current.appendChild(this._instance.node))}componentDidUpdate(r){this._instance?.update&&this._instance.update(this.props)}componentWillUnmount(){this._instance?.dispose&&this._instance.dispose()}render(){return(0,N.createElement)("div",{ref:this._ref})}}}var ly=class{_domComponentRegistry;_components=new Map;_domAdapters=new Map;constructor(e){this._domComponentRegistry=e}add(e,t){return this.override(e,()=>t)}addDom(e,t){const r=e;this._domAdapters.delete(r);const n=this._domComponentRegistry.add(e,t);return{dispose:()=>{this._domAdapters.delete(r),n.dispose()}}}override(e,t){const r=e;let n=this._components.get(r);n||(n={replacers:[]},this._components.set(r,n));const i=()=>{const o=n.replacers.findIndex(a=>a.replacer===t);o>=0&&(n.replacers.splice(o,1),this._recomputeComponent(r,n))};return n.replacers.push({replacer:t,dispose:i}),this._recomputeComponent(r,n),{dispose:i}}_recomputeComponent(e,t){t.component=t.replacers.reduce((r,{replacer:n})=>n(r),void 0)}get(e){if(sy(e))return e;const t=e,r=this._components.get(t);if(r?.component)return r.component;const n=this._domComponentRegistry.get(e);if(n){let i=this._domAdapters.get(t);return i||(i=cy(n),this._domAdapters.set(t,i)),i}}_resolveComponentInput(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean"||At(e))return e;if(typeof e=="string"){const t=this.get(e);return At(t)?t:t?Zi(t):e}if(ay(e))return Zi(e);if(uy(e)){const t=this.get(e.type);return At(t)?t:t?Zi(t,e.props):null}return null}getReactNode(e){return this._resolveComponentInput(e)}getReactElement(e){const t=this._resolveComponentInput(e);return At(t)?t:typeof t=="string"||t==null||typeof t=="boolean"||typeof t=="number"?(0,N.createElement)(N.Fragment,null,t):(0,N.createElement)(N.Fragment,null)}};ry(()=>new ly(oy(M.DependencyResolver,Eu)));function Su(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}var dy=365.2425,fy=Math.pow(10,8)*24*60*60*1e3,Pu=6e4,Ou=36e5,rM=-fy,py=3600,Tu=py*24,nM=Tu*7,my=Tu*dy,hy=my/12,iM=hy*3;function gy(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function by(e,t){var r;Su(1,arguments);var n=gy((r=t?.additionalDigits)!==null&&r!==void 0?r:2);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var i=Ey(e),o;if(i.date){var a=Sy(i.date,n);o=Py(a.restDateString,a.year)}if(!o||isNaN(o.getTime()))return new Date(NaN);var s=o.getTime(),c=0,u;if(i.time&&(c=Oy(i.time),isNaN(c)))return new Date(NaN);if(i.timezone){if(u=Ty(i.timezone),isNaN(u))return new Date(NaN)}else{var h=new Date(s+c),f=new Date(0);return f.setFullYear(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate()),f.setHours(h.getUTCHours(),h.getUTCMinutes(),h.getUTCSeconds(),h.getUTCMilliseconds()),f}return new Date(s+c+u)}var yn={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},yy=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,vy=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,_y=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Ey(e){var t={},r=e.split(yn.dateTimeDelimiter),n;if(r.length>2)return t;if(/:/.test(r[0])?n=r[0]:(t.date=r[0],n=r[1],yn.timeZoneDelimiter.test(t.date)&&(t.date=e.split(yn.timeZoneDelimiter)[0],n=e.substr(t.date.length,e.length))),n){var i=yn.timezone.exec(n);i?(t.time=n.replace(i[1],""),t.timezone=i[1]):t.time=n}return t}function Sy(e,t){var r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),n=e.match(r);if(!n)return{year:NaN,restDateString:""};var i=n[1]?parseInt(n[1]):null,o=n[2]?parseInt(n[2]):null;return{year:o===null?i:o*100,restDateString:e.slice((n[1]||n[2]).length)}}function Py(e,t){if(t===null)return new Date(NaN);var r=e.match(yy);if(!r)return new Date(NaN);var n=!!r[4],i=dr(r[1]),o=dr(r[2])-1,a=dr(r[3]),s=dr(r[4]),c=dr(r[5])-1;if(n)return My(t,s,c)?Cy(t,s,c):new Date(NaN);var u=new Date(0);return!Iy(t,o,a)||!wy(t,i)?new Date(NaN):(u.setUTCFullYear(t,o,Math.max(i,a)),u)}function dr(e){return e?parseInt(e):1}function Oy(e){var t=e.match(vy);if(!t)return NaN;var r=eo(t[1]),n=eo(t[2]),i=eo(t[3]);return Ry(r,n,i)?r*Ou+n*Pu+i*1e3:NaN}function eo(e){return e&&parseFloat(e.replace(",","."))||0}function Ty(e){if(e==="Z")return 0;var t=e.match(_y);if(!t)return 0;var r=t[1]==="+"?-1:1,n=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return Dy(n,i)?r*(n*Ou+i*Pu):NaN}function Cy(e,t,r){var n=new Date(0);n.setUTCFullYear(e,0,4);var i=n.getUTCDay()||7,o=(t-1)*7+r+1-i;return n.setUTCDate(n.getUTCDate()+o),n}var Ay=[31,null,31,30,31,30,31,31,30,31,30,31];function Cu(e){return e%400===0||e%4===0&&e%100!==0}function Iy(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(Ay[t]||(Cu(e)?29:28))}function wy(e,t){return t>=1&&t<=(Cu(e)?366:365)}function My(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}function Ry(e,t,r){return e===24?t===0&&r===0:r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}function Dy(e,t){return t>=0&&t<=59}var Ny=Object.freeze({});function jy(){return null}function to(){return Ny}function Ly(){return""}function ro(){return ky}function ky(){}function Fy(){return(0,N.useMemo)(()=>({get:()=>null,set:()=>{}}),[])}var Au=["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"],Uy=[...Au,"html","id","project","password"],no=new Set(["html",...Au,"global_block","project"]),By=new Set(["title","slug","type","modified","author","subject","description","excerpt","status","link","renderGuid","date","date_gmt","modified_gmt","comment_status","ping_status","template","related_email","project_title","project_author"]),$y=new Set(["tags","blocktags","lock","is_template","isAmp","global_block"]);function Iu(e,t){return no.has(e)?e==="html"?typeof t=="string":e==="meta"?t!=null&&typeof t=="object":e==="project"?t!=null:By.has(e)?t!=null&&t!=="":$y.has(e)?t!=null:t!==void 0:!1}function Gy(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 r=new Set(Uy),n={};for(const i of Object.keys(e))r.has(i)||(n[i]=e[i]);return Object.keys(n).length>0&&(t.catalogExtra=n),t}function qy(e,t){return{...Gy(e),html:t.html||"",insertFrom:t.insertFrom,fragmentRole:t.fragmentRole,name:t.name,project:t.project}}var xy=class extends M.BaseEmitter{async execute([e],t){for(const r of t){const n=await r(e);n&&(n.id===void 0&&(n.id=e.value.id),e.value=n)}return e.value}},Hy=class extends M.AsyncEmitter{};function oM(e){return e}var wu=class extends M.Disposable{_items=new Map;_onChangeEmitter=new M.Signal;async _getOrCreate(e,t){const r=this._items;let n;if(r.has(e))try{n=await r.get(e)}catch{t&&(n=await t())}else t&&(n=await t(),n&&this._onChangeEmitter.fire());return n}async _addOrUpdate(e,t){let r;const n=this._items;if(n.has(e))try{r=await n.get(e)}catch{}const i=await t(r);return M.deepEqual(r,i)||this._onChangeEmitter.fire(),i}entries(){return Promise.all([...this._items.entries()].map(([e,t])=>t.then(r=>[e,r]))).then(e=>e.filter(([t,r])=>!!r))}values(){return Promise.all([...this._items.values()].map(e=>e).filter(e=>!!e))}getOrCreate(e,t){const r=this._getOrCreate(e,()=>t(e));return this._items.set(e,r),r}addOrUpdate(e,t){const r=this._addOrUpdate(e,t);return this._items.set(e,r),r}async getIfPresent(e){if(this._items.has(e))try{return await this._items.get(e)}catch{return}}add(e,t){const r=Promise.resolve(t);return this._items.set(e,r),r}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=[],r=new Set(Array.from(e).map(([i,o])=>i)),n=(await this.entries()).filter(([i,o])=>!r.has(i));for(const[i,o]of e)t.push(this.addOrUpdate(i,()=>o)),r.add(i);for(const[i]of n)t.push(this.remove(i));return await Promise.all(t),n}finally{this.resumeChange()}}clear(){this._items.clear(),this._onChangeEmitter.fire()}suspendChange(){this._onChangeEmitter.suspend()}resumeChange(){this._onChangeEmitter.resume()}onChange=this._onChangeEmitter.event};function Vy(e,{filter:t,order:r="asc",orderBy:n,page:i,pageSize:o=20}={}){const a=e.length;let s=e.length;if(t!==void 0){const c=Object.keys(t);e=e.filter(u=>{for(const h of c){const f=u[h],y=t[h];return h==="id"||typeof f!="string"?f===y:typeof y=="string"&&f.startsWith(y)}return!0}),s=e.length}return n&&(e=e.sort((c,u)=>(c[n]>u[n]?1:u[n]>c[n]?-1:0)*(r==="asc"?1:-1))),i!==void 0&&(e=e.slice(o*(i-1),o*i)),{data:e,filteredTotal:s,total:a,totalPages:Math.ceil(s/o)}}var zy=1e3;function Mu(e,t,r=zy,n=0){if(n>r||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 a of i)if(!Mu(e[a],t[a],r,n+1))return!1;return!0}return!1}function Ru(e,t){if(!e||typeof e!="object")return t;if(!t||typeof t!="object")return{};const r={};for(const n of Object.keys(t)){const i=t[n],o=e[n];Mu(i,o)||(r[n]=i)}return r}function Qy(e=[]){if(e=e.filter(r=>r),e.length<=1)return e[0];const t=new Map;for(const r of e)for(const n of r)if(n.id!==void 0){const i=t.get(n.id)||{};t.set(n.id,{...i,...n})}return[...t].map(([r,n])=>n)}function Wy(e,t){return Du(e)&&Du(t)?String(e)===String(t):e===t}function Du(e){return typeof e=="string"||typeof e=="number"}var Ky=class extends M.Disposable{_cache=new wu;_readEmitter=new M.AsyncEmitter;_saveEmitter=this.addDisposable(new xy);_removeEmitter=this.addDisposable(new Hy);_foreignCache=Object.create(null);async get(e){return this._cache.getOrCreate(e,async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter(r=>!!r)))}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const r=this.addDisposable(new M.Disposable);r.addDispose(()=>delete this._foreignCache[e]);const n=r.addDisposable(new wu),i=r.addDisposable(new M.AsyncEmitter);t=this._foreignCache[e]={get:async(o,a={})=>{await n.getOrCreate(o,async()=>{try{const c=Qy(await i.fire(o))||[];for(const u of c)u[e]=o,await this._cache.add(u.id,u);return c}catch{return[]}});const s=(await this._cache.values()||[]).filter(c=>{const u=c[e];return u==null||Wy(u,o)});return Vy(s,a)},first(o,a={}){return t.get(o,{...a,page:1,pageSize:1}).then(({data:s})=>s[0])},handleRead:i.event,clear(){n.clear()},dispose(){r.dispose()}}}return t}async create(e,{source:t="",silent:r}={}){let n=e;return r||(n=await this._saveEmitter.fire({prev:void 0,patch:e,value:n,source:t})),n.id===void 0&&(n.id=M.generateUUID()),await this._cache.addOrUpdate(n.id,()=>n)}notifySave(e){return this._saveEmitter.fire(e)}async update(e,t,{source:r="",silent:n}={}){return this._cache.addOrUpdate(e,async i=>{const o=i?{...i,...t}:t;if(!n)return t=i?Ru(i,t):t,await this._saveEmitter.fire({prev:i,patch:t,value:o,source:r})})}async remove(e,{source:t="",silent:r}={}){const n=await this._cache.remove(e);return r||await this._removeEmitter.fire({value:n,source:t}),n}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 fr(e){const t=M.createIdentifier$1(e);return r=>r.getOrCreateInstance(t,()=>new Ky)}function Yy(e){const t=e.getInstance(M.STORE_ID);if(!t)throw new Error("Failed");return t}function Nu(e){const t=e.getInstance(M.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}var ju=fr("plugin.dataSource.blocks"),Lu=fr("plugin.dataSource.blockRevisions"),ku=fr("plugin.dataSource.comments"),Xy=yu(),Jy=yu(),Fu=M.createIdentifier$1("EmailPort");function Zy(e){return e.getInstance(Fu)}function ev(e,t){e.inject(Fu,t)}var Uu=M.createIdentifier$1("EmailHistoryPort"),Bu=M.createIdentifier$1("BlockHistoryPort");function $u(e){return e.getInstance(Bu)}function tv(e,t){e.inject(Bu,t)}function Gu(e){return e.getInstance(Uu)}function rv(e,t){e.inject(Uu,t)}var io={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},qu=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],oo=2e4,nv=qu.reduce((e,t)=>e+io[t],0),xu=oo+nv+3e3;function iv(e){return qu.reduce((t,r)=>t+Hu(r,e),0)}function Hu(e,t){const r=t?.[e];return typeof r=="number"&&r>0?r:io[e]}function ov(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:xu}function av(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:oo}function Vu(e=xu){return e+3e3}var sv=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleSaveEmail не ответил за ${e}ms — письмо не сохранено`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}},uv=({source:e,emailtags:t,group:r,tags:n,...i})=>i,cv=()=>Vu();async function lv({emails:e},t){const r=cv();let n;try{return await Promise.race([e.notifySave(t),new Promise((i,o)=>{n=setTimeout(()=>{const a=new sv(r);t.value.id,o(a)},r)})])}finally{n!==void 0&&clearTimeout(n)}}function dv(e){const{emails:t}=e,r=async(n,i)=>{const o=uv(i),a=n===void 0?void 0:await t.cache.getIfPresent(n),s=a?{...a,...o}:o,c=await lv(e,{prev:a,patch:a?Ru(a,o):o,value:s,source:i.source??""}),u=String(c.id??n??M.generateUUID()),h=c.id===void 0?{...c,id:u}:c;return await t.cache.addOrUpdate(u,()=>h)};return{async readEmail(n){return await t.get(n)??null},async createEmail(n){const i=await r(void 0,n);return i?.renderGuid?i:{...i,renderGuid:M.generateUUID()}},async updateEmail(n,i){return await r(n,i)}}}var aM=5e3;function vn(e){return e?.length?[...e].sort((t,r)=>Date.parse(r.modified)-Date.parse(t.modified))[0]:null}function ao(e,{freshSince:t}={}){return!(!e?.slug?.includes("autosave")||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function fv(e,t={}){const r=vn((e??[]).filter(n=>n?.html?.trim()));return ao(r,t)?r:null}function zu(e){const t=Date.parse(vn(e)?.modified??"");return{autosave:fv(e),...Number.isFinite(t)?{latestAt:t}:{}}}function pv(e,t){const r=vn((e??[]).filter(a=>a?.html?.trim())),n=Date.parse(r?.modified??""),i=r&&Number.isFinite(n)&&(t===void 0||n>t),o=[Date.parse(vn(e??[])?.modified??""),t??NaN].filter(a=>Number.isFinite(a));return{autosave:i&&ao(r)?r:null,...o.length?{latestAt:Math.max(...o)}:{}}}function mv({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var so=20,hv=({source:e,emailtags:t,group:r,tags:n,...i})=>i;function gv({revisions:e,revisionsByEmail:t}){const r=async(n,i)=>(t.clear(),await t.get(n,{page:i}),(await e.cache.values()??[]).filter(o=>String(o?.parent)===String(n)));return{async readRevisions(n,i=1){const o=await r(n,i);return{revisions:o.slice(so*(i-1),so*i),page:i,hasMore:o.length>so*i}},async readAutosave(n){return zu(await r(n,1))},async saveAutosave(n,i){const o=hv(i);return await e.create({...o,parent:n,modified:new Date().toString()})}}}function uo(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Qu(e,t){const r={...e};return t===void 0?(delete r.meta,r):(r.meta={...e.meta??{},...t},r)}function Wu(e,t,r){return e&&!uo(t)&&uo(e)?{...r,meta:e.meta}:r}var Ku=fr("plugin.dataSource.emails"),Yu=fr("plugin.dataSource.emailRevisions"),Xu=M.createIdentifier$1("emailDocuments.provided");function bv(e){const t=Ku(e),r=Yu(e),n=r.byForeignKey("parent");return e.getInstance(Xu)?{emails:t,emailRevisions:r}:(e.inject(Xu,!0),ev(e,dv({emails:t})),rv(e,gv({revisions:r,revisionsByEmail:n})),Nu(e).addDisposable(t.onSave(({prev:i,patch:o,value:a})=>Wu(i,o,a),Number.MIN_VALUE)),{emails:t,emailRevisions:r})}var yv=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
11
11
|
<html>
|
|
12
12
|
<head>
|
|
13
13
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
@@ -57,14 +57,14 @@ The error may be correlated with this previous error:
|
|
|
57
57
|
|
|
58
58
|
`+r.toString()),e}}var Rl={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},eP=["(","?"],Wn={")":["("],":":["?","?:"]},tP=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;function rP(e){for(var t=[],r=[],n,i,o,a;n=e.match(tP);){for(i=n[0],o=e.substr(0,n.index).trim(),o&&t.push(o);a=r.pop();){if(Wn[i]){if(Wn[i][0]===a){i=Wn[i][1]||i;break}}else if(eP.indexOf(a)>=0||Rl[a]<Rl[i]){r.push(a);break}t.push(a)}Wn[i]||r.push(i),e=e.substr(n.index+i.length)}return e=e.trim(),e&&t.push(e),t.concat(r.reverse())}var nP={"!":function(e){return!e},"*":function(e,t){return e*t},"/":function(e,t){return e/t},"%":function(e,t){return e%t},"+":function(e,t){return e+t},"-":function(e,t){return e-t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},"&&":function(e,t){return e&&t},"||":function(e,t){return e||t},"?:":function(e,t,r){if(e)throw t;return r}};function iP(e,t){for(var r=[],n=0,i,o,a,s,c;n<e.length;n++){if(s=e[n],a=nP[s],a){for(i=a.length,o=Array(i);i--;)o[i]=r.pop();try{c=a.apply(null,o)}catch(u){return u}}else t.hasOwnProperty(s)?c=t[s]:c=+s;r.push(c)}return r[0]}function oP(e){var t=rP(e);return function(r){return iP(t,r)}}function aP(e){var t=oP(e);return function(r){return+t({n:r})}}var Dl={contextDelimiter:"",onMissingKey:null};function sP(e){for(var t=e.split(";"),r=0,n;r<t.length;r++)if(n=t[r].trim(),n.indexOf("plural=")===0)return n.substr(7)}function Ko(e,t){var r;this.data=e,this.pluralForms={},this.options={};for(r in Dl)this.options[r]=t!==void 0&&r in t?t[r]:Dl[r]}Ko.prototype.getPluralForm=function(e,t){var r=this.pluralForms[e],n,i,o;return r||(n=this.data[e][""],o=n["Plural-Forms"]||n["plural-forms"]||n.plural_forms,typeof o!="function"&&(i=sP(n["Plural-Forms"]||n["plural-forms"]||n.plural_forms),o=aP(i)),r=this.pluralForms[e]=o),r(t)},Ko.prototype.dcnpgettext=function(e,t,r,n,i){var o,a,s;return i===void 0?o=0:o=this.getPluralForm(e,i),a=r,t&&(a=t+this.options.contextDelimiter+r),s=this.data[e][a],s&&s[o]?s[o]:(this.options.onMissingKey&&this.options.onMissingKey(r,e),o===0?r:n)};var Nl={"":{plural_forms(e){return e===1?0:1}}},uP=/^i18n\.(n?gettext|has_translation)(_|$)/,Yo=(e,t,r)=>{const n=new Ko({}),i=new Set,o=()=>{i.forEach(g=>g())},a=g=>(i.add(g),()=>i.delete(g)),s=(g="default")=>n.data[g],c=(g,m="default")=>{n.data[m]={...n.data[m],...g},n.data[m][""]={...Nl[""],...n.data[m]?.[""]},delete n.pluralForms[m]},u=(g,m)=>{c(g,m),o()},h=(g,m="default")=>{n.data[m]={...n.data[m],...g,"":{...Nl[""],...n.data[m]?.[""],...g?.[""]}},delete n.pluralForms[m],o()},f=(g,m)=>{n.data={},n.pluralForms={},u(g,m)},y=(g="default",m,l,b,d)=>(n.data[g]||c(void 0,g),n.dcnpgettext(g,m,l,b,d)),E=(g="default")=>g,S=(g,m)=>{let l=y(m,void 0,g);return r?(l=r.applyFilters("i18n.gettext",l,g,m),r.applyFilters("i18n.gettext_"+E(m),l,g,m)):l},v=(g,m,l)=>{let b=y(l,m,g);return r?(b=r.applyFilters("i18n.gettext_with_context",b,g,m,l),r.applyFilters("i18n.gettext_with_context_"+E(l),b,g,m,l)):b},C=(g,m,l,b)=>{let d=y(b,void 0,g,m,l);return r?(d=r.applyFilters("i18n.ngettext",d,g,m,l,b),r.applyFilters("i18n.ngettext_"+E(b),d,g,m,l,b)):d},A=(g,m,l,b,d)=>{let _=y(d,b,g,m,l);return r?(_=r.applyFilters("i18n.ngettext_with_context",_,g,m,l,b,d),r.applyFilters("i18n.ngettext_with_context_"+E(d),_,g,m,l,b,d)):_},I=()=>v("ltr","text direction")==="rtl",T=(g,m,l)=>{const b=m?m+""+g:g;let d=!!n.data?.[l??"default"]?.[b];return r&&(d=r.applyFilters("i18n.has_translation",d,g,m,l),d=r.applyFilters("i18n.has_translation_"+E(l),d,g,m,l)),d};if(e&&u(e,t),r){const g=m=>{uP.test(m)&&o()};r.addAction("hookAdded","core/i18n",g),r.addAction("hookRemoved","core/i18n",g)}return{getLocaleData:s,setLocaleData:u,addLocaleData:h,resetLocaleData:f,subscribe:a,__:S,_x:v,_n:C,_nx:A,isRTL:I,hasTranslation:T}},cP={ru_RU:{"Unlimited possibilities with the PRO plan":["Безграничные возможности с тарифом PRO"],"All plan features":["Все преимущества тарифов"],Free:["Free"],Personal:["Персональный"],Advanced:["Продвинутый"],"Advanced+":["Продвинутый+"],Pro:["Профессиональный"],"Pro+":["Профессиональный+"],Enterprise:["Корпоративный"],"Projects and emails":["Проекты и письма"],"Email editor":["Редактор писем"],"Additional features":["Дополнительные функции"],"Team collaboration":["Командная работа"],Support:["Поддержка"],Projects:["Проекты"],"Saved email templates":["Сохранённые шаблоны писем"],"Saved blocks":["Сохранённые блоки"],"Exports per month":["Экспорты в месяц"],"Export to HTML, ZIP and clipboard":["Экспорт в HTML, ZIP и буфер обмена"],"Export to PDF":["Экспорт в PDF"],"Export to PNG":["Экспорт в PNG"],"Export to webhook":["Экспорт в вебхук"],"Template import":["Импорт шаблона"],"Test emails":["Отправка тестовых писем"],"Preview mode":["Предпросмотр письма"],"Undo and redo":["Отмена и повтор действий"],"Export to Outlook":["Экспорт в Outlook"],"Email client tests":["Тесты в почтовиках"],"Block visibility control":["Управление видимостью блоков"],"Border control":["Управление рамками"],"Corner radius control":["Управление скруглением"],"Shadow control":["Управление тенью"],"Convert block to image":["Преобразование блока в изображение"],Typographer:["Типограф"],"Variables support":["Работа с переменными"],"Timer element":["Элемент «Таймер»"],"Video element":["Элемент «Видео»"],"AMP elements":["AMP элементы"],"AI image element":["Элемент «AI картинка»"],"AI image generation":["AI генерация изображений"],"Stock images and GIFs":["Стоковые изображения и GIF"],"Image editor":["Редактор изображений"],"AMP support":["Поддержка AMP"],"HTML code editing":["Правка HTML кода"],"Mobile adaptation":["Адаптация под мобильные устройства"],"Mobile element properties editor":["Редактор свойств элементов для мобильных"],"AI Assistant":["AI Ассистент"],"Link and image checks":["Проверка ссылок и изображений"],"Saved version history":["История сохранённых версий"],Users:["Пользователи"],"Template discussion":["Обсуждение шаблонов"],"User roles and access levels":["Роли пользователей и уровни доступа"],Chat:["Чат"],"Email support":["Электронная почта"],"Phone support":["Телефон"],"Video call":["Видеосозвон"],"Invoice payment and document flow":["Оплата по счёту, документооборот"],"Failed to load plan data":["Не удалось загрузить данные тарифа"],"Editor features depend on your plan. Check your connection and try again.":["Возможности редактора зависят от тарифа. Проверьте соединение и повторите попытку."],"Try again":["Повторить"]}};function lP(e,t){const r=t?cP[t]:void 0;return r&&e.setLocaleData(r),e}var dP={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"},jl={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0};function Mr(e){"@babel/helpers - typeof";return Mr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mr(e)}function Ll(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function kl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ll(Object(r),!0).forEach(function(n){fP(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ll(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fP(e,t,r){return t=pP(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pP(e){var t=mP(e,"string");return Mr(t)=="symbol"?t:String(t)}function mP(e,t){if(Mr(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Mr(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var hP=kl(kl({},jl),{},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",week:"Week",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"}),Fl={placeholder:"Select time",rangePlaceholder:["Start time","End time"]},Ul={lang:{placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"],...hP},timePickerLocale:{...Fl}},gP=Ul,bP=Z.__exportAll({default:()=>Bl}),Ce="${label} is not a valid ${type}",Bl={locale:"en",Pagination:dP,DatePicker:Ul,TimePicker:Fl,Calendar:gP,global:{placeholder:"Please select",close:"Close",sortable:"sortable"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckAll:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",deselectAll:"Deselect all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand",collapse:"Collapse"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:Ce,method:Ce,array:Ce,object:Ce,number:Ce,date:Ce,boolean:Ce,integer:Ce,float:Ce,regexp:Ce,email:Ce,url:Ce,hex:Ce},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"},ColorPicker:{presetEmpty:"Empty",transparent:"Transparent",singleColor:"Single",gradientColor:"Gradient"}},$l=Bl,Gl=(e,t)=>{const r=(0,N.useRef)(void 0);r.current=e;const n=(0,N.useRef)(void 0);(0,N.useEffect)(()=>{n.current!==null&&r.current(n.current||[]),n.current=t},t)},Xo=Yo();function ql(e){return{__:e.__.bind(e),_x:e._x.bind(e),_n:e._n.bind(e),_nx:e._nx.bind(e),sprintf:ZS,isRTL:e.isRTL.bind(e),hasTranslation:e.hasTranslation.bind(e)}}var xl=(0,N.createContext)(ql(Xo));function yP(e){const{children:t,i18n:r=Xo}=e,[,n]=(0,N.useReducer)(()=>[],[]);(0,N.useEffect)(()=>r.subscribe(n),[r]);const i=(0,N.useMemo)(()=>ql(r),[r]);return(0,N.createElement)(xl.Provider,{value:i},t)}var Rr=()=>(0,N.useContext)(xl),Hl=Xo;function vP(e){if(e==="uk"||e.startsWith("uk_"))return"uk";const t=e.search(/[_-]/);return t>0?e.slice(0,t):e}var Jo=class extends M.Disposable{_options;_listeners=[];constructor(e){super(),this._options=e}fire=e=>{if(!this.isDisposed()){let t;const r=[...this._listeners];for(const n of r){if(t===!1)return!1;t instanceof Promise?t=t.then(i=>i===!1||this.isDisposed()?!1:n(i)).catch(i=>{}):t=n(e)}return t}};addEventListener=e=>{const t=this._listeners,r=this._options;return t.push(e),t.length===1&&this._options?.onFirstListenerAdd&&this._options.onFirstListenerAdd(),{dispose:()=>{const n=t.indexOf(e);n>=0&&(t.splice(n,1),t.length||r?.onFirstListenerAdd&&r.onLastListenerRemove())}}};event=this.addEventListener},Vl;(function(e){function t(i){let o;const a=new Jo({onFirstListenerAdd(){o=i(a.fire)},onLastListenerRemove(){o.dispose()}});return a.event}e.snapshot=t;function r(i,o){return t(a=>i(s=>o(s)&&a(s)))}e.filter=r;function n(i,o){return t(a=>i(s=>a(o(s))))}e.map=n})(Vl||(Vl={}));var zl=M.createIdentifier$1("helpers.commandEmitter");function _P(e,t,r){e instanceof M.Container||(e=M.getContainer(e)),e.getOrCreateInstance(zl,()=>new Jo).fire({id:t,payload:r})}function EP(e,t){return M.getContainer(e).getOrCreateInstance(zl,()=>new Jo).addEventListener}var Ql=(e,t)=>{const r=EP(Al(),e);(0,N.useEffect)(()=>{const n=r(({id:i,payload:o})=>{i===e&&t(o)});return()=>n.dispose()},[r,e,t])};function CM(e){return e}var SP="SAVE",AM="SET_THEME",Wl="NOTIFY",IM="SET_CONFIG",wM="UPDATE_CONFIG",Kn=e=>Hl.__(e);function Kl(){return typeof navigator<"u"&&navigator.onLine===!1}function Yl(e){if(e==null)return[];const t=[e];if(typeof e!="object")return t;const r=e;if(r.error!=null&&(t.push(r.error),typeof r.error=="object")){const n=r.error;n.data!=null&&t.push(n.data),n.error!=null&&t.push(n.error)}if(r.data!=null&&(t.push(r.data),typeof r.data=="object")){const n=r.data;n.error!=null&&t.push(n.error)}return r.innerException!=null&&t.push(r.innerException),t}function Xl(e){if(!e)return!1;if(typeof e=="string"){const r=e.toLowerCase();return r.includes("fetch")||r.includes("network")||r.includes("timeout")||r.includes("failed to fetch")||r.includes("load failed")||r.includes("networkerror")}if(e instanceof Error)return Xl(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 PP(e){return Kl()?!0:Yl(e).some(Xl)}function OP(e){return Kl()?{title:Kn("No internet connection"),description:Kn("Check your network connection and try again.")}:PP(e)?{title:Kn("Server is unavailable"),description:Kn("Could not reach the server. Please try again later.")}:null}function Jl(e,t){return typeof e=="string"&&e.trim()?e:typeof e=="number"||typeof e=="boolean"?String(e):t}var TP=new Set(["uninitialized","pending","fulfilled","rejected"]);function Zl(e){return typeof e=="string"&&!TP.has(e)?e:void 0}function Yn(...e){for(const t of e){if(typeof t=="string"&&t.trim())return t;if(typeof t=="number"||typeof t=="boolean")return String(t)}}function ed(e){const t=OP(e);if(t)return t;const r=Yl(e),n=e&&typeof e=="object"?e:{},i=Yn(n.title,n.message),o=Yn(n.description),a=i??Yn(...r.flatMap(c=>{if(!c||typeof c!="object")return[c];const u=c,h=u.data;return[u.message,u.code,h?.code,h?.message,Zl(u.status)]}))??"Unknown error",s=o??Yn(...r.flatMap(c=>{if(!c||typeof c!="object")return typeof c=="string"?[c]:[];const u=c,h=u.data;return[u.description,typeof u.error=="string"?u.error:void 0,h?.message,h?.code,Zl(u.status)]}))??"Unknown error";return{title:Jl(a,"Unknown error"),description:Jl(s,"Unknown error")}}var td="bottomRight";function CP(e){if(e.title!=null||e.message==null)return e;const{message:t,...r}=e;return{...r,title:t}}function AP({node:e}){const t=(0,N.useCallback)(r=>r?.replaceWith(e),[e]);return(0,G.jsx)("div",{ref:t})}var IP=["title","message","description","actions","icon","closeIcon"];function wP(e){let t=e;for(const r of IP){const n=t[r];n instanceof HTMLElement&&(t===e&&(t={...e}),t[r]=(0,G.jsx)(AP,{node:n}))}return t}function MP(e){return{id:e.id,code:e.html,title:e.title,subject:e.subject,preheader:e.preheader}}function RP(e){return{id:e.id,code:e.html,title:e.title}}function Xn(){const e=Xi(M.events.ON_NOTIFICATION),{notification:t}=_e.ui_kit$App.useApp(),r=(0,N.useCallback)((u,h)=>{u.type||(u={...u,type:"info"});const f=Qe({...u});return e.fire(f).then(y=>y.every(E=>E!==!1)?(u={...u,...f},u.placement===void 0&&(u.placement=td),u=Object.assign(u,...y.filter(E=>typeof E=="object")),h||(t[u.type]?t[u.type](wP(CP(u))):u.title),u):!1)},[t,e]),n=(0,N.useCallback)((u,h)=>{const{title:f,description:y}=ed(u);return r({...u&&typeof u=="object"?u:{},title:(0,G.jsx)("div",{dangerouslySetInnerHTML:{__html:f}}),description:(0,G.jsx)("div",{dangerouslySetInnerHTML:{__html:y}}),type:"error"},h)},[r]),i=(0,N.useCallback)((u="Success",h)=>r({...typeof u=="string"?{title:u}:u,type:"success"},h),[r]),o=(0,N.useCallback)((u,h)=>r({...u,type:"warning"},h),[r]),a=(0,N.useCallback)((u,h)=>r({...u,type:"info"},h),[r]),s=(0,N.useCallback)(u=>{t.destroy(u)},[t]),c=(0,N.useCallback)((u,h,f,y,E=td)=>{if(f){const{title:S,description:v}=ed(f);n({id:u,data:h,title:S,description:v,placement:E,innerException:f?.data instanceof Error?f.data:f,error:f},y)}},[n]);return(0,N.useMemo)(()=>({notify:r,success:i,error:n,warning:o,fromError:c,info:a,destroy:s}),[r,i,n,o,c,a,s])}function DP(){const{notify:e}=Xn();Ql(Wl,e)}var MM="en_US",rd=M.createIdentifier$1("locale.service"),NP={ready:!1};function nd(){const e=ze().getInstance(rd),t=(0,N.useCallback)(r=>{if(!e)return()=>{};const n=e.state.watch(r);return()=>n.dispose()},[e]);return(0,N.useSyncExternalStore)(t,()=>e?.snapshot()??NP)}function id(e){const t=e?.[""];return typeof t?.lang=="string"?t.lang:void 0}function jP(){const e=nd();return e.id??id(e.catalog)}var LP=({children:e})=>{const t=nd(),r=Xn(),n=t.id??id(t.catalog),i=(0,N.useMemo)(()=>lP(Yo(t.catalog),n),[t.catalog,n]),o=t.antd,a=o&&o.locale!==$l.locale?o:$l;return(0,N.useEffect)(()=>{},[t.id]),Gl(([s])=>{!s&&t.failure&&r.fromError(t.failure.kind,void 0,t.failure.error??{status:"FETCH_ERROR"})},[t.failure,r]),(0,G.jsx)(yP,{i18n:i,children:(0,G.jsx)(kP,{children:(0,G.jsx)(bu.Provider,{value:t.ready,children:(0,G.jsx)(_e.ui_kit$ThemeProvider,{locale:a,children:e})})})})};function kP({children:e}){const t=Rr();return(0,G.jsx)(_e.ui_kit$UiKitI18nProvider,{value:t,children:e})}function at({id:e,type:t,title:r,excerpt:n,author:i,acf:{subject:o,description:a,html:s,project:c,related_email:u,tags:h,type:f,is_template:y,global_block:E,lock:S},...v}){return{...v,id:String(e),author:String(i),renderGuid:M.generateUUID(),description:a,html:s,excerpt:Ne(r),project:se(c)?c.ID:c,project_author:se(c)?c.post_author:void 0,project_title:se(c)?c.post_title:void 0,tags:h,is_template:y,global_block:E,type:f,related_email:ie(se(u)?u.ID:u),title:Ne(r)||"",lock:S}}function od({title:e,subject:t,description:r,renderGuid:n,html:i,project:o,tags:a,type:s,related_email:c,is_template:u,global_block:h,lock:f,author:y,...E}){return{...E,author:de(y),title:e,acf:{description:r,related_email:de(c),html:i,project:o,tags:a,type:s,is_template:u,...typeof h=="boolean"?{global_block:h}:{},lock:f}}}function ad({id:e,title:t,acf:{html:r},excerpt:n,parent:i,author:o,...a}){return{...a,id:ie(e),author:ie(o),parent:ie(i),title:Ne(t)||"",html:r,excerpt:se(n)?n.rendered:n}}function sd({parent:e,title:t,html:r,project:n,author:i,...o}){return{...o,author:de(i),parent:de(e),title:Ne(t),"acf[html]":r,"acf[project]":se(n)?n.id||n.ID:n}}function Zo(e){return(t,r,n,i)=>e(M.getContainer(r))(t,r,n,i)}var ea=[{type:"Blocks",id:"LIST"},{type:"ParentsBlocks",id:"LIST"},{type:"TemplatesBlocks",id:"LIST"}],Jn=be({reducerPath:"blocksApi",tagTypes:["Blocks","TemplatesBlocks","ParentsBlocks","Block"],baseQuery:Oe({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getBlocks:e.query({queryFn(t,r){const n=q(r),i={order:"desc",orderby:"modified"},o={};if(t.notEmbed||(o._embed=""),t.projectId&&(o._embed="author",o._fields="id,title,blocktags,blockfolder,group,modified,date,type,acf.lock,acf.project.ID,acf.type,author,acf.is_template,acf.global_block,acf.html,_embedded",i["filter[meta_key]"]="project",i["filter[meta_value]"]=t.projectId),t.fields&&(o._fields=t.fields),t.page&&(i.page=t.page),t.order&&(i.order=t.order),t.orderby&&(i.orderby=t.orderby),t.folderTag&&t.folderTag!=="all"?(i["filter[tax_query][relation]"]="AND",i["filter[tax_query][0][taxonomy]"]="blockfolder",i["filter[tax_query][0][field]"]="id",i["filter[tax_query][0][terms]"]=t.folderTag,i["filter[tax_query][0][include_children]"]="0"):t.hasOwnProperty("folderTag")&&(t.folderTag!=="all"||typeof t.folderTag=="object"&&t.folderTag===null)&&!t.tags?.length&&t.status&&t.status!=="trash"&&(i["filter[tax_query][0][taxonomy]"]="blockfolder",i["filter[tax_query][0][operator]"]="NOT EXISTS"),t.tags?.length>0&&t.status!=="trash"){i["filter[tax_query][relation]"]="AND";for(let a=0,s=t.tags.length;a<s;a++){const c=t.tags[a];i[`filter[tax_query][${a+1}][taxonomy]`]="blocktags",i[`filter[tax_query][${a+1}][field]`]="id",i[`filter[tax_query][${a+1}][terms]`]=c}}return t.type&&(i["filter[meta_query][2][key]"]="type",i["filter[meta_query][2][value]"]=t.type),t.name&&(i.search=t.name),t.pageSize&&(i.per_page=t.pageSize),t.status==="trash"&&(o.status="trash"),n.wp.eblock_list(i,{extraQuery:o}).then(Pe(at))},providesTags:t=>t?[...t.map(({id:r})=>({type:"Blocks",id:r})),{type:"Blocks",id:"LIST"}]:[{type:"Blocks",id:"LIST"}]}),getBlocksSchema:e.query({queryFn(t,r){return q(r).wp.eblock_list(void 0,{method:"OPTIONS",extraQuery:{_fields:"schema.properties.acf"}})}}),getParentEmailBlocks:e.query({queryFn(t,r){const n=q(r),i={"filter[meta_query][0][compare]":"LIKE"},o={};if(t.notEmbed||(o._embed=""),t.emailId&&(i["filter[meta_query][0][key]"]="related_email",i["filter[meta_query][0][value]"]=t.emailId),t.fields&&(o._fields=t.fields),t.page&&(i.page=t.page),t.tags?.length>0){i["filter[tax_query][relation]"]="AND";for(let a=0,s=t.tags.length;a<s;a++){const c=t.tags[a];i[`filter[tax_query][${a}][taxonomy]`]="blocktags",i[`filter[tax_query][${a}][field]`]="id",i[`filter[tax_query][${a}][terms]`]=c}}return t.type&&(i["filter[meta_query][2][key]"]="type",i["filter[meta_query][2][value]"]=t.type),t.name&&(i.search=t.name),t.pageSize&&(i.per_page=t.pageSize),n.wp.eblock_list(i,{extraQuery:o}).then(Pe(at))},providesTags:t=>t?[...t.map(({id:r})=>({type:"ParentsBlocks",id:r})),{type:"ParentsBlocks",id:"LIST"}]:[{type:"ParentsBlocks",id:"LIST"}]}),getTemplateBlocks:e.query({queryFn:(t,r)=>{const n=q(r),i={"filter[meta_query][1][key]":"is_template","filter[meta_query][1][value]":"1",orderby:"modified",order:"desc"},o={};if(t.notEmbed||(o._embed=""),t.fields&&(o._fields=t.fields),t.page&&(i.page=t.page),t.tags?.length>0){i["filter[tax_query][relation]"]="AND";for(let a=0,s=t.tags.length;a<s;a++){const c=t.tags[a];i[`filter[tax_query][${a}][taxonomy]`]="blocktags",i[`filter[tax_query][${a}][field]`]="id",i[`filter[tax_query][${a}][terms]`]=c}}return t.type&&(i["filter[meta_query][2][key]"]="type",i["filter[meta_query][2][value]"]=t.type),t.name&&(i.search=t.name),t.pageSize&&(i.per_page=t.pageSize),n.wp.eblock_list(i,{extraQuery:o}).then(Pe(at))},providesTags:t=>t?[...t.map(({id:r})=>({type:"TemplatesBlocks",id:r})),{type:"TemplatesBlocks",id:"LIST"}]:[{type:"TemplatesBlocks",id:"LIST"}]}),getBlock:e.query({queryFn(t,r){return q(r).wp.eblock_detail({id:de(t)},{extraQuery:{_embed:""}}).then(ce(at))},providesTags:(t,r,n)=>[{type:"Block",id:n}]}),addBlock:e.mutation({queryFn(t,r){return q(r).wp.eblock_create({...od(t),status:"publish"},{type:M.ContentType.Json}).then(ce(at))},invalidatesTags:[...ea]}),editBlock:e.mutation({queryFn:Zo(t=>({blockId:r,source:n,...i},o)=>{const a=Or(t),s=Qe(od(i));return a.wp.eblock_partial_update({id:r},s,{type:M.ContentType.Json,extraQuery:{_embed:"wp:term"}}).then(ce(at))}),invalidatesTags:(t,r,n)=>[...ea,{type:"Blocks",id:n.blockId}]}),deleteBlock:e.mutation({queryFn(t,r){const n=q(r);let i,o;return typeof t=="object"?(i=t.id,o=t.force):(i=t,o=!1),n.wp.eblock_delete({id:i},{force:o}).then(hn(at))},invalidatesTags:(t,r,n)=>[...ea,{type:"Blocks",id:typeof n=="object"?n.id:n}]}),addTag:e.mutation({queryFn(t,r){return q(r).wp.blocktags_create({...t},{type:M.ContentType.Json})}}),getDeletableTag:e.query({queryFn([t,r],n){return q(n).wp.eblock_list({status:["private"],"filter[meta_key]":"project","filter[meta_value]":t,blocktags:[r]},{extraQuery:{"_fields[]":"blocktags"}}).then(Pe(at))}}),autoSaveBlock:e.mutation({queryFn({blockId:t,body:r},n){const i=q(n),o=sd(r);return i.wp.eblock_autosaves_create({id:t},o,{type:M.ContentType.FormData}).then(ce(ad))}})})}),{useGetBlocksQuery:FP,useGetBlockQuery:RM,useLazyGetBlockQuery:DM,useGetBlocksSchemaQuery:UP,useGetParentEmailBlocksQuery:BP,useAddBlockMutation:$P,useEditBlockMutation:GP,useAddTagMutation:NM,useAutoSaveBlockMutation:qP,useGetTemplateBlocksQuery:xP}=Jn,ta={invalidateBlockId:null,isCodeMode:!1,codeModeDirection:"right",editorThemeColor:"light",isSettingsDisabled:!1,settings:{width:""},elementSettings:{},searchFilters:{},monacoDidMount:!1},Lt="blockSlice",ud=ge({name:Lt,initialState:ta,reducers:{switchCodeMode:e=>{e.isCodeMode=!e.isCodeMode},setEditorThemeColor:(e,t)=>{e.editorThemeColor=t.payload},setBlockSettings:(e,t)=>{Object.assign(e,{...e,settings:t.payload,isSettingsDisabled:!1})},setBlockSettingsDisable:(e,t)=>{e.isSettingsDisabled=t.payload},setElementSettings:(e,t)=>{e.elementSettings=t.payload},setSearchFilters:(e,t)=>{e.searchFilters=t.payload},resetBlockSlice:()=>ta},extraReducers:e=>{e.addMatcher(t=>t.type==="blocksApi/queries/queryResultPatched",(t,r)=>{const n=r.payload.queryCacheKey.match(/\(([0-9]+)\)/);n?.[1]&&(t.invalidateBlockId=n[1])}),e.addMatcher(t=>t.type==="blocksApi/invalidateTags",(t,r)=>{if(r.payload[0].id===+t.invalidateBlockId)return{...ta,isCodeMode:t?.isCodeMode,codeModeDirection:t.codeModeDirection}}),e.addMatcher(Jn.endpoints.editBlock.matchFulfilled,t=>{t.invalidateBlockId=null})}}),{switchCodeMode:jM,setEditorThemeColor:HP,setBlockSettings:VP,setElementSettings:zP,setBlockSettingsDisable:QP,setSearchFilters:LM,resetBlockSlice:WP}=ud.actions,KP=e=>e[Lt].isCodeMode,YP=e=>e[Lt].settings,XP=e=>e[Lt].elementSettings,JP=e=>e[Lt].editorThemeColor,ZP=e=>e[Lt].isSettingsDisabled,cd=M.createIdentifier$1("CodeMode");function ra(){let e;try{const t=window.localStorage?.getItem(pt.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 eO(e){try{window.localStorage?.setItem(pt.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function Zn(e){return e.getOrCreateInstance(cd,()=>{const t=Le(ra());return t.watch(eO),t})}function ld(e){return e?.getInstance(cd)?.get()??ra()}function dd(e,t){const r=Zn(e);r.get().isCodeMode!==t&&r.set({...r.get(),isCodeMode:t})}function tO(e){const t=Zn(e);t.set({...t.get(),isCodeMode:!t.get().isCodeMode})}function rO(e,t){const r=Zn(e);r.set({...r.get(),direction:t})}var nO="100%",fd=ra(),iO={activeModal:"",lastActiveSettingsTab:Wi,activeSettingsTab:Wi,isPanelHistoryCollapsed:!0,monacoHeight:0,isCodeMode:fd.isCodeMode,codeModeDirection:fd.direction,isHeaderCodeMenuOpen:{current:!1,switched:!1},emailWidth:nO,emailViewType:su,mobileViewActive:{shutdown:!0,styles:!0},emailMaxWidthSize:425,propertiesPanelKey:iu,parentBlocks:[],isGlobalLoading:!1},Ae="emailPageSlice",pd=ge({name:Ae,initialState:iO,reducers:{openModal:(e,t)=>{e.activeModal=t.payload},closeModal:e=>{e.activeModal=""},setActiveSettingsTab:(e,t)=>{e.lastActiveSettingsTab=e.activeSettingsTab,e.activeSettingsTab=t.payload,t.payload!=="History"&&(e.isPanelHistoryCollapsed=!0)},resetToLastActiveSettingsTab:e=>{e.lastActiveSettingsTab==="Properties"?e.activeSettingsTab="Build":e.activeSettingsTab=e.lastActiveSettingsTab,e.lastActiveSettingsTab!=="History"&&(e.isPanelHistoryCollapsed=!0)},switchIsPanelHistoryCollapsed:(e,t)=>{e.isPanelHistoryCollapsed=t.payload||!e.isPanelHistoryCollapsed},setEmailWidth:(e,{payload:t})=>{e.emailWidth=t,e.emailViewType=typeof t=="number"&&t<=e.emailMaxWidthSize?uu:su,window.localStorage.setItem(pt.em_default_sizes,JSON.stringify(t))},setEmailMaxWidthSize:(e,{payload:t})=>{e.emailMaxWidthSize=t},setEmailViewType:(e,t)=>{e.emailViewType=t.payload},setCodeMode:(e,{payload:t})=>{e.isCodeMode=t},switchCodeModeDirection:(e,{payload:t})=>{e.codeModeDirection=t},setMobileViewActive:(e,t)=>{e.mobileViewActive=t.payload},setPropertiesPanelKey:(e,t)=>{e.propertiesPanelKey=t.payload},resetParentBlocks:e=>{e.parentBlocks=[]},setParentBlocks:(e,t)=>{e.parentBlocks=t.payload},setIsGlobalLoading:(e,t)=>{e.isGlobalLoading=t.payload},setHeaderCodeMenuOpen:(e,t)=>{e.isHeaderCodeMenuOpen.current&&!t.payload?e.isHeaderCodeMenuOpen.switched=!0:e.isHeaderCodeMenuOpen.switched=!1,e.isHeaderCodeMenuOpen.current=t.payload}},extraReducers:e=>{e.addMatcher(Jn.endpoints.getParentEmailBlocks.matchFulfilled,(t,r)=>{t.parentBlocks=r.payload})}}),{openModal:oO,closeModal:aO,setActiveSettingsTab:sO,resetToLastActiveSettingsTab:uO,switchIsPanelHistoryCollapsed:cO,setEmailWidth:lO,switchCodeModeDirection:dO,setMobileViewActive:fO,setEmailViewType:kM,setCodeMode:pO,setEmailMaxWidthSize:FM,setPropertiesPanelKey:mO,resetParentBlocks:hO,setIsGlobalLoading:gO,setHeaderCodeMenuOpen:bO}=pd.actions,yO=e=>e[Ae].isCodeMode,vO=e=>e[Ae].emailWidth,_O=e=>e[Ae].activeModal,EO=e=>e[Ae].parentBlocks,SO=e=>e[Ae].emailViewType,PO=e=>e[Ae].isGlobalLoading,OO=e=>e[Ae].mobileViewActive,TO=e=>e[Ae].codeModeDirection,CO=e=>e[Ae].activeSettingsTab,AO=e=>e[Ae].propertiesPanelKey,IO=e=>e[Ae].isHeaderCodeMenuOpen,wO=e=>e[Ae].isPanelHistoryCollapsed,md=()=>yb(M.COOKIE_MANAGER_ID),MO=()=>{},RO={};function DO(){const e=ze(),t=(0,N.useCallback)(r=>{if(!e)return MO;const n=Po(e).watch(r);return()=>n.dispose()},[e]);return{read:(0,N.useCallback)(()=>Cn(e).profile??RO,[e]),subscribe:t}}function na(){const{read:e,subscribe:t}=DO();return(0,N.useSyncExternalStore)(t,e,e)}function NO(){return na().locale}var UM="new";function jO(){const{emailId:e}=to();return e==="new"?void 0:e}function LO(e,t){return e==null||t==null?!1:String(e)===String(t)}function hd(e,t){if(e?.myRole==="owner"||e?.myRole==="admin")return e.myRole;if(e?.myRole==="user"||e?.myRole==="viewer")return"user";const r=Array.isArray(e?.members)?e.members:[],n=Array.isArray(e?.invites)?e.invites:[];if(t?.id==null||t.id==="")return null;const i=r.find(a=>LO(a?.userId,t.id));if(i){if(i.role==="owner"||i.role==="admin")return i.role;if(i.role==="user"||i.role==="viewer")return"user"}const o=t.email?.trim().toLowerCase();return o&&n.some(a=>a?.email?.trim().toLowerCase()===o)?"invited":null}function ia(e,t){return t.isPlugin?!1:e?.ownerPlan?.isPaid!==!0}function kO(e,t){const r=hd(e,t);return r===null||r==="owner"}var FO=3,UO=6,ei=new WeakMap,gd=new Map;function bd(e){let t=e.parentElement;for(;t;){const r=getComputedStyle(t).overflowY;if(r==="auto"||r==="scroll")return t;t=t.parentElement}return null}function yd(e,t){const r=e?e.clientHeight:typeof window>"u"?0:window.innerHeight;return`${Math.round(r*t)}px 0px`}function BO(e){if(typeof IntersectionObserver>"u")return;const t=gd.get(e);if(t)return t;const r={fill:new IntersectionObserver(n=>{for(const i of n)i.isIntersecting&&ei.get(i.target)?.fill()},{root:e,rootMargin:yd(e,FO)}),drop:new IntersectionObserver(n=>{for(const i of n)i.isIntersecting||ei.get(i.target)?.drop()},{root:e,rootMargin:yd(e,UO)})};return gd.set(e,r),r}function $O(e,t){const r=BO(bd(e));return r?(ei.set(e,t),r.fill.observe(e),r.drop.observe(e),()=>{r.fill.unobserve(e),r.drop.unobserve(e),ei.delete(e)}):!1}var oa=".blocks-search__result-body",vd=`${oa}[data-block-preview="filled"]`,aa=new Map;function GO(e){const t=e.shadowRoot?.firstElementChild,r=t instanceof HTMLStyleElement?t.nextElementSibling:t;return r instanceof HTMLElement?r.offsetHeight:0}function sa(e){if(!e.length)return;const t=bd(e[0].body),r=t?t.getBoundingClientRect().top:0,n=e.map(({body:o})=>o.getBoundingClientRect());let i=0;e.forEach(({body:o,height:a,placeholder:s},c)=>{const u=n[c];if(t&&u.top<r&&(i+=a-u.height),o.style.height=`${a}px`,s){o.dataset.previewPlaceholder="true";return}o.dataset.previewMeasured="true",aa.set(o,a)}),t&&i!==0&&(t.scrollTop+=i)}function qO(){let e=0,t=0;return aa.forEach((r,n)=>{if(!n.isConnected){aa.delete(n);return}e+=r,t+=1}),t?e/t:0}function _d(e){const t=qO();!t||!e||sa([...e.querySelectorAll(`${oa}:not([data-preview-measured]):not([data-preview-placeholder])`)].map(r=>({body:r,height:t,placeholder:!0})))}function xO(e,t){e&&(sa(Ed([...e.querySelectorAll(`${vd} .blocks-search__result-html`)].map(r=>[r,t]))),_d(e))}function Ed(e){const t=e.map(([n,i])=>GO(n)*i),r=[];return e.forEach(([n],i)=>{const o=n.closest(oa);o&&t[i]>0&&r.push({body:o,height:t[i]})}),r}var ua=new Map,ca=0;function HO(){ca=0;const e=[...ua].filter(([t])=>t.closest(vd)!==null);ua.clear(),sa(Ed(e)),_d(e[0]?.[0].ownerDocument??null)}function VO(e,t){ua.set(e,t),ca||(ca=requestAnimationFrame(HO))}function zO(e){return(0,N.useCallback)(t=>VO(t,e),[e])}var QO="https://cdn.useblocks.io/socnets";function WO(e){let t=String(e??"");for(;t.endsWith("/");)t=t.slice(0,-1);return t}function KO(e){let t=String(e??"");for(;t.startsWith("/");)t=t.slice(1);return t}function la(e){return`${WO(QO)}/${KO(e)}`}var Sd={telegram:"tg",youtube:"yt",vk:"vk",yandex_zen:"yd",x:"xa",twitter:"tw",instagram:"ig",facebook:"fb",pinterest:"pi",tiktok:"tt",ok:"ok",max:"max",rutube:"rutube",whatsapp:"whatsapp",linkedin:"linkedin",viber:"viber",apple:"apple",dis:"dis",drbl:"drbl",fig:"fig",gh:"gh",ggl:"ggl",mdm:"mdm",rdt:"rdt",sgnl:"sgnl",sc:"sc",sptf:"sptf",tmblr:"tmblr",twitch:"twitch",thrds:"thrds",msngr:"msngr",bs:"bs"};function Pd(e,t){return la(`${e}${t?"-negative":""}.png`)}function YO(e){const t=String(e.buttonBgColor??"").trim();return t||(e.blockBgEnabled&&String(e.blockBgColor??"").trim()?String(e.blockBgColor).trim():"")}function XO(e){const t=YO(e);return t||String(e.hostCellBgForIconLuminance??"").trim()}function Od(e){const t=String(e??"").trim();if(t.endsWith("%")){const n=parseFloat(t);return Number.isNaN(n)?null:Math.min(1,Math.max(0,n/100))}const r=parseFloat(t);return Number.isNaN(r)?null:Math.min(1,Math.max(0,r))}function da(e){const t=String(e??"").trim();if(t.endsWith("%")){const n=parseFloat(t);return Number.isNaN(n)?null:Math.min(255,Math.max(0,Math.round(n/100*255)))}const r=parseFloat(t);return Number.isNaN(r)?null:Math.min(255,Math.max(0,Math.round(r)))}function JO(e){const t=String(e??"").trim().toLowerCase();if(!t||t==="transparent")return null;if(t.startsWith("#")){let u=t.slice(1);return/^[0-9a-f]{3}$/i.test(u)&&(u=u.split("").map(h=>h+h).join("")),/^[0-9a-f]{6}$/i.test(u)?{r:parseInt(u.slice(0,2),16),g:parseInt(u.slice(2,4),16),b:parseInt(u.slice(4,6),16),a:1}:/^[0-9a-f]{8}$/i.test(u)?{r:parseInt(u.slice(0,2),16),g:parseInt(u.slice(2,4),16),b:parseInt(u.slice(4,6),16),a:parseInt(u.slice(6,8),16)/255}:null}const r=/^rgba?\(\s*([^)]+)\)$/i.exec(t);if(!r)return null;let n=1,i=r[1];if(i.includes("/")){const u=i.split(/\s*\/\s*/);if(i=u[0].trim(),!u[1])return null;const h=Od(u[1]);if(h===null)return null;n=h}const o=i.split(/[\s,]+/).map(u=>u.trim()).filter(Boolean);if(o.length<3)return null;const a=da(o[0]),s=da(o[1]),c=da(o[2]);if(a===null||s===null||c===null)return null;if(o.length>=4&&!r[1].includes("/")){const u=Od(o[3]);if(u===null)return null;n=u}return{r:a,g:s,b:c,a:n}}function fa(e){const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function ZO(e){const t=JO(e);if(!t)return null;const r=t.a,n=h=>Math.round(h*r+255*(1-r)),i=n(t.r),o=n(t.g),a=n(t.b),s=fa(i),c=fa(o),u=fa(a);return .2126*s+.7152*c+.0722*u}function eT(e){const t=ZO(e);return t==null?!1:t>=.6}function Td(e){return Object.fromEntries(Object.entries(Sd).map(([t,r])=>[t,Pd(r,e)]))}var Dr=Td(!1),Cd=Td(!0);function tT({blockBgEnabled:e,blockBgColor:t,buttonBgColor:r}){const n=!!(e&&String(t??"").trim()),i=!!String(r??"").trim();return n||i}function rT(e,t={}){const r=Sd[e],n=tT(t);if(r&&n){const i=XO(t);return la(`${r}${i&&eT(i)?"-negative-black":"-negative"}.png`)}return r&&!n?la(`${r}.png`):(n?Cd:Dr)[e]??Dr[e]}function nT(e,t){const r=Dr[e];return t==="dark"?Cd[e]??r:r}var iT=Dr;function oT(){return[{platform:"telegram",label:"Telegram",href:""},{platform:"whatsapp",label:"WhatsApp",href:""},{platform:"instagram",label:"Instagram",href:""},{platform:"facebook",label:"Facebook",href:""},{platform:"youtube",label:"YouTube",href:""}]}var BM=["tg","yt","vk","yd","xa","ig","fb"].map(e=>Pd(e,!1));function Ad(e){return e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?(?:script|embed|object|frameset|frame|iframe|applet|meta)[^>]*>/gi,""),e=e.replace(/ on\w+="[^"]*"/g,""),e=e.replace(/ on\w+='[^']*'/g,""),e}var ti=N.default.forwardRef(({icon:e,...t},r)=>{const n=gn(),i=(0,N.useMemo)(()=>{if(!n?.icons)return;const o={};for(const[a,s]of Object.entries(n.icons))typeof s=="string"&&(o[a]=Ad(s));return Object.keys(o).length>0?o:void 0},[n?.icons]);return(0,G.jsx)(_e.ui_kit$EmIcons,{ref:r,icon:e,configIcons:i,strokeWidth:n?.iconStrokeWidth,...t})});ti.displayName="EmIcons";function aT(e){const{isPlanLocked:t,trialEnabled:r,canStartTrial:n}=e;return!t||r||!n?"upsell":"trial"}var pa=Vi("config/changeConfigModeWithCodeCheck",async(e,{dispatch:t,getState:r})=>{const n=M.getContainer({getState:r}),i=n?.getInstance(M.CONFIG_SOURCE_ID);i?.setMode(e),t(Qn.endpoints.editMe.initiate({email_builder_config:e}));const o=i?.get()?.codeEnabled;return n&&o===!1&&ld(n).isCodeMode&&dd(n,!1),e});function sT(e,t,r){const n=e.data?.status,i=typeof e.status=="number"?e.status:void 0;return n===403||i===403?{kind:"failure",userMessage:e.message&&String(e.message).trim()||t}:{kind:"success",title:e.code&&String(e.code).trim()||r,description:e.message&&String(e.message).trim()||void 0}}async function uT(e,t,r,n,i,o,a){const s=await t(e),c=r("Could not activate the trial. Please try again later or contact support.");if("error"in s&&s.error){const u=s.error,h="data"in u?u.data:void 0;return a((h&&typeof h=="object"&&h!==null&&"message"in h?String(h.message):void 0)||c),!1}if("data"in s&&s.data&&typeof s.data=="object"){const u=sT(s.data,c,r("Trial period activated."));return u.kind==="failure"?(a(u.userMessage),!1):(n(pa("pro")),await i(void 0),u.description?o({title:u.title,description:u.description}):o(u.title),!0)}return n(pa("pro")),await i(void 0),o(r("Trial period activated.")),!0}var cT="https://app.useblocks.io/api".replaceAll(/[\\/]$/g,""),ma="wp-json/limits/v1",lT="wp-json/subscription/v2",Id=be({reducerPath:"limitsApi",baseQuery:Oe({baseUrl:cT}),tagTypes:["LimitsStats","LimitsWarnings","SubscriptionMe"],endpoints:e=>({getLimitsStats:e.query({query:()=>({url:`${ma}/stats`,method:"GET"}),providesTags:["LimitsStats"]}),getLimitsStatsByType:e.query({query:t=>({url:`${ma}/stats/${t}`,method:"GET"}),providesTags:(t,r,n)=>[{type:"LimitsStats",id:n}]}),getLimitsWarnings:e.query({query:()=>({url:`${ma}/warnings`,method:"GET"}),providesTags:["LimitsWarnings"]}),getSubscriptionMeV2:e.query({query:()=>({url:`${lT}/me`,method:"GET"}),providesTags:["SubscriptionMe"]}),invalidatePlanCache:e.mutation({queryFn:async(t,r)=>Fe(await Ue(r).billing.planInvalidateCreate())})})}),{useGetLimitsStatsQuery:$M,useLazyGetLimitsStatsQuery:GM,useGetLimitsStatsByTypeQuery:qM,useLazyGetLimitsStatsByTypeQuery:dT,useGetLimitsWarningsQuery:xM,useLazyGetLimitsWarningsQuery:HM,useGetSubscriptionMeV2Query:VM,useLazyGetSubscriptionMeV2Query:zM,useInvalidatePlanCacheMutation:fT}=Id,Nr="Integrations",ri="Webhook",ni="TestRecipients",ha="Storage",wd="Plan",Be=(e,t)=>{const r=Fe(e);return"error"in r?{error:r.error}:{data:t(r.data)}},ga=be({reducerPath:"projectSettingsV2Api",tagTypes:[Nr,ri,ni,ha,wd],baseQuery:Oe({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({getProjectPlan:e.query({async queryFn(t,r,n,i){const o=await F_(M.getContainer(r),String(t));if(o)return{data:o};const a=await i(`/projects/${t}/plan`);return a.error?{error:a.error}:{data:a.data}},providesTags:(t,r,n)=>[{type:wd,id:String(n)}]}),getProjectIntegrations:e.query({async queryFn(t,r){return Be(await Re(M.getContainer(r)).projects.integrationsList({id:String(t)}),n=>Object.fromEntries((n?.items||[]).map(i=>[i.provider,i])))},providesTags:(t,r,n)=>[{type:Nr,id:String(n)}]}),getIntegrationCredentials:e.query({async queryFn({projectId:t,provider:r},n){return Be(await Re(M.getContainer(n)).projects.integrationsDetail({id:String(t),provider:r,reveal:!0}),i=>i?.settings||{})},keepUnusedDataFor:0}),putProjectIntegration:e.mutation({async queryFn({projectId:t,provider:r,settings:n},i){return Be(await Re(M.getContainer(i)).projects.integrationsUpdate({id:String(t),provider:r},{settings:n}),o=>o)},invalidatesTags:(t,r,{projectId:n})=>[{type:Nr,id:String(n)}]}),deleteProjectIntegration:e.mutation({async queryFn({projectId:t,provider:r},n){return Be(await Re(M.getContainer(n)).projects.integrationsDelete({id:String(t),provider:r}),()=>{})},invalidatesTags:(t,r,{projectId:n})=>[{type:Nr,id:String(n)}]}),getProjectWebhook:e.query({async queryFn(t,r){return Be(await Re(M.getContainer(r)).projects.webhookList({id:String(t)}),n=>n?.url||"")},providesTags:(t,r,n)=>[{type:ri,id:String(n)}]}),putProjectWebhook:e.mutation({async queryFn({projectId:t,url:r},n){return Be(await Re(M.getContainer(n)).projects.webhookUpdate({id:String(t)},{url:r}),i=>({url:i?.url||""}))},invalidatesTags:(t,r,{projectId:n})=>[{type:ri,id:String(n)}]}),getProjectStorage:e.query({async queryFn(t,r){return Be(await Re(M.getContainer(r)).projects.storageList({id:String(t)}),n=>n)},providesTags:(t,r,n)=>[{type:ha,id:String(n)}]}),putProjectSettings:e.mutation({async queryFn({projectId:t,body:r},n){return Be(await Re(M.getContainer(n)).projects.settingsUpdate({id:String(t)},r),i=>i)},invalidatesTags:(t,r,{projectId:n})=>[{type:Nr,id:String(n)},{type:ri,id:String(n)},{type:ni,id:String(n)},{type:ha,id:String(n)}]}),getProjectTestRecipients:e.query({async queryFn(t,r){return Be(await Re(M.getContainer(r)).projects.testRecipientsList({id:String(t)}),n=>n?.emails||[])},providesTags:(t,r,n)=>[{type:ni,id:String(n)}]}),putProjectTestRecipients:e.mutation({async queryFn({projectId:t,emails:r},n){return Be(await Re(M.getContainer(n)).projects.testRecipientsUpdate({id:String(t)},{emails:r}),i=>({emails:i?.emails||[]}))},invalidatesTags:(t,r,{projectId:n})=>[{type:ni,id:String(n)}]})})}),{useGetProjectPlanQuery:ba,useLazyGetProjectPlanQuery:pT,useGetProjectStorageQuery:QM,usePutProjectSettingsMutation:WM,useGetProjectIntegrationsQuery:mT,useLazyGetIntegrationCredentialsQuery:hT,usePutProjectIntegrationMutation:KM,useDeleteProjectIntegrationMutation:YM,useGetProjectWebhookQuery:gT,usePutProjectWebhookMutation:XM,useGetProjectTestRecipientsQuery:bT,usePutProjectTestRecipientsMutation:yT}=ga;function vT(){const{__:e}=Rr(),t=qe(),r=md(),{success:n,notify:i}=Xn(),o=lr(),[a]=wl(),[s,{isLoading:c}]=WS(),[u]=fT(),h=(0,N.useCallback)(f=>{i({title:f,type:"error"})},[i]);return{activate:(0,N.useCallback)(async()=>{const f=r.get(Qi.em_token);if(!f)return h(e("Sign in to your account to activate the trial period.")),!1;try{const y=await uT(f,s,e,t,a,n,h);return y&&(await u(),t(jt.util.invalidateTags(["project"])),t(ga.util.invalidateTags(["Plan"])),o({event:"change",action:"activate_trial"})),y}catch(y){return h(y?.data?.message||e("Could not activate the trial. Please try again later or contact support.")),!1}},[e,s,r,t,a,u,h,n,o]),isActivating:c}}var _T=({open:e,sideOnOk:t,onCancel:r,initialSlide:n=0})=>{const{__:i}=Rr(),o=ro(),[a,s]=(0,N.useState)(n),c=(0,N.useRef)(null),u=lr(),h=()=>{t&&t(),o("/billing"),r(!1)};(0,N.useEffect)(()=>{e&&c.current&&(c.current.goTo(n,!0),s(n))},[e,n]);const f=(0,N.useMemo)(()=>[{image:i("https://cdn.useblocks.io/1351/241017_18_1sGjUaZ.png"),backgroundColor:"var(--ub-blue-2)",title:i("More editing features"),description:i("Use our visual editor to customize every element to your needs: change borders and their radius, box shadows, paddings, background, and much more.")},{image:i("https://cdn.useblocks.io/1351/241017_18_J7QtvZ3.png"),backgroundColor:"var(--ub-purple-2)",title:i("Work with the HTML code"),description:i("Edit the HTML version of your email template in the Code mode and see the changes in real time. Builder has no code restrictions — you can create templates of any complexity!")},{image:i("https://cdn.useblocks.io/1351/241017_18_2fjDRfL.png"),backgroundColor:"var(--ub-cyan-2)",title:i("AI image generation"),description:i("Generate stunning visuals for your emails with ease. We have trained our AI model to ensure the highest quality images.")},{image:i("https://cdn.useblocks.io/1351/241017_18_D5C25Zp.png"),backgroundColor:"var(--ub-green-2)",title:i("Stock photos and GIFs"),description:i("Search the vast gallery of stock photos and GIFs to find visuals for any occasion. You can filter the results by image orientation, color scheme, and more.")},{image:i("https://cdn.useblocks.io/1351/241017_18_NDYloAO.png"),backgroundColor:"var(--ub-magenta-2)",title:i("Version history"),description:i("Check who and when made changes to the email template and, if necessary, restore one of the previous versions.")},{image:i("https://cdn.useblocks.io/1351/241017_18_g5mVlmh.png"),backgroundColor:"var(--ub-red-2)",title:i("Image editor"),description:i("Want to resize an image, add some text, or apply a filter? No need to leave builder! You can make all the basic changes in our image editor.")},{image:i("https://cdn.useblocks.io/1351/241017_18_ur8Lh3W.png"),backgroundColor:"var(--ub-orange-2)",title:i("Email optimization"),description:i("Check your email against broken links, missing alt texts, large images, and other issues that might prevent your emails from hitting inboxes.")},{image:i("https://cdn.useblocks.io/1351/241017_18_S5Pld9p.png"),backgroundColor:"var(--ub-volcano-2)",title:i("Team collaboration"),description:i("Share the project with your team and collaborate in real time. Add comments to individual email blocks and discuss necessary edits right in the builder.")},{image:i("https://cdn.useblocks.io/1351/241017_18_tGbb2j9.png"),backgroundColor:"var(--ub-geekblue-2)",title:i("Email testing"),description:i("Check how your email appears across various devices and email clients.")},{image:i("https://cdn.useblocks.io/1351/241017_18_gDXi4uM.png"),backgroundColor:"var(--ub-geekblue-2)",title:i("AI assistant"),description:i("Let our AI assistant enhance your email template! From creating subject lines and preheaders based on the email copy to generating the whole email with your website in mind!")}],[i]);return(0,N.useEffect)(()=>{if(e&&c.current){c.current.goTo(n,!0),s(n);const y=f[n];u({event:"open_modal",action:"open_premium-features_modal",modal_id:"premium-features",offer_id:y.title})}},[e,f,n,u]),(0,G.jsxs)(_e.ui_kit$Modal,{open:e,footer:null,onCancel:r,closable:!1,className:"premium-features-modal",classNames:{mask:"premium-features-modal-mask"},styles:{mask:{background:"rgba(0, 0, 0, 0.65)"}},width:1100,style:{maxWidth:"80%"},children:[(0,G.jsx)(_e.ui_kit$Carousel,{dots:!0,slidesToShow:1,slidesToScroll:1,autoplay:!0,className:"carousel-slider",draggable:!0,autoplaySpeed:5e3,initialSlide:a,ref:c,children:f.map((y,E)=>(0,G.jsx)("div",{children:(0,G.jsxs)("div",{className:"carousel-slide",style:{background:`${y.backgroundColor}`},children:[(0,G.jsx)("div",{className:"slide-item-image",children:(0,G.jsx)("img",{src:y.image,alt:`slide-${E}`})}),(0,G.jsxs)("div",{className:"slide-item-content",children:[(0,G.jsx)("h3",{className:"slide-title",children:y.title}),(0,G.jsx)("p",{className:"slide-description",children:y.description})]})]})},E))}),(0,G.jsx)("div",{className:"modal-subtitle",children:i("This and other features are available for you on a higher plan.")}),(0,G.jsxs)("div",{className:"modal-buttons",children:[(0,G.jsx)(_e.ui_kit$Button,{size:"large",onClick:()=>r(!1),children:i("Cancel")}),(0,G.jsx)(_e.ui_kit$Button,{type:"primary",size:"large",onClick:h,style:{padding:"0 30px"},children:i("Select plan")})]})]})},ET="CheckCircleVerified",ST=["Export to HTML, AMP, PDF and PNG","Code editing and version history","AI assistant and AI image generation","Stock photos, GIFs and icons, plus the image editor","Email checks and teamwork"],Md=["https://cdn.useblocks.io/1351/241017_18_1sGjUaZ.png","https://cdn.useblocks.io/1351/241017_18_J7QtvZ3.png","https://cdn.useblocks.io/1351/241017_18_2fjDRfL.png","https://cdn.useblocks.io/1351/241017_18_D5C25Zp.png","https://cdn.useblocks.io/1351/241017_18_NDYloAO.png","https://cdn.useblocks.io/1351/241017_18_g5mVlmh.png","https://cdn.useblocks.io/1351/241017_18_ur8Lh3W.png","https://cdn.useblocks.io/1351/241017_18_S5Pld9p.png","https://cdn.useblocks.io/1351/241017_18_tGbb2j9.png","https://cdn.useblocks.io/1351/241017_18_gDXi4uM.png"],PT=5e3,OT=({open:e,onCancel:t,onConfirm:r,loading:n=!1})=>{const{__:i}=Rr(),[o,a]=(0,N.useState)(0),s=(0,N.useMemo)(()=>Md.map(c=>({backgroundImage:`url(${i(c)})`})),[i]);return(0,N.useEffect)(()=>{if(!e){a(0);return}const c=setInterval(()=>a(u=>(u+1)%Md.length),PT);return()=>clearInterval(c)},[e]),(0,G.jsx)(_e.ui_kit$Modal,{open:e,onCancel:t,footer:null,closable:!1,centered:!0,width:760,className:"trial-suggest-modal",children:(0,G.jsxs)("div",{className:"trial-suggest-modal__layout",children:[(0,G.jsx)("div",{className:"trial-suggest-modal__gallery",children:(0,G.jsx)("div",{className:"trial-suggest-modal__slide-image",style:s[o]})}),(0,G.jsxs)("div",{className:"trial-suggest-modal__content",children:[(0,G.jsxs)("span",{className:"trial-suggest-modal__badge",children:[i("14 days free")," "]}),(0,G.jsxs)("h2",{className:"trial-suggest-modal__title",children:[i("Try every editor feature — free")," "]}),(0,G.jsx)("p",{className:"trial-suggest-modal__intro",children:i("Turn on a 14-day trial and the whole editor opens up:")}),(0,G.jsx)("ul",{className:"trial-suggest-modal__features",children:ST.map(c=>(0,G.jsxs)("li",{children:[(0,G.jsx)(ti,{icon:ET,className:"trial-suggest-modal__feature-icon"}),(0,G.jsx)("span",{children:i(c)})]},c))}),(0,G.jsxs)("p",{className:"trial-suggest-modal__promise",children:[(0,G.jsx)(ti,{icon:"ShieldTickIcon",component:_e.icons$ShieldTickIcon,className:"trial-suggest-modal__promise-icon"}),(0,G.jsx)("span",{children:i("No card required: we ask for no payment or personal details.")})]}),(0,G.jsx)("p",{className:"trial-suggest-modal__note",children:i("When the trial ends, the service switches to the free plan.")}),(0,G.jsxs)("div",{className:"trial-suggest-modal__buttons",children:[(0,G.jsxs)(_e.ui_kit$Button,{type:"text",size:"large",onClick:t,className:"trial-suggest-modal__decline",children:[i("Not now")," "]}),(0,G.jsxs)(_e.ui_kit$Button,{type:"primary",size:"large",loading:n,onClick:r,children:[i("Start the trial")," "]})]})]})]})})},TT=({open:e,onCancel:t,initialSlide:r=0,onTrialActivated:n,sideOnOk:i})=>{const o=na(),a=hr(),s=lr(),{activate:c,isActivating:u}=vT(),h=aT({isPlanLocked:ia(a,{isPlugin:!0}),trialEnabled:!!o?.trial_enabled,canStartTrial:kO(a,o)})==="trial";(0,N.useEffect)(()=>{!e||!h||s({event:"open_modal",action:"open_trial-suggest_modal",modal_id:"trial-suggest"})},[e,h,s]);const f=(0,N.useCallback)(()=>{(async()=>{if(await c()){(n??t)();return}t()})()},[c,t,n]);return h?(0,G.jsx)(OT,{open:e,onCancel:t,onConfirm:f,loading:u}):(0,G.jsx)(_T,{open:e,onCancel:t,initialSlide:r,sideOnOk:i})},CT=["export_platforms","export_html","export_amp","export_webhook","export_pdf","export_png","element_image","element_ai_image","element_text","element_heading","element_button","element_spacer","element_lists","element_divider","element_social","element_table","element_timer","element_video","element_amp_carousel","element_amp_accordion","element_amp_form","block_save","block_visibility","block_border","block_radius","block_shadow","block_to_image","theme_editing","preheader_editing","desktop_mobile_toggle","undo_redo","typograph","variables","google_fonts","code_editor","version_history","preview_service","template_import","code_minify","mobile_props","discussion","utm_editor","stock_photo","stock_gif","stock_icons","image_editor"],AT={export_platforms:1,export_html:1,export_amp:1,export_webhook:1,export_pdf:1,export_png:1,element_image:1,element_ai_image:2,element_text:1,element_heading:1,element_button:1,element_spacer:1,element_lists:1,element_divider:1,element_social:1,element_table:1,element_timer:1,element_video:1,element_amp_carousel:1,element_amp_accordion:1,element_amp_form:1,block_save:1,block_visibility:1,block_border:1,block_radius:1,block_shadow:1,block_to_image:1,theme_editing:1,preheader_editing:1,desktop_mobile_toggle:1,undo_redo:1,typograph:1,variables:1,google_fonts:1,code_editor:1,version_history:4,preview_service:1,template_import:1,code_minify:1,mobile_props:1,discussion:7,utm_editor:1,stock_photo:3,stock_gif:3,stock_icons:3,image_editor:5};function IT(e){return CT.includes(e)}function Rd(e){const{featureKey:t,features:r,isPlugin:n}=e,i=r!==void 0;return n?{isLocked:!1,isPlanDataReady:i}:t==null||!IT(t)?{isLocked:!1,isPlanDataReady:i}:{isLocked:Tb(r,t)!==!0,isPlanDataReady:i}}function Dd(){const e=hr(),t=e?.id,{data:r}=ba(t,{skip:!0});return ia(e,{isPlugin:!0}),r?.features}function wT(){const e=Dd();return(0,N.useCallback)(t=>Rd({featureKey:t,features:e,isPlugin:!0}).isLocked,[e])}function MT(e){const t=Dd();return(0,N.useMemo)(()=>{const r=Rd({featureKey:e,features:t,isPlugin:!0});return{isLocked:r.isLocked,state:r.isLocked?{state:"locked_by_plan"}:{state:"allowed"},isPlanDataReady:r.isPlanDataReady}},[e,t])}var Nd=["vk","telegram","youtube","tiktok","ok","pinterest","max","rutube","yandex_zen","vkv","drbl","fig","gh","ggl","rdt","sptf","twitch"],RT=["telegram","whatsapp","instagram","facebook","youtube","tiktok","x","linkedin","pinterest","viber","apple","dis","drbl","fig","ggl","mdm","rdt","sgnl","sc","sptf","tmblr","twitch","thrds","msngr","bs"],DT=[{id:"vk",labelMsgid:"VK",brands:["em"]},{id:"telegram",labelMsgid:"Telegram",brands:["em","blocks"]},{id:"youtube",labelMsgid:"YouTube",brands:["em","blocks"]},{id:"tiktok",labelMsgid:"TikTok",brands:["em","blocks"]},{id:"ok",labelMsgid:"Одноклассники",brands:["em"]},{id:"pinterest",labelMsgid:"Pinterest",brands:["em","blocks"]},{id:"max",labelMsgid:"Макс",brands:["em"]},{id:"rutube",labelMsgid:"RuTube",brands:["em"]},{id:"yandex_zen",labelMsgid:"Яндекс Дзен",brands:["em"]},{id:"whatsapp",labelMsgid:"WhatsApp",brands:["blocks"]},{id:"instagram",labelMsgid:"Instagram",brands:["blocks"]},{id:"facebook",labelMsgid:"Facebook",brands:["blocks"]},{id:"x",labelMsgid:"X (Twitter)",brands:["blocks"]},{id:"linkedin",labelMsgid:"LinkedIn",brands:["blocks"]},{id:"viber",labelMsgid:"Viber",brands:["blocks"]},{id:"apple",labelMsgid:"Apple",brands:["blocks"]},{id:"dis",labelMsgid:"Discord",brands:["blocks"]},{id:"drbl",labelMsgid:"Dribbble",brands:["blocks","em"]},{id:"fig",labelMsgid:"Figma",brands:["blocks","em"]},{id:"gh",labelMsgid:"GitHub",brands:["blocks","em"]},{id:"ggl",labelMsgid:"Google",brands:["blocks","em"]},{id:"mdm",labelMsgid:"Medium",brands:["blocks"]},{id:"rdt",labelMsgid:"Reddit",brands:["blocks","em"]},{id:"sgnl",labelMsgid:"Signal",brands:["blocks"]},{id:"sc",labelMsgid:"Snapchat",brands:["blocks"]},{id:"sptf",labelMsgid:"Spotify",brands:["blocks","em"]},{id:"tmblr",labelMsgid:"Tumblr",brands:["blocks"]},{id:"twitch",labelMsgid:"Twitch",brands:["blocks","em"]},{id:"thrds",labelMsgid:"Threads",brands:["blocks"]},{id:"msngr",labelMsgid:"Messenger",brands:["blocks"]},{id:"bs",labelMsgid:"Bluesky",brands:["blocks"]},{id:"vkv",labelMsgid:"VK Видео",brands:["em"]}];function NT(e){const t=e==="em"?Nd:RT,r=new Set(t),n=Object.fromEntries(DT.filter(i=>i.brands.includes(e)&&r.has(i.id)).map(i=>[i.id,i]));return t.map(i=>n[i]).filter(i=>!!i)}var jT=new Set([ur.APPLICATION_ELEMENT_SETTINGS_SET,ur.APPLICATION_BLOCK_SETTINGS_SET,ur.APPLICATION_EMAIL_SETTINGS_SET]);function LT(e,t){const r=bn(),n=t??e,i=(0,N.useRef)(n);i.current=n,(0,N.useEffect)(()=>{if(t){const h=r.addListener(e,f=>i.current(f));return()=>{h.dispose()}}let o=null;const a=new Map,s=()=>{o=null,a.forEach(h=>i.current(h)),a.clear()},c=h=>{const f=h.data?.operation;if(f&&jT.has(f)){a.set(f,h),o===null&&(o=requestAnimationFrame(s));return}i.current(h)},u=r.addListener(c);return()=>{u.dispose(),o!==null&&(cancelAnimationFrame(o),o=null),a.clear()}},[r,e,t])}var jd=(0,N.createContext)({document:void 0,history:void 0});function jr(){return(0,N.useContext)(jd)}function kT({document:e,history:t,children:r}){const n=(0,N.useMemo)(()=>({document:e,history:t}),[e,t]);return(0,G.jsx)(jd.Provider,{value:n,children:r})}function Ld(e){return e?.getContent()??""}function FT(e,t){return e?{dispose:e.subscribe(t)}:{dispose:()=>{}}}var UT=[/chunkloaderror/i,/loading chunk [\d\w-]+ failed/i,/failed to fetch dynamically imported module/i,/importing a module script failed/i,/error loading dynamically imported module/i];function BT(e){if(!e)return!1;const t=$T(e);return UT.some(r=>r.test(t))||e instanceof Error&&e.name==="ChunkLoadError"?!0:GT(e)}function $T(e){return typeof e=="string"?e:e instanceof Error?`${e.name} ${e.message}`:typeof e=="object"&&e!==null&&"message"in e?String(e.message??e):String(e)}function GT(e){if(typeof ErrorEvent>"u"||!(e instanceof ErrorEvent))return!1;const t=e.target;if(!t||typeof t!="object")return!1;const r="src"in t?String(t.src??""):"",n="href"in t?String(t.href??""):"",i=r||n;return i?/\/static\/js\/[a-f0-9]+\.js/i.test(i)||/\/main\.[a-f0-9]{8}\.js/i.test(i):!1}var kd="_rb",Fd="stale-build-reload-at",Ud="stale-build-reload-count",qT=5e3,xT=3,Bd=!1;function HT(){return!1}function $d(){return typeof sessionStorage>"u"?0:Number(sessionStorage.getItem(Ud)??0)}function VT(){typeof sessionStorage>"u"||sessionStorage.setItem(Ud,String($d()+1))}function zT(e){if(!HT()||Bd||typeof window>"u"||typeof sessionStorage>"u"||$d()>=xT)return;const t=Number(sessionStorage.getItem(Fd)??0);if(t&&Date.now()-t<qT)return;Bd=!0,VT(),sessionStorage.setItem(Fd,String(Date.now()));const r=new URL(window.location.href);if(!r.searchParams.has(kd)){r.searchParams.set(kd,String(Date.now())),window.location.replace(r.toString());return}window.location.reload()}function QT(e,t){return(0,N.lazy)(()=>(t&&De(`route:${t}:start`,{kind:"network"}),e().then(r=>(t&&De(`route:${t}:end`,{kind:"network"}),r)).catch(r=>{if(BT(r))return zT("lazy_import"),new Promise(()=>{});throw r})))}var WT=null,Gd=(0,N.createContext)(WT);function KT(){return(0,N.useContext)(Gd)}var qd=(0,N.createContext)(ou);function YT({kind:e,children:t}){return(0,G.jsx)(qd.Provider,{value:e,children:t})}function XT(){return(0,N.useContext)(qd)}var xd=()=>{};function JT(){const e=ze(),t=(0,N.useCallback)(n=>{if(!e)return xd;const i=wt(e).watch(n);return()=>i.dispose()},[e]),r=(0,N.useCallback)(()=>mr(e).requested,[e]);return(0,N.useSyncExternalStore)(t,r,r)}function ZT(){const{projectId:e}=to(),t=ze(),r=(0,N.useCallback)(o=>{if(!t)return xd;const a=wt(t).watch(o);return()=>a.dispose()},[t]),n=(0,N.useCallback)(()=>mr(t).card?.id,[t]),i=(0,N.useSyncExternalStore)(r,n,n);return e??(i!=null&&i!==""?String(i):void 0)}var eC=e=>{if(e===0)return"0 B";const t=1024,r=["B","KB","MB","GB","TB"],n=Math.min(Math.floor(Math.log(e)/Math.log(t)),r.length-1),i=r.at(n)??"B";return parseFloat((e/Math.pow(t,n)).toFixed(1))+" "+i},tC=e=>e?new TextEncoder().encode(e).length:0,rC=(e,t=90)=>e>t*1024,nC=e=>{const t=[];let r=e;r=r.replace(/<!--\[if[^\]]*\]>[\s\S]*?<!\[endif\]-->/gi,i=>{const o=t.length,a=i.replace(/\s+/g," ").replace(/> </g,"><").replace(/\s+>/g,">").replace(/<!--\[if([^\]]*)\]>\s+/g,"<!--[if$1]>").replace(/\s+<!\[endif\]-->/g,"<![endif]-->");return t.push(a),`___CONDITIONAL_COMMENT_${o}___`});let n=r.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/> </g,"><").replace(/\s+>/g,">").trim();return t.forEach((i,o)=>{n=n.replace(`___CONDITIONAL_COMMENT_${o}___`,i)}),n},iC={email_10_30:{id:"email_10_30",titleKey:"You have used up the number of emails you can create on your current plan",subtitleKey:"You can increase the number of emails right now.",usageResource:"email_generate",previous:10,next:30,showSecondaryBuy:!1,debugLabelKey:"Limit modal: emails 10→30"},email_30_300:{id:"email_30_300",titleKey:"You have used up the number of emails you can create on your current plan",subtitleKey:"You can increase the number of emails right now.",usageResource:"email_generate",previous:30,next:300,showSecondaryBuy:!1,debugLabelKey:"Limit modal: emails 30→300"},email_300_inf:{id:"email_300_inf",titleKey:"You have used up the number of emails you can create on your current plan",subtitleKey:"You can increase the number of emails right now.",usageResource:"email_generate",previous:300,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: emails 300→∞"},ai_10_50:{id:"ai_10_50",titleKey:"You have used up your AI generations",subtitleKey:"You can add more generations right now; they are billed separately from the generations included in your plan.",usageResource:"ai",previous:10,next:50,showSecondaryBuy:!1,debugLabelKey:"Limit modal: AI 10→50"},ai_30_150:{id:"ai_30_150",titleKey:"You have used up your AI generations",subtitleKey:"You can add more generations right now; they are billed separately from the generations included in your plan.",usageResource:"ai",previous:30,next:150,showSecondaryBuy:!1,debugLabelKey:"Limit modal: AI 30→150"},ai_150_inf:{id:"ai_150_inf",titleKey:"You have used up your AI generations",subtitleKey:"You can add more generations right now; they are billed separately from the generations included in your plan.",usageResource:"ai",previous:150,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: AI 150→∞"},optimization_exceeded:{id:"optimization_exceeded",titleKey:"You have used up your optimisation limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"optimization",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: optimization exhausted"},image_generate_exceeded:{id:"image_generate_exceeded",titleKey:"You have used up your image generation limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"image_generate",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: image_generate exhausted"},preview_exceeded:{id:"preview_exceeded",titleKey:"You have used up your preview (test send) limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"preview",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: preview exhausted"},link_check_exceeded:{id:"link_check_exceeded",titleKey:"You have used up your link check limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"link_check",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: link_check exhausted"},image_check_exceeded:{id:"image_check_exceeded",titleKey:"You have used up your image check limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"image_check",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: image_check exhausted"},spam_check_exceeded:{id:"spam_check_exceeded",titleKey:"You have used up your spam check limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"spam_check",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: spam_check exhausted"}};function oC(e){return iC[e]}function aC(e){return e==="infinity"?"∞":e}var sC=/\s+\d+$/;function uC(e){return e.trim().replace(sC,"").toLowerCase().replaceAll("+","-plus").split(/\s+/).filter(Boolean).join("-")}function Hd(e,t,r){if(!e||!t||!r)return;const n=e.filter(o=>uC(o.title??"")===t).map(o=>o.limits?.[r]);if(n.length===0)return;const i=n.findIndex(o=>String(o??"").trim()!=="0");return i===-1?"0":n[i]}function Vd(e,t){if(!e||!e.is_unlimited||t==null)return e;const r=String(t).trim();return r===""||Number(r)!==0?e:{...e,is_unlimited:!1}}var zd={ai:"ai_limit",email_generate:"email_generate_limit",image_generate:"image_generate_limit",preview:"preview_limit",link_check:"link_check_limit",image_check:"image_check_limit",spam_check:"spam_check_limit"};function ya(){return!0}function Qd(e){const{data:t}=Ml(void 0,{skip:ya()||e});return t}function Wd(e){if(e)return{used:e.used??0,base_limit:e.base_limit??0,extra:e.extra??0,total_limit:e.total_limit??0,remaining:e.remaining??0,percent:e.percent??0,is_unlimited:e.is_unlimited??!1}}function cC(){const e=hr()?.id,{data:t,isSuccess:r}=ba(e,{skip:ya()||!e}),n=Qd(!t?.slug);return(0,N.useMemo)(()=>{const i=t?.limits??{},o={};return Object.entries(i).forEach(([a,s])=>{const c=a,u=Vd(Wd(s),Hd(n,t?.slug,zd[c]));u&&(o[c]=u)}),{limits:o,isLoaded:!!r}},[n,t,r])}function lC(){const e=hr()?.id,[t]=pT(),r=Qd(!1);return(0,N.useCallback)(async n=>{if(ya()||!e)return;const i=await t(e,!1);return Vd(Wd(i.data?.limits?.[n]),Hd(r,i.data?.slug,zd[n]))},[r,t,e])}var dC=new Set([le.UPLOAD_IMAGE_MODAL,le.UPLOAD_BACKGROUND_MODAL,le.UPLOAD_IMAGE_MODAL_AI,le.UPLOAD_BACKGROUND_MODAL_AI,le.UPLOAD_IMAGE_MODAL_STOCK,le.UPLOAD_BACKGROUND_MODAL_STOCK,le.UPLOAD_IMAGE_MODAL_GIF,le.UPLOAD_BACKGROUND_MODAL_GIF,le.UPLOAD_IMAGE_MODAL_EDIT,le.UPLOAD_BACKGROUND_MODAL_EDIT,le.UPLOAD_IMAGE_MODAL_UPLOAD,le.UPLOAD_BACKGROUND_MODAL_UPLOAD]),fC=new Set([le.UPLOAD_IMAGE_MODAL_EDIT,le.UPLOAD_BACKGROUND_MODAL_EDIT]);function pC(e){return!!e&&fC.has(e)}function mC(e){return!!e&&dC.has(e)}var hC=({users:e,isEditor:t,isPlugin:r,token:n})=>{const[i,o]=(0,N.useState)(!1),a=window.localStorage.getItem(pt.em_color_scheme),s=h=>{const{first_name:f,last_name:y,email:E}=h.user.name;return f?`${f.split("")[0]}${y?`${y.split("")[0]}`:""}`:E?.split("")[0].toUpperCase()||" "},c=h=>{const{first_name:f,last_name:y,email:E}=h.user.name;return f&&y?`${f} ${y}`:f||E},u=h=>{const f=c(h);return(0,G.jsx)("span",{children:f})};return(0,G.jsx)(G.Fragment,{children:e.length>0&&t&&(0,G.jsx)("div",{className:`user-list ${i?"open":""}`,style:r?{left:"60px",bottom:"10px"}:{},onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),children:e.map(h=>(0,G.jsx)("div",{className:"user",style:{[cr("user-color")]:h.user.color,[cr("border-color")]:n?.colorBgContainer,[cr("text-color")]:a==="dark"?n?.colorIconHover:n?.colorWhite},children:(0,G.jsx)(_e.ui_kit$Tooltip,{title:u(h),placement:"topLeft",trigger:"hover",color:n?.colorBgSpotlight,children:(0,G.jsx)("div",{children:s(h)})})},h.user.color))})})},ii="Ai",Kd=be({reducerPath:"AiApi",tagTypes:[ii],baseQuery:Oe({baseUrl:"https://app.useblocks.io/api/wp-json/save-file/v1/"}),endpoints:e=>({sendMessage:e.mutation({queryFn({body:t},r){return q(r).aiGenerator.ai_create(t)}}),getDialog:e.query({queryFn({entity_id:t,connection:r="chat"},n){return ot(M.getContainer(n)).aiAssistentEnabled===!1?Promise.resolve({data:{documents:[],totalCount:0}}):q(n).aiGenerator.ai_status_list({connection:r,entity_id:t})},providesTags:t=>t?.documents?[...t.documents.map(({id:r})=>({type:ii,id:r})),{type:ii,id:"LIST"}]:[{type:ii,id:"LIST"}]})})}),{useSendMessageMutation:gC,useGetDialogQuery:bC,useLazyGetDialogQuery:yC}=Kd,Yd=be({reducerPath:"saveFileApi",tagTypes:["Images"],baseQuery:Oe({baseUrl:"https://app.useblocks.io/api/wp-json/save-file/v1/"}),endpoints:e=>({uploadImage:e.mutation({queryFn(t,r){return q(r).saveFile.upload_create(t,{type:M.ContentType.FormData})}}),sendTestEmail:e.mutation({queryFn(t,r){return q(r).saveFile.send_email_create(t,{type:M.ContentType.FormData})}}),sendLivePreview:e.mutation({queryFn(t,r){return q(r).saveFile.get_link_create(t,{type:M.ContentType.FormData})}}),sendShortLink:e.mutation({queryFn(t,r){return q(r).saveFile.shortener_create(t,{type:M.ContentType.FormData})}})})}),{useUploadImageMutation:vC,useSendTestEmailMutation:_C,useSendLivePreviewMutation:EC,useSendShortLinkMutation:SC}=Yd,PC=async(e,t,r)=>{const n=q(t).baseUrl.replaceAll(/[\\/]$/g,""),i=await Oe({baseUrl:n})(e,t,r);if(i.error){let o=i.error;if(typeof o.json=="function")try{o=await o.json()}catch{o=await o}return{error:o}}return i},Xd=be({reducerPath:"AiApiGenerator",baseQuery:PC,endpoints:e=>({generateIdForTask:e.mutation({queryFn(t,r){return $E(r).tasks.tasksControllerCreateTask(t).then(n=>n)}}),clearAiChat:e.query({queryFn(t,r){return q(r).aiGenerator.clear_history_list(t).then(n=>n)}}),getGeneratedContent:e.query({queryFn:t=>({data:[]}),async onCacheEntryAdded({id:t,setError:r},n){const{updateCachedData:i,cacheEntryRemoved:o}=n,a=q(n).baseUrl.indexOf("emailmaker")>=0?cu.maker:cu.blocks,s=await M.getContainer(n).getInstance(M.TOKEN_ID),c=s?{Authorization:`Bearer ${s}`}:{},{EventSourcePolyfill:u}=await(0,et.__vitePreload)(async()=>{const{EventSourcePolyfill:f}=await Promise.resolve().then(()=>Z.__toESM(fe("./e50befab.js").default));return{EventSourcePolyfill:f}},void 0,{}.url),h=new u(`${a}/tasks/${t}`,{headers:c});h.onmessage=f=>{const y=JSON.parse(f.data);i(E=>{E.push(y)})},h.onerror=f=>{r("Error connecting to EventSource"),h.close()},await o,h.close()}}),getAiGenerateStatus:e.mutation({query:t=>({url:"/constructor/v1/ai-save-task",method:"POST",body:t})})})}),{useGenerateIdForTaskMutation:JM,useGetGeneratedContentQuery:ZM,useLazyClearAiChatQuery:OC,useLazyGetGeneratedContentQuery:TC,useGetAiGenerateStatusMutation:CC}=Xd;function Lr({id:e,post:t,parent:r,author:n,content:i,acf:{status:o,target_id:a},...s}){return{...s,id:ie(e),post:ie(t),parent:ie(r),author:ie(n),content:Ne(i),target_id:a,comment_status:o}}var st="Comments",Jd=be({reducerPath:"commentsApi",tagTypes:[st],baseQuery:Oe({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getComments:e.query({queryFn:function(t,r){return q(r).wp.comments_list({post:[de(t)],per_page:50,order:"asc"}).then(Pe(Lr))},providesTags:t=>t?[...t.map(({id:r})=>({type:st,id:r})),{type:st,id:"LIST"}]:[{type:st,id:"LIST"}]}),addComment:e.mutation({queryFn({subjectId:t,author:r,parent:n,content:i,author_name:o,author_email:a,targetId:s},c){const u=q(c),h={post:de(t),author:de(r),author_name:o,author_email:a},f={};return i&&(h.content=i),n&&(h.parent=de(n)),s&&(f["acf[target_id]"]=s),u.wp.comments_create(h,{type:M.ContentType.UrlEncoded,extraQuery:f}).then(ce(Lr))},invalidatesTags:[{type:st,id:"LIST"}]}),deleteComment:e.mutation({queryFn(t,r){return q(r).wp.comments_delete({id:t},{}).then(hn(Lr))},invalidatesTags:[{type:st,id:"LIST"}]}),editComment:e.mutation({queryFn({commentId:t,content:r,status:n,targetId:i},o){const a=q(o),s={},c={};return r&&(s.content=r),n&&(c["acf[status]"]=n),i&&(c["acf[target_id]"]=i),a.wp.comments_update({id:t},s,{type:M.ContentType.UrlEncoded,extraQuery:c}).then(ce(Lr))},invalidatesTags:[{type:st,id:"LIST"}]}),deleteTarget:e.mutation({queryFn(t,r){return q(r).wp.comments_update({id:t},{},{type:M.ContentType.UrlEncoded,extraQuery:{"acf[target_id]":""}}).then(ce(Lr))},invalidatesTags:[{type:st,id:"LIST"}]})})}),{useGetCommentsQuery:AC,useAddCommentMutation:IC,useDeleteCommentMutation:wC,useEditCommentMutation:MC,useDeleteTargetMutation:RC}=Jd,Zd={isCollapsed:!0,isMonacoFocusing:!1},ef="defaultModePanesSlice",tf=ge({name:ef,initialState:Zd,reducers:{setMonacoFocusing:(e,t)=>{e.isMonacoFocusing=t.payload},resetPanes:()=>Zd}}),{resetPanes:DC,setMonacoFocusing:NC}=tf.actions,jC=e=>e[ef].isMonacoFocusing,kr=null,va=[],Fr=null,rf="custom",LC=e=>{va=e,kr=null,Fr=null},kC=e=>{const t=e.weight?.trim()||"400",r=e.style??"normal";return r==="italic"||r==="oblique"?`${t}i`:t},FC=e=>{if(!va.length)return e;const t=Array.isArray(e.familyMetadataList)?[...e.familyMetadataList]:[],r=new Map;for(const i of va){const o=i.family?.trim()||Eg(i.source_url)||i.name.trim();if(!o)continue;const a=kC(i);let s=r.get(o);s||(s={family:o,category:rf,subsets:["cyrillic","latin"],popularity:0,fonts:{}},r.set(o,s)),s.fonts[a]={}}if(!r.size)return e;const n=t.filter(i=>i?.category!==rf||!(typeof i.family=="string"&&r.has(i.family)));return{...e,familyMetadataList:[...r.values(),...n]}},UC=()=>kr?Promise.resolve(kr):(Fr!==null||(Fr=(0,et.__vitePreload)(async()=>{const{default:e}=await Promise.resolve().then(()=>fe("./fb2fe2db.js"));return{default:e}},void 0,{}.url).then(({default:e})=>(kr=FC(e),kr)).catch(e=>{throw e})),Fr);function BC(e){Promise.resolve(e).catch(t=>{})}var _a=new Set;function $C(e,t){_a.has(e)||(_a.add(e),Promise.resolve(t()).finally(()=>{_a.delete(e)}))}function GC(e,t,r,n){const i=Si(e),o=Symbol(`once-handler-${t}`),a=i?s=>{s[o]||(s[o]=!0,r(s))}:r;return i?.addEventListener(t,a,n),window.addEventListener(t,a,n),{dispose:()=>{i?.removeEventListener(t,a,n),window.removeEventListener(t,a,n)}}}function qC(e,t,r,n){const i=Si(e),o=Symbol(`once-handler-${t}`),a=i?s=>{s[o]||(s[o]=!0,r(s))}:r;return i?.addEventListener(t,a,n),document.addEventListener(t,a,n),{dispose:()=>{i?.removeEventListener(t,a,n),document.removeEventListener(t,a,n)}}}var xC=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Ea(e){return xC.test(e)||e.indexOf("//")===0}function Ur(e){return e&&(e.endsWith("/")?e:`${e}/`)}function nf(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function of(e,t){const r=e==null||e===""?"./":String(e);if(Ea(r))return Ur(r);const n=t??nf();if(!n)return Ur(r);try{return Ur(new URL(r,n).href)}catch{return Ur(r)}}function HC(e,t){const r=t??nf();if(!r)return e;try{return new URL(e,r).href}catch{return e}}function VC(e,t){const r=String(e??"");if(!r)return"";if(Ea(r))return r;if(r.charAt(0)==="/")return HC(r);const n=r.replace(/^\.\/+/,"").replace(/^\/+/,"");try{return new URL(n,t).href}catch{return Ur(t)+n}}function af(){return typeof window.__useblocks__<"u"&&window.__useblocks__?.publicPath?of(window.__useblocks__.publicPath):of("/")}function zC(e){return VC(e,af())}function sf(e){const t=zC(e);return Ea(t)?t:typeof window<"u"&&window.location?.origin?new URL(t.startsWith("/")?t:`/${t}`,window.location.origin).href:t}var Sa=e=>{if(!e)return"image/png";const t=e.toLowerCase();return t.includes("jpeg")||t.includes("jpg")||t.includes("pjpeg")?"image/jpeg":t.includes("png")?"image/png":t.includes("gif")?"image/gif":t.includes("webp")?"image/webp":t.includes("svg")?"image/svg+xml":"image/png"},uf=e=>{const t=Sa(e).split("/")[1];return t==="svg+xml"?"svg":t||"png"};function oi(e){switch(e.trim().split(".").pop()?.toLowerCase()){case"svg":return"image/svg+xml";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"webp":return"image/webp";default:return}}function cf(e){if(e.type?.startsWith?.("image/"))return!0;const t=(e.name??"").trim();if(oi(t))return!0;const r=(e.type??"").toLowerCase();return r.includes("svg")?!0:r==="text/xml"||r==="application/xml"||r==="text/plain"?t.toLowerCase().endsWith(".svg"):!1}var ai={MAX_SIZE_MB:.48,MAX_WIDTH_OR_HEIGHT:2e3,QUALITY:.8},QC=["gif","svg"];function WC(e){return!QC.includes(e)}function lf(e,t){if(e?.compressMaxSize===0||e?.compressMaxWidthOrHeight===0)return!1;const r=t?.trim()??"";return r.startsWith("image/")&&r!=="image/gif"}function df(e){return{maxSizeMB:e?.compressMaxSize??ai.MAX_SIZE_MB,maxWidthOrHeight:e?.compressMaxWidthOrHeight??ai.MAX_WIDTH_OR_HEIGHT}}function ff(e){if(!e)return null;const t=e.trim();if(t.endsWith("%"))return null;const r=parseFloat(t.replace(/px$/i,""));return Number.isFinite(r)&&r>0?r:null}function KC(e){const t=e.match(/<\s*svg\b[\s\S]*?>/i)?.[0]??"",r=t.match(/\bwidth\s*=\s*["']([^"']*)["']/i)?.[1],n=t.match(/\bheight\s*=\s*["']([^"']*)["']/i)?.[1],i=ff(r),o=ff(n);if(i!=null&&o!=null)return{width:i,height:o};const a=e.match(/viewBox\s*=\s*["']([^"']+)["']/i)?.[1];if(a){const s=a.trim().split(/[\s,]+/);if(s.length===4){const c=parseFloat(s[2]),u=parseFloat(s[3]);if(Number.isFinite(c)&&Number.isFinite(u)&&c>0&&u>0)return{width:c,height:u}}}return i!=null?{width:i,height:i}:o!=null?{width:o,height:o}:{width:300,height:300}}function YC(e,t=2,r=4096){const{width:n,height:i}=KC(e);let o=Math.max(1,Math.round(n*t)),a=Math.max(1,Math.round(i*t));const s=Math.max(64,r),c=Math.max(o,a);if(c>s){const u=s/c;o=Math.max(1,Math.round(o*u)),a=Math.max(1,Math.round(a*u))}return{width:o,height:a}}function XC(e){return new Promise((t,r)=>{e.toBlob(n=>{n?t(n):r(new Error("canvas.toBlob returned null"))},"image/png")})}async function JC(e,t,r){const n=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),i=URL.createObjectURL(n);try{const o=new Image;await new Promise((h,f)=>{o.onload=()=>h(),o.onerror=()=>f(new Error("Failed to load SVG image")),o.src=i});const a=document.createElement("canvas"),s=Math.max(1,Math.round(t)),c=Math.max(1,Math.round(r));a.width=s,a.height=c;const u=a.getContext("2d");if(!u)throw new Error("Canvas 2D context is not available");return u.clearRect(0,0,s,c),u.drawImage(o,0,0,s,c),XC(a)}finally{URL.revokeObjectURL(i)}}var ZC=24e3;async function eA(e,t=ZC){const r=Math.min(t,Math.max(0,e.size));return e.slice(0,r).text()}function tA(e){const t=e.trimStart().replace(/^\uFEFF/,"");return t.startsWith("<")?/<\s*svg[\s>/]/i.test(t):!1}async function rA(e,t={}){const r=t.pixelScale??2,n=t.maxLongEdge??4096,i=await e.text(),{width:o,height:a}=YC(i,r,n),s=await JC(i,o,a),c=t.outputFileName??e.name,u=/\.svg$/i.test(c)?c.replace(/\.svg$/i,".png"):`${c}.png`;return new File([s],u,{type:"image/png",lastModified:e.lastModified})}function si(e,t,r,n){return new File([e],t,{type:r,lastModified:n})}function Pa(e,t){return!t||t===e.name?e:si(e,t,e.type,e.lastModified)}function nA(e,t,r,n){const i=n??t.name;return e instanceof File?e.type!==r||e.lastModified!==t.lastModified||e.name!==i?si(e,i,r,t.lastModified):e:si(e,i,r,t.lastModified)}function iA(e,t){const r=t.startsWith(".")?t.slice(1):t,n=e.lastIndexOf(".");return n>0?`${e.substring(0,n)}.${r}`:`${e}.${r}`}function oA(e){return e==="image/webp"?"image/jpeg":e}async function pf(e,t={}){const{maxSizeMB:r=ai.MAX_SIZE_MB,maxWidthOrHeight:n=ai.MAX_WIDTH_OR_HEIGHT,mimeType:i,fileName:o,libURL:a,enableCompression:s=!0,convertSvgToPng:c=!1}=t;if(!e||!(e instanceof File))return e;let u=e,h=!1;if(c){const g=(u.type||"").toLowerCase(),m=/\.svg$/i.test(u.name.trim()),l=g.includes("svg");let b=!1;if(!l&&!m)try{const d=await eA(u);b=tA(d)}catch{b=!1}if(l||m||b)try{u=await rA(u,{maxLongEdge:n,outputFileName:o??u.name}),h=!0}catch{u=e}}const f=(u.type&&u.type.trim()!==""?u.type:oi(u.name))||(h?"image/png":i)||"image/jpeg",y=Sa(f),E=h?u.name:o??u.name;if(!y.startsWith("image/"))return Pa(u,E);const S=oA(y),v=uf(y),C=uf(S),A=S!==y?iA(E,C):E,I=s&&WC(v);if(!I&&S===y)return Pa(u,A);const T=u.type===y?u:si(u,u.name,y,u.lastModified);try{const g={libURL:a,useWebWorker:!0,fileType:S};I?(g.maxSizeMB=r,g.maxWidthOrHeight=n):(g.maxSizeMB=Math.max(T.size/1048576+1,1),g.initialQuality=1,g.alwaysKeepResolution=!0);const{default:m}=await(0,et.__vitePreload)(async()=>{const{default:b}=await Promise.resolve().then(()=>Z.__toESM(fe("./ac50dfd1.js").default));return{default:b}},void 0,{}.url),l=await m(T,g);return nA(l,T,Sa(l.type||S),A)}catch{try{return Pa(u,A)}catch{return u}}}var aA="js/browser-image-compression.js";function mf(){return sf(aA)}async function sA(e,t,r=mf()){if(!cf(e))return e;const{maxSizeMB:n,maxWidthOrHeight:i}=df(t),o=e.type?.trim()||oi(e.name)||e.type||"";return pf(e,{maxSizeMB:n,maxWidthOrHeight:i,mimeType:o||void 0,fileName:e.name,libURL:r,enableCompression:lf(t,o),convertSvgToPng:!0})}function hf(e){if(!e)return!1;try{return e.getInstance(M.SECURITY_MODULE_ID)!==void 0}catch{return!1}}function uA(){const e=pe();return(0,N.useMemo)(()=>hf(M.getContainer(e)),[e])}function cA(){const e=ro();return(0,N.useCallback)(()=>{document.body.classList.remove("editor"),e("/billing")},[e])}function lA(e){return vP(e||"en_US")}var dA=Z.__commonJSMin(((e,t)=>{(function(){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(i,o){return i<<o|i>>>32-o},rotr:function(i,o){return i<<32-o|i>>>o},endian:function(i){if(i.constructor==Number)return n.rotl(i,8)&16711935|n.rotl(i,24)&4278255360;for(var o=0;o<i.length;o++)i[o]=n.endian(i[o]);return i},randomBytes:function(i){for(var o=[];i>0;i--)o.push(Math.floor(Math.random()*256));return o},bytesToWords:function(i){for(var o=[],a=0,s=0;a<i.length;a++,s+=8)o[s>>>5]|=i[a]<<24-s%32;return o},wordsToBytes:function(i){for(var o=[],a=0;a<i.length*32;a+=8)o.push(i[a>>>5]>>>24-a%32&255);return o},bytesToHex:function(i){for(var o=[],a=0;a<i.length;a++)o.push((i[a]>>>4).toString(16)),o.push((i[a]&15).toString(16));return o.join("")},hexToBytes:function(i){for(var o=[],a=0;a<i.length;a+=2)o.push(parseInt(i.substr(a,2),16));return o},bytesToBase64:function(i){for(var o=[],a=0;a<i.length;a+=3)for(var s=i[a]<<16|i[a+1]<<8|i[a+2],c=0;c<4;c++)a*8+c*6<=i.length*8?o.push(r.charAt(s>>>6*(3-c)&63)):o.push("=");return o.join("")},base64ToBytes:function(i){i=i.replace(/[^A-Z0-9+\/]/gi,"");for(var o=[],a=0,s=0;a<i.length;s=++a%4)s!=0&&o.push((r.indexOf(i.charAt(a-1))&Math.pow(2,-2*s+8)-1)<<s*2|r.indexOf(i.charAt(a))>>>6-s*2);return o}};t.exports=n})()})),gf=Z.__commonJSMin(((e,t)=>{var r={utf8:{stringToBytes:function(n){return r.bin.stringToBytes(unescape(encodeURIComponent(n)))},bytesToString:function(n){return decodeURIComponent(escape(r.bin.bytesToString(n)))}},bin:{stringToBytes:function(n){for(var i=[],o=0;o<n.length;o++)i.push(n.charCodeAt(o)&255);return i},bytesToString:function(n){for(var i=[],o=0;o<n.length;o++)i.push(String.fromCharCode(n[o]));return i.join("")}}};t.exports=r})),fA=Z.__commonJSMin(((e,t)=>{t.exports=function(i){return i!=null&&(r(i)||n(i)||!!i._isBuffer)};function r(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function n(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&r(i.slice(0,0))}})),pA=Z.__commonJSMin(((e,t)=>{(function(){var r=dA(),n=gf().utf8,i=fA(),o=gf().bin,a=function(s,c){s.constructor==String?c&&c.encoding==="binary"?s=o.stringToBytes(s):s=n.stringToBytes(s):i(s)?s=Array.prototype.slice.call(s,0):!Array.isArray(s)&&s.constructor!==Uint8Array&&(s=s.toString());for(var u=r.bytesToWords(s),h=s.length*8,f=1732584193,y=-271733879,E=-1732584194,S=271733878,v=0;v<u.length;v++)u[v]=(u[v]<<8|u[v]>>>24)&16711935|(u[v]<<24|u[v]>>>8)&4278255360;u[h>>>5]|=128<<h%32,u[(h+64>>>9<<4)+14]=h;for(var C=a._ff,A=a._gg,I=a._hh,T=a._ii,v=0;v<u.length;v+=16){var g=f,m=y,l=E,b=S;f=C(f,y,E,S,u[v+0],7,-680876936),S=C(S,f,y,E,u[v+1],12,-389564586),E=C(E,S,f,y,u[v+2],17,606105819),y=C(y,E,S,f,u[v+3],22,-1044525330),f=C(f,y,E,S,u[v+4],7,-176418897),S=C(S,f,y,E,u[v+5],12,1200080426),E=C(E,S,f,y,u[v+6],17,-1473231341),y=C(y,E,S,f,u[v+7],22,-45705983),f=C(f,y,E,S,u[v+8],7,1770035416),S=C(S,f,y,E,u[v+9],12,-1958414417),E=C(E,S,f,y,u[v+10],17,-42063),y=C(y,E,S,f,u[v+11],22,-1990404162),f=C(f,y,E,S,u[v+12],7,1804603682),S=C(S,f,y,E,u[v+13],12,-40341101),E=C(E,S,f,y,u[v+14],17,-1502002290),y=C(y,E,S,f,u[v+15],22,1236535329),f=A(f,y,E,S,u[v+1],5,-165796510),S=A(S,f,y,E,u[v+6],9,-1069501632),E=A(E,S,f,y,u[v+11],14,643717713),y=A(y,E,S,f,u[v+0],20,-373897302),f=A(f,y,E,S,u[v+5],5,-701558691),S=A(S,f,y,E,u[v+10],9,38016083),E=A(E,S,f,y,u[v+15],14,-660478335),y=A(y,E,S,f,u[v+4],20,-405537848),f=A(f,y,E,S,u[v+9],5,568446438),S=A(S,f,y,E,u[v+14],9,-1019803690),E=A(E,S,f,y,u[v+3],14,-187363961),y=A(y,E,S,f,u[v+8],20,1163531501),f=A(f,y,E,S,u[v+13],5,-1444681467),S=A(S,f,y,E,u[v+2],9,-51403784),E=A(E,S,f,y,u[v+7],14,1735328473),y=A(y,E,S,f,u[v+12],20,-1926607734),f=I(f,y,E,S,u[v+5],4,-378558),S=I(S,f,y,E,u[v+8],11,-2022574463),E=I(E,S,f,y,u[v+11],16,1839030562),y=I(y,E,S,f,u[v+14],23,-35309556),f=I(f,y,E,S,u[v+1],4,-1530992060),S=I(S,f,y,E,u[v+4],11,1272893353),E=I(E,S,f,y,u[v+7],16,-155497632),y=I(y,E,S,f,u[v+10],23,-1094730640),f=I(f,y,E,S,u[v+13],4,681279174),S=I(S,f,y,E,u[v+0],11,-358537222),E=I(E,S,f,y,u[v+3],16,-722521979),y=I(y,E,S,f,u[v+6],23,76029189),f=I(f,y,E,S,u[v+9],4,-640364487),S=I(S,f,y,E,u[v+12],11,-421815835),E=I(E,S,f,y,u[v+15],16,530742520),y=I(y,E,S,f,u[v+2],23,-995338651),f=T(f,y,E,S,u[v+0],6,-198630844),S=T(S,f,y,E,u[v+7],10,1126891415),E=T(E,S,f,y,u[v+14],15,-1416354905),y=T(y,E,S,f,u[v+5],21,-57434055),f=T(f,y,E,S,u[v+12],6,1700485571),S=T(S,f,y,E,u[v+3],10,-1894986606),E=T(E,S,f,y,u[v+10],15,-1051523),y=T(y,E,S,f,u[v+1],21,-2054922799),f=T(f,y,E,S,u[v+8],6,1873313359),S=T(S,f,y,E,u[v+15],10,-30611744),E=T(E,S,f,y,u[v+6],15,-1560198380),y=T(y,E,S,f,u[v+13],21,1309151649),f=T(f,y,E,S,u[v+4],6,-145523070),S=T(S,f,y,E,u[v+11],10,-1120210379),E=T(E,S,f,y,u[v+2],15,718787259),y=T(y,E,S,f,u[v+9],21,-343485551),f=f+g>>>0,y=y+m>>>0,E=E+l>>>0,S=S+b>>>0}return r.endian([f,y,E,S])};a._ff=function(s,c,u,h,f,y,E){var S=s+(c&u|~c&h)+(f>>>0)+E;return(S<<y|S>>>32-y)+c},a._gg=function(s,c,u,h,f,y,E){var S=s+(c&h|u&~h)+(f>>>0)+E;return(S<<y|S>>>32-y)+c},a._hh=function(s,c,u,h,f,y,E){var S=s+(c^u^h)+(f>>>0)+E;return(S<<y|S>>>32-y)+c},a._ii=function(s,c,u,h,f,y,E){var S=s+(u^(c|~h))+(f>>>0)+E;return(S<<y|S>>>32-y)+c},a._blocksize=16,a._digestsize=16,t.exports=function(s,c){if(s==null)throw new Error("Illegal argument "+s);var u=r.wordsToBytes(a(s,c));return c&&c.asBytes?u:c&&c.asString?o.bytesToString(u):r.bytesToHex(u)}})()})),bf=Z.__toESM(pA());function mA(e){return e.replace(/\/+$/,"")}function yf(e,t){const r=mA(String(t||"").trim());if(!r)throw new Error(`[previewUrls] Missing ${e}`);return r}function vf(){return typeof window<"u"&&!window.location.host.includes("localhost")?window.location.origin:new URL(yf("REACT_APP_OPENAPI_BASE_URL","https://app.useblocks.io/api")).origin}function hA(){return new URL(vf()).hostname}function gA(){return vf()}function bA(){return new URL(yf("REACT_APP_IMAGE_INFO_TOOL","https://scr.useblocks.io/imageinfo")).origin}function yA(){return typeof window<"u"&&window.location.host.includes("localhost"),bA()}function ui(e,t){return(0,bf.default)(`${e}${t}${Qg}`)}function vA(e,t,r,n){const i=n??ui(r,t);return`https://${hA()}/get${e}/${t}?secret_hash=${i}&raw=true`}function _A(e,t,r){return`/get${e}/${t}?secret_hash=${ui(r,t)}&raw=true`}function EA(e,t){return`${gA()}/email/${e}/raw?key=${ui(t,e)}`}function SA(e,t){return`/email/${e}/raw?key=${ui(t,e)}`}function PA(e){return e==null||e===""?"":`&cacheControl=true&cache-hash=${(0,bf.default)(String(e))}`}var eR=800;function _f({type:e,projectId:t,elementId:r,cacheKey:n,clearCache:i=!0,pixelRatio:o=.8,selector:a,force:s,minHeight:c,targetUrl:u,width:h=800}){const f=yA(),y=PA(n),E=c?`minHeight=${c}&`:"",S=s===void 0?"":`&force=${s}`,v=u??vA(e,r,t);return`${f}/screenshot?${E}delay=1000&width=${h}${a?"":"&fullPage=true"}&deviceScaleFactor=${o}&format=jpg&clearCache=${i}${y}${S}&url=${encodeURIComponent(v)}${a?`&selector=${a}`:""}`}function OA(e,t,r=!0,n=.8,i,o,a){const s=`https://racs.rest/v3/file/${e}?resource=exportPngApi`;return _f({type:"email",projectId:0,elementId:e,cacheKey:t??o??e,clearCache:r,pixelRatio:n,selector:i,targetUrl:s,width:a})}function TA(e,t,r,n){return _f({type:e,projectId:t,elementId:r,cacheKey:n??null,pixelRatio:.8,clearCache:!0})}function CA(){return"support@useblocks.io"}function AA(){return dg==="useblocks"}var Ef={historyData:[],elementHistoryHasMore:!1},Oa="revisionHistorySlice",Ta=ge({name:Oa,initialState:Ef,reducers:{resetElementHistorySlice:()=>({...Ef}),setElementHistory:(e,t)=>{t.payload.length!==0&&(e.historyData=t.payload)},setElementHistoryPage:(e,{payload:t})=>{e.historyData=t.revisions,e.elementHistoryHasMore=t.hasMore}}}),{resetElementHistorySlice:IA,setElementHistoryPage:ci}=Ta.actions,{setElementHistory:tR}=Ta.actions,wA=e=>e[Oa].elementHistoryHasMore,MA=e=>e[Oa].historyData;function RA(){const e=pe(),t=qe();return(0,N.useCallback)(async(r,n=1)=>{const i=M.getContainer(e),o=It(Oo(i).sessionKey());try{if(o){if(!Cc(i))return n===1&&t(ci({revisions:[],hasMore:!1})),{isSuccess:!0,data:{data:[],hasMore:!1}};const{revisions:c,hasMore:u}=await Ao(i).readRevisions(String(r),n);return n===1&&t(ci({revisions:c,hasMore:u})),{isSuccess:!0,data:{data:c,hasMore:u}}}if(!await rc(i))return n===1&&t(ci({revisions:[],hasMore:!1})),{isSuccess:!0,data:{data:[],hasMore:!1}};const{revisions:a,hasMore:s}=await Co(i).readRevisions(String(r),n);return n===1&&t(ci({revisions:a,hasMore:s})),{isSuccess:!0,data:{data:a,hasMore:s}}}catch(a){return{isError:!0,error:a}}},[e,t])}var DA="Not available for collaborative editing",NA="Problem with internet connection";function jA(){const{document:e}=jr();return(0,N.useCallback)(()=>Ld(e),[e])}function LA(e){const t={order:"desc",orderby:"modified"},r={};if(e.notEmbed||(r._embed=""),e.projectId&&(r._embed="author",r._fields="id,title,meta,emailtags,folder,group,modified,date,type,acf.lock,acf.project.ID,author,acf.is_template,_embedded",t["filter[meta_key]"]="project",t["filter[meta_value]"]=e.projectId),e.fields&&(r._fields=e.fields),e.page&&(t.page=e.page),(e.order==="asc"||e.order==="desc")&&(t.order=e.order),e.orderby&&(t.orderby=e.orderby),e.folderTag&&e.folderTag!=="all"?(t["filter[tax_query][relation]"]="AND",t["filter[tax_query][0][taxonomy]"]="folder",t["filter[tax_query][0][field]"]="id",t["filter[tax_query][0][terms]"]=e.folderTag,t["filter[tax_query][0][include_children]"]="0"):(e.folderTag!=="all"||typeof e.folderTag=="object"&&e.folderTag===null)&&!e.tags?.length&&e.status&&e.status!=="trash"&&(t["filter[tax_query][0][taxonomy]"]="folder",t["filter[tax_query][0][operator]"]="NOT EXISTS"),e.tags?.length>0&&e.status!=="trash"){t["filter[tax_query][relation]"]="AND";for(let n=0,i=e.tags.length;n<i;n++){const o=e.tags[n];t[`filter[tax_query][${n+1}][taxonomy]`]="emailtags",t[`filter[tax_query][${n+1}][field]`]="id",t[`filter[tax_query][${n+1}][terms]`]=o}}return e.name&&(t.search=e.name),e.pageSize&&(t.per_page=e.pageSize),e.status==="trash"&&(r.status="trash"),{request:t,extraQuery:r}}var kA=M.createIdentifier$1("EmailsList"),FA={};function UA(e,t){return!!e&&JSON.stringify(e)===JSON.stringify(t)}async function BA(e,t){const r=e?.getInstance(kA),n=r?.get(),i=n?.promise;if(!(!r||i===void 0||!UA(n?.args,t)))return r.set(FA),i}function $A(e){return typeof e=="object"&&e!==null?e:void 0}function bt({id:e,title:t,meta:r,type:n,guid:i,acf:{lock:o,subject:a,description:s,html:c,project:u,tags:h,utm_parameters:f,parent_email:y,common_styles:E,is_template:S},author:v,...C}){const A=$A(r);return{...C,...A!==void 0?{meta:A}:{},id:ie(e),author:ie(v),title:Ne(t)||"",lock:o,description:s,html:c,project:se(u)?u.ID:u,project_author:se(u)?u.post_author:void 0,project_title:se(u)?u.post_title:void 0,tags:h,utm_parameters:f,parent_email:ie(y instanceof Array&&y[0]?y[0].ID:y),common_styles:E,is_template:S}}function Ca({title:e,lock:t,subject:r,description:n,html:i,project:o,tags:a,renderGuid:s,utm_parameters:c,parent_email:u,common_styles:h,is_template:f,author:y,meta:E,...S}){return{...S,author:de(y),title:e,acf:{lock:t,description:n,html:i,project:o,tags:a,utm_parameters:c,parent_email:de(u),common_styles:h,is_template:f}}}function GA(e){return typeof e=="object"&&e!==null?e:void 0}function Sf({id:e,title:t,meta:r,acf:{html:n,common_styles:i},parent:o,excerpt:a,author:s,...c}){const u=GA(r);return{...c,...u!==void 0?{meta:u}:{},author:ie(s),id:ie(e),parent:ie(o),title:Ne(t)||"",html:n,common_styles:i,excerpt:se(a)?a.rendered:a}}function Pf({parent:e,title:t,html:r,project:n,subject:i,preheader:o,common_styles:a,author:s,parent_email:c,meta:u,...h}){return{...h,author:de(s),title:t,parent:de(e),"acf[html]":r,"acf[project]":se(n)?n.id||n.ID:n,"acf[parent_email]":c,"acf[common_styles]":a}}var Of=be({reducerPath:"emailsApi",tagTypes:["Emails","Email"],baseQuery:Oe({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getEmails:e.query({async queryFn(t,r){const n=await BA(Un(r),t);if(n)return n;const i=q(r),{request:o,extraQuery:a}=LA(t);return i.wp.email_list(o,{extraQuery:a}).then(s=>Pe(bt)(s))},providesTags:t=>t?[...t.map(({id:r})=>({type:"Emails",id:r})),{type:"Emails",id:"LIST"}]:[{type:"Emails",id:"LIST"}]}),getTemplateEmails:e.query({queryFn(t,r){const n=q(r),i={"filter[meta_query][1][key]":"is_template","filter[meta_query][1][value]":"1","filter[meta_query][0][compare]":"LIKE",orderby:"modified",order:"desc"},o={_embed:"author,wp:term",_fields:"_embedded,id,title,meta,emailtags,folder,group,modified,date,type,acf.lock,acf.project.ID,acf.is_template"};if(t.emailId&&(i["filter[meta_query][0][key]"]="parent_email",i["filter[meta_query][0][value]"]=t.emailId),t.fields&&(o._fields=t.fields),t.group?.length>0||t.projectGroup?.length>0){const a=[...t.group||[],...t.projectGroup||[]].reduce((c,{key:u,parentId:h})=>(c[h]||(c[h]=[]),c[h].push(String(u)),c),{}),s=Object.values(a).map(c=>c.sort());i["filter[tax_query][relation]"]="AND",s.forEach((c,u)=>{i[`filter[tax_query][${u}][relation]`]="OR",c.forEach((h,f)=>{i[`filter[tax_query][${u}][${f}][taxonomy]`]="group",i[`filter[tax_query][${u}][${f}][field]`]="id",i[`filter[tax_query][${u}][${f}][terms]`]=h})})}if(t.tags?.length>0){i["filter[tax_query][relation]"]="AND";for(let a=0,s=t.tags.length;a<s;a++){const c=t.tags[a];i[`filter[tax_query][${a}][taxonomy]`]="emailtags",i[`filter[tax_query][${a}][field]`]="id",i[`filter[tax_query][${a}][terms]`]=c}}if(t.type&&(i["filter[meta_query][2][key]"]="type",i["filter[meta_query][2][value]"]=t.type),t.name&&(i.search=t.name),t.pageSize&&(i.per_page=t.pageSize),t.page){i.page=t.page;const{groupsTemplateProjectTotal:a,groupsTemplateProjectTotalPages:s}=r.getState()?.projectSlice;if(!t.projectGroup?.length&&!t.group?.length&&s<t.page&&t.groupType===Og.ALL&&a&&s&&!t.projectId){const c=24-a%24+(t.page-(s+1))*24;c&&(i.page=1,i.offset=c)}}return t.projectId&&(i["filter[meta_key]"]="project",i["filter[meta_value]"]=t.projectId),n.wp.email_list(i,{extraQuery:o}).then(Pe(bt))},keepUnusedDataFor:0}),addEmail:e.mutation({queryFn:Zo(t=>({source:r,...n})=>Or(t).wp.email_create({status:"publish",...Ca(n)},{type:M.ContentType.Json}).then(ce(bt))),invalidatesTags:[{type:"Emails",id:"LIST"}]}),editEmail:e.mutation({queryFn:Zo(t=>({emailId:r,source:n,...i})=>{const o=Or(t),a=Qe(Ca(i));return o.wp.email_partial_update({id:r},a,{type:M.ContentType.Json,extraQuery:{_embed:"wp:term",_fields:"_embedded,id,author,title,meta,emailtags,folder,group,modified,date,type,acf.description,acf.html,acf.common_styles,acf.is_template,acf.lock,acf.parent_email,acf.project,acf.secret_hash,acf.subject,acf.utm_parameters"}}).then(ce(bt))}),invalidatesTags:(t,r,n)=>[{type:"Emails",id:"LIST"},{type:"Emails",id:n.emailId}]}),deleteEmail:e.mutation({queryFn(t,r){const n=q(r);let i,o;return typeof t=="object"?(i=t.id,o=t.force):(i=t,o=!1),n.wp.email_delete({id:i},{force:o}).then(hn(bt))},invalidatesTags:(t,r,n)=>[{type:"Emails",id:"LIST"},{type:"Emails",id:typeof n=="object"?n.id:n}]}),addTag:e.mutation({queryFn(t,r){return q(r).wp.emailtags_create({...t},{type:M.ContentType.Json})}}),getDeletableTag:e.query({queryFn([t,r],n){return q(n).wp.email_list({status:["private"],"filter[meta_key]":"project","filter[meta_value]":t,emailtags:[r]},{extraQuery:{"_fields[]":"emailtags"}}).then(Pe(bt))}}),autoSaveEmail:e.mutation({queryFn({emailId:t,body:r},n){const i=q(n),o=Pf(r);return i.wp.email_autosaves_create({id:t},o,{type:M.ContentType.FormData}).then(ce(Sf))},onQueryStarted({emailId:t,body:r},n){_n(M.getContainer(n))&&Eo(t,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader})}})})}),{useGetEmailsQuery:rR,useGetTemplateEmailsQuery:nR,useAddEmailMutation:qA,useEditEmailMutation:xA,useDeleteEmailMutation:iR,useGetDeletableTagQuery:oR,useAddTagMutation:aR,useAutoSaveEmailMutation:sR}=Of;function HA(){const{document:e}=jr();return(0,N.useCallback)(t=>fc(e,t),[e])}function VA(e){const{document:t}=jr(),r=(0,N.useCallback)(i=>t?t.subscribe(i):()=>{},[t]),n=(0,N.useCallback)(()=>t?.get().attributes?.[e],[t,e]);return(0,N.useSyncExternalStore)(r,n)}var Aa=null;function Tf(){return Aa===null&&(Aa=(0,et.__vitePreload)(()=>Promise.resolve().then(()=>fe("./48da14fd.js")).then(e=>e.default),void 0,{}.url)),Aa}async function zA(e){return(await Tf()).getType(e)}async function QA(e){return(await Tf()).getExtension(e)}var Cf=()=>(0,et.__vitePreload)(()=>Promise.resolve().then(()=>fe("./7b850506.js")),void 0,{}.url),WA=new TextDecoder("utf-8",{fatal:!0}),KA=new TextDecoder;async function Af(e){return e instanceof Uint8Array?e:typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(await e.arrayBuffer())}function YA(e){let t=!1;for(let n=0;n<e.length;n++){const i=e.charCodeAt(n);if(i>255)return e;i>=128&&(t=!0)}if(!t)return e;const r=Uint8Array.from(e,n=>n.charCodeAt(0));try{return WA.decode(r)}catch{return new TextDecoder("cp866").decode(r)}}function If(e){const t={};for(const r of Object.keys(e))r.endsWith("/")||(t[YA(r)]=e[r]);return t}async function XA(e){const{zip:t,zipSync:r}=await Cf(),n={};for(const i of Object.keys(e))n[i]=await Af(e[i]);try{const i=await new Promise((o,a)=>{t(n,{level:6},(s,c)=>s?a(s):o(c))});return new Blob([i],{type:"application/zip"})}catch{return new Blob([r(n,{level:6})],{type:"application/zip"})}}async function wf(e){const{unzip:t,unzipSync:r}=await Cf(),n=await Af(e);try{return If(await new Promise((i,o)=>{t(n,(a,s)=>a?o(a):i(s))}))}catch{return If(r(n))}}function JA(e){const t=atob(e);return wf(Uint8Array.from(t,r=>r.charCodeAt(0)))}function ZA(e){return KA.decode(e)}function eI(e){return new Blob([e])}function Mf(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function li(e){const t=e.indexOf("(");if(t<0)return!0;let r=0,n="",i=!1;for(let o=t;o<e.length;o++){const a=e[o];if(i){i=!1;continue}if(a==="\\"){i=!0;continue}if(n){a===n&&(n="");continue}if(a==='"'||a==="'"){n=a;continue}if(a==="("){r++;continue}if(a===")"&&(r--,r<0))return!1}return r===0}function tI(e){return(t,r,n)=>li(t)?e(t,r,n):!1}function rI(e){return t=>li(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function nI(e){return(t,r,n)=>li(t)?Mf(t)?e(t,r,n):t:!1}function iI(e){return t=>{const r=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return li(r)?Mf(r)?e(t):t:!1}}function oI(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function Ia(e,t){const r=e.length;for(let n=0;n<r;n++){const i=e.charCodeAt(n);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 aI(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",n=new Uint8Array(e);crypto.getRandomValues(n);let i="";for(let o=0;o<e;o++){const a=n[o]%62;i+=t.charAt(a)}return i}var sI=8,uI=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=aI(sI),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},di=new uI;function Rf(e,t){return t!==void 0&&!Ia(e,t)?`%|{${di.getOrCreateByKey(e)}}|%`:e}function cI(e){const t=di.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function re(e,t,r){return t!==void 0?Ia(e,t)?e:`%|{${di.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function lI(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function te(e){return e.startsWith("<!--")&&e.endsWith("-->")?lI(e.slice(4,-3)):e}function dI(e){const t=/^(IF|ELSE|ELSIF|ELSEIF|END|FOREACH|WHILE|NEXT|LAST|BREAK|DO|UNLESS|CONTINUE|SET|UNSET|DEFINE|INCLUDE)\b/i,r=/\w+\s*\(/;let n=e;const i=e.match(/\[%\s*([^%]*?)\s*%\]/);i&&(n=i[1]);const o=n.trim();return t.test(o)||r.test(o)}function fI(e,t,r){return t!==void 0?Ia(e,t)?e:`%|{${di.getOrCreateByKey(e)}}|%`:r||oI(e)||dI(e)?`<!--${e}-->`:e}var yt=tI(re),vt=rI(te),pI=nI(re),mI=iI(te),Df=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",cI),e.escape("@{","}",re,!0).unescape("<!--@{","}-->",te,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",Rf,!0),e.escape("{{","}}",Rf,!0),e.createSyntax("brace-percent").escape("{%","%}",re).unescape("<!--{%","%}-->",te),e.createSyntax("brace-hash").escape("{#","#}",re).unescape("<!--{#","#}-->",te),e.createSyntax("proscript").escape("[%","%]",fI,!0).unescape("<!--[%","%]-->",te,!0),e.createSyntax("getresponse").escape("[[IF","]]",re).escape("[[if","]]",re).escape("[[ELSE]]","",re).escape("[[else]]","",re).escape("[[ENDIF]]","",re).escape("[[endif]]","",re).unescape("<!--[[IF","]]-->",te).unescape("<!--[[if","]]-->",te).unescape("<!--[[ELSE]]","-->",te).unescape("<!--[[else]]","-->",te).unescape("<!--[[ENDIF]]","-->",te).unescape("<!--[[endif]]","-->",te),e.createSyntax("expert-sender").escape("<if",">",re).escape("</if",">",re).escape("<else",">",re).escape("</else",">",re).escape("<var ",">",re,!0).unescape("<!--<if ",">-->",te).unescape("<!--</if",">-->",te).unescape("<!--<else ",">-->",te).unescape("<!--</else",">-->",te).unescape("<!--<var",">-->",te,!0),e.createSyntax("velocity").escape("#if",")",yt).escape("#elseif",")",yt).escape("#else","",re).escape("#foreach",")",yt).escape("#macro",")",yt).escape("#set",")",pI,!0).escape("#parse",")",yt).escape("#include",")",yt).escape("#evaluate",")",yt).escape("#end","",re).escape("#break","",re).escape("#stop","",re).unescape("<!--#macro","-->",vt).unescape("<!--#if","-->",vt).unescape("<!--#elseif","-->",vt).unescape("<!--#else","-->",te).unescape("<!--#foreach","-->",vt).unescape("<!--#parse","-->",vt).unescape("<!--#include","-->",vt).unescape("<!--#evaluate","-->",vt).unescape("<!--#end","-->",te).unescape("<!--#break","-->",te).unescape("<!--#stop","-->",te).unescape("<!--#set","-->",mI,!0),e.createSyntax("mailchimp").escape("*|","|*",re).unescape("<!--*|","|*-->",te)},wa="bare",hI=new Map;function gI(e){return e?hI.get(e)??wa:wa}var Nf=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function jf(e){return Nf.includes(e)}function Br(e){return e==="bare"||e==="html-comment"}function Ma(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function bI(e,t=r=>{}){const r={output:{},editor:{}};if(e==null)return r;let n;if(typeof e=="string"){if(!Br(e))return t(`templateDirectives: unknown form "${String(e)}", falling back to the default ("bare").`),r;n={output:e}}else if(typeof e=="object"&&!Array.isArray(e))n=e;else return t(`templateDirectives: expected a string or an object, got ${typeof e}. Ignored.`),r;for(const[u,h]of[["output",n.output],["editor",n.editor]])if(h!==void 0&&!Br(h))return t(`templateDirectives.${u}: unknown form "${String(h)}", configuration ignored.`),r;if(n.syntaxes!==void 0&&!Ma(n.syntaxes))return t("templateDirectives.syntaxes: expected an object, configuration ignored."),r;if(n.syntaxes){for(const[u,h]of Object.entries(n.syntaxes))if(!(!jf(u)||h===void 0||Br(h))){if(!Ma(h))return t(`templateDirectives.syntaxes.${u}: expected a form or an object, configuration ignored.`),r;for(const f of["output","editor"]){const y=h[f];if(y!==void 0&&!Br(y))return t(`templateDirectives.syntaxes.${u}.${f}: unknown form "${String(y)}", configuration ignored.`),r}}}if(n.output===void 0&&n.editor===void 0&&n.syntaxes===void 0)return r;const i=n.output??wa;let o=n.editor;i==="bare"&&n.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),o=void 0);const a=[];if(n.syntaxes)for(const u of Object.keys(n.syntaxes)){if(!jf(u)){t(`templateDirectives.syntaxes: unknown syntax id "${u}", entry ignored.`);continue}a.push(u)}else a.push(...Nf);const s={},c={};for(const u of a){const h=n.syntaxes?.[u],f=Ma(h)?h:void 0,y=(Br(h)?h:f?.output)??i;let E=f?.editor??o??y;y==="bare"&&E==="html-comment"&&(t(`templateDirectives.syntaxes.${u}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),E="bare"),s[u]=y,c[u]=E}return{output:s,editor:c}}function Lf(e,t,r,n){for(let i=t;i<r;i++){const o=e[i];n.insideAttributeValue?n.attributeQuoteChar==='"'||n.attributeQuoteChar==="'"?o===n.attributeQuoteChar&&(n.insideAttributeValue=!1,n.attributeQuoteChar=void 0):n.unquotedAttr&&/[\s>]/.test(o)&&(n.insideAttributeValue=!1,n.attributeQuoteChar=void 0,n.unquotedAttr=!1):o==="<"?n.insideTag=!0:o===">"?n.insideTag=!1:n.insideTag&&(o==='"'||o==="'")?(n.insideAttributeValue=!0,n.attributeQuoteChar=o,n.unquotedAttr=!1):n.insideTag&&/\S/.test(o)&&n.attributeQuoteChar===void 0&&e[i-1]==="="&&!['"',"'","`"].includes(o)&&(n.insideAttributeValue=!0,n.attributeQuoteChar="",n.unquotedAttr=!0)}}function $r(e,t){return e.start<t.end&&t.start<e.end}function kf(e,t,r,n,i=[]){if(r&&(t=t.filter(h=>h.isVariable)),!t.length)return[];const o=t.flatMap(h=>h.match(e).flatMap(f=>!Number.isInteger(f.start)||!Number.isInteger(f.end)||f.start<0||f.end>e.length||f.start>=f.end?[]:[{range:f,mapFn:h.mapFn,overrideBuiltins:h.overrideBuiltins,syntax:h.syntax,isVariable:h.isVariable}])).sort((h,f)=>h.range.start-f.range.start||h.range.end-f.range.end),a=[],s=i.slice().sort((h,f)=>h.start-f.start),c={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let u=0;for(const{range:h,mapFn:f,overrideBuiltins:y,syntax:E,isVariable:S}of o){if(n?(c.insideAttributeValue=!0,c.attributeQuoteChar='"'):Lf(e,u,h.start,c),u=h.end,s.some(I=>$r(I,h)))continue;const v=c.insideAttributeValue?c.attributeQuoteChar??"":void 0,C=e.substring(h.start,h.end),A=f(C,v,c.insideTag);A!==!1&&A!==C&&(a.push({range:h,text:A,overrideBuiltins:y,syntax:E,isVariable:S}),s.push(h))}return a.sort((h,f)=>h.range.start-f.range.start||h.range.end-f.range.end)}function yI(e,t){const r=t.reduce((s,{mapFn:c,start:u,end:h,syntax:f,isVariable:y})=>(s[u]||(s[u]=[]),s[u].push({value:h,mapFn:c,syntax:f,isVariable:y}),s),Object.create(null)),n=Object.keys(r).map(s=>s.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),i=new RegExp(n,"g"),o=[];let a;for(;(a=i.exec(e))!==null;){const s=a[0];o.push({start:a.index,startToken:s,endTokens:r[s]})}return o}function Ra(e,t,r,n,i=!1){const o=[];if(r&&(t=t.filter(u=>u.isVariable)),!t.length)return o;const a=yI(e,t),s={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let c=0;for(let u=0;u<a.length;u++){const{start:h,startToken:f,endTokens:y}=a[u];n?(s.insideAttributeValue=!0,s.attributeQuoteChar='"'):Lf(e,c,h,s),c=h;const E=s.insideAttributeValue?s.attributeQuoteChar??"":void 0;let S=!1;for(const{mapFn:v,value:C,syntax:A,isVariable:I}of y){let T=h+f.length,g=e.indexOf(C,T);for(;g!==-1;){let m=g,l=h+f.length,b=0;for(;m!==-1;){const w=e.indexOf(f,l);if(w!==-1&&w<m)b++,l=w+f.length,m=e.indexOf(C,l);else if(b>0)b--,l=m+C.length,m=e.indexOf(C,l);else break}if(m<0)break;const d=m+C.length,_=e.substring(h,d),P=v(_,E,s.insideTag);if(P===!1){T=g+Math.max(C.length,1),g=e.indexOf(C,T);continue}(i||P!==_)&&o.push({range:{start:h,end:d},text:i?_:P,syntax:A,isVariable:I});const O=a.findIndex(({start:w})=>w>=d);O>u?u=O-1:u=a.length,S=!0;break}if(S)break}}return o}function fi(e,t){if(!t.length)return e;const r=t.slice().sort((i,o)=>o.range.start-i.range.start);let n=e;for(const{text:i,range:o}of r)n=n.slice(0,o.start)+i+n.slice(o.end);return n}var vI=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=Df){const{_escapes:t,_unescapes:r}=this;e({createSyntax(n){return{...this,syntax:n}},escape(n,i,o,a){return t.push({start:n,end:i,mapFn:o,isVariable:a,syntax:this.syntax||n}),this},unescape(n,i,o,a){return r.push({start:n,end:i,mapFn:o,isVariable:a,syntax:this.syntax||n}),this}})}registerMatcherPair(e){const t=e.syntax||"matcher",r={syntax:t,match:e.escape.match,mapFn:e.escape.mapFn,isVariable:e.escape.isVariable,overrideBuiltins:e.escape.overrideBuiltins},n={syntax:t,match:e.unescape.match,mapFn:e.unescape.mapFn,isVariable:e.unescape.isVariable,overrideBuiltins:e.unescape.overrideBuiltins};this._escapeMatchers.push(r),this._unescapeMatchers.push(n);let i=!1;const o={dispose:()=>{i||(i=!0,this._escapeMatchers=this._escapeMatchers.filter(a=>a!==r),this._unescapeMatchers=this._unescapeMatchers.filter(a=>a!==n))}};return this.addDisposable(o),o}_collectMappings(e,t,r){const n=Ra(e,this._escapes,t,r),i=kf(e,this._escapeMatchers,t,r),o=i.filter(c=>c.overrideBuiltins).map(c=>c.range),a=n.filter(c=>!o.some(u=>$r(u,c.range))),s=i.filter(c=>c.overrideBuiltins||!a.some(u=>$r(c.range,u.range)));return[...a,...s].sort((c,u)=>c.range.start-u.range.start||c.range.end-u.range.end)}getMappings(e,t,r){return this._collectMappings(e,t,r)}_collectRevertMappings(e,t){const r=Ra(e,this._unescapes,t),n=kf(e,this._unescapeMatchers,t,!1),i=n.filter(s=>s.overrideBuiltins).map(s=>s.range),o=r.filter(s=>!i.some(c=>$r(c,s.range))),a=n.filter(s=>s.overrideBuiltins||!o.some(c=>$r(s.range,c.range)));return[...o,...a].sort((s,c)=>s.range.start-c.range.start||s.range.end-c.range.end)}getRevertMappings(e,t,r){const n=r?i=>i!==void 0&&r.has(i):i=>gI(i)==="html-comment";return this._collectRevertMappings(e,t).filter(i=>i.isVariable||!n(i.syntax))}getDetectedMappings(e,t,r){return Ra(e,this._escapes,t,r,!0)}getEscapedText(e,t){return fi(e,this.getMappings(e,t))}getUnescapedText(e,t,r){return fi(e,this.getRevertMappings(e,t,r))}normalizeToPolicy(e,t){const r=o=>o===void 0?void 0:t[o],n=Object.values(t);let i=e;return n.includes("bare")&&(i=fi(i,this._collectRevertMappings(i).filter(o=>r(o.syntax)==="bare"))),n.includes("html-comment")&&(i=fi(i,this._collectMappings(i).filter(o=>!o.isVariable&&r(o.syntax)==="html-comment"&&o.text.startsWith("<!--")&&o.text.endsWith("-->")))),i}hasDetectedMappings(e,t,r){return this.getDetectedMappings(e,t,r).length>0}addDisposable(e){this._disposables.push(e)}dispose(){for(const e of this._disposables)e.dispose()}};function Ff(e){return e.replace("<script","<___script").replace("<\/script>","</___script>")}var _I=new vI(e=>{e.escape("<script","<\/script>",t=>Ff(t)).unescape("<___script","</___script>",t=>t.replace("<___script","<script").replace("</___script>","<\/script>")),e.escape("<script","/>",t=>Ff(t)).unescape("<___script","/>",t=>t.replace("<___script","<script")),Df(e)}),Uf=class{_voidElements;constructor(e){this._voidElements=new Set(e)}isVoidElement(e){return this._voidElements.has(e.toLowerCase())}},ve=(function(e){return e[e.StartCommentTag=0]="StartCommentTag",e[e.Comment=1]="Comment",e[e.EndCommentTag=2]="EndCommentTag",e[e.StartTagOpen=3]="StartTagOpen",e[e.StartTagClose=4]="StartTagClose",e[e.StartTagSelfClose=5]="StartTagSelfClose",e[e.StartTag=6]="StartTag",e[e.EndTagOpen=7]="EndTagOpen",e[e.EndTagClose=8]="EndTagClose",e[e.EndTag=9]="EndTag",e[e.DelimiterAssign=10]="DelimiterAssign",e[e.AttributeName=11]="AttributeName",e[e.AttributeValue=12]="AttributeValue",e[e.StartDoctypeTag=13]="StartDoctypeTag",e[e.Doctype=14]="Doctype",e[e.EndDoctypeTag=15]="EndDoctypeTag",e[e.Content=16]="Content",e[e.Whitespace=17]="Whitespace",e[e.Unknown=18]="Unknown",e[e.Script=19]="Script",e[e.Styles=20]="Styles",e[e.EOS=21]="EOS",e[e.AdvancedStart=100]="AdvancedStart",e[e.AdvancedEnd=101]="AdvancedEnd",e})({}),EI=class{source;len;position;constructor(e,t){this.source=e,this.len=e.length,this.position=t}eos(){return this.len<=this.position}getSource(){return this.source}pos(){return this.position}goBackTo(e){this.position=e}goBack(e){this.position-=e}advance(e){this.position+=e}goToEnd(){this.position=this.source.length}nextChar(){return this.source.charCodeAt(this.position++)||0}peekChar(e=0){return this.source.charCodeAt(this.position+e)||0}advanceIfChar(e){return e===this.source.charCodeAt(this.position)?(this.position++,!0):!1}advanceIfChars(e){let t;if(this.position+e.length>this.source.length)return!1;for(t=0;t<e.length;t++)if(this.source.charCodeAt(this.position+t)!==e[t])return!1;return this.advance(t),!0}advanceIfRegExp(e){const t=this.source.substr(this.position).match(e);return t?(this.position=this.position+t.index+t[0].length,t[0]):""}advanceUntilRegExp(e){const t=this.source.substr(this.position).match(e);return t?(this.position=this.position+t.index,t[0]):(this.goToEnd(),"")}advanceUntilChar(e){for(;this.position<this.source.length;){if(this.source.charCodeAt(this.position)===e)return!0;this.advance(1)}return!1}advanceUntilChars(e){for(;this.position+e.length<=this.source.length;){let t=0;for(;t<e.length&&this.source.charCodeAt(this.position+t)===e[t];t++);if(t===e.length)return!0;this.advance(1)}return this.goToEnd(),!1}skipWhitespace(){return this.advanceWhileChar(e=>e===II||e===wI||e===TI||e===AI||e===CI)>0}advanceWhileChar(e){const t=this.position;for(;this.position<this.len&&e(this.source.charCodeAt(this.position));)this.position++;return this.position-t}},Bf=33,kt=45,pi=60,$e=62,Da=47,SI=61,PI=34,OI=39,TI=10,CI=13,AI=12,II=32,wI=9,MI={"text/x-handlebars-template":!0,"text/html":!0};function RI(e,t=0,r=0,n=!1){const i=new EI(e,t);let o=r,a=0,s=18,c,u,h,f,y;function E(){return i.advanceIfRegExp(/^[_:a-zA-Z][_:\w-.\d]*/).toLowerCase()}function S(){return i.advanceIfRegExp(/^[^\s"'></=\x00-\x0F\x7F\x80-\x9F]*/).toLowerCase()}function v(I,T,g){return s=T,a=I,c=g,T}function C(){const I=i.pos(),T=o,g=A();return g!==21&&I===i.pos()&&!(n&&(g===4||g===8))?(i.advance(1),v(I,18)):g}function A(){const I=i.pos();if(i.eos())return v(I,21);let T;switch(o){case 6:return i.advanceIfChars([kt,kt,$e])?(o=0,v(I,2)):(i.advanceUntilChars([kt,kt,$e]),v(I,1));case 3:return i.advanceIfChar($e)?(o=0,v(I,15)):(i.advanceUntilChar($e),v(I,14));case 0:if(i.advanceIfChar(pi)){if(!i.eos()&&i.peekChar()===Bf){if(i.advanceIfChars([Bf,kt,kt]))return o=6,v(I,0);if(i.advanceIfRegExp(/^!doctype/i))return o=3,v(I,13)}return i.advanceIfChar(Da)?(o=2,v(I,7)):(o=1,v(I,3))}return i.advanceUntilChar(pi),v(I,16);case 2:return E().length>0?(o=5,v(I,9)):i.skipWhitespace()?v(I,17,"Tag name must directly follow the open bracket."):(o=5,i.advanceUntilChar($e),I<i.pos()?v(I,18,"End tag name expected."):A());case 5:if(i.skipWhitespace())return v(I,17);if(i.advanceIfChar($e))return o=0,v(I,8);if(n&&i.peekChar()===pi)return o=0,v(I,8,"Closing bracket missing.");T="Closing bracket expected.";break;case 1:return h=E(),y=void 0,f=void 0,h.length>0?(u=!1,o=4,v(I,6)):i.skipWhitespace()?v(I,17,"Tag name must directly follow the open bracket."):(o=4,i.advanceUntilChar($e),I<i.pos()?v(I,18,"Start tag name expected."):A());case 4:return i.skipWhitespace()?(u=!0,v(I,17)):u&&(f=S(),f.length>0)?(o=9,u=!1,v(I,11)):i.advanceIfChars([Da,$e])?(o=0,v(I,5)):i.advanceIfChar($e)?(h==="script"?y&&MI[y]?o=0:o=7:h==="style"?o=8:o=0,v(I,4)):n&&i.peekChar()===pi?(o=0,v(I,4,"Closing bracket missing.")):(i.advance(1),v(I,18,"Unexpected character in tag."));case 9:return i.skipWhitespace()?(u=!0,v(I,17)):i.advanceIfChar(SI)?(o=10,v(I,10)):(o=4,A());case 10:if(i.skipWhitespace())return v(I,17);let g=i.advanceIfRegExp(/^[^\s"'`=<>]+/);if(g.length>0)return i.peekChar()===$e&&i.peekChar(-1)===Da&&(i.goBack(1),g=g.substr(0,g.length-1)),f==="type"&&(y=g),o=4,u=!1,v(I,12);const m=i.peekChar();return m===OI||m===PI?(i.advance(1),i.advanceUntilChar(m)&&i.advance(1),f==="type"&&(y=i.getSource().substring(I+1,i.pos()-1)),o=4,u=!1,v(I,12)):(o=4,u=!1,A());case 7:let l=1;for(;!i.eos();){const b=i.advanceIfRegExp(/<!--|-->|<\/?script\s*\/?>?/i);if(b.length===0)return i.goToEnd(),v(I,19);if(b==="<!--")l===1&&(l=2);else if(b==="-->")l=1;else if(b[1]!=="/")l===2&&(l=3);else if(l===3)l=2;else{i.goBack(b.length);break}}return o=0,I<i.pos()?v(I,19):A();case 8:return i.advanceUntilRegExp(/<\/style/i),o=0,I<i.pos()?v(I,20):A()}return i.advance(1),o=0,v(I,18,T)}return{scan:C,getTokenType:()=>s,getTokenOffset:()=>a,getTokenLength:()=>i.pos()-a,getTokenEnd:()=>i.pos(),getTokenText:()=>i.getSource().substring(a,i.pos()),getScannerState:()=>o,getTokenError:()=>c}}function DI(e){if(typeof e=="string"){const t=e.startsWith("'")||e.startsWith('"')?1:0,r=e.endsWith("'")||e.endsWith('"')?e.length-1:e.length;return e.substring(t,r)}return e}var $f=class{text;type;node=void 0;replaces=void 0;constructor(e,t){this.text=e,this.type=t}get hasNode(){return!!this.node}addReplace(e){this.replaces?.push(e)}start(e,t,r){if(!this.node){const n=this.node=new tt(e,this.text.length,[],r);n.type=this.type,n.startTagEnd=t,this.replaces=[]}}finish(e,t){const r=this.replaces,n=this.node,i=e+(t||0);if(r){for(const o of r){const a=o.parent;if(!a)throw new Error("parent not defined");const s=a.children.indexOf(o);a.children.splice(s,1)}this.replaces=void 0}if(n){const o=n.parent;if(!o)throw new Error("parent not defined");o.children.push(n),n.closed=t!==void 0,n.endTagStart=e,n.end=i,n.content=this.text.substring(n.startTagEnd,e),this.node=void 0}}},Gf=class{dataManager;constructor(e){this.dataManager=e}parse(e,t=[]){const r=RI(e,void 0,void 0,!0),n=new tt(0,e.length,[],void 0);n.type=ue.ROOT;let i=n,o=-1,a,s=null,c=r.scan();const u=()=>{if(!i.tag){const S=i.parent.children,v=S[S.length-2],C=e.substring(i.start,i.end);v?.type===ue.HTML?(v.content=(v.content||"")+C,v.end=i.end,S.splice(S.length-1,1)):(i.type=ue.HTML,i.content=C,i.children=[]),i.type=ue.HTML}i=i.parent},h=new $f(e,ue.COMMENT),f=new $f(e,ue.DOCTYPE),y=S=>{i.children.push(S)};for(;c!==ve.EOS;){switch(c){case ve.StartDoctypeTag:f.start(r.getTokenOffset(),r.getTokenEnd(),i);break;case ve.EndDoctypeTag:{const I=i.lastChild,T=f.node;if(!T)throw new Error("");const g=I?I.end:i.startTagEnd!==void 0?i.startTagEnd:i.start;if(g!==T.start){const m=e.substring(g,T.start);if(m){const l=new tt(g,T.start,[],i);l.type=ue.HTML,l.content=m,y(l)}}f.finish(r.getTokenOffset(),r.getTokenLength());break}case ve.StartCommentTag:h.start(r.getTokenOffset(),r.getTokenEnd(),i);break;case ve.EndCommentTag:{const I=i.lastChild,T=h.node;if(!T)throw new Error("");const g=I?I.end:i.startTagEnd!==void 0?i.startTagEnd:i.start;if(g!==T.start){const m=e.substring(g,T.start);if(m){const l=new tt(g,T.start,[],i);l.type=ue.HTML,l.content=m,y(l)}}h.finish(r.getTokenOffset(),r.getTokenLength());break}case ve.StartTagOpen:const S=i.lastChild,v=new tt(r.getTokenOffset(),e.length,[],i),C=S?S.end:i.startTagEnd!==void 0?i.startTagEnd:i.start;if(C!==v.start){const I=e.substring(C,v.start);if(I){const T=new tt(C,v.start,[],i);T.type=ue.HTML,T.content=I,y(T)}}y(v),i=v;break;case ve.StartTag:i.tag=r.getTokenText();break;case ve.StartTagClose:i.parent&&(i.end=r.getTokenEnd(),r.getTokenLength()?(i.startTagEnd=r.getTokenEnd(),i.tag&&this.dataManager.isVoidElement(i.tag)&&(i.closed=!0,u())):u());break;case ve.StartTagSelfClose:i.parent&&(i.closed=!0,i.end=r.getTokenEnd(),i.startTagEnd=r.getTokenEnd(),u());break;case ve.EndTagOpen:o=r.getTokenOffset(),a=void 0;break;case ve.EndTag:a=r.getTokenText().toLowerCase();break;case ve.EndTagClose:let A=i;for(;!A.isSameTag(a)&&A.parent;)A=A.parent;if(A.parent){const I=i.lastChild,T=I?I.end:i.startTagEnd===void 0?i.start:i.startTagEnd;if(T!==o){const g=e.substring(T,o);if(g){const m=new tt(T,o,[],i);m.type=ue.HTML,m.content=g,y(m)}}for(;i!==A;)i.end=o,i.closed=!1,u();i.closed=!0,i.endTagStart=o,i.end=r.getTokenEnd(),u()}break;case ve.AttributeName:{s=r.getTokenText();let I=i.attributes;I||(i.attributes=I={}),I[s]=null;break}case ve.AttributeValue:{const I=r.getTokenText(),T=i.attributes;T&&s&&(T[s]=DI(I),s=null);break}}c=r.scan()}for(;i.parent;)i.end=e.length,i.closed=!1,u();h.hasNode,h.finish(e.length);const E=n.lastChild?.end||0;if(E<e.length){const S=e.substring(E);if(S){const v=new tt(E,e.length,[],n);v.type=ue.HTML,v.content=S,y(v)}}return{roots:n.children,findNodeBefore:n.findNodeBefore.bind(n),findNodeAt:n.findNodeAt.bind(n)}}},uR=new Gf(new Uf(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"])),NI=new Uf(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"]),jI=new Gf(NI);function LI(e){return jI.parse(e)}function kI(e){if(e){const t=document.createElement("div");return t.insertAdjacentHTML("afterbegin",e),t.firstChild||document.createTextNode("")}else return document.createTextNode("")}var qf;function FI(e,t,r){return qf?qf(e,t,r):r}var Na;function UI(){return Na||(Na=document.implementation.createHTMLDocument("")),Na}function BI(e,t){let r;switch(t?.toLowerCase()){case"tr":r=e.createElement("table");break;case"td":r=e.createElement("tr");break;case"head":case"body":r=e.createElement("html");break;case"documenttype":case"html":{const n=e.implementation.createHTMLDocument();for(const i of[...n.childNodes])i.remove();return n}default:r=e.createElement("div")}return r}var $I=new Set(["onclick","onload","onchange","onsubmit","onmouseover","onkeydown","onerror"]),GI=new Set(["script","style","xmp"]);function qI(e,t){return!(t&&GI.has(t.toLowerCase())||$I.has(e.toLowerCase()))}var xI=e=>{let t=e.indexOf("&");for(;t!==-1;){if(e.indexOf(";",t)!==-1)return!0;t=e.indexOf("&",t+1)}return!1};function xf(e,t,r){let n=e.tagName.toLowerCase();n==="html"&&(n="div");const i=`<${n} ${t}="${r}"/>`,o=BI(UI(),n);if(o instanceof Document)return;o.innerHTML=i;const a=o.querySelector(n);if(!a)throw new Error("targetElement is not defined");const s=a.getAttributeNode(t);s&&e.setAttributeNode(s.cloneNode())}function Hf(e,t,r){try{qI(t,e.tagName)&&!xI(r)?e.setAttribute(t,r):xf(e,t,r)}catch{xf(e,t,r)}}function ja(e,t=!0){const r=e.content;switch(e.type){case ue.ROOT:{const n=document.implementation.createHTMLDocument();for(const i of[...n.childNodes])n.removeChild(i);if(t)for(const i of e.children)n.appendChild(ja(i));return n}case ue.DOCTYPE:return new DOMParser().parseFromString(`<!DOCTYPE${e.content}>`,"text/html").doctype;case ue.COMMENT:return document.createComment(r||"");case ue.ELEMENT:if(e.tag){const n=document.createElement(e.tag);if(Object.defineProperty(n,"$$tagName",{enumerable:!1,configurable:!1,value:e.tag}),e.attributes)for(const i of e.attributeNames){const o=e.attributes[i];try{const a=FI(n,i,typeof o=="string"?o:"");a!==null&&Hf(n,i,a)}catch{}}if(t)for(const i of e.children)n.appendChild(ja(i));return n}return document.createTextNode("<");case ue.HTML:return kI(r||"");default:throw new Error("unsupported node")}}function Vf(e){return LI(e).roots.map(t=>ja(t))}var zf=Symbol("Error");function HI(e){return Promise.all(e.map(t=>t instanceof Promise?t.catch(r=>zf):t)).then(t=>t.filter(r=>r!==zf))}var Qf=(e,t)=>t.some(r=>r instanceof RegExp?r.test(e):r===e),VI=new Set(["https:","http:","file:"]),zI=e=>{const t=e.indexOf(":");if(t<=0)return!1;const r=e.substring(0,t+1);return/^[a-zA-Z][a-zA-Z0-9+\-.]*:$/.test(r)?r.endsWith(":")&&!r.includes(".")&&!VI.has(r):!1};function QI(e,t){if(t={defaultProtocol:"http",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,removeExplicitPort:!1,sortQueryParameters:!0,...t},!e)return"";if(Wf(e)&&(e=Kf(e)),typeof t.defaultProtocol=="string"&&!t.defaultProtocol.endsWith(":")&&(t.defaultProtocol=`${t.defaultProtocol}:`),e=e.trim(),/^data:/i.test(e)||zI(e))return e;const r=e.startsWith("//"),n=!r&&/^\.*\//.test(e);let i;try{i=n?new URL(e,typeof document<"u"?document.baseURI:"http://localhost/").toString():e}catch{i=e}let o;try{o=new URL(i)}catch{const s=document.createElement("a");s.href=e,o=new URL(s.href)}if(t.forceHttp&&t.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(t.forceHttp&&o.protocol==="https:"&&(o.protocol="http:"),t.forceHttps&&o.protocol==="http:"&&(o.protocol="https:"),t.stripAuthentication&&(o.username="",o.password=""),t.stripHash?o.hash="":t.stripTextFragment&&(o.hash=o.hash.replace(/#?:~:text.*?$/i,"")),o.pathname){const s=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g;let c=0,u="";for(;;){const f=s.exec(o.pathname);if(!f)break;const y=f.index,E=o.pathname.slice(c,y);u+=E.replace(/\/{2,}/g,"/"),u+=f[0],c=y+f[0].length}const h=o.pathname.slice(c);u+=h.replace(/\/{2,}/g,"/"),o.pathname=u;try{o.pathname=decodeURI(o.pathname)}catch{}}if(t.removeDirectoryIndex){let s=o.pathname.split("/");const c=s[s.length-1];Array.isArray(t.removeDirectoryIndex)&&Qf(c,t.removeDirectoryIndex)&&(s=s.slice(0,-1),o.pathname=s.join("/")+"/")}if(t.stripWWW&&/^www\.(?!www\.)[a-z\d\-]+(\.[a-z.\-]{2,63})+$/.test(o.hostname||"")&&(o.hostname=o.hostname.replace(/^www\./,"")),Array.isArray(t.removeQueryParameters))for(const s of[...o.searchParams.keys()])Qf(s,t.removeQueryParameters)&&o.searchParams.delete(s);if(t.sortQueryParameters){o.searchParams.sort();try{o.search=decodeURIComponent(o.search)}catch{}}t.removeTrailingSlash&&(o.pathname=o.pathname.replace(/\/$/,"")),t.removeExplicitPort&&o.port&&(o.port="");let a=o.toString();return!t.removeSingleSlash&&o.pathname==="/"&&!e.endsWith("/")&&o.hash===""&&(a=a.replace(/\/$/,"")),(t.removeTrailingSlash||o.pathname==="/")&&o.hash===""&&t.removeSingleSlash&&(a=a.replace(/\/$/,"")),r&&!t.normalizeProtocol&&(a=a.replace(/^https?:\/\//,"//")),a}function Wf(e){if(!e)return!1;const t=e[0];return e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||WI(t)}function WI(e){const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}function KI(e){return/^(mailto:|tel:|fax:|sms:|geo:|blob:|data:|javascript:)/i.test(e)}function Kf(e){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")||!Wf(e)||KI(e))return e;if(e.startsWith("/"))return window.location.origin+e;const t=window.location.href,r=t.lastIndexOf("/");return(r!==-1?t.slice(0,r+1):t+"/")+e}var Ft=/<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,YI=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Ut=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Yf=/display:\s*none\s*!important/gi,XI=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,JI=/\s*height\s*:\s*100%\s*!important\s*;?/gi,ZI=/height\s*:\s*100%\s*!important/i,ew=[".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 tw(e){return Yf.lastIndex=0,(e.match(Yf)||[]).length}function Xf(e){const t=e.trim(),r=tw(t);if(r===0)return!1;if(t.includes(".advertisment,")&&t.includes(".adHolder,")&&(t.includes(".socialshare,")||r>=3||t.length>2e3))return!0;const n=ew.filter(i=>t.includes(i)).length;return n>=1&&(r>=3||t.length>2e3)||r>=5&&n>=1?!0:r>=20&&/\b(?:\.ad(?:s|vert|vertisment|Holder|banner|box|Container|Wrapper)?[,{]|#ad[-_]|ins\.adsbygoogle)/i.test(t)}function rw(e){Ut.lastIndex=0;for(const t of e.matchAll(Ut))if(Xf(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function nw(e){let t=!1;return Ut.lastIndex=0,{html:e.replace(Ut,r=>Xf(r.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):r),found:t}}function iw(e){return Ft.lastIndex=0,Ft.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||rw(e)}function Jf(e){if(!iw(e))return{html:e,found:!1};let t=!1,r=e;Ft.lastIndex=0,Ft.test(r)&&(Ft.lastIndex=0,r=r.replace(Ft,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(r)||/\sdata-bis-config\s*=/.test(r))&&(r=r.replace(YI,""),t=!0);const n=nw(r);return r=n.html,t=t||n.found,{html:r,found:t}}function ow(e){return!e||!ZI.test(e)?e:(Ut.lastIndex=0,e.replace(Ut,t=>t.replace(XI,(r,n,i,o)=>`${n}${i.replace(JI,"")}${o}`)))}function aw(e){const t=Jf(e.replaceAll(`\r
|
|
59
59
|
`,`
|
|
60
|
-
`));return{html:ow(t.html),hasBrowserExtensionArtifacts:t.found}}var sw=Z.__commonJSMin(((e,t)=>{(function(r,n){typeof e=="object"&&typeof t<"u"?n(e):typeof define=="function"&&define.amd?define(["exports"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.MutationSummary={}))})(e,(function(r){"use strict";var n=(function(){function g(){this._nodes=[],this._values=[]}return g._isIndex=function(m){return+m===m>>>0},g._nodeId=function(m){var l=m[g._ID_PROP];return l||(l=m[g._ID_PROP]=g._NEXT_ID++),l},g.prototype.set=function(m,l){var b=g._nodeId(m);this._nodes[b]=m,this._values[b]=l},g.prototype.get=function(m){var l=g._nodeId(m);return l!==void 0?this._values[l]:void 0},g.prototype.has=function(m){return g._nodeId(m)in this._nodes},g.prototype.delete=function(m){var l=g._nodeId(m);delete this._nodes[l],this._values[l]=void 0},g.prototype.keys=function(){var m=[];for(var l in this._nodes)g._isIndex(l)&&m.push(this._nodes[l]);return m},g._ID_PROP="__mutation_summary_node_map_id__",g._NEXT_ID=1,g})(),i=(function(){function g(){this.added=new n,this.removed=new n,this.maybeMoved=new n,this.oldPrevious=new n,this.moved=void 0}return g})();r.Movement=void 0,(function(g){g[g.STAYED_OUT=0]="STAYED_OUT",g[g.ENTERED=1]="ENTERED",g[g.STAYED_IN=2]="STAYED_IN",g[g.REPARENTED=3]="REPARENTED",g[g.REORDERED=4]="REORDERED",g[g.EXITED=5]="EXITED"})(r.Movement||(r.Movement={}));var o=function(g,m){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,b){l.__proto__=b}||function(l,b){for(var d in b)Object.prototype.hasOwnProperty.call(b,d)&&(l[d]=b[d])},o(g,m)};function a(g,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");o(g,m);function l(){this.constructor=g}g.prototype=m===null?Object.create(m):(l.prototype=m.prototype,new l)}var s=(function(){function g(m,l,b,d,_,P,O,w){l===void 0&&(l=!1),b===void 0&&(b=!1),d===void 0&&(d=!1),_===void 0&&(_=null),P===void 0&&(P=!1),O===void 0&&(O=null),w===void 0&&(w=null),this.node=m,this.childList=l,this.attributes=b,this.characterData=d,this.oldParentNode=_,this.added=P,this.attributeOldValues=O,this.characterDataOldValue=w,this.isCaseInsensitive=this.node.nodeType===Node.ELEMENT_NODE&&this.node instanceof HTMLElement&&this.node.ownerDocument instanceof HTMLDocument}return g.prototype.getAttributeOldValue=function(m){if(this.attributeOldValues)return this.isCaseInsensitive&&(m=m.toLowerCase()),this.attributeOldValues[m]},g.prototype.getAttributeNamesMutated=function(){var m=[];if(!this.attributeOldValues)return m;for(var l in this.attributeOldValues)this.attributeOldValues.hasOwnProperty(l)&&m.push(l);return m},g.prototype.attributeMutated=function(m,l){this.attributes=!0,this.attributeOldValues=this.attributeOldValues||{},!(m in this.attributeOldValues)&&(this.attributeOldValues[m]=l)},g.prototype.characterDataMutated=function(m){this.characterData||(this.characterData=!0,this.characterDataOldValue=m)},g.prototype.removedFromParent=function(m){this.childList=!0,this.added||this.oldParentNode?this.added=!1:this.oldParentNode=m},g.prototype.insertedIntoParent=function(){this.childList=!0,this.added=!0},g.prototype.getOldParent=function(){if(this.childList){if(this.oldParentNode)return this.oldParentNode;if(this.added)return null}return this.node.parentNode},g})(),c=(function(g){a(m,g);function m(l,b){var d=g.call(this)||this;d.rootNode=l,d.reachableCache=void 0,d.wasReachableCache=void 0,d.anyParentsChanged=!1,d.anyAttributesChanged=!1,d.anyCharacterDataChanged=!1;for(var _=0;_<b.length;_++){var P=b[_];switch(P.type){case"childList":d.anyParentsChanged=!0;for(var O=0;O<P.removedNodes.length;O++){var w=P.removedNodes[O];d.getChange(w).removedFromParent(P.target)}for(var O=0;O<P.addedNodes.length;O++){var w=P.addedNodes[O];d.getChange(w).insertedIntoParent()}break;case"attributes":d.anyAttributesChanged=!0;var D=d.getChange(P.target);D.attributeMutated(P.attributeName,P.oldValue);break;case"characterData":d.anyCharacterDataChanged=!0;var D=d.getChange(P.target);D.characterDataMutated(P.oldValue)}}return d}return m.prototype.getChange=function(l){var b=this.get(l);return b||(b=new s(l),this.set(l,b)),b},m.prototype.getOldParent=function(l){var b=this.get(l);return b?b.getOldParent():l.parentNode},m.prototype.getIsReachable=function(l){if(l===this.rootNode)return!0;if(!l)return!1;this.reachableCache=this.reachableCache||new n;var b=this.reachableCache.get(l);return b===void 0&&(b=this.getIsReachable(l.parentNode),this.reachableCache.set(l,b)),b},m.prototype.getWasReachable=function(l){if(l===this.rootNode)return!0;if(!l)return!1;this.wasReachableCache=this.wasReachableCache||new n;var b=this.wasReachableCache.get(l);return b===void 0&&(b=this.getWasReachable(this.getOldParent(l)),this.wasReachableCache.set(l,b)),b},m.prototype.reachabilityChange=function(l){return this.getIsReachable(l)?this.getWasReachable(l)?r.Movement.STAYED_IN:r.Movement.ENTERED:this.getWasReachable(l)?r.Movement.EXITED:r.Movement.STAYED_OUT},m})(n),u=(function(){function g(m,l,b,d,_){this.rootNode=m,this.mutations=l,this.selectors=b,this.calcReordered=d,this.calcOldPreviousSibling=_,this.treeChanges=new c(m,l),this.entered=[],this.exited=[],this.stayedIn=new n,this.visited=new n,this.childListChangeMap=void 0,this.characterDataOnly=void 0,this.matchCache=void 0,this.processMutations()}return g.prototype.processMutations=function(){if(!(!this.treeChanges.anyParentsChanged&&!this.treeChanges.anyAttributesChanged))for(var m=this.treeChanges.keys(),l=0;l<m.length;l++)this.visitNode(m[l],void 0)},g.prototype.visitNode=function(m,l){if(!this.visited.has(m)){this.visited.set(m,!0);var b=this.treeChanges.get(m),d=l;if((b&&b.childList||d==null)&&(d=this.treeChanges.reachabilityChange(m)),d!==r.Movement.STAYED_OUT){if(this.matchabilityChange(m),d===r.Movement.ENTERED)this.entered.push(m);else if(d===r.Movement.EXITED)this.exited.push(m),this.ensureHasOldPreviousSiblingIfNeeded(m);else if(d===r.Movement.STAYED_IN){var _=r.Movement.STAYED_IN;b&&b.childList&&(b.oldParentNode!==m.parentNode?(_=r.Movement.REPARENTED,this.ensureHasOldPreviousSiblingIfNeeded(m)):this.calcReordered&&this.wasReordered(m)&&(_=r.Movement.REORDERED)),this.stayedIn.set(m,_)}if(d!==r.Movement.STAYED_IN)for(var P=m.firstChild;P;P=P.nextSibling)this.visitNode(P,d)}}},g.prototype.ensureHasOldPreviousSiblingIfNeeded=function(m){if(this.calcOldPreviousSibling){this.processChildlistChanges();var l=m.parentNode,b=this.treeChanges.get(m);b&&b.oldParentNode&&(l=b.oldParentNode);var d=this.childListChangeMap.get(l);d||(d=new i,this.childListChangeMap.set(l,d)),d.oldPrevious.has(m)||d.oldPrevious.set(m,m.previousSibling)}},g.prototype.getChanged=function(m,l,b){this.selectors=l,this.characterDataOnly=b;for(var d=0;d<this.entered.length;d++){var _=this.entered[d],P=this.matchabilityChange(_);(P===r.Movement.ENTERED||P===r.Movement.STAYED_IN)&&m.added.push(_)}for(var O=this.stayedIn.keys(),d=0;d<O.length;d++){var _=O[d],P=this.matchabilityChange(_);if(P===r.Movement.ENTERED)m.added.push(_);else if(P===r.Movement.EXITED)m.removed.push(_);else if(P===r.Movement.STAYED_IN&&(m.reparented||m.reordered)){var w=this.stayedIn.get(_);m.reparented&&w===r.Movement.REPARENTED?m.reparented.push(_):m.reordered&&w===r.Movement.REORDERED&&m.reordered.push(_)}}for(var d=0;d<this.exited.length;d++){var _=this.exited[d],P=this.matchabilityChange(_);(P===r.Movement.EXITED||P===r.Movement.STAYED_IN)&&m.removed.push(_)}},g.prototype.getOldParentNode=function(m){var l=this.treeChanges.get(m);if(l&&l.childList)return l.oldParentNode?l.oldParentNode:null;var b=this.treeChanges.reachabilityChange(m);if(b===r.Movement.STAYED_OUT||b===r.Movement.ENTERED)throw Error("getOldParentNode requested on invalid node.");return m.parentNode},g.prototype.getOldPreviousSibling=function(m){var l=m.parentNode,b=this.treeChanges.get(m);b&&b.oldParentNode&&(l=b.oldParentNode);var d=this.childListChangeMap.get(l);if(!d)throw Error("getOldPreviousSibling requested on invalid node.");return d.oldPrevious.get(m)},g.prototype.getOldAttribute=function(m,l){var b=this.treeChanges.get(m);if(!b||!b.attributes)throw Error("getOldAttribute requested on invalid node.");var d=b.getAttributeOldValue(l);if(d===void 0)throw Error("getOldAttribute requested for unchanged attribute name.");return d},g.prototype.attributeChangedNodes=function(m){if(!this.treeChanges.anyAttributesChanged)return{};var l,b;if(m){l={},b={};for(var d=0;d<m.length;d++){var _=m[d];l[_]=!0,b[_.toLowerCase()]=_}}for(var P={},O=this.treeChanges.keys(),d=0;d<O.length;d++){var w=O[d],D=this.treeChanges.get(w);if(D.attributes&&!(r.Movement.STAYED_IN!==this.treeChanges.reachabilityChange(w)||r.Movement.STAYED_IN!==this.matchabilityChange(w)))for(var R=w,j=D.getAttributeNamesMutated(),L=0;L<j.length;L++){var _=j[L];l&&!l[_]&&!(D.isCaseInsensitive&&b[_])||D.getAttributeOldValue(_)!==R.getAttribute(_)&&(b&&D.isCaseInsensitive&&(_=b[_]),P[_]=P[_]||[],P[_].push(R))}}return P},g.prototype.getOldCharacterData=function(m){var l=this.treeChanges.get(m);if(!l||!l.characterData)throw Error("getOldCharacterData requested on invalid node.");return l.characterDataOldValue},g.prototype.getCharacterDataChanged=function(){if(!this.treeChanges.anyCharacterDataChanged)return[];for(var m=this.treeChanges.keys(),l=[],b=0;b<m.length;b++){var d=m[b];if(r.Movement.STAYED_IN===this.treeChanges.reachabilityChange(d)){var _=this.treeChanges.get(d);!_.characterData||d.textContent==_.characterDataOldValue||l.push(d)}}return l},g.prototype.computeMatchabilityChange=function(m,l){this.matchCache||(this.matchCache=[]),this.matchCache[m.uid]||(this.matchCache[m.uid]=new n);var b=this.matchCache[m.uid],d=b.get(l);return d===void 0&&(d=m.matchabilityChange(l,this.treeChanges.get(l)),b.set(l,d)),d},g.prototype.matchabilityChange=function(m){var l=this;if(this.characterDataOnly)switch(m.nodeType){case Node.COMMENT_NODE:case Node.TEXT_NODE:return r.Movement.STAYED_IN;default:return r.Movement.STAYED_OUT}if(!this.selectors)return r.Movement.STAYED_IN;if(m.nodeType!==Node.ELEMENT_NODE)return r.Movement.STAYED_OUT;for(var b=m,d=this.selectors.map(function(O){return l.computeMatchabilityChange(O,b)}),_=r.Movement.STAYED_OUT,P=0;_!==r.Movement.STAYED_IN&&P<d.length;){switch(d[P]){case r.Movement.STAYED_IN:_=r.Movement.STAYED_IN;break;case r.Movement.ENTERED:_===r.Movement.EXITED?_=r.Movement.STAYED_IN:_=r.Movement.ENTERED;break;case r.Movement.EXITED:_===r.Movement.ENTERED?_=r.Movement.STAYED_IN:_=r.Movement.EXITED}P++}return _},g.prototype.getChildlistChange=function(m){var l=this.childListChangeMap.get(m);return l||(l=new i,this.childListChangeMap.set(m,l)),l},g.prototype.processChildlistChanges=function(){if(!this.childListChangeMap){this.childListChangeMap=new n;for(var m=function(d){var _=l.mutations[d];if(_.type!="childList"||l.treeChanges.reachabilityChange(_.target)!==r.Movement.STAYED_IN&&!l.calcOldPreviousSibling)return"continue";for(var P=l.getChildlistChange(_.target),O=_.previousSibling,w=function(j,L){!j||P.oldPrevious.has(j)||P.added.has(j)||P.maybeMoved.has(j)||L&&(P.added.has(L)||P.maybeMoved.has(L))||P.oldPrevious.set(j,L)},D=0;D<_.removedNodes.length;D++){var R=_.removedNodes[D];w(R,O),P.added.has(R)?P.added.delete(R):(P.removed.set(R,!0),P.maybeMoved.delete(R)),O=R}w(_.nextSibling,O);for(var D=0;D<_.addedNodes.length;D++){var R=_.addedNodes[D];P.removed.has(R)?(P.removed.delete(R),P.maybeMoved.set(R,!0)):P.added.set(R,!0)}},l=this,b=0;b<this.mutations.length;b++)m(b)}},g.prototype.wasReordered=function(m){if(!this.treeChanges.anyParentsChanged)return!1;this.processChildlistChanges();var l=m.parentNode,b=this.treeChanges.get(m);b&&b.oldParentNode&&(l=b.oldParentNode);var d=this.childListChangeMap.get(l);if(!d)return!1;if(d.moved)return d.moved.get(m);d.moved=new n;var _=new n;function P(j){if(!j||!d.maybeMoved.has(j))return!1;var L=d.moved.get(j);return L!==void 0||(_.has(j)?L=!0:(_.set(j,!0),L=R(j)!==w(j)),_.has(j)?(_.delete(j),d.moved.set(j,L)):L=d.moved.get(j)),L}var O=new n;function w(j){var L=O.get(j);if(L!==void 0)return L;for(L=d.oldPrevious.get(j);L&&(d.removed.has(L)||P(L));)L=w(L);return L===void 0&&(L=j.previousSibling),O.set(j,L),L}var D=new n;function R(j){if(D.has(j))return D.get(j);for(var L=j.previousSibling;L&&(d.added.has(L)||P(L));)L=L.previousSibling;return D.set(j,L),L}return d.maybeMoved.keys().forEach(P),d.moved.get(m)},g})(),h=(function(){function g(m,l){var b=this;if(this.projection=m,this.added=[],this.removed=[],this.reparented=l.all||l.element||l.characterData?[]:void 0,this.reordered=l.all?[]:void 0,m.getChanged(this,l.elementFilter,l.characterData),l.all||l.attribute||l.attributeList){var d=l.attribute?[l.attribute]:l.attributeList,_=m.attributeChangedNodes(d);l.attribute?this.valueChanged=_[l.attribute]||[]:(this.attributeChanged=_,l.attributeList&&l.attributeList.forEach(function(O){b.attributeChanged.hasOwnProperty(O)||(b.attributeChanged[O]=[])}))}if(l.all||l.characterData){var P=m.getCharacterDataChanged();l.characterData?this.valueChanged=P:this.characterDataChanged=P}this.reordered&&(this.getOldPreviousSibling=m.getOldPreviousSibling.bind(m))}return g.prototype.getOldParentNode=function(m){return this.projection.getOldParentNode(m)},g.prototype.getOldAttribute=function(m,l){return this.projection.getOldAttribute(m,l)},g.prototype.getOldCharacterData=function(m){return this.projection.getOldCharacterData(m)},g.prototype.getOldPreviousSibling=function(m){return this.projection.getOldPreviousSibling(m)},g})(),f=(function(){function g(){}return g.prototype.matches=function(m){if(m===null)return!1;if(this.attrValue===void 0)return!0;if(!this.contains)return this.attrValue==m;for(var l=m.split(" "),b=0;b<l.length;b++)if(this.attrValue===l[b])return!0;return!1},g.prototype.toString=function(){return this.attrName==="class"&&this.contains?"."+this.attrValue:this.attrName==="id"&&!this.contains?"#"+this.attrValue:this.contains?"["+this.attrName+"~="+y(this.attrValue)+"]":"attrValue"in this?"["+this.attrName+"="+y(this.attrValue)+"]":"["+this.attrName+"]"},g})();function y(g){return'"'+g.replace(/"/,'\\"')+'"'}var E=/[a-zA-Z_]+/,S=/[a-zA-Z0-9_\-]+/,v=(function(){function g(){this.uid=g.nextUid++,this.qualifiers=[]}return Object.defineProperty(g.prototype,"caseInsensitiveTagName",{get:function(){return this.tagName.toUpperCase()},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"selectorString",{get:function(){return this.tagName+this.qualifiers.join("")},enumerable:!1,configurable:!0}),g.prototype.isMatching=function(m){return m[g.matchesSelector](this.selectorString)},g.prototype.wasMatching=function(m,l,b){if(!l||!l.attributes)return b;var d=l.isCaseInsensitive?this.caseInsensitiveTagName:this.tagName;if(d!=="*"&&d!==m.tagName)return!1;for(var _=[],P=!1,O=0;O<this.qualifiers.length;O++){var w=this.qualifiers[O],D=l.getAttributeOldValue(w.attrName);_.push(D),P=P||D!==void 0}if(!P)return b;for(var O=0;O<this.qualifiers.length;O++){var w=this.qualifiers[O],D=_[O];if(D===void 0&&(D=m.getAttribute(w.attrName)),!w.matches(D))return!1}return!0},g.prototype.matchabilityChange=function(m,l){var b=this.isMatching(m);return b?this.wasMatching(m,l,b)?r.Movement.STAYED_IN:r.Movement.ENTERED:this.wasMatching(m,l,b)?r.Movement.EXITED:r.Movement.STAYED_OUT},g.parseSelectors=function(m){var l=[],b,d;function _(){b&&(d&&(b.qualifiers.push(d),d=void 0),l.push(b)),b=new g}function P(){d&&b.qualifiers.push(d),d=new f}for(var O=/\s/,w=void 0,D="Invalid or unsupported selector syntax.",R=1,j=2,L=3,F=4,U=5,B=6,x=7,z=8,X=9,J=10,Q=11,ee=12,Y=13,H=14,$=R,W=0;W<m.length;){var k=m[W++];switch($){case R:if(k.match(E)){_(),b.tagName=k,$=j;break}if(k=="*"){_(),b.tagName="*",$=L;break}if(k=="."){_(),P(),b.tagName="*",d.attrName="class",d.contains=!0,$=F;break}if(k=="#"){_(),P(),b.tagName="*",d.attrName="id",$=F;break}if(k=="["){_(),P(),b.tagName="*",d.attrName="",$=B;break}if(k.match(O))break;throw Error(D);case j:if(k.match(S)){b.tagName+=k;break}if(k=="."){P(),d.attrName="class",d.contains=!0,$=F;break}if(k=="#"){P(),d.attrName="id",$=F;break}if(k=="["){P(),d.attrName="",$=B;break}if(k.match(O)){$=H;break}if(k==","){$=R;break}throw Error(D);case L:if(k=="."){P(),d.attrName="class",d.contains=!0,$=F;break}if(k=="#"){P(),d.attrName="id",$=F;break}if(k=="["){P(),d.attrName="",$=B;break}if(k.match(O)){$=H;break}if(k==","){$=R;break}throw Error(D);case F:if(k.match(E)){d.attrValue=k,$=U;break}throw Error(D);case U:if(k.match(S)){d.attrValue+=k;break}if(k=="."){P(),d.attrName="class",d.contains=!0,$=F;break}if(k=="#"){P(),d.attrName="id",$=F;break}if(k=="["){P(),$=B;break}if(k.match(O)){$=H;break}if(k==","){$=R;break}throw Error(D);case B:if(k.match(E)){d.attrName=k,$=x;break}if(k.match(O))break;throw Error(D);case x:if(k.match(S)){d.attrName+=k;break}if(k.match(O)){$=z;break}if(k=="~"){d.contains=!0,$=X;break}if(k=="="){d.attrValue="",$=Q;break}if(k=="]"){$=L;break}throw Error(D);case z:if(k=="~"){d.contains=!0,$=X;break}if(k=="="){d.attrValue="",$=Q;break}if(k=="]"){$=L;break}if(k.match(O))break;throw Error(D);case X:if(k=="="){d.attrValue="",$=Q;break}throw Error(D);case J:if(k=="]"){$=L;break}if(k.match(O))break;throw Error(D);case Q:if(k.match(O))break;if(k=='"'||k=="'"){w=k,$=Y;break}d.attrValue+=k,$=ee;break;case ee:if(k.match(O)){$=J;break}if(k=="]"){$=L;break}if(k=="'"||k=='"')throw Error(D);d.attrValue+=k;break;case Y:if(k==w){$=J;break}d.attrValue+=k;break;case H:if(k.match(O))break;if(k==","){$=R;break}throw Error(D)}}switch($){case R:case j:case L:case U:case H:_();break;default:throw Error(D)}if(!l.length)throw Error(D);return l},g.nextUid=1,g.matchesSelector="matches",g})(),C=(function(){function g(){}return g.createObserverOptions=function(m){var l={childList:!0,subtree:!0},b;function d(_){if(!(l.attributes&&!b)){if(l.attributes=!0,l.attributeOldValue=!0,!_){b=void 0;return}b=b||{},_.forEach(function(P){b[P]=!0,b[P.toLowerCase()]=!0})}}return m.forEach(function(_){if(_.characterData){l.characterData=!0,l.characterDataOldValue=!0;return}if(_.all){d(),l.characterData=!0,l.characterDataOldValue=!0;return}if(_.attribute){d([_.attribute.trim()]);return}var P=g._elementFilterAttributes(_.elementFilter).concat(_.attributeList||[]);P.length&&d(P)}),b&&(l.attributeFilter=Object.keys(b)),l},g.validateOptions=function(m){for(var l in m)if(!(l in g._optionKeys))throw Error("Invalid option: "+l);if(typeof m.callback!="function")throw Error("Invalid options: callback is required and must be a function");if(!m.queries||!m.queries.length)throw Error("Invalid options: queries must contain at least one query request object.");for(var b={callback:m.callback,rootNode:m.rootNode||document,observeOwnChanges:!!m.observeOwnChanges,oldPreviousSibling:!!m.oldPreviousSibling,queries:[]},d=0;d<m.queries.length;d++){var _=m.queries[d];if(_.all){if(Object.keys(_).length>1)throw Error("Invalid request option. all has no options.");b.queries.push({all:!0});continue}if("attribute"in _){var P={attribute:g._validateAttribute(_.attribute)};if(P.elementFilter=v.parseSelectors("*["+P.attribute+"]"),Object.keys(_).length>1)throw Error("Invalid request option. attribute has no options.");b.queries.push(P);continue}if("element"in _){var O=Object.keys(_).length,P={element:_.element,elementFilter:v.parseSelectors(_.element)};if(_.hasOwnProperty("elementAttributes")&&(P.attributeList=g._validateElementAttributes(_.elementAttributes),O--),O>1)throw Error("Invalid request option. element only allows elementAttributes option.");b.queries.push(P);continue}if(_.characterData){if(Object.keys(_).length>1)throw Error("Invalid request option. characterData has no options.");b.queries.push({characterData:!0});continue}throw Error("Invalid request option. Unknown query request.")}return b},g._validateElementAttributes=function(m){if(!m.trim().length)throw Error("Invalid request option: elementAttributes must contain at least one attribute.");for(var l={},b={},d=m.split(/\s+/),_=0;_<d.length;_++){var P=d[_];if(P){P=g._validateAttribute(P);var O=P.toLowerCase();if(l[O])throw Error("Invalid request option: observing multiple case variations of the same attribute is not supported.");b[P]=!0,l[O]=!0}}return Object.keys(b)},g._elementFilterAttributes=function(m){var l={};return m.forEach(function(b){b.qualifiers.forEach(function(d){l[d.attrName]=!0})}),Object.keys(l)},g._validateAttribute=function(m){if(typeof m!="string"||(m=m.trim(),!m))throw Error("Invalid request option. attribute must be a non-zero length string.");if(!m.match(g._attributeFilterPattern))throw Error("Invalid request option. invalid attribute name: "+m);return m},g._attributeFilterPattern=/^([a-zA-Z:_]+[a-zA-Z0-9_\-:.]*)$/,g._optionKeys={callback:!0,queries:!0,rootNode:!0,oldPreviousSibling:!0,observeOwnChanges:!0},g})(),A=(function(){function g(m){var l=this;this._connected=!1,this._options=C.validateOptions(m),this._observerOptions=C.createObserverOptions(this._options.queries),this._root=this._options.rootNode,this._callback=this._options.callback,this._elementFilter=Array.prototype.concat.apply([],this._options.queries.map(function(b){return b.elementFilter?b.elementFilter:[]})),this._elementFilter.length||(this._elementFilter=void 0),this._calcReordered=this._options.queries.some(function(b){return b.all}),this._queryValidators=[],g.createQueryValidator&&(this._queryValidators=this._options.queries.map(function(b){return g.createQueryValidator(l._root,b)})),this._observer=new MutationObserver(function(b){l._observerCallback(b)}),this.reconnect()}return g.prototype.reconnect=function(){if(this._connected)throw Error("Already connected");this._observer.observe(this._root,this._observerOptions),this._connected=!0,this._checkpointQueryValidators()},g.prototype.takeSummaries=function(){if(!this._connected)throw Error("Not connected");var m=this._createSummaries(this._observer.takeRecords());return this._changesToReport(m)?m:void 0},g.prototype.disconnect=function(){var m=this.takeSummaries();return this._observer.disconnect(),this._connected=!1,m},g.prototype._observerCallback=function(m){this._options.observeOwnChanges||this._observer.disconnect();var l=this._createSummaries(m);this._runQueryValidators(l),this._options.observeOwnChanges&&this._checkpointQueryValidators(),this._changesToReport(l)&&this._callback(l),!this._options.observeOwnChanges&&this._connected&&(this._checkpointQueryValidators(),this._observer.observe(this._root,this._observerOptions))},g.prototype._createSummaries=function(m){if(!m||!m.length)return[];for(var l=new u(this._root,m,this._elementFilter,this._calcReordered,this._options.oldPreviousSibling),b=[],d=0;d<this._options.queries.length;d++)b.push(new h(l,this._options.queries[d]));return b},g.prototype._checkpointQueryValidators=function(){this._queryValidators.forEach(function(m){m&&m.recordPreviousState()})},g.prototype._runQueryValidators=function(m){this._queryValidators.forEach(function(l,b){l&&l.validate(m[b])})},g.prototype._changesToReport=function(m){return m.some(function(l){return!!(["added","removed","reordered","reparented","valueChanged","characterDataChanged"].some(function(b){return l[b]&&l[b].length})||l.attributeChanged&&Object.keys(l.attributeChanged).some(function(b){return!!l.attributeChanged[b].length}))})},g})(),I=(function(){function g(m,l){this.root=m,this.delegate=l,this.idMap={}}return g.prototype.initialize=function(m,l){this.idMap[m]=this.root;for(var b=0;b<l.length;b++)this.deserializeNode(l[b],this.root)},g.prototype.applyChanged=function(m,l,b,d){var _=this;l.forEach(function(P){var O=_.deserializeNode(P);_.deserializeNode(P.parentNode),_.deserializeNode(P.previousSibling),O.parentNode&&O.parentNode.removeChild(O)}),m.forEach(function(P){var O=_.deserializeNode(P);O.parentNode&&O.parentNode.removeChild(O)}),l.forEach(function(P){var O=_.deserializeNode(P),w=_.deserializeNode(P.parentNode),D=_.deserializeNode(P.previousSibling);w.insertBefore(O,D?D.nextSibling:w.firstChild)}),b.forEach(function(P){var O=_.deserializeNode(P);Object.keys(P.attributes).forEach(function(w){var D=P.attributes[w];D===null?O.removeAttribute(w):(!_.delegate||!_.delegate.setAttribute||!_.delegate.setAttribute(O,w,D))&&O.setAttribute(w,D)})}),d.forEach(function(P){var O=_.deserializeNode(P);O.textContent=P.textContent}),m.forEach(function(P){delete _.idMap[P.id]})},g.prototype.deserializeNode=function(m,l){var b=this;if(m===null)return null;var d=this.idMap[m.id];if(d)return d;var _=this.root.ownerDocument;switch(_===null&&(_=this.root),m.nodeType){case Node.COMMENT_NODE:d=_.createComment(m.textContent);break;case Node.TEXT_NODE:d=_.createTextNode(m.textContent);break;case Node.DOCUMENT_TYPE_NODE:d=_.implementation.createDocumentType(m.name,m.publicId,m.systemId);break;case Node.ELEMENT_NODE:this.delegate&&this.delegate.createElement&&(d=this.delegate.createElement(m.tagName)),d||(d=_.createElement(m.tagName)),Object.keys(m.attributes).forEach(function(O){(!b.delegate||!b.delegate.setAttribute||!b.delegate.setAttribute(d,O,m.attributes[O]))&&d.setAttribute(O,m.attributes[O])});break;default:throw"Unsupported node type: "+m.nodeType}if(this.idMap[m.id]=d,l&&l.appendChild(d),m.childNodes)for(var P=0;P<m.childNodes.length;P++)this.deserializeNode(m.childNodes[P],d);return d},g})(),T=(function(){function g(m,l,b){var d=this;this.target=m,this.mirror=l,this.nextId=1,this.knownNodes=new n;for(var _=this.serializeNode(m).id,P=[],O=m.firstChild;O;O=O.nextSibling)P.push(this.serializeNode(O,!0));this.mirror.initialize(_,P);var w=[{all:!0}];b&&(w=w.concat(b)),this.mutationSummary=new A({rootNode:m,callback:function(D){d.applyChanged(D)},queries:w})}return g.prototype.disconnect=function(){this.mutationSummary&&(this.mutationSummary.disconnect(),this.mutationSummary=void 0)},g.prototype.rememberNode=function(m){var l=this.nextId++;return this.knownNodes.set(m,l),l},g.prototype.forgetNode=function(m){this.knownNodes.delete(m)},g.prototype.serializeNode=function(m,l){if(m===null)return null;var b=this.knownNodes.get(m);if(b!==void 0)return{id:b};var d={nodeType:m.nodeType,id:this.rememberNode(m)};switch(d.nodeType){case Node.DOCUMENT_TYPE_NODE:var _=m;d.name=_.name,d.publicId=_.publicId,d.systemId=_.systemId;break;case Node.COMMENT_NODE:case Node.TEXT_NODE:d.textContent=m.textContent;break;case Node.ELEMENT_NODE:var P=m;d.tagName=P.tagName,d.attributes={};for(var O=0;O<P.attributes.length;O++){var w=P.attributes[O];d.attributes[w.name]=w.value}if(l&&P.childNodes.length){d.childNodes=[];for(var D=P.firstChild;D;D=D.nextSibling)d.childNodes.push(this.serializeNode(D,!0))}}return d},g.prototype.serializeAddedAndMoved=function(m,l,b){var d=this,_=m.concat(l).concat(b),P=new n;_.forEach(function(w){var D=w.parentNode,R=P.get(D);R||(R=new n,P.set(D,R)),R.set(w,!0)});var O=[];return P.keys().forEach(function(w){for(var D=P.get(w),R=D.keys();R.length;){for(var j=R[0];j.previousSibling&&D.has(j.previousSibling);)j=j.previousSibling;for(;j&&D.has(j);){var L=d.serializeNode(j);L.previousSibling=d.serializeNode(j.previousSibling),L.parentNode=d.serializeNode(j.parentNode),O.push(L),D.delete(j),j=j.nextSibling}R=D.keys()}}),O},g.prototype.serializeAttributeChanges=function(m){var l=this,b=new n;return Object.keys(m).forEach(function(d){m[d].forEach(function(_){var P=b.get(_);P||(P=l.serializeNode(_),P.attributes={},b.set(_,P)),P.attributes[d]=_.getAttribute(d)})}),b.keys().map(function(d){return b.get(d)})},g.prototype.applyChanged=function(m){var l=this,b=m[0],d=b.removed.map(function(w){return l.serializeNode(w)}),_=this.serializeAddedAndMoved(b.added,b.reparented,b.reordered),P=this.serializeAttributeChanges(b.attributeChanged),O=b.characterDataChanged.map(function(w){var D=l.serializeNode(w);return D.textContent=w.textContent,D});this.mirror.applyChanged(d,_,P,O),b.removed.forEach(function(w){l.forgetNode(w)})},g})();if(MutationObserver===void 0)throw Error("DOM Mutation Observers are required");r.ChildListChange=i,r.MutationProjection=u,r.MutationSummary=A,r.NodeChange=s,r.NodeMap=n,r.Qualifier=f,r.Selector=v,r.Summary=h,r.TreeChanges=c,r.TreeMirror=I,r.TreeMirrorClient=T,Object.defineProperty(r,"__esModule",{value:!0})}))})),uw=sw(),Bt=0,$t=new Array(1e3);function cw(){for(let e=0;e<Bt;e+=2){const t=$t[e],r=$t[e+1];t(...r),$t[e]=void 0,$t[e+1]=void 0}Bt=0}function lw(e,...t){$t[Bt]=e,$t[Bt+1]=t,Bt+=2,Bt===2&&fw()}function dw(){let e=0;const t=new MutationObserver(cw),r=document.createTextNode("");return t.observe(r,{characterData:!0}),()=>{r.data=String(e=++e%2)}}var fw=dw();function Zf(){lw(()=>{La.hasListeners()&&(La.fire(),Zf())})}var La=new M.Emitter({onFirstListenerAdd:Zf}),ka=La.once,pw=class extends M.Emitter{_mutationSummary;constructor(e={}){super(),this._mutationSummary=new uw.MutationSummary({...e,observeOwnChanges:!0,callback:t=>this.fire(t),queries:[{all:!0}]})}dispose(){this._mutationSummary.disconnect(),super.dispose()}trigger(e){const t=this._mutationSummary.takeSummaries();return(e||t?.length)&&this.fire(t||[]),t}},mw=class extends M.Disposable{_mutationEmitter;_innerEmitter=this.addDisposable(new M.Emitter({onFirstListenerAdd:()=>{this._nextTickHandler()}}));_lostEmitter=this.addDisposable(new M.Emitter);_paused=0;_stopped=0;_summaries=[];_nextTickHandler(){ka(()=>{this.trigger(),this._summaries.length&&(this._innerEmitter.hasListeners()?this._innerEmitter.fire(this._summaries):this._lostEmitter.fire(this._summaries),this._summaries=[])},Number.MAX_VALUE)}constructor(e={}){super(),this._mutationEmitter=this.addDisposable(new pw(e)),this.onNativeMutate=this._mutationEmitter.event,this.addDisposable(this._mutationEmitter.event(t=>{this._stopped||(this._paused?this._lostEmitter.fire(t):(this._summaries.push(...t),ka(()=>{this._summaries.length&&!this._innerEmitter.hasListeners()&&(this._lostEmitter.fire(this._summaries),this._summaries=[])},Number.MAX_VALUE)))}))}get isStoped(){return this._paused>0||this._stopped>0}stop(){this._mutationEmitter.trigger(),this._stopped++}start(){this._mutationEmitter.trigger(),this._stopped--}pause(){this._mutationEmitter.trigger(),this._paused++}resume(){this._mutationEmitter.trigger(),this._paused--}trigger(){this._mutationEmitter.trigger(!0)}onMutate=this._innerEmitter.event;onLost=this._lostEmitter.event;onNativeMutate};function hw(e){for(const t of e){if(t.removed)for(const r of t.removed){const n=t.getOldParentNode(r),i=t.getOldPreviousSibling(r);if(n){const o=i?.nextSibling??null;n.insertBefore(r,o)}}if(t.added)for(const r of t.added)r.parentNode&&r.parentNode.removeChild(r);if(t.reordered)for(const r of t.reordered){const n=t.getOldParentNode(r),i=t.getOldPreviousSibling(r);if(n){const o=i?.nextSibling??null;n.insertBefore(r,o)}}if(t.attributeChanged)for(const r of Object.keys(t.attributeChanged))for(const n of t.attributeChanged[r]){const i=t.getOldAttribute(n,r);i==null?n.removeAttribute(r):n.setAttribute(r,i)}if(t.characterDataChanged)for(const r of t.characterDataChanged)(Pi(r)||Ei(r)||Ei(r))&&(r.data=t.getOldCharacterData(r))}}var gw=class extends M.Disposable{_commitPromise;_mutationCollector;_onLostSummaries=e=>{try{this._mutationCollector.stop(),hw(e)}finally{this._mutationCollector.start()}};constructor(e){super(),this._mutationCollector=this.addDisposable(new mw({rootNode:e,oldPreviousSibling:!0})),this._mutationCollector.onLost(this._onLostSummaries)}commit(){if(this._commitPromise)return this._commitPromise;{const e=()=>new Promise(t=>{const r=this._mutationCollector.onMutate(n=>{this._commitPromise=void 0,t(),r.dispose()});ka(()=>{this._commitPromise=void 0,t(),r.dispose()})});return this._commitPromise=e().catch(t=>{})}}};function bw(e,t){const r=o=>{const a={contentDocument:o,html:Ht(o)};return a.html=Jf(a.html).html,a},n=new M.AsyncEmitter,i=new M.AsyncEmitter;try{const o=Vf(e),a=document.implementation.createHTMLDocument();return as(a,o),{document:a,handleRender:i.event,handleReadHtml:n.event,async run(){if(i.hasListeners()){const s=document.createElement("iframe");s.style.position="absolute",s.style.left="-10000px",document.body.appendChild(s);const c=s.contentWindow.document,u=new gw(s.contentDocument);let h;try{if(t){const[f,y]=t;f!==void 0&&s.setAttribute("width",String(f)),y!==void 0&&s.setAttribute("height",String(y))}as(c,[...a.childNodes]),u.commit()}catch(f){throw f}finally{try{try{await i.fire({managedNodeController:u,contentDocument:c})}catch{}const f=r(c);await n.fire(f),h=f.html}finally{s.parentNode===document.body&&document.body.removeChild(s)}}return h}else{const s=r(a);return await n.fire(s),s.html}}}}catch(o){throw o}}var yw=3,vw=/^(.+\.[a-zA-Z0-9]{1,8})\?[^?#]*$/;function _w(e){let t=e;for(let r=0;r<yw;r++)try{const n=decodeURIComponent(t);if(n===t)break;t=n}catch{break}return t.normalize("NFC")}function Ew(e){const t=e.match(vw);return t?t[1]:e}function Sw(e){if(/^https?:\/\//i.test(e))return new URL(e).pathname.split("/").filter(Boolean).pop();if(e.startsWith("//"))return new URL(e,"https://placeholder.invalid").pathname.split("/").filter(Boolean).pop()}function ep(e){const t=e.replaceAll("\\","/").trim();if(!t)return t;let r;try{r=Sw(t)}catch{}if(!r){r=Ew(t.split("/").pop()??"");const n=r.indexOf("#");n>=0&&(r=r.slice(0,n))}return _w(r)}function Pw(e){const t=e.trim();if(t){if(!(/^https?:\/\//i.test(t)||t.startsWith("//")))try{new URL(t)}catch{return}return ep(t)||void 0}}function Ow(e,t){const r=document.createElement("input");r.type="file",r.accept=e,r.multiple=!1,r.setAttribute("data-testid","uploadFile"),r.style.position="absolute",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r),r.onchange=()=>{r.files?.length&&t(r.files),document.body.removeChild(r)},r.click()}var tp=()=>(0,et.__vitePreload)(()=>Promise.resolve().then(()=>fe("./181088a9.js")),void 0,{}.url);async function Tw(e,t){if(t==="amp")e.handleRender(async({contentDocument:r,managedNodeController:n})=>{for(const o of r.querySelectorAll(".em-amp-show-disabled"))o.remove();const{html2amp:i}=await tp();await i(r,{mappedTags:{script:"___script"},commit:()=>n.commit()})});else if(t==="html"){const r=e.document;for(const i of r.querySelectorAll(".em-amp-show-only"))i.remove();const{amp2html:n}=await tp();n(r,{mappedTags:{script:"___script"}})}}function Cw(e,t){e?.mutate({content:ho(t)},{source:"remote"})}function Aw(e,t,r,{undoable:n}){if(!e)return;const i=e.getContent(),o=ho(r);i!==o&&(e.mutate({changes:[new Me(0,i,0,o)]},{source:"user"}),n||t?.clear())}function Iw(){const{document:e,history:t}=jr();return(0,N.useCallback)((r,n)=>Aw(e,t,r,n),[e,t])}function Fa(e,t){return Fa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Fa(e,t)}function rp(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Fa(e,t)}function ww(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function Mw(e,t){e.classList?e.classList.add(t):ww(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function np(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function Rw(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=np(e.className,t):e.setAttribute("class",np(e.className&&e.className.baseVal||"",t))}var ip={disabled:!1},op=N.default.createContext(null),ap=function(t){return t.scrollTop},Ua="unmounted",Gt="exited",mi="entering",hi="entered",Ba="exiting",Ye=(function(e){rp(t,e);function t(n,i){var o=e.call(this,n,i)||this,a=i,s=a&&!a.isMounting?n.enter:n.appear,c;return o.appearStatus=null,n.in?s?(c=Gt,o.appearStatus=mi):c=hi:n.unmountOnExit||n.mountOnEnter?c=Ua:c=Gt,o.state={status:c},o.nextCallback=null,o}t.getDerivedStateFromProps=function(i,o){return i.in&&o.status==="unmounted"?{status:Gt}:null};var r=t.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(i){var o=null;if(i!==this.props){var a=this.state.status;this.props.in?a!=="entering"&&a!=="entered"&&(o=mi):(a==="entering"||a==="entered")&&(o=Ba)}this.updateStatus(!1,o)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var i=this.props.timeout,o=a=s=i,a,s;return i!=null&&typeof i!="number"&&(o=i.exit,a=i.enter,s=i.appear!==void 0?i.appear:a),{exit:o,enter:a,appear:s}},r.updateStatus=function(i,o){if(i===void 0&&(i=!1),o!==null)if(this.cancelNextCallback(),o==="entering"){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:Ze.default.findDOMNode(this);a&&ap(a)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status==="exited"&&this.setState({status:Ua})},r.performEnter=function(i){var o=this,a=this.props.enter,s=this.context?this.context.isMounting:i,c=this.props.nodeRef?[s]:[Ze.default.findDOMNode(this),s],u=c[0],h=c[1],f=this.getTimeouts(),y=s?f.appear:f.enter;if(!i&&!a||ip.disabled){this.safeSetState({status:hi},function(){o.props.onEntered(u)});return}this.props.onEnter(u,h),this.safeSetState({status:mi},function(){o.props.onEntering(u,h),o.onTransitionEnd(y,function(){o.safeSetState({status:hi},function(){o.props.onEntered(u,h)})})})},r.performExit=function(){var i=this,o=this.props.exit,a=this.getTimeouts(),s=this.props.nodeRef?void 0:Ze.default.findDOMNode(this);if(!o||ip.disabled){this.safeSetState({status:Gt},function(){i.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:Ba},function(){i.props.onExiting(s),i.onTransitionEnd(a.exit,function(){i.safeSetState({status:Gt},function(){i.props.onExited(s)})})})},r.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(i,o){o=this.setNextCallback(o),this.setState(i,o)},r.setNextCallback=function(i){var o=this,a=!0;return this.nextCallback=function(s){a&&(a=!1,o.nextCallback=null,i(s))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},r.onTransitionEnd=function(i,o){this.setNextCallback(o);var a=this.props.nodeRef?this.props.nodeRef.current:Ze.default.findDOMNode(this),s=i==null&&!this.props.addEndListener;if(!a||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var c=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],u=c[0],h=c[1];this.props.addEndListener(u,h)}i!=null&&setTimeout(this.nextCallback,i)},r.render=function(){var i=this.state.status;if(i==="unmounted")return null;var o=this.props,a=o.children;o.in,o.mountOnEnter,o.unmountOnExit,o.appear,o.enter,o.exit,o.timeout,o.addEndListener,o.onEnter,o.onEntering,o.onEntered,o.onExit,o.onExiting,o.onExited,o.nodeRef;var s=fs(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return N.default.createElement(op.Provider,{value:null},typeof a=="function"?a(i,s):N.default.cloneElement(N.default.Children.only(a),s))},t})(N.default.Component);Ye.contextType=op,Ye.propTypes={};function qt(){}Ye.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:qt,onEntering:qt,onEntered:qt,onExit:qt,onExiting:qt,onExited:qt},Ye.UNMOUNTED=Ua,Ye.EXITED=Gt,Ye.ENTERING=mi,Ye.ENTERED=hi,Ye.EXITING=Ba;var Dw=function(t,r){return t&&r&&r.split(" ").forEach(function(n){return Mw(t,n)})},$a=function(t,r){return t&&r&&r.split(" ").forEach(function(n){return Rw(t,n)})},Ga=(function(e){rp(t,e);function t(){for(var n,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return n=e.call.apply(e,[this].concat(o))||this,n.appliedClasses={appear:{},enter:{},exit:{}},n.onEnter=function(s,c){var u=n.resolveArguments(s,c),h=u[0],f=u[1];n.removeClasses(h,"exit"),n.addClass(h,f?"appear":"enter","base"),n.props.onEnter&&n.props.onEnter(s,c)},n.onEntering=function(s,c){var u=n.resolveArguments(s,c),h=u[0],f=u[1]?"appear":"enter";n.addClass(h,f,"active"),n.props.onEntering&&n.props.onEntering(s,c)},n.onEntered=function(s,c){var u=n.resolveArguments(s,c),h=u[0],f=u[1]?"appear":"enter";n.removeClasses(h,f),n.addClass(h,f,"done"),n.props.onEntered&&n.props.onEntered(s,c)},n.onExit=function(s){var c=n.resolveArguments(s)[0];n.removeClasses(c,"appear"),n.removeClasses(c,"enter"),n.addClass(c,"exit","base"),n.props.onExit&&n.props.onExit(s)},n.onExiting=function(s){var c=n.resolveArguments(s)[0];n.addClass(c,"exit","active"),n.props.onExiting&&n.props.onExiting(s)},n.onExited=function(s){var c=n.resolveArguments(s)[0];n.removeClasses(c,"exit"),n.addClass(c,"exit","done"),n.props.onExited&&n.props.onExited(s)},n.resolveArguments=function(s,c){return n.props.nodeRef?[n.props.nodeRef.current,s]:[s,c]},n.getClassNames=function(s){var c=n.props.classNames,u=typeof c=="string",h=u&&c?c+"-":"",f=u?""+h+s:c[s];return{baseClassName:f,activeClassName:u?f+"-active":c[s+"Active"],doneClassName:u?f+"-done":c[s+"Done"]}},n}var r=t.prototype;return r.addClass=function(i,o,a){var s=this.getClassNames(o)[a+"ClassName"],c=this.getClassNames("enter").doneClassName;o==="appear"&&a==="done"&&c&&(s+=" "+c),a==="active"&&i&&ap(i),s&&(this.appliedClasses[o][a]=s,Dw(i,s))},r.removeClasses=function(i,o){var a=this.appliedClasses[o],s=a.base,c=a.active,u=a.done;this.appliedClasses[o]={},s&&$a(i,s),c&&$a(i,c),u&&$a(i,u)},r.render=function(){var i=this.props;i.classNames;var o=fs(i,["classNames"]);return N.default.createElement(Ye,Ai({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t})(N.default.Component);Ga.defaultProps={classNames:""},Ga.propTypes={};function sp(){const e=pe(),t=Oo(M.getContainer(e)),r=(0,N.useCallback)(n=>t.subscribe(n),[t]);return{document:(0,N.useSyncExternalStore)(r,()=>t.current()),show:(0,N.useSyncExternalStore)(r,()=>t.showFacts()),error:(0,N.useSyncExternalStore)(r,()=>t.openError())}}function Nw(e){return String(e).replace(/"/g,""")}function up(e=new Date){const t=r=>String(r).padStart(2,"0");return String(e.getFullYear())+t(e.getMonth()+1)+t(e.getDate())+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}function jw(e){if(!e||!/^\d{12}(\d{2})?$/.test(e))return null;const t=Number(e.slice(0,4)),r=Number(e.slice(4,6))-1,n=Number(e.slice(6,8)),i=Number(e.slice(8,10)),o=Number(e.slice(10,12)),a=e.length>=14?Number(e.slice(12,14)):0,s=new Date(t,r,n,i,o,a);return Number.isNaN(s.getTime())?null:s}function cp(e){const t=/<(table|tr|div)(\s[^>]*)>/gi;let r;for(;(r=t.exec(e))!==null;){const n=r[2]??"";if(/\bem\s*=\s*["']block["']/i.test(n))return{full:r[0],index:r.index}}return null}function lp(e,t,r){const n=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),i=Nw(r);return n.test(e)?e.replace(n,`${t}="${i}"`):e.replace(/>$/,` ${t}="${i}">`)}function dp(e,t){const r=new RegExp(`\\b${t}\\s*=\\s*["']([^"']*)["']`,"i").exec(e);return r?r[1]:void 0}function Lw(e){if(!e?.trim())return{};const t=cp(e);return t?{emBlockId:dp(t.full,"em-block-id"),emBlockVersion:dp(t.full,"em-block-version")}:{}}function kw(e,t,r){if(!e?.trim()||!t)return e;const n=cp(e);if(!n)return e;const i=String(t),o=up(r??new Date);let{full:a,index:s}=n;const c=a.length;return/\bem-block-id\s*=/.test(a)||(a=lp(a,"em-block-id",i)),a=lp(a,"em-block-version",o),e.slice(0,s)+a+e.slice(s+c)}function Fw(e){return{projectId:e,pageSize:1e3,page:1,tags:null,name:null,type:null,notEmbed:!0,order:"asc",orderby:"title"}}function Uw(e){return e===null?null:e===void 0||e===""||e===0||e==="0"?au:e}function Bw(e){return{emailId:e,pageSize:1e3,page:1,projectId:Jg,notEmbed:!0,name:null,type:null}}function $w(){return{pageSize:1e3,page:1,notEmbed:!0,name:null,type:null}}var Gw=`
|
|
60
|
+
`));return{html:ow(t.html),hasBrowserExtensionArtifacts:t.found}}var sw=Z.__commonJSMin(((e,t)=>{(function(r,n){typeof e=="object"&&typeof t<"u"?n(e):typeof define=="function"&&define.amd?define(["exports"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.MutationSummary={}))})(e,(function(r){"use strict";var n=(function(){function g(){this._nodes=[],this._values=[]}return g._isIndex=function(m){return+m===m>>>0},g._nodeId=function(m){var l=m[g._ID_PROP];return l||(l=m[g._ID_PROP]=g._NEXT_ID++),l},g.prototype.set=function(m,l){var b=g._nodeId(m);this._nodes[b]=m,this._values[b]=l},g.prototype.get=function(m){var l=g._nodeId(m);return l!==void 0?this._values[l]:void 0},g.prototype.has=function(m){return g._nodeId(m)in this._nodes},g.prototype.delete=function(m){var l=g._nodeId(m);delete this._nodes[l],this._values[l]=void 0},g.prototype.keys=function(){var m=[];for(var l in this._nodes)g._isIndex(l)&&m.push(this._nodes[l]);return m},g._ID_PROP="__mutation_summary_node_map_id__",g._NEXT_ID=1,g})(),i=(function(){function g(){this.added=new n,this.removed=new n,this.maybeMoved=new n,this.oldPrevious=new n,this.moved=void 0}return g})();r.Movement=void 0,(function(g){g[g.STAYED_OUT=0]="STAYED_OUT",g[g.ENTERED=1]="ENTERED",g[g.STAYED_IN=2]="STAYED_IN",g[g.REPARENTED=3]="REPARENTED",g[g.REORDERED=4]="REORDERED",g[g.EXITED=5]="EXITED"})(r.Movement||(r.Movement={}));var o=function(g,m){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,b){l.__proto__=b}||function(l,b){for(var d in b)Object.prototype.hasOwnProperty.call(b,d)&&(l[d]=b[d])},o(g,m)};function a(g,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");o(g,m);function l(){this.constructor=g}g.prototype=m===null?Object.create(m):(l.prototype=m.prototype,new l)}var s=(function(){function g(m,l,b,d,_,P,O,w){l===void 0&&(l=!1),b===void 0&&(b=!1),d===void 0&&(d=!1),_===void 0&&(_=null),P===void 0&&(P=!1),O===void 0&&(O=null),w===void 0&&(w=null),this.node=m,this.childList=l,this.attributes=b,this.characterData=d,this.oldParentNode=_,this.added=P,this.attributeOldValues=O,this.characterDataOldValue=w,this.isCaseInsensitive=this.node.nodeType===Node.ELEMENT_NODE&&this.node instanceof HTMLElement&&this.node.ownerDocument instanceof HTMLDocument}return g.prototype.getAttributeOldValue=function(m){if(this.attributeOldValues)return this.isCaseInsensitive&&(m=m.toLowerCase()),this.attributeOldValues[m]},g.prototype.getAttributeNamesMutated=function(){var m=[];if(!this.attributeOldValues)return m;for(var l in this.attributeOldValues)this.attributeOldValues.hasOwnProperty(l)&&m.push(l);return m},g.prototype.attributeMutated=function(m,l){this.attributes=!0,this.attributeOldValues=this.attributeOldValues||{},!(m in this.attributeOldValues)&&(this.attributeOldValues[m]=l)},g.prototype.characterDataMutated=function(m){this.characterData||(this.characterData=!0,this.characterDataOldValue=m)},g.prototype.removedFromParent=function(m){this.childList=!0,this.added||this.oldParentNode?this.added=!1:this.oldParentNode=m},g.prototype.insertedIntoParent=function(){this.childList=!0,this.added=!0},g.prototype.getOldParent=function(){if(this.childList){if(this.oldParentNode)return this.oldParentNode;if(this.added)return null}return this.node.parentNode},g})(),c=(function(g){a(m,g);function m(l,b){var d=g.call(this)||this;d.rootNode=l,d.reachableCache=void 0,d.wasReachableCache=void 0,d.anyParentsChanged=!1,d.anyAttributesChanged=!1,d.anyCharacterDataChanged=!1;for(var _=0;_<b.length;_++){var P=b[_];switch(P.type){case"childList":d.anyParentsChanged=!0;for(var O=0;O<P.removedNodes.length;O++){var w=P.removedNodes[O];d.getChange(w).removedFromParent(P.target)}for(var O=0;O<P.addedNodes.length;O++){var w=P.addedNodes[O];d.getChange(w).insertedIntoParent()}break;case"attributes":d.anyAttributesChanged=!0;var D=d.getChange(P.target);D.attributeMutated(P.attributeName,P.oldValue);break;case"characterData":d.anyCharacterDataChanged=!0;var D=d.getChange(P.target);D.characterDataMutated(P.oldValue)}}return d}return m.prototype.getChange=function(l){var b=this.get(l);return b||(b=new s(l),this.set(l,b)),b},m.prototype.getOldParent=function(l){var b=this.get(l);return b?b.getOldParent():l.parentNode},m.prototype.getIsReachable=function(l){if(l===this.rootNode)return!0;if(!l)return!1;this.reachableCache=this.reachableCache||new n;var b=this.reachableCache.get(l);return b===void 0&&(b=this.getIsReachable(l.parentNode),this.reachableCache.set(l,b)),b},m.prototype.getWasReachable=function(l){if(l===this.rootNode)return!0;if(!l)return!1;this.wasReachableCache=this.wasReachableCache||new n;var b=this.wasReachableCache.get(l);return b===void 0&&(b=this.getWasReachable(this.getOldParent(l)),this.wasReachableCache.set(l,b)),b},m.prototype.reachabilityChange=function(l){return this.getIsReachable(l)?this.getWasReachable(l)?r.Movement.STAYED_IN:r.Movement.ENTERED:this.getWasReachable(l)?r.Movement.EXITED:r.Movement.STAYED_OUT},m})(n),u=(function(){function g(m,l,b,d,_){this.rootNode=m,this.mutations=l,this.selectors=b,this.calcReordered=d,this.calcOldPreviousSibling=_,this.treeChanges=new c(m,l),this.entered=[],this.exited=[],this.stayedIn=new n,this.visited=new n,this.childListChangeMap=void 0,this.characterDataOnly=void 0,this.matchCache=void 0,this.processMutations()}return g.prototype.processMutations=function(){if(!(!this.treeChanges.anyParentsChanged&&!this.treeChanges.anyAttributesChanged))for(var m=this.treeChanges.keys(),l=0;l<m.length;l++)this.visitNode(m[l],void 0)},g.prototype.visitNode=function(m,l){if(!this.visited.has(m)){this.visited.set(m,!0);var b=this.treeChanges.get(m),d=l;if((b&&b.childList||d==null)&&(d=this.treeChanges.reachabilityChange(m)),d!==r.Movement.STAYED_OUT){if(this.matchabilityChange(m),d===r.Movement.ENTERED)this.entered.push(m);else if(d===r.Movement.EXITED)this.exited.push(m),this.ensureHasOldPreviousSiblingIfNeeded(m);else if(d===r.Movement.STAYED_IN){var _=r.Movement.STAYED_IN;b&&b.childList&&(b.oldParentNode!==m.parentNode?(_=r.Movement.REPARENTED,this.ensureHasOldPreviousSiblingIfNeeded(m)):this.calcReordered&&this.wasReordered(m)&&(_=r.Movement.REORDERED)),this.stayedIn.set(m,_)}if(d!==r.Movement.STAYED_IN)for(var P=m.firstChild;P;P=P.nextSibling)this.visitNode(P,d)}}},g.prototype.ensureHasOldPreviousSiblingIfNeeded=function(m){if(this.calcOldPreviousSibling){this.processChildlistChanges();var l=m.parentNode,b=this.treeChanges.get(m);b&&b.oldParentNode&&(l=b.oldParentNode);var d=this.childListChangeMap.get(l);d||(d=new i,this.childListChangeMap.set(l,d)),d.oldPrevious.has(m)||d.oldPrevious.set(m,m.previousSibling)}},g.prototype.getChanged=function(m,l,b){this.selectors=l,this.characterDataOnly=b;for(var d=0;d<this.entered.length;d++){var _=this.entered[d],P=this.matchabilityChange(_);(P===r.Movement.ENTERED||P===r.Movement.STAYED_IN)&&m.added.push(_)}for(var O=this.stayedIn.keys(),d=0;d<O.length;d++){var _=O[d],P=this.matchabilityChange(_);if(P===r.Movement.ENTERED)m.added.push(_);else if(P===r.Movement.EXITED)m.removed.push(_);else if(P===r.Movement.STAYED_IN&&(m.reparented||m.reordered)){var w=this.stayedIn.get(_);m.reparented&&w===r.Movement.REPARENTED?m.reparented.push(_):m.reordered&&w===r.Movement.REORDERED&&m.reordered.push(_)}}for(var d=0;d<this.exited.length;d++){var _=this.exited[d],P=this.matchabilityChange(_);(P===r.Movement.EXITED||P===r.Movement.STAYED_IN)&&m.removed.push(_)}},g.prototype.getOldParentNode=function(m){var l=this.treeChanges.get(m);if(l&&l.childList)return l.oldParentNode?l.oldParentNode:null;var b=this.treeChanges.reachabilityChange(m);if(b===r.Movement.STAYED_OUT||b===r.Movement.ENTERED)throw Error("getOldParentNode requested on invalid node.");return m.parentNode},g.prototype.getOldPreviousSibling=function(m){var l=m.parentNode,b=this.treeChanges.get(m);b&&b.oldParentNode&&(l=b.oldParentNode);var d=this.childListChangeMap.get(l);if(!d)throw Error("getOldPreviousSibling requested on invalid node.");return d.oldPrevious.get(m)},g.prototype.getOldAttribute=function(m,l){var b=this.treeChanges.get(m);if(!b||!b.attributes)throw Error("getOldAttribute requested on invalid node.");var d=b.getAttributeOldValue(l);if(d===void 0)throw Error("getOldAttribute requested for unchanged attribute name.");return d},g.prototype.attributeChangedNodes=function(m){if(!this.treeChanges.anyAttributesChanged)return{};var l,b;if(m){l={},b={};for(var d=0;d<m.length;d++){var _=m[d];l[_]=!0,b[_.toLowerCase()]=_}}for(var P={},O=this.treeChanges.keys(),d=0;d<O.length;d++){var w=O[d],D=this.treeChanges.get(w);if(D.attributes&&!(r.Movement.STAYED_IN!==this.treeChanges.reachabilityChange(w)||r.Movement.STAYED_IN!==this.matchabilityChange(w)))for(var R=w,j=D.getAttributeNamesMutated(),L=0;L<j.length;L++){var _=j[L];l&&!l[_]&&!(D.isCaseInsensitive&&b[_])||D.getAttributeOldValue(_)!==R.getAttribute(_)&&(b&&D.isCaseInsensitive&&(_=b[_]),P[_]=P[_]||[],P[_].push(R))}}return P},g.prototype.getOldCharacterData=function(m){var l=this.treeChanges.get(m);if(!l||!l.characterData)throw Error("getOldCharacterData requested on invalid node.");return l.characterDataOldValue},g.prototype.getCharacterDataChanged=function(){if(!this.treeChanges.anyCharacterDataChanged)return[];for(var m=this.treeChanges.keys(),l=[],b=0;b<m.length;b++){var d=m[b];if(r.Movement.STAYED_IN===this.treeChanges.reachabilityChange(d)){var _=this.treeChanges.get(d);!_.characterData||d.textContent==_.characterDataOldValue||l.push(d)}}return l},g.prototype.computeMatchabilityChange=function(m,l){this.matchCache||(this.matchCache=[]),this.matchCache[m.uid]||(this.matchCache[m.uid]=new n);var b=this.matchCache[m.uid],d=b.get(l);return d===void 0&&(d=m.matchabilityChange(l,this.treeChanges.get(l)),b.set(l,d)),d},g.prototype.matchabilityChange=function(m){var l=this;if(this.characterDataOnly)switch(m.nodeType){case Node.COMMENT_NODE:case Node.TEXT_NODE:return r.Movement.STAYED_IN;default:return r.Movement.STAYED_OUT}if(!this.selectors)return r.Movement.STAYED_IN;if(m.nodeType!==Node.ELEMENT_NODE)return r.Movement.STAYED_OUT;for(var b=m,d=this.selectors.map(function(O){return l.computeMatchabilityChange(O,b)}),_=r.Movement.STAYED_OUT,P=0;_!==r.Movement.STAYED_IN&&P<d.length;){switch(d[P]){case r.Movement.STAYED_IN:_=r.Movement.STAYED_IN;break;case r.Movement.ENTERED:_===r.Movement.EXITED?_=r.Movement.STAYED_IN:_=r.Movement.ENTERED;break;case r.Movement.EXITED:_===r.Movement.ENTERED?_=r.Movement.STAYED_IN:_=r.Movement.EXITED}P++}return _},g.prototype.getChildlistChange=function(m){var l=this.childListChangeMap.get(m);return l||(l=new i,this.childListChangeMap.set(m,l)),l},g.prototype.processChildlistChanges=function(){if(!this.childListChangeMap){this.childListChangeMap=new n;for(var m=function(d){var _=l.mutations[d];if(_.type!="childList"||l.treeChanges.reachabilityChange(_.target)!==r.Movement.STAYED_IN&&!l.calcOldPreviousSibling)return"continue";for(var P=l.getChildlistChange(_.target),O=_.previousSibling,w=function(j,L){!j||P.oldPrevious.has(j)||P.added.has(j)||P.maybeMoved.has(j)||L&&(P.added.has(L)||P.maybeMoved.has(L))||P.oldPrevious.set(j,L)},D=0;D<_.removedNodes.length;D++){var R=_.removedNodes[D];w(R,O),P.added.has(R)?P.added.delete(R):(P.removed.set(R,!0),P.maybeMoved.delete(R)),O=R}w(_.nextSibling,O);for(var D=0;D<_.addedNodes.length;D++){var R=_.addedNodes[D];P.removed.has(R)?(P.removed.delete(R),P.maybeMoved.set(R,!0)):P.added.set(R,!0)}},l=this,b=0;b<this.mutations.length;b++)m(b)}},g.prototype.wasReordered=function(m){if(!this.treeChanges.anyParentsChanged)return!1;this.processChildlistChanges();var l=m.parentNode,b=this.treeChanges.get(m);b&&b.oldParentNode&&(l=b.oldParentNode);var d=this.childListChangeMap.get(l);if(!d)return!1;if(d.moved)return d.moved.get(m);d.moved=new n;var _=new n;function P(j){if(!j||!d.maybeMoved.has(j))return!1;var L=d.moved.get(j);return L!==void 0||(_.has(j)?L=!0:(_.set(j,!0),L=R(j)!==w(j)),_.has(j)?(_.delete(j),d.moved.set(j,L)):L=d.moved.get(j)),L}var O=new n;function w(j){var L=O.get(j);if(L!==void 0)return L;for(L=d.oldPrevious.get(j);L&&(d.removed.has(L)||P(L));)L=w(L);return L===void 0&&(L=j.previousSibling),O.set(j,L),L}var D=new n;function R(j){if(D.has(j))return D.get(j);for(var L=j.previousSibling;L&&(d.added.has(L)||P(L));)L=L.previousSibling;return D.set(j,L),L}return d.maybeMoved.keys().forEach(P),d.moved.get(m)},g})(),h=(function(){function g(m,l){var b=this;if(this.projection=m,this.added=[],this.removed=[],this.reparented=l.all||l.element||l.characterData?[]:void 0,this.reordered=l.all?[]:void 0,m.getChanged(this,l.elementFilter,l.characterData),l.all||l.attribute||l.attributeList){var d=l.attribute?[l.attribute]:l.attributeList,_=m.attributeChangedNodes(d);l.attribute?this.valueChanged=_[l.attribute]||[]:(this.attributeChanged=_,l.attributeList&&l.attributeList.forEach(function(O){b.attributeChanged.hasOwnProperty(O)||(b.attributeChanged[O]=[])}))}if(l.all||l.characterData){var P=m.getCharacterDataChanged();l.characterData?this.valueChanged=P:this.characterDataChanged=P}this.reordered&&(this.getOldPreviousSibling=m.getOldPreviousSibling.bind(m))}return g.prototype.getOldParentNode=function(m){return this.projection.getOldParentNode(m)},g.prototype.getOldAttribute=function(m,l){return this.projection.getOldAttribute(m,l)},g.prototype.getOldCharacterData=function(m){return this.projection.getOldCharacterData(m)},g.prototype.getOldPreviousSibling=function(m){return this.projection.getOldPreviousSibling(m)},g})(),f=(function(){function g(){}return g.prototype.matches=function(m){if(m===null)return!1;if(this.attrValue===void 0)return!0;if(!this.contains)return this.attrValue==m;for(var l=m.split(" "),b=0;b<l.length;b++)if(this.attrValue===l[b])return!0;return!1},g.prototype.toString=function(){return this.attrName==="class"&&this.contains?"."+this.attrValue:this.attrName==="id"&&!this.contains?"#"+this.attrValue:this.contains?"["+this.attrName+"~="+y(this.attrValue)+"]":"attrValue"in this?"["+this.attrName+"="+y(this.attrValue)+"]":"["+this.attrName+"]"},g})();function y(g){return'"'+g.replace(/"/,'\\"')+'"'}var E=/[a-zA-Z_]+/,S=/[a-zA-Z0-9_\-]+/,v=(function(){function g(){this.uid=g.nextUid++,this.qualifiers=[]}return Object.defineProperty(g.prototype,"caseInsensitiveTagName",{get:function(){return this.tagName.toUpperCase()},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"selectorString",{get:function(){return this.tagName+this.qualifiers.join("")},enumerable:!1,configurable:!0}),g.prototype.isMatching=function(m){return m[g.matchesSelector](this.selectorString)},g.prototype.wasMatching=function(m,l,b){if(!l||!l.attributes)return b;var d=l.isCaseInsensitive?this.caseInsensitiveTagName:this.tagName;if(d!=="*"&&d!==m.tagName)return!1;for(var _=[],P=!1,O=0;O<this.qualifiers.length;O++){var w=this.qualifiers[O],D=l.getAttributeOldValue(w.attrName);_.push(D),P=P||D!==void 0}if(!P)return b;for(var O=0;O<this.qualifiers.length;O++){var w=this.qualifiers[O],D=_[O];if(D===void 0&&(D=m.getAttribute(w.attrName)),!w.matches(D))return!1}return!0},g.prototype.matchabilityChange=function(m,l){var b=this.isMatching(m);return b?this.wasMatching(m,l,b)?r.Movement.STAYED_IN:r.Movement.ENTERED:this.wasMatching(m,l,b)?r.Movement.EXITED:r.Movement.STAYED_OUT},g.parseSelectors=function(m){var l=[],b,d;function _(){b&&(d&&(b.qualifiers.push(d),d=void 0),l.push(b)),b=new g}function P(){d&&b.qualifiers.push(d),d=new f}for(var O=/\s/,w=void 0,D="Invalid or unsupported selector syntax.",R=1,j=2,L=3,F=4,U=5,B=6,x=7,z=8,X=9,J=10,Q=11,ee=12,Y=13,H=14,$=R,W=0;W<m.length;){var k=m[W++];switch($){case R:if(k.match(E)){_(),b.tagName=k,$=j;break}if(k=="*"){_(),b.tagName="*",$=L;break}if(k=="."){_(),P(),b.tagName="*",d.attrName="class",d.contains=!0,$=F;break}if(k=="#"){_(),P(),b.tagName="*",d.attrName="id",$=F;break}if(k=="["){_(),P(),b.tagName="*",d.attrName="",$=B;break}if(k.match(O))break;throw Error(D);case j:if(k.match(S)){b.tagName+=k;break}if(k=="."){P(),d.attrName="class",d.contains=!0,$=F;break}if(k=="#"){P(),d.attrName="id",$=F;break}if(k=="["){P(),d.attrName="",$=B;break}if(k.match(O)){$=H;break}if(k==","){$=R;break}throw Error(D);case L:if(k=="."){P(),d.attrName="class",d.contains=!0,$=F;break}if(k=="#"){P(),d.attrName="id",$=F;break}if(k=="["){P(),d.attrName="",$=B;break}if(k.match(O)){$=H;break}if(k==","){$=R;break}throw Error(D);case F:if(k.match(E)){d.attrValue=k,$=U;break}throw Error(D);case U:if(k.match(S)){d.attrValue+=k;break}if(k=="."){P(),d.attrName="class",d.contains=!0,$=F;break}if(k=="#"){P(),d.attrName="id",$=F;break}if(k=="["){P(),$=B;break}if(k.match(O)){$=H;break}if(k==","){$=R;break}throw Error(D);case B:if(k.match(E)){d.attrName=k,$=x;break}if(k.match(O))break;throw Error(D);case x:if(k.match(S)){d.attrName+=k;break}if(k.match(O)){$=z;break}if(k=="~"){d.contains=!0,$=X;break}if(k=="="){d.attrValue="",$=Q;break}if(k=="]"){$=L;break}throw Error(D);case z:if(k=="~"){d.contains=!0,$=X;break}if(k=="="){d.attrValue="",$=Q;break}if(k=="]"){$=L;break}if(k.match(O))break;throw Error(D);case X:if(k=="="){d.attrValue="",$=Q;break}throw Error(D);case J:if(k=="]"){$=L;break}if(k.match(O))break;throw Error(D);case Q:if(k.match(O))break;if(k=='"'||k=="'"){w=k,$=Y;break}d.attrValue+=k,$=ee;break;case ee:if(k.match(O)){$=J;break}if(k=="]"){$=L;break}if(k=="'"||k=='"')throw Error(D);d.attrValue+=k;break;case Y:if(k==w){$=J;break}d.attrValue+=k;break;case H:if(k.match(O))break;if(k==","){$=R;break}throw Error(D)}}switch($){case R:case j:case L:case U:case H:_();break;default:throw Error(D)}if(!l.length)throw Error(D);return l},g.nextUid=1,g.matchesSelector="matches",g})(),C=(function(){function g(){}return g.createObserverOptions=function(m){var l={childList:!0,subtree:!0},b;function d(_){if(!(l.attributes&&!b)){if(l.attributes=!0,l.attributeOldValue=!0,!_){b=void 0;return}b=b||{},_.forEach(function(P){b[P]=!0,b[P.toLowerCase()]=!0})}}return m.forEach(function(_){if(_.characterData){l.characterData=!0,l.characterDataOldValue=!0;return}if(_.all){d(),l.characterData=!0,l.characterDataOldValue=!0;return}if(_.attribute){d([_.attribute.trim()]);return}var P=g._elementFilterAttributes(_.elementFilter).concat(_.attributeList||[]);P.length&&d(P)}),b&&(l.attributeFilter=Object.keys(b)),l},g.validateOptions=function(m){for(var l in m)if(!(l in g._optionKeys))throw Error("Invalid option: "+l);if(typeof m.callback!="function")throw Error("Invalid options: callback is required and must be a function");if(!m.queries||!m.queries.length)throw Error("Invalid options: queries must contain at least one query request object.");for(var b={callback:m.callback,rootNode:m.rootNode||document,observeOwnChanges:!!m.observeOwnChanges,oldPreviousSibling:!!m.oldPreviousSibling,queries:[]},d=0;d<m.queries.length;d++){var _=m.queries[d];if(_.all){if(Object.keys(_).length>1)throw Error("Invalid request option. all has no options.");b.queries.push({all:!0});continue}if("attribute"in _){var P={attribute:g._validateAttribute(_.attribute)};if(P.elementFilter=v.parseSelectors("*["+P.attribute+"]"),Object.keys(_).length>1)throw Error("Invalid request option. attribute has no options.");b.queries.push(P);continue}if("element"in _){var O=Object.keys(_).length,P={element:_.element,elementFilter:v.parseSelectors(_.element)};if(_.hasOwnProperty("elementAttributes")&&(P.attributeList=g._validateElementAttributes(_.elementAttributes),O--),O>1)throw Error("Invalid request option. element only allows elementAttributes option.");b.queries.push(P);continue}if(_.characterData){if(Object.keys(_).length>1)throw Error("Invalid request option. characterData has no options.");b.queries.push({characterData:!0});continue}throw Error("Invalid request option. Unknown query request.")}return b},g._validateElementAttributes=function(m){if(!m.trim().length)throw Error("Invalid request option: elementAttributes must contain at least one attribute.");for(var l={},b={},d=m.split(/\s+/),_=0;_<d.length;_++){var P=d[_];if(P){P=g._validateAttribute(P);var O=P.toLowerCase();if(l[O])throw Error("Invalid request option: observing multiple case variations of the same attribute is not supported.");b[P]=!0,l[O]=!0}}return Object.keys(b)},g._elementFilterAttributes=function(m){var l={};return m.forEach(function(b){b.qualifiers.forEach(function(d){l[d.attrName]=!0})}),Object.keys(l)},g._validateAttribute=function(m){if(typeof m!="string"||(m=m.trim(),!m))throw Error("Invalid request option. attribute must be a non-zero length string.");if(!m.match(g._attributeFilterPattern))throw Error("Invalid request option. invalid attribute name: "+m);return m},g._attributeFilterPattern=/^([a-zA-Z:_]+[a-zA-Z0-9_\-:.]*)$/,g._optionKeys={callback:!0,queries:!0,rootNode:!0,oldPreviousSibling:!0,observeOwnChanges:!0},g})(),A=(function(){function g(m){var l=this;this._connected=!1,this._options=C.validateOptions(m),this._observerOptions=C.createObserverOptions(this._options.queries),this._root=this._options.rootNode,this._callback=this._options.callback,this._elementFilter=Array.prototype.concat.apply([],this._options.queries.map(function(b){return b.elementFilter?b.elementFilter:[]})),this._elementFilter.length||(this._elementFilter=void 0),this._calcReordered=this._options.queries.some(function(b){return b.all}),this._queryValidators=[],g.createQueryValidator&&(this._queryValidators=this._options.queries.map(function(b){return g.createQueryValidator(l._root,b)})),this._observer=new MutationObserver(function(b){l._observerCallback(b)}),this.reconnect()}return g.prototype.reconnect=function(){if(this._connected)throw Error("Already connected");this._observer.observe(this._root,this._observerOptions),this._connected=!0,this._checkpointQueryValidators()},g.prototype.takeSummaries=function(){if(!this._connected)throw Error("Not connected");var m=this._createSummaries(this._observer.takeRecords());return this._changesToReport(m)?m:void 0},g.prototype.disconnect=function(){var m=this.takeSummaries();return this._observer.disconnect(),this._connected=!1,m},g.prototype._observerCallback=function(m){this._options.observeOwnChanges||this._observer.disconnect();var l=this._createSummaries(m);this._runQueryValidators(l),this._options.observeOwnChanges&&this._checkpointQueryValidators(),this._changesToReport(l)&&this._callback(l),!this._options.observeOwnChanges&&this._connected&&(this._checkpointQueryValidators(),this._observer.observe(this._root,this._observerOptions))},g.prototype._createSummaries=function(m){if(!m||!m.length)return[];for(var l=new u(this._root,m,this._elementFilter,this._calcReordered,this._options.oldPreviousSibling),b=[],d=0;d<this._options.queries.length;d++)b.push(new h(l,this._options.queries[d]));return b},g.prototype._checkpointQueryValidators=function(){this._queryValidators.forEach(function(m){m&&m.recordPreviousState()})},g.prototype._runQueryValidators=function(m){this._queryValidators.forEach(function(l,b){l&&l.validate(m[b])})},g.prototype._changesToReport=function(m){return m.some(function(l){return!!(["added","removed","reordered","reparented","valueChanged","characterDataChanged"].some(function(b){return l[b]&&l[b].length})||l.attributeChanged&&Object.keys(l.attributeChanged).some(function(b){return!!l.attributeChanged[b].length}))})},g})(),I=(function(){function g(m,l){this.root=m,this.delegate=l,this.idMap={}}return g.prototype.initialize=function(m,l){this.idMap[m]=this.root;for(var b=0;b<l.length;b++)this.deserializeNode(l[b],this.root)},g.prototype.applyChanged=function(m,l,b,d){var _=this;l.forEach(function(P){var O=_.deserializeNode(P);_.deserializeNode(P.parentNode),_.deserializeNode(P.previousSibling),O.parentNode&&O.parentNode.removeChild(O)}),m.forEach(function(P){var O=_.deserializeNode(P);O.parentNode&&O.parentNode.removeChild(O)}),l.forEach(function(P){var O=_.deserializeNode(P),w=_.deserializeNode(P.parentNode),D=_.deserializeNode(P.previousSibling);w.insertBefore(O,D?D.nextSibling:w.firstChild)}),b.forEach(function(P){var O=_.deserializeNode(P);Object.keys(P.attributes).forEach(function(w){var D=P.attributes[w];D===null?O.removeAttribute(w):(!_.delegate||!_.delegate.setAttribute||!_.delegate.setAttribute(O,w,D))&&O.setAttribute(w,D)})}),d.forEach(function(P){var O=_.deserializeNode(P);O.textContent=P.textContent}),m.forEach(function(P){delete _.idMap[P.id]})},g.prototype.deserializeNode=function(m,l){var b=this;if(m===null)return null;var d=this.idMap[m.id];if(d)return d;var _=this.root.ownerDocument;switch(_===null&&(_=this.root),m.nodeType){case Node.COMMENT_NODE:d=_.createComment(m.textContent);break;case Node.TEXT_NODE:d=_.createTextNode(m.textContent);break;case Node.DOCUMENT_TYPE_NODE:d=_.implementation.createDocumentType(m.name,m.publicId,m.systemId);break;case Node.ELEMENT_NODE:this.delegate&&this.delegate.createElement&&(d=this.delegate.createElement(m.tagName)),d||(d=_.createElement(m.tagName)),Object.keys(m.attributes).forEach(function(O){(!b.delegate||!b.delegate.setAttribute||!b.delegate.setAttribute(d,O,m.attributes[O]))&&d.setAttribute(O,m.attributes[O])});break;default:throw"Unsupported node type: "+m.nodeType}if(this.idMap[m.id]=d,l&&l.appendChild(d),m.childNodes)for(var P=0;P<m.childNodes.length;P++)this.deserializeNode(m.childNodes[P],d);return d},g})(),T=(function(){function g(m,l,b){var d=this;this.target=m,this.mirror=l,this.nextId=1,this.knownNodes=new n;for(var _=this.serializeNode(m).id,P=[],O=m.firstChild;O;O=O.nextSibling)P.push(this.serializeNode(O,!0));this.mirror.initialize(_,P);var w=[{all:!0}];b&&(w=w.concat(b)),this.mutationSummary=new A({rootNode:m,callback:function(D){d.applyChanged(D)},queries:w})}return g.prototype.disconnect=function(){this.mutationSummary&&(this.mutationSummary.disconnect(),this.mutationSummary=void 0)},g.prototype.rememberNode=function(m){var l=this.nextId++;return this.knownNodes.set(m,l),l},g.prototype.forgetNode=function(m){this.knownNodes.delete(m)},g.prototype.serializeNode=function(m,l){if(m===null)return null;var b=this.knownNodes.get(m);if(b!==void 0)return{id:b};var d={nodeType:m.nodeType,id:this.rememberNode(m)};switch(d.nodeType){case Node.DOCUMENT_TYPE_NODE:var _=m;d.name=_.name,d.publicId=_.publicId,d.systemId=_.systemId;break;case Node.COMMENT_NODE:case Node.TEXT_NODE:d.textContent=m.textContent;break;case Node.ELEMENT_NODE:var P=m;d.tagName=P.tagName,d.attributes={};for(var O=0;O<P.attributes.length;O++){var w=P.attributes[O];d.attributes[w.name]=w.value}if(l&&P.childNodes.length){d.childNodes=[];for(var D=P.firstChild;D;D=D.nextSibling)d.childNodes.push(this.serializeNode(D,!0))}}return d},g.prototype.serializeAddedAndMoved=function(m,l,b){var d=this,_=m.concat(l).concat(b),P=new n;_.forEach(function(w){var D=w.parentNode,R=P.get(D);R||(R=new n,P.set(D,R)),R.set(w,!0)});var O=[];return P.keys().forEach(function(w){for(var D=P.get(w),R=D.keys();R.length;){for(var j=R[0];j.previousSibling&&D.has(j.previousSibling);)j=j.previousSibling;for(;j&&D.has(j);){var L=d.serializeNode(j);L.previousSibling=d.serializeNode(j.previousSibling),L.parentNode=d.serializeNode(j.parentNode),O.push(L),D.delete(j),j=j.nextSibling}R=D.keys()}}),O},g.prototype.serializeAttributeChanges=function(m){var l=this,b=new n;return Object.keys(m).forEach(function(d){m[d].forEach(function(_){var P=b.get(_);P||(P=l.serializeNode(_),P.attributes={},b.set(_,P)),P.attributes[d]=_.getAttribute(d)})}),b.keys().map(function(d){return b.get(d)})},g.prototype.applyChanged=function(m){var l=this,b=m[0],d=b.removed.map(function(w){return l.serializeNode(w)}),_=this.serializeAddedAndMoved(b.added,b.reparented,b.reordered),P=this.serializeAttributeChanges(b.attributeChanged),O=b.characterDataChanged.map(function(w){var D=l.serializeNode(w);return D.textContent=w.textContent,D});this.mirror.applyChanged(d,_,P,O),b.removed.forEach(function(w){l.forgetNode(w)})},g})();if(MutationObserver===void 0)throw Error("DOM Mutation Observers are required");r.ChildListChange=i,r.MutationProjection=u,r.MutationSummary=A,r.NodeChange=s,r.NodeMap=n,r.Qualifier=f,r.Selector=v,r.Summary=h,r.TreeChanges=c,r.TreeMirror=I,r.TreeMirrorClient=T,Object.defineProperty(r,"__esModule",{value:!0})}))})),uw=sw(),Bt=0,$t=new Array(1e3);function cw(){for(let e=0;e<Bt;e+=2){const t=$t[e],r=$t[e+1];t(...r),$t[e]=void 0,$t[e+1]=void 0}Bt=0}function lw(e,...t){$t[Bt]=e,$t[Bt+1]=t,Bt+=2,Bt===2&&fw()}function dw(){let e=0;const t=new MutationObserver(cw),r=document.createTextNode("");return t.observe(r,{characterData:!0}),()=>{r.data=String(e=++e%2)}}var fw=dw();function Zf(){lw(()=>{La.hasListeners()&&(La.fire(),Zf())})}var La=new M.Emitter({onFirstListenerAdd:Zf}),ka=La.once,pw=class extends M.Emitter{_mutationSummary;constructor(e={}){super(),this._mutationSummary=new uw.MutationSummary({...e,observeOwnChanges:!0,callback:t=>this.fire(t),queries:[{all:!0}]})}dispose(){this._mutationSummary.disconnect(),super.dispose()}trigger(e){const t=this._mutationSummary.takeSummaries();return(e||t?.length)&&this.fire(t||[]),t}},mw=class extends M.Disposable{_mutationEmitter;_innerEmitter=this.addDisposable(new M.Emitter({onFirstListenerAdd:()=>{this._nextTickHandler()}}));_lostEmitter=this.addDisposable(new M.Emitter);_paused=0;_stopped=0;_summaries=[];_nextTickHandler(){ka(()=>{this.trigger(),this._summaries.length&&(this._innerEmitter.hasListeners()?this._innerEmitter.fire(this._summaries):this._lostEmitter.fire(this._summaries),this._summaries=[])},Number.MAX_VALUE)}constructor(e={}){super(),this._mutationEmitter=this.addDisposable(new pw(e)),this.onNativeMutate=this._mutationEmitter.event,this.addDisposable(this._mutationEmitter.event(t=>{this._stopped||(this._paused?this._lostEmitter.fire(t):(this._summaries.push(...t),ka(()=>{this._summaries.length&&!this._innerEmitter.hasListeners()&&(this._lostEmitter.fire(this._summaries),this._summaries=[])},Number.MAX_VALUE)))}))}get isStoped(){return this._paused>0||this._stopped>0}stop(){this._mutationEmitter.trigger(),this._stopped++}start(){this._mutationEmitter.trigger(),this._stopped--}pause(){this._mutationEmitter.trigger(),this._paused++}resume(){this._mutationEmitter.trigger(),this._paused--}trigger(){this._mutationEmitter.trigger(!0)}onMutate=this._innerEmitter.event;onLost=this._lostEmitter.event;onNativeMutate};function hw(e){for(const t of e){if(t.removed)for(const r of t.removed){const n=t.getOldParentNode(r),i=t.getOldPreviousSibling(r);if(n){const o=i?.nextSibling??null;n.insertBefore(r,o)}}if(t.added)for(const r of t.added)r.parentNode&&r.parentNode.removeChild(r);if(t.reordered)for(const r of t.reordered){const n=t.getOldParentNode(r),i=t.getOldPreviousSibling(r);if(n){const o=i?.nextSibling??null;n.insertBefore(r,o)}}if(t.attributeChanged)for(const r of Object.keys(t.attributeChanged))for(const n of t.attributeChanged[r]){const i=t.getOldAttribute(n,r);i==null?n.removeAttribute(r):n.setAttribute(r,i)}if(t.characterDataChanged)for(const r of t.characterDataChanged)(Pi(r)||Ei(r)||Ei(r))&&(r.data=t.getOldCharacterData(r))}}var gw=class extends M.Disposable{_commitPromise;_mutationCollector;_onLostSummaries=e=>{try{this._mutationCollector.stop(),hw(e)}finally{this._mutationCollector.start()}};constructor(e){super(),this._mutationCollector=this.addDisposable(new mw({rootNode:e,oldPreviousSibling:!0})),this._mutationCollector.onLost(this._onLostSummaries)}commit(){if(this._commitPromise)return this._commitPromise;{const e=()=>new Promise(t=>{const r=this._mutationCollector.onMutate(n=>{this._commitPromise=void 0,t(),r.dispose()});ka(()=>{this._commitPromise=void 0,t(),r.dispose()})});return this._commitPromise=e().catch(t=>{})}}};function bw(e,t){const r=o=>{const a={contentDocument:o,html:Ht(o)};return a.html=Jf(a.html).html,a},n=new M.AsyncEmitter,i=new M.AsyncEmitter;try{const o=Vf(e),a=document.implementation.createHTMLDocument();return as(a,o),{document:a,handleRender:i.event,handleReadHtml:n.event,async run(){if(i.hasListeners()){const s=document.createElement("iframe");s.style.position="absolute",s.style.left="-10000px",document.body.appendChild(s);const c=s.contentWindow.document,u=new gw(s.contentDocument);let h;try{if(t){const[f,y]=t;f!==void 0&&s.setAttribute("width",String(f)),y!==void 0&&s.setAttribute("height",String(y))}as(c,[...a.childNodes]),u.commit()}catch(f){throw f}finally{try{try{await i.fire({managedNodeController:u,contentDocument:c})}catch{}const f=r(c);await n.fire(f),h=f.html}finally{s.parentNode===document.body&&document.body.removeChild(s)}}return h}else{const s=r(a);return await n.fire(s),s.html}}}}catch(o){throw o}}var yw=3,vw=/^(.+\.[a-zA-Z0-9]{1,8})\?[^?#]*$/;function _w(e){let t=e;for(let r=0;r<yw;r++)try{const n=decodeURIComponent(t);if(n===t)break;t=n}catch{break}return t.normalize("NFC")}function Ew(e){const t=e.match(vw);return t?t[1]:e}function Sw(e){if(/^https?:\/\//i.test(e))return new URL(e).pathname.split("/").filter(Boolean).pop();if(e.startsWith("//"))return new URL(e,"https://placeholder.invalid").pathname.split("/").filter(Boolean).pop()}function ep(e){const t=e.replaceAll("\\","/").trim();if(!t)return t;let r;try{r=Sw(t)}catch{}if(!r){r=Ew(t.split("/").pop()??"");const n=r.indexOf("#");n>=0&&(r=r.slice(0,n))}return _w(r)}function Pw(e){const t=e.trim();if(t){if(!(/^https?:\/\//i.test(t)||t.startsWith("//")))try{new URL(t)}catch{return}return ep(t)||void 0}}function Ow(e,t){const r=document.createElement("input");r.type="file",r.accept=e,r.multiple=!1,r.setAttribute("data-testid","uploadFile"),r.style.position="absolute",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r),r.onchange=()=>{r.files?.length&&t(r.files),document.body.removeChild(r)},r.click()}var tp=()=>(0,et.__vitePreload)(()=>Promise.resolve().then(()=>fe("./30f16e98.js")),void 0,{}.url);async function Tw(e,t){if(t==="amp")e.handleRender(async({contentDocument:r,managedNodeController:n})=>{for(const o of r.querySelectorAll(".em-amp-show-disabled"))o.remove();const{html2amp:i}=await tp();await i(r,{mappedTags:{script:"___script"},commit:()=>n.commit()})});else if(t==="html"){const r=e.document;for(const i of r.querySelectorAll(".em-amp-show-only"))i.remove();const{amp2html:n}=await tp();n(r,{mappedTags:{script:"___script"}})}}function Cw(e,t){e?.mutate({content:ho(t)},{source:"remote"})}function Aw(e,t,r,{undoable:n}){if(!e)return;const i=e.getContent(),o=ho(r);i!==o&&(e.mutate({changes:[new Me(0,i,0,o)]},{source:"user"}),n||t?.clear())}function Iw(){const{document:e,history:t}=jr();return(0,N.useCallback)((r,n)=>Aw(e,t,r,n),[e,t])}function Fa(e,t){return Fa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Fa(e,t)}function rp(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Fa(e,t)}function ww(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function Mw(e,t){e.classList?e.classList.add(t):ww(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function np(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function Rw(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=np(e.className,t):e.setAttribute("class",np(e.className&&e.className.baseVal||"",t))}var ip={disabled:!1},op=N.default.createContext(null),ap=function(t){return t.scrollTop},Ua="unmounted",Gt="exited",mi="entering",hi="entered",Ba="exiting",Ye=(function(e){rp(t,e);function t(n,i){var o=e.call(this,n,i)||this,a=i,s=a&&!a.isMounting?n.enter:n.appear,c;return o.appearStatus=null,n.in?s?(c=Gt,o.appearStatus=mi):c=hi:n.unmountOnExit||n.mountOnEnter?c=Ua:c=Gt,o.state={status:c},o.nextCallback=null,o}t.getDerivedStateFromProps=function(i,o){return i.in&&o.status==="unmounted"?{status:Gt}:null};var r=t.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(i){var o=null;if(i!==this.props){var a=this.state.status;this.props.in?a!=="entering"&&a!=="entered"&&(o=mi):(a==="entering"||a==="entered")&&(o=Ba)}this.updateStatus(!1,o)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var i=this.props.timeout,o=a=s=i,a,s;return i!=null&&typeof i!="number"&&(o=i.exit,a=i.enter,s=i.appear!==void 0?i.appear:a),{exit:o,enter:a,appear:s}},r.updateStatus=function(i,o){if(i===void 0&&(i=!1),o!==null)if(this.cancelNextCallback(),o==="entering"){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:Ze.default.findDOMNode(this);a&&ap(a)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status==="exited"&&this.setState({status:Ua})},r.performEnter=function(i){var o=this,a=this.props.enter,s=this.context?this.context.isMounting:i,c=this.props.nodeRef?[s]:[Ze.default.findDOMNode(this),s],u=c[0],h=c[1],f=this.getTimeouts(),y=s?f.appear:f.enter;if(!i&&!a||ip.disabled){this.safeSetState({status:hi},function(){o.props.onEntered(u)});return}this.props.onEnter(u,h),this.safeSetState({status:mi},function(){o.props.onEntering(u,h),o.onTransitionEnd(y,function(){o.safeSetState({status:hi},function(){o.props.onEntered(u,h)})})})},r.performExit=function(){var i=this,o=this.props.exit,a=this.getTimeouts(),s=this.props.nodeRef?void 0:Ze.default.findDOMNode(this);if(!o||ip.disabled){this.safeSetState({status:Gt},function(){i.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:Ba},function(){i.props.onExiting(s),i.onTransitionEnd(a.exit,function(){i.safeSetState({status:Gt},function(){i.props.onExited(s)})})})},r.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(i,o){o=this.setNextCallback(o),this.setState(i,o)},r.setNextCallback=function(i){var o=this,a=!0;return this.nextCallback=function(s){a&&(a=!1,o.nextCallback=null,i(s))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},r.onTransitionEnd=function(i,o){this.setNextCallback(o);var a=this.props.nodeRef?this.props.nodeRef.current:Ze.default.findDOMNode(this),s=i==null&&!this.props.addEndListener;if(!a||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var c=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],u=c[0],h=c[1];this.props.addEndListener(u,h)}i!=null&&setTimeout(this.nextCallback,i)},r.render=function(){var i=this.state.status;if(i==="unmounted")return null;var o=this.props,a=o.children;o.in,o.mountOnEnter,o.unmountOnExit,o.appear,o.enter,o.exit,o.timeout,o.addEndListener,o.onEnter,o.onEntering,o.onEntered,o.onExit,o.onExiting,o.onExited,o.nodeRef;var s=fs(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return N.default.createElement(op.Provider,{value:null},typeof a=="function"?a(i,s):N.default.cloneElement(N.default.Children.only(a),s))},t})(N.default.Component);Ye.contextType=op,Ye.propTypes={};function qt(){}Ye.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:qt,onEntering:qt,onEntered:qt,onExit:qt,onExiting:qt,onExited:qt},Ye.UNMOUNTED=Ua,Ye.EXITED=Gt,Ye.ENTERING=mi,Ye.ENTERED=hi,Ye.EXITING=Ba;var Dw=function(t,r){return t&&r&&r.split(" ").forEach(function(n){return Mw(t,n)})},$a=function(t,r){return t&&r&&r.split(" ").forEach(function(n){return Rw(t,n)})},Ga=(function(e){rp(t,e);function t(){for(var n,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return n=e.call.apply(e,[this].concat(o))||this,n.appliedClasses={appear:{},enter:{},exit:{}},n.onEnter=function(s,c){var u=n.resolveArguments(s,c),h=u[0],f=u[1];n.removeClasses(h,"exit"),n.addClass(h,f?"appear":"enter","base"),n.props.onEnter&&n.props.onEnter(s,c)},n.onEntering=function(s,c){var u=n.resolveArguments(s,c),h=u[0],f=u[1]?"appear":"enter";n.addClass(h,f,"active"),n.props.onEntering&&n.props.onEntering(s,c)},n.onEntered=function(s,c){var u=n.resolveArguments(s,c),h=u[0],f=u[1]?"appear":"enter";n.removeClasses(h,f),n.addClass(h,f,"done"),n.props.onEntered&&n.props.onEntered(s,c)},n.onExit=function(s){var c=n.resolveArguments(s)[0];n.removeClasses(c,"appear"),n.removeClasses(c,"enter"),n.addClass(c,"exit","base"),n.props.onExit&&n.props.onExit(s)},n.onExiting=function(s){var c=n.resolveArguments(s)[0];n.addClass(c,"exit","active"),n.props.onExiting&&n.props.onExiting(s)},n.onExited=function(s){var c=n.resolveArguments(s)[0];n.removeClasses(c,"exit"),n.addClass(c,"exit","done"),n.props.onExited&&n.props.onExited(s)},n.resolveArguments=function(s,c){return n.props.nodeRef?[n.props.nodeRef.current,s]:[s,c]},n.getClassNames=function(s){var c=n.props.classNames,u=typeof c=="string",h=u&&c?c+"-":"",f=u?""+h+s:c[s];return{baseClassName:f,activeClassName:u?f+"-active":c[s+"Active"],doneClassName:u?f+"-done":c[s+"Done"]}},n}var r=t.prototype;return r.addClass=function(i,o,a){var s=this.getClassNames(o)[a+"ClassName"],c=this.getClassNames("enter").doneClassName;o==="appear"&&a==="done"&&c&&(s+=" "+c),a==="active"&&i&&ap(i),s&&(this.appliedClasses[o][a]=s,Dw(i,s))},r.removeClasses=function(i,o){var a=this.appliedClasses[o],s=a.base,c=a.active,u=a.done;this.appliedClasses[o]={},s&&$a(i,s),c&&$a(i,c),u&&$a(i,u)},r.render=function(){var i=this.props;i.classNames;var o=fs(i,["classNames"]);return N.default.createElement(Ye,Ai({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t})(N.default.Component);Ga.defaultProps={classNames:""},Ga.propTypes={};function sp(){const e=pe(),t=Oo(M.getContainer(e)),r=(0,N.useCallback)(n=>t.subscribe(n),[t]);return{document:(0,N.useSyncExternalStore)(r,()=>t.current()),show:(0,N.useSyncExternalStore)(r,()=>t.showFacts()),error:(0,N.useSyncExternalStore)(r,()=>t.openError())}}function Nw(e){return String(e).replace(/"/g,""")}function up(e=new Date){const t=r=>String(r).padStart(2,"0");return String(e.getFullYear())+t(e.getMonth()+1)+t(e.getDate())+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}function jw(e){if(!e||!/^\d{12}(\d{2})?$/.test(e))return null;const t=Number(e.slice(0,4)),r=Number(e.slice(4,6))-1,n=Number(e.slice(6,8)),i=Number(e.slice(8,10)),o=Number(e.slice(10,12)),a=e.length>=14?Number(e.slice(12,14)):0,s=new Date(t,r,n,i,o,a);return Number.isNaN(s.getTime())?null:s}function cp(e){const t=/<(table|tr|div)(\s[^>]*)>/gi;let r;for(;(r=t.exec(e))!==null;){const n=r[2]??"";if(/\bem\s*=\s*["']block["']/i.test(n))return{full:r[0],index:r.index}}return null}function lp(e,t,r){const n=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),i=Nw(r);return n.test(e)?e.replace(n,`${t}="${i}"`):e.replace(/>$/,` ${t}="${i}">`)}function dp(e,t){const r=new RegExp(`\\b${t}\\s*=\\s*["']([^"']*)["']`,"i").exec(e);return r?r[1]:void 0}function Lw(e){if(!e?.trim())return{};const t=cp(e);return t?{emBlockId:dp(t.full,"em-block-id"),emBlockVersion:dp(t.full,"em-block-version")}:{}}function kw(e,t,r){if(!e?.trim()||!t)return e;const n=cp(e);if(!n)return e;const i=String(t),o=up(r??new Date);let{full:a,index:s}=n;const c=a.length;return/\bem-block-id\s*=/.test(a)||(a=lp(a,"em-block-id",i)),a=lp(a,"em-block-version",o),e.slice(0,s)+a+e.slice(s+c)}function Fw(e){return{projectId:e,pageSize:1e3,page:1,tags:null,name:null,type:null,notEmbed:!0,order:"asc",orderby:"title"}}function Uw(e){return e===null?null:e===void 0||e===""||e===0||e==="0"?au:e}function Bw(e){return{emailId:e,pageSize:1e3,page:1,projectId:Jg,notEmbed:!0,name:null,type:null}}function $w(){return{pageSize:1e3,page:1,notEmbed:!0,name:null,type:null}}var Gw=`
|
|
61
61
|
:host > table { margin: 0 auto; }
|
|
62
62
|
table { border-collapse: initial; }
|
|
63
63
|
`;function fp(e){return e.shadowRoot??e.attachShadow({mode:"open"})}function qw(e,t){e.innerHTML=`<style>${Gw}</style>${t}`}function xw(e){e.shadowRoot&&(e.shadowRoot.innerHTML="")}function pp(e,t){const r=e.closest(".blocks-search__result-body");if(t){e.dataset.blockPreview="filled",r?.setAttribute("data-block-preview","filled");return}delete e.dataset.blockPreview,r?.removeAttribute("data-block-preview")}function Hw(e,t){const r=Array.from(e.querySelectorAll("img")).filter(n=>!n.complete);return r.forEach(n=>{n.addEventListener("load",t),n.addEventListener("error",t)}),()=>{r.forEach(n=>{n.removeEventListener("load",t),n.removeEventListener("error",t)})}}function Vw({html:e,className:t,style:r,onContentLoad:n}){const i=(0,N.useRef)(null);return(0,N.useEffect)(()=>{const o=i.current;if(!o)return;let a,s=!1;const c=()=>{if(s)return;const f=fp(o);qw(f,e),s=!0,pp(o,!0),n?.(o),a=n?Hw(f,()=>n(o)):void 0},h=$O(o,{fill:c,drop:()=>{s&&(a?.(),a=void 0,xw(o),s=!1,pp(o,!1))}});return h===!1?(c(),()=>a?.()):()=>{h(),a?.()}},[e,n]),(0,G.jsx)("div",{ref:i,className:t,style:r})}function zw(e){const t=e.cloneNode(!1),r=e.shadowRoot;return r?fp(t).innerHTML=r.innerHTML:t.innerHTML=e.innerHTML,t}var Qw={};function Ww(e){const t=(0,N.useCallback)(i=>e?e.subscribe(i):()=>{},[e]),r=(0,N.useRef)(null),n=(0,N.useCallback)(()=>{if(!e)return Qw;const{docId:i,attributes:o}=e.get();return(r.current?.docId!==i||r.current.attributes!==o)&&(r.current={docId:i,attributes:o}),r.current.attributes},[e]);return(0,N.useSyncExternalStore)(t,n)}function Kw({attributes:e,readContent:t,docId:r,hasSession:n,serverId:i,show:o}){if(!n)return;const a={id:i??void 0,renderGuid:r,showId:o?.id,isNew:i==null,showToken:o?.token},s={...e,...a};return Object.defineProperty(s,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),s}function Yw(){const{document:e,show:t,error:r}=sp(),n=Ww(e);return{document:e,email:(0,N.useMemo)(()=>Kw({attributes:n,readContent:()=>e?.getContent(),docId:e?.get().docId,hasSession:!!e,serverId:e?.get().serverId,show:t}),[n,e,t]),error:r}}function Xw(e){const t=pe();return(0,N.useMemo)(()=>e?M.getApi(M.getContainer(t),e):M.getContainer(t)?.getInstance(M.REST_CLIENT_ID),[t,e])}var Jw=()=>{const e=pe();return(0,N.useMemo)(()=>M.getContainer(e)?.getInstance(M.STORAGE_PROVIDER_ID),[e])},Zw=class{http;constructor(e){this.http=e}filesList=(e,t={})=>this.http.request({path:"/files",method:"GET",query:e,secure:!0,format:"json",...t});filesCreate=(e={})=>this.http.request({path:"/files",method:"POST",secure:!0,format:"json",...e});filesDelete=({id:e,...t},r={})=>this.http.request({path:`/files/${e}`,method:"DELETE",query:t,secure:!0,...r});filesDetail=({id:e,...t},r={})=>this.http.request({path:`/files/${e}`,method:"GET",query:t,secure:!0,format:"json",...r});filesPartialUpdate=({id:e},t,r={})=>this.http.request({path:`/files/${e}`,method:"PATCH",body:t,secure:!0,type:K.Json,format:"json",...r});contentList=({id:e,...t},r={})=>this.http.request({path:`/files/${e}/content`,method:"GET",query:t,secure:!0,...r});contentUpdate=({id:e},t={})=>this.http.request({path:`/files/${e}/content`,method:"PUT",secure:!0,format:"json",...t});backfillList=(e,t={})=>this.http.request({path:"/files/backfill",method:"GET",query:e,secure:!0,format:"json",...t});backfillCreate=(e,t={})=>this.http.request({path:"/files/backfill",method:"POST",body:e,secure:!0,type:K.Json,format:"json",...t});backfillCancelCreate=(e,t={})=>this.http.request({path:"/files/backfill/cancel",method:"POST",body:e,secure:!0,type:K.Json,format:"json",...t});uploadByUrlCreate=(e,t={})=>this.http.request({path:"/files/upload-by-url",method:"POST",body:e,secure:!0,type:K.Json,format:"json",...t})},e0=class{http;constructor(e){this.http=e}foldersList=(e,t={})=>this.http.request({path:"/folders",method:"GET",query:e,secure:!0,format:"json",...t});foldersCreate=(e,t={})=>this.http.request({path:"/folders",method:"POST",body:e,secure:!0,type:K.Json,format:"json",...t});foldersDelete=({id:e,...t},r={})=>this.http.request({path:`/folders/${e}`,method:"DELETE",query:t,secure:!0,...r});foldersPartialUpdate=({id:e},t,r={})=>this.http.request({path:`/folders/${e}`,method:"PATCH",body:t,secure:!0,type:K.Json,format:"json",...r})},t0=class{http;constructor(e){this.http=e}copyCreate=(e,t={})=>this.http.request({path:"/items/copy",method:"POST",body:e,secure:!0,type:K.Json,format:"json",...t});moveCreate=(e,t={})=>this.http.request({path:"/items/move",method:"POST",body:e,secure:!0,type:K.Json,format:"json",...t})},r0=class{http;constructor(e){this.http=e}emptyCreate=(e,t={})=>this.http.request({path:"/trash/empty",method:"POST",body:e,secure:!0,type:K.Json,format:"json",...t});restoreCreate=(e,t={})=>this.http.request({path:"/trash/restore",method:"POST",body:e,secure:!0,type:K.Json,format:"json",...t})},n0=class extends sl{files=new Zw(this);folders=new e0(this);items=new t0(this);trash=new r0(this)};function i0(e){const t=(M.isStateContainer(e)?M.getContainer(e):e)?.getInstance(M.CUSTOM_FETCH_ID);return new n0({baseUrl:"https://app.useblocks.io/api/v2",customFetch:t?.execute||fetch})}function o0(e){const t=xo(pt.em_filemanager_v2);return t!==void 0?t:e?.fileManagerV2Enabled!==void 0?!!e.fileManagerV2Enabled:!0}var mp=M.createIdentifier$1("EditorOptions"),qa=Sg;function a0(e){const t=typeof e.font_family=="string"?`${e.font_family}, sans-serif`:void 0,r=e.word_wrap===void 0?void 0:e.word_wrap?"on":"off";return{tabSize:e.tab_size,fontFamily:t,fontSize:e.font_size,wordWrap:r,insertSpaces:e.insert_spaces,minimap:{enabled:e.minimap}}}function hp(e){return e.getOrCreateInstance(mp,()=>{const t=Le(qa);let r=qa.fontFamily;return t.watch(n=>{!n.fontFamily||n.fontFamily===r||(r=n.fontFamily,Promise.resolve(Y_(n.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function s0(e){return e?.getInstance(mp)?.get()??qa}function u0(e,t={}){const r=hp(e);r.set(Rc({...r.get()},a0(t)))}function c0({candidates:e,headers:t,createEventSource:r,onMessage:n,onError:i}){const o=e.filter(Boolean);let a=!1,s=null;const c=()=>{s?.close(),s=null},u=h=>{if(a)return;const f=o[h];if(!f){i?.(new Error("Failed to connect to EventSource through proxy chain"));return}c();const y=r(f,{headers:t});s=y,y.onmessage=E=>{a||s!==y||n(E)},y.onerror=E=>{if(!(a||s!==y)){if(c(),h+1<o.length){u(h+1);return}i?.(E)}}};return u(0),{close(){a=!0,c()}}}var l0="https://api.unsplash.com",d0="https://api.giphy.com/v1/gifs";function Gr(e){return{error:e instanceof Error?e:new Error(String(e))}}async function gi(e){if(!e.ok)throw new Error(`Request failed with status ${e.status}`);const t=await e.text();try{return t?JSON.parse(t):null}catch(r){throw r}}function f0(e){return e&&Array.isArray(e.results)?e:e?.data&&Array.isArray(e.data.results)?e.data:e?.response&&Array.isArray(e.response.results)?e.response:{...e||{},results:[]}}var gp=be({reducerPath:"imageApi",baseQuery:void 0,endpoints:e=>({getImageInfo:e.query({queryFn:async function(t,r){try{const n=ot(M.getContainer(r)).imageInfoToolUrl||"https://scr.useblocks.io/imageinfo";return{data:await gi(await fetch(`${n}?url=${encodeURIComponent(t)}`))}}catch(n){return Gr(n)}}}),getSearchImage:e.query({queryFn:async function({query:t,page:r},n){const i=t.keywords.replace(/[^\w\d\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{const o=ot(M.getContainer(n)),a=M.getContainer(n).getInstance(M.SECURITY_MODULE_ID)!==void 0,s=new URL(`${l0}/search/photos`);return s.searchParams.set("client_id","S5iNcLqYgRBIOLQdluHdTsCJnjCvahzhG7JfYQOrV7o"),s.searchParams.set("lang","ru"),s.searchParams.set("per_page","18"),s.searchParams.set("query",i),s.searchParams.set("page",String(r)),t.color!==""&&s.searchParams.set("color",t.color),t.orientation!==""&&s.searchParams.set("orientation",t.orientation),{data:f0(await gi(await M.fetchWithResourceProxy(s.toString(),{config:o,standalone:a,resourceType:"stockImages",intent:"metadata"})))}}catch(o){return Gr(o)}}}),getUnsplashImage:e.query({queryFn:async function(t,r){try{const n=ot(M.getContainer(r)),i=M.getContainer(r).getInstance(M.SECURITY_MODULE_ID)!==void 0,o=new URL(t);return o.searchParams.set("client_id","S5iNcLqYgRBIOLQdluHdTsCJnjCvahzhG7JfYQOrV7o"),{data:await gi(await M.fetchWithResourceProxy(o.toString(),{config:n,standalone:i,resourceType:"stockImages",intent:"metadata"}))}}catch(n){return Gr(n)}}}),sendAiImageRequest:e.query({queryFn:async function({body:t},r){try{return await q(r).aiGenerator.ai_create(t)}catch(n){throw new Error(n)}}}),getAiImage:e.query({queryFn:async function(t,r){try{return await q(r).aiGenerator.ai_status_list(t)}catch(n){return Gr(n)}}}),getAiImageSSE:e.query({queryFn:t=>({data:[]}),async onCacheEntryAdded({task_id:t,entity_id:r,setError:n},i){const{updateCachedData:o,cacheEntryRemoved:a}=i,s=q(i).baseUrl||M.normalizeBaseUrl("https://app.useblocks.io/api"),c=ot(M.getContainer(i)),u=M.getContainer(i).getInstance(M.SECURITY_MODULE_ID)!==void 0,h=await M.getContainer(i).getInstance(M.TOKEN_ID),f=h?{Authorization:`Bearer ${h}`}:{},y=`${s}/ai-generator/v1/ai-status?entity_id=${r}&stream=1&task_id=${t}`,{EventSourcePolyfill:E}=await(0,et.__vitePreload)(async()=>{const{EventSourcePolyfill:C}=await Promise.resolve().then(()=>Z.__toESM(fe("./e50befab.js").default));return{EventSourcePolyfill:C}},void 0,{}.url),S=M.resolveBackendProxyRequestCandidates(y,{config:c,method:"GET",requestType:"ai",standalone:u}),v=c0({candidates:S.length>0?S:[y],headers:f,createEventSource:(C,A)=>new E(C,A),onMessage:C=>{const A=JSON.parse(C.data);o(I=>{I.push(A)}),A.progress===100&&v.close()},onError:()=>{v.close()}});await a,v.close()}}),getSearchGif:e.query({queryFn:async function({query:t,page:r},n){const i=t.keywords.replace(/[^\w\d\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{const o=ot(M.getContainer(n)),a=M.getContainer(n).getInstance(M.SECURITY_MODULE_ID)!==void 0;return{data:await gi(await M.fetchWithResourceProxy(`${d0}/search?api_key=Nh77eBlPeMn1ed9MBAvL542NUGeNO26F&q=${encodeURIComponent(i)}&limit=25&offset=${r}&lang=en`,{config:o,standalone:a,resourceType:"generic",intent:"metadata"}))}}catch(o){return Gr(o)}}})})}),{useLazyGetImageInfoQuery:p0,useGetImageInfoQuery:cR,useGetSearchImageQuery:lR,useLazyGetSearchImageQuery:m0,useSendAiImageRequestQuery:dR,useLazySendAiImageRequestQuery:h0,useGetAiImageQuery:fR,useLazyGetAiImageQuery:pR,useGetUnsplashImageQuery:mR,useLazyGetUnsplashImageQuery:g0,useGetSearchGifQuery:hR,useLazyGetSearchGifQuery:b0,useGetAiImageSSEQuery:gR,useLazyGetAiImageSSEQuery:y0}=gp,bp="Optimise",v0="usage_limit_exceeded",_0=async(e,t,r)=>{const n=q(t).baseUrl.replaceAll(/[\\/]$/g,""),i=await Oe({baseUrl:`${n}/optimization/v1/validate`})(e,t,r);if(i.error){let o=i.error;if(typeof o.json=="function")try{o=await o.json()}catch{o=await o}return{error:o}}return i},yp=be({reducerPath:"optimiseApi",tagTypes:[bp],baseQuery:_0,endpoints:e=>({editLinks:e.mutation({query:t=>({headers:{"Content-Type":"application/json",Accept:"application/json"},method:"POST",type:"application/json",url:"/links",body:t}),invalidatesTags:[bp]}),editImages:e.mutation({query:t=>({headers:{"Content-Type":"application/json",Accept:"application/json"},method:"POST",type:"application/json",url:"/images",body:t})}),editSpam:e.mutation({query:t=>({headers:{"Content-Type":"application/json",Accept:"application/json"},method:"POST",type:"application/json",url:"/spamassasin",body:t})})})}),{useEditLinksMutation:E0,useEditImagesMutation:S0,useEditSpamMutation:P0}=yp,O0={currentSchema:{},monacoDidMount:!1},T0="userSlice",vp=ge({name:T0,initialState:O0,reducers:{setMonacoDidMount:(e,{payload:t})=>{e.monacoDidMount=t}},extraReducers:e=>{e.addMatcher(Qn.endpoints.getSchema.matchFulfilled,(t,r)=>{t.currentSchema=r.payload.schema})}}),{setMonacoDidMount:C0}=vp.actions,A0={getContainer:M.getContainer,createIdentifier:M.createIdentifier$1,reducer:bb,reducerPath:fu};function I0(e){for(let t=e.length-1;t>=0;t--){const r=e[t];if(typeof r=="string"&&r)return r}}function w0(e){for(let t=0;t<e.length;t++){const r=e[t];if(r instanceof Blob)return r}}function M0(e,t){for(let r=e.length-1;r>=0;r--){const n=e[r];if(typeof n=="string"&&n&&n!==t)return n}}var R0="Image upload rejected by handleLoadImage";async function D0(e,t){const r=e.hasListeners(),n=await e.fireSettled(t);return{url:I0(n.results),hasHostListener:r,hostFailed:n.errors.length>0,error:n.errors[0]}}function N0(e,t={}){return e.url||e.hostFailed?!1:t.isStandalone?!(e.hasHostListener||t.targetIsOurBackend):!0}function j0(e){return e.error instanceof Error&&e.error.message?e.error:typeof e.error=="string"&&e.error?new Error(e.error):new Error(R0)}var _p=M.createIdentifier$1("DefaultCommonStyles");function Ep(e){return e.getOrCreateInstance(_p,()=>Le(void 0))}function L0(e){return e?.getInstance(_p)?.get()}function k0(e,t){Ep(e).set(t)}var Sp=M.createIdentifier$1("CodeErrors"),Pp=[];function F0(e){return e.getOrCreateInstance(Sp,()=>Le(Pp))}function U0(e){return e?.getInstance(Sp)?.get()??Pp}function B0(e,t){F0(e).set(t)}var $0={"doctype-html5":!1,"html-lang-require":!1,"head-script-disabled":!1,"style-disabled":!1,"script-disabled":!1,"attr-lowercase":!1,"attr-value-single-quotes":!1,"attr-value-not-empty":!1,"attr-sorted":!1,"attr-whitespace":!1,"input-requires-label":!1,"tag-self-close":!1,"tagname-lowercase":!1,"href-abs-or-rel":!1,"inline-style-disabled":!1,"space-tab-mixed-disabled":!1,"attr-no-unnecessary-whitespace":!0,"tags-check":{img:{selfclosing:!1,attrsRequired:["src","alt"]},a:{selfclosing:!1,attrsRequired:[]}},"empty-tag-not-self-closed":!1,"attr-value-double-quotes":!0,"doctype-first":!0,"tag-pair":!0,"spec-char-escape":!0,"id-unique":!0,"src-not-empty":!0,"attr-no-duplication":!0,"title-require":!0,"alt-require":!0,"inline-script-disabled":!0,"id-class-value":!1,"id-class-ad-disabled":!0,"attr-unsafe-chars":!0};Object.defineProperty(p,"AICHAT",{enumerable:!0,get:function(){return Fg}}),Object.defineProperty(p,"ANNOTATIONS_PARAMETERS",{enumerable:!0,get:function(){return Dg}}),Object.defineProperty(p,"APPEARANCE",{enumerable:!0,get:function(){return Tg}}),Object.defineProperty(p,"APP_COOKIES",{enumerable:!0,get:function(){return Qi}}),Object.defineProperty(p,"APP_ROUTES",{enumerable:!0,get:function(){return yg}}),Object.defineProperty(p,"ATOMS",{enumerable:!0,get:function(){return Gg}}),Object.defineProperty(p,"AiApi",{enumerable:!0,get:function(){return Kd}}),Object.defineProperty(p,"AiApiGenerator",{enumerable:!0,get:function(){return Xd}}),Object.defineProperty(p,"BASIC_BORDER_COLOR",{enumerable:!0,get:function(){return Lg}}),Object.defineProperty(p,"BLOCK",{enumerable:!0,get:function(){return Hg}}),Object.defineProperty(p,"BLOCKS",{enumerable:!0,get:function(){return $g}}),Object.defineProperty(p,"BLOCK_TAGS",{enumerable:!0,get:function(){return eb}}),Object.defineProperty(p,"BUILD",{enumerable:!0,get:function(){return Wi}}),Object.defineProperty(p,"BlockAutoSaveToWpBlockAutoSave",{enumerable:!0,get:function(){return sd}}),Object.defineProperty(p,"BlockPreviewShadow",{enumerable:!0,get:function(){return Vw}}),Object.defineProperty(p,"CARDS",{enumerable:!0,get:function(){return Vg}}),Object.defineProperty(p,"COLLABORATION_EDITOR_WARNING_TEXT",{enumerable:!0,get:function(){return DA}}),Object.defineProperty(p,"COMMON_STYLES",{enumerable:!0,get:function(){return cg}}),Object.defineProperty(p,"CSSTransition",{enumerable:!0,get:function(){return Ga}}),Object.defineProperty(p,"CURRENT_PROJECT_ID",{enumerable:!0,get:function(){return pr}}),Object.defineProperty(p,"CollaboratorList",{enumerable:!0,get:function(){return hC}}),Object.defineProperty(p,"ContentType",{enumerable:!0,get:function(){return K}}),Object.defineProperty(p,"DARK",{enumerable:!0,get:function(){return mg}}),Object.defineProperty(p,"DEFAULT_SANDBOX_OP_TIMEOUT_MS",{enumerable:!0,get:function(){return io}}),Object.defineProperty(p,"DEFAULT_SANDBOX_READY_TIMEOUT_MS",{enumerable:!0,get:function(){return oo}}),Object.defineProperty(p,"DISABLED_TAB",{enumerable:!0,get:function(){return Mg}}),Object.defineProperty(p,"DISCONNECT_WARNING_TEXT",{enumerable:!0,get:function(){return NA}}),Object.defineProperty(p,"DISCUSS",{enumerable:!0,get:function(){return Bg}}),Object.defineProperty(p,"DND_SOCIAL_LIST_REORDER_MIME",{enumerable:!0,get:function(){return vg}}),Object.defineProperty(p,"DocumentSessionProvider",{enumerable:!0,get:function(){return kT}}),Object.defineProperty(p,"EDIT",{enumerable:!0,get:function(){return kg}}),Object.defineProperty(p,"EDIT_SELECTED_ELEMENT",{enumerable:!0,get:function(){return iu}}),Object.defineProperty(p,"EDIT_SELECTED_TABLE_CELLS",{enumerable:!0,get:function(){return jg}}),Object.defineProperty(p,"ELEMENT_TYPES",{enumerable:!0,get:function(){return Pg}}),Object.defineProperty(p,"EMAIL",{enumerable:!0,get:function(){return ou}}),Object.defineProperty(p,"EMAIL_CODE_RULESET",{enumerable:!0,get:function(){return $0}}),Object.defineProperty(p,"EMAIL_DOCUMENTS_ID",{enumerable:!0,get:function(){return co}}),Object.defineProperty(p,"EMAIL_TAGS",{enumerable:!0,get:function(){return Zg}}),Object.defineProperty(p,"EM_SOCIAL_SELECT_ORDER",{enumerable:!0,get:function(){return Nd}}),Object.defineProperty(p,"ERROR",{enumerable:!0,get:function(){return lg}}),Object.defineProperty(p,"ERRORS",{enumerable:!0,get:function(){return Yg}}),Object.defineProperty(p,"EVENT_TYPES",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(p,"EditorModelContext",{enumerable:!0,get:function(){return Gd}}),Object.defineProperty(p,"ElementEntityKindProvider",{enumerable:!0,get:function(){return YT}}),Object.defineProperty(p,"EmIcons",{enumerable:!0,get:function(){return ti}}),Object.defineProperty(p,"EmailAutoSaveToWpEmailAutoSave",{enumerable:!0,get:function(){return Pf}}),Object.defineProperty(p,"EmailOpenFailedError",{enumerable:!0,get:function(){return _o}}),Object.defineProperty(p,"EmailToWpEmail",{enumerable:!0,get:function(){return Ca}}),Object.defineProperty(p,"FEATURE_UPSELL_SLIDE",{enumerable:!0,get:function(){return AT}}),Object.defineProperty(p,"HISTORY",{enumerable:!0,get:function(){return wg}}),Object.defineProperty(p,"ImagePickerProvider",{enumerable:!0,get:function(){return US}}),Object.defineProperty(p,"LIGHT",{enumerable:!0,get:function(){return pg}}),Object.defineProperty(p,"LOCALE_SERVICE_ID",{enumerable:!0,get:function(){return rd}}),Object.defineProperty(p,"LOCAL_STORAGE_ITEMS",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(p,"LocaleProvider",{enumerable:!0,get:function(){return LP}}),Object.defineProperty(p,"MOBILE",{enumerable:!0,get:function(){return uu}}),Object.defineProperty(p,"MODALS",{enumerable:!0,get:function(){return le}}),Object.defineProperty(p,"MOUNT_HEADLESS_MARK",{enumerable:!0,get:function(){return Dp}}),Object.defineProperty(p,"ModalRootContext",{enumerable:!0,get:function(){return gu}}),Object.defineProperty(p,"NOTIFY_COMMAND_ID",{enumerable:!0,get:function(){return Wl}}),Object.defineProperty(p,"NOT_ALL",{enumerable:!0,get:function(){return fg}}),Object.defineProperty(p,"OPTIMISE",{enumerable:!0,get:function(){return qg}}),Object.defineProperty(p,"OPTIMISE_TABS",{enumerable:!0,get:function(){return Xg}}),Object.defineProperty(p,"PENDING",{enumerable:!0,get:function(){return zg}}),Object.defineProperty(p,"PHASES",{enumerable:!0,get:function(){return St}}),Object.defineProperty(p,"PREFERS_COLOR_SCHEME_DARK",{enumerable:!0,get:function(){return bg}}),Object.defineProperty(p,"PREFERS_COLOR_SCHEME_LIGHT",{enumerable:!0,get:function(){return gg}}),Object.defineProperty(p,"PROPERTIES",{enumerable:!0,get:function(){return Ig}}),Object.defineProperty(p,"PlanUpgradePrompt",{enumerable:!0,get:function(){return TT}}),Object.defineProperty(p,"PromiseAllCatched",{enumerable:!0,get:function(){return HI}}),Object.defineProperty(p,"Provider",{enumerable:!0,get:function(){return Om}}),Object.defineProperty(p,"READ_COMMON_BLOCKS_EVENT_ID",{enumerable:!0,get:function(){return Jy}}),Object.defineProperty(p,"READ_TEMPLATE_BLOCKS_EVENT_ID",{enumerable:!0,get:function(){return Xy}}),Object.defineProperty(p,"RESET_BORDER_PARAMS",{enumerable:!0,get:function(){return xg}}),Object.defineProperty(p,"REST_EMAIL_PORTS_ID",{enumerable:!0,get:function(){return Pn}}),Object.defineProperty(p,"RootContext",{enumerable:!0,get:function(){return hu}}),Object.defineProperty(p,"RouteOutlet",{enumerable:!0,get:function(){return jy}}),Object.defineProperty(p,"SANDBOX_TRANSLATIONS_MAP",{enumerable:!0,get:function(){return tb}}),Object.defineProperty(p,"SAVE_COMMAND_ID",{enumerable:!0,get:function(){return SP}}),Object.defineProperty(p,"SETTINGS",{enumerable:!0,get:function(){return Ag}}),Object.defineProperty(p,"SOCIAL_ICON_BY_PLATFORM",{enumerable:!0,get:function(){return iT}}),Object.defineProperty(p,"SOCIAL_ICON_ORIGINAL_BY_PLATFORM",{enumerable:!0,get:function(){return Dr}}),Object.defineProperty(p,"STRUCTURE",{enumerable:!0,get:function(){return Cg}}),Object.defineProperty(p,"STYLES",{enumerable:!0,get:function(){return Ug}}),Object.defineProperty(p,"SYSTEM",{enumerable:!0,get:function(){return hg}}),Object.defineProperty(p,"TABLE_PROPERTIES",{enumerable:!0,get:function(){return Ng}}),Object.defineProperty(p,"TEMPLATE_EMAIL_ID",{enumerable:!0,get:function(){return au}}),Object.defineProperty(p,"TYPES_TRANSLATE",{enumerable:!0,get:function(){return rb}}),Object.defineProperty(p,"TextChange",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(p,"USAGE_LIMIT_EXCEEDED_CODE",{enumerable:!0,get:function(){return v0}}),Object.defineProperty(p,"UTM_PARAMETERS",{enumerable:!0,get:function(){return Rg}}),Object.defineProperty(p,"VALID",{enumerable:!0,get:function(){return Wg}}),Object.defineProperty(p,"WARNINGS",{enumerable:!0,get:function(){return Kg}}),Object.defineProperty(p,"WpBlockRevisionToBlockRevision",{enumerable:!0,get:function(){return ad}}),Object.defineProperty(p,"WpEmailRevisionToEmailRevision",{enumerable:!0,get:function(){return Sf}}),Object.defineProperty(p,"WpEmailToEmail",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(p,"WpUserToUser",{enumerable:!0,get:function(){return zn}}),Object.defineProperty(p,"_polyfill_node_global_default",{enumerable:!0,get:function(){return Wr}}),Object.defineProperty(p,"addDocumentListenerFromShadow",{enumerable:!0,get:function(){return qC}}),Object.defineProperty(p,"addWindowListenerFromShadow",{enumerable:!0,get:function(){return GC}}),Object.defineProperty(p,"api",{enumerable:!0,get:function(){return Il}}),Object.defineProperty(p,"applyEditorOptions",{enumerable:!0,get:function(){return u0}}),Object.defineProperty(p,"applyMetaPatch",{enumerable:!0,get:function(){return Qu}}),Object.defineProperty(p,"authorizationApi",{enumerable:!0,get:function(){return Qn}}),Object.defineProperty(p,"autosaveStateFromRevisions",{enumerable:!0,get:function(){return zu}}),Object.defineProperty(p,"autosaveStateFromSlots",{enumerable:!0,get:function(){return pv}}),Object.defineProperty(p,"blockPreviewHref",{enumerable:!0,get:function(){return TA}}),Object.defineProperty(p,"blockRevisionsDataSourceProvider",{enumerable:!0,get:function(){return Lu}}),Object.defineProperty(p,"blockSlice",{enumerable:!0,get:function(){return ud}}),Object.defineProperty(p,"blocksApi",{enumerable:!0,get:function(){return Jn}}),Object.defineProperty(p,"blocksDataSourceProvider",{enumerable:!0,get:function(){return ju}}),Object.defineProperty(p,"buildBlockInsertContext",{enumerable:!0,get:function(){return qy}}),Object.defineProperty(p,"buildEmailRawSharePath",{enumerable:!0,get:function(){return SA}}),Object.defineProperty(p,"buildEmailRawShareUrl",{enumerable:!0,get:function(){return EA}}),Object.defineProperty(p,"buildGetElementPreviewPath",{enumerable:!0,get:function(){return _A}}),Object.defineProperty(p,"changeConfig",{enumerable:!0,get:function(){return pa}}),Object.defineProperty(p,"clearDiagnostics",{enumerable:!0,get:function(){return Bp}}),Object.defineProperty(p,"clientFromApi",{enumerable:!0,get:function(){return q}}),Object.defineProperty(p,"cloneBlockPreviewForDrag",{enumerable:!0,get:function(){return zw}}),Object.defineProperty(p,"closeModal",{enumerable:!0,get:function(){return aO}}),Object.defineProperty(p,"closeModal$1",{enumerable:!0,get:function(){return NS}}),Object.defineProperty(p,"closeSecondModal",{enumerable:!0,get:function(){return LS}}),Object.defineProperty(p,"combineReducers",{enumerable:!0,get:function(){return wi}}),Object.defineProperty(p,"commentsApi",{enumerable:!0,get:function(){return Jd}}),Object.defineProperty(p,"commentsDataSourceProvider",{enumerable:!0,get:function(){return ku}}),Object.defineProperty(p,"commonLocale",{enumerable:!0,get:function(){return jl}}),Object.defineProperty(p,"configureStore",{enumerable:!0,get:function(){return yh}}),Object.defineProperty(p,"createApi",{enumerable:!0,get:function(){return be}}),Object.defineProperty(p,"createI18n",{enumerable:!0,get:function(){return Yo}}),Object.defineProperty(p,"createIFrame",{enumerable:!0,get:function(){return bw}}),Object.defineProperty(p,"createNewEmailDraft",{enumerable:!0,get:function(){return Ju}}),Object.defineProperty(p,"createRestClientV2",{enumerable:!0,get:function(){return i0}}),Object.defineProperty(p,"createSlice",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(p,"createState",{enumerable:!0,get:function(){return Fh}}),Object.defineProperty(p,"createZip",{enumerable:!0,get:function(){return XA}}),Object.defineProperty(p,"css",{enumerable:!0,get:function(){return _i}}),Object.defineProperty(p,"decodeFileNameFromPath",{enumerable:!0,get:function(){return ep}}),Object.defineProperty(p,"decodeFileNameFromUrl",{enumerable:!0,get:function(){return Pw}}),Object.defineProperty(p,"defaultI18nContext",{enumerable:!0,get:function(){return Hl}}),Object.defineProperty(p,"defaultModePanesSlice",{enumerable:!0,get:function(){return tf}}),Object.defineProperty(p,"detectMount",{enumerable:!0,get:function(){return Qa}}),Object.defineProperty(p,"di",{enumerable:!0,get:function(){return A0}}),Object.defineProperty(p,"drainLoaderMarks",{enumerable:!0,get:function(){return Ja}}),Object.defineProperty(p,"emCssVar",{enumerable:!0,get:function(){return fb}}),Object.defineProperty(p,"emailPageSlice",{enumerable:!0,get:function(){return pd}}),Object.defineProperty(p,"emailSlice",{enumerable:!0,get:function(){return tu}}),Object.defineProperty(p,"emailsApi",{enumerable:!0,get:function(){return Of}}),Object.defineProperty(p,"en_US_exports",{enumerable:!0,get:function(){return bP}}),Object.defineProperty(p,"executeCommand",{enumerable:!0,get:function(){return _P}}),Object.defineProperty(p,"existingTermIdFromError",{enumerable:!0,get:function(){return ES}}),Object.defineProperty(p,"failedTerms",{enumerable:!0,get:function(){return _S}}),Object.defineProperty(p,"fetchBaseQuery",{enumerable:!0,get:function(){return Uc}}),Object.defineProperty(p,"fetchBaseQueryApp",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(p,"filterUndefined",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(p,"findShadowRoot",{enumerable:!0,get:function(){return Si}}),Object.defineProperty(p,"fireUploadImageEvent",{enumerable:!0,get:function(){return D0}}),Object.defineProperty(p,"formatCodeSize",{enumerable:!0,get:function(){return eC}}),Object.defineProperty(p,"formatEmBlockVersion",{enumerable:!0,get:function(){return up}}),Object.defineProperty(p,"fromRevision",{enumerable:!0,get:function(){return yo}}),Object.defineProperty(p,"getAppConfig",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(p,"getAppNamespaceRoot",{enumerable:!0,get:function(){return za}}),Object.defineProperty(p,"getAppProject",{enumerable:!0,get:function(){return Ic}}),Object.defineProperty(p,"getBlockDesc",{enumerable:!0,get:function(){return RP}}),Object.defineProperty(p,"getBlocksProject",{enumerable:!0,get:function(){return G_}}),Object.defineProperty(p,"getBrandNamespace",{enumerable:!0,get:function(){return vi}}),Object.defineProperty(p,"getBrowserImageCompressionLibUrl",{enumerable:!0,get:function(){return mf}}),Object.defineProperty(p,"getBundledHostAssetUrl",{enumerable:!0,get:function(){return sf}}),Object.defineProperty(p,"getClient",{enumerable:!0,get:function(){return Or}}),Object.defineProperty(p,"getClientV2",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(p,"getCodeErrors",{enumerable:!0,get:function(){return U0}}),Object.defineProperty(p,"getCodeMode",{enumerable:!0,get:function(){return ld}}),Object.defineProperty(p,"getCodeSize",{enumerable:!0,get:function(){return tC}}),Object.defineProperty(p,"getComponentRegistry",{enumerable:!0,get:function(){return ny}}),Object.defineProperty(p,"getComputedStyleAsync",{enumerable:!0,get:function(){return cm}}),Object.defineProperty(p,"getConditionalComment",{enumerable:!0,get:function(){return sm}}),Object.defineProperty(p,"getCurrentProject",{enumerable:!0,get:function(){return mr}}),Object.defineProperty(p,"getCurrentUser",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(p,"getDataSources",{enumerable:!0,get:function(){return Ac}}),Object.defineProperty(p,"getDefaultCommonStyles",{enumerable:!0,get:function(){return L0}}),Object.defineProperty(p,"getDefaultSocialItemsBlocks",{enumerable:!0,get:function(){return oT}}),Object.defineProperty(p,"getDiagnosticsSnapshot",{enumerable:!0,get:function(){return Fp}}),Object.defineProperty(p,"getDiagnosticsStore",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(p,"getDisposable",{enumerable:!0,get:function(){return Nu}}),Object.defineProperty(p,"getDocType",{enumerable:!0,get:function(){return ts}}),Object.defineProperty(p,"getEditorOptions",{enumerable:!0,get:function(){return s0}}),Object.defineProperty(p,"getElementInnerHTML",{enumerable:!0,get:function(){return os}}),Object.defineProperty(p,"getElementStartHtml_VDOM",{enumerable:!0,get:function(){return Qp}}),Object.defineProperty(p,"getEmailDesc",{enumerable:!0,get:function(){return MP}}),Object.defineProperty(p,"getEmailDocuments",{enumerable:!0,get:function(){return Oo}}),Object.defineProperty(p,"getEmitter",{enumerable:!0,get:function(){return vu}}),Object.defineProperty(p,"getEvent",{enumerable:!0,get:function(){return Qb}}),Object.defineProperty(p,"getLimitUpgradePresetDefinition",{enumerable:!0,get:function(){return oC}}),Object.defineProperty(p,"getMessageService",{enumerable:!0,get:function(){return lu}}),Object.defineProperty(p,"getMimeExtension",{enumerable:!0,get:function(){return QA}}),Object.defineProperty(p,"getMimeType",{enumerable:!0,get:function(){return zA}}),Object.defineProperty(p,"getMyProjectRole",{enumerable:!0,get:function(){return hd}}),Object.defineProperty(p,"getOpenDocument",{enumerable:!0,get:function(){return wo}}),Object.defineProperty(p,"getOpenEmail",{enumerable:!0,get:function(){return $_}}),Object.defineProperty(p,"getOuterHtml",{enumerable:!0,get:function(){return Ht}}),Object.defineProperty(p,"getPublicPath",{enumerable:!0,get:function(){return af}}),Object.defineProperty(p,"getRendererString",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(p,"getResourcesSnapshot",{enumerable:!0,get:function(){return Up}}),Object.defineProperty(p,"getRestEmailPortFactories",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(p,"getRevisionServiceFlag",{enumerable:!0,get:function(){return Zu}}),Object.defineProperty(p,"getSandboxGeneration",{enumerable:!0,get:function(){return hb}}),Object.defineProperty(p,"getSocialIcon",{enumerable:!0,get:function(){return nT}}),Object.defineProperty(p,"getSocialIconForBlockCell",{enumerable:!0,get:function(){return rT}}),Object.defineProperty(p,"getSocialPresetsForBrand",{enumerable:!0,get:function(){return NT}}),Object.defineProperty(p,"getStore",{enumerable:!0,get:function(){return Yy}}),Object.defineProperty(p,"getSupportEmail",{enumerable:!0,get:function(){return CA}}),Object.defineProperty(p,"hasOwnMeta",{enumerable:!0,get:function(){return uo}}),Object.defineProperty(p,"identifyUser",{enumerable:!0,get:function(){return Iv}}),Object.defineProperty(p,"imageApi",{enumerable:!0,get:function(){return gp}}),Object.defineProperty(p,"inferImageMimeFromFileName",{enumerable:!0,get:function(){return oi}}),Object.defineProperty(p,"init__polyfill_node_global",{enumerable:!0,get:function(){return vs}}),Object.defineProperty(p,"injectBlockHistoryPort",{enumerable:!0,get:function(){return tv}}),Object.defineProperty(p,"injectEmBlockIdIntoBlockHtml",{enumerable:!0,get:function(){return kw}}),Object.defineProperty(p,"injectEmailRightsResolver",{enumerable:!0,get:function(){return _v}}),Object.defineProperty(p,"injectEmailTermsResolver",{enumerable:!0,get:function(){return d_}}),Object.defineProperty(p,"injectRestEmailPortFactories",{enumerable:!0,get:function(){return c_}}),Object.defineProperty(p,"isAMPImageElement",{enumerable:!0,get:function(){return Jp}}),Object.defineProperty(p,"isAllowedImageUploadFile",{enumerable:!0,get:function(){return cf}}),Object.defineProperty(p,"isCodeSizeExceeded",{enumerable:!0,get:function(){return rC}}),Object.defineProperty(p,"isComment",{enumerable:!0,get:function(){return Ei}}),Object.defineProperty(p,"isDiagnosticsEnabled",{enumerable:!0,get:function(){return Va}}),Object.defineProperty(p,"isDocument",{enumerable:!0,get:function(){return is}}),Object.defineProperty(p,"isDocumentFragment",{enumerable:!0,get:function(){return nm}}),Object.defineProperty(p,"isEditorLockedByPlan",{enumerable:!0,get:function(){return ia}}),Object.defineProperty(p,"isElement",{enumerable:!0,get:function(){return Vr}}),Object.defineProperty(p,"isFileManagerV2Enabled",{enumerable:!0,get:function(){return o0}}),Object.defineProperty(p,"isForm",{enumerable:!0,get:function(){return em}}),Object.defineProperty(p,"isGoogleFontsCssUrl",{enumerable:!0,get:function(){return _g}}),Object.defineProperty(p,"isHtmlElement",{enumerable:!0,get:function(){return Yp}}),Object.defineProperty(p,"isImageCenterModal",{enumerable:!0,get:function(){return mC}}),Object.defineProperty(p,"isImageEditModal",{enumerable:!0,get:function(){return pC}}),Object.defineProperty(p,"isImageElement",{enumerable:!0,get:function(){return Xp}}),Object.defineProperty(p,"isProjectsV2Enabled",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(p,"isRevisionServiceEnabled",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(p,"isScriptElement",{enumerable:!0,get:function(){return rm}}),Object.defineProperty(p,"isStandaloneRuntime",{enumerable:!0,get:function(){return hf}}),Object.defineProperty(p,"isStyleElement",{enumerable:!0,get:function(){return ns}}),Object.defineProperty(p,"isTableElement",{enumerable:!0,get:function(){return um}}),Object.defineProperty(p,"isTextNode",{enumerable:!0,get:function(){return Pi}}),Object.defineProperty(p,"isUseBlocksBuild",{enumerable:!0,get:function(){return AA}}),Object.defineProperty(p,"lazyRoute",{enumerable:!0,get:function(){return QT}}),Object.defineProperty(p,"limitsApi",{enumerable:!0,get:function(){return Id}}),Object.defineProperty(p,"loadDocumentContent",{enumerable:!0,get:function(){return Cw}}),Object.defineProperty(p,"loadGFonts",{enumerable:!0,get:function(){return UC}}),Object.defineProperty(p,"logShowPipeline",{enumerable:!0,get:function(){return qv}}),Object.defineProperty(p,"logShowPipelineError",{enumerable:!0,get:function(){return Gp}}),Object.defineProperty(p,"logShowPipelineWait",{enumerable:!0,get:function(){return xv}}),Object.defineProperty(p,"mapMargeTags",{enumerable:!0,get:function(){return mu}}),Object.defineProperty(p,"mapper",{enumerable:!0,get:function(){return _I}}),Object.defineProperty(p,"mark",{enumerable:!0,get:function(){return De}}),Object.defineProperty(p,"markAppearanceNeedsUpdate",{enumerable:!0,get:function(){return Yh}}),Object.defineProperty(p,"measureBlockPreviews",{enumerable:!0,get:function(){return xO}}),Object.defineProperty(p,"mergeEntityPreservingMeta",{enumerable:!0,get:function(){return Wu}}),Object.defineProperty(p,"minifyHtml",{enumerable:!0,get:function(){return nC}}),Object.defineProperty(p,"missingRequiredPhases",{enumerable:!0,get:function(){return jp}}),Object.defineProperty(p,"normalizeUrl",{enumerable:!0,get:function(){return QI}}),Object.defineProperty(p,"onSandboxGenerationChange",{enumerable:!0,get:function(){return gb}}),Object.defineProperty(p,"openFailureFromResponse",{enumerable:!0,get:function(){return s_}}),Object.defineProperty(p,"openModal",{enumerable:!0,get:function(){return oO}}),Object.defineProperty(p,"openModal$1",{enumerable:!0,get:function(){return El}}),Object.defineProperty(p,"openSecondModal",{enumerable:!0,get:function(){return jS}}),Object.defineProperty(p,"optimiseApi",{enumerable:!0,get:function(){return yp}}),Object.defineProperty(p,"parentEmailBlocksArgs",{enumerable:!0,get:function(){return Bw}}),Object.defineProperty(p,"parentEmailSource",{enumerable:!0,get:function(){return Uw}}),Object.defineProperty(p,"parseEmBlockVersion",{enumerable:!0,get:function(){return jw}}),Object.defineProperty(p,"parseFromString",{enumerable:!0,get:function(){return Vf}}),Object.defineProperty(p,"parseISO",{enumerable:!0,get:function(){return by}}),Object.defineProperty(p,"pickFileProxyBlobFromFireResults",{enumerable:!0,get:function(){return w0}}),Object.defineProperty(p,"pickProxyUrlOverrideFromFireResults",{enumerable:!0,get:function(){return M0}}),Object.defineProperty(p,"prepareEmailHtmlForEditor",{enumerable:!0,get:function(){return aw}}),Object.defineProperty(p,"prepareImageForEditorUpload",{enumerable:!0,get:function(){return sA}}),Object.defineProperty(p,"prepareImageForUpload",{enumerable:!0,get:function(){return pf}}),Object.defineProperty(p,"presetLimitDisplay",{enumerable:!0,get:function(){return aC}}),Object.defineProperty(p,"previewHrefForRacs",{enumerable:!0,get:function(){return OA}}),Object.defineProperty(p,"processAmp",{enumerable:!0,get:function(){return Tw}}),Object.defineProperty(p,"projectBlocksArgs",{enumerable:!0,get:function(){return Fw}}),Object.defineProperty(p,"projectGroupsLoaded",{enumerable:!0,get:function(){return Zh}}),Object.defineProperty(p,"projectSettingsV2Api",{enumerable:!0,get:function(){return ga}}),Object.defineProperty(p,"projectsApi",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(p,"projectsPageSlice",{enumerable:!0,get:function(){return _l}}),Object.defineProperty(p,"provideAutosaveUiFacts",{enumerable:!0,get:function(){return Pc}}),Object.defineProperty(p,"provideCodeMode",{enumerable:!0,get:function(){return Zn}}),Object.defineProperty(p,"provideCurrentProject",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(p,"provideCurrentUser",{enumerable:!0,get:function(){return Po}}),Object.defineProperty(p,"provideDefaultCommonStyles",{enumerable:!0,get:function(){return Ep}}),Object.defineProperty(p,"provideEditorOptions",{enumerable:!0,get:function(){return hp}}),Object.defineProperty(p,"provideEmailDocuments",{enumerable:!0,get:function(){return bv}}),Object.defineProperty(p,"provideHeadlessMode",{enumerable:!0,get:function(){return Ti}}),Object.defineProperty(p,"readDocumentContent",{enumerable:!0,get:function(){return Ld}}),Object.defineProperty(p,"readLocalToggle",{enumerable:!0,get:function(){return xo}}),Object.defineProperty(p,"readRootEmBlockAttrs",{enumerable:!0,get:function(){return Lw}}),Object.defineProperty(p,"readZip",{enumerable:!0,get:function(){return wf}}),Object.defineProperty(p,"readZipFromBase64",{enumerable:!0,get:function(){return JA}}),Object.defineProperty(p,"reducerPath",{enumerable:!0,get:function(){return fu}}),Object.defineProperty(p,"registerBlockInsertPending",{enumerable:!0,get:function(){return V_}}),Object.defineProperty(p,"rememberAutosaveTime",{enumerable:!0,get:function(){return Vh}}),Object.defineProperty(p,"reportError",{enumerable:!0,get:function(){return nc}}),Object.defineProperty(p,"reportMessage",{enumerable:!0,get:function(){return Av}}),Object.defineProperty(p,"require_prop_types",{enumerable:!0,get:function(){return vm}}),Object.defineProperty(p,"requiredArgs",{enumerable:!0,get:function(){return Su}}),Object.defineProperty(p,"requiredPhases",{enumerable:!0,get:function(){return Ka}}),Object.defineProperty(p,"resetBlockSlice",{enumerable:!0,get:function(){return WP}}),Object.defineProperty(p,"resetElementHistorySlice",{enumerable:!0,get:function(){return IA}}),Object.defineProperty(p,"resetEmailSlice",{enumerable:!0,get:function(){return Hh}}),Object.defineProperty(p,"resetPanes",{enumerable:!0,get:function(){return DC}}),Object.defineProperty(p,"resetParentBlocks",{enumerable:!0,get:function(){return hO}}),Object.defineProperty(p,"resetToLastActiveSettingsTab",{enumerable:!0,get:function(){return uO}}),Object.defineProperty(p,"resolveContentReadyTimeoutMs",{enumerable:!0,get:function(){return ov}}),Object.defineProperty(p,"resolveEmailPort",{enumerable:!0,get:function(){return To}}),Object.defineProperty(p,"resolveImageCompressionLimits",{enumerable:!0,get:function(){return df}}),Object.defineProperty(p,"resolveSandboxOpTimeoutMs",{enumerable:!0,get:function(){return Hu}}),Object.defineProperty(p,"resolveSandboxReadyTimeoutMs",{enumerable:!0,get:function(){return av}}),Object.defineProperty(p,"resolveSequentialSandboxOpBudgetMs",{enumerable:!0,get:function(){return iv}}),Object.defineProperty(p,"resolveTemplateDirectivesConfig",{enumerable:!0,get:function(){return bI}}),Object.defineProperty(p,"revisionHistorySlice",{enumerable:!0,get:function(){return Ta}}),Object.defineProperty(p,"runBlockInsertHtmlPipeline",{enumerable:!0,get:function(){return ey}}),Object.defineProperty(p,"runElementInsertHtmlPipeline",{enumerable:!0,get:function(){return Zb}}),Object.defineProperty(p,"runOnceInFlight",{enumerable:!0,get:function(){return $C}}),Object.defineProperty(p,"sanitizeHtml",{enumerable:!0,get:function(){return Ad}}),Object.defineProperty(p,"saveFileApi",{enumerable:!0,get:function(){return Yd}}),Object.defineProperty(p,"saveRefusalReason",{enumerable:!0,get:function(){return $v}}),Object.defineProperty(p,"selectActiveModal",{enumerable:!0,get:function(){return _O}}),Object.defineProperty(p,"selectActiveModal$1",{enumerable:!0,get:function(){return Sl}}),Object.defineProperty(p,"selectActiveProblemRange",{enumerable:!0,get:function(){return sg}}),Object.defineProperty(p,"selectActiveSettingsTab",{enumerable:!0,get:function(){return CO}}),Object.defineProperty(p,"selectBlockSettings",{enumerable:!0,get:function(){return YP}}),Object.defineProperty(p,"selectCodeModeDirection",{enumerable:!0,get:function(){return TO}}),Object.defineProperty(p,"selectEditorThemeColor",{enumerable:!0,get:function(){return JP}}),Object.defineProperty(p,"selectEditorThemeColor$1",{enumerable:!0,get:function(){return og}}),Object.defineProperty(p,"selectElementHistoryHasMore",{enumerable:!0,get:function(){return wA}}),Object.defineProperty(p,"selectElementSettings",{enumerable:!0,get:function(){return XP}}),Object.defineProperty(p,"selectElementSettings$1",{enumerable:!0,get:function(){return ig}}),Object.defineProperty(p,"selectEmailSettings",{enumerable:!0,get:function(){return tg}}),Object.defineProperty(p,"selectEmailViewType",{enumerable:!0,get:function(){return SO}}),Object.defineProperty(p,"selectEmailWidth",{enumerable:!0,get:function(){return vO}}),Object.defineProperty(p,"selectHistoryData",{enumerable:!0,get:function(){return MA}}),Object.defineProperty(p,"selectIsCodeMode",{enumerable:!0,get:function(){return yO}}),Object.defineProperty(p,"selectIsCodeMode$1",{enumerable:!0,get:function(){return KP}}),Object.defineProperty(p,"selectIsGlobalLoading",{enumerable:!0,get:function(){return PO}}),Object.defineProperty(p,"selectIsHeaderCodeMenuOpen",{enumerable:!0,get:function(){return IO}}),Object.defineProperty(p,"selectIsNeedUpdateAppearance",{enumerable:!0,get:function(){return ug}}),Object.defineProperty(p,"selectIsNeedUpdateContentAppearance",{enumerable:!0,get:function(){return eg}}),Object.defineProperty(p,"selectIsPanelHistoryCollapsed",{enumerable:!0,get:function(){return wO}}),Object.defineProperty(p,"selectIsSettingsDisabled",{enumerable:!0,get:function(){return ZP}}),Object.defineProperty(p,"selectIsSettingsDisabled$1",{enumerable:!0,get:function(){return ag}}),Object.defineProperty(p,"selectMobileViewActive",{enumerable:!0,get:function(){return OO}}),Object.defineProperty(p,"selectMonacoFocusing",{enumerable:!0,get:function(){return jC}}),Object.defineProperty(p,"selectParentBlocks",{enumerable:!0,get:function(){return EO}}),Object.defineProperty(p,"selectProblemsList",{enumerable:!0,get:function(){return rg}}),Object.defineProperty(p,"selectProjectGroups",{enumerable:!0,get:function(){return ng}}),Object.defineProperty(p,"selectPropertiesPanelKey",{enumerable:!0,get:function(){return AO}}),Object.defineProperty(p,"selectSecondModal",{enumerable:!0,get:function(){return kS}}),Object.defineProperty(p,"setActiveProblemRange",{enumerable:!0,get:function(){return Wh}}),Object.defineProperty(p,"setActiveSettingsTab",{enumerable:!0,get:function(){return sO}}),Object.defineProperty(p,"setAttributeSafe",{enumerable:!0,get:function(){return Hf}}),Object.defineProperty(p,"setBlockSettings",{enumerable:!0,get:function(){return VP}}),Object.defineProperty(p,"setBlockSettingsDisable",{enumerable:!0,get:function(){return QP}}),Object.defineProperty(p,"setCachedProjectFonts",{enumerable:!0,get:function(){return LC}}),Object.defineProperty(p,"setCodeErrors",{enumerable:!0,get:function(){return B0}}),Object.defineProperty(p,"setCodeMode",{enumerable:!0,get:function(){return pO}}),Object.defineProperty(p,"setCodeMode$1",{enumerable:!0,get:function(){return dd}}),Object.defineProperty(p,"setCodeModeDirection",{enumerable:!0,get:function(){return rO}}),Object.defineProperty(p,"setCurrentProjectCard",{enumerable:!0,get:function(){return L_}}),Object.defineProperty(p,"setCurrentProjectRefreshing",{enumerable:!0,get:function(){return j_}}),Object.defineProperty(p,"setDefaultCommonStyles",{enumerable:!0,get:function(){return k0}}),Object.defineProperty(p,"setEditorThemeColor",{enumerable:!0,get:function(){return HP}}),Object.defineProperty(p,"setEditorThemeColor$1",{enumerable:!0,get:function(){return $h}}),Object.defineProperty(p,"setElementSettings",{enumerable:!0,get:function(){return zP}}),Object.defineProperty(p,"setElementSettings$1",{enumerable:!0,get:function(){return qh}}),Object.defineProperty(p,"setEmailGroups",{enumerable:!0,get:function(){return Kh}}),Object.defineProperty(p,"setEmailSettings",{enumerable:!0,get:function(){return Gh}}),Object.defineProperty(p,"setEmailSettingsDisable",{enumerable:!0,get:function(){return xh}}),Object.defineProperty(p,"setEmailWidth",{enumerable:!0,get:function(){return lO}}),Object.defineProperty(p,"setHeaderCodeMenuOpen",{enumerable:!0,get:function(){return bO}}),Object.defineProperty(p,"setHeadlessMode",{enumerable:!0,get:function(){return pm}}),Object.defineProperty(p,"setHiddenMount",{enumerable:!0,get:function(){return gm}}),Object.defineProperty(p,"setIsGlobalLoading",{enumerable:!0,get:function(){return gO}}),Object.defineProperty(p,"setIsNeedUpdateAppearance",{enumerable:!0,get:function(){return Xh}}),Object.defineProperty(p,"setIsNeedUpdateContentAppearance",{enumerable:!0,get:function(){return Jh}}),Object.defineProperty(p,"setMobileViewActive",{enumerable:!0,get:function(){return fO}}),Object.defineProperty(p,"setMonacoDidMount",{enumerable:!0,get:function(){return C0}}),Object.defineProperty(p,"setMonacoFocusing",{enumerable:!0,get:function(){return NC}}),Object.defineProperty(p,"setProblemsList",{enumerable:!0,get:function(){return Qh}}),Object.defineProperty(p,"setPropertiesPanelKey",{enumerable:!0,get:function(){return mO}}),Object.defineProperty(p,"setupListeners",{enumerable:!0,get:function(){return fE}}),Object.defineProperty(p,"shouldEnableImageCompression",{enumerable:!0,get:function(){return lf}}),Object.defineProperty(p,"shouldFallbackToBuiltInUpload",{enumerable:!0,get:function(){return N0}}),Object.defineProperty(p,"subscribeToContent",{enumerable:!0,get:function(){return FT}}),Object.defineProperty(p,"swallowPromiseRejection",{enumerable:!0,get:function(){return BC}}),Object.defineProperty(p,"switchCodeModeDirection",{enumerable:!0,get:function(){return dO}}),Object.defineProperty(p,"switchIsPanelHistoryCollapsed",{enumerable:!0,get:function(){return cO}}),Object.defineProperty(p,"syncBlockCacheAfterInsertPipeline",{enumerable:!0,get:function(){return W_}}),Object.defineProperty(p,"taxonomiesApi",{enumerable:!0,get:function(){return xn}}),Object.defineProperty(p,"templateBlocksArgs",{enumerable:!0,get:function(){return $w}}),Object.defineProperty(p,"themeTokenCssVarName",{enumerable:!0,get:function(){return pb}}),Object.defineProperty(p,"toAbsolute",{enumerable:!0,get:function(){return Ha}}),Object.defineProperty(p,"toAbsoluteUrl",{enumerable:!0,get:function(){return Kf}}),Object.defineProperty(p,"toLanguageCode",{enumerable:!0,get:function(){return lA}}),Object.defineProperty(p,"toNumberSafe",{enumerable:!0,get:function(){return de}}),Object.defineProperty(p,"toUploadImageError",{enumerable:!0,get:function(){return j0}}),Object.defineProperty(p,"toggleCodeMode",{enumerable:!0,get:function(){return tO}}),Object.defineProperty(p,"transformListResponseFn",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(p,"transformResponseFn",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(p,"uploadFile",{enumerable:!0,get:function(){return Ow}}),Object.defineProperty(p,"useAddBlockMutation",{enumerable:!0,get:function(){return $P}}),Object.defineProperty(p,"useAddCommentMutation",{enumerable:!0,get:function(){return IC}}),Object.defineProperty(p,"useAddEmailMutation",{enumerable:!0,get:function(){return qA}}),Object.defineProperty(p,"useAddTermMutation",{enumerable:!0,get:function(){return IS}}),Object.defineProperty(p,"useAppConfig",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(p,"useAppDispatch",{enumerable:!0,get:function(){return $S}}),Object.defineProperty(p,"useAppNavigate",{enumerable:!0,get:function(){return ro}}),Object.defineProperty(p,"useAppSearchParams",{enumerable:!0,get:function(){return Fy}}),Object.defineProperty(p,"useAppStore",{enumerable:!0,get:function(){return Al}}),Object.defineProperty(p,"useAutoSaveBlockMutation",{enumerable:!0,get:function(){return qP}}),Object.defineProperty(p,"useCommand",{enumerable:!0,get:function(){return Ql}}),Object.defineProperty(p,"useConfigSource",{enumerable:!0,get:function(){return Ki}}),Object.defineProperty(p,"useContainer",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(p,"useContentReader",{enumerable:!0,get:function(){return jA}}),Object.defineProperty(p,"useContentReplacer",{enumerable:!0,get:function(){return Iw}}),Object.defineProperty(p,"useCookieManager",{enumerable:!0,get:function(){return md}}),Object.defineProperty(p,"useCurrentProjectRequested",{enumerable:!0,get:function(){return JT}}),Object.defineProperty(p,"useCurrentSession",{enumerable:!0,get:function(){return sp}}),Object.defineProperty(p,"useCurrentUser",{enumerable:!0,get:function(){return na}}),Object.defineProperty(p,"useCurrentUserLocale",{enumerable:!0,get:function(){return NO}}),Object.defineProperty(p,"useDeleteCommentMutation",{enumerable:!0,get:function(){return wC}}),Object.defineProperty(p,"useDeleteTargetMutation",{enumerable:!0,get:function(){return RC}}),Object.defineProperty(p,"useDeleteTermMutation",{enumerable:!0,get:function(){return MS}}),Object.defineProperty(p,"useDispatch",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(p,"useDocumentHistoryReader",{enumerable:!0,get:function(){return RA}}),Object.defineProperty(p,"useDocumentSessionContext",{enumerable:!0,get:function(){return jr}}),Object.defineProperty(p,"useEditBlockMutation",{enumerable:!0,get:function(){return GP}}),Object.defineProperty(p,"useEditCommentMutation",{enumerable:!0,get:function(){return MC}}),Object.defineProperty(p,"useEditEmailMutation",{enumerable:!0,get:function(){return xA}}),Object.defineProperty(p,"useEditImagesMutation",{enumerable:!0,get:function(){return S0}}),Object.defineProperty(p,"useEditLinksMutation",{enumerable:!0,get:function(){return E0}}),Object.defineProperty(p,"useEditMeMutation",{enumerable:!0,get:function(){return QS}}),Object.defineProperty(p,"useEditProjectMutation",{enumerable:!0,get:function(){return yS}}),Object.defineProperty(p,"useEditSpamMutation",{enumerable:!0,get:function(){return P0}}),Object.defineProperty(p,"useEditTermMutation",{enumerable:!0,get:function(){return wS}}),Object.defineProperty(p,"useEditorProjectId",{enumerable:!0,get:function(){return ZT}}),Object.defineProperty(p,"useElementEntityKind",{enumerable:!0,get:function(){return XT}}),Object.defineProperty(p,"useEmailAttribute",{enumerable:!0,get:function(){return VA}}),Object.defineProperty(p,"useEmailAttributesWriter",{enumerable:!0,get:function(){return HA}}),Object.defineProperty(p,"useEvent",{enumerable:!0,get:function(){return Wb}}),Object.defineProperty(p,"useEventEmitter",{enumerable:!0,get:function(){return Xi}}),Object.defineProperty(p,"useFitBlockPreviewHeight",{enumerable:!0,get:function(){return zO}}),Object.defineProperty(p,"useGetAiGenerateStatusMutation",{enumerable:!0,get:function(){return CC}}),Object.defineProperty(p,"useGetBlocksQuery",{enumerable:!0,get:function(){return FP}}),Object.defineProperty(p,"useGetBlocksSchemaQuery",{enumerable:!0,get:function(){return UP}}),Object.defineProperty(p,"useGetCommentsQuery",{enumerable:!0,get:function(){return AC}}),Object.defineProperty(p,"useGetDialogQuery",{enumerable:!0,get:function(){return bC}}),Object.defineProperty(p,"useGetParentEmailBlocksQuery",{enumerable:!0,get:function(){return BP}}),Object.defineProperty(p,"useGetProjectIntegrationsQuery",{enumerable:!0,get:function(){return mT}}),Object.defineProperty(p,"useGetProjectPlanQuery",{enumerable:!0,get:function(){return ba}}),Object.defineProperty(p,"useGetProjectQuery",{enumerable:!0,get:function(){return bS}}),Object.defineProperty(p,"useGetProjectTestRecipientsQuery",{enumerable:!0,get:function(){return bT}}),Object.defineProperty(p,"useGetProjectWebhookQuery",{enumerable:!0,get:function(){return gT}}),Object.defineProperty(p,"useGetSubscriptionsQuery",{enumerable:!0,get:function(){return Ml}}),Object.defineProperty(p,"useGetTemplateBlocksQuery",{enumerable:!0,get:function(){return xP}}),Object.defineProperty(p,"useGetTermsQuery",{enumerable:!0,get:function(){return AS}}),Object.defineProperty(p,"useHeadless",{enumerable:!0,get:function(){return Ib}}),Object.defineProperty(p,"useI18n",{enumerable:!0,get:function(){return Rr}}),Object.defineProperty(p,"useImagePicker",{enumerable:!0,get:function(){return BS}}),Object.defineProperty(p,"useIntegratorConfigValue",{enumerable:!0,get:function(){return Ab}}),Object.defineProperty(p,"useInterfaceLocale",{enumerable:!0,get:function(){return jP}}),Object.defineProperty(p,"useInvalidateProject",{enumerable:!0,get:function(){return gS}}),Object.defineProperty(p,"useInvalidateTerms",{enumerable:!0,get:function(){return CS}}),Object.defineProperty(p,"useIsLocaleInited",{enumerable:!0,get:function(){return zb}}),Object.defineProperty(p,"useIsStandalone",{enumerable:!0,get:function(){return uA}}),Object.defineProperty(p,"useLazyClearAiChatQuery",{enumerable:!0,get:function(){return OC}}),Object.defineProperty(p,"useLazyGetAiImageSSEQuery",{enumerable:!0,get:function(){return y0}}),Object.defineProperty(p,"useLazyGetDialogQuery",{enumerable:!0,get:function(){return yC}}),Object.defineProperty(p,"useLazyGetGeneratedContentQuery",{enumerable:!0,get:function(){return TC}}),Object.defineProperty(p,"useLazyGetImageInfoQuery",{enumerable:!0,get:function(){return p0}}),Object.defineProperty(p,"useLazyGetIntegrationCredentialsQuery",{enumerable:!0,get:function(){return hT}}),Object.defineProperty(p,"useLazyGetLimitsStatsByTypeQuery",{enumerable:!0,get:function(){return dT}}),Object.defineProperty(p,"useLazyGetMeQuery",{enumerable:!0,get:function(){return wl}}),Object.defineProperty(p,"useLazyGetSearchGifQuery",{enumerable:!0,get:function(){return b0}}),Object.defineProperty(p,"useLazyGetSearchImageQuery",{enumerable:!0,get:function(){return m0}}),Object.defineProperty(p,"useLazyGetUnsplashImageQuery",{enumerable:!0,get:function(){return g0}}),Object.defineProperty(p,"useLazySendAiImageRequestQuery",{enumerable:!0,get:function(){return h0}}),Object.defineProperty(p,"useListenPostMessage",{enumerable:!0,get:function(){return LT}}),Object.defineProperty(p,"useMessageService",{enumerable:!0,get:function(){return bn}}),Object.defineProperty(p,"useModalRootElement",{enumerable:!0,get:function(){return Vb}}),Object.defineProperty(p,"useModel",{enumerable:!0,get:function(){return KT}}),Object.defineProperty(p,"useNotification",{enumerable:!0,get:function(){return Xn}}),Object.defineProperty(p,"useNotifyCommand",{enumerable:!0,get:function(){return DP}}),Object.defineProperty(p,"useOpenEmail",{enumerable:!0,get:function(){return Yw}}),Object.defineProperty(p,"useOpenPlanCatalog",{enumerable:!0,get:function(){return cA}}),Object.defineProperty(p,"usePlanFeatureGate",{enumerable:!0,get:function(){return MT}}),Object.defineProperty(p,"usePlanFeatureLocks",{enumerable:!0,get:function(){return wT}}),Object.defineProperty(p,"usePrevious",{enumerable:!0,get:function(){return Gl}}),Object.defineProperty(p,"useProjectData",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(p,"useProjectPlanLimitPreflight",{enumerable:!0,get:function(){return lC}}),Object.defineProperty(p,"useProjectPlanLimits",{enumerable:!0,get:function(){return cC}}),Object.defineProperty(p,"usePushToDataLayer",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(p,"usePutProjectTestRecipientsMutation",{enumerable:!0,get:function(){return yT}}),Object.defineProperty(p,"useRestClient",{enumerable:!0,get:function(){return Xw}}),Object.defineProperty(p,"useRootElement",{enumerable:!0,get:function(){return Hb}}),Object.defineProperty(p,"useRouteEmailId",{enumerable:!0,get:function(){return jO}}),Object.defineProperty(p,"useRouteParams",{enumerable:!0,get:function(){return to}}),Object.defineProperty(p,"useRoutePathname",{enumerable:!0,get:function(){return Ly}}),Object.defineProperty(p,"useSelector",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(p,"useSendLivePreviewMutation",{enumerable:!0,get:function(){return EC}}),Object.defineProperty(p,"useSendMessageMutation",{enumerable:!0,get:function(){return gC}}),Object.defineProperty(p,"useSendPostMessage",{enumerable:!0,get:function(){return qb}}),Object.defineProperty(p,"useSendPostMessageEx",{enumerable:!0,get:function(){return xb}}),Object.defineProperty(p,"useSendShortLinkMutation",{enumerable:!0,get:function(){return SC}}),Object.defineProperty(p,"useSendTestEmailMutation",{enumerable:!0,get:function(){return _C}}),Object.defineProperty(p,"useServices",{enumerable:!0,get:function(){return vb}}),Object.defineProperty(p,"useStorageProvider",{enumerable:!0,get:function(){return Jw}}),Object.defineProperty(p,"useStore",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(p,"useUploadImageMutation",{enumerable:!0,get:function(){return vC}}),Object.defineProperty(p,"userSlice",{enumerable:!0,get:function(){return vp}}),Object.defineProperty(p,"v2ResultOf",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(p,"writeEmailAttributes",{enumerable:!0,get:function(){return fc}}),Object.defineProperty(p,"writePendingData",{enumerable:!0,get:function(){return Eo}}),Object.defineProperty(p,"writeSourceReport",{enumerable:!0,get:function(){return go}}),Object.defineProperty(p,"zipEntryToBlob",{enumerable:!0,get:function(){return eI}}),Object.defineProperty(p,"zipEntryToText",{enumerable:!0,get:function(){return ZA}})});
|
|
64
64
|
|
|
65
|
-
__useblocks__.define("static/core/
|
|
65
|
+
__useblocks__.define("static/core/d3e05bb9.js",["require","exports","module","static/core/fe480726.js","static/core/c00a8e02.js","react"],function(j,m,U){const b=j("./fe480726.js"),o=j("./c00a8e02.js");let _=j("react");function M(e){const t=o.parseISO(e);return isNaN(t)?new Date(e):t}var E=new Map;function v(e){let t=E.get(e);return t||(t={shortDate:new Intl.DateTimeFormat(e,{dateStyle:"short"}),shortTime:new Intl.DateTimeFormat(e,{timeStyle:"short"})},E.set(e,t)),t}var C=(e,t,n=!1)=>{e instanceof Date;const r=new Date,s=e.getDate()===r.getDate()&&e.getMonth()===r.getMonth()&&e.getFullYear()===r.getFullYear();if(n&&s){const a=Math.floor((r-e)/1e3),c=Math.floor(a/60),l=Math.floor(c/60);if(a<60)return t("Just now");if(l>0){const i=c%60;return`${l} ${t("hour","hours",l)} ${i} ${t("minute","minutes",i)}`}else return`${c} ${t("minute","minutes",c)}`}else{const{shortDate:a,shortTime:c}=v(navigator.language);return a.format(e)+" "+c.format(e)}},H=e=>{const t=e.match(/(\(copy\))( \d+)?$/),n=t?.[1],r=t?.[2];return n?r?`${e.slice(0,-r.length)} ${+r.slice(1)+1}`:`${e} 2`:`${e} (copy)`};function w(e,t,n){const r=new Map,s=new RegExp(`(${t})(.*?)(${n})`,"gis");return e=e.replaceAll(s,(a,c,l,i)=>{const u=b.generateUUID();return r.set(u,l),c+u+i}),{escapes:r,html:e}}function D(e,t){let n=[];for(const[r,s]of t){const{escapes:a,html:c}=w(e,r,s);e=c,n.push([r,s,a])}return{escapes:n,html:e}}function N(e,t,n,r){const s=new RegExp(`(${t})(.*?)(${n})`,"gis");return e.replaceAll(s,(a,c,l,i)=>{const u=r.get(l);return typeof u=="string"?c+u+i:a})}function R(e,t){for(const[n,r,s]of t)e=N(e,n,r,s);return e}var O=/<title>([\s\S]*?)<\/title>/gim;function k(e){return e==null?"":String(e).replace(/\s+/g," ").trim()}var $=(e,t)=>{const{escapes:n,html:r}=D(e,[["<style.*?>","<\\/style>"],["<script.*?>","<\\/script>"],["<\\!--","-->"]]);let s=r;return s=s.replaceAll(O,(a,c)=>{if(t==null)return a;const l=k(c);return l===k(t)?`<title>${H(l)}</title>`:a}),R(s,n.reverse())};function A(e){let{html:t}=D(e,[["<style.*?>","<\\/style>"],["<script.*?>","<\\/script>"],["<\\!--","-->"]]);return[...t.matchAll(O)].map(n=>k(n[1])).find(n=>!!n)}var L=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,F=()=>{const e=o.useSendPostMessage(),t=o.useRootElement(),n=o.useStore(),{projectId:r}=o.useRouteParams(),s=o.useProjectData();return(0,_.useCallback)(async(a,c,l,i,u)=>{t.querySelectorAll(".block-search__preview").forEach(K=>K.remove());const f=t.querySelector("#iframe-scroll-top"),y=t.querySelector("#iframe-scroll-bottom"),p=t.querySelector("#email_iframe_slot"),S=document.body.getBoundingClientRect().height,h=p.getClientRects()[0];h.top<0&&(f.style.display="block"),h.top+h.height>S&&(y.style.display="block");const I=l==="project"||l==="template"||l==="common"?"block":"structure",T=b.getContainer(n),P=s?.id??r,d=o.buildBlockInsertContext(u,{html:c||"",insertFrom:l,fragmentRole:I,name:i,project:P}),g=await o.runBlockInsertHtmlPipeline(T,{...d});await o.syncBlockCacheAfterInsertPipeline(T,d,g),o.registerBlockInsertPending(g,T);const J=g.project!==void 0&&g.project!==null?String(g.project):String(P??""),B={operation:o.EVENT_TYPES.SANDBOX_BLOCK_INSERT,settings:{blockHTML:g.html||null,targetBlock:null,project:J,type:l,name:g.name??i,blockId:g.id!=null?String(g.id):void 0}};a.dataTransfer.setData("Text",JSON.stringify(B)),e(B)},[e,t,n,r,s])},z=()=>{const e=o.useSendPostMessage(),t=o.useRootElement(),n=o.useStore();return(0,_.useCallback)(async(r,s,a)=>{if(!a(s))return;const c=t.querySelector("#iframe-scroll-top"),l=t.querySelector("#iframe-scroll-bottom"),i=t.querySelector("#email_iframe_slot"),u=document.body.getBoundingClientRect().height,f=i.getClientRects()[0];f.top<0&&(c.style.display="block"),f.top+f.height>u&&(l.style.display="block");const y=b.getContainer(n),p=await o.runElementInsertHtmlPipeline(y,{name:s?.name??"",className:s?.className??"",html:s?.html??""}),S={operation:o.EVENT_TYPES.SANDBOX_ATOM_INSERT,settings:{atomHTML:p.html||null,targetBlock:null,name:p.name??s.name}};r.dataTransfer.setData("Text",JSON.stringify(S)),e(S)},[e,t,n])},q=()=>{const e=o.useSendPostMessage(),t=o.usePushToDataLayer(),{emailId:n,blockId:r,projectId:s}=o.useRouteParams(),a=o.useProjectData(),c=o.useStore();return(0,_.useCallback)(async(l,i,u,f,y)=>{const p=u==="project"||u==="template"||u==="common"?"block":"structure",S=p==="block"?f||u||"block":f||u||"structure",h=p==="block"?"block":"structure",I=b.getContainer(c),T=a?.id??s,P=o.buildBlockInsertContext(y,{html:i||"",insertFrom:u,fragmentRole:h,name:S,project:T}),d=await o.runBlockInsertHtmlPipeline(I,{...P});await o.syncBlockCacheAfterInsertPipeline(I,P,d),o.registerBlockInsertPending(d,I);const g=d.project!==void 0&&d.project!==null?String(d.project):String(T??"");e({operation:o.EVENT_TYPES.SANDBOX_BLOCK_INSERT,action:"insert",settings:{blockHTML:d.html,type:u,name:d.name??S,project:g,blockId:d.id!=null?String(d.id):void 0}}),t({event:"add",action:"add_element_to_email",element_type:p,element_name:S,entity_id:n||r,project_id:a?.id||s})},[e,t,n,r,s,a,c])},V=()=>{const e=o.useSendPostMessage(),t=o.usePushToDataLayer(),{emailId:n,blockId:r,projectId:s}=o.useRouteParams(),a=o.useProjectData(),c=o.useStore();return(0,_.useCallback)(async(l,i)=>{const u=b.getContainer(c),f=await o.runElementInsertHtmlPipeline(u,{name:i?.name??"",className:i?.className??"",html:i?.html??""});e({operation:o.EVENT_TYPES.SANDBOX_ATOM_INSERT,action:"insert",settings:{atomHTML:f.html||null,targetBlock:null,name:f.name??i?.name}}),t({event:"add",action:"add_element_to_email",element_type:"atom",element_name:i.name||"atom",entity_id:n||r,project_id:a?.id||s})},[e,t,n,r,s,a,c])},Y=(e,t)=>{t.success({mask:{closable:!0},centered:!0,title:e("Coming soon"),content:e("The feature is under development."),okText:e("Ok. I'll be waiting"),onOk:()=>{}})},X=()=>{const e=o.useSendPostMessage();return(t,n)=>{e({operation:o.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,settings:t,type:n})}},G=(e,t="")=>{const n=[];return e&&e._embedded?.["wp:term"]?.filter(r=>!!r.length&&(t?r[0]?.taxonomy===t:!0)).forEach(r=>{const s=r[0].taxonomy;n[s]||(n[s]=[]),n[s]=r.map(a=>({id:a.id,name:a.name,children:a.children})),n[n.length]=n[s]}),t!==""&&n.length?n[t]:n};Object.defineProperty(m,"comingSoonHandler",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(m,"emailValidation",{enumerable:!0,get:function(){return L}}),Object.defineProperty(m,"formatDate",{enumerable:!0,get:function(){return C}}),Object.defineProperty(m,"generateCopyHtml",{enumerable:!0,get:function(){return $}}),Object.defineProperty(m,"generateCopyTitle",{enumerable:!0,get:function(){return H}}),Object.defineProperty(m,"getTaxonomy",{enumerable:!0,get:function(){return G}}),Object.defineProperty(m,"getTitleFromHtml",{enumerable:!0,get:function(){return A}}),Object.defineProperty(m,"tryParseISO",{enumerable:!0,get:function(){return M}}),Object.defineProperty(m,"useDragStartAtomToIframeHandler",{enumerable:!0,get:function(){return z}}),Object.defineProperty(m,"useDragStartBlockToIframeHandler",{enumerable:!0,get:function(){return F}}),Object.defineProperty(m,"useSendStyleToggleToIframe",{enumerable:!0,get:function(){return X}}),Object.defineProperty(m,"useSetHtmlAtomInIframeHandler",{enumerable:!0,get:function(){return V}}),Object.defineProperty(m,"useSetHtmlElementInIframeHandler",{enumerable:!0,get:function(){return q}})});
|
|
66
66
|
|
|
67
|
-
__useblocks__.define("static/core/
|
|
67
|
+
__useblocks__.define("static/core/a5b517f0.js",["require","exports","module","static/core/fe480726.js","static/core/c00a8e02.js"],function(P,b,rt){const $=P("./fe480726.js"),f=P("./c00a8e02.js");var H=/url(?:\((['|"]?))(.*?\.(png|jpg|gif|jpeg|tiff){1})(?:['|"]?\))/gi;function v(t){return t.arrayBuffer().then(e=>{const i=new Uint8Array(e);let n="";for(let r=0;r<i.length;r++)n+=String.fromCharCode(i[r]);return btoa(n)})}function I(t,e=76){if(t=t.replace(/[\r\n\s]/g,""),!t)return t;const i=[];for(let n=0;n<t.length;n+=e)i.push(t.slice(n,n+e));return i.join(`
|
|
68
68
|
`)}function T(t){return t.replaceAll(/[\\\/:*?"<>|]/g,"_")}async function C(t,e,i,n,r,s,c){const a=[];s&&(s.attachments=a);let l="";typeof r=="function"?l=await U(e,i,n,r,s,c):l=(await f.PromiseAllCatched(Object.keys(r).map(async m=>`\r
|
|
69
69
|
--boundary-string\r
|
|
70
70
|
Content-Type: ${m}\r
|
|
@@ -92,7 +92,7 @@ ${l}`}function R(t,e=!0){const i=f.decodeFileNameFromPath(t);return e?T(i):i}fun
|
|
|
92
92
|
`).trim()}catch{return""}}Object.defineProperty(b,"changeHtml",{enumerable:!0,get:function(){return D}}),Object.defineProperty(b,"extractDocumentTextContent",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(b,"getEML",{enumerable:!0,get:function(){return C}}),Object.defineProperty(b,"getFileNameAndExt",{enumerable:!0,get:function(){return j}}),Object.defineProperty(b,"getFileNameWithExt",{enumerable:!0,get:function(){return R}}),Object.defineProperty(b,"getImageByUrl",{enumerable:!0,get:function(){return O}}),Object.defineProperty(b,"htmlFilesToZip",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(b,"htmlToFilesData",{enumerable:!0,get:function(){return k}}),Object.defineProperty(b,"imageToBlob",{enumerable:!0,get:function(){return _}}),Object.defineProperty(b,"prepareHTML",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(b,"replaceImagesInDocument",{enumerable:!0,get:function(){return N}}),Object.defineProperty(b,"sanitizeFileName",{enumerable:!0,get:function(){return T}})});
|
|
93
93
|
|
|
94
94
|
(function(){try{if(typeof document<"u"){var t='html,body{width:100%;height:100%}.blocks-app input::-ms-clear{display:none}.blocks-app input::-ms-reveal{display:none}.blocks-app *,.blocks-app :before,.blocks-app :after{box-sizing:border-box}html{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:#0000;font-family:sans-serif;line-height:1.15}.blocks-app [tabindex="-1"]:focus{outline:none}.blocks-app hr{box-sizing:content-box;height:0;overflow:visible}.blocks-app h1,.blocks-app h2,.blocks-app h3,.blocks-app h4,.blocks-app h5,.blocks-app h6{margin-top:0;margin-bottom:.5em;font-weight:500}.blocks-app p{margin-top:0;margin-bottom:1em}.blocks-app abbr[title],.blocks-app abbr[data-original-title]{cursor:help;border-bottom:0;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.blocks-app address{font-style:normal;line-height:inherit;margin-bottom:1em}.blocks-app input[type=text],.blocks-app input[type=password],.blocks-app input[type=number],.blocks-app textarea{-webkit-appearance:none}.blocks-app ol,.blocks-app ul,.blocks-app dl{margin-top:0;margin-bottom:1em}.blocks-app ol ol,.blocks-app ul ul,.blocks-app ol ul,.blocks-app ul ol{margin-bottom:0}.blocks-app dt{font-weight:500}.blocks-app dd{margin-bottom:.5em;margin-left:0}.blocks-app blockquote{margin:0 0 1em}.blocks-app dfn{font-style:italic}.blocks-app b,.blocks-app strong{font-weight:bolder}.blocks-app small{font-size:80%}.blocks-app sub,.blocks-app sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}.blocks-app sub{bottom:-.25em}.blocks-app sup{top:-.5em}.blocks-app pre,.blocks-app code,.blocks-app kbd,.blocks-app samp{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:1em}.blocks-app pre{margin-top:0;margin-bottom:1em;overflow:auto}.blocks-app figure{margin:0 0 1em}.blocks-app img{vertical-align:middle;border-style:none}.blocks-app a,.blocks-app area,.blocks-app button,.blocks-app [role=button],.blocks-app input:not([type=range]),.blocks-app label,.blocks-app select,.blocks-app summary,.blocks-app textarea{touch-action:manipulation}.blocks-app table{border-collapse:collapse}.blocks-app caption{text-align:left;caption-side:bottom;padding-top:.75em;padding-bottom:.3em}.blocks-app input,.blocks-app button,.blocks-app select,.blocks-app optgroup,.blocks-app textarea{color:inherit;font-size:inherit;font-family:inherit;line-height:inherit;margin:0}.blocks-app button,.blocks-app input{overflow:visible}.blocks-app button,.blocks-app select{text-transform:none}.blocks-app button,html [type=button],.blocks-app [type=reset],.blocks-app [type=submit]{-webkit-appearance:button}.blocks-app button::-moz-focus-inner{border-style:none;padding:0}.blocks-app [type=button]::-moz-focus-inner{border-style:none;padding:0}.blocks-app [type=reset]::-moz-focus-inner{border-style:none;padding:0}.blocks-app [type=submit]::-moz-focus-inner{border-style:none;padding:0}.blocks-app input[type=radio],.blocks-app input[type=checkbox]{box-sizing:border-box;padding:0}.blocks-app input[type=date],.blocks-app input[type=time],.blocks-app input[type=datetime-local],.blocks-app input[type=month]{-webkit-appearance:listbox}.blocks-app textarea{resize:vertical;overflow:auto}.blocks-app fieldset{border:0;min-width:0;margin:0;padding:0}.blocks-app legend{width:100%;max-width:100%;color:inherit;font-size:1.5em;line-height:inherit;white-space:normal;margin-bottom:.5em;padding:0;display:block}.blocks-app progress{vertical-align:baseline}.blocks-app [type=number]::-webkit-inner-spin-button{height:auto}.blocks-app [type=number]::-webkit-outer-spin-button{height:auto}.blocks-app [type=search]{outline-offset:-2px;-webkit-appearance:none}.blocks-app [type=search]::-webkit-search-cancel-button{-webkit-appearance:none}.blocks-app [type=search]::-webkit-search-decoration{-webkit-appearance:none}.blocks-app ::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}.blocks-app output{display:inline-block}.blocks-app summary{display:list-item}.blocks-app template{display:none}.blocks-app [hidden]{display:none!important}.blocks-app .blocks-plugin{zoom:var(--ub-appZoom)}.blocks-app .blocks-plugin .ant-layout-sider-children{display:none}.blocks-app *,.blocks-app ul.ai-roles-list *,.blocks-app .ai-response-variant[class*=ai-response] *,.blocks-app ul.buttons-variants [class*=ai-response]{-webkit-user-select:none;user-select:none}.codicon[class*=codicon-]{font:16px/1 codicon!important}.blocks-app .element-card__title,.blocks-app [class*=ai-response],.blocks-app [class*=ai-response] *,.blocks-app .ant-comment-content-detail{-webkit-user-select:text;user-select:text}.blocks-app .code-mode__pane *{-webkit-user-select:auto;user-select:auto}.blocks-app,.blocks-app .ant-app,.blocks-app .ant-app .main,.blocks-app .ant-app .main__pane-content{height:100%}@media (width<=1300px){.blocks-app .ant-app .main{min-width:1270px}}.blocks-app .ant-app [role=button],.blocks-app .ant-app a,.blocks-app .ant-app area,.blocks-app .ant-app button,.blocks-app .ant-app input:not([type=range]),.blocks-app .ant-app label,.blocks-app .ant-app select,.blocks-app .ant-app summary,.blocks-app .ant-app textarea{touch-action:manipulation}.blocks-app .ant-app ::-webkit-scrollbar{width:10px;height:10px}.blocks-app .ant-app ::-webkit-scrollbar-corner{background:0 0}.blocks-app .ant-app ::-webkit-scrollbar-track{background:0 0}.blocks-app .ant-app ::-webkit-scrollbar-thumb{min-height:20px;box-shadow:inset 0 0 0 10px var(--ub-colorFillSecondaryDarken);background-clip:content-box;border:3px solid #0000;border-radius:8px;transition:all .2s}.blocks-app .ant-app ::-webkit-scrollbar-thumb:hover{box-shadow:inset 0 0 0 10px var(--ub-colorTextDisabled)}.blocks-app .ant-app textarea::-webkit-scrollbar-track{margin:10px}.blocks-app .ant-app .ant-btn.ant-btn-icon-only .free-mode-firewall-icon,.blocks-app .ant-app .email-pane .ant-tabs-tab .free-mode-firewall-icon,.blocks-app .ant-app .free-mode-firewall-icon{background-color:var(--ub-colorBgLayout);border-radius:100%;justify-content:center;display:flex;position:absolute;bottom:0;right:0}.blocks-app .ant-app .email-pane .ant-tabs-tab .free-mode-firewall-icon_emailpane{background-color:var(--ub-colorBgContainer);bottom:13px;right:13px}.blocks-app .ant-app .ant-table-wrapper .ant-table{border-radius:calc(var(--ub-borderRadiusXL) * 1px);overflow:hidden;background:0 0!important}.blocks-app .ant-app .ant-table-wrapper .ant-table .ant-table-thead>tr,.blocks-app .ant-app .ant-table-wrapper .ant-table .ant-table-thead>tr>th,.blocks-app .ant-app .ant-table-wrapper .ant-table .ant-table-thead>tr>td{background:0 0!important}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper,.blocks-app .ant-app .email-pane__content-col .selected-td-form__button:not(.ant-btn-text),.blocks-app .ant-app .email-pane__content-col .ant-btn-default{background:var(--ub-colorFillSecondary);border:1px solid #0000!important}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled){color:var(--ub-colorPrimary);background:var(--ub-colorFillSecondary);border-color:#0000}.blocks-app .ant-app .email-pane__content-col .selected-td-form__button{min-height:calc(var(--ub-formControlHeight) * 1px);min-width:calc(var(--ub-formControlHeight) * 1px);padding:0 8px;line-height:1;position:relative}.blocks-app .ant-app .email-pane__content-col .selected-td-form__button.ant-btn-icon-only .ant-btn-icon{justify-content:center;align-items:center;width:100%;height:100%;display:inline-flex}.blocks-app .ant-app .email-pane__content-col .selected-td-form__button.ant-btn-icon-only .anticon{vertical-align:0;justify-content:center;align-items:center;line-height:1;display:inline-flex}.blocks-app .ant-app .email-pane__content-col .selected-td-form__button.ghost-button:before{content:"";z-index:1;cursor:pointer;background-color:#0000;width:385px;height:50px;position:absolute;top:-9px;left:-338px}.blocks-app .ant-app .email-pane__content-col .ant-btn-default:not(:disabled,.ant-btn-disabled,.email-pane__content-col .selected-td-form__button--active):hover{background:var(--ub-colorFillSecondaryDarken);color:inherit;border-color:#0000}.blocks-app .ant-app .email-pane__content-col .selected-td-form__button--active,.blocks-app .ant-app .email-pane__content-col .ant-btn-default.selected-td-form__button--active{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary);border-color:#0000}.blocks-app .ant-app .email-pane__content-col .selected-td-form__button--active:hover{background:var(--ub-colorPrimaryBgHover);color:var(--ub-colorPrimaryTextHover)}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper,.blocks-app .ant-app .email-page .ant-btn{min-width:calc(var(--ub-formControlHeight) * 1px);height:calc(var(--ub-formControlHeight) * 1px);line-height:calc((var(--ub-formControlHeight) - 2) * 1px);text-align:center;padding:0 9px}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper{justify-content:center;align-items:center;padding:0 7px;display:flex}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper>span{display:inline-flex}.blocks-app .ant-app .ant-btn.ant-btn-icon-only.project-page__add-folder{margin-top:26px}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked):hover{color:inherit;background:var(--ub-colorFillSecondaryDarken)}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper.ant-radio-button-wrapper-checked{background:var(--ub-colorPrimaryBg)}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover{background:var(--ub-colorPrimaryBgHover);color:var(--ub-colorPrimaryTextHover)}.blocks-app .ant-app .email-pane__content-col .ant-form-item{margin-bottom:calc(var(--ub-formItemMarginBottomMD) * 1px)}.blocks-app .ant-app .email-pane__content-col .ant-form-item.form-item-margin-xs{margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px)}.blocks-app .ant-app .selected-td-form__br-input{margin-bottom:8px!important}.blocks-app .ant-app .addon-text-content{font-size:11px;font-weight:600}.blocks-app .ant-app .addon-text-content--icon{align-items:center;font-size:0;line-height:0;display:inline-flex}.blocks-app .ant-app .ant-btn.ant-btn-lg.project-page__folder_menu{text-align:center;width:32px;height:32px;padding:0;line-height:32px}.blocks-app .ant-app .editor .main__pane{overflow:hidden}.blocks-app .ant-app .element-card_block.ant-card-bordered .ant-card-cover .element-card__img-wrapper{background-color:#0000;background-image:linear-gradient(45deg,#0000001a 25%,#0000 0 75%,#0000001a 0),linear-gradient(45deg,#0000001a 25%,#0000 0 75%,#0000001a 0);background-position:0 0,4px 4px;background-repeat:repeat,repeat;background-size:8px 8px;background-attachment:scroll,scroll;background-origin:padding-box,padding-box;background-clip:border-box,border-box}.blocks-app .ant-app .ant-tabs-tabpane{width:100%}.blocks-app .ant-app .ant-tabs-large>.ant-tabs-nav .ant-tabs-tab{padding:18px 0}.blocks-app .ant-app .ant-tabs-content-holder{position:relative}.blocks-app .ant-app #pixie-editor ::-webkit-scrollbar-thumb{border:none}.blocks-app .ant-app .email-pane__bottom .code-mode__pane{border-top:1px solid var(--ub-colorBorder)}.blocks-app .ant-app .container{width:100%;margin:0 auto;padding:0 65px}@media (width<=1550px){.blocks-app .ant-app .container{gap:10px;padding:0 10px}}.blocks-app .ant-app .projects-page__container .container{padding-top:30px}.blocks-app .ant-app .container.email-pane__col-wrapper_pinch{padding-right:0}.blocks-app .ant-app body,.blocks-app .ant-app .ant-layout{transition:background-color .2s ease-in-out}.blocks-app .ant-app p{margin-top:0}.blocks-app .ant-app .ant-layout-content.container{padding-bottom:40px}.blocks-app .ant-app .ant-table-wrapper{width:100%}.blocks-app .ant-app .ant-table{border-radius:16px;overflow:hidden}.blocks-app .ant-app .verticalColorpicker.ant-color-picker .ant-color-picker-inner-content{width:340px}.blocks-app .ant-app .ant-color-picker .ant-color-picker-inner-content .ant-color-picker-panel .ant-color-picker-select .ant-color-picker-palette{min-height:160px}.blocks-app .ant-app .easylogic-colorpicker{border-radius:8px}.blocks-app .ant-app .easylogic-colorpicker .colorpicker-body .color{border-radius:8px 8px 0 0}.blocks-app .ant-app .ant-page-header-heading-title{max-width:700px;white-space:unset;box-shadow:none;align-items:baseline;padding:0;font-size:18px;line-height:24px}.blocks-app .ant-app .ant-page-header-heading-title.ant-typography-edit-content{overflow:unset;margin-top:0}.blocks-app .ant-app .ant-page-header-heading-title textarea{background:0 0;font-size:16px;font-weight:500;line-height:20px}.blocks-app .ant-app .ant-page-header-heading-preheader:disabled,.blocks-app .ant-app .ant-page-header-heading-title:disabled{cursor:not-allowed;-webkit-user-select:none;user-select:none;pointer-events:none}.blocks-app .ant-app .ant-menu{background:inherit}.blocks-app .ant-app .ant-page-header{background:inherit;margin-bottom:20px;padding:20px 0}@media (width<=1450px){.blocks-app .ant-app .ant-page-header{padding:10px 0}}.blocks-app .ant-app .ant-page-header-heading-left{margin:0;overflow:visible}.blocks-app .ant-app .ant-page-header-heading-extra{margin:0}.blocks-app .ant-app .ant-page-header-heading-sub-title{display:block;overflow:visible}.blocks-app .ant-app .ant-progress-inner{background-color:#fff}.blocks-app .ant-app .dark .ant-progress-inner{background-color:#ffffff14}.blocks-app .ant-app .ant-collapse>.ant-collapse-item>.ant-collapse-header{flex-direction:row-reverse}.blocks-app .ant-app .ant-tabs-tab{justify-content:center}.blocks-app .ant-app .nobr{white-space:nowrap}.blocks-app .ant-app .checkbox-horizontal .ant-row{flex-direction:row-reverse;justify-content:flex-end;align-items:center}.blocks-app .ant-app .checkbox-horizontal .ant-form-item-control{margin-right:10px;flex-grow:0!important;width:auto!important}.blocks-app .ant-app .checkbox-horizontal .ant-form-item-label{padding:0!important}.blocks-app .ant-app .ant-comment .ant-comment-nested{margin-left:24px}.blocks-app .ant-app .ant-comment .ant-comment-avatar{margin-top:-2px;margin-right:8px;position:relative}.blocks-app .ant-app .ant-comment .ant-comment-avatar img{width:24px;height:24px}.blocks-app .ant-app .ant-comment .ant-comment-inner{background:var(--ub-colorBgLayout);border-radius:8px;margin-bottom:12px;padding:12px;display:flex}.blocks-app .ant-app img:not([srcset*=\\.],[src*=\\.],[src*=data\\:image]){display:none}.blocks-app .ant-app .dark .targetted-comment-item>.ant-comment-inner{background:#7030d43b}.blocks-app .ant-app .ant-tabs-top:not(.secondary-tabs_unset_scroll)>.ant-tabs-nav:before,.blocks-app .blocks-modal .ant-tabs-top:not(.secondary-tabs_unset_scroll)>.ant-tabs-nav:before{background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);border-top:1px solid var(--ub-colorBorderSecondary);z-index:1;background-position:0 -2px;background-repeat:no-repeat;border-bottom:none;height:20px;bottom:-20px}.blocks-app .ant-app .ant-tabs-top[style*=vh]>.ant-tabs-nav:before,.blocks-app .blocks-modal .ant-tabs-top[style*=vh]>.ant-tabs-nav:before{background:0 0}.dark .blocks-app .ant-app .ant-tabs-top:not(.secondary-tabs_unset_scroll)>.ant-tabs-nav:before,.dark .blocks-app .blocks-modal .ant-tabs-top:not(.secondary-tabs_unset_scroll)>.ant-tabs-nav:before{background:linear-gradient(180deg, var(--ub-colorBgBase) -100%, transparent 50%)}.blocks-app .ant-app .ant-tabs-top>.ant-tabs-nav,.blocks-app .blocks-modal .ant-tabs-top>.ant-tabs-nav{margin-bottom:20px}.blocks-app .ant-app .ant-tabs.email-pane__col_settings-inner>.ant-tabs-nav .ant-tabs-nav-operations,.blocks-app .ant-app .ant-tabs.email-pane__col_settings-inner>div>.ant-tabs-nav .ant-tabs-nav-operations,.blocks-app .blocks-modal .ant-tabs.email-pane__col_settings-inner>.ant-tabs-nav .ant-tabs-nav-operations,.blocks-app .blocks-modal .ant-tabs.email-pane__col_settings-inner>div>.ant-tabs-nav .ant-tabs-nav-operations{visibility:hidden;pointer-events:none;position:absolute}.blocks-app .transition-enter{opacity:0}.blocks-app .transition-enter-active{opacity:1;transition:opacity .3s ease-in}.blocks-app .transition-exit{opacity:1}.blocks-app .transition-exit-active{opacity:0;transition:opacity .3s ease-in}.blocks-app #carrotquest-messenger-collapsed-container{z-index:10!important}.blocks-app .carrot-messenger-frame-container{z-index:11!important}.blocks-app .default-mode__pane_editor,.blocks-app .code-mode{z-index:20}@media (height<=700px){.blocks-app .ant-color-picker-presets .ant-collapse-item:last-child{display:none}}@media only screen and (device-width<=480px),only screen and (width<=480px){.blocks-app .email-pane_only_code_mode_mobile .email-pane__row .ant-col:first-child{display:none}.blocks-app .email-pane_only_code_mode_mobile .email-pane__row .ant-col:last-child{width:100%!important}}.blocks-app .em-filemanager .uploadProgress{right:105px!important}body{margin:0}.blocks-app .ant-menu-submenu-placement-rightTop:before,.blocks-app .ant-menu-submenu-placement-rightTop:after{display:none!important}.blocks-app .main{overflow:hidden}.blocks-app .main__pane-layout{height:100%;min-height:100%}.blocks-app .main__pane{height:100%;transition:height .2s cubic-bezier(0,0,.2,1);position:relative}.blocks-app .main__pane_editor{z-index:2;box-shadow:0 10px 60px #2223}.blocks-app .main__pane .ant-layout-sider-trigger{flex-direction:column;justify-content:center;display:flex;overflow:hidden}.blocks-app .main__pane-trigger{box-sizing:border-box;justify-content:space-between;align-items:center;gap:8px;width:100%;min-width:0;max-width:100%;display:flex}.blocks-app .main__pane-trigger .anticon{flex-shrink:0}.blocks-app .main__pane-trigger .theme-switcher{flex:auto;min-width:0}.blocks-app .main__pane-trigger_compact{justify-content:center;gap:0}.blocks-app .main__pane-trigger .anticon-menu-unfold,.blocks-app .main__pane-trigger:hover .anticon-menu{display:none}.blocks-app .main__pane-trigger:hover .anticon-menu-unfold,.blocks-app .main__pane-trigger .anticon-menu{display:inline-flex}.blocks-app .main__panes-resizer{position:relative}.blocks-app .main__panes-resizer:before{content:"";background-color:#0000;border-bottom:2px solid #0000;width:100%;height:10px;transition:border-color .2s;position:absolute;bottom:0;left:0;right:0}.blocks-app .main__panes-resizer:hover{cursor:row-resize}.blocks-app .main__panes-resizer:hover:before{border-color:var(--ub-colorPrimary)}.blocks-app .main__pane-close-btn{z-index:21;bottom:0;left:50%;transform:translate(-50%)}.blocks-app .main__pane-close-btn.ant-btn{border:0;border-radius:25px 25px 0 0;width:50px;height:25px;padding:0;position:absolute}.blocks-app .main__pane-close-btn .anticon{border-radius:50px 50px 0 0;outline:0 solid #188fff40;align-items:flex-end;height:100%;transition:all .1s cubic-bezier(0,0,.2,1)}.blocks-app .main__pane-close-btn .anticon.show-halo{outline-width:12px}.blocks-app .main__pane-close-btn .anticon.opened{align-items:flex-start;transform:rotate(180deg)}.blocks-app .main__pane-trigger .anticon.anticon-menu-fold{display:inline-flex}.blocks-app .main__pane-trigger.ant-btn{z-index:1;width:100%;height:70px;box-shadow:none;background:0 0;border:0;display:block;position:absolute;top:0;left:0;right:0}.blocks-app .main__pane-trigger.ant-btn:hover,.blocks-app .main__pane-trigger.ant-btn:focus{background:0 0}.blocks-app .main__pane-trigger.ant-btn:empty{visibility:visible;width:100%;display:block}.blocks-app .main__menu{z-index:11;height:100%;position:sticky;top:0}.blocks-app .main__menu .ant-layout-sider-children{box-sizing:border-box;max-height:100vh;overflow:hidden auto}.blocks-app .main__menu>div{border-right:1px solid;border-color:inherit}.blocks-app .main__menu:not(.ant-layout-sider-collapsed){margin-right:-180px;top:0;left:0;box-shadow:0 3px 6px -4px #0000001f,0 6px 16px #00000014,0 9px 28px 8px #0000000d}.blocks-app body.dark .main__menu:not(.ant-layout-sider-collapsed){box-shadow:0 3px 6px -4px #0000007a,0 6px 16px #00000052,0 9px 28px 8px #0003}.blocks-app .main__menu.main__menu_lock{box-shadow:none;margin-right:0}.blocks-app body.dark .main__menu.main__menu_lock{box-shadow:none}.blocks-app .main__menu *{text-overflow:unset!important}@media (width<=1400px){.blocks-app .main__menu .ant-layout-sider-zero-width-trigger{z-index:100000;top:50%;text-align:center;visibility:visible;width:20px;height:60px;font-size:16px;inset-inline-start:0;transform:translateY(-30px);box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #0000000f}.blocks-app .main__menu .ant-layout-sider-zero-width-trigger-right{visibility:hidden}}.blocks-app .main__content-wrapper{position:relative}@media (width<=1550px){.blocks-app .main__header{padding:0 20px 0 40px!important}}.blocks-app .ant-layout .ant-layout-sider-trigger{text-align:left;border-bottom:none;padding:0 30px}.blocks-app .ant-app .main__menu:not(.ant-layout-sider-collapsed) .ant-layout-sider-trigger{padding:0 30px}.blocks-app .ant-app .main__menu.ant-layout-sider-collapsed .ant-layout-sider-trigger{padding:0 10px}.blocks-app .ant-layout-sider-light .ant-layout-sider-trigger{background:0 0}.blocks-app .ant-btn.project-menu__block-button{padding:0!important}.blocks-app .selected-element-panel__columns-settings__controls__field{background:var(--ub-colorBgElevated);border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);transition:all .2s linear .2s}.blocks-app .selected-element-panel__columns-settings__controls__field:hover{border-color:var(--ub-borderColorHover)}.blocks-app .selected-element-panel__columns-settings__controls__field:focus,.blocks-app .selected-element-panel__columns-settings__controls__field:focus-within{border-color:var(--ub-colorPrimaryBorder);box-shadow:0 0 0 2px #0591ff1a}.blocks-app .selected-element-panel__columns-settings__controls__column.current .selected-element-panel__columns-settings__controls__field{background:var(--ub-colorPrimaryBg);border-color:var(--ub-colorPrimaryBorder)}.blocks-app .structures{margin-left:-3px;margin-right:-3px;overflow:visible}.blocks-app .structures__list{margin-bottom:-10px}.blocks-app .structures__item{box-sizing:border-box;cursor:grab;flex-direction:row;justify-content:center;align-items:center;width:100%;min-width:100%;height:50px;margin-bottom:20px;padding:0;display:flex}.blocks-app .structures__item:hover .structures__item-row{background:var(--ub-colorFillTertiary);border:#0000;box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #00000017}.dark .blocks-app .structures__item:hover .structures__item-row{background:var(--ub-colorBgSpotlight)}.blocks-app .structures__item-row{background:var(--ub-colorFillSecondary);border-radius:calc(var(--ub-borderRadius) * 1.2px);width:97%;height:100%;padding:6px 3px;transition:box-shadow .3s,border-color .3s,background-color .3s}.blocks-app .structures__item-col{border-radius:calc(var(--ub-borderRadius) * 1px);border:1px solid var(--ub-controlItemBgActiveHover);background:var(--ub-controlItemBgActive);width:100%;height:100%}.dark .blocks-app .structures__item-col{border-color:var(--ub-colorBgElevated);background:var(--ub-colorFillTertiary)}.blocks-app .em-dragging-element .structures__item .structures__item-row{background-color:var(--ub-controlTmpOutline);box-shadow:none}.dark .blocks-app .em-dragging-element .structures__item .structures__item-row{background:var(--ub-controlTmpOutline)}.blocks-app .em-dragging-element .structures__item .structures__item-row .structures__item-col{opacity:0;border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .em-ghost-element{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px)}.blocks-app .em-ghost-element .structures__item-col{opacity:1!important}.dark .blocks-app .em-ghost-element{background:var(--ub-colorBgSpotlight)}@media (width<=1550px){.blocks-app .structures__item{margin-bottom:16px}.blocks-app .structures__item:last-child{margin-bottom:20px}}.blocks-app .atoms{overflow:visible}.blocks-app .atoms__list{margin-bottom:20px;transition:opacity .2s}.blocks-app .atoms__item{font:inherit;text-align:center;appearance:none;box-sizing:border-box;border-radius:calc(var(--ub-borderRadius) * 1px);width:109px;height:70px;color:var(--ub-colorTextSecondary);background:var(--ub-colorFillSecondary);border:0;flex-direction:column;justify-content:center;align-items:center;margin:0;padding:5px;display:flex;position:relative}.blocks-app .atoms__item.ant-card-hoverable{cursor:grab!important}.blocks-app .atoms__item:hover{border-color:var(--ub-colorBgElevated)}.dark .blocks-app .atoms__item:hover{border-color:var(--ub-colorTextDisabled);background:var(--ub-colorBorder)}.blocks-app .atoms__item_inactive{opacity:.5;cursor:default}.blocks-app .atoms__item_inactive:hover{border-color:var(--ub-colorBorder)}.blocks-app .atoms__item_locked .atom-image{opacity:.55;margin-bottom:6px;display:inline-flex;position:relative}.blocks-app .atoms__item_locked .atom-image__lock{opacity:1;background-color:var(--ub-colorBgContainer);border-radius:100%;position:absolute;bottom:-2px;right:-6px}.blocks-app .atoms__item_locked .atom-title{opacity:.55}.blocks-app .atoms__item.ai:before{content:"AI";color:#fff;background-color:var(--ub-colorInfo);text-align:center;border-radius:0 calc(var(--ub-borderRadius) * 1px) 0 calc(var(--ub-borderRadiusSM) * 1px);width:36px;padding:1px 5px;font-size:12px;line-height:1.2;display:inline-block;position:absolute;top:0;right:0}.blocks-app .atoms__item.amp:before{content:"AMP";color:#fff;background-color:var(--ub-colorPrimary);text-align:center;border-radius:0 8px 0 5px;width:36px;padding:1px 5px;font-size:12px;line-height:1.2;display:inline-block;position:absolute;top:0;right:0}.blocks-app .atoms .anticon{color:var(--ub-colorTextSecondary);font-size:28px}.blocks-app .atoms .em-dragging-element .atoms__item{background-color:var(--ub-controlTmpOutline)}.blocks-app .atoms .em-ghost-element{background-color:var(--ub-colorBgContainer)!important;border:1px solid var(--ub-colorBorder)!important}.blocks-app .atoms .atom-title{color:var(--ub-colorTextTertiary);text-align:center;font-size:13px;line-height:1}.blocks-app #email_iframe{vertical-align:top;background-color:#f8f8f8;border:0;width:1px;min-width:100%}.blocks-app .iframe-provider+#email_iframe_slot{pointer-events:none}.blocks-app .iframe-provider{width:100%;height:100%;position:absolute;top:0;left:0}.blocks-app .browser-extension-warning-modal__footer,.blocks-app .browser-translate-warning-modal__footer{justify-content:center;margin-top:24px;display:flex}.blocks-app .email-pane{position:relative}.blocks-app .email-pane__loader{z-index:10;background-color:#fff6;width:100%;height:100%;position:fixed;top:0;left:0}.dark .blocks-app .email-pane__loader{background-color:#0006}.blocks-app .email-pane__paths{border-top:1px solid var(--ub-colorBorder);z-index:10;background-color:var(--ub-colorBgContainer);justify-content:space-between;align-items:center;width:100%;transition:all .5s;display:flex;position:sticky;bottom:0;left:0}.blocks-app .email-pane__paths>div{color:var(--ub-colorTextTertiary);padding:3px 15px}.blocks-app .email-pane__paths .ant-breadcrumb{white-space:nowrap;overflow:auto hidden}.blocks-app .email-pane__paths .ant-breadcrumb ol{flex-wrap:nowrap;padding-right:10px}.blocks-app .email-pane__paths .ant-breadcrumb li{position:relative}.blocks-app .email-pane__paths .ant-breadcrumb li:hover>span{color:var(--ub-colorPrimary)}.blocks-app .email-pane__paths .ant-breadcrumb li>span{color:var(--ub-colorTextSecondary);cursor:pointer;padding:3px 15px;display:block}.blocks-app .email-pane__paths .ant-breadcrumb li>span span{align-items:center;gap:4px;display:flex}.blocks-app .email-pane__paths .ant-breadcrumb li:after{content:"";border-style:solid;border-width:15px 0 15px 10px;border-color:transparent transparent transparent var(--ub-colorBgContainer);width:0;height:0;transition:all .5s;position:absolute;top:50%;right:-5px;transform:translateY(-50%)}.blocks-app .email-pane__paths .ant-breadcrumb li:before{content:"";border-style:solid;border-width:15px 0 15px 10px;border-color:transparent transparent transparent var(--ub-colorBorder);width:0;height:0;transition:all .5s;position:absolute;top:50%;right:-6px;transform:translateY(-50%)}.blocks-app .email-pane__code-size{white-space:nowrap;margin-left:auto;padding:3px 15px;font-size:14px}.blocks-app .email-pane__code-size_exceeded{color:var(--ub-colorError)}.blocks-app .email-pane .ant-btn-primary.mobile_view{background-color:var(--ub-colorInfo)}.blocks-app .email-pane .ant-btn-primary.mobile_view:hover{background-color:var(--ub-colorInfoHover)}.blocks-app .email-pane .ant-tabs .ant-tabs-tab-btn{transition:none}.blocks-app .email-pane .ant-tabs-extra-content{justify-content:center;align-items:center;display:flex}.blocks-app .email-pane .ant-tabs-extra-content .ant-segmented_editor-mode{margin-top:22px;transform:rotate(90deg)}.blocks-app .email-pane .ant-tabs-extra-content .ant-segmented_editor-mode .ant-segmented-item-label{min-height:40px;padding:0;line-height:40px}.blocks-app .email-pane .ant-tabs-extra-content .ant-segmented_editor-mode .ant-segmented-item-icon{width:28px;height:40px;display:inline-block;transform:rotate(-90deg)}.blocks-app .email-pane .ant-tabs-extra-content .ant-segmented_editor-mode .ant-segmented-item-icon .anticon{position:relative}.blocks-app .email-pane .email-pane_code-mode .email-pane__col-wrapper{transition:all .5s;padding-top:0!important}.blocks-app .blocks-plugin .email-pane .email-pane_code-mode .email-pane__resizable{padding-top:60px;transition:all .5s}.blocks-app .email-pane .email-pane_code-mode:not(.email-pane_is-mobile,.email-pane_code-mode-bottom) .email-pane__col-wrapper{padding-top:0!important}.blocks-app .email-pane .email-pane_code-mode:not(.email-pane_is-mobile,.email-pane_code-mode-bottom) .email-pane__left .email-pane__content-col_main{border-width:0;border-radius:0;margin-left:0;margin-right:0;border-top-width:0!important;border-bottom-width:0!important;border-right-width:0!important}.blocks-app .email-pane .email-pane_code-mode:not(.email-pane_is-mobile,.email-pane_code-mode-bottom) .email-pane__right .email-pane__content-col_main{border-width:0;border-radius:0;margin-left:0;margin-right:0;border-top-width:0!important;border-bottom-width:0!important;border-left-width:0!important}.blocks-app .blocks-plugin .email-pane .email-pane_code-mode:not(.email-pane_is-mobile,.email-pane_code-mode-bottom) .email-pane__resizable{max-width:calc(100% - 2px);margin-bottom:0;padding-top:0}.blocks-app .email-pane .selected-td-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .email-pane .selected-td-form__padding-input input{text-align:center}.blocks-app .email-pane .email-pane__comment-counter{background-color:var(--ub-colorInfo);color:var(--ub-colorWhite);border:none}.blocks-app .email-pane .element-controls{width:100%;height:100%}.blocks-app .email-pane #selected_element_form_desktop_props{height:100%}.blocks-app .email-pane .ant-tabs .ant-divider-horizontal.selected-td-form__divider{border-top:1px solid var(--ub-colorBorderSecondary);background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);width:calc(100% + 50px);margin:26px -23px}.dark .blocks-app .email-pane .ant-tabs .ant-divider-horizontal.selected-td-form__divider{background:linear-gradient(180deg, var(--ub-colorBgBase), transparent 40%)}.blocks-app .email-pane .ant-tabs .element-controls .selected-td-form__divider{margin-top:0;margin-bottom:0}.blocks-app .email-pane .ant-tabs .blocks-search__divider{pointer-events:none;width:auto;height:20px;margin:24px 0 0;position:absolute;bottom:-20px;left:-24px;right:-13px}.blocks-app .email-pane .ant-tabs ::-webkit-scrollbar-thumb{box-shadow:inset 0 0 0 10px var(--ub-colorFillSecondary)}.blocks-app .email-pane .ant-tabs ::-webkit-scrollbar-thumb:hover{box-shadow:inset 0 0 0 10px var(--ub-colorFill)}.blocks-app .email-pane .ant-tabs .blocks-search__empty-shadow{height:100%;position:relative}.blocks-app .email-pane .ant-tabs .blocks-search__empty-shadow:after{content:"";background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);z-index:1;width:calc(100% + 48px);height:20px;margin-left:-24px;position:absolute;top:0;left:0}.blocks-app .email-pane .ant-tabs .blocks-search__empty-wrapper{height:calc(100% + 10px);margin:0 -24px;padding:24px 14px 0 24px;position:relative;overflow:scroll}.blocks-app .email-pane__container{scroll-behavior:smooth;min-height:100%;padding-top:0}.blocks-app .email-pane_code-mode .email-pane__container{overflow:unset;height:unset;padding-bottom:0;position:relative}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .email-pane__container>.selected-element-panel{z-index:101;pointer-events:none;height:0;position:absolute;inset:0 0 auto}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .email-pane__container>.selected-element-panel>div{pointer-events:auto}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .email-pane__container>.selected-element-panel .selected-element-panel-content.selected-element-panel__content_abs{width:fit-content;max-width:calc(100% - 24px);min-height:auto;display:block}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .email-pane__container>.selected-element-panel .selected-element-panel-content.selected-element-panel__content_abs form.element-controls{height:auto;min-height:auto}.blocks-app .email-pane__col-wrapper{flex-wrap:nowrap;gap:30px;display:flex;position:relative}.blocks-app .email-pane__col-wrapper .email-pane__col_settings{margin-top:30px}.blocks-app .email-pane__col-wrapper .email-pane__col_settings-inner{border-radius:8px;position:sticky;top:30px;left:0}.blocks-app .ant-app .email-pane__col-wrapper_reverse{flex-direction:row-reverse}.blocks-app .email-pane .email-pane__sizeSwitcher:not(.email-pane__pinch,.email-pane__right) .email-pane__col-wrapper{top:-114px}.blocks-app .email-pane_code-mode .email-pane__code-divider{opacity:0;cursor:ew-resize;background-color:var(--ub-colorPrimary);width:5px;height:100%;transition:opacity .4s;position:absolute}.blocks-app .email-pane_code-mode .email-pane__code-divider:hover,.blocks-app .email-pane_code-mode .email-pane__code-divider:active{opacity:1;background-color:var(--ub-colorPrimary)}.blocks-app .email-pane_code-mode.email-pane .email-pane__row:not(.email-pane__bottom,.email-pane__sizeSwitcher) .email-pane__content-col_main{border-radius:0;border:0 solid var(--ub-colorBorder)!important;margin:0!important}.blocks-app .email-pane_code-mode.email-pane .email-pane__row:not(.email-pane__bottom,.email-pane__sizeSwitcher) [class^=device-width__] button{display:none}.blocks-app .email-pane_code-mode .email-pane__left{flex-direction:row}.blocks-app .email-pane_code-mode .email-pane__left>div:first-child{border-right:1px solid var(--ub-colorBorder);overflow-y:auto!important}.blocks-app .email-pane_code-mode .email-pane__left .email-pane__handle.left{display:none}.blocks-app .email-pane_code-mode .email-pane__left .email-pane__code-divider{left:-2px}.blocks-app .email-pane_code-mode .email-pane__right{flex-direction:row-reverse}.blocks-app .email-pane_code-mode .email-pane__right>div:first-child{border-left:1px solid var(--ub-colorBorder);overflow-y:auto!important}.blocks-app .email-pane_code-mode .email-pane__right .email-pane__handle.right{display:none}.blocks-app .email-pane_code-mode .email-pane__right .email-pane__code-divider{right:-2px}.blocks-app .email-pane_code-mode .email-pane__bottom{max-width:unset;flex-direction:column;margin:0}.blocks-app .email-pane_code-mode .email-pane__bottom .email-pane__col-wrapper{width:100%;margin:0 auto}.blocks-app .email-pane_code-mode .email-pane__bottom .email-pane__code-divider{opacity:0;cursor:ns-resize;z-index:10;width:100%;height:2px;top:-2px}.blocks-app .email-pane_code-mode .email-pane__bottom .email-pane__code-divider:hover,.blocks-app .email-pane_code-mode .email-pane__bottom .email-pane__code-divider:active{opacity:1;background-color:var(--ub-colorPrimary)}.blocks-app .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper{gap:0;height:100%;padding-left:3px}.blocks-app .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper .email-pane__col.email-pane__col_preview{overflow-y:scroll;height:100%!important}@media (width<=1590px){.blocks-app .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper .email-pane__col.email-pane__col_preview{overflow-x:hidden}}.blocks-app .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper .ant-tabs-content-holder{border-radius:0}.blocks-app .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper.email-pane__col-wrapper_reverse .email-pane__col.email-pane__col_preview{padding-left:10px;padding-right:0}.blocks-app .email-pane__left .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper.email-pane__col-wrapper_reverse .email-pane__col.email-pane__col_preview{padding-left:65px;padding-right:0}.blocks-app .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper .ant-tabs-right>.ant-tabs-nav .ant-tabs-tab{height:53px;padding-top:6px;padding-left:6px;padding-right:6px}.blocks-app .email-pane .email-pane.email-pane_code-mode .email-pane__col-wrapper_reverse .email-pane__col.email-pane__col_preview{padding-right:0}.blocks-app .email-pane .email-pane.email-pane_code-mode .email-pane__col-wrapper_pinch.email-pane__col-wrapper{padding-left:0}.blocks-app .email-pane .email-pane__right.email-pane__sizeSwitcher .email-pane__col.email-pane__col_preview{padding-left:0;padding-right:35px;overflow:visible}.blocks-app .email-pane .email-pane__right.email-pane__sizeSwitcher .email-pane__col.email-pane__col_preview .email-pane__content-col.email-pane__content-col_main{border-width:1px}.blocks-app .email-pane .email-pane__left.email-pane__sizeSwitcher .email-pane__col.email-pane__col_preview{padding-left:65px!important;padding-right:0!important}.blocks-app .email-pane .email-pane__right .email-pane__col-wrapper_reverse .email-pane__col.email-pane__col_preview,.blocks-app .email-pane .email-pane__left.email-pane__sizeSwitcher .email-pane__col-wrapper_reverse .email-pane__col.email-pane__col_preview{padding-left:0!important;padding-right:0!important}.blocks-app .email-pane .email-pane__right:not(.email-pane__pinch) .email-pane__col-wrapper_pinch.email-pane__col-wrapper{padding-left:0;padding-right:65px}.blocks-app .email-pane .email-pane__right.email-pane__pinch.email-pane__sizeSwitcher .email-pane__col-wrapper_pinch.email-pane__col-wrapper{padding-left:0}.blocks-app .email-pane .email-pane__right.email-pane__pinch.email-pane__sizeSwitcher .email-pane__col-wrapper_pinch.email-pane__col-wrapper .email-pane__col_preview{padding-left:0;padding-right:65px}.blocks-app .email-pane .email-pane__reverse .email-pane__col-wrapper_pinch.email-pane__col-wrapper{padding-left:0}.blocks-app .email-pane .email-pane__sizeSwitcher .email-pane__col.email-pane__col_preview{padding-top:30px}.blocks-app .email-pane .email-pane__sizeSwitcher .email-pane__col-wrapper_pinch .email-pane__col.email-pane__col_preview{padding:60px 2px 0}.blocks-app .email-pane .email-pane__reverse.email-pane__sizeSwitcher .email-pane__col.email-pane__col_preview{padding-right:65px}.blocks-app .email-pane .email-pane.email-pane_code-mode .email-pane__right .email-pane__col.email-pane__col_preview,.blocks-app .email-pane .email-pane.email-pane_code-mode .email-pane__left .email-pane__col.email-pane__col_preview{padding-top:0}.blocks-app .email-pane .email-pane__right .email-pane__col_preview,.blocks-app .email-pane .email-pane__left .email-pane__col_preview{padding-left:0;padding-right:0}.blocks-app .email-pane .email-pane.email-pane_code-mode .email-pane__col-wrapper_pinch.email-pane__col-wrapper .email-pane__col.email-pane__col_preview{height:100%!important}.blocks-app .email-pane .email-pane__sizes-panel-wrapper{z-index:5;position:sticky;top:30px;left:15px}.blocks-app .email-pane .email-pane__right .email-pane__sizes-panel-wrapper{left:auto;right:15px}.blocks-app .email-pane .email-pane__right.email-pane__sizeSwitcher .email-pane__sizes-panel-wrapper{display:none}.blocks-app .email-pane .email-pane__pinch .email-pane__sizes-panel-wrapper{position:absolute;top:12px;left:calc(50% - 266px)}.blocks-app .email-pane .email-pane__reverse .email-pane__sizes-panel-wrapper{left:auto;right:calc(50% - 266px)}.blocks-app .email-pane .email-pane__reverse.email-pane__left.email-pane__pinch .email-pane__sizes-panel-wrapper{display:none;left:15px;right:auto}.blocks-app .email-pane .email-pane__sizes-panel{background-color:var(--ub-colorBgElevated);border:1px solid var(--ub-colorBorder);border-radius:34px}.blocks-app .email-pane__header{padding-right:10px}.blocks-app .email-pane__header .header__left{margin-left:0}.blocks-app .email-pane__header .header__logo{float:left;height:auto;margin-top:5px;margin-right:26px;padding-right:0;font-size:22px!important}.blocks-app .email-pane__header__title{align-items:center;width:100%;display:flex}.blocks-app .email-pane__header__title__project a{white-space:nowrap;text-overflow:ellipsis;flex:1;max-width:190px;display:flex;overflow:hidden}.blocks-app .email-pane__header__title__project{float:left;margin-top:10px}.blocks-app .email-pane__header__title__project a:hover{color:var(--ub-colorPrimary)}.blocks-app .email-pane__header__title .ant-typography{white-space:nowrap;text-overflow:ellipsis;flex:1;margin:10px 0 10px 20px;padding:0;display:flex;overflow:hidden}.blocks-app .email-pane__row{flex-wrap:nowrap;justify-content:space-between;gap:30px;height:100%;position:relative}.blocks-app .email-pane_path-enabled .email-pane__row{height:calc(100% - 29px)}.blocks-app .email-pane_code-mode .email-pane__row{gap:0;height:calc(100% - 29px);padding:0}.blocks-app .email-pane__col_settings{border-color:var(--ub-colorBorder);height:100%;margin-right:50px;position:sticky;top:0;bottom:60px;overflow:visible}.blocks-app .email-pane__col_disabled.email-pane__content-col_tabs.email-pane__content-col{width:68px;min-width:68px;margin-right:0}.blocks-app .email-pane__col_settings-inner{height:100%;max-height:100%;margin-right:0}.blocks-app .email-pane__col_settings-inner_reverse{flex-direction:row-reverse}.blocks-app .email-pane__col_settings-inner_reverse .email-pane__tab-bar.ant-tabs-nav{margin-left:0;margin-right:8px}.blocks-app .email-pane__col_settings-inner_reverse .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab-btn>span{line-height:1}.blocks-app .email-pane__col .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab-btn>span{height:24px;margin-right:0;font-size:20px}.blocks-app .email-pane__col-wrapper_pinch .email-pane__col .email-pane__tab-bar.ant-tabs-nav{border-left:1px solid var(--ub-colorBorderSecondary);background:var(--ub-colorBgContainer)}.blocks-app .email-pane__reverse .email-pane__col-wrapper_pinch .email-pane__col .email-pane__tab-bar.ant-tabs-nav{border-left:none}.blocks-app .email-pane__col .email-pane__col_settings-inner_reverse{border-right:1px solid var(--ub-colorBorder)}.blocks-app .email-pane_view .email-pane__col{height:calc(100vh - 48px);top:0;bottom:0;overflow:auto}.blocks-app .email-pane__col_settings{height:calc(100vh - 76px);position:sticky;top:10px;bottom:60px;overflow:auto}.blocks-app .email-pane_view .email-pane__col_settings{height:calc(100vh - 48px)}.blocks-app .email-pane__col_settings-collapsed{flex:0 0;max-width:0}.blocks-app .email-pane__col_preview{scroll-behavior:smooth}.blocks-app .email-pane_code-mode .email-pane__row:not(.email-pane__bottom) .email-pane__col_preview{overflow:auto;width:100%!important}.blocks-app .email-pane__col_preview-collapsed{flex:0 0 100%;width:100%;max-width:100%}.blocks-app .email-pane__col_settings{z-index:11;height:100%;position:sticky;top:20px;bottom:60px;overflow:visible}.blocks-app .email-pane__col_settings-inner{height:100%;max-height:100%}.blocks-app .email-pane__col_menu{margin-left:20px}.blocks-app .email-pane__col .ant-modal-close{top:14px;width:34px;height:34px;font-size:16px;position:absolute;inset-inline-end:12px;padding:0!important}.blocks-app .email-pane__col_code-mode .ant-menu-vertical.element-preview-menu__list_discuss li.ant-menu-item{text-align:center}.blocks-app .email-pane__col__alert{z-index:100;width:40%;max-width:400px;bottom:40px;left:10px;position:absolute!important}.blocks-app .email-pane__collapse-wrapper{background-color:var(--ub-colorBgContainer);border:1px solid var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);flex-direction:column;align-self:flex-start;height:auto;min-height:0;max-height:100%;display:flex;overflow:hidden}.dark .blocks-app .email-pane__collapse-wrapper{border:1px solid var(--ub-colorBorderSecondary)}.blocks-app .email-pane__collapse-wrapper_disabled{display:none}.blocks-app .email-pane__collapse-wrapper>*{min-height:0;max-height:100%}.blocks-app .email-pane__collapse-wrapper .ant-tabs-content-holder{border-radius:0 0 calc(var(--ub-borderRadiusXL) * 1px) calc(var(--ub-borderRadiusXL) * 1px);border:none;margin:0 -1px -1px;transition:all .3s;overflow:hidden}.blocks-app .email-pane__collapse-wrapper .selected_form-mobile-props-title,.blocks-app .email-pane__collapse-wrapper .selected_form-desktop-props-title{opacity:0;will-change:transform, height;padding-top:0;transition:height .45s cubic-bezier(.16,1,.3,1),margin-top .45s cubic-bezier(.16,1,.3,1),transform .45s cubic-bezier(.16,1,.3,1),opacity .3s ease-out;transform:translateY(-100%)}@keyframes em-mobile-props-title-slide-in{0%{opacity:0;height:0;transform:translateY(-100%)}to{opacity:1;height:32px;transform:translateY(0)}}.blocks-app .email-pane__collapse-wrapper #selected_element_form_desktop_props{transition:all .1s}.blocks-app .email-pane__collapse-wrapper .selected_form-props-wrapper_optimize{padding-top:0}.blocks-app .ant-app .email-pane__collapse-wrapper .selected_form-mobile-props-title,.blocks-app .ant-app .email-pane__collapse-wrapper .selected_form-desktop-props-title{background-color:var(--ub-colorInfoBg);border:none;border-radius:0;height:0;padding:0 24px;top:0;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .panel-form__body{border:1px solid var(--ub-colorInfo);border-radius:0 0 calc(var(--ub-borderRadius) * 2px) calc(var(--ub-borderRadius) * 2px);scrollbar-gutter:auto;flex-direction:column;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .panel-form__body-content{flex-direction:column;flex:1;min-height:0;padding:0;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .panel-form__body-content>div{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .ant-tabs .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn{color:var(--ub-colorInfo)}.blocks-app .email-pane__collapse-wrapper.mobile-properties .ant-tabs .ant-tabs-ink-bar{background:var(--ub-colorInfo)}.blocks-app .email-pane__collapse-wrapper.mobile-properties .email-properties__collapse:after{display:none}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected-element-panel-content{flex-direction:column;flex:1;min-height:0;padding:0;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected-element-panel{flex-direction:column;flex:1;min-height:0;padding-left:0;padding-right:0;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected-element-panel>div{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties form.element-controls{flex-direction:column;height:100%;min-height:0;display:flex}.blocks-app .email-pane__collapse-wrapper.mobile-properties #selected_element_form_desktop_props{min-height:0;padding:24px var(--ub-panel-form-padding-x,24px) 0;flex:1;overflow:hidden auto}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected_form-mobile-props-wrapper{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected_form-mobile-props-header{flex-shrink:0}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected_form-mobile-props{scrollbar-gutter:stable;flex:1;min-height:0;overflow:hidden auto}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected-element-panel__float-blocks-settings{display:none}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected_form-desktop-props-title{opacity:1;height:32px;animation:.45s cubic-bezier(.16,1,.3,1) both em-mobile-props-title-slide-in;transform:translateY(0)}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected_form-mobile-props-title{z-index:1;border:none;border-bottom:1px solid var(--ub-colorBorderSecondary);background-color:var(--ub-colorInfoBg);padding:5px 24px;transform:translateY(0)}.blocks-app .email-pane__collapse-wrapper.mobile-view .ant-tabs-tab:first-child:hover{color:var(--ub-colorInfo)}.blocks-app .email-pane__collapse-wrapper.mobile-view .selected_form-mobile-props-title{opacity:1;height:32px;animation:.45s cubic-bezier(.16,1,.3,1) both em-mobile-props-title-slide-in;transform:translateY(0)}.blocks-app .email-pane__collapse-wrapper.mobile-view .selected_form-mobile-props-title .ant-alert-title{color:var(--ub-colorInfoText)}.blocks-app .email-pane__collapse-wrapper_build{flex:1;align-self:stretch;height:100%}.blocks-app .email-pane__collapse-wrapper_build>.email-pane__collapse{flex:1;min-height:0}.blocks-app .email-pane__collapse-wrapper_build>.email-pane__collapse>.ant-tabs-content-holder{flex:1;min-height:0;display:flex}.blocks-app .email-pane__collapse-wrapper_build>.email-pane__collapse>.ant-tabs-content-holder>.ant-tabs-content{height:100%;min-height:0}.blocks-app .email-pane__collapse-wrapper_build>.email-pane__collapse>.ant-tabs-content-holder>.ant-tabs-content>.ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .email-pane__col-wrapper_pinch .email-pane__collapse-wrapper{border:none;border-left:1px solid var(--ub-colorBorder);border-radius:0;height:100%}.blocks-app .email-pane__collapse{flex-direction:column;flex:1;width:100%;height:100%;min-height:0;max-height:100%;display:flex;overflow:hidden}.blocks-app .email-pane__collapse.ant-collapse{border:0}.blocks-app .email-pane__collapse-panel.ant-collapse-item{min-height:50px;overflow:hidden}.blocks-app .email-pane__comment-counter{border-radius:10px;width:27px;height:16px;margin:5px;padding:0 6px;font-size:12px}.blocks-app .email-pane__add-new-element-btn{width:100%;margin-bottom:60px}.blocks-app .email-pane__tab-bar.ant-tabs-nav{z-index:1;width:60px;margin-bottom:0;margin-left:8px;margin-right:0;top:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab-active{border-radius:8px;border-right:none!important}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tabpane,.blocks-app .ant-tabs-left>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab{padding-left:0}.blocks-app .ant-tabs-left>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab+.ant-tabs-tab,.blocks-app .ant-tabs-right>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab+.ant-tabs-tab{margin-top:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-nav-list{background:var(--ub-colorBgContainer);border-radius:8px;flex:none;padding:0 0 4px;box-shadow:0 2px 10px #0500380a}.blocks-app .email-pane__col-wrapper_pinch .email-pane__tab-bar.ant-tabs-nav .ant-tabs-nav-list{box-shadow:none;border-radius:0;height:100%}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-nav-wrap{overflow:unset;flex:none}.blocks-app .email-pane__tab-bar.ant-tabs-nav+.ant-tabs-content-holder{border-left:none;margin-left:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav+.ant-tabs-content-holder .ant-tabs-content>.ant-tabs-tabpane{padding-left:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab:first-child,.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab:nth-child(2),.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab:nth-child(3){display:none}.blocks-app .email-pane__col-wrapper_pinch .email-pane__tab-bar.ant-tabs-nav{margin-left:0;margin-right:0}.blocks-app .email-pane .ant-tabs-right>.ant-tabs-content-holder,.blocks-app .email-pane .ant-tabs-right>div>.ant-tabs-content-holder{border-right:none;margin-right:0}.blocks-app .email-pane .ant-tabs-left>.ant-tabs-nav .ant-tabs-tab{border:1px solid #0000;height:60px;padding:14px 24px}@media (width<=1550px){.blocks-app .email-pane .ant-tabs-left>.ant-tabs-nav .ant-tabs-tab{height:50px}}.blocks-app .email-pane .ant-collapse-panel{box-sizing:content-box;height:calc(100% - 50px);margin-top:-1px;overflow:auto}.blocks-app .email-pane .ant-tabs-content{height:100%;max-height:100%}.blocks-app .email-pane .ant-collapse-body,.blocks-app .email-pane .secondary-tabs .ant-tabs-content{height:100%;padding-bottom:0;position:relative;overflow:hidden scroll}.blocks-app .email-pane__comment-counter{position:absolute;top:-4px;right:0}@media (width<=1550px){.blocks-app .email-pane__comment-counter{right:-5px}}.blocks-app .email-pane__content-col_disable{pointer-events:none}.blocks-app .email-pane .header__project{vertical-align:middle;align-items:center;height:28px;padding-top:0;display:inline-flex}.blocks-app .email-pane .header__project .ant-avatar.ant-avatar-circle{min-width:28px}.blocks-app .email-pane_view .header__project{pointer-events:none}.blocks-app .email-pane__pane{height:100%;transition:height .2s cubic-bezier(0,0,.2,1);position:relative}.blocks-app .email-pane__panes{height:calc(100vh - 48px);display:flex;overflow:auto}.blocks-app .email-pane__panes-resizer{z-index:2;position:relative}.blocks-app .email-pane__panes-resizer:before{content:"";background-color:#0000;border-left:2px solid #0000;width:10px;height:100%;transition:border-color .2s;position:absolute;inset:0}.blocks-app .email-pane__panes-resizer:hover{cursor:col-resize}.blocks-app .email-pane__panes-resizer:hover:before{border-color:var(--ub-colorPrimary)}.blocks-app .email-pane__footer{z-index:2;border-top:1px solid #d9d9d9;height:28px;display:none;position:relative}.blocks-app .email-pane:not(.email-pane_view) .email-pane__pane-content{height:100%;position:absolute;inset:0;overflow:hidden}.blocks-app .email-pane__pane_main .email-pane:not(.email-pane_view) .email-pane__pane-content{overflow:auto}.blocks-app .email-pane:not(.email-pane_view) .email-pane__pane-content .email-pane__pane_editor{height:100%;overflow:visible}.blocks-app .email-pane:not(.email-pane_view) .email-pane__pane-content .email-pane__pane_editor .email-pane__pane-content{height:100%}.blocks-app .email-pane__buttons{text-align:right}.blocks-app .email-pane__buttons .ant-space.ant-space-horizontal.ant-space-align-center{display:flex}.blocks-app .email-pane__buttons button{width:46px;height:24px;margin-left:8px;padding:0}.blocks-app .email-pane__iframe-scroll-bottom,.blocks-app .email-pane__iframe-scroll-top{z-index:10;width:100%;height:50px;display:none;position:sticky;left:0;right:0}.blocks-app .email-pane__iframe-scroll-top{margin-bottom:-50px;top:0}.blocks-app .email-pane__iframe-scroll-bottom{margin-top:-50px;bottom:0}.blocks-app .email-pane__list{border:none;line-height:20px}.blocks-app .email-pane__list.ant-menu-horizontal>.ant-menu-item{padding:0 14px}.blocks-app .email-pane__list.ant-menu-horizontal>.ant-menu-item:after{content:none}.blocks-app .email-pane__list-item_active{color:var(--ub-colorPrimaryTextHover)}.blocks-app .ant-menu-item .email-pane__list-item-icon.anticon{font-size:20px}.blocks-app .email-pane__list-item:hover .email-pane__list-item-icon.anticon,.blocks-app .email-pane__list-item_active.ant-menu-item .email-pane__list-item-icon.anticon{color:var(--ub-colorPrimaryTextHover)}.blocks-app .email-pane__list-item.ant-menu-item.ant-menu-item-selected,.blocks-app .email-pane__list-item.ant-menu-item-disabled:hover .email-pane__list-item-icon.anticon{color:inherit}.blocks-app .email-pane__content-col.email-pane__content-col_menu{min-width:462px;margin-left:0}.blocks-app .email-pane__content-col_menu-left{margin-right:10px}.blocks-app .email-pane__code-mode{margin-top:10px;display:flex}.blocks-app .email-pane__code-mode .email-pane__panes{width:100%}.blocks-app .email-pane__code-mode .email-pane__panes+.email-pane__content-col.email-pane__content-col_menu,.blocks-app .email-pane__code-mode .email-pane__content-col.email-pane__content-col_menu:not(.email-pane__content-col_menu-right){width:60px;min-width:60px;margin-top:5px;margin-left:10px;margin-right:10px}.blocks-app .email-pane__code-mode .email-pane__content-col.email-pane__content-col_menu.email-pane__content-col_menu-right{width:50px;min-width:50px;margin-top:5px;margin-left:10px;margin-right:10px}.blocks-app .email-pane__col_code-mode{top:0}.blocks-app .email-pane__comments-icon-wrapper{text-align:center;cursor:pointer;width:50px;height:60px;margin-right:5px;padding:13px 21px;position:relative}.blocks-app .email-pane__comments-icon-wrapper:hover{color:#999da0}.blocks-app .email-pane__comment-counter{color:#000000d9;width:auto;min-width:28px;height:18px;text-shadow:none;border:1px solid #fff;border-radius:10px;margin:5px;padding:0 6px;font-size:12px;position:absolute;top:-8px;right:-10px}.blocks-app body.dark .email-pane__comment-counter{color:#f0f0f0;border-color:#1f1f1f}.blocks-app .email-pane__col-wrapper_pinch .email-pane__comment-counter{right:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tabpane,.blocks-app .ant-tabs-left>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab{padding-left:0}.blocks-app .ant-tabs-right>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab{padding-right:0}.blocks-app .ant-tabs-left>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab+.ant-tabs-tab{margin-top:0}.blocks-app .ant-tabs-right>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab+.ant-tabs-tab{z-index:1;margin-top:0}.blocks-app .ant-tabs-right>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab+.ant-tabs-tab .ant-tabs-tab-btn{background:0 0;border-radius:6px;justify-content:center;align-items:center;width:100%;height:100%;display:flex}.blocks-app .ant-tabs-right>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab+.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn{background:var(--ub-controlItemBgActive)}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-nav-list .ant-tabs-ink-bar{box-sizing:border-box;background:#fff;border:none;border-radius:6px;width:60px;margin:0 2px;display:none;box-shadow:0 2px 8px -2px #0000000d,0 1px 4px -1px #00000012,0 0 1px #00000014}.blocks-app .email-pane__tab-bar.ant-tabs-nav+.ant-tabs-content-holder{border-left:none;width:397px;margin-left:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav+.ant-tabs-content-holder .ant-tabs-content>.ant-tabs-tabpane{padding-left:0;padding-right:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab:first-child{display:none}.blocks-app .email-pane .ant-tabs-left>.ant-tabs-nav .ant-tabs-tab,.blocks-app .email-pane .ant-tabs-right>.ant-tabs-nav .ant-tabs-tab{border:none;height:56px;padding:4px 4px 0}.blocks-app .email-pane .ant-tabs-tab .anticon{margin-right:0;font-size:20px}.blocks-app .email-pane__code-mode:not(.email-pane__col_preview-collapsed){padding-left:60px}.blocks-app .email-pane__content-col_tabs.email-pane__content-col{margin-left:0;margin-right:0;transition:all .3s cubic-bezier(.075,.82,.165,1);top:30px}@media (width<=1350px){.blocks-app .email-pane__content-col_tabs.email-pane__content-col{transform-origin:0 0;transform:scale(.83)}}.blocks-app .email-pane__col-wrapper_pinch .email-pane__content-col_tabs.email-pane__content-col{margin-top:0;top:0;height:100%!important}.blocks-app .email-pane .email-pane__col-wrapper_pinch .blocks-search__empty-wrapper{height:calc(100% - 30px)}.blocks-app .email-pane__col_preview-collapsed{margin-left:70px}.blocks-app .email-pane .email-pane__content-col_main{border:1px solid var(--ub-colorBorder);border-radius:calc(var(--ub-borderRadiusXL) * 1px);margin-left:-2px;margin-right:-2px;transition:border-color .4s;overflow:hidden auto}.blocks-app .email-pane .secondary-tabs.secondary-tabs_unset_scroll .ant-tabs-nav:after{display:none}.blocks-app .email-pane .secondary-tabs.secondary-tabs_unset_scroll .ant-tabs-content{overflow-y:hidden;padding-top:0!important;padding-right:24px!important}.blocks-app .email-pane__col.email-pane__col_preview{flex-direction:column;justify-content:flex-start;align-items:center;max-width:1600px;margin:0;padding:0 2px;display:flex}.blocks-app .email-pane__sizes{border:1px solid var(--ub-colorBorder);z-index:10;opacity:.9;border-top:none;border-radius:0 0 8px 8px;justify-content:center;width:100%;height:15px;min-height:15px;margin-bottom:15px;transition:all .5s;display:flex;position:sticky;top:0;left:0}.blocks-app .email-pane__sizes:hover{opacity:1}.blocks-app .email-pane_code-mode .email-pane__row:not(.email-pane__bottom) .email-pane__sizes{border-width:0;height:0;min-height:0;margin-bottom:0}.blocks-app .email-pane__sizes .email-pane__width-selectors-wrapper{justify-content:center;width:100%;display:flex}.blocks-app .email-pane__sizes .device-width__theme{border-right:1px solid var(--ub-colorBorder);background-color:var(--ub-colorBgElevated);flex-shrink:0;width:36px;transition:all .3s;position:relative}.blocks-app .email-pane__sizes .device-width__theme .email-pane__theme-toggle{margin:0}.blocks-app .email-pane__sizes .device-width__theme-placeholder{flex-shrink:0;width:36px;cursor:default!important}.blocks-app .email-pane__sizes [class^=device-width__]{border-right:1px solid var(--ub-colorBorder);background-color:var(--ub-colorBgElevated);cursor:pointer;transition:all .3s;position:relative}.blocks-app .email-pane__sizes [class^=device-width__]:first-child{border-bottom-left-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .email-pane__sizes [class^=device-width__]:last-child{border-bottom-right-radius:calc(var(--ub-borderRadius) * 1px);border:none}.blocks-app .ant-app .email-pane__sizes [class^=device-width__] button{color:var(--ub-colorTextDescription);width:24px;min-width:24px;height:24px;line-height:1}.blocks-app .ant-app .email-pane__sizes [class^=device-width__] button:hover{background:var(--ub-colorPrimaryBg)}.blocks-app .email-pane__sizes .device-width__320{text-align:center;color:var(--ub-colorText);font-size:12px;line-height:15px}.blocks-app .email-pane__sizes.device-width__full-hovered [class^=device-width__],.blocks-app .email-pane__sizes.device-width__768-hovered [class*=__768],.blocks-app .email-pane__sizes.device-width__768-hovered [class*=__425],.blocks-app .email-pane__sizes.device-width__768-hovered [class*=__375],.blocks-app .email-pane__sizes.device-width__768-hovered [class*=__320],.blocks-app .email-pane__sizes.device-width__425-hovered [class*=__425],.blocks-app .email-pane__sizes.device-width__425-hovered [class*=__375],.blocks-app .email-pane__sizes.device-width__425-hovered [class*=__320],.blocks-app .email-pane__sizes.device-width__375-hovered [class*=__375],.blocks-app .email-pane__sizes.device-width__375-hovered [class*=__320],.blocks-app .email-pane__sizes.device-width__320-hovered [class*=__320]{background:var(--ub-colorPrimaryBg)}.blocks-app .email-pane__resizable{width:100%;margin-bottom:29px;transition:max-width .5s;position:relative}.blocks-app .blocks-plugin .email-pane__resizable{padding:0 2px}.blocks-app .email-pane__resizable_drag{transition:none}.blocks-app .email-pane__resizable .email-pane__handle{box-sizing:border-box;opacity:0;cursor:ew-resize;width:5px;height:100%;transition:opacity .4s;position:absolute}.blocks-app .email-pane_code-mode .email-pane__row:not(.email-pane__bottom) .email-pane__resizable .email-pane__handle{pointer-events:none}.blocks-app .email-pane__resizable .email-pane__handle:hover,.blocks-app .email-pane__resizable .email-pane__handle:active{opacity:1}.blocks-app .email-pane__resizable .email-pane__handle.left{left:0}.blocks-app .email-pane__resizable .email-pane__handle.right{right:0}.blocks-app .email-pane__left .email-pane__resizable,.blocks-app .email-pane__right .email-pane__resizable{margin-bottom:0}.blocks-app .email-pane__tooltip{margin-right:20px}.blocks-app .email-pane .ant-layout-content.container.email-pane__container{padding-bottom:0}.blocks-app .email-pane .ant-tabs-tabpane.ant-tabs-tabpane-active.em-analytics__email-tab-build{border-top-left-radius:0}.blocks-app .email-pane .ant-tabs-large.secondary-tabs .ant-tabs-nav-list{padding-left:24px}.blocks-app .email-pane .ant-tabs-large.secondary-tabs .ant-tabs-nav{margin-bottom:0}.blocks-app .email-pane .ant-tabs-large.secondary-tabs .ant-tabs-tab .ant-tabs-tab-btn{font-size:14px;font-weight:400}.blocks-app .email-pane .ant-tabs-large.secondary-tabs .ant-tabs-tab+.ant-tabs-tab{margin:0 0 0 20px}.blocks-app .email-pane .ant-tabs-large.secondary-tabs .ant-tabs-content{padding:24px 13px 4px 24px}.blocks-app .email-pane .ant-tabs-large.secondary-tabs.secondary-tabs_optimise .ant-tabs-content{padding:0 25px}.blocks-app .email-pane .ant-tabs-large.secondary-tabs.email-properties__collapse .ant-tabs-content{padding-bottom:0}.blocks-app .email-pane.email-pane_no-element-navigation .ant-tabs-large.secondary-tabs.email-properties__collapse .ant-tabs-content{padding-top:0}.blocks-app .email-pane .email-properties__collapse{position:relative}.blocks-app .email-pane .email-properties__collapse:after{content:"";background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);border-top:1px solid var(--ub-colorBorderSecondary);z-index:1;width:100%;height:20px;position:absolute;top:58px;left:0}.dark .blocks-app .email-pane .email-properties__collapse:after{background:linear-gradient(180deg, var(--ub-colorBgBase) -100%, transparent 50%)}.blocks-app .email-pane .ant-tooltip{pointer-events:none}.blocks-app .email-pane__blocks-search{overflow-clip-margin:40px;flex-direction:column;height:calc(100% - 44px);min-height:0;display:flex;overflow:clip}.blocks-app .email-pane__blocks-search label.ant-segmented-item{margin-top:0}.blocks-app .email-pane__blocks-panel,.blocks-app .email-pane__blocks-panel-body{height:100%}.blocks-app .email-pane__blocks-panel-header{flex-shrink:0}.blocks-app .email-pane__blocks-panel-results{display:none}.blocks-app .email-pane__blocks-panel-results_visible{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.blocks-app .email-pane__blocks-panel_scrollable,.blocks-app .email-pane__blocks-panel_scrollable{overflow-clip-margin:40px;flex-direction:column;flex:1;min-height:0;display:flex;overflow:clip}.blocks-app .email-pane__blocks-panel_scrollable .email-pane__blocks-panel-body{flex-direction:column;flex:1;min-height:0;margin-left:-24px;margin-right:-24px;display:flex;overflow:hidden}.blocks-app .email-pane__blocks-panel_scrollable .blocks-search__empty-shadow{padding-left:24px;padding-right:24px}.blocks-app .email-pane .email-pane__blocks-search .ant-segmented{position:relative;top:-7px}@media screen and (width<=700px){.blocks-app .email-pane_view .email-pane__buttons{display:none}.blocks-app .email-pane__content{margin:0;padding-right:0}.blocks-app .email-pane__content .email-pane__content-col_main{min-width:100%}.blocks-app .email-pane__content .email-pane__content-col_menu{display:none}.blocks-app .email-pane__content .email-pane__content-col_menu+.email-pane__resizer{border-left:none;border-right:2px solid #0000}.blocks-app .email-pane__content .email-pane__content-col_menu+.email-pane__resizer:hover{border-color:var(--ub-colorPrimary)}}.blocks-app .ant-menu-vertical.element-preview-menu__list_discuss li.ant-menu-item{text-align:right;padding:0 10px}.blocks-app .ant-tooltip{pointer-events:none}@media (width<=1550px){.blocks-app .email-pane .ant-tabs .secondary-tabs.email-pane__collapse:not(.secondary-tabs_unset_scroll):after{margin-top:44px}}.dark .blocks-app .email-pane .ant-tabs .blocks-search__empty-shadow:after{background:linear-gradient(180deg, var(--ub-colorBgBase) -100%, transparent 50%)}.dark .blocks-app .ant-app .email-pane .ant-tabs-extra-content .ant-segmented_editor-mode{background-color:#121212}.blocks-app .collaborator-list{position:absolute;bottom:30px}.blocks-app .ant-app .email-pane__col-wrapper_pinch .ant-switch.ant-switch_editor-mode{width:48px}.blocks-app .ant-app .email-pane__col-wrapper_pinch .ant-switch.ant-switch_editor-mode.ant-switch-checked{background:var(--ub-controlItemBgActive)}.blocks-app .ant-app .email-pane__col-wrapper_pinch .ant-switch.ant-switch_editor-mode.ant-switch-checked .ant-switch-inner-checked{color:var(--ub-colorPrimary)}.blocks-app .email-preview-menu__versions .ant-btn,.blocks-app .email-preview-menu__code .ant-btn,.blocks-app .email-preview-menu__preview .ant-btn,.blocks-app .email-preview-menu__test{justify-content:center;align-items:center;display:inline-flex}.blocks-app .email-preview-menu__list-item-icon{align-items:center;display:inline-flex}.blocks-app .email-preview-menu_right{margin-left:auto}.blocks-app .email-preview-menu_new{align-items:center;padding-right:22px;display:flex}.blocks-app .email-preview-menu .email-preview-menu__history *{pointer-events:none}.blocks-app .ant-menu.email-preview-menu__list{border:0}.blocks-app .ant-menu-vertical .ant-menu-item.email-preview-menu__list-item{margin-top:0;padding:0 10px}.blocks-app .ant-menu-vertical .ant-menu-item.email-preview-menu__list-item_disabled{cursor:not-allowed}.blocks-app .ant-menu-vertical .ant-menu-item.email-preview-menu__list-item:hover .ant-menu-item.email-preview-menu__list-item_disabled .anticon.email-preview-menu__list-item-icon{color:inherit}.blocks-app .ant-menu-vertical .ant-menu-item.email-preview-menu__list-item a{width:40px;height:40px;margin-left:-10px;display:block}.blocks-app .ant-menu-vertical .ant-menu-item.email-preview-menu__list-item a .email-preview-menu__list-item-icon{margin-left:10px}.blocks-app .ant-menu-item .anticon.email-preview-menu__list-item-icon{font-size:20px}.blocks-app .ant-menu-item .anticon.email-preview-menu__list-item-icon_revert{transform:scaleX(-1)}.blocks-app .email-preview-menu__list-item:hover .anticon.email-preview-menu__list-item-icon,.blocks-app .ant-menu-item.email-preview-menu__list-item_active .anticon.email-preview-menu__list-item-icon{color:var(--ub-colorPrimaryHover)}.blocks-app .ant-menu-item.ant-menu-item-selected.email-preview-menu__list-item,.blocks-app .ant-menu-item-disabled.email-preview-menu__list-item:hover .anticon.email-preview-menu__list-item-icon{color:inherit}.blocks-app .ant-menu-vertical>.email-preview-menu__list__scroll-buttons{cursor:default;text-align:center;height:auto;margin:0;padding:0}.blocks-app .ant-menu-vertical>.email-preview-menu__list__scroll-buttons .ant-space{display:block}.blocks-app .ant-menu-vertical>.email-preview-menu__list__scroll-buttons button{width:40px;height:40px;box-shadow:none;text-shadow:none;background:0 0;border:none;margin-bottom:8px;padding:0;display:block}.blocks-app .ant-menu-vertical>.email-preview-menu__list__scroll-buttons button .anticon{font-size:20px;transition:color .3s}.blocks-app .ant-menu-vertical>.email-preview-menu__list__scroll-buttons button .anticon :hover{color:var(--ub-colorPrimaryHover)}.blocks-app .ant-menu-vertical .email-preview-menu__list__divider{border-top:2px solid var(--ub-colorBorder);width:20px;min-width:auto;margin:20px 0}.blocks-app .ant-menu-vertical .email-preview-menu__list__divider.second-devider{margin-left:10px}.blocks-app .code-size-warning-modal .ant-modal-container{padding:32px}.blocks-app .code-size-warning-modal__content{flex-direction:column;display:flex}.blocks-app .code-size-warning-modal__icon{color:var(--ub-colorWarning);margin-bottom:16px;font-size:64px}.blocks-app .code-size-warning-modal__icon .anticon{display:block}.blocks-app .code-size-warning-modal__title{color:var(--ub-colorText);margin:0 0 12px;font-size:18px;font-weight:600}.blocks-app .code-size-warning-modal__message{color:var(--ub-colorTextSecondary);margin-bottom:24px;font-size:14px;line-height:1.6}.blocks-app .code-size-warning-modal__message p{margin:0 0 12px}.blocks-app .code-size-warning-modal__message p:last-child{margin-bottom:0}.blocks-app .code-size-warning-modal__message strong{color:var(--ub-colorError);font-weight:600}.blocks-app .code-size-warning-modal__image{width:100%;margin-bottom:24px}.blocks-app .code-size-warning-modal__image-placeholder{border-radius:8px;width:100%;height:200px;display:flex}.blocks-app .code-size-warning-modal__image-placeholder img{object-fit:contain;max-width:100%;max-height:100%}.blocks-app .code-size-warning-modal__actions{width:100%;display:flex}.blocks-app .code-size-warning-modal__actions .ant-btn{min-width:140px}.blocks-app .integration-tile{border:1px solid var(--ub-colorBorderSecondary);background:var(--ub-colorBgContainer);border-radius:8px;flex-direction:column;min-height:254px;padding:16px;transition:border-color .2s;display:flex}.blocks-app .integration-tile--error{border-color:var(--ub-colorError)}.blocks-app .integration-tile__body{flex:1;min-height:0}.blocks-app .integration-tile__icon{object-fit:contain;width:48px;height:48px;margin-bottom:12px}.blocks-app .integration-tile__icon-svg{margin-bottom:12px;font-size:48px;line-height:1}.blocks-app .integration-tile__title{color:var(--ub-colorText);margin:0 0 4px;font-size:14px;font-weight:500;line-height:1.3;display:block}.blocks-app .integration-tile__description{color:var(--ub-colorTextSecondary);margin:0;font-size:12px;font-weight:300;line-height:1.4;display:block}.blocks-app .integration-tile__footer{justify-content:space-between;align-items:flex-end;gap:8px;min-height:40px;margin-top:16px;display:flex}.blocks-app .integration-tile__badge{white-space:nowrap;border-radius:11px;align-items:center;height:22px;padding:0 8px;font-size:12px;font-weight:400;line-height:1;display:inline-flex}.blocks-app .integration-tile__badge--connected{color:var(--ub-colorSuccess);background:var(--ub-colorSuccessBg)}.blocks-app .integration-tile__badge--not_connected{color:var(--ub-colorTextSecondary);background:var(--ub-colorFillTertiary)}.blocks-app .integration-tile__badge--error{color:var(--ub-colorError);background:var(--ub-colorErrorBg)}.blocks-app .integration-tile__badge--coming_soon{color:var(--ub-colorPrimary);background:var(--ub-colorPrimaryBg)}.blocks-app .integration-tile__configure.ant-btn{box-sizing:border-box;width:40px;min-width:40px;height:40px;box-shadow:none;background:var(--ub-colorFillQuaternary);color:var(--ub-colorTextSecondary);border:none;border-radius:6px;flex-direction:row;flex:none;justify-content:center;align-items:center;gap:0;padding:0;display:inline-flex}.blocks-app .integration-tile__configure.ant-btn.ant-btn-icon-only{width:40px;min-width:40px;height:40px;padding:0}.blocks-app .integration-tile__configure.ant-btn .ant-btn-icon{justify-content:center;align-items:center;width:16px;height:16px;margin:0;line-height:0;display:inline-flex}.blocks-app .integration-tile__configure.ant-btn:not(:disabled):hover,.blocks-app .integration-tile__configure.ant-btn:not(:disabled):focus-visible{box-shadow:none;background:var(--ub-colorFillTertiary);color:var(--ub-colorTextSecondary);border:none}.blocks-app .integration-tile__configure.ant-btn:disabled,.blocks-app .integration-tile__configure.ant-btn.ant-btn-disabled{cursor:not-allowed;box-shadow:none;opacity:1;background:var(--ub-colorFillQuaternary);color:var(--ub-colorTextQuaternary);border:none}.blocks-app .integration-tile__configure.ant-btn:disabled .ant-btn-icon,.blocks-app .integration-tile__configure.ant-btn.ant-btn-disabled .ant-btn-icon{color:var(--ub-colorTextQuaternary)}.blocks-app .integration-tile__configure.ant-btn:disabled:hover,.blocks-app .integration-tile__configure.ant-btn:disabled:focus-visible,.blocks-app .integration-tile__configure.ant-btn.ant-btn-disabled:hover,.blocks-app .integration-tile__configure.ant-btn.ant-btn-disabled:focus-visible{box-shadow:none;background:var(--ub-colorFillQuaternary);color:var(--ub-colorTextQuaternary);border:none}.blocks-app .ant-app .integration-tile__configure.ant-btn.ant-btn-icon-only{width:40px;min-width:40px;height:40px;padding:0}.blocks-app .ant-app .integration-tile__configure.ant-btn.ant-btn-icon-only:disabled,.blocks-app .ant-app .integration-tile__configure.ant-btn.ant-btn-icon-only.ant-btn-disabled{opacity:1;background:var(--ub-colorFillQuaternary);color:var(--ub-colorTextQuaternary)}.blocks-app .em-export-platforms-submenu .ant-dropdown-menu{max-height:420px;overflow-y:auto}.blocks-app .app-logo{color:#000;line-height:1.35;display:inline-block}.blocks-app .app-logo:hover{color:#000}.blocks-app .em-analytics__email-save .ant-btn-loading-icon .anticon,.blocks-app .em-analytics__block-save .ant-btn-loading-icon .anticon{font-size:16px}.blocks-app .main__ribbon{background:var(--ub-colorInfo);min-height:43px;color:var(--ub-colorTextLightSolid);flex-direction:row;justify-content:center;align-items:center;font-size:16px;display:flex}.blocks-app .main__ribbon button{background:var(--ub-colorInfoTextHover)}.blocks-app .main__ribbon button:hover{background:var(--ub-colorInfoHover)!important}.blocks-app .main__ribbon .main__ribbon-resend.ant-btn.ant-btn-sm{padding-block:5px;padding-inline:14px}.blocks-app .header{box-sizing:content-box;border-bottom:1px solid;height:70px;min-height:70px}.blocks-app .header_blocks{padding-right:10px}.blocks-app .header_main{z-index:1}.blocks-app .header__container{justify-content:space-between;align-items:center;gap:30px;min-height:70px;transition:opacity .3s;display:flex}.blocks-app .header__logo,.blocks-app .header__project{white-space:nowrap;text-overflow:ellipsis;max-width:220px;display:block;overflow:hidden}.blocks-app .header__logo{padding-top:10px}.blocks-app .header h2,.blocks-app .header h3{margin:0}.blocks-app .header__right{max-height:40px}.blocks-app .header__right .header__action-btn.ant-btn{align-items:center;height:34px;min-height:34px;padding-block:0;display:inline-flex}.blocks-app .header__right .ant-space.ant-space-horizontal.ant-space-align-center{align-items:center;display:flex}.blocks-app .header__right,.blocks-app .header__left{display:flex}.blocks-app .header__left .ant-space,.blocks-app .header__left .ant-space .ant-space-item:last-child{flex-grow:1}.blocks-app .header .project-menu__list-item{cursor:pointer;transition:color .3s}.blocks-app .header .project-menu__list-item:hover{color:#40a9ff}.blocks-app .header .project-menu__list-item svg{width:1.2em;height:1.2em;vertical-align:inherit}.blocks-app .header .project-menu__list-item .anticon-bell svg{width:1.4em;height:1.4em}.blocks-app .header .ant-typography{margin-bottom:0}.blocks-app .foo-title{color:#fff;letter-spacing:1px;background:#9254de;border-radius:3px;margin-top:-10px;margin-left:-4px;padding:0 7px;font-size:13px;font-weight:500;position:absolute}.blocks-app .email-page-header__dropdown-menu{top:10px}.blocks-app .email-page-header__email-id{color:var(--ub-colorTextTertiary)}.blocks-app .email-page-header .button{cursor:pointer}.blocks-app .anticon.anticon-edit.email-page-header__icon-edit{color:#8c8c8c;margin-left:6px;font-size:16px}.blocks-app .ant-typography-edit:hover .anticon.anticon-edit.email-page-header__icon-edit{color:var(--ub-colorPrimaryHover)}.blocks-app .ant-page-header-heading{max-width:700px;transition:all .2s;position:relative}.blocks-app .ant-page-header-heading svg{cursor:pointer;opacity:0;justify-content:center;width:0;height:0;transition:all .2s .2s;position:absolute;top:0;right:3px}.blocks-app .ant-page-header-heading svg:hover{color:var(--ub-colorPrimaryHover)}.blocks-app .ant-page-header-heading.focus{background-color:var(--ub-colorFillSecondary);border-radius:calc(var(--ub-borderRadiusSM) * 1px);padding:0 8px}.blocks-app .ant-page-header-heading.focus svg{opacity:1;width:20px;height:20px;top:3px}.blocks-app .ant-page-header-heading.ant-page-header-heading_preheader.focus svg{top:3px}.blocks-app .ant-page-header-heading_preheader .anticon{top:-2px}.blocks-app .email-page-header .ant-page-header-heading-left{flex-grow:1;overflow:visible}.blocks-app .email-page-header .ant-page-header-back{align-self:flex-start;margin-right:0;padding-top:8px}.blocks-app div.ant-typography-edit-content.ant-page-header-heading-preheader,.blocks-app div.ant-typography-edit-content.ant-page-header-heading-title{margin-top:0;margin-bottom:0;inset-inline-start:0}.blocks-app .header__left .ant-form-item-control-input,.blocks-app .header__left .ant-form-item-control-input-content{line-height:normal;min-height:auto!important}.blocks-app .header__left .ant-page-header-heading-title{white-space:pre-wrap;text-overflow:ellipsis;border-radius:0;flex-grow:1;min-height:auto;font-weight:500;line-height:1;overflow:visible;height:auto!important;padding:3px 20px 3px 0!important}.blocks-app .header__left .ant-page-header-heading-preheader{max-width:700px;min-height:auto;box-shadow:none;text-overflow:ellipsis;white-space:nowrap;border-radius:0;display:block;overflow:hidden;height:auto!important;padding:3px 20px 3px 0!important;line-height:20px!important}.blocks-app .header__left .ant-skeleton.ant-skeleton-element{width:100%;display:block}.blocks-app .ant-page-header-heading-title,.blocks-app .ant-page-header-heading-preheader{background:0 0;padding:0;box-shadow:none!important;border:none!important;transition:none!important}.blocks-app .ant-page-header-heading-preheader{color:var(--ub-colorTextSecondary);min-height:auto}.blocks-app .subject_preheader_form__title{width:80px;color:var(--ub-colorTextTertiary);white-space:nowrap}.blocks-app .ant-page-header-heading-title{line-height:22px!important}.blocks-app .email-page-header .ant-typography{align-items:center;margin-bottom:0;padding:0 12px;display:flex}.blocks-app .email-page-header .ant-typography-edit-content{margin-top:-10px;padding:0;top:5px;left:auto}.blocks-app .email-page-header .ant-input{font-size:inherit;font-weight:inherit}.blocks-app .email-page-header .ant-page-header-heading-extra>*{margin-left:8px}.blocks-app header .ant-btn.email-page-header__btn_extra{width:32px;padding:0}.blocks-app .update-global-blocks-modal__hint{color:#000000a6;margin-bottom:16px}.blocks-app .update-global-blocks-modal__list{flex-direction:column;gap:12px;max-height:320px;display:flex;overflow-y:auto}.blocks-app .update-global-blocks-modal__row{align-items:center;gap:12px;display:flex}.blocks-app .update-global-blocks-modal__title{flex-direction:column;flex:auto;display:flex;overflow:hidden}.blocks-app .update-global-blocks-modal__version{color:#00000073;font-size:12px}.blocks-app .update-global-blocks-modal__count{color:#00000073;flex:none;font-size:12px}.blocks-app .update-global-blocks-modal__footer{justify-content:flex-end;gap:8px;display:flex}.blocks-app .convert-layout-modal .ant-modal-header{text-align:center;margin-top:16px;margin-bottom:8px}.blocks-app .convert-layout-modal .ant-modal-footer{margin-top:16px;padding:0 8px}.blocks-app .convert-layout-modal__title{color:var(--ub-colorText);font-size:20px;font-weight:600}.blocks-app .convert-layout-modal__content{flex-direction:column;align-items:center;gap:24px;display:flex;overflow:hidden}.blocks-app .convert-layout-modal__text{font-size:14px;line-height:1.5}.blocks-app .convert-layout-modal__intro-text{text-align:center;color:var(--ub-colorTextSecondary);padding:0 16px}.blocks-app .convert-layout-modal__image{border-radius:8px;width:100%;max-width:100%;height:auto;display:block}.blocks-app .convert-layout-modal__footer{justify-content:flex-end;gap:8px;margin-top:8px;display:flex}.blocks-app .convert-layout-modal__footer--between{justify-content:space-between}.blocks-app .convert-layout-modal__error-details{background-color:var(--ub-colorErrorBg,#ff00000f);color:var(--ub-colorTextSecondary);word-break:break-word;border-radius:8px;margin-top:12px;padding:8px 12px;font-size:12px}.blocks-app .conversion-overlay{z-index:2000;background-color:var(--ub-colorBgMask,#00000073);justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.blocks-app .conversion-overlay__content{background-color:var(--ub-colorBgElevated);width:360px;max-width:80vw;box-shadow:var(--ub-boxShadowSecondary);text-align:center;border-radius:12px;flex-direction:column;align-items:center;gap:16px;padding:32px;display:flex}.blocks-app .conversion-overlay__title{color:var(--ub-colorText);font-size:16px;font-weight:600}.blocks-app .conversion-overlay__hint{color:var(--ub-colorTextSecondary);font-size:13px}.blocks-app .conversion-overlay__progress{width:100%}@media (width<=1550px){.blocks-app .email-pane__col_settings{margin-left:48px;margin-right:32px}}.blocks-app .em-dragging-element{border-radius:8px}.blocks-app .em-dragging-element>div{box-shadow:none!important}.blocks-app .em-dragging-element .blocks-search__result-html,.blocks-app .em-dragging-element span,.blocks-app .em-dragging-element .atoms__item:before{visibility:hidden}.blocks-app .em-ghost-element.blocks-search__result-html,.blocks-app .em-ghost-element span,.blocks-app .em-ghost-element.atoms__item:before{visibility:visible!important}.blocks-app .em-ghost-element table{border-collapse:initial}',e=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),a=t;if(!e.sheets[a]){var p=!1;try{if(typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&document.adoptedStyleSheets){var n=new CSSStyleSheet;n.replaceSync(t),document.adoptedStyleSheets=document.adoptedStyleSheets.concat([n]),e.sheets[a]=n,e.order.push(a),p=!0}}catch{p=!1}if(!p){var o=document.createElement("style");o.setAttribute("data-useblocks","true"),o.appendChild(document.createTextNode(t)),document.head.appendChild(o),e.sheets[a]=o,e.order.push(a)}}}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
|
|
95
|
-
__useblocks__.define("core",["require","exports","module","static/core/2ff39ddf.js","static/core/fe480726.js","static/core/
|
|
95
|
+
__useblocks__.define("core",["require","exports","module","static/core/2ff39ddf.js","static/core/fe480726.js","static/core/c00a8e02.js","static/core/d3e05bb9.js","static/core/a5b517f0.js","react","react/jsx-runtime","__delivery__/libs","vite/preload-helper","react-dom/client","classnames","dayjs"],function(ye,nn,Dv){Object.defineProperties(nn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const zt=ye("./static/core/2ff39ddf.js"),h=ye("./static/core/fe480726.js"),r=ye("./static/core/c00a8e02.js"),xt=ye("./static/core/d3e05bb9.js"),yt=ye("./static/core/a5b517f0.js");let l=ye("react");l=zt.__toESM(l);let a=ye("react/jsx-runtime"),_=ye("__delivery__/libs"),Ve=ye("vite/preload-helper"),nl=ye("react-dom/client"),rt=ye("classnames");rt=zt.__toESM(rt);let En=ye("dayjs");En=zt.__toESM(En);var rl="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function ol(){return h.createAbortError(rl)}function il(e,t,n){if(typeof document>"u")return;let o=!1,i;const s=()=>{o=!0,i?.disconnect(),i=void 0},c=()=>{o||(s(),t())};if(n.addDispose(s),!e.isConnected){queueMicrotask(c);return}i=new MutationObserver(()=>{e.isConnected||c()});let d=e.parentNode;for(;d;)i.observe(d,{childList:!0}),d=d.parentNode}var sl="-host-mount";function al(){return`data-useblocks${sl}`}function ll(e,t){Array.from(e.children).forEach(n=>{n.nodeType===Node.ELEMENT_NODE&&n.hasAttribute(t)&&n.remove()})}function cl(e){const t=al();ll(e,t);const n=document.createElement("div");n.setAttribute(t,"true"),n.setAttribute("translate","no"),n.classList.add("notranslate"),n.style.display="block",n.style.width="100%",n.style.height="100%",n.style.minHeight="100%";const o=e.querySelector(":scope > [data-canvas-host]");return o?e.insertBefore(n,o):e.appendChild(n),n}function dl(e,t,n){n.addDispose(()=>{t.parentNode===e&&t.remove()})}function zn(e){return t=>{let n=null,o=!1;return{async setOptions(i){if(!n&&!o){n=await e(t);const s=await t.getInstanceAsync(h.INSTANCE_ID);Object.assign(s,n.instance||{})}n.setOptions&&await n.setOptions(i)},instance:{},dispose(){n?.dispose&&n?.dispose(),o=!0}}}}var ul=class{shadowRoot;markerAttr;observer;addedKeys=new Set;constructor({shadowRoot:e,markerAttr:t="data-useblocks"}){this.shadowRoot=e,this.markerAttr=t,this.observer=new MutationObserver(this.handleMutations),this.observer.observe(document.head,{childList:!0,subtree:!1}),this.syncExistingStyles()}syncExistingStyles(){const e=document.querySelectorAll(`style[${this.markerAttr}], link[${this.markerAttr}]`);for(let t=e.length-1;t>=0;t--)this.cloneAndInjectNode(e[t])}getNodeKey(e){return e.tagName==="STYLE"?(e.textContent||"").trim():e.tagName==="LINK"?e.href:null}cloneAndInjectNode(e){const t=this.getNodeKey(e);if(!t||this.addedKeys.has(t))return;const n=e.cloneNode(!0);this.shadowRoot.insertBefore(n,this.shadowRoot.firstChild),this.addedKeys.add(t)}handleMutations=e=>{for(const t of e)for(const n of t.addedNodes)n.nodeType===1&&(n instanceof HTMLStyleElement||n instanceof HTMLLinkElement)&&n.hasAttribute(this.markerAttr)&&this.cloneAndInjectNode(n)};dispose(){this.observer.disconnect(),this.addedKeys.clear()}};function pl({children:e}){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)("div",{className:"config-gate-fallback"}),children:e})}var ml=document.querySelectorAll("link[rel=stylesheet][media*=prefers-color-scheme][media*=dark]"),fl=document.querySelectorAll("link[rel=stylesheet][media*=prefers-color-scheme][media*=light]"),gl=e=>{if(typeof e!="string")return!1;const t=e.trim();return t.length>0&&!/\s/.test(t)},hl=e=>{let t,n;e==="system"?(t=r.PREFERS_COLOR_SCHEME_LIGHT,n=r.PREFERS_COLOR_SCHEME_DARK):(t=e==="light"?"all":r.NOT_ALL,n=e==="dark"?"all":r.NOT_ALL),[...fl].forEach(o=>{o.media=t}),[...ml].forEach(o=>{o.media=n})},_l=(e={})=>{const t=document.querySelector("head"),n=document.createElement("style");if(n.type="text/css",n.dataset.themeVaribalse=!0,n.setAttribute("data-useblocks","true"),Object.entries(e).length){let o="";Object.entries(e).forEach(([s,c])=>{typeof c!="object"&&(o+=` ${r.themeTokenCssVarName(s)}: ${c};
|
|
96
96
|
`)}),o=`.blocks-body, .blocks-app, .ant-modal-root, .ant-tooltip, .ant-notification {
|
|
97
97
|
${o}}`,n.appendChild(document.createTextNode(o));const i=t.querySelector('[data-theme-varibalse="true"]');i?t.replaceChild(n,i):t.insertBefore(n,t.firstChild)}},yl=e=>{if(!gl(e))return;const t=e.trim(),n=document.body;n.classList.contains(t)||setTimeout(()=>{n.classList.remove(t==="dark"?r.LIGHT:r.DARK),n.classList.add(t)},200)},vl=()=>{const e=r.useSendPostMessage();return(0,l.useCallback)(()=>{const t=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_color_scheme),n=matchMedia("(prefers-color-scheme: dark)").matches?r.DARK:r.LIGHT,o=t||n;e({operation:r.EVENT_TYPES.UPDATE_PREVIEW,theme:o})},[e])},Gt={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")},Fv={defaultMerge:Gt.defaultMerge};function bl(e,t){return t}function ei(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:wl(e)?1:e instanceof Set?3:e instanceof Map?4:5}function El(e){const t=new Set;for(const n of e)for(const o of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(o);return t}function Sl(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function ti(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}var ni=new Set(["[object Object]","[object Module]"]);function wl(e){if(!ni.has(Object.prototype.toString.call(e)))return!1;const{constructor:t}=e;if(t===void 0)return!0;const n=t.prototype;return!(n===null||typeof n!="object"||!ni.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function kl(e,t,n){const o={};for(const i of El(e)){const s=[];for(const d of e)Sl(d,i)&&s.push(d[i]);if(s.length===0)continue;const c=oi(s,t,t.metaDataUpdater(n,{key:i,parents:e}));c!==Gt.skip&&(i==="__proto__"?Object.defineProperty(o,i,{value:c,configurable:!0,enumerable:!0,writable:!0}):o[i]=c)}return o}function Cl(e){return e.flat()}function Tl(e){return new Set(ti(e))}function Il(e){return new Map(ti(e))}function ri(e){return e.at(-1)}var Gr=Object.freeze({__proto__:null,mergeArrays:Cl,mergeMaps:Il,mergeOthers:ri,mergeRecords:kl,mergeSets:Tl});function Wr(...e){return Al({})(...e)}function Al(e,t){const n=xl(e,o);function o(...i){return oi(i,n,t)}return o}function xl(e,t){return{defaultMergeFunctions:Gr,mergeFunctions:{...Gr,...Object.fromEntries(Object.entries(e).filter(([n,o])=>Object.hasOwn(Gr,n)).map(([n,o])=>o===!1?[n,ri]:[n,o]))},metaDataUpdater:e.metaDataUpdater??bl,deepmerge:t,useImplicitDefaultMerging:e.enableImplicitDefaultMerging??!1,actions:Gt}}function oi(e,t,n){if(e.length===0)return;if(e.length===1)return Hr(e,t,n);const o=ei(e[0]);if(o!==0&&o!==5){for(let i=1;i<e.length;i++)if(ei(e[i])!==o)return Hr(e,t,n)}switch(o){case 1:return Pl(e,t,n);case 2:return Rl(e,t,n);case 3:return jl(e,t,n);case 4:return Ol(e,t,n);default:return Hr(e,t,n)}}function Pl(e,t,n){const o=t.mergeFunctions.mergeRecords(e,t,n);return o===Gt.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):o}function Rl(e,t,n){const o=t.mergeFunctions.mergeArrays(e,t,n);return o===Gt.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):o}function jl(e,t,n){const o=t.mergeFunctions.mergeSets(e,t,n);return o===Gt.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):o}function Ol(e,t,n){const o=t.mergeFunctions.mergeMaps(e,t,n);return o===Gt.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):o}function Hr(e,t,n){const o=t.mergeFunctions.mergeOthers(e,t,n);return o===Gt.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):o}function qr(e){"@babel/helpers - typeof";return qr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qr(e)}function Ll(e){r.requiredArgs(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||qr(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):new Date(NaN)}function Ml(e){const t=new Map,n=new Set;let o=null,i=null;const s=(d,u)=>{const p={participantId:d.participant.id,acknowledgedVersion:d.acknowledged,documentVersion:e.get().version,error:u};n.forEach(f=>f(p))},c=d=>{if(d.detached)return;const u=e.get().version;if(d.acknowledged===u||d.skipVersion===u)return;if(d.pushing){d.stale=!0;return}d.pushing=!0;const{attributes:p}=e.get(),f=d.participant.applyChanges&&i?.version===u&&d.acknowledged===u-1?i:null;(f?d.participant.applyChanges(f.changes,u,p):d.participant.apply(e.getContent(),u,p)).then(()=>{d.acknowledged=u}).catch(g=>{s(d,g)}).finally(()=>{d.pushing=!1,d.stale&&(d.stale=!1,c(d))})};return e.subscribe(({version:d,changes:u})=>{i=u?.length?{version:d,changes:u}:null,t.forEach(c)}),{attach(d){const u={participant:d,acknowledged:null,pushing:!1,stale:!1,detached:!1,skipVersion:null};return t.set(d.id,u),c(u),{acknowledgedVersion:()=>u.acknowledged,reset(){u.acknowledged=null,u.skipVersion=null,c(u)},detach(){u.detached=!0,t.delete(d.id)}}},setPrimacy(d){o=d},getPrimacy:()=>o,mutateFrom(d,u,p){const f=t.get(d);if(p.echo!==!0&&o!==null&&o!==d)return f?.participant.dropUnsent?.(),null;const g=e.get().version;f&&(f.skipVersion=g+1);const y=e.mutate(u,{source:p.source});return f&&y===g?f.skipVersion=null:f&&(f.acknowledged=y),y},onOutOfSync(d){return n.add(d),()=>n.delete(d)}}}var Nl=({children:e})=>{const[t,n]=(0,l.useState)([]),o=r.useEvent(h.MODAL_SHOW_EVENT),i=r.useEvent(h.MODAL_CLOSE_EVENT),s=r.useEvent(h.MODAL_UPDATE_EVENT),c=r.useModalRootElement(),d=(0,l.useCallback)(g=>{n(y=>g===void 0?[]:y.filter(m=>m.id!==g))},[n]),u=(0,l.useCallback)(g=>{n(y=>{const m=y.find(E=>E.id===g.id);return m?y.map(E=>E===m?{...E,...m}:E):[...y,{...g,visible:!0}]})},[n]),p=(0,l.useCallback)(g=>{n(y=>{const m=y.find(E=>E.id===g.id);return m?y.map(E=>E===m?{...E,...m}:E):y})},[n]),f=(0,l.useCallback)(()=>c,[c]);return(0,l.useEffect)(()=>{const g=new h.Disposable;return g.addDisposable(o(u)),g.addDisposable(s(p)),g.addDisposable(i(d)),()=>g.dispose()},[o,i,s,u,d,p]),(0,a.jsxs)(a.Fragment,{children:[t.map(({id:g,content:y,props:m,visible:E,onOk:k,onClose:w,modalProps:v,...x})=>{const P=()=>d(g),K=async()=>{k&&await k(),d(g)};return(0,a.jsx)(_.ui_kit$Modal,{open:E,onCancel:P,onOk:K,afterClose:w,getContainer:f,...v,...x,children:typeof y!="function"?y:l.default.createElement(y,m)},g)}),e]})},Dl=new Set;function ii(e){const t=typeof e=="string"&&e?e:void 0;t?window.localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_color_scheme,t):window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_color_scheme);for(const n of Dl)n(t)}var Fl=[(0,_.ui_kit$createTransformer)()],Bl={colorDarken1:"rgba(0, 0, 0, 0.08)",colorFillSecondaryDarken:"rgba(0, 0, 0, 0.1)",formControlHeight:34,borderWidth:1,borderColorHover:"#C5C5C5",formItemMarginBottomMD:20,formItemMarginBottomXS:8,colorSecondaryH:265.03,colorSecondaryS:"63.92%",colorSecondaryL:"50%",colorSecondaryBgH:273,colorSecondaryBgS:"100%",colorSecondaryBgL:"93%",appZoom:1},$l={colorDarken1:"rgba(0, 0, 0, 0.9)",colorFillSecondaryDarken:"rgba(255, 255, 255, 0.16)",formControlHeight:34,borderWidth:1,borderColorHover:"rgba(255, 255, 255, 0.3)",formItemMarginBottomMD:20,formItemMarginBottomXS:8,appZoom:1},Ul=Wr(_.ui_kit$lightThemePreset,{token:Bl}),zl=Wr(_.ui_kit$darkThemePreset,{token:$l});function Gl({children:e}){const t=r.useSelector(r.selectEditorThemeColor$1),n=(0,l.useMemo)(()=>matchMedia("(prefers-color-scheme: dark)").matches?r.DARK:r.LIGHT,[]),o=r.useAppConfig(),[i,s]=(0,l.useState)(o.theme||n),c=r.useDispatch(),d=vl();(0,l.useEffect)(()=>{const k=o.theme||n;s(k),yl(k),c(r.setEditorThemeColor$1(k==="dark"?`vs-${k}`:r.LIGHT)),d()},[t,n,o.theme,o.pathEnabled,c,d]);const u=(0,l.useCallback)(k=>{k&&k!=="system"?(hl(k),ii(k)):ii(void 0)},[]);(0,l.useEffect)(()=>{const k=o.theme,w=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_color_scheme);k&&k!==w&&u(k)},[o.theme,u]);const p=(0,l.useCallback)(()=>{const k=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_color_scheme);u(k)},[u]);(0,l.useEffect)(()=>{p()},[p]);const f=o.themes,[g]=(0,l.useState)(1),y=(0,l.useMemo)(()=>{const k=i==="light"?Ul:zl,w=f[i],v=w?Wr(k,w):k;return{...v,token:{...v.token,appZoom:g}}},[i,f,g]),m=r.useModalRootElement(),E=(0,l.useCallback)(()=>m,[m]);return(0,a.jsx)(_.ui_kit$ThemeProvider,{theme:y,getPopupContainer:E,children:(0,a.jsx)(_.ui_kit$StyleProvider,{transformers:Fl,children:(0,a.jsx)(Nl,{children:(0,a.jsx)(_.ui_kit$App,{children:(0,a.jsx)(r.ImagePickerProvider,{children:e})})})})})}var Wl=({onLoad:e,children:t})=>{(0,l.useEffect)(()=>{e&&e()},[e]);const n=r.useAppDispatch();return(0,l.useEffect)(()=>{n(r.authorizationApi.endpoints.getMe.initiate(""))},[n]),t};function si({title:e,content:t,acf:{seen:n,type:o,event:i,data:s},...c}){return{...c,seen:n,type:o,event:i,data:s,title:r.getRendererString(e),content:t}}var Sn="Notifications",Gn=r.createApi({reducerPath:"notificationsApi",tagTypes:[Sn],baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getNotifications:e.query({queryFn(t,n){return r.clientFromApi(n).wp.notification_list({author:[Number(t)]}).then(r.transformListResponseFn(si))},providesTags:t=>t?[...t.map(({id:n})=>({type:Sn,id:n})),{type:Sn,id:"LIST"}]:[{type:Sn,id:"LIST"}]}),notificationShown:e.mutation({queryFn({id:t,datetime:n},o){return r.clientFromApi(o).wp.notification_create2({id:t},{},{type:h.ContentType.Json,extraQuery:{"acf[seen]":n}}).then(r.transformResponseFn(si))},invalidatesTags:[{type:Sn,id:"LIST"}]})})}),{useGetNotificationsQuery:Hl,useNotificationShownMutation:ql}=Gn,Vl=()=>{const e=r.useCookieManager(),t=r.useContainer(),n=r.useRoutePathname();(0,l.useEffect)(()=>{n.endsWith("/new")||e.remove(r.APP_COOKIES.em_new_email)},[n,e,t])},Kl=()=>{const e=r.useCookieManager(),t=r.useRoutePathname();(0,l.useEffect)(()=>{t.endsWith("/new")||e.remove(r.APP_COOKIES.em_new_block)},[t,e])},ai="em_notification_mark_seen_skipped_ids";function li(){try{const e=sessionStorage.getItem(ai),t=e?JSON.parse(e):[];return Array.isArray(t)?t.map(String):[]}catch{return[]}}function Yl(e){try{const t=String(e),n=new Set(li());n.has(t)||(n.add(t),sessionStorage.setItem(ai,JSON.stringify([...n])))}catch{}}var Ql=({children:e=void 0,sider:t=null,modals:n=null,hasEmail:o=!1,hasBlock:i=!1})=>{const{token:s}=(0,_.ui_kit$useToken)(),c=r.useDispatch(),d=r.useSelector(r.selectActiveModal$1),u=r.useCurrentUser();r.useSelector(r.selectIsCodeMode);const p=r.usePushToDataLayer(),[f]=ql(),g=r.useNotification();(0,l.useEffect)(()=>{_l(s)},[s]);const{data:y=[],isSuccess:m}=Hl(u?.id??"",{pollingInterval:3e5,skip:!!d||!u?.id});return(0,l.useEffect)(()=>{const E=y.filter(k=>k.seen===""||k.seen===null);setTimeout(()=>{if(E.length&&m){const k=new Set(li());E.forEach(w=>{if(k.has(String(w.id)))return;w.event==="subscription_payment"&&p({event:"payment",data:w.data}),g[w.type]({title:w.title?.rendered||w.title||"",description:w.content?.rendered||""});const v=new Date().toLocaleString();f({id:w.id,datetime:v}).unwrap().catch(x=>{const P=x&&typeof x=="object"?x:{};(P.data&&typeof P.data=="object"&&P.data!==null&&"code"in P.data?String(P.data.code):void 0)==="em_rest_notification_403"&&Yl(w.id)})})}},5e3)},[m,f,y,g]),Vl(),Kl(),(0,l.useEffect)(()=>{i||c(r.resetBlockSlice()),o||c(r.resetEmailSlice())},[i,o,c]),(0,a.jsx)("div",{className:"main",children:(0,a.jsx)("div",{className:"main__pane main__pane_main",children:(0,a.jsx)("div",{className:"main__pane-content",id:"pane-content-iframe","data-scroll-area":"page",children:(0,a.jsxs)(_.ui_kit$Layout,{className:"main__pane-layout",hasSider:!!t,children:[t,n,e??(0,a.jsx)(r.RouteOutlet,{})]})})})})},Xl={toggle:()=>{},set:()=>{},setDirection:()=>{}};function Vr(){const e=r.useContainer();return(0,l.useMemo)(()=>e?{toggle:()=>r.toggleCodeMode(e),set:t=>r.setCodeMode$1(e,t),setDirection:t=>r.setCodeModeDirection(e,t)}:Xl,[e])}var Jl=`
|
|
98
98
|
<style>
|
|
@@ -852,6 +852,6 @@ ${o}}`,n.appendChild(document.createTextNode(o));const i=t.querySelector('[data-
|
|
|
852
852
|
</div>
|
|
853
853
|
</section>
|
|
854
854
|
</amp-accordion>
|
|
855
|
-
</td></tr></table>`,Pc={image:"element_image","ai-image":"element_ai_image",text:"element_text",header:"element_heading",button:"element_button",spacer:"element_spacer","list-ul":"element_lists","list-ol":"element_lists",divider:"element_divider",social:"element_social",table:"element_table",countdown:"element_timer",video:"element_video","amp-carousel":"element_amp_carousel","amp-accordion":"element_amp_accordion","amp-form":"element_amp_form"};function yi(e){return Pc[e]??null}var vi=e=>Number(e)||void 0,Rc={colors:[],fonts:[],socials:[]},Kr=(e="entity")=>{const t=typeof globalThis<"u"?globalThis.crypto:void 0;if(t?.randomUUID)return t.randomUUID();const n=typeof performance<"u"?performance.now().toString(36).replace(".",""):String(Date.now());return`${e}-${Date.now().toString(36)}-${n}`},jc=()=>Kr("soc"),Oc=/^[a-z][a-z0-9+.-]*:/i,bi=e=>{const t=String(e??"").trim();return t?Oc.test(t)?t:`https://${t}`:""},Lc=e=>{const t=bi(e);if(!t)return!1;try{const n=new URL(t);return n.protocol==="https:"&&!!n.hostname}catch{return!1}},Mc=e=>[...e].filter(t=>t.url.trim()!=="").sort((t,n)=>t.order-n.order),Nc=e=>Mc(e).map(t=>({platform:t.icon_key,href:t.url,label:t.name,...t.icon_url?{iconSrc:t.icon_url}:{}})),Dc=/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,Fc=/^#?([0-9a-f]{6})$/i,Yr=e=>{if(!e)return null;const t=String(e).trim().toLowerCase(),n=Fc.exec(t);if(n)return`#${n[1]}`;const o=Dc.exec(t);if(o){const[,i,s,c]=o;return`#${i}${i}${s}${s}${c}${c}`}return null},Ei=()=>Kr("bc"),Bc=/\.(woff2|woff|ttf|otf)$/i,$c=e=>{const t=Bc.exec(e.trim().toLowerCase());return t?`.${t[1]}`:null},Uc={".woff":"application/x-font-woff",".woff2":"application/font-woff2",".ttf":"font/sfnt",".otf":"font/sfnt"},zc={".woff":["application/x-font-woff","font/woff","application/font-woff"],".woff2":["application/font-woff2","font/woff2"],".ttf":["font/sfnt","application/font-sfnt","application/x-font-ttf","font/ttf","application/x-font-truetype"],".otf":["font/sfnt","application/font-sfnt","application/vnd.ms-opentype","application/x-font-opentype","font/otf","font/opentype"]},Gc=new Set(["","application/octet-stream","binary/octet-stream"]),Wc=e=>{const t=$c(e.name);if(!t)return e;const n=e.type.trim().toLowerCase();return zc[t].includes(n)||!Gc.has(n)?e:new File([e],e.name,{type:Uc[t],lastModified:e.lastModified})},Hc=()=>Kr("fnt"),qc=e=>e.family?.trim()||e.name.trim(),Vc=e=>e.filter(t=>t.source_url?.trim()).map(t=>({family:t.family?.trim()||t.name.trim(),source_url:t.source_url?.trim()??"",weight:t.weight?.trim()||"400",style:t.style??"normal"})),Kc=(e,t={})=>{const n=t.srcOverride?.trim()||e.source_url?.trim();if(!n||!t.srcOverride&&Si(e)||t.srcOverride&&r.isGoogleFontsCssUrl(n))return null;const o=t.familyOverride?.trim()||qc(e),i=e.weight?.trim()||"400",s=e.style??"normal";return`@font-face{font-family:${JSON.stringify(o)};src:url(${JSON.stringify(n)});font-weight:${i};font-style:${s};font-display:swap;}`},Yc=e=>e.source_kind?e.source_kind:r.isGoogleFontsCssUrl(e.source_url)?"google_stylesheet":e.file_name?.trim()?"uploaded":"remote_file",Si=e=>e.source_kind?e.source_kind==="google_stylesheet"||e.source_kind==="remote_stylesheet":r.isGoogleFontsCssUrl(e.source_url),wi="data-em-project-fonts-face",ki="data-em-project-font-link",Qc=e=>{const t=e.filter(n=>Si(n)).map(n=>n.source_url?.trim()??"").filter(Boolean);return[...new Set(t)]},Xc=e=>e.map(t=>Kc(t)).filter(t=>!!t).join(""),Jc=(e,t=document)=>{const n=Xc(e),{head:o}=t;let i=o.querySelector(`style[${wi}]`);if(!n){i?.remove();return}i||(i=t.createElement("style"),i.setAttribute(wi,""),o.appendChild(i)),i.textContent=n},Zc=(e,t=document)=>{const n=new Set(Qc(e)),{head:o}=t;o.querySelectorAll(`link[${ki}]`).forEach(i=>{const s=i.getAttribute("href")??"";n.has(s)?n.delete(s):i.remove()}),n.forEach(i=>{const s=t.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("href",i),s.setAttribute(ki,""),o.appendChild(s)})},ed=(e,t=document)=>{Jc(e,t),Zc(e,t)},td=new Set(["normal","italic","oblique"]),Bv="[emailmaker] projectStyles:",Wt=e=>{},vt=e=>typeof e=="string"?e.trim():"",Ci=e=>!e||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("./")||e.startsWith("../")?!0:e.toLowerCase().startsWith("https://"),nd=e=>r.isGoogleFontsCssUrl(e)?"google_stylesheet":(e.split(/[?#]/)[0]??"").toLowerCase().endsWith(".css")?"remote_stylesheet":"remote_file",Qr=(e,t,n)=>e.length<=t?e:(Wt(`${n} list is capped at ${t} entries, ${e.length-t} dropped`),e.slice(0,t)),rd=(e,t)=>{const n=Yr(e?.hex);if(!n){Wt(`colors[${t}] skipped: "${String(e?.hex)}" is not a hex color`);return}return{id:vt(e.id)||Ei(),name:vt(e.name),hex:n,order:0}},od=(e,t)=>{const n=vt(e?.family),o=vt(e?.source_url);if(!n){Wt(`fonts[${t}] skipped: family is required`);return}if(!o){Wt(`fonts[${t}] skipped: source_url is required`);return}if(!Ci(o)){Wt(`fonts[${t}] skipped: source_url must be https or relative, got "${o}"`);return}const i=vt(e.style);return{id:vt(e.id)||Hc(),name:vt(e.name)||n,family:n,source_url:o,source_kind:nd(o),weight:vt(e.weight)||"400",style:td.has(i)?i:"normal",order:0}},id=(e,t)=>{const n=bi(e?.url);if(!n||!Lc(n)){Wt(`socials[${t}] skipped: url must be https, got "${String(e?.url)}"`);return}const o=vt(e.icon_key),i=vt(e.icon_url);let s;if(i&&Ci(i)?s=i:i&&Wt(`socials[${t}]: icon_url must be https or relative, got "${i}" — icon dropped`),!o&&!s){Wt(`socials[${t}] skipped: icon_key or icon_url is required`);return}return{id:vt(e.id)||jc(),name:vt(e.name),url:n,icon_key:o,...s?{icon_url:s}:{},enabled:!0,order:0}},Xr=e=>e.map((t,n)=>({...t,order:n})),sd=e=>({colors:Xr(Qr(e?.colors??[],32,"colors").map(rd).filter(t=>t!==void 0)),fonts:Xr(Qr(e?.fonts??[],20,"fonts").map(od).filter(t=>t!==void 0)),socials:Xr(Qr(e?.socials??[],20,"socials").map(id).filter(t=>t!==void 0))}),ad={tg:"telegram",yt:"youtube",yd:"yandex_zen",tt:"tiktok",pi:"pinterest",ig:"instagram",fb:"facebook",xa:"x",tw:"twitter"},Ti="vk",ld=new Set(r.EM_SOCIAL_SELECT_ORDER),cd=e=>ld.has(e),Ii=e=>{const t=String(e??"").trim().toLowerCase();return t?cd(t)?t:ad[t]??Ti:Ti},dd=e=>Ii(e),ud=new Set(["normal","italic","oblique"]),pd=new Set(["uploaded","remote_file","google_stylesheet"]),Pt=e=>(e??"").trim(),wn=e=>Pt(e)||void 0,Ai=e=>typeof e=="number"&&e>0?e:void 0,md=e=>ud.has(e)?e:void 0,fd=e=>pd.has(e)?e:void 0,gd=(e,t)=>{const n=Yr(Pt(e.hex));return n?{id:Pt(e.id)||Ei(),name:Pt(e.name),hex:n,order:e.order??t}:null},xi=(e,t=0)=>({id:Pt(e.id),name:Pt(e.name),source_url:wn(e.source_url),source_kind:fd(e.source_kind),file_name:wn(e.file_name),family:wn(e.family),weight:wn(e.weight),style:md(e.style),preview_url:wn(e.preview_url),storage_fallback:e.storage_fallback||void 0,font_size_px:Ai(e.font_size_px),line_height_px:Ai(e.line_height_px),order:e.order??t}),hd=(e,t)=>{const n=Pt(e.url);return n?{id:Pt(e.id),name:Pt(e.name),url:n,icon_key:Ii(Pt(e.icon_key)),enabled:e.enabled??!0,order:e.order??t}:null},rn=e=>[...e].sort((t,n)=>t.order-n.order),Pi=e=>e?{colors:rn((e.colors??[]).map(gd).filter(t=>t!==null)),fonts:rn((e.fonts??[]).map(xi)),socials:rn((e.socials??[]).map(hd).filter(t=>t!==null))}:Rc,_d=e=>e==="remote_stylesheet"?"remote_file":e,yd=e=>{const t={};return e.colors&&(t.colors=rn(e.colors).map(n=>({id:n.id,name:n.name.trim(),hex:Yr(n.hex)||n.hex}))),e.fonts&&(t.fonts=rn(e.fonts).map(n=>({id:n.id,name:n.name.trim(),source_url:n.source_url??"",source_kind:_d(Yc(n)),file_name:n.file_name??"",family:n.family??"",weight:n.weight??"",style:n.style??"",preview_url:n.preview_url??"",storage_fallback:n.storage_fallback??!1,font_size_px:n.font_size_px??0,line_height_px:n.line_height_px??0}))),e.socials&&(t.socials=rn(e.socials).map(n=>({id:n.id,name:n.name.trim(),url:n.url,icon_key:dd(n.icon_key),enabled:n.enabled}))),t},Ri="ProjectBrandStyles",Qt=r.createApi({reducerPath:"projectSettingsStylesApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),tagTypes:[Ri],endpoints:e=>({getProjectStyles:e.query({async queryFn({projectId:t},n){const o=r.v2ResultOf(await r.getClientV2(h.getContainer(n)).projects.stylesList({id:String(t)}));return"error"in o?{error:o.error}:{data:Pi(o.data)}},providesTags:(t,n,{projectId:o})=>[{type:Ri,id:String(o)}]}),updateProjectStyles:e.mutation({async queryFn({projectId:t,patch:n},o){const i=r.v2ResultOf(await r.getClientV2(h.getContainer(o)).projects.stylesPartialUpdate({id:String(t)},yd(n)));return"error"in i?{error:i.error}:{data:Pi(i.data)}},async onQueryStarted({projectId:t,patch:n},{dispatch:o,queryFulfilled:i}){const s=o(Qt.util.updateQueryData("getProjectStyles",{projectId:t},c=>Object.assign(c,n)));try{const{data:c}=await i;o(Qt.util.upsertQueryData("getProjectStyles",{projectId:t},c))}catch{s.undo()}}}),uploadProjectFont:e.mutation({async queryFn({projectId:t,file:n},o){const i=new FormData;i.append("file",Wc(n));const s=r.v2ResultOf(await r.getClientV2(h.getContainer(o)).request({path:`/projects/${String(t)}/styles/fonts`,method:"POST",body:i,secure:!0,type:r.ContentType.FormData,format:"json"}));return"error"in s?{error:s.error}:{data:xi(s.data)}},async onQueryStarted({projectId:t},{dispatch:n,queryFulfilled:o}){try{const{data:i}=await o;n(Qt.util.updateQueryData("getProjectStyles",{projectId:t},s=>{s.fonts=s.fonts.some(c=>c.id===i.id)?s.fonts.map(c=>c.id===i.id?i:c):[...s.fonts,i],s.fonts.sort((c,d)=>c.order-d.order)}))}catch{}}})})}),{useGetProjectStylesQuery:vd,useUpdateProjectStylesMutation:$v,useUploadProjectFontMutation:Uv}=Qt,ji=e=>{const t=r.useIntegratorConfigValue("projectStyles"),{data:n}=vd({projectId:e},{skip:!0});return(0,l.useMemo)(()=>sd(t),[t])},bd=2.5,Ed=({atom:e,onSelect:t,onDragStart:n,isDroppedAtom:o})=>{const i=(0,l.useCallback)(d=>t(d,e),[t,e]),s=(0,l.useCallback)(d=>n(d,e,o),[n,e,o]),c=(0,l.useCallback)(d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),t(d,e))},[t,e]);return(0,a.jsxs)("button",{type:"button",className:"ant-card-hoverable atoms__item "+e.className+(e.isLockedByPlan?" atoms__item_locked":""),draggable:!0,onClick:i,onKeyDown:c,onDragStart:s,"data-test-name":e.name,children:[(0,a.jsxs)("span",{className:"atom-image",children:[e.icon,e.isLockedByPlan&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:12,strokeWidth:bd,className:"atom-image__lock"})]}),(0,a.jsx)("span",{className:"atom-title",children:e.title})]})},Oi=()=>{const e=r.useI18n(),{__:t}=e,n=r.useAppConfig(),o=r.useProjectData(),i=r.useCurrentUserLocale()||"en_US",s=xt.useSetHtmlAtomInIframeHandler(),c=xt.useDragStartAtomToIframeHandler(),[d,u]=(0,l.useState)(!1),[p,f]=(0,l.useState)(0),g=r.useMessageService(),y=r.useServices(h.ATOMS_HANDLERS_ID),m=r.useEventEmitter(h.HANDLE_ATOM_INSERT_ID),E=r.usePlanFeatureLocks(),k=vi(o?.id),w=ji(k),v=w?Nc(w.socials):[],x=v.length>0?gi(v):Sc;let P=[];if(n.elementImageEnabled&&P.push({title:t("Image"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementImage",component:_.icons$ElementImage,size:24,strokeWidth:n.iconStrokeWidth}),html:dc,className:"",name:"image"}),n.elementAIimageEnabled&&P.push({title:t("AI image"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementImageAI",component:_.icons$ElementImageAI,size:24,strokeWidth:n.iconStrokeWidth}),html:uc,className:"ai",name:"ai-image"}),n.elementTextEnabled&&P.push({title:t("Text"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementText",component:_.icons$ElementText,size:24,strokeWidth:n.iconStrokeWidth}),html:pc(e),className:"",name:"text"}),n.elementHeaderEnabled&&P.push({title:t("Header"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementTitle",component:_.icons$ElementTitle,size:24,strokeWidth:n.iconStrokeWidth}),html:mc(e),className:"",name:"header"}),n.elementButtonEnabled&&P.push({title:t("Button"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementButton",component:_.icons$ElementButton,size:24,strokeWidth:n.iconStrokeWidth}),html:fc(e),className:"",name:"button"}),n.elementSpacerEnabled&&P.push({title:t("Spacer"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementSpacer",component:_.icons$ElementSpacer,size:24,strokeWidth:n.iconStrokeWidth}),html:yc,className:"",name:"spacer"}),n.elementListULEnabled&&P.push({title:t("List UL"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementListUL",component:_.icons$ElementListUL,size:24,strokeWidth:n.iconStrokeWidth}),html:gc(e),className:"",name:"list-ul"}),n.elementListOLEnabled&&P.push({title:t("List OL"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementListOL",component:_.icons$ElementListOL,size:24,strokeWidth:n.iconStrokeWidth}),html:hc(e),className:"",name:"list-ol"}),n.elementDividerEnabled&&P.push({title:t("Divider"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementDivider",component:_.icons$ElementDivider,size:24,strokeWidth:n.iconStrokeWidth}),html:_c,className:"",name:"divider"}),n.elementSocialEnabled&&P.push({title:t("Social media"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementSocial",component:_.icons$ElementSocial,size:24,strokeWidth:n.iconStrokeWidth}),html:x,className:"",name:"social"}),n.elementTableEnabled&&P.push({title:t("Table"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementTable",component:_.icons$ElementTable,size:24,strokeWidth:n.iconStrokeWidth}),html:wc(e),className:"",name:"table"}),n.elementCountdownEnabled&&P.push({title:t("Countdown"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementCountdown",component:_.icons$ElementCountdown,size:24,strokeWidth:n.iconStrokeWidth}),html:Tc(i),className:"",name:"countdown"}),n.elementVideoEnabled&&P.push({title:t("Video"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementVideo",component:_.icons$ElementVideo,size:24,strokeWidth:n.iconStrokeWidth}),html:Ic,className:"",name:"video"}),n.elementCarouselEnabled&&P.push({title:t("Carousel"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementCarousel",component:_.icons$ElementCarousel,size:24,strokeWidth:n.iconStrokeWidth}),html:Ac(e),className:"amp",name:"amp-carousel"}),n.elementAccordionEnabled&&P.push({title:t("Accordion"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementAccordion",component:_.icons$ElementAccordion,size:24,strokeWidth:n.iconStrokeWidth}),html:xc(e),className:"amp",name:"amp-accordion"}),n.elementFormEnabled&&P.push({title:t("Form"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementForm",component:_.icons$ElementForm,size:24,strokeWidth:n.iconStrokeWidth}),html:null,className:"amp",name:"amp-form"}),P=P.map(A=>({...A,fallbackTooltip:t("Coming soon"),planFeature:yi(A.name),isLockedByPlan:E(yi(A.name))})),y){const A={value:P};for(const O of y)O.execute(A);P=A.value}(0,l.useEffect)(()=>{const{dispose:A}=g.addListener(r.EVENT_TYPES.APPLICATION_ATOM_INSERTED,O=>{const z=P.find(B=>B.name===O);z&&m.fire(z)});return()=>A()},[g,P,m]);const K=(0,l.useCallback)(A=>{u(!0),f(A.planFeature?r.FEATURE_UPSELL_SLIDE[A.planFeature]:1)},[]),J=(0,l.useCallback)(A=>A.isLockedByPlan?(setTimeout(()=>K(A),1e3),!1):!0,[K]),N=(0,l.useCallback)((A,O)=>{if(O.isLockedByPlan){K(O);return}s(A,O)},[K,s]),L=(0,l.useCallback)((A,O,z)=>{c(A,O,z)},[c]);return(0,a.jsxs)("div",{className:"atoms",children:[(0,a.jsx)("div",{className:"atoms__list",children:(0,a.jsx)(_.ui_kit$Space,{wrap:!0,style:{justifyContent:"space-between",rowGap:10},children:P&&P.map((A,O)=>A.html?(0,a.jsx)(Ed,{atom:A,onSelect:N,onDragStart:L,isDroppedAtom:J},A.title+O.toString()):(0,a.jsx)(_.ui_kit$Tooltip,{title:A.fallbackTooltip||t("Coming soon"),placement:"top",children:(0,a.jsxs)("div",{className:"atoms__item atoms__item_inactive "+A.className,"data-test-name":A.name,children:[(0,a.jsx)("span",{className:"atom-image",children:A.icon}),(0,a.jsx)("span",{className:"atom-title",children:A.title})]},A.title+O.toString())},A.title+O.toString()))})}),(0,a.jsx)(r.PlanUpgradePrompt,{open:d,onCancel:()=>u(!1),initialSlide:p})]})};Oi.propTypes={};var Sd={full:{flexGrow:1},768:{width:171},425:{width:25},375:{width:28},320:{width:320}},Li={right:-12,top:4,zIndex:999,padding:0,position:"absolute"},wd=[{kind:"full",width:1200},{kind:"768",width:768},{kind:"425",width:425},{kind:"375",width:375},{kind:"320",width:320,showLabel:!0},{kind:"375",width:375},{kind:"425",width:425,control:"mobile"},{kind:"768",width:768,control:"desktop"},{kind:"full",width:1200}];function kd({kind:e,width:t,label:n,onSelect:o,onHover:i,children:s}){const c=(0,l.useCallback)(()=>i(e,n),[i,e,n]),d=(0,l.useCallback)(()=>i(null,""),[i]),u=(0,l.useCallback)(()=>o(t),[o,t]),p=(0,l.useCallback)(f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o(t))},[o,t]);return(0,a.jsx)("div",{className:`device-width__${e}`,style:Sd[e],role:"button",tabIndex:0,"aria-label":n,onMouseEnter:c,onMouseLeave:d,onClick:u,onKeyDown:p,children:s})}function Cd({onSelectWidth:e,themeToggle:t}){const{__:n}=r.useI18n(),[o,i]=(0,l.useState)(""),[s,c]=(0,l.useState)(""),d={full:n("Desktop"),768:n("Small desktop – 768px"),425:n("Mobile L – 425px"),375:n("Mobile M – 375px"),320:n("Mobile S – 320px")},u=(0,l.useCallback)((p,f)=>{i(p?`device-width__${p}-hovered`:""),c(f)},[]);return(0,a.jsx)("div",{className:`email-pane__sizes ${o}`,children:(0,a.jsxs)("div",{className:"email-pane__width-selectors-wrapper",children:[(0,a.jsx)("div",{className:"device-width__theme",children:t}),wd.map((p,f)=>(0,a.jsxs)(kd,{kind:p.kind,width:p.width,label:d[p.kind],onSelect:e,onHover:u,children:[p.showLabel?s:null,p.control==="mobile"&&(0,a.jsx)(_.ui_kit$Tooltip,{title:n("Mobile view"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:"default",icon:(0,a.jsx)(r.EmIcons,{icon:"MobileOutlined",component:_.icons$MobileOutlined,size:16,strokeWidth:2}),size:"small",shape:"circle",style:Li})}),p.control==="desktop"&&(0,a.jsx)(_.ui_kit$Tooltip,{title:n("Desktop view"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:"default",icon:(0,a.jsx)(r.EmIcons,{icon:"DesktopOutlined",component:_.icons$DesktopOutlined,size:16,strokeWidth:2}),size:"small",shape:"circle",style:Li})})]},`${p.kind}-${f}`)),(0,a.jsx)("div",{className:"device-width__theme-placeholder"})]})})}var $e=zt.__toESM(r.require_prop_types()),Mi=h.createIdentifier$1("canvas.resizerBinder"),Td=h.createIdentifier$1("canvas.service"),zv={created:r.PHASES.canvasCreated,loaded:r.PHASES.canvasLoaded};function Id(e){return e.getInstance(Td)}function Ni(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}))}}var Ad={canUndo:!1,canRedo:!1},xd={undo:()=>{},redo:()=>{},clear:()=>{},canUndo:()=>!1,canRedo:()=>!1,createSnapshot:()=>{},restoreSnapshot:()=>{},getPast:()=>[],getFuture:()=>[]};function Jr(e){const t=r.useDocumentSessionContext(),{history:n}=e??t;return(0,l.useMemo)(()=>n?Ni(n):xd,[n])}function Pd(){const{history:e}=r.useDocumentSessionContext(),t=(0,l.useCallback)(i=>e?e.subscribe(i):()=>{},[e]),n=(0,l.useRef)(null),o=(0,l.useCallback)(()=>{if(!e)return Ad;const i={canUndo:e.canUndo(),canRedo:e.canRedo()},s=n.current;return s&&s.canUndo===i.canUndo&&s.canRedo===i.canRedo?s:(n.current=i,i)},[e]);return(0,l.useSyncExternalStore)(t,o)}var Di=2e3,Rd=10,jd="iframe_errors",Od=5;function Ld(e){const{__:t}=r.useI18n(),n=r.useMessageService(),o=Jr(),{error:i}=r.useNotification(),{document:s}=r.useDocumentSessionContext(),c=(0,l.useCallback)(()=>s?.getContent()??"",[s]),d=(0,l.useRef)(0),u=(0,l.useRef)(void 0),p=(0,l.useRef)(!1),f=r.useCurrentUser(),g=(0,l.useCallback)(m=>new Promise((E,k)=>{const w=n.addListener(r.EVENT_TYPES.SANDBOX_READY,()=>{w.dispose(),E()});m&&setTimeout(()=>{w.dispose(),k("timeout")})}),[n]),y=(0,l.useCallback)(m=>{g(Di).catch(E=>{}).finally(()=>{Promise.resolve().then(()=>{if(!p.current){if(++d.current){if(u.current){if(d.current<Od){o.restoreSnapshot(u.current);for(let E=0;E<d.current;E++)o.undo()}}else u.current=o.createSnapshot();n.send(r.EVENT_TYPES.RELOAD)}setTimeout(()=>{if(--d.current===0){u.current=null;const E=new Error(m.message);m.stack&&(E.stack=m.stack);const k=r.reportError(E,{origin:"iframe"}),w={past:o.getPast(Rd),future:o.getFuture(),errorResolved:!p.current,text:c(),message:m.message,stack:m.stack,userId:f?.id,entityId:e?.id,entityType:document.location.pathname.indexOf("emails")>0?"email":"block",sentryEventId:k};i({id:"IFRAME_ERROR",data:w,title:t("Something went wrong")}),h.RACS.post(jd,w).catch(v=>{}),p.current=!1}},Di)}})})},[o,c,i,f?.id,e?.id,t,g,n]);r.useListenPostMessage(r.EVENT_TYPES.APPLICATION_DOMPARSER_ERROR,y)}function Md(e,t){const n=JSON.stringify(t??{});Nd(e?.get().attributes.common_styles,n)||r.writeEmailAttributes(e,{common_styles:n})}function Nd(e,t){if(e===t)return!0;try{return h.deepEqual(JSON.parse(e||"{}"),JSON.parse(t||"{}"))}catch{return!1}}var Wn=Symbol("isIframeEvent");function Dd({children:e}){const[t,n]=(0,l.useState)(),[o,i]=(0,l.useState)(),[s,c]=(0,l.useState)(!1),d=r.useMessageService();return(0,l.useEffect)(()=>{if(t){const u=d.addListener(r.EVENT_TYPES.APPLICATION_IFRAME_DRAG_EVENT,p=>{if(p.type!=="drageleave"&&p.type!=="dragenter"){const f=t.getBoundingClientRect(),g=p.clientX+f.x+window.scrollX,y=p.clientY+f.y+window.scrollY,m=document.elementFromPoint(g,y);if(m){const E=new DataTransfer,k=new DragEvent(p.type,{clientX:g,clientY:y,cancelable:!0,bubbles:!0,dataTransfer:E});k[Wn]=!0,m.dispatchEvent(k)}}});return()=>u.dispose()}},[d,t]),(0,l.useEffect)(()=>{const u=f=>{f[Wn]||c(!0)},p=f=>{f[Wn]||c(!1)};return window.addEventListener("dragstart",u),window.addEventListener("dragend",p),()=>{window.removeEventListener("dragstart",u),window.removeEventListener("dragend",p)}},[o]),(0,l.useEffect)(()=>{const u=p=>{if(!p[Wn]){const f=o.getBoundingClientRect();d.send(r.EVENT_TYPES.SANDBOX_DRAG_EVENT,{value:p.dataTransfer?.getData("Text")||"",type:p.type,clientX:p.pageX-f.x-window.scrollX,clientY:p.pageY-f.y-window.scrollY})}};if(o)return o.addEventListener("dragenter",u),o.addEventListener("dragover",u),o.addEventListener("dragleave",u),o.addEventListener("drop",u),o.addEventListener("dragend",u),()=>{o.removeEventListener("dragenter",u),o.removeEventListener("dragover",u),o.removeEventListener("dragleave",u),o.removeEventListener("drop",u),o.removeEventListener("dragend",u)}},[o,d]),(0,a.jsxs)("div",{ref:n,children:[s&&(0,a.jsx)("div",{ref:i,className:"iframe-provider"}),e]})}var Fd=["colorBgBase","colorBgElevated","colorError","colorInfo","colorInfoBg","colorInfoBgHover","colorInfoBorder","colorInfoBorderHover","colorLink","colorPrimary","colorPrimaryBg","colorPrimaryBgHover","colorPrimaryBorder","colorPrimaryBorderHover"];function Bd(e){const t={};for(const n of Fd){const o=e[n];typeof o=="string"&&(t[n]=o)}return t}function Zr(e,t){const n=r.useMessageService(),o=t?.async??!1;(0,l.useEffect)(()=>{const i=o?n.addListenerAsync(r.EVENT_TYPES.RELOAD,e):n.addListener(r.EVENT_TYPES.RELOAD,e);return()=>i.dispose()},[n,e,o]),(0,l.useEffect)(()=>{},[e])}function $d(){const e=r.useMessageService(),{token:t}=(0,_.ui_kit$useToken)(),[n,o]=(0,l.useState)();(0,l.useEffect)(()=>{if(!h.deepEqual(n,t)){const s=e.onInit(()=>{e.send(r.EVENT_TYPES.SANDBOX_SET_THEME_VARIABLES,Bd(t)),o(t)});return()=>s.dispose()}},[t,n,o,e]);const i=(0,l.useCallback)(()=>{o(void 0)},[]);Zr(i)}var Ud={minHeight:600},zd="#pane-content-wrapper, .email-pane__col_preview, .preview-mode__pane-content";function Fi(e){e?.current?.resize?.()}var Bi=(0,l.forwardRef)(({className:e=null,email:t=null,handlerSendPosition:n=()=>{},surface:o,clip:i=null},s)=>{const c=r.useAppConfig(),d=r.useContainer(),u=o??(t?.hasOwnProperty("type")?"block":"email"),p=(0,l.useMemo)(()=>Id(d),[d]),f=(0,l.useMemo)(()=>p?.current(u),[p,u]),g=(0,l.useRef)(null),y=(0,l.useCallback)(()=>{r.mark(r.PHASES.canvasLoaded),Fi(s),n()},[n,s]);(0,l.useImperativeHandle)(s,()=>({getIframeElement:()=>p?.current(u)?.element,resize:()=>p?.current(u)?.resize()}),[p,u]),(0,l.useEffect)(()=>{if(!p)return;const w=g.current,v=i??w?.closest(zd)??null;return p.alignSurface(u,w,v),()=>p.alignSurface(u,null)},[p,u,i,c.sidePanelFloating]);const m=(0,l.useRef)(y);m.current=y,(0,l.useEffect)(()=>{if(!f)return;let w=!1;const v=()=>{w||m.current({target:f.element})};return f.ready().then(v).catch(()=>{window.requestAnimationFrame(()=>{w||f.ready().then(v).catch(()=>{})})}),()=>{w=!0}},[f]),$d(),Ld(t);const{document:E}=r.useDocumentSessionContext();(0,l.useEffect)(()=>{const w=r.subscribeToContent(E,()=>{Fi(s)});return()=>w.dispose()},[E,s]);const k=(0,l.useCallback)(w=>{const{operation:v,settings:x}=w.data;v===r.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE&&Md(E,x?.commonStyles)},[E]);return r.useListenPostMessage(k),(0,a.jsx)(Dd,{children:(0,a.jsx)("div",{ref:g,className:(0,rt.default)("email-preview",e),id:"email_iframe_slot",style:Ud})})});Bi.propTypes={className:$e.default.string,surface:$e.default.oneOf(["email","block","preview"]),email:$e.default.shape({html:$e.default.string}),handlerSendPosition:$e.default.func,clip:$e.default.object};var eo=new Map,Gd=new Map;function Wd(e,t){e.set(t,(e.get(t)??0)+1)}function Hd(e,t){const n=e.get(t)??0;n<=1?e.delete(t):e.set(t,n-1)}function $i(e,t){return(e.get(t)??0)>0}function qd(e){return $i(eo,e)||$i(Gd,e)}function Vd(e){Wd(eo,e);let t=!1;return{dispose(){t||(t=!0,Kd(e))}}}function Kd(e){Hd(eo,e)}function Yd(e,t){return Xd([...e.changes].sort((n,o)=>n.rangeOffset-o.rangeOffset).map(n=>({start:n.rangeOffset,end:n.rangeOffset+n.rangeLength,text:n.text})),t)}function Qd(e,t){return e.map(n=>{const o=t.getPositionAt(n.oldPosition),i=t.getPositionAt(n.oldEnd);return{text:n.newText,range:{startLineNumber:o.lineNumber,startColumn:o.column,endLineNumber:i.lineNumber,endColumn:i.column}}})}function Xd(e,t){let n=0;return e.map(({start:o,end:i,text:s})=>{const c=new r.TextChange(o,t.slice(o,i),o+n,s);return n+=s.length-(i-o),c})}var Ui=new WeakMap;function Jd(e){const t=Ui.get(e);if(t)return t;const n=Ml(e);return Ui.set(e,n),n}var zi="monaco";function Zd(e,t){(0,l.useEffect)(()=>{if(!e||!t)return;const n=Jd(e);let o=!1;const i=d=>{o=!0;const u=Vd(t);try{d()}finally{u.dispose(),o=!1}},s=n.attach({id:zi,apply(d){return t.getValue()!==d&&i(()=>t.setValue(d)),Promise.resolve()},applyChanges(d){return i(()=>t.applyEdits(Qd(d,t))),Promise.resolve()}}),c=t.onDidChangeContent(d=>{if(o)return;const u=qd(t)?"remote":"user";n.mutateFrom(zi,{changes:Yd(d,e.getContent())},{source:u})});return()=>{s.detach(),c.dispose()}},[e,t])}function eu(e,t){const[n,o]=(0,l.useState)(void 0),i=(0,l.useRef)(!1),{error:s}=r.useNotification(),{__:c}=r.useI18n(),d=(0,l.useRef)(t);d.current=t;const u=(0,l.useRef)({error:s,__:c});u.current={error:s,__:c},(0,l.useEffect)(()=>{if(!e||n||i.current)return;i.current=!0;let f=!1;return d.current().then(g=>{if(f){g.dispose();return}o(g)}).catch(()=>{const{error:g,__:y}=u.current;g({id:"CODE_EDITOR_LOAD_FAILED",title:y("Failed to load the code editor")})}).finally(()=>{i.current=!1}),()=>{f=!0}},[e,n]);const p=(0,l.useRef)(void 0);return p.current=n,(0,l.useEffect)(()=>()=>{p.current?.dispose()},[]),n}var Hn;function to(){return Hn===void 0&&(Hn=(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/92e10a15.js")),void 0,{}.url).catch(e=>{throw Hn=void 0,e})),Hn}function tu(){return to().then(e=>e.ensureMonaco())}var nu=r.lazyRoute(()=>to().then(e=>({default:e.MonacoEditor}))),ru=()=>to().then(e=>e.loadEditorModel()),ou={height:"100%"};function iu(e){const t=eu(!0,ru),{document:n}=r.useDocumentSessionContext();return(0,l.useEffect)(()=>{},[]),(0,l.useEffect)(()=>{},[t]),Zd(n,t),(0,a.jsx)(r.EditorModelContext.Provider,{value:t,children:(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(_.ui_kit$Flex,{justify:"center",align:"center",style:ou,children:(0,a.jsx)(_.ui_kit$Spin,{size:"large"})}),children:(0,a.jsx)(nu,{...e})})})}var su=({elementPath:e})=>{const{_x:t}=r.useI18n(),n=r.useDispatch(),o=r.useMessageService(),i=r.useAppConfig(),{blockId:s}=r.useRouteParams(),c=r.useEditorProjectId(),d=r.useRouteEmailId(),u=r.useProjectData(),p=r.usePushToDataLayer(),f=(0,l.useCallback)(x=>{o.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_SET,index:x})},[o]),g=(0,l.useCallback)(x=>{let P="element";x?.target?.closest("svg")||x?.target?.closest(".anticon")||x?.target?.closest('[class*="icon"]')?P="icon":x?.target?.textContent&&!x?.target?.closest("svg")&&!x?.target?.closest(".anticon")&&(P="text"),n(r.setActiveSettingsTab(r.STYLES)),o.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),o.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),p({event:"click",action:"click_breadcrumb_email",email_id:d||s,project_id:u?.id||c,click_target:P})},[o,n,p,d,s,c,u]),y={title:(0,a.jsxs)("span",{onClick:g,children:[(0,a.jsx)(r.EmIcons,{icon:"Email",component:_.icons$Email,size:16,strokeWidth:i.iconStrokeWidth})," ",t("Email","letter")]})},[m,E]=(0,l.useState)([y]),k=(0,l.useCallback)(x=>{o.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_HOVER_SET,index:x})},[o]),w=x=>{if(x.includes("em-element-path-item-text"))return(0,a.jsx)(r.EmIcons,{icon:"ElementText",component:_.icons$ElementText,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-image"))return(0,a.jsx)(r.EmIcons,{icon:"ElementImage",component:_.icons$ElementImage,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-link"))return(0,a.jsx)(r.EmIcons,{icon:"LinkOutlined",component:_.icons$LinkOutlined,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-atom"))return(0,a.jsx)(r.EmIcons,{icon:"Atom",component:_.icons$Atom,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-column"))return(0,a.jsx)(r.EmIcons,{icon:"Column",component:_.icons$Column,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-block"))return(0,a.jsx)(r.EmIcons,{icon:"Block",component:_.icons$Block,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-group"))return(0,a.jsx)(r.EmIcons,{icon:"Group",component:_.icons$Group,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-button"))return(0,a.jsx)(r.EmIcons,{icon:"ElementButton",component:_.icons$ElementButton,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-table"))return(0,a.jsx)(r.EmIcons,{icon:"ElementTable",component:_.icons$ElementTable,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-amp"))return(0,a.jsx)(r.EmIcons,{icon:"AMP",component:_.icons$AMP,size:16,strokeWidth:i.iconStrokeWidth})},v=(0,l.useCallback)((x,P)=>{const K=J=>{let N="element";J.target.closest("svg")||J.target.closest(".anticon")||J.target.closest('[class*="icon"]')?N="icon":J.target.textContent&&!J.target.closest("svg")&&!J.target.closest(".anticon")&&(N="text");const L=e?.[P],A=L?.className?.replace("em-element-path-item-","")||"unknown";p({event:"click",action:"click_breadcrumb_element",email_id:d||s,project_id:u?.id||c,element_type:A,element_index:P,element_title:L?.title||"",click_target:N}),f(P)};return(0,a.jsxs)("span",{className:x.className,onClick:K,onMouseOver:()=>{k(P)},children:[w(x.className)," ",x.title]})},[f,k,e,p,d,s,c,u]);return(0,l.useEffect)(()=>{if(e){const x=e.map((P,K)=>({title:v(P,K)}));E([{title:(0,a.jsxs)("span",{onClick:g,children:[(0,a.jsx)(r.EmIcons,{icon:"Email",component:_.icons$Email,size:16,strokeWidth:i.iconStrokeWidth})," ",t("Email","letter")]})},...x])}},[e,v,g,t]),(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(_.ui_kit$Breadcrumb,{items:m,type:"separator",separator:""})})};function au(){const{document:e}=r.useDocumentSessionContext(),t=(0,l.useCallback)(o=>e?e.subscribe(o):()=>{},[e]),n=(0,l.useCallback)(()=>e?.getContent()??"",[e]);return(0,l.useSyncExternalStore)(t,n)}var lu=({fallbackHtml:e})=>{const{__:t}=r.useI18n(),n=au(),o=(0,l.useMemo)(()=>r.getCodeSize(n||e||""),[e,n]),i=r.formatCodeSize(o),s=r.isCodeSizeExceeded(o);return(0,a.jsx)(_.ui_kit$Tooltip,{placement:"left",title:t(s?"The code size exceeds the recommended value 90kB":"Code size"),children:(0,a.jsx)("span",{className:(0,rt.default)("email-pane__code-size",{"email-pane__code-size_exceeded":s}),children:i})})};function Gi(e){const{limits:t,isLoaded:n}=r.useProjectPlanLimits();return r.useProjectData(),(0,l.useMemo)(()=>({isLocked:!1,state:{state:"allowed"},isPlanDataReady:n,exceeded:null}),[!1,e,t,n])}var cu=({open:e,onClose:t})=>{const{__:n}=r.useI18n();return(0,a.jsxs)(_.ui_kit$Modal,{open:e,centered:!0,closable:!1,mask:{closable:!1},footer:null,width:520,className:"browser-extension-warning-modal",title:n("Browser extension detected"),onCancel:t,children:[(0,a.jsx)("p",{children:n("A browser extension (for example, Urban VPN Proxy or similar ad blockers/VPN tools) is injecting code into the email preview. This can corrupt your template when saving.")}),(0,a.jsx)("p",{children:n("We removed the injected code automatically. To avoid this issue, disable the extension for this site or use the editor in an incognito window without extensions.")}),(0,a.jsx)("div",{className:"browser-extension-warning-modal__footer",children:(0,a.jsxs)(_.ui_kit$Button,{type:"primary",onClick:t,children:[n("Got it")," "]})})]})},du={closable:!1},uu=({open:e,onClose:t})=>{const{__:n}=r.useI18n();return(0,a.jsxs)(_.ui_kit$Modal,{open:e,centered:!0,closable:!1,mask:du,footer:null,width:520,className:"browser-translate-warning-modal",title:n("Browser translation detected"),children:[(0,a.jsx)("p",{children:n("Browser page translation (for example, Google Translate) is active. It can break the editor and cause errors when saving.")}),(0,a.jsx)("p",{children:n("To avoid this issue, disable translation for this site in your browser settings or turn off auto-translate.")}),(0,a.jsx)("div",{className:"browser-translate-warning-modal__footer",children:(0,a.jsx)(_.ui_kit$Button,{type:"primary",onClick:t,children:n("Got it")})})]})},pu=h.createIdentifier$1("prewarm.editorVisible");function mu(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function fu(e={}){const t=e.paint??mu;let n=!1,o=!1,i=!1,s=!1,c=!1;const d=[],u=()=>{c||s||!n||!o||!i||(s=!0,t(()=>{c=!0,r.mark(r.PHASES.editorVisible);for(const p of d.splice(0))p()}))};return{noteShellVisible(){n=!0,u()},notePagePainted(){o=!0,u()},noteContentShown(){i=!0,u()},whenVisible(p){if(c){p();return}d.push(p)},contentShown:()=>i}}function Ht(e){return e.getOrCreateInstance(pu,()=>fu())}function kn(e){const t=(0,l.useRef)(!1);return e&&(t.current=!0),t.current}var Wi=4e3;function Xt(e){const t=window.requestIdleCallback;if(typeof t=="function"){t(e,{timeout:Wi});return}window.setTimeout(e,Wi)}var qn,no;function ro(){return qn===void 0&&(qn=(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/c6d342f2.js")).then(e=>e.panels_exports).then(e=>(no=e,e),e=>{throw qn=void 0,e}),void 0,{}.url)),qn}function gu(e){(0,l.useEffect)(()=>{Ht(e).whenVisible(()=>{Xt(()=>{ro().catch(()=>{})})})},[e])}function ut(e){const t=r.lazyRoute(()=>ro().then(o=>({default:o[e]})),"panels");function n(o){const[i]=(0,l.useState)(()=>no?no[e]:t);return(0,l.createElement)(i,o)}return n.displayName=`PanelDoor(${String(e)})`,n}var Hi=ut("EmailProperties"),hu=ut("SelectedElementPanel"),_u=ut("EmailSettings"),yu=ut("EmailStyles"),vu=ut("DiscussAi"),bu=ut("Optimise"),Eu=ut("FileManagerDataLayer"),Su=ut("BlocksSearch"),wu=ut("Discuss"),ku=ut("HistoryPanel"),Cu=ut("AddNewBlockModal"),Tu=ut("AddAllBlocksModal"),Iu=ut("SendTestEmailModal"),Au=ut("SaveBlockBtn"),oo=ut("LimitUpgradeModal"),xu={height:"100%"},Pu=()=>{const e=r.useContainer(),t=r.isImageCenterModal(r.useSelector(r.selectActiveModal$1)),[n,o]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{e&&Ht(e).whenVisible(()=>o(!0))},[e]),kn(n||t)?(0,a.jsx)(l.Suspense,{fallback:t?(0,a.jsx)(_.ui_kit$PageLoader,{style:xu}):null,children:(0,a.jsx)(Eu,{})}):null},Vn;function Ru(){return Vn===void 0&&(Vn=(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/b4e5fcbd.js")),void 0,{}.url).catch(e=>{throw Vn=void 0,e})),Vn}function Cn(e){return r.lazyRoute(()=>Ru().then(t=>({default:t[e]})),"form-panels")}var Gv=Cn("FormEditorCalendarPanel"),Wv=Cn("FormEditorCheckboxPanel"),Hv=Cn("FormEditorDropdownListPanel"),qv=Cn("FormEditorInputPanel"),Vv=Cn("FormEditorRadioPanel");function ju(){try{const e=new URLSearchParams(window.location.search).get("deferChrome");return e===null?void 0:e!=="0"&&e!=="false"}catch{return}}function Ou(e,t){const n=ju()??r.readLocalToggle(r.LOCAL_STORAGE_ITEMS.em_defer_chrome);if(n!==void 0)return n;const o=t?.deferEditorChrome;return typeof o=="boolean"?o:o&&typeof o=="object"?o[e]??!0:{}.REACT_APP_DEFER_EDITOR_CHROME_DEFAULT!=="false"}function qi(e){const t=r.useAppConfig(),[n,o]=(0,l.useState)(()=>!Ou(e,t));return(0,l.useEffect)(()=>{if(n)return;let i=0;const s=window.requestAnimationFrame(()=>{i=window.requestAnimationFrame(()=>(0,l.startTransition)(()=>o(!0)))});return()=>{window.cancelAnimationFrame(s),window.cancelAnimationFrame(i)}},[n]),n}var Vi=r.createState({blocksTotal:null,blocksTotalPages:null,parentEmailBlocksTotal:null,parentEmailBlocksTotalPages:null,templateBlocks:[],templateBlocksTotal:null,templateBlocksTotalPages:null,elementsView:r.CARDS,elementsList:[],customFolders:{},blocksTrashTotal:0,elementsTrashList:[]}),Kn="blocksPageSlice",io=r.createSlice({name:Kn,initialState:Vi,reducers:{resetPagesAndTotal:()=>Vi,resetElementsList:e=>{e.elementsList=[]},toggleElementsView:(e,t)=>{e.elementsView=t.payload},removeBlockFromList:(e,{payload:t})=>{const n=e.customFolders;t.folder!=="all"&&n[t.folder]?.list&&(n[t.folder]={...n[t.folder],list:n[t.folder].list.filter(o=>o.id!==t.emailId),total:n[t.folder].total-1},e.customFolders=n)}},extraReducers:e=>{e.addMatcher(r.blocksApi.endpoints.getBlocks.matchFulfilled,(t,{meta:n,payload:o})=>{const i=n.baseQueryMeta?.response.headers.get("X-WP-Total")||o?.length,s=n.arg.originalArgs?.status==="trash",c=!!n.arg.originalArgs?.name?.length,d=n.arg.originalArgs?.page,u=n.arg.originalArgs?.folderTag||n.arg.originalArgs?.tags?.[0];s?(c||(t.blocksTrashTotal=i),t.elementsTrashList=o):u?t.customFolders={...t.customFolders,[u]:{list:o,page:d,total:i}}:(t.blocksTotal=i,t.elementsList=o)}),e.addMatcher(r.blocksApi.endpoints.getParentEmailBlocks.matchFulfilled,(t,{meta:n,payload:o})=>{const i=n.baseQueryMeta?.response.headers.get("X-WP-Total")||o?.length||null,s=n.baseQueryMeta?.response.headers.get("X-WP-TotalPages");t.parentEmailBlocksTotal=i,t.parentEmailBlocksTotalPages=s}),e.addMatcher(r.blocksApi.endpoints.getTemplateBlocks.matchFulfilled,(t,{meta:n,payload:o})=>{const i=n.baseQueryMeta?.response.headers.get("X-WP-Total")||o?.length||null,s=n.baseQueryMeta?.response.headers.get("X-WP-TotalPages");t.templateBlocks=o,t.templateBlocksTotal=i,t.templateBlocksTotalPages=s}),e.addMatcher(r.blocksApi.endpoints.editBlock.matchFulfilled,(t,{payload:n})=>{t.elementsList.map(o=>o.id?.toString()===n.id?.toString()?Object.assign(o,{lock:n.lock,title:n.title,blocktags:n.blocktags}):o)})}}),{resetPagesAndTotal:Kv,resetElementsList:Yv,toggleElementsView:Qv,removeBlockFromList:Xv}=io.actions,Lu=e=>e[Kn].blocksTotal,Mu=e=>e[Kn].templateBlocksTotal,Nu=e=>e[Kn].parentEmailBlocksTotal,Du=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 Ki(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 Yi(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(h.throwIfAborted(n),new Promise((o,i)=>{let s=!1,c,d;const u=f=>{s||(s=!0,c!==void 0&&(clearTimeout(c),c=void 0),d?.dispose(),n?.removeEventListener("abort",p),f())},p=()=>{u(()=>i(h.createAbortError(n?.reason)))};if(d=e.onInit(()=>{e.isInited()&&e.getTarget()&&u(()=>o())}),e.isInited()&&e.getTarget()){u(()=>o());return}t>0&&(c=setTimeout(()=>{u(()=>i(new Du(t)))},t)),n?.addEventListener("abort",p)}))}var Fu=()=>{try{return localStorage.getItem("em-debug-project-fonts")==="1"}catch{return!1}},Tn=(e,t)=>{Fu()},Bu=e=>[...e].sort((t,n)=>t.order-n.order).map(t=>t.hex.toUpperCase()),$u=(e,t)=>{const n=Array.isArray(e?.usedColors)?e.usedColors:[],o=new Set,i=[];for(const s of[...n,...Bu(t)]){const c=String(s??"").trim().toUpperCase();!c||o.has(c)||(o.add(c),i.push(s))}return{...e,usedColors:i}},Qi,Uu=e=>{Qi=e},Yn=e=>$u(e,Qi?.colors??[]),zu=e=>{const t=r.useMessageService(),n=ji(e),[o,i]=(0,l.useState)("");(0,l.useEffect)(()=>{Uu(n);const c=n?.fonts??[];r.setCachedProjectFonts(c),ed(c),Tn("parent: cache + host @font-face synced",{projectId:e,fontsCount:c.length,families:c.map(d=>d.family?.trim()||d.name)})},[n,e]),(0,l.useEffect)(()=>{const c=n?.fonts??[],d=Vc(c),u=JSON.stringify(d);if(u===o){Tn("parent: iframe send skipped (unchanged)",{entriesCount:d.length});return}Tn("parent: scheduling SANDBOX_SET_PROJECT_FONTS",{entriesCount:d.length,entries:d});const p=()=>{t.send(r.EVENT_TYPES.SANDBOX_SET_PROJECT_FONTS,d),i(u),Tn("parent: SANDBOX_SET_PROJECT_FONTS sent",{entriesCount:d.length})};if(t.inited){p();return}const f=t.onInit(()=>{p()});return()=>f.dispose()},[t,n,o]);const s=(0,l.useCallback)(()=>{Tn("parent: iframe reload — will resend project fonts map"),i("")},[]);Zr(s)};function Gu(e,t){const n=e,o=n?.data?.operation!==void 0?n.data:n;if(o?.operation===t)return o.file instanceof File?o.file:void 0}async function Wu(e,t){const{userId:n,folderId:o}=t.readContext();if(n==null||o==null||o==="")return{status:"skipped"};try{const i=await t.prepare(e),s=await t.upload({user_id:n,folder:String(o),file:i});if(s.error)return{status:"failed",error:s.error};const{extractUploadResult:c}=await(0,Ve.__vitePreload)(async()=>{const{extractUploadResult:u}=await Promise.resolve().then(()=>ye("./static/core/f102fe60.js")).then(p=>p.import_exports);return{extractUploadResult:u}},void 0,{}.url),d=c(s.data);return d.error||!d.file_url?{status:"skipped"}:{status:"uploaded",url:d.file_url}}catch(i){return{status:"failed",error:i}}}function Hu(){const[e,t]=(0,l.useState)(!1),n=r.useHeadless(),o=r.useEventEmitter(h.events.ON_BROWSER_EXTENSION_DETECTED_ID),i=(0,l.useCallback)(()=>{t(!1)},[]);return(0,l.useEffect)(()=>{const s=o.event(()=>{n||t(!0)});return()=>s.dispose()},[o,n]),{open:e,close:i}}function qu(){const[e,t]=(0,l.useState)(!1),n=r.useHeadless(),o=r.useEventEmitter(h.events.ON_BROWSER_TRANSLATE_DETECTED_ID),i=(0,l.useCallback)(()=>{t(!1)},[]);return(0,l.useEffect)(()=>{const s=o.event(()=>{n||t(!0)});return()=>s.dispose()},[o,n]),{open:e,close:i}}var Vu=["translated-ltr","translated-rtl"],Ku=".goog-te-banner-frame",so=!1;function Yu(e){if(e)return e;if(!(typeof document>"u"))return document}function Qu(e){const t=Yu(e);if(!t?.documentElement)return!1;const n=t.documentElement.classList;return Vu.some(o=>n.contains(o))?!0:t.querySelector(Ku)!=null}function Xu(){so=!1}function Ju(e){const t=Qu();return t&&!so&&e(),so=t,t}var Zu=500;function ep(){const e=r.useEventEmitter(h.events.ON_BROWSER_TRANSLATE_DETECTED_ID),t=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(typeof window>"u")return;const n=()=>{Ju(()=>{e.fire()})},o=()=>{t.current!=null&&clearTimeout(t.current),t.current=setTimeout(()=>{t.current=null,n()},Zu)};n();const i=()=>{o()},s=()=>{document.visibilityState==="visible"&&o()},c=new MutationObserver(()=>{o()});return c.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),window.addEventListener("focus",i),document.addEventListener("visibilitychange",s),()=>{t.current!=null&&clearTimeout(t.current),Xu(),c.disconnect(),window.removeEventListener("focus",i),document.removeEventListener("visibilitychange",s)}},[e])}var ao={},Xi=(0,l.createContext)(ao),Ji=(0,l.createContext)({current:ao}),Zi=(0,l.createContext)(()=>{});function tp({children:e}){const t=r.useDispatch(),n=r.useSelector(r.selectActiveSettingsTab),o=r.useEvent(h.SETTINGS_PANEL_EVENT),[i,s]=(0,l.useState)(ao),c=(0,l.useRef)(i);return c.current=i,(0,l.useEffect)(()=>{const d=o(u=>{const p=u?.type===h.ADVANCED_SETTINGS_PANEL;if((!u||!u.type&&!u.content&&!u.advancedTabs?.length)&&n==="Properties")s({}),t(r.resetToLastActiveSettingsTab());else if(n!=="Properties"&&t(r.setActiveSettingsTab(r.PROPERTIES)),u.advancedTabs?.length&&!p&&!u.content){const f=u.advancedTabs.map(g=>({content:g.content,label:g.label,key:g.key,className:g.className}));s(g=>({settings:{},extraTabs:f}))}else if(p&&u.content){const f=u.advancedTabs?.map(g=>({content:g.content,label:g.label,key:g.key,className:g.className}));s(g=>({settings:{},type:u.type,content:u.content,instanceKey:u.instanceKey,parent:u.parent,caption:u.caption,extraTabs:f,deletable:u.deletable}))}});return()=>d.dispose()},[o,s,t,n]),(0,a.jsx)(Zi.Provider,{value:s,children:(0,a.jsx)(Ji.Provider,{value:c,children:(0,a.jsx)(Xi.Provider,{value:i,children:e})})})}function lo(){return(0,l.useContext)(Xi)}function np(){return(0,l.useContext)(Ji)}function rp(){return(0,l.useContext)(Zi)}var es={widthCodeSplit:50,isResizing:!1,currentSide:null},ts=(0,l.createContext)({current:es}),ns=(0,l.createContext)(es.widthCodeSplit),rs=(0,l.createContext)({isResizing:!1,currentSide:null}),os=(0,l.createContext)({setWidthCodeSplit:()=>{},setIsResizing:()=>{},setCurrentSide:()=>{},setBlockMaxHeight:()=>{}}),is=(0,l.createContext)("unset");function op({children:e}){const[t,n]=(0,l.useState)(()=>+window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_code_mode_pane_sizes)||50),[o,i]=(0,l.useState)(!1),[s,c]=(0,l.useState)(null),[d,u]=(0,l.useState)("unset"),p=(0,l.useMemo)(()=>({widthCodeSplit:t,isResizing:o,currentSide:s}),[t,o,s]),f=(0,l.useMemo)(()=>({isResizing:o,currentSide:s}),[o,s]),g=(0,l.useRef)(p);g.current=p;const y=(0,l.useMemo)(()=>({setWidthCodeSplit:n,setIsResizing:i,setCurrentSide:c,setBlockMaxHeight:u}),[]);return(0,a.jsx)(os.Provider,{value:y,children:(0,a.jsx)(ts.Provider,{value:g,children:(0,a.jsx)(rs.Provider,{value:f,children:(0,a.jsx)(ns.Provider,{value:t,children:(0,a.jsx)(is.Provider,{value:d,children:e})})})})})}function ss(){return(0,l.useContext)(rs)}function as(){return(0,l.useContext)(ns)}function ip(){return(0,l.useContext)(ts)}function sp(){return(0,l.useContext)(is)}function ap(){return(0,l.useContext)(os)}var ls=(0,l.createContext)({previewAlertShow:!1,templateNotEmAlertShow:!1}),cs=(0,l.createContext)({setPreviewAlertShow:()=>{},setTemplateNotEmAlertShow:()=>{}});function lp({children:e}){const[t,n]=(0,l.useState)(!1),[o,i]=(0,l.useState)(!1),s=(0,l.useMemo)(()=>({previewAlertShow:t,templateNotEmAlertShow:o}),[t,o]),c=(0,l.useMemo)(()=>({setPreviewAlertShow:n,setTemplateNotEmAlertShow:i}),[]);return(0,a.jsx)(cs.Provider,{value:c,children:(0,a.jsx)(ls.Provider,{value:s,children:e})})}function cp(){return(0,l.useContext)(ls)}function dp(){return(0,l.useContext)(cs)}function up({className:e,sidePanelFloating:t,isCodeMode:n,codeModeDirection:o,children:i}){const s=sp(),c=(0,l.useMemo)(()=>{const d=Number.isFinite(s)?`${s}px`:"unset";return{"--ub-em-pane-block-height":t?n&&o==="bottom"?d:"calc(100% - 30px)":"100%"}},[t,n,o,s]);return(0,a.jsx)(_.ui_kit$Layout,{className:e,style:c,children:i})}function pp({maxPaneWidth:e,isCodeMode:t,codeModeDirection:n,isShowMobileSettings:o,desktopMobileSwitchPanel:i,children:s}){const c=r.useSelector(r.selectEmailWidth),{isResizing:d,currentSide:u}=ss(),p=t&&n!=="bottom"&&!o&&i?"100%":c,f=(0,l.useMemo)(()=>({maxWidth:typeof p=="number"?Math.min(p,e):e}),[p,e]);return(0,a.jsx)("div",{className:(0,rt.default)("email-pane__resizable",{"email-pane__resizable_drag":u||d}),style:f,children:s})}function mp({isCodeMode:e,codeModeDirection:t,sidePanelFloating:n,contentWrapperRef:o,children:i}){const s=as(),c=(0,l.useMemo)(()=>({flexGrow:1,overflowY:n?"scroll":"hidden",overflowX:"hidden",height:e&&t==="bottom"?`calc(${s}%)`:"100%",width:`${t==="left"?100-s:t==="bottom"?100:s}%`}),[e,t,n,s]);return(0,a.jsx)(_.ui_kit$Col,{style:c,id:"pane-content-wrapper",ref:o,children:i})}function fp({isCodeMode:e,codeModeDirection:t,children:n}){const o=as(),i=(0,l.useMemo)(()=>({width:`${t==="right"?100-o:t==="bottom"?100:o}%`,position:"relative",height:t==="bottom"?`calc(${100-o}%)`:"unset",display:e?"initial":"none"}),[e,t,o]);return(0,a.jsx)(_.ui_kit$Col,{style:i,children:n})}function gp({wrapperRef:e,children:t}){const{isResizing:n,currentSide:o}=ss();return(0,a.jsx)("div",{className:(0,rt.default)("email-pane__content-col email-pane__content-col_main",{"email-pane__content-col_disable":o||n}),ref:e,children:t})}function hp({isShowMobileSettings:e,headless:t,templateNotEmAlertEnabled:n}){const{__:o}=r.useI18n(),{previewAlertShow:i,templateNotEmAlertShow:s}=cp();return(0,a.jsxs)(a.Fragment,{children:[i&&e&&(0,a.jsx)(_.ui_kit$Alert,{title:o("Template is not mobile-friendly"),description:o("While editing, some elements of the email no longer fit the screen of the mobile device. Check that these elements are set to a smaller width for mobile devices."),type:"warning",className:"email-pane__col__alert",closable:!0}),s&&!t&&n&&(0,a.jsx)(_.ui_kit$Alert,{title:o("Template from another editor"),description:o("This template was created in another editor. Rebuild it from our components to get stable rendering, error-free editing, and full design control."),type:"warning",className:"email-pane__col__alert",closable:!0})]})}function ds(){const e=r.useElementEntityKind(),t=r.useSelector(r.selectElementSettings$1),n=r.useSelector(r.selectElementSettings);return e==="email"?t:n}function _p({isShowMobileSettings:e,propertiesPanelKey:t,onMouseLeave:n,email:o,onClosePanel:i}){const s=ds(),c=lo();return s?.type||c?.type||c?.content||c?.extraTabs?.length?(0,a.jsx)("div",{className:(0,rt.default)("email-pane__collapse-wrapper",{"mobile-view":e,"mobile-properties":e&&t!=="Structure"}),onMouseLeave:n,children:(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(_.ui_kit$PageLoader,{}),children:(0,a.jsx)(Hi,{email:o,formSettings:c,onClosePanel:i})})}):null}function yp({className:e,emailElementType:t}){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(_.ui_kit$PageLoader,{}),children:(0,a.jsx)(hu,{className:e,emailElementType:t,formSettings:lo()})})}function vp({isCodeMode:e,codeModeDirection:t}){const n=r.useElementEntityKind(),o=ds()?.type;return!(o===r.ELEMENT_TYPES.TEXT||o===r.ELEMENT_TYPES.LINK||o===r.ELEMENT_TYPES.IMG||o===r.ELEMENT_TYPES.BUTTON)||!e||t==="bottom"?null:(0,a.jsx)(yp,{className:(0,rt.default)("selected-element-panel__content selected-element-panel__content_abs",{"selected-element-panel__hidden":o===r.ELEMENT_TYPES.IMG}),emailElementType:n})}function bp({isCodeMode:e,codeModeDirection:t,email:n,onClosePanel:o}){const i=lo();return i?.type!=="img"||!e||t==="bottom"?null:(0,a.jsx)("div",{className:"email-pane__collapse-wrapper email-pane__collapse-wrapper_disabled",children:(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(_.ui_kit$PageLoader,{}),children:(0,a.jsx)(Hi,{email:n,formSettings:i,onClosePanel:o})})})}var Ep="code",Sp=(e,t)=>(0,a.jsx)(t,{className:"email-pane__tab-bar",...e}),{Content:wp}=_.ui_kit$Layout,kp=()=>{ro().catch(()=>{})},Jt=e=>(0,l.memo)(t=>(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(_.ui_kit$PageLoader,{}),children:(0,a.jsx)(e,{...t})})),Cp=Jt(vu),Tp=Jt(yu),Ip=Jt(bu),Ap=Jt(Su),xp=(0,l.memo)(e=>(0,a.jsx)(iu,{...e})),Pp=(0,l.memo)((0,l.forwardRef)((e,t)=>(0,a.jsx)(Bi,{...e,ref:t}))),Rp=(0,l.memo)(e=>(0,a.jsx)(Oi,{...e})),jp=Jt(_u),Op=Jt(ku),Lp=Jt(wu),us=({emailElement:e,isSuccess:t,setIsCollaborationEditor:n,isShowAddAllBlocksModal:o,triggerOpenSavedBlocksTab:i,setIsShowAddAllBlocksModal:s})=>{const{__:d,_x:u}=r.useI18n(),p=r.useMessageService(),{blockId:f}=r.useRouteParams(),g=r.useEditorProjectId(),y=r.useRouteEmailId(),m=r.useDispatch(),E=Vr(),k=r.useOpenPlanCatalog(),{modal:w}=_.ui_kit$App.useApp(),v=r.useAppConfig(),x=r.useConfigSource(),P=r.useHeadless(),K=r.useContainer(),J=qi("panel");gu(K),(0,l.useEffect)(()=>{Ht(K).notePagePainted()},[K]);const{token:N}=(0,_.ui_kit$useToken)(),L=r.useNotification(),A=r.usePushToDataLayer(),O=r.useProjectData(),z=vi(O?.id||g);zu(z);const B=r.useCookieManager(),U=r.useSelector(r.selectActiveSettingsTab),de=r.useCurrentUser(),me=r.toLanguageCode(r.useInterfaceLocale()),H=r.useStore(),Z=ip(),{setWidthCodeSplit:De,setIsResizing:ve,setCurrentSide:et,setBlockMaxHeight:be}=ap(),fe=r.useSelector(r.selectActiveModal$1),Y=r.useSelector(r.selectIsCodeMode),pe=r.useSelector(r.selectCodeModeDirection),[ie,se]=(0,l.useState)(Y);(0,l.useEffect)(()=>{Y&&se(!0)},[Y]);const Ae=r.useSelector(Lu),Te=r.useSelector(Mu),Fe=r.useSelector(Nu),X=r.useSelector(r.selectPropertiesPanelKey),[Ee]=r.useLazyClearAiChatQuery(),[Ie]=r.useUploadImageMutation(),ge=r.useSelector(r.selectEmailViewType)===r.MOBILE,[Re,Ue]=(0,l.useState)(r.LIGHT),[C,T]=(0,l.useState)(),[R,D]=(0,l.useState)(v.defaultBuildPanel||"empty"),[I,S]=(0,l.useState)("empty"),[ae,we]=(0,l.useState)(!1),[Ye,Qe]=(0,l.useState)([]),[ze,Ze]=(0,l.useState)([]),{setPreviewAlertShow:pt,setTemplateNotEmAlertShow:bt}=dp(),{open:ft,close:lt}=Hu(),{open:G,close:V}=qu();ep();const te=r.useRootElement(),ue=r.isEditorLockedByPlan(O,{isPlugin:!0}),he=r.usePlanFeatureGate("discussion"),Ge=r.usePlanFeatureGate("code_editor"),qe=Gi("ai"),st=qe.exceeded?r.getLimitUpgradePresetDefinition(qe.exceeded.presetId):null,Bt=v?.configSwither||!1;(0,l.useEffect)(()=>{m(r.resetParentBlocks())},[m]),(0,l.useEffect)(()=>{const b=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_active_tab);b&&m(r.setActiveSettingsTab(b))},[B,m]);const Le=y||f,Xe=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,oe=rp(),ee=np(),$=(0,l.useRef)(null),le=(0,l.useRef)(null),xe=(0,l.useRef)(),Se=(0,l.useRef)(),Me=(0,l.useRef)(null),We=(0,l.useRef)(),Be=(0,l.useRef)(),ot=(0,l.useRef)(null),fn=(0,l.useRef)(!1),Ot=(0,l.useRef)(!1),ct=(0,l.useCallback)(()=>{Ot.current=!1},[]),Et=(0,l.useCallback)(()=>{Ot.current=!0},[]),Lt=(0,l.useCallback)(b=>{b?.type===r.ELEMENT_TYPES.SOCIAL&&Et()},[Et]),[jn,On]=(0,l.useState)(!1),[gn,Ln]=(0,l.useState)(!1),[Mn]=r.useEditMeMutation(),[gt,St]=(0,l.useState)(!1),[ce,ke]=(0,l.useState)(0),[Ne,nt]=(0,l.useState)(!1),je=(0,l.useCallback)(()=>nt(!1),[]),Yt=(0,l.useCallback)(()=>{nt(!1),k()},[k]),[$t,dt]=(0,l.useState)(!1),Nn=v.configSwither?localStorage.getItem("configSwither")==="pro"?!0:localStorage.getItem("configSwither")==="editor"?!1:v.mode==="pro":!1,Ut=(0,l.useCallback)(()=>{clearTimeout(ot.current);const b=".blocks-search__result-holder";te.querySelector(b)&&(Ae||Te||Fe)&&(te.querySelector(b).style.removeProperty("transition"),te.querySelector(b).style.opacity=0,ot.current=setTimeout(()=>{r.measureBlockPreviews(te,207/640),te.querySelector(b)&&(te.querySelector(b).style.transition="opacity 0.2s",te.querySelectorAll(b).forEach(j=>j.style.opacity=1))},200))},[Te,Ae,Fe]),Tt=(0,l.useRef)(void 0),It=(0,l.useCallback)(b=>{const j=b.target;j&&(window.clearTimeout(Tt.current),Tt.current=window.setTimeout(()=>{On(!!j.closest(".desktop_view")),Ln(!!j.closest(".mobile_view"))},100))},[]);(0,l.useEffect)(()=>()=>{window.clearTimeout(Tt.current)},[]),(0,l.useEffect)(()=>{const b=r.addDocumentListenerFromShadow(te,"mouseover",It);return()=>{b.dispose()}},[te,It]),(0,l.useEffect)(()=>{typeof n=="function"&&(ze.length>0?n(!0):n(!1))},[ze]);const[Dr]=r.useSendMessageMutation(),{data:ht={},refetch:M,status:q}=r.useGetDialogQuery({entity_id:Le},{skip:!Le||v.aiAssistentEnabled===!1||ue}),Q=r.useEventEmitter(h.events.AI_TEXT_REQUEST_ID).hasListeners(),re=r.useIsStandalone(),ne=!Q&&!re,W=(0,l.useMemo)(()=>ne?[{data:{role:"assistant",message:d("Typing..."),isLoading:!0}}]:[],[ne,d]),[Ce,_e]=(0,l.useState)([]),[He,hn]=(0,l.useState)(v.defaultBuildPanel!==""?r.BLOCKS:r.ATOMS),Dn=(0,l.useRef)(null),mt=(0,l.useCallback)(()=>{const b=Se.current?.getBoundingClientRect(),j=C?.getBoundingClientRect();p.send({operation:r.EVENT_TYPES.SANDBOX_WINDOW_CHARACTERISTIC,settings:{iframeOffsetTop:Y&&pe!=="bottom"?0:30,scrollTop:-b?.top+j?.top+30,innerHeight:window.innerHeight,previewHeight:j?.height,mode:Y&&pe!=="bottom"?Ep:"default"}})},[pe,Y,C,p]),Fr=t&&e,_n=(0,l.useCallback)(b=>{const j=window.navigator.platform.match("Mac");v.codeEnabled&&v.codeSideEnabled&&b.altKey&&b.keyCode===88&&(E.toggle(),Ge.isLocked&&(St(!0),ke(r.FEATURE_UPSELL_SLIDE.code_editor))),((j?b.metaKey:b.ctrlKey)&&b.shiftKey&&b.keyCode===76||(j?b.metaKey:b.ctrlKey)&&b.shiftKey&&b.keyCode===69||(j?b.metaKey:b.ctrlKey)&&b.shiftKey&&b.keyCode===82)&&b.preventDefault()},[v.codeEnabled,Ge.isLocked,v.codeSideEnabled,E]),wt=fe.includes("UPLOAD_IMAGE_")||fe.includes("UPLOAD_BACKGROUND_"),yn=(0,l.useRef)(!1),_t=(0,l.useCallback)(b=>{const j=b.target,F=j.closest(".email-pane__content-col")||j.closest(".email-pane__collapse-wrapper")||j.closest(".selected-element-panel-content")||j.closest(".selected-element-panel")||j.closest(".em-analytics__email-tab-properties")||j.closest(".em-analytics__email-tab-styles")||j.closest(".em-analytics__email-tab-history")||j.closest(".blocks-modal-container")||j.closest(".email-pane__sizes")||j.closest(".email-preview-menu")||j.closest(".monaco-editor")||j.closest(".ant-modal-wrap");yn.current=!!F},[]),Ga=(0,l.useCallback)(b=>{const j=yn.current,F=window.getSelection().toString().length>0||document.activeElement&&document.activeElement.tagName==="INPUT"&&document.activeElement.selectionStart!==document.activeElement.selectionEnd;yn.current=!1,!(j||F)&&(!document.querySelector(".easylogic-colorpicker")&&!te.querySelector(".easylogic-colorpicker")&&!b.target.closest(".email-pane__content-col")&&!b.target.closest(".blocks-modal-container")&&!b.target.closest(".email-pane__collapse-wrapper")&&!b.target.closest(".selected-element-panel__columns-settings__controls__column__remove")&&!b.target.closest(".email-preview__content-col_main")&&!b.target.closest(".email-preview-menu")&&!b.target.closest(".monaco-editor")&&!b.target.closest(".main__pane-close-btn")&&!b.target.closest(".main__pane-trigger")&&!b.target.closest(".ant-modal-wrap")&&!b.target.closest(".email-pane__sizes")&&!b.target.closest(".ant-input-clear-icon")&&!b.target.closest(".ant-color-picker")&&!b.target.closest(".control-font-family-dropdown")&&!Dn.current&&!b.target.closest(".email-preview-menu__history")&&!b.target.closest(".selected-element-panel-content")&&!b.target.closest(".ant-select-dropdown")&&!b.target.closest(".ant-picker-dropdown")&&!b.target.closest(".toggle_view")&&!b.target.closest(".upload-bg-image__menu")&&!b.target.closest(".email-pane__paths")&&!b.target.closest(".ant-tabs-extra-content")&&!b.target.closest(".anticon-delete")&&!wt&&fe!==r.MODALS.IMAGE_EDITOR_MODAL&&(U==="Properties"&&(Et(),m(r.resetToLastActiveSettingsTab()),p.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),Qe([])),U==="History"&&m(r.setActiveSettingsTab(r.BUILD)),m(r.switchIsPanelHistoryCollapsed(!0)),p.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),setTimeout(()=>{e.type?m(r.setElementSettings({type:null})):m(r.setElementSettings$1({type:null}))},300)),Dn.current=null)},[m,e.type,fe,U,p,wt]),[gv,Wa]=(0,l.useState)(!0),{data:qo=[],refetch:Br}=r.useGetCommentsQuery(Le,{skip:!Le||ue});(0,l.useEffect)(()=>{Le&&!ue&&Br()},[U,Le,ue,Br]),(0,l.useEffect)(()=>{Le&&!Object.keys(ht).length&&q==="fulfilled"&&M()},[U,Le,M,ht,q]),(0,l.useEffect)(()=>{const b=new h.Disposable,j=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_active_tab);if(ht?.totalCount===0&&q!=="pending"){const Pe={project_id:g,connection:"chat",entity_id:Le,context:"default",locale:me};!j&&ne&&r.runOnceInFlight(`email-default-context:${Le}`,()=>{r.swallowPromiseRejection(Dr({body:Pe}).then(()=>{b.isDisposed()||q==="fulfilled"&&M()}))})}const F={data:{role:"assistant",message:d("Typing..."),isLoading:!0}};return ht?.documents?.length>0?(window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_active_tab),_e(ht?.documents),ne&&ht?.documents[ht?.documents?.length-1].data?.userInfo&&_e([...ht?.documents,F])):j||_e(ne?[F]:[]),()=>b.dispose()},[Le,me,ht?.totalCount,ht?.documents,ne,g,M,Dr,q]),(0,l.useEffect)(()=>{oe({}),m(Xe==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},[m,Xe]);const Ha=(0,l.useCallback)(b=>{m(r.setEmailSettings(Yn(b)))},[m]),qa=(0,l.useCallback)(b=>{m(r.setBlockSettings(Yn(b)))},[m]),Fn=(0,l.useCallback)(b=>{m(Xe==="email"?r.setElementSettings$1(Yn(b)):r.setElementSettings(Yn(b)))},[m,Xe]);(0,l.useEffect)(()=>{const b=We.current,j=Me.current;T(Y?j??b:b)},[Y,pe]);const[hv,_v]=(0,l.useState)(null),yv=(0,l.useCallback)(b=>{v.sidePanelFloating&&(Me.current=b),_v(b)},[v.sidePanelFloating]),Bn=(0,l.useCallback)(b=>{D(b),b==="search"?we(!0):(we(!1),S(b)),setTimeout(Ut,50)},[Ut]),vv=(0,l.useCallback)(b=>{const j=b.data.operation,F=b.data,Pe=b.data.action;if(j==="application_block_inserted"||b.data.operationId==="application_block_inserted"){const Oe=b.data.operationId?b.data.data:F||{},Nt=Oe.type==="project"||Oe.type==="template"||Oe.type==="common"?"block":"structure",bn=Oe.name||Oe.type||(Nt==="block"?"block":"structure");A({event:"add",action:"add_element_to_email",element_type:Nt,element_name:bn,entity_id:e?.id||y||f,project_id:O?.id||g})}if(j===r.EVENT_TYPES.APPLICATION_SCROLL_TO&&setTimeout(()=>{Me.current?.scrollTo({top:b.data.settings.value,behavior:"smooth"})},100),j===r.EVENT_TYPES.APPLICATION_PREVIEW_ALERT_SHOW&&pt(F.settings.show),j===r.EVENT_TYPES.APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW&&bt(!0),j===r.EVENT_TYPES.APPLICATION_ACTION&&Pe==="toggle_editor"&&E.toggle(),j===r.EVENT_TYPES.APPLICATION_IFRAME_SET_HEIGHT&&(te.querySelector(".email-pane__iframe").style.height=F.settings.height+"px"),j===r.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){let Oe=Object.assign({},F.settings);delete Oe.preheader,Object.values(Oe).every(Nt=>!Nt)?(m(r.setEmailSettingsDisable(!0)),m(r.resetToLastActiveSettingsTab())):Ha(F.settings),F.settings.noBlocks,m(r.setMobileViewActive(F.settings.responsive)),Wa(Oe.structuresMedia)}if(j===r.EVENT_TYPES.APPLICATION_BLOCK_SETTINGS_SET&&(Object.values(F.settings).every(Oe=>!Oe)?(m(r.setBlockSettingsDisable(!0)),m(r.resetToLastActiveSettingsTab())):(qa(F.settings),Wa(F.settings.structuresMedia))),j===r.EVENT_TYPES.APPLICATION_ELEMENT_SETTINGS_SET){const Oe=Object.values(r.ELEMENT_TYPES).includes(F.type),Nt=ee.current,bn=Nt?.type==="advanced"&&!!Nt.content,At=F.tab?!0:!Oe&&!bn,{type:Ov,caption:Lv,settings:Mv}=F,tl=JSON.stringify([Ov,Lv,Mv]),Nv=tl!==$.current;if($.current=tl,At&&U==="Properties"&&m(r.resetToLastActiveSettingsTab()),F.type===r.ELEMENT_TYPES.EMPTY_TABLE||F.type===r.ELEMENT_TYPES.EMPTY_TD?(m(r.setActiveSettingsTab(r.BUILD)),F.type===r.ELEMENT_TYPES.EMPTY_TABLE?(hn(r.BLOCKS),F.tab?Bn(F.tab):Bn("common")):F.type===r.ELEMENT_TYPES.EMPTY_TD&&hn(r.ATOMS)):F.type&&U!=="Properties"?F.type===r.ELEMENT_TYPES.SOCIAL&&Ot.current?ct():(ct(),m(r.setActiveSettingsTab(r.PROPERTIES))):F.type!==r.ELEMENT_TYPES.SOCIAL&&ct(),!Nv)return;F.type===r.ELEMENT_TYPES.CAROUSEL||F.type===r.ELEMENT_TYPES.ACCORDION||F.type===r.ELEMENT_TYPES.SOCIAL?(oe(tn=>({settings:{...F.settings,type:At?null:F.type,caption:F.caption,parent:At?null:F.settings.parent},type:At?null:F.type,parent:At?null:F.settings.parent,caption:F.caption,extraTabs:tn.extraTabs})),Fn({})):(Fn({...F.settings,type:At?null:F.type,parent:At?null:F.settings.parent,caption:F.caption}),oe(tn=>!Oe&&tn.type==="advanced"&&tn.content?{...tn,settings:{...F.settings,type:F.type,parent:F.settings?.parent,caption:F.caption}}:tn.extraTabs?.length?{extraTabs:tn.extraTabs}:{})),F.settings?.path?.length>0&&Qe(F.settings?.path)}j===r.EVENT_TYPES.APPLICATION_ELEMENT_SETTINGS_CLOSE&&($.current=null,ee.current?.type===r.ELEMENT_TYPES.SOCIAL&&Et(),m(r.resetToLastActiveSettingsTab()))},[m,Ha,qa,Fn,U,Bn,te,A,e,y,f,O,ct,Et,E,g,ee,oe,pt,bt]);(0,l.useEffect)(()=>{r.identifyUser({id:de?.id,email:de?.email,username:de?.name})},[de]),(0,l.useEffect)(()=>{const b=de.email_builder_config,j=!ue,F=x.get()?.mode;if(!b||typeof b!="string")return;const Pe=j&&b==="simple"?"pro":b;Pe!==F&&m(r.changeConfig(Pe))},[ue,de.email_builder_config,de.id,m,H,x]),(0,l.useEffect)(()=>{if(Y&&Ge.isLocked&&E.toggle(),v.configSwither){let b=localStorage.getItem("configSwither")||v.mode||"editor";localStorage.setItem("configSwither",b),m(r.changeConfig(b))}},[]);const Va=b=>{setTimeout(()=>{if(ue)m(r.changeConfig("pro")),dt(!0),St(!0),A({event:"change",action:"change_config_mode",config_mode:"pro",entity_id:e?.id||y||f,project_id:O?.id||g});else{let j=b?"pro":"editor";localStorage.setItem("configSwither",j),m(r.changeConfig(j)),A({event:"change",action:"change_config_mode",config_mode:j,entity_id:e?.id||y||f,project_id:O?.id||g})}},200)},bv=()=>{Y&&E.toggle(),m(r.resetToLastActiveSettingsTab()),m(r.changeConfig("simple")),dt(!1),St(!1),A({event:"change",action:"change_config_mode",config_mode:"simple",entity_id:e?.id||y||f,project_id:O?.id||g})},Ev=(0,l.useCallback)(()=>{St(!1)},[]);r.useListenPostMessage(vv),(0,l.useEffect)(()=>{const b=p.addListener(j=>{const F=Gu(j,r.EVENT_TYPES.APPLICATION_NATIVE_IMAGE_DROP);if(!F)return;const Pe=()=>p.send({operation:r.EVENT_TYPES.SANDBOX_NATIVE_IMAGE_DROP_CLEAR});(async()=>{const Oe=await Wu(F,{readContext:()=>({userId:de?.id,folderId:O?.id??g}),prepare:At=>r.prepareImageForEditorUpload(At,v),upload:At=>Ie(At)});if(Oe.status==="failed"&&L.fromError("IMAGE_UPLOAD_ERROR",F,Oe.error,!0),Oe.status!=="uploaded"){Pe();return}p.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.IMG,settings:{src:Oe.url}});const Nt=H.getState(),bn=Xe==="email"?r.selectElementSettings$1(Nt):r.selectElementSettings(Nt);bn?.type===r.ELEMENT_TYPES.IMG&&Fn({...bn,src:Oe.url,changeKey:"src"})})()});return()=>b.dispose()},[p,Ie,de,g,O?.id,v,L,Fn,H,Xe]),(0,l.useEffect)(()=>{const b=p.addListener("application_atom_inserted",F=>{A({event:"add",action:"add_element_to_email",element_type:"atom",element_name:F||"atom",entity_id:e?.id||y||f,project_id:O?.id||g})}),j=p.addListener("application_block_inserted",F=>{const Pe=F?.type==="project"||F?.type==="template"||F?.type==="common"?"block":"structure",Oe=F?.name||F?.type||(Pe==="block"?"block":"structure");A({event:"add",action:"add_element_to_email",element_type:Pe,element_name:Oe,entity_id:e?.id||y||f,project_id:O?.id||g})});return()=>{b?.dispose(),j?.dispose()}},[p,A,e?.id,y,f,g,O?.id]);const Sv=b=>{let j=te.querySelector(".atoms__list");v.toggleSidePanel&&b===U?m(r.setActiveSettingsTab(r.DISABLED_TAB)):b==="Optimize"?xt.comingSoonHandler(d,w):b!=="Properties"&&b!=="History"?(m(r.setActiveSettingsTab(b)),A({event:"navigate",action:"navigate_email_pane_tab",tab_name:b==="Disabled_tab"?"DISABLED_TAB":b,entity_id:e?.id||y||f,project_id:O?.id||g}),p.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),p.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),Qe([])):(b==="Properties"||b==="History")&&A({event:"navigate",action:"navigate_email_pane_tab",tab_name:b,entity_id:e?.id||y||f,project_id:O?.id||g}),he.isLocked&&b==="Discuss"&&(St(!0),ke(r.FEATURE_UPSELL_SLIDE.discussion)),ue&&b==="Optimise"&&(St(!0),ke(6)),qe.isLocked&&b==="AiChat"&&(qe.state.state==="locked_by_limit"&&qe.exceeded?nt(!0):(St(!0),ke(9)))},Vo=(0,l.useRef)(null),$r=(0,l.useRef)(void 0),Mt=(0,l.useCallback)(()=>{const b=Me.current?.getBoundingClientRect();if(Vo?.current?.getBoundingClientRect().top>=0&&b){const j=Math.round(b.height-30);Vo.current.style.height=`${j}px`,be(j-30)}$r.current&&window.clearTimeout($r.current),$r.current=window.setTimeout(function(){p.isInited()&&mt()},100)},[mt,p,be]);(0,l.useEffect)(()=>()=>{window.clearTimeout($r.current)},[]),(0,l.useEffect)(()=>(U==="AiChat"&&!ue?le.current=setInterval(()=>{M({entity_id:Le})},5e3):clearInterval(le.current),clearInterval(le.current)),[Le,ue,M,U]);const wv=b=>hn(b||""),kv=()=>{we(!1),D(I)},Ko=()=>{let b=te.querySelector(".block-search__preview");b&&(b.style.opacity="0",b.style.transform="translateX(-99%)",setTimeout(function(){b.remove()},300))};let vn=[];const $n={display:"flex",alignItems:"center",justifyContent:"center"};v.blocksEmptyEnabled&&vn.push({label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"top",title:d("Empty blocks"),children:(0,a.jsx)("div",{style:$n,children:(0,a.jsx)(r.EmIcons,{icon:"BorderOuterOutlined",component:_.icons$BorderOuterOutlined,style:{fontSize:18}})})}),value:"empty"}),v.blocksSavedEnabled&&vn.push({label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"top",title:d("Saved blocks"),children:(0,a.jsx)("div",{style:$n,children:(0,a.jsx)(r.EmIcons,{icon:"AppstoreAddOutlined",component:_.icons$AppstoreAddOutlined,style:{fontSize:18}})})}),value:"project"}),v.blocksCommonEnabled&&vn.push({label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"top",title:d("Common blocks"),children:(0,a.jsx)("div",{style:$n,children:(0,a.jsx)(r.EmIcons,{icon:"AppstoreOutlined",component:_.icons$AppstoreOutlined,style:{fontSize:18}})})}),value:"common"}),v.blocksTemplateEnabled&&vn.push({label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"top",title:d("Template blocks"),children:(0,a.jsx)("div",{style:$n,children:(0,a.jsx)(r.EmIcons,{icon:"BuildOutlined",component:_.icons$BuildOutlined,style:{fontSize:18}})})}),value:"template"}),v.blocksSearchEnabled&&vn.push({label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"top",title:d("Blocks search"),children:(0,a.jsx)("div",{style:$n,children:(0,a.jsx)(r.EmIcons,{icon:"SearchOutlined",component:_.icons$SearchOutlined,style:{fontSize:18}})})}),value:"search"});const Ur=R!=="empty"||ae,Cv=!v.blocksSectionsShow||Ur?"100%":"calc(100% - 44px)";let Tv=[{label:(0,a.jsx)("div",{className:"email-pane__tab",children:d("Elements")}),key:r.ATOMS,className:"email-pane__collapse-panel email-pane__atoms",children:(0,a.jsx)(Rp,{})},{label:(0,a.jsx)("div",{className:"email-pane__tab",children:d("Blocks")}),key:r.BLOCKS,className:"email-pane__collapse-panel email-pane__blocks-search",style:{height:Cv},children:(0,a.jsxs)("div",{className:(0,rt.default)("email-pane__blocks-panel",{"email-pane__blocks-panel_scrollable":Ur}),children:[v.blocksSectionsShow&&(0,a.jsxs)("div",{className:"email-pane__blocks-panel-header",children:[(0,a.jsxs)(_.ui_kit$Space.Compact,{block:!0,children:[!ae&&(0,a.jsx)(_.ui_kit$Segmented,{block:!0,style:{width:"100%",marginTop:24},onChange:Bn,value:R,options:vn}),ae&&(0,a.jsx)("div",{style:{width:"100%",height:36}}),ae&&(0,a.jsx)("div",{style:{width:36,textAlign:"right",marginTop:22},children:(0,a.jsx)(r.EmIcons,{icon:"CloseOutlined",component:_.icons$CloseOutlined,style:{padding:"0 2px 0",cursor:"pointer"},onClick:kv})})]}),(0,a.jsx)("div",{className:"blocks-search__divider-wrapper",style:{marginTop:ae?28:12},children:(0,a.jsx)(_.ui_kit$Divider,{className:"blocks-search__divider"})})]}),(0,a.jsxs)("div",{className:"email-pane__blocks-panel-body",children:[(0,a.jsx)("div",{className:"blocks-search__empty-shadow",style:{display:R==="empty"&&!ae?"block":"none"},children:gv?(0,a.jsx)(pi,{}):(0,a.jsx)(di,{})}),(0,a.jsx)("div",{className:(0,rt.default)("email-pane__blocks-panel-results",{"email-pane__blocks-panel-results_visible":Ur}),children:(0,a.jsx)(Ap,{parentEmailId:e?.parent_email,blocksTab:R,search:ae,reloadBlockScreens:Ut,setIsShowAddAllBlocksModal:s})})]})]})}];const Un=[{disabled:gt,key:r.PROPERTIES,style:{height:"var(--ub-em-pane-block-height)"},className:"em-analytics__email-tab-properties",children:(0,a.jsx)(_p,{isShowMobileSettings:ge,propertiesPanelKey:X,onMouseLeave:Ko,email:e,onClosePanel:Lt})},{disabled:gt,key:r.HISTORY,style:{height:"var(--ub-em-pane-block-height)"},className:"em-analytics__email-tab-history",children:Fr&&(0,a.jsx)("div",{className:"email-pane__collapse-wrapper",onMouseLeave:Ko,children:(0,a.jsx)(Op,{setCollapsedHistory:()=>m(r.switchIsPanelHistoryCollapsed(!0)),emailElement:Fr})})},{key:r.DISABLED_TAB,className:"em-analytics__email-tab-properties"},{disabled:gt,label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"left",title:u("Build","tab"),children:(0,a.jsx)(r.EmIcons,{"data-testid":"contentIcon",icon:"PlusCircleOutlined",component:_.icons$PlusCircleOutlined,size:24,strokeWidth:v.iconStrokeWidth})}),key:r.BUILD,className:"em-analytics__email-tab-build",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,a.jsx)("div",{className:(0,rt.default)("email-pane__collapse-wrapper",{"email-pane__collapse-wrapper_no-topleft-radius":U==="Build"||!U,"email-pane__collapse-wrapper_build":He==="Blocks"&&Ur}),onMouseLeave:Ko,children:(0,a.jsx)(_.ui_kit$Tabs,{className:(0,rt.default)("secondary-tabs email-pane__collapse",{"secondary-tabs_unset_scroll":He===r.BLOCKS}),size:"large",activeKey:He,onChange:wv,items:Tv})})},{disabled:gt,label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"left",title:u("Styles","tab"),children:(0,a.jsx)(r.EmIcons,{"data-testid":"stylesIcon",icon:"Styles",component:_.icons$Styles,size:24,strokeWidth:v.iconStrokeWidth})}),key:r.STYLES,className:"em-analytics__email-tab-styles",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,a.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,a.jsx)(Tp,{email:e})})}];v.commentsEnabled&&Un.push({disabled:gt,label:(0,a.jsxs)(_.ui_kit$Tooltip,{placement:"left",title:u("Discuss","tab"),children:[(0,a.jsx)(r.EmIcons,{"data-testid":"commentsIcon",icon:"CommentOutlined",component:_.icons$CommentOutlined,size:24,strokeWidth:v.iconStrokeWidth}),he.isLocked&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:v.iconStrokeWidth,className:"free-mode-firewall-icon free-mode-firewall-icon_emailpane"}),!!qo.length&&(0,a.jsx)("span",{className:"email-pane__comment-counter",children:qo.filter(b=>b.comment_status!=="deleted").length})]}),key:"Discuss",className:"email-pane__tab-discuss em-analytics__email-tab-discuss",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,a.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,a.jsx)(_.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse discuss-wrapper",size:"large",activeKey:"Discuss",items:[{label:(0,a.jsx)(a.Fragment,{children:d("Discuss")}),key:"Discuss",forceRender:!0,className:"email-settings__collapse-panel",children:Le?(0,a.jsx)(Lp,{email:e,comments:qo,subjectId:Le,isLoggedIn:!0,emailElementType:Xe}):(0,a.jsx)("div",{className:"aside-content-wrapper",children:e.hasOwnProperty("type")?(0,a.jsx)(_.ui_kit$Alert,{description:d("Save the block before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}}):(0,a.jsx)(_.ui_kit$Alert,{description:d("Save the email before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}})})}]})})});const Iv=()=>{Ee({entity_id:Le}).then(b=>{b.error?L.error({title:b.error.data.code,description:b.error.data.message}):b.data.success&&L.success({title:d("Success"),description:b.data.success}),ue||M()})};v.aiAssistentEnabled&&Un.push({disabled:gt,label:(0,a.jsxs)(_.ui_kit$Tooltip,{placement:"left",title:u("AI assistant","tab"),children:[(0,a.jsx)(r.EmIcons,{"data-testid":"aiAssistentIcon",icon:"AI",component:_.icons$AI,size:24,strokeWidth:v.iconStrokeWidth}),qe.isLocked&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:v.iconStrokeWidth,className:"free-mode-firewall-icon free-mode-firewall-icon_emailpane"}),ht?.totalCount>0&&Le&&(0,a.jsx)("span",{className:"email-pane__comment-counter",children:ht?.totalCount})]}),key:"AiChat",className:"email-pane__tab-discuss em-analytics__email-tab-discuss",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,a.jsx)(_.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse discuss-ai-wrapper",size:"large",activeKey:"AiChat",tabBarExtraContent:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"top",title:d("Clear chat"),children:(0,a.jsx)(_.ui_kit$Popconfirm,{description:d("Clear chat history?"),onConfirm:Iv,okText:d("Yes"),cancelText:d("No"),icon:"",placement:"leftTop",title:!1,children:(0,a.jsx)(_.ui_kit$Button,{type:"text",icon:(0,a.jsx)(r.EmIcons,{icon:"ClearChat",component:_.icons$ClearChat,style:{fontSize:16}}),style:{marginRight:16}})})}),items:[{label:(0,a.jsx)(a.Fragment,{children:d("AI assistant")}),key:"AiChat",forceRender:!0,className:"email-settings__collapse-panel",children:Le||window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_active_tab)?(0,a.jsx)(Cp,{messages:Ce.length>0?Ce:W,newEmailAiGeneratorRef:fn}):(0,a.jsx)("div",{className:"aside-content-wrapper",children:e.hasOwnProperty("type")?(0,a.jsx)(_.ui_kit$Alert,{description:d("Save the block before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}}):(0,a.jsx)(_.ui_kit$Alert,{description:d("Save the email before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}})})}]})})})}),v.optimizeEnabled&&Un.push({disabled:gt,label:(0,a.jsxs)(_.ui_kit$Tooltip,{placement:"left",title:u("Optimize","tab"),children:[(0,a.jsx)(r.EmIcons,{"data-testid":"optimizeIcon",icon:"Speed",component:_.icons$Speed,size:24,strokeWidth:v.iconStrokeWidth}),ue&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:v.iconStrokeWidth,className:"free-mode-firewall-icon free-mode-firewall-icon_emailpane"})]}),key:"Optimise",className:"em-analytics__email-tab-optimise",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,a.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,a.jsx)(_.ui_kit$Tabs,{className:"secondary-tabs secondary-tabs_optimise email-settings__collapse optimise-wrapper",size:"large",activeKey:"Optimise",items:[{label:(0,a.jsx)(a.Fragment,{children:d("Optimize")}),key:"Optimise",forceRender:!0,className:"email-settings__collapse-panel",children:(0,a.jsx)(Ip,{})}]})})}),v.settingsEnabled&&Un.push({disabled:gt,label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"left",title:u("Settings","tab"),children:(0,a.jsx)(r.EmIcons,{"data-testid":"settingsIcon",icon:"SettingOutlined",component:_.icons$SettingOutlined,size:24,strokeWidth:v.iconStrokeWidth})}),key:"Edit",className:"em-analytics__email-tab-edit",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,a.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,a.jsx)(jp,{email:e})})});const Ka=U===r.DISCUSS,Ya=(0,l.useRef)(0),Qa=(0,l.useRef)(0),Xa=(0,l.useRef)(0),Av=(0,l.useCallback)(()=>(te.querySelector(".email-pane__col_preview")?.getBoundingClientRect().width??0)-(v.sidePanelFloating?0:38),[te,v.sidePanelFloating]);(0,l.useEffect)(()=>{Le&&!ue&&Br()},[Le,ue,Br]),(0,l.useEffect)(()=>{const b=p.onInit(()=>{p.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),p.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:Ka})});return()=>b.dispose()},[Ka,p]),(0,l.useEffect)(()=>{if(!C||!Ki(p))return;const b=new AbortController;return Yi(p,r.DEFAULT_SANDBOX_READY_TIMEOUT_MS,b.signal).then(()=>mt()).catch(()=>{}),()=>b.abort()},[C,mt,p]);const Yo=(0,l.useCallback)(b=>{const j=b??r.selectEmailWidth(H.getState());p.send({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:typeof j=="number"?j+2:j}}),xe.current?.resize()},[H,p]);(0,l.useEffect)(()=>{if(!ge&&U!=="Disabled_tab"){const b=te.querySelector(".email-pane__row")?.getBoundingClientRect().width;Se?.current?.getBoundingClientRect().width+540>b&&m(r.setEmailWidth("100%"))}},[m,U,te,ge]);const Qo=(0,l.useCallback)(()=>{const b=Se.current;b&&(b.style.borderWidth="1px",v.sidePanelFloating||(b.style.marginLeft="-1px",b.style.marginRight="-1px"),b.style.borderLeftColor=null,b.style.borderRightColor=null)},[v.sidePanelFloating]),Ja=(0,l.useCallback)(b=>{const j=Z.current.widthCodeSplit;ve(!1),Z.current.currentSide&&(setTimeout(()=>Yo(),50),et(null)),b.target.classList.contains("email-pane__handle")||Qo(),window.localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_code_mode_pane_sizes,JSON.stringify(j))},[Yo,Z,ve,et,Qo]),Za=b=>j=>{j.target.classList.contains("email-pane__handle")&&(j.preventDefault(),Ya.current=j.target.parentNode.offsetWidth,Qa.current=j.pageX,Xa.current=Av(),et(b),Dn.current=b)},zr=b=>{const j=Se.current,{currentSide:F}=Z.current;typeof b=="string"&&(!F||F===b)?(te.querySelector(".email-pane__iframe").style.width="calc(100% + 1px)",b==="right"?(j.style.borderRightColor=N.colorPrimary,j.style.borderRightWidth="2px"):(j.style.borderLeftColor=N.colorPrimary,j.style.borderLeftWidth="2px",te.querySelector(".email-pane__iframe").style.marginLeft="-1px")):F||(Qo(),te.querySelector(".email-pane__iframe").style.width="1px",te.querySelector(".email-pane__iframe").style.removeProperty("margin-left"))},xv=(0,l.useCallback)(()=>{ve(!0)},[ve]),Xo=(0,l.useCallback)(b=>{const{currentSide:j}=Z.current;if(!j)return;const F=(b.pageX-Qa.current)*2,Pe=Ya.current+(j==="left"?-F:F),Oe=Math.min(Xa.current,1200);Pe>318&&Pe<Oe&&(m(r.setEmailWidth(Math.min(Pe,1200))),xe.current?.resize())},[m,Z]),Jo=(0,l.useCallback)(b=>{if(Z.current.isResizing)if(pe==="bottom"){const j=Be.current.getBoundingClientRect().height,F=Be.current.getBoundingClientRect().top,Pe=(b.clientY-F)/j*100;if(Pe<20||Pe>80)return;De(Pe),Mt()}else{const j=Be.current.getBoundingClientRect().width,F=Be.current.getBoundingClientRect().left,Pe=(b.clientX-F)/j*100,Oe=Se.current.getBoundingClientRect().width;if(v.desktopMobileSwitchPanel&&typeof Oe=="number"&&Oe<=425&&m(r.setEmailWidth(425)),Pe<20||Pe>80)return;De(Pe)}},[Z,De,pe,Mt,m,v.desktopMobileSwitchPanel]);(0,l.useEffect)(()=>{Mt()},[Y,Mt]);const Pv=b=>{b?.stopPropagation?.();const j=Re==="light"?r.DARK:r.LIGHT;p.send({operation:r.EVENT_TYPES.SANDBOX_SWITCH_THEME,data:{theme:j}}),Ue(j)},el=(b="panel")=>{const j=b==="panel",F=Re===r.DARK,Pe={size:j?18:16,strokeWidth:j?v.iconStrokeWidth:2};return(0,a.jsx)(_.ui_kit$Tooltip,{title:d(F?"Light theme":"Dark theme"),placement:j?"top":"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:j?F?"primary":"text":"default",icon:F?(0,a.jsx)(r.EmIcons,{icon:"LightMode",component:_.icons$LightMode,...Pe}):(0,a.jsx)(r.EmIcons,{icon:"DarkMode",component:_.icons$DarkMode,...Pe}),shape:"circle",size:j?void 0:"small",onClick:Pv,className:"toggle_view theme_view email-pane__theme-toggle",style:j?void 0:{left:4,top:4,zIndex:999,padding:0,position:"absolute"}})})},Zo=b=>{const j=typeof b=="number"?Math.min(b,1200):b;m(r.setEmailWidth(j)),setTimeout(()=>Yo(j),700);const F=typeof j=="number"?j:j==="100%"?"full":j,Pe=typeof j=="number"&&j<=425?"mobile":"desktop";A({event:"change",action:"change_email_size",email_id:e?.id||y||f,project_id:O?.id||g,width:F,view_type:Pe})};(0,l.useEffect)(()=>{const b=new h.Disposable;return b.addDisposable(r.addWindowListenerFromShadow(te,"mousedown",_t,!0)),b.addDisposable(r.addWindowListenerFromShadow(te,"click",Ga)),b.addDisposable(r.addWindowListenerFromShadow(te,"mouseup",j=>Ja(j),!0)),()=>{b.dispose()}},[te,Ga,_t,Ja]),(0,l.useEffect)(()=>{const b=Me.current;if(!b||typeof ResizeObserver!="function")return;const j=new ResizeObserver(Mt);return j.observe(b),()=>j.disconnect()},[Mt,v.sidePanelFloating]),(0,l.useEffect)(()=>(window.addEventListener("scroll",Mt,!0),window.addEventListener("mousemove",Xo,!0),window.addEventListener("mousemove",Jo),window.addEventListener("keydown",_n),()=>{window.removeEventListener("mousemove",Xo,!0),window.removeEventListener("mousemove",Jo),window.removeEventListener("scroll",Mt,!0),window.removeEventListener("keydown",_n)}),[Mt,Xo,Jo,_n]);const Rv=b=>{const j=Y?"visual":"code",F=!Y;if(Y?E.toggle():typeof b=="string"?(E.setDirection(b),!Y&&E.toggle()):E.toggle(),F){const Pe=Xe==="block"?"block":"email",Oe=typeof b=="string"?b:pe||"toggle";A({event:"activate",action:"activate_code_mode",entity_type:Pe,entity_id:e?.id||y||f,project_id:O?.id||g,code_mode_direction:Oe})}A({event:"change",action:"change_editor_mode",editor_mode:j,entity_id:e?.id||y||f,project_id:O?.id||g}),m(r.resetToLastActiveSettingsTab()),setTimeout(()=>{m(Xe==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),p.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),m(r.resetPanes())};(0,l.useEffect)(()=>{v.emailPaneDesktopSize&&m(r.setEmailWidth(v.emailPaneDesktopSize))},[m,v.emailPaneDesktopSize]);const jv=()=>{hn(r.BLOCKS),Bn("project")};return(0,l.useEffect)(()=>{i&&jv()},[i]),(0,a.jsx)(r.ElementEntityKindProvider,{kind:Xe,children:(0,a.jsxs)(up,{className:(0,rt.default)("email-pane",{"email-pane_code-mode":Y,"email-pane_only_code_mode_mobile":v.onlyCodeModeInMobile,"email-pane_code-mode-bottom":Y&&pe==="bottom","email-pane_no-element-navigation":!v.switchDesktopMobilePropsEnabled&&!v.stepToOtherElementEnabled&&!v.deleteButtonEnabled,"email-pane_is-mobile":ge,"email-pane_path-enabled":v.pathEnabled}),sidePanelFloating:!!v.sidePanelFloating,isCodeMode:!!Y,codeModeDirection:String(pe),children:[(0,a.jsxs)(wp,{className:"email-pane__container",ref:We,children:[(0,a.jsx)(vp,{isCodeMode:Y,codeModeDirection:pe}),(0,a.jsx)(hp,{isShowMobileSettings:ge,headless:!!P,templateNotEmAlertEnabled:!!v.templateNotEmAlertShow}),(0,a.jsxs)(_.ui_kit$Row,{ref:Be,className:(0,rt.default)("email-pane__row",{"email-pane__left":Y&&pe==="right","email-pane__right":Y&&pe==="left","email-pane__bottom":Y&&pe==="bottom","email-pane__sizeSwitcher":v.desktopMobileSwitchPanel,"email-pane__reverse":v.menuDirection==="left","email-pane__pinch":!v.sidePanelFloating}),children:[(0,a.jsxs)(mp,{isCodeMode:Y,codeModeDirection:pe,sidePanelFloating:v.sidePanelFloating,contentWrapperRef:yv,children:[(0,a.jsx)("div",{className:"email-pane__iframe-scroll-top",id:"iframe-scroll-top"}),v.desktopMobileSwitchPanel&&(0,a.jsxs)(_.ui_kit$Space,{className:"email-pane__sizes-panel-wrapper",orientation:"vertical",size:10,children:[(0,a.jsxs)(_.ui_kit$Space,{className:"email-pane__sizes-panel",size:0,children:[el("panel"),(0,a.jsx)(_.ui_kit$Tooltip,{title:d("Desktop view"),placement:"top",open:jn,children:(0,a.jsx)(_.ui_kit$Button,{type:ge?"text":"primary",icon:(0,a.jsx)(r.EmIcons,{icon:"DesktopOutlined",component:_.icons$DesktopOutlined,size:18,strokeWidth:v.iconStrokeWidth}),shape:"circle",onClick:()=>Zo(v.emailPaneDesktopSize||1e3),className:"toggle_view desktop_view"})}),(0,a.jsx)(_.ui_kit$Tooltip,{title:d("Mobile view"),placement:"top",open:gn,children:(0,a.jsx)(_.ui_kit$Button,{type:ge?"primary":"text",icon:(0,a.jsx)(r.EmIcons,{icon:"MobileOutlined",component:_.icons$MobileOutlined,size:18,strokeWidth:v.iconStrokeWidth}),shape:"circle",onClick:()=>Zo(425),className:"toggle_view mobile_view"})})]}),v.codeSideEnabled&&(0,a.jsx)(_.ui_kit$Tooltip,{title:d("Code mode"),placement:"right",children:(0,a.jsx)(_.ui_kit$Button,{type:Y?"primary":"default",icon:(0,a.jsx)(r.EmIcons,{icon:"Code",component:_.icons$Code}),shape:"circle",onClick:()=>Rv("right")})})]}),(0,a.jsxs)(_.ui_kit$Row,{className:(0,rt.default)("email-pane__col-wrapper",{container:Y&&pe==="bottom"||!Y,"email-pane__col-wrapper_reverse":v.menuDirection==="left","email-pane__col-wrapper_pinch":!v.sidePanelFloating}),style:{flexGrow:1,maxWidth:"unset",paddingTop:v.desktopMobileSwitchPanel&&Y&&pe!=="bottom"?"60px":""},children:[(0,a.jsxs)(_.ui_kit$Col,{className:"email-pane__col email-pane__col_preview",style:{flexGrow:1,maxWidth:"unset"},ref:v.sidePanelFloating?null:Me,children:[v.desktopMobileSwitchRule&&(0,a.jsx)(Cd,{onSelectWidth:Zo,themeToggle:el("rule")}),(0,a.jsxs)(pp,{maxPaneWidth:1200,isCodeMode:Y,codeModeDirection:pe,isShowMobileSettings:ge,desktopMobileSwitchPanel:v.desktopMobileSwitchPanel,children:[(0,a.jsx)("div",{className:"email-pane__handle left",onMouseDown:Za("left"),onMouseEnter:()=>zr("left"),onMouseLeave:zr}),(0,a.jsx)("div",{className:"email-pane__handle right",onMouseDown:Za("right"),onMouseEnter:()=>zr("right"),onMouseLeave:zr}),(0,a.jsx)(gp,{wrapperRef:Se,children:(0,a.jsx)(Pp,{ref:xe,className:"email-pane__iframe",email:e,handlerSendPosition:Mt,clip:hv})})]})]}),(0,a.jsx)(_.ui_kit$Col,{style:{display:Y&&pe!=="bottom"||v.disableSideMenu?"none":"initial"},ref:Vo,onPointerEnter:kp,className:(0,rt.default)("email-pane__content-col email-pane__content-col_menu email-pane__content-col_tabs email-pane__col email-pane__col_settings",{"email-pane__col_disabled":U===r.DISABLED_TAB}),children:(!Y||pe==="bottom")&&J&&(0,a.jsx)(_.ui_kit$Tabs,{className:(0,rt.default)("email-pane__col_settings-inner",{"email-pane__col_settings-inner_reverse":v.menuDirection==="left"}),size:"medium",activeKey:U,onTabClick:Sv,renderTabBar:Sp,tabPlacement:"right",items:Un,tabBarExtraContent:Bt&&(0,a.jsx)("div",{style:{paddingTop:15,textAlign:"center"},children:ue?(0,a.jsx)(_.ui_kit$Switch,{variant:"editorMode",checkedChildren:"Pro",unCheckedChildren:"Pro",onChange:Va,checked:$t}):(0,a.jsx)(_.ui_kit$Switch,{variant:"editorMode",checkedChildren:"Pro",unCheckedChildren:"Pro",onChange:Va,defaultChecked:Nn})})})})]}),(0,a.jsx)("div",{className:"email-pane__iframe-scroll-bottom",id:"iframe-scroll-bottom"})]}),(0,a.jsxs)(fp,{isCodeMode:Y,codeModeDirection:pe,children:[(0,a.jsx)("div",{className:"email-pane__code-divider",onMouseDown:xv}),(0,a.jsx)("div",{className:"code-mode__pane code-mode__pane_editor email-pane__pane email-pane__pane_editor",children:(0,a.jsx)("div",{className:"code-mode__pane-content email-pane__pane-content",children:ie&&(0,a.jsx)(xp,{email:e,setOtherUsers:Ze,readOnly:v.lockEditor,newEmailAiGeneratorRef:fn})})})]})]}),v.pathEnabled&&(0,a.jsxs)("div",{className:"email-pane__paths",children:[(0,a.jsx)(su,{elementPath:Ye}),(0,a.jsx)(lu,{fallbackHtml:e?.html})]}),(0,a.jsx)("div",{className:"collaborator-list",children:(0,a.jsx)(r.CollaboratorList,{users:ze,isEditor:!1,isPlugin:!0,token:N})})]}),(0,a.jsx)(bp,{isCodeMode:Y,codeModeDirection:pe,email:e,onClosePanel:Lt}),(0,a.jsx)(Pu,{}),(0,a.jsx)(r.PlanUpgradePrompt,{open:gt,onCancel:bv,onTrialActivated:Ev,initialSlide:ce}),st&&qe.exceeded?(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(oo,{open:Ne,onClose:je,title:d(st.titleKey),subtitle:d(st.subtitleKey),usageResource:st.usageResource,previousDisplay:r.presetLimitDisplay(qe.exceeded.previousLimit),nextDisplay:r.presetLimitDisplay(qe.exceeded.nextLimit),onChangePlan:Yt})}):null,(0,a.jsx)(cu,{open:ft,onClose:lt}),(0,a.jsx)(uu,{open:G,onClose:V})]})})};us.propTypes={};var Mp=e=>(0,a.jsx)(tp,{children:(0,a.jsx)(op,{children:(0,a.jsx)(lp,{children:(0,a.jsx)(us,{...e})})})}),Np=(0,l.memo)(Mp),Dp=({open:e,onClose:t})=>{const{__:n}=r.useI18n(),o=r.getSupportEmail(),[i,s=""]=n("To send a test email, you need to confirm your email address. If you haven’t received the confirmation link, contact support in the chat or email {supportEmail}.").split("{supportEmail}");return(0,a.jsx)(_.ui_kit$Modal,{width:440,open:e,onCancel:t,title:(0,a.jsxs)("div",{style:{paddingBottom:8},children:[(0,a.jsx)(r.EmIcons,{icon:"EmailConfirmation",component:_.icons$EmailConfirmation,size:20,strokeWidth:2})," ",n("Email confirmation required")]}),footer:[(0,a.jsx)(_.ui_kit$Button,{size:"large",type:"primary",onClick:t,children:n("Got it")},"ok")],children:(0,a.jsxs)("p",{children:[i,(0,a.jsx)("a",{href:`mailto:${o}`,children:o}),s]})})},Qn=e=>{const t=r.useCurrentUser(),[n,o]=(0,l.useState)({owner:!1,admin:!1,user:!1}),i=r.useProjectData(),{data:s}=r.useGetProjectQuery(e,{skip:!e||!t.id||!!i}),c=i||s;return(0,l.useEffect)(()=>{if(c){const d=r.getMyProjectRole(c,t);o({owner:d==="owner",admin:d==="admin",user:d==="user"})}},[c,t]),n},co=r.getLimitUpgradePresetDefinition("preview_exceeded"),ps=({emailElement:e,isCollaborationEditor:t})=>{const{__:n}=r.useI18n(),o=r.useDispatch(),i=Vr(),s=r.useOpenPlanCatalog(),c=r.useSendPostMessage(),{blockId:d}=r.useRouteParams(),u=r.useRouteEmailId(),p=r.useSelector(r.selectActiveModal$1)===r.MODALS.SEND_TEST_EMAIL,f=kn(p),[g,y]=(0,l.useState)(!1),[m,E]=r.useSendLivePreviewMutation(),k=r.useCurrentUser(),w=r.useDocumentHistoryReader(),v=r.useProjectPlanLimitPreflight(),{owner:x}=Qn(),P=Jr(),K=Pd(),J=r.useContentReader(),N=r.useSelector(r.selectIsPanelHistoryCollapsed),L=r.useSelector(r.selectIsCodeMode),A=r.useSelector(r.selectCodeModeDirection),{token:O}=(0,_.ui_kit$useToken)(),z=r.useNotification(),B=r.useAppConfig(),U=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,de=r.useEventEmitter(h.events.ON_SHARE_ID),me=r.useEventEmitter(h.events.ON_SHOW_PREVIEW_ID),[H,Z]=(0,l.useState)(!1),[De,ve]=(0,l.useState)(0),[et,be]=(0,l.useState)(!1),fe=kn(et),Y=(0,l.useCallback)(()=>be(!1),[]),pe=(0,l.useCallback)(()=>{be(!1),s()},[s]),[ie,se]=(0,l.useState)(n("—")),[Ae,Te]=(0,l.useState)(!1),Fe=r.useProjectData(),X=r.usePlanFeatureGate("version_history"),Ee=r.usePlanFeatureGate("code_editor"),Ie=r.usePlanFeatureGate("preview_service"),ge=r.usePlanFeatureGate("undo_redo"),Re=r.isEditorLockedByPlan(Fe,{isPlugin:!0}),Ue=r.usePushToDataLayer(),C=e?.project,T=he=>{const Ge=U==="block"?"block":"email";typeof he=="string"?(i.setDirection(he),!L&&i.toggle()):i.toggle(),Ue({event:"activate",action:"activate_code_mode",entity_type:Ge,entity_id:e?.id||u||d,project_id:e?.project||C}),setTimeout(()=>{o(U==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),Ee.isLocked&&(Z(!0),ve(r.FEATURE_UPSELL_SLIDE.code_editor))},R=(0,l.useCallback)(async()=>!0,[v]),D=async()=>{if(Re){Z(!0),ve(8);return}await R()&&(o(r.openModal$1(r.MODALS.SEND_TEST_EMAIL)),Ue({event:"open",action:"open_test_email_modal",entity_type:U==="block"?"block":"email",entity_id:e?.id||u||d,project_id:e?.project||C}))},I=()=>{Z(!0),ve(r.FEATURE_UPSELL_SLIDE.undo_redo)},S=()=>{P.undo()},ae=()=>{P.redo()},we=async()=>{const he=(await de.fire({project:C,id:u})).find(Ge=>Ge===!1||typeof Ge=="string");he!==!1&&navigator.clipboard.writeText(he||r.buildEmailRawShareUrl(u,C)).then(()=>{z.success(n("A shareable link to this page has been copied to the clipboard.")),Ue({event:"click",action:"share_email",entity_type:U==="block"?"block":"email",entity_id:e?.id||u||d,project_id:e?.project||C})})},Ye=async()=>{if(!g){if(!await R())return;const he={email:u,subject:encodeURIComponent("#"+e.project+" "+e.title).replaceAll(/%20/gi,"+").replaceAll(/%0A/gi,"%0D%0A"),content:encodeURIComponent(J()).replaceAll(/%20/gi,"+").replaceAll(/%0A/gi,"%0D%0A")};m(he),y(!0),Ue({event:"click",action:"open_email_inbox_tests",entity_type:U==="block"?"block":"email",entity_id:e?.id||u||d,project_id:e?.project||C})}},Qe=(0,l.useCallback)(async()=>{await R()&&(se(n("—")),be(!0))},[n,R]);(0,l.useEffect)(()=>{E.isError&&(z.error(E),y(!1))},[E]),(0,l.useEffect)(()=>{if(E.isSuccess&&g){if(E.data?.status===401)z.error({title:E.data.code,description:E.data.message});else if(E.data){let he=document.createElement("A");he.setAttribute("target","_blank"),he.setAttribute("href",E.data.message),he.click()}y(!1)}},[E,g,z]);const[ze,Ze]=(0,l.useState)(!1),pt=()=>{c({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:N}),o(r.switchIsPanelHistoryCollapsed(!N))},bt=()=>w(e?.id),ft=()=>{N?(Ze(!0),bt().then(he=>{he.isSuccess?he.data.data.length:he.isError&&z.error(he),pt(),o(r.setActiveSettingsTab(r.HISTORY)),Ze(!1),Ue({event:"open",action:"open_version_control",entity_type:U==="block"?"block":"email",entity_id:e?.id||u||d,project_id:e?.project||C}),X.isLocked&&(Z(!0),ve(r.FEATURE_UPSELL_SLIDE.version_history))})):(o(r.resetToLastActiveSettingsTab()),pt())},lt=()=>{N||(pt(),o(r.resetToLastActiveSettingsTab())),L&&i.toggle(),Z(!1)};let G=[];const V=(0,l.useCallback)(async()=>{const he=await me.fire({project:C,id:u});he.find(Ge=>Ge===!1||typeof Ge=="string")!==!1&&(window.open(he.find(Ge=>Ge)||r.buildEmailRawSharePath(u,C)),Ue({event:"click",action:"open_email_preview",entity_type:U==="block"?"block":"email",entity_id:e?.id||u||d,project_id:e?.project||C}))},[me,C,u,Ue,U,e,d]),te=(0,l.useCallback)(async()=>{window.open(r.buildGetElementPreviewPath(r.EMAIL,u,C)),Ue({event:"click",action:"open_web_version",entity_type:U==="block"?"block":"email",entity_id:e?.id||u||d,project_id:e?.project||C})},[C,u,Ue,U,e,d]);B.previewModeEnabled&&G.push({key:"Preview_mode",icon:(0,a.jsx)(r.EmIcons,{icon:"EyeOutlined",component:_.icons$EyeOutlined,size:18,strokeWidth:B.iconStrokeWidth}),label:n("Preview mode"),onClick:V}),B.livePreviewEnabled&&G.push({key:"Live_preview",icon:g?(0,a.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:_.icons$LoadingOutlined,style:{fontSize:16}}):(0,a.jsx)(r.EmIcons,{icon:"CheckCircleVerified",component:_.icons$CheckCircleVerified,size:18,strokeWidth:B.iconStrokeWidth}),label:n("Live preview"),onClick:k.id?.toString()===e.project_author?.toString()&&k?.subscription?.post_name==="community"&&x?Qe:Ye}),B.webversionEnabled&&G.push({key:"Web version",icon:(0,a.jsx)(r.EmIcons,{icon:"Web",component:_.icons$Web,size:18,strokeWidth:B.iconStrokeWidth}),label:n("Web version"),onClick:te}),B.sharePreviewEnabled&&G.push({key:"Share",icon:(0,a.jsx)(r.EmIcons,{icon:"ShareAltOutlined",component:_.icons$ShareAltOutlined,size:18,strokeWidth:B.iconStrokeWidth}),label:n("Share"),onClick:we,className:"em-analytics__email-share"});const ue=[{key:"Left_mode",icon:(0,a.jsx)(r.EmIcons,{icon:"PanelLeft",component:_.icons$PanelLeft,size:18,strokeWidth:B.iconStrokeWidth,style:{color:A==="left"&&L?O.colorPrimary:"inherit"}}),label:n("Left Code panel"),onClick:()=>T("left")},{key:"Right_mode",icon:(0,a.jsx)(r.EmIcons,{icon:"PanelLeft",component:_.icons$PanelLeft,size:18,strokeWidth:B.iconStrokeWidth,style:{transform:"rotate(180deg)",color:A==="right"&&L?O.colorPrimary:"inherit"}}),label:n("Right Code panel"),onClick:()=>T("right")},{key:"Bottom_mode",icon:(0,a.jsx)(r.EmIcons,{icon:"PanelLeft",component:_.icons$PanelLeft,size:18,strokeWidth:B.iconStrokeWidth,style:{transform:"rotate(-90deg)",color:A==="bottom"&&L?O.colorPrimary:"inherit"}}),label:n("Bottom Code panel"),onClick:()=>T("bottom")}];return(0,a.jsxs)("div",{className:"email-preview-menu email-preview-menu_new",children:[(0,a.jsxs)(_.ui_kit$Space,{size:32,children:[(0,a.jsxs)(_.ui_kit$Space,{className:"email-preview-menu__versions",size:8,style:{borderRadius:`calc(${r.emCssVar("borderRadius")} * 1px)`},children:[(0,a.jsx)(_.ui_kit$Tooltip,{title:n(t?r.COLLABORATION_EDITOR_WARNING_TEXT:"Undo (Ctrl+Z)"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:"text",icon:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.EmIcons,{icon:"UndoOutlined",component:_.icons$UndoOutlined,size:22,strokeWidth:B.iconStrokeWidth}),ge.isLocked&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:B.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:ge.isLocked?I:S,disabled:!ge.isLocked&&!K.canUndo})}),(0,a.jsx)(_.ui_kit$Tooltip,{title:n(t?r.COLLABORATION_EDITOR_WARNING_TEXT:"Redo (Ctrl+Shift+Z)"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:"text",icon:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.EmIcons,{icon:"RedoOutlined",component:_.icons$RedoOutlined,size:22,strokeWidth:B.iconStrokeWidth}),ge.isLocked&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:B.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:ge.isLocked?I:ae,disabled:!ge.isLocked&&!K.canRedo})}),B.historyEnabled&&(0,a.jsx)(_.ui_kit$Tooltip,{title:n("Version history"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:N?"text":"primary",ghost:!N,onClick:ft,disabled:e.isNew||ze,className:"email-preview-menu__history",icon:ze?(0,a.jsx)(_.ui_kit$Spin,{size:"small"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.EmIcons,{icon:"HistoryOutlined",component:_.icons$HistoryOutlined,size:22,strokeWidth:B.iconStrokeWidth,className:"email-preview-menu__list-item-icon email-preview-menu__list-item-icon_revert"}),X.isLocked&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:B.iconStrokeWidth,className:"free-mode-firewall-icon"})]})})})]}),(0,a.jsxs)(_.ui_kit$Space,{size:8,style:{borderRadius:`calc(${r.emCssVar("borderRadius")} * 1px)`},children:[B.codeEnabled&&(0,a.jsx)(_.ui_kit$Dropdown,{arrow:!0,placement:"bottom",menu:{items:ue},trigger:"hover",mouseEnterDelay:0,className:"email-preview-menu__code",children:(0,a.jsx)(_.ui_kit$Button,{type:L?"primary":"text",ghost:L,icon:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.EmIcons,{icon:"Code",component:_.icons$Code,size:22,strokeWidth:B.iconStrokeWidth}),Ee.isLocked&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:B.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:T})},"Code mode"),B.previewIconEnabled&&(Ie.isLocked?(0,a.jsx)(_.ui_kit$Tooltip,{title:n("Preview mode"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:"text",icon:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.EmIcons,{icon:"EyeOutlined",component:_.icons$EyeOutlined,size:22,strokeWidth:B.iconStrokeWidth,className:"email-preview-menu__list-item-icon"}),(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:B.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:()=>{Z(!0),ve(r.FEATURE_UPSELL_SLIDE.preview_service)}})}):(0,a.jsx)(_.ui_kit$Dropdown,{arrow:!0,placement:"bottom",menu:{items:G},className:"email-preview-menu__preview",children:(0,a.jsx)(_.ui_kit$Button,{type:"text",target:"_blank",rel:"noreferrer",icon:(0,a.jsx)(r.EmIcons,{icon:"EyeOutlined",component:_.icons$EyeOutlined,size:22,strokeWidth:B.iconStrokeWidth,className:"email-preview-menu__list-item-icon"}),onClick:B.previewModeEnabled?V:void 0})},"Preview")),B.sendTestEnabled&&(0,a.jsx)(_.ui_kit$Tooltip,{title:n("Send a test email"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{className:"em-analytics__email-open-test email-preview-menu__test",type:"text",icon:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.EmIcons,{icon:"SendOutlined",component:_.icons$SendOutlined,size:22,strokeWidth:B.iconStrokeWidth,className:"email-preview-menu__list-item-icon"}),Re&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:B.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:D})})]})]}),f&&(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(Iu,{isModalVisible:p,email:e})}),(0,a.jsx)(Dp,{open:Ae,onClose:()=>Te(!1)}),(0,a.jsx)(r.PlanUpgradePrompt,{open:H,onCancel:lt,initialSlide:De}),fe&&(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(oo,{open:et,onClose:Y,title:n(co.titleKey),subtitle:n(co.subtitleKey),usageResource:co.usageResource,previousDisplay:ie,nextDisplay:r.presetLimitDisplay("infinity"),onChangePlan:pe})})]})};ps.propTypes={};var Fp=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],Bp=200;function ms(e=new Set){const t=new Set;return(n,o)=>{if(!Fp.some(([s,c])=>!e.has(s)&&c.test(n)))return;const i=o??`new:${n.length}:${n.slice(0,200)}`;t.has(i)||(t.size>=Bp&&t.clear(),t.add(i))}}function fs(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:ms()}}var $p=fs();function on(e){return e?.getInstance(h.TEMPLATE_DIRECTIVES_ID)??$p}function Up({html:e,renderGuid:t,showToken:n,showId:o,...i},s){const{requested:c}=r.getCurrentProject(s),d=r.getAppConfig(s);return r.filterUndefined({...i,code:on(s).toOutputForm(e),project:c===void 0?i.project:c,utm_parameters:d.UTMEnabled?i.utm_parameters:void 0,tags:void 0,template:void 0,guid:void 0,emailtags:void 0,project_title:void 0,project_author:void 0,is_template:void 0,is_inited:void 0})}var zp=zt.__commonJSMin(((e,t)=>{r.init__polyfill_node_global(),(function(n,o){typeof define=="function"&&define.amd?define([],o):typeof e<"u"?o():(o(),n.FileSaver={})})(e,function(){"use strict";function n(p,f){return typeof f>"u"?f={autoBom:!1}:typeof f!="object"&&(f={autoBom:!f}),f.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(p.type)?new Blob(["\uFEFF",p],{type:p.type}):p}function o(p,f,g){var y=new XMLHttpRequest;y.open("GET",p),y.responseType="blob",y.onload=function(){u(y.response,f,g)},y.onerror=function(){},y.send()}function i(p){var f=new XMLHttpRequest;f.open("HEAD",p,!1);try{f.send()}catch{}return 200<=f.status&&299>=f.status}function s(p){try{p.dispatchEvent(new MouseEvent("click"))}catch{var f=document.createEvent("MouseEvents");f.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),p.dispatchEvent(f)}}var c=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof r._polyfill_node_global_default=="object"&&r._polyfill_node_global_default.global===r._polyfill_node_global_default?r._polyfill_node_global_default:void 0,d=c.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),u=c.saveAs||(typeof window!="object"||window!==c?function(){}:"download"in HTMLAnchorElement.prototype&&!d?function(p,f,g){var y=c.URL||c.webkitURL,m=document.createElement("a");f=f||p.name||"download",m.download=f,m.rel="noopener",typeof p=="string"?(m.href=p,m.origin===location.origin?s(m):i(m.href)?o(p,f,g):s(m,m.target="_blank")):(m.href=y.createObjectURL(p),setTimeout(function(){y.revokeObjectURL(m.href)},4e4),setTimeout(function(){s(m)},0))}:"msSaveOrOpenBlob"in navigator?function(p,f,g){if(f=f||p.name||"download",typeof p!="string")navigator.msSaveOrOpenBlob(n(p,g),f);else if(i(p))o(p,f,g);else{var y=document.createElement("a");y.href=p,y.target="_blank",setTimeout(function(){s(y)})}}:function(p,f,g,y){if(y=y||open("","_blank"),y&&(y.document.title=y.document.body.innerText="downloading..."),typeof p=="string")return o(p,f,g);var m=p.type==="application/octet-stream",E=/constructor/i.test(c.HTMLElement)||c.safari,k=/CriOS\/[\d]+/.test(navigator.userAgent);if((k||m&&E||d)&&typeof FileReader<"u"){var w=new FileReader;w.onloadend=function(){var P=w.result;P=k?P:P.replace(/^data:[^;]*;/,"data:attachment/file;"),y?y.location.href=P:location=P,y=null},w.readAsDataURL(p)}else{var v=c.URL||c.webkitURL,x=v.createObjectURL(p);y?y.location=x:location.href=x,y=null,setTimeout(function(){v.revokeObjectURL(x)},4e4)}});c.saveAs=u.saveAs=u,typeof t<"u"&&(t.exports=u)})})),sn=zp(),In="NEXT_BUTTON",uo="SAVE_BUTTON",po="KEYBOARD",Gp="EXTERNAL",Wp=new Set([uo,In,po]);function Hp(e){return e!=null&&e!==""&&Wp.has(e)}function gs(e){if(!e||e==="all")return;const t=Number(e);return Number.isFinite(t)?[t]:void 0}var hs=(0,l.createContext)(null);function qp(){const e=(0,l.useContext)(hs);if(!e)throw new Error("useEmailSaveController must be used within EmailSaveContext.Provider");return e}var Vp=2;function Kp({email:e,documentSession:t,save:n,saveState:o}){const i=r.useDispatch(),{__:s}=r.useI18n(),c=r.useEditorProjectId();r.useRouteEmailId();const d=+c,u=Number.isFinite(d)&&d>0?d:e?.project,p=r.useCookieManager(),f=r.useContainer(),g=r.useNotification(),y=r.useAppConfig(),m=r.useConfigSource(),[E,k]=(0,l.useState)(0),w=(0,l.useRef)(""),[v,x]=(0,l.useState)(!1),P=r.useEventEmitter(h.events.ON_NEXTBUTTON_CLICK_ID),K=r.useEventEmitter(h.events.ON_SAVEBUTTON_CLICK_ID);r.useEvent(h.events.ON_EMAIL_INIT_ID);const J=y.activeNextButton===!1,N=y.disableDoubleClickNextButton!==!1,L=(0,l.useRef)(!1),A=(0,l.useRef)(void 0),O=(0,l.useRef)(null),z=(0,l.useRef)(null),B=(0,l.useRef)(e);B.current=e;const U=(0,l.useCallback)(()=>{A.current=void 0},[]),de=(0,l.useCallback)(X=>{m.merge({activeNextButton:!X},"user")},[m]),me=(0,l.useCallback)((X,Ee)=>{const Ie=r.saveRefusalReason(Ee);if(Ie==="locked"){g.error({id:"EMAIL_ACCESS_TO_LOCKED_ERROR",data:r.getEmailDesc(X),message:s("No access to edit the letter.")});return}if(Ie==="too-many-tags"){g.error({id:"EMAIL_TOO_MANY_TAGS_ERROR",data:r.getEmailDesc(X),message:s("Maximum 10 tags available.")});return}const ge=r.failedTerms(Ee);if(ge){ge.failed.forEach(Re=>{if(ge.kind==="group"){g.fromError("GROUP_CREATING_ERROR",{id:Re.id??0,name:Re.name,parent:Re.parent??0},Ee);return}g.fromError("TAG_CREATING_ERROR",Re.name,Ee)});return}g.fromError(X.isNew?"EMAIL_CREATING_ERROR":"EMAIL_EDITING_ERROR",r.getEmailDesc(X),Ee)},[g,s]),H=(0,l.useCallback)(X=>{const Ee=Hp(X),Ie=()=>{x(!1),X===In&&(L.current=!1,de(!1))};if(!e){Ie();return}const ge=async()=>{(Ue=>{n("publish",{project:Ue.isNew?u:Ue.project,folder:gs(p.get(r.APP_COOKIES.em_folder)),source:X}).then(C=>{if(x(!1),L.current=!1,!C){X===In&&de(!1),Ee&&(me(Ue,o().error),U());return}Ee&&(g.success({id:"EMAIL_SAVING_SUCCESS",message:s("The email was successfully saved."),data:r.getEmailDesc(Ue)}),U())})})(e)};x(!0),ge()},[e,i,c,s,t,p,u,g,me,n,o,de,U]);r.useCommand(r.SAVE_COMMAND_ID,(0,l.useCallback)(X=>H(X||Gp),[H]));const Z=(0,l.useRef)(void 0),De=(0,l.useRef)(H);De.current=H;const ve=(0,l.useCallback)(X=>{w.current=X,k(Ee=>Ee+1)},[]);(0,l.useEffect)(()=>()=>{Z.current!==void 0&&clearTimeout(Z.current)},[]),(0,l.useEffect)(()=>{if(E===0)return;const X=w.current;B.current?.isNew&&(A.current=X),Z.current!==void 0&&clearTimeout(Z.current),Z.current=setTimeout(()=>{Z.current=void 0,De.current(X)})},[E]);const et=(0,l.useCallback)(X=>{(X.ctrlKey||X.metaKey)&&X.keyCode===83&&(X.preventDefault(),ve(po))},[ve]);(0,l.useEffect)(()=>(document.addEventListener("keydown",et),()=>{document.removeEventListener("keydown",et)}),[et]);const be=(0,l.useCallback)(X=>{const Ee=X.data.operation,Ie=X.data.action;Ee===r.EVENT_TYPES.APPLICATION_ACTION&&Ie==="save_email"&&ve(po)},[ve]);r.useListenPostMessage(be),(0,l.useEffect)(()=>{e?.isNew&&(z.current=null,O.current=null)},[e?.isNew,e?.renderGuid]),(0,l.useEffect)(()=>{L.current=!1},[e?.id]);const fe=p.get(r.APP_COOKIES.em_folder),Y=f?r.provideAutosaveUiFacts(f):void 0;(0,l.useEffect)(()=>{Y?.set({...Y?.get()??{isUserBusy:!1,saveContext:{}},saveContext:{project:u,folder:gs(fe)}})},[Y,u,fe]);const pe=(0,l.useRef)(!1),ie=o().failures;(0,l.useEffect)(()=>{ie>=Vp&&!pe.current&&(pe.current=!0,g.warning({message:s("Changes are not being saved. Check your connection.")})),ie===0&&(pe.current=!1)},[ie,g,s]);const se=v,Ae=o().saving,Te=(0,l.useCallback)(X=>{ve(X||uo)},[ve]),Fe=(0,l.useCallback)(async(X,Ee)=>{if(X===In){if(L.current)return;L.current=!0;try{N&&de(!0),(await P.fire(Ee)).every(Ie=>Ie!==!1)?ve(In):(de(!1),L.current=!1)}catch(Ie){g.fromError("NEXT_BUTTON_CLICK_EVENT_ERROR",r.getEmailDesc(Ee),Ie,!0),de(!1),L.current=!1}return}try{(await K.fire(Ee)).every(Ie=>Ie!==!1)&&ve(X||uo)}catch(Ie){g.fromError("SAVE_BUTTON_CLICK_EVENT_ERROR",r.getEmailDesc(Ee),Ie,!0)}},[N,P,K,g,de,ve]);return(0,l.useMemo)(()=>({requestSave:Te,requestSaveWithEvents:Fe,isLoading:se,isAutosaveLoading:Ae,nextButtonDisabled:J}),[Te,Fe,se,Ae,J])}var Yp="NEXT_BUTTON",Qp="SAVE_BUTTON",_s=({email:e=null,disabled:t})=>{const{__:n}=r.useI18n(),o=r.useAppConfig(),i=r.useContentReader(),s=r.useNotification(),{requestSaveWithEvents:c,isLoading:d,isAutosaveLoading:u,nextButtonDisabled:p}=qp(),f=d||u,[g,y]=(0,l.useState)(null);(0,l.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&y(!0)},[]);const m=o.saveButtonEnabled&&(0,a.jsx)(_.ui_kit$Tooltip,{title:n(g?"Save by ⌘S":"Save by Ctrl+S"),placement:"bottom",children:(0,a.jsx)("span",{className:"em-analytics__email-save-tooltip-target",children:(0,a.jsx)(_.ui_kit$Button,{disabled:t||u,type:o.nextButtonEnabled?"default":"primary",block:"false",className:"em-analytics__email-save",loading:f,icon:(0,a.jsx)(r.EmIcons,{icon:"SaveOutlined",component:_.icons$SaveOutlined,size:16,strokeWidth:o.iconStrokeWidth}),onClick:async k=>{const w=k.currentTarget,v={...e,html:i()};try{await c(Qp,v)}catch(x){s.fromError("SAVE_BUTTON_CLICK_EVENT_ERROR",r.getEmailDesc(v),x,!0)}finally{try{w?.blur?.()}catch{}}},children:o.saveButtonText||n("Save")})})},"save-button"),E=o.nextButtonEnabled&&(0,a.jsx)(_.ui_kit$Button,{disabled:t||p,type:"primary",block:"false",className:"em-analytics__email-save",icon:o.primaryCommandButtonIcon,loading:d,onClick:async()=>{const k={...e,html:i()};await c(Yp,k)},children:o.nextButtonText||n("Continue")},"next-button");return(0,a.jsx)(a.Fragment,{children:o.saveButtonEnabled&&o.nextButtonEnabled?(0,a.jsx)(_.ui_kit$Space,{children:[m,E]}):[m,E]})};_s.propTypes={email:$e.default.shape({id:$e.default.string,isNew:$e.default.bool,title:$e.default.string,lock:$e.default.bool,subject:$e.default.string,html:$e.default.string,description:$e.default.string,utm_parameters:$e.default.shape({utm_source:$e.default.string,utm_medium:$e.default.string,utm_campaign:$e.default.string,utm_term:$e.default.string,utm_content:$e.default.string}),project:$e.default.number,is_template:$e.default.bool}),disabled:$e.default.bool};var ys=({element:e,context:t="list"})=>{const{__:n,_x:o}=r.useI18n(),[i]=r.useEditEmailMutation(),[s]=r.useEditBlockMutation(),c=r.useNotification(),d=r.usePushToDataLayer();e.hasOwnProperty("type");const u=(f,g)=>{if(f.error)return c.error(f),!1;c.success(n("The ")+(g.hasOwnProperty("type")?n("block"):o("email","letter"))+" "+n("“")+f.data.title+n("”")+n("was successfully")+" "+(g.lock?g.hasOwnProperty("type")?o("unlocked.","block"):o("unlocked.","email"):g.hasOwnProperty("type")?o("locked.","block"):o("locked.","email")))},p=()=>{const f=!e.lock,g=f?"lock_email":"unlock_email";e.hasOwnProperty("type")?s({blockId:e.id,lock:f}).then(y=>{u(y,e),y.error||d({event:f?"lock":"unlock",action:f?"lock_block":"unlock_block",entity_type:"block",entity_id:e.id,project_id:e.project,context:t})}):i({emailId:e.id,lock:f}).then(y=>{u(y,e),y.error||d({event:f?"lock":"unlock",action:g,entity_type:"email",entity_id:e.id,project_id:e.project,context:t})})};return(0,a.jsx)("div",{className:e.hasOwnProperty("type")?"em-analytics__block-lock":"em-analytics__email-lock",onClick:p,children:e.lock?n("Unlock"):n("Lock")})};ys.propTypes={element:$e.default.shape({lock:$e.default.bool,id:$e.default.string})};var Xp=({open:e,codeSize:t,onMinimize:n,onDownloadAsIs:o,onCancel:i})=>{const{__:s}=r.useI18n(),c=r.formatCodeSize(t);return(0,a.jsx)(_.ui_kit$Modal,{open:e,onCancel:i,footer:null,className:"code-size-warning-modal",width:480,children:(0,a.jsxs)("div",{className:"code-size-warning-modal__content",children:[(0,a.jsx)("h3",{className:"code-size-warning-modal__title",children:s("Code Size Warning")}),(0,a.jsxs)("div",{className:"code-size-warning-modal__message",children:[(0,a.jsxs)("p",{children:[s("The current code size is")," ",(0,a.jsx)("strong",{children:c}),","," ",s("which exceeds the recommended 90 KB limit.")]}),(0,a.jsx)("p",{children:s("Large emails may have delivery issues and load slowly. We recommend minimizing code before exporting.")})]}),(0,a.jsxs)(_.ui_kit$Space,{className:"code-size-warning-modal__actions",size:"medium",children:[(0,a.jsx)(_.ui_kit$Button,{type:"primary",onClick:n,size:"large",children:s("Minimize code")}),(0,a.jsx)(_.ui_kit$Button,{onClick:o,size:"large",children:s("Download as is")})]})]})})};function Jp(e){return e.includes("em-narrow-table")}function Zp(e){if(!e||Jp(e))return!1;const t=e.includes("nl-container"),n=/row-content\s+stack/.test(e)||/stack\s+row-content/.test(e),o=/\brow-\d/.test(e),i=/_block\s+block-\d/.test(e),s=e.includes('role="presentation"');return t&&n&&(o||i)&&s}function em(e){return e?e.includes("em-narrow-table"):!1}function tm(e){return e.includes("em-narrow-table")}function nm(e){return e.includes("i-amphtml")||e.includes("amp-runtime")||e.includes("amp-version")}function rm(e){if(!e||tm(e)||nm(e))return!1;const t=e.includes("es-wrapper"),n=/es-(?:header|content|footer)-body/.test(e);return t||n}function vs(){r.useAppConfig();const e=r.useIntegratorConfigValue("beeFreeConverterEnabled"),t=r.useIntegratorConfigValue("stripoConverterEnabled"),n=r.useIntegratorConfigValue("aiLayoutConverterEnabled"),o=e===!0,i=t===!0,s=n===!0;return{beeFreeConverterEnabled:o,stripoConverterEnabled:i,aiLayoutConverterEnabled:s,anyConverterEnabled:o||i||s}}function bs(e,t){return!e||em(e)?null:Zp(e)?t.beeFreeConverterEnabled?"beefree":null:rm(e)?t.stripoConverterEnabled?"stripo":null:t.aiLayoutConverterEnabled?"ai":null}var om=()=>"useblocks",im={unisender:{id:"unisender",name:"Unisender",icon:"/images/integrations/unisender.svg",description:"Export emails to Unisender",cardDescription:"Mass mailing automation, audience segmentation, and campaign performance analytics.",apps:["emailmaker"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter Unisender API key",helpUrl:"https://app.unisender.com/ru/v5/cp/user/info/api"},{name:"sender_email",type:"email",label:"Sender Email",required:!0,placeholder:"sender@example.com",extra:"This email must be verified in Unisender"},{name:"sender_name",type:"text",label:"Sender Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"list_id",type:"number",label:"Contact List ID",required:!0,placeholder:"e.g., 123456"}]},mailganer:{id:"mailganer",name:"Mailganer",icon:"/images/integrations/mailganer.svg",description:"Export emails to Mailganer",cardDescription:"Contact sync, content personalization, and real-time campaign results tracking.",apps:["emailmaker"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter Mailganer API key",helpUrl:"https://mailganer.com/app/profile/"},{name:"from_email",type:"email",label:"Sender Email",required:!1,placeholder:"sender@example.com",extra:"This email must be verified in Mailganer"},{name:"from_name",type:"text",label:"Sender Name",required:!1,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Mailing Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"theme",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},sendsay:{id:"sendsay",name:"Sendsay",icon:"/images/integrations/sendsay.svg",description:"Export emails to Sendsay",cardDescription:"Mailing automation, audience segmentation, and email personalization.",apps:["emailmaker"],settingsFields:[{name:"login",type:"text",label:"Account Login",required:!0,placeholder:"e.g., myaccount or myaccount/sublogin",extra:"Your Sendsay account login (not email). For sublogin use format: account/sublogin",fullWidth:!0},{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter Sendsay API key",helpUrl:"https://docs.sendsay.ru/sendsay-api/how-to-get-apikey"},{name:"from_email",type:"email",label:"Sender Email",required:!1,placeholder:"sender@example.com",extra:"This email must be verified in Sendsay"},{name:"from_name",type:"text",label:"Sender Name",required:!1,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Draft Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!0,placeholder:"e.g., Special offer for you!"}]},klaviyo:{id:"klaviyo",name:"Klaviyo",icon:"/images/integrations/klaviyo.svg",description:"Export emails to Klaviyo",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"e.g., pk_xxxxxxxx",helpUrl:"https://help.klaviyo.com/hc/en-us/articles/7423954176283-How-to-create-a-private-API-key",extra:"Use a custom key with templates:write and campaigns:write (or Full access). Campaigns-only is not enough — export creates a template first."},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"This email must be verified in Klaviyo"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"list_id",type:"text",label:"List ID",required:!0,placeholder:"e.g., ABC123",helpText:"Find your List ID in Klaviyo: Lists & Segments → List → Settings"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},campaign_monitor:{id:"campaign_monitor",name:"Campaign Monitor",icon:"/images/integrations/campaign_monitor.svg",description:"Export emails to Campaign Monitor",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter API Key",fullWidth:!0,helpUrl:"https://help.campaignmonitor.com/s/article/api-keys"},{name:"client_id",type:"text",label:"Client ID",required:!0,placeholder:"e.g., 4a397ccaaa55eb4e6aa1221e1e2d7122",helpText:"Find in Account Settings → API Keys"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be verified in Campaign Monitor"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"list_id",type:"text",label:"List ID",required:!0,placeholder:"e.g., a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",helpText:"Find in Lists → List ID"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},constant_contact:{id:"constant_contact",name:"Constant Contact",icon:"/images/integrations/constant_contact.svg",description:"Export emails to Constant Contact",apps:["useblocks"],settingsFields:[{name:"access_token",type:"password",label:"Access Token",required:!0,placeholder:"OAuth2 Bearer token",fullWidth:!0,helpText:"Get from Constant Contact Developer Portal. Token expires in 24 hours.",helpUrl:"https://developer.constantcontact.com/api_guide/getting_started.html"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be confirmed in Constant Contact"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"list_id",type:"text",label:"Contact List ID",required:!0,placeholder:"e.g., fa32f620-6d82-11e8-8b59-fa163e56c9b0",helpText:"Find via GET /contact_lists API"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},bento:{id:"bento",name:"Bento",icon:"/images/integrations/bento.svg",description:"Export emails to Bento",apps:["useblocks"],settingsFields:[{name:"publishable_key",type:"password",label:"Publishable Key",required:!0,placeholder:"Enter Publishable Key",fullWidth:!0,helpUrl:"https://app.bentonow.com/account/teams"},{name:"secret_key",type:"password",label:"Secret Key",required:!0,placeholder:"Enter Secret Key",fullWidth:!0},{name:"site_uuid",type:"text",label:"Site UUID",required:!0,placeholder:"Your site UUID",helpText:"Find in Bento dashboard"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be an author in your Bento account"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Broadcast Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"},{name:"inclusive_tags",type:"text",label:"Tags (inclusive)",required:!1,placeholder:"e.g., subscribers,newsletter",helpText:"Comma-separated tags to send to. Default: subscribers"}]},dotdigital:{id:"dotdigital",name:"Dotdigital",icon:"/images/integrations/dotdigital.svg",description:"Export emails to Dotdigital",apps:["useblocks"],settingsFields:[{name:"username",type:"text",label:"API Username",required:!0,placeholder:"API user email",helpText:"API user email from Settings → Access → API users",helpUrl:"https://developer.dotdigital.com/docs/setting-up-an-api-user"},{name:"password",type:"password",label:"API Password",required:!0,placeholder:"API user password",fullWidth:!0},{name:"region",type:"text",label:"Region",required:!0,placeholder:"r1, r2, or r3",helpText:"r1=Europe, r2=North America, r3=Asia Pacific"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",fullWidth:!0,extra:"Use an email registered as a Custom from address in Dotdigital (see support.dotdigital.com — “Create a custom from address”). If it does not match, export uses your account default sender."},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},getresponse:{id:"getresponse",name:"GetResponse",icon:"/images/integrations/getresponse.svg",description:"Export emails to GetResponse",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter API Key",fullWidth:!0,helpUrl:"https://app.getresponse.com/api"},{name:"from_field_id",type:"text",label:"From Field ID",required:!0,placeholder:"e.g., V",helpText:"Find via GET /from-fields API"}],exportFields:[{name:"name",type:"text",label:"Newsletter Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"campaign_id",type:"text",label:"Campaign ID",required:!0,placeholder:"e.g., C",helpText:"List/campaign ID from GET /campaigns"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},brevo:{id:"brevo",name:"Brevo",icon:"/images/integrations/brevo.svg",description:"Export emails to Brevo",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter API Key",fullWidth:!0,helpUrl:"https://help.brevo.com/hc/en-us/articles/209467485-Create-and-manage-your-API-keys"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be verified in Brevo"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"list_id",type:"number",label:"List ID",required:!0,placeholder:"e.g., 2",helpText:"Find in Contacts → Lists"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},activecampaign:{id:"activecampaign",name:"ActiveCampaign",icon:"/images/integrations/activecampaign.svg",description:"Export emails as draft campaigns to ActiveCampaign",apps:["useblocks"],settingsFields:[{name:"api_url",type:"text",label:"API URL",required:!0,placeholder:"e.g., https://youraccount.api-us1.com",helpText:"Find in Settings → Developer → API Access",helpUrl:"https://help.activecampaign.com/hc/en-us/articles/207317590-Getting-started-with-the-API"},{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter API Key",fullWidth:!0},{name:"list_id",type:"text",label:"List ID",required:!0,placeholder:"e.g., 1",extra:"Find in Lists → Click your list → The ID is in the URL (e.g., /app/contacts?listid=1)"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be verified in ActiveCampaign"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},salesforce_mc:{id:"salesforce_mc",name:"Salesforce",icon:"/images/integrations/salesforce.svg",description:"Export emails to Salesforce",apps:["useblocks"],settingsFields:[{name:"subdomain",type:"text",label:"Tenant Subdomain",required:!0,placeholder:"e.g., mc563885gzs27c5t9-63k636ttgm",helpText:"Find in Installed Packages → API Integration → REST Base URI",helpUrl:"https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/your-subdomain-tenant-specific-endpoints.html"},{name:"client_id",type:"text",label:"Client ID",required:!0,placeholder:"From Installed Package"},{name:"client_secret",type:"password",label:"Client Secret",required:!0,placeholder:"From Installed Package"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be verified in Marketing Cloud"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Email Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},hubspot:{id:"hubspot",name:"HubSpot Email",icon:"/images/integrations/hubspot.svg",description:"Export emails to HubSpot",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"Private App Access Token",required:!0,placeholder:"e.g., pat-na1-xxxx",helpUrl:"https://developers.hubspot.com/docs/api/private-apps"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"This email must be verified in HubSpot"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Email Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},mailchimp:{id:"mailchimp",name:"Mailchimp",icon:"/images/integrations/mailchimp.svg",description:"Export emails to Mailchimp",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"e.g., xxxxxxxx-us1",helpUrl:"https://mailchimp.com/help/about-api-keys/"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"This email must be verified in Mailchimp"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"list_id",type:"text",label:"Audience ID",required:!0,placeholder:"e.g., a1b2c3d4e5",helpText:"Find your Audience ID in Audience settings → Audience name and defaults"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},enkod:{id:"enkod",name:"enKod",icon:"/images/integrations/enkod.svg",description:"Export emails to enKod",cardDescription:"Multi-channel campaigns automation (email, SMS, push, WhatsApp, and more).",apps:["emailmaker"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter enKod API key",helpUrl:"https://help.enkod.io/doku.php/api:start"},{name:"sender_email",type:"email",label:"Sender Email",required:!0,placeholder:"sender@example.com"},{name:"sender_name",type:"text",label:"Sender Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"subject",type:"text",label:"Email Subject",required:!0,placeholder:"e.g., Special offer for you!"}]}},sm=(e,t)=>!e.apps||e.apps.length===0?!0:e.apps.includes(t),mo=e=>{const t=im[e];if(t&&sm(t,om()))return t},am=(e,t)=>{const n={placeholder:e.placeholder?t(e.placeholder):void 0,style:{width:"100%"}};switch(e.type){case"number":return(0,a.jsx)(_.ui_kit$InputNumber,{...n,min:1});case"email":return(0,a.jsx)(_.ui_kit$Input,{...n,type:"email"});default:return(0,a.jsx)(_.ui_kit$Input,{...n})}},lm=({integration:e,visible:t,loading:n=!1,onConfirm:o,onCancel:i,__:s})=>{const[c]=_.ui_kit$Form.useForm(),d=e.exportFields||[];(0,l.useEffect)(()=>{t||c.resetFields()},[t,c]);const u=()=>{n||c.validateFields().then(g=>{o(g)})},p=()=>{c.resetFields(),i()};if(d.length===0)return null;const f=d.find(g=>g.helpText);return(0,a.jsxs)(_.ui_kit$Modal,{title:s(`Export to ${e.name}`),open:t,onOk:u,onCancel:p,okText:s("Export"),cancelText:s("Cancel"),confirmLoading:n,cancelButtonProps:{disabled:n},children:[f&&(0,a.jsx)(_.ui_kit$Alert,{title:s(f.label),description:s(f.helpText),type:"info",showIcon:!0,style:{marginBottom:16}}),(0,a.jsx)(_.ui_kit$Form,{form:c,layout:"vertical",children:d.map(g=>(0,a.jsx)(_.ui_kit$Form.Item,{label:s(g.label),name:g.name,rules:[...g.required?[{required:!0,message:s(`Please enter ${g.label.toLowerCase()}`)}]:[],...g.type==="number"?[{type:"number",message:s(`${g.label} must be a number`)}]:[]],children:am(g,s)},g.name))})]})},Xn=r.createApi({reducerPath:"unisenderApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createEmailMessage:e.mutation({query:t=>{const n="https://api.unisender.com/ru/api/createEmailMessage",o=new URLSearchParams;return o.append("format","json"),Object.entries(t).forEach(([i,s])=>{o.append(i,String(s))}),{url:`?proxy_url=${encodeURIComponent(n)}`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o.toString()}}})})}),{useCreateEmailMessageMutation:cm}=Xn,Jn=r.createApi({reducerPath:"mailganerApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://mailganer.com"}),endpoints:e=>({createMailing:e.mutation({query:t=>{const n=new URLSearchParams;return n.append("api_key",t.api_key),n.append("name",t.name),n.append("html-content",t.html_content),t.theme&&n.append("theme",t.theme),t.from_name&&n.append("from_name",t.from_name),t.from_email&&n.append("from_email",t.from_email),t.segment_id&&n.append("segment_id",String(t.segment_id)),t.utm_campaign&&n.append("utm_campaign",t.utm_campaign),t.utm_source&&n.append("utm_source",t.utm_source),t.utm_medium&&n.append("utm_medium",t.utm_medium),{url:"/api/v1/mailing/create/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:n.toString()}}})})}),{useCreateMailingMutation:dm}=Jn,Zn=r.createApi({reducerPath:"sendsayApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://api.sendsay.ru"}),endpoints:e=>({createDraft:e.mutation({query:t=>{const n={action:"issue.draft.set",apikey:t.api_key,return_fresh_obj:1,obj:{name:t.name,letter:{subject:t.subject,"from.name":t.from_name||void 0,"from.email":t.from_email||void 0,message:{html:t.html_content}}}};return{url:`/general/api/v100/json/${t.login.split("/").map(o=>encodeURIComponent(o)).join("/")}`,method:"POST",headers:{"Content-Type":"application/json"},body:n}}})})}),{useCreateDraftMutation:um}=Zn,er=r.createApi({reducerPath:"altcraftApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({addTemplate:e.mutation({query:t=>{const n=`${t.api_url}/api/v1.1/templates/add`,o={token:t.api_key,name:t.name,channels:[{sid:"email",fields:{html:t.html_content,text:"",subject:t.subject||t.name,from_email:t.from_email||"",from_name:t.from_name||"",replyto_email:"",replyto_name:"",is_not_inline:!0}}],is_draft:t.is_draft??!1};return{url:`?proxy_url=${encodeURIComponent(n)}`,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}}})})}),{useAddTemplateMutation:pm}=er,mm=e=>e.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/\s+/g," ").trim(),tr=r.createApi({reducerPath:"enkodApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://api.enkod.ru"}),endpoints:e=>({createMessage:e.mutation({query:t=>{const n=mm(t.html_content)||t.subject,o={message:{subject:t.subject,fromEmail:t.sender_email||"",fromName:t.sender_name||"",html:t.html_content,plainText:n},isDraft:!0};return{url:"/v1/message/onetime/",method:"POST",headers:{"Content-Type":"application/json",Apikey:t.api_key},body:o}}})})}),{useCreateMessageMutation:fm}=tr,gm=e=>{const t=e.split("-");return t.length>1?t[1]:"us1"},hm=e=>`https://${gm(e)}.api.mailchimp.com/3.0`,nr=r.createApi({reducerPath:"mailchimpApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s=hm(t.api_key),c=btoa(`anystring:${t.api_key}`),d={type:"regular",recipients:{list_id:t.list_id},settings:{subject_line:t.subject,from_name:t.from_name,reply_to:t.from_email}},u=await i({url:`?proxy_url=${encodeURIComponent(`${s}/campaigns`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Basic ${c}`},body:JSON.stringify(d)});if(u.error){const y=u.error,m=y?.data?.detail||y?.error||String(u.error),E=y?.data?.errors;return{error:{status:"CUSTOM_ERROR",error:E?.length?E.map(k=>k.detail||k.title).join("; "):m}}}const p=u.data;if(!p?.id)return{error:{status:"CUSTOM_ERROR",error:u.data?.errors?.map(y=>y.detail||y.title).join("; ")||"Failed to create campaign"}};const f={html:t.html},g=await i({url:`?proxy_url=${encodeURIComponent(`${s}/campaigns/${p.id}/content`)}`,method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Basic ${c}`},body:JSON.stringify(f)});if(g.error){const y=g.error;return{error:{status:"CUSTOM_ERROR",error:y?.data?.detail||y?.error||String(g.error)}}}return{data:{id:p.id,status:p.status,web_id:p.web_id}}}})})}),{useCreateCampaignMutation:_m}=nr,fo="https://a.klaviyo.com/api",ym="2025-04-15",vm=e=>({"Content-Type":"application/json",Accept:"application/json",Authorization:`Klaviyo-API-Key ${e}`,revision:ym}),rr=r.createApi({reducerPath:"klaviyoApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s=vm(t.api_key),c={data:{type:"template",attributes:{name:`Email ${Date.now()}`,editor_type:"CODE",html:t.html}}},d=await i({url:`?proxy_url=${encodeURIComponent(`${fo}/templates`)}`,method:"POST",headers:s,body:JSON.stringify(c)});if(d.error){const w=d.error,v=w?.data?.errors,x=w?.data?.detail;return{error:{status:"CUSTOM_ERROR",error:v?.length?v.map(P=>P.detail||P.status).join("; "):x||w?.error||String(d.error)}}}const u=d.data?.data?.id;if(!u)return{error:{status:"CUSTOM_ERROR",error:"Failed to create template"}};const p={data:{type:"campaign",attributes:{name:`Campaign ${Date.now()}`,audiences:{included:[t.list_id],excluded:[]},send_strategy:{method:"immediate"},"campaign-messages":{data:[{type:"campaign-message",attributes:{definition:{channel:"email",label:t.subject,content:{subject:t.subject,from_email:t.from_email,from_label:t.from_name,reply_to_email:t.from_email}}}}]}}}},f=await i({url:`?proxy_url=${encodeURIComponent(`${fo}/campaigns`)}`,method:"POST",headers:s,body:JSON.stringify(p)});if(f.error){const w=f.error,v=w?.data?.errors,x=w?.data?.detail;return{error:{status:"CUSTOM_ERROR",error:v?.length?v.map(P=>P.detail||P.status).join("; "):x||w?.error||String(f.error)}}}const g=f.data,y=g?.data?.relationships?.["campaign-messages"]?.data?.[0]?.id,m=g?.data?.id;if(!y)return{error:{status:"CUSTOM_ERROR",error:"Failed to get campaign message from campaign"}};const E={data:{type:"campaign-message",id:y,relationships:{template:{data:{type:"template",id:u}}}}},k=await i({url:`?proxy_url=${encodeURIComponent(`${fo}/campaign-message-assign-template`)}`,method:"POST",headers:s,body:JSON.stringify(E)});if(k.error){const w=k.error,v=w?.data?.errors,x=w?.data?.detail;return{error:{status:"CUSTOM_ERROR",error:v?.length?v.map(P=>P.detail||P.status).join("; "):x||w?.error||String(k.error)}}}return{data:{id:m,campaign_message_id:y}}}})})}),{useCreateCampaignMutation:bm}=rr,Em="https://api.hubapi.com",Sm=e=>({"Content-Type":"application/json",Authorization:`Bearer ${e}`}),or=r.createApi({reducerPath:"hubspotApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createEmail:e.mutation({queryFn:async(t,n,o,i)=>{const s=Sm(t.api_key),c={name:t.name,subject:t.subject,from:{fromName:t.from_name,replyTo:t.from_email},content:{templatePath:"@hubspot/email/dnd/plain_text.html",widgets:{"module-0-1-1":{body:{html:t.html,path:"@hubspot/rich_text",schema_version:2},child_css:{},css:{},id:"module-0-1-1",name:"module-0-1-1",order:2,styles:{},type:"module"},"module-1-1-1":{body:{align:"center",path:"@hubspot/email_footer",schema_version:2,unsubscribe_link_type:"both"},child_css:{},css:{},id:"module-1-1-1",name:"module-1-1-1",order:3,styles:{},type:"module"}}}},d=await i({url:`?proxy_url=${encodeURIComponent(`${Em}/marketing/v3/emails/`)}`,method:"POST",headers:s,body:JSON.stringify(c)});if(d.error){const p=d.error,f=p?.data?.errors,g=p?.data?.message;return{error:{status:"CUSTOM_ERROR",error:f?.length?f.map(y=>y.message||y.errorType).join("; "):g||p?.error||String(d.error)}}}const u=d.data;return u?.id?{data:{id:u.id}}:{error:{status:"CUSTOM_ERROR",error:d.data?.errors?.map(p=>p.message||p.errorType).join("; ")||"Failed to create email"}}}})})}),{useCreateEmailMutation:wm}=or,ir=r.createApi({reducerPath:"salesforceMcApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createEmail:e.mutation({queryFn:async(t,n,o,i)=>{const s=`https://${t.subdomain}.auth.marketingcloudapis.com/v2/token`,c=await i({url:`?proxy_url=${encodeURIComponent(s)}`,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"client_credentials",client_id:t.client_id,client_secret:t.client_secret})});if(c.error){const m=c.error;return{error:{status:"CUSTOM_ERROR",error:m?.data?.error_description||m?.data?.error||m?.error||String(c.error)}}}const d=c.data,u=d?.access_token,p=d?.rest_instance_url;if(!u||!p)return{error:{status:"CUSTOM_ERROR",error:d?.error_description||d?.error||"Failed to get access token"}};const f={name:t.name,assetType:{id:208,name:"htmlemail"},views:{html:{content:t.html},text:{},subjectline:{content:t.subject},preheader:{}},data:{email:{options:{characterEncoding:"utf-8"}}}},g=await i({url:`?proxy_url=${encodeURIComponent(`${p.replace(/\/$/,"")}/asset/v1/content/assets`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`},body:JSON.stringify(f)});if(g.error){const m=g.error,E=m?.data?.errors,k=m?.data?.message;return{error:{status:"CUSTOM_ERROR",error:E?.length?E.map(w=>w.message||w.documentation).join("; "):k||m?.error||String(g.error)}}}const y=g.data;return y?.id?{data:{id:y.id}}:{error:{status:"CUSTOM_ERROR",error:g.data?.errors?.map(m=>m.message).join("; ")||"Failed to create email"}}}})})}),{useCreateEmailMutation:km}=ir,Cm=e=>e.replace(/\/$/,""),Tm=e=>e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim()||" ",sr=r.createApi({reducerPath:"activecampaignApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s=Cm(t.api_url),c=t.api_key,d={"Content-Type":"application/json","Api-Token":c},u=await i({url:`?proxy_url=${encodeURIComponent(`${s}/api/3/addresses`)}`,method:"GET",headers:{"Api-Token":c}});if(u.error)return{error:{status:"CUSTOM_ERROR",error:"Failed to load mailing addresses. Check your API URL and Key."}};const p=u.data?.addresses??[],f=p.find(P=>P.isDefault==="1")??p[0];if(!f?.id)return{error:{status:"CUSTOM_ERROR",error:"NO_MAILING_ADDRESS"}};const g={message:{name:t.name,fromname:t.from_name,fromemail:t.from_email,email:t.from_email,reply2:t.from_email,subject:t.subject,html:t.html,text:Tm(t.html),preheader_text:"",format:"mime"}},y=await i({url:`?proxy_url=${encodeURIComponent(`${s}/api/3/messages`)}`,method:"POST",headers:d,body:JSON.stringify(g)});if(y.error){const P=y.error;return{error:{status:"CUSTOM_ERROR",error:P?.data?.message||P?.error||"Failed to create message."}}}const m=y.data?.message?.id;if(!m)return{error:{status:"CUSTOM_ERROR",error:"Message created but no ID returned."}};const E=`${s}/admin/api.php?api_action=campaign_create&api_output=json`,k=new URLSearchParams;k.append("type","single"),k.append("name",t.name),k.append("sdate","2099-12-31 12:00:00"),k.append("status","0"),k.append("public","1"),k.append("trackreads","1"),k.append("tracklinks","all"),k.append("htmlunsub","1"),k.append("textunsub","1"),k.append("addressid",String(f.id)),k.append(`p[${t.list_id}]`,t.list_id),k.append(`m[${m}]`,"100");const w=await i({url:`?proxy_url=${encodeURIComponent(E)}`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Api-Token":c},body:k.toString()});if(w.error){const P=w.error;return{error:{status:"CUSTOM_ERROR",error:P?.data?.result_message||P?.error||"Message created, but campaign creation failed."}}}const v=w.data;if(Number(v?.result_code)===0)return{error:{status:"CUSTOM_ERROR",error:v?.result_message||"Campaign creation failed (v1 API)."}};const x=v?.id;return x?{data:{campaignId:String(x)}}:{error:{status:"CUSTOM_ERROR",error:v?.result_message||"Campaign created but no ID returned."}}}})})}),{useCreateCampaignMutation:Im}=sr,Am="https://api.brevo.com/v3",ar=r.createApi({reducerPath:"brevoApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s={name:t.name,subject:t.subject,sender:{name:t.from_name,email:t.from_email},htmlContent:t.html,recipients:{listIds:[t.list_id]}},c=await i({url:`?proxy_url=${encodeURIComponent(`${Am}/emailCampaigns`)}`,method:"POST",headers:{"Content-Type":"application/json","api-key":t.api_key},body:JSON.stringify(s)});if(c.error){const u=c.error;return{error:{status:"CUSTOM_ERROR",error:u?.data?.message||u?.data?.code||u?.error||String(c.error)}}}const d=c.data;return d?.id?{data:{id:d.id}}:{error:{status:"CUSTOM_ERROR",error:c.data?.message||"Failed to create campaign"}}}})})}),{useCreateCampaignMutation:xm}=ar,Pm="https://api.createsend.com/api/v3.3",Rm=e=>`Basic ${btoa(`${e}:x`)}`,lr=r.createApi({reducerPath:"campaignMonitorApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s={Name:t.name,Subject:t.subject,FromName:t.from_name,FromEmail:t.from_email,ReplyTo:t.from_email,HtmlUrl:t.html_url,ListIDs:[t.list_id],InlineCss:!0},c=await i({url:`?proxy_url=${encodeURIComponent(`${Pm}/campaigns/${t.client_id}.json`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:Rm(t.api_key)},body:JSON.stringify(s)});if(c.error){const p=c.error;return{error:{status:"CUSTOM_ERROR",error:p?.data?.Message||p?.error||String(c.error)}}}const d=c.data,u=typeof d=="string"?d:d?.id;return!u||typeof u!="string"?{error:{status:"CUSTOM_ERROR",error:d?.Message||"Failed to create campaign"}}:{data:{id:u}}}})})}),{useCreateCampaignMutation:jm}=lr,Es="https://api.cc.email/v3",Om=e=>e.includes("[[trackingImage]]")?e:e.replace(/<body([^>]*)>/i,"<body$1>[[trackingImage]]"),cr=r.createApi({reducerPath:"constantContactApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s=Om(t.html),c={name:t.name,email_campaign_activities:[{format_type:5,from_email:t.from_email,reply_to_email:t.from_email,from_name:t.from_name,subject:t.subject,html_content:s}]},d=await i({url:`?proxy_url=${encodeURIComponent(`${Es}/emails`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.access_token}`},body:JSON.stringify(c)});if(d.error){const m=d.error;return{error:{status:"CUSTOM_ERROR",error:m?.data?.error_message||m?.data?.error_key||m?.error||String(d.error)}}}const u=d.data,p=u?.campaign_activities?.find(m=>m.role==="primary_email")?.campaign_activity_id,f=u?.campaign_id;if(!p||!f)return{error:{status:"CUSTOM_ERROR",error:"Failed to create campaign"}};const g={campaign_activity_id:p,campaign_id:f,role:"primary_email",contact_list_ids:[t.list_id],segment_ids:[],current_status:"DRAFT",format_type:5,from_email:t.from_email,from_name:t.from_name,reply_to_email:t.from_email,subject:t.subject,html_content:s},y=await i({url:`?proxy_url=${encodeURIComponent(`${Es}/emails/activities/${p}`)}`,method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.access_token}`},body:JSON.stringify(g)});if(y.error){const m=y.error;return{error:{status:"CUSTOM_ERROR",error:m?.data?.error_message||m?.data?.error_key||m?.error||String(y.error)}}}return{data:{campaign_id:f}}}})})}),{useCreateCampaignMutation:Lm}=cr,Mm="https://api.getresponse.com/v3",Nm=e=>`api-key ${e}`,dr=r.createApi({reducerPath:"getresponseApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createNewsletter:e.mutation({queryFn:async(t,n,o,i)=>{const s=t.html.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim(),c={name:t.name,type:"draft",subject:t.subject,fromField:{fromFieldId:t.from_field_id},replyTo:{fromFieldId:t.from_field_id},campaign:{campaignId:t.campaign_id},content:{html:t.html,plain:s||"Newsletter"},flags:["openrate","clicktrack"],sendSettings:{selectedCampaigns:[t.campaign_id]}},d=await i({url:`?proxy_url=${encodeURIComponent(`${Mm}/newsletters`)}`,method:"POST",headers:{"Content-Type":"application/json","X-Auth-Token":Nm(t.api_key)},body:JSON.stringify(c)});if(d.error){const p=d.error;return{error:{status:"CUSTOM_ERROR",error:p?.data?.message||p?.data?.code||p?.error||String(d.error)}}}const u=d.data;return u?.newsletterId?{data:{newsletterId:u.newsletterId}}:{error:{status:"CUSTOM_ERROR",error:d.data?.message||"Failed to create newsletter"}}}})})}),{useCreateNewsletterMutation:Dm}=dr,Fm=e=>`https://${e||"r1"}-api.dotdigital.com/v2`,Ss=(e,t)=>`Basic ${btoa(`${e}:${t}`)}`,ws=e=>e&&typeof e=="object"&&"data"in e&&e.data!==void 0?e.data:e,ks=e=>e.trim().toLowerCase(),ur=r.createApi({reducerPath:"dotdigitalApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s=t.html.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim(),c=Fm(t.region),d={"Content-Type":"application/json",Authorization:Ss(t.username,t.password)},u=await i({url:`?proxy_url=${encodeURIComponent(`${c}/custom-from-addresses`)}`,method:"GET",headers:{Authorization:Ss(t.username,t.password)}});let p=[];if(!u.error){const w=ws(u.data);Array.isArray(w)?p=w:w&&typeof w=="object"&&Array.isArray(w.items)&&(p=w.items)}const f=ks(t.from_email),g=p.find(w=>w.email&&ks(w.email)===f),y={name:t.name,subject:t.subject,fromName:t.from_name,htmlContent:t.html,plainTextContent:s||"Newsletter"},m=!g?.id;g?.id!=null&&(y.fromAddress={id:g.id});const E=await i({url:`?proxy_url=${encodeURIComponent(`${c}/campaigns`)}`,method:"POST",headers:d,body:JSON.stringify(y)});if(E.error){const w=E.error;return{error:{status:"CUSTOM_ERROR",error:w?.data?.message||w?.error||String(E.error)}}}const k=ws(E.data);return k?.id?{data:{id:k.id,usedAccountDefaultFromAddress:m}}:{error:{status:"CUSTOM_ERROR",error:E.data?.message||k?.message||"Failed to create campaign"}}}})})}),{useCreateCampaignMutation:Bm}=ur,$m="https://app.bentonow.com/api/v1",Um=(e,t)=>`Basic ${btoa(`${e}:${t}`)}`,pr=r.createApi({reducerPath:"bentoApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createBroadcast:e.mutation({queryFn:async(t,n,o,i)=>{const s={broadcasts:[{name:t.name,subject:t.subject,content:t.html,type:"raw",from:{email:t.from_email,name:t.from_name},inclusive_tags:t.inclusive_tags||"subscribers",exclusive_tags:"",segment_id:t.segment_id||"",batch_size_per_hour:500,approved:!1}]},c=`${$m}/batch/broadcasts?site_uuid=${encodeURIComponent(t.site_uuid)}`,d=await i({url:`?proxy_url=${encodeURIComponent(c)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:Um(t.publishable_key,t.secret_key),"User-Agent":"EmailMaker/1.0"},body:JSON.stringify(s)});if(d.error){const u=d.error;return{error:{status:"CUSTOM_ERROR",error:u?.data?.message||u?.error||String(d.error)}}}return{data:{count:d.data?.count??1}}}})})}),{useCreateBroadcastMutation:zm}=pr,Gm=()=>{const{__:e}=r.useI18n(),[t,{isLoading:n}]=cm(),[o,{isLoading:i}]=dm(),[s,{isLoading:c}]=um(),[d,{isLoading:u}]=pm(),[p,{isLoading:f}]=fm(),[g,{isLoading:y}]=_m(),[m,{isLoading:E}]=bm(),[k,{isLoading:w}]=wm(),[v,{isLoading:x}]=km(),[P,{isLoading:K}]=Im(),[J,{isLoading:N}]=xm(),[L,{isLoading:A}]=jm(),[O,{isLoading:z}]=Lm(),[B,{isLoading:U}]=Dm(),[de,{isLoading:me}]=Bm(),[H,{isLoading:Z}]=zm(),De=n||i||c||u||f||y||E||w||x||K||N||A||z||U||me||Z,Ue={unisender:async(T,R,D,I)=>{try{const S=await t({api_key:T.api_key,sender_name:T.sender_name,sender_email:T.sender_email,subject:I,body:D,list_id:R.list_id,generate_text:1,lang:"ru"}).unwrap();return S.result?.message_id?{success:!0,message:e("Email successfully created!"),link:{url:`https://app.unisender.com/ru/v5/spa/email-campaign/editor/${S.result.message_id}?step=send`,text:e("Open in Unisender")}}:S.error?{success:!1,error:S.error+(S.code?` (${S.code})`:"")}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create email")}}},mailganer:async(T,R,D,I)=>{try{const S=await o({api_key:T.api_key,name:R.name,html_content:D,theme:R.theme||I,from_name:T.from_name,from_email:T.from_email}).unwrap();return S.status===1&&S.public_id?{success:!0,message:e("Mailing successfully created!"),link:S.step1_url?{url:S.step1_url,text:e("Open in Mailganer")}:void 0}:S.error?{success:!1,error:S.error}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create mailing")}}},sendsay:async(T,R,D,I)=>{try{const S=await s({login:T.login,api_key:T.api_key,name:R.name,subject:R.subject,html_content:D,from_name:T.from_name,from_email:T.from_email}).unwrap();return S.obj?.id?{success:!0,message:e("Draft successfully created!"),link:{url:`https://app.sendsay.ru/content/drafts/email/${S.obj.id}/settings`,text:e("Open in Sendsay")}}:S.errors&&S.errors.length>0?{success:!1,error:S.errors.map(ae=>ae.explain).join(", ")}:S.error?{success:!1,error:S.explain||S.error}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create draft")}}},altcraft:async(T,R,D,I)=>{try{const S=await d({api_url:T.api_url,api_key:T.api_key,name:R.name,html_content:D,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email}).unwrap();return S.error===0?{success:!0,message:e("Template successfully created!")}:{success:!1,error:S.error_text||e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create template")}}},enkod:async(T,R,D,I)=>{try{const S=await p({api_key:T.api_key,subject:R.subject,html_content:D,sender_name:T.sender_name,sender_email:T.sender_email}).unwrap();if(S.success||S.messageId||S.id){const ae=S.messageId||S.id;return{success:!0,message:e("Draft successfully created!"),link:ae?{url:`https://app.enkod.ru/ensend/messages/detail/${ae}/preview`,text:e("Open in enKod")}:void 0}}else if(S.error||S.message)return{success:!1,error:S.error||S.message||e("Unknown error")};return{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create draft")}}},mailchimp:async(T,R,D,I)=>{try{const S=await g({api_key:T.api_key,list_id:R.list_id,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();if(S.id){const ae=T.api_key?.split("-")[1]||"us1";return{success:!0,message:e("Campaign successfully created!"),link:{url:`https://${ae}.admin.mailchimp.com/campaigns/#r:campaignId=${S.id}`,text:e("Open in Mailchimp")}}}return{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},klaviyo:async(T,R,D,I)=>{try{const S=await m({api_key:T.api_key,list_id:R.list_id,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();return S.id?{success:!0,message:e("Campaign successfully created!"),link:{url:`https://www.klaviyo.com/campaign/${S.id}/wizard/1`,text:e("Open in Klaviyo")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},hubspot:async(T,R,D,I)=>{try{const S=await k({api_key:T.api_key,name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();return S.id?{success:!0,message:e("Email successfully created!"),link:{url:`https://app.hubspot.com/email/0/edit/${S.id}`,text:e("Open in HubSpot")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create email")}}},salesforce_mc:async(T,R,D,I)=>{try{const S=await v({subdomain:T.subdomain,client_id:T.client_id,client_secret:T.client_secret,name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();return S.id?{success:!0,message:e("Email successfully created!"),link:{url:`https://app.s7.exacttarget.com/ContentBuilder?app=contentbuilder&id=${S.id}`,text:e("Open in Marketing Cloud")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create email")}}},activecampaign:async(T,R,D,I)=>{try{const S=await P({api_url:T.api_url,api_key:T.api_key,list_id:T.list_id,name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();if(S.campaignId){const ae=(T.api_url||"").replace(/\/$/,"").match(/https?:\/\/([^.]+)\.api-/),we=ae?ae[1]:"",Ye=we?`https://${we}.activehosted.com/app/campaigns/${S.campaignId}`:"https://www.activecampaign.com/app/campaigns";return{success:!0,message:e("Draft campaign created! Open it to review and schedule."),link:{url:Ye,text:e("Open draft campaign")}}}return{success:!1,error:e("Unknown error")}}catch(S){const ae=S.message||S.error||"";if(ae==="NO_MAILING_ADDRESS"){const we=(T.api_url||"").replace(/\/$/,"").match(/https?:\/\/([^.]+)\.api-/),Ye=we?we[1]:"",Qe=Ye?`https://${Ye}.activehosted.com/app/settings/addresses`:"https://www.activecampaign.com/app/settings/addresses";return{success:!1,error:e("No mailing address found. Add one in ActiveCampaign: ")+Qe}}return{success:!1,error:ae||e("Failed to create campaign")}}},brevo:async(T,R,D,I)=>{try{const S=await J({api_key:T.api_key,list_id:Number(R.list_id),name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();return S.id?{success:!0,message:e("Campaign successfully created!"),link:{url:`https://app.brevo.com/marketing-campaign/edit/${S.id}`,text:e("Open in Brevo")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},campaign_monitor:async(T,R,D,I)=>{try{const S=R.html_url?.trim();if(!S)return{success:!1,error:e("HTML URL is required. Save the email first, or paste a custom URL to your hosted HTML.")};const ae=await L({api_key:T.api_key,client_id:T.client_id,list_id:R.list_id,name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html_url:S.trim()}).unwrap();return ae.id?{success:!0,message:e("Campaign successfully created!"),link:{url:`https://app.createsend.com/campaigns/#/${ae.id}`,text:e("Open in Campaign Monitor")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},constant_contact:async(T,R,D,I)=>{try{return(await O({access_token:T.access_token,list_id:R.list_id,name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap()).campaign_id?{success:!0,message:e("Campaign successfully created!"),link:{url:"https://app.constantcontact.com/pages/email/campaigns",text:e("Open in Constant Contact")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},getresponse:async(T,R,D,I)=>{try{const S=await B({api_key:T.api_key,from_field_id:T.from_field_id,campaign_id:R.campaign_id,name:R.name,subject:R.subject||I,html:D}).unwrap();return S.newsletterId?{success:!0,message:e("Newsletter successfully created!"),link:{url:`https://app.getresponse.com/letter/${S.newsletterId}`,text:e("Open in GetResponse")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create newsletter")}}},dotdigital:async(T,R,D,I)=>{try{const S=await de({username:T.username,password:T.password,region:T.region||"r1",name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();return S.id?{success:!0,message:S.usedAccountDefaultFromAddress?e("Campaign created. Dotdigital used your account default sender because this From email is not registered as a custom from address. Add the address in Dotdigital and export again to use it."):e("Campaign successfully created!"),link:{url:"https://login.dotdigital.com/",text:e("Open in Dotdigital")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},bento:async(T,R,D,I)=>{try{return await H({publishable_key:T.publishable_key,secret_key:T.secret_key,site_uuid:T.site_uuid,name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D,inclusive_tags:R.inclusive_tags}).unwrap(),{success:!0,message:e("Broadcast successfully created!"),link:{url:"https://app.bentonow.com/",text:e("Open in Bento")}}}catch(S){return{success:!1,error:S.message||e("Failed to create broadcast")}}}};return{exportToIntegration:async(T,R,D,I,S)=>{const ae=Ue[T];return ae?ae(R,D,I,S):{success:!1,error:e("Unknown integration")}},isLoading:De}},Rt={INFO:"info",STORAGE:"storage",STYLES:"styles",MEMBERS:"members",INTEGRATIONS:"integrations",PLUGIN:"plugin"},Jv=Rt.INFO,Zv=[Rt.INFO,Rt.STORAGE,Rt.STYLES,Rt.MEMBERS,Rt.INTEGRATIONS,Rt.PLUGIN],eb={mainsettings:Rt.INFO,ftpsettings:Rt.STORAGE,webhooksettings:Rt.INTEGRATIONS},Wm=async(e,t,n)=>{try{const{notification:o,...i}=e,s=await r.fetchBaseQuery({baseUrl:"https://racs.rest/v3"})(i,t,n);if(s.error)throw new Error;return s}catch(o){return(e?.notification).error(o),{error:o}}},mr=r.createApi({reducerPath:"exportPngApi",baseQuery:Wm,endpoints:e=>({makeTemporaryMailForPng:e.mutation({query:({file:t,title:n,notification:o})=>{const i=new Blob([t],{type:"text/html"}),s=new FormData;return s.append("file",i,"base.html"),s.append("contentType","text/html"),{url:"?resource=exportPngApi",method:"POST",body:s,notification:o}}}),deleteTemporaryMail:e.mutation({query:({id:t,notification:n})=>({url:`/${t}?resource=exportPngApi`,method:"DELETE",notification:n})})})}),{useMakeTemporaryMailForPngMutation:Hm,useDeleteTemporaryMailMutation:qm}=mr,fr=r.createApi({reducerPath:"webHookApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({postDataByWebHook:e.mutation({query:({url:t,body:n})=>({url:`?proxy_url=${encodeURIComponent(t)}`,method:"POST",body:n})})})}),{usePostDataByWebHookMutation:Vm}=fr,Km=async(e,t,n)=>{try{const{notification:o,...i}=e,s=await r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"})(i,t,n);if(s.error)throw new Error;return s}catch(o){return(e?.notification).error(o),{error:o}}},gr=r.createApi({reducerPath:"htmlToPdfPlusApi",baseQuery:Km,endpoints:e=>({generateHtmlToPdf:e.mutation({query:({htmlContent:t,notification:n})=>({url:"emails/pdf",method:"POST",body:t,notification:n,responseHandler:o=>o.blob()})})})}),{useGenerateHtmlToPdfMutation:Ym}=gr,hr=r.createApi({reducerPath:"proxyApi",tagTypes:["Proxy"],baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/wp-json/cors-proxy/v1/get"}),endpoints:e=>({getFile:e.query({queryFn({url:t,tryFetch:n=!0,type:o},i){const s=r.clientFromApi(i),c=n?fetch(t):Promise.reject(),d=p=>{switch(o){case"json":return p.json();case"text":return p.text();default:return p.blob()}},u=p=>d(p).then(f=>({data:f}));return c.then(p=>u(p)).catch(()=>s.corsProxy.get_list({format:"blob",extraQuery:{url:encodeURIComponent(t)}}))}})})}),{useGetFileQuery:tb,useLazyGetFileQuery:Qm}=hr,nb="email",rb=100;function Xm(e){return yt.sanitizeFileName(String(e??"").trim()).slice(0,100).trimEnd()||"email"}function Cs(e){const t=Xm(e);return{archive:`${t}.zip`,desktop:`${t}-desktop.png`,mobile:`${t}-mobile.png`}}function Jm(e,t){const n=Cs(e);return{[n.desktop]:t.desktop,[n.mobile]:t.mobile}}var go=()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/f102fe60.js")).then(e=>e.import_exports),void 0,{}.url),Zm=1,ef=2,tf=375,Dt={fontSize:"16px"},nf={position:"absolute",bottom:-4,right:-4,borderRadius:"100%",backgroundColor:r.emCssVar("colorBgContainer")},rf={position:"relative",display:"inline-flex"},qt=({icon:e,locked:t,strokeWidth:n,className:o})=>(0,a.jsxs)("span",{className:o,style:rf,children:[e,t&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:12,strokeWidth:n,style:nf})]}),of=({email:e,autoSaveBlockResult:t})=>{const{__:n,_x:o}=r.useI18n(),i=r.useDispatch(),s=r.useEmailAttributesWriter(),[c]=Qm(),[d]=r.useUploadImageMutation(),u=r.useAppNavigate(),{owner:p,admin:f}=Qn(),g=r.useCurrentUser(),y=r.useProjectData(),{modal:m}=_.ui_kit$App.useApp(),E=r.useNotification(),{confirm:k}=m,w=r.useAppStore(),v=()=>on(h.getContainer(w)).keepWrappedOnOutput,x=(M,q,Q,re)=>yt.prepareHTML(M,q,Q,re,v()),P=(M,q,Q,re,ne,W)=>yt.getEML(M,q,Q,re,ne,W,v()),K=(M,q,Q,re,ne)=>yt.htmlToFilesData(M,q,Q,re,ne,v()),J=r.useCookieManager(),N=r.useAppConfig(),L=vs(),{beeFreeConverterEnabled:A,aiLayoutConverterEnabled:O}=L,z=r.useEditorProjectId(),B=r.useEventEmitter(h.events.ON_EMAIL_CLONE_ID),U=r.useEventEmitter(h.events.ON_BROWSER_EXTENSION_DETECTED_ID),[de]=Vm(),me=!0,{data:H}=r.useGetProjectIntegrationsQuery(y?.id??0,{skip:me}),{data:Z}=r.useGetProjectWebhookQuery(y?.id??0,{skip:me}),[De]=r.useLazyGetIntegrationCredentialsQuery(),{exportToIntegration:ve,isLoading:et}=Gm(),be=r.usePushToDataLayer(),[fe,Y]=(0,l.useState)(()=>!Ht(h.getContainer(w)).contentShown()),[pe,ie]=(0,l.useState)(!1),[se,Ae]=(0,l.useState)(null),[Te,Fe]=(0,l.useState)(""),[X,Ee]=(0,l.useState)(!1),[Ie,ge]=(0,l.useState)(0),[Re,Ue]=(0,l.useState)(null),[C,T]=(0,l.useState)(""),[R,D]=(0,l.useState)(!1),I=r.usePlanFeatureGate("export_html"),S=r.usePlanFeatureGate("export_pdf"),ae=r.usePlanFeatureGate("export_png");r.usePlanFeatureGate("export_webhook");const we=r.usePlanFeatureGate("export_platforms"),Ye=r.usePlanFeatureGate("export_amp"),Qe=r.usePlanFeatureGate("template_import"),ze=r.usePlanFeatureGate("code_minify"),Ze=M=>{Ee(!0),ge(r.FEATURE_UPSELL_SLIDE[M])},[pt]=r.emailsApi.useDeleteEmailMutation(),bt=async(M,q)=>{try{const Q=await pt(M.id).unwrap();M.project,E.success(n('The email "')+Q.title+o('" was successfully removed.',"email")),be({event:"delete",action:"delete_email",entity_type:"email",entity_id:M.id,project_id:M.project,context:"editor"})}catch(Q){E.error(Q)}},[ft,lt]=r.useAddEmailMutation(),[G]=Hm(),[V]=qm(),[te]=Ym(),ue=r.useProjectData(),he=r.useInvalidateTerms(),Ge=r.useSelector(r.selectIsHeaderCodeMenuOpen);(0,l.useEffect)(()=>{Ge.switched&&Y(!1)},[Ge]);const qe=()=>{const{title:M}=e;return M===null?n("New email title"):M},st=(M,q,Q=!1)=>{const re=r.getCodeSize(M);Q&&r.isCodeSizeExceeded(re)?(Fe(M),Ae(()=>q),ie(!0)):q(M)},Bt=()=>{if(ie(!1),ze.isLocked){Ze("code_minify");return}if(se&&Te){r.getCodeSize(Te);const M=r.minifyHtml(Te);r.getCodeSize(M),se(M),Ae(null),Fe("")}},Le=()=>{ie(!1),se&&Te&&(se(Te),Ae(null),Fe(""))},Xe=()=>{ie(!1),Ae(null),Fe("")},oe=r.useContentReader(),ee=r.useContentReplacer(),$=r.useEvent(h.events.ON_EMAIL_INIT_ID),le=r.useEventEmitter(h.events.ON_LAYOUT_CONVERT_REQUEST_ID);(0,l.useEffect)(()=>{const M=$(()=>{Y(!1)});return()=>M.dispose()},[$]);const xe=async(M,q=oe())=>{const Q=document.querySelector(".email-preview"),re=getComputedStyle(Q);return q=await x(q,[re.width],e.utm_parameters,async ne=>{ot(ne)}),G({file:q,title:qe(),notification:E}).unwrap().then(ne=>{const W={id:ne._id,...ne};return M(W,()=>V({id:W.id,notification:E}))}).catch(ne=>{E.error({title:ne.data?.code,description:ne.data?.message})})},Se=(M,q=1)=>xe((Q,re)=>({hrefs:M.map(ne=>r.previewHrefForRacs(Q.id,void 0,!1,q,void 0,void 0,ne)),dispose:re})),Me=(M,q,Q=2)=>xe((re,ne)=>({data:M.map(W=>({selector:W,href:r.previewHrefForRacs(re.id,void 0,!1,Q,W)})),dispose:ne}),q),We=async(M,q)=>{const Q=typeof M=="string"?(await c({url:M}))?.data:M;if(!Q)return typeof M=="string"?M:"";let re=r.decodeFileNameFromPath(q);if(typeof M=="string"&&/^https?:\/\//i.test(M)){const He=r.decodeFileNameFromUrl(M);He&&(re=He)}const ne=Q,{ensureFileExtension:W,extractUploadResult:Ce}=await go();re=await W(re,ne.type||"");const _e=new File([ne],re.toLowerCase(),{type:ne.type||""});try{const He=Ce(await d({user_id:g.id,folder:String(ue.id),file:_e}).unwrap());if(He.error)return typeof M=="string"?M:"";if(He.file_url)return He.file_url}catch{}return typeof M=="string"?M:""},Be=async M=>{const q=M.document.querySelectorAll("[em-operation=exportAsPicture]"),Q=new Map;for(let re=0,ne=q.length;re<ne;re++){const W=q[re];W.setAttribute("em-export-id",String(re)),Q.set(`[em-export-id='${re}']`,W)}Q.size&&M.handleRender(async({contentDocument:re,managedNodeController:ne})=>{try{const{data:W,dispose:Ce}=await Me([...Q.keys()],r.getOuterHtml(re),ef);try{const _e=W.map(async({href:He,selector:hn},Dn)=>{const mt=Q.get(hn);if(mt.tagName==="TD"){mt.removeAttribute("style");for(const _t of[...mt.classList])_t.startsWith("em-mob-")&&mt.classList.remove(_t)}ne.commit();const Fr=await We(He,`${Dn}-${mt.tagName.toLowerCase()}.png`),_n=parseInt(getComputedStyle(mt).width);let wt=new Image(_n);wt.setAttribute("border","0"),wt.setAttribute("style",`display: block; width: 100%; max-width: ${_n}px;`),wt.alt="",wt.src=Fr;const yn=mt.querySelector("a");if(yn){const _t=document.createElement("a");_t.setAttribute("target","_blank"),_t.setAttribute("href",yn.getAttribute("href")),_t.appendChild(wt),wt=_t}if(mt.tagName==="TD"){const _t=mt.cloneNode();_t.removeAttribute("em-operation"),_t.appendChild(wt),wt=_t}mt.replaceWith(wt),ne.commit()});await Promise.all(_e)}catch{}finally{Ce()}}catch{}})},ot=M=>{const q=M.document;if(ue?.limits?.preview_limit==="0"&&z&&g?.counters?.emails_counter>2&&!q.querySelector(".em-powered-logo")){const Q=`<a href="${`https://https://racs.rest/v3/v3/link?app=useblocks&project=${z}&email=${e.id}&link=https%3A%2F%2Fuseblocks.io`}" target="_blank"><img src="https://https://racs.rest/v3/v3/pixel/123.png?image=https://cdn.useblocks.io/blocks/powered.png&project=${z}&email=${e.id}" width="150" height="50" border="0" alt="" style="display: inline-block; width: 100%; max-width: 150px;"></a>`;q.querySelector("body > table:last-child > tbody:last-child > tr:last-child, body > div > table:last-child > tbody:last-child > tr:last-child")&&q.querySelector("body > table:last-child > tbody:last-child > tr:last-child, body > div > table:last-child > tbody:last-child > tr:last-child").insertAdjacentHTML("afterend",`<tr em="block" class="em-powered-logo">
|
|
855
|
+
</td></tr></table>`,Pc={image:"element_image","ai-image":"element_ai_image",text:"element_text",header:"element_heading",button:"element_button",spacer:"element_spacer","list-ul":"element_lists","list-ol":"element_lists",divider:"element_divider",social:"element_social",table:"element_table",countdown:"element_timer",video:"element_video","amp-carousel":"element_amp_carousel","amp-accordion":"element_amp_accordion","amp-form":"element_amp_form"};function yi(e){return Pc[e]??null}var vi=e=>Number(e)||void 0,Rc={colors:[],fonts:[],socials:[]},Kr=(e="entity")=>{const t=typeof globalThis<"u"?globalThis.crypto:void 0;if(t?.randomUUID)return t.randomUUID();const n=typeof performance<"u"?performance.now().toString(36).replace(".",""):String(Date.now());return`${e}-${Date.now().toString(36)}-${n}`},jc=()=>Kr("soc"),Oc=/^[a-z][a-z0-9+.-]*:/i,bi=e=>{const t=String(e??"").trim();return t?Oc.test(t)?t:`https://${t}`:""},Lc=e=>{const t=bi(e);if(!t)return!1;try{const n=new URL(t);return n.protocol==="https:"&&!!n.hostname}catch{return!1}},Mc=e=>[...e].filter(t=>t.url.trim()!=="").sort((t,n)=>t.order-n.order),Nc=e=>Mc(e).map(t=>({platform:t.icon_key,href:t.url,label:t.name,...t.icon_url?{iconSrc:t.icon_url}:{}})),Dc=/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,Fc=/^#?([0-9a-f]{6})$/i,Yr=e=>{if(!e)return null;const t=String(e).trim().toLowerCase(),n=Fc.exec(t);if(n)return`#${n[1]}`;const o=Dc.exec(t);if(o){const[,i,s,c]=o;return`#${i}${i}${s}${s}${c}${c}`}return null},Ei=()=>Kr("bc"),Bc=/\.(woff2|woff|ttf|otf)$/i,$c=e=>{const t=Bc.exec(e.trim().toLowerCase());return t?`.${t[1]}`:null},Uc={".woff":"application/x-font-woff",".woff2":"application/font-woff2",".ttf":"font/sfnt",".otf":"font/sfnt"},zc={".woff":["application/x-font-woff","font/woff","application/font-woff"],".woff2":["application/font-woff2","font/woff2"],".ttf":["font/sfnt","application/font-sfnt","application/x-font-ttf","font/ttf","application/x-font-truetype"],".otf":["font/sfnt","application/font-sfnt","application/vnd.ms-opentype","application/x-font-opentype","font/otf","font/opentype"]},Gc=new Set(["","application/octet-stream","binary/octet-stream"]),Wc=e=>{const t=$c(e.name);if(!t)return e;const n=e.type.trim().toLowerCase();return zc[t].includes(n)||!Gc.has(n)?e:new File([e],e.name,{type:Uc[t],lastModified:e.lastModified})},Hc=()=>Kr("fnt"),qc=e=>e.family?.trim()||e.name.trim(),Vc=e=>e.filter(t=>t.source_url?.trim()).map(t=>({family:t.family?.trim()||t.name.trim(),source_url:t.source_url?.trim()??"",weight:t.weight?.trim()||"400",style:t.style??"normal"})),Kc=(e,t={})=>{const n=t.srcOverride?.trim()||e.source_url?.trim();if(!n||!t.srcOverride&&Si(e)||t.srcOverride&&r.isGoogleFontsCssUrl(n))return null;const o=t.familyOverride?.trim()||qc(e),i=e.weight?.trim()||"400",s=e.style??"normal";return`@font-face{font-family:${JSON.stringify(o)};src:url(${JSON.stringify(n)});font-weight:${i};font-style:${s};font-display:swap;}`},Yc=e=>e.source_kind?e.source_kind:r.isGoogleFontsCssUrl(e.source_url)?"google_stylesheet":e.file_name?.trim()?"uploaded":"remote_file",Si=e=>e.source_kind?e.source_kind==="google_stylesheet"||e.source_kind==="remote_stylesheet":r.isGoogleFontsCssUrl(e.source_url),wi="data-em-project-fonts-face",ki="data-em-project-font-link",Qc=e=>{const t=e.filter(n=>Si(n)).map(n=>n.source_url?.trim()??"").filter(Boolean);return[...new Set(t)]},Xc=e=>e.map(t=>Kc(t)).filter(t=>!!t).join(""),Jc=(e,t=document)=>{const n=Xc(e),{head:o}=t;let i=o.querySelector(`style[${wi}]`);if(!n){i?.remove();return}i||(i=t.createElement("style"),i.setAttribute(wi,""),o.appendChild(i)),i.textContent=n},Zc=(e,t=document)=>{const n=new Set(Qc(e)),{head:o}=t;o.querySelectorAll(`link[${ki}]`).forEach(i=>{const s=i.getAttribute("href")??"";n.has(s)?n.delete(s):i.remove()}),n.forEach(i=>{const s=t.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("href",i),s.setAttribute(ki,""),o.appendChild(s)})},ed=(e,t=document)=>{Jc(e,t),Zc(e,t)},td=new Set(["normal","italic","oblique"]),Bv="[emailmaker] projectStyles:",Wt=e=>{},vt=e=>typeof e=="string"?e.trim():"",Ci=e=>!e||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("./")||e.startsWith("../")?!0:e.toLowerCase().startsWith("https://"),nd=e=>r.isGoogleFontsCssUrl(e)?"google_stylesheet":(e.split(/[?#]/)[0]??"").toLowerCase().endsWith(".css")?"remote_stylesheet":"remote_file",Qr=(e,t,n)=>e.length<=t?e:(Wt(`${n} list is capped at ${t} entries, ${e.length-t} dropped`),e.slice(0,t)),rd=(e,t)=>{const n=Yr(e?.hex);if(!n){Wt(`colors[${t}] skipped: "${String(e?.hex)}" is not a hex color`);return}return{id:vt(e.id)||Ei(),name:vt(e.name),hex:n,order:0}},od=(e,t)=>{const n=vt(e?.family),o=vt(e?.source_url);if(!n){Wt(`fonts[${t}] skipped: family is required`);return}if(!o){Wt(`fonts[${t}] skipped: source_url is required`);return}if(!Ci(o)){Wt(`fonts[${t}] skipped: source_url must be https or relative, got "${o}"`);return}const i=vt(e.style);return{id:vt(e.id)||Hc(),name:vt(e.name)||n,family:n,source_url:o,source_kind:nd(o),weight:vt(e.weight)||"400",style:td.has(i)?i:"normal",order:0}},id=(e,t)=>{const n=bi(e?.url);if(!n||!Lc(n)){Wt(`socials[${t}] skipped: url must be https, got "${String(e?.url)}"`);return}const o=vt(e.icon_key),i=vt(e.icon_url);let s;if(i&&Ci(i)?s=i:i&&Wt(`socials[${t}]: icon_url must be https or relative, got "${i}" — icon dropped`),!o&&!s){Wt(`socials[${t}] skipped: icon_key or icon_url is required`);return}return{id:vt(e.id)||jc(),name:vt(e.name),url:n,icon_key:o,...s?{icon_url:s}:{},enabled:!0,order:0}},Xr=e=>e.map((t,n)=>({...t,order:n})),sd=e=>({colors:Xr(Qr(e?.colors??[],32,"colors").map(rd).filter(t=>t!==void 0)),fonts:Xr(Qr(e?.fonts??[],20,"fonts").map(od).filter(t=>t!==void 0)),socials:Xr(Qr(e?.socials??[],20,"socials").map(id).filter(t=>t!==void 0))}),ad={tg:"telegram",yt:"youtube",yd:"yandex_zen",tt:"tiktok",pi:"pinterest",ig:"instagram",fb:"facebook",xa:"x",tw:"twitter"},Ti="vk",ld=new Set(r.EM_SOCIAL_SELECT_ORDER),cd=e=>ld.has(e),Ii=e=>{const t=String(e??"").trim().toLowerCase();return t?cd(t)?t:ad[t]??Ti:Ti},dd=e=>Ii(e),ud=new Set(["normal","italic","oblique"]),pd=new Set(["uploaded","remote_file","google_stylesheet"]),Pt=e=>(e??"").trim(),wn=e=>Pt(e)||void 0,Ai=e=>typeof e=="number"&&e>0?e:void 0,md=e=>ud.has(e)?e:void 0,fd=e=>pd.has(e)?e:void 0,gd=(e,t)=>{const n=Yr(Pt(e.hex));return n?{id:Pt(e.id)||Ei(),name:Pt(e.name),hex:n,order:e.order??t}:null},xi=(e,t=0)=>({id:Pt(e.id),name:Pt(e.name),source_url:wn(e.source_url),source_kind:fd(e.source_kind),file_name:wn(e.file_name),family:wn(e.family),weight:wn(e.weight),style:md(e.style),preview_url:wn(e.preview_url),storage_fallback:e.storage_fallback||void 0,font_size_px:Ai(e.font_size_px),line_height_px:Ai(e.line_height_px),order:e.order??t}),hd=(e,t)=>{const n=Pt(e.url);return n?{id:Pt(e.id),name:Pt(e.name),url:n,icon_key:Ii(Pt(e.icon_key)),enabled:e.enabled??!0,order:e.order??t}:null},rn=e=>[...e].sort((t,n)=>t.order-n.order),Pi=e=>e?{colors:rn((e.colors??[]).map(gd).filter(t=>t!==null)),fonts:rn((e.fonts??[]).map(xi)),socials:rn((e.socials??[]).map(hd).filter(t=>t!==null))}:Rc,_d=e=>e==="remote_stylesheet"?"remote_file":e,yd=e=>{const t={};return e.colors&&(t.colors=rn(e.colors).map(n=>({id:n.id,name:n.name.trim(),hex:Yr(n.hex)||n.hex}))),e.fonts&&(t.fonts=rn(e.fonts).map(n=>({id:n.id,name:n.name.trim(),source_url:n.source_url??"",source_kind:_d(Yc(n)),file_name:n.file_name??"",family:n.family??"",weight:n.weight??"",style:n.style??"",preview_url:n.preview_url??"",storage_fallback:n.storage_fallback??!1,font_size_px:n.font_size_px??0,line_height_px:n.line_height_px??0}))),e.socials&&(t.socials=rn(e.socials).map(n=>({id:n.id,name:n.name.trim(),url:n.url,icon_key:dd(n.icon_key),enabled:n.enabled}))),t},Ri="ProjectBrandStyles",Qt=r.createApi({reducerPath:"projectSettingsStylesApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),tagTypes:[Ri],endpoints:e=>({getProjectStyles:e.query({async queryFn({projectId:t},n){const o=r.v2ResultOf(await r.getClientV2(h.getContainer(n)).projects.stylesList({id:String(t)}));return"error"in o?{error:o.error}:{data:Pi(o.data)}},providesTags:(t,n,{projectId:o})=>[{type:Ri,id:String(o)}]}),updateProjectStyles:e.mutation({async queryFn({projectId:t,patch:n},o){const i=r.v2ResultOf(await r.getClientV2(h.getContainer(o)).projects.stylesPartialUpdate({id:String(t)},yd(n)));return"error"in i?{error:i.error}:{data:Pi(i.data)}},async onQueryStarted({projectId:t,patch:n},{dispatch:o,queryFulfilled:i}){const s=o(Qt.util.updateQueryData("getProjectStyles",{projectId:t},c=>Object.assign(c,n)));try{const{data:c}=await i;o(Qt.util.upsertQueryData("getProjectStyles",{projectId:t},c))}catch{s.undo()}}}),uploadProjectFont:e.mutation({async queryFn({projectId:t,file:n},o){const i=new FormData;i.append("file",Wc(n));const s=r.v2ResultOf(await r.getClientV2(h.getContainer(o)).request({path:`/projects/${String(t)}/styles/fonts`,method:"POST",body:i,secure:!0,type:r.ContentType.FormData,format:"json"}));return"error"in s?{error:s.error}:{data:xi(s.data)}},async onQueryStarted({projectId:t},{dispatch:n,queryFulfilled:o}){try{const{data:i}=await o;n(Qt.util.updateQueryData("getProjectStyles",{projectId:t},s=>{s.fonts=s.fonts.some(c=>c.id===i.id)?s.fonts.map(c=>c.id===i.id?i:c):[...s.fonts,i],s.fonts.sort((c,d)=>c.order-d.order)}))}catch{}}})})}),{useGetProjectStylesQuery:vd,useUpdateProjectStylesMutation:$v,useUploadProjectFontMutation:Uv}=Qt,ji=e=>{const t=r.useIntegratorConfigValue("projectStyles"),{data:n}=vd({projectId:e},{skip:!0});return(0,l.useMemo)(()=>sd(t),[t])},bd=2.5,Ed=({atom:e,onSelect:t,onDragStart:n,isDroppedAtom:o})=>{const i=(0,l.useCallback)(d=>t(d,e),[t,e]),s=(0,l.useCallback)(d=>n(d,e,o),[n,e,o]),c=(0,l.useCallback)(d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),t(d,e))},[t,e]);return(0,a.jsxs)("button",{type:"button",className:"ant-card-hoverable atoms__item "+e.className+(e.isLockedByPlan?" atoms__item_locked":""),draggable:!0,onClick:i,onKeyDown:c,onDragStart:s,"data-test-name":e.name,children:[(0,a.jsxs)("span",{className:"atom-image",children:[e.icon,e.isLockedByPlan&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:12,strokeWidth:bd,className:"atom-image__lock"})]}),(0,a.jsx)("span",{className:"atom-title",children:e.title})]})},Oi=()=>{const e=r.useI18n(),{__:t}=e,n=r.useAppConfig(),o=r.useProjectData(),i=r.useCurrentUserLocale()||"en_US",s=xt.useSetHtmlAtomInIframeHandler(),c=xt.useDragStartAtomToIframeHandler(),[d,u]=(0,l.useState)(!1),[p,f]=(0,l.useState)(0),g=r.useMessageService(),y=r.useServices(h.ATOMS_HANDLERS_ID),m=r.useEventEmitter(h.HANDLE_ATOM_INSERT_ID),E=r.usePlanFeatureLocks(),k=vi(o?.id),w=ji(k),v=w?Nc(w.socials):[],x=v.length>0?gi(v):Sc;let P=[];if(n.elementImageEnabled&&P.push({title:t("Image"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementImage",component:_.icons$ElementImage,size:24,strokeWidth:n.iconStrokeWidth}),html:dc,className:"",name:"image"}),n.elementAIimageEnabled&&P.push({title:t("AI image"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementImageAI",component:_.icons$ElementImageAI,size:24,strokeWidth:n.iconStrokeWidth}),html:uc,className:"ai",name:"ai-image"}),n.elementTextEnabled&&P.push({title:t("Text"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementText",component:_.icons$ElementText,size:24,strokeWidth:n.iconStrokeWidth}),html:pc(e),className:"",name:"text"}),n.elementHeaderEnabled&&P.push({title:t("Header"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementTitle",component:_.icons$ElementTitle,size:24,strokeWidth:n.iconStrokeWidth}),html:mc(e),className:"",name:"header"}),n.elementButtonEnabled&&P.push({title:t("Button"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementButton",component:_.icons$ElementButton,size:24,strokeWidth:n.iconStrokeWidth}),html:fc(e),className:"",name:"button"}),n.elementSpacerEnabled&&P.push({title:t("Spacer"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementSpacer",component:_.icons$ElementSpacer,size:24,strokeWidth:n.iconStrokeWidth}),html:yc,className:"",name:"spacer"}),n.elementListULEnabled&&P.push({title:t("List UL"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementListUL",component:_.icons$ElementListUL,size:24,strokeWidth:n.iconStrokeWidth}),html:gc(e),className:"",name:"list-ul"}),n.elementListOLEnabled&&P.push({title:t("List OL"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementListOL",component:_.icons$ElementListOL,size:24,strokeWidth:n.iconStrokeWidth}),html:hc(e),className:"",name:"list-ol"}),n.elementDividerEnabled&&P.push({title:t("Divider"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementDivider",component:_.icons$ElementDivider,size:24,strokeWidth:n.iconStrokeWidth}),html:_c,className:"",name:"divider"}),n.elementSocialEnabled&&P.push({title:t("Social media"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementSocial",component:_.icons$ElementSocial,size:24,strokeWidth:n.iconStrokeWidth}),html:x,className:"",name:"social"}),n.elementTableEnabled&&P.push({title:t("Table"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementTable",component:_.icons$ElementTable,size:24,strokeWidth:n.iconStrokeWidth}),html:wc(e),className:"",name:"table"}),n.elementCountdownEnabled&&P.push({title:t("Countdown"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementCountdown",component:_.icons$ElementCountdown,size:24,strokeWidth:n.iconStrokeWidth}),html:Tc(i),className:"",name:"countdown"}),n.elementVideoEnabled&&P.push({title:t("Video"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementVideo",component:_.icons$ElementVideo,size:24,strokeWidth:n.iconStrokeWidth}),html:Ic,className:"",name:"video"}),n.elementCarouselEnabled&&P.push({title:t("Carousel"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementCarousel",component:_.icons$ElementCarousel,size:24,strokeWidth:n.iconStrokeWidth}),html:Ac(e),className:"amp",name:"amp-carousel"}),n.elementAccordionEnabled&&P.push({title:t("Accordion"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementAccordion",component:_.icons$ElementAccordion,size:24,strokeWidth:n.iconStrokeWidth}),html:xc(e),className:"amp",name:"amp-accordion"}),n.elementFormEnabled&&P.push({title:t("Form"),icon:(0,a.jsx)(r.EmIcons,{icon:"ElementForm",component:_.icons$ElementForm,size:24,strokeWidth:n.iconStrokeWidth}),html:null,className:"amp",name:"amp-form"}),P=P.map(A=>({...A,fallbackTooltip:t("Coming soon"),planFeature:yi(A.name),isLockedByPlan:E(yi(A.name))})),y){const A={value:P};for(const O of y)O.execute(A);P=A.value}(0,l.useEffect)(()=>{const{dispose:A}=g.addListener(r.EVENT_TYPES.APPLICATION_ATOM_INSERTED,O=>{const z=P.find(B=>B.name===O);z&&m.fire(z)});return()=>A()},[g,P,m]);const K=(0,l.useCallback)(A=>{u(!0),f(A.planFeature?r.FEATURE_UPSELL_SLIDE[A.planFeature]:1)},[]),J=(0,l.useCallback)(A=>A.isLockedByPlan?(setTimeout(()=>K(A),1e3),!1):!0,[K]),N=(0,l.useCallback)((A,O)=>{if(O.isLockedByPlan){K(O);return}s(A,O)},[K,s]),L=(0,l.useCallback)((A,O,z)=>{c(A,O,z)},[c]);return(0,a.jsxs)("div",{className:"atoms",children:[(0,a.jsx)("div",{className:"atoms__list",children:(0,a.jsx)(_.ui_kit$Space,{wrap:!0,style:{justifyContent:"space-between",rowGap:10},children:P&&P.map((A,O)=>A.html?(0,a.jsx)(Ed,{atom:A,onSelect:N,onDragStart:L,isDroppedAtom:J},A.title+O.toString()):(0,a.jsx)(_.ui_kit$Tooltip,{title:A.fallbackTooltip||t("Coming soon"),placement:"top",children:(0,a.jsxs)("div",{className:"atoms__item atoms__item_inactive "+A.className,"data-test-name":A.name,children:[(0,a.jsx)("span",{className:"atom-image",children:A.icon}),(0,a.jsx)("span",{className:"atom-title",children:A.title})]},A.title+O.toString())},A.title+O.toString()))})}),(0,a.jsx)(r.PlanUpgradePrompt,{open:d,onCancel:()=>u(!1),initialSlide:p})]})};Oi.propTypes={};var Sd={full:{flexGrow:1},768:{width:171},425:{width:25},375:{width:28},320:{width:320}},Li={right:-12,top:4,zIndex:999,padding:0,position:"absolute"},wd=[{kind:"full",width:1200},{kind:"768",width:768},{kind:"425",width:425},{kind:"375",width:375},{kind:"320",width:320,showLabel:!0},{kind:"375",width:375},{kind:"425",width:425,control:"mobile"},{kind:"768",width:768,control:"desktop"},{kind:"full",width:1200}];function kd({kind:e,width:t,label:n,onSelect:o,onHover:i,children:s}){const c=(0,l.useCallback)(()=>i(e,n),[i,e,n]),d=(0,l.useCallback)(()=>i(null,""),[i]),u=(0,l.useCallback)(()=>o(t),[o,t]),p=(0,l.useCallback)(f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o(t))},[o,t]);return(0,a.jsx)("div",{className:`device-width__${e}`,style:Sd[e],role:"button",tabIndex:0,"aria-label":n,onMouseEnter:c,onMouseLeave:d,onClick:u,onKeyDown:p,children:s})}function Cd({onSelectWidth:e,themeToggle:t}){const{__:n}=r.useI18n(),[o,i]=(0,l.useState)(""),[s,c]=(0,l.useState)(""),d={full:n("Desktop"),768:n("Small desktop – 768px"),425:n("Mobile L – 425px"),375:n("Mobile M – 375px"),320:n("Mobile S – 320px")},u=(0,l.useCallback)((p,f)=>{i(p?`device-width__${p}-hovered`:""),c(f)},[]);return(0,a.jsx)("div",{className:`email-pane__sizes ${o}`,children:(0,a.jsxs)("div",{className:"email-pane__width-selectors-wrapper",children:[(0,a.jsx)("div",{className:"device-width__theme",children:t}),wd.map((p,f)=>(0,a.jsxs)(kd,{kind:p.kind,width:p.width,label:d[p.kind],onSelect:e,onHover:u,children:[p.showLabel?s:null,p.control==="mobile"&&(0,a.jsx)(_.ui_kit$Tooltip,{title:n("Mobile view"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:"default",icon:(0,a.jsx)(r.EmIcons,{icon:"MobileOutlined",component:_.icons$MobileOutlined,size:16,strokeWidth:2}),size:"small",shape:"circle",style:Li})}),p.control==="desktop"&&(0,a.jsx)(_.ui_kit$Tooltip,{title:n("Desktop view"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:"default",icon:(0,a.jsx)(r.EmIcons,{icon:"DesktopOutlined",component:_.icons$DesktopOutlined,size:16,strokeWidth:2}),size:"small",shape:"circle",style:Li})})]},`${p.kind}-${f}`)),(0,a.jsx)("div",{className:"device-width__theme-placeholder"})]})})}var $e=zt.__toESM(r.require_prop_types()),Mi=h.createIdentifier$1("canvas.resizerBinder"),Td=h.createIdentifier$1("canvas.service"),zv={created:r.PHASES.canvasCreated,loaded:r.PHASES.canvasLoaded};function Id(e){return e.getInstance(Td)}function Ni(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}))}}var Ad={canUndo:!1,canRedo:!1},xd={undo:()=>{},redo:()=>{},clear:()=>{},canUndo:()=>!1,canRedo:()=>!1,createSnapshot:()=>{},restoreSnapshot:()=>{},getPast:()=>[],getFuture:()=>[]};function Jr(e){const t=r.useDocumentSessionContext(),{history:n}=e??t;return(0,l.useMemo)(()=>n?Ni(n):xd,[n])}function Pd(){const{history:e}=r.useDocumentSessionContext(),t=(0,l.useCallback)(i=>e?e.subscribe(i):()=>{},[e]),n=(0,l.useRef)(null),o=(0,l.useCallback)(()=>{if(!e)return Ad;const i={canUndo:e.canUndo(),canRedo:e.canRedo()},s=n.current;return s&&s.canUndo===i.canUndo&&s.canRedo===i.canRedo?s:(n.current=i,i)},[e]);return(0,l.useSyncExternalStore)(t,o)}var Di=2e3,Rd=10,jd="iframe_errors",Od=5;function Ld(e){const{__:t}=r.useI18n(),n=r.useMessageService(),o=Jr(),{error:i}=r.useNotification(),{document:s}=r.useDocumentSessionContext(),c=(0,l.useCallback)(()=>s?.getContent()??"",[s]),d=(0,l.useRef)(0),u=(0,l.useRef)(void 0),p=(0,l.useRef)(!1),f=r.useCurrentUser(),g=(0,l.useCallback)(m=>new Promise((E,k)=>{const w=n.addListener(r.EVENT_TYPES.SANDBOX_READY,()=>{w.dispose(),E()});m&&setTimeout(()=>{w.dispose(),k("timeout")})}),[n]),y=(0,l.useCallback)(m=>{g(Di).catch(E=>{}).finally(()=>{Promise.resolve().then(()=>{if(!p.current){if(++d.current){if(u.current){if(d.current<Od){o.restoreSnapshot(u.current);for(let E=0;E<d.current;E++)o.undo()}}else u.current=o.createSnapshot();n.send(r.EVENT_TYPES.RELOAD)}setTimeout(()=>{if(--d.current===0){u.current=null;const E=new Error(m.message);m.stack&&(E.stack=m.stack);const k=r.reportError(E,{origin:"iframe"}),w={past:o.getPast(Rd),future:o.getFuture(),errorResolved:!p.current,text:c(),message:m.message,stack:m.stack,userId:f?.id,entityId:e?.id,entityType:document.location.pathname.indexOf("emails")>0?"email":"block",sentryEventId:k};i({id:"IFRAME_ERROR",data:w,title:t("Something went wrong")}),h.RACS.post(jd,w).catch(v=>{}),p.current=!1}},Di)}})})},[o,c,i,f?.id,e?.id,t,g,n]);r.useListenPostMessage(r.EVENT_TYPES.APPLICATION_DOMPARSER_ERROR,y)}function Md(e,t){const n=JSON.stringify(t??{});Nd(e?.get().attributes.common_styles,n)||r.writeEmailAttributes(e,{common_styles:n})}function Nd(e,t){if(e===t)return!0;try{return h.deepEqual(JSON.parse(e||"{}"),JSON.parse(t||"{}"))}catch{return!1}}var Wn=Symbol("isIframeEvent");function Dd({children:e}){const[t,n]=(0,l.useState)(),[o,i]=(0,l.useState)(),[s,c]=(0,l.useState)(!1),d=r.useMessageService();return(0,l.useEffect)(()=>{if(t){const u=d.addListener(r.EVENT_TYPES.APPLICATION_IFRAME_DRAG_EVENT,p=>{if(p.type!=="drageleave"&&p.type!=="dragenter"){const f=t.getBoundingClientRect(),g=p.clientX+f.x+window.scrollX,y=p.clientY+f.y+window.scrollY,m=document.elementFromPoint(g,y);if(m){const E=new DataTransfer,k=new DragEvent(p.type,{clientX:g,clientY:y,cancelable:!0,bubbles:!0,dataTransfer:E});k[Wn]=!0,m.dispatchEvent(k)}}});return()=>u.dispose()}},[d,t]),(0,l.useEffect)(()=>{const u=f=>{f[Wn]||c(!0)},p=f=>{f[Wn]||c(!1)};return window.addEventListener("dragstart",u),window.addEventListener("dragend",p),()=>{window.removeEventListener("dragstart",u),window.removeEventListener("dragend",p)}},[o]),(0,l.useEffect)(()=>{const u=p=>{if(!p[Wn]){const f=o.getBoundingClientRect();d.send(r.EVENT_TYPES.SANDBOX_DRAG_EVENT,{value:p.dataTransfer?.getData("Text")||"",type:p.type,clientX:p.pageX-f.x-window.scrollX,clientY:p.pageY-f.y-window.scrollY})}};if(o)return o.addEventListener("dragenter",u),o.addEventListener("dragover",u),o.addEventListener("dragleave",u),o.addEventListener("drop",u),o.addEventListener("dragend",u),()=>{o.removeEventListener("dragenter",u),o.removeEventListener("dragover",u),o.removeEventListener("dragleave",u),o.removeEventListener("drop",u),o.removeEventListener("dragend",u)}},[o,d]),(0,a.jsxs)("div",{ref:n,children:[s&&(0,a.jsx)("div",{ref:i,className:"iframe-provider"}),e]})}var Fd=["colorBgBase","colorBgElevated","colorError","colorInfo","colorInfoBg","colorInfoBgHover","colorInfoBorder","colorInfoBorderHover","colorLink","colorPrimary","colorPrimaryBg","colorPrimaryBgHover","colorPrimaryBorder","colorPrimaryBorderHover"];function Bd(e){const t={};for(const n of Fd){const o=e[n];typeof o=="string"&&(t[n]=o)}return t}function Zr(e,t){const n=r.useMessageService(),o=t?.async??!1;(0,l.useEffect)(()=>{const i=o?n.addListenerAsync(r.EVENT_TYPES.RELOAD,e):n.addListener(r.EVENT_TYPES.RELOAD,e);return()=>i.dispose()},[n,e,o]),(0,l.useEffect)(()=>{},[e])}function $d(){const e=r.useMessageService(),{token:t}=(0,_.ui_kit$useToken)(),[n,o]=(0,l.useState)();(0,l.useEffect)(()=>{if(!h.deepEqual(n,t)){const s=e.onInit(()=>{e.send(r.EVENT_TYPES.SANDBOX_SET_THEME_VARIABLES,Bd(t)),o(t)});return()=>s.dispose()}},[t,n,o,e]);const i=(0,l.useCallback)(()=>{o(void 0)},[]);Zr(i)}var Ud={minHeight:600},zd="#pane-content-wrapper, .email-pane__col_preview, .preview-mode__pane-content";function Fi(e){e?.current?.resize?.()}var Bi=(0,l.forwardRef)(({className:e=null,email:t=null,handlerSendPosition:n=()=>{},surface:o,clip:i=null},s)=>{const c=r.useAppConfig(),d=r.useContainer(),u=o??(t?.hasOwnProperty("type")?"block":"email"),p=(0,l.useMemo)(()=>Id(d),[d]),f=(0,l.useMemo)(()=>p?.current(u),[p,u]),g=(0,l.useRef)(null),y=(0,l.useCallback)(()=>{r.mark(r.PHASES.canvasLoaded),Fi(s),n()},[n,s]);(0,l.useImperativeHandle)(s,()=>({getIframeElement:()=>p?.current(u)?.element,resize:()=>p?.current(u)?.resize()}),[p,u]),(0,l.useEffect)(()=>{if(!p)return;const w=g.current,v=i??w?.closest(zd)??null;return p.alignSurface(u,w,v),()=>p.alignSurface(u,null)},[p,u,i,c.sidePanelFloating]);const m=(0,l.useRef)(y);m.current=y,(0,l.useEffect)(()=>{if(!f)return;let w=!1;const v=()=>{w||m.current({target:f.element})};return f.ready().then(v).catch(()=>{window.requestAnimationFrame(()=>{w||f.ready().then(v).catch(()=>{})})}),()=>{w=!0}},[f]),$d(),Ld(t);const{document:E}=r.useDocumentSessionContext();(0,l.useEffect)(()=>{const w=r.subscribeToContent(E,()=>{Fi(s)});return()=>w.dispose()},[E,s]);const k=(0,l.useCallback)(w=>{const{operation:v,settings:x}=w.data;v===r.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE&&Md(E,x?.commonStyles)},[E]);return r.useListenPostMessage(k),(0,a.jsx)(Dd,{children:(0,a.jsx)("div",{ref:g,className:(0,rt.default)("email-preview",e),id:"email_iframe_slot",style:Ud})})});Bi.propTypes={className:$e.default.string,surface:$e.default.oneOf(["email","block","preview"]),email:$e.default.shape({html:$e.default.string}),handlerSendPosition:$e.default.func,clip:$e.default.object};var eo=new Map,Gd=new Map;function Wd(e,t){e.set(t,(e.get(t)??0)+1)}function Hd(e,t){const n=e.get(t)??0;n<=1?e.delete(t):e.set(t,n-1)}function $i(e,t){return(e.get(t)??0)>0}function qd(e){return $i(eo,e)||$i(Gd,e)}function Vd(e){Wd(eo,e);let t=!1;return{dispose(){t||(t=!0,Kd(e))}}}function Kd(e){Hd(eo,e)}function Yd(e,t){return Xd([...e.changes].sort((n,o)=>n.rangeOffset-o.rangeOffset).map(n=>({start:n.rangeOffset,end:n.rangeOffset+n.rangeLength,text:n.text})),t)}function Qd(e,t){return e.map(n=>{const o=t.getPositionAt(n.oldPosition),i=t.getPositionAt(n.oldEnd);return{text:n.newText,range:{startLineNumber:o.lineNumber,startColumn:o.column,endLineNumber:i.lineNumber,endColumn:i.column}}})}function Xd(e,t){let n=0;return e.map(({start:o,end:i,text:s})=>{const c=new r.TextChange(o,t.slice(o,i),o+n,s);return n+=s.length-(i-o),c})}var Ui=new WeakMap;function Jd(e){const t=Ui.get(e);if(t)return t;const n=Ml(e);return Ui.set(e,n),n}var zi="monaco";function Zd(e,t){(0,l.useEffect)(()=>{if(!e||!t)return;const n=Jd(e);let o=!1;const i=d=>{o=!0;const u=Vd(t);try{d()}finally{u.dispose(),o=!1}},s=n.attach({id:zi,apply(d){return t.getValue()!==d&&i(()=>t.setValue(d)),Promise.resolve()},applyChanges(d){return i(()=>t.applyEdits(Qd(d,t))),Promise.resolve()}}),c=t.onDidChangeContent(d=>{if(o)return;const u=qd(t)?"remote":"user";n.mutateFrom(zi,{changes:Yd(d,e.getContent())},{source:u})});return()=>{s.detach(),c.dispose()}},[e,t])}function eu(e,t){const[n,o]=(0,l.useState)(void 0),i=(0,l.useRef)(!1),{error:s}=r.useNotification(),{__:c}=r.useI18n(),d=(0,l.useRef)(t);d.current=t;const u=(0,l.useRef)({error:s,__:c});u.current={error:s,__:c},(0,l.useEffect)(()=>{if(!e||n||i.current)return;i.current=!0;let f=!1;return d.current().then(g=>{if(f){g.dispose();return}o(g)}).catch(()=>{const{error:g,__:y}=u.current;g({id:"CODE_EDITOR_LOAD_FAILED",title:y("Failed to load the code editor")})}).finally(()=>{i.current=!1}),()=>{f=!0}},[e,n]);const p=(0,l.useRef)(void 0);return p.current=n,(0,l.useEffect)(()=>()=>{p.current?.dispose()},[]),n}var Hn;function to(){return Hn===void 0&&(Hn=(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/ddb5a35d.js")),void 0,{}.url).catch(e=>{throw Hn=void 0,e})),Hn}function tu(){return to().then(e=>e.ensureMonaco())}var nu=r.lazyRoute(()=>to().then(e=>({default:e.MonacoEditor}))),ru=()=>to().then(e=>e.loadEditorModel()),ou={height:"100%"};function iu(e){const t=eu(!0,ru),{document:n}=r.useDocumentSessionContext();return(0,l.useEffect)(()=>{},[]),(0,l.useEffect)(()=>{},[t]),Zd(n,t),(0,a.jsx)(r.EditorModelContext.Provider,{value:t,children:(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(_.ui_kit$Flex,{justify:"center",align:"center",style:ou,children:(0,a.jsx)(_.ui_kit$Spin,{size:"large"})}),children:(0,a.jsx)(nu,{...e})})})}var su=({elementPath:e})=>{const{_x:t}=r.useI18n(),n=r.useDispatch(),o=r.useMessageService(),i=r.useAppConfig(),{blockId:s}=r.useRouteParams(),c=r.useEditorProjectId(),d=r.useRouteEmailId(),u=r.useProjectData(),p=r.usePushToDataLayer(),f=(0,l.useCallback)(x=>{o.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_SET,index:x})},[o]),g=(0,l.useCallback)(x=>{let P="element";x?.target?.closest("svg")||x?.target?.closest(".anticon")||x?.target?.closest('[class*="icon"]')?P="icon":x?.target?.textContent&&!x?.target?.closest("svg")&&!x?.target?.closest(".anticon")&&(P="text"),n(r.setActiveSettingsTab(r.STYLES)),o.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),o.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),p({event:"click",action:"click_breadcrumb_email",email_id:d||s,project_id:u?.id||c,click_target:P})},[o,n,p,d,s,c,u]),y={title:(0,a.jsxs)("span",{onClick:g,children:[(0,a.jsx)(r.EmIcons,{icon:"Email",component:_.icons$Email,size:16,strokeWidth:i.iconStrokeWidth})," ",t("Email","letter")]})},[m,E]=(0,l.useState)([y]),k=(0,l.useCallback)(x=>{o.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_HOVER_SET,index:x})},[o]),w=x=>{if(x.includes("em-element-path-item-text"))return(0,a.jsx)(r.EmIcons,{icon:"ElementText",component:_.icons$ElementText,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-image"))return(0,a.jsx)(r.EmIcons,{icon:"ElementImage",component:_.icons$ElementImage,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-link"))return(0,a.jsx)(r.EmIcons,{icon:"LinkOutlined",component:_.icons$LinkOutlined,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-atom"))return(0,a.jsx)(r.EmIcons,{icon:"Atom",component:_.icons$Atom,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-column"))return(0,a.jsx)(r.EmIcons,{icon:"Column",component:_.icons$Column,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-block"))return(0,a.jsx)(r.EmIcons,{icon:"Block",component:_.icons$Block,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-group"))return(0,a.jsx)(r.EmIcons,{icon:"Group",component:_.icons$Group,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-button"))return(0,a.jsx)(r.EmIcons,{icon:"ElementButton",component:_.icons$ElementButton,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-table"))return(0,a.jsx)(r.EmIcons,{icon:"ElementTable",component:_.icons$ElementTable,size:16,strokeWidth:i.iconStrokeWidth});if(x.includes("em-element-path-item-amp"))return(0,a.jsx)(r.EmIcons,{icon:"AMP",component:_.icons$AMP,size:16,strokeWidth:i.iconStrokeWidth})},v=(0,l.useCallback)((x,P)=>{const K=J=>{let N="element";J.target.closest("svg")||J.target.closest(".anticon")||J.target.closest('[class*="icon"]')?N="icon":J.target.textContent&&!J.target.closest("svg")&&!J.target.closest(".anticon")&&(N="text");const L=e?.[P],A=L?.className?.replace("em-element-path-item-","")||"unknown";p({event:"click",action:"click_breadcrumb_element",email_id:d||s,project_id:u?.id||c,element_type:A,element_index:P,element_title:L?.title||"",click_target:N}),f(P)};return(0,a.jsxs)("span",{className:x.className,onClick:K,onMouseOver:()=>{k(P)},children:[w(x.className)," ",x.title]})},[f,k,e,p,d,s,c,u]);return(0,l.useEffect)(()=>{if(e){const x=e.map((P,K)=>({title:v(P,K)}));E([{title:(0,a.jsxs)("span",{onClick:g,children:[(0,a.jsx)(r.EmIcons,{icon:"Email",component:_.icons$Email,size:16,strokeWidth:i.iconStrokeWidth})," ",t("Email","letter")]})},...x])}},[e,v,g,t]),(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(_.ui_kit$Breadcrumb,{items:m,type:"separator",separator:""})})};function au(){const{document:e}=r.useDocumentSessionContext(),t=(0,l.useCallback)(o=>e?e.subscribe(o):()=>{},[e]),n=(0,l.useCallback)(()=>e?.getContent()??"",[e]);return(0,l.useSyncExternalStore)(t,n)}var lu=({fallbackHtml:e})=>{const{__:t}=r.useI18n(),n=au(),o=(0,l.useMemo)(()=>r.getCodeSize(n||e||""),[e,n]),i=r.formatCodeSize(o),s=r.isCodeSizeExceeded(o);return(0,a.jsx)(_.ui_kit$Tooltip,{placement:"left",title:t(s?"The code size exceeds the recommended value 90kB":"Code size"),children:(0,a.jsx)("span",{className:(0,rt.default)("email-pane__code-size",{"email-pane__code-size_exceeded":s}),children:i})})};function Gi(e){const{limits:t,isLoaded:n}=r.useProjectPlanLimits();return r.useProjectData(),(0,l.useMemo)(()=>({isLocked:!1,state:{state:"allowed"},isPlanDataReady:n,exceeded:null}),[!1,e,t,n])}var cu=({open:e,onClose:t})=>{const{__:n}=r.useI18n();return(0,a.jsxs)(_.ui_kit$Modal,{open:e,centered:!0,closable:!1,mask:{closable:!1},footer:null,width:520,className:"browser-extension-warning-modal",title:n("Browser extension detected"),onCancel:t,children:[(0,a.jsx)("p",{children:n("A browser extension (for example, Urban VPN Proxy or similar ad blockers/VPN tools) is injecting code into the email preview. This can corrupt your template when saving.")}),(0,a.jsx)("p",{children:n("We removed the injected code automatically. To avoid this issue, disable the extension for this site or use the editor in an incognito window without extensions.")}),(0,a.jsx)("div",{className:"browser-extension-warning-modal__footer",children:(0,a.jsxs)(_.ui_kit$Button,{type:"primary",onClick:t,children:[n("Got it")," "]})})]})},du={closable:!1},uu=({open:e,onClose:t})=>{const{__:n}=r.useI18n();return(0,a.jsxs)(_.ui_kit$Modal,{open:e,centered:!0,closable:!1,mask:du,footer:null,width:520,className:"browser-translate-warning-modal",title:n("Browser translation detected"),children:[(0,a.jsx)("p",{children:n("Browser page translation (for example, Google Translate) is active. It can break the editor and cause errors when saving.")}),(0,a.jsx)("p",{children:n("To avoid this issue, disable translation for this site in your browser settings or turn off auto-translate.")}),(0,a.jsx)("div",{className:"browser-translate-warning-modal__footer",children:(0,a.jsx)(_.ui_kit$Button,{type:"primary",onClick:t,children:n("Got it")})})]})},pu=h.createIdentifier$1("prewarm.editorVisible");function mu(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function fu(e={}){const t=e.paint??mu;let n=!1,o=!1,i=!1,s=!1,c=!1;const d=[],u=()=>{c||s||!n||!o||!i||(s=!0,t(()=>{c=!0,r.mark(r.PHASES.editorVisible);for(const p of d.splice(0))p()}))};return{noteShellVisible(){n=!0,u()},notePagePainted(){o=!0,u()},noteContentShown(){i=!0,u()},whenVisible(p){if(c){p();return}d.push(p)},contentShown:()=>i}}function Ht(e){return e.getOrCreateInstance(pu,()=>fu())}function kn(e){const t=(0,l.useRef)(!1);return e&&(t.current=!0),t.current}var Wi=4e3;function Xt(e){const t=window.requestIdleCallback;if(typeof t=="function"){t(e,{timeout:Wi});return}window.setTimeout(e,Wi)}var qn,no;function ro(){return qn===void 0&&(qn=(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/b97bd382.js")).then(e=>e.panels_exports).then(e=>(no=e,e),e=>{throw qn=void 0,e}),void 0,{}.url)),qn}function gu(e){(0,l.useEffect)(()=>{Ht(e).whenVisible(()=>{Xt(()=>{ro().catch(()=>{})})})},[e])}function ut(e){const t=r.lazyRoute(()=>ro().then(o=>({default:o[e]})),"panels");function n(o){const[i]=(0,l.useState)(()=>no?no[e]:t);return(0,l.createElement)(i,o)}return n.displayName=`PanelDoor(${String(e)})`,n}var Hi=ut("EmailProperties"),hu=ut("SelectedElementPanel"),_u=ut("EmailSettings"),yu=ut("EmailStyles"),vu=ut("DiscussAi"),bu=ut("Optimise"),Eu=ut("FileManagerDataLayer"),Su=ut("BlocksSearch"),wu=ut("Discuss"),ku=ut("HistoryPanel"),Cu=ut("AddNewBlockModal"),Tu=ut("AddAllBlocksModal"),Iu=ut("SendTestEmailModal"),Au=ut("SaveBlockBtn"),oo=ut("LimitUpgradeModal"),xu={height:"100%"},Pu=()=>{const e=r.useContainer(),t=r.isImageCenterModal(r.useSelector(r.selectActiveModal$1)),[n,o]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{e&&Ht(e).whenVisible(()=>o(!0))},[e]),kn(n||t)?(0,a.jsx)(l.Suspense,{fallback:t?(0,a.jsx)(_.ui_kit$PageLoader,{style:xu}):null,children:(0,a.jsx)(Eu,{})}):null},Vn;function Ru(){return Vn===void 0&&(Vn=(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/3bd1b21b.js")),void 0,{}.url).catch(e=>{throw Vn=void 0,e})),Vn}function Cn(e){return r.lazyRoute(()=>Ru().then(t=>({default:t[e]})),"form-panels")}var Gv=Cn("FormEditorCalendarPanel"),Wv=Cn("FormEditorCheckboxPanel"),Hv=Cn("FormEditorDropdownListPanel"),qv=Cn("FormEditorInputPanel"),Vv=Cn("FormEditorRadioPanel");function ju(){try{const e=new URLSearchParams(window.location.search).get("deferChrome");return e===null?void 0:e!=="0"&&e!=="false"}catch{return}}function Ou(e,t){const n=ju()??r.readLocalToggle(r.LOCAL_STORAGE_ITEMS.em_defer_chrome);if(n!==void 0)return n;const o=t?.deferEditorChrome;return typeof o=="boolean"?o:o&&typeof o=="object"?o[e]??!0:{}.REACT_APP_DEFER_EDITOR_CHROME_DEFAULT!=="false"}function qi(e){const t=r.useAppConfig(),[n,o]=(0,l.useState)(()=>!Ou(e,t));return(0,l.useEffect)(()=>{if(n)return;let i=0;const s=window.requestAnimationFrame(()=>{i=window.requestAnimationFrame(()=>(0,l.startTransition)(()=>o(!0)))});return()=>{window.cancelAnimationFrame(s),window.cancelAnimationFrame(i)}},[n]),n}var Vi=r.createState({blocksTotal:null,blocksTotalPages:null,parentEmailBlocksTotal:null,parentEmailBlocksTotalPages:null,templateBlocks:[],templateBlocksTotal:null,templateBlocksTotalPages:null,elementsView:r.CARDS,elementsList:[],customFolders:{},blocksTrashTotal:0,elementsTrashList:[]}),Kn="blocksPageSlice",io=r.createSlice({name:Kn,initialState:Vi,reducers:{resetPagesAndTotal:()=>Vi,resetElementsList:e=>{e.elementsList=[]},toggleElementsView:(e,t)=>{e.elementsView=t.payload},removeBlockFromList:(e,{payload:t})=>{const n=e.customFolders;t.folder!=="all"&&n[t.folder]?.list&&(n[t.folder]={...n[t.folder],list:n[t.folder].list.filter(o=>o.id!==t.emailId),total:n[t.folder].total-1},e.customFolders=n)}},extraReducers:e=>{e.addMatcher(r.blocksApi.endpoints.getBlocks.matchFulfilled,(t,{meta:n,payload:o})=>{const i=n.baseQueryMeta?.response.headers.get("X-WP-Total")||o?.length,s=n.arg.originalArgs?.status==="trash",c=!!n.arg.originalArgs?.name?.length,d=n.arg.originalArgs?.page,u=n.arg.originalArgs?.folderTag||n.arg.originalArgs?.tags?.[0];s?(c||(t.blocksTrashTotal=i),t.elementsTrashList=o):u?t.customFolders={...t.customFolders,[u]:{list:o,page:d,total:i}}:(t.blocksTotal=i,t.elementsList=o)}),e.addMatcher(r.blocksApi.endpoints.getParentEmailBlocks.matchFulfilled,(t,{meta:n,payload:o})=>{const i=n.baseQueryMeta?.response.headers.get("X-WP-Total")||o?.length||null,s=n.baseQueryMeta?.response.headers.get("X-WP-TotalPages");t.parentEmailBlocksTotal=i,t.parentEmailBlocksTotalPages=s}),e.addMatcher(r.blocksApi.endpoints.getTemplateBlocks.matchFulfilled,(t,{meta:n,payload:o})=>{const i=n.baseQueryMeta?.response.headers.get("X-WP-Total")||o?.length||null,s=n.baseQueryMeta?.response.headers.get("X-WP-TotalPages");t.templateBlocks=o,t.templateBlocksTotal=i,t.templateBlocksTotalPages=s}),e.addMatcher(r.blocksApi.endpoints.editBlock.matchFulfilled,(t,{payload:n})=>{t.elementsList.map(o=>o.id?.toString()===n.id?.toString()?Object.assign(o,{lock:n.lock,title:n.title,blocktags:n.blocktags}):o)})}}),{resetPagesAndTotal:Kv,resetElementsList:Yv,toggleElementsView:Qv,removeBlockFromList:Xv}=io.actions,Lu=e=>e[Kn].blocksTotal,Mu=e=>e[Kn].templateBlocksTotal,Nu=e=>e[Kn].parentEmailBlocksTotal,Du=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 Ki(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 Yi(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(h.throwIfAborted(n),new Promise((o,i)=>{let s=!1,c,d;const u=f=>{s||(s=!0,c!==void 0&&(clearTimeout(c),c=void 0),d?.dispose(),n?.removeEventListener("abort",p),f())},p=()=>{u(()=>i(h.createAbortError(n?.reason)))};if(d=e.onInit(()=>{e.isInited()&&e.getTarget()&&u(()=>o())}),e.isInited()&&e.getTarget()){u(()=>o());return}t>0&&(c=setTimeout(()=>{u(()=>i(new Du(t)))},t)),n?.addEventListener("abort",p)}))}var Fu=()=>{try{return localStorage.getItem("em-debug-project-fonts")==="1"}catch{return!1}},Tn=(e,t)=>{Fu()},Bu=e=>[...e].sort((t,n)=>t.order-n.order).map(t=>t.hex.toUpperCase()),$u=(e,t)=>{const n=Array.isArray(e?.usedColors)?e.usedColors:[],o=new Set,i=[];for(const s of[...n,...Bu(t)]){const c=String(s??"").trim().toUpperCase();!c||o.has(c)||(o.add(c),i.push(s))}return{...e,usedColors:i}},Qi,Uu=e=>{Qi=e},Yn=e=>$u(e,Qi?.colors??[]),zu=e=>{const t=r.useMessageService(),n=ji(e),[o,i]=(0,l.useState)("");(0,l.useEffect)(()=>{Uu(n);const c=n?.fonts??[];r.setCachedProjectFonts(c),ed(c),Tn("parent: cache + host @font-face synced",{projectId:e,fontsCount:c.length,families:c.map(d=>d.family?.trim()||d.name)})},[n,e]),(0,l.useEffect)(()=>{const c=n?.fonts??[],d=Vc(c),u=JSON.stringify(d);if(u===o){Tn("parent: iframe send skipped (unchanged)",{entriesCount:d.length});return}Tn("parent: scheduling SANDBOX_SET_PROJECT_FONTS",{entriesCount:d.length,entries:d});const p=()=>{t.send(r.EVENT_TYPES.SANDBOX_SET_PROJECT_FONTS,d),i(u),Tn("parent: SANDBOX_SET_PROJECT_FONTS sent",{entriesCount:d.length})};if(t.inited){p();return}const f=t.onInit(()=>{p()});return()=>f.dispose()},[t,n,o]);const s=(0,l.useCallback)(()=>{Tn("parent: iframe reload — will resend project fonts map"),i("")},[]);Zr(s)};function Gu(e,t){const n=e,o=n?.data?.operation!==void 0?n.data:n;if(o?.operation===t)return o.file instanceof File?o.file:void 0}async function Wu(e,t){const{userId:n,folderId:o}=t.readContext();if(n==null||o==null||o==="")return{status:"skipped"};try{const i=await t.prepare(e),s=await t.upload({user_id:n,folder:String(o),file:i});if(s.error)return{status:"failed",error:s.error};const{extractUploadResult:c}=await(0,Ve.__vitePreload)(async()=>{const{extractUploadResult:u}=await Promise.resolve().then(()=>ye("./static/core/a50825ac.js")).then(p=>p.import_exports);return{extractUploadResult:u}},void 0,{}.url),d=c(s.data);return d.error||!d.file_url?{status:"skipped"}:{status:"uploaded",url:d.file_url}}catch(i){return{status:"failed",error:i}}}function Hu(){const[e,t]=(0,l.useState)(!1),n=r.useHeadless(),o=r.useEventEmitter(h.events.ON_BROWSER_EXTENSION_DETECTED_ID),i=(0,l.useCallback)(()=>{t(!1)},[]);return(0,l.useEffect)(()=>{const s=o.event(()=>{n||t(!0)});return()=>s.dispose()},[o,n]),{open:e,close:i}}function qu(){const[e,t]=(0,l.useState)(!1),n=r.useHeadless(),o=r.useEventEmitter(h.events.ON_BROWSER_TRANSLATE_DETECTED_ID),i=(0,l.useCallback)(()=>{t(!1)},[]);return(0,l.useEffect)(()=>{const s=o.event(()=>{n||t(!0)});return()=>s.dispose()},[o,n]),{open:e,close:i}}var Vu=["translated-ltr","translated-rtl"],Ku=".goog-te-banner-frame",so=!1;function Yu(e){if(e)return e;if(!(typeof document>"u"))return document}function Qu(e){const t=Yu(e);if(!t?.documentElement)return!1;const n=t.documentElement.classList;return Vu.some(o=>n.contains(o))?!0:t.querySelector(Ku)!=null}function Xu(){so=!1}function Ju(e){const t=Qu();return t&&!so&&e(),so=t,t}var Zu=500;function ep(){const e=r.useEventEmitter(h.events.ON_BROWSER_TRANSLATE_DETECTED_ID),t=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(typeof window>"u")return;const n=()=>{Ju(()=>{e.fire()})},o=()=>{t.current!=null&&clearTimeout(t.current),t.current=setTimeout(()=>{t.current=null,n()},Zu)};n();const i=()=>{o()},s=()=>{document.visibilityState==="visible"&&o()},c=new MutationObserver(()=>{o()});return c.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),window.addEventListener("focus",i),document.addEventListener("visibilitychange",s),()=>{t.current!=null&&clearTimeout(t.current),Xu(),c.disconnect(),window.removeEventListener("focus",i),document.removeEventListener("visibilitychange",s)}},[e])}var ao={},Xi=(0,l.createContext)(ao),Ji=(0,l.createContext)({current:ao}),Zi=(0,l.createContext)(()=>{});function tp({children:e}){const t=r.useDispatch(),n=r.useSelector(r.selectActiveSettingsTab),o=r.useEvent(h.SETTINGS_PANEL_EVENT),[i,s]=(0,l.useState)(ao),c=(0,l.useRef)(i);return c.current=i,(0,l.useEffect)(()=>{const d=o(u=>{const p=u?.type===h.ADVANCED_SETTINGS_PANEL;if((!u||!u.type&&!u.content&&!u.advancedTabs?.length)&&n==="Properties")s({}),t(r.resetToLastActiveSettingsTab());else if(n!=="Properties"&&t(r.setActiveSettingsTab(r.PROPERTIES)),u.advancedTabs?.length&&!p&&!u.content){const f=u.advancedTabs.map(g=>({content:g.content,label:g.label,key:g.key,className:g.className}));s(g=>({settings:{},extraTabs:f}))}else if(p&&u.content){const f=u.advancedTabs?.map(g=>({content:g.content,label:g.label,key:g.key,className:g.className}));s(g=>({settings:{},type:u.type,content:u.content,instanceKey:u.instanceKey,parent:u.parent,caption:u.caption,extraTabs:f,deletable:u.deletable}))}});return()=>d.dispose()},[o,s,t,n]),(0,a.jsx)(Zi.Provider,{value:s,children:(0,a.jsx)(Ji.Provider,{value:c,children:(0,a.jsx)(Xi.Provider,{value:i,children:e})})})}function lo(){return(0,l.useContext)(Xi)}function np(){return(0,l.useContext)(Ji)}function rp(){return(0,l.useContext)(Zi)}var es={widthCodeSplit:50,isResizing:!1,currentSide:null},ts=(0,l.createContext)({current:es}),ns=(0,l.createContext)(es.widthCodeSplit),rs=(0,l.createContext)({isResizing:!1,currentSide:null}),os=(0,l.createContext)({setWidthCodeSplit:()=>{},setIsResizing:()=>{},setCurrentSide:()=>{},setBlockMaxHeight:()=>{}}),is=(0,l.createContext)("unset");function op({children:e}){const[t,n]=(0,l.useState)(()=>+window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_code_mode_pane_sizes)||50),[o,i]=(0,l.useState)(!1),[s,c]=(0,l.useState)(null),[d,u]=(0,l.useState)("unset"),p=(0,l.useMemo)(()=>({widthCodeSplit:t,isResizing:o,currentSide:s}),[t,o,s]),f=(0,l.useMemo)(()=>({isResizing:o,currentSide:s}),[o,s]),g=(0,l.useRef)(p);g.current=p;const y=(0,l.useMemo)(()=>({setWidthCodeSplit:n,setIsResizing:i,setCurrentSide:c,setBlockMaxHeight:u}),[]);return(0,a.jsx)(os.Provider,{value:y,children:(0,a.jsx)(ts.Provider,{value:g,children:(0,a.jsx)(rs.Provider,{value:f,children:(0,a.jsx)(ns.Provider,{value:t,children:(0,a.jsx)(is.Provider,{value:d,children:e})})})})})}function ss(){return(0,l.useContext)(rs)}function as(){return(0,l.useContext)(ns)}function ip(){return(0,l.useContext)(ts)}function sp(){return(0,l.useContext)(is)}function ap(){return(0,l.useContext)(os)}var ls=(0,l.createContext)({previewAlertShow:!1,templateNotEmAlertShow:!1}),cs=(0,l.createContext)({setPreviewAlertShow:()=>{},setTemplateNotEmAlertShow:()=>{}});function lp({children:e}){const[t,n]=(0,l.useState)(!1),[o,i]=(0,l.useState)(!1),s=(0,l.useMemo)(()=>({previewAlertShow:t,templateNotEmAlertShow:o}),[t,o]),c=(0,l.useMemo)(()=>({setPreviewAlertShow:n,setTemplateNotEmAlertShow:i}),[]);return(0,a.jsx)(cs.Provider,{value:c,children:(0,a.jsx)(ls.Provider,{value:s,children:e})})}function cp(){return(0,l.useContext)(ls)}function dp(){return(0,l.useContext)(cs)}function up({className:e,sidePanelFloating:t,isCodeMode:n,codeModeDirection:o,children:i}){const s=sp(),c=(0,l.useMemo)(()=>{const d=Number.isFinite(s)?`${s}px`:"unset";return{"--ub-em-pane-block-height":t?n&&o==="bottom"?d:"calc(100% - 30px)":"100%"}},[t,n,o,s]);return(0,a.jsx)(_.ui_kit$Layout,{className:e,style:c,children:i})}function pp({maxPaneWidth:e,isCodeMode:t,codeModeDirection:n,isShowMobileSettings:o,desktopMobileSwitchPanel:i,children:s}){const c=r.useSelector(r.selectEmailWidth),{isResizing:d,currentSide:u}=ss(),p=t&&n!=="bottom"&&!o&&i?"100%":c,f=(0,l.useMemo)(()=>({maxWidth:typeof p=="number"?Math.min(p,e):e}),[p,e]);return(0,a.jsx)("div",{className:(0,rt.default)("email-pane__resizable",{"email-pane__resizable_drag":u||d}),style:f,children:s})}function mp({isCodeMode:e,codeModeDirection:t,sidePanelFloating:n,contentWrapperRef:o,children:i}){const s=as(),c=(0,l.useMemo)(()=>({flexGrow:1,overflowY:n?"scroll":"hidden",overflowX:"hidden",height:e&&t==="bottom"?`calc(${s}%)`:"100%",width:`${t==="left"?100-s:t==="bottom"?100:s}%`}),[e,t,n,s]);return(0,a.jsx)(_.ui_kit$Col,{style:c,id:"pane-content-wrapper",ref:o,children:i})}function fp({isCodeMode:e,codeModeDirection:t,children:n}){const o=as(),i=(0,l.useMemo)(()=>({width:`${t==="right"?100-o:t==="bottom"?100:o}%`,position:"relative",height:t==="bottom"?`calc(${100-o}%)`:"unset",display:e?"initial":"none"}),[e,t,o]);return(0,a.jsx)(_.ui_kit$Col,{style:i,children:n})}function gp({wrapperRef:e,children:t}){const{isResizing:n,currentSide:o}=ss();return(0,a.jsx)("div",{className:(0,rt.default)("email-pane__content-col email-pane__content-col_main",{"email-pane__content-col_disable":o||n}),ref:e,children:t})}function hp({isShowMobileSettings:e,headless:t,templateNotEmAlertEnabled:n}){const{__:o}=r.useI18n(),{previewAlertShow:i,templateNotEmAlertShow:s}=cp();return(0,a.jsxs)(a.Fragment,{children:[i&&e&&(0,a.jsx)(_.ui_kit$Alert,{title:o("Template is not mobile-friendly"),description:o("While editing, some elements of the email no longer fit the screen of the mobile device. Check that these elements are set to a smaller width for mobile devices."),type:"warning",className:"email-pane__col__alert",closable:!0}),s&&!t&&n&&(0,a.jsx)(_.ui_kit$Alert,{title:o("Template from another editor"),description:o("This template was created in another editor. Rebuild it from our components to get stable rendering, error-free editing, and full design control."),type:"warning",className:"email-pane__col__alert",closable:!0})]})}function ds(){const e=r.useElementEntityKind(),t=r.useSelector(r.selectElementSettings$1),n=r.useSelector(r.selectElementSettings);return e==="email"?t:n}function _p({isShowMobileSettings:e,propertiesPanelKey:t,onMouseLeave:n,email:o,onClosePanel:i}){const s=ds(),c=lo();return s?.type||c?.type||c?.content||c?.extraTabs?.length?(0,a.jsx)("div",{className:(0,rt.default)("email-pane__collapse-wrapper",{"mobile-view":e,"mobile-properties":e&&t!=="Structure"}),onMouseLeave:n,children:(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(_.ui_kit$PageLoader,{}),children:(0,a.jsx)(Hi,{email:o,formSettings:c,onClosePanel:i})})}):null}function yp({className:e,emailElementType:t}){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(_.ui_kit$PageLoader,{}),children:(0,a.jsx)(hu,{className:e,emailElementType:t,formSettings:lo()})})}function vp({isCodeMode:e,codeModeDirection:t}){const n=r.useElementEntityKind(),o=ds()?.type;return!(o===r.ELEMENT_TYPES.TEXT||o===r.ELEMENT_TYPES.LINK||o===r.ELEMENT_TYPES.IMG||o===r.ELEMENT_TYPES.BUTTON)||!e||t==="bottom"?null:(0,a.jsx)(yp,{className:(0,rt.default)("selected-element-panel__content selected-element-panel__content_abs",{"selected-element-panel__hidden":o===r.ELEMENT_TYPES.IMG}),emailElementType:n})}function bp({isCodeMode:e,codeModeDirection:t,email:n,onClosePanel:o}){const i=lo();return i?.type!=="img"||!e||t==="bottom"?null:(0,a.jsx)("div",{className:"email-pane__collapse-wrapper email-pane__collapse-wrapper_disabled",children:(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(_.ui_kit$PageLoader,{}),children:(0,a.jsx)(Hi,{email:n,formSettings:i,onClosePanel:o})})})}var Ep="code",Sp=(e,t)=>(0,a.jsx)(t,{className:"email-pane__tab-bar",...e}),{Content:wp}=_.ui_kit$Layout,kp=()=>{ro().catch(()=>{})},Jt=e=>(0,l.memo)(t=>(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(_.ui_kit$PageLoader,{}),children:(0,a.jsx)(e,{...t})})),Cp=Jt(vu),Tp=Jt(yu),Ip=Jt(bu),Ap=Jt(Su),xp=(0,l.memo)(e=>(0,a.jsx)(iu,{...e})),Pp=(0,l.memo)((0,l.forwardRef)((e,t)=>(0,a.jsx)(Bi,{...e,ref:t}))),Rp=(0,l.memo)(e=>(0,a.jsx)(Oi,{...e})),jp=Jt(_u),Op=Jt(ku),Lp=Jt(wu),us=({emailElement:e,isSuccess:t,setIsCollaborationEditor:n,isShowAddAllBlocksModal:o,triggerOpenSavedBlocksTab:i,setIsShowAddAllBlocksModal:s})=>{const{__:d,_x:u}=r.useI18n(),p=r.useMessageService(),{blockId:f}=r.useRouteParams(),g=r.useEditorProjectId(),y=r.useRouteEmailId(),m=r.useDispatch(),E=Vr(),k=r.useOpenPlanCatalog(),{modal:w}=_.ui_kit$App.useApp(),v=r.useAppConfig(),x=r.useConfigSource(),P=r.useHeadless(),K=r.useContainer(),J=qi("panel");gu(K),(0,l.useEffect)(()=>{Ht(K).notePagePainted()},[K]);const{token:N}=(0,_.ui_kit$useToken)(),L=r.useNotification(),A=r.usePushToDataLayer(),O=r.useProjectData(),z=vi(O?.id||g);zu(z);const B=r.useCookieManager(),U=r.useSelector(r.selectActiveSettingsTab),de=r.useCurrentUser(),me=r.toLanguageCode(r.useInterfaceLocale()),H=r.useStore(),Z=ip(),{setWidthCodeSplit:De,setIsResizing:ve,setCurrentSide:et,setBlockMaxHeight:be}=ap(),fe=r.useSelector(r.selectActiveModal$1),Y=r.useSelector(r.selectIsCodeMode),pe=r.useSelector(r.selectCodeModeDirection),[ie,se]=(0,l.useState)(Y);(0,l.useEffect)(()=>{Y&&se(!0)},[Y]);const Ae=r.useSelector(Lu),Te=r.useSelector(Mu),Fe=r.useSelector(Nu),X=r.useSelector(r.selectPropertiesPanelKey),[Ee]=r.useLazyClearAiChatQuery(),[Ie]=r.useUploadImageMutation(),ge=r.useSelector(r.selectEmailViewType)===r.MOBILE,[Re,Ue]=(0,l.useState)(r.LIGHT),[C,T]=(0,l.useState)(),[R,D]=(0,l.useState)(v.defaultBuildPanel||"empty"),[I,S]=(0,l.useState)("empty"),[ae,we]=(0,l.useState)(!1),[Ye,Qe]=(0,l.useState)([]),[ze,Ze]=(0,l.useState)([]),{setPreviewAlertShow:pt,setTemplateNotEmAlertShow:bt}=dp(),{open:ft,close:lt}=Hu(),{open:G,close:V}=qu();ep();const te=r.useRootElement(),ue=r.isEditorLockedByPlan(O,{isPlugin:!0}),he=r.usePlanFeatureGate("discussion"),Ge=r.usePlanFeatureGate("code_editor"),qe=Gi("ai"),st=qe.exceeded?r.getLimitUpgradePresetDefinition(qe.exceeded.presetId):null,Bt=v?.configSwither||!1;(0,l.useEffect)(()=>{m(r.resetParentBlocks())},[m]),(0,l.useEffect)(()=>{const b=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_active_tab);b&&m(r.setActiveSettingsTab(b))},[B,m]);const Le=y||f,Xe=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,oe=rp(),ee=np(),$=(0,l.useRef)(null),le=(0,l.useRef)(null),xe=(0,l.useRef)(),Se=(0,l.useRef)(),Me=(0,l.useRef)(null),We=(0,l.useRef)(),Be=(0,l.useRef)(),ot=(0,l.useRef)(null),fn=(0,l.useRef)(!1),Ot=(0,l.useRef)(!1),ct=(0,l.useCallback)(()=>{Ot.current=!1},[]),Et=(0,l.useCallback)(()=>{Ot.current=!0},[]),Lt=(0,l.useCallback)(b=>{b?.type===r.ELEMENT_TYPES.SOCIAL&&Et()},[Et]),[jn,On]=(0,l.useState)(!1),[gn,Ln]=(0,l.useState)(!1),[Mn]=r.useEditMeMutation(),[gt,St]=(0,l.useState)(!1),[ce,ke]=(0,l.useState)(0),[Ne,nt]=(0,l.useState)(!1),je=(0,l.useCallback)(()=>nt(!1),[]),Yt=(0,l.useCallback)(()=>{nt(!1),k()},[k]),[$t,dt]=(0,l.useState)(!1),Nn=v.configSwither?localStorage.getItem("configSwither")==="pro"?!0:localStorage.getItem("configSwither")==="editor"?!1:v.mode==="pro":!1,Ut=(0,l.useCallback)(()=>{clearTimeout(ot.current);const b=".blocks-search__result-holder";te.querySelector(b)&&(Ae||Te||Fe)&&(te.querySelector(b).style.removeProperty("transition"),te.querySelector(b).style.opacity=0,ot.current=setTimeout(()=>{r.measureBlockPreviews(te,207/640),te.querySelector(b)&&(te.querySelector(b).style.transition="opacity 0.2s",te.querySelectorAll(b).forEach(j=>j.style.opacity=1))},200))},[Te,Ae,Fe]),Tt=(0,l.useRef)(void 0),It=(0,l.useCallback)(b=>{const j=b.target;j&&(window.clearTimeout(Tt.current),Tt.current=window.setTimeout(()=>{On(!!j.closest(".desktop_view")),Ln(!!j.closest(".mobile_view"))},100))},[]);(0,l.useEffect)(()=>()=>{window.clearTimeout(Tt.current)},[]),(0,l.useEffect)(()=>{const b=r.addDocumentListenerFromShadow(te,"mouseover",It);return()=>{b.dispose()}},[te,It]),(0,l.useEffect)(()=>{typeof n=="function"&&(ze.length>0?n(!0):n(!1))},[ze]);const[Dr]=r.useSendMessageMutation(),{data:ht={},refetch:M,status:q}=r.useGetDialogQuery({entity_id:Le},{skip:!Le||v.aiAssistentEnabled===!1||ue}),Q=r.useEventEmitter(h.events.AI_TEXT_REQUEST_ID).hasListeners(),re=r.useIsStandalone(),ne=!Q&&!re,W=(0,l.useMemo)(()=>ne?[{data:{role:"assistant",message:d("Typing..."),isLoading:!0}}]:[],[ne,d]),[Ce,_e]=(0,l.useState)([]),[He,hn]=(0,l.useState)(v.defaultBuildPanel!==""?r.BLOCKS:r.ATOMS),Dn=(0,l.useRef)(null),mt=(0,l.useCallback)(()=>{const b=Se.current?.getBoundingClientRect(),j=C?.getBoundingClientRect();p.send({operation:r.EVENT_TYPES.SANDBOX_WINDOW_CHARACTERISTIC,settings:{iframeOffsetTop:Y&&pe!=="bottom"?0:30,scrollTop:-b?.top+j?.top+30,innerHeight:window.innerHeight,previewHeight:j?.height,mode:Y&&pe!=="bottom"?Ep:"default"}})},[pe,Y,C,p]),Fr=t&&e,_n=(0,l.useCallback)(b=>{const j=window.navigator.platform.match("Mac");v.codeEnabled&&v.codeSideEnabled&&b.altKey&&b.keyCode===88&&(E.toggle(),Ge.isLocked&&(St(!0),ke(r.FEATURE_UPSELL_SLIDE.code_editor))),((j?b.metaKey:b.ctrlKey)&&b.shiftKey&&b.keyCode===76||(j?b.metaKey:b.ctrlKey)&&b.shiftKey&&b.keyCode===69||(j?b.metaKey:b.ctrlKey)&&b.shiftKey&&b.keyCode===82)&&b.preventDefault()},[v.codeEnabled,Ge.isLocked,v.codeSideEnabled,E]),wt=fe.includes("UPLOAD_IMAGE_")||fe.includes("UPLOAD_BACKGROUND_"),yn=(0,l.useRef)(!1),_t=(0,l.useCallback)(b=>{const j=b.target,F=j.closest(".email-pane__content-col")||j.closest(".email-pane__collapse-wrapper")||j.closest(".selected-element-panel-content")||j.closest(".selected-element-panel")||j.closest(".em-analytics__email-tab-properties")||j.closest(".em-analytics__email-tab-styles")||j.closest(".em-analytics__email-tab-history")||j.closest(".blocks-modal-container")||j.closest(".email-pane__sizes")||j.closest(".email-preview-menu")||j.closest(".monaco-editor")||j.closest(".ant-modal-wrap");yn.current=!!F},[]),Ga=(0,l.useCallback)(b=>{const j=yn.current,F=window.getSelection().toString().length>0||document.activeElement&&document.activeElement.tagName==="INPUT"&&document.activeElement.selectionStart!==document.activeElement.selectionEnd;yn.current=!1,!(j||F)&&(!document.querySelector(".easylogic-colorpicker")&&!te.querySelector(".easylogic-colorpicker")&&!b.target.closest(".email-pane__content-col")&&!b.target.closest(".blocks-modal-container")&&!b.target.closest(".email-pane__collapse-wrapper")&&!b.target.closest(".selected-element-panel__columns-settings__controls__column__remove")&&!b.target.closest(".email-preview__content-col_main")&&!b.target.closest(".email-preview-menu")&&!b.target.closest(".monaco-editor")&&!b.target.closest(".main__pane-close-btn")&&!b.target.closest(".main__pane-trigger")&&!b.target.closest(".ant-modal-wrap")&&!b.target.closest(".email-pane__sizes")&&!b.target.closest(".ant-input-clear-icon")&&!b.target.closest(".ant-color-picker")&&!b.target.closest(".control-font-family-dropdown")&&!Dn.current&&!b.target.closest(".email-preview-menu__history")&&!b.target.closest(".selected-element-panel-content")&&!b.target.closest(".ant-select-dropdown")&&!b.target.closest(".ant-picker-dropdown")&&!b.target.closest(".toggle_view")&&!b.target.closest(".upload-bg-image__menu")&&!b.target.closest(".email-pane__paths")&&!b.target.closest(".ant-tabs-extra-content")&&!b.target.closest(".anticon-delete")&&!wt&&fe!==r.MODALS.IMAGE_EDITOR_MODAL&&(U==="Properties"&&(Et(),m(r.resetToLastActiveSettingsTab()),p.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),Qe([])),U==="History"&&m(r.setActiveSettingsTab(r.BUILD)),m(r.switchIsPanelHistoryCollapsed(!0)),p.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),setTimeout(()=>{e.type?m(r.setElementSettings({type:null})):m(r.setElementSettings$1({type:null}))},300)),Dn.current=null)},[m,e.type,fe,U,p,wt]),[gv,Wa]=(0,l.useState)(!0),{data:qo=[],refetch:Br}=r.useGetCommentsQuery(Le,{skip:!Le||ue});(0,l.useEffect)(()=>{Le&&!ue&&Br()},[U,Le,ue,Br]),(0,l.useEffect)(()=>{Le&&!Object.keys(ht).length&&q==="fulfilled"&&M()},[U,Le,M,ht,q]),(0,l.useEffect)(()=>{const b=new h.Disposable,j=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_active_tab);if(ht?.totalCount===0&&q!=="pending"){const Pe={project_id:g,connection:"chat",entity_id:Le,context:"default",locale:me};!j&&ne&&r.runOnceInFlight(`email-default-context:${Le}`,()=>{r.swallowPromiseRejection(Dr({body:Pe}).then(()=>{b.isDisposed()||q==="fulfilled"&&M()}))})}const F={data:{role:"assistant",message:d("Typing..."),isLoading:!0}};return ht?.documents?.length>0?(window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_active_tab),_e(ht?.documents),ne&&ht?.documents[ht?.documents?.length-1].data?.userInfo&&_e([...ht?.documents,F])):j||_e(ne?[F]:[]),()=>b.dispose()},[Le,me,ht?.totalCount,ht?.documents,ne,g,M,Dr,q]),(0,l.useEffect)(()=>{oe({}),m(Xe==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},[m,Xe]);const Ha=(0,l.useCallback)(b=>{m(r.setEmailSettings(Yn(b)))},[m]),qa=(0,l.useCallback)(b=>{m(r.setBlockSettings(Yn(b)))},[m]),Fn=(0,l.useCallback)(b=>{m(Xe==="email"?r.setElementSettings$1(Yn(b)):r.setElementSettings(Yn(b)))},[m,Xe]);(0,l.useEffect)(()=>{const b=We.current,j=Me.current;T(Y?j??b:b)},[Y,pe]);const[hv,_v]=(0,l.useState)(null),yv=(0,l.useCallback)(b=>{v.sidePanelFloating&&(Me.current=b),_v(b)},[v.sidePanelFloating]),Bn=(0,l.useCallback)(b=>{D(b),b==="search"?we(!0):(we(!1),S(b)),setTimeout(Ut,50)},[Ut]),vv=(0,l.useCallback)(b=>{const j=b.data.operation,F=b.data,Pe=b.data.action;if(j==="application_block_inserted"||b.data.operationId==="application_block_inserted"){const Oe=b.data.operationId?b.data.data:F||{},Nt=Oe.type==="project"||Oe.type==="template"||Oe.type==="common"?"block":"structure",bn=Oe.name||Oe.type||(Nt==="block"?"block":"structure");A({event:"add",action:"add_element_to_email",element_type:Nt,element_name:bn,entity_id:e?.id||y||f,project_id:O?.id||g})}if(j===r.EVENT_TYPES.APPLICATION_SCROLL_TO&&setTimeout(()=>{Me.current?.scrollTo({top:b.data.settings.value,behavior:"smooth"})},100),j===r.EVENT_TYPES.APPLICATION_PREVIEW_ALERT_SHOW&&pt(F.settings.show),j===r.EVENT_TYPES.APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW&&bt(!0),j===r.EVENT_TYPES.APPLICATION_ACTION&&Pe==="toggle_editor"&&E.toggle(),j===r.EVENT_TYPES.APPLICATION_IFRAME_SET_HEIGHT&&(te.querySelector(".email-pane__iframe").style.height=F.settings.height+"px"),j===r.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){let Oe=Object.assign({},F.settings);delete Oe.preheader,Object.values(Oe).every(Nt=>!Nt)?(m(r.setEmailSettingsDisable(!0)),m(r.resetToLastActiveSettingsTab())):Ha(F.settings),F.settings.noBlocks,m(r.setMobileViewActive(F.settings.responsive)),Wa(Oe.structuresMedia)}if(j===r.EVENT_TYPES.APPLICATION_BLOCK_SETTINGS_SET&&(Object.values(F.settings).every(Oe=>!Oe)?(m(r.setBlockSettingsDisable(!0)),m(r.resetToLastActiveSettingsTab())):(qa(F.settings),Wa(F.settings.structuresMedia))),j===r.EVENT_TYPES.APPLICATION_ELEMENT_SETTINGS_SET){const Oe=Object.values(r.ELEMENT_TYPES).includes(F.type),Nt=ee.current,bn=Nt?.type==="advanced"&&!!Nt.content,At=F.tab?!0:!Oe&&!bn,{type:Ov,caption:Lv,settings:Mv}=F,tl=JSON.stringify([Ov,Lv,Mv]),Nv=tl!==$.current;if($.current=tl,At&&U==="Properties"&&m(r.resetToLastActiveSettingsTab()),F.type===r.ELEMENT_TYPES.EMPTY_TABLE||F.type===r.ELEMENT_TYPES.EMPTY_TD?(m(r.setActiveSettingsTab(r.BUILD)),F.type===r.ELEMENT_TYPES.EMPTY_TABLE?(hn(r.BLOCKS),F.tab?Bn(F.tab):Bn("common")):F.type===r.ELEMENT_TYPES.EMPTY_TD&&hn(r.ATOMS)):F.type&&U!=="Properties"?F.type===r.ELEMENT_TYPES.SOCIAL&&Ot.current?ct():(ct(),m(r.setActiveSettingsTab(r.PROPERTIES))):F.type!==r.ELEMENT_TYPES.SOCIAL&&ct(),!Nv)return;F.type===r.ELEMENT_TYPES.CAROUSEL||F.type===r.ELEMENT_TYPES.ACCORDION||F.type===r.ELEMENT_TYPES.SOCIAL?(oe(tn=>({settings:{...F.settings,type:At?null:F.type,caption:F.caption,parent:At?null:F.settings.parent},type:At?null:F.type,parent:At?null:F.settings.parent,caption:F.caption,extraTabs:tn.extraTabs})),Fn({})):(Fn({...F.settings,type:At?null:F.type,parent:At?null:F.settings.parent,caption:F.caption}),oe(tn=>!Oe&&tn.type==="advanced"&&tn.content?{...tn,settings:{...F.settings,type:F.type,parent:F.settings?.parent,caption:F.caption}}:tn.extraTabs?.length?{extraTabs:tn.extraTabs}:{})),F.settings?.path?.length>0&&Qe(F.settings?.path)}j===r.EVENT_TYPES.APPLICATION_ELEMENT_SETTINGS_CLOSE&&($.current=null,ee.current?.type===r.ELEMENT_TYPES.SOCIAL&&Et(),m(r.resetToLastActiveSettingsTab()))},[m,Ha,qa,Fn,U,Bn,te,A,e,y,f,O,ct,Et,E,g,ee,oe,pt,bt]);(0,l.useEffect)(()=>{r.identifyUser({id:de?.id,email:de?.email,username:de?.name})},[de]),(0,l.useEffect)(()=>{const b=de.email_builder_config,j=!ue,F=x.get()?.mode;if(!b||typeof b!="string")return;const Pe=j&&b==="simple"?"pro":b;Pe!==F&&m(r.changeConfig(Pe))},[ue,de.email_builder_config,de.id,m,H,x]),(0,l.useEffect)(()=>{if(Y&&Ge.isLocked&&E.toggle(),v.configSwither){let b=localStorage.getItem("configSwither")||v.mode||"editor";localStorage.setItem("configSwither",b),m(r.changeConfig(b))}},[]);const Va=b=>{setTimeout(()=>{if(ue)m(r.changeConfig("pro")),dt(!0),St(!0),A({event:"change",action:"change_config_mode",config_mode:"pro",entity_id:e?.id||y||f,project_id:O?.id||g});else{let j=b?"pro":"editor";localStorage.setItem("configSwither",j),m(r.changeConfig(j)),A({event:"change",action:"change_config_mode",config_mode:j,entity_id:e?.id||y||f,project_id:O?.id||g})}},200)},bv=()=>{Y&&E.toggle(),m(r.resetToLastActiveSettingsTab()),m(r.changeConfig("simple")),dt(!1),St(!1),A({event:"change",action:"change_config_mode",config_mode:"simple",entity_id:e?.id||y||f,project_id:O?.id||g})},Ev=(0,l.useCallback)(()=>{St(!1)},[]);r.useListenPostMessage(vv),(0,l.useEffect)(()=>{const b=p.addListener(j=>{const F=Gu(j,r.EVENT_TYPES.APPLICATION_NATIVE_IMAGE_DROP);if(!F)return;const Pe=()=>p.send({operation:r.EVENT_TYPES.SANDBOX_NATIVE_IMAGE_DROP_CLEAR});(async()=>{const Oe=await Wu(F,{readContext:()=>({userId:de?.id,folderId:O?.id??g}),prepare:At=>r.prepareImageForEditorUpload(At,v),upload:At=>Ie(At)});if(Oe.status==="failed"&&L.fromError("IMAGE_UPLOAD_ERROR",F,Oe.error,!0),Oe.status!=="uploaded"){Pe();return}p.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.IMG,settings:{src:Oe.url}});const Nt=H.getState(),bn=Xe==="email"?r.selectElementSettings$1(Nt):r.selectElementSettings(Nt);bn?.type===r.ELEMENT_TYPES.IMG&&Fn({...bn,src:Oe.url,changeKey:"src"})})()});return()=>b.dispose()},[p,Ie,de,g,O?.id,v,L,Fn,H,Xe]),(0,l.useEffect)(()=>{const b=p.addListener("application_atom_inserted",F=>{A({event:"add",action:"add_element_to_email",element_type:"atom",element_name:F||"atom",entity_id:e?.id||y||f,project_id:O?.id||g})}),j=p.addListener("application_block_inserted",F=>{const Pe=F?.type==="project"||F?.type==="template"||F?.type==="common"?"block":"structure",Oe=F?.name||F?.type||(Pe==="block"?"block":"structure");A({event:"add",action:"add_element_to_email",element_type:Pe,element_name:Oe,entity_id:e?.id||y||f,project_id:O?.id||g})});return()=>{b?.dispose(),j?.dispose()}},[p,A,e?.id,y,f,g,O?.id]);const Sv=b=>{let j=te.querySelector(".atoms__list");v.toggleSidePanel&&b===U?m(r.setActiveSettingsTab(r.DISABLED_TAB)):b==="Optimize"?xt.comingSoonHandler(d,w):b!=="Properties"&&b!=="History"?(m(r.setActiveSettingsTab(b)),A({event:"navigate",action:"navigate_email_pane_tab",tab_name:b==="Disabled_tab"?"DISABLED_TAB":b,entity_id:e?.id||y||f,project_id:O?.id||g}),p.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),p.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),Qe([])):(b==="Properties"||b==="History")&&A({event:"navigate",action:"navigate_email_pane_tab",tab_name:b,entity_id:e?.id||y||f,project_id:O?.id||g}),he.isLocked&&b==="Discuss"&&(St(!0),ke(r.FEATURE_UPSELL_SLIDE.discussion)),ue&&b==="Optimise"&&(St(!0),ke(6)),qe.isLocked&&b==="AiChat"&&(qe.state.state==="locked_by_limit"&&qe.exceeded?nt(!0):(St(!0),ke(9)))},Vo=(0,l.useRef)(null),$r=(0,l.useRef)(void 0),Mt=(0,l.useCallback)(()=>{const b=Me.current?.getBoundingClientRect();if(Vo?.current?.getBoundingClientRect().top>=0&&b){const j=Math.round(b.height-30);Vo.current.style.height=`${j}px`,be(j-30)}$r.current&&window.clearTimeout($r.current),$r.current=window.setTimeout(function(){p.isInited()&&mt()},100)},[mt,p,be]);(0,l.useEffect)(()=>()=>{window.clearTimeout($r.current)},[]),(0,l.useEffect)(()=>(U==="AiChat"&&!ue?le.current=setInterval(()=>{M({entity_id:Le})},5e3):clearInterval(le.current),clearInterval(le.current)),[Le,ue,M,U]);const wv=b=>hn(b||""),kv=()=>{we(!1),D(I)},Ko=()=>{let b=te.querySelector(".block-search__preview");b&&(b.style.opacity="0",b.style.transform="translateX(-99%)",setTimeout(function(){b.remove()},300))};let vn=[];const $n={display:"flex",alignItems:"center",justifyContent:"center"};v.blocksEmptyEnabled&&vn.push({label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"top",title:d("Empty blocks"),children:(0,a.jsx)("div",{style:$n,children:(0,a.jsx)(r.EmIcons,{icon:"BorderOuterOutlined",component:_.icons$BorderOuterOutlined,style:{fontSize:18}})})}),value:"empty"}),v.blocksSavedEnabled&&vn.push({label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"top",title:d("Saved blocks"),children:(0,a.jsx)("div",{style:$n,children:(0,a.jsx)(r.EmIcons,{icon:"AppstoreAddOutlined",component:_.icons$AppstoreAddOutlined,style:{fontSize:18}})})}),value:"project"}),v.blocksCommonEnabled&&vn.push({label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"top",title:d("Common blocks"),children:(0,a.jsx)("div",{style:$n,children:(0,a.jsx)(r.EmIcons,{icon:"AppstoreOutlined",component:_.icons$AppstoreOutlined,style:{fontSize:18}})})}),value:"common"}),v.blocksTemplateEnabled&&vn.push({label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"top",title:d("Template blocks"),children:(0,a.jsx)("div",{style:$n,children:(0,a.jsx)(r.EmIcons,{icon:"BuildOutlined",component:_.icons$BuildOutlined,style:{fontSize:18}})})}),value:"template"}),v.blocksSearchEnabled&&vn.push({label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"top",title:d("Blocks search"),children:(0,a.jsx)("div",{style:$n,children:(0,a.jsx)(r.EmIcons,{icon:"SearchOutlined",component:_.icons$SearchOutlined,style:{fontSize:18}})})}),value:"search"});const Ur=R!=="empty"||ae,Cv=!v.blocksSectionsShow||Ur?"100%":"calc(100% - 44px)";let Tv=[{label:(0,a.jsx)("div",{className:"email-pane__tab",children:d("Elements")}),key:r.ATOMS,className:"email-pane__collapse-panel email-pane__atoms",children:(0,a.jsx)(Rp,{})},{label:(0,a.jsx)("div",{className:"email-pane__tab",children:d("Blocks")}),key:r.BLOCKS,className:"email-pane__collapse-panel email-pane__blocks-search",style:{height:Cv},children:(0,a.jsxs)("div",{className:(0,rt.default)("email-pane__blocks-panel",{"email-pane__blocks-panel_scrollable":Ur}),children:[v.blocksSectionsShow&&(0,a.jsxs)("div",{className:"email-pane__blocks-panel-header",children:[(0,a.jsxs)(_.ui_kit$Space.Compact,{block:!0,children:[!ae&&(0,a.jsx)(_.ui_kit$Segmented,{block:!0,style:{width:"100%",marginTop:24},onChange:Bn,value:R,options:vn}),ae&&(0,a.jsx)("div",{style:{width:"100%",height:36}}),ae&&(0,a.jsx)("div",{style:{width:36,textAlign:"right",marginTop:22},children:(0,a.jsx)(r.EmIcons,{icon:"CloseOutlined",component:_.icons$CloseOutlined,style:{padding:"0 2px 0",cursor:"pointer"},onClick:kv})})]}),(0,a.jsx)("div",{className:"blocks-search__divider-wrapper",style:{marginTop:ae?28:12},children:(0,a.jsx)(_.ui_kit$Divider,{className:"blocks-search__divider"})})]}),(0,a.jsxs)("div",{className:"email-pane__blocks-panel-body",children:[(0,a.jsx)("div",{className:"blocks-search__empty-shadow",style:{display:R==="empty"&&!ae?"block":"none"},children:gv?(0,a.jsx)(pi,{}):(0,a.jsx)(di,{})}),(0,a.jsx)("div",{className:(0,rt.default)("email-pane__blocks-panel-results",{"email-pane__blocks-panel-results_visible":Ur}),children:(0,a.jsx)(Ap,{parentEmailId:e?.parent_email,blocksTab:R,search:ae,reloadBlockScreens:Ut,setIsShowAddAllBlocksModal:s})})]})]})}];const Un=[{disabled:gt,key:r.PROPERTIES,style:{height:"var(--ub-em-pane-block-height)"},className:"em-analytics__email-tab-properties",children:(0,a.jsx)(_p,{isShowMobileSettings:ge,propertiesPanelKey:X,onMouseLeave:Ko,email:e,onClosePanel:Lt})},{disabled:gt,key:r.HISTORY,style:{height:"var(--ub-em-pane-block-height)"},className:"em-analytics__email-tab-history",children:Fr&&(0,a.jsx)("div",{className:"email-pane__collapse-wrapper",onMouseLeave:Ko,children:(0,a.jsx)(Op,{setCollapsedHistory:()=>m(r.switchIsPanelHistoryCollapsed(!0)),emailElement:Fr})})},{key:r.DISABLED_TAB,className:"em-analytics__email-tab-properties"},{disabled:gt,label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"left",title:u("Build","tab"),children:(0,a.jsx)(r.EmIcons,{"data-testid":"contentIcon",icon:"PlusCircleOutlined",component:_.icons$PlusCircleOutlined,size:24,strokeWidth:v.iconStrokeWidth})}),key:r.BUILD,className:"em-analytics__email-tab-build",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,a.jsx)("div",{className:(0,rt.default)("email-pane__collapse-wrapper",{"email-pane__collapse-wrapper_no-topleft-radius":U==="Build"||!U,"email-pane__collapse-wrapper_build":He==="Blocks"&&Ur}),onMouseLeave:Ko,children:(0,a.jsx)(_.ui_kit$Tabs,{className:(0,rt.default)("secondary-tabs email-pane__collapse",{"secondary-tabs_unset_scroll":He===r.BLOCKS}),size:"large",activeKey:He,onChange:wv,items:Tv})})},{disabled:gt,label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"left",title:u("Styles","tab"),children:(0,a.jsx)(r.EmIcons,{"data-testid":"stylesIcon",icon:"Styles",component:_.icons$Styles,size:24,strokeWidth:v.iconStrokeWidth})}),key:r.STYLES,className:"em-analytics__email-tab-styles",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,a.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,a.jsx)(Tp,{email:e})})}];v.commentsEnabled&&Un.push({disabled:gt,label:(0,a.jsxs)(_.ui_kit$Tooltip,{placement:"left",title:u("Discuss","tab"),children:[(0,a.jsx)(r.EmIcons,{"data-testid":"commentsIcon",icon:"CommentOutlined",component:_.icons$CommentOutlined,size:24,strokeWidth:v.iconStrokeWidth}),he.isLocked&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:v.iconStrokeWidth,className:"free-mode-firewall-icon free-mode-firewall-icon_emailpane"}),!!qo.length&&(0,a.jsx)("span",{className:"email-pane__comment-counter",children:qo.filter(b=>b.comment_status!=="deleted").length})]}),key:"Discuss",className:"email-pane__tab-discuss em-analytics__email-tab-discuss",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,a.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,a.jsx)(_.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse discuss-wrapper",size:"large",activeKey:"Discuss",items:[{label:(0,a.jsx)(a.Fragment,{children:d("Discuss")}),key:"Discuss",forceRender:!0,className:"email-settings__collapse-panel",children:Le?(0,a.jsx)(Lp,{email:e,comments:qo,subjectId:Le,isLoggedIn:!0,emailElementType:Xe}):(0,a.jsx)("div",{className:"aside-content-wrapper",children:e.hasOwnProperty("type")?(0,a.jsx)(_.ui_kit$Alert,{description:d("Save the block before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}}):(0,a.jsx)(_.ui_kit$Alert,{description:d("Save the email before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}})})}]})})});const Iv=()=>{Ee({entity_id:Le}).then(b=>{b.error?L.error({title:b.error.data.code,description:b.error.data.message}):b.data.success&&L.success({title:d("Success"),description:b.data.success}),ue||M()})};v.aiAssistentEnabled&&Un.push({disabled:gt,label:(0,a.jsxs)(_.ui_kit$Tooltip,{placement:"left",title:u("AI assistant","tab"),children:[(0,a.jsx)(r.EmIcons,{"data-testid":"aiAssistentIcon",icon:"AI",component:_.icons$AI,size:24,strokeWidth:v.iconStrokeWidth}),qe.isLocked&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:v.iconStrokeWidth,className:"free-mode-firewall-icon free-mode-firewall-icon_emailpane"}),ht?.totalCount>0&&Le&&(0,a.jsx)("span",{className:"email-pane__comment-counter",children:ht?.totalCount})]}),key:"AiChat",className:"email-pane__tab-discuss em-analytics__email-tab-discuss",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,a.jsx)(_.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse discuss-ai-wrapper",size:"large",activeKey:"AiChat",tabBarExtraContent:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"top",title:d("Clear chat"),children:(0,a.jsx)(_.ui_kit$Popconfirm,{description:d("Clear chat history?"),onConfirm:Iv,okText:d("Yes"),cancelText:d("No"),icon:"",placement:"leftTop",title:!1,children:(0,a.jsx)(_.ui_kit$Button,{type:"text",icon:(0,a.jsx)(r.EmIcons,{icon:"ClearChat",component:_.icons$ClearChat,style:{fontSize:16}}),style:{marginRight:16}})})}),items:[{label:(0,a.jsx)(a.Fragment,{children:d("AI assistant")}),key:"AiChat",forceRender:!0,className:"email-settings__collapse-panel",children:Le||window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_active_tab)?(0,a.jsx)(Cp,{messages:Ce.length>0?Ce:W,newEmailAiGeneratorRef:fn}):(0,a.jsx)("div",{className:"aside-content-wrapper",children:e.hasOwnProperty("type")?(0,a.jsx)(_.ui_kit$Alert,{description:d("Save the block before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}}):(0,a.jsx)(_.ui_kit$Alert,{description:d("Save the email before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}})})}]})})})}),v.optimizeEnabled&&Un.push({disabled:gt,label:(0,a.jsxs)(_.ui_kit$Tooltip,{placement:"left",title:u("Optimize","tab"),children:[(0,a.jsx)(r.EmIcons,{"data-testid":"optimizeIcon",icon:"Speed",component:_.icons$Speed,size:24,strokeWidth:v.iconStrokeWidth}),ue&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:v.iconStrokeWidth,className:"free-mode-firewall-icon free-mode-firewall-icon_emailpane"})]}),key:"Optimise",className:"em-analytics__email-tab-optimise",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,a.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,a.jsx)(_.ui_kit$Tabs,{className:"secondary-tabs secondary-tabs_optimise email-settings__collapse optimise-wrapper",size:"large",activeKey:"Optimise",items:[{label:(0,a.jsx)(a.Fragment,{children:d("Optimize")}),key:"Optimise",forceRender:!0,className:"email-settings__collapse-panel",children:(0,a.jsx)(Ip,{})}]})})}),v.settingsEnabled&&Un.push({disabled:gt,label:(0,a.jsx)(_.ui_kit$Tooltip,{placement:"left",title:u("Settings","tab"),children:(0,a.jsx)(r.EmIcons,{"data-testid":"settingsIcon",icon:"SettingOutlined",component:_.icons$SettingOutlined,size:24,strokeWidth:v.iconStrokeWidth})}),key:"Edit",className:"em-analytics__email-tab-edit",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,a.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,a.jsx)(jp,{email:e})})});const Ka=U===r.DISCUSS,Ya=(0,l.useRef)(0),Qa=(0,l.useRef)(0),Xa=(0,l.useRef)(0),Av=(0,l.useCallback)(()=>(te.querySelector(".email-pane__col_preview")?.getBoundingClientRect().width??0)-(v.sidePanelFloating?0:38),[te,v.sidePanelFloating]);(0,l.useEffect)(()=>{Le&&!ue&&Br()},[Le,ue,Br]),(0,l.useEffect)(()=>{const b=p.onInit(()=>{p.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),p.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:Ka})});return()=>b.dispose()},[Ka,p]),(0,l.useEffect)(()=>{if(!C||!Ki(p))return;const b=new AbortController;return Yi(p,r.DEFAULT_SANDBOX_READY_TIMEOUT_MS,b.signal).then(()=>mt()).catch(()=>{}),()=>b.abort()},[C,mt,p]);const Yo=(0,l.useCallback)(b=>{const j=b??r.selectEmailWidth(H.getState());p.send({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:typeof j=="number"?j+2:j}}),xe.current?.resize()},[H,p]);(0,l.useEffect)(()=>{if(!ge&&U!=="Disabled_tab"){const b=te.querySelector(".email-pane__row")?.getBoundingClientRect().width;Se?.current?.getBoundingClientRect().width+540>b&&m(r.setEmailWidth("100%"))}},[m,U,te,ge]);const Qo=(0,l.useCallback)(()=>{const b=Se.current;b&&(b.style.borderWidth="1px",v.sidePanelFloating||(b.style.marginLeft="-1px",b.style.marginRight="-1px"),b.style.borderLeftColor=null,b.style.borderRightColor=null)},[v.sidePanelFloating]),Ja=(0,l.useCallback)(b=>{const j=Z.current.widthCodeSplit;ve(!1),Z.current.currentSide&&(setTimeout(()=>Yo(),50),et(null)),b.target.classList.contains("email-pane__handle")||Qo(),window.localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_code_mode_pane_sizes,JSON.stringify(j))},[Yo,Z,ve,et,Qo]),Za=b=>j=>{j.target.classList.contains("email-pane__handle")&&(j.preventDefault(),Ya.current=j.target.parentNode.offsetWidth,Qa.current=j.pageX,Xa.current=Av(),et(b),Dn.current=b)},zr=b=>{const j=Se.current,{currentSide:F}=Z.current;typeof b=="string"&&(!F||F===b)?(te.querySelector(".email-pane__iframe").style.width="calc(100% + 1px)",b==="right"?(j.style.borderRightColor=N.colorPrimary,j.style.borderRightWidth="2px"):(j.style.borderLeftColor=N.colorPrimary,j.style.borderLeftWidth="2px",te.querySelector(".email-pane__iframe").style.marginLeft="-1px")):F||(Qo(),te.querySelector(".email-pane__iframe").style.width="1px",te.querySelector(".email-pane__iframe").style.removeProperty("margin-left"))},xv=(0,l.useCallback)(()=>{ve(!0)},[ve]),Xo=(0,l.useCallback)(b=>{const{currentSide:j}=Z.current;if(!j)return;const F=(b.pageX-Qa.current)*2,Pe=Ya.current+(j==="left"?-F:F),Oe=Math.min(Xa.current,1200);Pe>318&&Pe<Oe&&(m(r.setEmailWidth(Math.min(Pe,1200))),xe.current?.resize())},[m,Z]),Jo=(0,l.useCallback)(b=>{if(Z.current.isResizing)if(pe==="bottom"){const j=Be.current.getBoundingClientRect().height,F=Be.current.getBoundingClientRect().top,Pe=(b.clientY-F)/j*100;if(Pe<20||Pe>80)return;De(Pe),Mt()}else{const j=Be.current.getBoundingClientRect().width,F=Be.current.getBoundingClientRect().left,Pe=(b.clientX-F)/j*100,Oe=Se.current.getBoundingClientRect().width;if(v.desktopMobileSwitchPanel&&typeof Oe=="number"&&Oe<=425&&m(r.setEmailWidth(425)),Pe<20||Pe>80)return;De(Pe)}},[Z,De,pe,Mt,m,v.desktopMobileSwitchPanel]);(0,l.useEffect)(()=>{Mt()},[Y,Mt]);const Pv=b=>{b?.stopPropagation?.();const j=Re==="light"?r.DARK:r.LIGHT;p.send({operation:r.EVENT_TYPES.SANDBOX_SWITCH_THEME,data:{theme:j}}),Ue(j)},el=(b="panel")=>{const j=b==="panel",F=Re===r.DARK,Pe={size:j?18:16,strokeWidth:j?v.iconStrokeWidth:2};return(0,a.jsx)(_.ui_kit$Tooltip,{title:d(F?"Light theme":"Dark theme"),placement:j?"top":"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:j?F?"primary":"text":"default",icon:F?(0,a.jsx)(r.EmIcons,{icon:"LightMode",component:_.icons$LightMode,...Pe}):(0,a.jsx)(r.EmIcons,{icon:"DarkMode",component:_.icons$DarkMode,...Pe}),shape:"circle",size:j?void 0:"small",onClick:Pv,className:"toggle_view theme_view email-pane__theme-toggle",style:j?void 0:{left:4,top:4,zIndex:999,padding:0,position:"absolute"}})})},Zo=b=>{const j=typeof b=="number"?Math.min(b,1200):b;m(r.setEmailWidth(j)),setTimeout(()=>Yo(j),700);const F=typeof j=="number"?j:j==="100%"?"full":j,Pe=typeof j=="number"&&j<=425?"mobile":"desktop";A({event:"change",action:"change_email_size",email_id:e?.id||y||f,project_id:O?.id||g,width:F,view_type:Pe})};(0,l.useEffect)(()=>{const b=new h.Disposable;return b.addDisposable(r.addWindowListenerFromShadow(te,"mousedown",_t,!0)),b.addDisposable(r.addWindowListenerFromShadow(te,"click",Ga)),b.addDisposable(r.addWindowListenerFromShadow(te,"mouseup",j=>Ja(j),!0)),()=>{b.dispose()}},[te,Ga,_t,Ja]),(0,l.useEffect)(()=>{const b=Me.current;if(!b||typeof ResizeObserver!="function")return;const j=new ResizeObserver(Mt);return j.observe(b),()=>j.disconnect()},[Mt,v.sidePanelFloating]),(0,l.useEffect)(()=>(window.addEventListener("scroll",Mt,!0),window.addEventListener("mousemove",Xo,!0),window.addEventListener("mousemove",Jo),window.addEventListener("keydown",_n),()=>{window.removeEventListener("mousemove",Xo,!0),window.removeEventListener("mousemove",Jo),window.removeEventListener("scroll",Mt,!0),window.removeEventListener("keydown",_n)}),[Mt,Xo,Jo,_n]);const Rv=b=>{const j=Y?"visual":"code",F=!Y;if(Y?E.toggle():typeof b=="string"?(E.setDirection(b),!Y&&E.toggle()):E.toggle(),F){const Pe=Xe==="block"?"block":"email",Oe=typeof b=="string"?b:pe||"toggle";A({event:"activate",action:"activate_code_mode",entity_type:Pe,entity_id:e?.id||y||f,project_id:O?.id||g,code_mode_direction:Oe})}A({event:"change",action:"change_editor_mode",editor_mode:j,entity_id:e?.id||y||f,project_id:O?.id||g}),m(r.resetToLastActiveSettingsTab()),setTimeout(()=>{m(Xe==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),p.send({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),m(r.resetPanes())};(0,l.useEffect)(()=>{v.emailPaneDesktopSize&&m(r.setEmailWidth(v.emailPaneDesktopSize))},[m,v.emailPaneDesktopSize]);const jv=()=>{hn(r.BLOCKS),Bn("project")};return(0,l.useEffect)(()=>{i&&jv()},[i]),(0,a.jsx)(r.ElementEntityKindProvider,{kind:Xe,children:(0,a.jsxs)(up,{className:(0,rt.default)("email-pane",{"email-pane_code-mode":Y,"email-pane_only_code_mode_mobile":v.onlyCodeModeInMobile,"email-pane_code-mode-bottom":Y&&pe==="bottom","email-pane_no-element-navigation":!v.switchDesktopMobilePropsEnabled&&!v.stepToOtherElementEnabled&&!v.deleteButtonEnabled,"email-pane_is-mobile":ge,"email-pane_path-enabled":v.pathEnabled}),sidePanelFloating:!!v.sidePanelFloating,isCodeMode:!!Y,codeModeDirection:String(pe),children:[(0,a.jsxs)(wp,{className:"email-pane__container",ref:We,children:[(0,a.jsx)(vp,{isCodeMode:Y,codeModeDirection:pe}),(0,a.jsx)(hp,{isShowMobileSettings:ge,headless:!!P,templateNotEmAlertEnabled:!!v.templateNotEmAlertShow}),(0,a.jsxs)(_.ui_kit$Row,{ref:Be,className:(0,rt.default)("email-pane__row",{"email-pane__left":Y&&pe==="right","email-pane__right":Y&&pe==="left","email-pane__bottom":Y&&pe==="bottom","email-pane__sizeSwitcher":v.desktopMobileSwitchPanel,"email-pane__reverse":v.menuDirection==="left","email-pane__pinch":!v.sidePanelFloating}),children:[(0,a.jsxs)(mp,{isCodeMode:Y,codeModeDirection:pe,sidePanelFloating:v.sidePanelFloating,contentWrapperRef:yv,children:[(0,a.jsx)("div",{className:"email-pane__iframe-scroll-top",id:"iframe-scroll-top"}),v.desktopMobileSwitchPanel&&(0,a.jsxs)(_.ui_kit$Space,{className:"email-pane__sizes-panel-wrapper",orientation:"vertical",size:10,children:[(0,a.jsxs)(_.ui_kit$Space,{className:"email-pane__sizes-panel",size:0,children:[el("panel"),(0,a.jsx)(_.ui_kit$Tooltip,{title:d("Desktop view"),placement:"top",open:jn,children:(0,a.jsx)(_.ui_kit$Button,{type:ge?"text":"primary",icon:(0,a.jsx)(r.EmIcons,{icon:"DesktopOutlined",component:_.icons$DesktopOutlined,size:18,strokeWidth:v.iconStrokeWidth}),shape:"circle",onClick:()=>Zo(v.emailPaneDesktopSize||1e3),className:"toggle_view desktop_view"})}),(0,a.jsx)(_.ui_kit$Tooltip,{title:d("Mobile view"),placement:"top",open:gn,children:(0,a.jsx)(_.ui_kit$Button,{type:ge?"primary":"text",icon:(0,a.jsx)(r.EmIcons,{icon:"MobileOutlined",component:_.icons$MobileOutlined,size:18,strokeWidth:v.iconStrokeWidth}),shape:"circle",onClick:()=>Zo(425),className:"toggle_view mobile_view"})})]}),v.codeSideEnabled&&(0,a.jsx)(_.ui_kit$Tooltip,{title:d("Code mode"),placement:"right",children:(0,a.jsx)(_.ui_kit$Button,{type:Y?"primary":"default",icon:(0,a.jsx)(r.EmIcons,{icon:"Code",component:_.icons$Code}),shape:"circle",onClick:()=>Rv("right")})})]}),(0,a.jsxs)(_.ui_kit$Row,{className:(0,rt.default)("email-pane__col-wrapper",{container:Y&&pe==="bottom"||!Y,"email-pane__col-wrapper_reverse":v.menuDirection==="left","email-pane__col-wrapper_pinch":!v.sidePanelFloating}),style:{flexGrow:1,maxWidth:"unset",paddingTop:v.desktopMobileSwitchPanel&&Y&&pe!=="bottom"?"60px":""},children:[(0,a.jsxs)(_.ui_kit$Col,{className:"email-pane__col email-pane__col_preview",style:{flexGrow:1,maxWidth:"unset"},ref:v.sidePanelFloating?null:Me,children:[v.desktopMobileSwitchRule&&(0,a.jsx)(Cd,{onSelectWidth:Zo,themeToggle:el("rule")}),(0,a.jsxs)(pp,{maxPaneWidth:1200,isCodeMode:Y,codeModeDirection:pe,isShowMobileSettings:ge,desktopMobileSwitchPanel:v.desktopMobileSwitchPanel,children:[(0,a.jsx)("div",{className:"email-pane__handle left",onMouseDown:Za("left"),onMouseEnter:()=>zr("left"),onMouseLeave:zr}),(0,a.jsx)("div",{className:"email-pane__handle right",onMouseDown:Za("right"),onMouseEnter:()=>zr("right"),onMouseLeave:zr}),(0,a.jsx)(gp,{wrapperRef:Se,children:(0,a.jsx)(Pp,{ref:xe,className:"email-pane__iframe",email:e,handlerSendPosition:Mt,clip:hv})})]})]}),(0,a.jsx)(_.ui_kit$Col,{style:{display:Y&&pe!=="bottom"||v.disableSideMenu?"none":"initial"},ref:Vo,onPointerEnter:kp,className:(0,rt.default)("email-pane__content-col email-pane__content-col_menu email-pane__content-col_tabs email-pane__col email-pane__col_settings",{"email-pane__col_disabled":U===r.DISABLED_TAB}),children:(!Y||pe==="bottom")&&J&&(0,a.jsx)(_.ui_kit$Tabs,{className:(0,rt.default)("email-pane__col_settings-inner",{"email-pane__col_settings-inner_reverse":v.menuDirection==="left"}),size:"medium",activeKey:U,onTabClick:Sv,renderTabBar:Sp,tabPlacement:"right",items:Un,tabBarExtraContent:Bt&&(0,a.jsx)("div",{style:{paddingTop:15,textAlign:"center"},children:ue?(0,a.jsx)(_.ui_kit$Switch,{variant:"editorMode",checkedChildren:"Pro",unCheckedChildren:"Pro",onChange:Va,checked:$t}):(0,a.jsx)(_.ui_kit$Switch,{variant:"editorMode",checkedChildren:"Pro",unCheckedChildren:"Pro",onChange:Va,defaultChecked:Nn})})})})]}),(0,a.jsx)("div",{className:"email-pane__iframe-scroll-bottom",id:"iframe-scroll-bottom"})]}),(0,a.jsxs)(fp,{isCodeMode:Y,codeModeDirection:pe,children:[(0,a.jsx)("div",{className:"email-pane__code-divider",onMouseDown:xv}),(0,a.jsx)("div",{className:"code-mode__pane code-mode__pane_editor email-pane__pane email-pane__pane_editor",children:(0,a.jsx)("div",{className:"code-mode__pane-content email-pane__pane-content",children:ie&&(0,a.jsx)(xp,{email:e,setOtherUsers:Ze,readOnly:v.lockEditor,newEmailAiGeneratorRef:fn})})})]})]}),v.pathEnabled&&(0,a.jsxs)("div",{className:"email-pane__paths",children:[(0,a.jsx)(su,{elementPath:Ye}),(0,a.jsx)(lu,{fallbackHtml:e?.html})]}),(0,a.jsx)("div",{className:"collaborator-list",children:(0,a.jsx)(r.CollaboratorList,{users:ze,isEditor:!1,isPlugin:!0,token:N})})]}),(0,a.jsx)(bp,{isCodeMode:Y,codeModeDirection:pe,email:e,onClosePanel:Lt}),(0,a.jsx)(Pu,{}),(0,a.jsx)(r.PlanUpgradePrompt,{open:gt,onCancel:bv,onTrialActivated:Ev,initialSlide:ce}),st&&qe.exceeded?(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(oo,{open:Ne,onClose:je,title:d(st.titleKey),subtitle:d(st.subtitleKey),usageResource:st.usageResource,previousDisplay:r.presetLimitDisplay(qe.exceeded.previousLimit),nextDisplay:r.presetLimitDisplay(qe.exceeded.nextLimit),onChangePlan:Yt})}):null,(0,a.jsx)(cu,{open:ft,onClose:lt}),(0,a.jsx)(uu,{open:G,onClose:V})]})})};us.propTypes={};var Mp=e=>(0,a.jsx)(tp,{children:(0,a.jsx)(op,{children:(0,a.jsx)(lp,{children:(0,a.jsx)(us,{...e})})})}),Np=(0,l.memo)(Mp),Dp=({open:e,onClose:t})=>{const{__:n}=r.useI18n(),o=r.getSupportEmail(),[i,s=""]=n("To send a test email, you need to confirm your email address. If you haven’t received the confirmation link, contact support in the chat or email {supportEmail}.").split("{supportEmail}");return(0,a.jsx)(_.ui_kit$Modal,{width:440,open:e,onCancel:t,title:(0,a.jsxs)("div",{style:{paddingBottom:8},children:[(0,a.jsx)(r.EmIcons,{icon:"EmailConfirmation",component:_.icons$EmailConfirmation,size:20,strokeWidth:2})," ",n("Email confirmation required")]}),footer:[(0,a.jsx)(_.ui_kit$Button,{size:"large",type:"primary",onClick:t,children:n("Got it")},"ok")],children:(0,a.jsxs)("p",{children:[i,(0,a.jsx)("a",{href:`mailto:${o}`,children:o}),s]})})},Qn=e=>{const t=r.useCurrentUser(),[n,o]=(0,l.useState)({owner:!1,admin:!1,user:!1}),i=r.useProjectData(),{data:s}=r.useGetProjectQuery(e,{skip:!e||!t.id||!!i}),c=i||s;return(0,l.useEffect)(()=>{if(c){const d=r.getMyProjectRole(c,t);o({owner:d==="owner",admin:d==="admin",user:d==="user"})}},[c,t]),n},co=r.getLimitUpgradePresetDefinition("preview_exceeded"),ps=({emailElement:e,isCollaborationEditor:t})=>{const{__:n}=r.useI18n(),o=r.useDispatch(),i=Vr(),s=r.useOpenPlanCatalog(),c=r.useSendPostMessage(),{blockId:d}=r.useRouteParams(),u=r.useRouteEmailId(),p=r.useSelector(r.selectActiveModal$1)===r.MODALS.SEND_TEST_EMAIL,f=kn(p),[g,y]=(0,l.useState)(!1),[m,E]=r.useSendLivePreviewMutation(),k=r.useCurrentUser(),w=r.useDocumentHistoryReader(),v=r.useProjectPlanLimitPreflight(),{owner:x}=Qn(),P=Jr(),K=Pd(),J=r.useContentReader(),N=r.useSelector(r.selectIsPanelHistoryCollapsed),L=r.useSelector(r.selectIsCodeMode),A=r.useSelector(r.selectCodeModeDirection),{token:O}=(0,_.ui_kit$useToken)(),z=r.useNotification(),B=r.useAppConfig(),U=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,de=r.useEventEmitter(h.events.ON_SHARE_ID),me=r.useEventEmitter(h.events.ON_SHOW_PREVIEW_ID),[H,Z]=(0,l.useState)(!1),[De,ve]=(0,l.useState)(0),[et,be]=(0,l.useState)(!1),fe=kn(et),Y=(0,l.useCallback)(()=>be(!1),[]),pe=(0,l.useCallback)(()=>{be(!1),s()},[s]),[ie,se]=(0,l.useState)(n("—")),[Ae,Te]=(0,l.useState)(!1),Fe=r.useProjectData(),X=r.usePlanFeatureGate("version_history"),Ee=r.usePlanFeatureGate("code_editor"),Ie=r.usePlanFeatureGate("preview_service"),ge=r.usePlanFeatureGate("undo_redo"),Re=r.isEditorLockedByPlan(Fe,{isPlugin:!0}),Ue=r.usePushToDataLayer(),C=e?.project,T=he=>{const Ge=U==="block"?"block":"email";typeof he=="string"?(i.setDirection(he),!L&&i.toggle()):i.toggle(),Ue({event:"activate",action:"activate_code_mode",entity_type:Ge,entity_id:e?.id||u||d,project_id:e?.project||C}),setTimeout(()=>{o(U==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),Ee.isLocked&&(Z(!0),ve(r.FEATURE_UPSELL_SLIDE.code_editor))},R=(0,l.useCallback)(async()=>!0,[v]),D=async()=>{if(Re){Z(!0),ve(8);return}await R()&&(o(r.openModal$1(r.MODALS.SEND_TEST_EMAIL)),Ue({event:"open",action:"open_test_email_modal",entity_type:U==="block"?"block":"email",entity_id:e?.id||u||d,project_id:e?.project||C}))},I=()=>{Z(!0),ve(r.FEATURE_UPSELL_SLIDE.undo_redo)},S=()=>{P.undo()},ae=()=>{P.redo()},we=async()=>{const he=(await de.fire({project:C,id:u})).find(Ge=>Ge===!1||typeof Ge=="string");he!==!1&&navigator.clipboard.writeText(he||r.buildEmailRawShareUrl(u,C)).then(()=>{z.success(n("A shareable link to this page has been copied to the clipboard.")),Ue({event:"click",action:"share_email",entity_type:U==="block"?"block":"email",entity_id:e?.id||u||d,project_id:e?.project||C})})},Ye=async()=>{if(!g){if(!await R())return;const he={email:u,subject:encodeURIComponent("#"+e.project+" "+e.title).replaceAll(/%20/gi,"+").replaceAll(/%0A/gi,"%0D%0A"),content:encodeURIComponent(J()).replaceAll(/%20/gi,"+").replaceAll(/%0A/gi,"%0D%0A")};m(he),y(!0),Ue({event:"click",action:"open_email_inbox_tests",entity_type:U==="block"?"block":"email",entity_id:e?.id||u||d,project_id:e?.project||C})}},Qe=(0,l.useCallback)(async()=>{await R()&&(se(n("—")),be(!0))},[n,R]);(0,l.useEffect)(()=>{E.isError&&(z.error(E),y(!1))},[E]),(0,l.useEffect)(()=>{if(E.isSuccess&&g){if(E.data?.status===401)z.error({title:E.data.code,description:E.data.message});else if(E.data){let he=document.createElement("A");he.setAttribute("target","_blank"),he.setAttribute("href",E.data.message),he.click()}y(!1)}},[E,g,z]);const[ze,Ze]=(0,l.useState)(!1),pt=()=>{c({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:N}),o(r.switchIsPanelHistoryCollapsed(!N))},bt=()=>w(e?.id),ft=()=>{N?(Ze(!0),bt().then(he=>{he.isSuccess?he.data.data.length:he.isError&&z.error(he),pt(),o(r.setActiveSettingsTab(r.HISTORY)),Ze(!1),Ue({event:"open",action:"open_version_control",entity_type:U==="block"?"block":"email",entity_id:e?.id||u||d,project_id:e?.project||C}),X.isLocked&&(Z(!0),ve(r.FEATURE_UPSELL_SLIDE.version_history))})):(o(r.resetToLastActiveSettingsTab()),pt())},lt=()=>{N||(pt(),o(r.resetToLastActiveSettingsTab())),L&&i.toggle(),Z(!1)};let G=[];const V=(0,l.useCallback)(async()=>{const he=await me.fire({project:C,id:u});he.find(Ge=>Ge===!1||typeof Ge=="string")!==!1&&(window.open(he.find(Ge=>Ge)||r.buildEmailRawSharePath(u,C)),Ue({event:"click",action:"open_email_preview",entity_type:U==="block"?"block":"email",entity_id:e?.id||u||d,project_id:e?.project||C}))},[me,C,u,Ue,U,e,d]),te=(0,l.useCallback)(async()=>{window.open(r.buildGetElementPreviewPath(r.EMAIL,u,C)),Ue({event:"click",action:"open_web_version",entity_type:U==="block"?"block":"email",entity_id:e?.id||u||d,project_id:e?.project||C})},[C,u,Ue,U,e,d]);B.previewModeEnabled&&G.push({key:"Preview_mode",icon:(0,a.jsx)(r.EmIcons,{icon:"EyeOutlined",component:_.icons$EyeOutlined,size:18,strokeWidth:B.iconStrokeWidth}),label:n("Preview mode"),onClick:V}),B.livePreviewEnabled&&G.push({key:"Live_preview",icon:g?(0,a.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:_.icons$LoadingOutlined,style:{fontSize:16}}):(0,a.jsx)(r.EmIcons,{icon:"CheckCircleVerified",component:_.icons$CheckCircleVerified,size:18,strokeWidth:B.iconStrokeWidth}),label:n("Live preview"),onClick:k.id?.toString()===e.project_author?.toString()&&k?.subscription?.post_name==="community"&&x?Qe:Ye}),B.webversionEnabled&&G.push({key:"Web version",icon:(0,a.jsx)(r.EmIcons,{icon:"Web",component:_.icons$Web,size:18,strokeWidth:B.iconStrokeWidth}),label:n("Web version"),onClick:te}),B.sharePreviewEnabled&&G.push({key:"Share",icon:(0,a.jsx)(r.EmIcons,{icon:"ShareAltOutlined",component:_.icons$ShareAltOutlined,size:18,strokeWidth:B.iconStrokeWidth}),label:n("Share"),onClick:we,className:"em-analytics__email-share"});const ue=[{key:"Left_mode",icon:(0,a.jsx)(r.EmIcons,{icon:"PanelLeft",component:_.icons$PanelLeft,size:18,strokeWidth:B.iconStrokeWidth,style:{color:A==="left"&&L?O.colorPrimary:"inherit"}}),label:n("Left Code panel"),onClick:()=>T("left")},{key:"Right_mode",icon:(0,a.jsx)(r.EmIcons,{icon:"PanelLeft",component:_.icons$PanelLeft,size:18,strokeWidth:B.iconStrokeWidth,style:{transform:"rotate(180deg)",color:A==="right"&&L?O.colorPrimary:"inherit"}}),label:n("Right Code panel"),onClick:()=>T("right")},{key:"Bottom_mode",icon:(0,a.jsx)(r.EmIcons,{icon:"PanelLeft",component:_.icons$PanelLeft,size:18,strokeWidth:B.iconStrokeWidth,style:{transform:"rotate(-90deg)",color:A==="bottom"&&L?O.colorPrimary:"inherit"}}),label:n("Bottom Code panel"),onClick:()=>T("bottom")}];return(0,a.jsxs)("div",{className:"email-preview-menu email-preview-menu_new",children:[(0,a.jsxs)(_.ui_kit$Space,{size:32,children:[(0,a.jsxs)(_.ui_kit$Space,{className:"email-preview-menu__versions",size:8,style:{borderRadius:`calc(${r.emCssVar("borderRadius")} * 1px)`},children:[(0,a.jsx)(_.ui_kit$Tooltip,{title:n(t?r.COLLABORATION_EDITOR_WARNING_TEXT:"Undo (Ctrl+Z)"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:"text",icon:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.EmIcons,{icon:"UndoOutlined",component:_.icons$UndoOutlined,size:22,strokeWidth:B.iconStrokeWidth}),ge.isLocked&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:B.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:ge.isLocked?I:S,disabled:!ge.isLocked&&!K.canUndo})}),(0,a.jsx)(_.ui_kit$Tooltip,{title:n(t?r.COLLABORATION_EDITOR_WARNING_TEXT:"Redo (Ctrl+Shift+Z)"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:"text",icon:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.EmIcons,{icon:"RedoOutlined",component:_.icons$RedoOutlined,size:22,strokeWidth:B.iconStrokeWidth}),ge.isLocked&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:B.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:ge.isLocked?I:ae,disabled:!ge.isLocked&&!K.canRedo})}),B.historyEnabled&&(0,a.jsx)(_.ui_kit$Tooltip,{title:n("Version history"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:N?"text":"primary",ghost:!N,onClick:ft,disabled:e.isNew||ze,className:"email-preview-menu__history",icon:ze?(0,a.jsx)(_.ui_kit$Spin,{size:"small"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.EmIcons,{icon:"HistoryOutlined",component:_.icons$HistoryOutlined,size:22,strokeWidth:B.iconStrokeWidth,className:"email-preview-menu__list-item-icon email-preview-menu__list-item-icon_revert"}),X.isLocked&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:B.iconStrokeWidth,className:"free-mode-firewall-icon"})]})})})]}),(0,a.jsxs)(_.ui_kit$Space,{size:8,style:{borderRadius:`calc(${r.emCssVar("borderRadius")} * 1px)`},children:[B.codeEnabled&&(0,a.jsx)(_.ui_kit$Dropdown,{arrow:!0,placement:"bottom",menu:{items:ue},trigger:"hover",mouseEnterDelay:0,className:"email-preview-menu__code",children:(0,a.jsx)(_.ui_kit$Button,{type:L?"primary":"text",ghost:L,icon:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.EmIcons,{icon:"Code",component:_.icons$Code,size:22,strokeWidth:B.iconStrokeWidth}),Ee.isLocked&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:B.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:T})},"Code mode"),B.previewIconEnabled&&(Ie.isLocked?(0,a.jsx)(_.ui_kit$Tooltip,{title:n("Preview mode"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{type:"text",icon:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.EmIcons,{icon:"EyeOutlined",component:_.icons$EyeOutlined,size:22,strokeWidth:B.iconStrokeWidth,className:"email-preview-menu__list-item-icon"}),(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:B.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:()=>{Z(!0),ve(r.FEATURE_UPSELL_SLIDE.preview_service)}})}):(0,a.jsx)(_.ui_kit$Dropdown,{arrow:!0,placement:"bottom",menu:{items:G},className:"email-preview-menu__preview",children:(0,a.jsx)(_.ui_kit$Button,{type:"text",target:"_blank",rel:"noreferrer",icon:(0,a.jsx)(r.EmIcons,{icon:"EyeOutlined",component:_.icons$EyeOutlined,size:22,strokeWidth:B.iconStrokeWidth,className:"email-preview-menu__list-item-icon"}),onClick:B.previewModeEnabled?V:void 0})},"Preview")),B.sendTestEnabled&&(0,a.jsx)(_.ui_kit$Tooltip,{title:n("Send a test email"),placement:"bottom",children:(0,a.jsx)(_.ui_kit$Button,{className:"em-analytics__email-open-test email-preview-menu__test",type:"text",icon:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.EmIcons,{icon:"SendOutlined",component:_.icons$SendOutlined,size:22,strokeWidth:B.iconStrokeWidth,className:"email-preview-menu__list-item-icon"}),Re&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:14,strokeWidth:B.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:D})})]})]}),f&&(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(Iu,{isModalVisible:p,email:e})}),(0,a.jsx)(Dp,{open:Ae,onClose:()=>Te(!1)}),(0,a.jsx)(r.PlanUpgradePrompt,{open:H,onCancel:lt,initialSlide:De}),fe&&(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(oo,{open:et,onClose:Y,title:n(co.titleKey),subtitle:n(co.subtitleKey),usageResource:co.usageResource,previousDisplay:ie,nextDisplay:r.presetLimitDisplay("infinity"),onChangePlan:pe})})]})};ps.propTypes={};var Fp=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],Bp=200;function ms(e=new Set){const t=new Set;return(n,o)=>{if(!Fp.some(([s,c])=>!e.has(s)&&c.test(n)))return;const i=o??`new:${n.length}:${n.slice(0,200)}`;t.has(i)||(t.size>=Bp&&t.clear(),t.add(i))}}function fs(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:ms()}}var $p=fs();function on(e){return e?.getInstance(h.TEMPLATE_DIRECTIVES_ID)??$p}function Up({html:e,renderGuid:t,showToken:n,showId:o,...i},s){const{requested:c}=r.getCurrentProject(s),d=r.getAppConfig(s);return r.filterUndefined({...i,code:on(s).toOutputForm(e),project:c===void 0?i.project:c,utm_parameters:d.UTMEnabled?i.utm_parameters:void 0,tags:void 0,template:void 0,guid:void 0,emailtags:void 0,project_title:void 0,project_author:void 0,is_template:void 0,is_inited:void 0})}var zp=zt.__commonJSMin(((e,t)=>{r.init__polyfill_node_global(),(function(n,o){typeof define=="function"&&define.amd?define([],o):typeof e<"u"?o():(o(),n.FileSaver={})})(e,function(){"use strict";function n(p,f){return typeof f>"u"?f={autoBom:!1}:typeof f!="object"&&(f={autoBom:!f}),f.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(p.type)?new Blob(["\uFEFF",p],{type:p.type}):p}function o(p,f,g){var y=new XMLHttpRequest;y.open("GET",p),y.responseType="blob",y.onload=function(){u(y.response,f,g)},y.onerror=function(){},y.send()}function i(p){var f=new XMLHttpRequest;f.open("HEAD",p,!1);try{f.send()}catch{}return 200<=f.status&&299>=f.status}function s(p){try{p.dispatchEvent(new MouseEvent("click"))}catch{var f=document.createEvent("MouseEvents");f.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),p.dispatchEvent(f)}}var c=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof r._polyfill_node_global_default=="object"&&r._polyfill_node_global_default.global===r._polyfill_node_global_default?r._polyfill_node_global_default:void 0,d=c.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),u=c.saveAs||(typeof window!="object"||window!==c?function(){}:"download"in HTMLAnchorElement.prototype&&!d?function(p,f,g){var y=c.URL||c.webkitURL,m=document.createElement("a");f=f||p.name||"download",m.download=f,m.rel="noopener",typeof p=="string"?(m.href=p,m.origin===location.origin?s(m):i(m.href)?o(p,f,g):s(m,m.target="_blank")):(m.href=y.createObjectURL(p),setTimeout(function(){y.revokeObjectURL(m.href)},4e4),setTimeout(function(){s(m)},0))}:"msSaveOrOpenBlob"in navigator?function(p,f,g){if(f=f||p.name||"download",typeof p!="string")navigator.msSaveOrOpenBlob(n(p,g),f);else if(i(p))o(p,f,g);else{var y=document.createElement("a");y.href=p,y.target="_blank",setTimeout(function(){s(y)})}}:function(p,f,g,y){if(y=y||open("","_blank"),y&&(y.document.title=y.document.body.innerText="downloading..."),typeof p=="string")return o(p,f,g);var m=p.type==="application/octet-stream",E=/constructor/i.test(c.HTMLElement)||c.safari,k=/CriOS\/[\d]+/.test(navigator.userAgent);if((k||m&&E||d)&&typeof FileReader<"u"){var w=new FileReader;w.onloadend=function(){var P=w.result;P=k?P:P.replace(/^data:[^;]*;/,"data:attachment/file;"),y?y.location.href=P:location=P,y=null},w.readAsDataURL(p)}else{var v=c.URL||c.webkitURL,x=v.createObjectURL(p);y?y.location=x:location.href=x,y=null,setTimeout(function(){v.revokeObjectURL(x)},4e4)}});c.saveAs=u.saveAs=u,typeof t<"u"&&(t.exports=u)})})),sn=zp(),In="NEXT_BUTTON",uo="SAVE_BUTTON",po="KEYBOARD",Gp="EXTERNAL",Wp=new Set([uo,In,po]);function Hp(e){return e!=null&&e!==""&&Wp.has(e)}function gs(e){if(!e||e==="all")return;const t=Number(e);return Number.isFinite(t)?[t]:void 0}var hs=(0,l.createContext)(null);function qp(){const e=(0,l.useContext)(hs);if(!e)throw new Error("useEmailSaveController must be used within EmailSaveContext.Provider");return e}var Vp=2;function Kp({email:e,documentSession:t,save:n,saveState:o}){const i=r.useDispatch(),{__:s}=r.useI18n(),c=r.useEditorProjectId();r.useRouteEmailId();const d=+c,u=Number.isFinite(d)&&d>0?d:e?.project,p=r.useCookieManager(),f=r.useContainer(),g=r.useNotification(),y=r.useAppConfig(),m=r.useConfigSource(),[E,k]=(0,l.useState)(0),w=(0,l.useRef)(""),[v,x]=(0,l.useState)(!1),P=r.useEventEmitter(h.events.ON_NEXTBUTTON_CLICK_ID),K=r.useEventEmitter(h.events.ON_SAVEBUTTON_CLICK_ID);r.useEvent(h.events.ON_EMAIL_INIT_ID);const J=y.activeNextButton===!1,N=y.disableDoubleClickNextButton!==!1,L=(0,l.useRef)(!1),A=(0,l.useRef)(void 0),O=(0,l.useRef)(null),z=(0,l.useRef)(null),B=(0,l.useRef)(e);B.current=e;const U=(0,l.useCallback)(()=>{A.current=void 0},[]),de=(0,l.useCallback)(X=>{m.merge({activeNextButton:!X},"user")},[m]),me=(0,l.useCallback)((X,Ee)=>{const Ie=r.saveRefusalReason(Ee);if(Ie==="locked"){g.error({id:"EMAIL_ACCESS_TO_LOCKED_ERROR",data:r.getEmailDesc(X),message:s("No access to edit the letter.")});return}if(Ie==="too-many-tags"){g.error({id:"EMAIL_TOO_MANY_TAGS_ERROR",data:r.getEmailDesc(X),message:s("Maximum 10 tags available.")});return}const ge=r.failedTerms(Ee);if(ge){ge.failed.forEach(Re=>{if(ge.kind==="group"){g.fromError("GROUP_CREATING_ERROR",{id:Re.id??0,name:Re.name,parent:Re.parent??0},Ee);return}g.fromError("TAG_CREATING_ERROR",Re.name,Ee)});return}g.fromError(X.isNew?"EMAIL_CREATING_ERROR":"EMAIL_EDITING_ERROR",r.getEmailDesc(X),Ee)},[g,s]),H=(0,l.useCallback)(X=>{const Ee=Hp(X),Ie=()=>{x(!1),X===In&&(L.current=!1,de(!1))};if(!e){Ie();return}const ge=async()=>{(Ue=>{n("publish",{project:Ue.isNew?u:Ue.project,folder:gs(p.get(r.APP_COOKIES.em_folder)),source:X}).then(C=>{if(x(!1),L.current=!1,!C){X===In&&de(!1),Ee&&(me(Ue,o().error),U());return}Ee&&(g.success({id:"EMAIL_SAVING_SUCCESS",message:s("The email was successfully saved."),data:r.getEmailDesc(Ue)}),U())})})(e)};x(!0),ge()},[e,i,c,s,t,p,u,g,me,n,o,de,U]);r.useCommand(r.SAVE_COMMAND_ID,(0,l.useCallback)(X=>H(X||Gp),[H]));const Z=(0,l.useRef)(void 0),De=(0,l.useRef)(H);De.current=H;const ve=(0,l.useCallback)(X=>{w.current=X,k(Ee=>Ee+1)},[]);(0,l.useEffect)(()=>()=>{Z.current!==void 0&&clearTimeout(Z.current)},[]),(0,l.useEffect)(()=>{if(E===0)return;const X=w.current;B.current?.isNew&&(A.current=X),Z.current!==void 0&&clearTimeout(Z.current),Z.current=setTimeout(()=>{Z.current=void 0,De.current(X)})},[E]);const et=(0,l.useCallback)(X=>{(X.ctrlKey||X.metaKey)&&X.keyCode===83&&(X.preventDefault(),ve(po))},[ve]);(0,l.useEffect)(()=>(document.addEventListener("keydown",et),()=>{document.removeEventListener("keydown",et)}),[et]);const be=(0,l.useCallback)(X=>{const Ee=X.data.operation,Ie=X.data.action;Ee===r.EVENT_TYPES.APPLICATION_ACTION&&Ie==="save_email"&&ve(po)},[ve]);r.useListenPostMessage(be),(0,l.useEffect)(()=>{e?.isNew&&(z.current=null,O.current=null)},[e?.isNew,e?.renderGuid]),(0,l.useEffect)(()=>{L.current=!1},[e?.id]);const fe=p.get(r.APP_COOKIES.em_folder),Y=f?r.provideAutosaveUiFacts(f):void 0;(0,l.useEffect)(()=>{Y?.set({...Y?.get()??{isUserBusy:!1,saveContext:{}},saveContext:{project:u,folder:gs(fe)}})},[Y,u,fe]);const pe=(0,l.useRef)(!1),ie=o().failures;(0,l.useEffect)(()=>{ie>=Vp&&!pe.current&&(pe.current=!0,g.warning({message:s("Changes are not being saved. Check your connection.")})),ie===0&&(pe.current=!1)},[ie,g,s]);const se=v,Ae=o().saving,Te=(0,l.useCallback)(X=>{ve(X||uo)},[ve]),Fe=(0,l.useCallback)(async(X,Ee)=>{if(X===In){if(L.current)return;L.current=!0;try{N&&de(!0),(await P.fire(Ee)).every(Ie=>Ie!==!1)?ve(In):(de(!1),L.current=!1)}catch(Ie){g.fromError("NEXT_BUTTON_CLICK_EVENT_ERROR",r.getEmailDesc(Ee),Ie,!0),de(!1),L.current=!1}return}try{(await K.fire(Ee)).every(Ie=>Ie!==!1)&&ve(X||uo)}catch(Ie){g.fromError("SAVE_BUTTON_CLICK_EVENT_ERROR",r.getEmailDesc(Ee),Ie,!0)}},[N,P,K,g,de,ve]);return(0,l.useMemo)(()=>({requestSave:Te,requestSaveWithEvents:Fe,isLoading:se,isAutosaveLoading:Ae,nextButtonDisabled:J}),[Te,Fe,se,Ae,J])}var Yp="NEXT_BUTTON",Qp="SAVE_BUTTON",_s=({email:e=null,disabled:t})=>{const{__:n}=r.useI18n(),o=r.useAppConfig(),i=r.useContentReader(),s=r.useNotification(),{requestSaveWithEvents:c,isLoading:d,isAutosaveLoading:u,nextButtonDisabled:p}=qp(),f=d||u,[g,y]=(0,l.useState)(null);(0,l.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&y(!0)},[]);const m=o.saveButtonEnabled&&(0,a.jsx)(_.ui_kit$Tooltip,{title:n(g?"Save by ⌘S":"Save by Ctrl+S"),placement:"bottom",children:(0,a.jsx)("span",{className:"em-analytics__email-save-tooltip-target",children:(0,a.jsx)(_.ui_kit$Button,{disabled:t||u,type:o.nextButtonEnabled?"default":"primary",block:"false",className:"em-analytics__email-save",loading:f,icon:(0,a.jsx)(r.EmIcons,{icon:"SaveOutlined",component:_.icons$SaveOutlined,size:16,strokeWidth:o.iconStrokeWidth}),onClick:async k=>{const w=k.currentTarget,v={...e,html:i()};try{await c(Qp,v)}catch(x){s.fromError("SAVE_BUTTON_CLICK_EVENT_ERROR",r.getEmailDesc(v),x,!0)}finally{try{w?.blur?.()}catch{}}},children:o.saveButtonText||n("Save")})})},"save-button"),E=o.nextButtonEnabled&&(0,a.jsx)(_.ui_kit$Button,{disabled:t||p,type:"primary",block:"false",className:"em-analytics__email-save",icon:o.primaryCommandButtonIcon,loading:d,onClick:async()=>{const k={...e,html:i()};await c(Yp,k)},children:o.nextButtonText||n("Continue")},"next-button");return(0,a.jsx)(a.Fragment,{children:o.saveButtonEnabled&&o.nextButtonEnabled?(0,a.jsx)(_.ui_kit$Space,{children:[m,E]}):[m,E]})};_s.propTypes={email:$e.default.shape({id:$e.default.string,isNew:$e.default.bool,title:$e.default.string,lock:$e.default.bool,subject:$e.default.string,html:$e.default.string,description:$e.default.string,utm_parameters:$e.default.shape({utm_source:$e.default.string,utm_medium:$e.default.string,utm_campaign:$e.default.string,utm_term:$e.default.string,utm_content:$e.default.string}),project:$e.default.number,is_template:$e.default.bool}),disabled:$e.default.bool};var ys=({element:e,context:t="list"})=>{const{__:n,_x:o}=r.useI18n(),[i]=r.useEditEmailMutation(),[s]=r.useEditBlockMutation(),c=r.useNotification(),d=r.usePushToDataLayer();e.hasOwnProperty("type");const u=(f,g)=>{if(f.error)return c.error(f),!1;c.success(n("The ")+(g.hasOwnProperty("type")?n("block"):o("email","letter"))+" "+n("“")+f.data.title+n("”")+n("was successfully")+" "+(g.lock?g.hasOwnProperty("type")?o("unlocked.","block"):o("unlocked.","email"):g.hasOwnProperty("type")?o("locked.","block"):o("locked.","email")))},p=()=>{const f=!e.lock,g=f?"lock_email":"unlock_email";e.hasOwnProperty("type")?s({blockId:e.id,lock:f}).then(y=>{u(y,e),y.error||d({event:f?"lock":"unlock",action:f?"lock_block":"unlock_block",entity_type:"block",entity_id:e.id,project_id:e.project,context:t})}):i({emailId:e.id,lock:f}).then(y=>{u(y,e),y.error||d({event:f?"lock":"unlock",action:g,entity_type:"email",entity_id:e.id,project_id:e.project,context:t})})};return(0,a.jsx)("div",{className:e.hasOwnProperty("type")?"em-analytics__block-lock":"em-analytics__email-lock",onClick:p,children:e.lock?n("Unlock"):n("Lock")})};ys.propTypes={element:$e.default.shape({lock:$e.default.bool,id:$e.default.string})};var Xp=({open:e,codeSize:t,onMinimize:n,onDownloadAsIs:o,onCancel:i})=>{const{__:s}=r.useI18n(),c=r.formatCodeSize(t);return(0,a.jsx)(_.ui_kit$Modal,{open:e,onCancel:i,footer:null,className:"code-size-warning-modal",width:480,children:(0,a.jsxs)("div",{className:"code-size-warning-modal__content",children:[(0,a.jsx)("h3",{className:"code-size-warning-modal__title",children:s("Code Size Warning")}),(0,a.jsxs)("div",{className:"code-size-warning-modal__message",children:[(0,a.jsxs)("p",{children:[s("The current code size is")," ",(0,a.jsx)("strong",{children:c}),","," ",s("which exceeds the recommended 90 KB limit.")]}),(0,a.jsx)("p",{children:s("Large emails may have delivery issues and load slowly. We recommend minimizing code before exporting.")})]}),(0,a.jsxs)(_.ui_kit$Space,{className:"code-size-warning-modal__actions",size:"medium",children:[(0,a.jsx)(_.ui_kit$Button,{type:"primary",onClick:n,size:"large",children:s("Minimize code")}),(0,a.jsx)(_.ui_kit$Button,{onClick:o,size:"large",children:s("Download as is")})]})]})})};function Jp(e){return e.includes("em-narrow-table")}function Zp(e){if(!e||Jp(e))return!1;const t=e.includes("nl-container"),n=/row-content\s+stack/.test(e)||/stack\s+row-content/.test(e),o=/\brow-\d/.test(e),i=/_block\s+block-\d/.test(e),s=e.includes('role="presentation"');return t&&n&&(o||i)&&s}function em(e){return e?e.includes("em-narrow-table"):!1}function tm(e){return e.includes("em-narrow-table")}function nm(e){return e.includes("i-amphtml")||e.includes("amp-runtime")||e.includes("amp-version")}function rm(e){if(!e||tm(e)||nm(e))return!1;const t=e.includes("es-wrapper"),n=/es-(?:header|content|footer)-body/.test(e);return t||n}function vs(){r.useAppConfig();const e=r.useIntegratorConfigValue("beeFreeConverterEnabled"),t=r.useIntegratorConfigValue("stripoConverterEnabled"),n=r.useIntegratorConfigValue("aiLayoutConverterEnabled"),o=e===!0,i=t===!0,s=n===!0;return{beeFreeConverterEnabled:o,stripoConverterEnabled:i,aiLayoutConverterEnabled:s,anyConverterEnabled:o||i||s}}function bs(e,t){return!e||em(e)?null:Zp(e)?t.beeFreeConverterEnabled?"beefree":null:rm(e)?t.stripoConverterEnabled?"stripo":null:t.aiLayoutConverterEnabled?"ai":null}var om=()=>"useblocks",im={unisender:{id:"unisender",name:"Unisender",icon:"/images/integrations/unisender.svg",description:"Export emails to Unisender",cardDescription:"Mass mailing automation, audience segmentation, and campaign performance analytics.",apps:["emailmaker"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter Unisender API key",helpUrl:"https://app.unisender.com/ru/v5/cp/user/info/api"},{name:"sender_email",type:"email",label:"Sender Email",required:!0,placeholder:"sender@example.com",extra:"This email must be verified in Unisender"},{name:"sender_name",type:"text",label:"Sender Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"list_id",type:"number",label:"Contact List ID",required:!0,placeholder:"e.g., 123456"}]},mailganer:{id:"mailganer",name:"Mailganer",icon:"/images/integrations/mailganer.svg",description:"Export emails to Mailganer",cardDescription:"Contact sync, content personalization, and real-time campaign results tracking.",apps:["emailmaker"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter Mailganer API key",helpUrl:"https://mailganer.com/app/profile/"},{name:"from_email",type:"email",label:"Sender Email",required:!1,placeholder:"sender@example.com",extra:"This email must be verified in Mailganer"},{name:"from_name",type:"text",label:"Sender Name",required:!1,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Mailing Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"theme",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},sendsay:{id:"sendsay",name:"Sendsay",icon:"/images/integrations/sendsay.svg",description:"Export emails to Sendsay",cardDescription:"Mailing automation, audience segmentation, and email personalization.",apps:["emailmaker"],settingsFields:[{name:"login",type:"text",label:"Account Login",required:!0,placeholder:"e.g., myaccount or myaccount/sublogin",extra:"Your Sendsay account login (not email). For sublogin use format: account/sublogin",fullWidth:!0},{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter Sendsay API key",helpUrl:"https://docs.sendsay.ru/sendsay-api/how-to-get-apikey"},{name:"from_email",type:"email",label:"Sender Email",required:!1,placeholder:"sender@example.com",extra:"This email must be verified in Sendsay"},{name:"from_name",type:"text",label:"Sender Name",required:!1,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Draft Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!0,placeholder:"e.g., Special offer for you!"}]},klaviyo:{id:"klaviyo",name:"Klaviyo",icon:"/images/integrations/klaviyo.svg",description:"Export emails to Klaviyo",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"e.g., pk_xxxxxxxx",helpUrl:"https://help.klaviyo.com/hc/en-us/articles/7423954176283-How-to-create-a-private-API-key",extra:"Use a custom key with templates:write and campaigns:write (or Full access). Campaigns-only is not enough — export creates a template first."},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"This email must be verified in Klaviyo"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"list_id",type:"text",label:"List ID",required:!0,placeholder:"e.g., ABC123",helpText:"Find your List ID in Klaviyo: Lists & Segments → List → Settings"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},campaign_monitor:{id:"campaign_monitor",name:"Campaign Monitor",icon:"/images/integrations/campaign_monitor.svg",description:"Export emails to Campaign Monitor",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter API Key",fullWidth:!0,helpUrl:"https://help.campaignmonitor.com/s/article/api-keys"},{name:"client_id",type:"text",label:"Client ID",required:!0,placeholder:"e.g., 4a397ccaaa55eb4e6aa1221e1e2d7122",helpText:"Find in Account Settings → API Keys"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be verified in Campaign Monitor"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"list_id",type:"text",label:"List ID",required:!0,placeholder:"e.g., a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",helpText:"Find in Lists → List ID"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},constant_contact:{id:"constant_contact",name:"Constant Contact",icon:"/images/integrations/constant_contact.svg",description:"Export emails to Constant Contact",apps:["useblocks"],settingsFields:[{name:"access_token",type:"password",label:"Access Token",required:!0,placeholder:"OAuth2 Bearer token",fullWidth:!0,helpText:"Get from Constant Contact Developer Portal. Token expires in 24 hours.",helpUrl:"https://developer.constantcontact.com/api_guide/getting_started.html"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be confirmed in Constant Contact"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"list_id",type:"text",label:"Contact List ID",required:!0,placeholder:"e.g., fa32f620-6d82-11e8-8b59-fa163e56c9b0",helpText:"Find via GET /contact_lists API"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},bento:{id:"bento",name:"Bento",icon:"/images/integrations/bento.svg",description:"Export emails to Bento",apps:["useblocks"],settingsFields:[{name:"publishable_key",type:"password",label:"Publishable Key",required:!0,placeholder:"Enter Publishable Key",fullWidth:!0,helpUrl:"https://app.bentonow.com/account/teams"},{name:"secret_key",type:"password",label:"Secret Key",required:!0,placeholder:"Enter Secret Key",fullWidth:!0},{name:"site_uuid",type:"text",label:"Site UUID",required:!0,placeholder:"Your site UUID",helpText:"Find in Bento dashboard"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be an author in your Bento account"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Broadcast Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"},{name:"inclusive_tags",type:"text",label:"Tags (inclusive)",required:!1,placeholder:"e.g., subscribers,newsletter",helpText:"Comma-separated tags to send to. Default: subscribers"}]},dotdigital:{id:"dotdigital",name:"Dotdigital",icon:"/images/integrations/dotdigital.svg",description:"Export emails to Dotdigital",apps:["useblocks"],settingsFields:[{name:"username",type:"text",label:"API Username",required:!0,placeholder:"API user email",helpText:"API user email from Settings → Access → API users",helpUrl:"https://developer.dotdigital.com/docs/setting-up-an-api-user"},{name:"password",type:"password",label:"API Password",required:!0,placeholder:"API user password",fullWidth:!0},{name:"region",type:"text",label:"Region",required:!0,placeholder:"r1, r2, or r3",helpText:"r1=Europe, r2=North America, r3=Asia Pacific"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",fullWidth:!0,extra:"Use an email registered as a Custom from address in Dotdigital (see support.dotdigital.com — “Create a custom from address”). If it does not match, export uses your account default sender."},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},getresponse:{id:"getresponse",name:"GetResponse",icon:"/images/integrations/getresponse.svg",description:"Export emails to GetResponse",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter API Key",fullWidth:!0,helpUrl:"https://app.getresponse.com/api"},{name:"from_field_id",type:"text",label:"From Field ID",required:!0,placeholder:"e.g., V",helpText:"Find via GET /from-fields API"}],exportFields:[{name:"name",type:"text",label:"Newsletter Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"campaign_id",type:"text",label:"Campaign ID",required:!0,placeholder:"e.g., C",helpText:"List/campaign ID from GET /campaigns"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},brevo:{id:"brevo",name:"Brevo",icon:"/images/integrations/brevo.svg",description:"Export emails to Brevo",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter API Key",fullWidth:!0,helpUrl:"https://help.brevo.com/hc/en-us/articles/209467485-Create-and-manage-your-API-keys"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be verified in Brevo"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"list_id",type:"number",label:"List ID",required:!0,placeholder:"e.g., 2",helpText:"Find in Contacts → Lists"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},activecampaign:{id:"activecampaign",name:"ActiveCampaign",icon:"/images/integrations/activecampaign.svg",description:"Export emails as draft campaigns to ActiveCampaign",apps:["useblocks"],settingsFields:[{name:"api_url",type:"text",label:"API URL",required:!0,placeholder:"e.g., https://youraccount.api-us1.com",helpText:"Find in Settings → Developer → API Access",helpUrl:"https://help.activecampaign.com/hc/en-us/articles/207317590-Getting-started-with-the-API"},{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter API Key",fullWidth:!0},{name:"list_id",type:"text",label:"List ID",required:!0,placeholder:"e.g., 1",extra:"Find in Lists → Click your list → The ID is in the URL (e.g., /app/contacts?listid=1)"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be verified in ActiveCampaign"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},salesforce_mc:{id:"salesforce_mc",name:"Salesforce",icon:"/images/integrations/salesforce.svg",description:"Export emails to Salesforce",apps:["useblocks"],settingsFields:[{name:"subdomain",type:"text",label:"Tenant Subdomain",required:!0,placeholder:"e.g., mc563885gzs27c5t9-63k636ttgm",helpText:"Find in Installed Packages → API Integration → REST Base URI",helpUrl:"https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/your-subdomain-tenant-specific-endpoints.html"},{name:"client_id",type:"text",label:"Client ID",required:!0,placeholder:"From Installed Package"},{name:"client_secret",type:"password",label:"Client Secret",required:!0,placeholder:"From Installed Package"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be verified in Marketing Cloud"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Email Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},hubspot:{id:"hubspot",name:"HubSpot Email",icon:"/images/integrations/hubspot.svg",description:"Export emails to HubSpot",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"Private App Access Token",required:!0,placeholder:"e.g., pat-na1-xxxx",helpUrl:"https://developers.hubspot.com/docs/api/private-apps"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"This email must be verified in HubSpot"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Email Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},mailchimp:{id:"mailchimp",name:"Mailchimp",icon:"/images/integrations/mailchimp.svg",description:"Export emails to Mailchimp",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"e.g., xxxxxxxx-us1",helpUrl:"https://mailchimp.com/help/about-api-keys/"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"This email must be verified in Mailchimp"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"list_id",type:"text",label:"Audience ID",required:!0,placeholder:"e.g., a1b2c3d4e5",helpText:"Find your Audience ID in Audience settings → Audience name and defaults"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},enkod:{id:"enkod",name:"enKod",icon:"/images/integrations/enkod.svg",description:"Export emails to enKod",cardDescription:"Multi-channel campaigns automation (email, SMS, push, WhatsApp, and more).",apps:["emailmaker"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter enKod API key",helpUrl:"https://help.enkod.io/doku.php/api:start"},{name:"sender_email",type:"email",label:"Sender Email",required:!0,placeholder:"sender@example.com"},{name:"sender_name",type:"text",label:"Sender Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"subject",type:"text",label:"Email Subject",required:!0,placeholder:"e.g., Special offer for you!"}]}},sm=(e,t)=>!e.apps||e.apps.length===0?!0:e.apps.includes(t),mo=e=>{const t=im[e];if(t&&sm(t,om()))return t},am=(e,t)=>{const n={placeholder:e.placeholder?t(e.placeholder):void 0,style:{width:"100%"}};switch(e.type){case"number":return(0,a.jsx)(_.ui_kit$InputNumber,{...n,min:1});case"email":return(0,a.jsx)(_.ui_kit$Input,{...n,type:"email"});default:return(0,a.jsx)(_.ui_kit$Input,{...n})}},lm=({integration:e,visible:t,loading:n=!1,onConfirm:o,onCancel:i,__:s})=>{const[c]=_.ui_kit$Form.useForm(),d=e.exportFields||[];(0,l.useEffect)(()=>{t||c.resetFields()},[t,c]);const u=()=>{n||c.validateFields().then(g=>{o(g)})},p=()=>{c.resetFields(),i()};if(d.length===0)return null;const f=d.find(g=>g.helpText);return(0,a.jsxs)(_.ui_kit$Modal,{title:s(`Export to ${e.name}`),open:t,onOk:u,onCancel:p,okText:s("Export"),cancelText:s("Cancel"),confirmLoading:n,cancelButtonProps:{disabled:n},children:[f&&(0,a.jsx)(_.ui_kit$Alert,{title:s(f.label),description:s(f.helpText),type:"info",showIcon:!0,style:{marginBottom:16}}),(0,a.jsx)(_.ui_kit$Form,{form:c,layout:"vertical",children:d.map(g=>(0,a.jsx)(_.ui_kit$Form.Item,{label:s(g.label),name:g.name,rules:[...g.required?[{required:!0,message:s(`Please enter ${g.label.toLowerCase()}`)}]:[],...g.type==="number"?[{type:"number",message:s(`${g.label} must be a number`)}]:[]],children:am(g,s)},g.name))})]})},Xn=r.createApi({reducerPath:"unisenderApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createEmailMessage:e.mutation({query:t=>{const n="https://api.unisender.com/ru/api/createEmailMessage",o=new URLSearchParams;return o.append("format","json"),Object.entries(t).forEach(([i,s])=>{o.append(i,String(s))}),{url:`?proxy_url=${encodeURIComponent(n)}`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o.toString()}}})})}),{useCreateEmailMessageMutation:cm}=Xn,Jn=r.createApi({reducerPath:"mailganerApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://mailganer.com"}),endpoints:e=>({createMailing:e.mutation({query:t=>{const n=new URLSearchParams;return n.append("api_key",t.api_key),n.append("name",t.name),n.append("html-content",t.html_content),t.theme&&n.append("theme",t.theme),t.from_name&&n.append("from_name",t.from_name),t.from_email&&n.append("from_email",t.from_email),t.segment_id&&n.append("segment_id",String(t.segment_id)),t.utm_campaign&&n.append("utm_campaign",t.utm_campaign),t.utm_source&&n.append("utm_source",t.utm_source),t.utm_medium&&n.append("utm_medium",t.utm_medium),{url:"/api/v1/mailing/create/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:n.toString()}}})})}),{useCreateMailingMutation:dm}=Jn,Zn=r.createApi({reducerPath:"sendsayApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://api.sendsay.ru"}),endpoints:e=>({createDraft:e.mutation({query:t=>{const n={action:"issue.draft.set",apikey:t.api_key,return_fresh_obj:1,obj:{name:t.name,letter:{subject:t.subject,"from.name":t.from_name||void 0,"from.email":t.from_email||void 0,message:{html:t.html_content}}}};return{url:`/general/api/v100/json/${t.login.split("/").map(o=>encodeURIComponent(o)).join("/")}`,method:"POST",headers:{"Content-Type":"application/json"},body:n}}})})}),{useCreateDraftMutation:um}=Zn,er=r.createApi({reducerPath:"altcraftApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({addTemplate:e.mutation({query:t=>{const n=`${t.api_url}/api/v1.1/templates/add`,o={token:t.api_key,name:t.name,channels:[{sid:"email",fields:{html:t.html_content,text:"",subject:t.subject||t.name,from_email:t.from_email||"",from_name:t.from_name||"",replyto_email:"",replyto_name:"",is_not_inline:!0}}],is_draft:t.is_draft??!1};return{url:`?proxy_url=${encodeURIComponent(n)}`,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}}})})}),{useAddTemplateMutation:pm}=er,mm=e=>e.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/\s+/g," ").trim(),tr=r.createApi({reducerPath:"enkodApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://api.enkod.ru"}),endpoints:e=>({createMessage:e.mutation({query:t=>{const n=mm(t.html_content)||t.subject,o={message:{subject:t.subject,fromEmail:t.sender_email||"",fromName:t.sender_name||"",html:t.html_content,plainText:n},isDraft:!0};return{url:"/v1/message/onetime/",method:"POST",headers:{"Content-Type":"application/json",Apikey:t.api_key},body:o}}})})}),{useCreateMessageMutation:fm}=tr,gm=e=>{const t=e.split("-");return t.length>1?t[1]:"us1"},hm=e=>`https://${gm(e)}.api.mailchimp.com/3.0`,nr=r.createApi({reducerPath:"mailchimpApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s=hm(t.api_key),c=btoa(`anystring:${t.api_key}`),d={type:"regular",recipients:{list_id:t.list_id},settings:{subject_line:t.subject,from_name:t.from_name,reply_to:t.from_email}},u=await i({url:`?proxy_url=${encodeURIComponent(`${s}/campaigns`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Basic ${c}`},body:JSON.stringify(d)});if(u.error){const y=u.error,m=y?.data?.detail||y?.error||String(u.error),E=y?.data?.errors;return{error:{status:"CUSTOM_ERROR",error:E?.length?E.map(k=>k.detail||k.title).join("; "):m}}}const p=u.data;if(!p?.id)return{error:{status:"CUSTOM_ERROR",error:u.data?.errors?.map(y=>y.detail||y.title).join("; ")||"Failed to create campaign"}};const f={html:t.html},g=await i({url:`?proxy_url=${encodeURIComponent(`${s}/campaigns/${p.id}/content`)}`,method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Basic ${c}`},body:JSON.stringify(f)});if(g.error){const y=g.error;return{error:{status:"CUSTOM_ERROR",error:y?.data?.detail||y?.error||String(g.error)}}}return{data:{id:p.id,status:p.status,web_id:p.web_id}}}})})}),{useCreateCampaignMutation:_m}=nr,fo="https://a.klaviyo.com/api",ym="2025-04-15",vm=e=>({"Content-Type":"application/json",Accept:"application/json",Authorization:`Klaviyo-API-Key ${e}`,revision:ym}),rr=r.createApi({reducerPath:"klaviyoApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s=vm(t.api_key),c={data:{type:"template",attributes:{name:`Email ${Date.now()}`,editor_type:"CODE",html:t.html}}},d=await i({url:`?proxy_url=${encodeURIComponent(`${fo}/templates`)}`,method:"POST",headers:s,body:JSON.stringify(c)});if(d.error){const w=d.error,v=w?.data?.errors,x=w?.data?.detail;return{error:{status:"CUSTOM_ERROR",error:v?.length?v.map(P=>P.detail||P.status).join("; "):x||w?.error||String(d.error)}}}const u=d.data?.data?.id;if(!u)return{error:{status:"CUSTOM_ERROR",error:"Failed to create template"}};const p={data:{type:"campaign",attributes:{name:`Campaign ${Date.now()}`,audiences:{included:[t.list_id],excluded:[]},send_strategy:{method:"immediate"},"campaign-messages":{data:[{type:"campaign-message",attributes:{definition:{channel:"email",label:t.subject,content:{subject:t.subject,from_email:t.from_email,from_label:t.from_name,reply_to_email:t.from_email}}}}]}}}},f=await i({url:`?proxy_url=${encodeURIComponent(`${fo}/campaigns`)}`,method:"POST",headers:s,body:JSON.stringify(p)});if(f.error){const w=f.error,v=w?.data?.errors,x=w?.data?.detail;return{error:{status:"CUSTOM_ERROR",error:v?.length?v.map(P=>P.detail||P.status).join("; "):x||w?.error||String(f.error)}}}const g=f.data,y=g?.data?.relationships?.["campaign-messages"]?.data?.[0]?.id,m=g?.data?.id;if(!y)return{error:{status:"CUSTOM_ERROR",error:"Failed to get campaign message from campaign"}};const E={data:{type:"campaign-message",id:y,relationships:{template:{data:{type:"template",id:u}}}}},k=await i({url:`?proxy_url=${encodeURIComponent(`${fo}/campaign-message-assign-template`)}`,method:"POST",headers:s,body:JSON.stringify(E)});if(k.error){const w=k.error,v=w?.data?.errors,x=w?.data?.detail;return{error:{status:"CUSTOM_ERROR",error:v?.length?v.map(P=>P.detail||P.status).join("; "):x||w?.error||String(k.error)}}}return{data:{id:m,campaign_message_id:y}}}})})}),{useCreateCampaignMutation:bm}=rr,Em="https://api.hubapi.com",Sm=e=>({"Content-Type":"application/json",Authorization:`Bearer ${e}`}),or=r.createApi({reducerPath:"hubspotApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createEmail:e.mutation({queryFn:async(t,n,o,i)=>{const s=Sm(t.api_key),c={name:t.name,subject:t.subject,from:{fromName:t.from_name,replyTo:t.from_email},content:{templatePath:"@hubspot/email/dnd/plain_text.html",widgets:{"module-0-1-1":{body:{html:t.html,path:"@hubspot/rich_text",schema_version:2},child_css:{},css:{},id:"module-0-1-1",name:"module-0-1-1",order:2,styles:{},type:"module"},"module-1-1-1":{body:{align:"center",path:"@hubspot/email_footer",schema_version:2,unsubscribe_link_type:"both"},child_css:{},css:{},id:"module-1-1-1",name:"module-1-1-1",order:3,styles:{},type:"module"}}}},d=await i({url:`?proxy_url=${encodeURIComponent(`${Em}/marketing/v3/emails/`)}`,method:"POST",headers:s,body:JSON.stringify(c)});if(d.error){const p=d.error,f=p?.data?.errors,g=p?.data?.message;return{error:{status:"CUSTOM_ERROR",error:f?.length?f.map(y=>y.message||y.errorType).join("; "):g||p?.error||String(d.error)}}}const u=d.data;return u?.id?{data:{id:u.id}}:{error:{status:"CUSTOM_ERROR",error:d.data?.errors?.map(p=>p.message||p.errorType).join("; ")||"Failed to create email"}}}})})}),{useCreateEmailMutation:wm}=or,ir=r.createApi({reducerPath:"salesforceMcApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createEmail:e.mutation({queryFn:async(t,n,o,i)=>{const s=`https://${t.subdomain}.auth.marketingcloudapis.com/v2/token`,c=await i({url:`?proxy_url=${encodeURIComponent(s)}`,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"client_credentials",client_id:t.client_id,client_secret:t.client_secret})});if(c.error){const m=c.error;return{error:{status:"CUSTOM_ERROR",error:m?.data?.error_description||m?.data?.error||m?.error||String(c.error)}}}const d=c.data,u=d?.access_token,p=d?.rest_instance_url;if(!u||!p)return{error:{status:"CUSTOM_ERROR",error:d?.error_description||d?.error||"Failed to get access token"}};const f={name:t.name,assetType:{id:208,name:"htmlemail"},views:{html:{content:t.html},text:{},subjectline:{content:t.subject},preheader:{}},data:{email:{options:{characterEncoding:"utf-8"}}}},g=await i({url:`?proxy_url=${encodeURIComponent(`${p.replace(/\/$/,"")}/asset/v1/content/assets`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`},body:JSON.stringify(f)});if(g.error){const m=g.error,E=m?.data?.errors,k=m?.data?.message;return{error:{status:"CUSTOM_ERROR",error:E?.length?E.map(w=>w.message||w.documentation).join("; "):k||m?.error||String(g.error)}}}const y=g.data;return y?.id?{data:{id:y.id}}:{error:{status:"CUSTOM_ERROR",error:g.data?.errors?.map(m=>m.message).join("; ")||"Failed to create email"}}}})})}),{useCreateEmailMutation:km}=ir,Cm=e=>e.replace(/\/$/,""),Tm=e=>e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim()||" ",sr=r.createApi({reducerPath:"activecampaignApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s=Cm(t.api_url),c=t.api_key,d={"Content-Type":"application/json","Api-Token":c},u=await i({url:`?proxy_url=${encodeURIComponent(`${s}/api/3/addresses`)}`,method:"GET",headers:{"Api-Token":c}});if(u.error)return{error:{status:"CUSTOM_ERROR",error:"Failed to load mailing addresses. Check your API URL and Key."}};const p=u.data?.addresses??[],f=p.find(P=>P.isDefault==="1")??p[0];if(!f?.id)return{error:{status:"CUSTOM_ERROR",error:"NO_MAILING_ADDRESS"}};const g={message:{name:t.name,fromname:t.from_name,fromemail:t.from_email,email:t.from_email,reply2:t.from_email,subject:t.subject,html:t.html,text:Tm(t.html),preheader_text:"",format:"mime"}},y=await i({url:`?proxy_url=${encodeURIComponent(`${s}/api/3/messages`)}`,method:"POST",headers:d,body:JSON.stringify(g)});if(y.error){const P=y.error;return{error:{status:"CUSTOM_ERROR",error:P?.data?.message||P?.error||"Failed to create message."}}}const m=y.data?.message?.id;if(!m)return{error:{status:"CUSTOM_ERROR",error:"Message created but no ID returned."}};const E=`${s}/admin/api.php?api_action=campaign_create&api_output=json`,k=new URLSearchParams;k.append("type","single"),k.append("name",t.name),k.append("sdate","2099-12-31 12:00:00"),k.append("status","0"),k.append("public","1"),k.append("trackreads","1"),k.append("tracklinks","all"),k.append("htmlunsub","1"),k.append("textunsub","1"),k.append("addressid",String(f.id)),k.append(`p[${t.list_id}]`,t.list_id),k.append(`m[${m}]`,"100");const w=await i({url:`?proxy_url=${encodeURIComponent(E)}`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Api-Token":c},body:k.toString()});if(w.error){const P=w.error;return{error:{status:"CUSTOM_ERROR",error:P?.data?.result_message||P?.error||"Message created, but campaign creation failed."}}}const v=w.data;if(Number(v?.result_code)===0)return{error:{status:"CUSTOM_ERROR",error:v?.result_message||"Campaign creation failed (v1 API)."}};const x=v?.id;return x?{data:{campaignId:String(x)}}:{error:{status:"CUSTOM_ERROR",error:v?.result_message||"Campaign created but no ID returned."}}}})})}),{useCreateCampaignMutation:Im}=sr,Am="https://api.brevo.com/v3",ar=r.createApi({reducerPath:"brevoApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s={name:t.name,subject:t.subject,sender:{name:t.from_name,email:t.from_email},htmlContent:t.html,recipients:{listIds:[t.list_id]}},c=await i({url:`?proxy_url=${encodeURIComponent(`${Am}/emailCampaigns`)}`,method:"POST",headers:{"Content-Type":"application/json","api-key":t.api_key},body:JSON.stringify(s)});if(c.error){const u=c.error;return{error:{status:"CUSTOM_ERROR",error:u?.data?.message||u?.data?.code||u?.error||String(c.error)}}}const d=c.data;return d?.id?{data:{id:d.id}}:{error:{status:"CUSTOM_ERROR",error:c.data?.message||"Failed to create campaign"}}}})})}),{useCreateCampaignMutation:xm}=ar,Pm="https://api.createsend.com/api/v3.3",Rm=e=>`Basic ${btoa(`${e}:x`)}`,lr=r.createApi({reducerPath:"campaignMonitorApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s={Name:t.name,Subject:t.subject,FromName:t.from_name,FromEmail:t.from_email,ReplyTo:t.from_email,HtmlUrl:t.html_url,ListIDs:[t.list_id],InlineCss:!0},c=await i({url:`?proxy_url=${encodeURIComponent(`${Pm}/campaigns/${t.client_id}.json`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:Rm(t.api_key)},body:JSON.stringify(s)});if(c.error){const p=c.error;return{error:{status:"CUSTOM_ERROR",error:p?.data?.Message||p?.error||String(c.error)}}}const d=c.data,u=typeof d=="string"?d:d?.id;return!u||typeof u!="string"?{error:{status:"CUSTOM_ERROR",error:d?.Message||"Failed to create campaign"}}:{data:{id:u}}}})})}),{useCreateCampaignMutation:jm}=lr,Es="https://api.cc.email/v3",Om=e=>e.includes("[[trackingImage]]")?e:e.replace(/<body([^>]*)>/i,"<body$1>[[trackingImage]]"),cr=r.createApi({reducerPath:"constantContactApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s=Om(t.html),c={name:t.name,email_campaign_activities:[{format_type:5,from_email:t.from_email,reply_to_email:t.from_email,from_name:t.from_name,subject:t.subject,html_content:s}]},d=await i({url:`?proxy_url=${encodeURIComponent(`${Es}/emails`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.access_token}`},body:JSON.stringify(c)});if(d.error){const m=d.error;return{error:{status:"CUSTOM_ERROR",error:m?.data?.error_message||m?.data?.error_key||m?.error||String(d.error)}}}const u=d.data,p=u?.campaign_activities?.find(m=>m.role==="primary_email")?.campaign_activity_id,f=u?.campaign_id;if(!p||!f)return{error:{status:"CUSTOM_ERROR",error:"Failed to create campaign"}};const g={campaign_activity_id:p,campaign_id:f,role:"primary_email",contact_list_ids:[t.list_id],segment_ids:[],current_status:"DRAFT",format_type:5,from_email:t.from_email,from_name:t.from_name,reply_to_email:t.from_email,subject:t.subject,html_content:s},y=await i({url:`?proxy_url=${encodeURIComponent(`${Es}/emails/activities/${p}`)}`,method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.access_token}`},body:JSON.stringify(g)});if(y.error){const m=y.error;return{error:{status:"CUSTOM_ERROR",error:m?.data?.error_message||m?.data?.error_key||m?.error||String(y.error)}}}return{data:{campaign_id:f}}}})})}),{useCreateCampaignMutation:Lm}=cr,Mm="https://api.getresponse.com/v3",Nm=e=>`api-key ${e}`,dr=r.createApi({reducerPath:"getresponseApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createNewsletter:e.mutation({queryFn:async(t,n,o,i)=>{const s=t.html.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim(),c={name:t.name,type:"draft",subject:t.subject,fromField:{fromFieldId:t.from_field_id},replyTo:{fromFieldId:t.from_field_id},campaign:{campaignId:t.campaign_id},content:{html:t.html,plain:s||"Newsletter"},flags:["openrate","clicktrack"],sendSettings:{selectedCampaigns:[t.campaign_id]}},d=await i({url:`?proxy_url=${encodeURIComponent(`${Mm}/newsletters`)}`,method:"POST",headers:{"Content-Type":"application/json","X-Auth-Token":Nm(t.api_key)},body:JSON.stringify(c)});if(d.error){const p=d.error;return{error:{status:"CUSTOM_ERROR",error:p?.data?.message||p?.data?.code||p?.error||String(d.error)}}}const u=d.data;return u?.newsletterId?{data:{newsletterId:u.newsletterId}}:{error:{status:"CUSTOM_ERROR",error:d.data?.message||"Failed to create newsletter"}}}})})}),{useCreateNewsletterMutation:Dm}=dr,Fm=e=>`https://${e||"r1"}-api.dotdigital.com/v2`,Ss=(e,t)=>`Basic ${btoa(`${e}:${t}`)}`,ws=e=>e&&typeof e=="object"&&"data"in e&&e.data!==void 0?e.data:e,ks=e=>e.trim().toLowerCase(),ur=r.createApi({reducerPath:"dotdigitalApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const s=t.html.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim(),c=Fm(t.region),d={"Content-Type":"application/json",Authorization:Ss(t.username,t.password)},u=await i({url:`?proxy_url=${encodeURIComponent(`${c}/custom-from-addresses`)}`,method:"GET",headers:{Authorization:Ss(t.username,t.password)}});let p=[];if(!u.error){const w=ws(u.data);Array.isArray(w)?p=w:w&&typeof w=="object"&&Array.isArray(w.items)&&(p=w.items)}const f=ks(t.from_email),g=p.find(w=>w.email&&ks(w.email)===f),y={name:t.name,subject:t.subject,fromName:t.from_name,htmlContent:t.html,plainTextContent:s||"Newsletter"},m=!g?.id;g?.id!=null&&(y.fromAddress={id:g.id});const E=await i({url:`?proxy_url=${encodeURIComponent(`${c}/campaigns`)}`,method:"POST",headers:d,body:JSON.stringify(y)});if(E.error){const w=E.error;return{error:{status:"CUSTOM_ERROR",error:w?.data?.message||w?.error||String(E.error)}}}const k=ws(E.data);return k?.id?{data:{id:k.id,usedAccountDefaultFromAddress:m}}:{error:{status:"CUSTOM_ERROR",error:E.data?.message||k?.message||"Failed to create campaign"}}}})})}),{useCreateCampaignMutation:Bm}=ur,$m="https://app.bentonow.com/api/v1",Um=(e,t)=>`Basic ${btoa(`${e}:${t}`)}`,pr=r.createApi({reducerPath:"bentoApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createBroadcast:e.mutation({queryFn:async(t,n,o,i)=>{const s={broadcasts:[{name:t.name,subject:t.subject,content:t.html,type:"raw",from:{email:t.from_email,name:t.from_name},inclusive_tags:t.inclusive_tags||"subscribers",exclusive_tags:"",segment_id:t.segment_id||"",batch_size_per_hour:500,approved:!1}]},c=`${$m}/batch/broadcasts?site_uuid=${encodeURIComponent(t.site_uuid)}`,d=await i({url:`?proxy_url=${encodeURIComponent(c)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:Um(t.publishable_key,t.secret_key),"User-Agent":"EmailMaker/1.0"},body:JSON.stringify(s)});if(d.error){const u=d.error;return{error:{status:"CUSTOM_ERROR",error:u?.data?.message||u?.error||String(d.error)}}}return{data:{count:d.data?.count??1}}}})})}),{useCreateBroadcastMutation:zm}=pr,Gm=()=>{const{__:e}=r.useI18n(),[t,{isLoading:n}]=cm(),[o,{isLoading:i}]=dm(),[s,{isLoading:c}]=um(),[d,{isLoading:u}]=pm(),[p,{isLoading:f}]=fm(),[g,{isLoading:y}]=_m(),[m,{isLoading:E}]=bm(),[k,{isLoading:w}]=wm(),[v,{isLoading:x}]=km(),[P,{isLoading:K}]=Im(),[J,{isLoading:N}]=xm(),[L,{isLoading:A}]=jm(),[O,{isLoading:z}]=Lm(),[B,{isLoading:U}]=Dm(),[de,{isLoading:me}]=Bm(),[H,{isLoading:Z}]=zm(),De=n||i||c||u||f||y||E||w||x||K||N||A||z||U||me||Z,Ue={unisender:async(T,R,D,I)=>{try{const S=await t({api_key:T.api_key,sender_name:T.sender_name,sender_email:T.sender_email,subject:I,body:D,list_id:R.list_id,generate_text:1,lang:"ru"}).unwrap();return S.result?.message_id?{success:!0,message:e("Email successfully created!"),link:{url:`https://app.unisender.com/ru/v5/spa/email-campaign/editor/${S.result.message_id}?step=send`,text:e("Open in Unisender")}}:S.error?{success:!1,error:S.error+(S.code?` (${S.code})`:"")}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create email")}}},mailganer:async(T,R,D,I)=>{try{const S=await o({api_key:T.api_key,name:R.name,html_content:D,theme:R.theme||I,from_name:T.from_name,from_email:T.from_email}).unwrap();return S.status===1&&S.public_id?{success:!0,message:e("Mailing successfully created!"),link:S.step1_url?{url:S.step1_url,text:e("Open in Mailganer")}:void 0}:S.error?{success:!1,error:S.error}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create mailing")}}},sendsay:async(T,R,D,I)=>{try{const S=await s({login:T.login,api_key:T.api_key,name:R.name,subject:R.subject,html_content:D,from_name:T.from_name,from_email:T.from_email}).unwrap();return S.obj?.id?{success:!0,message:e("Draft successfully created!"),link:{url:`https://app.sendsay.ru/content/drafts/email/${S.obj.id}/settings`,text:e("Open in Sendsay")}}:S.errors&&S.errors.length>0?{success:!1,error:S.errors.map(ae=>ae.explain).join(", ")}:S.error?{success:!1,error:S.explain||S.error}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create draft")}}},altcraft:async(T,R,D,I)=>{try{const S=await d({api_url:T.api_url,api_key:T.api_key,name:R.name,html_content:D,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email}).unwrap();return S.error===0?{success:!0,message:e("Template successfully created!")}:{success:!1,error:S.error_text||e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create template")}}},enkod:async(T,R,D,I)=>{try{const S=await p({api_key:T.api_key,subject:R.subject,html_content:D,sender_name:T.sender_name,sender_email:T.sender_email}).unwrap();if(S.success||S.messageId||S.id){const ae=S.messageId||S.id;return{success:!0,message:e("Draft successfully created!"),link:ae?{url:`https://app.enkod.ru/ensend/messages/detail/${ae}/preview`,text:e("Open in enKod")}:void 0}}else if(S.error||S.message)return{success:!1,error:S.error||S.message||e("Unknown error")};return{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create draft")}}},mailchimp:async(T,R,D,I)=>{try{const S=await g({api_key:T.api_key,list_id:R.list_id,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();if(S.id){const ae=T.api_key?.split("-")[1]||"us1";return{success:!0,message:e("Campaign successfully created!"),link:{url:`https://${ae}.admin.mailchimp.com/campaigns/#r:campaignId=${S.id}`,text:e("Open in Mailchimp")}}}return{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},klaviyo:async(T,R,D,I)=>{try{const S=await m({api_key:T.api_key,list_id:R.list_id,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();return S.id?{success:!0,message:e("Campaign successfully created!"),link:{url:`https://www.klaviyo.com/campaign/${S.id}/wizard/1`,text:e("Open in Klaviyo")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},hubspot:async(T,R,D,I)=>{try{const S=await k({api_key:T.api_key,name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();return S.id?{success:!0,message:e("Email successfully created!"),link:{url:`https://app.hubspot.com/email/0/edit/${S.id}`,text:e("Open in HubSpot")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create email")}}},salesforce_mc:async(T,R,D,I)=>{try{const S=await v({subdomain:T.subdomain,client_id:T.client_id,client_secret:T.client_secret,name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();return S.id?{success:!0,message:e("Email successfully created!"),link:{url:`https://app.s7.exacttarget.com/ContentBuilder?app=contentbuilder&id=${S.id}`,text:e("Open in Marketing Cloud")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create email")}}},activecampaign:async(T,R,D,I)=>{try{const S=await P({api_url:T.api_url,api_key:T.api_key,list_id:T.list_id,name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();if(S.campaignId){const ae=(T.api_url||"").replace(/\/$/,"").match(/https?:\/\/([^.]+)\.api-/),we=ae?ae[1]:"",Ye=we?`https://${we}.activehosted.com/app/campaigns/${S.campaignId}`:"https://www.activecampaign.com/app/campaigns";return{success:!0,message:e("Draft campaign created! Open it to review and schedule."),link:{url:Ye,text:e("Open draft campaign")}}}return{success:!1,error:e("Unknown error")}}catch(S){const ae=S.message||S.error||"";if(ae==="NO_MAILING_ADDRESS"){const we=(T.api_url||"").replace(/\/$/,"").match(/https?:\/\/([^.]+)\.api-/),Ye=we?we[1]:"",Qe=Ye?`https://${Ye}.activehosted.com/app/settings/addresses`:"https://www.activecampaign.com/app/settings/addresses";return{success:!1,error:e("No mailing address found. Add one in ActiveCampaign: ")+Qe}}return{success:!1,error:ae||e("Failed to create campaign")}}},brevo:async(T,R,D,I)=>{try{const S=await J({api_key:T.api_key,list_id:Number(R.list_id),name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();return S.id?{success:!0,message:e("Campaign successfully created!"),link:{url:`https://app.brevo.com/marketing-campaign/edit/${S.id}`,text:e("Open in Brevo")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},campaign_monitor:async(T,R,D,I)=>{try{const S=R.html_url?.trim();if(!S)return{success:!1,error:e("HTML URL is required. Save the email first, or paste a custom URL to your hosted HTML.")};const ae=await L({api_key:T.api_key,client_id:T.client_id,list_id:R.list_id,name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html_url:S.trim()}).unwrap();return ae.id?{success:!0,message:e("Campaign successfully created!"),link:{url:`https://app.createsend.com/campaigns/#/${ae.id}`,text:e("Open in Campaign Monitor")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},constant_contact:async(T,R,D,I)=>{try{return(await O({access_token:T.access_token,list_id:R.list_id,name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap()).campaign_id?{success:!0,message:e("Campaign successfully created!"),link:{url:"https://app.constantcontact.com/pages/email/campaigns",text:e("Open in Constant Contact")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},getresponse:async(T,R,D,I)=>{try{const S=await B({api_key:T.api_key,from_field_id:T.from_field_id,campaign_id:R.campaign_id,name:R.name,subject:R.subject||I,html:D}).unwrap();return S.newsletterId?{success:!0,message:e("Newsletter successfully created!"),link:{url:`https://app.getresponse.com/letter/${S.newsletterId}`,text:e("Open in GetResponse")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create newsletter")}}},dotdigital:async(T,R,D,I)=>{try{const S=await de({username:T.username,password:T.password,region:T.region||"r1",name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D}).unwrap();return S.id?{success:!0,message:S.usedAccountDefaultFromAddress?e("Campaign created. Dotdigital used your account default sender because this From email is not registered as a custom from address. Add the address in Dotdigital and export again to use it."):e("Campaign successfully created!"),link:{url:"https://login.dotdigital.com/",text:e("Open in Dotdigital")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},bento:async(T,R,D,I)=>{try{return await H({publishable_key:T.publishable_key,secret_key:T.secret_key,site_uuid:T.site_uuid,name:R.name,subject:R.subject||I,from_name:T.from_name,from_email:T.from_email,html:D,inclusive_tags:R.inclusive_tags}).unwrap(),{success:!0,message:e("Broadcast successfully created!"),link:{url:"https://app.bentonow.com/",text:e("Open in Bento")}}}catch(S){return{success:!1,error:S.message||e("Failed to create broadcast")}}}};return{exportToIntegration:async(T,R,D,I,S)=>{const ae=Ue[T];return ae?ae(R,D,I,S):{success:!1,error:e("Unknown integration")}},isLoading:De}},Rt={INFO:"info",STORAGE:"storage",STYLES:"styles",MEMBERS:"members",INTEGRATIONS:"integrations",PLUGIN:"plugin"},Jv=Rt.INFO,Zv=[Rt.INFO,Rt.STORAGE,Rt.STYLES,Rt.MEMBERS,Rt.INTEGRATIONS,Rt.PLUGIN],eb={mainsettings:Rt.INFO,ftpsettings:Rt.STORAGE,webhooksettings:Rt.INTEGRATIONS},Wm=async(e,t,n)=>{try{const{notification:o,...i}=e,s=await r.fetchBaseQuery({baseUrl:"https://racs.rest/v3"})(i,t,n);if(s.error)throw new Error;return s}catch(o){return(e?.notification).error(o),{error:o}}},mr=r.createApi({reducerPath:"exportPngApi",baseQuery:Wm,endpoints:e=>({makeTemporaryMailForPng:e.mutation({query:({file:t,title:n,notification:o})=>{const i=new Blob([t],{type:"text/html"}),s=new FormData;return s.append("file",i,"base.html"),s.append("contentType","text/html"),{url:"?resource=exportPngApi",method:"POST",body:s,notification:o}}}),deleteTemporaryMail:e.mutation({query:({id:t,notification:n})=>({url:`/${t}?resource=exportPngApi`,method:"DELETE",notification:n})})})}),{useMakeTemporaryMailForPngMutation:Hm,useDeleteTemporaryMailMutation:qm}=mr,fr=r.createApi({reducerPath:"webHookApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({postDataByWebHook:e.mutation({query:({url:t,body:n})=>({url:`?proxy_url=${encodeURIComponent(t)}`,method:"POST",body:n})})})}),{usePostDataByWebHookMutation:Vm}=fr,Km=async(e,t,n)=>{try{const{notification:o,...i}=e,s=await r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"})(i,t,n);if(s.error)throw new Error;return s}catch(o){return(e?.notification).error(o),{error:o}}},gr=r.createApi({reducerPath:"htmlToPdfPlusApi",baseQuery:Km,endpoints:e=>({generateHtmlToPdf:e.mutation({query:({htmlContent:t,notification:n})=>({url:"emails/pdf",method:"POST",body:t,notification:n,responseHandler:o=>o.blob()})})})}),{useGenerateHtmlToPdfMutation:Ym}=gr,hr=r.createApi({reducerPath:"proxyApi",tagTypes:["Proxy"],baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/wp-json/cors-proxy/v1/get"}),endpoints:e=>({getFile:e.query({queryFn({url:t,tryFetch:n=!0,type:o},i){const s=r.clientFromApi(i),c=n?fetch(t):Promise.reject(),d=p=>{switch(o){case"json":return p.json();case"text":return p.text();default:return p.blob()}},u=p=>d(p).then(f=>({data:f}));return c.then(p=>u(p)).catch(()=>s.corsProxy.get_list({format:"blob",extraQuery:{url:encodeURIComponent(t)}}))}})})}),{useGetFileQuery:tb,useLazyGetFileQuery:Qm}=hr,nb="email",rb=100;function Xm(e){return yt.sanitizeFileName(String(e??"").trim()).slice(0,100).trimEnd()||"email"}function Cs(e){const t=Xm(e);return{archive:`${t}.zip`,desktop:`${t}-desktop.png`,mobile:`${t}-mobile.png`}}function Jm(e,t){const n=Cs(e);return{[n.desktop]:t.desktop,[n.mobile]:t.mobile}}var go=()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/a50825ac.js")).then(e=>e.import_exports),void 0,{}.url),Zm=1,ef=2,tf=375,Dt={fontSize:"16px"},nf={position:"absolute",bottom:-4,right:-4,borderRadius:"100%",backgroundColor:r.emCssVar("colorBgContainer")},rf={position:"relative",display:"inline-flex"},qt=({icon:e,locked:t,strokeWidth:n,className:o})=>(0,a.jsxs)("span",{className:o,style:rf,children:[e,t&&(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:12,strokeWidth:n,style:nf})]}),of=({email:e,autoSaveBlockResult:t})=>{const{__:n,_x:o}=r.useI18n(),i=r.useDispatch(),s=r.useEmailAttributesWriter(),[c]=Qm(),[d]=r.useUploadImageMutation(),u=r.useAppNavigate(),{owner:p,admin:f}=Qn(),g=r.useCurrentUser(),y=r.useProjectData(),{modal:m}=_.ui_kit$App.useApp(),E=r.useNotification(),{confirm:k}=m,w=r.useAppStore(),v=()=>on(h.getContainer(w)).keepWrappedOnOutput,x=(M,q,Q,re)=>yt.prepareHTML(M,q,Q,re,v()),P=(M,q,Q,re,ne,W)=>yt.getEML(M,q,Q,re,ne,W,v()),K=(M,q,Q,re,ne)=>yt.htmlToFilesData(M,q,Q,re,ne,v()),J=r.useCookieManager(),N=r.useAppConfig(),L=vs(),{beeFreeConverterEnabled:A,aiLayoutConverterEnabled:O}=L,z=r.useEditorProjectId(),B=r.useEventEmitter(h.events.ON_EMAIL_CLONE_ID),U=r.useEventEmitter(h.events.ON_BROWSER_EXTENSION_DETECTED_ID),[de]=Vm(),me=!0,{data:H}=r.useGetProjectIntegrationsQuery(y?.id??0,{skip:me}),{data:Z}=r.useGetProjectWebhookQuery(y?.id??0,{skip:me}),[De]=r.useLazyGetIntegrationCredentialsQuery(),{exportToIntegration:ve,isLoading:et}=Gm(),be=r.usePushToDataLayer(),[fe,Y]=(0,l.useState)(()=>!Ht(h.getContainer(w)).contentShown()),[pe,ie]=(0,l.useState)(!1),[se,Ae]=(0,l.useState)(null),[Te,Fe]=(0,l.useState)(""),[X,Ee]=(0,l.useState)(!1),[Ie,ge]=(0,l.useState)(0),[Re,Ue]=(0,l.useState)(null),[C,T]=(0,l.useState)(""),[R,D]=(0,l.useState)(!1),I=r.usePlanFeatureGate("export_html"),S=r.usePlanFeatureGate("export_pdf"),ae=r.usePlanFeatureGate("export_png");r.usePlanFeatureGate("export_webhook");const we=r.usePlanFeatureGate("export_platforms"),Ye=r.usePlanFeatureGate("export_amp"),Qe=r.usePlanFeatureGate("template_import"),ze=r.usePlanFeatureGate("code_minify"),Ze=M=>{Ee(!0),ge(r.FEATURE_UPSELL_SLIDE[M])},[pt]=r.emailsApi.useDeleteEmailMutation(),bt=async(M,q)=>{try{const Q=await pt(M.id).unwrap();M.project,E.success(n('The email "')+Q.title+o('" was successfully removed.',"email")),be({event:"delete",action:"delete_email",entity_type:"email",entity_id:M.id,project_id:M.project,context:"editor"})}catch(Q){E.error(Q)}},[ft,lt]=r.useAddEmailMutation(),[G]=Hm(),[V]=qm(),[te]=Ym(),ue=r.useProjectData(),he=r.useInvalidateTerms(),Ge=r.useSelector(r.selectIsHeaderCodeMenuOpen);(0,l.useEffect)(()=>{Ge.switched&&Y(!1)},[Ge]);const qe=()=>{const{title:M}=e;return M===null?n("New email title"):M},st=(M,q,Q=!1)=>{const re=r.getCodeSize(M);Q&&r.isCodeSizeExceeded(re)?(Fe(M),Ae(()=>q),ie(!0)):q(M)},Bt=()=>{if(ie(!1),ze.isLocked){Ze("code_minify");return}if(se&&Te){r.getCodeSize(Te);const M=r.minifyHtml(Te);r.getCodeSize(M),se(M),Ae(null),Fe("")}},Le=()=>{ie(!1),se&&Te&&(se(Te),Ae(null),Fe(""))},Xe=()=>{ie(!1),Ae(null),Fe("")},oe=r.useContentReader(),ee=r.useContentReplacer(),$=r.useEvent(h.events.ON_EMAIL_INIT_ID),le=r.useEventEmitter(h.events.ON_LAYOUT_CONVERT_REQUEST_ID);(0,l.useEffect)(()=>{const M=$(()=>{Y(!1)});return()=>M.dispose()},[$]);const xe=async(M,q=oe())=>{const Q=document.querySelector(".email-preview"),re=getComputedStyle(Q);return q=await x(q,[re.width],e.utm_parameters,async ne=>{ot(ne)}),G({file:q,title:qe(),notification:E}).unwrap().then(ne=>{const W={id:ne._id,...ne};return M(W,()=>V({id:W.id,notification:E}))}).catch(ne=>{E.error({title:ne.data?.code,description:ne.data?.message})})},Se=(M,q=1)=>xe((Q,re)=>({hrefs:M.map(ne=>r.previewHrefForRacs(Q.id,void 0,!1,q,void 0,void 0,ne)),dispose:re})),Me=(M,q,Q=2)=>xe((re,ne)=>({data:M.map(W=>({selector:W,href:r.previewHrefForRacs(re.id,void 0,!1,Q,W)})),dispose:ne}),q),We=async(M,q)=>{const Q=typeof M=="string"?(await c({url:M}))?.data:M;if(!Q)return typeof M=="string"?M:"";let re=r.decodeFileNameFromPath(q);if(typeof M=="string"&&/^https?:\/\//i.test(M)){const He=r.decodeFileNameFromUrl(M);He&&(re=He)}const ne=Q,{ensureFileExtension:W,extractUploadResult:Ce}=await go();re=await W(re,ne.type||"");const _e=new File([ne],re.toLowerCase(),{type:ne.type||""});try{const He=Ce(await d({user_id:g.id,folder:String(ue.id),file:_e}).unwrap());if(He.error)return typeof M=="string"?M:"";if(He.file_url)return He.file_url}catch{}return typeof M=="string"?M:""},Be=async M=>{const q=M.document.querySelectorAll("[em-operation=exportAsPicture]"),Q=new Map;for(let re=0,ne=q.length;re<ne;re++){const W=q[re];W.setAttribute("em-export-id",String(re)),Q.set(`[em-export-id='${re}']`,W)}Q.size&&M.handleRender(async({contentDocument:re,managedNodeController:ne})=>{try{const{data:W,dispose:Ce}=await Me([...Q.keys()],r.getOuterHtml(re),ef);try{const _e=W.map(async({href:He,selector:hn},Dn)=>{const mt=Q.get(hn);if(mt.tagName==="TD"){mt.removeAttribute("style");for(const _t of[...mt.classList])_t.startsWith("em-mob-")&&mt.classList.remove(_t)}ne.commit();const Fr=await We(He,`${Dn}-${mt.tagName.toLowerCase()}.png`),_n=parseInt(getComputedStyle(mt).width);let wt=new Image(_n);wt.setAttribute("border","0"),wt.setAttribute("style",`display: block; width: 100%; max-width: ${_n}px;`),wt.alt="",wt.src=Fr;const yn=mt.querySelector("a");if(yn){const _t=document.createElement("a");_t.setAttribute("target","_blank"),_t.setAttribute("href",yn.getAttribute("href")),_t.appendChild(wt),wt=_t}if(mt.tagName==="TD"){const _t=mt.cloneNode();_t.removeAttribute("em-operation"),_t.appendChild(wt),wt=_t}mt.replaceWith(wt),ne.commit()});await Promise.all(_e)}catch{}finally{Ce()}}catch{}})},ot=M=>{const q=M.document;if(ue?.limits?.preview_limit==="0"&&z&&g?.counters?.emails_counter>2&&!q.querySelector(".em-powered-logo")){const Q=`<a href="${`https://https://racs.rest/v3/v3/link?app=useblocks&project=${z}&email=${e.id}&link=https%3A%2F%2Fuseblocks.io`}" target="_blank"><img src="https://https://racs.rest/v3/v3/pixel/123.png?image=https://cdn.useblocks.io/blocks/powered.png&project=${z}&email=${e.id}" width="150" height="50" border="0" alt="" style="display: inline-block; width: 100%; max-width: 150px;"></a>`;q.querySelector("body > table:last-child > tbody:last-child > tr:last-child, body > div > table:last-child > tbody:last-child > tr:last-child")&&q.querySelector("body > table:last-child > tbody:last-child > tr:last-child, body > div > table:last-child > tbody:last-child > tr:last-child").insertAdjacentHTML("afterend",`<tr em="block" class="em-powered-logo">
|
|
856
856
|
<td align="center" bgcolor="#FFFFFF">${Q}</td>
|
|
857
|
-
</tr>`)}},fn=async()=>{const M=oe();st(M,async q=>{try{const Q=document.querySelector(".email-preview"),re=getComputedStyle(Q),ne=await x(q,[re.width],e.utm_parameters,async He=>{ot(He)}),W=await te({htmlContent:ne,notification:E}).unwrap(),Ce=window.URL.createObjectURL(new Blob([W],{type:"application/pdf"})),_e=document.createElement("a");_e.href=Ce,_e.setAttribute("download",`${qe()}.pdf`),document.body.appendChild(_e),_e.click(),document.body.removeChild(_e),window.URL.revokeObjectURL(Ce)}catch{}})},Ot=M=>{const q=oe();st(q,Q=>{be({event:"click",action:"export_email",export_type:"HTML"});const re=document.querySelector(".email-preview"),ne=getComputedStyle(re);x(Q,[ne.width],e.utm_parameters,async W=>{await Be(W),ot(W),await r.processAmp(W,M)}).then(W=>{const Ce=new Blob([W],{type:"text/html;charset=utf-8"});(0,sn.saveAs)(Ce,`${qe()}.html`)}).catch(W=>{})},!0)},ct=M=>{const q=oe();st(q,Q=>{be({event:"click",action:"export_email",export_type:"TEXT"});const re=document.querySelector(".email-preview"),ne=getComputedStyle(re);x(Q,[ne.width],e.utm_parameters,async W=>{await Be(W),ot(W),await r.processAmp(W,M);const[{htmlToText:Ce},{EmailTextPlainConvertOptions:_e}]=await Promise.all([(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/ca873214.js")),void 0,{}.url),(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/13563d2c.js")),void 0,{}.url)]);W.handleReadHtml(He=>{He.html=Ce(He.contentDocument,_e)})}).then(W=>{const Ce=new Blob([W],{type:"text/plain;charset=utf-8"});(0,sn.saveAs)(Ce,`${qe()}.txt`)}).catch(W=>{})})},Et=()=>{const M=oe();st(M,q=>{be({event:"click",action:"export_email",export_type:"MARKDOWN"});const Q=document.querySelector(".email-preview"),re=getComputedStyle(Q),{utm_parameters:ne}=e;x(q,[re.width],ne,async W=>{ot(W),await r.processAmp(W,"html");const{htmlToMarkdown:Ce}=await(0,Ve.__vitePreload)(async()=>{const{htmlToMarkdown:_e}=await Promise.resolve().then(()=>ye("./static/core/f0f90842.js"));return{htmlToMarkdown:_e}},void 0,{}.url);W.handleReadHtml(_e=>{_e.html=Ce(_e.contentDocument)})}).then(W=>{const Ce=new Blob([W],{type:"text/markdown;charset=utf-8"});(0,sn.saveAs)(Ce,`${qe()}.md`)}).catch(W=>r.reportError(W,{origin:"markdown-export"}))})},Lt=M=>{const q=oe();st(q,Q=>{be({event:"click",action:"export_email",export_type:"Clipboard"});const re=document.querySelector(".email-preview"),ne=getComputedStyle(re);x(Q,[ne.width],e.utm_parameters,async W=>{await Be(W),ot(W),await r.processAmp(W,M)}).then(W=>navigator.clipboard.writeText(W).then(function(){E.success(n("The email has been copied to the clipboard."))})).catch(W=>{})},!0)},jn=async M=>{Re&&mo(Re)},On=()=>{Ue(null),T("")},gn=async()=>{if(!R){D(!0);try{const M=await Se([800,tf],Zm);if(!M)return;const{hrefs:q,dispose:Q}=M;try{const[re,ne]=await Promise.all(q.map(_e=>yt.getImageByUrl(_e).then(He=>yt.imageToBlob(He)))),W=qe(),Ce=await yt.htmlFilesToZip(Jm(W,{desktop:re,mobile:ne}));(0,sn.saveAs)(Ce,Cs(W).archive),be({event:"click",action:"export_email",export_type:"Image"})}finally{Q()}}catch{E.error({title:n("Error"),description:n("Failed to export the email as images. Please try again.")})}finally{D(!1)}}},Ln=M=>{const q=J.get(r.APP_COOKIES.em_token);return fetch(`https://app.useblocks.io/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(M)}`,{headers:{authorization:`Bearer ${q}`}}).then(Q=>Q.blob())},Mn=M=>new Promise((q,Q)=>{const re=()=>Ln(M).then(q,Q);fetch(M).then(ne=>q(ne.blob()),re).catch(()=>{})}),gt=(M,q)=>{const Q=oe();st(Q,re=>{be({event:"click",action:"export_email",export_type:"Outlook"});const ne=document.querySelector(".email-preview"),W=getComputedStyle(ne),Ce=async(_e,He)=>{_e.document,await r.processAmp(_e,He),await Be(_e),ot(_e)};P(e.title,re,[W.width,W.height],e.utm_parameters,M?_e=>Ce(_e,"html"):_e=>Ce(_e),q?{embedImagesAsBase64:!0,getImageBlob:Mn}:void 0).then(_e=>{const He=new Blob([_e],{type:"text/html;charset=utf-8"});(0,sn.saveAs)(He,`${qe()}.eml`)}).catch(_e=>{})})},St=M=>{k({centered:!0,mask:{closable:!0},title:n("Embed images in the file?"),content:n('If "Yes", images will be included in the file itself. This is useful for offline viewing or if external images are blocked, but increases file size. If "No", images will be loaded from external links.'),okText:n("Yes"),cancelText:n("No"),onOk:()=>gt(M,!0),onCancel:()=>gt(M,!1)})},ce=async()=>{const M=oe();st(M,async q=>{be({event:"click",action:"export_email",export_type:"ZIP"});const Q=document.querySelector(".email-preview"),re=getComputedStyle(Q),ne=await K(q,[re.width,void 0],e.utm_parameters,Mn,async Ce=>{await Be(Ce),ot(Ce),Tt&&await r.processAmp(Ce,"html")});Tt&&(ne["amp.html"]=await x(q,[re.width],e.utm_parameters,async Ce=>{await Be(Ce),ot(Ce),await r.processAmp(Ce,"amp")}));const W=await yt.htmlFilesToZip(ne);(0,sn.saveAs)(W,`${qe()}.zip`)},!0)},ke=async()=>{if(be({event:"click",action:"duplicate_email",entity_type:"email",entity_id:e.id,project_id:e.project,context:"editor"}),e.isNew)E.warning({title:n("To create a copy, you need to save the email.")});else{if((await B.fire(e)).some(M=>M===!1))return;ft({title:xt.generateCopyTitle(e.title),...e.meta!==void 0?{meta:e.meta}:{},project:Number(ue?.id),description:e.description,html:xt.generateCopyHtml(oe()||"",String(e.title)),parent_email:e.parent_email||6892,common_styles:e.common_styles||"",utm_parameters:{utm_source:e.utm_parameters?.utm_source,utm_medium:e.utm_parameters?.utm_medium,utm_campaign:e.utm_parameters?.utm_campaign,utm_term:e.utm_parameters?.utm_term,utm_content:e.utm_parameters?.utm_content},emailtags:e.emailtags,folder:e.folder}).unwrap().then(M=>{u(`/projects/${ue.id}/emails/${M.id}`),E.success({title:n('The copy of email "')+e.title+n('" was successfully created.')}),be({event:"duplicate",action:"duplicate_email_success",entity_type:"email",entity_id:e.id,cloned_entity_id:M.id,project_id:e.project,context:"editor"}),he("folder")}).catch(M=>{E.error({title:M.data.code,description:M.data.message})})}},Ne=()=>{be({event:"click",action:"click_delete_email_menu_item",entity_type:"email",entity_id:e.id,project_id:e.project,context:"editor"}),e.isNew?E.success(n("The draft of the email has been deleted.")):nt(e,u)},nt=(M,q)=>{be({event:"open",action:"open_delete_email_modal",entity_type:"email",entity_id:M.id,project_id:M.project,context:"editor"}),k({mask:{closable:!0},centered:!0,title:o('Are you sure to delete "',"email")+M.title+n('" email?'),icon:(0,a.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:_.icons$DeleteOutlined,size:22,style:{color:_.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:n("Yes"),cancelText:n("No"),onOk:()=>bt(M,q)})},je=()=>{go().catch(()=>{}),r.uploadFile("application/zip, message/rfc822, text/html",Yt)},Yt=async M=>{const q=M[0];try{i(r.setIsGlobalLoading(!0));const{createDocumentProcessor:Q,createFileProcessor:re,importEmail:ne}=await go(),{html:W,hasBrowserExtensionArtifacts:Ce}=await ne(q,re(c,d,g,ue,N),Q(q))??{html:"",hasBrowserExtensionArtifacts:!1};Ce&&U.fire();const[_e]=yt.getFileNameAndExt(q.name.replaceAll(" "," ")),He=_e||xt.getTitleFromHtml(W)||"";ee(W,{undoable:!0}),s({title:He}),i(r.setIsGlobalLoading(!1)),le.fire({html:W})}catch(Q){i(r.setIsGlobalLoading(!1));const re=Q instanceof Error?Q.message:Q;E.error({title:re})}be({event:"upload_file",action:"import_email"})},$t=()=>{const M=oe();M&&(be({event:"click",action:"convert_layout"}),le.fire({html:M}))},dt=[];N.emailDropdownMenuClone&&dt.push({label:n("Clone"),icon:(0,a.jsx)(r.EmIcons,{icon:"CopyOutlined",component:_.icons$CopyOutlined,size:16,strokeWidth:N.iconStrokeWidth}),key:"Clone",className:"em-analytics__email-clone",disabled:lt.isLoading,onClick:ke}),N.emailDropdownMenuImport&&dt.push({label:o("Import","verb"),icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"CloudUploadOutlined",component:_.icons$CloudUploadOutlined,style:Dt}),locked:Qe.isLocked,strokeWidth:N.iconStrokeWidth}),key:"Import",className:"em-analytics__editor-page__import",onClick:()=>{if(Qe.isLocked){Ze("template_import");return}be({event:"click",action:"import_email"}),je()}});const Nn=oe(),Ut=!e.hasOwnProperty("type")&&bs(Nn,L)!==null;N.emailDropdownMenuConvert&&Ut&&dt.push({label:n("Convert"),icon:(0,a.jsx)(r.EmIcons,{icon:"SwapOutlined",component:_.icons$SwapOutlined,size:16,strokeWidth:N.iconStrokeWidth}),key:"ConvertLayout",className:"em-analytics__email-convert",onClick:$t}),(p||f||g.id?.toString()===e.author?.toString())&&(N.emailDropdownMenuLock&&dt.push({label:(0,a.jsx)(ys,{element:e,context:"editor"},"Lock"),icon:e.lock?(0,a.jsx)(r.EmIcons,{icon:"UnLock",component:_.icons$UnLock,size:16,strokeWidth:N.iconStrokeWidth}):(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:16,strokeWidth:N.iconStrokeWidth}),disabled:e.isNew}),N.emailDropdownMenuRemove&&dt.push({label:n("Remove"),icon:(0,a.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:_.icons$DeleteOutlined,size:16,strokeWidth:N.iconStrokeWidth}),key:"Remove",className:"em-analytics__email-remove",style:{color:"#ff4d4f"},onClick:Ne}));const Tt=e.isAmp,It=[],Dr=()=>[...Tt?[{key:"html_txt",label:`${n("Plain text")} (HTML)`,onClick:()=>ct("html")},{key:"сode_txt",label:`${n("Plain text")} (AMP)`,onClick:()=>ct("amp")}]:[{key:"plain_txt",label:n("Plain text"),onClick:()=>ct()}],{key:"markdown",label:n("Markdown"),onClick:()=>Et()}];N.exportHtmlEnabled&&It.push({key:"html",label:n("Code"),icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"FileTextOutlined",component:_.icons$FileTextOutlined,style:Dt}),locked:I.isLocked,strokeWidth:N.iconStrokeWidth}),...I.isLocked?{onClick:()=>Ze("export_html")}:Tt?{children:[{key:"сode_html",label:n("AMP"),onClick:()=>Ye.isLocked?Ze("export_amp"):Ot("amp")},{key:"html_amp",label:n("HTML"),onClick:()=>Ot("html")}]}:{onClick:()=>Ot()}}),N.exportZipEnabled&&It.push({key:"zip",label:n("ZIP"),icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"FileZipOutlined",component:_.icons$FileZipOutlined,style:Dt}),locked:I.isLocked,strokeWidth:N.iconStrokeWidth}),...I.isLocked?{onClick:()=>Ze("export_html")}:{onClick:()=>ce().catch(M=>{})}}),N.exportClipboardEnabled&&It.push({key:"clipboard",label:n("Clipboard"),icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"SnippetsOutlined",component:_.icons$SnippetsOutlined,style:Dt}),locked:I.isLocked,strokeWidth:N.iconStrokeWidth}),...I.isLocked?{onClick:()=>Ze("export_html")}:Tt?{children:[{key:"clipboard_html",label:n("AMP"),onClick:()=>Ye.isLocked?Ze("export_amp"):Lt("amp")},{key:"clipboard_amp",label:n("HTML"),onClick:()=>Lt("html")}]}:{onClick:()=>Lt()}}),N.exportTextEnabled&&It.push({key:"text",label:n("Text"),icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"FileOutlined",component:_.icons$FileOutlined,style:Dt}),locked:I.isLocked,strokeWidth:N.iconStrokeWidth}),...I.isLocked?{onClick:()=>Ze("export_html")}:N.exportMarkdownEnabled?{children:Dr()}:Tt?{children:[{key:"сode_txt",label:n("AMP"),onClick:()=>Ye.isLocked?Ze("export_amp"):ct("amp")},{key:"html_txt",label:n("HTML"),onClick:()=>ct("html")}]}:{onClick:()=>ct()}}),N.exportOutlookEnabled&&It.push({key:"outlook",icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"FileWordOutlined",component:_.icons$FileWordOutlined,style:Dt}),locked:we.isLocked,strokeWidth:N.iconStrokeWidth}),label:n("Outlook"),onClick:()=>we.isLocked?Ze("export_platforms"):St(!!Tt)}),N.exportPdfEnabled&&It.push({key:"pdf",icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"FilePdfOutlined",component:_.icons$FilePdfOutlined,style:Dt}),locked:S.isLocked,strokeWidth:N.iconStrokeWidth}),label:n("PDF"),onClick:()=>S.isLocked?Ze("export_pdf"):fn()}),N.exportPngEnabled&&It.push({key:"img",icon:(0,a.jsx)(qt,{icon:R?(0,a.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:_.icons$LoadingOutlined,spin:!0,style:Dt}):(0,a.jsx)(r.EmIcons,{icon:"FileImageOutlined",component:_.icons$FileImageOutlined,style:Dt}),locked:ae.isLocked,strokeWidth:N.iconStrokeWidth}),label:n("PNG"),disabled:!ae.isLocked&&R,onClick:()=>ae.isLocked?Ze("export_png"):gn()});const ht=e.author;return(0,a.jsxs)(_.ui_kit$Space,{children:[N.emailDropdownMenuEnabled?(0,a.jsx)(_.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:dt},children:(0,a.jsx)(_.ui_kit$Button,{type:"default",block:!1,className:"email-page-header__btn email-page-header__btn_extra",onClick:()=>{},children:(0,a.jsx)(r.EmIcons,{icon:"DotsHoriz",component:_.icons$DotsHoriz,size:18,strokeWidth:N.iconStrokeWidth})})},"Actions"):N.emailDropdownMenuImport&&(0,a.jsx)(_.ui_kit$Tooltip,{title:o("Import","verb"),placement:"bottom",children:N.emailDropdownMenuImportButton?(0,a.jsx)(_.ui_kit$Button,{className:"em-analytics__editor-page__import",icon:(0,a.jsx)(r.EmIcons,{icon:"CloudUploadOutlined",component:_.icons$CloudUploadOutlined,size:16,strokeWidth:N.iconStrokeWidth}),onClick:()=>{be({event:"click",action:"import_email"}),je()},children:n("Import")}):(0,a.jsx)(_.ui_kit$Button,{className:"em-analytics__editor-page__import",type:"text",icon:(0,a.jsx)(r.EmIcons,{icon:"CloudUploadOutlined",component:_.icons$CloudUploadOutlined,size:22,strokeWidth:N.iconStrokeWidth}),onClick:()=>{be({event:"click",action:"import_email"}),je()}})}),N.emailExportEnabled&&(0,a.jsx)(_.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:It},children:(0,a.jsx)(_.ui_kit$Button,{className:"em-analytics__email-page__export",type:"default",icon:(0,a.jsx)(r.EmIcons,{icon:"CloudDownloadOutlined",component:_.icons$CloudDownloadOutlined,size:16,strokeWidth:N.iconStrokeWidth}),children:n("Export")},"Export")},"Export"),!e.hasOwnProperty("type")&&(0,a.jsx)(_s,{disabled:fe,email:e},"Save"),!!e.hasOwnProperty("type")&&(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(Au,{disabled:fe,rightCol:void 0,block:e,isEditableRights:p||f||g.id?.toString()===ht?.toString(),autoSaveBlockResult:t})},"Save"),(0,a.jsx)(Xp,{open:pe,codeSize:r.getCodeSize(Te),onMinimize:Bt,onDownloadAsIs:Le,onCancel:Xe}),Re&&mo(Re)&&(0,a.jsx)(lm,{integration:mo(Re),visible:!!Re,loading:et,onConfirm:jn,onCancel:On,__:n}),(0,a.jsx)(r.PlanUpgradePrompt,{open:X,sideOnOk:void 0,onCancel:()=>Ee(!1),initialSlide:Ie})]})},_r=r.createApi({reducerPath:"confirmationMailApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/",responseHandler:e=>e.text()}),endpoints:e=>({getConfirmationMail:e.query({query:({userId:t,email:n})=>({url:`?proxy_url=${encodeURIComponent(`https://webhook.latenode.com/5868/prod/1fbda9c1-3211-4b12-be45-9cd2ea73d73d?user_id=${t}&user_email=${n}`)}`})})})}),{useLazyGetConfirmationMailQuery:sf}=_r,af=()=>{const{__:e}=r.useI18n(),t=r.useNotification(),n=r.useCurrentUser(),[o]=sf(),[i,s]=(0,l.useState)(!1),c=r.usePushToDataLayer();(0,l.useEffect)(()=>{n.hasOwnProperty("email_confirmation")&&s(n.email_confirmation)},[n,i]);const d=()=>{c({event:"click",action:"click_resend_confirmation_email",user_email:n.email,user_id:n.id}),o({userId:n.id,email:n.email}).then(({data:u,error:p})=>{u?t.success(e("Confirmation email has been sent to {confirmedEmail}.").replace("{confirmedEmail}",n.email)):p&&t.error(p)})};return n?.email_confirmation||!n?.privacy_policy_agreement?null:(0,a.jsx)("div",{className:"main__ribbon",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(r.EmIcons,{icon:"EmailConfirmation",component:_.icons$EmailConfirmation,size:16,style:{marginRight:10,verticalAlign:"-0.15em"}}),e("Confirmation email was sent to")," ",(0,a.jsx)("em",{children:n.email}),". ",e("Didn't receive an email?")," ",(0,a.jsxs)(_.ui_kit$Button,{type:"primary",size:"small",className:"main__ribbon-resend",style:{fontSize:16,lineHeight:1,display:"inline-flex",alignItems:"center",gap:8},onClick:d,children:[e("Resend"),(0,a.jsx)(r.EmIcons,{icon:"SendOutlined",component:_.icons$SendOutlined,size:16,style:{flexShrink:0}})]})]})})},lf=({className:e,leftBlock:t,rightBlock:n,isHeaderCodeMenuOpen:o=!1})=>{const{token:i}=(0,_.ui_kit$useToken)(),s=(0,l.useRef)(),c=r.useAppConfig();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(af,{}),c.headerShow&&(0,a.jsx)("header",{className:(0,rt.default)("header",{[e]:e}),style:{borderColor:i.colorBorder},children:!o&&(0,a.jsx)(r.CSSTransition,{nodeRef:s,in:!o,timeout:300,classNames:"transition",children:(0,a.jsxs)("div",{className:"header__container container",children:[(0,a.jsx)("div",{className:"header__left",style:{flexGrow:1},children:t}),(0,a.jsx)("div",{className:"header__right",children:(0,a.jsx)(_.ui_kit$Space,{size:10,children:n})})]})})})]})},cf=e=>{},Ts=h.createIdentifier$1("canvas.headerFlow");function df(e){const t=(0,l.useCallback)(n=>e?e.subscribe(n):()=>{},[e]);return(0,l.useSyncExternalStore)(t,()=>e?.isReady()===!0)}var Is=({email:e,isCollaborationEditor:t})=>{const[n]=_.ui_kit$Form.useForm(),{__:o}=r.useI18n();let i=r.useDispatch();const s=r.useEmailAttributesWriter(),c=r.useAppNavigate(),d=r.useOpenPlanCatalog(),u=qi("header"),p=r.useCurrentUser(),f=r.useContainer().getInstance(Ts),g=r.useProjectData(),{owner:y,admin:m}=Qn(),{token:E}=(0,_.ui_kit$useToken)(),k=r.useAppConfig(),w=r.usePushToDataLayer(),v=(0,l.useRef)(),x=(0,l.useRef)(),P=(0,l.useRef)(),K=r.useEventEmitter(h.events.ON_PREVIOUSBUTTON_CLICK_ID),J=r.useEventEmitter(h.events.ON_PREHEADER_CHANGED_ID),N=r.useEventEmitter(h.events.ON_SUBJECT_CHANGED_ID),L=r.useSelector(r.selectCodeModeDirection),A=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,O=r.useSelector(r.selectElementSettings$1),z=r.useSelector(r.selectElementSettings),B=A==="email"?O:z,U=r.useSelector(r.selectIsCodeMode),[de,me]=(0,l.useState)(!1),[H,Z]=(0,l.useState)(!1),[De,ve]=(0,l.useState)(!1),et=(0,l.useCallback)(()=>ve(!1),[]),be=(0,l.useCallback)(()=>{ve(!1),d()},[d]),fe=Gi("email_generate"),Y=fe.exceeded?r.getLimitUpgradePresetDefinition(fe.exceeded.presetId):null;(0,l.useEffect)(()=>{const I=!!B?.type&&(B?.type===r.ELEMENT_TYPES.TEXT||B?.type===r.ELEMENT_TYPES.LINK||B.type===r.ELEMENT_TYPES.BUTTON)&&U&&L!=="bottom";me(I),i(r.setHeaderCodeMenuOpen(I))},[B,L,U]);const pe=(0,l.useCallback)(()=>{w({event:"click",action:"click_back_button",entity_type:A==="block"?"block":"email",entity_id:e?.id,project_id:e?.project||g?.id,context:"editor"}),K.fire(e)},[c,K,e,g?.id,w,A]),{document:ie}=r.useCurrentSession(),se=df(ie);r.usePrevious(([I])=>{se&&I!==e.subject&&N.fire(e.subject)},[e.subject,se]);const Ae=(0,l.useCallback)(I=>{const S=I.target.value;N.fire(S)},[N]),Te=(0,l.useCallback)(I=>{const S=I.target.value;J.fire(S)},[J]);r.usePrevious(([I])=>{se&&I!==e.preheader&&J.fire(e.preheader)},[e.preheader,se]);const Fe=(0,l.useCallback)((I,S="?")=>{I.subject?.length,I.preheader?.length,n.setFieldValue("subject",I.subject??""),n.setFieldValue("preheader",I.preheader??"")},[n]),X=(0,l.useRef)(void 0);(0,l.useEffect)(()=>{const I=e?.renderGuid??(e?.id!=null?String(e.id):void 0);!se||!I||X.current===I||(X.current=I,Fe(e,"identity"))},[se,e,Fe]);const Ee=(0,l.useCallback)(I=>{const S=I.target.value.trim();s({subject:S})},[s]),Ie=r.useEvent(h.events.BEFORE_SAVE_EMAIL),ge=(0,l.useCallback)(async I=>{const S=x.current?.input;if(document.activeElement===S){const we=S.value.trim();we!==I.subject&&(I.subject=we,s({subject:we}))}const ae=P.current?.input;if(document.activeElement===ae){const we=ae.value.trim();we!==I.preheader&&(I.preheader=we,s({preheader:we}))}await f?.whenDelivered()},[f,s]);(0,l.useEffect)(()=>{const I=Ie(ge);return()=>I.dispose()},[Ie,ge]);const Re=(0,l.useCallback)(I=>{const S=I.target.value.trim();s({preheader:S})},[s]),Ue=r.useEvent(h.events.ON_HEADER_APPLIED_ID);(0,l.useEffect)(()=>{const I=Ue(({field:S,value:ae})=>{n.setFieldValue(S,ae)});return()=>I.dispose()},[Ue,n]),cf(e.title===null?o("New email title"):e.title);const C=(0,l.useCallback)(()=>{i(r.setActiveSettingsTab(r.AICHAT)),setTimeout(()=>{const I=document.querySelector('li.ai-response-change-context[role="theme-and-preheader-generator"]');I&&I.click()},100)},[i]),T=(0,l.useCallback)(()=>{fe.isLocked?fe.state.state==="locked_by_limit"&&fe.exceeded?ve(!0):Z(!0):C()},[fe,C]),R=(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(_.ui_kit$Space,{ref:v,size:10,children:[k.headerArrowBackVisible&&(0,a.jsx)(_.ui_kit$Tooltip,{title:o("Back"),placement:"left",children:(0,a.jsx)(_.ui_kit$Button,{type:"text",icon:(0,a.jsx)(r.EmIcons,{icon:"ArrowLeftOutlined",component:_.icons$ArrowLeftOutlined,size:22,strokeWidth:k.iconStrokeWidth}),onClick:pe,shape:"circle"})}),(0,a.jsx)("div",{children:(k.headerTitleVisible||k.headerPreheaderVisible)&&(0,a.jsxs)(_.ui_kit$Form,{form:n,layout:"vertical",name:"subject_preheader_form",autoComplete:"off",initialValues:{subject:"",preheader:""},children:[k.headerTitleVisible&&(0,a.jsx)("div",{style:{marginTop:se?-3:0},children:(0,a.jsxs)(_.ui_kit$Space,{style:{width:"100%"},align:"baseline",size:12,children:[(0,a.jsx)("div",{className:"subject_preheader_form__title",children:o("Subject")}),se?(0,a.jsxs)("div",{className:"ant-page-header-heading",children:[(0,a.jsx)(_.ui_kit$Form.Item,{name:"subject",noStyle:!0,children:(0,a.jsx)(_.ui_kit$Input,{className:"ant-page-header-heading-title",ref:x,placeholder:o("Enter subject line here"),variant:"borderless",autoComplete:"off","data-lpignore":"true","data-1p-ignore":"","data-bwignore":"true","data-form-type":"other",onChange:Ae,onPressEnter:Ee,onBlur:I=>{Ee(I),document.querySelector(".ant-page-header-heading-title").closest(".ant-page-header-heading").classList.remove("focus")},onFocus:()=>{document.querySelector(".ant-page-header-heading-title").closest(".ant-page-header-heading").classList.add("focus")},disabled:k.lockPreheaderAndTitle})}),k.aiAssistentEnabled&&(0,a.jsx)(_.ui_kit$Tooltip,{title:o("Generate with AI"),children:(0,a.jsx)(r.EmIcons,{icon:"AI",component:_.icons$AI,size:12,strokeWidth:k.iconStrokeWidth,onClick:T})})]}):(0,a.jsx)(_.ui_kit$Skeleton.Input,{active:!0,size:16,style:{width:"40%",marginTop:3}})]})}),k.headerPreheaderVisible&&(0,a.jsx)("div",{children:(0,a.jsxs)(_.ui_kit$Space,{style:{width:"100%"},align:"baseline",size:12,children:[(0,a.jsx)("div",{className:"subject_preheader_form__title",children:o("Preheader")}),se?(0,a.jsxs)("div",{className:"ant-page-header-heading ant-page-header-heading_preheader",children:[(0,a.jsx)(_.ui_kit$Form.Item,{name:"preheader",noStyle:!0,children:(0,a.jsx)(_.ui_kit$Input,{className:"ant-page-header-heading-preheader",ref:P,placeholder:o("Enter preheader here"),variant:"borderless",autoComplete:"off","data-lpignore":"true","data-1p-ignore":"","data-bwignore":"true","data-form-type":"other",onChange:Te,onPressEnter:Re,onBlur:I=>{Re(I),document.querySelector(".ant-page-header-heading-preheader").closest(".ant-page-header-heading").classList.remove("focus")},onFocus:()=>{document.querySelector(".ant-page-header-heading-preheader").closest(".ant-page-header-heading").classList.add("focus")},disabled:k.lockPreheaderAndTitle})}),k.aiAssistentEnabled&&(0,a.jsx)(_.ui_kit$Tooltip,{title:o("Generate with AI"),children:(0,a.jsx)(r.EmIcons,{icon:"AI",component:_.icons$AI,size:12,strokeWidth:k.iconStrokeWidth,onClick:T})})]}):(0,a.jsx)(_.ui_kit$Skeleton.Input,{active:!0,size:16,style:{width:"80%",marginTop:2}})]})})]})})]})}),D=(0,a.jsxs)(a.Fragment,{children:[k.emailIdShow&&!!e.id&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"email-page-header__email-id",children:"ID"+e.id}),(0,a.jsx)(_.ui_kit$Divider,{orientation:"vertical"})]}),(0,a.jsx)(ps,{emailElement:e,isCollaborationEditor:t}),k.commandButtonsEnabled&&(0,a.jsxs)(a.Fragment,{children:[e.lock?(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:18,strokeWidth:k.iconStrokeWidth,className:(0,rt.default)("lock-icon",{"lock-icon__disabled":!(y||m||p.id?.toString()===e.author?.toString())}),style:{color:E.colorPrimary,verticalAlign:"sub"}},"Lock"):null,(0,a.jsx)(of,{email:e,isHeaderCodeMenuOpen:de},"Buttons")]})]});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(lf,{className:"email-pane__header",leftBlock:u?R:null,rightBlock:u?D:null,isHeaderCodeMenuOpen:de}),(0,a.jsx)(r.PlanUpgradePrompt,{open:H,onCancel:()=>Z(!1),initialSlide:9}),Y&&fe.exceeded?(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(oo,{open:De,onClose:et,title:o(Y.titleKey),subtitle:o(Y.subtitleKey),usageResource:Y.usageResource,previousDisplay:r.presetLimitDisplay(fe.exceeded.previousLimit),nextDisplay:r.presetLimitDisplay(fe.exceeded.nextLimit),onChangePlan:be})}):null]})};Is.propTypes={};function uf(e){const t=r.parseEmBlockVersion(e);if(!t)return e;const n=o=>String(o).padStart(2,"0");return`${n(t.getDate())}.${n(t.getMonth()+1)}.${t.getFullYear()} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}var pf=({open:e,blocks:t,projectId:n,onClose:o})=>{const{__:i,_n:s}=r.useI18n(),c=r.useSendPostMessage(),d=r.useNotification(),[u,p]=(0,l.useState)({});(0,l.useEffect)(()=>{e&&p(Object.fromEntries(t.map(m=>[m.emBlockId,!0])))},[e,t]);const f=(0,l.useMemo)(()=>Object.values(u).filter(Boolean).length,[u]),g=(m,E)=>{p(k=>({...k,[m]:E}))},y=()=>{const m=t.filter(E=>u[E.emBlockId]);m.length&&(m.forEach(E=>{c({operation:r.EVENT_TYPES.SANDBOX_GLOBAL_BLOCK_REPLACE,settings:{emBlockId:E.emBlockId,blockHTML:E.savedHtml,type:"project",...n?{project:String(n)}:{}}})}),d.success({message:i("Updated")+" "+m.length+" "+s("block","blocks",m.length),placement:"bottomRight"}),o())};return(0,a.jsxs)(_.ui_kit$Modal,{title:(0,a.jsx)("div",{className:"ant-modal-title",children:i("Update global blocks")}),open:e,onOk:y,onCancel:o,footer:(0,a.jsxs)("div",{className:"update-global-blocks-modal__footer",children:[(0,a.jsx)(_.ui_kit$Button,{size:"large",onClick:o,children:i("Cancel")}),(0,a.jsx)(_.ui_kit$Button,{size:"large",type:"primary",disabled:f===0,onClick:y,children:i("Update")})]}),children:[(0,a.jsx)("div",{className:"update-global-blocks-modal__hint",children:i("These global blocks have a newer saved version. Select the ones to update in the template.")}),(0,a.jsx)("div",{className:"update-global-blocks-modal__list",children:t.map(m=>(0,a.jsxs)("div",{className:"update-global-blocks-modal__row",children:[(0,a.jsx)(_.ui_kit$Switch,{checked:!!u[m.emBlockId],onChange:E=>g(m.emBlockId,E)}),(0,a.jsxs)("span",{className:"update-global-blocks-modal__title",title:m.title,children:[m.title,(0,a.jsxs)("span",{className:"update-global-blocks-modal__version",children:[i("Version of")," ",uf(m.savedVersion)]})]}),m.instances>1&&(0,a.jsxs)("span",{className:"update-global-blocks-modal__count",children:[m.instances," ",s("instance","instances",m.instances)]})]},m.emBlockId))})]})};function mf(e){const t=new Map;return e?.trim()&&new DOMParser().parseFromString(e,"text/html").querySelectorAll('[em="block"][em-block-id]').forEach(n=>{const o=n.getAttribute("em-block-id");if(!o)return;const i=n.getAttribute("em-block-version")??void 0,s=t.get(o);s?(s.versions.add(i),s.count+=1):t.set(o,{versions:new Set([i]),count:1})}),t}function ff(e,t){const n=mf(e);if(!n.size||!t?.length)return[];const o=[];for(const i of t){if(!i.global_block||!i.id||!i.html)continue;const s=String(i.id),c=n.get(s);if(!c)continue;const d=r.readRootEmBlockAttrs(i.html).emBlockVersion;d&&[...c.versions].some(u=>u!==d)&&o.push({emBlockId:s,title:i.title?.trim()||s,savedHtml:i.html,savedVersion:d,templateVersion:[...c.versions][0],instances:c.count})}return o}var As="em-block-id";function gf({projectId:e,document:t}){const n=r.useEvent(h.events.ON_EMAIL_INIT_ID),o=r.useHeadless(),[i,s]=(0,l.useState)([]),[c,d]=(0,l.useState)(!1),[u,p]=(0,l.useState)(null),f=(0,l.useCallback)(E=>t?.subscribe(E)??(()=>{}),[t]),g=(0,l.useSyncExternalStore)(f,()=>!!t?.getContent().includes(As)),{data:y}=r.blocksApi.endpoints.getBlocks.useQuery(r.projectBlocksArgs(e),{skip:!e||!g}),m=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{g&&m.current&&t&&(m.current=!1,p(t.getContent()))},[g,t]),(0,l.useEffect)(()=>{const E=new h.Disposable;return E.addDisposable(n(k=>{if(k?.reset)return;const w=k?.html??"",v=w.includes(As);m.current=!v,p(v?w:null)})),()=>E.dispose()},[n]),(0,l.useEffect)(()=>{if(u==null||!y)return;if(o){p(null);return}const E=ff(u,y);E.length&&(s(E),d(!0)),p(null)},[u,y,o]),{outdatedBlocks:i,isOpen:c,close:(0,l.useCallback)(()=>d(!1),[])}}var hf=({open:e,html:t,emBlockId:n,onSaveAsNew:o,onClose:i})=>{const{__:s}=r.useI18n(),c=r.useSendPostMessage(),d=r.useNotification(),[u]=r.useEditBlockMutation(),[p,f]=(0,l.useState)(!1),g=async()=>{if(!n||!t){i();return}f(!0);const y=new Date,m=r.formatEmBlockVersion(y),E=r.injectEmBlockIdIntoBlockHtml(t,String(n),y),k=await u({blockId:String(n),html:E});if(f(!1),"error"in k&&k.error){d.error({message:s("Failed to update the global block."),placement:"bottomRight"});return}c({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:String(n),emBlockVersion:m}}),d.success({message:s("The global block was updated."),placement:"bottomRight"}),i()};return(0,a.jsx)(_.ui_kit$Modal,{title:(0,a.jsx)("div",{className:"ant-modal-title",children:s("Saving changes in the block")}),open:e,onCancel:i,footer:(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[(0,a.jsx)(_.ui_kit$Button,{size:"large",disabled:p,onClick:o,children:s("Create new block")}),(0,a.jsx)(_.ui_kit$Button,{size:"large",type:"primary",loading:p,onClick:g,children:s("Update current block")})]}),children:(0,a.jsx)("div",{children:s("This is a global block. You can create a new one to apply changes only in this email, or update the current one — then the changes will be applied everywhere this block is used.")})})},_f=(function(){var e=window.__useblocks__;if(e&&e.assetUrl)return e.assetUrl("converter-intro.bf4ee74d750b35ae2c10.png");if(e&&e.publicPath)try{return new URL("static/media/converter-intro.bf4ee74d750b35ae2c10.png",e.publicPath).href}catch{}try{return new URL("/static/media/converter-intro.bf4ee74d750b35ae2c10.png",typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"").href}catch{return"/static/media/converter-intro.bf4ee74d750b35ae2c10.png"}})(),yf={closable:!1},vf=_f,bf=({open:e,onConfirm:t,onCancel:n,neverSuggestAgain:o,onNeverSuggestAgainChange:i})=>{const{__:s}=r.useI18n();return(0,a.jsx)(_.ui_kit$Modal,{className:"convert-layout-modal",title:(0,a.jsx)("div",{className:"convert-layout-modal__title",children:s("Template conversion")}),open:e,onOk:t,onCancel:n,mask:yf,width:480,footer:(0,a.jsxs)("div",{className:"convert-layout-modal__footer",style:{display:"flex",flexDirection:"column",gap:16},children:[(0,a.jsx)(_.ui_kit$Switch,{size:"small",checked:o,onChange:i,label:s("Don't suggest again"),labelSize:"small"}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,a.jsx)(_.ui_kit$Button,{size:"large",onClick:n,children:s("Cancel")}),(0,a.jsx)(_.ui_kit$Button,{size:"large",type:"primary",onClick:t,children:s("Convert")})]})]}),children:(0,a.jsxs)("div",{className:"convert-layout-modal__content",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:24,padding:"0 8px",overflow:"hidden"},children:[(0,a.jsx)("div",{className:"convert-layout-modal__text convert-layout-modal__intro-text",style:{textAlign:"center"},children:s("This layout was not created in our editor. Convert it to unlock full editing capabilities: easily change texts, replace images, and manage blocks.")}),(0,a.jsx)("img",{src:vf,alt:"Converter Intro",className:"convert-layout-modal__image",style:{display:"block",width:"100%",maxWidth:"100%",height:"auto",borderRadius:8}})]})})},Ef={closable:!1},Sf=({open:e,message:t,onRetry:n,onCancel:o})=>{const{__:i}=r.useI18n();return(0,a.jsx)(_.ui_kit$Modal,{title:(0,a.jsx)("div",{className:"ant-modal-title",children:i("Conversion failed")}),open:e,onOk:n,onCancel:o,mask:Ef,footer:(0,a.jsxs)("div",{className:"convert-layout-modal__footer",children:[(0,a.jsx)(_.ui_kit$Button,{size:"large",onClick:o,children:i("Cancel")}),(0,a.jsx)(_.ui_kit$Button,{size:"large",type:"primary",onClick:n,children:i("Try again")})]}),children:(0,a.jsxs)("div",{className:"convert-layout-modal__text",children:[i("Something went wrong during layout conversion. You can try running the conversion again."),t?(0,a.jsx)("div",{className:"convert-layout-modal__error-details",children:t}):null]})})},wf=({open:e,progress:t})=>{const{__:n}=r.useI18n();return e?(0,a.jsx)("div",{className:"conversion-overlay",children:(0,a.jsxs)("div",{className:"conversion-overlay__content",children:[(0,a.jsx)(_.ui_kit$Spin,{size:"large"}),(0,a.jsx)("div",{className:"conversion-overlay__title",children:n("Converting layout…")}),(0,a.jsx)("div",{className:"conversion-overlay__hint",children:n("This may take several minutes. Please keep this tab open.")}),(0,a.jsx)(_.ui_kit$Progress,{className:"conversion-overlay__progress",percent:Math.round(t),status:"active",strokeColor:r.emCssVar("colorPrimary")})]})}):null},yr=r.createApi({reducerPath:"layoutConverterApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({createConvertJob:e.mutation({query:({html:t})=>({url:"/ai/converter/jobs",method:"POST",body:{html:t}})}),getConvertJobStatus:e.query({query:t=>({url:`/ai/converter/jobs/${t}`,method:"GET"})})})}),{useCreateConvertJobMutation:kf,useLazyGetConvertJobStatusQuery:Cf}=yr;function Tf(){try{return window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_layout_convert_never_suggest)==="true"}catch{return!1}}function If(e){try{e?window.localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_layout_convert_never_suggest,"true"):window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_layout_convert_never_suggest)}catch{}}function xs(e){return e==="beefree"?(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/79749848.js")).then(t=>t.convertBeeFreeToEmailMaker),void 0,{}.url):(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/e0d71533.js")).then(t=>t.convertStripoToEmailMaker),void 0,{}.url)}var Af=5,Ps=95,xf=35e3,Pf=1e3,Rf=e=>new Promise(t=>setTimeout(t,e));function jf(e,t){if(e&&typeof e=="object"){const n=e,o=n.data;if(o&&typeof o=="object"){const i=o.error;if(typeof i=="object"&&i?.message)return i.message;if(typeof i=="string"&&i)return i;if(o.message)return o.message}if(typeof o=="string"&&o)return o;if(n.error)return n.error;if(n.message)return n.message}return t}function Of(){const{__:e}=r.useI18n(),t=r.useContentReplacer(),n=r.useNotification(),o=vs(),{aiLayoutConverterEnabled:i,anyConverterEnabled:s}=o,c=r.useHeadless(),d=r.useEvent(h.events.ON_EMAIL_INIT_ID),u=r.useEvent(h.events.ON_LAYOUT_CONVERT_REQUEST_ID),[p]=kf(),[f]=Cf(),[g,y]=(0,l.useState)(Tf),m=(0,l.useRef)(g),E=(0,l.useCallback)(ie=>{m.current=ie,y(ie),If(ie)},[]),[k,w]=(0,l.useState)(!1),[v,x]=(0,l.useState)(!1),[P,K]=(0,l.useState)(0),[J,N]=(0,l.useState)(!1),[L,A]=(0,l.useState)(""),O=(0,l.useRef)(""),z=(0,l.useRef)(null),B=(0,l.useRef)(null),U=(0,l.useRef)(!1),de=(0,l.useRef)({cancelled:!0}),me=(0,l.useRef)(null);(0,l.useEffect)(()=>{U.current=v},[v]);const H=(0,l.useCallback)(()=>{me.current!==null&&(clearInterval(me.current),me.current=null)},[]),Z=(0,l.useCallback)(()=>{H();const ie=Date.now();me.current=setInterval(()=>{const se=Date.now()-ie,Ae=Ps*(1-Math.exp(-se/xf));K(Te=>Math.max(Te,Math.min(Ps,Ae)))},Pf)},[H]),De=(0,l.useCallback)(ie=>{ie&&(t(ie,{undoable:!0}),B.current=ie)},[t]),ve=(0,l.useCallback)(async ie=>{const se={cancelled:!1};de.current=se,N(!1);const Ae=z.current;if(Ae==="beefree"||Ae==="stripo"){try{const Te=await xs(Ae),Fe=se.cancelled?"":Te(ie);if(Fe&&!se.cancelled){De(Fe),n.success({message:r.isUseBlocksBuild()?e("Layout converted to Blocks format"):e("Layout converted to EmailMaker format"),placement:"bottomRight"});return}}catch{}if(!i){se.cancelled||(A(e("Layout conversion failed")),N(!0));return}}if(i){x(!0),K(0),Z();try{const Te=await p({html:ie}).unwrap();if(se.cancelled)return;let Fe=Te.retry_after>0?Te.retry_after:Af;for(;!se.cancelled;){if(await Rf(Fe*1e3),se.cancelled)return;const X=await f(Te.job_id).unwrap();if(se.cancelled)return;if(X.retry_after&&X.retry_after>0&&(Fe=X.retry_after),X.status==="completed"){H(),K(100),De(X.html??""),n.success({message:r.isUseBlocksBuild()?e("Layout converted to Blocks format"):e("Layout converted to EmailMaker format"),placement:"bottomRight"}),setTimeout(()=>{se.cancelled||(x(!1),K(0))},400);return}if(X.status==="failed")throw new Error(X.error?.message||e("Layout conversion failed"))}}catch(Te){if(se.cancelled)return;H(),x(!1),K(0),A(jf(Te,e("Layout conversion failed"))),N(!0)}}},[e,i,De,p,n,f,Z,H]),et=(0,l.useCallback)(()=>{w(!1);const ie=O.current;ie&&ve(ie)},[ve]),be=(0,l.useCallback)(()=>{w(!1),B.current=O.current},[]),fe=(0,l.useCallback)(()=>{N(!1);const ie=O.current;ie&&ve(ie)},[ve]),Y=(0,l.useCallback)(()=>{N(!1),B.current=O.current},[]),pe=(0,l.useCallback)((ie,se=!1)=>{const Ae=bs(ie,o);if(s&&!c&&Ae&&!U.current){if(se)B.current=null;else{if(m.current)return;if(B.current===ie)return}O.current=ie,z.current=Ae,Ae!=="ai"&&xs(Ae).catch(()=>{}),w(!0)}},[s,o,c]);return(0,l.useEffect)(()=>{if(!s)return;const ie=new h.Disposable;return ie.addDisposable(d(se=>{se?.reset||pe(se?.html??"")})),()=>ie.dispose()},[s,d,pe]),(0,l.useEffect)(()=>{if(!s)return;const ie=new h.Disposable;return ie.addDisposable(u(se=>{pe(se?.html??"",!0)})),()=>ie.dispose()},[s,u,pe]),(0,l.useEffect)(()=>()=>{de.current.cancelled=!0,H()},[H]),{isPromptOpen:k,isConverting:v,progress:P,isErrorOpen:J,errorMessage:L,confirmConversion:et,cancelPrompt:be,retryConversion:fe,closeError:Y,neverSuggestAgain:g,setNeverSuggestAgain:E}}var Lf=6e4,Rs=new Map;function Mf(e){const t=e?String(e):"",n=Rs.get(t);if(n&&(Rs.delete(t),!(Date.now()-n.at>Lf)))return n.promise}var ho={data:void 0,isSuccess:!1,isError:!1,error:void 0,isLoading:!1};function Nf(e){const t=r.useStore(),n=(0,l.useRef)(t);n.current=t;const[o,i]=(0,l.useState)(ho),s=e?String(e):void 0;return(0,l.useEffect)(()=>{if(!s){i(ho);return}let c=!1;return i({...ho,isLoading:!0}),(Mf(s)??r.resolveEmailPort(h.getContainer(n.current)).readEmail(s)).then(d=>{c||i({data:d??void 0,isSuccess:!0,isError:!1,error:void 0,isLoading:!1})}).catch(d=>{c||i({data:void 0,isSuccess:!1,isError:!0,error:d,isLoading:!1})}),()=>{c=!0}},[s]),o}var ob=2;function Df(){const e=r.useProjectData()?.id,t=!0,{data:n,isError:o,isFetching:i,refetch:s}=r.useGetProjectPlanQuery(e,{skip:t}),[c,d]=(0,l.useState)(0),u=(0,l.useRef)(!1),p=!!o,f=c>=2,g=(0,l.useCallback)(()=>{u.current=!1,d(0),s()},[s]);(0,l.useEffect)(()=>{},[p,i,s,c,t]),(0,l.useEffect)(()=>{},[p,e,f,t]);const y="ready";return(0,l.useMemo)(()=>({status:y,retry:g}),[y,g])}var ib=300,Ff=h.createIdentifier$1("prewarm.queue");function Bf(e){const t=[];let n=!1,o=!1,i;const s=()=>{i&&(i.unwatch(),e.clearTimer(i.timer),i=void 0)},c=()=>{const p=t.shift();if(!p)return;o=!0;const f=()=>{o=!1,u()};p.start().then(f,f)},d=()=>{s(),e.idle(()=>{if(!(o||t.length===0)){if(e.activity.inFlight()>0){u();return}c()}})};function u(){if(!n||o||i||t.length===0)return;const p=()=>e.setTimer(d,300),f={timer:e.activity.inFlight()===0?p():void 0,unwatch:e.activity.watch(()=>{e.clearTimer(f.timer),f.timer=e.activity.inFlight()===0?p():void 0})};i=f}return e.whenVisible(()=>{n=!0,u()}),{add(p){t.some(f=>f.name===p.name)||(t.push(p),u())},remove(p){const f=t.findIndex(g=>g.name===p);f>=0&&t.splice(f,1),t.length===0&&s()}}}function $f(e){return e.getOrCreateInstance(Ff,()=>Bf({activity:h.getNetworkActivity(e),whenVisible:t=>Ht(e).whenVisible(t),idle:Xt,setTimer:(t,n)=>window.setTimeout(t,n),clearTimer:t=>window.clearTimeout(t)}))}function Uf({projectId:e,project:t,emailProjectId:n,parentEmailId:o}){const i=r.useContainer(),s=r.useAppDispatch(),d=!!r.useCookieManager().get(r.APP_COOKIES.em_token);(0,l.useEffect)(()=>{const u=$f(i),p=[],f=[],g=(m,E)=>{f.push(m),u.add({name:m,start:()=>{const k=E();return p.push(k),Promise.resolve(k)}})},y=r.parentEmailSource(o);return y&&g("blocks.parentEmail",()=>s(r.blocksApi.endpoints.getParentEmailBlocks.initiate(r.parentEmailBlocksArgs(y)))),g("blocks.template",()=>s(r.blocksApi.endpoints.getTemplateBlocks.initiate(r.templateBlocksArgs()))),e&&g("blocks.list",()=>s(r.blocksApi.endpoints.getBlocks.initiate(r.projectBlocksArgs(e)))),g("blocks.schema",()=>s(r.blocksApi.endpoints.getBlocksSchema.initiate(void 0))),t?.id&&g("blocks.tags",()=>s(r.taxonomiesApi.endpoints.getTerms.initiate({project:t,kind:r.BLOCK_TAGS}))),()=>{f.forEach(m=>u.remove(m)),p.forEach(m=>m.unsubscribe())}},[i,s,e,t,n,o,d])}var _o="AUTOSAVE_RECOVERY";function zf(e,t,n=!1,o){const i=t?.get().serverId??void 0,{__:s}=r.useI18n(),c=r.useNotification(),d=r.useAppConfig(),u=r.useSelector(r.selectMonacoFocusing),p=r.useContainer(),f=p?.getInstance(Ts),g=(0,l.useRef)(0),y=r.useSelector(r.selectIsPanelHistoryCollapsed),m=r.useSelector(r.selectActiveSettingsTab),E=r.useDispatch(),k=(0,l.useSyncExternalStore)((0,l.useCallback)(L=>o?.subscribe(L)??(()=>{}),[o]),()=>o?.recoveryFacts()),w=d?.revisionService===!0,v=k?.isRecovering===!0,x=k?.applied,P=(0,l.useCallback)(()=>{E(r.markAppearanceNeedsUpdate());const L=e?.renderGuid,A=e?.preheader,O=e?.subject;L&&(A||O)&&f?.reassert({...A?{preheader:A}:{},...O?{subject:O}:{}})},[E,f,e?.preheader,e?.subject,e?.title,e?.common_styles,e?.renderGuid,t,o]);(0,l.useEffect)(()=>()=>{clearTimeout(g.current),o?.endForcedHeaders()},[i,o]),(0,l.useEffect)(()=>{w&&v&&c.info({key:_o,title:s("Loading latest changes..."),duration:0})},[w,v,c,s]);const K=(0,l.useRef)({emailId:void 0,seq:0});(0,l.useEffect)(()=>{if(!x||k?.emailId!==i||(K.current.emailId!==i&&(K.current={emailId:i,seq:0}),x.seq<=K.current.seq))return;K.current={emailId:i,seq:x.seq},P();const{phase:L}=x;!w||L==="normal"||(L==="found"?c.success({key:_o,title:s("Changes loaded"),duration:3}):L==="timeout"?c.warning({key:_o,title:s("Locally saved version applied"),description:s("Syncing with the server in the background..."),duration:5}):L==="bg"&&c.info({key:"AUTOSAVE_BG_SYNCED",title:s("Email synced with the server"),duration:3}))},[w,x,k?.emailId,i,P,c,s]),(0,l.useEffect)(()=>{if(!n)return;const L=A=>{A.preventDefault()};return window.addEventListener("beforeunload",L),()=>window.removeEventListener("beforeunload",L)},[n]);const J=!y||u||m==="Discuss",N=p?r.provideAutosaveUiFacts(p):void 0;(0,l.useEffect)(()=>{N?.set({...N.get()??{isUserBusy:!1,saveContext:{}},isUserBusy:J})},[N,J])}var Gf=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 Wf(e,t,n){return t<=0?e:new Promise((o,i)=>{let s=!1,c;const d=u=>{s||(s=!0,c!==void 0&&(clearTimeout(c),c=void 0),u())};c=setTimeout(()=>{d(()=>i(new Gf(n,t)))},t),e.then(u=>{d(()=>o(u))},u=>{d(()=>i(u))})})}var Hf=2,vr=Symbol("sandbox:frame-replaced");function an(e,t,n,o,i,s,c){const d=`sandbox:${t}`,u=s?.getSandboxTimeoutMs(t)??r.DEFAULT_SANDBOX_OP_TIMEOUT_MS[t],p=()=>{let E=Wf(e.sendAsync(n,o),u,d);return E=h.raceWithAbortSignal(E,s?.signal),r.logShowPipelineWait(d,E,i)};if(t==="INIT_START"&&Ki(e)){const E=s?.getSandboxReadyTimeoutMs()??2e4,k=e,w=v=>{const x=Yi(k,E,s?.signal);return r.logShowPipelineWait("sandbox:INIT_START:ready-wait",x,i).then(()=>{if(!c||v<=0)return p();const P=c.getGeneration();let K;const J=new Promise((L,A)=>{K=c.onChange(()=>{c.getGeneration()!==P&&A(vr)})}),N=p();return N.catch(()=>{}),Promise.race([N,J]).finally(()=>K?.()).catch(L=>{if(L!==vr)throw L;return{...i},w(v-1)})})};return w(Hf)}if(!c)return p();const f=c.getGeneration();let g;const y=new Promise((E,k)=>{g=c.onChange(()=>{c.getGeneration()!==f&&k(vr)})}),m=p();return m.catch(()=>{}),Promise.race([m,y]).finally(()=>g?.()).catch(E=>{throw E===vr&&{...i},E})}function js(e,t,n,o){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...o!==void 0?{rev:o}:{}}}var Os="self-init:";function qf(e){return e.startsWith(Os)}function Ls(e,t){const n=e.getActiveShowRequest();return qf(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Vf(e){const t=()=>e.initPipeline(),n=e.messageService,o=()=>e.waitScope?.()??t();let i="";const s=()=>e.readDocument()?r.readDocumentContent(e.readDocument()):i,c=()=>on(e.container).editorPolicy,d=()=>e.readEmail(),u=()=>{const p=d();return{...p,id:e.isTemplate()||p.isNew?void 0:p.id,html:s()}};return{readContent:s,publicEmail:u,sendInitStart:()=>an(n,"INIT_START",r.EVENT_TYPES.SANDBOX_INIT_START,{guid:d().renderGuid},void 0,o()),sendInited:()=>an(n,"INITED",r.EVENT_TYPES.SANDBOX_INITED,{guid:d().renderGuid},void 0,o()),async sendContent(){const p=d(),{html:f,hasBrowserExtensionArtifacts:g}=r.prepareEmailHtmlForEditor(p?.html||"");g&&e.events.browserExtensionDetected(),r.loadDocumentContent(e.readDocument(),f),i=f,await an(n,"SET_ENTITY",r.EVENT_TYPES.SANDBOX_SET_ENTITY,js(s(),p.renderGuid,c(),e.readDocument()?.get().version),{guid:p.renderGuid,emailId:p.id??null},o())},refreshContent:()=>an(n,"SET_ENTITY",r.EVENT_TYPES.SANDBOX_SET_ENTITY,js(s(),d().renderGuid,c(),e.readDocument()?.get().version),void 0,o()),sendPreheader:async()=>{const p=d();if(p.preheader!==void 0)return an(n,"PREHEADER",r.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:p.preheader,guid:p.renderGuid,force:!0},void 0,o())},sendSubject:async()=>{const p=d();if(p.subject!==void 0)return an(n,"SUBJECT",r.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:p.subject,guid:p.renderGuid,force:!0},void 0,o())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:p=>e.showFilled?.(p),readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(u()),fireInit(p,f){if(!Ls(t(),p)){t().getActiveShowRequest()?.showId;return}const g=d();g.id,g.renderGuid,t().completeShow(p),r.writeEmailAttributes(e.readDocument(),{is_inited:!0},{source:"system"});const y=u();return f&&(y.reset=!0),e.events.inited(y)},fireEmailChanged(){e.events.emailChanged(u())},fireContentChanged(){e.events.contentChanged(s())}}}function Kf(e){const t=()=>e.initPipeline();let n=!1,o,i,s,c=0,d;const u=Vf({...e,waitScope:()=>({getSandboxTimeoutMs:w=>t().getSandboxTimeoutMs(w),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:d?.signal??t().signal})});let p;const f=(w,v)=>{if(p===w)return;p=w;const x=c;setTimeout(()=>{c!==x||t().signal.aborted||E(w,v).catch(()=>{})},0)},g=()=>{d?.abort(),d=void 0};let y;const m=()=>{const w=t().signal;w!==y&&(y?.removeEventListener("abort",g),y=w,w.addEventListener("abort",g))};async function E(w,v){const x=++c;g(),d=new AbortController,m();const P=()=>c!==x,K=u.readTarget(),J=t().generation,N=()=>J===t().generation&&!t().signal.aborted,L=v?"init:reset-":"init:";if(!v){const z=u.publicEmail();z?.id,z?.renderGuid,z?.preheader}let A=!1,O=!1;try{n=!0,await u.sendInitStart(),u.fireWillInit(),await(v?u.refreshContent():u.sendContent()),A=!0,v||u.publicEmail()?.id;try{await u.sendPreheader()}catch(z){r.logShowPipelineError(`${L}preheader-failed`,{showId:w,error:String(z)})}try{await u.sendSubject()}catch(z){r.logShowPipelineError(`${L}subject-failed`,{showId:w,error:String(z)})}if(P()||u.showFilled(K),await u.sendInited(),O=!0,i===w){const z=e.readSandboxGeneration?.()??s;z!==void 0&&(o=z)}await u.revealFilled()}catch(z){throw P()||r.logShowPipelineError(`${L}failed`,{showId:w,contentApplied:A,sandboxInitedAcked:O,superseded:!1,...e.describeSurface?.(),error:String(z)}),!P()&&Ls(t(),w)&&t().failShow(w,z),z}finally{k(w,v,L,{superseded:P(),sessionGeneration:J,contentApplied:A,sandboxInitedAcked:O,commit:N()})}}function k(w,v,x,P){const{superseded:K,contentApplied:J,sandboxInitedAcked:N}=P;if(K){`${x}`;return}N&&P.commit?u.fireInit(w,v||void 0):N?r.logShowPipelineError(`${x}aborted (stale session or signal)`,{showId:w,sessionGeneration:P.sessionGeneration,currentGeneration:t().generation,aborted:t().signal.aborted}):J?r.logShowPipelineError(`${x}aborted (sandbox INITED ack missing)`,{showId:w}):r.logShowPipelineError(`${x}aborted (content not applied)`,{showId:w}),n=!1,d=void 0,!N&&i===w&&(i=void 0,o===s&&(o=void 0)),!N&&J&&f(w,v)}return{channel:u,isEventsLocked:()=>n,filledGeneration:()=>o,markFilled:w=>{o=w},lastCorrelation:()=>i,markCorrelation:w=>{i=w},bumpRunSeq:()=>{c+=1},noteSandboxGeneration:w=>{s=w},fill:w=>E(w,!1),refill:w=>E(w,!0),stop:()=>{c+=1,g(),n=!1,y?.removeEventListener("abort",g),y=void 0}}}function Yf(e,t,n){if(!e?.renderGuid||!e.showId||e.showId!==t.showId)return!1;if(t.isNew)return e.id==null;const o=t.emailId??t.navId;return o!=null&&String(e.id??"")!==String(o)?!1:Ms(e,n)}function Ms(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Qf(e){const{pipeline:t,readEmail:n,readDocument:o,readRouteEmailId:i,readSandboxGeneration:s}=e,c=f=>{const g=n(),y=i();if(!Yf(g,f,y)){f.showId,f.navId,f.emailId,g?.id,g?.showId,g?.renderGuid;return}f.showId,g?.id,g?.renderGuid,t.markFilled(s()),t.markCorrelation(f.showId),t.fill(f.showId).catch(()=>{})};return{showRequested:f=>{c(f)},showRequestIdentityChanged:()=>{const f=e.initPipeline().getActiveShowRequest();f&&c(f)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const f=s();if(t.filledGeneration()===f)return;const g=n(),y=i();if(!g?.renderGuid||!Ms(g,y))return;const m=`${Os}${g.renderGuid}`;t.markFilled(f),t.markCorrelation(m);const E=o()?.isReady()===!0;g.id,g.renderGuid,(E?k=>t.refill(k):k=>t.fill(k))(m).catch(()=>{t.lastCorrelation()===m&&t.markFilled(void 0)})},saasChanged:()=>{const f=n();f?.renderGuid,f?.showToken,f?.id}}}var Ns=h.createIdentifier$1("canvas.sandboxFill"),Xf=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}},Jf=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(h.createAbortError("Superseded by newer show()")),n.aborted?Promise.reject(h.createAbortError(n.reason)):(this._activeRequest=e,new Promise((o,i)=>{const s=setTimeout(()=>{this._settle(e.showId,()=>{i(new Xf(e.showId,t))})},t);s.unref?.();const c=()=>{this._settle(e.showId,()=>{i(h.createAbortError(n.reason))})};n.addEventListener("abort",c,{once:!0});const d=()=>{clearTimeout(s),n.removeEventListener("abort",c)};this._pending.set(e.showId,{request:e,resolve:o,reject:i,timeoutId:s,dispose:d});for(const u of this._listeners)u(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 Zf(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function eg(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=r.resolveContentReadyTimeoutMs(e),n=r.resolveSandboxReadyTimeoutMs(e),o=r.resolveSequentialSandboxOpBudgetMs(e.sandbox);t<n+o}var tg=class{_controller=new AbortController;_externalSignalDisposable=new h.Disposable;_sessionChangeListeners=new Set;_showRegistry=new Jf;_timeouts;_generation=0;_sessionStarted=!1;get signal(){return this._controller.signal}get generation(){return this._generation}get contentReadyTimeoutMs(){return r.resolveContentReadyTimeoutMs(this._timeouts)}getSandboxTimeoutMs(e){return r.resolveSandboxOpTimeoutMs(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return r.resolveSandboxReadyTimeoutMs(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=Zf(this._timeouts,e.timeouts),eg(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}abort(e){const t=e??h.createAbortError("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new h.Disposable}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new h.Disposable,this._showRegistry.rejectAll(h.createAbortError("Init session replaced")),this._controller.signal.aborted||this._controller.abort(h.createAbortError("Init session replaced")),this._controller=new AbortController,this._emitSessionReplaced()}_emitSessionReplaced(){for(const e of this._sessionChangeListeners)e()}_linkExternalSignal(e){if(!e)return;if(e.aborted){this._controller.signal.aborted||(this._controller.abort(e.reason??h.createAbortError()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??h.createAbortError()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},ng=(()=>{const e=new tg;return e.configure({}),e})();function yo(){const e=r.useStore();return(0,l.useMemo)(()=>h.getContainer(e)?.getInstance(h.INIT_PIPELINE_ID)??ng,[e])}function rg(e){const t=yo(),n=(0,l.useRef)(e);n.current=e,(0,l.useEffect)(()=>{let o;const i=()=>{o?.();const c=t.signal;if(c.aborted){n.current();return}const d=()=>n.current();c.addEventListener("abort",d),o=()=>c.removeEventListener("abort",d)};i();const s=t.onSessionReplaced(i);return()=>{s(),o?.()}},[t])}function og(e){const t=yo(),n=(0,l.useRef)(e);n.current=e,(0,l.useEffect)(()=>t.onShowRequested(o=>n.current(o)),[t])}var ig=(e,t,n,o,i)=>{const s=r.useStore(),c=r.useMessageService(),d=yo(),u=(0,l.useRef)(d);u.current=d;const p=r.useEventEmitter(h.events.WILL_EMAIL_INIT_ID),f=r.useEventEmitter(h.events.ON_EMAIL_INIT_ID),g=r.useEventEmitter(h.events.ON_CONTENT_CHANGED_ID),y=r.useEventEmitter(h.events.ON_EMAIL_CHANGED_ID),m=r.useEventEmitter(h.events.ON_BROWSER_EXTENSION_DETECTED_ID),E=e?.id!==void 0,k=e?.showToken??0,w=k,v=(0,l.useRef)(w);v.current=w;const x=(0,l.useRef)(void 0);x.current=e;const[P,K]=(0,l.useState)(()=>r.getSandboxGeneration(c)),J=(0,l.useRef)(P);J.current=P,(0,l.useEffect)(()=>(K(r.getSandboxGeneration(c)),r.onSandboxGenerationChange(c,()=>{K(r.getSandboxGeneration(c))})),[c]);const N=(0,l.useRef)(o);N.current=o;const L=(0,l.useRef)(t);L.current=t;const A=i?.standalone?void 0:h.getContainer(s)?.getInstance(Ns),O=!A,z=(0,l.useRef)(A?.pipeline);z.current||(z.current=Kf({container:h.getContainer(s),messageService:c,initPipeline:()=>u.current,readDocument:()=>N.current,readEmail:()=>x.current,isTemplate:()=>!!L.current,readSandboxGeneration:()=>J.current,events:{willInit:H=>p.fire(H),inited:H=>f.fire(H),contentChanged:H=>g.fire(H),emailChanged:H=>y.fire(H),browserExtensionDetected:()=>m.fire()}}));const B=z.current,U=(0,l.useRef)(n);U.current=n;const de=(0,l.useRef)(void 0);O&&!de.current&&(de.current=Qf({pipeline:B,initPipeline:()=>u.current,readEmail:()=>x.current,readDocument:()=>N.current,readRouteEmailId:()=>U.current,readSandboxGeneration:()=>J.current}));const me=de.current;B.noteSandboxGeneration(J.current),(0,l.useEffect)(()=>{if(O)return()=>z.current?.stop()},[O]),(0,l.useEffect)(()=>{A?.setRoute({emailId:n,isTemplate:t})},[A,n,t]),(0,l.useEffect)(()=>{const H=x.current;if(O&&!B.isEventsLocked()&&e?.renderGuid===H?.renderGuid&&H?.is_inited&&H){const Z=B.channel.readContent();y.fire({...H,id:t||H.isNew?void 0:H.id,html:Z})}},[B,e?.renderGuid,e?.preheader,e?.common_styles,e?.meta,e?.subject,e?.utm_parameters?.utm_campaign||"",e?.utm_parameters?.utm_content||"",e?.utm_parameters?.utm_medium||"",e?.utm_parameters?.utm_source||"",e?.utm_parameters?.utm_term||"",y,t,O]),(0,l.useEffect)(()=>{if(O){const H=r.subscribeToContent(o,()=>{const Z=x.current;if(!B.isEventsLocked()&&e?.renderGuid===Z?.renderGuid&&Z){const De=B.channel.readContent();g.fire(De),y.fire({...Z,id:t||Z.isNew?void 0:Z.id,html:De})}});return()=>H.dispose()}},[o,B,g,y,e,t,O]),rg(()=>{O&&B.stop()}),og(H=>{me?.showRequested(H)}),(0,l.useEffect)(()=>{me?.showRequestIdentityChanged()},[me,d,e?.renderGuid,e?.showId,e?.id,n]),(0,l.useEffect)(()=>{me?.selfInitChanged()},[me,d,e?.renderGuid,e?.showId,e?.id,n,o,P]),r.usePrevious(()=>{me?.saasChanged()},[e?.renderGuid,k,E,me]),Zr(async()=>{if(!O)return;const H=d.getActiveShowRequest()?.showId;H&&(B.markFilled(J.current),await B.refill(H))},{async:!0})};function sg(e){const t=r.useEvent(h.events.ON_EMAIL_INIT_ID);(0,l.useEffect)(()=>{if(!e)return;const n=t(()=>e.clear());return()=>n.dispose()},[e,t])}function ag(e,t){const n=r.useEventEmitter(h.events.ON_DOCUMENT_SESSION_CHANGE);(0,l.useEffect)(()=>{n.fire({document:e,history:t})},[e,t,n])}function lg({templateEmailId:e,templateEmail:t,newEmail:n}){return e?t:n}function cg({routeEmailId:e,draft:t}){const n=r.useStore();(0,l.useRef)(0),(0,l.useEffect)(()=>{},[n,e,t])}function dg(e,t){return t}function ug(e){return!1}function pg({documents:e,push:t,projectId:n,subscription:o}){(0,l.useEffect)(()=>e.onSaved(i=>{i.intent==="publish"&&t({event:"save",action:"save_email",email_id:i.serverId??void 0,project_id:n,subscription:o})}),[e,t,n,o])}function mg(e){const t=r.useStore();(0,l.useEffect)(()=>{},[t,e])}function fg(e,t,n){const o=r.useAppNavigate(),i=r.useContainer();(0,l.useEffect)(()=>{},[o,e,t,n,i])}function gg(e){if(!e)return{status:"unknown"};if("status"in e){const t=e.data,n=t&&typeof t=="object"?t.message:void 0,o=typeof n=="string"?n:typeof t=="string"?t:void 0;return{status:String(e.status),message:o}}return{status:e.name??"unknown",message:e.message}}function Ds(e,t,n){const{status:o,message:i}=gg(n);r.reportMessage(`Failed to load ${e} ${t??"?"}: ${o}`,{origin:"entity-load-error",tags:{mechanism:"entity-load-error",entity_type:e,http_status:o},level:"error",contexts:{entity_load_error:{entityType:e,entityId:t,status:o,message:i,url:window.location.href}}})}var{Content:hg}=_.ui_kit$Layout,_g={paddingTop:"40px"},yg=()=>{const{__:e}=r.useI18n(),{owner:t,admin:n}=Qn(),o=r.useDispatch(),i=Vr(),s=r.useAppNavigate(),{modal:c}=_.ui_kit$App.useApp(),d=r.useAppConfig(),u=r.useRootElement(),p=r.useCookieManager(),f=r.useMessageService(),{emailId:g,preview:y}=r.useRouteParams(),m=r.useEditorProjectId(),E=r.useAppSearchParams(),k=r.useSelector(r.selectIsCodeMode),w=r.useSelector(r.selectActiveModal),v=r.useCurrentUser(),x=r.useProjectData(),P=(0,l.useMemo)(()=>r.createNewEmailDraft(x?{id:Number(x.id),title:x.name}:void 0),[x]),K=r.useSelector(r.selectIsGlobalLoading),[J]=r.useLazyGetMeQuery(),{isSuccess:N,data:L}=r.useGetSubscriptionsQuery(),A=Df(),[O,z]=(0,l.useState)(!1),[B,U]=(0,l.useState)(!1),[de,me]=(0,l.useState)(),[H,Z]=(0,l.useState)(null),[De,ve]=(0,l.useState)(!1),[et,be]=(0,l.useState)(!1),[fe,Y]=(0,l.useState)(!1),[pe,ie]=(0,l.useState)(!1),[se,Ae]=(0,l.useState)(!1),Te=(0,l.useRef)(),{confirm:Fe}=c,{counters:X,subscription:Ee}=v,Ie=X?.emails_counter;p.get(r.APP_COOKIES.em_template_email);const ge=E.get("template")||!B&&!g&&p.get(r.APP_COOKIES.em_new_email),{isSuccess:Re,isLoading:Ue,isError:C,error:T,data:R}=Nf(g?void 0:ge),D=lg({templateEmailId:ge,templateEmail:R,newEmail:P});cg({routeEmailId:g,draft:D});const{document:I,email:S,error:ae}=r.useOpenEmail(),we=S?.id!=null?String(S.id):void 0,Ye=dg(g,we);(0,l.useEffect)(()=>{},[g,we,I,ge]),fg(g,S?.id,m);const Qe=r.useStore(),ze=r.getEmailDocuments(h.getContainer(Qe)),Ze=(0,l.useCallback)((ce,ke)=>ze.save(ce,ke),[ze]),pt=(0,l.useCallback)(()=>ze.saveState(),[ze]),bt=r.usePushToDataLayer();pg({documents:ze,push:bt,projectId:m,subscription:Ee?.post_title}),(0,l.useEffect)(()=>{!B&&S?.id&&U(!0)},[U,B,S?.id]);const ft=ze.history();ag(I,ft),sg(ft),ig(S,ug(g),Ye,I);const lt=Jr({document:I,history:ft});zf(S,I,ze.saveState().saving,ze),mg(m),(0,l.useEffect)(()=>{r.injectEmailRightsResolver(h.getContainer(Qe),ce=>!!(t||n||v.id?.toString()===ce?.author?.toString()))},[Qe,t,n,v.id]);const G=Kp({email:S,save:Ze,saveState:pt,documentSession:I}),{outdatedBlocks:V,isOpen:te,close:ue}=gf({projectId:m,document:I});Uf({projectId:m,project:x,emailProjectId:S?.project,parentEmailId:S?.parent_email});const he=w===r.MODALS.ADD_NEW_EBLOCK_MODAL,Ge=kn(he),qe=kn(fe),{isPromptOpen:st,isConverting:Bt,progress:Le,isErrorOpen:Xe,errorMessage:oe,confirmConversion:ee,cancelPrompt:$,retryConversion:le,closeError:xe,neverSuggestAgain:Se,setNeverSuggestAgain:Me}=Of(),We=ae??(ge?T:void 0),Be=!!We,ot=!S&&!Be,fn=!!S;(0,l.useEffect)(()=>{Be&&We&&Ds("email",g||ge,We)},[Be,We,g,ge]),(0,l.useEffect)(()=>{ge&&Re&&(U(!0),E.set({}))},[ge,Re,E]),(0,l.useEffect)(()=>(o(r.switchIsPanelHistoryCollapsed(!0)),()=>o(r.switchIsPanelHistoryCollapsed(!0))),[o]);const Ot=(0,l.useCallback)(()=>{i.toggle(),o(r.resetPanes())},[o,i]);(0,l.useEffect)(()=>{y&&!k&&Ot()},[k,y,Ot]),(0,l.useEffect)(()=>{document.body.classList.add("editor"),o(r.setActiveSettingsTab(r.BUILD))},[o]),(0,l.useEffect)(()=>{!O&&Ie<3&&(J(),z(!0))},[J,Ie,O]);const ct=(0,l.useCallback)(()=>{lt.undo()},[lt]),Et=(0,l.useCallback)(()=>{lt.redo()},[lt]);(0,l.useEffect)(()=>{Te.current!==S?.id&&(lt.clear(),Te.current=S?.id)},[S,lt]);const Lt=(0,l.useCallback)(ce=>{(window.navigator.appVersion.indexOf("Mac")&&ce.metaKey||ce.ctrlKey)&&ce.code==="KeyZ"&&(ce.preventDefault(),ce.shiftKey?Et():ct())},[ct,Et]);(0,l.useEffect)(()=>()=>{o(r.resetPanes()),o(r.closeModal()),o(r.closeModal$1()),o(r.resetElementHistorySlice())},[o]);const jn=(0,l.useCallback)(ce=>{const ke=()=>{o(r.openModal(r.MODALS.ADD_NEW_EBLOCK_MODAL))},Ne=ce.data.operation,nt=ce.data,je=ce.data.action,Yt=u.querySelector("#iframe-scroll-top"),$t=u.querySelector("#iframe-scroll-bottom");if(Ne===r.EVENT_TYPES.APPLICATION_EBLOCK_ADD){const dt=nt.settings?.emBlockId;dt?Z({html:nt.data,emBlockId:String(dt)}):(me(nt.data),ke())}if(Ne===r.EVENT_TYPES.APPLICATION_ACTION&&(je==="undo"?ct():je==="redo"&&Et()),Ne===r.EVENT_TYPES.APPLICATION_SCROLL_BLOCK_SHOW){const dt=u.querySelector("#email_iframe_slot"),Nn=document.body.getBoundingClientRect().height,Ut=dt.getClientRects()[0];Ut.top<0&&(Yt.style.display="block"),Ut.top+Ut.height>Nn&&($t.style.display="block")}Ne===r.EVENT_TYPES.APPLICATION_SCROLL_BLOCK_HIDE&&(Yt.style.display="none",$t.style.display="none")},[o,ct,Et,u]);r.useListenPostMessage(jn);const On=ce=>{if(ce.target?.closest?.(".file-manager, .ant-modal.file-manager"))return;const ke=ce.dataTransfer,Ne=(ke?Array.from(ke.types||[]):[]).includes(r.DND_SOCIAL_LIST_REORDER_MIME),nt=typeof ce.composedPath=="function"?ce.composedPath():[];ce.target?.closest?.(".selected-social-form")||nt.some(je=>je&&je.nodeType===1&&typeof je.classList?.contains=="function"&&je.classList.contains("selected-social-form"))||Ne||(ce.preventDefault(),ce.target&&f.send({operation:r.EVENT_TYPES.SANDBOX_DRAG_CANCEL}),u.querySelectorAll(".em-dragging-element").forEach(je=>{je.classList.remove("em-dragging-element")}))},gn=(0,l.useRef)({});(0,l.useEffect)(()=>{const ce=new h.Disposable,ke=Ne=>nt=>gn.current[Ne]?.(nt);return ce.addDisposable(r.addWindowListenerFromShadow(u,"drop",ke("drop"))),ce.addDisposable(r.addWindowListenerFromShadow(u,"dragover",ke("dragover"))),ce.addDisposable(r.addWindowListenerFromShadow(u,"dragstart",ke("dragstart"))),ce.addDisposable(r.addWindowListenerFromShadow(u,"dragend",ke("dragend"))),()=>{ce.dispose()}},[u]),(0,l.useEffect)(()=>(window.addEventListener("keydown",Lt),()=>{window.removeEventListener("keydown",Lt)}),[Lt]);const Ln=ce=>{if(ce.preventDefault(),ce.target?.closest?.(".file-manager, .ant-modal.file-manager"))return;const ke=u.querySelector("#iframe-scroll-top"),Ne=u.querySelector("#iframe-scroll-bottom"),nt=d.sidePanelFloating?u.querySelector("#pane-content-wrapper"):u.querySelector(".email-pane__col_preview"),je=u.querySelector(".blocks-app").getBoundingClientRect().top,{height:Yt,top:$t}=u.querySelector("#email_iframe_slot").getBoundingClientRect(),dt=nt.getBoundingClientRect().height;$t>96?ke.style.display==="block"&&(ke.style.display="none"):(ke.style.display==="none"||ke.style.display==="")&&(ke.style.display="block"),Yt-dt+$t-je<44?Ne.style.display==="block"&&(Ne.style.display="none"):Ne.style.display==="none"&&(Ne.style.display="block"),ce.target===ke&&nt.scrollBy(0,-15),ce.target===Ne&&nt.scrollBy(0,15)},Mn=()=>{const ce=u.querySelector("#iframe-scroll-top"),ke=u.querySelector("#iframe-scroll-bottom");ce&&ke&&(ce.style.display="none",ke.style.display="none"),u.querySelectorAll(".em-dragging-element").forEach(Ne=>{Ne.classList.remove("em-dragging-element")})},gt=ce=>{const ke=ce.target,Ne=ke instanceof Element?ke:ke.parentElement;if(!(Ne instanceof Element)||Ne.closest(".selected-social-form"))return;Ne.parentElement?.classList.add("em-dragging-element");const nt=!!Ne.closest(".blocks-search__result-wrapper");var je=nt?r.cloneBlockPreviewForDrag(Ne.querySelector(".blocks-search__result-html")):Ne.cloneNode(!0);je.classList.add("em-ghost-element"),je.style.height=nt?"auto":"70px",je.style.width=nt?"600px":"109px",je.style.position="absolute",je.style.top="0",je.style.left="0",je.style.zIndex="-1",Ne.appendChild(je),ce.dataTransfer.setDragImage(je,0,0),window.setTimeout(function(){je.parentNode.removeChild(je)},1e3)};gn.current={drop:On,dragover:Ln,dragstart:gt,dragend:Mn};const St=(0,l.useCallback)(()=>{Fe({title:e("You reached the plan limit"),icon:(0,a.jsx)(r.EmIcons,{icon:"ExclamationCircleOutlined",component:_.icons$ExclamationCircleOutlined}),content:(0,a.jsx)("div",{style:{maxWidth:"330px"},children:e("Switch to a different plan to save more emails.")}),centered:!0,okText:e("Choose a plan"),cancelText:e("Continue without saving"),width:"unset",onOk(){s("/billing")},onCancel(){}})},[s,e,Fe]);return(0,l.useEffect)(()=>{if(N&&L){const ce=L?.find(ke=>ke.id?.toString()===Ee?.ID?.toString())?.limits?.emails_limit;ce&&Ie>=ce&&!De&&!g&&t&&(St(),ve(!0))}},[L,N,Ee,Ie,De,St,g,t]),(0,l.useEffect)(()=>{const ce=f.onInit(()=>{f.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})});return()=>ce.dispose()},[f]),(0,a.jsx)(r.DocumentSessionProvider,{document:I,history:ft,children:(0,a.jsx)(hs.Provider,{value:G,children:(0,a.jsxs)(_.ui_kit$Layout,{className:"email-page",children:[ot&&(0,a.jsx)(_.ui_kit$PageLoader,{}),!ot&&A.status==="pending"&&(0,a.jsx)(_.ui_kit$PageLoader,{}),A.status==="error"&&(0,a.jsx)(hg,{style:_g,children:(0,a.jsx)("div",{className:"container",children:(0,a.jsx)(_.ui_kit$Result,{status:"warning",title:e("Failed to load plan data"),subTitle:e("Editor features depend on your plan. Check your connection and try again."),extra:(0,a.jsx)(_.ui_kit$Button,{type:"primary",onClick:A.retry,children:e("Try again")})})})}),Be&&We&&!1,S&&!ot&&A.status==="ready"&&(0,a.jsxs)(_.ui_kit$Layout,{className:"email-pane",children:[K&&(0,a.jsx)("div",{className:"email-pane__loader",children:(0,a.jsx)(_.ui_kit$PageLoader,{small:!0})}),(0,a.jsx)(Is,{email:S,isCollaborationEditor:et}),(0,a.jsx)(Np,{emailElement:S,isSuccess:fn,setIsCollaborationEditor:be,setIsShowAddAllBlocksModal:Y,triggerOpenSavedBlocksTab:pe})]}),Ge&&(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(Cu,{isModalVisible:he,htmlContent:de,projectId:m,setIsShowAddAllBlocksModal:Y,setIsShowAddAllBlocksModalForNewEmail:Ae,currentEmail:S})}),(0,a.jsx)(pf,{open:te,blocks:V,projectId:m,onClose:ue}),(0,a.jsx)(hf,{open:!!H,html:H?.html,emBlockId:H?.emBlockId,onSaveAsNew:()=>{me(H?.html),Z(null),o(r.openModal(r.MODALS.ADD_NEW_EBLOCK_MODAL))},onClose:()=>Z(null)}),qe&&(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(Tu,{isModalVisible:fe,currentEmail:S,setIsShowAddAllBlocksModal:Y,setTriggerOpenSavedBlocksTab:ie,autoStart:!se,projectId:m})}),(0,a.jsx)(bf,{open:st,onConfirm:ee,onCancel:$,neverSuggestAgain:Se,onNeverSuggestAgainChange:Me}),(0,a.jsx)(wf,{open:Bt,progress:Le}),(0,a.jsx)(Sf,{open:Xe,message:oe,onRetry:le,onCancel:xe})]})})})};function vg(){const e=r.useStore(),t=r.getEmailDocuments(h.getContainer(e)),n=(0,l.useCallback)(o=>t.subscribe(o),[t]);return(0,l.useSyncExternalStore)(n,()=>!!t.current())}function bg(e,t){const n=r.useStore(),o=r.useAppConfig(),i=r.useStorageProvider();(0,l.useRef)(new Set),(0,l.useEffect)(()=>{},[e,t,o,n,i])}var Eg=30;function Sg(e){const t=r.useContainer(),n=r.useGetProjectQuery(+e,{skip:!e,refetchOnMountOrArgChange:Eg}),{isSuccess:o,isError:i,error:s,data:c,isFetching:d}=n;bg(e,o),(0,l.useEffect)(()=>{t&&r.setCurrentProjectRefreshing(t,d)},[t,d]),(0,l.useEffect)(()=>{t&&o&&c&&String(c.id)===String(e)&&r.setCurrentProjectCard(t,c)},[o,c,t,e]),(0,l.useEffect)(()=>{i&&s&&Ds("project",e,s)},[i,s,e]);const u=r.useProjectData(),p=!!u&&String(u.id)===String(e);return{...n,projectReady:p}}var An=r.createApi({reducerPath:"promoApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.emailmaker.ru/api/wp-json/promo/v1/"}),endpoints:e=>({checkPromo:e.mutation({queryFn:({code:t,type:n},o)=>r.clientFromApi(o).promo.set_code_create({code:t,type:n})}),getPromoInfo:e.query({queryFn({code:t},n){return r.clientFromApi(n).promo.get_code_info_list({code:t})}})})}),{useCheckPromoMutation:sb,useGetPromoInfoQuery:ab}=An;function wg(){const e=r.useContainer(),[t,n]=(0,l.useState)();return(0,l.useEffect)(()=>{if(!e)return;let o=!0;return r.getAppProject(e).then(i=>{o&&i!=null&&n(String(i))},()=>{}),()=>{o=!1}},[e]),t}var kg=()=>{const e=r.useDispatch(),t=r.useCookieManager(),n=r.useCurrentUser(),o=r.useContainer();(0,l.useEffect)(()=>{const s=n?.code_editor;s&&o&&r.applyEditorOptions(o,s)},[n,o]),(0,l.useEffect)(()=>{const s=t.get(r.APP_COOKIES.em_token),c=t.get(r.APP_COOKIES.promocode);s&&c&&(e(An.endpoints.checkPromo.initiate({code:c,type:"by_link"})),t.remove(r.APP_COOKIES.promocode))},[e,t]),r.useNotifyCommand();const i=vg();return Sg(wg()),i?(0,a.jsx)(Ql,{hasEmail:!0,children:(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(_.ui_kit$PageLoader,{}),children:(0,a.jsx)(yg,{})})}):null};function Cg(e,t){const n=(0,l.useRef)(!1);(0,l.useEffect)(()=>{!e||n.current||(n.current=!0,r.mark(r.PHASES.appVisible),t&&Ht(t).noteShellVisible())},[e,t])}var xn=new WeakMap,Tg="data-useblocks-config-styles";function Ig(e){return typeof e=="string"?e.trim():""}function Fs(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function Ag(e,t,n){if(!e||typeof document>"u")return null;const o=Ig(t),i=xn.get(e),s=n||e;if(!o)return i&&(i.remove(),xn.delete(e)),null;if(i)return i.textContent!==o&&(i.textContent=o),(i.parentNode!==s||i!==s.firstChild)&&Fs(s,i),i;const c=document.createElement("style");return c.setAttribute(Tg,"true"),c.textContent=o,Fs(s,c),xn.set(e,c),c}function vo(e){if(!e)return;const t=xn.get(e);t&&(t.remove(),xn.delete(e))}var xg={height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},Pg=({children:e,handleBeforeRender:t})=>{const[n,o]=(0,l.useState)(),i=r.useIsLocaleInited();Cg(i,r.useContainer());const s=r.useAppConfig().styles,c=(0,l.useRef)(null),d=(0,l.useRef)(!1),u=(0,l.useRef)(void 0),p=r.useRootElement();return(0,l.useLayoutEffect)(()=>{d.current||(d.current=!0,t&&t())},[]),(0,l.useLayoutEffect)(()=>{if(!p){u.current&&(vo(u.current),u.current=void 0);return}u.current&&u.current!==p&&vo(u.current),Ag(p,s,c.current||void 0),u.current=p},[p,s]),(0,l.useLayoutEffect)(()=>()=>{u.current&&(vo(u.current),u.current=void 0)},[]),(0,a.jsxs)(_.ui_kit$StyleProvider,{container:r.findShadowRoot(p)||document.head,children:[(0,a.jsxs)("div",{ref:c,className:"App blocks-app blocks-plugin",style:i?{}:{visibility:"hidden"},children:[(0,a.jsx)(r.ModalRootContext.Provider,{value:n,children:e}),(0,a.jsx)("div",{ref:o,className:"blocks-modal-container"})]}),!i&&(0,a.jsx)(_.ui_kit$Space,{size:"large",style:xg,children:(0,a.jsx)(_.ui_kit$Spin,{size:"large"})})]})};async function Rg({container:e,renderTarget:t,mapKey:n,disposable:o,chunkLoadedFire:i}){const s=await e.getInstanceAsync(h.STORE_ID);return new Promise(c=>{if(o.isDisposed()){c();return}const d=(0,nl.createRoot)(t),u=(0,a.jsx)(r.Provider,{store:s,children:(0,a.jsx)(Wl,{onLoad:c,children:(0,a.jsx)(r.RootContext.Provider,{value:{element:n},children:(0,a.jsx)(_.ui_kit$StyleProvider,{container:r.isDocumentFragment(n)?document.head:n,children:(0,a.jsx)(r.LocaleProvider,{children:(0,a.jsx)(Pg,{handleBeforeRender:i,children:(0,a.jsx)(pl,{children:(0,a.jsx)(Gl,{children:(0,a.jsx)(kg,{})})})})})})})})});d.render(u),o.addDispose(c),o.addDispose(()=>{try{d.unmount()}catch(p){if(p instanceof DOMException&&p.name==="NotFoundError"||p instanceof Error&&p.name==="NotFoundError"&&/removeChild/i.test(p.message)){r.logShowPipelineError("mount:unmount-dom-mismatch (host container was already removed)",{hint:"Usually harmless during host React StrictMode teardown. Ensure instance.destroy() runs before the host removes the mount container."});return}throw p}}),o.addDispose(()=>{h.ELEMENT_MAP.delete(n)})})}var lb="multiple init call on single HTMLELEMENT",jg=zn(async e=>{let t=null,n=!1;const o=h.getEmitter(e,h.events.ON_CHUNKS_LOADED),i=e.getInstance(h.DISPOSABLE_ID);let s,c=!1;const d=()=>{c||(c=!0,r.mark(r.PHASES.chunksLoaded),o.fire())},u=(p,f)=>Rg({container:e,renderTarget:p,mapKey:f,disposable:s,chunkLoadedFire:d});return{instance:{getElement(){return t}},async setOptions(p){const f=e.getInstance(h.INIT_PIPELINE_ID),g=await h.waitForElement(p.element,i,f.signal),y=e.getInstance(h.INSTANCE_ID),m=!!p.hidden&&!!g;if(t===g&&n===m)return;const E=t===g&&n&&!m;n=m,i.addDisposable(o.event(()=>{p.handleChunkLoaded&&p.handleChunkLoaded()})),t&&h.ELEMENT_MAP.delete(t),g&&h.ELEMENT_MAP.has(g),s&&s.dispose(),s=i.addDisposable(new h.Disposable);const k=p.element!==void 0;if(r.setHeadlessMode(e,!g||m),r.setHiddenMount(e,m),!g){r.mark(r.MOUNT_HEADLESS_MARK);const v=document.createElement("div");v.style.position="absolute",v.style.left="-10000px",v.style.top="-10000px",v.style.width="1600px",v.style.height="1000px",document.body.appendChild(v),t=v,d(),s.addDispose(()=>{v.parentNode===document.body&&v.remove()});return}const w=r.findShadowRoot(g);if(w&&s.addDisposable(new ul({shadowRoot:w})),k&&g instanceof Element){const v=g;il(v,()=>{i.isDisposed()||s?.isDisposed()||(r.logShowPipelineError("mount:detached (host removed element without destroy)",{elementId:v.id||null}),f.abort(ol()))},s)}if(m){r.mark(r.MOUNT_HEADLESS_MARK),t=g,d();return}if(k&&g instanceof Element){const v=g,x=cl(v);t=v;const P=u(x,v);return dl(v,x,s),P}return t=g,u(g,g)},dispose(){s&&!s.isDisposed()&&s.dispose()}}});function bo(e){return zn(async t=>(await t.getInstanceAsync(h.STORE_ID),await e(t)))}function Og({html:e,renderGuid:t,...n},o){const{requested:i}=r.getCurrentProject(o);return r.filterUndefined({...n,code:on(o).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 Lg(e,t){return r.filterUndefined({...e,link:void 0,comment_status:void 0})}function Mg({html:e,...t},n){return r.filterUndefined({...t,code:e,guid:void 0,compiled:r.filterUndefined({html:e,ampHtml:e&&""})})}var Bs=e=>{const t={current:Promise.resolve(),state:e,decorate:(n,o)=>(o&&(n=n.bind(o)),function(...i){const s=t.current.then(()=>n(...i));return t.current=s.then(c=>{t.state=c},c=>{}),s})};return t},Ng=h.createIdentifier$1("emailTemplate.reads");async function Dg(e,t){try{return await r.getRestEmailPortFactories(e).email(e).readEmail(t)??void 0}catch(n){r.logShowPipelineError("show:template-read-failed",{templateId:t,error:n instanceof Error?n.message:"неизвестная ошибка"});return}}function Fg(e,t){const n=e.getOrCreateInstance(Ng,()=>new Map),o=n.get(t);if(o!==void 0)return o;const i=Dg(e,t).then(s=>(s===void 0&&n.delete(t),s));return n.set(t,i),i}var kt=class extends h.Disposable{_event;_listener;_disposeEvent;constructor(e){super(),this._event=e}setListener(e){this._listener!==e&&(this._listener=e,this._disposeEvent&&this._disposeEvent(),e?this._disposeEvent=this._event(e):this._disposeEvent=void 0)}dispose(){this._disposeEvent&&this._disposeEvent(),super.dispose()}};function Ct(e,t,n){const o=h.snapshot(e);return(i,s,c)=>{const d=o(async u=>{const p=t?t(u):u;c&&i.bind(c);const f=await i(p);return n?n(f):f},s,c);return()=>d.dispose()}}var cb=h.createIdentifier("application_block_inserted"),db=h.createIdentifier$1("DataController"),ub=h.createIdentifier$1("DataEvents"),Bg=h.createIdentifier$1("plugin.startupShow");function $g(e){return e.getInstance(Bg)?.current??Promise.resolve()}var $s=bo(async()=>({instance:{}})),Us=bo(async e=>({instance:{},async setOptions(){await $g(e)}})),pb=h.combineMixins([$s,Us]),zs=()=>({title:"",description:"",website:"",company_size:"",industry:"",email:"",phone:"",logo_url:""}),Ug={title:"title",description:"description",website:"website",company_size:"company_size",industry:"industry",email:"email",phone:"phone",logo_url:"logo"},Gs=e=>({...zs(),title:e?.title??"",description:e?.description??"",website:e?.website??"",company_size:e?.company_size??"",industry:e?.industry??"",email:e?.email??"",phone:e?.phone??"",logo_url:e?.logo??""}),Ws=e=>(e??[]).filter(t=>!!t?.code).map(({code:t,label:n})=>({value:t,label:n??t})),zg=e=>({company_sizes:Ws(e?.company_sizes),industries:Ws(e?.industries)}),mb=Object.keys(zs()),Hs="ProjectProfile",Pn=r.createApi({reducerPath:"projectSettingsProfileApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),tagTypes:[Hs],endpoints:e=>({getProjectProfile:e.query({async queryFn(t,n){const o=r.v2ResultOf(await r.getClientV2(h.getContainer(n)).projects.profileList({id:String(t)}));return"error"in o?{error:o.error}:{data:Gs(o.data)}},providesTags:(t,n,o)=>[{type:Hs,id:String(o)}]}),getProjectProfileOptions:e.query({async queryFn(t,n){const o=r.v2ResultOf(await r.getClientV2(h.getContainer(n)).projects.profileOptionsList());return"error"in o?{error:o.error}:{data:zg(o.data)}}}),updateProjectProfileField:e.mutation({async queryFn({projectId:t,field:n,value:o},i){const s={[Ug[n]]:o},c=r.v2ResultOf(await r.getClientV2(h.getContainer(i)).projects.profilePartialUpdate({id:String(t)},s));return"error"in c?{error:c.error}:{data:Gs(c.data)}},async onQueryStarted({projectId:t},{dispatch:n,queryFulfilled:o}){try{const{data:i}=await o;n(Pn.util.updateQueryData("getProjectProfile",t,()=>i))}catch{}}})})}),{useGetProjectProfileQuery:fb,useGetProjectProfileOptionsQuery:gb,useUpdateProjectProfileFieldMutation:hb}=Pn,qs="ProjectStorage",Rn=r.createApi({reducerPath:"projectSettingsStorageApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),tagTypes:[qs],endpoints:e=>({getProjectStorage:e.query({async queryFn(t,n){const o=r.v2ResultOf(await r.getClientV2(h.getContainer(n)).projects.storageList({id:String(t)}));return"error"in o?{error:o.error}:{data:o.data}},providesTags:(t,n,o)=>[{type:qs,id:String(o)}]}),updateProjectStorage:e.mutation({async queryFn({projectId:t,body:n},o){const i=r.v2ResultOf(await r.getClientV2(h.getContainer(o)).projects.storageUpdate({id:String(t)},n));return"error"in i?{error:i.error}:{data:i.data}},async onQueryStarted({projectId:t},{dispatch:n,queryFulfilled:o}){const{data:i}=await o;n(Rn.util.upsertQueryData("getProjectStorage",t,i))}}),testProjectStorageConnection:e.mutation({async queryFn({projectId:t,body:n},o){const i=r.v2ResultOf(await r.getClientV2(h.getContainer(o)).projects.storageTestCreate({id:String(t)},n));return"error"in i?{error:i.error}:{data:i.data}}})})}),{useGetProjectStorageQuery:_b,useUpdateProjectStorageMutation:yb,useTestProjectStorageConnectionMutation:vb}=Rn,Gg=class{http;constructor(e){this.http=e}settings_summary_detail=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/settings-summary/${e}`,method:"GET",...n})},Vs=class{http;constructor(e){this.http=e}developer_credentials_detail=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/developer-credentials/${e}`,method:"GET",...n});developer_credentials_partial_update=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/developer-credentials/${e}`,method:"PATCH",...n});developer_credentials_rotate_secret_create=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/developer-credentials/${e}/rotate-secret`,method:"POST",...n});developer_credentials_verify_secret_create=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/developer-credentials/${e}/verify-secret`,method:"POST",...n})},Wg=class{http;constructor(e){this.http=e}developer_kit_postman_collection_list=(e={})=>this.http.request({path:"/projects/v1/developer-kit/postman-collection",method:"GET",...e})},Hg=class{http;constructor(e){this.http=e}billing_context_detail=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/billing-context/${e}`,method:"GET",...n});billing_context_payments_list=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/billing-context/${e}/payments`,method:"GET",query:t,...n})},qg=class{http;constructor(e){this.http=e}usage_detail=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/usage/${e}`,method:"GET",...n});usage_timeseries_list=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/usage/${e}/timeseries`,method:"GET",query:t,...n})},Ke={PLUGIN_INIT:"plugin_init",LINK_CHECK:"link_check",IMAGE_CHECK:"image_check",SPAM_ASSASSIN:"spam_assassin",AI_IMAGE:"ai_image",AI_WRITE:"ai_write",AI_REPHRASE:"ai_rephrase"},Zt={TODAY:"today",WEEK:"week",MONTH:"month",CUSTOM:"custom"},bb=[Ke.PLUGIN_INIT,Ke.LINK_CHECK,Ke.IMAGE_CHECK,Ke.SPAM_ASSASSIN,Ke.AI_IMAGE,Ke.AI_WRITE],ln={current:0,limit:null},Vg=()=>({pluginInit:{...ln},aiAssistant:{...ln},aiImage:{...ln},linkCheck:{...ln},imageCheck:{...ln},spamAssassin:{...ln}}),tt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Je=(e,t,n="")=>{for(const o of t){const i=e[o];if(typeof i=="string")return i;if(typeof i=="number"&&Number.isFinite(i))return String(i)}return n},Ft=(e,t,n=0)=>{for(const o of t){const i=e[o];if(typeof i=="number"&&Number.isFinite(i))return i;if(typeof i=="string"&&i.trim()&&Number.isFinite(Number(i)))return Number(i)}return n},Eo=(e,t,n=!1)=>{for(const o of t){const i=e[o];if(typeof i=="boolean")return i}return n},br=(e,t)=>{for(const n of t){const o=e[n];if(o===null)return null;if(typeof o=="number"&&Number.isFinite(o))return o;if(typeof o=="string"&&o.trim()&&Number.isFinite(Number(o)))return Number(o)}return null},Kg=new Set(Object.values(Ke)),Yg=e=>Kg.has(e)?e:null,en=e=>tt(e)&&"data"in e&&(e.ok===!0||typeof e.success=="boolean"||e.success===void 0)?e.data:e,cn=(e,t)=>{for(const n of t){const o=e[n];if(tt(o))return o}return null},Qg=(e,t)=>{for(const n of t){const o=e[n];if(!Array.isArray(o))continue;const i=o.filter(s=>typeof s=="string");if(i.length>0)return i}},Xg=e=>tt(e)?{clientId:Je(e,["clientId","client_id"]),clientSecretConfigured:Eo(e,["clientSecretConfigured","client_secret_configured"]),rotatedAt:Je(e,["rotatedAt","rotated_at"])||void 0,scopesSuggested:Qg(e,["scopesSuggested","scopes_suggested"])}:{clientId:"",clientSecretConfigured:!1},Ks=(e,t)=>{for(const n of t){const o=e[n];if(typeof o=="boolean")return o}},Jg=e=>{const t=Ks(e,["pluginConnected","plugin_connected","connected","is_connected"]);if(t!==void 0)return t;for(const n of["plugin","developer_credentials","developerCredentials"]){const o=cn(e,[n]);if(!o)continue;const i=Ks(o,["connected","plugin_connected","is_connected"]);if(i!==void 0)return i;const s=Je(o,["clientId","client_id"]),c=Eo(o,["clientSecretConfigured","client_secret_configured"]);if(s)return c}},Zg=e=>{const t=en(e);if(!tt(t))return{};const n=cn(t,["members"]);return{myRole:Je(t,["myRole","my_role","role"])||(n?Je(n,["myRole","my_role","role"]):"")||void 0,pluginConnected:Jg(t)}},eh=e=>tt(e)?{clientId:Je(e,["clientId","client_id"]),secret:Je(e,["secret","clientSecret","client_secret"])}:{clientId:"",secret:""},th=e=>{if(!tt(e))return null;const t=Je(e,["event","type","key"]),n=Yg(t);if(!n)return null;const o=e.delta??e.change??e.trend,i=o==null?null:typeof o=="number"&&Number.isFinite(o)?o:Number.isFinite(Number(o))?Number(o):null;return{event:n,total:Ft(e,["total","count","value"],0),delta:i}},Ys=e=>{if(!tt(e))return null;const t=Je(e,["date","day","x"]);if(!t)return null;const n={date:t},o=e.event_counts??e.eventCounts;if(tt(o)){for(const[i,s]of Object.entries(o))typeof s=="number"&&Number.isFinite(s)&&(n[i]=s);return n}for(const[i,s]of Object.entries(e))i==="date"||i==="day"||i==="x"||i==="event_counts"||i==="eventCounts"||typeof s=="number"&&Number.isFinite(s)&&(n[i]=s);return n},nh=e=>{const t=en(e);return tt(t)?(Array.isArray(t.chart)?t.chart:Array.isArray(t.series)?t.series:Array.isArray(t.time_series)?t.time_series:Array.isArray(t.history)?t.history:[]).map(Ys).filter(n=>n!==null):[]},rh=e=>{if(!tt(e))return{current:0,limit:null};const t=Ft(e,["current","count","used","value","total"],0),n=br(e,["limit","max","quota","cap"]);return{current:t,limit:n===null?null:n}},dn=(e,t)=>{for(const n of t)if(n in e)return rh(e[n]);return{current:0,limit:null}},un={pluginInit:[Ke.PLUGIN_INIT,"plugin_init","pluginInit"],aiAssistant:["ai_assistant","aiAssistant","ai"],aiImage:[Ke.AI_IMAGE,"ai_image","ai_img","aiImg"],linkCheck:[Ke.LINK_CHECK,"link_check","linkCheck"],imageCheck:[Ke.IMAGE_CHECK,"image_check","imageCheck"],spamAssassin:[Ke.SPAM_ASSASSIN,"spam_assassin","spamAssassin","spam_check","spamCheck"]},So=e=>{const t=Vg(),n=en(e),o=tt(n)&&tt(n.usage)?n.usage:n;if(!tt(o))return t;const i=Ft(o,["operationsTotal","operations_total"],0),s=Ft(o,["operationsLast30d","operations_last_30d"],0),c=cn(o,["metrics","counters","limits","events","usage_by_event","usageByEvent"])??o;return{pluginInit:dn(c,un.pluginInit),aiAssistant:dn(c,un.aiAssistant),aiImage:dn(c,un.aiImage),linkCheck:dn(c,un.linkCheck),imageCheck:dn(c,un.imageCheck),spamAssassin:dn(c,un.spamAssassin),lastActivityAt:Je(o,["lastActivityAt","last_activity_at"])||void 0,operationsTotal:i>0?i:void 0,operationsLast30d:s>0?s:void 0}},Qs=(e,t)=>{const n=[{event:Ke.LINK_CHECK,total:e.linkCheck.current,delta:null},{event:Ke.IMAGE_CHECK,total:e.imageCheck.current,delta:null},{event:Ke.SPAM_ASSASSIN,total:e.spamAssassin.current,delta:null},{event:Ke.AI_IMAGE,total:e.aiImage.current,delta:null}],o=t?nh(t):[];return o.length>0?{cards:n,chart:o}:{cards:n,chart:[]}},oh=e=>{const t=en(e);if(!tt(t))return Qs(So(e),e);const n=Array.isArray(t.cards)?t.cards:Array.isArray(t.summary)?t.summary:[],o=Array.isArray(t.chart)?t.chart:Array.isArray(t.series)?t.series:[];return n.length>0||o.length>0?{cards:n.map(th).filter(i=>i!==null),chart:o.map(Ys).filter(i=>i!==null)}:Qs(So(t),t)},ih=e=>{if(!tt(e))return null;const t=Je(e,["id","payment_id"]);return t?{id:t,date:Je(e,["date","created_at","paid_at"]),amount:Ft(e,["amount","sum"],0),currency:Je(e,["currency"],"RUB"),status:Je(e,["status"],"unknown"),receiptUrl:Je(e,["receiptUrl","receipt_url","pdf_url"])||void 0}:null},sh=e=>{const t=en(e),n=tt(t)&&Array.isArray(t.payments)?t.payments:[];return{payments:n.map(ih).filter(o=>o!==null),page:tt(t)?Ft(t,["page"],1):1,perPage:tt(t)?Ft(t,["perPage","per_page"],20):20,total:tt(t)?Ft(t,["total"],n.length):n.length,totalPages:tt(t)?Ft(t,["totalPages","total_pages"],1):1}},ah=e=>{const t=en(e);if(!tt(t))return{viewerSeesBilling:!1};const n=cn(t,["endpoints"])??{},o=cn(t,["documentLinks","document_links"]),i=o?Object.fromEntries(Object.entries(o).filter(f=>typeof f[1]=="string")):void 0,s=br(t,["ownerUserId","owner_user_id"]),c=cn(t,["tariff","plan","subscription"]),d=Je(t,["planDescription","plan_description"])||(c?Je(c,["description","about","plan_description"]):"")||void 0,u=br(t,["planPrice","plan_price","price","amount"])??(c?br(c,["price","amount"]):null),p=Je(t,["planCurrency","plan_currency","currency"])||(c?Je(c,["currency"]):"")||void 0;return{viewerSeesBilling:Eo(t,["viewerSeesBilling","viewer_sees_billing"]),ownerUserId:s??void 0,planName:Je(t,["planName","plan_name"])||void 0,planDescription:d,planPrice:u??void 0,planCurrency:p||void 0,endpoints:{limitsStats:Je(n,["limitsStats","limits_stats"])||void 0,subscriptionMe:Je(n,["subscriptionMe","subscription_me"])||void 0,payments:Je(n,["payments"])||void 0},documentLinks:i&&Object.keys(i).length>0?i:void 0}},lh={myRole:"owner"},ch=()=>({...lh}),dh={clientId:"rust-awkward-bear",clientSecretConfigured:{}.REACT_APP_PLUGIN_SETTINGS_MOCK_CONNECTED!=="false"},Xs=()=>({...dh,clientSecretConfigured:{}.REACT_APP_PLUGIN_SETTINGS_MOCK_CONNECTED!=="false"}),Js=Object.values(Ke),uh={[Ke.PLUGIN_INIT]:42,[Ke.LINK_CHECK]:-15,[Ke.IMAGE_CHECK]:28,[Ke.SPAM_ASSASSIN]:9,[Ke.AI_IMAGE]:6,[Ke.AI_WRITE]:-11,[Ke.AI_REPHRASE]:4},ph=(e,t)=>{const n={date:e};return Js.forEach((o,i)=>{const s=Math.sin(t*.65+i*.9),c=t*(i%2===0?.35:.2),d=2+i;n[o]=Math.max(0,Math.round(d+s*4+c))}),n},mh=e=>Js.map(t=>({event:t,total:e.reduce((n,o)=>n+(typeof o[t]=="number"?o[t]:0),0),delta:uh[t]})),fh=({period:e,dateFrom:t,dateTo:n})=>{const o=(0,En.default)().startOf("day");if(e===Zt.WEEK)return{startDate:o.subtract(6,"day"),days:7};if(e===Zt.MONTH)return{startDate:o.subtract(29,"day"),days:30};if(e===Zt.CUSTOM&&t&&n){const i=(0,En.default)(t),s=(0,En.default)(n);return{startDate:i,days:Math.max(1,s.diff(i,"day")+1)}}return{startDate:o,days:1}},wo=(e={period:Zt.TODAY})=>{const{startDate:t,days:n}=fh(e),o=Array.from({length:n},(i,s)=>ph(t.add(s,"day").format("YYYY-MM-DD"),s));return{cards:mh(o),chart:o}},Eb=wo({period:Zt.WEEK}),gh={pluginInit:{current:0,limit:null},aiAssistant:{current:0,limit:null},aiImage:{current:42,limit:100},linkCheck:{current:128,limit:500},imageCheck:{current:64,limit:200},spamAssassin:{current:31,limit:150},lastActivityAt:"2026-05-02T12:00:00Z"},Zs={payments:[{id:"98765",date:"2026-05-12T10:15:00+00:00",amount:990,currency:"RUB",status:"success",receiptUrl:"https://receipts.example/98765.pdf"},{id:"98764",date:"2026-04-12T10:15:00+00:00",amount:990,currency:"RUB",status:"success"},{id:"98763",date:"2026-03-12T10:15:00+00:00",amount:990,currency:"RUB",status:"failed"}],page:1,perPage:20,total:3,totalPages:1},hh={viewerSeesBilling:!0,ownerUserId:1,planName:"Corporate",planDescription:"For fully addressing all necessary tasks in any field.",planPrice:3200,planCurrency:"RUB",endpoints:{limitsStats:"/wp-json/limits/v1/stats",subscriptionMe:"/wp-json/subscription/v2/me",payments:"/wp-json/projects/v1/billing-context/2581/payments"}},_h={info:{name:"EmailMaker Plugin Requests",schema:"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},item:[]},yh=e=>e,vh=()=>!1,bh=()=>!1,Eh=e=>e,pn="ProjectPlugin",Sh=()=>({}).REACT_APP_PLUGIN_SETTINGS_USE_MOCK==="true",Vt=(e,t,n)=>e.error&&Sh()?{data:n(t)}:r.transformResponseFn(n)(e),wh=e=>yh(Xg(e)),kh=e=>Eh(ah(e)),Ch=({period:e,dateFrom:t,dateTo:n})=>{if(e===Zt.CUSTOM){const o={};return t&&(o.date_from=t),n&&(o.date_to=n),o}return{period:e??Zt.TODAY}},Er=r.createApi({reducerPath:"projectSettingsPluginApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api".replaceAll(/[\\/]$/g,"")}),tagTypes:[pn],endpoints:e=>({getPluginSummary:e.query({queryFn({projectId:t},n){return h.getApi(h.getContainer(n),[Gg]).settings_summary_detail({projectId:t}).then(o=>Vt(o,ch(),Zg))},providesTags:(t,n,{projectId:o})=>[{type:pn,id:o}]}),getPluginCredentials:e.query({queryFn({projectId:t},n){return h.getApi(h.getContainer(n),[Vs]).developer_credentials_detail({projectId:t}).then(o=>Vt(o,Xs(),wh))},providesTags:(t,n,{projectId:o})=>[{type:pn,id:`credentials-${o}`}]}),rotatePluginSecret:e.mutation({queryFn({projectId:t},n){return h.getApi(h.getContainer(n),[Vs]).developer_credentials_rotate_secret_create({projectId:t}).then(o=>Vt(o,{clientId:Xs().clientId,secret:"mock-rotated-secret"},eh))},invalidatesTags:(t,n,{projectId:o})=>[{type:pn,id:`credentials-${o}`}]}),getPostmanCollection:e.query({queryFn({projectId:t},n){return h.getApi(h.getContainer(n),[Wg]).developer_kit_postman_collection_list({extraQuery:{project_id:String(t)}}).then(o=>Vt(o,_h,i=>en(i)??i))}}),getPluginAnalytics:e.query({queryFn({projectId:t,period:n,dateFrom:o,dateTo:i},s){const c={period:n,dateFrom:o,dateTo:i};return vh()?Promise.resolve({data:wo(c)}):r.getClient(h.getContainer(s)).request({path:`/projects/v1/usage/${t}/timeseries`,method:"GET",query:Ch(c)}).then(d=>Vt(d,wo(c),oh))}}),getPluginBillingContext:e.query({queryFn({projectId:t},n){return h.getApi(h.getContainer(n),[Hg]).billing_context_detail({projectId:t}).then(o=>Vt(o,hh,kh))},providesTags:(t,n,{projectId:o})=>[{type:pn,id:`billing-${o}`}]}),getPluginUsage:e.query({queryFn({projectId:t},n){return h.getApi(h.getContainer(n),[qg]).usage_detail({projectId:t}).then(o=>Vt(o,gh,So))}}),getPluginPayments:e.query({queryFn({projectId:t,page:n=1,perPage:o=20},i){return bh()?Promise.resolve({data:Zs}):r.getClient(h.getContainer(i)).request({path:`/projects/v1/billing-context/${t}/payments`,method:"GET",query:{page:String(n),per_page:String(o)}}).then(s=>Vt(s,Zs,sh))},providesTags:(t,n,{projectId:o})=>[{type:pn,id:`payments-${o}`}]})})}),{useGetPluginSummaryQuery:Sb,useGetPluginCredentialsQuery:wb,useRotatePluginSecretMutation:kb,useLazyGetPostmanCollectionQuery:Cb,useGetPluginAnalyticsQuery:Tb,useGetPluginBillingContextQuery:Ib,useGetPluginPaymentsQuery:Ab,useGetPluginUsageQuery:xb}=Er,ea="EmailRaw",Sr=r.createApi({reducerPath:"emailRawApi",tagTypes:[ea],baseQuery:r.fetchBaseQuery({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getEmailRaw:e.query({queryFn:function({emailId:t,secret_hash:n},o){return h.getApi(h.getContainer(o),[h.WpEmailApi]).email_detail({id:t},{extraQuery:{secret_hash:n}}).then(r.transformResponseFn(r.WpEmailToEmail))},providesTags:(t,n,o)=>[{type:ea,id:o}]})})}),{useGetEmailRawQuery:Pb}=Sr,wr=r.createApi({reducerPath:"yandexAuthApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({validateYandexToken:e.mutation({query:t=>({url:"/auth/yandex",method:"POST",body:t})})})}),{useValidateYandexTokenMutation:Rb}=wr,kr=r.createApi({reducerPath:"elamaAuthApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({validateElamaCode:e.mutation({query:t=>({url:"/auth/elama",method:"POST",body:t})})})}),{useValidateElamaCodeMutation:jb}=kr,Cr=r.createApi({reducerPath:"googleAuthApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({validateGoogleToken:e.mutation({query:t=>({url:"/auth/google",method:"POST",body:t})})})}),{useValidateGoogleTokenMutation:Ob}=Cr,ta=async e=>{const t=await e.text();let n=t;try{n=JSON.parse(t)}catch{n=t}return n},Th=(e,t,n)=>{if(!e)throw new Error(`Set ${n}`);return{url:`?proxy_url=${encodeURIComponent(e)}`,method:"POST",headers:{"Content-Type":"application/json"},body:t,responseHandler:ta}},Ih=(e,t,n)=>{if(!e)throw new Error(`Set ${n}`);return{url:`?proxy_url=${encodeURIComponent(e)}`,method:"POST",body:t,responseHandler:ta}},Tr=r.createApi({reducerPath:"requestPlaneApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({getRequest:e.mutation({query:t=>Ih("https://webhook.latenode.com/5868/prod/5c07527e-9d53-467a-a148-87220d46e9ae",t,"REACT_APP_PIPEDREAM_REQUEST_PLANE_SRC")}),getInvoiceRequest:e.mutation({query:t=>Th("https://webhook.latenode.com/5868/prod/5c07527e-9d53-467a-a148-87220d46e9ae",t,"REACT_APP_REQUEST_PLANE_WEBHOOK_URL")})})}),{useGetRequestMutation:Lb,useGetInvoiceRequestMutation:Mb}=Tr,Ir=r.createApi({reducerPath:"getCheckoutUrlApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({GetCheckoutUrl:e.mutation({query:t=>({url:`?proxy_url=${encodeURIComponent("https://webhook.latenode.com/5868/prod/5072387e-5ace-4ca7-9a25-2f952a7075af")}`,method:"POST",body:t})})})}),{useGetCheckoutUrlMutation:Nb}=Ir,ko=r.createApi({reducerPath:"recoverPasswordApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://app.useblocks.io/api/wp-json/bdpwr/v1/"}),endpoints:()=>({})}),Ar=r.createApi({reducerPath:"addUserToProjectApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/wp-json/user_to_project/v1/add_user"}),endpoints:e=>({addUserToProject:e.mutation({queryFn(t,n){return r.clientFromApi(n).userToProject.add_user_create(t,{type:h.ContentType.FormData})}})})}),{useAddUserToProjectMutation:Db}=Ar,xr=r.createApi({reducerPath:"recurrenceSubscriptionsOffApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({getCanselRecurrence:e.query({query:t=>({url:`?proxy_url=${encodeURIComponent(`https://webhook.latenode.com/5868/prod/38815aec-cb5d-4b40-8dcb-75e7453573a0?subscription_id=${t.sid}&user_id=${t.uid}`)}`})})})}),{useLazyGetCanselRecurrenceQuery:Fb,useGetCanselRecurrenceQuery:Bb}=xr,Pr=r.createApi({reducerPath:"recurrenceSubscriptionsOnApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({getRecurrence:e.query({query:t=>({url:`?proxy_url=${encodeURIComponent(`https://webhook.latenode.com/5868/prod/7ac13d46-e4af-4dea-ab21-aab55415575b?subscription_id=${t.sid}&user_id=${t.uid}`)}`})})})}),{useLazyGetRecurrenceQuery:$b,useGetRecurrenceQuery:Ub}=Pr,Ah="https://app.useblocks.io/api/v2",Rr=r.createApi({reducerPath:"authApi",baseQuery:r.fetchBaseQueryApp({baseUrl:Ah,prepareHeaders:e=>{const t=r.api.get(r.APP_COOKIES.em_token);return t&&!e.has("authorization")&&e.set("authorization",`Bearer ${t}`),e}}),endpoints:e=>({login:e.mutation({query:t=>({url:"/auth/token",method:"POST",body:t})}),register:e.mutation({query:t=>({url:"/auth/register",method:"POST",body:t})}),refreshToken:e.mutation({query:t=>({url:"/auth/token/refresh",method:"POST",body:t})}),logout:e.mutation({query:()=>({url:"/auth/token",method:"DELETE"})}),getUser:e.query({query:()=>"/auth/user",transformResponse:t=>{const n=Array.isArray(t)?t[0]:t;return r.WpUserToUser(n)}}),changePassword:e.mutation({query:t=>({url:"/auth/password/change",method:"POST",body:t})}),resetPassword:e.mutation({query:t=>({url:"/auth/password/reset",method:"POST",body:t})}),resetPasswordConfirm:e.mutation({query:t=>({url:"/auth/password/reset/confirm",method:"POST",body:t})})})}),{useLoginMutation:zb,useRegisterMutation:Gb,useRefreshTokenMutation:Wb,useLogoutMutation:Hb,useGetUserQuery:qb,useLazyGetUserQuery:Vb,useChangePasswordMutation:Kb,useResetPasswordMutation:Yb,useResetPasswordConfirmMutation:Qb}=Rr;function na(e){return{id:e.id??0,name:e.name??"",children:(e.children??[]).map(na)}}function xh(e){return(e?.folders??[]).map(na)}function Ph(e){return{items:(e?.items??[]).flatMap(t=>t.id?[{kind:t.kind??"email",id:t.id,name:t.name??"",title:t.title??"",preheader:t.preheader??"",folderId:t.folder_id??0,hasAmp:t.has_amp??!1,previewImage:t.preview_image??"",updatedAt:t.updated_at??"",imported:t.imported??!1}]:[]),total:e?.total??0}}function Co(e){const t=e.status??"pending";return{id:e.id??"",status:t,outcome:e.outcome,total:e.total??0,imported:e.imported??0,warnings:e.warnings??0,failed:e.failed??0,finished:t==="done"||t==="failed",items:(e.items??[]).map(n=>({kind:n.kind??"email",stripoId:n.stripo_id??0,name:n.name??"",status:n.status??"failed",reason:n.reason,emailId:n.email_id})),createdAt:e.created_at??"",finishedAt:e.finished_at}}function Rh(e){return{selectors:e.map(t=>({kind:t.kind,...t.ids?.length?{ids:t.ids}:{},...t.all?{all:!0}:{},...t.folderId?{folder_id:t.folderId}:{},...t.rootOnly?{root_only:!0}:{},...t.search?{search:t.search}:{}}))}}var To="StripoItems",Io="StripoFolders",jr="StripoImportJob",mn=(e,t)=>{const n=r.v2ResultOf(e);return"error"in n?{error:n.error}:{data:t(n.data)}},Or=r.createApi({reducerPath:"stripoImportApi",tagTypes:[To,Io,jr],baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({saveStripoKey:e.mutation({async queryFn({projectId:t,apiKey:n},o){return mn(await r.getClientV2(h.getContainer(o)).projects.stripoKeyUpdate({id:String(t)},{api_key:n}),()=>{})},invalidatesTags:[To,Io]}),getStripoFolders:e.query({async queryFn({projectId:t,kind:n},o){return mn(await r.getClientV2(h.getContainer(o)).projects.stripoFoldersList({id:String(t),kind:n}),xh)},providesTags:[Io]}),getStripoItems:e.query({async queryFn({projectId:t,kind:n,folderId:o,rootOnly:i,search:s,page:c,limit:d},u){return mn(await r.getClientV2(h.getContainer(u)).projects.stripoItemsList({id:String(t),kind:n,...o?{folder_id:o}:{},...i?{root_only:!0}:{},...s?{search:s}:{},page:c,limit:d}),Ph)},providesTags:[To]}),startStripoImport:e.mutation({async queryFn({projectId:t,selectors:n},o){return mn(await r.getClientV2(h.getContainer(o)).projects.stripoImportsCreate({id:String(t)},Rh(n)),Co)},invalidatesTags:[jr]}),getCurrentStripoImport:e.query({async queryFn(t,n){const o=await r.getClientV2(h.getContainer(n)).projects.stripoImportsCurrentList({id:String(t)});return o.status===204?{data:null}:mn(o,Co)},providesTags:[jr]}),getStripoImport:e.query({async queryFn({projectId:t,jobId:n},o){return mn(await r.getClientV2(h.getContainer(o)).projects.stripoImportsDetail({id:String(t),jobId:n}),Co)},providesTags:[jr]})})}),{useSaveStripoKeyMutation:Xb,useGetStripoFoldersQuery:Jb,useGetStripoItemsQuery:Zb,useLazyGetStripoItemsQuery:e0,useStartStripoImportMutation:t0,useGetCurrentStripoImportQuery:n0,useGetStripoImportQuery:r0}=Or,jh=r.createState({activeGroupsTags:[],activeProjectGroupsTags:[],groupsTemplateTotal:null,groupsTemplateProjectTotalPages:null,groupsTemplateProjectTotal:null}),Oh="projectSlice",Ao=r.createSlice({name:Oh,initialState:jh,reducers:{setActiveGroupsTags:(e,{payload:t})=>{e.activeGroupsTags=t,t.length&&(e.activeProjectGroupsTags=[])},setActiveProjectGroupsTags:(e,{payload:t})=>{e.activeProjectGroupsTags=t,t.length&&(e.activeGroupsTags=[])},resetAllTags:e=>{e.activeProjectGroupsTags=[],e.activeGroupsTags=[]}},extraReducers:e=>{e.addMatcher(r.emailsApi.endpoints.getTemplateEmails.matchFulfilled,(t,{payload:n,meta:o})=>{const{projectId:i}=o.arg.originalArgs;i?(t.groupsTemplateProjectTotal=+o.baseQueryMeta?.response.headers.get("X-WP-Total"),t.groupsTemplateProjectTotalPages=+o.baseQueryMeta?.response.headers.get("X-WP-TotalPages")):t.groupsTemplateTotal=+o.baseQueryMeta?.response.headers.get("X-WP-Total")})}}),{setActiveGroupsTags:o0,setActiveProjectGroupsTags:i0,resetAllTags:s0}=Ao.actions,Lh=r.createState({emailsTotal:0,elementsList:[],emailsTrashTotal:0,elementsTrashList:[],customFolders:{},elementsView:r.CARDS}),Mh="emailsPageSlice";function Nh(e){const t=e?.baseQueryMeta?.response;return Number(t?.headers?.get("X-WP-Total"))||0}function ra(e,t){const{emails:n,total:o,isSearch:i,page:s,tagOrFolderId:c}=t;if(t.status==="trash")!i&&o!==void 0&&(e.emailsTrashTotal=o),e.elementsTrashList=n;else if(c){const d=e.customFolders[c];e.customFolders={...e.customFolders,[c]:{list:n,page:s,total:o??d?.total??0}}}else o!==void 0&&(e.emailsTotal=o),e.elementsList=n}var xo=r.createSlice({name:Mh,initialState:Lh,reducers:{resetElementsList:e=>{e.elementsList=[]},syncElementsList:(e,{payload:t})=>{ra(e,t)},toggleElementsView:(e,t)=>{e.elementsView=t.payload},removeEmailFromList:(e,{payload:t})=>{const n=e.customFolders;t.folder!=="all"&&n[t.folder]?.list&&(n[t.folder]={...n[t.folder],list:n[t.folder].list.filter(o=>o.id!==t.emailId),total:n[t.folder].total-1},e.customFolders=n)}},extraReducers:e=>{e.addMatcher(r.emailsApi.endpoints.getEmails.matchFulfilled,(t,{meta:n,payload:o})=>{const i=n.arg.originalArgs;ra(t,{emails:o,total:Nh(n),status:i?.status,page:i?.page,isSearch:!!i?.name?.length,tagOrFolderId:i?.folderTag||i?.tags?.[0]})}),e.addMatcher(r.emailsApi.endpoints.getTemplateEmails.matchFulfilled,(t,{meta:n,payload:o})=>{const i=+n.baseQueryMeta?.response.headers.get("X-WP-Total")||0;t.elementsList=o,t.emailsTotal=i;const{projectGroup:s,projectId:c,tags:d}=n.arg.originalArgs;(s?.length&&c||d?.length||!d?.length&&!s?.length)&&(t.emailsTotal=i)}),e.addMatcher(r.emailsApi.endpoints.editEmail.matchFulfilled,(t,{payload:n})=>{t.elementsList.map(o=>o.id?.toString()===n.id?.toString()?Object.assign(o,{lock:n.lock,title:n.title,emailtags:n.emailtags}):o)})}}),{toggleElementsView:a0,resetElementsList:l0,syncElementsList:c0,removeEmailFromList:d0}=xo.actions,oa=r.combineReducers({[r.di.reducerPath]:r.di.reducer,[r.AiApi.reducerPath]:r.AiApi.reducer,[r.userSlice.name]:r.userSlice.reducer,[r.emailSlice.name]:r.emailSlice.reducer,[r.blockSlice.name]:r.blockSlice.reducer,[r.imageApi.reducerPath]:r.imageApi.reducer,[An.reducerPath]:An.reducer,[hr.reducerPath]:hr.reducer,[Ao.name]:Ao.reducer,[r.blocksApi.reducerPath]:r.blocksApi.reducer,[r.emailsApi.reducerPath]:r.emailsApi.reducer,[fr.reducerPath]:fr.reducer,[Xn.reducerPath]:Xn.reducer,[Jn.reducerPath]:Jn.reducer,[Zn.reducerPath]:Zn.reducer,[er.reducerPath]:er.reducer,[tr.reducerPath]:tr.reducer,[nr.reducerPath]:nr.reducer,[rr.reducerPath]:rr.reducer,[or.reducerPath]:or.reducer,[ir.reducerPath]:ir.reducer,[sr.reducerPath]:sr.reducer,[ar.reducerPath]:ar.reducer,[lr.reducerPath]:lr.reducer,[cr.reducerPath]:cr.reducer,[dr.reducerPath]:dr.reducer,[ur.reducerPath]:ur.reducer,[pr.reducerPath]:pr.reducer,[r.emailPageSlice.name]:r.emailPageSlice.reducer,[r.projectsApi.reducerPath]:r.projectsApi.reducer,[Pn.reducerPath]:Pn.reducer,[Qt.reducerPath]:Qt.reducer,[Rn.reducerPath]:Rn.reducer,[Er.reducerPath]:Er.reducer,[r.saveFileApi.reducerPath]:r.saveFileApi.reducer,[Sr.reducerPath]:Sr.reducer,[r.commentsApi.reducerPath]:r.commentsApi.reducer,[r.optimiseApi.reducerPath]:r.optimiseApi.reducer,[io.name]:io.reducer,[xo.name]:xo.reducer,[mr.reducerPath]:mr.reducer,[Cr.reducerPath]:Cr.reducer,[wr.reducerPath]:wr.reducer,[kr.reducerPath]:kr.reducer,[r.taxonomiesApi.reducerPath]:r.taxonomiesApi.reducer,[r.projectsPageSlice.name]:r.projectsPageSlice.reducer,[r.AiApiGenerator.reducerPath]:r.AiApiGenerator.reducer,[Tr.reducerPath]:Tr.reducer,[gr.reducerPath]:gr.reducer,[yr.reducerPath]:yr.reducer,[Gn.reducerPath]:Gn.reducer,[r.authorizationApi.reducerPath]:r.authorizationApi.reducer,[r.limitsApi.reducerPath]:r.limitsApi.reducer,[r.revisionHistorySlice.name]:r.revisionHistorySlice.reducer,[Ir.reducerPath]:Ir.reducer,[r.defaultModePanesSlice.name]:r.defaultModePanesSlice.reducer,[ko.reducerPath]:ko.reducer,[Ar.reducerPath]:Ar.reducer,[_r.reducerPath]:_r.reducer,[Pr.reducerPath]:Pr.reducer,[xr.reducerPath]:xr.reducer,[Rr.reducerPath]:Rr.reducer,[r.projectSettingsV2Api.reducerPath]:r.projectSettingsV2Api.reducer,[Or.reducerPath]:Or.reducer}),Dh=(e,t)=>t.type==="authorizationApi/resetApiState"?oa({[r.reducerPath]:e[r.reducerPath]},t):oa(e,t),ia=[r.AiApi,r.imageApi,hr,r.emailsApi,An,r.blocksApi,fr,Xn,Jn,Zn,er,tr,nr,rr,or,ir,sr,ar,lr,cr,dr,ur,pr,Sr,r.projectsApi,Pn,Qt,Rn,Er,r.commentsApi,r.optimiseApi,r.saveFileApi,mr,Cr,r.taxonomiesApi,wr,kr,r.AiApiGenerator,Tr,r.authorizationApi,r.limitsApi,gr,yr,Gn,Ir,ko,Rr,r.projectSettingsV2Api,Or,Ar,_r,Pr,xr];function Fh(e){let t={};if(e){const o=h.createIdentifier$1();h.DependencyResolver.inject(o,e),t={INJECTION:o}}const n=r.configureStore({reducer:Dh,middleware:o=>o({serializableCheck:!1}).concat(ia.map(i=>i.middleware)),preloadedState:t});return r.setupListeners(n.dispatch),n}var sa=h.createIdentifier$1("RtkApiRegistry");function Bh(e,t){e.inject(sa,new Map(t.map(n=>[n.reducerPath,n])))}function at(e,t){const n=e?.getInstance(sa)?.get(t);if(!n)throw new Error(`RTK api "${t}" is not in the container registry (provideRtkApiRegistry did not run)`);return n}function $h(e,t){let n={isCodeMode:void 0,direction:void 0};return r.provideCodeMode(e).watch(o=>{n.isCodeMode!==o.isCodeMode&&t.dispatch(r.setCodeMode(o.isCodeMode)),n.direction!==o.direction&&t.dispatch(r.switchCodeModeDirection(o.direction)),n={isCodeMode:o.isCodeMode,direction:o.direction}})}function Uh(e,t){const n=r.provideCurrentUser(e),o=r.authorizationApi.endpoints.getMe.select("");let i=n.get()?.profile;const s=()=>{const c=o(t.getState()).data;!c||c===i||(i=c,n.set({profile:c}))};return s(),{dispose:t.subscribe(s)}}var zh=h.createIdentifier$1("EmailSettingsPort");function Gh(e,t){e.inject(zh,{read:()=>r.selectEmailSettings(t.getState())??{},write:n=>{t.dispatch(r.setEmailSettings(n))},markAppearanceChanged:()=>{t.dispatch(r.markAppearanceNeedsUpdate())}})}var Wh="Invalid standaloneKey.",Hh="not implemented",u0=1,qh=h.createIdentifier$1("StandaloneMockGuard");function Po(){const e=new Error(Wh);return e.name="InvalidStandaloneKeyError",e}function Ro(e){return r.isStandaloneRuntime(h.getContainer(e))}function Vh(e){return e instanceof Error?e.name==="InvalidStandaloneKeyError"||e.message==="Invalid standaloneKey."||e.message==="not implemented":e===Hh}function aa(e){if(Ro(e))throw Po()}function Kh(e,t,n){return n instanceof Error&&n.name==="InvalidStandaloneKeyError"?n:Po()}var Yh=()=>()=>{throw Po()};function Qh(e){if(!e)throw new Error("DI container not found for standalone mock guard");e.inject(qh,1)}function Xh(e){return typeof e!="function"}var p0="[plugin-api-mock]";function la(){return!0}function Jh(e){try{if(e===null||typeof e!="object")return e;const t={};for(const n of Object.keys(e).slice(0,12)){const o=e[n];t[n]=typeof o=="string"&&o.length>120?`${o.slice(0,120)}…(${o.length})`:o}return t}catch{return"(unserializable arg)"}}function Zh(e,t){return n=>{const o=n.query,i=n.queryFn||((s,c,d,u)=>{if(!o)throw new Error("query not found EndpointDefinition");return u(o(s))});i&&(n.query=void 0,n.queryFn=async(s,c,d,u)=>{try{let p;const f=h.getContainer(c).getServices(e);for(let g=f.length-1;g>=0;g--){const y=f[g];if(p=p?await p(async m=>await y.execute(m),c):await y.execute(s),Xh(p))return{data:p,error:null}}if(p)p=await p(async(g,y=c,m=d,E=u)=>{aa(c);const k=await i(g,y,m,E);if(k.error)throw k.error;return k.data},c);else{aa(c),la();const g=await i(s,c,d,u);if(g.error)throw g.error;p=g.data}return{data:p,error:null}}catch(p){return Ro(c)&&Vh(p)?{error:Kh(t,Jh(s),p)}:(la(),{error:p})}})}}var ca=new Set;function it(e){return(t,n)=>{const o=Object.create(null),i=Object.keys(n),s=new h.Disposable;for(const c of i){const d=`api_listeners_flag_${t.reducerPath}/${c.toString()}`,u=h.createIdentifier$1(`api_listeners_${t.reducerPath}/${c.toString()}`);ca.has(d)||(o[c]=Zh(u,`${t.reducerPath}/${c.toString()}`),ca.add(d)),s.addDisposable(e.addService(u,{execute:n[c]}))}return Object.keys(o).length&&t.enhanceEndpoints({endpoints:o}),r.getDisposable(e).addDisposable(s),s}}function da(e,t){for(const n of Object.keys(t))try{t[n](e)}catch{}}function m0(e){return e}function ua(e,t){return e({body:t}).catch(()=>new Promise(n=>setTimeout(n,1e3)))}function e_(e){it(e)(at(e,"AiApi"),{sendMessage:({body:t})=>async(n,o)=>{const i=r.getEmitter(e,h.events.AI_TEXT_REQUEST_ID);if(!i.hasListeners())return ua(n,t);const s=t,c={message:s.message??s.context,locale:s.locale,entityId:s.entity_id,projectId:s.project_id!=null?String(s.project_id):void 0,subject:s.subject,preheader:s.preheader,textContent:s.textContent,context:s.context??s.connection,connection:s.connection,onProgress:(d,u)=>{r.getEmitter(e,h.events.AI_TEXT_PROGRESS_ID).fire({progress:Number.isFinite(d)?d:0,status:typeof u=="string"?u:void 0})},onStreamChunk:d=>{typeof d!="string"||!d||r.getEmitter(e,h.events.AI_TEXT_STREAM_ID).fire({partialHtml:d})},signal:o.signal};for(const d of i.getListeners([c])){const u=await d(c);if(u)return{status:200,_eventResult:!0,aiMessage:typeof u.message=="string"?u.message:"",aiHtml:typeof u.html=="string"?u.html:void 0}}return ua(n,t)},getDialog:t=>(n,o)=>Ro(o)?Promise.resolve({documents:[],totalCount:0}):n(t)})}function t_(e){const t=it(e),n=r.getEmitter(e,h.events.FILE_PROXY_EVENT_ID);t(at(e,"proxyApi"),{async getFile({url:o,tryFetch:i=!0,type:s}){return async c=>{const{requested:d}=r.getCurrentProject(e),u=(await n.fire({url:o,project:d})).filter(p=>p instanceof Blob)[0];if(u)switch(s){case"json":return JSON.parse(await u.text());case"text":return u.text();default:return u}else return c({url:o,tryFetch:i,type:s})}}})}function n_(e){it(e)(at(e,"tokenApi"),{tokenCreate(t){return n=>n(t)},tokenValidate(){return t=>t({})}})}function f0(e){return e}function r_(e){it(e)(at(e,"imageApi"),{sendAiImageRequest:function({body:t}){return async(n,o)=>{const i=r.getEmitter(e,h.events.AI_IMAGE_REQUEST_ID);if(!i.hasListeners()||t.request!=="create-image")return n({body:t});const s={prompt:t.message??"",size:t.size,entityId:t.entity_id,projectId:t.project_id!=null?String(t.project_id):void 0,onProgress:(c,d)=>{r.getEmitter(e,h.events.AI_IMAGE_PROGRESS_ID).fire({progress:Number.isFinite(c)?c:0,status:typeof d=="string"?d:void 0})},signal:o.signal};for(const c of i.getListeners([s])){const d=await c(s);if(d&&d.images?.length)return{data:{status:200,_eventResult:!0,task:{images:d.images}}}}return n({body:t})}},getAiImage(t){return n=>n(t)}})}async function pa(e,t,n,o,i){try{const s=(await e.fire({project:String(t),emailId:n})).filter(c=>c!=null);if(s.length)return s.flat()}catch{}return o(i)}function o_(e){const t=it(e),n=at(e,"blocksApi"),o=r.blocksDataSourceProvider(e),i=o.byForeignKey("project"),s=r.blockRevisionsDataSourceProvider(e);s.byForeignKey("parent");const{dispatch:c}=r.getStore(e),d=r.getDisposable(e);d.addDisposable(o.onChange(()=>c(n.util.invalidateTags(["Blocks"])))),d.addDisposable(o.onSave(({prev:f,patch:g,value:y})=>{const m=f?{...f,...g}:g;let E=r.mergeEntityPreservingMeta(f,g,y);return m&&E.html===m.html&&E.title===m.title&&(E={...E,renderGuid:m.renderGuid}),E},Number.MIN_VALUE));const u=r.getEmitter(e,r.READ_COMMON_BLOCKS_EVENT_ID),p=r.getEmitter(e,r.READ_TEMPLATE_BLOCKS_EVENT_ID);t(n,{async getBlocks(f){const g={};f.name&&(g.title=f.name),f.type&&(g.type=f.type);const y=f.projectId??await r.getBlocksProject(e);return await i.get(y,{filter:g,page:f.page,pageSize:f.pageSize,order:f.order,orderBy:f.orderby}).then(({data:m})=>m)},getBlocksSchema(){return f=>f(void 0)},getParentEmailBlocks(f){return async g=>{const y=r.getCurrentProject(e).requested||"";return pa(p,y,f.emailId||"",g,f)}},getTemplateBlocks(f){return async g=>{const y=r.getCurrentProject(e).requested||"";return pa(u,y,f.emailId||"",g,f)}},async getBlock(f){const g=r.getCurrentProject(e).card?.id;if(g!==void 0)return i.first(Number(g),{filter:{id:f}})},addBlock(f){return async g=>{const y=await o.create(f);return r.getAppConfig(e).preventSendDataToEM||g(y).catch(m=>{}),y}},editBlock({blockId:f,...g}){return o.update(f,g)},deleteBlock(f){return o.remove(typeof f=="object"?f.id:f)},addTag(f){return f},getDeletableTag([f,g]){return[]},autoSaveBlock({blockId:f,body:g}){return s.create({...g,parent:f})}})}function i_(e){const{emails:t,emailRevisions:n}=r.provideEmailDocuments(e),{dispatch:o}=r.getStore(e),i=r.getDisposable(e),s=it(e),c=at(e,"emailsApi");i.addDisposable(t.onChange(async()=>{o(c.util.invalidateTags(["Email"]))})),s(c,{getEmails:d=>[],getTemplateEmails:d=>[],async addEmail({source:d,...u}){const p=await t.create(u,{source:d});return p.renderGuid||(p.renderGuid=h.generateUUID()),p},editEmail(d){return async u=>{const{emailId:p,source:f,...g}=d;return r.isRevisionServiceEnabled(e)&&await u(d),t.update(p,g,{source:f})}},deleteEmail(d){return t.remove(typeof d=="object"?d.id:d)},addTag(){throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},getDeletableTag([d,u]){return[]},autoSaveEmail({emailId:d,body:u}){return async p=>{r.isRevisionServiceEnabled(e)&&await p({emailId:d,body:u});const f=await n.create({...u,parent:d,modified:new Date().toString()});return f&&!f.html&&u.html?{...f,html:u.html}:f}}})}var s_="tmp",g0=h.createIdentifier$1();function a_(e){const t=it(e);if(!e.getInstance(h.DISPOSABLE_ID))throw new Error("Something was wrong");const n=r.getEmitter(e,h.events.UPLOAD_EVENT_ID),o=r.getEmitter(e,h.events.ON_SEND_TESTEMAIL_ID),i=r.getEmitter(e,h.events.ON_SEND_LIVEPREVIEW_ID);t(at(e,"saveFileApi"),{uploadImage(s){return async c=>{const{requested:d}=r.getCurrentProject(e),u=async()=>c({...s,user_id:String((await e.getInstanceAsync(h.APP_ID)).app_id)});if(s.folder===s_)return u();const p=await r.fireUploadImageEvent(n,{file:s.file,project:d});if(p.url)return[{file_url:p.url,project:d}];if(!r.shouldFallbackToBuiltInUpload(p,{isStandalone:r.isStandaloneRuntime(e)}))throw r.toUploadImageError(p);return u()}},sendTestEmail(s){return async c=>{const{requested:d}=r.getCurrentProject(e);(await o.fire({project:d,email_id:s.email_id,subject:s.subject,email:s.email,html:s.html,from_name:s.from_name})).some(u=>u===!1)&&await c({...s,user_id:String((await e.getInstanceAsync(h.APP_ID)).app_id)})}},async sendLivePreview(s){const{requested:c}=r.getCurrentProject(e);(await i.fire({project:c,id:s.email,subject:s.subject,html:s.content})).some(d=>d===!1)},sendShortLink(s){return c=>c(s)}})}function l_(e){it(e)(at(e,"emailRawApi"),{getEmailRaw({emailId:t,secret_hash:n}){throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)}})}function Kt(e,t){for(var n=e<0?"-":"",o=Math.abs(e).toString();o.length<t;)o="0"+o;return n+o}function c_(e,t){var n,o;r.requiredArgs(1,arguments);var i=Ll(e);if(isNaN(i.getTime()))throw new RangeError("Invalid time value");var s=String((n=t?.format)!==null&&n!==void 0?n:"extended"),c=String((o=t?.representation)!==null&&o!==void 0?o:"complete");if(s!=="extended"&&s!=="basic")throw new RangeError("format must be 'extended' or 'basic'");if(c!=="date"&&c!=="time"&&c!=="complete")throw new RangeError("representation must be 'date', 'time', or 'complete'");var d="",u="",p=s==="extended"?"-":"",f=s==="extended"?":":"";if(c!=="time"){var g=Kt(i.getDate(),2),y=Kt(i.getMonth()+1,2),m=Kt(i.getFullYear(),4);d="".concat(m).concat(p).concat(y).concat(p).concat(g)}if(c!=="date"){var E=i.getTimezoneOffset();if(E!==0){var k=Math.abs(E),w=Kt(Math.floor(k/60),2),v=Kt(k%60,2),x=E<0?"+":"-";u="".concat(x).concat(w,":").concat(v)}else u="Z";var P=Kt(i.getHours(),2),K=Kt(i.getMinutes(),2),J=Kt(i.getSeconds(),2),N=d===""?"":"T",L=[P,K,J].join(f);d="".concat(d).concat(N).concat(L).concat(u)}return d}function d_(e){const t=it(e),n=at(e,"commentsApi"),o=r.commentsDataSourceProvider(e),i=o.byForeignKey("post"),{dispatch:s}=r.getStore(e);r.getDisposable(e).addDisposable(o.onChange(()=>s(n.util.invalidateTags(["Comments"])))),t(n,{getComments(c){return i.get(c).then(({data:d})=>d)},addComment({subjectId:c,author:d,parent:u,content:p,author_name:f,author_email:g,targetId:y}){const m={post:c,author:d,author_name:f,author_email:g,content:p,parent:u,target_id:y,date:c_(new Date),author_avatar_urls:{}};return o.create(m)},deleteComment(c){return o.remove(c)},editComment({commentId:c,...d}){return o.update(c,d)},deleteTarget(c){return o.update(c,{target_id:""})}})}function jo(e){return{id:String(e),name:"",myRole:"",members:[],invites:[],emailsCount:0,blocksCount:0,title:"",group:[],folder:[],blockfolder:[]}}function ma(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function u_(e,t){const n=jo(String(t)),o=r.getCurrentProject(e).card;return o&&String(o.id)===String(t)?Promise.resolve({...n,...o,id:String(t)}):Promise.resolve({...n,id:String(t)})}function p_(e){let t,n;const o=i=>((t!==i||!n)&&(t=i,n=u_(e,i)),n);it(e)(at(e,"projectsApi"),{getProjects(i={page:1}){return[]},getProject(i){return async s=>r.isStandaloneRuntime(e)?s(i):{...await o(i),id:String(i)}},addProject(i){throw new Error},async editProject({projectId:i,...s}){const c={...await o(i),...s,id:String(i)};return t=i,n=Promise.resolve(c),c},deleteProject(i){throw new Error},mutateProjectMembers(){throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},addProjectMember(){throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},getFrequentProjects(){return[]}})}function m_(e){let t={id:"0",username:"",email:"",password:"",code_editor:{},theme:"light",locale:r.getCurrentUser(e).profile?.locale,counters:{},avatar_urls:{},autosaves:!0};it(e)(at(e,"authorizationApi"),{getSchema:()=>n=>n({}),getMe:()=>t,editMe:n=>t={...t,...n},getSubscriptions:()=>[]})}function f_(e){it(e)(at(e,"notificationsApi"),{getNotifications(t){return[]},notificationShown({id:t,datetime:n}){throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)}})}function g_(e){it(e)(at(e,"addUserToProjectApi"),{addUserToProject:()=>{}})}function h_(e){r.injectEmailTermsResolver(e,{resolve:async()=>{}}),it(e)(at(e,"taxonomiesApi"),{getTerms:()=>[],getStandardGroups:()=>[],addTerm:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},editTerm:t=>({id:t.id,name:t.name,parent:0,count:0}),deleteTerm:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)}})}function __(e){it(e)(at(e,"projectSettingsV2Api"),{getProjectIntegrations:()=>({}),getProjectWebhook:()=>"",getProjectStorage:()=>({}),getProjectTestRecipients:()=>[],getIntegrationCredentials:()=>({}),putProjectIntegration:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},deleteProjectIntegration:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},putProjectWebhook:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},putProjectSettings:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},putProjectTestRecipients:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)}})}function y_(e){it(e)(at(e,"stripoImportApi"),{getStripoFolders:()=>[],getStripoItems:()=>({items:[],total:0}),getCurrentStripoImport:()=>null,getStripoImport:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},saveStripoKey:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},startStripoImport:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)}})}var fa={addUserToProjectApiMock:g_,AiApiMock:e_,authorizationApiMock:m_,blocksApiMock:o_,commentsApiMock:d_,emailsApiMock:i_,emailRawApiMock:l_,imageApiMock:r_,notificationsApiMock:f_,projectsApiMock:p_,projectSettingsV2ApiMock:__,proxyApiMock:t_,saveFileApiMock:a_,stripoImportApiMock:y_,taxonomiesApiMock:h_,tokenApiMock:n_},Oo=r.createApi({reducerPath:"tokenApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/wp-json/jwt-auth/v1/"}),endpoints:e=>({tokenCreate:e.mutation({queryFn(t,n){return r.clientFromApi(n).jwtAuth.token_create({body:t,type:h.ContentType.Json})}}),tokenValidate:e.mutation({queryFn(t,n){return r.clientFromApi(n).jwtAuth.token_validate_create({type:h.ContentType.Json})}})})}),{useTokenCreateMutation:h0,useTokenValidateMutation:_0}=Oo;function Lo(){const e=new Map;for(const t of ia)e.set(t.reducerPath,t);return e.set(Oo.reducerPath,Oo),[...e.values()]}function v_(e,t){const n=Object.keys(t.endpoints);n.length&&e(t,Object.fromEntries(n.map(o=>[o,Yh])))}function b_(e){Qh(e);const t=it(e);for(const n of Lo())v_(t,n)}function E_(e){if(!e)return;const t=h.decodeJwt(e)?.data,n=t?.data?.scope??t?.scope;return(Array.isArray(n)?n.flatMap(o=>typeof o=="string"?o.split(/\s+/):[]):typeof n=="string"?n.split(/\s+/):[]).find(o=>/^project_\d+$/.test(o))?.replace(/^project_/,"")||void 0}var S_={AiApi:new Set(["sendMessage","getDialog"]),imageApi:new Set(["sendAiImageRequest","getAiImage","getAiImageSSE"])};function w_(e){return r.getAppConfig(h.getContainer(e))}function k_(e){return e?.backendProxy!==void 0&&e?.backendProxyPolicy?.proxyAi===!0}function C_(e){return k_(w_(e))}function T_(e,t,n,o){return S_[t]?.has(n)?i=>C_(e)?s=>s(i):o(i):o}function I_(e){const t=it(e);return((n,o)=>{if(!n||typeof n.reducerPath!="string")return new h.Disposable;const i=Object.fromEntries(Object.entries(o??{}).map(([s,c])=>[s,typeof c=="function"?T_(e,n.reducerPath,s,c):c]));return t(n,i)})}function A_(e){const t=`blocks_${h.generateUUID().replaceAll("-","")}`,n=document.createElement("script");return n.type="text/javascript",n.text=`window.${t}(function(module, exports, require) { ${e}; })`,new Promise((o,i)=>{window[t]=function(s){const c={exports:{}},d=()=>{};s(c,c.exports,d),o(c.exports)},document.head.appendChild(n)}).finally(()=>{n.remove(),delete window[t]})}async function ga(e){const t=h.getContainer(e),n=t?.getInstance(h.STANDALONE_PROJECT_ID),o=n?void 0:await t?.getInstanceAsync(h.APP_ID).catch(()=>{}),i=n||(o?.project!==void 0?String(o.project):void 0);i&&t&&r.setCurrentProjectCard(t,jo(i))}async function x_(e,t){try{const n=function(d){const u=e.getInstance(h.STANDALONE_PROJECT_ID),p=u?ma(u,d):d;e.injectFactory(h.APP_ID,async()=>p)},o=I_(e),i=await r.readZipFromBase64(t),s=i.key&&r.zipEntryToText(i.key);if(typeof s!="string")return;const c=await A_(s);if(typeof c!="object"||c===null||typeof c.execute!="function")return;c.execute(n,o,Lo())}catch{}}async function ha(e,t){b_(h.getContainer(e)),await x_(h.getContainer(e),t),da(h.getContainer(e),fa)}var P_=zn(async e=>{const t=Fh(e);e.inject(h.STORE_ID,t),Bh(e,Lo()),Gh(e,t),r.getDisposable(e).addDisposable(Uh(e,t)),r.getDisposable(e).addDisposable($h(e,t));const n=h.getContainer(t);n&&(e.inject(h.MESSAGE_SERVICE_ID,r.getMessageService(n)),e.inject(r.CURRENT_PROJECT_ID,r.provideCurrentProject(n)));const o=e.getInstance(h.SECURITY_MODULE_ID);return o?(await ha(t,o),await ga(t)):da(h.getContainer(t),fa),{instance:{}}}),_a=["historyEnabled","commentsEnabled","aiAssistentEnabled","livePreviewEnabled","sendTestEnabled","sharePreviewEnabled","webversionEnabled","optimizeSpamAssassinEnabled","exportWebHookEnabled","aiLayoutConverterEnabled","elementAIimageEnabled","elementAItextEnabled","revisionService"];function R_(e){const t={...e};for(const n of _a)t[n]=!1;return t}function j_(e){const t={...e};for(const n of _a)n in t&&typeof t[n]=="boolean"&&(t[n]=!1);return t}function O_(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,o]of Object.entries(e))!o||typeof o!="object"||Array.isArray(o)||(t[n]=j_(o));return Object.keys(t).length>0?t:void 0}function Mo(e){const t=R_(e),n=O_(e.advancedConfigs),o={...t};return n?o.advancedConfigs=n:delete o.advancedConfigs,o}var y0=1,L_=2592e6;function ya(){return"useblocks".trim()||void 0}function M_(e){return{schemaVersion:1,savedAt:Date.now(),project:e.project,app_id:e.app_id,app_config:Mo(ba(e.app_config))}}function va(e){return{...e,app_config:ba(e.app_config)}}function ba(e){if(!e||typeof e!="object"||Array.isArray(e))return{};try{if(typeof structuredClone=="function")return structuredClone(e)}catch{}try{return JSON.parse(JSON.stringify(e))}catch{return{}}}async function N_(e){const t=ya();t&&await G_(t,M_(e))}async function D_(e=Date.now()){const t=ya();if(t)return W_(t,e)}function F_(e,t=Date.now()){return e.savedAt>t?!1:t-e.savedAt<=L_}function Ea(e){if(!e||typeof e!="object")return!1;const t=e,n=typeof t.project=="number"&&Number.isFinite(t.project)||typeof t.project=="string"&&t.project.trim()!=="";return t.schemaVersion===1&&typeof t.savedAt=="number"&&Number.isFinite(t.savedAt)&&n&&typeof t.app_id=="number"&&Number.isFinite(t.app_id)&&t.app_config!=null&&typeof t.app_config=="object"&&!Array.isArray(t.app_config)}var jt="snapshots",B_=1;function $_(){return`${"useblocks".trim()||"plugin"}-plugin-deferred-config`}function Lr(){return new Promise((e,t)=>{if(typeof indexedDB>"u"){t(new Error("indexedDB is not available"));return}const n=indexedDB.open($_(),B_);n.onerror=()=>t(n.error||new Error("indexedDB open failed")),n.onupgradeneeded=()=>{const o=n.result;o.objectStoreNames.contains(jt)||o.createObjectStore(jt)},n.onsuccess=()=>e(n.result)})}function U_(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error||new Error("indexedDB request failed"))})}function z_(){return{async get(e){const t=await Lr();try{const n=await U_(t.transaction(jt,"readonly").objectStore(jt).get(e));return n===void 0?void 0:n}finally{t.close()}},async put(e,t){const n=await Lr();try{const o=n.transaction(jt,"readwrite");o.objectStore(jt).put(t,e),await new Promise((i,s)=>{o.oncomplete=()=>i(),o.onerror=()=>s(o.error||new Error("indexedDB write failed")),o.onabort=()=>s(o.error||new Error("indexedDB write aborted"))})}finally{n.close()}},async delete(e){const t=await Lr();try{const n=t.transaction(jt,"readwrite");n.objectStore(jt).delete(e),await new Promise((o,i)=>{n.oncomplete=()=>o(),n.onerror=()=>i(n.error||new Error("indexedDB delete failed")),n.onabort=()=>i(n.error||new Error("indexedDB delete aborted"))})}finally{t.close()}},async clear(){const e=await Lr();try{const t=e.transaction(jt,"readwrite");t.objectStore(jt).clear(),await new Promise((n,o)=>{t.oncomplete=()=>n(),t.onerror=()=>o(t.error||new Error("indexedDB clear failed")),t.onabort=()=>o(t.error||new Error("indexedDB clear aborted"))})}finally{e.close()}}}}var Sa,No;function Do(){return Sa||(No||(No=z_()),No)}function wa(e){Do().delete(e).catch(()=>{})}async function G_(e,t){if(Ea(t))try{await Do().put(e,va(t))}catch{}}async function W_(e,t=Date.now()){try{const n=await Do().get(e);if(n===void 0)return;if(!Ea(n)){wa(e);return}if(!F_(n,t)){wa(e);return}return va(n)}catch{return}}function H_(e,t){if(e.getInstance(h.STANDALONE_FILE_PROXY_REGISTERED_ID))return;e.inject(h.STANDALONE_FILE_PROXY_REGISTERED_ID,!0);const n=h.getEvent(e,h.events.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:o})=>(await fetch(o)).blob(),Number.MIN_VALUE))}function ka(e){try{return E_(e)||void 0}catch{return}}async function q_(e,t,n){if(!e)return;let o;try{const i=await e(t,n,void 0);o=String(i||"").trim()}catch{return}if(o)return{token:o,serverProjectId:ka(o)}}function V_(e){if(e==null)return;const t=String(e).trim();return/^\d+$/.test(t)?t:void 0}function K_(e){const t=String(e.getInstance(h.JWT_TOKEN_ID)||"").trim();if(t)return ka(t)}function Ca(e,t,n){e.inject(h.APP_ID,void 0),e.inject(h.APP_ID,Promise.resolve(ma(t,n)))}function Y_(e){return{app_id:e.app_id,app_config:Mo(e.app_config)}}async function Ta(){const e=await D_();return e?Y_(e):{app_config:Mo({})}}function Q_(e,t){e.getInstance(h.STANDALONE_ACTIVATED_ID)||(e.inject(h.SECURITY_MODULE_ID,void 0),e.inject(h.STANDALONE_BOOTSTRAP_TOKEN_ID,void 0),e.inject(h.STANDALONE_PROJECT_ID,void 0),t&&e.inject(h.APP_ID,void 0),e.inject(h.STANDALONE_FILE_PROXY_REGISTERED_ID,void 0))}async function Ia(e){const{container:t,store:n,standaloneKey:o,project:i,reason:s,getAuthToken:c,user:d}=e,u=e.disposable||t.getInstance(h.DISPOSABLE_ID);if(t.getInstance(h.STANDALONE_ACTIVATED_ID))return;const p=await q_(c,d,i),f=V_(i),g=p?.serverProjectId??K_(t)??(p?void 0:f);t.inject(h.SECURITY_MODULE_ID,o);let y=!1;try{if(p&&(t.inject(h.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(p.token)),c&&h.recreateTokenProvider(t,c,d,i)),g){const m=await Ta();t.inject(h.STANDALONE_PROJECT_ID,g),Ca(t,g,m),y=!0,r.setCurrentProjectCard(t,jo(g))}if(await ha(n,o),y=!0,!g){await ga(n);const m=t.getInstance(h.STANDALONE_PROJECT_ID);if(m)Ca(t,m,await Ta()),y=!0;else if(t.getInstance(h.APP_ID)!==void 0)try{(await t.getInstanceAsync(h.APP_ID))?.project==null}catch{}}u&&H_(t,u),t.inject(h.STANDALONE_ACTIVATED_ID,!0)}catch(m){throw Q_(t,y),m}}async function X_(e,t,n,o){const i=o?.attemptTimeout??h.isFailoverEnabled(n),s=h.isFailoverEnabled(n)?h.getOrderedOriginCandidates(n):h.getOriginChain(n).length>0?[h.getActiveBaseUrl(n)]:[];if(s.length===0)throw new Error("[apiOriginFailover] no API base URL configured");const c=e.startsWith("/")?e:`/${e}`;let d,u;for(let p=0;p<s.length;p++){const f=s[p],g=p===s.length-1,y=i?h.beginFailoverAttempt(t.signal):void 0;try{const m=await fetch(`${f}${c}`,{...t,...y?{signal:y.signal}:{}});if(!m.ok&&h.shouldFailoverResponse(m.status)){if(d=m,!g){h.reportOriginFailure(f,n);continue}break}return m.ok&&h.reportOriginSuccess(f,n),m}catch(m){const E=y?.timeoutError();if(!E&&!h.shouldFailoverError(m))throw m;u=E||m,g||h.reportOriginFailure(f,n)}finally{y?.done()}}if(h.isFailoverEnabled(n)&&h.abandonStickyOrigin(),d)return d;throw u instanceof Error?u:new Error("[apiOriginFailover] fetch chain failed")}function J_(e,t){const n=String(t.baseUrl||"").trim();if(n)return h.resolveExplicitApiBaseUrl(n);const o=e.getInstance(h.REST_CLIENT_FACTORY_ID),i=String(o?.getOptions()?.baseUrl||"").trim();return h.resolveExplicitApiBaseUrl(i||void 0)}async function Z_(e,t){if(t.getAuthToken)try{const n=await t.getAuthToken(t.user,t.project,void 0);if(String(n||"").trim())return!0}catch{if(!t.jwtAuth)return!1}if(t.jwtAuth)try{if(String(e.getInstance(h.JWT_TOKEN_ID)||"").trim())return!0;const n=J_(e,t);if(!n)return!1;const o=await X_("/jwt-auth/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.jwtAuth)},n,{attemptTimeout:!0});if(!o.ok)return!1;const i=await o.json();return i.token?(e.inject(h.JWT_ERROR_ID,void 0),e.inject(h.JWT_TOKEN_ID,i.token),!0):!1}catch{return!1}return!1}async function ey(e){try{if(e.getInstance(h.APP_ID)===void 0)return!1;const t=await ny(e.getInstanceAsync(h.APP_ID));return t!=null&&t.project!=null?t:!1}catch{return!1}}function ty(){return h.getFailoverAttemptTimeoutMs()*Math.max(1,h.getOriginChain().length)}function ny(e){const t=ty();return new Promise((n,o)=>{const i=setTimeout(()=>{n(void 0)},t);e.then(s=>{clearTimeout(i),n(s)},s=>{clearTimeout(i),o(s)})})}function Aa(e){return String(e.standaloneKey||"").trim()||void 0}function ry(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function oy(e){return ry(e)?!!Aa(e):!1}var iy=zn(async e=>{const t=e.getInstance(h.DISPOSABLE_ID),n=()=>e.getInstanceAsync(h.STORE_ID);return{async setOptions(o){if(!oy(o)){e.getInstance(h.STANDALONE_ACTIVATED_ID);return}const i=Aa(o);if(!i||e.getInstance(h.STANDALONE_ACTIVATED_ID))return;const s=await n(),c=!!(o.getAuthToken||o.jwtAuth),d=c?await Z_(e,o):!0;if(c&&!d){await Ia({container:e,store:s,standaloneKey:i,project:o.project,getAuthToken:o.getAuthToken,user:o.user,disposable:t,reason:"auth pipeline failed"});return}const u=await ey(e);if(u){await N_(u).catch(()=>{});return}await Ia({container:e,store:s,standaloneKey:i,project:o.project,getAuthToken:o.getAuthToken,user:o.user,disposable:t,reason:"app_init failed"})}}}),sy=h.defineMixin(e=>{let t;const n=r.getDisposable(e),o=h.getEvent(e,h.events.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(o(({history:s})=>{t=s}));const i=()=>t?Ni(t):void 0;return{instance:{undoRedoService:{undo:()=>i()?.undo(),redo:()=>i()?.redo(),clear:()=>i()?.clear(),getPast:s=>i()?.getPast(s)??[],getFuture:s=>i()?.getFuture(s)??[],canUndo:()=>i()?.canUndo()??!1,canRedo:()=>i()?.canRedo()??!1,createSnapshot:()=>i()?.createSnapshot(),restoreSnapshot:s=>i()?.restoreSnapshot(s)}}}});function ay(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 ly(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}async function xa(e){const t=r.getCurrentUser(e).profile;if(t)return t;const n=e.getInstance(h.STORE_ID);if(n)return(await n.dispatch(r.authorizationApi.endpoints.getMe.initiate("",{forceRefetch:!0}))).data}function cy(e){const t=r.resolveTemplateDirectivesConfig(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return fs();const n=new Set(Object.keys(t.output).filter(i=>t.output[i]==="html-comment")),o=new Set(Object.keys(t.output));return{isConfigured:()=>!0,toEditorForm:i=>r.mapper.normalizeToPolicy(i,t.editor),toOutputForm:i=>r.mapper.normalizeToPolicy(i,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:ms(o)}}function Pa(e){const t=r.getCodeMode(e);return{...Mr(e),editor:ly(r.getEditorOptions(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function Mr(e){return e.getInstance(h.CONFIG_SOURCE_ID)?.get()??{}}function Fo(e){return e.getInstance(h.CONFIG_SOURCE_ID)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}var dy=bo(e=>{const t=r.getDisposable(e),n=Ct(r.getEvent(e,h.events.ON_LIMIT_ID)),o=t.addDisposable(new kt(n)),i=Ct(r.getEvent(e,h.events.READ_LOCALE)),s=t.addDisposable(new kt(i)),c=Ct(r.getEvent(e,h.events.ON_TRANSLATE_ID)),d=t.addDisposable(new kt(c)),u=r.getEmitter(e,h.CONFIG_CHANGED_EVENT_ID),p=async()=>{try{return e.getInstance(h.APP_ID)===void 0?{}:(await e.getInstanceAsync(h.APP_ID))?.app_config||{}}catch{return{}}},f=Bs(),g=Bs();let y,m=!1,E;const k=async()=>{const A=Pa(e);if(!m){E=h.deepClone(A),m=!0;return}E!==void 0&&h.deepEqual(E,A)||(E=h.deepClone(A),await u.fire(A))},w=A=>{if(typeof A=="number")return String(A);if(typeof A=="string")return A},v=A=>{if(A!==void 0){const O=r.provideCurrentProject(e);O.set({...O.get(),requested:String(A)})}},x=async(A,O)=>{if(!A){const Z=await xa(e);return y=w(Z?.id),{didReset:!1}}const z=await xa(e),B=A.id!==void 0?w(A.id):w(z?.id),U=y!==void 0?String(y):void 0,de=B!==void 0?String(B):void 0,me=U!==void 0&&de!==void 0&&U!==de,H={...z,...r.filterUndefined(A),id:B};if(A.id===void 0&&!z?.id&&delete H.id,r.provideCurrentUser(e).set({profile:H}),me&&O){const Z=e.getInstance(h.INSTANCE_ID);if(Z?.reset)return await Z.reset(O),{didReset:!0}}return y=de,{didReset:!1}},P=A=>{const O=e.getInstance(h.CONFIG_SOURCE_ID);O?.setAdvancedConfigs({...A.advancedConfigs,...A.user?.advancedConfigs}),O?.replace(A.user,"user"),O?.replace(A.serverSide,"server")},K=async()=>{await e.getInstance(h.CONFIG_SOURCE_ID)?.ready(),r.getRevisionServiceFlag(e).set(Mr(e).revisionService===!0);const{codeModeDirection:A,editor:O}=Mr(e);O&&r.applyEditorOptions(e,ay(O)),A!==void 0&&(A==="none"?r.setCodeMode$1(e,!1):(r.setCodeMode$1(e,!0),r.setCodeModeDirection(e,A)))},J=async A=>{P(A),await K()};let N;const L=f.decorate(async({config:A={},project:O,user:z,advancedConfigs:B},U)=>{e.getInstance(h.CONFIG_SOURCE_ID)?.replace(await p(),"server"),await K(),e.inject(h.TEMPLATE_DIRECTIVES_ID,cy(Mr(e).templateDirectives)),v(O),U&&"commonStyles"in U&&r.setDefaultCommonStyles(e,U.commonStyles===void 0?void 0:U.commonStyles);const{didReset:de}=await x(z,U)});return{setOptions:g.decorate(async A=>{const{config:O={},project:z,user:B,advancedConfigs:U,handleReadLocale:de,handleLimitUsage:me,handleTranslate:H,storageProvider:Z}=A;e.inject(h.STORAGE_PROVIDER_ID,Z),s.setListener(de),o.setListener(me),d.setListener(H),await L({config:O,project:z,user:B,advancedConfigs:U},A).catch(De=>{}),await k(),N&&N.dispose(),N=new h.Disposable}),instance:{setConfig:g.decorate(async A=>{const O=A,{commonStyles:z,...B}=O;"commonStyles"in O&&r.setDefaultCommonStyles(e,z===void 0?void 0:z),await J({advancedConfigs:Fo(e).advancedConfigs,serverSide:await p(),user:B}),await k()}),getConfig:()=>Pa(e),updateConfig:g.decorate(async A=>{const O=A,{commonStyles:z,...B}=O;"commonStyles"in O&&r.setDefaultCommonStyles(e,z===void 0?void 0:z),await J({advancedConfigs:Fo(e).advancedConfigs,serverSide:await p(),user:{...Fo(e).user,...B}}),await k()}),handleReadLocale:i,handleLimitUsage:n,handleTranslate:c}}}),Nr;function Bo(){return Nr===void 0&&(Nr=(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/43affb86.js")),void 0,{}.url).catch(e=>{throw Nr=void 0,e})),Nr}var Ra;function uy(){return Ra??=(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/e47dcbb0.js")).then(e=>zt.__toESM(e.require_core())),void 0,{}.url),Ra}function py(e){const t=[0],n=[];let o=0;for(;o<e.length;){const i=e.charCodeAt(o);i===10||i===13?(n.push(o-t[t.length-1]),o+=i===13&&e.charCodeAt(o+1)===10?2:1,t.push(o)):o+=1}return n.push(e.length-t[t.length-1]),{starts:t,lengths:n}}function ja({starts:e,lengths:t},n,o){const i=Math.min(Math.max(n,1),e.length)-1;return e[i]+Math.min(Math.max(o,1),t[i]+1)-1}var my={error:8,warning:4,info:2};function fy(e,t){const n=e.evidence!==""?e.col+e.evidence.length:t.lengths[e.line-1]??e.col+1;return{severity:my[e.type]??8,message:e.message,startLineNumber:e.line,startColumn:e.col,endLineNumber:e.line,endColumn:n,startOffset:ja(t,e.line,e.col),endOffset:ja(t,e.line,n)}}async function gy(e){const{HTMLHint:t}=await uy(),n=py(e);return t.verify(e,r.EMAIL_CODE_RULESET).map(o=>fy(o,n))}var hy=class extends h.Disposable{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=r.getDataSources(e),this.addDisposable(h.getEvent(e,h.events.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}async getBlocks(){const e=await this._readProjectBlocks();return await this._blockMetaWrites,(await this._dataSources.blocks.cache.values()).filter(t=>t.project===e).map(t=>Og(t,this._container))}async _readProjectBlocks(){const e=await r.getBlocksProject(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=>Lg(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=>Mg(n,this._container))}async getEmailSnapshot(){return Up(r.getOpenEmail(this._container,this._currentEmail),this._container)}async getEmail(e=!0){return this.compile(e)}async compileEmail(e=!0){return this.compile(e)}async compile(e){const{compileEmail:t}=await Bo();return t(await this.getEmailSnapshot(),e,on(this._container).keepWrappedOnOutput)}setEmailMeta(e){const t=r.getOpenDocument(this._container);if(!t)return;const n=t.get().attributes.meta;r.writeEmailAttributes(t,{meta:r.applyMetaPatch({meta:n},e).meta});const o=t.get().serverId;o!=null&&this._dataSources.emails.cache.addOrUpdate(o,i=>i&&r.applyMetaPatch(i,e))}setBlockMeta(e,t){const n=async()=>{await this._readProjectBlocks();const{cache:o}=this._dataSources.blocks;await o.getIfPresent(e)&&await o.addOrUpdate(e,i=>i&&r.applyMetaPatch(i,t))};this._blockMetaWrites=this._blockMetaWrites.then(n).catch(()=>{})}getCodeErrors(){const e=r.getCodeErrors(this._container);return e.length>0?e:void 0}validateCode(){return Promise.resolve(gy(r.getOpenEmail(this._container,this._currentEmail).html??""))}};function Oa(){Bo().catch(()=>{})}function _y(e){const t=r.provideHeadlessMode(e).watch(n=>{n&&Oa()});e.getInstance(h.DISPOSABLE_ID)?.addDisposable(t),Ht(e).whenVisible(()=>{Xt(Oa)})}var yy=h.createIdentifier$1("EmailOperationsController");function La(e){return e.getOrCreateInstance(yy,()=>{const t=new hy(e);return e.getInstance(h.DISPOSABLE_ID)?.addDisposable(t),t})}function vy(e){La(e),_y(e)}function by(e){const t=La(e);return{getEmailSnapshot:()=>t.getEmailSnapshot(),getEmail:()=>t.getEmail(),async compileEmail(n,o=!0){if(!n)return t.compileEmail(o);const{compileEmail:i}=await Bo();return i(n,o,on(e).keepWrappedOnOutput)},validateCode:()=>t.validateCode(),getCodeErrors:()=>t.getCodeErrors(),getBlocks:()=>t.getBlocks(),getComments:()=>t.getComments(),getEmailRevisions:()=>t.getEmailRevisions(),setEmailMeta:n=>t.setEmailMeta(n),setBlockMeta:(n,o)=>t.setBlockMeta(n,o)}}var Ey=h.defineMixin(e=>{const t=e.getInstance(h.DISPOSABLE_ID),n=h.getEvent(e,h.events.UPLOAD_EVENT_ID),o=h.getEvent(e,h.events.FILE_PROXY_EVENT_ID),i=h.getEmitter(e,h.events.PROXY_URL_EVENT_ID).event,s=Ct(n),c=Ct(i),d=Ct(o),u=t.addDisposable(new kt(s)),p=t.addDisposable(new kt(d)),f=t.addDisposable(new kt(c));return{setOptions(g){u.setListener(g.handleLoadImage),p.setListener(g.handleFileProxy),f.setListener(g.handleUrlProxy)},instance:{handleLoadImage:s,handleFileProxy:d,handleUrlProxy:c}}}),Sy=h.defineMixin(e=>{const t=e.getInstance(h.DISPOSABLE_ID),n=h.getEvent(e,h.events.AI_TEXT_REQUEST_ID),o=h.getEvent(e,h.events.AI_IMAGE_REQUEST_ID),i=Ct(n),s=Ct(o),c=t.addDisposable(new kt(i)),d=t.addDisposable(new kt(s));return{setOptions(u){c.setListener(u.handleAITextRequest),d.setListener(u.handleAIImageRequest)},instance:{handleAITextRequest:i,handleAIImageRequest:s}}}),wy=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function ky(e){const t=new Map;for(const n of e)for(const o of n.provides??[]){const i=t.get(o)??[];i.push(n),t.set(o,i)}return t}function Cy(e,t){const n=[];for(const o of e.awaits?.services??[])for(const i of t.get(o)??[])i!==e&&n.push(i);return n}function Ty(e){const t=ky(e),n=[],o=new Set,i=[],s=new Set,c=d=>{if(!o.has(d)){if(s.has(d)){const u=i.indexOf(d);throw new wy([...i.slice(u),d].map(p=>p.name))}s.add(d),i.push(d);for(const u of Cy(d,t))c(u);i.pop(),s.delete(d),o.add(d),n.push(d)}};for(const d of e)c(d);return n}var Iy="author,slug,date,modified,title,acf.html,id,parent,date_gmt",Ay="author,slug,date,modified,modified_gmt,title,acf.html,id,parent",xy=20,$o=[h.WpEblockApi];function Ma(e){return typeof e=="string"&&e?`${e.replace(/Z$/,"")}Z`:void 0}function Py(e){return{async readRevisions(t,n=1){const o=await h.getApi(e,$o).eblock_revisions_list({parent:t,per_page:xy,page:n},{extraQuery:{_fields:Iy}}),i=(o?.data??[]).map(c=>r.WpBlockRevisionToBlockRevision(c)),s=Number(o?.headers?.get("X-WP-TotalPages"));return{revisions:i,page:n,hasMore:Number.isFinite(s)&&n<s}},async readAutosave(t){const n=h.getApi(e,$o),[o,i]=await Promise.all([n.eblock_autosaves_list({id:t},{extraQuery:{_fields:Ay}}),n.eblock_detail({id:t},{extraQuery:{_fields:"modified_gmt"}})]),s=(o?.data??[]).map(d=>{const u=d,p=r.WpBlockRevisionToBlockRevision(u),f=Ma(u.modified_gmt);return f?{...p,modified:f}:p}),c=Date.parse(Ma(i?.data?.modified_gmt)??"");return r.autosaveStateFromSlots(s,Number.isFinite(c)?c:void 0)},async saveAutosave(t,n){const o=n,i=o.global_block&&o.html?r.injectEmBlockIdIntoBlockHtml(o.html,t):o.html??"";r.writePendingData(t,{sentAt:Date.now(),html:i,common_styles:""});const s=await h.getApi(e,$o).eblock_autosaves_create({id:t},r.BlockAutoSaveToWpBlockAutoSave({title:o.title,html:i,project:o.project,excerpt:new Date().toISOString()}),{type:h.ContentType.FormData});return r.WpBlockRevisionToBlockRevision(s?.data)}}}var Ry="author,slug,date,modified,title,meta,acf.html,acf.common_styles,id,parent,date_gmt",jy="author,slug,date,modified,modified_gmt,title,meta,acf.html,acf.common_styles,id,parent";function Na(e){return typeof e=="string"&&e?`${e.replace(/Z$/,"")}Z`:void 0}var Oy=20,Uo=[h.WpEmailApi];function Ly(e){return{async readRevisions(t,n=1){const o=await h.getApi(e,Uo).email_revisions_list({parent:t,per_page:Oy,page:n},{extraQuery:{_fields:Ry}}),i=(o?.data??[]).map(c=>r.WpEmailRevisionToEmailRevision(c)),s=Number(o?.headers?.get("X-WP-TotalPages"));return{revisions:i,page:n,hasMore:Number.isFinite(s)&&n<s}},async readAutosave(t){const n=h.getApi(e,Uo),[o,i]=await Promise.all([n.email_autosaves_list({id:t},{extraQuery:{_fields:jy}}),n.email_detail({id:t},{extraQuery:{_fields:"modified_gmt"}})]),s=(o?.data??[]).map(d=>{const u=d,p=r.WpEmailRevisionToEmailRevision(u),f=Na(u.modified_gmt);return f?{...p,modified:f}:p}),c=Date.parse(Na(i?.data?.modified_gmt)??"");return r.autosaveStateFromSlots(s,Number.isFinite(c)?c:void 0)},async saveAutosave(t,n){const o=await h.getApi(e,Uo).email_autosaves_create({id:t},r.EmailAutoSaveToWpEmailAutoSave({...n,excerpt:new Date().toISOString()}),{type:h.ContentType.FormData});return r.WpEmailRevisionToEmailRevision(o?.data)}}}var Da=["_embedded","id","author","title","meta","emailtags","folder","group","modified","date","type","parent","date_gmt","acf.description","acf.html","acf.common_styles","acf.is_template","acf.lock","acf.parent_email","acf.project","acf.secret_hash","acf.subject","acf.utm_parameters"].join(","),zo=[h.WpEmailApi],Fa=e=>r.EmailToWpEmail(e);function My(e){return{async readEmail(t){const n=await h.getApi(e,zo).email_detail({id:r.toNumberSafe(t)},{extraQuery:{_embed:"wp:term",_fields:Da}});if(!n)throw new r.EmailOpenFailedError("unavailable");if(n.ok===!1)throw r.openFailureFromResponse(n);return n.data?r.WpEmailToEmail(n.data):null},async createEmail(t){const n={status:"publish",...Fa(t)},o=await h.getApi(e,zo).email_create(n,{type:h.ContentType.Json});return r.WpEmailToEmail(o?.data)},async updateEmail(t,n){const o=await h.getApi(e,zo).email_partial_update({id:t},Fa(n),{type:h.ContentType.Json,extraQuery:{_embed:"wp:term",_fields:Da}});return r.WpEmailToEmail(o?.data)}}}function Ny(e){r.injectRestEmailPortFactories(e,{email:My,history:Ly,blockHistory:Py})}var Go=20,Dy=({source:e,emailtags:t,group:n,tags:o,...i})=>i;function Fy({revisions:e,revisionsByBlock:t}){const n=async(o,i)=>(t.clear(),await t.get(o,{page:i}),(await e.cache.values()??[]).filter(s=>String(s?.parent)===String(o)));return{async readRevisions(o,i=1){const s=await n(o,i);return{revisions:s.slice(Go*(i-1),Go*i),page:i,hasMore:s.length>Go*i}},async readAutosave(o){return r.autosaveStateFromRevisions(await n(o,1))},async saveAutosave(o,i){const s=Dy(i);return await e.create({...s,parent:o,modified:new Date().toString()})}}}var Ba=h.createIdentifier$1("blockDocuments.provided");function By(e){if(e.getInstance(Ba))return;e.inject(Ba,!0);const t=r.blockRevisionsDataSourceProvider(e);r.injectBlockHistoryPort(e,Fy({revisions:t,revisionsByBlock:t.byForeignKey("parent")}))}var $y=zt.__commonJSMin(((e,t)=>{(function(n){if(typeof window>"u")return;var o=0,i,s=!1,c=!1,d=7,u="[iFrameSizer]",p=u.length,f=null,g=window.requestAnimationFrame,y=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),m={},E=null,k=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,license:"1jqr0si6pnt",log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){O("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}});function w(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function v(C,T,R){C.addEventListener(T,R,!1)}function x(C,T,R){C.removeEventListener(T,R,!1)}function P(){for(var C=["moz","webkit","o","ms"],T=0;T<C.length&&!g;T+=1)g=window[C[T]+"RequestAnimationFrame"];g?g=g.bind(window):L("setup","RequestAnimationFrame not supported")}function K(C){var T="Host page: "+C;return window.top!==window.self&&(T=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+C:"Nested host page: "+C),T}function J(C){return u+"["+K(C)+"]"}function N(C){return m[C]?m[C].log:s}function L(C,T){z("log",C,T,N(C))}function A(C,T){z("info",C,T,N(C))}function O(C,T){z("warn",C,T,!0)}function z(C,T,R,D){D===!0&&window.console}function B(C){function T(){function $(){et(oe),Z(ee),Ge("onResized",oe)}S("Height"),S("Width"),be($,oe,"init")}function R(){var $=Xe.slice(p).split(":"),le=$[1]?parseInt($[1],10):0,xe=m[$[0]]&&m[$[0]].iframe,Se=getComputedStyle(xe);return{iframe:xe,id:$[0],height:le+D(Se)+I(Se),width:$[2],type:$[3]}}function D($){return $.boxSizing!=="border-box"?0:($.paddingTop?parseInt($.paddingTop,10):0)+($.paddingBottom?parseInt($.paddingBottom,10):0)}function I($){return $.boxSizing!=="border-box"?0:($.borderTopWidth?parseInt($.borderTopWidth,10):0)+($.borderBottomWidth?parseInt($.borderBottomWidth,10):0)}function S($){var le=Number(m[ee]["max"+$]),xe=Number(m[ee]["min"+$]),Se=$.toLowerCase(),Me=Number(oe[Se]);L(ee,"Checking "+Se+" is in range "+xe+"-"+le),Me<xe&&(Me=xe,L(ee,"Set "+Se+" to min value")),Me>le&&(Me=le,L(ee,"Set "+Se+" to max value")),oe[Se]=""+Me}function ae(){function $(){function Se(){var We=0,Be=!1;for(L(ee,"Checking connection is from allowed list of origins: "+xe);We<xe.length;We++)if(xe[We]===le){Be=!0;break}return Be}function Me(){var We=m[ee]&&m[ee].remoteHost;return L(ee,"Checking connection is from: "+We),le===We}return xe.constructor===Array?Se():Me()}var le=C.origin,xe=m[ee]&&m[ee].checkOrigin;if(xe&&""+le!="null"&&!$())throw new Error("Unexpected message received from: "+le+" for "+oe.iframe.id+". Message was: "+C.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}function we(){return u===(""+Xe).slice(0,p)&&Xe.slice(p).split(":")[0]in m}function Ye(){var $=oe.type in{true:1,false:1,undefined:1};return $&&L(ee,"Ignoring init message from meta parent page"),$}function Qe($){return Xe.slice(Xe.indexOf(":")+d+$)}function ze($){L(ee,"onMessage passed: {iframe: "+oe.iframe.id+", message: "+$+"}"),Ge("onMessage",{iframe:oe.iframe,message:JSON.parse($)}),L(ee,"--")}function Ze(){var $=document.body.getBoundingClientRect(),le=oe.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:le.height,iframeWidth:le.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(le.top-$.top,10),offsetLeft:parseInt(le.left-$.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}function pt($,le){function xe(){fe("Send Page Info","pageInfo:"+Ze(),$,le)}Te(xe,32,le)}function bt(){function $(Me,We){function Be(){m[Se]?pt(m[Se].iframe,Se):le()}["scroll","resize"].forEach(function(ot){L(Se,Me+ot+" listener for sendPageInfo"),We(window,ot,Be)})}function le(){$("Remove ",x)}function xe(){$("Add ",v)}var Se=ee;xe(),m[Se]&&(m[Se].stopPageInfo=le)}function ft(){m[ee]&&m[ee].stopPageInfo&&(m[ee].stopPageInfo(),delete m[ee].stopPageInfo)}function lt(){var $=!0;return oe.iframe===null&&(O(ee,"IFrame ("+oe.id+") not found"),$=!1),$}function G($){var le=$.getBoundingClientRect();return H(ee),{x:Math.floor(Number(le.left)+Number(f.x)),y:Math.floor(Number(le.top)+Number(f.y))}}function V($){function le(){f=We,te(),L(ee,"--")}function xe(){return{x:Number(oe.width)+Me.x,y:Number(oe.height)+Me.y}}function Se(){window.parentIFrame?window.parentIFrame["scrollTo"+($?"Offset":"")](We.x,We.y):O(ee,"Unable to scroll to requested position, window.parentIFrame not found")}var Me=$?G(oe.iframe):{x:0,y:0},We=xe();L(ee,"Reposition requested from iFrame (offset x:"+Me.x+" y:"+Me.y+")"),window.top===window.self?le():Se()}function te(){Ge("onScroll",f)===!1?De():Z(ee)}function ue($){function le(){var Be=G(We);L(ee,"Moving to in page link (#"+Se+") at x: "+Be.x+" y: "+Be.y),f={x:Be.x,y:Be.y},te(),L(ee,"--")}function xe(){window.parentIFrame?window.parentIFrame.moveToAnchor(Se):L(ee,"In page link #"+Se+" not found and window.parentIFrame not found")}var Se=$.split("#")[1]||"",Me=decodeURIComponent(Se),We=document.getElementById(Me)||document.getElementsByName(Me)[0];We?le():window.top===window.self?L(ee,"In page link #"+Se+" not found"):xe()}function he($){var le={};if(Number(oe.width)===0&&Number(oe.height)===0){var xe=Qe(9).split(":");le={x:xe[1],y:xe[0]}}else le={x:oe.width,y:oe.height};Ge($,{iframe:oe.iframe,screenX:Number(le.x),screenY:Number(le.y),type:oe.type})}function Ge($,le){return U(ee,$,le)}function qe(){switch(m[ee]&&m[ee].firstRun&&Le(),oe.type){case"close":me(oe.iframe);break;case"message":ze(Qe(6));break;case"mouseenter":he("onMouseEnter");break;case"mouseleave":he("onMouseLeave");break;case"autoResize":m[ee].autoResize=JSON.parse(Qe(9));break;case"scrollTo":V(!1);break;case"scrollToOffset":V(!0);break;case"pageInfo":pt(m[ee]&&m[ee].iframe,ee),bt();break;case"pageInfoStop":ft();break;case"inPageLink":ue(Qe(9));break;case"reset":ve(oe);break;case"init":T(),Ge("onInit",oe.iframe);break;default:Number(oe.width)===0&&Number(oe.height)===0?O("Unsupported message received ("+oe.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):T()}}function st($){var le=!0;return m[$]||(le=!1,O(oe.type+" No settings for "+$+". Message was: "+Xe)),le}function Bt(){for(var $ in m)fe("iFrame requested init",Y($),m[$].iframe,$)}function Le(){m[ee]&&(m[ee].firstRun=!1)}var Xe=C.data,oe={},ee=null;Xe==="[iFrameResizerChild]Ready"?Bt():we()?(oe=R(),ee=oe.id,m[ee]&&(m[ee].loaded=!0),!Ye()&&st(ee)&&(L(ee,"Received: "+Xe),lt()&&ae()&&qe())):A(ee,"Ignored: "+Xe)}function U(C,T,R){var D=null,I=null;if(m[C])if(D=m[C][T],typeof D=="function")I=D(R);else throw new TypeError(T+" on iFrame["+C+"] is not a function");return I}function de(C){var T=C.id;delete m[T]}function me(C){var T=C.id;if(U(T,"onClose",T)===!1){L(T,"Close iframe cancelled by onClose event");return}L(T,"Removing iFrame: "+T);try{C.parentNode&&C.parentNode.removeChild(C)}catch(R){O(R)}U(T,"onClosed",T),L(T,"--"),de(C),i&&(i.disconnect(),i=null)}function H(C){f===null&&(f={x:window.pageXOffset===n?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===n?document.documentElement.scrollTop:window.pageYOffset},L(C,"Get page position: "+f.x+","+f.y))}function Z(C){f!==null&&(window.scrollTo(f.x,f.y),L(C,"Set page position: "+f.x+","+f.y),De())}function De(){f=null}function ve(C){function T(){et(C),fe("reset","reset",C.iframe,C.id)}L(C.id,"Size reset requested by "+(C.type==="init"?"host page":"iFrame")),H(C.id),be(T,C,"reset")}function et(C){function T(S){if(!C.id){L("undefined","messageData id not set");return}C.iframe.style[S]=C[S]+"px",L(C.id,"IFrame ("+I+") "+S+" set to "+C[S]+"px")}function R(S){!c&&C[S]==="0"&&(c=!0,L(I,"Hidden iFrame detected, creating visibility listener"),Fe())}function D(S){T(S),R(S)}var I=C.iframe.id;m[I]&&(m[I].sizeHeight&&D("height"),m[I].sizeWidth&&D("width"))}function be(C,T,R){R!==T.type&&g&&!window.jasmine?(L(T.id,"Requesting animation frame"),g(C)):C()}function fe(C,T,R,D,I){function S(){var ze=m[D]&&m[D].targetOrigin;L(D,"["+C+"] Sending msg to iframe["+D+"] ("+T+") targetOrigin: "+ze),R.contentWindow.postMessage(u+T,ze)}function ae(){O(D,"["+C+"] IFrame("+D+") not found")}function we(){R&&"contentWindow"in R&&R.contentWindow!==null?S():ae()}function Ye(){function ze(){m[D]&&!m[D].loaded&&!Qe&&(Qe=!0,O(D,"IFrame has not responded within "+m[D].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}I&&m[D]&&m[D].warningTimeout&&(m[D].msgTimeout=setTimeout(ze,m[D].warningTimeout))}var Qe=!1;D=D||R.id,m[D]&&(we(),Ye())}function Y(C){return C+":"+m[C].bodyMarginV1+":"+m[C].sizeWidth+":"+m[C].log+":"+m[C].interval+":"+m[C].enablePublicMethods+":"+m[C].autoResize+":"+m[C].bodyMargin+":"+m[C].heightCalculationMethod+":"+m[C].bodyBackground+":"+m[C].bodyPadding+":"+m[C].tolerance+":"+m[C].inPageLinks+":"+m[C].resizeFrom+":"+m[C].widthCalculationMethod+":"+m[C].mouseEvents}function pe(C){return typeof C=="number"}function ie(C,T){function R(){function V(ue){var he=m[G][ue];he!==1/0&&he!==0&&(C.style[ue]=pe(he)?he+"px":he,L(G,"Set "+ue+" = "+C.style[ue]))}function te(ue){if(m[G]["min"+ue]>m[G]["max"+ue])throw new Error("Value for min"+ue+" can not be greater than max"+ue)}te("Height"),te("Width"),V("maxHeight"),V("minHeight"),V("maxWidth"),V("minWidth")}function D(){var V=T&&T.id||k.id+o++;return document.getElementById(V)!==null&&(V+=o++),V}function I(V){if(typeof V!="string")throw new TypeError("Invaild id for iFrame. Expected String");return V===""&&(C.id=V=D(),s=(T||{}).log,L(V,"Added missing iframe ID: "+V+" ("+C.src+")")),V}function S(){switch(L(G,"IFrame scrolling "+(m[G]&&m[G].scrolling?"enabled":"disabled")+" for "+G),C.style.overflow=(m[G]&&m[G].scrolling)===!1?"hidden":"auto",m[G]&&m[G].scrolling){case"omit":break;case!0:C.scrolling="yes";break;case!1:C.scrolling="no";break;default:C.scrolling=m[G]?m[G].scrolling:"no"}}function ae(){(typeof(m[G]&&m[G].bodyMargin)=="number"||(m[G]&&m[G].bodyMargin)==="0")&&(m[G].bodyMarginV1=m[G].bodyMargin,m[G].bodyMargin=""+m[G].bodyMargin+"px")}function we(){var V=m[G]&&m[G].firstRun,te=m[G]&&m[G].heightCalculationMethod in y;!V&&te&&ve({iframe:C,height:0,width:0,type:"init"})}function Ye(){m[G]&&(m[G].iframe.iFrameResizer={close:me.bind(null,m[G].iframe),removeListeners:de.bind(null,m[G].iframe),resize:fe.bind(null,"Window resize","resize",m[G].iframe),moveToAnchor:function(V){fe("Move to anchor","moveToAnchor:"+V,m[G].iframe,G)},sendMessage:function(V){V=JSON.stringify(V),fe("Send Message","message:"+V,m[G].iframe,G)}})}function Qe(V){function te(){fe("iFrame.onload",V,C,n,!0),we()}function ue(Ge){if(!C.parentNode)return null;var qe=new Ge(function(st){st.forEach(function(Bt){Array.prototype.slice.call(Bt.removedNodes).forEach(function(Le){Le===C&&me(C)})})});return qe.observe(C.parentNode,{childList:!0}),qe}var he=w();he&&(i=ue(he)),v(C,"load",te),fe("init",V,C,n,!0)}function ze(V){if(typeof V!="object")throw new TypeError("Options is not an object")}function Ze(V){for(var te in k)Object.prototype.hasOwnProperty.call(k,te)&&(m[G][te]=Object.prototype.hasOwnProperty.call(V,te)?V[te]:k[te])}function pt(V){return V===""||V.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":V}function bt(V){var te=V.split("Callback");if(te.length===2){var ue="on"+te[0].charAt(0).toUpperCase()+te[0].slice(1);this[ue]=this[V],delete this[V],O(G,"Deprecated: '"+V+"' has been renamed '"+ue+"'. The old method will be removed in the next major version.")}}function ft(V){V=V||{},m[G]=Object.create(null),m[G].iframe=C,m[G].firstRun=!0,m[G].remoteHost=C.src&&C.src.split("/").slice(0,3).join("/"),ze(V),Object.keys(V).forEach(bt,V),Ze(V),m[G]&&(m[G].targetOrigin=m[G].checkOrigin===!0?pt(m[G].remoteHost):"*")}function lt(){return G in m&&"iFrameResizer"in C}var G=I(C.id);lt()?O(G,"Ignored iFrame, already setup."):(ft(T),S(),R(),ae(),Qe(Y(G)),Ye())}function se(C,T){E===null&&(E=setTimeout(function(){E=null,C()},T))}var Ae={};function Te(C,T,R){Ae[R]||(Ae[R]=setTimeout(function(){Ae[R]=null,C()},T))}function Fe(){function C(){function I(S){function ae(Ye){return(m[S]&&m[S].iframe.style[Ye])==="0px"}function we(Ye){return Ye.offsetParent!==null}m[S]&&we(m[S].iframe)&&(ae("height")||ae("width"))&&fe("Visibility change","resize",m[S].iframe,S)}Object.keys(m).forEach(function(S){I(S)})}function T(I){L("window","Mutation observed: "+I[0].target+" "+I[0].type),se(C,16)}function R(){var I=document.querySelector("body");new D(T).observe(I,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0})}var D=w();D&&R()}function X(C){function T(){Ie("Window "+C,"resize")}L("window","Trigger event: "+C),se(T,16)}function Ee(){function C(){Ie("Tab Visible","resize")}document.visibilityState!=="hidden"&&(L("document","Trigger event: Visibility change"),se(C,16))}function Ie(C,T){function R(D){return m[D]&&m[D].resizeFrom==="parent"&&m[D].autoResize&&!m[D].firstRun}Object.keys(m).forEach(function(D){R(D)&&fe(C,T,m[D].iframe,D)})}function ge(){v(window,"message",B),v(window,"resize",function(){X("resize")}),v(document,"visibilitychange",Ee),v(document,"-webkit-visibilitychange",Ee)}function Re(){function C(D,I){function S(){if(I.tagName){if(I.tagName.toUpperCase()!=="IFRAME")throw new TypeError("Expected <IFRAME> tag, found <"+I.tagName+">")}else throw new TypeError("Object is not a valid DOM element")}I&&(S(),ie(I,D),R.push(I))}function T(D){D&&D.enablePublicMethods&&O("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}var R;return P(),ge(),function(I,S){switch(R=[],T(I),typeof S){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(S||"iframe"),C.bind(n,I));break;case"object":C(I,S);break;default:throw new TypeError("Unexpected data type ("+typeof S+")")}return R}}function Ue(C){C.fn?C.fn.iFrameResize||(C.fn.iFrameResize=function(R){function D(I,S){ie(S,R)}return this.filter("iframe").each(D).end()}):A("","Unable to bind to jQuery, it is not fully loaded.")}window.jQuery!==n&&Ue(window.jQuery),typeof define=="function"&&define.amd?define([],Re):typeof t=="object"&&typeof t.exports=="object"&&(t.exports=Re()),window.iFrameResize=window.iFrameResize||Re()})()})),Uy=zt.__toESM($y()),zy={checkOrigin:!1,minHeight:600,scrolling:!1};function Gy(e){const t=()=>e.iFrameResizer;return(0,Uy.default)(zy,e),{resize:()=>t()?.resize?.(),dispose:()=>t()?.removeListeners?.()}}function Wy(e){e.inject(Mi,Gy)}function Hy(e){const t=r.getMessageService(e),n=e.getInstance(r.LOCALE_SERVICE_ID);if(!n)return;let o="";const i=()=>{const d=n.snapshot(),u=d.id??"";if(!t.isInited()||u===o)return;const p=r.createI18n(d.catalog),f=y=>p.__(y),g=r.SANDBOX_TRANSLATIONS_MAP(f);o=u,t.send(r.EVENT_TYPES.SANDBOX_TRANSLATIONS,{name:u,data:g})},s=t.onInit(()=>{o="",i()}),c=n.state.watch(i);e.getInstance(h.DISPOSABLE_ID)?.addDispose(()=>{s.dispose(),c.dispose()})}function qy(e){const t=e?.content?.templateId;return t==null||t===""?void 0:String(t)}function Vy(e){e.getInstance(h.OPTIONS_SOURCE_ID)?.watch(t=>{const n=qy(t);n!==void 0&&Fg(e,n)})}var Wo={en_US:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/6c10ee28.js")).then(e=>e.en_US_exports),void 0,{}.url),ru_RU:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/b502ca96.js")),void 0,{}.url),uk_UA:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/fad0a613.js")),void 0,{}.url),es_ES:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/cab426fa.js")),void 0,{}.url),pt_BR:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/6589e3b8.js")),void 0,{}.url),de_DE:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/5f0c0e3a.js")),void 0,{}.url),fr_FR:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/9b7f52a5.js")),void 0,{}.url),it_IT:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/70b2c337.js")),void 0,{}.url),pl_PL:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/6eeae572.js")),void 0,{}.url)};async function Ky(e){const t=Wo[e];if(!t){const n=Wo.en_US;return n?(await n()).default:void 0}return(await t()).default}var v0=Object.keys(Wo),Yy=e=>e==="uk"?"uk_UA":e;function Qy(e){e.getInstance(r.LOCALE_SERVICE_ID)?.useAntdLoader(t=>Ky(Yy(t)))}function Xy(e){}function $a(e,t,n){let o=!1;const i=e.watch(s=>{o||!t(s)||(o=!0,n())});o&&i.dispose()}function Jy(e,t){const n=e.getInstance(h.CONFIG_SOURCE_ID);n&&$a(n,o=>!!o?.codeEnabled||!!o?.codeSideEnabled,()=>{tv(e,()=>{nv(e,()=>{ev(e,()=>{Ht(e).whenVisible(()=>{Xt(()=>{Zy(t).catch(()=>{})})})})})})})}async function Zy(e){await e()}function ev(e,t){const n=e.getInstance(Ns);if(!n){Xt(t);return}const o=()=>{if(n.pipeline.filledGeneration()!==void 0){t();return}Xt(o)};Xt(o)}function tv(e,t){const n=e.getInstance(r.EMAIL_DOCUMENTS_ID);if(!n)return;if(n.current()){t();return}let o=!1;const i=n.subscribe(()=>{o||!n.current()||(o=!0,t())});o&&i()}function nv(e,t){const n=e.getInstance(h.OPTIONS_SOURCE_ID);n&&$a(n,o=>!!o?.element,t)}function rv(e){Jy(e,tu)}var Ua=h.createIdentifier$1("NotificationService");function za(e,t="success"){return typeof e=="string"&&(e={message:e}),r.filterUndefined({type:e.type||t,data:e.data,innerException:e.innerException,title:e.message,description:e.description,actions:e.btn,onClose:e.onClose,duration:e.duration,icon:e.icon,placement:e.placement,style:e.style,closeIcon:e.closeIcon,props:e.props,role:e.role})}var ov="bottomRight";function Ho(e,t){return typeof e=="string"||typeof e=="object"?za(e,t):e}var iv=class extends h.Disposable{send;onNotify;onError;onSuccess;constructor(e,t,n){super(),this.send=n,this.onNotify=Ct(t,c=>c,c=>Ho(c)),this.onError=Ct(h.filter(t,c=>c.type==="error"),c=>c,c=>Ho(c,"error")),this.onSuccess=Ct(h.filter(t,c=>c.type==="success"),c=>c,c=>Ho(c));const o=this.addDisposable(new kt(this.onNotify)),i=this.addDisposable(new kt(this.onError)),s=this.addDisposable(new kt(this.onSuccess));this.addDisposable(e.watch(({handleNotify:c,handleError:d,handleSuccess:u})=>{o.setListener(c),i.setListener(d),s.setListener(u)}))}notify(e){this.send({placement:ov,...za(e)})}};function sv(e){e.injectFactory(Ua,()=>{const t=new iv(e.getInstance(h.OPTIONS_SOURCE_ID),h.getEvent(e,h.events.ON_NOTIFICATION),n=>{r.executeCommand(e,r.NOTIFY_COMMAND_ID,n)});return e.getInstance(h.DISPOSABLE_ID)?.addDisposable(t),t},!0)}function av(e){const t=r.getEmailDocuments(e),n=i=>{e.getInstance(h.STORE_ID)?.dispatch(r.taxonomiesApi.util.invalidateTags([{type:"folder",id:i}]))},o=t.onSaved(i=>{i.created&&n("folder")});e.getInstance(h.DISPOSABLE_ID)?.addDispose(o)}function b0(e){return e}var lv=[{name:"rest.legacySections",provides:[h.REST_CLIENT_ID],setup:h.provideLegacyRestSections},{name:"canvas.resizer",provides:[Mi],setup:Wy},{name:"canvas.sandboxLocale",awaits:{services:[r.LOCALE_SERVICE_ID]},setup:Hy},{name:"locale.brandCatalog",awaits:{services:[r.LOCALE_SERVICE_ID]},setup:Xy},{name:"email.restPorts",provides:[r.REST_EMAIL_PORTS_ID],setup:Ny},{name:"block.historyPort",setup:By},{name:"email.templatePrefetch",setup:Vy},{name:"locale.antd",awaits:{services:[r.LOCALE_SERVICE_ID]},setup:Qy},{name:"save.listsFollow",setup:av},{name:"monaco.prewarm",awaits:{services:[h.CONFIG_SOURCE_ID]},setup:rv},{name:"notifications",provides:[Ua],setup:sv},{name:"email.operations",setup:vy}],cv=h.defineMixin(e=>{for(const t of Ty(lv))t.setup(e);return{instance:by(e)}}),dv=h.combineMixins([cv,P_,iy,dy,Ey,Sy,jg,sy,$s,Us]);async function uv(e){const t=new Map;typeof e=="object"&&(e=e.code);const{amp2html:n,html2amp:o}=await(0,Ve.__vitePreload)(async()=>{const{amp2html:c,html2amp:d}=await Promise.resolve().then(()=>ye("./static/core/181088a9.js"));return{amp2html:c,html2amp:d}},void 0,{}.url),i=await yt.changeHtml(e,async c=>{await yt.replaceImagesInDocument(c.document,d=>r.mapper.getEscapedText(d)!==d?d:r.toAbsoluteUrl(d),t);for(const d of c.document.querySelectorAll(".em-amp-show-disabled"))d.remove();c.handleRender(async({contentDocument:d,managedNodeController:u})=>{await o(d,{mappedTags:{script:"___script"},commit:()=>u.commit()})})},[800]),s=await yt.changeHtml(e,async c=>{await yt.replaceImagesInDocument(c.document,d=>r.mapper.getEscapedText(d)!==d?d:r.toAbsoluteUrl(d),t);for(const d of c.document.querySelectorAll(".em-amp-show-only"))d.remove();await n(c.document,{mappedTags:{script:"___script"}})},[800]);return{code:e,html:s,ampHtml:i}}async function pv(){const{installDiagnostics:e}=await(0,Ve.__vitePreload)(async()=>{const{installDiagnostics:t}=await Promise.resolve().then(()=>ye("./static/core/6c7df338.js"));return{installDiagnostics:t}},void 0,{}.url);return e()}async function mv(e,t){const{initDevTools:n}=await(0,Ve.__vitePreload)(async()=>{const{initDevTools:o}=await Promise.resolve().then(()=>ye("./static/core/52fbc985.js"));return{initDevTools:o}},void 0,{}.url);n(e,t)}var fv="1.1.85-dev.2";nn.asyncMixins=dv,nn.initDevTools=mv,nn.installDiagnostics=pv,nn.parseAMP=uv,nn.version=fv});
|
|
857
|
+
</tr>`)}},fn=async()=>{const M=oe();st(M,async q=>{try{const Q=document.querySelector(".email-preview"),re=getComputedStyle(Q),ne=await x(q,[re.width],e.utm_parameters,async He=>{ot(He)}),W=await te({htmlContent:ne,notification:E}).unwrap(),Ce=window.URL.createObjectURL(new Blob([W],{type:"application/pdf"})),_e=document.createElement("a");_e.href=Ce,_e.setAttribute("download",`${qe()}.pdf`),document.body.appendChild(_e),_e.click(),document.body.removeChild(_e),window.URL.revokeObjectURL(Ce)}catch{}})},Ot=M=>{const q=oe();st(q,Q=>{be({event:"click",action:"export_email",export_type:"HTML"});const re=document.querySelector(".email-preview"),ne=getComputedStyle(re);x(Q,[ne.width],e.utm_parameters,async W=>{await Be(W),ot(W),await r.processAmp(W,M)}).then(W=>{const Ce=new Blob([W],{type:"text/html;charset=utf-8"});(0,sn.saveAs)(Ce,`${qe()}.html`)}).catch(W=>{})},!0)},ct=M=>{const q=oe();st(q,Q=>{be({event:"click",action:"export_email",export_type:"TEXT"});const re=document.querySelector(".email-preview"),ne=getComputedStyle(re);x(Q,[ne.width],e.utm_parameters,async W=>{await Be(W),ot(W),await r.processAmp(W,M);const[{htmlToText:Ce},{EmailTextPlainConvertOptions:_e}]=await Promise.all([(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/230f23ec.js")),void 0,{}.url),(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/6541580a.js")),void 0,{}.url)]);W.handleReadHtml(He=>{He.html=Ce(He.contentDocument,_e)})}).then(W=>{const Ce=new Blob([W],{type:"text/plain;charset=utf-8"});(0,sn.saveAs)(Ce,`${qe()}.txt`)}).catch(W=>{})})},Et=()=>{const M=oe();st(M,q=>{be({event:"click",action:"export_email",export_type:"MARKDOWN"});const Q=document.querySelector(".email-preview"),re=getComputedStyle(Q),{utm_parameters:ne}=e;x(q,[re.width],ne,async W=>{ot(W),await r.processAmp(W,"html");const{htmlToMarkdown:Ce}=await(0,Ve.__vitePreload)(async()=>{const{htmlToMarkdown:_e}=await Promise.resolve().then(()=>ye("./static/core/b743a76d.js"));return{htmlToMarkdown:_e}},void 0,{}.url);W.handleReadHtml(_e=>{_e.html=Ce(_e.contentDocument)})}).then(W=>{const Ce=new Blob([W],{type:"text/markdown;charset=utf-8"});(0,sn.saveAs)(Ce,`${qe()}.md`)}).catch(W=>r.reportError(W,{origin:"markdown-export"}))})},Lt=M=>{const q=oe();st(q,Q=>{be({event:"click",action:"export_email",export_type:"Clipboard"});const re=document.querySelector(".email-preview"),ne=getComputedStyle(re);x(Q,[ne.width],e.utm_parameters,async W=>{await Be(W),ot(W),await r.processAmp(W,M)}).then(W=>navigator.clipboard.writeText(W).then(function(){E.success(n("The email has been copied to the clipboard."))})).catch(W=>{})},!0)},jn=async M=>{Re&&mo(Re)},On=()=>{Ue(null),T("")},gn=async()=>{if(!R){D(!0);try{const M=await Se([800,tf],Zm);if(!M)return;const{hrefs:q,dispose:Q}=M;try{const[re,ne]=await Promise.all(q.map(_e=>yt.getImageByUrl(_e).then(He=>yt.imageToBlob(He)))),W=qe(),Ce=await yt.htmlFilesToZip(Jm(W,{desktop:re,mobile:ne}));(0,sn.saveAs)(Ce,Cs(W).archive),be({event:"click",action:"export_email",export_type:"Image"})}finally{Q()}}catch{E.error({title:n("Error"),description:n("Failed to export the email as images. Please try again.")})}finally{D(!1)}}},Ln=M=>{const q=J.get(r.APP_COOKIES.em_token);return fetch(`https://app.useblocks.io/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(M)}`,{headers:{authorization:`Bearer ${q}`}}).then(Q=>Q.blob())},Mn=M=>new Promise((q,Q)=>{const re=()=>Ln(M).then(q,Q);fetch(M).then(ne=>q(ne.blob()),re).catch(()=>{})}),gt=(M,q)=>{const Q=oe();st(Q,re=>{be({event:"click",action:"export_email",export_type:"Outlook"});const ne=document.querySelector(".email-preview"),W=getComputedStyle(ne),Ce=async(_e,He)=>{_e.document,await r.processAmp(_e,He),await Be(_e),ot(_e)};P(e.title,re,[W.width,W.height],e.utm_parameters,M?_e=>Ce(_e,"html"):_e=>Ce(_e),q?{embedImagesAsBase64:!0,getImageBlob:Mn}:void 0).then(_e=>{const He=new Blob([_e],{type:"text/html;charset=utf-8"});(0,sn.saveAs)(He,`${qe()}.eml`)}).catch(_e=>{})})},St=M=>{k({centered:!0,mask:{closable:!0},title:n("Embed images in the file?"),content:n('If "Yes", images will be included in the file itself. This is useful for offline viewing or if external images are blocked, but increases file size. If "No", images will be loaded from external links.'),okText:n("Yes"),cancelText:n("No"),onOk:()=>gt(M,!0),onCancel:()=>gt(M,!1)})},ce=async()=>{const M=oe();st(M,async q=>{be({event:"click",action:"export_email",export_type:"ZIP"});const Q=document.querySelector(".email-preview"),re=getComputedStyle(Q),ne=await K(q,[re.width,void 0],e.utm_parameters,Mn,async Ce=>{await Be(Ce),ot(Ce),Tt&&await r.processAmp(Ce,"html")});Tt&&(ne["amp.html"]=await x(q,[re.width],e.utm_parameters,async Ce=>{await Be(Ce),ot(Ce),await r.processAmp(Ce,"amp")}));const W=await yt.htmlFilesToZip(ne);(0,sn.saveAs)(W,`${qe()}.zip`)},!0)},ke=async()=>{if(be({event:"click",action:"duplicate_email",entity_type:"email",entity_id:e.id,project_id:e.project,context:"editor"}),e.isNew)E.warning({title:n("To create a copy, you need to save the email.")});else{if((await B.fire(e)).some(M=>M===!1))return;ft({title:xt.generateCopyTitle(e.title),...e.meta!==void 0?{meta:e.meta}:{},project:Number(ue?.id),description:e.description,html:xt.generateCopyHtml(oe()||"",String(e.title)),parent_email:e.parent_email||6892,common_styles:e.common_styles||"",utm_parameters:{utm_source:e.utm_parameters?.utm_source,utm_medium:e.utm_parameters?.utm_medium,utm_campaign:e.utm_parameters?.utm_campaign,utm_term:e.utm_parameters?.utm_term,utm_content:e.utm_parameters?.utm_content},emailtags:e.emailtags,folder:e.folder}).unwrap().then(M=>{u(`/projects/${ue.id}/emails/${M.id}`),E.success({title:n('The copy of email "')+e.title+n('" was successfully created.')}),be({event:"duplicate",action:"duplicate_email_success",entity_type:"email",entity_id:e.id,cloned_entity_id:M.id,project_id:e.project,context:"editor"}),he("folder")}).catch(M=>{E.error({title:M.data.code,description:M.data.message})})}},Ne=()=>{be({event:"click",action:"click_delete_email_menu_item",entity_type:"email",entity_id:e.id,project_id:e.project,context:"editor"}),e.isNew?E.success(n("The draft of the email has been deleted.")):nt(e,u)},nt=(M,q)=>{be({event:"open",action:"open_delete_email_modal",entity_type:"email",entity_id:M.id,project_id:M.project,context:"editor"}),k({mask:{closable:!0},centered:!0,title:o('Are you sure to delete "',"email")+M.title+n('" email?'),icon:(0,a.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:_.icons$DeleteOutlined,size:22,style:{color:_.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:n("Yes"),cancelText:n("No"),onOk:()=>bt(M,q)})},je=()=>{go().catch(()=>{}),r.uploadFile("application/zip, message/rfc822, text/html",Yt)},Yt=async M=>{const q=M[0];try{i(r.setIsGlobalLoading(!0));const{createDocumentProcessor:Q,createFileProcessor:re,importEmail:ne}=await go(),{html:W,hasBrowserExtensionArtifacts:Ce}=await ne(q,re(c,d,g,ue,N),Q(q))??{html:"",hasBrowserExtensionArtifacts:!1};Ce&&U.fire();const[_e]=yt.getFileNameAndExt(q.name.replaceAll(" "," ")),He=_e||xt.getTitleFromHtml(W)||"";ee(W,{undoable:!0}),s({title:He}),i(r.setIsGlobalLoading(!1)),le.fire({html:W})}catch(Q){i(r.setIsGlobalLoading(!1));const re=Q instanceof Error?Q.message:Q;E.error({title:re})}be({event:"upload_file",action:"import_email"})},$t=()=>{const M=oe();M&&(be({event:"click",action:"convert_layout"}),le.fire({html:M}))},dt=[];N.emailDropdownMenuClone&&dt.push({label:n("Clone"),icon:(0,a.jsx)(r.EmIcons,{icon:"CopyOutlined",component:_.icons$CopyOutlined,size:16,strokeWidth:N.iconStrokeWidth}),key:"Clone",className:"em-analytics__email-clone",disabled:lt.isLoading,onClick:ke}),N.emailDropdownMenuImport&&dt.push({label:o("Import","verb"),icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"CloudUploadOutlined",component:_.icons$CloudUploadOutlined,style:Dt}),locked:Qe.isLocked,strokeWidth:N.iconStrokeWidth}),key:"Import",className:"em-analytics__editor-page__import",onClick:()=>{if(Qe.isLocked){Ze("template_import");return}be({event:"click",action:"import_email"}),je()}});const Nn=oe(),Ut=!e.hasOwnProperty("type")&&bs(Nn,L)!==null;N.emailDropdownMenuConvert&&Ut&&dt.push({label:n("Convert"),icon:(0,a.jsx)(r.EmIcons,{icon:"SwapOutlined",component:_.icons$SwapOutlined,size:16,strokeWidth:N.iconStrokeWidth}),key:"ConvertLayout",className:"em-analytics__email-convert",onClick:$t}),(p||f||g.id?.toString()===e.author?.toString())&&(N.emailDropdownMenuLock&&dt.push({label:(0,a.jsx)(ys,{element:e,context:"editor"},"Lock"),icon:e.lock?(0,a.jsx)(r.EmIcons,{icon:"UnLock",component:_.icons$UnLock,size:16,strokeWidth:N.iconStrokeWidth}):(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:16,strokeWidth:N.iconStrokeWidth}),disabled:e.isNew}),N.emailDropdownMenuRemove&&dt.push({label:n("Remove"),icon:(0,a.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:_.icons$DeleteOutlined,size:16,strokeWidth:N.iconStrokeWidth}),key:"Remove",className:"em-analytics__email-remove",style:{color:"#ff4d4f"},onClick:Ne}));const Tt=e.isAmp,It=[],Dr=()=>[...Tt?[{key:"html_txt",label:`${n("Plain text")} (HTML)`,onClick:()=>ct("html")},{key:"сode_txt",label:`${n("Plain text")} (AMP)`,onClick:()=>ct("amp")}]:[{key:"plain_txt",label:n("Plain text"),onClick:()=>ct()}],{key:"markdown",label:n("Markdown"),onClick:()=>Et()}];N.exportHtmlEnabled&&It.push({key:"html",label:n("Code"),icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"FileTextOutlined",component:_.icons$FileTextOutlined,style:Dt}),locked:I.isLocked,strokeWidth:N.iconStrokeWidth}),...I.isLocked?{onClick:()=>Ze("export_html")}:Tt?{children:[{key:"сode_html",label:n("AMP"),onClick:()=>Ye.isLocked?Ze("export_amp"):Ot("amp")},{key:"html_amp",label:n("HTML"),onClick:()=>Ot("html")}]}:{onClick:()=>Ot()}}),N.exportZipEnabled&&It.push({key:"zip",label:n("ZIP"),icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"FileZipOutlined",component:_.icons$FileZipOutlined,style:Dt}),locked:I.isLocked,strokeWidth:N.iconStrokeWidth}),...I.isLocked?{onClick:()=>Ze("export_html")}:{onClick:()=>ce().catch(M=>{})}}),N.exportClipboardEnabled&&It.push({key:"clipboard",label:n("Clipboard"),icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"SnippetsOutlined",component:_.icons$SnippetsOutlined,style:Dt}),locked:I.isLocked,strokeWidth:N.iconStrokeWidth}),...I.isLocked?{onClick:()=>Ze("export_html")}:Tt?{children:[{key:"clipboard_html",label:n("AMP"),onClick:()=>Ye.isLocked?Ze("export_amp"):Lt("amp")},{key:"clipboard_amp",label:n("HTML"),onClick:()=>Lt("html")}]}:{onClick:()=>Lt()}}),N.exportTextEnabled&&It.push({key:"text",label:n("Text"),icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"FileOutlined",component:_.icons$FileOutlined,style:Dt}),locked:I.isLocked,strokeWidth:N.iconStrokeWidth}),...I.isLocked?{onClick:()=>Ze("export_html")}:N.exportMarkdownEnabled?{children:Dr()}:Tt?{children:[{key:"сode_txt",label:n("AMP"),onClick:()=>Ye.isLocked?Ze("export_amp"):ct("amp")},{key:"html_txt",label:n("HTML"),onClick:()=>ct("html")}]}:{onClick:()=>ct()}}),N.exportOutlookEnabled&&It.push({key:"outlook",icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"FileWordOutlined",component:_.icons$FileWordOutlined,style:Dt}),locked:we.isLocked,strokeWidth:N.iconStrokeWidth}),label:n("Outlook"),onClick:()=>we.isLocked?Ze("export_platforms"):St(!!Tt)}),N.exportPdfEnabled&&It.push({key:"pdf",icon:(0,a.jsx)(qt,{icon:(0,a.jsx)(r.EmIcons,{icon:"FilePdfOutlined",component:_.icons$FilePdfOutlined,style:Dt}),locked:S.isLocked,strokeWidth:N.iconStrokeWidth}),label:n("PDF"),onClick:()=>S.isLocked?Ze("export_pdf"):fn()}),N.exportPngEnabled&&It.push({key:"img",icon:(0,a.jsx)(qt,{icon:R?(0,a.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:_.icons$LoadingOutlined,spin:!0,style:Dt}):(0,a.jsx)(r.EmIcons,{icon:"FileImageOutlined",component:_.icons$FileImageOutlined,style:Dt}),locked:ae.isLocked,strokeWidth:N.iconStrokeWidth}),label:n("PNG"),disabled:!ae.isLocked&&R,onClick:()=>ae.isLocked?Ze("export_png"):gn()});const ht=e.author;return(0,a.jsxs)(_.ui_kit$Space,{children:[N.emailDropdownMenuEnabled?(0,a.jsx)(_.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:dt},children:(0,a.jsx)(_.ui_kit$Button,{type:"default",block:!1,className:"email-page-header__btn email-page-header__btn_extra",onClick:()=>{},children:(0,a.jsx)(r.EmIcons,{icon:"DotsHoriz",component:_.icons$DotsHoriz,size:18,strokeWidth:N.iconStrokeWidth})})},"Actions"):N.emailDropdownMenuImport&&(0,a.jsx)(_.ui_kit$Tooltip,{title:o("Import","verb"),placement:"bottom",children:N.emailDropdownMenuImportButton?(0,a.jsx)(_.ui_kit$Button,{className:"em-analytics__editor-page__import",icon:(0,a.jsx)(r.EmIcons,{icon:"CloudUploadOutlined",component:_.icons$CloudUploadOutlined,size:16,strokeWidth:N.iconStrokeWidth}),onClick:()=>{be({event:"click",action:"import_email"}),je()},children:n("Import")}):(0,a.jsx)(_.ui_kit$Button,{className:"em-analytics__editor-page__import",type:"text",icon:(0,a.jsx)(r.EmIcons,{icon:"CloudUploadOutlined",component:_.icons$CloudUploadOutlined,size:22,strokeWidth:N.iconStrokeWidth}),onClick:()=>{be({event:"click",action:"import_email"}),je()}})}),N.emailExportEnabled&&(0,a.jsx)(_.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:It},children:(0,a.jsx)(_.ui_kit$Button,{className:"em-analytics__email-page__export",type:"default",icon:(0,a.jsx)(r.EmIcons,{icon:"CloudDownloadOutlined",component:_.icons$CloudDownloadOutlined,size:16,strokeWidth:N.iconStrokeWidth}),children:n("Export")},"Export")},"Export"),!e.hasOwnProperty("type")&&(0,a.jsx)(_s,{disabled:fe,email:e},"Save"),!!e.hasOwnProperty("type")&&(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(Au,{disabled:fe,rightCol:void 0,block:e,isEditableRights:p||f||g.id?.toString()===ht?.toString(),autoSaveBlockResult:t})},"Save"),(0,a.jsx)(Xp,{open:pe,codeSize:r.getCodeSize(Te),onMinimize:Bt,onDownloadAsIs:Le,onCancel:Xe}),Re&&mo(Re)&&(0,a.jsx)(lm,{integration:mo(Re),visible:!!Re,loading:et,onConfirm:jn,onCancel:On,__:n}),(0,a.jsx)(r.PlanUpgradePrompt,{open:X,sideOnOk:void 0,onCancel:()=>Ee(!1),initialSlide:Ie})]})},_r=r.createApi({reducerPath:"confirmationMailApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/",responseHandler:e=>e.text()}),endpoints:e=>({getConfirmationMail:e.query({query:({userId:t,email:n})=>({url:`?proxy_url=${encodeURIComponent(`https://webhook.latenode.com/5868/prod/1fbda9c1-3211-4b12-be45-9cd2ea73d73d?user_id=${t}&user_email=${n}`)}`})})})}),{useLazyGetConfirmationMailQuery:sf}=_r,af=()=>{const{__:e}=r.useI18n(),t=r.useNotification(),n=r.useCurrentUser(),[o]=sf(),[i,s]=(0,l.useState)(!1),c=r.usePushToDataLayer();(0,l.useEffect)(()=>{n.hasOwnProperty("email_confirmation")&&s(n.email_confirmation)},[n,i]);const d=()=>{c({event:"click",action:"click_resend_confirmation_email",user_email:n.email,user_id:n.id}),o({userId:n.id,email:n.email}).then(({data:u,error:p})=>{u?t.success(e("Confirmation email has been sent to {confirmedEmail}.").replace("{confirmedEmail}",n.email)):p&&t.error(p)})};return n?.email_confirmation||!n?.privacy_policy_agreement?null:(0,a.jsx)("div",{className:"main__ribbon",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(r.EmIcons,{icon:"EmailConfirmation",component:_.icons$EmailConfirmation,size:16,style:{marginRight:10,verticalAlign:"-0.15em"}}),e("Confirmation email was sent to")," ",(0,a.jsx)("em",{children:n.email}),". ",e("Didn't receive an email?")," ",(0,a.jsxs)(_.ui_kit$Button,{type:"primary",size:"small",className:"main__ribbon-resend",style:{fontSize:16,lineHeight:1,display:"inline-flex",alignItems:"center",gap:8},onClick:d,children:[e("Resend"),(0,a.jsx)(r.EmIcons,{icon:"SendOutlined",component:_.icons$SendOutlined,size:16,style:{flexShrink:0}})]})]})})},lf=({className:e,leftBlock:t,rightBlock:n,isHeaderCodeMenuOpen:o=!1})=>{const{token:i}=(0,_.ui_kit$useToken)(),s=(0,l.useRef)(),c=r.useAppConfig();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(af,{}),c.headerShow&&(0,a.jsx)("header",{className:(0,rt.default)("header",{[e]:e}),style:{borderColor:i.colorBorder},children:!o&&(0,a.jsx)(r.CSSTransition,{nodeRef:s,in:!o,timeout:300,classNames:"transition",children:(0,a.jsxs)("div",{className:"header__container container",children:[(0,a.jsx)("div",{className:"header__left",style:{flexGrow:1},children:t}),(0,a.jsx)("div",{className:"header__right",children:(0,a.jsx)(_.ui_kit$Space,{size:10,children:n})})]})})})]})},cf=e=>{},Ts=h.createIdentifier$1("canvas.headerFlow");function df(e){const t=(0,l.useCallback)(n=>e?e.subscribe(n):()=>{},[e]);return(0,l.useSyncExternalStore)(t,()=>e?.isReady()===!0)}var Is=({email:e,isCollaborationEditor:t})=>{const[n]=_.ui_kit$Form.useForm(),{__:o}=r.useI18n();let i=r.useDispatch();const s=r.useEmailAttributesWriter(),c=r.useAppNavigate(),d=r.useOpenPlanCatalog(),u=qi("header"),p=r.useCurrentUser(),f=r.useContainer().getInstance(Ts),g=r.useProjectData(),{owner:y,admin:m}=Qn(),{token:E}=(0,_.ui_kit$useToken)(),k=r.useAppConfig(),w=r.usePushToDataLayer(),v=(0,l.useRef)(),x=(0,l.useRef)(),P=(0,l.useRef)(),K=r.useEventEmitter(h.events.ON_PREVIOUSBUTTON_CLICK_ID),J=r.useEventEmitter(h.events.ON_PREHEADER_CHANGED_ID),N=r.useEventEmitter(h.events.ON_SUBJECT_CHANGED_ID),L=r.useSelector(r.selectCodeModeDirection),A=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,O=r.useSelector(r.selectElementSettings$1),z=r.useSelector(r.selectElementSettings),B=A==="email"?O:z,U=r.useSelector(r.selectIsCodeMode),[de,me]=(0,l.useState)(!1),[H,Z]=(0,l.useState)(!1),[De,ve]=(0,l.useState)(!1),et=(0,l.useCallback)(()=>ve(!1),[]),be=(0,l.useCallback)(()=>{ve(!1),d()},[d]),fe=Gi("email_generate"),Y=fe.exceeded?r.getLimitUpgradePresetDefinition(fe.exceeded.presetId):null;(0,l.useEffect)(()=>{const I=!!B?.type&&(B?.type===r.ELEMENT_TYPES.TEXT||B?.type===r.ELEMENT_TYPES.LINK||B.type===r.ELEMENT_TYPES.BUTTON)&&U&&L!=="bottom";me(I),i(r.setHeaderCodeMenuOpen(I))},[B,L,U]);const pe=(0,l.useCallback)(()=>{w({event:"click",action:"click_back_button",entity_type:A==="block"?"block":"email",entity_id:e?.id,project_id:e?.project||g?.id,context:"editor"}),K.fire(e)},[c,K,e,g?.id,w,A]),{document:ie}=r.useCurrentSession(),se=df(ie);r.usePrevious(([I])=>{se&&I!==e.subject&&N.fire(e.subject)},[e.subject,se]);const Ae=(0,l.useCallback)(I=>{const S=I.target.value;N.fire(S)},[N]),Te=(0,l.useCallback)(I=>{const S=I.target.value;J.fire(S)},[J]);r.usePrevious(([I])=>{se&&I!==e.preheader&&J.fire(e.preheader)},[e.preheader,se]);const Fe=(0,l.useCallback)((I,S="?")=>{I.subject?.length,I.preheader?.length,n.setFieldValue("subject",I.subject??""),n.setFieldValue("preheader",I.preheader??"")},[n]),X=(0,l.useRef)(void 0);(0,l.useEffect)(()=>{const I=e?.renderGuid??(e?.id!=null?String(e.id):void 0);!se||!I||X.current===I||(X.current=I,Fe(e,"identity"))},[se,e,Fe]);const Ee=(0,l.useCallback)(I=>{const S=I.target.value.trim();s({subject:S})},[s]),Ie=r.useEvent(h.events.BEFORE_SAVE_EMAIL),ge=(0,l.useCallback)(async I=>{const S=x.current?.input;if(document.activeElement===S){const we=S.value.trim();we!==I.subject&&(I.subject=we,s({subject:we}))}const ae=P.current?.input;if(document.activeElement===ae){const we=ae.value.trim();we!==I.preheader&&(I.preheader=we,s({preheader:we}))}await f?.whenDelivered()},[f,s]);(0,l.useEffect)(()=>{const I=Ie(ge);return()=>I.dispose()},[Ie,ge]);const Re=(0,l.useCallback)(I=>{const S=I.target.value.trim();s({preheader:S})},[s]),Ue=r.useEvent(h.events.ON_HEADER_APPLIED_ID);(0,l.useEffect)(()=>{const I=Ue(({field:S,value:ae})=>{n.setFieldValue(S,ae)});return()=>I.dispose()},[Ue,n]),cf(e.title===null?o("New email title"):e.title);const C=(0,l.useCallback)(()=>{i(r.setActiveSettingsTab(r.AICHAT)),setTimeout(()=>{const I=document.querySelector('li.ai-response-change-context[role="theme-and-preheader-generator"]');I&&I.click()},100)},[i]),T=(0,l.useCallback)(()=>{fe.isLocked?fe.state.state==="locked_by_limit"&&fe.exceeded?ve(!0):Z(!0):C()},[fe,C]),R=(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(_.ui_kit$Space,{ref:v,size:10,children:[k.headerArrowBackVisible&&(0,a.jsx)(_.ui_kit$Tooltip,{title:o("Back"),placement:"left",children:(0,a.jsx)(_.ui_kit$Button,{type:"text",icon:(0,a.jsx)(r.EmIcons,{icon:"ArrowLeftOutlined",component:_.icons$ArrowLeftOutlined,size:22,strokeWidth:k.iconStrokeWidth}),onClick:pe,shape:"circle"})}),(0,a.jsx)("div",{children:(k.headerTitleVisible||k.headerPreheaderVisible)&&(0,a.jsxs)(_.ui_kit$Form,{form:n,layout:"vertical",name:"subject_preheader_form",autoComplete:"off",initialValues:{subject:"",preheader:""},children:[k.headerTitleVisible&&(0,a.jsx)("div",{style:{marginTop:se?-3:0},children:(0,a.jsxs)(_.ui_kit$Space,{style:{width:"100%"},align:"baseline",size:12,children:[(0,a.jsx)("div",{className:"subject_preheader_form__title",children:o("Subject")}),se?(0,a.jsxs)("div",{className:"ant-page-header-heading",children:[(0,a.jsx)(_.ui_kit$Form.Item,{name:"subject",noStyle:!0,children:(0,a.jsx)(_.ui_kit$Input,{className:"ant-page-header-heading-title",ref:x,placeholder:o("Enter subject line here"),variant:"borderless",autoComplete:"off","data-lpignore":"true","data-1p-ignore":"","data-bwignore":"true","data-form-type":"other",onChange:Ae,onPressEnter:Ee,onBlur:I=>{Ee(I),document.querySelector(".ant-page-header-heading-title").closest(".ant-page-header-heading").classList.remove("focus")},onFocus:()=>{document.querySelector(".ant-page-header-heading-title").closest(".ant-page-header-heading").classList.add("focus")},disabled:k.lockPreheaderAndTitle})}),k.aiAssistentEnabled&&(0,a.jsx)(_.ui_kit$Tooltip,{title:o("Generate with AI"),children:(0,a.jsx)(r.EmIcons,{icon:"AI",component:_.icons$AI,size:12,strokeWidth:k.iconStrokeWidth,onClick:T})})]}):(0,a.jsx)(_.ui_kit$Skeleton.Input,{active:!0,size:16,style:{width:"40%",marginTop:3}})]})}),k.headerPreheaderVisible&&(0,a.jsx)("div",{children:(0,a.jsxs)(_.ui_kit$Space,{style:{width:"100%"},align:"baseline",size:12,children:[(0,a.jsx)("div",{className:"subject_preheader_form__title",children:o("Preheader")}),se?(0,a.jsxs)("div",{className:"ant-page-header-heading ant-page-header-heading_preheader",children:[(0,a.jsx)(_.ui_kit$Form.Item,{name:"preheader",noStyle:!0,children:(0,a.jsx)(_.ui_kit$Input,{className:"ant-page-header-heading-preheader",ref:P,placeholder:o("Enter preheader here"),variant:"borderless",autoComplete:"off","data-lpignore":"true","data-1p-ignore":"","data-bwignore":"true","data-form-type":"other",onChange:Te,onPressEnter:Re,onBlur:I=>{Re(I),document.querySelector(".ant-page-header-heading-preheader").closest(".ant-page-header-heading").classList.remove("focus")},onFocus:()=>{document.querySelector(".ant-page-header-heading-preheader").closest(".ant-page-header-heading").classList.add("focus")},disabled:k.lockPreheaderAndTitle})}),k.aiAssistentEnabled&&(0,a.jsx)(_.ui_kit$Tooltip,{title:o("Generate with AI"),children:(0,a.jsx)(r.EmIcons,{icon:"AI",component:_.icons$AI,size:12,strokeWidth:k.iconStrokeWidth,onClick:T})})]}):(0,a.jsx)(_.ui_kit$Skeleton.Input,{active:!0,size:16,style:{width:"80%",marginTop:2}})]})})]})})]})}),D=(0,a.jsxs)(a.Fragment,{children:[k.emailIdShow&&!!e.id&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"email-page-header__email-id",children:"ID"+e.id}),(0,a.jsx)(_.ui_kit$Divider,{orientation:"vertical"})]}),(0,a.jsx)(ps,{emailElement:e,isCollaborationEditor:t}),k.commandButtonsEnabled&&(0,a.jsxs)(a.Fragment,{children:[e.lock?(0,a.jsx)(r.EmIcons,{icon:"Lock",component:_.icons$Lock,size:18,strokeWidth:k.iconStrokeWidth,className:(0,rt.default)("lock-icon",{"lock-icon__disabled":!(y||m||p.id?.toString()===e.author?.toString())}),style:{color:E.colorPrimary,verticalAlign:"sub"}},"Lock"):null,(0,a.jsx)(of,{email:e,isHeaderCodeMenuOpen:de},"Buttons")]})]});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(lf,{className:"email-pane__header",leftBlock:u?R:null,rightBlock:u?D:null,isHeaderCodeMenuOpen:de}),(0,a.jsx)(r.PlanUpgradePrompt,{open:H,onCancel:()=>Z(!1),initialSlide:9}),Y&&fe.exceeded?(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(oo,{open:De,onClose:et,title:o(Y.titleKey),subtitle:o(Y.subtitleKey),usageResource:Y.usageResource,previousDisplay:r.presetLimitDisplay(fe.exceeded.previousLimit),nextDisplay:r.presetLimitDisplay(fe.exceeded.nextLimit),onChangePlan:be})}):null]})};Is.propTypes={};function uf(e){const t=r.parseEmBlockVersion(e);if(!t)return e;const n=o=>String(o).padStart(2,"0");return`${n(t.getDate())}.${n(t.getMonth()+1)}.${t.getFullYear()} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}var pf=({open:e,blocks:t,projectId:n,onClose:o})=>{const{__:i,_n:s}=r.useI18n(),c=r.useSendPostMessage(),d=r.useNotification(),[u,p]=(0,l.useState)({});(0,l.useEffect)(()=>{e&&p(Object.fromEntries(t.map(m=>[m.emBlockId,!0])))},[e,t]);const f=(0,l.useMemo)(()=>Object.values(u).filter(Boolean).length,[u]),g=(m,E)=>{p(k=>({...k,[m]:E}))},y=()=>{const m=t.filter(E=>u[E.emBlockId]);m.length&&(m.forEach(E=>{c({operation:r.EVENT_TYPES.SANDBOX_GLOBAL_BLOCK_REPLACE,settings:{emBlockId:E.emBlockId,blockHTML:E.savedHtml,type:"project",...n?{project:String(n)}:{}}})}),d.success({message:i("Updated")+" "+m.length+" "+s("block","blocks",m.length),placement:"bottomRight"}),o())};return(0,a.jsxs)(_.ui_kit$Modal,{title:(0,a.jsx)("div",{className:"ant-modal-title",children:i("Update global blocks")}),open:e,onOk:y,onCancel:o,footer:(0,a.jsxs)("div",{className:"update-global-blocks-modal__footer",children:[(0,a.jsx)(_.ui_kit$Button,{size:"large",onClick:o,children:i("Cancel")}),(0,a.jsx)(_.ui_kit$Button,{size:"large",type:"primary",disabled:f===0,onClick:y,children:i("Update")})]}),children:[(0,a.jsx)("div",{className:"update-global-blocks-modal__hint",children:i("These global blocks have a newer saved version. Select the ones to update in the template.")}),(0,a.jsx)("div",{className:"update-global-blocks-modal__list",children:t.map(m=>(0,a.jsxs)("div",{className:"update-global-blocks-modal__row",children:[(0,a.jsx)(_.ui_kit$Switch,{checked:!!u[m.emBlockId],onChange:E=>g(m.emBlockId,E)}),(0,a.jsxs)("span",{className:"update-global-blocks-modal__title",title:m.title,children:[m.title,(0,a.jsxs)("span",{className:"update-global-blocks-modal__version",children:[i("Version of")," ",uf(m.savedVersion)]})]}),m.instances>1&&(0,a.jsxs)("span",{className:"update-global-blocks-modal__count",children:[m.instances," ",s("instance","instances",m.instances)]})]},m.emBlockId))})]})};function mf(e){const t=new Map;return e?.trim()&&new DOMParser().parseFromString(e,"text/html").querySelectorAll('[em="block"][em-block-id]').forEach(n=>{const o=n.getAttribute("em-block-id");if(!o)return;const i=n.getAttribute("em-block-version")??void 0,s=t.get(o);s?(s.versions.add(i),s.count+=1):t.set(o,{versions:new Set([i]),count:1})}),t}function ff(e,t){const n=mf(e);if(!n.size||!t?.length)return[];const o=[];for(const i of t){if(!i.global_block||!i.id||!i.html)continue;const s=String(i.id),c=n.get(s);if(!c)continue;const d=r.readRootEmBlockAttrs(i.html).emBlockVersion;d&&[...c.versions].some(u=>u!==d)&&o.push({emBlockId:s,title:i.title?.trim()||s,savedHtml:i.html,savedVersion:d,templateVersion:[...c.versions][0],instances:c.count})}return o}var As="em-block-id";function gf({projectId:e,document:t}){const n=r.useEvent(h.events.ON_EMAIL_INIT_ID),o=r.useHeadless(),[i,s]=(0,l.useState)([]),[c,d]=(0,l.useState)(!1),[u,p]=(0,l.useState)(null),f=(0,l.useCallback)(E=>t?.subscribe(E)??(()=>{}),[t]),g=(0,l.useSyncExternalStore)(f,()=>!!t?.getContent().includes(As)),{data:y}=r.blocksApi.endpoints.getBlocks.useQuery(r.projectBlocksArgs(e),{skip:!e||!g}),m=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{g&&m.current&&t&&(m.current=!1,p(t.getContent()))},[g,t]),(0,l.useEffect)(()=>{const E=new h.Disposable;return E.addDisposable(n(k=>{if(k?.reset)return;const w=k?.html??"",v=w.includes(As);m.current=!v,p(v?w:null)})),()=>E.dispose()},[n]),(0,l.useEffect)(()=>{if(u==null||!y)return;if(o){p(null);return}const E=ff(u,y);E.length&&(s(E),d(!0)),p(null)},[u,y,o]),{outdatedBlocks:i,isOpen:c,close:(0,l.useCallback)(()=>d(!1),[])}}var hf=({open:e,html:t,emBlockId:n,onSaveAsNew:o,onClose:i})=>{const{__:s}=r.useI18n(),c=r.useSendPostMessage(),d=r.useNotification(),[u]=r.useEditBlockMutation(),[p,f]=(0,l.useState)(!1),g=async()=>{if(!n||!t){i();return}f(!0);const y=new Date,m=r.formatEmBlockVersion(y),E=r.injectEmBlockIdIntoBlockHtml(t,String(n),y),k=await u({blockId:String(n),html:E});if(f(!1),"error"in k&&k.error){d.error({message:s("Failed to update the global block."),placement:"bottomRight"});return}c({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:String(n),emBlockVersion:m}}),d.success({message:s("The global block was updated."),placement:"bottomRight"}),i()};return(0,a.jsx)(_.ui_kit$Modal,{title:(0,a.jsx)("div",{className:"ant-modal-title",children:s("Saving changes in the block")}),open:e,onCancel:i,footer:(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[(0,a.jsx)(_.ui_kit$Button,{size:"large",disabled:p,onClick:o,children:s("Create new block")}),(0,a.jsx)(_.ui_kit$Button,{size:"large",type:"primary",loading:p,onClick:g,children:s("Update current block")})]}),children:(0,a.jsx)("div",{children:s("This is a global block. You can create a new one to apply changes only in this email, or update the current one — then the changes will be applied everywhere this block is used.")})})},_f=(function(){var e=window.__useblocks__;if(e&&e.assetUrl)return e.assetUrl("converter-intro.bf4ee74d750b35ae2c10.png");if(e&&e.publicPath)try{return new URL("static/media/converter-intro.bf4ee74d750b35ae2c10.png",e.publicPath).href}catch{}try{return new URL("/static/media/converter-intro.bf4ee74d750b35ae2c10.png",typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"").href}catch{return"/static/media/converter-intro.bf4ee74d750b35ae2c10.png"}})(),yf={closable:!1},vf=_f,bf=({open:e,onConfirm:t,onCancel:n,neverSuggestAgain:o,onNeverSuggestAgainChange:i})=>{const{__:s}=r.useI18n();return(0,a.jsx)(_.ui_kit$Modal,{className:"convert-layout-modal",title:(0,a.jsx)("div",{className:"convert-layout-modal__title",children:s("Template conversion")}),open:e,onOk:t,onCancel:n,mask:yf,width:480,footer:(0,a.jsxs)("div",{className:"convert-layout-modal__footer",style:{display:"flex",flexDirection:"column",gap:16},children:[(0,a.jsx)(_.ui_kit$Switch,{size:"small",checked:o,onChange:i,label:s("Don't suggest again"),labelSize:"small"}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,a.jsx)(_.ui_kit$Button,{size:"large",onClick:n,children:s("Cancel")}),(0,a.jsx)(_.ui_kit$Button,{size:"large",type:"primary",onClick:t,children:s("Convert")})]})]}),children:(0,a.jsxs)("div",{className:"convert-layout-modal__content",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:24,padding:"0 8px",overflow:"hidden"},children:[(0,a.jsx)("div",{className:"convert-layout-modal__text convert-layout-modal__intro-text",style:{textAlign:"center"},children:s("This layout was not created in our editor. Convert it to unlock full editing capabilities: easily change texts, replace images, and manage blocks.")}),(0,a.jsx)("img",{src:vf,alt:"Converter Intro",className:"convert-layout-modal__image",style:{display:"block",width:"100%",maxWidth:"100%",height:"auto",borderRadius:8}})]})})},Ef={closable:!1},Sf=({open:e,message:t,onRetry:n,onCancel:o})=>{const{__:i}=r.useI18n();return(0,a.jsx)(_.ui_kit$Modal,{title:(0,a.jsx)("div",{className:"ant-modal-title",children:i("Conversion failed")}),open:e,onOk:n,onCancel:o,mask:Ef,footer:(0,a.jsxs)("div",{className:"convert-layout-modal__footer",children:[(0,a.jsx)(_.ui_kit$Button,{size:"large",onClick:o,children:i("Cancel")}),(0,a.jsx)(_.ui_kit$Button,{size:"large",type:"primary",onClick:n,children:i("Try again")})]}),children:(0,a.jsxs)("div",{className:"convert-layout-modal__text",children:[i("Something went wrong during layout conversion. You can try running the conversion again."),t?(0,a.jsx)("div",{className:"convert-layout-modal__error-details",children:t}):null]})})},wf=({open:e,progress:t})=>{const{__:n}=r.useI18n();return e?(0,a.jsx)("div",{className:"conversion-overlay",children:(0,a.jsxs)("div",{className:"conversion-overlay__content",children:[(0,a.jsx)(_.ui_kit$Spin,{size:"large"}),(0,a.jsx)("div",{className:"conversion-overlay__title",children:n("Converting layout…")}),(0,a.jsx)("div",{className:"conversion-overlay__hint",children:n("This may take several minutes. Please keep this tab open.")}),(0,a.jsx)(_.ui_kit$Progress,{className:"conversion-overlay__progress",percent:Math.round(t),status:"active",strokeColor:r.emCssVar("colorPrimary")})]})}):null},yr=r.createApi({reducerPath:"layoutConverterApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({createConvertJob:e.mutation({query:({html:t})=>({url:"/ai/converter/jobs",method:"POST",body:{html:t}})}),getConvertJobStatus:e.query({query:t=>({url:`/ai/converter/jobs/${t}`,method:"GET"})})})}),{useCreateConvertJobMutation:kf,useLazyGetConvertJobStatusQuery:Cf}=yr;function Tf(){try{return window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_layout_convert_never_suggest)==="true"}catch{return!1}}function If(e){try{e?window.localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_layout_convert_never_suggest,"true"):window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_layout_convert_never_suggest)}catch{}}function xs(e){return e==="beefree"?(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/79749848.js")).then(t=>t.convertBeeFreeToEmailMaker),void 0,{}.url):(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/e0d71533.js")).then(t=>t.convertStripoToEmailMaker),void 0,{}.url)}var Af=5,Ps=95,xf=35e3,Pf=1e3,Rf=e=>new Promise(t=>setTimeout(t,e));function jf(e,t){if(e&&typeof e=="object"){const n=e,o=n.data;if(o&&typeof o=="object"){const i=o.error;if(typeof i=="object"&&i?.message)return i.message;if(typeof i=="string"&&i)return i;if(o.message)return o.message}if(typeof o=="string"&&o)return o;if(n.error)return n.error;if(n.message)return n.message}return t}function Of(){const{__:e}=r.useI18n(),t=r.useContentReplacer(),n=r.useNotification(),o=vs(),{aiLayoutConverterEnabled:i,anyConverterEnabled:s}=o,c=r.useHeadless(),d=r.useEvent(h.events.ON_EMAIL_INIT_ID),u=r.useEvent(h.events.ON_LAYOUT_CONVERT_REQUEST_ID),[p]=kf(),[f]=Cf(),[g,y]=(0,l.useState)(Tf),m=(0,l.useRef)(g),E=(0,l.useCallback)(ie=>{m.current=ie,y(ie),If(ie)},[]),[k,w]=(0,l.useState)(!1),[v,x]=(0,l.useState)(!1),[P,K]=(0,l.useState)(0),[J,N]=(0,l.useState)(!1),[L,A]=(0,l.useState)(""),O=(0,l.useRef)(""),z=(0,l.useRef)(null),B=(0,l.useRef)(null),U=(0,l.useRef)(!1),de=(0,l.useRef)({cancelled:!0}),me=(0,l.useRef)(null);(0,l.useEffect)(()=>{U.current=v},[v]);const H=(0,l.useCallback)(()=>{me.current!==null&&(clearInterval(me.current),me.current=null)},[]),Z=(0,l.useCallback)(()=>{H();const ie=Date.now();me.current=setInterval(()=>{const se=Date.now()-ie,Ae=Ps*(1-Math.exp(-se/xf));K(Te=>Math.max(Te,Math.min(Ps,Ae)))},Pf)},[H]),De=(0,l.useCallback)(ie=>{ie&&(t(ie,{undoable:!0}),B.current=ie)},[t]),ve=(0,l.useCallback)(async ie=>{const se={cancelled:!1};de.current=se,N(!1);const Ae=z.current;if(Ae==="beefree"||Ae==="stripo"){try{const Te=await xs(Ae),Fe=se.cancelled?"":Te(ie);if(Fe&&!se.cancelled){De(Fe),n.success({message:r.isUseBlocksBuild()?e("Layout converted to Blocks format"):e("Layout converted to EmailMaker format"),placement:"bottomRight"});return}}catch{}if(!i){se.cancelled||(A(e("Layout conversion failed")),N(!0));return}}if(i){x(!0),K(0),Z();try{const Te=await p({html:ie}).unwrap();if(se.cancelled)return;let Fe=Te.retry_after>0?Te.retry_after:Af;for(;!se.cancelled;){if(await Rf(Fe*1e3),se.cancelled)return;const X=await f(Te.job_id).unwrap();if(se.cancelled)return;if(X.retry_after&&X.retry_after>0&&(Fe=X.retry_after),X.status==="completed"){H(),K(100),De(X.html??""),n.success({message:r.isUseBlocksBuild()?e("Layout converted to Blocks format"):e("Layout converted to EmailMaker format"),placement:"bottomRight"}),setTimeout(()=>{se.cancelled||(x(!1),K(0))},400);return}if(X.status==="failed")throw new Error(X.error?.message||e("Layout conversion failed"))}}catch(Te){if(se.cancelled)return;H(),x(!1),K(0),A(jf(Te,e("Layout conversion failed"))),N(!0)}}},[e,i,De,p,n,f,Z,H]),et=(0,l.useCallback)(()=>{w(!1);const ie=O.current;ie&&ve(ie)},[ve]),be=(0,l.useCallback)(()=>{w(!1),B.current=O.current},[]),fe=(0,l.useCallback)(()=>{N(!1);const ie=O.current;ie&&ve(ie)},[ve]),Y=(0,l.useCallback)(()=>{N(!1),B.current=O.current},[]),pe=(0,l.useCallback)((ie,se=!1)=>{const Ae=bs(ie,o);if(s&&!c&&Ae&&!U.current){if(se)B.current=null;else{if(m.current)return;if(B.current===ie)return}O.current=ie,z.current=Ae,Ae!=="ai"&&xs(Ae).catch(()=>{}),w(!0)}},[s,o,c]);return(0,l.useEffect)(()=>{if(!s)return;const ie=new h.Disposable;return ie.addDisposable(d(se=>{se?.reset||pe(se?.html??"")})),()=>ie.dispose()},[s,d,pe]),(0,l.useEffect)(()=>{if(!s)return;const ie=new h.Disposable;return ie.addDisposable(u(se=>{pe(se?.html??"",!0)})),()=>ie.dispose()},[s,u,pe]),(0,l.useEffect)(()=>()=>{de.current.cancelled=!0,H()},[H]),{isPromptOpen:k,isConverting:v,progress:P,isErrorOpen:J,errorMessage:L,confirmConversion:et,cancelPrompt:be,retryConversion:fe,closeError:Y,neverSuggestAgain:g,setNeverSuggestAgain:E}}var Lf=6e4,Rs=new Map;function Mf(e){const t=e?String(e):"",n=Rs.get(t);if(n&&(Rs.delete(t),!(Date.now()-n.at>Lf)))return n.promise}var ho={data:void 0,isSuccess:!1,isError:!1,error:void 0,isLoading:!1};function Nf(e){const t=r.useStore(),n=(0,l.useRef)(t);n.current=t;const[o,i]=(0,l.useState)(ho),s=e?String(e):void 0;return(0,l.useEffect)(()=>{if(!s){i(ho);return}let c=!1;return i({...ho,isLoading:!0}),(Mf(s)??r.resolveEmailPort(h.getContainer(n.current)).readEmail(s)).then(d=>{c||i({data:d??void 0,isSuccess:!0,isError:!1,error:void 0,isLoading:!1})}).catch(d=>{c||i({data:void 0,isSuccess:!1,isError:!0,error:d,isLoading:!1})}),()=>{c=!0}},[s]),o}var ob=2;function Df(){const e=r.useProjectData()?.id,t=!0,{data:n,isError:o,isFetching:i,refetch:s}=r.useGetProjectPlanQuery(e,{skip:t}),[c,d]=(0,l.useState)(0),u=(0,l.useRef)(!1),p=!!o,f=c>=2,g=(0,l.useCallback)(()=>{u.current=!1,d(0),s()},[s]);(0,l.useEffect)(()=>{},[p,i,s,c,t]),(0,l.useEffect)(()=>{},[p,e,f,t]);const y="ready";return(0,l.useMemo)(()=>({status:y,retry:g}),[y,g])}var ib=300,Ff=h.createIdentifier$1("prewarm.queue");function Bf(e){const t=[];let n=!1,o=!1,i;const s=()=>{i&&(i.unwatch(),e.clearTimer(i.timer),i=void 0)},c=()=>{const p=t.shift();if(!p)return;o=!0;const f=()=>{o=!1,u()};p.start().then(f,f)},d=()=>{s(),e.idle(()=>{if(!(o||t.length===0)){if(e.activity.inFlight()>0){u();return}c()}})};function u(){if(!n||o||i||t.length===0)return;const p=()=>e.setTimer(d,300),f={timer:e.activity.inFlight()===0?p():void 0,unwatch:e.activity.watch(()=>{e.clearTimer(f.timer),f.timer=e.activity.inFlight()===0?p():void 0})};i=f}return e.whenVisible(()=>{n=!0,u()}),{add(p){t.some(f=>f.name===p.name)||(t.push(p),u())},remove(p){const f=t.findIndex(g=>g.name===p);f>=0&&t.splice(f,1),t.length===0&&s()}}}function $f(e){return e.getOrCreateInstance(Ff,()=>Bf({activity:h.getNetworkActivity(e),whenVisible:t=>Ht(e).whenVisible(t),idle:Xt,setTimer:(t,n)=>window.setTimeout(t,n),clearTimer:t=>window.clearTimeout(t)}))}function Uf({projectId:e,project:t,emailProjectId:n,parentEmailId:o}){const i=r.useContainer(),s=r.useAppDispatch(),d=!!r.useCookieManager().get(r.APP_COOKIES.em_token);(0,l.useEffect)(()=>{const u=$f(i),p=[],f=[],g=(m,E)=>{f.push(m),u.add({name:m,start:()=>{const k=E();return p.push(k),Promise.resolve(k)}})},y=r.parentEmailSource(o);return y&&g("blocks.parentEmail",()=>s(r.blocksApi.endpoints.getParentEmailBlocks.initiate(r.parentEmailBlocksArgs(y)))),g("blocks.template",()=>s(r.blocksApi.endpoints.getTemplateBlocks.initiate(r.templateBlocksArgs()))),e&&g("blocks.list",()=>s(r.blocksApi.endpoints.getBlocks.initiate(r.projectBlocksArgs(e)))),g("blocks.schema",()=>s(r.blocksApi.endpoints.getBlocksSchema.initiate(void 0))),t?.id&&g("blocks.tags",()=>s(r.taxonomiesApi.endpoints.getTerms.initiate({project:t,kind:r.BLOCK_TAGS}))),()=>{f.forEach(m=>u.remove(m)),p.forEach(m=>m.unsubscribe())}},[i,s,e,t,n,o,d])}var _o="AUTOSAVE_RECOVERY";function zf(e,t,n=!1,o){const i=t?.get().serverId??void 0,{__:s}=r.useI18n(),c=r.useNotification(),d=r.useAppConfig(),u=r.useSelector(r.selectMonacoFocusing),p=r.useContainer(),f=p?.getInstance(Ts),g=(0,l.useRef)(0),y=r.useSelector(r.selectIsPanelHistoryCollapsed),m=r.useSelector(r.selectActiveSettingsTab),E=r.useDispatch(),k=(0,l.useSyncExternalStore)((0,l.useCallback)(L=>o?.subscribe(L)??(()=>{}),[o]),()=>o?.recoveryFacts()),w=d?.revisionService===!0,v=k?.isRecovering===!0,x=k?.applied,P=(0,l.useCallback)(()=>{E(r.markAppearanceNeedsUpdate());const L=e?.renderGuid,A=e?.preheader,O=e?.subject;L&&(A||O)&&f?.reassert({...A?{preheader:A}:{},...O?{subject:O}:{}})},[E,f,e?.preheader,e?.subject,e?.title,e?.common_styles,e?.renderGuid,t,o]);(0,l.useEffect)(()=>()=>{clearTimeout(g.current),o?.endForcedHeaders()},[i,o]),(0,l.useEffect)(()=>{w&&v&&c.info({key:_o,title:s("Loading latest changes..."),duration:0})},[w,v,c,s]);const K=(0,l.useRef)({emailId:void 0,seq:0});(0,l.useEffect)(()=>{if(!x||k?.emailId!==i||(K.current.emailId!==i&&(K.current={emailId:i,seq:0}),x.seq<=K.current.seq))return;K.current={emailId:i,seq:x.seq},P();const{phase:L}=x;!w||L==="normal"||(L==="found"?c.success({key:_o,title:s("Changes loaded"),duration:3}):L==="timeout"?c.warning({key:_o,title:s("Locally saved version applied"),description:s("Syncing with the server in the background..."),duration:5}):L==="bg"&&c.info({key:"AUTOSAVE_BG_SYNCED",title:s("Email synced with the server"),duration:3}))},[w,x,k?.emailId,i,P,c,s]),(0,l.useEffect)(()=>{if(!n)return;const L=A=>{A.preventDefault()};return window.addEventListener("beforeunload",L),()=>window.removeEventListener("beforeunload",L)},[n]);const J=!y||u||m==="Discuss",N=p?r.provideAutosaveUiFacts(p):void 0;(0,l.useEffect)(()=>{N?.set({...N.get()??{isUserBusy:!1,saveContext:{}},isUserBusy:J})},[N,J])}var Gf=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 Wf(e,t,n){return t<=0?e:new Promise((o,i)=>{let s=!1,c;const d=u=>{s||(s=!0,c!==void 0&&(clearTimeout(c),c=void 0),u())};c=setTimeout(()=>{d(()=>i(new Gf(n,t)))},t),e.then(u=>{d(()=>o(u))},u=>{d(()=>i(u))})})}var Hf=2,vr=Symbol("sandbox:frame-replaced");function an(e,t,n,o,i,s,c){const d=`sandbox:${t}`,u=s?.getSandboxTimeoutMs(t)??r.DEFAULT_SANDBOX_OP_TIMEOUT_MS[t],p=()=>{let E=Wf(e.sendAsync(n,o),u,d);return E=h.raceWithAbortSignal(E,s?.signal),r.logShowPipelineWait(d,E,i)};if(t==="INIT_START"&&Ki(e)){const E=s?.getSandboxReadyTimeoutMs()??2e4,k=e,w=v=>{const x=Yi(k,E,s?.signal);return r.logShowPipelineWait("sandbox:INIT_START:ready-wait",x,i).then(()=>{if(!c||v<=0)return p();const P=c.getGeneration();let K;const J=new Promise((L,A)=>{K=c.onChange(()=>{c.getGeneration()!==P&&A(vr)})}),N=p();return N.catch(()=>{}),Promise.race([N,J]).finally(()=>K?.()).catch(L=>{if(L!==vr)throw L;return{...i},w(v-1)})})};return w(Hf)}if(!c)return p();const f=c.getGeneration();let g;const y=new Promise((E,k)=>{g=c.onChange(()=>{c.getGeneration()!==f&&k(vr)})}),m=p();return m.catch(()=>{}),Promise.race([m,y]).finally(()=>g?.()).catch(E=>{throw E===vr&&{...i},E})}function js(e,t,n,o){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...o!==void 0?{rev:o}:{}}}var Os="self-init:";function qf(e){return e.startsWith(Os)}function Ls(e,t){const n=e.getActiveShowRequest();return qf(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Vf(e){const t=()=>e.initPipeline(),n=e.messageService,o=()=>e.waitScope?.()??t();let i="";const s=()=>e.readDocument()?r.readDocumentContent(e.readDocument()):i,c=()=>on(e.container).editorPolicy,d=()=>e.readEmail(),u=()=>{const p=d();return{...p,id:e.isTemplate()||p.isNew?void 0:p.id,html:s()}};return{readContent:s,publicEmail:u,sendInitStart:()=>an(n,"INIT_START",r.EVENT_TYPES.SANDBOX_INIT_START,{guid:d().renderGuid},void 0,o()),sendInited:()=>an(n,"INITED",r.EVENT_TYPES.SANDBOX_INITED,{guid:d().renderGuid},void 0,o()),async sendContent(){const p=d(),{html:f,hasBrowserExtensionArtifacts:g}=r.prepareEmailHtmlForEditor(p?.html||"");g&&e.events.browserExtensionDetected(),r.loadDocumentContent(e.readDocument(),f),i=f,await an(n,"SET_ENTITY",r.EVENT_TYPES.SANDBOX_SET_ENTITY,js(s(),p.renderGuid,c(),e.readDocument()?.get().version),{guid:p.renderGuid,emailId:p.id??null},o())},refreshContent:()=>an(n,"SET_ENTITY",r.EVENT_TYPES.SANDBOX_SET_ENTITY,js(s(),d().renderGuid,c(),e.readDocument()?.get().version),void 0,o()),sendPreheader:async()=>{const p=d();if(p.preheader!==void 0)return an(n,"PREHEADER",r.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:p.preheader,guid:p.renderGuid,force:!0},void 0,o())},sendSubject:async()=>{const p=d();if(p.subject!==void 0)return an(n,"SUBJECT",r.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:p.subject,guid:p.renderGuid,force:!0},void 0,o())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:p=>e.showFilled?.(p),readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(u()),fireInit(p,f){if(!Ls(t(),p)){t().getActiveShowRequest()?.showId;return}const g=d();g.id,g.renderGuid,t().completeShow(p),r.writeEmailAttributes(e.readDocument(),{is_inited:!0},{source:"system"});const y=u();return f&&(y.reset=!0),e.events.inited(y)},fireEmailChanged(){e.events.emailChanged(u())},fireContentChanged(){e.events.contentChanged(s())}}}function Kf(e){const t=()=>e.initPipeline();let n=!1,o,i,s,c=0,d;const u=Vf({...e,waitScope:()=>({getSandboxTimeoutMs:w=>t().getSandboxTimeoutMs(w),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:d?.signal??t().signal})});let p;const f=(w,v)=>{if(p===w)return;p=w;const x=c;setTimeout(()=>{c!==x||t().signal.aborted||E(w,v).catch(()=>{})},0)},g=()=>{d?.abort(),d=void 0};let y;const m=()=>{const w=t().signal;w!==y&&(y?.removeEventListener("abort",g),y=w,w.addEventListener("abort",g))};async function E(w,v){const x=++c;g(),d=new AbortController,m();const P=()=>c!==x,K=u.readTarget(),J=t().generation,N=()=>J===t().generation&&!t().signal.aborted,L=v?"init:reset-":"init:";if(!v){const z=u.publicEmail();z?.id,z?.renderGuid,z?.preheader}let A=!1,O=!1;try{n=!0,await u.sendInitStart(),u.fireWillInit(),await(v?u.refreshContent():u.sendContent()),A=!0,v||u.publicEmail()?.id;try{await u.sendPreheader()}catch(z){r.logShowPipelineError(`${L}preheader-failed`,{showId:w,error:String(z)})}try{await u.sendSubject()}catch(z){r.logShowPipelineError(`${L}subject-failed`,{showId:w,error:String(z)})}if(P()||u.showFilled(K),await u.sendInited(),O=!0,i===w){const z=e.readSandboxGeneration?.()??s;z!==void 0&&(o=z)}await u.revealFilled()}catch(z){throw P()||r.logShowPipelineError(`${L}failed`,{showId:w,contentApplied:A,sandboxInitedAcked:O,superseded:!1,...e.describeSurface?.(),error:String(z)}),!P()&&Ls(t(),w)&&t().failShow(w,z),z}finally{k(w,v,L,{superseded:P(),sessionGeneration:J,contentApplied:A,sandboxInitedAcked:O,commit:N()})}}function k(w,v,x,P){const{superseded:K,contentApplied:J,sandboxInitedAcked:N}=P;if(K){`${x}`;return}N&&P.commit?u.fireInit(w,v||void 0):N?r.logShowPipelineError(`${x}aborted (stale session or signal)`,{showId:w,sessionGeneration:P.sessionGeneration,currentGeneration:t().generation,aborted:t().signal.aborted}):J?r.logShowPipelineError(`${x}aborted (sandbox INITED ack missing)`,{showId:w}):r.logShowPipelineError(`${x}aborted (content not applied)`,{showId:w}),n=!1,d=void 0,!N&&i===w&&(i=void 0,o===s&&(o=void 0)),!N&&J&&f(w,v)}return{channel:u,isEventsLocked:()=>n,filledGeneration:()=>o,markFilled:w=>{o=w},lastCorrelation:()=>i,markCorrelation:w=>{i=w},bumpRunSeq:()=>{c+=1},noteSandboxGeneration:w=>{s=w},fill:w=>E(w,!1),refill:w=>E(w,!0),stop:()=>{c+=1,g(),n=!1,y?.removeEventListener("abort",g),y=void 0}}}function Yf(e,t,n){if(!e?.renderGuid||!e.showId||e.showId!==t.showId)return!1;if(t.isNew)return e.id==null;const o=t.emailId??t.navId;return o!=null&&String(e.id??"")!==String(o)?!1:Ms(e,n)}function Ms(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Qf(e){const{pipeline:t,readEmail:n,readDocument:o,readRouteEmailId:i,readSandboxGeneration:s}=e,c=f=>{const g=n(),y=i();if(!Yf(g,f,y)){f.showId,f.navId,f.emailId,g?.id,g?.showId,g?.renderGuid;return}f.showId,g?.id,g?.renderGuid,t.markFilled(s()),t.markCorrelation(f.showId),t.fill(f.showId).catch(()=>{})};return{showRequested:f=>{c(f)},showRequestIdentityChanged:()=>{const f=e.initPipeline().getActiveShowRequest();f&&c(f)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const f=s();if(t.filledGeneration()===f)return;const g=n(),y=i();if(!g?.renderGuid||!Ms(g,y))return;const m=`${Os}${g.renderGuid}`;t.markFilled(f),t.markCorrelation(m);const E=o()?.isReady()===!0;g.id,g.renderGuid,(E?k=>t.refill(k):k=>t.fill(k))(m).catch(()=>{t.lastCorrelation()===m&&t.markFilled(void 0)})},saasChanged:()=>{const f=n();f?.renderGuid,f?.showToken,f?.id}}}var Ns=h.createIdentifier$1("canvas.sandboxFill"),Xf=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}},Jf=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(h.createAbortError("Superseded by newer show()")),n.aborted?Promise.reject(h.createAbortError(n.reason)):(this._activeRequest=e,new Promise((o,i)=>{const s=setTimeout(()=>{this._settle(e.showId,()=>{i(new Xf(e.showId,t))})},t);s.unref?.();const c=()=>{this._settle(e.showId,()=>{i(h.createAbortError(n.reason))})};n.addEventListener("abort",c,{once:!0});const d=()=>{clearTimeout(s),n.removeEventListener("abort",c)};this._pending.set(e.showId,{request:e,resolve:o,reject:i,timeoutId:s,dispose:d});for(const u of this._listeners)u(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 Zf(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function eg(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=r.resolveContentReadyTimeoutMs(e),n=r.resolveSandboxReadyTimeoutMs(e),o=r.resolveSequentialSandboxOpBudgetMs(e.sandbox);t<n+o}var tg=class{_controller=new AbortController;_externalSignalDisposable=new h.Disposable;_sessionChangeListeners=new Set;_showRegistry=new Jf;_timeouts;_generation=0;_sessionStarted=!1;get signal(){return this._controller.signal}get generation(){return this._generation}get contentReadyTimeoutMs(){return r.resolveContentReadyTimeoutMs(this._timeouts)}getSandboxTimeoutMs(e){return r.resolveSandboxOpTimeoutMs(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return r.resolveSandboxReadyTimeoutMs(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=Zf(this._timeouts,e.timeouts),eg(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}abort(e){const t=e??h.createAbortError("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new h.Disposable}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new h.Disposable,this._showRegistry.rejectAll(h.createAbortError("Init session replaced")),this._controller.signal.aborted||this._controller.abort(h.createAbortError("Init session replaced")),this._controller=new AbortController,this._emitSessionReplaced()}_emitSessionReplaced(){for(const e of this._sessionChangeListeners)e()}_linkExternalSignal(e){if(!e)return;if(e.aborted){this._controller.signal.aborted||(this._controller.abort(e.reason??h.createAbortError()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??h.createAbortError()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},ng=(()=>{const e=new tg;return e.configure({}),e})();function yo(){const e=r.useStore();return(0,l.useMemo)(()=>h.getContainer(e)?.getInstance(h.INIT_PIPELINE_ID)??ng,[e])}function rg(e){const t=yo(),n=(0,l.useRef)(e);n.current=e,(0,l.useEffect)(()=>{let o;const i=()=>{o?.();const c=t.signal;if(c.aborted){n.current();return}const d=()=>n.current();c.addEventListener("abort",d),o=()=>c.removeEventListener("abort",d)};i();const s=t.onSessionReplaced(i);return()=>{s(),o?.()}},[t])}function og(e){const t=yo(),n=(0,l.useRef)(e);n.current=e,(0,l.useEffect)(()=>t.onShowRequested(o=>n.current(o)),[t])}var ig=(e,t,n,o,i)=>{const s=r.useStore(),c=r.useMessageService(),d=yo(),u=(0,l.useRef)(d);u.current=d;const p=r.useEventEmitter(h.events.WILL_EMAIL_INIT_ID),f=r.useEventEmitter(h.events.ON_EMAIL_INIT_ID),g=r.useEventEmitter(h.events.ON_CONTENT_CHANGED_ID),y=r.useEventEmitter(h.events.ON_EMAIL_CHANGED_ID),m=r.useEventEmitter(h.events.ON_BROWSER_EXTENSION_DETECTED_ID),E=e?.id!==void 0,k=e?.showToken??0,w=k,v=(0,l.useRef)(w);v.current=w;const x=(0,l.useRef)(void 0);x.current=e;const[P,K]=(0,l.useState)(()=>r.getSandboxGeneration(c)),J=(0,l.useRef)(P);J.current=P,(0,l.useEffect)(()=>(K(r.getSandboxGeneration(c)),r.onSandboxGenerationChange(c,()=>{K(r.getSandboxGeneration(c))})),[c]);const N=(0,l.useRef)(o);N.current=o;const L=(0,l.useRef)(t);L.current=t;const A=i?.standalone?void 0:h.getContainer(s)?.getInstance(Ns),O=!A,z=(0,l.useRef)(A?.pipeline);z.current||(z.current=Kf({container:h.getContainer(s),messageService:c,initPipeline:()=>u.current,readDocument:()=>N.current,readEmail:()=>x.current,isTemplate:()=>!!L.current,readSandboxGeneration:()=>J.current,events:{willInit:H=>p.fire(H),inited:H=>f.fire(H),contentChanged:H=>g.fire(H),emailChanged:H=>y.fire(H),browserExtensionDetected:()=>m.fire()}}));const B=z.current,U=(0,l.useRef)(n);U.current=n;const de=(0,l.useRef)(void 0);O&&!de.current&&(de.current=Qf({pipeline:B,initPipeline:()=>u.current,readEmail:()=>x.current,readDocument:()=>N.current,readRouteEmailId:()=>U.current,readSandboxGeneration:()=>J.current}));const me=de.current;B.noteSandboxGeneration(J.current),(0,l.useEffect)(()=>{if(O)return()=>z.current?.stop()},[O]),(0,l.useEffect)(()=>{A?.setRoute({emailId:n,isTemplate:t})},[A,n,t]),(0,l.useEffect)(()=>{const H=x.current;if(O&&!B.isEventsLocked()&&e?.renderGuid===H?.renderGuid&&H?.is_inited&&H){const Z=B.channel.readContent();y.fire({...H,id:t||H.isNew?void 0:H.id,html:Z})}},[B,e?.renderGuid,e?.preheader,e?.common_styles,e?.meta,e?.subject,e?.utm_parameters?.utm_campaign||"",e?.utm_parameters?.utm_content||"",e?.utm_parameters?.utm_medium||"",e?.utm_parameters?.utm_source||"",e?.utm_parameters?.utm_term||"",y,t,O]),(0,l.useEffect)(()=>{if(O){const H=r.subscribeToContent(o,()=>{const Z=x.current;if(!B.isEventsLocked()&&e?.renderGuid===Z?.renderGuid&&Z){const De=B.channel.readContent();g.fire(De),y.fire({...Z,id:t||Z.isNew?void 0:Z.id,html:De})}});return()=>H.dispose()}},[o,B,g,y,e,t,O]),rg(()=>{O&&B.stop()}),og(H=>{me?.showRequested(H)}),(0,l.useEffect)(()=>{me?.showRequestIdentityChanged()},[me,d,e?.renderGuid,e?.showId,e?.id,n]),(0,l.useEffect)(()=>{me?.selfInitChanged()},[me,d,e?.renderGuid,e?.showId,e?.id,n,o,P]),r.usePrevious(()=>{me?.saasChanged()},[e?.renderGuid,k,E,me]),Zr(async()=>{if(!O)return;const H=d.getActiveShowRequest()?.showId;H&&(B.markFilled(J.current),await B.refill(H))},{async:!0})};function sg(e){const t=r.useEvent(h.events.ON_EMAIL_INIT_ID);(0,l.useEffect)(()=>{if(!e)return;const n=t(()=>e.clear());return()=>n.dispose()},[e,t])}function ag(e,t){const n=r.useEventEmitter(h.events.ON_DOCUMENT_SESSION_CHANGE);(0,l.useEffect)(()=>{n.fire({document:e,history:t})},[e,t,n])}function lg({templateEmailId:e,templateEmail:t,newEmail:n}){return e?t:n}function cg({routeEmailId:e,draft:t}){const n=r.useStore();(0,l.useRef)(0),(0,l.useEffect)(()=>{},[n,e,t])}function dg(e,t){return t}function ug(e){return!1}function pg({documents:e,push:t,projectId:n,subscription:o}){(0,l.useEffect)(()=>e.onSaved(i=>{i.intent==="publish"&&t({event:"save",action:"save_email",email_id:i.serverId??void 0,project_id:n,subscription:o})}),[e,t,n,o])}function mg(e){const t=r.useStore();(0,l.useEffect)(()=>{},[t,e])}function fg(e,t,n){const o=r.useAppNavigate(),i=r.useContainer();(0,l.useEffect)(()=>{},[o,e,t,n,i])}function gg(e){if(!e)return{status:"unknown"};if("status"in e){const t=e.data,n=t&&typeof t=="object"?t.message:void 0,o=typeof n=="string"?n:typeof t=="string"?t:void 0;return{status:String(e.status),message:o}}return{status:e.name??"unknown",message:e.message}}function Ds(e,t,n){const{status:o,message:i}=gg(n);r.reportMessage(`Failed to load ${e} ${t??"?"}: ${o}`,{origin:"entity-load-error",tags:{mechanism:"entity-load-error",entity_type:e,http_status:o},level:"error",contexts:{entity_load_error:{entityType:e,entityId:t,status:o,message:i,url:window.location.href}}})}var{Content:hg}=_.ui_kit$Layout,_g={paddingTop:"40px"},yg=()=>{const{__:e}=r.useI18n(),{owner:t,admin:n}=Qn(),o=r.useDispatch(),i=Vr(),s=r.useAppNavigate(),{modal:c}=_.ui_kit$App.useApp(),d=r.useAppConfig(),u=r.useRootElement(),p=r.useCookieManager(),f=r.useMessageService(),{emailId:g,preview:y}=r.useRouteParams(),m=r.useEditorProjectId(),E=r.useAppSearchParams(),k=r.useSelector(r.selectIsCodeMode),w=r.useSelector(r.selectActiveModal),v=r.useCurrentUser(),x=r.useProjectData(),P=(0,l.useMemo)(()=>r.createNewEmailDraft(x?{id:Number(x.id),title:x.name}:void 0),[x]),K=r.useSelector(r.selectIsGlobalLoading),[J]=r.useLazyGetMeQuery(),{isSuccess:N,data:L}=r.useGetSubscriptionsQuery(),A=Df(),[O,z]=(0,l.useState)(!1),[B,U]=(0,l.useState)(!1),[de,me]=(0,l.useState)(),[H,Z]=(0,l.useState)(null),[De,ve]=(0,l.useState)(!1),[et,be]=(0,l.useState)(!1),[fe,Y]=(0,l.useState)(!1),[pe,ie]=(0,l.useState)(!1),[se,Ae]=(0,l.useState)(!1),Te=(0,l.useRef)(),{confirm:Fe}=c,{counters:X,subscription:Ee}=v,Ie=X?.emails_counter;p.get(r.APP_COOKIES.em_template_email);const ge=E.get("template")||!B&&!g&&p.get(r.APP_COOKIES.em_new_email),{isSuccess:Re,isLoading:Ue,isError:C,error:T,data:R}=Nf(g?void 0:ge),D=lg({templateEmailId:ge,templateEmail:R,newEmail:P});cg({routeEmailId:g,draft:D});const{document:I,email:S,error:ae}=r.useOpenEmail(),we=S?.id!=null?String(S.id):void 0,Ye=dg(g,we);(0,l.useEffect)(()=>{},[g,we,I,ge]),fg(g,S?.id,m);const Qe=r.useStore(),ze=r.getEmailDocuments(h.getContainer(Qe)),Ze=(0,l.useCallback)((ce,ke)=>ze.save(ce,ke),[ze]),pt=(0,l.useCallback)(()=>ze.saveState(),[ze]),bt=r.usePushToDataLayer();pg({documents:ze,push:bt,projectId:m,subscription:Ee?.post_title}),(0,l.useEffect)(()=>{!B&&S?.id&&U(!0)},[U,B,S?.id]);const ft=ze.history();ag(I,ft),sg(ft),ig(S,ug(g),Ye,I);const lt=Jr({document:I,history:ft});zf(S,I,ze.saveState().saving,ze),mg(m),(0,l.useEffect)(()=>{r.injectEmailRightsResolver(h.getContainer(Qe),ce=>!!(t||n||v.id?.toString()===ce?.author?.toString()))},[Qe,t,n,v.id]);const G=Kp({email:S,save:Ze,saveState:pt,documentSession:I}),{outdatedBlocks:V,isOpen:te,close:ue}=gf({projectId:m,document:I});Uf({projectId:m,project:x,emailProjectId:S?.project,parentEmailId:S?.parent_email});const he=w===r.MODALS.ADD_NEW_EBLOCK_MODAL,Ge=kn(he),qe=kn(fe),{isPromptOpen:st,isConverting:Bt,progress:Le,isErrorOpen:Xe,errorMessage:oe,confirmConversion:ee,cancelPrompt:$,retryConversion:le,closeError:xe,neverSuggestAgain:Se,setNeverSuggestAgain:Me}=Of(),We=ae??(ge?T:void 0),Be=!!We,ot=!S&&!Be,fn=!!S;(0,l.useEffect)(()=>{Be&&We&&Ds("email",g||ge,We)},[Be,We,g,ge]),(0,l.useEffect)(()=>{ge&&Re&&(U(!0),E.set({}))},[ge,Re,E]),(0,l.useEffect)(()=>(o(r.switchIsPanelHistoryCollapsed(!0)),()=>o(r.switchIsPanelHistoryCollapsed(!0))),[o]);const Ot=(0,l.useCallback)(()=>{i.toggle(),o(r.resetPanes())},[o,i]);(0,l.useEffect)(()=>{y&&!k&&Ot()},[k,y,Ot]),(0,l.useEffect)(()=>{document.body.classList.add("editor"),o(r.setActiveSettingsTab(r.BUILD))},[o]),(0,l.useEffect)(()=>{!O&&Ie<3&&(J(),z(!0))},[J,Ie,O]);const ct=(0,l.useCallback)(()=>{lt.undo()},[lt]),Et=(0,l.useCallback)(()=>{lt.redo()},[lt]);(0,l.useEffect)(()=>{Te.current!==S?.id&&(lt.clear(),Te.current=S?.id)},[S,lt]);const Lt=(0,l.useCallback)(ce=>{(window.navigator.appVersion.indexOf("Mac")&&ce.metaKey||ce.ctrlKey)&&ce.code==="KeyZ"&&(ce.preventDefault(),ce.shiftKey?Et():ct())},[ct,Et]);(0,l.useEffect)(()=>()=>{o(r.resetPanes()),o(r.closeModal()),o(r.closeModal$1()),o(r.resetElementHistorySlice())},[o]);const jn=(0,l.useCallback)(ce=>{const ke=()=>{o(r.openModal(r.MODALS.ADD_NEW_EBLOCK_MODAL))},Ne=ce.data.operation,nt=ce.data,je=ce.data.action,Yt=u.querySelector("#iframe-scroll-top"),$t=u.querySelector("#iframe-scroll-bottom");if(Ne===r.EVENT_TYPES.APPLICATION_EBLOCK_ADD){const dt=nt.settings?.emBlockId;dt?Z({html:nt.data,emBlockId:String(dt)}):(me(nt.data),ke())}if(Ne===r.EVENT_TYPES.APPLICATION_ACTION&&(je==="undo"?ct():je==="redo"&&Et()),Ne===r.EVENT_TYPES.APPLICATION_SCROLL_BLOCK_SHOW){const dt=u.querySelector("#email_iframe_slot"),Nn=document.body.getBoundingClientRect().height,Ut=dt.getClientRects()[0];Ut.top<0&&(Yt.style.display="block"),Ut.top+Ut.height>Nn&&($t.style.display="block")}Ne===r.EVENT_TYPES.APPLICATION_SCROLL_BLOCK_HIDE&&(Yt.style.display="none",$t.style.display="none")},[o,ct,Et,u]);r.useListenPostMessage(jn);const On=ce=>{if(ce.target?.closest?.(".file-manager, .ant-modal.file-manager"))return;const ke=ce.dataTransfer,Ne=(ke?Array.from(ke.types||[]):[]).includes(r.DND_SOCIAL_LIST_REORDER_MIME),nt=typeof ce.composedPath=="function"?ce.composedPath():[];ce.target?.closest?.(".selected-social-form")||nt.some(je=>je&&je.nodeType===1&&typeof je.classList?.contains=="function"&&je.classList.contains("selected-social-form"))||Ne||(ce.preventDefault(),ce.target&&f.send({operation:r.EVENT_TYPES.SANDBOX_DRAG_CANCEL}),u.querySelectorAll(".em-dragging-element").forEach(je=>{je.classList.remove("em-dragging-element")}))},gn=(0,l.useRef)({});(0,l.useEffect)(()=>{const ce=new h.Disposable,ke=Ne=>nt=>gn.current[Ne]?.(nt);return ce.addDisposable(r.addWindowListenerFromShadow(u,"drop",ke("drop"))),ce.addDisposable(r.addWindowListenerFromShadow(u,"dragover",ke("dragover"))),ce.addDisposable(r.addWindowListenerFromShadow(u,"dragstart",ke("dragstart"))),ce.addDisposable(r.addWindowListenerFromShadow(u,"dragend",ke("dragend"))),()=>{ce.dispose()}},[u]),(0,l.useEffect)(()=>(window.addEventListener("keydown",Lt),()=>{window.removeEventListener("keydown",Lt)}),[Lt]);const Ln=ce=>{if(ce.preventDefault(),ce.target?.closest?.(".file-manager, .ant-modal.file-manager"))return;const ke=u.querySelector("#iframe-scroll-top"),Ne=u.querySelector("#iframe-scroll-bottom"),nt=d.sidePanelFloating?u.querySelector("#pane-content-wrapper"):u.querySelector(".email-pane__col_preview"),je=u.querySelector(".blocks-app").getBoundingClientRect().top,{height:Yt,top:$t}=u.querySelector("#email_iframe_slot").getBoundingClientRect(),dt=nt.getBoundingClientRect().height;$t>96?ke.style.display==="block"&&(ke.style.display="none"):(ke.style.display==="none"||ke.style.display==="")&&(ke.style.display="block"),Yt-dt+$t-je<44?Ne.style.display==="block"&&(Ne.style.display="none"):Ne.style.display==="none"&&(Ne.style.display="block"),ce.target===ke&&nt.scrollBy(0,-15),ce.target===Ne&&nt.scrollBy(0,15)},Mn=()=>{const ce=u.querySelector("#iframe-scroll-top"),ke=u.querySelector("#iframe-scroll-bottom");ce&&ke&&(ce.style.display="none",ke.style.display="none"),u.querySelectorAll(".em-dragging-element").forEach(Ne=>{Ne.classList.remove("em-dragging-element")})},gt=ce=>{const ke=ce.target,Ne=ke instanceof Element?ke:ke.parentElement;if(!(Ne instanceof Element)||Ne.closest(".selected-social-form"))return;Ne.parentElement?.classList.add("em-dragging-element");const nt=!!Ne.closest(".blocks-search__result-wrapper");var je=nt?r.cloneBlockPreviewForDrag(Ne.querySelector(".blocks-search__result-html")):Ne.cloneNode(!0);je.classList.add("em-ghost-element"),je.style.height=nt?"auto":"70px",je.style.width=nt?"600px":"109px",je.style.position="absolute",je.style.top="0",je.style.left="0",je.style.zIndex="-1",Ne.appendChild(je),ce.dataTransfer.setDragImage(je,0,0),window.setTimeout(function(){je.parentNode.removeChild(je)},1e3)};gn.current={drop:On,dragover:Ln,dragstart:gt,dragend:Mn};const St=(0,l.useCallback)(()=>{Fe({title:e("You reached the plan limit"),icon:(0,a.jsx)(r.EmIcons,{icon:"ExclamationCircleOutlined",component:_.icons$ExclamationCircleOutlined}),content:(0,a.jsx)("div",{style:{maxWidth:"330px"},children:e("Switch to a different plan to save more emails.")}),centered:!0,okText:e("Choose a plan"),cancelText:e("Continue without saving"),width:"unset",onOk(){s("/billing")},onCancel(){}})},[s,e,Fe]);return(0,l.useEffect)(()=>{if(N&&L){const ce=L?.find(ke=>ke.id?.toString()===Ee?.ID?.toString())?.limits?.emails_limit;ce&&Ie>=ce&&!De&&!g&&t&&(St(),ve(!0))}},[L,N,Ee,Ie,De,St,g,t]),(0,l.useEffect)(()=>{const ce=f.onInit(()=>{f.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})});return()=>ce.dispose()},[f]),(0,a.jsx)(r.DocumentSessionProvider,{document:I,history:ft,children:(0,a.jsx)(hs.Provider,{value:G,children:(0,a.jsxs)(_.ui_kit$Layout,{className:"email-page",children:[ot&&(0,a.jsx)(_.ui_kit$PageLoader,{}),!ot&&A.status==="pending"&&(0,a.jsx)(_.ui_kit$PageLoader,{}),A.status==="error"&&(0,a.jsx)(hg,{style:_g,children:(0,a.jsx)("div",{className:"container",children:(0,a.jsx)(_.ui_kit$Result,{status:"warning",title:e("Failed to load plan data"),subTitle:e("Editor features depend on your plan. Check your connection and try again."),extra:(0,a.jsx)(_.ui_kit$Button,{type:"primary",onClick:A.retry,children:e("Try again")})})})}),Be&&We&&!1,S&&!ot&&A.status==="ready"&&(0,a.jsxs)(_.ui_kit$Layout,{className:"email-pane",children:[K&&(0,a.jsx)("div",{className:"email-pane__loader",children:(0,a.jsx)(_.ui_kit$PageLoader,{small:!0})}),(0,a.jsx)(Is,{email:S,isCollaborationEditor:et}),(0,a.jsx)(Np,{emailElement:S,isSuccess:fn,setIsCollaborationEditor:be,setIsShowAddAllBlocksModal:Y,triggerOpenSavedBlocksTab:pe})]}),Ge&&(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(Cu,{isModalVisible:he,htmlContent:de,projectId:m,setIsShowAddAllBlocksModal:Y,setIsShowAddAllBlocksModalForNewEmail:Ae,currentEmail:S})}),(0,a.jsx)(pf,{open:te,blocks:V,projectId:m,onClose:ue}),(0,a.jsx)(hf,{open:!!H,html:H?.html,emBlockId:H?.emBlockId,onSaveAsNew:()=>{me(H?.html),Z(null),o(r.openModal(r.MODALS.ADD_NEW_EBLOCK_MODAL))},onClose:()=>Z(null)}),qe&&(0,a.jsx)(l.Suspense,{fallback:null,children:(0,a.jsx)(Tu,{isModalVisible:fe,currentEmail:S,setIsShowAddAllBlocksModal:Y,setTriggerOpenSavedBlocksTab:ie,autoStart:!se,projectId:m})}),(0,a.jsx)(bf,{open:st,onConfirm:ee,onCancel:$,neverSuggestAgain:Se,onNeverSuggestAgainChange:Me}),(0,a.jsx)(wf,{open:Bt,progress:Le}),(0,a.jsx)(Sf,{open:Xe,message:oe,onRetry:le,onCancel:xe})]})})})};function vg(){const e=r.useStore(),t=r.getEmailDocuments(h.getContainer(e)),n=(0,l.useCallback)(o=>t.subscribe(o),[t]);return(0,l.useSyncExternalStore)(n,()=>!!t.current())}function bg(e,t){const n=r.useStore(),o=r.useAppConfig(),i=r.useStorageProvider();(0,l.useRef)(new Set),(0,l.useEffect)(()=>{},[e,t,o,n,i])}var Eg=30;function Sg(e){const t=r.useContainer(),n=r.useGetProjectQuery(+e,{skip:!e,refetchOnMountOrArgChange:Eg}),{isSuccess:o,isError:i,error:s,data:c,isFetching:d}=n;bg(e,o),(0,l.useEffect)(()=>{t&&r.setCurrentProjectRefreshing(t,d)},[t,d]),(0,l.useEffect)(()=>{t&&o&&c&&String(c.id)===String(e)&&r.setCurrentProjectCard(t,c)},[o,c,t,e]),(0,l.useEffect)(()=>{i&&s&&Ds("project",e,s)},[i,s,e]);const u=r.useProjectData(),p=!!u&&String(u.id)===String(e);return{...n,projectReady:p}}var An=r.createApi({reducerPath:"promoApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.emailmaker.ru/api/wp-json/promo/v1/"}),endpoints:e=>({checkPromo:e.mutation({queryFn:({code:t,type:n},o)=>r.clientFromApi(o).promo.set_code_create({code:t,type:n})}),getPromoInfo:e.query({queryFn({code:t},n){return r.clientFromApi(n).promo.get_code_info_list({code:t})}})})}),{useCheckPromoMutation:sb,useGetPromoInfoQuery:ab}=An;function wg(){const e=r.useContainer(),[t,n]=(0,l.useState)();return(0,l.useEffect)(()=>{if(!e)return;let o=!0;return r.getAppProject(e).then(i=>{o&&i!=null&&n(String(i))},()=>{}),()=>{o=!1}},[e]),t}var kg=()=>{const e=r.useDispatch(),t=r.useCookieManager(),n=r.useCurrentUser(),o=r.useContainer();(0,l.useEffect)(()=>{const s=n?.code_editor;s&&o&&r.applyEditorOptions(o,s)},[n,o]),(0,l.useEffect)(()=>{const s=t.get(r.APP_COOKIES.em_token),c=t.get(r.APP_COOKIES.promocode);s&&c&&(e(An.endpoints.checkPromo.initiate({code:c,type:"by_link"})),t.remove(r.APP_COOKIES.promocode))},[e,t]),r.useNotifyCommand();const i=vg();return Sg(wg()),i?(0,a.jsx)(Ql,{hasEmail:!0,children:(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(_.ui_kit$PageLoader,{}),children:(0,a.jsx)(yg,{})})}):null};function Cg(e,t){const n=(0,l.useRef)(!1);(0,l.useEffect)(()=>{!e||n.current||(n.current=!0,r.mark(r.PHASES.appVisible),t&&Ht(t).noteShellVisible())},[e,t])}var xn=new WeakMap,Tg="data-useblocks-config-styles";function Ig(e){return typeof e=="string"?e.trim():""}function Fs(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function Ag(e,t,n){if(!e||typeof document>"u")return null;const o=Ig(t),i=xn.get(e),s=n||e;if(!o)return i&&(i.remove(),xn.delete(e)),null;if(i)return i.textContent!==o&&(i.textContent=o),(i.parentNode!==s||i!==s.firstChild)&&Fs(s,i),i;const c=document.createElement("style");return c.setAttribute(Tg,"true"),c.textContent=o,Fs(s,c),xn.set(e,c),c}function vo(e){if(!e)return;const t=xn.get(e);t&&(t.remove(),xn.delete(e))}var xg={height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},Pg=({children:e,handleBeforeRender:t})=>{const[n,o]=(0,l.useState)(),i=r.useIsLocaleInited();Cg(i,r.useContainer());const s=r.useAppConfig().styles,c=(0,l.useRef)(null),d=(0,l.useRef)(!1),u=(0,l.useRef)(void 0),p=r.useRootElement();return(0,l.useLayoutEffect)(()=>{d.current||(d.current=!0,t&&t())},[]),(0,l.useLayoutEffect)(()=>{if(!p){u.current&&(vo(u.current),u.current=void 0);return}u.current&&u.current!==p&&vo(u.current),Ag(p,s,c.current||void 0),u.current=p},[p,s]),(0,l.useLayoutEffect)(()=>()=>{u.current&&(vo(u.current),u.current=void 0)},[]),(0,a.jsxs)(_.ui_kit$StyleProvider,{container:r.findShadowRoot(p)||document.head,children:[(0,a.jsxs)("div",{ref:c,className:"App blocks-app blocks-plugin",style:i?{}:{visibility:"hidden"},children:[(0,a.jsx)(r.ModalRootContext.Provider,{value:n,children:e}),(0,a.jsx)("div",{ref:o,className:"blocks-modal-container"})]}),!i&&(0,a.jsx)(_.ui_kit$Space,{size:"large",style:xg,children:(0,a.jsx)(_.ui_kit$Spin,{size:"large"})})]})};async function Rg({container:e,renderTarget:t,mapKey:n,disposable:o,chunkLoadedFire:i}){const s=await e.getInstanceAsync(h.STORE_ID);return new Promise(c=>{if(o.isDisposed()){c();return}const d=(0,nl.createRoot)(t),u=(0,a.jsx)(r.Provider,{store:s,children:(0,a.jsx)(Wl,{onLoad:c,children:(0,a.jsx)(r.RootContext.Provider,{value:{element:n},children:(0,a.jsx)(_.ui_kit$StyleProvider,{container:r.isDocumentFragment(n)?document.head:n,children:(0,a.jsx)(r.LocaleProvider,{children:(0,a.jsx)(Pg,{handleBeforeRender:i,children:(0,a.jsx)(pl,{children:(0,a.jsx)(Gl,{children:(0,a.jsx)(kg,{})})})})})})})})});d.render(u),o.addDispose(c),o.addDispose(()=>{try{d.unmount()}catch(p){if(p instanceof DOMException&&p.name==="NotFoundError"||p instanceof Error&&p.name==="NotFoundError"&&/removeChild/i.test(p.message)){r.logShowPipelineError("mount:unmount-dom-mismatch (host container was already removed)",{hint:"Usually harmless during host React StrictMode teardown. Ensure instance.destroy() runs before the host removes the mount container."});return}throw p}}),o.addDispose(()=>{h.ELEMENT_MAP.delete(n)})})}var lb="multiple init call on single HTMLELEMENT",jg=zn(async e=>{let t=null,n=!1;const o=h.getEmitter(e,h.events.ON_CHUNKS_LOADED),i=e.getInstance(h.DISPOSABLE_ID);let s,c=!1;const d=()=>{c||(c=!0,r.mark(r.PHASES.chunksLoaded),o.fire())},u=(p,f)=>Rg({container:e,renderTarget:p,mapKey:f,disposable:s,chunkLoadedFire:d});return{instance:{getElement(){return t}},async setOptions(p){const f=e.getInstance(h.INIT_PIPELINE_ID),g=await h.waitForElement(p.element,i,f.signal),y=e.getInstance(h.INSTANCE_ID),m=!!p.hidden&&!!g;if(t===g&&n===m)return;const E=t===g&&n&&!m;n=m,i.addDisposable(o.event(()=>{p.handleChunkLoaded&&p.handleChunkLoaded()})),t&&h.ELEMENT_MAP.delete(t),g&&h.ELEMENT_MAP.has(g),s&&s.dispose(),s=i.addDisposable(new h.Disposable);const k=p.element!==void 0;if(r.setHeadlessMode(e,!g||m),r.setHiddenMount(e,m),!g){r.mark(r.MOUNT_HEADLESS_MARK);const v=document.createElement("div");v.style.position="absolute",v.style.left="-10000px",v.style.top="-10000px",v.style.width="1600px",v.style.height="1000px",document.body.appendChild(v),t=v,d(),s.addDispose(()=>{v.parentNode===document.body&&v.remove()});return}const w=r.findShadowRoot(g);if(w&&s.addDisposable(new ul({shadowRoot:w})),k&&g instanceof Element){const v=g;il(v,()=>{i.isDisposed()||s?.isDisposed()||(r.logShowPipelineError("mount:detached (host removed element without destroy)",{elementId:v.id||null}),f.abort(ol()))},s)}if(m){r.mark(r.MOUNT_HEADLESS_MARK),t=g,d();return}if(k&&g instanceof Element){const v=g,x=cl(v);t=v;const P=u(x,v);return dl(v,x,s),P}return t=g,u(g,g)},dispose(){s&&!s.isDisposed()&&s.dispose()}}});function bo(e){return zn(async t=>(await t.getInstanceAsync(h.STORE_ID),await e(t)))}function Og({html:e,renderGuid:t,...n},o){const{requested:i}=r.getCurrentProject(o);return r.filterUndefined({...n,code:on(o).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 Lg(e,t){return r.filterUndefined({...e,link:void 0,comment_status:void 0})}function Mg({html:e,...t},n){return r.filterUndefined({...t,code:e,guid:void 0,compiled:r.filterUndefined({html:e,ampHtml:e&&""})})}var Bs=e=>{const t={current:Promise.resolve(),state:e,decorate:(n,o)=>(o&&(n=n.bind(o)),function(...i){const s=t.current.then(()=>n(...i));return t.current=s.then(c=>{t.state=c},c=>{}),s})};return t},Ng=h.createIdentifier$1("emailTemplate.reads");async function Dg(e,t){try{return await r.getRestEmailPortFactories(e).email(e).readEmail(t)??void 0}catch(n){r.logShowPipelineError("show:template-read-failed",{templateId:t,error:n instanceof Error?n.message:"неизвестная ошибка"});return}}function Fg(e,t){const n=e.getOrCreateInstance(Ng,()=>new Map),o=n.get(t);if(o!==void 0)return o;const i=Dg(e,t).then(s=>(s===void 0&&n.delete(t),s));return n.set(t,i),i}var kt=class extends h.Disposable{_event;_listener;_disposeEvent;constructor(e){super(),this._event=e}setListener(e){this._listener!==e&&(this._listener=e,this._disposeEvent&&this._disposeEvent(),e?this._disposeEvent=this._event(e):this._disposeEvent=void 0)}dispose(){this._disposeEvent&&this._disposeEvent(),super.dispose()}};function Ct(e,t,n){const o=h.snapshot(e);return(i,s,c)=>{const d=o(async u=>{const p=t?t(u):u;c&&i.bind(c);const f=await i(p);return n?n(f):f},s,c);return()=>d.dispose()}}var cb=h.createIdentifier("application_block_inserted"),db=h.createIdentifier$1("DataController"),ub=h.createIdentifier$1("DataEvents"),Bg=h.createIdentifier$1("plugin.startupShow");function $g(e){return e.getInstance(Bg)?.current??Promise.resolve()}var $s=bo(async()=>({instance:{}})),Us=bo(async e=>({instance:{},async setOptions(){await $g(e)}})),pb=h.combineMixins([$s,Us]),zs=()=>({title:"",description:"",website:"",company_size:"",industry:"",email:"",phone:"",logo_url:""}),Ug={title:"title",description:"description",website:"website",company_size:"company_size",industry:"industry",email:"email",phone:"phone",logo_url:"logo"},Gs=e=>({...zs(),title:e?.title??"",description:e?.description??"",website:e?.website??"",company_size:e?.company_size??"",industry:e?.industry??"",email:e?.email??"",phone:e?.phone??"",logo_url:e?.logo??""}),Ws=e=>(e??[]).filter(t=>!!t?.code).map(({code:t,label:n})=>({value:t,label:n??t})),zg=e=>({company_sizes:Ws(e?.company_sizes),industries:Ws(e?.industries)}),mb=Object.keys(zs()),Hs="ProjectProfile",Pn=r.createApi({reducerPath:"projectSettingsProfileApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),tagTypes:[Hs],endpoints:e=>({getProjectProfile:e.query({async queryFn(t,n){const o=r.v2ResultOf(await r.getClientV2(h.getContainer(n)).projects.profileList({id:String(t)}));return"error"in o?{error:o.error}:{data:Gs(o.data)}},providesTags:(t,n,o)=>[{type:Hs,id:String(o)}]}),getProjectProfileOptions:e.query({async queryFn(t,n){const o=r.v2ResultOf(await r.getClientV2(h.getContainer(n)).projects.profileOptionsList());return"error"in o?{error:o.error}:{data:zg(o.data)}}}),updateProjectProfileField:e.mutation({async queryFn({projectId:t,field:n,value:o},i){const s={[Ug[n]]:o},c=r.v2ResultOf(await r.getClientV2(h.getContainer(i)).projects.profilePartialUpdate({id:String(t)},s));return"error"in c?{error:c.error}:{data:Gs(c.data)}},async onQueryStarted({projectId:t},{dispatch:n,queryFulfilled:o}){try{const{data:i}=await o;n(Pn.util.updateQueryData("getProjectProfile",t,()=>i))}catch{}}})})}),{useGetProjectProfileQuery:fb,useGetProjectProfileOptionsQuery:gb,useUpdateProjectProfileFieldMutation:hb}=Pn,qs="ProjectStorage",Rn=r.createApi({reducerPath:"projectSettingsStorageApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),tagTypes:[qs],endpoints:e=>({getProjectStorage:e.query({async queryFn(t,n){const o=r.v2ResultOf(await r.getClientV2(h.getContainer(n)).projects.storageList({id:String(t)}));return"error"in o?{error:o.error}:{data:o.data}},providesTags:(t,n,o)=>[{type:qs,id:String(o)}]}),updateProjectStorage:e.mutation({async queryFn({projectId:t,body:n},o){const i=r.v2ResultOf(await r.getClientV2(h.getContainer(o)).projects.storageUpdate({id:String(t)},n));return"error"in i?{error:i.error}:{data:i.data}},async onQueryStarted({projectId:t},{dispatch:n,queryFulfilled:o}){const{data:i}=await o;n(Rn.util.upsertQueryData("getProjectStorage",t,i))}}),testProjectStorageConnection:e.mutation({async queryFn({projectId:t,body:n},o){const i=r.v2ResultOf(await r.getClientV2(h.getContainer(o)).projects.storageTestCreate({id:String(t)},n));return"error"in i?{error:i.error}:{data:i.data}}})})}),{useGetProjectStorageQuery:_b,useUpdateProjectStorageMutation:yb,useTestProjectStorageConnectionMutation:vb}=Rn,Gg=class{http;constructor(e){this.http=e}settings_summary_detail=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/settings-summary/${e}`,method:"GET",...n})},Vs=class{http;constructor(e){this.http=e}developer_credentials_detail=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/developer-credentials/${e}`,method:"GET",...n});developer_credentials_partial_update=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/developer-credentials/${e}`,method:"PATCH",...n});developer_credentials_rotate_secret_create=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/developer-credentials/${e}/rotate-secret`,method:"POST",...n});developer_credentials_verify_secret_create=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/developer-credentials/${e}/verify-secret`,method:"POST",...n})},Wg=class{http;constructor(e){this.http=e}developer_kit_postman_collection_list=(e={})=>this.http.request({path:"/projects/v1/developer-kit/postman-collection",method:"GET",...e})},Hg=class{http;constructor(e){this.http=e}billing_context_detail=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/billing-context/${e}`,method:"GET",...n});billing_context_payments_list=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/billing-context/${e}/payments`,method:"GET",query:t,...n})},qg=class{http;constructor(e){this.http=e}usage_detail=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/usage/${e}`,method:"GET",...n});usage_timeseries_list=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/usage/${e}/timeseries`,method:"GET",query:t,...n})},Ke={PLUGIN_INIT:"plugin_init",LINK_CHECK:"link_check",IMAGE_CHECK:"image_check",SPAM_ASSASSIN:"spam_assassin",AI_IMAGE:"ai_image",AI_WRITE:"ai_write",AI_REPHRASE:"ai_rephrase"},Zt={TODAY:"today",WEEK:"week",MONTH:"month",CUSTOM:"custom"},bb=[Ke.PLUGIN_INIT,Ke.LINK_CHECK,Ke.IMAGE_CHECK,Ke.SPAM_ASSASSIN,Ke.AI_IMAGE,Ke.AI_WRITE],ln={current:0,limit:null},Vg=()=>({pluginInit:{...ln},aiAssistant:{...ln},aiImage:{...ln},linkCheck:{...ln},imageCheck:{...ln},spamAssassin:{...ln}}),tt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Je=(e,t,n="")=>{for(const o of t){const i=e[o];if(typeof i=="string")return i;if(typeof i=="number"&&Number.isFinite(i))return String(i)}return n},Ft=(e,t,n=0)=>{for(const o of t){const i=e[o];if(typeof i=="number"&&Number.isFinite(i))return i;if(typeof i=="string"&&i.trim()&&Number.isFinite(Number(i)))return Number(i)}return n},Eo=(e,t,n=!1)=>{for(const o of t){const i=e[o];if(typeof i=="boolean")return i}return n},br=(e,t)=>{for(const n of t){const o=e[n];if(o===null)return null;if(typeof o=="number"&&Number.isFinite(o))return o;if(typeof o=="string"&&o.trim()&&Number.isFinite(Number(o)))return Number(o)}return null},Kg=new Set(Object.values(Ke)),Yg=e=>Kg.has(e)?e:null,en=e=>tt(e)&&"data"in e&&(e.ok===!0||typeof e.success=="boolean"||e.success===void 0)?e.data:e,cn=(e,t)=>{for(const n of t){const o=e[n];if(tt(o))return o}return null},Qg=(e,t)=>{for(const n of t){const o=e[n];if(!Array.isArray(o))continue;const i=o.filter(s=>typeof s=="string");if(i.length>0)return i}},Xg=e=>tt(e)?{clientId:Je(e,["clientId","client_id"]),clientSecretConfigured:Eo(e,["clientSecretConfigured","client_secret_configured"]),rotatedAt:Je(e,["rotatedAt","rotated_at"])||void 0,scopesSuggested:Qg(e,["scopesSuggested","scopes_suggested"])}:{clientId:"",clientSecretConfigured:!1},Ks=(e,t)=>{for(const n of t){const o=e[n];if(typeof o=="boolean")return o}},Jg=e=>{const t=Ks(e,["pluginConnected","plugin_connected","connected","is_connected"]);if(t!==void 0)return t;for(const n of["plugin","developer_credentials","developerCredentials"]){const o=cn(e,[n]);if(!o)continue;const i=Ks(o,["connected","plugin_connected","is_connected"]);if(i!==void 0)return i;const s=Je(o,["clientId","client_id"]),c=Eo(o,["clientSecretConfigured","client_secret_configured"]);if(s)return c}},Zg=e=>{const t=en(e);if(!tt(t))return{};const n=cn(t,["members"]);return{myRole:Je(t,["myRole","my_role","role"])||(n?Je(n,["myRole","my_role","role"]):"")||void 0,pluginConnected:Jg(t)}},eh=e=>tt(e)?{clientId:Je(e,["clientId","client_id"]),secret:Je(e,["secret","clientSecret","client_secret"])}:{clientId:"",secret:""},th=e=>{if(!tt(e))return null;const t=Je(e,["event","type","key"]),n=Yg(t);if(!n)return null;const o=e.delta??e.change??e.trend,i=o==null?null:typeof o=="number"&&Number.isFinite(o)?o:Number.isFinite(Number(o))?Number(o):null;return{event:n,total:Ft(e,["total","count","value"],0),delta:i}},Ys=e=>{if(!tt(e))return null;const t=Je(e,["date","day","x"]);if(!t)return null;const n={date:t},o=e.event_counts??e.eventCounts;if(tt(o)){for(const[i,s]of Object.entries(o))typeof s=="number"&&Number.isFinite(s)&&(n[i]=s);return n}for(const[i,s]of Object.entries(e))i==="date"||i==="day"||i==="x"||i==="event_counts"||i==="eventCounts"||typeof s=="number"&&Number.isFinite(s)&&(n[i]=s);return n},nh=e=>{const t=en(e);return tt(t)?(Array.isArray(t.chart)?t.chart:Array.isArray(t.series)?t.series:Array.isArray(t.time_series)?t.time_series:Array.isArray(t.history)?t.history:[]).map(Ys).filter(n=>n!==null):[]},rh=e=>{if(!tt(e))return{current:0,limit:null};const t=Ft(e,["current","count","used","value","total"],0),n=br(e,["limit","max","quota","cap"]);return{current:t,limit:n===null?null:n}},dn=(e,t)=>{for(const n of t)if(n in e)return rh(e[n]);return{current:0,limit:null}},un={pluginInit:[Ke.PLUGIN_INIT,"plugin_init","pluginInit"],aiAssistant:["ai_assistant","aiAssistant","ai"],aiImage:[Ke.AI_IMAGE,"ai_image","ai_img","aiImg"],linkCheck:[Ke.LINK_CHECK,"link_check","linkCheck"],imageCheck:[Ke.IMAGE_CHECK,"image_check","imageCheck"],spamAssassin:[Ke.SPAM_ASSASSIN,"spam_assassin","spamAssassin","spam_check","spamCheck"]},So=e=>{const t=Vg(),n=en(e),o=tt(n)&&tt(n.usage)?n.usage:n;if(!tt(o))return t;const i=Ft(o,["operationsTotal","operations_total"],0),s=Ft(o,["operationsLast30d","operations_last_30d"],0),c=cn(o,["metrics","counters","limits","events","usage_by_event","usageByEvent"])??o;return{pluginInit:dn(c,un.pluginInit),aiAssistant:dn(c,un.aiAssistant),aiImage:dn(c,un.aiImage),linkCheck:dn(c,un.linkCheck),imageCheck:dn(c,un.imageCheck),spamAssassin:dn(c,un.spamAssassin),lastActivityAt:Je(o,["lastActivityAt","last_activity_at"])||void 0,operationsTotal:i>0?i:void 0,operationsLast30d:s>0?s:void 0}},Qs=(e,t)=>{const n=[{event:Ke.LINK_CHECK,total:e.linkCheck.current,delta:null},{event:Ke.IMAGE_CHECK,total:e.imageCheck.current,delta:null},{event:Ke.SPAM_ASSASSIN,total:e.spamAssassin.current,delta:null},{event:Ke.AI_IMAGE,total:e.aiImage.current,delta:null}],o=t?nh(t):[];return o.length>0?{cards:n,chart:o}:{cards:n,chart:[]}},oh=e=>{const t=en(e);if(!tt(t))return Qs(So(e),e);const n=Array.isArray(t.cards)?t.cards:Array.isArray(t.summary)?t.summary:[],o=Array.isArray(t.chart)?t.chart:Array.isArray(t.series)?t.series:[];return n.length>0||o.length>0?{cards:n.map(th).filter(i=>i!==null),chart:o.map(Ys).filter(i=>i!==null)}:Qs(So(t),t)},ih=e=>{if(!tt(e))return null;const t=Je(e,["id","payment_id"]);return t?{id:t,date:Je(e,["date","created_at","paid_at"]),amount:Ft(e,["amount","sum"],0),currency:Je(e,["currency"],"RUB"),status:Je(e,["status"],"unknown"),receiptUrl:Je(e,["receiptUrl","receipt_url","pdf_url"])||void 0}:null},sh=e=>{const t=en(e),n=tt(t)&&Array.isArray(t.payments)?t.payments:[];return{payments:n.map(ih).filter(o=>o!==null),page:tt(t)?Ft(t,["page"],1):1,perPage:tt(t)?Ft(t,["perPage","per_page"],20):20,total:tt(t)?Ft(t,["total"],n.length):n.length,totalPages:tt(t)?Ft(t,["totalPages","total_pages"],1):1}},ah=e=>{const t=en(e);if(!tt(t))return{viewerSeesBilling:!1};const n=cn(t,["endpoints"])??{},o=cn(t,["documentLinks","document_links"]),i=o?Object.fromEntries(Object.entries(o).filter(f=>typeof f[1]=="string")):void 0,s=br(t,["ownerUserId","owner_user_id"]),c=cn(t,["tariff","plan","subscription"]),d=Je(t,["planDescription","plan_description"])||(c?Je(c,["description","about","plan_description"]):"")||void 0,u=br(t,["planPrice","plan_price","price","amount"])??(c?br(c,["price","amount"]):null),p=Je(t,["planCurrency","plan_currency","currency"])||(c?Je(c,["currency"]):"")||void 0;return{viewerSeesBilling:Eo(t,["viewerSeesBilling","viewer_sees_billing"]),ownerUserId:s??void 0,planName:Je(t,["planName","plan_name"])||void 0,planDescription:d,planPrice:u??void 0,planCurrency:p||void 0,endpoints:{limitsStats:Je(n,["limitsStats","limits_stats"])||void 0,subscriptionMe:Je(n,["subscriptionMe","subscription_me"])||void 0,payments:Je(n,["payments"])||void 0},documentLinks:i&&Object.keys(i).length>0?i:void 0}},lh={myRole:"owner"},ch=()=>({...lh}),dh={clientId:"rust-awkward-bear",clientSecretConfigured:{}.REACT_APP_PLUGIN_SETTINGS_MOCK_CONNECTED!=="false"},Xs=()=>({...dh,clientSecretConfigured:{}.REACT_APP_PLUGIN_SETTINGS_MOCK_CONNECTED!=="false"}),Js=Object.values(Ke),uh={[Ke.PLUGIN_INIT]:42,[Ke.LINK_CHECK]:-15,[Ke.IMAGE_CHECK]:28,[Ke.SPAM_ASSASSIN]:9,[Ke.AI_IMAGE]:6,[Ke.AI_WRITE]:-11,[Ke.AI_REPHRASE]:4},ph=(e,t)=>{const n={date:e};return Js.forEach((o,i)=>{const s=Math.sin(t*.65+i*.9),c=t*(i%2===0?.35:.2),d=2+i;n[o]=Math.max(0,Math.round(d+s*4+c))}),n},mh=e=>Js.map(t=>({event:t,total:e.reduce((n,o)=>n+(typeof o[t]=="number"?o[t]:0),0),delta:uh[t]})),fh=({period:e,dateFrom:t,dateTo:n})=>{const o=(0,En.default)().startOf("day");if(e===Zt.WEEK)return{startDate:o.subtract(6,"day"),days:7};if(e===Zt.MONTH)return{startDate:o.subtract(29,"day"),days:30};if(e===Zt.CUSTOM&&t&&n){const i=(0,En.default)(t),s=(0,En.default)(n);return{startDate:i,days:Math.max(1,s.diff(i,"day")+1)}}return{startDate:o,days:1}},wo=(e={period:Zt.TODAY})=>{const{startDate:t,days:n}=fh(e),o=Array.from({length:n},(i,s)=>ph(t.add(s,"day").format("YYYY-MM-DD"),s));return{cards:mh(o),chart:o}},Eb=wo({period:Zt.WEEK}),gh={pluginInit:{current:0,limit:null},aiAssistant:{current:0,limit:null},aiImage:{current:42,limit:100},linkCheck:{current:128,limit:500},imageCheck:{current:64,limit:200},spamAssassin:{current:31,limit:150},lastActivityAt:"2026-05-02T12:00:00Z"},Zs={payments:[{id:"98765",date:"2026-05-12T10:15:00+00:00",amount:990,currency:"RUB",status:"success",receiptUrl:"https://receipts.example/98765.pdf"},{id:"98764",date:"2026-04-12T10:15:00+00:00",amount:990,currency:"RUB",status:"success"},{id:"98763",date:"2026-03-12T10:15:00+00:00",amount:990,currency:"RUB",status:"failed"}],page:1,perPage:20,total:3,totalPages:1},hh={viewerSeesBilling:!0,ownerUserId:1,planName:"Corporate",planDescription:"For fully addressing all necessary tasks in any field.",planPrice:3200,planCurrency:"RUB",endpoints:{limitsStats:"/wp-json/limits/v1/stats",subscriptionMe:"/wp-json/subscription/v2/me",payments:"/wp-json/projects/v1/billing-context/2581/payments"}},_h={info:{name:"EmailMaker Plugin Requests",schema:"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},item:[]},yh=e=>e,vh=()=>!1,bh=()=>!1,Eh=e=>e,pn="ProjectPlugin",Sh=()=>({}).REACT_APP_PLUGIN_SETTINGS_USE_MOCK==="true",Vt=(e,t,n)=>e.error&&Sh()?{data:n(t)}:r.transformResponseFn(n)(e),wh=e=>yh(Xg(e)),kh=e=>Eh(ah(e)),Ch=({period:e,dateFrom:t,dateTo:n})=>{if(e===Zt.CUSTOM){const o={};return t&&(o.date_from=t),n&&(o.date_to=n),o}return{period:e??Zt.TODAY}},Er=r.createApi({reducerPath:"projectSettingsPluginApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api".replaceAll(/[\\/]$/g,"")}),tagTypes:[pn],endpoints:e=>({getPluginSummary:e.query({queryFn({projectId:t},n){return h.getApi(h.getContainer(n),[Gg]).settings_summary_detail({projectId:t}).then(o=>Vt(o,ch(),Zg))},providesTags:(t,n,{projectId:o})=>[{type:pn,id:o}]}),getPluginCredentials:e.query({queryFn({projectId:t},n){return h.getApi(h.getContainer(n),[Vs]).developer_credentials_detail({projectId:t}).then(o=>Vt(o,Xs(),wh))},providesTags:(t,n,{projectId:o})=>[{type:pn,id:`credentials-${o}`}]}),rotatePluginSecret:e.mutation({queryFn({projectId:t},n){return h.getApi(h.getContainer(n),[Vs]).developer_credentials_rotate_secret_create({projectId:t}).then(o=>Vt(o,{clientId:Xs().clientId,secret:"mock-rotated-secret"},eh))},invalidatesTags:(t,n,{projectId:o})=>[{type:pn,id:`credentials-${o}`}]}),getPostmanCollection:e.query({queryFn({projectId:t},n){return h.getApi(h.getContainer(n),[Wg]).developer_kit_postman_collection_list({extraQuery:{project_id:String(t)}}).then(o=>Vt(o,_h,i=>en(i)??i))}}),getPluginAnalytics:e.query({queryFn({projectId:t,period:n,dateFrom:o,dateTo:i},s){const c={period:n,dateFrom:o,dateTo:i};return vh()?Promise.resolve({data:wo(c)}):r.getClient(h.getContainer(s)).request({path:`/projects/v1/usage/${t}/timeseries`,method:"GET",query:Ch(c)}).then(d=>Vt(d,wo(c),oh))}}),getPluginBillingContext:e.query({queryFn({projectId:t},n){return h.getApi(h.getContainer(n),[Hg]).billing_context_detail({projectId:t}).then(o=>Vt(o,hh,kh))},providesTags:(t,n,{projectId:o})=>[{type:pn,id:`billing-${o}`}]}),getPluginUsage:e.query({queryFn({projectId:t},n){return h.getApi(h.getContainer(n),[qg]).usage_detail({projectId:t}).then(o=>Vt(o,gh,So))}}),getPluginPayments:e.query({queryFn({projectId:t,page:n=1,perPage:o=20},i){return bh()?Promise.resolve({data:Zs}):r.getClient(h.getContainer(i)).request({path:`/projects/v1/billing-context/${t}/payments`,method:"GET",query:{page:String(n),per_page:String(o)}}).then(s=>Vt(s,Zs,sh))},providesTags:(t,n,{projectId:o})=>[{type:pn,id:`payments-${o}`}]})})}),{useGetPluginSummaryQuery:Sb,useGetPluginCredentialsQuery:wb,useRotatePluginSecretMutation:kb,useLazyGetPostmanCollectionQuery:Cb,useGetPluginAnalyticsQuery:Tb,useGetPluginBillingContextQuery:Ib,useGetPluginPaymentsQuery:Ab,useGetPluginUsageQuery:xb}=Er,ea="EmailRaw",Sr=r.createApi({reducerPath:"emailRawApi",tagTypes:[ea],baseQuery:r.fetchBaseQuery({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getEmailRaw:e.query({queryFn:function({emailId:t,secret_hash:n},o){return h.getApi(h.getContainer(o),[h.WpEmailApi]).email_detail({id:t},{extraQuery:{secret_hash:n}}).then(r.transformResponseFn(r.WpEmailToEmail))},providesTags:(t,n,o)=>[{type:ea,id:o}]})})}),{useGetEmailRawQuery:Pb}=Sr,wr=r.createApi({reducerPath:"yandexAuthApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({validateYandexToken:e.mutation({query:t=>({url:"/auth/yandex",method:"POST",body:t})})})}),{useValidateYandexTokenMutation:Rb}=wr,kr=r.createApi({reducerPath:"elamaAuthApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({validateElamaCode:e.mutation({query:t=>({url:"/auth/elama",method:"POST",body:t})})})}),{useValidateElamaCodeMutation:jb}=kr,Cr=r.createApi({reducerPath:"googleAuthApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({validateGoogleToken:e.mutation({query:t=>({url:"/auth/google",method:"POST",body:t})})})}),{useValidateGoogleTokenMutation:Ob}=Cr,ta=async e=>{const t=await e.text();let n=t;try{n=JSON.parse(t)}catch{n=t}return n},Th=(e,t,n)=>{if(!e)throw new Error(`Set ${n}`);return{url:`?proxy_url=${encodeURIComponent(e)}`,method:"POST",headers:{"Content-Type":"application/json"},body:t,responseHandler:ta}},Ih=(e,t,n)=>{if(!e)throw new Error(`Set ${n}`);return{url:`?proxy_url=${encodeURIComponent(e)}`,method:"POST",body:t,responseHandler:ta}},Tr=r.createApi({reducerPath:"requestPlaneApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({getRequest:e.mutation({query:t=>Ih("https://webhook.latenode.com/5868/prod/5c07527e-9d53-467a-a148-87220d46e9ae",t,"REACT_APP_PIPEDREAM_REQUEST_PLANE_SRC")}),getInvoiceRequest:e.mutation({query:t=>Th("https://webhook.latenode.com/5868/prod/5c07527e-9d53-467a-a148-87220d46e9ae",t,"REACT_APP_REQUEST_PLANE_WEBHOOK_URL")})})}),{useGetRequestMutation:Lb,useGetInvoiceRequestMutation:Mb}=Tr,Ir=r.createApi({reducerPath:"getCheckoutUrlApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({GetCheckoutUrl:e.mutation({query:t=>({url:`?proxy_url=${encodeURIComponent("https://webhook.latenode.com/5868/prod/5072387e-5ace-4ca7-9a25-2f952a7075af")}`,method:"POST",body:t})})})}),{useGetCheckoutUrlMutation:Nb}=Ir,ko=r.createApi({reducerPath:"recoverPasswordApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://app.useblocks.io/api/wp-json/bdpwr/v1/"}),endpoints:()=>({})}),Ar=r.createApi({reducerPath:"addUserToProjectApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/wp-json/user_to_project/v1/add_user"}),endpoints:e=>({addUserToProject:e.mutation({queryFn(t,n){return r.clientFromApi(n).userToProject.add_user_create(t,{type:h.ContentType.FormData})}})})}),{useAddUserToProjectMutation:Db}=Ar,xr=r.createApi({reducerPath:"recurrenceSubscriptionsOffApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({getCanselRecurrence:e.query({query:t=>({url:`?proxy_url=${encodeURIComponent(`https://webhook.latenode.com/5868/prod/38815aec-cb5d-4b40-8dcb-75e7453573a0?subscription_id=${t.sid}&user_id=${t.uid}`)}`})})})}),{useLazyGetCanselRecurrenceQuery:Fb,useGetCanselRecurrenceQuery:Bb}=xr,Pr=r.createApi({reducerPath:"recurrenceSubscriptionsOnApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({getRecurrence:e.query({query:t=>({url:`?proxy_url=${encodeURIComponent(`https://webhook.latenode.com/5868/prod/7ac13d46-e4af-4dea-ab21-aab55415575b?subscription_id=${t.sid}&user_id=${t.uid}`)}`})})})}),{useLazyGetRecurrenceQuery:$b,useGetRecurrenceQuery:Ub}=Pr,Ah="https://app.useblocks.io/api/v2",Rr=r.createApi({reducerPath:"authApi",baseQuery:r.fetchBaseQueryApp({baseUrl:Ah,prepareHeaders:e=>{const t=r.api.get(r.APP_COOKIES.em_token);return t&&!e.has("authorization")&&e.set("authorization",`Bearer ${t}`),e}}),endpoints:e=>({login:e.mutation({query:t=>({url:"/auth/token",method:"POST",body:t})}),register:e.mutation({query:t=>({url:"/auth/register",method:"POST",body:t})}),refreshToken:e.mutation({query:t=>({url:"/auth/token/refresh",method:"POST",body:t})}),logout:e.mutation({query:()=>({url:"/auth/token",method:"DELETE"})}),getUser:e.query({query:()=>"/auth/user",transformResponse:t=>{const n=Array.isArray(t)?t[0]:t;return r.WpUserToUser(n)}}),changePassword:e.mutation({query:t=>({url:"/auth/password/change",method:"POST",body:t})}),resetPassword:e.mutation({query:t=>({url:"/auth/password/reset",method:"POST",body:t})}),resetPasswordConfirm:e.mutation({query:t=>({url:"/auth/password/reset/confirm",method:"POST",body:t})})})}),{useLoginMutation:zb,useRegisterMutation:Gb,useRefreshTokenMutation:Wb,useLogoutMutation:Hb,useGetUserQuery:qb,useLazyGetUserQuery:Vb,useChangePasswordMutation:Kb,useResetPasswordMutation:Yb,useResetPasswordConfirmMutation:Qb}=Rr;function na(e){return{id:e.id??0,name:e.name??"",children:(e.children??[]).map(na)}}function xh(e){return(e?.folders??[]).map(na)}function Ph(e){return{items:(e?.items??[]).flatMap(t=>t.id?[{kind:t.kind??"email",id:t.id,name:t.name??"",title:t.title??"",preheader:t.preheader??"",folderId:t.folder_id??0,hasAmp:t.has_amp??!1,previewImage:t.preview_image??"",updatedAt:t.updated_at??"",imported:t.imported??!1}]:[]),total:e?.total??0}}function Co(e){const t=e.status??"pending";return{id:e.id??"",status:t,outcome:e.outcome,total:e.total??0,imported:e.imported??0,warnings:e.warnings??0,failed:e.failed??0,finished:t==="done"||t==="failed",items:(e.items??[]).map(n=>({kind:n.kind??"email",stripoId:n.stripo_id??0,name:n.name??"",status:n.status??"failed",reason:n.reason,emailId:n.email_id})),createdAt:e.created_at??"",finishedAt:e.finished_at}}function Rh(e){return{selectors:e.map(t=>({kind:t.kind,...t.ids?.length?{ids:t.ids}:{},...t.all?{all:!0}:{},...t.folderId?{folder_id:t.folderId}:{},...t.rootOnly?{root_only:!0}:{},...t.search?{search:t.search}:{}}))}}var To="StripoItems",Io="StripoFolders",jr="StripoImportJob",mn=(e,t)=>{const n=r.v2ResultOf(e);return"error"in n?{error:n.error}:{data:t(n.data)}},Or=r.createApi({reducerPath:"stripoImportApi",tagTypes:[To,Io,jr],baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({saveStripoKey:e.mutation({async queryFn({projectId:t,apiKey:n},o){return mn(await r.getClientV2(h.getContainer(o)).projects.stripoKeyUpdate({id:String(t)},{api_key:n}),()=>{})},invalidatesTags:[To,Io]}),getStripoFolders:e.query({async queryFn({projectId:t,kind:n},o){return mn(await r.getClientV2(h.getContainer(o)).projects.stripoFoldersList({id:String(t),kind:n}),xh)},providesTags:[Io]}),getStripoItems:e.query({async queryFn({projectId:t,kind:n,folderId:o,rootOnly:i,search:s,page:c,limit:d},u){return mn(await r.getClientV2(h.getContainer(u)).projects.stripoItemsList({id:String(t),kind:n,...o?{folder_id:o}:{},...i?{root_only:!0}:{},...s?{search:s}:{},page:c,limit:d}),Ph)},providesTags:[To]}),startStripoImport:e.mutation({async queryFn({projectId:t,selectors:n},o){return mn(await r.getClientV2(h.getContainer(o)).projects.stripoImportsCreate({id:String(t)},Rh(n)),Co)},invalidatesTags:[jr]}),getCurrentStripoImport:e.query({async queryFn(t,n){const o=await r.getClientV2(h.getContainer(n)).projects.stripoImportsCurrentList({id:String(t)});return o.status===204?{data:null}:mn(o,Co)},providesTags:[jr]}),getStripoImport:e.query({async queryFn({projectId:t,jobId:n},o){return mn(await r.getClientV2(h.getContainer(o)).projects.stripoImportsDetail({id:String(t),jobId:n}),Co)},providesTags:[jr]})})}),{useSaveStripoKeyMutation:Xb,useGetStripoFoldersQuery:Jb,useGetStripoItemsQuery:Zb,useLazyGetStripoItemsQuery:e0,useStartStripoImportMutation:t0,useGetCurrentStripoImportQuery:n0,useGetStripoImportQuery:r0}=Or,jh=r.createState({activeGroupsTags:[],activeProjectGroupsTags:[],groupsTemplateTotal:null,groupsTemplateProjectTotalPages:null,groupsTemplateProjectTotal:null}),Oh="projectSlice",Ao=r.createSlice({name:Oh,initialState:jh,reducers:{setActiveGroupsTags:(e,{payload:t})=>{e.activeGroupsTags=t,t.length&&(e.activeProjectGroupsTags=[])},setActiveProjectGroupsTags:(e,{payload:t})=>{e.activeProjectGroupsTags=t,t.length&&(e.activeGroupsTags=[])},resetAllTags:e=>{e.activeProjectGroupsTags=[],e.activeGroupsTags=[]}},extraReducers:e=>{e.addMatcher(r.emailsApi.endpoints.getTemplateEmails.matchFulfilled,(t,{payload:n,meta:o})=>{const{projectId:i}=o.arg.originalArgs;i?(t.groupsTemplateProjectTotal=+o.baseQueryMeta?.response.headers.get("X-WP-Total"),t.groupsTemplateProjectTotalPages=+o.baseQueryMeta?.response.headers.get("X-WP-TotalPages")):t.groupsTemplateTotal=+o.baseQueryMeta?.response.headers.get("X-WP-Total")})}}),{setActiveGroupsTags:o0,setActiveProjectGroupsTags:i0,resetAllTags:s0}=Ao.actions,Lh=r.createState({emailsTotal:0,elementsList:[],emailsTrashTotal:0,elementsTrashList:[],customFolders:{},elementsView:r.CARDS}),Mh="emailsPageSlice";function Nh(e){const t=e?.baseQueryMeta?.response;return Number(t?.headers?.get("X-WP-Total"))||0}function ra(e,t){const{emails:n,total:o,isSearch:i,page:s,tagOrFolderId:c}=t;if(t.status==="trash")!i&&o!==void 0&&(e.emailsTrashTotal=o),e.elementsTrashList=n;else if(c){const d=e.customFolders[c];e.customFolders={...e.customFolders,[c]:{list:n,page:s,total:o??d?.total??0}}}else o!==void 0&&(e.emailsTotal=o),e.elementsList=n}var xo=r.createSlice({name:Mh,initialState:Lh,reducers:{resetElementsList:e=>{e.elementsList=[]},syncElementsList:(e,{payload:t})=>{ra(e,t)},toggleElementsView:(e,t)=>{e.elementsView=t.payload},removeEmailFromList:(e,{payload:t})=>{const n=e.customFolders;t.folder!=="all"&&n[t.folder]?.list&&(n[t.folder]={...n[t.folder],list:n[t.folder].list.filter(o=>o.id!==t.emailId),total:n[t.folder].total-1},e.customFolders=n)}},extraReducers:e=>{e.addMatcher(r.emailsApi.endpoints.getEmails.matchFulfilled,(t,{meta:n,payload:o})=>{const i=n.arg.originalArgs;ra(t,{emails:o,total:Nh(n),status:i?.status,page:i?.page,isSearch:!!i?.name?.length,tagOrFolderId:i?.folderTag||i?.tags?.[0]})}),e.addMatcher(r.emailsApi.endpoints.getTemplateEmails.matchFulfilled,(t,{meta:n,payload:o})=>{const i=+n.baseQueryMeta?.response.headers.get("X-WP-Total")||0;t.elementsList=o,t.emailsTotal=i;const{projectGroup:s,projectId:c,tags:d}=n.arg.originalArgs;(s?.length&&c||d?.length||!d?.length&&!s?.length)&&(t.emailsTotal=i)}),e.addMatcher(r.emailsApi.endpoints.editEmail.matchFulfilled,(t,{payload:n})=>{t.elementsList.map(o=>o.id?.toString()===n.id?.toString()?Object.assign(o,{lock:n.lock,title:n.title,emailtags:n.emailtags}):o)})}}),{toggleElementsView:a0,resetElementsList:l0,syncElementsList:c0,removeEmailFromList:d0}=xo.actions,oa=r.combineReducers({[r.di.reducerPath]:r.di.reducer,[r.AiApi.reducerPath]:r.AiApi.reducer,[r.userSlice.name]:r.userSlice.reducer,[r.emailSlice.name]:r.emailSlice.reducer,[r.blockSlice.name]:r.blockSlice.reducer,[r.imageApi.reducerPath]:r.imageApi.reducer,[An.reducerPath]:An.reducer,[hr.reducerPath]:hr.reducer,[Ao.name]:Ao.reducer,[r.blocksApi.reducerPath]:r.blocksApi.reducer,[r.emailsApi.reducerPath]:r.emailsApi.reducer,[fr.reducerPath]:fr.reducer,[Xn.reducerPath]:Xn.reducer,[Jn.reducerPath]:Jn.reducer,[Zn.reducerPath]:Zn.reducer,[er.reducerPath]:er.reducer,[tr.reducerPath]:tr.reducer,[nr.reducerPath]:nr.reducer,[rr.reducerPath]:rr.reducer,[or.reducerPath]:or.reducer,[ir.reducerPath]:ir.reducer,[sr.reducerPath]:sr.reducer,[ar.reducerPath]:ar.reducer,[lr.reducerPath]:lr.reducer,[cr.reducerPath]:cr.reducer,[dr.reducerPath]:dr.reducer,[ur.reducerPath]:ur.reducer,[pr.reducerPath]:pr.reducer,[r.emailPageSlice.name]:r.emailPageSlice.reducer,[r.projectsApi.reducerPath]:r.projectsApi.reducer,[Pn.reducerPath]:Pn.reducer,[Qt.reducerPath]:Qt.reducer,[Rn.reducerPath]:Rn.reducer,[Er.reducerPath]:Er.reducer,[r.saveFileApi.reducerPath]:r.saveFileApi.reducer,[Sr.reducerPath]:Sr.reducer,[r.commentsApi.reducerPath]:r.commentsApi.reducer,[r.optimiseApi.reducerPath]:r.optimiseApi.reducer,[io.name]:io.reducer,[xo.name]:xo.reducer,[mr.reducerPath]:mr.reducer,[Cr.reducerPath]:Cr.reducer,[wr.reducerPath]:wr.reducer,[kr.reducerPath]:kr.reducer,[r.taxonomiesApi.reducerPath]:r.taxonomiesApi.reducer,[r.projectsPageSlice.name]:r.projectsPageSlice.reducer,[r.AiApiGenerator.reducerPath]:r.AiApiGenerator.reducer,[Tr.reducerPath]:Tr.reducer,[gr.reducerPath]:gr.reducer,[yr.reducerPath]:yr.reducer,[Gn.reducerPath]:Gn.reducer,[r.authorizationApi.reducerPath]:r.authorizationApi.reducer,[r.limitsApi.reducerPath]:r.limitsApi.reducer,[r.revisionHistorySlice.name]:r.revisionHistorySlice.reducer,[Ir.reducerPath]:Ir.reducer,[r.defaultModePanesSlice.name]:r.defaultModePanesSlice.reducer,[ko.reducerPath]:ko.reducer,[Ar.reducerPath]:Ar.reducer,[_r.reducerPath]:_r.reducer,[Pr.reducerPath]:Pr.reducer,[xr.reducerPath]:xr.reducer,[Rr.reducerPath]:Rr.reducer,[r.projectSettingsV2Api.reducerPath]:r.projectSettingsV2Api.reducer,[Or.reducerPath]:Or.reducer}),Dh=(e,t)=>t.type==="authorizationApi/resetApiState"?oa({[r.reducerPath]:e[r.reducerPath]},t):oa(e,t),ia=[r.AiApi,r.imageApi,hr,r.emailsApi,An,r.blocksApi,fr,Xn,Jn,Zn,er,tr,nr,rr,or,ir,sr,ar,lr,cr,dr,ur,pr,Sr,r.projectsApi,Pn,Qt,Rn,Er,r.commentsApi,r.optimiseApi,r.saveFileApi,mr,Cr,r.taxonomiesApi,wr,kr,r.AiApiGenerator,Tr,r.authorizationApi,r.limitsApi,gr,yr,Gn,Ir,ko,Rr,r.projectSettingsV2Api,Or,Ar,_r,Pr,xr];function Fh(e){let t={};if(e){const o=h.createIdentifier$1();h.DependencyResolver.inject(o,e),t={INJECTION:o}}const n=r.configureStore({reducer:Dh,middleware:o=>o({serializableCheck:!1}).concat(ia.map(i=>i.middleware)),preloadedState:t});return r.setupListeners(n.dispatch),n}var sa=h.createIdentifier$1("RtkApiRegistry");function Bh(e,t){e.inject(sa,new Map(t.map(n=>[n.reducerPath,n])))}function at(e,t){const n=e?.getInstance(sa)?.get(t);if(!n)throw new Error(`RTK api "${t}" is not in the container registry (provideRtkApiRegistry did not run)`);return n}function $h(e,t){let n={isCodeMode:void 0,direction:void 0};return r.provideCodeMode(e).watch(o=>{n.isCodeMode!==o.isCodeMode&&t.dispatch(r.setCodeMode(o.isCodeMode)),n.direction!==o.direction&&t.dispatch(r.switchCodeModeDirection(o.direction)),n={isCodeMode:o.isCodeMode,direction:o.direction}})}function Uh(e,t){const n=r.provideCurrentUser(e),o=r.authorizationApi.endpoints.getMe.select("");let i=n.get()?.profile;const s=()=>{const c=o(t.getState()).data;!c||c===i||(i=c,n.set({profile:c}))};return s(),{dispose:t.subscribe(s)}}var zh=h.createIdentifier$1("EmailSettingsPort");function Gh(e,t){e.inject(zh,{read:()=>r.selectEmailSettings(t.getState())??{},write:n=>{t.dispatch(r.setEmailSettings(n))},markAppearanceChanged:()=>{t.dispatch(r.markAppearanceNeedsUpdate())}})}var Wh="Invalid standaloneKey.",Hh="not implemented",u0=1,qh=h.createIdentifier$1("StandaloneMockGuard");function Po(){const e=new Error(Wh);return e.name="InvalidStandaloneKeyError",e}function Ro(e){return r.isStandaloneRuntime(h.getContainer(e))}function Vh(e){return e instanceof Error?e.name==="InvalidStandaloneKeyError"||e.message==="Invalid standaloneKey."||e.message==="not implemented":e===Hh}function aa(e){if(Ro(e))throw Po()}function Kh(e,t,n){return n instanceof Error&&n.name==="InvalidStandaloneKeyError"?n:Po()}var Yh=()=>()=>{throw Po()};function Qh(e){if(!e)throw new Error("DI container not found for standalone mock guard");e.inject(qh,1)}function Xh(e){return typeof e!="function"}var p0="[plugin-api-mock]";function la(){return!0}function Jh(e){try{if(e===null||typeof e!="object")return e;const t={};for(const n of Object.keys(e).slice(0,12)){const o=e[n];t[n]=typeof o=="string"&&o.length>120?`${o.slice(0,120)}…(${o.length})`:o}return t}catch{return"(unserializable arg)"}}function Zh(e,t){return n=>{const o=n.query,i=n.queryFn||((s,c,d,u)=>{if(!o)throw new Error("query not found EndpointDefinition");return u(o(s))});i&&(n.query=void 0,n.queryFn=async(s,c,d,u)=>{try{let p;const f=h.getContainer(c).getServices(e);for(let g=f.length-1;g>=0;g--){const y=f[g];if(p=p?await p(async m=>await y.execute(m),c):await y.execute(s),Xh(p))return{data:p,error:null}}if(p)p=await p(async(g,y=c,m=d,E=u)=>{aa(c);const k=await i(g,y,m,E);if(k.error)throw k.error;return k.data},c);else{aa(c),la();const g=await i(s,c,d,u);if(g.error)throw g.error;p=g.data}return{data:p,error:null}}catch(p){return Ro(c)&&Vh(p)?{error:Kh(t,Jh(s),p)}:(la(),{error:p})}})}}var ca=new Set;function it(e){return(t,n)=>{const o=Object.create(null),i=Object.keys(n),s=new h.Disposable;for(const c of i){const d=`api_listeners_flag_${t.reducerPath}/${c.toString()}`,u=h.createIdentifier$1(`api_listeners_${t.reducerPath}/${c.toString()}`);ca.has(d)||(o[c]=Zh(u,`${t.reducerPath}/${c.toString()}`),ca.add(d)),s.addDisposable(e.addService(u,{execute:n[c]}))}return Object.keys(o).length&&t.enhanceEndpoints({endpoints:o}),r.getDisposable(e).addDisposable(s),s}}function da(e,t){for(const n of Object.keys(t))try{t[n](e)}catch{}}function m0(e){return e}function ua(e,t){return e({body:t}).catch(()=>new Promise(n=>setTimeout(n,1e3)))}function e_(e){it(e)(at(e,"AiApi"),{sendMessage:({body:t})=>async(n,o)=>{const i=r.getEmitter(e,h.events.AI_TEXT_REQUEST_ID);if(!i.hasListeners())return ua(n,t);const s=t,c={message:s.message??s.context,locale:s.locale,entityId:s.entity_id,projectId:s.project_id!=null?String(s.project_id):void 0,subject:s.subject,preheader:s.preheader,textContent:s.textContent,context:s.context??s.connection,connection:s.connection,onProgress:(d,u)=>{r.getEmitter(e,h.events.AI_TEXT_PROGRESS_ID).fire({progress:Number.isFinite(d)?d:0,status:typeof u=="string"?u:void 0})},onStreamChunk:d=>{typeof d!="string"||!d||r.getEmitter(e,h.events.AI_TEXT_STREAM_ID).fire({partialHtml:d})},signal:o.signal};for(const d of i.getListeners([c])){const u=await d(c);if(u)return{status:200,_eventResult:!0,aiMessage:typeof u.message=="string"?u.message:"",aiHtml:typeof u.html=="string"?u.html:void 0}}return ua(n,t)},getDialog:t=>(n,o)=>Ro(o)?Promise.resolve({documents:[],totalCount:0}):n(t)})}function t_(e){const t=it(e),n=r.getEmitter(e,h.events.FILE_PROXY_EVENT_ID);t(at(e,"proxyApi"),{async getFile({url:o,tryFetch:i=!0,type:s}){return async c=>{const{requested:d}=r.getCurrentProject(e),u=(await n.fire({url:o,project:d})).filter(p=>p instanceof Blob)[0];if(u)switch(s){case"json":return JSON.parse(await u.text());case"text":return u.text();default:return u}else return c({url:o,tryFetch:i,type:s})}}})}function n_(e){it(e)(at(e,"tokenApi"),{tokenCreate(t){return n=>n(t)},tokenValidate(){return t=>t({})}})}function f0(e){return e}function r_(e){it(e)(at(e,"imageApi"),{sendAiImageRequest:function({body:t}){return async(n,o)=>{const i=r.getEmitter(e,h.events.AI_IMAGE_REQUEST_ID);if(!i.hasListeners()||t.request!=="create-image")return n({body:t});const s={prompt:t.message??"",size:t.size,entityId:t.entity_id,projectId:t.project_id!=null?String(t.project_id):void 0,onProgress:(c,d)=>{r.getEmitter(e,h.events.AI_IMAGE_PROGRESS_ID).fire({progress:Number.isFinite(c)?c:0,status:typeof d=="string"?d:void 0})},signal:o.signal};for(const c of i.getListeners([s])){const d=await c(s);if(d&&d.images?.length)return{data:{status:200,_eventResult:!0,task:{images:d.images}}}}return n({body:t})}},getAiImage(t){return n=>n(t)}})}async function pa(e,t,n,o,i){try{const s=(await e.fire({project:String(t),emailId:n})).filter(c=>c!=null);if(s.length)return s.flat()}catch{}return o(i)}function o_(e){const t=it(e),n=at(e,"blocksApi"),o=r.blocksDataSourceProvider(e),i=o.byForeignKey("project"),s=r.blockRevisionsDataSourceProvider(e);s.byForeignKey("parent");const{dispatch:c}=r.getStore(e),d=r.getDisposable(e);d.addDisposable(o.onChange(()=>c(n.util.invalidateTags(["Blocks"])))),d.addDisposable(o.onSave(({prev:f,patch:g,value:y})=>{const m=f?{...f,...g}:g;let E=r.mergeEntityPreservingMeta(f,g,y);return m&&E.html===m.html&&E.title===m.title&&(E={...E,renderGuid:m.renderGuid}),E},Number.MIN_VALUE));const u=r.getEmitter(e,r.READ_COMMON_BLOCKS_EVENT_ID),p=r.getEmitter(e,r.READ_TEMPLATE_BLOCKS_EVENT_ID);t(n,{async getBlocks(f){const g={};f.name&&(g.title=f.name),f.type&&(g.type=f.type);const y=f.projectId??await r.getBlocksProject(e);return await i.get(y,{filter:g,page:f.page,pageSize:f.pageSize,order:f.order,orderBy:f.orderby}).then(({data:m})=>m)},getBlocksSchema(){return f=>f(void 0)},getParentEmailBlocks(f){return async g=>{const y=r.getCurrentProject(e).requested||"";return pa(p,y,f.emailId||"",g,f)}},getTemplateBlocks(f){return async g=>{const y=r.getCurrentProject(e).requested||"";return pa(u,y,f.emailId||"",g,f)}},async getBlock(f){const g=r.getCurrentProject(e).card?.id;if(g!==void 0)return i.first(Number(g),{filter:{id:f}})},addBlock(f){return async g=>{const y=await o.create(f);return r.getAppConfig(e).preventSendDataToEM||g(y).catch(m=>{}),y}},editBlock({blockId:f,...g}){return o.update(f,g)},deleteBlock(f){return o.remove(typeof f=="object"?f.id:f)},addTag(f){return f},getDeletableTag([f,g]){return[]},autoSaveBlock({blockId:f,body:g}){return s.create({...g,parent:f})}})}function i_(e){const{emails:t,emailRevisions:n}=r.provideEmailDocuments(e),{dispatch:o}=r.getStore(e),i=r.getDisposable(e),s=it(e),c=at(e,"emailsApi");i.addDisposable(t.onChange(async()=>{o(c.util.invalidateTags(["Email"]))})),s(c,{getEmails:d=>[],getTemplateEmails:d=>[],async addEmail({source:d,...u}){const p=await t.create(u,{source:d});return p.renderGuid||(p.renderGuid=h.generateUUID()),p},editEmail(d){return async u=>{const{emailId:p,source:f,...g}=d;return r.isRevisionServiceEnabled(e)&&await u(d),t.update(p,g,{source:f})}},deleteEmail(d){return t.remove(typeof d=="object"?d.id:d)},addTag(){throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},getDeletableTag([d,u]){return[]},autoSaveEmail({emailId:d,body:u}){return async p=>{r.isRevisionServiceEnabled(e)&&await p({emailId:d,body:u});const f=await n.create({...u,parent:d,modified:new Date().toString()});return f&&!f.html&&u.html?{...f,html:u.html}:f}}})}var s_="tmp",g0=h.createIdentifier$1();function a_(e){const t=it(e);if(!e.getInstance(h.DISPOSABLE_ID))throw new Error("Something was wrong");const n=r.getEmitter(e,h.events.UPLOAD_EVENT_ID),o=r.getEmitter(e,h.events.ON_SEND_TESTEMAIL_ID),i=r.getEmitter(e,h.events.ON_SEND_LIVEPREVIEW_ID);t(at(e,"saveFileApi"),{uploadImage(s){return async c=>{const{requested:d}=r.getCurrentProject(e),u=async()=>c({...s,user_id:String((await e.getInstanceAsync(h.APP_ID)).app_id)});if(s.folder===s_)return u();const p=await r.fireUploadImageEvent(n,{file:s.file,project:d});if(p.url)return[{file_url:p.url,project:d}];if(!r.shouldFallbackToBuiltInUpload(p,{isStandalone:r.isStandaloneRuntime(e)}))throw r.toUploadImageError(p);return u()}},sendTestEmail(s){return async c=>{const{requested:d}=r.getCurrentProject(e);(await o.fire({project:d,email_id:s.email_id,subject:s.subject,email:s.email,html:s.html,from_name:s.from_name})).some(u=>u===!1)&&await c({...s,user_id:String((await e.getInstanceAsync(h.APP_ID)).app_id)})}},async sendLivePreview(s){const{requested:c}=r.getCurrentProject(e);(await i.fire({project:c,id:s.email,subject:s.subject,html:s.content})).some(d=>d===!1)},sendShortLink(s){return c=>c(s)}})}function l_(e){it(e)(at(e,"emailRawApi"),{getEmailRaw({emailId:t,secret_hash:n}){throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)}})}function Kt(e,t){for(var n=e<0?"-":"",o=Math.abs(e).toString();o.length<t;)o="0"+o;return n+o}function c_(e,t){var n,o;r.requiredArgs(1,arguments);var i=Ll(e);if(isNaN(i.getTime()))throw new RangeError("Invalid time value");var s=String((n=t?.format)!==null&&n!==void 0?n:"extended"),c=String((o=t?.representation)!==null&&o!==void 0?o:"complete");if(s!=="extended"&&s!=="basic")throw new RangeError("format must be 'extended' or 'basic'");if(c!=="date"&&c!=="time"&&c!=="complete")throw new RangeError("representation must be 'date', 'time', or 'complete'");var d="",u="",p=s==="extended"?"-":"",f=s==="extended"?":":"";if(c!=="time"){var g=Kt(i.getDate(),2),y=Kt(i.getMonth()+1,2),m=Kt(i.getFullYear(),4);d="".concat(m).concat(p).concat(y).concat(p).concat(g)}if(c!=="date"){var E=i.getTimezoneOffset();if(E!==0){var k=Math.abs(E),w=Kt(Math.floor(k/60),2),v=Kt(k%60,2),x=E<0?"+":"-";u="".concat(x).concat(w,":").concat(v)}else u="Z";var P=Kt(i.getHours(),2),K=Kt(i.getMinutes(),2),J=Kt(i.getSeconds(),2),N=d===""?"":"T",L=[P,K,J].join(f);d="".concat(d).concat(N).concat(L).concat(u)}return d}function d_(e){const t=it(e),n=at(e,"commentsApi"),o=r.commentsDataSourceProvider(e),i=o.byForeignKey("post"),{dispatch:s}=r.getStore(e);r.getDisposable(e).addDisposable(o.onChange(()=>s(n.util.invalidateTags(["Comments"])))),t(n,{getComments(c){return i.get(c).then(({data:d})=>d)},addComment({subjectId:c,author:d,parent:u,content:p,author_name:f,author_email:g,targetId:y}){const m={post:c,author:d,author_name:f,author_email:g,content:p,parent:u,target_id:y,date:c_(new Date),author_avatar_urls:{}};return o.create(m)},deleteComment(c){return o.remove(c)},editComment({commentId:c,...d}){return o.update(c,d)},deleteTarget(c){return o.update(c,{target_id:""})}})}function jo(e){return{id:String(e),name:"",myRole:"",members:[],invites:[],emailsCount:0,blocksCount:0,title:"",group:[],folder:[],blockfolder:[]}}function ma(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function u_(e,t){const n=jo(String(t)),o=r.getCurrentProject(e).card;return o&&String(o.id)===String(t)?Promise.resolve({...n,...o,id:String(t)}):Promise.resolve({...n,id:String(t)})}function p_(e){let t,n;const o=i=>((t!==i||!n)&&(t=i,n=u_(e,i)),n);it(e)(at(e,"projectsApi"),{getProjects(i={page:1}){return[]},getProject(i){return async s=>r.isStandaloneRuntime(e)?s(i):{...await o(i),id:String(i)}},addProject(i){throw new Error},async editProject({projectId:i,...s}){const c={...await o(i),...s,id:String(i)};return t=i,n=Promise.resolve(c),c},deleteProject(i){throw new Error},mutateProjectMembers(){throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},addProjectMember(){throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},getFrequentProjects(){return[]}})}function m_(e){let t={id:"0",username:"",email:"",password:"",code_editor:{},theme:"light",locale:r.getCurrentUser(e).profile?.locale,counters:{},avatar_urls:{},autosaves:!0};it(e)(at(e,"authorizationApi"),{getSchema:()=>n=>n({}),getMe:()=>t,editMe:n=>t={...t,...n},getSubscriptions:()=>[]})}function f_(e){it(e)(at(e,"notificationsApi"),{getNotifications(t){return[]},notificationShown({id:t,datetime:n}){throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)}})}function g_(e){it(e)(at(e,"addUserToProjectApi"),{addUserToProject:()=>{}})}function h_(e){r.injectEmailTermsResolver(e,{resolve:async()=>{}}),it(e)(at(e,"taxonomiesApi"),{getTerms:()=>[],getStandardGroups:()=>[],addTerm:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},editTerm:t=>({id:t.id,name:t.name,parent:0,count:0}),deleteTerm:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)}})}function __(e){it(e)(at(e,"projectSettingsV2Api"),{getProjectIntegrations:()=>({}),getProjectWebhook:()=>"",getProjectStorage:()=>({}),getProjectTestRecipients:()=>[],getIntegrationCredentials:()=>({}),putProjectIntegration:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},deleteProjectIntegration:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},putProjectWebhook:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},putProjectSettings:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},putProjectTestRecipients:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)}})}function y_(e){it(e)(at(e,"stripoImportApi"),{getStripoFolders:()=>[],getStripoItems:()=>({items:[],total:0}),getCurrentStripoImport:()=>null,getStripoImport:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},saveStripoKey:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)},startStripoImport:()=>{throw new Error(h.NOT_IMPLEMENTED_IN_PLUGIN)}})}var fa={addUserToProjectApiMock:g_,AiApiMock:e_,authorizationApiMock:m_,blocksApiMock:o_,commentsApiMock:d_,emailsApiMock:i_,emailRawApiMock:l_,imageApiMock:r_,notificationsApiMock:f_,projectsApiMock:p_,projectSettingsV2ApiMock:__,proxyApiMock:t_,saveFileApiMock:a_,stripoImportApiMock:y_,taxonomiesApiMock:h_,tokenApiMock:n_},Oo=r.createApi({reducerPath:"tokenApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/wp-json/jwt-auth/v1/"}),endpoints:e=>({tokenCreate:e.mutation({queryFn(t,n){return r.clientFromApi(n).jwtAuth.token_create({body:t,type:h.ContentType.Json})}}),tokenValidate:e.mutation({queryFn(t,n){return r.clientFromApi(n).jwtAuth.token_validate_create({type:h.ContentType.Json})}})})}),{useTokenCreateMutation:h0,useTokenValidateMutation:_0}=Oo;function Lo(){const e=new Map;for(const t of ia)e.set(t.reducerPath,t);return e.set(Oo.reducerPath,Oo),[...e.values()]}function v_(e,t){const n=Object.keys(t.endpoints);n.length&&e(t,Object.fromEntries(n.map(o=>[o,Yh])))}function b_(e){Qh(e);const t=it(e);for(const n of Lo())v_(t,n)}function E_(e){if(!e)return;const t=h.decodeJwt(e)?.data,n=t?.data?.scope??t?.scope;return(Array.isArray(n)?n.flatMap(o=>typeof o=="string"?o.split(/\s+/):[]):typeof n=="string"?n.split(/\s+/):[]).find(o=>/^project_\d+$/.test(o))?.replace(/^project_/,"")||void 0}var S_={AiApi:new Set(["sendMessage","getDialog"]),imageApi:new Set(["sendAiImageRequest","getAiImage","getAiImageSSE"])};function w_(e){return r.getAppConfig(h.getContainer(e))}function k_(e){return e?.backendProxy!==void 0&&e?.backendProxyPolicy?.proxyAi===!0}function C_(e){return k_(w_(e))}function T_(e,t,n,o){return S_[t]?.has(n)?i=>C_(e)?s=>s(i):o(i):o}function I_(e){const t=it(e);return((n,o)=>{if(!n||typeof n.reducerPath!="string")return new h.Disposable;const i=Object.fromEntries(Object.entries(o??{}).map(([s,c])=>[s,typeof c=="function"?T_(e,n.reducerPath,s,c):c]));return t(n,i)})}function A_(e){const t=`blocks_${h.generateUUID().replaceAll("-","")}`,n=document.createElement("script");return n.type="text/javascript",n.text=`window.${t}(function(module, exports, require) { ${e}; })`,new Promise((o,i)=>{window[t]=function(s){const c={exports:{}},d=()=>{};s(c,c.exports,d),o(c.exports)},document.head.appendChild(n)}).finally(()=>{n.remove(),delete window[t]})}async function ga(e){const t=h.getContainer(e),n=t?.getInstance(h.STANDALONE_PROJECT_ID),o=n?void 0:await t?.getInstanceAsync(h.APP_ID).catch(()=>{}),i=n||(o?.project!==void 0?String(o.project):void 0);i&&t&&r.setCurrentProjectCard(t,jo(i))}async function x_(e,t){try{const n=function(d){const u=e.getInstance(h.STANDALONE_PROJECT_ID),p=u?ma(u,d):d;e.injectFactory(h.APP_ID,async()=>p)},o=I_(e),i=await r.readZipFromBase64(t),s=i.key&&r.zipEntryToText(i.key);if(typeof s!="string")return;const c=await A_(s);if(typeof c!="object"||c===null||typeof c.execute!="function")return;c.execute(n,o,Lo())}catch{}}async function ha(e,t){b_(h.getContainer(e)),await x_(h.getContainer(e),t),da(h.getContainer(e),fa)}var P_=zn(async e=>{const t=Fh(e);e.inject(h.STORE_ID,t),Bh(e,Lo()),Gh(e,t),r.getDisposable(e).addDisposable(Uh(e,t)),r.getDisposable(e).addDisposable($h(e,t));const n=h.getContainer(t);n&&(e.inject(h.MESSAGE_SERVICE_ID,r.getMessageService(n)),e.inject(r.CURRENT_PROJECT_ID,r.provideCurrentProject(n)));const o=e.getInstance(h.SECURITY_MODULE_ID);return o?(await ha(t,o),await ga(t)):da(h.getContainer(t),fa),{instance:{}}}),_a=["historyEnabled","commentsEnabled","aiAssistentEnabled","livePreviewEnabled","sendTestEnabled","sharePreviewEnabled","webversionEnabled","optimizeSpamAssassinEnabled","exportWebHookEnabled","aiLayoutConverterEnabled","elementAIimageEnabled","elementAItextEnabled","revisionService"];function R_(e){const t={...e};for(const n of _a)t[n]=!1;return t}function j_(e){const t={...e};for(const n of _a)n in t&&typeof t[n]=="boolean"&&(t[n]=!1);return t}function O_(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,o]of Object.entries(e))!o||typeof o!="object"||Array.isArray(o)||(t[n]=j_(o));return Object.keys(t).length>0?t:void 0}function Mo(e){const t=R_(e),n=O_(e.advancedConfigs),o={...t};return n?o.advancedConfigs=n:delete o.advancedConfigs,o}var y0=1,L_=2592e6;function ya(){return"useblocks".trim()||void 0}function M_(e){return{schemaVersion:1,savedAt:Date.now(),project:e.project,app_id:e.app_id,app_config:Mo(ba(e.app_config))}}function va(e){return{...e,app_config:ba(e.app_config)}}function ba(e){if(!e||typeof e!="object"||Array.isArray(e))return{};try{if(typeof structuredClone=="function")return structuredClone(e)}catch{}try{return JSON.parse(JSON.stringify(e))}catch{return{}}}async function N_(e){const t=ya();t&&await G_(t,M_(e))}async function D_(e=Date.now()){const t=ya();if(t)return W_(t,e)}function F_(e,t=Date.now()){return e.savedAt>t?!1:t-e.savedAt<=L_}function Ea(e){if(!e||typeof e!="object")return!1;const t=e,n=typeof t.project=="number"&&Number.isFinite(t.project)||typeof t.project=="string"&&t.project.trim()!=="";return t.schemaVersion===1&&typeof t.savedAt=="number"&&Number.isFinite(t.savedAt)&&n&&typeof t.app_id=="number"&&Number.isFinite(t.app_id)&&t.app_config!=null&&typeof t.app_config=="object"&&!Array.isArray(t.app_config)}var jt="snapshots",B_=1;function $_(){return`${"useblocks".trim()||"plugin"}-plugin-deferred-config`}function Lr(){return new Promise((e,t)=>{if(typeof indexedDB>"u"){t(new Error("indexedDB is not available"));return}const n=indexedDB.open($_(),B_);n.onerror=()=>t(n.error||new Error("indexedDB open failed")),n.onupgradeneeded=()=>{const o=n.result;o.objectStoreNames.contains(jt)||o.createObjectStore(jt)},n.onsuccess=()=>e(n.result)})}function U_(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error||new Error("indexedDB request failed"))})}function z_(){return{async get(e){const t=await Lr();try{const n=await U_(t.transaction(jt,"readonly").objectStore(jt).get(e));return n===void 0?void 0:n}finally{t.close()}},async put(e,t){const n=await Lr();try{const o=n.transaction(jt,"readwrite");o.objectStore(jt).put(t,e),await new Promise((i,s)=>{o.oncomplete=()=>i(),o.onerror=()=>s(o.error||new Error("indexedDB write failed")),o.onabort=()=>s(o.error||new Error("indexedDB write aborted"))})}finally{n.close()}},async delete(e){const t=await Lr();try{const n=t.transaction(jt,"readwrite");n.objectStore(jt).delete(e),await new Promise((o,i)=>{n.oncomplete=()=>o(),n.onerror=()=>i(n.error||new Error("indexedDB delete failed")),n.onabort=()=>i(n.error||new Error("indexedDB delete aborted"))})}finally{t.close()}},async clear(){const e=await Lr();try{const t=e.transaction(jt,"readwrite");t.objectStore(jt).clear(),await new Promise((n,o)=>{t.oncomplete=()=>n(),t.onerror=()=>o(t.error||new Error("indexedDB clear failed")),t.onabort=()=>o(t.error||new Error("indexedDB clear aborted"))})}finally{e.close()}}}}var Sa,No;function Do(){return Sa||(No||(No=z_()),No)}function wa(e){Do().delete(e).catch(()=>{})}async function G_(e,t){if(Ea(t))try{await Do().put(e,va(t))}catch{}}async function W_(e,t=Date.now()){try{const n=await Do().get(e);if(n===void 0)return;if(!Ea(n)){wa(e);return}if(!F_(n,t)){wa(e);return}return va(n)}catch{return}}function H_(e,t){if(e.getInstance(h.STANDALONE_FILE_PROXY_REGISTERED_ID))return;e.inject(h.STANDALONE_FILE_PROXY_REGISTERED_ID,!0);const n=h.getEvent(e,h.events.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:o})=>(await fetch(o)).blob(),Number.MIN_VALUE))}function ka(e){try{return E_(e)||void 0}catch{return}}async function q_(e,t,n){if(!e)return;let o;try{const i=await e(t,n,void 0);o=String(i||"").trim()}catch{return}if(o)return{token:o,serverProjectId:ka(o)}}function V_(e){if(e==null)return;const t=String(e).trim();return/^\d+$/.test(t)?t:void 0}function K_(e){const t=String(e.getInstance(h.JWT_TOKEN_ID)||"").trim();if(t)return ka(t)}function Ca(e,t,n){e.inject(h.APP_ID,void 0),e.inject(h.APP_ID,Promise.resolve(ma(t,n)))}function Y_(e){return{app_id:e.app_id,app_config:Mo(e.app_config)}}async function Ta(){const e=await D_();return e?Y_(e):{app_config:Mo({})}}function Q_(e,t){e.getInstance(h.STANDALONE_ACTIVATED_ID)||(e.inject(h.SECURITY_MODULE_ID,void 0),e.inject(h.STANDALONE_BOOTSTRAP_TOKEN_ID,void 0),e.inject(h.STANDALONE_PROJECT_ID,void 0),t&&e.inject(h.APP_ID,void 0),e.inject(h.STANDALONE_FILE_PROXY_REGISTERED_ID,void 0))}async function Ia(e){const{container:t,store:n,standaloneKey:o,project:i,reason:s,getAuthToken:c,user:d}=e,u=e.disposable||t.getInstance(h.DISPOSABLE_ID);if(t.getInstance(h.STANDALONE_ACTIVATED_ID))return;const p=await q_(c,d,i),f=V_(i),g=p?.serverProjectId??K_(t)??(p?void 0:f);t.inject(h.SECURITY_MODULE_ID,o);let y=!1;try{if(p&&(t.inject(h.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(p.token)),c&&h.recreateTokenProvider(t,c,d,i)),g){const m=await Ta();t.inject(h.STANDALONE_PROJECT_ID,g),Ca(t,g,m),y=!0,r.setCurrentProjectCard(t,jo(g))}if(await ha(n,o),y=!0,!g){await ga(n);const m=t.getInstance(h.STANDALONE_PROJECT_ID);if(m)Ca(t,m,await Ta()),y=!0;else if(t.getInstance(h.APP_ID)!==void 0)try{(await t.getInstanceAsync(h.APP_ID))?.project==null}catch{}}u&&H_(t,u),t.inject(h.STANDALONE_ACTIVATED_ID,!0)}catch(m){throw Q_(t,y),m}}async function X_(e,t,n,o){const i=o?.attemptTimeout??h.isFailoverEnabled(n),s=h.isFailoverEnabled(n)?h.getOrderedOriginCandidates(n):h.getOriginChain(n).length>0?[h.getActiveBaseUrl(n)]:[];if(s.length===0)throw new Error("[apiOriginFailover] no API base URL configured");const c=e.startsWith("/")?e:`/${e}`;let d,u;for(let p=0;p<s.length;p++){const f=s[p],g=p===s.length-1,y=i?h.beginFailoverAttempt(t.signal):void 0;try{const m=await fetch(`${f}${c}`,{...t,...y?{signal:y.signal}:{}});if(!m.ok&&h.shouldFailoverResponse(m.status)){if(d=m,!g){h.reportOriginFailure(f,n);continue}break}return m.ok&&h.reportOriginSuccess(f,n),m}catch(m){const E=y?.timeoutError();if(!E&&!h.shouldFailoverError(m))throw m;u=E||m,g||h.reportOriginFailure(f,n)}finally{y?.done()}}if(h.isFailoverEnabled(n)&&h.abandonStickyOrigin(),d)return d;throw u instanceof Error?u:new Error("[apiOriginFailover] fetch chain failed")}function J_(e,t){const n=String(t.baseUrl||"").trim();if(n)return h.resolveExplicitApiBaseUrl(n);const o=e.getInstance(h.REST_CLIENT_FACTORY_ID),i=String(o?.getOptions()?.baseUrl||"").trim();return h.resolveExplicitApiBaseUrl(i||void 0)}async function Z_(e,t){if(t.getAuthToken)try{const n=await t.getAuthToken(t.user,t.project,void 0);if(String(n||"").trim())return!0}catch{if(!t.jwtAuth)return!1}if(t.jwtAuth)try{if(String(e.getInstance(h.JWT_TOKEN_ID)||"").trim())return!0;const n=J_(e,t);if(!n)return!1;const o=await X_("/jwt-auth/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.jwtAuth)},n,{attemptTimeout:!0});if(!o.ok)return!1;const i=await o.json();return i.token?(e.inject(h.JWT_ERROR_ID,void 0),e.inject(h.JWT_TOKEN_ID,i.token),!0):!1}catch{return!1}return!1}async function ey(e){try{if(e.getInstance(h.APP_ID)===void 0)return!1;const t=await ny(e.getInstanceAsync(h.APP_ID));return t!=null&&t.project!=null?t:!1}catch{return!1}}function ty(){return h.getFailoverAttemptTimeoutMs()*Math.max(1,h.getOriginChain().length)}function ny(e){const t=ty();return new Promise((n,o)=>{const i=setTimeout(()=>{n(void 0)},t);e.then(s=>{clearTimeout(i),n(s)},s=>{clearTimeout(i),o(s)})})}function Aa(e){return String(e.standaloneKey||"").trim()||void 0}function ry(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function oy(e){return ry(e)?!!Aa(e):!1}var iy=zn(async e=>{const t=e.getInstance(h.DISPOSABLE_ID),n=()=>e.getInstanceAsync(h.STORE_ID);return{async setOptions(o){if(!oy(o)){e.getInstance(h.STANDALONE_ACTIVATED_ID);return}const i=Aa(o);if(!i||e.getInstance(h.STANDALONE_ACTIVATED_ID))return;const s=await n(),c=!!(o.getAuthToken||o.jwtAuth),d=c?await Z_(e,o):!0;if(c&&!d){await Ia({container:e,store:s,standaloneKey:i,project:o.project,getAuthToken:o.getAuthToken,user:o.user,disposable:t,reason:"auth pipeline failed"});return}const u=await ey(e);if(u){await N_(u).catch(()=>{});return}await Ia({container:e,store:s,standaloneKey:i,project:o.project,getAuthToken:o.getAuthToken,user:o.user,disposable:t,reason:"app_init failed"})}}}),sy=h.defineMixin(e=>{let t;const n=r.getDisposable(e),o=h.getEvent(e,h.events.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(o(({history:s})=>{t=s}));const i=()=>t?Ni(t):void 0;return{instance:{undoRedoService:{undo:()=>i()?.undo(),redo:()=>i()?.redo(),clear:()=>i()?.clear(),getPast:s=>i()?.getPast(s)??[],getFuture:s=>i()?.getFuture(s)??[],canUndo:()=>i()?.canUndo()??!1,canRedo:()=>i()?.canRedo()??!1,createSnapshot:()=>i()?.createSnapshot(),restoreSnapshot:s=>i()?.restoreSnapshot(s)}}}});function ay(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 ly(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}async function xa(e){const t=r.getCurrentUser(e).profile;if(t)return t;const n=e.getInstance(h.STORE_ID);if(n)return(await n.dispatch(r.authorizationApi.endpoints.getMe.initiate("",{forceRefetch:!0}))).data}function cy(e){const t=r.resolveTemplateDirectivesConfig(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return fs();const n=new Set(Object.keys(t.output).filter(i=>t.output[i]==="html-comment")),o=new Set(Object.keys(t.output));return{isConfigured:()=>!0,toEditorForm:i=>r.mapper.normalizeToPolicy(i,t.editor),toOutputForm:i=>r.mapper.normalizeToPolicy(i,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:ms(o)}}function Pa(e){const t=r.getCodeMode(e);return{...Mr(e),editor:ly(r.getEditorOptions(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function Mr(e){return e.getInstance(h.CONFIG_SOURCE_ID)?.get()??{}}function Fo(e){return e.getInstance(h.CONFIG_SOURCE_ID)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}var dy=bo(e=>{const t=r.getDisposable(e),n=Ct(r.getEvent(e,h.events.ON_LIMIT_ID)),o=t.addDisposable(new kt(n)),i=Ct(r.getEvent(e,h.events.READ_LOCALE)),s=t.addDisposable(new kt(i)),c=Ct(r.getEvent(e,h.events.ON_TRANSLATE_ID)),d=t.addDisposable(new kt(c)),u=r.getEmitter(e,h.CONFIG_CHANGED_EVENT_ID),p=async()=>{try{return e.getInstance(h.APP_ID)===void 0?{}:(await e.getInstanceAsync(h.APP_ID))?.app_config||{}}catch{return{}}},f=Bs(),g=Bs();let y,m=!1,E;const k=async()=>{const A=Pa(e);if(!m){E=h.deepClone(A),m=!0;return}E!==void 0&&h.deepEqual(E,A)||(E=h.deepClone(A),await u.fire(A))},w=A=>{if(typeof A=="number")return String(A);if(typeof A=="string")return A},v=A=>{if(A!==void 0){const O=r.provideCurrentProject(e);O.set({...O.get(),requested:String(A)})}},x=async(A,O)=>{if(!A){const Z=await xa(e);return y=w(Z?.id),{didReset:!1}}const z=await xa(e),B=A.id!==void 0?w(A.id):w(z?.id),U=y!==void 0?String(y):void 0,de=B!==void 0?String(B):void 0,me=U!==void 0&&de!==void 0&&U!==de,H={...z,...r.filterUndefined(A),id:B};if(A.id===void 0&&!z?.id&&delete H.id,r.provideCurrentUser(e).set({profile:H}),me&&O){const Z=e.getInstance(h.INSTANCE_ID);if(Z?.reset)return await Z.reset(O),{didReset:!0}}return y=de,{didReset:!1}},P=A=>{const O=e.getInstance(h.CONFIG_SOURCE_ID);O?.setAdvancedConfigs({...A.advancedConfigs,...A.user?.advancedConfigs}),O?.replace(A.user,"user"),O?.replace(A.serverSide,"server")},K=async()=>{await e.getInstance(h.CONFIG_SOURCE_ID)?.ready(),r.getRevisionServiceFlag(e).set(Mr(e).revisionService===!0);const{codeModeDirection:A,editor:O}=Mr(e);O&&r.applyEditorOptions(e,ay(O)),A!==void 0&&(A==="none"?r.setCodeMode$1(e,!1):(r.setCodeMode$1(e,!0),r.setCodeModeDirection(e,A)))},J=async A=>{P(A),await K()};let N;const L=f.decorate(async({config:A={},project:O,user:z,advancedConfigs:B},U)=>{e.getInstance(h.CONFIG_SOURCE_ID)?.replace(await p(),"server"),await K(),e.inject(h.TEMPLATE_DIRECTIVES_ID,cy(Mr(e).templateDirectives)),v(O),U&&"commonStyles"in U&&r.setDefaultCommonStyles(e,U.commonStyles===void 0?void 0:U.commonStyles);const{didReset:de}=await x(z,U)});return{setOptions:g.decorate(async A=>{const{config:O={},project:z,user:B,advancedConfigs:U,handleReadLocale:de,handleLimitUsage:me,handleTranslate:H,storageProvider:Z}=A;e.inject(h.STORAGE_PROVIDER_ID,Z),s.setListener(de),o.setListener(me),d.setListener(H),await L({config:O,project:z,user:B,advancedConfigs:U},A).catch(De=>{}),await k(),N&&N.dispose(),N=new h.Disposable}),instance:{setConfig:g.decorate(async A=>{const O=A,{commonStyles:z,...B}=O;"commonStyles"in O&&r.setDefaultCommonStyles(e,z===void 0?void 0:z),await J({advancedConfigs:Fo(e).advancedConfigs,serverSide:await p(),user:B}),await k()}),getConfig:()=>Pa(e),updateConfig:g.decorate(async A=>{const O=A,{commonStyles:z,...B}=O;"commonStyles"in O&&r.setDefaultCommonStyles(e,z===void 0?void 0:z),await J({advancedConfigs:Fo(e).advancedConfigs,serverSide:await p(),user:{...Fo(e).user,...B}}),await k()}),handleReadLocale:i,handleLimitUsage:n,handleTranslate:c}}}),Nr;function Bo(){return Nr===void 0&&(Nr=(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/4916b3a1.js")),void 0,{}.url).catch(e=>{throw Nr=void 0,e})),Nr}var Ra;function uy(){return Ra??=(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/e47dcbb0.js")).then(e=>zt.__toESM(e.require_core())),void 0,{}.url),Ra}function py(e){const t=[0],n=[];let o=0;for(;o<e.length;){const i=e.charCodeAt(o);i===10||i===13?(n.push(o-t[t.length-1]),o+=i===13&&e.charCodeAt(o+1)===10?2:1,t.push(o)):o+=1}return n.push(e.length-t[t.length-1]),{starts:t,lengths:n}}function ja({starts:e,lengths:t},n,o){const i=Math.min(Math.max(n,1),e.length)-1;return e[i]+Math.min(Math.max(o,1),t[i]+1)-1}var my={error:8,warning:4,info:2};function fy(e,t){const n=e.evidence!==""?e.col+e.evidence.length:t.lengths[e.line-1]??e.col+1;return{severity:my[e.type]??8,message:e.message,startLineNumber:e.line,startColumn:e.col,endLineNumber:e.line,endColumn:n,startOffset:ja(t,e.line,e.col),endOffset:ja(t,e.line,n)}}async function gy(e){const{HTMLHint:t}=await uy(),n=py(e);return t.verify(e,r.EMAIL_CODE_RULESET).map(o=>fy(o,n))}var hy=class extends h.Disposable{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=r.getDataSources(e),this.addDisposable(h.getEvent(e,h.events.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}async getBlocks(){const e=await this._readProjectBlocks();return await this._blockMetaWrites,(await this._dataSources.blocks.cache.values()).filter(t=>t.project===e).map(t=>Og(t,this._container))}async _readProjectBlocks(){const e=await r.getBlocksProject(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=>Lg(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=>Mg(n,this._container))}async getEmailSnapshot(){return Up(r.getOpenEmail(this._container,this._currentEmail),this._container)}async getEmail(e=!0){return this.compile(e)}async compileEmail(e=!0){return this.compile(e)}async compile(e){const{compileEmail:t}=await Bo();return t(await this.getEmailSnapshot(),e,on(this._container).keepWrappedOnOutput)}setEmailMeta(e){const t=r.getOpenDocument(this._container);if(!t)return;const n=t.get().attributes.meta;r.writeEmailAttributes(t,{meta:r.applyMetaPatch({meta:n},e).meta});const o=t.get().serverId;o!=null&&this._dataSources.emails.cache.addOrUpdate(o,i=>i&&r.applyMetaPatch(i,e))}setBlockMeta(e,t){const n=async()=>{await this._readProjectBlocks();const{cache:o}=this._dataSources.blocks;await o.getIfPresent(e)&&await o.addOrUpdate(e,i=>i&&r.applyMetaPatch(i,t))};this._blockMetaWrites=this._blockMetaWrites.then(n).catch(()=>{})}getCodeErrors(){const e=r.getCodeErrors(this._container);return e.length>0?e:void 0}validateCode(){return Promise.resolve(gy(r.getOpenEmail(this._container,this._currentEmail).html??""))}};function Oa(){Bo().catch(()=>{})}function _y(e){const t=r.provideHeadlessMode(e).watch(n=>{n&&Oa()});e.getInstance(h.DISPOSABLE_ID)?.addDisposable(t),Ht(e).whenVisible(()=>{Xt(Oa)})}var yy=h.createIdentifier$1("EmailOperationsController");function La(e){return e.getOrCreateInstance(yy,()=>{const t=new hy(e);return e.getInstance(h.DISPOSABLE_ID)?.addDisposable(t),t})}function vy(e){La(e),_y(e)}function by(e){const t=La(e);return{getEmailSnapshot:()=>t.getEmailSnapshot(),getEmail:()=>t.getEmail(),async compileEmail(n,o=!0){if(!n)return t.compileEmail(o);const{compileEmail:i}=await Bo();return i(n,o,on(e).keepWrappedOnOutput)},validateCode:()=>t.validateCode(),getCodeErrors:()=>t.getCodeErrors(),getBlocks:()=>t.getBlocks(),getComments:()=>t.getComments(),getEmailRevisions:()=>t.getEmailRevisions(),setEmailMeta:n=>t.setEmailMeta(n),setBlockMeta:(n,o)=>t.setBlockMeta(n,o)}}var Ey=h.defineMixin(e=>{const t=e.getInstance(h.DISPOSABLE_ID),n=h.getEvent(e,h.events.UPLOAD_EVENT_ID),o=h.getEvent(e,h.events.FILE_PROXY_EVENT_ID),i=h.getEmitter(e,h.events.PROXY_URL_EVENT_ID).event,s=Ct(n),c=Ct(i),d=Ct(o),u=t.addDisposable(new kt(s)),p=t.addDisposable(new kt(d)),f=t.addDisposable(new kt(c));return{setOptions(g){u.setListener(g.handleLoadImage),p.setListener(g.handleFileProxy),f.setListener(g.handleUrlProxy)},instance:{handleLoadImage:s,handleFileProxy:d,handleUrlProxy:c}}}),Sy=h.defineMixin(e=>{const t=e.getInstance(h.DISPOSABLE_ID),n=h.getEvent(e,h.events.AI_TEXT_REQUEST_ID),o=h.getEvent(e,h.events.AI_IMAGE_REQUEST_ID),i=Ct(n),s=Ct(o),c=t.addDisposable(new kt(i)),d=t.addDisposable(new kt(s));return{setOptions(u){c.setListener(u.handleAITextRequest),d.setListener(u.handleAIImageRequest)},instance:{handleAITextRequest:i,handleAIImageRequest:s}}}),wy=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function ky(e){const t=new Map;for(const n of e)for(const o of n.provides??[]){const i=t.get(o)??[];i.push(n),t.set(o,i)}return t}function Cy(e,t){const n=[];for(const o of e.awaits?.services??[])for(const i of t.get(o)??[])i!==e&&n.push(i);return n}function Ty(e){const t=ky(e),n=[],o=new Set,i=[],s=new Set,c=d=>{if(!o.has(d)){if(s.has(d)){const u=i.indexOf(d);throw new wy([...i.slice(u),d].map(p=>p.name))}s.add(d),i.push(d);for(const u of Cy(d,t))c(u);i.pop(),s.delete(d),o.add(d),n.push(d)}};for(const d of e)c(d);return n}var Iy="author,slug,date,modified,title,acf.html,id,parent,date_gmt",Ay="author,slug,date,modified,modified_gmt,title,acf.html,id,parent",xy=20,$o=[h.WpEblockApi];function Ma(e){return typeof e=="string"&&e?`${e.replace(/Z$/,"")}Z`:void 0}function Py(e){return{async readRevisions(t,n=1){const o=await h.getApi(e,$o).eblock_revisions_list({parent:t,per_page:xy,page:n},{extraQuery:{_fields:Iy}}),i=(o?.data??[]).map(c=>r.WpBlockRevisionToBlockRevision(c)),s=Number(o?.headers?.get("X-WP-TotalPages"));return{revisions:i,page:n,hasMore:Number.isFinite(s)&&n<s}},async readAutosave(t){const n=h.getApi(e,$o),[o,i]=await Promise.all([n.eblock_autosaves_list({id:t},{extraQuery:{_fields:Ay}}),n.eblock_detail({id:t},{extraQuery:{_fields:"modified_gmt"}})]),s=(o?.data??[]).map(d=>{const u=d,p=r.WpBlockRevisionToBlockRevision(u),f=Ma(u.modified_gmt);return f?{...p,modified:f}:p}),c=Date.parse(Ma(i?.data?.modified_gmt)??"");return r.autosaveStateFromSlots(s,Number.isFinite(c)?c:void 0)},async saveAutosave(t,n){const o=n,i=o.global_block&&o.html?r.injectEmBlockIdIntoBlockHtml(o.html,t):o.html??"";r.writePendingData(t,{sentAt:Date.now(),html:i,common_styles:""});const s=await h.getApi(e,$o).eblock_autosaves_create({id:t},r.BlockAutoSaveToWpBlockAutoSave({title:o.title,html:i,project:o.project,excerpt:new Date().toISOString()}),{type:h.ContentType.FormData});return r.WpBlockRevisionToBlockRevision(s?.data)}}}var Ry="author,slug,date,modified,title,meta,acf.html,acf.common_styles,id,parent,date_gmt",jy="author,slug,date,modified,modified_gmt,title,meta,acf.html,acf.common_styles,id,parent";function Na(e){return typeof e=="string"&&e?`${e.replace(/Z$/,"")}Z`:void 0}var Oy=20,Uo=[h.WpEmailApi];function Ly(e){return{async readRevisions(t,n=1){const o=await h.getApi(e,Uo).email_revisions_list({parent:t,per_page:Oy,page:n},{extraQuery:{_fields:Ry}}),i=(o?.data??[]).map(c=>r.WpEmailRevisionToEmailRevision(c)),s=Number(o?.headers?.get("X-WP-TotalPages"));return{revisions:i,page:n,hasMore:Number.isFinite(s)&&n<s}},async readAutosave(t){const n=h.getApi(e,Uo),[o,i]=await Promise.all([n.email_autosaves_list({id:t},{extraQuery:{_fields:jy}}),n.email_detail({id:t},{extraQuery:{_fields:"modified_gmt"}})]),s=(o?.data??[]).map(d=>{const u=d,p=r.WpEmailRevisionToEmailRevision(u),f=Na(u.modified_gmt);return f?{...p,modified:f}:p}),c=Date.parse(Na(i?.data?.modified_gmt)??"");return r.autosaveStateFromSlots(s,Number.isFinite(c)?c:void 0)},async saveAutosave(t,n){const o=await h.getApi(e,Uo).email_autosaves_create({id:t},r.EmailAutoSaveToWpEmailAutoSave({...n,excerpt:new Date().toISOString()}),{type:h.ContentType.FormData});return r.WpEmailRevisionToEmailRevision(o?.data)}}}var Da=["_embedded","id","author","title","meta","emailtags","folder","group","modified","date","type","parent","date_gmt","acf.description","acf.html","acf.common_styles","acf.is_template","acf.lock","acf.parent_email","acf.project","acf.secret_hash","acf.subject","acf.utm_parameters"].join(","),zo=[h.WpEmailApi],Fa=e=>r.EmailToWpEmail(e);function My(e){return{async readEmail(t){const n=await h.getApi(e,zo).email_detail({id:r.toNumberSafe(t)},{extraQuery:{_embed:"wp:term",_fields:Da}});if(!n)throw new r.EmailOpenFailedError("unavailable");if(n.ok===!1)throw r.openFailureFromResponse(n);return n.data?r.WpEmailToEmail(n.data):null},async createEmail(t){const n={status:"publish",...Fa(t)},o=await h.getApi(e,zo).email_create(n,{type:h.ContentType.Json});return r.WpEmailToEmail(o?.data)},async updateEmail(t,n){const o=await h.getApi(e,zo).email_partial_update({id:t},Fa(n),{type:h.ContentType.Json,extraQuery:{_embed:"wp:term",_fields:Da}});return r.WpEmailToEmail(o?.data)}}}function Ny(e){r.injectRestEmailPortFactories(e,{email:My,history:Ly,blockHistory:Py})}var Go=20,Dy=({source:e,emailtags:t,group:n,tags:o,...i})=>i;function Fy({revisions:e,revisionsByBlock:t}){const n=async(o,i)=>(t.clear(),await t.get(o,{page:i}),(await e.cache.values()??[]).filter(s=>String(s?.parent)===String(o)));return{async readRevisions(o,i=1){const s=await n(o,i);return{revisions:s.slice(Go*(i-1),Go*i),page:i,hasMore:s.length>Go*i}},async readAutosave(o){return r.autosaveStateFromRevisions(await n(o,1))},async saveAutosave(o,i){const s=Dy(i);return await e.create({...s,parent:o,modified:new Date().toString()})}}}var Ba=h.createIdentifier$1("blockDocuments.provided");function By(e){if(e.getInstance(Ba))return;e.inject(Ba,!0);const t=r.blockRevisionsDataSourceProvider(e);r.injectBlockHistoryPort(e,Fy({revisions:t,revisionsByBlock:t.byForeignKey("parent")}))}var $y=zt.__commonJSMin(((e,t)=>{(function(n){if(typeof window>"u")return;var o=0,i,s=!1,c=!1,d=7,u="[iFrameSizer]",p=u.length,f=null,g=window.requestAnimationFrame,y=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),m={},E=null,k=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,license:"1jqr0si6pnt",log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){O("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}});function w(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function v(C,T,R){C.addEventListener(T,R,!1)}function x(C,T,R){C.removeEventListener(T,R,!1)}function P(){for(var C=["moz","webkit","o","ms"],T=0;T<C.length&&!g;T+=1)g=window[C[T]+"RequestAnimationFrame"];g?g=g.bind(window):L("setup","RequestAnimationFrame not supported")}function K(C){var T="Host page: "+C;return window.top!==window.self&&(T=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+C:"Nested host page: "+C),T}function J(C){return u+"["+K(C)+"]"}function N(C){return m[C]?m[C].log:s}function L(C,T){z("log",C,T,N(C))}function A(C,T){z("info",C,T,N(C))}function O(C,T){z("warn",C,T,!0)}function z(C,T,R,D){D===!0&&window.console}function B(C){function T(){function $(){et(oe),Z(ee),Ge("onResized",oe)}S("Height"),S("Width"),be($,oe,"init")}function R(){var $=Xe.slice(p).split(":"),le=$[1]?parseInt($[1],10):0,xe=m[$[0]]&&m[$[0]].iframe,Se=getComputedStyle(xe);return{iframe:xe,id:$[0],height:le+D(Se)+I(Se),width:$[2],type:$[3]}}function D($){return $.boxSizing!=="border-box"?0:($.paddingTop?parseInt($.paddingTop,10):0)+($.paddingBottom?parseInt($.paddingBottom,10):0)}function I($){return $.boxSizing!=="border-box"?0:($.borderTopWidth?parseInt($.borderTopWidth,10):0)+($.borderBottomWidth?parseInt($.borderBottomWidth,10):0)}function S($){var le=Number(m[ee]["max"+$]),xe=Number(m[ee]["min"+$]),Se=$.toLowerCase(),Me=Number(oe[Se]);L(ee,"Checking "+Se+" is in range "+xe+"-"+le),Me<xe&&(Me=xe,L(ee,"Set "+Se+" to min value")),Me>le&&(Me=le,L(ee,"Set "+Se+" to max value")),oe[Se]=""+Me}function ae(){function $(){function Se(){var We=0,Be=!1;for(L(ee,"Checking connection is from allowed list of origins: "+xe);We<xe.length;We++)if(xe[We]===le){Be=!0;break}return Be}function Me(){var We=m[ee]&&m[ee].remoteHost;return L(ee,"Checking connection is from: "+We),le===We}return xe.constructor===Array?Se():Me()}var le=C.origin,xe=m[ee]&&m[ee].checkOrigin;if(xe&&""+le!="null"&&!$())throw new Error("Unexpected message received from: "+le+" for "+oe.iframe.id+". Message was: "+C.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}function we(){return u===(""+Xe).slice(0,p)&&Xe.slice(p).split(":")[0]in m}function Ye(){var $=oe.type in{true:1,false:1,undefined:1};return $&&L(ee,"Ignoring init message from meta parent page"),$}function Qe($){return Xe.slice(Xe.indexOf(":")+d+$)}function ze($){L(ee,"onMessage passed: {iframe: "+oe.iframe.id+", message: "+$+"}"),Ge("onMessage",{iframe:oe.iframe,message:JSON.parse($)}),L(ee,"--")}function Ze(){var $=document.body.getBoundingClientRect(),le=oe.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:le.height,iframeWidth:le.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(le.top-$.top,10),offsetLeft:parseInt(le.left-$.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}function pt($,le){function xe(){fe("Send Page Info","pageInfo:"+Ze(),$,le)}Te(xe,32,le)}function bt(){function $(Me,We){function Be(){m[Se]?pt(m[Se].iframe,Se):le()}["scroll","resize"].forEach(function(ot){L(Se,Me+ot+" listener for sendPageInfo"),We(window,ot,Be)})}function le(){$("Remove ",x)}function xe(){$("Add ",v)}var Se=ee;xe(),m[Se]&&(m[Se].stopPageInfo=le)}function ft(){m[ee]&&m[ee].stopPageInfo&&(m[ee].stopPageInfo(),delete m[ee].stopPageInfo)}function lt(){var $=!0;return oe.iframe===null&&(O(ee,"IFrame ("+oe.id+") not found"),$=!1),$}function G($){var le=$.getBoundingClientRect();return H(ee),{x:Math.floor(Number(le.left)+Number(f.x)),y:Math.floor(Number(le.top)+Number(f.y))}}function V($){function le(){f=We,te(),L(ee,"--")}function xe(){return{x:Number(oe.width)+Me.x,y:Number(oe.height)+Me.y}}function Se(){window.parentIFrame?window.parentIFrame["scrollTo"+($?"Offset":"")](We.x,We.y):O(ee,"Unable to scroll to requested position, window.parentIFrame not found")}var Me=$?G(oe.iframe):{x:0,y:0},We=xe();L(ee,"Reposition requested from iFrame (offset x:"+Me.x+" y:"+Me.y+")"),window.top===window.self?le():Se()}function te(){Ge("onScroll",f)===!1?De():Z(ee)}function ue($){function le(){var Be=G(We);L(ee,"Moving to in page link (#"+Se+") at x: "+Be.x+" y: "+Be.y),f={x:Be.x,y:Be.y},te(),L(ee,"--")}function xe(){window.parentIFrame?window.parentIFrame.moveToAnchor(Se):L(ee,"In page link #"+Se+" not found and window.parentIFrame not found")}var Se=$.split("#")[1]||"",Me=decodeURIComponent(Se),We=document.getElementById(Me)||document.getElementsByName(Me)[0];We?le():window.top===window.self?L(ee,"In page link #"+Se+" not found"):xe()}function he($){var le={};if(Number(oe.width)===0&&Number(oe.height)===0){var xe=Qe(9).split(":");le={x:xe[1],y:xe[0]}}else le={x:oe.width,y:oe.height};Ge($,{iframe:oe.iframe,screenX:Number(le.x),screenY:Number(le.y),type:oe.type})}function Ge($,le){return U(ee,$,le)}function qe(){switch(m[ee]&&m[ee].firstRun&&Le(),oe.type){case"close":me(oe.iframe);break;case"message":ze(Qe(6));break;case"mouseenter":he("onMouseEnter");break;case"mouseleave":he("onMouseLeave");break;case"autoResize":m[ee].autoResize=JSON.parse(Qe(9));break;case"scrollTo":V(!1);break;case"scrollToOffset":V(!0);break;case"pageInfo":pt(m[ee]&&m[ee].iframe,ee),bt();break;case"pageInfoStop":ft();break;case"inPageLink":ue(Qe(9));break;case"reset":ve(oe);break;case"init":T(),Ge("onInit",oe.iframe);break;default:Number(oe.width)===0&&Number(oe.height)===0?O("Unsupported message received ("+oe.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):T()}}function st($){var le=!0;return m[$]||(le=!1,O(oe.type+" No settings for "+$+". Message was: "+Xe)),le}function Bt(){for(var $ in m)fe("iFrame requested init",Y($),m[$].iframe,$)}function Le(){m[ee]&&(m[ee].firstRun=!1)}var Xe=C.data,oe={},ee=null;Xe==="[iFrameResizerChild]Ready"?Bt():we()?(oe=R(),ee=oe.id,m[ee]&&(m[ee].loaded=!0),!Ye()&&st(ee)&&(L(ee,"Received: "+Xe),lt()&&ae()&&qe())):A(ee,"Ignored: "+Xe)}function U(C,T,R){var D=null,I=null;if(m[C])if(D=m[C][T],typeof D=="function")I=D(R);else throw new TypeError(T+" on iFrame["+C+"] is not a function");return I}function de(C){var T=C.id;delete m[T]}function me(C){var T=C.id;if(U(T,"onClose",T)===!1){L(T,"Close iframe cancelled by onClose event");return}L(T,"Removing iFrame: "+T);try{C.parentNode&&C.parentNode.removeChild(C)}catch(R){O(R)}U(T,"onClosed",T),L(T,"--"),de(C),i&&(i.disconnect(),i=null)}function H(C){f===null&&(f={x:window.pageXOffset===n?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===n?document.documentElement.scrollTop:window.pageYOffset},L(C,"Get page position: "+f.x+","+f.y))}function Z(C){f!==null&&(window.scrollTo(f.x,f.y),L(C,"Set page position: "+f.x+","+f.y),De())}function De(){f=null}function ve(C){function T(){et(C),fe("reset","reset",C.iframe,C.id)}L(C.id,"Size reset requested by "+(C.type==="init"?"host page":"iFrame")),H(C.id),be(T,C,"reset")}function et(C){function T(S){if(!C.id){L("undefined","messageData id not set");return}C.iframe.style[S]=C[S]+"px",L(C.id,"IFrame ("+I+") "+S+" set to "+C[S]+"px")}function R(S){!c&&C[S]==="0"&&(c=!0,L(I,"Hidden iFrame detected, creating visibility listener"),Fe())}function D(S){T(S),R(S)}var I=C.iframe.id;m[I]&&(m[I].sizeHeight&&D("height"),m[I].sizeWidth&&D("width"))}function be(C,T,R){R!==T.type&&g&&!window.jasmine?(L(T.id,"Requesting animation frame"),g(C)):C()}function fe(C,T,R,D,I){function S(){var ze=m[D]&&m[D].targetOrigin;L(D,"["+C+"] Sending msg to iframe["+D+"] ("+T+") targetOrigin: "+ze),R.contentWindow.postMessage(u+T,ze)}function ae(){O(D,"["+C+"] IFrame("+D+") not found")}function we(){R&&"contentWindow"in R&&R.contentWindow!==null?S():ae()}function Ye(){function ze(){m[D]&&!m[D].loaded&&!Qe&&(Qe=!0,O(D,"IFrame has not responded within "+m[D].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}I&&m[D]&&m[D].warningTimeout&&(m[D].msgTimeout=setTimeout(ze,m[D].warningTimeout))}var Qe=!1;D=D||R.id,m[D]&&(we(),Ye())}function Y(C){return C+":"+m[C].bodyMarginV1+":"+m[C].sizeWidth+":"+m[C].log+":"+m[C].interval+":"+m[C].enablePublicMethods+":"+m[C].autoResize+":"+m[C].bodyMargin+":"+m[C].heightCalculationMethod+":"+m[C].bodyBackground+":"+m[C].bodyPadding+":"+m[C].tolerance+":"+m[C].inPageLinks+":"+m[C].resizeFrom+":"+m[C].widthCalculationMethod+":"+m[C].mouseEvents}function pe(C){return typeof C=="number"}function ie(C,T){function R(){function V(ue){var he=m[G][ue];he!==1/0&&he!==0&&(C.style[ue]=pe(he)?he+"px":he,L(G,"Set "+ue+" = "+C.style[ue]))}function te(ue){if(m[G]["min"+ue]>m[G]["max"+ue])throw new Error("Value for min"+ue+" can not be greater than max"+ue)}te("Height"),te("Width"),V("maxHeight"),V("minHeight"),V("maxWidth"),V("minWidth")}function D(){var V=T&&T.id||k.id+o++;return document.getElementById(V)!==null&&(V+=o++),V}function I(V){if(typeof V!="string")throw new TypeError("Invaild id for iFrame. Expected String");return V===""&&(C.id=V=D(),s=(T||{}).log,L(V,"Added missing iframe ID: "+V+" ("+C.src+")")),V}function S(){switch(L(G,"IFrame scrolling "+(m[G]&&m[G].scrolling?"enabled":"disabled")+" for "+G),C.style.overflow=(m[G]&&m[G].scrolling)===!1?"hidden":"auto",m[G]&&m[G].scrolling){case"omit":break;case!0:C.scrolling="yes";break;case!1:C.scrolling="no";break;default:C.scrolling=m[G]?m[G].scrolling:"no"}}function ae(){(typeof(m[G]&&m[G].bodyMargin)=="number"||(m[G]&&m[G].bodyMargin)==="0")&&(m[G].bodyMarginV1=m[G].bodyMargin,m[G].bodyMargin=""+m[G].bodyMargin+"px")}function we(){var V=m[G]&&m[G].firstRun,te=m[G]&&m[G].heightCalculationMethod in y;!V&&te&&ve({iframe:C,height:0,width:0,type:"init"})}function Ye(){m[G]&&(m[G].iframe.iFrameResizer={close:me.bind(null,m[G].iframe),removeListeners:de.bind(null,m[G].iframe),resize:fe.bind(null,"Window resize","resize",m[G].iframe),moveToAnchor:function(V){fe("Move to anchor","moveToAnchor:"+V,m[G].iframe,G)},sendMessage:function(V){V=JSON.stringify(V),fe("Send Message","message:"+V,m[G].iframe,G)}})}function Qe(V){function te(){fe("iFrame.onload",V,C,n,!0),we()}function ue(Ge){if(!C.parentNode)return null;var qe=new Ge(function(st){st.forEach(function(Bt){Array.prototype.slice.call(Bt.removedNodes).forEach(function(Le){Le===C&&me(C)})})});return qe.observe(C.parentNode,{childList:!0}),qe}var he=w();he&&(i=ue(he)),v(C,"load",te),fe("init",V,C,n,!0)}function ze(V){if(typeof V!="object")throw new TypeError("Options is not an object")}function Ze(V){for(var te in k)Object.prototype.hasOwnProperty.call(k,te)&&(m[G][te]=Object.prototype.hasOwnProperty.call(V,te)?V[te]:k[te])}function pt(V){return V===""||V.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":V}function bt(V){var te=V.split("Callback");if(te.length===2){var ue="on"+te[0].charAt(0).toUpperCase()+te[0].slice(1);this[ue]=this[V],delete this[V],O(G,"Deprecated: '"+V+"' has been renamed '"+ue+"'. The old method will be removed in the next major version.")}}function ft(V){V=V||{},m[G]=Object.create(null),m[G].iframe=C,m[G].firstRun=!0,m[G].remoteHost=C.src&&C.src.split("/").slice(0,3).join("/"),ze(V),Object.keys(V).forEach(bt,V),Ze(V),m[G]&&(m[G].targetOrigin=m[G].checkOrigin===!0?pt(m[G].remoteHost):"*")}function lt(){return G in m&&"iFrameResizer"in C}var G=I(C.id);lt()?O(G,"Ignored iFrame, already setup."):(ft(T),S(),R(),ae(),Qe(Y(G)),Ye())}function se(C,T){E===null&&(E=setTimeout(function(){E=null,C()},T))}var Ae={};function Te(C,T,R){Ae[R]||(Ae[R]=setTimeout(function(){Ae[R]=null,C()},T))}function Fe(){function C(){function I(S){function ae(Ye){return(m[S]&&m[S].iframe.style[Ye])==="0px"}function we(Ye){return Ye.offsetParent!==null}m[S]&&we(m[S].iframe)&&(ae("height")||ae("width"))&&fe("Visibility change","resize",m[S].iframe,S)}Object.keys(m).forEach(function(S){I(S)})}function T(I){L("window","Mutation observed: "+I[0].target+" "+I[0].type),se(C,16)}function R(){var I=document.querySelector("body");new D(T).observe(I,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0})}var D=w();D&&R()}function X(C){function T(){Ie("Window "+C,"resize")}L("window","Trigger event: "+C),se(T,16)}function Ee(){function C(){Ie("Tab Visible","resize")}document.visibilityState!=="hidden"&&(L("document","Trigger event: Visibility change"),se(C,16))}function Ie(C,T){function R(D){return m[D]&&m[D].resizeFrom==="parent"&&m[D].autoResize&&!m[D].firstRun}Object.keys(m).forEach(function(D){R(D)&&fe(C,T,m[D].iframe,D)})}function ge(){v(window,"message",B),v(window,"resize",function(){X("resize")}),v(document,"visibilitychange",Ee),v(document,"-webkit-visibilitychange",Ee)}function Re(){function C(D,I){function S(){if(I.tagName){if(I.tagName.toUpperCase()!=="IFRAME")throw new TypeError("Expected <IFRAME> tag, found <"+I.tagName+">")}else throw new TypeError("Object is not a valid DOM element")}I&&(S(),ie(I,D),R.push(I))}function T(D){D&&D.enablePublicMethods&&O("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}var R;return P(),ge(),function(I,S){switch(R=[],T(I),typeof S){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(S||"iframe"),C.bind(n,I));break;case"object":C(I,S);break;default:throw new TypeError("Unexpected data type ("+typeof S+")")}return R}}function Ue(C){C.fn?C.fn.iFrameResize||(C.fn.iFrameResize=function(R){function D(I,S){ie(S,R)}return this.filter("iframe").each(D).end()}):A("","Unable to bind to jQuery, it is not fully loaded.")}window.jQuery!==n&&Ue(window.jQuery),typeof define=="function"&&define.amd?define([],Re):typeof t=="object"&&typeof t.exports=="object"&&(t.exports=Re()),window.iFrameResize=window.iFrameResize||Re()})()})),Uy=zt.__toESM($y()),zy={checkOrigin:!1,minHeight:600,scrolling:!1};function Gy(e){const t=()=>e.iFrameResizer;return(0,Uy.default)(zy,e),{resize:()=>t()?.resize?.(),dispose:()=>t()?.removeListeners?.()}}function Wy(e){e.inject(Mi,Gy)}function Hy(e){const t=r.getMessageService(e),n=e.getInstance(r.LOCALE_SERVICE_ID);if(!n)return;let o="";const i=()=>{const d=n.snapshot(),u=d.id??"";if(!t.isInited()||u===o)return;const p=r.createI18n(d.catalog),f=y=>p.__(y),g=r.SANDBOX_TRANSLATIONS_MAP(f);o=u,t.send(r.EVENT_TYPES.SANDBOX_TRANSLATIONS,{name:u,data:g})},s=t.onInit(()=>{o="",i()}),c=n.state.watch(i);e.getInstance(h.DISPOSABLE_ID)?.addDispose(()=>{s.dispose(),c.dispose()})}function qy(e){const t=e?.content?.templateId;return t==null||t===""?void 0:String(t)}function Vy(e){e.getInstance(h.OPTIONS_SOURCE_ID)?.watch(t=>{const n=qy(t);n!==void 0&&Fg(e,n)})}var Wo={en_US:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/c00a8e02.js")).then(e=>e.en_US_exports),void 0,{}.url),ru_RU:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/8fb0fe48.js")),void 0,{}.url),uk_UA:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/9a70cc1e.js")),void 0,{}.url),es_ES:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/5bf994b4.js")),void 0,{}.url),pt_BR:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/a15ab67d.js")),void 0,{}.url),de_DE:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/ffb36e93.js")),void 0,{}.url),fr_FR:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/364dcebf.js")),void 0,{}.url),it_IT:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/dfddbd68.js")),void 0,{}.url),pl_PL:()=>(0,Ve.__vitePreload)(()=>Promise.resolve().then(()=>ye("./static/core/f3eda1c7.js")),void 0,{}.url)};async function Ky(e){const t=Wo[e];if(!t){const n=Wo.en_US;return n?(await n()).default:void 0}return(await t()).default}var v0=Object.keys(Wo),Yy=e=>e==="uk"?"uk_UA":e;function Qy(e){e.getInstance(r.LOCALE_SERVICE_ID)?.useAntdLoader(t=>Ky(Yy(t)))}function Xy(e){}function $a(e,t,n){let o=!1;const i=e.watch(s=>{o||!t(s)||(o=!0,n())});o&&i.dispose()}function Jy(e,t){const n=e.getInstance(h.CONFIG_SOURCE_ID);n&&$a(n,o=>!!o?.codeEnabled||!!o?.codeSideEnabled,()=>{tv(e,()=>{nv(e,()=>{ev(e,()=>{Ht(e).whenVisible(()=>{Xt(()=>{Zy(t).catch(()=>{})})})})})})})}async function Zy(e){await e()}function ev(e,t){const n=e.getInstance(Ns);if(!n){Xt(t);return}const o=()=>{if(n.pipeline.filledGeneration()!==void 0){t();return}Xt(o)};Xt(o)}function tv(e,t){const n=e.getInstance(r.EMAIL_DOCUMENTS_ID);if(!n)return;if(n.current()){t();return}let o=!1;const i=n.subscribe(()=>{o||!n.current()||(o=!0,t())});o&&i()}function nv(e,t){const n=e.getInstance(h.OPTIONS_SOURCE_ID);n&&$a(n,o=>!!o?.element,t)}function rv(e){Jy(e,tu)}var Ua=h.createIdentifier$1("NotificationService");function za(e,t="success"){return typeof e=="string"&&(e={message:e}),r.filterUndefined({type:e.type||t,data:e.data,innerException:e.innerException,title:e.message,description:e.description,actions:e.btn,onClose:e.onClose,duration:e.duration,icon:e.icon,placement:e.placement,style:e.style,closeIcon:e.closeIcon,props:e.props,role:e.role})}var ov="bottomRight";function Ho(e,t){return typeof e=="string"||typeof e=="object"?za(e,t):e}var iv=class extends h.Disposable{send;onNotify;onError;onSuccess;constructor(e,t,n){super(),this.send=n,this.onNotify=Ct(t,c=>c,c=>Ho(c)),this.onError=Ct(h.filter(t,c=>c.type==="error"),c=>c,c=>Ho(c,"error")),this.onSuccess=Ct(h.filter(t,c=>c.type==="success"),c=>c,c=>Ho(c));const o=this.addDisposable(new kt(this.onNotify)),i=this.addDisposable(new kt(this.onError)),s=this.addDisposable(new kt(this.onSuccess));this.addDisposable(e.watch(({handleNotify:c,handleError:d,handleSuccess:u})=>{o.setListener(c),i.setListener(d),s.setListener(u)}))}notify(e){this.send({placement:ov,...za(e)})}};function sv(e){e.injectFactory(Ua,()=>{const t=new iv(e.getInstance(h.OPTIONS_SOURCE_ID),h.getEvent(e,h.events.ON_NOTIFICATION),n=>{r.executeCommand(e,r.NOTIFY_COMMAND_ID,n)});return e.getInstance(h.DISPOSABLE_ID)?.addDisposable(t),t},!0)}function av(e){const t=r.getEmailDocuments(e),n=i=>{e.getInstance(h.STORE_ID)?.dispatch(r.taxonomiesApi.util.invalidateTags([{type:"folder",id:i}]))},o=t.onSaved(i=>{i.created&&n("folder")});e.getInstance(h.DISPOSABLE_ID)?.addDispose(o)}function b0(e){return e}var lv=[{name:"rest.legacySections",provides:[h.REST_CLIENT_ID],setup:h.provideLegacyRestSections},{name:"canvas.resizer",provides:[Mi],setup:Wy},{name:"canvas.sandboxLocale",awaits:{services:[r.LOCALE_SERVICE_ID]},setup:Hy},{name:"locale.brandCatalog",awaits:{services:[r.LOCALE_SERVICE_ID]},setup:Xy},{name:"email.restPorts",provides:[r.REST_EMAIL_PORTS_ID],setup:Ny},{name:"block.historyPort",setup:By},{name:"email.templatePrefetch",setup:Vy},{name:"locale.antd",awaits:{services:[r.LOCALE_SERVICE_ID]},setup:Qy},{name:"save.listsFollow",setup:av},{name:"monaco.prewarm",awaits:{services:[h.CONFIG_SOURCE_ID]},setup:rv},{name:"notifications",provides:[Ua],setup:sv},{name:"email.operations",setup:vy}],cv=h.defineMixin(e=>{for(const t of Ty(lv))t.setup(e);return{instance:by(e)}}),dv=h.combineMixins([cv,P_,iy,dy,Ey,Sy,jg,sy,$s,Us]);async function uv(e){const t=new Map;typeof e=="object"&&(e=e.code);const{amp2html:n,html2amp:o}=await(0,Ve.__vitePreload)(async()=>{const{amp2html:c,html2amp:d}=await Promise.resolve().then(()=>ye("./static/core/30f16e98.js"));return{amp2html:c,html2amp:d}},void 0,{}.url),i=await yt.changeHtml(e,async c=>{await yt.replaceImagesInDocument(c.document,d=>r.mapper.getEscapedText(d)!==d?d:r.toAbsoluteUrl(d),t);for(const d of c.document.querySelectorAll(".em-amp-show-disabled"))d.remove();c.handleRender(async({contentDocument:d,managedNodeController:u})=>{await o(d,{mappedTags:{script:"___script"},commit:()=>u.commit()})})},[800]),s=await yt.changeHtml(e,async c=>{await yt.replaceImagesInDocument(c.document,d=>r.mapper.getEscapedText(d)!==d?d:r.toAbsoluteUrl(d),t);for(const d of c.document.querySelectorAll(".em-amp-show-only"))d.remove();await n(c.document,{mappedTags:{script:"___script"}})},[800]);return{code:e,html:s,ampHtml:i}}async function pv(){const{installDiagnostics:e}=await(0,Ve.__vitePreload)(async()=>{const{installDiagnostics:t}=await Promise.resolve().then(()=>ye("./static/core/199dc589.js"));return{installDiagnostics:t}},void 0,{}.url);return e()}async function mv(e,t){const{initDevTools:n}=await(0,Ve.__vitePreload)(async()=>{const{initDevTools:o}=await Promise.resolve().then(()=>ye("./static/core/52fbc985.js"));return{initDevTools:o}},void 0,{}.url);n(e,t)}var fv="1.1.85-dev.4";nn.asyncMixins=dv,nn.initDevTools=mv,nn.installDiagnostics=pv,nn.parseAMP=uv,nn.version=fv});
|