useblocks 1.1.102 → 1.1.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/{iframe-eblock.1c4e77a0.html → iframe-eblock.b65837b7.html} +2 -2
- package/iframe/{iframe.1c4e77a0.html → iframe.b65837b7.html} +2 -2
- package/iframe/js/{discussHandlers.Xh4-JUcT.js → discussHandlers.B36tbVEC.js} +44 -44
- package/iframe/js/{iframe-eblock.body.1c4e77a0.js → iframe-eblock.body.b65837b7.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.1c4e77a0.js → iframe.body.b65837b7.js} +3 -3
- package/iframe/js/iframe.js +2 -2
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{b7aa9fec.js → 20098caa.js} +1 -1
- package/static/core/{1b68c0f0.js → 29993987.js} +1 -1
- package/static/core/{6a671446.js → 2a85f6f1.js} +1 -1
- package/static/core/{edf450a1.js → 348ec5fd.js} +1 -1
- package/static/core/{26cc947d.js → 3501b0a6.js} +1 -1
- package/static/core/{11b821ed.js → 36448ec6.js} +1 -1
- package/static/core/{5e7c221f.js → 41dd8b28.js} +13 -13
- package/static/core/{44d2c046.js → 47bde21f.js} +1 -1
- package/static/core/{f1ee2bef.js → 50c87f51.js} +1 -1
- package/static/core/{a98b6879.js → 5c36eb62.js} +1 -1
- package/static/core/{f323e60e.js → 5d7aff4e.js} +1 -1
- package/static/core/{5d849eef.js → 63f26591.js} +1 -1
- package/static/core/{3ec42945.js → 68650ff2.js} +1 -1
- package/static/core/{cc180859.js → 69cf8e2c.js} +1 -1
- package/static/core/{ca4dad9b.js → 6b904901.js} +2 -2
- package/static/core/{3fb172c7.js → 8288f720.js} +1 -1
- package/static/core/{91e07171.js → a013bc08.js} +1 -1
- package/static/core/{a2e57e5f.js → aa3448fe.js} +1 -1
- package/static/core/{448f03f8.js → b7d1fefc.js} +1 -1
- package/static/core/{53103851.js → c9a4d1ef.js} +2 -2
- package/static/core/{ae22b7f6.js → d74756b9.js} +1 -1
- package/static/core/{b653f9c5.js → defdbce4.js} +1 -1
- package/static/core/{64be048b.js → ed8a3337.js} +1 -1
- package/static/core/{847338a8.js → f8819751.js} +1 -1
- package/static/core/{d7666ad0.js → fd8197a8.js} +1 -1
- package/static/umd-runtime/{runtime.2paN090q.js → runtime.D3aKaKTc.js} +1 -1
- package/useblocks-core.b65837b7.js +859 -0
- package/useblocks-esm.js +6 -6
- package/{useblocks-po.1c4e77a0.js → useblocks-po.b65837b7.js} +1 -1
- package/useblocks.d.ts +31 -6
- package/useblocks.js +6 -6
- package/vendor/useblocks-ui-kit/package.json +1 -1
- package/useblocks-core.1c4e77a0.js +0 -859
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__useblocks__.define("js/iframe.js",["require","exports","module","js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.Xh4-JUcT.js"],function(To,eb,tb){const Gi=To("./rolldown-runtime.BRlIiq3h.js"),a=To("./discussHandlers.Xh4-JUcT.js");var Ct=null;function Lo(e){const o=window.getSelection();if(o&&o.rangeCount>0){const t=o.getRangeAt(0);if(e.contains(t.startContainer))return{container:t.startContainer,offset:t.startOffset}}return Ct&&Ct.container.isConnected&&e.contains(Ct.container)?Ct:null}function Yi(e){const o=[],t=Array.from(e.childNodes);let n=[],r=0;return t.forEach((i,l)=>{i.nodeType===Node.ELEMENT_NODE&&i.tagName==="BR"?(n.length>0&&o.push({html:jt(n),nodes:[...n],startIndex:r,endIndex:l-1}),n=[],r=l+1):n.push(i)}),n.length>0&&o.push({html:jt(n),nodes:[...n],startIndex:r,endIndex:t.length-1}),o}function Ki(e){const o=[],t=Array.from(e.childNodes);let n=[],r=0;const i=s=>{n.length>0&&(o.push({html:jt(n),nodes:[...n],startIndex:r,endIndex:s-1}),n=[])},l=s=>s.nodeType===Node.ELEMENT_NODE&&(s.tagName==="UL"||s.tagName==="OL");return t.forEach((s,c)=>{s.nodeType===Node.ELEMENT_NODE&&s.tagName==="BR"?(i(c),r=c+1):l(s)?(i(c),o.push({html:jt([s]),nodes:[s],startIndex:c,endIndex:c}),r=c+1):n.push(s)}),i(t.length),o}function jt(e){const o=document.createElement("div");return e.forEach(t=>o.appendChild(t.cloneNode(!0))),o.innerHTML}function wo(e,o){const t=Lo(o);if(!t)return 0;const n=t.container;if(!o.contains(n))return 0;for(let r=0;r<e.length;r++)for(const i of e[r].nodes)if(i===n||i.contains(n))return r;if(n===o){const r=t.offset;for(let i=0;i<e.length;i++)if(r>=e[i].startIndex&&r<=e[i].endIndex)return i;for(let i=0;i<e.length;i++)if(r===e[i].startIndex)return i;for(let i=0;i<e.length;i++)if(e[i].startIndex>=r)return i;if(e.length>0)return e.length-1}return 0}function wn(e,o,t,n){if(!t.contains(o))return n;for(let r=0;r<e.length;r++)for(const i of e[r].nodes)if(i===o||i.contains(o))return r;return n}function Xi(e,o){const t=window.getSelection();if(!t||t.rangeCount===0){const s=wo(e,o);return{start:s,end:s}}const n=t.getRangeAt(0);if(n.collapsed){const s=wo(e,o);return{start:s,end:s}}const r=wo(e,o),i=wn(e,n.startContainer,o,r),l=wn(e,n.endContainer,o,r);return{start:Math.min(i,l),end:Math.max(i,l)}}function Zi(e){return e.querySelector("br")!==null}function Ji(e){const o=Lo(e);if(!o)return null;const t=o.container.nodeType===Node.ELEMENT_NODE?o.container:o.container.parentElement;if(!t)return null;const n=t.closest("ol, ul");return n&&e.contains(n)?n:null}function Qi(e){const o=Lo(e);if(!o)return;const{container:t,offset:n}=o;if(t!==e)return;const r=Array.from(e.childNodes),i=n>0?r[n-1]:null,l=n<r.length?r[n]:null,s=b=>b!==null&&b.nodeType===Node.ELEMENT_NODE&&b.tagName==="BR",c=b=>b!==null&&b.nodeType===Node.TEXT_NODE&&b.data.trim()==="",d=s(i),u=s(l),g=c(l),m=n>=r.length;if(!(d&&u||d&&m||n===0&&u||d&&g))return;let f;g?(f=l,f.data=" "):(f=document.createTextNode(" "),l?e.insertBefore(f,l):e.appendChild(f));const p=window.getSelection();if(p){const b=document.createRange();b.setStart(f,0),b.collapse(!0),p.removeAllRanges(),p.addRange(b)}Ct={container:f,offset:0}}function el(e,o){const t=o?"ol":"ul";if(e.querySelector("ol, ul")){const n=Ji(e);if(n){if(n.tagName.toLowerCase()===t)return;const l=document.createElement(t);for(Array.from(n.attributes).forEach(s=>{s.name!=="style"&&l.setAttribute(s.name,s.value)}),l.setAttribute("style",a.STANDARD_LIST_STYLES.LIST);n.firstChild;)l.appendChild(n.firstChild);n.parentNode?.replaceChild(l,n);return}const r=e.querySelector(":scope > ol, :scope > ul"),i=Array.from(e.childNodes).some(l=>l.nodeType===Node.ELEMENT_NODE&&l.tagName==="BR");if(r&&!i){if(r.tagName.toLowerCase()===t)return;const l=document.createElement(t);for(Array.from(r.attributes).forEach(s=>{s.name!=="style"&&l.setAttribute(s.name,s.value)}),l.setAttribute("style",a.STANDARD_LIST_STYLES.LIST);r.firstChild;)l.appendChild(r.firstChild);r.parentNode?.replaceChild(l,r);return}}Zi(e)||e.querySelector(":scope > ol, :scope > ul")?(Qi(e),tl(e,t)):kn(e,t)}function kn(e,o){const t=document.createElement(o);t.setAttribute("style",a.STANDARD_LIST_STYLES.LIST);const n=document.createElement("li");n.setAttribute("style",a.STANDARD_LIST_STYLES.LIST_ITEM);const r=e.innerHTML.trim();r?n.innerHTML=r:n.innerHTML=" ",t.appendChild(n),e.innerHTML="",e.appendChild(t),_n(n)}function tl(e,o){const t=Ki(e);if(t.length===0){kn(e,o);return}const{start:n,end:r}=Xi(t,e),i=document.createElement(o);i.setAttribute("style",a.STANDARD_LIST_STYLES.LIST);let l=null;for(let d=n;d<=r;d++){const u=document.createElement("li");u.setAttribute("style",a.STANDARD_LIST_STYLES.LIST_ITEM),u.innerHTML=t[d].html.trim()||" ",i.appendChild(u),l=u}const s=t.slice(0,n).map(d=>d.html).join("<br>"),c=t.slice(r+1).map(d=>d.html).join("<br>");if(e.innerHTML="",s.trim()){const d=document.createElement("span");for(d.innerHTML=s;d.firstChild;)e.appendChild(d.firstChild);e.appendChild(document.createElement("br"))}if(e.appendChild(i),c.trim()){e.appendChild(document.createElement("br"));const d=document.createElement("span");for(d.innerHTML=c;d.firstChild;)e.appendChild(d.firstChild)}l&&_n(l)}function _n(e){try{const o=window.getSelection();if(o){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0),o.removeAllRanges(),o.addRange(t)}}catch{}}function ol(e,o){let t=0;const n=Array.from(e.childNodes);for(const r of n){if(r===o)return t;r.nodeType===Node.ELEMENT_NODE&&r.tagName==="BR"&&t++}return t}function nl(e,o){const t=Yi(e);if(o<0||o>=t.length)return;const n=t[o];if(n.nodes.length!==0)try{const r=window.getSelection();if(!r)return;const i=n.nodes[0],l=document.createRange();if(i.nodeType===Node.TEXT_NODE)l.setStart(i,0),l.collapse(!0);else if(i.nodeType===Node.ELEMENT_NODE)l.selectNodeContents(i),l.collapse(!0);else return;r.removeAllRanges(),r.addRange(l)}catch{}}function rl(e){const o=e.querySelector("ol, ul");if(!o)return;const t=ol(e,o),n=o.querySelectorAll("li"),r=[];n.forEach(l=>{const s=l.innerHTML.trim();s&&s!==" "&&r.push(s)});const i=r.join("<br>");i?o.outerHTML=i:o.outerHTML=" ",nl(e,t)}function Gt(e){if(!e)return!1;const o=e.closest("ul, ol");return o?!o.closest(a.TABLE_LIST_SELECTOR):!1}function Nn(e){return e.getAttribute("src")}function Yt(e,o){const t=a.resolveActiveElement(e.elem),n=Nn(t),r=a.getElementMobileProps({elem:t}),i=t.closest("td"),l=i?a.getElementMobileProps({elem:i}):null;let s="img",c=o.PICTURE;e.elem.classList.contains("em-countdown")?(s="countdown",c=o.COUNTDOWN):e.elem.classList.contains("em-video")&&(s="video",c=o.VIDEO);const d=g=>g===null||g==="auto"?null:typeof g=="number"?g:null,u={type:s,caption:c,src:n??"",width:Bn(t,"width"),height:Bn(t,"height"),alt:t.getAttribute("alt")??"",title:t.getAttribute("title")??"",align:i?.getAttribute("align")??"undefined",valign:t.style?.verticalAlign??"undefined",border:a.getElementBorder(t),borderRadius:a.getElementBorderRadius(t),boxShadow:a.getElementBoxShadow(t),mobileWidth:{value:d(r.mobileWidth),dim:r.mobileWidthDim??"px"},mobileHeight:{value:d(r.mobileHeight),dim:r.mobileHeightDim??"px"},mobileBorder:r.mobileBorder,mobileBorderRadius:r.mobileBorderRadius,mobileBoxShadow:r.mobileBoxShadow,mobileAlign:l?.mobileAlign,mobileVerticalAlign:r.mobileVerticalAlign,show:r.show,link:t.closest("a")?.getAttribute("href")??null,renderedWidth:Math.round(e.elem.getBoundingClientRect().width),renderedHeight:Math.round(e.elem.getBoundingClientRect().height),imgReplacer:t.closest("em-replace")?.getAttribute("src")??""};if(s==="countdown"&&(u.countdown=e.elem.getAttribute("em-cd-settings")??void 0),s==="video"){const g=e.elem.getAttribute("em-video-settings");if(g)try{u.video=JSON.parse(g.replaceAll("'",'"'))}catch{u.video={}}}return a.isShowOnMobile(e.elem)&&(u.showOnMobile=!0),i&&(u.maxWidth=Math.round(i.getBoundingClientRect().width)),u}function Bn(e,o){const t=e.getAttribute(o);return!t||t==="auto"?{value:null,dim:"px"}:{value:parseFloat(t),dim:t.includes("%")?"%":"px"}}function Mn(e){return e.tagName==="IMG"||e.tagName==="AMP-IMG"}var Rn="em-mob-text_align-",il=":scope > tr > td, :scope > tbody > tr > td",ll='div[style*="font-family"][style*="font-size"]';function ko(e){return e.querySelector(il)}function _o(e){return e.querySelector(ll)}function al(e,o){for(let t=e;t&&t!==o;t=t.parentElement)if(t.tagName.includes("-"))return!0;return!1}function Pn(e){const o=e.closest('table[em="atom"]');if(!o||al(e,o))return null;const t=ko(o);return t?{atomTd:t,textDiv:_o(t)}:null}function vt(e){const o=e.closest("div, p, td");if(!o)return null;if(o.style.textAlign)return o;const t=Pn(e);return t?t.textDiv?.hasAttribute("align")?t.textDiv:t.atomTd:o}function In(e){const o=vt(e);return o&&(o.style.textAlign||o.getAttribute("align"))||"left"}function sl(e){const o=vt(e);if(!o)return"";for(const t of o.classList)if(t.startsWith("em-mob-text_align-"))return t.slice(18);return""}function No(e){return{value:sl(e)}}function cl(e,o,t=Rn){const n=Pn(e);if(n)for(const r of[n.atomTd,n.textDiv])r&&r!==o&&a.removeClassesByPrefix(r,t)}function dl(e){const o=ko(e);if(!o)return null;const t=_o(o);return t?.hasAttribute("align")?t:o}function ml(e,o){e.querySelectorAll('[em="atom"]').forEach(t=>{const n=dl(t);n&&o(n,t)})}function ul(e,o,t=Rn){const n=ko(e),r=n?_o(n):null;for(const i of[n,r])i&&i!==o&&a.removeClassesByPrefix(i,t)}function Kt(e,o,t){const n=a.getParentElementOfSelection()||e.elem,r=n.tagName==="EDITOR"&&n.firstChild?.nodeType===1?n.firstChild:n,i=e.elem.closest('[style*="font-family"], [style*="font-size"], [style*="line-height"]')||e.elem,l=r.style.fontFamily||r.style.fontSize||r.style.lineHeight||r.closest('[style*="font-family"], [style*="font-size"], [style*="line-height"]')?r:i,s=e.elem.closest('[style*="line-height"]')||l.querySelector('[style*="line-height"]')||l,c=n.closest('[class*="em-mob-font_size"], [style*="font-size"]')||n,d=n.closest('[class*="em-mob-line_height"]')||n.closest('[style*="line-height"]')||n,u=a.getElementMobileProps({elem:c}),g=a.getElementMobileProps({elem:d}),m=Hn(e.elem,t),f=a.textHasStyle$1(r,"strong","b"),p=l!==r?a.textHasStyle$1(l,"strong","b"):!1,b=e.elem&&r&&e.elem.isConnected&&(r===e.elem||r.contains(e.elem))?a.textHasStyle$1(e.elem,"strong","b"):!1,h=f||p||b,y=a.isElementHasBold(l),E=h||y,S={type:"text",caption:o.TEXT,fontFamily:a.getFontFamilyFromElement$1(l.closest('[style*="font-family"]')||e.elem),fontSize:parseFloat(e.elem.closest('[style*="font-size"]')?.style.fontSize)||parseFloat(getComputedStyle(e.elem).fontSize),fontSizeDim:"px",lineHeight:a.getLineHeightInPixels$1(s),lineHeightDim:"px",textAlign:In(e.elem),textStrong:E,textItalic:a.textHasStyle$1(e.elem,"i","em")||!l.closest('[style*="font-style: normal"]')&&l.style?.fontStyle==="italic",textStrikethrough:a.textHasStyle$1(e.elem,"s","strike")||(l.style?.textDecoration?.includes("line-through")??!1),textUnderline:a.textHasStyle$1(e.elem,"u")||(l.style?.textDecoration?.includes("underline")??!1)||!l.style?.textDecoration&&(e.elem.tagName==="A"&&e.elem.hasAttribute("href")||a.hasLinkInSelection()),textColor:a.rgbToHex(e.elem.closest('[style*="color"]')?.style.color)||a.rgbToHex(getComputedStyle(e.elem).color)||"",textBackgroundColor:bl(e.elem),mobileFontSize:{value:u.mobileFontSize,dim:u.mobileFontSizeDim||"px"},mobileLineHeight:{value:g.mobileLineHeight,dim:"px"},mobileTextAlign:No(e.elem),linkHref:(()=>{const v=l.closest("a");if(!v)return;const C=v.getAttribute("href");if(C!==null)return C})(),textAnchor:(()=>{const v=l.closest("a");if(v&&!v.hasAttribute("href"))return v.getAttribute("name")?.trim()||void 0})(),textLink:(()=>{const v=l.closest("a");return v?!!v.hasAttribute("href"):a.textHasStyle$1(e.elem,"a")||a.hasLinkInSelection()})(),textReplacer:t.variableElement(e.elem),list:m,standardList:On(e.elem),textSuperscript:a.textHasStyle$1(e.elem,"sup"),textSubscript:a.textHasStyle$1(e.elem,"sub")};return a.isShowOnMobile(n)&&(S.showOnMobile=!0),S}function Hn(e,o){const{isElementList:t,isElementListOL:n,isElementListUL:r,requestElemBullet:i}=o;if(!t)return{isList:!1,listType:"UL"};const l=e.closest("td");return{isList:!0,listType:n?"OL":"UL",bulletsColor:t&&i?a.rgbToHex(i.closest('[style*="color"]')?.style.color):"",betweenParagraphs:t&&parseInt(l?.style?.paddingBottom,10)||0,betweenRowCell:t&&parseInt(l?.style?.paddingLeft,10)||0,bulletFontSize:t&&i&&parseInt(i.style.fontSize,10)||0,bulletFontBold:t?i?.style.fontWeight==="bold":!1,bulletFontItalic:t?i?.style.fontStyle==="italic":!1,bulletFontFamily:n&&i?a.getFontFamilyFromElement$1(i):"",bulletFontUnderline:t?i?.style.textDecoration?.includes("underline")??!1:!1,bulletFontStrikethrough:t?i?.style.textDecoration?.includes("line-through")??!1:!1,bulletType:r&&i?i.innerHTML.replace(/\s| /g,""):""}}function On(e){return Gt(e)?{listTypeOL:!!e.querySelector("ol")||!!e.closest("ol"),listTypeUL:!!e.querySelector("ul")||!!e.closest("ul")}:{listTypeOL:!1,listTypeUL:!1}}function Bo(e){if(!e)return!1;const o=e.trim().toLowerCase();return o!=="transparent"&&o!=="inherit"}var fl=new Set(["A","B","EM","I","MARK","S","SMALL","SPAN","STRIKE","STRONG","SUB","SUP","U"]);function pl(e){let o=e;for(;o&&fl.has(o.tagName);){const t=o.style.backgroundColor;if(Bo(t))return t;o=o.parentElement}return""}function gl(e,o,t){let n=e;for(;n;){const r=n.style.getPropertyValue(o);if(Bo(r))return r;if(t&&n===t)break;n=n.parentElement}return""}function bl(e){const o=pl(e);if(Bo(o))return a.rgbToHex(o)||"";if(e.closest(".em-element-custom-table"))return a.rgbToHex(a.findParentWithExplicitStyle(e,"background-color"))||"";const t=e.closest("div");return a.rgbToHex(gl(e,"background-color",t))||""}function hl(e){return e.tagName==="DIV"?!!(e.style.fontFamily&&e.style.fontSize&&e.style.lineHeight):e.tagName==="TD"?e.firstChild?.tagName==="EDITOR"||e.firstElementChild?.tagName==="EDITOR":!1}function yl(e,o,t){const{findElementWithSelectedText:n,selectedText:r,variableElement:i,requestElemBullet:l,isElementList:s,isElementListOL:c,isElementListUL:d}=t,u=n(r,e.elem)||e.elem,g=e.elem.closest('[class*="em-mob-font_size"]')||e.elem.closest('[style*="font-size"]')||e.elem,m=e.elem.closest('[class*="em-mob-line_height"]')||e.elem.closest('[style*="line-height"]')||e.elem,f=a.getElementMobileProps({elem:g}),p=a.getElementMobileProps({elem:m}),b=Hn(e.elem,t),h={type:"text",caption:o.TEXT,linkHref:(()=>{const y=e.elem.getAttribute("href");if(y!==null)return y})(),textAnchor:(()=>{if(!e.elem.hasAttribute("href"))return e.elem.getAttribute("name")?.trim()||void 0})(),textLink:!!e.elem.hasAttribute("href"),target:e.elem.getAttribute("target")??"",fontFamily:a.getFontFamilyFromElement$1(e.elem),fontSize:parseFloat(e.elem.closest('[style*="font-size"]')?.style.fontSize)||0,fontSizeDim:"px",lineHeight:a.getLineHeightInPixels$1(e.elem),lineHeightDim:"px",textAlign:In(e.elem),textStrong:a.textHasStyle$1(u,"strong","b")||a.isElementHasBold(u),textItalic:a.textHasStyle$1(u,"i","em")||!e.elem.closest('[style*="font-style: normal"]')&&e.elem.style?.fontStyle==="italic",textStrikethrough:a.textHasStyle$1(u,"s","strike")||(e.elem.style?.textDecoration?.includes("line-through")??!1),textUnderline:a.textHasStyle$1(u,"u")||(e.elem.style?.textDecoration?.includes("underline")??!1)||!(e.elem.style?.textDecoration?.length>0)&&e.elem.tagName==="A"&&e.elem.hasAttribute("href"),textColor:a.rgbToHex(e.elem.tagName==="A"?a.findParentWithExplicitStyle(e.elem.querySelector('[style*="color"]'),"color"):a.findParentWithExplicitStyle(e.elem,"color"))||a.rgbToHex(getComputedStyle(e.elem).color)||"",textBackgroundColor:a.rgbToHex(e.elem.tagName==="A"?a.findParentWithExplicitStyle(e.elem.querySelector('[style*="background-color"]'),"background-color"):a.findParentWithExplicitStyle(e.elem,"background-color"))||"",mobileFontSize:{value:f.mobileFontSize,dim:f.mobileFontSizeDim||"px"},mobileLineHeight:{value:p.mobileLineHeight,dim:"px"},mobileTextAlign:No(e.elem),textReplacer:i(e.elem),list:b,standardList:On(e.elem),textSuperscript:a.textHasStyle$1(e.elem,"sup"),textSubscript:a.textHasStyle$1(e.elem,"sub")};return a.isShowOnMobile(e.elem)&&(h.showOnMobile=!0),h}function Mo(e){let o="";if(e.nodeType===Node.COMMENT_NODE&&e.nodeValue?.includes("[if mso]")){const t=e.nodeValue.replace(/^\[if mso\]>/i,"").replace(/<!\[endif\]$/i,"").trim();o+=t}return e.childNodes.forEach(t=>{o+=Mo(t)}),o}function Ro(e,o,t={value:0}){e.nodeType===Node.COMMENT_NODE&&e.nodeValue?.includes("[if mso]")&&(t.value===0?e.nodeValue=`[if mso]>${o}<![endif]`:e.nodeValue="",t.value++),e.childNodes.forEach(n=>Ro(n,o,t))}function El(e,o){const t=e.getAttribute(o);return!t||t==="auto"?{value:null,dim:"px"}:{value:parseFloat(t),dim:t.includes("%")?"%":"px"}}function xn(e,o){const t=e.style[o];return t?{value:parseFloat(t),dim:t.includes("%")?"%":"px"}:{value:null,dim:"px"}}function Sl(e){return e===null||e==="auto"?null:typeof e=="number"?e:null}function Cl(e){if(e.style.backgroundImage){const o=e.style.backgroundImage;return[{type:"url",value:o.substring(5,o.length-2)}]}return e.getAttribute("background")?[{type:"url",value:e.getAttribute("background")||""}]:[{type:"url",value:""}]}function vl(e,o){const t=e.elem;if(t.innerHTML==="")return{type:"emptyTable",caption:o.TABLE};t.setAttribute("em-edit","active");const n=a.getElementMobileProps({elem:t}),r={type:"table",caption:o.TABLE,backgroundColor:t.style.backgroundColor?a.rgbToHex(t.style.backgroundColor):"",backgroundImage:Cl(t),backgroundPositionX:t.style.backgroundPositionX!=="initial"?t.style.backgroundPositionX:"",backgroundPositionY:t.style.backgroundPositionY!=="initial"?t.style.backgroundPositionY:"",backgroundRepeat:t.style.backgroundRepeat||"repeat",backgroundSize:t.style.backgroundSize||"auto",width:El(t,"width"),maxWidth:xn(t,"maxWidth"),minWidth:xn(t,"minWidth"),align:t.getAttribute("align")??"",border:a.getElementBorder(t),boxShadow:a.getElementBoxShadow(t),borderRadius:a.getElementBorderRadius(t),mobileWidth:{value:Sl(n.mobileWidth),dim:n.mobileWidthDim??"px"},mobileBorder:n.mobileBorder,mobileBorderRadius:n.mobileBorderRadius,mobileBoxShadow:n.mobileBoxShadow,show:n.show,mobileAlign:n.mobileAlign,mobileBackgroundColor:n.mobileBackgroundColor,mobileBackgroundImage:n.mobileBackgroundImage,mobileBackgroundPositionX:n.mobileBackgroundPositionX,mobileBackgroundPositionY:n.mobileBackgroundPositionY,mobileBackgroundRepeat:n.mobileBackgroundRepeat,mobileBackgroundSize:n.mobileBackgroundSize,exportAsPicture:t.getAttribute("em-operation")==="exportAsPicture",outlookBackground:a.hasElementVMLBackground(t,"around")};return a.isShowOnMobile(t)&&(r.showOnMobile=!0),r}function Al(e){return e.tagName==="TABLE"&&e.getAttribute("em")!=="atom"}function Tl(e){return e.closest("em-replace")?.getAttribute("text")||null}var Ll=()=>a.isInitialized()?a.getHtmlDocument():null,wl=()=>a.state.get("isProgrammaticSelection");function kl(e){if(!a.isElementLocked())try{a.incrementLock(),a.removeAllAttributes("em-edit");let o={};if(!e.elem)return;const t=_l(e.elem);if(!t)return;e.elem=t;const n=Nl(e.elem);document.body.classList.contains("mceNonEditable")||Bl(e.elem),o=Pl(e,n),o.type&&(o.operation="application_element_settings_set",a.messageService.send(o))}finally{a.decrementLock()}}function _l(e){const o=Ll();return!o||!o.getMappedParent(e)?e:o.getVisibleNode(e)}function Nl(e){const o=a.hasClosestTrWithClass(e,a.CLASS_NAME_OL),t=a.hasClosestTrWithClass(e,a.CLASS_NAME_UL),n=o||t,r=n?e.closest("tr")?.querySelector("td:first-child div:first-child"):null,i=document.querySelectorAll(`.${a.CLASS_NAME_OL}, .${a.CLASS_NAME_UL}`);return{isElementListOL:o,isElementListUL:t,isElementList:n,isCellCustomTable:!!e.closest(".em-element-custom-table"),bulletElem:r,totalListCount:i.length}}function Po(e){return{variableElement:Tl,requestElemBullet:e.bulletElem,isElementListOL:e.isElementListOL,isElementListUL:e.isElementListUL,isElementList:e.isElementList}}function Bl(e){const o=window.getSelection();(o?.isCollapsed||!o?.isCollapsed&&!e.querySelector("editor"))&&(a.removeAllAttributes("em-edit"),e.tagName!=="TABLE"&&(a.resolveActiveElement(e).setAttribute("em-edit","active"),Ml(e)),Rl(e))}function Ml(e){const o=e.closest("table");if(!o)return;for(const n of o.querySelectorAll('[contenteditable="true"]'))n.tagName!=="EDITOR"&&n.removeAttribute("contenteditable");const t=o.querySelector("editor");if(t){const n=t.firstChild;t.childNodes.length===1&&n?.nodeType===1&&n.tagName==="A"&&n.childNodes.length===1&&n.firstChild?.nodeType===3?n.setAttribute("contenteditable","true"):t.setAttribute("contenteditable","true")}}function Rl(e){const o=e.parentElement;o&&(o.querySelectorAll("strike, s").forEach(t=>{t.style.textDecoration="line-through"}),o.querySelectorAll("u").forEach(t=>{t.style.textDecoration="underline"}))}function Pl(e,o){const t=e.elem;if(!(window.getSelection()?.isCollapsed??!0)&&!t.closest("a")&&!wl()&&!o.isCellCustomTable){const n=Po(o);return{type:"text",caption:Locale.TEXT,settings:Kt(e,Locale,n)}}if(t.closest("amp-carousel"))return Il(e);if(t.tagName==="AMP-ACCORDION")return Hl(e);if(Mn(t))return{type:Yt(e,Locale).type,caption:Yt(e,Locale).caption,settings:Yt(e,Locale)};if(!o.isCellCustomTable&&(t.tagName==="A"||t.tagName==="EM-REPLACE"&&t.closest("a")))return Ol(e,o);if(t.tagName==="TABLE"&&t.getAttribute("em")!=="atom")return xl(e);if(t.tagName==="LI"&&Gt(t)){const n=Po(o);return{type:"text",caption:Locale.TEXT,settings:Kt(e,Locale,n)}}return o.isCellCustomTable?Dl(e):t.tagName==="TD"?Fl(e):t.closest(".em-vindent")?ql(e):t.classList.contains("em-floatblock")||t.closest(".em-floatblock")?Wl(e):t.tagName==="DIV"?$l(e,o):t.getAttribute("em")==="block"?zl(e):{}}function Il(e){return{type:"carousel",caption:Locale.CAROUSEL,settings:{}}}function Hl(e){return{type:"accordion",caption:Locale.ACCORDION,settings:{}}}function Ol(e,o){const t=e.elem;if(t.style?.display==="block"||t.style?.display==="inline-block")return{type:"button",caption:Locale.BUTTON,settings:{}};const n=Po(o);return{type:"text",caption:Locale.TEXT,settings:Kt(e,Locale,n)}}function xl(e){return e.elem.innerHTML===""?{type:"emptyTable",settings:{}}:{type:"table",caption:Locale.TABLE,settings:{}}}function Dl(e){return{type:"customTable",caption:Locale.TABLE,settings:{}}}function Fl(e){return{type:"td",caption:Locale.TABLE_COLUMN,settings:{}}}function ql(e){return{type:"vindent",caption:Locale.VERTICAL_INDENT,settings:{}}}function Wl(e){return{type:"floatBlock",caption:Locale.FLOAT_BLOCK,settings:{}}}function $l(e,o){return{type:"div",caption:Locale.CONTAINER,settings:{}}}function zl(e){return{type:"structure",caption:Locale.STRUCTURE,settings:{}}}var ob=Promise.resolve();function At(e){return!(!e.startsWith("#")||e.indexOf("#",1)!==-1)}var Vl=["em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"],Ul=["em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top"],jl=["em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"];function Dn(){document.querySelectorAll(".em-block-insert").forEach(e=>{e.classList.remove(...Vl)})}function Gl(){document.querySelectorAll(".em-atom-insert").forEach(e=>{e.classList.remove(...Ul)})}function Xt(){document.querySelectorAll(".em-blockatom-insert").forEach(e=>{e.classList.remove(...jl)})}function Io(e,o){const t=e.getBoundingClientRect();return o>t.top+t.height/2?"bottom":"top"}function Fn(e,o){const t=e.getBoundingClientRect(),n=document.body.getBoundingClientRect();return o==="bottom"?t.bottom>n.height-21:t.top<2}function Ho(e,o,t){const n=t==="atom"?"em-atom-insert":"em-block-insert",r=t==="blockatom"?"em-blockatom-insert":n;if(e.classList.add(r),o==="bottom"){e.classList.remove(`${n}_top`,`${n}_top-document`);const i=Fn(e,"bottom")?`${n}_bottom-document`:`${n}_bottom`;e.classList.add(i)}else{e.classList.remove(`${n}_bottom`,`${n}_bottom-document`);const i=Fn(e,"top")?`${n}_top-document`:`${n}_top`;e.classList.add(i)}}function Oo(e){return e.tagName==="TABLE"&&!e.innerHTML}function Zt(e){return e.tagName==="TABLE"||e.tagName==="TR"?e.querySelector("[data-template-content]")??e.querySelector("td"):e}function qn(e){if(!e?.length)return null;for(let o=0;o<e.length;o++){const t=e.item(o);if(t?.type.startsWith("image/"))return t}return null}function Yl(e){if(!e?.items?.length)return null;for(let o=0;o<e.items.length;o++){const t=e.items[o];if(t.kind!=="file")continue;const n=t.getAsFile();if(n&&n.type.startsWith("image/"))return n}return null}function Kl(e){const o=qn(e.dataTransfer?.files??null);return o||Yl(e.dataTransfer??null)}function xo(e){const o=document.body?.parentElement??document.body;if(!o)return null;const t=document.elementFromPoint(e.clientX,e.clientY);if(!t)return null;const n=t.closest(".em-element-resize-img-container");if(n){const i=n.querySelector("img");if(i&&o.contains(i))return i}const r=t.closest("img");return!r||!o.contains(r)?null:r}function Tt(e){const o=e.dataTransfer?.types;return!!o&&Array.from(o).includes("Files")}function Do(e){if(!Tt(e))return!1;const o=e.dataTransfer;if(!o)return!1;if(o.files?.length)return!!qn(o.files);const t=o.items;if(!t?.length)return!0;for(let n=0;n<t.length;n++){const r=t[n];if(r.kind!=="file")continue;const i=r.type||"";if(i.startsWith("image/")||i==="")return!0}return!1}var Wn="em-native-img-drop-target",Fo="em-native-img-uploading",Xl="em-native-img-drop-loading",Jt="em-native-file-drag",Lt=null,et=null;function $n(){et&&(window.removeEventListener("scroll",et.reposition,!0),window.removeEventListener("resize",et.reposition),et.resizeObserver?.disconnect(),et.overlay.remove(),et=null)}function Zl(e){$n();const o=document.createElement("div");o.className="em-native-img-upload-spin-overlay",o.setAttribute("aria-hidden","true");const t=document.createElement("div");t.className="em-native-img-upload-spin",o.appendChild(t),document.body.appendChild(o);const n=()=>{const i=e.getBoundingClientRect();o.style.left=`${Math.round(i.left)}px`,o.style.top=`${Math.round(i.top)}px`,o.style.width=`${Math.max(Math.round(i.width),1)}px`,o.style.height=`${Math.max(Math.round(i.height),1)}px`};n(),window.addEventListener("scroll",n,!0),window.addEventListener("resize",n);let r=null;typeof ResizeObserver<"u"&&(r=new ResizeObserver(()=>n()),r.observe(e)),et={overlay:o,reposition:n,resizeObserver:r}}function qo(){Lt&&(Lt.classList.remove(Wn),Lt=null)}function tt(){document.body.classList.remove(Jt),qo()}function Jl(e){if(!Tt(e)){tt();return}if(!Do(e)){tt();return}document.body.classList.add(Jt);const o=xo(e);if(!o){qo();return}Lt!==o&&(qo(),Lt=o,o.classList.add(Wn))}function zn(){$n(),document.body.classList.remove(Xl),document.body.classList.remove(Jt),document.querySelectorAll(`.${Fo}`).forEach(e=>{e.classList.remove(Fo)})}function Ql(e,o){if(o.lockEditor||!Tt(e))return!1;const t=Kl(e);if(!t)return!1;const n=xo(e);return n?(o.applicationElementSettingsSet({elem:n}),tt(),n.classList.add(Fo),Zl(n),o.messageService.send({operation:a.EVENT_TYPES.APPLICATION_NATIVE_IMAGE_DROP,file:t}),!0):!1}function ea(e,o){if(o.lockEditor)return;document.body.classList.contains("em-block-insert-body")||o.messageService.send({operation:"application_scroll-block-show"});const t=e.target;t.getAttribute("em")==="atom"&&(document.body.classList.add("em-atom-insert-body-inside"),o.commit(!1),o.mutableState.atomReplaced=t)}function ta(e,o){o.lockEditor||(tt(),e.preventDefault(),o.messageService.send({operation:"application_scroll-block-hide"}))}function oa(e,o){if(e.preventDefault(),o.lockEditor){tt();return}Tt(e)?(Do(e)&&xo(e)&&(e.dataTransfer.dropEffect="copy"),Jl(e)):tt();const t=e.target;if(document.body.classList.contains("em-block-insert-body")){const n=Oo(t)?null:t.closest('[em="block"]');if(n){o.mutableState.targetBlock=n;const r=Zt(n);r&&Ho(r,Io(r,e.pageY),"block")}else Dn()}else if(document.body.classList.contains("em-atom-insert-body")){const n=t.closest('[em="atom"]');if(n&&n.innerHTML.trim())o.mutableState.targetBlock=n,Ho(n,Io(n,e.pageY),"atom"),Xt();else if(t.closest('[em="block"]')&&t.tagName==="TD"&&!t.innerHTML&&!t.hasAttribute("height")||t.tagName==="DIV"&&t.closest("amp-accordion")&&!t.innerHTML)Xt();else{const r=t.closest('[em="block"]');if(r){o.mutableState.targetBlock=r;const i=Zt(r);i&&(Ho(i,Io(i,e.pageY),"blockatom"),Gl())}}}}function na(e,o){if(o.lockEditor)return;Tt(e)&&Do(e)&&document.body.classList.add(Jt);const t=e.target;if(document.body.classList.contains("em-block-insert-body")){document.querySelectorAll(".em-block-insert-empty").forEach(r=>{r.classList.remove("em-block-insert-empty")});const n=t.closest('[em="block"]');Oo(t)?(t.classList.add("em-block-insert-empty"),Dn()):n&&(o.mutableState.targetBlock=n)}else if(document.body.classList.contains("em-atom-insert-body")||document.body.classList.contains("em-atom-insert-body-inside")){document.querySelectorAll(".em-atom-insert-empty").forEach(i=>{i.classList.remove("em-atom-insert-empty")});const n=t.closest('[em="atom"]');n&&n.innerHTML.trim()?(o.mutableState.targetBlock=n,document.querySelectorAll(".em-atom-insert, .em-blockatom-insert").forEach(i=>{i.classList.remove("em-atom-insert","em-blockatom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top")})):t.closest('[em="block"]')&&t.tagName==="TD"&&!t.innerHTML&&!t.hasAttribute("height")&&t.parentElement&&[...t.parentElement.children].indexOf(t)%2===0||t.tagName==="DIV"&&t.closest("amp-accordion")&&!t.innerHTML?(t.classList.add("em-atom-insert-empty"),document.querySelectorAll(".em-atom-insert, .em-blockatom-insert").forEach(i=>{i.classList.remove("em-atom-insert","em-blockatom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top")})):document.querySelectorAll(".em-atom-insert").forEach(i=>{i.classList.remove("em-atom-insert","em-blockatom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top")}),document.querySelectorAll(".em-block-insert-empty").forEach(i=>{i.classList.remove("em-block-insert-empty")});const r=t.closest('[em="block"]');Oo(t)?(t.classList.add("em-block-insert-empty"),Xt()):r?o.mutableState.targetBlock=r:Xt()}}function ra(e,o){if(o.lockEditor)return;const t=e.target;if(document.body.classList.contains("em-block-insert-body")){const n=e.relatedTarget,r=t.closest('[em="block"]');if(n&&r&&r.contains(n))return;o.mutableState.newTargetblock=t.closest('[em="block"]'),o.mutableState.newTargetblock&&(t.closest('[em="block"]')&&(o.mutableState.newTargetblock!==o.mutableState.targetBlock||o.mutableState.newTargetblock.closest('[em="group"]')!==o.mutableState.targetBlock?.closest('[em="group"]'))?o.mutableState.newTargetblock.tagName==="DIV"?o.mutableState.newTargetblock.classList.remove("em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"):o.mutableState.newTargetblock.querySelectorAll(".em-block-insert").forEach(i=>{i.classList.remove("em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top")}):document.querySelectorAll(".em-block-insert-empty").forEach(i=>{i.classList.remove("em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top")}))}else if(document.body.classList.contains("em-atom-insert-body")){const n=e.relatedTarget,r=t.closest('[em="atom"]');if(n&&r&&r.contains(n))return;const i=t.closest('[em="block"]');if(n&&i&&i.contains(n))return;o.mutableState.newTargetblock=t.closest('[em="atom"]'),o.mutableState.newTargetblock&&(t.getAttribute("em")==="atom"&&o.mutableState.newTargetblock!==o.mutableState.targetBlock?o.mutableState.newTargetblock.classList.remove("em-atom-insert","em-blockatom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top"):document.querySelectorAll(".em-atom-insert-empty").forEach(s=>{s.classList.remove("em-atom-insert","em-blockatom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top")}));const l=t.closest('[em="block"]');l&&(t.closest('[em="block"]')&&(l!==o.mutableState.targetBlock||l.closest('[em="group"]')!==o.mutableState.targetBlock?.closest('[em="group"]'))?l.tagName==="DIV"?l.classList.remove("em-atom-insert","em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"):l.querySelectorAll(".em-blockatom-insert").forEach(s=>{s.classList.remove("em-atom-insert","em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top")}):document.querySelectorAll(".em-block-insert-empty").forEach(s=>{s.classList.remove("em-atom-insert","em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top")}))}}function ia(e,o,t){if(!e)return;let n=document.head.querySelector('style[em="styles"]'),r="";n?r=t.HTMLDocument.getInnerHtml(n):(n=document.createElement("style"),n.setAttribute("em","styles"),n=document.head.insertAdjacentElement("beforeend",n));const i=document.createElement("div");o&&(e=e.replace(/(max-device-width:|max-width:)\d+px/g,s=>s.replace(/\d+/,String(o)))),i.insertAdjacentHTML("afterbegin",e);let l=t.minify(r+`
|
|
1
|
+
__useblocks__.define("js/iframe.js",["require","exports","module","js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.B36tbVEC.js"],function(To,eb,tb){const Gi=To("./rolldown-runtime.BRlIiq3h.js"),a=To("./discussHandlers.B36tbVEC.js");var Ct=null;function Lo(e){const o=window.getSelection();if(o&&o.rangeCount>0){const t=o.getRangeAt(0);if(e.contains(t.startContainer))return{container:t.startContainer,offset:t.startOffset}}return Ct&&Ct.container.isConnected&&e.contains(Ct.container)?Ct:null}function Yi(e){const o=[],t=Array.from(e.childNodes);let n=[],r=0;return t.forEach((i,l)=>{i.nodeType===Node.ELEMENT_NODE&&i.tagName==="BR"?(n.length>0&&o.push({html:jt(n),nodes:[...n],startIndex:r,endIndex:l-1}),n=[],r=l+1):n.push(i)}),n.length>0&&o.push({html:jt(n),nodes:[...n],startIndex:r,endIndex:t.length-1}),o}function Ki(e){const o=[],t=Array.from(e.childNodes);let n=[],r=0;const i=s=>{n.length>0&&(o.push({html:jt(n),nodes:[...n],startIndex:r,endIndex:s-1}),n=[])},l=s=>s.nodeType===Node.ELEMENT_NODE&&(s.tagName==="UL"||s.tagName==="OL");return t.forEach((s,c)=>{s.nodeType===Node.ELEMENT_NODE&&s.tagName==="BR"?(i(c),r=c+1):l(s)?(i(c),o.push({html:jt([s]),nodes:[s],startIndex:c,endIndex:c}),r=c+1):n.push(s)}),i(t.length),o}function jt(e){const o=document.createElement("div");return e.forEach(t=>o.appendChild(t.cloneNode(!0))),o.innerHTML}function wo(e,o){const t=Lo(o);if(!t)return 0;const n=t.container;if(!o.contains(n))return 0;for(let r=0;r<e.length;r++)for(const i of e[r].nodes)if(i===n||i.contains(n))return r;if(n===o){const r=t.offset;for(let i=0;i<e.length;i++)if(r>=e[i].startIndex&&r<=e[i].endIndex)return i;for(let i=0;i<e.length;i++)if(r===e[i].startIndex)return i;for(let i=0;i<e.length;i++)if(e[i].startIndex>=r)return i;if(e.length>0)return e.length-1}return 0}function wn(e,o,t,n){if(!t.contains(o))return n;for(let r=0;r<e.length;r++)for(const i of e[r].nodes)if(i===o||i.contains(o))return r;return n}function Xi(e,o){const t=window.getSelection();if(!t||t.rangeCount===0){const s=wo(e,o);return{start:s,end:s}}const n=t.getRangeAt(0);if(n.collapsed){const s=wo(e,o);return{start:s,end:s}}const r=wo(e,o),i=wn(e,n.startContainer,o,r),l=wn(e,n.endContainer,o,r);return{start:Math.min(i,l),end:Math.max(i,l)}}function Zi(e){return e.querySelector("br")!==null}function Ji(e){const o=Lo(e);if(!o)return null;const t=o.container.nodeType===Node.ELEMENT_NODE?o.container:o.container.parentElement;if(!t)return null;const n=t.closest("ol, ul");return n&&e.contains(n)?n:null}function Qi(e){const o=Lo(e);if(!o)return;const{container:t,offset:n}=o;if(t!==e)return;const r=Array.from(e.childNodes),i=n>0?r[n-1]:null,l=n<r.length?r[n]:null,s=b=>b!==null&&b.nodeType===Node.ELEMENT_NODE&&b.tagName==="BR",c=b=>b!==null&&b.nodeType===Node.TEXT_NODE&&b.data.trim()==="",d=s(i),u=s(l),g=c(l),m=n>=r.length;if(!(d&&u||d&&m||n===0&&u||d&&g))return;let f;g?(f=l,f.data=" "):(f=document.createTextNode(" "),l?e.insertBefore(f,l):e.appendChild(f));const p=window.getSelection();if(p){const b=document.createRange();b.setStart(f,0),b.collapse(!0),p.removeAllRanges(),p.addRange(b)}Ct={container:f,offset:0}}function el(e,o){const t=o?"ol":"ul";if(e.querySelector("ol, ul")){const n=Ji(e);if(n){if(n.tagName.toLowerCase()===t)return;const l=document.createElement(t);for(Array.from(n.attributes).forEach(s=>{s.name!=="style"&&l.setAttribute(s.name,s.value)}),l.setAttribute("style",a.STANDARD_LIST_STYLES.LIST);n.firstChild;)l.appendChild(n.firstChild);n.parentNode?.replaceChild(l,n);return}const r=e.querySelector(":scope > ol, :scope > ul"),i=Array.from(e.childNodes).some(l=>l.nodeType===Node.ELEMENT_NODE&&l.tagName==="BR");if(r&&!i){if(r.tagName.toLowerCase()===t)return;const l=document.createElement(t);for(Array.from(r.attributes).forEach(s=>{s.name!=="style"&&l.setAttribute(s.name,s.value)}),l.setAttribute("style",a.STANDARD_LIST_STYLES.LIST);r.firstChild;)l.appendChild(r.firstChild);r.parentNode?.replaceChild(l,r);return}}Zi(e)||e.querySelector(":scope > ol, :scope > ul")?(Qi(e),tl(e,t)):kn(e,t)}function kn(e,o){const t=document.createElement(o);t.setAttribute("style",a.STANDARD_LIST_STYLES.LIST);const n=document.createElement("li");n.setAttribute("style",a.STANDARD_LIST_STYLES.LIST_ITEM);const r=e.innerHTML.trim();r?n.innerHTML=r:n.innerHTML=" ",t.appendChild(n),e.innerHTML="",e.appendChild(t),_n(n)}function tl(e,o){const t=Ki(e);if(t.length===0){kn(e,o);return}const{start:n,end:r}=Xi(t,e),i=document.createElement(o);i.setAttribute("style",a.STANDARD_LIST_STYLES.LIST);let l=null;for(let d=n;d<=r;d++){const u=document.createElement("li");u.setAttribute("style",a.STANDARD_LIST_STYLES.LIST_ITEM),u.innerHTML=t[d].html.trim()||" ",i.appendChild(u),l=u}const s=t.slice(0,n).map(d=>d.html).join("<br>"),c=t.slice(r+1).map(d=>d.html).join("<br>");if(e.innerHTML="",s.trim()){const d=document.createElement("span");for(d.innerHTML=s;d.firstChild;)e.appendChild(d.firstChild);e.appendChild(document.createElement("br"))}if(e.appendChild(i),c.trim()){e.appendChild(document.createElement("br"));const d=document.createElement("span");for(d.innerHTML=c;d.firstChild;)e.appendChild(d.firstChild)}l&&_n(l)}function _n(e){try{const o=window.getSelection();if(o){const t=document.createRange();t.selectNodeContents(e),t.collapse(!0),o.removeAllRanges(),o.addRange(t)}}catch{}}function ol(e,o){let t=0;const n=Array.from(e.childNodes);for(const r of n){if(r===o)return t;r.nodeType===Node.ELEMENT_NODE&&r.tagName==="BR"&&t++}return t}function nl(e,o){const t=Yi(e);if(o<0||o>=t.length)return;const n=t[o];if(n.nodes.length!==0)try{const r=window.getSelection();if(!r)return;const i=n.nodes[0],l=document.createRange();if(i.nodeType===Node.TEXT_NODE)l.setStart(i,0),l.collapse(!0);else if(i.nodeType===Node.ELEMENT_NODE)l.selectNodeContents(i),l.collapse(!0);else return;r.removeAllRanges(),r.addRange(l)}catch{}}function rl(e){const o=e.querySelector("ol, ul");if(!o)return;const t=ol(e,o),n=o.querySelectorAll("li"),r=[];n.forEach(l=>{const s=l.innerHTML.trim();s&&s!==" "&&r.push(s)});const i=r.join("<br>");i?o.outerHTML=i:o.outerHTML=" ",nl(e,t)}function Gt(e){if(!e)return!1;const o=e.closest("ul, ol");return o?!o.closest(a.TABLE_LIST_SELECTOR):!1}function Nn(e){return e.getAttribute("src")}function Yt(e,o){const t=a.resolveActiveElement(e.elem),n=Nn(t),r=a.getElementMobileProps({elem:t}),i=t.closest("td"),l=i?a.getElementMobileProps({elem:i}):null;let s="img",c=o.PICTURE;e.elem.classList.contains("em-countdown")?(s="countdown",c=o.COUNTDOWN):e.elem.classList.contains("em-video")&&(s="video",c=o.VIDEO);const d=g=>g===null||g==="auto"?null:typeof g=="number"?g:null,u={type:s,caption:c,src:n??"",width:Bn(t,"width"),height:Bn(t,"height"),alt:t.getAttribute("alt")??"",title:t.getAttribute("title")??"",align:i?.getAttribute("align")??"undefined",valign:t.style?.verticalAlign??"undefined",border:a.getElementBorder(t),borderRadius:a.getElementBorderRadius(t),boxShadow:a.getElementBoxShadow(t),mobileWidth:{value:d(r.mobileWidth),dim:r.mobileWidthDim??"px"},mobileHeight:{value:d(r.mobileHeight),dim:r.mobileHeightDim??"px"},mobileBorder:r.mobileBorder,mobileBorderRadius:r.mobileBorderRadius,mobileBoxShadow:r.mobileBoxShadow,mobileAlign:l?.mobileAlign,mobileVerticalAlign:r.mobileVerticalAlign,show:r.show,link:t.closest("a")?.getAttribute("href")??null,renderedWidth:Math.round(e.elem.getBoundingClientRect().width),renderedHeight:Math.round(e.elem.getBoundingClientRect().height),imgReplacer:t.closest("em-replace")?.getAttribute("src")??""};if(s==="countdown"&&(u.countdown=e.elem.getAttribute("em-cd-settings")??void 0),s==="video"){const g=e.elem.getAttribute("em-video-settings");if(g)try{u.video=JSON.parse(g.replaceAll("'",'"'))}catch{u.video={}}}return a.isShowOnMobile(e.elem)&&(u.showOnMobile=!0),i&&(u.maxWidth=Math.round(i.getBoundingClientRect().width)),u}function Bn(e,o){const t=e.getAttribute(o);return!t||t==="auto"?{value:null,dim:"px"}:{value:parseFloat(t),dim:t.includes("%")?"%":"px"}}function Mn(e){return e.tagName==="IMG"||e.tagName==="AMP-IMG"}var Rn="em-mob-text_align-",il=":scope > tr > td, :scope > tbody > tr > td",ll='div[style*="font-family"][style*="font-size"]';function ko(e){return e.querySelector(il)}function _o(e){return e.querySelector(ll)}function al(e,o){for(let t=e;t&&t!==o;t=t.parentElement)if(t.tagName.includes("-"))return!0;return!1}function Pn(e){const o=e.closest('table[em="atom"]');if(!o||al(e,o))return null;const t=ko(o);return t?{atomTd:t,textDiv:_o(t)}:null}function vt(e){const o=e.closest("div, p, td");if(!o)return null;if(o.style.textAlign)return o;const t=Pn(e);return t?t.textDiv?.hasAttribute("align")?t.textDiv:t.atomTd:o}function In(e){const o=vt(e);return o&&(o.style.textAlign||o.getAttribute("align"))||"left"}function sl(e){const o=vt(e);if(!o)return"";for(const t of o.classList)if(t.startsWith("em-mob-text_align-"))return t.slice(18);return""}function No(e){return{value:sl(e)}}function cl(e,o,t=Rn){const n=Pn(e);if(n)for(const r of[n.atomTd,n.textDiv])r&&r!==o&&a.removeClassesByPrefix(r,t)}function dl(e){const o=ko(e);if(!o)return null;const t=_o(o);return t?.hasAttribute("align")?t:o}function ml(e,o){e.querySelectorAll('[em="atom"]').forEach(t=>{const n=dl(t);n&&o(n,t)})}function ul(e,o,t=Rn){const n=ko(e),r=n?_o(n):null;for(const i of[n,r])i&&i!==o&&a.removeClassesByPrefix(i,t)}function Kt(e,o,t){const n=a.getParentElementOfSelection()||e.elem,r=n.tagName==="EDITOR"&&n.firstChild?.nodeType===1?n.firstChild:n,i=e.elem.closest('[style*="font-family"], [style*="font-size"], [style*="line-height"]')||e.elem,l=r.style.fontFamily||r.style.fontSize||r.style.lineHeight||r.closest('[style*="font-family"], [style*="font-size"], [style*="line-height"]')?r:i,s=e.elem.closest('[style*="line-height"]')||l.querySelector('[style*="line-height"]')||l,c=n.closest('[class*="em-mob-font_size"], [style*="font-size"]')||n,d=n.closest('[class*="em-mob-line_height"]')||n.closest('[style*="line-height"]')||n,u=a.getElementMobileProps({elem:c}),g=a.getElementMobileProps({elem:d}),m=Hn(e.elem,t),f=a.textHasStyle$1(r,"strong","b"),p=l!==r?a.textHasStyle$1(l,"strong","b"):!1,b=e.elem&&r&&e.elem.isConnected&&(r===e.elem||r.contains(e.elem))?a.textHasStyle$1(e.elem,"strong","b"):!1,h=f||p||b,y=a.isElementHasBold(l),E=h||y,S={type:"text",caption:o.TEXT,fontFamily:a.getFontFamilyFromElement$1(l.closest('[style*="font-family"]')||e.elem),fontSize:parseFloat(e.elem.closest('[style*="font-size"]')?.style.fontSize)||parseFloat(getComputedStyle(e.elem).fontSize),fontSizeDim:"px",lineHeight:a.getLineHeightInPixels$1(s),lineHeightDim:"px",textAlign:In(e.elem),textStrong:E,textItalic:a.textHasStyle$1(e.elem,"i","em")||!l.closest('[style*="font-style: normal"]')&&l.style?.fontStyle==="italic",textStrikethrough:a.textHasStyle$1(e.elem,"s","strike")||(l.style?.textDecoration?.includes("line-through")??!1),textUnderline:a.textHasStyle$1(e.elem,"u")||(l.style?.textDecoration?.includes("underline")??!1)||!l.style?.textDecoration&&(e.elem.tagName==="A"&&e.elem.hasAttribute("href")||a.hasLinkInSelection()),textColor:a.rgbToHex(e.elem.closest('[style*="color"]')?.style.color)||a.rgbToHex(getComputedStyle(e.elem).color)||"",textBackgroundColor:bl(e.elem),mobileFontSize:{value:u.mobileFontSize,dim:u.mobileFontSizeDim||"px"},mobileLineHeight:{value:g.mobileLineHeight,dim:"px"},mobileTextAlign:No(e.elem),linkHref:(()=>{const v=l.closest("a");if(!v)return;const C=v.getAttribute("href");if(C!==null)return C})(),textAnchor:(()=>{const v=l.closest("a");if(v&&!v.hasAttribute("href"))return v.getAttribute("name")?.trim()||void 0})(),textLink:(()=>{const v=l.closest("a");return v?!!v.hasAttribute("href"):a.textHasStyle$1(e.elem,"a")||a.hasLinkInSelection()})(),textReplacer:t.variableElement(e.elem),list:m,standardList:On(e.elem),textSuperscript:a.textHasStyle$1(e.elem,"sup"),textSubscript:a.textHasStyle$1(e.elem,"sub")};return a.isShowOnMobile(n)&&(S.showOnMobile=!0),S}function Hn(e,o){const{isElementList:t,isElementListOL:n,isElementListUL:r,requestElemBullet:i}=o;if(!t)return{isList:!1,listType:"UL"};const l=e.closest("td");return{isList:!0,listType:n?"OL":"UL",bulletsColor:t&&i?a.rgbToHex(i.closest('[style*="color"]')?.style.color):"",betweenParagraphs:t&&parseInt(l?.style?.paddingBottom,10)||0,betweenRowCell:t&&parseInt(l?.style?.paddingLeft,10)||0,bulletFontSize:t&&i&&parseInt(i.style.fontSize,10)||0,bulletFontBold:t?i?.style.fontWeight==="bold":!1,bulletFontItalic:t?i?.style.fontStyle==="italic":!1,bulletFontFamily:n&&i?a.getFontFamilyFromElement$1(i):"",bulletFontUnderline:t?i?.style.textDecoration?.includes("underline")??!1:!1,bulletFontStrikethrough:t?i?.style.textDecoration?.includes("line-through")??!1:!1,bulletType:r&&i?i.innerHTML.replace(/\s| /g,""):""}}function On(e){return Gt(e)?{listTypeOL:!!e.querySelector("ol")||!!e.closest("ol"),listTypeUL:!!e.querySelector("ul")||!!e.closest("ul")}:{listTypeOL:!1,listTypeUL:!1}}function Bo(e){if(!e)return!1;const o=e.trim().toLowerCase();return o!=="transparent"&&o!=="inherit"}var fl=new Set(["A","B","EM","I","MARK","S","SMALL","SPAN","STRIKE","STRONG","SUB","SUP","U"]);function pl(e){let o=e;for(;o&&fl.has(o.tagName);){const t=o.style.backgroundColor;if(Bo(t))return t;o=o.parentElement}return""}function gl(e,o,t){let n=e;for(;n;){const r=n.style.getPropertyValue(o);if(Bo(r))return r;if(t&&n===t)break;n=n.parentElement}return""}function bl(e){const o=pl(e);if(Bo(o))return a.rgbToHex(o)||"";if(e.closest(".em-element-custom-table"))return a.rgbToHex(a.findParentWithExplicitStyle(e,"background-color"))||"";const t=e.closest("div");return a.rgbToHex(gl(e,"background-color",t))||""}function hl(e){return e.tagName==="DIV"?!!(e.style.fontFamily&&e.style.fontSize&&e.style.lineHeight):e.tagName==="TD"?e.firstChild?.tagName==="EDITOR"||e.firstElementChild?.tagName==="EDITOR":!1}function yl(e,o,t){const{findElementWithSelectedText:n,selectedText:r,variableElement:i,requestElemBullet:l,isElementList:s,isElementListOL:c,isElementListUL:d}=t,u=n(r,e.elem)||e.elem,g=e.elem.closest('[class*="em-mob-font_size"]')||e.elem.closest('[style*="font-size"]')||e.elem,m=e.elem.closest('[class*="em-mob-line_height"]')||e.elem.closest('[style*="line-height"]')||e.elem,f=a.getElementMobileProps({elem:g}),p=a.getElementMobileProps({elem:m}),b=Hn(e.elem,t),h={type:"text",caption:o.TEXT,linkHref:(()=>{const y=e.elem.getAttribute("href");if(y!==null)return y})(),textAnchor:(()=>{if(!e.elem.hasAttribute("href"))return e.elem.getAttribute("name")?.trim()||void 0})(),textLink:!!e.elem.hasAttribute("href"),target:e.elem.getAttribute("target")??"",fontFamily:a.getFontFamilyFromElement$1(e.elem),fontSize:parseFloat(e.elem.closest('[style*="font-size"]')?.style.fontSize)||0,fontSizeDim:"px",lineHeight:a.getLineHeightInPixels$1(e.elem),lineHeightDim:"px",textAlign:In(e.elem),textStrong:a.textHasStyle$1(u,"strong","b")||a.isElementHasBold(u),textItalic:a.textHasStyle$1(u,"i","em")||!e.elem.closest('[style*="font-style: normal"]')&&e.elem.style?.fontStyle==="italic",textStrikethrough:a.textHasStyle$1(u,"s","strike")||(e.elem.style?.textDecoration?.includes("line-through")??!1),textUnderline:a.textHasStyle$1(u,"u")||(e.elem.style?.textDecoration?.includes("underline")??!1)||!(e.elem.style?.textDecoration?.length>0)&&e.elem.tagName==="A"&&e.elem.hasAttribute("href"),textColor:a.rgbToHex(e.elem.tagName==="A"?a.findParentWithExplicitStyle(e.elem.querySelector('[style*="color"]'),"color"):a.findParentWithExplicitStyle(e.elem,"color"))||a.rgbToHex(getComputedStyle(e.elem).color)||"",textBackgroundColor:a.rgbToHex(e.elem.tagName==="A"?a.findParentWithExplicitStyle(e.elem.querySelector('[style*="background-color"]'),"background-color"):a.findParentWithExplicitStyle(e.elem,"background-color"))||"",mobileFontSize:{value:f.mobileFontSize,dim:f.mobileFontSizeDim||"px"},mobileLineHeight:{value:p.mobileLineHeight,dim:"px"},mobileTextAlign:No(e.elem),textReplacer:i(e.elem),list:b,standardList:On(e.elem),textSuperscript:a.textHasStyle$1(e.elem,"sup"),textSubscript:a.textHasStyle$1(e.elem,"sub")};return a.isShowOnMobile(e.elem)&&(h.showOnMobile=!0),h}function Mo(e){let o="";if(e.nodeType===Node.COMMENT_NODE&&e.nodeValue?.includes("[if mso]")){const t=e.nodeValue.replace(/^\[if mso\]>/i,"").replace(/<!\[endif\]$/i,"").trim();o+=t}return e.childNodes.forEach(t=>{o+=Mo(t)}),o}function Ro(e,o,t={value:0}){e.nodeType===Node.COMMENT_NODE&&e.nodeValue?.includes("[if mso]")&&(t.value===0?e.nodeValue=`[if mso]>${o}<![endif]`:e.nodeValue="",t.value++),e.childNodes.forEach(n=>Ro(n,o,t))}function El(e,o){const t=e.getAttribute(o);return!t||t==="auto"?{value:null,dim:"px"}:{value:parseFloat(t),dim:t.includes("%")?"%":"px"}}function xn(e,o){const t=e.style[o];return t?{value:parseFloat(t),dim:t.includes("%")?"%":"px"}:{value:null,dim:"px"}}function Sl(e){return e===null||e==="auto"?null:typeof e=="number"?e:null}function Cl(e){if(e.style.backgroundImage){const o=e.style.backgroundImage;return[{type:"url",value:o.substring(5,o.length-2)}]}return e.getAttribute("background")?[{type:"url",value:e.getAttribute("background")||""}]:[{type:"url",value:""}]}function vl(e,o){const t=e.elem;if(t.innerHTML==="")return{type:"emptyTable",caption:o.TABLE};t.setAttribute("em-edit","active");const n=a.getElementMobileProps({elem:t}),r={type:"table",caption:o.TABLE,backgroundColor:t.style.backgroundColor?a.rgbToHex(t.style.backgroundColor):"",backgroundImage:Cl(t),backgroundPositionX:t.style.backgroundPositionX!=="initial"?t.style.backgroundPositionX:"",backgroundPositionY:t.style.backgroundPositionY!=="initial"?t.style.backgroundPositionY:"",backgroundRepeat:t.style.backgroundRepeat||"repeat",backgroundSize:t.style.backgroundSize||"auto",width:El(t,"width"),maxWidth:xn(t,"maxWidth"),minWidth:xn(t,"minWidth"),align:t.getAttribute("align")??"",border:a.getElementBorder(t),boxShadow:a.getElementBoxShadow(t),borderRadius:a.getElementBorderRadius(t),mobileWidth:{value:Sl(n.mobileWidth),dim:n.mobileWidthDim??"px"},mobileBorder:n.mobileBorder,mobileBorderRadius:n.mobileBorderRadius,mobileBoxShadow:n.mobileBoxShadow,show:n.show,mobileAlign:n.mobileAlign,mobileBackgroundColor:n.mobileBackgroundColor,mobileBackgroundImage:n.mobileBackgroundImage,mobileBackgroundPositionX:n.mobileBackgroundPositionX,mobileBackgroundPositionY:n.mobileBackgroundPositionY,mobileBackgroundRepeat:n.mobileBackgroundRepeat,mobileBackgroundSize:n.mobileBackgroundSize,exportAsPicture:t.getAttribute("em-operation")==="exportAsPicture",outlookBackground:a.hasElementVMLBackground(t,"around")};return a.isShowOnMobile(t)&&(r.showOnMobile=!0),r}function Al(e){return e.tagName==="TABLE"&&e.getAttribute("em")!=="atom"}function Tl(e){return e.closest("em-replace")?.getAttribute("text")||null}var Ll=()=>a.isInitialized()?a.getHtmlDocument():null,wl=()=>a.state.get("isProgrammaticSelection");function kl(e){if(!a.isElementLocked())try{a.incrementLock(),a.removeAllAttributes("em-edit");let o={};if(!e.elem)return;const t=_l(e.elem);if(!t)return;e.elem=t;const n=Nl(e.elem);document.body.classList.contains("mceNonEditable")||Bl(e.elem),o=Pl(e,n),o.type&&(o.operation="application_element_settings_set",a.messageService.send(o))}finally{a.decrementLock()}}function _l(e){const o=Ll();return!o||!o.getMappedParent(e)?e:o.getVisibleNode(e)}function Nl(e){const o=a.hasClosestTrWithClass(e,a.CLASS_NAME_OL),t=a.hasClosestTrWithClass(e,a.CLASS_NAME_UL),n=o||t,r=n?e.closest("tr")?.querySelector("td:first-child div:first-child"):null,i=document.querySelectorAll(`.${a.CLASS_NAME_OL}, .${a.CLASS_NAME_UL}`);return{isElementListOL:o,isElementListUL:t,isElementList:n,isCellCustomTable:!!e.closest(".em-element-custom-table"),bulletElem:r,totalListCount:i.length}}function Po(e){return{variableElement:Tl,requestElemBullet:e.bulletElem,isElementListOL:e.isElementListOL,isElementListUL:e.isElementListUL,isElementList:e.isElementList}}function Bl(e){const o=window.getSelection();(o?.isCollapsed||!o?.isCollapsed&&!e.querySelector("editor"))&&(a.removeAllAttributes("em-edit"),e.tagName!=="TABLE"&&(a.resolveActiveElement(e).setAttribute("em-edit","active"),Ml(e)),Rl(e))}function Ml(e){const o=e.closest("table");if(!o)return;for(const n of o.querySelectorAll('[contenteditable="true"]'))n.tagName!=="EDITOR"&&n.removeAttribute("contenteditable");const t=o.querySelector("editor");if(t){const n=t.firstChild;t.childNodes.length===1&&n?.nodeType===1&&n.tagName==="A"&&n.childNodes.length===1&&n.firstChild?.nodeType===3?n.setAttribute("contenteditable","true"):t.setAttribute("contenteditable","true")}}function Rl(e){const o=e.parentElement;o&&(o.querySelectorAll("strike, s").forEach(t=>{t.style.textDecoration="line-through"}),o.querySelectorAll("u").forEach(t=>{t.style.textDecoration="underline"}))}function Pl(e,o){const t=e.elem;if(!(window.getSelection()?.isCollapsed??!0)&&!t.closest("a")&&!wl()&&!o.isCellCustomTable){const n=Po(o);return{type:"text",caption:Locale.TEXT,settings:Kt(e,Locale,n)}}if(t.closest("amp-carousel"))return Il(e);if(t.tagName==="AMP-ACCORDION")return Hl(e);if(Mn(t))return{type:Yt(e,Locale).type,caption:Yt(e,Locale).caption,settings:Yt(e,Locale)};if(!o.isCellCustomTable&&(t.tagName==="A"||t.tagName==="EM-REPLACE"&&t.closest("a")))return Ol(e,o);if(t.tagName==="TABLE"&&t.getAttribute("em")!=="atom")return xl(e);if(t.tagName==="LI"&&Gt(t)){const n=Po(o);return{type:"text",caption:Locale.TEXT,settings:Kt(e,Locale,n)}}return o.isCellCustomTable?Dl(e):t.tagName==="TD"?Fl(e):t.closest(".em-vindent")?ql(e):t.classList.contains("em-floatblock")||t.closest(".em-floatblock")?Wl(e):t.tagName==="DIV"?$l(e,o):t.getAttribute("em")==="block"?zl(e):{}}function Il(e){return{type:"carousel",caption:Locale.CAROUSEL,settings:{}}}function Hl(e){return{type:"accordion",caption:Locale.ACCORDION,settings:{}}}function Ol(e,o){const t=e.elem;if(t.style?.display==="block"||t.style?.display==="inline-block")return{type:"button",caption:Locale.BUTTON,settings:{}};const n=Po(o);return{type:"text",caption:Locale.TEXT,settings:Kt(e,Locale,n)}}function xl(e){return e.elem.innerHTML===""?{type:"emptyTable",settings:{}}:{type:"table",caption:Locale.TABLE,settings:{}}}function Dl(e){return{type:"customTable",caption:Locale.TABLE,settings:{}}}function Fl(e){return{type:"td",caption:Locale.TABLE_COLUMN,settings:{}}}function ql(e){return{type:"vindent",caption:Locale.VERTICAL_INDENT,settings:{}}}function Wl(e){return{type:"floatBlock",caption:Locale.FLOAT_BLOCK,settings:{}}}function $l(e,o){return{type:"div",caption:Locale.CONTAINER,settings:{}}}function zl(e){return{type:"structure",caption:Locale.STRUCTURE,settings:{}}}var ob=Promise.resolve();function At(e){return!(!e.startsWith("#")||e.indexOf("#",1)!==-1)}var Vl=["em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"],Ul=["em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top"],jl=["em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"];function Dn(){document.querySelectorAll(".em-block-insert").forEach(e=>{e.classList.remove(...Vl)})}function Gl(){document.querySelectorAll(".em-atom-insert").forEach(e=>{e.classList.remove(...Ul)})}function Xt(){document.querySelectorAll(".em-blockatom-insert").forEach(e=>{e.classList.remove(...jl)})}function Io(e,o){const t=e.getBoundingClientRect();return o>t.top+t.height/2?"bottom":"top"}function Fn(e,o){const t=e.getBoundingClientRect(),n=document.body.getBoundingClientRect();return o==="bottom"?t.bottom>n.height-21:t.top<2}function Ho(e,o,t){const n=t==="atom"?"em-atom-insert":"em-block-insert",r=t==="blockatom"?"em-blockatom-insert":n;if(e.classList.add(r),o==="bottom"){e.classList.remove(`${n}_top`,`${n}_top-document`);const i=Fn(e,"bottom")?`${n}_bottom-document`:`${n}_bottom`;e.classList.add(i)}else{e.classList.remove(`${n}_bottom`,`${n}_bottom-document`);const i=Fn(e,"top")?`${n}_top-document`:`${n}_top`;e.classList.add(i)}}function Oo(e){return e.tagName==="TABLE"&&!e.innerHTML}function Zt(e){return e.tagName==="TABLE"||e.tagName==="TR"?e.querySelector("[data-template-content]")??e.querySelector("td"):e}function qn(e){if(!e?.length)return null;for(let o=0;o<e.length;o++){const t=e.item(o);if(t?.type.startsWith("image/"))return t}return null}function Yl(e){if(!e?.items?.length)return null;for(let o=0;o<e.items.length;o++){const t=e.items[o];if(t.kind!=="file")continue;const n=t.getAsFile();if(n&&n.type.startsWith("image/"))return n}return null}function Kl(e){const o=qn(e.dataTransfer?.files??null);return o||Yl(e.dataTransfer??null)}function xo(e){const o=document.body?.parentElement??document.body;if(!o)return null;const t=document.elementFromPoint(e.clientX,e.clientY);if(!t)return null;const n=t.closest(".em-element-resize-img-container");if(n){const i=n.querySelector("img");if(i&&o.contains(i))return i}const r=t.closest("img");return!r||!o.contains(r)?null:r}function Tt(e){const o=e.dataTransfer?.types;return!!o&&Array.from(o).includes("Files")}function Do(e){if(!Tt(e))return!1;const o=e.dataTransfer;if(!o)return!1;if(o.files?.length)return!!qn(o.files);const t=o.items;if(!t?.length)return!0;for(let n=0;n<t.length;n++){const r=t[n];if(r.kind!=="file")continue;const i=r.type||"";if(i.startsWith("image/")||i==="")return!0}return!1}var Wn="em-native-img-drop-target",Fo="em-native-img-uploading",Xl="em-native-img-drop-loading",Jt="em-native-file-drag",Lt=null,et=null;function $n(){et&&(window.removeEventListener("scroll",et.reposition,!0),window.removeEventListener("resize",et.reposition),et.resizeObserver?.disconnect(),et.overlay.remove(),et=null)}function Zl(e){$n();const o=document.createElement("div");o.className="em-native-img-upload-spin-overlay",o.setAttribute("aria-hidden","true");const t=document.createElement("div");t.className="em-native-img-upload-spin",o.appendChild(t),document.body.appendChild(o);const n=()=>{const i=e.getBoundingClientRect();o.style.left=`${Math.round(i.left)}px`,o.style.top=`${Math.round(i.top)}px`,o.style.width=`${Math.max(Math.round(i.width),1)}px`,o.style.height=`${Math.max(Math.round(i.height),1)}px`};n(),window.addEventListener("scroll",n,!0),window.addEventListener("resize",n);let r=null;typeof ResizeObserver<"u"&&(r=new ResizeObserver(()=>n()),r.observe(e)),et={overlay:o,reposition:n,resizeObserver:r}}function qo(){Lt&&(Lt.classList.remove(Wn),Lt=null)}function tt(){document.body.classList.remove(Jt),qo()}function Jl(e){if(!Tt(e)){tt();return}if(!Do(e)){tt();return}document.body.classList.add(Jt);const o=xo(e);if(!o){qo();return}Lt!==o&&(qo(),Lt=o,o.classList.add(Wn))}function zn(){$n(),document.body.classList.remove(Xl),document.body.classList.remove(Jt),document.querySelectorAll(`.${Fo}`).forEach(e=>{e.classList.remove(Fo)})}function Ql(e,o){if(o.lockEditor||!Tt(e))return!1;const t=Kl(e);if(!t)return!1;const n=xo(e);return n?(o.applicationElementSettingsSet({elem:n}),tt(),n.classList.add(Fo),Zl(n),o.messageService.send({operation:a.EVENT_TYPES.APPLICATION_NATIVE_IMAGE_DROP,file:t}),!0):!1}function ea(e,o){if(o.lockEditor)return;document.body.classList.contains("em-block-insert-body")||o.messageService.send({operation:"application_scroll-block-show"});const t=e.target;t.getAttribute("em")==="atom"&&(document.body.classList.add("em-atom-insert-body-inside"),o.commit(!1),o.mutableState.atomReplaced=t)}function ta(e,o){o.lockEditor||(tt(),e.preventDefault(),o.messageService.send({operation:"application_scroll-block-hide"}))}function oa(e,o){if(e.preventDefault(),o.lockEditor){tt();return}Tt(e)?(Do(e)&&xo(e)&&(e.dataTransfer.dropEffect="copy"),Jl(e)):tt();const t=e.target;if(document.body.classList.contains("em-block-insert-body")){const n=Oo(t)?null:t.closest('[em="block"]');if(n){o.mutableState.targetBlock=n;const r=Zt(n);r&&Ho(r,Io(r,e.pageY),"block")}else Dn()}else if(document.body.classList.contains("em-atom-insert-body")){const n=t.closest('[em="atom"]');if(n&&n.innerHTML.trim())o.mutableState.targetBlock=n,Ho(n,Io(n,e.pageY),"atom"),Xt();else if(t.closest('[em="block"]')&&t.tagName==="TD"&&!t.innerHTML&&!t.hasAttribute("height")||t.tagName==="DIV"&&t.closest("amp-accordion")&&!t.innerHTML)Xt();else{const r=t.closest('[em="block"]');if(r){o.mutableState.targetBlock=r;const i=Zt(r);i&&(Ho(i,Io(i,e.pageY),"blockatom"),Gl())}}}}function na(e,o){if(o.lockEditor)return;Tt(e)&&Do(e)&&document.body.classList.add(Jt);const t=e.target;if(document.body.classList.contains("em-block-insert-body")){document.querySelectorAll(".em-block-insert-empty").forEach(r=>{r.classList.remove("em-block-insert-empty")});const n=t.closest('[em="block"]');Oo(t)?(t.classList.add("em-block-insert-empty"),Dn()):n&&(o.mutableState.targetBlock=n)}else if(document.body.classList.contains("em-atom-insert-body")||document.body.classList.contains("em-atom-insert-body-inside")){document.querySelectorAll(".em-atom-insert-empty").forEach(i=>{i.classList.remove("em-atom-insert-empty")});const n=t.closest('[em="atom"]');n&&n.innerHTML.trim()?(o.mutableState.targetBlock=n,document.querySelectorAll(".em-atom-insert, .em-blockatom-insert").forEach(i=>{i.classList.remove("em-atom-insert","em-blockatom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top")})):t.closest('[em="block"]')&&t.tagName==="TD"&&!t.innerHTML&&!t.hasAttribute("height")&&t.parentElement&&[...t.parentElement.children].indexOf(t)%2===0||t.tagName==="DIV"&&t.closest("amp-accordion")&&!t.innerHTML?(t.classList.add("em-atom-insert-empty"),document.querySelectorAll(".em-atom-insert, .em-blockatom-insert").forEach(i=>{i.classList.remove("em-atom-insert","em-blockatom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top")})):document.querySelectorAll(".em-atom-insert").forEach(i=>{i.classList.remove("em-atom-insert","em-blockatom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top")}),document.querySelectorAll(".em-block-insert-empty").forEach(i=>{i.classList.remove("em-block-insert-empty")});const r=t.closest('[em="block"]');Oo(t)?(t.classList.add("em-block-insert-empty"),Xt()):r?o.mutableState.targetBlock=r:Xt()}}function ra(e,o){if(o.lockEditor)return;const t=e.target;if(document.body.classList.contains("em-block-insert-body")){const n=e.relatedTarget,r=t.closest('[em="block"]');if(n&&r&&r.contains(n))return;o.mutableState.newTargetblock=t.closest('[em="block"]'),o.mutableState.newTargetblock&&(t.closest('[em="block"]')&&(o.mutableState.newTargetblock!==o.mutableState.targetBlock||o.mutableState.newTargetblock.closest('[em="group"]')!==o.mutableState.targetBlock?.closest('[em="group"]'))?o.mutableState.newTargetblock.tagName==="DIV"?o.mutableState.newTargetblock.classList.remove("em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"):o.mutableState.newTargetblock.querySelectorAll(".em-block-insert").forEach(i=>{i.classList.remove("em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top")}):document.querySelectorAll(".em-block-insert-empty").forEach(i=>{i.classList.remove("em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top")}))}else if(document.body.classList.contains("em-atom-insert-body")){const n=e.relatedTarget,r=t.closest('[em="atom"]');if(n&&r&&r.contains(n))return;const i=t.closest('[em="block"]');if(n&&i&&i.contains(n))return;o.mutableState.newTargetblock=t.closest('[em="atom"]'),o.mutableState.newTargetblock&&(t.getAttribute("em")==="atom"&&o.mutableState.newTargetblock!==o.mutableState.targetBlock?o.mutableState.newTargetblock.classList.remove("em-atom-insert","em-blockatom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top"):document.querySelectorAll(".em-atom-insert-empty").forEach(s=>{s.classList.remove("em-atom-insert","em-blockatom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top")}));const l=t.closest('[em="block"]');l&&(t.closest('[em="block"]')&&(l!==o.mutableState.targetBlock||l.closest('[em="group"]')!==o.mutableState.targetBlock?.closest('[em="group"]'))?l.tagName==="DIV"?l.classList.remove("em-atom-insert","em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"):l.querySelectorAll(".em-blockatom-insert").forEach(s=>{s.classList.remove("em-atom-insert","em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top")}):document.querySelectorAll(".em-block-insert-empty").forEach(s=>{s.classList.remove("em-atom-insert","em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top")}))}}function ia(e,o,t){if(!e)return;let n=document.head.querySelector('style[em="styles"]'),r="";n?r=t.HTMLDocument.getInnerHtml(n):(n=document.createElement("style"),n.setAttribute("em","styles"),n=document.head.insertAdjacentElement("beforeend",n));const i=document.createElement("div");o&&(e=e.replace(/(max-device-width:|max-width:)\d+px/g,s=>s.replace(/\d+/,String(o)))),i.insertAdjacentHTML("afterbegin",e);let l=t.minify(r+`
|
|
2
2
|
`+[...i.querySelectorAll("style")].map(s=>s.innerHTML).join(`
|
|
3
3
|
`),{restructure:!0,forceMediaMerge:!0}).css;l=t.cssbeautify(l,{indent:" ",autosemicolon:!0}),n&&(n.textContent=`
|
|
4
4
|
`+l+`
|
|
@@ -145,7 +145,7 @@ __useblocks__.define("js/iframe.js",["require","exports","module","js/rolldown-r
|
|
|
145
145
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
|
146
146
|
<path d="M7 3H11M3 5H15M13.6667 5L13.1991 12.0129C13.129 13.065 13.0939 13.5911 12.8667 13.99C12.6666 14.3412 12.3648 14.6235 12.0011 14.7998C11.588 15 11.0607 15 10.0062 15H7.9938C6.93927 15 6.41202 15 5.99889 14.7998C5.63517 14.6235 5.33339 14.3412 5.13332 13.99C4.90607 13.5911 4.871 13.065 4.80086 12.0129L4.33333 5" stroke="#777582" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
|
|
147
147
|
</svg>
|
|
148
|
-
`;function Cs(e,o,t,n){const r=document.querySelector(".table-menu"),i=r?.closest("table");if(!i)return;const l=i?.querySelector(`.${a.CLASS_FOR_BASIC_CELL}`),s=Nt(i),{row:c}=Vo(s,a.CLASS_FOR_BASIC_CELL),{row:d,isOverlapped:u}=er(s,a.CLASS_FOR_BASIC_CELL),{isOverlapped:g}=tr(s,a.CLASS_FOR_BASIC_CELL);if(!i||!l)return;const m={addBottomRow:r.querySelector('[data-id="add-bottom-row"]'),addTopRow:r.querySelector('[data-id="add-top-row"]'),removeRow:r.querySelector('[data-id="remove-row"]'),mergeTopCell:r.querySelector('[data-id="merge-top-cell"]'),mergeBottomCell:r.querySelector('[data-id="merge-bottom-cell"]'),splitHorizontalCell:r.querySelector('[data-id="split-horizontal-cell"]'),addLeftColumn:r.querySelector('[data-id="add-left-column"]'),addRightColumn:r.querySelector('[data-id="add-right-column"]'),mergeRightCell:r.querySelector('[data-id="merge-right-cell"]'),mergeLeftCell:r.querySelector('[data-id="merge-left-cell"]'),splitVerticalCell:r.querySelector('[data-id="split-vertical-cell"]'),removeColumn:r.querySelector('[data-id="remove-column"]')};m.addBottomRow&&(m.addBottomRow.style.display="block"),m.addTopRow&&(m.addTopRow.style.display="block"),m.removeRow&&(m.removeRow.style.display="block"),m.mergeTopCell&&(m.mergeTopCell.style.display="block"),m.mergeBottomCell&&(m.mergeBottomCell.style.display="block"),m.splitHorizontalCell&&(m.splitHorizontalCell.style.display="none"),m.addLeftColumn&&(m.addLeftColumn.style.display="block"),m.addRightColumn&&(m.addRightColumn.style.display="block"),m.mergeRightCell&&(m.mergeRightCell.style.display="block"),m.mergeLeftCell&&(m.mergeLeftCell.style.display="block"),m.splitVerticalCell&&(m.splitVerticalCell.style.display="none"),m.removeColumn&&(m.removeColumn.style.display="block"),l.getAttribute("rowspan")&&m.splitHorizontalCell&&(m.splitHorizontalCell.style.display="block"),l.getAttribute("colspan")&&m.splitVerticalCell&&(m.splitVerticalCell.style.display="block"),e&&(m.mergeBottomCell&&(m.mergeBottomCell.style.display="none"),m.mergeRightCell&&(m.mergeRightCell.style.display="none"),m.mergeLeftCell&&(m.mergeLeftCell.style.display="none"),m.addTopRow&&(m.addTopRow.style.display="none"),m.addBottomRow&&(m.addBottomRow.style.display="none"),m.removeRow&&(m.removeRow.style.display="none")),o&&(m.mergeTopCell&&(m.mergeTopCell.style.display="none"),m.mergeRightCell&&(m.mergeRightCell.style.display="none"),m.mergeLeftCell&&(m.mergeLeftCell.style.display="none"),m.addTopRow&&(m.addTopRow.style.display="none"),m.addBottomRow&&(m.addBottomRow.style.display="none"),m.removeRow&&(m.removeRow.style.display="none")),t&&(m.mergeTopCell&&(m.mergeTopCell.style.display="none"),m.mergeBottomCell&&(m.mergeBottomCell.style.display="none"),m.mergeRightCell&&(m.mergeRightCell.style.display="none"),m.addLeftColumn&&(m.addLeftColumn.style.display="none"),m.addRightColumn&&(m.addRightColumn.style.display="none"),m.removeColumn&&(m.removeColumn.style.display="none")),n&&(m.mergeTopCell&&(m.mergeTopCell.style.display="none"),m.mergeBottomCell&&(m.mergeBottomCell.style.display="none"),m.mergeLeftCell&&(m.mergeLeftCell.style.display="none"),m.addLeftColumn&&(m.addLeftColumn.style.display="none"),m.addRightColumn&&(m.addRightColumn.style.display="none"),m.removeColumn&&(m.removeColumn.style.display="none")),g&&m.removeColumn&&(m.removeColumn.style.display="none"),u&&d===c&&m.removeRow&&(m.removeRow.style.display="none"),l.getAttribute("colspan")&&(m.mergeTopCell&&(m.mergeTopCell.style.display="none"),m.mergeBottomCell&&(m.mergeBottomCell.style.display="none")),l.getAttribute("rowspan")&&(m.mergeLeftCell&&(m.mergeLeftCell.style.display="none"),m.mergeRightCell&&(m.mergeRightCell.style.display="none"))}var vs={INSERT_COLUMN_BEFORE_TABLE:"Insert column before",INSERT_COLUMN_AFTER_TABLE:"Insert column after",MERGE_RIGHT_CELL_TABLE:"Merge right",MERGE_LEFT_CELL_TABLE:"Merge left",SPLIT_CELL_TABLE:"Split cell",REMOVE_COLUMN_TABLE:"Remove column",INSERT_ROW_BEFORE_TABLE:"Insert row before",INSERT_ROW_AFTER_TABLE:"Insert row after",MERGE_TOP_CELL_TABLE:"Merge top",MERGE_BOTTOM_CELL_TABLE:"Merge bottom",REMOVE_ROW_TABLE:"Remove row",EDIT_ATOM:"Edit"},ve=()=>window.Locale||vs;function As(e,o){e.forEach(t=>{o.querySelectorAll(`.${t}`).forEach(n=>n.classList.remove(t))})}function Ts(e,o){const t=e?.tagName==="TD"?e?.querySelector("div"):e?.closest("div")?e?.closest("div"):e;if(!e.closest(".em-element-custom-table")||t?.tagName!=="DIV")return!1;document.querySelectorAll(`.${a.TEMPORARY_ACTIVE_CELL_BACKGROUND_COLOR}`).forEach(y=>{y.classList.remove(a.TEMPORARY_ACTIVE_CELL_BACKGROUND_COLOR)});const n=[a.CLASS_FOR_BASIC_ROW,a.CLASS_FOR_BASIC_CELL];let r=!1,i=!1;const l=t,s=document.querySelector(`.${a.CLASS_FOR_BASIC_CELL}`),c=document.querySelector(".table-menu");s&&s.classList.remove(a.CLASS_FOR_BASIC_CELL),c&&c.remove();const d=l.closest(".em-element-custom-table"),u=d.closest('[em="block"]'),g=a.addElement({targetElement:d,insertType:"append",className:"of-atom table-menu",style:"width: 48px; height: 28px; display: flex; position: absolute; right: 0; top: -30px; background: #FFDCC7; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); pointer-events: auto; z-index: 1001;"});let m=!1,f=1;const p=()=>({isDirectionUP:a.state.get("isDirectionUP"),isDirectionDOWN:a.state.get("isDirectionDOWN"),isDirectionLEFT:a.state.get("isDirectionLEFT"),isDirectionRIGHT:a.state.get("isDirectionRIGHT"),actualTargetCount:a.state.get("actualTargetCount")});d.addEventListener("mousedown",y=>{const E=y.target.tagName.toUpperCase();if(y.button===0&&E!=="UL"&&E!=="LI"&&E!=="SVG"&&E!=="PATH"&&E!=="CIRCLE"){m=!0;const S=d.querySelector(`.${a.CLASS_FOR_BASIC_CELL}`);document.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`)?.forEach(v=>{v.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL),S?.classList.remove(a.CLASS_FOR_BASIC_CELL)})}}),d.addEventListener("mouseup",y=>{m=!1,y.target.closest("td")?.classList.contains("remove-basic-cell")&&a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1})}),d.addEventListener("mouseover",y=>{const E=d.querySelector(`.${a.CLASS_FOR_BASIC_CELL}`);f=d.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).length,f=f===0?1:f;const S=y.target;if(m&&S.closest("TD")&&E){const v=S.closest("TD");d.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach($=>$.classList.remove(a.TEMPORARY_CLASS)),f===1&&d.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach($=>$.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),v.classList.add(a.TEMPORARY_CLASS);const C=v.closest(".em-element-custom-table");if(!C)return;let L=Nt(C);const w=Vo(L,a.CLASS_FOR_BASIC_CELL);if(!w)return;const{row:T,col:M}=w,{row:R,col:j,isOverlapped:Q}=er(L,a.CLASS_FOR_BASIC_CELL),{row:k,col:K,isOverlapped:P}=tr(L,a.CLASS_FOR_BASIC_CELL);!r&&!i&&f===1&&!(Q||P)&&(C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach($=>$.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),v.classList.add(a.CLASS_BACKGROUND_ACTIVE_CELL));const I=Vo(L,a.TEMPORARY_CLASS);if(!I)return;const{row:D,col:O}=I;if(C.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach($=>$.classList.remove(a.TEMPORARY_CLASS)),T!==D&&M!==O){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach($=>$.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),r=!1,i=!1;return}const{isDirectionUP:Z,isDirectionDOWN:ee,isDirectionLEFT:q,isDirectionRIGHT:B}=p();if(!r&&!i&&!v.classList.contains("remove-basic-cell")&&(a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1}),T===D?(r=!0,i=!1,M>O&&a.state.set("isDirectionLEFT",!0),M<O&&a.state.set("isDirectionRIGHT",!0)):M===O&&(i=!0,r=!1,T>D&&a.state.set("isDirectionUP",!0),T<D&&a.state.set("isDirectionDOWN",!0))),T===D&&(ee||Z)||M===O&&(B||q)||M===O&&T===D){a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1}),r=!1,i=!1;return}if(Q&&j!==null){const{isDirectionRIGHT:$,isDirectionLEFT:ie}=p();if($&&j-O<=0&&j>M){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}if(ie&&O-j<=0&&j<M){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}}if(P&&k!==null){const{isDirectionDOWN:$,isDirectionUP:ie}=p();if($&&k-D<=0&&k>T){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}if(ie&&D-k<=0&&k<T){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}}if(T===D&&r){i=!1;const{isDirectionRIGHT:$,isDirectionLEFT:ie}=p();if($){const G=O-M;if(a.state.set("actualTargetCount",oo(L,D,O,T,M,!0)),G<0){a.state.set("isDirectionRIGHT",!1),r=!1,i=!1;return}C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(re=>re.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),ir(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!0)}if(ie){const G=M-O;if(a.state.set("actualTargetCount",oo(L,T,M,D,O,!0)),G<0){a.state.set("isDirectionLEFT",!1),r=!1,i=!1;return}C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(re=>re.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),ir(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!1)}C.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach(G=>G.classList.remove(a.TEMPORARY_CLASS))}if(M===O&&i){r=!1;const{isDirectionDOWN:$,isDirectionUP:ie}=p();if($){const G=D-T;if(a.state.set("actualTargetCount",oo(L,D,O,T,M,!1)),G<0){a.state.set("isDirectionDOWN",!1),r=!1,i=!1;return}C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(re=>re.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),lr(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!0)}if(ie){const G=T-D;a.state.set("actualTargetCount",oo(L,T,M,D,O,!1)),G<0&&(a.state.set("isDirectionUP",!1),r=!1,i=!1),C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(re=>re.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),lr(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!1)}C.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach(G=>G.classList.remove(a.TEMPORARY_CLASS))}const ue=C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`);v.classList.contains("remove-basic-cell")&&ue?.length>1&&(ue?.forEach($=>{$.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)}),r=!1,i=!1)}}),Ls(g,d,u,o,n);const b=l.closest("td");b.classList.add(a.CLASS_FOR_BASIC_CELL);function h(y){const E=y.target;!u.contains(E)&&!g.contains(E)&&(g.remove(),b&&(document.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`)?.forEach(S=>{S.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)}),document.querySelectorAll(`.${a.TEMPORARY_ACTIVE_CELL_BACKGROUND_COLOR}`).forEach(S=>{S.classList.remove(a.TEMPORARY_ACTIVE_CELL_BACKGROUND_COLOR)}),b.classList.remove(a.CLASS_FOR_BASIC_CELL)),document.removeEventListener("click",h))}return document.addEventListener("click",h),!0}function Ls(e,o,t,n,r){const i=Cs;function l(y){const E=y.querySelector("ul"),S=y.getAttribute("data-open")==="true",v=n.target.closest("td")?.classList.contains(a.CLASS_FOR_BASIC_CELL),C=o.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`);v&&C?.length===0&&a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1});const{isDirectionUP:L,isDirectionDOWN:w,isDirectionLEFT:T,isDirectionRIGHT:M}={isDirectionUP:a.state.get("isDirectionUP"),isDirectionDOWN:a.state.get("isDirectionDOWN"),isDirectionLEFT:a.state.get("isDirectionLEFT"),isDirectionRIGHT:a.state.get("isDirectionRIGHT")};i(L,w,T,M),e.querySelectorAll("[data-open]").forEach(R=>{R!==y&&R.getAttribute("data-open")==="true"&&(R.setAttribute("data-open","false"),R.querySelector("ul").style.display="none")}),S||(y.setAttribute("data-open","true"),E.style.display="block")}function s(y){const E=y.querySelector("ul");y.getAttribute("data-open")==="true"&&(y.setAttribute("data-open","false"),E.style.display="none")}function c(y){y.stopPropagation(),y.preventDefault();const E=y.target,S=E.closest("li"),v=S?.getAttribute("data-id"),C=S?.closest("tr"),L=S?.closest("td");C?.classList.add(a.CLASS_FOR_BASIC_ROW),L?.classList.add(a.CLASS_FOR_BASIC_CELL);const w=E.closest("table");if(!S||!w)return;const T=Nt(w),M=w.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).length;switch(v){case"add-bottom-row":{const k=Xn(T,a.CLASS_FOR_BASIC_CELL,!1);w.innerHTML=Ce(k);break}case"add-top-row":{const k=Xn(T,a.CLASS_FOR_BASIC_CELL,!0);w.innerHTML=Ce(k);break}case"remove-row":{const k=za(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Ce(k);break}case"merge-top-cell":{const k=M===0?Qn(T,a.CLASS_FOR_BASIC_CELL,!0,M+1):nr(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Ce(k);break}case"merge-bottom-cell":{const k=M===0?Qn(T,a.CLASS_FOR_BASIC_CELL,!1,M+1):nr(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Ce(k);break}case"split-horizontal-cell":{const k=ja(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Ce(k);break}case"add-left-column":{const k=Zn(T,a.CLASS_FOR_BASIC_CELL,!0);w.innerHTML=Ce(k);break}case"add-right-column":{const k=Zn(T,a.CLASS_FOR_BASIC_CELL,!1);w.innerHTML=Ce(k);break}case"merge-right-cell":{const k=M===0?Jn(T,a.CLASS_FOR_BASIC_CELL,!1,M+1):or(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Ce(k);break}case"merge-left-cell":{const k=M===0?Jn(T,a.CLASS_FOR_BASIC_CELL,!0,M+1):or(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Ce(k);break}case"split-vertical-cell":{const k=Ua(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Ce(k);break}case"remove-column":{const k=Va(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Ce(k);break}}const R=S.closest("ul");R.parentElement.setAttribute("data-open","false"),R.style.display="none",e.querySelectorAll('[data-open="true"]').forEach(k=>{k.setAttribute("data-open","false"),k.querySelector("ul").style.display="none"});const j=document.querySelector(`.${a.CLASS_FOR_BASIC_CELL}`),Q=document.querySelector(".table-menu");j?.classList.remove(a.CLASS_FOR_BASIC_CELL),Q?.remove(),document.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(k=>{k.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)}),As(r,w),a.commit()}function d(y){l(y.currentTarget)}function u(y){s(y.currentTarget)}const g=a.addElement({targetElement:e,insertType:"append",style:"cursor: pointer; flex: 1; margin: auto; padding-top: 2px;",className:"em-element-editor-widget-edit",HTMLcontent:ar,title:"Колонки"});g.setAttribute("data-open","false");const m=a.addElement({targetElement:g,insertType:"append",tag:"ul",style:a.styleMenuElement}),f={targetElement:m,insertType:"append",tag:"li",className:"em-element-editor-widget-group",style:a.styleMenuElementList};a.addElement({...f,HTMLcontent:ar,title:"",style:"padding: 3px; cursor: pointer; font-size: 14px; background-color: #E2DEDD; border-radius: 5px; margin: 1px; margin-top: -4px","data-id":"menu-item"}),a.addElement({...f,HTMLcontent:ms,title:ve().INSERT_COLUMN_BEFORE_TABLE,"data-id":"add-left-column"}),a.addElement({...f,HTMLcontent:us,title:ve().INSERT_COLUMN_AFTER_TABLE,"data-id":"add-right-column"}),a.addElement({...f,HTMLcontent:bs,title:ve().MERGE_RIGHT_CELL_TABLE,"data-id":"merge-right-cell"}),a.addElement({...f,HTMLcontent:fs,title:ve().MERGE_LEFT_CELL_TABLE,"data-id":"merge-left-cell"}),a.addElement({...f,HTMLcontent:Ss,title:ve().SPLIT_CELL_TABLE,"data-id":"split-vertical-cell"}),a.addElement({...f,HTMLcontent:cr,title:ve().REMOVE_COLUMN_TABLE,"data-id":"remove-column"}),m.addEventListener("click",c),g.addEventListener("mouseenter",d),g.addEventListener("mouseleave",u);const p=a.addElement({targetElement:e,insertType:"append",style:"cursor: pointer; flex: 1; margin: auto; padding-top: 2px;",className:"em-element-editor-widget-clone",HTMLcontent:sr,title:"Строки"});p.setAttribute("data-open","false");const b=a.addElement({targetElement:p,insertType:"append",tag:"ul",style:a.styleMenuElement}),h={targetElement:b,insertType:"append",tag:"li",className:"em-element-editor-widget-group",style:a.styleMenuElementList};a.addElement({...h,HTMLcontent:sr,title:ve().EDIT_ATOM||"Edit",style:"padding: 3px; cursor: pointer; font-size: 14px; background-color: #E2DEDD; border-radius: 5px; margin: 1px; margin-top: -4px"}),a.addElement({...h,HTMLcontent:ps,title:ve().INSERT_ROW_BEFORE_TABLE,"data-id":"add-top-row"}),a.addElement({...h,HTMLcontent:gs,title:ve().INSERT_ROW_AFTER_TABLE,"data-id":"add-bottom-row"}),a.addElement({...h,HTMLcontent:hs,title:ve().MERGE_TOP_CELL_TABLE,"data-id":"merge-top-cell"}),a.addElement({...h,HTMLcontent:ys,title:ve().MERGE_BOTTOM_CELL_TABLE,"data-id":"merge-bottom-cell"}),a.addElement({...h,HTMLcontent:Es,title:ve().SPLIT_CELL_TABLE,"data-id":"split-horizontal-cell"}),a.addElement({...h,HTMLcontent:cr,title:ve().REMOVE_ROW_TABLE,"data-id":"remove-row"}),b.addEventListener("click",c),p.addEventListener("mouseenter",d),p.addEventListener("mouseleave",u)}function ws(e,o,t){const n=e.closest("div"),r=e.closest("em-replace");if(!r||!n||!t.isClickAtEndOfEmReplace(o,r))return!1;const i=`em-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r.setAttribute("data-em-id",i);const l=t.getOrCreateAfterSpan(r),s=`temp-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;l.setAttribute("data-cursor-target",s),n.innerHTML=n.innerHTML;const c=n.querySelector(`[data-em-id="${i}"]`);if(c){c.removeAttribute("data-em-id");let d=c.nextElementSibling;(!d||!d.hasAttribute("data-cursor-target"))&&(d=n.querySelector(`[data-cursor-target="${s}"]`)),d&&(d.removeAttribute("data-cursor-target"),d.removeAttribute("style"),n.getAttribute("contenteditable")==="true"&&n.focus(),setTimeout(()=>{t.setCursorInsideSpan(d),t._wrapEditor(d,!0),t.commit()},10))}return t.commit(),!0}function ks(e,o){document.querySelectorAll("[em-optimise-error]").forEach(t=>{t.removeAttribute("em-optimise-error")}),document.querySelectorAll("img").forEach((t,n)=>{t.setAttribute("em-optimise",`image_${n}`)}),o.commit()}function _s(e,o){document.querySelectorAll("[em-optimise-error]").forEach(t=>{t.removeAttribute("em-optimise-error")}),document.querySelectorAll("a[href]").forEach((t,n)=>{t.setAttribute("em-optimise",`link_${n}`)}),o.commit()}function Ns(e,o){const t=e.data.settings?.elementId;if(!t)return;const n=document.querySelector(`[em-optimise="${t}"]`);n&&(e.data.settings?.isError&&(n.setAttribute("em-optimise-error","true"),o.commit()),o.messageService.send({operation:"application_scroll-to",settings:{value:n.getBoundingClientRect().top+o.iframeOffsetTop-o.previewHeight/2}}),o.setCursorPosition(n),o.applicationElementSettingsSet({elem:n}))}function Bs(e,o){const t=e.data.settings?.elementId;if(!t)return;const n=document.querySelector(`[em-optimise="${t}"]`);n&&(o.messageService.send({operation:"application_scroll-to",settings:{value:n.getBoundingClientRect().top+o.iframeOffsetTop-o.previewHeight/2}}),o.setCursorPosition(n),o.applicationElementSettingsSet({elem:n}),e.data.settings?.isError&&n.setAttribute("em-optimise-error","true"),o.commit())}var Ms={sandbox_set_attr_to_images:ks,sandbox_set_attr_to_links:_s,sandbox_set_position_to_img:Ns,sandbox_set_position_to_link:Bs},Rs=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28"><rect width="28" height="28" rx="3" fill="#e5e7eb"/><circle cx="18.5" cy="9.5" r="2.5" fill="#9ca3af"/><path d="M5 21l6-7 4 4.5 3-3 5 5.5z" fill="#9ca3af"/></svg>')}`;function no(e){e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.remove():e.elem.previousSibling&&no({elem:e.elem.previousSibling})}function ro(e){if(!e.elem)return!1;if(e.elem.parentElement?.tagName==="SECTION"||e.elem.classList.contains("em-narrow-table")&&Array.from(e.elem.childNodes).every(t=>t.nodeType===Node.TEXT_NODE))return e.elem.innerHTML="",!1;e.elem.querySelector(".em-element-editor")&&e.elem.querySelector(".em-element-editor")?.remove(),e.elem.querySelector(".em-element-path")&&e.elem.querySelectorAll(".em-element-path").forEach(t=>t.remove()),e.elem.querySelector(".em-element-block-add")&&e.elem.querySelectorAll(".em-element-block-add").forEach(t=>t.remove()),e.elem.querySelector(".em-vindent-paddingTop, .em-vindent-paddingRight, .em-vindent-paddingBottom, .em-vindent-paddingLeft")&&e.elem.querySelectorAll(".em-vindent-paddingTop, .em-vindent-paddingRight, .em-vindent-paddingBottom, .em-vindent-paddingLeft").forEach(t=>t.remove());const o=e.elem.parentElement;if(e.elem.classList.contains("em-mob-wrap")||e.elem.classList.contains("noresp-em-mob-wrap"))e.elem.innerHTML.trim()===""&&(e.elem.parentElement?.querySelectorAll(":scope > .em-mob-wrap, :scope > .noresp-em-mob-wrap").length>1?e.elem.innerHTML="":(e.elem.remove(),ro({elem:o})));else if(e.elem.innerHTML.trim()==="")no({elem:e.elem}),e.elem.remove(),ro({elem:o});else if(o&&!o.querySelector('div[style*="display"]')){for(const t of e.elem.childNodes)t.nodeName==="#text"&&t.textContent?.trim()===""?(no({elem:t}),t.textContent=""):t.nodeName==="#comment"&&t.textContent?.indexOf("mso")!==-1&&(no({elem:t}),t.remove());e.elem.innerHTML.trim()===""&&ro({elem:e.elem})}return!0}function Ps(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=e.getElementParent(o);let n=o.parentNode;const r=o.closest("editor");if(e.setCursorPosition(t),o.classList.contains("em-code")){const i=e.getVariableByIcon?.(o);i&&(i.parentNode?.removeChild(i),o.remove())}else if(o.tagName==="TD"&&o.innerHTML===""&&o.hasAttribute("height")){const i=o.closest("table");if(i){const l=i.previousSibling;l&&l?.textContent?.trim()===""&&l.remove(),i.remove()}}else if(o.closest(".em-element-resize-img-container"))n=o.closest(".em-element-resize-img-container").parentNode,o.closest("td")?.querySelector("editor")?.innerHTML===""&&o.closest("td")?.querySelector("editor")?.remove(),o.closest(".em-element-resize-img-container")?.remove();else if(o.closest('[em="atom"]')){const i=o.closest(".em-mob-wrap, .noresp-em-mob-wrap"),l=o.closest('[em="atom"]');o.tagName==="TD"&&o.previousElementSibling===null&&o.nextElementSibling===null?(n=l.parentNode,l?.remove()):(n=o.closest("td"),o.remove());const s=!!i&&Array.from(i.querySelectorAll('[em="atom"]')).some(c=>c!==l);o.tagName!=="TD"&&i&&!s&&i.textContent?.trim()===""&&(i.textContent="")}else{o.remove();const i=o.previousSibling;i&&i?.textContent?.trim()===""&&i.remove(),o.remove()}r&&r.remove(),ro({elem:n}),e.commit(),e.messageService.send({operation:"application_element_settings_close"})}function Is(e,o){const t=document.querySelector("[em-edit]");if(t)if(e.action==="add_p"){let n=null;if(["DIV","P","TD","EDITOR","B","STRONG","SPAN","I","EM","A"].includes(t.tagName)){if(t.closest("div")?.style.fontFamily?n=t.closest("div"):t.closest("p")?.style.fontFamily?n=t.closest("p"):n=t,n&&o.HTMLDocument){const r=o.HTMLDocument.getOuterHtml(n);n.closest("table")?.getAttribute("em")==="atom"?n.closest("table")?.insertAdjacentHTML("afterend",`<table cellpadding="0" cellspacing="0" border="0" width="100%" em="atom"><tr><td style="padding-bottom: 10px;">${r}</td></tr></table>`):n.insertAdjacentHTML("afterend",`<table cellpadding="0" cellspacing="0" border="0" width="100%" em="atom"><tr><td style="padding-bottom: 10px;">${r}</td></tr></table>`)}o.commit()}o.setCursorPosition(t)}else if(e.action==="add_img"){if(window.getSelection){const n=document.createElement("img");n.setAttribute("src",Rs),n.setAttribute("width","28"),n.setAttribute("border","0"),n.setAttribute("alt",""),n.style.display="inline-block",n.style.verticalAlign="text-bottom";const r=window.getSelection();if(r?.getRangeAt&&r.rangeCount){const i=r.getRangeAt(0);i.deleteContents(),i.insertNode(n)}else document.querySelector("[em-edit]")?.prepend(n);o.commit()}}else(e.action==="typograf"||e.action==="typograf_all")&&Hs(e,o).catch(n=>{})}async function Hs(e,o){const{default:t}=await a.__vitePreload(async()=>{const{default:c}=await Promise.resolve().then(()=>To("./typograf.all.BbXdyfMT.js")).then(d=>d.typograf_all_exports);return{default:c}},void 0,{}.url);let n=document.querySelector("[em-edit]")?.closest("div")||document.querySelector("[em-edit]")?.closest("editor")||null;const r=e.action==="typograf"?n?.innerText:document.body.innerText,i=o.hasRussianText?.(r||"")??!1,l=new t({locale:[e.locale==="ru_RU"||i?"ru":"en-US"],htmlEntity:{type:"name",onlyInvisible:!0,list:["nbsp","shy","mdash","ndash","laquo","raquo"]}});l.disableRule("ru/punctuation/*"),l.disableRule("common/punctuation/*"),l.enableRule("common/punctuation/quote"),l.setSetting("common/punctuation/quote","ru",{left:"«",right:"»",removeDuplicateQuotes:!0}),l.setSetting("common/punctuation/quote","en-US",{left:'"',right:'"',removeDuplicateQuotes:!0}),l.disableRule("ru/dash/kakto"),l.disableRule("ru/dash/taki"),l.disableRule("ru/dash/izpod"),l.disableRule("ru/dash/izza"),l.disableRule("ru/dash/ka"),l.disableRule("ru/dash/to"),l.disableRule("ru/dash/koe"),l.disableRule("common/nbsp/nowrap"),l.disableRule("common/nbsp/dpi"),l.disableRule("common/nbsp/afterParagraphMark"),l.enableRule("common/nbsp/afterNumber"),l.disableRule("common/html/quot"),l.disableRule("ru/date/*"),l.disableRule("common/number/mathSigns"),l.disableRule("ru/number/ordinals"),l.disableRule("ru/number/comma"),l.disableRule("ru/symbols/NN"),l.disableRule("common/symbols/cf"),l.disableRule("ru/other/phone-number"),l.addSafeTag('<[^>]+class="preheader"[^>]*>',"</[^>]+>"),l.addSafeTag("<!--","-->");function s(c){let d=l.execute(c);return d=d.replace(/\b(\d{1,3}(?:[ \u00A0]\d{3})*(?:[.,]\d+)?)\b/g,function(u){return u.replace(/[ \u00A0]/g,"").replace(/\B(?=(\d{3})+(?!\d))/g," ")}),d=d.replace(/(\d[\d ]*[.,]?\d+)(?:\s| )?(?=(?:руб(?:\.|лей)?|р\.|долл(?:\.|аров)?|\$|₽|€|£|¥|USD|EUR|RUB))/gi,"$1 "),d=d.replace(/(\d[\d ]*[.,]?\d+) (руб(?:\.|лей)?|р\.|долл(?:\.|аров)?|\$|₽|€|£|¥|USD|EUR|RUB)/gi,"$1 $2"),d}if(e.action==="typograf_all"){const c=document.body;c&&(c.innerHTML=s(c.innerHTML))}else n?.parentElement&&(n=n.parentElement,n?.parentElement&&(n.parentElement.innerHTML=s(n.parentElement.innerHTML)));document.querySelectorAll(".em-element-resize-img-container").forEach(c=>c.replaceWith(...c.childNodes)),document.querySelectorAll(".em-element-img-change-group").forEach(c=>c.remove()),document.querySelectorAll("editor").forEach(c=>c.replaceWith(...c.childNodes)),o.commit()}function dr(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function Uo(e){if(!e||e.tagName!=="A")return!1;const o=e.getAttribute("style");if(!o||!o.includes("display"))return!1;const t=e.style.display;return!(t!=="block"&&t!=="inline-block"||o.includes("mso-style-priority"))}function Os(e,o){const t=e.closest("a");if(Uo(t))return t;if(!o)return null;const n=dr(o.anchorNode)?.closest("a")??null;if(Uo(n))return n;const r=dr(o.focusNode)?.closest("a")??null;return Uo(r)?r:null}function mr(e){return e.tagName==="IMG"?e.closest('div[em="atom"]')||e.closest(".em-element-resize-img-container")||e:e.closest("editor")?e.closest('[style*="font-family"][style*="font-size"]')||e:e.tagName==="TD"&&e.classList.contains("em-vindent")?e.closest(".em-vindent-table")||e:e.tagName==="TD"&&e.parentElement?.getAttribute("em")==="block"?e.parentElement:e}function ur(e){return e?e.classList.contains("em-vindent-table")?e.querySelector("td"):e.classList.contains("em-element-resize-img-container")?e.querySelector("img"):e.tagName==="TR"&&e.getAttribute("em")==="block"?e.firstElementChild:e:null}function xs(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=window.getSelection();if(Os(o,t)&&t&&!t.isCollapsed)try{t.collapseToEnd()}catch{}const n=e.getElementParent(o);n instanceof Element&&(e.setCursorPosition(n),e.applicationElementSettingsSet({elem:n}))}function Ds(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=ur(mr(o).previousElementSibling);t&&(e.setCursorPosition(t),e.applicationElementSettingsSet({elem:t}))}function Fs(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=ur(mr(o).nextElementSibling);t&&(e.setCursorPosition(t),e.applicationElementSettingsSet({elem:t}))}function qs(e,o){o.removeAllAttributes("em-edit");const t=document.querySelector(".em-editor-wrapper");t&&(t.style.display="none"),document.querySelectorAll("editor").forEach(n=>{n.blur()})}function Ws(e,o){const t=o.elementPath[e.data.index??0];if(t?.elem){const n=t.elem;o.applicationElementSettingsSet({elem:n}),o.setCursorPosition(n)}}function $s(e,o){o.removeAllAttributes("em-state");const t=o.elementPath[e.data.index??0];t?.elem&&t.elem.setAttribute("em-state","active")}function zs(e,o){if(!o.getElementParent)return;const t={setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,applicationElementSettingsSet:o.applicationElementSettingsSet};xs(t)}function Vs(e,o){if(!o.getElementParent)return;const t={setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,applicationElementSettingsSet:o.applicationElementSettingsSet};Ds(t)}function Us(e,o){if(!o.getElementParent)return;const t={setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,applicationElementSettingsSet:o.applicationElementSettingsSet};Fs(t)}function js(e,o){if(!o.getElementParent||!o.state)return;const t={state:o.state,commit:o.commit,setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,messageService:o.messageService,getVariableByIcon:o.getVariableByIcon};Ps(t)}function Gs(e,o){if(!o.getElementParent||!o.state)return;const t={action:e.data.action,locale:e.data.locale},n={state:o.state,commit:o.commit,setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,messageService:o.messageService,HTMLDocument:o.HTMLDocument,hasRussianText:o.hasRussianText};Is(t,n)}var Ys={sandbox_element_active_reset:qs,sandbox_element_active_set:Ws,sandbox_element_hover_set:$s,sandbox_element_parent_get:zs,sandbox_element_prev_get:Vs,sandbox_element_next_get:Us,sandbox_element_remove:js,sandbox_element_text:Gs};function Ks(e,o){a.state.set("lockEdit",!!e.data.data),a.applyEditLock(a.editLocked())}function Xs(e,o){o.setEditorFocus(e.data.data)}var Zs={sandbox_lock_edit:Ks,editor_change_focus:Xs};function Js(e,o){document.querySelectorAll("[em-optimise-error]").forEach(t=>{t.removeAttribute("em-optimise-error")}),document.querySelectorAll("img").forEach((t,n)=>{t.setAttribute("em-optimise",`image_${n}`)}),o.commit()}function Qs(e,o){document.querySelectorAll("[em-optimise-error]").forEach(t=>{t.removeAttribute("em-optimise-error")}),document.querySelectorAll("a[href]").forEach((t,n)=>{t.setAttribute("em-optimise",`link_${n}`)}),o.commit()}function ec(e,o){const t=document.querySelector(`[em-optimise="${e.data.settings.elementId}"]`);t&&(e.data.settings.isError&&(t.setAttribute("em-optimise-error","true"),o.commit()),o.messageService.send({operation:"application_scroll-to",settings:{value:t.getBoundingClientRect().top+o.iframeOffsetTop-o.previewHeight/2}}),o.setCursorPosition(t),o.applicationElementSettingsSet({elem:t}))}function tc(e,o){const t=document.querySelector(`[em-optimise="${e.data.settings.elementId}"]`);t&&(o.messageService.send({operation:"application_scroll-to",settings:{value:t.getBoundingClientRect().top+o.iframeOffsetTop-o.previewHeight/2}}),o.setCursorPosition(t),o.applicationElementSettingsSet({elem:t}),e.data.settings.isError&&t.setAttribute("em-optimise-error","true"),o.commit())}var oc={sandbox_set_attr_to_images:Js,sandbox_set_attr_to_links:Qs,sandbox_set_position_to_img:ec,sandbox_set_position_to_link:tc};function nc(e){const o="1c4e77a0";let t=document.getElementsByTagName("head")[0];!t&&document.documentElement&&(t=document.createElement("head"),document.documentElement.insertBefore(t,document.documentElement.firstChild));const n=`css/sandbox-${e}.css?${o}`,r=`css/sandbox-${e==="light"?"dark":"light"}.css?${o}`,i=document.querySelectorAll(`[href="${r}"]`);if(!document.querySelector(`[href="${n}"]`)){const l=document.createElement("link");l.setAttribute("rel","stylesheet"),l.setAttribute("type","text/css"),l.setAttribute("em","css"),l.setAttribute("href",n),t?.appendChild(l)}for(const l of i)l.remove()}function rc(e,o){o.initPreview(!0)}function ic(e,o){const t=e.data;t.theme&&(a.state.set("applicationTheme",t.theme),nc(t.theme),a.commit(!1)),t.commonStyles&&o.setCommonStyles(t.commonStyles),typeof t.copyPasteEnabled<"u"&&a.state.set("copyPasteEnabled",t.copyPasteEnabled),typeof t.saveBlockEnabled<"u"&&a.state.set("saveBlockEnabled",t.saveBlockEnabled),typeof t.editImageControlEnabled<"u"&&a.state.set("editImageControlEnabled",t.editImageControlEnabled),typeof t.elementAIimageEnabled<"u"&&a.state.set("elementAIimageEnabled",t.elementAIimageEnabled),typeof t.imageCenterStockEnabled<"u"&&a.state.set("imageCenterStockEnabled",t.imageCenterStockEnabled),typeof t.imageCenterGifEnabled<"u"&&a.state.set("imageCenterGifEnabled",t.imageCenterGifEnabled),typeof t.imageCenterEditorEnabled<"u"&&a.state.set("imageCenterEditorEnabled",t.imageCenterEditorEnabled),typeof t.blocksAddPanelEnabled<"u"&&a.state.set("blocksAddPanelEnabled",t.blocksAddPanelEnabled),typeof t.lockEditor<"u"&&a.state.set("lockEditor",t.lockEditor),typeof t.codeMode<"u"&&a.state.set("codeMode",t.codeMode),typeof t.appName<"u"&&a.state.set("appName",t.appName),typeof t.previewPage<"u"&&(a.state.set("previewPage",t.previewPage),document.body?.classList.toggle("em-sandbox-preview",t.previewPage))}function lc(e){const o=e.data?.data?.theme;(o==="light"||o==="dark")&&a.darkMode.set(o)}var ac={init_preview:rc,update_preview:ic,sandbox_switch_theme:lc},Re=".em-mob-wrap, .noresp-em-mob-wrap",me=".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)",le='div[style*="inline-block"]';function ot(e){e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.textContent=e.elem.textContent.replaceAll(/width=".*?"/gi,'width="'+e.width+'"'):e.elem.previousSibling&&ot({elem:e.elem.previousSibling,width:e.width})}function fr(e){const o=e.removedBlockIndex===0?"nextSibling":"previousSibling";e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.remove():e.elem[o]&&fr({elem:e.elem[o],removedBlockIndex:e.removedBlockIndex})}function io(e){return!!e.querySelector(Re)||!!e.closest(Re)}function Bt(e){return e.querySelector(Re)?document.querySelector('[em-edit="active"]'):e.closest(Re).parentElement}function lo(e){return e.querySelector(le)?document.querySelector('[em-edit="active"]'):e.closest(le).parentElement}function sc(e,o){const t=document.querySelector("[em-edit]");if(t)try{if(o.state.increment("activeElementLocked"),io(t)){const n=Bt(t),r=e.minWidth,i=n.querySelectorAll(me).length,l=i>1?parseFloat(String(e.gap)):20,s=i>1?parseFloat(String(e.gapMobile||e.gap)):20;let c="";n.querySelector(".em-mob-wrap")?c=`<td width="${l}" class="em-mob-wrap em-mob-height-${s}px"></td>
|
|
148
|
+
`;function Cs(e,o,t,n){const r=document.querySelector(".table-menu"),i=r?.closest("table");if(!i)return;const l=i?.querySelector(`.${a.CLASS_FOR_BASIC_CELL}`),s=Nt(i),{row:c}=Vo(s,a.CLASS_FOR_BASIC_CELL),{row:d,isOverlapped:u}=er(s,a.CLASS_FOR_BASIC_CELL),{isOverlapped:g}=tr(s,a.CLASS_FOR_BASIC_CELL);if(!i||!l)return;const m={addBottomRow:r.querySelector('[data-id="add-bottom-row"]'),addTopRow:r.querySelector('[data-id="add-top-row"]'),removeRow:r.querySelector('[data-id="remove-row"]'),mergeTopCell:r.querySelector('[data-id="merge-top-cell"]'),mergeBottomCell:r.querySelector('[data-id="merge-bottom-cell"]'),splitHorizontalCell:r.querySelector('[data-id="split-horizontal-cell"]'),addLeftColumn:r.querySelector('[data-id="add-left-column"]'),addRightColumn:r.querySelector('[data-id="add-right-column"]'),mergeRightCell:r.querySelector('[data-id="merge-right-cell"]'),mergeLeftCell:r.querySelector('[data-id="merge-left-cell"]'),splitVerticalCell:r.querySelector('[data-id="split-vertical-cell"]'),removeColumn:r.querySelector('[data-id="remove-column"]')};m.addBottomRow&&(m.addBottomRow.style.display="block"),m.addTopRow&&(m.addTopRow.style.display="block"),m.removeRow&&(m.removeRow.style.display="block"),m.mergeTopCell&&(m.mergeTopCell.style.display="block"),m.mergeBottomCell&&(m.mergeBottomCell.style.display="block"),m.splitHorizontalCell&&(m.splitHorizontalCell.style.display="none"),m.addLeftColumn&&(m.addLeftColumn.style.display="block"),m.addRightColumn&&(m.addRightColumn.style.display="block"),m.mergeRightCell&&(m.mergeRightCell.style.display="block"),m.mergeLeftCell&&(m.mergeLeftCell.style.display="block"),m.splitVerticalCell&&(m.splitVerticalCell.style.display="none"),m.removeColumn&&(m.removeColumn.style.display="block"),l.getAttribute("rowspan")&&m.splitHorizontalCell&&(m.splitHorizontalCell.style.display="block"),l.getAttribute("colspan")&&m.splitVerticalCell&&(m.splitVerticalCell.style.display="block"),e&&(m.mergeBottomCell&&(m.mergeBottomCell.style.display="none"),m.mergeRightCell&&(m.mergeRightCell.style.display="none"),m.mergeLeftCell&&(m.mergeLeftCell.style.display="none"),m.addTopRow&&(m.addTopRow.style.display="none"),m.addBottomRow&&(m.addBottomRow.style.display="none"),m.removeRow&&(m.removeRow.style.display="none")),o&&(m.mergeTopCell&&(m.mergeTopCell.style.display="none"),m.mergeRightCell&&(m.mergeRightCell.style.display="none"),m.mergeLeftCell&&(m.mergeLeftCell.style.display="none"),m.addTopRow&&(m.addTopRow.style.display="none"),m.addBottomRow&&(m.addBottomRow.style.display="none"),m.removeRow&&(m.removeRow.style.display="none")),t&&(m.mergeTopCell&&(m.mergeTopCell.style.display="none"),m.mergeBottomCell&&(m.mergeBottomCell.style.display="none"),m.mergeRightCell&&(m.mergeRightCell.style.display="none"),m.addLeftColumn&&(m.addLeftColumn.style.display="none"),m.addRightColumn&&(m.addRightColumn.style.display="none"),m.removeColumn&&(m.removeColumn.style.display="none")),n&&(m.mergeTopCell&&(m.mergeTopCell.style.display="none"),m.mergeBottomCell&&(m.mergeBottomCell.style.display="none"),m.mergeLeftCell&&(m.mergeLeftCell.style.display="none"),m.addLeftColumn&&(m.addLeftColumn.style.display="none"),m.addRightColumn&&(m.addRightColumn.style.display="none"),m.removeColumn&&(m.removeColumn.style.display="none")),g&&m.removeColumn&&(m.removeColumn.style.display="none"),u&&d===c&&m.removeRow&&(m.removeRow.style.display="none"),l.getAttribute("colspan")&&(m.mergeTopCell&&(m.mergeTopCell.style.display="none"),m.mergeBottomCell&&(m.mergeBottomCell.style.display="none")),l.getAttribute("rowspan")&&(m.mergeLeftCell&&(m.mergeLeftCell.style.display="none"),m.mergeRightCell&&(m.mergeRightCell.style.display="none"))}var vs={INSERT_COLUMN_BEFORE_TABLE:"Insert column before",INSERT_COLUMN_AFTER_TABLE:"Insert column after",MERGE_RIGHT_CELL_TABLE:"Merge right",MERGE_LEFT_CELL_TABLE:"Merge left",SPLIT_CELL_TABLE:"Split cell",REMOVE_COLUMN_TABLE:"Remove column",INSERT_ROW_BEFORE_TABLE:"Insert row before",INSERT_ROW_AFTER_TABLE:"Insert row after",MERGE_TOP_CELL_TABLE:"Merge top",MERGE_BOTTOM_CELL_TABLE:"Merge bottom",REMOVE_ROW_TABLE:"Remove row",EDIT_ATOM:"Edit"},ve=()=>window.Locale||vs;function As(e,o){e.forEach(t=>{o.querySelectorAll(`.${t}`).forEach(n=>n.classList.remove(t))})}function Ts(e,o){const t=e?.tagName==="TD"?e?.querySelector("div"):e?.closest("div")?e?.closest("div"):e;if(!e.closest(".em-element-custom-table")||t?.tagName!=="DIV")return!1;document.querySelectorAll(`.${a.TEMPORARY_ACTIVE_CELL_BACKGROUND_COLOR}`).forEach(y=>{y.classList.remove(a.TEMPORARY_ACTIVE_CELL_BACKGROUND_COLOR)});const n=[a.CLASS_FOR_BASIC_ROW,a.CLASS_FOR_BASIC_CELL];let r=!1,i=!1;const l=t,s=document.querySelector(`.${a.CLASS_FOR_BASIC_CELL}`),c=document.querySelector(".table-menu");s&&s.classList.remove(a.CLASS_FOR_BASIC_CELL),c&&c.remove();const d=l.closest(".em-element-custom-table"),u=d.closest('[em="block"]'),g=a.addElement({targetElement:d,insertType:"append",className:"of-atom table-menu",style:"width: 48px; height: 28px; display: flex; position: absolute; right: 0; top: -30px; background: #FFDCC7; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); pointer-events: auto; z-index: 1001;"});let m=!1,f=1;const p=()=>({isDirectionUP:a.state.get("isDirectionUP"),isDirectionDOWN:a.state.get("isDirectionDOWN"),isDirectionLEFT:a.state.get("isDirectionLEFT"),isDirectionRIGHT:a.state.get("isDirectionRIGHT"),actualTargetCount:a.state.get("actualTargetCount")});d.addEventListener("mousedown",y=>{const E=y.target.tagName.toUpperCase();if(y.button===0&&E!=="UL"&&E!=="LI"&&E!=="SVG"&&E!=="PATH"&&E!=="CIRCLE"){m=!0;const S=d.querySelector(`.${a.CLASS_FOR_BASIC_CELL}`);document.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`)?.forEach(v=>{v.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL),S?.classList.remove(a.CLASS_FOR_BASIC_CELL)})}}),d.addEventListener("mouseup",y=>{m=!1,y.target.closest("td")?.classList.contains("remove-basic-cell")&&a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1})}),d.addEventListener("mouseover",y=>{const E=d.querySelector(`.${a.CLASS_FOR_BASIC_CELL}`);f=d.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).length,f=f===0?1:f;const S=y.target;if(m&&S.closest("TD")&&E){const v=S.closest("TD");d.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach($=>$.classList.remove(a.TEMPORARY_CLASS)),f===1&&d.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach($=>$.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),v.classList.add(a.TEMPORARY_CLASS);const C=v.closest(".em-element-custom-table");if(!C)return;let L=Nt(C);const w=Vo(L,a.CLASS_FOR_BASIC_CELL);if(!w)return;const{row:T,col:M}=w,{row:R,col:j,isOverlapped:Q}=er(L,a.CLASS_FOR_BASIC_CELL),{row:k,col:K,isOverlapped:P}=tr(L,a.CLASS_FOR_BASIC_CELL);!r&&!i&&f===1&&!(Q||P)&&(C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach($=>$.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),v.classList.add(a.CLASS_BACKGROUND_ACTIVE_CELL));const I=Vo(L,a.TEMPORARY_CLASS);if(!I)return;const{row:D,col:O}=I;if(C.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach($=>$.classList.remove(a.TEMPORARY_CLASS)),T!==D&&M!==O){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach($=>$.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),r=!1,i=!1;return}const{isDirectionUP:Z,isDirectionDOWN:ee,isDirectionLEFT:q,isDirectionRIGHT:B}=p();if(!r&&!i&&!v.classList.contains("remove-basic-cell")&&(a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1}),T===D?(r=!0,i=!1,M>O&&a.state.set("isDirectionLEFT",!0),M<O&&a.state.set("isDirectionRIGHT",!0)):M===O&&(i=!0,r=!1,T>D&&a.state.set("isDirectionUP",!0),T<D&&a.state.set("isDirectionDOWN",!0))),T===D&&(ee||Z)||M===O&&(B||q)||M===O&&T===D){a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1}),r=!1,i=!1;return}if(Q&&j!==null){const{isDirectionRIGHT:$,isDirectionLEFT:ie}=p();if($&&j-O<=0&&j>M){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}if(ie&&O-j<=0&&j<M){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}}if(P&&k!==null){const{isDirectionDOWN:$,isDirectionUP:ie}=p();if($&&k-D<=0&&k>T){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}if(ie&&D-k<=0&&k<T){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}}if(T===D&&r){i=!1;const{isDirectionRIGHT:$,isDirectionLEFT:ie}=p();if($){const G=O-M;if(a.state.set("actualTargetCount",oo(L,D,O,T,M,!0)),G<0){a.state.set("isDirectionRIGHT",!1),r=!1,i=!1;return}C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(re=>re.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),ir(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!0)}if(ie){const G=M-O;if(a.state.set("actualTargetCount",oo(L,T,M,D,O,!0)),G<0){a.state.set("isDirectionLEFT",!1),r=!1,i=!1;return}C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(re=>re.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),ir(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!1)}C.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach(G=>G.classList.remove(a.TEMPORARY_CLASS))}if(M===O&&i){r=!1;const{isDirectionDOWN:$,isDirectionUP:ie}=p();if($){const G=D-T;if(a.state.set("actualTargetCount",oo(L,D,O,T,M,!1)),G<0){a.state.set("isDirectionDOWN",!1),r=!1,i=!1;return}C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(re=>re.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),lr(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!0)}if(ie){const G=T-D;a.state.set("actualTargetCount",oo(L,T,M,D,O,!1)),G<0&&(a.state.set("isDirectionUP",!1),r=!1,i=!1),C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(re=>re.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),lr(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!1)}C.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach(G=>G.classList.remove(a.TEMPORARY_CLASS))}const ue=C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`);v.classList.contains("remove-basic-cell")&&ue?.length>1&&(ue?.forEach($=>{$.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)}),r=!1,i=!1)}}),Ls(g,d,u,o,n);const b=l.closest("td");b.classList.add(a.CLASS_FOR_BASIC_CELL);function h(y){const E=y.target;!u.contains(E)&&!g.contains(E)&&(g.remove(),b&&(document.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`)?.forEach(S=>{S.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)}),document.querySelectorAll(`.${a.TEMPORARY_ACTIVE_CELL_BACKGROUND_COLOR}`).forEach(S=>{S.classList.remove(a.TEMPORARY_ACTIVE_CELL_BACKGROUND_COLOR)}),b.classList.remove(a.CLASS_FOR_BASIC_CELL)),document.removeEventListener("click",h))}return document.addEventListener("click",h),!0}function Ls(e,o,t,n,r){const i=Cs;function l(y){const E=y.querySelector("ul"),S=y.getAttribute("data-open")==="true",v=n.target.closest("td")?.classList.contains(a.CLASS_FOR_BASIC_CELL),C=o.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`);v&&C?.length===0&&a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1});const{isDirectionUP:L,isDirectionDOWN:w,isDirectionLEFT:T,isDirectionRIGHT:M}={isDirectionUP:a.state.get("isDirectionUP"),isDirectionDOWN:a.state.get("isDirectionDOWN"),isDirectionLEFT:a.state.get("isDirectionLEFT"),isDirectionRIGHT:a.state.get("isDirectionRIGHT")};i(L,w,T,M),e.querySelectorAll("[data-open]").forEach(R=>{R!==y&&R.getAttribute("data-open")==="true"&&(R.setAttribute("data-open","false"),R.querySelector("ul").style.display="none")}),S||(y.setAttribute("data-open","true"),E.style.display="block")}function s(y){const E=y.querySelector("ul");y.getAttribute("data-open")==="true"&&(y.setAttribute("data-open","false"),E.style.display="none")}function c(y){y.stopPropagation(),y.preventDefault();const E=y.target,S=E.closest("li"),v=S?.getAttribute("data-id"),C=S?.closest("tr"),L=S?.closest("td");C?.classList.add(a.CLASS_FOR_BASIC_ROW),L?.classList.add(a.CLASS_FOR_BASIC_CELL);const w=E.closest("table");if(!S||!w)return;const T=Nt(w),M=w.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).length;switch(v){case"add-bottom-row":{const k=Xn(T,a.CLASS_FOR_BASIC_CELL,!1);w.innerHTML=Ce(k);break}case"add-top-row":{const k=Xn(T,a.CLASS_FOR_BASIC_CELL,!0);w.innerHTML=Ce(k);break}case"remove-row":{const k=za(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Ce(k);break}case"merge-top-cell":{const k=M===0?Qn(T,a.CLASS_FOR_BASIC_CELL,!0,M+1):nr(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Ce(k);break}case"merge-bottom-cell":{const k=M===0?Qn(T,a.CLASS_FOR_BASIC_CELL,!1,M+1):nr(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Ce(k);break}case"split-horizontal-cell":{const k=ja(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Ce(k);break}case"add-left-column":{const k=Zn(T,a.CLASS_FOR_BASIC_CELL,!0);w.innerHTML=Ce(k);break}case"add-right-column":{const k=Zn(T,a.CLASS_FOR_BASIC_CELL,!1);w.innerHTML=Ce(k);break}case"merge-right-cell":{const k=M===0?Jn(T,a.CLASS_FOR_BASIC_CELL,!1,M+1):or(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Ce(k);break}case"merge-left-cell":{const k=M===0?Jn(T,a.CLASS_FOR_BASIC_CELL,!0,M+1):or(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Ce(k);break}case"split-vertical-cell":{const k=Ua(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Ce(k);break}case"remove-column":{const k=Va(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Ce(k);break}}const R=S.closest("ul");R.parentElement.setAttribute("data-open","false"),R.style.display="none",e.querySelectorAll('[data-open="true"]').forEach(k=>{k.setAttribute("data-open","false"),k.querySelector("ul").style.display="none"});const j=document.querySelector(`.${a.CLASS_FOR_BASIC_CELL}`),Q=document.querySelector(".table-menu");j?.classList.remove(a.CLASS_FOR_BASIC_CELL),Q?.remove(),document.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(k=>{k.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)}),As(r,w),a.commit()}function d(y){l(y.currentTarget)}function u(y){s(y.currentTarget)}const g=a.addElement({targetElement:e,insertType:"append",style:"cursor: pointer; flex: 1; margin: auto; padding-top: 2px;",className:"em-element-editor-widget-edit",HTMLcontent:ar,title:"Колонки"});g.setAttribute("data-open","false");const m=a.addElement({targetElement:g,insertType:"append",tag:"ul",style:a.styleMenuElement}),f={targetElement:m,insertType:"append",tag:"li",className:"em-element-editor-widget-group",style:a.styleMenuElementList};a.addElement({...f,HTMLcontent:ar,title:"",style:"padding: 3px; cursor: pointer; font-size: 14px; background-color: #E2DEDD; border-radius: 5px; margin: 1px; margin-top: -4px","data-id":"menu-item"}),a.addElement({...f,HTMLcontent:ms,title:ve().INSERT_COLUMN_BEFORE_TABLE,"data-id":"add-left-column"}),a.addElement({...f,HTMLcontent:us,title:ve().INSERT_COLUMN_AFTER_TABLE,"data-id":"add-right-column"}),a.addElement({...f,HTMLcontent:bs,title:ve().MERGE_RIGHT_CELL_TABLE,"data-id":"merge-right-cell"}),a.addElement({...f,HTMLcontent:fs,title:ve().MERGE_LEFT_CELL_TABLE,"data-id":"merge-left-cell"}),a.addElement({...f,HTMLcontent:Ss,title:ve().SPLIT_CELL_TABLE,"data-id":"split-vertical-cell"}),a.addElement({...f,HTMLcontent:cr,title:ve().REMOVE_COLUMN_TABLE,"data-id":"remove-column"}),m.addEventListener("click",c),g.addEventListener("mouseenter",d),g.addEventListener("mouseleave",u);const p=a.addElement({targetElement:e,insertType:"append",style:"cursor: pointer; flex: 1; margin: auto; padding-top: 2px;",className:"em-element-editor-widget-clone",HTMLcontent:sr,title:"Строки"});p.setAttribute("data-open","false");const b=a.addElement({targetElement:p,insertType:"append",tag:"ul",style:a.styleMenuElement}),h={targetElement:b,insertType:"append",tag:"li",className:"em-element-editor-widget-group",style:a.styleMenuElementList};a.addElement({...h,HTMLcontent:sr,title:ve().EDIT_ATOM||"Edit",style:"padding: 3px; cursor: pointer; font-size: 14px; background-color: #E2DEDD; border-radius: 5px; margin: 1px; margin-top: -4px"}),a.addElement({...h,HTMLcontent:ps,title:ve().INSERT_ROW_BEFORE_TABLE,"data-id":"add-top-row"}),a.addElement({...h,HTMLcontent:gs,title:ve().INSERT_ROW_AFTER_TABLE,"data-id":"add-bottom-row"}),a.addElement({...h,HTMLcontent:hs,title:ve().MERGE_TOP_CELL_TABLE,"data-id":"merge-top-cell"}),a.addElement({...h,HTMLcontent:ys,title:ve().MERGE_BOTTOM_CELL_TABLE,"data-id":"merge-bottom-cell"}),a.addElement({...h,HTMLcontent:Es,title:ve().SPLIT_CELL_TABLE,"data-id":"split-horizontal-cell"}),a.addElement({...h,HTMLcontent:cr,title:ve().REMOVE_ROW_TABLE,"data-id":"remove-row"}),b.addEventListener("click",c),p.addEventListener("mouseenter",d),p.addEventListener("mouseleave",u)}function ws(e,o,t){const n=e.closest("div"),r=e.closest("em-replace");if(!r||!n||!t.isClickAtEndOfEmReplace(o,r))return!1;const i=`em-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r.setAttribute("data-em-id",i);const l=t.getOrCreateAfterSpan(r),s=`temp-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;l.setAttribute("data-cursor-target",s),n.innerHTML=n.innerHTML;const c=n.querySelector(`[data-em-id="${i}"]`);if(c){c.removeAttribute("data-em-id");let d=c.nextElementSibling;(!d||!d.hasAttribute("data-cursor-target"))&&(d=n.querySelector(`[data-cursor-target="${s}"]`)),d&&(d.removeAttribute("data-cursor-target"),d.removeAttribute("style"),n.getAttribute("contenteditable")==="true"&&n.focus(),setTimeout(()=>{t.setCursorInsideSpan(d),t._wrapEditor(d,!0),t.commit()},10))}return t.commit(),!0}function ks(e,o){document.querySelectorAll("[em-optimise-error]").forEach(t=>{t.removeAttribute("em-optimise-error")}),document.querySelectorAll("img").forEach((t,n)=>{t.setAttribute("em-optimise",`image_${n}`)}),o.commit()}function _s(e,o){document.querySelectorAll("[em-optimise-error]").forEach(t=>{t.removeAttribute("em-optimise-error")}),document.querySelectorAll("a[href]").forEach((t,n)=>{t.setAttribute("em-optimise",`link_${n}`)}),o.commit()}function Ns(e,o){const t=e.data.settings?.elementId;if(!t)return;const n=document.querySelector(`[em-optimise="${t}"]`);n&&(e.data.settings?.isError&&(n.setAttribute("em-optimise-error","true"),o.commit()),o.messageService.send({operation:"application_scroll-to",settings:{value:n.getBoundingClientRect().top+o.iframeOffsetTop-o.previewHeight/2}}),o.setCursorPosition(n),o.applicationElementSettingsSet({elem:n}))}function Bs(e,o){const t=e.data.settings?.elementId;if(!t)return;const n=document.querySelector(`[em-optimise="${t}"]`);n&&(o.messageService.send({operation:"application_scroll-to",settings:{value:n.getBoundingClientRect().top+o.iframeOffsetTop-o.previewHeight/2}}),o.setCursorPosition(n),o.applicationElementSettingsSet({elem:n}),e.data.settings?.isError&&n.setAttribute("em-optimise-error","true"),o.commit())}var Ms={sandbox_set_attr_to_images:ks,sandbox_set_attr_to_links:_s,sandbox_set_position_to_img:Ns,sandbox_set_position_to_link:Bs},Rs=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28"><rect width="28" height="28" rx="3" fill="#e5e7eb"/><circle cx="18.5" cy="9.5" r="2.5" fill="#9ca3af"/><path d="M5 21l6-7 4 4.5 3-3 5 5.5z" fill="#9ca3af"/></svg>')}`;function no(e){e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.remove():e.elem.previousSibling&&no({elem:e.elem.previousSibling})}function ro(e){if(!e.elem)return!1;if(e.elem.parentElement?.tagName==="SECTION"||e.elem.classList.contains("em-narrow-table")&&Array.from(e.elem.childNodes).every(t=>t.nodeType===Node.TEXT_NODE))return e.elem.innerHTML="",!1;e.elem.querySelector(".em-element-editor")&&e.elem.querySelector(".em-element-editor")?.remove(),e.elem.querySelector(".em-element-path")&&e.elem.querySelectorAll(".em-element-path").forEach(t=>t.remove()),e.elem.querySelector(".em-element-block-add")&&e.elem.querySelectorAll(".em-element-block-add").forEach(t=>t.remove()),e.elem.querySelector(".em-vindent-paddingTop, .em-vindent-paddingRight, .em-vindent-paddingBottom, .em-vindent-paddingLeft")&&e.elem.querySelectorAll(".em-vindent-paddingTop, .em-vindent-paddingRight, .em-vindent-paddingBottom, .em-vindent-paddingLeft").forEach(t=>t.remove());const o=e.elem.parentElement;if(e.elem.classList.contains("em-mob-wrap")||e.elem.classList.contains("noresp-em-mob-wrap"))e.elem.innerHTML.trim()===""&&(e.elem.parentElement?.querySelectorAll(":scope > .em-mob-wrap, :scope > .noresp-em-mob-wrap").length>1?e.elem.innerHTML="":(e.elem.remove(),ro({elem:o})));else if(e.elem.innerHTML.trim()==="")no({elem:e.elem}),e.elem.remove(),ro({elem:o});else if(o&&!o.querySelector('div[style*="display"]')){for(const t of e.elem.childNodes)t.nodeName==="#text"&&t.textContent?.trim()===""?(no({elem:t}),t.textContent=""):t.nodeName==="#comment"&&t.textContent?.indexOf("mso")!==-1&&(no({elem:t}),t.remove());e.elem.innerHTML.trim()===""&&ro({elem:e.elem})}return!0}function Ps(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=e.getElementParent(o);let n=o.parentNode;const r=o.closest("editor");if(e.setCursorPosition(t),o.classList.contains("em-code")){const i=e.getVariableByIcon?.(o);i&&(i.parentNode?.removeChild(i),o.remove())}else if(o.tagName==="TD"&&o.innerHTML===""&&o.hasAttribute("height")){const i=o.closest("table");if(i){const l=i.previousSibling;l&&l?.textContent?.trim()===""&&l.remove(),i.remove()}}else if(o.closest(".em-element-resize-img-container"))n=o.closest(".em-element-resize-img-container").parentNode,o.closest("td")?.querySelector("editor")?.innerHTML===""&&o.closest("td")?.querySelector("editor")?.remove(),o.closest(".em-element-resize-img-container")?.remove();else if(o.closest('[em="atom"]')){const i=o.closest(".em-mob-wrap, .noresp-em-mob-wrap"),l=o.closest('[em="atom"]');o.tagName==="TD"&&o.previousElementSibling===null&&o.nextElementSibling===null?(n=l.parentNode,l?.remove()):(n=o.closest("td"),o.remove());const s=!!i&&Array.from(i.querySelectorAll('[em="atom"]')).some(c=>c!==l);o.tagName!=="TD"&&i&&!s&&i.textContent?.trim()===""&&(i.textContent="")}else{o.remove();const i=o.previousSibling;i&&i?.textContent?.trim()===""&&i.remove(),o.remove()}r&&r.remove(),ro({elem:n}),e.commit(),e.messageService.send({operation:"application_element_settings_close"})}function Is(e,o){const t=document.querySelector("[em-edit]");if(t)if(e.action==="add_p"){let n=null;if(["DIV","P","TD","EDITOR","B","STRONG","SPAN","I","EM","A"].includes(t.tagName)){if(t.closest("div")?.style.fontFamily?n=t.closest("div"):t.closest("p")?.style.fontFamily?n=t.closest("p"):n=t,n&&o.HTMLDocument){const r=o.HTMLDocument.getOuterHtml(n);n.closest("table")?.getAttribute("em")==="atom"?n.closest("table")?.insertAdjacentHTML("afterend",`<table cellpadding="0" cellspacing="0" border="0" width="100%" em="atom"><tr><td style="padding-bottom: 10px;">${r}</td></tr></table>`):n.insertAdjacentHTML("afterend",`<table cellpadding="0" cellspacing="0" border="0" width="100%" em="atom"><tr><td style="padding-bottom: 10px;">${r}</td></tr></table>`)}o.commit()}o.setCursorPosition(t)}else if(e.action==="add_img"){if(window.getSelection){const n=document.createElement("img");n.setAttribute("src",Rs),n.setAttribute("width","28"),n.setAttribute("border","0"),n.setAttribute("alt",""),n.style.display="inline-block",n.style.verticalAlign="text-bottom";const r=window.getSelection();if(r?.getRangeAt&&r.rangeCount){const i=r.getRangeAt(0);i.deleteContents(),i.insertNode(n)}else document.querySelector("[em-edit]")?.prepend(n);o.commit()}}else(e.action==="typograf"||e.action==="typograf_all")&&Hs(e,o).catch(n=>{})}async function Hs(e,o){const{default:t}=await a.__vitePreload(async()=>{const{default:c}=await Promise.resolve().then(()=>To("./typograf.all.BbXdyfMT.js")).then(d=>d.typograf_all_exports);return{default:c}},void 0,{}.url);let n=document.querySelector("[em-edit]")?.closest("div")||document.querySelector("[em-edit]")?.closest("editor")||null;const r=e.action==="typograf"?n?.innerText:document.body.innerText,i=o.hasRussianText?.(r||"")??!1,l=new t({locale:[e.locale==="ru_RU"||i?"ru":"en-US"],htmlEntity:{type:"name",onlyInvisible:!0,list:["nbsp","shy","mdash","ndash","laquo","raquo"]}});l.disableRule("ru/punctuation/*"),l.disableRule("common/punctuation/*"),l.enableRule("common/punctuation/quote"),l.setSetting("common/punctuation/quote","ru",{left:"«",right:"»",removeDuplicateQuotes:!0}),l.setSetting("common/punctuation/quote","en-US",{left:'"',right:'"',removeDuplicateQuotes:!0}),l.disableRule("ru/dash/kakto"),l.disableRule("ru/dash/taki"),l.disableRule("ru/dash/izpod"),l.disableRule("ru/dash/izza"),l.disableRule("ru/dash/ka"),l.disableRule("ru/dash/to"),l.disableRule("ru/dash/koe"),l.disableRule("common/nbsp/nowrap"),l.disableRule("common/nbsp/dpi"),l.disableRule("common/nbsp/afterParagraphMark"),l.enableRule("common/nbsp/afterNumber"),l.disableRule("common/html/quot"),l.disableRule("ru/date/*"),l.disableRule("common/number/mathSigns"),l.disableRule("ru/number/ordinals"),l.disableRule("ru/number/comma"),l.disableRule("ru/symbols/NN"),l.disableRule("common/symbols/cf"),l.disableRule("ru/other/phone-number"),l.addSafeTag('<[^>]+class="preheader"[^>]*>',"</[^>]+>"),l.addSafeTag("<!--","-->");function s(c){let d=l.execute(c);return d=d.replace(/\b(\d{1,3}(?:[ \u00A0]\d{3})*(?:[.,]\d+)?)\b/g,function(u){return u.replace(/[ \u00A0]/g,"").replace(/\B(?=(\d{3})+(?!\d))/g," ")}),d=d.replace(/(\d[\d ]*[.,]?\d+)(?:\s| )?(?=(?:руб(?:\.|лей)?|р\.|долл(?:\.|аров)?|\$|₽|€|£|¥|USD|EUR|RUB))/gi,"$1 "),d=d.replace(/(\d[\d ]*[.,]?\d+) (руб(?:\.|лей)?|р\.|долл(?:\.|аров)?|\$|₽|€|£|¥|USD|EUR|RUB)/gi,"$1 $2"),d}if(e.action==="typograf_all"){const c=document.body;c&&(c.innerHTML=s(c.innerHTML))}else n?.parentElement&&(n=n.parentElement,n?.parentElement&&(n.parentElement.innerHTML=s(n.parentElement.innerHTML)));document.querySelectorAll(".em-element-resize-img-container").forEach(c=>c.replaceWith(...c.childNodes)),document.querySelectorAll(".em-element-img-change-group").forEach(c=>c.remove()),document.querySelectorAll("editor").forEach(c=>c.replaceWith(...c.childNodes)),o.commit()}function dr(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function Uo(e){if(!e||e.tagName!=="A")return!1;const o=e.getAttribute("style");if(!o||!o.includes("display"))return!1;const t=e.style.display;return!(t!=="block"&&t!=="inline-block"||o.includes("mso-style-priority"))}function Os(e,o){const t=e.closest("a");if(Uo(t))return t;if(!o)return null;const n=dr(o.anchorNode)?.closest("a")??null;if(Uo(n))return n;const r=dr(o.focusNode)?.closest("a")??null;return Uo(r)?r:null}function mr(e){return e.tagName==="IMG"?e.closest('div[em="atom"]')||e.closest(".em-element-resize-img-container")||e:e.closest("editor")?e.closest('[style*="font-family"][style*="font-size"]')||e:e.tagName==="TD"&&e.classList.contains("em-vindent")?e.closest(".em-vindent-table")||e:e.tagName==="TD"&&e.parentElement?.getAttribute("em")==="block"?e.parentElement:e}function ur(e){return e?e.classList.contains("em-vindent-table")?e.querySelector("td"):e.classList.contains("em-element-resize-img-container")?e.querySelector("img"):e.tagName==="TR"&&e.getAttribute("em")==="block"?e.firstElementChild:e:null}function xs(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=window.getSelection();if(Os(o,t)&&t&&!t.isCollapsed)try{t.collapseToEnd()}catch{}const n=e.getElementParent(o);n instanceof Element&&(e.setCursorPosition(n),e.applicationElementSettingsSet({elem:n}))}function Ds(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=ur(mr(o).previousElementSibling);t&&(e.setCursorPosition(t),e.applicationElementSettingsSet({elem:t}))}function Fs(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=ur(mr(o).nextElementSibling);t&&(e.setCursorPosition(t),e.applicationElementSettingsSet({elem:t}))}function qs(e,o){o.removeAllAttributes("em-edit");const t=document.querySelector(".em-editor-wrapper");t&&(t.style.display="none"),document.querySelectorAll("editor").forEach(n=>{n.blur()})}function Ws(e,o){const t=o.elementPath[e.data.index??0];if(t?.elem){const n=t.elem;o.applicationElementSettingsSet({elem:n}),o.setCursorPosition(n)}}function $s(e,o){o.removeAllAttributes("em-state");const t=o.elementPath[e.data.index??0];t?.elem&&t.elem.setAttribute("em-state","active")}function zs(e,o){if(!o.getElementParent)return;const t={setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,applicationElementSettingsSet:o.applicationElementSettingsSet};xs(t)}function Vs(e,o){if(!o.getElementParent)return;const t={setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,applicationElementSettingsSet:o.applicationElementSettingsSet};Ds(t)}function Us(e,o){if(!o.getElementParent)return;const t={setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,applicationElementSettingsSet:o.applicationElementSettingsSet};Fs(t)}function js(e,o){if(!o.getElementParent||!o.state)return;const t={state:o.state,commit:o.commit,setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,messageService:o.messageService,getVariableByIcon:o.getVariableByIcon};Ps(t)}function Gs(e,o){if(!o.getElementParent||!o.state)return;const t={action:e.data.action,locale:e.data.locale},n={state:o.state,commit:o.commit,setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,messageService:o.messageService,HTMLDocument:o.HTMLDocument,hasRussianText:o.hasRussianText};Is(t,n)}var Ys={sandbox_element_active_reset:qs,sandbox_element_active_set:Ws,sandbox_element_hover_set:$s,sandbox_element_parent_get:zs,sandbox_element_prev_get:Vs,sandbox_element_next_get:Us,sandbox_element_remove:js,sandbox_element_text:Gs};function Ks(e,o){a.state.set("lockEdit",!!e.data.data),a.applyEditLock(a.editLocked())}function Xs(e,o){o.setEditorFocus(e.data.data)}var Zs={sandbox_lock_edit:Ks,editor_change_focus:Xs};function Js(e,o){document.querySelectorAll("[em-optimise-error]").forEach(t=>{t.removeAttribute("em-optimise-error")}),document.querySelectorAll("img").forEach((t,n)=>{t.setAttribute("em-optimise",`image_${n}`)}),o.commit()}function Qs(e,o){document.querySelectorAll("[em-optimise-error]").forEach(t=>{t.removeAttribute("em-optimise-error")}),document.querySelectorAll("a[href]").forEach((t,n)=>{t.setAttribute("em-optimise",`link_${n}`)}),o.commit()}function ec(e,o){const t=document.querySelector(`[em-optimise="${e.data.settings.elementId}"]`);t&&(e.data.settings.isError&&(t.setAttribute("em-optimise-error","true"),o.commit()),o.messageService.send({operation:"application_scroll-to",settings:{value:t.getBoundingClientRect().top+o.iframeOffsetTop-o.previewHeight/2}}),o.setCursorPosition(t),o.applicationElementSettingsSet({elem:t}))}function tc(e,o){const t=document.querySelector(`[em-optimise="${e.data.settings.elementId}"]`);t&&(o.messageService.send({operation:"application_scroll-to",settings:{value:t.getBoundingClientRect().top+o.iframeOffsetTop-o.previewHeight/2}}),o.setCursorPosition(t),o.applicationElementSettingsSet({elem:t}),e.data.settings.isError&&t.setAttribute("em-optimise-error","true"),o.commit())}var oc={sandbox_set_attr_to_images:Js,sandbox_set_attr_to_links:Qs,sandbox_set_position_to_img:ec,sandbox_set_position_to_link:tc};function nc(e){const o="b65837b7";let t=document.getElementsByTagName("head")[0];!t&&document.documentElement&&(t=document.createElement("head"),document.documentElement.insertBefore(t,document.documentElement.firstChild));const n=`css/sandbox-${e}.css?${o}`,r=`css/sandbox-${e==="light"?"dark":"light"}.css?${o}`,i=document.querySelectorAll(`[href="${r}"]`);if(!document.querySelector(`[href="${n}"]`)){const l=document.createElement("link");l.setAttribute("rel","stylesheet"),l.setAttribute("type","text/css"),l.setAttribute("em","css"),l.setAttribute("href",n),t?.appendChild(l)}for(const l of i)l.remove()}function rc(e,o){o.initPreview(!0)}function ic(e,o){const t=e.data;t.theme&&(a.state.set("applicationTheme",t.theme),nc(t.theme),a.commit(!1)),t.commonStyles&&o.setCommonStyles(t.commonStyles),typeof t.copyPasteEnabled<"u"&&a.state.set("copyPasteEnabled",t.copyPasteEnabled),typeof t.saveBlockEnabled<"u"&&a.state.set("saveBlockEnabled",t.saveBlockEnabled),typeof t.editImageControlEnabled<"u"&&a.state.set("editImageControlEnabled",t.editImageControlEnabled),typeof t.elementAIimageEnabled<"u"&&a.state.set("elementAIimageEnabled",t.elementAIimageEnabled),typeof t.imageCenterStockEnabled<"u"&&a.state.set("imageCenterStockEnabled",t.imageCenterStockEnabled),typeof t.imageCenterGifEnabled<"u"&&a.state.set("imageCenterGifEnabled",t.imageCenterGifEnabled),typeof t.imageCenterEditorEnabled<"u"&&a.state.set("imageCenterEditorEnabled",t.imageCenterEditorEnabled),typeof t.blocksAddPanelEnabled<"u"&&a.state.set("blocksAddPanelEnabled",t.blocksAddPanelEnabled),typeof t.lockEditor<"u"&&a.state.set("lockEditor",t.lockEditor),typeof t.codeMode<"u"&&a.state.set("codeMode",t.codeMode),typeof t.appName<"u"&&a.state.set("appName",t.appName),typeof t.previewPage<"u"&&(a.state.set("previewPage",t.previewPage),document.body?.classList.toggle("em-sandbox-preview",t.previewPage))}function lc(e){const o=e.data?.data?.theme;(o==="light"||o==="dark")&&a.darkMode.set(o)}var ac={init_preview:rc,update_preview:ic,sandbox_switch_theme:lc},Re=".em-mob-wrap, .noresp-em-mob-wrap",me=".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)",le='div[style*="inline-block"]';function ot(e){e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.textContent=e.elem.textContent.replaceAll(/width=".*?"/gi,'width="'+e.width+'"'):e.elem.previousSibling&&ot({elem:e.elem.previousSibling,width:e.width})}function fr(e){const o=e.removedBlockIndex===0?"nextSibling":"previousSibling";e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.remove():e.elem[o]&&fr({elem:e.elem[o],removedBlockIndex:e.removedBlockIndex})}function io(e){return!!e.querySelector(Re)||!!e.closest(Re)}function Bt(e){return e.querySelector(Re)?document.querySelector('[em-edit="active"]'):e.closest(Re).parentElement}function lo(e){return e.querySelector(le)?document.querySelector('[em-edit="active"]'):e.closest(le).parentElement}function sc(e,o){const t=document.querySelector("[em-edit]");if(t)try{if(o.state.increment("activeElementLocked"),io(t)){const n=Bt(t),r=e.minWidth,i=n.querySelectorAll(me).length,l=i>1?parseFloat(String(e.gap)):20,s=i>1?parseFloat(String(e.gapMobile||e.gap)):20;let c="";n.querySelector(".em-mob-wrap")?c=`<td width="${l}" class="em-mob-wrap em-mob-height-${s}px"></td>
|
|
149
149
|
<td width="${r}" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>`:n.querySelector(".noresp-em-mob-wrap")&&(c=`<td width="${l}" class="noresp-em-mob-wrap noresp-em-mob-height-${s}px"></td>
|
|
150
150
|
<td width="${r}" valign="top" class="noresp-em-mob-wrap em-mob-width-100perc"></td>`);let d=0,u=0,g=0;n.querySelectorAll(me).forEach(f=>{parseFloat(f.getAttribute("width")||"0")>r&&g++,d+=parseFloat(f.getAttribute("width")||"0")});const m=(r+l)/g;if(n.querySelectorAll(me).forEach(f=>{if(parseFloat(f.getAttribute("width")||"0")>r){const p=Math.round(parseFloat(f.getAttribute("width")||"0")-m);f.setAttribute("width",String(p))}}),n.querySelectorAll(me)[i-1].insertAdjacentHTML("afterend",c),n.querySelectorAll(me).forEach(f=>{u+=parseFloat(f.getAttribute("width")||"0")}),d-u-l!==0){const f=n.querySelector(Re),p=parseFloat(f.getAttribute("width")||"0")+(d-u-l);f.setAttribute("width",String(p))}o.setPercentsForColumns(n.querySelectorAll(me)),o.commit()}else{const n=lo(t),r=e.minWidth,i=n.querySelectorAll(le).length,l=i>1?parseFloat(String(e.gap)):20,s='<!--[if (gte mso 9)|(IE)]></td><td width="'+(r+l)+`" valign="top"><![endif]-->
|
|
151
151
|
<div style="display: inline-block; width: `+(r+l)+`px; vertical-align: top;" class="em-mob-width-100perc">
|
|
@@ -316,4 +316,4 @@ __useblocks__.define("js/iframe.js",["require","exports","module","js/rolldown-r
|
|
|
316
316
|
</td>
|
|
317
317
|
</tr>`;function gg(e,o){if(!e||e.innerHTML.trim()||o.getLockEditor())return!1;const t=Li.match(/<style((.|\n|\r)*?)<\/style>/g);o.applyStylesToDocument(t||[]);let n=Li.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();n=o.commonStylesApply({html:n});let r=pg.replace("{{ATOM_HTML}}",n);const i=r.match(/<style((.|\n|\r)*?)<\/style>/g);o.applyStylesToDocument(i||[]),r=o.commonStylesApplyToBlock({html:r}),(r.indexOf("empty-structure")>-1||r.indexOf("em-structure")>-1)&&(r=o.setFloatBlocksWidth({blockHTML:r,targetBlock:e,project:o.appName})),e.insertAdjacentHTML("beforeend",`
|
|
318
318
|
`+r+`
|
|
319
|
-
`);const l=e.querySelector('[em="block"]:last-child [em="atom"]');if(l){const s=l.querySelector("div");let c=null;s&&(s.innerHTML="",s.appendChild(document.createTextNode("")),o.wrapEditor(s,!0),s.classList.add("em-just-inserted"),setTimeout(()=>{const d=s.closest("editor")||s,u=d?.querySelector("div")||s,g=u||d||s,m=g.getBoundingClientRect();["mouseover","mousedown","mouseup","click"].forEach(b=>{g.dispatchEvent(new MouseEvent(b,{bubbles:!0,cancelable:!0,view:window,clientX:m.left+Math.min(1,Math.max(0,m.width/2)),clientY:m.top+Math.min(1,Math.max(0,m.height/2)),button:0}))});let f=u.firstChild;f||(f=document.createTextNode(""),u.appendChild(f)),d?.focus?.();const p=window.getSelection();if(p&&f){const b=document.createRange();b.setStart(f,0),b.collapse(!0),p.removeAllRanges(),p.addRange(b)}o.setCursorPosition(d||s)},0),c=s.closest("editor")||s),s&&o.setCursorPosition(c||s)}return o.messageService.send("application_atom_inserted","text"),o.commit(),!0}function bg(e){return function(t){let n=t.target;try{n=e.getVisibleNode(n);const r=e.isInExternal(n);e.incrementActiveElementLocked();const i=document.body;if(i?.classList.contains("mceNonEditable")&&!i.classList.contains("em-sandbox-discuss")||i?.classList.contains("em-sandbox-discuss")&&!i.classList.contains("em-sandbox-discuss_set-target"))return;if(i?.classList.contains("em-sandbox-discuss_set-target")){document.querySelectorAll('[em-hover="true"]').forEach(u=>{u.removeAttribute("em-hover"),u.removeAttribute("contenteditable")}),n.closest(".em-element-vindent")||(n.setAttribute("em-hover","true"),n.setAttribute("contenteditable","true"));return}if(n.tagName!=="BODY"){const u=n.parentElement;a.unwrapForeignEditors(n)&&!n.isConnected&&u&&(n=u)}if(n&&(n?.closest('[em="atom"]')||!r)&&n.getAttribute("contenteditable")!=="false"&&n.parentElement?.getAttribute("contenteditable")!=="false"&&n.tagName!=="BODY"&&n.parentElement?.tagName!=="SECTION"){const u=!n.closest("editor"),g=!e.getLockEditorInit(),m=n.tagName!=="IMG",f=!(n.childElementCount===1&&n.firstElementChild?.tagName==="IMG"&&(n.textContent?.trim()??"")==="");if(u&&g&&m&&f){let p=n;do if(p=p.closest("div, p, h1, h2, h3, h4, h5")||p.closest("span, b, strong, i, em, s, a, sup, sub"),p)if(!e.isVisible(p))p=p.parentElement;else break;while(p);if(n.tagName==="LI"&&n.style.fontFamily&&n.style.fontSize){const b=n.closest("ul, ol");b&&e.wrapEditor(b,!0)}else if(n.tagName==="TD"&&n.style.fontFamily&&n.style.fontSize&&!n.querySelector("editor"))e.wrapEditor(n);else if(p&&p.style.fontFamily&&p.style.fontSize&&(n.tagName==="LI"||!n.querySelector("img")))if(n.tagName==="LI"){const b=n.closest("ul, ol");b&&e.wrapEditor(b,!0)}else n.querySelector("img")||e.wrapEditor(n,!0);else if(p&&p.closest('[style*="font-family"][style*="font-size"]')){const b=p.closest('[style*="font-family"][style*="font-size"]');b&&b.tagName!=="BODY"&&b.tagName!=="TD"&&b.tagName!=="TABLE"?e.wrapEditor(b,!1):b?.tagName==="TD"&&!b.querySelector("editor")&&!b.closest(".em-element-custom-table")&&e.wrapEditor(b)}else if(p&&p?.tagName==="DIV"&&!p.querySelector("table")){const b=!!p.style.height?.length,h=p.className.includes("em-element-img-change-group"),y=p.querySelector("img")?.parentNode,E=!!p.querySelector("img")&&y&&!e.hasTextNodeInElement(y);!b&&!h&&!E&&e.wrapEditor(p,!0)}else for(let b=0;b<n.childNodes.length;b++){const h=n.childNodes[b];if(h.nodeName==="#text"&&(h.textContent?.trim().length??0)>0&&!n.querySelector("table")){const y=n.tagName==="P"?n.parentElement:n;y&&e.wrapEditor(y);break}}}}(n?.closest('[em="atom"]')||!r)&&!e.getIsLeftButtonDown()&&e.implementElementsEditors(n),n?.classList.contains("em-element-vindent-bg")&&(n=n.closest(".em-vindent")),n?.closest(".em-gap")?n.closest("tr")?.querySelectorAll(".em-mob-wrap:nth-child(even) .em-gap").forEach(u=>u.classList.add("em-hover")):e.getIsLeftButtonDown()||document.querySelectorAll(".em-gap").forEach(u=>u.classList.remove("em-hover"));const l=e.getLoadStylesTimer(),s=!!n.style.padding||!!n.style.paddingTop||!!n.style.paddingBottom||!!n.style.paddingLeft||!!n.style.paddingRight,c=n.closest('[em="block"]'),d=!!c?.querySelector(".em-mob-wrap, .noresp-em-mob-wrap")&&(c?.querySelectorAll(".em-mob-wrap, .noresp-em-mob-wrap").length??0)>2;l&&(n.tagName==="TD"&&(n.innerHTML===""||n.querySelector(".em-element-vindent"))&&n.getAttribute("height")||n.tagName==="DIV"&&n.style.height&&n.style.fontSize||n.tagName==="IMG"||s||d)&&e.implementResizableElems(n)}catch{}finally{Promise.resolve().then(()=>e.decrementActiveElementLocked())}}}function hg(e){return function(t){const n=window.getSelection(),r=(n?.rangeCount?n.getRangeAt(0):null)?.commonAncestorContainer,i=r?.nodeType===1?r:r?.parentElement,l=i?.closest("editor"),s=window.navigator.platform.match("Mac"),c=l?e.getCursorPositionType(l):null,d=l?.closest("tr")?.querySelector("tr td:nth-of-type(2) div"),u=t.target,g=e.getListContext(u),{isList:m}=g,f=d?.textContent===l?.textContent,p=l?e.LIST_REGEX.EMPTY_TEXT.test(l.textContent||""):!1,b=s?t.metaKey:t.ctrlKey;if(b&&t.keyCode===83){t.preventDefault(),e.messageService.send({operation:"application_action",action:"save_email"});return}if(b&&t.keyCode===90){t.preventDefault(),e.messageService.send({operation:"application_action",action:t.shiftKey?"redo":"undo"});return}if(b&&t.keyCode===89&&!t.shiftKey){t.preventDefault(),e.messageService.send({operation:"application_action",action:"redo"});return}if(t.altKey&&t.keyCode===88){t.preventDefault(),e.messageService.send({operation:"application_action",action:"toggle_editor"});return}const h={getElementParent:e.getElementParent,setCursorPosition:e.setCursorPosition,removeElementEditors:e.removeElementEditors,getVariableByIcon:e.getVariableByIcon,removeEmptyParents:e.removeEmptyParents,getAllComments:e.getAllComments,isVariableComment:e.isVariableComment,getVariableIcon:e.getVariableIcon,commit:e.commit,messageService:e.messageService};if(e.handleDeleteKey(t,m,c,h))return;if(t.keyCode===27){const C=document.querySelector(".em-editor-wrapper");C?.style&&(C.style.display="none"),e.removeAllAttributes("em-edit"),document.querySelectorAll("editor").forEach(L=>L.blur()),n?.removeAllRanges(),e.applicationElementSettingsSet({elem:null}),e.messageService.send({operation:"application_close-image-edit-popup"});return}b&&t.keyCode===66&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"toggle_strong"}));const y=s?t.keyCode===88:t.keyCode===53;if((s?t.metaKey:t.altKey)&&t.shiftKey&&y&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"toggle_strikethrough"})),b&&t.shiftKey&&t.keyCode===76&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"textAlign_left"})),b&&t.shiftKey&&t.keyCode===82&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"textAlign_right"})),b&&t.shiftKey&&t.keyCode===69&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"textAlign_center"})),b&&t.keyCode===73&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"toggle_italic"})),b&&t.keyCode===85&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"toggle_underline"})),wa(t,{commit:e.commit})||e.handleEnterForBr(t,l,m,f,{commit:e.commit}))return;if(b&&t.keyCode===86){e.setIsPasteFromContextMenu(!1);const C=L=>{e.handlePasteTextFragment(L,!1,e.getCommonStyles(),e.changeMsoValue,e.commit),document.removeEventListener("paste",C)};document.addEventListener("paste",C)}else e.changeMsoValue(t);const E={activeElem:l,listContext:g,cursorPositionType:c,isTargetCell:f,isEmptyText:p,commit:e.commit,wrapEditor:e.wrapEditor,removeTemporaryListClasses:e.removeTemporaryListClasses};if(e.handleEnterInList(t,E)||(e.handleArrowRightInList(t,c,p),e.handleArrowUpDownInList(t,E)))return;const S={...E,parentElement:i,findNodeAtPosition:e.findNodeAtPosition,setCursorSafely:e.setCursorSafely};if(e.handleDeleteInList(t,S)||e.handlePreventBulletCellEdit(t,m,f))return;const v={isCaretAtEndOfEmReplace:e.isCaretAtEndOfEmReplace,getOrCreateAfterSpan:e.getOrCreateAfterSpan,setCursorInsideSpan:e.setCursorInsideSpan,isCaretAtEndOfStandardElement:e.isCaretAtEndOfStandardElement,setCursorPositionSimple:e.setCursorPositionSimple,wrapEditor:e.wrapEditor,commit:e.commit};e.handleArrowRight(t,v)&&e.commit()}}var yg=new Set(["textStrong","textItalic","textStrikethrough","textUnderline","textLink","textColor","textBackgroundColor"]);function Eg(e){const{commit:o,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,findOutermostParentWithText:l,clearLinkTags:s,addFontFamilyClass:c,getIsProgrammaticSelection:d,getCommonStyles:u}=e;function g(E,S,v){const C=!!E&&!!S&&S.tagName==="DIV"&&E.tagName==="EDITOR"&&E.parentElement===S&&S.childElementCount===1&&S.firstElementChild===E&&!Array.from(S.childNodes).some(R=>R!==E&&R.nodeType===Node.TEXT_NODE&&!!R.textContent?.trim()),L=!!E&&E.childElementCount===0&&Array.from(E.childNodes).some(R=>R.nodeType===Node.TEXT_NODE&&!!R.textContent?.trim()),w=!!E&&oe(E).trim()===v.trim();if(!C||!L||!w||!E.hasAttribute("em-edit")||!S.parentNode)return;const T=S.parentNode,M=E.getAttribute("em-edit")||"active";for(;E.firstChild;)S.appendChild(E.firstChild);E.remove(),E.removeAttribute("em-edit"),S.setAttribute("em-edit",M),T.replaceChild(E,S),E.appendChild(S)}function m(E,S){try{return S.intersectsNode(E)}catch{const v=document.createRange();return v.selectNodeContents(E),S.compareBoundaryPoints(Range.END_TO_START,v)<0&&S.compareBoundaryPoints(Range.START_TO_END,v)>0}}function f(E){const S=E?.links||{},v=S.underline,C=S.color,L=typeof v=="boolean"?v?"underline":"none":"underline";return{color:typeof C=="string"&&C.trim()?C.trim():"inherit",textDecoration:L}}function p(E,S){if(!E||!S)return null;const v=S,C=Array.from(v.querySelectorAll("a"));v.tagName==="A"&&C.unshift(v);const L=typeof window<"u"&&window.Range?window.Range.START_TO_START:0,w=typeof window<"u"&&window.Range?window.Range.END_TO_END:2;for(const T of C){const M=document.createRange();M.selectNodeContents(T);const R=M.compareBoundaryPoints(L,E)<=0,j=M.compareBoundaryPoints(w,E)>=0;if(R&&j)return T}return null}function b(E,S,v){const C=Array.from(S?.getElementsByTagName("span")||[]).reverse();let L=!1;oe(S)===E&&C.length&&(L=!0),C.forEach(w=>{const T=w.getAttribute("style"),M=!!T&&T.trim().length>0;let R=Array.from(w.attributes).filter(Q=>Q.name!=="style");if(!M&&R.length===1&&R[0].name==="em-edit"&&w.parentElement&&!w.parentElement.hasAttribute("em-edit")){const Q=w.getAttribute("em-edit")||"active";w.parentElement.setAttribute("em-edit",Q),w.removeAttribute("em-edit"),R=Array.from(w.attributes).filter(k=>k.name!=="style")}const j=R.length>0;if(!M&&!j){const Q=oe(w);if(w.childNodes.length===1&&w.childNodes[0].nodeType===3){const k=w.childNodes[0];w.parentNode?.replaceChild(k,w),v.isEditorTagOutside&&oe(S)!==E&&k.parentNode&&(v.range?.selectNode(k),t(v.range))}else{const k=Array.from(w.childNodes);k.forEach(K=>{w.parentNode?.insertBefore(K,w)}),E===Q&&(v.range=document.createRange(),v.range.setStartBefore(k[0]),v.range.setEndAfter(k[k.length-1]),t(v.range)),w.parentNode?.removeChild(w)}}}),L&&(n(S,E),v.range.selectNode(S),t(v.range))}function h(E,S){if(E?.rangeCount>0){const v=E.getRangeAt(0),C=v.commonAncestorContainer;let L=v.startOffset,w=v.endOffset;for(;C.data&&L>0&&!/\s/.test(C.data[L-1]);)L--;for(;C.data&&w<C.length&&!/\s/.test(C.data[w]);)w++;S.setStart(C,L),S.setEnd(C,w),t(S)}}function y(E,S,v){E.innerHTML=E.innerHTML.replaceAll(/<\/?strike[^>]*>/gi,""),E.parentNode&&(v.selectNode(E),t(v),n(E,S))}return function(S,v){const C=Zf(v.settings,a.rgbToHex),L=v.settings.textColor??v.settings.textBackgroundColor;if(typeof L=="string"&&L.trim()!==""&&!a.rgbToHex(L))return!1;const w=a.getListContext(S),{classNameOl:T,classNameUl:M,classNameBullet:R,isListOL:j,isListUL:Q,isList:k}=w;k&&w.tableElement?.querySelectorAll("tbody > tr > td:first-child")?.forEach(N=>{const Y=N.querySelector(":scope > div")||N.querySelector(":scope > editor div");Y&&Y.classList.add(`${R}`)}),S?.querySelectorAll(".em-element-path").forEach(N=>N.remove());const K=Object.keys(v.settings)[0];let P=window.getSelection();if(!P||P.rangeCount===0){if(!S||!S.isConnected)return;const N=document.createRange();if(N.selectNodeContents(S),P=window.getSelection(),!P)return;P.removeAllRanges(),P.addRange(N)}let I=P.getRangeAt(0);const D=I.commonAncestorContainer;let O=D.nodeType===1?D:D.parentElement,Z=P.anchorNode?.nodeType===1?P.anchorNode:P.anchorNode?.parentElement,ee=!1,q=a.getSelectedText();if(S||(S=P.anchorNode?.childNodes.length===1&&P.anchorNode.firstChild?.nodeType===1?P.anchorNode.firstChild:O,S.tagName==="EDITOR"&&(S=S.parentElement)),C.name==="textLink"&&C.value===""){const N=O?.closest?.("a, [href]")||null;N&&(I.selectNode(N),t(I),S=N)}if(C.name==="textUnderline"&&!C.value){let N=O.closest(["u","strike","[style*=text-decoration]","span","a"].find(Y=>O?.closest(Y))||"u");!N&&S?.tagName==="A"&&(N=S),N?.tagName==="A"&&(N.style.textDecoration="none",n(N,q),I.selectNode(N),t(I),S=N,ee=!0)}let B=v.type==="button"?(S||Z)?.closest("a"):(S||Z)?.closest("a, div, p, td, h1, h2, h3, h4, h5, h6, li, ul, ol, sup, sub");const ue=v.settings.fontFamily;let $=null;const ie=Array.from(B?.classList||[]).some(N=>(N.startsWith("em-font-")&&($=N),N.startsWith("em-font-")&&N.includes(C.name==="textItalic"?"Italic":"Bold")));ie&&(C.name==="textItalic"||C.name==="textStrong")&&$&&B?.classList.remove($);const G={range:I,isEditorTagOutside:!1},re=(N=a.getSelectedText(),Y=B)=>{b(N,Y,G)},we=a.checkForWorkClass,ke=a.checkForTextNodes,So=(N,Y)=>{y(N,q,G.range)};let Pe,fe;K==="textColor"?Pe=fe="color":K==="textBackgroundColor"&&(Pe="backgroundColor",fe="background-color");const Ae=v.settings.hasOwnProperty("textColor")||v.settings.hasOwnProperty("textBackgroundColor"),se=!!O?.closest("editor")||oe(O)===q||oe(O.querySelector("editor"))===q;G.isEditorTagOutside=se,v.settings.hasOwnProperty("textColor")&&C.value&&document.execCommand("styleWithCSS",!1,"true");const Ie=a.setCustomColor,Ye=d(),_e=u();if(ap({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex})||sp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,fontFamilyArray:ue,removeClassesByPrefix:a.removeClassesByPrefix$1,createFontClassName:a.createFontClassName,clearLinkTags:s,addFontFamilyClass:c,cleanEmptySpans:re}))return!1;const he=O.closest(C.tags.find(N=>O?.closest(N))||"span");(I?.collapsed||!a.getSelectedText())&&(C.value?C.value&&se&&(v.type==="button"||S.tagName==="A"&&he?I.selectNodeContents(he):h(P,I)):he&&I.selectNodeContents(he)),(v.type==="button"||S.tagName==="A"||S?.closest("a"))&&a.getSelectedText()&&a.getSelectedText()!==oe(S)&&he&&(v.settings.hasOwnProperty("textLink")||v.settings.hasOwnProperty("textUnderline"))&&(I.selectNode(he),t(I),v.settings.hasOwnProperty("textUnderline")&&S.tagName==="A"&&(S.style.textDecoration=C.value?"underline":"none",ee=!0)),P=window.getSelection(),I=P.getRangeAt(0),G.range=I,q=a.getSelectedText(),Array.from(B?.querySelectorAll("span,div")||[]).reverse().forEach(N=>{N.getAttribute("style")===""&&N.removeAttribute("style"),N.hasAttribute("contenteditable")&&N.removeAttribute("contenteditable"),N.hasAttribute("em-edit")&&N.removeAttribute("em-edit"),N.hasAttribute("em-relative")&&N.removeAttribute("em-relative"),N.hasAttribute("class")&&(N.classList.remove("em-relative"),N.classList.length===0&&N.removeAttribute("class"))});let Co=null;Ae&&fe&&B?.style?.getPropertyValue?.(fe)?.trim()&&(oe(B)===q&&(B.style[Pe]=a.rgbToHex(C.value?.toString())||"",ee=!0),Pe==="color"&&(O===B||S?.closest('[style*="color"]')===B)&&(Co=a.rgbToHex(B.style[fe]),B.style.removeProperty(fe),!B?.hasAttribute("em-edit")&&k&&B&&Ye&&B.closest("tr")?.querySelector(`.${R}`)?.style.removeProperty(fe)));let Vt=null,Ke=null;if(Ae&&Pe==="color"&&B?.tagName==="A"){let N=B.parentElement;for(;N&&!["BODY","HTML","TD","TH"].includes(N.tagName);){const Y=N.style.getPropertyValue("color")?.trim();if(Y){Vt=a.rgbToHex(Y)||Y,Ke=N,N.style.removeProperty("color");break}N=N.parentElement}}fe&&!(C.value.length===7||C.value.length===4)&&(ee=!0),se&&(!C.value&&C.name!=="fontSize"&&C.name!=="textLink"||C.value)&&(!(C.name==="textUnderline"||C.name==="textStrikethrough")||v.type!=="button")&&!ee&&(C.name!=="fontSize"&&!Ae&&oe(B)===q?document.execCommand(C.command,!1,Ae?C.value:C.name==="textLink"?" ":void 0):oe(B)!==q&&(v.settings.hasOwnProperty("textColor")&&document.execCommand("styleWithCSS",!1,"true"),document.execCommand(C.command,!1,Ae?String(C.value):C.name==="textLink"?" ":void 0),v.settings.hasOwnProperty("textColor")&&C.value&&ip(B||O,String(C.value),a.rgbToHex))),q=a.getSelectedText();{const N={parentElement:O,parentNode:Z,parentWrapper:B,selection:P,range:I};mp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,activeElement:S,hasItalicClass:ie,tempStyleClass:$,checkForWorkClass:we,removeFormattingTags:Rt,cleanEmptySpans:re,mutableState:N,currentStyle:Pe,isProgrammaticSelection:Ye,findParentWithFontSizeAndTag:a.findParentWithFontSizeAndTag}),O=N.parentElement,Z=N.parentNode,B=N.parentWrapper,P=N.selection,I=N.range,G.range=I}cp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,activeElement:S,hasItalicClass:ie,tempStyleClass:$,checkForWorkClass:we,removeFormattingTags:Rt,cleanEmptySpans:re}),dp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,activeElement:S,hasItalicClass:ie,tempStyleClass:$,checkForWorkClass:we,removeFormattingTags:Rt,cleanEmptySpans:re});const Et={parentWrapper:B,range:I,selection:P};up({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,activeElement:S,hasItalicClass:ie,tempStyleClass:$,checkForWorkClass:we,removeFormattingTags:Rt,cleanEmptySpans:re,request:v,findOutermostParentWithText:l,mutableState:Et}),B=Et.parentWrapper,I=Et.range,G.range=I;const Tn={parentWrapper:B,range:I,selection:P};if(fp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,activeElement:S,hasItalicClass:ie,tempStyleClass:$,checkForWorkClass:we,removeFormattingTags:Rt,cleanEmptySpans:re,request:v,findOutermostParentWithText:l,cleanStrikesInElement:So,mutableState:Tn}),B=Tn.parentWrapper,C.value===!1&&B){const N=window.getSelection(),Y=N&&N.rangeCount>0?N.getRangeAt(0):I,He={textStrong:["strong","b"],textItalic:["em","i"],textStrikethrough:["s","strike"],textUnderline:["u"]}[C.name];let ze=!1;He&&He.forEach(X=>{Array.from(B.getElementsByTagName(X)).reverse().forEach(ye=>{if(!m(ye,Y))return;const Ve=oe(ye);if(!Ve||Ve.trim().length===0)return;const ce=ye.parentElement;ye.hasAttribute("em-edit")&&ce&&!ce.hasAttribute("em-edit")&&ce.setAttribute("em-edit",ye.getAttribute("em-edit")||"active"),ye.outerHTML=ye.innerHTML,ze=!0,g(ce,B,q)})}),ze&&setTimeout(()=>{const X=document.querySelector("[em-edit]")||r(q)||(B?.isConnected?B:null);X&&n(X,q)},0)}if(C.value===!0&&B&&se){const N={textStrong:"strong",textItalic:"em",textStrikethrough:"s",textUnderline:"u"},Y={textStrong:["strong","b"],textItalic:["em","i"],textStrikethrough:["s","strike"],textUnderline:["u"]},He=N[C.name],ze=Y[C.name];if(He&&ze&&q&&q.trim().length>0){const X=B,ye=ze.some(Qe=>X.getElementsByTagName(Qe).length>0),Ve=(X.style?.textDecoration||"").toLowerCase(),ce=(X.style?.textDecorationLine||"").toLowerCase(),Ne=Ve.includes("underline")||ce.includes("underline"),de=Ve.includes("line-through")||ce.includes("line-through"),St=C.name==="textUnderline"&&Ne||C.name==="textStrikethrough"&&de,Ao=oe(X)===q;if(!ye&&!St&&Ao){const Qe=document.createElement(He);for(;X.firstChild;)Qe.appendChild(X.firstChild);X.appendChild(Qe);try{const Oe=document.createRange();Oe.selectNodeContents(Qe),t(Oe),I=Oe,G.range=Oe}catch{}setTimeout(()=>{const Oe=document.querySelector("[em-edit]")||r(q)||(X.isConnected?X:null);Oe&&n(Oe,q)},0)}}}const W={parentWrapper:B,parentNode:Z,range:I,selection:P};pp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,isColorChange:Ae,tempColor:Co,outerContextColor:Vt,outerContextElement:Ke,stylePropretyName:fe,currentStyle:Pe,canselExecCommand:ee,isProgrammaticSelection:Ye,request:v,setCustomColor:Ie,checkForWorkClass:we,cleanEmptySpans:re,mutableState:W}),B=W.parentWrapper,Z=W.parentNode;const pe={parentWrapper:B,parentNode:Z,range:I,selection:P};if(bp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,findOutermostParentWithText:l,activeElement:S,commonStyles:_e,cleanEmptySpansWithParent:re,mutableState:pe}),I=pe.range,C.name==="textLink"&&C.value===!0&&se&&B&&q?.trim().length>0){const N=pe.range||I,Y=q.trim(),He=[...B?Array.from(B.querySelectorAll("a")):[],...B?.parentElement?Array.from(B.parentElement.querySelectorAll("a")):[]],ze=He.find(X=>oe(X)?.trim()===Y)||He[0]||null;if(!(p(N,B)||p(N,B.parentElement)||ze)&&N&&!N.collapsed){const X=document.createElement("a"),{color:ye,textDecoration:Ve}=f(_e);X.setAttribute("target","_blank"),X.setAttribute("href",""),X.setAttribute("new","true"),X.setAttribute("style",`color: ${ye}; text-decoration: ${Ve};`);let ce=!1;const Ne=B.querySelector("editor");if(Ne&&oe(Ne)===q&&Ne.querySelector("a")===null){for(;Ne.firstChild;)X.appendChild(Ne.firstChild);Ne.appendChild(X),ce=!0}try{if(!ce){const de=N.extractContents();de.childNodes.length>0&&(X.appendChild(de),N.insertNode(X),ce=!0)}}catch{ce=!1}if(!ce&&oe(B)===q){for(;B.firstChild;)X.appendChild(B.firstChild);B.appendChild(X),ce=!0}if(ce){try{const de=document.createRange();de.selectNodeContents(X),t(de),I=de,pe.range=de,G.range=de}catch{}n(X,q)}}}const Ln=C.name==="textUnderline"&&!C.value;if((!Ae&&ee||Ln)&&re(q),yg.has(C.name)){const N=pe.parentWrapper||B||r(q)||i();N&&re(q,N)}k&&O.querySelectorAll(`tr td:first-child > div.${R}, tr td:first-child > editor div.${R}`).forEach(N=>{N.classList.remove(`${R}`)});const vo=r(q);vo?.hasAttribute("em-edit")||vo?.setAttribute("em-edit","active"),o()}}var ge=null,ft=!1,wi=!1,Ue="",je="",pt=null,ki=null,nt=null,pn=!1,po=!1,gn=!1,ne,Xe,bn,rt,$e,go,U,bo,_i,hn,yn,ho,qt,En=".em-prevent-action",F,Wt,it,gt;function be(e){return Kd(e,{HTMLDocument:U,documentMapping:rt,remoteDocument:Xe,messageService:a.messageService})}function Sg(e){go?.setEditorFocus(e)}function Cg(e,o=a.getSelectedText()){let n=(i=>i?.nodeType===Node.ELEMENT_NODE?i:i?.parentElement||null)((typeof a.findElementWithSelectedText=="function"?a.findElementWithSelectedText(o,e):null)||e);if(!n||n.tagName==="EDITOR"&&(n=n.firstElementChild||null,!n))return;const r=a.state.get("activeElementLocked")>0;try{r&&a.state.decrement("activeElementLocked"),ae({elem:n})}finally{r&&a.state.increment("activeElementLocked")}}function vg(e,o){const t=U.getRangeByElement(e,!0);t&&rt.hasMappedReplacementRangeInRange(t)||$e.whenEditorLostFocus(()=>it(e,o),"editor")}function Ag(e){return a.prepareEditorHTML(e,a.parseFromString)}var Tg=a.checkIsEditorInited;function Ni(e=!1){lm({state:a.state,getEmailWidth:()=>a.state.get("emailWidth"),messageService:a.messageService,removeHiddenClasses:a.removeHiddenClasses,findGlobalHolder:Ai,elMarkupHelper:wg,rgbToHex:a.rgbToHex,getSubject:Go,getPreheader:ao,getUsedColors:qr,commit:F,setGlobalHolder:o=>{ge=o}},e),yn?.refit()}function Lg(...e){if(a.state.get("previewPage")){yn.refit();return}ed(...e)}function wg(){gm(ge)}function kg(e){return hm(e,U)}function _g(e){return gg(e,{getLockEditor:()=>a.state.get("lockEditor"),applyStylesToDocument:kg,commonStylesApply:Ze,commonStylesApplyToBlock:Je,setFloatBlocksWidth:Ge,appName:a.state.get("appName"),wrapEditor:it,setCursorPosition:be,messageService:a.messageService,commit:F})}function Ng(e){Pu(e,{setBlockGroupControlsPosition:yo,commit:F})}var Bi=Dt,Mi=Ft;function Bg(){return a.stickyCheck(F)}var Mg=a.checkSandboxStyles,Sn=a.getElementParent;function Rg(e){return a.addBlockToProject(e,{HTMLDocument:U,messageService:a.messageService})}function yo(){return a.setBlockGroupControlsPosition({scrollTop:a.state.get("scrollTop")})}function Ge(e){return a.setFloatBlocksWidth(e,ne)}function bt(e){return a.setBlockMaxWidth(e,ne)}var lt=a.setImageWidth;function at(e){return a.insertCountdown(e,F)}var $t=a.uptimeCountdown,ht=a.checkBlockAdaptivity;function Cn(e){return a.addFontFamilyClass(e,F)}function vn(e){a.clearLinkTags(e,o=>{F(o)}),Ri()}function Ri(){a.clearProjectFontFaces(e=>{F(e)})}function Ze(e){return a.commonStylesApply(e,F)}var Je=a.commonStylesApplyToBlock,Pg=a.getStructureColumns,Ig=a.getElementTdDiv,Pi=a.setStructureBlocksWidth;function Hg(e){e=ne.getVisibleNode(e),a.implementResizableElems(e),$e.whenEditorLostFocus(()=>{e.isConnected})}function Ii({target:e}){return bm({target:e},F)}var Hi;function Og(e){const o=["textStrong","textItalic","textStrikethrough","textUnderline","textColor","textBackgroundColor","textLink","lineHeight","fontSize","fontFamily"];try{a.state.increment("activeElementLocked");let t=e.data;t.settings=bo.escape(t.settings),Object.keys(t.settings)[0];let n=a.getActiveEditElement();const r=n;let i=r?.parentElement??null;for(;i&&!i.tagName.startsWith("AMP-");)i=i.parentElement;const l=r?.tagName??"",s=i&&r?Array.from(i.getElementsByTagName(l)).indexOf(r):-1,{classNameOl:c,classNameUl:d,isListOL:u,isListUL:g,isList:m}=a.getListContext(n),f=a.getListContainer(n);if(t.type==="img"||t.type==="countdown"||t.type==="video")Mp(t.settings,{activeElement:n,getActiveEditElement:a.getActiveEditElement,setCursorPosition:be,setElementBorder:a.setElementBorder,setElementBoxShadow:a.setElementBoxShadow,setElementBorderRadius:a.setElementBorderRadius,setElementMobileWidth:a.setElementMobileWidth,setElementMobileHeight:a.setElementMobileHeight,setElementMobileBorder:a.setElementMobileBorder,setElementMobileBorderRadius:a.setElementMobileBorderRadius,setElementMobileBoxShadow:a.setElementMobileBoxShadow,setElementMobileAlign:a.setElementMobileAlign,setElementMobileVerticalAlign:a.setElementMobileVerticalAlign,setElementShow:a.setElementShow});else if(t.type==="a")Rp(t.settings,{activeElement:n,textStyleProperties:o,toggleTextStyle:gt});else if(t.type==="table")af(t.settings,{activeElement:n,setElementBorder:a.setElementBorder,setElementBoxShadow:a.setElementBoxShadow,setElementBorderRadius:a.setElementBorderRadius,setElementMobileTableAlign:a.setElementMobileTableAlign,setElementMobileWidth:a.setElementMobileWidth,setElementMobileBorder:a.setElementMobileBorder,setElementMobileBorderRadius:a.setElementMobileBorderRadius,setElementMobileBoxShadow:a.setElementMobileBoxShadow,setElementMobileBackgroundColor:a.setElementMobileBackgroundColor,setElementMobileBackgroundImage:a.setElementMobileBackgroundImage,setElementMobileBackgroundPositionX:a.setElementMobileBackgroundPositionX,setElementMobileBackgroundPositionY:a.setElementMobileBackgroundPositionY,setElementMobileBackgroundRepeat:a.setElementMobileBackgroundRepeat,setElementMobileBackgroundSize:a.setElementMobileBackgroundSize,setElementShow:a.setElementShow});else if(t.type==="td"||t.type==="structure"||t.type==="group"||t.type==="column")cf(t.settings,{activeElement:n,requestType:t.type,textStyleProperties:o,isElementListContainer:f,isProgrammaticSelection:{get value(){return ft},set value(b){ft=b}},setElementBorder:a.setElementBorder,setElementBoxShadow:a.setElementBoxShadow,setElementBorderRadius:a.setElementBorderRadius,setElementMobileWidth:a.setElementMobileWidth,setElementMobileHeight:a.setElementMobileHeight,setElementMobileBorder:a.setElementMobileBorder,setElementMobileBorderRadius:a.setElementMobileBorderRadius,setElementMobileBoxShadow:a.setElementMobileBoxShadow,setElementMobileAlign:a.setElementMobileAlign,setElementMobileTableAlign:a.setElementMobileTableAlign,setElementMobileVerticalAlign:a.setElementMobileVerticalAlign,setElementMobileDirection:a.setElementMobileDirection,setElementMobileBackgroundColor:a.setElementMobileBackgroundColor,setElementMobileBackgroundImage:a.setElementMobileBackgroundImage,setElementMobileBackgroundPositionX:a.setElementMobileBackgroundPositionX,setElementMobileBackgroundPositionY:a.setElementMobileBackgroundPositionY,setElementMobileBackgroundRepeat:a.setElementMobileBackgroundRepeat,setElementMobileBackgroundSize:a.setElementMobileBackgroundSize,setElementMobilePadding:a.setElementMobilePadding,setElementShow:a.setElementShow,setContrastBlock:a.setContrastBlock,setStructureBlocksWidth:Pi,toggleTextStyle:gt,removeEditorTags:a.removeEditorTags,addClassToSecondCell:a.addClassToSecondCell,wrapEditor:it,addNewRange:a.addNewRange});else if(t.type==="button")of(t.settings,{activeElement:n,textStyleProperties:o,setElementBorder:a.setElementBorder,setElementBoxShadow:a.setElementBoxShadow,setElementBorderRadius:a.setElementBorderRadius,setElementMobileWidth:a.setElementMobileWidth,setElementMobileHeight:a.setElementMobileHeight,setElementMobileLineHeight:a.setElementMobileLineHeight,setElementMobileBorder:a.setElementMobileBorder,setElementMobileBorderRadius:a.setElementMobileBorderRadius,setElementMobileBoxShadow:a.setElementMobileBoxShadow,setElementMobileAlign:a.setElementMobileAlign,setElementMobileTableAlign:a.setElementMobileTableAlign,setElementMobileVerticalAlign:a.setElementMobileVerticalAlign,setElementMobileBackgroundColor:a.setElementMobileBackgroundColor,setElementMobileBackgroundImage:a.setElementMobileBackgroundImage,setElementMobileBackgroundPositionX:a.setElementMobileBackgroundPositionX,setElementMobileBackgroundPositionY:a.setElementMobileBackgroundPositionY,setElementMobileBackgroundRepeat:a.setElementMobileBackgroundRepeat,setElementMobileBackgroundSize:a.setElementMobileBackgroundSize,setElementMobilePadding:a.setElementMobilePadding,setElementMobileFontSize:a.setElementMobileFontSize,setElementShow:a.setElementShow,toggleTextStyle:gt,compareStrings:a.compareStrings});else if(t.type==="div")lf(t.settings,{activeElement:n,setElementBorder:a.setElementBorder,setElementBoxShadow:a.setElementBoxShadow,setElementBorderRadius:a.setElementBorderRadius,setElementMobileWidth:a.setElementMobileWidth,setElementMobileHeight:a.setElementMobileHeight,setElementMobileBorder:a.setElementMobileBorder,setElementMobileBorderRadius:a.setElementMobileBorderRadius,setElementMobileBoxShadow:a.setElementMobileBoxShadow,setElementMobileAlign:a.setElementMobileAlign,setElementMobileVerticalAlign:a.setElementMobileVerticalAlign,setElementMobileDirection:a.setElementMobileDirection,setElementMobileBackgroundColor:a.setElementMobileBackgroundColor,setElementMobileBackgroundImage:a.setElementMobileBackgroundImage,setElementMobileBackgroundPositionX:a.setElementMobileBackgroundPositionX,setElementMobileBackgroundPositionY:a.setElementMobileBackgroundPositionY,setElementMobileBackgroundRepeat:a.setElementMobileBackgroundRepeat,setElementMobileBackgroundSize:a.setElementMobileBackgroundSize,setElementMobilePadding:a.setElementMobilePadding,setElementShow:a.setElementShow});else if(t.type==="vindent")Pp(t.settings,{activeElement:n,setElementMobileHeight:a.setElementMobileHeight});else if(t.type==="var")Ip(t.settings,{activeElement:n,isVariableText:a.isVariableText});else if(t.type==="floatBlock")ff(t.settings,{activeElement:n,setElementMobileWidth:a.setElementMobileWidth,setElementMobileContentWidth:a.setElementMobileContentWidth,setElementMobileVerticalAlign:a.setElementMobileVerticalAlign,setElementShow:a.setElementShow});else if(t.type==="text")Tp(t.settings,{activeElement:n,textStyleProperties:o,toggleTextStyle:gt,collectVMLContent:Mo,updateVMLComments:Ro,removeClassesByPrefix:a.removeClassesByPrefix$1,createFontClassName:a.createFontClassName,addFontFamilyClass:Cn,clearLinkTags:vn,handleTextScriptSettings:_f,handleTextReplacer:Nf,handleTextAnchor:Hf,unwrapNestedTags:Id,wrapInTag:Wr,unwrapTag:Hd,isRangeMatching:Od,splitWrapper:xd,cleanEmptyTags:Dd,applicationElementSettingsSet:ae,compareStrings:a.compareStrings,setElementMobileFontSize:a.setElementMobileFontSize,setElementMobileLineHeight:a.setElementMobileLineHeight,setElementMobileAlign:a.setElementMobileAlign,updateTableStyle:a.updateTableStyle,changeBullets:a.changeBullets,changeBulletsColor:a.changeBulletsColor,changeBulletsSize:a.changeBulletsSize,changeBulletsItalic:a.changeBulletsItalic,changeBulletsWeight:a.changeBulletsWeight,changeBulletsStrikethrough:a.changeBulletsStrikethrough,changeBulletsUnderline:a.changeBulletsUnderline,findElementWithSelectedText:a.findElementWithSelectedText,removeEditorTags:a.removeEditorTags,isElementList:m,isElementListOL:u,classNameOl:c,classNameUl:d,commit:F});else if(t.type==="floatBlocksWidths")pf(t.settings,{activeElement:n,setPercentsForColumns:a.setPercentsForColumns,setElementMobileHeight:a.setElementMobileHeight});else if(t.type==="floatBlocksPreset")gf(t.settings,{activeElement:n,setPercentsForColumns:a.setPercentsForColumns,setElementMobileHeight:a.setElementMobileHeight});else if(t.type==="floatBlocksValign")bf(t.settings,{activeElement:n,setPercentsForColumns:a.setPercentsForColumns,setElementMobileHeight:a.setElementMobileHeight});else if(t.type==="floatBlocksGap")hf(t.settings,{activeElement:n,setPercentsForColumns:a.setPercentsForColumns,setElementMobileHeight:a.setElementMobileHeight});else if(t.type==="floatBlocksGapMobile")yf(t.settings,{activeElement:n,setPercentsForColumns:a.setPercentsForColumns,setElementMobileHeight:a.setElementMobileHeight});else if(t.type==="carousel")Ef(t.settings,{activeElement:n,HTMLDocument:U,parseFromString:a.parseFromString,setElementBorderRadius:a.setElementBorderRadius,commit:F});else if(t.type==="accordion")Sf(t.settings,{activeElement:n,HTMLDocument:U,parseFromString:a.parseFromString,setElementBorderRadius:a.setElementBorderRadius,commit:F});else if(t.type==="social"){const b=kf(t.settings,{activeElement:n,parseFromString:a.parseFromString,commit:F});b&&(n=b)}else t.type==="customTable"&&Of(t.settings,{activeElement:n,activeCell:a.state.get("activeCell"),state:a.state,parseTableElementToModel:Nt,tableModelToHtml:Ce,updateTablePadding:Ga,updateBackgroundPosition:Ya,removeStyleProperty:rs,updateBorderRadius:ls,removeClassByPrefix:cs,getCellsWithClasses:Xa,updateTableCellBackgroundByIds:Za,addClassToCellsByIds:Ja,getExternalBorders:es,mergeUniCells:ds,updateCellBordersByIds:Qa,getExternalCorners:os,updateCellBorderRadiusByIds:ts,updateCellPaddingByIds:ns,removeOuterBorders:as,simplifyBorders:ss,wrapEditor:it,addNewRange:a.addNewRange,toggleTextStyle:gt,textStyleProperties:o,commit:F,setElementMobileWidth:a.setElementMobileWidth,setElementMobileHeight:a.setElementMobileHeight,setElementShow:a.setElementShow,setElementMobileBackgroundColor:a.setElementMobileBackgroundColor,setElementMobileBackgroundImage:a.setElementMobileBackgroundImage,setElementMobileBackgroundPositionX:a.setElementMobileBackgroundPositionX,setElementMobileBackgroundPositionY:a.setElementMobileBackgroundPositionY,setElementMobileBackgroundRepeat:a.setElementMobileBackgroundRepeat,setElementMobileBackgroundSize:a.setElementMobileBackgroundSize,setElementMobileBoxShadow:a.setElementMobileBoxShadow,setElementMobileBorder:a.setElementMobileBorder,setElementMobileBorderRadius:a.setElementMobileBorderRadius});try{a.emFilterCSS()}catch{}a.state.increment("activeElementLocked");const p=n;Wt().finally(()=>{const b=U.getMappedParent(n);if(b?.isConnected){const h=b,y=h.tagName.startsWith("AMP-"),E=y&&h===i&&s>=0,S=y?Array.from(h.querySelectorAll("section"),T=>T.hasAttribute("expanded")):[],v=ne.getOuterHtml(b),C=a.parseFromString(v)[0];b.parentNode?.replaceChild(C,b);const L=C,w=E?L.getElementsByTagName(l)[s]??null:null;if(w)w.setAttribute("em-edit","active"),n=w;else if(p?.tagName==="A"&&C.tagName!=="A"){const T=C.querySelector?.("a");T?(T.setAttribute("em-edit","active"),n=T):(C.setAttribute("em-edit","active"),n=C)}else C.setAttribute("em-edit","active"),n=C;Wt().finally(()=>{L.querySelectorAll("section").forEach((T,M)=>{S[M]&&T.setAttribute("expanded","")}),a.state.decrement("activeElementLocked"),be(n)})}else a.state.decrement("activeElementLocked"),be(n)})}catch{}finally{Promise.resolve().then(()=>a.state.decrement("activeElementLocked"))}}function ae(e){if(!a.state.isActiveElementLocked()){if(!e.elem){const o=document.querySelector("[em-edit]");o&&(e.elem=o)}try{a.state.increment("activeElementLocked"),a.removeAllAttributes("em-edit");let o={};if(e.elem){if(e.elem.closest?.(En))return;e.elem=Fp(e.elem,{getVariableByIcon:a.getVariableByIcon,htmlDocument:ne,findOutermostParentWithText:a.findOutermostParentWithText,sendResizeEvent:a.sendResizeEvent});const t=e.elem.tagName==="EDITOR"&&e.elem.firstChild?.nodeType===1?e.elem.firstChild:e.elem,{classNameOl:n,classNameUl:r,isListOL:i,isListUL:l,isList:s}=a.getListContext(e.elem),c=s?a.getListBullet(e.elem):null,d=!!e.elem.closest(".em-element-custom-table"),u=a.getLineHeightInPixels,g=E=>a.getFontFamilyFromElement(E,t),m=a.textHasStyle,f=(E,S=!1)=>Dp(S,{getSelectedText:a.getSelectedText,getRangeFromSelection:a.getRangeFromSelection});xp(e.elem,window.getSelection()?.isCollapsed??!0,!!e.elem.querySelector("editor"),{removeAllAttributes:a.removeAllAttributes}),o={operation:"application_element_settings_set",settings:{}};const p=qp({elem:e.elem,isCellCustomTable:d,listContext:{isListOL:i,isListUL:l,isList:s},requestElemBullet:c,variableElement:f},{...Hi,Locale:qt,isProgrammaticSelection:ft,getElementTdDiv:Ig,getLineHeghtInPixels:u,getFontFamilyFromElement:g,textHasStyle:m,activeCell:a.state.get("activeCell"),CLASS_FOR_BASIC_CELL:a.CLASS_FOR_BASIC_CELL,requestElemWithStyle:t}),b=$p(e.elem,window.getSelection()?.isCollapsed??!0,p);o.type=b.type,o.caption=b.caption,o.settings=b.settings;const h=Op(e.elem,b,o,{removeAllAttributes:a.removeAllAttributes});if(h.isProgrammaticSelectionReset&&(ft=!1),h.shouldReturn)return;const y=Hp({elem:e.elem,message:o,activateSection:e.activateSection},{getElementParentCaption:Jr,getStructureColumns:Pg,getUsedColors:qr,getElementPath:wm,getCurrentElementPath:Cm,ampService:_i,mapObj:bo,commonStyles:a.state.get("commonStyles")});o=y.message,a.state.update({elementPath:y.elementPath})}else{setTimeout(()=>{let t=document.querySelector("[em-edit]");if(t?.isConnected){ae({elem:t});return}const n={operation:"application_element_settings_set",settings:bo.unescape({parent:void 0,nextElem:!1,prevElem:!1}),type:null};JSON.stringify(n),a.messageService.send(n)},0);return}JSON.stringify(o),Ue=e.elem?U.getOuterHtml(e.elem):"",je=It(e.elem),a.messageService.send(o)}finally{Promise.resolve().then(()=>{const o=document.querySelector("[em-edit]");Ue=o?U.getOuterHtml(o):"",je=It(o),a.state.decrement("activeElementLocked")})}}}function xg(){document.addEventListener("keydown",m=>{document.body?.classList.contains("mceNonEditable")||a.state.get("lockEditor")||!m.target?.closest?.('[contenteditable="true"]')||!m.key||m.ctrlKey||m.altKey||m.metaKey||m.key.length===1&&(m.preventDefault(),m.stopImmediatePropagation(),document.execCommand("insertText",!1,m.key))},!0);const e=m=>{const f=m.target,p=f?.closest?.("a")||f?.querySelector?.("a");if(!p)return;const b=p.closest("td")||p.parentElement;b&&a.findRoundrectComment(b)&&F(!1).then(()=>{!b.isConnected||!p.isConnected||(p.closest("editor")||p.querySelector("editor")||b.querySelector("editor"))&&a.updateButtonVMLLabel(b,p.textContent||"")&&F(!1)})};document.addEventListener("input",e,!1),document.addEventListener("focusout",m=>{a.handleVMLButtonInput(m)&&F(!1)},!1),a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1,actualTargetCount:0,activeCell:[],lockEditorInit:!0,globalHolder:null,applicationTheme:"light",iframeOffsetTop:0,scrollTop:0,previewHeight:0,applicationMode:"default",emailWidth:0,lockEdit:!1,elementPath:[],copyPasteEnabled:!0,saveBlockEnabled:!0,editImageControlEnabled:!0,elementAIimageEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterEditorEnabled:!0,blocksAddPanelEnabled:!0,lockEditor:!0,codeMode:!0,appName:"",commonStyles:{},isProgrammaticSelection:!1});let o=a.state.get("activeElementLocked");a.state.subscribe(m=>{if(m.activeElementLocked!==void 0){const f=o,p=m.activeElementLocked;o=p,f>0&&p===0&&Promise.resolve().then(()=>{if(a.state.get("activeElementLocked")!==0)return;const b=document.querySelector("[em-edit]");Ue=b?U.getOuterHtml(b):"",je=It(b)})}"globalHolder"in m&&(ge=m.globalHolder),"isProgrammaticSelection"in m&&(ft=m.isProgrammaticSelection)}),a.implementPolyfills(),setTimeout(()=>{wi=!0},1e3),a.provideSandboxState(a.container);const t=a.provideAttributePipeline(a.container).pipeline,n=a.provideDocumentSync(a.container,rd,{prepareHtml:m=>a.emFilter({node:m,isPartial:!0}),lock:{increment:()=>a.state.increment("activeElementLocked"),decrement:()=>a.state.decrement("activeElementLocked")}});ne=n.htmlDocument,Xe=n.remoteDocument,bn=n.textDocument,rt=n.documentMapping,a.provideImageCache(a.container,{pipeline:t,htmlDocument:ne}),hn=a.provideEmVersion(a.container,{pipeline:t,htmlDocument:ne}).reload,n.onDocumentReplaced(()=>hn?.clear()),Yc(),yn=td({getGlobalHolder:()=>ge}),a.messageService.addListener(a.EVENT_TYPES.SANDBOX_IMAGE_RESET,({url:m})=>{m&&(a.container.getInstance(a.IMAGE_CACHE_ID)?.forget(m),hn?.reload(m))}),a.initDocuments({htmlDocument:ne,remoteDocument:Xe,textDocument:bn,documentMapping:rt}),F=m=>n.commit(m),Wt=m=>n.commitLockedAsync(m),go=a.provideFocus(a.container,{htmlDocument:ne,remoteDocument:Xe}),$e=go.controller,a.initFocusManager($e),a.attachFocusService(go),U=ne,id(),ad(),pd(ne,$e),gd(ne,$e),a.registerCrossDomainDD(),a.registerThemeVariablesService(ne),a.registerProjectFontsService(),Td(Xe,m=>{F(m)}),Sd(ne,rt,be),a.registerCorrectVariableSelectionService(),a.registerResizeWatch(ne,Xe),a.registerResetService(ne),Ld(ne,$e,Xe),a.registerExtensionScriptsService(ne),_i=a.provideAmp(a.container,ne).service,ho=a.registerLocalizationService(ne),wd({container:a.container,focusController:$e,features:Pd}),Sm(ho),qt=ho.localized,ho.onChangeLocale(({data:m})=>{qt=m}),ku({getLocale:()=>qt,commit:m=>F(m)}),a.initSandboxStyles({textDocument:bn,commit:m=>F(m)}),a.initResizableElements({getLocale:()=>qt,commit:m=>F(m),messageService:a.messageService}),ne.onChange(m=>{m.some(f=>f.added.length||f.characterDataChanged||f.reordered?.length||f.reparented?.length)&&a.initSortable(U)}),bo=a.createMapObj(rt),U.onChange(()=>{Mg()}),ne.onRefresh(Ni),U.onChange(m=>{for(const f of m)for(const p of f.removed)(p instanceof HTMLHeadElement||p instanceof HTMLLinkElement&&p.hasAttribute("em"))&&document.querySelector(".em-editor-wrapper")?.remove()});const r=new a.UpdateQueue;let i=0;U.onChange(m=>{for(const f of m)for(const p of f.added)r.add(p.parentElement?p.parentElement:p);i||(i=setTimeout(()=>{$e.whenEditorLostFocus(()=>{r.clear(),F(!1)}),i=0},1e3))}),U.onChange(a.createHandleChangesWithRemovedElementsOnly(ae)),U.onChange(()=>{if(a.state.get("activeElementLocked")>0)return;const m=document.querySelector("[em-edit]"),f=m?U.getOuterHtml(m):"",p=It(m);(Ue!==f||je!==p)&&(document.body&&!document.body.classList.contains("em-sandbox-discuss")?m?m.closest?.(En)||(Ue=f,je=p,ae({elem:m})):setTimeout(()=>{let h=document.querySelector("[em-edit]");if(h){const y=U.getOuterHtml(h),E=It(h);(Ue!==y||je!==E)&&(Ue=y,je=E,h.closest?.(En)||ae({elem:h}))}else Ue=f,je=p,ae({elem:null})},0):(Ue=f,je=p));const b=document.body;b&&((a.state.get("lockEdit")!==b.classList.contains("mceNonEditable")||a.state.get("lockEditor"))&&(a.state.get("lockEdit")||a.state.get("lockEditor")?b.classList.add("mceNonEditable"):b.classList.remove("mceNonEditable")),b.classList.toggle("em-sandbox-preview",a.state.get("previewPage")))}),gt=Eg({commit:F,addNewRange:a.addNewRange,refreshElementSettings:Cg,findElementWithSelectedText:a.findElementWithSelectedText,getParentElementOfSelection:a.getParentElementOfSelection$1,findOutermostParentWithText:a.findOutermostParentWithText,clearLinkTags:vn,addFontFamilyClass:Cn,getIsProgrammaticSelection:()=>ft,getCommonStyles:()=>a.state.get("commonStyles")}),it=a.createWrapEditor({removeHiddenClasses:a.removeHiddenClasses,checkIsInited:Tg,prepareEditorHTML:Ag,getVisibleText:a.getVisibleText,defaultVisibleTextMapFn:a.defaultVisibleTextMapFn,getTagNameForContainer:a.getTagNameForContainer,applyAttributesToTag:(m,f,p)=>a.applyAttributesToTag(m,f,p,a.rgbToHex),setCursorToElement:a.setCursorToElement,removeLastWord:a.removeLastWord,hasOnlyTextNodesDeep:a.hasOnlyTextNodesDeep,isRangeCoveringAllVisibleText:a.isRangeCoveringAllVisibleText,isEditorContentOnlyNbsp:a.isEditorContentOnlyNbsp$1,isClickAtEndOfEmReplace:a.isClickAtEndOfEmReplace,getOrCreateAfterSpan:a.getOrCreateAfterSpan,setCursorInsideSpan:a.setCursorInsideSpan,commit:F,createBeforeInputHandler:a.createBeforeInputHandler}),Hi={_isCarouselElement:Nm,_isAccordionElement:Mm,_isSocialBlockElement:zm,_isImageElement:Mn,_isLinkElement:Xm,_isButtonElement:Km,_isTableElement:Al,_isCustomTableElement:bu,_isAtomElement:yu,_isTdColumnGroup:au,_isTdStructure:su,_isEmptyTd:cu,_isTdCell:du,_isVindentTd:eu,_isVindentDiv:tu,_isFloatBlockElement:lu,_isDivTextElement:hl,_isInlineButtonElement:Zm,_extractTextSettings:Kt,_extractCarouselSettings:km,_extractAccordionSettings:Bm,_extractSocialSettings:Vm,_extractImgSettings:Yt,_extractButtonSettings:Ym,_extractLinkTextSettings:yl,_extractTableSettings:vl,_extractCustomTableSettings:hu,_extractAtomElementSettings:Cu,_extractProgrammaticElementSettings:vu,_extractTdColumnGroupSettings:uu,_extractTdStructureSettings:fu,_extractTdCellSettings:pu,_extractVindentSettings:ou,_extractFloatBlockSettings:iu,_extractDivContainerSettings:gu,_clearActiveEditElements:a.clearActiveEditElements,HTMLDocument:U,parseFromString:a.parseFromString,getParentElementOfSelection:a.getParentElementOfSelection$1,getSelectedText:a.getSelectedText,findElementWithSelectedText:a.findElementWithSelectedText,parseTableElementToModel:Nt,extractBorderRadius:is,parseBackgroundStyles:Ka,isElementHasBold:a.isElementHasBold$1},Uc(),Wc(ae),Bc(function(m){typeof be=="function"&&be(m)}),Mc(function(m){Ni(m)}),Rc(function(m){a.state.set("commonStyles",m)}),Pc(function(m){return Sn(m)}),Ic(function(m){return a.getVariableByIcon(m)}),Hc(function(m){return Fd(m)}),Oc({getOuterHtml:function(m){return a.getOuterHtml(m)}}),xc({increment:function(m){a.state.increment(m)},decrement:function(m){a.state.decrement(m)}}),Dc(function(m){a.setPercentsForColumns(m)}),Fc(function(){return a.getActiveEditElement()}),qc(function(m){return a.parseFromString(m)}),a.state.subscribe(m=>{const f={};"iframeOffsetTop"in m&&(f.iframeOffsetTop=m.iframeOffsetTop),"previewHeight"in m&&(f.previewHeight=m.previewHeight),"emailWidth"in m&&(f.emailWidth=m.emailWidth),"elementPath"in m&&(f.elementPath=m.elementPath),"lockEdit"in m&&(f.lockEdit=m.lockEdit),Object.keys(f).length>0&&zc(f)}),a.watchLockEditor(),a.messageService.addListener(function(m){if(m.data.operation=="update_position_from_editor"){let f=m.data.data;if(f){f=Xe.correctOffset(f,!0),f=rt.correctOffset(f,!0);let p=U.getElementByPosition(f);if(p&&!(p instanceof Element)&&(p=p.parentElement),p){const b=p.getBoundingClientRect(),h=document.querySelector("[em-edit]");p.tagName!=="BODY"&&b.height&&b.width&&h!==p&&ae({elem:p});let y=p,E={operation:"application_scroll-to",settings:{value:a.state.get("applicationMode")==="default"?y.getBoundingClientRect().top+a.state.get("iframeOffsetTop")-a.state.get("previewHeight")/2+y.getBoundingClientRect().height/2:y.getBoundingClientRect().top-a.state.get("previewHeight")/2+y.getBoundingClientRect().height/2}};a.messageService.send(E)}}}if(m.data.operation=="sandbox_email_settings_set"){let f=m.data;if(ge=Ai(),ge){const h=ge.classList.contains("full-wrap")?ge.querySelector("td"):ge;h&&a.setEmailBackgroundSettings(h,f.settings,jo())}f.settings.subject!==void 0&&(document.title=f.settings.subject);const p=og(f.settings,{globalHolder:ge,emailWidth:a.state.get("emailWidth"),state:a.state,findParentTr:a.findParentTr});dg(f.settings,ge),Vp(f.settings,{globalHolder:ge,commonStyles:a.state.get("commonStyles"),lockEditor:a.state.get("lockEditor"),removeClassesByPrefix:a.removeClassesByPrefix$1,createFontClassName:a.createFontClassName,addFontFamilyClass:Cn,clearLinkTags:vn,clearProjectFontFaces:Ri,rgbToHex:a.rgbToHex,setElementBorder:a.setElementBorder,setElementBorderRadius:a.setElementBorderRadius,setStructureBlocksWidth:Pi,messageService:a.messageService});const b=Object.keys(f.settings).filter(h=>f.settings[h]!==void 0);(p||!(b.length===1&&b[0]==="width"))&&Wt()}m.data.operation==="sandbox_element_settings_set"&&$e.whenEditorLostFocus(()=>Og(m)),(m?.data?.operation??m?.operation)==="sandbox_native-image-drop-clear"&&zn(),m.data.operation==="sandbox_window-characteristic"&&Kc(m.data.settings,m.data.mode,{state:a.state,previewHeight:a.state.get("previewHeight"),iframeOffsetTop:a.state.get("iframeOffsetTop"),scrollTop:a.state.get("scrollTop"),globalHolder:ge,setBlockGroupControlsPosition:yo,messageService:a.messageService}),m.data.operation=="sandbox_iframe-setsize"&&Lg(m.data.settings,{state:a.state,previewHeight:a.state.get("previewHeight"),iframeOffsetTop:a.state.get("iframeOffsetTop"),scrollTop:a.state.get("scrollTop"),globalHolder:ge,setBlockGroupControlsPosition:yo,messageService:a.messageService}),m.data.operation=="sandbox_atom-insert"&&Xu({action:m.data.action,atomHTML:m.data.settings?.atomHTML,name:m.data.settings?.name},{state:a.state,commit:F,lockEditor:a.state.get("lockEditor"),emailWidth:a.state.get("emailWidth"),iframeOffsetTop:a.state.get("iframeOffsetTop"),previewHeight:a.state.get("previewHeight"),parseFromString:a.parseFromString,getOuterHtml:a.getOuterHtml,HTMLDocument:U,minify:a.minifyStylesheet,cssbeautify,insertAdjacentHTML:a.insertAdjacentHTML,messageService:a.messageService,setDocumentStyles:f=>a.setDocumentStyles(f,{minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U}),setImageWidth:lt,commonStylesApply:Ze,commonStylesApplyToBlock:Je,insertCountdown:at,uptimeCountdown:$t,setBlockMaxWidth:bt,setFloatBlocksWidth:Ge,fitImagesToColumns:a.fitImagesToColumns,checkBlockAdaptivity:ht,setAtomReplaced:f=>{nt=f}}),m.data.operation=="sandbox_block-insert"&&Qu({action:m.data.action,blockHTML:m.data.settings?.blockHTML,type:m.data.settings?.type,project:m.data.settings?.project,name:m.data.settings?.name,blockId:m.data.settings?.blockId},{state:a.state,commit:F,lockEditor:a.state.get("lockEditor"),emailWidth:a.state.get("emailWidth"),iframeOffsetTop:a.state.get("iframeOffsetTop"),previewHeight:a.state.get("previewHeight"),parseFromString:a.parseFromString,getOuterHtml:a.getOuterHtml,HTMLDocument:U,minify:a.minifyStylesheet,cssbeautify,insertAdjacentHTML:a.insertAdjacentHTML,messageService:a.messageService,setDocumentStyles:f=>a.setDocumentStyles(f,{minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U}),setImageWidth:lt,commonStylesApply:Ze,commonStylesApplyToBlock:Je,insertCountdown:at,uptimeCountdown:$t,setBlockMaxWidth:bt,setFloatBlocksWidth:Ge,fitImagesToColumns:a.fitImagesToColumns,checkBlockAdaptivity:ht}),m.data.operation=="sandbox_global_block_replace"&&Ju({emBlockId:m.data.settings?.emBlockId,blockHTML:m.data.settings?.blockHTML,type:m.data.settings?.type,project:m.data.settings?.project,name:m.data.settings?.name},{state:a.state,commit:F,lockEditor:a.state.get("lockEditor"),emailWidth:a.state.get("emailWidth"),iframeOffsetTop:a.state.get("iframeOffsetTop"),previewHeight:a.state.get("previewHeight"),parseFromString:a.parseFromString,getOuterHtml:a.getOuterHtml,HTMLDocument:U,minify:a.minifyStylesheet,cssbeautify,insertAdjacentHTML:a.insertAdjacentHTML,messageService:a.messageService,setDocumentStyles:f=>a.setDocumentStyles(f,{minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U}),setImageWidth:lt,commonStylesApply:Ze,commonStylesApplyToBlock:Je,insertCountdown:at,uptimeCountdown:$t,setBlockMaxWidth:bt,setFloatBlocksWidth:Ge,fitImagesToColumns:a.fitImagesToColumns,checkBlockAdaptivity:ht})}),document.addEventListener("click",()=>{}),document.addEventListener("click",function(m){a.state.get("lockEditor")||tf(m,{lockEditor:a.state.get("lockEditor"),commit:F,atomDropCtx:{messageService:a.messageService,isJsonString:a.isJsonString,getOuterHtml:a.getOuterHtml,minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U,_setDocumentStyles:a.setDocumentStyles,commonStylesApply:Ze,commonStylesApplyToBlock:Je,setImageWidth:lt,setFloatBlocksWidth:Ge,fitImagesToColumns:a.fitImagesToColumns,insertCountdown:at,mutableState:{atomReplaced:nt}},blockDropCtx:{lockEditor:a.state.get("lockEditor"),state:a.state,commit:F,messageService:a.messageService,emailWidth:a.state.get("emailWidth"),parseFromString:a.parseFromString,getOuterHtml:a.getOuterHtml,isJsonString:a.isJsonString,isTableElement:a.isTableElement,insertAdjacentHTML:a.insertAdjacentHTML,minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U,commonStylesApplyToBlock:Je,commonStylesApply:Ze,uptimeCountdown:$t,setBlockMaxWidth:bt,setFloatBlocksWidth:Ge,checkBlockAdaptivity:ht,setImageWidth:lt,insertCountdown:at,_setDocumentStyles:a.setDocumentStyles,applicationElementSettingsSet:ae,mutableState:{atomReplaced:nt}}})},!0),document.onmouseover=bg({getVisibleNode:m=>U.getVisibleNode(m),isInExternal:m=>U.isInExternal(m),isVisible:m=>ne.isVisible(m),incrementActiveElementLocked:()=>a.state.increment("activeElementLocked"),decrementActiveElementLocked:()=>a.state.decrement("activeElementLocked"),getLockEditorInit:()=>a.state.get("lockEditorInit"),getIsLeftButtonDown:()=>po,getLoadStylesTimer:()=>wi,hasTextNodeInElement:a.hasTextNodeInElement,wrapEditor:vg,implementElementsEditors:Ng,implementResizableElems:Hg,commit:F}),document.onmouseleave=function(){Mi(),document.querySelectorAll('[em="group"] .em-element-editor, .em-element-path, .em-element-block-add').forEach(m=>{m.remove(),F(!1)})},document.addEventListener("mousedown",function(m){m.shiftKey||m.button===2||window.getSelection()?.removeAllRanges(),m.button===0&&(po=!0,a.state.set("isLeftButtonDown",!0))}),document.addEventListener("mouseup",function(m){m.button===0&&(po=!1,a.state.set("isLeftButtonDown",!1))}),document.addEventListener("dragend",function(m){m.button===0&&(po=!1,a.state.set("isLeftButtonDown",!1))});const l=()=>({parseFromString:a.parseFromString,HTMLDocument:U,commit:F,implementElementEditor:Bi,setCursorPosition:be,scrollTop:a.state.get("scrollTop")}),s=()=>({parseFromString:a.parseFromString,HTMLDocument:U,commit:F,implementElementEditor:Bi,setCursorPosition:be,scrollTop:a.state.get("scrollTop"),iframeOffsetTop:a.state.get("iframeOffsetTop"),applicationElementSettingsSet:ae});document.onclick=fg({getLockEditor:()=>a.state.get("lockEditor"),setEditorFocus:Sg,setCursorPosition:be,getParentElementOfSelection:a.getParentElementOfSelection$1,findOutermostParentWithText:a.findOutermostParentWithText,setBlockGroupControlsPosition:yo,applicationElementSettingsSet:ae,insertTextAtomIntoEmptyNarrowTable:_g,handleRemoveAtom:m=>a.handleRemoveAtom(m,{getElementParent:Sn,setCursorPosition:be,getVariableByIcon:a.getVariableByIcon,commit:F}),handleCloneAtom:m=>a.handleCloneAtom(m,l()),handleMoveBlockUp:m=>a.handleMoveBlockUp(m,l()),handleMoveBlockDown:m=>a.handleMoveBlockDown(m,l()),handleRemoveBlock:m=>a.handleRemoveBlock(m,l()),handleCloneBlock:m=>a.handleCloneBlock(m,l()),handleCopyBlock:(m,f)=>mg(m,f,{HTMLDocument:U}),handlePasteBlock:(m,f)=>ug(m,f,{HTMLDocument:U,parseFromString:a.parseFromString,getOuterHtml:a.getOuterHtml,minify:a.minifyStylesheet,cssbeautify,insertAdjacentHTML:a.insertAdjacentHTML,setBlockMaxWidth:bt,setFloatBlocksWidth:Ge,checkBlockAdaptivity:ht,commit:F,setCursorPosition:be,emailWidth:a.state.get("emailWidth"),appName:a.state.get("appName")}),handleMergeBlocks:m=>a.handleMergeBlocks(m,{...l(),emFilter:a.emFilter}),handleUnmergeBlocks:m=>a.handleUnmergeBlocks(m,l()),isAddBlockMenuClick:a.isAddBlockMenuClick,handleAddBlockMenu:(m,f)=>a.handleAddBlockMenu(m,f,{removeAllAttributes:a.removeAllAttributes,state:a.state,commitLockedAsync:Wt}),addBlockToProject:Rg,handleMoveGroupUp:m=>a.handleMoveGroupUp(m,s()),handleMoveGroupDown:m=>a.handleMoveGroupDown(m,s()),handleAddGroup:m=>a.handleAddGroup(m,s()),handleCloneGroup:m=>a.handleCloneGroup(m,s()),handleRemoveGroup:m=>a.handleRemoveGroup(m,s()),isDiscussViewMode:a.isDiscussViewMode,isDiscussSetTargetMode:a.isDiscussSetTargetMode,handleDiscussViewClick:a.handleDiscussViewClick,handleDiscussSetTargetClick:m=>a.handleDiscussSetTargetClick(m,{makeId:a.makeId,commit:F}),handleEmReplaceClick:(m,f)=>ws(m,f,{isClickAtEndOfEmReplace:a.isClickAtEndOfEmReplace,getOrCreateAfterSpan:a.getOrCreateAfterSpan,setCursorInsideSpan:a.setCursorInsideSpan,_wrapEditor:it,commit:F}),handleCustomTableClick:Ts}),document.addEventListener("mouseup",()=>{}),window.addEventListener("mousemove",function(){a.state.set("lockEditorInit",!1)}),document.addEventListener("keydown",hg({getCursorPositionType:a.getCursorPositionType,getListContext:a.getListContext,LIST_TEMP_CLASSES:a.LIST_TEMP_CLASSES,LIST_REGEX:a.LIST_REGEX,collectVMLContent:Mo,updateVMLComments:Ro,handleVMLButtonText:a.handleVMLButtonText,handleDeleteKey:a.handleDeleteKey,handleEnterForBr:a.handleEnterForBr,handleEnterInList:ua,handleArrowRightInList:ba,handleArrowUpDownInList:ga,handleDeleteInList:ha,handlePreventBulletCellEdit:ya,handleArrowRight:a.handleArrowRight,getElementParent:Sn,setCursorPosition:be,removeElementEditors:Mi,getVariableByIcon:a.getVariableByIcon,removeEmptyParents:a.removeEmptyParents,getAllComments:a.getAllComments,isVariableComment:a.isVariableComment,getVariableIcon:a.getVariableIcon,removeAllAttributes:a.removeAllAttributes,applicationElementSettingsSet:ae,removeTemporaryListClasses:a.removeTemporaryListClasses,findNodeAtPosition:am,setCursorSafely:sm,isCaretAtEndOfEmReplace:a.isCaretAtEndOfEmReplace,getOrCreateAfterSpan:a.getOrCreateAfterSpan,setCursorInsideSpan:a.setCursorInsideSpan,isCaretAtEndOfStandardElement:a.isCaretAtEndOfStandardElement,setCursorPositionSimple:a.setCursorPositionSimple,handlePasteTextFragment:zr,changeMsoValue:Ii,getCommonStyles:()=>a.state.get("commonStyles"),setIsPasteFromContextMenu:m=>{gn=m},wrapEditor:it,messageService:a.messageService,commit:F}),!1),ne.beforeCommit(()=>{try{pn||(pn=!0,a.emFilterCSS())}finally{pn=!1}}),document.addEventListener("click",m=>{m.target?.closest(".em-element-editor-widget-clone")||(document.querySelectorAll('.em-element-editor-widget-clone[data-open="true"]').forEach(f=>{f.setAttribute("data-open","false"),f.querySelector("ul").style.display="none"}),Bg())}),document.addEventListener("drag",function(m){m.preventDefault()},!1);const c={targetBlock:pt,atomReplaced:nt};document.addEventListener("dragstart",function(m){Jd(m,{lockEditor:a.state.get("lockEditor")})},!0),document.addEventListener("dragstart",function(m){ea(m,{lockEditor:a.state.get("lockEditor"),commit:F,messageService:a.messageService,mutableState:c}),nt=c.atomReplaced},!1);const d={targetBlock:pt};document.addEventListener("dragover",function(m){oa(m,{lockEditor:a.state.get("lockEditor"),mutableState:d}),pt=d.targetBlock},!1);const u={targetBlock:pt};document.addEventListener("dragenter",function(m){na(m,{lockEditor:a.state.get("lockEditor"),mutableState:u}),pt=u.targetBlock},!1);const g={targetBlock:pt,newTargetblock:ki};document.addEventListener("dragleave",function(m){ra(m,{lockEditor:a.state.get("lockEditor"),mutableState:g}),ki=g.newTargetblock},!1),document.addEventListener("drop",function(m){if(!a.state.get("lockEditor"))try{if(m.preventDefault(),m.stopPropagation(),Ql(m,{lockEditor:a.state.get("lockEditor"),applicationElementSettingsSet:ae,messageService:a.messageService})||Qd(m,{applicationElementSettingsSet:ae}))return a.state.increment("activeElementLocked"),Qt(),F(),!1;if(a.state.increment("activeElementLocked"),document.body.classList.contains("em-block-insert-body"))try{const f=JSON.parse(m.dataTransfer?.getData("Text")||"{}");Vn(m,f,{lockEditor:a.state.get("lockEditor"),state:a.state,commit:F,messageService:a.messageService,emailWidth:a.state.get("emailWidth"),parseFromString:a.parseFromString,getOuterHtml:a.getOuterHtml,isJsonString:a.isJsonString,isTableElement:a.isTableElement,insertAdjacentHTML:a.insertAdjacentHTML,minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U,commonStylesApplyToBlock:Je,commonStylesApply:Ze,uptimeCountdown:$t,setBlockMaxWidth:bt,setFloatBlocksWidth:Ge,checkBlockAdaptivity:ht,setImageWidth:lt,insertCountdown:at,_setDocumentStyles:a.setDocumentStyles,applicationElementSettingsSet:ae,mutableState:{atomReplaced:nt}})}catch{}else if(document.body.classList.contains("em-atom-insert-body")||document.body.classList.contains("em-atom-insert-body-inside"))try{jn(m,{messageService:a.messageService,isJsonString:a.isJsonString,getOuterHtml:a.getOuterHtml,minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U,_setDocumentStyles:a.setDocumentStyles,commonStylesApply:Ze,commonStylesApplyToBlock:Je,setImageWidth:lt,setFloatBlocksWidth:Ge,fitImagesToColumns:a.fitImagesToColumns,insertCountdown:at,mutableState:{atomReplaced:nt}})}catch{}return Qt(),F(),!1}finally{Promise.resolve().then(()=>{a.state.decrement("activeElementLocked");const f=document.querySelector(".em-just-inserted");if(f){ae({elem:f}),f.classList.remove("em-just-inserted"),F();const p=Nn(f);setTimeout(()=>{a.messageService.send({operation:"application_open-image-ai-popup",src:p})},1e3)}})}},!1),document.addEventListener("dragend",function(m){ta(m,{lockEditor:a.state.get("lockEditor"),messageService:a.messageService})},!1),a.initResizer({applicationElementSettingsSet:m=>ae(m),setCursorPosition:m=>be(m),commit:m=>F(m)}),document.addEventListener("contextmenu",m=>{gn=!!m.target?.nodeName}),document.addEventListener("paste",m=>{gn&&zr(m,!1,a.state.get("commonStyles"),Ii,F)}),document.addEventListener("click",()=>a.messageService.send({operation:"application_focus_in_iframe"}))}var Dg="__emmDiagnostics__",Fg="diagnostics";function qg(){try{const e=new URLSearchParams(window.location.search).get(Fg);return e!==null&&e!=="0"}catch{return!1}}function An(e){try{window.parent.postMessage({mark:Dg,...e},"*")}catch{}}function Wg(){const e=window.performance.getEntriesByType("resource").map(o=>{const t=o;return{name:t.name,initiatorType:t.initiatorType,startTime:t.startTime,responseEnd:t.responseEnd,transferSize:t.transferSize,decodedBodySize:t.decodedBodySize}});An({type:"resources",timeOrigin:window.performance.timeOrigin,items:e})}function yt(){return window.performance.timeOrigin+window.performance.now()}function $g(){return Array.from(document.images).every(e=>e.complete)}function zg(e,o){const n=window.setInterval(()=>{!$g()||yt()-e()<500||(window.clearInterval(n),An({type:"settled",at:Math.max(e(),o)}),Wg())},100)}function Vg(){if(!qg()||typeof MutationObserver!="function")return;let e=!1,o=yt();new MutationObserver(()=>{o=yt(),!e&&(e=!0,window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const t=yt();An({type:"paint",at:t}),zg(()=>o,t)})}))}).observe(document.documentElement,{childList:!0,subtree:!0,characterData:!0}),window.addEventListener("load",()=>{o=yt()}),document.addEventListener("load",()=>{o=yt()},!0)}var Ug=500,jg=300,zt,Eo=!1;function Oi(){if(Eo)return;Eo=!0;let e=!1;const o=window.setTimeout(()=>{e||(e=!0,zt=!1,Eo=!1)},jg);window.requestAnimationFrame(()=>{e||(e=!0,window.clearTimeout(o),zt=!0,Eo=!1)})}function Gg(){return zt===!1?(Oi(),Promise.resolve()):new Promise(e=>{let o=!1;const t=()=>{o||(o=!0,e())},n=window.setTimeout(()=>{zt=!1,t()},Ug);window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{window.clearTimeout(n),zt=!0,t()})})})}var Yg=1;function Kg(){Oi();const e=async(o,t)=>{await t?.(o),await Gg()};a.messageService.addListenerAsync(a.EVENT_TYPES.SANDBOX_INITED,e,Yg)}var Xg=16,xi=100,Zg=.95,Di=.02;function Fi(e,o){return o===WheelEvent.DOM_DELTA_LINE?e*Xg:o===WheelEvent.DOM_DELTA_PAGE?e*window.innerHeight:e}function qi(e,o,t){if(t===0)return!1;const n=getComputedStyle(e),r=o==="y"?n.overflowY:n.overflowX;if(r!=="auto"&&r!=="scroll"&&r!=="overlay")return!1;const i=o==="y"?e.scrollTop:Math.abs(e.scrollLeft),l=o==="y"?e.scrollHeight-e.clientHeight:e.scrollWidth-e.clientWidth;return l<=0?!1:(o==="x"&&e.scrollLeft<0?-t:t)>0?i<l-.5:i>.5}function Wi(e,o,t){const n=document.scrollingElement??document.documentElement;for(let r=e instanceof Element?e:null;r;r=r.parentElement){if(r===n||r===document.body)return!1;if(qi(r,"y",t)||qi(r,"x",o))return!0}return!1}function Jg(){let e=0,o=0,t=!1;const n=()=>{t=!1;const g=e,m=o;e=0,o=0,!(g===0&&m===0)&&a.messageService.send(a.EVENT_TYPES.SANDBOX_WHEEL,{deltaX:g,deltaY:m})},r=(g,m)=>{e+=g,o+=m,t||(t=!0,window.requestAnimationFrame(n))};window.addEventListener("wheel",g=>{g.ctrlKey||Wi(g.target,g.deltaX,g.deltaY)||(g.preventDefault(),r(Fi(g.deltaX,g.deltaMode),Fi(g.deltaY,g.deltaMode)))},{passive:!1});let i,l=!1,s={x:0,y:0},c;const d=()=>{c!==void 0&&(window.cancelAnimationFrame(c),c=void 0)},u=()=>{let{x:g,y:m}=s,f=performance.now();const p=b=>{const h=b>f?Math.min(b-f,50):16;f=b;const y=Math.pow(Zg,h/16);if(g*=y,m*=y,Math.abs(g)<Di&&Math.abs(m)<Di){c=void 0;return}r(g*h,m*h),c=window.requestAnimationFrame(p)};c=window.requestAnimationFrame(p)};window.addEventListener("touchstart",g=>{d(),l=!1,s={x:0,y:0};const m=g.touches.length===1?g.touches[0]:void 0;i=m?{x:m.screenX,y:m.screenY,at:g.timeStamp}:void 0},{passive:!0}),window.addEventListener("touchmove",g=>{const m=g.touches.length===1?g.touches[0]:void 0;if(!m||!i){i=void 0,l=!1;return}const f=i.x-m.screenX,p=i.y-m.screenY,b=g.timeStamp-i.at;if(i={x:m.screenX,y:m.screenY,at:g.timeStamp},!Wi(g.target,f,p)){if(g.cancelable&&g.preventDefault(),l=!0,b>0){const h=Math.min(b/xi,1);s={x:s.x*(1-h)+f/b*h,y:s.y*(1-h)+p/b*h}}r(f,p)}},{passive:!1}),window.addEventListener("touchend",g=>{const m=i?g.timeStamp-i.at:1/0;l&&g.touches.length===0&&m<xi&&u(),i=void 0,l=!1},{passive:!0}),window.addEventListener("touchcancel",()=>{i=void 0,l=!1})}Vg(),xg(),Kg(),Jg()});
|
|
319
|
+
`);const l=e.querySelector('[em="block"]:last-child [em="atom"]');if(l){const s=l.querySelector("div");let c=null;s&&(s.innerHTML="",s.appendChild(document.createTextNode("")),o.wrapEditor(s,!0),s.classList.add("em-just-inserted"),setTimeout(()=>{const d=s.closest("editor")||s,u=d?.querySelector("div")||s,g=u||d||s,m=g.getBoundingClientRect();["mouseover","mousedown","mouseup","click"].forEach(b=>{g.dispatchEvent(new MouseEvent(b,{bubbles:!0,cancelable:!0,view:window,clientX:m.left+Math.min(1,Math.max(0,m.width/2)),clientY:m.top+Math.min(1,Math.max(0,m.height/2)),button:0}))});let f=u.firstChild;f||(f=document.createTextNode(""),u.appendChild(f)),d?.focus?.();const p=window.getSelection();if(p&&f){const b=document.createRange();b.setStart(f,0),b.collapse(!0),p.removeAllRanges(),p.addRange(b)}o.setCursorPosition(d||s)},0),c=s.closest("editor")||s),s&&o.setCursorPosition(c||s)}return o.messageService.send("application_atom_inserted","text"),o.commit(),!0}function bg(e){return function(t){let n=t.target;try{n=e.getVisibleNode(n);const r=e.isInExternal(n);e.incrementActiveElementLocked();const i=document.body;if(i?.classList.contains("mceNonEditable")&&!i.classList.contains("em-sandbox-discuss")||i?.classList.contains("em-sandbox-discuss")&&!i.classList.contains("em-sandbox-discuss_set-target"))return;if(i?.classList.contains("em-sandbox-discuss_set-target")){document.querySelectorAll('[em-hover="true"]').forEach(u=>{u.removeAttribute("em-hover"),u.removeAttribute("contenteditable")}),n.closest(".em-element-vindent")||(n.setAttribute("em-hover","true"),n.setAttribute("contenteditable","true"));return}if(n.tagName!=="BODY"){const u=n.parentElement;a.unwrapForeignEditors(n)&&!n.isConnected&&u&&(n=u)}if(n&&(n?.closest('[em="atom"]')||!r)&&n.getAttribute("contenteditable")!=="false"&&n.parentElement?.getAttribute("contenteditable")!=="false"&&n.tagName!=="BODY"&&n.parentElement?.tagName!=="SECTION"){const u=!n.closest("editor"),g=!e.getLockEditorInit(),m=n.tagName!=="IMG",f=!(n.childElementCount===1&&n.firstElementChild?.tagName==="IMG"&&(n.textContent?.trim()??"")==="");if(u&&g&&m&&f){let p=n;do if(p=p.closest("div, p, h1, h2, h3, h4, h5")||p.closest("span, b, strong, i, em, s, a, sup, sub"),p)if(!e.isVisible(p))p=p.parentElement;else break;while(p);if(n.tagName==="LI"&&n.style.fontFamily&&n.style.fontSize){const b=n.closest("ul, ol");b&&e.wrapEditor(b,!0)}else if(n.tagName==="TD"&&n.style.fontFamily&&n.style.fontSize&&!n.querySelector("editor"))e.wrapEditor(n);else if(p&&p.style.fontFamily&&p.style.fontSize&&(n.tagName==="LI"||!n.querySelector("img")))if(n.tagName==="LI"){const b=n.closest("ul, ol");b&&e.wrapEditor(b,!0)}else n.querySelector("img")||e.wrapEditor(n,!0);else if(p&&p.closest('[style*="font-family"][style*="font-size"]')){const b=p.closest('[style*="font-family"][style*="font-size"]');b&&b.tagName!=="BODY"&&b.tagName!=="TD"&&b.tagName!=="TABLE"?e.wrapEditor(b,!1):b?.tagName==="TD"&&!b.querySelector("editor")&&!b.closest(".em-element-custom-table")&&e.wrapEditor(b)}else if(p&&p?.tagName==="DIV"&&!p.querySelector("table")){const b=!!p.style.height?.length,h=p.className.includes("em-element-img-change-group"),y=p.querySelector("img")?.parentNode,E=!!p.querySelector("img")&&y&&!e.hasTextNodeInElement(y);!b&&!h&&!E&&e.wrapEditor(p,!0)}else for(let b=0;b<n.childNodes.length;b++){const h=n.childNodes[b];if(h.nodeName==="#text"&&(h.textContent?.trim().length??0)>0&&!n.querySelector("table")){const y=n.tagName==="P"?n.parentElement:n;y&&e.wrapEditor(y);break}}}}(n?.closest('[em="atom"]')||!r)&&!e.getIsLeftButtonDown()&&e.implementElementsEditors(n),n?.classList.contains("em-element-vindent-bg")&&(n=n.closest(".em-vindent")),n?.closest(".em-gap")?n.closest("tr")?.querySelectorAll(".em-mob-wrap:nth-child(even) .em-gap").forEach(u=>u.classList.add("em-hover")):e.getIsLeftButtonDown()||document.querySelectorAll(".em-gap").forEach(u=>u.classList.remove("em-hover"));const l=e.getLoadStylesTimer(),s=!!n.style.padding||!!n.style.paddingTop||!!n.style.paddingBottom||!!n.style.paddingLeft||!!n.style.paddingRight,c=n.closest('[em="block"]'),d=!!c?.querySelector(".em-mob-wrap, .noresp-em-mob-wrap")&&(c?.querySelectorAll(".em-mob-wrap, .noresp-em-mob-wrap").length??0)>2;l&&(n.tagName==="TD"&&(n.innerHTML===""||n.querySelector(".em-element-vindent"))&&n.getAttribute("height")||n.tagName==="DIV"&&n.style.height&&n.style.fontSize||n.tagName==="IMG"||s||d)&&e.implementResizableElems(n)}catch{}finally{Promise.resolve().then(()=>e.decrementActiveElementLocked())}}}function hg(e){return function(t){const n=window.getSelection(),r=(n?.rangeCount?n.getRangeAt(0):null)?.commonAncestorContainer,i=r?.nodeType===1?r:r?.parentElement,l=i?.closest("editor"),s=window.navigator.platform.match("Mac"),c=l?e.getCursorPositionType(l):null,d=l?.closest("tr")?.querySelector("tr td:nth-of-type(2) div"),u=t.target,g=e.getListContext(u),{isList:m}=g,f=d?.textContent===l?.textContent,p=l?e.LIST_REGEX.EMPTY_TEXT.test(l.textContent||""):!1,b=s?t.metaKey:t.ctrlKey;if(b&&t.keyCode===83){t.preventDefault(),e.messageService.send({operation:"application_action",action:"save_email"});return}if(b&&t.keyCode===90){t.preventDefault(),e.messageService.send({operation:"application_action",action:t.shiftKey?"redo":"undo"});return}if(b&&t.keyCode===89&&!t.shiftKey){t.preventDefault(),e.messageService.send({operation:"application_action",action:"redo"});return}if(t.altKey&&t.keyCode===88){t.preventDefault(),e.messageService.send({operation:"application_action",action:"toggle_editor"});return}const h={getElementParent:e.getElementParent,setCursorPosition:e.setCursorPosition,removeElementEditors:e.removeElementEditors,getVariableByIcon:e.getVariableByIcon,removeEmptyParents:e.removeEmptyParents,getAllComments:e.getAllComments,isVariableComment:e.isVariableComment,getVariableIcon:e.getVariableIcon,commit:e.commit,messageService:e.messageService};if(e.handleDeleteKey(t,m,c,h))return;if(t.keyCode===27){const C=document.querySelector(".em-editor-wrapper");C?.style&&(C.style.display="none"),e.removeAllAttributes("em-edit"),document.querySelectorAll("editor").forEach(L=>L.blur()),n?.removeAllRanges(),e.applicationElementSettingsSet({elem:null}),e.messageService.send({operation:"application_close-image-edit-popup"});return}b&&t.keyCode===66&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"toggle_strong"}));const y=s?t.keyCode===88:t.keyCode===53;if((s?t.metaKey:t.altKey)&&t.shiftKey&&y&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"toggle_strikethrough"})),b&&t.shiftKey&&t.keyCode===76&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"textAlign_left"})),b&&t.shiftKey&&t.keyCode===82&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"textAlign_right"})),b&&t.shiftKey&&t.keyCode===69&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"textAlign_center"})),b&&t.keyCode===73&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"toggle_italic"})),b&&t.keyCode===85&&(t.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"toggle_underline"})),wa(t,{commit:e.commit})||e.handleEnterForBr(t,l,m,f,{commit:e.commit}))return;if(b&&t.keyCode===86){e.setIsPasteFromContextMenu(!1);const C=L=>{e.handlePasteTextFragment(L,!1,e.getCommonStyles(),e.changeMsoValue,e.commit),document.removeEventListener("paste",C)};document.addEventListener("paste",C)}else e.changeMsoValue(t);const E={activeElem:l,listContext:g,cursorPositionType:c,isTargetCell:f,isEmptyText:p,commit:e.commit,wrapEditor:e.wrapEditor,removeTemporaryListClasses:e.removeTemporaryListClasses};if(e.handleEnterInList(t,E)||(e.handleArrowRightInList(t,c,p),e.handleArrowUpDownInList(t,E)))return;const S={...E,parentElement:i,findNodeAtPosition:e.findNodeAtPosition,setCursorSafely:e.setCursorSafely};if(e.handleDeleteInList(t,S)||e.handlePreventBulletCellEdit(t,m,f))return;const v={isCaretAtEndOfEmReplace:e.isCaretAtEndOfEmReplace,getOrCreateAfterSpan:e.getOrCreateAfterSpan,setCursorInsideSpan:e.setCursorInsideSpan,isCaretAtEndOfStandardElement:e.isCaretAtEndOfStandardElement,setCursorPositionSimple:e.setCursorPositionSimple,wrapEditor:e.wrapEditor,commit:e.commit};e.handleArrowRight(t,v)&&e.commit()}}var yg=new Set(["textStrong","textItalic","textStrikethrough","textUnderline","textLink","textColor","textBackgroundColor"]);function Eg(e){const{commit:o,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,findOutermostParentWithText:l,clearLinkTags:s,addFontFamilyClass:c,getIsProgrammaticSelection:d,getCommonStyles:u}=e;function g(E,S,v){const C=!!E&&!!S&&S.tagName==="DIV"&&E.tagName==="EDITOR"&&E.parentElement===S&&S.childElementCount===1&&S.firstElementChild===E&&!Array.from(S.childNodes).some(R=>R!==E&&R.nodeType===Node.TEXT_NODE&&!!R.textContent?.trim()),L=!!E&&E.childElementCount===0&&Array.from(E.childNodes).some(R=>R.nodeType===Node.TEXT_NODE&&!!R.textContent?.trim()),w=!!E&&oe(E).trim()===v.trim();if(!C||!L||!w||!E.hasAttribute("em-edit")||!S.parentNode)return;const T=S.parentNode,M=E.getAttribute("em-edit")||"active";for(;E.firstChild;)S.appendChild(E.firstChild);E.remove(),E.removeAttribute("em-edit"),S.setAttribute("em-edit",M),T.replaceChild(E,S),E.appendChild(S)}function m(E,S){try{return S.intersectsNode(E)}catch{const v=document.createRange();return v.selectNodeContents(E),S.compareBoundaryPoints(Range.END_TO_START,v)<0&&S.compareBoundaryPoints(Range.START_TO_END,v)>0}}function f(E){const S=E?.links||{},v=S.underline,C=S.color,L=typeof v=="boolean"?v?"underline":"none":"underline";return{color:typeof C=="string"&&C.trim()?C.trim():"inherit",textDecoration:L}}function p(E,S){if(!E||!S)return null;const v=S,C=Array.from(v.querySelectorAll("a"));v.tagName==="A"&&C.unshift(v);const L=typeof window<"u"&&window.Range?window.Range.START_TO_START:0,w=typeof window<"u"&&window.Range?window.Range.END_TO_END:2;for(const T of C){const M=document.createRange();M.selectNodeContents(T);const R=M.compareBoundaryPoints(L,E)<=0,j=M.compareBoundaryPoints(w,E)>=0;if(R&&j)return T}return null}function b(E,S,v){const C=Array.from(S?.getElementsByTagName("span")||[]).reverse();let L=!1;oe(S)===E&&C.length&&(L=!0),C.forEach(w=>{const T=w.getAttribute("style"),M=!!T&&T.trim().length>0;let R=Array.from(w.attributes).filter(Q=>Q.name!=="style");if(!M&&R.length===1&&R[0].name==="em-edit"&&w.parentElement&&!w.parentElement.hasAttribute("em-edit")){const Q=w.getAttribute("em-edit")||"active";w.parentElement.setAttribute("em-edit",Q),w.removeAttribute("em-edit"),R=Array.from(w.attributes).filter(k=>k.name!=="style")}const j=R.length>0;if(!M&&!j){const Q=oe(w);if(w.childNodes.length===1&&w.childNodes[0].nodeType===3){const k=w.childNodes[0];w.parentNode?.replaceChild(k,w),v.isEditorTagOutside&&oe(S)!==E&&k.parentNode&&(v.range?.selectNode(k),t(v.range))}else{const k=Array.from(w.childNodes);k.forEach(K=>{w.parentNode?.insertBefore(K,w)}),E===Q&&(v.range=document.createRange(),v.range.setStartBefore(k[0]),v.range.setEndAfter(k[k.length-1]),t(v.range)),w.parentNode?.removeChild(w)}}}),L&&(n(S,E),v.range.selectNode(S),t(v.range))}function h(E,S){if(E?.rangeCount>0){const v=E.getRangeAt(0),C=v.commonAncestorContainer;let L=v.startOffset,w=v.endOffset;for(;C.data&&L>0&&!/\s/.test(C.data[L-1]);)L--;for(;C.data&&w<C.length&&!/\s/.test(C.data[w]);)w++;S.setStart(C,L),S.setEnd(C,w),t(S)}}function y(E,S,v){E.innerHTML=E.innerHTML.replaceAll(/<\/?strike[^>]*>/gi,""),E.parentNode&&(v.selectNode(E),t(v),n(E,S))}return function(S,v){const C=Zf(v.settings,a.rgbToHex),L=v.settings.textColor??v.settings.textBackgroundColor;if(typeof L=="string"&&L.trim()!==""&&!a.rgbToHex(L))return!1;const w=a.getListContext(S),{classNameOl:T,classNameUl:M,classNameBullet:R,isListOL:j,isListUL:Q,isList:k}=w;k&&w.tableElement?.querySelectorAll("tbody > tr > td:first-child")?.forEach(N=>{const Y=N.querySelector(":scope > div")||N.querySelector(":scope > editor div");Y&&Y.classList.add(`${R}`)}),S?.querySelectorAll(".em-element-path").forEach(N=>N.remove());const K=Object.keys(v.settings)[0];let P=window.getSelection();if(!P||P.rangeCount===0){if(!S||!S.isConnected)return;const N=document.createRange();if(N.selectNodeContents(S),P=window.getSelection(),!P)return;P.removeAllRanges(),P.addRange(N)}let I=P.getRangeAt(0);const D=I.commonAncestorContainer;let O=D.nodeType===1?D:D.parentElement,Z=P.anchorNode?.nodeType===1?P.anchorNode:P.anchorNode?.parentElement,ee=!1,q=a.getSelectedText();if(S||(S=P.anchorNode?.childNodes.length===1&&P.anchorNode.firstChild?.nodeType===1?P.anchorNode.firstChild:O,S.tagName==="EDITOR"&&(S=S.parentElement)),C.name==="textLink"&&C.value===""){const N=O?.closest?.("a, [href]")||null;N&&(I.selectNode(N),t(I),S=N)}if(C.name==="textUnderline"&&!C.value){let N=O.closest(["u","strike","[style*=text-decoration]","span","a"].find(Y=>O?.closest(Y))||"u");!N&&S?.tagName==="A"&&(N=S),N?.tagName==="A"&&(N.style.textDecoration="none",n(N,q),I.selectNode(N),t(I),S=N,ee=!0)}let B=v.type==="button"?(S||Z)?.closest("a"):(S||Z)?.closest("a, div, p, td, h1, h2, h3, h4, h5, h6, li, ul, ol, sup, sub");const ue=v.settings.fontFamily;let $=null;const ie=Array.from(B?.classList||[]).some(N=>(N.startsWith("em-font-")&&($=N),N.startsWith("em-font-")&&N.includes(C.name==="textItalic"?"Italic":"Bold")));ie&&(C.name==="textItalic"||C.name==="textStrong")&&$&&B?.classList.remove($);const G={range:I,isEditorTagOutside:!1},re=(N=a.getSelectedText(),Y=B)=>{b(N,Y,G)},we=a.checkForWorkClass,ke=a.checkForTextNodes,So=(N,Y)=>{y(N,q,G.range)};let Pe,fe;K==="textColor"?Pe=fe="color":K==="textBackgroundColor"&&(Pe="backgroundColor",fe="background-color");const Ae=v.settings.hasOwnProperty("textColor")||v.settings.hasOwnProperty("textBackgroundColor"),se=!!O?.closest("editor")||oe(O)===q||oe(O.querySelector("editor"))===q;G.isEditorTagOutside=se,v.settings.hasOwnProperty("textColor")&&C.value&&document.execCommand("styleWithCSS",!1,"true");const Ie=a.setCustomColor,Ye=d(),_e=u();if(ap({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex})||sp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,fontFamilyArray:ue,removeClassesByPrefix:a.removeClassesByPrefix$1,createFontClassName:a.createFontClassName,clearLinkTags:s,addFontFamilyClass:c,cleanEmptySpans:re}))return!1;const he=O.closest(C.tags.find(N=>O?.closest(N))||"span");(I?.collapsed||!a.getSelectedText())&&(C.value?C.value&&se&&(v.type==="button"||S.tagName==="A"&&he?I.selectNodeContents(he):h(P,I)):he&&I.selectNodeContents(he)),(v.type==="button"||S.tagName==="A"||S?.closest("a"))&&a.getSelectedText()&&a.getSelectedText()!==oe(S)&&he&&(v.settings.hasOwnProperty("textLink")||v.settings.hasOwnProperty("textUnderline"))&&(I.selectNode(he),t(I),v.settings.hasOwnProperty("textUnderline")&&S.tagName==="A"&&(S.style.textDecoration=C.value?"underline":"none",ee=!0)),P=window.getSelection(),I=P.getRangeAt(0),G.range=I,q=a.getSelectedText(),Array.from(B?.querySelectorAll("span,div")||[]).reverse().forEach(N=>{N.getAttribute("style")===""&&N.removeAttribute("style"),N.hasAttribute("contenteditable")&&N.removeAttribute("contenteditable"),N.hasAttribute("em-edit")&&N.removeAttribute("em-edit"),N.hasAttribute("em-relative")&&N.removeAttribute("em-relative"),N.hasAttribute("class")&&(N.classList.remove("em-relative"),N.classList.length===0&&N.removeAttribute("class"))});let Co=null;Ae&&fe&&B?.style?.getPropertyValue?.(fe)?.trim()&&(oe(B)===q&&(B.style[Pe]=a.rgbToHex(C.value?.toString())||"",ee=!0),Pe==="color"&&(O===B||S?.closest('[style*="color"]')===B)&&(Co=a.rgbToHex(B.style[fe]),B.style.removeProperty(fe),!B?.hasAttribute("em-edit")&&k&&B&&Ye&&B.closest("tr")?.querySelector(`.${R}`)?.style.removeProperty(fe)));let Vt=null,Ke=null;if(Ae&&Pe==="color"&&B?.tagName==="A"){let N=B.parentElement;for(;N&&!["BODY","HTML","TD","TH"].includes(N.tagName);){const Y=N.style.getPropertyValue("color")?.trim();if(Y){Vt=a.rgbToHex(Y)||Y,Ke=N,N.style.removeProperty("color");break}N=N.parentElement}}fe&&!(C.value.length===7||C.value.length===4)&&(ee=!0),se&&(!C.value&&C.name!=="fontSize"&&C.name!=="textLink"||C.value)&&(!(C.name==="textUnderline"||C.name==="textStrikethrough")||v.type!=="button")&&!ee&&(C.name!=="fontSize"&&!Ae&&oe(B)===q?document.execCommand(C.command,!1,Ae?C.value:C.name==="textLink"?" ":void 0):oe(B)!==q&&(v.settings.hasOwnProperty("textColor")&&document.execCommand("styleWithCSS",!1,"true"),document.execCommand(C.command,!1,Ae?String(C.value):C.name==="textLink"?" ":void 0),v.settings.hasOwnProperty("textColor")&&C.value&&ip(B||O,String(C.value),a.rgbToHex))),q=a.getSelectedText();{const N={parentElement:O,parentNode:Z,parentWrapper:B,selection:P,range:I};mp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,activeElement:S,hasItalicClass:ie,tempStyleClass:$,checkForWorkClass:we,removeFormattingTags:Rt,cleanEmptySpans:re,mutableState:N,currentStyle:Pe,isProgrammaticSelection:Ye,findParentWithFontSizeAndTag:a.findParentWithFontSizeAndTag}),O=N.parentElement,Z=N.parentNode,B=N.parentWrapper,P=N.selection,I=N.range,G.range=I}cp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,activeElement:S,hasItalicClass:ie,tempStyleClass:$,checkForWorkClass:we,removeFormattingTags:Rt,cleanEmptySpans:re}),dp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,activeElement:S,hasItalicClass:ie,tempStyleClass:$,checkForWorkClass:we,removeFormattingTags:Rt,cleanEmptySpans:re});const Et={parentWrapper:B,range:I,selection:P};up({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,activeElement:S,hasItalicClass:ie,tempStyleClass:$,checkForWorkClass:we,removeFormattingTags:Rt,cleanEmptySpans:re,request:v,findOutermostParentWithText:l,mutableState:Et}),B=Et.parentWrapper,I=Et.range,G.range=I;const Tn={parentWrapper:B,range:I,selection:P};if(fp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,activeElement:S,hasItalicClass:ie,tempStyleClass:$,checkForWorkClass:we,removeFormattingTags:Rt,cleanEmptySpans:re,request:v,findOutermostParentWithText:l,cleanStrikesInElement:So,mutableState:Tn}),B=Tn.parentWrapper,C.value===!1&&B){const N=window.getSelection(),Y=N&&N.rangeCount>0?N.getRangeAt(0):I,He={textStrong:["strong","b"],textItalic:["em","i"],textStrikethrough:["s","strike"],textUnderline:["u"]}[C.name];let ze=!1;He&&He.forEach(X=>{Array.from(B.getElementsByTagName(X)).reverse().forEach(ye=>{if(!m(ye,Y))return;const Ve=oe(ye);if(!Ve||Ve.trim().length===0)return;const ce=ye.parentElement;ye.hasAttribute("em-edit")&&ce&&!ce.hasAttribute("em-edit")&&ce.setAttribute("em-edit",ye.getAttribute("em-edit")||"active"),ye.outerHTML=ye.innerHTML,ze=!0,g(ce,B,q)})}),ze&&setTimeout(()=>{const X=document.querySelector("[em-edit]")||r(q)||(B?.isConnected?B:null);X&&n(X,q)},0)}if(C.value===!0&&B&&se){const N={textStrong:"strong",textItalic:"em",textStrikethrough:"s",textUnderline:"u"},Y={textStrong:["strong","b"],textItalic:["em","i"],textStrikethrough:["s","strike"],textUnderline:["u"]},He=N[C.name],ze=Y[C.name];if(He&&ze&&q&&q.trim().length>0){const X=B,ye=ze.some(Qe=>X.getElementsByTagName(Qe).length>0),Ve=(X.style?.textDecoration||"").toLowerCase(),ce=(X.style?.textDecorationLine||"").toLowerCase(),Ne=Ve.includes("underline")||ce.includes("underline"),de=Ve.includes("line-through")||ce.includes("line-through"),St=C.name==="textUnderline"&&Ne||C.name==="textStrikethrough"&&de,Ao=oe(X)===q;if(!ye&&!St&&Ao){const Qe=document.createElement(He);for(;X.firstChild;)Qe.appendChild(X.firstChild);X.appendChild(Qe);try{const Oe=document.createRange();Oe.selectNodeContents(Qe),t(Oe),I=Oe,G.range=Oe}catch{}setTimeout(()=>{const Oe=document.querySelector("[em-edit]")||r(q)||(X.isConnected?X:null);Oe&&n(Oe,q)},0)}}}const W={parentWrapper:B,parentNode:Z,range:I,selection:P};pp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,isColorChange:Ae,tempColor:Co,outerContextColor:Vt,outerContextElement:Ke,stylePropretyName:fe,currentStyle:Pe,canselExecCommand:ee,isProgrammaticSelection:Ye,request:v,setCustomColor:Ie,checkForWorkClass:we,cleanEmptySpans:re,mutableState:W}),B=W.parentWrapper,Z=W.parentNode;const pe={parentWrapper:B,parentNode:Z,range:I,selection:P};if(bp({parentElement:O,parentNode:Z,parentWrapper:B,currentSettings:C,isElementList:k,classNameBullet:R,isEditorTagOutside:se,selectedText:q,range:I,selection:P,checkForTextNodes:ke,commit:o,getInnerText:oe,getSelectedText:a.getSelectedText,addNewRange:t,refreshElementSettings:n,findElementWithSelectedText:r,getParentElementOfSelection:i,rgbToHex:a.rgbToHex,findOutermostParentWithText:l,activeElement:S,commonStyles:_e,cleanEmptySpansWithParent:re,mutableState:pe}),I=pe.range,C.name==="textLink"&&C.value===!0&&se&&B&&q?.trim().length>0){const N=pe.range||I,Y=q.trim(),He=[...B?Array.from(B.querySelectorAll("a")):[],...B?.parentElement?Array.from(B.parentElement.querySelectorAll("a")):[]],ze=He.find(X=>oe(X)?.trim()===Y)||He[0]||null;if(!(p(N,B)||p(N,B.parentElement)||ze)&&N&&!N.collapsed){const X=document.createElement("a"),{color:ye,textDecoration:Ve}=f(_e);X.setAttribute("target","_blank"),X.setAttribute("href",""),X.setAttribute("new","true"),X.setAttribute("style",`color: ${ye}; text-decoration: ${Ve};`);let ce=!1;const Ne=B.querySelector("editor");if(Ne&&oe(Ne)===q&&Ne.querySelector("a")===null){for(;Ne.firstChild;)X.appendChild(Ne.firstChild);Ne.appendChild(X),ce=!0}try{if(!ce){const de=N.extractContents();de.childNodes.length>0&&(X.appendChild(de),N.insertNode(X),ce=!0)}}catch{ce=!1}if(!ce&&oe(B)===q){for(;B.firstChild;)X.appendChild(B.firstChild);B.appendChild(X),ce=!0}if(ce){try{const de=document.createRange();de.selectNodeContents(X),t(de),I=de,pe.range=de,G.range=de}catch{}n(X,q)}}}const Ln=C.name==="textUnderline"&&!C.value;if((!Ae&&ee||Ln)&&re(q),yg.has(C.name)){const N=pe.parentWrapper||B||r(q)||i();N&&re(q,N)}k&&O.querySelectorAll(`tr td:first-child > div.${R}, tr td:first-child > editor div.${R}`).forEach(N=>{N.classList.remove(`${R}`)});const vo=r(q);vo?.hasAttribute("em-edit")||vo?.setAttribute("em-edit","active"),o()}}var ge=null,ft=!1,wi=!1,Ue="",je="",pt=null,ki=null,nt=null,pn=!1,po=!1,gn=!1,ne,Xe,bn,rt,$e,go,U,bo,_i,hn,yn,ho,qt,En=".em-prevent-action",F,Wt,it,gt;function be(e){return Kd(e,{HTMLDocument:U,documentMapping:rt,remoteDocument:Xe,messageService:a.messageService})}function Sg(e){go?.setEditorFocus(e)}function Cg(e,o=a.getSelectedText()){let n=(i=>i?.nodeType===Node.ELEMENT_NODE?i:i?.parentElement||null)((typeof a.findElementWithSelectedText=="function"?a.findElementWithSelectedText(o,e):null)||e);if(!n||n.tagName==="EDITOR"&&(n=n.firstElementChild||null,!n))return;const r=a.state.get("activeElementLocked")>0;try{r&&a.state.decrement("activeElementLocked"),ae({elem:n})}finally{r&&a.state.increment("activeElementLocked")}}function vg(e,o){const t=U.getRangeByElement(e,!0);t&&rt.hasMappedReplacementRangeInRange(t)||$e.whenEditorLostFocus(()=>it(e,o),"editor")}function Ag(e){return a.prepareEditorHTML(e,a.parseFromString)}var Tg=a.checkIsEditorInited;function Ni(e=!1){lm({state:a.state,getEmailWidth:()=>a.state.get("emailWidth"),messageService:a.messageService,removeHiddenClasses:a.removeHiddenClasses,findGlobalHolder:Ai,elMarkupHelper:wg,rgbToHex:a.rgbToHex,getSubject:Go,getPreheader:ao,getUsedColors:qr,commit:F,setGlobalHolder:o=>{ge=o}},e),yn?.refit()}function Lg(...e){if(a.state.get("previewPage")){yn.refit();return}ed(...e)}function wg(){gm(ge)}function kg(e){return hm(e,U)}function _g(e){return gg(e,{getLockEditor:()=>a.state.get("lockEditor"),applyStylesToDocument:kg,commonStylesApply:Ze,commonStylesApplyToBlock:Je,setFloatBlocksWidth:Ge,appName:a.state.get("appName"),wrapEditor:it,setCursorPosition:be,messageService:a.messageService,commit:F})}function Ng(e){Pu(e,{setBlockGroupControlsPosition:yo,commit:F})}var Bi=Dt,Mi=Ft;function Bg(){return a.stickyCheck(F)}var Mg=a.checkSandboxStyles,Sn=a.getElementParent;function Rg(e){return a.addBlockToProject(e,{HTMLDocument:U,messageService:a.messageService})}function yo(){return a.setBlockGroupControlsPosition({scrollTop:a.state.get("scrollTop")})}function Ge(e){return a.setFloatBlocksWidth(e,ne)}function bt(e){return a.setBlockMaxWidth(e,ne)}var lt=a.setImageWidth;function at(e){return a.insertCountdown(e,F)}var $t=a.uptimeCountdown,ht=a.checkBlockAdaptivity;function Cn(e){return a.addFontFamilyClass(e,F)}function vn(e){a.clearLinkTags(e,o=>{F(o)}),Ri()}function Ri(){a.clearProjectFontFaces(e=>{F(e)})}function Ze(e){return a.commonStylesApply(e,F)}var Je=a.commonStylesApplyToBlock,Pg=a.getStructureColumns,Ig=a.getElementTdDiv,Pi=a.setStructureBlocksWidth;function Hg(e){e=ne.getVisibleNode(e),a.implementResizableElems(e),$e.whenEditorLostFocus(()=>{e.isConnected})}function Ii({target:e}){return bm({target:e},F)}var Hi;function Og(e){const o=["textStrong","textItalic","textStrikethrough","textUnderline","textColor","textBackgroundColor","textLink","lineHeight","fontSize","fontFamily"];try{a.state.increment("activeElementLocked");let t=e.data;t.settings=bo.escape(t.settings),Object.keys(t.settings)[0];let n=a.getActiveEditElement();const r=n;let i=r?.parentElement??null;for(;i&&!i.tagName.startsWith("AMP-");)i=i.parentElement;const l=r?.tagName??"",s=i&&r?Array.from(i.getElementsByTagName(l)).indexOf(r):-1,{classNameOl:c,classNameUl:d,isListOL:u,isListUL:g,isList:m}=a.getListContext(n),f=a.getListContainer(n);if(t.type==="img"||t.type==="countdown"||t.type==="video")Mp(t.settings,{activeElement:n,getActiveEditElement:a.getActiveEditElement,setCursorPosition:be,setElementBorder:a.setElementBorder,setElementBoxShadow:a.setElementBoxShadow,setElementBorderRadius:a.setElementBorderRadius,setElementMobileWidth:a.setElementMobileWidth,setElementMobileHeight:a.setElementMobileHeight,setElementMobileBorder:a.setElementMobileBorder,setElementMobileBorderRadius:a.setElementMobileBorderRadius,setElementMobileBoxShadow:a.setElementMobileBoxShadow,setElementMobileAlign:a.setElementMobileAlign,setElementMobileVerticalAlign:a.setElementMobileVerticalAlign,setElementShow:a.setElementShow});else if(t.type==="a")Rp(t.settings,{activeElement:n,textStyleProperties:o,toggleTextStyle:gt});else if(t.type==="table")af(t.settings,{activeElement:n,setElementBorder:a.setElementBorder,setElementBoxShadow:a.setElementBoxShadow,setElementBorderRadius:a.setElementBorderRadius,setElementMobileTableAlign:a.setElementMobileTableAlign,setElementMobileWidth:a.setElementMobileWidth,setElementMobileBorder:a.setElementMobileBorder,setElementMobileBorderRadius:a.setElementMobileBorderRadius,setElementMobileBoxShadow:a.setElementMobileBoxShadow,setElementMobileBackgroundColor:a.setElementMobileBackgroundColor,setElementMobileBackgroundImage:a.setElementMobileBackgroundImage,setElementMobileBackgroundPositionX:a.setElementMobileBackgroundPositionX,setElementMobileBackgroundPositionY:a.setElementMobileBackgroundPositionY,setElementMobileBackgroundRepeat:a.setElementMobileBackgroundRepeat,setElementMobileBackgroundSize:a.setElementMobileBackgroundSize,setElementShow:a.setElementShow});else if(t.type==="td"||t.type==="structure"||t.type==="group"||t.type==="column")cf(t.settings,{activeElement:n,requestType:t.type,textStyleProperties:o,isElementListContainer:f,isProgrammaticSelection:{get value(){return ft},set value(b){ft=b}},setElementBorder:a.setElementBorder,setElementBoxShadow:a.setElementBoxShadow,setElementBorderRadius:a.setElementBorderRadius,setElementMobileWidth:a.setElementMobileWidth,setElementMobileHeight:a.setElementMobileHeight,setElementMobileBorder:a.setElementMobileBorder,setElementMobileBorderRadius:a.setElementMobileBorderRadius,setElementMobileBoxShadow:a.setElementMobileBoxShadow,setElementMobileAlign:a.setElementMobileAlign,setElementMobileTableAlign:a.setElementMobileTableAlign,setElementMobileVerticalAlign:a.setElementMobileVerticalAlign,setElementMobileDirection:a.setElementMobileDirection,setElementMobileBackgroundColor:a.setElementMobileBackgroundColor,setElementMobileBackgroundImage:a.setElementMobileBackgroundImage,setElementMobileBackgroundPositionX:a.setElementMobileBackgroundPositionX,setElementMobileBackgroundPositionY:a.setElementMobileBackgroundPositionY,setElementMobileBackgroundRepeat:a.setElementMobileBackgroundRepeat,setElementMobileBackgroundSize:a.setElementMobileBackgroundSize,setElementMobilePadding:a.setElementMobilePadding,setElementShow:a.setElementShow,setContrastBlock:a.setContrastBlock,setStructureBlocksWidth:Pi,toggleTextStyle:gt,removeEditorTags:a.removeEditorTags,addClassToSecondCell:a.addClassToSecondCell,wrapEditor:it,addNewRange:a.addNewRange});else if(t.type==="button")of(t.settings,{activeElement:n,textStyleProperties:o,setElementBorder:a.setElementBorder,setElementBoxShadow:a.setElementBoxShadow,setElementBorderRadius:a.setElementBorderRadius,setElementMobileWidth:a.setElementMobileWidth,setElementMobileHeight:a.setElementMobileHeight,setElementMobileLineHeight:a.setElementMobileLineHeight,setElementMobileBorder:a.setElementMobileBorder,setElementMobileBorderRadius:a.setElementMobileBorderRadius,setElementMobileBoxShadow:a.setElementMobileBoxShadow,setElementMobileAlign:a.setElementMobileAlign,setElementMobileTableAlign:a.setElementMobileTableAlign,setElementMobileVerticalAlign:a.setElementMobileVerticalAlign,setElementMobileBackgroundColor:a.setElementMobileBackgroundColor,setElementMobileBackgroundImage:a.setElementMobileBackgroundImage,setElementMobileBackgroundPositionX:a.setElementMobileBackgroundPositionX,setElementMobileBackgroundPositionY:a.setElementMobileBackgroundPositionY,setElementMobileBackgroundRepeat:a.setElementMobileBackgroundRepeat,setElementMobileBackgroundSize:a.setElementMobileBackgroundSize,setElementMobilePadding:a.setElementMobilePadding,setElementMobileFontSize:a.setElementMobileFontSize,setElementShow:a.setElementShow,toggleTextStyle:gt,compareStrings:a.compareStrings});else if(t.type==="div")lf(t.settings,{activeElement:n,setElementBorder:a.setElementBorder,setElementBoxShadow:a.setElementBoxShadow,setElementBorderRadius:a.setElementBorderRadius,setElementMobileWidth:a.setElementMobileWidth,setElementMobileHeight:a.setElementMobileHeight,setElementMobileBorder:a.setElementMobileBorder,setElementMobileBorderRadius:a.setElementMobileBorderRadius,setElementMobileBoxShadow:a.setElementMobileBoxShadow,setElementMobileAlign:a.setElementMobileAlign,setElementMobileVerticalAlign:a.setElementMobileVerticalAlign,setElementMobileDirection:a.setElementMobileDirection,setElementMobileBackgroundColor:a.setElementMobileBackgroundColor,setElementMobileBackgroundImage:a.setElementMobileBackgroundImage,setElementMobileBackgroundPositionX:a.setElementMobileBackgroundPositionX,setElementMobileBackgroundPositionY:a.setElementMobileBackgroundPositionY,setElementMobileBackgroundRepeat:a.setElementMobileBackgroundRepeat,setElementMobileBackgroundSize:a.setElementMobileBackgroundSize,setElementMobilePadding:a.setElementMobilePadding,setElementShow:a.setElementShow});else if(t.type==="vindent")Pp(t.settings,{activeElement:n,setElementMobileHeight:a.setElementMobileHeight});else if(t.type==="var")Ip(t.settings,{activeElement:n,isVariableText:a.isVariableText});else if(t.type==="floatBlock")ff(t.settings,{activeElement:n,setElementMobileWidth:a.setElementMobileWidth,setElementMobileContentWidth:a.setElementMobileContentWidth,setElementMobileVerticalAlign:a.setElementMobileVerticalAlign,setElementShow:a.setElementShow});else if(t.type==="text")Tp(t.settings,{activeElement:n,textStyleProperties:o,toggleTextStyle:gt,collectVMLContent:Mo,updateVMLComments:Ro,removeClassesByPrefix:a.removeClassesByPrefix$1,createFontClassName:a.createFontClassName,addFontFamilyClass:Cn,clearLinkTags:vn,handleTextScriptSettings:_f,handleTextReplacer:Nf,handleTextAnchor:Hf,unwrapNestedTags:Id,wrapInTag:Wr,unwrapTag:Hd,isRangeMatching:Od,splitWrapper:xd,cleanEmptyTags:Dd,applicationElementSettingsSet:ae,compareStrings:a.compareStrings,setElementMobileFontSize:a.setElementMobileFontSize,setElementMobileLineHeight:a.setElementMobileLineHeight,setElementMobileAlign:a.setElementMobileAlign,updateTableStyle:a.updateTableStyle,changeBullets:a.changeBullets,changeBulletsColor:a.changeBulletsColor,changeBulletsSize:a.changeBulletsSize,changeBulletsItalic:a.changeBulletsItalic,changeBulletsWeight:a.changeBulletsWeight,changeBulletsStrikethrough:a.changeBulletsStrikethrough,changeBulletsUnderline:a.changeBulletsUnderline,findElementWithSelectedText:a.findElementWithSelectedText,removeEditorTags:a.removeEditorTags,isElementList:m,isElementListOL:u,classNameOl:c,classNameUl:d,commit:F});else if(t.type==="floatBlocksWidths")pf(t.settings,{activeElement:n,setPercentsForColumns:a.setPercentsForColumns,setElementMobileHeight:a.setElementMobileHeight});else if(t.type==="floatBlocksPreset")gf(t.settings,{activeElement:n,setPercentsForColumns:a.setPercentsForColumns,setElementMobileHeight:a.setElementMobileHeight});else if(t.type==="floatBlocksValign")bf(t.settings,{activeElement:n,setPercentsForColumns:a.setPercentsForColumns,setElementMobileHeight:a.setElementMobileHeight});else if(t.type==="floatBlocksGap")hf(t.settings,{activeElement:n,setPercentsForColumns:a.setPercentsForColumns,setElementMobileHeight:a.setElementMobileHeight});else if(t.type==="floatBlocksGapMobile")yf(t.settings,{activeElement:n,setPercentsForColumns:a.setPercentsForColumns,setElementMobileHeight:a.setElementMobileHeight});else if(t.type==="carousel")Ef(t.settings,{activeElement:n,HTMLDocument:U,parseFromString:a.parseFromString,setElementBorderRadius:a.setElementBorderRadius,commit:F});else if(t.type==="accordion")Sf(t.settings,{activeElement:n,HTMLDocument:U,parseFromString:a.parseFromString,setElementBorderRadius:a.setElementBorderRadius,commit:F});else if(t.type==="social"){const b=kf(t.settings,{activeElement:n,parseFromString:a.parseFromString,commit:F});b&&(n=b)}else t.type==="customTable"&&Of(t.settings,{activeElement:n,activeCell:a.state.get("activeCell"),state:a.state,parseTableElementToModel:Nt,tableModelToHtml:Ce,updateTablePadding:Ga,updateBackgroundPosition:Ya,removeStyleProperty:rs,updateBorderRadius:ls,removeClassByPrefix:cs,getCellsWithClasses:Xa,updateTableCellBackgroundByIds:Za,addClassToCellsByIds:Ja,getExternalBorders:es,mergeUniCells:ds,updateCellBordersByIds:Qa,getExternalCorners:os,updateCellBorderRadiusByIds:ts,updateCellPaddingByIds:ns,removeOuterBorders:as,simplifyBorders:ss,wrapEditor:it,addNewRange:a.addNewRange,toggleTextStyle:gt,textStyleProperties:o,commit:F,setElementMobileWidth:a.setElementMobileWidth,setElementMobileHeight:a.setElementMobileHeight,setElementShow:a.setElementShow,setElementMobileBackgroundColor:a.setElementMobileBackgroundColor,setElementMobileBackgroundImage:a.setElementMobileBackgroundImage,setElementMobileBackgroundPositionX:a.setElementMobileBackgroundPositionX,setElementMobileBackgroundPositionY:a.setElementMobileBackgroundPositionY,setElementMobileBackgroundRepeat:a.setElementMobileBackgroundRepeat,setElementMobileBackgroundSize:a.setElementMobileBackgroundSize,setElementMobileBoxShadow:a.setElementMobileBoxShadow,setElementMobileBorder:a.setElementMobileBorder,setElementMobileBorderRadius:a.setElementMobileBorderRadius});try{a.emFilterCSS()}catch{}a.state.increment("activeElementLocked");const p=n;Wt().finally(()=>{const b=U.getMappedParent(n);if(b?.isConnected){const h=b,y=h.tagName.startsWith("AMP-"),E=y&&h===i&&s>=0,S=y?Array.from(h.querySelectorAll("section"),T=>T.hasAttribute("expanded")):[],v=ne.getOuterHtml(b),C=a.parseFromString(v)[0];b.parentNode?.replaceChild(C,b);const L=C,w=E?L.getElementsByTagName(l)[s]??null:null;if(w)w.setAttribute("em-edit","active"),n=w;else if(p?.tagName==="A"&&C.tagName!=="A"){const T=C.querySelector?.("a");T?(T.setAttribute("em-edit","active"),n=T):(C.setAttribute("em-edit","active"),n=C)}else C.setAttribute("em-edit","active"),n=C;Wt().finally(()=>{L.querySelectorAll("section").forEach((T,M)=>{S[M]&&T.setAttribute("expanded","")}),a.state.decrement("activeElementLocked"),be(n)})}else a.state.decrement("activeElementLocked"),be(n)})}catch{}finally{Promise.resolve().then(()=>a.state.decrement("activeElementLocked"))}}function ae(e){if(!a.state.isActiveElementLocked()){if(!e.elem){const o=document.querySelector("[em-edit]");o&&(e.elem=o)}try{a.state.increment("activeElementLocked"),a.removeAllAttributes("em-edit");let o={};if(e.elem){if(e.elem.closest?.(En))return;e.elem=Fp(e.elem,{getVariableByIcon:a.getVariableByIcon,htmlDocument:ne,findOutermostParentWithText:a.findOutermostParentWithText,sendResizeEvent:a.sendResizeEvent});const t=e.elem.tagName==="EDITOR"&&e.elem.firstChild?.nodeType===1?e.elem.firstChild:e.elem,{classNameOl:n,classNameUl:r,isListOL:i,isListUL:l,isList:s}=a.getListContext(e.elem),c=s?a.getListBullet(e.elem):null,d=!!e.elem.closest(".em-element-custom-table"),u=a.getLineHeightInPixels,g=E=>a.getFontFamilyFromElement(E,t),m=a.textHasStyle,f=(E,S=!1)=>Dp(S,{getSelectedText:a.getSelectedText,getRangeFromSelection:a.getRangeFromSelection});xp(e.elem,window.getSelection()?.isCollapsed??!0,!!e.elem.querySelector("editor"),{removeAllAttributes:a.removeAllAttributes}),o={operation:"application_element_settings_set",settings:{}};const p=qp({elem:e.elem,isCellCustomTable:d,listContext:{isListOL:i,isListUL:l,isList:s},requestElemBullet:c,variableElement:f},{...Hi,Locale:qt,isProgrammaticSelection:ft,getElementTdDiv:Ig,getLineHeghtInPixels:u,getFontFamilyFromElement:g,textHasStyle:m,activeCell:a.state.get("activeCell"),CLASS_FOR_BASIC_CELL:a.CLASS_FOR_BASIC_CELL,requestElemWithStyle:t}),b=$p(e.elem,window.getSelection()?.isCollapsed??!0,p);o.type=b.type,o.caption=b.caption,o.settings=b.settings;const h=Op(e.elem,b,o,{removeAllAttributes:a.removeAllAttributes});if(h.isProgrammaticSelectionReset&&(ft=!1),h.shouldReturn)return;const y=Hp({elem:e.elem,message:o,activateSection:e.activateSection},{getElementParentCaption:Jr,getStructureColumns:Pg,getUsedColors:qr,getElementPath:wm,getCurrentElementPath:Cm,ampService:_i,mapObj:bo,commonStyles:a.state.get("commonStyles")});o=y.message,a.state.update({elementPath:y.elementPath})}else{setTimeout(()=>{let t=document.querySelector("[em-edit]");if(t?.isConnected){ae({elem:t});return}const n={operation:"application_element_settings_set",settings:bo.unescape({parent:void 0,nextElem:!1,prevElem:!1}),type:null};JSON.stringify(n),a.messageService.send(n)},0);return}JSON.stringify(o),Ue=e.elem?U.getOuterHtml(e.elem):"",je=It(e.elem),a.messageService.send(o)}finally{Promise.resolve().then(()=>{const o=document.querySelector("[em-edit]");Ue=o?U.getOuterHtml(o):"",je=It(o),a.state.decrement("activeElementLocked")})}}}function xg(){document.addEventListener("keydown",m=>{document.body?.classList.contains("mceNonEditable")||a.state.get("lockEditor")||!m.target?.closest?.('[contenteditable="true"]')||!m.key||m.ctrlKey||m.altKey||m.metaKey||m.key.length===1&&(m.preventDefault(),m.stopImmediatePropagation(),document.execCommand("insertText",!1,m.key))},!0);const e=m=>{const f=m.target,p=f?.closest?.("a")||f?.querySelector?.("a");if(!p)return;const b=p.closest("td")||p.parentElement;b&&a.findRoundrectComment(b)&&F(!1).then(()=>{!b.isConnected||!p.isConnected||(p.closest("editor")||p.querySelector("editor")||b.querySelector("editor"))&&a.updateButtonVMLLabel(b,p.textContent||"")&&F(!1)})};document.addEventListener("input",e,!1),document.addEventListener("focusout",m=>{a.handleVMLButtonInput(m)&&F(!1)},!1),a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1,actualTargetCount:0,activeCell:[],lockEditorInit:!0,globalHolder:null,applicationTheme:"light",iframeOffsetTop:0,scrollTop:0,previewHeight:0,applicationMode:"default",emailWidth:0,lockEdit:!1,elementPath:[],copyPasteEnabled:!0,saveBlockEnabled:!0,editImageControlEnabled:!0,elementAIimageEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterEditorEnabled:!0,blocksAddPanelEnabled:!0,lockEditor:!0,codeMode:!0,appName:"",commonStyles:{},isProgrammaticSelection:!1});let o=a.state.get("activeElementLocked");a.state.subscribe(m=>{if(m.activeElementLocked!==void 0){const f=o,p=m.activeElementLocked;o=p,f>0&&p===0&&Promise.resolve().then(()=>{if(a.state.get("activeElementLocked")!==0)return;const b=document.querySelector("[em-edit]");Ue=b?U.getOuterHtml(b):"",je=It(b)})}"globalHolder"in m&&(ge=m.globalHolder),"isProgrammaticSelection"in m&&(ft=m.isProgrammaticSelection)}),a.implementPolyfills(),setTimeout(()=>{wi=!0},1e3),a.provideSandboxState(a.container);const t=a.provideAttributePipeline(a.container).pipeline,n=a.provideDocumentSync(a.container,rd,{prepareHtml:m=>a.emFilter({node:m,isPartial:!0}),lock:{increment:()=>a.state.increment("activeElementLocked"),decrement:()=>a.state.decrement("activeElementLocked")}});ne=n.htmlDocument,a.watchNewEditors(ne),Xe=n.remoteDocument,bn=n.textDocument,rt=n.documentMapping,a.provideImageCache(a.container,{pipeline:t,htmlDocument:ne}),hn=a.provideEmVersion(a.container,{pipeline:t,htmlDocument:ne}).reload,n.onDocumentReplaced(()=>hn?.clear()),Yc(),yn=td({getGlobalHolder:()=>ge}),a.messageService.addListener(a.EVENT_TYPES.SANDBOX_IMAGE_RESET,({url:m})=>{m&&(a.container.getInstance(a.IMAGE_CACHE_ID)?.forget(m),hn?.reload(m))}),a.initDocuments({htmlDocument:ne,remoteDocument:Xe,textDocument:bn,documentMapping:rt}),F=m=>n.commit(m),Wt=m=>n.commitLockedAsync(m),go=a.provideFocus(a.container,{htmlDocument:ne,remoteDocument:Xe}),$e=go.controller,a.initFocusManager($e),a.attachFocusService(go),U=ne,id(),ad(),pd(ne,$e),gd(ne,$e),a.registerCrossDomainDD(),a.registerThemeVariablesService(ne),a.registerProjectFontsService(),Td(Xe,m=>{F(m)}),Sd(ne,rt,be),a.registerCorrectVariableSelectionService(),a.registerResizeWatch(ne,Xe),a.registerResetService(ne),Ld(ne,$e,Xe),a.registerExtensionScriptsService(ne),_i=a.provideAmp(a.container,ne).service,ho=a.registerLocalizationService(ne),wd({container:a.container,focusController:$e,features:Pd}),Sm(ho),qt=ho.localized,ho.onChangeLocale(({data:m})=>{qt=m}),ku({getLocale:()=>qt,commit:m=>F(m)}),a.initSandboxStyles({textDocument:bn,commit:m=>F(m)}),a.initResizableElements({getLocale:()=>qt,commit:m=>F(m),messageService:a.messageService}),ne.onChange(m=>{m.some(f=>f.added.length||f.characterDataChanged||f.reordered?.length||f.reparented?.length)&&a.initSortable(U)}),bo=a.createMapObj(rt),U.onChange(()=>{Mg()}),ne.onRefresh(Ni),U.onChange(m=>{for(const f of m)for(const p of f.removed)(p instanceof HTMLHeadElement||p instanceof HTMLLinkElement&&p.hasAttribute("em"))&&document.querySelector(".em-editor-wrapper")?.remove()});const r=new a.UpdateQueue;let i=0;U.onChange(m=>{for(const f of m)for(const p of f.added)r.add(p.parentElement?p.parentElement:p);i||(i=setTimeout(()=>{$e.whenEditorLostFocus(()=>{r.clear(),F(!1)}),i=0},1e3))}),U.onChange(a.createHandleChangesWithRemovedElementsOnly(ae)),U.onChange(()=>{if(a.state.get("activeElementLocked")>0)return;const m=document.querySelector("[em-edit]"),f=m?U.getOuterHtml(m):"",p=It(m);(Ue!==f||je!==p)&&(document.body&&!document.body.classList.contains("em-sandbox-discuss")?m?m.closest?.(En)||(Ue=f,je=p,ae({elem:m})):setTimeout(()=>{let h=document.querySelector("[em-edit]");if(h){const y=U.getOuterHtml(h),E=It(h);(Ue!==y||je!==E)&&(Ue=y,je=E,h.closest?.(En)||ae({elem:h}))}else Ue=f,je=p,ae({elem:null})},0):(Ue=f,je=p));const b=document.body;b&&((a.state.get("lockEdit")!==b.classList.contains("mceNonEditable")||a.state.get("lockEditor"))&&(a.state.get("lockEdit")||a.state.get("lockEditor")?b.classList.add("mceNonEditable"):b.classList.remove("mceNonEditable")),b.classList.toggle("em-sandbox-preview",a.state.get("previewPage")))}),gt=Eg({commit:F,addNewRange:a.addNewRange,refreshElementSettings:Cg,findElementWithSelectedText:a.findElementWithSelectedText,getParentElementOfSelection:a.getParentElementOfSelection$1,findOutermostParentWithText:a.findOutermostParentWithText,clearLinkTags:vn,addFontFamilyClass:Cn,getIsProgrammaticSelection:()=>ft,getCommonStyles:()=>a.state.get("commonStyles")}),it=a.createWrapEditor({removeHiddenClasses:a.removeHiddenClasses,checkIsInited:Tg,prepareEditorHTML:Ag,getVisibleText:a.getVisibleText,defaultVisibleTextMapFn:a.defaultVisibleTextMapFn,getTagNameForContainer:a.getTagNameForContainer,applyAttributesToTag:(m,f,p)=>a.applyAttributesToTag(m,f,p,a.rgbToHex),setCursorToElement:a.setCursorToElement,removeLastWord:a.removeLastWord,hasOnlyTextNodesDeep:a.hasOnlyTextNodesDeep,isRangeCoveringAllVisibleText:a.isRangeCoveringAllVisibleText,isEditorContentOnlyNbsp:a.isEditorContentOnlyNbsp$1,isClickAtEndOfEmReplace:a.isClickAtEndOfEmReplace,getOrCreateAfterSpan:a.getOrCreateAfterSpan,setCursorInsideSpan:a.setCursorInsideSpan,commit:F,createBeforeInputHandler:a.createBeforeInputHandler}),Hi={_isCarouselElement:Nm,_isAccordionElement:Mm,_isSocialBlockElement:zm,_isImageElement:Mn,_isLinkElement:Xm,_isButtonElement:Km,_isTableElement:Al,_isCustomTableElement:bu,_isAtomElement:yu,_isTdColumnGroup:au,_isTdStructure:su,_isEmptyTd:cu,_isTdCell:du,_isVindentTd:eu,_isVindentDiv:tu,_isFloatBlockElement:lu,_isDivTextElement:hl,_isInlineButtonElement:Zm,_extractTextSettings:Kt,_extractCarouselSettings:km,_extractAccordionSettings:Bm,_extractSocialSettings:Vm,_extractImgSettings:Yt,_extractButtonSettings:Ym,_extractLinkTextSettings:yl,_extractTableSettings:vl,_extractCustomTableSettings:hu,_extractAtomElementSettings:Cu,_extractProgrammaticElementSettings:vu,_extractTdColumnGroupSettings:uu,_extractTdStructureSettings:fu,_extractTdCellSettings:pu,_extractVindentSettings:ou,_extractFloatBlockSettings:iu,_extractDivContainerSettings:gu,_clearActiveEditElements:a.clearActiveEditElements,HTMLDocument:U,parseFromString:a.parseFromString,getParentElementOfSelection:a.getParentElementOfSelection$1,getSelectedText:a.getSelectedText,findElementWithSelectedText:a.findElementWithSelectedText,parseTableElementToModel:Nt,extractBorderRadius:is,parseBackgroundStyles:Ka,isElementHasBold:a.isElementHasBold$1},Uc(),Wc(ae),Bc(function(m){typeof be=="function"&&be(m)}),Mc(function(m){Ni(m)}),Rc(function(m){a.state.set("commonStyles",m)}),Pc(function(m){return Sn(m)}),Ic(function(m){return a.getVariableByIcon(m)}),Hc(function(m){return Fd(m)}),Oc({getOuterHtml:function(m){return a.getOuterHtml(m)}}),xc({increment:function(m){a.state.increment(m)},decrement:function(m){a.state.decrement(m)}}),Dc(function(m){a.setPercentsForColumns(m)}),Fc(function(){return a.getActiveEditElement()}),qc(function(m){return a.parseFromString(m)}),a.state.subscribe(m=>{const f={};"iframeOffsetTop"in m&&(f.iframeOffsetTop=m.iframeOffsetTop),"previewHeight"in m&&(f.previewHeight=m.previewHeight),"emailWidth"in m&&(f.emailWidth=m.emailWidth),"elementPath"in m&&(f.elementPath=m.elementPath),"lockEdit"in m&&(f.lockEdit=m.lockEdit),Object.keys(f).length>0&&zc(f)}),a.watchLockEditor(),a.messageService.addListener(function(m){if(m.data.operation=="update_position_from_editor"){let f=m.data.data;if(f){f=Xe.correctOffset(f,!0),f=rt.correctOffset(f,!0);let p=U.getElementByPosition(f);if(p&&!(p instanceof Element)&&(p=p.parentElement),p){const b=p.getBoundingClientRect(),h=document.querySelector("[em-edit]");p.tagName!=="BODY"&&b.height&&b.width&&h!==p&&ae({elem:p});let y=p,E={operation:"application_scroll-to",settings:{value:a.state.get("applicationMode")==="default"?y.getBoundingClientRect().top+a.state.get("iframeOffsetTop")-a.state.get("previewHeight")/2+y.getBoundingClientRect().height/2:y.getBoundingClientRect().top-a.state.get("previewHeight")/2+y.getBoundingClientRect().height/2}};a.messageService.send(E)}}}if(m.data.operation=="sandbox_email_settings_set"){let f=m.data;if(ge=Ai(),ge){const h=ge.classList.contains("full-wrap")?ge.querySelector("td"):ge;h&&a.setEmailBackgroundSettings(h,f.settings,jo())}f.settings.subject!==void 0&&(document.title=f.settings.subject);const p=og(f.settings,{globalHolder:ge,emailWidth:a.state.get("emailWidth"),state:a.state,findParentTr:a.findParentTr});dg(f.settings,ge),Vp(f.settings,{globalHolder:ge,commonStyles:a.state.get("commonStyles"),lockEditor:a.state.get("lockEditor"),removeClassesByPrefix:a.removeClassesByPrefix$1,createFontClassName:a.createFontClassName,addFontFamilyClass:Cn,clearLinkTags:vn,clearProjectFontFaces:Ri,rgbToHex:a.rgbToHex,setElementBorder:a.setElementBorder,setElementBorderRadius:a.setElementBorderRadius,setStructureBlocksWidth:Pi,messageService:a.messageService});const b=Object.keys(f.settings).filter(h=>f.settings[h]!==void 0);(p||!(b.length===1&&b[0]==="width"))&&Wt()}m.data.operation==="sandbox_element_settings_set"&&$e.whenEditorLostFocus(()=>Og(m)),(m?.data?.operation??m?.operation)==="sandbox_native-image-drop-clear"&&zn(),m.data.operation==="sandbox_window-characteristic"&&Kc(m.data.settings,m.data.mode,{state:a.state,previewHeight:a.state.get("previewHeight"),iframeOffsetTop:a.state.get("iframeOffsetTop"),scrollTop:a.state.get("scrollTop"),globalHolder:ge,setBlockGroupControlsPosition:yo,messageService:a.messageService}),m.data.operation=="sandbox_iframe-setsize"&&Lg(m.data.settings,{state:a.state,previewHeight:a.state.get("previewHeight"),iframeOffsetTop:a.state.get("iframeOffsetTop"),scrollTop:a.state.get("scrollTop"),globalHolder:ge,setBlockGroupControlsPosition:yo,messageService:a.messageService}),m.data.operation=="sandbox_atom-insert"&&Xu({action:m.data.action,atomHTML:m.data.settings?.atomHTML,name:m.data.settings?.name},{state:a.state,commit:F,lockEditor:a.state.get("lockEditor"),emailWidth:a.state.get("emailWidth"),iframeOffsetTop:a.state.get("iframeOffsetTop"),previewHeight:a.state.get("previewHeight"),parseFromString:a.parseFromString,getOuterHtml:a.getOuterHtml,HTMLDocument:U,minify:a.minifyStylesheet,cssbeautify,insertAdjacentHTML:a.insertAdjacentHTML,messageService:a.messageService,setDocumentStyles:f=>a.setDocumentStyles(f,{minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U}),setImageWidth:lt,commonStylesApply:Ze,commonStylesApplyToBlock:Je,insertCountdown:at,uptimeCountdown:$t,setBlockMaxWidth:bt,setFloatBlocksWidth:Ge,fitImagesToColumns:a.fitImagesToColumns,checkBlockAdaptivity:ht,setAtomReplaced:f=>{nt=f}}),m.data.operation=="sandbox_block-insert"&&Qu({action:m.data.action,blockHTML:m.data.settings?.blockHTML,type:m.data.settings?.type,project:m.data.settings?.project,name:m.data.settings?.name,blockId:m.data.settings?.blockId},{state:a.state,commit:F,lockEditor:a.state.get("lockEditor"),emailWidth:a.state.get("emailWidth"),iframeOffsetTop:a.state.get("iframeOffsetTop"),previewHeight:a.state.get("previewHeight"),parseFromString:a.parseFromString,getOuterHtml:a.getOuterHtml,HTMLDocument:U,minify:a.minifyStylesheet,cssbeautify,insertAdjacentHTML:a.insertAdjacentHTML,messageService:a.messageService,setDocumentStyles:f=>a.setDocumentStyles(f,{minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U}),setImageWidth:lt,commonStylesApply:Ze,commonStylesApplyToBlock:Je,insertCountdown:at,uptimeCountdown:$t,setBlockMaxWidth:bt,setFloatBlocksWidth:Ge,fitImagesToColumns:a.fitImagesToColumns,checkBlockAdaptivity:ht}),m.data.operation=="sandbox_global_block_replace"&&Ju({emBlockId:m.data.settings?.emBlockId,blockHTML:m.data.settings?.blockHTML,type:m.data.settings?.type,project:m.data.settings?.project,name:m.data.settings?.name},{state:a.state,commit:F,lockEditor:a.state.get("lockEditor"),emailWidth:a.state.get("emailWidth"),iframeOffsetTop:a.state.get("iframeOffsetTop"),previewHeight:a.state.get("previewHeight"),parseFromString:a.parseFromString,getOuterHtml:a.getOuterHtml,HTMLDocument:U,minify:a.minifyStylesheet,cssbeautify,insertAdjacentHTML:a.insertAdjacentHTML,messageService:a.messageService,setDocumentStyles:f=>a.setDocumentStyles(f,{minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U}),setImageWidth:lt,commonStylesApply:Ze,commonStylesApplyToBlock:Je,insertCountdown:at,uptimeCountdown:$t,setBlockMaxWidth:bt,setFloatBlocksWidth:Ge,fitImagesToColumns:a.fitImagesToColumns,checkBlockAdaptivity:ht})}),document.addEventListener("click",()=>{}),document.addEventListener("click",function(m){a.state.get("lockEditor")||tf(m,{lockEditor:a.state.get("lockEditor"),commit:F,atomDropCtx:{messageService:a.messageService,isJsonString:a.isJsonString,getOuterHtml:a.getOuterHtml,minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U,_setDocumentStyles:a.setDocumentStyles,commonStylesApply:Ze,commonStylesApplyToBlock:Je,setImageWidth:lt,setFloatBlocksWidth:Ge,fitImagesToColumns:a.fitImagesToColumns,insertCountdown:at,mutableState:{atomReplaced:nt}},blockDropCtx:{lockEditor:a.state.get("lockEditor"),state:a.state,commit:F,messageService:a.messageService,emailWidth:a.state.get("emailWidth"),parseFromString:a.parseFromString,getOuterHtml:a.getOuterHtml,isJsonString:a.isJsonString,isTableElement:a.isTableElement,insertAdjacentHTML:a.insertAdjacentHTML,minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U,commonStylesApplyToBlock:Je,commonStylesApply:Ze,uptimeCountdown:$t,setBlockMaxWidth:bt,setFloatBlocksWidth:Ge,checkBlockAdaptivity:ht,setImageWidth:lt,insertCountdown:at,_setDocumentStyles:a.setDocumentStyles,applicationElementSettingsSet:ae,mutableState:{atomReplaced:nt}}})},!0),document.onmouseover=bg({getVisibleNode:m=>U.getVisibleNode(m),isInExternal:m=>U.isInExternal(m),isVisible:m=>ne.isVisible(m),incrementActiveElementLocked:()=>a.state.increment("activeElementLocked"),decrementActiveElementLocked:()=>a.state.decrement("activeElementLocked"),getLockEditorInit:()=>a.state.get("lockEditorInit"),getIsLeftButtonDown:()=>po,getLoadStylesTimer:()=>wi,hasTextNodeInElement:a.hasTextNodeInElement,wrapEditor:vg,implementElementsEditors:Ng,implementResizableElems:Hg,commit:F}),document.onmouseleave=function(){Mi(),document.querySelectorAll('[em="group"] .em-element-editor, .em-element-path, .em-element-block-add').forEach(m=>{m.remove(),F(!1)})},document.addEventListener("mousedown",function(m){m.shiftKey||m.button===2||window.getSelection()?.removeAllRanges(),m.button===0&&(po=!0,a.state.set("isLeftButtonDown",!0))}),document.addEventListener("mouseup",function(m){m.button===0&&(po=!1,a.state.set("isLeftButtonDown",!1))}),document.addEventListener("dragend",function(m){m.button===0&&(po=!1,a.state.set("isLeftButtonDown",!1))});const l=()=>({parseFromString:a.parseFromString,HTMLDocument:U,commit:F,implementElementEditor:Bi,setCursorPosition:be,scrollTop:a.state.get("scrollTop")}),s=()=>({parseFromString:a.parseFromString,HTMLDocument:U,commit:F,implementElementEditor:Bi,setCursorPosition:be,scrollTop:a.state.get("scrollTop"),iframeOffsetTop:a.state.get("iframeOffsetTop"),applicationElementSettingsSet:ae});document.onclick=fg({getLockEditor:()=>a.state.get("lockEditor"),setEditorFocus:Sg,setCursorPosition:be,getParentElementOfSelection:a.getParentElementOfSelection$1,findOutermostParentWithText:a.findOutermostParentWithText,setBlockGroupControlsPosition:yo,applicationElementSettingsSet:ae,insertTextAtomIntoEmptyNarrowTable:_g,handleRemoveAtom:m=>a.handleRemoveAtom(m,{getElementParent:Sn,setCursorPosition:be,getVariableByIcon:a.getVariableByIcon,commit:F}),handleCloneAtom:m=>a.handleCloneAtom(m,l()),handleMoveBlockUp:m=>a.handleMoveBlockUp(m,l()),handleMoveBlockDown:m=>a.handleMoveBlockDown(m,l()),handleRemoveBlock:m=>a.handleRemoveBlock(m,l()),handleCloneBlock:m=>a.handleCloneBlock(m,l()),handleCopyBlock:(m,f)=>mg(m,f,{HTMLDocument:U}),handlePasteBlock:(m,f)=>ug(m,f,{HTMLDocument:U,parseFromString:a.parseFromString,getOuterHtml:a.getOuterHtml,minify:a.minifyStylesheet,cssbeautify,insertAdjacentHTML:a.insertAdjacentHTML,setBlockMaxWidth:bt,setFloatBlocksWidth:Ge,checkBlockAdaptivity:ht,commit:F,setCursorPosition:be,emailWidth:a.state.get("emailWidth"),appName:a.state.get("appName")}),handleMergeBlocks:m=>a.handleMergeBlocks(m,{...l(),emFilter:a.emFilter}),handleUnmergeBlocks:m=>a.handleUnmergeBlocks(m,l()),isAddBlockMenuClick:a.isAddBlockMenuClick,handleAddBlockMenu:(m,f)=>a.handleAddBlockMenu(m,f,{removeAllAttributes:a.removeAllAttributes,state:a.state,commitLockedAsync:Wt}),addBlockToProject:Rg,handleMoveGroupUp:m=>a.handleMoveGroupUp(m,s()),handleMoveGroupDown:m=>a.handleMoveGroupDown(m,s()),handleAddGroup:m=>a.handleAddGroup(m,s()),handleCloneGroup:m=>a.handleCloneGroup(m,s()),handleRemoveGroup:m=>a.handleRemoveGroup(m,s()),isDiscussViewMode:a.isDiscussViewMode,isDiscussSetTargetMode:a.isDiscussSetTargetMode,handleDiscussViewClick:a.handleDiscussViewClick,handleDiscussSetTargetClick:m=>a.handleDiscussSetTargetClick(m,{makeId:a.makeId,commit:F}),handleEmReplaceClick:(m,f)=>ws(m,f,{isClickAtEndOfEmReplace:a.isClickAtEndOfEmReplace,getOrCreateAfterSpan:a.getOrCreateAfterSpan,setCursorInsideSpan:a.setCursorInsideSpan,_wrapEditor:it,commit:F}),handleCustomTableClick:Ts}),document.addEventListener("mouseup",()=>{}),window.addEventListener("mousemove",function(){a.state.set("lockEditorInit",!1)}),document.addEventListener("keydown",hg({getCursorPositionType:a.getCursorPositionType,getListContext:a.getListContext,LIST_TEMP_CLASSES:a.LIST_TEMP_CLASSES,LIST_REGEX:a.LIST_REGEX,collectVMLContent:Mo,updateVMLComments:Ro,handleVMLButtonText:a.handleVMLButtonText,handleDeleteKey:a.handleDeleteKey,handleEnterForBr:a.handleEnterForBr,handleEnterInList:ua,handleArrowRightInList:ba,handleArrowUpDownInList:ga,handleDeleteInList:ha,handlePreventBulletCellEdit:ya,handleArrowRight:a.handleArrowRight,getElementParent:Sn,setCursorPosition:be,removeElementEditors:Mi,getVariableByIcon:a.getVariableByIcon,removeEmptyParents:a.removeEmptyParents,getAllComments:a.getAllComments,isVariableComment:a.isVariableComment,getVariableIcon:a.getVariableIcon,removeAllAttributes:a.removeAllAttributes,applicationElementSettingsSet:ae,removeTemporaryListClasses:a.removeTemporaryListClasses,findNodeAtPosition:am,setCursorSafely:sm,isCaretAtEndOfEmReplace:a.isCaretAtEndOfEmReplace,getOrCreateAfterSpan:a.getOrCreateAfterSpan,setCursorInsideSpan:a.setCursorInsideSpan,isCaretAtEndOfStandardElement:a.isCaretAtEndOfStandardElement,setCursorPositionSimple:a.setCursorPositionSimple,handlePasteTextFragment:zr,changeMsoValue:Ii,getCommonStyles:()=>a.state.get("commonStyles"),setIsPasteFromContextMenu:m=>{gn=m},wrapEditor:it,messageService:a.messageService,commit:F}),!1),ne.beforeCommit(()=>{try{pn||(pn=!0,a.emFilterCSS())}finally{pn=!1}}),document.addEventListener("click",m=>{m.target?.closest(".em-element-editor-widget-clone")||(document.querySelectorAll('.em-element-editor-widget-clone[data-open="true"]').forEach(f=>{f.setAttribute("data-open","false"),f.querySelector("ul").style.display="none"}),Bg())}),document.addEventListener("drag",function(m){m.preventDefault()},!1);const c={targetBlock:pt,atomReplaced:nt};document.addEventListener("dragstart",function(m){Jd(m,{lockEditor:a.state.get("lockEditor")})},!0),document.addEventListener("dragstart",function(m){ea(m,{lockEditor:a.state.get("lockEditor"),commit:F,messageService:a.messageService,mutableState:c}),nt=c.atomReplaced},!1);const d={targetBlock:pt};document.addEventListener("dragover",function(m){oa(m,{lockEditor:a.state.get("lockEditor"),mutableState:d}),pt=d.targetBlock},!1);const u={targetBlock:pt};document.addEventListener("dragenter",function(m){na(m,{lockEditor:a.state.get("lockEditor"),mutableState:u}),pt=u.targetBlock},!1);const g={targetBlock:pt,newTargetblock:ki};document.addEventListener("dragleave",function(m){ra(m,{lockEditor:a.state.get("lockEditor"),mutableState:g}),ki=g.newTargetblock},!1),document.addEventListener("drop",function(m){if(!a.state.get("lockEditor"))try{if(m.preventDefault(),m.stopPropagation(),Ql(m,{lockEditor:a.state.get("lockEditor"),applicationElementSettingsSet:ae,messageService:a.messageService})||Qd(m,{applicationElementSettingsSet:ae}))return a.state.increment("activeElementLocked"),Qt(),F(),!1;if(a.state.increment("activeElementLocked"),document.body.classList.contains("em-block-insert-body"))try{const f=JSON.parse(m.dataTransfer?.getData("Text")||"{}");Vn(m,f,{lockEditor:a.state.get("lockEditor"),state:a.state,commit:F,messageService:a.messageService,emailWidth:a.state.get("emailWidth"),parseFromString:a.parseFromString,getOuterHtml:a.getOuterHtml,isJsonString:a.isJsonString,isTableElement:a.isTableElement,insertAdjacentHTML:a.insertAdjacentHTML,minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U,commonStylesApplyToBlock:Je,commonStylesApply:Ze,uptimeCountdown:$t,setBlockMaxWidth:bt,setFloatBlocksWidth:Ge,checkBlockAdaptivity:ht,setImageWidth:lt,insertCountdown:at,_setDocumentStyles:a.setDocumentStyles,applicationElementSettingsSet:ae,mutableState:{atomReplaced:nt}})}catch{}else if(document.body.classList.contains("em-atom-insert-body")||document.body.classList.contains("em-atom-insert-body-inside"))try{jn(m,{messageService:a.messageService,isJsonString:a.isJsonString,getOuterHtml:a.getOuterHtml,minify:a.minifyStylesheet,cssbeautify,HTMLDocument:U,_setDocumentStyles:a.setDocumentStyles,commonStylesApply:Ze,commonStylesApplyToBlock:Je,setImageWidth:lt,setFloatBlocksWidth:Ge,fitImagesToColumns:a.fitImagesToColumns,insertCountdown:at,mutableState:{atomReplaced:nt}})}catch{}return Qt(),F(),!1}finally{Promise.resolve().then(()=>{a.state.decrement("activeElementLocked");const f=document.querySelector(".em-just-inserted");if(f){ae({elem:f}),f.classList.remove("em-just-inserted"),F();const p=Nn(f);setTimeout(()=>{a.messageService.send({operation:"application_open-image-ai-popup",src:p})},1e3)}})}},!1),document.addEventListener("dragend",function(m){ta(m,{lockEditor:a.state.get("lockEditor"),messageService:a.messageService})},!1),a.initResizer({applicationElementSettingsSet:m=>ae(m),setCursorPosition:m=>be(m),commit:m=>F(m)}),document.addEventListener("contextmenu",m=>{gn=!!m.target?.nodeName}),document.addEventListener("paste",m=>{gn&&zr(m,!1,a.state.get("commonStyles"),Ii,F)}),document.addEventListener("click",()=>a.messageService.send({operation:"application_focus_in_iframe"}))}var Dg="__emmDiagnostics__",Fg="diagnostics";function qg(){try{const e=new URLSearchParams(window.location.search).get(Fg);return e!==null&&e!=="0"}catch{return!1}}function An(e){try{window.parent.postMessage({mark:Dg,...e},"*")}catch{}}function Wg(){const e=window.performance.getEntriesByType("resource").map(o=>{const t=o;return{name:t.name,initiatorType:t.initiatorType,startTime:t.startTime,responseEnd:t.responseEnd,transferSize:t.transferSize,decodedBodySize:t.decodedBodySize}});An({type:"resources",timeOrigin:window.performance.timeOrigin,items:e})}function yt(){return window.performance.timeOrigin+window.performance.now()}function $g(){return Array.from(document.images).every(e=>e.complete)}function zg(e,o){const n=window.setInterval(()=>{!$g()||yt()-e()<500||(window.clearInterval(n),An({type:"settled",at:Math.max(e(),o)}),Wg())},100)}function Vg(){if(!qg()||typeof MutationObserver!="function")return;let e=!1,o=yt();new MutationObserver(()=>{o=yt(),!e&&(e=!0,window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const t=yt();An({type:"paint",at:t}),zg(()=>o,t)})}))}).observe(document.documentElement,{childList:!0,subtree:!0,characterData:!0}),window.addEventListener("load",()=>{o=yt()}),document.addEventListener("load",()=>{o=yt()},!0)}var Ug=500,jg=300,zt,Eo=!1;function Oi(){if(Eo)return;Eo=!0;let e=!1;const o=window.setTimeout(()=>{e||(e=!0,zt=!1,Eo=!1)},jg);window.requestAnimationFrame(()=>{e||(e=!0,window.clearTimeout(o),zt=!0,Eo=!1)})}function Gg(){return zt===!1?(Oi(),Promise.resolve()):new Promise(e=>{let o=!1;const t=()=>{o||(o=!0,e())},n=window.setTimeout(()=>{zt=!1,t()},Ug);window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{window.clearTimeout(n),zt=!0,t()})})})}var Yg=1;function Kg(){Oi();const e=async(o,t)=>{await t?.(o),await Gg()};a.messageService.addListenerAsync(a.EVENT_TYPES.SANDBOX_INITED,e,Yg)}var Xg=16,xi=100,Zg=.95,Di=.02;function Fi(e,o){return o===WheelEvent.DOM_DELTA_LINE?e*Xg:o===WheelEvent.DOM_DELTA_PAGE?e*window.innerHeight:e}function qi(e,o,t){if(t===0)return!1;const n=getComputedStyle(e),r=o==="y"?n.overflowY:n.overflowX;if(r!=="auto"&&r!=="scroll"&&r!=="overlay")return!1;const i=o==="y"?e.scrollTop:Math.abs(e.scrollLeft),l=o==="y"?e.scrollHeight-e.clientHeight:e.scrollWidth-e.clientWidth;return l<=0?!1:(o==="x"&&e.scrollLeft<0?-t:t)>0?i<l-.5:i>.5}function Wi(e,o,t){const n=document.scrollingElement??document.documentElement;for(let r=e instanceof Element?e:null;r;r=r.parentElement){if(r===n||r===document.body)return!1;if(qi(r,"y",t)||qi(r,"x",o))return!0}return!1}function Jg(){let e=0,o=0,t=!1;const n=()=>{t=!1;const g=e,m=o;e=0,o=0,!(g===0&&m===0)&&a.messageService.send(a.EVENT_TYPES.SANDBOX_WHEEL,{deltaX:g,deltaY:m})},r=(g,m)=>{e+=g,o+=m,t||(t=!0,window.requestAnimationFrame(n))};window.addEventListener("wheel",g=>{g.ctrlKey||Wi(g.target,g.deltaX,g.deltaY)||(g.preventDefault(),r(Fi(g.deltaX,g.deltaMode),Fi(g.deltaY,g.deltaMode)))},{passive:!1});let i,l=!1,s={x:0,y:0},c;const d=()=>{c!==void 0&&(window.cancelAnimationFrame(c),c=void 0)},u=()=>{let{x:g,y:m}=s,f=performance.now();const p=b=>{const h=b>f?Math.min(b-f,50):16;f=b;const y=Math.pow(Zg,h/16);if(g*=y,m*=y,Math.abs(g)<Di&&Math.abs(m)<Di){c=void 0;return}r(g*h,m*h),c=window.requestAnimationFrame(p)};c=window.requestAnimationFrame(p)};window.addEventListener("touchstart",g=>{d(),l=!1,s={x:0,y:0};const m=g.touches.length===1?g.touches[0]:void 0;i=m?{x:m.screenX,y:m.screenY,at:g.timeStamp}:void 0},{passive:!0}),window.addEventListener("touchmove",g=>{const m=g.touches.length===1?g.touches[0]:void 0;if(!m||!i){i=void 0,l=!1;return}const f=i.x-m.screenX,p=i.y-m.screenY,b=g.timeStamp-i.at;if(i={x:m.screenX,y:m.screenY,at:g.timeStamp},!Wi(g.target,f,p)){if(g.cancelable&&g.preventDefault(),l=!0,b>0){const h=Math.min(b/xi,1);s={x:s.x*(1-h)+f/b*h,y:s.y*(1-h)+p/b*h}}r(f,p)}},{passive:!1}),window.addEventListener("touchend",g=>{const m=i?g.timeStamp-i.at:1/0;l&&g.touches.length===0&&m<xi&&u(),i=void 0,l=!1},{passive:!0}),window.addEventListener("touchcancel",()=>{i=void 0,l=!1})}Vg(),xg(),Kg(),Jg()});
|