@markopolo_ai_inc/markopolo-email-editor 1.0.57 → 1.0.59
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/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("antd"),n=require("@fortawesome/react-fontawesome"),o=require("@fortawesome/free-solid-svg-icons"),a=require("framer-motion"),l=require("react/jsx-runtime"),i=require("react-dom"),r=require("react-color");function s(e){const t=String(e??"").trim();return/^(?:javascript|vbscript)\s*:/i.test(t)||/^data\s*:/i.test(t)}function c(e){let t=String(e??"").trim();if(!t)return"";if(s(t))return"";for(let e=0;e<t.length;e++){const n=t.charCodeAt(e),o=t[e];if(n<32||"<"===o||">"===o||'"'===o)return""}return t}function d(e){const t=String(e??"").trim().match(/^https?:\/\/(.+)/is);return!!t&&/^https?:\/\//i.test(t[1])}function u(e,t={}){const{allowMailtoTel:n=!0}=t,o=String(e??"").trim();if(!o)return null;if(s(o))return null;if(d(o))return null;if(n&&(/^mailto:/i.test(o)||/^tel:/i.test(o)))return o;const a=/^https?:\/\//i.test(o)?o:`https://${o.replace(/^\/+/,"")}`;return p(a,!1,t)?a:null}function p(e,t=!1,n={}){return null==m(e,t,n)}function m(e,t=!1,n={}){const{allowMailtoTel:o=!0}=n;if(null==e||""===String(e).trim())return t?null:"empty";const a=String(e).trim();if(s(a))return"blocked_scheme";if(d(a))return"duplicate_protocol";let l;if(/^https?:\/\//i.test(a)){const e=a.replace(/^https?:\/\//i,"");if(/^https?:\/\//i.test(e))return"duplicate_protocol";l=a}else l=o&&/^mailto:/i.test(a)||o&&/^tel:/i.test(a)?a:`https://${a}`;try{const e=new URL(l);return"http:"===e.protocol||"https:"===e.protocol?function(e){const t=String(e??"").trim().toLowerCase();return""!==t&&"http"!==t&&"https"!==t&&("localhost"===t||!!t.includes(":")||!!/^(?:\d{1,3}\.){3}\d{1,3}$/.test(t)||t.includes("."))}(e.hostname)?null:"missing_hostname_dot":o&&"mailto:"===e.protocol||o&&"tel:"===e.protocol?null:"invalid_protocol"}catch{return"invalid_url"}}function g(e){const t=String(e?.image||"").toLowerCase(),n=String(e?.title||"").toLowerCase().trim();return t.includes("/tc-x.svg")||t.includes("/brand-x.svg")||t.includes("/icons/x.svg")||t.includes("simple-icons")&&t.includes("/x.svg")||"x"===n||"twitter"===n}const h=["default","white","black","gray"];function b(e){const t="string"==typeof e?e:"gray";return h.includes(t)?t:"default"}function y(e){if(!e||"object"!=typeof e)return{};const{padding:t,paddingTop:n,paddingRight:o,paddingBottom:a,paddingLeft:l,...i}=e;return i}const f={small:21,medium:24,large:32},_="https://unpkg.com/@tabler/icons@3.24.0/icons/outline",k={facebook:"brand-facebook",x:"brand-x",instagram:"brand-instagram",linkedin:"brand-linkedin",tiktok:"brand-tiktok",youtube:"brand-youtube",pinterest:"brand-pinterest"};function x(e){if(!e)return null;const t=k[e];return t?`${_}/${t}.svg`:null}const v={left:"flex-start",center:"center",right:"flex-end",justify:"space-between"};function w(e){const t=e&&"object"==typeof e?{...e}:{},n=t.columnGapPx,o="number"==typeof n&&Number.isFinite(n)&&n>=0?n:8;delete t.columnGapPx;const a=t.textAlign||"center";delete t.textAlign;const l=v[a]||v.left;return{...t,display:"flex",width:"100%",maxWidth:"100%",boxSizing:"border-box",flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:l,columnGap:o,rowGap:0}}function S(e){if(!e)return null;if(g(e))return"x";const t=String(e.image||"").toLowerCase(),n=String(e.title||"").toLowerCase();return t.includes("facebook")||n.includes("facebook")?"facebook":t.includes("instagram")||n.includes("instagram")?"instagram":t.includes("linkedin")||n.includes("linkedin")?"linkedin":t.includes("tiktok")||n.includes("tiktok")?"tiktok":t.includes("youtube")||n.includes("youtube")?"youtube":t.includes("pinterest")||n.includes("pinterest")?"pinterest":null}const j="https://s.magecdn.com/social";const C={facebook:"tc-facebook.svg",x:"tc-x.svg",instagram:"tc-instagram.svg",linkedin:"tc-linkedin.svg",tiktok:"tc-tiktok.svg",youtube:"tc-youtube.svg",pinterest:"tc-pinterest.svg"};function N(e){const t=String(e||"").toLowerCase();return x("twitter"===t?"x":t)}function I(e){const t=e?.iconSize;if(t&&null!=f[t])return f[t];const n=Number(e?.imageWidth);return Number.isFinite(n)&&n>0?Math.round(n):f.medium}function A(e){const t=function(e){switch(e){case"white":return"brightness(0) invert(1)";case"black":return"brightness(0)";case"gray":return"brightness(0) opacity(0.55)";default:return""}}(e);return t?{filter:t}:{}}function L(e,t,n){const o=Number(n)||f.medium,a={width:o,height:o,objectFit:"contain",display:"block",verticalAlign:"middle",flexShrink:0},l=t&&"default"!==t?t:"default",i=String(e?.image||"").trim(),r=function(e){return x(S(e))}(e),s=function(e){const t=S(e);if(!t)return null;const n=C[t];return n?`${j}/${n}`:null}(e);if(i&&!function(e){const t=String(e||"").trim().toLowerCase();return!(!t||!t.startsWith(String(j).toLowerCase())&&!t.startsWith(String(_).toLowerCase())&&!t.includes("unpkg.com/@tabler/icons"))}(i))return{src:i,style:a};if("default"===l)return s?{src:s,style:a}:{src:i,style:a};if(r){if("white"===l)return{src:r,style:{...a,filter:"brightness(0) invert(1)"}};if("gray"===l)return{src:r,style:{...a,filter:"brightness(0) opacity(0.55)"}};if("black"===l)return{src:r,style:a}}return i?{src:i,style:{...a,...A(l)}}:{src:"",style:a}}function T(e,t,n){const{src:o,style:a}=L(e,t,n),l=Number(n)||f.medium,i=[`width:${l}px`,`height:${l}px`,"object-fit:contain","display:block","vertical-align:middle"];return a.filter&&i.push(`filter:${a.filter}`),null!=a.opacity&&i.push(`opacity:${a.opacity}`),{src:o,styleAttr:i.join(";")}}const B=e=>{const t=e.constructor===Array?[]:{};for(let n in e)e.hasOwnProperty(n)&&(e[n]&&"object"==typeof e[n]?(t[n]=e[n].constructor===Array?[]:{},t[n]=B(e[n])):t[n]=e[n]);return t},$=(e,t)=>{let n=null;return function(){n||(n=setTimeout(()=>{e.apply(this,arguments),n=null},t))}};function R(e,t={}){if(null==e||"string"!=typeof e)return e;const n=null!=t.fontSize?Number(t.fontSize):14,o=null!=t.fontFamily?String(t.fontFamily):"sans-serif",a=null!=t.color?String(t.color):"",l=["direction: ltr",`font-size: ${n}px`,`font-family: ${o}`];a&&l.push(`color: ${a}`);const i=t.fontWeight;null!=i&&""!==String(i).trim()&&l.push(`font-weight: ${i}`);const r=t.fontStretch;null!=r&&""!==String(r).trim()&&"normal"!==String(r).toLowerCase()&&l.push(`font-stretch: ${r}`);const s=t.textTransform;null!=s&&""!==String(s).trim()&&"none"!==String(s).toLowerCase()&&l.push(`text-transform: ${s}`);const c=l.join("; ");let d=function(e){if(null==e||"string"!=typeof e)return e;let t=e.replace(/\sstyle\s*=\s*["']([^"']*)["']/gi,(e,t)=>{const n=t.replace(/\s*font-size\s*:[^;]+;?/gi,"").replace(/\s*font-family\s*:[^;]+;?/gi,"").replace(/\s*color\s*:[^;]+;?/gi,"").replace(/^;\s*|;\s*$/g,"").trim();return n?` style="${n}"`:""}),n="";for(let e=0;e<20&&n!==t;e++)n=t,t=t.replace(/<font(\s[^>]*)?>([\s\S]*?)<\/font>/gi,"$2");return t}(e.trim());const u=/^<span(?:\s[^>]*)?>([\s\S]*)<\/span>$/i.exec(d.trim()),p=/^<div(?:\s[^>]*)?>([\s\S]*)<\/div>$/i.exec(d.trim());return u?d=u[1]:p&&(d=p[1]),`<span style="${c}">${d}</span>`}function P(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function M(e){if(!e||"object"!=typeof e)return;e.id||(e.id=P());const t=e.children;Array.isArray(t)&&t.forEach(M)}function F(e){if(!e||"object"!=typeof e)return;e.id=P();const t=e.children;Array.isArray(t)&&t.forEach(F)}function U(e){if(!e||"object"!=typeof e)return e;const t=B(e);return F(t),t}const D=[{key:"facebook",image:N("facebook"),title:"Facebook"},{key:"twitter",image:N("twitter"),title:"X"},{key:"instagram",image:N("instagram"),title:"Instagram"},{key:"linkedin",image:N("linkedin"),title:"LinkedIn"},{key:"tiktok",image:N("tiktok"),title:"TikTok"},{key:"youtube",image:N("youtube"),title:"YouTube"}];function E(e){const t=e?.socialPlatformKey;if(t&&"string"==typeof t&&D.some(e=>e.key===t))return t;if(g(e))return"twitter";const n=String(e?.title??"").trim().toLowerCase(),o=String(e?.image??"").trim();for(const e of D){if(n&&n===e.title.toLowerCase())return e.key;if("twitter"===e.key&&n&&("twitter"===n||"tweet"===n||"tw"===n))return"twitter";if(o&&o===e.image)return e.key}return null}function z(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:{},o=Array.isArray(e)?e:[],a=new Map,l=[];for(const e of o){const t=E(e);t?a.set(t,e):l.push(e)}return[...D.map(e=>{const t=a.get(e.key),o=null!=n[e.key]?c(String(n[e.key]).trim()):"",l=null!=t?.linkURL?String(t.linkURL).trim():"",i=l?c(l):"",r=o||i||"";return{id:t?.id??P(),image:t?.image||e.image,title:t?.title||e.title,linkURL:r,socialPlatformKey:e.key}}),...l]}const O=[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}];function W(e,t){if(!e)return e;const n=t&&"object"==typeof t?t:{},o=n?.companyContext?.navigation_links,a=Array.isArray(o)&&o.length>0,l=n?.companyContext?.social_links,i=Object.values(e).some(e=>e&&"menu"===e.key&&!1!==e.useNavigationLinks),r=Object.values(e).some(e=>e&&"social_link"===e.key),s=Object.values(e).some(e=>e&&"column"===e.key&&"footer"===e.containerType&&e.footerUnifiedLayout&&!1!==e.footerUseCompanySocial);if(!i&&!r&&!s)return e;const c={...e};let d=!1;return Object.keys(e).forEach(t=>{const n=e[t];if(n){if("menu"===n.key&&!1!==n.useNavigationLinks){const e=a?o.map(e=>function(e){if(!e||"object"!=typeof e)return{label:"Link",url:"#",target:"_self"};const t=e.label??e.name??e.title??"Link",n="string"==typeof t?t:null!=t?String(t):"Link",o=e.url??e.href??e.link??e.uri??"";return{label:n||"Link",url:("string"==typeof o?o.trim():null!=o?String(o).trim():"")||"#",target:"_blank"===e.target||"_self"===e.target?e.target:"_self"}}(e)):O;c[t]={...n,list:e},d=!0}if("social_link"===n.key&&!1!==n.useCompanySocialLinks){const e=z(n.list??[],l??{}),o={...n,list:e};JSON.stringify({...n,list:n.list??[]})!==JSON.stringify(o)&&(c[t]=o,d=!0)}if("column"===n.key&&"footer"===n.containerType&&n.footerUnifiedLayout&&!1!==n.footerUseCompanySocial){const e=function(e,t){return z(e,t)}(n.footerSocialList??[],l??{});JSON.stringify(n.footerSocialList??[])!==JSON.stringify(e)&&(c[t]={...n,footerSocialList:e},d=!0)}}}),d?c:e}const H=280,K=1200,V={EMAIL_WIDTH:"email_width",CUSTOM_PX:"custom_px",FULL_BLEED:"full_bleed"};function G(e){const t=Math.round(Number(e));return!Number.isFinite(t)||t<=0?600:Math.min(K,Math.max(H,t))}function q(e){const t=e?.contentWidthMode;return Object.values(V).includes(t)?t:V.EMAIL_WIDTH}function J(e){return G(e?.contentWidth)}function Y(e){return q(e)===V.FULL_BLEED}function X(e="Drag block here",t){return{id:t||P(),name:e,key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}}}function Z(e){const t={},n=[];function o(e){if(e&&"object"==typeof e)if(e.id||(e.id=P()),"column"===e.key){const n=(e.children||[]).map(e=>{e.id||(e.id=P());const t=[];return(e.children||[]).forEach(e=>{e.id||(e.id=P()),o(e),t.push(e.id)}),{id:e.id,width:e.width,styles:e.styles,childrenIds:t}}),{children:a,...l}=e;t[e.id]={...l,cells:n}}else t[e.id]=e}return(e||[]).forEach(e=>{e.id||(e.id=P()),o(e),n.push(e.id)}),{blockMap:t,rootOrder:n}}function Q(e,t){function n(t){const o=e[t];if(!o)return null;if("column"===o.key){const e=(o.cells||[]).map(e=>({id:e.id,name:"Content",key:"content",width:e.width,styles:e.styles,children:(e.childrenIds||[]).map(e=>n(e)).filter(Boolean)})),{cells:t,...a}=o;return{...a,children:e}}return{...o}}return(t||[]).map(e=>n(e)).filter(Boolean)}function ee(e,t){const n=t[e];if(!n)return null;if("column"!==n.key)return n;const o=(n.cells||[]).map(e=>({id:e.id,name:"Content",key:"content",width:e.width,styles:e.styles,children:(e.childrenIds||[]).map(e=>{const n=t[e];return n?"column"===n.key?ee(e,t):n:null}).filter(Boolean)})),{cells:a,...l}=n;return{...l,children:o}}function te(e,t,n){function o(t){const a=e[t];if(!a||"column"!==a.key)return null;for(let l=0;l<(a.cells||[]).length;l++){const i=a.cells[l];for(let a=0;a<(i.childrenIds||[]).length;a++){if(i.childrenIds[a]===n)return{containerId:t,cellIndex:l,itemIndex:a};const r=e[i.childrenIds[a]];if(r&&"column"===r.key){const e=o(i.childrenIds[a]);if(e)return e}}}return null}for(const e of t||[]){const t=o(e);if(t)return t}return null}function ne(e,t,n){const o=(t||[]).indexOf(n);if(-1!==o){const t=e[n];return{containerBlock:t??null,containerType:t?.containerType??"none",cellIndex:0,isRoot:!0,rootIndex:o}}const a=te(e,t,n);if(!a)return{containerBlock:null,containerType:"none",cellIndex:0,isRoot:!1};const l=e[a.containerId];return{containerBlock:l??null,containerType:l?.containerType??"none",cellIndex:a.cellIndex,isRoot:!1}}function oe(e,t,n){const o=(t||[]).indexOf(n);if(-1!==o){const t=e[n];return[{containerBlock:t??null,containerType:t?.containerType??"none",cellIndex:0,isRoot:!0,rootIndex:o}]}function a(t,o=[]){const l=e[t];if(!l||"column"!==l.key)return null;for(let t=0;t<(l.cells||[]).length;t++){const i=l.cells[t];for(let r=0;r<(i.childrenIds||[]).length;r++){const s=i.childrenIds[r];if(s===n)return[{containerBlock:l,containerType:l?.containerType??"none",cellIndex:t,isRoot:!1},...o];const c=e[s];if(c&&"column"===c.key){const e=a(s,[{containerBlock:l,containerType:l?.containerType??"none",cellIndex:t,isRoot:!1},...o]);if(e)return e}}}return null}for(const e of t||[]){const t=a(e,[]);if(t)return t}return[]}function ae(e,t,n){const o=oe(e,t,n),a=o.find(e=>e?.containerType&&"none"!==e.containerType)||o[0]||null,l=a?.cellIndex??0,i=a?.containerBlock??null,r=i?.columnProducts?.[l]??null,s=Array.isArray(i?.columnProducts)?i.columnProducts.find(e=>null!=e)??null:null;return{containerType:a?.containerType??"none",columnIndex:l,columnProduct:r??s,containerBlock:i,lineage:o}}function le(e,t,n,o,a){const l=e[t];if(!l)return e;const i=l.cells.map((e,t)=>{if(t!==n)return e;const l=[...e.childrenIds];return l[o]=a,{...e,childrenIds:l}});return{...e,[t]:{...l,cells:i}}}function ie(e,t,n,o){const a=e[t];if(!a)return{blockMap:e,removedId:null};const l=a.cells[n];if(!l)return{blockMap:e,removedId:null};const i=l.childrenIds[o],r=[...l.childrenIds];r.splice(o,1);const s=a.cells.map((e,t)=>t===n?{...e,childrenIds:r}:e);return{blockMap:{...e,[t]:{...a,cells:s}},removedId:i}}function re(e,t,n,o,a){const l=e[t];if(!l)return e;const i=l.cells[n];if(!i)return e;const r=[...i.childrenIds];r.splice(o,0,a);const s=l.cells.map((e,t)=>t===n?{...e,childrenIds:r}:e);return{...e,[t]:{...l,cells:s}}}function se(e,t,n,o){if(!n||!e[n]||0===o)return null;const a=t.indexOf(n);if(-1!==a){const n=a+o;if(n<0||n>=t.length)return null;const l=[...t],[i]=l.splice(a,1);return l.splice(n,0,i),{nextMap:e,nextRootOrder:l}}const l=te(e,t,n);if(!l)return null;const{containerId:i,cellIndex:r,itemIndex:s}=l,c=e[i],d=[...c.cells[r].childrenIds],u=s+o;if(u<0||u>=d.length)return null;const[p]=d.splice(s,1);d.splice(u,0,p);const m=c.cells.map((e,t)=>t===r?{...e,childrenIds:d}:e);return{nextMap:{...e,[i]:{...c,cells:m}},nextRootOrder:t}}function ce(e,t){const n={...e};return function e(t){const o=n[t];o&&("column"===o.key&&(o.cells||[]).forEach(t=>(t.childrenIds||[]).forEach(t=>e(t))),delete n[t])}(t),n}function de(e,t={}){if(!e||"column"!==e.key||!Array.isArray(e.cells))return null;const n=(o=t)&&"object"==typeof o?Array.isArray(o)?o.reduce((e,t)=>(t&&"object"==typeof t&&t.id&&(e[t.id]=t),e),{}):{...o}:{};var o;const a=B(e);delete a.children,delete a.blockMap,delete a.blockSnapshotMap;const l={...n,[a.id]:a};function i(e){e&&!l[e]&&(l[e]=X("…",e))}return function e(t){if(t&&"column"===t.key&&Array.isArray(t.cells))for(const n of t.cells)for(const t of n.childrenIds||[]){i(t);const n=l[t];n&&"column"===n.key&&e(n)}}(a),{blockMap:l,rootId:a.id}}function ue(e,t){if(!t)return{newBlockMap:e,rootId:null};if("column"===t.key){const n=Array.isArray(t.children)&&t.children.length>0;if(Array.isArray(t.cells)&&t.cells.length>0&&!n){const n=de(t,t.blockMap||t.blockSnapshotMap||{});if(n?.blockMap&&n.rootId){const t=Q(n.blockMap,[n.rootId])[0];if(t){const{blockMap:n,rootOrder:o}=Z([t]);return{newBlockMap:{...e,...n},rootId:o[0]??null}}}}const{blockMap:o,rootOrder:a}=Z([t]);return{newBlockMap:{...e,...o},rootId:a[0]??null}}return{newBlockMap:{...e,[t.id]:t},rootId:t.id}}const pe="SET_BLOCK_LIST",me="SET_BLOCKS",ge="SET_IS_DRAG_START",he="SET_ACTION_TYPE",be="SET_PREVIEW_MODE",ye="SET_CURRENT_ITEM",fe="SET_BODY_SETTINGS",_e="SET_SELECTION_RANGE",ke="SET_TEXT_RANGE",xe="SET_LANGUAGE",ve="SET_LANGUAGE_LIBRARIES",we="SET_TEMPLATE_VARIABLES",Se="UNDO",je="REDO",Ce=e=>({type:he,actionType:e}),Ne=e=>({type:ye,currentItem:e}),Ie=(e,t={})=>({type:we,templateData:e,skipUndo:Boolean(t.skipUndo)}),Ae={},Le=[],Te={preHeader:"",contentWidth:600,contentWidthMode:"email_width",stackColumnsOnMobile:!0,scaleFontOnMobile:!0,styles:{backgroundColor:"#F5F5F5",contentBg:"#FFFFFF",color:"#171717",headingColor:"#171717",linkColor:"#338AF3",fontFamily:"'Overused Grotesk', ui-sans-serif, system-ui, sans-serif"}},Be={blockMap:Ae,rootOrder:Le,blockList:[],isDragStart:!1,actionType:"firstRender",previewMode:"desktop",currentItem:null,bodySettings:Te,selectionRange:null,textRange:null,language:"en",languageLibraries:{},templateData:null,undoStack:[],redoStack:[]},$e=e.createContext();function Re(e,t,n){const o=W(t,e.templateData),a=Q(o,n);let{currentItem:l}=e;if(l?.id&&o[l.id]){const e=ee(l.id,o);e&&e!==l.data&&(l={...l,data:e})}return{...e,blockMap:o,rootOrder:n,blockList:a,currentItem:l}}function Pe(e){return e?{...e,data:e.data&&"object"==typeof e.data?B(e.data):e.data}:null}function Me(e){return{blockMap:B(e.blockMap||Ae),rootOrder:[...e.rootOrder||Le],bodySettings:B(e.bodySettings||Te),currentItem:Pe(e.currentItem),templateData:null==e.templateData?null:B(e.templateData)}}function Fe(e){return JSON.stringify(e,(e,t)=>t&&"object"==typeof t&&!Array.isArray(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ue(e,t){if(t)return e;const n=Me(e),o=e.undoStack[e.undoStack.length-1];return o&&function(e,t){if(!e||!t)return!1;try{return Fe(e)===Fe(t)}catch{return!1}}(n,o)?e:{...e,undoStack:[...e.undoStack,n].slice(-50),redoStack:[]}}function De(e,t){const n=t.templateData,o=W(B(t.blockMap||Ae),n),a=[...t.rootOrder||Le],l=Q(o,a);let i=Pe(t.currentItem);if(i?.id&&o[i.id]){const e=ee(i.id,o);e&&(i={...i,data:e})}const r=B(t.bodySettings||Te);return{...e,blockMap:o,rootOrder:a,blockList:l,bodySettings:{...r,contentWidth:G(r.contentWidth)},currentItem:i,templateData:n}}function Ee(e,t){switch(t.type){case me:return Re(Ue(e,t.skipUndo),t.blockMap,t.rootOrder);case pe:{const n=Ue(e,t.skipUndo),{blockMap:o,rootOrder:a}=Z(t.blockList);return Re(n,o,a)}case ge:return{...e,isDragStart:t.isDragStart};case he:return{...e,actionType:t.actionType};case be:return{...e,previewMode:t.previewMode};case ye:{let n=t.currentItem;if(n?.id&&e.blockMap[n.id]){const t=ee(n.id,e.blockMap);t&&(n={...n,data:t})}return{...e,currentItem:n}}case fe:{const n=Ue(e,t.skipUndo),o={...n.bodySettings,...t.bodySettings};return{...n,bodySettings:{...o,contentWidth:G(o.contentWidth)}}}case _e:return{...e,selectionRange:t.selectionRange};case ke:return{...e,textRange:t.textRange};case xe:return{...e,language:t.language};case ve:return{...e,languageLibraries:t.languageLibraries};case we:{const n=Ue(e,t.skipUndo),o=t.templateData,a=W(n.blockMap,o),l=Q(a,n.rootOrder);let{currentItem:i}=n;if(i?.id&&a[i.id]){const e=ee(i.id,a);e&&(i={...i,data:e})}return{...n,templateData:o,blockMap:a,blockList:l,currentItem:i}}case Se:{if(!e.undoStack.length)return e;const t=e.undoStack[e.undoStack.length-1],n=e.undoStack.slice(0,-1),o=Me(e),a=[...e.redoStack,o].slice(-50);return{...De(e,t),undoStack:n,redoStack:a,actionType:"undo"}}case je:{if(!e.redoStack.length)return e;const t=e.redoStack[e.redoStack.length-1],n=e.redoStack.slice(0,-1),o=Me(e),a=[...e.undoStack,o].slice(-50);return{...De(e,t),undoStack:a,redoStack:n,actionType:"redo"}}default:return e}}function ze(e){if(null==e)return"";const t=String(e).trim();if(!t)return"";const n=t.toLowerCase();return"none"===n||"null"===n||"undefined"===n?"":t}var Oe={global:[{key:"CustomerName",token:"{{CustomerName}}",label:"Customer Name",labelKey:"variable_customer_name",type:"text",fallback:"Customer",source:"derived"},{key:"BrandName",token:"{{BrandName}}",label:"Brand Name",labelKey:"variable_brand_name",type:"text",fallback:"Company Name",source:"companyContext.name"},{key:"Tagline",token:"{{Tagline}}",label:"Tagline",labelKey:"variable_tagline",type:"text",fallback:"Your tagline here",source:"brandContext.tagline"},{key:"LogoUrl",token:"{{LogoUrl}}",label:"BrandLogo",labelKey:"variable_image_logo",type:"image",fallback:"https://via.placeholder.com/150x50/ffffff/333333?text=Logo",source:"brandContext.logo_url"},{key:"Website",token:"{{Website}}",label:"Website",labelKey:"variable_website",type:"text",fallback:"www.example.com",source:"companyContext.website"},{key:"Address",token:"{{Address}}",label:"Address",labelKey:"variable_address",type:"text",fallback:"",source:"companyContext.address"}],product:[{key:"ProductName",token:"{{ProductName}}",label:"Product Name",labelKey:"variable_product_name",type:"text",fallback:"Product Name",source:"content.products[].name"},{key:"ProductDescription",token:"{{ProductDescription}}",label:"Product Description",labelKey:"variable_product_description",type:"text",fallback:"Product description goes here.",source:"content.products[].description"},{key:"ProductImage",token:"{{ProductImage}}",label:"Product Image URL",labelKey:"variable_product_image",type:"image",fallback:"https://via.placeholder.com/300x300/eeeeee/666666?text=Product",source:"content.products[].image"},{key:"ProductLink",token:"{{ProductLink}}",label:"Product Link",labelKey:"variable_product_link",type:"url",fallback:"https://www.example.com",source:"content.products[].link"},{key:"ProductPrice",token:"{{ProductPrice}}",label:"Product Price (Amount)",labelKey:"variable_product_price",type:"number",fallback:"0",source:"content.products[].price.amount"},{key:"ProductCurrency",token:"{{ProductCurrency}}",label:"Product Currency",labelKey:"variable_product_currency",type:"text",fallback:"USD",source:"content.products[].price.currency"},{key:"ProductOldPrice",token:"{{ProductOldPrice}}",label:"Product Old Price",labelKey:"variable_product_old_price",type:"number",fallback:"0",source:"content.products[].old_price"},{key:"ProductNewPrice",token:"{{ProductNewPrice}}",label:"Product New Price",labelKey:"variable_product_new_price",type:"number",fallback:"0",source:"content.products[].new_price"},{key:"ProductPriceDisplay",token:"{{ProductPriceDisplay}}",label:"Product Price Display",labelKey:"variable_product_price_display",type:"text",fallback:"USD 0",source:"derived"}],discount:[{key:"DiscountValue",token:"{{DiscountValue}}",label:"Discount Value",labelKey:"variable_discount_value",type:"text",fallback:"20%",source:"content.discount.value"},{key:"DiscountCode",token:"{{DiscountCode}}",label:"Discount Code",labelKey:"variable_discount_code",type:"text",fallback:"SAVE20",source:"content.discount.code"},{key:"ValidUntil",token:"{{ValidUntil}}",label:"Valid Until",labelKey:"variable_valid_until",type:"date",fallback:"12-31-2025",source:"content.discount.valid_until"}]};const We="CustomerName",He="DiscountValue",Ke="DiscountCode",Ve="ValidUntil",Ge="CompanyName",qe="Address",Je="Website",Ye="BrandName",Xe="LogoUrl",Ze="Tagline",Qe="HeroBanner",et="FooterBanner",tt="NavLabel",nt="NavUrl",ot="ProductName",at="ProductDescription",lt="ProductImage",it="ProductLink",rt="ProductPrice",st="ProductCurrency",ct="ProductOldPrice",dt="ProductNewPrice",ut="ProductPriceDisplay",pt="CTALabel",mt="CTAUrl",gt=new Set([ct,dt]);function ht(e){return`{{${e}}}`}const bt=Oe;let yt=bt;function ft(e,t=yt){return t&&Array.isArray(t[e])?t[e].map(e=>({...e,token:e.token||ht(e.key)})):[]}let _t=[],kt=[],xt=[],vt={},wt=[],St=[],jt=[];function Ct(){_t=ft("global",yt),kt=ft("product",yt),xt=ft("discount",yt),vt=[..._t,...kt,...xt].reduce((e,t)=>(e[t.key]=t,e),{}),wt=xt.map(e=>({variableKey:e.key,labelKey:e.labelKey}));const e=kt.filter(e=>!gt.has(e.key));St=e.map(e=>({variableKey:e.key,labelKey:e.labelKey})),jt=_t.map(e=>({value:e.token,label:e.label,key:e.key,labelKey:e.labelKey,source:e.source,type:e.type})),xt.map(e=>({value:e.token,label:e.label,key:e.key,labelKey:e.labelKey,source:e.source,type:e.type})),e.map(e=>({value:e.token,label:e.label,key:e.key,labelKey:e.labelKey,source:e.source,type:e.type}))}Ct();const Nt={[We]:"User",[He]:"20%",[Ke]:"SAVE20",[Ve]:"12-31-2025",[Ge]:"Company Name",[Ye]:"Company Name",[qe]:"",[Je]:"www.example.com",[Xe]:"https://via.placeholder.com/150x50/ffffff/333333?text=Logo",[Ze]:"Your tagline here",[Qe]:"https://via.placeholder.com/600x200/eeeeee/666666?text=Hero",[et]:"https://via.placeholder.com/600x100/eeeeee/666666?text=Footer",[tt]:"Link",[nt]:"https://www.example.com",[ot]:"Product Name",[at]:"Product description goes here.",[lt]:"https://via.placeholder.com/300x300/eeeeee/666666?text=Product",[it]:"https://www.example.com",[rt]:"0",[st]:"USD",[ct]:"0",[dt]:"0",[ut]:"$0.00 USD",[pt]:"Shop Now",[mt]:"www.example.com"};function It(e){return null==e||"string"!=typeof e?"":e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const At=new Set([ut]);function Lt(e,t,n={}){if(null==e||"string"!=typeof e)return"";const o=e.replace(/\{\{(\w+)\}\}/g,(e,o)=>{const a=Ft(t,o,n);return At.has(o)?a:It(a)});return null==(a=o)||"string"!=typeof a?a:a.replace(/^(<p[^>]*>\s*(?:<br\s*\/?>| )?\s*<\/p>\s*)+/i,"");var a}function Tt(e){return Nt[e]??"—"}const Bt=/^\{\{\s*[\w.]+\s*\}\}$/;function $t(e,t,{allowEmpty:n=!1}={}){if(null==e)return n?"":Tt(t);const o=String(e).trim();return""===o?n?"":Tt(t):function(e){return"string"==typeof e&&Bt.test(e.trim())}(o)?Tt(t):o}const Rt={USD:"en-US",CAD:"en-CA",EUR:"de-DE",GBP:"en-GB",AUD:"en-AU",NZD:"en-NZ",SGD:"en-SG",INR:"en-IN",JPY:"ja-JP",CNY:"zh-CN",BDT:"bn-BD",AED:"ar-AE",SAR:"ar-SA"};function Pt(e){return function(e){return"string"==typeof e&&/^[A-Za-z]{3}$/.test(e.trim())}(e)?String(e).trim().toUpperCase():"USD"}function Mt(e,t){const n=function(e){if(null==e)return null;const t=String(e).replace(/,/g,"").trim();if(""===t)return null;const n=Number(t);return Number.isFinite(n)?n:null}(e);if(null==n)return null;const o=Pt(t),a=function(e){return Rt[e]??null}(o);if(!a)return null;const l=function(e){if(null==e)return 0;const t=String(e).trim().replace(/,/g,"");if(!t.includes("."))return 0;const[,n=""]=t.split(".");return Math.max(0,n.length)}(e);try{return`${new Intl.NumberFormat(a,{style:"currency",currency:o,minimumFractionDigits:l,maximumFractionDigits:l}).format(n)} ${o}`}catch{return null}}function Ft(e,t,n={}){if(!e)return Tt(t);const{columnIndex:o,columnProduct:a}=n;let l=a;switch(!l&&e.content?.products&&"number"==typeof o&&(l=e.content.products[o]||null),t){case We:return Tt(We);case He:return $t(e.content?.discount?.value,He);case Ke:return $t(e.content?.discount?.code,Ke);case Ve:return $t(e.content?.discount?.valid_until,Ve);case Ge:case Ye:return $t(e.companyContext?.name,t);case qe:return $t(e.companyContext?.address,qe,{allowEmpty:!0});case Je:return $t(e.companyContext?.website,Je);case Xe:return $t(e.brandContext?.logo_url,Xe);case Ze:return $t(e.brandContext?.tagline,Ze);case Qe:return $t(e.brandContext?.heroBanner,Qe);case et:return $t(e.brandContext?.footerBanner,et);case tt:case nt:return Tt(t);case ot:return $t(l?.name,ot);case at:{const e=ze(l?.description);return e?$t(e,at,{allowEmpty:!0}):""}case lt:return $t(l?.image,lt);case it:return $t(l?.link,it);case rt:return null!=l?.price&&"number"==typeof l.price||null!=l?.price&&"string"==typeof l.price?String(l.price):null!=l?.new_price?String(l.new_price):Tt(rt);case st:return $t(l?.currency,st);case ct:return $t(l?.old_price,ct);case dt:return null!=l?.new_price?$t(l.new_price,dt):null!=l?.price?$t(l.price,dt):Tt(dt);case ut:{const e=Pt(l?.currency),t=null!=l?.price?l.price:l?.new_price,n=null!=l?.old_price||null!=l?.new_price,o=null!=l?.old_price?l.old_price:null,a=null!=l?.new_price?l.new_price:null!=l?.price?l.price:null;if(n&&(null!=o||null!=a)){const t=Mt(o,e),n=Mt(a,e),l=null!=(null!=t?t:null!=o?String(o):null)?It(null!=t?t:null!=o?String(o):""):"";return[""!==l?`<span style="text-decoration: line-through;">${l}</span>`:"",null!=(null!=n?n:null!=a?String(a):null)?It(null!=n?n:null!=a?String(a):""):""].filter(Boolean).join(" ")||Tt(ut)}const i=Mt(t,e);return null!=i?It(i):null!=t?It(String(t)):Tt(ut)}case pt:{const t=e.content?.cta?.text;return $t(t,pt)}case mt:{const t=e.content?.cta?.url;return $t(null!=t?t:e.companyContext?.website,mt)}default:return Tt(t)}}const Ut=[{variableKey:Xe,labelKey:"variable_image_logo"},{variableKey:Qe,labelKey:"variable_image_hero_banner"},{variableKey:et,labelKey:"variable_image_footer_banner"}],Dt=[{variableKey:lt,labelKey:"variable_image_product_image"}],Et=[{variableKey:pt,labelKey:"variable_cta_label"}],zt=[{variableKey:mt,labelKey:"variable_cta_url"}],Ot=[{variableKey:it,labelKey:"variable_product_link"},{variableKey:Je,labelKey:"variable_website"}];function Wt(e,t,n,o={}){let a=[];return"discount"===t?a=[...wt]:"product"===t&&(a=[...St]),a.map(({variableKey:e,labelKey:t})=>({...vt[e]||{},variableKey:e,labelKey:t,value:ht(e),pasteValue:Ft(n,e,o)}))}function Ht(e,t,n,o={},a=[]){const l="none"===t?jt.map(e=>({...e,pasteValue:Ft(n,e.key,o)})):Wt(0,t,n,o),i=(a||[]).filter(e=>e&&e.containerType&&"none"!==e.containerType).flatMap(e=>Wt(0,e.containerType,n,e.context||{})),r=new Set,s=[];return[...l,...i].forEach(e=>{const t=e.variableKey||e.key||e.value;t&&!r.has(t)&&(r.add(t),s.push(e))}),s}const Kt={display_text:"DisplayText",introduction:"Introduction",heading:"Heading",subheading:"Subheading",products_description:"ProductDescription"};function Vt(e,t,n,o){return{value:ht(e),labelKey:t,variableKey:e,key:e,type:"image",pasteValue:Ft(n,e,o)}}function Gt(e,t,n={}){const o=Ut.map(({variableKey:e,labelKey:o})=>Vt(e,o,t,n));if("product"===e){const e=Dt.map(({variableKey:e,labelKey:o})=>Vt(e,o,t,n));return[...o,...e]}return o}function qt(e){return!1!==e?.linkEnabled}function Jt(e,t,n={}){if(!e||!t)return e;const{useImportant:o=!1}=n,a=String(t).trim();if(!a)return e;const l=o?`color: ${a} !important`:`color: ${a}`;return String(e).replace(/<a\b([^>]*)>/gi,(e,t)=>{const n=t.match(/\sstyle\s*=\s*"([^"]*)"/i);if(n){const e=(n[1]||"").replace(/\s*color\s*:\s*[^;]+(!important)?\s*;?/gi,"").replace(/;\s*;/g,";").replace(/^\s*;|;\s*$/g,"").trim(),o=`${e?`${e}; `:""}${l};`;return`<a${t.replace(n[0],` style="${o}"`)}>`}const o=t.match(/\sstyle\s*=\s*'([^']*)'/i);if(o){const e=(o[1]||"").replace(/\s*color\s*:\s*[^;]+(!important)?\s*;?/gi,"").replace(/;\s*;/g,";").replace(/^\s*;|;\s*$/g,"").trim(),n=`${e?`${e}; `:""}${l};`;return`<a${t.replace(o[0],` style='${n}'`)}>`}return`<a${t} style="${l};">`})}const Yt=[{name:"Sans Serif (Generic)",stack:"sans-serif"},{name:"Overused Grotesk",stack:"'Overused Grotesk', ui-sans-serif, system-ui, sans-serif"},{name:"Arial",stack:"Arial, Helvetica, sans-serif"},{name:"Helvetica",stack:"Helvetica, Arial, sans-serif"},{name:"Georgia",stack:"Georgia, Times New Roman, serif"},{name:"Times New Roman",stack:"'Times New Roman', Times, serif"},{name:"Verdana",stack:"Verdana, Geneva, sans-serif"},{name:"Tahoma",stack:"Tahoma, Geneva, sans-serif"},{name:"Trebuchet MS",stack:"'Trebuchet MS', Helvetica, Arial, sans-serif"},{name:"Courier New",stack:"'Courier New', Courier, monospace"},{name:"Palatino",stack:"'Palatino Linotype', Palatino, serif"},{name:"Garamond",stack:"Garamond, 'Times New Roman', serif"},{name:"Lucida",stack:"'Lucida Sans Unicode', 'Lucida Grande', sans-serif"}],Xt=[{name:"Roboto",fallback:"Arial, sans-serif"},{name:"Open Sans",fallback:"Arial, sans-serif"},{name:"Lato",fallback:"Arial, sans-serif"},{name:"Montserrat",fallback:"Arial, sans-serif"},{name:"Poppins",fallback:"Arial, sans-serif"},{name:"Merriweather",fallback:"Georgia, serif"},{name:"Playfair Display",fallback:"Georgia, serif"},{name:"Cormorant Garamond",fallback:"Garamond, 'Times New Roman', serif"},{name:"Source Sans 3",fallback:"Arial, sans-serif"},{name:"Inter",fallback:"Arial, sans-serif"},{name:"Nunito",fallback:"Arial, sans-serif"},{name:"Nunito Sans",fallback:"Arial, sans-serif"},{name:"Raleway",fallback:"Arial, sans-serif"},{name:"Rubik",fallback:"Arial, sans-serif"},{name:"Work Sans",fallback:"Arial, sans-serif"},{name:"DM Sans",fallback:"Arial, sans-serif"},{name:"Manrope",fallback:"Arial, sans-serif"},{name:"Outfit",fallback:"Arial, sans-serif"},{name:"Plus Jakarta Sans",fallback:"Arial, sans-serif"},{name:"IBM Plex Sans",fallback:"Arial, sans-serif"},{name:"IBM Plex Serif",fallback:"Georgia, serif"},{name:"Noto Sans",fallback:"Arial, sans-serif"},{name:"Noto Serif",fallback:"Georgia, serif"},{name:"PT Sans",fallback:"Arial, sans-serif"},{name:"PT Serif",fallback:"Georgia, serif"},{name:"Ubuntu",fallback:"Arial, sans-serif"},{name:"Fira Sans",fallback:"Arial, sans-serif"},{name:"Barlow",fallback:"Arial, sans-serif"},{name:"Quicksand",fallback:"Arial, sans-serif"},{name:"Libre Baskerville",fallback:"Georgia, serif"},{name:"Libre Franklin",fallback:"Arial, sans-serif"},{name:"Crimson Pro",fallback:"Georgia, serif"},{name:"Lora",fallback:"Georgia, serif"},{name:"Space Grotesk",fallback:"Arial, sans-serif"},{name:"Archivo",fallback:"Arial, sans-serif"},{name:"Mulish",fallback:"Arial, sans-serif"},{name:"Figtree",fallback:"Arial, sans-serif"},{name:"Be Vietnam Pro",fallback:"Arial, sans-serif"},{name:"Sora",fallback:"Arial, sans-serif"},{name:"Josefin Sans",fallback:"Arial, sans-serif"}],Zt=e=>/\s/.test(String(e||""))?`'${String(e).replace(/'/g,"\\'")}'`:String(e);function Qt(e){return`https://fonts.googleapis.com/css2?family=${(e=>String(e).trim().replace(/\s+/g,"+"))(e)}:wght@400;700&display=swap`}function en(e){const t=e?.brandContext?.customFonts;return Array.isArray(t)?t.filter(e=>e&&"object"==typeof e&&e.name&&e.url).map(e=>({label:`${e.name} (Brand Kit)`,value:`${Zt(e.name)}, Arial, sans-serif`,primaryName:String(e.name),source:"custom",url:String(e.url),format:e.format?String(e.format):void 0,weight:null!=e.weight?String(e.weight):void 0,style:e.style?String(e.style):void 0})):[]}function tn(e){return[...Yt.map(e=>({label:e.name,value:e.stack,primaryName:e.name,source:"system"})),...Xt.map(e=>({label:`${e.name} (Google)`,value:`${Zt(e.name)}, ${e.fallback}`,primaryName:e.name,source:"google"})),...en(e)]}function nn(e){if(!e)return"";const t=String(e).split(",")[0];return String(t??"").trim().replace(/^['"]|['"]$/g,"")}function on(e,t){const n=tn(t),o=nn(e).toLowerCase(),a=n.find(e=>e.primaryName.toLowerCase()===o);return a?a.value:e}function an(e,t){const n=tn(t),o=on(e,t),a=nn(o).toLowerCase(),l=n.find(e=>e.primaryName.toLowerCase()===a||e.value===o);return l?l.label:"sans-serif"===a?"Sans Serif (Generic)":o}function ln(e){const t=String(e.name||"").trim(),n=String(e.url||"").trim();if(!t||!n)return"";const o=e.format?` format('${e.format}')`:"",a=e.weight?`font-weight:${e.weight};`:"",l=e.style?`font-style:${e.style};`:"";return`@font-face{font-family:${Zt(t)};src:url('${n}')${o};${a}${l}}`}function rn(e,t,n){const o=function(e,t){const n=new Set,o=e=>{null!=e&&""!==String(e).trim()&&n.add(String(e).trim())};o(t?.styles?.fontFamily);const a=e=>{Array.isArray(e)&&e.forEach(e=>{e&&"object"==typeof e&&(o(e?.styles?.desktop?.fontFamily),o(e?.styles?.mobile?.fontFamily),"image"===e.key&&Array.isArray(e.overlayItems)&&e.overlayItems.forEach(e=>{e&&"object"==typeof e&&o(e.fontFamily)}),Array.isArray(e.children)&&a(e.children))})};return a(e),[...n]}(e,t),a=new Set;o.forEach(e=>{const t=function(e){const t=nn(e),n=Xt.find(e=>e.name.toLowerCase()===t.toLowerCase());return n?Qt(n.name):null}(e);t&&a.add(t)});const l=(Array.isArray(n?.brandContext?.customFonts)?n.brandContext.customFonts:[]).map(ln).filter(Boolean);return[...[...a].map(e=>`@import url('${e}');`),...l].join("\n")}const sn="ee_cb";function cn(e){const t=String(e??"").trim();if(!t)return t;if(/^\{\{/u.test(t)||/^data:/iu.test(t))return t;try{const e="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(t,e);return n.searchParams.set(sn,String(Date.now())),n.toString()}catch{const e=t.includes("?")?"&":"?";return`${t}${e}${sn}=${Date.now()}`}}function dn(e){const t=String(e??"").trim();if(!t)return t;try{const e="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(t,e);n.searchParams.delete(sn);let o=n.toString();return o.endsWith("?")&&(o=o.slice(0,-1)),o}catch{return t.replace(new RegExp(`[?&]${sn}=\\d+`,"g"),"").replace(/\?&/g,"?").replace(/&&+/g,"&").replace(/[?&]$/,"")}}const un=[{value:"cover",labelKey:"container_bg_size_cover"},{value:"contain",labelKey:"container_bg_size_contain"},{value:"fill",labelKey:"container_bg_size_fill"}],pn=["left top","center top","right top","left center","center center","right center","left bottom","center bottom","right bottom"];function mn(e){return String(e??"").trim().replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"").replace(/\r/g,"")}function gn(e,t){const n=e?.containerBackgroundEnabled,o=e?.containerBackgroundImage,a=o&&String(o).trim();if(!1===n||!a)return{background:t};const l={cover:"cover",contain:"contain",fill:"100% 100%"}[e?.containerBackgroundSize||"cover"]||"cover",i=e?.containerBackgroundPosition||"center center";return{backgroundColor:t,backgroundImage:`url("${mn(a)}")`,backgroundSize:l,backgroundPosition:i,backgroundRepeat:"no-repeat"}}const hn=["tl","tc","tr","ml","mc","mr","bl","bc","br"],bn={tl:{top:"10%",left:"8%",transform:"translate(0, 0)",textAlign:"left"},tc:{top:"10%",left:"50%",transform:"translate(-50%, 0)",textAlign:"center"},tr:{top:"10%",right:"8%",transform:"translate(0, 0)",textAlign:"right"},ml:{top:"50%",left:"8%",transform:"translate(0, -50%)",textAlign:"left"},mc:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",textAlign:"center"},mr:{top:"50%",right:"8%",transform:"translate(0, -50%)",textAlign:"right"},bl:{bottom:"10%",left:"8%",transform:"translate(0, 0)",textAlign:"left"},bc:{bottom:"10%",left:"50%",transform:"translate(-50%, 0)",textAlign:"center"},br:{bottom:"10%",right:"8%",transform:"translate(0, 0)",textAlign:"right"}};function yn(e){const t=String(e??"bc").toLowerCase();return hn.includes(t)?t:"bc"}function fn(e){const t=yn(e);return bn[t]}function _n(e,t){const n="string"==typeof t?t.trim():"";if(n)return n;const o=function(e){if(!e||"string"!=typeof e)return null;const t=e.trim(),n=[/(?:youtube\.com\/watch\?[^#]*[&?]v=)([a-zA-Z0-9_-]{11})/,/youtube\.com\/watch\?v=([a-zA-Z0-9_-]{11})/,/youtu\.be\/([a-zA-Z0-9_-]{11})/,/youtube\.com\/embed\/([a-zA-Z0-9_-]{11})/,/youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})/,/youtube-nocookie\.com\/embed\/([a-zA-Z0-9_-]{11})/];for(const e of n){const n=t.match(e);if(n?.[1])return n[1]}return null}(e||"");return o?`https://img.youtube.com/vi/${o}/hqdefault.jpg`:""}function kn(e){const t=null!=e?String(e).trim():"";return t&&"transparent"!==t.toLowerCase()?t:"#ffffff"}const xn=e=>null==e||""===String(e).trim();function vn(e,t){const n="string"==typeof e?e.trim():String(e??"").trim();if(!n)return"";const o=/^\{\{(\w+)\}\}$/.exec(n);if(o&&t){const e=Ft(t,o[1],{});if(null!=e&&""!==String(e).trim()&&!String(e).startsWith("{{"))return String(e).trim()}return n}function wn(e,t){if(null==e||""===e)return"";const n=String(e);return t?n.replace(/\{\{(\w+)\}\}/g,(e,n)=>{const o=Ft(t,n,{});if(null==o)return`{{${n}}}`;const a=String(o);return a.startsWith("{{")?`{{${n}}}`:a}):n}function Sn(e,t){if(null==e||""===e)return"";const n=String(e);return t?n.replace(/\{\{(\w+)\}\}/g,(e,n)=>{const o=Ft(t,n,{}),a=null!=o?String(o).trim():"";return!a||"—"===a||a.startsWith("{{")?e:a}):n}const jn=()=>[{id:P(),label:"Privacy",url:"#",target:"_self"},{id:P(),label:"Terms",url:"#",target:"_self"}];function Cn(e){let t=null!=e?.unsubscribeLinkLabel&&""!==String(e.unsubscribeLinkLabel).trim()?String(e.unsubscribeLinkLabel).trim():"",n=null!=e?.preferencesLinkLabel&&""!==String(e.preferencesLinkLabel).trim()?String(e.preferencesLinkLabel).trim():"";const o=String(e?.unsubscribeText??"").trim();if(!t&&o){const e=o.split(/\s*[·•]\s*/);t=e[0]?.trim()||"",n=n||e[1]?.trim()||""}return{unsubscribeLinkLabel:t||"Unsubscribe",preferencesLinkLabel:n||"Update preferences"}}function Nn(e){return(Array.isArray(e)&&0!==e.length?e:z([],{})).map(e=>({id:e?.id,image:e?.image??"",title:e?.title??"",linkURL:e?.linkURL??"",socialPlatformKey:e?.socialPlatformKey}))}function In(e){return Array.isArray(e)&&0!==e.length?e.map(e=>({id:e?.id,label:e?.label??"",url:e?.url??"",target:"_blank"===e?.target?"_blank":"_self"})):jn()}const An=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),Ln=(e,t)=>{if(null==e||""===e)return t;if("number"==typeof e)return e;const n=parseInt(String(e).replace(/px/gi,""),10);return Number.isFinite(n)?n:t};const Tn="#111827";function Bn(e){if(null==e)return"";const t=String(e).trim().toLowerCase();return/^#[0-9a-f]{3}$/.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function $n(e){return Bn(e)===Bn("#263d2d")}function Rn(e){if(null==e||"object"!=typeof e)return"#111111";const t=e.brandContext,n=t&&"object"==typeof t?t.brand_color??t.brandColor??null:null,o=e.brandColor,a=("string"==typeof n&&""!==n.trim()?n:"string"==typeof o&&""!==o.trim()?o:null)??"#111111",l=String(a).trim();return""!==l?l:"#111111"}const Pn=new Set(["fontWeight","opacity","zIndex"]),Mn=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),Fn=e=>Mn(e).replace(/"/g,""").replace(/'/g,"'"),Un=(e,t="#")=>{if(null==e)return t;const n=String(e).trim();if(!n)return t;const o=n.toLowerCase();return/^\s*(?:javascript|vbscript):/i.test(o)||/^\s*data:/i.test(o)?t:/^https?:\/\//i.test(n)||/^mailto:/i.test(n)||/^tel:/i.test(n)?n:n.startsWith("//")?`https:${n}`:/^[a-z][a-z\d+.-]*:/i.test(n)?n:`https://${n.replace(/^\/+/,"")}`},Dn=(e,t)=>{const n=new RegExp(/[A-Z]/g),o=e=>e.replace(n,e=>`-${e.toLowerCase()}`),a={desktop:t?.desktop??{},mobile:t?.mobile??{}};let l={className:e,desktop:"",mobile:""};for(let e of Object.entries(a.desktop))if(e[1]&&"contentBackground"!==e[0]&&"horizontalAlign"!==e[0]&&"containerBackgroundImage"!==e[0]&&"containerBackgroundSize"!==e[0]&&"containerBackgroundPosition"!==e[0]){const t="number"!=typeof e[1]||Pn.has(e[0])?e[1]:e[1]+"px";l.desktop+=`${o(e[0])}:${t};`}if(Object.keys(a.mobile).length){let t="";for(let e of Object.entries(a.mobile))if(e[1]&&"contentBackground"!==e[0]&&"horizontalAlign"!==e[0]&&"containerBackgroundImage"!==e[0]&&"containerBackgroundSize"!==e[0]&&"containerBackgroundPosition"!==e[0]){const n="number"!=typeof e[1]||Pn.has(e[0])?e[1]:e[1]+"px";t+=`${o(e[0])}:${n} !important;`}l.mobile+=`@media(max-width:620px){\n .${e} {\n ${t}\n }\n }`}return l};function En(e){if(!e||"object"!=typeof e)return{};const{marginLeft:t,marginTop:n,...o}=e;return o}function zn(e){if(!e||"object"!=typeof e)return{};const t={};return null!=e.marginLeft&&""!==e.marginLeft&&(t.marginLeft=e.marginLeft),null!=e.marginTop&&""!==e.marginTop&&(t.marginTop=e.marginTop),t}function On(e){const t=y(e||{}),{linkColor:n,color:o,...a}=t,l=null!=n&&""!==String(n).trim()?String(n).trim():null,i=null!=o&&""!==String(o).trim()?String(o).trim():null,r=l??i;return null==r?a:{...a,color:r}}const Wn=(e,t="",n)=>{const o=e.map((e,o)=>{let a={...e};const l={desktop:e?.styles?.desktop??{},mobile:e?.styles?.mobile??{}},i="menu"===e.key?{desktop:On(l.desktop),mobile:On(l.mobile)}:"social_link"===e.key?{desktop:y(l.desktop),mobile:y(l.mobile)}:l;if(a.styleConfig=Dn(n?`${n}-${e.key}-${o}`:`${e.key}-${o}`,i),a.contentStyles){const n={desktop:a.contentStyles?.desktop??{},mobile:a.contentStyles?.mobile??{}};let l=n;if(a.imageHostMarginStyleConfig=null,"image"===a.key){l={desktop:En(n.desktop),mobile:En(n.mobile)};const i={desktop:zn(n.desktop),mobile:zn(n.mobile)};if(Object.keys(i.desktop).length||Object.keys(i.mobile).length){const n=Dn(`${e.key}-hostmargin-${o}`,i);a.imageHostMarginStyleConfig=n,n.mobile&&(t+=n.mobile)}}a.contentStyleConfig=Dn(`${e.key}-content-${o}`,l),a.contentStyleConfig.mobile&&(t+=a.contentStyleConfig.mobile)}if("video"===a.key&&a.videoArea){const l={desktop:a.videoArea?.desktop??{},mobile:a.videoArea?.mobile??{}},i=null!=n?`${n}-${e.key}-video-area-${o}`:`${e.key}-video-area-${o}`;a.videoAreaStyleConfig=Dn(i,l),a.videoAreaStyleConfig.mobile&&(t+=a.videoAreaStyleConfig.mobile)}if(a.styleConfig.mobile&&(t+=a.styleConfig.mobile),i.desktop.contentBackground&&(a.contentStyleConfig={className:`${e.key}-content-${o}`,desktop:`background-color:${i.desktop.contentBackground};`,mobile:""}),i.mobile.contentBackground&&(a.contentStyleConfig||(a.contentStyleConfig={className:`${e.key}-content-${o}`,desktop:"",mobile:""}),a.contentStyleConfig.mobile=` @media(max-width:620px){\n .${a.contentStyleConfig.className} {background-color:${i.mobile.contentBackground};}\n }`,t+=a.contentStyleConfig.mobile),"menu"===a.key){if("stack"===(e.mobileLayout??"stack")){const n=a.contentStyleConfig?.className??`menu-content-${o}`;a.contentStyleConfig||(a.contentStyleConfig={className:n,desktop:"",mobile:""});const l=a.contentStyles?.desktop?.textAlign??a.contentStyles?.mobile?.textAlign??"center",i=String(l).toLowerCase(),r="left"===i?"flex-start":"right"===i?"flex-end":"center",s=["left","right","center","justify"].includes(i)?i:"center",c=e.linkGapPx,d=`@media(max-width:620px){\n.${n}{display:flex !important;flex-direction:column !important;align-items:${r} !important;flex-wrap:nowrap !important;}\n.${n}>span{display:none !important;}\n.${n}>a{display:block !important;width:100% !important;box-sizing:border-box !important;text-align:${s} !important;margin:0 0 ${"number"==typeof c&&Number.isFinite(c)&&c>=0?c:0}px 0 !important;}\n.${n}>a:last-child{margin-bottom:0 !important;}\n}`;a.contentStyleConfig.mobile=(a.contentStyleConfig.mobile||"")+d,t+=d}}if(e.children?.length){const{newBlockList:n,styles:l}=Wn(e.children,t,o);t+=l,a.children=n}return{...a}});return{newBlockList:o,styles:t}};function Hn(e){const t=e.contentStyleConfig?.desktop??"",n=function(e){const t=e.contentStyles?.desktop??{},n=e.contentStyles?.mobile??{},o=null!=t.textAlign&&""!==String(t.textAlign).trim()?t.textAlign:n.textAlign,a=null!=o&&""!==String(o).trim()?String(o).trim():"center";return"start"===a?"left":"end"===a?"right":a}(e);return/\btext-align\s*:/i.test(t)?t:`${t}text-align:${n};`}const Kn="#2faade";function Vn(e){const t=String(e??"");return null!=(n=t)&&"string"==typeof n&&/<[a-zA-Z!/?]/.test(n.trim())?function(e){if(!e||!/<a\b/i.test(e))return e;const t=(e,t,n)=>{const o=(t[1]||"").replace(/\s*text-decoration(-line)?\s*:[^;]+;?/gi,"").replace(/^\s*;|;\s*$/g,"").trim(),a=(o?`${o}; `:"")+"text-decoration: none;",l='"'===n?` style="${a}"`:` style='${a}'`;return`<a${e.replace(t[0],l)}>`};return String(e).replace(/<a\b([^>]*)>/gi,(e,n)=>{const o=n.match(/\sstyle\s*=\s*"([^"]*)"/i);if(o)return t(n,o,'"');const a=n.match(/\sstyle\s*=\s*'([^']*)'/i);return a?t(n,a,"'"):`<a${n} style="text-decoration: none;">`})}(t):Mn(t);var n}function Gn(e){const t=e?.dynamicSelectedContent,n=e?.text??"";if(null==t)return String(n);const o=String(t);return""===o.trim()?String(n):o}const qn=(e,t,n={})=>{let o=Gn(e);t&&o&&(o=Lt(o,t,n));const a=e?.styles?.desktop??{},l=null!=a.linkColor&&""!==String(a.linkColor).trim();return o=Jt(o,l?String(a.linkColor).trim():Kn,{useImportant:l}),`<${e.type} ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""} \n style="${e.styleConfig?.desktop||""}">\n ${o}\n </${e.type}>`};const Jn=(e,t,n={},o=null)=>{let a=e.text||"",l=e.linkURL||"";if(t){const o=a.match(/\{\{(\w+)\}\}/),i=e.labelVariable?e.labelVariable.replace(/^\{\{|\}\}$/g,"").trim():o?o[1]:void 0;if(i){const e=Ft(t,i,n);null==e||String(e).startsWith("{{")||(a=String(e))}if(e.urlVariable){const o=Ft(t,e.urlVariable.replace(/^\{\{|\}\}$/g,""),n);o&&!o.startsWith("{{")&&(l=String(o))}else{const e=String(l||"").trim().match(/^\{\{(\w+)\}\}$/);if(e){const o=Ft(t,e[1],n);o&&!String(o).startsWith("{{")&&(l=String(o))}}}const i=Vn(a),r=Fn(Un(l)),s=Rn(t);let c=e.styleConfig.desktop||"";!function(e,t){if(!function(e){return!(!e||"column"!==e.key||"product"!==e.containerType)&&"additional"!==e.productRole&&("image_left"===e.mainProductLayout||"image_stacked"!==e.mainProductLayout&&function(e){const t=e?.children?.[0]?.children?.[0];return"column"===t?.key&&"2-3"===t?.type}(e))}(t))return!1;const n=e.styles?.desktop?.backgroundColor;return null==n||""===String(n).trim()||Bn(n)===Bn(Tn)}(e,o)?$n(e.styles?.desktop?.backgroundColor)&&(c=c.replace(/background-color:\s*[^;]+;?/gi,"")):c=c.replace(/background-color:\s*[^;]+;?/gi,"");const d=c.includes("background-color:")?"":`background-color:${s};`;return`<div ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""} \n style="${e.contentStyleConfig.desktop}">\n <a ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""} \n style="${c}${d}text-align:center;text-decoration:none;" target="_blank" rel="noopener noreferrer" href="${r}">${i}</a>\n </div>`};const Yn=e=>{const t=Array.isArray(e.list)?e.list.filter(Boolean):[];if(0===t.length)return"";const n=Boolean(e.showTextLabel),o=`${e.styleConfig.desktop};display:inline-flex;vertical-align:middle;margin:0;align-items:center;${n?"gap:8px;":""}`,a=I(e),l=Math.max(11,Math.round(.58*a)),i=b(e.iconColor),r=t.map(t=>{const{title:r,linkURL:s}=t,c=u(s,{allowMailtoTel:!1}),{src:d,styleAttr:p}=T(t,i,a),m=`<img src="${Fn(d)}" alt="${Fn(r)}" style="${Fn(p)}" \n ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""}/>`,h=g(t)?"X":String(r??""),b=n?`<span style="font-size:${l}px;line-height:1.2;color:#525252;font-family:inherit;white-space:nowrap;">${Mn(h)}</span>`:"",y=`${o};text-decoration:none;`;return c?`<a target="_blank" rel="noopener noreferrer" href="${Fn(c)}" style="${y}">${m}${b}</a>`:`<span style="${y}">${m}${b}</span>`}).join(""),s=function(e){const t=e?.contentStyles?.desktop??{},n=t.textAlign||"center",o=t.columnGapPx;return`width:100%;max-width:100%;box-sizing:border-box;display:flex;flex-wrap:wrap;align-items:center;justify-content:${"justify"===n?"space-between":"center"===n?"center":"right"===n?"flex-end":"flex-start"};column-gap:${"number"==typeof o&&Number.isFinite(o)&&o>=0?o:8}px;row-gap:0`}(e),c=`${e.contentStyleConfig.desktop};${s}`;return`<div ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""} \n style="${c}">\n ${r}\n </div>`};const Xn=(e,t,n,o,a,l)=>{let i="";const r={columnIndex:a??0,columnProduct:o?.columnProducts?.[l??0]??null};return e.forEach((e,s)=>{if("column"===e.key){const r=function(e){const t={...e?.desktop??{}},n=e?.mobile??{},o=String(t.containerBackgroundImage??"").trim(),a=String(n.containerBackgroundImage??"").trim();!o&&a&&(t.containerBackgroundImage=n.containerBackgroundImage,null!=n.containerBackgroundSize&&(t.containerBackgroundSize=n.containerBackgroundSize),null!=n.containerBackgroundPosition&&(t.containerBackgroundPosition=n.containerBackgroundPosition),void 0!==n.containerBackgroundEnabled&&(t.containerBackgroundEnabled=n.containerBackgroundEnabled));const l=t.minHeight,i=n.minHeight;return null!=l&&""!==String(l).trim()||null==i||""===String(i).trim()||(t.minHeight=i),t}(e.styles),c=e.styles?.desktop?.borderRadius,d=c?`border-radius:${"number"==typeof c?c+"px":c};`:"",p=d?"overflow:hidden;":"",m=function(e){const t=e??{};if(!1===t.containerBackgroundEnabled)return"";const n=dn(t.containerBackgroundImage);return n&&String(n).trim()?`background-image:url("${mn(n)}");background-size:${{cover:"cover",contain:"contain",fill:"100% 100%"}[t.containerBackgroundSize||"cover"]||"cover"};background-position:${t.containerBackgroundPosition||"center center"};background-repeat:no-repeat;`:""}(r),g=function(e){if(null==e)return"";if("number"==typeof e&&Number.isFinite(e))return`min-height:${e}px;`;const t=String(e).trim();return t?/^\d+$/.test(t)?`min-height:${t}px;`:`min-height:${t};`:""}(r.minHeight),h=String(r.contentBackground??"").trim(),b=h&&"transparent"!==h.toLowerCase()?`background-color:${h};`:"",y=void 0!==l,_=Y(t)||y?"100%":`${J(t)}px`,k=e.containerType&&"none"!==e.containerType?e:o,x=e.containerType&&"none"!==e.containerType?s:a,v=e.containerType&&"none"!==e.containerType?0:l,w="footer"===e.containerType&&e.footerUnifiedLayout?function(e,t,n){const o=e,a=o.styles?.desktop??{},l=Boolean(o.showBrand??!0),i=Boolean(o.showTagline??!0),r=Boolean(o.footerShowLogo??!1),s=vn(o.footerLogoSrc??"",n),c=wn(String(o.footerLogoAlt??"Logo").trim()||"Logo",n).trim()||"Logo",d=o.footerLogoLink??"",p=Ln(o.footerLogoMaxWidthPercent,30),m=Ln(o.footerLogoPaddingPx,24),g=Boolean(o.showAddress??!0),h=Boolean(o.showUnsubscribe??!0),b=Boolean(o.showSocial??!1),y=Boolean(o.showSecondaryLinks??!1),_=Boolean(o.showCopyright??!0),k=wn(o.brandName??"",n),x=wn(o.brandTagline??"",n).trim(),v=wn(o.address??"",n),w=wn(o.copyrightText??"",n),S=o.unsubscribeUrl??"",j=o.preferencesUrl??"",{unsubscribeLinkLabel:C,preferencesLinkLabel:N}=Cn(o),I=In(o.secondaryLinks),A=Nn(o.footerSocialList),L=a.color??"#737373",B=null!=a.linkColor&&""!==String(a.linkColor).trim()?String(a.linkColor).trim():L,$=Ln(a.fontSize,12),R=a.textAlign??"center",P=Ln(a.paddingTop,28),M=Ln(a.paddingRight,24),F=Ln(a.paddingBottom,28),U=Ln(a.paddingLeft,24),D=kn(a.contentBackground),E=Boolean(o.showDivider??!1),z=An(o.dividerColor??"#374151"),O=Boolean(o.showBorderTop??!1),W=Ln(o.borderTopWidth,1),H=o.borderTopStyle??"solid",K=An(o.borderTopColor??"#e5e7eb"),V=O&&W>0?`${W}px ${H} ${K}`:"",G=t?.width??"100%",q=t?.styleConfig?.mobile?` class="${t.styleConfig.className}"`:"",J=t?.styleConfig?.desktop??"",Y=`margin:0;color:${An(L)};font-size:${$}px;line-height:1.5;font-family:Arial,sans-serif;`,X=`color:${An(B)};text-decoration:underline;`,Z=[];let Q="";if(E&&(Q+=`<div style="border-top:1px solid ${z};margin-bottom:14px;width:100%;font-size:0;line-height:0;"> </div>`),r&&s.trim()){const e="left"===R?"left":"right"===R?"right":"center",t=`<img src="${An(s)}" alt="${An(c)}" width="570" style="max-width:${p}%;height:auto;display:inline-block;padding:${m}px;vertical-align:middle;border:0;outline:none;text-decoration:none;"/>`,o=u(Sn(d,n)),a=o?`<a href="${An(o)}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;line-height:0;display:inline-block;">${t}</a>`:t;Q+=`<div style="text-align:${An(e)};margin-bottom:10px;line-height:0;">${a}</div>`}if(l&&k.trim()&&(Q+=`<p style="${Y}font-weight:600;margin:0 0 10px 0;">${An(k)}</p>`),i&&x&&(Q+=`<p style="${Y}margin:0 0 10px 0;opacity:0.92;">${An(x)}</p>`),g&&v.trim()&&(Q+=`<p style="${Y}margin:0 0 10px 0;">${An(v)}</p>`),b){const e=Array.isArray(A)?A.filter(Boolean):[];if(e.length>0){const t=f.medium,o=e.map(e=>{const o=u(Sn(e.linkURL,n),{allowMailtoTel:!1}),{src:a,styleAttr:l}=T(e,"default",t),i=`<img src="${An(a)}" alt="" width="${t}" height="${t}" style="${l}" border="0"/>`;return`<td style="padding:0 6px;">${o?`<a href="${An(o)}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;line-height:0;display:inline-block;">${i}</a>`:i}</td>`}).join(""),a="left"===R?"left":"right"===R?"right":"center";Q+=`<table role="presentation" cellpadding="0" cellspacing="0" border="0" align="${a}" style="${"center"===a?"margin:0 auto;margin-bottom:10px;":"right"===a?"margin-left:auto;margin-bottom:10px;":"margin-bottom:10px;"}"><tr>${o}</tr></table>`}}if(h){const e=An(wn(C,n)),t=An(wn(N,n)),o=An(u(Sn(S,n))),a=An(u(Sn(j,n)));let l=`<p style="${Y}margin:0 0 10px 0;word-break:break-word;">`;l+=`<a href="${o}" style="${X}">${e}</a>`,N&&(l+=`<span style="padding:0 6px;">·</span><a href="${a}" style="${X}">${t}</a>`),l+="</p>",Q+=l}if(y&&I.length>0){let e=`<p style="${Y}margin:0 0 10px 0;word-break:break-word;">`;I.forEach((t,o)=>{o>0&&(e+='<span style="padding:0 6px;">·</span>');const a=An(wn(t.label,n)),l=An(u(Sn(t.url,n))),i="_blank"===t.target?' target="_blank" rel="noopener noreferrer"':"";e+=`<a href="${l}" style="${X}"${i}>${a||`#${o+1}`}</a>`}),e+="</p>",Q+=e}if(_&&w.trim()){Q+=`<p style="${Y}font-size:${Math.max(10,$-1)}px;margin:0;opacity:0.9;">${An(w)}</p>`}var ee;return Z.push(`<td${q} style="width:${G};${J}">${ee=Q,`<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="width:100%;"><tr><td align="${An(R)}" style="${Y}text-align:${An(R)};background-color:${An(D)};padding:${P}px ${M}px ${F}px ${U}px;${V?`border-top:${V};`:""}">${ee}</td></tr></table>`}</td>`),Z.join("")}(e,e.children?.find(e=>"content"===e.key)??e.children?.[0]??null,n):Xn(e.children,t,n,k,x,v);i+=`<div ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""}\n style="${e.styleConfig.desktop};${b}width:100%;display:block;${p}">\n <table ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""}\n style="width:100%;max-width:${_};margin:0 auto;${d}${e.contentStyleConfig?.desktop??""}${b}${m}${g}">\n <tbody><tr>${w}</tr></tbody>\n </table></div>`}if("content"===e.key&&(i+=`<td ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""} \n style="width:${e.width}; ${e.styleConfig.desktop}">${Xn(e.children,t,n,o,a,s)}</td>`),"text"===e.key){const t=null!=o?{columnIndex:a??0,columnProduct:o?.columnProducts?.[l??0]??null}:r;e.type&&/^h[1-4]$/.test(e.type)?i+=qn(e,n,t):i+=((e,t,n={},o=null)=>{let a=Gn(e);t&&a&&(a=Lt(a,t,n));const l=e?.styles?.desktop??{},i=null!=l.linkColor&&""!==String(l.linkColor).trim();a=Jt(a,i?String(l.linkColor).trim():Kn,{useImportant:i});const r="footer"===o?.containerType,s=null==(c=a)||"string"!=typeof c?"":c.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();var c;return!r||""!==s&&"{{Address}}"!==s&&"{{Tagline}}"!==s?`<div ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""} \n style="${e.styleConfig?.desktop||""}">${a}</div>`:""})(e,n,t,o)}if("heading"===e.key&&(i+=qn(e,n,r)),"image"===e.key){i+=((e,t,n={},o=null)=>{let a=e.src||"";const l="string"==typeof e.src&&/^\{\{\s*[\w.]+\s*\}\}$/.test(e.src.trim())?e.src.trim():"";if(t&&l){const e=Ft(t,l.replace(/^\{\{\s*|\s*\}\}$/g,""),n);e&&!/^\{\{\s*[\w.]+\s*\}\}$/.test(String(e).trim())&&(a=e)}a=dn(a);const i=Fn(a),r=Fn(e.alt||"Image"),s=null!=e.linkURL?String(e.linkURL).trim():"",c=Array.isArray(e.overlayItems)?e.overlayItems:[],d=c.some(e=>""!==String(e?.text??"").trim()),u=String(e.overlayText??"").trim(),p=Boolean(e.textOverlayEnabled)&&(d||""!==u)&&a,m=`${e.styleConfig?.desktop||""};max-width:100%;display:inline-block;vertical-align:top;`;let g=`<img src="${i}" alt="${r}" style="${m}" ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""}/>`;if(p){const t=fn(yn(e.overlayPosition)),n=Object.entries({position:"absolute",...t,"z-index":"2","max-width":`${"number"==typeof e.overlayMaxWidth?e.overlayMaxWidth:100}%`,"box-sizing":"border-box","pointer-events":"none"}).map(([e,t])=>`${e}:${t};`).join(""),a="number"==typeof e.overlayPadding?e.overlayPadding:16,l=e.textShadowEnabled?"text-shadow:0 1px 3px rgba(0,0,0,0.55);":"";let s="";if(d){const t="number"==typeof e.overlayItemGap?e.overlayItemGap:8,n=c.filter(e=>String(e?.text??"").trim()).map(e=>{const t="number"==typeof e.fontSize?e.fontSize:16,n=Fn(e.color||"#ffffff"),a=(e=>{switch(e){case"h1":case"h2":case"h3":return"700";case"subtitle":case"eyebrow":return"600";default:return"400"}})(e.kind),i=null!=e.fontFamily&&""!==String(e.fontFamily).trim()?String(e.fontFamily).trim():String(o?.styles?.fontFamily||"sans-serif").trim()||"sans-serif",r=Fn(i),s=Mn(String(e.text??""));return`<div style="color:${n};font-size:${t}px;font-weight:${a};line-height:1.35;font-family:${r};${l}">${s}</div>`});s=`<div style="display:flex;flex-direction:column;gap:${t}px;width:100%;padding:${a}px;">${n.join("")}</div>`}else s=`<div style="color:${Fn(e.overlayTextColor||"#ffffff")};font-size:${"number"==typeof e.overlayFontSize?e.overlayFontSize:18}px;font-weight:600;line-height:1.35;${e.overlayBoxBackground?`background-color:${Fn(e.overlayBoxBackground)};padding:8px 12px;`:`padding:${a}px;`}${l}">${Mn(u)}</div>`;g=`<div style="position:relative;display:inline-block;vertical-align:top;max-width:100%;overflow:hidden;line-height:0;">\n ${e.scrimEnabled?'<div style="position:absolute;left:0;top:0;width:100%;height:100%;z-index:1;pointer-events:none;background:linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0.12), transparent 55%);"></div>':""}\n <img src="${i}" alt="${r}" style="${m}position:relative;z-index:0;border-radius:0;" ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""}/>\n <div style="${n}">\n ${s}\n </div>\n </div>`}const h=qt(e)&&""!==s?`<a href="${Fn(Un(s))}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;display:inline-block;max-width:100%;">${g}</a>`:g,b=e.imageHostMarginStyleConfig,y=b&&(b.desktop||b.mobile)?`<div ${b.mobile?`class="${b.className}"`:""} style="display:inline-block;vertical-align:top;max-width:100%;${b.desktop||""}">${h}</div>`:h;return`<div ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""} \n style="${Hn(e)}">\n ${y}\n </div>`})(e,n,null!=o?{columnIndex:a??0,columnProduct:o?.columnProducts?.[l??0]??null}:r,t)}if("video"===e.key&&(i+=(e=>{const t=null!=e.videoUrl?String(e.videoUrl).trim():"",n=_n(t,null!=e.thumbnailUrl?String(e.thumbnailUrl).trim():""),o=t?Un(t):"#",a=`${e.styleConfig?.desktop||""};max-width:100%;height:auto;display:block;border:0;`,l=e.contentStyleConfig?.desktop||"",i=e.videoAreaStyleConfig?.desktop||"";return`<div ${e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:""} style="${l}">\n <div ${e.videoAreaStyleConfig?.mobile?`class="${e.videoAreaStyleConfig.className}"`:""} style="${i}">\n ${n?`<a href="${Fn(o)}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;display:inline-block;max-width:100%;line-height:0;"><img src="${Fn(n)}" alt="${Fn("Video")}" style="${a}"/></a>`:`<a href="${Fn(o)}" target="_blank" rel="noopener noreferrer" style="display:inline-block;padding:14px 18px;background:#eeeeee;color:#333333;font-family:Arial,Helvetica,sans-serif;font-size:14px;font-weight:600;text-decoration:none;border-radius:4px;">Watch video</a>`}\n </div>\n</div>`})(e)),"button"===e.key){i+=Jn(e,n,null!=o?{columnIndex:a??0,columnProduct:o?.columnProducts?.[l??0]??null}:r,o)}var c,d;"divider"===e.key&&(i+=`<div ${(c=e).contentStyleConfig.mobile?`class="${c.contentStyleConfig.className}"`:""} \n style="${c.contentStyleConfig.desktop}">\n <div ${c.styleConfig.mobile?`class="${c.styleConfig.className}"`:""} \n style="${c.styleConfig.desktop}"></div>\n </div>`),"spacer"===e.key&&(i+=(d=e,`<div ${d.contentStyleConfig?.mobile?`class="${d.contentStyleConfig.className}"`:""} \n style="${d.contentStyleConfig?.desktop||""}">\n <div ${d.styleConfig?.mobile?`class="${d.styleConfig.className}"`:""} \n style="${d.styleConfig?.desktop||""}"></div>\n </div>`)),"menu"===e.key&&(i+=(e=>{const t=e.list||[],n=null!=e.separator?String(e.separator):" | ",o=e.styleConfig?.desktop||"",a=e.contentStyleConfig?.desktop||"",l=e.linkGapPx,i="number"==typeof l&&Number.isFinite(l)&&l>=0?l:0,r=Boolean(e.linkUnderline),s=e.styles?.desktop??{},c=null!=s.fontSize&&Number.isFinite(Number(s.fontSize))?`${Number(s.fontSize)}px`:"14px",d=null!=s.color&&""!==String(s.color).trim()?String(s.color):"#333333";let u="";return t.forEach((e,t)=>{t>0&&(u+=`<span style="${i>0?`display:inline-block;margin-left:${i}px;margin-right:${i}px;font-size:${c};color:${d};`:`display:inline-block;padding-left:4px;padding-right:4px;font-size:${c};color:${d};`}">${Mn(n)}</span>`);const a=Un(e.url,"#"),l="_blank"===e.target?"_blank":"_self",s=Mn(e.label||"Link"),p=r?"underline":"none";u+=`<a target="${l}" href="${Fn(a)}" style="${o};text-decoration:${p};display:inline-block;">${s}</a>`}),`<div ${e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:""} style="${a}">${u}</div>`})(e)),"avatar"===e.key&&(i+=(e=>{const t=e.src||"",n=e.alt||"Avatar",o=e.linkURL,a=e.styleConfig?.desktop||"",l=e.styles?.desktop?.width??64,i=`max-width:100%;width:${"number"==typeof l?l+"px":l};height:${"number"==typeof l?l+"px":l};object-fit:cover;border-radius:${e.styles?.desktop?.borderRadius??"50%"};${a}`,r=Fn(t),s=Fn(n),c=t?`<img src="${r}" alt="${s}" style="${i}" />`:`<div style="${i};background:#eee;display:flex;align-items:center;justify-content:center;"></div>`,d=e.contentStyleConfig?.desktop||"",u=o?`<a href="${Fn(Un(o))}" target="_blank" rel="noopener noreferrer">${c}</a>`:c;return`<div ${e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:""} style="${d}">${u}</div>`})(e)),"social_link"===e.key&&(i+=Yn(e)),"raw_html"===e.key&&(i+=(e=>{const t=function(e){const t=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i);return t?t[1]:/<html[\s>]/i.test(e)||/<!DOCTYPE/i.test(e)?e.replace(/<!DOCTYPE[^>]*>/gi,"").replace(/<html[^>]*>/gi,"").replace(/<\/html>/gi,"").replace(/<head[\s\S]*?<\/head>/gi,"").replace(/<\/?body[^>]*>/gi,"").trim():e}(e.html??""),n=e.contentStyleConfig?.desktop??"",o=e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:"",a=e.contentStyles?.desktop??{},l=a.width,i=a.textAlign??"center";let r="";return null!=l&&"100%"!==String(l)&&"center"===i?r="margin-left:auto;margin-right:auto;":null!=l&&"100%"!==String(l)&&"right"===i?r="margin-left:auto;margin-right:0;":null==l||"100%"===String(l)||"left"!==i&&"justify"!==i||(r="margin-left:0;margin-right:auto;"),`<div ${o} style="${r}max-width:100%;${n}">${t}</div>`})(e)),"table"===e.key&&(i+=(e=>{const t=e.contentStyleConfig?.desktop||"",n=e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:"",o=e.styles?.desktop??{},a="number"==typeof e.rows?e.rows:3,l="number"==typeof e.cols?e.cols:3,i=Boolean(e.headerRow),r=Boolean(e.headerCol),s=Boolean(e.stripedRows),c=o.fontSize??14,d=o.color??"#333333",u=o.borderStyle??"solid",p=o.borderWidth??1,m=o.borderColor??"#e0e0e0",g=o.cellPadding??8,h=o.textAlign??"left",b=o.headerBg??"#f5f5f5",y=o.headerColor??"#333333",f=o.stripedBg??"#fafafa",_="none"!==u?`${p}px ${u} ${m}`:"none",k=Array.from({length:a}).map((t,n)=>`<tr>${Array.from({length:l}).map((t,o)=>{const a=i&&0===n||r&&0===o,l=a?b:s&&!a&&n%2==0?f:"transparent",u=a?y:d,p=a?"600":"400",m=`${n}-${o}`,k=e.cells?.[m],x=i&&0===n||r&&0===o?"th":"td";let v="—";return"image"===k?.type&&String(k.src??"").trim()?v=`<img src="${Fn(k.src)}" alt="${Fn(k.alt||"")}" style="max-width:100%;height:auto;display:block;border:0;"/>`:String(k?.text??"").trim()&&(v=Mn(String(k.text))),`<${x} style="border:${_};padding:${g}px;font-size:${c}px;color:${u};text-align:${h};background-color:${l};font-weight:${p};vertical-align:top;">${v}</${x}>`}).join("")}</tr>`).join("");return`<div ${n} style="${t}"><table role="presentation" style="${e.styleConfig?.desktop||""};border-collapse:collapse;width:100%;table-layout:auto;"><tbody>${k}</tbody></table></div>`})(e))}),i},Zn={preHeader:"",contentWidth:600,contentWidthMode:"email_width",stackColumnsOnMobile:!0,scaleFontOnMobile:!0,styles:{backgroundColor:"#F5F5F5",contentBg:"#FFFFFF",color:"#171717",headingColor:"#171717",linkColor:"#338AF3",fontFamily:"'Overused Grotesk', ui-sans-serif, system-ui, sans-serif"}},Qn=e=>Array.isArray(e)?e.filter(e=>!(e&&"object"==typeof e&&!0===e.hidden)).map(e=>e&&"object"==typeof e&&Array.isArray(e.children)?{...e,children:Qn(e.children)}:e):e,eo=({bodySettings:e,blockList:t,templateData:n})=>{let o="";const a=((e,t)=>{if(!Array.isArray(e))return e;const n=t?.content?.products;if(!Array.isArray(n)||0===n.length)return e;const o=t?.content?.primaryProductId,a=(o?n.find(e=>e?.id===o):n[0])??n[0]??null;if(!a)return e;const l=n.filter(e=>e?.id!==a.id),i=e=>{if(!e||"object"!=typeof e)return e;const t=Array.isArray(e.children)?e.children.map(i):e.children;if("column"!==e.key||"product"!==e.containerType)return{...e,children:t};const n="additional"===e.productRole?"additional":"main",o=Math.max(Array.isArray(t)?t.length:0,Array.isArray(e.columnProducts)?e.columnProducts.length:0,1),r=Array.from({length:o},(e,t)=>"main"===n||0===l.length?a:l[t%l.length]);return{...e,children:t,columnProducts:r}};return e.map(i)})(Qn(t??[]),n),{newBlockList:l,styles:i}=Wn(a);o=Xn(l,e,n);const r=rn(a,e,n);return`<html>\n <head>\n <meta charset="UTF-8">\n <title>email</title>\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style type="text/css">\n *{\n margin: 0;\n padding: 0;\n border: none;\n box-sizing: border-box;\n }\n\n html,body {\n height:100%;\n overflow-y:auto;\n }\n\n table {\n width: 100%;\n color:unset;\n }\n\n table, tr, td {\n vertical-align: top;\n border-collapse: collapse;\n }\n\n h1,h2,h3,h4 {\n display: block;\n margin-block-start: 0px;\n margin-block-end: 0px;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n font-weight: bold;\n ${e.styles?.headingColor?`color: ${e.styles.headingColor};`:""}\n }\n\n a {\n ${e.styles?.linkColor?`color: ${e.styles.linkColor};`:""}\n }\n\n @media(max-width:620px){\n${!1!==e.stackColumnsOnMobile?" td {\n display:inline-block;\n width:100% !important;\n }\n":""}${!1!==e.scaleFontOnMobile?" body { font-size: 16px !important; }\n":""} }\n ${r}\n ${i}\n</style>\n </head>\n <body>\n <div style="opacity:0;">${e.preHeader}</div>\n <div style="background-color:${e.styles.backgroundColor};color:${e.styles.color}; font-family:${e.styles.fontFamily};"> ${o}</div>\n </body>\n </html>`};function to(e){let t=e;if("string"==typeof e)try{t=JSON.parse(e)}catch(e){throw new Error("exportNormalizerToHtml: invalid JSON")}if(null==t)throw new Error("exportNormalizerToHtml: input is null or undefined");let n=[],o={...Zn,styles:{...Zn.styles}};Array.isArray(t)?n=t:"object"==typeof t&&(n=Array.isArray(t.blockList)?t.blockList:[],t.bodySettings&&"object"==typeof t.bodySettings&&(o={preHeader:null!=t.bodySettings.preHeader?t.bodySettings.preHeader:Zn.preHeader,contentWidth:G(t.bodySettings.contentWidth??Zn.contentWidth),contentWidthMode:t.bodySettings.contentWidthMode??Zn.contentWidthMode,stackColumnsOnMobile:!1!==t.bodySettings.stackColumnsOnMobile,scaleFontOnMobile:!1!==t.bodySettings.scaleFontOnMobile,styles:{backgroundColor:t.bodySettings.styles?.backgroundColor??Zn.styles.backgroundColor,contentBg:t.bodySettings.styles?.contentBg??Zn.styles.contentBg,color:t.bodySettings.styles?.color??Zn.styles.color,headingColor:t.bodySettings.styles?.headingColor??Zn.styles.headingColor,linkColor:t.bodySettings.styles?.linkColor??Zn.styles.linkColor,fontFamily:t.bodySettings.styles?.fontFamily??Zn.styles.fontFamily}}));return`<!DOCTYPE html>\n${function(e){return e.replace(/\n/g," ").replace(/[ \t]{2,}/g," ").replace(/> </g,"><").trim()}(eo({bodySettings:o,blockList:n,templateData:t.templateData}))}`}function no(e,t){if("section"===e.layoutRole||"columns"===e.layoutRole)return e.layoutRole;if(!0===e.columnLayoutOnly)return"columns";return t.length>1||e.type&&"full"!==e.type?"columns":"section"}const oo=["product"];function ao(e){return Array.isArray(e)?e:e&&"object"==typeof e?Object.values(e):[]}function lo(e,t={}){if(!e||"object"!=typeof e)return e;if("image"===e.key){const n="string"==typeof e.imageVariable&&/^\{\{\w+\}\}$/.test(e.imageVariable.trim())?e.imageVariable.trim():"",o="string"==typeof e.src&&/^\{\{\w+\}\}$/.test(e.src.trim())?e.src.trim():"",{imageVariable:a,...l}=e;return{...l,src:o||n||e.src,textOverlayEnabled:Boolean(e.textOverlayEnabled),overlayText:e.overlayText??"",overlayPosition:e.overlayPosition??"bc",overlayTextColor:e.overlayTextColor??"#ffffff",overlayFontSize:(()=>{const t=Number(e.overlayFontSize);return Number.isFinite(t)&&t>0?t:18})(),overlayBoxBackground:e.overlayBoxBackground??"",overlayPadding:(()=>{const t=Number(e.overlayPadding);return Number.isFinite(t)&&t>=0?t:16})(),scrimEnabled:Boolean(e.scrimEnabled),textShadowEnabled:Boolean(e.textShadowEnabled),children:ao(e.children).map(e=>lo(e,t))}}if("video"===e.key){const t=e.videoArea||{},n=t.desktop||{};return{...e,videoUrl:"string"==typeof e.videoUrl?e.videoUrl:"",thumbnailUrl:"string"==typeof e.thumbnailUrl?e.thumbnailUrl:"",videoArea:{desktop:{paddingTop:n.paddingTop??0,paddingBottom:n.paddingBottom??0,paddingLeft:n.paddingLeft??0,paddingRight:n.paddingRight??0,backgroundColor:n.backgroundColor??"transparent",borderWidth:n.borderWidth??0,borderStyle:n.borderStyle??"solid",borderColor:n.borderColor??"#cccccc",borderRadius:n.borderRadius??0},mobile:t.mobile??{}},styles:{desktop:{width:"auto",height:"auto",fillColumn:!1,fillColumnMobile:!1,display:"inline-block",...e.styles?.desktop||{}},mobile:{...e.styles?.mobile||{}}},contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center",backgroundColor:"transparent",...e.contentStyles?.desktop||{}},mobile:{...e.contentStyles?.mobile||{}}}}}if("column"===e.key){const{ctaText:n,container_type:o,...a}=e,l=function(e){if(!e||"object"!=typeof e)return null;const t=null!=e.containerType&&""!==e.containerType?e.containerType:e.container_type;return null==t||""===t?null:"string"!=typeof t?String(t).trim().toLowerCase()||null:t.trim().toLowerCase()}(e),i=l??e.containerType??null;let r=function(e){const t=null==e?null:String(e).trim().toLowerCase();return null==t||""===t||"none"===t?"none":"discount"===t?"discount":"header"===t?"header":"footer"===t?"footer":"product"===t||"hero_product"===t||"additional_product"===t?"product":"none"}(l??e.containerType);if("none"===r){const t=function(e){if(!e||"column"!==e.key)return null;if(!0===e.footerUnifiedLayout)return"footer";if(Array.isArray(e.footerSocialList)&&e.footerSocialList.length>0)return"footer";if(void 0!==e.showFooterBanner)return"footer";let t=!1,n=!1;const o=e=>{e&&"object"==typeof e&&((e.headerLogoSlot||e.headerBannerSlot||e.headerBannerDividerSlot)&&(t=!0),null!=e.footerSlot&&""!==String(e.footerSlot).trim()&&(n=!0),ao(e.children).forEach(o))};return o(e),n?"footer":void 0!==e.showLogo||void 0!==e.showHeaderBanner||t?"header":null}(e);t&&(r=t)}const s="string"==typeof i?i.trim().toLowerCase():"",c="product"===r?e.productRole??("additional_product"===s?"additional":"main"):void 0,d=ao(e.children);let u=e.columnProducts;if(oo.includes(r)){const e=d.length;Array.isArray(u)||(u=[]),u=Array.from({length:e},(e,t)=>u[t]??null)}else u=[];return{...a,containerType:r,productRole:c,columnProducts:u,layoutRole:no(e,d),children:(d||[]).map(e=>lo(e,t))}}if("heading"===e.key){const n=e.id?t?.[e.id]:null,o={...e,key:"text",name:e.name,type:e.type||"h1",contentType:e.contentType??"static",text:e.text,styles:e.styles,contentStyles:e.contentStyles,selectedVariableKey:e.selectedVariableKey,dynamicVariable:n?.variable??e.dynamicVariable,dynamicPrompt:n?.prompt??e.dynamicPrompt,dynamicSelectedContent:n?.selectedContent??e.dynamicSelectedContent,dynamicOptions:Array.isArray(n?.options)?n.options:n?.selectedContent?[n.selectedContent]:e.dynamicOptions};return"dynamic"===o.contentType&&(o.dynamicVariable=o.dynamicVariable??"",o.dynamicPrompt=o.dynamicPrompt??"",o.dynamicSelectedContent=o.dynamicSelectedContent??"",o.dynamicOptions=Array.isArray(o.dynamicOptions)?o.dynamicOptions:[],o.dynamicAiLanguage="bn-BD"===n?.language||"bn-BD"===o.dynamicAiLanguage?"bn-BD":"en"),{...o,children:ao(e.children).map(e=>lo(e,t))}}if("text"===e.key){const n=e.id?t?.[e.id]:null,o=e.contentType??"static",a={...e,type:e.type||"p",contentType:o};return"dynamic"===o&&(a.dynamicVariable=n?.variable??e.dynamicVariable??"",a.dynamicPrompt=n?.prompt??e.dynamicPrompt??"",a.dynamicSelectedContent=n?.selectedContent??e.dynamicSelectedContent??"",a.dynamicOptions=Array.isArray(n?.options)?n.options:n?.selectedContent?[n.selectedContent]:Array.isArray(e.dynamicOptions)?e.dynamicOptions:[],a.dynamicAiLanguage="bn-BD"===n?.language||"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"),{...a,children:ao(e.children).map(e=>lo(e,t))}}return{...e,children:ao(e.children).map(e=>lo(e,t))}}const io="https://api-alpha.markopolo.ai/v1",ro="https://nbq-ml-api-stg.markopolo.ai/v1",so="95b48b5b-cf5e-486d-817e-9839d4c4e618";function co(e,t){const n=null!=(o=e)&&"string"==typeof o&&o.trim()?o.replace(/\/$/,""):io;var o;const a=function(e){return null!=e&&"string"==typeof e&&e.trim()?e.replace(/\/$/,""):ro}(t);return{imageUploadEndpoint:`${n}/upload-file`,imageUploadQueryParams:{show:!1},imageUploadCompanyField:"comment",productsEndpoint:`${n}/knowledge-base/products`,universalEmailBlocksEndpoint:`${n}/universal-email-blocks`,mlEmailNodesEndpoint:`${a}/ml-service/content/generate-email-nodes`,mlEmailGenerateEndpoint:`${a}/ml-service/content/generate-email`}}function uo(e={}){const t=e&&"object"==typeof e?e:{},{apiBaseUrlV1:n,apiBaseV1:o,mlGenerationApiBaseUrlV1:a,mlApiBaseUrlV1:l,headers:i,mlEmailGenerateBnEndpoint:r,...s}=t,c=n||o||io,d="undefined"!=typeof process&&process.env?.REACT_APP_ML_API_BASE_V1,u=co(c,a||l||d||ro),p="undefined"!=typeof process?String(process.env?.REACT_APP_EMAIL_TEMPLATE_ID??"").trim():"",m={...u,...s};m.mlEmailGenerateEndpoint&&String(m.mlEmailGenerateEndpoint).trim()||!r||(m.mlEmailGenerateEndpoint=String(r).replace(/\/generate-email\/bn\/?$/i,"/generate-email"));const g=String(m.emailTemplateId??"").trim()||p||so;return{...m,emailTemplateId:g,headers:{...m.headers||{},...i||{}}}}function po(e,t,n){const o=String(e??"").trim(),a=t&&"object"==typeof t?JSON.parse(JSON.stringify(t)):{name:"Block",key:"column"};a.name||(a.name="column"===a.key?"Container":o||"Block"),a.key||(a.key="column"),"column"===a.key&&Array.isArray(a.children)&&a.children.length>0&&delete a.cells;const l="column"===a.key?String(a.containerType??"none"):"none",i=function(e){if(!e||"object"!=typeof e)return"content";const t=String(e.key??"").toLowerCase();if("column"===t){const t=String(e.containerType??"none").toLowerCase();return"header"===t?"header":"footer"===t?"footer":"none"===t||""===t?"column":"content"}return"image"===t?"image":"menu"===t?"menu":"content"}(a),r="undefined"!=typeof performance&&performance.now?Math.floor(performance.now()):Date.now(),s=String(a.id??r).replace(/-/g,"").slice(0,12),c=`preset_${d=o,String(d??"").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"").slice(0,48)||"block"}_${s}`;var d;return{companyId:String(n),blockName:o,blockType:i,presetId:c,presetName:o,nameKey:c,containerType:l,block:a}}function mo(e,t){if(!e||"object"!=typeof e)return null!=t?`Request failed (${t})`:"Request failed";const n=e.error;if(n&&"object"==typeof n&&null!=n.message){const e=String(n.message).trim();if(e){const t=null!=n.code?String(n.code).trim():"";return t&&t!==e&&!e.toLowerCase().includes(t.toLowerCase())?`${t}: ${e}`:e}}return"string"==typeof n&&n.trim()?n.trim():"string"==typeof e.message&&e.message.trim()?e.message.trim():null!=t?`Request failed (${t})`:"Request failed"}function go(e){const t=e?.universalEmailBlocksEndpoint;if(t&&String(t).trim())return String(t).replace(/\/$/,"");const n=String(e?.apiBaseUrlV1||e?.apiBaseV1||"").replace(/\/$/,"");return n?`${n}/universal-email-blocks`:""}function ho(e){return{"Content-Type":"application/json",...e?.headers||{}}}function bo(e){if(!e||"object"!=typeof e)return null;const t=e.resourceId??e.id;if(!t)return null;let n=e.block;if("string"==typeof n)try{n=JSON.parse(n)}catch{n=null}n&&"object"==typeof n||(n={});const o=e.blockMap??e.blocks??e.blockSnapshotMap;if("column"===n.key&&o&&"object"==typeof o){const e=Array.isArray(o)?o.reduce((e,t)=>(t&&"object"==typeof t&&t.id&&(e[t.id]=t),e),{}):{...o};Object.keys(e).length>0&&(n={...n,blockMap:e})}return{id:t,name:e.blockName??e.name??"Saved block",block:n,resourceId:e.resourceId??t,blockType:e.blockType}}const yo={preHeader:"",contentWidth:600,stackColumnsOnMobile:!0,scaleFontOnMobile:!0,styles:{backgroundColor:"#F5F5F5",contentBg:"#FFFFFF",color:"#171717",headingColor:"#171717",linkColor:"#338AF3",fontFamily:"'Overused Grotesk', ui-sans-serif, system-ui, sans-serif"}};function fo(e){const t=String(e??"").trim();return/^\{\{[A-Za-z_]\w*\}\}$/.test(t)}const _o=/^\s*\{\{[\s\S]*\}\}\s*$/;function ko(e){const t=String(e??"").trim();if(!t)return!1;if("#"===t)return!1;if(t.startsWith("#")&&t.length>1)return!1;if(_o.test(t))return!1;if(fo(t))return!1;const n=t.toLowerCase();return!n.startsWith("http://")&&!n.startsWith("https://")&&(!n.startsWith("mailto:")&&!n.startsWith("tel:")&&!n.startsWith("//"))}function xo(e){if(!e||"object"!=typeof e)return"";return`${e.severity??"unknown"}:${e.code??"issue"}:${e.blockId??"global"}:${e.location??""}`}function vo(e){let t=!1;const n=e=>{if(Array.isArray(e))for(const o of e)o&&"object"==typeof o&&("text"===o.key&&"dynamic"===o.contentType&&"bn-BD"===o.dynamicAiLanguage&&(t=!0),Array.isArray(o.children)&&n(o.children))};return n(Array.isArray(e)?e:[]),t?"bn-BD":"en"}function wo(e,t=!1){if(null==e||""===String(e).trim())return t;const n=String(e).trim();try{return/^https?:\/\//i.test(n)?new URL(n):new URL("https://"+n),!0}catch{return!1}}const So={text:"Text",heading:"Heading",button:"Button",image:"Image",video:"Video",avatar:"Profile image",menu:"Menu",social_link:"Social links",raw_html:"HTML"};const jo={none:"Container",product:"Product",discount:"Discount",header:"Header",footer:"Footer",navigation_bar:"Navigation",introduction:"Introduction",hero:"Hero",hero_product:"Hero product",body:"Body",additional_product:"Additional product"};function Co(e,t,n){const o=e.containerType??"none",a=function(e){const t=e??"none";return jo[t]?jo[t]:String(t).replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}(o);return n<=1?a:"none"===o?`${No(t+1)} section`:`${No(t+1)} ${a} block`}function No(e){const t=e%10,n=e%100;return 1===t&&11!==n?`${e}st`:2===t&&12!==n?`${e}nd`:3===t&&13!==n?`${e}rd`:`${e}th`}function Io(e,t,n){const o=function(e){return So[e]?So[e]:String(e||"block").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}(t),a=[...e],l=a.length>0?a.join(" → "):"Email body";return n?`${o} ("${n}") — ${l}`:`${o} — ${l}`}function Ao(e,t){const n=function(e){return null==e||"object"!=typeof e?{...yo,styles:{...yo.styles}}:{preHeader:null!=e.preHeader?e.preHeader:yo.preHeader,contentWidth:G(null!=e.contentWidth?e.contentWidth:yo.contentWidth),stackColumnsOnMobile:!1!==e.stackColumnsOnMobile,scaleFontOnMobile:!1!==e.scaleFontOnMobile,styles:{backgroundColor:null!=e.styles?.backgroundColor?e.styles.backgroundColor:yo.styles.backgroundColor,contentBg:null!=e.styles?.contentBg?e.styles.contentBg:yo.styles.contentBg,color:null!=e.styles?.color?e.styles.color:yo.styles.color,headingColor:null!=e.styles?.headingColor?e.styles.headingColor:yo.styles.headingColor,linkColor:null!=e.styles?.linkColor?e.styles.linkColor:yo.styles.linkColor,fontFamily:null!=e.styles?.fontFamily?e.styles.fontFamily:yo.styles.fontFamily}}}(e);("number"!=typeof n.contentWidth||!Number.isFinite(n.contentWidth)||n.contentWidth<=0)&&t.push({severity:"error",code:"body_content_width_invalid",message:"Body content width must be between 280 and 1200 px.",location:"Theme settings"});const o=n.styles;null!=o.backgroundColor&&""!==String(o.backgroundColor).trim()||t.push({severity:"error",code:"body_background_color_missing",message:"Theme background color is missing.",location:"Theme settings"}),null!=o.color&&""!==String(o.color).trim()||t.push({severity:"error",code:"body_text_color_missing",message:"Theme text color is missing.",location:"Theme settings"}),null!=o.fontFamily&&""!==String(o.fontFamily).trim()||t.push({severity:"error",code:"body_font_family_missing",message:"Theme font family is missing.",location:"Theme settings"})}function Lo(e,t){e.push(t)}function To(e){return null==e?"":String(e).replace(/&/gi,"&").replace(/"/gi,'"').replace(/'/g,"'").trim()}function Bo(e){if(null==e||"string"!=typeof e)return[];const t=[],n=/<a\b[^>]*?\bhref\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>"']+))/gi;let o=n.exec(e);for(;o;){const a=o[1]??o[2]??o[3]??"";t.push(To(a)),o=n.exec(e)}return t}function $o(e,t=!0){const n=String(e??"").trim();return n?fo(n)?null:m(n,!1,{allowMailtoTel:t}):null}function Ro(e,t,n){const o=e.linkURL,a=()=>Io(t,"button",void 0),l=e.id??null;null==o||""===String(o).trim()?Lo(n,{severity:"warning",code:"button_empty_link",message:'Button link URL is empty; will be saved as href="https://".',location:a(),blockId:l}):s(o)?Lo(n,{severity:"error",code:"button_blocked_scheme",message:"Button link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",location:a(),blockId:l}):fo(o)||p(o,!1,{allowMailtoTel:!0})?!fo(o)&&ko(o)&&Lo(n,{severity:"warning",code:"button_link_missing_protocol",message:"Button link should start with https://, http://, mailto:, or tel: for reliable email clients.",location:a(),blockId:l}):Lo(n,{severity:"warning",code:"button_invalid_link",message:"Button link URL format is invalid.",location:a(),blockId:l}),function(e,t,n,o,{invalidCode:a,invalidMessage:l,blockedCode:i,blockedMessage:r,missingProtocolCode:c,missingProtocolMessage:d}){Bo(e??"").forEach((e,u)=>{const m=String(e??"").trim();""!==m&&(s(m)?Lo(t,{severity:"error",code:i,message:r,location:n(u),blockId:o}):p(m,!1,{allowMailtoTel:!0})?ko(m)&&Lo(t,{severity:"warning",code:c,message:d,location:n(u),blockId:o}):Lo(t,{severity:"warning",code:a,message:l,location:n(u),blockId:o}))})}(e.text,n,e=>Io(t,"button",`label link ${e+1}`),l,{invalidCode:"button_label_invalid_link",invalidMessage:"Button label link URL format is invalid.",blockedCode:"button_label_blocked_link_scheme",blockedMessage:"Button label link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",missingProtocolCode:"button_label_link_missing_protocol",missingProtocolMessage:"Button label link should start with https://, http://, mailto:, or tel: for reliable email clients."})}const Po=["product"];function Mo(e,t,n,o,a){(function(...e){const t=new Set,n=[];for(const o of e)if(null!=o&&""!==String(o).trim())for(const e of Bo(String(o))){const o=String(e).trim();o&&!t.has(o)&&(t.add(o),n.push(e))}return n})(e.text,e.dynamicSelectedContent).forEach((a,l)=>{const i=String(a??"").trim();""!==i&&(i.startsWith("#")||_o.test(i)||(s(i)?Lo(n,{severity:"error",code:"text_blocked_link_scheme",message:"Text link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",location:Io(t,o,`link ${l+1}`),blockId:e.id??null}):p(i,!1,{allowMailtoTel:!0})?ko(i)&&Lo(n,{severity:"warning",code:"text_link_missing_protocol",message:"Text link should start with https://, http://, mailto:, or tel: for reliable email clients.",location:Io(t,o,`link ${l+1}`),blockId:e.id??null}):Lo(n,{severity:"warning",code:"text_invalid_link",message:"Text link URL format is invalid.",location:Io(t,o,`link ${l+1}`),blockId:e.id??null})))});if("dynamic"!==(e.contentType??"static"))return;const l=e.dynamicSelectedContent,i=null!=e?.id?a?.[e.id]?.selectedContent:void 0;let r=null!=l&&""!==String(l).trim()?l:i;var c;null!=r&&""!==String(r).trim()||null==e.text||""===(null==(c=e.text)?"":String(c).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim())||(r=e.text),null!=r&&""!==String(r).trim()||Lo(n,{severity:"warning",code:"dynamic_content_empty",message:"Dynamic content not generated; export will use static text if available.",location:Io(t,o,void 0),blockId:e.id??null})}function Fo(e,t,n){const o=e.list||[],a=new Set;o.forEach((o,l)=>{const i=o.title||o.image||`link ${l+1}`,r=e=>Io(t,"social_link",e||i),c=function(e){const t=String(e?.image||"").trim();if(t)return`img:${t}`;const n=String(e?.title||"").trim().toLowerCase();return n?`title:${n}`:null}(o);c&&(a.has(c)?Lo(n,{severity:"warning",code:"social_duplicate_platform",message:"Duplicate social platform in this block; only one entry per platform should be kept.",location:r(i),blockId:e.id??null}):a.add(c));const d=o.linkURL;if(null==d||""===String(d).trim()){const t=String(o?.title||"").trim()||`Item ${l+1}`;Lo(n,{severity:"warning",code:"social_empty_link",message:`${t} URL is empty — add https URL before sending; the icon still previews without an outbound link.`,location:r(i),blockId:e.id??null})}else s(d)?Lo(n,{severity:"error",code:"social_blocked_scheme",message:"Social link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s) URLs only (e.g. www.example.com or https://…).",location:r(i),blockId:e.id??null}):p(d,!1,{allowMailtoTel:!1})||Lo(n,{severity:"warning",code:"social_invalid_link",message:"Social link URL format is invalid.",location:r(i),blockId:e.id??null});const u=o.image;null==u||""===String(u).trim()?Lo(n,{severity:"warning",code:"social_empty_icon",message:"Social link icon URL is empty; icon will not display.",location:r(i),blockId:e.id??null}):wo(u,!1)||Lo(n,{severity:"warning",code:"social_invalid_icon",message:"Social link icon URL format is invalid.",location:r(i),blockId:e.id??null})}),0===o.length&&Lo(n,{severity:"info",code:"social_no_links",message:"Social link block has no links.",location:Io(t,"social_link",void 0),blockId:e.id??null})}function Uo(e,t,n,o,a){if(!Array.isArray(e))return;const l=e.length;e.forEach((e,i)=>{if(!e||"object"!=typeof e)return;if(!0===e.hidden)return;const r=e.key;if("column"===r){const r=Co(e,i,l),s=[...t,r];return function(e,t,n){const o=e.containerType??"none";if(!Po.includes(o))return;const a=e.children??[],l=e.columnProducts??[];a.forEach((o,i)=>{const r=l[i];if(null==r||"object"==typeof r&&!r.id){const o=a.length>1?`Column ${i+1} of ${a.length}`:"This column",l=[...t,o].join(" → ");Lo(n,{severity:"warning",code:"container_product_not_assigned",message:"A product is not assigned to this column; assign a product in Container settings.",location:l,blockId:e.id??null})}})}(e,s,n),void(Array.isArray(e.children)&&Uo(e.children,s,n,o,a))}if("content"===r){const r=l>1?`Column ${i+1} of ${l}`:null,s=r?[...t,r]:t;return void(Array.isArray(e.children)&&Uo(e.children,s,n,o,a))}switch(r){case"image":!function(e,t,n){const o=e.src,a=()=>Io(t,"image",void 0);null!=o&&""!==String(o).trim()?(wo(o,!1)||Lo(n,{severity:"warning",code:"image_invalid_src",message:"Image URL format is invalid.",location:a(),blockId:e.id??null}),qt(e)&&$o(e.linkURL,!0)&&Lo(n,{severity:"warning",code:"image_invalid_link",message:"Image link URL format is invalid.",location:a(),blockId:e.id??null}),null!=e.alt&&""!==String(e.alt).trim()||Lo(n,{severity:"info",code:"image_empty_alt",message:"Image alt text is empty; consider adding for accessibility.",location:a(),blockId:e.id??null})):Lo(n,{severity:"error",code:"image_empty_src",message:"Image URL is empty; the image will not display.",location:a(),blockId:e.id??null})}(e,t,n);break;case"video":!function(e,t,n){const o=()=>Io(t,"video",void 0),a=null!=e.videoUrl?String(e.videoUrl).trim():"";a?wo(a,!1)||Lo(n,{severity:"warning",code:"video_invalid_url",message:"Video URL format may be invalid.",location:o(),blockId:e.id??null}):Lo(n,{severity:"error",code:"video_empty_url",message:"Video URL is empty; the video will not display.",location:o(),blockId:e.id??null})}(e,t,n);break;case"avatar":!function(e,t,n){const o=e.src,a=()=>Io(t,"avatar",void 0);null==o||""===String(o).trim()?Lo(n,{severity:"warning",code:"avatar_empty_src",message:"Avatar image URL is empty; avatar will not display.",location:a(),blockId:e.id??null}):wo(o,!1)||Lo(n,{severity:"warning",code:"avatar_invalid_src",message:"Avatar image URL format is invalid.",location:a(),blockId:e.id??null}),$o(e.linkURL,!0)&&Lo(n,{severity:"warning",code:"avatar_invalid_link",message:"Avatar link URL format is invalid.",location:a(),blockId:e.id??null})}(e,t,n);break;case"button":Ro(e,t,n);break;case"menu":!function(e,t,n){const o=e.list||[];o.forEach((o,a)=>{const l=String(o.label??"").trim()||`Item ${a+1}`,i=e=>Io(t,"menu",e||`Item ${a+1}`);null!=o.label&&""!==String(o.label).trim()||Lo(n,{severity:"info",code:"menu_empty_label",message:'Navigation link label is empty; will display as "Link".',location:i(`item ${a+1}`),blockId:e.id??null});const r=o.url;null==r||""===String(r).trim()?Lo(n,{severity:"warning",code:"menu_empty_url",message:`"${l}" link URL is empty; will be saved as href="#". Add a destination URL (e.g. https://example.com) before sending.`,location:i(l),blockId:e.id??null}):s(r)?Lo(n,{severity:"error",code:"menu_blocked_scheme",message:`"${l}" link uses a blocked URL scheme (javascript:, data:, etc.). Use https://, mailto:, or tel: only.`,location:i(l),blockId:e.id??null}):p(r,!1,{allowMailtoTel:!0})?!fo(r)&&ko(r)&&Lo(n,{severity:"warning",code:"menu_item_url_missing_protocol",message:`"${l}" link should start with https://, http://, mailto:, or tel: for reliable email client support.`,location:i(l),blockId:e.id??null}):Lo(n,{severity:"warning",code:"menu_invalid_url",message:`"${l}" link URL is not valid. Use a full URL starting with https://example.com.`,location:i(l),blockId:e.id??null})}),0===o.length&&Lo(n,{severity:"info",code:"menu_no_items",message:"Menu block has no items.",location:Io(t,"menu",void 0),blockId:e.id??null})}(e,t,n);break;case"social_link":Fo(e,t,n);break;case"raw_html":!function(e,t,n){const o=e.html;null!=o&&""!==String(o).trim()||Lo(n,{severity:"info",code:"raw_html_empty",message:"HTML block has no custom markup; export will include an empty wrapper.",location:Io(t,"raw_html",void 0),blockId:e.id??null})}(e,t,n);break;case"text":Mo(e,t,n,"text",a);break;case"heading":Mo(e,t,n,"heading",a)}})}function Do({blockList:e,bodySettings:t,aiContentRefs:n={}}){const o=[];return Ao(t,o),Uo(Array.isArray(e)?e:[],[],o,t,n),o}function Eo(){const e="undefined"!=typeof window&&null!=window?window:"undefined"!=typeof global&&null!=global?global:void 0;if(!e)return;const t=e.Image;return"function"==typeof t?t:void 0}const zo=/^\{\{\s*[\w.]+\s*\}\}$/;function Oo(e){if(null==e||""===String(e).trim())return null;const t=String(e).trim();if(function(e){return null!=e&&"string"==typeof e&&zo.test(e.trim())}(t))return null;if(/^https?:\/\//i.test(t))return wo(t,!1)?t:null;if(t.startsWith("//")){const e=`https:${t}`;return wo(e,!1)?e:null}return null}function Wo(e,t=[],n=e?.length??0){const o=[];return Array.isArray(e)?(e.forEach((e,a)=>{if(!e||"object"!=typeof e)return;if(!0===e.hidden)return;const l=e.key;if("column"===l){const l=Co(e,a,n),i=[...t,l],r=e.children;return void o.push(...Wo(r,i,r?.length??0))}if("content"===l){const l=n>1?`Column ${a+1} of ${n}`:null,i=l?[...t,l]:t,r=e.children;return void o.push(...Wo(r,i,r?.length??0))}if("image"===l){const n=Oo(e.src);n&&o.push({url:n,location:Io(t,"image",void 0),blockId:e.id??null})}}),o):o}function Ho(e,t=12e3){const n=Eo();if(!n)return Promise.resolve(!1);const o=String(e).trim();return o?new Promise(e=>{const a=new n;let l=!1;const i=t=>{l||(l=!0,clearTimeout(r),a.onload=null,a.onerror=null,e(t))},r=setTimeout(()=>i(!1),t);a.onload=()=>i(!0),a.onerror=()=>i(!1);try{a.src=o}catch{i(!1)}}):Promise.resolve(!1)}async function Ko(e,t={}){const{timeoutMs:n=12e3,concurrent:o=6}=t;if(!Eo())return[];const a=Wo(Array.isArray(e)?e:[]);if(0===a.length)return[];const l=new Map;for(const e of a)l.has(e.url)||l.set(e.url,[]),l.get(e.url).push(e.location);const i=[...l.keys()],r=new Map;let s=0;const c=Math.max(1,Math.min(o,i.length));await Promise.all(Array.from({length:c},()=>async function(){for(;s<i.length;){const e=s++,t=i[e],o=await Ho(t,n);r.set(t,o)}}()));const d=[];for(const[e,t]of l)if(!0!==r.get(e))for(const n of t)d.push({severity:"warning",code:"image_url_not_loadable",message:"Image URL could not be loaded or previewed; the link may be broken, expired, or blocked.",location:n,blockId:a.find(t=>t.url===e&&t.location===n)?.blockId??null});return d}async function Vo(e,t){return[...Do(e),...await Ko(e?.blockList??[],t)]}const Go=(...e)=>e.filter(Boolean).join(" ");function qo(e,t){const n=e[t];if(!n||"column"!==n.key)return[];const o=[];for(const t of n.cells||[])for(const n of t.childrenIds||[]){o.push(n);const t=e[n];"column"===t?.key&&o.push(...qo(e,n))}return o}function Jo(e,t,n){const o=e[n];if(!o)return null;const{containerBlock:a}=ne(e,t,n);if(!a?.id)return null;const l={...e};if("footer"===a.containerType&&!0!==a.footerUnifiedLayout){if(o.footerBannerSlot||o.footerBannerDividerSlot){l[a.id]={...a,showFooterBanner:!1};for(const t of qo(e,a.id)){const n=e[t];(n?.footerBannerSlot||n?.footerBannerDividerSlot)&&(l[t]={...n,hidden:!0})}return{nextBlockMap:l}}return o.footerSlot?(l[n]={...o,hidden:!0},{nextBlockMap:l}):null}if("header"===a.containerType){if(o.headerLogoSlot)return l[a.id]={...a,showLogo:!1},l[n]={...o,hidden:!0},{nextBlockMap:l};if(o.headerBannerSlot||o.headerBannerDividerSlot){l[a.id]={...a,showHeaderBanner:!1};for(const t of qo(e,a.id)){const n=e[t];(n?.headerBannerSlot||n?.headerBannerDividerSlot)&&(l[t]={...n,hidden:!0})}return{nextBlockMap:l}}return null}return null}const Yo={drag_block_here:"请将模块拖放到此处",drop_content_here:"将内容拖放到此处",drop_content_hint:"从左侧拖拽模块到此处,或单击插入。",drag_section_here:"将版块拖放到此处",blocks:"模块",photos:"图片",powered_by_pexels:"图片由Pexels提供",loading:"加载中...",content:"内容",typography:"排版",compliance_approx_kb:"约 {{n}} KB",styles:"样式",ai_powered:"AI 驱动",layout:"布局",components:"组件",presets:"预设",body_settings:"邮件主题设置",global:"全局",text_and_headings:"文本与标题",pre_header:"预标题",pre_header_description:"预标题是在收件箱中查看电子邮件时跟随主题行的简短摘要文本。",confirm:"确认",cancel:"取消",add_blocks:"请添加块",block_product:"产品",block_product_single:"单个",block_product_multi:"多个",block_discount:"折扣",product_output_layout:"输出布局",product_main_layout_stacked:"图片在上,详情在下",product_main_layout_image_left:"图片在左,详情在右",discount_variant_simple:"简洁(单行)",discount_variant_card:"卡片(标题 + 优惠码)",additional_products_grid_layout:"附加产品",additional_products_per_row:"每行产品数",product_row_count_2:"2 列",product_row_count_3:"3 列",block_introduction:"引言",block_body:"正文",block_header:"页眉",block_footer:"页脚",no_product_found:"未找到产品",no_products_matching_search:"没有符合搜索条件的产品。清空搜索可查看完整列表。",load_more_products:"加载更多",add_products:"添加产品",add_products_in_store:"请在店铺中添加产品。",column:"列",columns:"列排版",column_settings:"列设置",column_cells_section:"列单元格",column_wrapper_style:"外层样式",column_styles:"列样式",size_px:"尺寸",column_delete:"删除列",column_delete_desc:"您确定删除多余的{{count}}列吗?",block_palette_section:"版块",block_palette_columns:"分栏",settings_title_column_layout:"栏位设置",container:"版块",select_parent_section_tooltip:"父级版块设置 — 布局、间距与背景",container_settings:"版块设置",layers_panel:"图层",email_styles_section:"邮件样式",document_section:"文档",body_bg_color_short:"背景色",body_content_bg_short:"正文背景",body_width_label:"宽度",body_font_short:"字体",body_text_short:"正文",body_heading_short:"标题",body_link_short:"链接",type_styles_section:"文字",container_type:"版块类型",container_type_help:"决定该版块可用的变量和产品映射。",container_type_none:"默认",container_type_header:"页眉",container_type_discount:"折扣",container_type_introduction:"引言",container_type_body:"正文",container_type_product:"产品",container_type_hero_product:"主推产品",container_type_additional_product:"附加产品",container_type_footer:"页脚",product_role:"产品角色",product_role_main_hero:"主推产品",product_role_additional:"附加产品",product_column_select_label:"使用系统变量",product_column_select_placeholder:"搜索或选择产品",product_column_variables_heading:"产品字段变量",product_column_kb_heading:"知识库产品",product_column_kb_tooltip:"请在此从知识库目录中选择产品,用于决定该列在邮件中展示的商品。",text:"文本",text_content:"这是一个文本,点击修改文本",text_settings:"文本设置",text_styles:"文本样式",text_align:"文本对齐方式",heading:"标题",heading_content:"这是一个标题,点击修改标题",heading_settings:"标题设置",heading_type:"标题类型",button:"按钮",button_settings:"按钮设置",button_action:"点击按钮触发",button_styles:"按钮样式",button_padding:"按钮内边距",spacer:"间距",spacer_block:"间距块",spacer_settings:"间距设置",divider:"分割线",divider_settings:"分割线设置",divider_type:"分割线类型",divider_styles:"分割线样式",image:"图片",image_settings:"图片设置",image_crop_soon:"图片裁剪功能尚未开放。",crop:"裁剪",replace:"替换",delete:"删除",image_max_upload_size:"最大 10 MB",video:"视频",video_settings:"视频",video_tab_styles:"样式",video_tab_display:"显示",video_url:"视频地址",video_thumbnail_url:"自定义封面图 URL",video_thumbnail_url_placeholder:"留空则使用 YouTube 默认封面",video_export_note:"邮件客户端通常显示封面图链接,而不是内嵌播放器。",video_thumbnail_layout:"封面布局",video_width:"宽度 (W)",video_height:"高度 (H)",video_fill_column:"铺满列宽",video_fill_column_mobile:"移动端铺满列宽",alignment:"对齐",video_area_section:"视频区域",video_block_section:"区块",video_border_none:"无",image_action:"点击图片跳转",image_url:"图片URL",image_alt:"图片alt",image_alt_placeholder:"为屏幕阅读用户描述图片",image_styles:"图片样式",image_source:"图片来源",image_source_url:"输入URL",image_source_upload:"上传图片",image_upload:"上传",image_upload_click:"点击上传",image_upload_not_configured:"未配置图片上传。请在 apiConfig 中设置 imageUploadEndpoint,或传入 null 关闭;默认使用内置 API 根地址。",image_uploaded:"图片上传成功",image_upload_failed:"图片上传失败",image_upload_error:"上传图片时出错",image_upload_file_hint:"PNG、JPEG、GIF、SVG、WebP,最大 10 MB",image_upload_invalid_type:"请使用 PNG、JPEG、GIF、SVG 或 WebP 格式。",uploading:"上传中…",image_source_variable:"使用变量",menu:"导航栏",menu_settings:"导航栏设置",menu_items:"菜单项",menu_item:"菜单项",menu_styles:"菜单样式",add_new_item:"添加新项",label:"标签",page:"页面",url:"链接地址",target:"打开方式",same_tab:"当前窗口",new_tab:"新窗口",separator:"分隔符",menu_separator_placeholder:'例如 " | " 或 " • "',menu_separator_allowed_hint:"仅可使用:| • — / · 以及空格。",menu_link_gap:"链接间距",menu_underline_links:"链接下划线",logo_text_placeholder:"品牌名称",letter_spacing:"字间距",link_color:"链接颜色",menu_layout:"菜单布局",layout_mode:"布局模式",nav_only:"仅导航",stacked:"堆叠排列",logo_left:"Logo 在左",logo_right:"Logo 在右",logo_only:"仅 Logo",mobile_layout:"移动端布局",stack:"纵向堆叠",inline:"行内排列",logo_section:"Logo 区域",show_logo:"显示 Logo",logo_url:"Logo 地址",logo_text:"Logo 文字",logo_alt:"Logo 替代文字",logo_link:"Logo 链接",logo_max_width:"Logo 最大宽度",border_bottom:"底边框",show_border_bottom:"显示底边框",font_weight:"字重",font_weight_light:"细",font_weight_regular:"常规",font_weight_semibold:"半粗",font_weight_bold:"粗",text_transform:"字母大小写与样式",avatar:"头像",avatar_settings:"头像设置",avatar_image:"头像图片",avatar_border_radius:"圆角",social_link:"社交链接",add_social_link:"添加社交链接",social_link_size:"社交链接大小",icon_styles:"图标样式",icon_size:"图标大小",icon_size_small:"小",icon_size_medium:"中",icon_size_large:"大",icon_color:"图标颜色",icon_color_default:"默认",icon_color_white:"白色",icon_color_black:"黑色",icon_color_gray:"灰色",social_icon_spacing:"图标间距",social_links:"社交链接",social_link_settings:"社交链接设置",social_platform_x:"X",social_platform_formerly_twitter:"原 Twitter",social_platform_x_alt:"X(原 Twitter)",social_link_placeholder_facebook:"https://www.facebook.com/yourpage",social_link_placeholder_linkedin:"https://www.linkedin.com/company/yourcompany",social_link_placeholder_instagram:"https://www.instagram.com/yourhandle",social_link_placeholder_tiktok:"https://www.tiktok.com/@yourhandle",social_link_placeholder_x:"https://x.com/yourhandle",social_link_placeholder_youtube:"https://www.youtube.com/yourchannel",social_link_placeholder_pinterest:"https://www.pinterest.com/yourprofile",social_link_placeholder_generic:"https://example.com",social_settings_icons:"图标",social_settings_style:"样式",social_platform_field:"平台",social_icon_label_field:"标签",social_custom_icon:"自定义图标",social_add_icon:"添加平台",social_platform_custom:"自定义",social_icon_size_px:"尺寸",collapse:"收起",expand:"展开",raw_html:"HTML",raw_html_block:"适合邮件的 HTML",raw_html_block_description:"为兼容各邮件客户端,建议使用表格布局与内联样式。",raw_html_settings:"HTML 设置",raw_html_code_label:"代码",raw_html_code_hint:"导出邮件时将原样插入。发送前请在主流邮件客户端中实测。",raw_html_default_content:'<p style="text-align:center;color:#A3A3A3;font-size:12px">在此添加自定义 HTML</p>',raw_html_appearance:"布局",raw_html_clear_background:"清除背景",raw_html_email_client_warning:"自定义 HTML 在不同邮件客户端中的表现可能不一致,请充分测试。",raw_html_info_tooltip_aria:"了解适合邮件的 HTML",content_background_color:"内容背景颜色",container_background_image_title:"版块背景图",container_background_image_section_title:"版块背景图",container_background_image_section_toggle:"显示版块背景图设置",container_background_image_layout_group:"图片布局",container_background_image_row_label:"背景图",container_background_image_intro:"拖入该版块的文本、按钮、图片等会叠在背景图之上。请从左侧组件栏拖入画布中的该版块。",container_background_image_tooltip_p1:"背景图应用在版块的表格层上,兼容常见邮件客户端(不使用 position:absolute)。",container_background_image_tooltip_p2:"可用「内容背景颜色」为区块加蒙层或衬色,或设为透明以只显示照片。",container_background_image_enable:"启用背景图",container_background_image_url:"图片地址",container_background_image_upload:"上传图片",container_background_image_upload_click:"拖拽或选择图片",container_background_image_file_hint:"支持 .png、.jpg、.jpeg、.gif、.webp。单文件最大 10 MB。",container_background_image_select_button:"选择图片",container_background_image_clear:"移除背景图",container_background_image_size:"图片适配",container_background_image_position:"焦点位置",container_bg_size_cover:"覆盖(裁切)",container_bg_size_contain:"包含(完整)",container_bg_size_fill:"填充",image_file_too_large:"图片大小不能超过 10 MB。",container_bg_image_url_error_blocked_scheme:"该地址使用了不允许的协议。图片请仅使用 http:// 或 https://。",container_bg_image_url_error_duplicate_protocol:"地址中重复了协议前缀,请只保留一个,例如 https://。",container_bg_image_url_error_hostname:"请填写带有效域名的完整地址(例如 https://cdn.example.com/photo.jpg)。",container_bg_image_url_error_invalid_protocol:"不支持的协议。图片地址请使用 http:// 或 https://。",container_bg_image_url_error_generic:"图片地址格式无效。",container_bg_image_preview_failed:"无法加载预览:该地址可能不是图片,或服务器不允许嵌入显示。",image_text_overlay:"文字叠层",overlay_multi_item:"多段文本叠放",add_overlay_item:"添加叠层项",drag_to_move:"拖动排序",overlay_max_width:"叠层最大宽度",item_gap:"项间距",scrim:"背景蒙层",text_shadow:"文字阴影",fill_column:"填满列宽",image_text_overlay_tip:"可选:在图片上显示简短说明。若要在照片上排版多块内容,请使用版块背景图。",image_text_overlay_container_tip:"选中版块 → 样式 → 版块背景图,再将文字、按钮等拖入该版块。",image_text_overlay_enable:"启用文字叠层",image_overlay_caption:"说明文字",image_overlay_caption_placeholder:"一行简短文字…",image_overlay_position:"说明位置",image_overlay_pos_tl:"左上",image_overlay_pos_tc:"上中",image_overlay_pos_tr:"右上",image_overlay_pos_ml:"左中",image_overlay_pos_mc:"正中",image_overlay_pos_mr:"右中",image_overlay_pos_bl:"左下",image_overlay_pos_bc:"下中",image_overlay_pos_br:"右下",image_overlay_box_bg:"说明框背景(CSS)",image_overlay_padding:"说明内边距",background_color:"背景颜色",text_color:"文本颜色",email_theme_background_color:"邮件主题色",heading_color:"标题颜色",content_background:"内容区背景",font_color:"字体颜色",button_color:"按钮颜色",divider_color:"分割线颜色",action_type:"按钮类型",top:"上",right:"右",left:"左",bottom:"下",line_height:"行高",link:"超链接",link_url:"超链接URL",link_url_placeholder:"example.com",padding_settings:"内边距设置",width_auto:"宽度自适应",auto_width:"自动宽度",width:"宽度",height:"高度",font_size:"字体大小",font_family:"字体",align:"对齐方式",solid:"实线",dotted:"虚线(点)",dashed:"虚线(破折号)",spacing:"间距",border_radius:"圆角",link_all_sides:"联动四边",padding_link_sides_label:"四边使用相同内边距",padding_link_sides_tooltip:"开启后只需输入一个数值,将同时应用到上、右、下、左四面。关闭后可分别设置每一侧。",email_width_mode:"宽度",email_width_default:"邮件宽度(默认)",custom_px:"自定义像素",custom_width_px:"自定义宽度",full_bleed:"全幅铺满",full_bleed_tooltip:"在支持的客户端中可延展到边缘;不支持时会限制在邮件宽度内。",export_html:"导出html",export_json:"导出JSON",export_checking_images:"正在检查图片…",language_zh:"中文",export_validation_title:"导出前校验",export_validation_issues_found:"导出前发现以下问题",export_validation_errors:"错误",export_validation_warnings:"警告",export_validation_info:"提示",export_anyway:"仍要导出",ignore:"忽略",validation_body_content_width_invalid:"邮件内容宽度须在 280–1200 px 之间。",validation_body_background_color_missing:"主题背景色未设置。",validation_body_text_color_missing:"主题文字颜色未设置。",validation_body_font_family_missing:"主题字体未设置。",validation_image_empty_src:"图片地址为空,图片将无法显示。",validation_image_invalid_src:"图片地址格式无效。",validation_image_invalid_link:"图片链接地址格式无效。",validation_image_url_not_loadable:"图片地址无法加载或预览;链接可能已失效、过期或被拦截。",validation_image_empty_alt:"图片未设置 alt 文本,建议添加以提升可访问性。",validation_avatar_empty_src:"头像图片地址为空,头像将无法显示。",validation_avatar_invalid_src:"头像图片地址格式无效。",validation_avatar_invalid_link:"头像链接地址格式无效。",validation_button_empty_link:'按钮链接为空,将被保存为 href="https://"。',validation_button_invalid_link:"按钮链接格式无效。",validation_button_blocked_scheme:"按钮链接使用了被禁止的 URL 协议(如 javascript:、data: 等)。请仅使用 http(s)、mailto: 或 tel:。",validation_button_label_invalid_link:"按钮文案中的链接地址格式无效。",validation_button_label_blocked_link_scheme:"按钮文案中的链接使用了被禁止的 URL 协议(如 javascript:、data: 等)。请仅使用 http(s)、mailto: 或 tel:。",validation_rich_text_link_invalid:"富文本超链接地址格式无效。",validation_rich_text_link_blocked_scheme:"富文本链接使用了被禁止的 URL 协议(如 javascript:、data: 等)。请仅使用 http(s)、mailto: 或 tel:。",validation_menu_empty_label:"菜单项标签为空,将显示为「链接」。",validation_menu_empty_url:'菜单项链接为空,将被保存为 href="#"。',validation_menu_invalid_url:"菜单项链接格式无效。",validation_menu_blocked_scheme:"菜单项链接使用了被禁止的协议(如 javascript:、data: 等)。请仅使用 http(s)、mailto: 或 tel:。",validation_menu_no_items:"菜单块没有任何项。",validation_raw_html_empty:"HTML 块没有自定义代码;导出将只有空的外层容器。",validation_social_empty_link:'社交链接地址为空,将被保存为 href="https://"。',validation_social_invalid_link:"社交链接地址格式无效。",validation_social_blocked_scheme:"社交链接使用了被禁止的 URL 协议(如 javascript:、data: 等)。请仅使用 http(s) 地址(例如 www.example.com 或 https://…)。",validation_social_empty_icon:"社交链接图标地址为空,图标将无法显示。",validation_social_invalid_icon:"社交链接图标地址格式无效。",validation_social_no_links:"社交链接块没有任何链接。",validation_social_duplicate_platform:"社交链接块中存在重复平台,每个平台仅应保留一条。",section_nest_not_allowed:"版块不能嵌套在另一版块内,请在版块之间的堆叠区域释放。",validation_container_product_not_assigned:"该列未分配产品;请在版块设置中分配产品。",validation_dynamic_content_empty:"未生成动态内容;导出将使用静态文本(如有)。",validation_text_invalid_link:"文本链接地址格式无效。",validation_text_blocked_link_scheme:"文本链接使用了被禁止的 URL 协议(如 javascript:、data: 等)。请仅使用 http(s)、mailto: 或 tel:。",tooltip_bold:"加粗",tooltip_italic:"斜体",tooltip_underline:"下划线",tooltip_strikethrough:"删除线",tooltip_align_left:"居左",tooltip_align_center:"居中",tooltip_align_right:"居右",tooltip_ordered_list:"有序列表",tooltip_unordered_list:"无序列表",tooltip_link:"超链接",tooltip_remove_link:"删除超链接",add_link_modal_title:"添加超链接",content_type:"内容类型",content_type_static:"静态",content_type_dynamic:"动态",ai_enabled:"使用 AI 撰写",text_ai_mode_manual_edit_title:"无法在画布中编辑该文本",text_ai_mode_manual_edit_disabled:"此文本块已开启 AI 撰写,画布上不能直接编辑。请在右侧面板关闭「使用 AI 撰写」后即可手动编辑正文。",text_and_content_type:"内容类型",heading_or_body:"标题",body_paragraph:"正文",heading_h1:"H1",heading_h2:"H2",heading_h3:"H3",heading_h4:"H4",variables:"变量",insert_merge_field:"选择或输入变量...",dynamic_prompt_help:"写下你的提示",ai_output_language:"AI 输出语言",ai_output_language_en:"英语",ai_output_language_bn:"孟加拉语",generate:"生成",ml_generation_failed:"无法生成 AI 内容",ml_ai_unavailable:"AI 生成需要分栏布局、公司 ID、模板 ID 和 ML 接口。请将文本放在栏目内并检查 apiConfig。",ml_no_variations:"未返回任何建议。请更换提示词或确认服务器上存在该模板。",ml_generation_unexpected_error:"生成内容时发生意外错误。",sample_ai_content:"示例 AI 内容",select_content:"选择内容",variable_dynamic_placeholder:"无(可选)",variable_display_text:"展示文案",variable_introduction:"引言",variable_heading:"标题",variable_subheading:"副标题",variable_products_description:"产品描述",variable_customer_name:"客户姓名",variable_introduction_title:"引言标题",variable_introduction_subtitle:"引言副标题",variable_body_title:"正文标题",variable_body_subtitle:"正文副标题",variable_discount_value:"折扣力度",variable_discount_code:"折扣码",variable_valid_until:"有效期至",variable_company_name:"公司名称",variable_brand_name:"品牌名称",variable_address:"地址",variable_website:"网站",variable_logo_url:"Logo URL",variable_tagline:"标语",variable_nav_label:"导航文案",variable_nav_url:"导航链接",variable_product_name:"产品名称",variable_product_description:"产品描述",variable_product_image:"产品图片 URL",variable_product_link:"产品链接",variable_product_price:"产品价格",variable_product_currency:"货币",variable_product_old_price:"原价",variable_product_new_price:"现价",variable_product_price_display:"产品价格展示",variable_image_logo:"Logo",variable_image_hero_banner:"主图横幅",variable_image_footer_banner:"页脚横幅",variable_image_product_image:"产品图片",variable_cta_label:"CTA 文案",variable_cta_url:"CTA 链接",button_label_variable:"按钮文案(变量)",button_url_variable:"使用变量",button_text:"按钮文案",button_label_manual:"输入文案",button_url_manual:"输入链接",use_company_social_links:"使用公司社交链接",use_navigation_links:"使用导航链接",tooltip_container_type:"决定该版块可用的变量和产品映射。",tooltip_variables_static:"将合并字段插入内容,发送邮件时将被替换。",tooltip_dynamic_prompt:"描述语气或意图,我们将推荐示例内容。(预览模式 — 连接 AI API 后可生成真实内容。)",tooltip_write_using_ai:"开启后,可选择输出语言并输入提示生成多种示例。需配置 ML/API。",tooltip_write_using_ai_unavailable:"当前编辑器未开启 AI 写作。请在宿主应用或 API 中启用后再使用「使用 AI 撰写」。",label_align:"对齐",label_padding:"内边距",section_background_group:"区块背景",section_bg_mode:"类型",section_bg_color:"颜色",section_bg_image:"图片",section_bg_none:"无",section_content_area_group:"内容区",content_area_color:"内容底色",content_color_auto:"自动",content_color_custom:"自定义",shortcuts_modal_title:"键盘快捷键",shortcuts_modal_footnote:"在右侧设置面板的文本框中输入时快捷键会暂时停用,以便正常编辑链接和复制粘贴。",shortcut_save:"保存(由宿主页面接入时触发)",shortcut_undo:"撤销",shortcut_redo:"重做",shortcut_duplicate:"复制选中模块",shortcut_copy_block:"复制模块",shortcut_paste_block:"粘贴模块",shortcut_delete_block:"删除选中模块",shortcut_escape:"取消选中",shortcut_cheat_sheet:"打开此帮助",shortcut_delete_confirm_title:"删除此版块?",shortcut_delete_confirm_desc:"版块内仍有内容模块,确定要删除吗?",context_duplicate:"复制",context_copy:"复制到剪贴板",context_cut:"剪切",context_paste:"粘贴",context_delete:"删除",context_move_up:"上移",context_move_down:"下移",context_save_global:"保存为全局组件",context_reset_styles:"重置样式",topbar_back_to_templates:"模板",topbar_breadcrumb_email:"邮件",topbar_rename_template:"重命名模板",topbar_untitled_template:"未命名模板",send_test:"发送测试",preview:"预览",html_email_preview:"HTML 预览",html_email_preview_title:"HTML 邮件预览",html_email_preview_device_aria:"HTML 预览设备宽度",html_email_preview_error:"无法生成 HTML 预览,请查看控制台。",save_template:"保存模板",more_actions:"更多操作",keyboard_shortcuts:"键盘快捷键",high_contrast_on:"高对比度开",high_contrast_off:"高对比度关",desktop:"桌面",mobile:"移动",undo:"撤销",redo:"重做",save_state_saved:"已保存",save_state_saving:"保存中…",save_state_unsaved:"未保存",save_state_error:"保存失败",export_validation_open_block:"打开此区块",save:"保存",template_name:"模板名称",save_template_title:"保存模板",save_template_category:"分类",save_template_category_placeholder:"选择或输入分类…",category_promotional:"促销",category_transactional:"事务通知",category_newsletter:"Newsletter",category_onboarding:"Onboarding",category_announcement:"公告",category_other:"其他",send_test_title:"发送测试邮件",send_test_send:"发送测试",send_test_recipients:"收件人",send_test_recipients_placeholder:"name@example.com, another@example.com",send_test_recipients_hint:"按 Enter 或逗号可添加地址。",send_test_payload:"数据上下文",send_test_payload_none:"不附带数据",send_test_payload_profile:"用户资料数据",send_test_payload_event:"事件数据",send_test_prefix_label:"[TEST] 前缀",send_test_prefix_hint:"在邮件主题前添加 [TEST]。",universal:"通用",layers:"图层",document:"文档",layer_one:"个区块",layer_many:"个区块",layer_move_up:"上移",layer_move_down:"下移",layer_duplicate:"复制",layer_delete:"删除",universal_saved_blocks:"已保存区块",universal_empty_state_line_1:"还没有通用内容。点击",universal_empty_state_line_2:"可将区块保存以在其他模板中复用。",universal_used_in_count:"已使用 {{count}}",compliance:"合规",compliance_preflight:"发送前检查",compliance_all_clear_title:"准备就绪",compliance_all_clear_desc:"所有合规检查均已通过。",compliance_severity_error:"错误",compliance_severity_warning:"警告",compliance_severity_info:"信息",compliance_tab_badge_label:"未解决问题:{{count}}",compliance_email_size:"邮件大小(估算)",compliance_above_clip:"已超过 Gmail 约 102 KB 折叠阈值,收件箱中可能会被截断显示。",compliance_below_clip:"低于 Gmail 折叠阈值",right_panel_empty_hint:"点击画布中的任意区块以编辑其特定设置。从左侧栏拖动区块以添加新内容。",right_panel_back:"返回",layer_show:"显示",layer_hide:"隐藏",save_as_universal:"保存为通用区块",universal_save_modal_title:"保存为通用区块",universal_save_modal_subtitle:"可在多个模板中复用。编辑不会影响已发送的邮件。",universal_save_modal_placeholder:"例如:Beantown 页脚",universal_save_modal_confirm:"保存区块",universal_save_success:"已保存为通用区块:{{name}}",universal_save_error:"保存失败,请检查网络后重试。",universal_delete:"删除",universal_delete_confirm_title:"移除已保存区块?",universal_delete_confirm_body:"将从素材库中移除,已发送邮件不受影响。",universal_delete_confirm_ok:"移除",configure_columns_title:"配置分栏",configure_columns_subtitle:"选择一种布局。每一列初始为空,可拖入区块。",configure_columns_insert:"插入版块",configure_columns_hint:"点击配置布局",configure_columns_row_count:"插入行数:",standard_layout:"标准布局",grid_layout:"6/12 栅格",grid_settings:"网格",grid_rows_locked_hint:"邮件分栏为单行布局,行数固定为 1。",columns_layout:"分栏布局",column_sizes:"列宽 (%)",show_more:"展开",show_less:"收起",col:"列",gaps:"间距",column_gap:"列间距",button_variant:"样式变体",full_width:"全宽",hover_bg_color:"悬停背景色",hover_text_color:"悬停文字颜色",text_decoration:"文本装饰",shadow:"阴影",shadow_preset:"预设",table:"表格",table_settings:"表格设置",footer_settings:"页脚设置",cell_content:"单元格内容",add_link_url:"链接地址",add_link_url_placeholder:"https://example.com",add_link_display_text:"显示文本",add_link_display_text_placeholder:"留空则保留当前选中文本",add_link_display_text_empty_badge:"未填写 — 将使用选中的文字作为链接文字",add_link_open_new_tab:"在新标签页打开",align_left:"左对齐",align_center:"居中对齐",align_right:"右对齐",minimize_toolbar:"收起",close_text_editor:"退出文本编辑",unlink_universal:"解除当前副本关联",unlink_modal_title:"编辑通用区块",unlink_modal_keep:"保持关联",unlink_modal_unlink:"仅解绑当前副本",unlink_modal_body:"该区块当前关联到通用内容。直接编辑会影响所有使用该通用区块的位置。",unlink_modal_body2:"选择“仅解绑当前副本”可只在当前模板独立编辑;选择“保持关联”则继续联动所有实例。",custom:"自定义",custom_color:"自定义颜色",show_text_label:"显示文字标签",mobile_optimization:"移动端优化",stack_columns_on_mobile:"移动端堆叠栏目",scale_font_on_mobile:"移动端缩小字体",section_layout:"版块布局",content_max_width:"内容最大宽度",content_max_width_option_full:"全宽",min_height:"最小高度",border:"边框",border_style:"边框样式",border_width:"边框宽度",border_color:"边框颜色",visibility:"可见性",hidden_on_mobile:"在移动端隐藏",table_structure:"表格结构",rows:"行",header_row:"标题行",header_column:"标题列",cell_selector:"单元格选择器",cell_content_type:"单元格内容类型",table_style:"表格样式",cell_padding:"单元格内边距",header_style:"标题样式",header_background:"标题背景",header_text_color:"标题文字颜色",striped_rows:"斑马纹行",stripe_color:"斑马纹颜色",table_structure_mode:"模式",table_mode_static:"静态",table_mode_dynamic:"动态",table_dynamic_structure_hint:"导出仍为静态 HTML;数据驱动表格或将在后续版本接入。",table_add_row:"添加行",table_add_column:"添加列",table_decrease_rows:"减少行数",table_increase_rows:"增加行数",table_decrease_cols:"减少列数",table_increase_cols:"增加列数",table_selected_cell:"已选:第 {{row}} 行,第 {{col}} 列",table_select_cell_hint:"在网格中点击单元格以编辑内容。",table_cell_grid_truncated:"仅显示前 {{rows}} × {{cols}} 格",table_cell_text_placeholder:"单元格文字…",table_align_left:"左对齐",table_align_center:"居中",table_align_right:"右对齐",footer_visible_lines:"显示内容行",footer_toggle_brand_name:"品牌名称",footer_toggle_tagline:"标语",footer_toggle_address:"地址",footer_toggle_unsubscribe:"退订",footer_toggle_social_row:"社交图标行",footer_toggle_secondary_links:"次级链接",footer_toggle_copyright:"版权信息",footer_native_social_hint:"要编辑各平台与图标,请先关闭上方的公司链接,或在画布中选择社交行。",footer_company_social_managed_note:"图标与个人主页链接来自公司数据(与预览一致)。关闭上方开关后,可仅为本模板自定义平台。",footer_company_social_url_empty:"公司数据中暂无链接",footer_content_heading:"正文内容",footer_label_brand:"品牌",footer_unsubscribe_link_label:"退订链接文案",footer_preferences_link_label:"偏好设置链接文案",footer_preferences_url:"偏好设置链接 URL",footer_preferences_default_label:"更新偏好",footer_secondary_links_heading:"次级链接",footer_secondary_link_text:"链接文字",footer_secondary_link_url:"链接地址",footer_new_link_label:"新链接",footer_add_link:"添加链接",footer_social_platforms_heading:"社交平台",footer_platform_label:"平台",footer_social_profile_url:"主页链接",footer_upload_icon:"上传图标",footer_add_platform:"+ 添加平台",footer_style_heading:"样式",footer_text_color:"文字颜色",footer_link_color:"链接颜色",footer_background_content:"背景",footer_column_background:"栏背景",footer_align:"对齐",footer_border_heading:"边框",footer_divider_above:"上方分割线",footer_border_top:"顶部边框",footer_border_top_color:"顶部边框颜色",footer_social_instagram:"Instagram",footer_social_facebook:"Facebook",footer_social_twitter:"Twitter",footer_social_linkedin:"领英",footer_social_youtube:"YouTube",footer_social_tiktok:"TikTok",footer_social_custom_icon:"自定义图标",footer_sections:"页脚区块",footer_brand_name_placeholder:"您的品牌",footer_brand_tagline_placeholder:"品牌标语",footer_address_placeholder:"示例:某某路 123 号,城市,国家",footer_unsubscribe_url_placeholder:"{{unsubscribe_url}}",footer_copyright_placeholder:"© {{year}} 您的公司",footer_default_unsubscribe_text:"退订",show_brand:"品牌信息",brand_name:"品牌名称",brand_tagline:"品牌标语",show_address:"地址",address:"地址文本",show_unsubscribe:"退订链接",unsubscribe_text:"链接文案",unsubscribe_url:"退订链接 URL",show_social:"社交图标",social_icons_hint:"请在该区块的内容设置里配置社交图标。",show_secondary_links:"次级链接",show_copyright:"版权信息",copyright_text:"版权文本",footer_style:"页脚样式",padding_top:"顶部内边距",padding_bottom:"底部内边距",show_divider:"显示分割线",header_settings:"页眉设置",discount_settings:"折扣设置",discount_show_title:"显示标题",preset_discount_simple:"折扣(单行)",style:"样式",navigation:"导航",link_style:"链接样式",color:"颜色",size:"大小",weight:"字重",transform:"字形变换",gap:"间距",underline:"下划线",title:"标题",add_link:"添加链接",font_weight_medium:"中等",nav_text_transform_sentence:"正常大小写",nav_text_transform_uppercase:"全部大写",nav_text_transform_capitalize:"首字母大写",placeholder_https:"https://…",brand_name_placeholder:"品牌名称",logo_padding:"Logo 内边距",default_nav_link_label:"链接",navigation_link_placeholder_url:"#",container_variables_none_available:"此版块类型没有可用的变量。",header_layout_logo_left_nav_right:"Logo 在左,导航在右",header_layout_logo_right_nav_left:"Logo 在右,导航在左",header_layout_logo_center_nav_below:"Logo 居中,导航在下",header_layout_logo_only:"仅 Logo",header_layout_nav_only:"仅导航",header_banner_section:"页眉横幅",show_header_banner:"显示页眉横幅",footer_banner_section:"页脚横幅",show_footer_banner:"显示页脚横幅",border_none:"无",discount_code_section:"优惠码",discount_code_background:"代码背景",discount_code_corner_radius:"代码圆角",column_preset_1_col:"1 列",column_preset_equal_2:"两列等宽",column_preset_equal_3:"三列等宽",column_preset_equal_4:"四列等宽",column_preset_1_2:"1 / 2",column_preset_2_1:"2 / 1",column_preset_1_3:"1 / 3",column_preset_3_1:"3 / 1",column_preset_2_3:"2 : 3",column_preset_3_2:"3 : 2",column_preset_1_2_1:"1 / 2 / 1",column_preset_2_1_1:"2 / 1 / 1",column_preset_1_1_2:"1 / 1 / 2",column_preset_2_4_2_4:"2-4 · 2-4",column_preset_4_2_4_2:"4-2 · 4-2"},Xo={drag_block_here:"Drag block here",drop_content_here:"Drop content here",drop_content_hint:"Drag blocks from the left, or click to insert.",drag_section_here:"Drag section here",blocks:"Blocks",photos:"Photos",powered_by_pexels:"Powered by Pexels",loading:"Loading...",content:"Content",typography:"Typography",styles:"Styles",ai_powered:"AI powered",layout:"Layout",components:"Components",presets:"Presets",body_settings:"Theme Settings",global:"Global",text_and_headings:"Text and headings",pre_header:"Pre-header",pre_header_description:"The pre-header is a short summary text that follows the subject line when viewing an email in the inbox.",confirm:"Confirm",cancel:"Cancel",add_blocks:"Add blocks",block_product:"Product",block_product_single:"Single",block_product_multi:"Multi",block_discount:"Discount",product_output_layout:"Output layout",product_main_layout_stacked:"Image on top, Details below",product_main_layout_image_left:"Image left, Details right",discount_variant_simple:"Simple (one line)",discount_variant_card:"Card (title + code)",additional_products_grid_layout:"Additional products",additional_products_per_row:"Products per row",product_row_count_2:"2 columns",product_row_count_3:"3 columns",block_introduction:"Introduction",block_body:"Body",block_header:"Header",block_footer:"Footer",no_product_found:"No product found",no_products_matching_search:"No products match your search. Clear the search to see the full list.",load_more_products:"Load more",add_products:"Add products",add_products_in_store:"Add products in your store.",column:"Column",columns:"Columns",column_settings:"Column Settings",column_cells_section:"Column cells",column_wrapper_style:"Wrapper style",column_styles:"Column Styles",size_px:"Size",column_delete:"Delete Column",column_delete_desc:"Are you sure you want to delete {{count}} extra columns? ",block_palette_section:"Section",block_palette_columns:"Column",settings_title_column_layout:"Column settings",container:"Section",select_parent_section_tooltip:"Parent section settings — layout, spacing, and background",container_settings:"Section settings",layers_panel:"Layers",email_styles_section:"Email styles",document_section:"Document",body_bg_color_short:"Bg color",body_content_bg_short:"Content bg",body_width_label:"Width",body_font_short:"Font",body_text_short:"Text",body_heading_short:"Heading",body_link_short:"Link",type_styles_section:"Type",container_type:"Section type",container_type_help:"Determines which variables and product mappings are available for this section.",container_type_none:"Default",container_type_header:"Header",container_type_discount:"Discount",container_type_introduction:"Introduction",container_type_body:"Body",container_type_product:"Product",container_type_hero_product:"Hero Product",container_type_additional_product:"Additional Product",container_type_footer:"Footer",product_role:"Product Role",product_role_main_hero:"Primary",product_role_additional:"Secondary",product_column_select_label:"Use system variables",product_column_select_placeholder:"Search or select a product",product_column_variables_heading:"Product field tokens",product_column_kb_heading:"Knowledge base product",product_column_kb_tooltip:"Choose a product from your knowledge base catalog here. This controls which product appears in this column in the email.",text:"Text",text_content:"This is a text, click to edit text",text_settings:"Text Settings",text_styles:"Text Styles",text_align:"Text Align",heading:"Heading",heading_content:"This is a heading, click to edit heading",heading_settings:"Heading Settings",heading_type:"Heading Type",button:"Button",button_settings:"Button Settings",button_action:"Button Action",button_styles:"Button Styles",button_padding:"Button Padding",spacer:"Spacer",spacer_block:"SPACER BLOCK",spacer_settings:"Spacer Settings",divider:"Divider",divider_settings:"Divider Settings",divider_type:"Divider Type",divider_styles:"Divider Styles",image:"Image",image_action:"Image Action",image_url:"Image URL",image_alt:"Image Alt",image_alt_placeholder:"Describe for screen readers",image_styles:"Image Styles",image_settings:"Image Settings",image_crop_soon:"Image cropping is not available yet.",crop:"Crop",replace:"Replace",delete:"Delete",image_max_upload_size:"max 10 MB",video:"Video",video_settings:"Video",video_tab_styles:"Styles",video_tab_display:"Display",video_url:"Video URL",video_thumbnail_url:"Custom thumbnail URL",video_thumbnail_url_placeholder:"Leave empty to use YouTube thumbnail",video_export_note:"Email clients typically show a linked thumbnail, not embedded playback.",video_thumbnail_layout:"Thumbnail layout",video_width:"Width (W)",video_height:"Height (H)",video_fill_column:"Fill column",video_fill_column_mobile:"Fill column on mobile",alignment:"Alignment",video_area_section:"Video area",video_block_section:"Block",video_border_none:"None",image_source:"Image source",image_source_url:"Enter URL",image_source_upload:"Upload image",image_upload:"Upload",image_upload_click:"Click to upload",image_upload_not_configured:"Image upload is not configured. Set imageUploadEndpoint in apiConfig or pass null to disable; defaults use the built-in API base.",image_uploaded:"Image uploaded successfully",image_upload_failed:"Failed to upload image",image_upload_error:"Error uploading image",image_upload_file_hint:"PNG, JPEG, GIF, SVG, WebP · max 10 MB",image_upload_invalid_type:"Use PNG, JPEG, GIF, SVG, or WebP.",uploading:"Uploading…",image_source_variable:"Use variable",menu:"Navigation bar",menu_settings:"Navigation bar Settings",menu_layout:"Menu layout",layout_mode:"Layout mode",nav_only:"Navigation only",stacked:"Stacked",logo_left:"Logo left",logo_right:"Logo right",logo_only:"Logo only",mobile_layout:"Mobile layout",stack:"Stack",inline:"Inline",logo_section:"Logo section",show_logo:"Show logo",logo_url:"Logo URL",logo_text:"Logo text",logo_alt:"Logo alt",logo_link:"Logo link",logo_max_width:"Logo max width",border_bottom:"Border bottom",show_border_bottom:"Show border bottom",font_weight:"Font weight",font_weight_light:"Light",font_weight_regular:"Regular",font_weight_semibold:"Semi-bold",font_weight_bold:"Bold",text_transform:"Text transform",menu_items:"Menu Items",menu_item:"Menu Item",menu_styles:"Menu Styles",add_new_item:"Add New Item",label:"Label",page:"Page",url:"URL",target:"Target",same_tab:"Same Tab",new_tab:"New Tab",separator:"Separator",menu_separator_placeholder:'e.g. " | " or " • "',menu_separator_allowed_hint:"Only these symbols: | • — / · You may add spaces.",menu_link_gap:"Link spacing",menu_underline_links:"Underline links",logo_text_placeholder:"Brand",letter_spacing:"Letter Spacing",link_color:"Link Color",avatar:"Avatar",avatar_settings:"Avatar Settings",avatar_image:"Avatar image",avatar_border_radius:"Border radius",social_link:"Social Link",social_link_settings:"Social Link Settings",add_social_link:"Add Social Link",social_link_size:"Social Link Size",icon_styles:"Icon styles",icon_size:"Icon size",icon_size_small:"Small",icon_size_medium:"Medium",icon_size_large:"Large",icon_color:"Icon color",icon_color_default:"Default",icon_color_white:"White",icon_color_black:"Black",icon_color_gray:"Gray",social_icon_spacing:"Icon spacing",social_links:"Social Links",social_platform_x:"X",social_platform_formerly_twitter:"Formerly Twitter",social_platform_x_alt:"X, formerly Twitter",social_link_placeholder_facebook:"https://www.facebook.com/yourpage",social_link_placeholder_linkedin:"https://www.linkedin.com/company/yourcompany",social_link_placeholder_instagram:"https://www.instagram.com/yourhandle",social_link_placeholder_tiktok:"https://www.tiktok.com/@yourhandle",social_link_placeholder_x:"https://x.com/yourhandle",social_link_placeholder_youtube:"https://www.youtube.com/yourchannel",social_link_placeholder_pinterest:"https://www.pinterest.com/yourprofile",social_link_placeholder_generic:"https://example.com",social_settings_icons:"Icons",social_settings_style:"Style",social_platform_field:"Platform",social_icon_label_field:"Label",social_custom_icon:"Custom icon",social_add_icon:"Add platform",social_platform_custom:"Custom",social_icon_size_px:"Size",collapse:"Collapse",expand:"Expand",raw_html:"HTML",raw_html_block:"Email-safe HTML",raw_html_block_description:"Prefer table-based layouts and inline CSS for client compatibility.",raw_html_settings:"HTML Settings",raw_html_code_label:"Code",raw_html_code_hint:"Inserted as-is in the exported email. Test in major clients before you send.",raw_html_default_content:'<p style="text-align:center;color:#A3A3A3;font-size:12px">Add custom HTML here</p>',raw_html_appearance:"Layout",raw_html_clear_background:"Clear",raw_html_email_client_warning:"Custom HTML may render inconsistently across email clients. Test thoroughly.",raw_html_info_tooltip_aria:"More about email-safe HTML",content_background_color:"Content Background Color",container_background_image_title:"Section background image",container_background_image_section_title:"Section background image",container_background_image_section_toggle:"Show section background image",container_background_image_layout_group:"Image layout",container_background_image_row_label:"Background image",container_background_image_intro:"Blocks you add to this section (text, buttons, images, etc.) appear on top of the image. Drag components from the palette into the section on the canvas.",container_background_image_tooltip_p1:"Uses a background image on the section table (email-client friendly — not CSS position:absolute).",container_background_image_tooltip_p2:"Use “Content background color” for a tint behind blocks, or set it transparent so only the photo shows through.",container_background_image_enable:"Enable background image",container_background_image_url:"Image URL",container_background_image_upload:"Upload image",container_background_image_upload_click:"Drag and drop or select image",container_background_image_file_hint:"Accepts .png, .jpg, .jpeg, .gif, and .webp. Maximum file size 10 MB.",container_background_image_select_button:"Select image",container_background_image_clear:"Remove background image",container_background_image_size:"Image fit",container_background_image_position:"Focal point",container_bg_size_cover:"Cover",container_bg_size_contain:"Contain",container_bg_size_fill:"Fill",image_file_too_large:"Image must be 10 MB or smaller.",container_bg_image_url_error_blocked_scheme:"This URL uses a blocked protocol. Use only http:// or https:// for images.",container_bg_image_url_error_duplicate_protocol:"The URL repeats the protocol. Use a single https:// prefix.",container_bg_image_url_error_hostname:"Use a full URL with a valid hostname (e.g. https://cdn.example.com/photo.jpg).",container_bg_image_url_error_invalid_protocol:"Unsupported protocol. Use http:// or https:// for image URLs.",container_bg_image_url_error_generic:"Invalid image URL format.",container_bg_image_preview_failed:"Could not load a preview for this URL. It may not be an image, or the host blocked the request.",image_text_overlay:"Text overlay",overlay_multi_item:"Multi-item stack",add_overlay_item:"Add overlay item",drag_to_move:"Drag to move",overlay_max_width:"Overlay max width",item_gap:"Item gap",scrim:"Scrim",text_shadow:"Text shadow",fill_column:"Fill column",image_text_overlay_tip:"Optional caption drawn on top of the image in the editor. For full layouts over a photo, use a section background image instead.",image_text_overlay_container_tip:"Select the section → Styles → Section background image, then drag text and buttons into that section.",image_text_overlay_enable:"Enable text overlay",image_overlay_caption:"Caption",image_overlay_caption_placeholder:"Short line of text…",image_overlay_position:"Caption position",image_overlay_pos_tl:"Top left",image_overlay_pos_tc:"Top center",image_overlay_pos_tr:"Top right",image_overlay_pos_ml:"Middle left",image_overlay_pos_mc:"Middle center",image_overlay_pos_mr:"Middle right",image_overlay_pos_bl:"Bottom left",image_overlay_pos_bc:"Bottom center",image_overlay_pos_br:"Bottom right",image_overlay_box_bg:"Caption box background (CSS)",image_overlay_padding:"Caption padding",background_color:"Background Color",text_color:"Text Color",email_theme_background_color:"Email Theme Background Color",font_color:"Font Color",button_color:"Button Color",divider_color:"Divider Color",action_type:"Action Type",content_background:"Content background",heading_color:"Heading color",top:"Top",right:"Right",left:"Left",bottom:"Bottom",line_height:"Line Height",link:"Link",link_url:"Link URL",link_url_placeholder:"example.com",padding_settings:"Padding Settings",width:"Width",height:"Height",width_auto:"Width Auto",auto_width:"Auto Width",font_size:"Font Size",font_family:"Font Family",solid:"Solid",dotted:"Dotted",dashed:"Dashed",align:"Align",spacing:"Spacing",border_radius:"Border radius",link_all_sides:"Link all sides",padding_link_sides_label:"Same padding on all sides",padding_link_sides_tooltip:"When on, one value updates top, right, bottom, and left together. Turn off to set each side separately.",email_width_mode:"Width",email_width_default:"Email-width (default)",custom_px:"Custom px",custom_width_px:"Custom width",full_bleed:"Full bleed",full_bleed_tooltip:"Extends edge-to-edge in clients that support it; clipped to email-width otherwise.",export_html:"Export HTML",export_json:"Export JSON",export_checking_images:"Checking images…",language_zh:"中文",export_validation_title:"Export validation",export_validation_issues_found:"Issues found before export",export_validation_errors:"Errors",export_validation_warnings:"Warnings",export_validation_info:"Info",export_anyway:"Export anyway",ignore:"Ignore",validation_body_content_width_invalid:"Body content width must be between 280 and 1200 px.",validation_body_background_color_missing:"Theme background color is missing.",validation_body_text_color_missing:"Theme text color is missing.",validation_body_font_family_missing:"Theme font family is missing.",validation_image_empty_src:"Image URL is empty; the image will not display.",validation_image_invalid_src:"Image URL format is invalid.",validation_image_invalid_link:"Image link URL format is invalid.",validation_image_url_not_loadable:"Image URL could not be loaded or previewed; the link may be broken, expired, or blocked.",validation_image_empty_alt:"Image alt text is empty; consider adding for accessibility.",validation_avatar_empty_src:"Avatar image URL is empty; avatar will not display.",validation_avatar_invalid_src:"Avatar image URL format is invalid.",validation_avatar_invalid_link:"Avatar link URL format is invalid.",validation_button_empty_link:'Button link URL is empty; will be saved as href="https://".',validation_button_invalid_link:"Button link URL format is invalid.",validation_button_blocked_scheme:"Button link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",validation_button_label_invalid_link:"Button label link URL format is invalid.",validation_button_label_blocked_link_scheme:"Button label link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",validation_rich_text_link_invalid:"Rich text hyperlink URL format is invalid.",validation_rich_text_link_blocked_scheme:"Rich text link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",validation_menu_no_items:"Navigation bar has no links.",validation_raw_html_empty:"HTML block has no custom markup; export will include an empty wrapper.",validation_social_empty_link:'Social link URL is empty; will be saved as href="https://".',validation_social_invalid_link:"Social link URL format is invalid.",validation_social_blocked_scheme:"Social link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s) only (e.g. www.example.com or https://…).",validation_social_empty_icon:"Social link icon URL is empty; icon will not display.",validation_social_invalid_icon:"Social link icon URL format is invalid.",validation_social_no_links:"Social link block has no links.",validation_social_duplicate_platform:"Duplicate social platform in this block; only one entry per platform should be kept.",validation_container_product_not_assigned:"A product is not assigned to this column; assign a product in Section settings.",validation_dynamic_content_empty:"Dynamic content not generated; export will use static text if available.",validation_text_invalid_link:"Text link URL format is invalid.",validation_text_blocked_link_scheme:"Text link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",tooltip_bold:"Bold",tooltip_italic:"Italic",tooltip_underline:"Underline",tooltip_strikethrough:"Strikethrough",tooltip_align_left:"Align left",tooltip_align_center:"Align center",tooltip_align_right:"Align right",tooltip_ordered_list:"Ordered list",tooltip_unordered_list:"Unordered list",tooltip_link:"Link",tooltip_remove_link:"Remove link",add_link_modal_title:"Add link",content_type:"Content type",content_type_static:"Static",content_type_dynamic:"Dynamic",ai_enabled:"Write using AI",text_ai_mode_manual_edit_title:"Can't edit this text here",text_ai_mode_manual_edit_disabled:"AI writing is on for this block, so the text isn't editable on the canvas. In the right panel, turn off “Write using AI” to edit manually.",text_and_content_type:"Content type",heading_or_body:"Heading",body_paragraph:"Body",heading_h1:"H1",heading_h2:"H2",heading_h3:"H3",heading_h4:"H4",variables:"Variables",insert_merge_field:"Select or type variable...",dynamic_prompt_help:"Write your prompt",ai_output_language:"AI output language",ai_output_language_en:"English",ai_output_language_bn:"Bengali",generate:"Generate",ml_generation_failed:"Could not generate AI content",ml_ai_unavailable:"AI generation needs a column layout, company ID, template ID, and ML endpoint. Open this text inside a section column and check apiConfig.",ml_no_variations:"No suggestions were returned. Try another prompt or verify the template exists on the server.",ml_generation_unexpected_error:"Something went wrong while generating content.",sample_ai_content:"Sample AI content",select_content:"Select content",variable_dynamic_placeholder:"None (optional)",variable_display_text:"Display text",variable_introduction:"Introduction",variable_heading:"Heading",variable_subheading:"Subheading",variable_products_description:"Products description",variable_customer_name:"Customer Name",variable_introduction_title:"Introduction Title",variable_introduction_subtitle:"Introduction Subtitle",variable_body_title:"Body Title",variable_body_subtitle:"Body Subtitle",variable_discount_value:"Discount value",variable_discount_code:"Discount code",variable_valid_until:"Valid until",variable_company_name:"Company name",variable_brand_name:"Brand name",variable_address:"Address",variable_website:"Website",variable_logo_url:"Logo URL",variable_tagline:"Tagline",variable_nav_label:"Nav link label",variable_nav_url:"Nav link URL",variable_product_name:"Product name",variable_product_description:"Product description",variable_product_image:"Product image URL",variable_product_link:"Product link",variable_product_price:"Product price",variable_product_currency:"Product currency",variable_product_old_price:"Product old price",variable_product_new_price:"Product new price",variable_product_price_display:"Product price display",variable_image_logo:"Logo",variable_image_hero_banner:"Hero banner",variable_image_footer_banner:"Footer banner",variable_image_product_image:"Product image",variable_cta_label:"CTA label",variable_cta_url:"CTA URL",button_label_variable:"Button label (variable)",button_url_variable:"Use variable",button_text:"Button text",button_label_manual:"Enter label",button_url_manual:"Enter URL",use_company_social_links:"Use company social links",use_navigation_links:"Use navigation links",tooltip_container_type:"Determines which variables and product mappings are available for this section.",tooltip_variables_static:"Insert a merge field into your content. It will be replaced when the email is sent.",tooltip_dynamic_prompt:"Describe the tone or intent; we'll suggest sample content. (Preview mode — connect an AI API for real generation.)",tooltip_write_using_ai:"When on, choose output language and write a prompt to generate variants. Requires ML/API when connected.",tooltip_write_using_ai_unavailable:"AI authoring is disabled for this editor. Enable it from the host app or API options to use Write using AI.",label_align:"Align",label_padding:"Padding",section_background_group:"SECTION BACKGROUND",section_bg_mode:"Type",section_bg_color:"Color",section_bg_image:"Image",section_bg_none:"None",section_content_area_group:"CONTENT AREA",content_area_color:"Content color",content_color_auto:"Auto",content_color_custom:"Custom",shortcuts_modal_title:"Keyboard shortcuts",shortcuts_modal_footnote:"Shortcuts are disabled while typing in text fields inside the settings panel, so you can edit URLs and copy/paste normally.",shortcut_save:"Save (handled by the host page when connected)",shortcut_undo:"Undo",shortcut_redo:"Redo",shortcut_duplicate:"Duplicate selected block",shortcut_copy_block:"Copy selected block",shortcut_paste_block:"Paste block",shortcut_delete_block:"Delete selected block",shortcut_escape:"Deselect block",shortcut_cheat_sheet:"Open this help",shortcut_delete_confirm_title:"Delete this section?",shortcut_delete_confirm_desc:"This section has content blocks inside. Delete it anyway?",section_nest_not_allowed:"Sections cannot be placed inside another section. Drop between sections in the stack.",context_duplicate:"Duplicate",context_copy:"Copy",context_cut:"Cut",context_paste:"Paste",context_delete:"Delete",context_move_up:"Move up",context_move_down:"Move down",context_save_global:"Save as Global Element",context_reset_styles:"Reset styles",topbar_back_to_templates:"Templates",topbar_exit:"Exit",topbar_breadcrumb_email:"Email",topbar_rename_template:"Rename template",topbar_untitled_template:"Untitled template",send_test:"Send test",preview:"Preview",html_email_preview:"HTML preview",html_email_preview_title:"HTML Email Preview",html_email_preview_device_aria:"HTML preview device width",html_email_preview_error:"Could not generate the HTML preview. Check the console for details.",save_template:"Save template",more_actions:"More actions",keyboard_shortcuts:"Keyboard shortcuts",high_contrast_on:"High contrast on",high_contrast_off:"High contrast off",desktop:"Desktop",mobile:"Mobile",undo:"Undo",redo:"Redo",save_state_saved:"Saved",save_state_saving:"Saving…",save_state_unsaved:"Unsaved",save_state_error:"Save failed",export_validation_open_block:"Open block",save:"Save",template_name:"Template name",save_template_title:"Save template",save_template_category:"Category",save_template_category_placeholder:"Select or type a category…",category_promotional:"Promotional",category_transactional:"Transactional",category_newsletter:"Newsletter",category_onboarding:"Onboarding",category_announcement:"Announcement",category_other:"Other",send_test_title:"Send test email",send_test_send:"Send test",send_test_recipients:"Recipients",send_test_recipients_placeholder:"name@example.com, another@example.com",send_test_recipients_hint:"Press Enter or comma to add each address.",send_test_payload:"Payload context",send_test_payload_none:"No payload",send_test_payload_profile:"Profile data",send_test_payload_event:"Event data",send_test_prefix_label:"[TEST] prefix",send_test_prefix_hint:"Prepends [TEST] to the subject line.",universal:"Universal",layers:"Layers",document:"Document",layer_one:"block",layer_many:"blocks",layer_move_up:"Move up",layer_move_down:"Move down",layer_duplicate:"Duplicate",layer_delete:"Delete",universal_saved_blocks:"Saved blocks",universal_empty_state_line_1:"No universal content yet. Click",universal_empty_state_line_2:"on any block to save it for reuse across templates.",universal_used_in_count:"used in {{count}}",compliance:"Compliance",compliance_preflight:"Pre-flight",compliance_all_clear_title:"Ready to send",compliance_all_clear_desc:"All compliance checks pass.",compliance_severity_error:"Error",compliance_severity_warning:"Warning",compliance_severity_info:"Info",compliance_tab_badge_label:"Unresolved issues: {{count}}",compliance_email_size:"Email size (approx.)",compliance_above_clip:"Above Gmail’s ~102 KB clip threshold — heavy templates may be clipped in the inbox.",compliance_below_clip:"Below Gmail clip threshold",right_panel_empty_hint:"Click any block in the canvas to edit its specific settings. Drag blocks from the left rail to add new content.",right_panel_back:"Back",layer_show:"Show",layer_hide:"Hide",save_as_universal:"Save as universal",universal_save_modal_title:"Save as universal block",universal_save_modal_subtitle:"Reusable across templates. Edits won't affect already-sent emails.",universal_save_modal_placeholder:"e.g. Beantown footer",universal_save_modal_confirm:"Save block",universal_save_success:'Saved "{{name}}" as universal block',universal_save_error:"Could not save the universal block. Check your connection and try again.",universal_delete:"Remove",universal_delete_confirm_title:"Remove saved block?",universal_delete_confirm_body:"This removes the block from your saved library. Existing emails are not changed.",universal_delete_confirm_ok:"Remove",configure_columns_title:"Configure columns",configure_columns_subtitle:"Pick a layout. Each column starts empty so you can drag blocks into it.",configure_columns_insert:"Insert section",configure_columns_hint:"click to configure layout",configure_columns_row_count:"Rows to insert:",standard_layout:"Standard",grid_layout:"6/12 Grid",grid_settings:"Grid",grid_rows_locked_hint:"Email layouts use one row of columns.",columns_layout:"Columns layout",column_sizes:"Column widths (%)",show_more:"Show more",show_less:"Show less",col:"Col",gaps:"Gaps",column_gap:"Column gap",button_variant:"Variant",full_width:"Full width",hover_bg_color:"Hover background",hover_text_color:"Hover text",text_decoration:"Decoration",shadow:"Shadow",shadow_preset:"Preset",table:"Table",table_settings:"Table settings",footer_settings:"Footer settings",compliance_approx_kb:"Approx {{n}} KB",cell_content:"Cell content",add_link_url:"URL",add_link_url_placeholder:"https://example.com",add_link_display_text:"Display text",add_link_display_text_placeholder:"Leave blank to keep selected text",add_link_display_text_empty_badge:"No text — link will use selected text",add_link_open_new_tab:"Open in new tab",align_left:"Align left",align_center:"Align center",align_right:"Align right",minimize_toolbar:"Collapse",close_text_editor:"Exit text editing",unlink_universal:"Unlink this copy",unlink_modal_title:"Edit universal block",unlink_modal_keep:"Keep linked",unlink_modal_unlink:"Unlink this copy",unlink_modal_body:"This block is linked to a universal snippet. Editing it here will affect all uses of this block everywhere.",unlink_modal_body2:"Choose “Unlink this copy” to make an independent copy that only affects this template, or “Keep linked” to edit all instances together.",custom:"Custom",custom_color:"Custom color",show_text_label:"Show label",mobile_optimization:"Mobile optimization",stack_columns_on_mobile:"Stack columns on mobile",scale_font_on_mobile:"Scale font on mobile",section_layout:"Section Layout",content_max_width:"Content max-width",content_max_width_option_full:"Full width",min_height:"Min height",border:"Border",border_style:"Border style",border_width:"Border width",border_color:"Border color",visibility:"Visibility",hidden_on_mobile:"Hide on mobile",table_structure:"Table Structure",rows:"Rows",header_row:"Header row",header_column:"Header column",cell_selector:"Cell selector",cell_content_type:"Cell content type",table_style:"Table style",cell_padding:"Cell padding",header_style:"Header style",header_background:"Header background",header_text_color:"Header text color",striped_rows:"Striped rows",stripe_color:"Stripe color",table_structure_mode:"Mode",table_mode_static:"Static",table_mode_dynamic:"Dynamic",table_dynamic_structure_hint:"Export still uses static HTML; data-driven tables may be wired in a future update.",table_add_row:"Add row",table_add_column:"Add column",table_decrease_rows:"Decrease row count",table_increase_rows:"Increase row count",table_decrease_cols:"Decrease column count",table_increase_cols:"Increase column count",table_selected_cell:"Selected: row {{row}}, col {{col}}",table_select_cell_hint:"Select a cell in the grid to edit its content.",table_cell_grid_truncated:"Showing first {{rows}} × {{cols}} cells",table_cell_text_placeholder:"Cell text…",table_align_left:"Left",table_align_center:"Center",table_align_right:"Right",footer_visible_lines:"Visible lines",footer_toggle_brand_name:"Brand name",footer_toggle_tagline:"Tagline",footer_toggle_address:"Address",footer_toggle_unsubscribe:"Unsubscribe",footer_toggle_social_row:"Social row",footer_toggle_secondary_links:"Secondary links",footer_toggle_copyright:"Copyright",footer_native_social_hint:"To edit individual platforms and icons, turn off company links above or select the social row on the canvas.",footer_company_social_managed_note:"Icons and profile URLs come from your company data (same as the live preview). Turn off the switch above to customize platforms for this template only.",footer_company_social_url_empty:"No URL in company data",footer_content_heading:"Content",footer_label_brand:"Brand",footer_unsubscribe_link_label:"Unsubscribe link label",footer_preferences_link_label:"Preferences link label",footer_preferences_url:"Preferences URL",footer_preferences_default_label:"Update preferences",footer_secondary_links_heading:"Secondary links",footer_secondary_link_text:"Link text",footer_secondary_link_url:"URL",footer_new_link_label:"New link",footer_add_link:"Add link",footer_social_platforms_heading:"Social platforms",footer_platform_label:"Platform",footer_social_profile_url:"Profile URL",footer_upload_icon:"Upload icon",footer_add_platform:"+ Add platform",footer_style_heading:"Style",footer_text_color:"Text",footer_link_color:"Link",footer_background_content:"Background",footer_column_background:"Column background",footer_align:"Align",footer_border_heading:"Border",footer_divider_above:"Divider above",footer_border_top:"Border top",footer_border_top_color:"Border top color",footer_social_instagram:"Instagram",footer_social_facebook:"Facebook",footer_social_twitter:"Twitter",footer_social_linkedin:"LinkedIn",footer_social_youtube:"YouTube",footer_social_tiktok:"TikTok",footer_social_custom_icon:"Custom icon",footer_sections:"Footer sections",footer_brand_name_placeholder:"Your brand",footer_brand_tagline_placeholder:"Your tagline",footer_address_placeholder:"123 Main St, City, Country",footer_unsubscribe_url_placeholder:"{{unsubscribe_url}}",footer_copyright_placeholder:"© {{year}} Your Company",footer_default_unsubscribe_text:"Unsubscribe",show_brand:"Brand",brand_name:"Brand name",brand_tagline:"Tagline",show_address:"Address",address:"Address text",show_unsubscribe:"Unsubscribe link",unsubscribe_text:"Link text",unsubscribe_url:"Unsubscribe URL",show_social:"Social icons",social_icons_hint:"Configure social icons in the block's content settings.",show_secondary_links:"Secondary links",show_copyright:"Copyright",copyright_text:"Copyright text",footer_style:"Footer style",padding_top:"Top padding",padding_bottom:"Bottom padding",show_divider:"Show divider",header_settings:"Header settings",discount_settings:"Discount settings",discount_show_title:"Show title",preset_discount_simple:"Discount (simple line)",style:"Style",navigation:"Navigation",link_style:"Link style",color:"Color",size:"Size",weight:"Weight",transform:"Transform",gap:"Gap",underline:"Underline",title:"Title",add_link:"Add link",font_weight_medium:"Medium",nav_text_transform_sentence:"Sentence case",nav_text_transform_uppercase:"Uppercase",nav_text_transform_capitalize:"Capitalize",placeholder_https:"https://…",brand_name_placeholder:"Brand name",logo_padding:"Logo padding",default_nav_link_label:"Link",navigation_link_placeholder_url:"#",container_variables_none_available:"No variables available for this container type.",header_layout_logo_left_nav_right:"Logo left, Navigation right",header_layout_logo_right_nav_left:"Logo right, Navigation left",header_layout_logo_center_nav_below:"Logo centered, Navigation below",header_layout_logo_only:"Logo only",header_layout_nav_only:"Navigation only",header_banner_section:"Header banner",show_header_banner:"Show header banner",footer_banner_section:"Footer banner",show_footer_banner:"Show footer banner",border_none:"None",discount_code_section:"Promo code",discount_code_background:"Code background",discount_code_corner_radius:"Code corner radius",column_preset_1_col:"1 col",column_preset_equal_2:"Equal 2",column_preset_equal_3:"Equal 3",column_preset_equal_4:"Equal 4",column_preset_1_2:"1 / 2",column_preset_2_1:"2 / 1",column_preset_1_3:"1 / 3",column_preset_3_1:"3 / 1",column_preset_2_3:"2 : 3",column_preset_3_2:"3 : 2",column_preset_1_2_1:"1 / 2 / 1",column_preset_2_1_1:"2 / 1 / 1",column_preset_1_1_2:"1 / 1 / 2",column_preset_2_4_2_4:"2-4 · 2-4",column_preset_4_2_4_2:"4-2 · 4-2"},Zo=()=>{const{language:t,languageLibraries:n}=e.useContext($e);let o={zh:Yo,en:Xo};n&&(o={...o,...n,zh:{...Yo,...o.zh||{}},en:{...Xo,...o.en||{}}});return{t:(e,n)=>{let a=(o[t]||{})[e];return n&&n instanceof Object&&Object.keys(n).forEach(e=>{a=a.replace(`{{${e}}}`,n[e])}),a||e}}};function Qo(e){return"string"!=typeof e?e:e.replace(/\u202E/g,"").replace(/\u202D/g,"").replace(/\u202A/g,"").replace(/\u202B/g,"").replace(/\u202C/g,"").replace(/\sdir\s*=\s*["']rtl["']/gi,' dir="ltr"').replace(/\sstyle\s*=\s*["']([^"']*)["']/gi,(e,t)=>{const n=String(t||"").replace(/\s*direction\s*:\s*rtl\s*;?/gi,"").trim();return n?` style="${n}"`:""})}function ea(e){if("string"!=typeof e||!e)return{masked:e||"",tokens:[]};const t=[];return{masked:e.replace(/\{\{[^{}]+\}\}/g,e=>(t.push(e),`${t.length-1}`)),tokens:t}}function ta(e,t){if("string"!=typeof e||!t.length)return e;let n=e;for(let e=t.length-1;e>=0;e--){const o=`${e}`;n=n.split(o).join(t[e])}return n}let na=0;function oa(a){if("function"!=typeof a)return;const l="undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now();if(l-na<2200)return;na=l;const i=e.createElement(n.FontAwesomeIcon,{icon:o.faInfoCircle,style:{fontSize:24,color:"#93c5fd"},"aria-hidden":!0});t.notification.open({key:"ee-text-ai-readonly-hint",icon:i,message:e.createElement("span",{style:{fontSize:15,fontWeight:700,color:"#fafafa",letterSpacing:"0.01em"}},a("text_ai_mode_manual_edit_title")),description:e.createElement("span",{style:{fontSize:13,lineHeight:1.55,color:"#e5e5e5"}},a("text_ai_mode_manual_edit_disabled")),duration:8,placement:"top",top:72,className:"ee-ai-readonly-notification",style:{width:380,maxWidth:"min(380px, calc(100vw - 32px))"}})}function aa(e){return e&&"text"===e.key&&"dynamic"===e.contentType}const la=/\{\{(\w+)\}\}/g;function ia(e,t){if(null!=e)if("string"!=typeof e){if(Array.isArray(e))e.forEach(e=>ia(e,t));else if("object"==typeof e){if(void 0!==e.$$typeof)return;Object.values(e).forEach(e=>ia(e,t))}}else(function(e){if("string"!=typeof e||0===e.length)return[];const t=[];let n;for(;null!==(n=la.exec(e));){const e=n[1];e&&t.push(e)}return la.lastIndex=0,t})(e).forEach(e=>t.add(e))}function ra(e,t,n){e&&"object"==typeof e&&(e.id&&n.has(e.id)||(e.id&&n.add(e.id),"column"!==e.key?ia(e,t):(e.children||[]).forEach(e=>{(e?.children||[]).forEach(e=>ra(e,t,n))})))}function sa(e,t,n,o){if(!e||o.has(e))return;o.add(e);const a=t[e];a&&"object"==typeof a&&("column"===a.key?(a.cells||[]).forEach(e=>{(e.childrenIds||[]).forEach(e=>sa(e,t,n,o))}):ia(a,n))}function ca(e,t){const n=new Set;if(!e||"object"!=typeof e)return n;if(Array.isArray(e.children)){const t=new Set;return ra(e,n,t),n}if(!t||"object"!=typeof t)return n;const o=new Set;return(e.cells||[]).forEach(e=>{(e.childrenIds||[]).forEach(e=>sa(e,t,n,o))}),n}const da=()=>{const t=(e,n)=>e?e.classList?.contains("text-content_editable")?null:e&&e.tagName?.toLocaleLowerCase()===n?e:t(e.parentNode,n):null,n=e.useCallback((e,t)=>e?e.classList?.contains("text-content_editable")?null:e&&e.style?.[t]?e.style[t]:n(e.parentNode,t):null,[]);return{getSelectionNode:t,getSectionStyle:n}},ua=({modifyText:t,setTextContent:a})=>{const{selectionRange:i}=e.useContext($e),{getSelectionNode:r}=da(),{t:s}=Zo(),c=e.useMemo(()=>i?r(i.commonAncestorContainer,"b"):null,[i,r]);return l.jsx("button",{className:Go("rich-text-tools-button ",c&&"rich-text-tools-button-active"),title:s("tooltip_bold"),onClick:()=>{t("bold",!1,null),a()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faBold,className:"rich-text-tools-button-icon"})})};function pa(e,t){if(!e)return!1;const n=e.commonAncestorContainer;if(!function(e){let t=e;for(t&&3===t.nodeType&&(t=t.parentElement);t;){if(t.classList?.contains("text-content_editable"))return!0;t=t.parentNode}return!1}(n))return!1;try{if(document.queryCommandState("italic"))return!0}catch{}return!("function"!=typeof t||!t(n,"i")&&!t(n,"em"))||function(e){let t=e;for(t&&3===t.nodeType&&(t=t.parentElement);t&&!t.classList?.contains("text-content_editable");){if(1===t.nodeType){const e=t.tagName?.toLowerCase();if("i"===e||"em"===e)return!0;const n=t.style?.fontStyle;if("italic"===n||"oblique"===n)return!0;try{if("undefined"!=typeof window&&window.getComputedStyle){const e=window.getComputedStyle(t).fontStyle;if("italic"===e||"oblique"===e)return!0}}catch{}}t=t.parentNode}return!1}(n)}const ma=({modifyText:t,setTextContent:a})=>{const{selectionRange:i}=e.useContext($e),{getSelectionNode:r}=da(),{t:s}=Zo(),c=pa(i,r);return l.jsx("button",{className:Go("rich-text-tools-button ",c&&"rich-text-tools-button-active"),title:s("tooltip_italic"),onClick:()=>{try{document.execCommand("styleWithCSS",!1,!0)}catch{}t("italic",!1,null),a()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faItalic,className:"rich-text-tools-button-icon"})})},ga=({modifyText:t,setTextContent:a})=>{const{selectionRange:i}=e.useContext($e),{getSelectionNode:r}=da(),{t:s}=Zo(),c=e.useMemo(()=>i?r(i.commonAncestorContainer,"u"):null,[i,r]);return l.jsx("button",{className:Go("rich-text-tools-button ",c&&"rich-text-tools-button-active"),title:s("tooltip_underline"),onClick:()=>{t("underline",!1,null),a()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faUnderline,className:"rich-text-tools-button-icon"})})},ha=({modifyText:t,setTextContent:a})=>{const{selectionRange:i}=e.useContext($e),{getSelectionNode:r}=da(),{t:s}=Zo(),c=e.useMemo(()=>i?r(i.commonAncestorContainer,"strike"):null,[i,r]);return l.jsx("button",{className:Go("rich-text-tools-button ",c&&"rich-text-tools-button-active"),title:s("tooltip_strikethrough"),onClick:()=>{t("strikethrough",!1,null),a()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faStrikethrough,className:"rich-text-tools-button-icon"})})},ba=({modifyText:t,setTextContent:a})=>{const{selectionRange:i}=e.useContext($e),{getSelectionNode:r}=da(),{t:s}=Zo(),c=e.useMemo(()=>i?r(i.commonAncestorContainer,"ol"):null,[i,r]);return l.jsx("button",{className:Go("rich-text-tools-button ",c&&"rich-text-tools-button-active"),title:s("tooltip_ordered_list"),onClick:()=>{t("insertOrderedList",!1,null),a()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faListOl,className:"rich-text-tools-button-icon"})})},ya=({modifyText:t,setTextContent:a})=>{const{selectionRange:i}=e.useContext($e),{getSelectionNode:r}=da(),{t:s}=Zo(),c=e.useMemo(()=>i?r(i.commonAncestorContainer,"ul"):null,[i,r]);return l.jsx("button",{className:Go("rich-text-tools-button ",c&&"rich-text-tools-button-active"),title:s("tooltip_unordered_list"),onClick:()=>{t("insertUnorderedList",!1,null),a()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faListUl,className:"rich-text-tools-button-icon"})})},fa=({modifyText:a,setTextContent:i})=>{const{selectionRange:r}=e.useContext($e),{t:s}=Zo(),{getSelectionNode:c}=da(),[d,u]=e.useState(!1),[p,m]=e.useState({value:"",range:null}),[g,h]=e.useState(""),[b,y]=e.useState(!0),f=e.useRef(null),_=e.useMemo(()=>r?c(r.commonAncestorContainer,"a"):null,[r,c]),k=e.useCallback(()=>{u(!1),m({value:"",range:null}),h(""),y(!0)},[]),x=e.useCallback(()=>{const{range:e,value:t,rangeIsLink:n}=p;if(e){if(n){const n=e.commonAncestorContainer,o=1===n.nodeType&&"A"===n.nodeName?n:n.parentNode&&"A"===n.parentNode.nodeName?n.parentNode:null;o&&(o.setAttribute("href",t),o.target=b?"_blank":"_self",g.trim()&&(o.textContent=g.trim()))}else{const n=document.createElement("a");if(n.target=b?"_blank":"_self",n.setAttribute("href",t),g.trim())n.textContent=g.trim(),e.deleteContents(),e.insertNode(n);else try{e.surroundContents(n)}catch{return void k()}}i(),k()}else k()},[p,g,b,i,k]);return l.jsxs(l.Fragment,{children:[l.jsx("button",{className:Go("rich-text-tools-button ",_&&"rich-text-tools-button-active"),title:s("tooltip_link"),onClick:e=>{let t=window.getSelection(),n=t.getRangeAt(0);const o=n.commonAncestorContainer.parentNode,a="A"===o.nodeName,l={...p,range:n};let r="",s=!0;if(a){l.rangeIsLink=!0;const e=o.getAttribute("href"),t=null!=e?String(e).trim():"";l.value=""!==t?t:String(o.href||"").trim(),r=o.textContent||"",s="_self"!==o.target}else{r=t.toString()}const c=e?.currentTarget?.closest?.(".email-editor");c&&(f.current=c),m(l),h(r),y(s),u(!0),i()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faLink,className:"rich-text-tools-button-icon"})}),l.jsx("button",{className:Go("rich-text-tools-button"),title:s("tooltip_remove_link"),onClick:()=>{a("unlink",!1,null),i()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faUnlink,className:"rich-text-tools-button-icon"})}),l.jsx(t.Modal,{title:s("add_link_modal_title"),open:d,zIndex:1100,getContainer:()=>"undefined"==typeof document?null:f.current||document.querySelector(".email-editor")||document.body,onOk:x,onCancel:k,okText:s("confirm"),cancelText:s("cancel"),wrapClassName:"ee-modal-dark",children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[l.jsxs("div",{children:[l.jsx("div",{style:{marginBottom:4,fontSize:12,fontWeight:500},children:s("add_link_url")||"URL"}),l.jsx(t.Input,{value:p.value??"",placeholder:s("add_link_url_placeholder")||s("link_url_placeholder")||"https://example.com",onChange:e=>m({...p,value:e.target.value})})]}),l.jsxs("div",{children:[l.jsxs("div",{style:{marginBottom:4,display:"flex",alignItems:"center",flexWrap:"wrap",gap:8},children:[l.jsx("span",{style:{fontSize:12,fontWeight:500},children:s("add_link_display_text")||"Display text"}),g.trim()?null:l.jsx(t.Badge,{status:"warning",text:s("add_link_display_text_empty_badge"),className:"ee-link-modal-display-text-badge"})]}),l.jsx(t.Input,{value:g,placeholder:s("add_link_display_text_placeholder")||"Leave blank to keep selected text",onChange:e=>h(e.target.value)})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[l.jsx("span",{style:{fontSize:13},children:s("add_link_open_new_tab")||"Open in new tab"}),l.jsx(t.Switch,{className:"ee-settings-switch",checked:b,onChange:y})]})]})})]})},_a=({id:i,textBlock:r,syncTextFromDom:s})=>{const{blockMap:c,rootOrder:d,templateData:u}=e.useContext($e),{t:p}=Zo(),m=e.useRef(null),[g,h]=e.useState(!1),[b,y]=e.useState(!1),f=e.useMemo(()=>{const e=oe(c,d,i),t=e?.[0]??null;return{containerBlock:t?.containerBlock??null,containerType:t?.containerType??"none",cellIndex:t?.cellIndex??0,lineage:e}},[c,d,i]),_=e.useMemo(()=>{const e=f?.cellIndex??0,t=f?.containerBlock;return{columnIndex:e,columnProduct:t?.columnProducts?.[e]??null}},[f]),k=e.useMemo(()=>(f?.lineage??[]).slice(1).filter(e=>e?.containerType&&"none"!==e.containerType).map(e=>{const t=e.cellIndex??0;return{containerType:e.containerType,context:{columnIndex:t,columnProduct:e.containerBlock?.columnProducts?.[t]??null}}}),[f?.lineage]),x=e.useMemo(()=>Ht(0,f?.containerType??"none",u,_,k),[f?.containerType,u,_,k]),v=e.useMemo(()=>ca(f?.containerBlock,c),[f?.containerBlock,c]),w=e.useMemo(()=>x.filter(e=>"image"!==e.type&&!v.has(e.variableKey??e.key)),[x,v]),S=e.useCallback(()=>{if(!m.current)return;const e=m.current.parentNode?.getBoundingClientRect(),t=document.querySelector("#preview");if(!e||!t)return;const n=t.getBoundingClientRect();e.top-190<0?(m.current.style.bottom="auto",m.current.style.top="110%"):(m.current.style.bottom="110%",m.current.style.top="auto"),e.left+420>n.left+n.width?(m.current.style.left="auto",m.current.style.right="0"):(m.current.style.left="0",m.current.style.right="auto")},[]);e.useEffect(()=>{S()},[S]),e.useEffect(()=>{const e=()=>{const e="undefined"!=typeof window&&window.getSelection(),t=m.current;if(!e||0===e.rangeCount||!t)return void S();const n=e.getRangeAt(0),o=r?.current;if(!o||!o.contains(n.commonAncestorContainer)||e.isCollapsed)return void S();const a=n.getBoundingClientRect();if(!a||0===a.width&&0===a.height)return void S();const l=t.parentNode;if(!l)return;const i=l.getBoundingClientRect(),s=document.querySelector("#preview"),c=s?s.getBoundingClientRect():null;let d=a.top-i.top-46-8;a.top-60<0&&(d=a.bottom-i.top+8);let u=a.left-i.left+a.width/2-210;if(c){const e=c.left-i.left+8,t=c.right-i.left-8-420;u=Math.max(e,Math.min(u,t))}t.style.top=`${d}px`,t.style.bottom="auto",t.style.left=`${u}px`,t.style.right="auto"};return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[S,r]);const j=(e,t,n)=>{document.execCommand(e,t,n)},C=()=>{"function"!=typeof s?r?.current&&("undefined"!=typeof InputEvent&&InputEvent?r.current.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0})):r.current.dispatchEvent(new Event("input",{bubbles:!0}))):s()};return l.jsx("div",{className:"rich-text",ref:m,onClick:e=>{e.preventDefault(),e.stopPropagation()},children:l.jsx(a.motion.div,{className:"rich-text-tools",initial:{scale:0,x:0},animate:{scale:1,x:0},style:{width:g?"auto":"max-content",maxWidth:"min(100%, 520px)"},children:l.jsxs("div",{className:"rich-text-tools-body items-center",children:[!g&&l.jsxs(l.Fragment,{children:[l.jsx(ua,{modifyText:j,setTextContent:C}),l.jsx(ma,{modifyText:j,setTextContent:C}),l.jsx(ga,{modifyText:j,setTextContent:C}),l.jsx(ha,{modifyText:j,setTextContent:C}),l.jsx(ba,{modifyText:j,setTextContent:C}),l.jsx(ya,{modifyText:j,setTextContent:C}),l.jsx(fa,{modifyText:j,setTextContent:C}),l.jsx(t.Popover,{zIndex:540,trigger:"click",open:b,onOpenChange:y,overlayClassName:"ee-rich-text-variables-popover",getPopupContainer:()=>document.querySelector("#preview")||document.body,content:l.jsxs("div",{className:"ee-rich-text-variables-menu",children:[l.jsx("div",{className:"ee-rich-text-variables-header",children:p("variables")}),w.map(e=>l.jsx("div",{className:"ee-rich-text-variables-item",onMouseDown:t=>{t.preventDefault(),(e=>{if(!r?.current||!e)return;const t=window.getSelection();let n=null;if(t?.rangeCount){const e=t.getRangeAt(0);r.current.contains(e.commonAncestorContainer)&&(n=e)}n||(n=document.createRange(),n.selectNodeContents(r.current),n.collapse(!1)),n.deleteContents();const o=document.createTextNode(e);n.insertNode(o),n.setStartAfter(o),n.collapse(!0),t&&(t.removeAllRanges(),t.addRange(n)),C(),y(!1)})(e.value)},children:e.labelKey?p(e.labelKey):e.label||e.value},`variables-${e.value}`))]}),children:l.jsx("button",{className:"rich-text-tools-button",title:p("insert_merge_field"),onMouseDown:e=>e.preventDefault(),children:l.jsx("span",{className:"rich-text-tools-button-icon",style:{color:"#fff",fontFamily:"monospace",fontWeight:700,fontSize:13,lineHeight:1},children:"{}"})})})]}),l.jsx("button",{className:"rich-text-tools-button",title:p("minimize_toolbar")||"Collapse",onClick:()=>h(!g),children:l.jsx(n.FontAwesomeIcon,{icon:g?o.faExpandAlt:o.faCompressAlt,className:"rich-text-tools-button-icon"})})]})})})},ka=({id:t,blockItem:n,displayContent:o})=>{const{currentItem:a,previewMode:i,blockMap:r,rootOrder:s,setBlocks:c,setCurrentItem:d,isDragStart:u,templateData:p,registerRichTextFlush:m,actionType:g}=e.useContext($e),{t:h}=Zo(),b=e.useRef(null),y=e.useRef(null),f=e.useRef(!1),_=e.useRef(!1),k="undo"===g||"redo"===g||"string"==typeof g&&g.startsWith("set_history"),x=a&&a.id===(t??n?.id),v="text"===n?.key&&"dynamic"===n?.contentType,w=x&&!v,S="desktop"===i?n.styles?.desktop??{}:{...n.styles?.desktop??{},...n.styles?.mobile??{}},j=S.linkColor||"#2faade",{linkColor:C,...N}=S,I={...N,direction:"ltr",unicodeBidi:"isolate","--ee-rich-text-link-color":j},A=e.useRef(!1),L=null!=o?o:n.text||"",T=e.useMemo(()=>{const e=oe(r,s,t??n?.id),o=e?.[0]??null;return{containerBlock:o?.containerBlock??null,containerType:o?.containerType??"none",cellIndex:o?.cellIndex??0,lineage:e}},[r,s,t,n?.id]),B=e.useMemo(()=>{const e=T?.cellIndex??0,t=T?.containerBlock;return{columnIndex:e,columnProduct:t?.columnProducts?.[e]??null}},[T]),$=e.useMemo(()=>(T?.lineage??[]).slice(1).filter(e=>e?.containerType&&"none"!==e.containerType).map(e=>{const t=e.cellIndex??0;return{containerType:e.containerType,context:{columnIndex:t,columnProduct:e.containerBlock?.columnProducts?.[t]??null}}}),[T?.lineage]),R=e.useMemo(()=>Ht(0,T?.containerType??"none",p,B,$).map(e=>{return t=e.value,n=e.pasteValue,{token:t,pasteValue:String(n||"")};var t,n}).filter(e=>e.token&&e.pasteValue&&""!==e.pasteValue.trim()&&!e.pasteValue.includes("{{")&&e.pasteValue!==e.token).sort((e,t)=>t.pasteValue.length-e.pasteValue.length),[p,B,T?.containerType,$]),P=e.useCallback(e=>{if(!e||!R.length||"undefined"==typeof document)return e;const t=document.createElement("div");t.innerHTML=e;const n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let o=n.nextNode();for(;o;){const e=o.nodeValue||"",{masked:t,tokens:a}=ea(e);let l=t;R.forEach(({token:e,pasteValue:t})=>{t&&l.includes(t)&&(l=l.split(t).join(e))}),o.nodeValue=ta(l,a),o=n.nextNode()}return t.innerHTML},[R]);e.useEffect(()=>{f.current=w},[w]);const M=e.useCallback(()=>{null!=y.current&&(clearTimeout(y.current),y.current=null)},[]);e.useEffect(()=>()=>M(),[M]),e.useEffect(()=>{if(w&&b.current){const e=Qo(L);if(A.current){const t=b.current,n=Qo(t.innerHTML||"");if("undefined"!=typeof document&&document.activeElement===t&&e!==n&&!k)return void(A.current=!0);e!==n&&(t.innerHTML=e)}else b.current.innerHTML=e,b.current.focus();A.current=!0}else A.current=!1},[w,t,L,k]);const F=e.useCallback(e=>{if(!e)return;const l=t??n?.id,i=r[l]||{},{textToStore:u,unchangedFromResolved:p}=function({rawHtml:e,displayContent:t,blockItemText:n,oldBlockKey:o,blockItemKey:a,restoreVariableTokensInHtml:l}){const i=Qo(e),r=null!=t?Qo(String(t)):null,s=!/<\s*a\b/i.test(i)&&null!=r&&i===r;let c=s?n:i;return"text"===(o??a)&&"function"==typeof l&&(c=l(c)),{textToStore:c,unchangedFromResolved:s}}({rawHtml:e.innerHTML,displayContent:o,blockItemText:n.text,oldBlockKey:i.key,blockItemKey:n.key,restoreVariableTokensInHtml:P}),m=p?i.selectedVariableKey:void 0;if((i.text??"")===(u??"")&&String(i.selectedVariableKey??"")===String(m??""))return;const g={...i,text:u,selectedVariableKey:m},h={...r,[l]:g};c(h,s,`edit_${Date.now()}`),d({...a,data:g})},[t,n?.id,n?.key,n?.text,r,s,c,d,a,o,P]),U=e.useCallback(()=>{F(b.current)},[F]),D=e.useCallback(()=>{M(),y.current=setTimeout(()=>{y.current=null,f.current&&b.current&&!_.current&&F(b.current)},380)},[M,F]),E=e.useCallback(()=>{M(),U()},[M,U]);e.useEffect(()=>{if(w&&"function"==typeof m)return m(U)},[w,m,U]);const z=e.useCallback(e=>{if("number"==typeof e.button&&0!==e.button)return;if(!x||!v)return;oa(h);const t=b.current;if(t&&"function"==typeof t.focus)try{t.focus({preventScroll:!0})}catch{t.focus()}},[x,v,h]),O=e.useCallback(e=>{if(!x||!v)return;if(e.metaKey||e.ctrlKey||e.altKey)return;if("Tab"===e.key||"Escape"===e.key)return;if(e.isComposing)return;const t=e.key;1!==t.length&&"Enter"!==t&&"Backspace"!==t&&"Delete"!==t||(e.preventDefault(),oa(h))},[x,v,h]),W=e.useCallback(e=>{(e=>{e.preventDefault(),e.stopPropagation()})(e)},[]),H=Qo(L),K=t??n?.id;return l.jsxs("div",{className:"relative",dir:"ltr",style:{direction:"ltr",unicodeBidi:"isolate"},children:[w&&n&&!u&&l.jsx(_a,{textBlock:b,id:K,syncTextFromDom:U}),l.jsx("div",{className:Go(w&&"text-block","text-content_editable"),tabIndex:x&&v?0:void 0,onPointerDownCapture:z,onKeyDownCapture:O,onClick:W,onInput:w?()=>{_.current||D()}:void 0,onBlur:E,onCompositionStart:()=>{_.current=!0,M()},onCompositionEnd:()=>{_.current=!1,M(),U()},style:I,dir:"ltr",contentEditable:w,suppressContentEditableWarning:!0,ref:b,dangerouslySetInnerHTML:w?void 0:{__html:H}})]})},xa=t=>{const{id:n,blockItem:o}=t,{currentItem:a,previewMode:i,templateData:r,blockMap:s,rootOrder:c}=e.useContext($e),d="desktop"===i?o.styles?.desktop??{}:{...o.styles?.desktop??{},...o.styles?.mobile??{}},u=a&&a.id===n,p=e.useMemo(()=>ae(s,c,n),[s,c,n]),m=e.useMemo(()=>Lt(o.text,r,p),[o.text,r,p]),g=u?o.text||"":m,h=null!=d.linkColor&&""!==String(d.linkColor).trim()?String(d.linkColor).trim():"#2faade",b=e.useMemo(()=>Jt(g,h,{useImportant:!1}),[g,h]),y=p?.containerBlock,f="footer"===y?.containerType,_=(m||"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();if(f&&(""===_||"{{Address}}"===_||"{{Tagline}}"===_))return null;const k=o.type&&/^h[1-4]$/.test(o.type)?o.type:"div";return u?l.jsx(ka,{...t,blockItem:o}):e.createElement(k,{style:{...d,direction:"ltr",unicodeBidi:"isolate"},dir:"ltr",dangerouslySetInnerHTML:{__html:b}})};const va=t=>{const{blockItem:n,id:o}=t,{currentItem:a,previewMode:i,templateData:r,blockMap:s,rootOrder:c}=e.useContext($e),d=e.useMemo(()=>ae(s,c,o),[o,s,c]),u=e.useMemo(()=>{const e=n.text??"",t=e.match(/\{\{(\w+)\}\}/),o=n.labelVariable?n.labelVariable.replace(/^\{\{|\}\}$/g,"").trim():t?t[1]:void 0;if(!r||!o)return e;const a=Ft(r,o,d);return null==a||String(a).startsWith("{{")?e:String(a)},[n.text,n.labelVariable,r,d]),p=a&&a.id===o,m=e.useMemo(()=>{const e="desktop"===i?n.styles?.desktop??{}:{...n.styles?.desktop??{},...n.styles?.mobile??{}};let t=e.backgroundColor;return!function(e,t,n,o){const a=oe(t,n,o).find(e=>"product"===e?.containerType);if(!a?.containerBlock)return!1;if(!function(e,t){if(!t||"column"!==t.key||"product"!==t.containerType)return!1;if("additional"===t.productRole)return!1;if("image_left"===t.mainProductLayout)return!0;if("image_stacked"===t.mainProductLayout)return!1;const n=t.cells||[],o=n[0]?.childrenIds?.[0],a=e[o];return"column"===a?.key&&"2-3"===a?.type}(t,a.containerBlock))return!1;const l=e.styles?.desktop?.backgroundColor;return null==l||""===String(l).trim()||Bn(l)===Bn(Tn)}(n,s,c,o)?(null==t||""===String(t).trim()||$n(t))&&(t=Rn(r)):t=Rn(r),{...e,backgroundColor:t}},[n,s,o,i,c,r]),g="desktop"===i?n.contentStyles?.desktop:{...n.contentStyles?.desktop,...n.contentStyles?.mobile},h=e.useMemo(()=>l.jsx(ka,{...t,blockItem:{...n,styles:{...n.styles,desktop:{...n.styles?.desktop,backgroundColor:m.backgroundColor}}},displayContent:u}),[n,u,m.backgroundColor]);return l.jsx("div",{style:{...g},children:p?h:l.jsx("div",{style:{...m,textAlign:"center"},dangerouslySetInnerHTML:{__html:u}})})},wa=({blockItem:t})=>{const{previewMode:n}=e.useContext($e),o="desktop"===n?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},a="desktop"===n?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile};return l.jsx("div",{className:"relative",children:l.jsx("div",{style:{...a},children:l.jsx("div",{style:{...o}})})})},Sa=({blockItem:t})=>{const{previewMode:n}=e.useContext($e),o="desktop"===n?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},a="desktop"===n?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile};return l.jsx("div",{className:"relative",style:{...a},children:l.jsx("div",{style:{width:"100%",height:"number"==typeof o.height?`${o.height}px`:o.height||"16px",display:o.display||"block"}})})},ja=({blockItem:t})=>{const{previewMode:n}=e.useContext($e),{list:o=[],separator:a=" | "}=t,i=o,r=t.mobileLayout??"stack",s="mobile"===n&&"stack"===r,c=y("desktop"===n?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}}),d="desktop"===n?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile},u=d&&"object"==typeof d?{...d}:{},p=u.textAlign??"center";delete u.textAlign;const m=t.linkGapPx,g="number"==typeof m&&Number.isFinite(m)&&m>=0?m:0,h=Boolean(t.linkUnderline),b=c.fontWeight,f="normal"===b||"bold"===b?b:null!=b?String(b):"400",_={fontSize:null!=c.fontSize?`${c.fontSize}px`:"14px",fontFamily:c.fontFamily||"sans-serif",color:c.linkColor||c.color||"#2faade",fontWeight:f,letterSpacing:null!=c.letterSpacing?`${c.letterSpacing}px`:"0px",textDecoration:h?"underline":"none",textTransform:c.textTransform??"none",display:"inline-block"},k={fontSize:null!=c.fontSize?`${c.fontSize}px`:"14px",color:c.color||"#333",display:"inline-block",verticalAlign:"middle",whiteSpace:"pre"},x=g>0?{...k,marginLeft:g,marginRight:g}:{...k,paddingLeft:4,paddingRight:4},v="left"===p?"flex-start":"right"===p?"flex-end":"center",w=s?{...u,display:"flex",flexDirection:"column",flexWrap:"nowrap",alignItems:v,...g>0?{gap:g}:{},width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box"}:{...u,display:"block",textAlign:"justify"===p?"justify":p,width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box"},S=(e,t)=>l.jsx("a",{href:e.url?e.url.startsWith("http")?e.url:`https://${e.url}`:"#",target:"_blank"===e.target?"_blank":"_self",rel:"_blank"===e.target?"noopener noreferrer":void 0,style:_,onClick:e=>e.preventDefault(),children:e.label||"Link"},`${t}-link`);return l.jsx("div",{className:"relative ee-menu-block-root",children:l.jsx("div",{className:"ee-menu-block-inner",style:w,children:i.flatMap((e,t)=>{if(s)return[S(e,t)];const n=[];return t>0&&n.push(l.jsx("span",{style:x,children:a},`${t}-sep`)),n.push(S(e,t)),n})})})};function Ca(e,t,n){return Math.min(n,Math.max(t,e))}function Na(e,t,n,o){const a=(e?.[t]??e?.desktop??{})[n];return"number"==typeof a&&Number.isFinite(a)?a:o}function Ia({blockMap:e,id:t,previewMode:n,widthPx:o,heightPx:a,marginLeftPx:l,marginTopPx:i}){const r=e[t];if(!r||"image"!==r.key)return e;const s=B(r);if(s.styles||(s.styles={desktop:{},mobile:{}}),s.styles[n]||(s.styles[n]={}),s.contentStyles||(s.contentStyles={desktop:{},mobile:{}}),s.contentStyles[n]||(s.contentStyles[n]={...s.contentStyles.desktop??{}}),null!=o){const e=`${Math.round(o)}px`;s.styles[n].width=e,"desktop"!==n&&(s.styles.desktop.width=e)}if(null!=a){const e=`${Math.round(a)}px`;s.styles[n].height=e,"desktop"!==n&&(s.styles.desktop.height=e)}if(null!=l){const e=Math.round(l);s.contentStyles[n].marginLeft=e,"desktop"!==n&&(s.contentStyles.desktop.marginLeft=e)}if(null!=i){const e=Math.round(i);s.contentStyles[n].marginTop=e,"desktop"!==n&&(s.contentStyles.desktop.marginTop=e)}return{...e,[t]:s}}function Aa({active:t,hostRef:n,blockId:o,previewMode:a,getEditorSnapshot:i}){const r=e.useRef(null),s=e.useRef(null),c=e.useRef(i);e.useEffect(()=>{c.current=i},[i]);const d=e.useCallback(e=>l=>{if(!t||!n.current)return;l.stopPropagation(),l.preventDefault(),s.current=null;const i=n.current,d=i.parentElement;if(!d)return;const u=d.getBoundingClientRect(),p=i.getBoundingClientRect(),m=i.querySelector("img"),g=m?.getBoundingClientRect()??p,h=u.width>0?u.width:600,b=c.current().blockMap[o],y=b?.contentStyles??{},f=Na(y,a,"marginLeft",p.left-u.left),_=Na(y,a,"marginTop",g.top-u.top),k=p.width,x=g.height;r.current={edge:e,startX:l.clientX,startY:l.clientY,startMl:f,startMt:_,startW:k,startH:x,parentW:h};const v=e=>{const t=r.current;if(!t||!n.current)return;const l=c.current(),{blockMap:i,rootOrder:d,setBlocks:u,setCurrentItem:p,currentItem:m}=l,g=s.current||i,h=e.clientX-t.startX,b=e.clientY-t.startY,y=Math.max(24,.05*t.parentW),f=t.parentW-t.startMl;if("e"===t.edge){const e=Ca(t.startW+h,y,f),n=Ia({blockMap:g,id:o,previewMode:a,widthPx:e,heightPx:null,marginTopPx:null});u(n,d,{skipUndo:!0}),m?.id===o&&p({...m,data:n[o]}),s.current=n}else if("w"===t.edge){const e=Ca(t.startMl+h,0,t.parentW-y),n=Ca(t.startMl+t.startW-e,y,t.parentW-e),l=Ia({blockMap:g,id:o,previewMode:a,widthPx:n,marginLeftPx:e,heightPx:null,marginTopPx:null});u(l,d,{skipUndo:!0}),m?.id===o&&p({...m,data:l[o]}),s.current=l}else if("s"===t.edge){const e=Ca(t.startH+b,24,2e3),n=Ia({blockMap:g,id:o,previewMode:a,widthPx:null,heightPx:e,marginLeftPx:null,marginTopPx:null});u(n,d,{skipUndo:!0}),m?.id===o&&p({...m,data:n[o]}),s.current=n}else if("n"===t.edge){const e=Ca(t.startMt+b,0,800),n=Ca(t.startH-b,24,2e3),l=Ia({blockMap:g,id:o,previewMode:a,widthPx:null,heightPx:n,marginLeftPx:null,marginTopPx:e});u(l,d,{skipUndo:!0}),m?.id===o&&p({...m,data:l[o]}),s.current=l}},w=()=>{r.current=null,document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",w);const e=c.current(),{rootOrder:t,setBlocks:n}=e,o=s.current||e.blockMap;s.current=null,n({...o},t,{skipUndo:!1})};document.addEventListener("pointermove",v),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",w)},[t,n,o,a]);if(!t)return null;const u=(e,t,n,o)=>l.jsx("button",{type:"button",className:`ee-image-resize-handle ${t}`,"aria-label":o,tabIndex:-1,style:{cursor:n,touchAction:"none"},onPointerDown:d(e)});return l.jsxs(l.Fragment,{children:[u("n","ee-image-resize-handle--n","n-resize","Resize from top edge"),u("s","ee-image-resize-handle--s","s-resize","Resize from bottom edge"),u("e","ee-image-resize-handle--e","e-resize","Resize from right edge"),u("w","ee-image-resize-handle--w","w-resize","Resize from left edge")]})}function La(e){return null!=e&&"string"==typeof e&&/<[a-zA-Z!/?]/.test(e.trim())}function Ta(e){switch(e){case"h1":case"h2":case"h3":return 700;case"subtitle":case"eyebrow":return 600;default:return 400}}const Ba=({blockItem:t,id:a})=>{const{previewMode:i,templateData:r,blockMap:s,rootOrder:c,bodySettings:d,currentItem:p,setBlocks:m,setCurrentItem:g}=e.useContext($e),h=s[a]||t,{src:b,alt:y,linkURL:f}=h,_="desktop"===i?h.styles?.desktop??{}:{...h.styles?.desktop??{},...h.styles?.mobile??{}},{outerContentStyles:k,hostMarginStyle:x}=e.useMemo(()=>{const e="desktop"===i?h.contentStyles?.desktop??{}:{...h.contentStyles?.desktop,...h.contentStyles?.mobile},{marginLeft:t,marginTop:n,...o}=e,a={};return null!=t&&(a.marginLeft=t),null!=n&&(a.marginTop=n),{outerContentStyles:o,hostMarginStyle:a}},[h.contentStyles,i]),v=e.useRef(null),w=e.useCallback(()=>({blockMap:s,rootOrder:c,setBlocks:m,setCurrentItem:g,currentItem:p,previewMode:i}),[s,c,m,g,p,i]),S=e.useMemo(()=>{const e="string"==typeof b&&/^\{\{\w+\}\}$/.test(b.trim())?b.trim():"";if(b&&!e)return b;if(!r||!e)return b||"";const t=ae(s,c,a),n=e.replace(/^\{\{|\}\}$/g,"").trim(),o=Ft(r,n,t);return o&&!o.startsWith("{{")?o:b||""},[b,r,s,c,a]),j="string"==typeof b&&/^\{\{\w+\}\}$/.test(b.trim())?b.trim():"",C=!S||S.startsWith("{{"),N=y||"Image",I=_.width,A=I&&"auto"!==I,L="string"==typeof f?f.trim():"",T=""===L?"":u(L,{allowMailtoTel:!0})??"",B=Boolean(h.textOverlayEnabled)&&function(e){const t=Array.isArray(e.overlayItems)?e.overlayItems:[];return t.length>0?t.some(e=>""!==String(e?.text??"").trim()):""!==String(e.overlayText??"").trim()}(h)&&S&&!C,$=()=>{const e=String(h.overlayText??"").replace(/<script\b[\s\S]*?<\/script>/gi,"");return La(e)?l.jsx("span",{className:"ee-image-overlay-caption-html",dangerouslySetInnerHTML:{__html:e}}):l.jsx("span",{className:"ee-image-overlay-caption-plain",style:{whiteSpace:"pre-wrap"},children:e})},R=()=>{const e=Array.isArray(h.overlayItems)?h.overlayItems:[],t="number"==typeof h.overlayItemGap?h.overlayItemGap:8,n="number"==typeof h.overlayMaxWidth?h.overlayMaxWidth:100,o="number"==typeof h.overlayPadding?h.overlayPadding:16,a=h.textShadowEnabled?"0 1px 3px rgba(0,0,0,0.55)":"none",i=d?.styles?.fontFamily??"sans-serif";return l.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:t,width:`${n}%`,maxWidth:"100%",padding:o,boxSizing:"border-box"},children:e.map((e,t)=>{const n=String(e?.text??"").replace(/<script\b[\s\S]*?<\/script>/gi,""),o="number"==typeof e?.fontSize?e.fontSize:16,r=e?.color||"#ffffff",s=null!=e?.fontFamily&&""!==String(e.fontFamily).trim()?String(e.fontFamily).trim():i;return l.jsx("div",{style:{color:r,fontSize:o,fontFamily:s,fontWeight:Ta(e?.kind),lineHeight:1.35,textShadow:a,wordBreak:"break-word"},children:La(n)?l.jsx("span",{className:"ee-image-overlay-caption-html",dangerouslySetInnerHTML:{__html:n}}):l.jsx("span",{style:{whiteSpace:"pre-wrap"},children:n})},t)})})},P=B?(()=>{const e=fn(yn(h.overlayPosition)),t=_.borderRadius,n="number"==typeof h.overlayMaxWidth?h.overlayMaxWidth:100,o="number"==typeof h.overlayPadding?h.overlayPadding:16,a={position:"relative",display:A?"inline-block":"block",width:A?I:"100%",maxWidth:"100%",borderRadius:t,overflow:"hidden",lineHeight:0,verticalAlign:"top"},i=Array.isArray(h.overlayItems)?h.overlayItems:[],r=i.length>0&&i.some(e=>""!==String(e?.text??"").trim()),s={...e,position:"absolute",pointerEvents:"none",zIndex:2,maxWidth:`${n}%`,boxSizing:"border-box",...r?{}:{color:h.overlayTextColor||"#ffffff",fontSize:"number"==typeof h.overlayFontSize?h.overlayFontSize:18,fontWeight:600,lineHeight:1.35,padding:o,textShadow:h.textShadowEnabled?"0 1px 3px rgba(0,0,0,0.55)":void 0,...h.overlayBoxBackground?{backgroundColor:h.overlayBoxBackground,padding:`${Math.max(8,o/2)}px 12px`}:{}}},c=l.jsx("img",{src:S,style:{..._,width:"100%",maxWidth:"100%",display:"block",borderRadius:0,verticalAlign:"top"},alt:N});return l.jsxs("div",{className:"ee-image-overlay-host",style:a,children:[h.scrimEnabled?l.jsx("div",{style:{position:"absolute",left:0,right:0,top:0,bottom:0,pointerEvents:"none",zIndex:1,background:"linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0.12), transparent 55%)"},"aria-hidden":!0}):null,l.jsx("div",{style:{position:"relative",zIndex:0},children:c}),l.jsx("div",{className:"ee-image-overlay-caption",style:s,children:r?R():$()})]})})():S&&!C?A?l.jsx("div",{style:{width:I,display:"inline-block"},children:l.jsx("img",{src:S,style:{..._,width:"100%",maxWidth:"100%"},alt:N,className:"inline-block"})}):l.jsx("img",{src:S,style:_,alt:N,className:"inline-block"}):l.jsx("div",{className:"empty-image",style:{..._,width:"auto"===_.width?"100%":_.width},title:C&&j?j:void 0,children:C&&j?l.jsx("span",{className:"empty-image-variable-label",children:j}):l.jsx(n.FontAwesomeIcon,{icon:o.faImage,className:"empty-image-icon"})}),M=qt(h)&&T&&S&&!C?l.jsx("a",{href:T,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",display:"inline-block",maxWidth:"100%"},onClick:e=>e.preventDefault(),children:P}):P,F=p?.id===a;return l.jsx("div",{className:"relative",children:l.jsx("div",{style:{...k||{}},children:l.jsxs("div",{ref:v,style:x,className:Go("ee-image-canvas-host",F&&"ee-image-canvas-host--selected"),children:[M,l.jsx(Aa,{active:F,hostRef:v,blockId:a,previewMode:i,getEditorSnapshot:w})]})})})},$a=({blockItem:t})=>{const{src:a,alt:i,linkURL:r}=t,{previewMode:s}=e.useContext($e),c="desktop"===s?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},d="desktop"===s?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile},p=a?l.jsx("img",{src:a,style:{...c,width:c.width??64,height:c.width??64,objectFit:"cover",borderRadius:c.borderRadius??"50%"},alt:i||"Avatar",className:"inline-block"}):l.jsx("div",{className:"empty-avatar",style:{width:c.width??64,height:c.width??64,borderRadius:c.borderRadius??"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--ee-border, #eee)"},children:l.jsx(n.FontAwesomeIcon,{icon:o.faUser,style:{fontSize:"24px",color:"#999"}})}),m={...d,width:"100%"},g=null!=r&&String(r).trim()?u(r,{allowMailtoTel:!0}):null;return l.jsx("div",{className:"relative",children:l.jsx("div",{style:m,children:g?l.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-block"},children:p}):p})})},Ra=({blockItem:t})=>{const{previewMode:n}=e.useContext($e),{t:o}=Zo(),{list:a=[]}=t,i=I(t),r=b(t?.iconColor),s="desktop"===n?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},c=y(s),d="desktop"===n?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile},p=Boolean(t.showTextLabel),m=s.color||"#525252",h=Math.max(11,Math.round(.58*i)),f=Array.isArray(a)?a.filter(Boolean):[];return 0===f.length?null:l.jsx("div",{className:"relative",children:l.jsx("div",{style:w(d),children:f.map((e,t)=>{const{image:n,title:a,linkURL:s}=e,d=g(e)?o("social_platform_x_alt"):a,b=g(e)?o("social_platform_x"):a,{src:y,style:f}=L(e,r,i),_=l.jsx("img",{src:y||n,alt:d,style:f}),k=u(s,{allowMailtoTel:!1}),x={display:"inline-flex",alignItems:"center",gap:p?8:0,textDecoration:"none",color:m},v=l.jsxs(l.Fragment,{children:[_,p?l.jsx("span",{style:{fontSize:h,lineHeight:1.2,color:m,whiteSpace:"nowrap"},children:b}):null]});return l.jsx("div",{style:{...c,display:"inline-flex",alignItems:"center"},children:k?l.jsx("a",{href:k,target:"_blank",rel:"noopener noreferrer",style:x,onClick:e=>e.preventDefault(),children:v}):l.jsx("span",{style:x,children:v})},t)})})})};const Pa=({blockItem:t})=>{const{previewMode:n}=e.useContext($e),o="desktop"===n?{...t.contentStyles?.desktop??{}}:{...t.contentStyles?.desktop??{},...t.contentStyles?.mobile??{}},{outer:a,inner:i}=function(e){if(!e||"object"!=typeof e)return{outer:{width:"100%",textAlign:"center",boxSizing:"border-box"},inner:{width:"100%",maxWidth:"100%",display:"inline-block",verticalAlign:"top",boxSizing:"border-box"}};const{textAlign:t="center",width:n="100%",paddingTop:o,paddingRight:a,paddingBottom:l,paddingLeft:i,backgroundColor:r,...s}=e;return{outer:{width:"100%",textAlign:t,boxSizing:"border-box"},inner:{width:n,maxWidth:"100%",display:"inline-block",verticalAlign:"top",boxSizing:"border-box",paddingTop:o,paddingRight:a,paddingBottom:l,paddingLeft:i,backgroundColor:r,...s}}}(o),r=e.useCallback(e=>{const t=e.target?.closest?.("a[href]");if(!t)return;e.preventDefault(),e.stopPropagation();const n=(t.getAttribute("href")||"").trim();if(n&&!/^javascript:/i.test(n)&&!/^data:/i.test(n))if(/^https?:\/\//i.test(n)||n.startsWith("//")){const e=n.startsWith("//")?`https:${n}`:n;window.open(e,"_blank","noopener,noreferrer")}else(/^mailto:/i.test(n)||/^tel:/i.test(n))&&window.open(n,"_blank","noopener,noreferrer")},[]);return l.jsx("div",{className:"relative ee-raw-html-block",children:l.jsx("div",{className:"ee-raw-html-outer",style:a,children:l.jsx("div",{className:"ee-raw-html-inner",style:i,children:l.jsx("div",{className:"ee-raw-html-content",role:"region","aria-label":"Custom HTML preview",onClick:r,dangerouslySetInnerHTML:{__html:t.html??""}})})})})},Ma=({blockItem:t})=>{const{previewMode:n}=e.useContext($e),o="desktop"===n?{...t.styles?.desktop??{}}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},a="number"==typeof t.rows?t.rows:3,i="number"==typeof t.cols?t.cols:3,r=Boolean(t.headerRow),s=Boolean(t.headerCol),c=Boolean(t.stripedRows),d=o.fontSize??14,u=o.color??"#333333",p=o.borderStyle??"solid",m=o.borderWidth??1,g=o.borderColor??"#e0e0e0",h=o.cellPadding??8,b=o.textAlign??"left",y=o.headerBg??"#f5f5f5",f=o.headerColor??"#333333",_=o.stripedBg??"#fafafa",k="none"!==p?`${m}px ${p} ${g}`:"none",x=(e,t)=>{const n=r&&0===e||s&&0===t;return{border:k,padding:h,fontSize:d,color:n?f:u,textAlign:b,backgroundColor:n?y:c&&!n&&e%2==0?_:"transparent",fontWeight:n?600:400,verticalAlign:"top"}},v={...t.contentStyles?.desktop??{},..."desktop"!==n?t.contentStyles?.mobile??{}:{}},w=(e,n)=>{const o=`${e}-${n}`,a=t.cells?.[o];if("image"===a?.type&&String(a.src??"").trim())return l.jsx("img",{src:a.src,alt:a.alt||"",style:{maxWidth:"100%",height:"auto",display:"block"}});const i=a?.text??"";return i?l.jsx("span",{style:{whiteSpace:"pre-wrap"},children:i}):l.jsx("span",{style:{color:"rgba(0,0,0,0.35)",fontStyle:"italic",fontWeight:400},children:"—"})};return l.jsx("div",{style:{width:"100%",boxSizing:"border-box",paddingTop:v.paddingTop??0,paddingBottom:v.paddingBottom??0,paddingLeft:v.paddingLeft??0,paddingRight:v.paddingRight??0,textAlign:v.textAlign??"left",overflowX:"auto"},children:l.jsx("table",{style:{width:"100%",borderCollapse:"collapse",tableLayout:"auto"},children:l.jsx("tbody",{children:Array.from({length:a}).map((e,t)=>l.jsx("tr",{children:Array.from({length:i}).map((e,n)=>{const o=r&&0===t||s&&0===n?"th":"td";return l.jsx(o,{style:x(t,n),children:w(t,n)},`${t}-${n}`)})},t))})})})},Fa=({blockItem:t})=>{const{previewMode:a}=e.useContext($e),i=e.useMemo(()=>"desktop"===a?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},[t.styles,a]),r=e.useMemo(()=>"desktop"===a?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile},[t.contentStyles,a]),s=e.useMemo(()=>"desktop"===a?t.videoArea?.desktop??{}:{...t.videoArea?.desktop??{},...t.videoArea?.mobile??{}},[t.videoArea,a]),c="string"==typeof t.videoUrl?t.videoUrl.trim():"",d=Boolean(i.fillColumn),u=Boolean(i.fillColumnMobile),p="desktop"===a?d:u||d,m=e.useMemo(()=>_n(c,t.thumbnailUrl),[c,t.thumbnailUrl]),g=e.useMemo(()=>{let e=i.width,t=i.height;null!=e&&""!==e||(e="auto"),null!=t&&""!==t||(t="auto"),p&&(e="100%");const n=r?.textAlign||"center";let o="0 auto";return"left"===n?o="0":"right"===n&&(o="0 0 0 auto"),{width:"number"==typeof e?`${e}px`:e,height:"number"==typeof t?`${t}px`:t,display:"block",margin:o,maxWidth:"100%"}},[i,p,r?.textAlign]),h=e.useMemo(()=>{const e=s||{},t=null!=e.borderWidth?Number(e.borderWidth):0;let n="none";return t>0&&e.borderStyle&&"none"!==e.borderStyle&&(n=`${t}px ${e.borderStyle} ${e.borderColor??"#cccccc"}`),{paddingTop:e.paddingTop??0,paddingBottom:e.paddingBottom??0,paddingLeft:e.paddingLeft??0,paddingRight:e.paddingRight??0,backgroundColor:e.backgroundColor||"transparent",border:n,borderRadius:e.borderRadius??0,boxSizing:"border-box"}},[s]),b=e.useMemo(()=>{let e=i.width;p&&(e="100%"),null!=e&&""!==e||(e="auto");const t="auto"===e?"100%":"number"==typeof e?`${e}px`:e,n=s?.borderRadius;return{width:t,maxWidth:"100%",boxSizing:"border-box",...null!=n&&""!==n?{borderRadius:n}:{}}},[i.width,p,s?.borderRadius]),y=!m,f=c.startsWith("http://")||c.startsWith("https://")||c.startsWith("//")?c.startsWith("//")?`https:${c}`:c:c?`https://${c.replace(/^\/+/,"")}`:"",_=y?l.jsx("div",{className:"empty-image ee-video-inner",style:b,children:l.jsx(n.FontAwesomeIcon,{icon:o.faVideo,className:"empty-image-icon"})}):l.jsx("div",{className:"ee-video-inner",style:h,children:f?l.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",style:{display:"block",lineHeight:0,textDecoration:"none"},onClick:e=>e.stopPropagation(),children:l.jsx("img",{src:m,alt:"Video thumbnail",className:"ee-video-thumb",style:g})}):l.jsx("img",{src:m,alt:"Video thumbnail",className:"ee-video-thumb",style:g})});return l.jsx("div",{className:"relative ee-video-block",children:l.jsx("div",{style:{...r||{}},children:_})})},Ua=({blockItem:e,id:t})=>{if(!e)return null;const n={blockItem:e,id:t};switch(e.key){case"text":return l.jsx(xa,{...n});case"button":return l.jsx(va,{...n});case"divider":return l.jsx(wa,{...n});case"spacer":return l.jsx(Sa,{...n});case"menu":return l.jsx(ja,{...n});case"image":return l.jsx(Ba,{...n});case"video":return l.jsx(Fa,{...n});case"avatar":return l.jsx($a,{...n});case"social_link":return l.jsx(Ra,{...n});case"raw_html":return l.jsx(Pa,{...n});case"table":return l.jsx(Ma,{...n});default:return null}},Da={tree:null};function Ea(e,t,n){if(!n||!e[n])return null;if(t.includes(n))return ee(n,e);const o=e[n];return"column"===o.key?ee(n,e):B(o)}function za(e,t,n){const o=Ea(e,t,n);return o?Oa(e,t,o,n):null}function Oa(e,t,n,o){if(!n||!o||!e[o])return null;const a=U(n),l=t.indexOf(o);if(-1!==l){const{newBlockMap:n,rootId:o}=ue(e,a);if(!o)return null;const i=[...t];i.splice(l+1,0,o);const r=n[o];return{nextMap:n,nextRootOrder:i,newId:o,selectionData:"column"===r?.key?ee(o,n):r}}const i=te(e,t,o);if(!i)return null;const{newBlockMap:r,rootId:s}=ue(e,a);if(!s)return null;const c=re(r,i.containerId,i.cellIndex,i.itemIndex+1,s),d=c[s];return{nextMap:c,nextRootOrder:t,newId:s,selectionData:"column"===d?.key?ee(s,c):d}}function Wa(e,t,n,o){if(!n)return null;if(o&&e[o])return Oa(e,t,n,o);const a=U(n),{newBlockMap:l,rootId:i}=ue(e,a);if(!i)return null;const r=l[i],s="column"===r?.key?ee(i,l):r;return{nextMap:l,nextRootOrder:[...t,i],newId:i,selectionData:s}}function Ha(e,t){const n=e[t];if(!n||"column"!==n.key)return!1;for(const t of n.cells||[])for(const n of t.childrenIds||[]){const t=e[n];if(t&&"empty"!==t.key)return!0}return!1}function Ka(e,t,n,o){if(!n||!e[n])return null;if(-1!==t.indexOf(n)){return{nextMap:ce(e,n),nextRootOrder:t.filter(e=>e!==n)}}const a=te(e,t,n);if(!a)return null;const l=Jo(e,t,n);if(l?.nextBlockMap)return{nextMap:l.nextBlockMap,nextRootOrder:t};const{blockMap:i,removedId:r}=ie(e,a.containerId,a.cellIndex,a.itemIndex);let s=i;const c=i[a.containerId];if(c&&0===c.cells[a.cellIndex].childrenIds.length){const e=X(o("drag_block_here"));s={...i,[e.id]:e,[a.containerId]:{...c,cells:c.cells.map((t,n)=>n===a.cellIndex?{...t,childrenIds:[e.id]}:t)}}}return r&&(s=ce(s,r)),{nextMap:s,nextRootOrder:t}}function Va(e){return e&&"column"===e.key?"section"===e.layoutRole||"columns"===e.layoutRole?e.layoutRole:!0===e.columnLayoutOnly?"columns":"section":null}const Ga="section",qa="columns";function Ja(e,t){if(!e||"column"!==e.key)return!1;if("none"!==e.containerType)return!1;const n=e.children;if(Array.isArray(n)){if(n.length<2||n.length>3)return!1;for(const e of n){if("content"!==e?.key)return!1;const t=e?.children?.[0];if("column"!==t?.key||"product"!==t?.containerType)return!1}return!0}if(!t||!Array.isArray(e.cells))return!1;const o=e.cells.length;if(o<2||o>3)return!1;for(const n of e.cells){const e=n?.childrenIds?.[0],o=t[e];if(!o||"column"!==o.key||"product"!==o.containerType)return!1}return!0}const Ya="ee:open-configure-columns";function Xa(e){"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(Ya,{detail:null!=e&&String(e).length>0?{rootId:e}:{}}))}const Za=(e,t)=>null==e||""===e?t:"number"==typeof e?e:parseInt(String(e).replace(/px/gi,""),10)||t;function Qa({segment:e,active:t,children:n,onSelect:o}){return n?l.jsx("div",{className:Go("ee-footer-canvas-segment",t&&"ee-footer-canvas-segment--selected"),"data-footer-segment":e,role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),o?.(e,t)},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o?.(e,t))},children:n}):null}const el=({column:t,canvasFooterSegment:n,isFooterColumnSelected:o,onFooterCanvasSegmentSelect:a})=>{const{previewMode:i,templateData:r}=e.useContext($e),s="desktop"===i?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},c=Boolean(t.showBrand??!0),d=Boolean(t.showTagline??!0),p=Boolean(t.footerShowLogo??!1),m=vn(t.footerLogoSrc??"",r),g=wn(String(t.footerLogoAlt??"Logo").trim()||"Logo",r).trim()||"Logo",h=t.footerLogoLink??"",b="number"==typeof t.footerLogoMaxWidthPercent?t.footerLogoMaxWidthPercent:parseInt(String(t.footerLogoMaxWidthPercent??"30"),10)||30,y="number"==typeof t.footerLogoPaddingPx?t.footerLogoPaddingPx:Za(t.footerLogoPaddingPx,24),f=Boolean(t.showAddress??!0),_=Boolean(t.showUnsubscribe??!0),k=Boolean(t.showSocial??!1),x=Boolean(t.showSecondaryLinks??!1),v=Boolean(t.showCopyright??!0),w=wn(t.brandName??"",r),S=wn(t.brandTagline??"",r).trim(),j=wn(t.address??"",r),C=wn(t.copyrightText??"",r),N=t.unsubscribeUrl??"",A=t.preferencesUrl??"",{unsubscribeLinkLabel:T,preferencesLinkLabel:B}=Cn(t),$=wn(T,r),R=wn(B,r),P=In(t.secondaryLinks),M=Nn(t.footerSocialList),F=s.color??"#737373",U=null!=s.linkColor&&""!==String(s.linkColor).trim()?String(s.linkColor).trim():F,D=Za(s.fontSize,12),E=s.textAlign??"center",z=Za(s.paddingTop,28),O=Za(s.paddingRight,24),W=Za(s.paddingBottom,28),H=Za(s.paddingLeft,24),K=Boolean(t.showDivider??!1),V=t.dividerColor??"#374151",G=Boolean(t.showBorderTop??!1),q=Za(t.borderTopWidth,1),J=t.borderTopStyle??"solid",Y=t.borderTopColor??"#e5e7eb",X=kn(s.contentBackground),Z={margin:0,color:F,fontSize:D,lineHeight:1.5,fontFamily:s.fontFamily??"Arial, sans-serif"},Q={color:U,textDecoration:"underline",cursor:"pointer"},ee={onClick:e=>{e.preventDefault()}},te={boxSizing:"border-box",width:"100%",textAlign:E,backgroundColor:X,paddingTop:z,paddingRight:O,paddingBottom:W,paddingLeft:H,borderTop:G&&q>0?`${q}px ${J} ${Y}`:void 0},ne=(e,t)=>l.jsx("div",{style:{marginTop:0,marginBottom:10},children:e},t),oe=Array.isArray(M)?M.filter(Boolean):[],ae=I({imageWidth:36}),le=u(Sn(h,r)),ie=l.jsx("img",{src:m,alt:g,draggable:!1,style:{maxWidth:`${Math.min(100,Math.max(10,b))}%`,height:"auto",display:"inline-block",padding:y,verticalAlign:"middle",border:0}}),re=le?l.jsx("a",{href:le,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",lineHeight:0,display:"inline-block"},...ee,children:ie}):ie,se=e=>Boolean(o&&n===e);return l.jsxs("div",{style:te,children:[K?l.jsx(Qa,{segment:"divider",active:se("divider"),onSelect:a,children:l.jsx("div",{style:{borderTop:`1px solid ${V}`,marginBottom:15,width:"100%"},"aria-hidden":!0})}):null,p&&m.trim()?ne(l.jsx(Qa,{segment:"logo",active:se("logo"),onSelect:a,children:l.jsx("div",{style:{display:"flex",justifyContent:"left"===E?"flex-start":"right"===E?"flex-end":"center",lineHeight:0},children:re})}),"logo"):null,c&&w.trim()?ne(l.jsx(Qa,{segment:"brand",active:se("brand"),onSelect:a,children:l.jsx("p",{style:{...Z,fontWeight:600},children:w})}),"brand"):null,d&&S.trim()?ne(l.jsx(Qa,{segment:"tagline",active:se("tagline"),onSelect:a,children:l.jsx("p",{style:{...Z,opacity:.92},children:S})}),"tagline"):null,f&&j.trim()?ne(l.jsx(Qa,{segment:"address",active:se("address"),onSelect:a,children:l.jsx("p",{style:Z,children:j})}),"address"):null,k&&oe.length>0?ne(l.jsx(Qa,{segment:"social",active:se("social"),onSelect:a,children:l.jsx("div",{style:{display:"flex",justifyContent:"left"===E?"flex-start":"right"===E?"flex-end":"center",flexWrap:"wrap",gap:12,alignItems:"center"},children:oe.map((e,t)=>{const n=u(Sn(e.linkURL,r),{allowMailtoTel:!1}),{src:o,style:a}=L(e,"default",ae),i=l.jsx("img",{src:o||e.image,alt:"",style:a,draggable:!1}),s={style:{display:"inline-flex",alignItems:"center",lineHeight:0}};return n?l.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",...s,...ee,children:i},`${e.title}-${t}`):l.jsx("span",{...s,children:i},`${e.title}-${t}`)})})}),"social"):null,_?ne(l.jsx(Qa,{segment:"unsubscribe",active:se("unsubscribe"),onSelect:a,children:l.jsxs("p",{style:{...Z,wordBreak:"break-word"},children:[l.jsx("a",{href:u(Sn(N,r)),style:Q,...ee,children:$}),B?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{padding:"0 6px",userSelect:"none"},children:"·"}),l.jsx("a",{href:u(Sn(A,r)),style:Q,...ee,children:R})]}):null]})}),"unsub"):null,x&&P.length>0?ne(l.jsx(Qa,{segment:"secondary",active:se("secondary"),onSelect:a,children:l.jsx("p",{style:{...Z,wordBreak:"break-word"},children:P.map((e,t)=>l.jsxs("span",{children:[t>0?l.jsx("span",{style:{padding:"0 6px",userSelect:"none"},children:"·"}):null,l.jsx("a",{href:u(Sn(e.url,r)),target:"_blank"===e.target?"_blank":void 0,rel:"_blank"===e.target?"noopener noreferrer":void 0,style:Q,...ee,children:wn(e.label||"",r)||`#${t+1}`})]},e.id||`${e.label}-${t}`))})}),"secondary"):null,v&&C.trim()?ne(l.jsx(Qa,{segment:"copyright",active:se("copyright"),onSelect:a,children:l.jsx("p",{style:{...Z,fontSize:Math.max(10,D-1),opacity:.9},children:C})}),"copy"):null,l.jsx("div",{style:{height:1,marginBottom:-10},"aria-hidden":!0})]})},tl=["paddingTop","paddingRight","paddingBottom","paddingLeft"],nl=o.faCog;function ol(e,t){if(!t?.key)return{icon:o.faSquare,label:""};const{key:n,containerType:a}=t;if("column"===n)return"header"===a?{icon:o.faWindowMaximize,label:e("block_header")||"Header"}:"footer"===a?{icon:o.faWindowMinimize,label:e("block_footer")||"Footer"}:"product"===a?{icon:o.faCube,label:e("block_product")}:"discount"===a?{icon:o.faTag,label:e("block_discount")}:Va(t)===qa?{icon:o.faColumns,label:e("block_palette_columns")}:{icon:o.faSquare,label:e("block_palette_section")};switch(n){case"text":return{icon:o.faFont,label:e("text")};case"button":return{icon:o.faLink,label:e("button")};case"image":return{icon:o.faImage,label:e("image")};case"video":return{icon:o.faVideo,label:e("video")};case"divider":return{icon:o.faGripLines,label:e("divider")};case"spacer":return{icon:o.faArrowsAltV,label:e("spacer")};case"menu":return{icon:o.faBars,label:e("menu")};case"avatar":return{icon:o.faUser,label:e("avatar")};case"social_link":return{icon:o.faShareAlt,label:e("social_link")};case"raw_html":return{icon:o.faCode,label:e("raw_html")};case"table":return{icon:o.faTable,label:e("table")};case"empty":return{icon:o.faSquare,label:""};default:return{icon:o.faSquare,label:n||""}}}function al(e,t){if("header"!==e?.containerType||!t?.hidden)return!1;const n=String(t.src??""),o=!1===e.showLogo&&"image"===t.key&&!t.headerBannerSlot&&!t.footerBannerSlot&&(!0===t.headerLogoSlot||/\{\{\s*LogoUrl\s*\}\}/.test(n)||n.includes("LogoUrl")),a=!0!==e.showHeaderBanner&&(Boolean(t.headerBannerSlot)||Boolean(t.headerBannerDividerSlot)||"image"===t.key&&n.includes("HeroBanner"));return o||a}function ll(e,t){return"footer"===e?.containerType&&!0!==e?.footerUnifiedLayout&&Boolean(t?.hidden)}const il=a=>{const{block:i,blockIndex:r,clearStyles:s}=a,{t:c}=Zo(),{previewMode:d,blockMap:u,rootOrder:p,validationMarkers:m,ignoreValidationIssue:g,setBlocks:h,currentItem:b,setCurrentItem:y,setIsDragStart:f,isDragStart:_,bodySettings:k,setActionType:x,onSaveBlockAsGlobal:v}=e.useContext($e),w="desktop"===d?i.styles?.desktop??{}:{...i.styles?.desktop??{},...i.styles?.mobile??{}},{contentBackground:S,containerBackgroundImage:j,containerBackgroundSize:C,containerBackgroundPosition:N,...I}=w,A="footer"===i.containerType&&i.footerUnifiedLayout?kn(S):S;let L=I,T={};if("discount"===i.containerType){L={...I},T={};for(const e of tl)Object.prototype.hasOwnProperty.call(L,e)&&(T[e]=L[e],delete L[e])}if("footer"===i.containerType&&i.footerUnifiedLayout){L={...L};for(const e of tl)delete L[e]}let B=w;if("footer"===i.containerType&&i.footerUnifiedLayout){B={...w};for(const e of tl)delete B[e]}const $="undefined"!=typeof window?window.__eeDragItemData:null,R=$?.key??(b?.id?u[b.id]?.key:null)??b?.data?.key,P=_&&"column"!==R,M=e=>t=>{t.preventDefault(),t.stopPropagation(),y({id:e.id,data:e,type:"edit"}),x("edit")},F=e=>t=>{t.preventDefault(),t.stopPropagation();const n=u[e];n&&(y({id:n.id,data:n,type:"edit"}),x("edit"))},U=(e,t,n)=>o=>{o.preventDefault(),o.stopPropagation();const a=u[e]?.cells?.[t]?.childrenIds?.[n];if(a){const e=Jo(u,p,a);if(e?.nextBlockMap)return h(e.nextBlockMap,p,"edit"),void y(null)}const{blockMap:l,removedId:i}=ie(u,e,t,n);let r=l;const s=l[e];if(s&&0===s.cells[t].childrenIds.length){const n=X(c("drag_block_here"));r={...l,[n.id]:n,[e]:{...s,cells:s.cells.map((e,o)=>o===t?{...e,childrenIds:[n.id]}:e)}}}i&&(r=ce(r,i)),h(r,p,"delete"),y(null)},D=e=>()=>{f(!0),y({id:e.id,data:e,type:"move"}),x("move")},E=e=>{e.preventDefault(),e.stopPropagation(),setTimeout(()=>{e.target.style.border="",e.target.children[0]&&e.target.children[0].classList.remove("sidebar-block-move"),f(!1),s&&s()},50)},z=e=>e.preventDefault(),O=e=>{e.preventDefault(),e.stopPropagation()},W=(e,t)=>n=>{O(n);const o=se(u,p,e,t);o&&h(o.nextMap,o.nextRootOrder,"move")},H=e=>t=>{O(t);const n=za(u,p,e);n&&(h(n.nextMap,n.nextRootOrder,"add"),y({id:n.newId,data:n.selectionData,type:"edit"}))},K=e=>"desktop"===d?e.styles?.desktop||{}:{...e.styles?.desktop||{},...e.styles?.mobile||{}},V=J(k),G=Y(k),q="mobile"===d||G?"100%":V,Z="mobile"===d||G?"100%":V,Q=e=>{const n=m?.[e];if(!n)return null;const o="error"===n.severity?`${n.errorCount} error${1===n.errorCount?"":"s"}`:"warning"===n.severity?`${n.warningCount} warning${1===n.warningCount?"":"s"}`:`${n.infoCount??n.totalCount} info`,a=l.jsx("div",{className:"block-validation-popover",children:n.issues.map((e,n)=>{const o=Boolean(e.blockId&&u?.[e.blockId]);return l.jsxs("div",{className:"block-validation-popover-item",children:[l.jsx("div",{className:"block-validation-popover-message",children:e.message}),l.jsxs("div",{className:"block-validation-popover-actions",children:[o&&l.jsx(t.Button,{size:"small",type:"text",className:"block-validation-popover-open-block",onClick:(a=e.blockId,e=>{e.preventDefault(),e.stopPropagation(),a&&u?.[a]&&(y({id:a,data:u[a],type:"edit"}),x("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(a)):String(a).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),t=document.querySelector(`[data-block-id="${e}"]`);t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}))}),children:c("export_validation_open_block")||"Open block"}),"function"==typeof g&&l.jsx(t.Button,{size:"small",type:"text",className:"block-validation-popover-ignore",onClick:t=>{t.preventDefault(),t.stopPropagation(),g(e)},children:c("ignore")})]})]},`${e.code}-${n}`);var a})});return l.jsx(t.Popover,{trigger:["hover","click"],placement:"topRight",overlayClassName:"block-validation-popover-overlay",content:a,getPopupContainer:()=>document.querySelector("#preview")||document.body,children:l.jsxs("button",{type:"button",className:Go("block-validation-indicator","error"===n.severity?"block-validation-indicator-error":"warning"===n.severity?"block-validation-indicator-warning":"block-validation-indicator-info"),"aria-label":o,onClick:e=>{e.preventDefault(),e.stopPropagation()},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},children:[l.jsx("span",{className:"block-validation-indicator-dot"}),l.jsx("span",{className:"block-validation-indicator-count",children:n.totalCount})]})})},ee=(t,a,i,r,s,p,m=1)=>{const g=K({styles:t.styles}),{contentBackground:h,containerBackgroundImage:y,containerBackgroundSize:f,containerBackgroundPosition:_,...x}=g,v=b?.id===t.id,w=((e=1)=>({"--nested-level":Math.max(1,e),"--nested-width":"100%"}))(m);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative block-content-drag-label-content","data-drop-key":s,children:[l.jsx("div",{className:"absolute block-move-top",children:l.jsx("span",{className:"block-tools-drag_here",children:c("drag_block_here")})}),P&&l.jsx("div",{className:"block-move-content-top","data-name":"dragTools","data-position":"top","data-container-id":a,"data-cell-index":i,"data-item-index":r,"data-drop-key":s,"data-type":"block-item-move"})]}),l.jsx("div",{className:Go("block-item block-item-container",v&&"block-item-focus"),style:w,"data-block-id":t.id,onMouseEnter:e=>{e.currentTarget.dataset.hovered="true"},onMouseLeave:e=>{delete e.currentTarget.dataset.hovered},onClick:M(t),children:l.jsxs("div",{className:"relative",children:[Q(t.id),l.jsx("div",{className:"block-item-tools",onDragOver:z,children:P&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"block-move-content-top","data-name":"dragTools","data-position":"top","data-container-id":a,"data-cell-index":i,"data-item-index":r,"data-drop-key":s,"data-type":"block-item-move"}),l.jsx("div",{className:"block-move-content-bottom","data-name":"dragTools","data-position":"bottom","data-container-id":a,"data-cell-index":i,"data-item-index":r+1,"data-drop-key":p,"data-type":"block-item-move"})]})}),(()=>{const e=u[a]?.cells?.[i],s=r>0,d=r<(e?.childrenIds?.length??0)-1,p=ol(c,t);return l.jsxs("div",{className:"block-chrome-overlay",children:[l.jsxs("span",{className:"block-chrome-badge",children:[l.jsx(n.FontAwesomeIcon,{icon:p.icon}),l.jsx("span",{children:p.label})]}),l.jsxs("div",{className:"block-chrome-toolbar",children:[l.jsx("span",{className:"block-chrome-action",onMouseDown:O,onClick:F(a),title:c("select_parent_section_tooltip"),children:l.jsx(n.FontAwesomeIcon,{icon:nl})}),l.jsx("span",{className:Go("block-chrome-action",!s&&"block-chrome-action-disabled"),onMouseDown:O,onClick:W(t.id,-1),title:c("context_move_up"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronUp})}),l.jsx("span",{className:Go("block-chrome-action",!d&&"block-chrome-action-disabled"),onMouseDown:O,onClick:W(t.id,1),title:c("context_move_down"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronDown})}),l.jsx("span",{className:"block-chrome-divider","aria-hidden":!0}),l.jsx("span",{className:"block-chrome-action",onMouseDown:O,onClick:H(t.id),title:c("context_duplicate"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faCopy})}),l.jsx("span",{className:"block-chrome-divider","aria-hidden":!0}),l.jsx("span",{className:"block-chrome-action block-chrome-action-danger",onMouseDown:O,onClick:U(a,i,r),title:c("layer_delete"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash})}),l.jsx("span",{className:"block-chrome-action block-chrome-action-disabled ee-section-nested-no-drag",draggable:!1,onMouseDown:e=>e.stopPropagation(),title:c("section_nest_not_allowed"),style:{cursor:"not-allowed"},children:l.jsx(n.FontAwesomeIcon,{icon:o.faArrowsAlt})})]})]})})(),l.jsx("div",{style:{...x,overflow:x.borderRadius?"hidden":void 0},children:l.jsx("div",{className:"block-content block-item-container-body",style:{...gn(g,h),borderRadius:x.borderRadius,overflow:x.borderRadius?"hidden":void 0,...null!=x.minHeight&&""!==x.minHeight&&""!==String(x.minHeight).trim()?{minHeight:x.minHeight}:{}},children:(t.children||[]).map((n,o)=>{const a=K(n);return l.jsx("div",{style:{...a,width:"mobile"===d&&!1!==k.stackColumnsOnMobile?"100%":n.width},children:(n.children||[]).map((a,i)=>{const r=`${t.id}:${o}:${i}`,s=`${t.id}:${o}:${i+1}`,d=i===n.children.length-1&&"empty"!==a.key&&"column"!==a.key;return l.jsxs(e.Fragment,{children:[te(a,t.id,o,i,r,s,m),d&&l.jsx("div",{className:"relative block-content-drag-label-content","data-drop-key":s,children:l.jsx("div",{className:"absolute block-move-bottom",children:l.jsx("span",{className:"block-tools-drag_here",children:c("drag_block_here")})})})]},`${t.id}:${o}:${a.id||i}`)})},`${t.id}:${n.id||"cell"}:${o}`)})})})]})}),l.jsxs("div",{className:"relative block-content-drag-label-content","data-drop-key":p,children:[l.jsx("div",{className:"absolute block-move-bottom",children:l.jsx("span",{className:"block-tools-drag_here",children:c("drag_block_here")})}),P&&l.jsx("div",{className:"block-move-content-bottom","data-name":"dragTools","data-position":"bottom","data-container-id":a,"data-cell-index":i,"data-item-index":r+1,"data-drop-key":p,"data-type":"block-item-move"})]})]})},te=(t,a,r,s,d,p,m=0)=>"empty"===t.key?l.jsx("div",{className:"relative width-full",children:l.jsx("div",{className:"block-empty-content ee-empty-drop-slot",onDragOver:P?z:void 0,...P?{"data-container-id":a,"data-cell-index":r,"data-item-index":s,"data-type":"empty-block-item"}:{},"aria-label":t.name||c("drag_block_here"),children:l.jsx("span",{className:"ee-empty-drop-slot__label",children:c("drag_block_here")})})},t.id||s):"column"===t.key?l.jsx(e.Fragment,{children:ee(t,a,r,s,d,p,m+1)},`${a}:${r}:${t.id||s}`):l.jsxs(e.Fragment,{children:[l.jsx("div",{className:"relative block-content-drag-label-content","data-drop-key":d,children:l.jsx("div",{className:"absolute block-move-top",children:l.jsx("span",{className:"block-tools-drag_here",children:c("drag_block_here")})})}),l.jsx("div",{className:Go("block-item",b?.id===t.id&&"block-item-focus",t.hidden&&!al(i,t)&&!ll(i,t)&&"block-hidden-dim",(al(i,t)||ll(i,t))&&"ee-header-banner-off-canvas"),"data-block-id":t.id,onClick:e=>{e.preventDefault(),e.stopPropagation(),aa(t)&&b?.id===t.id&&oa(c),y({id:t.id,data:t,type:"edit"}),x("edit")},children:l.jsxs("div",{className:"relative",children:[Q(t.id),l.jsx("div",{className:Go("block-item-tools",aa(t)&&b?.id===t.id&&"block-item-tools--pointer-through-ai-text"),onDragOver:z,children:P&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"block-move-content-top","data-name":"dragTools","data-position":"top","data-container-id":a,"data-cell-index":r,"data-item-index":s,"data-drop-key":d,"data-type":"block-item-move"}),l.jsx("div",{className:"block-move-content-bottom","data-name":"dragTools","data-position":"bottom","data-container-id":a,"data-cell-index":r,"data-item-index":s+1,"data-drop-key":p,"data-type":"block-item-move"})]})}),(()=>{const e=u[a]?.cells?.[r],i=s>0,d=s<(e?.childrenIds?.length??0)-1,p=ol(c,t);return l.jsxs("div",{className:"block-chrome-overlay",children:[l.jsxs("span",{className:"block-chrome-badge",children:[l.jsx(n.FontAwesomeIcon,{icon:p.icon}),l.jsx("span",{children:p.label})]}),l.jsxs("div",{className:"block-chrome-toolbar",children:[l.jsx("span",{className:"block-chrome-action",onMouseDown:O,onClick:F(a),title:c("select_parent_section_tooltip"),children:l.jsx(n.FontAwesomeIcon,{icon:nl})}),l.jsx("span",{className:Go("block-chrome-action",!i&&"block-chrome-action-disabled"),onMouseDown:O,onClick:W(t.id,-1),title:c("context_move_up"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronUp})}),l.jsx("span",{className:Go("block-chrome-action",!d&&"block-chrome-action-disabled"),onMouseDown:O,onClick:W(t.id,1),title:c("context_move_down"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronDown})}),l.jsx("span",{className:"block-chrome-divider","aria-hidden":!0}),l.jsx("span",{className:"block-chrome-action",onMouseDown:O,onClick:H(t.id),title:c("context_duplicate"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faCopy})}),l.jsx("span",{className:"block-chrome-divider","aria-hidden":!0}),l.jsx("span",{className:"block-chrome-action block-chrome-action-danger",onMouseDown:O,onClick:U(a,r,s),title:c("layer_delete"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash})}),l.jsx("span",{className:"block-chrome-action block-chrome-drag",draggable:"true",onMouseDown:e=>e.stopPropagation(),onDragEnd:E,onDragStart:D(t),title:c("drag_to_move")||"Drag to move",children:l.jsx(n.FontAwesomeIcon,{icon:o.faArrowsAlt})})]})]})})(),l.jsx(Ua,{blockItem:t,id:t.id})]})})]},`${a}:${r}:${t.id||s}`),ne=ol(c,i),oe="column"===b?.data?.key&&Va(b.data)===qa?c("block_palette_columns"):c("container");return l.jsx(l.Fragment,{children:l.jsxs("div",{className:Go("relative block-drag-label-content",_&&"column"===R&&"ee-section-drop-preview"),"data-index":r,"data-position":"top",children:[_&&"column"===R?l.jsxs("div",{className:"ee-section-drop-slot-outline","aria-hidden":!0,children:[l.jsx("span",{className:"ee-section-drop-badge",children:oe}),l.jsx("span",{className:"ee-section-drop-hint",children:c("drag_section_here")})]}):null,l.jsx("div",{className:"absolute block-move-top",children:l.jsx("span",{className:"block-tools-drag_here",children:c("drag_block_here")})}),l.jsxs("div",{className:Go("relative block",b?.id===i.id&&"block-focus","mobile"===d&&"mobile-block-focus",i.hidden&&"block-hidden-dim"),"data-block-id":i.id,onClick:M(i),children:[l.jsxs("div",{className:"hover-visible",children:[Q(i.id),l.jsxs("div",{className:"block-chrome-overlay",children:[l.jsxs("span",{className:"block-chrome-badge",children:[l.jsx(n.FontAwesomeIcon,{icon:ne.icon}),l.jsx("span",{children:ne.label})]}),l.jsxs("div",{className:"block-chrome-toolbar",children:[l.jsx("span",{className:Go("block-chrome-action",r<=0&&"block-chrome-action-disabled"),onMouseDown:O,onClick:W(i.id,-1),title:c("context_move_up"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronUp})}),l.jsx("span",{className:Go("block-chrome-action",r>=p.length-1&&"block-chrome-action-disabled"),onMouseDown:O,onClick:W(i.id,1),title:c("context_move_down"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronDown})}),l.jsx("span",{className:"block-chrome-divider","aria-hidden":!0}),l.jsx("span",{className:"block-chrome-action",onMouseDown:O,onClick:H(i.id),title:c("context_duplicate"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faCopy})}),"function"==typeof v&&l.jsx("span",{className:"block-chrome-action",onMouseDown:O,onClick:(ae=i,e=>{O(e),window.dispatchEvent(new CustomEvent("ee:canvas-save-universal",{detail:{block:ae}}))}),title:c("save_as_universal"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faStar})}),l.jsx("span",{className:"block-chrome-divider","aria-hidden":!0}),l.jsx("span",{className:"block-chrome-action block-chrome-action-danger",onMouseDown:O,onClick:e=>{e.preventDefault(),e.stopPropagation();const t=ce(u,i.id),n=p.filter(e=>e!==i.id);h(t,n,"delete"),y(null)},title:c("layer_delete"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash})}),l.jsx("span",{className:"block-chrome-action block-chrome-drag",draggable:"true",onMouseDown:e=>e.stopPropagation(),onDragEnd:E,onDragStart:()=>{f(!0),y({id:i.id,data:i,type:"move"}),x("move")},title:c("drag_to_move")||"Drag to move",children:l.jsx(n.FontAwesomeIcon,{icon:o.faArrowsAlt})})]})]})]}),l.jsx("div",{className:"width-full height-full absolute",onDragOver:z,style:{pointerEvents:_&&"column"===R?"auto":"none"},children:_&&"column"===R&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"block-move-content-top","data-name":"dragTools","data-type":"drag-over-column","data-position":"top","data-index":r}),l.jsx("div",{className:"block-move-content-bottom","data-name":"dragTools","data-type":"drag-over-column","data-position":"bottom","data-index":r+1})]})}),l.jsx("div",{className:"column margin-auto",style:{...L,width:"100%",maxWidth:"100%",overflow:L.borderRadius?"hidden":void 0},children:l.jsx("div",{className:"block-content",style:{...gn(B,A),...T,borderRadius:L.borderRadius,overflow:L.borderRadius?"hidden":void 0,width:q,maxWidth:Z,...null!=L.minHeight&&""!==L.minHeight&&""!==String(L.minHeight).trim()?{minHeight:L.minHeight}:{}},"data-index":r,children:i.children.map((t,n)=>{const o="desktop"===d?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}};return l.jsx(e.Fragment,{children:l.jsx("div",{id:`block-content-${r}-${n}`,style:{...o,width:"mobile"===d&&!1!==k.stackColumnsOnMobile?"100%":t.width},children:"footer"===i.containerType&&i.footerUnifiedLayout&&0===n?l.jsx("div",{className:"ee-smart-footer-column-body width-full",children:l.jsx(el,{column:i,canvasFooterSegment:i.footerSelectedSegment,isFooterColumnSelected:b?.id===i.id,onFooterCanvasSegmentSelect:(e,t)=>{t?.preventDefault?.(),t?.stopPropagation?.();const n=u[i.id];if(!n||"column"!==n.key)return;const o={...n,footerSelectedSegment:e};h({...u,[i.id]:o},p,`edit_${Date.now()}`),y({id:i.id,data:o,type:"edit"}),x("edit")}})},`${i.id}:${n}:footer-unified`):t.children.map((o,a)=>{const r=`${i.id}:${n}:${a}`,s=`${i.id}:${n}:${a+1}`,d=a===t.children.length-1&&"empty"!==o.key&&"column"!==o.key;return l.jsxs(e.Fragment,{children:[te(o,i.id,n,a,r,s,0),d&&l.jsx("div",{className:"relative block-content-drag-label-content","data-drop-key":s,children:l.jsx("div",{className:"absolute block-move-bottom",children:l.jsx("span",{className:"block-tools-drag_here",children:c("drag_block_here")})})})]},`${i.id}:${n}:${o.id||a}`)})})},`${i.id}:${t.id||"content"}:${n}`)})})})]})]})});var ae};function rl(e){return{id:P(),name:e("drag_block_here"),key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}}}function sl(e,t){return{id:P(),name:e("content"),key:"content",width:t,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[rl(e)]}}function cl(e,{layoutRole:t,columnLayoutOnly:n,name:o}){const a=n?[sl(e,"50%"),sl(e,"50%")]:[sl(e,"100%")];return{id:P(),name:o,key:"column",type:n?"1-1":"full",containerType:"none",layoutRole:t,columnLayoutOnly:n,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},children:a}}const dl=e=>[cl(e,{layoutRole:Ga,columnLayoutOnly:!1,name:e("block_palette_section")}),cl(e,{layoutRole:qa,columnLayoutOnly:!0,name:e("block_palette_columns")}),{id:P(),name:e("text"),key:"text",text:e("text_content"),type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",color:void 0,lineHeight:"20px",paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"left"},mobile:{}}},{id:P(),name:e("button"),key:"button",text:e("button"),type:"link",linkURL:"",contentStyles:{desktop:{textAlign:"center",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{width:"auto",fontSize:12,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:20,paddingRight:20,backgroundColor:void 0,color:"#fff",display:"inline-block"},mobile:{}}},{id:P(),name:e("spacer"),key:"spacer",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{height:16,width:"100%",display:"block"},mobile:{}}},{id:P(),name:e("divider"),key:"divider",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},{id:P(),name:e("raw_html"),key:"raw_html",html:e("raw_html_default_content"),contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center",width:"100%"},mobile:{}},styles:{desktop:{},mobile:{}}},{id:P(),name:e("image"),key:"image",src:"",alt:"Image",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{id:P(),name:e("video"),key:"video",videoUrl:"",thumbnailUrl:"",styles:{desktop:{width:"auto",height:"auto",fillColumn:!1,fillColumnMobile:!1,display:"inline-block"},mobile:{}},videoArea:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,backgroundColor:"transparent",borderWidth:0,borderStyle:"solid",borderColor:"#cccccc",borderRadius:0},mobile:{}},contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center",backgroundColor:"transparent"},mobile:{}}},{id:P(),name:e("menu"),key:"menu",layoutMode:"nav-only",showLogo:!1,mobileLayout:"stack",linkGapPx:0,linkUnderline:!1,list:[{label:"Page",url:"",target:"_self"},{label:"Page",url:"",target:"_self"}],separator:" | ",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:14,fontFamily:"sans-serif",color:"#333333",linkColor:"#2faade",letterSpacing:0,fontWeight:"400",textTransform:"none"},mobile:{}}},{id:P(),name:e("table")||"Table",key:"table",rows:3,cols:3,structureMode:"static",headerRow:!0,headerCol:!1,stripedRows:!1,cells:{},contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}},styles:{desktop:{fontSize:14,color:"#333333",borderStyle:"solid",borderWidth:1,borderColor:"#e0e0e0",cellPadding:8,textAlign:"left",headerBg:"#f5f5f5",headerColor:"#333333",stripedRows:!1,stripedBg:"#fafafa"},mobile:{}}},{id:P(),name:e("social_link"),key:"social_link",list:[],imageWidth:32,iconSize:"medium",iconColor:"gray",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"center"},mobile:{}},styles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}}}];const ul="ee-block-context-menu";function pl(e,t,n){return{label:e,onSelect:t,disabled:n}}const ml=()=>{const{t:n}=Zo(),{blockMap:o,rootOrder:a,setBlocks:r,setCurrentItem:s,onSaveBlockAsGlobal:c}=e.useContext($e),[d,u]=e.useState(null),p=e.useCallback(()=>u(null),[]);e.useEffect(()=>{const e=e=>{const t=e.target.closest?.(".email-editor");if(!t)return;const n=e.target.closest?.("[data-block-id]");if(!n||!t.contains(n))return;const a=n.getAttribute("data-block-id");a&&o[a]&&(e.preventDefault(),e.stopPropagation(),u({x:e.clientX,y:e.clientY,blockId:a}))},t=e=>{e.target.closest?.(`.${ul}`)||u(null)};return document.addEventListener("contextmenu",e,!0),document.addEventListener("click",t,!0),document.addEventListener("scroll",t,!0),()=>{document.removeEventListener("contextmenu",e,!0),document.removeEventListener("click",t,!0),document.removeEventListener("scroll",t,!0)}},[o]);const m=e.useCallback((e,t)=>{const n=se(o,a,e,t);n&&(r(n.nextMap,n.nextRootOrder,"move"),p())},[o,a,r,p]),g=e.useCallback(e=>Boolean(se(o,a,e,-1)),[o,a]),h=e.useCallback(e=>Boolean(se(o,a,e,1)),[o,a]),b=e.useCallback(e=>{const l=o[e];if(!l)return[];const i=()=>{const t=Ea(o,a,e);t&&(Da.tree=t)};return[pl(n("context_duplicate"),()=>{const t=za(o,a,e);t&&(r(t.nextMap,t.nextRootOrder,"add"),s({id:t.newId,data:t.selectionData,type:"edit"}),p())},!1),pl(n("context_copy"),()=>{i(),p()},!1),pl(n("context_cut"),()=>{i();const c=()=>{const t=Ka(o,a,e,n);t&&(r(t.nextMap,t.nextRootOrder,"delete"),s(null),p())};if("column"===l.key&&Ha(o,e))return p(),void t.Modal.confirm({title:n("shortcut_delete_confirm_title"),content:n("shortcut_delete_confirm_desc"),okText:n("confirm"),cancelText:n("cancel"),wrapClassName:"ee-modal-dark",onOk:c});c()},!1),pl(n("context_paste"),()=>{if(!Da.tree)return;const t=Wa(o,a,Da.tree,e);t&&(r(t.nextMap,t.nextRootOrder,"add"),s({id:t.newId,data:t.selectionData,type:"edit"}),p())},!Da.tree),pl(n("context_delete"),()=>{const i=()=>{const t=Ka(o,a,e,n);t&&(r(t.nextMap,t.nextRootOrder,"delete"),s(null),p())};if("column"===l.key&&Ha(o,e))return p(),void t.Modal.confirm({title:n("shortcut_delete_confirm_title"),content:n("shortcut_delete_confirm_desc"),okText:n("confirm"),cancelText:n("cancel"),wrapClassName:"ee-modal-dark",onOk:i});i()},!1),pl(n("context_move_up"),()=>m(e,-1),!g(e)),pl(n("context_move_down"),()=>m(e,1),!h(e)),pl(n("context_save_global"),()=>{"function"==typeof c&&c(e),p()},"function"!=typeof c),pl(n("context_reset_styles"),()=>{const t=function(e,t,n){const o=e[t];if(!o||!o.key)return null;const a=dl(n).find(e=>e.key===o.key);if(!a)return null;const l={...o};return null!=a.styles&&(l.styles=B(a.styles)),null!=a.contentStyles&&(l.contentStyles=B(a.contentStyles)),{...e,[t]:l}}(o,e,n);if(!t)return;r(t,a,`edit_${Date.now()}`);const l=t[e];l&&s({id:e,data:"column"===l.key?ee(e,t):l,type:"edit"}),p()},"empty"===l.key||!dl(n).some(e=>e.key===l.key))]},[o,a,r,s,n,p,g,h,m,c]);if(!d)return null;const y=b(d.blockId),f="undefined"!=typeof window?window.innerWidth:9999,_="undefined"!=typeof window?window.innerHeight:9999,k=Math.min(d.x,f-220-8),x=Math.min(d.y,_-360-8);return i.createPortal(l.jsx("div",{className:ul,style:{position:"fixed",left:k,top:x,zIndex:10050,minWidth:220,background:"#1a1a1a",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,boxShadow:"0 12px 40px rgba(0,0,0,0.45)",padding:"6px 0"},role:"menu",onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:y.map(e=>l.jsx("button",{type:"button",role:"menuitem",disabled:e.disabled,className:"ee-block-context-menu-item",style:{display:"block",width:"100%",textAlign:"left",padding:"8px 14px",border:"none",background:"transparent",color:e.disabled?"rgba(255,255,255,0.35)":"#f5f5f5",fontSize:13,cursor:e.disabled?"not-allowed":"pointer"},onMouseEnter:t=>{e.disabled||(t.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},onClick:()=>{e.disabled||e.onSelect()},children:e.label},e.label))}),document.body)},gl=t=>{const{clearStyles:n}=t,{t:o}=Zo(),{previewMode:a,bodySettings:i,blockList:r,currentItem:s,blockMap:c,isDragStart:d,setSelectionRange:u}=e.useContext($e),p=e.useRef(null),m="undefined"!=typeof window?window.__eeDragItemData:null,g="undefined"!=typeof window?window.__eeDragSource:null,h=m?.key??(s?.id?c[s.id]?.key:null)??s?.data?.key,b="add"===s?.type||Boolean(m),y=r.length>0&&d&&"product-variables"!==g&&("column"===h||b);e.useEffect(()=>{const e=$(()=>{try{const n=window.getSelection();if(!n||0===n.rangeCount)return;const o=n.getRangeAt(0),a=document.getElementById("preview");if(!(!!a&&(a.contains(o.commonAncestorContainer)||a===o.commonAncestorContainer)))return;const l=(e=>e?{startContainer:e.startContainer,startOffset:e.startOffset,endContainer:e.endContainer,endOffset:e.endOffset,collapsed:e.collapsed}:null)(o);if(e=p.current,t=l,e&&t&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset&&e.collapsed===t.collapsed)return;p.current=l,u(o.cloneRange())}catch(e){console.warn(e)}var e,t},100);return document.addEventListener("selectionchange",e),()=>{document.removeEventListener("selectionchange",e)}},[u]);const f=e=>{e.preventDefault()},_=J(i),k=Y(i),x=i?.styles||{},v=null!=x.color&&""!==String(x.color).trim()?String(x.color).trim():Te.styles?.color??"#171717",w={width:"desktop"===a?"100%":364,backgroundColor:x.backgroundColor,color:v,fontFamily:x.fontFamily},S={maxWidth:"100%",width:"100%",backgroundColor:"transparent",..."mobile"===a&&!1!==i.scaleFontOnMobile?{fontSize:16}:{}};return l.jsxs("div",{className:"preview-main",children:[l.jsx(ml,{}),l.jsx("div",{className:"default-scrollbar",id:"preview",children:l.jsx("div",{className:"preview-content",style:w,children:l.jsx("div",{className:"margin-auto",style:S,children:r.length?l.jsxs("div",{className:"preview-column-stack",children:[y&&l.jsxs("div",{className:Go("block-drag-label-content preview-edge-drop-zone preview-edge-drop-zone-top","column"===h&&"ee-section-drop-preview"),"data-index":0,"data-position":"top",children:["column"===h?l.jsxs("div",{className:"ee-section-drop-slot-outline ee-section-drop-slot-outline-edge","aria-hidden":!0,children:[l.jsx("span",{className:"ee-section-drop-badge",children:o("container")}),l.jsx("span",{className:"ee-section-drop-hint",children:o("drag_section_here")})]}):null,l.jsx("div",{className:"absolute block-move-top",children:l.jsx("span",{className:"block-tools-drag_here",children:o("drag_block_here")})}),l.jsx("div",{className:"preview-edge-drop-hit","data-name":"dragTools","data-type":"drag-over-column","data-position":"top","data-index":0,onDragOver:f})]}),r.map((t,o)=>l.jsx(e.Fragment,{children:l.jsx(il,{block:t,blockIndex:o,clearStyles:n})},`${t?.id||"block"}-${o}`)),l.jsxs("div",{className:Go("relative block-drag-label-content","ee-bottom-stack-drop-slot",d&&!y&&"ee-bottom-stack-drop-slot--active"),"data-index":r.length,"data-position":"bottom",style:{minHeight:d&&!y?52:0},children:[d&&!y?l.jsx("div",{className:"ee-bottom-drop-slot-outline","aria-hidden":!0,children:l.jsx("span",{className:"ee-bottom-drop-slot-label",children:o("drag_block_here")})}):null,l.jsx("div",{className:"absolute block-move-bottom",children:l.jsx("span",{className:"block-tools-drag_here",children:o("drag_block_here")})}),d&&!y&&l.jsx("div",{"data-name":"dragTools","data-type":"drag-over-column","data-position":"bottom","data-index":r.length,onDragOver:f,style:{position:"absolute",inset:0,zIndex:106,pointerEvents:"auto"}})]}),y&&l.jsxs("div",{className:Go("block-drag-label-content preview-edge-drop-zone preview-edge-drop-zone-bottom","column"===h&&"ee-section-drop-preview"),"data-index":r.length,"data-position":"bottom",children:["column"===h?l.jsxs("div",{className:"ee-section-drop-slot-outline ee-section-drop-slot-outline-edge","aria-hidden":!0,children:[l.jsx("span",{className:"ee-section-drop-badge",children:o("container")}),l.jsx("span",{className:"ee-section-drop-hint",children:o("drag_section_here")})]}):null,l.jsx("div",{className:"absolute block-move-bottom",children:l.jsx("span",{className:"block-tools-drag_here",children:o("drag_block_here")})}),l.jsx("div",{className:"preview-edge-drop-hit","data-name":"dragTools","data-type":"drag-over-column","data-position":"bottom","data-index":r.length,onDragOver:f})]})]}):l.jsx("div",{"data-name":"dragEmpty",className:"start-to-add ee-empty-document",style:{width:k?"100%":_,maxWidth:"100%"},"data-type":"empty-block",onDragOver:f,children:l.jsxs("div",{className:"ee-empty-document-inner",children:[l.jsxs("svg",{className:"ee-empty-document__icon",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:[l.jsx("rect",{x:"6",y:"22",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),l.jsx("rect",{x:"24",y:"22",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),l.jsx("rect",{x:"6",y:"6",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),l.jsx("rect",{x:"28",y:"4",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"})]}),l.jsx("p",{className:"ee-empty-document__title",children:o("drop_content_here")}),l.jsx("p",{className:"ee-empty-document__hint",children:o("drop_content_hint")})]})})})})})]})},hl=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,bl=/^rgba?\(\s*(\d{1,3})\s*[, ]\s*(\d{1,3})\s*[, ]\s*(\d{1,3})(?:\s*[,/]\s*([0-9.]+))?\s*\)$/i,yl=e=>(e=>Math.max(0,Math.min(255,Number.isFinite(e)?Math.round(e):0)))(e).toString(16).padStart(2,"0"),fl=(e,t="#000000")=>{const n=String(e??"").trim();if(!n)return t;if("transparent"===n.toLowerCase())return t;if(/^[0-9a-f]{3}$/i.test(n)){return`#${n.toLowerCase().split("").map(e=>e+e).join("")}`}if(/^[0-9a-f]{6}$/i.test(n))return`#${n.toLowerCase()}`;if(hl.test(n)){if(4===n.length){const[,e,t,o]=n;return`#${e}${e}${t}${t}${o}${o}`.toLowerCase()}return n.toLowerCase()}const o=n.match(bl);if(o){const e=Number(o[1]),t=Number(o[2]),n=Number(o[3]);return`#${yl(e)}${yl(t)}${yl(n)}`.toLowerCase()}const a=(e=>{if("undefined"==typeof document)return null;const t=document.createElement("span");if(t.style.color="",t.style.color=String(e??"").trim(),!t.style.color)return null;const n=t.style.color.match(bl);if(!n)return null;const o=Number(n[1]),a=Number(n[2]),l=Number(n[3]);return`#${yl(o)}${yl(a)}${yl(l)}`.toLowerCase()})(n);return a||t},_l={backgroundImage:"linear-gradient(45deg, #1f1f1f 25%, transparent 25%), linear-gradient(-45deg, #1f1f1f 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #1f1f1f 75%), linear-gradient(-45deg, transparent 75%, #1f1f1f 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 0 4px, 4px -4px, -4px 0px"},kl=({color:n,setColor:o,fallbackColor:a="#ffffff",variant:i="field"})=>{const[s,c]=e.useState(!1),d=fl(n,a),u=d,p=l.jsx("div",{className:"select-none ee-color-picker-popover",children:l.jsx(r.ChromePicker,{disableAlpha:!0,color:d,style:{boxShadow:"none"},onChange:e=>o({hex:fl(e?.hex,a)})})});return l.jsx(t.Popover,{zIndex:1070,getPopupContainer:()=>document.querySelector(".right-settings")||document.body,content:p,trigger:"click",open:s,onOpenChange:c,children:"field"===i?l.jsxs("button",{type:"button",className:"ee-color-picker-field-trigger","aria-label":"Open color picker",children:[l.jsx("span",{className:"ee-color-picker-field-swatch",style:{background:"transparent"===u?void 0:u,..."transparent"===u?_l:{}}}),l.jsx("span",{className:"ee-color-picker-field-hex","aria-hidden":!0,children:d.toUpperCase()}),l.jsx("span",{className:"ee-color-picker-field-chevron","aria-hidden":!0})]}):l.jsx("button",{type:"button",className:"color-picker-button","aria-label":"Open color picker",style:{background:u,backgroundImage:"transparent"===u?_l.backgroundImage:void 0,backgroundSize:"transparent"===u?_l.backgroundSize:void 0,backgroundPosition:"transparent"===u?_l.backgroundPosition:void 0}})})},xl=[{key:"paddingTop",suffix:"T"},{key:"paddingRight",suffix:"R"},{key:"paddingBottom",suffix:"B"},{key:"paddingLeft",suffix:"L"}],vl=({padding:e,onChange:n,min:o=0,disabled:a})=>{const{t:i}=Zo(),r=t=>o=>{const a="number"==typeof o?o:null==o||""===o?0:Number(o);Number.isNaN(a)||n({...e,[t]:a})};return l.jsx("div",{className:"ee-settings-padding-grid",role:"group","aria-label":i("padding_settings"),children:xl.map(({key:n,suffix:i})=>l.jsx(t.InputNumber,{min:o,step:1,value:e?.[n]??0,onChange:r(n),disabled:a,addonAfter:l.jsx("span",{className:"ee-settings-padding-addon-side","aria-hidden":!0,children:i}),className:"input-width ee-settings-input-affix ee-padding-side-input-num",onFocus:e=>e?.target?.select?.()},n))})},wl=e=>l.jsx(t.Switch,{...e,className:`ee-settings-switch ${e.className||""}`.trim()}),Sl=({padding:a,setPadding:i,showLinkSides:r=!0})=>{const{t:s}=Zo(),[c,d]=e.useState(!1);return r?l.jsxs("div",{className:"padding-settings ee-padding-settings-v2",children:[c?l.jsx(t.InputNumber,{min:0,step:1,addonAfter:"px",className:"input-width ee-settings-input-affix ee-padding-linked-input-num",value:a?.paddingTop??0,onChange:e=>{const t="number"==typeof e?e:0;i({...a,paddingTop:t,paddingRight:t,paddingBottom:t,paddingLeft:t})},onFocus:e=>e?.target?.select?.()}):l.jsx(vl,{padding:a,onChange:i,min:0}),l.jsxs("div",{className:"ee-settings-row ee-padding-link-sides-row padding-settings-link-row",children:[l.jsxs("span",{className:"ee-padding-link-sides-label",children:[s("padding_link_sides_label"),l.jsx(t.Tooltip,{title:s("padding_link_sides_tooltip"),children:l.jsx("span",{className:"ee-help-icon ee-padding-link-sides-help","aria-label":s("padding_link_sides_tooltip"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]}),l.jsx(wl,{checked:c,onChange:d})]})]}):l.jsx("div",{className:"padding-settings ee-padding-settings-v2 ee-padding-settings-plain",children:l.jsx(vl,{padding:a,onChange:i,min:0})})};function jl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cl,Nl={exports:{}};Cl=Nl,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var a=arguments[t];a&&(e=o(e,n(a)))}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var a="";for(var l in n)e.call(n,l)&&n[l]&&(a=o(a,l));return a}function o(e,t){return t?e?e+" "+t:e+t:e}Cl.exports?(t.default=t,Cl.exports=t):window.classNames=t}();var Il=jl(Nl.exports);const Al=()=>{const{t:e}=Zo(),t=dl(e),n=(e=>{const t={desktop:{textAlign:"center",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},n={key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},o=o=>({name:e("content"),key:"content",width:o,styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]});return{full:{columns:1,type:"full",children:[{name:e("content"),key:"content",width:"100%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}]},"1-1":{columns:2,type:"1-1",children:Array.from({length:2}).map(()=>({name:e("content"),key:"content",width:"50%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"1-1-1":{columns:3,type:"1-1-1",children:Array.from({length:3}).map(()=>({name:e("content"),key:"content",width:"33.3%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"1-2-1":{columns:3,type:"1-2-1",children:Array.from({length:3}).map((e,t)=>o(1===t?"50%":"25%"))},"2-1-1":{columns:3,type:"2-1-1",children:Array.from({length:3}).map((e,t)=>o(0===t?"50%":"25%"))},"1-1-2":{columns:3,type:"1-1-2",children:Array.from({length:3}).map((e,t)=>o(2===t?"50%":"25%"))},"1-1-1-1":{columns:4,type:"1-1-1-1",children:Array.from({length:4}).map(()=>({name:e("content"),key:"content",width:"25%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"1-2":{columns:2,type:"1-2",children:Array.from({length:2}).map((e,t)=>o(0===t?"33.3%":"66.6%"))},"2-1":{columns:2,type:"2-1",children:Array.from({length:2}).map((e,t)=>o(0===t?"66.6%":"33.3%"))},"1-3":{columns:2,type:"1-3",children:Array.from({length:2}).map((e,t)=>o(0===t?"25%":"75%"))},"3-1":{columns:2,type:"3-1",children:Array.from({length:2}).map((e,t)=>o(0===t?"75%":"25%"))},"2-3":{columns:2,type:"2-3",children:Array.from({length:2}).map((e,t)=>o(0===t?"40%":"60%"))},"3-2":{columns:2,type:"3-2",children:Array.from({length:2}).map((e,t)=>o(0===t?"60%":"40%"))},"2-4-2-4":{columns:4,type:"2-4-2-4",children:Array.from({length:4}).map((o,a)=>({name:e("content"),key:"content",width:a%2==0?"16.6%":"33.3%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"4-2-4-2":{columns:4,type:"4-2-4-2",children:Array.from({length:4}).map((o,a)=>({name:e("content"),key:"content",width:a%2==0?"33.3%":"16.6%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))}}})(e),o=(e=>t=>{const n={id:P(),name:e("drag_block_here"),key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}};return{id:P(),name:e("container"),key:"column",type:"full",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},children:[{id:P(),name:e("content"),key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[t||n]}]}})(e);return{blockConfigsList:t,columnsSetting:n,getColumnConfig:o}},Ll=({children:e,className:t=""})=>l.jsx("h3",{className:`ee-settings-section-title ${t}`.trim(),children:e}),Tl=e=>e?l.jsx("span",{style:{color:"var(--ee-text-tertiary)",fontWeight:400,fontSize:11,marginLeft:6},children:"optional"}):null,Bl=({label:e,hint:t,optional:n,children:o,className:a="",layout:i="stack"})=>l.jsxs("div",{className:`ee-settings-field ${"toggle"===i?"ee-settings-field--toggle":""} ${a}`.trim(),children:["toggle"===i&&e?l.jsxs("div",{className:"ee-settings-row ee-settings-field-toggle-inner",children:[l.jsxs("span",{className:"ee-settings-row-label",children:[e,Tl(n)]}),o]}):l.jsxs(l.Fragment,{children:[e?l.jsxs("div",{className:"ee-settings-field-label",children:[e,Tl(n)]}):null,o]}),t?l.jsx("div",{style:{fontSize:11,color:"var(--ee-text-tertiary)",lineHeight:1.5},children:t}):null]}),$l=({widths:e})=>{const t=e.reduce((e,t)=>e+parseFloat(t),0)||1;return l.jsx("div",{style:{display:"flex",height:18,gap:2,borderRadius:2,overflow:"hidden",width:36,flexShrink:0},children:e.map((e,n)=>l.jsx("div",{style:{flex:parseFloat(e)/t,background:"rgba(216, 254, 145, 0.5)",borderRadius:1}},n))})},Rl=[{key:"full",labelKey:"column_preset_1_col",widths:["100%"]},{key:"1-1",labelKey:"column_preset_equal_2",widths:["50%","50%"]},{key:"1-1-1",labelKey:"column_preset_equal_3",widths:["33.3%","33.3%","33.3%"]},{key:"1-1-1-1",labelKey:"column_preset_equal_4",widths:["25%","25%","25%","25%"]},{key:"1-2",labelKey:"column_preset_1_2",widths:["33.3%","66.6%"]},{key:"2-1",labelKey:"column_preset_2_1",widths:["66.6%","33.3%"]},{key:"1-3",labelKey:"column_preset_1_3",widths:["25%","75%"]},{key:"3-1",labelKey:"column_preset_3_1",widths:["75%","25%"]},{key:"2-3",labelKey:"column_preset_2_3",widths:["40%","60%"]},{key:"3-2",labelKey:"column_preset_3_2",widths:["60%","40%"]},{key:"1-2-1",labelKey:"column_preset_1_2_1",widths:["25%","50%","25%"]},{key:"2-1-1",labelKey:"column_preset_2_1_1",widths:["50%","25%","25%"]},{key:"1-1-2",labelKey:"column_preset_1_1_2",widths:["25%","25%","50%"]},{key:"2-4-2-4",labelKey:"column_preset_2_4_2_4",widths:["16.6%","33.3%","16.6%","33.3%"]},{key:"4-2-4-2",labelKey:"column_preset_4_2_4_2",widths:["33.3%","16.6%","33.3%","16.6%"]}],Pl=()=>{const{blockMap:a,rootOrder:i,setBlocks:r,currentItem:s,setCurrentItem:c,previewMode:d}=e.useContext($e),{t:u}=Zo(),{columnsSetting:p}=Al();if(!s?.data||"column"!==s.data.key)return null;if(Va(s.data)!==qa)return null;const m=s.data.children||[],g=m.length,h=e=>{const{blockMap:t}=Z([e]),n={...a,...t};r(n,i,`edit_${Date.now()}`),c({...s,data:e})},b=e=>{const t=p[e.key]||p.full;if(!t)return;const n=s.data.children||[],o=(t.children||[]).map((e,t)=>{const o=n[t];if(o)return{...o,key:e.key,name:e.name,width:e.width,styles:B(e.styles??o.styles),children:o.children};const a=P();return{...e,id:a}}),a=B(s.data);a.children=o,h(a)},y=(()=>{const e="desktop"===d?s.data.styles?.desktop:{...s.data.styles?.desktop,...s.data.styles?.mobile},t=e?.columnGap??e?.column_gap??0;return"number"==typeof t?t:parseInt(String(t).replace("px",""),10)||0})(),f=m.reduce((e,t)=>e+parseFloat(t.width||"100"),0)||1,_=Rl.filter(e=>p[e.key]);return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:u("grid_settings")}),l.jsxs("div",{className:"ee-settings-row ee-columns-count-row",children:[l.jsx("span",{className:"ee-padding-link-sides-label",children:u("columns")}),l.jsxs("div",{className:"ee-columns-stepper",children:[l.jsx("button",{type:"button",className:"ee-col-stepper-btn",disabled:g<=1,onClick:()=>{const e=Math.max(1,g-1),t=Rl.find(t=>t.widths.length===e);t&&b(t)},"aria-label":u("columns"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faMinus,style:{fontSize:10}})}),l.jsx("span",{className:"ee-columns-stepper-value",children:g}),l.jsx("button",{type:"button",className:"ee-col-stepper-btn",disabled:g>=4,onClick:()=>{const e=Math.min(4,g+1),t=Rl.find(t=>t.widths.length===e&&t.key.startsWith("1-1"));if(t)b(t);else{const t=Rl.find(t=>t.widths.length===e);t&&b(t)}},"aria-label":u("columns"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faPlus,style:{fontSize:10}})})]})]}),l.jsx(Ll,{children:u("presets")}),l.jsx("div",{className:"ee-columns-preset-grid",children:_.map(e=>{const t=g===e.widths.length&&m.every((t,n)=>{const o=parseFloat(t.width||"0"),a=parseFloat(e.widths[n]||"0");return Math.abs(o-a)<1});return l.jsxs("button",{type:"button",className:Il("ee-columns-preset-btn",t&&"ee-columns-preset-btn--active"),onClick:()=>b(e),children:[l.jsx($l,{widths:e.widths}),l.jsx("span",{children:u(e.labelKey)})]},e.key)})}),g>1&&l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:u("column_sizes")}),l.jsx("div",{className:"ee-columns-width-sliders",children:m.map((e,t)=>{const n=(e=>{if("string"!=typeof e)return 1;const t=parseFloat(e.replace("%",""));return isNaN(t)?1:t})(e.width)/f*100;return l.jsxs("div",{className:"ee-columns-width-slider-row",children:[l.jsxs("span",{className:"ee-columns-width-col-label",children:[u("col")," ",t+1]}),l.jsx("input",{type:"range",min:10,max:90,step:1,value:Math.round(n),onChange:e=>{const n=parseInt(e.target.value,10),o=t===g-1?0:g-1,a=100-n-m.reduce((e,n,a)=>a===t||a===o?e:e+Math.round(parseFloat(n.width||"0")/f*100),0),l=B(s.data);l.children=l.children.map((e,l)=>l===t?{...e,width:`${n}%`}:l===o?{...e,width:`${Math.max(10,a)}%`}:e),h(l)},className:"ee-columns-width-range"}),l.jsxs("span",{className:"ee-columns-width-pct",children:[Math.round(n),"%"]})]},e.id||t)})})]}),l.jsx(Ll,{children:u("gaps")}),l.jsx(Bl,{label:u("column_gap"),children:l.jsx(t.InputNumber,{min:0,max:60,className:"input-width ee-settings-input-affix",addonAfter:"px",value:y,onChange:e=>(e=>{const t=B(s.data);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles[d]||(t.styles[d]={}),Object.assign(t.styles[d],e),h(t)})({columnGap:e??0})})})]})},Ml=({items:e,value:t,onChange:n,size:o="md",className:a="","aria-label":i})=>l.jsx("div",{className:`ee-settings-segmented ${"sm"===o?"ee-settings-segmented--sm":""} ${a}`.trim(),role:"group","aria-label":i,children:e.map(e=>{const o="string"==typeof e?e:e.value,a="string"==typeof e?e:e.label,i="object"==typeof e&&e.icon?e.icon:null,r=o===t,s="object"==typeof e&&e.iconOnly;return l.jsxs("button",{type:"button",title:"string"==typeof a?a:void 0,className:`ee-settings-segmented-btn${r?" ee-settings-segmented-btn--active":""}${s?" ee-settings-segmented-btn--icon-only":""}`,onClick:()=>n&&n(o),children:[i,a]},String(o))})}),Fl=e=>{if(!e||"string"!=typeof e)return!1;try{const t=new URL(e);return/\/knowledge-base\/products$/i.test(t.pathname.replace(/\/$/,""))}catch{return/knowledge-base\/products\/?$/i.test(String(e).trim().replace(/\/$/,""))}},Ul=e=>{if(!e||"object"!=typeof e)return null;const t=null!=e.id?String(e.id):null!=e.resourceId?String(e.resourceId):"";if(!t)return null;const n=e.price,o="number"==typeof n?n:parseFloat(String(n??"").replace(/,/g,""));return{id:t,name:e.name??"",description:ze(e.description),image:e.image_url??e.image??"",link:e.url??"",price:Number.isFinite(o)?o:0,currency:e.currency??"USD",old_price:null!=e.old_price?e.old_price:null,new_price:null!=e.new_price?e.new_price:null,resourceId:e.resourceId,source:e.source}},Dl=async(e,t,n={},{page:o=1,limit:a=20,search:l=""}={})=>{if(!e)return null;try{if(Fl(e)){if(!t)return null;const i=e.replace(/\/$/,""),r=new URL(`${i}/${encodeURIComponent(t)}`);r.searchParams.set("page",String(o)),r.searchParams.set("limit",String(a)),r.searchParams.set("search",l??"");const s=await fetch(r.toString(),{method:"GET",headers:{"Content-Type":"application/json",...n}});if(!s.ok)return console.error("[API Service] KB products fetch failed:",s.status,s.statusText),null;const c=await s.json(),d=Array.isArray(c.data)?c.data:[];return{products:d.map(Ul).filter(Boolean),meta:c.meta&&"object"==typeof c.meta?c.meta:{}}}const i=new URL(e);t&&i.searchParams.append("companyId",t);const r=await fetch(i.toString(),{method:"GET",headers:{"Content-Type":"application/json",...n}});if(!r.ok)return console.error("[API Service] Products fetch failed:",r.status,r.statusText),null;const s=await r.json();if(!1===s.success)return console.error("[API Service] Products API returned error:",s.error),null;const c=s.data?.products??[],d=Array.isArray(c)?c.map(e=>e&&"object"==typeof e?{...e,description:ze(e.description)}:e):[];return Array.isArray(d)&&0!==d.length?{products:d,meta:{hasMore:!1,hasProducts:!0}}:{products:[],meta:{hasMore:!1,hasProducts:!1}}}catch(e){return console.error("[API Service] Error fetching products:",e),null}},El={};function zl(){return"undefined"!=typeof document?document.body:null}function Ol(e){if(!e)return"";const t=e.currency??"",n=e.price?.amount??e.price??"";return`${e.name} — ${t} ${n}`.trim()}function Wl(e,t){const n=new Map;return[...e,...t].forEach(e=>{e&&e.id&&n.set(e.id,e)}),Array.from(n.values())}function Hl({apiConfig:n,templateData:o,value:a,selectedProduct:i,onChange:r,placeholder:s,staticProductList:c=[],getPopupContainer:d}){const{t:u}=Zo(),p=n?.productsEndpoint,m=n?.companyId??o?.companyId,g=e.useMemo(()=>{const e=n?.headers;return e&&"object"==typeof e?e:El},[n?.headers]),h=Boolean(p&&m)&&Fl(p),[b,y]=e.useState([]),[f,_]=e.useState({}),[k,x]=e.useState(!1),[v,w]=e.useState(""),[S,j]=e.useState(""),C=e.useRef(null),N=e.useRef(0),I=e.useRef(1),A=e.useRef(""),L=e.useRef(!1),T=e.useRef(""),B=e.useCallback(async(e,t,n)=>{if(!h)return;const o=(t??"").trim();if(n){const t=`${o}::${e}`;if(L.current&&T.current===t)return;L.current=!0,T.current=t}const a=++N.current;x(!0);try{const l=await Dl(p,m,g,{page:e,limit:20,search:o});if(a!==N.current)return;if(!l)return n||(y([]),j((t??"").trim())),void _({});_(l.meta||{}),y(e=>n?Wl(e,l.products):l.products),I.current=e}finally{n&&(L.current=!1,T.current=""),a===N.current&&x(!1)}},[h,p,m,g]),$=e.useCallback(async e=>{if(!h)return;const t=(e??"").trim();L.current=!1,T.current="";const n=++N.current;x(!0);try{if(""!==t){const e=await Dl(p,m,g,{page:1,limit:20,search:t});if(n!==N.current)return;return e?(_(e.meta||{}),y(e.products),j(t),void(I.current=1)):(y([]),_({}),j(t),void(I.current=1))}let e=1,o=[],a={};for(;o.length<10&&e<=15;){const t=await Dl(p,m,g,{page:e,limit:20,search:""});if(n!==N.current)return;if(!t?.products?.length)break;if(o=Wl(o,t.products),a=t.meta||{},I.current=e,!a.hasMore)break;e+=1}_(a),y(o),j("")}finally{n===N.current&&x(!1)}},[h,p,m,g]),R=e.useCallback(()=>{if(!h||k||!f?.hasMore)return;const e=I.current+1;B(e,A.current,!0)},[h,k,f?.hasMore,B]),P=d??zl,M=e.useCallback(e=>l.jsxs("div",{children:[e,k&&b.length>0&&l.jsxs("div",{className:"ee-kb-product-select-footer",children:[l.jsx(t.Spin,{size:"small"})," ",l.jsx("span",{children:u("loading")})]}),!k&&f?.hasMore&&l.jsx("div",{className:"ee-kb-product-select-footer",children:l.jsx("button",{type:"button",className:"ee-kb-product-select-load-more",onClick:R,children:u("load_more_products")})})]}),[k,b.length,f?.hasMore,R,u]),F=e.useMemo(()=>{const e=h?b:c;return Wl(i?.id?[i]:[],e)},[h,b,c,i]),U=e.useMemo(()=>F.map(e=>({value:e.id,label:Ol(e)})),[F]),D=e=>{if(!e)return r(null),void(h&&(clearTimeout(C.current),w(""),A.current="",I.current=1,j(""),$("")));const t=F.find(t=>t.id===e)||c.find(t=>t.id===e);r(t||null)},E="ee-kb-product-select-dropdown";return h?l.jsx(t.Select,{className:"ee-stack-control ee-kb-product-select",value:a??void 0,placeholder:s,style:{width:"100%"},virtual:!0,dropdownMatchSelectWidth:!0,listHeight:320,listItemHeight:32,dropdownClassName:E,getPopupContainer:P,onChange:D,allowClear:!0,showSearch:!0,filterOption:!1,searchValue:v,onSearch:e=>{if(!h)return;const t=e??"";w(t);const n=t.trim();if(clearTimeout(C.current),""===n)return A.current="",I.current=1,void $("");C.current=setTimeout(()=>{A.current=n,I.current=1,$(n)},400)},onOpenChange:e=>{clearTimeout(C.current),e?(L.current=!1,T.current="",w(""),A.current="",I.current=1,$("")):(L.current=!1,T.current="",w(""),A.current="")},notFoundContent:k?l.jsxs("span",{className:"ee-kb-product-select-loading",children:[l.jsx(t.Spin,{size:"small"})," ",u("loading")]}):U.length>0?null:l.jsx("span",{className:"ee-kb-product-select-empty",children:""!==S.trim()?u("no_products_matching_search"):u("no_product_found")}),options:U,dropdownRender:M}):l.jsx(t.Select,{className:"ee-stack-control",value:a??void 0,placeholder:s,style:{width:"100%"},virtual:!0,dropdownMatchSelectWidth:!0,listHeight:320,listItemHeight:32,dropdownClassName:E,getPopupContainer:P,onChange:D,allowClear:!0,showSearch:!0,optionFilterProp:"label",options:c.map(e=>({value:e.id,label:Ol(e)}))})}const Kl=()=>{const{previewMode:t,currentItem:n,blockMap:o,rootOrder:a,setBlocks:i,setCurrentItem:r}=e.useContext($e),s=e=>{let t;if("column"===e.key){const{blockMap:n}=Z([e]);t={...o,...n}}else t={...o,[n.id]:e};i(t,a,`edit_${(new Date).getTime()}`),r({...n,data:e})};return{findStyleItem:(e,n)=>{let o=e[t][n];return o||(o=e.desktop[n]),o},cardItemElement:(e,t)=>l.jsxs("div",{className:"card-item",children:[l.jsx("div",{className:"card-item-title",children:e}),l.jsx("div",{children:t})]}),updateItemStyles:s,colorChange:e=>({hex:o})=>{const a=B(n.data);a.styles[t][e]=o,s(a)},paddingChange:e=>{const o=B(n.data);o.styles[t]={...o.styles[t],...e},s(o)},otherStylesChange:(e,o)=>{const a=B(n.data);a.styles||(a.styles={desktop:{},mobile:{}}),a.styles[t]||(a.styles[t]={}),a.styles[t][e]=o,"desktop"!==t&&(a.styles.desktop[e]=o),s(a)},inputChange:e=>o=>{const a=B(n.data);a.styles||(a.styles={desktop:{},mobile:{}}),a.styles[t]||(a.styles[t]={}),a.styles[t][e]=o,"desktop"!==t&&(a.styles.desktop[e]=o),s(a)}}};var Vl={presets:[{id:"preset_header",presetName:"Header",nameKey:"preset_header",containerType:"header",block:{name:"Container",key:"column",type:"full",containerType:"header",headerLayout:"logo_center_nav_below",showHeaderBanner:!1,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",headerLogoSlot:!0,src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:16,paddingBottom:8,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{width:"30%"},mobile:{}}},{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:8,paddingBottom:16,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0},{name:"Image",key:"image",headerBannerSlot:!0,hidden:!0,src:"{{HeroBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Divider",key:"divider",headerBannerDividerSlot:!0,hidden:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}}]}]}},{id:"preset_header_centered",presetName:"Header (Centered)",nameKey:"preset_header_centered",containerType:"header",block:{name:"Container",key:"column",type:"full",containerType:"header",headerLayout:"logo_center_nav_below",showHeaderBanner:!1,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",headerLogoSlot:!0,src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:16,paddingBottom:8,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{width:"30%"},mobile:{}}},{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:8,paddingBottom:16,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0},{name:"Image",key:"image",headerBannerSlot:!0,hidden:!0,src:"{{HeroBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Divider",key:"divider",headerBannerDividerSlot:!0,hidden:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}}]}]}},{id:"preset_header_nav_only",presetName:"Nav Bar",nameKey:"preset_header_nav_only",containerType:"header",block:{name:"Container",key:"column",type:"full",containerType:"header",headerLayout:"nav_only",showHeaderBanner:!1,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0}]}]}},{id:"navigation_bar",presetName:"Navigation Bar",nameKey:"preset_navigation_bar",containerType:"none",block:{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:25,paddingBottom:15,paddingLeft:5,paddingRight:5,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:14,fontFamily:"Verdana",color:"#333333",linkColor:"#333333",paddingTop:5,paddingBottom:5,paddingLeft:8,paddingRight:8,letterSpacing:0,fontWeight:"normal"},mobile:{}},isPreset:!0}},{id:"product_single",nameKey:"preset_product_single",containerType:"product",presetName:"Product",block:{name:"Container",key:"column",type:"full",containerType:"product",mainProductLayout:"image_stacked",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"main",columnProducts:[{id:"product-1",name:"Abundance Butterfly Diamond Ring",description:"The Maia Diamond Ring features round diamonds set along a delicate gold band, creating a refined and minimalistic look. Its versatile design makes it perfect for everyday wear or for layering with other rings.",image:"https://www.psylish.com/cdn/shop/files/IMG_4632.jpg?v=1773123202&width=1220",link:"https://www.psylish.com",price:2e3,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"",contentStyles:{desktop:{paddingTop:null,paddingBottom:null,paddingLeft:null,paddingRight:null,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 20px; font-family: sans-serif"><p>{{ProductName}}</p></span>',type:"h2",contentType:"static",styles:{desktop:{fontSize:20,fontFamily:"sans-serif",lineHeight:"120%",paddingTop:12,paddingBottom:null,paddingLeft:12,paddingRight:12,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 16px; font-family: sans-serif">{{ProductPriceDisplay}}<br></span>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:null,paddingBottom:6,paddingLeft:12,paddingRight:12,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:"<p>{{ProductDescription}}</p>",type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"120%",paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Shop Now",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:12,paddingBottom:12,paddingLeft:null,paddingRight:null},mobile:{}},styles:{desktop:{width:"100%",fontSize:16,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:null,paddingRight:null,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}},{name:"Divider",key:"divider",contentStyles:{desktop:{paddingTop:2,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}}]}]}},{id:"product_image_left",presetName:"Product (Image Left)",nameKey:"preset_product_image_left",containerType:"product",block:{name:"Container",key:"column",type:"full",containerType:"product",productRole:"main",mainProductLayout:"image_left",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:12,paddingLeft:12,paddingRight:12,paddingBottom:12,contentBackground:"#fff"},mobile:{}},isPreset:!0,columnProducts:[{id:"product-1",name:"ADIDAS | KID'S STAN SMITH",description:"Elevate your space with a thoughtfully crafted piece that blends function and style. Whether at home or on the go, it's the kind of essential you'll wonder how you lived without.",image:"https://www.psylish.com/cdn/shop/files/IMG_4632.jpg?v=1773123202&width=1220",link:"https://www.psylish.com",price:90,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"2-3",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Content",key:"content",width:"40%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:8,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Product image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}}]},{name:"Content",key:"content",width:"60%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:12,paddingLeft:8,paddingRight:0,paddingBottom:12,contentBackground:"transparent"},mobile:{}},children:[{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;font-weight:700;letter-spacing:0.05em;text-transform:uppercase;margin:0 0 4px">{{ProductName}}</p>',type:"h2",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:4,paddingLeft:0,paddingRight:0,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;color:#6b7280;margin:0 0 10px">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#374151;line-height:1.5">{{ProductDescription}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"150%",paddingTop:0,paddingBottom:14,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Buy Now",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"left",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{width:"auto",fontSize:13,lineHeight:"140%",borderRadius:2,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:20,paddingRight:20,color:"#fff",display:"inline-block"},mobile:{}}}]}]}]}]}},{id:"product_two_column",presetName:"Additional Products",nameKey:"preset_product_two_column",containerType:"product",block:{name:"Container",key:"column",type:"1-1",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,columns:2,columnProducts:[null,null],children:[{name:"Content",key:"content",width:"50%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:0,paddingRight:0,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-2",name:"Heartline Diamond Ring",description:"The Sariah Diamond Earrings feature round diamonds in a classic hoop design that curves elegantly around the lobe.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_15.png?v=1770880382&width=1220",link:"https://www.psylish.com/",price:1e3,currency:"USD",old_price:1200,new_price:1e3}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 20px; font-family: Arial"><p>{{ProductName}}</p></span>',type:"h2",contentType:"static",styles:{desktop:{fontSize:20,fontFamily:"Arial",lineHeight:"140%",paddingTop:12,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 16px; font-family: Arial">{{ProductPriceDisplay}}<br></span>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"Arial",lineHeight:"140%",paddingTop:2,paddingBottom:2,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:"<p>{{ProductDescription}}</p>",type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:12,paddingBottom:12,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Add to Cart",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:12,paddingBottom:12,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{width:"100%",fontSize:16,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]},{name:"Content",key:"content",width:"50%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:0,paddingRight:0,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-3",name:"Lynx Heart Diamond Ring",description:"The Sariah Diamond Earrings feature round diamonds in a classic hoop design that curves elegantly around the lobe.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_48.png?v=1770881768&width=1220",link:"https://www.psylish.com/",price:900,currency:"USD",old_price:1200,new_price:900}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 20px; font-family: Arial"><p>{{ProductName}}</p></span>',type:"h2",contentType:"static",styles:{desktop:{fontSize:20,fontFamily:"Arial",lineHeight:"140%",paddingTop:12,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 16px; font-family: Arial">{{ProductPriceDisplay}}<br></span>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"Arial",lineHeight:"140%",paddingTop:2,paddingBottom:2,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:"<p>{{ProductDescription}}</p>",type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:12,paddingBottom:12,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Add to Cart",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:12,paddingBottom:12,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{width:"100%",fontSize:16,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:20,paddingRight:20,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]}]}},{id:"product_three_column",presetName:"Products (3 Column)",nameKey:"preset_product_three_column",containerType:"product",block:{name:"Container",key:"column",type:"1-1-1",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,columns:3,columnProducts:[null,null,null],children:[{name:"Content",key:"content",width:"33.3%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-4",name:"Diamond Ring",description:"Elegant diamond ring for everyday wear.",image:"https://www.psylish.com/cdn/shop/files/IMG_4632.jpg?v=1773123202&width=1220",link:"https://www.psylish.com",price:1500,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;font-weight:bold;margin:0">{{ProductName}}</p>',type:"h3",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:8,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#6b7280;margin:0">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"View",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:6,paddingBottom:8,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:13,lineHeight:"140%",borderRadius:3,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]},{name:"Content",key:"content",width:"33.3%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-5",name:"Sapphire Bracelet",description:"Delicate bracelet with sapphire stones.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_15.png?v=1770880382&width=1220",link:"https://www.psylish.com/",price:750,currency:"USD",old_price:900,new_price:750}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;font-weight:bold;margin:0">{{ProductName}}</p>',type:"h3",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:8,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#6b7280;margin:0">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"View",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:6,paddingBottom:8,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:13,lineHeight:"140%",borderRadius:3,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]},{name:"Content",key:"content",width:"33.3%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-6",name:"Pearl Necklace",description:"Classic pearl necklace for timeless elegance.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_48.png?v=1770881768&width=1220",link:"https://www.psylish.com/",price:600,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;font-weight:bold;margin:0">{{ProductName}}</p>',type:"h3",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:8,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#6b7280;margin:0">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"View",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:6,paddingBottom:8,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:13,lineHeight:"140%",borderRadius:3,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]}]}},{id:"preset_discount",presetName:"Discount",nameKey:"preset_discount",containerType:"discount",block:{name:"Container",key:"column",type:"full",containerType:"discount",discountVariant:"card",showTitle:!0,discountTitle:"{{DiscountValue}} off your first order",discountCode:"{{DiscountCode}}",titleSize:22,titleWeight:"600",codeSize:16,codeSpacing:.08,codeBorder:"dashed",codeBorderWidth:1.5,codeBg:"none",codeRadius:4,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:28,paddingLeft:24,paddingRight:24,paddingBottom:28,contentBackground:"#D8FE91"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Text",key:"text",text:'<p style="text-align:center;margin:0 0 0px"><span style="font-family:Arial;font-size:22px;font-weight:600;color:#171717">{{DiscountValue}} off your first order</span></p>',type:"h2",contentType:"static",styles:{desktop:{fontSize:22,fontFamily:"Arial",lineHeight:"130%",paddingTop:0,paddingBottom:14,paddingLeft:0,paddingRight:0,textAlign:"center",fontWeight:"600"},mobile:{}}},{name:"Text",key:"text",text:'<p style="text-align:center;margin:0"><span style="font-family:Arial;font-size:16px;letter-spacing:0.08em;color:#171717">{{DiscountCode}}</span></p>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"Arial",lineHeight:"130%",paddingTop:10,paddingBottom:10,paddingLeft:28,paddingRight:28,textAlign:"center",borderTopStyle:"dashed",borderBottomStyle:"dashed",borderLeftStyle:"dashed",borderRightStyle:"dashed",borderTopColor:"#171717",borderBottomColor:"#171717",borderLeftColor:"#171717",borderRightColor:"#171717",borderTopWidth:"1.5px",borderBottomWidth:"1.5px",borderLeftWidth:"1.5px",borderRightWidth:"1.5px",borderRadius:"4px",display:"block",width:"fit-content",maxWidth:"100%",marginLeft:"auto",marginRight:"auto"},mobile:{}}}]}],discountAlign:"center",discountGap:14}},{id:"preset_discount_simple",presetName:"Discount (simple line)",nameKey:"preset_discount_simple",containerType:"discount",block:{name:"Container",key:"column",type:"full",containerType:"discount",discountVariant:"simple",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#ffa7aa"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Text",key:"text",text:'<div style="text-align: center;"><font face="Arial">Use <b>{{DiscountCode}}</b> for <b>{{DiscountValue}}</b> OFF. Expires on {{ValidUntil}}</font></div>',type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"120%",paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}}]}]}},{id:"preset_footer",presetName:"Footer",nameKey:"preset_footer",containerType:"footer",block:{name:"Container",key:"column",type:"full",containerType:"footer",footerUnifiedLayout:!1,showFooterBanner:!1,isPreset:!0,styles:{key:"column",desktop:{backgroundColor:"#f4f4f5",paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,contentBackground:"#ffffff",color:"#737373",linkColor:"",fontSize:12,textAlign:"center"},mobile:{}},children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",footerBannerSlot:!0,hidden:!0,src:"{{FooterBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Divider",key:"divider",footerBannerDividerSlot:!0,hidden:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},{name:"Image",key:"image",footerSlot:"logo",src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:4,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"30%"},mobile:{}}},{name:"Text",key:"text",footerSlot:"brand",hidden:!0,text:'<div style="text-align:center"><b>{{BrandName}}</b></div>',type:"p",contentType:"static",styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:8,paddingBottom:4,paddingLeft:12,paddingRight:12,textAlign:"center",fontWeight:"600"},mobile:{}}},{name:"Text",key:"text",footerSlot:"tagline",text:'<div style="text-align:center">{{Tagline}}</div>',type:"p",contentType:"static",styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:2,paddingBottom:2,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}},{name:"Text",key:"text",footerSlot:"address",hidden:!0,text:'<div style="text-align:center">{{Address}}</div>',type:"p",contentType:"static",styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:4,paddingBottom:4,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}},{name:"Social link",key:"social_link",footerSlot:"social",list:[],imageWidth:36,iconSize:"medium",iconColor:"gray",contentStyles:{desktop:{paddingTop:12,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}}},{name:"Menu",key:"menu",footerSlot:"secondary",hidden:!0,useNavigationLinks:!1,layoutMode:"nav-only",showLogo:!1,mobileLayout:"stack",linkGapPx:0,linkUnderline:!1,list:[{label:"Privacy",url:"#",target:"_self"},{label:"Terms",url:"#",target:"_self"}],separator:" · ",contentStyles:{desktop:{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",linkColor:"#737373",letterSpacing:0,fontWeight:"400",textTransform:"none"},mobile:{}},isPreset:!0},{name:"Menu",key:"menu",footerSlot:"unsubscribe",hidden:!0,useNavigationLinks:!1,layoutMode:"nav-only",showLogo:!1,mobileLayout:"stack",linkGapPx:0,linkUnderline:!1,list:[{label:"Unsubscribe",url:"{{unsubscribe_url}}",target:"_self"},{label:"Update preferences",url:"#",target:"_self"}],separator:" · ",contentStyles:{desktop:{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",linkColor:"#737373",letterSpacing:0,fontWeight:"400",textTransform:"none"},mobile:{}},isPreset:!0},{name:"Text",key:"text",footerSlot:"copyright",text:'<div style="text-align:center;font-size:11px;opacity:0.9">© 2026 {{BrandName}}</div>',type:"p",contentType:"static",styles:{desktop:{fontSize:11,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:8,paddingBottom:4,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}}]}]}}]};const Gl=new Set(["navigation_bar","preset_header_centered","preset_header_nav_only","product_image_left","product_three_column","preset_discount_simple"]);function ql(e){if(!e||"object"!=typeof e)return e;const t={...e,id:P()};return Array.isArray(t.children)&&(t.children=t.children.map(ql)),Array.isArray(t.columnProducts)&&(t.columnProducts=t.columnProducts.map(e=>e&&"object"==typeof e?{...e}:e)),t}function Jl(e){const t=Vl.presets.find(t=>t.id===e);return t?ql(JSON.parse(JSON.stringify(t.block))):null}const Yl=[{id:"dolor-sit-amet",name:"Dolor Sit Amet",description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",image:"https://plus.unsplash.com/premium_photo-1681711647066-ef84575c0d95?fm=jpg&q=30&w=300&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MXx8cHJvZHVjdCUyMHBob3RvZ3JhcGh5fGVufDB8fDB8fHww",link:"https://loremipsum.com/checkout/cart/12345",price:2e3,currency:"USD",old_price:2500,new_price:2e3},{id:"sample-2",name:"Sample Pearl Necklace",description:"Classic strand of lustrous freshwater pearls with a sterling silver clasp. Timeless elegance for any outfit.",image:"https://picsum.photos/seed/necklace2/200/200",link:"https://www.example.com/products/sample-2",price:750,currency:"USD",old_price:null,new_price:null},{id:"sample-3",name:"Sample Gold Bracelet",description:"Handcrafted 14K yellow gold link bracelet. Lightweight and comfortable for everyday wear.",image:"https://picsum.photos/seed/bracelet3/200/200",link:"https://www.example.com/products/sample-3",price:450,currency:"USD",old_price:500,new_price:450},{id:"sample-4",name:"Sample Silver Earrings",description:"Delicate sterling silver drop earrings with subtle sparkle. A versatile addition to your jewelry collection.",image:"https://picsum.photos/seed/earrings4/200/200",link:"https://www.example.com/products/sample-4",price:199,currency:"USD",old_price:null,new_price:null},{id:"sample-5",name:"Sample Gemstone Pendant",description:"Stunning pendant with a natural gemstone centerpiece on a fine silver chain. Makes a memorable gift.",image:"https://picsum.photos/seed/pendant5/200/200",link:"https://www.example.com/products/sample-5",price:320,currency:"USD",old_price:400,new_price:320}],Xl=new Set(["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml","image/webp"]),Zl={png:"image/png",jpeg:"image/jpeg",jpg:"image/jpeg",gif:"image/gif",svg:"image/svg+xml",webp:"image/webp"},Ql=Array.from(Xl).join(",");function ei(e){return e?function(e){if(!e)return!1;const t=String(e.type||"").toLowerCase().trim();if(t)return Xl.has(t);const n=String(e.name||"").toLowerCase(),o=n.lastIndexOf(".");if(-1===o)return!1;const a=n.slice(o+1);return Object.prototype.hasOwnProperty.call(Zl,a)}(e)?e.size>10485760?"size":null:"type":null}const ti=({imageUploadEndpoint:t,headers:n={},companyId:o,imageUploadQueryParams:a,imageUploadCompanyField:l="companyId"}={})=>{const i=!!t;return{uploadImageFile:e.useCallback(async e=>{if(!i)return console.error("[useImageUpload] No image upload endpoint configured"),null;if(!e)return console.error("[useImageUpload] No file provided"),null;const r=ei(e);if("type"===r)return console.error("[useImageUpload] File type not allowed:",e.type),null;if("size"===r)return console.error("[useImageUpload] File too large:",e.size,"bytes"),null;const s=await(async(e,t,n,o={},a={})=>{if(!e)return console.error("[API Service] No image upload endpoint configured"),null;if(!t)return console.error("[API Service] No file provided for upload"),null;const{queryParams:l={},companyField:i="companyId"}=a;try{const a=new FormData;a.append("file",t),n&&("comment"===i?a.append("comment",n):a.append("companyId",n));let r=e;if(l&&Object.keys(l).length>0){const t="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(e,t);Object.entries(l).forEach(([e,t])=>{null!=t&&n.searchParams.set(e,String(t))}),r=n.toString()}const s={...o};Object.keys(s).forEach(e=>{"content-type"===e.toLowerCase()&&delete s[e]});const c=await fetch(r,{method:"POST",headers:{...s},body:a}),d=await c.text();let u={};try{u=d?JSON.parse(d):{}}catch{u=d?{message:d.slice(0,500)}:{}}if(!c.ok){const e=mo(u,c.status);throw console.error("[API Service] Image upload failed:",c.status,e),new Error(e)}if(u&&!1===u.success){const e=mo(u,c.status);throw console.error("[API Service] Upload API returned error:",e),new Error(e)}if(u&&"string"==typeof u.url&&u.url.trim())return u.url.trim();const p=u?.data?.url;if(p&&"string"==typeof p)return p.trim();throw new Error("Upload succeeded but no image URL was returned.")}catch(e){if(console.error("[API Service] Error uploading image:",e),e instanceof Error&&e.message)throw e;throw new Error(e&&"object"==typeof e&&"message"in e?String(e.message):"Unable to upload image. Check your network and try again.")}})(t,e,o,n,{queryParams:a,companyField:l});return s},[i,t,n,o,a,l]),isConfigured:i}};function ni(e){if(null==e)return!0;const t=String(e).trim().toLowerCase();return""===t||"transparent"===t}const oi=({t:n,findStyleItem:o,colorChange:a,inputChange:i,paddingChange:r,patchContainerBackground:s,commitColumnUpdate:c,currentItem:d,children:u})=>{const p=o(d.data.styles,"backgroundColor"),m=o(d.data.styles,"contentBackground"),g=o(d.data.styles,"containerBackgroundImage")??"",h=""!==String(g).trim(),b=e.useMemo(()=>function(e,t){return e?"image":ni(t)?"none":"color"}(h,p),[h,p]),[y,f]=e.useState(null),_=y??b;e.useEffect(()=>{f(null)},[d?.data?.id]),e.useEffect(()=>{h&&f(null)},[h]);const k=o(d.data.styles,"contentMaxWidth")??"100%",x=e.useMemo(()=>[{value:"100%",label:n("content_max_width_option_full")},{value:"720px",label:"720"},{value:"600px",label:"600"},{value:"540px",label:"540"}],[n]),v=e.useMemo(()=>[{value:"none",label:n("border_none")},{value:"solid",label:n("solid")},{value:"dashed",label:n("dashed")},{value:"dotted",label:n("dotted")}],[n]),w=x.some(e=>e.value===k)?k:"100%",S=o(d.data.styles,"minHeight")??"",j="string"==typeof S?parseInt(S.replace("px",""),10)||"":S||"",C=o(d.data.styles,"borderStyle")??"none",N=o(d.data.styles,"borderWidth")??1,I="string"==typeof N?parseInt(N.replace("px",""),10)||1:N||1,A=o(d.data.styles,"borderColor")??"#e0e0e0",L=o(d.data.styles,"borderRadius")??0,T="string"==typeof L?parseInt(String(L).replace("px",""),10)||0:L||0,$="none"!==C,R=Boolean(d.data.hiddenOnMobile),P=ni(m)?"auto":"custom";return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:n("section_background_group")}),l.jsx(Bl,{label:n("section_bg_mode"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:_,onChange:e=>(e=>{if("image"===e)return f("image"),void s({containerBackgroundEnabled:!0});if(f(null),"color"===e){s({containerBackgroundImage:"",containerBackgroundEnabled:!1});const e=ni(p)?"#ffffff":p;return void a("backgroundColor")({hex:e})}"none"===e&&(s({containerBackgroundImage:"",containerBackgroundEnabled:!1}),a("backgroundColor")({hex:"transparent"}))})(e),"aria-label":n("section_bg_mode"),items:[{value:"color",label:n("section_bg_color")},{value:"image",label:n("section_bg_image")},{value:"none",label:n("section_bg_none")}]})}),("color"===_||"image"===_)&&l.jsx(Bl,{label:n("background_color"),children:l.jsx(kl,{color:ni(p)?"#ffffff":p,setColor:({hex:e})=>a("backgroundColor")({hex:e})})}),"image"===_?u:null,l.jsx(Ll,{children:n("section_content_area_group")}),l.jsx(Bl,{label:n("content_area_color"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:P,onChange:e=>{"auto"!==e?i("contentBackground")("#ffffff"):i("contentBackground")("transparent")},"aria-label":n("content_area_color"),items:[{value:"auto",label:n("content_color_auto")},{value:"custom",label:n("content_color_custom")}]})}),"custom"===P?l.jsx(Bl,{label:n("content_background_color"),children:l.jsx(kl,{color:ni(m)?"#ffffff":m,setColor:({hex:e})=>a("contentBackground")({hex:e})})}):null,l.jsx(Bl,{label:n("content_max_width"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:w,onChange:e=>i("contentMaxWidth")(e),"aria-label":n("content_max_width"),items:x})}),l.jsx(Bl,{label:n("min_height"),children:l.jsx(t.InputNumber,{min:0,max:2e3,className:"input-width ee-settings-input-affix",addonAfter:"px",value:j,onFocus:e=>e?.target?.select?.(),onChange:e=>i("minHeight")(e?`${e}px`:"")})}),l.jsx(Ll,{children:n("border")}),l.jsx(Bl,{label:n("border_style"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:C,onChange:e=>i("borderStyle")(e),"aria-label":n("border_style"),items:v})}),$?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:n("border_width"),children:l.jsx(t.InputNumber,{min:0,max:20,className:"input-width ee-settings-input-affix",addonAfter:"px",value:I,onFocus:e=>e?.target?.select?.(),onChange:e=>i("borderWidth")(e??1)})}),l.jsx(Bl,{label:n("border_color"),children:l.jsx(kl,{color:A,setColor:({hex:e})=>a("borderColor")({hex:e})})})]}):null,l.jsx(Bl,{label:n("border_radius"),children:l.jsx(t.InputNumber,{min:0,max:64,className:"input-width ee-settings-input-affix",addonAfter:"px",value:T,onFocus:e=>e?.target?.select?.(),onChange:e=>i("borderRadius")(e??0)})}),l.jsx(Ll,{children:n("spacing")}),l.jsx(Bl,{label:n("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:o(d.data.styles,"paddingTop"),paddingRight:o(d.data.styles,"paddingRight"),paddingLeft:o(d.data.styles,"paddingLeft"),paddingBottom:o(d.data.styles,"paddingBottom")},setPadding:r})}),l.jsx(Ll,{children:n("visibility")}),l.jsxs("div",{className:"ee-settings-row ee-padding-link-sides-row ee-visibility-hide-mobile-row",children:[l.jsx("span",{className:"ee-padding-link-sides-label",children:n("hidden_on_mobile")}),l.jsx(wl,{checked:R,onChange:e=>{const t=B(d.data);t.hiddenOnMobile=e,c(t)}})]})]})},ai=["product"],li=e=>"additional"===e?"additional":"main";function ii(e,t,n){if(!e||"product"!==e.containerType)return null;const o=oe(t,n,e.id);for(let e=0;e<o.length;e++){const n=o[e]?.containerBlock;if(n&&Ja(n,t))return"additional"}return"main"}function ri(e){const t=String(e??"").trim();return t?/^\{\{\w+\}\}$/.test(t)?null:m(t,!1,{allowMailtoTel:!1})||null:null}const si=()=>{const{blockMap:a,rootOrder:i,setBlocks:r,currentItem:s,setCurrentItem:c,previewMode:d,templateData:p,setIsDragStart:m,setActionType:g,apiConfig:h}=e.useContext($e),{t:b}=Zo(),[y,f]=e.useState(!1),_=e.useRef(null),[k,x]=e.useState(!1),[v,w]=e.useState(""),[S,j]=e.useState(""),{uploadImageFile:C,isConfigured:N}=ti({imageUploadEndpoint:h?.imageUploadEndpoint,headers:h?.headers||{},companyId:h?.companyId,imageUploadQueryParams:h?.imageUploadQueryParams,imageUploadCompanyField:h?.imageUploadCompanyField}),{findStyleItem:I,colorChange:A,inputChange:L,paddingChange:T}=Kl(),{blockConfigsList:$}=Al(),R=Va(s?.data),P=s?.data?.children??[],[M,F]=e.useState(0);e.useEffect(()=>{F(0)},[s?.data?.id]),e.useEffect(()=>{const e=P.length;0!==e&&F(t=>t>=e?Math.max(0,e-1):t)},[P.length]);const[U,D]=e.useState(!1);e.useEffect(()=>{D(!1)},[s?.data?.id]);const E="discount"===(z=s.data.containerType??"none")||"none"===z||"header"===z||"footer"===z?z:"product";var z;const O="product"===s.data.containerType?ii(s.data,a,i):null,W=li(O??s.data.productRole??"main"),H=s.data.columnProducts,K=e.useMemo(()=>Array.isArray(H)?H:[],[H]),V=e.useMemo(()=>{const e=s.data;return"image_left"===e.mainProductLayout||"image_stacked"===e.mainProductLayout?e.mainProductLayout:function(e){const t=e?.children?.[0]?.children?.[0];return"column"===t?.key&&"2-3"===t?.type}(e)?"image_left":"image_stacked"},[s.data]),G=e.useMemo(()=>{const e=s.data;if(!Ja(e))return null;const t=e.children?.length??0;return 2!==t&&3!==t?null:{columnCount:t}},[s.data]),q=e.useMemo(()=>({columnIndex:0,columnProduct:K[0]??null}),[K]),J=I(s.data.styles,"containerBackgroundImage")??"";e.useEffect(()=>{j("")},[J]);const Y=p?.content?.products?.length>0?p.content.products:p?.catalogProducts?.length>0?p.catalogProducts:Yl,X=e=>{const{blockMap:t}=Z([e]);let n={...a,...t};const o=li(e.productRole);"product"===e.containerType&&"main"===o&&Object.keys(n).forEach(t=>{if(t===e.id)return;const o=n[t];if(!o||"column"!==o.key)return;if("product"!==o.containerType)return;"main"===li(o.productRole)&&(n[t]={...o,productRole:"additional"})}),r(n,i,`edit_${(new Date).getTime()}`),c({...s,data:e})};e.useEffect(()=>{if("product"!==s?.data?.containerType)return;const e=ii(s.data,a,i);if(!e)return;if(li(s.data.productRole)===e)return;const t=B(s.data);t.productRole=e,X(t)},[s?.data?.id,s?.data?.containerType,s?.data?.productRole,a,i]);const Q=e=>{const t=B(s.data);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles[d]||(t.styles[d]={}),Object.assign(t.styles[d],e),"desktop"!==d&&(t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e)),X(t)},ee=async e=>{if(!e)return;const n=ei(e);if("type"!==n)if("size"!==n)if(N){x(!0);try{const n=await C(e);n?(Q({containerBackgroundImage:cn(n),containerBackgroundEnabled:!0}),w(""),j(""),t.message.success(b("image_uploaded"))):t.message.error(b("image_upload_failed"))}catch(n){console.error(n);const e="string"==typeof n?.message&&n.message.trim()?n.message.trim():null;t.message.error(e||b("image_upload_error"))}finally{x(!1)}}else t.message.error(b("image_upload_not_configured"));else t.message.error(b("image_file_too_large"));else t.message.error(b("image_upload_invalid_type"))},te=e=>{const t=ri(e);var n;w(t?b("blocked_scheme"===(n=t)?"container_bg_image_url_error_blocked_scheme":"duplicate_protocol"===n?"container_bg_image_url_error_duplicate_protocol":"missing_hostname_dot"===n?"container_bg_image_url_error_hostname":"invalid_protocol"===n?"container_bg_image_url_error_invalid_protocol":"container_bg_image_url_error_generic"):""),j("")},ne=ai.includes(E),ae=e=>{if(!ne||"main"!==li(W))return;if(e===V)return;const t=Jl("image_left"===e?"product_image_left":"product_single");if(!t)return;const n=B(s.data);n.mainProductLayout=e,n.children=B(t.children),n.columnProducts=B(K),X(n)},le=e.useMemo(()=>ca(s.data,a),[s.data,a]),ie=e.useMemo(()=>oe(a,i,s.data?.id),[a,i,s.data?.id]),re=e.useMemo(()=>(ie||[]).filter(e=>e?.containerBlock&&e.containerBlock.id!==s.data?.id&&"none"!==e.containerType).map(e=>{const t=e.cellIndex??0;return{containerType:e.containerType,context:{columnIndex:t,columnProduct:e.containerBlock?.columnProducts?.[t]??null}}}),[ie,s.data?.id]),se=Ht(0,E,p,{},re).filter(({variableKey:e,key:t})=>!("product"===E)||(e??t)!==ut).filter(({variableKey:e,key:t})=>!le.has(e??t)),ce=e.useMemo(()=>{const e={columnIndex:0,columnProduct:K[0]??null};return Gt(E,p,e).filter(e=>e.variableKey&&!le.has(e.variableKey))},[E,p,K,le]),de=e.useMemo(()=>{const e=new Set(se.map(e=>e.variableKey??e.key)),t=ce.filter(t=>{const n=t.variableKey;return!(!n||e.has(n))&&(e.add(n),!0)});return[...se,...t]},[se,ce]),ue=e=>t=>{const n=(e=>{const{value:t,type:n}=e;if("image"===n){const e=B($.find(e=>"image"===e.key));return e?(e.src=t,e):{name:b("image"),key:"image",src:t,alt:"Image",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}}}const o=B($.find(e=>"text"===e.key));return o?(o.text=`<p>${t}</p>`,o.type="p",o.contentType="static",o):{name:b("text"),key:"text",text:`<p>${t}</p>`,type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"20px",paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"left"},mobile:{}}}})(e);"undefined"!=typeof window&&(window.__eeDragItemData=n,window.__eeDragSource="product-variables"),m(!0),g("add"),t.target.classList.add("ee-product-variable-item-dragging"),t.dataTransfer&&(t.dataTransfer.effectAllowed="copy")},pe=e=>{e.target.classList.remove("ee-product-variable-item-dragging"),"undefined"!=typeof window&&(window.__eeDragItemData=null,window.__eeDragSource=null),setTimeout(()=>{m(!1)},50)},me=e=>t=>{const n=B(s.data);n.children[e].styles[d]={...n.children[e].styles[d],...t},X(n)},ge=(e=!1)=>{const a=I(s.data.styles,"containerBackgroundImage")??"",i=function(e,t,n){const o=String(e??"").trim();if(!o)return"";if(ri(o))return"";if(/^\{\{\w+\}\}$/.test(o)){const e=o.replace(/\{\{|\}\}/g,"").trim(),a=t&&e?Ft(t,e,n):null;return null==a||String(a).startsWith("{{")?"":u(String(a).trim(),{allowMailtoTel:!1})||""}return u(o,{allowMailtoTel:!1})||""}(a,p,q),r=l.jsxs("span",{className:"ee-container-bg-heading-inline",children:[b("container_background_image_section_title"),l.jsx(t.Tooltip,{title:l.jsxs("div",{className:"ee-container-bg-tooltip",children:[l.jsx("p",{className:"ee-container-bg-tooltip-p",children:b("container_background_image_tooltip_p1")}),l.jsx("p",{className:"ee-container-bg-tooltip-p",children:b("container_background_image_tooltip_p2")}),l.jsx("p",{className:"ee-container-bg-tooltip-p",children:b("container_background_image_intro")})]}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:l.jsx("span",{className:"ee-container-bg-section-help",tabIndex:0,"aria-label":b("container_background_image_title"),onClick:e=>e.stopPropagation(),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]}),c=!e||U;return l.jsxs("div",{className:Go("ee-container-bg-section",e&&"ee-container-bg-section--disclosure"),children:[e?l.jsxs("div",{className:"ee-settings-row ee-padding-link-sides-row ee-container-bg-disclosure-switch-row",children:[l.jsx("div",{className:"ee-container-bg-disclosure-heading-left",children:l.jsx("span",{className:"ee-settings-section-title ee-container-bg-section-heading",children:r})}),l.jsx(wl,{checked:U,onChange:D,"aria-label":b("container_background_image_section_toggle")})]}):l.jsx(Ll,{className:"ee-container-bg-section-heading",children:r}),c?l.jsxs("div",{className:"ee-container-bg-section-body",children:[l.jsx("input",{ref:_,type:"file",accept:Ql,className:"ee-image-upload-input-hidden",onChange:async e=>{const t=e.target.files?.[0];await ee(t),e.target.value=""},disabled:k}),l.jsxs(Bl,{label:b("container_background_image_upload"),children:[l.jsx(t.Spin,{spinning:k,children:l.jsxs("div",{role:"button",tabIndex:0,className:"ee-image-upload-trigger",onClick:()=>!k&&_.current?.click(),onDrop:async e=>{e.preventDefault(),e.stopPropagation();const t=e.dataTransfer?.files?.[0];await ee(t)},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},style:{opacity:k?.6:1,cursor:k?"not-allowed":"pointer"},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faCloudUploadAlt,className:"ee-image-upload-icon"}),l.jsx("span",{children:b(k?"uploading":"image_upload_click")})]})}),l.jsxs("div",{className:"ee-image-toolbar",children:[l.jsxs("button",{type:"button",className:"ee-image-toolbar-btn",onClick:()=>_.current?.click(),disabled:k,children:[l.jsx(n.FontAwesomeIcon,{icon:o.faSyncAlt}),l.jsx("span",{children:b("replace")||"Replace"})]}),l.jsxs("button",{type:"button",className:"ee-image-toolbar-btn ee-image-toolbar-btn--danger",onClick:()=>{w(""),j(""),Q({containerBackgroundImage:"",containerBackgroundEnabled:!1})},disabled:k||!String(a).trim(),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faTrash}),l.jsx("span",{children:b("delete")||"Delete"})]})]}),l.jsx("div",{className:"ee-image-upload-hint",children:b("image_upload_file_hint")||"PNG, JPEG, GIF, SVG, WebP · max 10 MB"})]}),l.jsxs("div",{className:"ee-container-bg-url-block",children:[l.jsx("div",{className:"ee-stack-label ee-container-bg-url-label",children:b("container_background_image_url")}),l.jsx(t.Input,{className:"width-full",value:a,onChange:e=>{const t=e.target.value,n=""!==String(t).trim();j(""),v&&te(t),Q({containerBackgroundImage:t,containerBackgroundEnabled:n})},onBlur:e=>te(e.target.value),status:v||S?"error":"",placeholder:"https://"}),v?l.jsx("div",{className:"ee-field-error",role:"alert",children:v}):null,S&&!v?l.jsx("div",{className:"ee-field-error",role:"alert",children:S}):null,i&&!v?l.jsx("div",{className:"ee-container-bg-url-preview",children:l.jsx("img",{src:i,alt:"",className:"ee-container-bg-url-preview-img",onLoad:()=>j(""),onError:()=>j(b("container_bg_image_preview_failed"))})}):null]}),l.jsxs("div",{className:"ee-container-bg-format-bar",children:[l.jsx("div",{className:"ee-container-bg-format-bar-caption",children:b("container_background_image_layout_group")}),l.jsxs("div",{className:"ee-container-bg-format-bar-inner",children:[l.jsxs("div",{className:"ee-container-bg-format-bar-field ee-container-bg-format-bar-field-size",children:[l.jsx("div",{className:"ee-container-bg-format-bar-label",children:b("container_background_image_size")}),l.jsx(t.Select,{className:"ee-container-bg-size-select ee-container-bg-size-select-half",value:I(s.data.styles,"containerBackgroundSize")||"cover",onChange:e=>Q({containerBackgroundSize:e}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:un.map(e=>l.jsx(t.Select.Option,{value:e.value,children:b(e.labelKey)},e.value))})]}),l.jsxs("div",{className:"ee-container-bg-format-bar-field ee-container-bg-format-bar-field-grid",children:[l.jsx("div",{className:"ee-container-bg-format-bar-label",children:b("container_background_image_position")}),l.jsx("div",{className:"ee-container-bg-position-grid",role:"group","aria-label":b("container_background_image_position"),children:pn.map(e=>{const t=I(s.data.styles,"containerBackgroundPosition")||"center center";return l.jsx("button",{type:"button",className:Go("ee-container-bg-position-cell",t===e&&"ee-container-bg-position-cell-active"),title:e,"aria-pressed":t===e,onClick:()=>Q({containerBackgroundPosition:e}),children:l.jsx("span",{className:"ee-container-bg-dot","aria-hidden":!0})},e)})})]})]})]})]}):null]})};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsxs(l.Fragment,{children:[ne||G?null:l.jsx(Ll,{className:"ee-settings-section-title--flush",children:b("container_settings")}),l.jsxs("div",{className:"ee-right-panel-stack",children:[G?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:b("additional_products_grid_layout")}),l.jsx(Bl,{label:b("additional_products_per_row"),children:l.jsx(t.Select,{className:"ee-stack-control",value:String(G.columnCount),style:{width:"100%"},getPopupContainer:()=>document.querySelector(".right-settings")||document.body,onChange:e=>(e=>{if(!G||e===G.columnCount)return;const t=Jl(3===e?"product_three_column":"product_two_column");if(!t)return;const n=s.data.id,o=B(s.data.styles),a=[...s.data.columnProducts??[]],l=B(t);l.id=n,l.styles=B(o),l.styles.desktop||(l.styles.desktop={}),Object.assign(l.styles.desktop,{paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0}),l.columnProducts=Array.from({length:e},(e,t)=>a[t]??null),X(l)})(Number(e)),options:[{value:"2",label:b("product_row_count_2")},{value:"3",label:b("product_row_count_3")}]})})]}):null,ne&&"main"===li(W)?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:b("product_output_layout")}),l.jsx(Bl,{label:b("style"),children:l.jsx(t.Select,{className:"ee-stack-control",value:V,style:{width:"100%"},getPopupContainer:()=>document.querySelector(".right-settings")||document.body,onChange:ae,options:[{value:"image_stacked",label:b("product_main_layout_stacked")},{value:"image_left",label:b("product_main_layout_image_left")}]})})]}):null,ne&&l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12 ee-product-kb-heading-with-tooltip",children:l.jsxs("span",{className:"ee-product-kb-heading-inner",children:[l.jsx("span",{children:b("product_column_kb_heading")}),l.jsx(t.Tooltip,{title:b("product_column_kb_tooltip"),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:l.jsx("span",{className:"ee-container-bg-section-help",tabIndex:0,"aria-label":b("product_column_kb_tooltip"),onClick:e=>e.stopPropagation(),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]})}),l.jsxs("div",{className:"ee-product-assign-section ee-product-assign-after-kb-heading",children:[l.jsx("span",{className:"ee-stack-label",children:b("product_column_select_label")}),l.jsx(Hl,{apiConfig:h,templateData:p,value:K[0]?.id??void 0,selectedProduct:K[0],onChange:e=>((e,t)=>{const n=B(s.data),o=[...n.columnProducts??[]];o[e]=t,n.columnProducts=o,X(n)})(0,e),placeholder:b("product_column_select_placeholder"),staticProductList:Y})]})]}),l.jsxs("div",{className:"ee-product-variables-section margin-top-12",children:[l.jsx("span",{className:"ee-stack-label",children:b("product_column_variables_heading")}),l.jsxs("button",{type:"button",className:"ee-product-variables-toggle",onClick:()=>f(e=>!e),children:[l.jsx("span",{children:b("variables")}),l.jsx("span",{className:"ee-product-variables-toggle-icon",children:y?"▴":"▾"})]}),y&&l.jsx("div",{className:"ee-product-variables-dropdown",children:de.length>0?de.map(e=>l.jsxs("div",{className:"ee-product-variable-item",draggable:!0,onDragStart:ue(e),onDragEnd:pe,title:e.value,children:[l.jsx("span",{className:"ee-product-variable-item-label",children:e.labelKey?b(e.labelKey):e.label}),l.jsx("span",{className:"ee-product-variable-item-token",children:e.value})]},e.value)):l.jsx("div",{className:"ee-stack-help",children:b("container_variables_none_available")})})]})]})]}),R===qa&&l.jsx(Pl,{}),R!==Ga&&(()=>{const e=s.data.children||[],t=Math.min(Math.max(0,M),Math.max(0,e.length-1)),n=e[t],o=n?I(n.styles,"backgroundColor"):void 0,a=b(R===qa?"column_cells_section":"column_settings");return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:a}),e.length>1?l.jsx(Bl,{label:b("column"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:String(t),"aria-label":b("column_settings"),onChange:e=>F(Number(e)),items:e.map((e,t)=>({value:String(t),label:`${b("column")} ${t+1}`}))})}):null,n?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:b("content_background_color"),children:l.jsx(kl,{color:o,setColor:({hex:e})=>((e,t)=>n=>{const o=B(s.data);o.children[t].styles[d][e]=n,X(o)})("backgroundColor",t)(e)})}),l.jsx(Bl,{label:b("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:I(n.styles,"paddingTop"),paddingRight:I(n.styles,"paddingRight"),paddingLeft:I(n.styles,"paddingLeft"),paddingBottom:I(n.styles,"paddingBottom")},setPadding:me(t)})})]}):null]})})(),(()=>{if(R===Ga)return l.jsx(oi,{t:b,findStyleItem:I,colorChange:A,inputChange:L,paddingChange:T,patchContainerBackground:Q,commitColumnUpdate:X,currentItem:s,children:ge()});const e=I(s.data.styles,"backgroundColor"),n=I(s.data.styles,"contentBackground"),o=I(s.data.styles,"borderRadius"),a="number"==typeof o?o:parseInt(String(o||"").replace("px",""),10)||0,i=Boolean(s.data.hiddenOnMobile);return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:b(R===qa?"column_wrapper_style":"column_styles")}),l.jsx(Bl,{label:b("background_color"),children:l.jsx(kl,{color:e,setColor:A("backgroundColor")})}),l.jsx(Bl,{label:b("content_background_color"),children:l.jsx(kl,{color:n,setColor:A("contentBackground")})}),l.jsx(Bl,{label:b("border_radius"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:a,onFocus:e=>e?.target?.select?.(),onChange:e=>L("borderRadius")(Number(e)||0)})}),l.jsx(Bl,{label:b("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:I(s.data.styles,"paddingTop"),paddingRight:I(s.data.styles,"paddingRight"),paddingLeft:I(s.data.styles,"paddingLeft"),paddingBottom:I(s.data.styles,"paddingBottom")},setPadding:T})}),ge(R===qa),R===qa?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:b("visibility")}),l.jsxs("div",{className:"ee-settings-row ee-padding-link-sides-row ee-visibility-hide-mobile-row",children:[l.jsx("span",{className:"ee-padding-link-sides-label",children:b("hidden_on_mobile")}),l.jsx(wl,{checked:i,onChange:e=>{const t=B(s.data);t.hiddenOnMobile=e,X(t)}})]})]}):null]})})()]})})},ci=({mlEmailNodesEndpoint:t,mlGenerationEndpoint:n,headers:o={},templateData:a,blockId:l,containerType:i,containerId:r,productId:s,blockName:c="Text",blockElementType:d="p",emailTemplateId:u,companyId:p,aiContentLanguage:m="en"}={})=>{const g=!!(t&&String(u??"").trim()&&String(p??"").trim()&&l&&r),h=!!n,b=g||h;return{generateOptions:e.useCallback(async(e,b,y={})=>{const{previousPrompt:f="",previousSelectedAiContent:_=""}=y,k=function(e,t={}){const{containerType:n}=t,o=String(e??"").trim();let a;return a=Kt[o]?Kt[o]:o?o.split(/[-_]/).map(e=>e.length?e[0].toUpperCase()+e.slice(1).toLowerCase():"").join(""):"DisplayText",a||(a="DisplayText"),"product"===n&&"DisplayText"===a?"ProductDescription":a}(e,{containerType:i});if(g){const e={containerType:i||"none",id:r};if("product"===(i||"")&&null!=s){const t=String(s).trim();t&&(e.productId=t)}const n=t,a={blockContext:{blockId:l,name:c,type:d||"p"},companyId:p,containerContext:e,emailTemplateId:u,language:"bn-BD"===m?"bn-BD":"en",promptContext:{newPrompt:b||"",previousPrompt:f||"",previousSelectedAiContent:_||""},type:k},g=await(async(e,t,n={})=>{if(!e)return console.error("[API Service] generate-email-nodes: no endpoint"),{success:!1,error:"ML endpoint is not configured."};try{const o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)});let a={};try{a=await o.json()}catch{a={}}if(!o.ok||!1===a.success){let e="";const t=a.error;if(t&&"object"==typeof t){const n=null!=t.code?String(t.code):"",o=null!=t.message?String(t.message):"";e=[n,o].filter(Boolean).join(" — ")||o||n}return e||(e=null!=a.message?String(a.message):`${o.status} ${o.statusText}`),console.error("[API Service] generate-email-nodes failed:",e),{success:!1,error:String(e),errorCode:t&&"object"==typeof t&&null!=t.code?String(t.code):void 0}}const l=Array.isArray(a.variations)?a.variations:[],i=l.map(e=>e&&"string"==typeof e.value?e.value.trim():"").filter(Boolean);return 0===i.length?(console.error("[API Service] generate-email-nodes: empty variations"),{success:!1,error:"No variations were returned for this request."}):{success:!0,options:i,variations:l,emailJson:"string"==typeof a.emailJson?a.emailJson:void 0,blockId:a.blockId,emailTemplateId:a.emailTemplateId}}catch(e){return console.error("[API Service] Error calling generate-email-nodes:",e),{success:!1,error:e&&"object"==typeof e&&"message"in e?String(e.message):"Unable to reach the ML service. Check your network and try again."}}})(n,a,o);if(g&&g.success&&g.options?.length)return g.options;return{error:g&&"object"==typeof g&&g.error?String(g.error):"No response from the ML service."}}if(h){const e={variable:k,prompt:b,context:{templateData:a,blockId:l,containerType:i}},t=await(async(e,t,n={})=>{if(!e)return console.error("[API Service] ML endpoint not configured"),null;try{const o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)});if(!o.ok)return console.error("[API Service] ML endpoint failed:",o.status,o.statusText),null;const a=await o.json();if(!a.success)return console.error("[API Service] ML API returned error:",a.error),null;const l=a.data?.options??[];return Array.isArray(l)&&0!==l.length?l:(console.error("[API Service] ML API returned empty options"),null)}catch(e){return console.error("[API Service] Error calling ML endpoint:",e),null}})(n,e,o);return t&&t.length?t:{error:"The legacy ML endpoint did not return any options. Check the API response."}}return{i18nKey:"ml_ai_unavailable"}},[g,h,t,n,o,a,l,i,r,s,c,d,u,p,m]),isConfigured:b}};function di(){const{blockMap:t,rootOrder:n,currentItem:o}=e.useContext($e);return e.useMemo(()=>{if(!t||!o?.id)return{containerBlock:null,containerType:"none",columnIndex:0,cellIndex:0};const{containerBlock:e,containerType:a,cellIndex:l,isRoot:i,rootIndex:r}=ne(t,n,o.id);let s=0;if(i)s=r??0;else if(e){const t=n.indexOf(e.id);s=t>=0?t:0}const c=l??0;return{containerBlock:e??null,containerType:a??"none",columnIndex:s,cellIndex:c,contentIndex:c}},[t,n,o?.id])}const{TextArea:ui}=t.Input,pi=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,64],mi="staticTextBeforeAi";function gi(e,t,n,o){const a=Number.parseInt(String(e??""),10);return Number.isNaN(a)?o:Math.min(n,Math.max(t,a))}function hi(e){return null==e||"string"!=typeof e?"":e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}const bi=({embedded:a=!1})=>{const{currentItem:i,previewMode:r,templateData:s,apiConfig:c,bodySettings:d,aiEnabled:u=!0}=e.useContext($e),{t:p}=Zo(),{findStyleItem:m,paddingChange:g,otherStylesChange:h,inputChange:b,updateItemStyles:y}=Kl(),{containerBlock:f,containerType:_,cellIndex:k}=di(),x="product"===_?f?.columnProducts?.[k??0]?.id:void 0,v="bn-BD"===i?.data?.dynamicAiLanguage?"bn-BD":"en",{generateOptions:w}=ci({mlEmailNodesEndpoint:c?.mlEmailNodesEndpoint,mlGenerationEndpoint:c?.mlGenerationEndpoint,headers:c?.headers||{},templateData:s,blockId:i?.id,containerType:_,containerId:f?.id,productId:x,blockName:i?.data?.name||"Text",blockElementType:i?.data?.type||"p",emailTemplateId:c?.emailTemplateId,companyId:c?.companyId??s?.companyId,aiContentLanguage:v}),[S,j]=e.useState(""),C=m(i.data.styles,"fontSize"),N=null!=C&&""!==C?Number(C):14,[I,A]=e.useState(String(N)),[L,T]=e.useState(""),$=(e,t)=>{const n=B(i.data);n.styles||(n.styles={desktop:{},mobile:{}}),n.styles.desktop||(n.styles.desktop={}),n.styles.mobile||(n.styles.mobile={}),n.styles.desktop[e]=t,n.styles[r][e]=t,n.text=R(n.text,n.styles.desktop),y(n)},P=e=>{const t=gi(e,1,999,14);A(String(t)),$("fontSize",t)},M=()=>{const e=String(L??"").trim();if(""===e){const e=B(i.data);return e.styles||(e.styles={desktop:{},mobile:{}}),e.styles.desktop||(e.styles.desktop={}),e.styles.mobile||(e.styles.mobile={}),delete e.styles.desktop.lineHeight,delete e.styles.mobile.lineHeight,void y(e)}const t=gi(e,1,999,24);T(String(t)),b("lineHeight")(`${t}px`)};e.useEffect(()=>{A(String(N))},[i?.id,N]);const F=m(i.data.styles,"lineHeight");e.useEffect(()=>{T(null==F||""===F?"":String(function(e,t=14){if(null==e||""===e)return Math.max(1,Math.round(1.4*Number(t)));const n=String(e).trim(),o=n.match(/^(-?\d*\.?\d+)\s*%$/);if(o){const e=Number(o[1]);if(!Number.isNaN(e))return Math.max(1,Math.round(t*e/100))}const a=n.match(/^(-?\d*\.?\d+)\s*px$/i);if(a){const e=Number(a[1]);if(!Number.isNaN(e))return Math.max(1,Math.round(e))}const l=Number(n);return Number.isNaN(l)?24:l>0&&l<=10?Math.max(1,Math.round(t*l)):Math.max(1,Math.round(l))}(F,N)))},[i?.id,F,N]);const[U,D]=e.useState([]),[E,z]=e.useState(!1),[O,W]=e.useState(""),H=i.data.contentType??"static",K=i.data.type??"p",V=String(K).toLowerCase(),G="p"===V||""===K?"p":/^h[1-6]$/.test(V)?V:"p",q=e=>{if(!u)return;const t=e?"dynamic":"static",n=B(i.data),o=n.styles?.desktop??{};if(n.contentType=t,"dynamic"===t){if("static"===(i.data.contentType??"static")){const e=i.data.text??"",t=R(p("text_content"),o),a=R(p("ai_enabled"),o);hi(e).length>0&&e!==t&&e!==a?n[mi]=e:delete n[mi]}n.selectedVariableKey=void 0,n.dynamicVariable=n.dynamicVariable??"",n.dynamicPrompt=n.dynamicPrompt??"",n.dynamicSelectedContent=n.dynamicSelectedContent??"",n.dynamicOptions=Array.isArray(n.dynamicOptions)?n.dynamicOptions:[],n.dynamicAiLanguage="bn-BD"===n.dynamicAiLanguage?"bn-BD":"en";const e=n.dynamicSelectedContent??"",t="string"==typeof e?hi(e):"",a=R(p("ai_enabled"),o);n.text=t.length>0?R(e,o):a}else{const e=n[mi];"string"==typeof e&&hi(e).length>0?n.text=R(e,o):n.text=R(p("text_content"),o),delete n[mi]}y(n)},J=async()=>{const e=i.data.dynamicVariable??"",t=i.data.dynamicPrompt??S??"";z(!0),W("");try{const n=await w(e,t,{previousPrompt:i.data.dynamicPreviousPrompt??"",previousSelectedAiContent:hi(i.data.dynamicSelectedContent||i.data.text)});if(n&&"object"==typeof n&&!Array.isArray(n))return n.i18nKey?W(p(n.i18nKey)):n.error?W(String(n.error)):W(p("ml_no_variations")),void D([]);if(Array.isArray(n)&&n.length>0){W(""),D(n);const e=B(i.data);e.dynamicOptions=n,e.dynamicPrompt=t,e.dynamicPreviousPrompt=t,y(e)}else W(p("ml_no_variations")),D([])}catch(e){console.error("[TextStyleSettings] Error during content generation:",e),W(e&&"object"==typeof e&&"message"in e?String(e.message):p("ml_generation_unexpected_error")),D([])}finally{z(!1)}},Y=e=>{const t=e.target.value;j(t),W("");const n=B(i.data);n.dynamicPrompt=t,y(n)},X=e=>{const t=B(i.data);t.dynamicAiLanguage="bn-BD"===e?"bn-BD":"en",y(t)};return l.jsxs("div",{className:a?"ee-settings-block-form ee-discount-simple-text-settings":"margin-y-30 ee-settings-block-form",children:[(()=>{const e=l.jsxs("div",{className:Go("ee-text-ai-usp-row","ee-settings-row","ee-text-ai-toggle-row",!u&&"ee-text-ai-usp-row--disabled"),children:[l.jsxs("span",{className:"ee-text-ai-label-with-help",children:[p("ai_enabled"),l.jsx(t.Tooltip,{title:p("tooltip_write_using_ai"),children:l.jsx("span",{className:"ee-help-icon ee-text-ai-help-trigger","aria-label":p("tooltip_write_using_ai"),onClick:e=>e.stopPropagation(),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]}),l.jsx(wl,{checked:"dynamic"===H,onChange:q,disabled:!u})]});return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"ee-text-settings-content-wrap",children:[l.jsx(Ll,{children:p("content")}),l.jsxs("div",{className:"ee-text-settings-content-gap",children:[l.jsx(Bl,{label:p("heading_type"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:G,onChange:e=>{return(t=e,()=>{const e=String(t??"p").toLowerCase(),n=i.data.styles?.desktop??{},o="p"!==e&&/^h[1-6]$/.test(e)?e:"p";let a,l,r;if("p"===o)a=14,l=20,r="400";else{switch(a=n.fontSize,o){case"h1":a=22;break;case"h2":a=20;break;case"h3":a=18;break;case"h4":a=16;break;case"h5":a=15;break;case"h6":a=14;break;default:a=null!=a&&""!==a&&Number(a)||14}l=Math.max(1,Math.round(1.4*Number(a))),r="bold"}const s=B(i.data);s.type=o;const c="p"===o?{textTransform:"none",letterSpacing:"0em"}:{},d={...n,...c,fontSize:a,lineHeight:`${l}px`,fontWeight:r},u={...i.data.styles?.mobile??{},...c,fontSize:a,lineHeight:`${l}px`,fontWeight:r};s.styles={...s.styles??{},desktop:d,mobile:u},s.text=R(s.text,d),y(s)})();var t},items:[{value:"p",label:p("body_paragraph")},{value:"h1",label:"H1"},{value:"h2",label:"H2"},{value:"h3",label:"H3"},{value:"h4",label:"H4"}],"aria-label":p("heading_type")})}),l.jsx("div",{className:"ee-text-ai-slot",children:u?e:l.jsx(t.Tooltip,{title:p("tooltip_write_using_ai_unavailable"),children:e})}),u&&"dynamic"===H?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ee-dynamic-prompt-block ee-dynamic-prompt-block--with-heading",children:[l.jsxs("div",{className:"ee-dynamic-language-row",children:[l.jsx("span",{className:"ee-prompt-label",children:p("ai_output_language")}),l.jsxs(t.Select,{className:"input-width ee-dynamic-language-select",value:v,onChange:X,getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:[l.jsx(t.Select.Option,{value:"en",children:p("ai_output_language_en")}),l.jsx(t.Select.Option,{value:"bn-BD",children:p("ai_output_language_bn")})]})]}),l.jsxs("span",{className:"ee-prompt-label",children:[p("dynamic_prompt_help"),l.jsx(t.Tooltip,{title:p("tooltip_dynamic_prompt"),children:l.jsx("span",{className:"ee-help-icon","aria-label":"Help",children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]}),l.jsx(ui,{rows:3,value:i.data.dynamicPrompt??S,onChange:Y,placeholder:p("dynamic_prompt_help")}),l.jsx(t.Button,{type:"primary",size:"small",block:!0,loading:E,disabled:!(i.data.dynamicPrompt??S??"").trim(),onClick:J,children:p("generate")}),O?l.jsx("div",{className:"ee-ml-generation-error",role:"alert",children:O}):null]}),(i.data.dynamicOptions?.length>0||U.length>0)&&l.jsxs("div",{className:"ee-sample-content-block",children:[l.jsx("div",{className:"card-item-title",children:p("select_content")}),(i.data.dynamicOptions||U).map((e,t)=>{const n="string"==typeof e?e:String(e),o=i.data.dynamicSelectedContent??"",a=(("string"==typeof o?hi(o):"").length>0?o:i.data.text??"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim(),r=n.replace(/\s+/g," ").trim(),s=a.length>0&&a===r;return l.jsx("div",{className:Go("ee-sample-content-item",s&&"ee-sample-content-item-selected"),onClick:()=>(e=>{const t=B(i.data);t.dynamicSelectedContent=e,t.text=e,y(t),Array.isArray(t.dynamicOptions)&&t.dynamicOptions.length&&D([...t.dynamicOptions]),W("")})(e),children:e},t)})]})]}):null]})]})})})(),(()=>{const e=m(i.data.styles,"color"),a=null!=e&&""!==String(e).trim()?e:d?.styles?.color??"#171717",c=m(i.data.styles,"linkColor"),u=m(i.data.styles,"textAlign"),g=m(i.data.styles,"fontFamily"),f=function(e){if(null==e||""===e)return"400";const t=String(e).trim().toLowerCase();if("bold"===t||"bolder"===t)return"700";if("normal"===t||"lighter"===t)return"400";const n=Number(t);return Number.isNaN(n)||n<=450?"400":n<=550?"500":n<=650?"600":"700"}(m(i.data.styles,"fontWeight")),_=m(i.data.styles,"textTransform"),k=null!=_&&""!==String(_).trim()?String(_):"none",x=function(e,t){if(null==e||""===e)return t;const n=String(e).trim().replace(/[a-z%]+$/i,""),o=Number(n);return Number.isNaN(o)?t:o}(m(i.data.styles,"letterSpacing"),0),v=tn(s),w=on(g,s);return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:p("typography")}),l.jsx(Bl,{label:p("font_color"),children:l.jsx(kl,{color:a,fallbackColor:d?.styles?.color??"#171717",setColor:({hex:e})=>$("color",e)})}),l.jsx(Bl,{label:p("link_color"),children:l.jsx(kl,{color:null!=c&&""!==String(c).trim()?c:"#2faade",setColor:({hex:e})=>((e,t)=>{const n=B(i.data);n.styles||(n.styles={desktop:{},mobile:{}}),n.styles.desktop||(n.styles.desktop={}),n.styles.mobile||(n.styles.mobile={}),n.styles.desktop[e]=t,n.styles[r][e]=t,y(n)})("linkColor",e)})}),l.jsx(Bl,{label:p("label_align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:u||"left",onChange:e=>h("textAlign",e),"aria-label":p("text_align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignJustify,className:"tag-style-size"}),iconOnly:!0}]})}),l.jsx(Bl,{label:p("font_weight"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:f,onChange:e=>$("fontWeight",e),"aria-label":p("font_weight"),items:[{value:"400",label:"Reg"},{value:"500",label:"Med"},{value:"600",label:"SBd"},{value:"700",label:"Bd"}]})}),l.jsx(Bl,{label:p("text_transform"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:k,onChange:e=>$("textTransform",e),"aria-label":p("text_transform"),items:[{value:"none",label:"Aa"},{value:"uppercase",label:"AA"},{value:"capitalize",label:"Cp"}]})}),l.jsx(Bl,{label:p("font_family"),children:l.jsx(t.Select,{className:"input-width ee-font-family-select",value:w,showSearch:!0,optionFilterProp:"label",labelRender:({value:e})=>l.jsx("span",{children:an(e,s)}),onChange:e=>$("fontFamily",on(e,s)),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:v})}),l.jsx(Bl,{label:p("font_size"),children:l.jsx(t.AutoComplete,{className:"input-width ee-settings-input-affix",value:I,options:pi.map(e=>({value:String(e),label:`${e}px`})),onChange:e=>A(String(e??"")),onSelect:e=>P(e),filterOption:!1,getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:l.jsx(t.Input,{addonAfter:"px",onFocus:e=>e?.target?.select?.(),onBlur:()=>P(I),onPressEnter:e=>{P(I),e.currentTarget.blur()},onKeyDown:e=>{if("ArrowUp"!==e.key&&"ArrowDown"!==e.key)return;e.preventDefault();const t="ArrowUp"===e.key?1:-1,n=gi(I,1,999,14)+t;P(n)}})})}),l.jsx(Bl,{label:p("line_height"),children:l.jsx(t.Input,{className:"input-width ee-settings-input-affix",addonAfter:"px",value:L,onChange:e=>T(e.target.value.replace(/[^\d]/g,"")),onFocus:e=>e?.target?.select?.(),onBlur:M,onPressEnter:e=>{M(),e.currentTarget.blur()}})}),l.jsx(Bl,{label:p("letter_spacing"),children:l.jsx(t.InputNumber,{className:"input-width ee-settings-input-affix",addonAfter:"px",min:-20,max:100,step:.1,value:x,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t=null==e||Number.isNaN(Number(e))?0:Number(e);b("letterSpacing")(`${t}px`)}})})]})})(),l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:p("spacing")||"Spacing"}),l.jsx(Bl,{label:p("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:m(i.data.styles,"paddingTop"),paddingRight:m(i.data.styles,"paddingRight"),paddingLeft:m(i.data.styles,"paddingLeft"),paddingBottom:m(i.data.styles,"paddingBottom")},setPadding:g})})]})]})};function yi(e){if(null==e)return!0;const t=String(e).trim().toLowerCase();return""===t||"transparent"===t||"rgba(0, 0, 0, 0)"===t}function fi(e,t){const n=Rn(t);if(!e||"object"!=typeof e)return n;for(const t of["desktop","mobile"]){const o=e[t]?.backgroundColor;if(!yi(o))return $n(o)?n:o}for(const t of["desktop","mobile"]){const n=e[t]?.borderColor;if(!yi(n))return n}return n}function _i(e,t,n){"solid"===t?(e.borderWidth=0,e.borderStyle="solid",e.borderColor=n,e.backgroundColor=n,e.color=function(e){const t=String(e??"").trim().replace(/^#/,"");if(3!==t.length&&6!==t.length)return"#ffffff";const n=(e=>3===e.length?e.split("").map(e=>e+e).join(""):e)(t),o=parseInt(n.slice(0,2),16),a=parseInt(n.slice(2,4),16),l=parseInt(n.slice(4,6),16);return[o,a,l].every(e=>Number.isFinite(e))&&(.299*o+.587*a+.114*l)/255>.62?"#171717":"#ffffff"}(n),e.textDecoration="none"):"outline"===t?(e.borderWidth=2,e.borderStyle="solid",e.borderColor=n,e.backgroundColor="transparent",e.color=n,e.textDecoration="none"):"ghost"===t?(e.borderWidth=0,e.borderStyle="none",e.borderColor="transparent",e.backgroundColor="transparent",e.color=n,e.textDecoration="none"):"underline"===t&&(e.borderWidth=0,e.borderStyle="none",e.borderColor="transparent",e.backgroundColor="transparent",e.color=n,e.textDecoration="underline")}const ki=()=>{const{currentItem:a,previewMode:i,templateData:r}=e.useContext($e),[s,c]=e.useState(""),{t:d}=Zo(),{containerBlock:u,containerType:p,contentIndex:g}=di(),h=u?.columnProducts?.[g]??null,b=e.useMemo(()=>({columnIndex:g,columnProduct:h}),[g,h]),y=e.useMemo(()=>tn(r),[r]),f=["header","footer","discount","product"].includes(p),{findStyleItem:_,colorChange:k,paddingChange:x,inputChange:v,updateItemStyles:w}=Kl(),{urlOptions:S}=e.useMemo(()=>function(e,t,n={}){const o="product"===e?Ot:zt;return{labelOptions:Et.map(({variableKey:e,labelKey:o})=>({value:ht(e),labelKey:o,pasteValue:Ft(t,e,n)})),urlOptions:o.map(({variableKey:e,labelKey:o})=>({value:ht(e),labelKey:o,pasteValue:Ft(t,e,n)}))}}(p,r,b),[p,r,b]);return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[(()=>{const{linkURL:e,text:n,labelVariable:o,urlVariable:i}=a.data,u=n?.replace(/<[^>]+>/g,"").trim()??"",p=o||u&&/\{\{\w+\}\}/.test(u),g=o?o.replace(/^\{\{|\}\}$/g,"").trim():u.match(/\{\{(\w+)\}\}/)?.[1]||"CTALabel",h=r&&p?Ft(r,g,b):null,y=null==h||String(h).startsWith("{{")?u:h,_=i?i.replace(/^\{\{|\}\}$/g,"").trim():"",k=null!=e?String(e).trim():"",x=k.match(/^\{\{(\w+)\}\}$/),v=i||(!i&&x?k:null)||void 0,j=x&&r?Ft(r,x[1],b):null,C=null==j||"string"!=typeof j||String(j).startsWith("{{")?"":String(j).trim(),N=!k&&_&&r?Ft(r,_,b):null,I=null==N||"string"!=typeof N||N.startsWith("{{")?"":String(N).trim(),A=C||I||k||"",L=e=>{c((e=>{const t=String(e??"").trim(),n=m(t,!1,{allowMailtoTel:!0});return n?"empty"===n?"Button -> Link URL is empty. Add a destination like 'https://example.com' or 'mailto:support@example.com'.":"blocked_scheme"===n?`Button -> Link URL ('${t}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===n?`Button -> Link URL ('${t}') repeats the protocol. Keep only one, e.g. 'https://example.com'.`:"missing_hostname_dot"===n?`Button -> Link URL ('${t}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===n?`Button -> Link URL ('${t}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`Button -> Link URL ('${t}') is invalid. Fix the URL format, for example 'https://example.com'.`:""})(e))};return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:d("button_action")}),l.jsx(Bl,{label:d("button_text"),children:l.jsx(t.Input,{className:"width-full",value:y,onChange:e=>{const t=e.target.value,n=B(a.data);n.text=t,t&&t.startsWith("{{")||(n.labelVariable=""),w(n)},placeholder:d("button_label_manual")})}),f&&S.length>0?l.jsx(Bl,{label:d("button_url_variable"),children:l.jsx(t.Select,{className:"ee-variable-select width-full",placeholder:d("button_url_manual"),allowClear:!0,value:v,onChange:e=>{const t=B(a.data);if(!e){t.urlVariable="";const e=String(t.linkURL??"").trim();return/^\{\{\w+\}\}$/.test(e)?t.linkURL="":t.linkURL=t.linkURL||"",void w(t)}const n=S.find(t=>t.value===e);t.urlVariable=e;const o=n?n.pasteValue:e;t.linkURL="string"==typeof o?o.replace(/^https?:\/\//,""):"",w(t)},getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:[{value:"",label:d("button_url_manual")},...S.map(e=>({value:e.value,label:d(e.labelKey)}))]})}):null,l.jsx(Bl,{label:d("link_url"),children:l.jsxs(l.Fragment,{children:[l.jsx(t.Input,{className:"width-full",value:A,onChange:e=>{const t=e.target.value,n=B(a.data);n.linkURL=t,t&&t.startsWith("{{")||(n.urlVariable=""),w(n),s&&L(t)},onBlur:e=>L(e.target.value),status:s?"error":"",placeholder:d("link_url_placeholder")}),s?l.jsx("div",{className:"ee-field-error",role:"alert",children:s}):null]})})]})})(),(()=>{const e=_(a.data.styles,"width"),s=_(a.data.styles,"borderRadius"),c="number"==typeof s?s:parseInt(String(s||"").replace("px",""),10)||0,u=a.data.contentStyles?.[i]?.textAlign??"center",p="left"===u||"center"===u||"right"===u?u:"center",m=_(a.data.styles,"color"),g=_(a.data.styles,"fontFamily"),h=_(a.data.styles,"fontSize"),b=_(a.data.styles,"lineHeight"),f=function(e,t){const n=e?.buttonAccentColor;return null==n||yi(n)?fi(e?.styles,t):n}(a.data,r),S=a.data.buttonVariant??"solid",j=a.data.hoverBg??"",C=a.data.hoverColor??"",N=_(a.data.styles,"letterSpacing")??"0em",I=_(a.data.styles,"textTransform")??"none",A=_(a.data.styles,"textDecoration")??"none",L=_(a.data.styles,"borderWidth"),T=_(a.data.styles,"borderStyle")??"solid",$=_(a.data.styles,"borderColor")??"#000000",R=a.data.shadowPreset??"none",P=e=>t=>{const n=B(a.data);n[e]=t,w(n)},M={none:"",sm:"0 1px 2px rgba(0,0,0,0.12)",md:"0 4px 6px rgba(0,0,0,0.18)",lg:"0 10px 20px rgba(0,0,0,0.22)"},F=()=>document.querySelector(".right-settings")||document.body;return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:d("button_styles")}),l.jsx(Bl,{label:d("button_variant")||"Variant",children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:S,onChange:e=>(e=>{const t=B(a.data);t.buttonVariant=e,t.styles=t.styles??{desktop:{},mobile:{}},t.styles.desktop={...t.styles.desktop??{}},t.styles.mobile={...t.styles.mobile??{}};const n=null==t.buttonAccentColor||yi(t.buttonAccentColor)?fi(t.styles,r):t.buttonAccentColor;t.buttonAccentColor=n,_i(t.styles.desktop,e,n),_i(t.styles.mobile,e,n),w(t)})(e),"aria-label":d("button_variant")||"Variant",items:[{value:"solid",label:"Solid"},{value:"outline",label:"Outline"},{value:"ghost",label:"Ghost"},{value:"underline",label:"Underline"}]})}),l.jsx(Bl,{layout:"toggle",label:d("full_width")||"Full width",children:l.jsx(wl,{checked:"auto"!==e,onChange:()=>{const t="auto"===e?"100%":"auto";v("width")(t)}})}),"auto"!==e?l.jsx(Bl,{label:d("width"),children:l.jsx(t.Slider,{value:Number(String(e).replace("%","")),onChange:e=>v("width")(e+"%")})}):null,"auto"!==e?l.jsx(Bl,{label:d("align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:p,onChange:e=>(e=>{const t=B(a.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]||{},textAlign:e},w(t)})(e),"aria-label":d("align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0}]})}):null,l.jsx(Bl,{label:d("font_color"),children:l.jsx(kl,{color:m,setColor:k("color")})}),l.jsx(Bl,{label:d("button_color"),children:l.jsx(kl,{color:f,setColor:({hex:e})=>{const t=B(a.data);t.styles=t.styles??{desktop:{},mobile:{}},t.styles.desktop={...t.styles.desktop??{}},t.styles.mobile={...t.styles.mobile??{}},t.buttonAccentColor=e;const n=t.buttonVariant??"solid";_i(t.styles.desktop,n,e),_i(t.styles.mobile,n,e),w(t)}})}),l.jsx(Bl,{label:d("hover_bg_color")||"Hover bg",children:l.jsx(kl,{color:j||f,setColor:e=>P("hoverBg")(e.hex)})}),l.jsx(Bl,{label:d("hover_text_color")||"Hover text",children:l.jsx(kl,{color:C||m,setColor:e=>P("hoverColor")(e.hex)})}),l.jsx(Bl,{label:d("font_family"),children:l.jsx(t.Select,{className:"width-full",showSearch:!0,optionFilterProp:"label",value:on(g??"sans-serif",r),onChange:e=>v("fontFamily")(on(e,r)),labelRender:({value:e})=>l.jsx("span",{children:an(e,r)}),getPopupContainer:F,options:y})}),l.jsx(Bl,{label:d("font_size"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:h,onFocus:e=>e?.target?.select?.(),onChange:v("fontSize")})}),l.jsx(Bl,{label:d("line_height"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"%",value:Number(String(b||"100").replace("%","")),onFocus:e=>e?.target?.select?.(),onChange:e=>v("lineHeight")(`${e??0}%`)})}),l.jsx(Bl,{label:d("letter_spacing")||"Letter spacing",children:l.jsx(t.InputNumber,{className:"input-width ee-settings-input-affix",addonAfter:"em",step:.01,value:parseFloat(String(N).replace("em",""))||0,onFocus:e=>e?.target?.select?.(),onChange:e=>v("letterSpacing")(`${e??0}em`)})}),l.jsx(Bl,{label:d("text_transform")||"Transform",children:l.jsx(t.Select,{className:"width-full",value:I,onChange:v("textTransform"),getPopupContainer:F,options:[{value:"none",label:"None"},{value:"uppercase",label:"UPPERCASE"},{value:"lowercase",label:"lowercase"},{value:"capitalize",label:"Capitalize"}]})}),l.jsx(Bl,{label:d("text_decoration")||"Decoration",children:l.jsx(t.Select,{className:"width-full",value:A,onChange:v("textDecoration"),getPopupContainer:F,options:[{value:"none",label:"None"},{value:"underline",label:"Underline"},{value:"line-through",label:"Strikethrough"}]})}),l.jsx(Ll,{children:d("border")||"Border"}),l.jsx(Bl,{label:d("border_width")||"Width",children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof L?L:parseInt(String(L||"0"),10)||0,onFocus:e=>e?.target?.select?.(),onChange:e=>v("borderWidth")(Number(e)||0)})}),l.jsx(Bl,{label:d("border_style")||"Style",children:l.jsx(t.Select,{className:"width-full",value:T,onChange:v("borderStyle"),getPopupContainer:F,options:[{value:"solid",label:d("solid")},{value:"dashed",label:d("dashed")},{value:"dotted",label:d("dotted")},{value:"none",label:d("video_border_none")}]})}),l.jsx(Bl,{label:d("border_color"),children:l.jsx(kl,{color:$,setColor:e=>v("borderColor")(e.hex)})}),l.jsx(Bl,{label:d("border_radius"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:c,onFocus:e=>e?.target?.select?.(),onChange:e=>v("borderRadius")(Number(e)||0)})}),l.jsx(Ll,{children:d("shadow")||"Shadow"}),l.jsx(Bl,{label:d("shadow_preset")||"Preset",children:l.jsx(t.Select,{className:"width-full",value:R,onChange:e=>{const t=B(a.data);t.shadowPreset=e,t.styles=t.styles??{},t.styles[i]=t.styles[i]??{},t.styles[i].boxShadow=M[e]??"",w(t)},getPopupContainer:F,options:[{value:"none",label:"None"},{value:"sm",label:"Small"},{value:"md",label:"Medium"},{value:"lg",label:"Large"}]})}),l.jsx(Ll,{children:d("button_padding")}),l.jsx(Bl,{label:d("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:_(a.data.styles,"paddingTop"),paddingRight:_(a.data.styles,"paddingRight"),paddingLeft:_(a.data.styles,"paddingLeft"),paddingBottom:_(a.data.styles,"paddingBottom")},setPadding:x})})]})})(),l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:d("spacing")}),l.jsx(Bl,{label:d("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:_(a.data.contentStyles,"paddingTop"),paddingRight:_(a.data.contentStyles,"paddingRight"),paddingLeft:_(a.data.contentStyles,"paddingLeft"),paddingBottom:_(a.data.contentStyles,"paddingBottom")},setPadding:e=>{const t=B(a.data);t.contentStyles[i]={...t.contentStyles[i],...e},w(t)}})})]})]})},xi=()=>{const{currentItem:a,previewMode:i}=e.useContext($e),{t:r}=Zo(),{findStyleItem:s,colorChange:c,updateItemStyles:d,inputChange:u}=Kl(),p=e=>{const t=B(a.data);t.contentStyles[i]={...t.contentStyles[i],...e},d(t)};return l.jsx("div",{className:"margin-y-30 ee-settings-block-form",children:(()=>{const e=s(a.data.contentStyles,"textAlign"),m=["left","center","right","justify"].includes(e)?e:"center",g=(e=>{if(null==e)return 100;if("number"==typeof e&&Number.isFinite(e))return Math.min(100,Math.max(0,e));const t=String(e).trim();if(/%$/.test(t)){const e=Number(t.replace(/%/,""));return Number.isFinite(e)?Math.min(100,Math.max(0,e)):100}const n=Number.parseFloat(t);return Number.isFinite(n)?Math.min(100,Math.max(0,n)):100})(s(a.data.styles,"width")),h=s(a.data.styles,"borderTopColor"),b=s(a.data.styles,"borderTopWidth"),y=s(a.data.styles,"borderTopStyle"),f=[{label:r("solid"),value:"solid"},{label:r("dotted"),value:"dotted"},{label:r("dashed"),value:"dashed"}];return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:r("divider")}),l.jsx(Bl,{label:r("divider_type"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:y||"solid",onChange:e=>u("borderTopStyle")(e),"aria-label":r("divider_type"),items:f.map(e=>({value:e.value,label:e.label}))})}),l.jsx(Bl,{label:r("height"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof b?b:0,onFocus:e=>e?.target?.select?.(),onChange:e=>u("borderTopWidth")("number"==typeof e?e:0)})}),l.jsx(Bl,{label:r("divider_color"),children:l.jsx(kl,{color:h,setColor:c("borderTopColor")})}),l.jsx(Bl,{label:r("width"),children:l.jsx(t.Slider,{min:0,max:100,value:g,tooltip:{formatter:e=>`${e}%`},onChange:e=>u("width")(`${e}%`)})}),l.jsx(Bl,{label:r("align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:m,onChange:e=>(e=>{const t=B(a.data);t.contentStyles[i]={...t.contentStyles[i],textAlign:e},d(t)})(e),"aria-label":r("align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignJustify,className:"tag-style-size"}),iconOnly:!0}]})}),l.jsx(Ll,{children:r("spacing")}),l.jsx(Bl,{label:r("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:s(a.data.contentStyles,"paddingTop"),paddingRight:s(a.data.contentStyles,"paddingRight"),paddingLeft:s(a.data.contentStyles,"paddingLeft"),paddingBottom:s(a.data.contentStyles,"paddingBottom")},setPadding:p})})]})})()})};function vi(e,t,n,o){const a=Number.parseInt(String(e??""),10);return Number.isNaN(a)?o:Math.min(n,Math.max(t,a))}const wi=()=>{const{currentItem:a}=e.useContext($e),{t:i}=Zo(),{findStyleItem:r,inputChange:s}=Kl(),c=r(a.data.styles,"height"),d="number"==typeof c?c:parseInt(c,10)||16;return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx(Ll,{children:i("spacer")}),l.jsx(Bl,{label:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(n.FontAwesomeIcon,{icon:o.faArrowsAltV,className:"tag-style-size"}),i("height")]}),children:l.jsx(t.InputNumber,{min:0,max:200,step:1,className:"input-width ee-settings-input-affix",addonAfter:"px",value:d,onFocus:e=>e?.target?.select?.(),onChange:e=>s("height")(vi(e,0,200,0)),onBlur:e=>s("height")(vi(e?.target?.value,0,200,0)),onKeyDown:e=>{if("ArrowUp"!==e.key&&"ArrowDown"!==e.key)return;e.preventDefault();const t="ArrowUp"===e.key?1:-1;s("height")(vi(d+t,0,200,0))}})})]})};function Si(e){if(null==e||""===e)return"400";const t=String(e).trim().toLowerCase();if("normal"===t||"regular"===t)return"400";if("bold"===t)return"700";if("bolder"===t)return"700";if("lighter"===t)return"300";if("light"===t)return"300";const n=Number(t);return Number.isNaN(n)?"400":n<=350?"300":n<=500?"400":n<=650?"600":"700"}const ji=new Set(["|","•","—","/","·"," "]);function Ci(e){return[...String(e??"")].filter(e=>ji.has(e)).join("")}const Ni=()=>{const{currentItem:a,previewMode:i,templateData:r}=e.useContext($e),{t:s}=Zo(),{findStyleItem:c,updateItemStyles:d,colorChange:u,inputChange:p}=Kl(),{list:g=[],separator:h=" | "}=a.data;e.useLayoutEffect(()=>{const e=a?.data?.separator,t=Ci(String(e??""));if(String(e??"")!==t){const e=B(a.data);e.separator=t,d(e)}},[a?.id,a?.data,d]);const[b,y]=e.useState(!1),[f,_]=e.useState(null),[k,x]=e.useState({}),v=e.useRef(null),w=()=>document.querySelector(".right-settings")||document.body,S=(e,t)=>{const n=B(a.data);n[e]=t,"list"===e&&(n.useNavigationLinks=!1),d(n)},j=(e,t,n)=>{const o=((e,t,n)=>{const o=String(e??"").trim(),a=`Menu item ${t+1}${n?` (${n})`:""} -> URL`,l=m(o,!1,{allowMailtoTel:!0});return l?"empty"===l?`${a} is empty. Add a destination like 'https://example.com'.`:"blocked_scheme"===l?`${a} ('${o}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===l?`${a} ('${o}') repeats the protocol. Keep one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===l?`${a} ('${o}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===l?`${a} ('${o}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`${a} ('${o}') is invalid. Fix it to a valid URL like 'https://example.com'.`:""})(e,t,n);x(e=>{if(!o&&!e[t])return e;const n={...e};return o?n[t]=o:delete n[t],n})},C=e.useCallback($(e=>{e.preventDefault();const t=v.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const a=f,l=B(g);null==a||a===o||l.length<2||([l[o],l[a]]=[l[a],l[o]],_(o),S("list",l))},50),[f]),N=tn(r),I=on(c(a.data.styles,"fontFamily"),r),A=[{label:s("same_tab"),value:"_self"},{label:s("new_tab"),value:"_blank"}],L=a.data.layoutMode??"nav-only",T=Boolean(a.data.showLogo),R=Boolean(a.data.borderBottom),P=a.data.borderBottomColor??"#e5e7eb",M=a.data.borderBottomWidth??1,F=a.data.mobileLayout??"stack",U=a.data.linkGapPx,D="number"==typeof U&&Number.isFinite(U)?U:0,E=Boolean(a.data.linkUnderline),z=c(a.data.contentStyles,"textAlign"),O=["left","center","right"].includes(z)?z:"center";return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx(Ll,{children:s("menu_layout")||"Menu layout"}),l.jsx(Bl,{label:s("mobile_layout")||"Mobile layout",children:l.jsx(t.Select,{className:"width-full",value:F,onChange:e=>S("mobileLayout",e),getPopupContainer:w,options:[{value:"stack",label:s("stack")||"Stack"},{value:"inline",label:s("inline")||"Inline"}]})}),["logo-left","logo-right","stacked","logo-only"].includes(L)&&l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:s("logo_section")}),l.jsx(Bl,{layout:"toggle",label:s("show_logo"),children:l.jsx(wl,{checked:T,onChange:e=>S("showLogo",e)})}),T?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:s("logo_url")||"Logo URL",children:l.jsx(t.Input,{className:"width-full",placeholder:"https://...",value:a.data.logoSrc??"",onChange:e=>S("logoSrc",e.target.value)})}),l.jsx(Bl,{label:s("logo_text")||"Logo text",children:l.jsx(t.Input,{className:"width-full",placeholder:s("logo_text_placeholder")||"Brand",value:a.data.logoText??"",onChange:e=>S("logoText",e.target.value)})}),l.jsx(Bl,{label:s("logo_alt")||"Alt text",children:l.jsx(t.Input,{className:"width-full",placeholder:"Logo",value:a.data.logoAlt??"",onChange:e=>S("logoAlt",e.target.value)})}),l.jsx(Bl,{label:s("logo_link")||"Logo link",children:l.jsx(t.Input,{className:"width-full",value:a.data.logoHref??"",onChange:e=>S("logoHref",e.target.value),placeholder:s("link_url_placeholder")||"example.com"})}),l.jsx(Bl,{label:s("logo_max_width"),children:l.jsx(t.InputNumber,{min:20,max:400,className:"input-width ee-settings-input-affix",addonAfter:"px",value:a.data.logoMaxWidth??120,onFocus:e=>e?.target?.select?.(),onChange:e=>S("logoMaxWidth",e??120)})})]}):null]}),l.jsx(Ll,{children:s("menu_items")}),l.jsx("div",{ref:v,onDragOver:C,className:"margin-top-12",children:g.map((e,a)=>l.jsx("div",{"data-index":a,draggable:!0,onDragStart:()=>{y(!0),_(a)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),y(!1),_(null)},className:Go("social-link-item","cursor-grab",b&&"social-link-item-drag_start",f===a?"social-link-item-current":"border-transparent"),children:l.jsxs("div",{className:"social-link-item-content ee-menu-item-content",children:[l.jsxs("div",{className:"ee-menu-item-header flex items-center justify-between margin-bottom-8",children:[l.jsxs("div",{className:"flex items-center ee-menu-item-drag-row",children:[l.jsx("span",{className:"social-link-item-drag-handle ee-menu-item-drag-handle","aria-hidden":!0,children:l.jsx(n.FontAwesomeIcon,{icon:o.faGripVertical,className:"social-link-item-drag-handle-icon"})}),l.jsxs("span",{className:"font-semibold",children:[s("menu_item")," ",a+1]})]}),l.jsx("div",{className:"social-link-item-icon social-link-item-icon-slate ee-menu-item-delete",role:"button",tabIndex:0,onClick:()=>S("list",g.filter((e,t)=>t!==a)),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S("list",g.filter((e,t)=>t!==a)))},children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash,className:"social-link-item-icon-svg social-link-item-icon-svg-deep"})})]}),l.jsxs("div",{className:"ee-menu-item-fields ee-settings-stack-flat",children:[l.jsx(Bl,{label:s("label"),children:l.jsx(t.Input,{className:"width-full ee-menu-item-input",value:e.label||"",onChange:e=>S("list",g.map((t,n)=>n===a?{...t,label:e.target.value}:t)),placeholder:s("page")||"Page"})}),l.jsxs(Bl,{label:s("url"),children:[l.jsx(t.Input,{className:"width-full ee-menu-item-input",value:e.url||"",status:k[a]?"error":"",onChange:t=>{const n=t.target.value;S("list",g.map((e,t)=>t===a?{...e,url:n}:e)),k[a]&&j(n,a,e.label)},onBlur:t=>j(t.target.value,a,e.label),placeholder:s("link_url_placeholder")||"example.com"}),k[a]?l.jsx("div",{className:"ee-field-error",role:"alert",children:k[a]}):null]}),l.jsx(Bl,{label:s("target"),children:l.jsx(t.Select,{className:"width-full ee-menu-item-input",value:e.target||"_self",onChange:e=>S("list",g.map((t,n)=>n===a?{...t,target:e}:t)),getPopupContainer:w,children:A.map(e=>l.jsx(t.Select.Option,{value:e.value,children:e.label},e.value))})})]})]})},a))}),l.jsxs("button",{type:"button",className:"menu-add-new-item margin-top-12",onClick:()=>S("list",g.concat({label:s("page")||"Page",url:"",target:"_self"})),children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",s("add_new_item")]}),l.jsx(Ll,{className:"margin-top-18",children:s("menu_styles")}),l.jsx(Bl,{label:s("font_family"),children:l.jsx(t.Select,{className:"width-full ee-font-family-select",value:I,showSearch:!0,optionFilterProp:"label",labelRender:({value:e})=>l.jsx("span",{children:an(e,r)}),onChange:e=>p("fontFamily")(on(e,r)),getPopupContainer:w,options:N})}),l.jsx(Bl,{label:s("font_size"),children:l.jsx(t.InputNumber,{min:8,max:72,className:"input-width ee-settings-input-affix",addonAfter:"px",value:c(a.data.styles,"fontSize"),onFocus:e=>e?.target?.select?.(),onChange:p("fontSize")})}),l.jsx(Bl,{label:s("letter_spacing"),children:l.jsx(t.InputNumber,{className:"input-width ee-settings-input-affix",addonAfter:"px",value:c(a.data.styles,"letterSpacing"),onFocus:e=>e?.target?.select?.(),onChange:p("letterSpacing")})}),l.jsx(Bl,{label:s("text_color"),children:l.jsx(kl,{color:c(a.data.styles,"color"),setColor:u("color")})}),l.jsx(Bl,{label:s("link_color"),children:l.jsx(kl,{color:c(a.data.styles,"linkColor"),setColor:u("linkColor")})}),l.jsx(Bl,{label:s("align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:O,onChange:e=>(e=>{const t=B(a.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]??{},textAlign:e},d(t)})(e),"aria-label":s("align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0}]})}),l.jsx(Bl,{label:s("separator"),hint:s("menu_separator_allowed_hint"),children:l.jsx(t.Input,{className:"width-full ee-menu-separator-input",value:Ci(h),onChange:e=>S("separator",Ci(e.target.value)),placeholder:s("menu_separator_placeholder")})}),l.jsx(Bl,{label:s("menu_link_gap")||"Link spacing",children:l.jsx(t.InputNumber,{min:0,max:96,className:"input-width ee-settings-input-affix",addonAfter:"px",value:D,onFocus:e=>e?.target?.select?.(),onChange:e=>(e=>{const t="number"==typeof e&&Number.isFinite(e)&&e>=0?Math.min(96,e):0,n=B(a.data);n.linkGapPx=t,d(n)})("number"==typeof e?e:0)})}),l.jsx(Bl,{layout:"toggle",label:s("menu_underline_links")||"Underline links",children:l.jsx(wl,{checked:E,onChange:e=>{const t=B(a.data);t.linkUnderline=!!e,d(t)}})}),l.jsx(Bl,{label:s("font_weight")||"Font weight",children:l.jsx(t.Select,{className:"width-full",value:Si(c(a.data.styles,"fontWeight")),onChange:p("fontWeight"),getPopupContainer:w,options:[{value:"300",label:s("font_weight_light")||"Light"},{value:"400",label:s("font_weight_regular")||"Regular"},{value:"600",label:s("font_weight_semibold")||"Semi-bold"},{value:"700",label:s("font_weight_bold")||"Bold"}]})}),l.jsx(Bl,{label:s("text_transform")||"Text transform",children:l.jsx(t.Select,{className:"width-full",value:c(a.data.styles,"textTransform")??"none",onChange:p("textTransform"),getPopupContainer:w,options:[{value:"none",label:"None"},{value:"uppercase",label:"UPPERCASE"},{value:"capitalize",label:"Capitalize"}]})}),l.jsx(Ll,{children:s("border_bottom")||"Border bottom"}),l.jsx(Bl,{layout:"toggle",label:s("show_border_bottom"),children:l.jsx(wl,{checked:R,onChange:e=>S("borderBottom",e)})}),R?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:s("border_color")||"Color",children:l.jsx(kl,{color:P,setColor:({hex:e})=>S("borderBottomColor",e)})}),l.jsx(Bl,{label:s("border_width")||"Width",children:l.jsx(t.InputNumber,{min:1,max:8,className:"input-width ee-settings-input-affix",addonAfter:"px",value:M,onFocus:e=>e?.target?.select?.(),onChange:e=>S("borderBottomWidth",e??1)})})]}):null,l.jsx(Ll,{className:"ee-menu-settings-padding-heading",children:s("padding_settings")}),l.jsx(Bl,{children:l.jsx(Sl,{padding:{paddingTop:c(a.data.contentStyles,"paddingTop"),paddingRight:c(a.data.contentStyles,"paddingRight"),paddingLeft:c(a.data.contentStyles,"paddingLeft"),paddingBottom:c(a.data.contentStyles,"paddingBottom")},setPadding:e=>{const t=B(a.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]??{},...e},d(t)}})})]})},Ii=()=>{const{currentItem:a,previewMode:i,templateData:r,apiConfig:s,bodySettings:c}=e.useContext($e),{t:d}=Zo(),{containerBlock:u,containerType:p,contentIndex:g}=di(),h=u?.columnProducts?.[g]??null,{findStyleItem:b,inputChange:y,updateItemStyles:f}=Kl(),_=e=>{const t=B(a.data);Object.assign(t,e),f(t)},k=e.useRef(null),[x,v]=e.useState(!1),[w,S]=e.useState(""),[j,C]=e.useState(""),N=e.useMemo(()=>({columnIndex:g,columnProduct:h}),[g,h]),I=e.useMemo(()=>Gt(p,r,N),[p,r,N]),{uploadImageFile:A,isConfigured:L}=ti({imageUploadEndpoint:s?.imageUploadEndpoint,headers:s?.headers||{},companyId:s?.companyId,imageUploadQueryParams:s?.imageUploadQueryParams,imageUploadCompanyField:s?.imageUploadCompanyField}),T=e=>{const t=B(a.data);t.contentStyles[i]={...t.contentStyles[i],...e},f(t)};return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[(()=>{const{linkURL:e}=a.data,n=qt(a.data),o=e=>{C((e=>{const t=String(e??"").trim(),n=m(t,!1,{allowMailtoTel:!0});return n?"empty"===n?"Image -> Link URL is empty. Add a destination like 'https://example.com' or disable link action.":"blocked_scheme"===n?`Image -> Link URL ('${t}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===n?`Image -> Link URL ('${t}') repeats the protocol. Keep only one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===n?`Image -> Link URL ('${t}') is missing a valid hostname. Use a full URL like 'https://example.com'.`:"invalid_protocol"===n?`Image -> Link URL ('${t}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`Image -> Link URL ('${t}') is invalid. Fix the URL format, for example 'https://example.com'.`:""})(e))};return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:d("image_action")}),l.jsx(Bl,{label:d("action_type"),children:l.jsxs("div",{className:"ee-settings-row ee-padding-link-sides-row",children:[l.jsx("span",{className:Go("link-tag",!n&&"ee-image-link-tag-inactive"),children:d("link")}),l.jsx(wl,{checked:n,onChange:e=>{const t=B(a);t.data.linkEnabled=Boolean(e),f(t.data)}})]})}),n?l.jsx(Bl,{label:d("link_url"),children:l.jsxs(l.Fragment,{children:[l.jsx(t.Input,{value:e??"",onChange:e=>{const t=e.target.value??"",n=B(a);n.data.linkURL=t,f(n.data),j&&o(t)},onBlur:e=>o(e.target.value),status:j?"error":"",placeholder:d("link_url_placeholder"),className:"width-full"}),j?l.jsx("div",{className:"ee-field-error",role:"alert",children:j}):null]})}):null]})})(),(()=>{const{src:e,alt:i}=a.data,s="string"==typeof e&&/^\{\{\w+\}\}$/.test(e.trim())?String(e).replace(/\{\{|\}\}/g,"").trim():"",c=r&&s?Ft(r,s,N):null,u=null==c||String(c).startsWith("{{")?e||"":c,p=e=>{S((e=>{const t=String(e??"").trim();if(/^\{\{\w+\}\}$/.test(t))return"";const n=m(t,!1,{allowMailtoTel:!1});return n?"empty"===n?"Image -> Image URL is empty. Add an image URL like 'https://example.com/image.jpg' or choose a variable.":"blocked_scheme"===n?`Image -> Image URL ('${t}') uses a blocked protocol. Use only http:// or https:// image URLs.`:"duplicate_protocol"===n?`Image -> Image URL ('${t}') repeats the protocol. Keep only one protocol, e.g. 'https://example.com/image.jpg'.`:"missing_hostname_dot"===n?`Image -> Image URL ('${t}') is missing a valid hostname. Use a full URL like 'https://example.com/image.jpg'.`:"invalid_protocol"===n?`Image -> Image URL ('${t}') has an unsupported protocol. Use only http:// or https:// image URLs.`:`Image -> Image URL ('${t}') is invalid. Fix the URL format, for example 'https://example.com/image.jpg'.`:""})(e))},g=e=>t=>{const n=B(a),o=t.target.value;n.data[e]=o,f(n.data),"src"===e&&w&&p(o)},h=e=>{const t=B(a);t.data.src=e,f(t.data)},b=()=>{k.current?.click()};return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:d("image")}),l.jsx(Bl,{label:d("image_upload"),children:l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:k,type:"file",accept:Ql,className:"ee-image-upload-input-hidden",onChange:async e=>{const n=e.target.files?.[0];if(!n)return;const o=ei(n);if("type"===o)return t.message.error(d("image_upload_invalid_type")||"Use PNG, JPEG, GIF, SVG, or WebP."),void(e.target.value="");if("size"===o)return t.message.error(d("image_file_too_large")),void(e.target.value="");if(!L)return t.message.error(d("image_upload_not_configured")||"Image upload not configured"),console.warn("[ImageStyleSettings] Image upload endpoint not configured"),void(e.target.value="");v(!0);try{const e=await A(n);e?(h(cn(e)),t.message.success(d("image_uploaded")||"Image uploaded successfully")):t.message.error(d("image_upload_failed")||"Failed to upload image")}catch(e){console.error("[ImageStyleSettings] Upload error:",e);const n="string"==typeof e?.message&&e.message.trim()?e.message.trim():null;t.message.error(n||d("image_upload_error")||"Error uploading image")}finally{v(!1),e.target.value=""}},disabled:x}),l.jsx(t.Spin,{spinning:x,children:l.jsxs("div",{role:"button",tabIndex:0,className:"ee-image-upload-trigger",onClick:b,onDrop:async e=>{e.preventDefault(),e.stopPropagation();const n=e.dataTransfer?.files?.[0];if(!n)return;const o=ei(n);if("type"!==o)if("size"!==o){if(!L)return t.message.error(d("image_upload_not_configured")||"Image upload not configured"),void console.warn("[ImageStyleSettings] Image upload endpoint not configured");v(!0);try{const e=await A(n);e?(h(cn(e)),t.message.success(d("image_uploaded")||"Image uploaded successfully")):t.message.error(d("image_upload_failed")||"Failed to upload image")}catch(e){console.error("[ImageStyleSettings] Upload error:",e);const n="string"==typeof e?.message&&e.message.trim()?e.message.trim():null;t.message.error(n||d("image_upload_error")||"Error uploading image")}finally{v(!1),k.current.value=""}}else t.message.error(d("image_file_too_large"));else t.message.error(d("image_upload_invalid_type")||"Use PNG, JPEG, GIF, SVG, or WebP.")},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},style:{opacity:x?.6:1,cursor:x?"not-allowed":"pointer"},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faCloudUploadAlt,className:"ee-image-upload-icon"}),l.jsx("span",{children:x?d("uploading")||"Uploading...":d("image_upload_click")})]})}),l.jsxs("div",{className:"ee-image-toolbar",children:[l.jsxs("button",{type:"button",className:"ee-image-toolbar-btn",onClick:b,disabled:x,children:[l.jsx(n.FontAwesomeIcon,{icon:o.faSyncAlt}),l.jsx("span",{children:d("replace")||"Replace"})]}),l.jsxs("button",{type:"button",className:"ee-image-toolbar-btn ee-image-toolbar-btn--danger",onClick:()=>_({src:""}),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faTrash}),l.jsx("span",{children:d("delete")||"Delete"})]})]}),l.jsx("div",{className:"ee-image-upload-hint",children:d("image_upload_file_hint")||"PNG, JPEG, GIF, SVG, WebP · max 10 MB"})]})}),I.length>0?l.jsx(Bl,{label:d("image_source_variable"),children:l.jsx(t.Select,{className:"ee-variable-select width-full",placeholder:d("image_source_variable"),allowClear:!0,value:"string"==typeof e&&/^\{\{\w+\}\}$/.test(String(e).trim())?String(e).trim():void 0,onChange:e=>h(e??""),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:I.map(e=>({value:e.value,label:d(e.labelKey)}))})}):null,l.jsx(Bl,{label:d("image_url"),children:l.jsxs(l.Fragment,{children:[l.jsx(t.Input,{className:"width-full",value:u,onChange:g("src"),onBlur:e=>p(e.target.value),status:w?"error":"",placeholder:"https://..."}),w?l.jsx("div",{className:"ee-field-error",role:"alert",children:w}):null]})}),l.jsx(Bl,{label:d("image_alt"),children:l.jsx(t.Input,{className:"width-full",value:i||"",onChange:g("alt"),placeholder:d("image_alt_placeholder")})})]})})(),(()=>{const e=a.data,i=c?.styles?.fontFamily??"sans-serif",s=Boolean(e.textOverlayEnabled),u=e.overlayPosition??"bc",p=Boolean(e.scrimEnabled),m=Boolean(e.textShadowEnabled),g=e.overlayMaxWidth??100,h=e.overlayItemGap??8,b=Array.isArray(e.overlayItems)?e.overlayItems:[],y=[{value:"eyebrow",label:"Eyebrow",defaultSize:11},{value:"h1",label:"H1",defaultSize:32},{value:"h2",label:"H2",defaultSize:24},{value:"h3",label:"H3",defaultSize:18},{value:"subtitle",label:"Subtitle",defaultSize:16},{value:"body",label:"Body",defaultSize:14}],f=(e,t)=>{const n=[...b];n[e]={...n[e],...t},_({overlayItems:n})},k=(e,t)=>{const n=[...b],o="up"===t?e-1:e+1;o<0||o>=n.length||([n[e],n[o]]=[n[o],n[e]],_({overlayItems:n}))},x=(e,t,o,a)=>l.jsx("button",{type:"button",disabled:t,onClick:e,style:{width:22,height:22,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"1px solid rgba(255,255,255,0.12)",borderRadius:3,cursor:t?"not-allowed":"pointer",color:a?"#f87070":"var(--ee-muted-foreground)",opacity:t?.35:1,padding:0,flexShrink:0},children:l.jsx(n.FontAwesomeIcon,{icon:o,style:{fontSize:9}})});return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:l.jsxs("span",{className:"ee-container-bg-heading-inline",children:[d("image_text_overlay"),l.jsx(t.Tooltip,{title:l.jsxs("div",{children:[l.jsx("p",{style:{marginBottom:8},children:d("image_text_overlay_tip")}),l.jsx("p",{style:{margin:0,opacity:.85},children:d("image_text_overlay_container_tip")})]}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:l.jsx("span",{className:"ee-help-icon ee-container-bg-section-help",tabIndex:0,"aria-label":d("image_text_overlay"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]})}),l.jsx(Bl,{layout:"toggle",label:d("image_text_overlay_enable"),children:l.jsx(wl,{checked:s,onChange:t=>{if(t&&!e.textOverlayEnabled){const e=b.length>0?b:[{kind:"eyebrow",text:"EYEBROW TEXT",color:"#d8fe91",fontSize:11,fontFamily:i},{kind:"h1",text:"Heading Text",color:"#ffffff",fontSize:32,fontFamily:i},{kind:"body",text:"Body copy goes here.",color:"#ffffff",fontSize:14,fontFamily:i}];_({textOverlayEnabled:!0,overlayItems:e})}else _({textOverlayEnabled:t})}})}),s?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:d("add_overlay_item")||"Add element",children:l.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:y.map(e=>l.jsxs("button",{type:"button",onClick:()=>(e=>{const t=y.find(t=>t.value===e)||y[5],n=[...b,{kind:e,text:"",color:"#ffffff",fontSize:t.defaultSize,fontFamily:i}];_({overlayItems:n})})(e.value),style:{padding:"4px 10px",background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:4,color:"var(--ee-foreground)",cursor:"pointer",fontSize:11,fontFamily:"inherit"},children:["+ ",e.label]},e.value))})}),b.length>0&&l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:12},children:b.map((e,n)=>l.jsxs("div",{style:{background:"rgba(255,255,255,0.04)",border:"1px solid var(--ee-border)",borderRadius:6,padding:"10px 12px"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:8},children:[x(()=>k(n,"up"),0===n,o.faChevronUp,!1),x(()=>k(n,"down"),n===b.length-1,o.faChevronDown,!1),l.jsx(t.Select,{size:"small",style:{flex:1},value:e.kind||"body",onChange:e=>f(n,{kind:e}),options:y.map(e=>({value:e.value,label:e.label})),getPopupContainer:()=>document.querySelector(".right-settings")||document.body}),x(()=>(e=>{_({overlayItems:b.filter((t,n)=>n!==e)})})(n),!1,o.faTrash,!0)]}),l.jsx(t.Input,{size:"small",value:e.text||"",placeholder:"Text content...",onChange:e=>f(n,{text:e.target.value}),style:{marginBottom:8}}),l.jsxs("div",{style:{marginBottom:8},children:[l.jsx("div",{style:{fontSize:11,color:"var(--ee-muted-foreground)",marginBottom:4},children:d("font_family")}),l.jsx(t.Select,{size:"small",className:"width-full ee-font-family-select",showSearch:!0,optionFilterProp:"label",value:on(null!=e.fontFamily&&""!==String(e.fontFamily).trim()?e.fontFamily:i,r),onChange:e=>f(n,{fontFamily:on(e,r)}),labelRender:({value:e})=>l.jsx("span",{children:an(e,r)}),options:tn(r),getPopupContainer:()=>document.querySelector(".right-settings")||document.body})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[l.jsx(kl,{color:e.color||"#ffffff",setColor:({hex:e})=>f(n,{color:e}),fallbackColor:"#ffffff"}),l.jsx(t.InputNumber,{size:"small",min:8,max:96,addonAfter:"px",value:e.fontSize||16,style:{flex:1},onChange:e=>f(n,{fontSize:"number"==typeof e?e:16})})]})]},n))}),l.jsx(Bl,{label:d("item_gap")||"Item gap",children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:h,onChange:e=>_({overlayItemGap:"number"==typeof e?e:8})})}),l.jsx(Bl,{label:d("image_overlay_position"),children:l.jsx("div",{className:"ee-image-overlay-position-grid",role:"group","aria-label":d("image_overlay_position"),children:hn.map(e=>l.jsx("button",{type:"button",className:Go("ee-image-overlay-position-cell",u===e&&"ee-image-overlay-position-cell-active"),title:d(`image_overlay_pos_${e}`),"aria-pressed":u===e,onClick:()=>_({overlayPosition:e}),children:l.jsx("span",{className:"ee-image-overlay-dot","aria-hidden":!0})},e))})}),l.jsx(Bl,{label:d("overlay_max_width")||"Max width",children:l.jsx(t.InputNumber,{min:20,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:g,onChange:e=>_({overlayMaxWidth:"number"==typeof e?e:100})})}),l.jsx(Bl,{label:d("image_overlay_box_bg"),children:l.jsx(t.Input,{className:"width-full",placeholder:"rgba(0,0,0,0.35)",value:e.overlayBoxBackground??"",onChange:e=>_({overlayBoxBackground:e.target.value})})}),l.jsx(Bl,{label:d("image_overlay_padding"),children:l.jsx(t.InputNumber,{min:0,max:120,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof e.overlayPadding?e.overlayPadding:16,onChange:e=>_({overlayPadding:"number"==typeof e?e:16})})}),l.jsx(Bl,{layout:"toggle",label:d("scrim")||"Scrim",children:l.jsx(wl,{checked:p,onChange:e=>_({scrimEnabled:e})})}),l.jsx(Bl,{layout:"toggle",label:d("text_shadow")||"Text shadow",children:l.jsx(wl,{checked:m,onChange:e=>_({textShadowEnabled:e})})})]}):null]})})(),(()=>{const e=b(a.data.styles,"width"),r=b(a.data.styles,"height"),s=b(a.data.styles,"borderRadius"),c="number"==typeof s?s:parseInt(String(s||"").replace("px",""),10)||0,u=b(a.data.contentStyles,"textAlign"),p=Boolean(a.data.fillColumn);return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:d("layout")}),l.jsx(Bl,{layout:"toggle",label:d("fill_column")||"Fill column",children:l.jsx(wl,{checked:p,onChange:e=>_({fillColumn:e})})}),l.jsx(Bl,{layout:"toggle",label:d("auto_width"),children:l.jsx(wl,{checked:"auto"===e,onChange:()=>{const t="auto"===e?"100%":"auto";y("width")(t)}})}),"auto"!==e?l.jsx(Bl,{label:d("width"),children:l.jsx(t.Slider,{value:Number(String(e).replace("%","")),onChange:e=>y("width")(e+"%")})}):null,l.jsx(Bl,{label:d("height")||"Height",children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",placeholder:"auto",value:r&&parseInt(String(r).replace("px",""),10)||void 0,onChange:e=>y("height")(e?`${e}px`:"auto")})}),l.jsx(Bl,{label:d("border_radius"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:c,onFocus:e=>e?.target?.select?.(),onChange:e=>y("borderRadius")(Number(e)||0)})}),l.jsx(Bl,{label:d("align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:u||"center",onChange:e=>(e=>{const t=B(a.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]||(t.contentStyles[i]={}),t.contentStyles[i]={...t.contentStyles[i],textAlign:e},"desktop"!==i&&(t.contentStyles.desktop||(t.contentStyles.desktop={}),t.contentStyles.desktop={...t.contentStyles.desktop,textAlign:e}),f(t)})(e),"aria-label":d("align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignJustify,className:"tag-style-size"}),iconOnly:!0}]})}),l.jsx(Ll,{children:d("spacing")}),l.jsx(Bl,{label:d("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:b(a.data.contentStyles,"paddingTop"),paddingRight:b(a.data.contentStyles,"paddingRight"),paddingLeft:b(a.data.contentStyles,"paddingLeft"),paddingBottom:b(a.data.contentStyles,"paddingBottom")},setPadding:T})})]})})()]})},Ai=()=>{const{currentItem:a,previewMode:i}=e.useContext($e),{t:r}=Zo(),{findStyleItem:s,updateItemStyles:c}=Kl(),d=e=>{const t=B(a.data);e(t),c(t)},u=e=>{const t=a.data.videoArea||{},n="desktop"===i?{}:t.desktop||{};return t[i]?.[e]??n[e]},p=e=>d(t=>{t.videoArea||(t.videoArea={desktop:{},mobile:{}}),t.videoArea[i]={...t.videoArea[i]||{},...e}}),m=s(a.data.contentStyles,"textAlign"),g=["left","center","right"].includes(m)?m:"center",h=l.jsxs("span",{className:"ee-container-bg-heading-inline",children:[r("video_url"),l.jsx(t.Tooltip,{title:r("video_export_note"),children:l.jsx("span",{className:"ee-help-icon ee-container-bg-section-help",tabIndex:0,"aria-label":r("video_export_note"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]});return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx(Ll,{children:r("video_tab_display")}),l.jsx(Bl,{label:h,children:l.jsx(t.Input,{className:"width-full",value:a.data.videoUrl??"",onChange:e=>d(t=>{t.videoUrl=e.target.value}),placeholder:"https://www.youtube.com/watch?v=..."})}),l.jsx(Bl,{label:r("video_thumbnail_url"),children:l.jsx(t.Input,{className:"width-full",value:a.data.thumbnailUrl??"",onChange:e=>d(t=>{t.thumbnailUrl=e.target.value}),placeholder:r("video_thumbnail_url_placeholder")})}),l.jsx(Ll,{children:r("video_thumbnail_layout")}),l.jsx(Bl,{label:r("video_width"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix ee-video-dim-field width-full",placeholder:"auto",addonAfter:"px",value:"number"==typeof s(a.data.styles,"width")?s(a.data.styles,"width"):void 0,onChange:e=>d(t=>{t.styles=t.styles||{desktop:{},mobile:{}},t.styles[i]={...t.styles[i]||{},width:null==e||""===e?"auto":e}})})}),l.jsx(Bl,{label:r("video_height"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix ee-video-dim-field width-full",placeholder:"auto",addonAfter:"px",value:"number"==typeof s(a.data.styles,"height")?s(a.data.styles,"height"):void 0,onChange:e=>d(t=>{t.styles=t.styles||{desktop:{},mobile:{}},t.styles[i]={...t.styles[i]||{},height:null==e||""===e?"auto":e}})})}),l.jsx(Bl,{label:r("alignment"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:g,onChange:e=>d(t=>{t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]||{},textAlign:e}}),"aria-label":r("alignment"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0}]})}),l.jsx(Bl,{layout:"toggle",label:r("video_fill_column"),children:l.jsx(wl,{checked:Boolean(s(a.data.styles,"fillColumn")),onChange:e=>d(t=>{t.styles=t.styles||{desktop:{},mobile:{}},t.styles[i]={...t.styles[i]||{},fillColumn:e}})})}),l.jsx(Bl,{layout:"toggle",label:r("video_fill_column_mobile"),children:l.jsx(wl,{checked:Boolean(s(a.data.styles,"fillColumnMobile")),onChange:e=>d(t=>{t.styles=t.styles||{desktop:{},mobile:{}},t.styles[i]={...t.styles[i]||{},fillColumnMobile:e}})})}),l.jsx(Ll,{children:r("video_area_section")}),l.jsx(Bl,{label:r("label_padding"),children:l.jsx(Sl,{setPadding:e=>d(t=>{t.videoArea||(t.videoArea={desktop:{},mobile:{}}),t.videoArea[i]={...t.videoArea[i]||{},...e}}),padding:{paddingTop:u("paddingTop")??0,paddingBottom:u("paddingBottom")??0,paddingLeft:u("paddingLeft")??0,paddingRight:u("paddingRight")??0}})}),l.jsx(Bl,{label:r("background_color"),children:l.jsx(kl,{color:"string"==typeof u("backgroundColor")&&u("backgroundColor").replace(/^#/,"")||"transparent",setColor:({hex:e})=>p({backgroundColor:e})})}),l.jsx(Bl,{label:r("divider_type"),children:l.jsxs(t.Select,{className:"width-full",value:u("borderStyle")||"solid",onChange:e=>p({borderStyle:e}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:[l.jsx(t.Select.Option,{value:"none",children:r("video_border_none")}),l.jsx(t.Select.Option,{value:"solid",children:r("solid")}),l.jsx(t.Select.Option,{value:"dashed",children:r("dashed")})]})}),l.jsx(Bl,{label:r("border_width"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:u("borderWidth")??0,onFocus:e=>e?.target?.select?.(),onChange:e=>p({borderWidth:null==e?0:e})})}),l.jsx(Bl,{label:r("border_color"),children:l.jsx(kl,{color:(u("borderColor")||"#cccccc").replace(/^#/,""),setColor:({hex:e})=>p({borderColor:e})})}),l.jsx(Ll,{children:r("video_block_section")}),l.jsx(Bl,{label:r("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:s(a.data.contentStyles,"paddingTop")??0,paddingBottom:s(a.data.contentStyles,"paddingBottom")??0,paddingLeft:s(a.data.contentStyles,"paddingLeft")??0,paddingRight:s(a.data.contentStyles,"paddingRight")??0},setPadding:e=>d(t=>{t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]||{},...e}})})}),l.jsx(Bl,{label:r("background_color"),children:l.jsx(kl,{color:(s(a.data.contentStyles,"backgroundColor")||"").replace(/^#/,"")||"transparent",setColor:({hex:e})=>d(t=>{t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]||{},backgroundColor:e}})})})]})},Li=()=>{const{currentItem:n}=e.useContext($e),{t:o}=Zo(),{findStyleItem:a,cardItemElement:i,updateItemStyles:r}=Kl(),{src:s,alt:c,linkURL:d}=n.data,u=a(n.data.styles,"width")??64,p=a(n.data.styles,"borderRadius"),m="50%"===p?50:parseInt(String(p).replace("px",""),10)||0;return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx("div",{className:"right-setting-block-item-title",children:o("avatar_image")}),i(o("image_url"),l.jsx(t.Input,{value:s,onChange:e=>{const t=B(n.data);t.src=e.target.value??"",r(t)}})),i(o("image_alt"),l.jsx(t.Input,{value:c,onChange:e=>{const t=B(n.data);t.alt=e.target.value??"",r(t)},placeholder:"Avatar"})),i(o("link_url"),l.jsx(t.Input,{value:d,onChange:e=>{const t=B(n.data);t.linkURL=e.target.value??"",r(t)},placeholder:o("link_url_placeholder")})),l.jsx("div",{className:"right-setting-block-item-title margin-top-18",children:o("image_styles")}),i(o("width"),l.jsx(t.InputNumber,{min:16,max:256,value:"number"==typeof u?u:64,onChange:e=>{const t=B(n.data);t.styles.desktop||(t.styles.desktop={}),t.styles.desktop.width=e,r(t)},addonAfter:"px"})),i(o("avatar_border_radius"),l.jsx(t.InputNumber,{min:0,max:50,value:m,onChange:e=>{const t=B(n.data);t.styles.desktop||(t.styles.desktop={}),t.styles.desktop.borderRadius=50===e?"50%":`${e}px`,r(t)},addonAfter:50===m?"%":"px"})),l.jsx("div",{className:"right-setting-block-item-title margin-top-18",children:o("padding_settings")}),l.jsx(Sl,{padding:{paddingTop:a(n.data.contentStyles,"paddingTop"),paddingRight:a(n.data.contentStyles,"paddingRight"),paddingLeft:a(n.data.contentStyles,"paddingLeft"),paddingBottom:a(n.data.contentStyles,"paddingBottom")},setPadding:e=>{const t=B(n.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles.desktop={...t.contentStyles.desktop,...e},r(t)}})]})},Ti="__ee_social_custom__";function Bi({preset:e,settingsPanelIconColor:t,t:n}){const{src:o,style:a}=L(e,t,22);return l.jsxs("span",{className:"ee-social-add-menu-item",children:[o?l.jsx("img",{src:o,alt:"",className:"ee-social-add-menu-icon",style:a,draggable:!1}):null,l.jsx("span",{children:g(e)?n("social_platform_x"):e.title})]})}function $i(e,t){const n=String(e?.image||"").trim(),o=String(t?.image||"").trim();if(n&&o&&n===o)return!0;const a=String(e?.title||"").trim().toLowerCase(),l=String(t?.title||"").trim().toLowerCase();return Boolean(a&&l&&a===l)}const Ri={facebook:"social_link_placeholder_facebook",linkedin:"social_link_placeholder_linkedin",instagram:"social_link_placeholder_instagram",tiktok:"social_link_placeholder_tiktok",youtube:"social_link_placeholder_youtube",pinterest:"social_link_placeholder_pinterest"};function Pi(e,t){if(g(e))return t("social_link_placeholder_x");const n=String(e?.title||"").trim().toLowerCase(),o=Ri[n];return t(o||"social_link_placeholder_generic")}function Mi({blockNode:a,onUpdateBlock:i,previewMode:r,findStyleItem:s,apiConfig:c,templateData:d,embedded:u=!1}){const{t:p}=Zo(),h=e.useMemo(()=>Array.isArray(a.list)?a.list:[],[a.list]),[y,_]=e.useState(!1),[k,v]=e.useState(null),[w,S]=e.useState({}),[j,C]=e.useState(null),N=e.useRef(null),I=e.useRef(null),[A,T]=e.useState(null),[R,M]=e.useState(null),{uploadImageFile:F,isConfigured:U}=ti({imageUploadEndpoint:c?.imageUploadEndpoint,headers:c?.headers||{},companyId:c?.companyId,imageUploadQueryParams:c?.imageUploadQueryParams,imageUploadCompanyField:c?.imageUploadCompanyField}),D=[{image:x("facebook"),title:"Facebook",linkURL:""},{image:x("linkedin"),title:"LinkedIn",linkURL:""},{image:x("instagram"),title:"Instagram",linkURL:""},{image:x("tiktok"),title:"TikTok",linkURL:""},{image:x("x"),title:"X",linkURL:""},{image:x("youtube"),title:"YouTube",linkURL:""},{image:x("pinterest"),title:"Pinterest",linkURL:""}];e.useEffect(()=>{null!=j&&j>=h.length&&C(h.length?h.length-1:null)},[j,h.length]);const E=(e,t)=>{const n=B(a),o=function(e){if(!Array.isArray(e))return e;const t=[];for(const n of e)t.some(e=>$i(e,n))||t.push(n);return t}(t);n[e]=o,n.useCompanySocialLinks=!1,i(n)},z=(e,t)=>{E("list",h.map((n,o)=>o===e?{...n,...t}:n))},O=(e,t,n)=>{const o=((e,t,n)=>{const o=String(e??"").trim(),a=`Social links -> ${n||`Item ${t+1}`} URL`,l=m(o,!1,{allowMailtoTel:!1});return l?"empty"===l?`${a} is empty. Add a profile URL like 'https://example.com'.`:"blocked_scheme"===l?`${a} ('${o}') uses a blocked protocol. Use only http:// or https:// URLs.`:"duplicate_protocol"===l?`${a} ('${o}') repeats the protocol. Keep one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===l?`${a} ('${o}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===l?`${a} ('${o}') has an unsupported protocol. Use only http:// or https:// URLs.`:`${a} ('${o}') is invalid. Fix it to a valid URL like 'https://example.com'.`:""})(e,t,n);S(e=>{if(!o&&!e[t])return e;const n={...e};return o?n[t]=o:delete n[t],n})},W=e.useCallback($(e=>{e.preventDefault();const t=N.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const a=k,l=B(h);a!==o&&([l[o],l[a]]=[l[a],l[o]],v(o),E("list",l),C(e=>e===a?o:e===o?a:e))},50),[k,h,u]),H=()=>document.querySelector(".right-settings")||document.body,K=s(a.contentStyles,"textAlign"),V=["left","center","right","justify"].includes(K)?K:"center",G=s(a.contentStyles,"columnGapPx"),q="number"==typeof G&&Number.isFinite(G)&&G>=0?G:8,J=function(e){if(e?.iconSize&&null!=f[e.iconSize])return e.iconSize;const t=Number(e?.imageWidth);if(!Number.isFinite(t)||t<=0)return"medium";let n="medium",o=1/0;for(const[e,a]of Object.entries(f)){const l=Math.abs(t-a);l<o&&(o=l,n=e)}return n}(a),Y=b(a.iconColor),X="default"===Y?"default":"white",Z=Boolean(a.showTextLabel),Q=e.useMemo(()=>[{value:"small",label:p("icon_size_small")},{value:"medium",label:p("icon_size_medium")},{value:"large",label:p("icon_size_large")}],[p]),ee=D.filter(e=>!h.some(t=>$i(t,e))),te=[...D.map(e=>({value:e.title,label:g(e)?p("social_platform_x"):e.title})),{value:Ti,label:p("social_platform_custom")}],ne=[{value:"default",label:p("icon_color_default")},{value:"white",label:p("icon_color_white")},{value:"black",label:p("icon_color_black")},{value:"gray",label:p("icon_color_gray")}],oe=[...ee.map(e=>({key:e.title+e.image,label:l.jsx(Bi,{preset:e,settingsPanelIconColor:X,t:p}),onClick:()=>{E("list",h.concat({...e,id:P()})),C(h.length)}})),{key:"__add_custom_social_row__",label:l.jsxs("span",{className:"ee-social-add-menu-item ee-social-add-menu-item--custom",children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"}),l.jsx("span",{children:p("social_platform_custom")})]}),onClick:()=>{E("list",h.concat({id:P(),image:"",title:"",linkURL:""})),C(h.length)}}];return l.jsxs("div",{className:Go("ee-settings-block-form ee-social-link-settings",!u&&"margin-y-30"),children:[u?null:l.jsx(Ll,{className:"ee-social-link-settings-section",children:p("social_settings_icons")}),l.jsxs("div",{ref:N,onDragOver:W,className:"ee-social-link-icons-list",children:[l.jsx("input",{ref:I,type:"file",accept:Ql,className:"ee-image-upload-input-hidden",onChange:async e=>{const n=e.target.files?.[0];e.target.value="";const o=A;if(T(null),null==n||null==o)return;const a=ei(n);if("type"!==a)if("size"!==a){M(o);try{const e=await F(n);e?(z(o,{image:cn(e)}),t.message.success(p("image_uploaded"))):t.message.error(p("image_upload_failed"))}catch(e){t.message.error(p("image_upload_error"))}finally{M(null)}}else t.message.error(p("image_file_too_large"));else t.message.error(p("image_upload_invalid_type"))}}),h.map((e,a)=>{const{title:i,linkURL:r}=e,s=g(e),c=function(e,t){const n=String(e?.image||"").trim(),o=t.find(e=>e.image===n);if(o)return o;if(g(e))return t.find(e=>g(e))??null;const a=String(e?.title||"").trim();return a?t.find(e=>e.title===a)??null:null}(e,D),d=!c,u=d&&!String(i||"").trim()?p("social_platform_custom"):s?p("social_platform_x"):i,m=d&&!String(i||"").trim()?p("social_platform_custom"):s?p("social_platform_x_alt"):i,b=L(e,X,22),f=L(e,X,28),x=c?c.title:Ti,S=j===a;return l.jsx("div",{"data-index":a,draggable:!0,onDragStart:()=>{_(!0),v(a)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),_(!1),v(null)},className:Go("social-link-item","cursor-grab",y&&"social-link-item-drag_start",k===a?"social-link-item-current":"border-transparent"),children:l.jsxs("div",{className:Go("social-link-item-content","ee-menu-item-content","ee-social-link-row-shell"),children:[l.jsxs("div",{className:"ee-social-link-row-header",children:[l.jsx("span",{className:"social-link-item-drag-handle","aria-hidden":!0,children:l.jsx(n.FontAwesomeIcon,{icon:o.faGripVertical,className:"social-link-item-drag-handle-icon"})}),b.src?l.jsx("img",{src:b.src,alt:m,className:"social-link-item-img",style:b.style,draggable:!1}):l.jsx("div",{className:"social-link-item-img ee-social-row-icon-placeholder","aria-hidden":!0}),l.jsx("div",{className:"ee-social-link-row-header-main",children:l.jsxs("div",{className:"social-link-platform-title-wrap ee-social-link-row-title-wrap",children:[l.jsx("div",{className:"font-semibold ee-social-link-row-primary-title",children:u}),s?l.jsx("div",{className:"social-link-platform-former-name",children:p("social_platform_formerly_twitter")}):null]})}),l.jsxs("div",{className:"ee-social-link-row-tools",children:[l.jsx("button",{type:"button",className:"ee-social-link-row-icon-btn","aria-expanded":S,"aria-label":p(S?"collapse":"expand"),onClick:e=>{e.stopPropagation(),(e=>{C(t=>t===e?null:e)})(a)},children:l.jsx(n.FontAwesomeIcon,{icon:S?o.faChevronUp:o.faChevronDown})}),l.jsx("button",{type:"button",className:"ee-social-link-row-icon-btn ee-social-link-row-icon-btn-danger","aria-label":p("delete"),onClick:e=>{e.stopPropagation(),E("list",h.filter((e,t)=>t!==a)),C(e=>e===a?null:null!=e&&e>a?e-1:e)},children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash,className:"social-link-item-icon-svg"})})]})]}),S?l.jsxs("div",{className:"ee-social-link-row-detail",children:[l.jsx(Bl,{label:p("social_platform_field"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:x,options:te,getPopupContainer:H,onChange:e=>{if(e===Ti)return void z(a,{title:"",image:""});const t=D.find(t=>t.title===e);t&&z(a,{image:t.image,title:t.title})}})}),l.jsx(Bl,{label:p("social_icon_label_field"),children:l.jsx(t.Input,{className:"width-full",value:i||"",placeholder:u,onChange:e=>z(a,{title:e.target.value})})}),l.jsxs(Bl,{label:p("url"),children:[l.jsx(t.Input,{className:"width-full",placeholder:Pi(e,p),value:r||"",status:w[a]?"error":"",onChange:e=>{const t=e.target.value;E("list",h.map((e,n)=>n===a?{...e,linkURL:t}:e)),w[a]&&O(t,a,u)},onBlur:e=>O(e.target.value,a,u)}),w[a]?l.jsx("div",{className:"ee-field-error",role:"alert",children:w[a]}):null]}),l.jsx(Bl,{label:p("social_custom_icon"),children:l.jsxs("div",{className:"ee-social-custom-icon-row",children:[l.jsx("div",{className:"ee-social-custom-icon-preview",children:f.src?l.jsx("img",{src:f.src,alt:"",style:f.style,draggable:!1}):l.jsx("span",{className:"ee-social-custom-icon-preview-empty","aria-hidden":!0})}),l.jsx("button",{type:"button",className:"menu-add-new-item ee-social-custom-upload-btn",disabled:!U||R===a,onClick:()=>(e=>{U?(T(e),requestAnimationFrame(()=>I.current?.click?.())):t.message.error(p("image_upload_not_configured"))})(a),children:p(R===a?"uploading":"image_upload")})]})})]}):null]})},e.id??`${e.image??""}-${a}`)})]}),u?null:l.jsx(t.Dropdown,{overlayClassName:"ee-social-add-platform-dropdown",menu:{items:oe},trigger:["click"],getPopupContainer:H,children:l.jsxs("button",{type:"button",className:"menu-add-new-item margin-top-12",children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",p("social_add_icon")]})}),l.jsx(Ll,{className:"ee-social-link-settings-section ee-social-link-settings-style-heading",children:p("social_settings_style")}),l.jsx(Ll,{className:"ee-social-link-settings-subsection",children:p("icon_styles")}),l.jsx(Bl,{label:p("icon_size"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:J,onChange:e=>{const t=B(a);t.iconSize=e,t.imageWidth=f[e]??32,t.iconSizePx=null,i(t)},getPopupContainer:H,options:Q})}),l.jsx(Bl,{label:p("icon_color"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:Y,onChange:e=>{const t=b(e),n=B(a);n.iconColor=t,n.iconColorHex=null,i(n)},getPopupContainer:H,options:ne})}),l.jsx(Bl,{layout:"toggle",label:p("show_text_label"),children:l.jsx(wl,{checked:Z,onChange:e=>{const t=B(a);t.showTextLabel=e,i(t)}})}),l.jsx(Bl,{label:p("social_icon_spacing"),children:l.jsx(t.InputNumber,{min:0,max:96,className:"input-width ee-settings-input-affix",addonAfter:"px",value:q,onFocus:e=>e?.target?.select?.(),onChange:e=>(e=>{const t="number"==typeof e&&Number.isFinite(e)&&e>=0?Math.min(96,e):8,n=B(a);n.contentStyles||(n.contentStyles={desktop:{},mobile:{}}),n.contentStyles[r]={...n.contentStyles[r]||{},columnGapPx:t},i(n)})(e)})}),l.jsx(Bl,{label:p("align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:V,onChange:e=>(e=>{const t=B(a);t.contentStyles[r]={...t.contentStyles[r],textAlign:e},i(t)})(e),"aria-label":p("align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignJustify,className:"tag-style-size"}),iconOnly:!0}]})}),u?null:l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"ee-social-settings-padding-heading ee-social-link-settings-subsection",children:p("padding_settings")}),l.jsx(Bl,{children:l.jsx(Sl,{padding:{paddingTop:s(a.contentStyles,"paddingTop"),paddingRight:s(a.contentStyles,"paddingRight"),paddingLeft:s(a.contentStyles,"paddingLeft"),paddingBottom:s(a.contentStyles,"paddingBottom")},setPadding:e=>{const t=B(a);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[r]||(t.contentStyles[r]={}),t.contentStyles[r]={...t.contentStyles[r],...e},i(t)}})})]})]})}const Fi=()=>{const{currentItem:t,previewMode:n,apiConfig:o,templateData:a}=e.useContext($e),{findStyleItem:i,updateItemStyles:r}=Kl(),s=e.useCallback(e=>{r(e)},[r]);return l.jsx(Mi,{blockNode:t.data,onUpdateBlock:s,previewMode:n,findStyleItem:i,apiConfig:o,templateData:a,embedded:!1})},{TextArea:Ui}=t.Input;const Di=()=>{const{currentItem:a,previewMode:i}=e.useContext($e),{t:r}=Zo(),{findStyleItem:s,updateItemStyles:c}=Kl(),d=e=>{const t=B(a.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]??{},...e},c(t)},u=s(a.data.contentStyles,"textAlign"),p=["left","center","right","justify"].includes(u)?u:"center",m=function(e){if(null==e||""===e)return 100;if("number"==typeof e)return Math.min(100,Math.max(10,Math.round(e)));const t=String(e).trim().match(/^(\d+(?:\.\d+)?)%$/);return t?Math.min(100,Math.max(10,Math.round(Number(t[1])))):100}(s(a.data.contentStyles,"width")),g=s(a.data.contentStyles,"backgroundColor"),h=function(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e))return Math.min(48,Math.max(0,Math.round(e)));const t=String(e).trim().replace(/px$/i,""),n=Number.parseFloat(t);return Number.isFinite(n)?Math.min(48,Math.max(0,Math.round(n))):0}(s(a.data.contentStyles,"borderRadius"));return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form ee-raw-html-settings",children:[l.jsx(Ll,{className:"ee-raw-html-heading-row",children:l.jsxs("span",{className:"ee-raw-html-title-left",children:[l.jsx(n.FontAwesomeIcon,{icon:o.faCode,className:"ee-raw-html-title-icon","aria-hidden":!0}),l.jsx("span",{className:"ee-raw-html-block-heading-text",children:r("raw_html_block")}),l.jsx(t.Tooltip,{title:r("raw_html_code_hint"),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:l.jsx("span",{className:"ee-help-icon ee-raw-html-title-help",tabIndex:0,"aria-label":r("raw_html_info_tooltip_aria"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]})}),l.jsx("p",{className:"ee-raw-html-block-description",children:r("raw_html_block_description")}),l.jsx(Bl,{label:r("raw_html_code_label"),children:l.jsx(Ui,{className:"ee-raw-html-code-textarea",value:a.data.html??"",onChange:e=>(e=>{const t=B(a.data);t.html=e,c(t)})(e.target.value),autoSize:{minRows:10,maxRows:28},spellCheck:!1})}),l.jsx(Ll,{children:r("raw_html_appearance")}),l.jsx(Bl,{label:r("width"),children:l.jsx(t.Slider,{min:10,max:100,value:m,tooltip:{formatter:e=>`${e}%`},onChange:e=>{d({width:`${e}%`})}})}),l.jsx(Bl,{label:r("align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:p,onChange:e=>(e=>{d({textAlign:e})})(e),"aria-label":r("align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignJustify,className:"tag-style-size"}),iconOnly:!0}]})}),l.jsx(Bl,{label:r("border_radius"),children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:h,onFocus:e=>e?.target?.select?.(),onChange:e=>(e=>{const t="number"==typeof e&&Number.isFinite(e)?Math.min(48,Math.max(0,Math.round(e))):0;if(0===t){const e=B(a.data);e.contentStyles||(e.contentStyles={desktop:{},mobile:{}});const t={...e.contentStyles[i]??{}};return delete t.borderRadius,e.contentStyles[i]=t,void c(e)}d({borderRadius:t})})("number"==typeof e?e:0)})}),l.jsx(Bl,{label:r("background_color"),children:l.jsxs("div",{className:"ee-raw-html-bg-row",children:[l.jsx(kl,{color:g,setColor:({hex:e})=>{d({backgroundColor:e})},fallbackColor:"#ffffff"}),null!=g&&""!==String(g).trim()&&"transparent"!==String(g).toLowerCase()?l.jsx(t.Button,{type:"link",size:"small",onClick:()=>{const e=B(a.data),t=e.contentStyles[i]||{},{backgroundColor:n,...o}=t;e.contentStyles[i]=o,c(e)},children:r("raw_html_clear_background")}):null]})}),l.jsx(Ll,{className:"ee-raw-html-settings-padding-heading",children:r("padding_settings")}),l.jsx(Bl,{children:l.jsx(Sl,{padding:{paddingTop:s(a.data.contentStyles,"paddingTop"),paddingRight:s(a.data.contentStyles,"paddingRight"),paddingLeft:s(a.data.contentStyles,"paddingLeft"),paddingBottom:s(a.data.contentStyles,"paddingBottom")},setPadding:e=>{d(e)}})}),l.jsxs("div",{className:"ee-raw-html-email-warning",role:"note",children:[l.jsx(n.FontAwesomeIcon,{icon:o.faExclamationTriangle,className:"ee-raw-html-email-warning-icon","aria-hidden":!0}),l.jsx("span",{children:r("raw_html_email_client_warning")})]})]})},Ei=[{value:"none",label:"None"},{value:"solid",label:"Solid"},{value:"dashed",label:"Dashed"},{value:"dotted",label:"Dotted"}],zi=()=>{const{currentItem:a,previewMode:i}=e.useContext($e),{t:r}=Zo(),{findStyleItem:s,updateItemStyles:c}=Kl(),d=()=>document.querySelector(".right-settings")||document.body,u=e=>{const t=B(a.data);Object.assign(t,e),c(t)},p=e=>{const t=B(a.data);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),"desktop"!==i&&(t.styles.mobile||(t.styles.mobile={}),Object.assign(t.styles.mobile,e)),c(t)},m=a.data.rows??3,g=a.data.cols??3,h=Boolean(a.data.headerRow),b=Boolean(a.data.headerCol),y=a.data.selectedCell??null,f=a.data.structureMode??"static",_=s(a.data.styles,"fontSize")??14,k=s(a.data.styles,"color")??"#333333",x=s(a.data.styles,"borderColor")??"#e0e0e0",v=s(a.data.styles,"borderStyle")??"solid",w=s(a.data.styles,"borderWidth")??1,S=s(a.data.styles,"cellPadding")??8,j=s(a.data.styles,"textAlign")??"left",C=s(a.data.styles,"headerBg")??"#f5f5f5",N=s(a.data.styles,"headerColor")??"#333333",I=Boolean(a.data.stripedRows),A=s(a.data.styles,"stripedBg")??"#fafafa",L="number"==typeof g?g:3,T="number"==typeof m?m:3,$=e.useMemo(()=>y&&a.data.cells?a.data.cells[y]??null:null,[y,a.data.cells]),R="image"===$?.type?"image":"text",P=e=>{if(!y)return;const t={...a.data.cells||{}};t[y]={...t[y]||{},...e},u({cells:t})},M=Math.min(T,8),F=Math.min(L,8),U=e.useMemo(()=>{if("string"!=typeof y)return null;const e=y.match(/^(\d+)-(\d+)$/);return e?{row:Number(e[1])+1,col:Number(e[2])+1}:null},[y]),D=e.useMemo(()=>[{value:"left",label:r("table_align_left")},{value:"center",label:r("table_align_center")},{value:"right",label:r("table_align_right")}],[r]);return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form ee-table-settings",children:[l.jsx(Ll,{children:r("table_structure")}),l.jsx(Bl,{label:r("table_structure_mode"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:f,onChange:e=>u({structureMode:e}),"aria-label":r("table_structure_mode"),items:[{value:"static",label:r("table_mode_static")},{value:"dynamic",label:r("table_mode_dynamic")}]})}),"dynamic"===f?l.jsx("div",{className:"ee-table-dynamic-hint",role:"note",children:r("table_dynamic_structure_hint")}):null,l.jsx(Bl,{label:r("rows"),children:l.jsx(t.InputNumber,{min:1,max:20,className:"width-full ee-settings-input-affix ee-table-dimension-input",value:T,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t="number"==typeof e&&Number.isFinite(e)?Math.round(e):null;null!=t&&u({rows:Math.min(20,Math.max(1,t))})}})}),l.jsx(Bl,{label:r("columns"),children:l.jsx(t.InputNumber,{min:1,max:12,className:"width-full ee-settings-input-affix ee-table-dimension-input",value:L,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t="number"==typeof e&&Number.isFinite(e)?Math.round(e):null;null!=t&&u({cols:Math.min(12,Math.max(1,t))})}})}),l.jsxs("div",{className:"ee-table-add-actions",children:[l.jsxs("button",{type:"button",className:"ee-table-add-btn menu-add-new-item",onClick:()=>u({rows:Math.min(20,T+1)}),disabled:T>=20,children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",r("table_add_row")]}),l.jsxs("button",{type:"button",className:"ee-table-add-btn menu-add-new-item",onClick:()=>u({cols:Math.min(12,L+1)}),disabled:L>=12,children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",r("table_add_column")]})]}),l.jsx(Bl,{layout:"toggle",label:r("header_row"),children:l.jsx(wl,{checked:h,onChange:e=>u({headerRow:e})})}),l.jsx(Bl,{layout:"toggle",label:r("header_column"),children:l.jsx(wl,{checked:b,onChange:e=>u({headerCol:e})})}),l.jsx(Ll,{className:"margin-top-12",children:r("cell_selector")}),l.jsxs("div",{className:"ee-table-cell-picker-wrap",children:[l.jsx("div",{className:"ee-table-cell-picker-grid",style:{gridTemplateColumns:`repeat(${F}, minmax(0, 1fr))`},children:Array.from({length:M*F}).map((e,t)=>{const n=Math.floor(t/F),o=t%F,i=`${n}-${o}`,r=y===i,s=h&&0===n||b&&0===o;return l.jsxs("button",{type:"button",className:`ee-table-cell-picker-btn${r?" ee-table-cell-picker-btn--selected":""}${s?" ee-table-cell-picker-btn--header":""}`,onClick:()=>{if(r)return void u({selectedCell:null});const e={...a.data.cells||{}};e[i]||(e[i]={type:"text",text:""}),u({selectedCell:i,cells:e})},children:[n+1,",",o+1]},i)})}),T>M||L>F?l.jsx("div",{className:"ee-table-cell-picker-caption",children:r("table_cell_grid_truncated",{rows:M,cols:F})}):null,y&&U?l.jsx("div",{className:"ee-table-selected-label",children:r("table_selected_cell",{row:U.row,col:U.col})}):l.jsx("div",{className:"ee-table-selected-label ee-table-selected-label--muted",children:r("table_select_cell_hint")})]}),y?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:r("cell_content")}),l.jsx(Bl,{label:r("cell_content_type"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:R,onChange:e=>{P("image"===e?{type:"image",src:"",alt:""}:{type:"text",text:$?.text??""})},"aria-label":r("cell_content_type"),items:[{value:"text",icon:l.jsx(n.FontAwesomeIcon,{icon:o.faFont,className:"tag-style-size"}),label:r("text")},{value:"image",icon:l.jsx(n.FontAwesomeIcon,{icon:o.faImage,className:"tag-style-size"}),label:r("image")}]})}),"text"===R?l.jsx(Bl,{label:r("content"),children:l.jsx(t.Input.TextArea,{className:"ee-table-cell-textarea",rows:4,value:$?.text??"",placeholder:r("table_cell_text_placeholder"),onChange:e=>P({text:e.target.value})})}):l.jsx(Bl,{label:r("image"),children:l.jsx(t.Input,{className:"width-full",value:$?.src??"",placeholder:"https://...",onChange:e=>P({src:e.target.value})})})]}):null,l.jsx(Ll,{className:"margin-top-12",children:r("table_style")}),l.jsx(Bl,{label:r("font_size"),children:l.jsx(t.InputNumber,{min:8,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof _?_:parseInt(String(_||"14"),10),onFocus:e=>e?.target?.select?.(),onChange:e=>p({fontSize:e??14})})}),l.jsx(Bl,{label:r("text_color"),children:l.jsx(kl,{color:k,setColor:({hex:e})=>p({color:e})})}),l.jsx(Bl,{label:r("text_align"),children:l.jsx(t.Select,{className:"width-full",value:j,onChange:e=>p({textAlign:e}),getPopupContainer:d,options:D})}),l.jsx(Bl,{label:r("cell_padding"),children:l.jsx(t.InputNumber,{min:0,max:40,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof S?S:parseInt(String(S||"8"),10),onFocus:e=>e?.target?.select?.(),onChange:e=>p({cellPadding:e??8})})}),l.jsx(Ll,{className:"margin-top-12",children:r("border")}),l.jsx(Bl,{label:r("border_style"),children:l.jsx(t.Select,{className:"width-full",value:v,onChange:e=>p({borderStyle:e}),getPopupContainer:d,options:Ei})}),"none"!==v?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:r("border_width"),children:l.jsx(t.InputNumber,{min:0,max:10,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof w?w:parseInt(String(w||"1"),10),onFocus:e=>e?.target?.select?.(),onChange:e=>p({borderWidth:e??1})})}),l.jsx(Bl,{label:r("border_color"),children:l.jsx(kl,{color:x,setColor:({hex:e})=>p({borderColor:e})})})]}):null,l.jsx(Ll,{className:"margin-top-12",children:r("header_style")}),l.jsx(Bl,{label:r("header_background"),children:l.jsx(kl,{color:C,setColor:({hex:e})=>p({headerBg:e})})}),l.jsx(Bl,{label:r("header_text_color"),children:l.jsx(kl,{color:N,setColor:({hex:e})=>p({headerColor:e})})}),l.jsx(Bl,{layout:"toggle",label:r("striped_rows"),children:l.jsx(wl,{checked:I,onChange:e=>u({stripedRows:e})})}),I?l.jsx(Bl,{label:r("stripe_color"),children:l.jsx(kl,{color:A,setColor:({hex:e})=>p({stripedBg:e})})}):null,l.jsx(Ll,{className:"ee-table-settings-padding-heading",children:r("padding_settings")}),l.jsx(Bl,{children:l.jsx(Sl,{padding:{paddingTop:s(a.data.contentStyles,"paddingTop"),paddingRight:s(a.data.contentStyles,"paddingRight"),paddingLeft:s(a.data.contentStyles,"paddingLeft"),paddingBottom:s(a.data.contentStyles,"paddingBottom")},setPadding:e=>(e=>{const t=B(a.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]??{},...e},c(t)})(e)})})]})},Oi={logo:"logo",brand:"brand",tagline:"tagline",address:"address",unsubscribe:"unsubscribe",social:"social",secondary:"secondary",copyright:"copyright"};function Wi(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>Wi(e,t,n))}:e:e}function Hi(e,t,n=new Set){if(!e||n.has(e.id))return null;if(n.add(e.id),e.footerSlot===t)return e;if(Array.isArray(e.children))for(const o of e.children){const e=Hi(o,t,n);if(e)return e}return null}function Ki(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"image"===e.key&&e.footerBannerSlot)return e;if("image"===e.key&&String(e.src||"").includes("FooterBanner"))return e;if(Array.isArray(e.children))for(const n of e.children){const e=Ki(n,t);if(e)return e}return null}function Vi(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"divider"===e.key&&e.footerBannerDividerSlot)return e;if(Array.isArray(e.children))for(const n of e.children){const e=Vi(n,t);if(e)return e}return null}function Gi(e){return String(e??"").replace(/<[^>]+>/g,"").trim()}function qi(e){const t=/<div[^>]*>([\s\S]*?)<\/div>/i.exec(e||"");return t?t[1].trim():Gi(e)}function Ji(e){return`<div style="text-align:center">${e}</div>`}function Yi(e){const t={unsubLabel:"Unsubscribe",unsubUrl:"#",prefLabel:"Update preferences",prefUrl:"#"};if(!e||"string"!=typeof e)return t;const n=/<a\s+href="([^"]*)"[^>]*>([\s\S]*?)<\/a>[\s\S]*?<a\s+href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/i.exec(e);return n&&(t.unsubUrl=n[1],t.unsubLabel=Gi(n[2]),t.prefUrl=n[3],t.prefLabel=Gi(n[4])),t}function Xi(e){const t={unsubLabel:"Unsubscribe",unsubUrl:"#",prefLabel:"Update preferences",prefUrl:"#"};if(!e)return t;if("menu"===e.key&&Array.isArray(e.list)){const n=e.list[0]||{},o=e.list[1]||{};return{unsubLabel:String(n.label??t.unsubLabel),unsubUrl:String(n.url??t.unsubUrl),prefLabel:String(o.label??t.prefLabel),prefUrl:String(o.url??t.prefUrl)}}return{...t,...Yi(e?.text??"")}}const Zi=[10,11,12,13,14,16];function Qi(){const{currentItem:a,templateData:i,previewMode:r,apiConfig:s}=e.useContext($e),{t:c}=Zo(),{findStyleItem:d,updateItemStyles:u}=Kl(),[p,m]=e.useState(null);e.useEffect(()=>{m(null)},[a?.id]);const g=a.data,h=e=>p===e,b=(e,t)=>h(e)?t:wn(t??"",i),y=(e,t)=>h(e)?t:Sn(t??"",i),f=e.useMemo(()=>{const e={};for(const t of Object.values(Oi))e[t]=Hi(g,t);return e},[g.id,JSON.stringify(g.children)]),_=e=>{u(e)},k=(e,t)=>{const n=f[e];n?.id&&_(Wi(B(g),n.id,t))},x=(e,t)=>{k(e,e=>({...e,hidden:!t}))},v=e=>{const t=f[e];return!!t&&!0!==t.hidden},w=f[Oi.logo],S=f[Oi.brand],j=f[Oi.tagline],C=f[Oi.address],N=f[Oi.unsubscribe],I=f[Oi.social],A=f[Oi.secondary],L=f[Oi.copyright],T=v(Oi.logo),$=v(Oi.brand),R=v(Oi.tagline),M=v(Oi.address),F=v(Oi.unsubscribe),U=v(Oi.social),D=v(Oi.secondary),E=v(Oi.copyright),z=w?.src??"{{LogoUrl}}",O=e.useMemo(()=>{const e="string"==typeof z?z.trim():String(z??""),t=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",n=i&&t?Ft(i,t,{}):null;return null==n||String(n).startsWith("{{")?vn(z,i)||z||"":String(n)},[z,i]),W=w?.alt??"Logo",H=w?.linkURL??"",K=String(w?.styles?.desktop?.width??"30%"),V=parseInt(K.replace("%",""),10)||30,G=w?.contentStyles?.desktop?.paddingTop??w?.contentStyles?.desktop?.paddingLeft??12,q=e.useMemo(()=>Ki(g),[g.id,JSON.stringify(g.children)]),J=!0===g.showFooterBanner,Y=q?.src??"{{FooterBanner}}",X=e.useMemo(()=>{const e="string"==typeof Y?Y.trim():String(Y??""),t=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",n=i&&t?Ft(i,t,{}):null;return null==n||String(n).startsWith("{{")?Y||"":String(n)},[Y,i]),Z=q?.alt??"",Q=q?.linkURL??"",ee=function(e){const t=/<b>([\s\S]*?)<\/b>/i.exec(e||"");return t?t[1].trim():Gi(e)}(S?.text??""),te=qi(j?.text??""),ne=qi(C?.text??""),oe=qi(L?.text??"");const ae=Xi(N),le=A?.list??[],ie=d(g.styles,"color")??"#737373",re=d(g.styles,"linkColor"),se=null!=re&&""!==String(re).trim()?String(re).trim():"",ce=d(g.styles,"backgroundColor")??"#f4f4f5",de=d(g.styles,"contentBackground")??"#ffffff",ue=d(g.styles,"fontSize")??12,pe=d(g.styles,"textAlign")??"center",me=d(g.styles,"paddingTop")??28,ge=d(g.styles,"paddingBottom")??28,he=d(g.styles,"paddingLeft")??24,be=d(g.styles,"paddingRight")??24,ye=e.useMemo(()=>Zi.map(e=>({value:e,label:`${e}px`})),[]),fe=e=>{const t=B(g);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),_(t)},_e=e=>{q?.id&&_(Wi(B(g),q.id,e))},ke=e=>{k(Oi.secondary,t=>({...t,list:e,useNavigationLinks:!1}))},xe=e=>{k(Oi.unsubscribe,t=>{const n={...Xi(t),...e},o=[{label:(a=n).unsubLabel||"Unsubscribe",url:a.unsubUrl||"#",target:"_self"},{label:a.prefLabel||"Update preferences",url:a.prefUrl||"#",target:"_self"}];var a;return"menu"===t.key?{...t,list:o,useNavigationLinks:!1}:function(e,t){return{id:e.id,name:e.name,key:"menu",footerSlot:"unsubscribe",hidden:e.hidden,layoutMode:"nav-only",showLogo:!1,mobileLayout:"stack",linkGapPx:0,linkUnderline:!1,list:t,separator:" · ",useNavigationLinks:!1,contentStyles:e.contentStyles||{desktop:{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,textAlign:"center"},mobile:{}},styles:e.styles?.desktop||e.styles?.mobile?e.styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",linkColor:"#737373",letterSpacing:0,fontWeight:"400",textTransform:"none"},mobile:{}},isPreset:e.isPreset}}(t,o)})},ve=(new Date).getFullYear();return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form ee-footer-native-shell-settings",children:[l.jsx(Ll,{children:c("footer_visible_lines")}),l.jsx(Bl,{layout:"toggle",label:c("show_logo"),children:l.jsx(wl,{checked:T,onChange:e=>x(Oi.logo,e)})}),l.jsx(Bl,{layout:"toggle",label:c("show_footer_banner"),children:l.jsx(wl,{checked:J,onChange:e=>{let t=B(g);t.showFooterBanner=e,e&&!Ki(t)&&(t=function(e,t){const n=B(e),o=function(e){const t=e.children?.find(e=>"content"===e.key);return t||e.children?.[0]}(n);if(!o?.children)return n;const a=!0===e.showFooterBanner,l={id:P(),name:t("image"),key:"image",footerBannerSlot:!0,src:"{{FooterBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}},hidden:!a},i={id:P(),name:t("divider"),key:"divider",footerBannerDividerSlot:!0,hidden:!a,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},r=[...o.children];return r.splice(0,0,l,i),{...n,children:(n.children||[]).map(e=>e.id===o.id?{...e,children:r}:e)}}(t,c));const n=Ki(t);n?.id&&(t=Wi(t,n.id,t=>({...t,hidden:!e})));const o=Vi(t);o?.id&&(t=Wi(t,o.id,t=>({...t,hidden:!e}))),_(t)}})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_brand_name"),children:l.jsx(wl,{checked:$,onChange:e=>x(Oi.brand,e)})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_tagline"),children:l.jsx(wl,{checked:R,onChange:e=>x(Oi.tagline,e)})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_address"),children:l.jsx(wl,{checked:M,onChange:e=>x(Oi.address,e)})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_social_row"),children:l.jsx(wl,{checked:U,onChange:e=>x(Oi.social,e)})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_secondary_links"),children:l.jsx(wl,{checked:D,onChange:e=>x(Oi.secondary,e)})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_unsubscribe"),children:l.jsx(wl,{checked:F,onChange:e=>x(Oi.unsubscribe,e)})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_copyright"),children:l.jsx(wl,{checked:E,onChange:e=>x(Oi.copyright,e)})}),T&&w?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:c("logo_section")}),l.jsx(Bl,{label:c("image_url"),children:l.jsx(t.Input,{className:"width-full",value:h("logoSrc")?z:O,placeholder:c("placeholder_https"),onFocus:()=>m("logoSrc"),onBlur:()=>m(e=>"logoSrc"===e?null:e),onChange:e=>k(Oi.logo,t=>({...t,src:e.target.value}))})}),l.jsx(Bl,{label:c("logo_alt"),children:l.jsx(t.Input,{className:"width-full",value:b("logoAlt",W),placeholder:"Logo",onFocus:()=>m("logoAlt"),onBlur:()=>m(e=>"logoAlt"===e?null:e),onChange:e=>k(Oi.logo,t=>({...t,alt:e.target.value}))})}),l.jsx(Bl,{label:c("logo_link"),children:l.jsx(t.Input,{className:"width-full",value:y("logoLink",H),placeholder:c("link_url_placeholder"),onFocus:()=>m("logoLink"),onBlur:()=>m(e=>"logoLink"===e?null:e),onChange:e=>k(Oi.logo,t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})}),l.jsx(Bl,{label:c("logo_max_width"),children:l.jsx(t.InputNumber,{min:10,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:V,onFocus:e=>e?.target?.select?.(),onChange:e=>k(Oi.logo,t=>({...t,styles:{...t.styles,desktop:{...t.styles?.desktop,width:`${e||30}%`}}}))})}),l.jsx(Bl,{label:c("logo_padding"),children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof G?G:12,onFocus:e=>e?.target?.select?.(),onChange:e=>k(Oi.logo,t=>({...t,contentStyles:{...t.contentStyles,desktop:{...t.contentStyles?.desktop,paddingTop:e??12,paddingBottom:e??12,paddingLeft:e??12,paddingRight:e??12}}}))})})]}):null,J&&q?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:c("footer_banner_section")}),l.jsx(Bl,{label:c("image_url"),children:l.jsx(t.Input,{className:"width-full",value:h("footerBannerSrc")?Y:X,placeholder:c("placeholder_https"),onFocus:()=>m("footerBannerSrc"),onBlur:()=>m(e=>"footerBannerSrc"===e?null:e),onChange:e=>_e(t=>({...t,src:e.target.value}))})}),l.jsx(Bl,{label:c("image_alt"),children:l.jsx(t.Input,{className:"width-full",value:b("footerBannerAlt",Z),placeholder:c("image_alt_placeholder"),onFocus:()=>m("footerBannerAlt"),onBlur:()=>m(e=>"footerBannerAlt"===e?null:e),onChange:e=>_e(t=>({...t,alt:e.target.value}))})}),l.jsx(Bl,{label:c("link_url"),children:l.jsx(t.Input,{className:"width-full",value:y("footerBannerLink",Q),placeholder:c("link_url_placeholder"),onFocus:()=>m("footerBannerLink"),onBlur:()=>m(e=>"footerBannerLink"===e?null:e),onChange:e=>_e(t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})})]}):null,l.jsx(Ll,{className:"margin-top-12",children:c("footer_content_heading")}),$&&S?l.jsx(Bl,{label:c("footer_label_brand"),children:l.jsx(t.Input,{className:"width-full",value:b("brandName",ee),placeholder:c("footer_brand_name_placeholder"),onFocus:()=>m("brandName"),onBlur:()=>m(e=>"brandName"===e?null:e),onChange:e=>k(Oi.brand,t=>{return{...t,text:(n=e.target.value,`<div style="text-align:center"><b>${n}</b></div>`)};var n})})}):null,R&&j?l.jsx(Bl,{label:c("brand_tagline"),children:l.jsx(t.Input,{className:"width-full",value:b("tagline",te),placeholder:c("footer_brand_tagline_placeholder"),onFocus:()=>m("tagline"),onBlur:()=>m(e=>"tagline"===e?null:e),onChange:e=>k(Oi.tagline,t=>({...t,text:Ji(e.target.value)}))})}):null,M&&C?l.jsx(Bl,{label:c("address"),children:l.jsx(t.Input.TextArea,{className:"width-full",value:b("address",ne),rows:2,placeholder:c("footer_address_placeholder"),onFocus:()=>m("address"),onBlur:()=>m(e=>"address"===e?null:e),onChange:e=>k(Oi.address,t=>({...t,text:Ji(e.target.value)}))})}):null,U&&I?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:c("footer_social_platforms_heading")}),l.jsx(Mi,{blockNode:I,onUpdateBlock:e=>k(Oi.social,()=>e),previewMode:r,findStyleItem:d,apiConfig:s,templateData:i,embedded:!0},I.id)]}):null,D&&A?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:c("footer_secondary_links_heading")}),l.jsxs("div",{className:"margin-top-12 ee-settings-stack-flat",children:[le.map((e,n)=>l.jsxs("div",{className:"margin-bottom-12",children:[l.jsx(Bl,{label:`${c("footer_secondary_link_text")} ${n+1}`,children:l.jsx(t.Input,{className:"width-full",value:e.label||"",onChange:e=>{const t=[...le];t[n]={...t[n],label:e.target.value},ke(t)}})}),l.jsx(Bl,{label:c("footer_secondary_link_url"),children:l.jsx(t.Input,{className:"width-full",value:e.url||"",onChange:e=>{const t=[...le];t[n]={...t[n],url:e.target.value},ke(t)}})})]},`${e.label}-${n}`)),l.jsxs("button",{type:"button",className:"menu-add-new-item",onClick:()=>ke([...le,{label:c("footer_new_link_label"),url:"#",target:"_self"}]),children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",c("footer_add_link")]})]})]}):null,F&&N?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:c("footer_toggle_unsubscribe")}),l.jsx(Bl,{label:c("footer_unsubscribe_link_label"),children:l.jsx(t.Input,{className:"width-full",value:b("unsubLabel",ae.unsubLabel),onFocus:()=>m("unsubLabel"),onBlur:()=>m(e=>"unsubLabel"===e?null:e),onChange:e=>xe({unsubLabel:e.target.value})})}),l.jsx(Bl,{label:c("unsubscribe_url"),children:l.jsx(t.Input,{className:"width-full",value:y("unsubUrl",ae.unsubUrl),placeholder:c("footer_unsubscribe_url_placeholder"),onFocus:()=>m("unsubUrl"),onBlur:()=>m(e=>"unsubUrl"===e?null:e),onChange:e=>xe({unsubUrl:e.target.value})})}),l.jsx(Bl,{label:c("footer_preferences_link_label"),children:l.jsx(t.Input,{className:"width-full",value:b("prefLabel",ae.prefLabel),onFocus:()=>m("prefLabel"),onBlur:()=>m(e=>"prefLabel"===e?null:e),onChange:e=>xe({prefLabel:e.target.value})})}),l.jsx(Bl,{label:c("footer_preferences_url"),children:l.jsx(t.Input,{className:"width-full",value:y("prefUrl",ae.prefUrl),onFocus:()=>m("prefUrl"),onBlur:()=>m(e=>"prefUrl"===e?null:e),onChange:e=>xe({prefUrl:e.target.value})})})]}):null,E&&L?l.jsx(Bl,{label:c("copyright_text"),children:l.jsx(t.Input,{className:"width-full",value:b("copyright",oe),placeholder:c("footer_copyright_placeholder",{year:ve}),onFocus:()=>m("copyright"),onBlur:()=>m(e=>"copyright"===e?null:e),onChange:e=>k(Oi.copyright,t=>{return{...t,text:(n=e.target.value,`<div style="text-align:center;font-size:11px;opacity:0.9">${n}</div>`)};var n})})}):null,l.jsx(Ll,{className:"margin-top-12",children:c("footer_style_heading")}),l.jsx(Bl,{label:c("footer_text_color"),children:l.jsx(kl,{color:ie,setColor:({hex:e})=>fe({color:e})})}),l.jsx(Bl,{label:c("footer_link_color"),children:l.jsx(kl,{color:se||ie,setColor:({hex:e})=>fe({linkColor:e})})}),l.jsx(Bl,{label:c("footer_background_content"),children:l.jsx(kl,{color:de,setColor:({hex:e})=>fe({contentBackground:e||"#ffffff"})})}),l.jsx(Bl,{label:c("footer_column_background"),children:l.jsx(kl,{color:ce,setColor:({hex:e})=>fe({backgroundColor:e||"transparent"})})}),l.jsx(Bl,{label:c("font_size"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:"number"==typeof ue?ue:parseInt(String(ue||"12"),10),onChange:e=>fe({fontSize:e}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:ye})}),l.jsx(Bl,{label:c("footer_align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:pe,onChange:e=>fe({textAlign:e}),"aria-label":c("footer_align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft})},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter})},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight})}]})}),l.jsx(Bl,{label:c("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:me,paddingBottom:ge,paddingLeft:he,paddingRight:be},setPadding:fe})})]})}const er=[10,11,12,13,14,16],tr="__ee_footer_social_custom__",nr=[{value:"instagram",image:x("instagram"),labelKey:"footer_social_instagram",title:"Instagram"},{value:"facebook",image:x("facebook"),labelKey:"footer_social_facebook",title:"Facebook"},{value:"twitter",image:x("x"),labelKey:"footer_social_twitter",title:"Twitter"},{value:"linkedin",image:x("linkedin"),labelKey:"footer_social_linkedin",title:"LinkedIn"},{value:"youtube",image:x("youtube"),labelKey:"footer_social_youtube",title:"YouTube"},{value:"tiktok",image:x("tiktok"),labelKey:"footer_social_tiktok",title:"TikTok"}];function or(e){const t=String(e?.image||"").toLowerCase(),n=nr.find(e=>String(e.image).toLowerCase()===t);return n?n.value:t.includes("brand-instagram")||t.includes("tc-instagram")?"instagram":t.includes("brand-facebook")||t.includes("tc-facebook")?"facebook":t.includes("brand-x")||t.includes("tc-x")?"twitter":t.includes("brand-linkedin")||t.includes("tc-linkedin")?"linkedin":t.includes("brand-youtube")||t.includes("tc-youtube")?"youtube":t.includes("brand-tiktok")||t.includes("tc-tiktok")?"tiktok":"custom"}const ar={facebook:"social_link_placeholder_facebook",linkedin:"social_link_placeholder_linkedin",instagram:"social_link_placeholder_instagram",tiktok:"social_link_placeholder_tiktok",youtube:"social_link_placeholder_youtube"};function lr(e,t){if(g(e))return t("social_link_placeholder_x");const n=String(e?.title||"").trim().toLowerCase(),o=ar[n];return t(o||"social_link_placeholder_generic")}function ir({preset:e,t:t}){const n={image:e.image,title:e.title},{src:o,style:a}=L(n,"default",22);return l.jsxs("span",{className:"ee-social-add-menu-item",children:[o?l.jsx("img",{src:o,alt:"",className:"ee-social-add-menu-icon",style:a,draggable:!1}):null,l.jsx("span",{children:t(e.labelKey)})]})}const rr=()=>{const{currentItem:a,apiConfig:i,templateData:r}=e.useContext($e),{t:s}=Zo(),{findStyleItem:c,updateItemStyles:d}=Kl(),u=e.useRef(null),p=e.useRef(null),h=e.useRef(null),[b,y]=e.useState(null),[f,_]=e.useState(!1),[k,x]=e.useState(null),[v,w]=e.useState(!1),[S,j]=e.useState(null),[C,N]=e.useState(!1),[I,A]=e.useState(null),[T,R]=e.useState({}),[M,F]=e.useState(null);e.useEffect(()=>{F(null)},[a?.id]);const{uploadImageFile:U,isConfigured:D}=ti({imageUploadEndpoint:i?.imageUploadEndpoint,headers:i?.headers||{},companyId:i?.companyId,imageUploadQueryParams:i?.imageUploadQueryParams,imageUploadCompanyField:i?.imageUploadCompanyField}),E=()=>document.querySelector(".right-settings")||document.body,O=e.useMemo(()=>er.map(e=>({value:e,label:`${e}px`})),[]),W=e=>{const t=B(a.data);Object.assign(t,e),"footer"===t.containerType&&Object.prototype.hasOwnProperty.call(e,"footerSocialList")&&(t.footerUseCompanySocial=!1),d(t)},H=e=>{const t=B(a.data);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),d(t)};e.useEffect(()=>{const e=a?.data;if(!e||"footer"!==e.containerType||!e.footerUnifiedLayout)return;if(!r)return;const t=function(e,t){if(!t||!e)return{};const n={},o=t.companyContext||{},a=t.brandContext||{};if(xn(e.brandName)&&null!=o.name&&""!==String(o.name).trim()&&(n.brandName=String(o.name).trim()),xn(e.address)&&null!=o.address&&""!==String(o.address).trim()&&(n.address=String(o.address).trim()),xn(e.brandTagline)&&null!=a.tagline&&""!==String(a.tagline).trim()&&(n.brandTagline=String(a.tagline).trim()),xn(e.footerLogoSrc)&&null!=a.logo_url&&""!==String(a.logo_url).trim()&&(n.footerLogoSrc=String(a.logo_url).trim()),xn(e.footerLogoLink)&&null!=o.website&&""!==String(o.website).trim()&&(n.footerLogoLink=String(o.website).trim()),xn(e.footerLogoAlt)&&null!=o.name&&""!==String(o.name).trim()&&(n.footerLogoAlt=String(o.name).trim()),xn(e.copyrightText)&&null!=o.name&&""!==String(o.name).trim()){const e=(new Date).getFullYear();n.copyrightText=`© ${e} ${String(o.name).trim()}`}return n}(e,r);if(0===Object.keys(t).length)return;const n=B(e);Object.assign(n,t),n.footerUnifiedLayout=!0,d(n)},[a?.data,r,d]);const K=Boolean(a.data.showBrand??!0),V=Boolean(a.data.showTagline??!0),G=Boolean(a.data.footerShowLogo??!1),q=a.data.footerLogoSrc??"",J=a.data.footerLogoAlt??"Logo",Y=a.data.footerLogoLink??"",X="number"==typeof a.data.footerLogoMaxWidthPercent?a.data.footerLogoMaxWidthPercent:parseInt(String(a.data.footerLogoMaxWidthPercent??"30"),10)||30,Z="number"==typeof a.data.footerLogoPaddingPx?a.data.footerLogoPaddingPx:parseInt(String(a.data.footerLogoPaddingPx??"24"),10)||24,Q=e.useMemo(()=>vn(q,r),[q,r]),ee=e=>M===e,te=(e,t)=>ee(e)?t:wn(t??"",r),ne=Boolean(a.data.showAddress??!0),oe=Boolean(a.data.showUnsubscribe??!0),ae=Boolean(a.data.showSocial??!1),le=Boolean(a.data.showSecondaryLinks??!1),ie=Boolean(a.data.showCopyright??!0),re=a.data.footerSelectedSegment??null,se=a.data.brandName??"",ce=a.data.brandTagline??"",de=a.data.address??"",ue=Cn(a.data),pe=null!=a.data.unsubscribeLinkLabel?String(a.data.unsubscribeLinkLabel):ue.unsubscribeLinkLabel,me=null!=a.data.preferencesLinkLabel?String(a.data.preferencesLinkLabel):ue.preferencesLinkLabel,ge=a.data.unsubscribeUrl??"",he=a.data.preferencesUrl??"",be=a.data.copyrightText??"",ye=In(a.data.secondaryLinks),fe=Nn(a.data.footerSocialList);e.useEffect(()=>{null!=k&&k>=fe.length&&x(fe.length?fe.length-1:null)},[k,fe.length]),e.useEffect(()=>{re&&requestAnimationFrame(()=>{document.getElementById(`ee-footer-settings-segment-${re}`)?.scrollIntoView?.({block:"nearest",behavior:"smooth"})})},[re,a?.id]);const _e=a.data.styles?.desktop??{},ke=c(a.data.styles,"color")??"#737373",xe=c(a.data.styles,"linkColor"),ve=null!=xe&&""!==String(xe).trim()?String(xe).trim():"",we=c(a.data.styles,"backgroundColor")??"transparent",Se=kn(c(a.data.styles,"contentBackground")??""),je=c(a.data.styles,"fontSize")??12,Ce=c(a.data.styles,"textAlign")??"center",Ne=c(a.data.styles,"paddingTop")??28,Ie=c(a.data.styles,"paddingBottom")??28,Ae=c(a.data.styles,"paddingLeft")??24,Le=c(a.data.styles,"paddingRight")??24,Te=Boolean(a.data.showDivider??!1),Be=a.data.dividerColor??"#374151",Re=Boolean(a.data.showBorderTop??!1),Pe=a.data.borderTopColor??_e.borderTopColor??"#e5e7eb",Me="number"==typeof a.data.borderTopWidth?a.data.borderTopWidth:parseInt(String(a.data.borderTopWidth??"1"),10)||1,Fe=(new Date).getFullYear(),Ue=e.useMemo(()=>nr.map(e=>({value:e.value,label:s(e.labelKey)})),[s]),De=e.useMemo(()=>[...Ue,{value:tr,label:s("footer_social_custom_icon")}],[Ue,s]),Ee=e.useMemo(()=>[{label:s("same_tab"),value:"_self"},{label:s("new_tab"),value:"_blank"}],[s]),ze=e=>{const t=e.map(e=>({...e,id:e.id||P()}));W({secondaryLinks:In(t)})},Oe=e=>{const t=e.map(e=>({...e,id:e.id||P()}));W({footerSocialList:Nn(t)})},We=(e,t)=>{Oe(fe.map((n,o)=>o===e?{...n,...t,id:n.id||P()}:n))},He=(e,t,n)=>{const o=((e,t,n)=>{const o=String(e??"").trim(),a=`Footer link ${t+1}${n?` (${n})`:""} -> URL`,l=m(o,!1,{allowMailtoTel:!0});return l?"empty"===l?`${a} is empty. Add a destination like 'https://example.com'.`:"blocked_scheme"===l?`${a} ('${o}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===l?`${a} ('${o}') repeats the protocol. Keep one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===l?`${a} ('${o}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===l?`${a} ('${o}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`${a} ('${o}') is invalid. Fix it to a valid URL like 'https://example.com'.`:""})(e,t,n);R(e=>{if(!o&&!e[t])return e;const n={...e};return o?n[t]=o:delete n[t],n})},Ke=e.useCallback($(e=>{e.preventDefault();const t=p.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const a=S,l=B(fe);null==a||a===o||l.length<2||([l[o],l[a]]=[l[a],l[o]],j(o),Oe(l),x(e=>e===a?o:e===o?a:e))},50),[S,fe]),Ve=e.useCallback($(e=>{e.preventDefault();const t=h.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const a=I,l=B(ye);null==a||a===o||l.length<2||([l[o],l[a]]=[l[a],l[o]],A(o),ze(l))},50),[I,ye]),Ge=new Set(fe.map(e=>or(e)).filter(e=>"custom"!==e)),qe=[...nr.filter(e=>!Ge.has(e.value)).map(e=>({key:`footer-add-${e.value}`,label:l.jsx(ir,{preset:e,t:s}),onClick:()=>{const t=fe.length;Oe([...fe,{id:P(),image:e.image,title:e.title,linkURL:"",socialPlatformKey:e.value}]),x(t)}})),{key:"__footer_add_custom__",label:l.jsxs("span",{className:"ee-social-add-menu-item ee-social-add-menu-item--custom",children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"}),l.jsx("span",{children:s("footer_social_custom_icon")})]}),onClick:()=>{const e=fe.length;Oe([...fe,{id:P(),image:"",title:"",linkURL:""}]),x(e)}}],Je=e=>Go("ee-footer-settings-segment",re===e&&"ee-footer-settings-segment--focused");return a?.data?.footerUnifiedLayout?l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx(Ll,{children:s("footer_visible_lines")}),l.jsx(Bl,{layout:"toggle",label:s("show_logo"),children:l.jsx(wl,{checked:G,onChange:e=>W({footerShowLogo:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_brand_name"),children:l.jsx(wl,{checked:K,onChange:e=>W({showBrand:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_tagline"),children:l.jsx(wl,{checked:V,onChange:e=>W({showTagline:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_address"),children:l.jsx(wl,{checked:ne,onChange:e=>W({showAddress:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_unsubscribe"),children:l.jsx(wl,{checked:oe,onChange:e=>W({showUnsubscribe:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_social_row"),children:l.jsx(wl,{checked:ae,onChange:e=>W({showSocial:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_secondary_links"),children:l.jsx(wl,{checked:le,onChange:e=>W({showSecondaryLinks:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_copyright"),children:l.jsx(wl,{checked:ie,onChange:e=>W({showCopyright:e})})}),l.jsx("div",{id:"ee-footer-settings-segment-logo",className:Je("logo"),children:G?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:s("logo_section")}),l.jsx(Bl,{label:s("image_url"),children:l.jsx(t.Input,{className:"width-full",value:ee("logoSrc")?q:Q,placeholder:s("placeholder_https"),onFocus:()=>F("logoSrc"),onBlur:()=>F(e=>"logoSrc"===e?null:e),onChange:e=>W({footerLogoSrc:e.target.value})})}),l.jsx(Bl,{label:s("logo_alt"),children:l.jsx(t.Input,{className:"width-full",value:te("logoAlt",J),placeholder:"Logo",onFocus:()=>F("logoAlt"),onBlur:()=>F(e=>"logoAlt"===e?null:e),onChange:e=>W({footerLogoAlt:e.target.value})})}),l.jsx(Bl,{label:s("logo_link"),children:l.jsx(t.Input,{className:"width-full",value:(Ye="logoLink",Xe=Y,ee(Ye)?Xe:Sn(Xe??"",r)),placeholder:s("link_url_placeholder"),onFocus:()=>F("logoLink"),onBlur:()=>F(e=>"logoLink"===e?null:e),onChange:e=>W({footerLogoLink:e.target.value})})}),l.jsx(Bl,{label:s("logo_max_width"),children:l.jsx(t.InputNumber,{min:10,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:X,onFocus:e=>e?.target?.select?.(),onChange:e=>W({footerLogoMaxWidthPercent:e??30})})}),l.jsx(Bl,{label:s("logo_padding"),children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:Z,onFocus:e=>e?.target?.select?.(),onChange:e=>W({footerLogoPaddingPx:e??24})})})]}):null}),l.jsx(Ll,{className:"margin-top-12",children:s("footer_content_heading")}),K?l.jsx("div",{id:"ee-footer-settings-segment-brand",className:Je("brand"),children:l.jsx(Bl,{label:s("footer_label_brand"),children:l.jsx(t.Input,{className:"width-full",value:te("brandName",se),placeholder:s("footer_brand_name_placeholder"),onFocus:()=>F("brandName"),onBlur:()=>F(e=>"brandName"===e?null:e),onChange:e=>W({brandName:e.target.value})})})}):null,V?l.jsx("div",{id:"ee-footer-settings-segment-tagline",className:Je("tagline"),children:l.jsx(Bl,{label:s("brand_tagline"),children:l.jsx(t.Input,{className:"width-full",value:te("tagline",ce),placeholder:s("footer_brand_tagline_placeholder"),onFocus:()=>F("tagline"),onBlur:()=>F(e=>"tagline"===e?null:e),onChange:e=>W({brandTagline:e.target.value})})})}):null,ne?l.jsx("div",{id:"ee-footer-settings-segment-address",className:Je("address"),children:l.jsx(Bl,{label:s("address"),children:l.jsx(t.Input.TextArea,{className:"width-full",value:te("address",de),rows:2,placeholder:s("footer_address_placeholder"),onFocus:()=>F("address"),onBlur:()=>F(e=>"address"===e?null:e),onChange:e=>W({address:e.target.value})})})}):null,oe?l.jsxs("div",{id:"ee-footer-settings-segment-unsubscribe",className:Je("unsubscribe"),children:[l.jsx(Bl,{label:s("footer_unsubscribe_link_label"),children:l.jsx(t.Input,{className:"width-full",value:pe,placeholder:s("footer_default_unsubscribe_text"),onChange:e=>W({unsubscribeLinkLabel:e.target.value})})}),l.jsx(Bl,{label:s("unsubscribe_url"),children:l.jsx(t.Input,{className:"width-full",value:ge,placeholder:s("footer_unsubscribe_url_placeholder"),onChange:e=>W({unsubscribeUrl:e.target.value})})}),l.jsx(Bl,{label:s("footer_preferences_link_label"),children:l.jsx(t.Input,{className:"width-full",value:me,placeholder:s("footer_preferences_default_label"),onChange:e=>W({preferencesLinkLabel:e.target.value})})}),l.jsx(Bl,{label:s("footer_preferences_url"),children:l.jsx(t.Input,{className:"width-full",value:he,placeholder:"#",onChange:e=>W({preferencesUrl:e.target.value})})})]}):null,ie?l.jsx("div",{id:"ee-footer-settings-segment-copyright",className:Je("copyright"),children:l.jsx(Bl,{label:s("copyright_text"),children:l.jsx(t.Input,{className:"width-full",value:te("copyright",be),placeholder:s("footer_copyright_placeholder",{year:Fe}),onFocus:()=>F("copyright"),onBlur:()=>F(e=>"copyright"===e?null:e),onChange:e=>W({copyrightText:e.target.value})})})}):null,le?l.jsxs("div",{id:"ee-footer-settings-segment-secondary",className:Je("secondary"),children:[l.jsx(Ll,{className:"margin-top-12",children:s("footer_secondary_links_heading")}),l.jsx("div",{ref:h,onDragOver:Ve,className:"margin-top-12",children:ye.map((e,a)=>l.jsx("div",{"data-index":a,draggable:!0,onDragStart:()=>{N(!0),A(a)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),N(!1),A(null)},className:Go("social-link-item","cursor-grab",C&&"social-link-item-drag_start",I===a?"social-link-item-current":"border-transparent"),children:l.jsxs("div",{className:"social-link-item-content ee-menu-item-content",children:[l.jsxs("div",{className:"ee-menu-item-header flex items-center justify-between margin-bottom-8",children:[l.jsxs("div",{className:"flex items-center ee-menu-item-drag-row",children:[l.jsx("span",{className:"social-link-item-drag-handle ee-menu-item-drag-handle","aria-hidden":!0,children:l.jsx(n.FontAwesomeIcon,{icon:o.faGripVertical,className:"social-link-item-drag-handle-icon"})}),l.jsxs("span",{className:"font-semibold",children:[s("footer_secondary_link_text")," ",a+1]})]}),l.jsx("div",{className:"social-link-item-icon social-link-item-icon-slate ee-menu-item-delete",role:"button",tabIndex:0,onClick:()=>{const e=ye.filter((e,t)=>t!==a);ze(e.length?e:jn()),R(e=>{const t={...e};return delete t[a],t})},onKeyDown:e=>{if("Enter"===e.key||" "===e.key){e.preventDefault();const t=ye.filter((e,t)=>t!==a);ze(t.length?t:jn())}},children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash,className:"social-link-item-icon-svg social-link-item-icon-svg-deep"})})]}),l.jsxs("div",{className:"ee-menu-item-fields ee-settings-stack-flat",children:[l.jsx(Bl,{label:s("footer_secondary_link_text"),children:l.jsx(t.Input,{className:"width-full ee-menu-item-input",value:e.label||"",onChange:e=>ze(ye.map((t,n)=>n===a?{...t,label:e.target.value}:t)),placeholder:s("footer_secondary_link_text")})}),l.jsxs(Bl,{label:s("footer_secondary_link_url"),children:[l.jsx(t.Input,{className:"width-full ee-menu-item-input",value:e.url||"",status:T[a]?"error":"",onChange:t=>{const n=t.target.value;ze(ye.map((e,t)=>t===a?{...e,url:n}:e)),T[a]&&He(n,a,e.label)},onBlur:t=>He(t.target.value,a,e.label),placeholder:s("link_url_placeholder")}),T[a]?l.jsx("div",{className:"ee-field-error",role:"alert",children:T[a]}):null]}),l.jsx(Bl,{label:s("target"),children:l.jsx(t.Select,{className:"width-full ee-menu-item-input",value:e.target||"_self",onChange:e=>ze(ye.map((t,n)=>n===a?{...t,target:e}:t)),getPopupContainer:E,options:Ee})})]})]})},e.id??`sec-${a}`))}),l.jsxs("button",{type:"button",className:"menu-add-new-item margin-top-12",onClick:()=>ze([...ye,{id:P(),label:s("footer_new_link_label"),url:"#",target:"_self"}]),children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",s("footer_add_link")]})]}):null,ae?l.jsxs("div",{id:"ee-footer-settings-segment-social",className:Je("social"),children:[l.jsx(Ll,{className:"margin-top-12",children:s("footer_social_platforms_heading")}),l.jsx("input",{ref:u,type:"file",accept:Ql,className:"ee-image-upload-input-hidden",onChange:async e=>{const n=e.target.files?.[0];if(e.target.value="",null==n||null==b)return;const o=ei(n);if("type"!==o)if("size"!==o){if(!D)return t.message.error(s("image_upload_not_configured")),void y(null);_(!0);try{const e=await U(n);if(e){const n=[...fe],o=n[b];o&&(n[b]={...o,id:o.id||P(),image:cn(e)},Oe(n),t.message.success(s("image_uploaded")))}else t.message.error(s("image_upload_failed"))}catch(e){t.message.error(s("image_upload_error"))}finally{_(!1),y(null)}}else t.message.error(s("image_file_too_large"));else t.message.error(s("image_upload_invalid_type"))}}),l.jsx("div",{ref:p,onDragOver:Ke,className:"ee-social-link-icons-list margin-top-12",children:fe.map((e,a)=>{const i=function(e){const t=String(e?.image||"").trim(),n=nr.find(e=>String(e.image).trim()===t);if(n)return n;const o=or(e);return o&&"custom"!==o?nr.find(e=>e.value===o)??null:null}(e),r=g(e),c=!i,d=c&&!String(e.title||"").trim()?s("footer_social_custom_icon"):r?s("social_platform_x"):String(e.title||"").trim()?String(e.title||"").trim():s(i?i.labelKey:"footer_social_custom_icon"),p=c&&!String(e.title||"").trim()?s("footer_social_custom_icon"):r?s("social_platform_x_alt"):String(e.title||"").trim()||s(i?i.labelKey:"footer_social_custom_icon"),m=L(e,"default",22),h=L(e,"default",28),_=i?i.value:tr,C=k===a;return l.jsx("div",{"data-index":a,draggable:!0,onDragStart:()=>{w(!0),j(a)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),w(!1),j(null)},className:Go("social-link-item","cursor-grab",v&&"social-link-item-drag_start",S===a?"social-link-item-current":"border-transparent"),children:l.jsxs("div",{className:Go("social-link-item-content","ee-menu-item-content","ee-social-link-row-shell"),children:[l.jsxs("div",{className:"ee-social-link-row-header",children:[l.jsx("span",{className:"social-link-item-drag-handle","aria-hidden":!0,children:l.jsx(n.FontAwesomeIcon,{icon:o.faGripVertical,className:"social-link-item-drag-handle-icon"})}),m.src?l.jsx("img",{src:m.src,alt:p,className:"social-link-item-img",style:m.style,draggable:!1}):l.jsx("div",{className:"social-link-item-img ee-social-row-icon-placeholder","aria-hidden":!0}),l.jsx("div",{className:"ee-social-link-row-header-main",children:l.jsxs("div",{className:"social-link-platform-title-wrap ee-social-link-row-title-wrap",children:[l.jsx("div",{className:"font-semibold ee-social-link-row-primary-title",children:d}),r?l.jsx("div",{className:"social-link-platform-former-name",children:s("social_platform_formerly_twitter")}):null]})}),l.jsxs("div",{className:"ee-social-link-row-tools",children:[l.jsx("button",{type:"button",className:"ee-social-link-row-icon-btn","aria-expanded":C,"aria-label":s(C?"collapse":"expand"),onClick:e=>{e.stopPropagation(),(e=>{x(t=>t===e?null:e)})(a)},children:l.jsx(n.FontAwesomeIcon,{icon:C?o.faChevronUp:o.faChevronDown})}),l.jsx("button",{type:"button",className:"ee-social-link-row-icon-btn ee-social-link-row-icon-btn-danger","aria-label":s("delete"),onClick:e=>{e.stopPropagation();const t=fe.filter((e,t)=>t!==a);Oe(t.length?t:z([],{})),x(e=>e===a?null:null!=e&&e>a?e-1:e)},children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash,className:"social-link-item-icon-svg"})})]})]}),C?l.jsxs("div",{className:"ee-social-link-row-detail",children:[l.jsx(Bl,{label:s("footer_platform_label"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:_,options:De,getPopupContainer:E,onChange:e=>{e!==tr?((e,t)=>{const n=nr.find(e=>e.value===t),o=fe[e];if(!o)return;const a=[...fe];n&&(a[e]={...o,id:o.id||P(),image:n.image,title:n.title,socialPlatformKey:n.value}),Oe(a)})(a,e):We(a,{title:"",image:"",socialPlatformKey:void 0})}})}),l.jsx(Bl,{label:s("social_icon_label_field"),children:l.jsx(t.Input,{className:"width-full",value:e.title||"",placeholder:d,onChange:e=>We(a,{title:e.target.value})})}),l.jsx(Bl,{label:s("footer_social_profile_url"),children:l.jsx(t.Input,{className:"width-full",placeholder:lr(e,s),value:e.linkURL||"",onChange:e=>We(a,{linkURL:e.target.value})})}),l.jsx(Bl,{label:s("social_custom_icon"),children:l.jsxs("div",{className:"ee-social-custom-icon-row",children:[l.jsx("div",{className:"ee-social-custom-icon-preview",children:h.src?l.jsx("img",{src:h.src,alt:"",style:h.style,draggable:!1}):l.jsx("span",{className:"ee-social-custom-icon-preview-empty","aria-hidden":!0})}),l.jsx("button",{type:"button",className:"menu-add-new-item ee-social-custom-upload-btn ee-footer-social-upload-btn",disabled:!D||f&&b===a,onClick:()=>{y(a),u.current?.click()},children:s(f&&b===a?"uploading":"footer_upload_icon")})]})})]}):null]})},e.id??`soc-${a}`)})}),l.jsx(t.Dropdown,{overlayClassName:"ee-social-add-platform-dropdown",menu:{items:qe},trigger:["click"],getPopupContainer:E,children:l.jsxs("button",{type:"button",className:"menu-add-new-item margin-top-12",children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",s("footer_add_platform")]})})]}):null,l.jsx(Ll,{className:"margin-top-12",children:s("footer_style_heading")}),l.jsx(Bl,{label:s("footer_text_color"),children:l.jsx(kl,{color:ke,setColor:({hex:e})=>H({color:e})})}),l.jsx(Bl,{label:s("footer_link_color"),children:l.jsx(kl,{color:ve||ke,setColor:({hex:e})=>H({linkColor:e})})}),l.jsx(Bl,{label:s("footer_background_content"),children:l.jsx(kl,{color:Se,setColor:({hex:e})=>H({contentBackground:e||"#ffffff"})})}),l.jsx(Bl,{label:s("footer_column_background"),children:l.jsx(kl,{color:we,setColor:({hex:e})=>H({backgroundColor:e||"transparent"})})}),l.jsx(Bl,{label:s("font_size"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:"number"==typeof je?je:parseInt(String(je||"12"),10),style:{width:"100%"},onChange:e=>H({fontSize:e}),getPopupContainer:E,options:O})}),l.jsx(Bl,{label:s("footer_align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:Ce,onChange:e=>H({textAlign:e}),"aria-label":s("footer_align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft})},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter})},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight})}]})}),l.jsx(Ll,{className:"margin-top-12",children:s("footer_border_heading")}),l.jsxs("div",{id:"ee-footer-settings-segment-divider",className:Je("divider"),children:[l.jsx(Bl,{layout:"toggle",label:s("footer_divider_above"),children:l.jsx(wl,{checked:Te,onChange:e=>W({showDivider:e})})}),Te?l.jsx(Bl,{label:s("divider_color"),children:l.jsx(kl,{color:Be,setColor:({hex:e})=>W({dividerColor:e})})}):null]}),l.jsx(Bl,{layout:"toggle",label:s("footer_border_top"),children:l.jsx(wl,{checked:Re,onChange:e=>W({showBorderTop:e})})}),Re?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:s("footer_border_top_color"),children:l.jsx(kl,{color:Pe,setColor:({hex:e})=>W({borderTopColor:e})})}),l.jsx(Bl,{label:s("border_width"),children:l.jsx(t.InputNumber,{min:1,max:8,className:"input-width ee-settings-input-affix",addonAfter:"px",value:Me,onFocus:e=>e?.target?.select?.(),onChange:e=>W({borderTopWidth:e??1})})})]}):null,l.jsx(Bl,{label:s("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:Ne,paddingBottom:Ie,paddingLeft:Ae,paddingRight:Le},setPadding:e=>H({...e})})})]}):l.jsx(Qi,{});var Ye,Xe};function sr(e,t,n=new Set){if(!e||n.has(e.id))return null;if(n.add(e.id),e.key===t)return e;if(Array.isArray(e.children))for(const o of e.children){const e=sr(o,t,n);if(e)return e}return null}function cr(e,t,n=new Set){if(!e||n.has(e.id))return null;if(n.add(e.id),"image"===e.key&&String(e.src||"").includes(t))return e;if(Array.isArray(e.children))for(const o of e.children){const e=cr(o,t,n);if(e)return e}return null}function dr(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"image"===e.key&&e.headerBannerSlot)return e;if("image"===e.key&&String(e.src||"").includes("HeroBanner"))return e;if(Array.isArray(e.children))for(const n of e.children){const e=dr(n,t);if(e)return e}return null}function ur(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"divider"===e.key&&e.headerBannerDividerSlot)return e;if(Array.isArray(e.children))for(const n of e.children){const e=ur(n,t);if(e)return e}return null}function pr(e){const t=cr(e,"LogoUrl");if(t)return t;let n=null;return function e(t){if(t&&!n)if("image"!==t.key){if(Array.isArray(t.children))for(const n of t.children)e(n)}else n=t}(e),n}function mr(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>mr(e,t,n))}:e:e}function gr(e,t,n,o){const a=t?B(t):{id:P(),name:"Image",key:"image",src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"left"},mobile:{}},styles:{desktop:{width:"50%"},mobile:{}}},l=n?B(n):{id:P(),name:"Menu",key:"menu",useNavigationLinks:!0,list:O.map(e=>({...e})),separator:" | ",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0},i={paddingTop:20,paddingBottom:16},r=(e,t,n,o)=>({id:P(),name:"Content",key:"content",width:t||"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:e.map(e=>"image"===e.key?{...e,id:P(),contentStyles:{...e.contentStyles,desktop:{...e.contentStyles?.desktop,textAlign:n||"left",...o||{}}}}:"menu"===e.key?{...e,id:P(),contentStyles:{...e.contentStyles,desktop:{...e.contentStyles?.desktop,textAlign:n||"center",...o||{}}}}:{...e,id:P()})});let s;switch(e){case"logo_left_nav_right":default:s=[r([a],"50%","left"),r([l],"50%","right",i)];break;case"logo_right_nav_left":s=[r([l],"50%","left",i),r([a],"50%","right")];break;case"logo_center_nav_below":s=[r([a,l],"100%","center")];break;case"logo_only":s=[r([a],"100%","center")];break;case"nav_only":s=[r([l],"100%","center")]}return(e=>{if(!o||!o.banner&&!o.divider)return e;const t=[o.banner,o.divider].filter(Boolean).map(e=>B(e));return[...e,r(t,"100%","center")]})(s)}const hr=()=>{const{blockMap:n,rootOrder:o,setBlocks:a,currentItem:i,setCurrentItem:r,templateData:s}=e.useContext($e),{t:c}=Zo(),{findStyleItem:d}=Kl(),u=i.data,p=e=>{const{blockMap:t}=Z([e]),l={...n,...t};a(l,o,`edit_${Date.now()}`),r({...i,data:e})},m=e.useMemo(()=>pr(u),[u.id,JSON.stringify(u.children)]),g=e.useMemo(()=>sr(u,"menu"),[u.id,JSON.stringify(u.children)]),h=e.useMemo(()=>dr(u),[u.id,JSON.stringify(u.children)]),b=e.useMemo(()=>[{value:"logo_left_nav_right",label:c("header_layout_logo_left_nav_right")},{value:"logo_right_nav_left",label:c("header_layout_logo_right_nav_left")},{value:"logo_center_nav_below",label:c("header_layout_logo_center_nav_below")},{value:"logo_only",label:c("header_layout_logo_only")},{value:"nav_only",label:c("header_layout_nav_only")}],[c]),y=e.useMemo(()=>[{value:"400",label:c("font_weight_regular")},{value:"500",label:c("font_weight_medium")},{value:"600",label:c("font_weight_semibold")},{value:"700",label:c("font_weight_bold")}],[c]),f=e.useMemo(()=>[{value:"none",label:c("nav_text_transform_sentence")},{value:"uppercase",label:c("nav_text_transform_uppercase")},{value:"capitalize",label:c("nav_text_transform_capitalize")}],[c]),_=e.useMemo(()=>[{value:"stack",label:c("stack")},{value:"inline",label:c("inline")}],[c]),k=u.headerLayout||"logo_center_nav_below",x=!1!==u.showLogo,v=!0===u.showHeaderBanner,w=m?.src??"{{LogoUrl}}",S=e.useMemo(()=>{const e="string"==typeof w?w.trim():String(w??""),t=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",n=s&&t?Ft(s,t,{}):null;return null==n||String(n).startsWith("{{")?w||"":String(n)},[w,s]),j=h?.src??"{{HeroBanner}}",C=e.useMemo(()=>{const e="string"==typeof j?j.trim():String(j??""),t=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",n=s&&t?Ft(s,t,{}):null;return null==n||String(n).startsWith("{{")?j||"":String(n)},[j,s]),N=m?.alt??"Logo",I=m?.linkURL??"",A=String(m?.styles?.desktop?.width??"50%"),L=parseInt(A.replace("%",""),10)||50,T=m?.contentStyles?.desktop?.paddingLeft??12,$=h?.alt??"",R=h?.linkURL??"",M=g?.list??[],F=g?.styles?.desktop?.linkColor??"#525252",U=g?.styles?.desktop?.fontSize??13,D=String(g?.styles?.desktop?.fontWeight??"500"),E=g?.styles?.desktop?.textTransform??"uppercase",z=g?.styles?.desktop?.letterSpacing??.02,O=g?.styles?.desktop?.paddingLeft??8,W=g?.linkUnderline??!1,H=d(u.styles,"contentBackground")??"#ffffff",K=u.showBorderBottom??!1,V=u.mobileLayout??"stack",G=d(u.styles,"paddingTop")??0,q=d(u.styles,"paddingRight")??0,J=d(u.styles,"paddingBottom")??0,Y=d(u.styles,"paddingLeft")??0,X=e=>{m&&p(mr(B(u),m.id,e))},Q=e=>{h&&p(mr(B(u),h.id,e))},ee=e=>{g&&p(mr(B(u),g.id,t=>({...e(t),useNavigationLinks:!1})))},te=e=>{ee(t=>({...t,styles:{...t.styles,desktop:{...t.styles?.desktop,...e}}}))},ne=e=>{p({...B(u),...e})},oe=e=>{const t=B(u);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),p(t)},ae=(e,t,n)=>{ee(o=>{const a=[...o.list||[]];return a[e]={...a[e],[t]:n},{...o,list:a}})},le=["logo_left_nav_right","logo_right_nav_left","logo_center_nav_below","logo_only"].includes(k),ie=["logo_left_nav_right","logo_right_nav_left","logo_center_nav_below","nav_only"].includes(k),re=()=>document.querySelector(".right-settings")||document.body;return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx(Ll,{children:c("layout")}),l.jsx(Bl,{label:c("style"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:k,onChange:e=>{const t=B(u),n=pr(t),o=sr(t,"menu"),a=function(e){const t=dr(e),n=ur(e);return t||n?{banner:t,divider:n}:null}(t);t.headerLayout=e,t.children=gr(e,n,o,a);const l=!1!==t.showLogo,i=pr(t);let r=t;i?.id&&(r=mr(r,i.id,e=>({...e,hidden:!l})));const s=!0===r.showHeaderBanner,c=dr(r);c?.id&&(r=mr(r,c.id,e=>({...e,hidden:!s})));const d=ur(r);d?.id&&(r=mr(r,d.id,e=>({...e,hidden:!s}))),p(r)},options:b,getPopupContainer:re})}),le&&l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:c("logo_section")}),l.jsx(Bl,{layout:"toggle",label:c("show_logo"),children:l.jsx(wl,{checked:x,onChange:e=>{let t=B(u);t.showLogo=e;const n=m?.id;n&&(t=mr(t,n,t=>({...t,hidden:!e}))),p(t)}})}),x&&l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:c("image_url"),children:l.jsx(t.Input,{className:"width-full",value:S,placeholder:c("placeholder_https"),onChange:e=>X(t=>({...t,src:e.target.value}))})}),l.jsx(Bl,{label:c("logo_text"),children:l.jsx(t.Input,{className:"width-full",value:u.logoText??"",placeholder:c("brand_name_placeholder"),onChange:e=>ne({logoText:e.target.value})})}),l.jsx(Bl,{label:c("logo_alt"),children:l.jsx(t.Input,{className:"width-full",value:N,onChange:e=>X(t=>({...t,alt:e.target.value}))})}),l.jsx(Bl,{label:c("logo_link"),children:l.jsx(t.Input,{className:"width-full",value:I,placeholder:c("link_url_placeholder"),onChange:e=>X(t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})}),l.jsx(Bl,{label:c("logo_max_width"),children:l.jsx(t.InputNumber,{min:10,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:L,onFocus:e=>e?.target?.select?.(),onChange:e=>X(t=>({...t,styles:{...t.styles,desktop:{...t.styles?.desktop,width:`${e||50}%`}}}))})}),l.jsx(Bl,{label:c("logo_padding"),children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:T,onFocus:e=>e?.target?.select?.(),onChange:e=>X(t=>({...t,contentStyles:{...t.contentStyles,desktop:{...t.contentStyles?.desktop,paddingTop:e??12,paddingBottom:e??12,paddingLeft:e??12,paddingRight:e??12}}}))})})]})]}),l.jsx(Ll,{className:"margin-top-12",children:c("header_banner_section")}),l.jsx(Bl,{layout:"toggle",label:c("show_header_banner"),children:l.jsx(wl,{checked:v,onChange:e=>{let t=B(u);t.showHeaderBanner=e,e&&!dr(t)&&(t=function(e,t){const n=B(e),o={id:P(),name:t("image"),key:"image",headerBannerSlot:!0,src:"{{HeroBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},a={id:P(),name:t("divider"),key:"divider",headerBannerDividerSlot:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},l=!0===e.showHeaderBanner;o.hidden=!l,a.hidden=!l;const i={id:P(),name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[o,a]};return n.children=[...n.children||[],i],n}(t,c));const n=dr(t);n?.id&&(t=mr(t,n.id,t=>({...t,hidden:!e})));const o=ur(t);o?.id&&(t=mr(t,o.id,t=>({...t,hidden:!e}))),p(t)}})}),v&&h?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:c("image_url"),children:l.jsx(t.Input,{className:"width-full",value:C,placeholder:c("placeholder_https"),onChange:e=>Q(t=>({...t,src:e.target.value}))})}),l.jsx(Bl,{label:c("image_alt"),children:l.jsx(t.Input,{className:"width-full",value:$,placeholder:c("image_alt_placeholder"),onChange:e=>Q(t=>({...t,alt:e.target.value}))})}),l.jsx(Bl,{label:c("link_url"),children:l.jsx(t.Input,{className:"width-full",value:R,placeholder:c("link_url_placeholder"),onChange:e=>Q(t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})})]}):null,ie&&l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:c("navigation")}),l.jsx("div",{className:"margin-top-12",children:M.map((e,n)=>l.jsxs("div",{className:"ee-header-nav-link-row",children:[l.jsx(t.Input,{className:"ee-header-nav-link-input",value:e.label,placeholder:c("page"),onChange:e=>ae(n,"label",e.target.value)}),l.jsx(t.Input,{className:"ee-header-nav-link-input",value:e.url,placeholder:c("link_url_placeholder"),onChange:e=>ae(n,"url",e.target.value)}),l.jsx("button",{type:"button",className:"ee-header-nav-remove-btn",onClick:()=>(e=>{ee(t=>({...t,list:(t.list||[]).filter((t,n)=>n!==e)}))})(n),"aria-label":c("tooltip_remove_link"),children:"×"})]},`header-nav-${n}-${e.label??""}`))}),l.jsxs("button",{type:"button",className:"ee-header-add-nav-link-btn",onClick:()=>{ee(e=>({...e,list:[...e.list||[],{label:c("default_nav_link_label"),url:"#",target:"_blank"}]}))},children:[l.jsx("span",{className:"ee-header-add-nav-link-btn-icon",children:"+"}),c("add_link")]}),l.jsx(Ll,{className:"margin-top-18",children:c("link_style")}),l.jsx(Bl,{label:c("color"),children:l.jsx(kl,{color:F,setColor:({hex:e})=>te({linkColor:e,color:e})})}),l.jsx(Bl,{label:c("size"),children:l.jsx(t.InputNumber,{min:10,max:24,className:"input-width ee-settings-input-affix",addonAfter:"px",value:U,onFocus:e=>e?.target?.select?.(),onChange:e=>te({fontSize:e??13})})}),l.jsx(Bl,{label:c("weight"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:D,onChange:e=>te({fontWeight:e}),options:y,getPopupContainer:re})}),l.jsx(Bl,{label:c("transform"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:E,onChange:e=>te({textTransform:e}),options:f,getPopupContainer:re})}),l.jsx(Bl,{label:c("spacing"),children:l.jsx(t.InputNumber,{min:0,max:1,step:.01,className:"input-width ee-settings-input-affix",addonAfter:"em",value:z,onFocus:e=>e?.target?.select?.(),onChange:e=>te({letterSpacing:e??0})})}),l.jsx(Bl,{label:c("gap"),children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:O,onFocus:e=>e?.target?.select?.(),onChange:e=>te({paddingLeft:e??8,paddingRight:e??8})})}),l.jsx(Bl,{layout:"toggle",label:c("underline"),children:l.jsx(wl,{checked:W,onChange:e=>ee(t=>({...t,linkUnderline:e}))})})]}),l.jsx(Ll,{children:c("container_settings")}),l.jsx(Bl,{label:c("background_color"),children:l.jsx(kl,{color:H,setColor:({hex:e})=>oe({contentBackground:e})})}),l.jsx(Bl,{layout:"toggle",label:c("border_bottom"),children:l.jsx(wl,{checked:K,onChange:e=>ne({showBorderBottom:e})})}),l.jsx(Bl,{label:c("mobile_layout"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:V,onChange:e=>ne({mobileLayout:e}),options:_,getPopupContainer:re})}),l.jsx(Bl,{label:c("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:G,paddingRight:q,paddingBottom:J,paddingLeft:Y},setPadding:oe})})]})};function br(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>br(e,t,n))}:e:e}function yr({columnCurrentItem:t,textBlockId:n}){const o=e.useContext($e),a=t?.id,i=o.blockMap?.[n],r=e.useMemo(()=>{if(!a||!n||!i||"text"!==i.key)return null;const e={id:i.id,data:i,type:"edit"};return{...o,currentItem:e,setCurrentItem:e=>{if(e?.id===n&&null!=e?.data){const l=br(B(t.data),n,()=>e.data),{blockMap:i}=Z([l]),r={...o.blockMap,...i};return o.setBlocks(r,o.rootOrder,`edit_${Date.now()}`),void o.setCurrentItem({...t,id:a,data:l})}o.setCurrentItem(e)}}},[o,t,a,i,n]);return r?l.jsx($e.Provider,{value:r,children:l.jsx(bi,{embedded:!0})}):null}function fr(e,t=[]){if(!e)return t;if("text"===e.key&&t.push(e),Array.isArray(e.children))for(const n of e.children)fr(n,t);return t}function _r(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>_r(e,t,n))}:e:e}const kr=()=>{const{blockMap:n,rootOrder:o,setBlocks:a,currentItem:i,setCurrentItem:r}=e.useContext($e),{t:s}=Zo(),{findStyleItem:c}=Kl(),d=e.useMemo(()=>[{value:"400",label:s("font_weight_regular")},{value:"500",label:s("font_weight_medium")},{value:"600",label:s("font_weight_semibold")},{value:"700",label:s("font_weight_bold")}],[s]),u=e.useMemo(()=>[{value:"dashed",label:s("dashed")},{value:"solid",label:s("solid")},{value:"dotted",label:s("dotted")},{value:"none",label:s("border_none")}],[s]),p=e.useMemo(()=>[{value:"left",label:s("table_align_left")},{value:"center",label:s("table_align_center")},{value:"right",label:s("table_align_right")}],[s]),m=i.data,g=m.discountVariant??"card",h="card"===g,b=e=>{const{blockMap:t}=Z([e]),l={...n,...t};a(l,o,`edit_${Date.now()}`),r({...i,data:e})},y=e=>{b({...B(m),...e})},f=e=>{const t=B(m);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),b(t)},_=(e,t)=>{b(_r(B(m),e,t))},k=fr(m),x=h?k[0]??null:null,v=h?k[1]??null:null,w=h?null:k[0]?.id,S=m.showTitle??!0,j=m.discountTitle??"{{DiscountValue}} off your first order",C=m.titleSize??22,N=String(m.titleWeight??"600"),I=m.discountCode??"{{DiscountCode}}",A=m.codeSize??16,L=m.codeSpacing??.08,T=m.codeBorder??"dashed",$=m.codeBorderWidth??1.5,R=m.codeBg??"none",P=m.codeRadius??4,M=c(m.styles,"contentBackground")??(h?"#D8FE91":"#ffa7aa"),F=c(m.styles,"color")??"#171717",U=m.discountAlign??"center",D=m.discountGap??14,E=c(m.styles,"paddingTop")??28,z=c(m.styles,"paddingRight")??24,O=c(m.styles,"paddingBottom")??28,W=c(m.styles,"paddingLeft")??24,H=()=>document.querySelector(".right-settings")||document.body,K=(e,t,n,o={})=>{if(!x)return;const a=void 0!==o.textColor?o.textColor:F,l=void 0!==o.discountAlign?o.discountAlign:U,i=void 0!==o.discountGap?o.discountGap:D;_(x.id,o=>({...o,text:`<p style="text-align:center;margin:0 0 0px"><span style="font-family:Arial;font-size:${t}px;font-weight:${n};color:${a}">${e}</span></p>`,styles:{...o.styles,desktop:{...o.styles?.desktop,fontSize:t,fontWeight:n,textAlign:l,paddingBottom:i}}}))},V=(e,t,n,o,a,l,i={})=>{if(!v)return;const r=void 0!==i.textColor?i.textColor:F,s=void 0!==i.codeBg?i.codeBg:R,c="none"!==s&&""!==s&&s?s:"transparent",d=void 0!==i.discountAlign?i.discountAlign:U,u="none"===o?"none":o,p="none"!==o?r:"transparent";_(v.id,i=>({...i,text:`<p style="text-align:center;margin:0"><span style="font-family:Arial;font-size:${t}px;letter-spacing:${n}em;color:${r}">${e}</span></p>`,styles:{...i.styles,desktop:{...i.styles?.desktop,fontSize:t,letterSpacing:n,textAlign:d,borderTopStyle:u,borderBottomStyle:u,borderLeftStyle:u,borderRightStyle:u,borderTopColor:p,borderBottomColor:p,borderLeftColor:p,borderRightColor:p,borderTopWidth:"none"!==o?`${a}px`:"0px",borderBottomWidth:"none"!==o?`${a}px`:"0px",borderLeftWidth:"none"!==o?`${a}px`:"0px",borderRightWidth:"none"!==o?`${a}px`:"0px",borderRadius:`${l}px`,display:"block",width:"fit-content",maxWidth:"100%",marginLeft:"auto",marginRight:"auto",backgroundColor:c}}}))};return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx(Ll,{children:s("layout")}),l.jsx(Bl,{label:s("style"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:g,onChange:e=>{const t="card"===e?"card":"simple";if(t===(m.discountVariant??"card"))return;const n=Jl("card"===t?"preset_discount":"preset_discount_simple");if(!n)return;const o=B(n);o.id=m.id,b(o)},options:[{value:"card",label:s("discount_variant_card")},{value:"simple",label:s("discount_variant_simple")}],getPopupContainer:H})}),!h&&w&&l.jsx(yr,{columnCurrentItem:i,textBlockId:w}),h&&l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:s("title")}),l.jsx(Bl,{layout:"toggle",label:s("discount_show_title"),children:l.jsx(wl,{checked:S,onChange:e=>{y({showTitle:e}),x&&_(x.id,t=>({...t,hidden:!e}))}})}),S&&l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:s("text"),children:l.jsx(t.Input,{className:"width-full",value:j,onChange:e=>{const t=e.target.value;y({discountTitle:t}),K(t,C,N)}})}),l.jsx(Bl,{label:s("size"),children:l.jsx(t.InputNumber,{min:12,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:C,onFocus:e=>e?.target?.select?.(),onChange:e=>{y({titleSize:e??22}),K(j,e??22,N)}})}),l.jsx(Bl,{label:s("weight"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:N,onChange:e=>{y({titleWeight:e}),K(j,C,e)},options:d,getPopupContainer:H})})]}),l.jsx(Ll,{children:s("discount_code_section")}),l.jsx(Bl,{label:s("text"),children:l.jsx(t.Input,{className:"width-full",value:I,onChange:e=>{const t=e.target.value;y({discountCode:t}),V(t,A,L,T,$,P)}})}),l.jsx(Bl,{label:s("size"),children:l.jsx(t.InputNumber,{min:10,max:32,className:"input-width ee-settings-input-affix",addonAfter:"px",value:A,onFocus:e=>e?.target?.select?.(),onChange:e=>{y({codeSize:e??16}),V(I,e??16,L,T,$,P)}})}),l.jsx(Bl,{label:s("spacing"),children:l.jsx(t.InputNumber,{min:0,max:1,step:.01,className:"input-width ee-settings-input-affix",addonAfter:"em",value:L,onFocus:e=>e?.target?.select?.(),onChange:e=>{y({codeSpacing:e??0}),V(I,A,e??0,T,$,P)}})}),l.jsx(Bl,{label:s("border_style"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:T,onChange:e=>{y({codeBorder:e}),V(I,A,L,e,$,P)},options:u,getPopupContainer:H})}),"none"!==T&&l.jsx(Bl,{label:s("border_width"),children:l.jsx(t.InputNumber,{min:.5,max:6,step:.5,className:"input-width ee-settings-input-affix",addonAfter:"px",value:$,onFocus:e=>e?.target?.select?.(),onChange:e=>{y({codeBorderWidth:e??1.5}),V(I,A,L,T,e??1.5,P)}})}),l.jsx(Bl,{label:s("discount_code_background"),children:l.jsx(kl,{color:"none"===R?"":R,setColor:({hex:e})=>{const t=e||"none";y({codeBg:t}),V(I,A,L,T,$,P,{codeBg:t})}})}),l.jsx(Bl,{label:s("discount_code_corner_radius"),children:l.jsx(t.InputNumber,{min:0,max:32,className:"input-width ee-settings-input-affix",addonAfter:"px",value:P,onFocus:e=>e?.target?.select?.(),onChange:e=>{y({codeRadius:e??4}),V(I,A,L,T,$,e??4)}})})]}),l.jsx(Ll,{children:s("container_settings")}),l.jsx(Bl,{label:s("background_color"),children:l.jsx(kl,{color:M,setColor:({hex:e})=>f({contentBackground:e})})}),h&&l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:s("text_color"),children:l.jsx(kl,{color:F,setColor:({hex:e})=>{f({color:e}),(e=>{h&&(K(j,C,N,{textColor:e}),V(I,A,L,T,$,P,{textColor:e}))})(e)}})}),l.jsx(Bl,{label:s("text_align"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:U,onChange:e=>{y({discountAlign:e}),K(j,C,N,{discountAlign:e}),V(I,A,L,T,$,P,{discountAlign:e})},options:p,getPopupContainer:H})}),l.jsx(Bl,{label:s("gap"),children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:D,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t=e??14;y({discountGap:t}),K(j,C,N,{discountGap:t})}})})]}),l.jsx(Bl,{label:s("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:E,paddingRight:z,paddingBottom:O,paddingLeft:W},setPadding:f})})]})},xr=new Set(["header","discount"]),vr=()=>{const{currentItem:t}=e.useContext($e),n=t?.data?.key,o=t?.data?.containerType,a="column"===n,i=a&&"footer"===o,r=a&&!xr.has(o)&&"footer"!==o;return l.jsxs(l.Fragment,{children:[a&&"header"===o&&l.jsx(hr,{}),a&&"discount"===o&&l.jsx(kr,{}),i?l.jsx(rr,{}):null,r?l.jsx(si,{}):null,"text"===n&&l.jsx(bi,{}),"button"===n&&l.jsx(ki,{}),"divider"===n&&l.jsx(xi,{}),"spacer"===n&&l.jsx(wi,{}),"menu"===n&&l.jsx(Ni,{}),"image"===n&&l.jsx(Ii,{}),"video"===n&&l.jsx(Ai,{}),"avatar"===n&&l.jsx(Li,{}),"social_link"===n&&l.jsx(Fi,{}),"raw_html"===n&&l.jsx(Di,{}),"table"===n&&l.jsx(zi,{})]})},wr={error:{icon:o.faExclamationCircle,color:"#F87171",bg:"rgba(127, 29, 29, 0.35)",border:"rgba(248, 113, 113, 0.45)"},warning:{icon:o.faExclamationTriangle,color:"#fbbf24",bg:"rgba(251, 191, 36, 0.08)",border:"rgba(251, 191, 36, 0.25)"},info:{icon:o.faInfoCircle,color:"#60a5fa",bg:"rgba(96, 165, 250, 0.08)",border:"rgba(96, 165, 250, 0.25)"}},Sr=e=>{const t={},n=e=>{Array.isArray(e)&&e.forEach(e=>{e&&"object"==typeof e&&("text"===e.key&&"dynamic"===e.contentType&&(e.dynamicPrompt||e.dynamicSelectedContent)&&(t[e.id]={blockId:e.id,key:e.key,type:e.type||"p",prompt:e.dynamicPrompt??"",selectedContent:e.dynamicSelectedContent??"",options:e.dynamicOptions??[],variable:e.dynamicVariable??"",language:"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"}),Array.isArray(e.children)&&n(e.children))})};return n(e),t},jr=()=>{const{blockList:t,bodySettings:a,blockMap:i,setCurrentItem:r,setActionType:s,validationMarkers:c,ignoreValidationIssue:d,filterIgnoredValidationIssues:u}=e.useContext($e),{t:p}=Zo(),m=e.useMemo(()=>{const e=Do({blockList:t??[],bodySettings:a??null,aiContentRefs:Sr(t??[])});return"function"==typeof u?u(e):e},[t,a,u]),g=m.filter(e=>"error"===e.severity),h=m.filter(e=>"warning"===e.severity),b=m.filter(e=>"info"===e.severity),y=(e,t)=>{const o=wr[e.severity]||wr.info,a=`validation_${e.code}`,c=p(a),u=c&&c!==a?c:e.message,m=Boolean(e.blockId&&i?.[e.blockId]);return l.jsxs("div",{style:{padding:10,background:o.bg,border:`1px solid ${o.border}`,borderRadius:4,display:"flex",gap:10,marginBottom:8},children:[l.jsx(n.FontAwesomeIcon,{icon:o.icon,style:{width:14,height:14,color:o.color,flexShrink:0,marginTop:2}}),l.jsxs("div",{style:{flex:1,minWidth:0},children:[l.jsx("div",{style:{fontSize:12,fontWeight:700,color:o.color,textTransform:"none"},children:e.location||e.code||p(`compliance_severity_${e.severity}`)||e.severity}),l.jsx("div",{style:{fontSize:11,color:"var(--ee-foreground)",marginTop:2,lineHeight:1.5},children:u}),(m||"function"==typeof d)&&l.jsxs("div",{style:{marginTop:6,display:"flex",gap:8},children:[m&&l.jsx("button",{type:"button",onClick:()=>{var t;(t=e.blockId)&&i?.[t]&&(r({id:t,data:i[t],type:"edit"}),s("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(t)):String(t).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${e}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}))},style:{background:"transparent",border:"1px solid rgba(255,255,255,0.18)",color:"var(--ee-foreground)",padding:"3px 8px",borderRadius:999,fontSize:11,cursor:"pointer",fontFamily:"inherit"},children:p("export_validation_open_block")||"Open block"}),"function"==typeof d&&l.jsx("button",{type:"button",onClick:()=>d(e),style:{background:"transparent",border:"1px solid rgba(255,255,255,0.12)",color:"var(--ee-muted-foreground)",padding:"3px 8px",borderRadius:999,fontSize:11,cursor:"pointer",fontFamily:"inherit"},title:xo(e),children:p("ignore")})]})]})]},t)},f=0===m.length,_=e.useMemo(()=>{try{return JSON.stringify({blockList:t??[],bodySettings:a??{}}).length}catch{return 0}},[t,a]),k=Math.max(1,Math.round(2*_/1024)),x=Math.min(100,k/200*100),v=k>=102,w=l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:p("compliance_email_size")||"Email size"}),l.jsxs("div",{style:{padding:"10px 12px",background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:6},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[l.jsx("span",{style:{fontSize:12,color:"#A3A3A3",fontVariantNumeric:"tabular-nums"},children:p("compliance_approx_kb",{n:String(k)})}),l.jsx("span",{style:{fontSize:11,fontWeight:600,color:v?"#f87070":"#C6F065",fontVariantNumeric:"tabular-nums"},children:v?p("compliance_above_clip")||"Above clip threshold":p("compliance_below_clip")||"Below clip threshold"})]}),l.jsxs("div",{style:{position:"relative",height:6,background:"rgba(255,255,255,0.08)",borderRadius:99},children:[l.jsx("div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${x}%`,background:v?"#f87070":"var(--ee-primary)",borderRadius:99,transition:"width 0.3s ease"}}),l.jsx("div",{style:{position:"absolute",left:"51%",top:-3,bottom:-3,width:1.5,background:"rgba(251,191,36,0.7)",borderRadius:1}})]}),l.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:6},children:l.jsxs("span",{style:{fontSize:10,color:"rgba(251,191,36,0.85)"},children:[102," KB clip"]})})]})]});return l.jsxs("div",{style:{padding:"14px 14px 18px 14px"},children:[l.jsx(Ll,{className:"ee-settings-section-title--flush",children:p("compliance_preflight")||"Pre-flight"}),f?l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:12,background:"rgba(216, 254, 145, 0.08)",border:"1px solid rgba(216, 254, 145, 0.25)",borderRadius:4},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faCheckCircle,style:{width:16,height:16,color:"var(--ee-primary)"}}),l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:13,fontWeight:500},children:p("compliance_all_clear_title")}),l.jsx("div",{style:{fontSize:11,color:"var(--ee-muted-foreground)",marginTop:2},children:p("compliance_all_clear_desc")})]})]}):l.jsxs(l.Fragment,{children:[g.length>0&&l.jsxs("div",{style:{marginBottom:12},children:[l.jsxs("div",{className:"export-validation-errors-heading",style:{fontWeight:600,marginBottom:6,fontSize:12},children:[p("export_validation_errors")," (",g.length,")"]}),g.map((e,t)=>y(e,`e-${t}`))]}),h.length>0&&l.jsxs("div",{style:{marginBottom:12},children:[l.jsxs("div",{className:"export-validation-warnings-heading",style:{fontWeight:600,marginBottom:6,fontSize:12},children:[p("export_validation_warnings")," (",h.length,")"]}),h.map((e,t)=>y(e,`w-${t}`))]}),b.length>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"export-validation-info-heading",style:{fontWeight:600,marginBottom:6,fontSize:12},children:[p("export_validation_info")," (",b.length,")"]}),b.map((e,t)=>y(e,`i-${t}`))]})]}),w]})},Cr=({open:e,onUnlinkInstance:n,onKeepLinked:o,onClose:a})=>{const{t:i}=Zo(),r=()=>{o?.(),a?.()};return l.jsxs(t.Modal,{className:"ee-modal-dark",title:i("unlink_modal_title")||"Edit universal block",open:e,onCancel:r,footer:[l.jsx(t.Button,{onClick:r,children:i("unlink_modal_keep")||"Keep linked"},"keep"),l.jsx(t.Button,{type:"primary",danger:!0,onClick:()=>{n?.(),a?.()},children:i("unlink_modal_unlink")||"Unlink this copy"},"unlink")],width:440,destroyOnClose:!0,children:[l.jsx("p",{style:{color:"var(--ee-muted-foreground)",marginBottom:8},children:i("unlink_modal_body")||"This block is linked to a universal snippet. Editing it here will affect all uses of this block everywhere."}),l.jsx("p",{style:{color:"var(--ee-muted-foreground)"},children:i("unlink_modal_body2")||"Choose “Unlink this copy” to make an independent copy that only affects this template, or “Keep linked” to edit all instances together."})]})},Nr=({onSaveAsUniversal:a})=>{const{blockMap:i,rootOrder:r,setBlocks:s,currentItem:c,setCurrentItem:d,onSaveBlockAsGlobal:u}=e.useContext($e),{t:p}=Zo(),[m,g]=e.useState(!1),[h,b]=e.useState(!1),y=e.useRef(null);e.useEffect(()=>{if(!m)return;const e=e=>{y.current&&!y.current.contains(e.target)&&g(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[m]);const f=c?.id,_=f?i[f]:null;if(!f||!_)return null;const k=()=>g(!1),x="function"==typeof a||"function"==typeof u,v=Boolean(_?.universalBlockId);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{ref:y,className:"ee-block-actions-menu-wrap",onClick:e=>e.stopPropagation(),children:[l.jsx("button",{type:"button",className:"ee-block-actions-trigger",onClick:()=>g(e=>!e),"aria-haspopup":"true","aria-expanded":m,"aria-label":p("more_actions"),title:p("more_actions"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faEllipsisV})}),m&&l.jsxs("div",{className:"ee-block-actions-menu",role:"menu",children:[l.jsxs("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k();const e=za(i,r,f);e&&(s(e.nextMap,e.nextRootOrder,"add"),d({id:e.newId,data:e.selectionData,type:"edit"}))},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faCopy}),l.jsx("span",{children:p("layer_duplicate")})]}),x&&l.jsxs("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k(),"function"==typeof a&&a(_)},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faStar}),l.jsx("span",{children:p("save_as_universal")})]}),v&&l.jsxs("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k(),b(!0)},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faUnlink}),l.jsx("span",{children:p("unlink_universal")||"Unlink this copy"})]}),l.jsxs("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k();const e={..._,hidden:!_.hidden};s({...i,[f]:e},r,"edit")},children:[l.jsx(n.FontAwesomeIcon,{icon:_.hidden?o.faEye:o.faEyeSlash}),l.jsx("span",{children:_.hidden?p("layer_show"):p("layer_hide")})]}),l.jsx("div",{className:"ee-block-actions-divider","aria-hidden":!0}),l.jsxs("button",{type:"button",role:"menuitem",className:"ee-block-actions-item ee-block-actions-item-danger",onClick:()=>{k();const e=()=>{const e=Ka(i,r,f,p);e&&(s(e.nextMap,e.nextRootOrder,"delete"),d(null))};"column"===_.key&&Ha(i,f)?t.Modal.confirm({title:p("shortcut_delete_confirm_title"),content:p("shortcut_delete_confirm_desc"),okText:p("confirm"),cancelText:p("cancel"),wrapClassName:"ee-modal-dark",onOk:e}):e()},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faTrash}),l.jsx("span",{children:p("layer_delete")})]})]})]}),l.jsx(Cr,{open:h,onUnlinkInstance:()=>{const e={..._};delete e.universalBlockId,s({...i,[f]:e},r,`edit_${Date.now()}`),d({...c,data:e})},onKeepLinked:()=>{},onClose:()=>b(!1)})]})},Ir=({open:n,block:o,onCreate:a,onClose:i})=>{const{t:r}=Zo(),[s,c]=e.useState("");e.useEffect(()=>{n&&c("")},[n]);const d=()=>{s.trim()&&o&&a({name:s.trim(),block:o})};return l.jsxs(t.Modal,{className:"ee-modal-dark",title:r("universal_save_modal_title"),open:n,onCancel:i,footer:[l.jsx(t.Button,{onClick:i,children:r("cancel")},"cancel"),l.jsx(t.Button,{type:"primary",onClick:d,disabled:!s.trim(),children:r("universal_save_modal_confirm")},"save")],width:420,destroyOnClose:!0,children:[l.jsx("p",{style:{color:"var(--ee-muted-foreground)",marginBottom:12},children:r("universal_save_modal_subtitle")}),l.jsx(t.Input,{autoFocus:!0,value:s,placeholder:r("universal_save_modal_placeholder"),onChange:e=>c(e.target.value),onPressEnter:d})]})},Ar="content",Lr="styles",Tr="compliance",Br=()=>{const{currentItem:a,isDragStart:i,bodySettings:r,setBodySettings:s,setCurrentItem:c,setActionType:d,blockMap:u,rootOrder:p,validationMarkers:m,onSaveBlockAsGlobal:g,templateData:h}=e.useContext($e),[b,y]=e.useState(null),{t:f}=Zo(),_=e.useCallback(e=>e&&"object"==typeof e&&"column"===e.key&&e.id&&u[e.id]?ee(e.id,u)??e:e,[u]),k=e.useCallback(e=>{y(_(e))},[_]),x=e.useCallback(async({name:e,block:n})=>{try{"function"==typeof g&&await Promise.resolve(g({name:e,block:n})),t.message.success(String(f("universal_save_success")||"").replace("{{name}}",e)||`Saved "${e}" as universal`),y(null)}catch(e){console.error("[EmailEditor] onSaveBlockAsGlobal:",e);const n=f("universal_save_error")||"Could not save universal block",o="string"==typeof e?.message&&e.message.trim()?e.message.trim():"string"==typeof e?e:n;t.message.error(o||n)}},[g,f]);e.useEffect(()=>{const e=e=>{e.detail&&e.detail.block&&y(_(e.detail.block))};return window.addEventListener("ee:canvas-save-universal",e),()=>window.removeEventListener("ee:canvas-save-universal",e)},[_]);const v=e.useMemo(()=>tn(h),[h]),[w,S]=e.useState(Ar),j=e.useRef(null),C=m?Object.values(m).reduce((e,t)=>e+(t?.totalCount||0),0):0,N=e=>{if(!e)return o.faSquare;switch(e.key){case"column":{const t=e.containerType;return"product"===t?o.faCube:"discount"===t?o.faTag:Va(e)===Ga?o.faSquare:o.faColumns}case"text":{const t=(e.type||"p").toLowerCase();return/^h[1-6]$/.test(t)?o.faHeading:o.faFont}case"button":return o.faLink;case"image":return o.faImage;case"video":return o.faVideo;case"divider":return o.faGripLines;case"spacer":return o.faArrowsAltV;case"menu":return o.faBars;case"avatar":return o.faUser;case"social_link":return o.faShareAlt;case"raw_html":return o.faCode;case"table":return o.faTable;case"footer":return o.faEnvelopeOpenText;default:return o.faSquare}},I=()=>{if(!a?.id||!u[a.id])return[];const e=[a.id],t=new Set(e);let n=a.id;for(;;){const o=te(u,p,n);if(!o||t.has(o.containerId))break;e.unshift(o.containerId),t.add(o.containerId),n=o.containerId}return e.map(e=>({id:e,data:u[e]})).filter(e=>Boolean(e.data))},A=()=>{let e="Block";const t=a?.data.key;switch(t){case"text":{const t=(a?.data?.type||"p").toLowerCase();e=/^h[1-6]$/.test(t)?f("heading_settings"):f("text_settings");break}case"column":{const t=a?.data?.containerType;if("product"===t){e=f("block_product");break}if("header"===t){e=f("header_settings");break}if("discount"===t){e=f("discount_settings");break}if("footer"===t){e=f("footer_settings");break}if(Ja(a?.data)){e=f("additional_products_grid_layout");break}e=Va(a?.data)===qa?f("settings_title_column_layout"):f("container_settings");break}case"button":e=f("button_settings");break;case"divider":e=f("divider_settings");break;case"spacer":e=f("spacer_settings");break;case"menu":e=f("menu_settings");break;case"image":e=f("image_settings");break;case"video":e=f("video_settings");break;case"avatar":e=f("avatar_settings");break;case"social_link":e=f("social_link_settings");break;case"raw_html":e=f("raw_html_settings");break;case"table":e=f("table_settings");break;case"footer":e=f("footer_settings")}return e},L=e=>t=>{s({...r,styles:{...r.styles,[e]:t.hex}},"set_body_settings")},T=(e,t,n,o)=>l.jsx(Bl,{label:e,children:l.jsx(kl,{color:t,setColor:n,fallbackColor:o})}),B=()=>{const e=r.styles||{},n=e.headingColor||e.color||"#171717";return l.jsxs("section",{className:"right-panel-styles-section",children:[l.jsx("h3",{className:"right-panel-styles-section-title",children:f("type_styles_section")}),l.jsxs("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[l.jsx(Bl,{label:f("body_font_short"),children:l.jsx(t.Select,{className:"input-width",showSearch:!0,optionFilterProp:"label",value:on(e.fontFamily,h),onChange:e=>{return t=on(e,h),void s({...r,styles:{...r.styles,fontFamily:t}},"set_body_settings");var t},labelRender:({value:e})=>l.jsx("span",{children:an(e,h)}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:v.map(e=>({label:e.label,value:e.value}))})}),T(f("body_text_short"),e.color,L("color"),"#171717"),T(f("body_heading_short"),n,L("headingColor"),"#171717"),T(f("body_link_short"),e.linkColor||"#338AF3",L("linkColor"),"#338AF3")]})]})},$=()=>{const e=r.styles||{},n=J(r);return l.jsxs("section",{className:"right-panel-styles-section",children:[l.jsx("h3",{className:"right-panel-styles-section-title",children:f("document_section")}),l.jsxs("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[T(f("body_bg_color_short"),e.backgroundColor,L("backgroundColor"),"#F5F5F5"),T(f("body_content_bg_short"),e.contentBg??"#FFFFFF",L("contentBg"),"#FFFFFF"),l.jsx(Bl,{label:f("body_width_label"),children:l.jsx(t.InputNumber,{className:"input-width ee-settings-input-affix ee-body-width-number",addonAfter:"px",min:H,max:K,value:n,onChange:e=>s({...r,contentWidth:e,contentWidthMode:V.CUSTOM_PX},"set_body_settings")})})]})]})},R=()=>{const e=q(r),a=J(r),i=r.styles||{};return l.jsxs(l.Fragment,{children:[l.jsxs("section",{className:"right-panel-styles-section",children:[l.jsx("h3",{className:"right-panel-styles-section-title",children:f("email_styles_section")}),l.jsxs("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[T(f("body_bg_color_short"),i.backgroundColor,L("backgroundColor"),"#F5F5F5"),T(f("body_content_bg_short"),i.contentBg??"#FFFFFF",L("contentBg"),"#FFFFFF"),l.jsx(Bl,{label:l.jsxs("span",{children:[f("email_width_mode"),l.jsx(t.Tooltip,{title:f("full_bleed_tooltip"),children:l.jsx("span",{className:"ee-help-icon","aria-label":"Help",children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]}),children:l.jsx(t.Select,{className:"input-width ee-width-mode-select",value:e,onChange:e=>s({...r,contentWidthMode:e},"set_body_settings"),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:[{value:V.EMAIL_WIDTH,label:f("email_width_default")},{value:V.CUSTOM_PX,label:f("custom_px")},{value:V.FULL_BLEED,label:f("full_bleed")}]})}),l.jsx(Bl,{label:f("custom_width_px"),children:l.jsx(t.InputNumber,{className:"input-width ee-settings-input-affix ee-body-width-number",addonAfter:"px",min:H,max:K,value:a,disabled:e===V.FULL_BLEED,onChange:e=>s({...r,contentWidth:e,contentWidthMode:V.CUSTOM_PX},"set_body_settings")})})]})]}),B(),l.jsxs("section",{className:"right-panel-styles-section",children:[l.jsx("h3",{className:"right-panel-styles-section-title",children:f("text_and_headings")}),l.jsx("div",{className:"right-panel-styles-section-body",children:l.jsx(Bl,{label:f("pre_header"),hint:f("pre_header_description"),children:l.jsx(t.Input,{value:r.preHeader,onChange:e=>s({...r,preHeader:e.target.value},"set_body_settings")})})})]}),l.jsxs("section",{className:"right-panel-styles-section",children:[l.jsx("h3",{className:"right-panel-styles-section-title",children:f("mobile_optimization")||"Mobile optimization"}),l.jsxs("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[l.jsxs("div",{className:"ee-settings-row",children:[l.jsx("span",{className:"ee-settings-row-label",children:f("stack_columns_on_mobile")||"Stack columns on mobile"}),l.jsx(wl,{checked:!1!==r.stackColumnsOnMobile,onChange:e=>s({...r,stackColumnsOnMobile:e},"set_body_settings")})]}),l.jsxs("div",{className:"ee-settings-row",children:[l.jsx("span",{className:"ee-settings-row-label",children:f("scale_font_on_mobile")||"Scale font on mobile"}),l.jsx(wl,{checked:!1!==r.scaleFontOnMobile,onChange:e=>s({...r,scaleFontOnMobile:e},"set_body_settings")})]})]})]})]})},P="undefined"!=typeof window&&"product-variables"===window.__eeDragSource,M=a&&"edit"===a.type&&(!i||P);e.useLayoutEffect(()=>{if(!M)return;S(Ar);const e=j.current;e&&(e.scrollTop=0)},[M,a?.id]);const F=()=>l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"right-panel-block-settings-header",children:[l.jsx("button",{type:"button",className:"right-panel-back-btn",onClick:()=>c(null),"aria-label":f("right_panel_back"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronLeft})}),l.jsx("span",{className:"ee-block-settings-header-icon","aria-hidden":!0,children:l.jsx(n.FontAwesomeIcon,{icon:N(a?.data)})}),l.jsx("h2",{className:"right-setting-block-title right-panel-block-title-inline",children:A()}),l.jsx(Nr,{onSaveAsUniversal:k})]}),l.jsxs("div",{className:"right-panel-layers-bar",children:[l.jsx("div",{className:"right-panel-layers-header",children:f("layers_panel")}),l.jsx("nav",{className:"right-panel-breadcrumbs-shell","aria-label":f("layers_panel"),children:l.jsx("ol",{className:"right-panel-breadcrumbs-trail",children:I().map((e,t,a)=>{const i=t===a.length-1,r=(e=>{if(!e)return"";switch(e.key){case"column":{const t=e.containerType;if("product"===t)return f("block_product");if("discount"===t)return f("block_discount");if("header"===t)return f("block_header");if("footer"===t)return f("block_footer");const n=Va(e);return f(n===Ga?"block_palette_section":n===qa?"block_palette_columns":"container")}case"text":{const t=(e.type||"p").toLowerCase();return/^h[1-6]$/.test(t)?f("heading"):f("text")}case"button":return f("button");case"image":return f("image");case"video":return f("video");case"divider":return f("divider");case"spacer":return f("spacer");case"menu":return f("menu");case"avatar":return f("avatar");case"social_link":return f("social_link");case"raw_html":return f("raw_html");case"table":return f("table");case"footer":return f("block_footer");case"empty":return f("drag_block_here");default:return e.name||"Block"}})(e.data),s=N(e.data);return l.jsxs("li",{className:"right-panel-breadcrumb-item right-panel-breadcrumb-crumb-slot",children:[t>0?l.jsx("span",{className:"right-panel-breadcrumb-sep","aria-hidden":!0,children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronRight})}):null,i?l.jsxs("span",{className:"right-panel-breadcrumb-segment right-panel-breadcrumb-current","aria-current":"page",children:[l.jsx("span",{className:"right-panel-breadcrumb-ancestor-icon right-panel-breadcrumb-current-icon",children:l.jsx(n.FontAwesomeIcon,{icon:s})}),l.jsx("span",{className:"right-panel-breadcrumb-label",children:r})]}):l.jsxs("button",{type:"button",className:"right-panel-breadcrumb-segment right-panel-breadcrumb-ancestor",onClick:(p=e.id,e=>{e.preventDefault(),e.stopPropagation();const t=u[p];t&&(c({id:p,data:t,type:"edit"}),d("edit"))}),children:[l.jsx("span",{className:"right-panel-breadcrumb-ancestor-icon",children:l.jsx(n.FontAwesomeIcon,{icon:s})}),l.jsx("span",{className:"right-panel-breadcrumb-label",children:r})]})]},`${e.id||"layer"}-${t}`);var p})})})]}),l.jsx("div",{className:"right-panel-block-settings-form",children:l.jsx(vr,{})})]});return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"right-settings",onClick:e=>{e.stopPropagation()},children:l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"right-panel-tabs",children:[l.jsx("button",{type:"button",className:"right-panel-tab "+(w===Ar?"right-panel-tab-active":""),onClick:()=>S(Ar),children:f("content")}),l.jsx("button",{type:"button",className:"right-panel-tab "+(w===Lr?"right-panel-tab-active":""),onClick:()=>S(Lr),children:f("styles")}),l.jsxs("button",{type:"button",className:"right-panel-tab "+(w===Tr?"right-panel-tab-active":""),onClick:()=>S(Tr),children:[f("compliance"),C>0&&l.jsx("span",{className:"right-panel-tab-badge","aria-label":f("compliance_tab_badge_label",{count:C>99?"99+":String(C)}),children:C>99?"99+":C})]})]}),l.jsxs("div",{ref:j,className:"right-panel-tab-content default-scrollbar"+(w===Ar&&M?" right-panel-tab-content--block-settings":""),children:[w===Ar&&(M?F():l.jsxs(l.Fragment,{children:[$(),B(),l.jsx("div",{className:"ee-content-empty-hint",children:f("right_panel_empty_hint")})]})),w===Lr&&R(),w===Tr&&l.jsx(jr,{})]})]})}),l.jsx(Ir,{open:Boolean(b),block:b,onCreate:x,onClose:()=>y(null)})]})},$r={column:o.faColumns,text:o.faFont,button:o.faMinusSquare,divider:o.faGripLines,spacer:o.faArrowsAltV,menu:o.faBars,image:o.faImage,social_link:o.faShareAltSquare,raw_html:o.faCode,table:o.faTable,video:o.faVideo,product:o.faCube,header:o.faWindowMaximize,footer:o.faWindowMinimize,discount:o.faTag},Rr={header:"header",footer:"footer",discount:"discount",product:"product",none:"product"};function Pr(e,t){const n=Rr[t];return n&&$r[n]?$r[n]:$r.product}const Mr=["text","image","button","divider","spacer","social_link","menu","table","video","raw_html"],Fr={[Ga]:o.faSquare,[qa]:o.faColumns};const Ur=({clearStyles:t,openConfigureColumnsModal:a})=>{const{setCurrentItem:i,setIsDragStart:r,setActionType:s,templateData:c,aiEnabled:d=!0}=e.useContext($e),{blockConfigsList:u}=Al(),{t:p}=Zo(),{blockItems:m,layoutItems:g}=function(e,t){const n=[];Mr.forEach(o=>{const a=e.find(e=>e.key===o);a&&("text"===o&&t?n.push({...a,ai:!0,contentType:"static",dynamicPrompt:"",dynamicSelectedContent:"",dynamicOptions:[],dynamicVariable:"",isPreset:!1}):n.push({...a,isPreset:!1}))});const o=[],a=e.find(e=>"column"===e.key&&e.layoutRole===Ga),l=e.find(e=>"column"===e.key&&e.layoutRole===qa);return a&&o.push({...a,isPreset:!1,paletteIcon:Fr[Ga],opensConfigureModal:!1}),l&&o.push({...l,isPreset:!1,paletteIcon:Fr[qa],opensConfigureModal:!0}),{blockItems:n,layoutItems:o}}(u,d),h=Vl.presets.filter(e=>!Gl.has(e.id)).map(e=>({key:e.id,name:e.presetName,icon:Pr(e.presetName,e.containerType),isPreset:!0,getColumn:()=>Jl(e.id)})),b=e=>{e.target.style.outline="",setTimeout(()=>{r(!1),t&&t()},50)},y=e=>t=>{const n=e.isPreset?B(e.getColumn(p,c)):B(e);i({id:null,data:n,type:"add"}),r(!0),t.target.style.outline="1px dashed var(--ee-primary)",s("add")},f=e=>{const t="boolean"==typeof e.opensConfigureModal?e.opensConfigureModal:Va(e)===qa;return l.jsxs("div",{className:"ee-blocks-palette-card",draggable:!0,onDragStart:y(e),onDragEnd:b,onClick:()=>{t&&a()},title:t?`${e.name} — ${p("configure_columns_hint")}`:e.name,children:[l.jsx(n.FontAwesomeIcon,{icon:e.paletteIcon||e.icon||$r[e.key]||o.faFont,className:"ee-blocks-palette-card-icon"}),l.jsx("span",{className:"ee-blocks-palette-card-label",children:e.name}),e.ai&&l.jsxs("span",{className:"ee-blocks-palette-card-ai",children:[l.jsx(n.FontAwesomeIcon,{icon:o.faStar,className:"ee-blocks-palette-card-ai-icon","aria-hidden":!0}),"AI"]})]},`palette-card-${e.key}-${e.layoutRole??"base"}`)};return l.jsxs("div",{className:"ee-blocks-palette",children:[l.jsx("div",{className:"ee-left-rail-section-title",children:p("blocks")}),l.jsx("div",{className:"ee-blocks-palette-grid",children:m.map(f)}),g.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"ee-left-rail-section-title",style:{paddingTop:16},children:p("layout")}),l.jsx("div",{className:"ee-blocks-palette-grid",children:g.map(f)})]}),h.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"ee-left-rail-section-title",style:{paddingTop:16},children:p("presets")}),l.jsx("div",{className:"ee-blocks-palette-rows",children:h.map(e=>l.jsxs("div",{className:"ee-blocks-palette-row",draggable:!0,onDragStart:y(e),onDragEnd:b,title:e.name,children:[l.jsx(n.FontAwesomeIcon,{icon:o.faGripVertical,className:"ee-blocks-palette-row-grip"}),l.jsx(n.FontAwesomeIcon,{icon:e.icon,className:"ee-blocks-palette-row-icon"}),l.jsx("span",{className:"ee-blocks-palette-row-label",children:e.name})]},e.key))})]})]})},Dr=({clearStyles:a})=>{const{universals:i=[],universalsLoading:r,setCurrentItem:s,setIsDragStart:c,setActionType:d,deleteUniversalEmailBlock:u}=e.useContext($e),{t:p}=Zo(),m=e=>t=>{const n=JSON.parse(JSON.stringify(e.block||{}));n&&"object"==typeof n&&(s({id:null,data:n,type:"add"}),c(!0),t.currentTarget.style.outline="1px dashed var(--ee-primary)",d("add"))},g=e=>{e.currentTarget.style.outline="",setTimeout(()=>{c(!1),a&&a()},50)};return l.jsxs("div",{className:"ee-universal-panel",children:[l.jsxs("div",{className:"ee-left-rail-section-title",children:[p("universal_saved_blocks"),r?l.jsx("span",{className:"ee-universal-loading",children:" · …"}):null]}),0===i.length?l.jsxs("div",{className:"ee-universal-empty",children:[p("universal_empty_state_line_1")," ",l.jsx(n.FontAwesomeIcon,{icon:o.faStar,style:{width:10,height:10,color:"var(--ee-primary)",verticalAlign:"middle"}})," ",p("universal_empty_state_line_2")]}):l.jsx("div",{className:"ee-universal-list",children:i.map(e=>{const a=String(e?.block?.containerType||e?.block?.key||"block").replace(/[-_]/g," "),i="none"===a.trim().toLowerCase()?p("block_palette_section"):a;return l.jsxs("div",{className:"ee-universal-item",draggable:!0,onDragStart:m(e),onDragEnd:g,title:e.name,children:[l.jsx(n.FontAwesomeIcon,{icon:o.faGripVertical,className:"ee-blocks-palette-row-grip"}),l.jsx(n.FontAwesomeIcon,{icon:o.faStar,className:"ee-universal-item-icon"}),l.jsxs("div",{className:"ee-universal-item-body",children:[l.jsx("div",{className:"ee-universal-item-name",children:e.name}),l.jsxs("div",{className:"ee-universal-item-meta",children:[i,null!=e.usedIn?` · ${p("universal_used_in_count").replace("{{count}}",String(e.usedIn))}`:""]})]}),"function"==typeof u?l.jsx("button",{type:"button",className:"ee-universal-item-delete","aria-label":p("universal_delete"),title:p("universal_delete"),onMouseDown:e=>e.stopPropagation(),onClick:n=>{n.preventDefault(),n.stopPropagation(),t.Modal.confirm({title:p("universal_delete_confirm_title"),content:p("universal_delete_confirm_body"),okButtonProps:{danger:!0},okText:p("universal_delete_confirm_ok"),cancelText:p("cancel"),wrapClassName:"ee-modal-dark",onOk:async()=>{try{await u(e.resourceId??e.id)}catch(e){throw t.message.error(e?.message||p("universal_save_error")||"Could not delete"),e}}})},children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash,className:"ee-universal-item-delete-icon"})}):null]},e.id)})})]})},Er={column:o.faColumns,text:o.faFont,button:o.faMinusSquare,divider:o.faGripLines,spacer:o.faArrowsAltV,menu:o.faBars,image:o.faImage,video:o.faVideo,social_link:o.faShareAltSquare,raw_html:o.faCode,table:o.faTable,avatar:o.faUser,empty:o.faSquare};function zr(e){return e?"column"===e.key?"product"===e.containerType?o.faCube:"discount"===e.containerType?o.faTag:Va(e)===Ga?o.faSquare:o.faColumns:Er[e.key]||o.faSquare:o.faSquare}function Or(e,t=28){const n=String(e??"").replace(/<[^>]+>/g,"").trim();return n?n.length>t?`${n.slice(0,t)}…`:n:null}function Wr(e,t){if("column"!==e?.key||"footer"!==e.containerType||!e.footerUnifiedLayout)return[];const n=[],a=(e,t,o,a)=>{n.push({segment:e,label:t,subtitle:Or(o),icon:a})};if(e.showDivider&&a("divider",t("footer_divider_above"),null,o.faGripLines),e.footerShowLogo&&a("logo",`${t("image")} · ${t("logo_section")}`,e.footerLogoAlt||"",o.faImage),e.showBrand&&a("brand",`${t("text")} · ${t("footer_label_brand")}`,e.brandName||"",o.faFont),e.showTagline&&a("tagline",`${t("text")} · ${t("brand_tagline")}`,e.brandTagline||"",o.faFont),e.showAddress&&a("address",`${t("text")} · ${t("address")}`,e.address||"",o.faFont),e.showSocial){const n=Nn(e.footerSocialList).map(e=>String(e.title||"").trim()).filter(Boolean);a("social",t("footer_social_platforms_heading"),n.length?n.slice(0,4).join(", "):null,o.faShareAltSquare)}if(e.showUnsubscribe){const n=[String(e.unsubscribeLinkLabel??"").trim(),String(e.preferencesLinkLabel??"").trim()].filter(Boolean).join(" · ");a("unsubscribe",`${t("menu")} · ${t("footer_toggle_unsubscribe")}`,n||null,o.faBars)}if(e.showSecondaryLinks){const n=In(e.secondaryLinks).map(e=>String(e.label||"").trim()).filter(Boolean);a("secondary",t("footer_secondary_links_heading"),n.length?n.slice(0,5).join(" · "):null,o.faBars)}return e.showCopyright&&a("copyright",`${t("text")} · ${t("copyright_text")}`,e.copyrightText||"",o.faFont),n}const Hr=()=>{const{blockMap:a,rootOrder:i,setBlocks:r,setCurrentItem:s,setActionType:c,currentItem:d,onSaveBlockAsGlobal:u}=e.useContext($e),{t:p}=Zo(),[m,g]=e.useState(null),[h,b]=e.useState(null),y=d?.id||null,f=e=>{if(!e||!a[e])return;let t=a[e];if("column"===t.key&&"footer"===t.containerType&&t.footerUnifiedLayout&&null!=t.footerSelectedSegment&&""!==t.footerSelectedSegment){const n={...t};delete n.footerSelectedSegment,r({...a,[e]:n},i,`edit_${Date.now()}`),t=n}s({id:e,data:t,type:"edit"}),c("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const t="function"==typeof window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${t}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})})},_=(e,t)=>{const n=a[e];if(!n)return;const o={...n,footerSelectedSegment:t};r({...a,[e]:o},i,`edit_${Date.now()}`),s({id:e,data:o,type:"edit"}),c("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const t="function"==typeof window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${t}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})})},k=(e,t)=>{const n=i.indexOf(e);if(-1===n)return;const o=[...i],l="up"===t?n-1:n+1;l<0||l>=o.length||([o[n],o[l]]=[o[l],o[n]],r(a,o,"move"))},x=(e,t)=>{const n=i.indexOf(e);if(-1===n)return;const o=[...i];o.splice(n,1);const l=t>n?t-1:t;o.splice(Math.max(0,Math.min(l,o.length)),0,e),r(a,o,"move")},v=(e,c,d,w,S)=>{if(!e)return null;const j=y===e.id,C=function(e){if(!e)return null;const t=e.text||e.title||e.list&&e.list[0]?.label||e.alt||e.html||"",n=String(t).replace(/<[^>]+>/g,"").trim();return n?n.length>24?`${n.slice(0,24)}…`:n:null}(e),N=function(e,t){if(!e)return"";switch(e.key){case"column":{const n=e.containerType;if("product"===n)return t("block_product");if("discount"===n)return t("block_discount");if("header"===n)return t("block_header");if("footer"===n)return t("block_footer");if("introduction"===n)return t("block_introduction");if("body"===n)return t("block_body");const o=Va(e);return t(o===Ga?"block_palette_section":o===qa?"block_palette_columns":"container")}case"text":return t("text");case"button":return t("button");case"image":return t("image");case"video":return t("video");case"divider":return t("divider");case"spacer":return t("spacer");case"menu":return t("menu");case"avatar":return t("avatar");case"social_link":return t("social_link");case"raw_html":return t("raw_html");case"table":return t("table")||"Table";case"empty":return t("drag_block_here");default:return e.name||"Block"}}(e,p),I=!!e.hidden,A=d&&m&&m!==e.id&&h===w;return l.jsxs("div",{children:[A&&l.jsx("div",{className:"ee-layer-drop-indicator","aria-hidden":!0}),l.jsxs("div",{className:Go("ee-layer-row",j&&"ee-layer-row-selected",I&&"ee-layer-row-hidden"),style:{paddingLeft:6+14*c},onClick:t=>{t.stopPropagation(),f(e.id)},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),f(e.id))},role:"button",tabIndex:0,draggable:d,onDragStart:t=>{if(d){t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",e.id)}catch{}g(e.id)}},onDragOver:t=>{if(!d||!m||m===e.id)return;t.preventDefault();const n=t.currentTarget.getBoundingClientRect(),o=t.clientY-n.top<n.height/2;b(o?w:w+1)},onDrop:e=>{if(!d||!m)return;e.preventDefault();x(m,h??w),g(null),b(null)},onDragEnd:()=>{g(null),b(null)},children:[l.jsx(n.FontAwesomeIcon,{icon:zr(e),className:"ee-layer-row-icon"}),l.jsxs("span",{className:"ee-layer-row-label",children:[N,C&&l.jsxs("span",{className:"ee-layer-row-sub",children:["· ",C]})]}),l.jsxs("div",{className:"ee-layer-row-actions",onClick:e=>e.stopPropagation(),children:[d&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"ee-layer-mini-btn",title:p("layer_move_up"),disabled:0===w,onClick:()=>k(e.id,"up"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronUp})}),l.jsx("button",{type:"button",className:"ee-layer-mini-btn",title:p("layer_move_down"),disabled:w===S-1,onClick:()=>k(e.id,"down"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronDown})})]}),l.jsx("button",{type:"button",className:"ee-layer-mini-btn",title:p("layer_duplicate"),onClick:()=>(e=>{const t=za(a,i,e);t&&(r(t.nextMap,t.nextRootOrder,"add"),s({id:t.newId,data:t.selectionData,type:"edit"}))})(e.id),children:l.jsx(n.FontAwesomeIcon,{icon:o.faCopy})}),d&&"column"===e.key&&"function"==typeof u?l.jsx("button",{type:"button",className:"ee-layer-mini-btn ee-layer-save-universal",title:p("save_as_universal"),"aria-label":p("save_as_universal"),onClick:t=>{t.stopPropagation(),window.dispatchEvent(new CustomEvent("ee:canvas-save-universal",{detail:{block:e}}))},children:l.jsx(n.FontAwesomeIcon,{icon:o.faStar})}):null,l.jsx("button",{type:"button",className:"ee-layer-mini-btn ee-layer-mini-btn-danger",title:p("layer_delete"),onClick:()=>(e=>{const n=a[e];if(!n)return;const o=()=>{const t=Ka(a,i,e,p);t&&(r(t.nextMap,t.nextRootOrder,"delete"),s(null))};"column"===n.key&&Ha(a,e)?t.Modal.confirm({title:p("shortcut_delete_confirm_title"),content:p("shortcut_delete_confirm_desc"),okText:p("confirm"),cancelText:p("cancel"),wrapClassName:"ee-modal-dark",onOk:o}):o()})(e.id),children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash})})]}),l.jsx("button",{type:"button",className:"ee-layer-mini-btn ee-layer-row-vis",title:p(I?"layer_show":"layer_hide"),onClick:t=>{t.stopPropagation(),(e=>{const t=a[e];if(!t)return;const n={...a,[e]:{...t,hidden:!t.hidden}};r(n,i,"edit")})(e.id)},children:l.jsx(n.FontAwesomeIcon,{icon:I?o.faEyeSlash:o.faEye})})]}),"column"===e.key&&Array.isArray(e.cells)&&e.cells.map((t,n)=>{const o=t.childrenIds||[],i=e.cells.length>1;return l.jsxs("div",{children:[i&&l.jsx("div",{className:"ee-layer-cell-label",style:{paddingLeft:12+14*(c+1)},children:`${p("column")} ${n+1}`}),o.map(e=>{const t=a[e];return t&&"empty"!==t.key?v(t,c+2,!1,0,0):null})]},t.id||n)}),"column"===e.key&&"footer"===e.containerType&&e.footerUnifiedLayout&&Wr(e,p).map(({segment:t,label:o,subtitle:i,icon:r})=>{const s=a[e.id]||e,d=y===e.id&&s.footerSelectedSegment===t,u=c+2;return l.jsxs("div",{className:Go("ee-layer-row","ee-layer-row--footer-segment",d&&"ee-layer-row-selected"),style:{paddingLeft:6+14*u},role:"button",tabIndex:0,onClick:n=>{n.stopPropagation(),_(e.id,t)},onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),n.stopPropagation(),_(e.id,t))},children:[l.jsx(n.FontAwesomeIcon,{icon:r,className:"ee-layer-row-icon"}),l.jsxs("span",{className:"ee-layer-row-label",children:[o,i?l.jsxs("span",{className:"ee-layer-row-sub",children:["· ",i]}):null]})]},`${e.id}:footer-seg:${t}`)})]},e.id)};return l.jsxs("div",{className:"ee-layers-panel",onDragOver:e=>{m&&e.preventDefault()},onDrop:e=>{if(!m)return;e.preventDefault();const t=h??i.length;x(m,t),g(null),b(null)},children:[l.jsxs("div",{className:"ee-layers-header",children:[l.jsx("span",{children:p("layers")}),l.jsxs("span",{className:"ee-layers-header-count",children:[i.length," ",1===i.length?p("layer_one"):p("layer_many")]})]}),l.jsxs("button",{type:"button",className:Go("ee-layers-document",!y&&"ee-layers-document-active"),onClick:()=>s(null),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faFile}),l.jsx("span",{children:p("document")})]}),i.map((e,t)=>{const n=a[e];return v(n,1,!0,t,i.length)}),m&&h===i.length&&l.jsx("div",{className:"ee-layer-drop-indicator","aria-hidden":!0})]})},Kr=[{key:"full",label:"1 column",desc:"Full-width section"},{key:"1-1",label:"2 columns",desc:"Equal halves"},{key:"1-1-1",label:"3 columns",desc:"Equal thirds"},{key:"1-1-1-1",label:"4 columns",desc:"Equal quarters"},{key:"1-2",label:"1 : 2",desc:"Narrow + wide"},{key:"2-1",label:"2 : 1",desc:"Wide + narrow"},{key:"1-3",label:"1 : 3",desc:"Sidebar + body"},{key:"3-1",label:"3 : 1",desc:"Body + sidebar"},{key:"2-3",label:"2 : 3",desc:"Off-center"},{key:"3-2",label:"3 : 2",desc:"Off-center"},{key:"1-2-1",label:"1 : 2 : 1",desc:"Hero + edges"},{key:"2-1-1",label:"2 : 1 : 1",desc:"Lead + two"},{key:"1-1-2",label:"1 : 1 : 2",desc:"Two + lead"}],Vr=[{key:"6-col-equal",label:"6 cols equal",cols:6,parts:[1,1,1,1,1,1]},{key:"12-col-equal",label:"12 cols equal",cols:12,parts:[1,1,1,1,1,1,1,1,1,1,1,1]}],Gr=["A","B","C","D"],qr=["A","B","C","D","E","F","G","H","I","J","K","L"],Jr=({parts:e,rowCount:t})=>{const n=e.slice(0,Math.min(e.length,12)),o=Math.min(t,4);return l.jsxs("div",{className:"ee-grid-preview-wrap",children:[l.jsx("div",{className:"ee-grid-preview-heading",children:"Live preview"}),Array.from({length:o}).map((e,t)=>l.jsxs("div",{className:"ee-grid-preview-row",children:[l.jsx("div",{className:"ee-grid-preview-row-label",children:Gr[t]}),n.map((e,n)=>l.jsxs("div",{className:"ee-grid-preview-cell",style:{flex:e},children:[qr[n],Gr[t]]},n))]},t))]})},Yr=e=>{const t="full"===e?[1]:e.split("-").map(e=>parseInt(e,10)),n=t.reduce((e,t)=>e+t,0);return l.jsx("div",{className:"ee-layout-preview",children:t.map((e,t)=>l.jsx("span",{className:"ee-layout-preview-cell",style:{flex:e/n}},t))})};function Xr(e,t,n){const o=e[t]||e.full,a=e=>e&&"object"==typeof e?{...e,id:P(),...Array.isArray(e.children)?{children:e.children.map(a)}:{}}:e;return{id:P(),name:n("block_palette_columns"),key:"column",type:o.type,containerType:"none",layoutRole:qa,columnLayoutOnly:!0,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},children:(o.children||[]).map(a)}}const Zr=({open:a,onClose:i,columnRootId:r})=>{const{t:s}=Zo(),{columnsSetting:c}=Al(),{blockMap:d,rootOrder:u,setBlocks:p,setCurrentItem:m}=e.useContext($e),[g,h]=e.useState("1-1"),[b,y]=e.useState(1),[f,_]=e.useState(!1),[k,x]=e.useState("6-col-equal");e.useEffect(()=>{a&&(h("1-1"),y(1),_(!1))},[a]);const v=(()=>{if(f){const e=Vr.find(e=>e.key===k);return e?e.parts:[1]}return"full"===g?[1]:g.split("-").map(e=>parseInt(e,10))})();return l.jsxs(t.Modal,{className:"ee-modal-dark ee-configure-columns-modal",title:s("configure_columns_title"),open:a,onCancel:i,footer:[l.jsx(t.Button,{onClick:i,children:s("cancel")},"cancel"),l.jsx(t.Button,{type:"primary",onClick:()=>{const e=f?"full":g;let t=d,n=[...u];const o=r&&"column"===t[r]?.key?r:null;let a=null;for(let l=0;l<b;l++){const i=Xr(c,e,s);if(f){const e=Vr.find(e=>e.key===k);if(e){i.type=e.key;const t=e.cols,n=`${(100/t).toFixed(4)}%`;i.children=Array.from({length:t},(e,t)=>({id:P(),name:s("content"),key:"content",width:n,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{id:P(),name:s("drag_block_here"),key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}}]}))}}if(o&&0===l&&"column"===t[o]?.key){i.id=o,t=ce(t,o);const{blockMap:e}=Z([i]);t={...t,...e},a=o;continue}const{newBlockMap:r,rootId:d}=ue(t,i);d&&(t=r,n=[...n,d],a=d)}p(t,n,"add"),null!=a&&t[a]&&m({id:a,data:t[a],type:"edit"}),i()},children:s("configure_columns_insert")},"insert")],width:660,destroyOnClose:!0,children:[l.jsx("p",{style:{color:"var(--ee-muted-foreground)",marginBottom:14},children:s("configure_columns_subtitle")}),l.jsxs("div",{className:"ee-layout-tab-group",role:"tablist","aria-label":"Layout type",children:[l.jsx("button",{type:"button",role:"tab","aria-selected":!f,className:Go("ee-layout-tab",!f&&"ee-layout-tab-active"),onClick:()=>_(!1),children:s("standard_layout")||"Standard"}),l.jsx("button",{type:"button",role:"tab","aria-selected":f,className:Go("ee-layout-tab",f&&"ee-layout-tab-active"),onClick:()=>_(!0),children:s("grid_layout")||"6/12 Grid"})]}),f?l.jsx("div",{style:{display:"flex",gap:8},children:Vr.map(e=>l.jsxs("button",{type:"button",className:Go("ee-layout-card",k===e.key&&"ee-layout-card-active"),onClick:()=>x(e.key),style:{flex:1},children:[l.jsx("div",{className:"ee-layout-grid-mini-bar",children:e.parts.slice(0,6).map((e,t)=>l.jsx("span",{className:"ee-layout-grid-mini-cell"},t))}),l.jsx("div",{className:"ee-layout-card-label",children:e.label})]},e.key))}):l.jsx("div",{className:"ee-layout-grid",children:Kr.filter(e=>c[e.key]).map(e=>l.jsxs("button",{type:"button",className:Go("ee-layout-card",g===e.key&&"ee-layout-card-active"),onClick:()=>h(e.key),children:[Yr(e.key),l.jsx("div",{className:"ee-layout-card-label",children:e.label}),l.jsx("div",{className:"ee-layout-card-desc",children:e.desc})]},e.key))}),l.jsx(Jr,{parts:v,rowCount:b}),l.jsxs("div",{className:"ee-row-count-row",children:[l.jsx("span",{children:s("configure_columns_row_count")||"Rows to insert:"}),l.jsx(t.Button,{className:"ee-configure-stepper-btn",type:"default",size:"small",icon:l.jsx(n.FontAwesomeIcon,{icon:o.faMinus}),onClick:()=>y(e=>Math.max(1,e-1)),disabled:b<=1}),l.jsx("span",{className:"ee-row-count-value",children:b}),l.jsx(t.Button,{className:"ee-configure-stepper-btn",type:"default",size:"small",icon:l.jsx(n.FontAwesomeIcon,{icon:o.faPlus}),onClick:()=>y(e=>Math.min(4,e+1)),disabled:b>=4})]})]})},Qr="blocks",es="universal",ts="layers",ns=({clearStyles:t})=>{const{t:a}=Zo(),[i,r]=e.useState(Qr),[s,c]=e.useState(!1),[d,u]=e.useState(null);e.useEffect(()=>{const e=e=>{u(e?.detail?.rootId??null),c(!0)};return window.addEventListener(Ya,e),()=>window.removeEventListener(Ya,e)},[]);const p=[{id:Qr,label:a("blocks"),icon:o.faTh},{id:es,label:a("universal"),icon:o.faStar},{id:ts,label:a("layers"),icon:o.faLayerGroup}];return l.jsxs("aside",{className:"ee-left-rail","aria-label":"Editor sidebar",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[l.jsx("div",{className:"ee-left-rail-tabs",role:"tablist",children:p.map(e=>l.jsxs("button",{type:"button",role:"tab","aria-selected":i===e.id,className:Go("ee-left-rail-tab",i===e.id&&"ee-left-rail-tab-active"),onClick:()=>r(e.id),children:[l.jsx(n.FontAwesomeIcon,{icon:e.icon}),l.jsx("span",{children:e.label})]},e.id))}),l.jsxs("div",{className:"ee-left-rail-body",children:[i===Qr&&l.jsx(Ur,{clearStyles:t,openConfigureColumnsModal:()=>{u(null),c(!0)}}),i===es&&l.jsx(Dr,{clearStyles:t}),i===ts&&l.jsx(Hr,{})]}),l.jsx(Zr,{open:s,columnRootId:d,onClose:()=>{c(!1),u(null)}})]})},os=({open:n,issues:o,onClose:a,onExportAnyway:i})=>{const{setCurrentItem:r,setActionType:s,blockMap:c}=e.useContext($e),{t:d}=Zo(),u=e=>{var t;e?.blockId&&((t=e.blockId)&&c?.[t]&&(r({id:t,data:c[t],type:"edit"}),s("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(t)):String(t).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${e}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}),1)&&a())},p=(e,t)=>{const n=Boolean(e?.blockId),o=`validation_${e.code}`,a=d(o),i=a&&a!==o?a:e.message;return l.jsx("li",{className:"export-validation-issue-item",children:l.jsxs("button",{type:"button",className:"export-validation-issue-btn "+(n?"is-clickable":""),onClick:()=>u(e),disabled:!n,children:[l.jsx("span",{className:"export-validation-issue-copy",children:i}),n&&l.jsx("span",{className:"export-validation-issue-action",children:d("export_validation_open_block")||"Open block"})]})},t)},m=(o||[]).filter(e=>"error"===e.severity),g=(o||[]).filter(e=>"warning"===e.severity),h=(o||[]).filter(e=>"info"===e.severity);return l.jsxs(t.Modal,{className:"ee-modal-dark",title:d("export_validation_title"),open:n,onCancel:a,footer:[l.jsx(t.Button,{onClick:a,children:d("cancel")},"cancel"),l.jsx(t.Button,{type:"primary",onClick:i,children:d("export_anyway")},"export")],width:520,destroyOnClose:!0,children:[l.jsx("p",{style:{marginBottom:12},children:d("export_validation_issues_found")}),l.jsxs("div",{style:{maxHeight:360,overflowY:"auto"},children:[m.length>0&&l.jsxs("div",{style:{marginBottom:12},children:[l.jsxs("div",{className:"export-validation-errors-heading",style:{fontWeight:600,marginBottom:6},children:[d("export_validation_errors")," (",m.length,")"]}),l.jsx("ul",{className:"export-validation-issue-list",children:m.map((e,t)=>p(e,`e-${t}`))})]}),g.length>0&&l.jsxs("div",{style:{marginBottom:12},children:[l.jsxs("div",{className:"export-validation-warnings-heading",style:{fontWeight:600,marginBottom:6},children:[d("export_validation_warnings")," (",g.length,")"]}),l.jsx("ul",{className:"export-validation-issue-list",children:g.map((e,t)=>p(e,`w-${t}`))})]}),h.length>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"export-validation-info-heading",style:{fontWeight:600,marginBottom:6},children:[d("export_validation_info")," (",h.length,")"]}),l.jsx("ul",{className:"export-validation-issue-list",children:h.map((e,t)=>p(e,`i-${t}`))})]})]})]})},{Option:as}=t.Select,ls=[{value:"none",label:"No payload"},{value:"profile",label:"Profile data"},{value:"event",label:"Event data"}],is=({open:n,onClose:o,onSend:a,templateName:i})=>{const{t:r}=Zo(),[s,c]=e.useState([]),[d,u]=e.useState(""),[p,m]=e.useState("none"),[g,h]=e.useState(!0),[b,y]=e.useState(!1),f=e=>{const t=String(e||"").trim();if(!t)return;const n=t.split(/[\s,;]+/).filter(Boolean);c(e=>{const t=new Set(e);return n.forEach(e=>t.add(e)),Array.from(t)}),u("")},_=e=>{c(t=>t.filter(t=>t!==e))},k=()=>{c([]),u(""),m("none"),h(!0),y(!1),o?.()};return l.jsx(t.Modal,{className:"ee-modal-dark",title:r("send_test_title")||"Send test email",open:n,onCancel:k,footer:[l.jsx(t.Button,{onClick:k,disabled:b,children:r("cancel")},"cancel"),l.jsx(t.Button,{type:"primary",onClick:async()=>{if(0!==s.length){y(!0);try{await Promise.resolve(a?.({recipients:s,payloadType:p,testPrefix:g,subjectPrefix:g?"[TEST] ":"",name:i||"Untitled template"})),k()}finally{y(!1)}}},loading:b,disabled:0===s.length,children:r("send_test_send")||"Send test"},"send")],width:480,destroyOnClose:!0,children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[l.jsxs("div",{children:[l.jsx("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:r("send_test_recipients")||"Recipients"}),l.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,minHeight:36,padding:"4px 8px",border:"1px solid var(--ee-border, #374151)",borderRadius:6,backgroundColor:"var(--ee-surface, #1a1a1a)",cursor:"text"},onClick:()=>document.getElementById("ee-send-test-input")?.focus(),children:[s.map(e=>l.jsx(t.Tag,{closable:!0,onClose:()=>_(e),style:{margin:2},children:e},e)),l.jsx(t.Input,{id:"ee-send-test-input",bordered:!1,value:d,style:{flex:1,minWidth:160,padding:0},placeholder:0===s.length?r("send_test_recipients_placeholder")||"name@example.com, another@example.com":"",onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"!==e.key&&","!==e.key&&" "!==e.key&&"Tab"!==e.key||(e.preventDefault(),f(d)),"Backspace"===e.key&&!d&&s.length>0&&_(s[s.length-1])},onBlur:()=>{d.trim()&&f(d)}})]}),l.jsx("div",{style:{fontSize:11,color:"var(--ee-muted-foreground)",marginTop:4},children:r("send_test_recipients_hint")||"Press Enter or comma to add each address."})]}),l.jsxs("div",{children:[l.jsx("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:r("send_test_payload")||"Payload context"}),l.jsx(t.Select,{style:{width:"100%"},value:p,onChange:m,getPopupContainer:()=>document.querySelector(".email-editor")||document.body,children:ls.map(e=>l.jsx(as,{value:e.value,children:r(`send_test_payload_${e.value}`)||e.label},e.value))})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 12px",borderRadius:6,backgroundColor:"var(--ee-surface, #1a1a1a)",border:"1px solid var(--ee-border, #374151)"},children:[l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:13,fontWeight:500},children:r("send_test_prefix_label")||"[TEST] prefix"}),l.jsx("div",{style:{fontSize:12,color:"var(--ee-muted-foreground)"},children:r("send_test_prefix_hint")||"Prepends [TEST] to the subject line."})]}),l.jsx(t.Switch,{checked:g,onChange:h})]})]})})},rs=({templateName:a,onTemplateNameChange:i,onBack:r,onPreview:s,onSendTest:c,onSaveTemplate:d,onShowShortcuts:u,onSendTestIntent:p,onSaveTemplateIntent:m,saveStatusDetail:g,onExit:h,hideOverflowExportActions:b=!1})=>{const{previewMode:y,setPreviewMode:f,canUndo:_,canRedo:k,undo:x,redo:v,blockList:w,bodySettings:S,templateData:j,saveState:C,highContrastEditor:N,setHighContrastEditor:I,filterIgnoredValidationIssues:A}=e.useContext($e),{t:L}=Zo(),[T,B]=e.useState(!1),[$,R]=e.useState(a||""),[P,M]=e.useState(!1),[F,U]=e.useState(!1),[D,E]=e.useState([]),[z,O]=e.useState(null),[W,H]=e.useState(!1),[K,V]=e.useState(!1),[G,q]=e.useState(!1),[J,Y]=e.useState(""),[X,Z]=e.useState(!1),[Q,ee]=e.useState("desktop"),te=e.useRef(null);e.useEffect(()=>{X&&ee("desktop")},[X]);const ne=e.useMemo(()=>{if(!X)return{html:"",error:null};try{return{html:eo({bodySettings:S,blockList:w,templateData:j??void 0})??"",error:null}}catch(e){return console.error("[EmailEditor] HTML preview generation failed:",e),{html:"",error:L("html_email_preview_error")}}},[X,S,w,j,L]);e.useEffect(()=>{R(a||"")},[a]),e.useEffect(()=>{if(!P)return;const e=e=>{te.current&&!te.current.contains(e.target)&&M(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[P]);const oe=()=>{B(!1),"function"==typeof i&&$!==a&&i($)},ae=e.useCallback(e=>{const t={},n=(e,o=[])=>{Array.isArray(e)&&e.forEach(e=>{if(!e||"object"!=typeof e)return;const a={blockId:e.id??null,key:e.key??null,containerType:"column"===e.key?e.containerType??"none":null},l=[...o,a];if("text"===e.key&&"dynamic"===e.contentType){const n="string"==typeof e.dynamicPrompt?e.dynamicPrompt.trim():"",o="string"==typeof e.dynamicSelectedContent?e.dynamicSelectedContent.trim():"";if(!n&&!o)return;t[e.id]={blockId:e.id,path:l,key:e.key,type:e.type||"p",selectedContent:o,options:Array.isArray(e.dynamicOptions)?e.dynamicOptions:[],prompt:n,variable:e.dynamicVariable??"",language:"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"}}Array.isArray(e.children)&&n(e.children,l)})};return n(e,[]),t},[]),le=e.useCallback(e=>Array.isArray(e)?e.map(e=>{if(!e||"object"!=typeof e)return e;const{dynamicPrompt:t,dynamicOptions:n,dynamicSelectedContent:o,dynamicVariable:a,dynamicAiLanguage:l,staticTextBeforeAi:i,children:r,...s}=e;return{...s,children:le(r)}}):e,[]),ie=e.useCallback(()=>({blockList:le(w??[]),bodySettings:S??null,aiContentRefs:ae(w??[]),language:vo(w??[])}),[w,S,ae,le]),re=()=>{const e=ie(),t=JSON.stringify(e,null,2),n=new Blob([t],{type:"application/json"}),o=document.createElement("a");o.download=`${a||"email-template"}.json`,o.href=URL.createObjectURL(n),o.click()},se=()=>{const e=eo({bodySettings:S,blockList:w,templateData:j});if(null==e)return;const t=new Blob([e],{type:"text/html"}),n=document.createElement("a");n.download=`${a||"email-template"}.html`,n.href=URL.createObjectURL(t),n.click()},ce=async e=>{H(!0);try{const t=ie();let n=Do({blockList:t.blockList??[],bodySettings:t.bodySettings??null,aiContentRefs:t.aiContentRefs??{}});const o=await Ko(t.blockList??[]);if(n=[...n,...o],"function"==typeof A&&(n=A(n)),0===n.length)return void("html"===e?se():re());E(n),O(e),U(!0)}finally{H(!1)}},de=()=>{U(!1),E([]),O(null)},ue="function"==typeof p||"function"==typeof c,pe="function"==typeof m||"function"==typeof d,me="function"==typeof p,ge="function"==typeof m;return l.jsxs("header",{className:"ee-topbar",children:["function"==typeof r&&"function"!=typeof h&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:"ee-topbar-back",onClick:r,"aria-label":L("topbar_back_to_templates"),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faChevronLeft}),l.jsx("span",{children:L("topbar_back_to_templates")})]}),l.jsx("div",{className:"ee-topbar-divider","aria-hidden":!0})]}),l.jsxs("div",{className:"ee-topbar-breadcrumb",children:[l.jsx(n.FontAwesomeIcon,{icon:o.faEnvelope}),l.jsx("span",{children:L("topbar_breadcrumb_email")}),l.jsx(n.FontAwesomeIcon,{icon:o.faChevronRight,className:"ee-topbar-breadcrumb-sep"}),T?l.jsx("input",{autoFocus:!0,className:"ee-topbar-name-input",value:$,onChange:e=>R(e.target.value),onBlur:oe,onKeyDown:e=>{"Enter"===e.key?oe():"Escape"===e.key&&(R(a||""),B(!1))},"aria-label":L("topbar_rename_template")}):l.jsx("button",{type:"button",className:"ee-topbar-name-btn",onClick:()=>{"function"==typeof i&&B(!0)},title:"function"==typeof i?L("topbar_rename_template"):void 0,children:a||L("topbar_untitled_template")})]}),l.jsxs("div",{className:"ee-topbar-spacer",children:[(g||C)&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ee-topbar-status-cluster ee-topbar-status-cluster--lead",children:[l.jsx("span",{className:Go("header-save-state","saved"===C&&"header-save-state_saved","saving"===C&&"header-save-state_saving","unsaved"===C&&"header-save-state_unsaved","error"===C&&"header-save-state_error"),"aria-label":`save-state-${C}`,children:g||C&&(L(`save_state_${C}`)||C)}),"saved"===C&&l.jsx(n.FontAwesomeIcon,{icon:o.faCheckCircle,className:"ee-topbar-saved-check","aria-hidden":!0}),"saving"===C&&l.jsx(n.FontAwesomeIcon,{icon:o.faSpinner,spin:!0,className:"ee-topbar-saving-spinner","aria-hidden":!0})]}),l.jsx("div",{className:"ee-topbar-divider","aria-hidden":!0})]}),l.jsx("button",{type:"button",className:"ee-topbar-icon-btn",onClick:x,disabled:!_,title:L("undo"),"aria-label":L("undo"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faUndo})}),l.jsx("button",{type:"button",className:"ee-topbar-icon-btn",onClick:v,disabled:!k,title:L("redo"),"aria-label":L("redo"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faRedo})}),l.jsx("div",{className:"ee-topbar-divider","aria-hidden":!0}),l.jsxs("div",{className:"ee-topbar-segment",role:"tablist","aria-label":"Device preview",children:[l.jsx("button",{type:"button",role:"tab","aria-selected":"desktop"===y,className:Go("ee-topbar-segment-btn","desktop"===y&&"ee-topbar-segment-btn-active"),onClick:()=>f("desktop"),title:L("desktop"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faDesktop})}),l.jsx("button",{type:"button",role:"tab","aria-selected":"mobile"===y,className:Go("ee-topbar-segment-btn","mobile"===y&&"ee-topbar-segment-btn-active"),onClick:()=>f("mobile"),title:L("mobile"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faMobileAlt})})]}),l.jsx("button",{type:"button",className:"ee-topbar-icon-btn",onClick:()=>Z(!0),title:L("html_email_preview"),"aria-label":L("html_email_preview"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faEye})}),l.jsx("div",{className:"ee-topbar-divider","aria-hidden":!0}),ue&&l.jsxs("button",{type:"button",className:"ee-topbar-btn ee-topbar-btn-ghost ee-topbar-btn-send-test",onClick:()=>{"function"!=typeof p?"function"==typeof c&&V(!0):p()},title:L("send_test"),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faPaperPlane}),l.jsx("span",{className:"ee-topbar-btn-label",children:L("send_test")})]}),"function"==typeof s&&l.jsxs("button",{type:"button",className:"ee-topbar-btn ee-topbar-btn-outline",onClick:()=>{"function"==typeof s&&s()},title:L("preview"),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faExternalLinkAlt}),l.jsx("span",{className:"ee-topbar-btn-label",children:L("preview")})]}),pe&&l.jsxs("button",{type:"button",className:"ee-topbar-btn ee-topbar-btn-primary",onClick:()=>{"function"!=typeof m?"function"==typeof d&&q(!0):m()},title:L("save_template"),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faSave}),l.jsx("span",{className:"ee-topbar-btn-label",children:L("save_template")})]}),l.jsxs("div",{className:"ee-topbar-overflow-wrap",ref:te,children:[l.jsx("button",{type:"button",className:"ee-topbar-icon-btn",onClick:()=>M(e=>!e),"aria-haspopup":"true","aria-expanded":P,"aria-label":L("more_actions"),title:L("more_actions"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faEllipsisV})}),P&&l.jsxs("div",{className:"ee-topbar-overflow-menu",role:"menu",children:[!b&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",disabled:W,onClick:()=>{M(!1),ce("json")},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faFileExport}),l.jsx("span",{children:L("export_json")})]}),l.jsxs("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",disabled:W,onClick:()=>{M(!1),ce("html")},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faFileCode}),l.jsx("span",{children:L("export_html")})]})]}),"function"==typeof u&&l.jsxs(l.Fragment,{children:[!b&&l.jsx("div",{className:"ee-topbar-overflow-divider","aria-hidden":!0}),l.jsxs("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",onClick:()=>{M(!1),u()},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faKeyboard}),l.jsx("span",{children:L("keyboard_shortcuts")})]})]}),"function"==typeof I&&l.jsxs("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",onClick:()=>{I(e=>!e),M(!1)},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faAdjust}),l.jsx("span",{children:L(N?"high_contrast_off":"high_contrast_on")})]})]})]}),"function"==typeof h&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"ee-topbar-divider ee-topbar-divider-exit","aria-hidden":!0}),l.jsx("button",{type:"button",className:"ee-topbar-exit-btn",onClick:h,children:L("topbar_exit")||"Exit"})]})]}),l.jsx(t.Modal,{className:"ee-modal-dark ee-html-preview-modal",title:l.jsxs("div",{className:"ee-html-preview-modal-header-inner",children:[l.jsx("span",{className:"ee-html-preview-modal-title-text",children:L("html_email_preview_title")}),l.jsxs("div",{className:"ee-topbar-segment ee-html-preview-modal-segment",role:"tablist","aria-label":L("html_email_preview_device_aria"),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),children:[l.jsx("button",{type:"button",role:"tab","aria-selected":"desktop"===Q,className:Go("ee-topbar-segment-btn","desktop"===Q&&"ee-topbar-segment-btn-active"),onClick:()=>ee("desktop"),title:L("desktop"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faDesktop})}),l.jsx("button",{type:"button",role:"tab","aria-selected":"mobile"===Q,className:Go("ee-topbar-segment-btn","mobile"===Q&&"ee-topbar-segment-btn-active"),onClick:()=>ee("mobile"),title:L("mobile"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faMobileAlt})})]})]}),open:X,onCancel:()=>Z(!1),footer:null,width:"min(960px, 96vw)",centered:!0,destroyOnClose:!0,children:ne.error?l.jsx("p",{className:"ee-html-preview-error",children:ne.error}):l.jsx("div",{className:Go("ee-html-preview-viewport","mobile"===Q&&"ee-html-preview-viewport--mobile"),children:l.jsx("iframe",{title:L("html_email_preview_title"),className:"ee-html-preview-iframe",sandbox:"allow-same-origin allow-popups allow-popups-to-escape-sandbox",srcDoc:ne.html})})}),l.jsx(os,{open:F,issues:D,onClose:de,onExportAnyway:()=>{"html"===z?se():"json"===z&&re(),de()}}),!me&&"function"==typeof c&&l.jsx(is,{open:K,templateName:a,onClose:()=>V(!1),onSend:e=>{if("function"!=typeof c)return;const t=ie();c({...t,name:a||"Untitled template",recipients:e.recipients,payloadType:e.payloadType,subjectPrefix:e.subjectPrefix})}}),!ge&&"function"==typeof d&&l.jsx(t.Modal,{className:"ee-modal-dark",title:L("save_template_title")||"Save template",open:G,onCancel:()=>{q(!1),Y("")},onOk:()=>{if("function"!=typeof d)return;const e=ie();d({...e,name:a||"Untitled template",category:J}),q(!1),Y("")},okText:L("save")||"Save",cancelText:L("cancel"),width:420,destroyOnClose:!0,children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[l.jsxs("div",{children:[l.jsx("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:L("template_name")||"Template name"}),l.jsx(t.Input,{value:a||L("topbar_untitled_template"),readOnly:!0})]}),l.jsxs("div",{children:[l.jsx("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:L("save_template_category")||"Category"}),l.jsx(t.Select,{style:{width:"100%"},value:J||void 0,placeholder:L("save_template_category_placeholder")||"Select or type a category…",allowClear:!0,showSearch:!0,onChange:e=>Y(e||""),getPopupContainer:()=>document.querySelector(".email-editor")||document.body,options:[{value:"promotional",label:L("category_promotional")||"Promotional"},{value:"transactional",label:L("category_transactional")||"Transactional"},{value:"newsletter",label:L("category_newsletter")||"Newsletter"},{value:"onboarding",label:L("category_onboarding")||"Onboarding"},{value:"announcement",label:L("category_announcement")||"Announcement"},{value:"other",label:L("category_other")||"Other"}]})]})]})})]})},ss=({keys:e,desc:t})=>l.jsxs("div",{className:"ee-shortcuts-row",children:[l.jsx("span",{className:"ee-shortcuts-row-desc",children:t}),l.jsx("kbd",{className:"ee-shortcuts-kbd",children:e})]}),cs=({open:e,onClose:n})=>{const{t:o}=Zo(),a=/Mac|iPhone|iPod|iPad/i.test("undefined"!=typeof navigator&&navigator.platform||"")?"⌘":"Ctrl";return l.jsxs(t.Modal,{wrapClassName:"ee-modal-dark ee-shortcuts-modal",title:o("shortcuts_modal_title"),open:e,onCancel:n,footer:null,width:520,destroyOnClose:!0,children:[l.jsx(ss,{keys:`${a} + S`,desc:o("shortcut_save")}),l.jsx(ss,{keys:`${a} + Z`,desc:o("shortcut_undo")}),l.jsx(ss,{keys:`${a} + Shift + Z / ${a} + Y`,desc:o("shortcut_redo")}),l.jsx(ss,{keys:`${a} + D`,desc:o("shortcut_duplicate")}),l.jsx(ss,{keys:`${a} + C`,desc:o("shortcut_copy_block")}),l.jsx(ss,{keys:`${a} + V`,desc:o("shortcut_paste_block")}),l.jsx(ss,{keys:"Delete / Backspace",desc:o("shortcut_delete_block")}),l.jsx(ss,{keys:"Esc",desc:o("shortcut_escape")}),l.jsx(ss,{keys:"?",desc:o("shortcut_cheat_sheet")}),l.jsx("p",{className:"ee-shortcuts-footnote",children:o("shortcuts_modal_footnote")})]})};function ds(e){return e&&"function"==typeof e.closest&&(e.closest('[data-type="empty-block-item"]')||e.closest('[data-type="empty-block"]')||e.closest('[data-type="drag-over-column"]')||e.closest('[data-type="block-item-move"]'))||e}const us=({language:n})=>{const{blockMap:o,rootOrder:a,setBlocks:i,currentItem:r,setCurrentItem:s,setIsDragStart:c,setLanguage:d,templateData:u,highContrastEditor:p,canUndo:m,canRedo:g,undo:h,redo:b,flushPendingRichText:y,onShortcutSave:f,templateName:_,onTemplateNameChange:k,onBack:x,onSaveTemplate:v,onSaveTemplateIntent:w,onSendTest:S,onSendTestIntent:j,saveStatusDetail:C,onExit:N,onPreview:I,hideOverflowExportActions:A}=e.useContext($e),{t:L}=Zo(),{getColumnConfig:T}=Al(),[B,$]=e.useState(!1),R=e=>{if(!e||"object"!=typeof e)return e;const t=u?.content?.products,n=u?.catalogProducts,o=u?.content?.primaryProductId,a=Array.isArray(t)&&t.length>0?t:Array.isArray(n)&&n.length>0?n:Yl,l=o?a.find(e=>e.id===o):a[0],i=l?a.filter(e=>e?.id!==l.id):a,r=e=>{if(!e||"object"!=typeof e)return e;const t=Array.isArray(e.children)?e.children.map(r):e.children;if("column"!==e.key||"product"!==e.containerType||!l)return{...e,children:t};const n=Math.max(Array.isArray(t)?t.length:0,Array.isArray(e.columnProducts)?e.columnProducts.length:0,1),o="additional"===e.productRole?"additional":"main",a=Array.from({length:n},(e,t)=>"main"===o||0===i.length?l:i[t%i.length]);return{...e,children:t,columnProducts:a}};return r(e)};e.useEffect(()=>{d(n)},[n,d]),e.useEffect(()=>{const e=e=>{const t=e.target;if(n=t,Boolean(n&&n.closest&&n.closest(".email-editor")))return!0;var n;const o=t===document.body||t===document.documentElement||"string"==typeof t?.id&&"root"===t.id;return Boolean(o&&document.querySelector(".email-editor"))},n=e=>"Backspace"===e.key||"Delete"===e.key||"Backspace"===e.code||"Delete"===e.code,l=l=>{if(!e(l))return;const c=l.metaKey||l.ctrlKey,d=l.key,u=(p=l.target,Boolean(p?.closest?.(".text-content_editable[contenteditable='true']")));var p;const _=(e=>{if(!e)return!1;const t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||Boolean(e.closest?.(".ant-input, .ant-input-number, textarea.ant-input, .ant-select-selection-search-input"))})(l.target),k=()=>{if(!r?.id||"add"===r.type)return!1;const e=r.id,n=o[e];if(!n)return!1;const c=()=>{const t=Ka(o,a,e,L);t&&(i(t.nextMap,t.nextRootOrder,"delete"),s(null))};return"column"===n.key&&Ha(o,e)?(l.preventDefault(),l.stopPropagation(),t.Modal.confirm({title:L("shortcut_delete_confirm_title"),content:L("shortcut_delete_confirm_desc"),okText:L("confirm"),cancelText:L("cancel"),wrapClassName:"ee-modal-dark",onOk:c}),!0):(l.preventDefault(),l.stopPropagation(),c(),!0)};if(c&&"s"===String(d).toLowerCase())"function"==typeof f&&(l.preventDefault(),l.stopPropagation(),f());else if(u){if("Escape"===d)return l.preventDefault(),l.stopPropagation(),y(),$(!1),"function"==typeof document.activeElement?.blur&&document.activeElement.blur(),void s(null);if(!c&&n(l)&&(e=>"function"==typeof e?.closest&&e.closest("[data-block-id]")?.getAttribute?.("data-block-id")||null)(l.target)===r?.id&&(()=>{const e=window.getSelection();if(!e?.rangeCount)return!1;const t=e.anchorNode;if(!t)return!1;const n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,o="function"==typeof n?.closest?n.closest(".text-content_editable[contenteditable='true']"):null;return!!o&&0===String(o.innerText||"").replace(/[\u200b\uFEFF]/g,"").replace(/\u00a0/g," ").replace(/[\t\n\r\f]/g,"").trim().length})())return y(),void k();if(c&&"z"===String(d).toLowerCase()&&!l.shiftKey){if(!m)return;return l.preventDefault(),l.stopPropagation(),y(),void h()}if(c&&("z"===String(d).toLowerCase()&&l.shiftKey||"y"===String(d).toLowerCase())){if(!g)return;return l.preventDefault(),l.stopPropagation(),y(),void b()}}else if(!_){if(c&&"z"===String(d).toLowerCase()&&!l.shiftKey){if(!m)return;return l.preventDefault(),y(),void h()}if(c&&("z"===String(d).toLowerCase()&&l.shiftKey||"y"===String(d).toLowerCase())){if(!g)return;return l.preventDefault(),y(),void b()}if(c&&"d"===String(d).toLowerCase()){if(!r?.id||"add"===r.type)return;l.preventDefault();const e=za(o,a,r.id);if(!e)return;return i(e.nextMap,e.nextRootOrder,"add"),void s({id:e.newId,data:e.selectionData,type:"edit"})}if(c&&"c"===String(d).toLowerCase()){if(!r?.id||"add"===r.type)return;l.preventDefault();const e=Ea(o,a,r.id);return void(e&&(Da.tree=e))}if(c&&"v"===String(d).toLowerCase()){if(!Da.tree)return;l.preventDefault();const e=r?.id&&o[r.id]?r.id:null,t=Wa(o,a,Da.tree,e);if(!t)return;return i(t.nextMap,t.nextRootOrder,"add"),void s({id:t.newId,data:t.selectionData,type:"edit"})}return"Escape"===d?(l.preventDefault(),$(!1),void s(null)):"?"===d||l.shiftKey&&"Slash"===l.code?(l.preventDefault(),void $(!0)):void(n(l)&&k())}};return document.addEventListener("keydown",l,!0),()=>document.removeEventListener("keydown",l,!0)},[o,a,r,i,s,m,g,h,b,y,f,L]);const P=()=>{const e=document.getElementsByClassName("block-drag-label-content");Array.from(e).forEach(e=>{e.children[0]&&(e.children[0].style.visibility="hidden")})},M=()=>{const e=document.getElementsByClassName("block-content-drag-label-content");Array.from(e).forEach(e=>{e.children[0]&&(e.children[0].style.visibility="hidden")})},F=()=>{document.querySelectorAll(".block-empty-content").forEach(e=>{e.style.border=""})},D=()=>{document.querySelectorAll('[data-type="empty-block"]').forEach(e=>{e.style.border=""})},E=()=>{document.querySelectorAll('[data-drag-hovered="true"]').forEach(e=>{delete e.dataset.dragHovered})},z=e=>{const t=e?.closest?.(".block-item[data-block-id], .block[data-block-id]")||null;document.querySelectorAll('[data-drag-hovered="true"]').forEach(e=>{e!==t&&delete e.dataset.dragHovered}),t&&(t.dataset.dragHovered="true")},O=()=>{P(),M(),F(),D(),E()},W=e.useCallback(e=>{e.preventDefault(),e.stopPropagation();const t=ds(e.target),{type:n}=t.dataset||{};switch(n){case"empty-block":P(),M(),E(),t.style.border="2px dashed var(--ee-drop-target-outline)";break;case"drag-over-column":{M(),z(t);const e=t.dataset.index,n=document.getElementsByClassName("block-drag-label-content");Array.from(n).forEach(t=>{const n=Number(t.dataset.index)===Number(e),o=t.querySelector(".block-move-top"),a=t.querySelector(".block-move-bottom");o&&(o.style.visibility=n?"visible":"hidden"),a&&(a.style.visibility=n?"visible":"hidden")});break}case"block-item-move":{P(),z(t);const e=t.dataset.dropKey,n=document.getElementsByClassName("block-content-drag-label-content");Array.from(n).forEach(t=>{t.dataset.dropKey===e?t.children[0].style.visibility="visible":t.children[0].style.visibility="hidden"});break}case"empty-block-item":P(),M(),z(t),t.classList?.contains("block-empty-content")&&(t.style.border="2px dashed var(--ee-drop-target-outline)");break;default:P(),M(),E()}},[]),H=(e,t)=>{const{blockMap:n,removedId:o}=ie(e,t.containerId,t.cellIndex,t.itemIndex);return{result:n,removedId:o}},K=(e,t,n,o)=>{const a=e[t];if(!a||a.cells[n].childrenIds.length>0)return e;const l=X(o("drag_block_here"));return{...e,[l.id]:l,[t]:{...a,cells:a.cells.map((e,t)=>t===n?{...e,childrenIds:[l.id]}:e)}}},V=(e,t,n)=>{if(!t||!n)return!1;if(t===n)return!0;const o=t=>{const a=e[t];if(!a||"column"!==a.key)return!1;for(const e of a.cells||[])for(const t of e.childrenIds||[]){if(t===n)return!0;if(o(t))return!0}return!1};return o(t)};return l.jsxs(l.Fragment,{children:[l.jsx(cs,{open:B,onClose:()=>$(!1)}),l.jsxs("div",{className:"email-editor"+(p?" ee-high-contrast":""),onDragOver:W,onDrop:e=>{e.preventDefault(),e.stopPropagation();const n=ds(e.target),{type:l}=n.dataset||{};E(),F(),D(),c(!1);const d="undefined"!=typeof window?window.__eeDragItemData:null,u=()=>{"undefined"!=typeof window&&(window.__eeDragItemData=null,window.__eeDragSource=null)},p="add"===r?.type&&null!=r?.data,m=p||d?"add":r?.type,g=p?function(e){if(!e||"object"!=typeof e)return e;const t="column"===e.key&&Array.isArray(e.children)&&e.children.length>0;if("column"===e.key&&Array.isArray(e.cells)&&e.cells.length>0&&!t){const t=de(e,e.blockMap||e.blockSnapshotMap||{});if(t?.blockMap&&t.rootId){const e=Q(t.blockMap,[t.rootId])[0];if(e)return U(e)}}return U(e)}(r.data):d?U(d):r?.data??null;if(g){switch(l){case"empty-block":{const e="column"===g.key?g:T(g),t=R(e),{newBlockMap:n,rootId:a}=ue(o,t);if(!a)return void u();i(n,[a],"add"),s({id:a,data:n[a],type:"edit"}),"add"===m&&"column"===n[a]?.key&&Va(n[a])===qa&&Xa(a);break}case"empty-block-item":{F();const e=n.dataset.containerId,l=Number(n.dataset.cellIndex),c=Number(n.dataset.itemIndex);if(!e)return void u();if("column"===g.key||"add"!==m&&r?.id&&"column"===o[r.id]?.key)return t.message.warning(L("section_nest_not_allowed")),u(),void O();let d={...o};if("add"===m){const t=U(g),n=R(t),{newBlockMap:o,rootId:r}=ue(d,n);if(!r)return void u();d=le(o,e,l,c,r),i(d,a,"add"),s({id:r,data:d[r],type:"edit"})}else{const t=r.id;if(V(d,t,e))return u(),void O();const n=te(d,a,t);if(!n)return void u();{const{result:t,removedId:o}=H(d,n);d=t?K(t,n.containerId,n.cellIndex,L):d,o&&(d=le(d,e,l,c,o))}i(d,a,"move"),s({...r,data:d[t]??r.data,type:"edit"})}break}case"drag-over-column":{const e=Number(n.dataset.index);let t,l=[...a],c={...o};if("add"===m){const n=U(g);if("column"===n.key){const o=R(n),{newBlockMap:a,rootId:i}=ue(c,o);if(!i)return void u();c=a,l.splice(e,0,i),t={id:i,data:c[i],type:"edit"}}else{const o=e>=l.length?l[l.length-1]:l[e],a=c[o];if(!a||"column"!==a.key)return void u();const{newBlockMap:i,rootId:r}=ue(c,n);if(!r)return void u();c=i;const s=0,d=c[o]?.cells?.[s],p=d?.childrenIds?.[0],m=p?c[p]:null;if("empty"===m?.key)c=le(c,o,s,0,r);else{c=re(c,o,s,d?.childrenIds?.length??0,r)}t={id:r,data:c[r],type:"edit"}}}else{const n=r.id,o=a.indexOf(n);if(-1===o)return void u();l.splice(o,1),l.splice(e>o?e-1:e,0,n),t={...r,type:"edit"}}i(c,l,"move"),s(t),"add"===m&&"column"===t?.data?.key&&Va(t.data)===qa&&Xa(t.id),setTimeout(()=>{const e=document.getElementsByClassName("block-drag-label-content");Array.from(e).forEach(e=>{const t=e.querySelector(".block-move-top");t&&(t.style.visibility="hidden")})},30);break}case"block-item-move":{const e=n.dataset.dropKey;if(!e)return void u();const[l,c,d]=e.split(":"),p=Number(c),h=Number(d);let b,y={...o};if("add"===m){if("column"===g.key)return t.message.warning(L("section_nest_not_allowed")),u(),void O();const e=U(g),n=R(e),{newBlockMap:o,rootId:a}=ue(y,n);if(!a)return void u();y=re(o,l,p,h,a),b={id:a,data:y[a],type:"edit"}}else{const e=r.id;if("column"===y[e]?.key)return t.message.warning(L("section_nest_not_allowed")),u(),void O();if(V(y,e,l))return u(),void O();const n=te(y,a,e);if(!n)return void u();const{blockMap:o,removedId:i}=ie(y,n.containerId,n.cellIndex,n.itemIndex);y=o;const s=y[n.containerId];if(s&&0===s.cells[n.cellIndex].childrenIds.length){const e=X(L("drag_block_here"));y={...y,[e.id]:e,[n.containerId]:{...s,cells:s.cells.map((t,o)=>o===n.cellIndex?{...t,childrenIds:[e.id]}:t)}}}let c=h;n.containerId===l&&n.cellIndex===p&&n.itemIndex<h&&(c=h-1),y=re(y,l,p,c,i),b={...r,type:"edit"}}i(y,a,"move"),s(b),setTimeout(()=>{const e=document.getElementsByClassName("block-content-drag-label-content");Array.from(e).forEach(e=>{e.children[0]&&(e.children[0].style.visibility="hidden")})},30);break}}u()}else u()},onDragLeave:e=>{const t=e.currentTarget,n=e.relatedTarget,o=ds(e.target);setTimeout(()=>{if(t&&t.contains(n))switch(o?.dataset?.type){case"empty-block":o.style.border="";break;case"empty-block-item":o?.classList?.contains("block-empty-content")&&(o.style.border="")}else O()},50)},children:[l.jsx(rs,{templateName:_,onTemplateNameChange:k,onBack:x,onSaveTemplate:v,onSaveTemplateIntent:w,onSendTest:S,onSendTestIntent:j,saveStatusDetail:C,onExit:N,onPreview:I,hideOverflowExportActions:A,onShowShortcuts:()=>$(!0)}),l.jsxs("div",{className:"email-editor-main",onClick:e=>{e.preventDefault(),e.stopPropagation(),s(null)},children:[l.jsx(ns,{clearStyles:O}),l.jsx(gl,{clearStyles:O}),l.jsx(Br,{clearStyles:O})]})]})]})},ps="markopolo-email-editor:undo:";const ms=e=>Array.isArray(e)?e.map(e=>e&&"object"==typeof e?{...e,children:ms(e.children)}:e):e&&"object"==typeof e?Object.values(e).map(e=>e&&"object"==typeof e?{...e,children:ms(e.children)}:e):[],gs=e=>{const t={},n=(e,o=[])=>{Array.isArray(e)&&e.forEach(e=>{if(!e||"object"!=typeof e)return;const a={blockId:e.id??null,key:e.key??null,containerType:"column"===e.key?e.containerType??"none":null},l=[...o,a];if("text"===e.key&&"dynamic"===e.contentType){const n="string"==typeof e.dynamicPrompt?e.dynamicPrompt.trim():"",o="string"==typeof e.dynamicSelectedContent?e.dynamicSelectedContent.trim():"";if(!n&&!o)return;t[e.id]={blockId:e.id,path:l,key:e.key,type:e.type||"p",selectedContent:o,options:Array.isArray(e.dynamicOptions)?e.dynamicOptions:[],prompt:n,variable:e.dynamicVariable??"",language:"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"}}Array.isArray(e.children)&&n(e.children,l)})};return n(e,[]),t},hs=e=>Array.isArray(e)?e.map(e=>{if(!e||"object"!=typeof e)return e;const{dynamicPrompt:t,dynamicOptions:n,dynamicSelectedContent:o,dynamicVariable:a,dynamicAiLanguage:l,staticTextBeforeAi:i,children:r,...s}=e;return{...s,children:hs(r)}}):e,bs=e.forwardRef(({defaultBlockList:t,defaultBodySettings:n,aiContentRefs:o,language:a="en",customLanguageLibraries:i,templateData:r,variableDefinitions:s,apiConfig:c={},aiEnabled:d=!0,saveState:u="saved",onChange:p,undoPersistenceKey:m=null,onShortcutSave:g,onSaveBlockAsGlobal:h,templateName:b="",onTemplateNameChange:y,onBack:f,onSaveTemplate:_,onSaveTemplateIntent:k,onSendTest:x,onSendTestIntent:v,saveStatusDetail:w,onExit:S,onPreview:j,hideOverflowExportActions:C=!1,universals:N=[]},I)=>{const[A,L]=e.useState(()=>{if("undefined"==typeof window)return!1;try{return"1"===window.localStorage.getItem("ee_high_contrast_editor")}catch{return!1}});e.useEffect(()=>{if("undefined"!=typeof window)try{window.localStorage.setItem("ee_high_contrast_editor",A?"1":"0")}catch{}},[A]),e.useEffect(()=>{var e;yt=(e=s)&&"object"==typeof e?e:bt,Ct()},[s]);const T=e.useMemo(()=>uo(c),[c]),[B,$]=e.useState([]),[R,P]=e.useState(!1),F=e.useCallback(async()=>{if(T?.companyId){P(!0);try{const e=await async function(e,t={}){const n=go(e),o=e?.companyId;if(!n||!o)return[];const a=new URLSearchParams({companyId:String(o),page:String(t.page??1),limit:String(t.limit??100)});null!=t.blockType&&String(t.blockType).trim()&&a.set("blockType",String(t.blockType)),"boolean"==typeof t.isActive&&a.set("isActive",String(t.isActive));const l=await fetch(`${n}?${a.toString()}`,{method:"GET",headers:{...e?.headers||{}}}),i=await l.text();let r;try{r=i?JSON.parse(i):{}}catch{return[]}if(!l.ok)return console.warn("[universal-email-blocks]",l.status,r),[];const s=r?.data;return Array.isArray(s)?s.map(bo).filter(Boolean):[]}(T,{limit:100});$(Array.isArray(e)?e:[])}catch(e){console.warn("[EmailEditor] universal email blocks fetch",e)}finally{P(!1)}}else $([])},[T]);e.useEffect(()=>{F()},[F]);const U=e.useMemo(()=>{const e=B??[],t=N??[];if(!T?.companyId)return t;const n=new Set;return e.filter(e=>{const t=String(e?.resourceId??e?.id??"");return!(!t||n.has(t))&&(n.add(t),!0)})},[T?.companyId,B,N]),D=e.useCallback(async e=>{T?.companyId&&(await async function(e,{name:t,block:n}){const o=go(e),a=e?.companyId;if(!o||!a)throw new Error("Universal blocks API: missing endpoint or companyId");const l=po(t,n,a),i=await fetch(o,{method:"POST",headers:ho(e),body:JSON.stringify(l)}),r=await i.text();let s;try{s=r?JSON.parse(r):{}}catch{s={message:r}}if(!i.ok)throw new Error(mo(s,i.status));return s?.data??s}(T,e),await F()),"function"==typeof h&&await Promise.resolve(h(e))},[T,h,F]),E=e.useCallback(async e=>{T?.companyId&&(await async function(e,t){const n=go(e),o=e?.companyId;if(!n||!o||!t)throw new Error("Universal blocks API: missing endpoint, companyId, or id");const a=new URLSearchParams({companyId:String(o)}),l=`${n}/${encodeURIComponent(String(t))}?${a}`,i=await fetch(l,{method:"DELETE",headers:{...e?.headers||{}}});if(204===i.status)return!0;if(!i.ok){const e=await i.text();let t;try{t=e?JSON.parse(e):{}}catch{t={message:e}}throw new Error(mo(t,i.status))}return!0}(T,e),await F())},[T,F]),z=t&&!Array.isArray(t)&&"object"==typeof t?t:null,O=z?z.blocks??z.blockList??[]:t,H=(K=O,Array.isArray(K)?K.map(e=>e&&"object"==typeof e?{...e,children:ms(e.children)}:e):K&&"object"==typeof K?Object.values(K).map(e=>e&&"object"==typeof e?{...e,children:ms(e.children)}:e):[]);var K;const V=o??z?.aiContentRefs??{},q=n??z?.bodySettings??Be.bodySettings,J=r??Be.templateData,Y=((e,t)=>{if(!Array.isArray(e))return e;const n=t?.content?.products;if(!Array.isArray(n)||0===n.length)return e;const o=t?.content?.primaryProductId,a=(o?n.find(e=>e?.id===o):n[0])??n[0]??Yl[0]??null;if(!a)return e;const l=n.filter(e=>e?.id!==a.id),i=e=>{if(!e||"object"!=typeof e)return e;const t=Array.isArray(e.children)?e.children.map(i):e.children;if("column"!==e.key||"product"!==e.containerType)return{...e,children:t};const n="additional"===e.productRole?"additional":"main",o=Math.max(Array.isArray(t)?t.length:0,Array.isArray(e.columnProducts)?e.columnProducts.length:0,1),r=Array.from({length:o},(e,t)=>"main"===n||0===l.length?a:l[t%l.length]);return{...e,children:t,columnProducts:r}};return e.map(i)})(H,J),X=function(e,t={}){const n=Array.isArray(e)?e:e&&"object"==typeof e?Object.values(e):null;if(!Array.isArray(n))return e;const o=n.map(e=>lo(e,t));return o.forEach(M),o}(Y,V),{blockMap:Q,rootOrder:te}=Z(X),ne=W(Q,J),oe=e.useMemo(()=>function(e){if("undefined"==typeof sessionStorage||!e)return null;try{const t=sessionStorage.getItem(ps+e);if(!t)return null;const n=JSON.parse(t);return n&&"object"==typeof n?{undoStack:Array.isArray(n.undoStack)?n.undoStack:[],redoStack:Array.isArray(n.redoStack)?n.redoStack:[]}:null}catch{return null}}(m),[m]),[ae,le]=e.useReducer(Ee,{...Be,blockMap:ne,rootOrder:te,blockList:X,bodySettings:{...q,contentWidth:G(q?.contentWidth)},languageLibraries:i,templateData:J,undoStack:oe?.undoStack??[],redoStack:oe?.redoStack??[]}),ie=e.useRef(null);e.useEffect(()=>{m&&function(e,t,n){if("undefined"!=typeof sessionStorage&&e)try{sessionStorage.setItem(ps+e,JSON.stringify({undoStack:t,redoStack:n}))}catch{}}(m,ae.undoStack,ae.redoStack)},[m,ae.undoStack,ae.redoStack]),e.useEffect(()=>{le(Ie(r??null,{skipUndo:!0}))},[r]);const[re,se]=e.useState([]);e.useEffect(()=>{if("undefined"==typeof document)return;const e=ae.blockList??[],t="ee-font-runtime-imports",n=document.getElementById(t)||Object.assign(document.createElement("style"),{id:t}),o=rn(e,ae.bodySettings,ae.templateData);n.textContent=o||"",n.parentNode||document.head.appendChild(n)},[ae.blockList,ae.bodySettings,ae.templateData]);const ce=e.useMemo(()=>new Set(re),[re]),de=e.useCallback(e=>(Array.isArray(e)?e:[]).filter(e=>!ce.has(xo(e))),[ce]),ue=e.useCallback(e=>{const t=xo(e);t&&se(e=>e.includes(t)?e:[...e,t])},[]),he=e.useCallback(()=>{const e=ae.blockList??[];return{blockList:hs(e),bodySettings:ae.bodySettings??null,aiContentRefs:gs(e),language:vo(e)}},[ae.blockList,ae.bodySettings]),ye=e.useMemo(()=>de(Do({blockList:ae.blockList??[],bodySettings:ae.bodySettings??null,aiContentRefs:gs(ae.blockList??[])})).filter(e=>e?.blockId&&("warning"===e.severity||"error"===e.severity||"info"===e.severity)).reduce((e,t)=>{const n=t.blockId,o=e[n]??{severity:t.severity,warningCount:0,errorCount:0,infoCount:0,totalCount:0,messages:[],issues:[]};return"error"===t.severity&&(o.errorCount+=1),"warning"===t.severity&&(o.warningCount+=1),"info"===t.severity&&(o.infoCount+=1),o.totalCount+=1,o.severity=o.errorCount>0?"error":o.warningCount>0?"warning":"info",o.messages.push(t.message),o.issues.push(t),e[n]=o,e},{}),[ae.blockList,ae.bodySettings,de]);e.useImperativeHandle(I,()=>({blockList:hs(ae.blockList??[]),bodySettings:ae.bodySettings,aiContentRefs:gs(ae.blockList??[]),actionType:ae.actionType,exportJson:he,filterIgnoredValidationIssues:de,ignoreValidationIssue:ue,focusBlock:e=>{if(!e||!ae.blockMap?.[e])return!1;const t=ae.blockMap[e],n="column"===t?.key?ee(e,ae.blockMap)??t:t;return le(Ne({id:e,data:n,type:"edit"})),le(Ce("edit")),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const t="function"==typeof window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/([ #;?%&,.+*~':\x22!^$\x5b\x5d()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${t}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}),!0},exportHtml:()=>eo({bodySettings:ae.bodySettings,blockList:ae.blockList,templateData:ae.templateData})}),[ae.blockList,ae.blockMap,ae.bodySettings,ae.actionType,ae.templateData,he,de,ue]),e.useEffect(()=>{"function"==typeof p&&"firstRender"!==ae.actionType&&p({blockList:hs(ae.blockList??[]),bodySettings:ae.bodySettings??null,aiContentRefs:gs(ae.blockList??[]),actionType:ae.actionType})},[ae.blockList,ae.bodySettings,ae.actionType,p]);const we=e.useCallback(e=>{le((e=>({type:ge,isDragStart:e}))(e))},[]),Ae=e.useCallback((e,t,n)=>{t&&le(Ce(t)),le(((e,t={})=>({type:fe,bodySettings:e,skipUndo:Boolean(t.skipUndo)}))(e,n||{}))},[]),Le=e.useCallback((e,t,n,o)=>{n&&le(Ce(n)),le(((e,t,n={})=>({type:me,blockMap:e,rootOrder:t,skipUndo:Boolean(n.skipUndo)}))(e,t,o||{}))},[]),Te=e.useCallback((e,t,n)=>{t&&le(Ce(t)),le(((e,t={})=>({type:pe,blockList:e,skipUndo:Boolean(t.skipUndo)}))(e,n||{}))},[]),Re=e.useCallback(e=>{le((e=>({type:be,previewMode:e}))(e))},[]),Pe=e.useCallback(e=>{le(Ne(e))},[]),Me=e.useCallback(e=>{le((e=>({type:_e,selectionRange:e}))(e))},[]),Fe=e.useCallback(e=>{le((e=>({type:ke,textRange:e}))(e))},[]),Ue=e.useCallback(e=>{le(Ce(e))},[]),De=e.useCallback(e=>{le((e=>({type:xe,language:e}))(e))},[]),ze=e.useCallback(e=>{le((e=>({type:ve,languageLibraries:e}))(e))},[]),Oe=e.useCallback((e,t)=>{le(Ie(e,t||{}))},[]),We=e.useCallback(()=>{try{ie.current?.()}catch{}},[]),He=e.useCallback(e=>(ie.current=e,()=>{ie.current===e&&(ie.current=null)}),[]),Ke=e.useCallback(()=>{We(),le({type:Se})},[We]),Ve=e.useCallback(()=>{We(),le({type:je})},[We]),Ge=e.useMemo(()=>({blockMap:ae.blockMap,rootOrder:ae.rootOrder,blockList:ae.blockList,actionType:ae.actionType,previewMode:ae.previewMode,currentItem:ae.currentItem,bodySettings:ae.bodySettings,isDragStart:ae.isDragStart,selectionRange:ae.selectionRange,textRange:ae.textRange,language:ae.language,languageLibraries:ae.languageLibraries,templateData:ae.templateData,apiConfig:T,validationMarkers:ye,ignoreValidationIssue:ue,aiEnabled:d,saveState:u,highContrastEditor:A,canUndo:ae.undoStack.length>0,canRedo:ae.redoStack.length>0,undo:Ke,redo:Ve,flushPendingRichText:We,registerRichTextFlush:He,onShortcutSave:g,onSaveBlockAsGlobal:D,templateName:b,onTemplateNameChange:y,onBack:f,onSaveTemplate:_,onSaveTemplateIntent:k,onSendTest:x,onSendTestIntent:v,saveStatusDetail:w,onExit:S,onPreview:j,hideOverflowExportActions:C,universals:U,universalsLoading:R,deleteUniversalEmailBlock:T?.companyId?E:void 0,setIsDragStart:we,setBodySettings:Ae,setBlocks:Le,setBlockList:Te,setPreviewMode:Re,setCurrentItem:Pe,setSelectionRange:Me,setTextRange:Fe,setActionType:Ue,setLanguage:De,setLanguageLibraries:ze,setTemplateData:Oe,setHighContrastEditor:L}),[ae.blockMap,ae.rootOrder,ae.blockList,ae.actionType,ae.previewMode,ae.currentItem,ae.bodySettings,ae.isDragStart,ae.selectionRange,ae.textRange,ae.language,ae.languageLibraries,ae.templateData,ae.undoStack.length,ae.redoStack.length,T,ye,ue,d,u,A,Ke,Ve,We,He,g,D,b,y,f,_,k,x,v,w,S,j,C,U,R,E,we,Ae,Le,Te,Re,Pe,Me,Fe,Ue,De,ze,Oe,L]);return l.jsx($e.Provider,{value:Ge,children:l.jsx(us,{language:a})})});const ys=["Product","Discount"],fs=["text","image","button"];function _s(e,t,n,o,a,l,i){if("column"===e.key&&e.containerType){const t=function(e){const t=e.toLowerCase();return"product"===t?"Product":"discount"===t?"Discount":"None"}(e.containerType),n=e.id??null;let r=o;"Product"===t&&(i.productIndex++,r=i.productIndex);for(const o of e.children??[])_s(o,t,n,r,a,l,i);return}if("content"===e.key){for(const r of e.children??[])_s(r,t,n,o,a,l,i);return}const r="dynamic"===e.contentType,s=ys.includes(t)&&fs.includes(e.key);if((r||s)&&n){let i=a.find(e=>e.containerId===n);i||(i={containerId:n,containerType:t,blocks:[]},a.push(i));const c=e.id?l[e.id]:void 0,d=function(e){return"image"===e.key?e.src??"":"button"===e.key?e.linkURL??"":e.text??""}(e);let u="";"Product"===t?u=function(e,t){const n=`product ${t}`;return e.includes("{{ProductImage}}")?`This block is meant for displaying the ${n} image`:e.includes("{{ProductName}}")?`This block is meant for displaying the ${n} name`:e.includes("{{ProductOldPrice}}")||e.includes("{{ProductNewPrice}}")?`This block is meant for displaying the ${n} original and discounted price`:e.includes("{{ProductPrice}}")||e.includes("{{ProductCurrency}}")?`This block is meant for displaying the ${n} price and currency`:e.includes("{{ProductDescription}}")?`This block is meant for displaying the ${n} description`:e.includes("{{ProductLink}}")?`This block is meant for displaying the ${n} link`:`This block is meant for displaying ${n} content`}(d,o):"Discount"===t&&(u=function(e){const t=[];return e.includes("{{DiscountValue}}")&&t.push("the discount value (e.g. 20% or $10)"),e.includes("{{DiscountCode}}")&&t.push("the discount/promo code"),e.includes("{{ValidUntil}}")&&t.push("the discount expiry date"),0===t.length?"This block is meant for displaying discount/offer information":`This block is meant for displaying ${t.join(", ")}`}(d));const p=c?.prompt||u,m=s&&!r;i.blocks.push({id:e.id??"",contentType:m||"dynamic"===e.contentType?"dynamic":"static",value:m?"":d,ai:{prompt:p,selectedSampleAiContent:m?"":c?.selectedContent??d}})}if(e.children)for(const r of e.children)_s(r,t,n,o,a,l,i)}const ks={text:"text",image:"src",button:"linkURL"};function xs(e,t){if(0===t.size)return!0;if(e.id&&t.has(e.id)){const n=t.get(e.id),o=ks[e.key];o&&(e[o]=n,t.delete(e.id))}if(e.children)for(const n of e.children)if(xs(n,t))return!0;return 0===t.size}var vs=Object.freeze({__proto__:null,jsonToHtml:function(e){return to(e)},normalizeJson:function(e){const t="string"==typeof e?JSON.parse(e):e,n=[],o=t.aiContentRefs||{},a={productIndex:0},l=t.blockList||[];for(const e of l)_s(e,"None",null,0,n,o,a);return{groups:n}},updateJsonWithMlContent:function(e,t){const n="string"==typeof e?JSON.parse(e):e,o=structuredClone(n),a=new Map;for(const e of t)e.variations.length>0&&a.set(e.nodeId,e.variations[0].value);const l=o.blockList||[];for(const e of l)if(xs(e,a))break;return o}});const ws=Object.freeze({keys:["content","catalogProducts","companyContext","brandContext","companyId"],description:"templateData drives placeholders, product columns, and menu/social sync. content.products + content.primaryProductId, when non-empty, override product column assignments on load. catalogProducts (optional array) is the KB/catalog list for the product picker and for newly added preset product blocks; it does not replace columnProducts in a saved template when content.products is empty. companyContext.navigation_links and companyContext.social_links sync into menu/social blocks; brandContext (including brand_color) resolves branding tokens and CTA/button fallback colors in HTML export."});exports.DEFAULT_EMAIL_TEMPLATE_ID=so,exports.DEFAULT_MARKOPOLO_API_BASE_V1=io,exports.DEFAULT_ML_GENERATION_API_BASE_V1=ro,exports.EmailEditor=bs,exports.TEMPLATE_DATA_SCHEMA=ws,exports.createDefaultTemplateData=function(e={}){const t={name:"",website:"",navigation_links:[],social_links:{}},n={brand_color:"#111111",logo_url:"",tagline:"",heroBanner:"",footerBanner:""},o=null;return{content:{...{products:[],primaryProductId:null},...e.content&&"object"==typeof e.content?e.content:{}},companyContext:{...t,...e.companyContext&&"object"==typeof e.companyContext?e.companyContext:{}},brandContext:{...n,..."string"==typeof e.brandColor&&e.brandColor.trim()?{brand_color:e.brandColor.trim()}:{},...e.brandContext&&"object"==typeof e.brandContext?e.brandContext:{}},companyId:null!=e.companyId?e.companyId:o}},exports.default=bs,exports.exportNormalizerToHtml=to,exports.exportTemplateJson=function(e,t={}){const{validate:n=!0}=t,o=e?.current;if(!o||"function"!=typeof o.exportJson)throw new Error("exportTemplateJson: ref must be attached to EmailEditor (expected ref.current.exportJson to be a function).");const a=o.exportJson();if(!a||"object"!=typeof a)throw new Error("exportTemplateJson: exportJson() returned an invalid payload.");return{payload:a,issues:n?Do({blockList:a.blockList,bodySettings:a.bodySettings,aiContentRefs:a.aiContentRefs}):[]}},exports.exportTemplateJsonAsync=async function(e,t={}){const{validate:n=!0,checkImages:o=!0,imageProbe:a}=t,l=e?.current;if(!l||"function"!=typeof l.exportJson)throw new Error("exportTemplateJsonAsync: ref must be attached to EmailEditor (expected ref.current.exportJson to be a function).");const i=l.exportJson();if(!i||"object"!=typeof i)throw new Error("exportTemplateJsonAsync: exportJson() returned an invalid payload.");return n?{payload:i,issues:o?await Vo({blockList:i.blockList,bodySettings:i.bodySettings,aiContentRefs:i.aiContentRefs},a):Do({blockList:i.blockList,bodySettings:i.bodySettings,aiContentRefs:i.aiContentRefs})}:{payload:i,issues:[]}},exports.mergeMarkopoloApiConfig=uo,exports.utils=vs,exports.validateExportPayload=Do,exports.validateExportPayloadComplete=Vo,exports.validateImageUrlsReachable=Ko,exports.validateTemplateDataShape=function(e){const t=[];if(null==e||"object"!=typeof e)return{ok:!1,warnings:["templateData must be a non-null object"]};const n=e;if(null!=n.content&&"object"!=typeof n.content)t.push("templateData.content should be an object when provided");else if(n.content&&"object"==typeof n.content){const e=n.content;null==e.products||Array.isArray(e.products)||t.push("templateData.content.products should be an array when provided")}if(null==n.catalogProducts||Array.isArray(n.catalogProducts)||t.push("templateData.catalogProducts should be an array when provided"),null!=n.companyContext&&"object"!=typeof n.companyContext&&t.push("templateData.companyContext should be an object when provided"),null!=n.brandContext&&"object"!=typeof n.brandContext&&t.push("templateData.brandContext should be an object when provided"),n.brandContext&&"object"==typeof n.brandContext){const e=n.brandContext;null!=e.brand_color&&"string"!=typeof e.brand_color&&t.push("templateData.brandContext.brand_color should be a string when provided")}return{ok:0===t.length,warnings:t}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("antd"),n=require("@fortawesome/react-fontawesome"),o=require("@fortawesome/free-solid-svg-icons"),a=require("framer-motion"),l=require("react/jsx-runtime"),i=require("react-dom"),r=require("react-color");function s(e){const t=String(e??"").trim();return/^(?:javascript|vbscript)\s*:/i.test(t)||/^data\s*:/i.test(t)}function c(e){let t=String(e??"").trim();if(!t)return"";if(s(t))return"";for(let e=0;e<t.length;e++){const n=t.charCodeAt(e),o=t[e];if(n<32||"<"===o||">"===o||'"'===o)return""}return t}function d(e){const t=String(e??"").trim().match(/^https?:\/\/(.+)/is);return!!t&&/^https?:\/\//i.test(t[1])}function u(e,t={}){const{allowMailtoTel:n=!0}=t,o=String(e??"").trim();if(!o)return null;if(s(o))return null;if(d(o))return null;if(n&&(/^mailto:/i.test(o)||/^tel:/i.test(o)))return o;const a=/^https?:\/\//i.test(o)?o:`https://${o.replace(/^\/+/,"")}`;return p(a,!1,t)?a:null}function p(e,t=!1,n={}){return null==m(e,t,n)}function m(e,t=!1,n={}){const{allowMailtoTel:o=!0}=n;if(null==e||""===String(e).trim())return t?null:"empty";const a=String(e).trim();if(s(a))return"blocked_scheme";if(d(a))return"duplicate_protocol";let l;if(/^https?:\/\//i.test(a)){const e=a.replace(/^https?:\/\//i,"");if(/^https?:\/\//i.test(e))return"duplicate_protocol";l=a}else l=o&&/^mailto:/i.test(a)||o&&/^tel:/i.test(a)?a:`https://${a}`;try{const e=new URL(l);return"http:"===e.protocol||"https:"===e.protocol?function(e){const t=String(e??"").trim().toLowerCase();return""!==t&&"http"!==t&&"https"!==t&&("localhost"===t||!!t.includes(":")||!!/^(?:\d{1,3}\.){3}\d{1,3}$/.test(t)||t.includes("."))}(e.hostname)?null:"missing_hostname_dot":o&&"mailto:"===e.protocol||o&&"tel:"===e.protocol?null:"invalid_protocol"}catch{return"invalid_url"}}function g(e){const t=String(e?.image||"").toLowerCase(),n=String(e?.title||"").toLowerCase().trim();return t.includes("/tc-x.svg")||t.includes("/brand-x.svg")||t.includes("/icons/x.svg")||t.includes("simple-icons")&&t.includes("/x.svg")||"x"===n||"twitter"===n}const h=["default","white","black","gray"];function b(e){const t="string"==typeof e?e:"gray";return h.includes(t)?t:"default"}function y(e){if(!e||"object"!=typeof e)return{};const{padding:t,paddingTop:n,paddingRight:o,paddingBottom:a,paddingLeft:l,...i}=e;return i}const f={small:21,medium:24,large:32},_="https://unpkg.com/@tabler/icons@3.24.0/icons/outline",k={facebook:"brand-facebook",x:"brand-x",instagram:"brand-instagram",linkedin:"brand-linkedin",tiktok:"brand-tiktok",youtube:"brand-youtube",pinterest:"brand-pinterest"};function x(e){if(!e)return null;const t=k[e];return t?`${_}/${t}.svg`:null}const v={left:"flex-start",center:"center",right:"flex-end",justify:"space-between"};function w(e){const t=e&&"object"==typeof e?{...e}:{},n=t.columnGapPx,o="number"==typeof n&&Number.isFinite(n)&&n>=0?n:8;delete t.columnGapPx;const a=t.textAlign||"center";delete t.textAlign;const l=v[a]||v.left;return{...t,display:"flex",width:"100%",maxWidth:"100%",boxSizing:"border-box",flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:l,columnGap:o,rowGap:0}}function S(e){if(!e)return null;if(g(e))return"x";const t=String(e.image||"").toLowerCase(),n=String(e.title||"").toLowerCase();return t.includes("facebook")||n.includes("facebook")?"facebook":t.includes("instagram")||n.includes("instagram")?"instagram":t.includes("linkedin")||n.includes("linkedin")?"linkedin":t.includes("tiktok")||n.includes("tiktok")?"tiktok":t.includes("youtube")||n.includes("youtube")?"youtube":t.includes("pinterest")||n.includes("pinterest")?"pinterest":null}const j="https://s.magecdn.com/social";const C={facebook:"tc-facebook.svg",x:"tc-x.svg",instagram:"tc-instagram.svg",linkedin:"tc-linkedin.svg",tiktok:"tc-tiktok.svg",youtube:"tc-youtube.svg",pinterest:"tc-pinterest.svg"};function N(e){const t=String(e||"").toLowerCase();return x("twitter"===t?"x":t)}function I(e){const t=e?.iconSize;if(t&&null!=f[t])return f[t];const n=Number(e?.imageWidth);return Number.isFinite(n)&&n>0?Math.round(n):f.medium}function A(e){const t=function(e){switch(e){case"white":return"brightness(0) invert(1)";case"black":return"brightness(0)";case"gray":return"brightness(0) opacity(0.55)";default:return""}}(e);return t?{filter:t}:{}}function L(e,t,n){const o=Number(n)||f.medium,a={width:o,height:o,objectFit:"contain",display:"block",verticalAlign:"middle",flexShrink:0},l=t&&"default"!==t?t:"default",i=String(e?.image||"").trim(),r=function(e){return x(S(e))}(e),s=function(e){const t=S(e);if(!t)return null;const n=C[t];return n?`${j}/${n}`:null}(e);if(i&&!function(e){const t=String(e||"").trim().toLowerCase();return!(!t||!t.startsWith(String(j).toLowerCase())&&!t.startsWith(String(_).toLowerCase())&&!t.includes("unpkg.com/@tabler/icons"))}(i))return{src:i,style:a};if("default"===l)return s?{src:s,style:a}:{src:i,style:a};if(r){if("white"===l)return{src:r,style:{...a,filter:"brightness(0) invert(1)"}};if("gray"===l)return{src:r,style:{...a,filter:"brightness(0) opacity(0.55)"}};if("black"===l)return{src:r,style:a}}return i?{src:i,style:{...a,...A(l)}}:{src:"",style:a}}function T(e,t,n){const{src:o,style:a}=L(e,t,n),l=Number(n)||f.medium,i=[`width:${l}px`,`height:${l}px`,"object-fit:contain","display:block","vertical-align:middle"];return a.filter&&i.push(`filter:${a.filter}`),null!=a.opacity&&i.push(`opacity:${a.opacity}`),{src:o,styleAttr:i.join(";")}}const B=e=>{const t=e.constructor===Array?[]:{};for(let n in e)e.hasOwnProperty(n)&&(e[n]&&"object"==typeof e[n]?(t[n]=e[n].constructor===Array?[]:{},t[n]=B(e[n])):t[n]=e[n]);return t},$=(e,t)=>{let n=null;return function(){n||(n=setTimeout(()=>{e.apply(this,arguments),n=null},t))}};function R(e,t={}){if(null==e||"string"!=typeof e)return e;const n=null!=t.fontSize?Number(t.fontSize):14,o=null!=t.fontFamily?String(t.fontFamily):"sans-serif",a=null!=t.color?String(t.color):"",l=["direction: ltr",`font-size: ${n}px`,`font-family: ${o}`];a&&l.push(`color: ${a}`);const i=t.fontWeight;null!=i&&""!==String(i).trim()&&l.push(`font-weight: ${i}`);const r=t.fontStretch;null!=r&&""!==String(r).trim()&&"normal"!==String(r).toLowerCase()&&l.push(`font-stretch: ${r}`);const s=t.textTransform;null!=s&&""!==String(s).trim()&&"none"!==String(s).toLowerCase()&&l.push(`text-transform: ${s}`);const c=l.join("; ");let d=function(e){if(null==e||"string"!=typeof e)return e;let t=e.replace(/\sstyle\s*=\s*["']([^"']*)["']/gi,(e,t)=>{const n=t.replace(/\s*font-size\s*:[^;]+;?/gi,"").replace(/\s*font-family\s*:[^;]+;?/gi,"").replace(/\s*color\s*:[^;]+;?/gi,"").replace(/^;\s*|;\s*$/g,"").trim();return n?` style="${n}"`:""}),n="";for(let e=0;e<20&&n!==t;e++)n=t,t=t.replace(/<font(\s[^>]*)?>([\s\S]*?)<\/font>/gi,"$2");return t}(e.trim());const u=/^<span(?:\s[^>]*)?>([\s\S]*)<\/span>$/i.exec(d.trim()),p=/^<div(?:\s[^>]*)?>([\s\S]*)<\/div>$/i.exec(d.trim());return u?d=u[1]:p&&(d=p[1]),`<span style="${c}">${d}</span>`}function P(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function M(e){if(!e||"object"!=typeof e)return;e.id||(e.id=P());const t=e.children;Array.isArray(t)&&t.forEach(M)}function F(e){if(!e||"object"!=typeof e)return;e.id=P();const t=e.children;Array.isArray(t)&&t.forEach(F)}function U(e){if(!e||"object"!=typeof e)return e;const t=B(e);return F(t),t}const D=[{key:"facebook",image:N("facebook"),title:"Facebook"},{key:"twitter",image:N("twitter"),title:"X"},{key:"instagram",image:N("instagram"),title:"Instagram"},{key:"linkedin",image:N("linkedin"),title:"LinkedIn"},{key:"tiktok",image:N("tiktok"),title:"TikTok"},{key:"youtube",image:N("youtube"),title:"YouTube"}];function E(e){const t=e?.socialPlatformKey;if(t&&"string"==typeof t&&D.some(e=>e.key===t))return t;if(g(e))return"twitter";const n=String(e?.title??"").trim().toLowerCase(),o=String(e?.image??"").trim();for(const e of D){if(n&&n===e.title.toLowerCase())return e.key;if("twitter"===e.key&&n&&("twitter"===n||"tweet"===n||"tw"===n))return"twitter";if(o&&o===e.image)return e.key}return null}function z(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:{},o=Array.isArray(e)?e:[],a=new Map,l=[];for(const e of o){const t=E(e);t?a.set(t,e):l.push(e)}return[...D.map(e=>{const t=a.get(e.key),o=null!=n[e.key]?c(String(n[e.key]).trim()):"",l=null!=t?.linkURL?String(t.linkURL).trim():"",i=l?c(l):"",r=o||i||"";return{id:t?.id??P(),image:t?.image||e.image,title:t?.title||e.title,linkURL:r,socialPlatformKey:e.key}}),...l]}const O=[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}];function W(e,t){if(!e)return e;const n=t&&"object"==typeof t?t:{},o=n?.companyContext?.navigation_links,a=Array.isArray(o)&&o.length>0,l=n?.companyContext?.social_links,i=Object.values(e).some(e=>e&&"menu"===e.key&&!1!==e.useNavigationLinks),r=Object.values(e).some(e=>e&&"social_link"===e.key),s=Object.values(e).some(e=>e&&"column"===e.key&&"footer"===e.containerType&&e.footerUnifiedLayout&&!1!==e.footerUseCompanySocial);if(!i&&!r&&!s)return e;const c={...e};let d=!1;return Object.keys(e).forEach(t=>{const n=e[t];if(n){if("menu"===n.key&&!1!==n.useNavigationLinks){const e=a?o.map(e=>function(e){if(!e||"object"!=typeof e)return{label:"Link",url:"#",target:"_self"};const t=e.label??e.name??e.title??"Link",n="string"==typeof t?t:null!=t?String(t):"Link",o=e.url??e.href??e.link??e.uri??"";return{label:n||"Link",url:("string"==typeof o?o.trim():null!=o?String(o).trim():"")||"#",target:"_blank"===e.target||"_self"===e.target?e.target:"_self"}}(e)):O;c[t]={...n,list:e},d=!0}if("social_link"===n.key&&!1!==n.useCompanySocialLinks){const e=z(n.list??[],l??{}),o={...n,list:e};JSON.stringify({...n,list:n.list??[]})!==JSON.stringify(o)&&(c[t]=o,d=!0)}if("column"===n.key&&"footer"===n.containerType&&n.footerUnifiedLayout&&!1!==n.footerUseCompanySocial){const e=function(e,t){return z(e,t)}(n.footerSocialList??[],l??{});JSON.stringify(n.footerSocialList??[])!==JSON.stringify(e)&&(c[t]={...n,footerSocialList:e},d=!0)}}}),d?c:e}const H=280,K=1200,V={EMAIL_WIDTH:"email_width",CUSTOM_PX:"custom_px",FULL_BLEED:"full_bleed"};function G(e){const t=Math.round(Number(e));return!Number.isFinite(t)||t<=0?600:Math.min(K,Math.max(H,t))}function q(e){const t=e?.contentWidthMode;return Object.values(V).includes(t)?t:V.EMAIL_WIDTH}function J(e){return G(e?.contentWidth)}function Y(e){return q(e)===V.FULL_BLEED}function X(e="Drag block here",t){return{id:t||P(),name:e,key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}}}function Z(e){const t={},n=[];function o(e){if(e&&"object"==typeof e)if(e.id||(e.id=P()),"column"===e.key){const n=(e.children||[]).map(e=>{e.id||(e.id=P());const t=[];return(e.children||[]).forEach(e=>{e.id||(e.id=P()),o(e),t.push(e.id)}),{id:e.id,width:e.width,styles:e.styles,childrenIds:t}}),{children:a,...l}=e;t[e.id]={...l,cells:n}}else t[e.id]=e}return(e||[]).forEach(e=>{e.id||(e.id=P()),o(e),n.push(e.id)}),{blockMap:t,rootOrder:n}}function Q(e,t){function n(t){const o=e[t];if(!o)return null;if("column"===o.key){const e=(o.cells||[]).map(e=>({id:e.id,name:"Content",key:"content",width:e.width,styles:e.styles,children:(e.childrenIds||[]).map(e=>n(e)).filter(Boolean)})),{cells:t,...a}=o;return{...a,children:e}}return{...o}}return(t||[]).map(e=>n(e)).filter(Boolean)}function ee(e,t){const n=t[e];if(!n)return null;if("column"!==n.key)return n;const o=(n.cells||[]).map(e=>({id:e.id,name:"Content",key:"content",width:e.width,styles:e.styles,children:(e.childrenIds||[]).map(e=>{const n=t[e];return n?"column"===n.key?ee(e,t):n:null}).filter(Boolean)})),{cells:a,...l}=n;return{...l,children:o}}function te(e,t,n){function o(t){const a=e[t];if(!a||"column"!==a.key)return null;for(let l=0;l<(a.cells||[]).length;l++){const i=a.cells[l];for(let a=0;a<(i.childrenIds||[]).length;a++){if(i.childrenIds[a]===n)return{containerId:t,cellIndex:l,itemIndex:a};const r=e[i.childrenIds[a]];if(r&&"column"===r.key){const e=o(i.childrenIds[a]);if(e)return e}}}return null}for(const e of t||[]){const t=o(e);if(t)return t}return null}function ne(e,t,n){const o=(t||[]).indexOf(n);if(-1!==o){const t=e[n];return{containerBlock:t??null,containerType:t?.containerType??"none",cellIndex:0,isRoot:!0,rootIndex:o}}const a=te(e,t,n);if(!a)return{containerBlock:null,containerType:"none",cellIndex:0,isRoot:!1};const l=e[a.containerId];return{containerBlock:l??null,containerType:l?.containerType??"none",cellIndex:a.cellIndex,isRoot:!1}}function oe(e,t,n){const o=(t||[]).indexOf(n);if(-1!==o){const t=e[n];return[{containerBlock:t??null,containerType:t?.containerType??"none",cellIndex:0,isRoot:!0,rootIndex:o}]}function a(t,o=[]){const l=e[t];if(!l||"column"!==l.key)return null;for(let t=0;t<(l.cells||[]).length;t++){const i=l.cells[t];for(let r=0;r<(i.childrenIds||[]).length;r++){const s=i.childrenIds[r];if(s===n)return[{containerBlock:l,containerType:l?.containerType??"none",cellIndex:t,isRoot:!1},...o];const c=e[s];if(c&&"column"===c.key){const e=a(s,[{containerBlock:l,containerType:l?.containerType??"none",cellIndex:t,isRoot:!1},...o]);if(e)return e}}}return null}for(const e of t||[]){const t=a(e,[]);if(t)return t}return[]}function ae(e,t,n){const o=oe(e,t,n),a=o.find(e=>e?.containerType&&"none"!==e.containerType)||o[0]||null,l=a?.cellIndex??0,i=a?.containerBlock??null,r=i?.columnProducts?.[l]??null,s=Array.isArray(i?.columnProducts)?i.columnProducts.find(e=>null!=e)??null:null;return{containerType:a?.containerType??"none",columnIndex:l,columnProduct:r??s,containerBlock:i,lineage:o}}function le(e,t,n,o,a){const l=e[t];if(!l)return e;const i=l.cells.map((e,t)=>{if(t!==n)return e;const l=[...e.childrenIds];return l[o]=a,{...e,childrenIds:l}});return{...e,[t]:{...l,cells:i}}}function ie(e,t,n,o){const a=e[t];if(!a)return{blockMap:e,removedId:null};const l=a.cells[n];if(!l)return{blockMap:e,removedId:null};const i=l.childrenIds[o],r=[...l.childrenIds];r.splice(o,1);const s=a.cells.map((e,t)=>t===n?{...e,childrenIds:r}:e);return{blockMap:{...e,[t]:{...a,cells:s}},removedId:i}}function re(e,t,n,o,a){const l=e[t];if(!l)return e;const i=l.cells[n];if(!i)return e;const r=[...i.childrenIds];r.splice(o,0,a);const s=l.cells.map((e,t)=>t===n?{...e,childrenIds:r}:e);return{...e,[t]:{...l,cells:s}}}function se(e,t,n,o){if(!n||!e[n]||0===o)return null;const a=t.indexOf(n);if(-1!==a){const n=a+o;if(n<0||n>=t.length)return null;const l=[...t],[i]=l.splice(a,1);return l.splice(n,0,i),{nextMap:e,nextRootOrder:l}}const l=te(e,t,n);if(!l)return null;const{containerId:i,cellIndex:r,itemIndex:s}=l,c=e[i],d=[...c.cells[r].childrenIds],u=s+o;if(u<0||u>=d.length)return null;const[p]=d.splice(s,1);d.splice(u,0,p);const m=c.cells.map((e,t)=>t===r?{...e,childrenIds:d}:e);return{nextMap:{...e,[i]:{...c,cells:m}},nextRootOrder:t}}function ce(e,t){const n={...e};return function e(t){const o=n[t];o&&("column"===o.key&&(o.cells||[]).forEach(t=>(t.childrenIds||[]).forEach(t=>e(t))),delete n[t])}(t),n}function de(e,t={}){if(!e||"column"!==e.key||!Array.isArray(e.cells))return null;const n=(o=t)&&"object"==typeof o?Array.isArray(o)?o.reduce((e,t)=>(t&&"object"==typeof t&&t.id&&(e[t.id]=t),e),{}):{...o}:{};var o;const a=B(e);delete a.children,delete a.blockMap,delete a.blockSnapshotMap;const l={...n,[a.id]:a};function i(e){e&&!l[e]&&(l[e]=X("…",e))}return function e(t){if(t&&"column"===t.key&&Array.isArray(t.cells))for(const n of t.cells)for(const t of n.childrenIds||[]){i(t);const n=l[t];n&&"column"===n.key&&e(n)}}(a),{blockMap:l,rootId:a.id}}function ue(e,t){if(!t)return{newBlockMap:e,rootId:null};if("column"===t.key){const n=Array.isArray(t.children)&&t.children.length>0;if(Array.isArray(t.cells)&&t.cells.length>0&&!n){const n=de(t,t.blockMap||t.blockSnapshotMap||{});if(n?.blockMap&&n.rootId){const t=Q(n.blockMap,[n.rootId])[0];if(t){const{blockMap:n,rootOrder:o}=Z([t]);return{newBlockMap:{...e,...n},rootId:o[0]??null}}}}const{blockMap:o,rootOrder:a}=Z([t]);return{newBlockMap:{...e,...o},rootId:a[0]??null}}return{newBlockMap:{...e,[t.id]:t},rootId:t.id}}const pe="SET_BLOCK_LIST",me="SET_BLOCKS",ge="SET_IS_DRAG_START",he="SET_ACTION_TYPE",be="SET_PREVIEW_MODE",ye="SET_CURRENT_ITEM",fe="SET_BODY_SETTINGS",_e="SET_SELECTION_RANGE",ke="SET_TEXT_RANGE",xe="SET_LANGUAGE",ve="SET_LANGUAGE_LIBRARIES",we="SET_TEMPLATE_VARIABLES",Se="UNDO",je="REDO",Ce=e=>({type:he,actionType:e}),Ne=e=>({type:ye,currentItem:e}),Ie=(e,t={})=>({type:we,templateData:e,skipUndo:Boolean(t.skipUndo)}),Ae={},Le=[],Te={preHeader:"",contentWidth:600,contentWidthMode:"email_width",stackColumnsOnMobile:!0,scaleFontOnMobile:!0,styles:{backgroundColor:"#F5F5F5",contentBg:"#FFFFFF",color:"#171717",headingColor:"#171717",linkColor:"#338AF3",fontFamily:"'Overused Grotesk', ui-sans-serif, system-ui, sans-serif"}},Be={blockMap:Ae,rootOrder:Le,blockList:[],isDragStart:!1,actionType:"firstRender",previewMode:"desktop",currentItem:null,bodySettings:Te,selectionRange:null,textRange:null,language:"en",languageLibraries:{},templateData:null,undoStack:[],redoStack:[]},$e=e.createContext();function Re(e,t,n){const o=W(t,e.templateData),a=Q(o,n);let{currentItem:l}=e;if(l?.id&&o[l.id]){const e=ee(l.id,o);e&&e!==l.data&&(l={...l,data:e})}return{...e,blockMap:o,rootOrder:n,blockList:a,currentItem:l}}function Pe(e){return e?{...e,data:e.data&&"object"==typeof e.data?B(e.data):e.data}:null}function Me(e){return{blockMap:B(e.blockMap||Ae),rootOrder:[...e.rootOrder||Le],bodySettings:B(e.bodySettings||Te),currentItem:Pe(e.currentItem),templateData:null==e.templateData?null:B(e.templateData)}}function Fe(e){return JSON.stringify(e,(e,t)=>t&&"object"==typeof t&&!Array.isArray(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ue(e,t){if(t)return e;const n=Me(e),o=e.undoStack[e.undoStack.length-1];return o&&function(e,t){if(!e||!t)return!1;try{return Fe(e)===Fe(t)}catch{return!1}}(n,o)?e:{...e,undoStack:[...e.undoStack,n].slice(-50),redoStack:[]}}function De(e,t){const n=t.templateData,o=W(B(t.blockMap||Ae),n),a=[...t.rootOrder||Le],l=Q(o,a);let i=Pe(t.currentItem);if(i?.id&&o[i.id]){const e=ee(i.id,o);e&&(i={...i,data:e})}const r=B(t.bodySettings||Te);return{...e,blockMap:o,rootOrder:a,blockList:l,bodySettings:{...r,contentWidth:G(r.contentWidth)},currentItem:i,templateData:n}}function Ee(e,t){switch(t.type){case me:return Re(Ue(e,t.skipUndo),t.blockMap,t.rootOrder);case pe:{const n=Ue(e,t.skipUndo),{blockMap:o,rootOrder:a}=Z(t.blockList);return Re(n,o,a)}case ge:return{...e,isDragStart:t.isDragStart};case he:return{...e,actionType:t.actionType};case be:return{...e,previewMode:t.previewMode};case ye:{let n=t.currentItem;if(n?.id&&e.blockMap[n.id]){const t=ee(n.id,e.blockMap);t&&(n={...n,data:t})}return{...e,currentItem:n}}case fe:{const n=Ue(e,t.skipUndo),o={...n.bodySettings,...t.bodySettings};return{...n,bodySettings:{...o,contentWidth:G(o.contentWidth)}}}case _e:return{...e,selectionRange:t.selectionRange};case ke:return{...e,textRange:t.textRange};case xe:return{...e,language:t.language};case ve:return{...e,languageLibraries:t.languageLibraries};case we:{const n=Ue(e,t.skipUndo),o=t.templateData,a=W(n.blockMap,o),l=Q(a,n.rootOrder);let{currentItem:i}=n;if(i?.id&&a[i.id]){const e=ee(i.id,a);e&&(i={...i,data:e})}return{...n,templateData:o,blockMap:a,blockList:l,currentItem:i}}case Se:{if(!e.undoStack.length)return e;const t=e.undoStack[e.undoStack.length-1],n=e.undoStack.slice(0,-1),o=Me(e),a=[...e.redoStack,o].slice(-50);return{...De(e,t),undoStack:n,redoStack:a,actionType:"undo"}}case je:{if(!e.redoStack.length)return e;const t=e.redoStack[e.redoStack.length-1],n=e.redoStack.slice(0,-1),o=Me(e),a=[...e.undoStack,o].slice(-50);return{...De(e,t),undoStack:a,redoStack:n,actionType:"redo"}}default:return e}}function ze(e){if(null==e)return"";const t=String(e).trim();if(!t)return"";const n=t.toLowerCase();return"none"===n||"null"===n||"undefined"===n?"":t}var Oe={global:[{key:"CustomerName",token:"{{CustomerName}}",label:"Customer Name",labelKey:"variable_customer_name",type:"text",fallback:"Customer",source:"derived"},{key:"BrandName",token:"{{BrandName}}",label:"Brand Name",labelKey:"variable_brand_name",type:"text",fallback:"Company Name",source:"companyContext.name"},{key:"Tagline",token:"{{Tagline}}",label:"Tagline",labelKey:"variable_tagline",type:"text",fallback:"Your tagline here",source:"brandContext.tagline"},{key:"LogoUrl",token:"{{LogoUrl}}",label:"BrandLogo",labelKey:"variable_image_logo",type:"image",fallback:"https://via.placeholder.com/150x50/ffffff/333333?text=Logo",source:"brandContext.logo_url"},{key:"Website",token:"{{Website}}",label:"Website",labelKey:"variable_website",type:"text",fallback:"www.example.com",source:"companyContext.website"},{key:"Address",token:"{{Address}}",label:"Address",labelKey:"variable_address",type:"text",fallback:"",source:"companyContext.address"}],product:[{key:"ProductName",token:"{{ProductName}}",label:"Product Name",labelKey:"variable_product_name",type:"text",fallback:"Product Name",source:"content.products[].name"},{key:"ProductDescription",token:"{{ProductDescription}}",label:"Product Description",labelKey:"variable_product_description",type:"text",fallback:"Product description goes here.",source:"content.products[].description"},{key:"ProductImage",token:"{{ProductImage}}",label:"Product Image URL",labelKey:"variable_product_image",type:"image",fallback:"https://via.placeholder.com/300x300/eeeeee/666666?text=Product",source:"content.products[].image"},{key:"ProductLink",token:"{{ProductLink}}",label:"Product Link",labelKey:"variable_product_link",type:"url",fallback:"https://www.example.com",source:"content.products[].link"},{key:"ProductPrice",token:"{{ProductPrice}}",label:"Product Price (Amount)",labelKey:"variable_product_price",type:"number",fallback:"0",source:"content.products[].price.amount"},{key:"ProductCurrency",token:"{{ProductCurrency}}",label:"Product Currency",labelKey:"variable_product_currency",type:"text",fallback:"USD",source:"content.products[].price.currency"},{key:"ProductOldPrice",token:"{{ProductOldPrice}}",label:"Product Old Price",labelKey:"variable_product_old_price",type:"number",fallback:"0",source:"content.products[].old_price"},{key:"ProductNewPrice",token:"{{ProductNewPrice}}",label:"Product New Price",labelKey:"variable_product_new_price",type:"number",fallback:"0",source:"content.products[].new_price"},{key:"ProductPriceDisplay",token:"{{ProductPriceDisplay}}",label:"Product Price Display",labelKey:"variable_product_price_display",type:"text",fallback:"USD 0",source:"derived"}],discount:[{key:"DiscountValue",token:"{{DiscountValue}}",label:"Discount Value",labelKey:"variable_discount_value",type:"text",fallback:"20%",source:"content.discount.value"},{key:"DiscountCode",token:"{{DiscountCode}}",label:"Discount Code",labelKey:"variable_discount_code",type:"text",fallback:"SAVE20",source:"content.discount.code"},{key:"ValidUntil",token:"{{ValidUntil}}",label:"Valid Until",labelKey:"variable_valid_until",type:"date",fallback:"12-31-2025",source:"content.discount.valid_until"}]};const We="CustomerName",He="DiscountValue",Ke="DiscountCode",Ve="ValidUntil",Ge="CompanyName",qe="Address",Je="Website",Ye="BrandName",Xe="LogoUrl",Ze="Tagline",Qe="HeroBanner",et="FooterBanner",tt="NavLabel",nt="NavUrl",ot="ProductName",at="ProductDescription",lt="ProductImage",it="ProductLink",rt="ProductPrice",st="ProductCurrency",ct="ProductOldPrice",dt="ProductNewPrice",ut="ProductPriceDisplay",pt="CTALabel",mt="CTAUrl",gt=new Set([ct,dt]);function ht(e){return`{{${e}}}`}const bt=Oe;let yt=bt;function ft(e,t=yt){return t&&Array.isArray(t[e])?t[e].map(e=>({...e,token:e.token||ht(e.key)})):[]}let _t=[],kt=[],xt=[],vt={},wt=[],St=[],jt=[];function Ct(){_t=ft("global",yt),kt=ft("product",yt),xt=ft("discount",yt),vt=[..._t,...kt,...xt].reduce((e,t)=>(e[t.key]=t,e),{}),wt=xt.map(e=>({variableKey:e.key,labelKey:e.labelKey}));const e=kt.filter(e=>!gt.has(e.key));St=e.map(e=>({variableKey:e.key,labelKey:e.labelKey})),jt=_t.map(e=>({value:e.token,label:e.label,key:e.key,labelKey:e.labelKey,source:e.source,type:e.type})),xt.map(e=>({value:e.token,label:e.label,key:e.key,labelKey:e.labelKey,source:e.source,type:e.type})),e.map(e=>({value:e.token,label:e.label,key:e.key,labelKey:e.labelKey,source:e.source,type:e.type}))}Ct();const Nt={[We]:"User",[He]:"20%",[Ke]:"SAVE20",[Ve]:"12-31-2025",[Ge]:"Company Name",[Ye]:"Company Name",[qe]:"",[Je]:"www.example.com",[Xe]:"https://via.placeholder.com/150x50/ffffff/333333?text=Logo",[Ze]:"Your tagline here",[Qe]:"https://via.placeholder.com/600x200/eeeeee/666666?text=Hero",[et]:"https://via.placeholder.com/600x100/eeeeee/666666?text=Footer",[tt]:"Link",[nt]:"https://www.example.com",[ot]:"Product Name",[at]:"Product description goes here.",[lt]:"https://via.placeholder.com/300x300/eeeeee/666666?text=Product",[it]:"https://www.example.com",[rt]:"0",[st]:"USD",[ct]:"0",[dt]:"0",[ut]:"$0.00 USD",[pt]:"Shop Now",[mt]:"www.example.com"};function It(e){return null==e||"string"!=typeof e?"":e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const At=new Set([ut]);function Lt(e,t,n={}){if(null==e||"string"!=typeof e)return"";const o=e.replace(/\{\{(\w+)\}\}/g,(e,o)=>{const a=Ft(t,o,n);return At.has(o)?a:It(a)});return null==(a=o)||"string"!=typeof a?a:a.replace(/^(<p[^>]*>\s*(?:<br\s*\/?>| )?\s*<\/p>\s*)+/i,"");var a}function Tt(e){return Nt[e]??"—"}const Bt=/^\{\{\s*[\w.]+\s*\}\}$/;function $t(e,t,{allowEmpty:n=!1}={}){if(null==e)return n?"":Tt(t);const o=String(e).trim();return""===o?n?"":Tt(t):function(e){return"string"==typeof e&&Bt.test(e.trim())}(o)?Tt(t):o}const Rt={USD:"en-US",CAD:"en-CA",EUR:"de-DE",GBP:"en-GB",AUD:"en-AU",NZD:"en-NZ",SGD:"en-SG",INR:"en-IN",JPY:"ja-JP",CNY:"zh-CN",BDT:"bn-BD",AED:"ar-AE",SAR:"ar-SA"};function Pt(e){return function(e){return"string"==typeof e&&/^[A-Za-z]{3}$/.test(e.trim())}(e)?String(e).trim().toUpperCase():"USD"}function Mt(e,t){const n=function(e){if(null==e)return null;const t=String(e).replace(/,/g,"").trim();if(""===t)return null;const n=Number(t);return Number.isFinite(n)?n:null}(e);if(null==n)return null;const o=Pt(t),a=function(e){return Rt[e]??null}(o);if(!a)return null;const l=function(e){if(null==e)return 0;const t=String(e).trim().replace(/,/g,"");if(!t.includes("."))return 0;const[,n=""]=t.split(".");return Math.max(0,n.length)}(e);try{return`${new Intl.NumberFormat(a,{style:"currency",currency:o,minimumFractionDigits:l,maximumFractionDigits:l}).format(n)} ${o}`}catch{return null}}function Ft(e,t,n={}){if(!e)return Tt(t);const{columnIndex:o,columnProduct:a}=n;let l=a;switch(!l&&e.content?.products&&"number"==typeof o&&(l=e.content.products[o]||null),t){case We:return Tt(We);case He:return $t(e.content?.discount?.value,He);case Ke:return $t(e.content?.discount?.code,Ke);case Ve:return $t(e.content?.discount?.valid_until,Ve);case Ge:case Ye:return $t(e.companyContext?.name,t);case qe:return $t(e.companyContext?.address,qe,{allowEmpty:!0});case Je:return $t(e.companyContext?.website,Je);case Xe:return $t(e.brandContext?.logo_url,Xe);case Ze:return $t(e.brandContext?.tagline,Ze);case Qe:return $t(e.brandContext?.heroBanner,Qe);case et:return $t(e.brandContext?.footerBanner,et);case tt:case nt:return Tt(t);case ot:return $t(l?.name,ot);case at:{const e=ze(l?.description);return e?$t(e,at,{allowEmpty:!0}):""}case lt:return $t(l?.image,lt);case it:return $t(l?.link,it);case rt:return null!=l?.price&&"number"==typeof l.price||null!=l?.price&&"string"==typeof l.price?String(l.price):null!=l?.new_price?String(l.new_price):Tt(rt);case st:return $t(l?.currency,st);case ct:return $t(l?.old_price,ct);case dt:return null!=l?.new_price?$t(l.new_price,dt):null!=l?.price?$t(l.price,dt):Tt(dt);case ut:{const e=Pt(l?.currency),t=null!=l?.price?l.price:l?.new_price,n=null!=l?.old_price||null!=l?.new_price,o=null!=l?.old_price?l.old_price:null,a=null!=l?.new_price?l.new_price:null!=l?.price?l.price:null;if(n&&(null!=o||null!=a)){const t=Mt(o,e),n=Mt(a,e),l=null!=(null!=t?t:null!=o?String(o):null)?It(null!=t?t:null!=o?String(o):""):"";return[""!==l?`<span style="text-decoration: line-through;">${l}</span>`:"",null!=(null!=n?n:null!=a?String(a):null)?It(null!=n?n:null!=a?String(a):""):""].filter(Boolean).join(" ")||Tt(ut)}const i=Mt(t,e);return null!=i?It(i):null!=t?It(String(t)):Tt(ut)}case pt:{const t=e.content?.cta?.text;return $t(t,pt)}case mt:{const t=e.content?.cta?.url;return $t(null!=t?t:e.companyContext?.website,mt)}default:return Tt(t)}}const Ut=[{variableKey:Xe,labelKey:"variable_image_logo"},{variableKey:Qe,labelKey:"variable_image_hero_banner"},{variableKey:et,labelKey:"variable_image_footer_banner"}],Dt=[{variableKey:lt,labelKey:"variable_image_product_image"}],Et=[{variableKey:pt,labelKey:"variable_cta_label"}],zt=[{variableKey:mt,labelKey:"variable_cta_url"}],Ot=[{variableKey:it,labelKey:"variable_product_link"},{variableKey:Je,labelKey:"variable_website"}];function Wt(e,t,n,o={}){let a=[];return"discount"===t?a=[...wt]:"product"===t&&(a=[...St]),a.map(({variableKey:e,labelKey:t})=>({...vt[e]||{},variableKey:e,labelKey:t,value:ht(e),pasteValue:Ft(n,e,o)}))}function Ht(e,t,n,o={},a=[]){const l="none"===t?jt.map(e=>({...e,pasteValue:Ft(n,e.key,o)})):Wt(0,t,n,o),i=(a||[]).filter(e=>e&&e.containerType&&"none"!==e.containerType).flatMap(e=>Wt(0,e.containerType,n,e.context||{})),r=new Set,s=[];return[...l,...i].forEach(e=>{const t=e.variableKey||e.key||e.value;t&&!r.has(t)&&(r.add(t),s.push(e))}),s}const Kt={display_text:"DisplayText",introduction:"Introduction",heading:"Heading",subheading:"Subheading",products_description:"ProductDescription"};function Vt(e,t,n,o){return{value:ht(e),labelKey:t,variableKey:e,key:e,type:"image",pasteValue:Ft(n,e,o)}}function Gt(e,t,n={}){const o=Ut.map(({variableKey:e,labelKey:o})=>Vt(e,o,t,n));if("product"===e){const e=Dt.map(({variableKey:e,labelKey:o})=>Vt(e,o,t,n));return[...o,...e]}return o}function qt(e){return!1!==e?.linkEnabled}function Jt(e,t,n={}){if(!e||!t)return e;const{useImportant:o=!1}=n,a=String(t).trim();if(!a)return e;const l=o?`color: ${a} !important`:`color: ${a}`;return String(e).replace(/<a\b([^>]*)>/gi,(e,t)=>{const n=t.match(/\sstyle\s*=\s*"([^"]*)"/i);if(n){const e=(n[1]||"").replace(/\s*color\s*:\s*[^;]+(!important)?\s*;?/gi,"").replace(/;\s*;/g,";").replace(/^\s*;|;\s*$/g,"").trim(),o=`${e?`${e}; `:""}${l};`;return`<a${t.replace(n[0],` style="${o}"`)}>`}const o=t.match(/\sstyle\s*=\s*'([^']*)'/i);if(o){const e=(o[1]||"").replace(/\s*color\s*:\s*[^;]+(!important)?\s*;?/gi,"").replace(/;\s*;/g,";").replace(/^\s*;|;\s*$/g,"").trim(),n=`${e?`${e}; `:""}${l};`;return`<a${t.replace(o[0],` style='${n}'`)}>`}return`<a${t} style="${l};">`})}const Yt=[{name:"Sans Serif (Generic)",stack:"sans-serif"},{name:"Overused Grotesk",stack:"'Overused Grotesk', ui-sans-serif, system-ui, sans-serif"},{name:"Arial",stack:"Arial, Helvetica, sans-serif"},{name:"Helvetica",stack:"Helvetica, Arial, sans-serif"},{name:"Georgia",stack:"Georgia, Times New Roman, serif"},{name:"Times New Roman",stack:"'Times New Roman', Times, serif"},{name:"Verdana",stack:"Verdana, Geneva, sans-serif"},{name:"Tahoma",stack:"Tahoma, Geneva, sans-serif"},{name:"Trebuchet MS",stack:"'Trebuchet MS', Helvetica, Arial, sans-serif"},{name:"Courier New",stack:"'Courier New', Courier, monospace"},{name:"Palatino",stack:"'Palatino Linotype', Palatino, serif"},{name:"Garamond",stack:"Garamond, 'Times New Roman', serif"},{name:"Lucida",stack:"'Lucida Sans Unicode', 'Lucida Grande', sans-serif"}],Xt=[{name:"Roboto",fallback:"Arial, sans-serif"},{name:"Open Sans",fallback:"Arial, sans-serif"},{name:"Lato",fallback:"Arial, sans-serif"},{name:"Montserrat",fallback:"Arial, sans-serif"},{name:"Poppins",fallback:"Arial, sans-serif"},{name:"Merriweather",fallback:"Georgia, serif"},{name:"Playfair Display",fallback:"Georgia, serif"},{name:"Cormorant Garamond",fallback:"Garamond, 'Times New Roman', serif"},{name:"Source Sans 3",fallback:"Arial, sans-serif"},{name:"Inter",fallback:"Arial, sans-serif"},{name:"Nunito",fallback:"Arial, sans-serif"},{name:"Nunito Sans",fallback:"Arial, sans-serif"},{name:"Raleway",fallback:"Arial, sans-serif"},{name:"Rubik",fallback:"Arial, sans-serif"},{name:"Work Sans",fallback:"Arial, sans-serif"},{name:"DM Sans",fallback:"Arial, sans-serif"},{name:"Manrope",fallback:"Arial, sans-serif"},{name:"Outfit",fallback:"Arial, sans-serif"},{name:"Plus Jakarta Sans",fallback:"Arial, sans-serif"},{name:"IBM Plex Sans",fallback:"Arial, sans-serif"},{name:"IBM Plex Serif",fallback:"Georgia, serif"},{name:"Noto Sans",fallback:"Arial, sans-serif"},{name:"Noto Serif",fallback:"Georgia, serif"},{name:"PT Sans",fallback:"Arial, sans-serif"},{name:"PT Serif",fallback:"Georgia, serif"},{name:"Ubuntu",fallback:"Arial, sans-serif"},{name:"Fira Sans",fallback:"Arial, sans-serif"},{name:"Barlow",fallback:"Arial, sans-serif"},{name:"Quicksand",fallback:"Arial, sans-serif"},{name:"Libre Baskerville",fallback:"Georgia, serif"},{name:"Libre Franklin",fallback:"Arial, sans-serif"},{name:"Crimson Pro",fallback:"Georgia, serif"},{name:"Lora",fallback:"Georgia, serif"},{name:"Space Grotesk",fallback:"Arial, sans-serif"},{name:"Archivo",fallback:"Arial, sans-serif"},{name:"Mulish",fallback:"Arial, sans-serif"},{name:"Figtree",fallback:"Arial, sans-serif"},{name:"Be Vietnam Pro",fallback:"Arial, sans-serif"},{name:"Sora",fallback:"Arial, sans-serif"},{name:"Josefin Sans",fallback:"Arial, sans-serif"}],Zt=e=>/\s/.test(String(e||""))?`'${String(e).replace(/'/g,"\\'")}'`:String(e);function Qt(e){return`https://fonts.googleapis.com/css2?family=${(e=>String(e).trim().replace(/\s+/g,"+"))(e)}:wght@400;700&display=swap`}function en(e){const t=e?.brandContext?.customFonts;return Array.isArray(t)?t.filter(e=>e&&"object"==typeof e&&e.name&&e.url).map(e=>({label:`${e.name} (Brand Kit)`,value:`${Zt(e.name)}, Arial, sans-serif`,primaryName:String(e.name),source:"custom",url:String(e.url),format:e.format?String(e.format):void 0,weight:null!=e.weight?String(e.weight):void 0,style:e.style?String(e.style):void 0})):[]}function tn(e){return[...Yt.map(e=>({label:e.name,value:e.stack,primaryName:e.name,source:"system"})),...Xt.map(e=>({label:`${e.name} (Google)`,value:`${Zt(e.name)}, ${e.fallback}`,primaryName:e.name,source:"google"})),...en(e)]}function nn(e){if(!e)return"";const t=String(e).split(",")[0];return String(t??"").trim().replace(/^['"]|['"]$/g,"")}function on(e,t){const n=tn(t),o=nn(e).toLowerCase(),a=n.find(e=>e.primaryName.toLowerCase()===o);return a?a.value:e}function an(e,t){const n=tn(t),o=on(e,t),a=nn(o).toLowerCase(),l=n.find(e=>e.primaryName.toLowerCase()===a||e.value===o);return l?l.label:"sans-serif"===a?"Sans Serif (Generic)":o}function ln(e){const t=String(e.name||"").trim(),n=String(e.url||"").trim();if(!t||!n)return"";const o=e.format?` format('${e.format}')`:"",a=e.weight?`font-weight:${e.weight};`:"",l=e.style?`font-style:${e.style};`:"";return`@font-face{font-family:${Zt(t)};src:url('${n}')${o};${a}${l}}`}function rn(e,t,n){const o=function(e,t){const n=new Set,o=e=>{null!=e&&""!==String(e).trim()&&n.add(String(e).trim())};o(t?.styles?.fontFamily);const a=e=>{Array.isArray(e)&&e.forEach(e=>{e&&"object"==typeof e&&(o(e?.styles?.desktop?.fontFamily),o(e?.styles?.mobile?.fontFamily),"image"===e.key&&Array.isArray(e.overlayItems)&&e.overlayItems.forEach(e=>{e&&"object"==typeof e&&o(e.fontFamily)}),Array.isArray(e.children)&&a(e.children))})};return a(e),[...n]}(e,t),a=new Set;o.forEach(e=>{const t=function(e){const t=nn(e),n=Xt.find(e=>e.name.toLowerCase()===t.toLowerCase());return n?Qt(n.name):null}(e);t&&a.add(t)});const l=(Array.isArray(n?.brandContext?.customFonts)?n.brandContext.customFonts:[]).map(ln).filter(Boolean);return[...[...a].map(e=>`@import url('${e}');`),...l].join("\n")}const sn="ee_cb";function cn(e){const t=String(e??"").trim();if(!t)return t;if(/^\{\{/u.test(t)||/^data:/iu.test(t))return t;try{const e="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(t,e);return n.searchParams.set(sn,String(Date.now())),n.toString()}catch{const e=t.includes("?")?"&":"?";return`${t}${e}${sn}=${Date.now()}`}}function dn(e){const t=String(e??"").trim();if(!t)return t;try{const e="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(t,e);n.searchParams.delete(sn);let o=n.toString();return o.endsWith("?")&&(o=o.slice(0,-1)),o}catch{return t.replace(new RegExp(`[?&]${sn}=\\d+`,"g"),"").replace(/\?&/g,"?").replace(/&&+/g,"&").replace(/[?&]$/,"")}}const un=[{value:"cover",labelKey:"container_bg_size_cover"},{value:"contain",labelKey:"container_bg_size_contain"},{value:"fill",labelKey:"container_bg_size_fill"}],pn=["left top","center top","right top","left center","center center","right center","left bottom","center bottom","right bottom"];function mn(e){return String(e??"").trim().replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"").replace(/\r/g,"")}function gn(e,t){const n=e?.containerBackgroundEnabled,o=e?.containerBackgroundImage,a=o&&String(o).trim();if(!1===n||!a)return{background:t};const l={cover:"cover",contain:"contain",fill:"100% 100%"}[e?.containerBackgroundSize||"cover"]||"cover",i=e?.containerBackgroundPosition||"center center";return{backgroundColor:t,backgroundImage:`url("${mn(a)}")`,backgroundSize:l,backgroundPosition:i,backgroundRepeat:"no-repeat"}}const hn=["tl","tc","tr","ml","mc","mr","bl","bc","br"],bn={tl:{top:"10%",left:"8%",transform:"translate(0, 0)",textAlign:"left"},tc:{top:"10%",left:"50%",transform:"translate(-50%, 0)",textAlign:"center"},tr:{top:"10%",right:"8%",transform:"translate(0, 0)",textAlign:"right"},ml:{top:"50%",left:"8%",transform:"translate(0, -50%)",textAlign:"left"},mc:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",textAlign:"center"},mr:{top:"50%",right:"8%",transform:"translate(0, -50%)",textAlign:"right"},bl:{bottom:"10%",left:"8%",transform:"translate(0, 0)",textAlign:"left"},bc:{bottom:"10%",left:"50%",transform:"translate(-50%, 0)",textAlign:"center"},br:{bottom:"10%",right:"8%",transform:"translate(0, 0)",textAlign:"right"}};function yn(e){const t=String(e??"bc").toLowerCase();return hn.includes(t)?t:"bc"}function fn(e){const t=yn(e);return bn[t]}function _n(e,t){const n="string"==typeof t?t.trim():"";if(n)return n;const o=function(e){if(!e||"string"!=typeof e)return null;const t=e.trim(),n=[/(?:youtube\.com\/watch\?[^#]*[&?]v=)([a-zA-Z0-9_-]{11})/,/youtube\.com\/watch\?v=([a-zA-Z0-9_-]{11})/,/youtu\.be\/([a-zA-Z0-9_-]{11})/,/youtube\.com\/embed\/([a-zA-Z0-9_-]{11})/,/youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})/,/youtube-nocookie\.com\/embed\/([a-zA-Z0-9_-]{11})/];for(const e of n){const n=t.match(e);if(n?.[1])return n[1]}return null}(e||"");return o?`https://img.youtube.com/vi/${o}/hqdefault.jpg`:""}function kn(e){const t=null!=e?String(e).trim():"";return t&&"transparent"!==t.toLowerCase()?t:"#ffffff"}const xn=e=>null==e||""===String(e).trim();function vn(e,t){const n="string"==typeof e?e.trim():String(e??"").trim();if(!n)return"";const o=/^\{\{(\w+)\}\}$/.exec(n);if(o&&t){const e=Ft(t,o[1],{});if(null!=e&&""!==String(e).trim()&&!String(e).startsWith("{{"))return String(e).trim()}return n}function wn(e,t){if(null==e||""===e)return"";const n=String(e);return t?n.replace(/\{\{(\w+)\}\}/g,(e,n)=>{const o=Ft(t,n,{});if(null==o)return`{{${n}}}`;const a=String(o);return a.startsWith("{{")?`{{${n}}}`:a}):n}function Sn(e,t){if(null==e||""===e)return"";const n=String(e);return t?n.replace(/\{\{(\w+)\}\}/g,(e,n)=>{const o=Ft(t,n,{}),a=null!=o?String(o).trim():"";return!a||"—"===a||a.startsWith("{{")?e:a}):n}const jn=()=>[{id:P(),label:"Privacy",url:"#",target:"_self"},{id:P(),label:"Terms",url:"#",target:"_self"}];function Cn(e){let t=null!=e?.unsubscribeLinkLabel&&""!==String(e.unsubscribeLinkLabel).trim()?String(e.unsubscribeLinkLabel).trim():"",n=null!=e?.preferencesLinkLabel&&""!==String(e.preferencesLinkLabel).trim()?String(e.preferencesLinkLabel).trim():"";const o=String(e?.unsubscribeText??"").trim();if(!t&&o){const e=o.split(/\s*[·•]\s*/);t=e[0]?.trim()||"",n=n||e[1]?.trim()||""}return{unsubscribeLinkLabel:t||"Unsubscribe",preferencesLinkLabel:n||"Update preferences"}}function Nn(e){return(Array.isArray(e)&&0!==e.length?e:z([],{})).map(e=>({id:e?.id,image:e?.image??"",title:e?.title??"",linkURL:e?.linkURL??"",socialPlatformKey:e?.socialPlatformKey}))}function In(e){return Array.isArray(e)&&0!==e.length?e.map(e=>({id:e?.id,label:e?.label??"",url:e?.url??"",target:"_blank"===e?.target?"_blank":"_self"})):jn()}const An=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),Ln=(e,t)=>{if(null==e||""===e)return t;if("number"==typeof e)return e;const n=parseInt(String(e).replace(/px/gi,""),10);return Number.isFinite(n)?n:t};const Tn="#111827";function Bn(e){if(null==e)return"";const t=String(e).trim().toLowerCase();return/^#[0-9a-f]{3}$/.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function $n(e){return Bn(e)===Bn("#263d2d")}function Rn(e){if(null==e||"object"!=typeof e)return"#111111";const t=e.brandContext,n=t&&"object"==typeof t?t.brand_color??t.brandColor??null:null,o=e.brandColor,a=("string"==typeof n&&""!==n.trim()?n:"string"==typeof o&&""!==o.trim()?o:null)??"#111111",l=String(a).trim();return""!==l?l:"#111111"}const Pn=new Set(["fontWeight","opacity","zIndex"]),Mn=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),Fn=e=>Mn(e).replace(/"/g,""").replace(/'/g,"'"),Un=(e,t="#")=>{if(null==e)return t;const n=String(e).trim();if(!n)return t;const o=n.toLowerCase();return/^\s*(?:javascript|vbscript):/i.test(o)||/^\s*data:/i.test(o)?t:/^https?:\/\//i.test(n)||/^mailto:/i.test(n)||/^tel:/i.test(n)?n:n.startsWith("//")?`https:${n}`:/^[a-z][a-z\d+.-]*:/i.test(n)?n:`https://${n.replace(/^\/+/,"")}`},Dn=(e,t)=>{const n=new RegExp(/[A-Z]/g),o=e=>e.replace(n,e=>`-${e.toLowerCase()}`),a={desktop:t?.desktop??{},mobile:t?.mobile??{}};let l={className:e,desktop:"",mobile:""};for(let e of Object.entries(a.desktop))if(e[1]&&"contentBackground"!==e[0]&&"horizontalAlign"!==e[0]&&"containerBackgroundImage"!==e[0]&&"containerBackgroundSize"!==e[0]&&"containerBackgroundPosition"!==e[0]){const t="number"!=typeof e[1]||Pn.has(e[0])?e[1]:e[1]+"px";l.desktop+=`${o(e[0])}:${t};`}if(Object.keys(a.mobile).length){let t="";for(let e of Object.entries(a.mobile))if(e[1]&&"contentBackground"!==e[0]&&"horizontalAlign"!==e[0]&&"containerBackgroundImage"!==e[0]&&"containerBackgroundSize"!==e[0]&&"containerBackgroundPosition"!==e[0]){const n="number"!=typeof e[1]||Pn.has(e[0])?e[1]:e[1]+"px";t+=`${o(e[0])}:${n} !important;`}l.mobile+=`@media(max-width:620px){\n .${e} {\n ${t}\n }\n }`}return l};function En(e){if(!e||"object"!=typeof e)return{};const{marginLeft:t,marginTop:n,...o}=e;return o}function zn(e){if(!e||"object"!=typeof e)return{};const t={};return null!=e.marginLeft&&""!==e.marginLeft&&(t.marginLeft=e.marginLeft),null!=e.marginTop&&""!==e.marginTop&&(t.marginTop=e.marginTop),t}function On(e){const t=y(e||{}),{linkColor:n,color:o,...a}=t,l=null!=n&&""!==String(n).trim()?String(n).trim():null,i=null!=o&&""!==String(o).trim()?String(o).trim():null,r=l??i;return null==r?a:{...a,color:r}}const Wn=(e,t="",n=null)=>{const o=e.map((e,o)=>{let a={...e};const l=null!==n?`${n}-${o}`:`${o}`,i=e=>`e${l}-${e}`,r={desktop:e?.styles?.desktop??{},mobile:e?.styles?.mobile??{}},s="menu"===e.key?{desktop:On(r.desktop),mobile:On(r.mobile)}:"social_link"===e.key?{desktop:y(r.desktop),mobile:y(r.mobile)}:r;if(a.styleConfig=Dn(i(e.key),s),a.contentStyles){const n={desktop:a.contentStyles?.desktop??{},mobile:a.contentStyles?.mobile??{}};let o=n;if(a.imageHostMarginStyleConfig=null,"image"===a.key){o={desktop:En(n.desktop),mobile:En(n.mobile)};const l={desktop:zn(n.desktop),mobile:zn(n.mobile)};if(Object.keys(l.desktop).length||Object.keys(l.mobile).length){const n=Dn(i(`${e.key}-hm`),l);a.imageHostMarginStyleConfig=n,n.mobile&&(t+=n.mobile)}}a.contentStyleConfig=Dn(i(`${e.key}-c`),o),a.contentStyleConfig.mobile&&(t+=a.contentStyleConfig.mobile)}if("video"===a.key&&a.videoArea){const n={desktop:a.videoArea?.desktop??{},mobile:a.videoArea?.mobile??{}};a.videoAreaStyleConfig=Dn(i(`${e.key}-va`),n),a.videoAreaStyleConfig.mobile&&(t+=a.videoAreaStyleConfig.mobile)}if(a.styleConfig.mobile&&(t+=a.styleConfig.mobile),s.desktop.contentBackground&&(a.contentStyleConfig||(a.contentStyleConfig={className:i(`${e.key}-c`),desktop:"",mobile:""}),a.contentStyleConfig.desktop+=`background-color:${s.desktop.contentBackground};`),s.mobile.contentBackground){a.contentStyleConfig||(a.contentStyleConfig={className:i(`${e.key}-c`),desktop:"",mobile:""});const n=`@media(max-width:620px){.${a.contentStyleConfig.className}{background-color:${s.mobile.contentBackground};}}`;a.contentStyleConfig.mobile=(a.contentStyleConfig.mobile||"")+n,t+=n}if("menu"===a.key){if("stack"===(e.mobileLayout??"stack")){const n=a.contentStyleConfig?.className??i(`${e.key}-c`);a.contentStyleConfig||(a.contentStyleConfig={className:n,desktop:"",mobile:""});const o=a.contentStyles?.desktop?.textAlign??a.contentStyles?.mobile?.textAlign??"center",l=String(o).toLowerCase(),r="left"===l?"flex-start":"right"===l?"flex-end":"center",s=["left","right","center","justify"].includes(l)?l:"center",c=e.linkGapPx,d=`@media(max-width:620px){\n.${n}{display:flex !important;flex-direction:column !important;align-items:${r} !important;flex-wrap:nowrap !important;}\n.${n}>span{display:none !important;}\n.${n}>a{display:block !important;width:100% !important;box-sizing:border-box !important;text-align:${s} !important;margin:0 0 ${"number"==typeof c&&Number.isFinite(c)&&c>=0?c:0}px 0 !important;}\n.${n}>a:last-child{margin-bottom:0 !important;}\n}`;a.contentStyleConfig.mobile=(a.contentStyleConfig.mobile||"")+d,t+=d}}if(e.children?.length){const{newBlockList:n,styles:o}=Wn(e.children,"",l);t+=o,a.children=n}return{...a}});return{newBlockList:o,styles:t}};function Hn(e){const t=e.contentStyleConfig?.desktop??"",n=function(e){const t=e.contentStyles?.desktop??{},n=e.contentStyles?.mobile??{},o=null!=t.textAlign&&""!==String(t.textAlign).trim()?t.textAlign:n.textAlign,a=null!=o&&""!==String(o).trim()?String(o).trim():"center";return"start"===a?"left":"end"===a?"right":a}(e);return/\btext-align\s*:/i.test(t)?t:`${t}text-align:${n};`}const Kn="#2faade";function Vn(e){const t=String(e??"");return null!=(n=t)&&"string"==typeof n&&/<[a-zA-Z!/?]/.test(n.trim())?function(e){if(!e||!/<a\b/i.test(e))return e;const t=(e,t,n)=>{const o=(t[1]||"").replace(/\s*text-decoration(-line)?\s*:[^;]+;?/gi,"").replace(/^\s*;|;\s*$/g,"").trim(),a=(o?`${o}; `:"")+"text-decoration: none;",l='"'===n?` style="${a}"`:` style='${a}'`;return`<a${e.replace(t[0],l)}>`};return String(e).replace(/<a\b([^>]*)>/gi,(e,n)=>{const o=n.match(/\sstyle\s*=\s*"([^"]*)"/i);if(o)return t(n,o,'"');const a=n.match(/\sstyle\s*=\s*'([^']*)'/i);return a?t(n,a,"'"):`<a${n} style="text-decoration: none;">`})}(t):Mn(t);var n}function Gn(e){const t=e?.dynamicSelectedContent,n=e?.text??"";if(null==t)return String(n);const o=String(t);return""===o.trim()?String(n):o}const qn=(e,t,n={})=>{let o=Gn(e);t&&o&&(o=Lt(o,t,n));const a=e?.styles?.desktop??{},l=null!=a.linkColor&&""!==String(a.linkColor).trim();return o=Jt(o,l?String(a.linkColor).trim():Kn,{useImportant:l}),`<${e.type} ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""} \n style="${e.styleConfig?.desktop||""}">\n ${o}\n </${e.type}>`};const Jn=(e,t,n={},o=null)=>{let a=e.text||"",l=e.linkURL||"";if(t){const o=a.match(/\{\{(\w+)\}\}/),i=e.labelVariable?e.labelVariable.replace(/^\{\{|\}\}$/g,"").trim():o?o[1]:void 0;if(i){const e=Ft(t,i,n);null==e||String(e).startsWith("{{")||(a=String(e))}if(e.urlVariable){const o=Ft(t,e.urlVariable.replace(/^\{\{|\}\}$/g,""),n);o&&!o.startsWith("{{")&&(l=String(o))}else{const e=String(l||"").trim().match(/^\{\{(\w+)\}\}$/);if(e){const o=Ft(t,e[1],n);o&&!String(o).startsWith("{{")&&(l=String(o))}}}const i=Vn(a),r=Fn(Un(l)),s=Rn(t);let c=e.styleConfig.desktop||"";!function(e,t){if(!function(e){return!(!e||"column"!==e.key||"product"!==e.containerType)&&"additional"!==e.productRole&&("image_left"===e.mainProductLayout||"image_stacked"!==e.mainProductLayout&&function(e){const t=e?.children?.[0]?.children?.[0];return"column"===t?.key&&"2-3"===t?.type}(e))}(t))return!1;const n=e.styles?.desktop?.backgroundColor;return null==n||""===String(n).trim()||Bn(n)===Bn(Tn)}(e,o)?$n(e.styles?.desktop?.backgroundColor)&&(c=c.replace(/background-color:\s*[^;]+;?/gi,"")):c=c.replace(/background-color:\s*[^;]+;?/gi,"");const d=c.includes("background-color:")?"":`background-color:${s};`;return`<div ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""} \n style="${e.contentStyleConfig.desktop}">\n <a ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""} \n style="${c}${d}text-align:center;text-decoration:none;" target="_blank" rel="noopener noreferrer" href="${r}">${i}</a>\n </div>`};const Yn=e=>{const t=Array.isArray(e.list)?e.list.filter(Boolean):[];if(0===t.length)return"";const n=Boolean(e.showTextLabel),o=`${e.styleConfig.desktop};display:inline-flex;vertical-align:middle;margin:0;align-items:center;${n?"gap:8px;":""}`,a=I(e),l=Math.max(11,Math.round(.58*a)),i=b(e.iconColor),r=t.map(t=>{const{title:r,linkURL:s}=t,c=u(s,{allowMailtoTel:!1}),{src:d,styleAttr:p}=T(t,i,a),m=`<img src="${Fn(d)}" alt="${Fn(r)}" style="${Fn(p)}" \n ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""}/>`,h=g(t)?"X":String(r??""),b=n?`<span style="font-size:${l}px;line-height:1.2;color:#525252;font-family:inherit;white-space:nowrap;">${Mn(h)}</span>`:"",y=`${o};text-decoration:none;`;return c?`<a target="_blank" rel="noopener noreferrer" href="${Fn(c)}" style="${y}">${m}${b}</a>`:`<span style="${y}">${m}${b}</span>`}).join(""),s=function(e){const t=e?.contentStyles?.desktop??{},n=t.textAlign||"center",o=t.columnGapPx;return`width:100%;max-width:100%;box-sizing:border-box;display:flex;flex-wrap:wrap;align-items:center;justify-content:${"justify"===n?"space-between":"center"===n?"center":"right"===n?"flex-end":"flex-start"};column-gap:${"number"==typeof o&&Number.isFinite(o)&&o>=0?o:8}px;row-gap:0`}(e),c=`${e.contentStyleConfig.desktop};${s}`;return`<div ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""} \n style="${c}">\n ${r}\n </div>`};const Xn=(e,t,n,o,a,l)=>{let i="";const r={columnIndex:a??0,columnProduct:o?.columnProducts?.[l??0]??null};return e.forEach((e,s)=>{if("column"===e.key){const r=function(e){const t={...e?.desktop??{}},n=e?.mobile??{},o=String(t.containerBackgroundImage??"").trim(),a=String(n.containerBackgroundImage??"").trim();!o&&a&&(t.containerBackgroundImage=n.containerBackgroundImage,null!=n.containerBackgroundSize&&(t.containerBackgroundSize=n.containerBackgroundSize),null!=n.containerBackgroundPosition&&(t.containerBackgroundPosition=n.containerBackgroundPosition),void 0!==n.containerBackgroundEnabled&&(t.containerBackgroundEnabled=n.containerBackgroundEnabled));const l=t.minHeight,i=n.minHeight;return null!=l&&""!==String(l).trim()||null==i||""===String(i).trim()||(t.minHeight=i),t}(e.styles),c=e.styles?.desktop?.borderRadius,d=c?`border-radius:${"number"==typeof c?c+"px":c};`:"",p=d?"overflow:hidden;":"",m=function(e){const t=e??{};if(!1===t.containerBackgroundEnabled)return"";const n=dn(t.containerBackgroundImage);return n&&String(n).trim()?`background-image:url("${mn(n)}");background-size:${{cover:"cover",contain:"contain",fill:"100% 100%"}[t.containerBackgroundSize||"cover"]||"cover"};background-position:${t.containerBackgroundPosition||"center center"};background-repeat:no-repeat;`:""}(r),g=function(e){if(null==e)return"";if("number"==typeof e&&Number.isFinite(e))return`min-height:${e}px;`;const t=String(e).trim();return t?/^\d+$/.test(t)?`min-height:${t}px;`:`min-height:${t};`:""}(r.minHeight),h=String(r.contentBackground??"").trim(),b=h&&"transparent"!==h.toLowerCase()?`background-color:${h};`:"",y=void 0!==l,_=Y(t)||y?"100%":`${J(t)}px`,k=e.containerType&&"none"!==e.containerType?e:o,x=e.containerType&&"none"!==e.containerType?s:a,v=e.containerType&&"none"!==e.containerType?0:l,w="footer"===e.containerType&&e.footerUnifiedLayout?function(e,t,n){const o=e,a=o.styles?.desktop??{},l=Boolean(o.showBrand??!0),i=Boolean(o.showTagline??!0),r=Boolean(o.footerShowLogo??!1),s=vn(o.footerLogoSrc??"",n),c=wn(String(o.footerLogoAlt??"Logo").trim()||"Logo",n).trim()||"Logo",d=o.footerLogoLink??"",p=Ln(o.footerLogoMaxWidthPercent,30),m=Ln(o.footerLogoPaddingPx,24),g=Boolean(o.showAddress??!0),h=Boolean(o.showUnsubscribe??!0),b=Boolean(o.showSocial??!1),y=Boolean(o.showSecondaryLinks??!1),_=Boolean(o.showCopyright??!0),k=wn(o.brandName??"",n),x=wn(o.brandTagline??"",n).trim(),v=wn(o.address??"",n),w=wn(o.copyrightText??"",n),S=o.unsubscribeUrl??"",j=o.preferencesUrl??"",{unsubscribeLinkLabel:C,preferencesLinkLabel:N}=Cn(o),I=In(o.secondaryLinks),A=Nn(o.footerSocialList),L=a.color??"#737373",B=null!=a.linkColor&&""!==String(a.linkColor).trim()?String(a.linkColor).trim():L,$=Ln(a.fontSize,12),R=a.textAlign??"center",P=Ln(a.paddingTop,28),M=Ln(a.paddingRight,24),F=Ln(a.paddingBottom,28),U=Ln(a.paddingLeft,24),D=kn(a.contentBackground),E=Boolean(o.showDivider??!1),z=An(o.dividerColor??"#374151"),O=Boolean(o.showBorderTop??!1),W=Ln(o.borderTopWidth,1),H=o.borderTopStyle??"solid",K=An(o.borderTopColor??"#e5e7eb"),V=O&&W>0?`${W}px ${H} ${K}`:"",G=t?.width??"100%",q=t?.styleConfig?.mobile?` class="${t.styleConfig.className}"`:"",J=t?.styleConfig?.desktop??"",Y=`margin:0;color:${An(L)};font-size:${$}px;line-height:1.5;font-family:Arial,sans-serif;`,X=`color:${An(B)};text-decoration:underline;`,Z=[];let Q="";if(E&&(Q+=`<div style="border-top:1px solid ${z};margin-bottom:14px;width:100%;font-size:0;line-height:0;"> </div>`),r&&s.trim()){const e="left"===R?"left":"right"===R?"right":"center",t=`<img src="${An(s)}" alt="${An(c)}" width="570" style="max-width:${p}%;height:auto;display:inline-block;padding:${m}px;vertical-align:middle;border:0;outline:none;text-decoration:none;"/>`,o=u(Sn(d,n)),a=o?`<a href="${An(o)}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;line-height:0;display:inline-block;">${t}</a>`:t;Q+=`<div style="text-align:${An(e)};margin-bottom:10px;line-height:0;">${a}</div>`}if(l&&k.trim()&&(Q+=`<p style="${Y}font-weight:600;margin:0 0 10px 0;">${An(k)}</p>`),i&&x&&(Q+=`<p style="${Y}margin:0 0 10px 0;opacity:0.92;">${An(x)}</p>`),g&&v.trim()&&(Q+=`<p style="${Y}margin:0 0 10px 0;">${An(v)}</p>`),b){const e=Array.isArray(A)?A.filter(Boolean):[];if(e.length>0){const t=f.medium,o=e.map(e=>{const o=u(Sn(e.linkURL,n),{allowMailtoTel:!1}),{src:a,styleAttr:l}=T(e,"default",t),i=`<img src="${An(a)}" alt="" width="${t}" height="${t}" style="${l}" border="0"/>`;return`<td style="padding:0 6px;">${o?`<a href="${An(o)}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;line-height:0;display:inline-block;">${i}</a>`:i}</td>`}).join(""),a="left"===R?"left":"right"===R?"right":"center";Q+=`<table role="presentation" cellpadding="0" cellspacing="0" border="0" align="${a}" style="${"center"===a?"margin:0 auto;margin-bottom:10px;":"right"===a?"margin-left:auto;margin-bottom:10px;":"margin-bottom:10px;"}"><tr>${o}</tr></table>`}}if(h){const e=An(wn(C,n)),t=An(wn(N,n)),o=An(u(Sn(S,n))),a=An(u(Sn(j,n)));let l=`<p style="${Y}margin:0 0 10px 0;word-break:break-word;">`;l+=`<a href="${o}" style="${X}">${e}</a>`,N&&(l+=`<span style="padding:0 6px;">·</span><a href="${a}" style="${X}">${t}</a>`),l+="</p>",Q+=l}if(y&&I.length>0){let e=`<p style="${Y}margin:0 0 10px 0;word-break:break-word;">`;I.forEach((t,o)=>{o>0&&(e+='<span style="padding:0 6px;">·</span>');const a=An(wn(t.label,n)),l=An(u(Sn(t.url,n))),i="_blank"===t.target?' target="_blank" rel="noopener noreferrer"':"";e+=`<a href="${l}" style="${X}"${i}>${a||`#${o+1}`}</a>`}),e+="</p>",Q+=e}if(_&&w.trim()){Q+=`<p style="${Y}font-size:${Math.max(10,$-1)}px;margin:0;opacity:0.9;">${An(w)}</p>`}var ee;return Z.push(`<td${q} style="width:${G};${J}">${ee=Q,`<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="width:100%;"><tr><td align="${An(R)}" style="${Y}text-align:${An(R)};background-color:${An(D)};padding:${P}px ${M}px ${F}px ${U}px;${V?`border-top:${V};`:""}">${ee}</td></tr></table>`}</td>`),Z.join("")}(e,e.children?.find(e=>"content"===e.key)??e.children?.[0]??null,n):Xn(e.children,t,n,k,x,v);i+=`<div ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""}\n style="${e.styleConfig.desktop};${b}width:100%;display:block;${p}">\n <table ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""}\n style="width:100%;max-width:${_};margin:0 auto;${d}${e.contentStyleConfig?.desktop??""}${b}${m}${g}">\n <tbody><tr>${w}</tr></tbody>\n </table></div>`}if("content"===e.key&&(i+=`<td ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""} \n style="width:${e.width}; ${e.styleConfig.desktop}">${Xn(e.children,t,n,o,a,s)}</td>`),"text"===e.key){const t=null!=o?{columnIndex:a??0,columnProduct:o?.columnProducts?.[l??0]??null}:r;e.type&&/^h[1-4]$/.test(e.type)?i+=qn(e,n,t):i+=((e,t,n={},o=null)=>{let a=Gn(e);t&&a&&(a=Lt(a,t,n));const l=e?.styles?.desktop??{},i=null!=l.linkColor&&""!==String(l.linkColor).trim();a=Jt(a,i?String(l.linkColor).trim():Kn,{useImportant:i});const r="footer"===o?.containerType,s=null==(c=a)||"string"!=typeof c?"":c.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();var c;return!r||""!==s&&"{{Address}}"!==s&&"{{Tagline}}"!==s?`<div ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""} \n style="${e.styleConfig?.desktop||""}">${a}</div>`:""})(e,n,t,o)}if("heading"===e.key&&(i+=qn(e,n,r)),"image"===e.key){i+=((e,t,n={},o=null)=>{let a=e.src||"";const l="string"==typeof e.src&&/^\{\{\s*[\w.]+\s*\}\}$/.test(e.src.trim())?e.src.trim():"";if(t&&l){const e=Ft(t,l.replace(/^\{\{\s*|\s*\}\}$/g,""),n);e&&!/^\{\{\s*[\w.]+\s*\}\}$/.test(String(e).trim())&&(a=e)}a=dn(a);const i=Fn(a),r=Fn(e.alt||"Image"),s=null!=e.linkURL?String(e.linkURL).trim():"",c=Array.isArray(e.overlayItems)?e.overlayItems:[],d=c.some(e=>""!==String(e?.text??"").trim()),u=String(e.overlayText??"").trim(),p=Boolean(e.textOverlayEnabled)&&(d||""!==u)&&a,m=`${e.styleConfig?.desktop||""};max-width:100%;display:inline-block;vertical-align:top;`;let g=`<img src="${i}" alt="${r}" style="${m}" ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""}/>`;if(p){const t=fn(yn(e.overlayPosition)),n=Object.entries({position:"absolute",...t,"z-index":"2","max-width":`${"number"==typeof e.overlayMaxWidth?e.overlayMaxWidth:100}%`,"box-sizing":"border-box","pointer-events":"none"}).map(([e,t])=>`${e}:${t};`).join(""),a="number"==typeof e.overlayPadding?e.overlayPadding:16,l=e.textShadowEnabled?"text-shadow:0 1px 3px rgba(0,0,0,0.55);":"";let s="";if(d){const t="number"==typeof e.overlayItemGap?e.overlayItemGap:8,n=c.filter(e=>String(e?.text??"").trim()).map(e=>{const t="number"==typeof e.fontSize?e.fontSize:16,n=Fn(e.color||"#ffffff"),a=(e=>{switch(e){case"h1":case"h2":case"h3":return"700";case"subtitle":case"eyebrow":return"600";default:return"400"}})(e.kind),i=null!=e.fontFamily&&""!==String(e.fontFamily).trim()?String(e.fontFamily).trim():String(o?.styles?.fontFamily||"sans-serif").trim()||"sans-serif",r=Fn(i),s=Mn(String(e.text??""));return`<div style="color:${n};font-size:${t}px;font-weight:${a};line-height:1.35;font-family:${r};${l}">${s}</div>`});s=`<div style="display:flex;flex-direction:column;gap:${t}px;width:100%;padding:${a}px;">${n.join("")}</div>`}else s=`<div style="color:${Fn(e.overlayTextColor||"#ffffff")};font-size:${"number"==typeof e.overlayFontSize?e.overlayFontSize:18}px;font-weight:600;line-height:1.35;${e.overlayBoxBackground?`background-color:${Fn(e.overlayBoxBackground)};padding:8px 12px;`:`padding:${a}px;`}${l}">${Mn(u)}</div>`;g=`<div style="position:relative;display:inline-block;vertical-align:top;max-width:100%;overflow:hidden;line-height:0;">\n ${e.scrimEnabled?'<div style="position:absolute;left:0;top:0;width:100%;height:100%;z-index:1;pointer-events:none;background:linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0.12), transparent 55%);"></div>':""}\n <img src="${i}" alt="${r}" style="${m}position:relative;z-index:0;border-radius:0;" ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""}/>\n <div style="${n}">\n ${s}\n </div>\n </div>`}const h=qt(e)&&""!==s?`<a href="${Fn(Un(s))}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;display:inline-block;max-width:100%;">${g}</a>`:g,b=e.imageHostMarginStyleConfig,y=b&&(b.desktop||b.mobile)?`<div ${b.mobile?`class="${b.className}"`:""} style="display:inline-block;vertical-align:top;max-width:100%;${b.desktop||""}">${h}</div>`:h;return`<div ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""} \n style="${Hn(e)}">\n ${y}\n </div>`})(e,n,null!=o?{columnIndex:a??0,columnProduct:o?.columnProducts?.[l??0]??null}:r,t)}if("video"===e.key&&(i+=(e=>{const t=null!=e.videoUrl?String(e.videoUrl).trim():"",n=_n(t,null!=e.thumbnailUrl?String(e.thumbnailUrl).trim():""),o=t?Un(t):"#",a=`${e.styleConfig?.desktop||""};max-width:100%;height:auto;display:block;border:0;`,l=e.contentStyleConfig?.desktop||"",i=e.videoAreaStyleConfig?.desktop||"";return`<div ${e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:""} style="${l}">\n <div ${e.videoAreaStyleConfig?.mobile?`class="${e.videoAreaStyleConfig.className}"`:""} style="${i}">\n ${n?`<a href="${Fn(o)}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;display:inline-block;max-width:100%;line-height:0;"><img src="${Fn(n)}" alt="${Fn("Video")}" style="${a}"/></a>`:`<a href="${Fn(o)}" target="_blank" rel="noopener noreferrer" style="display:inline-block;padding:14px 18px;background:#eeeeee;color:#333333;font-family:Arial,Helvetica,sans-serif;font-size:14px;font-weight:600;text-decoration:none;border-radius:4px;">Watch video</a>`}\n </div>\n</div>`})(e)),"button"===e.key){i+=Jn(e,n,null!=o?{columnIndex:a??0,columnProduct:o?.columnProducts?.[l??0]??null}:r,o)}var c,d;"divider"===e.key&&(i+=`<div ${(c=e).contentStyleConfig.mobile?`class="${c.contentStyleConfig.className}"`:""} \n style="${c.contentStyleConfig.desktop}">\n <div ${c.styleConfig.mobile?`class="${c.styleConfig.className}"`:""} \n style="${c.styleConfig.desktop}"></div>\n </div>`),"spacer"===e.key&&(i+=(d=e,`<div ${d.contentStyleConfig?.mobile?`class="${d.contentStyleConfig.className}"`:""} \n style="${d.contentStyleConfig?.desktop||""}">\n <div ${d.styleConfig?.mobile?`class="${d.styleConfig.className}"`:""} \n style="${d.styleConfig?.desktop||""}"></div>\n </div>`)),"menu"===e.key&&(i+=(e=>{const t=e.list||[],n=null!=e.separator?String(e.separator):" | ",o=e.styleConfig?.desktop||"",a=e.contentStyleConfig?.desktop||"",l=e.linkGapPx,i="number"==typeof l&&Number.isFinite(l)&&l>=0?l:0,r=Boolean(e.linkUnderline),s=e.styles?.desktop??{},c=null!=s.fontSize&&Number.isFinite(Number(s.fontSize))?`${Number(s.fontSize)}px`:"14px",d=null!=s.color&&""!==String(s.color).trim()?String(s.color):"#333333";let u="";return t.forEach((e,t)=>{t>0&&(u+=`<span style="${i>0?`display:inline-block;margin-left:${i}px;margin-right:${i}px;font-size:${c};color:${d};`:`display:inline-block;padding-left:4px;padding-right:4px;font-size:${c};color:${d};`}">${Mn(n)}</span>`);const a=Un(e.url,"#"),l="_blank"===e.target?"_blank":"_self",s=Mn(e.label||"Link"),p=r?"underline":"none";u+=`<a target="${l}" href="${Fn(a)}" style="${o};text-decoration:${p};display:inline-block;">${s}</a>`}),`<div ${e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:""} style="${a}">${u}</div>`})(e)),"avatar"===e.key&&(i+=(e=>{const t=e.src||"",n=e.alt||"Avatar",o=e.linkURL,a=e.styleConfig?.desktop||"",l=e.styles?.desktop?.width??64,i=`max-width:100%;width:${"number"==typeof l?l+"px":l};height:${"number"==typeof l?l+"px":l};object-fit:cover;border-radius:${e.styles?.desktop?.borderRadius??"50%"};${a}`,r=Fn(t),s=Fn(n),c=t?`<img src="${r}" alt="${s}" style="${i}" />`:`<div style="${i};background:#eee;display:flex;align-items:center;justify-content:center;"></div>`,d=e.contentStyleConfig?.desktop||"",u=o?`<a href="${Fn(Un(o))}" target="_blank" rel="noopener noreferrer">${c}</a>`:c;return`<div ${e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:""} style="${d}">${u}</div>`})(e)),"social_link"===e.key&&(i+=Yn(e)),"raw_html"===e.key&&(i+=(e=>{const t=function(e){const t=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i);return t?t[1]:/<html[\s>]/i.test(e)||/<!DOCTYPE/i.test(e)?e.replace(/<!DOCTYPE[^>]*>/gi,"").replace(/<html[^>]*>/gi,"").replace(/<\/html>/gi,"").replace(/<head[\s\S]*?<\/head>/gi,"").replace(/<\/?body[^>]*>/gi,"").trim():e}(e.html??""),n=e.contentStyleConfig?.desktop??"",o=e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:"",a=e.contentStyles?.desktop??{},l=a.width,i=a.textAlign??"center";let r="";return null!=l&&"100%"!==String(l)&&"center"===i?r="margin-left:auto;margin-right:auto;":null!=l&&"100%"!==String(l)&&"right"===i?r="margin-left:auto;margin-right:0;":null==l||"100%"===String(l)||"left"!==i&&"justify"!==i||(r="margin-left:0;margin-right:auto;"),`<div ${o} style="${r}max-width:100%;${n}">${t}</div>`})(e)),"table"===e.key&&(i+=(e=>{const t=e.contentStyleConfig?.desktop||"",n=e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:"",o=e.styles?.desktop??{},a="number"==typeof e.rows?e.rows:3,l="number"==typeof e.cols?e.cols:3,i=Boolean(e.headerRow),r=Boolean(e.headerCol),s=Boolean(e.stripedRows),c=o.fontSize??14,d=o.color??"#333333",u=o.borderStyle??"solid",p=o.borderWidth??1,m=o.borderColor??"#e0e0e0",g=o.cellPadding??8,h=o.textAlign??"left",b=o.headerBg??"#f5f5f5",y=o.headerColor??"#333333",f=o.stripedBg??"#fafafa",_="none"!==u?`${p}px ${u} ${m}`:"none",k=Array.from({length:a}).map((t,n)=>`<tr>${Array.from({length:l}).map((t,o)=>{const a=i&&0===n||r&&0===o,l=a?b:s&&!a&&n%2==0?f:"transparent",u=a?y:d,p=a?"600":"400",m=`${n}-${o}`,k=e.cells?.[m],x=i&&0===n||r&&0===o?"th":"td";let v="—";return"image"===k?.type&&String(k.src??"").trim()?v=`<img src="${Fn(k.src)}" alt="${Fn(k.alt||"")}" style="max-width:100%;height:auto;display:block;border:0;"/>`:String(k?.text??"").trim()&&(v=Mn(String(k.text))),`<${x} style="border:${_};padding:${g}px;font-size:${c}px;color:${u};text-align:${h};background-color:${l};font-weight:${p};vertical-align:top;">${v}</${x}>`}).join("")}</tr>`).join("");return`<div ${n} style="${t}"><table role="presentation" style="${e.styleConfig?.desktop||""};border-collapse:collapse;width:100%;table-layout:auto;"><tbody>${k}</tbody></table></div>`})(e))}),i},Zn={preHeader:"",contentWidth:600,contentWidthMode:"email_width",stackColumnsOnMobile:!0,scaleFontOnMobile:!0,styles:{backgroundColor:"#F5F5F5",contentBg:"#FFFFFF",color:"#171717",headingColor:"#171717",linkColor:"#338AF3",fontFamily:"'Overused Grotesk', ui-sans-serif, system-ui, sans-serif"}},Qn=e=>Array.isArray(e)?e.filter(e=>!(e&&"object"==typeof e&&!0===e.hidden)).map(e=>e&&"object"==typeof e&&Array.isArray(e.children)?{...e,children:Qn(e.children)}:e):e,eo=({bodySettings:e,blockList:t,templateData:n})=>{let o="";const a=((e,t)=>{if(!Array.isArray(e))return e;const n=t?.content?.products;if(!Array.isArray(n)||0===n.length)return e;const o=t?.content?.primaryProductId,a=(o?n.find(e=>e?.id===o):n[0])??n[0]??null;if(!a)return e;const l=n.filter(e=>e?.id!==a.id),i=e=>{if(!e||"object"!=typeof e)return e;const t=Array.isArray(e.children)?e.children.map(i):e.children;if("column"!==e.key||"product"!==e.containerType)return{...e,children:t};const n="additional"===e.productRole?"additional":"main",o=Math.max(Array.isArray(t)?t.length:0,Array.isArray(e.columnProducts)?e.columnProducts.length:0,1),r=Array.from({length:o},(e,t)=>"main"===n||0===l.length?a:l[t%l.length]);return{...e,children:t,columnProducts:r}};return e.map(i)})(Qn(t??[]),n),{newBlockList:l,styles:i}=Wn(a);o=Xn(l,e,n);const r=rn(a,e,n);return`<html>\n <head>\n <meta charset="UTF-8">\n <title>email</title>\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style type="text/css">\n *{\n margin: 0;\n padding: 0;\n border: none;\n box-sizing: border-box;\n }\n\n html,body {\n height:100%;\n overflow-y:auto;\n }\n\n table {\n width: 100%;\n color:unset;\n }\n\n table, tr, td {\n vertical-align: top;\n border-collapse: collapse;\n }\n\n h1,h2,h3,h4 {\n display: block;\n margin-block-start: 0px;\n margin-block-end: 0px;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n font-weight: bold;\n ${e.styles?.headingColor?`color: ${e.styles.headingColor};`:""}\n }\n\n a {\n ${e.styles?.linkColor?`color: ${e.styles.linkColor};`:""}\n }\n\n @media(max-width:620px){\n${!1!==e.stackColumnsOnMobile?" td {\n display:inline-block;\n width:100% !important;\n }\n":""}${!1!==e.scaleFontOnMobile?" body { font-size: 16px !important; }\n":""} }\n ${r}\n ${i}\n</style>\n </head>\n <body>\n <div style="opacity:0;">${e.preHeader}</div>\n <div style="background-color:${e.styles.backgroundColor};color:${e.styles.color}; font-family:${e.styles.fontFamily};"> ${o}</div>\n </body>\n </html>`};function to(e){let t=e;if("string"==typeof e)try{t=JSON.parse(e)}catch(e){throw new Error("exportNormalizerToHtml: invalid JSON")}if(null==t)throw new Error("exportNormalizerToHtml: input is null or undefined");let n=[],o={...Zn,styles:{...Zn.styles}};Array.isArray(t)?n=t:"object"==typeof t&&(n=Array.isArray(t.blockList)?t.blockList:[],t.bodySettings&&"object"==typeof t.bodySettings&&(o={preHeader:null!=t.bodySettings.preHeader?t.bodySettings.preHeader:Zn.preHeader,contentWidth:G(t.bodySettings.contentWidth??Zn.contentWidth),contentWidthMode:t.bodySettings.contentWidthMode??Zn.contentWidthMode,stackColumnsOnMobile:!1!==t.bodySettings.stackColumnsOnMobile,scaleFontOnMobile:!1!==t.bodySettings.scaleFontOnMobile,styles:{backgroundColor:t.bodySettings.styles?.backgroundColor??Zn.styles.backgroundColor,contentBg:t.bodySettings.styles?.contentBg??Zn.styles.contentBg,color:t.bodySettings.styles?.color??Zn.styles.color,headingColor:t.bodySettings.styles?.headingColor??Zn.styles.headingColor,linkColor:t.bodySettings.styles?.linkColor??Zn.styles.linkColor,fontFamily:t.bodySettings.styles?.fontFamily??Zn.styles.fontFamily}}));return`<!DOCTYPE html>\n${function(e){return e.replace(/\n/g," ").replace(/[ \t]{2,}/g," ").replace(/> </g,"><").trim()}(eo({bodySettings:o,blockList:n,templateData:t.templateData}))}`}function no(e,t){if("section"===e.layoutRole||"columns"===e.layoutRole)return e.layoutRole;if(!0===e.columnLayoutOnly)return"columns";return t.length>1||e.type&&"full"!==e.type?"columns":"section"}const oo=["product"];function ao(e){return Array.isArray(e)?e:e&&"object"==typeof e?Object.values(e):[]}function lo(e,t={}){if(!e||"object"!=typeof e)return e;if("image"===e.key){const n="string"==typeof e.imageVariable&&/^\{\{\w+\}\}$/.test(e.imageVariable.trim())?e.imageVariable.trim():"",o="string"==typeof e.src&&/^\{\{\w+\}\}$/.test(e.src.trim())?e.src.trim():"",{imageVariable:a,...l}=e;return{...l,src:o||n||e.src,textOverlayEnabled:Boolean(e.textOverlayEnabled),overlayText:e.overlayText??"",overlayPosition:e.overlayPosition??"bc",overlayTextColor:e.overlayTextColor??"#ffffff",overlayFontSize:(()=>{const t=Number(e.overlayFontSize);return Number.isFinite(t)&&t>0?t:18})(),overlayBoxBackground:e.overlayBoxBackground??"",overlayPadding:(()=>{const t=Number(e.overlayPadding);return Number.isFinite(t)&&t>=0?t:16})(),scrimEnabled:Boolean(e.scrimEnabled),textShadowEnabled:Boolean(e.textShadowEnabled),children:ao(e.children).map(e=>lo(e,t))}}if("video"===e.key){const t=e.videoArea||{},n=t.desktop||{};return{...e,videoUrl:"string"==typeof e.videoUrl?e.videoUrl:"",thumbnailUrl:"string"==typeof e.thumbnailUrl?e.thumbnailUrl:"",videoArea:{desktop:{paddingTop:n.paddingTop??0,paddingBottom:n.paddingBottom??0,paddingLeft:n.paddingLeft??0,paddingRight:n.paddingRight??0,backgroundColor:n.backgroundColor??"transparent",borderWidth:n.borderWidth??0,borderStyle:n.borderStyle??"solid",borderColor:n.borderColor??"#cccccc",borderRadius:n.borderRadius??0},mobile:t.mobile??{}},styles:{desktop:{width:"auto",height:"auto",fillColumn:!1,fillColumnMobile:!1,display:"inline-block",...e.styles?.desktop||{}},mobile:{...e.styles?.mobile||{}}},contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center",backgroundColor:"transparent",...e.contentStyles?.desktop||{}},mobile:{...e.contentStyles?.mobile||{}}}}}if("column"===e.key){const{ctaText:n,container_type:o,...a}=e,l=function(e){if(!e||"object"!=typeof e)return null;const t=null!=e.containerType&&""!==e.containerType?e.containerType:e.container_type;return null==t||""===t?null:"string"!=typeof t?String(t).trim().toLowerCase()||null:t.trim().toLowerCase()}(e),i=l??e.containerType??null;let r=function(e){const t=null==e?null:String(e).trim().toLowerCase();return null==t||""===t||"none"===t?"none":"discount"===t?"discount":"header"===t?"header":"footer"===t?"footer":"product"===t||"hero_product"===t||"additional_product"===t?"product":"none"}(l??e.containerType);if("none"===r){const t=function(e){if(!e||"column"!==e.key)return null;if(!0===e.footerUnifiedLayout)return"footer";if(Array.isArray(e.footerSocialList)&&e.footerSocialList.length>0)return"footer";if(void 0!==e.showFooterBanner)return"footer";let t=!1,n=!1;const o=e=>{e&&"object"==typeof e&&((e.headerLogoSlot||e.headerBannerSlot||e.headerBannerDividerSlot)&&(t=!0),null!=e.footerSlot&&""!==String(e.footerSlot).trim()&&(n=!0),ao(e.children).forEach(o))};return o(e),n?"footer":void 0!==e.showLogo||void 0!==e.showHeaderBanner||t?"header":null}(e);t&&(r=t)}const s="string"==typeof i?i.trim().toLowerCase():"",c="product"===r?e.productRole??("additional_product"===s?"additional":"main"):void 0,d=ao(e.children);let u=e.columnProducts;if(oo.includes(r)){const e=d.length;Array.isArray(u)||(u=[]),u=Array.from({length:e},(e,t)=>u[t]??null)}else u=[];return{...a,containerType:r,productRole:c,columnProducts:u,layoutRole:no(e,d),children:(d||[]).map(e=>lo(e,t))}}if("heading"===e.key){const n=e.id?t?.[e.id]:null,o={...e,key:"text",name:e.name,type:e.type||"h1",contentType:e.contentType??"static",text:e.text,styles:e.styles,contentStyles:e.contentStyles,selectedVariableKey:e.selectedVariableKey,dynamicVariable:n?.variable??e.dynamicVariable,dynamicPrompt:n?.prompt??e.dynamicPrompt,dynamicSelectedContent:n?.selectedContent??e.dynamicSelectedContent,dynamicOptions:Array.isArray(n?.options)?n.options:n?.selectedContent?[n.selectedContent]:e.dynamicOptions};return"dynamic"===o.contentType&&(o.dynamicVariable=o.dynamicVariable??"",o.dynamicPrompt=o.dynamicPrompt??"",o.dynamicSelectedContent=o.dynamicSelectedContent??"",o.dynamicOptions=Array.isArray(o.dynamicOptions)?o.dynamicOptions:[],o.dynamicAiLanguage="bn-BD"===n?.language||"bn-BD"===o.dynamicAiLanguage?"bn-BD":"en"),{...o,children:ao(e.children).map(e=>lo(e,t))}}if("text"===e.key){const n=e.id?t?.[e.id]:null,o=e.contentType??"static",a={...e,type:e.type||"p",contentType:o};return"dynamic"===o&&(a.dynamicVariable=n?.variable??e.dynamicVariable??"",a.dynamicPrompt=n?.prompt??e.dynamicPrompt??"",a.dynamicSelectedContent=n?.selectedContent??e.dynamicSelectedContent??"",a.dynamicOptions=Array.isArray(n?.options)?n.options:n?.selectedContent?[n.selectedContent]:Array.isArray(e.dynamicOptions)?e.dynamicOptions:[],a.dynamicAiLanguage="bn-BD"===n?.language||"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"),{...a,children:ao(e.children).map(e=>lo(e,t))}}return{...e,children:ao(e.children).map(e=>lo(e,t))}}const io="https://api-alpha.markopolo.ai/v1",ro="https://nbq-ml-api-stg.markopolo.ai/v1",so="95b48b5b-cf5e-486d-817e-9839d4c4e618";function co(e,t){const n=null!=(o=e)&&"string"==typeof o&&o.trim()?o.replace(/\/$/,""):io;var o;const a=function(e){return null!=e&&"string"==typeof e&&e.trim()?e.replace(/\/$/,""):ro}(t);return{imageUploadEndpoint:`${n}/upload-file`,imageUploadQueryParams:{show:!1},imageUploadCompanyField:"comment",productsEndpoint:`${n}/knowledge-base/products`,universalEmailBlocksEndpoint:`${n}/universal-email-blocks`,mlEmailNodesEndpoint:`${a}/ml-service/content/generate-email-nodes`,mlEmailGenerateEndpoint:`${a}/ml-service/content/generate-email`}}function uo(e={}){const t=e&&"object"==typeof e?e:{},{apiBaseUrlV1:n,apiBaseV1:o,mlGenerationApiBaseUrlV1:a,mlApiBaseUrlV1:l,headers:i,mlEmailGenerateBnEndpoint:r,...s}=t,c=n||o||io,d="undefined"!=typeof process&&process.env?.REACT_APP_ML_API_BASE_V1,u=co(c,a||l||d||ro),p="undefined"!=typeof process?String(process.env?.REACT_APP_EMAIL_TEMPLATE_ID??"").trim():"",m={...u,...s};m.mlEmailGenerateEndpoint&&String(m.mlEmailGenerateEndpoint).trim()||!r||(m.mlEmailGenerateEndpoint=String(r).replace(/\/generate-email\/bn\/?$/i,"/generate-email"));const g=String(m.emailTemplateId??"").trim()||p||so;return{...m,emailTemplateId:g,headers:{...m.headers||{},...i||{}}}}function po(e,t,n){const o=String(e??"").trim(),a=t&&"object"==typeof t?JSON.parse(JSON.stringify(t)):{name:"Block",key:"column"};a.name||(a.name="column"===a.key?"Container":o||"Block"),a.key||(a.key="column"),"column"===a.key&&Array.isArray(a.children)&&a.children.length>0&&delete a.cells;const l="column"===a.key?String(a.containerType??"none"):"none",i=function(e){if(!e||"object"!=typeof e)return"content";const t=String(e.key??"").toLowerCase();if("column"===t){const t=String(e.containerType??"none").toLowerCase();return"header"===t?"header":"footer"===t?"footer":"none"===t||""===t?"column":"content"}return"image"===t?"image":"menu"===t?"menu":"content"}(a),r="undefined"!=typeof performance&&performance.now?Math.floor(performance.now()):Date.now(),s=String(a.id??r).replace(/-/g,"").slice(0,12),c=`preset_${d=o,String(d??"").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"").slice(0,48)||"block"}_${s}`;var d;return{companyId:String(n),blockName:o,blockType:i,presetId:c,presetName:o,nameKey:c,containerType:l,block:a}}function mo(e,t){if(!e||"object"!=typeof e)return null!=t?`Request failed (${t})`:"Request failed";const n=e.error;if(n&&"object"==typeof n&&null!=n.message){const e=String(n.message).trim();if(e){const t=null!=n.code?String(n.code).trim():"";return t&&t!==e&&!e.toLowerCase().includes(t.toLowerCase())?`${t}: ${e}`:e}}return"string"==typeof n&&n.trim()?n.trim():"string"==typeof e.message&&e.message.trim()?e.message.trim():null!=t?`Request failed (${t})`:"Request failed"}function go(e){const t=e?.universalEmailBlocksEndpoint;if(t&&String(t).trim())return String(t).replace(/\/$/,"");const n=String(e?.apiBaseUrlV1||e?.apiBaseV1||"").replace(/\/$/,"");return n?`${n}/universal-email-blocks`:""}function ho(e){return{"Content-Type":"application/json",...e?.headers||{}}}function bo(e){if(!e||"object"!=typeof e)return null;const t=e.resourceId??e.id;if(!t)return null;let n=e.block;if("string"==typeof n)try{n=JSON.parse(n)}catch{n=null}n&&"object"==typeof n||(n={});const o=e.blockMap??e.blocks??e.blockSnapshotMap;if("column"===n.key&&o&&"object"==typeof o){const e=Array.isArray(o)?o.reduce((e,t)=>(t&&"object"==typeof t&&t.id&&(e[t.id]=t),e),{}):{...o};Object.keys(e).length>0&&(n={...n,blockMap:e})}return{id:t,name:e.blockName??e.name??"Saved block",block:n,resourceId:e.resourceId??t,blockType:e.blockType}}const yo={preHeader:"",contentWidth:600,stackColumnsOnMobile:!0,scaleFontOnMobile:!0,styles:{backgroundColor:"#F5F5F5",contentBg:"#FFFFFF",color:"#171717",headingColor:"#171717",linkColor:"#338AF3",fontFamily:"'Overused Grotesk', ui-sans-serif, system-ui, sans-serif"}};function fo(e){const t=String(e??"").trim();return/^\{\{[A-Za-z_]\w*\}\}$/.test(t)}const _o=/^\s*\{\{[\s\S]*\}\}\s*$/;function ko(e){const t=String(e??"").trim();if(!t)return!1;if("#"===t)return!1;if(t.startsWith("#")&&t.length>1)return!1;if(_o.test(t))return!1;if(fo(t))return!1;const n=t.toLowerCase();return!n.startsWith("http://")&&!n.startsWith("https://")&&(!n.startsWith("mailto:")&&!n.startsWith("tel:")&&!n.startsWith("//"))}function xo(e){if(!e||"object"!=typeof e)return"";return`${e.severity??"unknown"}:${e.code??"issue"}:${e.blockId??"global"}:${e.location??""}`}function vo(e){let t=!1;const n=e=>{if(Array.isArray(e))for(const o of e)o&&"object"==typeof o&&("text"===o.key&&"dynamic"===o.contentType&&"bn-BD"===o.dynamicAiLanguage&&(t=!0),Array.isArray(o.children)&&n(o.children))};return n(Array.isArray(e)?e:[]),t?"bn-BD":"en"}function wo(e,t=!1){if(null==e||""===String(e).trim())return t;const n=String(e).trim();try{return/^https?:\/\//i.test(n)?new URL(n):new URL("https://"+n),!0}catch{return!1}}const So={text:"Text",heading:"Heading",button:"Button",image:"Image",video:"Video",avatar:"Profile image",menu:"Menu",social_link:"Social links",raw_html:"HTML"};const jo={none:"Container",product:"Product",discount:"Discount",header:"Header",footer:"Footer",navigation_bar:"Navigation",introduction:"Introduction",hero:"Hero",hero_product:"Hero product",body:"Body",additional_product:"Additional product"};function Co(e,t,n){const o=e.containerType??"none",a=function(e){const t=e??"none";return jo[t]?jo[t]:String(t).replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}(o);return n<=1?a:"none"===o?`${No(t+1)} section`:`${No(t+1)} ${a} block`}function No(e){const t=e%10,n=e%100;return 1===t&&11!==n?`${e}st`:2===t&&12!==n?`${e}nd`:3===t&&13!==n?`${e}rd`:`${e}th`}function Io(e,t,n){const o=function(e){return So[e]?So[e]:String(e||"block").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}(t),a=[...e],l=a.length>0?a.join(" → "):"Email body";return n?`${o} ("${n}") — ${l}`:`${o} — ${l}`}function Ao(e,t){const n=function(e){return null==e||"object"!=typeof e?{...yo,styles:{...yo.styles}}:{preHeader:null!=e.preHeader?e.preHeader:yo.preHeader,contentWidth:G(null!=e.contentWidth?e.contentWidth:yo.contentWidth),stackColumnsOnMobile:!1!==e.stackColumnsOnMobile,scaleFontOnMobile:!1!==e.scaleFontOnMobile,styles:{backgroundColor:null!=e.styles?.backgroundColor?e.styles.backgroundColor:yo.styles.backgroundColor,contentBg:null!=e.styles?.contentBg?e.styles.contentBg:yo.styles.contentBg,color:null!=e.styles?.color?e.styles.color:yo.styles.color,headingColor:null!=e.styles?.headingColor?e.styles.headingColor:yo.styles.headingColor,linkColor:null!=e.styles?.linkColor?e.styles.linkColor:yo.styles.linkColor,fontFamily:null!=e.styles?.fontFamily?e.styles.fontFamily:yo.styles.fontFamily}}}(e);("number"!=typeof n.contentWidth||!Number.isFinite(n.contentWidth)||n.contentWidth<=0)&&t.push({severity:"error",code:"body_content_width_invalid",message:"Body content width must be between 280 and 1200 px.",location:"Theme settings"});const o=n.styles;null!=o.backgroundColor&&""!==String(o.backgroundColor).trim()||t.push({severity:"error",code:"body_background_color_missing",message:"Theme background color is missing.",location:"Theme settings"}),null!=o.color&&""!==String(o.color).trim()||t.push({severity:"error",code:"body_text_color_missing",message:"Theme text color is missing.",location:"Theme settings"}),null!=o.fontFamily&&""!==String(o.fontFamily).trim()||t.push({severity:"error",code:"body_font_family_missing",message:"Theme font family is missing.",location:"Theme settings"})}function Lo(e,t){e.push(t)}function To(e){return null==e?"":String(e).replace(/&/gi,"&").replace(/"/gi,'"').replace(/'/g,"'").trim()}function Bo(e){if(null==e||"string"!=typeof e)return[];const t=[],n=/<a\b[^>]*?\bhref\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>"']+))/gi;let o=n.exec(e);for(;o;){const a=o[1]??o[2]??o[3]??"";t.push(To(a)),o=n.exec(e)}return t}function $o(e,t=!0){const n=String(e??"").trim();return n?fo(n)?null:m(n,!1,{allowMailtoTel:t}):null}function Ro(e,t,n){const o=e.linkURL,a=()=>Io(t,"button",void 0),l=e.id??null;null==o||""===String(o).trim()?Lo(n,{severity:"warning",code:"button_empty_link",message:'Button link URL is empty; will be saved as href="https://".',location:a(),blockId:l}):s(o)?Lo(n,{severity:"error",code:"button_blocked_scheme",message:"Button link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",location:a(),blockId:l}):fo(o)||p(o,!1,{allowMailtoTel:!0})?!fo(o)&&ko(o)&&Lo(n,{severity:"warning",code:"button_link_missing_protocol",message:"Button link should start with https://, http://, mailto:, or tel: for reliable email clients.",location:a(),blockId:l}):Lo(n,{severity:"warning",code:"button_invalid_link",message:"Button link URL format is invalid.",location:a(),blockId:l}),function(e,t,n,o,{invalidCode:a,invalidMessage:l,blockedCode:i,blockedMessage:r,missingProtocolCode:c,missingProtocolMessage:d}){Bo(e??"").forEach((e,u)=>{const m=String(e??"").trim();""!==m&&(s(m)?Lo(t,{severity:"error",code:i,message:r,location:n(u),blockId:o}):p(m,!1,{allowMailtoTel:!0})?ko(m)&&Lo(t,{severity:"warning",code:c,message:d,location:n(u),blockId:o}):Lo(t,{severity:"warning",code:a,message:l,location:n(u),blockId:o}))})}(e.text,n,e=>Io(t,"button",`label link ${e+1}`),l,{invalidCode:"button_label_invalid_link",invalidMessage:"Button label link URL format is invalid.",blockedCode:"button_label_blocked_link_scheme",blockedMessage:"Button label link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",missingProtocolCode:"button_label_link_missing_protocol",missingProtocolMessage:"Button label link should start with https://, http://, mailto:, or tel: for reliable email clients."})}const Po=["product"];function Mo(e,t,n,o,a){(function(...e){const t=new Set,n=[];for(const o of e)if(null!=o&&""!==String(o).trim())for(const e of Bo(String(o))){const o=String(e).trim();o&&!t.has(o)&&(t.add(o),n.push(e))}return n})(e.text,e.dynamicSelectedContent).forEach((a,l)=>{const i=String(a??"").trim();""!==i&&(i.startsWith("#")||_o.test(i)||(s(i)?Lo(n,{severity:"error",code:"text_blocked_link_scheme",message:"Text link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",location:Io(t,o,`link ${l+1}`),blockId:e.id??null}):p(i,!1,{allowMailtoTel:!0})?ko(i)&&Lo(n,{severity:"warning",code:"text_link_missing_protocol",message:"Text link should start with https://, http://, mailto:, or tel: for reliable email clients.",location:Io(t,o,`link ${l+1}`),blockId:e.id??null}):Lo(n,{severity:"warning",code:"text_invalid_link",message:"Text link URL format is invalid.",location:Io(t,o,`link ${l+1}`),blockId:e.id??null})))});if("dynamic"!==(e.contentType??"static"))return;const l=e.dynamicSelectedContent,i=null!=e?.id?a?.[e.id]?.selectedContent:void 0;let r=null!=l&&""!==String(l).trim()?l:i;var c;null!=r&&""!==String(r).trim()||null==e.text||""===(null==(c=e.text)?"":String(c).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim())||(r=e.text),null!=r&&""!==String(r).trim()||Lo(n,{severity:"warning",code:"dynamic_content_empty",message:"Dynamic content not generated; export will use static text if available.",location:Io(t,o,void 0),blockId:e.id??null})}function Fo(e,t,n){const o=e.list||[],a=new Set;o.forEach((o,l)=>{const i=o.title||o.image||`link ${l+1}`,r=e=>Io(t,"social_link",e||i),c=function(e){const t=String(e?.image||"").trim();if(t)return`img:${t}`;const n=String(e?.title||"").trim().toLowerCase();return n?`title:${n}`:null}(o);c&&(a.has(c)?Lo(n,{severity:"warning",code:"social_duplicate_platform",message:"Duplicate social platform in this block; only one entry per platform should be kept.",location:r(i),blockId:e.id??null}):a.add(c));const d=o.linkURL;if(null==d||""===String(d).trim()){const t=String(o?.title||"").trim()||`Item ${l+1}`;Lo(n,{severity:"warning",code:"social_empty_link",message:`${t} URL is empty — add https URL before sending; the icon still previews without an outbound link.`,location:r(i),blockId:e.id??null})}else s(d)?Lo(n,{severity:"error",code:"social_blocked_scheme",message:"Social link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s) URLs only (e.g. www.example.com or https://…).",location:r(i),blockId:e.id??null}):p(d,!1,{allowMailtoTel:!1})||Lo(n,{severity:"warning",code:"social_invalid_link",message:"Social link URL format is invalid.",location:r(i),blockId:e.id??null});const u=o.image;null==u||""===String(u).trim()?Lo(n,{severity:"warning",code:"social_empty_icon",message:"Social link icon URL is empty; icon will not display.",location:r(i),blockId:e.id??null}):wo(u,!1)||Lo(n,{severity:"warning",code:"social_invalid_icon",message:"Social link icon URL format is invalid.",location:r(i),blockId:e.id??null})}),0===o.length&&Lo(n,{severity:"info",code:"social_no_links",message:"Social link block has no links.",location:Io(t,"social_link",void 0),blockId:e.id??null})}function Uo(e,t,n,o,a){if(!Array.isArray(e))return;const l=e.length;e.forEach((e,i)=>{if(!e||"object"!=typeof e)return;if(!0===e.hidden)return;const r=e.key;if("column"===r){const r=Co(e,i,l),s=[...t,r];return function(e,t,n){const o=e.containerType??"none";if(!Po.includes(o))return;const a=e.children??[],l=e.columnProducts??[];a.forEach((o,i)=>{const r=l[i];if(null==r||"object"==typeof r&&!r.id){const o=a.length>1?`Column ${i+1} of ${a.length}`:"This column",l=[...t,o].join(" → ");Lo(n,{severity:"warning",code:"container_product_not_assigned",message:"A product is not assigned to this column; assign a product in Container settings.",location:l,blockId:e.id??null})}})}(e,s,n),void(Array.isArray(e.children)&&Uo(e.children,s,n,o,a))}if("content"===r){const r=l>1?`Column ${i+1} of ${l}`:null,s=r?[...t,r]:t;return void(Array.isArray(e.children)&&Uo(e.children,s,n,o,a))}switch(r){case"image":!function(e,t,n){const o=e.src,a=()=>Io(t,"image",void 0);null!=o&&""!==String(o).trim()?(wo(o,!1)||Lo(n,{severity:"warning",code:"image_invalid_src",message:"Image URL format is invalid.",location:a(),blockId:e.id??null}),qt(e)&&$o(e.linkURL,!0)&&Lo(n,{severity:"warning",code:"image_invalid_link",message:"Image link URL format is invalid.",location:a(),blockId:e.id??null}),null!=e.alt&&""!==String(e.alt).trim()||Lo(n,{severity:"info",code:"image_empty_alt",message:"Image alt text is empty; consider adding for accessibility.",location:a(),blockId:e.id??null})):Lo(n,{severity:"error",code:"image_empty_src",message:"Image URL is empty; the image will not display.",location:a(),blockId:e.id??null})}(e,t,n);break;case"video":!function(e,t,n){const o=()=>Io(t,"video",void 0),a=null!=e.videoUrl?String(e.videoUrl).trim():"";a?wo(a,!1)||Lo(n,{severity:"warning",code:"video_invalid_url",message:"Video URL format may be invalid.",location:o(),blockId:e.id??null}):Lo(n,{severity:"error",code:"video_empty_url",message:"Video URL is empty; the video will not display.",location:o(),blockId:e.id??null})}(e,t,n);break;case"avatar":!function(e,t,n){const o=e.src,a=()=>Io(t,"avatar",void 0);null==o||""===String(o).trim()?Lo(n,{severity:"warning",code:"avatar_empty_src",message:"Avatar image URL is empty; avatar will not display.",location:a(),blockId:e.id??null}):wo(o,!1)||Lo(n,{severity:"warning",code:"avatar_invalid_src",message:"Avatar image URL format is invalid.",location:a(),blockId:e.id??null}),$o(e.linkURL,!0)&&Lo(n,{severity:"warning",code:"avatar_invalid_link",message:"Avatar link URL format is invalid.",location:a(),blockId:e.id??null})}(e,t,n);break;case"button":Ro(e,t,n);break;case"menu":!function(e,t,n){const o=e.list||[];o.forEach((o,a)=>{const l=String(o.label??"").trim()||`Item ${a+1}`,i=e=>Io(t,"menu",e||`Item ${a+1}`);null!=o.label&&""!==String(o.label).trim()||Lo(n,{severity:"info",code:"menu_empty_label",message:'Navigation link label is empty; will display as "Link".',location:i(`item ${a+1}`),blockId:e.id??null});const r=o.url;null==r||""===String(r).trim()?Lo(n,{severity:"warning",code:"menu_empty_url",message:`"${l}" link URL is empty; will be saved as href="#". Add a destination URL (e.g. https://example.com) before sending.`,location:i(l),blockId:e.id??null}):s(r)?Lo(n,{severity:"error",code:"menu_blocked_scheme",message:`"${l}" link uses a blocked URL scheme (javascript:, data:, etc.). Use https://, mailto:, or tel: only.`,location:i(l),blockId:e.id??null}):p(r,!1,{allowMailtoTel:!0})?!fo(r)&&ko(r)&&Lo(n,{severity:"warning",code:"menu_item_url_missing_protocol",message:`"${l}" link should start with https://, http://, mailto:, or tel: for reliable email client support.`,location:i(l),blockId:e.id??null}):Lo(n,{severity:"warning",code:"menu_invalid_url",message:`"${l}" link URL is not valid. Use a full URL starting with https://example.com.`,location:i(l),blockId:e.id??null})}),0===o.length&&Lo(n,{severity:"info",code:"menu_no_items",message:"Menu block has no items.",location:Io(t,"menu",void 0),blockId:e.id??null})}(e,t,n);break;case"social_link":Fo(e,t,n);break;case"raw_html":!function(e,t,n){const o=e.html;null!=o&&""!==String(o).trim()||Lo(n,{severity:"info",code:"raw_html_empty",message:"HTML block has no custom markup; export will include an empty wrapper.",location:Io(t,"raw_html",void 0),blockId:e.id??null})}(e,t,n);break;case"text":Mo(e,t,n,"text",a);break;case"heading":Mo(e,t,n,"heading",a)}})}function Do({blockList:e,bodySettings:t,aiContentRefs:n={}}){const o=[];return Ao(t,o),Uo(Array.isArray(e)?e:[],[],o,t,n),o}function Eo(){const e="undefined"!=typeof window&&null!=window?window:"undefined"!=typeof global&&null!=global?global:void 0;if(!e)return;const t=e.Image;return"function"==typeof t?t:void 0}const zo=/^\{\{\s*[\w.]+\s*\}\}$/;function Oo(e){if(null==e||""===String(e).trim())return null;const t=String(e).trim();if(function(e){return null!=e&&"string"==typeof e&&zo.test(e.trim())}(t))return null;if(/^https?:\/\//i.test(t))return wo(t,!1)?t:null;if(t.startsWith("//")){const e=`https:${t}`;return wo(e,!1)?e:null}return null}function Wo(e,t=[],n=e?.length??0){const o=[];return Array.isArray(e)?(e.forEach((e,a)=>{if(!e||"object"!=typeof e)return;if(!0===e.hidden)return;const l=e.key;if("column"===l){const l=Co(e,a,n),i=[...t,l],r=e.children;return void o.push(...Wo(r,i,r?.length??0))}if("content"===l){const l=n>1?`Column ${a+1} of ${n}`:null,i=l?[...t,l]:t,r=e.children;return void o.push(...Wo(r,i,r?.length??0))}if("image"===l){const n=Oo(e.src);n&&o.push({url:n,location:Io(t,"image",void 0),blockId:e.id??null})}}),o):o}function Ho(e,t=12e3){const n=Eo();if(!n)return Promise.resolve(!1);const o=String(e).trim();return o?new Promise(e=>{const a=new n;let l=!1;const i=t=>{l||(l=!0,clearTimeout(r),a.onload=null,a.onerror=null,e(t))},r=setTimeout(()=>i(!1),t);a.onload=()=>i(!0),a.onerror=()=>i(!1);try{a.src=o}catch{i(!1)}}):Promise.resolve(!1)}async function Ko(e,t={}){const{timeoutMs:n=12e3,concurrent:o=6}=t;if(!Eo())return[];const a=Wo(Array.isArray(e)?e:[]);if(0===a.length)return[];const l=new Map;for(const e of a)l.has(e.url)||l.set(e.url,[]),l.get(e.url).push(e.location);const i=[...l.keys()],r=new Map;let s=0;const c=Math.max(1,Math.min(o,i.length));await Promise.all(Array.from({length:c},()=>async function(){for(;s<i.length;){const e=s++,t=i[e],o=await Ho(t,n);r.set(t,o)}}()));const d=[];for(const[e,t]of l)if(!0!==r.get(e))for(const n of t)d.push({severity:"warning",code:"image_url_not_loadable",message:"Image URL could not be loaded or previewed; the link may be broken, expired, or blocked.",location:n,blockId:a.find(t=>t.url===e&&t.location===n)?.blockId??null});return d}async function Vo(e,t){return[...Do(e),...await Ko(e?.blockList??[],t)]}const Go=(...e)=>e.filter(Boolean).join(" ");function qo(e,t){const n=e[t];if(!n||"column"!==n.key)return[];const o=[];for(const t of n.cells||[])for(const n of t.childrenIds||[]){o.push(n);const t=e[n];"column"===t?.key&&o.push(...qo(e,n))}return o}function Jo(e,t,n){const o=e[n];if(!o)return null;const{containerBlock:a}=ne(e,t,n);if(!a?.id)return null;const l={...e};if("footer"===a.containerType&&!0!==a.footerUnifiedLayout){if(o.footerBannerSlot||o.footerBannerDividerSlot){l[a.id]={...a,showFooterBanner:!1};for(const t of qo(e,a.id)){const n=e[t];(n?.footerBannerSlot||n?.footerBannerDividerSlot)&&(l[t]={...n,hidden:!0})}return{nextBlockMap:l}}return o.footerSlot?(l[n]={...o,hidden:!0},{nextBlockMap:l}):null}if("header"===a.containerType){if(o.headerLogoSlot)return l[a.id]={...a,showLogo:!1},l[n]={...o,hidden:!0},{nextBlockMap:l};if(o.headerBannerSlot||o.headerBannerDividerSlot){l[a.id]={...a,showHeaderBanner:!1};for(const t of qo(e,a.id)){const n=e[t];(n?.headerBannerSlot||n?.headerBannerDividerSlot)&&(l[t]={...n,hidden:!0})}return{nextBlockMap:l}}return null}return null}const Yo={drag_block_here:"请将模块拖放到此处",drop_content_here:"将内容拖放到此处",drop_content_hint:"从左侧拖拽模块到此处,或单击插入。",drag_section_here:"将版块拖放到此处",blocks:"模块",photos:"图片",powered_by_pexels:"图片由Pexels提供",loading:"加载中...",content:"内容",typography:"排版",compliance_approx_kb:"约 {{n}} KB",styles:"样式",ai_powered:"AI 驱动",layout:"布局",components:"组件",presets:"预设",body_settings:"邮件主题设置",global:"全局",text_and_headings:"文本与标题",pre_header:"预标题",pre_header_description:"预标题是在收件箱中查看电子邮件时跟随主题行的简短摘要文本。",confirm:"确认",cancel:"取消",add_blocks:"请添加块",block_product:"产品",block_product_single:"单个",block_product_multi:"多个",block_discount:"折扣",product_output_layout:"输出布局",product_main_layout_stacked:"图片在上,详情在下",product_main_layout_image_left:"图片在左,详情在右",discount_variant_simple:"简洁(单行)",discount_variant_card:"卡片(标题 + 优惠码)",additional_products_grid_layout:"附加产品",additional_products_per_row:"每行产品数",product_row_count_2:"2 列",product_row_count_3:"3 列",block_introduction:"引言",block_body:"正文",block_header:"页眉",block_footer:"页脚",no_product_found:"未找到产品",no_products_matching_search:"没有符合搜索条件的产品。清空搜索可查看完整列表。",load_more_products:"加载更多",add_products:"添加产品",add_products_in_store:"请在店铺中添加产品。",column:"列",columns:"列排版",column_settings:"列设置",column_cells_section:"列单元格",column_wrapper_style:"外层样式",column_styles:"列样式",size_px:"尺寸",column_delete:"删除列",column_delete_desc:"您确定删除多余的{{count}}列吗?",block_palette_section:"版块",block_palette_columns:"分栏",settings_title_column_layout:"栏位设置",container:"版块",select_parent_section_tooltip:"父级版块设置 — 布局、间距与背景",container_settings:"版块设置",layers_panel:"图层",email_styles_section:"邮件样式",document_section:"文档",body_bg_color_short:"背景色",body_content_bg_short:"正文背景",body_width_label:"宽度",body_font_short:"字体",body_text_short:"正文",body_heading_short:"标题",body_link_short:"链接",type_styles_section:"文字",container_type:"版块类型",container_type_help:"决定该版块可用的变量和产品映射。",container_type_none:"默认",container_type_header:"页眉",container_type_discount:"折扣",container_type_introduction:"引言",container_type_body:"正文",container_type_product:"产品",container_type_hero_product:"主推产品",container_type_additional_product:"附加产品",container_type_footer:"页脚",product_role:"产品角色",product_role_main_hero:"主推产品",product_role_additional:"附加产品",product_column_select_label:"使用系统变量",product_column_select_placeholder:"搜索或选择产品",product_column_variables_heading:"产品字段变量",product_column_kb_heading:"知识库产品",product_column_kb_tooltip:"请在此从知识库目录中选择产品,用于决定该列在邮件中展示的商品。",text:"文本",text_content:"这是一个文本,点击修改文本",text_settings:"文本设置",text_styles:"文本样式",text_align:"文本对齐方式",heading:"标题",heading_content:"这是一个标题,点击修改标题",heading_settings:"标题设置",heading_type:"标题类型",button:"按钮",button_settings:"按钮设置",button_action:"点击按钮触发",button_styles:"按钮样式",button_padding:"按钮内边距",spacer:"间距",spacer_block:"间距块",spacer_settings:"间距设置",divider:"分割线",divider_settings:"分割线设置",divider_type:"分割线类型",divider_styles:"分割线样式",image:"图片",image_settings:"图片设置",image_crop_soon:"图片裁剪功能尚未开放。",crop:"裁剪",replace:"替换",delete:"删除",image_max_upload_size:"最大 10 MB",video:"视频",video_settings:"视频",video_tab_styles:"样式",video_tab_display:"显示",video_url:"视频地址",video_thumbnail_url:"自定义封面图 URL",video_thumbnail_url_placeholder:"留空则使用 YouTube 默认封面",video_export_note:"邮件客户端通常显示封面图链接,而不是内嵌播放器。",video_thumbnail_layout:"封面布局",video_width:"宽度 (W)",video_height:"高度 (H)",video_fill_column:"铺满列宽",video_fill_column_mobile:"移动端铺满列宽",alignment:"对齐",video_area_section:"视频区域",video_block_section:"区块",video_border_none:"无",image_action:"点击图片跳转",image_url:"图片URL",image_alt:"图片alt",image_alt_placeholder:"为屏幕阅读用户描述图片",image_styles:"图片样式",image_source:"图片来源",image_source_url:"输入URL",image_source_upload:"上传图片",image_upload:"上传",image_upload_click:"点击上传",image_upload_not_configured:"未配置图片上传。请在 apiConfig 中设置 imageUploadEndpoint,或传入 null 关闭;默认使用内置 API 根地址。",image_uploaded:"图片上传成功",image_upload_failed:"图片上传失败",image_upload_error:"上传图片时出错",image_upload_file_hint:"PNG、JPEG、GIF、SVG、WebP,最大 10 MB",image_upload_invalid_type:"请使用 PNG、JPEG、GIF、SVG 或 WebP 格式。",uploading:"上传中…",image_source_variable:"使用变量",menu:"导航栏",menu_settings:"导航栏设置",menu_items:"菜单项",menu_item:"菜单项",menu_styles:"菜单样式",add_new_item:"添加新项",label:"标签",page:"页面",url:"链接地址",target:"打开方式",same_tab:"当前窗口",new_tab:"新窗口",separator:"分隔符",menu_separator_placeholder:'例如 " | " 或 " • "',menu_separator_allowed_hint:"仅可使用:| • — / · 以及空格。",menu_link_gap:"链接间距",menu_underline_links:"链接下划线",logo_text_placeholder:"品牌名称",letter_spacing:"字间距",link_color:"链接颜色",menu_layout:"菜单布局",layout_mode:"布局模式",nav_only:"仅导航",stacked:"堆叠排列",logo_left:"Logo 在左",logo_right:"Logo 在右",logo_only:"仅 Logo",mobile_layout:"移动端布局",stack:"纵向堆叠",inline:"行内排列",logo_section:"Logo 区域",show_logo:"显示 Logo",logo_url:"Logo 地址",logo_text:"Logo 文字",logo_alt:"Logo 替代文字",logo_link:"Logo 链接",logo_max_width:"Logo 最大宽度",border_bottom:"底边框",show_border_bottom:"显示底边框",font_weight:"字重",font_weight_light:"细",font_weight_regular:"常规",font_weight_semibold:"半粗",font_weight_bold:"粗",text_transform:"字母大小写与样式",avatar:"头像",avatar_settings:"头像设置",avatar_image:"头像图片",avatar_border_radius:"圆角",social_link:"社交链接",add_social_link:"添加社交链接",social_link_size:"社交链接大小",icon_styles:"图标样式",icon_size:"图标大小",icon_size_small:"小",icon_size_medium:"中",icon_size_large:"大",icon_color:"图标颜色",icon_color_default:"默认",icon_color_white:"白色",icon_color_black:"黑色",icon_color_gray:"灰色",social_icon_spacing:"图标间距",social_links:"社交链接",social_link_settings:"社交链接设置",social_platform_x:"X",social_platform_formerly_twitter:"原 Twitter",social_platform_x_alt:"X(原 Twitter)",social_link_placeholder_facebook:"https://www.facebook.com/yourpage",social_link_placeholder_linkedin:"https://www.linkedin.com/company/yourcompany",social_link_placeholder_instagram:"https://www.instagram.com/yourhandle",social_link_placeholder_tiktok:"https://www.tiktok.com/@yourhandle",social_link_placeholder_x:"https://x.com/yourhandle",social_link_placeholder_youtube:"https://www.youtube.com/yourchannel",social_link_placeholder_pinterest:"https://www.pinterest.com/yourprofile",social_link_placeholder_generic:"https://example.com",social_settings_icons:"图标",social_settings_style:"样式",social_platform_field:"平台",social_icon_label_field:"标签",social_custom_icon:"自定义图标",social_add_icon:"添加平台",social_platform_custom:"自定义",social_icon_size_px:"尺寸",collapse:"收起",expand:"展开",raw_html:"HTML",raw_html_block:"适合邮件的 HTML",raw_html_block_description:"为兼容各邮件客户端,建议使用表格布局与内联样式。",raw_html_settings:"HTML 设置",raw_html_code_label:"代码",raw_html_code_hint:"导出邮件时将原样插入。发送前请在主流邮件客户端中实测。",raw_html_default_content:'<p style="text-align:center;color:#A3A3A3;font-size:12px">在此添加自定义 HTML</p>',raw_html_appearance:"布局",raw_html_clear_background:"清除背景",raw_html_email_client_warning:"自定义 HTML 在不同邮件客户端中的表现可能不一致,请充分测试。",raw_html_info_tooltip_aria:"了解适合邮件的 HTML",content_background_color:"内容背景颜色",container_background_image_title:"版块背景图",container_background_image_section_title:"版块背景图",container_background_image_section_toggle:"显示版块背景图设置",container_background_image_layout_group:"图片布局",container_background_image_row_label:"背景图",container_background_image_intro:"拖入该版块的文本、按钮、图片等会叠在背景图之上。请从左侧组件栏拖入画布中的该版块。",container_background_image_tooltip_p1:"背景图应用在版块的表格层上,兼容常见邮件客户端(不使用 position:absolute)。",container_background_image_tooltip_p2:"可用「内容背景颜色」为区块加蒙层或衬色,或设为透明以只显示照片。",container_background_image_enable:"启用背景图",container_background_image_url:"图片地址",container_background_image_upload:"上传图片",container_background_image_upload_click:"拖拽或选择图片",container_background_image_file_hint:"支持 .png、.jpg、.jpeg、.gif、.webp。单文件最大 10 MB。",container_background_image_select_button:"选择图片",container_background_image_clear:"移除背景图",container_background_image_size:"图片适配",container_background_image_position:"焦点位置",container_bg_size_cover:"覆盖(裁切)",container_bg_size_contain:"包含(完整)",container_bg_size_fill:"填充",image_file_too_large:"图片大小不能超过 10 MB。",container_bg_image_url_error_blocked_scheme:"该地址使用了不允许的协议。图片请仅使用 http:// 或 https://。",container_bg_image_url_error_duplicate_protocol:"地址中重复了协议前缀,请只保留一个,例如 https://。",container_bg_image_url_error_hostname:"请填写带有效域名的完整地址(例如 https://cdn.example.com/photo.jpg)。",container_bg_image_url_error_invalid_protocol:"不支持的协议。图片地址请使用 http:// 或 https://。",container_bg_image_url_error_generic:"图片地址格式无效。",container_bg_image_preview_failed:"无法加载预览:该地址可能不是图片,或服务器不允许嵌入显示。",image_text_overlay:"文字叠层",overlay_multi_item:"多段文本叠放",add_overlay_item:"添加叠层项",drag_to_move:"拖动排序",overlay_max_width:"叠层最大宽度",item_gap:"项间距",scrim:"背景蒙层",text_shadow:"文字阴影",fill_column:"填满列宽",image_text_overlay_tip:"可选:在图片上显示简短说明。若要在照片上排版多块内容,请使用版块背景图。",image_text_overlay_container_tip:"选中版块 → 样式 → 版块背景图,再将文字、按钮等拖入该版块。",image_text_overlay_enable:"启用文字叠层",image_overlay_caption:"说明文字",image_overlay_caption_placeholder:"一行简短文字…",image_overlay_position:"说明位置",image_overlay_pos_tl:"左上",image_overlay_pos_tc:"上中",image_overlay_pos_tr:"右上",image_overlay_pos_ml:"左中",image_overlay_pos_mc:"正中",image_overlay_pos_mr:"右中",image_overlay_pos_bl:"左下",image_overlay_pos_bc:"下中",image_overlay_pos_br:"右下",image_overlay_box_bg:"说明框背景(CSS)",image_overlay_padding:"说明内边距",background_color:"背景颜色",text_color:"文本颜色",email_theme_background_color:"邮件主题色",heading_color:"标题颜色",content_background:"内容区背景",font_color:"字体颜色",button_color:"按钮颜色",divider_color:"分割线颜色",action_type:"按钮类型",top:"上",right:"右",left:"左",bottom:"下",line_height:"行高",link:"超链接",link_url:"超链接URL",link_url_placeholder:"example.com",padding_settings:"内边距设置",width_auto:"宽度自适应",auto_width:"自动宽度",width:"宽度",height:"高度",font_size:"字体大小",font_family:"字体",align:"对齐方式",solid:"实线",dotted:"虚线(点)",dashed:"虚线(破折号)",spacing:"间距",border_radius:"圆角",link_all_sides:"联动四边",padding_link_sides_label:"四边使用相同内边距",padding_link_sides_tooltip:"开启后只需输入一个数值,将同时应用到上、右、下、左四面。关闭后可分别设置每一侧。",email_width_mode:"宽度",email_width_default:"邮件宽度(默认)",custom_px:"自定义像素",custom_width_px:"自定义宽度",full_bleed:"全幅铺满",full_bleed_tooltip:"在支持的客户端中可延展到边缘;不支持时会限制在邮件宽度内。",export_html:"导出html",export_json:"导出JSON",export_checking_images:"正在检查图片…",language_zh:"中文",export_validation_title:"导出前校验",export_validation_issues_found:"导出前发现以下问题",export_validation_errors:"错误",export_validation_warnings:"警告",export_validation_info:"提示",export_anyway:"仍要导出",ignore:"忽略",validation_body_content_width_invalid:"邮件内容宽度须在 280–1200 px 之间。",validation_body_background_color_missing:"主题背景色未设置。",validation_body_text_color_missing:"主题文字颜色未设置。",validation_body_font_family_missing:"主题字体未设置。",validation_image_empty_src:"图片地址为空,图片将无法显示。",validation_image_invalid_src:"图片地址格式无效。",validation_image_invalid_link:"图片链接地址格式无效。",validation_image_url_not_loadable:"图片地址无法加载或预览;链接可能已失效、过期或被拦截。",validation_image_empty_alt:"图片未设置 alt 文本,建议添加以提升可访问性。",validation_avatar_empty_src:"头像图片地址为空,头像将无法显示。",validation_avatar_invalid_src:"头像图片地址格式无效。",validation_avatar_invalid_link:"头像链接地址格式无效。",validation_button_empty_link:'按钮链接为空,将被保存为 href="https://"。',validation_button_invalid_link:"按钮链接格式无效。",validation_button_blocked_scheme:"按钮链接使用了被禁止的 URL 协议(如 javascript:、data: 等)。请仅使用 http(s)、mailto: 或 tel:。",validation_button_label_invalid_link:"按钮文案中的链接地址格式无效。",validation_button_label_blocked_link_scheme:"按钮文案中的链接使用了被禁止的 URL 协议(如 javascript:、data: 等)。请仅使用 http(s)、mailto: 或 tel:。",validation_rich_text_link_invalid:"富文本超链接地址格式无效。",validation_rich_text_link_blocked_scheme:"富文本链接使用了被禁止的 URL 协议(如 javascript:、data: 等)。请仅使用 http(s)、mailto: 或 tel:。",validation_menu_empty_label:"菜单项标签为空,将显示为「链接」。",validation_menu_empty_url:'菜单项链接为空,将被保存为 href="#"。',validation_menu_invalid_url:"菜单项链接格式无效。",validation_menu_blocked_scheme:"菜单项链接使用了被禁止的协议(如 javascript:、data: 等)。请仅使用 http(s)、mailto: 或 tel:。",validation_menu_no_items:"菜单块没有任何项。",validation_raw_html_empty:"HTML 块没有自定义代码;导出将只有空的外层容器。",validation_social_empty_link:'社交链接地址为空,将被保存为 href="https://"。',validation_social_invalid_link:"社交链接地址格式无效。",validation_social_blocked_scheme:"社交链接使用了被禁止的 URL 协议(如 javascript:、data: 等)。请仅使用 http(s) 地址(例如 www.example.com 或 https://…)。",validation_social_empty_icon:"社交链接图标地址为空,图标将无法显示。",validation_social_invalid_icon:"社交链接图标地址格式无效。",validation_social_no_links:"社交链接块没有任何链接。",validation_social_duplicate_platform:"社交链接块中存在重复平台,每个平台仅应保留一条。",section_nest_not_allowed:"版块不能嵌套在另一版块内,请在版块之间的堆叠区域释放。",validation_container_product_not_assigned:"该列未分配产品;请在版块设置中分配产品。",validation_dynamic_content_empty:"未生成动态内容;导出将使用静态文本(如有)。",validation_text_invalid_link:"文本链接地址格式无效。",validation_text_blocked_link_scheme:"文本链接使用了被禁止的 URL 协议(如 javascript:、data: 等)。请仅使用 http(s)、mailto: 或 tel:。",tooltip_bold:"加粗",tooltip_italic:"斜体",tooltip_underline:"下划线",tooltip_strikethrough:"删除线",tooltip_align_left:"居左",tooltip_align_center:"居中",tooltip_align_right:"居右",tooltip_ordered_list:"有序列表",tooltip_unordered_list:"无序列表",tooltip_link:"超链接",tooltip_remove_link:"删除超链接",add_link_modal_title:"添加超链接",content_type:"内容类型",content_type_static:"静态",content_type_dynamic:"动态",ai_enabled:"使用 AI 撰写",text_ai_mode_manual_edit_title:"无法在画布中编辑该文本",text_ai_mode_manual_edit_disabled:"此文本块已开启 AI 撰写,画布上不能直接编辑。请在右侧面板关闭「使用 AI 撰写」后即可手动编辑正文。",text_and_content_type:"内容类型",heading_or_body:"标题",body_paragraph:"正文",heading_h1:"H1",heading_h2:"H2",heading_h3:"H3",heading_h4:"H4",variables:"变量",insert_merge_field:"选择或输入变量...",dynamic_prompt_help:"写下你的提示",ai_output_language:"AI 输出语言",ai_output_language_en:"英语",ai_output_language_bn:"孟加拉语",generate:"生成",ml_generation_failed:"无法生成 AI 内容",ml_ai_unavailable:"AI 生成需要分栏布局、公司 ID、模板 ID 和 ML 接口。请将文本放在栏目内并检查 apiConfig。",ml_no_variations:"未返回任何建议。请更换提示词或确认服务器上存在该模板。",ml_generation_unexpected_error:"生成内容时发生意外错误。",sample_ai_content:"示例 AI 内容",select_content:"选择内容",variable_dynamic_placeholder:"无(可选)",variable_display_text:"展示文案",variable_introduction:"引言",variable_heading:"标题",variable_subheading:"副标题",variable_products_description:"产品描述",variable_customer_name:"客户姓名",variable_introduction_title:"引言标题",variable_introduction_subtitle:"引言副标题",variable_body_title:"正文标题",variable_body_subtitle:"正文副标题",variable_discount_value:"折扣力度",variable_discount_code:"折扣码",variable_valid_until:"有效期至",variable_company_name:"公司名称",variable_brand_name:"品牌名称",variable_address:"地址",variable_website:"网站",variable_logo_url:"Logo URL",variable_tagline:"标语",variable_nav_label:"导航文案",variable_nav_url:"导航链接",variable_product_name:"产品名称",variable_product_description:"产品描述",variable_product_image:"产品图片 URL",variable_product_link:"产品链接",variable_product_price:"产品价格",variable_product_currency:"货币",variable_product_old_price:"原价",variable_product_new_price:"现价",variable_product_price_display:"产品价格展示",variable_image_logo:"Logo",variable_image_hero_banner:"主图横幅",variable_image_footer_banner:"页脚横幅",variable_image_product_image:"产品图片",variable_cta_label:"CTA 文案",variable_cta_url:"CTA 链接",button_label_variable:"按钮文案(变量)",button_url_variable:"使用变量",button_text:"按钮文案",button_label_manual:"输入文案",button_url_manual:"输入链接",use_company_social_links:"使用公司社交链接",use_navigation_links:"使用导航链接",tooltip_container_type:"决定该版块可用的变量和产品映射。",tooltip_variables_static:"将合并字段插入内容,发送邮件时将被替换。",tooltip_dynamic_prompt:"描述语气或意图,我们将推荐示例内容。(预览模式 — 连接 AI API 后可生成真实内容。)",tooltip_write_using_ai:"开启后,可选择输出语言并输入提示生成多种示例。需配置 ML/API。",tooltip_write_using_ai_unavailable:"当前编辑器未开启 AI 写作。请在宿主应用或 API 中启用后再使用「使用 AI 撰写」。",label_align:"对齐",label_padding:"内边距",section_background_group:"区块背景",section_bg_mode:"类型",section_bg_color:"颜色",section_bg_image:"图片",section_bg_none:"无",section_content_area_group:"内容区",content_area_color:"内容底色",content_color_auto:"自动",content_color_custom:"自定义",shortcuts_modal_title:"键盘快捷键",shortcuts_modal_footnote:"在右侧设置面板的文本框中输入时快捷键会暂时停用,以便正常编辑链接和复制粘贴。",shortcut_save:"保存(由宿主页面接入时触发)",shortcut_undo:"撤销",shortcut_redo:"重做",shortcut_duplicate:"复制选中模块",shortcut_copy_block:"复制模块",shortcut_paste_block:"粘贴模块",shortcut_delete_block:"删除选中模块",shortcut_escape:"取消选中",shortcut_cheat_sheet:"打开此帮助",shortcut_delete_confirm_title:"删除此版块?",shortcut_delete_confirm_desc:"版块内仍有内容模块,确定要删除吗?",context_duplicate:"复制",context_copy:"复制到剪贴板",context_cut:"剪切",context_paste:"粘贴",context_delete:"删除",context_move_up:"上移",context_move_down:"下移",context_save_global:"保存为全局组件",context_reset_styles:"重置样式",topbar_back_to_templates:"模板",topbar_breadcrumb_email:"邮件",topbar_rename_template:"重命名模板",topbar_untitled_template:"未命名模板",send_test:"发送测试",preview:"预览",html_email_preview:"HTML 预览",html_email_preview_title:"HTML 邮件预览",html_email_preview_device_aria:"HTML 预览设备宽度",html_email_preview_error:"无法生成 HTML 预览,请查看控制台。",save_template:"保存模板",more_actions:"更多操作",keyboard_shortcuts:"键盘快捷键",high_contrast_on:"高对比度开",high_contrast_off:"高对比度关",desktop:"桌面",mobile:"移动",undo:"撤销",redo:"重做",save_state_saved:"已保存",save_state_saving:"保存中…",save_state_unsaved:"未保存",save_state_error:"保存失败",export_validation_open_block:"打开此区块",save:"保存",template_name:"模板名称",save_template_title:"保存模板",save_template_category:"分类",save_template_category_placeholder:"选择或输入分类…",category_promotional:"促销",category_transactional:"事务通知",category_newsletter:"Newsletter",category_onboarding:"Onboarding",category_announcement:"公告",category_other:"其他",send_test_title:"发送测试邮件",send_test_send:"发送测试",send_test_recipients:"收件人",send_test_recipients_placeholder:"name@example.com, another@example.com",send_test_recipients_hint:"按 Enter 或逗号可添加地址。",send_test_payload:"数据上下文",send_test_payload_none:"不附带数据",send_test_payload_profile:"用户资料数据",send_test_payload_event:"事件数据",send_test_prefix_label:"[TEST] 前缀",send_test_prefix_hint:"在邮件主题前添加 [TEST]。",universal:"通用",layers:"图层",document:"文档",layer_one:"个区块",layer_many:"个区块",layer_move_up:"上移",layer_move_down:"下移",layer_duplicate:"复制",layer_delete:"删除",universal_saved_blocks:"已保存区块",universal_empty_state_line_1:"还没有通用内容。点击",universal_empty_state_line_2:"可将区块保存以在其他模板中复用。",universal_used_in_count:"已使用 {{count}}",compliance:"合规",compliance_preflight:"发送前检查",compliance_all_clear_title:"准备就绪",compliance_all_clear_desc:"所有合规检查均已通过。",compliance_severity_error:"错误",compliance_severity_warning:"警告",compliance_severity_info:"信息",compliance_tab_badge_label:"未解决问题:{{count}}",compliance_email_size:"邮件大小(估算)",compliance_above_clip:"已超过 Gmail 约 102 KB 折叠阈值,收件箱中可能会被截断显示。",compliance_below_clip:"低于 Gmail 折叠阈值",right_panel_empty_hint:"点击画布中的任意区块以编辑其特定设置。从左侧栏拖动区块以添加新内容。",right_panel_back:"返回",layer_show:"显示",layer_hide:"隐藏",save_as_universal:"保存为通用区块",universal_save_modal_title:"保存为通用区块",universal_save_modal_subtitle:"可在多个模板中复用。编辑不会影响已发送的邮件。",universal_save_modal_placeholder:"例如:Beantown 页脚",universal_save_modal_confirm:"保存区块",universal_save_success:"已保存为通用区块:{{name}}",universal_save_error:"保存失败,请检查网络后重试。",universal_delete:"删除",universal_delete_confirm_title:"移除已保存区块?",universal_delete_confirm_body:"将从素材库中移除,已发送邮件不受影响。",universal_delete_confirm_ok:"移除",configure_columns_title:"配置分栏",configure_columns_subtitle:"选择一种布局。每一列初始为空,可拖入区块。",configure_columns_insert:"插入版块",configure_columns_hint:"点击配置布局",configure_columns_row_count:"插入行数:",standard_layout:"标准布局",grid_layout:"6/12 栅格",grid_settings:"网格",grid_rows_locked_hint:"邮件分栏为单行布局,行数固定为 1。",columns_layout:"分栏布局",column_sizes:"列宽 (%)",show_more:"展开",show_less:"收起",col:"列",gaps:"间距",column_gap:"列间距",button_variant:"样式变体",full_width:"全宽",hover_bg_color:"悬停背景色",hover_text_color:"悬停文字颜色",text_decoration:"文本装饰",shadow:"阴影",shadow_preset:"预设",table:"表格",table_settings:"表格设置",footer_settings:"页脚设置",cell_content:"单元格内容",add_link_url:"链接地址",add_link_url_placeholder:"https://example.com",add_link_display_text:"显示文本",add_link_display_text_placeholder:"留空则保留当前选中文本",add_link_display_text_empty_badge:"未填写 — 将使用选中的文字作为链接文字",add_link_open_new_tab:"在新标签页打开",align_left:"左对齐",align_center:"居中对齐",align_right:"右对齐",minimize_toolbar:"收起",close_text_editor:"退出文本编辑",unlink_universal:"解除当前副本关联",unlink_modal_title:"编辑通用区块",unlink_modal_keep:"保持关联",unlink_modal_unlink:"仅解绑当前副本",unlink_modal_body:"该区块当前关联到通用内容。直接编辑会影响所有使用该通用区块的位置。",unlink_modal_body2:"选择“仅解绑当前副本”可只在当前模板独立编辑;选择“保持关联”则继续联动所有实例。",custom:"自定义",custom_color:"自定义颜色",show_text_label:"显示文字标签",mobile_optimization:"移动端优化",stack_columns_on_mobile:"移动端堆叠栏目",scale_font_on_mobile:"移动端缩小字体",section_layout:"版块布局",content_max_width:"内容最大宽度",content_max_width_option_full:"全宽",min_height:"最小高度",border:"边框",border_style:"边框样式",border_width:"边框宽度",border_color:"边框颜色",visibility:"可见性",hidden_on_mobile:"在移动端隐藏",table_structure:"表格结构",rows:"行",header_row:"标题行",header_column:"标题列",cell_selector:"单元格选择器",cell_content_type:"单元格内容类型",table_style:"表格样式",cell_padding:"单元格内边距",header_style:"标题样式",header_background:"标题背景",header_text_color:"标题文字颜色",striped_rows:"斑马纹行",stripe_color:"斑马纹颜色",table_structure_mode:"模式",table_mode_static:"静态",table_mode_dynamic:"动态",table_dynamic_structure_hint:"导出仍为静态 HTML;数据驱动表格或将在后续版本接入。",table_add_row:"添加行",table_add_column:"添加列",table_decrease_rows:"减少行数",table_increase_rows:"增加行数",table_decrease_cols:"减少列数",table_increase_cols:"增加列数",table_selected_cell:"已选:第 {{row}} 行,第 {{col}} 列",table_select_cell_hint:"在网格中点击单元格以编辑内容。",table_cell_grid_truncated:"仅显示前 {{rows}} × {{cols}} 格",table_cell_text_placeholder:"单元格文字…",table_align_left:"左对齐",table_align_center:"居中",table_align_right:"右对齐",footer_visible_lines:"显示内容行",footer_toggle_brand_name:"品牌名称",footer_toggle_tagline:"标语",footer_toggle_address:"地址",footer_toggle_unsubscribe:"退订",footer_toggle_social_row:"社交图标行",footer_toggle_secondary_links:"次级链接",footer_toggle_copyright:"版权信息",footer_native_social_hint:"要编辑各平台与图标,请先关闭上方的公司链接,或在画布中选择社交行。",footer_company_social_managed_note:"图标与个人主页链接来自公司数据(与预览一致)。关闭上方开关后,可仅为本模板自定义平台。",footer_company_social_url_empty:"公司数据中暂无链接",footer_content_heading:"正文内容",footer_label_brand:"品牌",footer_unsubscribe_link_label:"退订链接文案",footer_preferences_link_label:"偏好设置链接文案",footer_preferences_url:"偏好设置链接 URL",footer_preferences_default_label:"更新偏好",footer_secondary_links_heading:"次级链接",footer_secondary_link_text:"链接文字",footer_secondary_link_url:"链接地址",footer_new_link_label:"新链接",footer_add_link:"添加链接",footer_social_platforms_heading:"社交平台",footer_platform_label:"平台",footer_social_profile_url:"主页链接",footer_upload_icon:"上传图标",footer_add_platform:"+ 添加平台",footer_style_heading:"样式",footer_text_color:"文字颜色",footer_link_color:"链接颜色",footer_background_content:"背景",footer_column_background:"栏背景",footer_align:"对齐",footer_border_heading:"边框",footer_divider_above:"上方分割线",footer_border_top:"顶部边框",footer_border_top_color:"顶部边框颜色",footer_social_instagram:"Instagram",footer_social_facebook:"Facebook",footer_social_twitter:"Twitter",footer_social_linkedin:"领英",footer_social_youtube:"YouTube",footer_social_tiktok:"TikTok",footer_social_custom_icon:"自定义图标",footer_sections:"页脚区块",footer_brand_name_placeholder:"您的品牌",footer_brand_tagline_placeholder:"品牌标语",footer_address_placeholder:"示例:某某路 123 号,城市,国家",footer_unsubscribe_url_placeholder:"{{unsubscribe_url}}",footer_copyright_placeholder:"© {{year}} 您的公司",footer_default_unsubscribe_text:"退订",show_brand:"品牌信息",brand_name:"品牌名称",brand_tagline:"品牌标语",show_address:"地址",address:"地址文本",show_unsubscribe:"退订链接",unsubscribe_text:"链接文案",unsubscribe_url:"退订链接 URL",show_social:"社交图标",social_icons_hint:"请在该区块的内容设置里配置社交图标。",show_secondary_links:"次级链接",show_copyright:"版权信息",copyright_text:"版权文本",footer_style:"页脚样式",padding_top:"顶部内边距",padding_bottom:"底部内边距",show_divider:"显示分割线",header_settings:"页眉设置",discount_settings:"折扣设置",discount_show_title:"显示标题",preset_discount_simple:"折扣(单行)",style:"样式",navigation:"导航",link_style:"链接样式",color:"颜色",size:"大小",weight:"字重",transform:"字形变换",gap:"间距",underline:"下划线",title:"标题",add_link:"添加链接",font_weight_medium:"中等",nav_text_transform_sentence:"正常大小写",nav_text_transform_uppercase:"全部大写",nav_text_transform_capitalize:"首字母大写",placeholder_https:"https://…",brand_name_placeholder:"品牌名称",logo_padding:"Logo 内边距",default_nav_link_label:"链接",navigation_link_placeholder_url:"#",container_variables_none_available:"此版块类型没有可用的变量。",header_layout_logo_left_nav_right:"Logo 在左,导航在右",header_layout_logo_right_nav_left:"Logo 在右,导航在左",header_layout_logo_center_nav_below:"Logo 居中,导航在下",header_layout_logo_only:"仅 Logo",header_layout_nav_only:"仅导航",header_banner_section:"页眉横幅",show_header_banner:"显示页眉横幅",footer_banner_section:"页脚横幅",show_footer_banner:"显示页脚横幅",border_none:"无",discount_code_section:"优惠码",discount_code_background:"代码背景",discount_code_corner_radius:"代码圆角",column_preset_1_col:"1 列",column_preset_equal_2:"两列等宽",column_preset_equal_3:"三列等宽",column_preset_equal_4:"四列等宽",column_preset_1_2:"1 / 2",column_preset_2_1:"2 / 1",column_preset_1_3:"1 / 3",column_preset_3_1:"3 / 1",column_preset_2_3:"2 : 3",column_preset_3_2:"3 : 2",column_preset_1_2_1:"1 / 2 / 1",column_preset_2_1_1:"2 / 1 / 1",column_preset_1_1_2:"1 / 1 / 2",column_preset_2_4_2_4:"2-4 · 2-4",column_preset_4_2_4_2:"4-2 · 4-2"},Xo={drag_block_here:"Drag block here",drop_content_here:"Drop content here",drop_content_hint:"Drag blocks from the left, or click to insert.",drag_section_here:"Drag section here",blocks:"Blocks",photos:"Photos",powered_by_pexels:"Powered by Pexels",loading:"Loading...",content:"Content",typography:"Typography",styles:"Styles",ai_powered:"AI powered",layout:"Layout",components:"Components",presets:"Presets",body_settings:"Theme Settings",global:"Global",text_and_headings:"Text and headings",pre_header:"Pre-header",pre_header_description:"The pre-header is a short summary text that follows the subject line when viewing an email in the inbox.",confirm:"Confirm",cancel:"Cancel",add_blocks:"Add blocks",block_product:"Product",block_product_single:"Single",block_product_multi:"Multi",block_discount:"Discount",product_output_layout:"Output layout",product_main_layout_stacked:"Image on top, Details below",product_main_layout_image_left:"Image left, Details right",discount_variant_simple:"Simple (one line)",discount_variant_card:"Card (title + code)",additional_products_grid_layout:"Additional products",additional_products_per_row:"Products per row",product_row_count_2:"2 columns",product_row_count_3:"3 columns",block_introduction:"Introduction",block_body:"Body",block_header:"Header",block_footer:"Footer",no_product_found:"No product found",no_products_matching_search:"No products match your search. Clear the search to see the full list.",load_more_products:"Load more",add_products:"Add products",add_products_in_store:"Add products in your store.",column:"Column",columns:"Columns",column_settings:"Column Settings",column_cells_section:"Column cells",column_wrapper_style:"Wrapper style",column_styles:"Column Styles",size_px:"Size",column_delete:"Delete Column",column_delete_desc:"Are you sure you want to delete {{count}} extra columns? ",block_palette_section:"Section",block_palette_columns:"Column",settings_title_column_layout:"Column settings",container:"Section",select_parent_section_tooltip:"Parent section settings — layout, spacing, and background",container_settings:"Section settings",layers_panel:"Layers",email_styles_section:"Email styles",document_section:"Document",body_bg_color_short:"Bg color",body_content_bg_short:"Content bg",body_width_label:"Width",body_font_short:"Font",body_text_short:"Text",body_heading_short:"Heading",body_link_short:"Link",type_styles_section:"Type",container_type:"Section type",container_type_help:"Determines which variables and product mappings are available for this section.",container_type_none:"Default",container_type_header:"Header",container_type_discount:"Discount",container_type_introduction:"Introduction",container_type_body:"Body",container_type_product:"Product",container_type_hero_product:"Hero Product",container_type_additional_product:"Additional Product",container_type_footer:"Footer",product_role:"Product Role",product_role_main_hero:"Primary",product_role_additional:"Secondary",product_column_select_label:"Use system variables",product_column_select_placeholder:"Search or select a product",product_column_variables_heading:"Product field tokens",product_column_kb_heading:"Knowledge base product",product_column_kb_tooltip:"Choose a product from your knowledge base catalog here. This controls which product appears in this column in the email.",text:"Text",text_content:"This is a text, click to edit text",text_settings:"Text Settings",text_styles:"Text Styles",text_align:"Text Align",heading:"Heading",heading_content:"This is a heading, click to edit heading",heading_settings:"Heading Settings",heading_type:"Heading Type",button:"Button",button_settings:"Button Settings",button_action:"Button Action",button_styles:"Button Styles",button_padding:"Button Padding",spacer:"Spacer",spacer_block:"SPACER BLOCK",spacer_settings:"Spacer Settings",divider:"Divider",divider_settings:"Divider Settings",divider_type:"Divider Type",divider_styles:"Divider Styles",image:"Image",image_action:"Image Action",image_url:"Image URL",image_alt:"Image Alt",image_alt_placeholder:"Describe for screen readers",image_styles:"Image Styles",image_settings:"Image Settings",image_crop_soon:"Image cropping is not available yet.",crop:"Crop",replace:"Replace",delete:"Delete",image_max_upload_size:"max 10 MB",video:"Video",video_settings:"Video",video_tab_styles:"Styles",video_tab_display:"Display",video_url:"Video URL",video_thumbnail_url:"Custom thumbnail URL",video_thumbnail_url_placeholder:"Leave empty to use YouTube thumbnail",video_export_note:"Email clients typically show a linked thumbnail, not embedded playback.",video_thumbnail_layout:"Thumbnail layout",video_width:"Width (W)",video_height:"Height (H)",video_fill_column:"Fill column",video_fill_column_mobile:"Fill column on mobile",alignment:"Alignment",video_area_section:"Video area",video_block_section:"Block",video_border_none:"None",image_source:"Image source",image_source_url:"Enter URL",image_source_upload:"Upload image",image_upload:"Upload",image_upload_click:"Click to upload",image_upload_not_configured:"Image upload is not configured. Set imageUploadEndpoint in apiConfig or pass null to disable; defaults use the built-in API base.",image_uploaded:"Image uploaded successfully",image_upload_failed:"Failed to upload image",image_upload_error:"Error uploading image",image_upload_file_hint:"PNG, JPEG, GIF, SVG, WebP · max 10 MB",image_upload_invalid_type:"Use PNG, JPEG, GIF, SVG, or WebP.",uploading:"Uploading…",image_source_variable:"Use variable",menu:"Navigation bar",menu_settings:"Navigation bar Settings",menu_layout:"Menu layout",layout_mode:"Layout mode",nav_only:"Navigation only",stacked:"Stacked",logo_left:"Logo left",logo_right:"Logo right",logo_only:"Logo only",mobile_layout:"Mobile layout",stack:"Stack",inline:"Inline",logo_section:"Logo section",show_logo:"Show logo",logo_url:"Logo URL",logo_text:"Logo text",logo_alt:"Logo alt",logo_link:"Logo link",logo_max_width:"Logo max width",border_bottom:"Border bottom",show_border_bottom:"Show border bottom",font_weight:"Font weight",font_weight_light:"Light",font_weight_regular:"Regular",font_weight_semibold:"Semi-bold",font_weight_bold:"Bold",text_transform:"Text transform",menu_items:"Menu Items",menu_item:"Menu Item",menu_styles:"Menu Styles",add_new_item:"Add New Item",label:"Label",page:"Page",url:"URL",target:"Target",same_tab:"Same Tab",new_tab:"New Tab",separator:"Separator",menu_separator_placeholder:'e.g. " | " or " • "',menu_separator_allowed_hint:"Only these symbols: | • — / · You may add spaces.",menu_link_gap:"Link spacing",menu_underline_links:"Underline links",logo_text_placeholder:"Brand",letter_spacing:"Letter Spacing",link_color:"Link Color",avatar:"Avatar",avatar_settings:"Avatar Settings",avatar_image:"Avatar image",avatar_border_radius:"Border radius",social_link:"Social Link",social_link_settings:"Social Link Settings",add_social_link:"Add Social Link",social_link_size:"Social Link Size",icon_styles:"Icon styles",icon_size:"Icon size",icon_size_small:"Small",icon_size_medium:"Medium",icon_size_large:"Large",icon_color:"Icon color",icon_color_default:"Default",icon_color_white:"White",icon_color_black:"Black",icon_color_gray:"Gray",social_icon_spacing:"Icon spacing",social_links:"Social Links",social_platform_x:"X",social_platform_formerly_twitter:"Formerly Twitter",social_platform_x_alt:"X, formerly Twitter",social_link_placeholder_facebook:"https://www.facebook.com/yourpage",social_link_placeholder_linkedin:"https://www.linkedin.com/company/yourcompany",social_link_placeholder_instagram:"https://www.instagram.com/yourhandle",social_link_placeholder_tiktok:"https://www.tiktok.com/@yourhandle",social_link_placeholder_x:"https://x.com/yourhandle",social_link_placeholder_youtube:"https://www.youtube.com/yourchannel",social_link_placeholder_pinterest:"https://www.pinterest.com/yourprofile",social_link_placeholder_generic:"https://example.com",social_settings_icons:"Icons",social_settings_style:"Style",social_platform_field:"Platform",social_icon_label_field:"Label",social_custom_icon:"Custom icon",social_add_icon:"Add platform",social_platform_custom:"Custom",social_icon_size_px:"Size",collapse:"Collapse",expand:"Expand",raw_html:"HTML",raw_html_block:"Email-safe HTML",raw_html_block_description:"Prefer table-based layouts and inline CSS for client compatibility.",raw_html_settings:"HTML Settings",raw_html_code_label:"Code",raw_html_code_hint:"Inserted as-is in the exported email. Test in major clients before you send.",raw_html_default_content:'<p style="text-align:center;color:#A3A3A3;font-size:12px">Add custom HTML here</p>',raw_html_appearance:"Layout",raw_html_clear_background:"Clear",raw_html_email_client_warning:"Custom HTML may render inconsistently across email clients. Test thoroughly.",raw_html_info_tooltip_aria:"More about email-safe HTML",content_background_color:"Content Background Color",container_background_image_title:"Section background image",container_background_image_section_title:"Section background image",container_background_image_section_toggle:"Show section background image",container_background_image_layout_group:"Image layout",container_background_image_row_label:"Background image",container_background_image_intro:"Blocks you add to this section (text, buttons, images, etc.) appear on top of the image. Drag components from the palette into the section on the canvas.",container_background_image_tooltip_p1:"Uses a background image on the section table (email-client friendly — not CSS position:absolute).",container_background_image_tooltip_p2:"Use “Content background color” for a tint behind blocks, or set it transparent so only the photo shows through.",container_background_image_enable:"Enable background image",container_background_image_url:"Image URL",container_background_image_upload:"Upload image",container_background_image_upload_click:"Drag and drop or select image",container_background_image_file_hint:"Accepts .png, .jpg, .jpeg, .gif, and .webp. Maximum file size 10 MB.",container_background_image_select_button:"Select image",container_background_image_clear:"Remove background image",container_background_image_size:"Image fit",container_background_image_position:"Focal point",container_bg_size_cover:"Cover",container_bg_size_contain:"Contain",container_bg_size_fill:"Fill",image_file_too_large:"Image must be 10 MB or smaller.",container_bg_image_url_error_blocked_scheme:"This URL uses a blocked protocol. Use only http:// or https:// for images.",container_bg_image_url_error_duplicate_protocol:"The URL repeats the protocol. Use a single https:// prefix.",container_bg_image_url_error_hostname:"Use a full URL with a valid hostname (e.g. https://cdn.example.com/photo.jpg).",container_bg_image_url_error_invalid_protocol:"Unsupported protocol. Use http:// or https:// for image URLs.",container_bg_image_url_error_generic:"Invalid image URL format.",container_bg_image_preview_failed:"Could not load a preview for this URL. It may not be an image, or the host blocked the request.",image_text_overlay:"Text overlay",overlay_multi_item:"Multi-item stack",add_overlay_item:"Add overlay item",drag_to_move:"Drag to move",overlay_max_width:"Overlay max width",item_gap:"Item gap",scrim:"Scrim",text_shadow:"Text shadow",fill_column:"Fill column",image_text_overlay_tip:"Optional caption drawn on top of the image in the editor. For full layouts over a photo, use a section background image instead.",image_text_overlay_container_tip:"Select the section → Styles → Section background image, then drag text and buttons into that section.",image_text_overlay_enable:"Enable text overlay",image_overlay_caption:"Caption",image_overlay_caption_placeholder:"Short line of text…",image_overlay_position:"Caption position",image_overlay_pos_tl:"Top left",image_overlay_pos_tc:"Top center",image_overlay_pos_tr:"Top right",image_overlay_pos_ml:"Middle left",image_overlay_pos_mc:"Middle center",image_overlay_pos_mr:"Middle right",image_overlay_pos_bl:"Bottom left",image_overlay_pos_bc:"Bottom center",image_overlay_pos_br:"Bottom right",image_overlay_box_bg:"Caption box background (CSS)",image_overlay_padding:"Caption padding",background_color:"Background Color",text_color:"Text Color",email_theme_background_color:"Email Theme Background Color",font_color:"Font Color",button_color:"Button Color",divider_color:"Divider Color",action_type:"Action Type",content_background:"Content background",heading_color:"Heading color",top:"Top",right:"Right",left:"Left",bottom:"Bottom",line_height:"Line Height",link:"Link",link_url:"Link URL",link_url_placeholder:"example.com",padding_settings:"Padding Settings",width:"Width",height:"Height",width_auto:"Width Auto",auto_width:"Auto Width",font_size:"Font Size",font_family:"Font Family",solid:"Solid",dotted:"Dotted",dashed:"Dashed",align:"Align",spacing:"Spacing",border_radius:"Border radius",link_all_sides:"Link all sides",padding_link_sides_label:"Same padding on all sides",padding_link_sides_tooltip:"When on, one value updates top, right, bottom, and left together. Turn off to set each side separately.",email_width_mode:"Width",email_width_default:"Email-width (default)",custom_px:"Custom px",custom_width_px:"Custom width",full_bleed:"Full bleed",full_bleed_tooltip:"Extends edge-to-edge in clients that support it; clipped to email-width otherwise.",export_html:"Export HTML",export_json:"Export JSON",export_checking_images:"Checking images…",language_zh:"中文",export_validation_title:"Export validation",export_validation_issues_found:"Issues found before export",export_validation_errors:"Errors",export_validation_warnings:"Warnings",export_validation_info:"Info",export_anyway:"Export anyway",ignore:"Ignore",validation_body_content_width_invalid:"Body content width must be between 280 and 1200 px.",validation_body_background_color_missing:"Theme background color is missing.",validation_body_text_color_missing:"Theme text color is missing.",validation_body_font_family_missing:"Theme font family is missing.",validation_image_empty_src:"Image URL is empty; the image will not display.",validation_image_invalid_src:"Image URL format is invalid.",validation_image_invalid_link:"Image link URL format is invalid.",validation_image_url_not_loadable:"Image URL could not be loaded or previewed; the link may be broken, expired, or blocked.",validation_image_empty_alt:"Image alt text is empty; consider adding for accessibility.",validation_avatar_empty_src:"Avatar image URL is empty; avatar will not display.",validation_avatar_invalid_src:"Avatar image URL format is invalid.",validation_avatar_invalid_link:"Avatar link URL format is invalid.",validation_button_empty_link:'Button link URL is empty; will be saved as href="https://".',validation_button_invalid_link:"Button link URL format is invalid.",validation_button_blocked_scheme:"Button link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",validation_button_label_invalid_link:"Button label link URL format is invalid.",validation_button_label_blocked_link_scheme:"Button label link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",validation_rich_text_link_invalid:"Rich text hyperlink URL format is invalid.",validation_rich_text_link_blocked_scheme:"Rich text link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",validation_menu_no_items:"Navigation bar has no links.",validation_raw_html_empty:"HTML block has no custom markup; export will include an empty wrapper.",validation_social_empty_link:'Social link URL is empty; will be saved as href="https://".',validation_social_invalid_link:"Social link URL format is invalid.",validation_social_blocked_scheme:"Social link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s) only (e.g. www.example.com or https://…).",validation_social_empty_icon:"Social link icon URL is empty; icon will not display.",validation_social_invalid_icon:"Social link icon URL format is invalid.",validation_social_no_links:"Social link block has no links.",validation_social_duplicate_platform:"Duplicate social platform in this block; only one entry per platform should be kept.",validation_container_product_not_assigned:"A product is not assigned to this column; assign a product in Section settings.",validation_dynamic_content_empty:"Dynamic content not generated; export will use static text if available.",validation_text_invalid_link:"Text link URL format is invalid.",validation_text_blocked_link_scheme:"Text link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",tooltip_bold:"Bold",tooltip_italic:"Italic",tooltip_underline:"Underline",tooltip_strikethrough:"Strikethrough",tooltip_align_left:"Align left",tooltip_align_center:"Align center",tooltip_align_right:"Align right",tooltip_ordered_list:"Ordered list",tooltip_unordered_list:"Unordered list",tooltip_link:"Link",tooltip_remove_link:"Remove link",add_link_modal_title:"Add link",content_type:"Content type",content_type_static:"Static",content_type_dynamic:"Dynamic",ai_enabled:"Write using AI",text_ai_mode_manual_edit_title:"Can't edit this text here",text_ai_mode_manual_edit_disabled:"AI writing is on for this block, so the text isn't editable on the canvas. In the right panel, turn off “Write using AI” to edit manually.",text_and_content_type:"Content type",heading_or_body:"Heading",body_paragraph:"Body",heading_h1:"H1",heading_h2:"H2",heading_h3:"H3",heading_h4:"H4",variables:"Variables",insert_merge_field:"Select or type variable...",dynamic_prompt_help:"Write your prompt",ai_output_language:"AI output language",ai_output_language_en:"English",ai_output_language_bn:"Bengali",generate:"Generate",ml_generation_failed:"Could not generate AI content",ml_ai_unavailable:"AI generation needs a column layout, company ID, template ID, and ML endpoint. Open this text inside a section column and check apiConfig.",ml_no_variations:"No suggestions were returned. Try another prompt or verify the template exists on the server.",ml_generation_unexpected_error:"Something went wrong while generating content.",sample_ai_content:"Sample AI content",select_content:"Select content",variable_dynamic_placeholder:"None (optional)",variable_display_text:"Display text",variable_introduction:"Introduction",variable_heading:"Heading",variable_subheading:"Subheading",variable_products_description:"Products description",variable_customer_name:"Customer Name",variable_introduction_title:"Introduction Title",variable_introduction_subtitle:"Introduction Subtitle",variable_body_title:"Body Title",variable_body_subtitle:"Body Subtitle",variable_discount_value:"Discount value",variable_discount_code:"Discount code",variable_valid_until:"Valid until",variable_company_name:"Company name",variable_brand_name:"Brand name",variable_address:"Address",variable_website:"Website",variable_logo_url:"Logo URL",variable_tagline:"Tagline",variable_nav_label:"Nav link label",variable_nav_url:"Nav link URL",variable_product_name:"Product name",variable_product_description:"Product description",variable_product_image:"Product image URL",variable_product_link:"Product link",variable_product_price:"Product price",variable_product_currency:"Product currency",variable_product_old_price:"Product old price",variable_product_new_price:"Product new price",variable_product_price_display:"Product price display",variable_image_logo:"Logo",variable_image_hero_banner:"Hero banner",variable_image_footer_banner:"Footer banner",variable_image_product_image:"Product image",variable_cta_label:"CTA label",variable_cta_url:"CTA URL",button_label_variable:"Button label (variable)",button_url_variable:"Use variable",button_text:"Button text",button_label_manual:"Enter label",button_url_manual:"Enter URL",use_company_social_links:"Use company social links",use_navigation_links:"Use navigation links",tooltip_container_type:"Determines which variables and product mappings are available for this section.",tooltip_variables_static:"Insert a merge field into your content. It will be replaced when the email is sent.",tooltip_dynamic_prompt:"Describe the tone or intent; we'll suggest sample content. (Preview mode — connect an AI API for real generation.)",tooltip_write_using_ai:"When on, choose output language and write a prompt to generate variants. Requires ML/API when connected.",tooltip_write_using_ai_unavailable:"AI authoring is disabled for this editor. Enable it from the host app or API options to use Write using AI.",label_align:"Align",label_padding:"Padding",section_background_group:"SECTION BACKGROUND",section_bg_mode:"Type",section_bg_color:"Color",section_bg_image:"Image",section_bg_none:"None",section_content_area_group:"CONTENT AREA",content_area_color:"Content color",content_color_auto:"Auto",content_color_custom:"Custom",shortcuts_modal_title:"Keyboard shortcuts",shortcuts_modal_footnote:"Shortcuts are disabled while typing in text fields inside the settings panel, so you can edit URLs and copy/paste normally.",shortcut_save:"Save (handled by the host page when connected)",shortcut_undo:"Undo",shortcut_redo:"Redo",shortcut_duplicate:"Duplicate selected block",shortcut_copy_block:"Copy selected block",shortcut_paste_block:"Paste block",shortcut_delete_block:"Delete selected block",shortcut_escape:"Deselect block",shortcut_cheat_sheet:"Open this help",shortcut_delete_confirm_title:"Delete this section?",shortcut_delete_confirm_desc:"This section has content blocks inside. Delete it anyway?",section_nest_not_allowed:"Sections cannot be placed inside another section. Drop between sections in the stack.",context_duplicate:"Duplicate",context_copy:"Copy",context_cut:"Cut",context_paste:"Paste",context_delete:"Delete",context_move_up:"Move up",context_move_down:"Move down",context_save_global:"Save as Global Element",context_reset_styles:"Reset styles",topbar_back_to_templates:"Templates",topbar_exit:"Exit",topbar_breadcrumb_email:"Email",topbar_rename_template:"Rename template",topbar_untitled_template:"Untitled template",send_test:"Send test",preview:"Preview",html_email_preview:"HTML preview",html_email_preview_title:"HTML Email Preview",html_email_preview_device_aria:"HTML preview device width",html_email_preview_error:"Could not generate the HTML preview. Check the console for details.",save_template:"Save template",more_actions:"More actions",keyboard_shortcuts:"Keyboard shortcuts",high_contrast_on:"High contrast on",high_contrast_off:"High contrast off",desktop:"Desktop",mobile:"Mobile",undo:"Undo",redo:"Redo",save_state_saved:"Saved",save_state_saving:"Saving…",save_state_unsaved:"Unsaved",save_state_error:"Save failed",export_validation_open_block:"Open block",save:"Save",template_name:"Template name",save_template_title:"Save template",save_template_category:"Category",save_template_category_placeholder:"Select or type a category…",category_promotional:"Promotional",category_transactional:"Transactional",category_newsletter:"Newsletter",category_onboarding:"Onboarding",category_announcement:"Announcement",category_other:"Other",send_test_title:"Send test email",send_test_send:"Send test",send_test_recipients:"Recipients",send_test_recipients_placeholder:"name@example.com, another@example.com",send_test_recipients_hint:"Press Enter or comma to add each address.",send_test_payload:"Payload context",send_test_payload_none:"No payload",send_test_payload_profile:"Profile data",send_test_payload_event:"Event data",send_test_prefix_label:"[TEST] prefix",send_test_prefix_hint:"Prepends [TEST] to the subject line.",universal:"Universal",layers:"Layers",document:"Document",layer_one:"block",layer_many:"blocks",layer_move_up:"Move up",layer_move_down:"Move down",layer_duplicate:"Duplicate",layer_delete:"Delete",universal_saved_blocks:"Saved blocks",universal_empty_state_line_1:"No universal content yet. Click",universal_empty_state_line_2:"on any block to save it for reuse across templates.",universal_used_in_count:"used in {{count}}",compliance:"Compliance",compliance_preflight:"Pre-flight",compliance_all_clear_title:"Ready to send",compliance_all_clear_desc:"All compliance checks pass.",compliance_severity_error:"Error",compliance_severity_warning:"Warning",compliance_severity_info:"Info",compliance_tab_badge_label:"Unresolved issues: {{count}}",compliance_email_size:"Email size (HTML)",compliance_above_clip:"Above Gmail clip threshold",compliance_near_clip:"Approaching clip threshold",compliance_below_clip:"Below Gmail clip threshold",compliance_clip_reason_over:"Gmail will clip this email. Reduce content or remove large blocks.",compliance_clip_reason_near:"Close to Gmail's 102 KB clip limit. Consider trimming content.",compliance_clip_reason_raw_html:"{{n}} raw HTML block(s) — custom HTML is included verbatim and can significantly inflate email size.",right_panel_empty_hint:"Click any block in the canvas to edit its specific settings. Drag blocks from the left rail to add new content.",right_panel_back:"Back",layer_show:"Show",layer_hide:"Hide",save_as_universal:"Save as universal",universal_save_modal_title:"Save as universal block",universal_save_modal_subtitle:"Reusable across templates. Edits won't affect already-sent emails.",universal_save_modal_placeholder:"e.g. Beantown footer",universal_save_modal_confirm:"Save block",universal_save_success:'Saved "{{name}}" as universal block',universal_save_error:"Could not save the universal block. Check your connection and try again.",universal_delete:"Remove",universal_delete_confirm_title:"Remove saved block?",universal_delete_confirm_body:"This removes the block from your saved library. Existing emails are not changed.",universal_delete_confirm_ok:"Remove",configure_columns_title:"Configure columns",configure_columns_subtitle:"Pick a layout. Each column starts empty so you can drag blocks into it.",configure_columns_insert:"Insert section",configure_columns_hint:"click to configure layout",configure_columns_row_count:"Rows to insert:",standard_layout:"Standard",grid_layout:"6/12 Grid",grid_settings:"Grid",grid_rows_locked_hint:"Email layouts use one row of columns.",columns_layout:"Columns layout",column_sizes:"Column widths (%)",show_more:"Show more",show_less:"Show less",col:"Col",gaps:"Gaps",column_gap:"Column gap",button_variant:"Variant",full_width:"Full width",hover_bg_color:"Hover background",hover_text_color:"Hover text",text_decoration:"Decoration",shadow:"Shadow",shadow_preset:"Preset",table:"Table",table_settings:"Table settings",footer_settings:"Footer settings",compliance_approx_kb:"{{n}} KB",cell_content:"Cell content",add_link_url:"URL",add_link_url_placeholder:"https://example.com",add_link_display_text:"Display text",add_link_display_text_placeholder:"Leave blank to keep selected text",add_link_display_text_empty_badge:"No text — link will use selected text",add_link_open_new_tab:"Open in new tab",align_left:"Align left",align_center:"Align center",align_right:"Align right",minimize_toolbar:"Collapse",close_text_editor:"Exit text editing",unlink_universal:"Unlink this copy",unlink_modal_title:"Edit universal block",unlink_modal_keep:"Keep linked",unlink_modal_unlink:"Unlink this copy",unlink_modal_body:"This block is linked to a universal snippet. Editing it here will affect all uses of this block everywhere.",unlink_modal_body2:"Choose “Unlink this copy” to make an independent copy that only affects this template, or “Keep linked” to edit all instances together.",custom:"Custom",custom_color:"Custom color",show_text_label:"Show label",mobile_optimization:"Mobile optimization",stack_columns_on_mobile:"Stack columns on mobile",scale_font_on_mobile:"Scale font on mobile",section_layout:"Section Layout",content_max_width:"Content max-width",content_max_width_option_full:"Full width",min_height:"Min height",border:"Border",border_style:"Border style",border_width:"Border width",border_color:"Border color",visibility:"Visibility",hidden_on_mobile:"Hide on mobile",table_structure:"Table Structure",rows:"Rows",header_row:"Header row",header_column:"Header column",cell_selector:"Cell selector",cell_content_type:"Cell content type",table_style:"Table style",cell_padding:"Cell padding",header_style:"Header style",header_background:"Header background",header_text_color:"Header text color",striped_rows:"Striped rows",stripe_color:"Stripe color",table_structure_mode:"Mode",table_mode_static:"Static",table_mode_dynamic:"Dynamic",table_dynamic_structure_hint:"Export still uses static HTML; data-driven tables may be wired in a future update.",table_add_row:"Add row",table_add_column:"Add column",table_decrease_rows:"Decrease row count",table_increase_rows:"Increase row count",table_decrease_cols:"Decrease column count",table_increase_cols:"Increase column count",table_selected_cell:"Selected: row {{row}}, col {{col}}",table_select_cell_hint:"Select a cell in the grid to edit its content.",table_cell_grid_truncated:"Showing first {{rows}} × {{cols}} cells",table_cell_text_placeholder:"Cell text…",table_align_left:"Left",table_align_center:"Center",table_align_right:"Right",footer_visible_lines:"Visible lines",footer_toggle_brand_name:"Brand name",footer_toggle_tagline:"Tagline",footer_toggle_address:"Address",footer_toggle_unsubscribe:"Unsubscribe",footer_toggle_social_row:"Social row",footer_toggle_secondary_links:"Secondary links",footer_toggle_copyright:"Copyright",footer_native_social_hint:"To edit individual platforms and icons, turn off company links above or select the social row on the canvas.",footer_company_social_managed_note:"Icons and profile URLs come from your company data (same as the live preview). Turn off the switch above to customize platforms for this template only.",footer_company_social_url_empty:"No URL in company data",footer_content_heading:"Content",footer_label_brand:"Brand",footer_unsubscribe_link_label:"Unsubscribe link label",footer_preferences_link_label:"Preferences link label",footer_preferences_url:"Preferences URL",footer_preferences_default_label:"Update preferences",footer_secondary_links_heading:"Secondary links",footer_secondary_link_text:"Link text",footer_secondary_link_url:"URL",footer_new_link_label:"New link",footer_add_link:"Add link",footer_social_platforms_heading:"Social platforms",footer_platform_label:"Platform",footer_social_profile_url:"Profile URL",footer_upload_icon:"Upload icon",footer_add_platform:"+ Add platform",footer_style_heading:"Style",footer_text_color:"Text",footer_link_color:"Link",footer_background_content:"Background",footer_column_background:"Column background",footer_align:"Align",footer_border_heading:"Border",footer_divider_above:"Divider above",footer_border_top:"Border top",footer_border_top_color:"Border top color",footer_social_instagram:"Instagram",footer_social_facebook:"Facebook",footer_social_twitter:"Twitter",footer_social_linkedin:"LinkedIn",footer_social_youtube:"YouTube",footer_social_tiktok:"TikTok",footer_social_custom_icon:"Custom icon",footer_sections:"Footer sections",footer_brand_name_placeholder:"Your brand",footer_brand_tagline_placeholder:"Your tagline",footer_address_placeholder:"123 Main St, City, Country",footer_unsubscribe_url_placeholder:"{{unsubscribe_url}}",footer_copyright_placeholder:"© {{year}} Your Company",footer_default_unsubscribe_text:"Unsubscribe",show_brand:"Brand",brand_name:"Brand name",brand_tagline:"Tagline",show_address:"Address",address:"Address text",show_unsubscribe:"Unsubscribe link",unsubscribe_text:"Link text",unsubscribe_url:"Unsubscribe URL",show_social:"Social icons",social_icons_hint:"Configure social icons in the block's content settings.",show_secondary_links:"Secondary links",show_copyright:"Copyright",copyright_text:"Copyright text",footer_style:"Footer style",padding_top:"Top padding",padding_bottom:"Bottom padding",show_divider:"Show divider",header_settings:"Header settings",discount_settings:"Discount settings",discount_show_title:"Show title",preset_discount_simple:"Discount (simple line)",style:"Style",navigation:"Navigation",link_style:"Link style",color:"Color",size:"Size",weight:"Weight",transform:"Transform",gap:"Gap",underline:"Underline",title:"Title",add_link:"Add link",font_weight_medium:"Medium",nav_text_transform_sentence:"Sentence case",nav_text_transform_uppercase:"Uppercase",nav_text_transform_capitalize:"Capitalize",placeholder_https:"https://…",brand_name_placeholder:"Brand name",logo_padding:"Logo padding",default_nav_link_label:"Link",navigation_link_placeholder_url:"#",container_variables_none_available:"No variables available for this container type.",header_layout_logo_left_nav_right:"Logo left, Navigation right",header_layout_logo_right_nav_left:"Logo right, Navigation left",header_layout_logo_center_nav_below:"Logo centered, Navigation below",header_layout_logo_only:"Logo only",header_layout_nav_only:"Navigation only",header_banner_section:"Header banner",show_header_banner:"Show header banner",footer_banner_section:"Footer banner",show_footer_banner:"Show footer banner",border_none:"None",discount_code_section:"Promo code",discount_code_background:"Code background",discount_code_corner_radius:"Code corner radius",column_preset_1_col:"1 col",column_preset_equal_2:"Equal 2",column_preset_equal_3:"Equal 3",column_preset_equal_4:"Equal 4",column_preset_1_2:"1 / 2",column_preset_2_1:"2 / 1",column_preset_1_3:"1 / 3",column_preset_3_1:"3 / 1",column_preset_2_3:"2 : 3",column_preset_3_2:"3 : 2",column_preset_1_2_1:"1 / 2 / 1",column_preset_2_1_1:"2 / 1 / 1",column_preset_1_1_2:"1 / 1 / 2",column_preset_2_4_2_4:"2-4 · 2-4",column_preset_4_2_4_2:"4-2 · 4-2"},Zo=()=>{const{language:t,languageLibraries:n}=e.useContext($e);let o={zh:Yo,en:Xo};n&&(o={...o,...n,zh:{...Yo,...o.zh||{}},en:{...Xo,...o.en||{}}});return{t:(e,n)=>{let a=(o[t]||{})[e];return n&&n instanceof Object&&Object.keys(n).forEach(e=>{a=a.replace(`{{${e}}}`,n[e])}),a||e}}};function Qo(e){return"string"!=typeof e?e:e.replace(/\u202E/g,"").replace(/\u202D/g,"").replace(/\u202A/g,"").replace(/\u202B/g,"").replace(/\u202C/g,"").replace(/\sdir\s*=\s*["']rtl["']/gi,' dir="ltr"').replace(/\sstyle\s*=\s*["']([^"']*)["']/gi,(e,t)=>{const n=String(t||"").replace(/\s*direction\s*:\s*rtl\s*;?/gi,"").trim();return n?` style="${n}"`:""})}function ea(e){if("string"!=typeof e||!e)return{masked:e||"",tokens:[]};const t=[];return{masked:e.replace(/\{\{[^{}]+\}\}/g,e=>(t.push(e),`${t.length-1}`)),tokens:t}}function ta(e,t){if("string"!=typeof e||!t.length)return e;let n=e;for(let e=t.length-1;e>=0;e--){const o=`${e}`;n=n.split(o).join(t[e])}return n}let na=0;function oa(a){if("function"!=typeof a)return;const l="undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now();if(l-na<2200)return;na=l;const i=e.createElement(n.FontAwesomeIcon,{icon:o.faInfoCircle,style:{fontSize:24,color:"#93c5fd"},"aria-hidden":!0});t.notification.open({key:"ee-text-ai-readonly-hint",icon:i,message:e.createElement("span",{style:{fontSize:15,fontWeight:700,color:"#fafafa",letterSpacing:"0.01em"}},a("text_ai_mode_manual_edit_title")),description:e.createElement("span",{style:{fontSize:13,lineHeight:1.55,color:"#e5e5e5"}},a("text_ai_mode_manual_edit_disabled")),duration:8,placement:"top",top:72,className:"ee-ai-readonly-notification",style:{width:380,maxWidth:"min(380px, calc(100vw - 32px))"}})}function aa(e){return e&&"text"===e.key&&"dynamic"===e.contentType}const la=/\{\{(\w+)\}\}/g;function ia(e,t){if(null!=e)if("string"!=typeof e){if(Array.isArray(e))e.forEach(e=>ia(e,t));else if("object"==typeof e){if(void 0!==e.$$typeof)return;Object.values(e).forEach(e=>ia(e,t))}}else(function(e){if("string"!=typeof e||0===e.length)return[];const t=[];let n;for(;null!==(n=la.exec(e));){const e=n[1];e&&t.push(e)}return la.lastIndex=0,t})(e).forEach(e=>t.add(e))}function ra(e,t,n){e&&"object"==typeof e&&(e.id&&n.has(e.id)||(e.id&&n.add(e.id),"column"!==e.key?ia(e,t):(e.children||[]).forEach(e=>{(e?.children||[]).forEach(e=>ra(e,t,n))})))}function sa(e,t,n,o){if(!e||o.has(e))return;o.add(e);const a=t[e];a&&"object"==typeof a&&("column"===a.key?(a.cells||[]).forEach(e=>{(e.childrenIds||[]).forEach(e=>sa(e,t,n,o))}):ia(a,n))}function ca(e,t){const n=new Set;if(!e||"object"!=typeof e)return n;if(Array.isArray(e.children)){const t=new Set;return ra(e,n,t),n}if(!t||"object"!=typeof t)return n;const o=new Set;return(e.cells||[]).forEach(e=>{(e.childrenIds||[]).forEach(e=>sa(e,t,n,o))}),n}const da=()=>{const t=(e,n)=>e?e.classList?.contains("text-content_editable")?null:e&&e.tagName?.toLocaleLowerCase()===n?e:t(e.parentNode,n):null,n=e.useCallback((e,t)=>e?e.classList?.contains("text-content_editable")?null:e&&e.style?.[t]?e.style[t]:n(e.parentNode,t):null,[]);return{getSelectionNode:t,getSectionStyle:n}},ua=({modifyText:t,setTextContent:a})=>{const{selectionRange:i}=e.useContext($e),{getSelectionNode:r}=da(),{t:s}=Zo(),c=e.useMemo(()=>i?r(i.commonAncestorContainer,"b"):null,[i,r]);return l.jsx("button",{className:Go("rich-text-tools-button ",c&&"rich-text-tools-button-active"),title:s("tooltip_bold"),onClick:()=>{t("bold",!1,null),a()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faBold,className:"rich-text-tools-button-icon"})})};function pa(e,t){if(!e)return!1;const n=e.commonAncestorContainer;if(!function(e){let t=e;for(t&&3===t.nodeType&&(t=t.parentElement);t;){if(t.classList?.contains("text-content_editable"))return!0;t=t.parentNode}return!1}(n))return!1;try{if(document.queryCommandState("italic"))return!0}catch{}return!("function"!=typeof t||!t(n,"i")&&!t(n,"em"))||function(e){let t=e;for(t&&3===t.nodeType&&(t=t.parentElement);t&&!t.classList?.contains("text-content_editable");){if(1===t.nodeType){const e=t.tagName?.toLowerCase();if("i"===e||"em"===e)return!0;const n=t.style?.fontStyle;if("italic"===n||"oblique"===n)return!0;try{if("undefined"!=typeof window&&window.getComputedStyle){const e=window.getComputedStyle(t).fontStyle;if("italic"===e||"oblique"===e)return!0}}catch{}}t=t.parentNode}return!1}(n)}const ma=({modifyText:t,setTextContent:a})=>{const{selectionRange:i}=e.useContext($e),{getSelectionNode:r}=da(),{t:s}=Zo(),c=pa(i,r);return l.jsx("button",{className:Go("rich-text-tools-button ",c&&"rich-text-tools-button-active"),title:s("tooltip_italic"),onClick:()=>{try{document.execCommand("styleWithCSS",!1,!0)}catch{}t("italic",!1,null),a()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faItalic,className:"rich-text-tools-button-icon"})})},ga=({modifyText:t,setTextContent:a})=>{const{selectionRange:i}=e.useContext($e),{getSelectionNode:r}=da(),{t:s}=Zo(),c=e.useMemo(()=>i?r(i.commonAncestorContainer,"u"):null,[i,r]);return l.jsx("button",{className:Go("rich-text-tools-button ",c&&"rich-text-tools-button-active"),title:s("tooltip_underline"),onClick:()=>{t("underline",!1,null),a()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faUnderline,className:"rich-text-tools-button-icon"})})},ha=({modifyText:t,setTextContent:a})=>{const{selectionRange:i}=e.useContext($e),{getSelectionNode:r}=da(),{t:s}=Zo(),c=e.useMemo(()=>i?r(i.commonAncestorContainer,"strike"):null,[i,r]);return l.jsx("button",{className:Go("rich-text-tools-button ",c&&"rich-text-tools-button-active"),title:s("tooltip_strikethrough"),onClick:()=>{t("strikethrough",!1,null),a()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faStrikethrough,className:"rich-text-tools-button-icon"})})},ba=({modifyText:t,setTextContent:a})=>{const{selectionRange:i}=e.useContext($e),{getSelectionNode:r}=da(),{t:s}=Zo(),c=e.useMemo(()=>i?r(i.commonAncestorContainer,"ol"):null,[i,r]);return l.jsx("button",{className:Go("rich-text-tools-button ",c&&"rich-text-tools-button-active"),title:s("tooltip_ordered_list"),onClick:()=>{t("insertOrderedList",!1,null),a()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faListOl,className:"rich-text-tools-button-icon"})})},ya=({modifyText:t,setTextContent:a})=>{const{selectionRange:i}=e.useContext($e),{getSelectionNode:r}=da(),{t:s}=Zo(),c=e.useMemo(()=>i?r(i.commonAncestorContainer,"ul"):null,[i,r]);return l.jsx("button",{className:Go("rich-text-tools-button ",c&&"rich-text-tools-button-active"),title:s("tooltip_unordered_list"),onClick:()=>{t("insertUnorderedList",!1,null),a()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faListUl,className:"rich-text-tools-button-icon"})})},fa=({modifyText:a,setTextContent:i})=>{const{selectionRange:r}=e.useContext($e),{t:s}=Zo(),{getSelectionNode:c}=da(),[d,u]=e.useState(!1),[p,m]=e.useState({value:"",range:null}),[g,h]=e.useState(""),[b,y]=e.useState(!0),f=e.useRef(null),_=e.useMemo(()=>r?c(r.commonAncestorContainer,"a"):null,[r,c]),k=e.useCallback(()=>{u(!1),m({value:"",range:null}),h(""),y(!0)},[]),x=e.useCallback(()=>{const{range:e,value:t,rangeIsLink:n}=p;if(e){if(n){const n=e.commonAncestorContainer,o=1===n.nodeType&&"A"===n.nodeName?n:n.parentNode&&"A"===n.parentNode.nodeName?n.parentNode:null;o&&(o.setAttribute("href",t),o.target=b?"_blank":"_self",g.trim()&&(o.textContent=g.trim()))}else{const n=document.createElement("a");if(n.target=b?"_blank":"_self",n.setAttribute("href",t),g.trim())n.textContent=g.trim(),e.deleteContents(),e.insertNode(n);else try{e.surroundContents(n)}catch{return void k()}}i(),k()}else k()},[p,g,b,i,k]);return l.jsxs(l.Fragment,{children:[l.jsx("button",{className:Go("rich-text-tools-button ",_&&"rich-text-tools-button-active"),title:s("tooltip_link"),onClick:e=>{let t=window.getSelection(),n=t.getRangeAt(0);const o=n.commonAncestorContainer.parentNode,a="A"===o.nodeName,l={...p,range:n};let r="",s=!0;if(a){l.rangeIsLink=!0;const e=o.getAttribute("href"),t=null!=e?String(e).trim():"";l.value=""!==t?t:String(o.href||"").trim(),r=o.textContent||"",s="_self"!==o.target}else{r=t.toString()}const c=e?.currentTarget?.closest?.(".email-editor");c&&(f.current=c),m(l),h(r),y(s),u(!0),i()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faLink,className:"rich-text-tools-button-icon"})}),l.jsx("button",{className:Go("rich-text-tools-button"),title:s("tooltip_remove_link"),onClick:()=>{a("unlink",!1,null),i()},children:l.jsx(n.FontAwesomeIcon,{icon:o.faUnlink,className:"rich-text-tools-button-icon"})}),l.jsx(t.Modal,{title:s("add_link_modal_title"),open:d,zIndex:1100,getContainer:()=>"undefined"==typeof document?null:f.current||document.querySelector(".email-editor")||document.body,onOk:x,onCancel:k,okText:s("confirm"),cancelText:s("cancel"),wrapClassName:"ee-modal-dark",children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[l.jsxs("div",{children:[l.jsx("div",{style:{marginBottom:4,fontSize:12,fontWeight:500},children:s("add_link_url")||"URL"}),l.jsx(t.Input,{value:p.value??"",placeholder:s("add_link_url_placeholder")||s("link_url_placeholder")||"https://example.com",onChange:e=>m({...p,value:e.target.value})})]}),l.jsxs("div",{children:[l.jsxs("div",{style:{marginBottom:4,display:"flex",alignItems:"center",flexWrap:"wrap",gap:8},children:[l.jsx("span",{style:{fontSize:12,fontWeight:500},children:s("add_link_display_text")||"Display text"}),g.trim()?null:l.jsx(t.Badge,{status:"warning",text:s("add_link_display_text_empty_badge"),className:"ee-link-modal-display-text-badge"})]}),l.jsx(t.Input,{value:g,placeholder:s("add_link_display_text_placeholder")||"Leave blank to keep selected text",onChange:e=>h(e.target.value)})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[l.jsx("span",{style:{fontSize:13},children:s("add_link_open_new_tab")||"Open in new tab"}),l.jsx(t.Switch,{className:"ee-settings-switch",checked:b,onChange:y})]})]})})]})},_a=({id:i,textBlock:r,syncTextFromDom:s})=>{const{blockMap:c,rootOrder:d,templateData:u}=e.useContext($e),{t:p}=Zo(),m=e.useRef(null),[g,h]=e.useState(!1),[b,y]=e.useState(!1),f=e.useMemo(()=>{const e=oe(c,d,i),t=e?.[0]??null;return{containerBlock:t?.containerBlock??null,containerType:t?.containerType??"none",cellIndex:t?.cellIndex??0,lineage:e}},[c,d,i]),_=e.useMemo(()=>{const e=f?.cellIndex??0,t=f?.containerBlock;return{columnIndex:e,columnProduct:t?.columnProducts?.[e]??null}},[f]),k=e.useMemo(()=>(f?.lineage??[]).slice(1).filter(e=>e?.containerType&&"none"!==e.containerType).map(e=>{const t=e.cellIndex??0;return{containerType:e.containerType,context:{columnIndex:t,columnProduct:e.containerBlock?.columnProducts?.[t]??null}}}),[f?.lineage]),x=e.useMemo(()=>Ht(0,f?.containerType??"none",u,_,k),[f?.containerType,u,_,k]),v=e.useMemo(()=>ca(f?.containerBlock,c),[f?.containerBlock,c]),w=e.useMemo(()=>x.filter(e=>"image"!==e.type&&!v.has(e.variableKey??e.key)),[x,v]),S=e.useCallback(()=>{if(!m.current)return;const e=m.current.parentNode?.getBoundingClientRect(),t=document.querySelector("#preview");if(!e||!t)return;const n=t.getBoundingClientRect();e.top-190<0?(m.current.style.bottom="auto",m.current.style.top="110%"):(m.current.style.bottom="110%",m.current.style.top="auto"),e.left+420>n.left+n.width?(m.current.style.left="auto",m.current.style.right="0"):(m.current.style.left="0",m.current.style.right="auto")},[]);e.useEffect(()=>{S()},[S]),e.useEffect(()=>{const e=()=>{const e="undefined"!=typeof window&&window.getSelection(),t=m.current;if(!e||0===e.rangeCount||!t)return void S();const n=e.getRangeAt(0),o=r?.current;if(!o||!o.contains(n.commonAncestorContainer)||e.isCollapsed)return void S();const a=n.getBoundingClientRect();if(!a||0===a.width&&0===a.height)return void S();const l=t.parentNode;if(!l)return;const i=l.getBoundingClientRect(),s=document.querySelector("#preview"),c=s?s.getBoundingClientRect():null;let d=a.top-i.top-46-8;a.top-60<0&&(d=a.bottom-i.top+8);let u=a.left-i.left+a.width/2-210;if(c){const e=c.left-i.left+8,t=c.right-i.left-8-420;u=Math.max(e,Math.min(u,t))}t.style.top=`${d}px`,t.style.bottom="auto",t.style.left=`${u}px`,t.style.right="auto"};return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[S,r]);const j=(e,t,n)=>{document.execCommand(e,t,n)},C=()=>{"function"!=typeof s?r?.current&&("undefined"!=typeof InputEvent&&InputEvent?r.current.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0})):r.current.dispatchEvent(new Event("input",{bubbles:!0}))):s()};return l.jsx("div",{className:"rich-text",ref:m,onClick:e=>{e.preventDefault(),e.stopPropagation()},children:l.jsx(a.motion.div,{className:"rich-text-tools",initial:{scale:0,x:0},animate:{scale:1,x:0},style:{width:g?"auto":"max-content",maxWidth:"min(100%, 520px)"},children:l.jsxs("div",{className:"rich-text-tools-body items-center",children:[!g&&l.jsxs(l.Fragment,{children:[l.jsx(ua,{modifyText:j,setTextContent:C}),l.jsx(ma,{modifyText:j,setTextContent:C}),l.jsx(ga,{modifyText:j,setTextContent:C}),l.jsx(ha,{modifyText:j,setTextContent:C}),l.jsx(ba,{modifyText:j,setTextContent:C}),l.jsx(ya,{modifyText:j,setTextContent:C}),l.jsx(fa,{modifyText:j,setTextContent:C}),l.jsx(t.Popover,{zIndex:540,trigger:"click",open:b,onOpenChange:y,overlayClassName:"ee-rich-text-variables-popover",getPopupContainer:()=>document.querySelector("#preview")||document.body,content:l.jsxs("div",{className:"ee-rich-text-variables-menu",children:[l.jsx("div",{className:"ee-rich-text-variables-header",children:p("variables")}),w.map(e=>l.jsx("div",{className:"ee-rich-text-variables-item",onMouseDown:t=>{t.preventDefault(),(e=>{if(!r?.current||!e)return;const t=window.getSelection();let n=null;if(t?.rangeCount){const e=t.getRangeAt(0);r.current.contains(e.commonAncestorContainer)&&(n=e)}n||(n=document.createRange(),n.selectNodeContents(r.current),n.collapse(!1)),n.deleteContents();const o=document.createTextNode(e);n.insertNode(o),n.setStartAfter(o),n.collapse(!0),t&&(t.removeAllRanges(),t.addRange(n)),C(),y(!1)})(e.value)},children:e.labelKey?p(e.labelKey):e.label||e.value},`variables-${e.value}`))]}),children:l.jsx("button",{className:"rich-text-tools-button",title:p("insert_merge_field"),onMouseDown:e=>e.preventDefault(),children:l.jsx("span",{className:"rich-text-tools-button-icon",style:{color:"#fff",fontFamily:"monospace",fontWeight:700,fontSize:13,lineHeight:1},children:"{}"})})})]}),l.jsx("button",{className:"rich-text-tools-button",title:p("minimize_toolbar")||"Collapse",onClick:()=>h(!g),children:l.jsx(n.FontAwesomeIcon,{icon:g?o.faExpandAlt:o.faCompressAlt,className:"rich-text-tools-button-icon"})})]})})})},ka=({id:t,blockItem:n,displayContent:o})=>{const{currentItem:a,previewMode:i,blockMap:r,rootOrder:s,setBlocks:c,setCurrentItem:d,isDragStart:u,templateData:p,registerRichTextFlush:m,actionType:g}=e.useContext($e),{t:h}=Zo(),b=e.useRef(null),y=e.useRef(null),f=e.useRef(!1),_=e.useRef(!1),k="undo"===g||"redo"===g||"string"==typeof g&&g.startsWith("set_history"),x=a&&a.id===(t??n?.id),v="text"===n?.key&&"dynamic"===n?.contentType,w=x&&!v,S="desktop"===i?n.styles?.desktop??{}:{...n.styles?.desktop??{},...n.styles?.mobile??{}},j=S.linkColor||"#2faade",{linkColor:C,...N}=S,I={...N,direction:"ltr",unicodeBidi:"isolate","--ee-rich-text-link-color":j},A=e.useRef(!1),L=null!=o?o:n.text||"",T=e.useMemo(()=>{const e=oe(r,s,t??n?.id),o=e?.[0]??null;return{containerBlock:o?.containerBlock??null,containerType:o?.containerType??"none",cellIndex:o?.cellIndex??0,lineage:e}},[r,s,t,n?.id]),B=e.useMemo(()=>{const e=T?.cellIndex??0,t=T?.containerBlock;return{columnIndex:e,columnProduct:t?.columnProducts?.[e]??null}},[T]),$=e.useMemo(()=>(T?.lineage??[]).slice(1).filter(e=>e?.containerType&&"none"!==e.containerType).map(e=>{const t=e.cellIndex??0;return{containerType:e.containerType,context:{columnIndex:t,columnProduct:e.containerBlock?.columnProducts?.[t]??null}}}),[T?.lineage]),R=e.useMemo(()=>Ht(0,T?.containerType??"none",p,B,$).map(e=>{return t=e.value,n=e.pasteValue,{token:t,pasteValue:String(n||"")};var t,n}).filter(e=>e.token&&e.pasteValue&&""!==e.pasteValue.trim()&&!e.pasteValue.includes("{{")&&e.pasteValue!==e.token).sort((e,t)=>t.pasteValue.length-e.pasteValue.length),[p,B,T?.containerType,$]),P=e.useCallback(e=>{if(!e||!R.length||"undefined"==typeof document)return e;const t=document.createElement("div");t.innerHTML=e;const n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let o=n.nextNode();for(;o;){const e=o.nodeValue||"",{masked:t,tokens:a}=ea(e);let l=t;R.forEach(({token:e,pasteValue:t})=>{t&&l.includes(t)&&(l=l.split(t).join(e))}),o.nodeValue=ta(l,a),o=n.nextNode()}return t.innerHTML},[R]);e.useEffect(()=>{f.current=w},[w]);const M=e.useCallback(()=>{null!=y.current&&(clearTimeout(y.current),y.current=null)},[]);e.useEffect(()=>()=>M(),[M]),e.useEffect(()=>{if(w&&b.current){const e=Qo(L);if(A.current){const t=b.current,n=Qo(t.innerHTML||"");if("undefined"!=typeof document&&document.activeElement===t&&e!==n&&!k)return void(A.current=!0);e!==n&&(t.innerHTML=e)}else b.current.innerHTML=e,b.current.focus();A.current=!0}else A.current=!1},[w,t,L,k]);const F=e.useCallback(e=>{if(!e)return;const l=t??n?.id,i=r[l]||{},{textToStore:u,unchangedFromResolved:p}=function({rawHtml:e,displayContent:t,blockItemText:n,oldBlockKey:o,blockItemKey:a,restoreVariableTokensInHtml:l}){const i=Qo(e),r=null!=t?Qo(String(t)):null,s=!/<\s*a\b/i.test(i)&&null!=r&&i===r;let c=s?n:i;return"text"===(o??a)&&"function"==typeof l&&(c=l(c)),{textToStore:c,unchangedFromResolved:s}}({rawHtml:e.innerHTML,displayContent:o,blockItemText:n.text,oldBlockKey:i.key,blockItemKey:n.key,restoreVariableTokensInHtml:P}),m=p?i.selectedVariableKey:void 0;if((i.text??"")===(u??"")&&String(i.selectedVariableKey??"")===String(m??""))return;const g={...i,text:u,selectedVariableKey:m},h={...r,[l]:g};c(h,s,`edit_${Date.now()}`),d({...a,data:g})},[t,n?.id,n?.key,n?.text,r,s,c,d,a,o,P]),U=e.useCallback(()=>{F(b.current)},[F]),D=e.useCallback(()=>{M(),y.current=setTimeout(()=>{y.current=null,f.current&&b.current&&!_.current&&F(b.current)},380)},[M,F]),E=e.useCallback(()=>{M(),U()},[M,U]);e.useEffect(()=>{if(w&&"function"==typeof m)return m(U)},[w,m,U]);const z=e.useCallback(e=>{if("number"==typeof e.button&&0!==e.button)return;if(!x||!v)return;oa(h);const t=b.current;if(t&&"function"==typeof t.focus)try{t.focus({preventScroll:!0})}catch{t.focus()}},[x,v,h]),O=e.useCallback(e=>{if(!x||!v)return;if(e.metaKey||e.ctrlKey||e.altKey)return;if("Tab"===e.key||"Escape"===e.key)return;if(e.isComposing)return;const t=e.key;1!==t.length&&"Enter"!==t&&"Backspace"!==t&&"Delete"!==t||(e.preventDefault(),oa(h))},[x,v,h]),W=e.useCallback(e=>{(e=>{e.preventDefault(),e.stopPropagation()})(e)},[]),H=Qo(L),K=t??n?.id;return l.jsxs("div",{className:"relative",dir:"ltr",style:{direction:"ltr",unicodeBidi:"isolate"},children:[w&&n&&!u&&l.jsx(_a,{textBlock:b,id:K,syncTextFromDom:U}),l.jsx("div",{className:Go(w&&"text-block","text-content_editable"),tabIndex:x&&v?0:void 0,onPointerDownCapture:z,onKeyDownCapture:O,onClick:W,onInput:w?()=>{_.current||D()}:void 0,onBlur:E,onCompositionStart:()=>{_.current=!0,M()},onCompositionEnd:()=>{_.current=!1,M(),U()},style:I,dir:"ltr",contentEditable:w,suppressContentEditableWarning:!0,ref:b,dangerouslySetInnerHTML:w?void 0:{__html:H}})]})},xa=t=>{const{id:n,blockItem:o}=t,{currentItem:a,previewMode:i,templateData:r,blockMap:s,rootOrder:c}=e.useContext($e),d="desktop"===i?o.styles?.desktop??{}:{...o.styles?.desktop??{},...o.styles?.mobile??{}},u=a&&a.id===n,p=e.useMemo(()=>ae(s,c,n),[s,c,n]),m=e.useMemo(()=>Lt(o.text,r,p),[o.text,r,p]),g=u?o.text||"":m,h=null!=d.linkColor&&""!==String(d.linkColor).trim()?String(d.linkColor).trim():"#2faade",b=e.useMemo(()=>Jt(g,h,{useImportant:!1}),[g,h]),y=p?.containerBlock,f="footer"===y?.containerType,_=(m||"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();if(f&&(""===_||"{{Address}}"===_||"{{Tagline}}"===_))return null;const k=o.type&&/^h[1-4]$/.test(o.type)?o.type:"div";return u?l.jsx(ka,{...t,blockItem:o}):e.createElement(k,{style:{...d,direction:"ltr",unicodeBidi:"isolate"},dir:"ltr",dangerouslySetInnerHTML:{__html:b}})};const va=t=>{const{blockItem:n,id:o}=t,{currentItem:a,previewMode:i,templateData:r,blockMap:s,rootOrder:c}=e.useContext($e),d=e.useMemo(()=>ae(s,c,o),[o,s,c]),u=e.useMemo(()=>{const e=n.text??"",t=e.match(/\{\{(\w+)\}\}/),o=n.labelVariable?n.labelVariable.replace(/^\{\{|\}\}$/g,"").trim():t?t[1]:void 0;if(!r||!o)return e;const a=Ft(r,o,d);return null==a||String(a).startsWith("{{")?e:String(a)},[n.text,n.labelVariable,r,d]),p=a&&a.id===o,m=e.useMemo(()=>{const e="desktop"===i?n.styles?.desktop??{}:{...n.styles?.desktop??{},...n.styles?.mobile??{}};let t=e.backgroundColor;return!function(e,t,n,o){const a=oe(t,n,o).find(e=>"product"===e?.containerType);if(!a?.containerBlock)return!1;if(!function(e,t){if(!t||"column"!==t.key||"product"!==t.containerType)return!1;if("additional"===t.productRole)return!1;if("image_left"===t.mainProductLayout)return!0;if("image_stacked"===t.mainProductLayout)return!1;const n=t.cells||[],o=n[0]?.childrenIds?.[0],a=e[o];return"column"===a?.key&&"2-3"===a?.type}(t,a.containerBlock))return!1;const l=e.styles?.desktop?.backgroundColor;return null==l||""===String(l).trim()||Bn(l)===Bn(Tn)}(n,s,c,o)?(null==t||""===String(t).trim()||$n(t))&&(t=Rn(r)):t=Rn(r),{...e,backgroundColor:t}},[n,s,o,i,c,r]),g="desktop"===i?n.contentStyles?.desktop:{...n.contentStyles?.desktop,...n.contentStyles?.mobile},h=e.useMemo(()=>l.jsx(ka,{...t,blockItem:{...n,styles:{...n.styles,desktop:{...n.styles?.desktop,backgroundColor:m.backgroundColor}}},displayContent:u}),[n,u,m.backgroundColor]);return l.jsx("div",{style:{...g},children:p?h:l.jsx("div",{style:{...m,textAlign:"center"},dangerouslySetInnerHTML:{__html:u}})})},wa=({blockItem:t})=>{const{previewMode:n}=e.useContext($e),o="desktop"===n?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},a="desktop"===n?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile};return l.jsx("div",{className:"relative",children:l.jsx("div",{style:{...a},children:l.jsx("div",{style:{...o}})})})},Sa=({blockItem:t})=>{const{previewMode:n}=e.useContext($e),o="desktop"===n?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},a="desktop"===n?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile};return l.jsx("div",{className:"relative",style:{...a},children:l.jsx("div",{style:{width:"100%",height:"number"==typeof o.height?`${o.height}px`:o.height||"16px",display:o.display||"block"}})})},ja=({blockItem:t})=>{const{previewMode:n}=e.useContext($e),{list:o=[],separator:a=" | "}=t,i=o,r=t.mobileLayout??"stack",s="mobile"===n&&"stack"===r,c=y("desktop"===n?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}}),d="desktop"===n?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile},u=d&&"object"==typeof d?{...d}:{},p=u.textAlign??"center";delete u.textAlign;const m=t.linkGapPx,g="number"==typeof m&&Number.isFinite(m)&&m>=0?m:0,h=Boolean(t.linkUnderline),b=c.fontWeight,f="normal"===b||"bold"===b?b:null!=b?String(b):"400",_={fontSize:null!=c.fontSize?`${c.fontSize}px`:"14px",fontFamily:c.fontFamily||"sans-serif",color:c.linkColor||c.color||"#2faade",fontWeight:f,letterSpacing:null!=c.letterSpacing?`${c.letterSpacing}px`:"0px",textDecoration:h?"underline":"none",textTransform:c.textTransform??"none",display:"inline-block"},k={fontSize:null!=c.fontSize?`${c.fontSize}px`:"14px",color:c.color||"#333",display:"inline-block",verticalAlign:"middle",whiteSpace:"pre"},x=g>0?{...k,marginLeft:g,marginRight:g}:{...k,paddingLeft:4,paddingRight:4},v="left"===p?"flex-start":"right"===p?"flex-end":"center",w=s?{...u,display:"flex",flexDirection:"column",flexWrap:"nowrap",alignItems:v,...g>0?{gap:g}:{},width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box"}:{...u,display:"block",textAlign:"justify"===p?"justify":p,width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box"},S=(e,t)=>l.jsx("a",{href:e.url?e.url.startsWith("http")?e.url:`https://${e.url}`:"#",target:"_blank"===e.target?"_blank":"_self",rel:"_blank"===e.target?"noopener noreferrer":void 0,style:_,onClick:e=>e.preventDefault(),children:e.label||"Link"},`${t}-link`);return l.jsx("div",{className:"relative ee-menu-block-root",children:l.jsx("div",{className:"ee-menu-block-inner",style:w,children:i.flatMap((e,t)=>{if(s)return[S(e,t)];const n=[];return t>0&&n.push(l.jsx("span",{style:x,children:a},`${t}-sep`)),n.push(S(e,t)),n})})})};function Ca(e,t,n){return Math.min(n,Math.max(t,e))}function Na(e,t,n,o){const a=(e?.[t]??e?.desktop??{})[n];return"number"==typeof a&&Number.isFinite(a)?a:o}function Ia({blockMap:e,id:t,previewMode:n,widthPx:o,heightPx:a,marginLeftPx:l,marginTopPx:i}){const r=e[t];if(!r||"image"!==r.key)return e;const s=B(r);if(s.styles||(s.styles={desktop:{},mobile:{}}),s.styles[n]||(s.styles[n]={}),s.contentStyles||(s.contentStyles={desktop:{},mobile:{}}),s.contentStyles[n]||(s.contentStyles[n]={...s.contentStyles.desktop??{}}),null!=o){const e=`${Math.round(o)}px`;s.styles[n].width=e,"desktop"!==n&&(s.styles.desktop.width=e)}if(null!=a){const e=`${Math.round(a)}px`;s.styles[n].height=e,"desktop"!==n&&(s.styles.desktop.height=e)}if(null!=l){const e=Math.round(l);s.contentStyles[n].marginLeft=e,"desktop"!==n&&(s.contentStyles.desktop.marginLeft=e)}if(null!=i){const e=Math.round(i);s.contentStyles[n].marginTop=e,"desktop"!==n&&(s.contentStyles.desktop.marginTop=e)}return{...e,[t]:s}}function Aa({active:t,hostRef:n,blockId:o,previewMode:a,getEditorSnapshot:i}){const r=e.useRef(null),s=e.useRef(null),c=e.useRef(i);e.useEffect(()=>{c.current=i},[i]);const d=e.useCallback(e=>l=>{if(!t||!n.current)return;l.stopPropagation(),l.preventDefault(),s.current=null;const i=n.current,d=i.parentElement;if(!d)return;const u=d.getBoundingClientRect(),p=i.getBoundingClientRect(),m=i.querySelector("img"),g=m?.getBoundingClientRect()??p,h=u.width>0?u.width:600,b=c.current().blockMap[o],y=b?.contentStyles??{},f=Na(y,a,"marginLeft",p.left-u.left),_=Na(y,a,"marginTop",g.top-u.top),k=p.width,x=g.height;r.current={edge:e,startX:l.clientX,startY:l.clientY,startMl:f,startMt:_,startW:k,startH:x,parentW:h};const v=e=>{const t=r.current;if(!t||!n.current)return;const l=c.current(),{blockMap:i,rootOrder:d,setBlocks:u,setCurrentItem:p,currentItem:m}=l,g=s.current||i,h=e.clientX-t.startX,b=e.clientY-t.startY,y=Math.max(24,.05*t.parentW),f=t.parentW-t.startMl;if("e"===t.edge){const e=Ca(t.startW+h,y,f),n=Ia({blockMap:g,id:o,previewMode:a,widthPx:e,heightPx:null,marginTopPx:null});u(n,d,{skipUndo:!0}),m?.id===o&&p({...m,data:n[o]}),s.current=n}else if("w"===t.edge){const e=Ca(t.startMl+h,0,t.parentW-y),n=Ca(t.startMl+t.startW-e,y,t.parentW-e),l=Ia({blockMap:g,id:o,previewMode:a,widthPx:n,marginLeftPx:e,heightPx:null,marginTopPx:null});u(l,d,{skipUndo:!0}),m?.id===o&&p({...m,data:l[o]}),s.current=l}else if("s"===t.edge){const e=Ca(t.startH+b,24,2e3),n=Ia({blockMap:g,id:o,previewMode:a,widthPx:null,heightPx:e,marginLeftPx:null,marginTopPx:null});u(n,d,{skipUndo:!0}),m?.id===o&&p({...m,data:n[o]}),s.current=n}else if("n"===t.edge){const e=Ca(t.startMt+b,0,800),n=Ca(t.startH-b,24,2e3),l=Ia({blockMap:g,id:o,previewMode:a,widthPx:null,heightPx:n,marginLeftPx:null,marginTopPx:e});u(l,d,{skipUndo:!0}),m?.id===o&&p({...m,data:l[o]}),s.current=l}},w=()=>{r.current=null,document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",w);const e=c.current(),{rootOrder:t,setBlocks:n}=e,o=s.current||e.blockMap;s.current=null,n({...o},t,{skipUndo:!1})};document.addEventListener("pointermove",v),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",w)},[t,n,o,a]);if(!t)return null;const u=(e,t,n,o)=>l.jsx("button",{type:"button",className:`ee-image-resize-handle ${t}`,"aria-label":o,tabIndex:-1,style:{cursor:n,touchAction:"none"},onPointerDown:d(e)});return l.jsxs(l.Fragment,{children:[u("n","ee-image-resize-handle--n","n-resize","Resize from top edge"),u("s","ee-image-resize-handle--s","s-resize","Resize from bottom edge"),u("e","ee-image-resize-handle--e","e-resize","Resize from right edge"),u("w","ee-image-resize-handle--w","w-resize","Resize from left edge")]})}function La(e){return null!=e&&"string"==typeof e&&/<[a-zA-Z!/?]/.test(e.trim())}function Ta(e){switch(e){case"h1":case"h2":case"h3":return 700;case"subtitle":case"eyebrow":return 600;default:return 400}}const Ba=({blockItem:t,id:a})=>{const{previewMode:i,templateData:r,blockMap:s,rootOrder:c,bodySettings:d,currentItem:p,setBlocks:m,setCurrentItem:g}=e.useContext($e),h=s[a]||t,{src:b,alt:y,linkURL:f}=h,_="desktop"===i?h.styles?.desktop??{}:{...h.styles?.desktop??{},...h.styles?.mobile??{}},{outerContentStyles:k,hostMarginStyle:x}=e.useMemo(()=>{const e="desktop"===i?h.contentStyles?.desktop??{}:{...h.contentStyles?.desktop,...h.contentStyles?.mobile},{marginLeft:t,marginTop:n,...o}=e,a={};return null!=t&&(a.marginLeft=t),null!=n&&(a.marginTop=n),{outerContentStyles:o,hostMarginStyle:a}},[h.contentStyles,i]),v=e.useRef(null),w=e.useCallback(()=>({blockMap:s,rootOrder:c,setBlocks:m,setCurrentItem:g,currentItem:p,previewMode:i}),[s,c,m,g,p,i]),S=e.useMemo(()=>{const e="string"==typeof b&&/^\{\{\w+\}\}$/.test(b.trim())?b.trim():"";if(b&&!e)return b;if(!r||!e)return b||"";const t=ae(s,c,a),n=e.replace(/^\{\{|\}\}$/g,"").trim(),o=Ft(r,n,t);return o&&!o.startsWith("{{")?o:b||""},[b,r,s,c,a]),j="string"==typeof b&&/^\{\{\w+\}\}$/.test(b.trim())?b.trim():"",C=!S||S.startsWith("{{"),N=y||"Image",I=_.width,A=I&&"auto"!==I,L="string"==typeof f?f.trim():"",T=""===L?"":u(L,{allowMailtoTel:!0})??"",B=Boolean(h.textOverlayEnabled)&&function(e){const t=Array.isArray(e.overlayItems)?e.overlayItems:[];return t.length>0?t.some(e=>""!==String(e?.text??"").trim()):""!==String(e.overlayText??"").trim()}(h)&&S&&!C,$=()=>{const e=String(h.overlayText??"").replace(/<script\b[\s\S]*?<\/script>/gi,"");return La(e)?l.jsx("span",{className:"ee-image-overlay-caption-html",dangerouslySetInnerHTML:{__html:e}}):l.jsx("span",{className:"ee-image-overlay-caption-plain",style:{whiteSpace:"pre-wrap"},children:e})},R=()=>{const e=Array.isArray(h.overlayItems)?h.overlayItems:[],t="number"==typeof h.overlayItemGap?h.overlayItemGap:8,n="number"==typeof h.overlayMaxWidth?h.overlayMaxWidth:100,o="number"==typeof h.overlayPadding?h.overlayPadding:16,a=h.textShadowEnabled?"0 1px 3px rgba(0,0,0,0.55)":"none",i=d?.styles?.fontFamily??"sans-serif";return l.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:t,width:`${n}%`,maxWidth:"100%",padding:o,boxSizing:"border-box"},children:e.map((e,t)=>{const n=String(e?.text??"").replace(/<script\b[\s\S]*?<\/script>/gi,""),o="number"==typeof e?.fontSize?e.fontSize:16,r=e?.color||"#ffffff",s=null!=e?.fontFamily&&""!==String(e.fontFamily).trim()?String(e.fontFamily).trim():i;return l.jsx("div",{style:{color:r,fontSize:o,fontFamily:s,fontWeight:Ta(e?.kind),lineHeight:1.35,textShadow:a,wordBreak:"break-word"},children:La(n)?l.jsx("span",{className:"ee-image-overlay-caption-html",dangerouslySetInnerHTML:{__html:n}}):l.jsx("span",{style:{whiteSpace:"pre-wrap"},children:n})},t)})})},P=B?(()=>{const e=fn(yn(h.overlayPosition)),t=_.borderRadius,n="number"==typeof h.overlayMaxWidth?h.overlayMaxWidth:100,o="number"==typeof h.overlayPadding?h.overlayPadding:16,a={position:"relative",display:A?"inline-block":"block",width:A?I:"100%",maxWidth:"100%",borderRadius:t,overflow:"hidden",lineHeight:0,verticalAlign:"top"},i=Array.isArray(h.overlayItems)?h.overlayItems:[],r=i.length>0&&i.some(e=>""!==String(e?.text??"").trim()),s={...e,position:"absolute",pointerEvents:"none",zIndex:2,maxWidth:`${n}%`,boxSizing:"border-box",...r?{}:{color:h.overlayTextColor||"#ffffff",fontSize:"number"==typeof h.overlayFontSize?h.overlayFontSize:18,fontWeight:600,lineHeight:1.35,padding:o,textShadow:h.textShadowEnabled?"0 1px 3px rgba(0,0,0,0.55)":void 0,...h.overlayBoxBackground?{backgroundColor:h.overlayBoxBackground,padding:`${Math.max(8,o/2)}px 12px`}:{}}},c=l.jsx("img",{src:S,style:{..._,width:"100%",maxWidth:"100%",display:"block",borderRadius:0,verticalAlign:"top"},alt:N});return l.jsxs("div",{className:"ee-image-overlay-host",style:a,children:[h.scrimEnabled?l.jsx("div",{style:{position:"absolute",left:0,right:0,top:0,bottom:0,pointerEvents:"none",zIndex:1,background:"linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0.12), transparent 55%)"},"aria-hidden":!0}):null,l.jsx("div",{style:{position:"relative",zIndex:0},children:c}),l.jsx("div",{className:"ee-image-overlay-caption",style:s,children:r?R():$()})]})})():S&&!C?A?l.jsx("div",{style:{width:I,display:"inline-block"},children:l.jsx("img",{src:S,style:{..._,width:"100%",maxWidth:"100%"},alt:N,className:"inline-block"})}):l.jsx("img",{src:S,style:_,alt:N,className:"inline-block"}):l.jsx("div",{className:"empty-image",style:{..._,width:"auto"===_.width?"100%":_.width},title:C&&j?j:void 0,children:C&&j?l.jsx("span",{className:"empty-image-variable-label",children:j}):l.jsx(n.FontAwesomeIcon,{icon:o.faImage,className:"empty-image-icon"})}),M=qt(h)&&T&&S&&!C?l.jsx("a",{href:T,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",display:"inline-block",maxWidth:"100%"},onClick:e=>e.preventDefault(),children:P}):P,F=p?.id===a;return l.jsx("div",{className:"relative",children:l.jsx("div",{style:{...k||{}},children:l.jsxs("div",{ref:v,style:x,className:Go("ee-image-canvas-host",F&&"ee-image-canvas-host--selected"),children:[M,l.jsx(Aa,{active:F,hostRef:v,blockId:a,previewMode:i,getEditorSnapshot:w})]})})})},$a=({blockItem:t})=>{const{src:a,alt:i,linkURL:r}=t,{previewMode:s}=e.useContext($e),c="desktop"===s?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},d="desktop"===s?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile},p=a?l.jsx("img",{src:a,style:{...c,width:c.width??64,height:c.width??64,objectFit:"cover",borderRadius:c.borderRadius??"50%"},alt:i||"Avatar",className:"inline-block"}):l.jsx("div",{className:"empty-avatar",style:{width:c.width??64,height:c.width??64,borderRadius:c.borderRadius??"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--ee-border, #eee)"},children:l.jsx(n.FontAwesomeIcon,{icon:o.faUser,style:{fontSize:"24px",color:"#999"}})}),m={...d,width:"100%"},g=null!=r&&String(r).trim()?u(r,{allowMailtoTel:!0}):null;return l.jsx("div",{className:"relative",children:l.jsx("div",{style:m,children:g?l.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-block"},children:p}):p})})},Ra=({blockItem:t})=>{const{previewMode:n}=e.useContext($e),{t:o}=Zo(),{list:a=[]}=t,i=I(t),r=b(t?.iconColor),s="desktop"===n?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},c=y(s),d="desktop"===n?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile},p=Boolean(t.showTextLabel),m=s.color||"#525252",h=Math.max(11,Math.round(.58*i)),f=Array.isArray(a)?a.filter(Boolean):[];return 0===f.length?null:l.jsx("div",{className:"relative",children:l.jsx("div",{style:w(d),children:f.map((e,t)=>{const{image:n,title:a,linkURL:s}=e,d=g(e)?o("social_platform_x_alt"):a,b=g(e)?o("social_platform_x"):a,{src:y,style:f}=L(e,r,i),_=l.jsx("img",{src:y||n,alt:d,style:f}),k=u(s,{allowMailtoTel:!1}),x={display:"inline-flex",alignItems:"center",gap:p?8:0,textDecoration:"none",color:m},v=l.jsxs(l.Fragment,{children:[_,p?l.jsx("span",{style:{fontSize:h,lineHeight:1.2,color:m,whiteSpace:"nowrap"},children:b}):null]});return l.jsx("div",{style:{...c,display:"inline-flex",alignItems:"center"},children:k?l.jsx("a",{href:k,target:"_blank",rel:"noopener noreferrer",style:x,onClick:e=>e.preventDefault(),children:v}):l.jsx("span",{style:x,children:v})},t)})})})};const Pa=({blockItem:t})=>{const{previewMode:n}=e.useContext($e),o="desktop"===n?{...t.contentStyles?.desktop??{}}:{...t.contentStyles?.desktop??{},...t.contentStyles?.mobile??{}},{outer:a,inner:i}=function(e){if(!e||"object"!=typeof e)return{outer:{width:"100%",textAlign:"center",boxSizing:"border-box"},inner:{width:"100%",maxWidth:"100%",display:"inline-block",verticalAlign:"top",boxSizing:"border-box"}};const{textAlign:t="center",width:n="100%",paddingTop:o,paddingRight:a,paddingBottom:l,paddingLeft:i,backgroundColor:r,...s}=e;return{outer:{width:"100%",textAlign:t,boxSizing:"border-box"},inner:{width:n,maxWidth:"100%",display:"inline-block",verticalAlign:"top",boxSizing:"border-box",paddingTop:o,paddingRight:a,paddingBottom:l,paddingLeft:i,backgroundColor:r,...s}}}(o),r=e.useCallback(e=>{const t=e.target?.closest?.("a[href]");if(!t)return;e.preventDefault(),e.stopPropagation();const n=(t.getAttribute("href")||"").trim();if(n&&!/^javascript:/i.test(n)&&!/^data:/i.test(n))if(/^https?:\/\//i.test(n)||n.startsWith("//")){const e=n.startsWith("//")?`https:${n}`:n;window.open(e,"_blank","noopener,noreferrer")}else(/^mailto:/i.test(n)||/^tel:/i.test(n))&&window.open(n,"_blank","noopener,noreferrer")},[]);return l.jsx("div",{className:"relative ee-raw-html-block",children:l.jsx("div",{className:"ee-raw-html-outer",style:a,children:l.jsx("div",{className:"ee-raw-html-inner",style:i,children:l.jsx("div",{className:"ee-raw-html-content",role:"region","aria-label":"Custom HTML preview",onClick:r,dangerouslySetInnerHTML:{__html:t.html??""}})})})})},Ma=({blockItem:t})=>{const{previewMode:n}=e.useContext($e),o="desktop"===n?{...t.styles?.desktop??{}}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},a="number"==typeof t.rows?t.rows:3,i="number"==typeof t.cols?t.cols:3,r=Boolean(t.headerRow),s=Boolean(t.headerCol),c=Boolean(t.stripedRows),d=o.fontSize??14,u=o.color??"#333333",p=o.borderStyle??"solid",m=o.borderWidth??1,g=o.borderColor??"#e0e0e0",h=o.cellPadding??8,b=o.textAlign??"left",y=o.headerBg??"#f5f5f5",f=o.headerColor??"#333333",_=o.stripedBg??"#fafafa",k="none"!==p?`${m}px ${p} ${g}`:"none",x=(e,t)=>{const n=r&&0===e||s&&0===t;return{border:k,padding:h,fontSize:d,color:n?f:u,textAlign:b,backgroundColor:n?y:c&&!n&&e%2==0?_:"transparent",fontWeight:n?600:400,verticalAlign:"top"}},v={...t.contentStyles?.desktop??{},..."desktop"!==n?t.contentStyles?.mobile??{}:{}},w=(e,n)=>{const o=`${e}-${n}`,a=t.cells?.[o];if("image"===a?.type&&String(a.src??"").trim())return l.jsx("img",{src:a.src,alt:a.alt||"",style:{maxWidth:"100%",height:"auto",display:"block"}});const i=a?.text??"";return i?l.jsx("span",{style:{whiteSpace:"pre-wrap"},children:i}):l.jsx("span",{style:{color:"rgba(0,0,0,0.35)",fontStyle:"italic",fontWeight:400},children:"—"})};return l.jsx("div",{style:{width:"100%",boxSizing:"border-box",paddingTop:v.paddingTop??0,paddingBottom:v.paddingBottom??0,paddingLeft:v.paddingLeft??0,paddingRight:v.paddingRight??0,textAlign:v.textAlign??"left",overflowX:"auto"},children:l.jsx("table",{style:{width:"100%",borderCollapse:"collapse",tableLayout:"auto"},children:l.jsx("tbody",{children:Array.from({length:a}).map((e,t)=>l.jsx("tr",{children:Array.from({length:i}).map((e,n)=>{const o=r&&0===t||s&&0===n?"th":"td";return l.jsx(o,{style:x(t,n),children:w(t,n)},`${t}-${n}`)})},t))})})})},Fa=({blockItem:t})=>{const{previewMode:a}=e.useContext($e),i=e.useMemo(()=>"desktop"===a?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},[t.styles,a]),r=e.useMemo(()=>"desktop"===a?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile},[t.contentStyles,a]),s=e.useMemo(()=>"desktop"===a?t.videoArea?.desktop??{}:{...t.videoArea?.desktop??{},...t.videoArea?.mobile??{}},[t.videoArea,a]),c="string"==typeof t.videoUrl?t.videoUrl.trim():"",d=Boolean(i.fillColumn),u=Boolean(i.fillColumnMobile),p="desktop"===a?d:u||d,m=e.useMemo(()=>_n(c,t.thumbnailUrl),[c,t.thumbnailUrl]),g=e.useMemo(()=>{let e=i.width,t=i.height;null!=e&&""!==e||(e="auto"),null!=t&&""!==t||(t="auto"),p&&(e="100%");const n=r?.textAlign||"center";let o="0 auto";return"left"===n?o="0":"right"===n&&(o="0 0 0 auto"),{width:"number"==typeof e?`${e}px`:e,height:"number"==typeof t?`${t}px`:t,display:"block",margin:o,maxWidth:"100%"}},[i,p,r?.textAlign]),h=e.useMemo(()=>{const e=s||{},t=null!=e.borderWidth?Number(e.borderWidth):0;let n="none";return t>0&&e.borderStyle&&"none"!==e.borderStyle&&(n=`${t}px ${e.borderStyle} ${e.borderColor??"#cccccc"}`),{paddingTop:e.paddingTop??0,paddingBottom:e.paddingBottom??0,paddingLeft:e.paddingLeft??0,paddingRight:e.paddingRight??0,backgroundColor:e.backgroundColor||"transparent",border:n,borderRadius:e.borderRadius??0,boxSizing:"border-box"}},[s]),b=e.useMemo(()=>{let e=i.width;p&&(e="100%"),null!=e&&""!==e||(e="auto");const t="auto"===e?"100%":"number"==typeof e?`${e}px`:e,n=s?.borderRadius;return{width:t,maxWidth:"100%",boxSizing:"border-box",...null!=n&&""!==n?{borderRadius:n}:{}}},[i.width,p,s?.borderRadius]),y=!m,f=c.startsWith("http://")||c.startsWith("https://")||c.startsWith("//")?c.startsWith("//")?`https:${c}`:c:c?`https://${c.replace(/^\/+/,"")}`:"",_=y?l.jsx("div",{className:"empty-image ee-video-inner",style:b,children:l.jsx(n.FontAwesomeIcon,{icon:o.faVideo,className:"empty-image-icon"})}):l.jsx("div",{className:"ee-video-inner",style:h,children:f?l.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",style:{display:"block",lineHeight:0,textDecoration:"none"},onClick:e=>e.stopPropagation(),children:l.jsx("img",{src:m,alt:"Video thumbnail",className:"ee-video-thumb",style:g})}):l.jsx("img",{src:m,alt:"Video thumbnail",className:"ee-video-thumb",style:g})});return l.jsx("div",{className:"relative ee-video-block",children:l.jsx("div",{style:{...r||{}},children:_})})},Ua=({blockItem:e,id:t})=>{if(!e)return null;const n={blockItem:e,id:t};switch(e.key){case"text":return l.jsx(xa,{...n});case"button":return l.jsx(va,{...n});case"divider":return l.jsx(wa,{...n});case"spacer":return l.jsx(Sa,{...n});case"menu":return l.jsx(ja,{...n});case"image":return l.jsx(Ba,{...n});case"video":return l.jsx(Fa,{...n});case"avatar":return l.jsx($a,{...n});case"social_link":return l.jsx(Ra,{...n});case"raw_html":return l.jsx(Pa,{...n});case"table":return l.jsx(Ma,{...n});default:return null}},Da={tree:null};function Ea(e,t,n){if(!n||!e[n])return null;if(t.includes(n))return ee(n,e);const o=e[n];return"column"===o.key?ee(n,e):B(o)}function za(e,t,n){const o=Ea(e,t,n);return o?Oa(e,t,o,n):null}function Oa(e,t,n,o){if(!n||!o||!e[o])return null;const a=U(n),l=t.indexOf(o);if(-1!==l){const{newBlockMap:n,rootId:o}=ue(e,a);if(!o)return null;const i=[...t];i.splice(l+1,0,o);const r=n[o];return{nextMap:n,nextRootOrder:i,newId:o,selectionData:"column"===r?.key?ee(o,n):r}}const i=te(e,t,o);if(!i)return null;const{newBlockMap:r,rootId:s}=ue(e,a);if(!s)return null;const c=re(r,i.containerId,i.cellIndex,i.itemIndex+1,s),d=c[s];return{nextMap:c,nextRootOrder:t,newId:s,selectionData:"column"===d?.key?ee(s,c):d}}function Wa(e,t,n,o){if(!n)return null;if(o&&e[o])return Oa(e,t,n,o);const a=U(n),{newBlockMap:l,rootId:i}=ue(e,a);if(!i)return null;const r=l[i],s="column"===r?.key?ee(i,l):r;return{nextMap:l,nextRootOrder:[...t,i],newId:i,selectionData:s}}function Ha(e,t){const n=e[t];if(!n||"column"!==n.key)return!1;for(const t of n.cells||[])for(const n of t.childrenIds||[]){const t=e[n];if(t&&"empty"!==t.key)return!0}return!1}function Ka(e,t,n,o){if(!n||!e[n])return null;if(-1!==t.indexOf(n)){return{nextMap:ce(e,n),nextRootOrder:t.filter(e=>e!==n)}}const a=te(e,t,n);if(!a)return null;const l=Jo(e,t,n);if(l?.nextBlockMap)return{nextMap:l.nextBlockMap,nextRootOrder:t};const{blockMap:i,removedId:r}=ie(e,a.containerId,a.cellIndex,a.itemIndex);let s=i;const c=i[a.containerId];if(c&&0===c.cells[a.cellIndex].childrenIds.length){const e=X(o("drag_block_here"));s={...i,[e.id]:e,[a.containerId]:{...c,cells:c.cells.map((t,n)=>n===a.cellIndex?{...t,childrenIds:[e.id]}:t)}}}return r&&(s=ce(s,r)),{nextMap:s,nextRootOrder:t}}function Va(e){return e&&"column"===e.key?"section"===e.layoutRole||"columns"===e.layoutRole?e.layoutRole:!0===e.columnLayoutOnly?"columns":"section":null}const Ga="section",qa="columns";function Ja(e,t){if(!e||"column"!==e.key)return!1;if("none"!==e.containerType)return!1;const n=e.children;if(Array.isArray(n)){if(n.length<2||n.length>3)return!1;for(const e of n){if("content"!==e?.key)return!1;const t=e?.children?.[0];if("column"!==t?.key||"product"!==t?.containerType)return!1}return!0}if(!t||!Array.isArray(e.cells))return!1;const o=e.cells.length;if(o<2||o>3)return!1;for(const n of e.cells){const e=n?.childrenIds?.[0],o=t[e];if(!o||"column"!==o.key||"product"!==o.containerType)return!1}return!0}const Ya="ee:open-configure-columns";function Xa(e){"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(Ya,{detail:null!=e&&String(e).length>0?{rootId:e}:{}}))}const Za=(e,t)=>null==e||""===e?t:"number"==typeof e?e:parseInt(String(e).replace(/px/gi,""),10)||t;function Qa({segment:e,active:t,children:n,onSelect:o}){return n?l.jsx("div",{className:Go("ee-footer-canvas-segment",t&&"ee-footer-canvas-segment--selected"),"data-footer-segment":e,role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),o?.(e,t)},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o?.(e,t))},children:n}):null}const el=({column:t,canvasFooterSegment:n,isFooterColumnSelected:o,onFooterCanvasSegmentSelect:a})=>{const{previewMode:i,templateData:r}=e.useContext($e),s="desktop"===i?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},c=Boolean(t.showBrand??!0),d=Boolean(t.showTagline??!0),p=Boolean(t.footerShowLogo??!1),m=vn(t.footerLogoSrc??"",r),g=wn(String(t.footerLogoAlt??"Logo").trim()||"Logo",r).trim()||"Logo",h=t.footerLogoLink??"",b="number"==typeof t.footerLogoMaxWidthPercent?t.footerLogoMaxWidthPercent:parseInt(String(t.footerLogoMaxWidthPercent??"30"),10)||30,y="number"==typeof t.footerLogoPaddingPx?t.footerLogoPaddingPx:Za(t.footerLogoPaddingPx,24),f=Boolean(t.showAddress??!0),_=Boolean(t.showUnsubscribe??!0),k=Boolean(t.showSocial??!1),x=Boolean(t.showSecondaryLinks??!1),v=Boolean(t.showCopyright??!0),w=wn(t.brandName??"",r),S=wn(t.brandTagline??"",r).trim(),j=wn(t.address??"",r),C=wn(t.copyrightText??"",r),N=t.unsubscribeUrl??"",A=t.preferencesUrl??"",{unsubscribeLinkLabel:T,preferencesLinkLabel:B}=Cn(t),$=wn(T,r),R=wn(B,r),P=In(t.secondaryLinks),M=Nn(t.footerSocialList),F=s.color??"#737373",U=null!=s.linkColor&&""!==String(s.linkColor).trim()?String(s.linkColor).trim():F,D=Za(s.fontSize,12),E=s.textAlign??"center",z=Za(s.paddingTop,28),O=Za(s.paddingRight,24),W=Za(s.paddingBottom,28),H=Za(s.paddingLeft,24),K=Boolean(t.showDivider??!1),V=t.dividerColor??"#374151",G=Boolean(t.showBorderTop??!1),q=Za(t.borderTopWidth,1),J=t.borderTopStyle??"solid",Y=t.borderTopColor??"#e5e7eb",X=kn(s.contentBackground),Z={margin:0,color:F,fontSize:D,lineHeight:1.5,fontFamily:s.fontFamily??"Arial, sans-serif"},Q={color:U,textDecoration:"underline",cursor:"pointer"},ee={onClick:e=>{e.preventDefault()}},te={boxSizing:"border-box",width:"100%",textAlign:E,backgroundColor:X,paddingTop:z,paddingRight:O,paddingBottom:W,paddingLeft:H,borderTop:G&&q>0?`${q}px ${J} ${Y}`:void 0},ne=(e,t)=>l.jsx("div",{style:{marginTop:0,marginBottom:10},children:e},t),oe=Array.isArray(M)?M.filter(Boolean):[],ae=I({imageWidth:36}),le=u(Sn(h,r)),ie=l.jsx("img",{src:m,alt:g,draggable:!1,style:{maxWidth:`${Math.min(100,Math.max(10,b))}%`,height:"auto",display:"inline-block",padding:y,verticalAlign:"middle",border:0}}),re=le?l.jsx("a",{href:le,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",lineHeight:0,display:"inline-block"},...ee,children:ie}):ie,se=e=>Boolean(o&&n===e);return l.jsxs("div",{style:te,children:[K?l.jsx(Qa,{segment:"divider",active:se("divider"),onSelect:a,children:l.jsx("div",{style:{borderTop:`1px solid ${V}`,marginBottom:15,width:"100%"},"aria-hidden":!0})}):null,p&&m.trim()?ne(l.jsx(Qa,{segment:"logo",active:se("logo"),onSelect:a,children:l.jsx("div",{style:{display:"flex",justifyContent:"left"===E?"flex-start":"right"===E?"flex-end":"center",lineHeight:0},children:re})}),"logo"):null,c&&w.trim()?ne(l.jsx(Qa,{segment:"brand",active:se("brand"),onSelect:a,children:l.jsx("p",{style:{...Z,fontWeight:600},children:w})}),"brand"):null,d&&S.trim()?ne(l.jsx(Qa,{segment:"tagline",active:se("tagline"),onSelect:a,children:l.jsx("p",{style:{...Z,opacity:.92},children:S})}),"tagline"):null,f&&j.trim()?ne(l.jsx(Qa,{segment:"address",active:se("address"),onSelect:a,children:l.jsx("p",{style:Z,children:j})}),"address"):null,k&&oe.length>0?ne(l.jsx(Qa,{segment:"social",active:se("social"),onSelect:a,children:l.jsx("div",{style:{display:"flex",justifyContent:"left"===E?"flex-start":"right"===E?"flex-end":"center",flexWrap:"wrap",gap:12,alignItems:"center"},children:oe.map((e,t)=>{const n=u(Sn(e.linkURL,r),{allowMailtoTel:!1}),{src:o,style:a}=L(e,"default",ae),i=l.jsx("img",{src:o||e.image,alt:"",style:a,draggable:!1}),s={style:{display:"inline-flex",alignItems:"center",lineHeight:0}};return n?l.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",...s,...ee,children:i},`${e.title}-${t}`):l.jsx("span",{...s,children:i},`${e.title}-${t}`)})})}),"social"):null,_?ne(l.jsx(Qa,{segment:"unsubscribe",active:se("unsubscribe"),onSelect:a,children:l.jsxs("p",{style:{...Z,wordBreak:"break-word"},children:[l.jsx("a",{href:u(Sn(N,r)),style:Q,...ee,children:$}),B?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{padding:"0 6px",userSelect:"none"},children:"·"}),l.jsx("a",{href:u(Sn(A,r)),style:Q,...ee,children:R})]}):null]})}),"unsub"):null,x&&P.length>0?ne(l.jsx(Qa,{segment:"secondary",active:se("secondary"),onSelect:a,children:l.jsx("p",{style:{...Z,wordBreak:"break-word"},children:P.map((e,t)=>l.jsxs("span",{children:[t>0?l.jsx("span",{style:{padding:"0 6px",userSelect:"none"},children:"·"}):null,l.jsx("a",{href:u(Sn(e.url,r)),target:"_blank"===e.target?"_blank":void 0,rel:"_blank"===e.target?"noopener noreferrer":void 0,style:Q,...ee,children:wn(e.label||"",r)||`#${t+1}`})]},e.id||`${e.label}-${t}`))})}),"secondary"):null,v&&C.trim()?ne(l.jsx(Qa,{segment:"copyright",active:se("copyright"),onSelect:a,children:l.jsx("p",{style:{...Z,fontSize:Math.max(10,D-1),opacity:.9},children:C})}),"copy"):null,l.jsx("div",{style:{height:1,marginBottom:-10},"aria-hidden":!0})]})},tl=["paddingTop","paddingRight","paddingBottom","paddingLeft"],nl=o.faCog;function ol(e,t){if(!t?.key)return{icon:o.faSquare,label:""};const{key:n,containerType:a}=t;if("column"===n)return"header"===a?{icon:o.faWindowMaximize,label:e("block_header")||"Header"}:"footer"===a?{icon:o.faWindowMinimize,label:e("block_footer")||"Footer"}:"product"===a?{icon:o.faCube,label:e("block_product")}:"discount"===a?{icon:o.faTag,label:e("block_discount")}:Va(t)===qa?{icon:o.faColumns,label:e("block_palette_columns")}:{icon:o.faSquare,label:e("block_palette_section")};switch(n){case"text":return{icon:o.faFont,label:e("text")};case"button":return{icon:o.faLink,label:e("button")};case"image":return{icon:o.faImage,label:e("image")};case"video":return{icon:o.faVideo,label:e("video")};case"divider":return{icon:o.faGripLines,label:e("divider")};case"spacer":return{icon:o.faArrowsAltV,label:e("spacer")};case"menu":return{icon:o.faBars,label:e("menu")};case"avatar":return{icon:o.faUser,label:e("avatar")};case"social_link":return{icon:o.faShareAlt,label:e("social_link")};case"raw_html":return{icon:o.faCode,label:e("raw_html")};case"table":return{icon:o.faTable,label:e("table")};case"empty":return{icon:o.faSquare,label:""};default:return{icon:o.faSquare,label:n||""}}}function al(e,t){if("header"!==e?.containerType||!t?.hidden)return!1;const n=String(t.src??""),o=!1===e.showLogo&&"image"===t.key&&!t.headerBannerSlot&&!t.footerBannerSlot&&(!0===t.headerLogoSlot||/\{\{\s*LogoUrl\s*\}\}/.test(n)||n.includes("LogoUrl")),a=!0!==e.showHeaderBanner&&(Boolean(t.headerBannerSlot)||Boolean(t.headerBannerDividerSlot)||"image"===t.key&&n.includes("HeroBanner"));return o||a}function ll(e,t){return"footer"===e?.containerType&&!0!==e?.footerUnifiedLayout&&Boolean(t?.hidden)}const il=a=>{const{block:i,blockIndex:r,clearStyles:s}=a,{t:c}=Zo(),{previewMode:d,blockMap:u,rootOrder:p,validationMarkers:m,ignoreValidationIssue:g,setBlocks:h,currentItem:b,setCurrentItem:y,setIsDragStart:f,isDragStart:_,bodySettings:k,setActionType:x,onSaveBlockAsGlobal:v}=e.useContext($e),w="desktop"===d?i.styles?.desktop??{}:{...i.styles?.desktop??{},...i.styles?.mobile??{}},{contentBackground:S,containerBackgroundImage:j,containerBackgroundSize:C,containerBackgroundPosition:N,...I}=w,A="footer"===i.containerType&&i.footerUnifiedLayout?kn(S):S;let L=I,T={};if("discount"===i.containerType){L={...I},T={};for(const e of tl)Object.prototype.hasOwnProperty.call(L,e)&&(T[e]=L[e],delete L[e])}if("footer"===i.containerType&&i.footerUnifiedLayout){L={...L};for(const e of tl)delete L[e]}let B=w;if("footer"===i.containerType&&i.footerUnifiedLayout){B={...w};for(const e of tl)delete B[e]}const $="undefined"!=typeof window?window.__eeDragItemData:null,R=$?.key??(b?.id?u[b.id]?.key:null)??b?.data?.key,P=_&&"column"!==R,M=e=>t=>{t.preventDefault(),t.stopPropagation(),y({id:e.id,data:e,type:"edit"}),x("edit")},F=e=>t=>{t.preventDefault(),t.stopPropagation();const n=u[e];n&&(y({id:n.id,data:n,type:"edit"}),x("edit"))},U=(e,t,n)=>o=>{o.preventDefault(),o.stopPropagation();const a=u[e]?.cells?.[t]?.childrenIds?.[n];if(a){const e=Jo(u,p,a);if(e?.nextBlockMap)return h(e.nextBlockMap,p,"edit"),void y(null)}const{blockMap:l,removedId:i}=ie(u,e,t,n);let r=l;const s=l[e];if(s&&0===s.cells[t].childrenIds.length){const n=X(c("drag_block_here"));r={...l,[n.id]:n,[e]:{...s,cells:s.cells.map((e,o)=>o===t?{...e,childrenIds:[n.id]}:e)}}}i&&(r=ce(r,i)),h(r,p,"delete"),y(null)},D=e=>()=>{f(!0),y({id:e.id,data:e,type:"move"}),x("move")},E=e=>{e.preventDefault(),e.stopPropagation(),setTimeout(()=>{e.target.style.border="",e.target.children[0]&&e.target.children[0].classList.remove("sidebar-block-move"),f(!1),s&&s()},50)},z=e=>e.preventDefault(),O=e=>{e.preventDefault(),e.stopPropagation()},W=(e,t)=>n=>{O(n);const o=se(u,p,e,t);o&&h(o.nextMap,o.nextRootOrder,"move")},H=e=>t=>{O(t);const n=za(u,p,e);n&&(h(n.nextMap,n.nextRootOrder,"add"),y({id:n.newId,data:n.selectionData,type:"edit"}))},K=e=>"desktop"===d?e.styles?.desktop||{}:{...e.styles?.desktop||{},...e.styles?.mobile||{}},V=J(k),G=Y(k),q="mobile"===d||G?"100%":V,Z="mobile"===d||G?"100%":V,Q=e=>{const n=m?.[e];if(!n)return null;const o="error"===n.severity?`${n.errorCount} error${1===n.errorCount?"":"s"}`:"warning"===n.severity?`${n.warningCount} warning${1===n.warningCount?"":"s"}`:`${n.infoCount??n.totalCount} info`,a=l.jsx("div",{className:"block-validation-popover",children:n.issues.map((e,n)=>{const o=Boolean(e.blockId&&u?.[e.blockId]);return l.jsxs("div",{className:"block-validation-popover-item",children:[l.jsx("div",{className:"block-validation-popover-message",children:e.message}),l.jsxs("div",{className:"block-validation-popover-actions",children:[o&&l.jsx(t.Button,{size:"small",type:"text",className:"block-validation-popover-open-block",onClick:(a=e.blockId,e=>{e.preventDefault(),e.stopPropagation(),a&&u?.[a]&&(y({id:a,data:u[a],type:"edit"}),x("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(a)):String(a).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),t=document.querySelector(`[data-block-id="${e}"]`);t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}))}),children:c("export_validation_open_block")||"Open block"}),"function"==typeof g&&l.jsx(t.Button,{size:"small",type:"text",className:"block-validation-popover-ignore",onClick:t=>{t.preventDefault(),t.stopPropagation(),g(e)},children:c("ignore")})]})]},`${e.code}-${n}`);var a})});return l.jsx(t.Popover,{trigger:["hover","click"],placement:"topRight",overlayClassName:"block-validation-popover-overlay",content:a,getPopupContainer:()=>document.querySelector("#preview")||document.body,children:l.jsxs("button",{type:"button",className:Go("block-validation-indicator","error"===n.severity?"block-validation-indicator-error":"warning"===n.severity?"block-validation-indicator-warning":"block-validation-indicator-info"),"aria-label":o,onClick:e=>{e.preventDefault(),e.stopPropagation()},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},children:[l.jsx("span",{className:"block-validation-indicator-dot"}),l.jsx("span",{className:"block-validation-indicator-count",children:n.totalCount})]})})},ee=(t,a,i,r,s,p,m=1)=>{const g=K({styles:t.styles}),{contentBackground:h,containerBackgroundImage:y,containerBackgroundSize:f,containerBackgroundPosition:_,...x}=g,v=b?.id===t.id,w=((e=1)=>({"--nested-level":Math.max(1,e),"--nested-width":"100%"}))(m);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative block-content-drag-label-content","data-drop-key":s,children:[l.jsx("div",{className:"absolute block-move-top",children:l.jsx("span",{className:"block-tools-drag_here",children:c("drag_block_here")})}),P&&l.jsx("div",{className:"block-move-content-top","data-name":"dragTools","data-position":"top","data-container-id":a,"data-cell-index":i,"data-item-index":r,"data-drop-key":s,"data-type":"block-item-move"})]}),l.jsx("div",{className:Go("block-item block-item-container",v&&"block-item-focus"),style:w,"data-block-id":t.id,onMouseEnter:e=>{e.currentTarget.dataset.hovered="true"},onMouseLeave:e=>{delete e.currentTarget.dataset.hovered},onClick:M(t),children:l.jsxs("div",{className:"relative",children:[Q(t.id),l.jsx("div",{className:"block-item-tools",onDragOver:z,children:P&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"block-move-content-top","data-name":"dragTools","data-position":"top","data-container-id":a,"data-cell-index":i,"data-item-index":r,"data-drop-key":s,"data-type":"block-item-move"}),l.jsx("div",{className:"block-move-content-bottom","data-name":"dragTools","data-position":"bottom","data-container-id":a,"data-cell-index":i,"data-item-index":r+1,"data-drop-key":p,"data-type":"block-item-move"})]})}),(()=>{const e=u[a]?.cells?.[i],s=r>0,d=r<(e?.childrenIds?.length??0)-1,p=ol(c,t);return l.jsxs("div",{className:"block-chrome-overlay",children:[l.jsxs("span",{className:"block-chrome-badge",children:[l.jsx(n.FontAwesomeIcon,{icon:p.icon}),l.jsx("span",{children:p.label})]}),l.jsxs("div",{className:"block-chrome-toolbar",children:[l.jsx("span",{className:"block-chrome-action",onMouseDown:O,onClick:F(a),title:c("select_parent_section_tooltip"),children:l.jsx(n.FontAwesomeIcon,{icon:nl})}),l.jsx("span",{className:Go("block-chrome-action",!s&&"block-chrome-action-disabled"),onMouseDown:O,onClick:W(t.id,-1),title:c("context_move_up"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronUp})}),l.jsx("span",{className:Go("block-chrome-action",!d&&"block-chrome-action-disabled"),onMouseDown:O,onClick:W(t.id,1),title:c("context_move_down"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronDown})}),l.jsx("span",{className:"block-chrome-divider","aria-hidden":!0}),l.jsx("span",{className:"block-chrome-action",onMouseDown:O,onClick:H(t.id),title:c("context_duplicate"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faCopy})}),l.jsx("span",{className:"block-chrome-divider","aria-hidden":!0}),l.jsx("span",{className:"block-chrome-action block-chrome-action-danger",onMouseDown:O,onClick:U(a,i,r),title:c("layer_delete"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash})}),l.jsx("span",{className:"block-chrome-action block-chrome-action-disabled ee-section-nested-no-drag",draggable:!1,onMouseDown:e=>e.stopPropagation(),title:c("section_nest_not_allowed"),style:{cursor:"not-allowed"},children:l.jsx(n.FontAwesomeIcon,{icon:o.faArrowsAlt})})]})]})})(),l.jsx("div",{style:{...x,overflow:x.borderRadius?"hidden":void 0},children:l.jsx("div",{className:"block-content block-item-container-body",style:{...gn(g,h),borderRadius:x.borderRadius,overflow:x.borderRadius?"hidden":void 0,...null!=x.minHeight&&""!==x.minHeight&&""!==String(x.minHeight).trim()?{minHeight:x.minHeight}:{}},children:(t.children||[]).map((n,o)=>{const a=K(n);return l.jsx("div",{style:{...a,width:"mobile"===d&&!1!==k.stackColumnsOnMobile?"100%":n.width},children:(n.children||[]).map((a,i)=>{const r=`${t.id}:${o}:${i}`,s=`${t.id}:${o}:${i+1}`,d=i===n.children.length-1&&"empty"!==a.key&&"column"!==a.key;return l.jsxs(e.Fragment,{children:[te(a,t.id,o,i,r,s,m),d&&l.jsx("div",{className:"relative block-content-drag-label-content","data-drop-key":s,children:l.jsx("div",{className:"absolute block-move-bottom",children:l.jsx("span",{className:"block-tools-drag_here",children:c("drag_block_here")})})})]},`${t.id}:${o}:${a.id||i}`)})},`${t.id}:${n.id||"cell"}:${o}`)})})})]})}),l.jsxs("div",{className:"relative block-content-drag-label-content","data-drop-key":p,children:[l.jsx("div",{className:"absolute block-move-bottom",children:l.jsx("span",{className:"block-tools-drag_here",children:c("drag_block_here")})}),P&&l.jsx("div",{className:"block-move-content-bottom","data-name":"dragTools","data-position":"bottom","data-container-id":a,"data-cell-index":i,"data-item-index":r+1,"data-drop-key":p,"data-type":"block-item-move"})]})]})},te=(t,a,r,s,d,p,m=0)=>"empty"===t.key?l.jsx("div",{className:"relative width-full",children:l.jsx("div",{className:"block-empty-content ee-empty-drop-slot",onDragOver:P?z:void 0,...P?{"data-container-id":a,"data-cell-index":r,"data-item-index":s,"data-type":"empty-block-item"}:{},"aria-label":t.name||c("drag_block_here"),children:l.jsx("span",{className:"ee-empty-drop-slot__label",children:c("drag_block_here")})})},t.id||s):"column"===t.key?l.jsx(e.Fragment,{children:ee(t,a,r,s,d,p,m+1)},`${a}:${r}:${t.id||s}`):l.jsxs(e.Fragment,{children:[l.jsx("div",{className:"relative block-content-drag-label-content","data-drop-key":d,children:l.jsx("div",{className:"absolute block-move-top",children:l.jsx("span",{className:"block-tools-drag_here",children:c("drag_block_here")})})}),l.jsx("div",{className:Go("block-item",b?.id===t.id&&"block-item-focus",t.hidden&&!al(i,t)&&!ll(i,t)&&"block-hidden-dim",(al(i,t)||ll(i,t))&&"ee-header-banner-off-canvas"),"data-block-id":t.id,onClick:e=>{e.preventDefault(),e.stopPropagation(),aa(t)&&b?.id===t.id&&oa(c),y({id:t.id,data:t,type:"edit"}),x("edit")},children:l.jsxs("div",{className:"relative",children:[Q(t.id),l.jsx("div",{className:Go("block-item-tools",aa(t)&&b?.id===t.id&&"block-item-tools--pointer-through-ai-text"),onDragOver:z,children:P&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"block-move-content-top","data-name":"dragTools","data-position":"top","data-container-id":a,"data-cell-index":r,"data-item-index":s,"data-drop-key":d,"data-type":"block-item-move"}),l.jsx("div",{className:"block-move-content-bottom","data-name":"dragTools","data-position":"bottom","data-container-id":a,"data-cell-index":r,"data-item-index":s+1,"data-drop-key":p,"data-type":"block-item-move"})]})}),(()=>{const e=u[a]?.cells?.[r],i=s>0,d=s<(e?.childrenIds?.length??0)-1,p=ol(c,t);return l.jsxs("div",{className:"block-chrome-overlay",children:[l.jsxs("span",{className:"block-chrome-badge",children:[l.jsx(n.FontAwesomeIcon,{icon:p.icon}),l.jsx("span",{children:p.label})]}),l.jsxs("div",{className:"block-chrome-toolbar",children:[l.jsx("span",{className:"block-chrome-action",onMouseDown:O,onClick:F(a),title:c("select_parent_section_tooltip"),children:l.jsx(n.FontAwesomeIcon,{icon:nl})}),l.jsx("span",{className:Go("block-chrome-action",!i&&"block-chrome-action-disabled"),onMouseDown:O,onClick:W(t.id,-1),title:c("context_move_up"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronUp})}),l.jsx("span",{className:Go("block-chrome-action",!d&&"block-chrome-action-disabled"),onMouseDown:O,onClick:W(t.id,1),title:c("context_move_down"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronDown})}),l.jsx("span",{className:"block-chrome-divider","aria-hidden":!0}),l.jsx("span",{className:"block-chrome-action",onMouseDown:O,onClick:H(t.id),title:c("context_duplicate"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faCopy})}),l.jsx("span",{className:"block-chrome-divider","aria-hidden":!0}),l.jsx("span",{className:"block-chrome-action block-chrome-action-danger",onMouseDown:O,onClick:U(a,r,s),title:c("layer_delete"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash})}),l.jsx("span",{className:"block-chrome-action block-chrome-drag",draggable:"true",onMouseDown:e=>e.stopPropagation(),onDragEnd:E,onDragStart:D(t),title:c("drag_to_move")||"Drag to move",children:l.jsx(n.FontAwesomeIcon,{icon:o.faArrowsAlt})})]})]})})(),l.jsx(Ua,{blockItem:t,id:t.id})]})})]},`${a}:${r}:${t.id||s}`),ne=ol(c,i),oe="column"===b?.data?.key&&Va(b.data)===qa?c("block_palette_columns"):c("container");return l.jsx(l.Fragment,{children:l.jsxs("div",{className:Go("relative block-drag-label-content",_&&"column"===R&&"ee-section-drop-preview"),"data-index":r,"data-position":"top",children:[_&&"column"===R?l.jsxs("div",{className:"ee-section-drop-slot-outline","aria-hidden":!0,children:[l.jsx("span",{className:"ee-section-drop-badge",children:oe}),l.jsx("span",{className:"ee-section-drop-hint",children:c("drag_section_here")})]}):null,l.jsx("div",{className:"absolute block-move-top",children:l.jsx("span",{className:"block-tools-drag_here",children:c("drag_block_here")})}),l.jsxs("div",{className:Go("relative block",b?.id===i.id&&"block-focus","mobile"===d&&"mobile-block-focus",i.hidden&&"block-hidden-dim"),"data-block-id":i.id,onClick:M(i),children:[l.jsxs("div",{className:"hover-visible",children:[Q(i.id),l.jsxs("div",{className:"block-chrome-overlay",children:[l.jsxs("span",{className:"block-chrome-badge",children:[l.jsx(n.FontAwesomeIcon,{icon:ne.icon}),l.jsx("span",{children:ne.label})]}),l.jsxs("div",{className:"block-chrome-toolbar",children:[l.jsx("span",{className:Go("block-chrome-action",r<=0&&"block-chrome-action-disabled"),onMouseDown:O,onClick:W(i.id,-1),title:c("context_move_up"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronUp})}),l.jsx("span",{className:Go("block-chrome-action",r>=p.length-1&&"block-chrome-action-disabled"),onMouseDown:O,onClick:W(i.id,1),title:c("context_move_down"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronDown})}),l.jsx("span",{className:"block-chrome-divider","aria-hidden":!0}),l.jsx("span",{className:"block-chrome-action",onMouseDown:O,onClick:H(i.id),title:c("context_duplicate"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faCopy})}),"function"==typeof v&&l.jsx("span",{className:"block-chrome-action",onMouseDown:O,onClick:(ae=i,e=>{O(e),window.dispatchEvent(new CustomEvent("ee:canvas-save-universal",{detail:{block:ae}}))}),title:c("save_as_universal"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faStar})}),l.jsx("span",{className:"block-chrome-divider","aria-hidden":!0}),l.jsx("span",{className:"block-chrome-action block-chrome-action-danger",onMouseDown:O,onClick:e=>{e.preventDefault(),e.stopPropagation();const t=ce(u,i.id),n=p.filter(e=>e!==i.id);h(t,n,"delete"),y(null)},title:c("layer_delete"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash})}),l.jsx("span",{className:"block-chrome-action block-chrome-drag",draggable:"true",onMouseDown:e=>e.stopPropagation(),onDragEnd:E,onDragStart:()=>{f(!0),y({id:i.id,data:i,type:"move"}),x("move")},title:c("drag_to_move")||"Drag to move",children:l.jsx(n.FontAwesomeIcon,{icon:o.faArrowsAlt})})]})]})]}),l.jsx("div",{className:"width-full height-full absolute",onDragOver:z,style:{pointerEvents:_&&"column"===R?"auto":"none"},children:_&&"column"===R&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"block-move-content-top","data-name":"dragTools","data-type":"drag-over-column","data-position":"top","data-index":r}),l.jsx("div",{className:"block-move-content-bottom","data-name":"dragTools","data-type":"drag-over-column","data-position":"bottom","data-index":r+1})]})}),l.jsx("div",{className:"column margin-auto",style:{...L,width:"100%",maxWidth:"100%",overflow:L.borderRadius?"hidden":void 0},children:l.jsx("div",{className:"block-content",style:{...gn(B,A),...T,borderRadius:L.borderRadius,overflow:L.borderRadius?"hidden":void 0,width:q,maxWidth:Z,...null!=L.minHeight&&""!==L.minHeight&&""!==String(L.minHeight).trim()?{minHeight:L.minHeight}:{}},"data-index":r,children:i.children.map((t,n)=>{const o="desktop"===d?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}};return l.jsx(e.Fragment,{children:l.jsx("div",{id:`block-content-${r}-${n}`,style:{...o,width:"mobile"===d&&!1!==k.stackColumnsOnMobile?"100%":t.width},children:"footer"===i.containerType&&i.footerUnifiedLayout&&0===n?l.jsx("div",{className:"ee-smart-footer-column-body width-full",children:l.jsx(el,{column:i,canvasFooterSegment:i.footerSelectedSegment,isFooterColumnSelected:b?.id===i.id,onFooterCanvasSegmentSelect:(e,t)=>{t?.preventDefault?.(),t?.stopPropagation?.();const n=u[i.id];if(!n||"column"!==n.key)return;const o={...n,footerSelectedSegment:e};h({...u,[i.id]:o},p,`edit_${Date.now()}`),y({id:i.id,data:o,type:"edit"}),x("edit")}})},`${i.id}:${n}:footer-unified`):t.children.map((o,a)=>{const r=`${i.id}:${n}:${a}`,s=`${i.id}:${n}:${a+1}`,d=a===t.children.length-1&&"empty"!==o.key&&"column"!==o.key;return l.jsxs(e.Fragment,{children:[te(o,i.id,n,a,r,s,0),d&&l.jsx("div",{className:"relative block-content-drag-label-content","data-drop-key":s,children:l.jsx("div",{className:"absolute block-move-bottom",children:l.jsx("span",{className:"block-tools-drag_here",children:c("drag_block_here")})})})]},`${i.id}:${n}:${o.id||a}`)})})},`${i.id}:${t.id||"content"}:${n}`)})})})]})]})});var ae};function rl(e){return{id:P(),name:e("drag_block_here"),key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}}}function sl(e,t){return{id:P(),name:e("content"),key:"content",width:t,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[rl(e)]}}function cl(e,{layoutRole:t,columnLayoutOnly:n,name:o}){const a=n?[sl(e,"50%"),sl(e,"50%")]:[sl(e,"100%")];return{id:P(),name:o,key:"column",type:n?"1-1":"full",containerType:"none",layoutRole:t,columnLayoutOnly:n,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},children:a}}const dl=e=>[cl(e,{layoutRole:Ga,columnLayoutOnly:!1,name:e("block_palette_section")}),cl(e,{layoutRole:qa,columnLayoutOnly:!0,name:e("block_palette_columns")}),{id:P(),name:e("text"),key:"text",text:e("text_content"),type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",color:void 0,lineHeight:"20px",paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"left"},mobile:{}}},{id:P(),name:e("button"),key:"button",text:e("button"),type:"link",linkURL:"",contentStyles:{desktop:{textAlign:"center",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{width:"auto",fontSize:12,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:20,paddingRight:20,backgroundColor:void 0,color:"#fff",display:"inline-block"},mobile:{}}},{id:P(),name:e("spacer"),key:"spacer",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{height:16,width:"100%",display:"block"},mobile:{}}},{id:P(),name:e("divider"),key:"divider",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},{id:P(),name:e("raw_html"),key:"raw_html",html:e("raw_html_default_content"),contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center",width:"100%"},mobile:{}},styles:{desktop:{},mobile:{}}},{id:P(),name:e("image"),key:"image",src:"",alt:"Image",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{id:P(),name:e("video"),key:"video",videoUrl:"",thumbnailUrl:"",styles:{desktop:{width:"auto",height:"auto",fillColumn:!1,fillColumnMobile:!1,display:"inline-block"},mobile:{}},videoArea:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,backgroundColor:"transparent",borderWidth:0,borderStyle:"solid",borderColor:"#cccccc",borderRadius:0},mobile:{}},contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center",backgroundColor:"transparent"},mobile:{}}},{id:P(),name:e("menu"),key:"menu",layoutMode:"nav-only",showLogo:!1,mobileLayout:"stack",linkGapPx:0,linkUnderline:!1,list:[{label:"Page",url:"",target:"_self"},{label:"Page",url:"",target:"_self"}],separator:" | ",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:14,fontFamily:"sans-serif",color:"#333333",linkColor:"#2faade",letterSpacing:0,fontWeight:"400",textTransform:"none"},mobile:{}}},{id:P(),name:e("table")||"Table",key:"table",rows:3,cols:3,structureMode:"static",headerRow:!0,headerCol:!1,stripedRows:!1,cells:{},contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}},styles:{desktop:{fontSize:14,color:"#333333",borderStyle:"solid",borderWidth:1,borderColor:"#e0e0e0",cellPadding:8,textAlign:"left",headerBg:"#f5f5f5",headerColor:"#333333",stripedRows:!1,stripedBg:"#fafafa"},mobile:{}}},{id:P(),name:e("social_link"),key:"social_link",list:[],imageWidth:32,iconSize:"medium",iconColor:"gray",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"center"},mobile:{}},styles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}}}];const ul="ee-block-context-menu";function pl(e,t,n){return{label:e,onSelect:t,disabled:n}}const ml=()=>{const{t:n}=Zo(),{blockMap:o,rootOrder:a,setBlocks:r,setCurrentItem:s,onSaveBlockAsGlobal:c}=e.useContext($e),[d,u]=e.useState(null),p=e.useCallback(()=>u(null),[]);e.useEffect(()=>{const e=e=>{const t=e.target.closest?.(".email-editor");if(!t)return;const n=e.target.closest?.("[data-block-id]");if(!n||!t.contains(n))return;const a=n.getAttribute("data-block-id");a&&o[a]&&(e.preventDefault(),e.stopPropagation(),u({x:e.clientX,y:e.clientY,blockId:a}))},t=e=>{e.target.closest?.(`.${ul}`)||u(null)};return document.addEventListener("contextmenu",e,!0),document.addEventListener("click",t,!0),document.addEventListener("scroll",t,!0),()=>{document.removeEventListener("contextmenu",e,!0),document.removeEventListener("click",t,!0),document.removeEventListener("scroll",t,!0)}},[o]);const m=e.useCallback((e,t)=>{const n=se(o,a,e,t);n&&(r(n.nextMap,n.nextRootOrder,"move"),p())},[o,a,r,p]),g=e.useCallback(e=>Boolean(se(o,a,e,-1)),[o,a]),h=e.useCallback(e=>Boolean(se(o,a,e,1)),[o,a]),b=e.useCallback(e=>{const l=o[e];if(!l)return[];const i=()=>{const t=Ea(o,a,e);t&&(Da.tree=t)};return[pl(n("context_duplicate"),()=>{const t=za(o,a,e);t&&(r(t.nextMap,t.nextRootOrder,"add"),s({id:t.newId,data:t.selectionData,type:"edit"}),p())},!1),pl(n("context_copy"),()=>{i(),p()},!1),pl(n("context_cut"),()=>{i();const c=()=>{const t=Ka(o,a,e,n);t&&(r(t.nextMap,t.nextRootOrder,"delete"),s(null),p())};if("column"===l.key&&Ha(o,e))return p(),void t.Modal.confirm({title:n("shortcut_delete_confirm_title"),content:n("shortcut_delete_confirm_desc"),okText:n("confirm"),cancelText:n("cancel"),wrapClassName:"ee-modal-dark",onOk:c});c()},!1),pl(n("context_paste"),()=>{if(!Da.tree)return;const t=Wa(o,a,Da.tree,e);t&&(r(t.nextMap,t.nextRootOrder,"add"),s({id:t.newId,data:t.selectionData,type:"edit"}),p())},!Da.tree),pl(n("context_delete"),()=>{const i=()=>{const t=Ka(o,a,e,n);t&&(r(t.nextMap,t.nextRootOrder,"delete"),s(null),p())};if("column"===l.key&&Ha(o,e))return p(),void t.Modal.confirm({title:n("shortcut_delete_confirm_title"),content:n("shortcut_delete_confirm_desc"),okText:n("confirm"),cancelText:n("cancel"),wrapClassName:"ee-modal-dark",onOk:i});i()},!1),pl(n("context_move_up"),()=>m(e,-1),!g(e)),pl(n("context_move_down"),()=>m(e,1),!h(e)),pl(n("context_save_global"),()=>{"function"==typeof c&&c(e),p()},"function"!=typeof c),pl(n("context_reset_styles"),()=>{const t=function(e,t,n){const o=e[t];if(!o||!o.key)return null;const a=dl(n).find(e=>e.key===o.key);if(!a)return null;const l={...o};return null!=a.styles&&(l.styles=B(a.styles)),null!=a.contentStyles&&(l.contentStyles=B(a.contentStyles)),{...e,[t]:l}}(o,e,n);if(!t)return;r(t,a,`edit_${Date.now()}`);const l=t[e];l&&s({id:e,data:"column"===l.key?ee(e,t):l,type:"edit"}),p()},"empty"===l.key||!dl(n).some(e=>e.key===l.key))]},[o,a,r,s,n,p,g,h,m,c]);if(!d)return null;const y=b(d.blockId),f="undefined"!=typeof window?window.innerWidth:9999,_="undefined"!=typeof window?window.innerHeight:9999,k=Math.min(d.x,f-220-8),x=Math.min(d.y,_-360-8);return i.createPortal(l.jsx("div",{className:ul,style:{position:"fixed",left:k,top:x,zIndex:10050,minWidth:220,background:"#1a1a1a",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,boxShadow:"0 12px 40px rgba(0,0,0,0.45)",padding:"6px 0"},role:"menu",onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:y.map(e=>l.jsx("button",{type:"button",role:"menuitem",disabled:e.disabled,className:"ee-block-context-menu-item",style:{display:"block",width:"100%",textAlign:"left",padding:"8px 14px",border:"none",background:"transparent",color:e.disabled?"rgba(255,255,255,0.35)":"#f5f5f5",fontSize:13,cursor:e.disabled?"not-allowed":"pointer"},onMouseEnter:t=>{e.disabled||(t.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},onClick:()=>{e.disabled||e.onSelect()},children:e.label},e.label))}),document.body)},gl=t=>{const{clearStyles:n}=t,{t:o}=Zo(),{previewMode:a,bodySettings:i,blockList:r,currentItem:s,blockMap:c,isDragStart:d,setSelectionRange:u}=e.useContext($e),p=e.useRef(null),m="undefined"!=typeof window?window.__eeDragItemData:null,g="undefined"!=typeof window?window.__eeDragSource:null,h=m?.key??(s?.id?c[s.id]?.key:null)??s?.data?.key,b="add"===s?.type||Boolean(m),y=r.length>0&&d&&"product-variables"!==g&&("column"===h||b);e.useEffect(()=>{const e=$(()=>{try{const n=window.getSelection();if(!n||0===n.rangeCount)return;const o=n.getRangeAt(0),a=document.getElementById("preview");if(!(!!a&&(a.contains(o.commonAncestorContainer)||a===o.commonAncestorContainer)))return;const l=(e=>e?{startContainer:e.startContainer,startOffset:e.startOffset,endContainer:e.endContainer,endOffset:e.endOffset,collapsed:e.collapsed}:null)(o);if(e=p.current,t=l,e&&t&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset&&e.collapsed===t.collapsed)return;p.current=l,u(o.cloneRange())}catch(e){console.warn(e)}var e,t},100);return document.addEventListener("selectionchange",e),()=>{document.removeEventListener("selectionchange",e)}},[u]);const f=e=>{e.preventDefault()},_=J(i),k=Y(i),x=i?.styles||{},v=null!=x.color&&""!==String(x.color).trim()?String(x.color).trim():Te.styles?.color??"#171717",w={width:"desktop"===a?"100%":364,backgroundColor:x.backgroundColor,color:v,fontFamily:x.fontFamily},S={maxWidth:"100%",width:"100%",backgroundColor:"transparent",..."mobile"===a&&!1!==i.scaleFontOnMobile?{fontSize:16}:{}};return l.jsxs("div",{className:"preview-main",children:[l.jsx(ml,{}),l.jsx("div",{className:"default-scrollbar",id:"preview",children:l.jsx("div",{className:"preview-content",style:w,children:l.jsx("div",{className:"margin-auto",style:S,children:r.length?l.jsxs("div",{className:"preview-column-stack",children:[y&&l.jsxs("div",{className:Go("block-drag-label-content preview-edge-drop-zone preview-edge-drop-zone-top","column"===h&&"ee-section-drop-preview"),"data-index":0,"data-position":"top",children:["column"===h?l.jsxs("div",{className:"ee-section-drop-slot-outline ee-section-drop-slot-outline-edge","aria-hidden":!0,children:[l.jsx("span",{className:"ee-section-drop-badge",children:o("container")}),l.jsx("span",{className:"ee-section-drop-hint",children:o("drag_section_here")})]}):null,l.jsx("div",{className:"absolute block-move-top",children:l.jsx("span",{className:"block-tools-drag_here",children:o("drag_block_here")})}),l.jsx("div",{className:"preview-edge-drop-hit","data-name":"dragTools","data-type":"drag-over-column","data-position":"top","data-index":0,onDragOver:f})]}),r.map((t,o)=>l.jsx(e.Fragment,{children:l.jsx(il,{block:t,blockIndex:o,clearStyles:n})},`${t?.id||"block"}-${o}`)),l.jsxs("div",{className:Go("relative block-drag-label-content","ee-bottom-stack-drop-slot",d&&!y&&"ee-bottom-stack-drop-slot--active"),"data-index":r.length,"data-position":"bottom",style:{minHeight:d&&!y?52:0},children:[d&&!y?l.jsx("div",{className:"ee-bottom-drop-slot-outline","aria-hidden":!0,children:l.jsx("span",{className:"ee-bottom-drop-slot-label",children:o("drag_block_here")})}):null,l.jsx("div",{className:"absolute block-move-bottom",children:l.jsx("span",{className:"block-tools-drag_here",children:o("drag_block_here")})}),d&&!y&&l.jsx("div",{"data-name":"dragTools","data-type":"drag-over-column","data-position":"bottom","data-index":r.length,onDragOver:f,style:{position:"absolute",inset:0,zIndex:106,pointerEvents:"auto"}})]}),y&&l.jsxs("div",{className:Go("block-drag-label-content preview-edge-drop-zone preview-edge-drop-zone-bottom","column"===h&&"ee-section-drop-preview"),"data-index":r.length,"data-position":"bottom",children:["column"===h?l.jsxs("div",{className:"ee-section-drop-slot-outline ee-section-drop-slot-outline-edge","aria-hidden":!0,children:[l.jsx("span",{className:"ee-section-drop-badge",children:o("container")}),l.jsx("span",{className:"ee-section-drop-hint",children:o("drag_section_here")})]}):null,l.jsx("div",{className:"absolute block-move-bottom",children:l.jsx("span",{className:"block-tools-drag_here",children:o("drag_block_here")})}),l.jsx("div",{className:"preview-edge-drop-hit","data-name":"dragTools","data-type":"drag-over-column","data-position":"bottom","data-index":r.length,onDragOver:f})]})]}):l.jsx("div",{"data-name":"dragEmpty",className:"start-to-add ee-empty-document",style:{width:k?"100%":_,maxWidth:"100%"},"data-type":"empty-block",onDragOver:f,children:l.jsxs("div",{className:"ee-empty-document-inner",children:[l.jsxs("svg",{className:"ee-empty-document__icon",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:[l.jsx("rect",{x:"6",y:"22",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),l.jsx("rect",{x:"24",y:"22",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),l.jsx("rect",{x:"6",y:"6",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),l.jsx("rect",{x:"28",y:"4",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"})]}),l.jsx("p",{className:"ee-empty-document__title",children:o("drop_content_here")}),l.jsx("p",{className:"ee-empty-document__hint",children:o("drop_content_hint")})]})})})})})]})},hl=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,bl=/^rgba?\(\s*(\d{1,3})\s*[, ]\s*(\d{1,3})\s*[, ]\s*(\d{1,3})(?:\s*[,/]\s*([0-9.]+))?\s*\)$/i,yl=e=>(e=>Math.max(0,Math.min(255,Number.isFinite(e)?Math.round(e):0)))(e).toString(16).padStart(2,"0"),fl=(e,t="#000000")=>{const n=String(e??"").trim();if(!n)return t;if("transparent"===n.toLowerCase())return t;if(/^[0-9a-f]{3}$/i.test(n)){return`#${n.toLowerCase().split("").map(e=>e+e).join("")}`}if(/^[0-9a-f]{6}$/i.test(n))return`#${n.toLowerCase()}`;if(hl.test(n)){if(4===n.length){const[,e,t,o]=n;return`#${e}${e}${t}${t}${o}${o}`.toLowerCase()}return n.toLowerCase()}const o=n.match(bl);if(o){const e=Number(o[1]),t=Number(o[2]),n=Number(o[3]);return`#${yl(e)}${yl(t)}${yl(n)}`.toLowerCase()}const a=(e=>{if("undefined"==typeof document)return null;const t=document.createElement("span");if(t.style.color="",t.style.color=String(e??"").trim(),!t.style.color)return null;const n=t.style.color.match(bl);if(!n)return null;const o=Number(n[1]),a=Number(n[2]),l=Number(n[3]);return`#${yl(o)}${yl(a)}${yl(l)}`.toLowerCase()})(n);return a||t},_l={backgroundImage:"linear-gradient(45deg, #1f1f1f 25%, transparent 25%), linear-gradient(-45deg, #1f1f1f 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #1f1f1f 75%), linear-gradient(-45deg, transparent 75%, #1f1f1f 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 0 4px, 4px -4px, -4px 0px"},kl=({color:n,setColor:o,fallbackColor:a="#ffffff",variant:i="field"})=>{const[s,c]=e.useState(!1),d=fl(n,a),u=d,p=l.jsx("div",{className:"select-none ee-color-picker-popover",children:l.jsx(r.ChromePicker,{disableAlpha:!0,color:d,style:{boxShadow:"none"},onChange:e=>o({hex:fl(e?.hex,a)})})});return l.jsx(t.Popover,{zIndex:1070,getPopupContainer:()=>document.querySelector(".right-settings")||document.body,content:p,trigger:"click",open:s,onOpenChange:c,children:"field"===i?l.jsxs("button",{type:"button",className:"ee-color-picker-field-trigger","aria-label":"Open color picker",children:[l.jsx("span",{className:"ee-color-picker-field-swatch",style:{background:"transparent"===u?void 0:u,..."transparent"===u?_l:{}}}),l.jsx("span",{className:"ee-color-picker-field-hex","aria-hidden":!0,children:d.toUpperCase()}),l.jsx("span",{className:"ee-color-picker-field-chevron","aria-hidden":!0})]}):l.jsx("button",{type:"button",className:"color-picker-button","aria-label":"Open color picker",style:{background:u,backgroundImage:"transparent"===u?_l.backgroundImage:void 0,backgroundSize:"transparent"===u?_l.backgroundSize:void 0,backgroundPosition:"transparent"===u?_l.backgroundPosition:void 0}})})},xl=[{key:"paddingTop",suffix:"T"},{key:"paddingRight",suffix:"R"},{key:"paddingBottom",suffix:"B"},{key:"paddingLeft",suffix:"L"}],vl=({padding:e,onChange:n,min:o=0,disabled:a})=>{const{t:i}=Zo(),r=t=>o=>{const a="number"==typeof o?o:null==o||""===o?0:Number(o);Number.isNaN(a)||n({...e,[t]:a})};return l.jsx("div",{className:"ee-settings-padding-grid",role:"group","aria-label":i("padding_settings"),children:xl.map(({key:n,suffix:i})=>l.jsx(t.InputNumber,{min:o,step:1,value:e?.[n]??0,onChange:r(n),disabled:a,addonAfter:l.jsx("span",{className:"ee-settings-padding-addon-side","aria-hidden":!0,children:i}),className:"input-width ee-settings-input-affix ee-padding-side-input-num",onFocus:e=>e?.target?.select?.()},n))})},wl=e=>l.jsx(t.Switch,{...e,className:`ee-settings-switch ${e.className||""}`.trim()}),Sl=({padding:a,setPadding:i,showLinkSides:r=!0})=>{const{t:s}=Zo(),[c,d]=e.useState(!1);return r?l.jsxs("div",{className:"padding-settings ee-padding-settings-v2",children:[c?l.jsx(t.InputNumber,{min:0,step:1,addonAfter:"px",className:"input-width ee-settings-input-affix ee-padding-linked-input-num",value:a?.paddingTop??0,onChange:e=>{const t="number"==typeof e?e:0;i({...a,paddingTop:t,paddingRight:t,paddingBottom:t,paddingLeft:t})},onFocus:e=>e?.target?.select?.()}):l.jsx(vl,{padding:a,onChange:i,min:0}),l.jsxs("div",{className:"ee-settings-row ee-padding-link-sides-row padding-settings-link-row",children:[l.jsxs("span",{className:"ee-padding-link-sides-label",children:[s("padding_link_sides_label"),l.jsx(t.Tooltip,{title:s("padding_link_sides_tooltip"),children:l.jsx("span",{className:"ee-help-icon ee-padding-link-sides-help","aria-label":s("padding_link_sides_tooltip"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]}),l.jsx(wl,{checked:c,onChange:d})]})]}):l.jsx("div",{className:"padding-settings ee-padding-settings-v2 ee-padding-settings-plain",children:l.jsx(vl,{padding:a,onChange:i,min:0})})};function jl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cl,Nl={exports:{}};Cl=Nl,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var a=arguments[t];a&&(e=o(e,n(a)))}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var a="";for(var l in n)e.call(n,l)&&n[l]&&(a=o(a,l));return a}function o(e,t){return t?e?e+" "+t:e+t:e}Cl.exports?(t.default=t,Cl.exports=t):window.classNames=t}();var Il=jl(Nl.exports);const Al=()=>{const{t:e}=Zo(),t=dl(e),n=(e=>{const t={desktop:{textAlign:"center",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},n={key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},o=o=>({name:e("content"),key:"content",width:o,styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]});return{full:{columns:1,type:"full",children:[{name:e("content"),key:"content",width:"100%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}]},"1-1":{columns:2,type:"1-1",children:Array.from({length:2}).map(()=>({name:e("content"),key:"content",width:"50%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"1-1-1":{columns:3,type:"1-1-1",children:Array.from({length:3}).map(()=>({name:e("content"),key:"content",width:"33.3%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"1-2-1":{columns:3,type:"1-2-1",children:Array.from({length:3}).map((e,t)=>o(1===t?"50%":"25%"))},"2-1-1":{columns:3,type:"2-1-1",children:Array.from({length:3}).map((e,t)=>o(0===t?"50%":"25%"))},"1-1-2":{columns:3,type:"1-1-2",children:Array.from({length:3}).map((e,t)=>o(2===t?"50%":"25%"))},"1-1-1-1":{columns:4,type:"1-1-1-1",children:Array.from({length:4}).map(()=>({name:e("content"),key:"content",width:"25%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"1-2":{columns:2,type:"1-2",children:Array.from({length:2}).map((e,t)=>o(0===t?"33.3%":"66.6%"))},"2-1":{columns:2,type:"2-1",children:Array.from({length:2}).map((e,t)=>o(0===t?"66.6%":"33.3%"))},"1-3":{columns:2,type:"1-3",children:Array.from({length:2}).map((e,t)=>o(0===t?"25%":"75%"))},"3-1":{columns:2,type:"3-1",children:Array.from({length:2}).map((e,t)=>o(0===t?"75%":"25%"))},"2-3":{columns:2,type:"2-3",children:Array.from({length:2}).map((e,t)=>o(0===t?"40%":"60%"))},"3-2":{columns:2,type:"3-2",children:Array.from({length:2}).map((e,t)=>o(0===t?"60%":"40%"))},"2-4-2-4":{columns:4,type:"2-4-2-4",children:Array.from({length:4}).map((o,a)=>({name:e("content"),key:"content",width:a%2==0?"16.6%":"33.3%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"4-2-4-2":{columns:4,type:"4-2-4-2",children:Array.from({length:4}).map((o,a)=>({name:e("content"),key:"content",width:a%2==0?"33.3%":"16.6%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))}}})(e),o=(e=>t=>{const n={id:P(),name:e("drag_block_here"),key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}};return{id:P(),name:e("container"),key:"column",type:"full",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},children:[{id:P(),name:e("content"),key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[t||n]}]}})(e);return{blockConfigsList:t,columnsSetting:n,getColumnConfig:o}},Ll=({children:e,className:t=""})=>l.jsx("h3",{className:`ee-settings-section-title ${t}`.trim(),children:e}),Tl=e=>e?l.jsx("span",{style:{color:"var(--ee-text-tertiary)",fontWeight:400,fontSize:11,marginLeft:6},children:"optional"}):null,Bl=({label:e,hint:t,optional:n,children:o,className:a="",layout:i="stack"})=>l.jsxs("div",{className:`ee-settings-field ${"toggle"===i?"ee-settings-field--toggle":""} ${a}`.trim(),children:["toggle"===i&&e?l.jsxs("div",{className:"ee-settings-row ee-settings-field-toggle-inner",children:[l.jsxs("span",{className:"ee-settings-row-label",children:[e,Tl(n)]}),o]}):l.jsxs(l.Fragment,{children:[e?l.jsxs("div",{className:"ee-settings-field-label",children:[e,Tl(n)]}):null,o]}),t?l.jsx("div",{style:{fontSize:11,color:"var(--ee-text-tertiary)",lineHeight:1.5},children:t}):null]}),$l=({widths:e})=>{const t=e.reduce((e,t)=>e+parseFloat(t),0)||1;return l.jsx("div",{style:{display:"flex",height:18,gap:2,borderRadius:2,overflow:"hidden",width:36,flexShrink:0},children:e.map((e,n)=>l.jsx("div",{style:{flex:parseFloat(e)/t,background:"rgba(216, 254, 145, 0.5)",borderRadius:1}},n))})},Rl=[{key:"full",labelKey:"column_preset_1_col",widths:["100%"]},{key:"1-1",labelKey:"column_preset_equal_2",widths:["50%","50%"]},{key:"1-1-1",labelKey:"column_preset_equal_3",widths:["33.3%","33.3%","33.3%"]},{key:"1-1-1-1",labelKey:"column_preset_equal_4",widths:["25%","25%","25%","25%"]},{key:"1-2",labelKey:"column_preset_1_2",widths:["33.3%","66.6%"]},{key:"2-1",labelKey:"column_preset_2_1",widths:["66.6%","33.3%"]},{key:"1-3",labelKey:"column_preset_1_3",widths:["25%","75%"]},{key:"3-1",labelKey:"column_preset_3_1",widths:["75%","25%"]},{key:"2-3",labelKey:"column_preset_2_3",widths:["40%","60%"]},{key:"3-2",labelKey:"column_preset_3_2",widths:["60%","40%"]},{key:"1-2-1",labelKey:"column_preset_1_2_1",widths:["25%","50%","25%"]},{key:"2-1-1",labelKey:"column_preset_2_1_1",widths:["50%","25%","25%"]},{key:"1-1-2",labelKey:"column_preset_1_1_2",widths:["25%","25%","50%"]},{key:"2-4-2-4",labelKey:"column_preset_2_4_2_4",widths:["16.6%","33.3%","16.6%","33.3%"]},{key:"4-2-4-2",labelKey:"column_preset_4_2_4_2",widths:["33.3%","16.6%","33.3%","16.6%"]}],Pl=()=>{const{blockMap:a,rootOrder:i,setBlocks:r,currentItem:s,setCurrentItem:c,previewMode:d}=e.useContext($e),{t:u}=Zo(),{columnsSetting:p}=Al();if(!s?.data||"column"!==s.data.key)return null;if(Va(s.data)!==qa)return null;const m=s.data.children||[],g=m.length,h=e=>{const{blockMap:t}=Z([e]),n={...a,...t};r(n,i,`edit_${Date.now()}`),c({...s,data:e})},b=e=>{const t=p[e.key]||p.full;if(!t)return;const n=s.data.children||[],o=(t.children||[]).map((e,t)=>{const o=n[t];if(o)return{...o,key:e.key,name:e.name,width:e.width,styles:B(e.styles??o.styles),children:o.children};const a=P();return{...e,id:a}}),a=B(s.data);a.children=o,h(a)},y=(()=>{const e="desktop"===d?s.data.styles?.desktop:{...s.data.styles?.desktop,...s.data.styles?.mobile},t=e?.columnGap??e?.column_gap??0;return"number"==typeof t?t:parseInt(String(t).replace("px",""),10)||0})(),f=m.reduce((e,t)=>e+parseFloat(t.width||"100"),0)||1,_=Rl.filter(e=>p[e.key]);return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:u("grid_settings")}),l.jsxs("div",{className:"ee-settings-row ee-columns-count-row",children:[l.jsx("span",{className:"ee-padding-link-sides-label",children:u("columns")}),l.jsxs("div",{className:"ee-columns-stepper",children:[l.jsx("button",{type:"button",className:"ee-col-stepper-btn",disabled:g<=1,onClick:()=>{const e=Math.max(1,g-1),t=Rl.find(t=>t.widths.length===e);t&&b(t)},"aria-label":u("columns"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faMinus,style:{fontSize:10}})}),l.jsx("span",{className:"ee-columns-stepper-value",children:g}),l.jsx("button",{type:"button",className:"ee-col-stepper-btn",disabled:g>=4,onClick:()=>{const e=Math.min(4,g+1),t=Rl.find(t=>t.widths.length===e&&t.key.startsWith("1-1"));if(t)b(t);else{const t=Rl.find(t=>t.widths.length===e);t&&b(t)}},"aria-label":u("columns"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faPlus,style:{fontSize:10}})})]})]}),l.jsx(Ll,{children:u("presets")}),l.jsx("div",{className:"ee-columns-preset-grid",children:_.map(e=>{const t=g===e.widths.length&&m.every((t,n)=>{const o=parseFloat(t.width||"0"),a=parseFloat(e.widths[n]||"0");return Math.abs(o-a)<1});return l.jsxs("button",{type:"button",className:Il("ee-columns-preset-btn",t&&"ee-columns-preset-btn--active"),onClick:()=>b(e),children:[l.jsx($l,{widths:e.widths}),l.jsx("span",{children:u(e.labelKey)})]},e.key)})}),g>1&&l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:u("column_sizes")}),l.jsx("div",{className:"ee-columns-width-sliders",children:m.map((e,t)=>{const n=(e=>{if("string"!=typeof e)return 1;const t=parseFloat(e.replace("%",""));return isNaN(t)?1:t})(e.width)/f*100;return l.jsxs("div",{className:"ee-columns-width-slider-row",children:[l.jsxs("span",{className:"ee-columns-width-col-label",children:[u("col")," ",t+1]}),l.jsx("input",{type:"range",min:10,max:90,step:1,value:Math.round(n),onChange:e=>{const n=parseInt(e.target.value,10),o=t===g-1?0:g-1,a=100-n-m.reduce((e,n,a)=>a===t||a===o?e:e+Math.round(parseFloat(n.width||"0")/f*100),0),l=B(s.data);l.children=l.children.map((e,l)=>l===t?{...e,width:`${n}%`}:l===o?{...e,width:`${Math.max(10,a)}%`}:e),h(l)},className:"ee-columns-width-range"}),l.jsxs("span",{className:"ee-columns-width-pct",children:[Math.round(n),"%"]})]},e.id||t)})})]}),l.jsx(Ll,{children:u("gaps")}),l.jsx(Bl,{label:u("column_gap"),children:l.jsx(t.InputNumber,{min:0,max:60,className:"input-width ee-settings-input-affix",addonAfter:"px",value:y,onChange:e=>(e=>{const t=B(s.data);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles[d]||(t.styles[d]={}),Object.assign(t.styles[d],e),h(t)})({columnGap:e??0})})})]})},Ml=({items:e,value:t,onChange:n,size:o="md",className:a="","aria-label":i})=>l.jsx("div",{className:`ee-settings-segmented ${"sm"===o?"ee-settings-segmented--sm":""} ${a}`.trim(),role:"group","aria-label":i,children:e.map(e=>{const o="string"==typeof e?e:e.value,a="string"==typeof e?e:e.label,i="object"==typeof e&&e.icon?e.icon:null,r=o===t,s="object"==typeof e&&e.iconOnly;return l.jsxs("button",{type:"button",title:"string"==typeof a?a:void 0,className:`ee-settings-segmented-btn${r?" ee-settings-segmented-btn--active":""}${s?" ee-settings-segmented-btn--icon-only":""}`,onClick:()=>n&&n(o),children:[i,a]},String(o))})}),Fl=e=>{if(!e||"string"!=typeof e)return!1;try{const t=new URL(e);return/\/knowledge-base\/products$/i.test(t.pathname.replace(/\/$/,""))}catch{return/knowledge-base\/products\/?$/i.test(String(e).trim().replace(/\/$/,""))}},Ul=e=>{if(!e||"object"!=typeof e)return null;const t=null!=e.id?String(e.id):null!=e.resourceId?String(e.resourceId):"";if(!t)return null;const n=e.price,o="number"==typeof n?n:parseFloat(String(n??"").replace(/,/g,""));return{id:t,name:e.name??"",description:ze(e.description),image:e.image_url??e.image??"",link:e.url??"",price:Number.isFinite(o)?o:0,currency:e.currency??"USD",old_price:null!=e.old_price?e.old_price:null,new_price:null!=e.new_price?e.new_price:null,resourceId:e.resourceId,source:e.source}},Dl=async(e,t,n={},{page:o=1,limit:a=20,search:l=""}={})=>{if(!e)return null;try{if(Fl(e)){if(!t)return null;const i=e.replace(/\/$/,""),r=new URL(`${i}/${encodeURIComponent(t)}`);r.searchParams.set("page",String(o)),r.searchParams.set("limit",String(a)),r.searchParams.set("search",l??"");const s=await fetch(r.toString(),{method:"GET",headers:{"Content-Type":"application/json",...n}});if(!s.ok)return console.error("[API Service] KB products fetch failed:",s.status,s.statusText),null;const c=await s.json(),d=Array.isArray(c.data)?c.data:[];return{products:d.map(Ul).filter(Boolean),meta:c.meta&&"object"==typeof c.meta?c.meta:{}}}const i=new URL(e);t&&i.searchParams.append("companyId",t);const r=await fetch(i.toString(),{method:"GET",headers:{"Content-Type":"application/json",...n}});if(!r.ok)return console.error("[API Service] Products fetch failed:",r.status,r.statusText),null;const s=await r.json();if(!1===s.success)return console.error("[API Service] Products API returned error:",s.error),null;const c=s.data?.products??[],d=Array.isArray(c)?c.map(e=>e&&"object"==typeof e?{...e,description:ze(e.description)}:e):[];return Array.isArray(d)&&0!==d.length?{products:d,meta:{hasMore:!1,hasProducts:!0}}:{products:[],meta:{hasMore:!1,hasProducts:!1}}}catch(e){return console.error("[API Service] Error fetching products:",e),null}},El={};function zl(){return"undefined"!=typeof document?document.body:null}function Ol(e){if(!e)return"";const t=e.currency??"",n=e.price?.amount??e.price??"";return`${e.name} — ${t} ${n}`.trim()}function Wl(e,t){const n=new Map;return[...e,...t].forEach(e=>{e&&e.id&&n.set(e.id,e)}),Array.from(n.values())}function Hl({apiConfig:n,templateData:o,value:a,selectedProduct:i,onChange:r,placeholder:s,staticProductList:c=[],getPopupContainer:d}){const{t:u}=Zo(),p=n?.productsEndpoint,m=n?.companyId??o?.companyId,g=e.useMemo(()=>{const e=n?.headers;return e&&"object"==typeof e?e:El},[n?.headers]),h=Boolean(p&&m)&&Fl(p),[b,y]=e.useState([]),[f,_]=e.useState({}),[k,x]=e.useState(!1),[v,w]=e.useState(""),[S,j]=e.useState(""),C=e.useRef(null),N=e.useRef(0),I=e.useRef(1),A=e.useRef(""),L=e.useRef(!1),T=e.useRef(""),B=e.useCallback(async(e,t,n)=>{if(!h)return;const o=(t??"").trim();if(n){const t=`${o}::${e}`;if(L.current&&T.current===t)return;L.current=!0,T.current=t}const a=++N.current;x(!0);try{const l=await Dl(p,m,g,{page:e,limit:20,search:o});if(a!==N.current)return;if(!l)return n||(y([]),j((t??"").trim())),void _({});_(l.meta||{}),y(e=>n?Wl(e,l.products):l.products),I.current=e}finally{n&&(L.current=!1,T.current=""),a===N.current&&x(!1)}},[h,p,m,g]),$=e.useCallback(async e=>{if(!h)return;const t=(e??"").trim();L.current=!1,T.current="";const n=++N.current;x(!0);try{if(""!==t){const e=await Dl(p,m,g,{page:1,limit:20,search:t});if(n!==N.current)return;return e?(_(e.meta||{}),y(e.products),j(t),void(I.current=1)):(y([]),_({}),j(t),void(I.current=1))}let e=1,o=[],a={};for(;o.length<10&&e<=15;){const t=await Dl(p,m,g,{page:e,limit:20,search:""});if(n!==N.current)return;if(!t?.products?.length)break;if(o=Wl(o,t.products),a=t.meta||{},I.current=e,!a.hasMore)break;e+=1}_(a),y(o),j("")}finally{n===N.current&&x(!1)}},[h,p,m,g]),R=e.useCallback(()=>{if(!h||k||!f?.hasMore)return;const e=I.current+1;B(e,A.current,!0)},[h,k,f?.hasMore,B]),P=d??zl,M=e.useCallback(e=>l.jsxs("div",{children:[e,k&&b.length>0&&l.jsxs("div",{className:"ee-kb-product-select-footer",children:[l.jsx(t.Spin,{size:"small"})," ",l.jsx("span",{children:u("loading")})]}),!k&&f?.hasMore&&l.jsx("div",{className:"ee-kb-product-select-footer",children:l.jsx("button",{type:"button",className:"ee-kb-product-select-load-more",onClick:R,children:u("load_more_products")})})]}),[k,b.length,f?.hasMore,R,u]),F=e.useMemo(()=>{const e=h?b:c;return Wl(i?.id?[i]:[],e)},[h,b,c,i]),U=e.useMemo(()=>F.map(e=>({value:e.id,label:Ol(e)})),[F]),D=e=>{if(!e)return r(null),void(h&&(clearTimeout(C.current),w(""),A.current="",I.current=1,j(""),$("")));const t=F.find(t=>t.id===e)||c.find(t=>t.id===e);r(t||null)},E="ee-kb-product-select-dropdown";return h?l.jsx(t.Select,{className:"ee-stack-control ee-kb-product-select",value:a??void 0,placeholder:s,style:{width:"100%"},virtual:!0,dropdownMatchSelectWidth:!0,listHeight:320,listItemHeight:32,dropdownClassName:E,getPopupContainer:P,onChange:D,allowClear:!0,showSearch:!0,filterOption:!1,searchValue:v,onSearch:e=>{if(!h)return;const t=e??"";w(t);const n=t.trim();if(clearTimeout(C.current),""===n)return A.current="",I.current=1,void $("");C.current=setTimeout(()=>{A.current=n,I.current=1,$(n)},400)},onOpenChange:e=>{clearTimeout(C.current),e?(L.current=!1,T.current="",w(""),A.current="",I.current=1,$("")):(L.current=!1,T.current="",w(""),A.current="")},notFoundContent:k?l.jsxs("span",{className:"ee-kb-product-select-loading",children:[l.jsx(t.Spin,{size:"small"})," ",u("loading")]}):U.length>0?null:l.jsx("span",{className:"ee-kb-product-select-empty",children:""!==S.trim()?u("no_products_matching_search"):u("no_product_found")}),options:U,dropdownRender:M}):l.jsx(t.Select,{className:"ee-stack-control",value:a??void 0,placeholder:s,style:{width:"100%"},virtual:!0,dropdownMatchSelectWidth:!0,listHeight:320,listItemHeight:32,dropdownClassName:E,getPopupContainer:P,onChange:D,allowClear:!0,showSearch:!0,optionFilterProp:"label",options:c.map(e=>({value:e.id,label:Ol(e)}))})}const Kl=()=>{const{previewMode:t,currentItem:n,blockMap:o,rootOrder:a,setBlocks:i,setCurrentItem:r}=e.useContext($e),s=e=>{let t;if("column"===e.key){const{blockMap:n}=Z([e]);t={...o,...n}}else t={...o,[n.id]:e};i(t,a,`edit_${(new Date).getTime()}`),r({...n,data:e})};return{findStyleItem:(e,n)=>{let o=e[t][n];return o||(o=e.desktop[n]),o},cardItemElement:(e,t)=>l.jsxs("div",{className:"card-item",children:[l.jsx("div",{className:"card-item-title",children:e}),l.jsx("div",{children:t})]}),updateItemStyles:s,colorChange:e=>({hex:o})=>{const a=B(n.data);a.styles[t][e]=o,s(a)},paddingChange:e=>{const o=B(n.data);o.styles[t]={...o.styles[t],...e},s(o)},otherStylesChange:(e,o)=>{const a=B(n.data);a.styles||(a.styles={desktop:{},mobile:{}}),a.styles[t]||(a.styles[t]={}),a.styles[t][e]=o,"desktop"!==t&&(a.styles.desktop[e]=o),s(a)},inputChange:e=>o=>{const a=B(n.data);a.styles||(a.styles={desktop:{},mobile:{}}),a.styles[t]||(a.styles[t]={}),a.styles[t][e]=o,"desktop"!==t&&(a.styles.desktop[e]=o),s(a)}}};var Vl={presets:[{id:"preset_header",presetName:"Header",nameKey:"preset_header",containerType:"header",block:{name:"Container",key:"column",type:"full",containerType:"header",headerLayout:"logo_center_nav_below",showHeaderBanner:!1,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",headerLogoSlot:!0,src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:16,paddingBottom:8,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{width:"30%"},mobile:{}}},{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:8,paddingBottom:16,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0},{name:"Image",key:"image",headerBannerSlot:!0,hidden:!0,src:"{{HeroBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Divider",key:"divider",headerBannerDividerSlot:!0,hidden:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}}]}]}},{id:"preset_header_centered",presetName:"Header (Centered)",nameKey:"preset_header_centered",containerType:"header",block:{name:"Container",key:"column",type:"full",containerType:"header",headerLayout:"logo_center_nav_below",showHeaderBanner:!1,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",headerLogoSlot:!0,src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:16,paddingBottom:8,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{width:"30%"},mobile:{}}},{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:8,paddingBottom:16,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0},{name:"Image",key:"image",headerBannerSlot:!0,hidden:!0,src:"{{HeroBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Divider",key:"divider",headerBannerDividerSlot:!0,hidden:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}}]}]}},{id:"preset_header_nav_only",presetName:"Nav Bar",nameKey:"preset_header_nav_only",containerType:"header",block:{name:"Container",key:"column",type:"full",containerType:"header",headerLayout:"nav_only",showHeaderBanner:!1,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0}]}]}},{id:"navigation_bar",presetName:"Navigation Bar",nameKey:"preset_navigation_bar",containerType:"none",block:{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:25,paddingBottom:15,paddingLeft:5,paddingRight:5,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:14,fontFamily:"Verdana",color:"#333333",linkColor:"#333333",paddingTop:5,paddingBottom:5,paddingLeft:8,paddingRight:8,letterSpacing:0,fontWeight:"normal"},mobile:{}},isPreset:!0}},{id:"product_single",nameKey:"preset_product_single",containerType:"product",presetName:"Product",block:{name:"Container",key:"column",type:"full",containerType:"product",mainProductLayout:"image_stacked",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"main",columnProducts:[{id:"product-1",name:"Abundance Butterfly Diamond Ring",description:"The Maia Diamond Ring features round diamonds set along a delicate gold band, creating a refined and minimalistic look. Its versatile design makes it perfect for everyday wear or for layering with other rings.",image:"https://www.psylish.com/cdn/shop/files/IMG_4632.jpg?v=1773123202&width=1220",link:"https://www.psylish.com",price:2e3,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"",contentStyles:{desktop:{paddingTop:null,paddingBottom:null,paddingLeft:null,paddingRight:null,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 20px; font-family: sans-serif"><p>{{ProductName}}</p></span>',type:"h2",contentType:"static",styles:{desktop:{fontSize:20,fontFamily:"sans-serif",lineHeight:"120%",paddingTop:12,paddingBottom:null,paddingLeft:12,paddingRight:12,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 16px; font-family: sans-serif">{{ProductPriceDisplay}}<br></span>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:null,paddingBottom:6,paddingLeft:12,paddingRight:12,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:"<p>{{ProductDescription}}</p>",type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"120%",paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Shop Now",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:12,paddingBottom:12,paddingLeft:null,paddingRight:null},mobile:{}},styles:{desktop:{width:"100%",fontSize:16,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:null,paddingRight:null,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}},{name:"Divider",key:"divider",contentStyles:{desktop:{paddingTop:2,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}}]}]}},{id:"product_image_left",presetName:"Product (Image Left)",nameKey:"preset_product_image_left",containerType:"product",block:{name:"Container",key:"column",type:"full",containerType:"product",productRole:"main",mainProductLayout:"image_left",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:12,paddingLeft:12,paddingRight:12,paddingBottom:12,contentBackground:"#fff"},mobile:{}},isPreset:!0,columnProducts:[{id:"product-1",name:"ADIDAS | KID'S STAN SMITH",description:"Elevate your space with a thoughtfully crafted piece that blends function and style. Whether at home or on the go, it's the kind of essential you'll wonder how you lived without.",image:"https://www.psylish.com/cdn/shop/files/IMG_4632.jpg?v=1773123202&width=1220",link:"https://www.psylish.com",price:90,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"2-3",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Content",key:"content",width:"40%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:8,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Product image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}}]},{name:"Content",key:"content",width:"60%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:12,paddingLeft:8,paddingRight:0,paddingBottom:12,contentBackground:"transparent"},mobile:{}},children:[{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;font-weight:700;letter-spacing:0.05em;text-transform:uppercase;margin:0 0 4px">{{ProductName}}</p>',type:"h2",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:4,paddingLeft:0,paddingRight:0,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;color:#6b7280;margin:0 0 10px">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#374151;line-height:1.5">{{ProductDescription}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"150%",paddingTop:0,paddingBottom:14,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Buy Now",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"left",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{width:"auto",fontSize:13,lineHeight:"140%",borderRadius:2,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:20,paddingRight:20,color:"#fff",display:"inline-block"},mobile:{}}}]}]}]}]}},{id:"product_two_column",presetName:"Additional Products",nameKey:"preset_product_two_column",containerType:"product",block:{name:"Container",key:"column",type:"1-1",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,columns:2,columnProducts:[null,null],children:[{name:"Content",key:"content",width:"50%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:0,paddingRight:0,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-2",name:"Heartline Diamond Ring",description:"The Sariah Diamond Earrings feature round diamonds in a classic hoop design that curves elegantly around the lobe.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_15.png?v=1770880382&width=1220",link:"https://www.psylish.com/",price:1e3,currency:"USD",old_price:1200,new_price:1e3}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 20px; font-family: Arial"><p>{{ProductName}}</p></span>',type:"h2",contentType:"static",styles:{desktop:{fontSize:20,fontFamily:"Arial",lineHeight:"140%",paddingTop:12,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 16px; font-family: Arial">{{ProductPriceDisplay}}<br></span>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"Arial",lineHeight:"140%",paddingTop:2,paddingBottom:2,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:"<p>{{ProductDescription}}</p>",type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:12,paddingBottom:12,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Add to Cart",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:12,paddingBottom:12,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{width:"100%",fontSize:16,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]},{name:"Content",key:"content",width:"50%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:0,paddingRight:0,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-3",name:"Lynx Heart Diamond Ring",description:"The Sariah Diamond Earrings feature round diamonds in a classic hoop design that curves elegantly around the lobe.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_48.png?v=1770881768&width=1220",link:"https://www.psylish.com/",price:900,currency:"USD",old_price:1200,new_price:900}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 20px; font-family: Arial"><p>{{ProductName}}</p></span>',type:"h2",contentType:"static",styles:{desktop:{fontSize:20,fontFamily:"Arial",lineHeight:"140%",paddingTop:12,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 16px; font-family: Arial">{{ProductPriceDisplay}}<br></span>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"Arial",lineHeight:"140%",paddingTop:2,paddingBottom:2,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:"<p>{{ProductDescription}}</p>",type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:12,paddingBottom:12,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Add to Cart",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:12,paddingBottom:12,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{width:"100%",fontSize:16,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:20,paddingRight:20,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]}]}},{id:"product_three_column",presetName:"Products (3 Column)",nameKey:"preset_product_three_column",containerType:"product",block:{name:"Container",key:"column",type:"1-1-1",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,columns:3,columnProducts:[null,null,null],children:[{name:"Content",key:"content",width:"33.3%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-4",name:"Diamond Ring",description:"Elegant diamond ring for everyday wear.",image:"https://www.psylish.com/cdn/shop/files/IMG_4632.jpg?v=1773123202&width=1220",link:"https://www.psylish.com",price:1500,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;font-weight:bold;margin:0">{{ProductName}}</p>',type:"h3",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:8,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#6b7280;margin:0">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"View",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:6,paddingBottom:8,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:13,lineHeight:"140%",borderRadius:3,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]},{name:"Content",key:"content",width:"33.3%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-5",name:"Sapphire Bracelet",description:"Delicate bracelet with sapphire stones.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_15.png?v=1770880382&width=1220",link:"https://www.psylish.com/",price:750,currency:"USD",old_price:900,new_price:750}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;font-weight:bold;margin:0">{{ProductName}}</p>',type:"h3",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:8,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#6b7280;margin:0">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"View",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:6,paddingBottom:8,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:13,lineHeight:"140%",borderRadius:3,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]},{name:"Content",key:"content",width:"33.3%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-6",name:"Pearl Necklace",description:"Classic pearl necklace for timeless elegance.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_48.png?v=1770881768&width=1220",link:"https://www.psylish.com/",price:600,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;font-weight:bold;margin:0">{{ProductName}}</p>',type:"h3",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:8,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#6b7280;margin:0">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"View",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:6,paddingBottom:8,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:13,lineHeight:"140%",borderRadius:3,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]}]}},{id:"preset_discount",presetName:"Discount",nameKey:"preset_discount",containerType:"discount",block:{name:"Container",key:"column",type:"full",containerType:"discount",discountVariant:"card",showTitle:!0,discountTitle:"{{DiscountValue}} off your first order",discountCode:"{{DiscountCode}}",titleSize:22,titleWeight:"600",codeSize:16,codeSpacing:.08,codeBorder:"dashed",codeBorderWidth:1.5,codeBg:"none",codeRadius:4,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:28,paddingLeft:24,paddingRight:24,paddingBottom:28,contentBackground:"#D8FE91"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Text",key:"text",text:'<p style="text-align:center;margin:0 0 0px"><span style="font-family:Arial;font-size:22px;font-weight:600;color:#171717">{{DiscountValue}} off your first order</span></p>',type:"h2",contentType:"static",styles:{desktop:{fontSize:22,fontFamily:"Arial",lineHeight:"130%",paddingTop:0,paddingBottom:14,paddingLeft:0,paddingRight:0,textAlign:"center",fontWeight:"600"},mobile:{}}},{name:"Text",key:"text",text:'<p style="text-align:center;margin:0"><span style="font-family:Arial;font-size:16px;letter-spacing:0.08em;color:#171717">{{DiscountCode}}</span></p>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"Arial",lineHeight:"130%",paddingTop:10,paddingBottom:10,paddingLeft:28,paddingRight:28,textAlign:"center",borderTopStyle:"dashed",borderBottomStyle:"dashed",borderLeftStyle:"dashed",borderRightStyle:"dashed",borderTopColor:"#171717",borderBottomColor:"#171717",borderLeftColor:"#171717",borderRightColor:"#171717",borderTopWidth:"1.5px",borderBottomWidth:"1.5px",borderLeftWidth:"1.5px",borderRightWidth:"1.5px",borderRadius:"4px",display:"block",width:"fit-content",maxWidth:"100%",marginLeft:"auto",marginRight:"auto"},mobile:{}}}]}],discountAlign:"center",discountGap:14}},{id:"preset_discount_simple",presetName:"Discount (simple line)",nameKey:"preset_discount_simple",containerType:"discount",block:{name:"Container",key:"column",type:"full",containerType:"discount",discountVariant:"simple",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#ffa7aa"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Text",key:"text",text:'<div style="text-align: center;"><font face="Arial">Use <b>{{DiscountCode}}</b> for <b>{{DiscountValue}}</b> OFF. Expires on {{ValidUntil}}</font></div>',type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"120%",paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}}]}]}},{id:"preset_footer",presetName:"Footer",nameKey:"preset_footer",containerType:"footer",block:{name:"Container",key:"column",type:"full",containerType:"footer",footerUnifiedLayout:!1,showFooterBanner:!1,isPreset:!0,styles:{key:"column",desktop:{backgroundColor:"#f4f4f5",paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,contentBackground:"#ffffff",color:"#737373",linkColor:"",fontSize:12,textAlign:"center"},mobile:{}},children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",footerBannerSlot:!0,hidden:!0,src:"{{FooterBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Divider",key:"divider",footerBannerDividerSlot:!0,hidden:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},{name:"Image",key:"image",footerSlot:"logo",src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:4,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"30%"},mobile:{}}},{name:"Text",key:"text",footerSlot:"brand",hidden:!0,text:'<div style="text-align:center"><b>{{BrandName}}</b></div>',type:"p",contentType:"static",styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:8,paddingBottom:4,paddingLeft:12,paddingRight:12,textAlign:"center",fontWeight:"600"},mobile:{}}},{name:"Text",key:"text",footerSlot:"tagline",text:'<div style="text-align:center">{{Tagline}}</div>',type:"p",contentType:"static",styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:2,paddingBottom:2,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}},{name:"Text",key:"text",footerSlot:"address",hidden:!0,text:'<div style="text-align:center">{{Address}}</div>',type:"p",contentType:"static",styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:4,paddingBottom:4,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}},{name:"Social link",key:"social_link",footerSlot:"social",list:[],imageWidth:36,iconSize:"medium",iconColor:"gray",contentStyles:{desktop:{paddingTop:12,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}}},{name:"Menu",key:"menu",footerSlot:"secondary",hidden:!0,useNavigationLinks:!1,layoutMode:"nav-only",showLogo:!1,mobileLayout:"stack",linkGapPx:0,linkUnderline:!1,list:[{label:"Privacy",url:"#",target:"_self"},{label:"Terms",url:"#",target:"_self"}],separator:" · ",contentStyles:{desktop:{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",linkColor:"#737373",letterSpacing:0,fontWeight:"400",textTransform:"none"},mobile:{}},isPreset:!0},{name:"Menu",key:"menu",footerSlot:"unsubscribe",hidden:!0,useNavigationLinks:!1,layoutMode:"nav-only",showLogo:!1,mobileLayout:"stack",linkGapPx:0,linkUnderline:!1,list:[{label:"Unsubscribe",url:"{{unsubscribe_url}}",target:"_self"},{label:"Update preferences",url:"#",target:"_self"}],separator:" · ",contentStyles:{desktop:{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",linkColor:"#737373",letterSpacing:0,fontWeight:"400",textTransform:"none"},mobile:{}},isPreset:!0},{name:"Text",key:"text",footerSlot:"copyright",text:'<div style="text-align:center;font-size:11px;opacity:0.9">© 2026 {{BrandName}}</div>',type:"p",contentType:"static",styles:{desktop:{fontSize:11,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:8,paddingBottom:4,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}}]}]}}]};const Gl=new Set(["navigation_bar","preset_header_centered","preset_header_nav_only","product_image_left","product_three_column","preset_discount_simple"]);function ql(e){if(!e||"object"!=typeof e)return e;const t={...e,id:P()};return Array.isArray(t.children)&&(t.children=t.children.map(ql)),Array.isArray(t.columnProducts)&&(t.columnProducts=t.columnProducts.map(e=>e&&"object"==typeof e?{...e}:e)),t}function Jl(e){const t=Vl.presets.find(t=>t.id===e);return t?ql(JSON.parse(JSON.stringify(t.block))):null}const Yl=[{id:"dolor-sit-amet",name:"Dolor Sit Amet",description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",image:"https://plus.unsplash.com/premium_photo-1681711647066-ef84575c0d95?fm=jpg&q=30&w=300&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MXx8cHJvZHVjdCUyMHBob3RvZ3JhcGh5fGVufDB8fDB8fHww",link:"https://loremipsum.com/checkout/cart/12345",price:2e3,currency:"USD",old_price:2500,new_price:2e3},{id:"sample-2",name:"Sample Pearl Necklace",description:"Classic strand of lustrous freshwater pearls with a sterling silver clasp. Timeless elegance for any outfit.",image:"https://picsum.photos/seed/necklace2/200/200",link:"https://www.example.com/products/sample-2",price:750,currency:"USD",old_price:null,new_price:null},{id:"sample-3",name:"Sample Gold Bracelet",description:"Handcrafted 14K yellow gold link bracelet. Lightweight and comfortable for everyday wear.",image:"https://picsum.photos/seed/bracelet3/200/200",link:"https://www.example.com/products/sample-3",price:450,currency:"USD",old_price:500,new_price:450},{id:"sample-4",name:"Sample Silver Earrings",description:"Delicate sterling silver drop earrings with subtle sparkle. A versatile addition to your jewelry collection.",image:"https://picsum.photos/seed/earrings4/200/200",link:"https://www.example.com/products/sample-4",price:199,currency:"USD",old_price:null,new_price:null},{id:"sample-5",name:"Sample Gemstone Pendant",description:"Stunning pendant with a natural gemstone centerpiece on a fine silver chain. Makes a memorable gift.",image:"https://picsum.photos/seed/pendant5/200/200",link:"https://www.example.com/products/sample-5",price:320,currency:"USD",old_price:400,new_price:320}],Xl=new Set(["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml","image/webp"]),Zl={png:"image/png",jpeg:"image/jpeg",jpg:"image/jpeg",gif:"image/gif",svg:"image/svg+xml",webp:"image/webp"},Ql=Array.from(Xl).join(",");function ei(e){return e?function(e){if(!e)return!1;const t=String(e.type||"").toLowerCase().trim();if(t)return Xl.has(t);const n=String(e.name||"").toLowerCase(),o=n.lastIndexOf(".");if(-1===o)return!1;const a=n.slice(o+1);return Object.prototype.hasOwnProperty.call(Zl,a)}(e)?e.size>10485760?"size":null:"type":null}const ti=({imageUploadEndpoint:t,headers:n={},companyId:o,imageUploadQueryParams:a,imageUploadCompanyField:l="companyId"}={})=>{const i=!!t;return{uploadImageFile:e.useCallback(async e=>{if(!i)return console.error("[useImageUpload] No image upload endpoint configured"),null;if(!e)return console.error("[useImageUpload] No file provided"),null;const r=ei(e);if("type"===r)return console.error("[useImageUpload] File type not allowed:",e.type),null;if("size"===r)return console.error("[useImageUpload] File too large:",e.size,"bytes"),null;const s=await(async(e,t,n,o={},a={})=>{if(!e)return console.error("[API Service] No image upload endpoint configured"),null;if(!t)return console.error("[API Service] No file provided for upload"),null;const{queryParams:l={},companyField:i="companyId"}=a;try{const a=new FormData;a.append("file",t),n&&("comment"===i?a.append("comment",n):a.append("companyId",n));let r=e;if(l&&Object.keys(l).length>0){const t="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(e,t);Object.entries(l).forEach(([e,t])=>{null!=t&&n.searchParams.set(e,String(t))}),r=n.toString()}const s={...o};Object.keys(s).forEach(e=>{"content-type"===e.toLowerCase()&&delete s[e]});const c=await fetch(r,{method:"POST",headers:{...s},body:a}),d=await c.text();let u={};try{u=d?JSON.parse(d):{}}catch{u=d?{message:d.slice(0,500)}:{}}if(!c.ok){const e=mo(u,c.status);throw console.error("[API Service] Image upload failed:",c.status,e),new Error(e)}if(u&&!1===u.success){const e=mo(u,c.status);throw console.error("[API Service] Upload API returned error:",e),new Error(e)}if(u&&"string"==typeof u.url&&u.url.trim())return u.url.trim();const p=u?.data?.url;if(p&&"string"==typeof p)return p.trim();throw new Error("Upload succeeded but no image URL was returned.")}catch(e){if(console.error("[API Service] Error uploading image:",e),e instanceof Error&&e.message)throw e;throw new Error(e&&"object"==typeof e&&"message"in e?String(e.message):"Unable to upload image. Check your network and try again.")}})(t,e,o,n,{queryParams:a,companyField:l});return s},[i,t,n,o,a,l]),isConfigured:i}};function ni(e){if(null==e)return!0;const t=String(e).trim().toLowerCase();return""===t||"transparent"===t}const oi=({t:n,findStyleItem:o,colorChange:a,inputChange:i,paddingChange:r,patchContainerBackground:s,commitColumnUpdate:c,currentItem:d,children:u})=>{const p=o(d.data.styles,"backgroundColor"),m=o(d.data.styles,"contentBackground"),g=o(d.data.styles,"containerBackgroundImage")??"",h=""!==String(g).trim(),b=e.useMemo(()=>function(e,t){return e?"image":ni(t)?"none":"color"}(h,p),[h,p]),[y,f]=e.useState(null),_=y??b;e.useEffect(()=>{f(null)},[d?.data?.id]),e.useEffect(()=>{h&&f(null)},[h]);const k=o(d.data.styles,"contentMaxWidth")??"100%",x=e.useMemo(()=>[{value:"100%",label:n("content_max_width_option_full")},{value:"720px",label:"720"},{value:"600px",label:"600"},{value:"540px",label:"540"}],[n]),v=e.useMemo(()=>[{value:"none",label:n("border_none")},{value:"solid",label:n("solid")},{value:"dashed",label:n("dashed")},{value:"dotted",label:n("dotted")}],[n]),w=x.some(e=>e.value===k)?k:"100%",S=o(d.data.styles,"minHeight")??"",j="string"==typeof S?parseInt(S.replace("px",""),10)||"":S||"",C=o(d.data.styles,"borderStyle")??"none",N=o(d.data.styles,"borderWidth")??1,I="string"==typeof N?parseInt(N.replace("px",""),10)||1:N||1,A=o(d.data.styles,"borderColor")??"#e0e0e0",L=o(d.data.styles,"borderRadius")??0,T="string"==typeof L?parseInt(String(L).replace("px",""),10)||0:L||0,$="none"!==C,R=Boolean(d.data.hiddenOnMobile),P=ni(m)?"auto":"custom";return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:n("section_background_group")}),l.jsx(Bl,{label:n("section_bg_mode"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:_,onChange:e=>(e=>{if("image"===e)return f("image"),void s({containerBackgroundEnabled:!0});if(f(null),"color"===e){s({containerBackgroundImage:"",containerBackgroundEnabled:!1});const e=ni(p)?"#ffffff":p;return void a("backgroundColor")({hex:e})}"none"===e&&(s({containerBackgroundImage:"",containerBackgroundEnabled:!1}),a("backgroundColor")({hex:"transparent"}))})(e),"aria-label":n("section_bg_mode"),items:[{value:"color",label:n("section_bg_color")},{value:"image",label:n("section_bg_image")},{value:"none",label:n("section_bg_none")}]})}),("color"===_||"image"===_)&&l.jsx(Bl,{label:n("background_color"),children:l.jsx(kl,{color:ni(p)?"#ffffff":p,setColor:({hex:e})=>a("backgroundColor")({hex:e})})}),"image"===_?u:null,l.jsx(Ll,{children:n("section_content_area_group")}),l.jsx(Bl,{label:n("content_area_color"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:P,onChange:e=>{"auto"!==e?i("contentBackground")("#ffffff"):i("contentBackground")("transparent")},"aria-label":n("content_area_color"),items:[{value:"auto",label:n("content_color_auto")},{value:"custom",label:n("content_color_custom")}]})}),"custom"===P?l.jsx(Bl,{label:n("content_background_color"),children:l.jsx(kl,{color:ni(m)?"#ffffff":m,setColor:({hex:e})=>a("contentBackground")({hex:e})})}):null,l.jsx(Bl,{label:n("content_max_width"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:w,onChange:e=>i("contentMaxWidth")(e),"aria-label":n("content_max_width"),items:x})}),l.jsx(Bl,{label:n("min_height"),children:l.jsx(t.InputNumber,{min:0,max:2e3,className:"input-width ee-settings-input-affix",addonAfter:"px",value:j,onFocus:e=>e?.target?.select?.(),onChange:e=>i("minHeight")(e?`${e}px`:"")})}),l.jsx(Ll,{children:n("border")}),l.jsx(Bl,{label:n("border_style"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:C,onChange:e=>i("borderStyle")(e),"aria-label":n("border_style"),items:v})}),$?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:n("border_width"),children:l.jsx(t.InputNumber,{min:0,max:20,className:"input-width ee-settings-input-affix",addonAfter:"px",value:I,onFocus:e=>e?.target?.select?.(),onChange:e=>i("borderWidth")(e??1)})}),l.jsx(Bl,{label:n("border_color"),children:l.jsx(kl,{color:A,setColor:({hex:e})=>a("borderColor")({hex:e})})})]}):null,l.jsx(Bl,{label:n("border_radius"),children:l.jsx(t.InputNumber,{min:0,max:64,className:"input-width ee-settings-input-affix",addonAfter:"px",value:T,onFocus:e=>e?.target?.select?.(),onChange:e=>i("borderRadius")(e??0)})}),l.jsx(Ll,{children:n("spacing")}),l.jsx(Bl,{label:n("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:o(d.data.styles,"paddingTop"),paddingRight:o(d.data.styles,"paddingRight"),paddingLeft:o(d.data.styles,"paddingLeft"),paddingBottom:o(d.data.styles,"paddingBottom")},setPadding:r})}),l.jsx(Ll,{children:n("visibility")}),l.jsxs("div",{className:"ee-settings-row ee-padding-link-sides-row ee-visibility-hide-mobile-row",children:[l.jsx("span",{className:"ee-padding-link-sides-label",children:n("hidden_on_mobile")}),l.jsx(wl,{checked:R,onChange:e=>{const t=B(d.data);t.hiddenOnMobile=e,c(t)}})]})]})},ai=["product"],li=e=>"additional"===e?"additional":"main";function ii(e,t,n){if(!e||"product"!==e.containerType)return null;const o=oe(t,n,e.id);for(let e=0;e<o.length;e++){const n=o[e]?.containerBlock;if(n&&Ja(n,t))return"additional"}return"main"}function ri(e){const t=String(e??"").trim();return t?/^\{\{\w+\}\}$/.test(t)?null:m(t,!1,{allowMailtoTel:!1})||null:null}const si=()=>{const{blockMap:a,rootOrder:i,setBlocks:r,currentItem:s,setCurrentItem:c,previewMode:d,templateData:p,setIsDragStart:m,setActionType:g,apiConfig:h}=e.useContext($e),{t:b}=Zo(),[y,f]=e.useState(!1),_=e.useRef(null),[k,x]=e.useState(!1),[v,w]=e.useState(""),[S,j]=e.useState(""),{uploadImageFile:C,isConfigured:N}=ti({imageUploadEndpoint:h?.imageUploadEndpoint,headers:h?.headers||{},companyId:h?.companyId,imageUploadQueryParams:h?.imageUploadQueryParams,imageUploadCompanyField:h?.imageUploadCompanyField}),{findStyleItem:I,colorChange:A,inputChange:L,paddingChange:T}=Kl(),{blockConfigsList:$}=Al(),R=Va(s?.data),P=s?.data?.children??[],[M,F]=e.useState(0);e.useEffect(()=>{F(0)},[s?.data?.id]),e.useEffect(()=>{const e=P.length;0!==e&&F(t=>t>=e?Math.max(0,e-1):t)},[P.length]);const[U,D]=e.useState(!1);e.useEffect(()=>{D(!1)},[s?.data?.id]);const E="discount"===(z=s.data.containerType??"none")||"none"===z||"header"===z||"footer"===z?z:"product";var z;const O="product"===s.data.containerType?ii(s.data,a,i):null,W=li(O??s.data.productRole??"main"),H=s.data.columnProducts,K=e.useMemo(()=>Array.isArray(H)?H:[],[H]),V=e.useMemo(()=>{const e=s.data;return"image_left"===e.mainProductLayout||"image_stacked"===e.mainProductLayout?e.mainProductLayout:function(e){const t=e?.children?.[0]?.children?.[0];return"column"===t?.key&&"2-3"===t?.type}(e)?"image_left":"image_stacked"},[s.data]),G=e.useMemo(()=>{const e=s.data;if(!Ja(e))return null;const t=e.children?.length??0;return 2!==t&&3!==t?null:{columnCount:t}},[s.data]),q=e.useMemo(()=>({columnIndex:0,columnProduct:K[0]??null}),[K]),J=I(s.data.styles,"containerBackgroundImage")??"";e.useEffect(()=>{j("")},[J]);const Y=p?.content?.products?.length>0?p.content.products:p?.catalogProducts?.length>0?p.catalogProducts:Yl,X=e=>{const{blockMap:t}=Z([e]);let n={...a,...t};const o=li(e.productRole);"product"===e.containerType&&"main"===o&&Object.keys(n).forEach(t=>{if(t===e.id)return;const o=n[t];if(!o||"column"!==o.key)return;if("product"!==o.containerType)return;"main"===li(o.productRole)&&(n[t]={...o,productRole:"additional"})}),r(n,i,`edit_${(new Date).getTime()}`),c({...s,data:e})};e.useEffect(()=>{if("product"!==s?.data?.containerType)return;const e=ii(s.data,a,i);if(!e)return;if(li(s.data.productRole)===e)return;const t=B(s.data);t.productRole=e,X(t)},[s?.data?.id,s?.data?.containerType,s?.data?.productRole,a,i]);const Q=e=>{const t=B(s.data);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles[d]||(t.styles[d]={}),Object.assign(t.styles[d],e),"desktop"!==d&&(t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e)),X(t)},ee=async e=>{if(!e)return;const n=ei(e);if("type"!==n)if("size"!==n)if(N){x(!0);try{const n=await C(e);n?(Q({containerBackgroundImage:cn(n),containerBackgroundEnabled:!0}),w(""),j(""),t.message.success(b("image_uploaded"))):t.message.error(b("image_upload_failed"))}catch(n){console.error(n);const e="string"==typeof n?.message&&n.message.trim()?n.message.trim():null;t.message.error(e||b("image_upload_error"))}finally{x(!1)}}else t.message.error(b("image_upload_not_configured"));else t.message.error(b("image_file_too_large"));else t.message.error(b("image_upload_invalid_type"))},te=e=>{const t=ri(e);var n;w(t?b("blocked_scheme"===(n=t)?"container_bg_image_url_error_blocked_scheme":"duplicate_protocol"===n?"container_bg_image_url_error_duplicate_protocol":"missing_hostname_dot"===n?"container_bg_image_url_error_hostname":"invalid_protocol"===n?"container_bg_image_url_error_invalid_protocol":"container_bg_image_url_error_generic"):""),j("")},ne=ai.includes(E),ae=e=>{if(!ne||"main"!==li(W))return;if(e===V)return;const t=Jl("image_left"===e?"product_image_left":"product_single");if(!t)return;const n=B(s.data);n.mainProductLayout=e,n.children=B(t.children),n.columnProducts=B(K),X(n)},le=e.useMemo(()=>ca(s.data,a),[s.data,a]),ie=e.useMemo(()=>oe(a,i,s.data?.id),[a,i,s.data?.id]),re=e.useMemo(()=>(ie||[]).filter(e=>e?.containerBlock&&e.containerBlock.id!==s.data?.id&&"none"!==e.containerType).map(e=>{const t=e.cellIndex??0;return{containerType:e.containerType,context:{columnIndex:t,columnProduct:e.containerBlock?.columnProducts?.[t]??null}}}),[ie,s.data?.id]),se=Ht(0,E,p,{},re).filter(({variableKey:e,key:t})=>!("product"===E)||(e??t)!==ut).filter(({variableKey:e,key:t})=>!le.has(e??t)),ce=e.useMemo(()=>{const e={columnIndex:0,columnProduct:K[0]??null};return Gt(E,p,e).filter(e=>e.variableKey&&!le.has(e.variableKey))},[E,p,K,le]),de=e.useMemo(()=>{const e=new Set(se.map(e=>e.variableKey??e.key)),t=ce.filter(t=>{const n=t.variableKey;return!(!n||e.has(n))&&(e.add(n),!0)});return[...se,...t]},[se,ce]),ue=e=>t=>{const n=(e=>{const{value:t,type:n}=e;if("image"===n){const e=B($.find(e=>"image"===e.key));return e?(e.src=t,e):{name:b("image"),key:"image",src:t,alt:"Image",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}}}const o=B($.find(e=>"text"===e.key));return o?(o.text=`<p>${t}</p>`,o.type="p",o.contentType="static",o):{name:b("text"),key:"text",text:`<p>${t}</p>`,type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"20px",paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"left"},mobile:{}}}})(e);"undefined"!=typeof window&&(window.__eeDragItemData=n,window.__eeDragSource="product-variables"),m(!0),g("add"),t.target.classList.add("ee-product-variable-item-dragging"),t.dataTransfer&&(t.dataTransfer.effectAllowed="copy")},pe=e=>{e.target.classList.remove("ee-product-variable-item-dragging"),"undefined"!=typeof window&&(window.__eeDragItemData=null,window.__eeDragSource=null),setTimeout(()=>{m(!1)},50)},me=e=>t=>{const n=B(s.data);n.children[e].styles[d]={...n.children[e].styles[d],...t},X(n)},ge=(e=!1)=>{const a=I(s.data.styles,"containerBackgroundImage")??"",i=function(e,t,n){const o=String(e??"").trim();if(!o)return"";if(ri(o))return"";if(/^\{\{\w+\}\}$/.test(o)){const e=o.replace(/\{\{|\}\}/g,"").trim(),a=t&&e?Ft(t,e,n):null;return null==a||String(a).startsWith("{{")?"":u(String(a).trim(),{allowMailtoTel:!1})||""}return u(o,{allowMailtoTel:!1})||""}(a,p,q),r=l.jsxs("span",{className:"ee-container-bg-heading-inline",children:[b("container_background_image_section_title"),l.jsx(t.Tooltip,{title:l.jsxs("div",{className:"ee-container-bg-tooltip",children:[l.jsx("p",{className:"ee-container-bg-tooltip-p",children:b("container_background_image_tooltip_p1")}),l.jsx("p",{className:"ee-container-bg-tooltip-p",children:b("container_background_image_tooltip_p2")}),l.jsx("p",{className:"ee-container-bg-tooltip-p",children:b("container_background_image_intro")})]}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:l.jsx("span",{className:"ee-container-bg-section-help",tabIndex:0,"aria-label":b("container_background_image_title"),onClick:e=>e.stopPropagation(),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]}),c=!e||U;return l.jsxs("div",{className:Go("ee-container-bg-section",e&&"ee-container-bg-section--disclosure"),children:[e?l.jsxs("div",{className:"ee-settings-row ee-padding-link-sides-row ee-container-bg-disclosure-switch-row",children:[l.jsx("div",{className:"ee-container-bg-disclosure-heading-left",children:l.jsx("span",{className:"ee-settings-section-title ee-container-bg-section-heading",children:r})}),l.jsx(wl,{checked:U,onChange:D,"aria-label":b("container_background_image_section_toggle")})]}):l.jsx(Ll,{className:"ee-container-bg-section-heading",children:r}),c?l.jsxs("div",{className:"ee-container-bg-section-body",children:[l.jsx("input",{ref:_,type:"file",accept:Ql,className:"ee-image-upload-input-hidden",onChange:async e=>{const t=e.target.files?.[0];await ee(t),e.target.value=""},disabled:k}),l.jsxs(Bl,{label:b("container_background_image_upload"),children:[l.jsx(t.Spin,{spinning:k,children:l.jsxs("div",{role:"button",tabIndex:0,className:"ee-image-upload-trigger",onClick:()=>!k&&_.current?.click(),onDrop:async e=>{e.preventDefault(),e.stopPropagation();const t=e.dataTransfer?.files?.[0];await ee(t)},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},style:{opacity:k?.6:1,cursor:k?"not-allowed":"pointer"},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faCloudUploadAlt,className:"ee-image-upload-icon"}),l.jsx("span",{children:b(k?"uploading":"image_upload_click")})]})}),l.jsxs("div",{className:"ee-image-toolbar",children:[l.jsxs("button",{type:"button",className:"ee-image-toolbar-btn",onClick:()=>_.current?.click(),disabled:k,children:[l.jsx(n.FontAwesomeIcon,{icon:o.faSyncAlt}),l.jsx("span",{children:b("replace")||"Replace"})]}),l.jsxs("button",{type:"button",className:"ee-image-toolbar-btn ee-image-toolbar-btn--danger",onClick:()=>{w(""),j(""),Q({containerBackgroundImage:"",containerBackgroundEnabled:!1})},disabled:k||!String(a).trim(),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faTrash}),l.jsx("span",{children:b("delete")||"Delete"})]})]}),l.jsx("div",{className:"ee-image-upload-hint",children:b("image_upload_file_hint")||"PNG, JPEG, GIF, SVG, WebP · max 10 MB"})]}),l.jsxs("div",{className:"ee-container-bg-url-block",children:[l.jsx("div",{className:"ee-stack-label ee-container-bg-url-label",children:b("container_background_image_url")}),l.jsx(t.Input,{className:"width-full",value:a,onChange:e=>{const t=e.target.value,n=""!==String(t).trim();j(""),v&&te(t),Q({containerBackgroundImage:t,containerBackgroundEnabled:n})},onBlur:e=>te(e.target.value),status:v||S?"error":"",placeholder:"https://"}),v?l.jsx("div",{className:"ee-field-error",role:"alert",children:v}):null,S&&!v?l.jsx("div",{className:"ee-field-error",role:"alert",children:S}):null,i&&!v?l.jsx("div",{className:"ee-container-bg-url-preview",children:l.jsx("img",{src:i,alt:"",className:"ee-container-bg-url-preview-img",onLoad:()=>j(""),onError:()=>j(b("container_bg_image_preview_failed"))})}):null]}),l.jsxs("div",{className:"ee-container-bg-format-bar",children:[l.jsx("div",{className:"ee-container-bg-format-bar-caption",children:b("container_background_image_layout_group")}),l.jsxs("div",{className:"ee-container-bg-format-bar-inner",children:[l.jsxs("div",{className:"ee-container-bg-format-bar-field ee-container-bg-format-bar-field-size",children:[l.jsx("div",{className:"ee-container-bg-format-bar-label",children:b("container_background_image_size")}),l.jsx(t.Select,{className:"ee-container-bg-size-select ee-container-bg-size-select-half",value:I(s.data.styles,"containerBackgroundSize")||"cover",onChange:e=>Q({containerBackgroundSize:e}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:un.map(e=>l.jsx(t.Select.Option,{value:e.value,children:b(e.labelKey)},e.value))})]}),l.jsxs("div",{className:"ee-container-bg-format-bar-field ee-container-bg-format-bar-field-grid",children:[l.jsx("div",{className:"ee-container-bg-format-bar-label",children:b("container_background_image_position")}),l.jsx("div",{className:"ee-container-bg-position-grid",role:"group","aria-label":b("container_background_image_position"),children:pn.map(e=>{const t=I(s.data.styles,"containerBackgroundPosition")||"center center";return l.jsx("button",{type:"button",className:Go("ee-container-bg-position-cell",t===e&&"ee-container-bg-position-cell-active"),title:e,"aria-pressed":t===e,onClick:()=>Q({containerBackgroundPosition:e}),children:l.jsx("span",{className:"ee-container-bg-dot","aria-hidden":!0})},e)})})]})]})]})]}):null]})};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsxs(l.Fragment,{children:[ne||G?null:l.jsx(Ll,{className:"ee-settings-section-title--flush",children:b("container_settings")}),l.jsxs("div",{className:"ee-right-panel-stack",children:[G?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:b("additional_products_grid_layout")}),l.jsx(Bl,{label:b("additional_products_per_row"),children:l.jsx(t.Select,{className:"ee-stack-control",value:String(G.columnCount),style:{width:"100%"},getPopupContainer:()=>document.querySelector(".right-settings")||document.body,onChange:e=>(e=>{if(!G||e===G.columnCount)return;const t=Jl(3===e?"product_three_column":"product_two_column");if(!t)return;const n=s.data.id,o=B(s.data.styles),a=[...s.data.columnProducts??[]],l=B(t);l.id=n,l.styles=B(o),l.styles.desktop||(l.styles.desktop={}),Object.assign(l.styles.desktop,{paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0}),l.columnProducts=Array.from({length:e},(e,t)=>a[t]??null),X(l)})(Number(e)),options:[{value:"2",label:b("product_row_count_2")},{value:"3",label:b("product_row_count_3")}]})})]}):null,ne&&"main"===li(W)?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:b("product_output_layout")}),l.jsx(Bl,{label:b("style"),children:l.jsx(t.Select,{className:"ee-stack-control",value:V,style:{width:"100%"},getPopupContainer:()=>document.querySelector(".right-settings")||document.body,onChange:ae,options:[{value:"image_stacked",label:b("product_main_layout_stacked")},{value:"image_left",label:b("product_main_layout_image_left")}]})})]}):null,ne&&l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12 ee-product-kb-heading-with-tooltip",children:l.jsxs("span",{className:"ee-product-kb-heading-inner",children:[l.jsx("span",{children:b("product_column_kb_heading")}),l.jsx(t.Tooltip,{title:b("product_column_kb_tooltip"),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:l.jsx("span",{className:"ee-container-bg-section-help",tabIndex:0,"aria-label":b("product_column_kb_tooltip"),onClick:e=>e.stopPropagation(),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]})}),l.jsxs("div",{className:"ee-product-assign-section ee-product-assign-after-kb-heading",children:[l.jsx("span",{className:"ee-stack-label",children:b("product_column_select_label")}),l.jsx(Hl,{apiConfig:h,templateData:p,value:K[0]?.id??void 0,selectedProduct:K[0],onChange:e=>((e,t)=>{const n=B(s.data),o=[...n.columnProducts??[]];o[e]=t,n.columnProducts=o,X(n)})(0,e),placeholder:b("product_column_select_placeholder"),staticProductList:Y})]})]}),l.jsxs("div",{className:"ee-product-variables-section margin-top-12",children:[l.jsx("span",{className:"ee-stack-label",children:b("product_column_variables_heading")}),l.jsxs("button",{type:"button",className:"ee-product-variables-toggle",onClick:()=>f(e=>!e),children:[l.jsx("span",{children:b("variables")}),l.jsx("span",{className:"ee-product-variables-toggle-icon",children:y?"▴":"▾"})]}),y&&l.jsx("div",{className:"ee-product-variables-dropdown",children:de.length>0?de.map(e=>l.jsxs("div",{className:"ee-product-variable-item",draggable:!0,onDragStart:ue(e),onDragEnd:pe,title:e.value,children:[l.jsx("span",{className:"ee-product-variable-item-label",children:e.labelKey?b(e.labelKey):e.label}),l.jsx("span",{className:"ee-product-variable-item-token",children:e.value})]},e.value)):l.jsx("div",{className:"ee-stack-help",children:b("container_variables_none_available")})})]})]})]}),R===qa&&l.jsx(Pl,{}),R!==Ga&&(()=>{const e=s.data.children||[],t=Math.min(Math.max(0,M),Math.max(0,e.length-1)),n=e[t],o=n?I(n.styles,"backgroundColor"):void 0,a=b(R===qa?"column_cells_section":"column_settings");return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:a}),e.length>1?l.jsx(Bl,{label:b("column"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:String(t),"aria-label":b("column_settings"),onChange:e=>F(Number(e)),items:e.map((e,t)=>({value:String(t),label:`${b("column")} ${t+1}`}))})}):null,n?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:b("content_background_color"),children:l.jsx(kl,{color:o,setColor:({hex:e})=>((e,t)=>n=>{const o=B(s.data);o.children[t].styles[d][e]=n,X(o)})("backgroundColor",t)(e)})}),l.jsx(Bl,{label:b("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:I(n.styles,"paddingTop"),paddingRight:I(n.styles,"paddingRight"),paddingLeft:I(n.styles,"paddingLeft"),paddingBottom:I(n.styles,"paddingBottom")},setPadding:me(t)})})]}):null]})})(),(()=>{if(R===Ga)return l.jsx(oi,{t:b,findStyleItem:I,colorChange:A,inputChange:L,paddingChange:T,patchContainerBackground:Q,commitColumnUpdate:X,currentItem:s,children:ge()});const e=I(s.data.styles,"backgroundColor"),n=I(s.data.styles,"contentBackground"),o=I(s.data.styles,"borderRadius"),a="number"==typeof o?o:parseInt(String(o||"").replace("px",""),10)||0,i=Boolean(s.data.hiddenOnMobile);return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:b(R===qa?"column_wrapper_style":"column_styles")}),l.jsx(Bl,{label:b("background_color"),children:l.jsx(kl,{color:e,setColor:A("backgroundColor")})}),l.jsx(Bl,{label:b("content_background_color"),children:l.jsx(kl,{color:n,setColor:A("contentBackground")})}),l.jsx(Bl,{label:b("border_radius"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:a,onFocus:e=>e?.target?.select?.(),onChange:e=>L("borderRadius")(Number(e)||0)})}),l.jsx(Bl,{label:b("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:I(s.data.styles,"paddingTop"),paddingRight:I(s.data.styles,"paddingRight"),paddingLeft:I(s.data.styles,"paddingLeft"),paddingBottom:I(s.data.styles,"paddingBottom")},setPadding:T})}),ge(R===qa),R===qa?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:b("visibility")}),l.jsxs("div",{className:"ee-settings-row ee-padding-link-sides-row ee-visibility-hide-mobile-row",children:[l.jsx("span",{className:"ee-padding-link-sides-label",children:b("hidden_on_mobile")}),l.jsx(wl,{checked:i,onChange:e=>{const t=B(s.data);t.hiddenOnMobile=e,X(t)}})]})]}):null]})})()]})})},ci=({mlEmailNodesEndpoint:t,mlGenerationEndpoint:n,headers:o={},templateData:a,blockId:l,containerType:i,containerId:r,productId:s,blockName:c="Text",blockElementType:d="p",emailTemplateId:u,companyId:p,aiContentLanguage:m="en"}={})=>{const g=!!(t&&String(u??"").trim()&&String(p??"").trim()&&l&&r),h=!!n,b=g||h;return{generateOptions:e.useCallback(async(e,b,y={})=>{const{previousPrompt:f="",previousSelectedAiContent:_=""}=y,k=function(e,t={}){const{containerType:n}=t,o=String(e??"").trim();let a;return a=Kt[o]?Kt[o]:o?o.split(/[-_]/).map(e=>e.length?e[0].toUpperCase()+e.slice(1).toLowerCase():"").join(""):"DisplayText",a||(a="DisplayText"),"product"===n&&"DisplayText"===a?"ProductDescription":a}(e,{containerType:i});if(g){const e={containerType:i||"none",id:r};if("product"===(i||"")&&null!=s){const t=String(s).trim();t&&(e.productId=t)}const n=t,a={blockContext:{blockId:l,name:c,type:d||"p"},companyId:p,containerContext:e,emailTemplateId:u,language:"bn-BD"===m?"bn-BD":"en",promptContext:{newPrompt:b||"",previousPrompt:f||"",previousSelectedAiContent:_||""},type:k},g=await(async(e,t,n={})=>{if(!e)return console.error("[API Service] generate-email-nodes: no endpoint"),{success:!1,error:"ML endpoint is not configured."};try{const o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)});let a={};try{a=await o.json()}catch{a={}}if(!o.ok||!1===a.success){let e="";const t=a.error;if(t&&"object"==typeof t){const n=null!=t.code?String(t.code):"",o=null!=t.message?String(t.message):"";e=[n,o].filter(Boolean).join(" — ")||o||n}return e||(e=null!=a.message?String(a.message):`${o.status} ${o.statusText}`),console.error("[API Service] generate-email-nodes failed:",e),{success:!1,error:String(e),errorCode:t&&"object"==typeof t&&null!=t.code?String(t.code):void 0}}const l=Array.isArray(a.variations)?a.variations:[],i=l.map(e=>e&&"string"==typeof e.value?e.value.trim():"").filter(Boolean);return 0===i.length?(console.error("[API Service] generate-email-nodes: empty variations"),{success:!1,error:"No variations were returned for this request."}):{success:!0,options:i,variations:l,emailJson:"string"==typeof a.emailJson?a.emailJson:void 0,blockId:a.blockId,emailTemplateId:a.emailTemplateId}}catch(e){return console.error("[API Service] Error calling generate-email-nodes:",e),{success:!1,error:e&&"object"==typeof e&&"message"in e?String(e.message):"Unable to reach the ML service. Check your network and try again."}}})(n,a,o);if(g&&g.success&&g.options?.length)return g.options;return{error:g&&"object"==typeof g&&g.error?String(g.error):"No response from the ML service."}}if(h){const e={variable:k,prompt:b,context:{templateData:a,blockId:l,containerType:i}},t=await(async(e,t,n={})=>{if(!e)return console.error("[API Service] ML endpoint not configured"),null;try{const o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)});if(!o.ok)return console.error("[API Service] ML endpoint failed:",o.status,o.statusText),null;const a=await o.json();if(!a.success)return console.error("[API Service] ML API returned error:",a.error),null;const l=a.data?.options??[];return Array.isArray(l)&&0!==l.length?l:(console.error("[API Service] ML API returned empty options"),null)}catch(e){return console.error("[API Service] Error calling ML endpoint:",e),null}})(n,e,o);return t&&t.length?t:{error:"The legacy ML endpoint did not return any options. Check the API response."}}return{i18nKey:"ml_ai_unavailable"}},[g,h,t,n,o,a,l,i,r,s,c,d,u,p,m]),isConfigured:b}};function di(){const{blockMap:t,rootOrder:n,currentItem:o}=e.useContext($e);return e.useMemo(()=>{if(!t||!o?.id)return{containerBlock:null,containerType:"none",columnIndex:0,cellIndex:0};const{containerBlock:e,containerType:a,cellIndex:l,isRoot:i,rootIndex:r}=ne(t,n,o.id);let s=0;if(i)s=r??0;else if(e){const t=n.indexOf(e.id);s=t>=0?t:0}const c=l??0;return{containerBlock:e??null,containerType:a??"none",columnIndex:s,cellIndex:c,contentIndex:c}},[t,n,o?.id])}const{TextArea:ui}=t.Input,pi=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,64],mi="staticTextBeforeAi";function gi(e,t,n,o){const a=Number.parseInt(String(e??""),10);return Number.isNaN(a)?o:Math.min(n,Math.max(t,a))}function hi(e){return null==e||"string"!=typeof e?"":e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}const bi=({embedded:a=!1})=>{const{currentItem:i,previewMode:r,templateData:s,apiConfig:c,bodySettings:d,aiEnabled:u=!0}=e.useContext($e),{t:p}=Zo(),{findStyleItem:m,paddingChange:g,otherStylesChange:h,inputChange:b,updateItemStyles:y}=Kl(),{containerBlock:f,containerType:_,cellIndex:k}=di(),x="product"===_?f?.columnProducts?.[k??0]?.id:void 0,v="bn-BD"===i?.data?.dynamicAiLanguage?"bn-BD":"en",{generateOptions:w}=ci({mlEmailNodesEndpoint:c?.mlEmailNodesEndpoint,mlGenerationEndpoint:c?.mlGenerationEndpoint,headers:c?.headers||{},templateData:s,blockId:i?.id,containerType:_,containerId:f?.id,productId:x,blockName:i?.data?.name||"Text",blockElementType:i?.data?.type||"p",emailTemplateId:c?.emailTemplateId,companyId:c?.companyId??s?.companyId,aiContentLanguage:v}),[S,j]=e.useState(""),C=m(i.data.styles,"fontSize"),N=null!=C&&""!==C?Number(C):14,[I,A]=e.useState(String(N)),[L,T]=e.useState(""),$=(e,t)=>{const n=B(i.data);n.styles||(n.styles={desktop:{},mobile:{}}),n.styles.desktop||(n.styles.desktop={}),n.styles.mobile||(n.styles.mobile={}),n.styles.desktop[e]=t,n.styles[r][e]=t,n.text=R(n.text,n.styles.desktop),y(n)},P=e=>{const t=gi(e,1,999,14);A(String(t)),$("fontSize",t)},M=()=>{const e=String(L??"").trim();if(""===e){const e=B(i.data);return e.styles||(e.styles={desktop:{},mobile:{}}),e.styles.desktop||(e.styles.desktop={}),e.styles.mobile||(e.styles.mobile={}),delete e.styles.desktop.lineHeight,delete e.styles.mobile.lineHeight,void y(e)}const t=gi(e,1,999,24);T(String(t)),b("lineHeight")(`${t}px`)};e.useEffect(()=>{A(String(N))},[i?.id,N]);const F=m(i.data.styles,"lineHeight");e.useEffect(()=>{T(null==F||""===F?"":String(function(e,t=14){if(null==e||""===e)return Math.max(1,Math.round(1.4*Number(t)));const n=String(e).trim(),o=n.match(/^(-?\d*\.?\d+)\s*%$/);if(o){const e=Number(o[1]);if(!Number.isNaN(e))return Math.max(1,Math.round(t*e/100))}const a=n.match(/^(-?\d*\.?\d+)\s*px$/i);if(a){const e=Number(a[1]);if(!Number.isNaN(e))return Math.max(1,Math.round(e))}const l=Number(n);return Number.isNaN(l)?24:l>0&&l<=10?Math.max(1,Math.round(t*l)):Math.max(1,Math.round(l))}(F,N)))},[i?.id,F,N]);const[U,D]=e.useState([]),[E,z]=e.useState(!1),[O,W]=e.useState(""),H=i.data.contentType??"static",K=i.data.type??"p",V=String(K).toLowerCase(),G="p"===V||""===K?"p":/^h[1-6]$/.test(V)?V:"p",q=e=>{if(!u)return;const t=e?"dynamic":"static",n=B(i.data),o=n.styles?.desktop??{};if(n.contentType=t,"dynamic"===t){if("static"===(i.data.contentType??"static")){const e=i.data.text??"",t=R(p("text_content"),o),a=R(p("ai_enabled"),o);hi(e).length>0&&e!==t&&e!==a?n[mi]=e:delete n[mi]}n.selectedVariableKey=void 0,n.dynamicVariable=n.dynamicVariable??"",n.dynamicPrompt=n.dynamicPrompt??"",n.dynamicSelectedContent=n.dynamicSelectedContent??"",n.dynamicOptions=Array.isArray(n.dynamicOptions)?n.dynamicOptions:[],n.dynamicAiLanguage="bn-BD"===n.dynamicAiLanguage?"bn-BD":"en";const e=n.dynamicSelectedContent??"",t="string"==typeof e?hi(e):"",a=R(p("ai_enabled"),o);n.text=t.length>0?R(e,o):a}else{const e=n[mi];"string"==typeof e&&hi(e).length>0?n.text=R(e,o):n.text=R(p("text_content"),o),delete n[mi]}y(n)},J=async()=>{const e=i.data.dynamicVariable??"",t=i.data.dynamicPrompt??S??"";z(!0),W("");try{const n=await w(e,t,{previousPrompt:i.data.dynamicPreviousPrompt??"",previousSelectedAiContent:hi(i.data.dynamicSelectedContent||i.data.text)});if(n&&"object"==typeof n&&!Array.isArray(n))return n.i18nKey?W(p(n.i18nKey)):n.error?W(String(n.error)):W(p("ml_no_variations")),void D([]);if(Array.isArray(n)&&n.length>0){W(""),D(n);const e=B(i.data);e.dynamicOptions=n,e.dynamicPrompt=t,e.dynamicPreviousPrompt=t,y(e)}else W(p("ml_no_variations")),D([])}catch(e){console.error("[TextStyleSettings] Error during content generation:",e),W(e&&"object"==typeof e&&"message"in e?String(e.message):p("ml_generation_unexpected_error")),D([])}finally{z(!1)}},Y=e=>{const t=e.target.value;j(t),W("");const n=B(i.data);n.dynamicPrompt=t,y(n)},X=e=>{const t=B(i.data);t.dynamicAiLanguage="bn-BD"===e?"bn-BD":"en",y(t)};return l.jsxs("div",{className:a?"ee-settings-block-form ee-discount-simple-text-settings":"margin-y-30 ee-settings-block-form",children:[(()=>{const e=l.jsxs("div",{className:Go("ee-text-ai-usp-row","ee-settings-row","ee-text-ai-toggle-row",!u&&"ee-text-ai-usp-row--disabled"),children:[l.jsxs("span",{className:"ee-text-ai-label-with-help",children:[p("ai_enabled"),l.jsx(t.Tooltip,{title:p("tooltip_write_using_ai"),children:l.jsx("span",{className:"ee-help-icon ee-text-ai-help-trigger","aria-label":p("tooltip_write_using_ai"),onClick:e=>e.stopPropagation(),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]}),l.jsx(wl,{checked:"dynamic"===H,onChange:q,disabled:!u})]});return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"ee-text-settings-content-wrap",children:[l.jsx(Ll,{children:p("content")}),l.jsxs("div",{className:"ee-text-settings-content-gap",children:[l.jsx(Bl,{label:p("heading_type"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:G,onChange:e=>{return(t=e,()=>{const e=String(t??"p").toLowerCase(),n=i.data.styles?.desktop??{},o="p"!==e&&/^h[1-6]$/.test(e)?e:"p";let a,l,r;if("p"===o)a=14,l=20,r="400";else{switch(a=n.fontSize,o){case"h1":a=22;break;case"h2":a=20;break;case"h3":a=18;break;case"h4":a=16;break;case"h5":a=15;break;case"h6":a=14;break;default:a=null!=a&&""!==a&&Number(a)||14}l=Math.max(1,Math.round(1.4*Number(a))),r="bold"}const s=B(i.data);s.type=o;const c="p"===o?{textTransform:"none",letterSpacing:"0em"}:{},d={...n,...c,fontSize:a,lineHeight:`${l}px`,fontWeight:r},u={...i.data.styles?.mobile??{},...c,fontSize:a,lineHeight:`${l}px`,fontWeight:r};s.styles={...s.styles??{},desktop:d,mobile:u},s.text=R(s.text,d),y(s)})();var t},items:[{value:"p",label:p("body_paragraph")},{value:"h1",label:"H1"},{value:"h2",label:"H2"},{value:"h3",label:"H3"},{value:"h4",label:"H4"}],"aria-label":p("heading_type")})}),l.jsx("div",{className:"ee-text-ai-slot",children:u?e:l.jsx(t.Tooltip,{title:p("tooltip_write_using_ai_unavailable"),children:e})}),u&&"dynamic"===H?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ee-dynamic-prompt-block ee-dynamic-prompt-block--with-heading",children:[l.jsxs("div",{className:"ee-dynamic-language-row",children:[l.jsx("span",{className:"ee-prompt-label",children:p("ai_output_language")}),l.jsxs(t.Select,{className:"input-width ee-dynamic-language-select",value:v,onChange:X,getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:[l.jsx(t.Select.Option,{value:"en",children:p("ai_output_language_en")}),l.jsx(t.Select.Option,{value:"bn-BD",children:p("ai_output_language_bn")})]})]}),l.jsxs("span",{className:"ee-prompt-label",children:[p("dynamic_prompt_help"),l.jsx(t.Tooltip,{title:p("tooltip_dynamic_prompt"),children:l.jsx("span",{className:"ee-help-icon","aria-label":"Help",children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]}),l.jsx(ui,{rows:3,value:i.data.dynamicPrompt??S,onChange:Y,placeholder:p("dynamic_prompt_help")}),l.jsx(t.Button,{type:"primary",size:"small",block:!0,loading:E,disabled:!(i.data.dynamicPrompt??S??"").trim(),onClick:J,children:p("generate")}),O?l.jsx("div",{className:"ee-ml-generation-error",role:"alert",children:O}):null]}),(i.data.dynamicOptions?.length>0||U.length>0)&&l.jsxs("div",{className:"ee-sample-content-block",children:[l.jsx("div",{className:"card-item-title",children:p("select_content")}),(i.data.dynamicOptions||U).map((e,t)=>{const n="string"==typeof e?e:String(e),o=i.data.dynamicSelectedContent??"",a=(("string"==typeof o?hi(o):"").length>0?o:i.data.text??"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim(),r=n.replace(/\s+/g," ").trim(),s=a.length>0&&a===r;return l.jsx("div",{className:Go("ee-sample-content-item",s&&"ee-sample-content-item-selected"),onClick:()=>(e=>{const t=B(i.data);t.dynamicSelectedContent=e,t.text=e,y(t),Array.isArray(t.dynamicOptions)&&t.dynamicOptions.length&&D([...t.dynamicOptions]),W("")})(e),children:e},t)})]})]}):null]})]})})})(),(()=>{const e=m(i.data.styles,"color"),a=null!=e&&""!==String(e).trim()?e:d?.styles?.color??"#171717",c=m(i.data.styles,"linkColor"),u=m(i.data.styles,"textAlign"),g=m(i.data.styles,"fontFamily"),f=function(e){if(null==e||""===e)return"400";const t=String(e).trim().toLowerCase();if("bold"===t||"bolder"===t)return"700";if("normal"===t||"lighter"===t)return"400";const n=Number(t);return Number.isNaN(n)||n<=450?"400":n<=550?"500":n<=650?"600":"700"}(m(i.data.styles,"fontWeight")),_=m(i.data.styles,"textTransform"),k=null!=_&&""!==String(_).trim()?String(_):"none",x=function(e,t){if(null==e||""===e)return t;const n=String(e).trim().replace(/[a-z%]+$/i,""),o=Number(n);return Number.isNaN(o)?t:o}(m(i.data.styles,"letterSpacing"),0),v=tn(s),w=on(g,s);return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:p("typography")}),l.jsx(Bl,{label:p("font_color"),children:l.jsx(kl,{color:a,fallbackColor:d?.styles?.color??"#171717",setColor:({hex:e})=>$("color",e)})}),l.jsx(Bl,{label:p("link_color"),children:l.jsx(kl,{color:null!=c&&""!==String(c).trim()?c:"#2faade",setColor:({hex:e})=>((e,t)=>{const n=B(i.data);n.styles||(n.styles={desktop:{},mobile:{}}),n.styles.desktop||(n.styles.desktop={}),n.styles.mobile||(n.styles.mobile={}),n.styles.desktop[e]=t,n.styles[r][e]=t,y(n)})("linkColor",e)})}),l.jsx(Bl,{label:p("label_align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:u||"left",onChange:e=>h("textAlign",e),"aria-label":p("text_align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignJustify,className:"tag-style-size"}),iconOnly:!0}]})}),l.jsx(Bl,{label:p("font_weight"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:f,onChange:e=>$("fontWeight",e),"aria-label":p("font_weight"),items:[{value:"400",label:"Reg"},{value:"500",label:"Med"},{value:"600",label:"SBd"},{value:"700",label:"Bd"}]})}),l.jsx(Bl,{label:p("text_transform"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:k,onChange:e=>$("textTransform",e),"aria-label":p("text_transform"),items:[{value:"none",label:"Aa"},{value:"uppercase",label:"AA"},{value:"capitalize",label:"Cp"}]})}),l.jsx(Bl,{label:p("font_family"),children:l.jsx(t.Select,{className:"input-width ee-font-family-select",value:w,showSearch:!0,optionFilterProp:"label",labelRender:({value:e})=>l.jsx("span",{children:an(e,s)}),onChange:e=>$("fontFamily",on(e,s)),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:v})}),l.jsx(Bl,{label:p("font_size"),children:l.jsx(t.AutoComplete,{className:"input-width ee-settings-input-affix",value:I,options:pi.map(e=>({value:String(e),label:`${e}px`})),onChange:e=>A(String(e??"")),onSelect:e=>P(e),filterOption:!1,getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:l.jsx(t.Input,{addonAfter:"px",onFocus:e=>e?.target?.select?.(),onBlur:()=>P(I),onPressEnter:e=>{P(I),e.currentTarget.blur()},onKeyDown:e=>{if("ArrowUp"!==e.key&&"ArrowDown"!==e.key)return;e.preventDefault();const t="ArrowUp"===e.key?1:-1,n=gi(I,1,999,14)+t;P(n)}})})}),l.jsx(Bl,{label:p("line_height"),children:l.jsx(t.Input,{className:"input-width ee-settings-input-affix",addonAfter:"px",value:L,onChange:e=>T(e.target.value.replace(/[^\d]/g,"")),onFocus:e=>e?.target?.select?.(),onBlur:M,onPressEnter:e=>{M(),e.currentTarget.blur()}})}),l.jsx(Bl,{label:p("letter_spacing"),children:l.jsx(t.InputNumber,{className:"input-width ee-settings-input-affix",addonAfter:"px",min:-20,max:100,step:.1,value:x,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t=null==e||Number.isNaN(Number(e))?0:Number(e);b("letterSpacing")(`${t}px`)}})})]})})(),l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:p("spacing")||"Spacing"}),l.jsx(Bl,{label:p("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:m(i.data.styles,"paddingTop"),paddingRight:m(i.data.styles,"paddingRight"),paddingLeft:m(i.data.styles,"paddingLeft"),paddingBottom:m(i.data.styles,"paddingBottom")},setPadding:g})})]})]})};function yi(e){if(null==e)return!0;const t=String(e).trim().toLowerCase();return""===t||"transparent"===t||"rgba(0, 0, 0, 0)"===t}function fi(e,t){const n=Rn(t);if(!e||"object"!=typeof e)return n;for(const t of["desktop","mobile"]){const o=e[t]?.backgroundColor;if(!yi(o))return $n(o)?n:o}for(const t of["desktop","mobile"]){const n=e[t]?.borderColor;if(!yi(n))return n}return n}function _i(e,t,n){"solid"===t?(e.borderWidth=0,e.borderStyle="solid",e.borderColor=n,e.backgroundColor=n,e.color=function(e){const t=String(e??"").trim().replace(/^#/,"");if(3!==t.length&&6!==t.length)return"#ffffff";const n=(e=>3===e.length?e.split("").map(e=>e+e).join(""):e)(t),o=parseInt(n.slice(0,2),16),a=parseInt(n.slice(2,4),16),l=parseInt(n.slice(4,6),16);return[o,a,l].every(e=>Number.isFinite(e))&&(.299*o+.587*a+.114*l)/255>.62?"#171717":"#ffffff"}(n),e.textDecoration="none"):"outline"===t?(e.borderWidth=2,e.borderStyle="solid",e.borderColor=n,e.backgroundColor="transparent",e.color=n,e.textDecoration="none"):"ghost"===t?(e.borderWidth=0,e.borderStyle="none",e.borderColor="transparent",e.backgroundColor="transparent",e.color=n,e.textDecoration="none"):"underline"===t&&(e.borderWidth=0,e.borderStyle="none",e.borderColor="transparent",e.backgroundColor="transparent",e.color=n,e.textDecoration="underline")}const ki=()=>{const{currentItem:a,previewMode:i,templateData:r}=e.useContext($e),[s,c]=e.useState(""),{t:d}=Zo(),{containerBlock:u,containerType:p,contentIndex:g}=di(),h=u?.columnProducts?.[g]??null,b=e.useMemo(()=>({columnIndex:g,columnProduct:h}),[g,h]),y=e.useMemo(()=>tn(r),[r]),f=["header","footer","discount","product"].includes(p),{findStyleItem:_,colorChange:k,paddingChange:x,inputChange:v,updateItemStyles:w}=Kl(),{urlOptions:S}=e.useMemo(()=>function(e,t,n={}){const o="product"===e?Ot:zt;return{labelOptions:Et.map(({variableKey:e,labelKey:o})=>({value:ht(e),labelKey:o,pasteValue:Ft(t,e,n)})),urlOptions:o.map(({variableKey:e,labelKey:o})=>({value:ht(e),labelKey:o,pasteValue:Ft(t,e,n)}))}}(p,r,b),[p,r,b]);return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[(()=>{const{linkURL:e,text:n,labelVariable:o,urlVariable:i}=a.data,u=n?.replace(/<[^>]+>/g,"").trim()??"",p=o||u&&/\{\{\w+\}\}/.test(u),g=o?o.replace(/^\{\{|\}\}$/g,"").trim():u.match(/\{\{(\w+)\}\}/)?.[1]||"CTALabel",h=r&&p?Ft(r,g,b):null,y=null==h||String(h).startsWith("{{")?u:h,_=i?i.replace(/^\{\{|\}\}$/g,"").trim():"",k=null!=e?String(e).trim():"",x=k.match(/^\{\{(\w+)\}\}$/),v=i||(!i&&x?k:null)||void 0,j=x&&r?Ft(r,x[1],b):null,C=null==j||"string"!=typeof j||String(j).startsWith("{{")?"":String(j).trim(),N=!k&&_&&r?Ft(r,_,b):null,I=null==N||"string"!=typeof N||N.startsWith("{{")?"":String(N).trim(),A=C||I||k||"",L=e=>{c((e=>{const t=String(e??"").trim(),n=m(t,!1,{allowMailtoTel:!0});return n?"empty"===n?"Button -> Link URL is empty. Add a destination like 'https://example.com' or 'mailto:support@example.com'.":"blocked_scheme"===n?`Button -> Link URL ('${t}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===n?`Button -> Link URL ('${t}') repeats the protocol. Keep only one, e.g. 'https://example.com'.`:"missing_hostname_dot"===n?`Button -> Link URL ('${t}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===n?`Button -> Link URL ('${t}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`Button -> Link URL ('${t}') is invalid. Fix the URL format, for example 'https://example.com'.`:""})(e))};return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:d("button_action")}),l.jsx(Bl,{label:d("button_text"),children:l.jsx(t.Input,{className:"width-full",value:y,onChange:e=>{const t=e.target.value,n=B(a.data);n.text=t,t&&t.startsWith("{{")||(n.labelVariable=""),w(n)},placeholder:d("button_label_manual")})}),f&&S.length>0?l.jsx(Bl,{label:d("button_url_variable"),children:l.jsx(t.Select,{className:"ee-variable-select width-full",placeholder:d("button_url_manual"),allowClear:!0,value:v,onChange:e=>{const t=B(a.data);if(!e){t.urlVariable="";const e=String(t.linkURL??"").trim();return/^\{\{\w+\}\}$/.test(e)?t.linkURL="":t.linkURL=t.linkURL||"",void w(t)}const n=S.find(t=>t.value===e);t.urlVariable=e;const o=n?n.pasteValue:e;t.linkURL="string"==typeof o?o.replace(/^https?:\/\//,""):"",w(t)},getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:[{value:"",label:d("button_url_manual")},...S.map(e=>({value:e.value,label:d(e.labelKey)}))]})}):null,l.jsx(Bl,{label:d("link_url"),children:l.jsxs(l.Fragment,{children:[l.jsx(t.Input,{className:"width-full",value:A,onChange:e=>{const t=e.target.value,n=B(a.data);n.linkURL=t,t&&t.startsWith("{{")||(n.urlVariable=""),w(n),s&&L(t)},onBlur:e=>L(e.target.value),status:s?"error":"",placeholder:d("link_url_placeholder")}),s?l.jsx("div",{className:"ee-field-error",role:"alert",children:s}):null]})})]})})(),(()=>{const e=_(a.data.styles,"width"),s=_(a.data.styles,"borderRadius"),c="number"==typeof s?s:parseInt(String(s||"").replace("px",""),10)||0,u=a.data.contentStyles?.[i]?.textAlign??"center",p="left"===u||"center"===u||"right"===u?u:"center",m=_(a.data.styles,"color"),g=_(a.data.styles,"fontFamily"),h=_(a.data.styles,"fontSize"),b=_(a.data.styles,"lineHeight"),f=function(e,t){const n=e?.buttonAccentColor;return null==n||yi(n)?fi(e?.styles,t):n}(a.data,r),S=a.data.buttonVariant??"solid",j=a.data.hoverBg??"",C=a.data.hoverColor??"",N=_(a.data.styles,"letterSpacing")??"0em",I=_(a.data.styles,"textTransform")??"none",A=_(a.data.styles,"textDecoration")??"none",L=_(a.data.styles,"borderWidth"),T=_(a.data.styles,"borderStyle")??"solid",$=_(a.data.styles,"borderColor")??"#000000",R=a.data.shadowPreset??"none",P=e=>t=>{const n=B(a.data);n[e]=t,w(n)},M={none:"",sm:"0 1px 2px rgba(0,0,0,0.12)",md:"0 4px 6px rgba(0,0,0,0.18)",lg:"0 10px 20px rgba(0,0,0,0.22)"},F=()=>document.querySelector(".right-settings")||document.body;return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:d("button_styles")}),l.jsx(Bl,{label:d("button_variant")||"Variant",children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:S,onChange:e=>(e=>{const t=B(a.data);t.buttonVariant=e,t.styles=t.styles??{desktop:{},mobile:{}},t.styles.desktop={...t.styles.desktop??{}},t.styles.mobile={...t.styles.mobile??{}};const n=null==t.buttonAccentColor||yi(t.buttonAccentColor)?fi(t.styles,r):t.buttonAccentColor;t.buttonAccentColor=n,_i(t.styles.desktop,e,n),_i(t.styles.mobile,e,n),w(t)})(e),"aria-label":d("button_variant")||"Variant",items:[{value:"solid",label:"Solid"},{value:"outline",label:"Outline"},{value:"ghost",label:"Ghost"},{value:"underline",label:"Underline"}]})}),l.jsx(Bl,{layout:"toggle",label:d("full_width")||"Full width",children:l.jsx(wl,{checked:"auto"!==e,onChange:()=>{const t="auto"===e?"100%":"auto";v("width")(t)}})}),"auto"!==e?l.jsx(Bl,{label:d("width"),children:l.jsx(t.Slider,{value:Number(String(e).replace("%","")),onChange:e=>v("width")(e+"%")})}):null,"auto"!==e?l.jsx(Bl,{label:d("align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:p,onChange:e=>(e=>{const t=B(a.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]||{},textAlign:e},w(t)})(e),"aria-label":d("align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0}]})}):null,l.jsx(Bl,{label:d("font_color"),children:l.jsx(kl,{color:m,setColor:k("color")})}),l.jsx(Bl,{label:d("button_color"),children:l.jsx(kl,{color:f,setColor:({hex:e})=>{const t=B(a.data);t.styles=t.styles??{desktop:{},mobile:{}},t.styles.desktop={...t.styles.desktop??{}},t.styles.mobile={...t.styles.mobile??{}},t.buttonAccentColor=e;const n=t.buttonVariant??"solid";_i(t.styles.desktop,n,e),_i(t.styles.mobile,n,e),w(t)}})}),l.jsx(Bl,{label:d("hover_bg_color")||"Hover bg",children:l.jsx(kl,{color:j||f,setColor:e=>P("hoverBg")(e.hex)})}),l.jsx(Bl,{label:d("hover_text_color")||"Hover text",children:l.jsx(kl,{color:C||m,setColor:e=>P("hoverColor")(e.hex)})}),l.jsx(Bl,{label:d("font_family"),children:l.jsx(t.Select,{className:"width-full",showSearch:!0,optionFilterProp:"label",value:on(g??"sans-serif",r),onChange:e=>v("fontFamily")(on(e,r)),labelRender:({value:e})=>l.jsx("span",{children:an(e,r)}),getPopupContainer:F,options:y})}),l.jsx(Bl,{label:d("font_size"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:h,onFocus:e=>e?.target?.select?.(),onChange:v("fontSize")})}),l.jsx(Bl,{label:d("line_height"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"%",value:Number(String(b||"100").replace("%","")),onFocus:e=>e?.target?.select?.(),onChange:e=>v("lineHeight")(`${e??0}%`)})}),l.jsx(Bl,{label:d("letter_spacing")||"Letter spacing",children:l.jsx(t.InputNumber,{className:"input-width ee-settings-input-affix",addonAfter:"em",step:.01,value:parseFloat(String(N).replace("em",""))||0,onFocus:e=>e?.target?.select?.(),onChange:e=>v("letterSpacing")(`${e??0}em`)})}),l.jsx(Bl,{label:d("text_transform")||"Transform",children:l.jsx(t.Select,{className:"width-full",value:I,onChange:v("textTransform"),getPopupContainer:F,options:[{value:"none",label:"None"},{value:"uppercase",label:"UPPERCASE"},{value:"lowercase",label:"lowercase"},{value:"capitalize",label:"Capitalize"}]})}),l.jsx(Bl,{label:d("text_decoration")||"Decoration",children:l.jsx(t.Select,{className:"width-full",value:A,onChange:v("textDecoration"),getPopupContainer:F,options:[{value:"none",label:"None"},{value:"underline",label:"Underline"},{value:"line-through",label:"Strikethrough"}]})}),l.jsx(Ll,{children:d("border")||"Border"}),l.jsx(Bl,{label:d("border_width")||"Width",children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof L?L:parseInt(String(L||"0"),10)||0,onFocus:e=>e?.target?.select?.(),onChange:e=>v("borderWidth")(Number(e)||0)})}),l.jsx(Bl,{label:d("border_style")||"Style",children:l.jsx(t.Select,{className:"width-full",value:T,onChange:v("borderStyle"),getPopupContainer:F,options:[{value:"solid",label:d("solid")},{value:"dashed",label:d("dashed")},{value:"dotted",label:d("dotted")},{value:"none",label:d("video_border_none")}]})}),l.jsx(Bl,{label:d("border_color"),children:l.jsx(kl,{color:$,setColor:e=>v("borderColor")(e.hex)})}),l.jsx(Bl,{label:d("border_radius"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:c,onFocus:e=>e?.target?.select?.(),onChange:e=>v("borderRadius")(Number(e)||0)})}),l.jsx(Ll,{children:d("shadow")||"Shadow"}),l.jsx(Bl,{label:d("shadow_preset")||"Preset",children:l.jsx(t.Select,{className:"width-full",value:R,onChange:e=>{const t=B(a.data);t.shadowPreset=e,t.styles=t.styles??{},t.styles[i]=t.styles[i]??{},t.styles[i].boxShadow=M[e]??"",w(t)},getPopupContainer:F,options:[{value:"none",label:"None"},{value:"sm",label:"Small"},{value:"md",label:"Medium"},{value:"lg",label:"Large"}]})}),l.jsx(Ll,{children:d("button_padding")}),l.jsx(Bl,{label:d("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:_(a.data.styles,"paddingTop"),paddingRight:_(a.data.styles,"paddingRight"),paddingLeft:_(a.data.styles,"paddingLeft"),paddingBottom:_(a.data.styles,"paddingBottom")},setPadding:x})})]})})(),l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:d("spacing")}),l.jsx(Bl,{label:d("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:_(a.data.contentStyles,"paddingTop"),paddingRight:_(a.data.contentStyles,"paddingRight"),paddingLeft:_(a.data.contentStyles,"paddingLeft"),paddingBottom:_(a.data.contentStyles,"paddingBottom")},setPadding:e=>{const t=B(a.data);t.contentStyles[i]={...t.contentStyles[i],...e},w(t)}})})]})]})},xi=()=>{const{currentItem:a,previewMode:i}=e.useContext($e),{t:r}=Zo(),{findStyleItem:s,colorChange:c,updateItemStyles:d,inputChange:u}=Kl(),p=e=>{const t=B(a.data);t.contentStyles[i]={...t.contentStyles[i],...e},d(t)};return l.jsx("div",{className:"margin-y-30 ee-settings-block-form",children:(()=>{const e=s(a.data.contentStyles,"textAlign"),m=["left","center","right","justify"].includes(e)?e:"center",g=(e=>{if(null==e)return 100;if("number"==typeof e&&Number.isFinite(e))return Math.min(100,Math.max(0,e));const t=String(e).trim();if(/%$/.test(t)){const e=Number(t.replace(/%/,""));return Number.isFinite(e)?Math.min(100,Math.max(0,e)):100}const n=Number.parseFloat(t);return Number.isFinite(n)?Math.min(100,Math.max(0,n)):100})(s(a.data.styles,"width")),h=s(a.data.styles,"borderTopColor"),b=s(a.data.styles,"borderTopWidth"),y=s(a.data.styles,"borderTopStyle"),f=[{label:r("solid"),value:"solid"},{label:r("dotted"),value:"dotted"},{label:r("dashed"),value:"dashed"}];return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:r("divider")}),l.jsx(Bl,{label:r("divider_type"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:y||"solid",onChange:e=>u("borderTopStyle")(e),"aria-label":r("divider_type"),items:f.map(e=>({value:e.value,label:e.label}))})}),l.jsx(Bl,{label:r("height"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof b?b:0,onFocus:e=>e?.target?.select?.(),onChange:e=>u("borderTopWidth")("number"==typeof e?e:0)})}),l.jsx(Bl,{label:r("divider_color"),children:l.jsx(kl,{color:h,setColor:c("borderTopColor")})}),l.jsx(Bl,{label:r("width"),children:l.jsx(t.Slider,{min:0,max:100,value:g,tooltip:{formatter:e=>`${e}%`},onChange:e=>u("width")(`${e}%`)})}),l.jsx(Bl,{label:r("align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:m,onChange:e=>(e=>{const t=B(a.data);t.contentStyles[i]={...t.contentStyles[i],textAlign:e},d(t)})(e),"aria-label":r("align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignJustify,className:"tag-style-size"}),iconOnly:!0}]})}),l.jsx(Ll,{children:r("spacing")}),l.jsx(Bl,{label:r("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:s(a.data.contentStyles,"paddingTop"),paddingRight:s(a.data.contentStyles,"paddingRight"),paddingLeft:s(a.data.contentStyles,"paddingLeft"),paddingBottom:s(a.data.contentStyles,"paddingBottom")},setPadding:p})})]})})()})};function vi(e,t,n,o){const a=Number.parseInt(String(e??""),10);return Number.isNaN(a)?o:Math.min(n,Math.max(t,a))}const wi=()=>{const{currentItem:a}=e.useContext($e),{t:i}=Zo(),{findStyleItem:r,inputChange:s}=Kl(),c=r(a.data.styles,"height"),d="number"==typeof c?c:parseInt(c,10)||16;return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx(Ll,{children:i("spacer")}),l.jsx(Bl,{label:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(n.FontAwesomeIcon,{icon:o.faArrowsAltV,className:"tag-style-size"}),i("height")]}),children:l.jsx(t.InputNumber,{min:0,max:200,step:1,className:"input-width ee-settings-input-affix",addonAfter:"px",value:d,onFocus:e=>e?.target?.select?.(),onChange:e=>s("height")(vi(e,0,200,0)),onBlur:e=>s("height")(vi(e?.target?.value,0,200,0)),onKeyDown:e=>{if("ArrowUp"!==e.key&&"ArrowDown"!==e.key)return;e.preventDefault();const t="ArrowUp"===e.key?1:-1;s("height")(vi(d+t,0,200,0))}})})]})};function Si(e){if(null==e||""===e)return"400";const t=String(e).trim().toLowerCase();if("normal"===t||"regular"===t)return"400";if("bold"===t)return"700";if("bolder"===t)return"700";if("lighter"===t)return"300";if("light"===t)return"300";const n=Number(t);return Number.isNaN(n)?"400":n<=350?"300":n<=500?"400":n<=650?"600":"700"}const ji=new Set(["|","•","—","/","·"," "]);function Ci(e){return[...String(e??"")].filter(e=>ji.has(e)).join("")}const Ni=()=>{const{currentItem:a,previewMode:i,templateData:r}=e.useContext($e),{t:s}=Zo(),{findStyleItem:c,updateItemStyles:d,colorChange:u,inputChange:p}=Kl(),{list:g=[],separator:h=" | "}=a.data;e.useLayoutEffect(()=>{const e=a?.data?.separator,t=Ci(String(e??""));if(String(e??"")!==t){const e=B(a.data);e.separator=t,d(e)}},[a?.id,a?.data,d]);const[b,y]=e.useState(!1),[f,_]=e.useState(null),[k,x]=e.useState({}),v=e.useRef(null),w=()=>document.querySelector(".right-settings")||document.body,S=(e,t)=>{const n=B(a.data);n[e]=t,"list"===e&&(n.useNavigationLinks=!1),d(n)},j=(e,t,n)=>{const o=((e,t,n)=>{const o=String(e??"").trim(),a=`Menu item ${t+1}${n?` (${n})`:""} -> URL`,l=m(o,!1,{allowMailtoTel:!0});return l?"empty"===l?`${a} is empty. Add a destination like 'https://example.com'.`:"blocked_scheme"===l?`${a} ('${o}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===l?`${a} ('${o}') repeats the protocol. Keep one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===l?`${a} ('${o}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===l?`${a} ('${o}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`${a} ('${o}') is invalid. Fix it to a valid URL like 'https://example.com'.`:""})(e,t,n);x(e=>{if(!o&&!e[t])return e;const n={...e};return o?n[t]=o:delete n[t],n})},C=e.useCallback($(e=>{e.preventDefault();const t=v.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const a=f,l=B(g);null==a||a===o||l.length<2||([l[o],l[a]]=[l[a],l[o]],_(o),S("list",l))},50),[f]),N=tn(r),I=on(c(a.data.styles,"fontFamily"),r),A=[{label:s("same_tab"),value:"_self"},{label:s("new_tab"),value:"_blank"}],L=a.data.layoutMode??"nav-only",T=Boolean(a.data.showLogo),R=Boolean(a.data.borderBottom),P=a.data.borderBottomColor??"#e5e7eb",M=a.data.borderBottomWidth??1,F=a.data.mobileLayout??"stack",U=a.data.linkGapPx,D="number"==typeof U&&Number.isFinite(U)?U:0,E=Boolean(a.data.linkUnderline),z=c(a.data.contentStyles,"textAlign"),O=["left","center","right"].includes(z)?z:"center";return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx(Ll,{children:s("menu_layout")||"Menu layout"}),l.jsx(Bl,{label:s("mobile_layout")||"Mobile layout",children:l.jsx(t.Select,{className:"width-full",value:F,onChange:e=>S("mobileLayout",e),getPopupContainer:w,options:[{value:"stack",label:s("stack")||"Stack"},{value:"inline",label:s("inline")||"Inline"}]})}),["logo-left","logo-right","stacked","logo-only"].includes(L)&&l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:s("logo_section")}),l.jsx(Bl,{layout:"toggle",label:s("show_logo"),children:l.jsx(wl,{checked:T,onChange:e=>S("showLogo",e)})}),T?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:s("logo_url")||"Logo URL",children:l.jsx(t.Input,{className:"width-full",placeholder:"https://...",value:a.data.logoSrc??"",onChange:e=>S("logoSrc",e.target.value)})}),l.jsx(Bl,{label:s("logo_text")||"Logo text",children:l.jsx(t.Input,{className:"width-full",placeholder:s("logo_text_placeholder")||"Brand",value:a.data.logoText??"",onChange:e=>S("logoText",e.target.value)})}),l.jsx(Bl,{label:s("logo_alt")||"Alt text",children:l.jsx(t.Input,{className:"width-full",placeholder:"Logo",value:a.data.logoAlt??"",onChange:e=>S("logoAlt",e.target.value)})}),l.jsx(Bl,{label:s("logo_link")||"Logo link",children:l.jsx(t.Input,{className:"width-full",value:a.data.logoHref??"",onChange:e=>S("logoHref",e.target.value),placeholder:s("link_url_placeholder")||"example.com"})}),l.jsx(Bl,{label:s("logo_max_width"),children:l.jsx(t.InputNumber,{min:20,max:400,className:"input-width ee-settings-input-affix",addonAfter:"px",value:a.data.logoMaxWidth??120,onFocus:e=>e?.target?.select?.(),onChange:e=>S("logoMaxWidth",e??120)})})]}):null]}),l.jsx(Ll,{children:s("menu_items")}),l.jsx("div",{ref:v,onDragOver:C,className:"margin-top-12",children:g.map((e,a)=>l.jsx("div",{"data-index":a,draggable:!0,onDragStart:()=>{y(!0),_(a)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),y(!1),_(null)},className:Go("social-link-item","cursor-grab",b&&"social-link-item-drag_start",f===a?"social-link-item-current":"border-transparent"),children:l.jsxs("div",{className:"social-link-item-content ee-menu-item-content",children:[l.jsxs("div",{className:"ee-menu-item-header flex items-center justify-between margin-bottom-8",children:[l.jsxs("div",{className:"flex items-center ee-menu-item-drag-row",children:[l.jsx("span",{className:"social-link-item-drag-handle ee-menu-item-drag-handle","aria-hidden":!0,children:l.jsx(n.FontAwesomeIcon,{icon:o.faGripVertical,className:"social-link-item-drag-handle-icon"})}),l.jsxs("span",{className:"font-semibold",children:[s("menu_item")," ",a+1]})]}),l.jsx("div",{className:"social-link-item-icon social-link-item-icon-slate ee-menu-item-delete",role:"button",tabIndex:0,onClick:()=>S("list",g.filter((e,t)=>t!==a)),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S("list",g.filter((e,t)=>t!==a)))},children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash,className:"social-link-item-icon-svg social-link-item-icon-svg-deep"})})]}),l.jsxs("div",{className:"ee-menu-item-fields ee-settings-stack-flat",children:[l.jsx(Bl,{label:s("label"),children:l.jsx(t.Input,{className:"width-full ee-menu-item-input",value:e.label||"",onChange:e=>S("list",g.map((t,n)=>n===a?{...t,label:e.target.value}:t)),placeholder:s("page")||"Page"})}),l.jsxs(Bl,{label:s("url"),children:[l.jsx(t.Input,{className:"width-full ee-menu-item-input",value:e.url||"",status:k[a]?"error":"",onChange:t=>{const n=t.target.value;S("list",g.map((e,t)=>t===a?{...e,url:n}:e)),k[a]&&j(n,a,e.label)},onBlur:t=>j(t.target.value,a,e.label),placeholder:s("link_url_placeholder")||"example.com"}),k[a]?l.jsx("div",{className:"ee-field-error",role:"alert",children:k[a]}):null]}),l.jsx(Bl,{label:s("target"),children:l.jsx(t.Select,{className:"width-full ee-menu-item-input",value:e.target||"_self",onChange:e=>S("list",g.map((t,n)=>n===a?{...t,target:e}:t)),getPopupContainer:w,children:A.map(e=>l.jsx(t.Select.Option,{value:e.value,children:e.label},e.value))})})]})]})},a))}),l.jsxs("button",{type:"button",className:"menu-add-new-item margin-top-12",onClick:()=>S("list",g.concat({label:s("page")||"Page",url:"",target:"_self"})),children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",s("add_new_item")]}),l.jsx(Ll,{className:"margin-top-18",children:s("menu_styles")}),l.jsx(Bl,{label:s("font_family"),children:l.jsx(t.Select,{className:"width-full ee-font-family-select",value:I,showSearch:!0,optionFilterProp:"label",labelRender:({value:e})=>l.jsx("span",{children:an(e,r)}),onChange:e=>p("fontFamily")(on(e,r)),getPopupContainer:w,options:N})}),l.jsx(Bl,{label:s("font_size"),children:l.jsx(t.InputNumber,{min:8,max:72,className:"input-width ee-settings-input-affix",addonAfter:"px",value:c(a.data.styles,"fontSize"),onFocus:e=>e?.target?.select?.(),onChange:p("fontSize")})}),l.jsx(Bl,{label:s("letter_spacing"),children:l.jsx(t.InputNumber,{className:"input-width ee-settings-input-affix",addonAfter:"px",value:c(a.data.styles,"letterSpacing"),onFocus:e=>e?.target?.select?.(),onChange:p("letterSpacing")})}),l.jsx(Bl,{label:s("text_color"),children:l.jsx(kl,{color:c(a.data.styles,"color"),setColor:u("color")})}),l.jsx(Bl,{label:s("link_color"),children:l.jsx(kl,{color:c(a.data.styles,"linkColor"),setColor:u("linkColor")})}),l.jsx(Bl,{label:s("align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:O,onChange:e=>(e=>{const t=B(a.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]??{},textAlign:e},d(t)})(e),"aria-label":s("align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0}]})}),l.jsx(Bl,{label:s("separator"),hint:s("menu_separator_allowed_hint"),children:l.jsx(t.Input,{className:"width-full ee-menu-separator-input",value:Ci(h),onChange:e=>S("separator",Ci(e.target.value)),placeholder:s("menu_separator_placeholder")})}),l.jsx(Bl,{label:s("menu_link_gap")||"Link spacing",children:l.jsx(t.InputNumber,{min:0,max:96,className:"input-width ee-settings-input-affix",addonAfter:"px",value:D,onFocus:e=>e?.target?.select?.(),onChange:e=>(e=>{const t="number"==typeof e&&Number.isFinite(e)&&e>=0?Math.min(96,e):0,n=B(a.data);n.linkGapPx=t,d(n)})("number"==typeof e?e:0)})}),l.jsx(Bl,{layout:"toggle",label:s("menu_underline_links")||"Underline links",children:l.jsx(wl,{checked:E,onChange:e=>{const t=B(a.data);t.linkUnderline=!!e,d(t)}})}),l.jsx(Bl,{label:s("font_weight")||"Font weight",children:l.jsx(t.Select,{className:"width-full",value:Si(c(a.data.styles,"fontWeight")),onChange:p("fontWeight"),getPopupContainer:w,options:[{value:"300",label:s("font_weight_light")||"Light"},{value:"400",label:s("font_weight_regular")||"Regular"},{value:"600",label:s("font_weight_semibold")||"Semi-bold"},{value:"700",label:s("font_weight_bold")||"Bold"}]})}),l.jsx(Bl,{label:s("text_transform")||"Text transform",children:l.jsx(t.Select,{className:"width-full",value:c(a.data.styles,"textTransform")??"none",onChange:p("textTransform"),getPopupContainer:w,options:[{value:"none",label:"None"},{value:"uppercase",label:"UPPERCASE"},{value:"capitalize",label:"Capitalize"}]})}),l.jsx(Ll,{children:s("border_bottom")||"Border bottom"}),l.jsx(Bl,{layout:"toggle",label:s("show_border_bottom"),children:l.jsx(wl,{checked:R,onChange:e=>S("borderBottom",e)})}),R?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:s("border_color")||"Color",children:l.jsx(kl,{color:P,setColor:({hex:e})=>S("borderBottomColor",e)})}),l.jsx(Bl,{label:s("border_width")||"Width",children:l.jsx(t.InputNumber,{min:1,max:8,className:"input-width ee-settings-input-affix",addonAfter:"px",value:M,onFocus:e=>e?.target?.select?.(),onChange:e=>S("borderBottomWidth",e??1)})})]}):null,l.jsx(Ll,{className:"ee-menu-settings-padding-heading",children:s("padding_settings")}),l.jsx(Bl,{children:l.jsx(Sl,{padding:{paddingTop:c(a.data.contentStyles,"paddingTop"),paddingRight:c(a.data.contentStyles,"paddingRight"),paddingLeft:c(a.data.contentStyles,"paddingLeft"),paddingBottom:c(a.data.contentStyles,"paddingBottom")},setPadding:e=>{const t=B(a.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]??{},...e},d(t)}})})]})},Ii=()=>{const{currentItem:a,previewMode:i,templateData:r,apiConfig:s,bodySettings:c}=e.useContext($e),{t:d}=Zo(),{containerBlock:u,containerType:p,contentIndex:g}=di(),h=u?.columnProducts?.[g]??null,{findStyleItem:b,inputChange:y,updateItemStyles:f}=Kl(),_=e=>{const t=B(a.data);Object.assign(t,e),f(t)},k=e.useRef(null),[x,v]=e.useState(!1),[w,S]=e.useState(""),[j,C]=e.useState(""),N=e.useMemo(()=>({columnIndex:g,columnProduct:h}),[g,h]),I=e.useMemo(()=>Gt(p,r,N),[p,r,N]),{uploadImageFile:A,isConfigured:L}=ti({imageUploadEndpoint:s?.imageUploadEndpoint,headers:s?.headers||{},companyId:s?.companyId,imageUploadQueryParams:s?.imageUploadQueryParams,imageUploadCompanyField:s?.imageUploadCompanyField}),T=e=>{const t=B(a.data);t.contentStyles[i]={...t.contentStyles[i],...e},f(t)};return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[(()=>{const{linkURL:e}=a.data,n=qt(a.data),o=e=>{C((e=>{const t=String(e??"").trim(),n=m(t,!1,{allowMailtoTel:!0});return n?"empty"===n?"Image -> Link URL is empty. Add a destination like 'https://example.com' or disable link action.":"blocked_scheme"===n?`Image -> Link URL ('${t}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===n?`Image -> Link URL ('${t}') repeats the protocol. Keep only one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===n?`Image -> Link URL ('${t}') is missing a valid hostname. Use a full URL like 'https://example.com'.`:"invalid_protocol"===n?`Image -> Link URL ('${t}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`Image -> Link URL ('${t}') is invalid. Fix the URL format, for example 'https://example.com'.`:""})(e))};return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:d("image_action")}),l.jsx(Bl,{label:d("action_type"),children:l.jsxs("div",{className:"ee-settings-row ee-padding-link-sides-row",children:[l.jsx("span",{className:Go("link-tag",!n&&"ee-image-link-tag-inactive"),children:d("link")}),l.jsx(wl,{checked:n,onChange:e=>{const t=B(a);t.data.linkEnabled=Boolean(e),f(t.data)}})]})}),n?l.jsx(Bl,{label:d("link_url"),children:l.jsxs(l.Fragment,{children:[l.jsx(t.Input,{value:e??"",onChange:e=>{const t=e.target.value??"",n=B(a);n.data.linkURL=t,f(n.data),j&&o(t)},onBlur:e=>o(e.target.value),status:j?"error":"",placeholder:d("link_url_placeholder"),className:"width-full"}),j?l.jsx("div",{className:"ee-field-error",role:"alert",children:j}):null]})}):null]})})(),(()=>{const{src:e,alt:i}=a.data,s="string"==typeof e&&/^\{\{\w+\}\}$/.test(e.trim())?String(e).replace(/\{\{|\}\}/g,"").trim():"",c=r&&s?Ft(r,s,N):null,u=null==c||String(c).startsWith("{{")?e||"":c,p=e=>{S((e=>{const t=String(e??"").trim();if(/^\{\{\w+\}\}$/.test(t))return"";const n=m(t,!1,{allowMailtoTel:!1});return n?"empty"===n?"Image -> Image URL is empty. Add an image URL like 'https://example.com/image.jpg' or choose a variable.":"blocked_scheme"===n?`Image -> Image URL ('${t}') uses a blocked protocol. Use only http:// or https:// image URLs.`:"duplicate_protocol"===n?`Image -> Image URL ('${t}') repeats the protocol. Keep only one protocol, e.g. 'https://example.com/image.jpg'.`:"missing_hostname_dot"===n?`Image -> Image URL ('${t}') is missing a valid hostname. Use a full URL like 'https://example.com/image.jpg'.`:"invalid_protocol"===n?`Image -> Image URL ('${t}') has an unsupported protocol. Use only http:// or https:// image URLs.`:`Image -> Image URL ('${t}') is invalid. Fix the URL format, for example 'https://example.com/image.jpg'.`:""})(e))},g=e=>t=>{const n=B(a),o=t.target.value;n.data[e]=o,f(n.data),"src"===e&&w&&p(o)},h=e=>{const t=B(a);t.data.src=e,f(t.data)},b=()=>{k.current?.click()};return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:d("image")}),l.jsx(Bl,{label:d("image_upload"),children:l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:k,type:"file",accept:Ql,className:"ee-image-upload-input-hidden",onChange:async e=>{const n=e.target.files?.[0];if(!n)return;const o=ei(n);if("type"===o)return t.message.error(d("image_upload_invalid_type")||"Use PNG, JPEG, GIF, SVG, or WebP."),void(e.target.value="");if("size"===o)return t.message.error(d("image_file_too_large")),void(e.target.value="");if(!L)return t.message.error(d("image_upload_not_configured")||"Image upload not configured"),console.warn("[ImageStyleSettings] Image upload endpoint not configured"),void(e.target.value="");v(!0);try{const e=await A(n);e?(h(cn(e)),t.message.success(d("image_uploaded")||"Image uploaded successfully")):t.message.error(d("image_upload_failed")||"Failed to upload image")}catch(e){console.error("[ImageStyleSettings] Upload error:",e);const n="string"==typeof e?.message&&e.message.trim()?e.message.trim():null;t.message.error(n||d("image_upload_error")||"Error uploading image")}finally{v(!1),e.target.value=""}},disabled:x}),l.jsx(t.Spin,{spinning:x,children:l.jsxs("div",{role:"button",tabIndex:0,className:"ee-image-upload-trigger",onClick:b,onDrop:async e=>{e.preventDefault(),e.stopPropagation();const n=e.dataTransfer?.files?.[0];if(!n)return;const o=ei(n);if("type"!==o)if("size"!==o){if(!L)return t.message.error(d("image_upload_not_configured")||"Image upload not configured"),void console.warn("[ImageStyleSettings] Image upload endpoint not configured");v(!0);try{const e=await A(n);e?(h(cn(e)),t.message.success(d("image_uploaded")||"Image uploaded successfully")):t.message.error(d("image_upload_failed")||"Failed to upload image")}catch(e){console.error("[ImageStyleSettings] Upload error:",e);const n="string"==typeof e?.message&&e.message.trim()?e.message.trim():null;t.message.error(n||d("image_upload_error")||"Error uploading image")}finally{v(!1),k.current.value=""}}else t.message.error(d("image_file_too_large"));else t.message.error(d("image_upload_invalid_type")||"Use PNG, JPEG, GIF, SVG, or WebP.")},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},style:{opacity:x?.6:1,cursor:x?"not-allowed":"pointer"},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faCloudUploadAlt,className:"ee-image-upload-icon"}),l.jsx("span",{children:x?d("uploading")||"Uploading...":d("image_upload_click")})]})}),l.jsxs("div",{className:"ee-image-toolbar",children:[l.jsxs("button",{type:"button",className:"ee-image-toolbar-btn",onClick:b,disabled:x,children:[l.jsx(n.FontAwesomeIcon,{icon:o.faSyncAlt}),l.jsx("span",{children:d("replace")||"Replace"})]}),l.jsxs("button",{type:"button",className:"ee-image-toolbar-btn ee-image-toolbar-btn--danger",onClick:()=>_({src:""}),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faTrash}),l.jsx("span",{children:d("delete")||"Delete"})]})]}),l.jsx("div",{className:"ee-image-upload-hint",children:d("image_upload_file_hint")||"PNG, JPEG, GIF, SVG, WebP · max 10 MB"})]})}),I.length>0?l.jsx(Bl,{label:d("image_source_variable"),children:l.jsx(t.Select,{className:"ee-variable-select width-full",placeholder:d("image_source_variable"),allowClear:!0,value:"string"==typeof e&&/^\{\{\w+\}\}$/.test(String(e).trim())?String(e).trim():void 0,onChange:e=>h(e??""),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:I.map(e=>({value:e.value,label:d(e.labelKey)}))})}):null,l.jsx(Bl,{label:d("image_url"),children:l.jsxs(l.Fragment,{children:[l.jsx(t.Input,{className:"width-full",value:u,onChange:g("src"),onBlur:e=>p(e.target.value),status:w?"error":"",placeholder:"https://..."}),w?l.jsx("div",{className:"ee-field-error",role:"alert",children:w}):null]})}),l.jsx(Bl,{label:d("image_alt"),children:l.jsx(t.Input,{className:"width-full",value:i||"",onChange:g("alt"),placeholder:d("image_alt_placeholder")})})]})})(),(()=>{const e=a.data,i=c?.styles?.fontFamily??"sans-serif",s=Boolean(e.textOverlayEnabled),u=e.overlayPosition??"bc",p=Boolean(e.scrimEnabled),m=Boolean(e.textShadowEnabled),g=e.overlayMaxWidth??100,h=e.overlayItemGap??8,b=Array.isArray(e.overlayItems)?e.overlayItems:[],y=[{value:"eyebrow",label:"Eyebrow",defaultSize:11},{value:"h1",label:"H1",defaultSize:32},{value:"h2",label:"H2",defaultSize:24},{value:"h3",label:"H3",defaultSize:18},{value:"subtitle",label:"Subtitle",defaultSize:16},{value:"body",label:"Body",defaultSize:14}],f=(e,t)=>{const n=[...b];n[e]={...n[e],...t},_({overlayItems:n})},k=(e,t)=>{const n=[...b],o="up"===t?e-1:e+1;o<0||o>=n.length||([n[e],n[o]]=[n[o],n[e]],_({overlayItems:n}))},x=(e,t,o,a)=>l.jsx("button",{type:"button",disabled:t,onClick:e,style:{width:22,height:22,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"1px solid rgba(255,255,255,0.12)",borderRadius:3,cursor:t?"not-allowed":"pointer",color:a?"#f87070":"var(--ee-muted-foreground)",opacity:t?.35:1,padding:0,flexShrink:0},children:l.jsx(n.FontAwesomeIcon,{icon:o,style:{fontSize:9}})});return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:l.jsxs("span",{className:"ee-container-bg-heading-inline",children:[d("image_text_overlay"),l.jsx(t.Tooltip,{title:l.jsxs("div",{children:[l.jsx("p",{style:{marginBottom:8},children:d("image_text_overlay_tip")}),l.jsx("p",{style:{margin:0,opacity:.85},children:d("image_text_overlay_container_tip")})]}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:l.jsx("span",{className:"ee-help-icon ee-container-bg-section-help",tabIndex:0,"aria-label":d("image_text_overlay"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]})}),l.jsx(Bl,{layout:"toggle",label:d("image_text_overlay_enable"),children:l.jsx(wl,{checked:s,onChange:t=>{if(t&&!e.textOverlayEnabled){const e=b.length>0?b:[{kind:"eyebrow",text:"EYEBROW TEXT",color:"#d8fe91",fontSize:11,fontFamily:i},{kind:"h1",text:"Heading Text",color:"#ffffff",fontSize:32,fontFamily:i},{kind:"body",text:"Body copy goes here.",color:"#ffffff",fontSize:14,fontFamily:i}];_({textOverlayEnabled:!0,overlayItems:e})}else _({textOverlayEnabled:t})}})}),s?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:d("add_overlay_item")||"Add element",children:l.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:y.map(e=>l.jsxs("button",{type:"button",onClick:()=>(e=>{const t=y.find(t=>t.value===e)||y[5],n=[...b,{kind:e,text:"",color:"#ffffff",fontSize:t.defaultSize,fontFamily:i}];_({overlayItems:n})})(e.value),style:{padding:"4px 10px",background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:4,color:"var(--ee-foreground)",cursor:"pointer",fontSize:11,fontFamily:"inherit"},children:["+ ",e.label]},e.value))})}),b.length>0&&l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:12},children:b.map((e,n)=>l.jsxs("div",{style:{background:"rgba(255,255,255,0.04)",border:"1px solid var(--ee-border)",borderRadius:6,padding:"10px 12px"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:8},children:[x(()=>k(n,"up"),0===n,o.faChevronUp,!1),x(()=>k(n,"down"),n===b.length-1,o.faChevronDown,!1),l.jsx(t.Select,{size:"small",style:{flex:1},value:e.kind||"body",onChange:e=>f(n,{kind:e}),options:y.map(e=>({value:e.value,label:e.label})),getPopupContainer:()=>document.querySelector(".right-settings")||document.body}),x(()=>(e=>{_({overlayItems:b.filter((t,n)=>n!==e)})})(n),!1,o.faTrash,!0)]}),l.jsx(t.Input,{size:"small",value:e.text||"",placeholder:"Text content...",onChange:e=>f(n,{text:e.target.value}),style:{marginBottom:8}}),l.jsxs("div",{style:{marginBottom:8},children:[l.jsx("div",{style:{fontSize:11,color:"var(--ee-muted-foreground)",marginBottom:4},children:d("font_family")}),l.jsx(t.Select,{size:"small",className:"width-full ee-font-family-select",showSearch:!0,optionFilterProp:"label",value:on(null!=e.fontFamily&&""!==String(e.fontFamily).trim()?e.fontFamily:i,r),onChange:e=>f(n,{fontFamily:on(e,r)}),labelRender:({value:e})=>l.jsx("span",{children:an(e,r)}),options:tn(r),getPopupContainer:()=>document.querySelector(".right-settings")||document.body})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[l.jsx(kl,{color:e.color||"#ffffff",setColor:({hex:e})=>f(n,{color:e}),fallbackColor:"#ffffff"}),l.jsx(t.InputNumber,{size:"small",min:8,max:96,addonAfter:"px",value:e.fontSize||16,style:{flex:1},onChange:e=>f(n,{fontSize:"number"==typeof e?e:16})})]})]},n))}),l.jsx(Bl,{label:d("item_gap")||"Item gap",children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:h,onChange:e=>_({overlayItemGap:"number"==typeof e?e:8})})}),l.jsx(Bl,{label:d("image_overlay_position"),children:l.jsx("div",{className:"ee-image-overlay-position-grid",role:"group","aria-label":d("image_overlay_position"),children:hn.map(e=>l.jsx("button",{type:"button",className:Go("ee-image-overlay-position-cell",u===e&&"ee-image-overlay-position-cell-active"),title:d(`image_overlay_pos_${e}`),"aria-pressed":u===e,onClick:()=>_({overlayPosition:e}),children:l.jsx("span",{className:"ee-image-overlay-dot","aria-hidden":!0})},e))})}),l.jsx(Bl,{label:d("overlay_max_width")||"Max width",children:l.jsx(t.InputNumber,{min:20,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:g,onChange:e=>_({overlayMaxWidth:"number"==typeof e?e:100})})}),l.jsx(Bl,{label:d("image_overlay_box_bg"),children:l.jsx(t.Input,{className:"width-full",placeholder:"rgba(0,0,0,0.35)",value:e.overlayBoxBackground??"",onChange:e=>_({overlayBoxBackground:e.target.value})})}),l.jsx(Bl,{label:d("image_overlay_padding"),children:l.jsx(t.InputNumber,{min:0,max:120,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof e.overlayPadding?e.overlayPadding:16,onChange:e=>_({overlayPadding:"number"==typeof e?e:16})})}),l.jsx(Bl,{layout:"toggle",label:d("scrim")||"Scrim",children:l.jsx(wl,{checked:p,onChange:e=>_({scrimEnabled:e})})}),l.jsx(Bl,{layout:"toggle",label:d("text_shadow")||"Text shadow",children:l.jsx(wl,{checked:m,onChange:e=>_({textShadowEnabled:e})})})]}):null]})})(),(()=>{const e=b(a.data.styles,"width"),r=b(a.data.styles,"height"),s=b(a.data.styles,"borderRadius"),c="number"==typeof s?s:parseInt(String(s||"").replace("px",""),10)||0,u=b(a.data.contentStyles,"textAlign"),p=Boolean(a.data.fillColumn);return l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:d("layout")}),l.jsx(Bl,{layout:"toggle",label:d("fill_column")||"Fill column",children:l.jsx(wl,{checked:p,onChange:e=>_({fillColumn:e})})}),l.jsx(Bl,{layout:"toggle",label:d("auto_width"),children:l.jsx(wl,{checked:"auto"===e,onChange:()=>{const t="auto"===e?"100%":"auto";y("width")(t)}})}),"auto"!==e?l.jsx(Bl,{label:d("width"),children:l.jsx(t.Slider,{value:Number(String(e).replace("%","")),onChange:e=>y("width")(e+"%")})}):null,l.jsx(Bl,{label:d("height")||"Height",children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",placeholder:"auto",value:r&&parseInt(String(r).replace("px",""),10)||void 0,onChange:e=>y("height")(e?`${e}px`:"auto")})}),l.jsx(Bl,{label:d("border_radius"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:c,onFocus:e=>e?.target?.select?.(),onChange:e=>y("borderRadius")(Number(e)||0)})}),l.jsx(Bl,{label:d("align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:u||"center",onChange:e=>(e=>{const t=B(a.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]||(t.contentStyles[i]={}),t.contentStyles[i]={...t.contentStyles[i],textAlign:e},"desktop"!==i&&(t.contentStyles.desktop||(t.contentStyles.desktop={}),t.contentStyles.desktop={...t.contentStyles.desktop,textAlign:e}),f(t)})(e),"aria-label":d("align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignJustify,className:"tag-style-size"}),iconOnly:!0}]})}),l.jsx(Ll,{children:d("spacing")}),l.jsx(Bl,{label:d("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:b(a.data.contentStyles,"paddingTop"),paddingRight:b(a.data.contentStyles,"paddingRight"),paddingLeft:b(a.data.contentStyles,"paddingLeft"),paddingBottom:b(a.data.contentStyles,"paddingBottom")},setPadding:T})})]})})()]})},Ai=()=>{const{currentItem:a,previewMode:i}=e.useContext($e),{t:r}=Zo(),{findStyleItem:s,updateItemStyles:c}=Kl(),d=e=>{const t=B(a.data);e(t),c(t)},u=e=>{const t=a.data.videoArea||{},n="desktop"===i?{}:t.desktop||{};return t[i]?.[e]??n[e]},p=e=>d(t=>{t.videoArea||(t.videoArea={desktop:{},mobile:{}}),t.videoArea[i]={...t.videoArea[i]||{},...e}}),m=s(a.data.contentStyles,"textAlign"),g=["left","center","right"].includes(m)?m:"center",h=l.jsxs("span",{className:"ee-container-bg-heading-inline",children:[r("video_url"),l.jsx(t.Tooltip,{title:r("video_export_note"),children:l.jsx("span",{className:"ee-help-icon ee-container-bg-section-help",tabIndex:0,"aria-label":r("video_export_note"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]});return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx(Ll,{children:r("video_tab_display")}),l.jsx(Bl,{label:h,children:l.jsx(t.Input,{className:"width-full",value:a.data.videoUrl??"",onChange:e=>d(t=>{t.videoUrl=e.target.value}),placeholder:"https://www.youtube.com/watch?v=..."})}),l.jsx(Bl,{label:r("video_thumbnail_url"),children:l.jsx(t.Input,{className:"width-full",value:a.data.thumbnailUrl??"",onChange:e=>d(t=>{t.thumbnailUrl=e.target.value}),placeholder:r("video_thumbnail_url_placeholder")})}),l.jsx(Ll,{children:r("video_thumbnail_layout")}),l.jsx(Bl,{label:r("video_width"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix ee-video-dim-field width-full",placeholder:"auto",addonAfter:"px",value:"number"==typeof s(a.data.styles,"width")?s(a.data.styles,"width"):void 0,onChange:e=>d(t=>{t.styles=t.styles||{desktop:{},mobile:{}},t.styles[i]={...t.styles[i]||{},width:null==e||""===e?"auto":e}})})}),l.jsx(Bl,{label:r("video_height"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix ee-video-dim-field width-full",placeholder:"auto",addonAfter:"px",value:"number"==typeof s(a.data.styles,"height")?s(a.data.styles,"height"):void 0,onChange:e=>d(t=>{t.styles=t.styles||{desktop:{},mobile:{}},t.styles[i]={...t.styles[i]||{},height:null==e||""===e?"auto":e}})})}),l.jsx(Bl,{label:r("alignment"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:g,onChange:e=>d(t=>{t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]||{},textAlign:e}}),"aria-label":r("alignment"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0}]})}),l.jsx(Bl,{layout:"toggle",label:r("video_fill_column"),children:l.jsx(wl,{checked:Boolean(s(a.data.styles,"fillColumn")),onChange:e=>d(t=>{t.styles=t.styles||{desktop:{},mobile:{}},t.styles[i]={...t.styles[i]||{},fillColumn:e}})})}),l.jsx(Bl,{layout:"toggle",label:r("video_fill_column_mobile"),children:l.jsx(wl,{checked:Boolean(s(a.data.styles,"fillColumnMobile")),onChange:e=>d(t=>{t.styles=t.styles||{desktop:{},mobile:{}},t.styles[i]={...t.styles[i]||{},fillColumnMobile:e}})})}),l.jsx(Ll,{children:r("video_area_section")}),l.jsx(Bl,{label:r("label_padding"),children:l.jsx(Sl,{setPadding:e=>d(t=>{t.videoArea||(t.videoArea={desktop:{},mobile:{}}),t.videoArea[i]={...t.videoArea[i]||{},...e}}),padding:{paddingTop:u("paddingTop")??0,paddingBottom:u("paddingBottom")??0,paddingLeft:u("paddingLeft")??0,paddingRight:u("paddingRight")??0}})}),l.jsx(Bl,{label:r("background_color"),children:l.jsx(kl,{color:"string"==typeof u("backgroundColor")&&u("backgroundColor").replace(/^#/,"")||"transparent",setColor:({hex:e})=>p({backgroundColor:e})})}),l.jsx(Bl,{label:r("divider_type"),children:l.jsxs(t.Select,{className:"width-full",value:u("borderStyle")||"solid",onChange:e=>p({borderStyle:e}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:[l.jsx(t.Select.Option,{value:"none",children:r("video_border_none")}),l.jsx(t.Select.Option,{value:"solid",children:r("solid")}),l.jsx(t.Select.Option,{value:"dashed",children:r("dashed")})]})}),l.jsx(Bl,{label:r("border_width"),children:l.jsx(t.InputNumber,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:u("borderWidth")??0,onFocus:e=>e?.target?.select?.(),onChange:e=>p({borderWidth:null==e?0:e})})}),l.jsx(Bl,{label:r("border_color"),children:l.jsx(kl,{color:(u("borderColor")||"#cccccc").replace(/^#/,""),setColor:({hex:e})=>p({borderColor:e})})}),l.jsx(Ll,{children:r("video_block_section")}),l.jsx(Bl,{label:r("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:s(a.data.contentStyles,"paddingTop")??0,paddingBottom:s(a.data.contentStyles,"paddingBottom")??0,paddingLeft:s(a.data.contentStyles,"paddingLeft")??0,paddingRight:s(a.data.contentStyles,"paddingRight")??0},setPadding:e=>d(t=>{t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]||{},...e}})})}),l.jsx(Bl,{label:r("background_color"),children:l.jsx(kl,{color:(s(a.data.contentStyles,"backgroundColor")||"").replace(/^#/,"")||"transparent",setColor:({hex:e})=>d(t=>{t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]||{},backgroundColor:e}})})})]})},Li=()=>{const{currentItem:n}=e.useContext($e),{t:o}=Zo(),{findStyleItem:a,cardItemElement:i,updateItemStyles:r}=Kl(),{src:s,alt:c,linkURL:d}=n.data,u=a(n.data.styles,"width")??64,p=a(n.data.styles,"borderRadius"),m="50%"===p?50:parseInt(String(p).replace("px",""),10)||0;return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx("div",{className:"right-setting-block-item-title",children:o("avatar_image")}),i(o("image_url"),l.jsx(t.Input,{value:s,onChange:e=>{const t=B(n.data);t.src=e.target.value??"",r(t)}})),i(o("image_alt"),l.jsx(t.Input,{value:c,onChange:e=>{const t=B(n.data);t.alt=e.target.value??"",r(t)},placeholder:"Avatar"})),i(o("link_url"),l.jsx(t.Input,{value:d,onChange:e=>{const t=B(n.data);t.linkURL=e.target.value??"",r(t)},placeholder:o("link_url_placeholder")})),l.jsx("div",{className:"right-setting-block-item-title margin-top-18",children:o("image_styles")}),i(o("width"),l.jsx(t.InputNumber,{min:16,max:256,value:"number"==typeof u?u:64,onChange:e=>{const t=B(n.data);t.styles.desktop||(t.styles.desktop={}),t.styles.desktop.width=e,r(t)},addonAfter:"px"})),i(o("avatar_border_radius"),l.jsx(t.InputNumber,{min:0,max:50,value:m,onChange:e=>{const t=B(n.data);t.styles.desktop||(t.styles.desktop={}),t.styles.desktop.borderRadius=50===e?"50%":`${e}px`,r(t)},addonAfter:50===m?"%":"px"})),l.jsx("div",{className:"right-setting-block-item-title margin-top-18",children:o("padding_settings")}),l.jsx(Sl,{padding:{paddingTop:a(n.data.contentStyles,"paddingTop"),paddingRight:a(n.data.contentStyles,"paddingRight"),paddingLeft:a(n.data.contentStyles,"paddingLeft"),paddingBottom:a(n.data.contentStyles,"paddingBottom")},setPadding:e=>{const t=B(n.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles.desktop={...t.contentStyles.desktop,...e},r(t)}})]})},Ti="__ee_social_custom__";function Bi({preset:e,settingsPanelIconColor:t,t:n}){const{src:o,style:a}=L(e,t,22);return l.jsxs("span",{className:"ee-social-add-menu-item",children:[o?l.jsx("img",{src:o,alt:"",className:"ee-social-add-menu-icon",style:a,draggable:!1}):null,l.jsx("span",{children:g(e)?n("social_platform_x"):e.title})]})}function $i(e,t){const n=String(e?.image||"").trim(),o=String(t?.image||"").trim();if(n&&o&&n===o)return!0;const a=String(e?.title||"").trim().toLowerCase(),l=String(t?.title||"").trim().toLowerCase();return Boolean(a&&l&&a===l)}const Ri={facebook:"social_link_placeholder_facebook",linkedin:"social_link_placeholder_linkedin",instagram:"social_link_placeholder_instagram",tiktok:"social_link_placeholder_tiktok",youtube:"social_link_placeholder_youtube",pinterest:"social_link_placeholder_pinterest"};function Pi(e,t){if(g(e))return t("social_link_placeholder_x");const n=String(e?.title||"").trim().toLowerCase(),o=Ri[n];return t(o||"social_link_placeholder_generic")}function Mi({blockNode:a,onUpdateBlock:i,previewMode:r,findStyleItem:s,apiConfig:c,templateData:d,embedded:u=!1}){const{t:p}=Zo(),h=e.useMemo(()=>Array.isArray(a.list)?a.list:[],[a.list]),[y,_]=e.useState(!1),[k,v]=e.useState(null),[w,S]=e.useState({}),[j,C]=e.useState(null),N=e.useRef(null),I=e.useRef(null),[A,T]=e.useState(null),[R,M]=e.useState(null),{uploadImageFile:F,isConfigured:U}=ti({imageUploadEndpoint:c?.imageUploadEndpoint,headers:c?.headers||{},companyId:c?.companyId,imageUploadQueryParams:c?.imageUploadQueryParams,imageUploadCompanyField:c?.imageUploadCompanyField}),D=[{image:x("facebook"),title:"Facebook",linkURL:""},{image:x("linkedin"),title:"LinkedIn",linkURL:""},{image:x("instagram"),title:"Instagram",linkURL:""},{image:x("tiktok"),title:"TikTok",linkURL:""},{image:x("x"),title:"X",linkURL:""},{image:x("youtube"),title:"YouTube",linkURL:""},{image:x("pinterest"),title:"Pinterest",linkURL:""}];e.useEffect(()=>{null!=j&&j>=h.length&&C(h.length?h.length-1:null)},[j,h.length]);const E=(e,t)=>{const n=B(a),o=function(e){if(!Array.isArray(e))return e;const t=[];for(const n of e)t.some(e=>$i(e,n))||t.push(n);return t}(t);n[e]=o,n.useCompanySocialLinks=!1,i(n)},z=(e,t)=>{E("list",h.map((n,o)=>o===e?{...n,...t}:n))},O=(e,t,n)=>{const o=((e,t,n)=>{const o=String(e??"").trim(),a=`Social links -> ${n||`Item ${t+1}`} URL`,l=m(o,!1,{allowMailtoTel:!1});return l?"empty"===l?`${a} is empty. Add a profile URL like 'https://example.com'.`:"blocked_scheme"===l?`${a} ('${o}') uses a blocked protocol. Use only http:// or https:// URLs.`:"duplicate_protocol"===l?`${a} ('${o}') repeats the protocol. Keep one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===l?`${a} ('${o}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===l?`${a} ('${o}') has an unsupported protocol. Use only http:// or https:// URLs.`:`${a} ('${o}') is invalid. Fix it to a valid URL like 'https://example.com'.`:""})(e,t,n);S(e=>{if(!o&&!e[t])return e;const n={...e};return o?n[t]=o:delete n[t],n})},W=e.useCallback($(e=>{e.preventDefault();const t=N.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const a=k,l=B(h);a!==o&&([l[o],l[a]]=[l[a],l[o]],v(o),E("list",l),C(e=>e===a?o:e===o?a:e))},50),[k,h,u]),H=()=>document.querySelector(".right-settings")||document.body,K=s(a.contentStyles,"textAlign"),V=["left","center","right","justify"].includes(K)?K:"center",G=s(a.contentStyles,"columnGapPx"),q="number"==typeof G&&Number.isFinite(G)&&G>=0?G:8,J=function(e){if(e?.iconSize&&null!=f[e.iconSize])return e.iconSize;const t=Number(e?.imageWidth);if(!Number.isFinite(t)||t<=0)return"medium";let n="medium",o=1/0;for(const[e,a]of Object.entries(f)){const l=Math.abs(t-a);l<o&&(o=l,n=e)}return n}(a),Y=b(a.iconColor),X="default"===Y?"default":"white",Z=Boolean(a.showTextLabel),Q=e.useMemo(()=>[{value:"small",label:p("icon_size_small")},{value:"medium",label:p("icon_size_medium")},{value:"large",label:p("icon_size_large")}],[p]),ee=D.filter(e=>!h.some(t=>$i(t,e))),te=[...D.map(e=>({value:e.title,label:g(e)?p("social_platform_x"):e.title})),{value:Ti,label:p("social_platform_custom")}],ne=[{value:"default",label:p("icon_color_default")},{value:"white",label:p("icon_color_white")},{value:"black",label:p("icon_color_black")},{value:"gray",label:p("icon_color_gray")}],oe=[...ee.map(e=>({key:e.title+e.image,label:l.jsx(Bi,{preset:e,settingsPanelIconColor:X,t:p}),onClick:()=>{E("list",h.concat({...e,id:P()})),C(h.length)}})),{key:"__add_custom_social_row__",label:l.jsxs("span",{className:"ee-social-add-menu-item ee-social-add-menu-item--custom",children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"}),l.jsx("span",{children:p("social_platform_custom")})]}),onClick:()=>{E("list",h.concat({id:P(),image:"",title:"",linkURL:""})),C(h.length)}}];return l.jsxs("div",{className:Go("ee-settings-block-form ee-social-link-settings",!u&&"margin-y-30"),children:[u?null:l.jsx(Ll,{className:"ee-social-link-settings-section",children:p("social_settings_icons")}),l.jsxs("div",{ref:N,onDragOver:W,className:"ee-social-link-icons-list",children:[l.jsx("input",{ref:I,type:"file",accept:Ql,className:"ee-image-upload-input-hidden",onChange:async e=>{const n=e.target.files?.[0];e.target.value="";const o=A;if(T(null),null==n||null==o)return;const a=ei(n);if("type"!==a)if("size"!==a){M(o);try{const e=await F(n);e?(z(o,{image:cn(e)}),t.message.success(p("image_uploaded"))):t.message.error(p("image_upload_failed"))}catch(e){t.message.error(p("image_upload_error"))}finally{M(null)}}else t.message.error(p("image_file_too_large"));else t.message.error(p("image_upload_invalid_type"))}}),h.map((e,a)=>{const{title:i,linkURL:r}=e,s=g(e),c=function(e,t){const n=String(e?.image||"").trim(),o=t.find(e=>e.image===n);if(o)return o;if(g(e))return t.find(e=>g(e))??null;const a=String(e?.title||"").trim();return a?t.find(e=>e.title===a)??null:null}(e,D),d=!c,u=d&&!String(i||"").trim()?p("social_platform_custom"):s?p("social_platform_x"):i,m=d&&!String(i||"").trim()?p("social_platform_custom"):s?p("social_platform_x_alt"):i,b=L(e,X,22),f=L(e,X,28),x=c?c.title:Ti,S=j===a;return l.jsx("div",{"data-index":a,draggable:!0,onDragStart:()=>{_(!0),v(a)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),_(!1),v(null)},className:Go("social-link-item","cursor-grab",y&&"social-link-item-drag_start",k===a?"social-link-item-current":"border-transparent"),children:l.jsxs("div",{className:Go("social-link-item-content","ee-menu-item-content","ee-social-link-row-shell"),children:[l.jsxs("div",{className:"ee-social-link-row-header",children:[l.jsx("span",{className:"social-link-item-drag-handle","aria-hidden":!0,children:l.jsx(n.FontAwesomeIcon,{icon:o.faGripVertical,className:"social-link-item-drag-handle-icon"})}),b.src?l.jsx("img",{src:b.src,alt:m,className:"social-link-item-img",style:b.style,draggable:!1}):l.jsx("div",{className:"social-link-item-img ee-social-row-icon-placeholder","aria-hidden":!0}),l.jsx("div",{className:"ee-social-link-row-header-main",children:l.jsxs("div",{className:"social-link-platform-title-wrap ee-social-link-row-title-wrap",children:[l.jsx("div",{className:"font-semibold ee-social-link-row-primary-title",children:u}),s?l.jsx("div",{className:"social-link-platform-former-name",children:p("social_platform_formerly_twitter")}):null]})}),l.jsxs("div",{className:"ee-social-link-row-tools",children:[l.jsx("button",{type:"button",className:"ee-social-link-row-icon-btn","aria-expanded":S,"aria-label":p(S?"collapse":"expand"),onClick:e=>{e.stopPropagation(),(e=>{C(t=>t===e?null:e)})(a)},children:l.jsx(n.FontAwesomeIcon,{icon:S?o.faChevronUp:o.faChevronDown})}),l.jsx("button",{type:"button",className:"ee-social-link-row-icon-btn ee-social-link-row-icon-btn-danger","aria-label":p("delete"),onClick:e=>{e.stopPropagation(),E("list",h.filter((e,t)=>t!==a)),C(e=>e===a?null:null!=e&&e>a?e-1:e)},children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash,className:"social-link-item-icon-svg"})})]})]}),S?l.jsxs("div",{className:"ee-social-link-row-detail",children:[l.jsx(Bl,{label:p("social_platform_field"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:x,options:te,getPopupContainer:H,onChange:e=>{if(e===Ti)return void z(a,{title:"",image:""});const t=D.find(t=>t.title===e);t&&z(a,{image:t.image,title:t.title})}})}),l.jsx(Bl,{label:p("social_icon_label_field"),children:l.jsx(t.Input,{className:"width-full",value:i||"",placeholder:u,onChange:e=>z(a,{title:e.target.value})})}),l.jsxs(Bl,{label:p("url"),children:[l.jsx(t.Input,{className:"width-full",placeholder:Pi(e,p),value:r||"",status:w[a]?"error":"",onChange:e=>{const t=e.target.value;E("list",h.map((e,n)=>n===a?{...e,linkURL:t}:e)),w[a]&&O(t,a,u)},onBlur:e=>O(e.target.value,a,u)}),w[a]?l.jsx("div",{className:"ee-field-error",role:"alert",children:w[a]}):null]}),l.jsx(Bl,{label:p("social_custom_icon"),children:l.jsxs("div",{className:"ee-social-custom-icon-row",children:[l.jsx("div",{className:"ee-social-custom-icon-preview",children:f.src?l.jsx("img",{src:f.src,alt:"",style:f.style,draggable:!1}):l.jsx("span",{className:"ee-social-custom-icon-preview-empty","aria-hidden":!0})}),l.jsx("button",{type:"button",className:"menu-add-new-item ee-social-custom-upload-btn",disabled:!U||R===a,onClick:()=>(e=>{U?(T(e),requestAnimationFrame(()=>I.current?.click?.())):t.message.error(p("image_upload_not_configured"))})(a),children:p(R===a?"uploading":"image_upload")})]})})]}):null]})},e.id??`${e.image??""}-${a}`)})]}),u?null:l.jsx(t.Dropdown,{overlayClassName:"ee-social-add-platform-dropdown",menu:{items:oe},trigger:["click"],getPopupContainer:H,children:l.jsxs("button",{type:"button",className:"menu-add-new-item margin-top-12",children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",p("social_add_icon")]})}),l.jsx(Ll,{className:"ee-social-link-settings-section ee-social-link-settings-style-heading",children:p("social_settings_style")}),l.jsx(Ll,{className:"ee-social-link-settings-subsection",children:p("icon_styles")}),l.jsx(Bl,{label:p("icon_size"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:J,onChange:e=>{const t=B(a);t.iconSize=e,t.imageWidth=f[e]??32,t.iconSizePx=null,i(t)},getPopupContainer:H,options:Q})}),l.jsx(Bl,{label:p("icon_color"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:Y,onChange:e=>{const t=b(e),n=B(a);n.iconColor=t,n.iconColorHex=null,i(n)},getPopupContainer:H,options:ne})}),l.jsx(Bl,{layout:"toggle",label:p("show_text_label"),children:l.jsx(wl,{checked:Z,onChange:e=>{const t=B(a);t.showTextLabel=e,i(t)}})}),l.jsx(Bl,{label:p("social_icon_spacing"),children:l.jsx(t.InputNumber,{min:0,max:96,className:"input-width ee-settings-input-affix",addonAfter:"px",value:q,onFocus:e=>e?.target?.select?.(),onChange:e=>(e=>{const t="number"==typeof e&&Number.isFinite(e)&&e>=0?Math.min(96,e):8,n=B(a);n.contentStyles||(n.contentStyles={desktop:{},mobile:{}}),n.contentStyles[r]={...n.contentStyles[r]||{},columnGapPx:t},i(n)})(e)})}),l.jsx(Bl,{label:p("align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:V,onChange:e=>(e=>{const t=B(a);t.contentStyles[r]={...t.contentStyles[r],textAlign:e},i(t)})(e),"aria-label":p("align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignJustify,className:"tag-style-size"}),iconOnly:!0}]})}),u?null:l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"ee-social-settings-padding-heading ee-social-link-settings-subsection",children:p("padding_settings")}),l.jsx(Bl,{children:l.jsx(Sl,{padding:{paddingTop:s(a.contentStyles,"paddingTop"),paddingRight:s(a.contentStyles,"paddingRight"),paddingLeft:s(a.contentStyles,"paddingLeft"),paddingBottom:s(a.contentStyles,"paddingBottom")},setPadding:e=>{const t=B(a);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[r]||(t.contentStyles[r]={}),t.contentStyles[r]={...t.contentStyles[r],...e},i(t)}})})]})]})}const Fi=()=>{const{currentItem:t,previewMode:n,apiConfig:o,templateData:a}=e.useContext($e),{findStyleItem:i,updateItemStyles:r}=Kl(),s=e.useCallback(e=>{r(e)},[r]);return l.jsx(Mi,{blockNode:t.data,onUpdateBlock:s,previewMode:n,findStyleItem:i,apiConfig:o,templateData:a,embedded:!1})},{TextArea:Ui}=t.Input;const Di=()=>{const{currentItem:a,previewMode:i}=e.useContext($e),{t:r}=Zo(),{findStyleItem:s,updateItemStyles:c}=Kl(),d=e=>{const t=B(a.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]??{},...e},c(t)},u=s(a.data.contentStyles,"textAlign"),p=["left","center","right","justify"].includes(u)?u:"center",m=function(e){if(null==e||""===e)return 100;if("number"==typeof e)return Math.min(100,Math.max(10,Math.round(e)));const t=String(e).trim().match(/^(\d+(?:\.\d+)?)%$/);return t?Math.min(100,Math.max(10,Math.round(Number(t[1])))):100}(s(a.data.contentStyles,"width")),g=s(a.data.contentStyles,"backgroundColor"),h=function(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e))return Math.min(48,Math.max(0,Math.round(e)));const t=String(e).trim().replace(/px$/i,""),n=Number.parseFloat(t);return Number.isFinite(n)?Math.min(48,Math.max(0,Math.round(n))):0}(s(a.data.contentStyles,"borderRadius"));return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form ee-raw-html-settings",children:[l.jsx(Ll,{className:"ee-raw-html-heading-row",children:l.jsxs("span",{className:"ee-raw-html-title-left",children:[l.jsx(n.FontAwesomeIcon,{icon:o.faCode,className:"ee-raw-html-title-icon","aria-hidden":!0}),l.jsx("span",{className:"ee-raw-html-block-heading-text",children:r("raw_html_block")}),l.jsx(t.Tooltip,{title:r("raw_html_code_hint"),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:l.jsx("span",{className:"ee-help-icon ee-raw-html-title-help",tabIndex:0,"aria-label":r("raw_html_info_tooltip_aria"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]})}),l.jsx("p",{className:"ee-raw-html-block-description",children:r("raw_html_block_description")}),l.jsx(Bl,{label:r("raw_html_code_label"),children:l.jsx(Ui,{className:"ee-raw-html-code-textarea",value:a.data.html??"",onChange:e=>(e=>{const t=B(a.data);t.html=e,c(t)})(e.target.value),autoSize:{minRows:10,maxRows:28},spellCheck:!1})}),l.jsx(Ll,{children:r("raw_html_appearance")}),l.jsx(Bl,{label:r("width"),children:l.jsx(t.Slider,{min:10,max:100,value:m,tooltip:{formatter:e=>`${e}%`},onChange:e=>{d({width:`${e}%`})}})}),l.jsx(Bl,{label:r("align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:p,onChange:e=>(e=>{d({textAlign:e})})(e),"aria-label":r("align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignJustify,className:"tag-style-size"}),iconOnly:!0}]})}),l.jsx(Bl,{label:r("border_radius"),children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:h,onFocus:e=>e?.target?.select?.(),onChange:e=>(e=>{const t="number"==typeof e&&Number.isFinite(e)?Math.min(48,Math.max(0,Math.round(e))):0;if(0===t){const e=B(a.data);e.contentStyles||(e.contentStyles={desktop:{},mobile:{}});const t={...e.contentStyles[i]??{}};return delete t.borderRadius,e.contentStyles[i]=t,void c(e)}d({borderRadius:t})})("number"==typeof e?e:0)})}),l.jsx(Bl,{label:r("background_color"),children:l.jsxs("div",{className:"ee-raw-html-bg-row",children:[l.jsx(kl,{color:g,setColor:({hex:e})=>{d({backgroundColor:e})},fallbackColor:"#ffffff"}),null!=g&&""!==String(g).trim()&&"transparent"!==String(g).toLowerCase()?l.jsx(t.Button,{type:"link",size:"small",onClick:()=>{const e=B(a.data),t=e.contentStyles[i]||{},{backgroundColor:n,...o}=t;e.contentStyles[i]=o,c(e)},children:r("raw_html_clear_background")}):null]})}),l.jsx(Ll,{className:"ee-raw-html-settings-padding-heading",children:r("padding_settings")}),l.jsx(Bl,{children:l.jsx(Sl,{padding:{paddingTop:s(a.data.contentStyles,"paddingTop"),paddingRight:s(a.data.contentStyles,"paddingRight"),paddingLeft:s(a.data.contentStyles,"paddingLeft"),paddingBottom:s(a.data.contentStyles,"paddingBottom")},setPadding:e=>{d(e)}})}),l.jsxs("div",{className:"ee-raw-html-email-warning",role:"note",children:[l.jsx(n.FontAwesomeIcon,{icon:o.faExclamationTriangle,className:"ee-raw-html-email-warning-icon","aria-hidden":!0}),l.jsx("span",{children:r("raw_html_email_client_warning")})]})]})},Ei=[{value:"none",label:"None"},{value:"solid",label:"Solid"},{value:"dashed",label:"Dashed"},{value:"dotted",label:"Dotted"}],zi=()=>{const{currentItem:a,previewMode:i}=e.useContext($e),{t:r}=Zo(),{findStyleItem:s,updateItemStyles:c}=Kl(),d=()=>document.querySelector(".right-settings")||document.body,u=e=>{const t=B(a.data);Object.assign(t,e),c(t)},p=e=>{const t=B(a.data);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),"desktop"!==i&&(t.styles.mobile||(t.styles.mobile={}),Object.assign(t.styles.mobile,e)),c(t)},m=a.data.rows??3,g=a.data.cols??3,h=Boolean(a.data.headerRow),b=Boolean(a.data.headerCol),y=a.data.selectedCell??null,f=a.data.structureMode??"static",_=s(a.data.styles,"fontSize")??14,k=s(a.data.styles,"color")??"#333333",x=s(a.data.styles,"borderColor")??"#e0e0e0",v=s(a.data.styles,"borderStyle")??"solid",w=s(a.data.styles,"borderWidth")??1,S=s(a.data.styles,"cellPadding")??8,j=s(a.data.styles,"textAlign")??"left",C=s(a.data.styles,"headerBg")??"#f5f5f5",N=s(a.data.styles,"headerColor")??"#333333",I=Boolean(a.data.stripedRows),A=s(a.data.styles,"stripedBg")??"#fafafa",L="number"==typeof g?g:3,T="number"==typeof m?m:3,$=e.useMemo(()=>y&&a.data.cells?a.data.cells[y]??null:null,[y,a.data.cells]),R="image"===$?.type?"image":"text",P=e=>{if(!y)return;const t={...a.data.cells||{}};t[y]={...t[y]||{},...e},u({cells:t})},M=Math.min(T,8),F=Math.min(L,8),U=e.useMemo(()=>{if("string"!=typeof y)return null;const e=y.match(/^(\d+)-(\d+)$/);return e?{row:Number(e[1])+1,col:Number(e[2])+1}:null},[y]),D=e.useMemo(()=>[{value:"left",label:r("table_align_left")},{value:"center",label:r("table_align_center")},{value:"right",label:r("table_align_right")}],[r]);return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form ee-table-settings",children:[l.jsx(Ll,{children:r("table_structure")}),l.jsx(Bl,{label:r("table_structure_mode"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:f,onChange:e=>u({structureMode:e}),"aria-label":r("table_structure_mode"),items:[{value:"static",label:r("table_mode_static")},{value:"dynamic",label:r("table_mode_dynamic")}]})}),"dynamic"===f?l.jsx("div",{className:"ee-table-dynamic-hint",role:"note",children:r("table_dynamic_structure_hint")}):null,l.jsx(Bl,{label:r("rows"),children:l.jsx(t.InputNumber,{min:1,max:20,className:"width-full ee-settings-input-affix ee-table-dimension-input",value:T,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t="number"==typeof e&&Number.isFinite(e)?Math.round(e):null;null!=t&&u({rows:Math.min(20,Math.max(1,t))})}})}),l.jsx(Bl,{label:r("columns"),children:l.jsx(t.InputNumber,{min:1,max:12,className:"width-full ee-settings-input-affix ee-table-dimension-input",value:L,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t="number"==typeof e&&Number.isFinite(e)?Math.round(e):null;null!=t&&u({cols:Math.min(12,Math.max(1,t))})}})}),l.jsxs("div",{className:"ee-table-add-actions",children:[l.jsxs("button",{type:"button",className:"ee-table-add-btn menu-add-new-item",onClick:()=>u({rows:Math.min(20,T+1)}),disabled:T>=20,children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",r("table_add_row")]}),l.jsxs("button",{type:"button",className:"ee-table-add-btn menu-add-new-item",onClick:()=>u({cols:Math.min(12,L+1)}),disabled:L>=12,children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",r("table_add_column")]})]}),l.jsx(Bl,{layout:"toggle",label:r("header_row"),children:l.jsx(wl,{checked:h,onChange:e=>u({headerRow:e})})}),l.jsx(Bl,{layout:"toggle",label:r("header_column"),children:l.jsx(wl,{checked:b,onChange:e=>u({headerCol:e})})}),l.jsx(Ll,{className:"margin-top-12",children:r("cell_selector")}),l.jsxs("div",{className:"ee-table-cell-picker-wrap",children:[l.jsx("div",{className:"ee-table-cell-picker-grid",style:{gridTemplateColumns:`repeat(${F}, minmax(0, 1fr))`},children:Array.from({length:M*F}).map((e,t)=>{const n=Math.floor(t/F),o=t%F,i=`${n}-${o}`,r=y===i,s=h&&0===n||b&&0===o;return l.jsxs("button",{type:"button",className:`ee-table-cell-picker-btn${r?" ee-table-cell-picker-btn--selected":""}${s?" ee-table-cell-picker-btn--header":""}`,onClick:()=>{if(r)return void u({selectedCell:null});const e={...a.data.cells||{}};e[i]||(e[i]={type:"text",text:""}),u({selectedCell:i,cells:e})},children:[n+1,",",o+1]},i)})}),T>M||L>F?l.jsx("div",{className:"ee-table-cell-picker-caption",children:r("table_cell_grid_truncated",{rows:M,cols:F})}):null,y&&U?l.jsx("div",{className:"ee-table-selected-label",children:r("table_selected_cell",{row:U.row,col:U.col})}):l.jsx("div",{className:"ee-table-selected-label ee-table-selected-label--muted",children:r("table_select_cell_hint")})]}),y?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:r("cell_content")}),l.jsx(Bl,{label:r("cell_content_type"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:R,onChange:e=>{P("image"===e?{type:"image",src:"",alt:""}:{type:"text",text:$?.text??""})},"aria-label":r("cell_content_type"),items:[{value:"text",icon:l.jsx(n.FontAwesomeIcon,{icon:o.faFont,className:"tag-style-size"}),label:r("text")},{value:"image",icon:l.jsx(n.FontAwesomeIcon,{icon:o.faImage,className:"tag-style-size"}),label:r("image")}]})}),"text"===R?l.jsx(Bl,{label:r("content"),children:l.jsx(t.Input.TextArea,{className:"ee-table-cell-textarea",rows:4,value:$?.text??"",placeholder:r("table_cell_text_placeholder"),onChange:e=>P({text:e.target.value})})}):l.jsx(Bl,{label:r("image"),children:l.jsx(t.Input,{className:"width-full",value:$?.src??"",placeholder:"https://...",onChange:e=>P({src:e.target.value})})})]}):null,l.jsx(Ll,{className:"margin-top-12",children:r("table_style")}),l.jsx(Bl,{label:r("font_size"),children:l.jsx(t.InputNumber,{min:8,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof _?_:parseInt(String(_||"14"),10),onFocus:e=>e?.target?.select?.(),onChange:e=>p({fontSize:e??14})})}),l.jsx(Bl,{label:r("text_color"),children:l.jsx(kl,{color:k,setColor:({hex:e})=>p({color:e})})}),l.jsx(Bl,{label:r("text_align"),children:l.jsx(t.Select,{className:"width-full",value:j,onChange:e=>p({textAlign:e}),getPopupContainer:d,options:D})}),l.jsx(Bl,{label:r("cell_padding"),children:l.jsx(t.InputNumber,{min:0,max:40,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof S?S:parseInt(String(S||"8"),10),onFocus:e=>e?.target?.select?.(),onChange:e=>p({cellPadding:e??8})})}),l.jsx(Ll,{className:"margin-top-12",children:r("border")}),l.jsx(Bl,{label:r("border_style"),children:l.jsx(t.Select,{className:"width-full",value:v,onChange:e=>p({borderStyle:e}),getPopupContainer:d,options:Ei})}),"none"!==v?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:r("border_width"),children:l.jsx(t.InputNumber,{min:0,max:10,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof w?w:parseInt(String(w||"1"),10),onFocus:e=>e?.target?.select?.(),onChange:e=>p({borderWidth:e??1})})}),l.jsx(Bl,{label:r("border_color"),children:l.jsx(kl,{color:x,setColor:({hex:e})=>p({borderColor:e})})})]}):null,l.jsx(Ll,{className:"margin-top-12",children:r("header_style")}),l.jsx(Bl,{label:r("header_background"),children:l.jsx(kl,{color:C,setColor:({hex:e})=>p({headerBg:e})})}),l.jsx(Bl,{label:r("header_text_color"),children:l.jsx(kl,{color:N,setColor:({hex:e})=>p({headerColor:e})})}),l.jsx(Bl,{layout:"toggle",label:r("striped_rows"),children:l.jsx(wl,{checked:I,onChange:e=>u({stripedRows:e})})}),I?l.jsx(Bl,{label:r("stripe_color"),children:l.jsx(kl,{color:A,setColor:({hex:e})=>p({stripedBg:e})})}):null,l.jsx(Ll,{className:"ee-table-settings-padding-heading",children:r("padding_settings")}),l.jsx(Bl,{children:l.jsx(Sl,{padding:{paddingTop:s(a.data.contentStyles,"paddingTop"),paddingRight:s(a.data.contentStyles,"paddingRight"),paddingLeft:s(a.data.contentStyles,"paddingLeft"),paddingBottom:s(a.data.contentStyles,"paddingBottom")},setPadding:e=>(e=>{const t=B(a.data);t.contentStyles||(t.contentStyles={desktop:{},mobile:{}}),t.contentStyles[i]={...t.contentStyles[i]??{},...e},c(t)})(e)})})]})},Oi={logo:"logo",brand:"brand",tagline:"tagline",address:"address",unsubscribe:"unsubscribe",social:"social",secondary:"secondary",copyright:"copyright"};function Wi(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>Wi(e,t,n))}:e:e}function Hi(e,t,n=new Set){if(!e||n.has(e.id))return null;if(n.add(e.id),e.footerSlot===t)return e;if(Array.isArray(e.children))for(const o of e.children){const e=Hi(o,t,n);if(e)return e}return null}function Ki(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"image"===e.key&&e.footerBannerSlot)return e;if("image"===e.key&&String(e.src||"").includes("FooterBanner"))return e;if(Array.isArray(e.children))for(const n of e.children){const e=Ki(n,t);if(e)return e}return null}function Vi(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"divider"===e.key&&e.footerBannerDividerSlot)return e;if(Array.isArray(e.children))for(const n of e.children){const e=Vi(n,t);if(e)return e}return null}function Gi(e){return String(e??"").replace(/<[^>]+>/g,"").trim()}function qi(e){const t=/<div[^>]*>([\s\S]*?)<\/div>/i.exec(e||"");return t?t[1].trim():Gi(e)}function Ji(e){return`<div style="text-align:center">${e}</div>`}function Yi(e){const t={unsubLabel:"Unsubscribe",unsubUrl:"#",prefLabel:"Update preferences",prefUrl:"#"};if(!e||"string"!=typeof e)return t;const n=/<a\s+href="([^"]*)"[^>]*>([\s\S]*?)<\/a>[\s\S]*?<a\s+href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/i.exec(e);return n&&(t.unsubUrl=n[1],t.unsubLabel=Gi(n[2]),t.prefUrl=n[3],t.prefLabel=Gi(n[4])),t}function Xi(e){const t={unsubLabel:"Unsubscribe",unsubUrl:"#",prefLabel:"Update preferences",prefUrl:"#"};if(!e)return t;if("menu"===e.key&&Array.isArray(e.list)){const n=e.list[0]||{},o=e.list[1]||{};return{unsubLabel:String(n.label??t.unsubLabel),unsubUrl:String(n.url??t.unsubUrl),prefLabel:String(o.label??t.prefLabel),prefUrl:String(o.url??t.prefUrl)}}return{...t,...Yi(e?.text??"")}}const Zi=[10,11,12,13,14,16];function Qi(){const{currentItem:a,templateData:i,previewMode:r,apiConfig:s}=e.useContext($e),{t:c}=Zo(),{findStyleItem:d,updateItemStyles:u}=Kl(),[p,m]=e.useState(null);e.useEffect(()=>{m(null)},[a?.id]);const g=a.data,h=e=>p===e,b=(e,t)=>h(e)?t:wn(t??"",i),y=(e,t)=>h(e)?t:Sn(t??"",i),f=e.useMemo(()=>{const e={};for(const t of Object.values(Oi))e[t]=Hi(g,t);return e},[g.id,JSON.stringify(g.children)]),_=e=>{u(e)},k=(e,t)=>{const n=f[e];n?.id&&_(Wi(B(g),n.id,t))},x=(e,t)=>{k(e,e=>({...e,hidden:!t}))},v=e=>{const t=f[e];return!!t&&!0!==t.hidden},w=f[Oi.logo],S=f[Oi.brand],j=f[Oi.tagline],C=f[Oi.address],N=f[Oi.unsubscribe],I=f[Oi.social],A=f[Oi.secondary],L=f[Oi.copyright],T=v(Oi.logo),$=v(Oi.brand),R=v(Oi.tagline),M=v(Oi.address),F=v(Oi.unsubscribe),U=v(Oi.social),D=v(Oi.secondary),E=v(Oi.copyright),z=w?.src??"{{LogoUrl}}",O=e.useMemo(()=>{const e="string"==typeof z?z.trim():String(z??""),t=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",n=i&&t?Ft(i,t,{}):null;return null==n||String(n).startsWith("{{")?vn(z,i)||z||"":String(n)},[z,i]),W=w?.alt??"Logo",H=w?.linkURL??"",K=String(w?.styles?.desktop?.width??"30%"),V=parseInt(K.replace("%",""),10)||30,G=w?.contentStyles?.desktop?.paddingTop??w?.contentStyles?.desktop?.paddingLeft??12,q=e.useMemo(()=>Ki(g),[g.id,JSON.stringify(g.children)]),J=!0===g.showFooterBanner,Y=q?.src??"{{FooterBanner}}",X=e.useMemo(()=>{const e="string"==typeof Y?Y.trim():String(Y??""),t=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",n=i&&t?Ft(i,t,{}):null;return null==n||String(n).startsWith("{{")?Y||"":String(n)},[Y,i]),Z=q?.alt??"",Q=q?.linkURL??"",ee=function(e){const t=/<b>([\s\S]*?)<\/b>/i.exec(e||"");return t?t[1].trim():Gi(e)}(S?.text??""),te=qi(j?.text??""),ne=qi(C?.text??""),oe=qi(L?.text??"");const ae=Xi(N),le=A?.list??[],ie=d(g.styles,"color")??"#737373",re=d(g.styles,"linkColor"),se=null!=re&&""!==String(re).trim()?String(re).trim():"",ce=d(g.styles,"backgroundColor")??"#f4f4f5",de=d(g.styles,"contentBackground")??"#ffffff",ue=d(g.styles,"fontSize")??12,pe=d(g.styles,"textAlign")??"center",me=d(g.styles,"paddingTop")??28,ge=d(g.styles,"paddingBottom")??28,he=d(g.styles,"paddingLeft")??24,be=d(g.styles,"paddingRight")??24,ye=e.useMemo(()=>Zi.map(e=>({value:e,label:`${e}px`})),[]),fe=e=>{const t=B(g);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),_(t)},_e=e=>{q?.id&&_(Wi(B(g),q.id,e))},ke=e=>{k(Oi.secondary,t=>({...t,list:e,useNavigationLinks:!1}))},xe=e=>{k(Oi.unsubscribe,t=>{const n={...Xi(t),...e},o=[{label:(a=n).unsubLabel||"Unsubscribe",url:a.unsubUrl||"#",target:"_self"},{label:a.prefLabel||"Update preferences",url:a.prefUrl||"#",target:"_self"}];var a;return"menu"===t.key?{...t,list:o,useNavigationLinks:!1}:function(e,t){return{id:e.id,name:e.name,key:"menu",footerSlot:"unsubscribe",hidden:e.hidden,layoutMode:"nav-only",showLogo:!1,mobileLayout:"stack",linkGapPx:0,linkUnderline:!1,list:t,separator:" · ",useNavigationLinks:!1,contentStyles:e.contentStyles||{desktop:{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,textAlign:"center"},mobile:{}},styles:e.styles?.desktop||e.styles?.mobile?e.styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",linkColor:"#737373",letterSpacing:0,fontWeight:"400",textTransform:"none"},mobile:{}},isPreset:e.isPreset}}(t,o)})},ve=(new Date).getFullYear();return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form ee-footer-native-shell-settings",children:[l.jsx(Ll,{children:c("footer_visible_lines")}),l.jsx(Bl,{layout:"toggle",label:c("show_logo"),children:l.jsx(wl,{checked:T,onChange:e=>x(Oi.logo,e)})}),l.jsx(Bl,{layout:"toggle",label:c("show_footer_banner"),children:l.jsx(wl,{checked:J,onChange:e=>{let t=B(g);t.showFooterBanner=e,e&&!Ki(t)&&(t=function(e,t){const n=B(e),o=function(e){const t=e.children?.find(e=>"content"===e.key);return t||e.children?.[0]}(n);if(!o?.children)return n;const a=!0===e.showFooterBanner,l={id:P(),name:t("image"),key:"image",footerBannerSlot:!0,src:"{{FooterBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}},hidden:!a},i={id:P(),name:t("divider"),key:"divider",footerBannerDividerSlot:!0,hidden:!a,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},r=[...o.children];return r.splice(0,0,l,i),{...n,children:(n.children||[]).map(e=>e.id===o.id?{...e,children:r}:e)}}(t,c));const n=Ki(t);n?.id&&(t=Wi(t,n.id,t=>({...t,hidden:!e})));const o=Vi(t);o?.id&&(t=Wi(t,o.id,t=>({...t,hidden:!e}))),_(t)}})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_brand_name"),children:l.jsx(wl,{checked:$,onChange:e=>x(Oi.brand,e)})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_tagline"),children:l.jsx(wl,{checked:R,onChange:e=>x(Oi.tagline,e)})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_address"),children:l.jsx(wl,{checked:M,onChange:e=>x(Oi.address,e)})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_social_row"),children:l.jsx(wl,{checked:U,onChange:e=>x(Oi.social,e)})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_secondary_links"),children:l.jsx(wl,{checked:D,onChange:e=>x(Oi.secondary,e)})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_unsubscribe"),children:l.jsx(wl,{checked:F,onChange:e=>x(Oi.unsubscribe,e)})}),l.jsx(Bl,{layout:"toggle",label:c("footer_toggle_copyright"),children:l.jsx(wl,{checked:E,onChange:e=>x(Oi.copyright,e)})}),T&&w?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:c("logo_section")}),l.jsx(Bl,{label:c("image_url"),children:l.jsx(t.Input,{className:"width-full",value:h("logoSrc")?z:O,placeholder:c("placeholder_https"),onFocus:()=>m("logoSrc"),onBlur:()=>m(e=>"logoSrc"===e?null:e),onChange:e=>k(Oi.logo,t=>({...t,src:e.target.value}))})}),l.jsx(Bl,{label:c("logo_alt"),children:l.jsx(t.Input,{className:"width-full",value:b("logoAlt",W),placeholder:"Logo",onFocus:()=>m("logoAlt"),onBlur:()=>m(e=>"logoAlt"===e?null:e),onChange:e=>k(Oi.logo,t=>({...t,alt:e.target.value}))})}),l.jsx(Bl,{label:c("logo_link"),children:l.jsx(t.Input,{className:"width-full",value:y("logoLink",H),placeholder:c("link_url_placeholder"),onFocus:()=>m("logoLink"),onBlur:()=>m(e=>"logoLink"===e?null:e),onChange:e=>k(Oi.logo,t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})}),l.jsx(Bl,{label:c("logo_max_width"),children:l.jsx(t.InputNumber,{min:10,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:V,onFocus:e=>e?.target?.select?.(),onChange:e=>k(Oi.logo,t=>({...t,styles:{...t.styles,desktop:{...t.styles?.desktop,width:`${e||30}%`}}}))})}),l.jsx(Bl,{label:c("logo_padding"),children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof G?G:12,onFocus:e=>e?.target?.select?.(),onChange:e=>k(Oi.logo,t=>({...t,contentStyles:{...t.contentStyles,desktop:{...t.contentStyles?.desktop,paddingTop:e??12,paddingBottom:e??12,paddingLeft:e??12,paddingRight:e??12}}}))})})]}):null,J&&q?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:c("footer_banner_section")}),l.jsx(Bl,{label:c("image_url"),children:l.jsx(t.Input,{className:"width-full",value:h("footerBannerSrc")?Y:X,placeholder:c("placeholder_https"),onFocus:()=>m("footerBannerSrc"),onBlur:()=>m(e=>"footerBannerSrc"===e?null:e),onChange:e=>_e(t=>({...t,src:e.target.value}))})}),l.jsx(Bl,{label:c("image_alt"),children:l.jsx(t.Input,{className:"width-full",value:b("footerBannerAlt",Z),placeholder:c("image_alt_placeholder"),onFocus:()=>m("footerBannerAlt"),onBlur:()=>m(e=>"footerBannerAlt"===e?null:e),onChange:e=>_e(t=>({...t,alt:e.target.value}))})}),l.jsx(Bl,{label:c("link_url"),children:l.jsx(t.Input,{className:"width-full",value:y("footerBannerLink",Q),placeholder:c("link_url_placeholder"),onFocus:()=>m("footerBannerLink"),onBlur:()=>m(e=>"footerBannerLink"===e?null:e),onChange:e=>_e(t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})})]}):null,l.jsx(Ll,{className:"margin-top-12",children:c("footer_content_heading")}),$&&S?l.jsx(Bl,{label:c("footer_label_brand"),children:l.jsx(t.Input,{className:"width-full",value:b("brandName",ee),placeholder:c("footer_brand_name_placeholder"),onFocus:()=>m("brandName"),onBlur:()=>m(e=>"brandName"===e?null:e),onChange:e=>k(Oi.brand,t=>{return{...t,text:(n=e.target.value,`<div style="text-align:center"><b>${n}</b></div>`)};var n})})}):null,R&&j?l.jsx(Bl,{label:c("brand_tagline"),children:l.jsx(t.Input,{className:"width-full",value:b("tagline",te),placeholder:c("footer_brand_tagline_placeholder"),onFocus:()=>m("tagline"),onBlur:()=>m(e=>"tagline"===e?null:e),onChange:e=>k(Oi.tagline,t=>({...t,text:Ji(e.target.value)}))})}):null,M&&C?l.jsx(Bl,{label:c("address"),children:l.jsx(t.Input.TextArea,{className:"width-full",value:b("address",ne),rows:2,placeholder:c("footer_address_placeholder"),onFocus:()=>m("address"),onBlur:()=>m(e=>"address"===e?null:e),onChange:e=>k(Oi.address,t=>({...t,text:Ji(e.target.value)}))})}):null,U&&I?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:c("footer_social_platforms_heading")}),l.jsx(Mi,{blockNode:I,onUpdateBlock:e=>k(Oi.social,()=>e),previewMode:r,findStyleItem:d,apiConfig:s,templateData:i,embedded:!0},I.id)]}):null,D&&A?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:c("footer_secondary_links_heading")}),l.jsxs("div",{className:"margin-top-12 ee-settings-stack-flat",children:[le.map((e,n)=>l.jsxs("div",{className:"margin-bottom-12",children:[l.jsx(Bl,{label:`${c("footer_secondary_link_text")} ${n+1}`,children:l.jsx(t.Input,{className:"width-full",value:e.label||"",onChange:e=>{const t=[...le];t[n]={...t[n],label:e.target.value},ke(t)}})}),l.jsx(Bl,{label:c("footer_secondary_link_url"),children:l.jsx(t.Input,{className:"width-full",value:e.url||"",onChange:e=>{const t=[...le];t[n]={...t[n],url:e.target.value},ke(t)}})})]},`${e.label}-${n}`)),l.jsxs("button",{type:"button",className:"menu-add-new-item",onClick:()=>ke([...le,{label:c("footer_new_link_label"),url:"#",target:"_self"}]),children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",c("footer_add_link")]})]})]}):null,F&&N?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:c("footer_toggle_unsubscribe")}),l.jsx(Bl,{label:c("footer_unsubscribe_link_label"),children:l.jsx(t.Input,{className:"width-full",value:b("unsubLabel",ae.unsubLabel),onFocus:()=>m("unsubLabel"),onBlur:()=>m(e=>"unsubLabel"===e?null:e),onChange:e=>xe({unsubLabel:e.target.value})})}),l.jsx(Bl,{label:c("unsubscribe_url"),children:l.jsx(t.Input,{className:"width-full",value:y("unsubUrl",ae.unsubUrl),placeholder:c("footer_unsubscribe_url_placeholder"),onFocus:()=>m("unsubUrl"),onBlur:()=>m(e=>"unsubUrl"===e?null:e),onChange:e=>xe({unsubUrl:e.target.value})})}),l.jsx(Bl,{label:c("footer_preferences_link_label"),children:l.jsx(t.Input,{className:"width-full",value:b("prefLabel",ae.prefLabel),onFocus:()=>m("prefLabel"),onBlur:()=>m(e=>"prefLabel"===e?null:e),onChange:e=>xe({prefLabel:e.target.value})})}),l.jsx(Bl,{label:c("footer_preferences_url"),children:l.jsx(t.Input,{className:"width-full",value:y("prefUrl",ae.prefUrl),onFocus:()=>m("prefUrl"),onBlur:()=>m(e=>"prefUrl"===e?null:e),onChange:e=>xe({prefUrl:e.target.value})})})]}):null,E&&L?l.jsx(Bl,{label:c("copyright_text"),children:l.jsx(t.Input,{className:"width-full",value:b("copyright",oe),placeholder:c("footer_copyright_placeholder",{year:ve}),onFocus:()=>m("copyright"),onBlur:()=>m(e=>"copyright"===e?null:e),onChange:e=>k(Oi.copyright,t=>{return{...t,text:(n=e.target.value,`<div style="text-align:center;font-size:11px;opacity:0.9">${n}</div>`)};var n})})}):null,l.jsx(Ll,{className:"margin-top-12",children:c("footer_style_heading")}),l.jsx(Bl,{label:c("footer_text_color"),children:l.jsx(kl,{color:ie,setColor:({hex:e})=>fe({color:e})})}),l.jsx(Bl,{label:c("footer_link_color"),children:l.jsx(kl,{color:se||ie,setColor:({hex:e})=>fe({linkColor:e})})}),l.jsx(Bl,{label:c("footer_background_content"),children:l.jsx(kl,{color:de,setColor:({hex:e})=>fe({contentBackground:e||"#ffffff"})})}),l.jsx(Bl,{label:c("footer_column_background"),children:l.jsx(kl,{color:ce,setColor:({hex:e})=>fe({backgroundColor:e||"transparent"})})}),l.jsx(Bl,{label:c("font_size"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:"number"==typeof ue?ue:parseInt(String(ue||"12"),10),onChange:e=>fe({fontSize:e}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:ye})}),l.jsx(Bl,{label:c("footer_align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:pe,onChange:e=>fe({textAlign:e}),"aria-label":c("footer_align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft})},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter})},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight})}]})}),l.jsx(Bl,{label:c("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:me,paddingBottom:ge,paddingLeft:he,paddingRight:be},setPadding:fe})})]})}const er=[10,11,12,13,14,16],tr="__ee_footer_social_custom__",nr=[{value:"instagram",image:x("instagram"),labelKey:"footer_social_instagram",title:"Instagram"},{value:"facebook",image:x("facebook"),labelKey:"footer_social_facebook",title:"Facebook"},{value:"twitter",image:x("x"),labelKey:"footer_social_twitter",title:"Twitter"},{value:"linkedin",image:x("linkedin"),labelKey:"footer_social_linkedin",title:"LinkedIn"},{value:"youtube",image:x("youtube"),labelKey:"footer_social_youtube",title:"YouTube"},{value:"tiktok",image:x("tiktok"),labelKey:"footer_social_tiktok",title:"TikTok"}];function or(e){const t=String(e?.image||"").toLowerCase(),n=nr.find(e=>String(e.image).toLowerCase()===t);return n?n.value:t.includes("brand-instagram")||t.includes("tc-instagram")?"instagram":t.includes("brand-facebook")||t.includes("tc-facebook")?"facebook":t.includes("brand-x")||t.includes("tc-x")?"twitter":t.includes("brand-linkedin")||t.includes("tc-linkedin")?"linkedin":t.includes("brand-youtube")||t.includes("tc-youtube")?"youtube":t.includes("brand-tiktok")||t.includes("tc-tiktok")?"tiktok":"custom"}const ar={facebook:"social_link_placeholder_facebook",linkedin:"social_link_placeholder_linkedin",instagram:"social_link_placeholder_instagram",tiktok:"social_link_placeholder_tiktok",youtube:"social_link_placeholder_youtube"};function lr(e,t){if(g(e))return t("social_link_placeholder_x");const n=String(e?.title||"").trim().toLowerCase(),o=ar[n];return t(o||"social_link_placeholder_generic")}function ir({preset:e,t:t}){const n={image:e.image,title:e.title},{src:o,style:a}=L(n,"default",22);return l.jsxs("span",{className:"ee-social-add-menu-item",children:[o?l.jsx("img",{src:o,alt:"",className:"ee-social-add-menu-icon",style:a,draggable:!1}):null,l.jsx("span",{children:t(e.labelKey)})]})}const rr=()=>{const{currentItem:a,apiConfig:i,templateData:r}=e.useContext($e),{t:s}=Zo(),{findStyleItem:c,updateItemStyles:d}=Kl(),u=e.useRef(null),p=e.useRef(null),h=e.useRef(null),[b,y]=e.useState(null),[f,_]=e.useState(!1),[k,x]=e.useState(null),[v,w]=e.useState(!1),[S,j]=e.useState(null),[C,N]=e.useState(!1),[I,A]=e.useState(null),[T,R]=e.useState({}),[M,F]=e.useState(null);e.useEffect(()=>{F(null)},[a?.id]);const{uploadImageFile:U,isConfigured:D}=ti({imageUploadEndpoint:i?.imageUploadEndpoint,headers:i?.headers||{},companyId:i?.companyId,imageUploadQueryParams:i?.imageUploadQueryParams,imageUploadCompanyField:i?.imageUploadCompanyField}),E=()=>document.querySelector(".right-settings")||document.body,O=e.useMemo(()=>er.map(e=>({value:e,label:`${e}px`})),[]),W=e=>{const t=B(a.data);Object.assign(t,e),"footer"===t.containerType&&Object.prototype.hasOwnProperty.call(e,"footerSocialList")&&(t.footerUseCompanySocial=!1),d(t)},H=e=>{const t=B(a.data);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),d(t)};e.useEffect(()=>{const e=a?.data;if(!e||"footer"!==e.containerType||!e.footerUnifiedLayout)return;if(!r)return;const t=function(e,t){if(!t||!e)return{};const n={},o=t.companyContext||{},a=t.brandContext||{};if(xn(e.brandName)&&null!=o.name&&""!==String(o.name).trim()&&(n.brandName=String(o.name).trim()),xn(e.address)&&null!=o.address&&""!==String(o.address).trim()&&(n.address=String(o.address).trim()),xn(e.brandTagline)&&null!=a.tagline&&""!==String(a.tagline).trim()&&(n.brandTagline=String(a.tagline).trim()),xn(e.footerLogoSrc)&&null!=a.logo_url&&""!==String(a.logo_url).trim()&&(n.footerLogoSrc=String(a.logo_url).trim()),xn(e.footerLogoLink)&&null!=o.website&&""!==String(o.website).trim()&&(n.footerLogoLink=String(o.website).trim()),xn(e.footerLogoAlt)&&null!=o.name&&""!==String(o.name).trim()&&(n.footerLogoAlt=String(o.name).trim()),xn(e.copyrightText)&&null!=o.name&&""!==String(o.name).trim()){const e=(new Date).getFullYear();n.copyrightText=`© ${e} ${String(o.name).trim()}`}return n}(e,r);if(0===Object.keys(t).length)return;const n=B(e);Object.assign(n,t),n.footerUnifiedLayout=!0,d(n)},[a?.data,r,d]);const K=Boolean(a.data.showBrand??!0),V=Boolean(a.data.showTagline??!0),G=Boolean(a.data.footerShowLogo??!1),q=a.data.footerLogoSrc??"",J=a.data.footerLogoAlt??"Logo",Y=a.data.footerLogoLink??"",X="number"==typeof a.data.footerLogoMaxWidthPercent?a.data.footerLogoMaxWidthPercent:parseInt(String(a.data.footerLogoMaxWidthPercent??"30"),10)||30,Z="number"==typeof a.data.footerLogoPaddingPx?a.data.footerLogoPaddingPx:parseInt(String(a.data.footerLogoPaddingPx??"24"),10)||24,Q=e.useMemo(()=>vn(q,r),[q,r]),ee=e=>M===e,te=(e,t)=>ee(e)?t:wn(t??"",r),ne=Boolean(a.data.showAddress??!0),oe=Boolean(a.data.showUnsubscribe??!0),ae=Boolean(a.data.showSocial??!1),le=Boolean(a.data.showSecondaryLinks??!1),ie=Boolean(a.data.showCopyright??!0),re=a.data.footerSelectedSegment??null,se=a.data.brandName??"",ce=a.data.brandTagline??"",de=a.data.address??"",ue=Cn(a.data),pe=null!=a.data.unsubscribeLinkLabel?String(a.data.unsubscribeLinkLabel):ue.unsubscribeLinkLabel,me=null!=a.data.preferencesLinkLabel?String(a.data.preferencesLinkLabel):ue.preferencesLinkLabel,ge=a.data.unsubscribeUrl??"",he=a.data.preferencesUrl??"",be=a.data.copyrightText??"",ye=In(a.data.secondaryLinks),fe=Nn(a.data.footerSocialList);e.useEffect(()=>{null!=k&&k>=fe.length&&x(fe.length?fe.length-1:null)},[k,fe.length]),e.useEffect(()=>{re&&requestAnimationFrame(()=>{document.getElementById(`ee-footer-settings-segment-${re}`)?.scrollIntoView?.({block:"nearest",behavior:"smooth"})})},[re,a?.id]);const _e=a.data.styles?.desktop??{},ke=c(a.data.styles,"color")??"#737373",xe=c(a.data.styles,"linkColor"),ve=null!=xe&&""!==String(xe).trim()?String(xe).trim():"",we=c(a.data.styles,"backgroundColor")??"transparent",Se=kn(c(a.data.styles,"contentBackground")??""),je=c(a.data.styles,"fontSize")??12,Ce=c(a.data.styles,"textAlign")??"center",Ne=c(a.data.styles,"paddingTop")??28,Ie=c(a.data.styles,"paddingBottom")??28,Ae=c(a.data.styles,"paddingLeft")??24,Le=c(a.data.styles,"paddingRight")??24,Te=Boolean(a.data.showDivider??!1),Be=a.data.dividerColor??"#374151",Re=Boolean(a.data.showBorderTop??!1),Pe=a.data.borderTopColor??_e.borderTopColor??"#e5e7eb",Me="number"==typeof a.data.borderTopWidth?a.data.borderTopWidth:parseInt(String(a.data.borderTopWidth??"1"),10)||1,Fe=(new Date).getFullYear(),Ue=e.useMemo(()=>nr.map(e=>({value:e.value,label:s(e.labelKey)})),[s]),De=e.useMemo(()=>[...Ue,{value:tr,label:s("footer_social_custom_icon")}],[Ue,s]),Ee=e.useMemo(()=>[{label:s("same_tab"),value:"_self"},{label:s("new_tab"),value:"_blank"}],[s]),ze=e=>{const t=e.map(e=>({...e,id:e.id||P()}));W({secondaryLinks:In(t)})},Oe=e=>{const t=e.map(e=>({...e,id:e.id||P()}));W({footerSocialList:Nn(t)})},We=(e,t)=>{Oe(fe.map((n,o)=>o===e?{...n,...t,id:n.id||P()}:n))},He=(e,t,n)=>{const o=((e,t,n)=>{const o=String(e??"").trim(),a=`Footer link ${t+1}${n?` (${n})`:""} -> URL`,l=m(o,!1,{allowMailtoTel:!0});return l?"empty"===l?`${a} is empty. Add a destination like 'https://example.com'.`:"blocked_scheme"===l?`${a} ('${o}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===l?`${a} ('${o}') repeats the protocol. Keep one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===l?`${a} ('${o}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===l?`${a} ('${o}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`${a} ('${o}') is invalid. Fix it to a valid URL like 'https://example.com'.`:""})(e,t,n);R(e=>{if(!o&&!e[t])return e;const n={...e};return o?n[t]=o:delete n[t],n})},Ke=e.useCallback($(e=>{e.preventDefault();const t=p.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const a=S,l=B(fe);null==a||a===o||l.length<2||([l[o],l[a]]=[l[a],l[o]],j(o),Oe(l),x(e=>e===a?o:e===o?a:e))},50),[S,fe]),Ve=e.useCallback($(e=>{e.preventDefault();const t=h.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const a=I,l=B(ye);null==a||a===o||l.length<2||([l[o],l[a]]=[l[a],l[o]],A(o),ze(l))},50),[I,ye]),Ge=new Set(fe.map(e=>or(e)).filter(e=>"custom"!==e)),qe=[...nr.filter(e=>!Ge.has(e.value)).map(e=>({key:`footer-add-${e.value}`,label:l.jsx(ir,{preset:e,t:s}),onClick:()=>{const t=fe.length;Oe([...fe,{id:P(),image:e.image,title:e.title,linkURL:"",socialPlatformKey:e.value}]),x(t)}})),{key:"__footer_add_custom__",label:l.jsxs("span",{className:"ee-social-add-menu-item ee-social-add-menu-item--custom",children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"}),l.jsx("span",{children:s("footer_social_custom_icon")})]}),onClick:()=>{const e=fe.length;Oe([...fe,{id:P(),image:"",title:"",linkURL:""}]),x(e)}}],Je=e=>Go("ee-footer-settings-segment",re===e&&"ee-footer-settings-segment--focused");return a?.data?.footerUnifiedLayout?l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx(Ll,{children:s("footer_visible_lines")}),l.jsx(Bl,{layout:"toggle",label:s("show_logo"),children:l.jsx(wl,{checked:G,onChange:e=>W({footerShowLogo:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_brand_name"),children:l.jsx(wl,{checked:K,onChange:e=>W({showBrand:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_tagline"),children:l.jsx(wl,{checked:V,onChange:e=>W({showTagline:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_address"),children:l.jsx(wl,{checked:ne,onChange:e=>W({showAddress:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_unsubscribe"),children:l.jsx(wl,{checked:oe,onChange:e=>W({showUnsubscribe:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_social_row"),children:l.jsx(wl,{checked:ae,onChange:e=>W({showSocial:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_secondary_links"),children:l.jsx(wl,{checked:le,onChange:e=>W({showSecondaryLinks:e})})}),l.jsx(Bl,{layout:"toggle",label:s("footer_toggle_copyright"),children:l.jsx(wl,{checked:ie,onChange:e=>W({showCopyright:e})})}),l.jsx("div",{id:"ee-footer-settings-segment-logo",className:Je("logo"),children:G?l.jsxs(l.Fragment,{children:[l.jsx(Ll,{className:"margin-top-12",children:s("logo_section")}),l.jsx(Bl,{label:s("image_url"),children:l.jsx(t.Input,{className:"width-full",value:ee("logoSrc")?q:Q,placeholder:s("placeholder_https"),onFocus:()=>F("logoSrc"),onBlur:()=>F(e=>"logoSrc"===e?null:e),onChange:e=>W({footerLogoSrc:e.target.value})})}),l.jsx(Bl,{label:s("logo_alt"),children:l.jsx(t.Input,{className:"width-full",value:te("logoAlt",J),placeholder:"Logo",onFocus:()=>F("logoAlt"),onBlur:()=>F(e=>"logoAlt"===e?null:e),onChange:e=>W({footerLogoAlt:e.target.value})})}),l.jsx(Bl,{label:s("logo_link"),children:l.jsx(t.Input,{className:"width-full",value:(Ye="logoLink",Xe=Y,ee(Ye)?Xe:Sn(Xe??"",r)),placeholder:s("link_url_placeholder"),onFocus:()=>F("logoLink"),onBlur:()=>F(e=>"logoLink"===e?null:e),onChange:e=>W({footerLogoLink:e.target.value})})}),l.jsx(Bl,{label:s("logo_max_width"),children:l.jsx(t.InputNumber,{min:10,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:X,onFocus:e=>e?.target?.select?.(),onChange:e=>W({footerLogoMaxWidthPercent:e??30})})}),l.jsx(Bl,{label:s("logo_padding"),children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:Z,onFocus:e=>e?.target?.select?.(),onChange:e=>W({footerLogoPaddingPx:e??24})})})]}):null}),l.jsx(Ll,{className:"margin-top-12",children:s("footer_content_heading")}),K?l.jsx("div",{id:"ee-footer-settings-segment-brand",className:Je("brand"),children:l.jsx(Bl,{label:s("footer_label_brand"),children:l.jsx(t.Input,{className:"width-full",value:te("brandName",se),placeholder:s("footer_brand_name_placeholder"),onFocus:()=>F("brandName"),onBlur:()=>F(e=>"brandName"===e?null:e),onChange:e=>W({brandName:e.target.value})})})}):null,V?l.jsx("div",{id:"ee-footer-settings-segment-tagline",className:Je("tagline"),children:l.jsx(Bl,{label:s("brand_tagline"),children:l.jsx(t.Input,{className:"width-full",value:te("tagline",ce),placeholder:s("footer_brand_tagline_placeholder"),onFocus:()=>F("tagline"),onBlur:()=>F(e=>"tagline"===e?null:e),onChange:e=>W({brandTagline:e.target.value})})})}):null,ne?l.jsx("div",{id:"ee-footer-settings-segment-address",className:Je("address"),children:l.jsx(Bl,{label:s("address"),children:l.jsx(t.Input.TextArea,{className:"width-full",value:te("address",de),rows:2,placeholder:s("footer_address_placeholder"),onFocus:()=>F("address"),onBlur:()=>F(e=>"address"===e?null:e),onChange:e=>W({address:e.target.value})})})}):null,oe?l.jsxs("div",{id:"ee-footer-settings-segment-unsubscribe",className:Je("unsubscribe"),children:[l.jsx(Bl,{label:s("footer_unsubscribe_link_label"),children:l.jsx(t.Input,{className:"width-full",value:pe,placeholder:s("footer_default_unsubscribe_text"),onChange:e=>W({unsubscribeLinkLabel:e.target.value})})}),l.jsx(Bl,{label:s("unsubscribe_url"),children:l.jsx(t.Input,{className:"width-full",value:ge,placeholder:s("footer_unsubscribe_url_placeholder"),onChange:e=>W({unsubscribeUrl:e.target.value})})}),l.jsx(Bl,{label:s("footer_preferences_link_label"),children:l.jsx(t.Input,{className:"width-full",value:me,placeholder:s("footer_preferences_default_label"),onChange:e=>W({preferencesLinkLabel:e.target.value})})}),l.jsx(Bl,{label:s("footer_preferences_url"),children:l.jsx(t.Input,{className:"width-full",value:he,placeholder:"#",onChange:e=>W({preferencesUrl:e.target.value})})})]}):null,ie?l.jsx("div",{id:"ee-footer-settings-segment-copyright",className:Je("copyright"),children:l.jsx(Bl,{label:s("copyright_text"),children:l.jsx(t.Input,{className:"width-full",value:te("copyright",be),placeholder:s("footer_copyright_placeholder",{year:Fe}),onFocus:()=>F("copyright"),onBlur:()=>F(e=>"copyright"===e?null:e),onChange:e=>W({copyrightText:e.target.value})})})}):null,le?l.jsxs("div",{id:"ee-footer-settings-segment-secondary",className:Je("secondary"),children:[l.jsx(Ll,{className:"margin-top-12",children:s("footer_secondary_links_heading")}),l.jsx("div",{ref:h,onDragOver:Ve,className:"margin-top-12",children:ye.map((e,a)=>l.jsx("div",{"data-index":a,draggable:!0,onDragStart:()=>{N(!0),A(a)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),N(!1),A(null)},className:Go("social-link-item","cursor-grab",C&&"social-link-item-drag_start",I===a?"social-link-item-current":"border-transparent"),children:l.jsxs("div",{className:"social-link-item-content ee-menu-item-content",children:[l.jsxs("div",{className:"ee-menu-item-header flex items-center justify-between margin-bottom-8",children:[l.jsxs("div",{className:"flex items-center ee-menu-item-drag-row",children:[l.jsx("span",{className:"social-link-item-drag-handle ee-menu-item-drag-handle","aria-hidden":!0,children:l.jsx(n.FontAwesomeIcon,{icon:o.faGripVertical,className:"social-link-item-drag-handle-icon"})}),l.jsxs("span",{className:"font-semibold",children:[s("footer_secondary_link_text")," ",a+1]})]}),l.jsx("div",{className:"social-link-item-icon social-link-item-icon-slate ee-menu-item-delete",role:"button",tabIndex:0,onClick:()=>{const e=ye.filter((e,t)=>t!==a);ze(e.length?e:jn()),R(e=>{const t={...e};return delete t[a],t})},onKeyDown:e=>{if("Enter"===e.key||" "===e.key){e.preventDefault();const t=ye.filter((e,t)=>t!==a);ze(t.length?t:jn())}},children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash,className:"social-link-item-icon-svg social-link-item-icon-svg-deep"})})]}),l.jsxs("div",{className:"ee-menu-item-fields ee-settings-stack-flat",children:[l.jsx(Bl,{label:s("footer_secondary_link_text"),children:l.jsx(t.Input,{className:"width-full ee-menu-item-input",value:e.label||"",onChange:e=>ze(ye.map((t,n)=>n===a?{...t,label:e.target.value}:t)),placeholder:s("footer_secondary_link_text")})}),l.jsxs(Bl,{label:s("footer_secondary_link_url"),children:[l.jsx(t.Input,{className:"width-full ee-menu-item-input",value:e.url||"",status:T[a]?"error":"",onChange:t=>{const n=t.target.value;ze(ye.map((e,t)=>t===a?{...e,url:n}:e)),T[a]&&He(n,a,e.label)},onBlur:t=>He(t.target.value,a,e.label),placeholder:s("link_url_placeholder")}),T[a]?l.jsx("div",{className:"ee-field-error",role:"alert",children:T[a]}):null]}),l.jsx(Bl,{label:s("target"),children:l.jsx(t.Select,{className:"width-full ee-menu-item-input",value:e.target||"_self",onChange:e=>ze(ye.map((t,n)=>n===a?{...t,target:e}:t)),getPopupContainer:E,options:Ee})})]})]})},e.id??`sec-${a}`))}),l.jsxs("button",{type:"button",className:"menu-add-new-item margin-top-12",onClick:()=>ze([...ye,{id:P(),label:s("footer_new_link_label"),url:"#",target:"_self"}]),children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",s("footer_add_link")]})]}):null,ae?l.jsxs("div",{id:"ee-footer-settings-segment-social",className:Je("social"),children:[l.jsx(Ll,{className:"margin-top-12",children:s("footer_social_platforms_heading")}),l.jsx("input",{ref:u,type:"file",accept:Ql,className:"ee-image-upload-input-hidden",onChange:async e=>{const n=e.target.files?.[0];if(e.target.value="",null==n||null==b)return;const o=ei(n);if("type"!==o)if("size"!==o){if(!D)return t.message.error(s("image_upload_not_configured")),void y(null);_(!0);try{const e=await U(n);if(e){const n=[...fe],o=n[b];o&&(n[b]={...o,id:o.id||P(),image:cn(e)},Oe(n),t.message.success(s("image_uploaded")))}else t.message.error(s("image_upload_failed"))}catch(e){t.message.error(s("image_upload_error"))}finally{_(!1),y(null)}}else t.message.error(s("image_file_too_large"));else t.message.error(s("image_upload_invalid_type"))}}),l.jsx("div",{ref:p,onDragOver:Ke,className:"ee-social-link-icons-list margin-top-12",children:fe.map((e,a)=>{const i=function(e){const t=String(e?.image||"").trim(),n=nr.find(e=>String(e.image).trim()===t);if(n)return n;const o=or(e);return o&&"custom"!==o?nr.find(e=>e.value===o)??null:null}(e),r=g(e),c=!i,d=c&&!String(e.title||"").trim()?s("footer_social_custom_icon"):r?s("social_platform_x"):String(e.title||"").trim()?String(e.title||"").trim():s(i?i.labelKey:"footer_social_custom_icon"),p=c&&!String(e.title||"").trim()?s("footer_social_custom_icon"):r?s("social_platform_x_alt"):String(e.title||"").trim()||s(i?i.labelKey:"footer_social_custom_icon"),m=L(e,"default",22),h=L(e,"default",28),_=i?i.value:tr,C=k===a;return l.jsx("div",{"data-index":a,draggable:!0,onDragStart:()=>{w(!0),j(a)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),w(!1),j(null)},className:Go("social-link-item","cursor-grab",v&&"social-link-item-drag_start",S===a?"social-link-item-current":"border-transparent"),children:l.jsxs("div",{className:Go("social-link-item-content","ee-menu-item-content","ee-social-link-row-shell"),children:[l.jsxs("div",{className:"ee-social-link-row-header",children:[l.jsx("span",{className:"social-link-item-drag-handle","aria-hidden":!0,children:l.jsx(n.FontAwesomeIcon,{icon:o.faGripVertical,className:"social-link-item-drag-handle-icon"})}),m.src?l.jsx("img",{src:m.src,alt:p,className:"social-link-item-img",style:m.style,draggable:!1}):l.jsx("div",{className:"social-link-item-img ee-social-row-icon-placeholder","aria-hidden":!0}),l.jsx("div",{className:"ee-social-link-row-header-main",children:l.jsxs("div",{className:"social-link-platform-title-wrap ee-social-link-row-title-wrap",children:[l.jsx("div",{className:"font-semibold ee-social-link-row-primary-title",children:d}),r?l.jsx("div",{className:"social-link-platform-former-name",children:s("social_platform_formerly_twitter")}):null]})}),l.jsxs("div",{className:"ee-social-link-row-tools",children:[l.jsx("button",{type:"button",className:"ee-social-link-row-icon-btn","aria-expanded":C,"aria-label":s(C?"collapse":"expand"),onClick:e=>{e.stopPropagation(),(e=>{x(t=>t===e?null:e)})(a)},children:l.jsx(n.FontAwesomeIcon,{icon:C?o.faChevronUp:o.faChevronDown})}),l.jsx("button",{type:"button",className:"ee-social-link-row-icon-btn ee-social-link-row-icon-btn-danger","aria-label":s("delete"),onClick:e=>{e.stopPropagation();const t=fe.filter((e,t)=>t!==a);Oe(t.length?t:z([],{})),x(e=>e===a?null:null!=e&&e>a?e-1:e)},children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash,className:"social-link-item-icon-svg"})})]})]}),C?l.jsxs("div",{className:"ee-social-link-row-detail",children:[l.jsx(Bl,{label:s("footer_platform_label"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:_,options:De,getPopupContainer:E,onChange:e=>{e!==tr?((e,t)=>{const n=nr.find(e=>e.value===t),o=fe[e];if(!o)return;const a=[...fe];n&&(a[e]={...o,id:o.id||P(),image:n.image,title:n.title,socialPlatformKey:n.value}),Oe(a)})(a,e):We(a,{title:"",image:"",socialPlatformKey:void 0})}})}),l.jsx(Bl,{label:s("social_icon_label_field"),children:l.jsx(t.Input,{className:"width-full",value:e.title||"",placeholder:d,onChange:e=>We(a,{title:e.target.value})})}),l.jsx(Bl,{label:s("footer_social_profile_url"),children:l.jsx(t.Input,{className:"width-full",placeholder:lr(e,s),value:e.linkURL||"",onChange:e=>We(a,{linkURL:e.target.value})})}),l.jsx(Bl,{label:s("social_custom_icon"),children:l.jsxs("div",{className:"ee-social-custom-icon-row",children:[l.jsx("div",{className:"ee-social-custom-icon-preview",children:h.src?l.jsx("img",{src:h.src,alt:"",style:h.style,draggable:!1}):l.jsx("span",{className:"ee-social-custom-icon-preview-empty","aria-hidden":!0})}),l.jsx("button",{type:"button",className:"menu-add-new-item ee-social-custom-upload-btn ee-footer-social-upload-btn",disabled:!D||f&&b===a,onClick:()=>{y(a),u.current?.click()},children:s(f&&b===a?"uploading":"footer_upload_icon")})]})})]}):null]})},e.id??`soc-${a}`)})}),l.jsx(t.Dropdown,{overlayClassName:"ee-social-add-platform-dropdown",menu:{items:qe},trigger:["click"],getPopupContainer:E,children:l.jsxs("button",{type:"button",className:"menu-add-new-item margin-top-12",children:[l.jsx("span",{className:"menu-add-new-item-icon",children:"+"})," ",s("footer_add_platform")]})})]}):null,l.jsx(Ll,{className:"margin-top-12",children:s("footer_style_heading")}),l.jsx(Bl,{label:s("footer_text_color"),children:l.jsx(kl,{color:ke,setColor:({hex:e})=>H({color:e})})}),l.jsx(Bl,{label:s("footer_link_color"),children:l.jsx(kl,{color:ve||ke,setColor:({hex:e})=>H({linkColor:e})})}),l.jsx(Bl,{label:s("footer_background_content"),children:l.jsx(kl,{color:Se,setColor:({hex:e})=>H({contentBackground:e||"#ffffff"})})}),l.jsx(Bl,{label:s("footer_column_background"),children:l.jsx(kl,{color:we,setColor:({hex:e})=>H({backgroundColor:e||"transparent"})})}),l.jsx(Bl,{label:s("font_size"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:"number"==typeof je?je:parseInt(String(je||"12"),10),style:{width:"100%"},onChange:e=>H({fontSize:e}),getPopupContainer:E,options:O})}),l.jsx(Bl,{label:s("footer_align"),children:l.jsx(Ml,{size:"sm",className:"ee-settings-segmented--stretch",value:Ce,onChange:e=>H({textAlign:e}),"aria-label":s("footer_align"),items:[{value:"left",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignLeft})},{value:"center",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignCenter})},{value:"right",label:l.jsx(n.FontAwesomeIcon,{icon:o.faAlignRight})}]})}),l.jsx(Ll,{className:"margin-top-12",children:s("footer_border_heading")}),l.jsxs("div",{id:"ee-footer-settings-segment-divider",className:Je("divider"),children:[l.jsx(Bl,{layout:"toggle",label:s("footer_divider_above"),children:l.jsx(wl,{checked:Te,onChange:e=>W({showDivider:e})})}),Te?l.jsx(Bl,{label:s("divider_color"),children:l.jsx(kl,{color:Be,setColor:({hex:e})=>W({dividerColor:e})})}):null]}),l.jsx(Bl,{layout:"toggle",label:s("footer_border_top"),children:l.jsx(wl,{checked:Re,onChange:e=>W({showBorderTop:e})})}),Re?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:s("footer_border_top_color"),children:l.jsx(kl,{color:Pe,setColor:({hex:e})=>W({borderTopColor:e})})}),l.jsx(Bl,{label:s("border_width"),children:l.jsx(t.InputNumber,{min:1,max:8,className:"input-width ee-settings-input-affix",addonAfter:"px",value:Me,onFocus:e=>e?.target?.select?.(),onChange:e=>W({borderTopWidth:e??1})})})]}):null,l.jsx(Bl,{label:s("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:Ne,paddingBottom:Ie,paddingLeft:Ae,paddingRight:Le},setPadding:e=>H({...e})})})]}):l.jsx(Qi,{});var Ye,Xe};function sr(e,t,n=new Set){if(!e||n.has(e.id))return null;if(n.add(e.id),e.key===t)return e;if(Array.isArray(e.children))for(const o of e.children){const e=sr(o,t,n);if(e)return e}return null}function cr(e,t,n=new Set){if(!e||n.has(e.id))return null;if(n.add(e.id),"image"===e.key&&String(e.src||"").includes(t))return e;if(Array.isArray(e.children))for(const o of e.children){const e=cr(o,t,n);if(e)return e}return null}function dr(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"image"===e.key&&e.headerBannerSlot)return e;if("image"===e.key&&String(e.src||"").includes("HeroBanner"))return e;if(Array.isArray(e.children))for(const n of e.children){const e=dr(n,t);if(e)return e}return null}function ur(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"divider"===e.key&&e.headerBannerDividerSlot)return e;if(Array.isArray(e.children))for(const n of e.children){const e=ur(n,t);if(e)return e}return null}function pr(e){const t=cr(e,"LogoUrl");if(t)return t;let n=null;return function e(t){if(t&&!n)if("image"!==t.key){if(Array.isArray(t.children))for(const n of t.children)e(n)}else n=t}(e),n}function mr(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>mr(e,t,n))}:e:e}function gr(e,t,n,o){const a=t?B(t):{id:P(),name:"Image",key:"image",src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"left"},mobile:{}},styles:{desktop:{width:"50%"},mobile:{}}},l=n?B(n):{id:P(),name:"Menu",key:"menu",useNavigationLinks:!0,list:O.map(e=>({...e})),separator:" | ",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0},i={paddingTop:20,paddingBottom:16},r=(e,t,n,o)=>({id:P(),name:"Content",key:"content",width:t||"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:e.map(e=>"image"===e.key?{...e,id:P(),contentStyles:{...e.contentStyles,desktop:{...e.contentStyles?.desktop,textAlign:n||"left",...o||{}}}}:"menu"===e.key?{...e,id:P(),contentStyles:{...e.contentStyles,desktop:{...e.contentStyles?.desktop,textAlign:n||"center",...o||{}}}}:{...e,id:P()})});let s;switch(e){case"logo_left_nav_right":default:s=[r([a],"50%","left"),r([l],"50%","right",i)];break;case"logo_right_nav_left":s=[r([l],"50%","left",i),r([a],"50%","right")];break;case"logo_center_nav_below":s=[r([a,l],"100%","center")];break;case"logo_only":s=[r([a],"100%","center")];break;case"nav_only":s=[r([l],"100%","center")]}return(e=>{if(!o||!o.banner&&!o.divider)return e;const t=[o.banner,o.divider].filter(Boolean).map(e=>B(e));return[...e,r(t,"100%","center")]})(s)}const hr=()=>{const{blockMap:n,rootOrder:o,setBlocks:a,currentItem:i,setCurrentItem:r,templateData:s}=e.useContext($e),{t:c}=Zo(),{findStyleItem:d}=Kl(),u=i.data,p=e=>{const{blockMap:t}=Z([e]),l={...n,...t};a(l,o,`edit_${Date.now()}`),r({...i,data:e})},m=e.useMemo(()=>pr(u),[u.id,JSON.stringify(u.children)]),g=e.useMemo(()=>sr(u,"menu"),[u.id,JSON.stringify(u.children)]),h=e.useMemo(()=>dr(u),[u.id,JSON.stringify(u.children)]),b=e.useMemo(()=>[{value:"logo_left_nav_right",label:c("header_layout_logo_left_nav_right")},{value:"logo_right_nav_left",label:c("header_layout_logo_right_nav_left")},{value:"logo_center_nav_below",label:c("header_layout_logo_center_nav_below")},{value:"logo_only",label:c("header_layout_logo_only")},{value:"nav_only",label:c("header_layout_nav_only")}],[c]),y=e.useMemo(()=>[{value:"400",label:c("font_weight_regular")},{value:"500",label:c("font_weight_medium")},{value:"600",label:c("font_weight_semibold")},{value:"700",label:c("font_weight_bold")}],[c]),f=e.useMemo(()=>[{value:"none",label:c("nav_text_transform_sentence")},{value:"uppercase",label:c("nav_text_transform_uppercase")},{value:"capitalize",label:c("nav_text_transform_capitalize")}],[c]),_=e.useMemo(()=>[{value:"stack",label:c("stack")},{value:"inline",label:c("inline")}],[c]),k=u.headerLayout||"logo_center_nav_below",x=!1!==u.showLogo,v=!0===u.showHeaderBanner,w=m?.src??"{{LogoUrl}}",S=e.useMemo(()=>{const e="string"==typeof w?w.trim():String(w??""),t=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",n=s&&t?Ft(s,t,{}):null;return null==n||String(n).startsWith("{{")?w||"":String(n)},[w,s]),j=h?.src??"{{HeroBanner}}",C=e.useMemo(()=>{const e="string"==typeof j?j.trim():String(j??""),t=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",n=s&&t?Ft(s,t,{}):null;return null==n||String(n).startsWith("{{")?j||"":String(n)},[j,s]),N=m?.alt??"Logo",I=m?.linkURL??"",A=String(m?.styles?.desktop?.width??"50%"),L=parseInt(A.replace("%",""),10)||50,T=m?.contentStyles?.desktop?.paddingLeft??12,$=h?.alt??"",R=h?.linkURL??"",M=g?.list??[],F=g?.styles?.desktop?.linkColor??"#525252",U=g?.styles?.desktop?.fontSize??13,D=String(g?.styles?.desktop?.fontWeight??"500"),E=g?.styles?.desktop?.textTransform??"uppercase",z=g?.styles?.desktop?.letterSpacing??.02,O=g?.styles?.desktop?.paddingLeft??8,W=g?.linkUnderline??!1,H=d(u.styles,"contentBackground")??"#ffffff",K=u.showBorderBottom??!1,V=u.mobileLayout??"stack",G=d(u.styles,"paddingTop")??0,q=d(u.styles,"paddingRight")??0,J=d(u.styles,"paddingBottom")??0,Y=d(u.styles,"paddingLeft")??0,X=e=>{m&&p(mr(B(u),m.id,e))},Q=e=>{h&&p(mr(B(u),h.id,e))},ee=e=>{g&&p(mr(B(u),g.id,t=>({...e(t),useNavigationLinks:!1})))},te=e=>{ee(t=>({...t,styles:{...t.styles,desktop:{...t.styles?.desktop,...e}}}))},ne=e=>{p({...B(u),...e})},oe=e=>{const t=B(u);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),p(t)},ae=(e,t,n)=>{ee(o=>{const a=[...o.list||[]];return a[e]={...a[e],[t]:n},{...o,list:a}})},le=["logo_left_nav_right","logo_right_nav_left","logo_center_nav_below","logo_only"].includes(k),ie=["logo_left_nav_right","logo_right_nav_left","logo_center_nav_below","nav_only"].includes(k),re=()=>document.querySelector(".right-settings")||document.body;return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx(Ll,{children:c("layout")}),l.jsx(Bl,{label:c("style"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:k,onChange:e=>{const t=B(u),n=pr(t),o=sr(t,"menu"),a=function(e){const t=dr(e),n=ur(e);return t||n?{banner:t,divider:n}:null}(t);t.headerLayout=e,t.children=gr(e,n,o,a);const l=!1!==t.showLogo,i=pr(t);let r=t;i?.id&&(r=mr(r,i.id,e=>({...e,hidden:!l})));const s=!0===r.showHeaderBanner,c=dr(r);c?.id&&(r=mr(r,c.id,e=>({...e,hidden:!s})));const d=ur(r);d?.id&&(r=mr(r,d.id,e=>({...e,hidden:!s}))),p(r)},options:b,getPopupContainer:re})}),le&&l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:c("logo_section")}),l.jsx(Bl,{layout:"toggle",label:c("show_logo"),children:l.jsx(wl,{checked:x,onChange:e=>{let t=B(u);t.showLogo=e;const n=m?.id;n&&(t=mr(t,n,t=>({...t,hidden:!e}))),p(t)}})}),x&&l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:c("image_url"),children:l.jsx(t.Input,{className:"width-full",value:S,placeholder:c("placeholder_https"),onChange:e=>X(t=>({...t,src:e.target.value}))})}),l.jsx(Bl,{label:c("logo_text"),children:l.jsx(t.Input,{className:"width-full",value:u.logoText??"",placeholder:c("brand_name_placeholder"),onChange:e=>ne({logoText:e.target.value})})}),l.jsx(Bl,{label:c("logo_alt"),children:l.jsx(t.Input,{className:"width-full",value:N,onChange:e=>X(t=>({...t,alt:e.target.value}))})}),l.jsx(Bl,{label:c("logo_link"),children:l.jsx(t.Input,{className:"width-full",value:I,placeholder:c("link_url_placeholder"),onChange:e=>X(t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})}),l.jsx(Bl,{label:c("logo_max_width"),children:l.jsx(t.InputNumber,{min:10,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:L,onFocus:e=>e?.target?.select?.(),onChange:e=>X(t=>({...t,styles:{...t.styles,desktop:{...t.styles?.desktop,width:`${e||50}%`}}}))})}),l.jsx(Bl,{label:c("logo_padding"),children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:T,onFocus:e=>e?.target?.select?.(),onChange:e=>X(t=>({...t,contentStyles:{...t.contentStyles,desktop:{...t.contentStyles?.desktop,paddingTop:e??12,paddingBottom:e??12,paddingLeft:e??12,paddingRight:e??12}}}))})})]})]}),l.jsx(Ll,{className:"margin-top-12",children:c("header_banner_section")}),l.jsx(Bl,{layout:"toggle",label:c("show_header_banner"),children:l.jsx(wl,{checked:v,onChange:e=>{let t=B(u);t.showHeaderBanner=e,e&&!dr(t)&&(t=function(e,t){const n=B(e),o={id:P(),name:t("image"),key:"image",headerBannerSlot:!0,src:"{{HeroBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},a={id:P(),name:t("divider"),key:"divider",headerBannerDividerSlot:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},l=!0===e.showHeaderBanner;o.hidden=!l,a.hidden=!l;const i={id:P(),name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[o,a]};return n.children=[...n.children||[],i],n}(t,c));const n=dr(t);n?.id&&(t=mr(t,n.id,t=>({...t,hidden:!e})));const o=ur(t);o?.id&&(t=mr(t,o.id,t=>({...t,hidden:!e}))),p(t)}})}),v&&h?l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:c("image_url"),children:l.jsx(t.Input,{className:"width-full",value:C,placeholder:c("placeholder_https"),onChange:e=>Q(t=>({...t,src:e.target.value}))})}),l.jsx(Bl,{label:c("image_alt"),children:l.jsx(t.Input,{className:"width-full",value:$,placeholder:c("image_alt_placeholder"),onChange:e=>Q(t=>({...t,alt:e.target.value}))})}),l.jsx(Bl,{label:c("link_url"),children:l.jsx(t.Input,{className:"width-full",value:R,placeholder:c("link_url_placeholder"),onChange:e=>Q(t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})})]}):null,ie&&l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:c("navigation")}),l.jsx("div",{className:"margin-top-12",children:M.map((e,n)=>l.jsxs("div",{className:"ee-header-nav-link-row",children:[l.jsx(t.Input,{className:"ee-header-nav-link-input",value:e.label,placeholder:c("page"),onChange:e=>ae(n,"label",e.target.value)}),l.jsx(t.Input,{className:"ee-header-nav-link-input",value:e.url,placeholder:c("link_url_placeholder"),onChange:e=>ae(n,"url",e.target.value)}),l.jsx("button",{type:"button",className:"ee-header-nav-remove-btn",onClick:()=>(e=>{ee(t=>({...t,list:(t.list||[]).filter((t,n)=>n!==e)}))})(n),"aria-label":c("tooltip_remove_link"),children:"×"})]},`header-nav-${n}-${e.label??""}`))}),l.jsxs("button",{type:"button",className:"ee-header-add-nav-link-btn",onClick:()=>{ee(e=>({...e,list:[...e.list||[],{label:c("default_nav_link_label"),url:"#",target:"_blank"}]}))},children:[l.jsx("span",{className:"ee-header-add-nav-link-btn-icon",children:"+"}),c("add_link")]}),l.jsx(Ll,{className:"margin-top-18",children:c("link_style")}),l.jsx(Bl,{label:c("color"),children:l.jsx(kl,{color:F,setColor:({hex:e})=>te({linkColor:e,color:e})})}),l.jsx(Bl,{label:c("size"),children:l.jsx(t.InputNumber,{min:10,max:24,className:"input-width ee-settings-input-affix",addonAfter:"px",value:U,onFocus:e=>e?.target?.select?.(),onChange:e=>te({fontSize:e??13})})}),l.jsx(Bl,{label:c("weight"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:D,onChange:e=>te({fontWeight:e}),options:y,getPopupContainer:re})}),l.jsx(Bl,{label:c("transform"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:E,onChange:e=>te({textTransform:e}),options:f,getPopupContainer:re})}),l.jsx(Bl,{label:c("spacing"),children:l.jsx(t.InputNumber,{min:0,max:1,step:.01,className:"input-width ee-settings-input-affix",addonAfter:"em",value:z,onFocus:e=>e?.target?.select?.(),onChange:e=>te({letterSpacing:e??0})})}),l.jsx(Bl,{label:c("gap"),children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:O,onFocus:e=>e?.target?.select?.(),onChange:e=>te({paddingLeft:e??8,paddingRight:e??8})})}),l.jsx(Bl,{layout:"toggle",label:c("underline"),children:l.jsx(wl,{checked:W,onChange:e=>ee(t=>({...t,linkUnderline:e}))})})]}),l.jsx(Ll,{children:c("container_settings")}),l.jsx(Bl,{label:c("background_color"),children:l.jsx(kl,{color:H,setColor:({hex:e})=>oe({contentBackground:e})})}),l.jsx(Bl,{layout:"toggle",label:c("border_bottom"),children:l.jsx(wl,{checked:K,onChange:e=>ne({showBorderBottom:e})})}),l.jsx(Bl,{label:c("mobile_layout"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:V,onChange:e=>ne({mobileLayout:e}),options:_,getPopupContainer:re})}),l.jsx(Bl,{label:c("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:G,paddingRight:q,paddingBottom:J,paddingLeft:Y},setPadding:oe})})]})};function br(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>br(e,t,n))}:e:e}function yr({columnCurrentItem:t,textBlockId:n}){const o=e.useContext($e),a=t?.id,i=o.blockMap?.[n],r=e.useMemo(()=>{if(!a||!n||!i||"text"!==i.key)return null;const e={id:i.id,data:i,type:"edit"};return{...o,currentItem:e,setCurrentItem:e=>{if(e?.id===n&&null!=e?.data){const l=br(B(t.data),n,()=>e.data),{blockMap:i}=Z([l]),r={...o.blockMap,...i};return o.setBlocks(r,o.rootOrder,`edit_${Date.now()}`),void o.setCurrentItem({...t,id:a,data:l})}o.setCurrentItem(e)}}},[o,t,a,i,n]);return r?l.jsx($e.Provider,{value:r,children:l.jsx(bi,{embedded:!0})}):null}function fr(e,t=[]){if(!e)return t;if("text"===e.key&&t.push(e),Array.isArray(e.children))for(const n of e.children)fr(n,t);return t}function _r(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>_r(e,t,n))}:e:e}const kr=()=>{const{blockMap:n,rootOrder:o,setBlocks:a,currentItem:i,setCurrentItem:r}=e.useContext($e),{t:s}=Zo(),{findStyleItem:c}=Kl(),d=e.useMemo(()=>[{value:"400",label:s("font_weight_regular")},{value:"500",label:s("font_weight_medium")},{value:"600",label:s("font_weight_semibold")},{value:"700",label:s("font_weight_bold")}],[s]),u=e.useMemo(()=>[{value:"dashed",label:s("dashed")},{value:"solid",label:s("solid")},{value:"dotted",label:s("dotted")},{value:"none",label:s("border_none")}],[s]),p=e.useMemo(()=>[{value:"left",label:s("table_align_left")},{value:"center",label:s("table_align_center")},{value:"right",label:s("table_align_right")}],[s]),m=i.data,g=m.discountVariant??"card",h="card"===g,b=e=>{const{blockMap:t}=Z([e]),l={...n,...t};a(l,o,`edit_${Date.now()}`),r({...i,data:e})},y=e=>{b({...B(m),...e})},f=e=>{const t=B(m);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),b(t)},_=(e,t)=>{b(_r(B(m),e,t))},k=fr(m),x=h?k[0]??null:null,v=h?k[1]??null:null,w=h?null:k[0]?.id,S=m.showTitle??!0,j=m.discountTitle??"{{DiscountValue}} off your first order",C=m.titleSize??22,N=String(m.titleWeight??"600"),I=m.discountCode??"{{DiscountCode}}",A=m.codeSize??16,L=m.codeSpacing??.08,T=m.codeBorder??"dashed",$=m.codeBorderWidth??1.5,R=m.codeBg??"none",P=m.codeRadius??4,M=c(m.styles,"contentBackground")??(h?"#D8FE91":"#ffa7aa"),F=c(m.styles,"color")??"#171717",U=m.discountAlign??"center",D=m.discountGap??14,E=c(m.styles,"paddingTop")??28,z=c(m.styles,"paddingRight")??24,O=c(m.styles,"paddingBottom")??28,W=c(m.styles,"paddingLeft")??24,H=()=>document.querySelector(".right-settings")||document.body,K=(e,t,n,o={})=>{if(!x)return;const a=void 0!==o.textColor?o.textColor:F,l=void 0!==o.discountAlign?o.discountAlign:U,i=void 0!==o.discountGap?o.discountGap:D;_(x.id,o=>({...o,text:`<p style="text-align:center;margin:0 0 0px"><span style="font-family:Arial;font-size:${t}px;font-weight:${n};color:${a}">${e}</span></p>`,styles:{...o.styles,desktop:{...o.styles?.desktop,fontSize:t,fontWeight:n,textAlign:l,paddingBottom:i}}}))},V=(e,t,n,o,a,l,i={})=>{if(!v)return;const r=void 0!==i.textColor?i.textColor:F,s=void 0!==i.codeBg?i.codeBg:R,c="none"!==s&&""!==s&&s?s:"transparent",d=void 0!==i.discountAlign?i.discountAlign:U,u="none"===o?"none":o,p="none"!==o?r:"transparent";_(v.id,i=>({...i,text:`<p style="text-align:center;margin:0"><span style="font-family:Arial;font-size:${t}px;letter-spacing:${n}em;color:${r}">${e}</span></p>`,styles:{...i.styles,desktop:{...i.styles?.desktop,fontSize:t,letterSpacing:n,textAlign:d,borderTopStyle:u,borderBottomStyle:u,borderLeftStyle:u,borderRightStyle:u,borderTopColor:p,borderBottomColor:p,borderLeftColor:p,borderRightColor:p,borderTopWidth:"none"!==o?`${a}px`:"0px",borderBottomWidth:"none"!==o?`${a}px`:"0px",borderLeftWidth:"none"!==o?`${a}px`:"0px",borderRightWidth:"none"!==o?`${a}px`:"0px",borderRadius:`${l}px`,display:"block",width:"fit-content",maxWidth:"100%",marginLeft:"auto",marginRight:"auto",backgroundColor:c}}}))};return l.jsxs("div",{className:"margin-y-30 ee-settings-block-form",children:[l.jsx(Ll,{children:s("layout")}),l.jsx(Bl,{label:s("style"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:g,onChange:e=>{const t="card"===e?"card":"simple";if(t===(m.discountVariant??"card"))return;const n=Jl("card"===t?"preset_discount":"preset_discount_simple");if(!n)return;const o=B(n);o.id=m.id,b(o)},options:[{value:"card",label:s("discount_variant_card")},{value:"simple",label:s("discount_variant_simple")}],getPopupContainer:H})}),!h&&w&&l.jsx(yr,{columnCurrentItem:i,textBlockId:w}),h&&l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:s("title")}),l.jsx(Bl,{layout:"toggle",label:s("discount_show_title"),children:l.jsx(wl,{checked:S,onChange:e=>{y({showTitle:e}),x&&_(x.id,t=>({...t,hidden:!e}))}})}),S&&l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:s("text"),children:l.jsx(t.Input,{className:"width-full",value:j,onChange:e=>{const t=e.target.value;y({discountTitle:t}),K(t,C,N)}})}),l.jsx(Bl,{label:s("size"),children:l.jsx(t.InputNumber,{min:12,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:C,onFocus:e=>e?.target?.select?.(),onChange:e=>{y({titleSize:e??22}),K(j,e??22,N)}})}),l.jsx(Bl,{label:s("weight"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:N,onChange:e=>{y({titleWeight:e}),K(j,C,e)},options:d,getPopupContainer:H})})]}),l.jsx(Ll,{children:s("discount_code_section")}),l.jsx(Bl,{label:s("text"),children:l.jsx(t.Input,{className:"width-full",value:I,onChange:e=>{const t=e.target.value;y({discountCode:t}),V(t,A,L,T,$,P)}})}),l.jsx(Bl,{label:s("size"),children:l.jsx(t.InputNumber,{min:10,max:32,className:"input-width ee-settings-input-affix",addonAfter:"px",value:A,onFocus:e=>e?.target?.select?.(),onChange:e=>{y({codeSize:e??16}),V(I,e??16,L,T,$,P)}})}),l.jsx(Bl,{label:s("spacing"),children:l.jsx(t.InputNumber,{min:0,max:1,step:.01,className:"input-width ee-settings-input-affix",addonAfter:"em",value:L,onFocus:e=>e?.target?.select?.(),onChange:e=>{y({codeSpacing:e??0}),V(I,A,e??0,T,$,P)}})}),l.jsx(Bl,{label:s("border_style"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:T,onChange:e=>{y({codeBorder:e}),V(I,A,L,e,$,P)},options:u,getPopupContainer:H})}),"none"!==T&&l.jsx(Bl,{label:s("border_width"),children:l.jsx(t.InputNumber,{min:.5,max:6,step:.5,className:"input-width ee-settings-input-affix",addonAfter:"px",value:$,onFocus:e=>e?.target?.select?.(),onChange:e=>{y({codeBorderWidth:e??1.5}),V(I,A,L,T,e??1.5,P)}})}),l.jsx(Bl,{label:s("discount_code_background"),children:l.jsx(kl,{color:"none"===R?"":R,setColor:({hex:e})=>{const t=e||"none";y({codeBg:t}),V(I,A,L,T,$,P,{codeBg:t})}})}),l.jsx(Bl,{label:s("discount_code_corner_radius"),children:l.jsx(t.InputNumber,{min:0,max:32,className:"input-width ee-settings-input-affix",addonAfter:"px",value:P,onFocus:e=>e?.target?.select?.(),onChange:e=>{y({codeRadius:e??4}),V(I,A,L,T,$,e??4)}})})]}),l.jsx(Ll,{children:s("container_settings")}),l.jsx(Bl,{label:s("background_color"),children:l.jsx(kl,{color:M,setColor:({hex:e})=>f({contentBackground:e})})}),h&&l.jsxs(l.Fragment,{children:[l.jsx(Bl,{label:s("text_color"),children:l.jsx(kl,{color:F,setColor:({hex:e})=>{f({color:e}),(e=>{h&&(K(j,C,N,{textColor:e}),V(I,A,L,T,$,P,{textColor:e}))})(e)}})}),l.jsx(Bl,{label:s("text_align"),children:l.jsx(t.Select,{className:"width-full ee-stack-control",value:U,onChange:e=>{y({discountAlign:e}),K(j,C,N,{discountAlign:e}),V(I,A,L,T,$,P,{discountAlign:e})},options:p,getPopupContainer:H})}),l.jsx(Bl,{label:s("gap"),children:l.jsx(t.InputNumber,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:D,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t=e??14;y({discountGap:t}),K(j,C,N,{discountGap:t})}})})]}),l.jsx(Bl,{label:s("label_padding"),children:l.jsx(Sl,{padding:{paddingTop:E,paddingRight:z,paddingBottom:O,paddingLeft:W},setPadding:f})})]})},xr=new Set(["header","discount"]),vr=()=>{const{currentItem:t}=e.useContext($e),n=t?.data?.key,o=t?.data?.containerType,a="column"===n,i=a&&"footer"===o,r=a&&!xr.has(o)&&"footer"!==o;return l.jsxs(l.Fragment,{children:[a&&"header"===o&&l.jsx(hr,{}),a&&"discount"===o&&l.jsx(kr,{}),i?l.jsx(rr,{}):null,r?l.jsx(si,{}):null,"text"===n&&l.jsx(bi,{}),"button"===n&&l.jsx(ki,{}),"divider"===n&&l.jsx(xi,{}),"spacer"===n&&l.jsx(wi,{}),"menu"===n&&l.jsx(Ni,{}),"image"===n&&l.jsx(Ii,{}),"video"===n&&l.jsx(Ai,{}),"avatar"===n&&l.jsx(Li,{}),"social_link"===n&&l.jsx(Fi,{}),"raw_html"===n&&l.jsx(Di,{}),"table"===n&&l.jsx(zi,{})]})},wr={error:{icon:o.faExclamationCircle,color:"#F87171",bg:"rgba(127, 29, 29, 0.35)",border:"rgba(248, 113, 113, 0.45)"},warning:{icon:o.faExclamationTriangle,color:"#fbbf24",bg:"rgba(251, 191, 36, 0.08)",border:"rgba(251, 191, 36, 0.25)"},info:{icon:o.faInfoCircle,color:"#60a5fa",bg:"rgba(96, 165, 250, 0.08)",border:"rgba(96, 165, 250, 0.25)"}},Sr=e=>{const t={},n=e=>{Array.isArray(e)&&e.forEach(e=>{e&&"object"==typeof e&&("text"===e.key&&"dynamic"===e.contentType&&(e.dynamicPrompt||e.dynamicSelectedContent)&&(t[e.id]={blockId:e.id,key:e.key,type:e.type||"p",prompt:e.dynamicPrompt??"",selectedContent:e.dynamicSelectedContent??"",options:e.dynamicOptions??[],variable:e.dynamicVariable??"",language:"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"}),Array.isArray(e.children)&&n(e.children))})};return n(e),t},jr=()=>{const{blockList:t,bodySettings:a,blockMap:i,setCurrentItem:r,setActionType:s,validationMarkers:c,ignoreValidationIssue:d,filterIgnoredValidationIssues:u}=e.useContext($e),{t:p}=Zo(),m=e.useMemo(()=>{const e=Do({blockList:t??[],bodySettings:a??null,aiContentRefs:Sr(t??[])});return"function"==typeof u?u(e):e},[t,a,u]),g=m.filter(e=>"error"===e.severity),h=m.filter(e=>"warning"===e.severity),b=m.filter(e=>"info"===e.severity),y=(e,t)=>{const o=wr[e.severity]||wr.info,a=`validation_${e.code}`,c=p(a),u=c&&c!==a?c:e.message,m=Boolean(e.blockId&&i?.[e.blockId]);return l.jsxs("div",{style:{padding:10,background:o.bg,border:`1px solid ${o.border}`,borderRadius:4,display:"flex",gap:10,marginBottom:8},children:[l.jsx(n.FontAwesomeIcon,{icon:o.icon,style:{width:14,height:14,color:o.color,flexShrink:0,marginTop:2}}),l.jsxs("div",{style:{flex:1,minWidth:0},children:[l.jsx("div",{style:{fontSize:12,fontWeight:700,color:o.color,textTransform:"none"},children:e.location||e.code||p(`compliance_severity_${e.severity}`)||e.severity}),l.jsx("div",{style:{fontSize:11,color:"var(--ee-foreground)",marginTop:2,lineHeight:1.5},children:u}),(m||"function"==typeof d)&&l.jsxs("div",{style:{marginTop:6,display:"flex",gap:8},children:[m&&l.jsx("button",{type:"button",onClick:()=>{var t;(t=e.blockId)&&i?.[t]&&(r({id:t,data:i[t],type:"edit"}),s("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(t)):String(t).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${e}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}))},style:{background:"transparent",border:"1px solid rgba(255,255,255,0.18)",color:"var(--ee-foreground)",padding:"3px 8px",borderRadius:999,fontSize:11,cursor:"pointer",fontFamily:"inherit"},children:p("export_validation_open_block")||"Open block"}),"function"==typeof d&&l.jsx("button",{type:"button",onClick:()=>d(e),style:{background:"transparent",border:"1px solid rgba(255,255,255,0.12)",color:"var(--ee-muted-foreground)",padding:"3px 8px",borderRadius:999,fontSize:11,cursor:"pointer",fontFamily:"inherit"},title:xo(e),children:p("ignore")})]})]})]},t)},f=0===m.length,_=e.useMemo(()=>{try{const e=to({blockList:t??[],bodySettings:a??{}}),n="undefined"!=typeof Blob?new Blob([e]).size:e.length;return Math.max(1,Math.round(n/1024))}catch{return 0}},[t,a]),k=e.useMemo(()=>{const e=t=>Array.isArray(t)?t.reduce((t,n)=>{if(!n||"object"!=typeof n)return t;return t+("raw_html"===n.key?1:0)+e(n.children)},0):0;return e(t??[])},[t]),x=Math.min(100,_/200*100),v=_>=102,w=!v&&_>=80,S=v?"#f87070":w?"#fbbf24":"var(--ee-primary)",j=v?"#f87070":w?"#fbbf24":"#C6F065",C=v?p("compliance_above_clip")||"Above clip threshold":w?p("compliance_near_clip")||"Approaching clip threshold":p("compliance_below_clip")||"Below clip threshold",N=l.jsxs(l.Fragment,{children:[l.jsx(Ll,{children:p("compliance_email_size")||"Email size"}),l.jsxs("div",{style:{padding:"10px 12px",background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:6},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[l.jsx("span",{style:{fontSize:12,color:"#A3A3A3",fontVariantNumeric:"tabular-nums"},children:p("compliance_approx_kb",{n:String(_)})}),l.jsx("span",{style:{fontSize:11,fontWeight:600,color:j,fontVariantNumeric:"tabular-nums"},children:C})]}),l.jsxs("div",{style:{position:"relative",height:6,background:"rgba(255,255,255,0.08)",borderRadius:99},children:[l.jsx("div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${x}%`,background:S,borderRadius:99,transition:"width 0.3s ease"}}),l.jsx("div",{style:{position:"absolute",left:"51%",top:-3,bottom:-3,width:1.5,background:"rgba(251,191,36,0.7)",borderRadius:1}})]}),l.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:6},children:l.jsxs("span",{style:{fontSize:10,color:"rgba(251,191,36,0.85)"},children:[102," KB clip"]})}),(v||w||k>0)&&l.jsxs("div",{style:{marginTop:8,padding:"6px 8px",background:v?"rgba(248,112,112,0.08)":"rgba(251,191,36,0.08)",border:"1px solid "+(v?"rgba(248,112,112,0.25)":"rgba(251,191,36,0.25)"),borderRadius:4,fontSize:11,color:v?"#f87070":"#fbbf24",lineHeight:1.5},children:[v&&l.jsx("div",{children:p("compliance_clip_reason_over")||"Gmail will clip this email. Reduce content or remove large blocks."}),w&&!v&&l.jsx("div",{children:p("compliance_clip_reason_near")||"Close to Gmail’s clip limit. Consider trimming content."}),k>0&&l.jsx("div",{style:{marginTop:v||w?4:0},children:p("compliance_clip_reason_raw_html",{n:String(k)})||`${k} raw HTML block${k>1?"s":""} — custom HTML is included verbatim and can significantly inflate email size.`})]})]})]});return l.jsxs("div",{style:{padding:"14px 14px 18px 14px"},children:[l.jsx(Ll,{className:"ee-settings-section-title--flush",children:p("compliance_preflight")||"Pre-flight"}),f?l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:12,background:"rgba(216, 254, 145, 0.08)",border:"1px solid rgba(216, 254, 145, 0.25)",borderRadius:4},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faCheckCircle,style:{width:16,height:16,color:"var(--ee-primary)"}}),l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:13,fontWeight:500},children:p("compliance_all_clear_title")}),l.jsx("div",{style:{fontSize:11,color:"var(--ee-muted-foreground)",marginTop:2},children:p("compliance_all_clear_desc")})]})]}):l.jsxs(l.Fragment,{children:[g.length>0&&l.jsxs("div",{style:{marginBottom:12},children:[l.jsxs("div",{className:"export-validation-errors-heading",style:{fontWeight:600,marginBottom:6,fontSize:12},children:[p("export_validation_errors")," (",g.length,")"]}),g.map((e,t)=>y(e,`e-${t}`))]}),h.length>0&&l.jsxs("div",{style:{marginBottom:12},children:[l.jsxs("div",{className:"export-validation-warnings-heading",style:{fontWeight:600,marginBottom:6,fontSize:12},children:[p("export_validation_warnings")," (",h.length,")"]}),h.map((e,t)=>y(e,`w-${t}`))]}),b.length>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"export-validation-info-heading",style:{fontWeight:600,marginBottom:6,fontSize:12},children:[p("export_validation_info")," (",b.length,")"]}),b.map((e,t)=>y(e,`i-${t}`))]})]}),N]})},Cr=({open:e,onUnlinkInstance:n,onKeepLinked:o,onClose:a})=>{const{t:i}=Zo(),r=()=>{o?.(),a?.()};return l.jsxs(t.Modal,{className:"ee-modal-dark",title:i("unlink_modal_title")||"Edit universal block",open:e,onCancel:r,footer:[l.jsx(t.Button,{onClick:r,children:i("unlink_modal_keep")||"Keep linked"},"keep"),l.jsx(t.Button,{type:"primary",danger:!0,onClick:()=>{n?.(),a?.()},children:i("unlink_modal_unlink")||"Unlink this copy"},"unlink")],width:440,destroyOnClose:!0,children:[l.jsx("p",{style:{color:"var(--ee-muted-foreground)",marginBottom:8},children:i("unlink_modal_body")||"This block is linked to a universal snippet. Editing it here will affect all uses of this block everywhere."}),l.jsx("p",{style:{color:"var(--ee-muted-foreground)"},children:i("unlink_modal_body2")||"Choose “Unlink this copy” to make an independent copy that only affects this template, or “Keep linked” to edit all instances together."})]})},Nr=({onSaveAsUniversal:a})=>{const{blockMap:i,rootOrder:r,setBlocks:s,currentItem:c,setCurrentItem:d,onSaveBlockAsGlobal:u}=e.useContext($e),{t:p}=Zo(),[m,g]=e.useState(!1),[h,b]=e.useState(!1),y=e.useRef(null);e.useEffect(()=>{if(!m)return;const e=e=>{y.current&&!y.current.contains(e.target)&&g(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[m]);const f=c?.id,_=f?i[f]:null;if(!f||!_)return null;const k=()=>g(!1),x="function"==typeof a||"function"==typeof u,v=Boolean(_?.universalBlockId);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{ref:y,className:"ee-block-actions-menu-wrap",onClick:e=>e.stopPropagation(),children:[l.jsx("button",{type:"button",className:"ee-block-actions-trigger",onClick:()=>g(e=>!e),"aria-haspopup":"true","aria-expanded":m,"aria-label":p("more_actions"),title:p("more_actions"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faEllipsisV})}),m&&l.jsxs("div",{className:"ee-block-actions-menu",role:"menu",children:[l.jsxs("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k();const e=za(i,r,f);e&&(s(e.nextMap,e.nextRootOrder,"add"),d({id:e.newId,data:e.selectionData,type:"edit"}))},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faCopy}),l.jsx("span",{children:p("layer_duplicate")})]}),x&&l.jsxs("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k(),"function"==typeof a&&a(_)},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faStar}),l.jsx("span",{children:p("save_as_universal")})]}),v&&l.jsxs("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k(),b(!0)},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faUnlink}),l.jsx("span",{children:p("unlink_universal")||"Unlink this copy"})]}),l.jsxs("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k();const e={..._,hidden:!_.hidden};s({...i,[f]:e},r,"edit")},children:[l.jsx(n.FontAwesomeIcon,{icon:_.hidden?o.faEye:o.faEyeSlash}),l.jsx("span",{children:_.hidden?p("layer_show"):p("layer_hide")})]}),l.jsx("div",{className:"ee-block-actions-divider","aria-hidden":!0}),l.jsxs("button",{type:"button",role:"menuitem",className:"ee-block-actions-item ee-block-actions-item-danger",onClick:()=>{k();const e=()=>{const e=Ka(i,r,f,p);e&&(s(e.nextMap,e.nextRootOrder,"delete"),d(null))};"column"===_.key&&Ha(i,f)?t.Modal.confirm({title:p("shortcut_delete_confirm_title"),content:p("shortcut_delete_confirm_desc"),okText:p("confirm"),cancelText:p("cancel"),wrapClassName:"ee-modal-dark",onOk:e}):e()},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faTrash}),l.jsx("span",{children:p("layer_delete")})]})]})]}),l.jsx(Cr,{open:h,onUnlinkInstance:()=>{const e={..._};delete e.universalBlockId,s({...i,[f]:e},r,`edit_${Date.now()}`),d({...c,data:e})},onKeepLinked:()=>{},onClose:()=>b(!1)})]})},Ir=({open:n,block:o,onCreate:a,onClose:i})=>{const{t:r}=Zo(),[s,c]=e.useState("");e.useEffect(()=>{n&&c("")},[n]);const d=()=>{s.trim()&&o&&a({name:s.trim(),block:o})};return l.jsxs(t.Modal,{className:"ee-modal-dark",title:r("universal_save_modal_title"),open:n,onCancel:i,footer:[l.jsx(t.Button,{onClick:i,children:r("cancel")},"cancel"),l.jsx(t.Button,{type:"primary",onClick:d,disabled:!s.trim(),children:r("universal_save_modal_confirm")},"save")],width:420,destroyOnClose:!0,children:[l.jsx("p",{style:{color:"var(--ee-muted-foreground)",marginBottom:12},children:r("universal_save_modal_subtitle")}),l.jsx(t.Input,{autoFocus:!0,value:s,placeholder:r("universal_save_modal_placeholder"),onChange:e=>c(e.target.value),onPressEnter:d})]})},Ar="content",Lr="styles",Tr="compliance",Br=()=>{const{currentItem:a,isDragStart:i,bodySettings:r,setBodySettings:s,setCurrentItem:c,setActionType:d,blockMap:u,rootOrder:p,validationMarkers:m,onSaveBlockAsGlobal:g,templateData:h}=e.useContext($e),[b,y]=e.useState(null),{t:f}=Zo(),_=e.useCallback(e=>e&&"object"==typeof e&&"column"===e.key&&e.id&&u[e.id]?ee(e.id,u)??e:e,[u]),k=e.useCallback(e=>{y(_(e))},[_]),x=e.useCallback(async({name:e,block:n})=>{try{"function"==typeof g&&await Promise.resolve(g({name:e,block:n})),t.message.success(String(f("universal_save_success")||"").replace("{{name}}",e)||`Saved "${e}" as universal`),y(null)}catch(e){console.error("[EmailEditor] onSaveBlockAsGlobal:",e);const n=f("universal_save_error")||"Could not save universal block",o="string"==typeof e?.message&&e.message.trim()?e.message.trim():"string"==typeof e?e:n;t.message.error(o||n)}},[g,f]);e.useEffect(()=>{const e=e=>{e.detail&&e.detail.block&&y(_(e.detail.block))};return window.addEventListener("ee:canvas-save-universal",e),()=>window.removeEventListener("ee:canvas-save-universal",e)},[_]);const v=e.useMemo(()=>tn(h),[h]),[w,S]=e.useState(Ar),j=e.useRef(null),C=m?Object.values(m).reduce((e,t)=>e+(t?.totalCount||0),0):0,N=e=>{if(!e)return o.faSquare;switch(e.key){case"column":{const t=e.containerType;return"product"===t?o.faCube:"discount"===t?o.faTag:Va(e)===Ga?o.faSquare:o.faColumns}case"text":{const t=(e.type||"p").toLowerCase();return/^h[1-6]$/.test(t)?o.faHeading:o.faFont}case"button":return o.faLink;case"image":return o.faImage;case"video":return o.faVideo;case"divider":return o.faGripLines;case"spacer":return o.faArrowsAltV;case"menu":return o.faBars;case"avatar":return o.faUser;case"social_link":return o.faShareAlt;case"raw_html":return o.faCode;case"table":return o.faTable;case"footer":return o.faEnvelopeOpenText;default:return o.faSquare}},I=()=>{if(!a?.id||!u[a.id])return[];const e=[a.id],t=new Set(e);let n=a.id;for(;;){const o=te(u,p,n);if(!o||t.has(o.containerId))break;e.unshift(o.containerId),t.add(o.containerId),n=o.containerId}return e.map(e=>({id:e,data:u[e]})).filter(e=>Boolean(e.data))},A=()=>{let e="Block";const t=a?.data.key;switch(t){case"text":{const t=(a?.data?.type||"p").toLowerCase();e=/^h[1-6]$/.test(t)?f("heading_settings"):f("text_settings");break}case"column":{const t=a?.data?.containerType;if("product"===t){e=f("block_product");break}if("header"===t){e=f("header_settings");break}if("discount"===t){e=f("discount_settings");break}if("footer"===t){e=f("footer_settings");break}if(Ja(a?.data)){e=f("additional_products_grid_layout");break}e=Va(a?.data)===qa?f("settings_title_column_layout"):f("container_settings");break}case"button":e=f("button_settings");break;case"divider":e=f("divider_settings");break;case"spacer":e=f("spacer_settings");break;case"menu":e=f("menu_settings");break;case"image":e=f("image_settings");break;case"video":e=f("video_settings");break;case"avatar":e=f("avatar_settings");break;case"social_link":e=f("social_link_settings");break;case"raw_html":e=f("raw_html_settings");break;case"table":e=f("table_settings");break;case"footer":e=f("footer_settings")}return e},L=e=>t=>{s({...r,styles:{...r.styles,[e]:t.hex}},"set_body_settings")},T=(e,t,n,o)=>l.jsx(Bl,{label:e,children:l.jsx(kl,{color:t,setColor:n,fallbackColor:o})}),B=()=>{const e=r.styles||{},n=e.headingColor||e.color||"#171717";return l.jsxs("section",{className:"right-panel-styles-section",children:[l.jsx("h3",{className:"right-panel-styles-section-title",children:f("type_styles_section")}),l.jsxs("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[l.jsx(Bl,{label:f("body_font_short"),children:l.jsx(t.Select,{className:"input-width",showSearch:!0,optionFilterProp:"label",value:on(e.fontFamily,h),onChange:e=>{return t=on(e,h),void s({...r,styles:{...r.styles,fontFamily:t}},"set_body_settings");var t},labelRender:({value:e})=>l.jsx("span",{children:an(e,h)}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:v.map(e=>({label:e.label,value:e.value}))})}),T(f("body_text_short"),e.color,L("color"),"#171717"),T(f("body_heading_short"),n,L("headingColor"),"#171717"),T(f("body_link_short"),e.linkColor||"#338AF3",L("linkColor"),"#338AF3")]})]})},$=()=>{const e=r.styles||{},n=J(r);return l.jsxs("section",{className:"right-panel-styles-section",children:[l.jsx("h3",{className:"right-panel-styles-section-title",children:f("document_section")}),l.jsxs("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[T(f("body_bg_color_short"),e.backgroundColor,L("backgroundColor"),"#F5F5F5"),T(f("body_content_bg_short"),e.contentBg??"#FFFFFF",L("contentBg"),"#FFFFFF"),l.jsx(Bl,{label:f("body_width_label"),children:l.jsx(t.InputNumber,{className:"input-width ee-settings-input-affix ee-body-width-number",addonAfter:"px",min:H,max:K,value:n,onChange:e=>s({...r,contentWidth:e,contentWidthMode:V.CUSTOM_PX},"set_body_settings")})})]})]})},R=()=>{const e=q(r),a=J(r),i=r.styles||{};return l.jsxs(l.Fragment,{children:[l.jsxs("section",{className:"right-panel-styles-section",children:[l.jsx("h3",{className:"right-panel-styles-section-title",children:f("email_styles_section")}),l.jsxs("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[T(f("body_bg_color_short"),i.backgroundColor,L("backgroundColor"),"#F5F5F5"),T(f("body_content_bg_short"),i.contentBg??"#FFFFFF",L("contentBg"),"#FFFFFF"),l.jsx(Bl,{label:l.jsxs("span",{children:[f("email_width_mode"),l.jsx(t.Tooltip,{title:f("full_bleed_tooltip"),children:l.jsx("span",{className:"ee-help-icon","aria-label":"Help",children:l.jsx(n.FontAwesomeIcon,{icon:o.faInfoCircle})})})]}),children:l.jsx(t.Select,{className:"input-width ee-width-mode-select",value:e,onChange:e=>s({...r,contentWidthMode:e},"set_body_settings"),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:[{value:V.EMAIL_WIDTH,label:f("email_width_default")},{value:V.CUSTOM_PX,label:f("custom_px")},{value:V.FULL_BLEED,label:f("full_bleed")}]})}),l.jsx(Bl,{label:f("custom_width_px"),children:l.jsx(t.InputNumber,{className:"input-width ee-settings-input-affix ee-body-width-number",addonAfter:"px",min:H,max:K,value:a,disabled:e===V.FULL_BLEED,onChange:e=>s({...r,contentWidth:e,contentWidthMode:V.CUSTOM_PX},"set_body_settings")})})]})]}),B(),l.jsxs("section",{className:"right-panel-styles-section",children:[l.jsx("h3",{className:"right-panel-styles-section-title",children:f("text_and_headings")}),l.jsx("div",{className:"right-panel-styles-section-body",children:l.jsx(Bl,{label:f("pre_header"),hint:f("pre_header_description"),children:l.jsx(t.Input,{value:r.preHeader,onChange:e=>s({...r,preHeader:e.target.value},"set_body_settings")})})})]}),l.jsxs("section",{className:"right-panel-styles-section",children:[l.jsx("h3",{className:"right-panel-styles-section-title",children:f("mobile_optimization")||"Mobile optimization"}),l.jsxs("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[l.jsxs("div",{className:"ee-settings-row",children:[l.jsx("span",{className:"ee-settings-row-label",children:f("stack_columns_on_mobile")||"Stack columns on mobile"}),l.jsx(wl,{checked:!1!==r.stackColumnsOnMobile,onChange:e=>s({...r,stackColumnsOnMobile:e},"set_body_settings")})]}),l.jsxs("div",{className:"ee-settings-row",children:[l.jsx("span",{className:"ee-settings-row-label",children:f("scale_font_on_mobile")||"Scale font on mobile"}),l.jsx(wl,{checked:!1!==r.scaleFontOnMobile,onChange:e=>s({...r,scaleFontOnMobile:e},"set_body_settings")})]})]})]})]})},P="undefined"!=typeof window&&"product-variables"===window.__eeDragSource,M=a&&"edit"===a.type&&(!i||P);e.useLayoutEffect(()=>{if(!M)return;S(Ar);const e=j.current;e&&(e.scrollTop=0)},[M,a?.id]);const F=()=>l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"right-panel-block-settings-header",children:[l.jsx("button",{type:"button",className:"right-panel-back-btn",onClick:()=>c(null),"aria-label":f("right_panel_back"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronLeft})}),l.jsx("span",{className:"ee-block-settings-header-icon","aria-hidden":!0,children:l.jsx(n.FontAwesomeIcon,{icon:N(a?.data)})}),l.jsx("h2",{className:"right-setting-block-title right-panel-block-title-inline",children:A()}),l.jsx(Nr,{onSaveAsUniversal:k})]}),l.jsxs("div",{className:"right-panel-layers-bar",children:[l.jsx("div",{className:"right-panel-layers-header",children:f("layers_panel")}),l.jsx("nav",{className:"right-panel-breadcrumbs-shell","aria-label":f("layers_panel"),children:l.jsx("ol",{className:"right-panel-breadcrumbs-trail",children:I().map((e,t,a)=>{const i=t===a.length-1,r=(e=>{if(!e)return"";switch(e.key){case"column":{const t=e.containerType;if("product"===t)return f("block_product");if("discount"===t)return f("block_discount");if("header"===t)return f("block_header");if("footer"===t)return f("block_footer");const n=Va(e);return f(n===Ga?"block_palette_section":n===qa?"block_palette_columns":"container")}case"text":{const t=(e.type||"p").toLowerCase();return/^h[1-6]$/.test(t)?f("heading"):f("text")}case"button":return f("button");case"image":return f("image");case"video":return f("video");case"divider":return f("divider");case"spacer":return f("spacer");case"menu":return f("menu");case"avatar":return f("avatar");case"social_link":return f("social_link");case"raw_html":return f("raw_html");case"table":return f("table");case"footer":return f("block_footer");case"empty":return f("drag_block_here");default:return e.name||"Block"}})(e.data),s=N(e.data);return l.jsxs("li",{className:"right-panel-breadcrumb-item right-panel-breadcrumb-crumb-slot",children:[t>0?l.jsx("span",{className:"right-panel-breadcrumb-sep","aria-hidden":!0,children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronRight})}):null,i?l.jsxs("span",{className:"right-panel-breadcrumb-segment right-panel-breadcrumb-current","aria-current":"page",children:[l.jsx("span",{className:"right-panel-breadcrumb-ancestor-icon right-panel-breadcrumb-current-icon",children:l.jsx(n.FontAwesomeIcon,{icon:s})}),l.jsx("span",{className:"right-panel-breadcrumb-label",children:r})]}):l.jsxs("button",{type:"button",className:"right-panel-breadcrumb-segment right-panel-breadcrumb-ancestor",onClick:(p=e.id,e=>{e.preventDefault(),e.stopPropagation();const t=u[p];t&&(c({id:p,data:t,type:"edit"}),d("edit"))}),children:[l.jsx("span",{className:"right-panel-breadcrumb-ancestor-icon",children:l.jsx(n.FontAwesomeIcon,{icon:s})}),l.jsx("span",{className:"right-panel-breadcrumb-label",children:r})]})]},`${e.id||"layer"}-${t}`);var p})})})]}),l.jsx("div",{className:"right-panel-block-settings-form",children:l.jsx(vr,{})})]});return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"right-settings",onClick:e=>{e.stopPropagation()},children:l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"right-panel-tabs",children:[l.jsx("button",{type:"button",className:"right-panel-tab "+(w===Ar?"right-panel-tab-active":""),onClick:()=>S(Ar),children:f("content")}),l.jsx("button",{type:"button",className:"right-panel-tab "+(w===Lr?"right-panel-tab-active":""),onClick:()=>S(Lr),children:f("styles")}),l.jsxs("button",{type:"button",className:"right-panel-tab "+(w===Tr?"right-panel-tab-active":""),onClick:()=>S(Tr),children:[f("compliance"),C>0&&l.jsx("span",{className:"right-panel-tab-badge","aria-label":f("compliance_tab_badge_label",{count:C>99?"99+":String(C)}),children:C>99?"99+":C})]})]}),l.jsxs("div",{ref:j,className:"right-panel-tab-content default-scrollbar"+(w===Ar&&M?" right-panel-tab-content--block-settings":""),children:[w===Ar&&(M?F():l.jsxs(l.Fragment,{children:[$(),B(),l.jsx("div",{className:"ee-content-empty-hint",children:f("right_panel_empty_hint")})]})),w===Lr&&R(),w===Tr&&l.jsx(jr,{})]})]})}),l.jsx(Ir,{open:Boolean(b),block:b,onCreate:x,onClose:()=>y(null)})]})},$r={column:o.faColumns,text:o.faFont,button:o.faMinusSquare,divider:o.faGripLines,spacer:o.faArrowsAltV,menu:o.faBars,image:o.faImage,social_link:o.faShareAltSquare,raw_html:o.faCode,table:o.faTable,video:o.faVideo,product:o.faCube,header:o.faWindowMaximize,footer:o.faWindowMinimize,discount:o.faTag},Rr={header:"header",footer:"footer",discount:"discount",product:"product",none:"product"};function Pr(e,t){const n=Rr[t];return n&&$r[n]?$r[n]:$r.product}const Mr=["text","image","button","divider","spacer","social_link","menu","table","video","raw_html"],Fr={[Ga]:o.faSquare,[qa]:o.faColumns};const Ur=({clearStyles:t,openConfigureColumnsModal:a})=>{const{setCurrentItem:i,setIsDragStart:r,setActionType:s,templateData:c,aiEnabled:d=!0}=e.useContext($e),{blockConfigsList:u}=Al(),{t:p}=Zo(),{blockItems:m,layoutItems:g}=function(e,t){const n=[];Mr.forEach(o=>{const a=e.find(e=>e.key===o);a&&("text"===o&&t?n.push({...a,ai:!0,contentType:"static",dynamicPrompt:"",dynamicSelectedContent:"",dynamicOptions:[],dynamicVariable:"",isPreset:!1}):n.push({...a,isPreset:!1}))});const o=[],a=e.find(e=>"column"===e.key&&e.layoutRole===Ga),l=e.find(e=>"column"===e.key&&e.layoutRole===qa);return a&&o.push({...a,isPreset:!1,paletteIcon:Fr[Ga],opensConfigureModal:!1}),l&&o.push({...l,isPreset:!1,paletteIcon:Fr[qa],opensConfigureModal:!0}),{blockItems:n,layoutItems:o}}(u,d),h=Vl.presets.filter(e=>!Gl.has(e.id)).map(e=>({key:e.id,name:e.presetName,icon:Pr(e.presetName,e.containerType),isPreset:!0,getColumn:()=>Jl(e.id)})),b=e=>{e.target.style.outline="",setTimeout(()=>{r(!1),t&&t()},50)},y=e=>t=>{const n=e.isPreset?B(e.getColumn(p,c)):B(e);i({id:null,data:n,type:"add"}),r(!0),t.target.style.outline="1px dashed var(--ee-primary)",s("add")},f=e=>{const t="boolean"==typeof e.opensConfigureModal?e.opensConfigureModal:Va(e)===qa;return l.jsxs("div",{className:"ee-blocks-palette-card",draggable:!0,onDragStart:y(e),onDragEnd:b,onClick:()=>{t&&a()},title:t?`${e.name} — ${p("configure_columns_hint")}`:e.name,children:[l.jsx(n.FontAwesomeIcon,{icon:e.paletteIcon||e.icon||$r[e.key]||o.faFont,className:"ee-blocks-palette-card-icon"}),l.jsx("span",{className:"ee-blocks-palette-card-label",children:e.name}),e.ai&&l.jsxs("span",{className:"ee-blocks-palette-card-ai",children:[l.jsx(n.FontAwesomeIcon,{icon:o.faStar,className:"ee-blocks-palette-card-ai-icon","aria-hidden":!0}),"AI"]})]},`palette-card-${e.key}-${e.layoutRole??"base"}`)};return l.jsxs("div",{className:"ee-blocks-palette",children:[l.jsx("div",{className:"ee-left-rail-section-title",children:p("blocks")}),l.jsx("div",{className:"ee-blocks-palette-grid",children:m.map(f)}),g.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"ee-left-rail-section-title",style:{paddingTop:16},children:p("layout")}),l.jsx("div",{className:"ee-blocks-palette-grid",children:g.map(f)})]}),h.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"ee-left-rail-section-title",style:{paddingTop:16},children:p("presets")}),l.jsx("div",{className:"ee-blocks-palette-rows",children:h.map(e=>l.jsxs("div",{className:"ee-blocks-palette-row",draggable:!0,onDragStart:y(e),onDragEnd:b,title:e.name,children:[l.jsx(n.FontAwesomeIcon,{icon:o.faGripVertical,className:"ee-blocks-palette-row-grip"}),l.jsx(n.FontAwesomeIcon,{icon:e.icon,className:"ee-blocks-palette-row-icon"}),l.jsx("span",{className:"ee-blocks-palette-row-label",children:e.name})]},e.key))})]})]})},Dr=({clearStyles:a})=>{const{universals:i=[],universalsLoading:r,setCurrentItem:s,setIsDragStart:c,setActionType:d,deleteUniversalEmailBlock:u}=e.useContext($e),{t:p}=Zo(),m=e=>t=>{const n=JSON.parse(JSON.stringify(e.block||{}));n&&"object"==typeof n&&(s({id:null,data:n,type:"add"}),c(!0),t.currentTarget.style.outline="1px dashed var(--ee-primary)",d("add"))},g=e=>{e.currentTarget.style.outline="",setTimeout(()=>{c(!1),a&&a()},50)};return l.jsxs("div",{className:"ee-universal-panel",children:[l.jsxs("div",{className:"ee-left-rail-section-title",children:[p("universal_saved_blocks"),r?l.jsx("span",{className:"ee-universal-loading",children:" · …"}):null]}),0===i.length?l.jsxs("div",{className:"ee-universal-empty",children:[p("universal_empty_state_line_1")," ",l.jsx(n.FontAwesomeIcon,{icon:o.faStar,style:{width:10,height:10,color:"var(--ee-primary)",verticalAlign:"middle"}})," ",p("universal_empty_state_line_2")]}):l.jsx("div",{className:"ee-universal-list",children:i.map(e=>{const a=String(e?.block?.containerType||e?.block?.key||"block").replace(/[-_]/g," "),i="none"===a.trim().toLowerCase()?p("block_palette_section"):a;return l.jsxs("div",{className:"ee-universal-item",draggable:!0,onDragStart:m(e),onDragEnd:g,title:e.name,children:[l.jsx(n.FontAwesomeIcon,{icon:o.faGripVertical,className:"ee-blocks-palette-row-grip"}),l.jsx(n.FontAwesomeIcon,{icon:o.faStar,className:"ee-universal-item-icon"}),l.jsxs("div",{className:"ee-universal-item-body",children:[l.jsx("div",{className:"ee-universal-item-name",children:e.name}),l.jsxs("div",{className:"ee-universal-item-meta",children:[i,null!=e.usedIn?` · ${p("universal_used_in_count").replace("{{count}}",String(e.usedIn))}`:""]})]}),"function"==typeof u?l.jsx("button",{type:"button",className:"ee-universal-item-delete","aria-label":p("universal_delete"),title:p("universal_delete"),onMouseDown:e=>e.stopPropagation(),onClick:n=>{n.preventDefault(),n.stopPropagation(),t.Modal.confirm({title:p("universal_delete_confirm_title"),content:p("universal_delete_confirm_body"),okButtonProps:{danger:!0},okText:p("universal_delete_confirm_ok"),cancelText:p("cancel"),wrapClassName:"ee-modal-dark",onOk:async()=>{try{await u(e.resourceId??e.id)}catch(e){throw t.message.error(e?.message||p("universal_save_error")||"Could not delete"),e}}})},children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash,className:"ee-universal-item-delete-icon"})}):null]},e.id)})})]})},Er={column:o.faColumns,text:o.faFont,button:o.faMinusSquare,divider:o.faGripLines,spacer:o.faArrowsAltV,menu:o.faBars,image:o.faImage,video:o.faVideo,social_link:o.faShareAltSquare,raw_html:o.faCode,table:o.faTable,avatar:o.faUser,empty:o.faSquare};function zr(e){return e?"column"===e.key?"product"===e.containerType?o.faCube:"discount"===e.containerType?o.faTag:Va(e)===Ga?o.faSquare:o.faColumns:Er[e.key]||o.faSquare:o.faSquare}function Or(e,t=28){const n=String(e??"").replace(/<[^>]+>/g,"").trim();return n?n.length>t?`${n.slice(0,t)}…`:n:null}function Wr(e,t){if("column"!==e?.key||"footer"!==e.containerType||!e.footerUnifiedLayout)return[];const n=[],a=(e,t,o,a)=>{n.push({segment:e,label:t,subtitle:Or(o),icon:a})};if(e.showDivider&&a("divider",t("footer_divider_above"),null,o.faGripLines),e.footerShowLogo&&a("logo",`${t("image")} · ${t("logo_section")}`,e.footerLogoAlt||"",o.faImage),e.showBrand&&a("brand",`${t("text")} · ${t("footer_label_brand")}`,e.brandName||"",o.faFont),e.showTagline&&a("tagline",`${t("text")} · ${t("brand_tagline")}`,e.brandTagline||"",o.faFont),e.showAddress&&a("address",`${t("text")} · ${t("address")}`,e.address||"",o.faFont),e.showSocial){const n=Nn(e.footerSocialList).map(e=>String(e.title||"").trim()).filter(Boolean);a("social",t("footer_social_platforms_heading"),n.length?n.slice(0,4).join(", "):null,o.faShareAltSquare)}if(e.showUnsubscribe){const n=[String(e.unsubscribeLinkLabel??"").trim(),String(e.preferencesLinkLabel??"").trim()].filter(Boolean).join(" · ");a("unsubscribe",`${t("menu")} · ${t("footer_toggle_unsubscribe")}`,n||null,o.faBars)}if(e.showSecondaryLinks){const n=In(e.secondaryLinks).map(e=>String(e.label||"").trim()).filter(Boolean);a("secondary",t("footer_secondary_links_heading"),n.length?n.slice(0,5).join(" · "):null,o.faBars)}return e.showCopyright&&a("copyright",`${t("text")} · ${t("copyright_text")}`,e.copyrightText||"",o.faFont),n}const Hr=()=>{const{blockMap:a,rootOrder:i,setBlocks:r,setCurrentItem:s,setActionType:c,currentItem:d,onSaveBlockAsGlobal:u}=e.useContext($e),{t:p}=Zo(),[m,g]=e.useState(null),[h,b]=e.useState(null),y=d?.id||null,f=e=>{if(!e||!a[e])return;let t=a[e];if("column"===t.key&&"footer"===t.containerType&&t.footerUnifiedLayout&&null!=t.footerSelectedSegment&&""!==t.footerSelectedSegment){const n={...t};delete n.footerSelectedSegment,r({...a,[e]:n},i,`edit_${Date.now()}`),t=n}s({id:e,data:t,type:"edit"}),c("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const t="function"==typeof window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${t}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})})},_=(e,t)=>{const n=a[e];if(!n)return;const o={...n,footerSelectedSegment:t};r({...a,[e]:o},i,`edit_${Date.now()}`),s({id:e,data:o,type:"edit"}),c("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const t="function"==typeof window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${t}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})})},k=(e,t)=>{const n=i.indexOf(e);if(-1===n)return;const o=[...i],l="up"===t?n-1:n+1;l<0||l>=o.length||([o[n],o[l]]=[o[l],o[n]],r(a,o,"move"))},x=(e,t)=>{const n=i.indexOf(e);if(-1===n)return;const o=[...i];o.splice(n,1);const l=t>n?t-1:t;o.splice(Math.max(0,Math.min(l,o.length)),0,e),r(a,o,"move")},v=(e,c,d,w,S)=>{if(!e)return null;const j=y===e.id,C=function(e){if(!e)return null;const t=e.text||e.title||e.list&&e.list[0]?.label||e.alt||e.html||"",n=String(t).replace(/<[^>]+>/g,"").trim();return n?n.length>24?`${n.slice(0,24)}…`:n:null}(e),N=function(e,t){if(!e)return"";switch(e.key){case"column":{const n=e.containerType;if("product"===n)return t("block_product");if("discount"===n)return t("block_discount");if("header"===n)return t("block_header");if("footer"===n)return t("block_footer");if("introduction"===n)return t("block_introduction");if("body"===n)return t("block_body");const o=Va(e);return t(o===Ga?"block_palette_section":o===qa?"block_palette_columns":"container")}case"text":return t("text");case"button":return t("button");case"image":return t("image");case"video":return t("video");case"divider":return t("divider");case"spacer":return t("spacer");case"menu":return t("menu");case"avatar":return t("avatar");case"social_link":return t("social_link");case"raw_html":return t("raw_html");case"table":return t("table")||"Table";case"empty":return t("drag_block_here");default:return e.name||"Block"}}(e,p),I=!!e.hidden,A=d&&m&&m!==e.id&&h===w;return l.jsxs("div",{children:[A&&l.jsx("div",{className:"ee-layer-drop-indicator","aria-hidden":!0}),l.jsxs("div",{className:Go("ee-layer-row",j&&"ee-layer-row-selected",I&&"ee-layer-row-hidden"),style:{paddingLeft:6+14*c},onClick:t=>{t.stopPropagation(),f(e.id)},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),f(e.id))},role:"button",tabIndex:0,draggable:d,onDragStart:t=>{if(d){t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",e.id)}catch{}g(e.id)}},onDragOver:t=>{if(!d||!m||m===e.id)return;t.preventDefault();const n=t.currentTarget.getBoundingClientRect(),o=t.clientY-n.top<n.height/2;b(o?w:w+1)},onDrop:e=>{if(!d||!m)return;e.preventDefault();x(m,h??w),g(null),b(null)},onDragEnd:()=>{g(null),b(null)},children:[l.jsx(n.FontAwesomeIcon,{icon:zr(e),className:"ee-layer-row-icon"}),l.jsxs("span",{className:"ee-layer-row-label",children:[N,C&&l.jsxs("span",{className:"ee-layer-row-sub",children:["· ",C]})]}),l.jsxs("div",{className:"ee-layer-row-actions",onClick:e=>e.stopPropagation(),children:[d&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"ee-layer-mini-btn",title:p("layer_move_up"),disabled:0===w,onClick:()=>k(e.id,"up"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronUp})}),l.jsx("button",{type:"button",className:"ee-layer-mini-btn",title:p("layer_move_down"),disabled:w===S-1,onClick:()=>k(e.id,"down"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faChevronDown})})]}),l.jsx("button",{type:"button",className:"ee-layer-mini-btn",title:p("layer_duplicate"),onClick:()=>(e=>{const t=za(a,i,e);t&&(r(t.nextMap,t.nextRootOrder,"add"),s({id:t.newId,data:t.selectionData,type:"edit"}))})(e.id),children:l.jsx(n.FontAwesomeIcon,{icon:o.faCopy})}),d&&"column"===e.key&&"function"==typeof u?l.jsx("button",{type:"button",className:"ee-layer-mini-btn ee-layer-save-universal",title:p("save_as_universal"),"aria-label":p("save_as_universal"),onClick:t=>{t.stopPropagation(),window.dispatchEvent(new CustomEvent("ee:canvas-save-universal",{detail:{block:e}}))},children:l.jsx(n.FontAwesomeIcon,{icon:o.faStar})}):null,l.jsx("button",{type:"button",className:"ee-layer-mini-btn ee-layer-mini-btn-danger",title:p("layer_delete"),onClick:()=>(e=>{const n=a[e];if(!n)return;const o=()=>{const t=Ka(a,i,e,p);t&&(r(t.nextMap,t.nextRootOrder,"delete"),s(null))};"column"===n.key&&Ha(a,e)?t.Modal.confirm({title:p("shortcut_delete_confirm_title"),content:p("shortcut_delete_confirm_desc"),okText:p("confirm"),cancelText:p("cancel"),wrapClassName:"ee-modal-dark",onOk:o}):o()})(e.id),children:l.jsx(n.FontAwesomeIcon,{icon:o.faTrash})})]}),l.jsx("button",{type:"button",className:"ee-layer-mini-btn ee-layer-row-vis",title:p(I?"layer_show":"layer_hide"),onClick:t=>{t.stopPropagation(),(e=>{const t=a[e];if(!t)return;const n={...a,[e]:{...t,hidden:!t.hidden}};r(n,i,"edit")})(e.id)},children:l.jsx(n.FontAwesomeIcon,{icon:I?o.faEyeSlash:o.faEye})})]}),"column"===e.key&&Array.isArray(e.cells)&&e.cells.map((t,n)=>{const o=t.childrenIds||[],i=e.cells.length>1;return l.jsxs("div",{children:[i&&l.jsx("div",{className:"ee-layer-cell-label",style:{paddingLeft:12+14*(c+1)},children:`${p("column")} ${n+1}`}),o.map(e=>{const t=a[e];return t&&"empty"!==t.key?v(t,c+2,!1,0,0):null})]},t.id||n)}),"column"===e.key&&"footer"===e.containerType&&e.footerUnifiedLayout&&Wr(e,p).map(({segment:t,label:o,subtitle:i,icon:r})=>{const s=a[e.id]||e,d=y===e.id&&s.footerSelectedSegment===t,u=c+2;return l.jsxs("div",{className:Go("ee-layer-row","ee-layer-row--footer-segment",d&&"ee-layer-row-selected"),style:{paddingLeft:6+14*u},role:"button",tabIndex:0,onClick:n=>{n.stopPropagation(),_(e.id,t)},onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),n.stopPropagation(),_(e.id,t))},children:[l.jsx(n.FontAwesomeIcon,{icon:r,className:"ee-layer-row-icon"}),l.jsxs("span",{className:"ee-layer-row-label",children:[o,i?l.jsxs("span",{className:"ee-layer-row-sub",children:["· ",i]}):null]})]},`${e.id}:footer-seg:${t}`)})]},e.id)};return l.jsxs("div",{className:"ee-layers-panel",onDragOver:e=>{m&&e.preventDefault()},onDrop:e=>{if(!m)return;e.preventDefault();const t=h??i.length;x(m,t),g(null),b(null)},children:[l.jsxs("div",{className:"ee-layers-header",children:[l.jsx("span",{children:p("layers")}),l.jsxs("span",{className:"ee-layers-header-count",children:[i.length," ",1===i.length?p("layer_one"):p("layer_many")]})]}),l.jsxs("button",{type:"button",className:Go("ee-layers-document",!y&&"ee-layers-document-active"),onClick:()=>s(null),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faFile}),l.jsx("span",{children:p("document")})]}),i.map((e,t)=>{const n=a[e];return v(n,1,!0,t,i.length)}),m&&h===i.length&&l.jsx("div",{className:"ee-layer-drop-indicator","aria-hidden":!0})]})},Kr=[{key:"full",label:"1 column",desc:"Full-width section"},{key:"1-1",label:"2 columns",desc:"Equal halves"},{key:"1-1-1",label:"3 columns",desc:"Equal thirds"},{key:"1-1-1-1",label:"4 columns",desc:"Equal quarters"},{key:"1-2",label:"1 : 2",desc:"Narrow + wide"},{key:"2-1",label:"2 : 1",desc:"Wide + narrow"},{key:"1-3",label:"1 : 3",desc:"Sidebar + body"},{key:"3-1",label:"3 : 1",desc:"Body + sidebar"},{key:"2-3",label:"2 : 3",desc:"Off-center"},{key:"3-2",label:"3 : 2",desc:"Off-center"},{key:"1-2-1",label:"1 : 2 : 1",desc:"Hero + edges"},{key:"2-1-1",label:"2 : 1 : 1",desc:"Lead + two"},{key:"1-1-2",label:"1 : 1 : 2",desc:"Two + lead"}],Vr=[{key:"6-col-equal",label:"6 cols equal",cols:6,parts:[1,1,1,1,1,1]},{key:"12-col-equal",label:"12 cols equal",cols:12,parts:[1,1,1,1,1,1,1,1,1,1,1,1]}],Gr=["A","B","C","D"],qr=["A","B","C","D","E","F","G","H","I","J","K","L"],Jr=({parts:e,rowCount:t})=>{const n=e.slice(0,Math.min(e.length,12)),o=Math.min(t,4);return l.jsxs("div",{className:"ee-grid-preview-wrap",children:[l.jsx("div",{className:"ee-grid-preview-heading",children:"Live preview"}),Array.from({length:o}).map((e,t)=>l.jsxs("div",{className:"ee-grid-preview-row",children:[l.jsx("div",{className:"ee-grid-preview-row-label",children:Gr[t]}),n.map((e,n)=>l.jsxs("div",{className:"ee-grid-preview-cell",style:{flex:e},children:[qr[n],Gr[t]]},n))]},t))]})},Yr=e=>{const t="full"===e?[1]:e.split("-").map(e=>parseInt(e,10)),n=t.reduce((e,t)=>e+t,0);return l.jsx("div",{className:"ee-layout-preview",children:t.map((e,t)=>l.jsx("span",{className:"ee-layout-preview-cell",style:{flex:e/n}},t))})};function Xr(e,t,n){const o=e[t]||e.full,a=e=>e&&"object"==typeof e?{...e,id:P(),...Array.isArray(e.children)?{children:e.children.map(a)}:{}}:e;return{id:P(),name:n("block_palette_columns"),key:"column",type:o.type,containerType:"none",layoutRole:qa,columnLayoutOnly:!0,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},children:(o.children||[]).map(a)}}const Zr=({open:a,onClose:i,columnRootId:r})=>{const{t:s}=Zo(),{columnsSetting:c}=Al(),{blockMap:d,rootOrder:u,setBlocks:p,setCurrentItem:m}=e.useContext($e),[g,h]=e.useState("1-1"),[b,y]=e.useState(1),[f,_]=e.useState(!1),[k,x]=e.useState("6-col-equal");e.useEffect(()=>{a&&(h("1-1"),y(1),_(!1))},[a]);const v=(()=>{if(f){const e=Vr.find(e=>e.key===k);return e?e.parts:[1]}return"full"===g?[1]:g.split("-").map(e=>parseInt(e,10))})();return l.jsxs(t.Modal,{className:"ee-modal-dark ee-configure-columns-modal",title:s("configure_columns_title"),open:a,onCancel:i,footer:[l.jsx(t.Button,{onClick:i,children:s("cancel")},"cancel"),l.jsx(t.Button,{type:"primary",onClick:()=>{const e=f?"full":g;let t=d,n=[...u];const o=r&&"column"===t[r]?.key?r:null;let a=null;for(let l=0;l<b;l++){const i=Xr(c,e,s);if(f){const e=Vr.find(e=>e.key===k);if(e){i.type=e.key;const t=e.cols,n=`${(100/t).toFixed(4)}%`;i.children=Array.from({length:t},(e,t)=>({id:P(),name:s("content"),key:"content",width:n,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{id:P(),name:s("drag_block_here"),key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}}]}))}}if(o&&0===l&&"column"===t[o]?.key){i.id=o,t=ce(t,o);const{blockMap:e}=Z([i]);t={...t,...e},a=o;continue}const{newBlockMap:r,rootId:d}=ue(t,i);d&&(t=r,n=[...n,d],a=d)}p(t,n,"add"),null!=a&&t[a]&&m({id:a,data:t[a],type:"edit"}),i()},children:s("configure_columns_insert")},"insert")],width:660,destroyOnClose:!0,children:[l.jsx("p",{style:{color:"var(--ee-muted-foreground)",marginBottom:14},children:s("configure_columns_subtitle")}),l.jsxs("div",{className:"ee-layout-tab-group",role:"tablist","aria-label":"Layout type",children:[l.jsx("button",{type:"button",role:"tab","aria-selected":!f,className:Go("ee-layout-tab",!f&&"ee-layout-tab-active"),onClick:()=>_(!1),children:s("standard_layout")||"Standard"}),l.jsx("button",{type:"button",role:"tab","aria-selected":f,className:Go("ee-layout-tab",f&&"ee-layout-tab-active"),onClick:()=>_(!0),children:s("grid_layout")||"6/12 Grid"})]}),f?l.jsx("div",{style:{display:"flex",gap:8},children:Vr.map(e=>l.jsxs("button",{type:"button",className:Go("ee-layout-card",k===e.key&&"ee-layout-card-active"),onClick:()=>x(e.key),style:{flex:1},children:[l.jsx("div",{className:"ee-layout-grid-mini-bar",children:e.parts.slice(0,6).map((e,t)=>l.jsx("span",{className:"ee-layout-grid-mini-cell"},t))}),l.jsx("div",{className:"ee-layout-card-label",children:e.label})]},e.key))}):l.jsx("div",{className:"ee-layout-grid",children:Kr.filter(e=>c[e.key]).map(e=>l.jsxs("button",{type:"button",className:Go("ee-layout-card",g===e.key&&"ee-layout-card-active"),onClick:()=>h(e.key),children:[Yr(e.key),l.jsx("div",{className:"ee-layout-card-label",children:e.label}),l.jsx("div",{className:"ee-layout-card-desc",children:e.desc})]},e.key))}),l.jsx(Jr,{parts:v,rowCount:b}),l.jsxs("div",{className:"ee-row-count-row",children:[l.jsx("span",{children:s("configure_columns_row_count")||"Rows to insert:"}),l.jsx(t.Button,{className:"ee-configure-stepper-btn",type:"default",size:"small",icon:l.jsx(n.FontAwesomeIcon,{icon:o.faMinus}),onClick:()=>y(e=>Math.max(1,e-1)),disabled:b<=1}),l.jsx("span",{className:"ee-row-count-value",children:b}),l.jsx(t.Button,{className:"ee-configure-stepper-btn",type:"default",size:"small",icon:l.jsx(n.FontAwesomeIcon,{icon:o.faPlus}),onClick:()=>y(e=>Math.min(4,e+1)),disabled:b>=4})]})]})},Qr="blocks",es="universal",ts="layers",ns=({clearStyles:t})=>{const{t:a}=Zo(),[i,r]=e.useState(Qr),[s,c]=e.useState(!1),[d,u]=e.useState(null);e.useEffect(()=>{const e=e=>{u(e?.detail?.rootId??null),c(!0)};return window.addEventListener(Ya,e),()=>window.removeEventListener(Ya,e)},[]);const p=[{id:Qr,label:a("blocks"),icon:o.faTh},{id:es,label:a("universal"),icon:o.faStar},{id:ts,label:a("layers"),icon:o.faLayerGroup}];return l.jsxs("aside",{className:"ee-left-rail","aria-label":"Editor sidebar",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[l.jsx("div",{className:"ee-left-rail-tabs",role:"tablist",children:p.map(e=>l.jsxs("button",{type:"button",role:"tab","aria-selected":i===e.id,className:Go("ee-left-rail-tab",i===e.id&&"ee-left-rail-tab-active"),onClick:()=>r(e.id),children:[l.jsx(n.FontAwesomeIcon,{icon:e.icon}),l.jsx("span",{children:e.label})]},e.id))}),l.jsxs("div",{className:"ee-left-rail-body",children:[i===Qr&&l.jsx(Ur,{clearStyles:t,openConfigureColumnsModal:()=>{u(null),c(!0)}}),i===es&&l.jsx(Dr,{clearStyles:t}),i===ts&&l.jsx(Hr,{})]}),l.jsx(Zr,{open:s,columnRootId:d,onClose:()=>{c(!1),u(null)}})]})},os=({open:n,issues:o,onClose:a,onExportAnyway:i})=>{const{setCurrentItem:r,setActionType:s,blockMap:c}=e.useContext($e),{t:d}=Zo(),u=e=>{var t;e?.blockId&&((t=e.blockId)&&c?.[t]&&(r({id:t,data:c[t],type:"edit"}),s("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(t)):String(t).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${e}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}),1)&&a())},p=(e,t)=>{const n=Boolean(e?.blockId),o=`validation_${e.code}`,a=d(o),i=a&&a!==o?a:e.message;return l.jsx("li",{className:"export-validation-issue-item",children:l.jsxs("button",{type:"button",className:"export-validation-issue-btn "+(n?"is-clickable":""),onClick:()=>u(e),disabled:!n,children:[l.jsx("span",{className:"export-validation-issue-copy",children:i}),n&&l.jsx("span",{className:"export-validation-issue-action",children:d("export_validation_open_block")||"Open block"})]})},t)},m=(o||[]).filter(e=>"error"===e.severity),g=(o||[]).filter(e=>"warning"===e.severity),h=(o||[]).filter(e=>"info"===e.severity);return l.jsxs(t.Modal,{className:"ee-modal-dark",title:d("export_validation_title"),open:n,onCancel:a,footer:[l.jsx(t.Button,{onClick:a,children:d("cancel")},"cancel"),l.jsx(t.Button,{type:"primary",onClick:i,children:d("export_anyway")},"export")],width:520,destroyOnClose:!0,children:[l.jsx("p",{style:{marginBottom:12},children:d("export_validation_issues_found")}),l.jsxs("div",{style:{maxHeight:360,overflowY:"auto"},children:[m.length>0&&l.jsxs("div",{style:{marginBottom:12},children:[l.jsxs("div",{className:"export-validation-errors-heading",style:{fontWeight:600,marginBottom:6},children:[d("export_validation_errors")," (",m.length,")"]}),l.jsx("ul",{className:"export-validation-issue-list",children:m.map((e,t)=>p(e,`e-${t}`))})]}),g.length>0&&l.jsxs("div",{style:{marginBottom:12},children:[l.jsxs("div",{className:"export-validation-warnings-heading",style:{fontWeight:600,marginBottom:6},children:[d("export_validation_warnings")," (",g.length,")"]}),l.jsx("ul",{className:"export-validation-issue-list",children:g.map((e,t)=>p(e,`w-${t}`))})]}),h.length>0&&l.jsxs("div",{children:[l.jsxs("div",{className:"export-validation-info-heading",style:{fontWeight:600,marginBottom:6},children:[d("export_validation_info")," (",h.length,")"]}),l.jsx("ul",{className:"export-validation-issue-list",children:h.map((e,t)=>p(e,`i-${t}`))})]})]})]})},{Option:as}=t.Select,ls=[{value:"none",label:"No payload"},{value:"profile",label:"Profile data"},{value:"event",label:"Event data"}],is=({open:n,onClose:o,onSend:a,templateName:i})=>{const{t:r}=Zo(),[s,c]=e.useState([]),[d,u]=e.useState(""),[p,m]=e.useState("none"),[g,h]=e.useState(!0),[b,y]=e.useState(!1),f=e=>{const t=String(e||"").trim();if(!t)return;const n=t.split(/[\s,;]+/).filter(Boolean);c(e=>{const t=new Set(e);return n.forEach(e=>t.add(e)),Array.from(t)}),u("")},_=e=>{c(t=>t.filter(t=>t!==e))},k=()=>{c([]),u(""),m("none"),h(!0),y(!1),o?.()};return l.jsx(t.Modal,{className:"ee-modal-dark",title:r("send_test_title")||"Send test email",open:n,onCancel:k,footer:[l.jsx(t.Button,{onClick:k,disabled:b,children:r("cancel")},"cancel"),l.jsx(t.Button,{type:"primary",onClick:async()=>{if(0!==s.length){y(!0);try{await Promise.resolve(a?.({recipients:s,payloadType:p,testPrefix:g,subjectPrefix:g?"[TEST] ":"",name:i||"Untitled template"})),k()}finally{y(!1)}}},loading:b,disabled:0===s.length,children:r("send_test_send")||"Send test"},"send")],width:480,destroyOnClose:!0,children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[l.jsxs("div",{children:[l.jsx("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:r("send_test_recipients")||"Recipients"}),l.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,minHeight:36,padding:"4px 8px",border:"1px solid var(--ee-border, #374151)",borderRadius:6,backgroundColor:"var(--ee-surface, #1a1a1a)",cursor:"text"},onClick:()=>document.getElementById("ee-send-test-input")?.focus(),children:[s.map(e=>l.jsx(t.Tag,{closable:!0,onClose:()=>_(e),style:{margin:2},children:e},e)),l.jsx(t.Input,{id:"ee-send-test-input",bordered:!1,value:d,style:{flex:1,minWidth:160,padding:0},placeholder:0===s.length?r("send_test_recipients_placeholder")||"name@example.com, another@example.com":"",onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"!==e.key&&","!==e.key&&" "!==e.key&&"Tab"!==e.key||(e.preventDefault(),f(d)),"Backspace"===e.key&&!d&&s.length>0&&_(s[s.length-1])},onBlur:()=>{d.trim()&&f(d)}})]}),l.jsx("div",{style:{fontSize:11,color:"var(--ee-muted-foreground)",marginTop:4},children:r("send_test_recipients_hint")||"Press Enter or comma to add each address."})]}),l.jsxs("div",{children:[l.jsx("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:r("send_test_payload")||"Payload context"}),l.jsx(t.Select,{style:{width:"100%"},value:p,onChange:m,getPopupContainer:()=>document.querySelector(".email-editor")||document.body,children:ls.map(e=>l.jsx(as,{value:e.value,children:r(`send_test_payload_${e.value}`)||e.label},e.value))})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 12px",borderRadius:6,backgroundColor:"var(--ee-surface, #1a1a1a)",border:"1px solid var(--ee-border, #374151)"},children:[l.jsxs("div",{children:[l.jsx("div",{style:{fontSize:13,fontWeight:500},children:r("send_test_prefix_label")||"[TEST] prefix"}),l.jsx("div",{style:{fontSize:12,color:"var(--ee-muted-foreground)"},children:r("send_test_prefix_hint")||"Prepends [TEST] to the subject line."})]}),l.jsx(t.Switch,{checked:g,onChange:h})]})]})})},rs=({templateName:a,onTemplateNameChange:i,onBack:r,onPreview:s,onSendTest:c,onSaveTemplate:d,onShowShortcuts:u,onSendTestIntent:p,onSaveTemplateIntent:m,saveStatusDetail:g,onExit:h,hideOverflowExportActions:b=!1})=>{const{previewMode:y,setPreviewMode:f,canUndo:_,canRedo:k,undo:x,redo:v,blockList:w,bodySettings:S,templateData:j,saveState:C,highContrastEditor:N,setHighContrastEditor:I,filterIgnoredValidationIssues:A}=e.useContext($e),{t:L}=Zo(),[T,B]=e.useState(!1),[$,R]=e.useState(a||""),[P,M]=e.useState(!1),[F,U]=e.useState(!1),[D,E]=e.useState([]),[z,O]=e.useState(null),[W,H]=e.useState(!1),[K,V]=e.useState(!1),[G,q]=e.useState(!1),[J,Y]=e.useState(""),[X,Z]=e.useState(!1),[Q,ee]=e.useState("desktop"),te=e.useRef(null);e.useEffect(()=>{X&&ee("desktop")},[X]);const ne=e.useMemo(()=>{if(!X)return{html:"",error:null};try{return{html:eo({bodySettings:S,blockList:w,templateData:j??void 0})??"",error:null}}catch(e){return console.error("[EmailEditor] HTML preview generation failed:",e),{html:"",error:L("html_email_preview_error")}}},[X,S,w,j,L]);e.useEffect(()=>{R(a||"")},[a]),e.useEffect(()=>{if(!P)return;const e=e=>{te.current&&!te.current.contains(e.target)&&M(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[P]);const oe=()=>{B(!1),"function"==typeof i&&$!==a&&i($)},ae=e.useCallback(e=>{const t={},n=(e,o=[])=>{Array.isArray(e)&&e.forEach(e=>{if(!e||"object"!=typeof e)return;const a={blockId:e.id??null,key:e.key??null,containerType:"column"===e.key?e.containerType??"none":null},l=[...o,a];if("text"===e.key&&"dynamic"===e.contentType){const n="string"==typeof e.dynamicPrompt?e.dynamicPrompt.trim():"",o="string"==typeof e.dynamicSelectedContent?e.dynamicSelectedContent.trim():"";if(!n&&!o)return;t[e.id]={blockId:e.id,path:l,key:e.key,type:e.type||"p",selectedContent:o,options:Array.isArray(e.dynamicOptions)?e.dynamicOptions:[],prompt:n,variable:e.dynamicVariable??"",language:"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"}}Array.isArray(e.children)&&n(e.children,l)})};return n(e,[]),t},[]),le=e.useCallback(e=>Array.isArray(e)?e.map(e=>{if(!e||"object"!=typeof e)return e;const{dynamicPrompt:t,dynamicOptions:n,dynamicSelectedContent:o,dynamicVariable:a,dynamicAiLanguage:l,staticTextBeforeAi:i,children:r,...s}=e;return{...s,children:le(r)}}):e,[]),ie=e.useCallback(()=>({blockList:le(w??[]),bodySettings:S??null,aiContentRefs:ae(w??[]),language:vo(w??[])}),[w,S,ae,le]),re=()=>{const e=ie(),t=JSON.stringify(e,null,2),n=new Blob([t],{type:"application/json"}),o=document.createElement("a");o.download=`${a||"email-template"}.json`,o.href=URL.createObjectURL(n),o.click()},se=()=>{const e=eo({bodySettings:S,blockList:w,templateData:j});if(null==e)return;const t=new Blob([e],{type:"text/html"}),n=document.createElement("a");n.download=`${a||"email-template"}.html`,n.href=URL.createObjectURL(t),n.click()},ce=async e=>{H(!0);try{const t=ie();let n=Do({blockList:t.blockList??[],bodySettings:t.bodySettings??null,aiContentRefs:t.aiContentRefs??{}});const o=await Ko(t.blockList??[]);if(n=[...n,...o],"function"==typeof A&&(n=A(n)),0===n.length)return void("html"===e?se():re());E(n),O(e),U(!0)}finally{H(!1)}},de=()=>{U(!1),E([]),O(null)},ue="function"==typeof p||"function"==typeof c,pe="function"==typeof m||"function"==typeof d,me="function"==typeof p,ge="function"==typeof m;return l.jsxs("header",{className:"ee-topbar",children:["function"==typeof r&&"function"!=typeof h&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:"ee-topbar-back",onClick:r,"aria-label":L("topbar_back_to_templates"),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faChevronLeft}),l.jsx("span",{children:L("topbar_back_to_templates")})]}),l.jsx("div",{className:"ee-topbar-divider","aria-hidden":!0})]}),l.jsxs("div",{className:"ee-topbar-breadcrumb",children:[l.jsx(n.FontAwesomeIcon,{icon:o.faEnvelope}),l.jsx("span",{children:L("topbar_breadcrumb_email")}),l.jsx(n.FontAwesomeIcon,{icon:o.faChevronRight,className:"ee-topbar-breadcrumb-sep"}),T?l.jsx("input",{autoFocus:!0,className:"ee-topbar-name-input",value:$,onChange:e=>R(e.target.value),onBlur:oe,onKeyDown:e=>{"Enter"===e.key?oe():"Escape"===e.key&&(R(a||""),B(!1))},"aria-label":L("topbar_rename_template")}):l.jsx("button",{type:"button",className:"ee-topbar-name-btn",onClick:()=>{"function"==typeof i&&B(!0)},title:"function"==typeof i?L("topbar_rename_template"):void 0,children:a||L("topbar_untitled_template")})]}),l.jsxs("div",{className:"ee-topbar-spacer",children:[(g||C)&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ee-topbar-status-cluster ee-topbar-status-cluster--lead",children:[l.jsx("span",{className:Go("header-save-state","saved"===C&&"header-save-state_saved","saving"===C&&"header-save-state_saving","unsaved"===C&&"header-save-state_unsaved","error"===C&&"header-save-state_error"),"aria-label":`save-state-${C}`,children:g||C&&(L(`save_state_${C}`)||C)}),"saved"===C&&l.jsx(n.FontAwesomeIcon,{icon:o.faCheckCircle,className:"ee-topbar-saved-check","aria-hidden":!0}),"saving"===C&&l.jsx(n.FontAwesomeIcon,{icon:o.faSpinner,spin:!0,className:"ee-topbar-saving-spinner","aria-hidden":!0})]}),l.jsx("div",{className:"ee-topbar-divider","aria-hidden":!0})]}),l.jsx("button",{type:"button",className:"ee-topbar-icon-btn",onClick:x,disabled:!_,title:L("undo"),"aria-label":L("undo"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faUndo})}),l.jsx("button",{type:"button",className:"ee-topbar-icon-btn",onClick:v,disabled:!k,title:L("redo"),"aria-label":L("redo"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faRedo})}),l.jsx("div",{className:"ee-topbar-divider","aria-hidden":!0}),l.jsxs("div",{className:"ee-topbar-segment",role:"tablist","aria-label":"Device preview",children:[l.jsx("button",{type:"button",role:"tab","aria-selected":"desktop"===y,className:Go("ee-topbar-segment-btn","desktop"===y&&"ee-topbar-segment-btn-active"),onClick:()=>f("desktop"),title:L("desktop"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faDesktop})}),l.jsx("button",{type:"button",role:"tab","aria-selected":"mobile"===y,className:Go("ee-topbar-segment-btn","mobile"===y&&"ee-topbar-segment-btn-active"),onClick:()=>f("mobile"),title:L("mobile"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faMobileAlt})})]}),l.jsx("button",{type:"button",className:"ee-topbar-icon-btn",onClick:()=>Z(!0),title:L("html_email_preview"),"aria-label":L("html_email_preview"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faEye})}),l.jsx("div",{className:"ee-topbar-divider","aria-hidden":!0}),ue&&l.jsxs("button",{type:"button",className:"ee-topbar-btn ee-topbar-btn-ghost ee-topbar-btn-send-test",onClick:()=>{"function"!=typeof p?"function"==typeof c&&V(!0):p()},title:L("send_test"),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faPaperPlane}),l.jsx("span",{className:"ee-topbar-btn-label",children:L("send_test")})]}),"function"==typeof s&&l.jsxs("button",{type:"button",className:"ee-topbar-btn ee-topbar-btn-outline",onClick:()=>{"function"==typeof s&&s()},title:L("preview"),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faExternalLinkAlt}),l.jsx("span",{className:"ee-topbar-btn-label",children:L("preview")})]}),pe&&l.jsxs("button",{type:"button",className:"ee-topbar-btn ee-topbar-btn-primary",onClick:()=>{"function"!=typeof m?"function"==typeof d&&q(!0):m()},title:L("save_template"),children:[l.jsx(n.FontAwesomeIcon,{icon:o.faSave}),l.jsx("span",{className:"ee-topbar-btn-label",children:L("save_template")})]}),l.jsxs("div",{className:"ee-topbar-overflow-wrap",ref:te,children:[l.jsx("button",{type:"button",className:"ee-topbar-icon-btn",onClick:()=>M(e=>!e),"aria-haspopup":"true","aria-expanded":P,"aria-label":L("more_actions"),title:L("more_actions"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faEllipsisV})}),P&&l.jsxs("div",{className:"ee-topbar-overflow-menu",role:"menu",children:[!b&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",disabled:W,onClick:()=>{M(!1),ce("json")},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faFileExport}),l.jsx("span",{children:L("export_json")})]}),l.jsxs("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",disabled:W,onClick:()=>{M(!1),ce("html")},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faFileCode}),l.jsx("span",{children:L("export_html")})]})]}),"function"==typeof u&&l.jsxs(l.Fragment,{children:[!b&&l.jsx("div",{className:"ee-topbar-overflow-divider","aria-hidden":!0}),l.jsxs("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",onClick:()=>{M(!1),u()},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faKeyboard}),l.jsx("span",{children:L("keyboard_shortcuts")})]})]}),"function"==typeof I&&l.jsxs("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",onClick:()=>{I(e=>!e),M(!1)},children:[l.jsx(n.FontAwesomeIcon,{icon:o.faAdjust}),l.jsx("span",{children:L(N?"high_contrast_off":"high_contrast_on")})]})]})]}),"function"==typeof h&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"ee-topbar-divider ee-topbar-divider-exit","aria-hidden":!0}),l.jsx("button",{type:"button",className:"ee-topbar-exit-btn",onClick:h,children:L("topbar_exit")||"Exit"})]})]}),l.jsx(t.Modal,{className:"ee-modal-dark ee-html-preview-modal",title:l.jsxs("div",{className:"ee-html-preview-modal-header-inner",children:[l.jsx("span",{className:"ee-html-preview-modal-title-text",children:L("html_email_preview_title")}),l.jsxs("div",{className:"ee-topbar-segment ee-html-preview-modal-segment",role:"tablist","aria-label":L("html_email_preview_device_aria"),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),children:[l.jsx("button",{type:"button",role:"tab","aria-selected":"desktop"===Q,className:Go("ee-topbar-segment-btn","desktop"===Q&&"ee-topbar-segment-btn-active"),onClick:()=>ee("desktop"),title:L("desktop"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faDesktop})}),l.jsx("button",{type:"button",role:"tab","aria-selected":"mobile"===Q,className:Go("ee-topbar-segment-btn","mobile"===Q&&"ee-topbar-segment-btn-active"),onClick:()=>ee("mobile"),title:L("mobile"),children:l.jsx(n.FontAwesomeIcon,{icon:o.faMobileAlt})})]})]}),open:X,onCancel:()=>Z(!1),footer:null,width:"min(960px, 96vw)",centered:!0,destroyOnClose:!0,children:ne.error?l.jsx("p",{className:"ee-html-preview-error",children:ne.error}):l.jsx("div",{className:Go("ee-html-preview-viewport","mobile"===Q&&"ee-html-preview-viewport--mobile"),children:l.jsx("iframe",{title:L("html_email_preview_title"),className:"ee-html-preview-iframe",sandbox:"allow-same-origin allow-popups allow-popups-to-escape-sandbox",srcDoc:ne.html})})}),l.jsx(os,{open:F,issues:D,onClose:de,onExportAnyway:()=>{"html"===z?se():"json"===z&&re(),de()}}),!me&&"function"==typeof c&&l.jsx(is,{open:K,templateName:a,onClose:()=>V(!1),onSend:e=>{if("function"!=typeof c)return;const t=ie();c({...t,name:a||"Untitled template",recipients:e.recipients,payloadType:e.payloadType,subjectPrefix:e.subjectPrefix})}}),!ge&&"function"==typeof d&&l.jsx(t.Modal,{className:"ee-modal-dark",title:L("save_template_title")||"Save template",open:G,onCancel:()=>{q(!1),Y("")},onOk:()=>{if("function"!=typeof d)return;const e=ie();d({...e,name:a||"Untitled template",category:J}),q(!1),Y("")},okText:L("save")||"Save",cancelText:L("cancel"),width:420,destroyOnClose:!0,children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[l.jsxs("div",{children:[l.jsx("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:L("template_name")||"Template name"}),l.jsx(t.Input,{value:a||L("topbar_untitled_template"),readOnly:!0})]}),l.jsxs("div",{children:[l.jsx("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:L("save_template_category")||"Category"}),l.jsx(t.Select,{style:{width:"100%"},value:J||void 0,placeholder:L("save_template_category_placeholder")||"Select or type a category…",allowClear:!0,showSearch:!0,onChange:e=>Y(e||""),getPopupContainer:()=>document.querySelector(".email-editor")||document.body,options:[{value:"promotional",label:L("category_promotional")||"Promotional"},{value:"transactional",label:L("category_transactional")||"Transactional"},{value:"newsletter",label:L("category_newsletter")||"Newsletter"},{value:"onboarding",label:L("category_onboarding")||"Onboarding"},{value:"announcement",label:L("category_announcement")||"Announcement"},{value:"other",label:L("category_other")||"Other"}]})]})]})})]})},ss=({keys:e,desc:t})=>l.jsxs("div",{className:"ee-shortcuts-row",children:[l.jsx("span",{className:"ee-shortcuts-row-desc",children:t}),l.jsx("kbd",{className:"ee-shortcuts-kbd",children:e})]}),cs=({open:e,onClose:n})=>{const{t:o}=Zo(),a=/Mac|iPhone|iPod|iPad/i.test("undefined"!=typeof navigator&&navigator.platform||"")?"⌘":"Ctrl";return l.jsxs(t.Modal,{wrapClassName:"ee-modal-dark ee-shortcuts-modal",title:o("shortcuts_modal_title"),open:e,onCancel:n,footer:null,width:520,destroyOnClose:!0,children:[l.jsx(ss,{keys:`${a} + S`,desc:o("shortcut_save")}),l.jsx(ss,{keys:`${a} + Z`,desc:o("shortcut_undo")}),l.jsx(ss,{keys:`${a} + Shift + Z / ${a} + Y`,desc:o("shortcut_redo")}),l.jsx(ss,{keys:`${a} + D`,desc:o("shortcut_duplicate")}),l.jsx(ss,{keys:`${a} + C`,desc:o("shortcut_copy_block")}),l.jsx(ss,{keys:`${a} + V`,desc:o("shortcut_paste_block")}),l.jsx(ss,{keys:"Delete / Backspace",desc:o("shortcut_delete_block")}),l.jsx(ss,{keys:"Esc",desc:o("shortcut_escape")}),l.jsx(ss,{keys:"?",desc:o("shortcut_cheat_sheet")}),l.jsx("p",{className:"ee-shortcuts-footnote",children:o("shortcuts_modal_footnote")})]})};function ds(e){return e&&"function"==typeof e.closest&&(e.closest('[data-type="empty-block-item"]')||e.closest('[data-type="empty-block"]')||e.closest('[data-type="drag-over-column"]')||e.closest('[data-type="block-item-move"]'))||e}const us=({language:n})=>{const{blockMap:o,rootOrder:a,setBlocks:i,currentItem:r,setCurrentItem:s,setIsDragStart:c,setLanguage:d,templateData:u,highContrastEditor:p,canUndo:m,canRedo:g,undo:h,redo:b,flushPendingRichText:y,onShortcutSave:f,templateName:_,onTemplateNameChange:k,onBack:x,onSaveTemplate:v,onSaveTemplateIntent:w,onSendTest:S,onSendTestIntent:j,saveStatusDetail:C,onExit:N,onPreview:I,hideOverflowExportActions:A}=e.useContext($e),{t:L}=Zo(),{getColumnConfig:T}=Al(),[B,$]=e.useState(!1),R=e=>{if(!e||"object"!=typeof e)return e;const t=u?.content?.products,n=u?.catalogProducts,o=u?.content?.primaryProductId,a=Array.isArray(t)&&t.length>0?t:Array.isArray(n)&&n.length>0?n:Yl,l=o?a.find(e=>e.id===o):a[0],i=l?a.filter(e=>e?.id!==l.id):a,r=e=>{if(!e||"object"!=typeof e)return e;const t=Array.isArray(e.children)?e.children.map(r):e.children;if("column"!==e.key||"product"!==e.containerType||!l)return{...e,children:t};const n=Math.max(Array.isArray(t)?t.length:0,Array.isArray(e.columnProducts)?e.columnProducts.length:0,1),o="additional"===e.productRole?"additional":"main",a=Array.from({length:n},(e,t)=>"main"===o||0===i.length?l:i[t%i.length]);return{...e,children:t,columnProducts:a}};return r(e)};e.useEffect(()=>{d(n)},[n,d]),e.useEffect(()=>{const e=e=>{const t=e.target;if(n=t,Boolean(n&&n.closest&&n.closest(".email-editor")))return!0;var n;const o=t===document.body||t===document.documentElement||"string"==typeof t?.id&&"root"===t.id;return Boolean(o&&document.querySelector(".email-editor"))},n=e=>"Backspace"===e.key||"Delete"===e.key||"Backspace"===e.code||"Delete"===e.code,l=l=>{if(!e(l))return;const c=l.metaKey||l.ctrlKey,d=l.key,u=(p=l.target,Boolean(p?.closest?.(".text-content_editable[contenteditable='true']")));var p;const _=(e=>{if(!e)return!1;const t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||Boolean(e.closest?.(".ant-input, .ant-input-number, textarea.ant-input, .ant-select-selection-search-input"))})(l.target),k=()=>{if(!r?.id||"add"===r.type)return!1;const e=r.id,n=o[e];if(!n)return!1;const c=()=>{const t=Ka(o,a,e,L);t&&(i(t.nextMap,t.nextRootOrder,"delete"),s(null))};return"column"===n.key&&Ha(o,e)?(l.preventDefault(),l.stopPropagation(),t.Modal.confirm({title:L("shortcut_delete_confirm_title"),content:L("shortcut_delete_confirm_desc"),okText:L("confirm"),cancelText:L("cancel"),wrapClassName:"ee-modal-dark",onOk:c}),!0):(l.preventDefault(),l.stopPropagation(),c(),!0)};if(c&&"s"===String(d).toLowerCase())"function"==typeof f&&(l.preventDefault(),l.stopPropagation(),f());else if(u){if("Escape"===d)return l.preventDefault(),l.stopPropagation(),y(),$(!1),"function"==typeof document.activeElement?.blur&&document.activeElement.blur(),void s(null);if(!c&&n(l)&&(e=>"function"==typeof e?.closest&&e.closest("[data-block-id]")?.getAttribute?.("data-block-id")||null)(l.target)===r?.id&&(()=>{const e=window.getSelection();if(!e?.rangeCount)return!1;const t=e.anchorNode;if(!t)return!1;const n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,o="function"==typeof n?.closest?n.closest(".text-content_editable[contenteditable='true']"):null;return!!o&&0===String(o.innerText||"").replace(/[\u200b\uFEFF]/g,"").replace(/\u00a0/g," ").replace(/[\t\n\r\f]/g,"").trim().length})())return y(),void k();if(c&&"z"===String(d).toLowerCase()&&!l.shiftKey){if(!m)return;return l.preventDefault(),l.stopPropagation(),y(),void h()}if(c&&("z"===String(d).toLowerCase()&&l.shiftKey||"y"===String(d).toLowerCase())){if(!g)return;return l.preventDefault(),l.stopPropagation(),y(),void b()}}else if(!_){if(c&&"z"===String(d).toLowerCase()&&!l.shiftKey){if(!m)return;return l.preventDefault(),y(),void h()}if(c&&("z"===String(d).toLowerCase()&&l.shiftKey||"y"===String(d).toLowerCase())){if(!g)return;return l.preventDefault(),y(),void b()}if(c&&"d"===String(d).toLowerCase()){if(!r?.id||"add"===r.type)return;l.preventDefault();const e=za(o,a,r.id);if(!e)return;return i(e.nextMap,e.nextRootOrder,"add"),void s({id:e.newId,data:e.selectionData,type:"edit"})}if(c&&"c"===String(d).toLowerCase()){if(!r?.id||"add"===r.type)return;l.preventDefault();const e=Ea(o,a,r.id);return void(e&&(Da.tree=e))}if(c&&"v"===String(d).toLowerCase()){if(!Da.tree)return;l.preventDefault();const e=r?.id&&o[r.id]?r.id:null,t=Wa(o,a,Da.tree,e);if(!t)return;return i(t.nextMap,t.nextRootOrder,"add"),void s({id:t.newId,data:t.selectionData,type:"edit"})}return"Escape"===d?(l.preventDefault(),$(!1),void s(null)):"?"===d||l.shiftKey&&"Slash"===l.code?(l.preventDefault(),void $(!0)):void(n(l)&&k())}};return document.addEventListener("keydown",l,!0),()=>document.removeEventListener("keydown",l,!0)},[o,a,r,i,s,m,g,h,b,y,f,L]);const P=()=>{const e=document.getElementsByClassName("block-drag-label-content");Array.from(e).forEach(e=>{e.children[0]&&(e.children[0].style.visibility="hidden")})},M=()=>{const e=document.getElementsByClassName("block-content-drag-label-content");Array.from(e).forEach(e=>{e.children[0]&&(e.children[0].style.visibility="hidden")})},F=()=>{document.querySelectorAll(".block-empty-content").forEach(e=>{e.style.border=""})},D=()=>{document.querySelectorAll('[data-type="empty-block"]').forEach(e=>{e.style.border=""})},E=()=>{document.querySelectorAll('[data-drag-hovered="true"]').forEach(e=>{delete e.dataset.dragHovered})},z=e=>{const t=e?.closest?.(".block-item[data-block-id], .block[data-block-id]")||null;document.querySelectorAll('[data-drag-hovered="true"]').forEach(e=>{e!==t&&delete e.dataset.dragHovered}),t&&(t.dataset.dragHovered="true")},O=()=>{P(),M(),F(),D(),E()},W=e.useCallback(e=>{e.preventDefault(),e.stopPropagation();const t=ds(e.target),{type:n}=t.dataset||{};switch(n){case"empty-block":P(),M(),E(),t.style.border="2px dashed var(--ee-drop-target-outline)";break;case"drag-over-column":{M(),z(t);const e=t.dataset.index,n=document.getElementsByClassName("block-drag-label-content");Array.from(n).forEach(t=>{const n=Number(t.dataset.index)===Number(e),o=t.querySelector(".block-move-top"),a=t.querySelector(".block-move-bottom");o&&(o.style.visibility=n?"visible":"hidden"),a&&(a.style.visibility=n?"visible":"hidden")});break}case"block-item-move":{P(),z(t);const e=t.dataset.dropKey,n=document.getElementsByClassName("block-content-drag-label-content");Array.from(n).forEach(t=>{t.dataset.dropKey===e?t.children[0].style.visibility="visible":t.children[0].style.visibility="hidden"});break}case"empty-block-item":P(),M(),z(t),t.classList?.contains("block-empty-content")&&(t.style.border="2px dashed var(--ee-drop-target-outline)");break;default:P(),M(),E()}},[]),H=(e,t)=>{const{blockMap:n,removedId:o}=ie(e,t.containerId,t.cellIndex,t.itemIndex);return{result:n,removedId:o}},K=(e,t,n,o)=>{const a=e[t];if(!a||a.cells[n].childrenIds.length>0)return e;const l=X(o("drag_block_here"));return{...e,[l.id]:l,[t]:{...a,cells:a.cells.map((e,t)=>t===n?{...e,childrenIds:[l.id]}:e)}}},V=(e,t,n)=>{if(!t||!n)return!1;if(t===n)return!0;const o=t=>{const a=e[t];if(!a||"column"!==a.key)return!1;for(const e of a.cells||[])for(const t of e.childrenIds||[]){if(t===n)return!0;if(o(t))return!0}return!1};return o(t)};return l.jsxs(l.Fragment,{children:[l.jsx(cs,{open:B,onClose:()=>$(!1)}),l.jsxs("div",{className:"email-editor"+(p?" ee-high-contrast":""),onDragOver:W,onDrop:e=>{e.preventDefault(),e.stopPropagation();const n=ds(e.target),{type:l}=n.dataset||{};E(),F(),D(),c(!1);const d="undefined"!=typeof window?window.__eeDragItemData:null,u=()=>{"undefined"!=typeof window&&(window.__eeDragItemData=null,window.__eeDragSource=null)},p="add"===r?.type&&null!=r?.data,m=p||d?"add":r?.type,g=p?function(e){if(!e||"object"!=typeof e)return e;const t="column"===e.key&&Array.isArray(e.children)&&e.children.length>0;if("column"===e.key&&Array.isArray(e.cells)&&e.cells.length>0&&!t){const t=de(e,e.blockMap||e.blockSnapshotMap||{});if(t?.blockMap&&t.rootId){const e=Q(t.blockMap,[t.rootId])[0];if(e)return U(e)}}return U(e)}(r.data):d?U(d):r?.data??null;if(g){switch(l){case"empty-block":{const e="column"===g.key?g:T(g),t=R(e),{newBlockMap:n,rootId:a}=ue(o,t);if(!a)return void u();i(n,[a],"add"),s({id:a,data:n[a],type:"edit"}),"add"===m&&"column"===n[a]?.key&&Va(n[a])===qa&&Xa(a);break}case"empty-block-item":{F();const e=n.dataset.containerId,l=Number(n.dataset.cellIndex),c=Number(n.dataset.itemIndex);if(!e)return void u();if("column"===g.key||"add"!==m&&r?.id&&"column"===o[r.id]?.key)return t.message.warning(L("section_nest_not_allowed")),u(),void O();let d={...o};if("add"===m){const t=U(g),n=R(t),{newBlockMap:o,rootId:r}=ue(d,n);if(!r)return void u();d=le(o,e,l,c,r),i(d,a,"add"),s({id:r,data:d[r],type:"edit"})}else{const t=r.id;if(V(d,t,e))return u(),void O();const n=te(d,a,t);if(!n)return void u();{const{result:t,removedId:o}=H(d,n);d=t?K(t,n.containerId,n.cellIndex,L):d,o&&(d=le(d,e,l,c,o))}i(d,a,"move"),s({...r,data:d[t]??r.data,type:"edit"})}break}case"drag-over-column":{const e=Number(n.dataset.index);let t,l=[...a],c={...o};if("add"===m){const n=U(g);if("column"===n.key){const o=R(n),{newBlockMap:a,rootId:i}=ue(c,o);if(!i)return void u();c=a,l.splice(e,0,i),t={id:i,data:c[i],type:"edit"}}else{const o=e>=l.length?l[l.length-1]:l[e],a=c[o];if(!a||"column"!==a.key)return void u();const{newBlockMap:i,rootId:r}=ue(c,n);if(!r)return void u();c=i;const s=0,d=c[o]?.cells?.[s],p=d?.childrenIds?.[0],m=p?c[p]:null;if("empty"===m?.key)c=le(c,o,s,0,r);else{c=re(c,o,s,d?.childrenIds?.length??0,r)}t={id:r,data:c[r],type:"edit"}}}else{const n=r.id,o=a.indexOf(n);if(-1===o)return void u();l.splice(o,1),l.splice(e>o?e-1:e,0,n),t={...r,type:"edit"}}i(c,l,"move"),s(t),"add"===m&&"column"===t?.data?.key&&Va(t.data)===qa&&Xa(t.id),setTimeout(()=>{const e=document.getElementsByClassName("block-drag-label-content");Array.from(e).forEach(e=>{const t=e.querySelector(".block-move-top");t&&(t.style.visibility="hidden")})},30);break}case"block-item-move":{const e=n.dataset.dropKey;if(!e)return void u();const[l,c,d]=e.split(":"),p=Number(c),h=Number(d);let b,y={...o};if("add"===m){if("column"===g.key)return t.message.warning(L("section_nest_not_allowed")),u(),void O();const e=U(g),n=R(e),{newBlockMap:o,rootId:a}=ue(y,n);if(!a)return void u();y=re(o,l,p,h,a),b={id:a,data:y[a],type:"edit"}}else{const e=r.id;if("column"===y[e]?.key)return t.message.warning(L("section_nest_not_allowed")),u(),void O();if(V(y,e,l))return u(),void O();const n=te(y,a,e);if(!n)return void u();const{blockMap:o,removedId:i}=ie(y,n.containerId,n.cellIndex,n.itemIndex);y=o;const s=y[n.containerId];if(s&&0===s.cells[n.cellIndex].childrenIds.length){const e=X(L("drag_block_here"));y={...y,[e.id]:e,[n.containerId]:{...s,cells:s.cells.map((t,o)=>o===n.cellIndex?{...t,childrenIds:[e.id]}:t)}}}let c=h;n.containerId===l&&n.cellIndex===p&&n.itemIndex<h&&(c=h-1),y=re(y,l,p,c,i),b={...r,type:"edit"}}i(y,a,"move"),s(b),setTimeout(()=>{const e=document.getElementsByClassName("block-content-drag-label-content");Array.from(e).forEach(e=>{e.children[0]&&(e.children[0].style.visibility="hidden")})},30);break}}u()}else u()},onDragLeave:e=>{const t=e.currentTarget,n=e.relatedTarget,o=ds(e.target);setTimeout(()=>{if(t&&t.contains(n))switch(o?.dataset?.type){case"empty-block":o.style.border="";break;case"empty-block-item":o?.classList?.contains("block-empty-content")&&(o.style.border="")}else O()},50)},children:[l.jsx(rs,{templateName:_,onTemplateNameChange:k,onBack:x,onSaveTemplate:v,onSaveTemplateIntent:w,onSendTest:S,onSendTestIntent:j,saveStatusDetail:C,onExit:N,onPreview:I,hideOverflowExportActions:A,onShowShortcuts:()=>$(!0)}),l.jsxs("div",{className:"email-editor-main",onClick:e=>{e.preventDefault(),e.stopPropagation(),s(null)},children:[l.jsx(ns,{clearStyles:O}),l.jsx(gl,{clearStyles:O}),l.jsx(Br,{clearStyles:O})]})]})]})},ps="markopolo-email-editor:undo:";const ms=e=>Array.isArray(e)?e.map(e=>e&&"object"==typeof e?{...e,children:ms(e.children)}:e):e&&"object"==typeof e?Object.values(e).map(e=>e&&"object"==typeof e?{...e,children:ms(e.children)}:e):[],gs=e=>{const t={},n=(e,o=[])=>{Array.isArray(e)&&e.forEach(e=>{if(!e||"object"!=typeof e)return;const a={blockId:e.id??null,key:e.key??null,containerType:"column"===e.key?e.containerType??"none":null},l=[...o,a];if("text"===e.key&&"dynamic"===e.contentType){const n="string"==typeof e.dynamicPrompt?e.dynamicPrompt.trim():"",o="string"==typeof e.dynamicSelectedContent?e.dynamicSelectedContent.trim():"";if(!n&&!o)return;t[e.id]={blockId:e.id,path:l,key:e.key,type:e.type||"p",selectedContent:o,options:Array.isArray(e.dynamicOptions)?e.dynamicOptions:[],prompt:n,variable:e.dynamicVariable??"",language:"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"}}Array.isArray(e.children)&&n(e.children,l)})};return n(e,[]),t},hs=e=>Array.isArray(e)?e.map(e=>{if(!e||"object"!=typeof e)return e;const{dynamicPrompt:t,dynamicOptions:n,dynamicSelectedContent:o,dynamicVariable:a,dynamicAiLanguage:l,staticTextBeforeAi:i,children:r,...s}=e;return{...s,children:hs(r)}}):e,bs=e.forwardRef(({defaultBlockList:t,defaultBodySettings:n,aiContentRefs:o,language:a="en",customLanguageLibraries:i,templateData:r,variableDefinitions:s,apiConfig:c={},aiEnabled:d=!0,saveState:u="saved",onChange:p,undoPersistenceKey:m=null,onShortcutSave:g,onSaveBlockAsGlobal:h,templateName:b="",onTemplateNameChange:y,onBack:f,onSaveTemplate:_,onSaveTemplateIntent:k,onSendTest:x,onSendTestIntent:v,saveStatusDetail:w,onExit:S,onPreview:j,hideOverflowExportActions:C=!1,universals:N=[]},I)=>{const[A,L]=e.useState(()=>{if("undefined"==typeof window)return!1;try{return"1"===window.localStorage.getItem("ee_high_contrast_editor")}catch{return!1}});e.useEffect(()=>{if("undefined"!=typeof window)try{window.localStorage.setItem("ee_high_contrast_editor",A?"1":"0")}catch{}},[A]),e.useEffect(()=>{var e;yt=(e=s)&&"object"==typeof e?e:bt,Ct()},[s]);const T=e.useMemo(()=>uo(c),[c]),[B,$]=e.useState([]),[R,P]=e.useState(!1),F=e.useCallback(async()=>{if(T?.companyId){P(!0);try{const e=await async function(e,t={}){const n=go(e),o=e?.companyId;if(!n||!o)return[];const a=new URLSearchParams({companyId:String(o),page:String(t.page??1),limit:String(t.limit??100)});null!=t.blockType&&String(t.blockType).trim()&&a.set("blockType",String(t.blockType)),"boolean"==typeof t.isActive&&a.set("isActive",String(t.isActive));const l=await fetch(`${n}?${a.toString()}`,{method:"GET",headers:{...e?.headers||{}}}),i=await l.text();let r;try{r=i?JSON.parse(i):{}}catch{return[]}if(!l.ok)return console.warn("[universal-email-blocks]",l.status,r),[];const s=r?.data;return Array.isArray(s)?s.map(bo).filter(Boolean):[]}(T,{limit:100});$(Array.isArray(e)?e:[])}catch(e){console.warn("[EmailEditor] universal email blocks fetch",e)}finally{P(!1)}}else $([])},[T]);e.useEffect(()=>{F()},[F]);const U=e.useMemo(()=>{const e=B??[],t=N??[];if(!T?.companyId)return t;const n=new Set;return e.filter(e=>{const t=String(e?.resourceId??e?.id??"");return!(!t||n.has(t))&&(n.add(t),!0)})},[T?.companyId,B,N]),D=e.useCallback(async e=>{T?.companyId&&(await async function(e,{name:t,block:n}){const o=go(e),a=e?.companyId;if(!o||!a)throw new Error("Universal blocks API: missing endpoint or companyId");const l=po(t,n,a),i=await fetch(o,{method:"POST",headers:ho(e),body:JSON.stringify(l)}),r=await i.text();let s;try{s=r?JSON.parse(r):{}}catch{s={message:r}}if(!i.ok)throw new Error(mo(s,i.status));return s?.data??s}(T,e),await F()),"function"==typeof h&&await Promise.resolve(h(e))},[T,h,F]),E=e.useCallback(async e=>{T?.companyId&&(await async function(e,t){const n=go(e),o=e?.companyId;if(!n||!o||!t)throw new Error("Universal blocks API: missing endpoint, companyId, or id");const a=new URLSearchParams({companyId:String(o)}),l=`${n}/${encodeURIComponent(String(t))}?${a}`,i=await fetch(l,{method:"DELETE",headers:{...e?.headers||{}}});if(204===i.status)return!0;if(!i.ok){const e=await i.text();let t;try{t=e?JSON.parse(e):{}}catch{t={message:e}}throw new Error(mo(t,i.status))}return!0}(T,e),await F())},[T,F]),z=t&&!Array.isArray(t)&&"object"==typeof t?t:null,O=z?z.blocks??z.blockList??[]:t,H=(K=O,Array.isArray(K)?K.map(e=>e&&"object"==typeof e?{...e,children:ms(e.children)}:e):K&&"object"==typeof K?Object.values(K).map(e=>e&&"object"==typeof e?{...e,children:ms(e.children)}:e):[]);var K;const V=o??z?.aiContentRefs??{},q=n??z?.bodySettings??Be.bodySettings,J=r??Be.templateData,Y=((e,t)=>{if(!Array.isArray(e))return e;const n=t?.content?.products;if(!Array.isArray(n)||0===n.length)return e;const o=t?.content?.primaryProductId,a=(o?n.find(e=>e?.id===o):n[0])??n[0]??Yl[0]??null;if(!a)return e;const l=n.filter(e=>e?.id!==a.id),i=e=>{if(!e||"object"!=typeof e)return e;const t=Array.isArray(e.children)?e.children.map(i):e.children;if("column"!==e.key||"product"!==e.containerType)return{...e,children:t};const n="additional"===e.productRole?"additional":"main",o=Math.max(Array.isArray(t)?t.length:0,Array.isArray(e.columnProducts)?e.columnProducts.length:0,1),r=Array.from({length:o},(e,t)=>"main"===n||0===l.length?a:l[t%l.length]);return{...e,children:t,columnProducts:r}};return e.map(i)})(H,J),X=function(e,t={}){const n=Array.isArray(e)?e:e&&"object"==typeof e?Object.values(e):null;if(!Array.isArray(n))return e;const o=n.map(e=>lo(e,t));return o.forEach(M),o}(Y,V),{blockMap:Q,rootOrder:te}=Z(X),ne=W(Q,J),oe=e.useMemo(()=>function(e){if("undefined"==typeof sessionStorage||!e)return null;try{const t=sessionStorage.getItem(ps+e);if(!t)return null;const n=JSON.parse(t);return n&&"object"==typeof n?{undoStack:Array.isArray(n.undoStack)?n.undoStack:[],redoStack:Array.isArray(n.redoStack)?n.redoStack:[]}:null}catch{return null}}(m),[m]),[ae,le]=e.useReducer(Ee,{...Be,blockMap:ne,rootOrder:te,blockList:X,bodySettings:{...q,contentWidth:G(q?.contentWidth)},languageLibraries:i,templateData:J,undoStack:oe?.undoStack??[],redoStack:oe?.redoStack??[]}),ie=e.useRef(null);e.useEffect(()=>{m&&function(e,t,n){if("undefined"!=typeof sessionStorage&&e)try{sessionStorage.setItem(ps+e,JSON.stringify({undoStack:t,redoStack:n}))}catch{}}(m,ae.undoStack,ae.redoStack)},[m,ae.undoStack,ae.redoStack]),e.useEffect(()=>{le(Ie(r??null,{skipUndo:!0}))},[r]);const[re,se]=e.useState([]);e.useEffect(()=>{if("undefined"==typeof document)return;const e=ae.blockList??[],t="ee-font-runtime-imports",n=document.getElementById(t)||Object.assign(document.createElement("style"),{id:t}),o=rn(e,ae.bodySettings,ae.templateData);n.textContent=o||"",n.parentNode||document.head.appendChild(n)},[ae.blockList,ae.bodySettings,ae.templateData]);const ce=e.useMemo(()=>new Set(re),[re]),de=e.useCallback(e=>(Array.isArray(e)?e:[]).filter(e=>!ce.has(xo(e))),[ce]),ue=e.useCallback(e=>{const t=xo(e);t&&se(e=>e.includes(t)?e:[...e,t])},[]),he=e.useCallback(()=>{const e=ae.blockList??[];return{blockList:hs(e),bodySettings:ae.bodySettings??null,aiContentRefs:gs(e),language:vo(e)}},[ae.blockList,ae.bodySettings]),ye=e.useMemo(()=>de(Do({blockList:ae.blockList??[],bodySettings:ae.bodySettings??null,aiContentRefs:gs(ae.blockList??[])})).filter(e=>e?.blockId&&("warning"===e.severity||"error"===e.severity||"info"===e.severity)).reduce((e,t)=>{const n=t.blockId,o=e[n]??{severity:t.severity,warningCount:0,errorCount:0,infoCount:0,totalCount:0,messages:[],issues:[]};return"error"===t.severity&&(o.errorCount+=1),"warning"===t.severity&&(o.warningCount+=1),"info"===t.severity&&(o.infoCount+=1),o.totalCount+=1,o.severity=o.errorCount>0?"error":o.warningCount>0?"warning":"info",o.messages.push(t.message),o.issues.push(t),e[n]=o,e},{}),[ae.blockList,ae.bodySettings,de]);e.useImperativeHandle(I,()=>({blockList:hs(ae.blockList??[]),bodySettings:ae.bodySettings,aiContentRefs:gs(ae.blockList??[]),actionType:ae.actionType,exportJson:he,filterIgnoredValidationIssues:de,ignoreValidationIssue:ue,focusBlock:e=>{if(!e||!ae.blockMap?.[e])return!1;const t=ae.blockMap[e],n="column"===t?.key?ee(e,ae.blockMap)??t:t;return le(Ne({id:e,data:n,type:"edit"})),le(Ce("edit")),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const t="function"==typeof window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/([ #;?%&,.+*~':\x22!^$\x5b\x5d()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${t}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}),!0},exportHtml:()=>eo({bodySettings:ae.bodySettings,blockList:ae.blockList,templateData:ae.templateData})}),[ae.blockList,ae.blockMap,ae.bodySettings,ae.actionType,ae.templateData,he,de,ue]),e.useEffect(()=>{"function"==typeof p&&"firstRender"!==ae.actionType&&p({blockList:hs(ae.blockList??[]),bodySettings:ae.bodySettings??null,aiContentRefs:gs(ae.blockList??[]),actionType:ae.actionType})},[ae.blockList,ae.bodySettings,ae.actionType,p]);const we=e.useCallback(e=>{le((e=>({type:ge,isDragStart:e}))(e))},[]),Ae=e.useCallback((e,t,n)=>{t&&le(Ce(t)),le(((e,t={})=>({type:fe,bodySettings:e,skipUndo:Boolean(t.skipUndo)}))(e,n||{}))},[]),Le=e.useCallback((e,t,n,o)=>{n&&le(Ce(n)),le(((e,t,n={})=>({type:me,blockMap:e,rootOrder:t,skipUndo:Boolean(n.skipUndo)}))(e,t,o||{}))},[]),Te=e.useCallback((e,t,n)=>{t&&le(Ce(t)),le(((e,t={})=>({type:pe,blockList:e,skipUndo:Boolean(t.skipUndo)}))(e,n||{}))},[]),Re=e.useCallback(e=>{le((e=>({type:be,previewMode:e}))(e))},[]),Pe=e.useCallback(e=>{le(Ne(e))},[]),Me=e.useCallback(e=>{le((e=>({type:_e,selectionRange:e}))(e))},[]),Fe=e.useCallback(e=>{le((e=>({type:ke,textRange:e}))(e))},[]),Ue=e.useCallback(e=>{le(Ce(e))},[]),De=e.useCallback(e=>{le((e=>({type:xe,language:e}))(e))},[]),ze=e.useCallback(e=>{le((e=>({type:ve,languageLibraries:e}))(e))},[]),Oe=e.useCallback((e,t)=>{le(Ie(e,t||{}))},[]),We=e.useCallback(()=>{try{ie.current?.()}catch{}},[]),He=e.useCallback(e=>(ie.current=e,()=>{ie.current===e&&(ie.current=null)}),[]),Ke=e.useCallback(()=>{We(),le({type:Se})},[We]),Ve=e.useCallback(()=>{We(),le({type:je})},[We]),Ge=e.useMemo(()=>({blockMap:ae.blockMap,rootOrder:ae.rootOrder,blockList:ae.blockList,actionType:ae.actionType,previewMode:ae.previewMode,currentItem:ae.currentItem,bodySettings:ae.bodySettings,isDragStart:ae.isDragStart,selectionRange:ae.selectionRange,textRange:ae.textRange,language:ae.language,languageLibraries:ae.languageLibraries,templateData:ae.templateData,apiConfig:T,validationMarkers:ye,ignoreValidationIssue:ue,aiEnabled:d,saveState:u,highContrastEditor:A,canUndo:ae.undoStack.length>0,canRedo:ae.redoStack.length>0,undo:Ke,redo:Ve,flushPendingRichText:We,registerRichTextFlush:He,onShortcutSave:g,onSaveBlockAsGlobal:D,templateName:b,onTemplateNameChange:y,onBack:f,onSaveTemplate:_,onSaveTemplateIntent:k,onSendTest:x,onSendTestIntent:v,saveStatusDetail:w,onExit:S,onPreview:j,hideOverflowExportActions:C,universals:U,universalsLoading:R,deleteUniversalEmailBlock:T?.companyId?E:void 0,setIsDragStart:we,setBodySettings:Ae,setBlocks:Le,setBlockList:Te,setPreviewMode:Re,setCurrentItem:Pe,setSelectionRange:Me,setTextRange:Fe,setActionType:Ue,setLanguage:De,setLanguageLibraries:ze,setTemplateData:Oe,setHighContrastEditor:L}),[ae.blockMap,ae.rootOrder,ae.blockList,ae.actionType,ae.previewMode,ae.currentItem,ae.bodySettings,ae.isDragStart,ae.selectionRange,ae.textRange,ae.language,ae.languageLibraries,ae.templateData,ae.undoStack.length,ae.redoStack.length,T,ye,ue,d,u,A,Ke,Ve,We,He,g,D,b,y,f,_,k,x,v,w,S,j,C,U,R,E,we,Ae,Le,Te,Re,Pe,Me,Fe,Ue,De,ze,Oe,L]);return l.jsx($e.Provider,{value:Ge,children:l.jsx(us,{language:a})})});const ys=["Product","Discount"],fs=["text","image","button"];function _s(e,t,n,o,a,l,i){if("column"===e.key&&e.containerType){const t=function(e){const t=e.toLowerCase();return"product"===t?"Product":"discount"===t?"Discount":"None"}(e.containerType),n=e.id??null;let r=o;"Product"===t&&(i.productIndex++,r=i.productIndex);for(const o of e.children??[])_s(o,t,n,r,a,l,i);return}if("content"===e.key){for(const r of e.children??[])_s(r,t,n,o,a,l,i);return}const r="dynamic"===e.contentType,s=ys.includes(t)&&fs.includes(e.key);if((r||s)&&n){let i=a.find(e=>e.containerId===n);i||(i={containerId:n,containerType:t,blocks:[]},a.push(i));const c=e.id?l[e.id]:void 0,d=function(e){return"image"===e.key?e.src??"":"button"===e.key?e.linkURL??"":e.text??""}(e);let u="";"Product"===t?u=function(e,t){const n=`product ${t}`;return e.includes("{{ProductImage}}")?`This block is meant for displaying the ${n} image`:e.includes("{{ProductName}}")?`This block is meant for displaying the ${n} name`:e.includes("{{ProductOldPrice}}")||e.includes("{{ProductNewPrice}}")?`This block is meant for displaying the ${n} original and discounted price`:e.includes("{{ProductPrice}}")||e.includes("{{ProductCurrency}}")?`This block is meant for displaying the ${n} price and currency`:e.includes("{{ProductDescription}}")?`This block is meant for displaying the ${n} description`:e.includes("{{ProductLink}}")?`This block is meant for displaying the ${n} link`:`This block is meant for displaying ${n} content`}(d,o):"Discount"===t&&(u=function(e){const t=[];return e.includes("{{DiscountValue}}")&&t.push("the discount value (e.g. 20% or $10)"),e.includes("{{DiscountCode}}")&&t.push("the discount/promo code"),e.includes("{{ValidUntil}}")&&t.push("the discount expiry date"),0===t.length?"This block is meant for displaying discount/offer information":`This block is meant for displaying ${t.join(", ")}`}(d));const p=c?.prompt||u,m=s&&!r;i.blocks.push({id:e.id??"",contentType:m||"dynamic"===e.contentType?"dynamic":"static",value:m?"":d,ai:{prompt:p,selectedSampleAiContent:m?"":c?.selectedContent??d}})}if(e.children)for(const r of e.children)_s(r,t,n,o,a,l,i)}const ks={text:"text",image:"src",button:"linkURL"};function xs(e,t){if(0===t.size)return!0;if(e.id&&t.has(e.id)){const n=t.get(e.id),o=ks[e.key];o&&(e[o]=n,t.delete(e.id))}if(e.children)for(const n of e.children)if(xs(n,t))return!0;return 0===t.size}var vs=Object.freeze({__proto__:null,jsonToHtml:function(e){return to(e)},normalizeJson:function(e){const t="string"==typeof e?JSON.parse(e):e,n=[],o=t.aiContentRefs||{},a={productIndex:0},l=t.blockList||[];for(const e of l)_s(e,"None",null,0,n,o,a);return{groups:n}},updateJsonWithMlContent:function(e,t){const n="string"==typeof e?JSON.parse(e):e,o=structuredClone(n),a=new Map;for(const e of t)e.variations.length>0&&a.set(e.nodeId,e.variations[0].value);const l=o.blockList||[];for(const e of l)if(xs(e,a))break;return o}});const ws=Object.freeze({keys:["content","catalogProducts","companyContext","brandContext","companyId"],description:"templateData drives placeholders, product columns, and menu/social sync. content.products + content.primaryProductId, when non-empty, override product column assignments on load. catalogProducts (optional array) is the KB/catalog list for the product picker and for newly added preset product blocks; it does not replace columnProducts in a saved template when content.products is empty. companyContext.navigation_links and companyContext.social_links sync into menu/social blocks; brandContext (including brand_color) resolves branding tokens and CTA/button fallback colors in HTML export."});exports.DEFAULT_EMAIL_TEMPLATE_ID=so,exports.DEFAULT_MARKOPOLO_API_BASE_V1=io,exports.DEFAULT_ML_GENERATION_API_BASE_V1=ro,exports.EmailEditor=bs,exports.TEMPLATE_DATA_SCHEMA=ws,exports.createDefaultTemplateData=function(e={}){const t={name:"",website:"",navigation_links:[],social_links:{}},n={brand_color:"#111111",logo_url:"",tagline:"",heroBanner:"",footerBanner:""},o=null;return{content:{...{products:[],primaryProductId:null},...e.content&&"object"==typeof e.content?e.content:{}},companyContext:{...t,...e.companyContext&&"object"==typeof e.companyContext?e.companyContext:{}},brandContext:{...n,..."string"==typeof e.brandColor&&e.brandColor.trim()?{brand_color:e.brandColor.trim()}:{},...e.brandContext&&"object"==typeof e.brandContext?e.brandContext:{}},companyId:null!=e.companyId?e.companyId:o}},exports.default=bs,exports.exportNormalizerToHtml=to,exports.exportTemplateJson=function(e,t={}){const{validate:n=!0}=t,o=e?.current;if(!o||"function"!=typeof o.exportJson)throw new Error("exportTemplateJson: ref must be attached to EmailEditor (expected ref.current.exportJson to be a function).");const a=o.exportJson();if(!a||"object"!=typeof a)throw new Error("exportTemplateJson: exportJson() returned an invalid payload.");return{payload:a,issues:n?Do({blockList:a.blockList,bodySettings:a.bodySettings,aiContentRefs:a.aiContentRefs}):[]}},exports.exportTemplateJsonAsync=async function(e,t={}){const{validate:n=!0,checkImages:o=!0,imageProbe:a}=t,l=e?.current;if(!l||"function"!=typeof l.exportJson)throw new Error("exportTemplateJsonAsync: ref must be attached to EmailEditor (expected ref.current.exportJson to be a function).");const i=l.exportJson();if(!i||"object"!=typeof i)throw new Error("exportTemplateJsonAsync: exportJson() returned an invalid payload.");return n?{payload:i,issues:o?await Vo({blockList:i.blockList,bodySettings:i.bodySettings,aiContentRefs:i.aiContentRefs},a):Do({blockList:i.blockList,bodySettings:i.bodySettings,aiContentRefs:i.aiContentRefs})}:{payload:i,issues:[]}},exports.mergeMarkopoloApiConfig=uo,exports.utils=vs,exports.validateExportPayload=Do,exports.validateExportPayloadComplete=Vo,exports.validateImageUrlsReachable=Ko,exports.validateTemplateDataShape=function(e){const t=[];if(null==e||"object"!=typeof e)return{ok:!1,warnings:["templateData must be a non-null object"]};const n=e;if(null!=n.content&&"object"!=typeof n.content)t.push("templateData.content should be an object when provided");else if(n.content&&"object"==typeof n.content){const e=n.content;null==e.products||Array.isArray(e.products)||t.push("templateData.content.products should be an array when provided")}if(null==n.catalogProducts||Array.isArray(n.catalogProducts)||t.push("templateData.catalogProducts should be an array when provided"),null!=n.companyContext&&"object"!=typeof n.companyContext&&t.push("templateData.companyContext should be an object when provided"),null!=n.brandContext&&"object"!=typeof n.brandContext&&t.push("templateData.brandContext should be an object when provided"),n.brandContext&&"object"==typeof n.brandContext){const e=n.brandContext;null!=e.brand_color&&"string"!=typeof e.brand_color&&t.push("templateData.brandContext.brand_color should be a string when provided")}return{ok:0===t.length,warnings:t}};
|