useblocks 1.1.85-dev.2 → 1.1.85-dev.3

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.
Files changed (43) hide show
  1. package/iframe/.vite/manifest.json +4 -4
  2. package/iframe/js/{discussHandlers.BtCUuj58.js → discussHandlers.BxlCsZ-4.js} +2 -2
  3. package/iframe/js/iframe-eblock.body.js +1 -1
  4. package/iframe/js/iframe-eblock.js +1 -1
  5. package/iframe/js/iframe.body.js +2 -2
  6. package/iframe/js/iframe.js +1 -1
  7. package/node_modules/useblocks-ui-kit/package.json +1 -1
  8. package/package.json +2 -2
  9. package/runtime/react/index.js +1 -1
  10. package/static/core/{ef3477dd.js → 14a79b09.js} +1 -1
  11. package/static/core/{6c7df338.js → 199dc589.js} +1 -1
  12. package/static/core/{ca873214.js → 230f23ec.js} +1 -1
  13. package/static/core/{181088a9.js → 30f16e98.js} +1 -1
  14. package/static/core/{6fdfa46d.js → 34730be9.js} +1 -1
  15. package/static/core/{9b7f52a5.js → 364dcebf.js} +1 -1
  16. package/static/core/{43affb86.js → 4916b3a1.js} +1 -1
  17. package/static/core/{c789db17.js → 4f790fdc.js} +1 -1
  18. package/static/core/{d74b0853.js → 520ec797.js} +3 -3
  19. package/static/core/{2639f789.js → 57c114f0.js} +1 -1
  20. package/static/core/{cab426fa.js → 5bf994b4.js} +1 -1
  21. package/static/core/{13563d2c.js → 6541580a.js} +1 -1
  22. package/static/core/{a72f1f53.js → 79431a89.js} +1 -1
  23. package/static/core/{b502ca96.js → 8fb0fe48.js} +1 -1
  24. package/static/core/{fad0a613.js → 9a70cc1e.js} +1 -1
  25. package/static/core/{6589e3b8.js → a15ab67d.js} +1 -1
  26. package/static/core/{576452f9.js → adf6e008.js} +1 -1
  27. package/static/core/{f0f90842.js → b743a76d.js} +1 -1
  28. package/static/core/{c6d342f2.js → b97bd382.js} +6 -6
  29. package/static/core/{92e10a15.js → ddb5a35d.js} +1 -1
  30. package/static/core/{70b2c337.js → dfddbd68.js} +1 -1
  31. package/static/core/{6eeae572.js → f3eda1c7.js} +1 -1
  32. package/static/core/{5f0c0e3a.js → ffb36e93.js} +1 -1
  33. package/static/umd-runtime/runtime.js +1 -1
  34. package/{useblocks-core.4865197d.js → useblocks-core.168aeeb1.js} +8 -8
  35. package/useblocks-esm.js +6 -6
  36. package/{useblocks-po.4865197d.js → useblocks-po.168aeeb1.js} +1 -1
  37. package/useblocks.js +6 -6
  38. package/vite/index.cjs +99 -3
  39. package/vite/index.js +99 -3
  40. package/webpack/index.cjs +93 -0
  41. package/webpack/index.js +93 -0
  42. /package/iframe/{iframe-eblock.4865197d.html → iframe-eblock.168aeeb1.html} +0 -0
  43. /package/iframe/{iframe.4865197d.html → iframe.168aeeb1.html} +0 -0
@@ -1,4 +1,4 @@
1
- __useblocks__.define("js/iframe-eblock.js",["require","exports","module","js/discussHandlers.BtCUuj58.js","js/typograf.all.BbXdyfMT.js"],function(Me,Ct,Pt){const o=Me("./discussHandlers.BtCUuj58.js"),qe=Me("./typograf.all.BbXdyfMT.js");function et(e){const i=new Map,t=[],l=[],n=[];for(const d of e)if(d instanceof HTMLLinkElement)d.getAttribute("em-class")?.startsWith("em-font-")&&l.push(d);else if(d instanceof HTMLStyleElement){const m=d.getAttribute("em")||"",a=i.get(m);a?a.push(d):i.set(m,[d])}else if(d instanceof Element)if(d.getAttribute("em")==="block")t.push(d);else{const m=d.querySelector("[em='block']");m&&t.push(m)}else d.textContent===`
1
+ __useblocks__.define("js/iframe-eblock.js",["require","exports","module","js/discussHandlers.BxlCsZ-4.js","js/typograf.all.BbXdyfMT.js"],function(Me,Ct,Pt){const o=Me("./discussHandlers.BxlCsZ-4.js"),qe=Me("./typograf.all.BbXdyfMT.js");function et(e){const i=new Map,t=[],l=[],n=[];for(const d of e)if(d instanceof HTMLLinkElement)d.getAttribute("em-class")?.startsWith("em-font-")&&l.push(d);else if(d instanceof HTMLStyleElement){const m=d.getAttribute("em")||"",a=i.get(m);a?a.push(d):i.set(m,[d])}else if(d instanceof Element)if(d.getAttribute("em")==="block")t.push(d);else{const m=d.querySelector("[em='block']");m&&t.push(m)}else d.textContent===`
2
2
  `&&n.push(d);const s=[];for(const d of l)s.push(d);for(const[d,m]of i)if(m.length>1){let a=o.minifyStylesheet(m.map(r=>r.innerHTML).join(`
3
3
  `),{restructure:!0,forceMediaMerge:!0}).css;if(a=cssbeautify(a,{indent:" ",autosemicolon:!0}),a){const r=document.createElement("style");r.innerHTML=`
4
4
  ${a}
@@ -2,6 +2,6 @@ var e=window.__useblocks__||(window.__useblocks__={});(function(){"use strict";i
2
2
 
3
3
  __useblocks__.require.config({ paths: {"js/iframe-eblock.js":"js/iframe-eblock.body.js"} });
4
4
 
5
- __useblocks__.require.config({"graph":{"js/iframe-eblock.js":["js/discussHandlers.BtCUuj58.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.BtCUuj58.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.BtCUuj58.js":["js/rolldown-runtime.BRlIiq3h.js"],"js/rolldown-runtime.BRlIiq3h.js":[],"js/rules.CL_BitCE.js":[],"js/typograf.all.BbXdyfMT.js":["js/rolldown-runtime.BRlIiq3h.js"]}});
5
+ __useblocks__.require.config({"graph":{"js/iframe-eblock.js":["js/discussHandlers.BxlCsZ-4.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.BxlCsZ-4.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.BxlCsZ-4.js":["js/rolldown-runtime.BRlIiq3h.js"],"js/rolldown-runtime.BRlIiq3h.js":[],"js/rules.CL_BitCE.js":[],"js/typograf.all.BbXdyfMT.js":["js/rolldown-runtime.BRlIiq3h.js"]}});
6
6
 
7
7
  __useblocks__.require("js/iframe-eblock.js");
@@ -1,4 +1,4 @@
1
- __useblocks__.define("js/iframe.js",["require","exports","module","js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.BtCUuj58.js"],function(Lo,Ag,Tg){const xi=Lo("./rolldown-runtime.BRlIiq3h.js"),a=Lo("./discussHandlers.BtCUuj58.js");var Ct=null;function wo(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 Di(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:Kt(n),nodes:[...n],startIndex:r,endIndex:l-1}),n=[],r=l+1):n.push(i)}),n.length>0&&o.push({html:Kt(n),nodes:[...n],startIndex:r,endIndex:t.length-1}),o}function Fi(e){const o=[],t=Array.from(e.childNodes);let n=[],r=0;const i=s=>{n.length>0&&(o.push({html:Kt(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:Kt([s]),nodes:[s],startIndex:c,endIndex:c}),r=c+1):n.push(s)}),i(t.length),o}function Kt(e){const o=document.createElement("div");return e.forEach(t=>o.appendChild(t.cloneNode(!0))),o.innerHTML}function ko(e,o){const t=wo(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 vn(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 qi(e,o){const t=window.getSelection();if(!t||t.rangeCount===0){const s=ko(e,o);return{start:s,end:s}}const n=t.getRangeAt(0);if(n.collapsed){const s=ko(e,o);return{start:s,end:s}}const r=ko(e,o),i=vn(e,n.startContainer,o,r),l=vn(e,n.endContainer,o,r);return{start:Math.min(i,l),end:Math.max(i,l)}}function Wi(e){return e.querySelector("br")!==null}function $i(e){const o=wo(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 zi(e){const o=wo(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),p=c(l),m=n>=r.length;if(!(d&&u||d&&m||n===0&&u||d&&p))return;let f;p?(f=l,f.data=" "):(f=document.createTextNode(" "),l?e.insertBefore(f,l):e.appendChild(f));const g=window.getSelection();if(g){const b=document.createRange();b.setStart(f,0),b.collapse(!0),g.removeAllRanges(),g.addRange(b)}Ct={container:f,offset:0}}function Vi(e,o){const t=o?"ol":"ul";if(e.querySelector("ol, ul")){const n=$i(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}}Wi(e)||e.querySelector(":scope > ol, :scope > ul")?(zi(e),Ui(e,t)):An(e,t)}function An(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="&nbsp;",t.appendChild(n),e.innerHTML="",e.appendChild(t),Tn(n)}function Ui(e,o){const t=Fi(e);if(t.length===0){An(e,o);return}const{start:n,end:r}=qi(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()||"&nbsp;",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&&Tn(l)}function Tn(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 ji(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 Gi(e,o){const t=Di(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 Yi(e){const o=e.querySelector("ol, ul");if(!o)return;const t=ji(e,o),n=o.querySelectorAll("li"),r=[];n.forEach(l=>{const s=l.innerHTML.trim();s&&s!=="&nbsp;"&&r.push(s)});const i=r.join("<br>");i?o.outerHTML=i:o.outerHTML="&nbsp;",Gi(e,t)}function Xt(e){if(!e)return!1;const o=e.closest("ul, ol");return o?!o.closest(a.TABLE_LIST_SELECTOR):!1}function Zt(e,o){const t=a.resolveActiveElement(e.elem),n=t.getAttribute("src"),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=p=>p===null||p==="auto"?null:typeof p=="number"?p:null,u={type:s,caption:c,src:n??"",width:Ln(t,"width"),height:Ln(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 p=e.elem.getAttribute("em-video-settings");if(p)try{u.video=JSON.parse(p.replaceAll("'",'"'))}catch{u.video={}}}return a.isShowOnMobile(e.elem)&&(u.showOnMobile=!0),i&&(u.maxWidth=Math.round(i.getBoundingClientRect().width)),u}function Ln(e,o){const t=e.getAttribute(o);return!t||t==="auto"?{value:null,dim:"px"}:{value:parseFloat(t),dim:t.includes("%")?"%":"px"}}function wn(e){return e.tagName==="IMG"||e.tagName==="AMP-IMG"}var kn="em-mob-text_align-",Ki=":scope > tr > td, :scope > tbody > tr > td",Xi='div[style*="font-family"][style*="font-size"]';function _o(e){return e.querySelector(Ki)}function No(e){return e.querySelector(Xi)}function _n(e){const o=e.closest('table[em="atom"]');if(!o)return null;const t=_o(o);return t?{atomTd:t,textDiv:No(t)}:null}function vt(e){const o=e.closest("div, p, td");if(!o)return null;if(o.style.textAlign)return o;const t=_n(e);return t?t.textDiv?.hasAttribute("align")?t.textDiv:t.atomTd:o}function Nn(e){const o=vt(e);return o&&(o.style.textAlign||o.getAttribute("align"))||"left"}function Zi(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 Bo(e){return{value:Zi(e)}}function Ji(e,o,t=kn){const n=_n(e);if(n)for(const r of[n.atomTd,n.textDiv])r&&r!==o&&a.removeClassesByPrefix(r,t)}function Qi(e){const o=_o(e);if(!o)return null;const t=No(o);return t?.hasAttribute("align")?t:o}function el(e,o){e.querySelectorAll('[em="atom"]').forEach(t=>{const n=Qi(t);n&&o(n,t)})}function tl(e,o,t=kn){const n=_o(e),r=n?No(n):null;for(const i of[n,r])i&&i!==o&&a.removeClassesByPrefix(i,t)}function Jt(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"]')||n.closest('[style*="font-size"]')||n,d=n.closest('[class*="em-mob-line_height"]')||n.closest('[style*="line-height"]')||n,u=a.getElementMobileProps({elem:c}),p=a.getElementMobileProps({elem:d}),m=Bn(e.elem,t),f=a.textHasStyle$1(r,"strong","b"),g=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||g||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:Nn(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:il(e.elem),mobileFontSize:{value:u.mobileFontSize,dim:u.mobileFontSizeDim||"px"},mobileLineHeight:{value:p.mobileLineHeight,dim:"px"},mobileTextAlign:Bo(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:Mn(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 Bn(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|&nbsp;/g,""):""}}function Mn(e){return Xt(e)?{listTypeOL:!!e.querySelector("ol")||!!e.closest("ol"),listTypeUL:!!e.querySelector("ul")||!!e.closest("ul")}:{listTypeOL:!1,listTypeUL:!1}}function Mo(e){if(!e)return!1;const o=e.trim().toLowerCase();return o!=="transparent"&&o!=="inherit"}var ol=new Set(["A","B","EM","I","MARK","S","SMALL","SPAN","STRIKE","STRONG","SUB","SUP","U"]);function nl(e){let o=e;for(;o&&ol.has(o.tagName);){const t=o.style.backgroundColor;if(Mo(t))return t;o=o.parentElement}return""}function rl(e,o,t){let n=e;for(;n;){const r=n.style.getPropertyValue(o);if(Mo(r))return r;if(t&&n===t)break;n=n.parentElement}return""}function il(e){const o=nl(e);if(Mo(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(rl(e,"background-color",t))||""}function ll(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 al(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,p=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:p}),g=a.getElementMobileProps({elem:m}),b=Bn(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:Nn(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:g.mobileLineHeight,dim:"px"},mobileTextAlign:Bo(e.elem),textReplacer:i(e.elem),list:b,standardList:Mn(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 Ro(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+=Ro(t)}),o}function Po(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=>Po(n,o,t))}function sl(e,o){const t=e.getAttribute(o);return!t||t==="auto"?{value:null,dim:"px"}:{value:parseFloat(t),dim:t.includes("%")?"%":"px"}}function Rn(e,o){const t=e.style[o];return t?{value:parseFloat(t),dim:t.includes("%")?"%":"px"}:{value:null,dim:"px"}}function cl(e){return e===null||e==="auto"?null:typeof e=="number"?e:null}function dl(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 ml(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:dl(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:sl(t,"width"),maxWidth:Rn(t,"maxWidth"),minWidth:Rn(t,"minWidth"),align:t.getAttribute("align")??"",border:a.getElementBorder(t),boxShadow:a.getElementBoxShadow(t),borderRadius:a.getElementBorderRadius(t),mobileWidth:{value:cl(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,exportAsPicture:t.getAttribute("em-operation")==="exportAsPicture",outlookBackground:a.hasElementVMLBackground(t,"around")};return a.isShowOnMobile(t)&&(r.showOnMobile=!0),r}function ul(e){return e.tagName==="TABLE"&&e.getAttribute("em")!=="atom"}function fl(e){return e.closest("em-replace")?.getAttribute("text")||null}var pl=()=>a.isInitialized()?a.getHtmlDocument():null,gl=()=>a.state.get("isProgrammaticSelection");function bl(e){if(!a.isElementLocked())try{a.incrementLock(),a.removeAllAttributes("em-edit");let o={};if(!e.elem)return;const t=hl(e.elem);if(!t)return;e.elem=t;const n=yl(e.elem);document.body.classList.contains("mceNonEditable")||El(e.elem),o=vl(e,n),o.type&&(o.operation="application_element_settings_set",a.messageService.send(o))}finally{a.decrementLock()}}function hl(e){const o=pl();return!o||!o.getMappedParent(e)?e:o.getVisibleNode(e)}function yl(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 Ho(e){return{variableElement:fl,requestElemBullet:e.bulletElem,isElementListOL:e.isElementListOL,isElementListUL:e.isElementListUL,isElementList:e.isElementList}}function El(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"),Sl(e)),Cl(e))}function Sl(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 Cl(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 vl(e,o){const t=e.elem;if(!(window.getSelection()?.isCollapsed??!0)&&!t.closest("a")&&!gl()&&!o.isCellCustomTable){const n=Ho(o);return{type:"text",caption:Locale.TEXT,settings:Jt(e,Locale,n)}}if(t.closest("amp-carousel"))return Al(e);if(t.tagName==="AMP-ACCORDION")return Tl(e);if(wn(t))return{type:Zt(e,Locale).type,caption:Zt(e,Locale).caption,settings:Zt(e,Locale)};if(!o.isCellCustomTable&&(t.tagName==="A"||t.tagName==="EM-REPLACE"&&t.closest("a")))return Ll(e,o);if(t.tagName==="TABLE"&&t.getAttribute("em")!=="atom")return wl(e);if(t.tagName==="LI"&&Xt(t)){const n=Ho(o);return{type:"text",caption:Locale.TEXT,settings:Jt(e,Locale,n)}}return o.isCellCustomTable?kl(e):t.tagName==="TD"?_l(e):t.closest(".em-vindent")?Nl(e):t.classList.contains("em-floatblock")||t.closest(".em-floatblock")?Bl(e):t.tagName==="DIV"?Ml(e,o):t.getAttribute("em")==="block"?Rl(e):{}}function Al(e){return{type:"carousel",caption:Locale.CAROUSEL,settings:{}}}function Tl(e){return{type:"accordion",caption:Locale.ACCORDION,settings:{}}}function Ll(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=Ho(o);return{type:"text",caption:Locale.TEXT,settings:Jt(e,Locale,n)}}function wl(e){return e.elem.innerHTML===""?{type:"emptyTable",settings:{}}:{type:"table",caption:Locale.TABLE,settings:{}}}function kl(e){return{type:"customTable",caption:Locale.TABLE,settings:{}}}function _l(e){return{type:"td",caption:Locale.TABLE_COLUMN,settings:{}}}function Nl(e){return{type:"vindent",caption:Locale.VERTICAL_INDENT,settings:{}}}function Bl(e){return{type:"floatBlock",caption:Locale.FLOAT_BLOCK,settings:{}}}function Ml(e,o){return{type:"div",caption:Locale.CONTAINER,settings:{}}}function Rl(e){return{type:"structure",caption:Locale.STRUCTURE,settings:{}}}var Lg=Promise.resolve();function At(e){return!(!e.startsWith("#")||e.indexOf("#",1)!==-1)}var Pl=["em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"],Hl=["em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top"],Il=["em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"];function Pn(){document.querySelectorAll(".em-block-insert").forEach(e=>{e.classList.remove(...Pl)})}function Ol(){document.querySelectorAll(".em-atom-insert").forEach(e=>{e.classList.remove(...Hl)})}function Qt(){document.querySelectorAll(".em-blockatom-insert").forEach(e=>{e.classList.remove(...Il)})}function Io(e,o){const t=e.getBoundingClientRect();return o>t.top+t.height/2?"bottom":"top"}function Hn(e,o){const t=e.getBoundingClientRect(),n=document.body.getBoundingClientRect();return o==="bottom"?t.bottom>n.height-21:t.top<2}function Oo(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=Hn(e,"bottom")?`${n}_bottom-document`:`${n}_bottom`;e.classList.add(i)}else{e.classList.remove(`${n}_bottom`,`${n}_bottom-document`);const i=Hn(e,"top")?`${n}_top-document`:`${n}_top`;e.classList.add(i)}}function xo(e){return e.tagName==="TABLE"&&!e.innerHTML}function eo(e){return e.tagName==="TABLE"||e.tagName==="TR"?e.querySelector("[data-template-content]")??e.querySelector("td"):e}function In(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 xl(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 Dl(e){const o=In(e.dataTransfer?.files??null);return o||xl(e.dataTransfer??null)}function Do(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 Fo(e){if(!Tt(e))return!1;const o=e.dataTransfer;if(!o)return!1;if(o.files?.length)return!!In(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 On="em-native-img-drop-target",qo="em-native-img-uploading",Fl="em-native-img-drop-loading",to="em-native-file-drag",Lt=null,Qe=null;function xn(){Qe&&(window.removeEventListener("scroll",Qe.reposition,!0),window.removeEventListener("resize",Qe.reposition),Qe.resizeObserver?.disconnect(),Qe.overlay.remove(),Qe=null)}function ql(e){xn();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)),Qe={overlay:o,reposition:n,resizeObserver:r}}function Wo(){Lt&&(Lt.classList.remove(On),Lt=null)}function et(){document.body.classList.remove(to),Wo()}function Wl(e){if(!Tt(e)){et();return}if(!Fo(e)){et();return}document.body.classList.add(to);const o=Do(e);if(!o){Wo();return}Lt!==o&&(Wo(),Lt=o,o.classList.add(On))}function Dn(){xn(),document.body.classList.remove(Fl),document.body.classList.remove(to),document.querySelectorAll(`.${qo}`).forEach(e=>{e.classList.remove(qo)})}function $l(e,o){if(o.lockEditor||!Tt(e))return!1;const t=Dl(e);if(!t)return!1;const n=Do(e);return n?(o.applicationElementSettingsSet({elem:n}),et(),n.classList.add(qo),ql(n),o.messageService.send({operation:a.EVENT_TYPES.APPLICATION_NATIVE_IMAGE_DROP,file:t}),!0):!1}function zl(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 Vl(e,o){o.lockEditor||(et(),e.preventDefault(),o.messageService.send({operation:"application_scroll-block-hide"}))}function Ul(e,o){if(e.preventDefault(),o.lockEditor){et();return}Tt(e)?(Fo(e)&&Do(e)&&(e.dataTransfer.dropEffect="copy"),Wl(e)):et();const t=e.target;if(document.body.classList.contains("em-block-insert-body")){const n=xo(t)?null:t.closest('[em="block"]');if(n){o.mutableState.targetBlock=n;const r=eo(n);r&&Oo(r,Io(r,e.pageY),"block")}else Pn()}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,Oo(n,Io(n,e.pageY),"atom"),Qt();else if(t.closest('[em="block"]')&&t.tagName==="TD"&&!t.innerHTML&&!t.hasAttribute("height")||t.tagName==="DIV"&&t.closest("amp-accordion")&&!t.innerHTML)Qt();else{const r=t.closest('[em="block"]');if(r){o.mutableState.targetBlock=r;const i=eo(r);i&&(Oo(i,Io(i,e.pageY),"blockatom"),Ol())}}}}function jl(e,o){if(o.lockEditor)return;Tt(e)&&Fo(e)&&document.body.classList.add(to);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"]');xo(t)?(t.classList.add("em-block-insert-empty"),Pn()):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"]');xo(t)?(t.classList.add("em-block-insert-empty"),Qt()):r?o.mutableState.targetBlock=r:Qt()}}function Gl(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 Yl(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.BxlCsZ-4.js"],function(Lo,Ag,Tg){const xi=Lo("./rolldown-runtime.BRlIiq3h.js"),a=Lo("./discussHandlers.BxlCsZ-4.js");var Ct=null;function wo(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 Di(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:Kt(n),nodes:[...n],startIndex:r,endIndex:l-1}),n=[],r=l+1):n.push(i)}),n.length>0&&o.push({html:Kt(n),nodes:[...n],startIndex:r,endIndex:t.length-1}),o}function Fi(e){const o=[],t=Array.from(e.childNodes);let n=[],r=0;const i=s=>{n.length>0&&(o.push({html:Kt(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:Kt([s]),nodes:[s],startIndex:c,endIndex:c}),r=c+1):n.push(s)}),i(t.length),o}function Kt(e){const o=document.createElement("div");return e.forEach(t=>o.appendChild(t.cloneNode(!0))),o.innerHTML}function ko(e,o){const t=wo(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 vn(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 qi(e,o){const t=window.getSelection();if(!t||t.rangeCount===0){const s=ko(e,o);return{start:s,end:s}}const n=t.getRangeAt(0);if(n.collapsed){const s=ko(e,o);return{start:s,end:s}}const r=ko(e,o),i=vn(e,n.startContainer,o,r),l=vn(e,n.endContainer,o,r);return{start:Math.min(i,l),end:Math.max(i,l)}}function Wi(e){return e.querySelector("br")!==null}function $i(e){const o=wo(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 zi(e){const o=wo(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),p=c(l),m=n>=r.length;if(!(d&&u||d&&m||n===0&&u||d&&p))return;let f;p?(f=l,f.data=" "):(f=document.createTextNode(" "),l?e.insertBefore(f,l):e.appendChild(f));const g=window.getSelection();if(g){const b=document.createRange();b.setStart(f,0),b.collapse(!0),g.removeAllRanges(),g.addRange(b)}Ct={container:f,offset:0}}function Vi(e,o){const t=o?"ol":"ul";if(e.querySelector("ol, ul")){const n=$i(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}}Wi(e)||e.querySelector(":scope > ol, :scope > ul")?(zi(e),Ui(e,t)):An(e,t)}function An(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="&nbsp;",t.appendChild(n),e.innerHTML="",e.appendChild(t),Tn(n)}function Ui(e,o){const t=Fi(e);if(t.length===0){An(e,o);return}const{start:n,end:r}=qi(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()||"&nbsp;",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&&Tn(l)}function Tn(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 ji(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 Gi(e,o){const t=Di(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 Yi(e){const o=e.querySelector("ol, ul");if(!o)return;const t=ji(e,o),n=o.querySelectorAll("li"),r=[];n.forEach(l=>{const s=l.innerHTML.trim();s&&s!=="&nbsp;"&&r.push(s)});const i=r.join("<br>");i?o.outerHTML=i:o.outerHTML="&nbsp;",Gi(e,t)}function Xt(e){if(!e)return!1;const o=e.closest("ul, ol");return o?!o.closest(a.TABLE_LIST_SELECTOR):!1}function Zt(e,o){const t=a.resolveActiveElement(e.elem),n=t.getAttribute("src"),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=p=>p===null||p==="auto"?null:typeof p=="number"?p:null,u={type:s,caption:c,src:n??"",width:Ln(t,"width"),height:Ln(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 p=e.elem.getAttribute("em-video-settings");if(p)try{u.video=JSON.parse(p.replaceAll("'",'"'))}catch{u.video={}}}return a.isShowOnMobile(e.elem)&&(u.showOnMobile=!0),i&&(u.maxWidth=Math.round(i.getBoundingClientRect().width)),u}function Ln(e,o){const t=e.getAttribute(o);return!t||t==="auto"?{value:null,dim:"px"}:{value:parseFloat(t),dim:t.includes("%")?"%":"px"}}function wn(e){return e.tagName==="IMG"||e.tagName==="AMP-IMG"}var kn="em-mob-text_align-",Ki=":scope > tr > td, :scope > tbody > tr > td",Xi='div[style*="font-family"][style*="font-size"]';function _o(e){return e.querySelector(Ki)}function No(e){return e.querySelector(Xi)}function _n(e){const o=e.closest('table[em="atom"]');if(!o)return null;const t=_o(o);return t?{atomTd:t,textDiv:No(t)}:null}function vt(e){const o=e.closest("div, p, td");if(!o)return null;if(o.style.textAlign)return o;const t=_n(e);return t?t.textDiv?.hasAttribute("align")?t.textDiv:t.atomTd:o}function Nn(e){const o=vt(e);return o&&(o.style.textAlign||o.getAttribute("align"))||"left"}function Zi(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 Bo(e){return{value:Zi(e)}}function Ji(e,o,t=kn){const n=_n(e);if(n)for(const r of[n.atomTd,n.textDiv])r&&r!==o&&a.removeClassesByPrefix(r,t)}function Qi(e){const o=_o(e);if(!o)return null;const t=No(o);return t?.hasAttribute("align")?t:o}function el(e,o){e.querySelectorAll('[em="atom"]').forEach(t=>{const n=Qi(t);n&&o(n,t)})}function tl(e,o,t=kn){const n=_o(e),r=n?No(n):null;for(const i of[n,r])i&&i!==o&&a.removeClassesByPrefix(i,t)}function Jt(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"]')||n.closest('[style*="font-size"]')||n,d=n.closest('[class*="em-mob-line_height"]')||n.closest('[style*="line-height"]')||n,u=a.getElementMobileProps({elem:c}),p=a.getElementMobileProps({elem:d}),m=Bn(e.elem,t),f=a.textHasStyle$1(r,"strong","b"),g=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||g||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:Nn(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:il(e.elem),mobileFontSize:{value:u.mobileFontSize,dim:u.mobileFontSizeDim||"px"},mobileLineHeight:{value:p.mobileLineHeight,dim:"px"},mobileTextAlign:Bo(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:Mn(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 Bn(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|&nbsp;/g,""):""}}function Mn(e){return Xt(e)?{listTypeOL:!!e.querySelector("ol")||!!e.closest("ol"),listTypeUL:!!e.querySelector("ul")||!!e.closest("ul")}:{listTypeOL:!1,listTypeUL:!1}}function Mo(e){if(!e)return!1;const o=e.trim().toLowerCase();return o!=="transparent"&&o!=="inherit"}var ol=new Set(["A","B","EM","I","MARK","S","SMALL","SPAN","STRIKE","STRONG","SUB","SUP","U"]);function nl(e){let o=e;for(;o&&ol.has(o.tagName);){const t=o.style.backgroundColor;if(Mo(t))return t;o=o.parentElement}return""}function rl(e,o,t){let n=e;for(;n;){const r=n.style.getPropertyValue(o);if(Mo(r))return r;if(t&&n===t)break;n=n.parentElement}return""}function il(e){const o=nl(e);if(Mo(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(rl(e,"background-color",t))||""}function ll(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 al(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,p=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:p}),g=a.getElementMobileProps({elem:m}),b=Bn(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:Nn(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:g.mobileLineHeight,dim:"px"},mobileTextAlign:Bo(e.elem),textReplacer:i(e.elem),list:b,standardList:Mn(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 Ro(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+=Ro(t)}),o}function Po(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=>Po(n,o,t))}function sl(e,o){const t=e.getAttribute(o);return!t||t==="auto"?{value:null,dim:"px"}:{value:parseFloat(t),dim:t.includes("%")?"%":"px"}}function Rn(e,o){const t=e.style[o];return t?{value:parseFloat(t),dim:t.includes("%")?"%":"px"}:{value:null,dim:"px"}}function cl(e){return e===null||e==="auto"?null:typeof e=="number"?e:null}function dl(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 ml(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:dl(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:sl(t,"width"),maxWidth:Rn(t,"maxWidth"),minWidth:Rn(t,"minWidth"),align:t.getAttribute("align")??"",border:a.getElementBorder(t),boxShadow:a.getElementBoxShadow(t),borderRadius:a.getElementBorderRadius(t),mobileWidth:{value:cl(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,exportAsPicture:t.getAttribute("em-operation")==="exportAsPicture",outlookBackground:a.hasElementVMLBackground(t,"around")};return a.isShowOnMobile(t)&&(r.showOnMobile=!0),r}function ul(e){return e.tagName==="TABLE"&&e.getAttribute("em")!=="atom"}function fl(e){return e.closest("em-replace")?.getAttribute("text")||null}var pl=()=>a.isInitialized()?a.getHtmlDocument():null,gl=()=>a.state.get("isProgrammaticSelection");function bl(e){if(!a.isElementLocked())try{a.incrementLock(),a.removeAllAttributes("em-edit");let o={};if(!e.elem)return;const t=hl(e.elem);if(!t)return;e.elem=t;const n=yl(e.elem);document.body.classList.contains("mceNonEditable")||El(e.elem),o=vl(e,n),o.type&&(o.operation="application_element_settings_set",a.messageService.send(o))}finally{a.decrementLock()}}function hl(e){const o=pl();return!o||!o.getMappedParent(e)?e:o.getVisibleNode(e)}function yl(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 Ho(e){return{variableElement:fl,requestElemBullet:e.bulletElem,isElementListOL:e.isElementListOL,isElementListUL:e.isElementListUL,isElementList:e.isElementList}}function El(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"),Sl(e)),Cl(e))}function Sl(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 Cl(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 vl(e,o){const t=e.elem;if(!(window.getSelection()?.isCollapsed??!0)&&!t.closest("a")&&!gl()&&!o.isCellCustomTable){const n=Ho(o);return{type:"text",caption:Locale.TEXT,settings:Jt(e,Locale,n)}}if(t.closest("amp-carousel"))return Al(e);if(t.tagName==="AMP-ACCORDION")return Tl(e);if(wn(t))return{type:Zt(e,Locale).type,caption:Zt(e,Locale).caption,settings:Zt(e,Locale)};if(!o.isCellCustomTable&&(t.tagName==="A"||t.tagName==="EM-REPLACE"&&t.closest("a")))return Ll(e,o);if(t.tagName==="TABLE"&&t.getAttribute("em")!=="atom")return wl(e);if(t.tagName==="LI"&&Xt(t)){const n=Ho(o);return{type:"text",caption:Locale.TEXT,settings:Jt(e,Locale,n)}}return o.isCellCustomTable?kl(e):t.tagName==="TD"?_l(e):t.closest(".em-vindent")?Nl(e):t.classList.contains("em-floatblock")||t.closest(".em-floatblock")?Bl(e):t.tagName==="DIV"?Ml(e,o):t.getAttribute("em")==="block"?Rl(e):{}}function Al(e){return{type:"carousel",caption:Locale.CAROUSEL,settings:{}}}function Tl(e){return{type:"accordion",caption:Locale.ACCORDION,settings:{}}}function Ll(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=Ho(o);return{type:"text",caption:Locale.TEXT,settings:Jt(e,Locale,n)}}function wl(e){return e.elem.innerHTML===""?{type:"emptyTable",settings:{}}:{type:"table",caption:Locale.TABLE,settings:{}}}function kl(e){return{type:"customTable",caption:Locale.TABLE,settings:{}}}function _l(e){return{type:"td",caption:Locale.TABLE_COLUMN,settings:{}}}function Nl(e){return{type:"vindent",caption:Locale.VERTICAL_INDENT,settings:{}}}function Bl(e){return{type:"floatBlock",caption:Locale.FLOAT_BLOCK,settings:{}}}function Ml(e,o){return{type:"div",caption:Locale.CONTAINER,settings:{}}}function Rl(e){return{type:"structure",caption:Locale.STRUCTURE,settings:{}}}var Lg=Promise.resolve();function At(e){return!(!e.startsWith("#")||e.indexOf("#",1)!==-1)}var Pl=["em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"],Hl=["em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top"],Il=["em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"];function Pn(){document.querySelectorAll(".em-block-insert").forEach(e=>{e.classList.remove(...Pl)})}function Ol(){document.querySelectorAll(".em-atom-insert").forEach(e=>{e.classList.remove(...Hl)})}function Qt(){document.querySelectorAll(".em-blockatom-insert").forEach(e=>{e.classList.remove(...Il)})}function Io(e,o){const t=e.getBoundingClientRect();return o>t.top+t.height/2?"bottom":"top"}function Hn(e,o){const t=e.getBoundingClientRect(),n=document.body.getBoundingClientRect();return o==="bottom"?t.bottom>n.height-21:t.top<2}function Oo(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=Hn(e,"bottom")?`${n}_bottom-document`:`${n}_bottom`;e.classList.add(i)}else{e.classList.remove(`${n}_bottom`,`${n}_bottom-document`);const i=Hn(e,"top")?`${n}_top-document`:`${n}_top`;e.classList.add(i)}}function xo(e){return e.tagName==="TABLE"&&!e.innerHTML}function eo(e){return e.tagName==="TABLE"||e.tagName==="TR"?e.querySelector("[data-template-content]")??e.querySelector("td"):e}function In(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 xl(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 Dl(e){const o=In(e.dataTransfer?.files??null);return o||xl(e.dataTransfer??null)}function Do(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 Fo(e){if(!Tt(e))return!1;const o=e.dataTransfer;if(!o)return!1;if(o.files?.length)return!!In(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 On="em-native-img-drop-target",qo="em-native-img-uploading",Fl="em-native-img-drop-loading",to="em-native-file-drag",Lt=null,Qe=null;function xn(){Qe&&(window.removeEventListener("scroll",Qe.reposition,!0),window.removeEventListener("resize",Qe.reposition),Qe.resizeObserver?.disconnect(),Qe.overlay.remove(),Qe=null)}function ql(e){xn();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)),Qe={overlay:o,reposition:n,resizeObserver:r}}function Wo(){Lt&&(Lt.classList.remove(On),Lt=null)}function et(){document.body.classList.remove(to),Wo()}function Wl(e){if(!Tt(e)){et();return}if(!Fo(e)){et();return}document.body.classList.add(to);const o=Do(e);if(!o){Wo();return}Lt!==o&&(Wo(),Lt=o,o.classList.add(On))}function Dn(){xn(),document.body.classList.remove(Fl),document.body.classList.remove(to),document.querySelectorAll(`.${qo}`).forEach(e=>{e.classList.remove(qo)})}function $l(e,o){if(o.lockEditor||!Tt(e))return!1;const t=Dl(e);if(!t)return!1;const n=Do(e);return n?(o.applicationElementSettingsSet({elem:n}),et(),n.classList.add(qo),ql(n),o.messageService.send({operation:a.EVENT_TYPES.APPLICATION_NATIVE_IMAGE_DROP,file:t}),!0):!1}function zl(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 Vl(e,o){o.lockEditor||(et(),e.preventDefault(),o.messageService.send({operation:"application_scroll-block-hide"}))}function Ul(e,o){if(e.preventDefault(),o.lockEditor){et();return}Tt(e)?(Fo(e)&&Do(e)&&(e.dataTransfer.dropEffect="copy"),Wl(e)):et();const t=e.target;if(document.body.classList.contains("em-block-insert-body")){const n=xo(t)?null:t.closest('[em="block"]');if(n){o.mutableState.targetBlock=n;const r=eo(n);r&&Oo(r,Io(r,e.pageY),"block")}else Pn()}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,Oo(n,Io(n,e.pageY),"atom"),Qt();else if(t.closest('[em="block"]')&&t.tagName==="TD"&&!t.innerHTML&&!t.hasAttribute("height")||t.tagName==="DIV"&&t.closest("amp-accordion")&&!t.innerHTML)Qt();else{const r=t.closest('[em="block"]');if(r){o.mutableState.targetBlock=r;const i=eo(r);i&&(Oo(i,Io(i,e.pageY),"blockatom"),Ol())}}}}function jl(e,o){if(o.lockEditor)return;Tt(e)&&Fo(e)&&document.body.classList.add(to);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"]');xo(t)?(t.classList.add("em-block-insert-empty"),Pn()):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"]');xo(t)?(t.classList.add("em-block-insert-empty"),Qt()):r?o.mutableState.targetBlock=r:Qt()}}function Gl(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 Yl(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 ds(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=Bt(i),{row:c}=Vo(s,a.CLASS_FOR_BASIC_CELL),{row:d,isOverlapped:u}=Zn(s,a.CLASS_FOR_BASIC_CELL),{isOverlapped:p}=Jn(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")),p&&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 ms={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"},Ce=()=>window.Locale||ms;function us(e,o){e.forEach(t=>{o.querySelectorAll(`.${t}`).forEach(n=>n.classList.remove(t))})}function fs(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"]'),p=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 g=()=>({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(G=>G.classList.remove(a.TEMPORARY_CLASS)),f===1&&d.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.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=Bt(C);const w=Vo(L,a.CLASS_FOR_BASIC_CELL);if(!w)return;const{row:T,col:k}=w,{row:D,col:z,isOverlapped:$}=Zn(L,a.CLASS_FOR_BASIC_CELL),{row:M,col:H,isOverlapped:P}=Jn(L,a.CLASS_FOR_BASIC_CELL);!r&&!i&&f===1&&!($||P)&&(C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),v.classList.add(a.CLASS_BACKGROUND_ACTIVE_CELL));const Z=Vo(L,a.TEMPORARY_CLASS);if(!Z)return;const{row:R,col:F}=Z;if(C.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach(G=>G.classList.remove(a.TEMPORARY_CLASS)),T!==R&&k!==F){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),r=!1,i=!1;return}const{isDirectionUP:ie,isDirectionDOWN:O,isDirectionLEFT:B,isDirectionRIGHT:ee}=g();if(!r&&!i&&!v.classList.contains("remove-basic-cell")&&(a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1}),T===R?(r=!0,i=!1,k>F&&a.state.set("isDirectionLEFT",!0),k<F&&a.state.set("isDirectionRIGHT",!0)):k===F&&(i=!0,r=!1,T>R&&a.state.set("isDirectionUP",!0),T<R&&a.state.set("isDirectionDOWN",!0))),T===R&&(O||ie)||k===F&&(ee||B)||k===F&&T===R){a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1}),r=!1,i=!1;return}if($&&z!==null){const{isDirectionRIGHT:G,isDirectionLEFT:J}=g();if(G&&z-F<=0&&z>k){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(Y=>Y.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}if(J&&F-z<=0&&z<k){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(Y=>Y.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}}if(P&&M!==null){const{isDirectionDOWN:G,isDirectionUP:J}=g();if(G&&M-R<=0&&M>T){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(Y=>Y.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}if(J&&R-M<=0&&M<T){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(Y=>Y.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}}if(T===R&&r){i=!1;const{isDirectionRIGHT:G,isDirectionLEFT:J}=g();if(G){const Y=F-k;if(a.state.set("actualTargetCount",ro(L,R,F,T,k,!0)),Y<0){a.state.set("isDirectionRIGHT",!1),r=!1,i=!1;return}C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(ae=>ae.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),or(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!0)}if(J){const Y=k-F;if(a.state.set("actualTargetCount",ro(L,T,k,R,F,!0)),Y<0){a.state.set("isDirectionLEFT",!1),r=!1,i=!1;return}C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(ae=>ae.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),or(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!1)}C.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach(Y=>Y.classList.remove(a.TEMPORARY_CLASS))}if(k===F&&i){r=!1;const{isDirectionDOWN:G,isDirectionUP:J}=g();if(G){const Y=R-T;if(a.state.set("actualTargetCount",ro(L,R,F,T,k,!1)),Y<0){a.state.set("isDirectionDOWN",!1),r=!1,i=!1;return}C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(ae=>ae.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),nr(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!0)}if(J){const Y=T-R;a.state.set("actualTargetCount",ro(L,T,k,R,F,!1)),Y<0&&(a.state.set("isDirectionUP",!1),r=!1,i=!1),C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(ae=>ae.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),nr(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!1)}C.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach(Y=>Y.classList.remove(a.TEMPORARY_CLASS))}const oe=C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`);v.classList.contains("remove-basic-cell")&&oe?.length>1&&(oe?.forEach(G=>{G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)}),r=!1,i=!1)}}),ps(p,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)&&!p.contains(E)&&(p.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 ps(e,o,t,n,r){const i=ds;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:k}={isDirectionUP:a.state.get("isDirectionUP"),isDirectionDOWN:a.state.get("isDirectionDOWN"),isDirectionLEFT:a.state.get("isDirectionLEFT"),isDirectionRIGHT:a.state.get("isDirectionRIGHT")};i(L,w,T,k),e.querySelectorAll("[data-open]").forEach(D=>{D!==y&&D.getAttribute("data-open")==="true"&&(D.setAttribute("data-open","false"),D.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=Bt(w),k=w.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).length;switch(v){case"add-bottom-row":{const M=Gn(T,a.CLASS_FOR_BASIC_CELL,!1);w.innerHTML=Se(M);break}case"add-top-row":{const M=Gn(T,a.CLASS_FOR_BASIC_CELL,!0);w.innerHTML=Se(M);break}case"remove-row":{const M=Ra(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Se(M);break}case"merge-top-cell":{const M=k===0?Xn(T,a.CLASS_FOR_BASIC_CELL,!0,k+1):er(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Se(M);break}case"merge-bottom-cell":{const M=k===0?Xn(T,a.CLASS_FOR_BASIC_CELL,!1,k+1):er(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Se(M);break}case"split-horizontal-cell":{const M=Ia(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Se(M);break}case"add-left-column":{const M=Yn(T,a.CLASS_FOR_BASIC_CELL,!0);w.innerHTML=Se(M);break}case"add-right-column":{const M=Yn(T,a.CLASS_FOR_BASIC_CELL,!1);w.innerHTML=Se(M);break}case"merge-right-cell":{const M=k===0?Kn(T,a.CLASS_FOR_BASIC_CELL,!1,k+1):Qn(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Se(M);break}case"merge-left-cell":{const M=k===0?Kn(T,a.CLASS_FOR_BASIC_CELL,!0,k+1):Qn(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Se(M);break}case"split-vertical-cell":{const M=Ha(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Se(M);break}case"remove-column":{const M=Pa(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Se(M);break}}const D=S.closest("ul");D.parentElement.setAttribute("data-open","false"),D.style.display="none",e.querySelectorAll('[data-open="true"]').forEach(M=>{M.setAttribute("data-open","false"),M.querySelector("ul").style.display="none"});const z=document.querySelector(`.${a.CLASS_FOR_BASIC_CELL}`),$=document.querySelector(".table-menu");z?.classList.remove(a.CLASS_FOR_BASIC_CELL),$?.remove(),document.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(M=>{M.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)}),us(r,w),a.commit()}function d(y){l(y.currentTarget)}function u(y){s(y.currentTarget)}const p=a.addElement({targetElement:e,insertType:"append",style:"cursor: pointer; flex: 1; margin: auto; padding-top: 2px;",className:"em-element-editor-widget-edit",HTMLcontent:rr,title:"Колонки"});p.setAttribute("data-open","false");const m=a.addElement({targetElement:p,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:rr,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:es,title:Ce().INSERT_COLUMN_BEFORE_TABLE,"data-id":"add-left-column"}),a.addElement({...f,HTMLcontent:ts,title:Ce().INSERT_COLUMN_AFTER_TABLE,"data-id":"add-right-column"}),a.addElement({...f,HTMLcontent:is,title:Ce().MERGE_RIGHT_CELL_TABLE,"data-id":"merge-right-cell"}),a.addElement({...f,HTMLcontent:os,title:Ce().MERGE_LEFT_CELL_TABLE,"data-id":"merge-left-cell"}),a.addElement({...f,HTMLcontent:cs,title:Ce().SPLIT_CELL_TABLE,"data-id":"split-vertical-cell"}),a.addElement({...f,HTMLcontent:lr,title:Ce().REMOVE_COLUMN_TABLE,"data-id":"remove-column"}),m.addEventListener("click",c),p.addEventListener("mouseenter",d),p.addEventListener("mouseleave",u);const g=a.addElement({targetElement:e,insertType:"append",style:"cursor: pointer; flex: 1; margin: auto; padding-top: 2px;",className:"em-element-editor-widget-clone",HTMLcontent:ir,title:"Строки"});g.setAttribute("data-open","false");const b=a.addElement({targetElement:g,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:ir,title:Ce().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:ns,title:Ce().INSERT_ROW_BEFORE_TABLE,"data-id":"add-top-row"}),a.addElement({...h,HTMLcontent:rs,title:Ce().INSERT_ROW_AFTER_TABLE,"data-id":"add-bottom-row"}),a.addElement({...h,HTMLcontent:ls,title:Ce().MERGE_TOP_CELL_TABLE,"data-id":"merge-top-cell"}),a.addElement({...h,HTMLcontent:as,title:Ce().MERGE_BOTTOM_CELL_TABLE,"data-id":"merge-bottom-cell"}),a.addElement({...h,HTMLcontent:ss,title:Ce().SPLIT_CELL_TABLE,"data-id":"split-horizontal-cell"}),a.addElement({...h,HTMLcontent:lr,title:Ce().REMOVE_ROW_TABLE,"data-id":"remove-row"}),b.addEventListener("click",c),g.addEventListener("mouseenter",d),g.addEventListener("mouseleave",u)}function gs(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 bs(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 hs(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 ys(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 Es(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 Ss={sandbox_set_attr_to_images:bs,sandbox_set_attr_to_links:hs,sandbox_set_position_to_img:ys,sandbox_set_position_to_link:Es},Cs="https://emcdn.ru/141965/231106_18_hwUXhU0.png";function io(e){e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.remove():e.elem.previousSibling&&io({elem:e.elem.previousSibling})}function lo(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(),lo({elem:o})));else if(e.elem.innerHTML.trim()==="")io({elem:e.elem}),e.elem.remove(),lo({elem:o});else if(o&&!o.querySelector('div[style*="display"]')){for(const t of e.elem.childNodes)t.nodeName==="#text"&&t.textContent?.trim()===""?(io({elem:t}),t.textContent=""):t.nodeName==="#comment"&&t.textContent?.indexOf("mso")!==-1&&(io({elem:t}),t.remove());e.elem.innerHTML.trim()===""&&lo({elem:e.elem})}return!0}function vs(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(),lo({elem:n}),e.commit(),e.messageService.send({operation:"application_element_settings_close"})}function As(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",Cs),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")&&Ts(e,o).catch(n=>{})}async function Ts(e,o){const{default:t}=await a.__vitePreload(async()=>{const{default:c}=await Promise.resolve().then(()=>Lo("./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,"&nbsp;")}),d=d.replace(/(\d[\d&nbsp;]*[.,]?\d+)(?:\s|&nbsp;)?(?=(?:руб(?:\.|лей)?|р\.|долл(?:\.|аров)?|\$|₽|€|£|¥|USD|EUR|RUB))/gi,"$1&nbsp;"),d=d.replace(/(\d[\d&nbsp;]*[.,]?\d+)&nbsp;(руб(?:\.|лей)?|р\.|долл(?:\.|аров)?|\$|₽|€|£|¥|USD|EUR|RUB)/gi,"$1&nbsp;$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 ar(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 Ls(e,o){const t=e.closest("a");if(Uo(t))return t;if(!o)return null;const n=ar(o.anchorNode)?.closest("a")??null;if(Uo(n))return n;const r=ar(o.focusNode)?.closest("a")??null;return Uo(r)?r:null}function sr(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 cr(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 ws(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=window.getSelection();if(Ls(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 ks(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=cr(sr(o).previousElementSibling);t&&(e.setCursorPosition(t),e.applicationElementSettingsSet({elem:t}))}function _s(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=cr(sr(o).nextElementSibling);t&&(e.setCursorPosition(t),e.applicationElementSettingsSet({elem:t}))}function Ns(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 Bs(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 Ms(e,o){o.removeAllAttributes("em-state");const t=o.elementPath[e.data.index??0];t?.elem&&t.elem.setAttribute("em-state","active")}function Rs(e,o){if(!o.getElementParent)return;const t={setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,applicationElementSettingsSet:o.applicationElementSettingsSet};ws(t)}function Ps(e,o){if(!o.getElementParent)return;const t={setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,applicationElementSettingsSet:o.applicationElementSettingsSet};ks(t)}function Hs(e,o){if(!o.getElementParent)return;const t={setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,applicationElementSettingsSet:o.applicationElementSettingsSet};_s(t)}function Is(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};vs(t)}function Os(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};As(t,n)}var xs={sandbox_element_active_reset:Ns,sandbox_element_active_set:Bs,sandbox_element_hover_set:Ms,sandbox_element_parent_get:Rs,sandbox_element_prev_get:Ps,sandbox_element_next_get:Hs,sandbox_element_remove:Is,sandbox_element_text:Os};function Ds(e,o){e.data.data?(a.state.set("lockEdit",!0),document.body.classList.add("mceNonEditable"),document.querySelectorAll("editor").forEach(t=>{t.setAttribute("contenteditable","false")})):(a.state.set("lockEdit",!1),document.body.classList.remove("mceNonEditable"),document.querySelectorAll("editor").forEach(t=>{t.setAttribute("contenteditable","true")}))}function Fs(e,o){o.setEditorFocus(e.data.data)}var qs={sandbox_lock_edit:Ds,editor_change_focus:Fs};function Ws(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 zs(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 Vs(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 Us={sandbox_set_attr_to_images:Ws,sandbox_set_attr_to_links:$s,sandbox_set_position_to_img:zs,sandbox_set_position_to_link:Vs};function js(e){const o="4865197d";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}"]`),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 s of i)s.remove()}function Gs(e,o){o.initPreview(!0)}function Ys(e,o){const t=e.data;t.theme&&(a.state.set("applicationTheme",t.theme),js(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 Ks(e){const o=e.data?.data?.theme;(o==="light"||o==="dark")&&a.darkMode.set(o)}var Xs={init_preview:Gs,update_preview:Ys,sandbox_switch_theme:Ks},Be=".em-mob-wrap, .noresp-em-mob-wrap",pe=".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)",ce='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 dr(e){const o=e.removedBlockIndex===0?"nextSibling":"previousSibling";e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.remove():e.elem[o]&&dr({elem:e.elem[o],removedBlockIndex:e.removedBlockIndex})}function ao(e){return!!e.querySelector(Be)||!!e.closest(Be)}function Mt(e){return e.querySelector(Be)?document.querySelector('[em-edit="active"]'):e.closest(Be).parentElement}function so(e){return e.querySelector(ce)?document.querySelector('[em-edit="active"]'):e.closest(ce).parentElement}function Zs(e,o){const t=document.querySelector("[em-edit]");if(t)try{if(o.state.increment("activeElementLocked"),ao(t)){const n=Mt(t),r=e.minWidth,i=n.querySelectorAll(pe).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 ds(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=Bt(i),{row:c}=Vo(s,a.CLASS_FOR_BASIC_CELL),{row:d,isOverlapped:u}=Zn(s,a.CLASS_FOR_BASIC_CELL),{isOverlapped:p}=Jn(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")),p&&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 ms={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"},Ce=()=>window.Locale||ms;function us(e,o){e.forEach(t=>{o.querySelectorAll(`.${t}`).forEach(n=>n.classList.remove(t))})}function fs(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"]'),p=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 g=()=>({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(G=>G.classList.remove(a.TEMPORARY_CLASS)),f===1&&d.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.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=Bt(C);const w=Vo(L,a.CLASS_FOR_BASIC_CELL);if(!w)return;const{row:T,col:k}=w,{row:D,col:z,isOverlapped:$}=Zn(L,a.CLASS_FOR_BASIC_CELL),{row:M,col:H,isOverlapped:P}=Jn(L,a.CLASS_FOR_BASIC_CELL);!r&&!i&&f===1&&!($||P)&&(C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),v.classList.add(a.CLASS_BACKGROUND_ACTIVE_CELL));const Z=Vo(L,a.TEMPORARY_CLASS);if(!Z)return;const{row:R,col:F}=Z;if(C.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach(G=>G.classList.remove(a.TEMPORARY_CLASS)),T!==R&&k!==F){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(G=>G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),r=!1,i=!1;return}const{isDirectionUP:ie,isDirectionDOWN:O,isDirectionLEFT:B,isDirectionRIGHT:ee}=g();if(!r&&!i&&!v.classList.contains("remove-basic-cell")&&(a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1}),T===R?(r=!0,i=!1,k>F&&a.state.set("isDirectionLEFT",!0),k<F&&a.state.set("isDirectionRIGHT",!0)):k===F&&(i=!0,r=!1,T>R&&a.state.set("isDirectionUP",!0),T<R&&a.state.set("isDirectionDOWN",!0))),T===R&&(O||ie)||k===F&&(ee||B)||k===F&&T===R){a.state.update({isDirectionUP:!1,isDirectionDOWN:!1,isDirectionLEFT:!1,isDirectionRIGHT:!1}),r=!1,i=!1;return}if($&&z!==null){const{isDirectionRIGHT:G,isDirectionLEFT:J}=g();if(G&&z-F<=0&&z>k){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(Y=>Y.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}if(J&&F-z<=0&&z<k){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(Y=>Y.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}}if(P&&M!==null){const{isDirectionDOWN:G,isDirectionUP:J}=g();if(G&&M-R<=0&&M>T){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(Y=>Y.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}if(J&&R-M<=0&&M<T){C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(Y=>Y.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL));return}}if(T===R&&r){i=!1;const{isDirectionRIGHT:G,isDirectionLEFT:J}=g();if(G){const Y=F-k;if(a.state.set("actualTargetCount",ro(L,R,F,T,k,!0)),Y<0){a.state.set("isDirectionRIGHT",!1),r=!1,i=!1;return}C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(ae=>ae.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),or(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!0)}if(J){const Y=k-F;if(a.state.set("actualTargetCount",ro(L,T,k,R,F,!0)),Y<0){a.state.set("isDirectionLEFT",!1),r=!1,i=!1;return}C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(ae=>ae.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),or(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!1)}C.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach(Y=>Y.classList.remove(a.TEMPORARY_CLASS))}if(k===F&&i){r=!1;const{isDirectionDOWN:G,isDirectionUP:J}=g();if(G){const Y=R-T;if(a.state.set("actualTargetCount",ro(L,R,F,T,k,!1)),Y<0){a.state.set("isDirectionDOWN",!1),r=!1,i=!1;return}C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(ae=>ae.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),nr(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!0)}if(J){const Y=T-R;a.state.set("actualTargetCount",ro(L,T,k,R,F,!1)),Y<0&&(a.state.set("isDirectionUP",!1),r=!1,i=!1),C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(ae=>ae.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)),nr(`.${a.CLASS_FOR_BASIC_CELL}`,a.state.get("actualTargetCount"),a.CLASS_BACKGROUND_ACTIVE_CELL,!1)}C.querySelectorAll(`.${a.TEMPORARY_CLASS}`).forEach(Y=>Y.classList.remove(a.TEMPORARY_CLASS))}const oe=C.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`);v.classList.contains("remove-basic-cell")&&oe?.length>1&&(oe?.forEach(G=>{G.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)}),r=!1,i=!1)}}),ps(p,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)&&!p.contains(E)&&(p.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 ps(e,o,t,n,r){const i=ds;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:k}={isDirectionUP:a.state.get("isDirectionUP"),isDirectionDOWN:a.state.get("isDirectionDOWN"),isDirectionLEFT:a.state.get("isDirectionLEFT"),isDirectionRIGHT:a.state.get("isDirectionRIGHT")};i(L,w,T,k),e.querySelectorAll("[data-open]").forEach(D=>{D!==y&&D.getAttribute("data-open")==="true"&&(D.setAttribute("data-open","false"),D.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=Bt(w),k=w.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).length;switch(v){case"add-bottom-row":{const M=Gn(T,a.CLASS_FOR_BASIC_CELL,!1);w.innerHTML=Se(M);break}case"add-top-row":{const M=Gn(T,a.CLASS_FOR_BASIC_CELL,!0);w.innerHTML=Se(M);break}case"remove-row":{const M=Ra(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Se(M);break}case"merge-top-cell":{const M=k===0?Xn(T,a.CLASS_FOR_BASIC_CELL,!0,k+1):er(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Se(M);break}case"merge-bottom-cell":{const M=k===0?Xn(T,a.CLASS_FOR_BASIC_CELL,!1,k+1):er(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Se(M);break}case"split-horizontal-cell":{const M=Ia(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Se(M);break}case"add-left-column":{const M=Yn(T,a.CLASS_FOR_BASIC_CELL,!0);w.innerHTML=Se(M);break}case"add-right-column":{const M=Yn(T,a.CLASS_FOR_BASIC_CELL,!1);w.innerHTML=Se(M);break}case"merge-right-cell":{const M=k===0?Kn(T,a.CLASS_FOR_BASIC_CELL,!1,k+1):Qn(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Se(M);break}case"merge-left-cell":{const M=k===0?Kn(T,a.CLASS_FOR_BASIC_CELL,!0,k+1):Qn(T,a.CLASS_FOR_BASIC_CELL,a.CLASS_BACKGROUND_ACTIVE_CELL);w.innerHTML=Se(M);break}case"split-vertical-cell":{const M=Ha(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Se(M);break}case"remove-column":{const M=Pa(T,a.CLASS_FOR_BASIC_CELL);w.innerHTML=Se(M);break}}const D=S.closest("ul");D.parentElement.setAttribute("data-open","false"),D.style.display="none",e.querySelectorAll('[data-open="true"]').forEach(M=>{M.setAttribute("data-open","false"),M.querySelector("ul").style.display="none"});const z=document.querySelector(`.${a.CLASS_FOR_BASIC_CELL}`),$=document.querySelector(".table-menu");z?.classList.remove(a.CLASS_FOR_BASIC_CELL),$?.remove(),document.querySelectorAll(`.${a.CLASS_BACKGROUND_ACTIVE_CELL}`).forEach(M=>{M.classList.remove(a.CLASS_BACKGROUND_ACTIVE_CELL)}),us(r,w),a.commit()}function d(y){l(y.currentTarget)}function u(y){s(y.currentTarget)}const p=a.addElement({targetElement:e,insertType:"append",style:"cursor: pointer; flex: 1; margin: auto; padding-top: 2px;",className:"em-element-editor-widget-edit",HTMLcontent:rr,title:"Колонки"});p.setAttribute("data-open","false");const m=a.addElement({targetElement:p,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:rr,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:es,title:Ce().INSERT_COLUMN_BEFORE_TABLE,"data-id":"add-left-column"}),a.addElement({...f,HTMLcontent:ts,title:Ce().INSERT_COLUMN_AFTER_TABLE,"data-id":"add-right-column"}),a.addElement({...f,HTMLcontent:is,title:Ce().MERGE_RIGHT_CELL_TABLE,"data-id":"merge-right-cell"}),a.addElement({...f,HTMLcontent:os,title:Ce().MERGE_LEFT_CELL_TABLE,"data-id":"merge-left-cell"}),a.addElement({...f,HTMLcontent:cs,title:Ce().SPLIT_CELL_TABLE,"data-id":"split-vertical-cell"}),a.addElement({...f,HTMLcontent:lr,title:Ce().REMOVE_COLUMN_TABLE,"data-id":"remove-column"}),m.addEventListener("click",c),p.addEventListener("mouseenter",d),p.addEventListener("mouseleave",u);const g=a.addElement({targetElement:e,insertType:"append",style:"cursor: pointer; flex: 1; margin: auto; padding-top: 2px;",className:"em-element-editor-widget-clone",HTMLcontent:ir,title:"Строки"});g.setAttribute("data-open","false");const b=a.addElement({targetElement:g,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:ir,title:Ce().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:ns,title:Ce().INSERT_ROW_BEFORE_TABLE,"data-id":"add-top-row"}),a.addElement({...h,HTMLcontent:rs,title:Ce().INSERT_ROW_AFTER_TABLE,"data-id":"add-bottom-row"}),a.addElement({...h,HTMLcontent:ls,title:Ce().MERGE_TOP_CELL_TABLE,"data-id":"merge-top-cell"}),a.addElement({...h,HTMLcontent:as,title:Ce().MERGE_BOTTOM_CELL_TABLE,"data-id":"merge-bottom-cell"}),a.addElement({...h,HTMLcontent:ss,title:Ce().SPLIT_CELL_TABLE,"data-id":"split-horizontal-cell"}),a.addElement({...h,HTMLcontent:lr,title:Ce().REMOVE_ROW_TABLE,"data-id":"remove-row"}),b.addEventListener("click",c),g.addEventListener("mouseenter",d),g.addEventListener("mouseleave",u)}function gs(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 bs(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 hs(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 ys(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 Es(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 Ss={sandbox_set_attr_to_images:bs,sandbox_set_attr_to_links:hs,sandbox_set_position_to_img:ys,sandbox_set_position_to_link:Es},Cs="https://emcdn.ru/141965/231106_18_hwUXhU0.png";function io(e){e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.remove():e.elem.previousSibling&&io({elem:e.elem.previousSibling})}function lo(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(),lo({elem:o})));else if(e.elem.innerHTML.trim()==="")io({elem:e.elem}),e.elem.remove(),lo({elem:o});else if(o&&!o.querySelector('div[style*="display"]')){for(const t of e.elem.childNodes)t.nodeName==="#text"&&t.textContent?.trim()===""?(io({elem:t}),t.textContent=""):t.nodeName==="#comment"&&t.textContent?.indexOf("mso")!==-1&&(io({elem:t}),t.remove());e.elem.innerHTML.trim()===""&&lo({elem:e.elem})}return!0}function vs(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(),lo({elem:n}),e.commit(),e.messageService.send({operation:"application_element_settings_close"})}function As(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",Cs),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")&&Ts(e,o).catch(n=>{})}async function Ts(e,o){const{default:t}=await a.__vitePreload(async()=>{const{default:c}=await Promise.resolve().then(()=>Lo("./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,"&nbsp;")}),d=d.replace(/(\d[\d&nbsp;]*[.,]?\d+)(?:\s|&nbsp;)?(?=(?:руб(?:\.|лей)?|р\.|долл(?:\.|аров)?|\$|₽|€|£|¥|USD|EUR|RUB))/gi,"$1&nbsp;"),d=d.replace(/(\d[\d&nbsp;]*[.,]?\d+)&nbsp;(руб(?:\.|лей)?|р\.|долл(?:\.|аров)?|\$|₽|€|£|¥|USD|EUR|RUB)/gi,"$1&nbsp;$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 ar(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 Ls(e,o){const t=e.closest("a");if(Uo(t))return t;if(!o)return null;const n=ar(o.anchorNode)?.closest("a")??null;if(Uo(n))return n;const r=ar(o.focusNode)?.closest("a")??null;return Uo(r)?r:null}function sr(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 cr(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 ws(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=window.getSelection();if(Ls(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 ks(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=cr(sr(o).previousElementSibling);t&&(e.setCursorPosition(t),e.applicationElementSettingsSet({elem:t}))}function _s(e){const o=document.querySelector("[em-edit]");if(!o)return;const t=cr(sr(o).nextElementSibling);t&&(e.setCursorPosition(t),e.applicationElementSettingsSet({elem:t}))}function Ns(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 Bs(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 Ms(e,o){o.removeAllAttributes("em-state");const t=o.elementPath[e.data.index??0];t?.elem&&t.elem.setAttribute("em-state","active")}function Rs(e,o){if(!o.getElementParent)return;const t={setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,applicationElementSettingsSet:o.applicationElementSettingsSet};ws(t)}function Ps(e,o){if(!o.getElementParent)return;const t={setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,applicationElementSettingsSet:o.applicationElementSettingsSet};ks(t)}function Hs(e,o){if(!o.getElementParent)return;const t={setCursorPosition:o.setCursorPosition,getElementParent:o.getElementParent,applicationElementSettingsSet:o.applicationElementSettingsSet};_s(t)}function Is(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};vs(t)}function Os(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};As(t,n)}var xs={sandbox_element_active_reset:Ns,sandbox_element_active_set:Bs,sandbox_element_hover_set:Ms,sandbox_element_parent_get:Rs,sandbox_element_prev_get:Ps,sandbox_element_next_get:Hs,sandbox_element_remove:Is,sandbox_element_text:Os};function Ds(e,o){e.data.data?(a.state.set("lockEdit",!0),document.body.classList.add("mceNonEditable"),document.querySelectorAll("editor").forEach(t=>{t.setAttribute("contenteditable","false")})):(a.state.set("lockEdit",!1),document.body.classList.remove("mceNonEditable"),document.querySelectorAll("editor").forEach(t=>{t.setAttribute("contenteditable","true")}))}function Fs(e,o){o.setEditorFocus(e.data.data)}var qs={sandbox_lock_edit:Ds,editor_change_focus:Fs};function Ws(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 zs(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 Vs(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 Us={sandbox_set_attr_to_images:Ws,sandbox_set_attr_to_links:$s,sandbox_set_position_to_img:zs,sandbox_set_position_to_link:Vs};function js(e){const o="168aeeb1";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}"]`),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 s of i)s.remove()}function Gs(e,o){o.initPreview(!0)}function Ys(e,o){const t=e.data;t.theme&&(a.state.set("applicationTheme",t.theme),js(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 Ks(e){const o=e.data?.data?.theme;(o==="light"||o==="dark")&&a.darkMode.set(o)}var Xs={init_preview:Gs,update_preview:Ys,sandbox_switch_theme:Ks},Be=".em-mob-wrap, .noresp-em-mob-wrap",pe=".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)",ce='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 dr(e){const o=e.removedBlockIndex===0?"nextSibling":"previousSibling";e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.remove():e.elem[o]&&dr({elem:e.elem[o],removedBlockIndex:e.removedBlockIndex})}function ao(e){return!!e.querySelector(Be)||!!e.closest(Be)}function Mt(e){return e.querySelector(Be)?document.querySelector('[em-edit="active"]'):e.closest(Be).parentElement}function so(e){return e.querySelector(ce)?document.querySelector('[em-edit="active"]'):e.closest(ce).parentElement}function Zs(e,o){const t=document.querySelector("[em-edit]");if(t)try{if(o.state.increment("activeElementLocked"),ao(t)){const n=Mt(t),r=e.minWidth,i=n.querySelectorAll(pe).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,p=0;n.querySelectorAll(pe).forEach(f=>{parseFloat(f.getAttribute("width")||"0")>r&&p++,d+=parseFloat(f.getAttribute("width")||"0")});const m=(r+l)/p;if(n.querySelectorAll(pe).forEach(f=>{if(parseFloat(f.getAttribute("width")||"0")>r){const g=Math.round(parseFloat(f.getAttribute("width")||"0")-m);f.setAttribute("width",String(g))}}),n.querySelectorAll(pe)[i-1].insertAdjacentHTML("afterend",c),n.querySelectorAll(pe).forEach(f=>{u+=parseFloat(f.getAttribute("width")||"0")}),d-u-l!==0){const f=n.querySelector(Be),g=parseFloat(f.getAttribute("width")||"0")+(d-u-l);f.setAttribute("width",String(g))}o.setPercentsForColumns(n.querySelectorAll(pe)),o.commit()}else{const n=so(t),r=e.minWidth,i=n.querySelectorAll(ce).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">
@@ -2,6 +2,6 @@ var e=window.__useblocks__||(window.__useblocks__={});(function(){"use strict";i
2
2
 
3
3
  __useblocks__.require.config({ paths: {"js/iframe.js":"js/iframe.body.js"} });
4
4
 
5
- __useblocks__.require.config({"graph":{"js/iframe-eblock.js":["js/discussHandlers.BtCUuj58.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.BtCUuj58.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.BtCUuj58.js":["js/rolldown-runtime.BRlIiq3h.js"],"js/rolldown-runtime.BRlIiq3h.js":[],"js/rules.CL_BitCE.js":[],"js/typograf.all.BbXdyfMT.js":["js/rolldown-runtime.BRlIiq3h.js"]}});
5
+ __useblocks__.require.config({"graph":{"js/iframe-eblock.js":["js/discussHandlers.BxlCsZ-4.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.BxlCsZ-4.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.BxlCsZ-4.js":["js/rolldown-runtime.BRlIiq3h.js"],"js/rolldown-runtime.BRlIiq3h.js":[],"js/rules.CL_BitCE.js":[],"js/typograf.all.BbXdyfMT.js":["js/rolldown-runtime.BRlIiq3h.js"]}});
6
6
 
7
7
  __useblocks__.require("js/iframe.js");
@@ -30,5 +30,5 @@
30
30
  "@ant-design/cssinjs": "^2.1.2"
31
31
  },
32
32
  "name": "useblocks-ui-kit",
33
- "version": "1.1.85-dev.2"
33
+ "version": "1.1.85-dev.3"
34
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "useblocks",
3
- "version": "1.1.85-dev.2",
3
+ "version": "1.1.85-dev.3",
4
4
  "private": false,
5
5
  "main": "useblocks.js",
6
6
  "module": "useblocks-esm.js",
@@ -250,7 +250,7 @@
250
250
  "string-convert": "0.2.1",
251
251
  "stylis": "4.4.0",
252
252
  "throttle-debounce": "5.0.2",
253
- "useblocks-ui-kit": "1.1.85-dev.2"
253
+ "useblocks-ui-kit": "1.1.85-dev.3"
254
254
  },
255
255
  "bundleDependencies": [
256
256
  "@ant-design/colors",
@@ -1 +1 @@
1
- import e from"react";var i=e&&e.default?e.default:e,{Activity:n,Children:o,Component:c,Fragment:m,Profiler:v,PureComponent:E,StrictMode:d,Suspense:R,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:S,__COMPILER_RUNTIME:h,cache:T,cacheSignal:b,cloneElement:g,createContext:N,createElement:_,createRef:A,forwardRef:O,isValidElement:k,lazy:I,memo:D,startTransition:L,unstable_useCacheRefresh:M,use:P,useActionState:U,useCallback:V,useContext:x,useDebugValue:H,useDeferredValue:z,useEffect:F,useEffectEvent:G,useId:W,useImperativeHandle:Y,useInsertionEffect:j,useLayoutEffect:p,useMemo:q,useOptimistic:w,useReducer:B,useRef:J,useState:Q,useSyncExternalStore:X,useTransition:Z,version:$}=e;try{var u=Symbol.for("editor-runtime.react.copies"),t=globalThis[u];t||(t=[],globalThis[u]=t);for(var r=!1,s=0;s<t.length;s++){var a=t[s];a&&a.react===e&&a.package==="useblocks"&&a.version==="1.1.85-dev.2"&&(r=!0)}r||t.push({package:"useblocks",version:"1.1.85-dev.2",react:e})}catch{}export{n as Activity,o as Children,c as Component,m as Fragment,v as Profiler,E as PureComponent,d as StrictMode,R as Suspense,S as __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,h as __COMPILER_RUNTIME,T as cache,b as cacheSignal,g as cloneElement,N as createContext,_ as createElement,A as createRef,i as default,O as forwardRef,k as isValidElement,I as lazy,D as memo,L as startTransition,M as unstable_useCacheRefresh,P as use,U as useActionState,V as useCallback,x as useContext,H as useDebugValue,z as useDeferredValue,F as useEffect,G as useEffectEvent,W as useId,Y as useImperativeHandle,j as useInsertionEffect,p as useLayoutEffect,q as useMemo,w as useOptimistic,B as useReducer,J as useRef,Q as useState,X as useSyncExternalStore,Z as useTransition,$ as version};
1
+ import e from"react";var i=e&&e.default?e.default:e,{Activity:n,Children:o,Component:c,Fragment:m,Profiler:v,PureComponent:E,StrictMode:d,Suspense:R,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:S,__COMPILER_RUNTIME:h,cache:T,cacheSignal:b,cloneElement:g,createContext:N,createElement:_,createRef:A,forwardRef:O,isValidElement:k,lazy:I,memo:D,startTransition:L,unstable_useCacheRefresh:M,use:P,useActionState:U,useCallback:V,useContext:x,useDebugValue:H,useDeferredValue:z,useEffect:F,useEffectEvent:G,useId:W,useImperativeHandle:Y,useInsertionEffect:j,useLayoutEffect:p,useMemo:q,useOptimistic:w,useReducer:B,useRef:J,useState:Q,useSyncExternalStore:X,useTransition:Z,version:$}=e;try{var u=Symbol.for("editor-runtime.react.copies"),t=globalThis[u];t||(t=[],globalThis[u]=t);for(var r=!1,s=0;s<t.length;s++){var a=t[s];a&&a.react===e&&a.package==="useblocks"&&a.version==="1.1.85-dev.3"&&(r=!0)}r||t.push({package:"useblocks",version:"1.1.85-dev.3",react:e})}catch{}export{n as Activity,o as Children,c as Component,m as Fragment,v as Profiler,E as PureComponent,d as StrictMode,R as Suspense,S as __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,h as __COMPILER_RUNTIME,T as cache,b as cacheSignal,g as cloneElement,N as createContext,_ as createElement,A as createRef,i as default,O as forwardRef,k as isValidElement,I as lazy,D as memo,L as startTransition,M as unstable_useCacheRefresh,P as use,U as useActionState,V as useCallback,x as useContext,H as useDebugValue,z as useDeferredValue,F as useEffect,G as useEffectEvent,W as useId,Y as useImperativeHandle,j as useInsertionEffect,p as useLayoutEffect,q as useMemo,w as useOptimistic,B as useReducer,J as useRef,Q as useState,X as useSyncExternalStore,Z as useTransition,$ as version};