useblocks 1.3.11-dev.2 → 1.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/compat-globals.js +1 -1
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/css/sandbox-dark.css +1 -1
- package/iframe/css/sandbox-light.css +1 -1
- package/iframe/css/sandbox.css +47 -17
- package/iframe/{iframe-eblock.fd4347fc.html → iframe-eblock.cd84d2b9.html} +2 -2
- package/iframe/{iframe.fd4347fc.html → iframe.cd84d2b9.html} +2 -2
- package/iframe/js/elMarkupHelper.CgToMPJX.js +278 -0
- package/iframe/js/{iframe-eblock.body.fd4347fc.js → iframe-eblock.body.cd84d2b9.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.fd4347fc.js → iframe.body.cd84d2b9.js} +2 -2
- package/iframe/js/iframe.js +2 -2
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{3ca0af3d.js → 18b86617.js} +1 -1
- package/static/core/{d48488c4.js → 1a17438d.js} +1 -1
- package/static/core/{846cd365.js → 1c9acdf4.js} +1 -1
- package/static/core/{31d22827.js → 1dfb486f.js} +1 -1
- package/static/core/{78500214.js → 209e2686.js} +1 -1
- package/static/core/{7934ed7e.js → 2209544a.js} +1 -1
- package/static/core/243ff5f9.js +19 -0
- package/static/core/{579d4466.js → 33588588.js} +1 -1
- package/static/core/{1fcc0627.js → 36ffa6e4.js} +1 -1
- package/static/core/{bbf48eb9.js → 39d9efa2.js} +1 -1
- package/static/core/{4181d334.js → 3a605273.js} +1 -1
- package/static/core/{13a6a2d3.js → 4224aefb.js} +1 -1
- package/static/core/{2865f716.js → 4bfd6086.js} +1 -1
- package/static/core/{3a5bea82.js → 550803ff.js} +1 -1
- package/static/core/{8d0796c1.js → 555c0dda.js} +1 -1
- package/static/core/5661be7c.js +7 -0
- package/static/core/{b0edd3a1.js → 57948058.js} +1 -1
- package/static/core/{66b856ca.js → 58c51568.js} +1 -1
- package/static/core/{5fd45688.js → 5a21c667.js} +1 -1
- package/static/core/{c33a9c36.js → 5cac7517.js} +1 -1
- package/static/core/{c5128299.js → 5d315649.js} +1 -1
- package/static/core/{12963ed5.js → 5f0554d8.js} +1 -1
- package/static/core/605267a0.js +1 -0
- package/static/core/{153a5a27.js → 6100ddd2.js} +1 -1
- package/static/core/{e37da9a7.js → 6c59da82.js} +1 -1
- package/static/core/{9d57053a.js → 87edea39.js} +1 -1
- package/static/core/{31da6da0.js → 8f57829b.js} +1 -1
- package/static/core/{925b75fb.js → 91d46f38.js} +2 -2
- package/static/core/{2d58a94b.js → 92fb4e07.js} +1 -1
- package/static/core/{17c8ebc4.js → 9d0b4233.js} +1 -1
- package/static/core/{cc4657d9.js → a8634edd.js} +1 -1
- package/static/core/{939d4a62.js → b4e4af36.js} +1 -1
- package/static/core/{9916b298.js → bff175af.js} +2 -2
- package/static/core/{f8f52e6d.js → c571b1dd.js} +1 -1
- package/static/core/{37bf0f7a.js → c6114314.js} +1 -1
- package/static/core/{ae251a52.js → ce93456f.js} +1 -1
- package/static/core/{dda98b73.js → d4513bf2.js} +1 -1
- package/static/core/{983a408d.js → de3f9bdc.js} +1 -1
- package/static/core/{70749936.js → e0282a25.js} +1 -1
- package/static/core/{e9281a4c.js → e35eca7d.js} +1 -1
- package/static/core/{6ec347ff.js → e37ba502.js} +1 -1
- package/static/core/{ab741434.js → f4b9148a.js} +1 -1
- package/static/core/{752288e6.js → f4e70f7f.js} +1 -1
- package/static/core/{9438888a.js → f9238279.js} +1 -1
- package/static/esm/{f97f42d1.js → c5372168.js} +1 -1
- package/static/esm/delivery-libs.js +1 -1
- package/static/umd-runtime/{Cvm7BS4_.js → CyULsN57.js} +31 -31
- package/static/umd-runtime/DdK5piwW.js +1 -0
- package/static/umd-runtime/delivery-libs.BJHA1QD4.js +1 -0
- package/static/umd-runtime/runtime.DAdCc3rx.js +1 -0
- package/static/umd-runtime/{ui-kit.CoVNet0I.js → ui-kit.BZ4Y4jr2.js} +2 -2
- package/useblocks-core.cd84d2b9.js +875 -0
- package/useblocks-esm.js +12 -12
- package/{useblocks-po.fd4347fc.js → useblocks-po.cd84d2b9.js} +1 -1
- package/useblocks.d.ts +3 -3
- package/useblocks.js +13 -13
- package/vendor/useblocks-ui-kit/es/components/Custom/FormBackgroundSettings/index.js +3 -3
- package/vendor/useblocks-ui-kit/es/components/Custom/FormBorderRadiusInputs/index.js +6 -6
- package/vendor/useblocks-ui-kit/es/components/Custom/FormBoxShadowInputs/index.js +5 -5
- package/vendor/useblocks-ui-kit/es/components/Custom/FormPanel/FormPaddingInputs/index.js +69 -64
- package/vendor/useblocks-ui-kit/es/components/Custom/FormPanel/FormSizeInputs/index.js +5 -5
- package/vendor/useblocks-ui-kit/es/components/Custom/FormPanel/FormTypographyFields/index.js +5 -5
- package/vendor/useblocks-ui-kit/es/components/Custom/Inputs/DraggableInputNumber/index.js +41 -35
- package/vendor/useblocks-ui-kit/es/components/Layout/Splitter/index.js +5 -0
- package/vendor/useblocks-ui-kit/index.js +12 -11
- package/vendor/useblocks-ui-kit/package.json +1 -1
- package/iframe/js/elMarkupHelper.DLCHSWwj.js +0 -279
- package/static/core/4f5add14.js +0 -1
- package/static/core/68e393e4.js +0 -19
- package/static/core/f126c14c.js +0 -7
- package/static/umd-runtime/B7h7P1Np.js +0 -1
- package/static/umd-runtime/delivery-libs.BymXnePv.js +0 -1
- package/static/umd-runtime/runtime.CQCs2kHH.js +0 -1
- package/useblocks-core.fd4347fc.js +0 -875
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
__useblocks__.define("js/elMarkupHelper.CgToMPJX.js",["require","exports","module"],function(_d,F,Moe){var Jg=Object.defineProperty,_r=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),ie=(e,t)=>{let n={};for(var r in e)Jg(n,r,{get:e[r],enumerable:!0});return t||Jg(n,Symbol.toStringTag,{value:"Module"}),n};function ns(e){"@babel/helpers - typeof";return ns=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ns(e)}function fN(e,t){if(ns(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mN(e){var t=fN(e,"string");return ns(t)=="symbol"?t:t+""}function A(e,t,n){return(t=mN(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var eb;eb=Symbol.toStringTag;var Cd=class{constructor(){A(this,"_valuesMap",new Map),A(this,eb,"Storage")}getItem(e){const t=String(e);return this._valuesMap.has(e)?String(this._valuesMap.get(t)):null}setItem(e,t){this._valuesMap.set(String(e),String(t))}removeItem(e){this._valuesMap.delete(e)}clear(){this._valuesMap.clear()}key(e){if(arguments.length===0)throw new TypeError("Failed to execute 'key' on 'Storage': 1 argument required, but only 0 present.");return Array.from(this._valuesMap.keys())[e]}get length(){return this._valuesMap.size}};function tb(){const e=new Cd;return new Proxy(e,{set:function(t,n,r){return typeof n=="string"&&Cd.prototype.hasOwnProperty(n)?e[n]=r:typeof n=="string"&&e.setItem(n,String(r)),!0},get:function(t,n){if(typeof n=="string"){if(Cd.prototype.hasOwnProperty(n)){const r=e[n];if(typeof r=="function"){const o=r;return(...i)=>o.apply(e,i)}return r}return e.getItem(n)}}})}function nb(){const e=tb(),t=tb();Object.defineProperty(window,"localStorage",{configurable:!0,enumerable:!0,get:()=>e}),Object.defineProperty(window,"sessionStorage",{configurable:!0,enumerable:!0,get:()=>t});let n=Object.create(null);Object.defineProperty(document,"cookie",{enumerable:!1,configurable:!0,get(){const r=[];for(var o in n)r.push(o+"="+n[o]);return r.join(";")},set(r){const o=r.indexOf("=");var i=r.substr(0,o),s=r.substring(o+1);return n[i]=s,i+"="+s}}),Object.defineProperty(document,"clearCookies",{enumerable:!1,configurable:!0,value:()=>n=Object.create(null)})}nb();var rb=Symbol.for("emailmaker.commandInputPause");function ob(){const e=window,t=e[rb];if(t)return t;const n=new Set;return e[rb]=n,window.addEventListener("input",r=>n.forEach(o=>o(r)),!0),n}function hN(){ob()}function pN(e){const t=ob();return t.add(e),()=>{t.delete(e)}}hN();var ib=class{constructor(e){A(this,"_voidElements",void 0),this._voidElements=new Set(e)}isVoidElement(e){return this._voidElements.has(e.toLowerCase())}},At=(function(e){return e[e.StartCommentTag=0]="StartCommentTag",e[e.Comment=1]="Comment",e[e.EndCommentTag=2]="EndCommentTag",e[e.StartTagOpen=3]="StartTagOpen",e[e.StartTagClose=4]="StartTagClose",e[e.StartTagSelfClose=5]="StartTagSelfClose",e[e.StartTag=6]="StartTag",e[e.EndTagOpen=7]="EndTagOpen",e[e.EndTagClose=8]="EndTagClose",e[e.EndTag=9]="EndTag",e[e.DelimiterAssign=10]="DelimiterAssign",e[e.AttributeName=11]="AttributeName",e[e.AttributeValue=12]="AttributeValue",e[e.StartDoctypeTag=13]="StartDoctypeTag",e[e.Doctype=14]="Doctype",e[e.EndDoctypeTag=15]="EndDoctypeTag",e[e.Content=16]="Content",e[e.Whitespace=17]="Whitespace",e[e.Unknown=18]="Unknown",e[e.Script=19]="Script",e[e.Styles=20]="Styles",e[e.EOS=21]="EOS",e[e.BogusComment=22]="BogusComment",e[e.AdvancedStart=100]="AdvancedStart",e[e.AdvancedEnd=101]="AdvancedEnd",e})({}),gN=class{constructor(e,t){A(this,"source",void 0),A(this,"len",void 0),A(this,"position",void 0),this.source=e,this.len=e.length,this.position=t}eos(){return this.len<=this.position}getSource(){return this.source}pos(){return this.position}goBackTo(e){this.position=e}goBack(e){this.position-=e}advance(e){this.position+=e}goToEnd(){this.position=this.source.length}nextChar(){return this.source.charCodeAt(this.position++)||0}peekChar(e=0){return this.source.charCodeAt(this.position+e)||0}advanceIfChar(e){return e===this.source.charCodeAt(this.position)?(this.position++,!0):!1}advanceIfChars(e){let t;if(this.position+e.length>this.source.length)return!1;for(t=0;t<e.length;t++)if(this.source.charCodeAt(this.position+t)!==e[t])return!1;return this.advance(t),!0}advanceIfRegExp(e){const t=this.source.substr(this.position).match(e);return t?(this.position=this.position+t.index+t[0].length,t[0]):""}advanceUntilRegExp(e){const t=this.source.substr(this.position).match(e);return t?(this.position=this.position+t.index,t[0]):(this.goToEnd(),"")}advanceUntilChar(e){for(;this.position<this.source.length;){if(this.source.charCodeAt(this.position)===e)return!0;this.advance(1)}return!1}advanceUntilChars(e){for(;this.position+e.length<=this.source.length;){let t=0;for(;t<e.length&&this.source.charCodeAt(this.position+t)===e[t];t++);if(t===e.length)return!0;this.advance(1)}return this.goToEnd(),!1}skipWhitespace(){return this.advanceWhileChar(e=>e===SN||e===wN||e===yN||e===EN||e===vN)>0}advanceWhileChar(e){const t=this.position;for(;this.position<this.len&&e(this.source.charCodeAt(this.position));)this.position++;return this.position-t}},Td=33,Do=45,rs=60,hn=62,el=47,bN=61,sb=34,ab=39,yN=10,vN=13,EN=12,SN=32,wN=9,lb=63,_N=65,CN=90,TN=97,AN=122;function cb(e){return e>=TN&&e<=AN||e>=_N&&e<=CN}function ub(e){return cb(e)||e===el||e===Td||e===lb}var tl="(?=[\\s/>])",kN=new RegExp(`<!--|-->|<\\/?script${tl}\\s*\\/?>?`,"i"),LN=new RegExp(`<\\/style${tl}`,"i"),NN={"text/x-handlebars-template":!0,"text/html":!0};function xN(e,t=0,n=0,r=!1){const o=new gN(e,t);let i=n,s=0,a=18,l,c,u=!1,d,f,h;function m(){return o.advanceIfRegExp(/^[_:a-zA-Z][_:\w-.\d]*/).toLowerCase()}function p(){const v=o.pos();for(;!o.eos();){const w=o.nextChar();if(w===hn)return!0;if(w===rs)break;if(w===sb||w===ab){if(!o.advanceUntilChar(w))break;o.advance(1)}}return o.goBackTo(v),!1}function S(){for(;o.advanceUntilChar(rs)&&!ub(o.peekChar(1));)o.advance(1)}function C(v){return o.advanceUntilChar(hn)&&o.advance(1),k(v,22)}function L(){return o.advanceIfRegExp(/^[^\s"'></=\x00-\x0F\x7F\x80-\x9F]*/).toLowerCase()}function k(v,w,b){return a=w,s=v,l=b,w}function y(){const v=o.pos(),w=i,b=g();return b!==21&&v===o.pos()&&!(r&&(b===4||b===8))?(o.advance(1),k(v,18)):b}function g(){const v=o.pos();if(o.eos())return k(v,21);let w;switch(i){case 6:return o.advanceIfChars([Do,Do,hn])?(i=0,k(v,2)):(o.advanceUntilChars([Do,Do,hn]),k(v,1));case 3:return o.advanceIfChar(hn)?(i=0,k(v,15)):(o.advanceUntilChar(hn),k(v,14));case 0:return o.peekChar()===rs&&ub(o.peekChar(1))?(o.advance(1),o.peekChar()===Td?o.advanceIfChars([Td,Do,Do])?(i=6,k(v,0)):o.advanceIfRegExp(/^!doctype/i)?(i=3,k(v,13)):C(v):o.peekChar()===lb?C(v):o.advanceIfChar(el)?cb(o.peekChar())?(i=2,k(v,7)):C(v):(i=1,k(v,3))):(S(),k(v,16));case 2:return m().length>0?(i=5,u=!1,k(v,9)):o.skipWhitespace()?k(v,17,"Tag name must directly follow the open bracket."):(i=5,o.advanceUntilChar(hn),v<o.pos()?k(v,18,"End tag name expected."):g());case 5:if(o.skipWhitespace())return u=!0,k(v,17);if(o.advanceIfChar(hn))return i=0,k(v,8);if(r&&o.peekChar()===rs)return i=0,k(v,8,"Closing bracket missing.");if((u||o.peekChar()===el)&&p())return i=0,k(v,8);w="Closing bracket expected.";break;case 1:return d=m(),h=void 0,f=void 0,d.length>0?(c=!1,i=4,k(v,6)):o.skipWhitespace()?k(v,17,"Tag name must directly follow the open bracket."):(i=4,o.advanceUntilChar(hn),v<o.pos()?k(v,18,"Start tag name expected."):g());case 4:return o.skipWhitespace()?(c=!0,k(v,17)):c&&(f=L(),f.length>0)?(i=9,c=!1,k(v,11)):o.advanceIfChars([el,hn])?(i=0,k(v,5)):o.advanceIfChar(hn)?(d==="script"?h&&NN[h]?i=0:i=7:d==="style"?i=8:i=0,k(v,4)):r&&o.peekChar()===rs?(i=0,k(v,4,"Closing bracket missing.")):(o.advance(1),k(v,18,"Unexpected character in tag."));case 9:return o.skipWhitespace()?(c=!0,k(v,17)):o.advanceIfChar(bN)?(i=10,k(v,10)):(i=4,g());case 10:if(o.skipWhitespace())return k(v,17);const b=o.advanceIfRegExp(/^[^\s"'`=<>]+/);if(b.length>0)return f==="type"&&(h=b),i=4,c=!1,k(v,12);const E=o.peekChar();return E===ab||E===sb?(o.advance(1),o.advanceUntilChar(E)&&o.advance(1),f==="type"&&(h=o.getSource().substring(v+1,o.pos()-1)),i=4,c=!1,k(v,12)):(i=4,c=!1,g());case 7:let _=1;for(;!o.eos();){const T=o.advanceIfRegExp(kN);if(T.length===0)return o.goToEnd(),k(v,19);if(T==="<!--")_===1&&(_=2);else if(T==="-->")_=1;else if(T[1]!=="/")_===2&&(_=3);else if(_===3)_=2;else{o.goBack(T.length);break}}return i=0,v<o.pos()?k(v,19):g();case 8:return o.advanceUntilRegExp(LN),i=0,v<o.pos()?k(v,20):g()}return o.advance(1),i=0,k(v,18,w)}return{scan:y,getTokenType:()=>a,getTokenOffset:()=>s,getTokenLength:()=>o.pos()-s,getTokenEnd:()=>o.pos(),getTokenText:()=>o.getSource().substring(s,o.pos()),getScannerState:()=>i,getTokenError:()=>l}}function ON(e,t){return t||e.start!==e.end?`<!DOCTYPE${e.content}>`:""}function RN(e,t){const n=`<!DOCTYPE${e.content}>`;return e.start=t,e.endTagStart=e.startTagEnd=e.end=t+n.length,n}function MN(e,t){return t||e.start!==e.end?`<!--${e.content}-->`:""}function PN(e,t){const n=`<!--${e.content}-->`;return e.start=t,e.startTagEnd=t+4,e.end=t+n.length,e.endTagStart=e.end-3,n}var Ad=new Set(["area","br","col","embed","hr","img","input","link","meta","param","vk-snippet-end"]);function IN(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,n)=>n.toUpperCase())}var db=Object.create(null);function DN(e,t){const n=db[e]||(db[e]=Object.create(null));let r=n[t];if(typeof r!="boolean"){const o=document.createElement(e)[IN(t)];r=n[t]=typeof o<"u"&&typeof o!="boolean"}return r}function kd(e,t){if(e.start===e.end||t)return"";switch(e.type){case I.ELEMENT:return Nd(e,t);case I.ROOT:return[...e.children].map(n=>kd(n,t)).join("");case I.DOCTYPE:return ON(e,t);case I.COMMENT:return MN(e,t);default:return e.content||""}}function Ld(){return{exact:new WeakMap,collapsed:new WeakMap}}function er(e,t=!1,n){if(e.start===e.end&&e.type!==I.ROOT)return"";const r=n&&(t?n.collapsed:n.exact),o=r?.get(e);if(o!==void 0)return o;const i=()=>e.children.map(a=>er(a,t,n)).join("");let s;switch(e.type){case I.ELEMENT:{const a=e.tag?.toLowerCase();s=`<${a}${e.attributeNames.map(l=>` ${l}=${JSON.stringify(e.attributes?.[l]??null)}`).join("")}>${i()}</${a}>`;break}case I.ROOT:s=i();break;case I.COMMENT:s=`<!--${e.content??""}-->`;break;case I.DOCTYPE:s=`<!${e.content??""}>`;break;default:{const a=e.content??"";s=t?a.replace(/\s+/g," ").trim():a}}return r?.set(e,s),s}function nl(e,t=0){if(e.start===e.end)return"";switch(e.type){case I.ELEMENT:return HN(e,t);case I.ROOT:return mb(e,t);case I.DOCTYPE:return RN(e,t);case I.COMMENT:return PN(e,t);default:return e.start=e.startTagEnd=t,e.end=e.endTagStart=t+(e.content?.length||0),e.content||""}}function fb(e){const t=e.tag?.toLowerCase();let n="";if(t){const r=e.attributes;if(r){const o=Object.keys(r);for(const i of o){const s=r[i]===null?"":r[i];typeof s=="string"&&(n+=s===""&&i!=="em"&&!DN(t,i)?` ${i}`:` ${i}="${s.replaceAll('"',"'")}"`)}}}return n}function BN(e,t){let n="";if(e.startTagEnd!==e.endTagStart||t)for(const r of e.children)n+=kd(r);return n}function mb(e,t){let n="";if(e.startTagEnd!==e.endTagStart)for(const r of e.children)n+=nl(r,t+n.length);return n}function hb(e,t){if(e.start!==e.startTagEnd||t){const n=e.tag?.toLowerCase()||"div",r=fb(e);return n==="vk-snippet-end"?`<${n}${r}/>`:`<${n}${r}>`}return""}function pb(e,t){return t||e.endTagStart!==e.end?`</${e.tag?.toLowerCase()||"div"}>`:""}function Nd(e,t,n=!0){const r=e.tag?.toLowerCase()||"div",o=hb(e,t);if(Ad.has(r))return o;{const i=pb(e,t);return`${o}${n?BN(e,t):""}${i}`}}function HN(e,t){const n=e.tag?.toLowerCase()||"div",r=hb(e);if(e.start=t,e.startTagEnd=t+r.length,Ad.has(n)){e.endTagStart=e.startTagEnd,e.end=e.startTagEnd;const o=i=>{for(const s of i.children)s.start=s.startTagEnd=s.endTagStart=s.end=i.end,o(s)};return o(e),r}else{const o=mb(e,e.startTagEnd);e.endTagStart=e.startTagEnd+o.length;const i=pb(e);return e.end=e.endTagStart+i.length,`${r}${o}${i}`}}function xd(e,t){let n=0,r=e.length;if(r===0)return 0;for(;n<r;){const o=Math.floor((n+r)/2);t(e[o])?r=o:n=o+1}return n}var I=(function(e){return e[e.HTML=0]="HTML",e[e.ELEMENT=1]="ELEMENT",e[e.ROOT=2]="ROOT",e[e.COMMENT=3]="COMMENT",e[e.DOCTYPE=4]="DOCTYPE",e[e.ADVANCED=5]="ADVANCED",e})({}),rl=e=>e.type===0?e.start-1:e.start,FN=e=>e.type===0?e.end+1:e.end,kt=class aN{get attributeNames(){return this.attributes?Object.keys(this.attributes):[]}get root(){return this.parent?this.parent.root:this}constructor(t,n,r,o){A(this,"start",void 0),A(this,"end",void 0),A(this,"children",void 0),A(this,"parent",void 0),A(this,"content",void 0),A(this,"type",1),A(this,"tag",void 0),A(this,"closed",!1),A(this,"startTagEnd",void 0),A(this,"endTagStart",void 0),A(this,"attributes",void 0),A(this,"createdBy",void 0),A(this,"isDirty",void 0),this.start=t,this.end=n,this.children=r,this.parent=o}isSameTag(t){return this.tag===void 0?t===void 0:t!==void 0&&this.tag.length===t.length&&this.tag.toLowerCase()===t}get firstChild(){return this.children[0]}get lastChild(){return this.children.length?this.children[this.children.length-1]:void 0}findNodeBefore(t){const n=xd(this.children,r=>t<=rl(r))-1;if(n>=0){const r=this.children[n];if(t>rl(r)){if(t<r.end)return r.findNodeBefore(t);const o=r.lastChild;return o&&o.end===r.end?r.findNodeBefore(t):r}}return this}findNodeAt(t){const n=xd(this.children,r=>t<=rl(r))-1;if(n>=0){const r=this.children[n];if(t>=rl(r)&&t<=FN(r))return r.findNodeAt(t)}return this}find(t){if(t(this))return this;for(const n of this.children){const r=n.find(t);if(r)return r}}closest(t){let n=this;do if(t(n))return n;while(n=n.parent)}parents(){return this.parent?[this.parent,...this.parent.parents()]:[]}closestFromRoot(t,n=!0){const r=n?[this,...this.parents()]:this.parents();for(let o=r.length-1;o>=0;o--){const i=r[o];if(t(i))return i}}contains(t){return!!t.closest(n=>n===this)}clone(t=this.parent,n=this.start,r=!0){const o=this.start-n,i=new aN(n,this.end-o,[],t);return i.children=r?this.children.map(s=>s.clone(i,s.start-o)):[],i.attributes={...this.attributes},i.closed=this.closed,i.content=this.content,i.startTagEnd=this.startTagEnd,i.endTagStart=this.endTagStart,i.tag=this.tag,i.type=this.type,i}};function $N(e){if(typeof e=="string"){const t=e.startsWith("'")||e.startsWith('"')?1:0,n=e.endsWith("'")||e.endsWith('"')?e.length-1:e.length;return e.substring(t,n)}return e}var gb=class{constructor(e,t){A(this,"text",void 0),A(this,"type",void 0),A(this,"node",void 0),A(this,"replaces",void 0),this.text=e,this.type=t}get hasNode(){return!!this.node}addReplace(e){this.replaces?.push(e)}start(e,t,n){if(!this.node){const r=this.node=new kt(e,this.text.length,[],n);r.type=this.type,r.startTagEnd=t,this.replaces=[]}}finish(e,t){const n=this.replaces,r=this.node,o=e+(t||0);if(n){for(const i of n){const s=i.parent;if(!s)throw new Error("parent not defined");const a=s.children.indexOf(i);s.children.splice(a,1)}this.replaces=void 0}if(r){const i=r.parent;if(!i)throw new Error("parent not defined");i.children.push(r),r.closed=t!==void 0,r.endTagStart=e,r.end=o,r.content=this.text.substring(r.startTagEnd,e),this.node=void 0}}},bb=class{constructor(e){A(this,"dataManager",void 0),this.dataManager=e}parse(e,t=[]){const n=xN(e,void 0,void 0,!0),r=new kt(0,e.length,[],void 0);r.type=I.ROOT;let o=r,i=-1,s,a=null,l=n.scan();const c=()=>{if(!o.tag){const p=o.parent.children,S=p[p.length-2],C=e.substring(o.start,o.end);S?.type===I.HTML?(S.content=(S.content||"")+C,S.end=o.end,p.splice(p.length-1,1)):(o.type=I.HTML,o.content=C,o.children=[]),o.type=I.HTML}o=o.parent},u=new gb(e,I.COMMENT),d=new gb(e,I.DOCTYPE),f=p=>{o.children.push(p)},h=(p,S)=>{const C=new kt(p,S,[],o);C.type=I.HTML,C.content=e.substring(p,S),f(C)};for(;l!==At.EOS;){switch(l){case At.StartDoctypeTag:d.start(n.getTokenOffset(),n.getTokenEnd(),o);break;case At.EndDoctypeTag:{const k=o.lastChild,y=d.node;if(!y)throw new Error("");const g=k?k.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(g!==y.start){const v=e.substring(g,y.start);if(v){const w=new kt(g,y.start,[],o);w.type=I.HTML,w.content=v,f(w)}}d.finish(n.getTokenOffset(),n.getTokenLength());break}case At.StartCommentTag:u.start(n.getTokenOffset(),n.getTokenEnd(),o);break;case At.EndCommentTag:{const k=o.lastChild,y=u.node;if(!y)throw new Error("");const g=k?k.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(g!==y.start){const v=e.substring(g,y.start);if(v){const w=new kt(g,y.start,[],o);w.type=I.HTML,w.content=v,f(w)}}u.finish(n.getTokenOffset(),n.getTokenLength());break}case At.StartTagOpen:const p=o.lastChild,S=new kt(n.getTokenOffset(),e.length,[],o),C=p?p.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(C!==S.start){const k=e.substring(C,S.start);if(k){const y=new kt(C,S.start,[],o);y.type=I.HTML,y.content=k,f(y)}}f(S),o=S;break;case At.BogusComment:{const k=o.lastChild?.end??o.startTagEnd??o.start;k<n.getTokenOffset()&&h(k,n.getTokenOffset()),h(n.getTokenOffset(),n.getTokenEnd());break}case At.StartTag:o.tag=n.getTokenText();break;case At.StartTagClose:o.parent&&(o.end=n.getTokenEnd(),n.getTokenLength()?(o.startTagEnd=n.getTokenEnd(),o.tag&&this.dataManager.isVoidElement(o.tag)&&(o.closed=!0,c())):c());break;case At.StartTagSelfClose:o.parent&&(o.closed=!0,o.end=n.getTokenEnd(),o.startTagEnd=n.getTokenEnd(),c());break;case At.EndTagOpen:i=n.getTokenOffset(),s=void 0;break;case At.EndTag:s=n.getTokenText().toLowerCase();break;case At.EndTagClose:let L=o;for(;!L.isSameTag(s)&&L.parent;)L=L.parent;if(L.parent){const k=o.lastChild,y=k?k.end:o.startTagEnd===void 0?o.start:o.startTagEnd;if(y!==i){const g=e.substring(y,i);if(g){const v=new kt(y,i,[],o);v.type=I.HTML,v.content=g,f(v)}}for(;o!==L;)o.end=i,o.closed=!1,c();o.closed=!0,o.endTagStart=i,o.end=n.getTokenEnd(),c()}break;case At.AttributeName:{a=n.getTokenText();let k=o.attributes;k||(o.attributes=k={}),k[a]=null;break}case At.AttributeValue:{const k=n.getTokenText(),y=o.attributes;y&&a&&(y[a]=$N(k),a=null);break}}l=n.scan()}for(;o.parent;)o.end=e.length,o.closed=!1,c();u.hasNode,u.finish(e.length);const m=r.lastChild?.end||0;if(m<e.length){const p=e.substring(m);if(p){const S=new kt(m,e.length,[],r);S.type=I.HTML,S.content=p,f(S)}}return{roots:r.children,findNodeBefore:r.findNodeBefore.bind(r),findNodeAt:r.findNodeAt.bind(r)}}},Poe=new bb(new ib(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"])),WN=new ib(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"]),qN=new bb(WN);function pn(e){return qN.parse(e)}var Od=Symbol("bogusCommentSource");function Cr(e){if(e){const t=document.createElement("div");t.insertAdjacentHTML("afterbegin",e);const n=t.firstChild??document.createTextNode("");return n.nodeType===Node.COMMENT_NODE&&zN(n,e),n}else return document.createTextNode("")}function zN(e,t){const n={source:t,data:e.data};Object.defineProperty(e,Od,{value:n,configurable:!0})}function os(e){const t=e[Od];return t&&t.data===e.data?t:void 0}function ol(e){return os(e)?.source}function yb(e,t){if(e.nodeType===Node.COMMENT_NODE){t.push(e);return}(e.nodeName==="TEMPLATE"?e.content:e).childNodes.forEach(n=>yb(n,t))}function il(...e){const t=[];return e.forEach(n=>yb(n,t)),t}function UN(e,t){return e.data===t.data&&(e.parent===void 0||t.parent===void 0||e.parent===t.parent)}function vb(e,t){os(e)||Object.defineProperty(e,Od,{value:t,configurable:!0})}function jN(e){const t=new Map,n=new Set;for(const{data:r,mark:o}of e){const i=t.get(r);!o||i&&i.source!==o.source?n.add(r):i||t.set(r,o)}return n.forEach(r=>t.delete(r)),t}function VN(e,t,n){if(!t.length||!e.some(o=>o.mark))return;const r=[];for(let o=0;o+t.length<=e.length;o++)n.every((i,s)=>UN(e[o+s],i))&&r.push(o);if(!r.length){const o=jN(e);t.forEach(i=>{const s=o.get(i.data);s&&vb(i,s)});return}t.forEach((o,i)=>{const s=r.map(l=>e[l+i].mark),[a]=s;a&&s.every(l=>l?.source===a.source)&&vb(o,a)})}function Eb(e,t){const n=e.parentNode,r=n&&n.nodeType===Node.ELEMENT_NODE&&!t.includes(n);return{data:e.data,mark:os(e),parent:r?n.nodeName.toLowerCase():void 0}}function Sb(e,t,n){const r=il(...t),o=n?[...t,n]:t;VN(e,r,r.map(i=>Eb(i,o)))}function nn(e,t){Sb(il(e).map(n=>Eb(n,[e])),[t],null)}var GN=/<[!?]|<\/[^a-zA-Z]/,XN=/^<[!?/]/;function KN(e){const t=[],n=r=>{const o=r.parent?.tag?.toLowerCase();if(r.type===I.COMMENT)t.push({data:r.content??"",mark:void 0,parent:o});else if(r.type===I.HTML&&r.content&&XN.test(r.content)){const i=Cr(r.content);i.nodeType===Node.COMMENT_NODE&&t.push({data:i.data,mark:os(i),parent:o})}r.children.forEach(n)};try{pn(e).roots.forEach(n)}catch{return[]}return t}function wb(e,t,n=null){GN.test(t)&&Sb(KN(t),e,n)}function Rd(e,t){wb([e],t)}var is="",YN=4,_b=0;function ZN(){return _b+=1,`${Math.random().toString(36).slice(2)}${_b.toString(36)}`}function QN(e,t,n){if(e.split(`${is}${t}:`).length-1!==n.length)return;const r=e.split(new RegExp(`<!--${is}${t}:(\\d+)${is}-->`)),o=r.filter((i,s)=>s%2===1).map(Number);if(!(o.length!==n.length||new Set(o).size!==n.length||o.some(i=>i>=n.length)))return r.map((i,s)=>s%2?n[Number(i)]:i).join("")}function sl(e,t,n){const r=il(e),o=r.map(l=>os(l)?.source);if(o.every(l=>l===void 0))return t?e.outerHTML:e.innerHTML;const i=n?e:e.cloneNode(!0),s=n?r:il(i),a=r.map(l=>l.data);for(let l=0;l<YN;l++){const c=ZN(),u=[];s.forEach((f,h)=>{const m=o[h];m!==void 0&&(f.data=`${is}${c}:${u.length}${is}`,u.push(m))});const d=QN(t?i.outerHTML:i.innerHTML,c,u);if(d!==void 0)return d}return s.forEach((l,c)=>{l.data=a[c]}),t?i.outerHTML:i.innerHTML}function Tr(e){return sl(e,!0,!1)}function Ke(e){return sl(e,!1,!1)}function Cb(e){return sl(e,!0,!0)}function JN(e){return sl(e,!1,!0)}function Le(e,t){e.innerHTML=t,Rd(e,t)}function Vt(e,t){Le(e,Ke(t))}function Md(e){ss(e,Ke(e))}function ss(e,t){const n=e.parentNode,r=e.previousSibling,o=e.nextSibling;if(e.outerHTML=t,!n)return;const i=[];for(let s=r?r.nextSibling:n.firstChild;s&&s!==o;s=s.nextSibling)i.push(s);wb(i,t,n)}var Tb=new Set(["text/x-handlebars-template","text/html"]);function al(e,t){if(e.type!==I.HTML||!t)return!1;const n=t.tag?.toLowerCase(),r=t.attributes?.type;return n==="style"||n==="script"&&!Tb.has(typeof r=="string"?r:"")}var e2={amp:"&",lt:"<",gt:">",nbsp:String.fromCodePoint(160),quot:'"'};function Pd(e){return e.replaceAll(/&(amp|lt|gt|nbsp|quot);/g,(t,n)=>e2[n])}var Ab=Symbol("rawTextSource");function Id(e){const t=document.createTextNode(Pd(e));return kb(t,e),t}function kb(e,t){Object.defineProperty(e,Ab,{value:t,configurable:!0})}function t2(e,t){e.data=Pd(t),kb(e,t)}function Lb(e){const t=e[Ab];return t!==void 0&&Pd(t)===e.textContent?t:void 0}var Bo,no;function Nb(e){const t=Bo;return Bo=e,()=>{Bo===e&&(Bo=t)}}function n2(e){const t=no;return no=e,()=>{no===e&&(no=t)}}function xb(e,t,n){return Bo?Bo(e,t,n):n}function r2(){return no!==void 0}function Ob(e,t,n){return no?no(e,t,n):n}var Dd;function o2(){return Dd||(Dd=document.implementation.createHTMLDocument("")),Dd}function i2(e,t){let n;switch(t?.toLowerCase()){case"tr":n=e.createElement("table");break;case"td":n=e.createElement("tr");break;case"head":case"body":n=e.createElement("html");break;case"documenttype":case"html":{const r=e.implementation.createHTMLDocument();for(const o of[...r.childNodes])o.remove();return r}default:n=e.createElement("div")}return n}var s2=new Set(["onclick","onload","onchange","onsubmit","onmouseover","onkeydown","onerror"]),a2=new Set(["script","style","xmp"]);function l2(e,t){return!(t&&a2.has(t.toLowerCase())||s2.has(e.toLowerCase()))}var c2=e=>{let t=e.indexOf("&");for(;t!==-1;){if(e.indexOf(";",t)!==-1)return!0;t=e.indexOf("&",t+1)}return!1},u2=new Set(["head","body"]);function Rb(e,t,n){let r=e.tagName.toLowerCase();r==="html"&&(r="div");const o=`<${r} ${t}="${n}"/>`,i=o2(),s=u2.has(r)?i2(i,r):i.createElement("template");if(s instanceof Document)return;s.innerHTML=o;const a=(s.tagName==="TEMPLATE"?s.content:s).querySelector(r);if(!a)throw new Error("targetElement is not defined");const l=a.getAttributeNode(t);l&&e.setAttributeNode(l.cloneNode())}function tr(e,t,n){try{l2(t,e.tagName)&&!c2(n)?e.setAttribute(t,n):Rb(e,t,n)}catch{Rb(e,t,n)}}function Mb(){return Cr("<script><\/script>")}var d2="text/x-em-dormant",as=Symbol("dormantScriptType");function Bd(e){e[as]=e.getAttribute("type"),e.setAttribute("type",d2)}function ll(e){return as in e}function f2(e){const t=[...e].filter(n=>!ll(n));return t.forEach(Bd),t}function m2(e,t){return ll(e)?(e[as]=t,!0):!1}function Pb(e){const t=new Set;for(const n of e){const r="querySelectorAll"in n?n.querySelectorAll("script"):[];for(const o of[n,...r])ll(o)&&t.add(o)}return[...t]}function Ib(e){if(!ll(e))return;const t=e[as];delete e[as],typeof t=="string"?e.setAttribute("type",t):e.removeAttribute("type")}var h2=["application/ecmascript","application/javascript","application/x-ecmascript","application/x-javascript","text/ecmascript","text/javascript","text/javascript1.0","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/javascript1.4","text/javascript1.5","text/jscript","text/livescript","text/x-ecmascript","text/x-javascript"];function p2(e){const t=e.getAttribute("type"),n=e.getAttribute("language");return t===""||t===null&&!n?"text/javascript":(t===null?`text/${n}`:t.trim()).toLowerCase()}function Db(e){const t=p2(e);return h2.includes(t)?"classic":t==="module"||t==="importmap"||t==="speculationrules"?t:void 0}function g2(e){return Db(e)==="classic"}function b2(e){const t=e.getAttribute("for"),n=e.getAttribute("event");return t===null||n===null?!0:t.trim().toLowerCase()==="window"&&["onload","onload()"].includes(n.trim().toLowerCase())}function y2(e){const t=Db(e);return!t||t==="speculationrules"||cl(e)?!1:t!=="classic"||!e.hasAttribute("nomodule")&&b2(e)}function v2(e){return e.hasAttribute("src")&&!["async","defer","nomodule"].some(t=>e.hasAttribute(t))&&g2(e)}function cl(e){for(let t=e.parentElement;t;t=t.parentElement)if(t.localName==="template"&&t.namespaceURI==="http://www.w3.org/1999/xhtml")return!0;return!1}function Bb(e,t){const n=e.parentNode;!n||!e.isConnected||(e.hasAttribute("src")&&!e.hasAttribute("async")&&(e.async=!1),t.run(e,()=>n.insertBefore(e,e.nextSibling)))}function Hb(e,t){[...t.attributes].forEach(r=>t.removeAttributeNode(r)),[...e.attributes].forEach(r=>t.setAttributeNode(r.cloneNode()));const n=Object.getOwnPropertyDescriptor(e,"$$tagName");n&&!Object.getOwnPropertyDescriptor(t,"$$tagName")&&Object.defineProperty(t,"$$tagName",n)}function Fb(e,t,n){e.replaceWith(t),t.append(...e.childNodes),n.substitute?.(e,t)}function $b(e,t){const n=Mb();return Hb(e,n),t.quiet(()=>Fb(e,n,t)),n}function E2(e,t,n){const r=$b(t,n),o=()=>{e.removeEventListener("load",o),e.removeEventListener("error",o),r.isConnected&&(n.quiet(()=>{Hb(r,t),Bd(t),Fb(r,t,n),Ib(t)}),Bb(t,n))};e.addEventListener("load",o),e.addEventListener("error",o)}function Wb(e,t){e.forEach(Ib);const n=e.filter(cl),r=e.filter(i=>i.isConnected&&!cl(i));if(!r.length&&!n.length)return;r.sort((i,s)=>i.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),t.awake?.(),n.forEach(i=>$b(i,t));let o;for(const i of r)o&&!i.hasAttribute("src")?E2(o,i,t):(Bb(i,t),o=v2(i)?i:o)}function ro(e,t=!0,n=!1){const r=e.content;switch(e.type){case I.ROOT:{const o=document.implementation.createHTMLDocument();for(const i of[...o.childNodes])o.removeChild(i);if(t)for(const i of e.children)o.appendChild(ro(i,!0,n));return o}case I.DOCTYPE:return new DOMParser().parseFromString(`<!DOCTYPE${e.content}>`,"text/html").doctype;case I.COMMENT:return document.createComment(r||"");case I.ELEMENT:if(e.tag){const o=e.tag.toLowerCase()==="script",i=n===!0&&o?Mb():document.createElement(e.tag);if(Object.defineProperty(i,"$$tagName",{enumerable:!1,configurable:!1,value:e.tag}),e.attributes)for(const s of e.attributeNames){const a=e.attributes[s];try{const l=xb(i,s,typeof a=="string"?a:"");l!==null&&tr(i,s,l)}catch{}}if(n==="dormant"&&o&&Bd(i),t){const s=e.tag.toLowerCase()==="template"?!0:n;for(const a of e.children)i.appendChild(al(a,e)?Id(a.content||""):ro(a,!0,s))}return i}return document.createTextNode("<");case I.HTML:return Cr(r||"");default:throw new Error("unsupported node")}}function Ne(e,t=!1){return pn(e).roots.map(n=>ro(n,!0,t))}function ul(e,t,n){switch(t){case"afterend":e.after(...n);break;case"afterbegin":e.prepend(...n);break;case"beforeend":e.append(...n);break;case"beforebegin":e.before(...n)}}function qb(e,t){e.replaceChildren(...Ne(t,!0))}function nr(e,t,n){ul(e,t,Ne(n,!0))}var zb=Symbol.for("emailmaker.documentWriteGuard"),ls=Symbol.for("emailmaker.documentWriteSink");function S2(e,t=document){const n=t,r=n[ls];return n[ls]=e,()=>{n[ls]===e&&(n[ls]=r)}}function Ioe(e){}function Hd(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,writable:!0})}function w2(e,t,n){for(let r=e.writerOf.get(t);r;r=e.writerOf.get(r))if(r===n)return!0;return!1}function _2(e,t){let n=t;for(;n.nextSibling&&w2(e,n.nextSibling,t);)n=n.nextSibling;return n}function Ub(e,t,n){if(!n.length)return;n.forEach(i=>e.writerOf.set(i,t));const r=()=>{for(const i of n){const s=t.parentNode;if(!s)return;s.insertBefore(i,_2(e,t).nextSibling)}},o=e.doc[ls];o?o(n,r,t):r()}function jb(e,t){return!!e&&e.type===I.ELEMENT&&!e.closed&&e.end===t}function C2(e,t){let n="";for(let r=e;jb(r,t);r=r.lastChild)n=`</${r.tag}>${n}`;return n}function T2(e){const t=pn(e).roots,n=t[t.length-1],r=jb(n,e.length);return{nodes:(r?t.slice(0,-1):t).map(o=>ro(o)),rest:r?e.slice(n.start):""}}function A2(e){const t=[...e.pending];e.pending.clear();for(const[n,r]of t){const o=pn(r).roots,i=r+C2(o[o.length-1],r.length);Ub(e,n,pn(i).roots.map(s=>ro(s)))}}function Vb(e,t,n){const r=e.doc.currentScript;if(!r?.parentNode){return}const{nodes:o,rest:i}=T2((e.pending.get(r)??"")+n);i?(e.pending.size||queueMicrotask(()=>A2(e)),e.pending.set(r,i)):e.pending.delete(r),Ub(e,r,o)}function k2(e=document){const t=e;if(t[zb])return;t[zb]=!0;const n={doc:t,writerOf:new WeakMap,pending:new Map};Hd(e,"write",(...r)=>Vb(n,"write",r.join(""))),Hd(e,"writeln",(...r)=>Vb(n,"writeln",`${r.join("")}
|
|
2
|
+
`)),Hd(e,"open",(...r)=>r.length>=3?e.defaultView?.open(r[0],r[1],r[2])??null:e)}k2();function L2(e){return e}var N2=class extends Error{constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),A(this,"cycle",void 0),this.cycle=e}};function x2(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const o=t.get(r)??[];o.push(n),t.set(r,o)}return t}function O2(e,t){const n=[];for(const r of e.awaits?.services??[])for(const o of t.get(r)??[])o!==e&&n.push(o);return n}function R2(e){const t=x2(e),n=[],r=new Set,o=[],i=new Set,s=a=>{if(!r.has(a)){if(i.has(a)){const l=o.indexOf(a);throw new N2([...o.slice(l),a].map(c=>c.name))}i.add(a),o.push(a);for(const l of O2(a,t))s(l);o.pop(),i.delete(a),r.add(a),n.push(a)}};for(const a of e)s(a);return n}var Ee=class lN{constructor(t=[]){A(this,"_inner",void 0),A(this,"_isDisposed",!1),this._inner=t}addDisposable(t){return this._inner.push(t),t instanceof lN&&t.addDispose(()=>{this.removeDisposable(t)}),t}addDispose(t){this.addDisposable({dispose:t})}removeDisposable(t){const n=this._inner.indexOf(t);n>=0&&this._inner.splice(n,1)}isDisposed(){return this._isDisposed}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const t of[...this._inner])t.dispose()}}};function Fd(e){return`service_container_${e}`}var cs=new Set,$d;function M2(){if(!$d)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,Gb.prototype.getInstanceAsync),e.stack}function Wd(e){cs.delete(e)&&$d?.end(e)}var Gb=class Qg extends Ee{_runCallbacks(t){[...this._injectCallbacks].forEach(n=>n(t))}constructor(t=null){super(),A(this,"_parent",void 0),A(this,"_injectCallbacks",[]),A(this,"_injections",Object.create(null)),A(this,"onInject",n=>(this._injectCallbacks.push(n),{dispose:()=>{const r=this._injectCallbacks.indexOf(n);r>=0&&this._injectCallbacks.splice(r,1)}})),this._parent=t,t&&this.addDisposable(t.onInject(n=>this._runCallbacks(n)))}inject(t,n){this._injections[t]=()=>n,this._runCallbacks(t)}injectFactory(t,n,r){const o=this._injections[t];let i=typeof o=="function"?o():o;const s=this._injections[t]=()=>(i=n(this,i),i);r&&s(),this._runCallbacks(t)}_find(t,n=!0){return this._injections[t]||n&&this._parent?._find(t)}_onInject(t,n,r=new Ee){return r.addDisposable(this.onInject(o=>{t===o&&!r.isDisposed()&&(r.dispose(),n(this.getInstance(o)))})),this._parent&&r.addDisposable(this._parent._onInject(t,n,r)),this.addDisposable(r),r}getInstance(t,n=!0){const r=this._find(t,n);if(typeof r=="function")return r()}getOrCreateInstance(t,n){const r=this._find(t);if(typeof r=="function")return r();const o=n(this);return this.inject(t,o),o}getInstanceAsync(t){const n=this._find(t);if(typeof n=="function")return Promise.resolve(n());const r=M2();return new Promise((o,i)=>{const s={id:String(t),startedAt:Date.now(),origin:r,container:this,reject:i};cs.add(s),$d?.start(s),this._onInject(t,()=>{Wd(s),o(this.getInstance(t))})})}failPendingWaits(t){for(const n of Array.from(cs))n.container===this&&(Wd(n),n.reject(t))}pendingWaits(){return[...cs].filter(t=>t.container===this)}addService(t,n){const r=Fd(t);this.injectFactory(r,(i,s=[])=>s.indexOf(n)<0?[...s,n]:s);const o=new Ee;return o.addDispose(()=>{this.injectFactory(r,(i,s=[])=>s.filter(a=>a!==n))}),o}addServiceFactory(t,n,r){const o=Fd(t);let i;this.injectFactory(o,(a,l=[])=>(i=n(a,i),i===void 0?l:l.indexOf(i)<0?[...l,i]:l),r);const s=new Ee;return s.addDispose(()=>{this.injectFactory(o,(a,l=[])=>i===void 0?l:l.filter(c=>c!==i))}),s}getServices(t){const n=Fd(t);return[...this.getInstance(n,!1)||[],...this._parent?.getServices(t)||[]]}createChild(){return new Qg(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{const n=this._parent?.getOrCreateIsolatedContainer(t);return new Qg(n)})}remove(t){const n=this._injections;delete n[String(t)]}injectListenerCount(){return this._injectCallbacks.length}dispose(){for(const t of Array.from(cs))t.container===this&&Wd(t);this._injections=Object.create(null),this._injectCallbacks=[],super.dispose()}};function qd(e){return e.startsWith("__")?e:`__${e}__`}function P2(e){if(typeof globalThis>"u")throw new Error("[di] globalThis is required for namespace container access.");const t=qd(e),n=globalThis;return n[t]??(n[t]={})}function I2(e){return e!=null&&typeof e=="object"&&typeof e.inject=="function"&&typeof e.getInstance=="function"}function D2(e){if(e)return qd(e);const t="useblocks".trim();if(!t)throw new Error("[di] REACT_APP_NAME is required for resolveContainer().");return qd(t)}function zd(e){const t=D2(e),n=P2(t);if(I2(n.container))return n.container;const r=new Gb(null);return n.container=r,r}function B2(){let e=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){let r=Math.random()*16;return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(t+r)%16|0,t=Math.floor(t/16)),(n==="x"?r:r&3|8).toString(16)})}function H2(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():B2()}function se(e=H2()){return e}function Xb(){return"iframe".trim()||"unknown"}function F2(e){if(typeof globalThis>"u")return;const t=Xb(),n=globalThis[e]??{};globalThis[e]=n;const r=n.__diagnostics??(n.__diagnostics={}),o=r.diModuleEval??(r.diModuleEval={evalCount:0,records:[]});o.records.push({buildSource:t,timestamp:Date.now(),stack:new Error().stack}),o.evalCount+=1}function $2(){const e="useblocks".trim();if(!e)throw new Error("[di] REACT_APP_NAME is required for DependencyResolver diagnostics.");return`__${e}__`}function W2(e,t){if(F2(t),typeof globalThis>"u")return e;const n=Xb(),r=globalThis,o=r[t]=r[t]||{},i=o.__diagnostics=o.__diagnostics||{},s=i.dependencyResolver=i.dependencyResolver||{entries:[]},a={container:e,source:"packages/runtime-core/di/index.ts",buildSource:n,timestamp:Date.now(),stack:new Error().stack};return s.entries.push(a),e}var dl;function q2(){if(dl)return dl;const e=$2();return dl=W2(zd(e),e),dl}var Doe=new Proxy({},{get(e,t,n){const r=q2(),o=Reflect.get(r,t,n);return typeof o=="function"?o.bind(r):o}}),z2=new Function("url","return import(url)");function U2(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function Ud(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Kb(e){return e.type==="umd"||e.resolve==="registry"}var j2="If the plugin is built on globals, enable the compatibility layer: the `compatGlobals` option of the bundler plugin or `import '<package>/compat-globals'` before creating the editor.";function V2(e){const t=Array.isArray(e)?e[0]:e;return Ud(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function G2(e,t){const n=V2(e),r=Ud(e)?e:void 0,o=t instanceof Error?t.message:String(t),i=r&&Kb(r)&&!/compat/iu.test(o)?` ${j2}`:"",s=new Error(`Plugin "${n}" was skipped: it failed to load. ${o}${i}`);return s.cause=t,{name:n,url:r?.url,error:s}}function X2(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}function Boe(e){return e}var K2=class{constructor(e,t,n={}){A(this,"_context",void 0),A(this,"_pluginRegistry",void 0),A(this,"_options",void 0),A(this,"_map",new Map),A(this,"_optionsMap",new Map),A(this,"_readyMap",new Map),A(this,"_resolveMap",new Map),A(this,"_initializingPlugins",new Map),A(this,"_creatingPlugins",new Set),A(this,"_initializedPlugins",new Set),A(this,"_creationOrder",[]),A(this,"_lifecycleListeners",new Set),A(this,"_activated",!1),this._context=e,this._pluginRegistry=t,this._options=n}activate(){return this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}activateSync(){this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}onLifecycle(e){return this._lifecycleListeners.add(e),{dispose:()=>this._lifecycleListeners.delete(e)}}_emitLifecycle(e){for(const t of Array.from(this._lifecycleListeners))try{t(e)}catch{}}async _resolveEntry(e){if(typeof e=="string"||typeof e=="symbol"){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);return{ctor:t}}if(typeof e=="function")return e.length===0?{ctor:await e()}:{ctor:e};if(Array.isArray(e)){const[t,n]=e;if(typeof t=="function")return{ctor:t,options:n};const r=await this._pluginRegistry.getAsync(t);if(!r)throw new Error(`Plugin "${String(t)}" not registered.`);return{ctor:r,options:n}}if(Ud(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if(Kb(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await z2(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,this._options.explainScriptFailure?.();let o;const i=a=>{o||(a.filename===r.src?o=this._scriptExecutionError(e,a.error??a.message):X2(a)&&(o=this._scriptExecutionError(e,this._options.explainScriptFailure?.()??a.message)))},s=()=>window.removeEventListener("error",i);window.addEventListener("error",i),r.onload=()=>{if(s(),o){n(o);return}t()},r.onerror=()=>{s(),n(new Error(`Failed to load script: ${e}`))},document.head.appendChild(r)})}_scriptExecutionError(e,t){const n=t instanceof Error?t.message:String(t),r=new Error(`Plugin script "${e}" threw while executing: ${n}`);return r.cause=t,r}initSync(e){const t=[];for(const n of e){const r=this._createOrSkip(n,void 0);r&&t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const o=await this._resolveOrSkip(r);if(!o)continue;const i=this._createOrSkip(o.ctor,o.options);i&&!n.has(i)&&(n.add(i),t.push(i))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const s of e){const a=await this._resolveOrSkip(s);a&&(t.add(a.ctor),n.push(a))}const r=[];this._map.forEach((s,a)=>{t.has(a)||r.push({key:a,plugin:s})});for(let s=r.length-1;s>=0;s--){const{key:a,plugin:l}=r[s];await this._initializingPlugins.get(l),await this._disposePlugin(l,l.constructor.name),this._map.delete(a),this._optionsMap.delete(a),this._readyMap.delete(l),this._resolveMap.delete(l),this._initializingPlugins.delete(l),this._initializedPlugins.delete(l);const c=this._creationOrder.indexOf(l);c>=0&&this._creationOrder.splice(c,1)}const o=[],i=new Set;for(const{ctor:s,options:a}of n){const l=this._createOrSkip(s,a);l&&!i.has(l)&&(i.add(l),o.push(l))}this._activated&&await this._startPluginsBatch(o)}isReady(e){return this._initializedPlugins.has(e)}ready(e){return this._initializingPlugins.get(e)??this._readyMap.get(e)??Promise.resolve()}async waitFor(e,t){if(this._pluginRegistry.has(e))return this.useByKeyAsync(e);const{timeout:n}=t??{};return await new Promise((r,o)=>{let i,s=!1;const a=()=>{s||(s=!0,i&&clearTimeout(i),this._pluginRegistry.off(e,a),r())};this._pluginRegistry.on(e,a),n!==void 0&&n>0&&(i=setTimeout(()=>{s||(s=!0,this._pluginRegistry.off(e,a),o(new Error(`waitFor("${String(e)}") timed out after ${n}ms`)))},n))}),this.useByKeyAsync(e)}useByKey(e){const t=this._pluginRegistry.get(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered or not loaded yet. Use useByKeyAsync() for async plugins.`);const n=this._getOrCreate(t);return this._activated&&this._startPluginsBatch([n]),n}async useByKeyAsync(e){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);const n=this._getOrCreate(t);return this._activated&&await this._startPluginsBatch([n]),n}useByCtor(e,t){const n=this._getOrCreate(e,t);return this._activated&&this._startPluginsBatch([n]),n}use(e){return typeof e=="function"?this.useByCtor(e):this.useByKey(e)}async useAsync(e){const{ctor:t,options:n}=await this._resolveEntry(e),r=this._getOrCreate(t,n);return this._activated&&await this._startPluginsBatch([r]),r}_getOrCreate(e,t){const n=e;if(!this._map.has(n)){t!==void 0&&this._optionsMap.set(n,t);const r=this._optionsMap.get(n),o=this._createPluginInstance(e,r),i=o.constructor.name;this._emitLifecycle({type:"created",plugin:o,name:i}),o.required?.(),this._map.set(n,o),this._creationOrder.push(o),this._setupReadyPromise(o)}return this._map.get(n)}async _resolveOrSkip(e){try{return await this._resolveEntry(e)}catch(t){const n=G2(e,t);try{this._options.reportLoadFailure?.(n)}catch{}return}}_createOrSkip(e,t){try{return this._getOrCreate(e,t)}catch(n){const r=e.name||"anonymous plugin";this._emitLifecycle({type:"create:error",ctor:e,name:r,error:n});return}}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);const r=this._options.openEarlyWindow?.();try{return U2(e)?new e(this._context,t):e(this._context,t)||{}}finally{r?.(),this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const o of t){if(this._initializedPlugins.has(o))continue;const i=this._initializingPlugins.get(o);if(i){n.add(i);continue}r.push(o)}if(r.length>0){const o=this._runBatchLifecycle(r);for(const i of r)this._initializingPlugins.set(i,o);n.add(o),o.finally(()=>{for(const i of r)this._initializingPlugins.get(i)===o&&this._initializingPlugins.delete(i)})}await Promise.all(n)}async _runBatchLifecycle(e){const t=[];for(const n of e){const r=n.constructor.name;this._emitLifecycle({type:"init:start",plugin:n,name:r});const o=this._options.openEarlyWindow?.();try{await this._callSync(n,r,"init"),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(i){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:i})}finally{o?.()}}for(const n of t){const r=n.constructor.name;this._emitLifecycle({type:"afterInit:start",plugin:n,name:r});try{await this._callSync(n,r,"afterInit"),this._emitLifecycle({type:"afterInit:success",plugin:n,name:r})}catch(o){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:o})}}for(const n of e)this._initializedPlugins.add(n),this._resolveMap.get(n)?.(),this._resolveMap.delete(n)}_callSync(e,t,n){this._emitLifecycle({type:`${n}:enter`,plugin:e,name:t});try{return e[n]?.()}finally{this._emitLifecycle({type:`${n}:leave`,plugin:e,name:t})}}async _disposePlugin(e,t){this._emitLifecycle({type:"dispose:start",plugin:e,name:t});try{await e.dispose?.(),this._emitLifecycle({type:"dispose:success",plugin:e,name:t})}catch(n){this._emitLifecycle({type:"dispose:error",plugin:e,name:t,error:n})}}async dispose(){for(let e=this._creationOrder.length-1;e>=0;e--){const t=this._creationOrder[e];await this._initializingPlugins.get(t),await this._disposePlugin(t,t.constructor.name)}this._map.clear(),this._optionsMap.clear(),this._readyMap.clear(),this._resolveMap.clear(),this._initializingPlugins.clear(),this._initializedPlugins.clear(),this._creationOrder.length=0,this._lifecycleListeners.clear()}getStatus(){return Array.from(this._map.values()).map(e=>({name:e.constructor.name,initialized:this._initializedPlugins.has(e)}))}},Yb=class{constructor(){A(this,"_plugins",new Map),A(this,"_listeners",new Map)}_getOrCreateEntry(e){let t=this._plugins.get(e);return t||(t={overrides:[]},this._plugins.set(e,t)),t}_applyOverrides(e,t){const n=this._plugins.get(e);if(n?.overrides)for(const r of n.overrides)t=r(t)||t;return t}_notifyListeners(e,t){const n=this._listeners.get(e);if(!n||n.length===0)return;for(const o of n)try{o.callback(t)}catch{}const r=n.filter(o=>!o.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){const n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){const n=Promise.resolve(t.factory()).then(o=>(t.ctor=o,t.loading=void 0,this._notifyListeners(e,o),o));t.loading=n;const r=await n;return this._applyOverrides(e,r)}return new Promise(n=>{this.on(e,r=>n(this._applyOverrides(e,r)))})}add(e,t){const n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(const t of Object.keys(e)){const n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){const n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){const t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){const n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{const r=n.overrides.indexOf(t);r>=0&&n.overrides.splice(r,1)}}}on(e,t){const n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const o={callback:t,once:!1};return r.push(o),{dispose:()=>this._removeListener(e,t)}}once(e,t){const n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const o={callback:t,once:!0};return r.push(o),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){const n=this._listeners.get(e);if(n){const r=n.findIndex(o=>o.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){const e=this;return{add(t,n){e.add(t,n)}}}},Y2=class{constructor(e){A(this,"resolveRegistry",void 0),this.resolveRegistry=e}target(){return this.resolveRegistry()}get(e){return this.target().get(e)}getAsync(e){return this.target().getAsync(e)}add(e,t){return this.target().add(e,t)}addAll(e){return this.target().addAll(e)}addAsync(e,t){return this.target().addAsync(e,t)}has(e){return this.target().has(e)}isLoaded(e){return this.target().isLoaded(e)}override(e,t){return this.target().override(e,t)}on(e,t){return this.target().on(e,t)}once(e,t){return this.target().once(e,t)}off(e,t){return this.target().off(e,t)}keys(){return this.target().keys()}forContext(){return this.target().forContext()}},Y=se("SandboxHtmlDocument"),it=se("SandboxRemoteDocument"),us=se("SandboxTextDocument"),gn=se("SandboxDocumentMapping"),_e=se("SandboxSyncCommit"),ds=se("SandboxLayoutProfile"),Zb=se("SandboxState"),xe=se("SandboxSelectionLock"),Ye=se("SandboxEditLock"),Ho=se("SandboxAttributePipeline"),jd=se("SandboxAmpService"),Vd=se("SandboxImageReload"),fl=se("SandboxImageCache"),st=se("SandboxFocus"),Gd=se("SandboxLocalization"),De=se("SandboxElementSettings"),Fo=se("SandboxElementRefs"),vt=se("SandboxSetCursor"),Qb=se("SandboxStyleRoot"),Jb=se("SandboxVmlWidthResolver"),ml=se("SandboxPrepareHtml"),fs=se("SandboxSurfaceName"),$o=se("SandboxDocumentSync"),Wo=se("SandboxMapObj"),qo=se("SandboxActiveElementFingerprint"),hl=se("SandboxToggleTextStyle"),bn=se("SandboxWrapEditor"),Ar=se("SandboxInsertServices"),ms=se("SandboxInitPreview"),Xd=se("SandboxInsertPolicy"),zo=se("SandboxTableSelections"),ey=se("SandboxNarrowTableTextAtom"),ty=se("SandboxSettingsExtras"),ny=se("SandboxViewportHandlers"),ry=se("SandboxOperations"),Uo=se("SandboxApplyElementSettings"),kr=se("SandboxOperationEnvironment"),jo=se("SandboxHostFacts"),Z2="__sandbox__",Pt=zd(Z2);function Q2(e){return e}function J2(e,t=Pt){t.inject(fs,e.name),t.inject(ds,e.profile);for(const n of R2(e.units))n.setup(t);return t}function yn(e,t){e.remove?.(t)}function M(e,t){const n=e.getInstance(t);if(n===void 0)throw new Error(`[sandbox] служба «${String(t)}» не зарегистрирована: её фича не подключена или ещё не зарегистрирована`);return n}var oy=class extends Ee{constructor(e={}){super(),A(this,"_options",void 0),A(this,"_listeners",[]),A(this,"on",this._addListener.bind(this)),A(this,"event",this._addListener.bind(this)),A(this,"once",(t,n=0,r)=>{const o=this._addListener((...i)=>(o?.dispose(),r?t.call(r,...i):t(...i)),n);return o}),A(this,"un",t=>{const n=this._listeners.findIndex(([r])=>r===t);n>=0&&(this._listeners.splice(n,1),this._listeners.length===0&&this._options.onLastListenerRemove&&this._options.onLastListenerRemove())}),this._options=e}getListeners(e){return this._listeners.flatMap(([t])=>typeof t=="function"?t:t.getListeners(e))}hasListeners(){for(const[e]of this._listeners){if(typeof e=="function")return!0;const t=e;if(typeof t.hasListeners=="function"){if(t.hasListeners())return!0;continue}return!0}return!1}_addListener(e,t=0,n){if(this.isDisposed())return{dispose:()=>{}};const r=this._listeners,o=this._options;n&&typeof e=="function"&&(e=e.bind(n));const i=r.findIndex(([,a])=>a<t),s=[e,t];return r.splice(i>=0?i:r.length,0,s),r.length===1&&o.onFirstListenerAdd&&o.onFirstListenerAdd(),{dispose:()=>{const a=r.indexOf(s);a>=0&&(r.splice(a,1),!r.length&&o.onLastListenerRemove&&o.onLastListenerRemove())}}}dispose(){this._listeners.splice(0,this._listeners.length),this._options.onLastListenerRemove&&this._options.onLastListenerRemove(),super.dispose()}},ex=class extends oy{execute(e,t){for(const n of t)try{n(...e)}catch{}}fire(...e){if(!this.isDisposed()){const t=this.execute(e,this.getListeners(e));return t===void 0?void 0:t}}},ge=class extends ex{execute([e],t){for(const n of t)try{n(e)}catch{}}},tx=class extends oy{fire(e){if(this.isDisposed())return;let t=!1,n=!1;const r={value:e,preventDefault(){t=!0},stopPropagation(){n=!0}},o=this.getListeners([r]);for(const i of o){if(n)break;try{i(r)}catch{}}return t?!1:void 0}};function nx(e,t,n){let r;const o=new ge({onFirstListenerAdd(){r=o.addDisposable(new Ee),r.addDisposable(e(i=>{t(i)!==!1&&o.fire(i)}))},onLastListenerRemove(){r?.dispose(),r=void 0}});return n?.addDisposable(o),o.event}function rx(e,t=window){return{peer:e,send(n){e.postMessage(n,"*")},subscribe(n){const r=o=>{n({data:o.data,source:o.source,ports:o.ports})};return t.addEventListener("message",r),{dispose:()=>t.removeEventListener("message",r)}},close(){}}}function ox(e){let t=!1;return{peer:e,send(n){e.postMessage(n)},subscribe(n){const r=o=>{n({data:o.data,source:e})};return e.addEventListener("message",r),t||(t=!0,e.start()),{dispose:()=>e.removeEventListener("message",r)}},close(){e.close()}}}function Hoe(e){return e}function ix(e){return e&&typeof e=="object"}function iy(e,t){return e&&typeof e=="object"&&e.operationId===t}var Pn="INIT_MESSAGE",sx="em:port-ready",ax="em:window-drained",Kd="";function sy(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}var lx=class extends Ee{constructor(...e){super(...e),A(this,"_listeners",Object.create(null)),A(this,"addListenerAsync",(t,n,r=0,o)=>{const i=this._listeners[t]||(this._listeners[t]=[]);o&&typeof n=="function"&&(n=n.bind(o));const s=i.findIndex(([l,c])=>r<=c),a=[n,r];return this.isDisposed()||i.splice(s>=0?s:i.length,0,a),{dispose(){const l=i.indexOf(a);l>=0&&i.splice(l,1)}}}),A(this,"fireAsync",(t,n)=>{if(!this.isDisposed()){const r=this._listeners[t]||(this._listeners[t]=[]);let o;for(let i=0;i<r.length;i++){const s=r[i][0],a=o;o=l=>s(l,a)}if(o)return o(n)}}),A(this,"addListener",(t,n,r=0)=>this.addListenerAsync(t,(o,i)=>{try{n(o)}catch{}return i&&i(o)},r))}},cx=class extends Ee{constructor(e,t){super(),A(this,"_singleton",void 0),A(this,"_target",void 0),A(this,"_transport",void 0),A(this,"_transportSubscription",void 0),A(this,"_ports",new Map),A(this,"_drained",new WeakSet),A(this,"_portSendHeld",new WeakSet),A(this,"_inited",!1),A(this,"_emitter",this.addDisposable(new lx)),A(this,"_handshaken",new WeakSet),A(this,"_greeted",new WeakSet),A(this,"_outgoingFilter",void 0),A(this,"_outgoingObservers",new Set),A(this,"_offTargetListeners",new Map),A(this,"_onTransportMessage",n=>{const r=n,o=r.data,i=r.source,s=o?.port===!0?r.ports?.[0]:void 0,a=!this._isPortSource(r.source);if(a&&i&&o?.operationId==="em:window-drained"){this._ports.has(i)&&this._drained.add(i);return}if(a&&i&&this._drained.has(i))return;if(i&&i!==this._target&&this._greeted.has(i)&&iy(o,Pn)){this._greeted.delete(i),this._handshaken.add(i),this._postMessage(i,{operationId:Pn,data:{}}),s&&this.usePort(s,!0,i);return}const l=r.source===this.target||this._isCurrentPort(r.source);if(l||this._notifyOffTarget(o?.operationId,r.source),ix(o)&&l||this._singleton&&iy(o,Pn)){if(s&&l){const f=this._target;Promise.resolve().then(()=>this.usePort(s,!0,f))}const c=this._emitter.fireAsync(o.operationId||Kd,o.operationId===void 0?r:o.data),u=o.result,d=o.error;u&&d&&Promise.resolve(c).then(f=>this._sendMessage(u,f),f=>this._sendMessage(d,f))}}),this._singleton=t,this._transport=rx({postMessage:()=>{}},window),this._transportSubscription=this.addDisposable(this._transport.subscribe(this._onTransportMessage)),this.addListener(Pn,()=>{this._inited||(this._inited=!0,this._target&&this._handshaken.add(this._target),this.send(Pn))}),e&&this.setTarget(e)}setTarget(e){if(this._target!==e){if(this._target=e,!e){this._inited=!1;return}if(this._handshaken.has(e)){this._inited=!0,this._emitter.fireAsync(Pn,void 0);return}this._inited=!1,this._postMessage(e,{operationId:Pn,data:{}})}}sendPort(e,t){this._postMessage(e,{operationId:Pn,data:{},port:!0},[t])}observeOutgoing(e){return this._outgoingObservers.add(e),{dispose:()=>{this._outgoingObservers.delete(e)}}}_notifyOutgoing(e,t){for(const n of Array.from(this._outgoingObservers))try{n(e,t)}catch{}}addOffTargetListener(e,t){let n=this._offTargetListeners.get(e);return n||(n=new Set,this._offTargetListeners.set(e,n)),n.add(t),{dispose:()=>{n.delete(t)}}}_notifyOffTarget(e,t){const n=typeof e=="string"?this._offTargetListeners.get(e):void 0,r=n?.size?this._knownPeer(t):void 0;if(!(!n||!r))for(const o of Array.from(n))try{o(r)}catch{}}_knownPeer(e){for(const[n,r]of this._ports)if(r.transport.peer===e)return n;const t=e;return typeof e=="object"&&e!==null&&(this._handshaken.has(t)||this._greeted.has(t))?t:void 0}setOutgoingFilter(e){return this._outgoingFilter=e,()=>{this._outgoingFilter===e&&(this._outgoingFilter=void 0)}}sendNow(e){const t=this._target;return!this._inited||!t?!1:(this._postMessage(t,e),!0)}greet(e){this._handshaken.has(e)||this._greeted.has(e)||this._target===e||(this._greeted.add(e),this._postMessage(e,{operationId:Pn,data:{}}))}forget(e){this._handshaken.delete(e),this._greeted.delete(e),this._closePort(e),this._drained.delete(e),this._target===e&&(this._inited=!1)}usePort(e,t=!1,n=this._target){if(!n||this._ports.has(n))return;const r=ox(e),o=r.subscribe(this._onTransportMessage);this._ports.set(n,{transport:r,subscription:o}),t&&(r.send({operationId:sx,data:{}}),this.drainWindow(n))}holdPort(e=this._target){!e||!this._ports.has(e)||(this._portSendHeld.add(e),this._drained.delete(e))}resumePort(e=this._target){e&&this._portSendHeld.delete(e)}useWindow(e=this._target){e&&(this._closePort(e),this._drained.delete(e))}get usesPort(){return this._target!==void 0&&this._ports.has(this._target)&&!this._portSendHeld.has(this._target)}hasPort(e,t){const n=this._ports.get(e);return n!==void 0&&(t===void 0||n.transport.peer===t)}_closePort(e){const t=this._ports.get(e);t&&(t.subscription.dispose(),t.transport.close(),this._ports.delete(e),this._portSendHeld.delete(e))}drainWindow(e){this._ports.has(e)&&e.postMessage({operationId:ax,data:{}},"*")}isWindowDrained(e){return this._drained.has(e)}_isPortSource(e){for(const t of this._ports.values())if(t.transport.peer===e)return!0;return!1}_isCurrentPort(e){return this._target!==void 0&&this._ports.get(this._target)?.transport.peer===e}getTarget(){return this._target}get target(){return this._target}_postMessage(e,t,n){let r=t;this._outgoingFilter&&!n?.length&&(r="data"in t?{...t,data:this._outgoingFilter(t.data)}:this._outgoingFilter(t));try{const o=this._ports.get(e);if(o&&!this._portSendHeld.has(e)){o.transport.send(r);return}if(n?.length){e.postMessage(r,"*",n);return}e.postMessage(r,"*")}catch(o){if(o?.name==="DataCloneError"){const i=typeof r?.data=="object"&&r?.data!==null?r.data:void 0}throw o}}_sendMessage(e,t,n=!0){if(!n&&!this.isInited())return;e&&this._notifyOutgoing(e,t);const r=this.addDisposable(this.onInit(o=>{const i=e?{operationId:e,data:t}:t;try{this._postMessage(o,{...i})}finally{r.dispose()}}))}send(e,t,n){return typeof e=="string"?this._sendMessage(e,t,n):this._sendMessage(Kd,e,t)}sendAsync(e,t,n=!0){if(!n&&!this.isInited())return Promise.resolve();this._notifyOutgoing(e,t);const r=sy(),o=sy();return new Promise((i,s)=>{const a=this.addDisposable(new Ee);a.addDisposable(this.onInit(l=>{try{this._postMessage(l,{operationId:e,data:t,result:r,error:o})}catch(c){a.dispose(),s(c);return}a.addDisposable(this._onMessage(r,c=>{i(c),a.dispose()})),a.addDisposable(this._onMessage(o,c=>{s(c),a.dispose()}))}))})}_onMessage(e,t,n=0){return this._emitter.addListener(e,t,n)}addListener(e,t,n){return t?this._onMessage(e,t,n):this._onMessage(Kd,e)}addListenerAsyncPipe(e,t,n=0){return this._emitter.addListenerAsync(e,t,n)}addListenerAsync(e,t,n=0){return this._emitter.addListenerAsync(e,async(r,o)=>{const i=await t(r);return o?o(r):i},n)}isInited(){return this._inited}get inited(){return this._inited}onInit(e,t=!0,n=0){const r=this.addDisposable(new Ee);return this._inited&&this._target?t&&Promise.resolve().then(()=>{!this._inited||!this._target?r.addDisposable(this.onInit(e,t,n)):e(this._target)}):r.addDisposable(this._onMessage(Pn,()=>{e(this._target)},n)),r}dispose(){for(const e of Array.from(this._ports.keys()))this._closePort(e);this._transport.close(),super.dispose()}};function ay(e,t){if(e===t)return;let n=0;const r=Math.min(e.length,t.length);for(;n<r&&e[n]===t[n];)n++;let o=e.length,i=t.length;for(;o>n&&i>n&&e[o-1]===t[i-1];)o--,i--;return{start:n,fromEnd:o,toEnd:i}}function ly(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return{length:e.length,hash:t>>>0}}var ux=/<\/?[a-zA-Z][a-zA-Z0-9:_.-]*(?:\s[^<>]*)?\/?>/g;function dx(e){return e.replace(ux,t=>/^<br\b/i.test(t)?" ":"")}var fx={theme:"canvas_fact_theme",flags:"canvas_fact_flags",commonStyles:"canvas_fact_common_styles",lockEditor:"canvas_fact_lock_editor",codeMode:"canvas_fact_code_mode",appName:"canvas_fact_app_name",previewPage:"canvas_fact_preview_page",viewport:"canvas_fact_viewport"},oo=8e3,mx=2e3,hx=15e3,Yd=3e3,px="fonts.googleapis.com",gx=e=>{try{const t=new URL(String(e??"").trim());return t.protocol==="https:"?t:null}catch{return null}},bx=e=>{const t=gx(String(e??""));return t?t.hostname===px&&t.pathname.startsWith("/css")&&!!t.searchParams.get("family"):!1},ue={MESSAGE:"message",INIT_PREVIEW:"init_preview",UPDATE_EDITOR:"update_editor",UPDATE_EDITOR_POSITION:"update_editor_position",UPDATE_SIDE_MENU_EDITOR:"update_side_menu_editor",SAVE_EMAIL:"saveEmail",SANDBOX_ELEMENT_SETTINGS_SET:"sandbox_element_settings_set",SANDBOX_IMAGE_RESET:"sandbox_image_reset",SANDBOX_NATIVE_IMAGE_DROP_CLEAR:"sandbox_native-image-drop-clear",SANDBOX_EMAIL_SETTINGS_SET:"sandbox_email_settings_set",SANDBOX_BLOCK_SETTINGS_SET:"sandbox_block_settings_set",SANDBOX_ELEMENT_PARENT_GET:"sandbox_element_parent_get",SANDBOX_ELEMENT_PARENT_TABLE_GET:"sandbox_element_parent_table_get",SANDBOX_ELEMENT_PREV_GET:"sandbox_element_prev_get",SANDBOX_ELEMENT_NEXT_GET:"sandbox_element_next_get",SANDBOX_ELEMENT_REMOVE:"sandbox_element_remove",SANDBOX_ELEMENT_ACTIVE_RESET:"sandbox_element_active_reset",SANDBOX_ELEMENT_ACTIVE_SET:"sandbox_element_active_set",SANDBOX_ELEMENT_HOVER_SET:"sandbox_element_hover_set",SANDBOX_ELEMENT_IMG_LINK:"sandbox_element_img_link",SANDBOX_ELEMENT_TEXT:"sandbox_element_text",SANDBOX_EMAIL_CONTENT_GET:"sandbox_email_content_get",SANDBOX_SET_POSITION_TO_IMG:"sandbox_set_position_to_img",SANDBOX_SET_POSITION_TO_LINK:"sandbox_set_position_to_link",SANDBOX_ACCORDION_ADD_SECTION:"sandbox_accordion_add_section",SANDBOX_ACCORDION_REMOVE_SECTION:"sandbox_accordion_remove_section",APPLICATION_FOCUS_IN_IFRAME:"application_focus_in_iframe",APPLICATION_EMAIL_SETTINGS_SET:"application_email_settings_set",APPLICATION_BLOCK_SETTINGS_SET:"application_block_settings_set",APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",_APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",APPLICATION_ELEMENT_SETTINGS_CLOSE:"application_element_settings_close",APPLICATION_ACTION:"application_action",APPLICATION_EBLOCK_ADD:"application_eblock_add",SANDBOX_EBLOCK_SET_EM_BLOCK_ID:"sandbox_eblock_set_em_block_id",SANDBOX_EBLOCK_CLEAR_EM_BLOCK_ID:"sandbox_eblock_clear_em_block_id",SANDBOX_GLOBAL_BLOCK_REPLACE:"sandbox_global_block_replace",APPLICATION_SCROLL_TO:"application_scroll-to",APPLICATION_SCROLL_BLOCK_SHOW:"application_scroll-block-show",APPLICATION_SCROLL_BLOCK_HIDE:"application_scroll-block-hide",APPLICATION_DISCUSS_SET_ID:"application_discuss_set_id",APPLICATION_DISCUSS_GET_COMMENT:"application_discuss_get_comment",APPLICATION_DISCUSS_NO_COMMENT:"application_discuss_no_comment",APPLICATION_DISCUSS_SAVE_TARGET:"application_discuss_save_target",APPLICATION_IFRAME_SET_HEIGHT:"application_iframe_set_height",APPLICATION_COMMON_STYLES_UPDATE:"application_commonStyles_update",APPLICATION_EMAIL_CONTENT_GET:"application_email_content_get",APPLICATION_OPEN_IMAGE_AI_POPUP:"application_open-image-ai-popup",APPLICATION_OPEN_IMAGE_UPLOAD_POPUP:"application_open-image-upload-popup",APPLICATION_OPEN_IMAGE_EDIT_POPUP:"application_open-image-edit-popup",APPLICATION_OPEN_IMAGE_GIF_POPUP:"application_open-image-gif-popup",APPLICATION_OPEN_IMAGE_STOCK_POPUP:"application_open-image-stock-popup",APPLICATION_CLOSE_IMAGE_EDIT_POPUP:"application_close-image-edit-popup",APPLICATION_NATIVE_IMAGE_DROP:"application_native-image-drop",APPLICATION_SUBJECT_UPDATE:"application_subject_update",APPLICATION_PREHEADER_UPDATE:"application_preheader_update",APPLICATION_DOMPARSER_ERROR:"application_domparser_error",APPLICATION_SYNC_DRIFT:"application_sync_drift",APPLICATION_UPDATE_ENTITY:"application_update_entity",APPLICATION_IFRAME_DRAG_EVENT:"application_iframe_drag_event",APPLICATION_HAS_AMP:"application_has_amp",APPLICATION_CANVAS_IMAGE_GET:"application_canvas_image_get",APPLICATION_PREVIEW_ALERT_SHOW:"application_preview_alert_show",APPLICATION_ATOM_INSERTED:"application_atom_inserted",APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW:"application_template_not_em_alert_show",SANDBOX_IFRAME_SETSIZE:"sandbox_iframe-setsize",SANDBOX_BLOCK_INSERT:"sandbox_block-insert",SANDBOX_ATOM_INSERT:"sandbox_atom-insert",SANDBOX_DRAG_CANCEL:"sandbox_drag-cancel",UPDATE_EDITOR_POSITION_FROM_EDITOR:"update_position_from_editor",UPDATE_EDITOR_POSITION_FROM_IFRAME:"update_position_from_iframe",SANDBOX_CHANGE_PREVIEW:"sandbox_change_preview",APPLICATION_CHANGE_PREVIEW:"application_change_preview",SANDBOX_LOCK_EDIT:"sandbox_lock_edit",SANDBOX_FLOATBLOCK_ADD:"sandbox_floatBlock_add",SANDBOX_FLOATBLOCK_REMOVE:"sandbox_floatBlock_remove",SANDBOX_FLOATBLOCK_COPY:"sandbox_floatBlock_copy",SANDBOX_FLOATBLOCK_SWAP:"sandbox_floatBlock_swap",EDITOR_CHANGE_FOCUS:"editor_change_focus",SANDBOX_RESIZED:"sandbox_resized",SANDBOX_LOCK_DISCUSS:"sandbox_lock_discuss",SANDBOX_DISCUSS_SET_TARGET:"sandbox_discuss_set_target",SANDBOX_DISCUSS_REMOVE_TARGET:"sandbox_discuss_remove_target",SANDBOX_DISCUSS_RESET:"sandbox_discuss_reset",SANDBOX_DISCUSS_GET_TARGET:"sandbox_discuss_get_target",SANDBOX_READY:"SANDBOX_READY",SANDBOX_FLOATBLOCK_WRAP:"sandbox_floatblock_wrap",SANDBOX_FLOATBLOCK_DIR:"sandbox_floatblock_dir",SANDBOX_SUBJECT_UPDATE:"sandbox_subject_update",SANDBOX_PREHEADER_UPDATE:"sandbox_preheader_update",SANDBOX_DRAG_EVENT:"sandbox_drag_event",SANDBOX_WHEEL:"sandbox_wheel",SANDBOX_TRANSLATIONS:"sandbox_send_translations",SANDBOX_SET_THEME_VARIABLES:"sandbox_send_theme_variables",SANDBOX_SET_PROJECT_FONTS:"sandbox_set_project_fonts",SANDBOX_CANVAS_IMAGE_CACHE_SETUP:"sandbox_canvas_image_cache_setup",SANDBOX_SET_ENTITY:"sandbox_set_entity",SANDBOX_INIT_START:"sandbox_init_start",SANDBOX_INITED:"sandbox_inited",SANDBOX_UPDATE_ENTITY:"sandbox_update_entity",RELOAD:"reload",SANDBOX_ADD_EXTENSIONS:"sandbox_add_extensions",SANDBOX_REMOVE_EXTENSIONS:"sandbox_remove_extensions",SANDBOX_ADD_SCRIPT:"sandbox_add_script",SANDBOX_IS_EMAIL_EMPTY:"sandbox_is_email_empty",SANDBOX_SWITCH_THEME:"sandbox_switch_theme",SANDBOX_CANVAS_HEALTH:"sandbox_canvas_health",SANDBOX_CANVAS_SYNCED:"sandbox_canvas_synced",SANDBOX_ELEMENT_OPERATION:"sandbox_element_operation"},yx=e=>({REORDER_ATOM:e("Reorder element"),CLONE_ATOM:e("Clone element"),REMOVE_ATOM:e("Remove element"),EDIT_ATOM:e("Edit element"),CHANGE_IMAGE:e("Change image"),CHANGE_IMAGE_EDIT:e("Edit"),CHANGE_IMAGE_STOCK:e("Stock"),CHANGE_IMAGE_CHANGETO:e("Upload"),CHANGE_IMAGE_GIF:e("GIF"),CHANGE_IMAGE_AI:e("Generate"),REORDER_BLOCK:e("Reorder block"),REORDER_BLOCK_UP:e("Move up"),REORDER_BLOCK_DOWN:e("Move down"),EDIT_BLOCK:e("Edit block"),CLONE_BLOCK:e("Clone block"),MERGE_BLOCK:e("Merge with the chosen block"),UNMERGE_BLOCK:e("Split blocks"),COPY_BLOCK_TO_CLIPBOARD:e("Copy block to clipboard"),PASTE_BLOCK_FROM_CLIPBOARD:e("Paste block from clipboard"),REMOVE_BLOCK:e("Remove block"),SAVE_TO_BLOCKS:e("Save to Blocks"),UPDATE_GLOBAL_BLOCK_IN_TEMPLATES:e("Push block update to all templates"),ADD_BLOCK:e("Add block"),ADD_EMPTY_BLOCK:e("Add an empty block"),ADD_SAVED_BLOCK:e("Add a saved block"),ADD_COMMON_BLOCK:e("Add a common block"),ADD_TEMPLATE_BLOCK:e("Add a template block"),ADD_SEARCH_BLOCK:e("Search a block"),REORDER_GROUP:e("Reorder group"),EDIT_GROUP:e("Edit group"),CLONE_GROUP:e("Clone group"),REMOVE_GROUP:e("Remove group"),ADD_GROUP:e("Add group"),LINK:e("link"),TABLE_COLUMN:e("cell"),TABLE:e("table"),FLOAT_BLOCK:e("column"),CONTAINER:e("container"),PICTURE:e("picture"),CAROUSEL:e("carousel"),ACCORDION:e("accordion"),SOCIAL:e("Social media"),VERTICAL_INDENT:e("indent"),TEXT:e("text"),BUTTON:e("button"),VAR:e("variable"),STRUCTURE:e("block"),EMAIL:e("email"),GROUP:e("group"),TYPOGRAF:e("Typograf"),COUNTDOWN:e("countdown"),ELEMENT:e("element"),VIDEO:e("video"),ELEMENT_PATH_LINK:e("Link"),ELEMENT_PATH_BLOCK:e("Block"),ELEMENT_PATH_ATOM:e("Element"),ELEMENT_PATH_TD:e("Cell"),ELEMENT_PATH_TABLE:e("Table"),ELEMENT_PATH_FLOATBLOCK:e("Column"),ELEMENT_PATH_TEXT:e("Text"),ELEMENT_PATH_DIV:e("Container"),ELEMENT_PATH_GROUP:e("Group"),ELEMENT_PATH_EMAIL:e("Email"),ELEMENT_PATH_IMG:e("Picture"),ELEMENT_PATH_VINDENT:e("Indent"),ELEMENT_PATH_BUTTON:e("Button"),ELEMENT_PATH_CAROUSEL:e("Carousel"),ELEMENT_PATH_ACCORDION:e("Accordion"),ELEMENT_PATH_SOCIAL:e("Social media"),ELEMENT_PATH_SECTION:e("Section"),TINYMCE_CHANGECASE:e("Case Change"),TINYMCE_UPPERCASE:e("Uppercase"),TINYMCE_LOWERCASE:e("Lowercase"),PASTE_HERE:e("Drop here"),INSERT_COLUMN_BEFORE_TABLE:e("Insert column before"),INSERT_COLUMN_AFTER_TABLE:e("Insert column after"),INSERT_ROW_BEFORE_TABLE:e("Insert row before"),INSERT_ROW_AFTER_TABLE:e("Insert row after"),MERGE_RIGHT_CELL_TABLE:e("Merge right cell"),MERGE_LEFT_CELL_TABLE:e("Merge left cell"),MERGE_TOP_CELL_TABLE:e("Merge top cell"),MERGE_BOTTOM_CELL_TABLE:e("Merge bottom cell"),SPLIT_CELL_TABLE:e("Split cell"),REMOVE_COLUMN_TABLE:e("Remove column"),REMOVE_ROW_TABLE:e("Remove row"),TABLE_MENU_COLUMNS:e("Columns"),TABLE_MENU_ROWS:e("Rows"),DROP_BLOCK_HINT:e("Click or drag a block")}),U=new cx(window.parent,!0),pl,hs,cy=Math.random().toString(36).slice(2,8),vx=0,gl;function uy(e,t){const n=pl;pl=e;try{return t()}finally{pl=n}}function bl(e,t){const n=hs;hs=e;try{return t()}finally{hs=n}}function Ex(){return hs}function Sx(){try{return pl?.()}catch{return}}function wx(){return gl||(gl=`${cy}:${++vx}`,Promise.resolve().then(()=>{gl=void 0})),gl}function at(e,t){const n=Sx();return U.send(ue.APPLICATION_DOMPARSER_ERROR,{message:e,stack:new Error().stack,...n?{mutation:n}:{},source:hs??"other",batch:wx(),instance:cy}),t}function Zd(e,t){let n=t.children,r=e(t)||0;if(r!=0||!n)return r!==1;for(const o of n)if(Zd(e,o)===!1)return!1;return!0}function dy(e,t,n=[t]){for(;t=t.parent;)if(e(n=[t,...n])===!1)return!1;return!0}function _x(e,t){return dy(([n,r])=>{const{children:o}=n;if(o){for(let i=o.indexOf(r)+1,s=o.length;i<s;i++)if(Zd(e,o[i])===!1)return!1}},t)}function rr(e,t,n){Zd(r=>{r.start+=t,r.startTagEnd!==void 0&&(r.startTagEnd+=t),r.end+=t,r.endTagStart!==void 0&&(r.endTagStart+=t)},e),n&&(dy(([r])=>{r.end+=n,r.endTagStart!==void 0&&(r.endTagStart+=n)},e),_x(r=>{r.start+=n,r.startTagEnd!==void 0&&(r.startTagEnd+=n),r.end+=n,r.endTagStart!==void 0&&(r.endTagStart+=n)},e))}var Cx=e=>e.type===I.HTML?e.start-1:e.start,Tx=e=>e.type===I.HTML?e.end+1:e.end;function Ax(e,t){const{start:n,end:r}=e;let o=t.findNodeAt(n);for(;o&&(Cx(o)>=n||Tx(o)<=r||o.start===o.startTagEnd);)o=o.parent;return o}function kx(e){return{start:e.start+(e.tag?.length||0)+1,end:(e.startTagEnd!==void 0?e.startTagEnd:e.start)-1}}function fy(e){const t=e.parent?.children;if(t){const n=t.indexOf(e);if(n>0)return t[n-1]}}function Lr(e){let t=e;do t=Lx(t);while(t&&t.type===I.HTML&&!t.content);return t}function Lx(e){const t=e.parent?.children;if(t){const n=t.indexOf(e);if(n<0)return at("parent and child not sync",e);if(n<t.length-1)return t[n+1]||null}return null}var io=class{constructor(e,t,n,r){A(this,"originalStart",void 0),A(this,"originalLength",void 0),A(this,"modifiedStart",void 0),A(this,"modifiedLength",void 0),this.originalStart=e,this.originalLength=t,this.modifiedStart=n,this.modifiedLength=r}getOriginalEnd(){return this.originalStart+this.originalLength}getModifiedEnd(){return this.modifiedStart+this.modifiedLength}};function my(e,t){return(t<<5)-t+e|0}function Nx(e,t){t=my(149417,t);for(let n=0,r=e.length;n<r;n++)t=my(e.charCodeAt(n),t);return t}var hy=class{constructor(e){A(this,"source",void 0),this.source=e}getElements(){const e=this.source,t=new Int32Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=e.charCodeAt(n);return t}};function py(e,t,n){return new xx(new hy(e),new hy(t)).ComputeDiff(n).changes}var Vo=class{static Assert(e,t){if(!e)throw new Error(t)}},Go=class{static Copy(e,t,n,r,o){for(let i=0;i<o;i++)n[r+i]=e[t+i]}static Copy2(e,t,n,r,o){for(let i=0;i<o;i++)n[r+i]=e[t+i]}},gy=class{constructor(){A(this,"m_changes",void 0),A(this,"m_originalStart",void 0),A(this,"m_modifiedStart",void 0),A(this,"m_originalCount",void 0),A(this,"m_modifiedCount",void 0),this.m_changes=[],this.m_originalStart=1073741824,this.m_modifiedStart=1073741824,this.m_originalCount=0,this.m_modifiedCount=0}MarkNextChange(){(this.m_originalCount>0||this.m_modifiedCount>0)&&this.m_changes.push(new io(this.m_originalStart,this.m_originalCount,this.m_modifiedStart,this.m_modifiedCount)),this.m_originalCount=0,this.m_modifiedCount=0,this.m_originalStart=1073741824,this.m_modifiedStart=1073741824}AddOriginalElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_originalCount++}AddModifiedElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_modifiedCount++}getChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes}getReverseChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes.reverse(),this.m_changes}},xx=class ts{constructor(t,n,r=null){A(this,"ContinueProcessingPredicate",void 0),A(this,"_originalSequence",void 0),A(this,"_modifiedSequence",void 0),A(this,"_hasStrings",void 0),A(this,"_originalStringElements",void 0),A(this,"_originalElementsOrHash",void 0),A(this,"_modifiedStringElements",void 0),A(this,"_modifiedElementsOrHash",void 0),A(this,"m_forwardHistory",void 0),A(this,"m_reverseHistory",void 0),this.ContinueProcessingPredicate=r,this._originalSequence=t,this._modifiedSequence=n;const[o,i,s]=ts._getElements(t),[a,l,c]=ts._getElements(n);this._hasStrings=s&&c,this._originalStringElements=o,this._originalElementsOrHash=i,this._modifiedStringElements=a,this._modifiedElementsOrHash=l,this.m_forwardHistory=[],this.m_reverseHistory=[]}static _isStringArray(t){return t.length>0&&typeof t[0]=="string"}static _getElements(t){const n=t.getElements();if(ts._isStringArray(n)){const r=new Int32Array(n.length);for(let o=0,i=n.length;o<i;o++)r[o]=Nx(n[o],0);return[n,r,!0]}return n instanceof Int32Array?[[],n,!1]:[[],new Int32Array(n),!1]}ElementsAreEqual(t,n){return this._originalElementsOrHash[t]!==this._modifiedElementsOrHash[n]?!1:this._hasStrings?this._originalStringElements[t]===this._modifiedStringElements[n]:!0}ElementsAreStrictEqual(t,n){return this.ElementsAreEqual(t,n)?ts._getStrictElement(this._originalSequence,t)===ts._getStrictElement(this._modifiedSequence,n):!1}static _getStrictElement(t,n){return typeof t.getStrictElement=="function"?t.getStrictElement(n):null}OriginalElementsAreEqual(t,n){return this._originalElementsOrHash[t]!==this._originalElementsOrHash[n]?!1:this._hasStrings?this._originalStringElements[t]===this._originalStringElements[n]:!0}ModifiedElementsAreEqual(t,n){return this._modifiedElementsOrHash[t]!==this._modifiedElementsOrHash[n]?!1:this._hasStrings?this._modifiedStringElements[t]===this._modifiedStringElements[n]:!0}ComputeDiff(t){return this._ComputeDiff(0,this._originalElementsOrHash.length-1,0,this._modifiedElementsOrHash.length-1,t)}_ComputeDiff(t,n,r,o,i){const s=[!1];let a=this.ComputeDiffRecursive(t,n,r,o,s);return i&&(a=this.PrettifyChanges(a)),{quitEarly:s[0],changes:a}}ComputeDiffRecursive(t,n,r,o,i){for(i[0]=!1;t<=n&&r<=o&&this.ElementsAreEqual(t,r);)t++,r++;for(;n>=t&&o>=r&&this.ElementsAreEqual(n,o);)n--,o--;if(t>n||r>o){let c;return r<=o?(Vo.Assert(t===n+1,"originalStart should only be one more than originalEnd"),c=[new io(t,0,r,o-r+1)]):t<=n?(Vo.Assert(r===o+1,"modifiedStart should only be one more than modifiedEnd"),c=[new io(t,n-t+1,r,0)]):(Vo.Assert(t===n+1,"originalStart should only be one more than originalEnd"),Vo.Assert(r===o+1,"modifiedStart should only be one more than modifiedEnd"),c=[]),c}const s=[0],a=[0],l=this.ComputeRecursionPoint(t,n,r,o,s,a,i);return s[0],a[0],l!==null?l:[new io(t,n-t+1,r,o-r+1)]}WALKTRACE(t,n,r,o,i,s,a,l,c,u,d,f,h,m,p,S,C,L){let k=null,y=null,g=new gy,v=n,w=r,b=h[0]-S[0]-o,E=-1073741824,_=this.m_forwardHistory.length-1;do{const T=b+t;T===v||T<w&&c[T-1]<c[T+1]?(d=c[T+1],m=d-b-o,d<E&&g.MarkNextChange(),E=d,g.AddModifiedElement(d+1,m),b=T+1-t):(d=c[T-1]+1,m=d-b-o,d<E&&g.MarkNextChange(),E=d-1,g.AddOriginalElement(d,m+1),b=T-1-t),_>=0&&(c=this.m_forwardHistory[_],t=c[0],v=1,w=c.length-1)}while(--_>=-1);if(k=g.getReverseChanges(),L[0]){let T=h[0]+1,x=S[0]+1;if(k!==null&&k.length>0){const N=k[k.length-1];T=Math.max(T,N.getOriginalEnd()),x=Math.max(x,N.getModifiedEnd())}y=[new io(T,f-T+1,x,p-x+1)]}else{g=new gy,v=s,w=a,b=h[0]-S[0]-l,E=1073741824,_=C?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{const T=b+i;T===v||T<w&&u[T-1]>=u[T+1]?(d=u[T+1]-1,m=d-b-l,d>E&&g.MarkNextChange(),E=d+1,g.AddOriginalElement(d+1,m+1),b=T+1-i):(d=u[T-1],m=d-b-l,d>E&&g.MarkNextChange(),E=d,g.AddModifiedElement(d+1,m+1),b=T-1-i),_>=0&&(u=this.m_reverseHistory[_],i=u[0],v=1,w=u.length-1)}while(--_>=-1);y=g.getChanges()}return this.ConcatenateChanges(k,y)}ComputeRecursionPoint(t,n,r,o,i,s,a){let l=0,c=0,u=0,d=0,f=0,h=0;t--,r--,i[0]=0,s[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];const m=n-t+(o-r),p=m+1,S=new Int32Array(p),C=new Int32Array(p),L=o-r,k=n-t,y=t-r,g=n-o,v=(k-L)%2===0;S[L]=t,C[k]=n,a[0]=!1;for(let w=1;w<=m/2+1;w++){let b=0,E=0;if(w>100)return null;u=this.ClipDiagonalBound(L-w,w,L,p),d=this.ClipDiagonalBound(L+w,w,L,p);for(let T=u;T<=d;T+=2){T===u||T<d&&S[T-1]<S[T+1]?l=S[T+1]:l=S[T-1]+1,c=l-(T-L)-y;const x=l;for(;l<n&&c<o&&this.ElementsAreEqual(l+1,c+1);)l++,c++;if(S[T]=l,l+c>b+E&&(b=l,E=c),!v&&Math.abs(T-k)<=w-1&&l>=C[T])return i[0]=l,s[0]=c,x<=C[T]&&w<=1448?this.WALKTRACE(L,u,d,y,k,f,h,g,S,C,l,n,i,c,o,s,v,a):null}const _=(b-t+(E-r)-w)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(b,_))return a[0]=!0,i[0]=b,s[0]=E,_>0&&w<=1448?this.WALKTRACE(L,u,d,y,k,f,h,g,S,C,l,n,i,c,o,s,v,a):(t++,r++,[new io(t,n-t+1,r,o-r+1)]);f=this.ClipDiagonalBound(k-w,w,k,p),h=this.ClipDiagonalBound(k+w,w,k,p);for(let T=f;T<=h;T+=2){T===f||T<h&&C[T-1]>=C[T+1]?l=C[T+1]-1:l=C[T-1],c=l-(T-k)-g;const x=l;for(;l>t&&c>r&&this.ElementsAreEqual(l,c);)l--,c--;if(C[T]=l,v&&Math.abs(T-L)<=w&&l<=S[T])return i[0]=l,s[0]=c,x>=S[T]&&w<=1448?this.WALKTRACE(L,u,d,y,k,f,h,g,S,C,l,n,i,c,o,s,v,a):null}if(w<=1447){let T=new Int32Array(d-u+2);T[0]=L-u+1,Go.Copy2(S,u,T,1,d-u+1),this.m_forwardHistory.push(T),T=new Int32Array(h-f+2),T[0]=k-f+1,Go.Copy2(C,f,T,1,h-f+1),this.m_reverseHistory.push(T)}}return this.WALKTRACE(L,u,d,y,k,f,h,g,S,C,l,n,i,c,o,s,v,a)}PrettifyChanges(t){for(let n=0;n<t.length;n++){const r=t[n],o=n<t.length-1?t[n+1].originalStart:this._originalElementsOrHash.length,i=n<t.length-1?t[n+1].modifiedStart:this._modifiedElementsOrHash.length,s=r.originalLength>0,a=r.modifiedLength>0;for(;r.originalStart+r.originalLength<o&&r.modifiedStart+r.modifiedLength<i&&(!s||this.OriginalElementsAreEqual(r.originalStart,r.originalStart+r.originalLength))&&(!a||this.ModifiedElementsAreEqual(r.modifiedStart,r.modifiedStart+r.modifiedLength));){const c=this.ElementsAreStrictEqual(r.originalStart,r.modifiedStart);if(this.ElementsAreStrictEqual(r.originalStart+r.originalLength,r.modifiedStart+r.modifiedLength)&&!c)break;r.originalStart++,r.modifiedStart++}const l=[null];if(n<t.length-1&&this.ChangesOverlap(t[n],t[n+1],l)){t[n]=l[0],t.splice(n+1,1),n--;continue}}for(let n=t.length-1;n>=0;n--){const r=t[n];let o=0,i=0;if(n>0){const d=t[n-1];o=d.originalStart+d.originalLength,i=d.modifiedStart+d.modifiedLength}const s=r.originalLength>0,a=r.modifiedLength>0;let l=0,c=this._boundaryScore(r.originalStart,r.originalLength,r.modifiedStart,r.modifiedLength);for(let d=1;;d++){const f=r.originalStart-d,h=r.modifiedStart-d;if(f<o||h<i||s&&!this.OriginalElementsAreEqual(f,f+r.originalLength)||a&&!this.ModifiedElementsAreEqual(h,h+r.modifiedLength))break;const m=(f===o&&h===i?5:0)+this._boundaryScore(f,r.originalLength,h,r.modifiedLength);m>c&&(c=m,l=d)}r.originalStart-=l,r.modifiedStart-=l;const u=[null];if(n>0&&this.ChangesOverlap(t[n-1],t[n],u)){t[n-1]=u[0],t.splice(n,1),n++;continue}}if(this._hasStrings)for(let n=1,r=t.length;n<r;n++){const o=t[n-1],i=t[n],s=i.originalStart-o.originalStart-o.originalLength,a=o.originalStart,l=i.originalStart+i.originalLength,c=l-a,u=o.modifiedStart,d=i.modifiedStart+i.modifiedLength,f=d-u;if(s<5&&c<20&&f<20){const h=this._findBetterContiguousSequence(a,c,u,f,s);if(h){const[m,p]=h;(m!==o.originalStart+o.originalLength||p!==o.modifiedStart+o.modifiedLength)&&(o.originalLength=m-o.originalStart,o.modifiedLength=p-o.modifiedStart,i.originalStart=m+s,i.modifiedStart=p+s,i.originalLength=l-i.originalStart,i.modifiedLength=d-i.modifiedStart)}}}return t}_findBetterContiguousSequence(t,n,r,o,i){if(n<i||o<i)return null;const s=t+n-i+1,a=r+o-i+1;let l=0,c=0,u=0;for(let d=t;d<s;d++)for(let f=r;f<a;f++){const h=this._contiguousSequenceScore(d,f,i);h>0&&h>l&&(l=h,c=d,u=f)}return l>0?[c,u]:null}_contiguousSequenceScore(t,n,r){let o=0;for(let i=0;i<r;i++){if(!this.ElementsAreEqual(t+i,n+i))return 0;o+=this._originalStringElements[t+i].length}return o}_OriginalIsBoundary(t){return t<=0||t>=this._originalElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._originalStringElements[t])}_OriginalRegionIsBoundary(t,n){if(this._OriginalIsBoundary(t)||this._OriginalIsBoundary(t-1))return!0;if(n>0){const r=t+n;if(this._OriginalIsBoundary(r-1)||this._OriginalIsBoundary(r))return!0}return!1}_ModifiedIsBoundary(t){return t<=0||t>=this._modifiedElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._modifiedStringElements[t])}_ModifiedRegionIsBoundary(t,n){if(this._ModifiedIsBoundary(t)||this._ModifiedIsBoundary(t-1))return!0;if(n>0){const r=t+n;if(this._ModifiedIsBoundary(r-1)||this._ModifiedIsBoundary(r))return!0}return!1}_boundaryScore(t,n,r,o){return(this._OriginalRegionIsBoundary(t,n)?1:0)+(this._ModifiedRegionIsBoundary(r,o)?1:0)}ConcatenateChanges(t,n){const r=[];if(t.length===0||n.length===0)return n.length>0?n:t;if(this.ChangesOverlap(t[t.length-1],n[0],r)){const o=new Array(t.length+n.length-1);return Go.Copy(t,0,o,0,t.length-1),o[t.length-1]=r[0],Go.Copy(n,1,o,t.length,n.length-1),o}else{const o=new Array(t.length+n.length);return Go.Copy(t,0,o,0,t.length),Go.Copy(n,0,o,t.length,n.length),o}}ChangesOverlap(t,n,r){if(Vo.Assert(t.originalStart<=n.originalStart,"Left change is not less than or equal to right change"),Vo.Assert(t.modifiedStart<=n.modifiedStart,"Left change is not less than or equal to right change"),t.originalStart+t.originalLength>=n.originalStart||t.modifiedStart+t.modifiedLength>=n.modifiedStart){const o=t.originalStart;let i=t.originalLength;const s=t.modifiedStart;let a=t.modifiedLength;return t.originalStart+t.originalLength>=n.originalStart&&(i=n.originalStart+n.originalLength-t.originalStart),t.modifiedStart+t.modifiedLength>=n.modifiedStart&&(a=n.modifiedStart+n.modifiedLength-t.modifiedStart),r[0]=new io(o,i,s,a),!0}else return r[0]=null,!1}ClipDiagonalBound(t,n,r,o){if(t>=0&&t<o)return t;const i=r,s=o-r-1,a=n%2===0;return t<0?a===(i%2===0)?0:1:a===(s%2===0)?o-1:o-2}};function yl(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var Gt=class{get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){A(this,"oldPosition",void 0),A(this,"oldText",void 0),A(this,"newPosition",void 0),A(this,"newText",void 0),this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${yl(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${yl(this.oldText)}")`:`(replace@${this.oldPosition} "${yl(this.oldText)}" with "${yl(this.newText)}")`}};function Lt(e,t){return e===null||e.length===0?t:new Ox(e,t).compress()}var Ox=class wr{constructor(t,n){A(this,"_prevEdits",void 0),A(this,"_currEdits",void 0),A(this,"_result",void 0),A(this,"_resultLen",void 0),A(this,"_prevLen",void 0),A(this,"_prevDeltaOffset",void 0),A(this,"_currLen",void 0),A(this,"_currDeltaOffset",void 0),this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),o=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(o===null)break;this._acceptCurr(o),o=this._getCurr(++n);continue}if(o===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(o.oldEnd<=r.newPosition){this._acceptCurr(o),o=this._getCurr(++n);continue}if(r.newEnd<=o.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(o.oldPosition<r.newPosition){const[l,c]=wr._splitCurr(o,r.newPosition-o.oldPosition);this._acceptCurr(l),o=c;continue}if(r.newPosition<o.oldPosition){const[l,c]=wr._splitPrev(r,o.oldPosition-r.newPosition);this._acceptPrev(l),r=c;continue}let s,a;if(o.oldEnd===r.newEnd)s=r,a=o,r=this._getPrev(++t),o=this._getCurr(++n);else if(o.oldEnd<r.newEnd){const[l,c]=wr._splitPrev(r,o.oldLength);s=l,a=o,r=c,o=this._getCurr(++n)}else{const[l,c]=wr._splitCurr(o,r.newLength);s=r,a=l,r=this._getPrev(++t),o=c}this._result[this._resultLen++]=new Gt(s.oldPosition,s.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const i=wr._merge(this._result);return wr._removeNoOps(i)}_acceptCurr(t){this._result[this._resultLen++]=wr._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=wr._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new Gt(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new Gt(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),o=t.newText.substr(n);return[new Gt(t.oldPosition,t.oldText,t.newPosition,r),new Gt(t.oldEnd,"",t.newPosition+n,o)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),o=t.oldText.substr(n);return[new Gt(t.oldPosition,r,t.newPosition,t.newText),new Gt(t.oldPosition+n,o,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,o=t[0];for(let i=1;i<t.length;i++){const s=t[i];o.oldEnd===s.oldPosition?o=new Gt(o.oldPosition,o.oldText+s.oldText,o.newPosition,o.newText+s.newText):(n[r++]=o,o=s)}return n[r++]=o,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let o=0;o<t.length;o++){const i=t[o];i.oldText!==i.newText&&(n[r++]=i)}return n}};function by(e){return new Gt(e.newPosition,e.newText,e.oldPosition,e.oldText)}function In(e){return e.map(by)}function Rx(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const o=t[r];n=n.slice(0,o.oldPosition)+o.newText+n.slice(o.oldEnd)}return n}function Mx(e,t,n){let r=0;const o=e.start===e.end;for(const i of t){const s=i.newLength-i.oldLength;if(i.oldLength===0){const a=i.oldPosition;if(o&&a===e.start)r+=n==="after"?s:0;else{if(e.start<a&&a<e.end)return null;a<=e.start&&(r+=s)}continue}if(o){if(e.start>=i.oldEnd)r+=s;else if(e.start>i.oldPosition)return null;continue}if(e.start>=i.oldEnd)r+=s;else if(e.end>i.oldPosition)return null}return{start:e.start+r,end:e.end+r}}function vl(e,t,n){if(!t.length)return[...e];const r=[];let o=0;for(const i of e){const s=Mx({start:i.oldPosition,end:i.oldEnd},t,n);if(!s)return null;r.push(new Gt(s.start,i.oldText,s.start+o,i.newText)),o+=i.newLength-i.oldLength}return r}function yy(e,t,n=0){const r=e.range;return new Gt(e.range.start,typeof t=="string"?t.substring(r.start,r.end):t.getText(r),r.start+n,e.text)}function Xo(e,t){let n=0;return e.map(({text:r,range:{start:o,end:i}})=>{let s=n;return n+=r.length-(i-o),yy({text:r,range:{start:o,end:i}},t,s)})}function Px(e){return{range:{start:e.oldPosition,end:e.oldEnd},text:e.newText}}function so(e){return e.map(t=>Px(t))}function Ix(e,t=ps(e)){const n=e.getLength(),{start:r,end:o}=t;return r>n||o<0?null:{start:r,end:o}}var Foe=RegExp("["+["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"].join("\\")+"]","g");function Dx(e,{start:t,end:n}){return{start:t,end:n+(e.newLength-e.oldLength)}}function ps(e){return{start:0,end:e.getLength()}}function Bx(e,t,n){return`${e.substring(0,n.start)}${t}${e.substring(n.end)}`}function gs(e,t){const n=[e];for(let r=t.length-1;r>=0;r--){const{text:o,range:i}=t[r],s=n[0];n.splice(0,1,s.substring(0,i.start),o,s.substring(i.end))}return n.join("")}function Hx(e,t){return t=El(t).sort(({range:n},{range:r})=>n.start-r.start),gs(e,t)}function bs(e,t){return e>=t.start&&e<=t.end}function El(e,t){e=[...e];let n=e.length;if(n<=1)return e;e=e.sort(({range:r},{range:o})=>r.start-o.start);for(let r=0;r<n;r++){let o=e[r],i=e[r].range;for(let s=r+1;s<n;s++){const a=e[s];let l=e[s].range,c;if(bs(i.start,l)&&bs(i.start,l))c=l;else if(bs(l.start,i))bs(l.end,i)?c=i:c={start:i.start,end:l.end};else if(bs(l.end,i))c={start:l.start,end:i.end};else continue;const u=o.text;let d=l.start-i.start+u.length,f=l.end-i.start+u.length;const h=Bx(u,a.text,{start:d,end:f});e[r]=o={range:i=c,text:h},e.splice(s--,1),n--}}return e}function Fx(e,t){if(e.length<=1)return e[0]||null;e=El(e);const n=e.reduce((r,{range:o})=>({start:Math.min(r.start,o.start),end:Math.max(r.end,o.end)}),{start:Number.MAX_VALUE,end:Number.MIN_VALUE});return{text:gs(t.substring(n.start,n.end),e.map(({range:r,text:o})=>({text:o,range:{start:r.start-n.start,end:r.end-n.start}}))),range:n}}function $x(e,t){const n=In(e),r=Fx(so(n),t);if(r){const o=yy(r,t);return by(o)}return null}function Wx(e,{range:t,text:n}){const r=e.getText(t);return py(r,n,!0).map(o=>({range:{start:t.start+o.originalStart,end:t.start+o.originalStart+o.originalLength},text:n.substring(o.modifiedStart,o.modifiedStart+o.modifiedLength)}))}function vy({oldText:e,newText:t,oldPosition:n,newPosition:r}){return py(e,t,!0).map(o=>new Gt(n+o.originalStart,e.substring(o.originalStart,o.originalStart+o.originalLength),r+o.modifiedStart,t.substring(o.modifiedStart,o.modifiedStart+o.modifiedLength)))}var qx=class{constructor(e,t){A(this,"index",void 0),A(this,"values",void 0),A(this,"type","insert"),this.index=e,this.values=t}},zx=class{constructor(e,t){A(this,"index",void 0),A(this,"howMany",void 0),A(this,"type","remove"),this.index=e,this.howMany=t}},Ux=class{constructor(e,t,n){A(this,"from",void 0),A(this,"to",void 0),A(this,"howMany",void 0),A(this,"type","move"),this.from=e,this.to=t,this.howMany=n}};function jx(e,t){return e===t}function Vx(e,t,n=jx){for(var r=e.length,o=t.length,i=[],s=Object.create(null),a=Object.create(null),l=0;l<r;l++)for(var c=e[l],u=0;u<o;u++)if(!a[u]&&n(c,t[u])){var d=l,f=u,h=0;do s[l++]=a[u++]=!0,h++;while(l<r&&u<o&&n(e[l],t[u])&&!a[u]);i.push(new Ux(d,f,h)),l--;break}var m=[];for(l=0;l<r;){if(s[l]){l++;continue}for(var p=l,h=0;l<r&&!s[l++];)h++;m.push(new zx(p,h))}for(var S=[],u=0;u<o;){if(a[u]){u++;continue}for(var p=u,h=0;u<o&&!a[u++];)h++;var C=t.slice(p,p+h);S.push(new qx(p,C))}var L=S.length,k=m.length,y=i.length,g,v,w=0;for(g=0;g<k;g++){var b=m[g];for(b.index-=w,w+=b.howMany,v=0;v<y;v++){var E=i[v];E.from>=b.index&&(E.from-=b.howMany)}}for(g=L;g--;){var _=S[g],h=_.values.length;for(v=y;v--;){var E=i[v];E.to>=_.index&&(E.to-=h)}}for(g=y;g-- >1;){var E=i[g];if(E.to!==E.from)for(v=g;v--;){var T=i[v];T.to>=E.to&&(T.to-=E.howMany),T.to>=E.from&&(T.to+=E.howMany)}}var x=[];for(g=0;g<y;g++){var E=i[g];if(E.to!==E.from)for(x.push(E),v=g+1;v<y;v++){var N=i[v];N.from>=E.from&&(N.from-=E.howMany),N.from>=E.to&&(N.from+=E.howMany)}}return[...m,...x,...S]}var Ey=class{constructor(){A(this,"_byKey",new Map),A(this,"_byValue",new Map)}set(e,t){this._byKey.set(e,t),this._byValue.set(t,e)}getByKey(e){return this._byKey.get(e)}getByValue(e){return this._byValue.get(e)}delete(e){const t=this._byKey.has(e);if(t){const n=this._byKey.get(e);this._byKey.delete(e),this._byValue.delete(n)}return t}deleteByValue(e){const t=this._byValue.has(e);if(t){const n=this._byValue.get(e);this._byValue.delete(e),this._byKey.delete(n)}return t}get size(){return this._byKey.size}},ae;(function(e){function t(d,f,h){return{type:"Add",node:f,nextSibling:h,parent:d}}e.add=t;function n(d){return{type:"Remove",node:d}}e.remove=n;function r(d,f,h){return{type:"Attribute",node:d,name:f,value:h}}e.attribute=r;function o(d,f,h){return h?{type:"Update",prev:d,next:f,soft:h}:{type:"Update",prev:d,next:f}}e.update=o;function i(d,f,h,m){return[{type:"Remove",node:d},{type:"Add",node:h,nextSibling:m,parent:f,replaces:d}]}e.recreate=i;function s(d,f,h){return{type:"Move",node:f,nextSibling:h,parent:d}}e.move=s;function a(d,f){return{type:"Set",node:d,data:f}}e.set=a;function l(d,f,h){return{type:"ClassList",node:d,addedClasses:f,removedClasses:h}}e.classList=l;function c(d,f){return{type:"Style",node:d,value:f}}e.style=c;function u(d,f){return{type:"Hidden",node:d,value:f}}e.hidden=u})(ae||(ae={}));function Sy(e,t){return e.push(t),{dispose:()=>{const n=e.indexOf(t);n!==-1&&e.splice(n,1)}}}var wy=[],_y=[];function Gx(e){return Sy(wy,e)}function Qd(e){return e?wy.some(t=>t(e)):!1}function Xx(e){return Sy(_y,e)}function Kx(e){return _y.some(t=>t(e))}function Yx(e,t){const n=e.attributes||{},r=t.attributes||{},o=e.attributeNames,i=t.attributeNames,s=o.length,a=i.length,l=[];let c=0;for(;c<s;c++){const u=o[c];if(u!==i[c]){for(let d=c;d<s;d++){const f=o[d];l.push(ae.attribute(t,f,void 0))}break}else r[u]!==n[u]&&l.push(ae.attribute(t,u,r[u]))}for(;c<a;c++){const u=i[c];l.push(ae.attribute(t,u,r[u]))}return l}function Zx(e){let t=[];const n=e.children.filter(o=>o.type!==I.HTML||!!o.content);let r;for(let o=n.length-1;o>=0;o--)t.push(ae.add(e,n[o],r)),r=n[o];return t}function Qx(e){return ae.remove(e)}var Jx=new Set(["head","body","html"]),eO=e=>e.type===I.ROOT||e.type===I.DOCTYPE||e.type===I.ELEMENT&&e.tag&&Jx.has(e.tag.toLowerCase()),tO=/^<[!?/]/;function Jd(e){return e.type===I.ELEMENT?String(e.tag):e.type===I.HTML&&tO.test(e.content??"")?"bogus":String(e.type)}function Sl(e){const t=new Ey,n=Object.create(null);for(const r of e){const o=Jd(r)+(!eO(r)&&r.start===r.end?"_hidden":"");let i="";r.type===I.ELEMENT&&r.attributes?.id?i=`id_${r.attributes.id}`:i=n[o]=(n[o]||0)+1,t.set(`${o}_${i}`,r)}return t}function Cy(e){const t=[];let n=0;for(const r of[...e].sort((o,i)=>o.oldPosition-i.oldPosition)){const o=r.newLength-r.oldLength,i=t[t.length-1];i&&r.oldPosition<i.oldEnd?(i.oldEnd=Math.max(i.oldEnd,r.oldEnd),i.delta+=o):t.push({oldPosition:r.oldPosition,oldEnd:r.oldEnd,shift:n,delta:o}),n+=o}return t}function wl(e,t){const n=e[t-1];return t<e.length?e[t].shift:n.shift+n.delta}function ef(e,t){return(e.type===I.HTML?e.end+1:e.end)<=t.oldPosition}function nO(e,t){return(e.type===I.HTML?e.start-1:e.start)>=t.oldEnd}function tf(e,t,n){return!!t&&t.start===n&&t.type===e.type&&t.tag===e.tag&&t.attributes?.id===e.attributes?.id&&t.end-t.start===e.end-e.start}function nf(e,t){return t.type===e.type&&Jd(t)===Jd(e)&&t.attributes?.id===e.attributes?.id}function ys(e,t,n){return er(e,!1,n)===er(t,!1,n)}function rf(e,t,n){let r=t,o=e;for(;r<o;){const i=r+o>>1;n(i)?o=i:r=i+1}return r}function _l(e,t,n=0){return rf(t.length,n,r=>!nO(e,t[r]))}function of(e,t){const n=_l(e,t);return t.slice(n,ky(e,t,n))}function Ty(e,t){const n=_l(e,t);return n<t.length&&!ef(e,t[n])?void 0:e.start+wl(t,n)}function Cl(e){return e.type===I.ELEMENT?e.attributes?.id:void 0}function Ay(e){const t=new Set,n=new Set;for(const r of e){const o=Cl(r);o&&(t.has(o)?n:t).add(o)}return n}function rO(e,t,n){const r=new Set([...Ay(t),...Ay(n)]),o=new Map;e.forEach((s,a)=>{for(let l=s.prevFrom;l<s.prevTo;l++){const c=Cl(t[l]);c&&o.set(c,{node:t[l],gap:a})}});const i=new Map;return e.forEach((s,a)=>{for(let l=s.nextFrom;l<s.nextTo;l++){const c=Cl(n[l]),u=c?o.get(c):void 0;c&&u&&u.gap!==a&&!r.has(c)&&nf(u.node,n[l])&&i.set(c,u.node)}}),i}function oO(e,t,n){const r=[];let o={prevFrom:0,prevTo:0,nextFrom:0,nextTo:0},i=0,s=0,a=0;const l=(c,u,d)=>{(c>o.prevFrom||u>o.nextFrom)&&r.push({...o,prevTo:c,nextTo:u,edits:n.slice(i,d)})};for(let c=0;c<e.length;c++){const u=e[c];if(s=_l(u,n,s),s<n.length&&!ef(u,n[s]))continue;const d=u.start+wl(n,s),f=rf(t.length,a,h=>t[h].start>=d);tf(u,t[f],d)&&(a=f,l(c,a,s),o={prevFrom:c+1,prevTo:c+1,nextFrom:a+1,nextTo:a+1},i=s,a++)}return l(e.length,t.length,n.length),r}function ky(e,t,n){return rf(t.length,n,r=>ef(e,t[r]))}function Ly(e,t,n,r,o,i,s){const a=_l(e,o),l=ky(e,o,a),c=(p,S=()=>!0)=>p?.find(C=>C>=n&&C<r&&nf(e,t[C])&&S(t[C]))??-1,u=e.start+wl(o,a),d=e.end+wl(o,l),f=a===o.length||e.start<o[a].oldPosition,h=f?c(s.byStart.get(u)):-1,m=l>a&&e.end>o[l-1].oldEnd?c(s.byEnd.get(d),p=>!(f&&sO(e,p,u))):-1;return h>=0&&m>=0&&h!==m?ys(e,t[h],i)||ys(e,t[m],i)?ys(e,t[h],i)?h:m:xy(e,t[m],o)>xy(e,t[h],o)?m:h:h>=0?h:m}function Ny(e,t,n){const r=e.get(t);r?r.push(n):e.set(t,[n])}function iO(e,t,n){const r={byStart:new Map,byEnd:new Map};for(let o=t;o<n;o++)Ny(r.byStart,e[o].start,o),Ny(r.byEnd,e[o].end,o);return r}function sO(e,t,n){for(let r=t.lastChild;r&&r.end===t.end;r=r.lastChild)if(r.start===n&&nf(e,r))return!0;return!1}function xy(e,t,n){const r=new Map(t.children.map(o=>[o.start,o]));return e.children.filter(o=>{const i=Ty(o,n);return i!==void 0&&tf(o,r.get(i),i)}).length}function Oy(e,t){return of(e,t).reduce((n,r)=>n-Math.max(0,Math.min(e.end,r.oldEnd)-Math.max(e.start,r.oldPosition)),e.end-e.start)}function aO(e,t,n,r,o,i){const s=ys(e,t,i),a=ys(n,r,i);return s!==a?a:Oy(n,o)>Oy(e,o)}function lO(e,t,n,r){const o=n.edits??[],i=[],s=[];let{prevFrom:a,prevTo:l,nextFrom:c,nextTo:u}=n;const d=iO(t,c,u);for(;o.length&&a<l&&c<u;){const f=Ly(e[l-1],t,c,u,o,r,d);if(l-1===a){f>=0&&s.unshift([a,f]);break}const h=Ly(e[a],t,c,u,o,r,d);let m=h>=0,p=f>=0;if(m&&p&&h>=f&&(p=aO(e[a],t[h],e[l-1],t[f],o,r),m=!p),!m&&!p)break;m&&(i.push([a,h]),a++,c=h+1),p&&(s.unshift([l-1,f]),l--,u=f)}return[...i,...s]}function cO(e,t){const n=[];let r=e.prevFrom,o=e.nextFrom;for(const[i,s]of[...t,[e.prevTo,e.nextTo]])(i>r||s>o)&&n.push({prevFrom:r,prevTo:i,nextFrom:o,nextTo:s,edits:e.edits}),r=i+1,o=s+1;return n}function uO(e,t,n,r,o){const i=o?.length?Ty(e,o):void 0;return(i===void 0?void 0:t.children.find(s=>tf(e,s,i)))??r.getByKey(n.getByValue(e)??"")}function vs(e,t){for(const n of t)e.push(n)}function Ry(e,t,n,r,o,i,s,a,l=new Map){const c=[],u=r.prevFrom,d=t.slice(u,r.prevTo),f=n.slice(r.nextFrom,r.nextTo),[h,m]=o??[Sl(d),Sl(f)],p=Vx(d,f,(C,L)=>h.getByValue(C)===m.getByValue(L)),S=C=>{const L=Cl(C);return L?l.get(L):void 0};for(const C of p)switch(C.type){case"insert":{const L=u+C.index;let k=t[L];for(const y of C.values.reverse()){t.splice(L,0,y),i.add(y);const g=S(y);g?(vs(c,Tl(g,y,s,a)),c.push(ae.move(e,y,k))):c.push(ae.add(e,y,k)),k=y}break}case"remove":{const L=t.splice(u+C.index,C.howMany);for(const k of L)S(k)!==k&&c.push(ae.remove(k));break}case"move":{const L=t.splice(u+C.from,C.howMany);let k=t[u+C.to];t.splice(u+C.to,0,...L);for(const y of L.reverse()){const g=m.getByKey(h.getByValue(y)??"");if(!g)return at("error while sync",c);i.add(g),vs(c,Tl(y,g,s,a,r.edits&&of(y,r.edits))),c.push(ae.move(e,g,k)),k=y}break}}return c}function sf(e,t,n=!1,r=Ld(),o){const i=[],s=Sl(e.children),a=Sl(t.children);for(let p=e.children.length-1;p>=0;p--){const S=e.children[p];if(S.type===I.ELEMENT&&S.start===S.end){const C=s.getByValue(S);if(!a.getByKey(C)){let L=!1;for(let k=p+1;k<e.children.length;k++){const y=e.children[k];if(y){const g=uO(y,t,s,a,o);if(g){const v=g.start,w=S.clone();t.children.splice(t.children.indexOf(g),0,w),rr(w,v-S.start),w.parent=t,a.set(C,w),L=!0;break}}}if(!L){const k=t.endTagStart===void 0?t.end:t.endTagStart,y=S.clone();t.children.push(y),a.set(C,y),rr(y,k-S.start),y.parent=t}}}}const l=e.children.filter(p=>p.type!==I.HTML||!!p.content),c=t.children.filter(p=>p.type!==I.HTML||!!p.content),u=o?.length?oO(l,c,o):null,d=u?rO(u,l,c):new Map,f=new Set;for(const p of u?[...u].reverse():[]){const S=cO(p,lO(l,c,p,r)).reverse();for(const C of S)vs(i,Ry(t,l,c,C,void 0,f,n,r,d))}const h={prevFrom:0,prevTo:l.length,nextFrom:0,nextTo:c.length,edits:o};u||vs(i,Ry(t,l,c,h,[s,a],f,n,r)),c.length!==l.length&&at("error while sync");const m=new Map;for(const p of u??[h])for(let S=p.nextFrom;S<p.nextTo;S++)m.set(S,p.edits);for(let p=c.length-1;p>=0;p--){const S=c[p];if(!f.has(S)){const C=m.get(p);vs(i,Tl(l[p],S,n,r,C&&of(l[p],C)))}}return i}function af(e){return e.type===I.ELEMENT&&Qd(e.tag)}function Tl(e,t,n=!1,r=Ld(),o){if(e.type===t.type&&!(e.isDirty||t.isDirty)){if(af(e)&&e.tag===t.tag){if(er(e,!1,r)===er(t,!1,r))return[ae.update(e,t,n),...sf(e,t,!0,r)]}else if((e.type===I.ELEMENT||e.type===I.ROOT)&&e.tag===t.tag)return[ae.update(e,t,n),...Yx(e,t),...sf(e,t,n,r,o)];if(e.type===I.HTML||e.type===I.COMMENT)return e.content===t.content?[ae.update(e,t,n)]:[ae.update(e,t,n),ae.set(t,t.content)]}return!e.parent||!t.parent?at("cannot replace document",[]):af(e)&&e.tag===t.tag?ae.recreate(e,t.parent,t,Lr(t)||void 0):[ae.remove(e),ae.add(t.parent,t,Lr(t)||void 0)]}var or="FROM_DOM",ir="FROM_REMOTE",dO=/<\/.*>/i;function fO(e){return dO.test(e)}var mO=/^<[!?/][^>]*$/,hO=class extends Ee{constructor(e,t){super(),A(this,"_baseDocument",void 0),A(this,"_createRoot",void 0),A(this,"_beforeTextChangeEmitter",this.addDisposable(new ge)),A(this,"_onTextChangeEmitter",this.addDisposable(new ge)),A(this,"_onMutateEmitter",this.addDisposable(new ge)),A(this,"_beforeRefreshEmitter",this.addDisposable(new ge)),A(this,"_onRefreshEmitter",this.addDisposable(new ge)),A(this,"_root",new kt(0,0,[])),A(this,"_applyingMutation",void 0),A(this,"_insertRun",void 0),A(this,"beforeTextChange",this._beforeTextChangeEmitter.event),A(this,"beforeRefresh",this._beforeRefreshEmitter.event),A(this,"onTextChange",this._onTextChangeEmitter.event),A(this,"onRefresh",this._onRefreshEmitter.event),A(this,"onMutate",this._onMutateEmitter.event),this._baseDocument=e,this._createRoot=t,this._baseDocument.onChanged(this._onTextChange.bind(this));const n=this._root=new kt(0,0,[]);n.type=I.ROOT}get root(){return this._root}contains(e){return e.root===this.root}isAttached(e){let t=e;for(;t.parent;){if(!t.parent.children.includes(t))return!1;t=t.parent}return t===this.root}get applyingMutation(){return this._applyingMutation}initialize(e,t,n){const r=this._root;this._beforeRefreshEmitter.fire();let{roots:o}=pn(e),i=this._root=this._createRoot?this._createRoot(o,e):new kt(0,e.length,o);if(i.type=I.ROOT,this._createRoot||o.forEach(s=>s.parent=i),!t){const s=n&&Cy(n);this._onRefreshEmitter.fire(r?sf(r,i,!1,void 0,s):Zx(i))}}_onTextChange({source:e,changes:t}){if(e==="FROM_REMOTE"){const n=$x(t,this._baseDocument.getText());if(n)try{this._beforeTextChangeEmitter.fire(),bl("text",()=>this.replaceWithHtml(n,ir,t))}finally{this._onTextChangeEmitter.fire()}}}insertBefore(e,t,n,r){if(t.parent){if(t.parent===e&&Lr(t)===n)return t;this.remove(t,r)}const o=this.contains(e),i=nl(t),s=e.children,a=n?s.indexOf(n):s.length;if(a<0)return at("referenced node is not a child of parent node",t);s.splice(a,0,t);const l=n?n.start:e.endTagStart===void 0?e.end:e.endTagStart;return t.parent=e,rr(t,l-t.start,i.length),o&&(r!=="FROM_DOM"&&this._onMutateEmitter.fire([ae.add(e,t,n||void 0)]),r!=="FROM_REMOTE"&&this._baseDocument.applyEdits(r,[{text:i,range:{start:l,end:l}}])),t}_batchInsert(e,t,n){const r=this._insertRun;if(t.parent||!this.contains(e))return!1;const o=n?n.start:e.endTagStart===void 0?e.end:e.endTagStart,i=e.children,s=n?r?.items[0].node===n?r.start:i.indexOf(n):i.length;if(s<0||r&&r.parent!==e)return!1;const a=s-(r?r.start:s);if(r&&(a<0||a>r.items.length))return!1;const l=nl(t),c=r??(this._insertRun={parent:e,start:s,offset:o,items:[],length:0});return i.splice(s,0,t),t.parent=e,c.items.splice(a,0,{node:t,text:l}),c.length+=l.length,!0}_flushInsertRun(e){const t=this._insertRun;if(!t)return;this._insertRun=void 0;let n=t.offset;for(const{node:r,text:o}of t.items)rr(r,n-r.start),n+=o.length;rr(t.items[t.items.length-1].node,0,t.length),e!=="FROM_REMOTE"&&this._baseDocument.applyEdits(e,[{text:t.items.map(r=>r.text).join(""),range:{start:t.offset,end:t.offset}}])}getContext(e){return e.closest(t=>Qd(t.tag))}replaceWithHtml(e,t,n=[e]){const r=this._baseDocument,o=u=>{const d=this.getContext(u);if(d)return d.isDirty=!0,Promise.resolve().then(()=>{d.isDirty=!1}),!1;if(u.type!==I.HTML){if(!u.closed)return!1}else return!u.content||!fO(u.content)&&!mO.test(u.content);return!0};if(!this._root)return this.initialize(r.getText(),!1,n);let i={start:e.oldPosition,end:e.oldEnd},s=Ax(i,this._root);if(!s)return this.initialize(r.getText(),!1,n);let a,l,c;do{const u=Dx(e,s);a=this._baseDocument.getText(u),[l,...c]=pn(a).roots}while((!l||c.length||!o(s)||!o(l)||l.end-l.start!==a.length)&&(s=s.parent));if(!s||!s.parent)return this.initialize(r.getText(),!1,n);this.replaceChild(s.parent,{node:l,text:a},s,t,n)}replaceChild(e,t,n,r,o){const{text:i,node:s}=t,a=e.children,l=a.indexOf(n);if(l<0)return at("referenced node is not a child of parent node",s);a.splice(l,1,s);const c=i.length-(n.end-n.start);return s.parent=e,rr(s,n.start-s.start,c),this._baseDocument.getText(s)!==i?(at("Error while sync"),s):(r!=="FROM_DOM"&&this._onMutateEmitter.fire(Tl(n,s,!1,void 0,o&&Cy(o))),n.parent=void 0,s)}remove(e,t){const n=this.contains(e),r=e.parent;if(!r)return at("node is not in tree");const o=r.children,i=o.indexOf(e);if(i<0)return at("referenced node is not a child of parent node");const s=e.end-e.start;rr(e,0,-s),o.splice(i,1),n&&(t!=="FROM_DOM"&&this._onMutateEmitter.fire([Qx(e)]),t!=="FROM_REMOTE"&&this._baseDocument.applyEdits(t,[{text:"",range:{start:e.start,end:e.end}}])),e.parent=void 0}setAttribute(e,t,n,r){const o=this.contains(e),i=e.attributes||(e.attributes=Object.create(null));if(typeof n=="string"?i[t]=n:delete i[t],e.start===e.startTagEnd)return;const s=fb(e),a=e.startTagEnd===void 0?0:e.startTagEnd-e.start-(e.tag?.length||0)-2,l=kx(e),c=s.length-a,u=e.start;rr(e,c,c),e.start=u,o&&this._baseDocument.applyEdits(r,[{text:s,range:l}])}setContent(e,t,n){const r=this.contains(e),o=e.start,i=e.end;e.content=t;const s=e.end-e.start;if(!s)return;const a=nl(e,o),l=a.length-s;rr(e,0,l),r&&this._baseDocument.applyEdits(n,[{text:a,range:{start:o,end:i}}])}replaceWith(e,t,n){const r=e.parent;if(r){let o=Lr(e);this.remove(e,n);for(let i=t.length-1;i>=0;i--){const s=t[i];this.insertBefore(r,s,o,n),o=s}}return t}replaceWithEx(e,t,n){if(typeof t=="string"){const i=pn(t).roots;i.length!==1&&at("Error while replacing with string"),t=i[0]}const r=e.children;this.replaceWith(e,[t],n);let o=null;for(let i=r.length-1;i>=0;i--){let s=r[i];this.insertBefore(t,s,o,n),o=s}return t}setHidden(e,t,n){t?e.parent&&this.remove(e,n):this.replaceWith(e,[...e.children],n)}applyMutations(e){this._baseDocument.beginUpdate();try{for(const t of e){if(this._applyingMutation=t,t.type==="Add"){const n=t.parent||this.root,r=t.nextSibling||null;this._batchInsert(n,t.node,r)||(this._flushInsertRun(or),this.insertBefore(n,t.node,r,or));continue}switch(this._flushInsertRun(or),t.type){case"Remove":this.remove(t.node,or);break;case"Set":this.setContent(t.node,t.data,or);break;case"Hidden":this.setHidden(t.node,t.value,or);break;case"Attribute":this.setAttribute(t.node,t.name,t.value===void 0?null:t.value,or)}}}finally{try{this._flushInsertRun(or)}finally{this._applyingMutation=void 0,this._baseDocument.endUpdate()}}}getNodeByPosition(e){return this._root?.findNodeAt(e)}};function pO(e,t){return e.replace(new RegExp(`<(?=/${t.tagName}${tl})`,"gi"),"<")}function My(e,t){return Lb(e)??pO(e.textContent??"",t)}function vn(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e.tagName.toUpperCase();return t==="STYLE"||t==="SCRIPT"&&!Tb.has(e.getAttribute("type")??"")}var gO=4,bO=3,yO=80,Py={Add:"insertBefore",Remove:"remove",Set:"set",Hidden:"hidden",Attribute:"attribute",Update:"update",Move:"move"},vO={[I.HTML]:"text",[I.ELEMENT]:"element",[I.ROOT]:"root",[I.COMMENT]:"comment",[I.DOCTYPE]:"doctype",[I.ADVANCED]:"advanced"},EO=new Set(["head","body"]);function lf(e){return(e??"").replace(/^(['"])(.*)\1$/s,"$2")}function Iy(e,t,n,r){const o=n.split(/\s+/).filter(Boolean).slice(0,bO);return(e+(t?`#${t}`:"")+o.map(i=>`.${i}`).join("")+(r?`[em=${r}]`:"")).slice(0,yO)}function SO(e){if(!e.tag)return`#${e.type}`;const t=e.attributes??{};return Iy(e.tag,lf(t.id),lf(t.class),lf(t.em))}function Dy(e){return e instanceof Element?Iy(e.localName,e.id,e.getAttribute("class")??"",e.getAttribute("em")??""):e.nodeName.toLowerCase()}function cf(e,t,n){const r=[];let o=e;for(;o&&r.length<gO;)r.unshift(n(o)),o=t(o);return r.join(" > ")}function wO(e){let t,n=e;for(;;){const r=n.tag?.toLowerCase();if(!t&&r&&EO.has(r)?t=r:r==="html"&&(t??(t="html")),!n.parent)break;n=n.parent}return n.type!==I.ROOT?"outside":t??"top"}function uf(e,t,n){const r=t(e);return{path:cf(e,o=>o.parent,SO),inTree:n(e),inDom:!!r?.isConnected,...r?{domPath:cf(r,o=>o.parentNode,Dy)}:{},inMap:!!r,hasParent:!!e.parent,kind:vO[e.type]??String(e.type),root:wO(e)}}function By(e,t,n){if(!e)return;const r=i=>uf(i,t,n);if(e.type==="Update")return{type:Py.Update,node:r(e.prev),...e.next.parent?{parent:r(e.next.parent)}:{}};if(!("node"in e))return;const o={type:Py[e.type]??e.type,node:r(e.node)};return e.type==="Add"||e.type==="Move"?(e.parent&&(o.parent=r(e.parent)),e.nextSibling&&(o.reference=r(e.nextSibling))):e.node.parent&&(o.parent=r(e.node.parent)),o}function df(e){let t=e;for(;t.parent;){if(!t.parent.children.includes(t))return!1;t=t.parent}return t.type===I.ROOT}function _O(e,t,n,r){const o=s=>uf(s,a=>r.getByNode(a),df),i=cf(e,s=>s.parentNode,Dy);return{type:"insertBefore",node:{path:i,inTree:!1,inDom:e.isConnected,domPath:i},parent:o(t),reference:o(n)}}function CO(e,t){const n=r=>uf(r,o=>t.getByNode(o),df);return{type:"remove",node:n(e),...e.parent?{parent:n(e.parent)}:{}}}function TO(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,n)=>n.toUpperCase())}function Hy(e){return"<!DOCTYPE "+e.name+(e.publicId?' PUBLIC "'+e.publicId+'"':"")+(!e.publicId&&e.systemId?" SYSTEM":"")+(e.systemId?' "'+e.systemId+'"':"")+">"}var Fy=Object.create(null);function $y(e,t){const n=Fy[e]||(Fy[e]=Object.create(null));let r=n[t];if(typeof r!="boolean"){const o=document.createElement(e)[TO(t)];r=n[t]=typeof o<"u"&&typeof o!="boolean"}return r}function En(e){return e.nodeType===Node.ELEMENT_NODE}function Wy(e){return En(e)?e.tagName==="AMP-IMG"?!0:$y(e.tagName.toLowerCase(),"src"):!1}var AO="http://www.w3.org/1999/xhtml";function we(e){return En(e)&&e.namespaceURI===AO}function ff(e){return En(e)&&!e.ownerSVGElement}function kO(e){return e.tagName==="IMG"}function LO(e){return e.tagName==="FORM"}function NO(e){return e.tagName==="SCRIPT"}function xO(e){return e.tagName==="STYLE"}function mf(e){return e.nodeType===Node.DOCUMENT_NODE}function qy(e){return e.nodeType===Node.DOCUMENT_TYPE_NODE}var Es;(function(e){function t(f){return f.constructor.name==="CSSStyleRule"}e.isStyleRule=t;function n(f){return f.constructor.name==="CSSImportRule"}e.isImportRule=n;function r(f){return f.constructor.name==="CSSMediaRule"}e.isMediaRule=r;function o(f){return f.constructor.name==="CSSFontFaceRule"}e.isFontFaceRule=o;function i(f){return f.constructor.name==="CSSPageRule"}e.isPageRule=i;function s(f){return f.constructor.name==="CSSKeyframesRule"}e.isKeyframesRule=s;function a(f){return f.constructor.name==="CSSKeyframeRule"}e.isKeyframeRuleRule=a;function l(f){return f.constructor.name==="CSSNamespaceRule"}e.isNamespaceRule=l;function c(f){return f.constructor.name==="CSSCounterStyleRule"}e.isCounterStyleRule=c;function u(f){return f.constructor.name==="CSSSupportsRule"}e.isSupportsRule=u;function d(f){return f.constructor.name==="CSSFontFeatureValuesRule"}e.isFontFeatureValuesRuleRule=d})(Es||(Es={}));function Ss(e){return e.nodeType===Node.COMMENT_NODE}function ao(e){return e.nodeType===Node.TEXT_NODE}function OO(e){return e.tagName==="TABLE"}async function RO(e,t=5e3){return typeof e.complete<"u"&&!e.complete?new Promise((n,r)=>{setTimeout(n,t),e.onload=()=>n(getComputedStyle(e)),e.onerror=o=>{}}):getComputedStyle(e)}function It(e){if(En(e))return zy(e);if(mf(e))return[...e.childNodes].map(r=>It(r)).join("");if(qy(e))return Hy(e);const t=ol(e);if(t!==void 0)return t;const n=document.createElement("div");return n.appendChild(e.cloneNode(!0)),n.innerHTML}function MO(e){const t=e.tagName.toLowerCase();let n="";for(const r of e.attributes){const o=r.name,i=r.value;n+=i===""&&o!=="em"&&!$y(t,o)?` ${o}`:` ${o}="${i.replaceAll('"',"'")}"`}return n}function Nt(e){let t="";for(const n of e.childNodes)t+=Lb(n)??It(n);return t}function zy(e){const t=Object.getOwnPropertyDescriptor(e,"$$tagName")?.value||e.tagName.toLowerCase(),n=MO(e);return Ad.has(t.toLowerCase())?t==="vk-snippet-end"?`<${t}${n}/>`:`<${t}${n}>`:xO(e)?`<${t}${n}>${e.innerHTML}</${t}>`:`<${t}${n}>${Nt(e)}</${t}>`}function PO(e){return typeof e=="string"?e:""}function Uy(e,t,n){if(n&&e.type===I.DOCTYPE&&n?.type!==I.ROOT){const o=document.createTextNode(e.content||"");return t.set(e,o),o}const r=al(e,n)?Id(e.content||""):ro(e,!1,"dormant");t.set(e,r);for(const o of e.children){const i=Uy(o,t,e);r.appendChild(i)}return r}function IO(e,t){for(let n=e.previousSibling;n;n=n.previousSibling)if(t(n))return!0;return!1}function jy(e,t,n,r,o){let i=e,s;for(let a=e.parentNode;a&&a!==t;a=a.parentNode)r?.(a)&&o&&IO(i,o)?s??(s={host:a,before:i}):r?.(a)?s=a.parentNode?{host:a.parentNode,before:a}:void 0:n(a)?s??(s={host:a,before:i}):s=void 0,i=a;return s}function DO(e,t,n=df,r=()=>!1,o=()=>!1,i=()=>!1){let s,a;const l=new Map,c=()=>{const d=By(s,f=>t.getByNode(f)||l.get(f),n);return d&&{...d,stage:"dom",...a?{cause:a}:{}}},u=d=>{a=d;try{at("Element node not in tree")}finally{a=void 0}};return uy(c,()=>BO(e,t,l,d=>s=d,u,r,o,i))}function BO(e,t,n,r,o,i,s,a){const l=[],c=new Map,u=w=>t.getByNode(w)||n.get(w),d=(w,b)=>jy(w,b,i,s,E=>!!t.getByElement(E)),f=w=>{if(w){const b=w.lastChild;let E=(b?u(b)?.nextSibling:u(w)?.firstChild)||void 0;for(;E&&c.has(E);)E=E.nextSibling||void 0;return E?.parentNode===u(w)?E:void 0}},h=new Map(e.flatMap(w=>w.type==="Update"?[[w.next,w.prev]]:[])),m=new Set(e.flatMap(w=>{if(w.type!=="Move")return[];const b=h.get(w.node);return[t.getByNode(w.node)??(b&&t.getByNode(b))]})),p=(w,b)=>{for(let E=fy(w);E;E=fy(E)){const _=h.get(E),T=u(E)??(_&&u(_));if(T&&!c.has(T)&&!m.has(T)&&b.contains(T)){const x=d(T,b);if(x)return x;let N=T;for(;N.parentNode&&N.parentNode!==b;)N=N.parentNode;return{host:b,before:N}}}},S=w=>!!t.getByElement(w)||i(w)||s(w),C=new Set(e.flatMap(w=>w.type==="Remove"?[t.getByNode(w.node)]:[])),L=w=>!c.has(w)&&!C.has(w)&&!m.has(w),k=w=>Array.from(w.childNodes).some(b=>L(b)&&(!!t.getByElement(b)||k(b))),y=(w,b)=>{for(let E=b?b.previousSibling:w.lastChild;E;E=E.previousSibling)if(L(E)){if(t.getByElement(E))return;if(a(E))return k(E)?void 0:E}},g=(w,b,E)=>{const _=w===E?y(E,b):void 0;return _?{host:_,before:Array.from(_.childNodes).find(T=>L(T)&&i(T))}:{host:w,before:b}},v=(w,b,E)=>{const _=p(w,E);if(!_)return{host:E,before:f(b)};let T=_.before.nextSibling??void 0;for(;T&&(c.has(T)||m.has(T)||!S(T));)T=T.nextSibling??void 0;return{host:_.host,before:T}};for(const w of e)switch(r(w),w.type){case"Add":{let{node:b,nextSibling:E}=w;const _=b.parent;if(_){const T=Uy(b,n,_);if(_.type===I.ROOT)l.push(ae.add(null,T,E&&u(E)));else{const x=u(_);if(x){let N,D=x;for(;E;){const R=n.get(E);if(R){const q=d(R,x);N=q?.before??R,D=q?.host??x;break}let O=t.getByNode(E);if(O&&!c.has(O)&&x.contains(O)){N=O;const q=d(O,x);if(q){D=q.host,N=q.before;break}for(;O.parentNode!==x&&O.parentNode;)O=O.parentNode,En(O)&&O.replaceWith(...O.childNodes);break}E=Lr(E)||void 0}N||({host:D,before:N}=v(b,_,x)),{host:D,before:N}=g(D,N,x),l.push(ae.add(D,T,N))}else o("parent-not-mapped")}}else o("no-parent");break}case"Move":{let{node:b,nextSibling:E}=w;const _=b.parent,T=u(b);if(_&&T)if(_.type===I.ROOT)l.push(ae.move(null,T,E&&u(E)));else{const x=u(_);if(x){let N,D=x;for(;E;){const R=n.get(E);if(R){const q=d(R,x);N=q?.before??R,D=q?.host??x;break}let O=t.getByNode(E);if(O&&!c.has(O)&&x.contains(O)){const q=d(O,x);if(q)D=q.host,O=q.before;else for(;O.parentNode!==x&&O.parentNode;)O=O.parentNode;O||at("error while calculating next sibling"),N=O;break}E=Lr(E)||void 0}N||({host:D,before:N}=v(b,_,x)),l.push(ae.move(D,T,N))}else o("parent-not-mapped")}else o(_?"node-not-mapped":"no-parent");break}case"Remove":{const b=w.node,E=u(b);if(b.type===I.HTML&&!b.content)continue;E?(c.set(E,b),l.push(ae.remove(E))):o("node-not-mapped");break}case"Update":{const b=w.prev,E=u(b);E?n.set(w.next,E):w.soft||o("node-not-mapped");break}case"Attribute":{const b=u(w.node);b?l.push(ae.attribute(b,w.name,w.value)):o("node-not-mapped");break}case"Set":{const b=w.node,E=u(b);E?b.type===I.HTML&&HO(E,String(w.data??""))||qy(E)&&b.type===I.DOCTYPE?l.push(ae.set(E,w.data||"")):e.push(ae.remove(b),ae.add(b.parent||null,b,Lr(b)||void 0)):o("node-not-mapped");break}}return{mutations:l,toAdd:n,toRemove:c,isService:i}}function HO(e,t){return ao(e)?!t.includes("<")||vn(e.parentNode)||ao(Cr(t)):!1}function FO({mutations:e}){return Pb(e.flatMap(t=>t.type==="Add"?[t.node]:[]))}var $O=["src","type"];function WO({mutations:e}){const t=new Set,n=r=>{r instanceof HTMLScriptElement&&r.isConnected&&!cl(r)&&t.add(r)};for(const r of e)r.type==="Add"||r.type==="Move"?(n(r.parent),n(r.node.parentNode)):r.type==="Remove"||r.type==="Set"?n(r.node.parentNode):r.type==="Attribute"&&$O.includes(r.name.toLowerCase())&&n(r.node);return[...t]}function qO(e,t,n){const r=e.data,o=Math.min(r.length,t.length),i=e.ownerDocument.getSelection(),s=!!i?.isCollapsed&&i.anchorNode===e&&i.anchorOffset===0&&t.length>r.length&&t.endsWith(r);let a=0;for(;!s&&a<o&&r[a]===t[a];)a++;let l=0;for(;l<o-a&&r[r.length-1-l]===t[t.length-1-l];)l++;const c=r.length-a-l,u=t.slice(a,t.length-l),d=!!i?.isCollapsed&&i.anchorNode===e&&i.anchorOffset>=a&&i.anchorOffset<=a+c,f=d&&n.get(e)===i.anchorOffset;e.replaceData(a,c,u),u&&i?.anchorNode!==e&&n.set(e,a),d&&i.collapse(e,f?a:a+u.length)}function Vy(e){const t=e.ownerDocument?.getSelection();return t?.anchorNode&&e.contains(t.anchorNode)?t:null}function zO(e,t){const n=e?.ownerDocument;if(!e||!n)return null;if(e.nodeType===Node.TEXT_NODE)return e;const r=n.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=null;for(let i=r.nextNode();i&&(o=i,!!t);i=r.nextNode());return o}function hf(e,t,n){const r=Vy(t),{anchorNode:o,anchorOffset:i,focusNode:s,focusOffset:a}=r??{};if(e.insertBefore(t,n),!(!r||!o||!s))try{const l=t.contains(o),c=t.contains(s);r.setBaseAndExtent(l?o:r.anchorNode??o,l?i??0:r.anchorOffset,c?s:r.focusNode??s,c?a??0:r.focusOffset)}catch{}}function UO(e){return!!e&&e.prev!==e.next&&e.prev.at(-1)!==e.next.at(-1)}function jO(e){return!!e&&e.next.length>e.prev.length&&e.next.endsWith(e.prev)}function pf(e,t,n,r){let o;for(let i=t?e.previousSibling:e.nextSibling;i;i=t?i.previousSibling:i.nextSibling){if(n?.has(i))continue;const s=zO(i,t),a=s?.parentElement?.closest("a")??s?.parentElement?.closest("em-replace");if(!s&&o)break;if(!s){o=i;continue}if(o&&!(t&&i===s&&UO(r?.get(s))))break;return a&&i.contains(a)?{beside:a}:{text:s}}return o?{beside:o}:null}function Gy(e,t,n){const r=t.parentNode;r&&e.collapse(r,[...r.childNodes].indexOf(t)+(n?1:0))}function VO(e,t,{removed:n,rewrites:r}){const o=Vy(e),i=o&&pf(e,!0,n,r),s=o&&!i?pf(e,!1,n,r):null;if(e.parentNode?.removeChild(e),!!o)try{if(i?.text){const a=t.get(i.text)??i.text.length;t.set(i.text,a),o.collapse(i.text,a)}else{if(i)return Gy(o,i.beside,!0),i.beside.nodeName==="BR"?i.beside:void 0;s?.text?o.collapse(s.text,0):s&&Gy(o,s.beside,!1)}}catch{}}function GO(e){const t=e.ownerDocument?.getSelection(),{anchorNode:n,anchorOffset:r}=t??{};return!!t?.isCollapsed&&n===e.parentNode&&n?.childNodes[(r??0)-1]===e}function Xy(e,t,{removed:n,moved:r,edited:o,rewrites:i}){if(e.nodeType!==Node.ELEMENT_NODE)return{node:e,offset:t};const[s,a]=[e.childNodes[t-1],e.childNodes[t]];return![s,a].some(l=>l&&n.has(l))||s&&r.has(s)?{node:e,offset:t}:s?.nodeType===Node.TEXT_NODE?{node:s,offset:s.length}:(!s||n.has(s))&&a?.nodeType===Node.TEXT_NODE&&!r.has(a)&&(!o.has(a)||jO(i.get(a)))&&(!n.has(a)||pf(a,!0,n,i)?.text)?{node:a,offset:0}:{node:e,offset:t}}function XO(e,t){const n=e?.getSelection(),{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=n??{};if(!(!n||!r||!i||!t.removed.size)&&!/^(INPUT|TEXTAREA)$/.test(e?.activeElement?.tagName??""))try{const a=Xy(r,o??0,t),l=Xy(i,s??0,t);(a.node!==r||l.node!==i)&&n.setBaseAndExtent(a.node,a.offset,l.node,l.offset)}catch{}}function Ky(e,t,n){if(t?.parentNode===e)return[e,t];const r=t&&n?jy(t,e,n):void 0;return r&&e.contains(r.host)?[r.host,r.before]:[e,null]}function KO(e){const t=new Map;for(const n of e)n.type==="Set"&&n.node instanceof Text&&!vn(n.node.parentNode)&&t.set(n.node,{prev:n.node.data,next:Cr(String(n.data??"")).textContent??""});return t}function YO({mutations:e,toAdd:t,toRemove:n,isService:r},o,i){const s=f=>new Set(e.flatMap(h=>h.type===f?[h.node]:[])),a=s("Remove"),l={removed:a,moved:s("Move"),edited:s("Set"),rewrites:KO(e)};XO([...a].find(f=>f.ownerDocument)?.ownerDocument,l);const c=(f,h,m)=>{if(!f)return at("Element node not in tree");if(!(f instanceof Element))return at("node is not HTMLEement");const p=m===void 0?void 0:xb(f,h,PO(m));if(!(h.toLowerCase()==="type"&&m2(f,p??null)))try{p!=null?tr(f,h,p):f.removeAttribute(h)}catch{}},u=new Map;let d;for(const f of e)switch(f.type){case"Add":{const{node:h,nextSibling:m,parent:p}=f;if(p){const[S,C]=Ky(p,m,r);S.insertBefore(h,C)}break}case"Move":{const{node:h,nextSibling:m,parent:p}=f;if(p){const[S,C]=Ky(p,m,r);hf(S,h,C)}break}case"Remove":{const{node:h}=f;if(h instanceof Document)for(const m of[...h.childNodes])m.parentNode?.removeChild(m);else d=VO(h,u,l)??d;break}case"Attribute":c(f.node,f.name,f.value);break;case"Set":{const{node:h,data:m}=f;if(h instanceof Comment)h.data=m;else if(h instanceof Text){const p=String(m??"");vn(h.parentNode)?t2(h,p):qO(h,Cr(p).textContent??"",u)}break}}for(const[f,h]of n)o.remove(h);for(const[f,h]of t){const m=o.getByElement(h);m&&o.remove(m),o.set(f,h)}if(i&&d?.isConnected&&GO(d))try{i(d)}catch{}}var ZO=class{constructor(){A(this,"_byKey",new WeakMap),A(this,"_byValue",new WeakMap)}get(e){return this._byKey.get(e)}getByValue(e){return this._byValue.get(e)?.deref()}set(e,t){this._byKey.set(e,t),this._byValue.set(t,new WeakRef(e))}delete(e){const t=this.get(e);t&&(this._byKey.delete(e),this._byValue.delete(t))}deleteByValue(e){const t=this.getByValue(e);t&&(this._byKey.delete(t),this._byValue.delete(e))}},QO=class{constructor(){A(this,"_map",new ZO)}getByNode(e){return this._map.getByValue(e)}getByElement(e){return this._map.get(e)}set(e,t){this._map.set(t,e)}remove(e,t=!0){const n=this._map.getByValue(e);if(n&&this._map.delete(n),t){const r=e.children;for(let o=0,i=r.length;o<i;o++)this.remove(r[o])}}};function Yy(e,t){for(let n=e;n;n=n.parent)if(n===t)return!0;return!1}function JO(e){let t;for(let n=e;n;n=n.parent)af(n)&&(t=n);return t}function eR(e){return e.type==="Update"?e.prev:e.node}function tR(e,t){const n=new Map;for(const o of e){if(o.type!=="Update"||!o.soft)continue;const i=JO(o.next);if(!i?.parent||n.has(i))continue;const s=e.find(c=>c.type==="Update"&&c.next===i),a=s?.type==="Update"?t.getByNode(s.prev):void 0;if(s?.type!=="Update"||!a?.isConnected)continue;const l=t.getByNode(o.prev);(!l||!l.isConnected||!a.contains(l))&&n.set(i,s.prev)}if(!n.size)return e;const r=[];for(const o of e){const i=eR(o),s=o.type==="Update"||o.type==="Remove"?t.getByNode(i):void 0;let a=!1;for(const[l,c]of n){const u=t.getByNode(c);if(Yy(i,l)||Yy(i,c)||s&&u?.contains(s)){a=!0,o.type==="Update"&&o.next===l&&l.parent&&r.push(...ae.recreate(c,l.parent,l,Lr(l)||void 0));break}}a||r.push(o)}return r}var gf;(function(e){function t(r,o,i=(s,a)=>s===a){const s=r.length;let a=s===o.length;if(a){for(let l=0;l<s;l++)if(!i(r[l],o[l])){a=!1;break}}return a}e.isEqual=t;function n(r,o,i=(s,a)=>s===a){const s=new Set,a=new Set;for(const l of r)for(const c of o)i(l,c)&&(s.add(l),a.add(c));return{added:o.filter(l=>!a.has(l)),removed:r.filter(l=>!s.has(l))}}e.compare=n})(gf||(gf={}));var Al=new Set;function Nr(e,t){Al.has(e)||(Al.size||Promise.resolve().then(()=>Al.clear()),Al.add(e),U.send(ue.APPLICATION_SYNC_DRIFT,{reason:e,...t()}))}var Zy=new WeakMap;function nR(e){const t=[],n=new Set(e);function r(o){if(n.has(o)){const{parentNode:i,nextSibling:s}=o;i&&n.has(i)&&r(i),s&&n.has(s)&&r(s),t.push(o),n.delete(o)}}for(const o of n)r(o);return t}function rR(e){return{added:e,removed:[],reparented:[],reordered:[]}}function oR(e,t){let n=Zy.get(e);if(!n){let l=function(c){for(const u of c)o.push(u),t(u)?i.push(u):l(u.childNodes)};var r=l;let{added:o,removed:i,reparented:s=[],reordered:a=[]}=e;o=[...o],i=[...i],s&&l(s),a&&l(a),o=nR(o),n={added:o,removed:i},Zy.set(e,n)}return n}function Qy(e,t){const n={};for(const[r,o]of Object.entries(t))n[r]={value:o,enumerable:!0};return Object.create(e,n)}function Jy(e){return new Set((e??"").split(/\s+/).filter(Boolean))}function ev(e,t){for(let n=e;n&&!t.isMapped(n);n=n.parentNode)if(n instanceof Element&&t.isServicePanel(n))return!0;return!1}function tv(e,t){return t.isWrapper(e)||ev(e,t)}function nv(e,t){const n=new Set(e.added.filter(r=>tv(r,t)));return{nodes:n,top:[...n].filter(r=>!r.parentNode||!n.has(r.parentNode))}}function iR(e,t){return e.flatMap(n=>nv(n,t).top)}function sR(e,t){const n=o=>ev(o,t),r=[];return{summaries:e.map(o=>{const i=nv(o,t);return r.push(...i.top),Qy(o,{added:o.added.filter(s=>!i.nodes.has(s)),reparented:o.reparented?.filter(s=>!n(s)),reordered:o.reordered?.filter(s=>!n(s)),characterDataChanged:o.characterDataChanged?.filter(s=>!n(s)),attributeChanged:aR(o,t,s=>tv(s,t))})}),service:r}}function aR(e,t,n){const r={};for(const[o,i]of Object.entries(e.attributeChanged??{})){if(t.isServiceAttribute(o))continue;const s=i.filter(a=>!n(a)&&!(o==="class"&&lR(e,a,t)));s.length&&(r[o]=s)}return r}function lR(e,t,n){const r=Jy(e.getOldAttribute(t,"class")),o=Jy(t.getAttribute("class")),i=[...r,...o].filter(s=>r.has(s)!==o.has(s));return i.length>0&&i.every(s=>n.isServiceClass(s))}var rv=Symbol("filterContext");function cR(e,t){t&&(e[rv]=t)}function uR(e){return e?.[rv]}var ov=Object.getPrototypeOf(customElements),dR=Reflect.get(ov,"define"),bf=new ge,yf=new ge,fR=bf.event,mR=yf.event,hR=["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","connectedMoveCallback","formAssociatedCallback","formResetCallback","formDisabledCallback","formStateRestoreCallback"];function pR(e){bf.fire();try{return e()}finally{yf.fire()}}ov.define=function(e,t,n){const r=t.prototype,o=class extends t{constructor(...i){bf.fire();try{super(...i)}finally{yf.fire()}}};Object.defineProperty(o,"name",{configurable:!0,value:t.name});for(const i of hR){const s=r[i];typeof s=="function"&&Object.defineProperty(o.prototype,i,{configurable:!0,writable:!0,value:function(...a){return pR(()=>s.call(this,...a))}})}dR.call(this,e,o,n)};function iv(e,t,n,r){const o=[...e.childNodes],i=t(e,r);for(const s of o)n(i,iv(s,t,n,i));return i}function Ko(e,t,n){if(t(e,n)!==!1)for(const r of[...e.childNodes])Ko(r,t,e)}var sr="___em-internal";function vf(e,t=!0,n=!1){let r=e.content;switch(e.type){case I.ROOT:{const o=document.implementation.createHTMLDocument();for(const i of[...o.childNodes])o.removeChild(i);if(t)for(const i of e.children)o.appendChild(vf(i,t,n));return o}case I.DOCTYPE:return new DOMParser().parseFromString(`<!DOCTYPE${e.content}>`,"text/html").doctype;case I.COMMENT:return document.createComment(r||"");case I.ELEMENT:if(e.tag){if(n&&customElements.get(e.tag)){const i=document.createElement("div");return i.innerHTML=kd(e),i.firstChild}const o=document.createElement(e.tag);if(e.attributes)for(const i of e.attributeNames){const s=e.attributes[i];try{tr(o,i,typeof s=="string"?s:"")}catch{}}if(t)for(const i of e.children)o.appendChild(al(i,e)?Id(i.content||""):vf(i,t,n));return o}return document.createTextNode("<");case I.HTML:return Cr(r||"");default:throw new Error("unsupported node")}}function gR(e){return pn(e).roots.map(t=>vf(t,!0,!0))}function sv(){const e=document.implementation.createHTMLDocument();for(const t of[...e.childNodes])t.remove();return e}function bR(e){let t;switch(e){case"tr":t=document.createElement("table");break;case"td":t=document.createElement("tr");break;case"head":case"body":t=document.createElement("html");break;case"DocumentType":case"html":return sv();default:t=document.createElement("div")}return t}function yR(e){return"<!DOCTYPE "+e.name+(e.publicId?' PUBLIC "'+e.publicId+'"':"")+(!e.publicId&&e.systemId?" SYSTEM":"")+(e.systemId?' "'+e.systemId+'"':"")+">"}function kl(e){if(e instanceof Element)return zy(e);if(e instanceof Document)return[...e.childNodes].map(r=>kl(r)).join("");if(e instanceof DocumentType)return yR(e);if(e instanceof DocumentFragment)return[...e.childNodes].map(r=>kl(r)).join("");const t=ol(e);if(t!==void 0)return t;const n=document.createElement("div");return n.appendChild(e.cloneNode(!0)),n.innerHTML}function av(e,t=e.parentNode){return vn(t)?My(e,t):kl(e)}function vR(e,t,n){let r=1;const o=new Ey,i=new Map,s=new Map,a=new Map;let l=!1;const c=iv(e,h=>{const m=String(r++);let p;if(Wy(h)||h instanceof Element&&h.hasAttribute("src")){const S=document.createElement(h.tagName);for(const{name:C,value:L}of h.attributes){const k=Ob(h,C,L);k!==null&&tr(S,C==="src"?"___src":C,k)}p=S}else p=h.cloneNode(),NR(h,p);if(p)p instanceof DocumentType&&(l=!0),a.set(p,m),i.set(h,m);else return document.createDocumentFragment();return p},(h,m)=>h&&m&&h.appendChild(m));let u=l?sv():document.createDocumentFragment();u.appendChild(c),Ko(u,(h,m)=>{if(m){const p=a.get(h);if(vn(m))return;if(!p)return at("Error while mapping: not found element");h instanceof Element?h.setAttribute(sr,p):m.insertBefore(document.createComment(`${sr}${p}`),h)}}),cR(u,e.parentNode);let d=gR(t(u)).filter(h=>!!h),f;if(!d.length)return o;if(u instanceof Document){const h=bR("html");for(const m of d)h.appendChild(m);f=h}else{f=document.createDocumentFragment();for(const h of d)f.appendChild(h)}return Ko(f,(h,m)=>{let p=null;if(h instanceof HTMLHtmlElement)s.set("1",h);else{if(h instanceof Element&&h.hasAttribute(sr)){p=h.getAttribute(sr),p&&s.set(p,h);return}const S=h.previousSibling;if(S instanceof Comment&&(!(h instanceof Comment)||h.data.indexOf(sr)<0)){const C=S.data,L=C.indexOf(sr);L>=0&&(p=C.substring(L+14),p&&s.set(p,h))}}}),Ko(f,h=>{if(h instanceof Element&&h.hasAttribute(sr)){h.removeAttribute(sr);return}h instanceof Comment&&h.data.indexOf(sr)>=0&&h.remove()}),Ko(e,h=>{const m=i.get(h),p=s.get(m);p&&(o.set(h,p),vn(h)&&h.firstChild&&p.firstChild&&o.set(h.firstChild,p.firstChild))}),o}function ER(e){const t=lv(e.cloneNode()),n=Nd(t),r=n.length;return t.startTagEnd=t.startTagEnd===void 0?void 0:n.indexOf(">",Math.max(n.lastIndexOf("'"),n.lastIndexOf('"')))+1,t.endTagStart=t.endTagStart===void 0?void 0:t.endTagStart+(r-t.end),t.end=r,t.type=I.ELEMENT,t}var Yo;(function(e){e.HiddenResult=(function(t){return t[t.none=0]="none",t[t.node=1]="node",t[t.children=2]="children",t[t.all=3]="all",t})({})})(Yo||(Yo={}));function lv(e){if(ao(e)&&vn(e.parentNode))return cv(My(e,e.parentNode));const t=ol(e);if(t!==void 0)return cv(t);let n=pn(kl(e.cloneNode())).roots[0];return n||(n=new kt(0,0,[]),n.type=I.HTML,n.content=""),n}function cv(e){const t=new kt(0,e.length,[]);return t.type=I.HTML,t.content=e,t}function uv(e,t=Yo.HiddenResult.node){if(t&Yo.HiddenResult.node&&(e.end=e.start=e.startTagEnd=e.endTagStart=e.end=0),t&Yo.HiddenResult.children)for(const n of e.children)uv(n,Yo.HiddenResult.all)}function SR(e,t=[],n){let r;return e instanceof Element?r=ER(e):r=lv(e),r.children=t,r.parent=void 0,n&&uv(r,n(r)),r}function Ef(e,t,n){let r=t.getByElement(e);if(r)return n?.(e)?void 0:r;for(const o of e.childNodes)if(r=Ef(o,t,n),r)return r}function dv(e,t,n,r){Nr("tree-node-out-of-place",()=>({mutation:n()}))}function fv(e,t,n,r,o){let i=e.parentNode,s=e.nextSibling,a;const l=(c,u)=>!o||o(c,u)?!0:(dv("insertBefore",c,()=>_O(e,u,c,t),u),!1);for(;i;){const c=t.getByElement(i)??(n&&i===n.node?n.treeNode:void 0);if(c){if(a){let u=t.getByNode(a);if(u&&i.contains(u)&&l(a,c))return{parentTreeNode:c,nextSiblingTreeNode:a};a=void 0}for(;s;){const u=Ef(s,t,r);if(u&&l(u,c))return{parentTreeNode:c,nextSiblingTreeNode:u};s=s.nextSibling}return{parentTreeNode:c}}if(!a)for(;s;){const u=Ef(s,t,r);if(u){a=u,s=s.nextSibling;break}s=s.nextSibling}s||(s=i.nextSibling),i=i.parentNode}}function wR(e,t){const n=[],r=e.attributeChanged;if(r)for(const o of Object.keys(r)){const i=r[o];for(const s of i){const a=t.getByElement(s);if(a){const l=s.getAttribute(o);n.push(ae.attribute(a,o,typeof l=="string"?l:void 0))}}}return n}function mv(e,t){return e.type===I.HTML?ol(t)??`<!--${t.data}-->`:t.data}function _R(e,t){const n=[],r=e.characterDataChanged;if(r)for(const o of r){const i=t.getByElement(o);i&&n.push(ae.set(i,Ss(o)?mv(i,o):av(o)))}return n}function CR(e){return(e instanceof Element?e:e.parentElement)?.closest(".sortable-fallback")??null}function TR(e){if(e.nodeType!==Node.TEXT_NODE)return!1;const t=e.parentElement;if(!t||t.closest(".em-element-list-ul, .em-element-list-ol")&&t.closest(".em-element-list-bullet"))return!1;const n=t.closest('[class*="em-element-"]:not(.em-element-resize-img-container)');return!(!n||[".em-element-list-ul",".em-element-list-ol",".em-element-custom-table"].some(r=>n.matches(r)))}function AR(e,t,n,r){const o=s=>{let a=s.parentNode;if(!a||a===n?.node||t.getByElement(a))return!1;for(;a&&a!==n?.node&&!t.getByElement(a);a=a.parentNode)if(!r(a))return!1;return!0},i=new Set;for(const s of BR(e)){const a=t.getByElement(s),l=a?.parent?.children,c=a&&l?l.indexOf(a):-1;if(!a||!l||c<0||!o(s))continue;const{parentTreeNode:u,nextSiblingTreeNode:d}=fv(s,t,n)||{};u===a.parent&&d===l[c+1]&&i.add(s)}return i}function kR(e,t,n,r=new Set){const o=[],i=new Set,s=new Map,a=(l,c)=>{const u=s.get(l);return u?u===c:l.parent===c&&c.children.includes(l)};for(const l of e){const{added:c,removed:u}=oR(l,d=>!!t.getByElement(d));for(const d of u)if(!i.has(d)&&!r.has(d)){const f=t.getByElement(d);if(f){const h=s.get(f)??f.parent;!h||!a(f,h)?dv("remove",f,()=>CO(f,t)):o.push(ae.remove(f)),s.delete(f),i.add(d)}}for(const d of c){if(r.has(d)||TR(d))continue;const f=CR(d);if(f&&!t.getByElement(f))continue;const{parentTreeNode:h,nextSiblingTreeNode:m}=fv(d,t,n,p=>i.has(p),a)||{};if(h){let p=t.getByElement(d);p||(p=SR(d),t.set(p,d)),o.push(ae.add(h,p,m)),s.set(p,h),i.delete(d)}}o.push(...wR(l,t)),o.push(..._R(l,t))}return o}function LR(e,t,n){const r=[],o=t.attributes,i=n.attributes;for(const s of o){const a=s.name,l=i.getNamedItem(a==="src"?"___src":a);if(l){const c=l.value;c!==s.value&&r.push(ae.attribute(e,a,c))}else r.push(ae.attribute(e,a,void 0))}for(const s of i){const a=s.name==="___src"?"src":s.name;o.getNamedItem(a)||r.push(ae.attribute(e,a,s.value))}return r}function NR(e,t){if(!(!r2()||!(e instanceof Element)||!(t instanceof Element)))for(const{name:n,value:r}of Array.from(e.attributes)){const o=Ob(e,n,r);o===null?t.removeAttribute(n):o!==r&&tr(t,n,o)}}function xR(e,t,n,r=()=>!1){const o=[],i=vR(e,n,t);return Ko(e,s=>{const a=t.getByElement(s);if(!a)return;const l=i.getByKey(s);if(l){if(l instanceof Element){if(!(s instanceof Element))return at("CharacterData mapped to Element");o.push(...LR(a,s,l))}else if(l instanceof CharacterData){if(!(s instanceof CharacterData))return at("Element mapped to CharacterData");const c=vn(s.parentNode)&&(s.parentNode?.nodeName==="SCRIPT"||!r(s));l.data!==s.data&&!c&&o.push(ae.set(a,Ss(l)?mv(a,l):av(l,s.parentNode)))}else if(l instanceof Document&&!(s instanceof Document))return at("Node mapped to Document")}else{const c=d=>{for(const f of d.childNodes)if(i.getByKey(f)||!c(f))return!1;return!0};let u;return c(s)?(o.push(ae.hidden(a,!0)),u=!1):o.push(ae.hidden(a,!1)),u}}),o}function OR(e,t){let n,r=e;do{if(t.getByElement(r))return n;n=r}while(r=r.parentNode);for(;e.parentNode;)e=e.parentNode}function RR(e){return[...new Set(e)]}function MR(e,t){return RR([...e.added,...e.reparented||[],...e.reordered||[],...Object.values(e.characterDataChanged||{}),...Object.values(e.attributeChanged||{})].flat().map(n=>OR(n,t)||n))}function PR(e,t){let n=[];for(const r of e){const o=MR(r,t),i=s=>{for(let a=0;a<n.length;a++){const l=n[a];if(l.contains(s)||l===s)return;if(s.contains(l)){n.splice(a,1,s);return}}n.push(s)};for(const s of o)i(s)}return n}function IR(e,t,n){const r=PR(e,t),o=DR(e);return r.flatMap(i=>xR(i,t,n,o))}function DR(e){const t=new Set(e.flatMap(n=>[...n.added,...Object.values(n.characterDataChanged||{}).flat()]));return n=>{for(let r=n;r;r=r.parentNode)if(t.has(r))return!0;return!1}}function BR(e){return e.flatMap(t=>[...t.reparented??[],...t.reordered??[]])}function HR(e,t){return Qy(e,{reparented:e.reparented?.filter(n=>!t.has(n)),reordered:e.reordered?.filter(n=>!t.has(n))})}function FR(e,t,n,r,o=()=>!1){const i=AR(e,t,r,o),s=i.size?e.map(a=>HR(a,i)):e;return[...kR(e,t,r,i),...IR(s,t,n)]}function $R(e){const t=[],n=new Map;for(let r=e.length-1;r>=0;r--){const o=e[r];if(o.type==="Attribute"){const{node:i,name:s,value:a}=o;let l=n.get(i);l||n.set(i,l={}),l.hasOwnProperty(s)||(l[s]=a,i.attributes?.[s]!==a&&t.unshift(o))}else t.unshift(o)}return t}var WR=class{constructor(){A(this,"_map",new WeakMap)}getAttribute(e,t){return this._map.get(e)?.[t]}setAttribute(e,t,n){let r=this._map.get(e);r||this._map.set(e,r=Object.create(null)),r[t]=n}removeAttribute(e,t){let n=this._map.get(e);n&&delete n[t]}hasAttribute(e,t){return this._map.has(e)?.hasOwnProperty(t)}getAttributes(e){return this._map.get(e)}has(e){return this._map.has(e)}replaceNode(e,t){const n=this._map.get(e);n&&(this._map.delete(e),this._map.set(t,n))}},hv=class{constructor(e=10){A(this,"_max",void 0),A(this,"_cache",new Map),this._max=e}get(e){let t=this._cache.get(e);return t!==void 0&&(this._cache.delete(e),this._cache.set(e,t)),t}put(e,t){this._cache.has(e)?this._cache.delete(e):this._cache.size==this._max&&this._cache.delete(this.first()),this._cache.set(e,t)}first(){return this._cache.keys().next().value}};function G(e){if(qR(e))return zR(e)?e.trim():UR(e)}var pv={RGB:/^rgba?\s*\(\s*(?<r>\d+)\s*,\s*(?<g>\d+)\s*,\s*(?<b>\d+)\s*(?:,\s*(?<a>(?:0?\.)?\d+)\s*)?\)/i,HEX:/^\s*#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})\s*$/i},qR=e=>typeof e=="string"&&e.trim()!=="",zR=e=>pv.HEX.test(e);function UR(e){const t=pv.RGB.exec(e)?.groups;if(!t)return;const n=jR(t);return GR(n)}var jR=e=>({r:Sf(e.r),g:Sf(e.g),b:Sf(e.b),a:VR(e.a)}),Sf=e=>Math.min(255,parseInt(e||"0",10)),VR=e=>parseFloat(e||"1"),GR=e=>`#${wf(e.r)}${wf(e.g)}${wf(e.b)}`,wf=e=>e.toString(16).padStart(2,"0");function gv(e){return e.replaceAll(/rgb\(\d{1,3}(,\s?\d{1,3}){2}\)/gi,t=>G(t)||t)}var bv=new hv(1e3);function Zo(e){if(e=e?.trim(),e){let t=bv.get(e);return t||(t=new Set(e.split(" ").filter(n=>!!n).map(n=>n)),bv.put(e,t)),t}else return new Set}function Ll(e){e||(e="");const t=document.createElement("div");return t.setAttribute("style",e),t.style}var yv=new hv(1e3);function ar(e){e||(e="");let t=yv.get(e);return t||(t=Ll(e),yv.put(e,t)),t}function Qo(e){return Array.from({length:e.length},(t,n)=>e.item(n))}function _f(e){return[...new Set(Array.from(e.matchAll(/(?:^|;)\s*([-\w]+)\s*:/g),t=>t[1].toLowerCase()))].sort()}function XR(e,t,n,r){const o=ar(n),i=_f(n),s=new Set(_f(r)),a=_f(e).filter(c=>i.includes(c)||!s.has(c)),l=Qo(t);return l.length===o.length&&l.every(c=>t.getPropertyValue(c)===o.getPropertyValue(c)&&t.getPropertyPriority(c)===o.getPropertyPriority(c))&&a.join(";")===i.join(";")}function vv(e,t,n){const r=t.getPropertyValue(n);r?e.setProperty(n,r,t.getPropertyPriority(n)):e.removeProperty(n)}function KR(e,t,n){const r=e?e.split(" "):[],o=Zo(n),i=Zo(t),s=r.filter(a=>(a=a.trim(),o.has(a)?i.has(a):!0));return s.length===r.length?e:s.join(" ")}function YR(e,t,n,r){const o=Ll(e),i=ar(n),s=ar(t);let a=!1;for(const l of Qo(i)){const c=i.getPropertyValue(l);o.getPropertyValue(l)===c&&s.getPropertyValue(l)!==c&&(a=!0,vv(o,s,l))}for(const l of r??[])o.getPropertyValue(l)?r?.delete(l):s.getPropertyValue(l)&&(a=!0,vv(o,s,l));return typeof t=="string"&&typeof e=="string"&&XR(e,o,t,n??"")?t:a?gv(o.cssText):e}function Ev(e,t,n,r,o){return e==="style"&&(typeof r=="string"||o?.size)?YR(t,n,r,o)||null:typeof r!="string"?t:e==="class"?KR(t,n,r)||null:n!==t&&t===r?null:t}function ZR(e,t){const n=Zo(e),r=Zo(t);for(const o of r)n.has(o)||(e=e?`${e.trimEnd()} ${o}`:o);return e}function QR(e,t){const n=Ll(e),r=ar(t);let o=!1;for(const i of Qo(r)){const s=r.getPropertyValue(i);n.getPropertyValue(i)!==s&&(o=!0,n.setProperty(i,s))}return o?n.cssText:e}function JR(e,t,n){return typeof n!="string"?t:e==="class"?ZR(t,n)||null:e==="style"?QR(t,n)||null:t}function eM(e,t,n){if(!t)return t;const r=Zo(e),o=Zo(n),i=t.split(" "),s=i.filter(a=>(a=a.trim(),!r.has(a)||o.has(a)));return s.length!==i.length?s.join(" "):t}function tM(e,t,n){if(!t)return t;const r=ar(e),o=Ll(t),i=ar(n);let s=!1;for(const a of Qo(o)){const l=o.getPropertyValue(a);r.getPropertyValue(a)===l&&i.getPropertyValue(a)!==l&&(s=!0,o.removeProperty(a))}return s?o.cssText:t}function nM(e,t){const n=ar(t);return Qo(ar(e)).filter(r=>!n.getPropertyValue(r))}function Sv(e){return e.type===I.ELEMENT&&e.start!==e.end}function wv(e){return e.filter(t=>t.type===I.ELEMENT)}function rM(e,t,n){const r=wv(e),o=wv(t),i=[],s=new Set,a=new Set,l=u=>{const d=(h,m)=>{const p=new Map;for(const S of h){const C=m.has(S)?void 0:u(S);C!==void 0&&p.set(C,p.has(C)?null:S)}return p},f=d(r,s);for(const[h,m]of d(o,a)){const p=f.get(h);m&&p&&(i.push([p,m,!0]),s.add(p),a.add(m))}};l(u=>typeof u.attributes?.id=="string"?`${u.tag}#${u.attributes.id}`:void 0),l(u=>er(u,!1,n)),l(u=>er(u,!0,n));const c=new Set(o.map(u=>u.tag));for(const u of c){const d=m=>m.filter(p=>p.tag===u),f=d(r).filter(m=>!s.has(m)),h=d(o).filter(m=>!a.has(m));if(f.length===h.length&&d(r).length===d(o).length){const m=f.length===1&&!f[0].attributes?.id&&!h[0].attributes?.id;h.forEach((p,S)=>i.push([f[S],p,m]))}}return i}var oM=class{constructor(e,t,n,r){A(this,"element",void 0),A(this,"name",void 0),A(this,"nextValue",void 0),A(this,"prevValue",void 0),this.element=e,this.name=t,this.nextValue=n,this.prevValue=r}},iM=class{constructor(e){A(this,"_nodeMap",void 0),A(this,"_map",new WR),A(this,"_removedStyles",new WeakMap),A(this,"_hiddenMutations",[]),A(this,"_restore",[]),this._nodeMap=e}_trackRemovedStyles(e,t,n){const r=this._removedStyles.get(e)??new Set;nM(t,n).forEach(o=>r.add(o)),Qo(ar(n)).forEach(o=>r.delete(o)),r.size?this._removedStyles.set(e,r):this._removedStyles.delete(e)}_onHiddenMutate(){try{for(const{name:e,element:t,prevValue:n,nextValue:r}of this._hiddenMutations){const o=this._nodeMap.getByElement(t);if(o)if(e==="class"){const i=eM(n,r,this._map.getAttribute(o,e))||null;i===null?this._map.removeAttribute(o,e):this._map.setAttribute(o,e,i)}else if(e==="style"){const i=tM(n,r,this._map.getAttribute(o,e))||null;i===null?this._map.removeAttribute(o,e):this._map.setAttribute(o,e,i),this._trackRemovedStyles(o,n,r)}else r===null?this._map.removeAttribute(o,e):this._map.setAttribute(o,e,r)}}finally{this._hiddenMutations=[]}}onHiddenMutate(e){const t=this._hiddenMutations;for(const n of e){const r=n.attributeChanged;if(r)for(const o of Object.keys(r)){const i=r[o];for(const s of i)t.push(new oM(s,o,s.getAttribute(o),n.getOldAttribute(s,o)))}}}beforeCommit(e){this._onHiddenMutate();const t=[];for(const n of e){if(n.type==="Attribute"){const{name:r,node:o,value:i}=n,s=r==="style"&&i?this._removedStyles.get(o):void 0,a=Ev(r,i,o.attributes?.[r]||null,this._map.getAttribute(o,r),s);if(s&&!s.size&&this._removedStyles.delete(o),a!==i){t.push(ae.attribute(o,r,a));continue}}if(t.push(n),n.type==="Add"){const{node:r}=n,o=r.attributes;if(o)for(const i of Object.keys(o)){const s=o[i],a=this._map.getAttribute(r,i);if(a){const l=Ev(i,s,null,a);l!==s&&t.push(ae.attribute(r,i,l))}}}}return t}onRemoteMutate(e){this._onHiddenMutate(),this._restore=[];const t=[];for(const n of e){if(n.type==="Attribute"){const{name:r,node:o,value:i}=n,s=JR(r,i,this._map.getAttribute(o,r));if(s!==i){t.push(ae.attribute(o,r,s));continue}}else if(n.type==="Update"){this._map.replaceNode(n.prev,n.next);const r=this._removedStyles.get(n.prev);r&&(this._removedStyles.delete(n.prev),this._removedStyles.set(n.next,r))}else n.type==="Add"&&n.replaces&&this._carryHidden(n.replaces,n.node,!0,Ld());t.push(n)}return t}_carryHidden(e,t,n,r){if(e.type!==t.type||e.tag!==t.tag)return;const o=this._map.getAttributes(e);if(n&&!Qd(t.tag)&&o){const i=[];for(const[s,a]of Object.entries(o))Kx(s)||(this._map.setAttribute(t,s,a),i.push([s,e.attributes?.[s]??null]));i.length&&this._restore.push({node:t,carried:i})}if(n&&er(e,!1,r)===er(t,!1,r)){const i=t.children.filter(Sv);e.children.filter(Sv).forEach((s,a)=>{i[a]&&this._carryHidden(s,i[a],!0,r)});return}for(const[i,s,a]of rM(e.children,t.children,r))this._carryHidden(i,s,a,r)}restoreHidden(){const e=this._restore;this._restore=[];for(const{node:t,carried:n}of e){const r=this._nodeMap.getByNode(t);if(r instanceof Element)for(const[o,i]of n){if((t.attributes?.[o]??null)!==i){this._map.removeAttribute(t,o);continue}const s=this._map.getAttribute(t,o);typeof s=="string"&&r.setAttribute(o,s)}}}},sM=class{constructor(e){A(this,"_isMapped",void 0),A(this,"_foreign",new WeakSet),A(this,"_movedTo",new WeakMap),A(this,"_output",new WeakSet),A(this,"_service",new WeakSet),A(this,"_wrappers",new WeakSet),A(this,"_outer",new WeakSet),A(this,"_hasForeign",!1),A(this,"_hasOutput",!1),this._isMapped=e}observeLost(e){for(const t of e){for(const n of t.added)this.markForeign(n);for(const n of[...t.reparented??[],...t.reordered??[]])!this._foreign.has(n)&&n.parentNode&&this._movedTo.set(n,n.parentNode)}}markForeign(e){this._hasForeign=!0,this._foreign.add(e)}markOutput(e){this.markForeign(e),this._hasOutput=!0,this._output.add(e)}isOutput(e){return this._hasOutput&&this._isInside(e,this._output)}get hasOutput(){return this._hasOutput}isMarked(e){return this._foreign.has(e)}isOffModel(e){return this._hasForeign&&this._isInside(e,this._foreign)}isForeign(e){return this._hasForeign&&this._nearestMark(e)==="foreign"}markService(e){this._service.add(e)}markWrapper(e){this._wrappers.add(e)}isWrapper(e){return this._wrappers.has(e)}forgetService(e){this._service.delete(e)}markOuterWrapper(e){this._outer.add(e)}isOuterWrapper(e){return this._outer.has(e)}isService(e){return this._isInside(e,this._service)}markOf(e){return this._service.has(e)?"service":this._foreign.has(e)?"foreign":void 0}_nearestMark(e){for(let t=e;t&&!this._isMapped(t);t=t.parentNode){const n=this.markOf(t);if(n)return n}}_isInside(e,t){for(let n=e;n;n=n.parentNode){if(this._isMapped(n))return!1;if(t.has(n))return!0}return!1}isPlacedInForeign(e){return this._hasForeign&&this.isForeign(this._isMapped(e)?e.parentNode:e)}movedTo(e){return this._movedTo.get(e)}forget(e){this._movedTo.delete(e)}},_v="foreign-structure-in-commit";function aM(e,t,n){const r=[],o=(s,a)=>{t.isPlacedInForeign(s)&&r.push({kind:t.movedTo(s)?"moved-own-node":a,node:s})},i=s=>{o(s,"moved"),n(s)||s.childNodes.forEach(i)};for(const s of e)s.added.forEach(a=>o(a,"inserted")),[...s.reparented??[],...s.reordered??[]].forEach(i),new Set(Object.values(s.attributeChanged??{}).flat()).forEach(a=>t.isForeign(a)&&r.push({kind:"attribute",node:a})),(s.characterDataChanged??[]).forEach(a=>t.isForeign(a)&&r.push({kind:"text",node:a}));for(const s of e)[...s.added,...s.reparented??[],...s.reordered??[]].forEach(a=>t.forget(a));return r}function Nl(e){if(!(e instanceof Element))return{tag:e.nodeName.toLowerCase()};const t=e.getAttribute("class");return{tag:e.tagName.toLowerCase(),...t?{class:t}:{}}}var Cv="implicit-tbody-in-canvas";function lM(e,t){const n=new Set;for(const r of e)for(const o of r.added)o instanceof Element&&(o.tagName==="TBODY"?[o]:Array.from(o.querySelectorAll("tbody"))).filter(i=>!t(i)).forEach(i=>n.add(i));return[...n]}function cM(e,t){if(!e.length||t.has("implicit-tbody-in-canvas"))return;const[n]=e,r={kind:"implicit-tbody",kinds:["implicit-tbody"],count:e.length,node:Nl(n),parent:n.parentNode?Nl(n.parentNode):void 0};t.add(Cv),Nr(Cv,()=>({foreign:r}))}function uM(e,t){if(!e.length)return;const[n]=e,r=[...new Set(e.map(({kind:i})=>i))],o={kind:n.kind,kinds:r,count:e.length,node:Nl(n.node),parent:n.node.parentNode?Nl(n.node.parentNode):void 0};t.has("foreign-structure-in-commit")||(t.add(_v),Nr(_v,()=>({foreign:o})))}var Cf="unaccounted-node";function Tv(e,t,n,r){if(t.isMapped(e))return"own";const o=t.markOf(e)??n;return o==="foreign"||o==="service"?o:!r||t.isCanvasNode(e)?"interface":"unaccounted"}function Av(e,t){let n,r=!1,o=t.isMapped(e);for(let i=e.parentNode;i;i=i.parentNode)r||(r=t.roots.has(i)),!o&&!n&&(o=t.isMapped(i),n=o?void 0:t.markOf(i));return Tv(e,t,n,r||t.roots.has(e))}function kv(e,t){const n=[],r=[];for(let o=e.lastChild;o;o=o.previousSibling)r.push([o,void 0,!1]);for(let o=r.pop();o;o=r.pop()){const[i,s,a]=o,l=a||t.roots.has(i),c=Tv(i,t,s,l);c==="unaccounted"&&s!=="unaccounted"&&n.push(i);const u=c==="own"||c==="interface"?void 0:c;for(let d=i.lastChild;d;d=d.previousSibling)r.push([d,u,l])}return n}function dM(e){const t=new WeakSet,n=(e.ownerDocument??e).createTreeWalker(e,NodeFilter.SHOW_ALL);for(let r=n.nextNode();r;r=n.nextNode())t.add(r);return t}function fM(e,t){const n=new Set;for(const r of e)r.isConnected&&Av(r,t)==="unaccounted"&&n.add(r);return[...n].filter(r=>!r.parentNode||!n.has(r.parentNode))}function mM(e){const t=e.nodeType===Node.ELEMENT_NODE?e.tagName.toLowerCase():e.nodeName,n=e.parentNode;return n?`${t}:${Array.prototype.indexOf.call(n.childNodes,e)+1}`:t}function Lv(e){const t=[];for(let o=e;o&&o.nodeType!==Node.DOCUMENT_NODE;o=o.parentNode)t.unshift(mM(o));const n=e instanceof Element?e.getAttribute("class"):null,r=e instanceof Element?e.tagName.toLowerCase():e.nodeName;return{path:t.join(" > "),tag:r,...n?{class:n}:{}}}function Nv(e,t){if(!e.length)return;const n={count:e.length,node:Lv(e[0])};t.has(Cf)||(t.add(Cf),Nr(Cf,()=>({unaccounted:n})))}var hM=_r(((e,t)=>{(function(n,r){typeof e=="object"&&typeof t<"u"?r(e):typeof define=="function"&&define.amd?define(["exports"],r):(n=typeof globalThis<"u"?globalThis:n||self,r(n.MutationSummary={}))})(e,(function(n){"use strict";var r=(function(){function y(){this._nodes=[],this._values=[]}return y._isIndex=function(g){return+g===g>>>0},y._nodeId=function(g){var v=g[y._ID_PROP];return v||(v=g[y._ID_PROP]=y._NEXT_ID++),v},y.prototype.set=function(g,v){var w=y._nodeId(g);this._nodes[w]=g,this._values[w]=v},y.prototype.get=function(g){var v=y._nodeId(g);return v!==void 0?this._values[v]:void 0},y.prototype.has=function(g){return y._nodeId(g)in this._nodes},y.prototype.delete=function(g){var v=y._nodeId(g);delete this._nodes[v],this._values[v]=void 0},y.prototype.keys=function(){var g=[];for(var v in this._nodes)y._isIndex(v)&&g.push(this._nodes[v]);return g},y._ID_PROP="__mutation_summary_node_map_id__",y._NEXT_ID=1,y})(),o=(function(){function y(){this.added=new r,this.removed=new r,this.maybeMoved=new r,this.oldPrevious=new r,this.moved=void 0}return y})();n.Movement=void 0,(function(y){y[y.STAYED_OUT=0]="STAYED_OUT",y[y.ENTERED=1]="ENTERED",y[y.STAYED_IN=2]="STAYED_IN",y[y.REPARENTED=3]="REPARENTED",y[y.REORDERED=4]="REORDERED",y[y.EXITED=5]="EXITED"})(n.Movement||(n.Movement={}));var i=function(y,g){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,w){v.__proto__=w}||function(v,w){for(var b in w)Object.prototype.hasOwnProperty.call(w,b)&&(v[b]=w[b])},i(y,g)};function s(y,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");i(y,g);function v(){this.constructor=y}y.prototype=g===null?Object.create(g):(v.prototype=g.prototype,new v)}var a=(function(){function y(g,v,w,b,E,_,T,x){v===void 0&&(v=!1),w===void 0&&(w=!1),b===void 0&&(b=!1),E===void 0&&(E=null),_===void 0&&(_=!1),T===void 0&&(T=null),x===void 0&&(x=null),this.node=g,this.childList=v,this.attributes=w,this.characterData=b,this.oldParentNode=E,this.added=_,this.attributeOldValues=T,this.characterDataOldValue=x,this.isCaseInsensitive=this.node.nodeType===Node.ELEMENT_NODE&&this.node instanceof HTMLElement&&this.node.ownerDocument instanceof HTMLDocument}return y.prototype.getAttributeOldValue=function(g){if(this.attributeOldValues)return this.isCaseInsensitive&&(g=g.toLowerCase()),this.attributeOldValues[g]},y.prototype.getAttributeNamesMutated=function(){var g=[];if(!this.attributeOldValues)return g;for(var v in this.attributeOldValues)this.attributeOldValues.hasOwnProperty(v)&&g.push(v);return g},y.prototype.attributeMutated=function(g,v){this.attributes=!0,this.attributeOldValues=this.attributeOldValues||{},!(g in this.attributeOldValues)&&(this.attributeOldValues[g]=v)},y.prototype.characterDataMutated=function(g){this.characterData||(this.characterData=!0,this.characterDataOldValue=g)},y.prototype.removedFromParent=function(g){this.childList=!0,this.added||this.oldParentNode?this.added=!1:this.oldParentNode=g},y.prototype.insertedIntoParent=function(){this.childList=!0,this.added=!0},y.prototype.getOldParent=function(){if(this.childList){if(this.oldParentNode)return this.oldParentNode;if(this.added)return null}return this.node.parentNode},y})(),l=(function(y){s(g,y);function g(v,w){var b=y.call(this)||this;b.rootNode=v,b.reachableCache=void 0,b.wasReachableCache=void 0,b.anyParentsChanged=!1,b.anyAttributesChanged=!1,b.anyCharacterDataChanged=!1;for(var E=0;E<w.length;E++){var _=w[E];switch(_.type){case"childList":b.anyParentsChanged=!0;for(var T=0;T<_.removedNodes.length;T++){var x=_.removedNodes[T];b.getChange(x).removedFromParent(_.target)}for(var T=0;T<_.addedNodes.length;T++){var x=_.addedNodes[T];b.getChange(x).insertedIntoParent()}break;case"attributes":b.anyAttributesChanged=!0;var N=b.getChange(_.target);N.attributeMutated(_.attributeName,_.oldValue);break;case"characterData":b.anyCharacterDataChanged=!0;var N=b.getChange(_.target);N.characterDataMutated(_.oldValue)}}return b}return g.prototype.getChange=function(v){var w=this.get(v);return w||(w=new a(v),this.set(v,w)),w},g.prototype.getOldParent=function(v){var w=this.get(v);return w?w.getOldParent():v.parentNode},g.prototype.getIsReachable=function(v){if(v===this.rootNode)return!0;if(!v)return!1;this.reachableCache=this.reachableCache||new r;var w=this.reachableCache.get(v);return w===void 0&&(w=this.getIsReachable(v.parentNode),this.reachableCache.set(v,w)),w},g.prototype.getWasReachable=function(v){if(v===this.rootNode)return!0;if(!v)return!1;this.wasReachableCache=this.wasReachableCache||new r;var w=this.wasReachableCache.get(v);return w===void 0&&(w=this.getWasReachable(this.getOldParent(v)),this.wasReachableCache.set(v,w)),w},g.prototype.reachabilityChange=function(v){return this.getIsReachable(v)?this.getWasReachable(v)?n.Movement.STAYED_IN:n.Movement.ENTERED:this.getWasReachable(v)?n.Movement.EXITED:n.Movement.STAYED_OUT},g})(r),c=(function(){function y(g,v,w,b,E){this.rootNode=g,this.mutations=v,this.selectors=w,this.calcReordered=b,this.calcOldPreviousSibling=E,this.treeChanges=new l(g,v),this.entered=[],this.exited=[],this.stayedIn=new r,this.visited=new r,this.childListChangeMap=void 0,this.characterDataOnly=void 0,this.matchCache=void 0,this.processMutations()}return y.prototype.processMutations=function(){if(!(!this.treeChanges.anyParentsChanged&&!this.treeChanges.anyAttributesChanged))for(var g=this.treeChanges.keys(),v=0;v<g.length;v++)this.visitNode(g[v],void 0)},y.prototype.visitNode=function(g,v){if(!this.visited.has(g)){this.visited.set(g,!0);var w=this.treeChanges.get(g),b=v;if((w&&w.childList||b==null)&&(b=this.treeChanges.reachabilityChange(g)),b!==n.Movement.STAYED_OUT){if(this.matchabilityChange(g),b===n.Movement.ENTERED)this.entered.push(g);else if(b===n.Movement.EXITED)this.exited.push(g),this.ensureHasOldPreviousSiblingIfNeeded(g);else if(b===n.Movement.STAYED_IN){var E=n.Movement.STAYED_IN;w&&w.childList&&(w.oldParentNode!==g.parentNode?(E=n.Movement.REPARENTED,this.ensureHasOldPreviousSiblingIfNeeded(g)):this.calcReordered&&this.wasReordered(g)&&(E=n.Movement.REORDERED)),this.stayedIn.set(g,E)}if(b!==n.Movement.STAYED_IN)for(var _=g.firstChild;_;_=_.nextSibling)this.visitNode(_,b)}}},y.prototype.ensureHasOldPreviousSiblingIfNeeded=function(g){if(this.calcOldPreviousSibling){this.processChildlistChanges();var v=g.parentNode,w=this.treeChanges.get(g);w&&w.oldParentNode&&(v=w.oldParentNode);var b=this.childListChangeMap.get(v);b||(b=new o,this.childListChangeMap.set(v,b)),b.oldPrevious.has(g)||b.oldPrevious.set(g,g.previousSibling)}},y.prototype.getChanged=function(g,v,w){this.selectors=v,this.characterDataOnly=w;for(var b=0;b<this.entered.length;b++){var E=this.entered[b],_=this.matchabilityChange(E);(_===n.Movement.ENTERED||_===n.Movement.STAYED_IN)&&g.added.push(E)}for(var T=this.stayedIn.keys(),b=0;b<T.length;b++){var E=T[b],_=this.matchabilityChange(E);if(_===n.Movement.ENTERED)g.added.push(E);else if(_===n.Movement.EXITED)g.removed.push(E);else if(_===n.Movement.STAYED_IN&&(g.reparented||g.reordered)){var x=this.stayedIn.get(E);g.reparented&&x===n.Movement.REPARENTED?g.reparented.push(E):g.reordered&&x===n.Movement.REORDERED&&g.reordered.push(E)}}for(var b=0;b<this.exited.length;b++){var E=this.exited[b],_=this.matchabilityChange(E);(_===n.Movement.EXITED||_===n.Movement.STAYED_IN)&&g.removed.push(E)}},y.prototype.getOldParentNode=function(g){var v=this.treeChanges.get(g);if(v&&v.childList)return v.oldParentNode?v.oldParentNode:null;var w=this.treeChanges.reachabilityChange(g);if(w===n.Movement.STAYED_OUT||w===n.Movement.ENTERED)throw Error("getOldParentNode requested on invalid node.");return g.parentNode},y.prototype.getOldPreviousSibling=function(g){var v=g.parentNode,w=this.treeChanges.get(g);w&&w.oldParentNode&&(v=w.oldParentNode);var b=this.childListChangeMap.get(v);if(!b)throw Error("getOldPreviousSibling requested on invalid node.");return b.oldPrevious.get(g)},y.prototype.getOldAttribute=function(g,v){var w=this.treeChanges.get(g);if(!w||!w.attributes)throw Error("getOldAttribute requested on invalid node.");var b=w.getAttributeOldValue(v);if(b===void 0)throw Error("getOldAttribute requested for unchanged attribute name.");return b},y.prototype.attributeChangedNodes=function(g){if(!this.treeChanges.anyAttributesChanged)return{};var v,w;if(g){v={},w={};for(var b=0;b<g.length;b++){var E=g[b];v[E]=!0,w[E.toLowerCase()]=E}}for(var _={},T=this.treeChanges.keys(),b=0;b<T.length;b++){var x=T[b],N=this.treeChanges.get(x);if(N.attributes&&!(n.Movement.STAYED_IN!==this.treeChanges.reachabilityChange(x)||n.Movement.STAYED_IN!==this.matchabilityChange(x)))for(var D=x,R=N.getAttributeNamesMutated(),O=0;O<R.length;O++){var E=R[O];v&&!v[E]&&!(N.isCaseInsensitive&&w[E])||N.getAttributeOldValue(E)!==D.getAttribute(E)&&(w&&N.isCaseInsensitive&&(E=w[E]),_[E]=_[E]||[],_[E].push(D))}}return _},y.prototype.getOldCharacterData=function(g){var v=this.treeChanges.get(g);if(!v||!v.characterData)throw Error("getOldCharacterData requested on invalid node.");return v.characterDataOldValue},y.prototype.getCharacterDataChanged=function(){if(!this.treeChanges.anyCharacterDataChanged)return[];for(var g=this.treeChanges.keys(),v=[],w=0;w<g.length;w++){var b=g[w];if(n.Movement.STAYED_IN===this.treeChanges.reachabilityChange(b)){var E=this.treeChanges.get(b);!E.characterData||b.textContent==E.characterDataOldValue||v.push(b)}}return v},y.prototype.computeMatchabilityChange=function(g,v){this.matchCache||(this.matchCache=[]),this.matchCache[g.uid]||(this.matchCache[g.uid]=new r);var w=this.matchCache[g.uid],b=w.get(v);return b===void 0&&(b=g.matchabilityChange(v,this.treeChanges.get(v)),w.set(v,b)),b},y.prototype.matchabilityChange=function(g){var v=this;if(this.characterDataOnly)switch(g.nodeType){case Node.COMMENT_NODE:case Node.TEXT_NODE:return n.Movement.STAYED_IN;default:return n.Movement.STAYED_OUT}if(!this.selectors)return n.Movement.STAYED_IN;if(g.nodeType!==Node.ELEMENT_NODE)return n.Movement.STAYED_OUT;for(var w=g,b=this.selectors.map(function(T){return v.computeMatchabilityChange(T,w)}),E=n.Movement.STAYED_OUT,_=0;E!==n.Movement.STAYED_IN&&_<b.length;){switch(b[_]){case n.Movement.STAYED_IN:E=n.Movement.STAYED_IN;break;case n.Movement.ENTERED:E===n.Movement.EXITED?E=n.Movement.STAYED_IN:E=n.Movement.ENTERED;break;case n.Movement.EXITED:E===n.Movement.ENTERED?E=n.Movement.STAYED_IN:E=n.Movement.EXITED}_++}return E},y.prototype.getChildlistChange=function(g){var v=this.childListChangeMap.get(g);return v||(v=new o,this.childListChangeMap.set(g,v)),v},y.prototype.processChildlistChanges=function(){if(!this.childListChangeMap){this.childListChangeMap=new r;for(var g=function(b){var E=v.mutations[b];if(E.type!="childList"||v.treeChanges.reachabilityChange(E.target)!==n.Movement.STAYED_IN&&!v.calcOldPreviousSibling)return"continue";for(var _=v.getChildlistChange(E.target),T=E.previousSibling,x=function(R,O){!R||_.oldPrevious.has(R)||_.added.has(R)||_.maybeMoved.has(R)||O&&(_.added.has(O)||_.maybeMoved.has(O))||_.oldPrevious.set(R,O)},N=0;N<E.removedNodes.length;N++){var D=E.removedNodes[N];x(D,T),_.added.has(D)?_.added.delete(D):(_.removed.set(D,!0),_.maybeMoved.delete(D)),T=D}x(E.nextSibling,T);for(var N=0;N<E.addedNodes.length;N++){var D=E.addedNodes[N];_.removed.has(D)?(_.removed.delete(D),_.maybeMoved.set(D,!0)):_.added.set(D,!0)}},v=this,w=0;w<this.mutations.length;w++)g(w)}},y.prototype.wasReordered=function(g){if(!this.treeChanges.anyParentsChanged)return!1;this.processChildlistChanges();var v=g.parentNode,w=this.treeChanges.get(g);w&&w.oldParentNode&&(v=w.oldParentNode);var b=this.childListChangeMap.get(v);if(!b)return!1;if(b.moved)return b.moved.get(g);b.moved=new r;var E=new r;function _(R){if(!R||!b.maybeMoved.has(R))return!1;var O=b.moved.get(R);return O!==void 0||(E.has(R)?O=!0:(E.set(R,!0),O=D(R)!==x(R)),E.has(R)?(E.delete(R),b.moved.set(R,O)):O=b.moved.get(R)),O}var T=new r;function x(R){var O=T.get(R);if(O!==void 0)return O;for(O=b.oldPrevious.get(R);O&&(b.removed.has(O)||_(O));)O=x(O);return O===void 0&&(O=R.previousSibling),T.set(R,O),O}var N=new r;function D(R){if(N.has(R))return N.get(R);for(var O=R.previousSibling;O&&(b.added.has(O)||_(O));)O=O.previousSibling;return N.set(R,O),O}return b.maybeMoved.keys().forEach(_),b.moved.get(g)},y})(),u=(function(){function y(g,v){var w=this;if(this.projection=g,this.added=[],this.removed=[],this.reparented=v.all||v.element||v.characterData?[]:void 0,this.reordered=v.all?[]:void 0,g.getChanged(this,v.elementFilter,v.characterData),v.all||v.attribute||v.attributeList){var b=v.attribute?[v.attribute]:v.attributeList,E=g.attributeChangedNodes(b);v.attribute?this.valueChanged=E[v.attribute]||[]:(this.attributeChanged=E,v.attributeList&&v.attributeList.forEach(function(T){w.attributeChanged.hasOwnProperty(T)||(w.attributeChanged[T]=[])}))}if(v.all||v.characterData){var _=g.getCharacterDataChanged();v.characterData?this.valueChanged=_:this.characterDataChanged=_}this.reordered&&(this.getOldPreviousSibling=g.getOldPreviousSibling.bind(g))}return y.prototype.getOldParentNode=function(g){return this.projection.getOldParentNode(g)},y.prototype.getOldAttribute=function(g,v){return this.projection.getOldAttribute(g,v)},y.prototype.getOldCharacterData=function(g){return this.projection.getOldCharacterData(g)},y.prototype.getOldPreviousSibling=function(g){return this.projection.getOldPreviousSibling(g)},y})(),d=(function(){function y(){}return y.prototype.matches=function(g){if(g===null)return!1;if(this.attrValue===void 0)return!0;if(!this.contains)return this.attrValue==g;for(var v=g.split(" "),w=0;w<v.length;w++)if(this.attrValue===v[w])return!0;return!1},y.prototype.toString=function(){return this.attrName==="class"&&this.contains?"."+this.attrValue:this.attrName==="id"&&!this.contains?"#"+this.attrValue:this.contains?"["+this.attrName+"~="+f(this.attrValue)+"]":"attrValue"in this?"["+this.attrName+"="+f(this.attrValue)+"]":"["+this.attrName+"]"},y})();function f(y){return'"'+y.replace(/"/,'\\"')+'"'}var h=/[a-zA-Z_]+/,m=/[a-zA-Z0-9_\-]+/,p=(function(){function y(){this.uid=y.nextUid++,this.qualifiers=[]}return Object.defineProperty(y.prototype,"caseInsensitiveTagName",{get:function(){return this.tagName.toUpperCase()},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"selectorString",{get:function(){return this.tagName+this.qualifiers.join("")},enumerable:!1,configurable:!0}),y.prototype.isMatching=function(g){return g[y.matchesSelector](this.selectorString)},y.prototype.wasMatching=function(g,v,w){if(!v||!v.attributes)return w;var b=v.isCaseInsensitive?this.caseInsensitiveTagName:this.tagName;if(b!=="*"&&b!==g.tagName)return!1;for(var E=[],_=!1,T=0;T<this.qualifiers.length;T++){var x=this.qualifiers[T],N=v.getAttributeOldValue(x.attrName);E.push(N),_=_||N!==void 0}if(!_)return w;for(var T=0;T<this.qualifiers.length;T++){var x=this.qualifiers[T],N=E[T];if(N===void 0&&(N=g.getAttribute(x.attrName)),!x.matches(N))return!1}return!0},y.prototype.matchabilityChange=function(g,v){var w=this.isMatching(g);return w?this.wasMatching(g,v,w)?n.Movement.STAYED_IN:n.Movement.ENTERED:this.wasMatching(g,v,w)?n.Movement.EXITED:n.Movement.STAYED_OUT},y.parseSelectors=function(g){var v=[],w,b;function E(){w&&(b&&(w.qualifiers.push(b),b=void 0),v.push(w)),w=new y}function _(){b&&w.qualifiers.push(b),b=new d}for(var T=/\s/,x=void 0,N="Invalid or unsupported selector syntax.",D=1,R=2,O=3,q=4,ee=5,de=6,re=7,Q=8,ve=9,fe=10,Te=11,ut=12,te=13,z=14,oe=D,qt=0;qt<g.length;){var j=g[qt++];switch(oe){case D:if(j.match(h)){E(),w.tagName=j,oe=R;break}if(j=="*"){E(),w.tagName="*",oe=O;break}if(j=="."){E(),_(),w.tagName="*",b.attrName="class",b.contains=!0,oe=q;break}if(j=="#"){E(),_(),w.tagName="*",b.attrName="id",oe=q;break}if(j=="["){E(),_(),w.tagName="*",b.attrName="",oe=de;break}if(j.match(T))break;throw Error(N);case R:if(j.match(m)){w.tagName+=j;break}if(j=="."){_(),b.attrName="class",b.contains=!0,oe=q;break}if(j=="#"){_(),b.attrName="id",oe=q;break}if(j=="["){_(),b.attrName="",oe=de;break}if(j.match(T)){oe=z;break}if(j==","){oe=D;break}throw Error(N);case O:if(j=="."){_(),b.attrName="class",b.contains=!0,oe=q;break}if(j=="#"){_(),b.attrName="id",oe=q;break}if(j=="["){_(),b.attrName="",oe=de;break}if(j.match(T)){oe=z;break}if(j==","){oe=D;break}throw Error(N);case q:if(j.match(h)){b.attrValue=j,oe=ee;break}throw Error(N);case ee:if(j.match(m)){b.attrValue+=j;break}if(j=="."){_(),b.attrName="class",b.contains=!0,oe=q;break}if(j=="#"){_(),b.attrName="id",oe=q;break}if(j=="["){_(),oe=de;break}if(j.match(T)){oe=z;break}if(j==","){oe=D;break}throw Error(N);case de:if(j.match(h)){b.attrName=j,oe=re;break}if(j.match(T))break;throw Error(N);case re:if(j.match(m)){b.attrName+=j;break}if(j.match(T)){oe=Q;break}if(j=="~"){b.contains=!0,oe=ve;break}if(j=="="){b.attrValue="",oe=Te;break}if(j=="]"){oe=O;break}throw Error(N);case Q:if(j=="~"){b.contains=!0,oe=ve;break}if(j=="="){b.attrValue="",oe=Te;break}if(j=="]"){oe=O;break}if(j.match(T))break;throw Error(N);case ve:if(j=="="){b.attrValue="",oe=Te;break}throw Error(N);case fe:if(j=="]"){oe=O;break}if(j.match(T))break;throw Error(N);case Te:if(j.match(T))break;if(j=='"'||j=="'"){x=j,oe=te;break}b.attrValue+=j,oe=ut;break;case ut:if(j.match(T)){oe=fe;break}if(j=="]"){oe=O;break}if(j=="'"||j=='"')throw Error(N);b.attrValue+=j;break;case te:if(j==x){oe=fe;break}b.attrValue+=j;break;case z:if(j.match(T))break;if(j==","){oe=D;break}throw Error(N)}}switch(oe){case D:case R:case O:case ee:case z:E();break;default:throw Error(N)}if(!v.length)throw Error(N);return v},y.nextUid=1,y.matchesSelector="matches",y})(),S=(function(){function y(){}return y.createObserverOptions=function(g){var v={childList:!0,subtree:!0},w;function b(E){if(!(v.attributes&&!w)){if(v.attributes=!0,v.attributeOldValue=!0,!E){w=void 0;return}w=w||{},E.forEach(function(_){w[_]=!0,w[_.toLowerCase()]=!0})}}return g.forEach(function(E){if(E.characterData){v.characterData=!0,v.characterDataOldValue=!0;return}if(E.all){b(),v.characterData=!0,v.characterDataOldValue=!0;return}if(E.attribute){b([E.attribute.trim()]);return}var _=y._elementFilterAttributes(E.elementFilter).concat(E.attributeList||[]);_.length&&b(_)}),w&&(v.attributeFilter=Object.keys(w)),v},y.validateOptions=function(g){for(var v in g)if(!(v in y._optionKeys))throw Error("Invalid option: "+v);if(typeof g.callback!="function")throw Error("Invalid options: callback is required and must be a function");if(!g.queries||!g.queries.length)throw Error("Invalid options: queries must contain at least one query request object.");for(var w={callback:g.callback,rootNode:g.rootNode||document,observeOwnChanges:!!g.observeOwnChanges,oldPreviousSibling:!!g.oldPreviousSibling,queries:[]},b=0;b<g.queries.length;b++){var E=g.queries[b];if(E.all){if(Object.keys(E).length>1)throw Error("Invalid request option. all has no options.");w.queries.push({all:!0});continue}if("attribute"in E){var _={attribute:y._validateAttribute(E.attribute)};if(_.elementFilter=p.parseSelectors("*["+_.attribute+"]"),Object.keys(E).length>1)throw Error("Invalid request option. attribute has no options.");w.queries.push(_);continue}if("element"in E){var T=Object.keys(E).length,_={element:E.element,elementFilter:p.parseSelectors(E.element)};if(E.hasOwnProperty("elementAttributes")&&(_.attributeList=y._validateElementAttributes(E.elementAttributes),T--),T>1)throw Error("Invalid request option. element only allows elementAttributes option.");w.queries.push(_);continue}if(E.characterData){if(Object.keys(E).length>1)throw Error("Invalid request option. characterData has no options.");w.queries.push({characterData:!0});continue}throw Error("Invalid request option. Unknown query request.")}return w},y._validateElementAttributes=function(g){if(!g.trim().length)throw Error("Invalid request option: elementAttributes must contain at least one attribute.");for(var v={},w={},b=g.split(/\s+/),E=0;E<b.length;E++){var _=b[E];if(_){_=y._validateAttribute(_);var T=_.toLowerCase();if(v[T])throw Error("Invalid request option: observing multiple case variations of the same attribute is not supported.");w[_]=!0,v[T]=!0}}return Object.keys(w)},y._elementFilterAttributes=function(g){var v={};return g.forEach(function(w){w.qualifiers.forEach(function(b){v[b.attrName]=!0})}),Object.keys(v)},y._validateAttribute=function(g){if(typeof g!="string"||(g=g.trim(),!g))throw Error("Invalid request option. attribute must be a non-zero length string.");if(!g.match(y._attributeFilterPattern))throw Error("Invalid request option. invalid attribute name: "+g);return g},y._attributeFilterPattern=/^([a-zA-Z:_]+[a-zA-Z0-9_\-:.]*)$/,y._optionKeys={callback:!0,queries:!0,rootNode:!0,oldPreviousSibling:!0,observeOwnChanges:!0},y})(),C=(function(){function y(g){var v=this;this._connected=!1,this._options=S.validateOptions(g),this._observerOptions=S.createObserverOptions(this._options.queries),this._root=this._options.rootNode,this._callback=this._options.callback,this._elementFilter=Array.prototype.concat.apply([],this._options.queries.map(function(w){return w.elementFilter?w.elementFilter:[]})),this._elementFilter.length||(this._elementFilter=void 0),this._calcReordered=this._options.queries.some(function(w){return w.all}),this._queryValidators=[],y.createQueryValidator&&(this._queryValidators=this._options.queries.map(function(w){return y.createQueryValidator(v._root,w)})),this._observer=new MutationObserver(function(w){v._observerCallback(w)}),this.reconnect()}return y.prototype.reconnect=function(){if(this._connected)throw Error("Already connected");this._observer.observe(this._root,this._observerOptions),this._connected=!0,this._checkpointQueryValidators()},y.prototype.takeSummaries=function(){if(!this._connected)throw Error("Not connected");var g=this._createSummaries(this._observer.takeRecords());return this._changesToReport(g)?g:void 0},y.prototype.disconnect=function(){var g=this.takeSummaries();return this._observer.disconnect(),this._connected=!1,g},y.prototype._observerCallback=function(g){this._options.observeOwnChanges||this._observer.disconnect();var v=this._createSummaries(g);this._runQueryValidators(v),this._options.observeOwnChanges&&this._checkpointQueryValidators(),this._changesToReport(v)&&this._callback(v),!this._options.observeOwnChanges&&this._connected&&(this._checkpointQueryValidators(),this._observer.observe(this._root,this._observerOptions))},y.prototype._createSummaries=function(g){if(!g||!g.length)return[];for(var v=new c(this._root,g,this._elementFilter,this._calcReordered,this._options.oldPreviousSibling),w=[],b=0;b<this._options.queries.length;b++)w.push(new u(v,this._options.queries[b]));return w},y.prototype._checkpointQueryValidators=function(){this._queryValidators.forEach(function(g){g&&g.recordPreviousState()})},y.prototype._runQueryValidators=function(g){this._queryValidators.forEach(function(v,w){v&&v.validate(g[w])})},y.prototype._changesToReport=function(g){return g.some(function(v){return!!(["added","removed","reordered","reparented","valueChanged","characterDataChanged"].some(function(w){return v[w]&&v[w].length})||v.attributeChanged&&Object.keys(v.attributeChanged).some(function(w){return!!v.attributeChanged[w].length}))})},y})(),L=(function(){function y(g,v){this.root=g,this.delegate=v,this.idMap={}}return y.prototype.initialize=function(g,v){this.idMap[g]=this.root;for(var w=0;w<v.length;w++)this.deserializeNode(v[w],this.root)},y.prototype.applyChanged=function(g,v,w,b){var E=this;v.forEach(function(_){var T=E.deserializeNode(_);E.deserializeNode(_.parentNode),E.deserializeNode(_.previousSibling),T.parentNode&&T.parentNode.removeChild(T)}),g.forEach(function(_){var T=E.deserializeNode(_);T.parentNode&&T.parentNode.removeChild(T)}),v.forEach(function(_){var T=E.deserializeNode(_),x=E.deserializeNode(_.parentNode),N=E.deserializeNode(_.previousSibling);x.insertBefore(T,N?N.nextSibling:x.firstChild)}),w.forEach(function(_){var T=E.deserializeNode(_);Object.keys(_.attributes).forEach(function(x){var N=_.attributes[x];N===null?T.removeAttribute(x):(!E.delegate||!E.delegate.setAttribute||!E.delegate.setAttribute(T,x,N))&&T.setAttribute(x,N)})}),b.forEach(function(_){var T=E.deserializeNode(_);T.textContent=_.textContent}),g.forEach(function(_){delete E.idMap[_.id]})},y.prototype.deserializeNode=function(g,v){var w=this;if(g===null)return null;var b=this.idMap[g.id];if(b)return b;var E=this.root.ownerDocument;switch(E===null&&(E=this.root),g.nodeType){case Node.COMMENT_NODE:b=E.createComment(g.textContent);break;case Node.TEXT_NODE:b=E.createTextNode(g.textContent);break;case Node.DOCUMENT_TYPE_NODE:b=E.implementation.createDocumentType(g.name,g.publicId,g.systemId);break;case Node.ELEMENT_NODE:this.delegate&&this.delegate.createElement&&(b=this.delegate.createElement(g.tagName)),b||(b=E.createElement(g.tagName)),Object.keys(g.attributes).forEach(function(T){(!w.delegate||!w.delegate.setAttribute||!w.delegate.setAttribute(b,T,g.attributes[T]))&&b.setAttribute(T,g.attributes[T])});break;default:throw"Unsupported node type: "+g.nodeType}if(this.idMap[g.id]=b,v&&v.appendChild(b),g.childNodes)for(var _=0;_<g.childNodes.length;_++)this.deserializeNode(g.childNodes[_],b);return b},y})(),k=(function(){function y(g,v,w){var b=this;this.target=g,this.mirror=v,this.nextId=1,this.knownNodes=new r;for(var E=this.serializeNode(g).id,_=[],T=g.firstChild;T;T=T.nextSibling)_.push(this.serializeNode(T,!0));this.mirror.initialize(E,_);var x=[{all:!0}];w&&(x=x.concat(w)),this.mutationSummary=new C({rootNode:g,callback:function(N){b.applyChanged(N)},queries:x})}return y.prototype.disconnect=function(){this.mutationSummary&&(this.mutationSummary.disconnect(),this.mutationSummary=void 0)},y.prototype.rememberNode=function(g){var v=this.nextId++;return this.knownNodes.set(g,v),v},y.prototype.forgetNode=function(g){this.knownNodes.delete(g)},y.prototype.serializeNode=function(g,v){if(g===null)return null;var w=this.knownNodes.get(g);if(w!==void 0)return{id:w};var b={nodeType:g.nodeType,id:this.rememberNode(g)};switch(b.nodeType){case Node.DOCUMENT_TYPE_NODE:var E=g;b.name=E.name,b.publicId=E.publicId,b.systemId=E.systemId;break;case Node.COMMENT_NODE:case Node.TEXT_NODE:b.textContent=g.textContent;break;case Node.ELEMENT_NODE:var _=g;b.tagName=_.tagName,b.attributes={};for(var T=0;T<_.attributes.length;T++){var x=_.attributes[T];b.attributes[x.name]=x.value}if(v&&_.childNodes.length){b.childNodes=[];for(var N=_.firstChild;N;N=N.nextSibling)b.childNodes.push(this.serializeNode(N,!0))}}return b},y.prototype.serializeAddedAndMoved=function(g,v,w){var b=this,E=g.concat(v).concat(w),_=new r;E.forEach(function(x){var N=x.parentNode,D=_.get(N);D||(D=new r,_.set(N,D)),D.set(x,!0)});var T=[];return _.keys().forEach(function(x){for(var N=_.get(x),D=N.keys();D.length;){for(var R=D[0];R.previousSibling&&N.has(R.previousSibling);)R=R.previousSibling;for(;R&&N.has(R);){var O=b.serializeNode(R);O.previousSibling=b.serializeNode(R.previousSibling),O.parentNode=b.serializeNode(R.parentNode),T.push(O),N.delete(R),R=R.nextSibling}D=N.keys()}}),T},y.prototype.serializeAttributeChanges=function(g){var v=this,w=new r;return Object.keys(g).forEach(function(b){g[b].forEach(function(E){var _=w.get(E);_||(_=v.serializeNode(E),_.attributes={},w.set(E,_)),_.attributes[b]=E.getAttribute(b)})}),w.keys().map(function(b){return w.get(b)})},y.prototype.applyChanged=function(g){var v=this,w=g[0],b=w.removed.map(function(x){return v.serializeNode(x)}),E=this.serializeAddedAndMoved(w.added,w.reparented,w.reordered),_=this.serializeAttributeChanges(w.attributeChanged),T=w.characterDataChanged.map(function(x){var N=v.serializeNode(x);return N.textContent=x.textContent,N});this.mirror.applyChanged(b,E,_,T),w.removed.forEach(function(x){v.forgetNode(x)})},y})();if(MutationObserver===void 0)throw Error("DOM Mutation Observers are required");n.ChildListChange=o,n.MutationProjection=c,n.MutationSummary=C,n.NodeChange=a,n.NodeMap=r,n.Qualifier=d,n.Selector=p,n.Summary=u,n.TreeChanges=l,n.TreeMirror=L,n.TreeMirrorClient=k,Object.defineProperty(n,"__esModule",{value:!0})}))})),pM=hM(),Jo=0,ei=new Array(1e3);function gM(){for(let e=0;e<Jo;e+=2){const t=ei[e],n=ei[e+1];t(...n),ei[e]=void 0,ei[e+1]=void 0}Jo=0}function bM(e,...t){ei[Jo]=e,ei[Jo+1]=t,Jo+=2,Jo===2&&vM()}function yM(){let e=0;const t=new MutationObserver(gM),n=document.createTextNode("");return t.observe(n,{characterData:!0}),()=>{n.data=String(e=++e%2)}}var vM=yM();function xv(){bM(()=>{Tf.hasListeners()&&(Tf.fire(),xv())})}var Tf=new ge({onFirstListenerAdd:xv}),xl=Tf.once;function EM(e,t,n){const r=new ge;let o=[];return r.addDisposable(e(i=>{xl(()=>{r.fire(t(o)),o=[]}),o.push(i)})),n?.addDisposable(r),r.event}var SM=class extends ge{constructor(e={}){super(),A(this,"_mutationSummary",void 0),this._mutationSummary=new pM.MutationSummary({...e,observeOwnChanges:!0,callback:t=>this.fire(t),queries:[{all:!0}]})}dispose(){this._mutationSummary.disconnect(),super.dispose()}trigger(e){if(this.isDisposed())return;const t=this._mutationSummary.takeSummaries();return(e||t?.length)&&this.fire(t||[]),t}},wM=class extends Ee{_nextTickHandler(){xl(()=>{this.trigger(),this._summaries.length&&(this._innerEmitter.hasListeners()?this._innerEmitter.fire(this._summaries):this._lostEmitter.fire(this._summaries),this._summaries=[])},Number.MAX_VALUE)}constructor(e={}){super(),A(this,"_mutationEmitter",void 0),A(this,"_innerEmitter",this.addDisposable(new ge({onFirstListenerAdd:()=>{this._nextTickHandler()}}))),A(this,"_lostEmitter",this.addDisposable(new ge)),A(this,"_paused",0),A(this,"_stopped",0),A(this,"_foreignCode",0),A(this,"_summaries",[]),A(this,"onMutate",this._innerEmitter.event),A(this,"onLost",this._lostEmitter.event),A(this,"onNativeMutate",void 0),this._mutationEmitter=this.addDisposable(new SM(e)),this.onNativeMutate=this._mutationEmitter.event,this.addDisposable(this._mutationEmitter.event(t=>{(!this._stopped||this._foreignCode)&&(this._paused?this._lostEmitter.fire(t):(this._summaries.push(...t),xl(()=>{this._summaries.length&&!this._innerEmitter.hasListeners()&&(this._lostEmitter.fire(this._summaries),this._summaries=[])},Number.MAX_VALUE)))}))}get isStoped(){return this._paused>0||this._stopped>0}stop(){this._mutationEmitter.trigger(),this._stopped++}start(){this._mutationEmitter.trigger(),this._stopped--}pause(){this._mutationEmitter.trigger(),this._paused++}resume(){this._mutationEmitter.trigger(),this._paused--}pauseForForeignCode(){this.pause(),this._foreignCode++}resumeAfterForeignCode(){this.resume(),this._foreignCode--}unpaused(e){if(!this._paused||this._stopped)return e();this._mutationEmitter.trigger();const t=this._paused;this._paused=0;try{return e()}finally{try{this._mutationEmitter.trigger()}finally{this._paused+=t}}}trigger(){this._mutationEmitter.trigger(!0)}takeRecords(){this._mutationEmitter.trigger()}flush(){if(this._mutationEmitter.trigger(),this._summaries.length&&this._innerEmitter.hasListeners()){const e=this._summaries;this._summaries=[],this._innerEmitter.fire(e)}}},_M=1,Ov=e=>e.nodeType===_M,Af=e=>e?.nodeName==="STYLE";function CM(e){return e.some(t=>t.attributeChanged&&Object.keys(t.attributeChanged).length||t.reparented?.length||t.reordered?.length||t.added?.some(n=>Ov(n)||Af(n.parentNode))||t.removed?.some(n=>Ov(n)||Af(t.getOldParentNode(n)))?!0:!!t.characterDataChanged?.some(n=>Af(n.parentNode)))}var TM=xl;function AM(e,t){let n=0;for(const r of t){if(r.oldPosition>e)break;const o=r.oldLength>0&&r.newLength>0,i=e===r.oldPosition||e===r.oldEnd;if(o&&i||r.oldPosition<e&&e<r.oldEnd)return;r.oldEnd<=e&&(n=r.newEnd-r.oldEnd)}return e+n}var Rv=/&(?:#\d+|#x[\da-f]+|[a-z][a-z\d]*);/iy;function Mv(e,t){Rv.lastIndex=t;const n=Rv.exec(e);return n?n[0].length:e.startsWith(`\r
|
|
3
|
+
`,t)?2:1}function Pv(e){return e.length===1?1:(Cr(e).textContent??"").length}function kM(e,t,n){if(n)return Math.min(t,e.length);let r=0,o=0;for(;o<e.length&&r<t;){const i=Mv(e,o);r+=Pv(e.slice(o,o+i)),o+=i}return o}function LM(e,t,n){if(n)return Math.min(t,e.length);let r=0;for(let o=0;o<e.length;){const i=Mv(e,o);if(o+i>t)break;r+=Pv(e.slice(o,o+i)),o+=i}return r}function ws(e,t){const n=t.nodeMap.getByElement(e);return n&&t.isAttached(n)?n:void 0}var NM='[contenteditable="true"], editor';function Iv(e,t,n){const r=e.childNodes;for(let i=t;i<r.length;i++){const s=ws(r[i],n);if(s)return s.start}for(let i=Math.min(t,r.length)-1;i>=0;i--){const s=ws(r[i],n);if(s)return s.end}const o=ws(e,n);return o&&(o.startTagEnd??o.start)}function Dv(e,t){if((e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(NM))for(let n=e,r=e.parentNode;r;n=r,r=r.parentNode){const o=Iv(r,Array.from(r.childNodes).indexOf(n),t);if(o!==void 0)return o}}function xM({node:e,offset:t},n){if(e.nodeType===Node.TEXT_NODE){const r=ws(e,n);if(r?.type!==I.HTML)return Dv(e,n);const o=n.textAt(r.start,r.end);return r.start+kM(o,t,vn(e.parentNode))}return Iv(e,t,n)??(ws(e,n)?void 0:Dv(e,n))}function kf(e,t,n){const r=n.nodeMap.getByNode(e),o=r?.parentNode;if(!(!r||!o))return{node:o,offset:Array.from(o.childNodes).indexOf(r)+(t?1:0)}}function OM(e,t){const n=t.nodeAt(e);if(!n)return;if(n.type===I.HTML){const s=t.nodeMap.getByNode(n);return s?.nodeType!==Node.TEXT_NODE?void 0:{node:s,offset:LM(t.textAt(n.start,n.end),Math.max(0,Math.min(e,n.end)-n.start),vn(s.parentNode))}}if(e<=n.start||e>=n.end)return kf(n,e>=n.end&&e>n.start,t);const r=n.children.find(s=>s.start>=e);if(r)return kf(r,!1,t);const o=n.children[n.children.length-1];if(o)return kf(o,!0,t);const i=t.nodeMap.getByNode(n);return i&&{node:i,offset:0}}var $oe=400,Bv=3e3,RM=class extends Ee{constructor(e,t=400){super(),A(this,"_waitMs",void 0),A(this,"_actionId",void 0),A(this,"_queue",[]),A(this,"_timer",void 0),A(this,"_guid",void 0),A(this,"_releaseOnReady",!1),A(this,"_releasing",!1),this._waitMs=t,this.addDisposable(e.onHistoryAction(n=>this._wait(n))),this.addDisposable(e.onHistoryActionSent(n=>this._sent(n))),this.addDisposable(e.onHistoryActionAnswered(n=>this._answered(n))),this.addDisposable(e.onEntitySet(n=>this._entitySet(n))),this.addDisposable(e.onReady(()=>this._ready())),this.addDispose(()=>this._drop())}hold(e){return this._actionId===void 0?!1:(this._queue.push(e),!0)}holdBehindQueued(e){return!this._queue.length||this._releasing?!1:(this._queue.push(e),!0)}isWaiting(){return this._actionId!==void 0}hasQueued(){return this._queue.length>0&&!this._releasing}releaseNow(){this._queue.length&&this._release()}_wait(e){this._actionId=e,this._restartTimer(Bv)}_sent(e){e===this._actionId&&!this._releaseOnReady&&this._restartTimer(this._waitMs)}_restartTimer(e){clearTimeout(this._timer),this._timer=setTimeout(()=>this._release(),e)}_answered(e){e===this._actionId&&this._release()}_release(){clearTimeout(this._timer),this._actionId=void 0,this._releaseOnReady=!1,this._releasing=!0;try{for(;this._actionId===void 0&&this._queue.length;){const e=this._queue.shift();try{e?.()}catch{}}}finally{this._releasing=!1}}_entitySet(e){const t=e===this._guid;this._guid=e,t?this._actionId!==void 0&&(this._restartTimer(this._waitMs),this._releaseOnReady=!0):this._drop()}_ready(){this._releaseOnReady&&(this._releaseOnReady=!1,this._release())}_drop(){clearTimeout(this._timer),this._actionId=void 0,this._releaseOnReady=!1,this._queue=[]}},Hv=2e3,MM=3;function PM(e,t,n){const r=e.data.indexOf(n,Math.max(0,t-n.length));return n.trim().length>=MM&&r>=0&&r<=t}function Fv(e,t){if(!e||e.nodeType===Node.TEXT_NODE)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r;for(let o=n.nextNode();o&&(t||!r);o=n.nextNode())r=o;return r}function IM(e,t){if(e.nodeType===Node.TEXT_NODE)return{text:e,offset:t};const n=Fv(e.childNodes[t-1],!0),r=n?void 0:Fv(e.childNodes[t],!1);return n?{text:n,offset:n.length}:r&&{text:r,offset:0}}var DM=class extends Ee{beginTextUpdate(){this._baseDocument.beginUpdate()}endTextUpdate(){this._baseDocument.endUpdate()}constructor(e,t,n){super(),A(this,"_baseDocument",void 0),A(this,"_remoteDocument",void 0),A(this,"_parsedDocument",void 0),A(this,"_nodeMap",void 0),A(this,"_beforeChangeEmitter",this.addDisposable(new ge)),A(this,"_beforeCommitEmitter",this.addDisposable(new ge)),A(this,"_beforeTextCommitEmitter",this.addDisposable(new ge)),A(this,"_onTextCommitEmitter",this.addDisposable(new ge)),A(this,"_onRefreshEmitter",this.addDisposable(new ge)),A(this,"_documentElement",void 0),A(this,"_docType",void 0),A(this,"_parseFn",void 0),A(this,"_serviceMarkup",void 0),A(this,"_mapHTMLRoots",void 0),A(this,"_roots",void 0),A(this,"_getRootsParent",void 0),A(this,"_mutationCollector",this.addDisposable(new wM)),A(this,"_attributeMapper",void 0),A(this,"_trackedOffsets",new Set),A(this,"_inputHold",void 0),A(this,"_shownEntity",void 0),A(this,"_savedCaret",void 0),A(this,"ownership",void 0),A(this,"holdCaretAfterBreak",void 0),A(this,"_reportedDrifts",new Set),A(this,"_hiddenEmptyTexts",new WeakSet),A(this,"_canvasNodes",dM(document)),A(this,"_accountingTimer",void 0),A(this,"_lastAccounting",0),A(this,"_capture",void 0),A(this,"_openBatches",0),A(this,"_pushUndoStop",!1),A(this,"_locked",!1),A(this,"_beforeCommitPending",!1),A(this,"_closeStep",!1),A(this,"_styleDirty",!0),A(this,"_outputs",new Map),A(this,"_runningScripts",[]),A(this,"scriptRunner",{run:(o,i)=>this.runScript(o,i),quiet:o=>this.renderOnly(o),substitute:(o,i)=>{const s=this._nodeMap.getByElement(o);s&&(this._nodeMap.remove(s,!1),this._nodeMap.set(s,i))}}),A(this,"_commands",[]),A(this,"_pauseOnCommandInput",o=>{const i=this._commands[this._commands.length-1];if(i){i.paused||(i.paused=!0,this._mutationCollector.pause());return}o.isTrusted&&(this._pushUndoStop=!0,this.recordNow())}),A(this,"_treeMutations",[]),A(this,"beforeChange",this._beforeChangeEmitter.event),A(this,"beforeCommit",this._beforeCommitEmitter.event),A(this,"beforeTextCommit",this._beforeTextCommitEmitter.event),A(this,"onTextCommit",this._onTextCommitEmitter.event),A(this,"onChange",nx(EM(this._mutationCollector.onNativeMutate,o=>o.flat(),this),o=>o.length>0,this)),A(this,"onRefresh",this._onRefreshEmitter.event),this._baseDocument=e,this._remoteDocument=t,this._parseFn=n.prepareHtml,this._serviceMarkup=n.serviceMarkup,this._mapHTMLRoots=n.mapHTMLRoots,this._getRootsParent=n.rootsParent,this._roots=[...document.childNodes];const r=this._parsedDocument=new hO(e,n.createRoot);this._nodeMap=new QO,this.addDisposable(r.onRefresh(this._onRefresh.bind(this))),this.addDisposable(r.onMutate(this._onRemoteMutate.bind(this))),this._attributeMapper=new iM(this._nodeMap),this.addDisposable(fR(()=>this._mutationCollector.pauseForForeignCode())),this.addDisposable(mR(()=>this._mutationCollector.resumeAfterForeignCode())),this.addDisposable(this._mutationCollector.onNativeMutate(o=>{this._styleDirty||(this._styleDirty=CM(o))})),this.addDisposable(this._mutationCollector.onLost(o=>this._attributeMapper.onHiddenMutate(o))),this.ownership=new sM(o=>!!this._nodeMap.getByElement(o)),this.addDisposable(this._mutationCollector.onLost(o=>{this._markLostService(o),this._bindScriptOutput(o)})),this.addDisposable(this._mutationCollector.onLost(o=>this.ownership.observeLost(o))),this.addDispose(pN(this._pauseOnCommandInput)),t.collectCanvasEdits=()=>this.commit(!1),this.addDispose(()=>clearTimeout(this._accountingTimer)),this.addDisposable(t.onEntitySet(o=>this._rememberCaret(o))),this.addDisposable(t.onReady(()=>this._dropForeignCaret())),this._inputHold=this.addDisposable(new RM(t)),this.addDisposable(e.onChanged(({changes:o})=>this._rebaseTracked(o))),this.addDisposable(t.onEntitySet(()=>this._forgetTracked()))}trackOffset(e){const t={offset:e};return this._trackedOffsets.add(t),{current:()=>t.offset,release:()=>this._trackedOffsets.delete(t)}}_rebaseTracked(e){for(const t of this._trackedOffsets)t.offset=t.offset===void 0?void 0:AM(t.offset,e)}_forgetTracked(){for(const e of this._trackedOffsets)e.offset=void 0;this._trackedOffsets.clear()}holdInput(e){return this._inputHold.hold(e)}holdInputBehindQueued(e){return this._inputHold.holdBehindQueued(e)}isHoldingInput(){return this._inputHold.isWaiting()}hasHeldInput(){return this._inputHold.hasQueued()}releaseHeldInput(){this._inputHold.releaseNow()}_rememberCaret(e){const t=e===this._shownEntity;this._shownEntity=e,this._savedCaret=void 0;const n=document.getSelection();if(!t||!n?.isCollapsed||document.activeElement?.closest("input, textarea, select, .monaco-editor"))return;const r=n.anchorNode,o=r?.childNodes,i=r?.nodeType===Node.TEXT_NODE?r:[o?.[n.anchorOffset-1],o?.[n.anchorOffset]].find(s=>s?.nodeType===Node.TEXT_NODE);i&&(this._savedCaret={node:i,text:i.data})}_dropForeignCaret(){const e=this._savedCaret;if(this._savedCaret=void 0,!e||document.activeElement?.closest("input, textarea, select, .monaco-editor"))return;const t=document.getSelection(),n=t?.anchorNode;if(!e.node.isConnected){const l=n?IM(n,t?.anchorOffset??0):void 0;l&&l.text!==e.node&&!PM(l.text,l.offset,e.text)&&t?.removeAllRanges();return}const{text:r}=e,o=e.node.data,i=Math.min(r.length,o.length);let s=0;for(;s<i&&r[s]===o[s];)s++;let a=0;for(;a<i-s&&r[r.length-1-a]===o[o.length-1-a];)a++;s+a<Math.ceil(i/2)&&(n===e.node||n===e.node.parentNode)&&t?.removeAllRanges()}_typedIntoHidden(e){const t=e.flatMap(n=>n.characterDataChanged??[]).filter(n=>this._hiddenEmptyTexts.has(n)&&n.isConnected&&n.data!==""&&!this.isBehindHidden(n));for(const n of t)this._hiddenEmptyTexts.delete(n),this.ownership.forgetService(n);return t.length?[rR(t)]:[]}isBehindHidden(e){for(let t=e.parentNode;t&&!this._nodeMap.getByElement(t);t=t.parentNode)if(!this.ownership.isWrapper(t)&&this.ownership.markOf(t))return!0;return!1}isUntracked(e){return this.ownership.isMarked(e)||this.ownership.isOffModel(e.parentNode)||this.ownership.isService(e)}markUntracked(e){this.ownership.markForeign(e)}_reportSafely(e){try{e()}catch{}}_reportForeignStructure(e){this._reportSafely(()=>{const t=n=>!!this._nodeMap.getByElement(n);uM(aM(e,this.ownership,t),this._reportedDrifts),cM(lM(e,t),this._reportedDrifts)})}_accountingRules(){const e=new Set;for(const t of this._parsedDocument.root.children){const n=this._nodeMap.getByNode(t);n&&e.add(n)}return this._getRootsParent?.()?.childNodes.forEach(t=>e.add(t)),{isMapped:t=>!!this._nodeMap.getByElement(t),markOf:t=>this.ownership.markOf(t),isCanvasNode:t=>this._canvasNodes.has(t),roots:e}}nodeBucket(e){return Av(e,this._accountingRules())}auditNodes(){return kv(document,this._accountingRules()).map(Lv)}checkAccounting(){this._reportSafely(()=>Nv(kv(document,this._accountingRules()),this._reportedDrifts))}_checkCommitted(e){this._reportSafely(()=>{const t=e.flatMap(n=>[...n.added,...n.reparented??[],...n.reordered??[]]);Nv(fM(t,this._accountingRules()),this._reportedDrifts)})}_scheduleAccountingCheck(){if(this._accountingTimer!==void 0||this.isDisposed())return;const e=()=>{this._accountingTimer=void 0,this._lastAccounting=Date.now(),this.isDisposed()||this.checkAccounting()},t=Math.max(0,this._lastAccounting+Hv-Date.now());this._accountingTimer=setTimeout(()=>{const n=window.requestIdleCallback;n?n(e,{timeout:Hv}):e()},t)}closeUndoStep(){this._closeStep=!0}commit(e=!0,t=!1){this._pushUndoStop||(this._pushUndoStop=e),this._locked||(this._locked=t);const n=this._capture??this._startCapture();return this._runBeforeCommit(),n}takeStyleDirty(){this._mutationCollector.takeRecords();const e=this._styleDirty;return this._styleDirty=!1,e}_runBeforeCommit(){this._beforeCommitPending&&!this.isDisposed()&&(this._beforeCommitPending=!1,this._mutationCollector.unpaused(()=>this._beforeCommitEmitter.fire()))}flushCommit(){this._capture!==void 0&&this._mutationCollector.flush()}recordNow(){this._capture===void 0&&this._startCapture(),this._mutationCollector.flush()}_startCapture(){let e;const t=new Promise(n=>e=n);return this._capture=t,this._openBatches++,this._beforeCommitPending=!0,this._sealOnNextTick(e),t}_letterEdits(e){const t=this._serviceRules();if(!t)return e;const n=sR(e,t);return n.service.forEach(r=>this.ownership.markService(r)),n.summaries}_markLostService(e){const t=this._serviceRules();if(t){const n=this._scriptOf()?{...t,isServicePanel:()=>!1}:t;iR(e,n).forEach(r=>this.ownership.markService(r))}}_serviceRules(){const e=this._serviceMarkup;return e&&{...e,isWrapper:t=>this.ownership.isWrapper(t),isMapped:t=>!!this._nodeMap.getByElement(t)}}_sealOnNextTick(e){const t=this._mutationCollector.onMutate(n=>{n.length&&(this._reportSafely(()=>this._beforeTextCommitEmitter.fire()),this._dropForeignOutput(n),this._reportForeignStructure(n),this._dropForeignNodes(n),bl("commit",()=>{const r=FR(this._letterEdits([...n,...this._typedIntoHidden(n)]),this._nodeMap,this._parseFn,this._rootsParent(),o=>this.ownership.isWrapper(o));this._commit(r)}),this._reportSafely(()=>this._onTextCommitEmitter.fire()),this._checkCommitted(n),this._dropOrphanedOutput())});TM(()=>{this._beforeCommitPending&&this._reportSafely(()=>this._runBeforeCommit()),this._reportSafely(()=>this._mutationCollector.flush()),this._beforeCommitPending=!1,t.dispose();const{_pushUndoStop:n,_locked:r}=this;this._capture=void 0,this._pushUndoStop=this._locked=!1,this._closeStep&&n&&(this._closeStep=!1,this._remoteDocument.closeStep());const o=()=>{this._openBatches--,e()};if(r&&!this.isDisposed()){this._remoteDocument.saveChangesAsync(n).finally(o);return}try{this.isDisposed()||this._remoteDocument.saveChanges(n)}finally{o()}})}get entityId(){return this._remoteDocument.entityId}whenSent(e=!1){return this._remoteDocument.whenSent(e)}sendAfterCurrentEdits(e){const t=this._pushUndoStop;return this._pushUndoStop=!1,this._remoteDocument.sendAfterCurrentEdits(e,t)}holdsTypedEdits(){return this._remoteDocument.holdsTypedEdits()}hasEditsAfterBoundary(){return this._remoteDocument.hasEditsAfterBoundary()}markHistoryAction(){return this._remoteDocument.markHistoryAction()}noteHistoryActionSent(e){this._remoteDocument.noteHistoryActionSent(e)}_textPoints(){return{nodeMap:this._nodeMap,textAt:(e,t)=>this._baseDocument.getText({start:e,end:t}),nodeAt:e=>this._parsedDocument.getNodeByPosition(e),isAttached:e=>this._parsedDocument.isAttached(e)}}pointToOffset(e){return xM(e,this._textPoints())}offsetToPoint(e){return OM(e,this._textPoints())}renderOnly(e){this._mutationCollector.stop();try{return e()}finally{this._mutationCollector.start()}}applyHidden(e){this._mutationCollector.pause();try{return e()}finally{this._mutationCollector.resume()}}applyForeignOutput(e,t,n){e.forEach(r=>this.ownership.markOutput(r)),this.applyHidden(t),this._keepOutput(n,e)}_keepOutput(e,t){t.length&&this._outputs.set(e,[...this._outputs.get(e)??[],...t])}_isGone(e){return!e.isConnected&&!this.isInLetter(e)}isInLetter(e){const t=this._nodeMap.getByElement(e);return!!t&&this._parsedDocument.isAttached(t)}letterChildren(e){return(this._nodeMap.getByElement(e)?.children??[]).flatMap(t=>{const n=this._nodeMap.getByNode(t);return n?[n]:[]})}runScript(e,t){this._mutationCollector.pauseForForeignCode(),this._runningScripts.push(e);try{t()}finally{try{this._mutationCollector.resumeAfterForeignCode()}finally{this._runningScripts.pop()}}}_scriptOf(){if(this._runningScripts.length)return this._runningScripts[this._runningScripts.length-1]??void 0;const e=document.currentScript;return e&&(this._nodeMap.getByElement(e)||this.ownership.isOutput(e))?e:void 0}_bindScriptOutput(e){const t=this._scriptOf();if(!t)return;const n=new Set(e.flatMap(o=>o.added)),r=[...n].filter(o=>!(o.parentNode&&n.has(o.parentNode))&&!this._nodeMap.getByElement(o)&&!this.ownership.isOutput(o)&&!this.ownership.isService(o)&&!this._runningScripts.includes(o));r.forEach(o=>this.ownership.markOutput(o)),this._keepOutput(t,r)}_dropOrphanedOutput(){let e=[...this._outputs.keys()].filter(t=>this._isGone(t));for(;e.length;){const t=e.flatMap(n=>this._outputs.get(n)??[]);e.forEach(n=>this._outputs.delete(n)),this.applyHidden(()=>t.flatMap(n=>this._unwrapOutput(n))).forEach(n=>this.ownership.forget(n)),e=[...this._outputs.keys()].filter(n=>this._isGone(n))}}_unwrapOutput(e){const t=[],n=r=>r.childNodes.forEach(o=>this.isInLetter(o)?t.push(o):n(o));return n(e),e.parentNode&&e.replaceWith(...t),t}_dropForeignOutput(e){if(this.ownership.hasOutput){const t=n=>!(this.ownership.isMarked(n)&&this.ownership.isOutput(n));for(const n of e)n.added=n.added.filter(t),n.reparented=n.reparented?.filter(t),n.reordered=n.reordered?.filter(t)}}_dropForeignNodes(e){const t=n=>!this.ownership.isMarked(n)||!!this._nodeMap.getByElement(n);for(const n of e)n.added=n.added.filter(t),n.reparented=n.reparented?.filter(t),n.reordered=n.reordered?.filter(t)}applyOwn(e){this._mutationCollector.takeRecords(),this._runningScripts.push(null);try{return this._mutationCollector.unpaused(e)}finally{this._runningScripts.pop()}}applyCommand(e){const t={paused:!1};this._commands.push(t);try{return this._mutationCollector.unpaused(e)}finally{this._commands.pop(),t.paused&&this._mutationCollector.resume()}}_rootsParent(){const e=this._getRootsParent?.();return e?{node:e,treeNode:this._parsedDocument.root}:void 0}getMappedParent(e){for(;e;){const t=this._nodeMap.getByElement(e);if(t){const n=this._parsedDocument.getContext(t);return n?this._nodeMap.getByNode(n):void 0}else e=e.parentNode}}getContext(e){return this.getMappedParent(e)||e}isInExternal(e){return this.getContext(e)!==e}isVisible(e){return!!this._nodeMap.getByElement(e)}getVisibleNode(e){let t=e;do{if(!t||this._nodeMap.getByElement(t))return t;t=t.parentNode||void 0}while(t)}_commit(e){if(e.length){e=this._attributeMapper.beforeCommit(e),e=$R(e);try{this._baseDocument.beginUpdate();const t=this._parsedDocument;uy(()=>{const n=By(t.applyingMutation,r=>this._nodeMap.getByNode(r),r=>t.isAttached(r));return n&&{...n,stage:"tree"}},()=>t.applyMutations(e));for(const n of e)if(n.type==="Hidden"){const r=this._nodeMap.getByNode(n.node);r&&(this.ownership.markService(r),r.nodeType===Node.TEXT_NODE&&r.data===""&&this._hiddenEmptyTexts.add(r)),this._nodeMap.remove(n.node,n.value)}}finally{this._baseDocument.endUpdate()}}}correctNodes(e){const t=new Map;for(const n of e)if(!t.has(n)&&this._parsedDocument.contains(n)&&n.type===I.ELEMENT){const r=Nd(n,!1,!1);r!==this._baseDocument.getText({start:n.start,end:n.startTagEnd===void 0?n.start:n.startTagEnd})+this._baseDocument.getText({start:n.endTagStart===void 0?n.end:n.endTagStart,end:n.end})&&t.set(n,r)}try{this._baseDocument.beginUpdate();for(const[n,r]of t)if(r!==this._baseDocument.getText({start:n.start,end:n.end})){const o=this._parsedDocument.replaceWithEx(n,r,or),i=this._nodeMap.getByNode(n);i&&(this._nodeMap.remove(n),this._nodeMap.set(o,i))}}finally{this._baseDocument.endUpdate()}}_onRefresh(e){try{bl("refresh",()=>this._onRemoteMutate(e,!0))}finally{this._onRefreshEmitter.fire()}}_onRemoteMutate(e,t){if(this._treeMutations.push([e,t,Ex()??"other"]),!(this._remoteDocument.hasChanges()&&!this._remoteDocument.isApplyingRemote()))for(const[n,r,o]of this._treeMutations)bl(o,()=>this._doOnRemoteMutate(n,r))}_doOnRemoteMutate(e,t){try{if(this._mutationCollector.stop(),e=tR(this._attributeMapper.onRemoteMutate(e),this._nodeMap),this._treeMutations=[],!t){const o=this._parsedDocument.root;for(const i of e)if(i.type==="Add"){if(i.parent===o){t=!0;break}}else if(i.type==="Remove"){if(i.node.parent===o){t=!0;break}}else if(i.type==="Move"&&(i.node.parent===o||i.parent===o)){t=!0;break}}const n=DO(e,this._nodeMap,o=>this._parsedDocument.isAttached(o),o=>this.ownership.markOf(o)==="service",o=>this.ownership.isOuterWrapper(o),o=>this.ownership.isWrapper(o)&&o.nodeName==="EDITOR"),r=FO(n);this._beforeChangeEmitter.fire({domMutations:n.mutations,treeMutations:e}),r.push(...f2(WO(n)));try{if(YO(n,this._nodeMap,this.holdCaretAfterBreak),this._dropOrphanedOutput(),this._attributeMapper.restoreHidden(),t){const o=this._parsedDocument.root?.children;if(o){const i=o.map(a=>this._nodeMap.getByNode(a)).filter(a=>!!a),s=this._roots=this._mapHTMLRoots(i,this);gf.isEqual(i,s)}}}finally{Wb(r,this.scriptRunner)}}finally{this._mutationCollector.start(),this._scheduleAccountingCheck()}}getLinks(e){const t=this._nodeMap.getByElement(e),n=t?[[t,e]]:[];for(const r of e.childNodes)n.push(...this.getLinks(r));return n}setLinks(e){for(const[t,n]of e)this._nodeMap.set(t,n)}_clearLinks(e){for(const[t]of e)this._nodeMap.remove(t)}_removeByLinks(e,t){const n=new Set,r=[];for(const[o,i]of e)o.parent&&!n.has(o.parent)&&(this._parsedDocument.remove(o,t),r.unshift(ae.remove(i))),n.add(o);return r}getInnerHtml(e){let t=this._nodeMap.getByElement(e);return t?this._baseDocument.getText({start:t.startTagEnd===void 0?t.start:t.startTagEnd,end:t.endTagStart===void 0?t.end:t.endTagStart}):""}getOuterHtml(e){let t=this._nodeMap.getByElement(e);return t?this._baseDocument.getText({start:t.start,end:t.end}):""}getRootsHtml(){const e=this._getRootsParent?.();return e?this._rootsHtmlOf(e):""}_rootsHtmlOf(e){return[...e.childNodes].map(t=>!this._nodeMap.getByElement(t)&&this.ownership.isWrapper(t)?this._rootsHtmlOf(t):this.getOuterHtml(t)).join("")}setInnerHtml(e,t){if(e instanceof Element)e.innerHTML=t;else if(e instanceof Comment)e.data=t;else if(e instanceof Document){at("not supported inner html of Document");return}else e instanceof Text&&(e.textContent=t)}getElementByPosition(e){let t=this._parsedDocument.getNodeByPosition(e);if(t){let n;do n=this._nodeMap.getByNode(t);while(!n&&(t=t?.parent));return n}}getRangeByElement(e,t=!1){if(e){let n=null;do n=this._nodeMap.getByElement(e);while(t&&!n&&(e=e.parentElement));if(n)return{start:n.start,end:n.end}}}},Woe=1500,qoe=2,BM=100,HM=class{constructor(e){A(this,"_options",void 0),A(this,"_watches",new Map),A(this,"_timer",void 0),A(this,"_last",0),A(this,"_tick",()=>{const t=Date.now(),n=Math.min(Math.max(t-this._last,0),200);this._last=t;for(const[r,o]of this._watches){if(!this._options.isAwaiting(r)){this._watches.delete(r);continue}if(o.waited+=n,!(o.waited<1500)){if(o.retries<2){o.retries+=1,o.waited=0,o.resend();continue}t-o.startedAt<15e3||(this._watches.delete(r),this._options.onGiveUp(r,o.retries))}}this._watches.size||this._stop()}),this._options=e}watch(e,t){this._watches.set(e,{startedAt:Date.now(),waited:0,retries:0,resend:t}),this._timer===void 0&&(this._last=Date.now(),this._timer=setInterval(this._tick,BM))}resendNow(e){const t=this._watches.get(e);t&&(t.waited=0,t.resend())}giveUpNow(e){const t=this._watches.get(e);this._watches.delete(e),this._options.onGiveUp(e,t?.retries??0)}dispose(){this._watches.clear(),this._stop()}_stop(){this._timer!==void 0&&(clearInterval(this._timer),this._timer=void 0)}},Lf=class{constructor(){A(this,"_changes",null),A(this,"_typedAt",null),A(this,"_selection",null),A(this,"_closesStep",!1)}get(){return this._changes}hasChanges(){return!!this._changes?.length}add(e){this.hasChanges()||(this._selection=null);const t=Lt(this._changes,e);this._changes=t.length?t:null;const n=Date.now();this._typedAt=this._changes?{from:this._typedAt?.from??n,to:n}:null}clear(){this._changes=null,this._typedAt=null,this._selection=null,this._closesStep=!1}closeStep(){this._closesStep=!0}closesStep(){return this._closesStep}replace(e){this._changes=e.length?e:null,this._selection=null,this._changes||(this._typedAt=null)}typedAt(){return this._typedAt}selection(){return this._selection}noteSelection(e,t){this.hasChanges()&&(this._selection=t?e:this._selection&&{before:this._selection.before,after:e.after})}takeFrom(e){this._changes=e._changes,this._typedAt=e._typedAt,this._selection=e._selection,this._closesStep=e._closesStep,e.clear()}absorb(e){const t=this._typedAt,n=e._typedAt,r=this.hasChanges()?this._selection&&e._selection&&{...this._selection,after:e._selection.after}:e._selection;e._changes&&this.add(e._changes),this._closesStep=e._closesStep,this._selection=this._changes?r:null,this._changes&&(this._typedAt=t&&n?{from:Math.min(t.from,n.from),to:Math.max(t.to,n.to)}:n??t)}correctOffset(e,t){const n=this._changes;if(n){let r=0;for(let o=0,i=n.length;o<i;o++){const s=n[o];if(s.oldPosition<e)r+=s.newLength-s.oldLength;else break}e=e+(t?1:-1)*r}return e}correctRange(e,t){return{start:this.correctOffset(e.start,t),end:this.correctOffset(e.end,t)}}},$v=60;function FM(e,t){const n=ay(e,t);if(!n)return;const r=n.start;return{offset:r,ownLength:e.length,cachedLength:t.length,own:e.substring(r,r+$v),cached:t.substring(r,r+$v)}}var $M=64,WM=class extends Ee{constructor(...e){super(...e),A(this,"_onApplyEmitter",this.addDisposable(new ge)),A(this,"_onEmptyEmitter",this.addDisposable(new ge)),A(this,"_dispatched",[]),A(this,"_echoed",new Set),A(this,"_revertedAwaiting",new Set),A(this,"onApply",this._onApplyEmitter.event),A(this,"onEmpty",this._onEmptyEmitter.event)}_emit(e){e.length&&this._onApplyEmitter.fire(e),this.hasDispatched()||this._onEmptyEmitter.fire()}hasDispatched(){return!!this._dispatched.length}isInFlight(e){return this._dispatched.some(t=>t.changeId===e)}hasRevertedAwaiting(){return this._revertedAwaiting.size>0}revertedAwaitingIds(){return new Set(this._revertedAwaiting)}awaitingIds(){return[...this._dispatched.flatMap(e=>e.changeId===void 0?[]:[e.changeId]),...this._revertedAwaiting]}isRevertedAwaiting(e){return this._revertedAwaiting.has(e)}forgetReverted(e){for(const t of e)this._revertedAwaiting.delete(t)}wasEchoed(e){return e!==void 0&&this._echoed.has(e)}countDispatched(){return this._dispatched.reduce((e,t)=>e+t.textChanges.length,0)}_remember(e){this._echoed.add(e),this._echoed.size>$M&&this._echoed.delete(this._echoed.values().next().value)}append(e,t){this._dispatched.unshift({changeId:t,textChanges:e})}apply(e,t,n=!1,r=[e]){const o=t===void 0?-1:this._dispatched.findIndex(i=>i.changeId===t);if(t!==void 0&&(this._remember(t),this._revertedAwaiting.delete(t)),o>=0){this._confirmEcho(o,e);return}n&&this._rebaseDispatched(r)||this._applyExternal(e)}_rebaseDispatched(e){const t=[...this._dispatched].reverse().map(r=>({...r}));let n=[];for(const r of e){let o=r;for(const i of t){const s=vl(i.textChanges,o,"after"),a=s&&vl(o,i.textChanges,"before");if(!s||!a)return!1;i.textChanges=s,o=a}n=Lt(n,o)}return this._dispatched=t.reverse(),this._emit(n),!0}_confirmEcho(e,t){const[n]=this._dispatched.splice(e,1);this._emit(Lt(In(n.textChanges),t))}_applyExternal(e){let t=[];for(const n of this._dispatched)t=Lt(t,In(n.textChanges)),n.changeId!==void 0&&this._revertedAwaiting.add(n.changeId);this._dispatched=[],this._emit(Lt(t,e))}clear(){const e=this.hasDispatched();this._dispatched=[],this._revertedAwaiting.clear(),e&&this._onEmptyEmitter.fire()}},qM=class cN extends Ee{constructor(t=""){super(),A(this,"_text",void 0),this._text=t}getText(t){const n=Ix(this,t);return n?this._text.substring(n.start,n.end):""}getLength(){return this._text.length}clone(){return new cN(this._text)}},Ol=class uN extends qM{constructor(t=""){super(t),A(this,"_eventQueue",void 0),A(this,"_lockCounter",0),A(this,"_onChangeEmitter",this.addDisposable(new ge)),A(this,"_onChangedEmitter",this.addDisposable(new ge)),A(this,"onChanged",this._onChangedEmitter.event)}applyEdits(t,n){if(n=n.flatMap(r=>Wx(this,r)),n.length){const r=Xo(n,this);this._eventQueue&&this._eventQueue.push({source:t,changes:r}),this.change(t,n),this._eventQueue||this._onChangedEmitter.fire({source:t,changes:r})}}change(t,n){this._text=Hx(this._text,n)}beginUpdate(){this._lockCounter++===0&&(this._eventQueue=[])}endUpdate(t){const n=this._eventQueue;if(--this._lockCounter===0&&n&&(this._eventQueue=void 0,n.length)){t===void 0&&(t=n[0].source);let r=null;for(const{changes:o}of n)r=Lt(r,o);if(r=r?.filter(o=>o.oldPosition!==o.newPosition||o.newText!==o.oldText),r?.length)return this._onChangedEmitter.fire({source:t,changes:r}),!0}return!1}clone(){return new uN(this._text)}};function Wv(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function Rl(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",o=!1;for(let i=t;i<e.length;i++){const s=e[i];if(o){o=!1;continue}if(s==="\\"){o=!0;continue}if(r){s===r&&(r="");continue}if(s==='"'||s==="'"){r=s;continue}if(s==="("){n++;continue}if(s===")"&&(n--,n<0))return!1}return n===0}function zM(e){return(t,n,r)=>Rl(t)?e(t,n,r):!1}function UM(e){return t=>Rl(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function jM(e){return(t,n,r)=>Rl(t)?Wv(t)?e(t,n,r):t:!1}function VM(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return Rl(n)?Wv(n)?e(t):t:!1}}function GM(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function Nf(e,t){const n=e.length;for(let r=0;r<n;r++){const o=e.charCodeAt(r);if(o===0||t==='"'&&o===34||t==="'"&&o===39||t===""&&(o===32||o===9||o===10||o===13||o===12||o===34||o===39||o===60||o===62||o===61||o===96))return!1}return!0}function XM(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let o="";for(let i=0;i<e;i++){const s=r[i]%62;o+=t.charAt(s)}return o}var KM=8,YM=class{constructor(){A(this,"_byKey",Object.create(null)),A(this,"_byValue",Object.create(null))}getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=XM(KM),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},Ml=new YM;function qv(e,t){return t!==void 0&&!Nf(e,t)?`%|{${Ml.getOrCreateByKey(e)}}|%`:e}function ZM(e){const t=Ml.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function Ze(e,t,n){return t!==void 0?Nf(e,t)?e:`%|{${Ml.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function QM(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function Ue(e){return e.startsWith("<!--")&&e.endsWith("-->")?QM(e.slice(4,-3)):e}function JM(e){const t=/^(IF|ELSE|ELSIF|ELSEIF|END|FOREACH|WHILE|NEXT|LAST|BREAK|DO|UNLESS|CONTINUE|SET|UNSET|DEFINE|INCLUDE)\b/i,n=/\w+\s*\(/;let r=e;const o=e.match(/\[%\s*([^%]*?)\s*%\]/);o&&(r=o[1]);const i=r.trim();return t.test(i)||n.test(i)}function eP(e,t,n){return t!==void 0?Nf(e,t)?e:`%|{${Ml.getOrCreateByKey(e)}}|%`:n||GM(e)||JM(e)?`<!--${e}-->`:e}var lo=zM(Ze),co=UM(Ue),tP=jM(Ze),nP=VM(Ue),rP=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",ZM),e.escape("@{","}",Ze,!0).unescape("<!--@{","}-->",Ue,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",qv,!0),e.escape("{{","}}",qv,!0),e.createSyntax("brace-percent").escape("{%","%}",Ze).unescape("<!--{%","%}-->",Ue),e.createSyntax("brace-hash").escape("{#","#}",Ze).unescape("<!--{#","#}-->",Ue),e.createSyntax("proscript").escape("[%","%]",eP,!0).unescape("<!--[%","%]-->",Ue,!0),e.createSyntax("getresponse").escape("[[IF","]]",Ze).escape("[[if","]]",Ze).escape("[[ELSE]]","",Ze).escape("[[else]]","",Ze).escape("[[ENDIF]]","",Ze).escape("[[endif]]","",Ze).unescape("<!--[[IF","]]-->",Ue).unescape("<!--[[if","]]-->",Ue).unescape("<!--[[ELSE]]","-->",Ue).unescape("<!--[[else]]","-->",Ue).unescape("<!--[[ENDIF]]","-->",Ue).unescape("<!--[[endif]]","-->",Ue),e.createSyntax("expert-sender").escape("<if",">",Ze).escape("</if",">",Ze).escape("<else",">",Ze).escape("</else",">",Ze).escape("<var ",">",Ze,!0).unescape("<!--<if ",">-->",Ue).unescape("<!--</if",">-->",Ue).unescape("<!--<else ",">-->",Ue).unescape("<!--</else",">-->",Ue).unescape("<!--<var",">-->",Ue,!0),e.createSyntax("velocity").escape("#if",")",lo).escape("#elseif",")",lo).escape("#else","",Ze).escape("#foreach",")",lo).escape("#macro",")",lo).escape("#set",")",tP,!0).escape("#parse",")",lo).escape("#include",")",lo).escape("#evaluate",")",lo).escape("#end","",Ze).escape("#break","",Ze).escape("#stop","",Ze).unescape("<!--#macro","-->",co).unescape("<!--#if","-->",co).unescape("<!--#elseif","-->",co).unescape("<!--#else","-->",Ue).unescape("<!--#foreach","-->",co).unescape("<!--#parse","-->",co).unescape("<!--#include","-->",co).unescape("<!--#evaluate","-->",co).unescape("<!--#end","-->",Ue).unescape("<!--#break","-->",Ue).unescape("<!--#stop","-->",Ue).unescape("<!--#set","-->",nP,!0),e.createSyntax("mailchimp").escape("*|","|*",Ze).unescape("<!--*|","|*-->",Ue)},zv="bare",xf=new Map;function oP(e){for(const t of Object.keys(e)){const n=e[t];n&&xf.set(t,n)}}function iP(e){return e?xf.get(e)??zv:zv}function sP(){xf.clear()}function Uv(e,t,n,r){for(let o=t;o<n;o++){const i=e[o];r.insideAttributeValue?r.attributeQuoteChar==='"'||r.attributeQuoteChar==="'"?i===r.attributeQuoteChar&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0):r.unquotedAttr&&/[\s>]/.test(i)&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0,r.unquotedAttr=!1):i==="<"?r.insideTag=!0:i===">"?r.insideTag=!1:r.insideTag&&(i==='"'||i==="'")?(r.insideAttributeValue=!0,r.attributeQuoteChar=i,r.unquotedAttr=!1):r.insideTag&&/\S/.test(i)&&r.attributeQuoteChar===void 0&&e[o-1]==="="&&!['"',"'","`"].includes(i)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function _s(e,t){return e.start<t.end&&t.start<e.end}function jv(e,t,n,r,o=[]){if(n&&(t=t.filter(u=>u.isVariable)),!t.length)return[];const i=t.flatMap(u=>u.match(e).flatMap(d=>!Number.isInteger(d.start)||!Number.isInteger(d.end)||d.start<0||d.end>e.length||d.start>=d.end?[]:[{range:d,mapFn:u.mapFn,overrideBuiltins:u.overrideBuiltins,syntax:u.syntax,isVariable:u.isVariable}])).sort((u,d)=>u.range.start-d.range.start||u.range.end-d.range.end),s=[],a=o.slice().sort((u,d)=>u.start-d.start),l={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let c=0;for(const{range:u,mapFn:d,overrideBuiltins:f,syntax:h,isVariable:m}of i){if(r?(l.insideAttributeValue=!0,l.attributeQuoteChar='"'):Uv(e,c,u.start,l),c=u.end,a.some(L=>_s(L,u)))continue;const p=l.insideAttributeValue?l.attributeQuoteChar??"":void 0,S=e.substring(u.start,u.end),C=d(S,p,l.insideTag);C!==!1&&C!==S&&(s.push({range:u,text:C,overrideBuiltins:f,syntax:h,isVariable:m}),a.push(u))}return s.sort((u,d)=>u.range.start-d.range.start||u.range.end-d.range.end)}function aP(e,t){const n=t.reduce((a,{mapFn:l,start:c,end:u,syntax:d,isVariable:f})=>(a[c]||(a[c]=[]),a[c].push({value:u,mapFn:l,syntax:d,isVariable:f}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),o=new RegExp(r,"g"),i=[];let s;for(;(s=o.exec(e))!==null;){const a=s[0];i.push({start:s.index,startToken:a,endTokens:n[a]})}return i}function Of(e,t,n,r,o=!1){const i=[];if(n&&(t=t.filter(c=>c.isVariable)),!t.length)return i;const s=aP(e,t),a={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let l=0;for(let c=0;c<s.length;c++){const{start:u,startToken:d,endTokens:f}=s[c];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):Uv(e,l,u,a),l=u;const h=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let m=!1;for(const{mapFn:p,value:S,syntax:C,isVariable:L}of f){let k=u+d.length,y=e.indexOf(S,k);for(;y!==-1;){let g=y,v=u+d.length,w=0;for(;g!==-1;){const x=e.indexOf(d,v);if(x!==-1&&x<g)w++,v=x+d.length,g=e.indexOf(S,v);else if(w>0)w--,v=g+S.length,g=e.indexOf(S,v);else break}if(g<0)break;const b=g+S.length,E=e.substring(u,b),_=p(E,h,a.insideTag);if(_===!1){k=y+Math.max(S.length,1),y=e.indexOf(S,k);continue}(o||_!==E)&&i.push({range:{start:u,end:b},text:o?E:_,syntax:C,isVariable:L});const T=s.findIndex(({start:x})=>x>=b);T>c?c=T-1:c=s.length,m=!0;break}if(m)break}}return i}function Pl(e,t){if(!t.length)return e;const n=t.slice().sort((o,i)=>i.range.start-o.range.start);let r=e;for(const{text:o,range:i}of n)r=r.slice(0,i.start)+o+r.slice(i.end);return r}var Vv=class{constructor(e=rP){A(this,"_disposables",[]),A(this,"_escapes",[]),A(this,"_unescapes",[]),A(this,"_escapeMatchers",[]),A(this,"_unescapeMatchers",[]);const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,o,i,s){return t.push({start:r,end:o,mapFn:i,isVariable:s,syntax:this.syntax||r}),this},unescape(r,o,i,s){return n.push({start:r,end:o,mapFn:i,isVariable:s,syntax:this.syntax||r}),this}})}registerMatcherPair(e){const t=e.syntax||"matcher",n={syntax:t,match:e.escape.match,mapFn:e.escape.mapFn,isVariable:e.escape.isVariable,overrideBuiltins:e.escape.overrideBuiltins},r={syntax:t,match:e.unescape.match,mapFn:e.unescape.mapFn,isVariable:e.unescape.isVariable,overrideBuiltins:e.unescape.overrideBuiltins};this._escapeMatchers.push(n),this._unescapeMatchers.push(r);let o=!1;const i={dispose:()=>{o||(o=!0,this._escapeMatchers=this._escapeMatchers.filter(s=>s!==n),this._unescapeMatchers=this._unescapeMatchers.filter(s=>s!==r))}};return this.addDisposable(i),i}_collectMappings(e,t,n){const r=Of(e,this._escapes,t,n),o=jv(e,this._escapeMatchers,t,n),i=o.filter(l=>l.overrideBuiltins).map(l=>l.range),s=r.filter(l=>!i.some(c=>_s(c,l.range))),a=o.filter(l=>l.overrideBuiltins||!s.some(c=>_s(l.range,c.range)));return[...s,...a].sort((l,c)=>l.range.start-c.range.start||l.range.end-c.range.end)}getMappings(e,t,n){return this._collectMappings(e,t,n)}_collectRevertMappings(e,t){const n=Of(e,this._unescapes,t),r=jv(e,this._unescapeMatchers,t,!1),o=r.filter(a=>a.overrideBuiltins).map(a=>a.range),i=n.filter(a=>!o.some(l=>_s(l,a.range))),s=r.filter(a=>a.overrideBuiltins||!i.some(l=>_s(a.range,l.range)));return[...i,...s].sort((a,l)=>a.range.start-l.range.start||a.range.end-l.range.end)}getRevertMappings(e,t,n){const r=n?o=>o!==void 0&&n.has(o):o=>iP(o)==="html-comment";return this._collectRevertMappings(e,t).filter(o=>o.isVariable||!r(o.syntax))}getDetectedMappings(e,t,n){return Of(e,this._escapes,t,n,!0)}getEscapedText(e,t){return Pl(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return Pl(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=i=>i===void 0?void 0:t[i],r=Object.values(t);let o=e;return r.includes("bare")&&(o=Pl(o,this._collectRevertMappings(o).filter(i=>n(i.syntax)==="bare"))),r.includes("html-comment")&&(o=Pl(o,this._collectMappings(o).filter(i=>!i.isVariable&&n(i.syntax)==="html-comment"&&i.text.startsWith("<!--")&&i.text.endsWith("-->")))),o}hasDetectedMappings(e,t,n){return this.getDetectedMappings(e,t,n).length>0}addDisposable(e){this._disposables.push(e)}dispose(){for(const e of this._disposables)e.dispose()}},lP=1e4,Gv=3,cP=hx+Yd;function uP(e){return(e??[]).reduce((t,n)=>t+n.oldLength,0)}function dP(e,t){return e.stack.closesStep()?!1:e.undoStop===t.undoStop||e.serviceRemoval+t.serviceRemoval<=200}var fP=class extends Ol{constructor(){super(),A(this,"_editStack",new Lf),A(this,"_frozenStack",new Lf),A(this,"_frozenUndoStop",!0),A(this,"_barrierSends",[]),A(this,"_barrierResolves",[]),A(this,"_queuedBarriers",[]),A(this,"_editLog",[]),A(this,"_entityId",void 0),A(this,"_versionController",this.addDisposable(new WM)),A(this,"_beforeSaveEmitter",this.addDisposable(new tx)),A(this,"_onReadyEmitter",this.addDisposable(new ge)),A(this,"_onEntitySetEmitter",this.addDisposable(new ge)),A(this,"_onPendingSentEmitter",this.addDisposable(new ge)),A(this,"_onHistoryAnswerEmitter",this.addDisposable(new ge)),A(this,"_onHistoryActionEmitter",this.addDisposable(new ge)),A(this,"_onHistoryActionSentEmitter",this.addDisposable(new ge)),A(this,"_onHistoryActionAnsweredEmitter",this.addDisposable(new ge)),A(this,"_canvasEdits",0),A(this,"_nextActionId",1),A(this,"_historyAction",null),A(this,"_cache",new Ol),A(this,"beforeSave",this._beforeSaveEmitter.event),A(this,"_reverting",!1),A(this,"_inited",!1),A(this,"_nextChangeId",1),A(this,"_originId",`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`),A(this,"_rev",null),A(this,"_sealed",[]),A(this,"_saveHeld",!1),A(this,"_releasing",!1),A(this,"_applyingRemote",!1),A(this,"collectCanvasEdits",()=>Promise.resolve()),A(this,"_echoLost",!1),A(this,"_reportedText",null),A(this,"_reportId",0),A(this,"_lostChangeIds",new Set),A(this,"_recoveryTimer",void 0),A(this,"_recoveryOverdue",!1),A(this,"_coveredRev",null),A(this,"_awaitingRefill",!1),A(this,"_resyncing",!1),A(this,"_onEchoLostEmitter",this.addDisposable(new ge)),A(this,"_onEchoRecoveredEmitter",this.addDisposable(new ge)),A(this,"_echoWatchdog",this.addDisposable(new HM({isAwaiting:e=>this._versionController.isInFlight(e)||this._versionController.isRevertedAwaiting(e),onGiveUp:(e,t)=>this._onEchoLost(e,t)}))),A(this,"_handleUpdateEntity",e=>{const{edits:t,guid:n,changeId:r,rev:o}=e;if(e.resync&&n===this._entityId){const{reportId:i,textFingerprint:s}=e.resync,a=this._awaitingRefill?null:this._reportedText;return a!==null&&i===this._reportId?this._applyResync(e,s,a):void 0}if(this._versionController.wasEchoed(r)||this._isCovered(e)){e.historyAnswer?.actionId!==void 0&&n===this._entityId&&this._takeHistoryAnswer({actionId:e.historyAnswer.actionId});return}if(n===this._entityId){this._reportSyncDrift("update-entity");const i=this._onRemoteChange(t,r,o);return e.historyAnswer&&this._takeHistoryAnswer(e.historyAnswer),i}}),A(this,"_handleSetEntity",e=>{this._reportSyncDrift("set-entity"),sP(),oP(e.templateDirectivesPolicy??{});const t=e.guid===this._entityId,n=this._unsentLayers().some(r=>r.hasChanges());this._entityId=e.guid,this._onEntitySetEmitter.fire(e.guid),this._historyAction=null,this._editStack.clear(),this._sealed=[],this._releasing=!1,this._clearFrozen(),this._finishBarrier(t&&!this._holdsUnsent()&&!n),this._versionController.clear(),this._saveHeld=!1,this._awaitingRefill=!1,this._clearEchoLost(),this._onPendingSentEmitter.fire(),this._replaceText(e.html),this._rev=e.rev??null,this._coveredRev=this._rev,this._onReadyEmitter.fire()}),A(this,"_onRemoteChange",(e,t,n)=>t===void 0&&this._echoLost&&e.every(r=>!r.length)?this._whenNoneDispatched():new Promise((r,o)=>{const i=this._applyGroupsToCache(e),s=i.reduce((c,u)=>Lt(c,u),[]);this._rev=n??null;const a=this._versionController.revertedAwaitingIds();this._versionController.apply(s,t,n!==void 0&&!this._echoLost,i);const l=[...this._lostChangeIds].filter(c=>a.has(c)&&this._versionController.isRevertedAwaiting(c)&&this.hasChanges());!this._versionController.hasDispatched()&&!this._awaitingRefill&&!l.length&&(this._versionController.forgetReverted(this._lostChangeIds),this._clearEchoLost(),this._flushPendingSave()),this._whenNoneDispatched().then(r)})),A(this,"onReady",this._onReadyEmitter.event),A(this,"onEntitySet",this._onEntitySetEmitter.event),A(this,"onHistoryAnswer",this._onHistoryAnswerEmitter.event),A(this,"onHistoryAction",this._onHistoryActionEmitter.event),A(this,"onHistoryActionSent",this._onHistoryActionSentEmitter.event),A(this,"onHistoryActionAnswered",this._onHistoryActionAnsweredEmitter.event),this.addDisposable(U.addListenerAsync(ue.SANDBOX_SET_ENTITY,this._handleSetEntity)),this.addDisposable(U.addListenerAsync(ue.SANDBOX_UPDATE_ENTITY,this._handleUpdateEntity)),this.addDisposable(U.addListenerAsync(ue.SANDBOX_CANVAS_SYNCED,e=>this.whenSynced(e?.applied))),this._versionController.onApply(this._onApply.bind(this)),this.addDisposable({dispose:()=>clearTimeout(this._recoveryTimer)})}loadState(e){this._entityId=e.entityId;const t=[[{range:ps(this._cache),text:e.text}]];this._onRemoteChange(t)}get entityId(){return this._entityId}saveState(){return{entityId:this._entityId,text:this.getText()}}_onApply(e){const t=this._unsentLayers();if(t.every(i=>!i.hasChanges())){super.applyEdits(ir,so(e));return}let n=e;const r=[];let o=-1;for(const[i,s]of t.entries()){const a=s.get();if(!a){r.push(null);continue}const l=vl(a,n,"after"),c=l&&vl(n,a,"before");if(!l||!c){o=i;break}r.push(l),n=c}if(o>=0){this._dropLayersFrom(o,t,n),t.slice(0,o).forEach((i,s)=>{const a=r[s];a&&i.replace(a)}),this._compactSealed();return}try{this._applyingRemote=!0,super.applyEdits(ir,so(n))}finally{this._applyingRemote=!1}t.forEach((i,s)=>{const a=r[s];a&&i.replace(a)}),this._compactSealed()}_dropLayersFrom(e,t,n){const r=t.slice(e).reduce((a,l)=>Lt(a,l.get()??[]),[]),o=[],i=[],s=Math.max(e-1,0);this._sealed.splice(Math.max(e-1-this._queuedBarriers.length,0));for(const a of this._queuedBarriers.splice(s))o.push(...a.sends),i.push(...a.resolves);e===0&&(this._frozenStack.clear(),o.unshift(...this._barrierSends.splice(0)),i.unshift(...this._barrierResolves.splice(0))),this._editStack.clear(),this._setSaveHeld(this._saveHeld&&this._sealed.length>0),super.applyEdits(ir,so(Lt(In(r),n))),this._runBarrier(o,i,!1)}_unsentLayers(){return[this._frozenStack,...this._queuedBarriers.map(e=>e.stack),...this._sealed.map(e=>e.stack),this._editStack]}_unsentChanges(){return this._unsentLayers().reduce((e,t)=>Lt(e,t.get()??[]),[])}_textWithoutUnsent(){return Rx(this.getText(),In(this._unsentChanges()))}isApplyingRemote(){return this._applyingRemote}_flushPendingSave(){this._versionController.hasRevertedAwaiting()||(this._releaseBarrier(),this._sealed.length&&(this._sendSealed(),this._onPendingSentEmitter.fire()))}_setSaveHeld(e){const t=this._saveHeld&&!e;this._saveHeld=e,t&&this._onPendingSentEmitter.fire()}_isSent(e=!1){return!this._frozenStack.hasChanges()&&(!this._sealed.length||e&&this._saveHeld)}_seal(e){if(this._editStack.hasChanges()){const t=e?0:uP(this._editStack.get()),n=new Lf;n.takeFrom(this._editStack),this._sealed.push({stack:n,undoStop:e,serviceRemoval:t})}this._compactSealed()}_compactSealed(){const e=this._sealed.length>0,t=[];for(const n of this._sealed){const r=t[t.length-1];if(n.stack.hasChanges()){if(!r||!dP(r,n)){t.push(n);continue}r.stack.absorb(n.stack),r.undoStop||(r.undoStop=n.undoStop),r.serviceRemoval+=n.serviceRemoval,r.stack.hasChanges()||t.pop()}}this._sealed=t,e&&!t.length&&(this._releasing=!1,this._saveHeld=!1,this._onPendingSentEmitter.fire())}_sendSealed(e=!1,t=!1){if(this._compactSealed(),this._rev!==null&&(this._awaitsEcho()||this._frozenStack.hasChanges()||this._holdsUnsent()))return!0;const n=e||this._sealed.some(o=>o.undoStop);if(!t&&!this._releasing&&this._beforeSaveEmitter.fire(n)===!1)return this._setSaveHeld(this._sealed.length>0),!1;const r=this._entityId;if(!r)return!1;for(;this._sealed.length;){const[o]=this._sealed.splice(0,1),i=o?.stack.get()?.flatMap(s=>vy(s));if(o&&i?.length&&(this._dispatch(r,i,o.undoStop,o.stack.typedAt(),o.stack.selection(),o.stack.closesStep()),this._rev!==null))break}return this._compactSealed(),this._setSaveHeld(!1),!0}whenSent(e=!1){return this._isSent(e)?Promise.resolve():new Promise(t=>{const n=this._onPendingSentEmitter.event(()=>{this._isSent(e)&&(n.dispose(),t())})})}_countUnsent(){const e=this._unsentLayers().reduce((t,n)=>t+(n.get()?.length??0),0);return this._versionController.countDispatched()+e}_onEchoLost(e,t){if(this._lostChangeIds.add(e),this._echoLost)return;this._echoLost=!0,this._armRecoveryDeadline();const n=this._countUnsent(),r=this._textWithoutUnsent(),o=++this._reportId;this._reportedText=r,Nr("echo-timeout",()=>({guid:this._entityId,at:"update-entity",unsent:n,textFingerprint:ly(r),canvasText:r,reportId:o,dropsCovered:!0,originId:this._originId})),this._onEchoLostEmitter.fire()}holdsTypedEdits(){return this._frozenStack.hasChanges()}hasEditsAfterBoundary(){return this._editStack.hasChanges()||this._sealed.length>0}markHistoryAction(){const e=this._nextActionId++;return this._historyAction={id:e,edits:this._canvasEdits,answered:!1},this._onHistoryActionEmitter.fire(e),e}noteHistoryActionSent(e){this._onHistoryActionSentEmitter.fire(e)}noteSelection(e,t){const n=this._sealed.length>0&&this._editStack.selection()===null;this._editStack.noteSelection(e,t||n)}_takeHistoryAnswer({actionId:e,selection:t}){const n=this._historyAction,r=e!==void 0,o=r&&n?.id===e?n:void 0;o&&(o.answered=!0);const i=r?o?.edits===this._canvasEdits:!n||n.answered;t&&i&&!this.hasChanges()&&!this._awaitsEcho()&&!this._holdsUnsent()&&this._onHistoryAnswerEmitter.fire({selection:t,own:r}),o&&this._onHistoryActionAnsweredEmitter.fire(o.id)}_holdsUnsent(){return this._echoLost||this._awaitingRefill}async whenSynced(e){const t=new ge;let n=!1;const r=setTimeout(()=>{n=!0,t.fire()},cP),o=e!==void 0&&e.guid!==this._entityId;try{return e&&!o&&this._settleByReceipt(e),await this.collectCanvasEdits(),o?this._syncState():await this._syncedBefore(t,()=>n)}finally{clearTimeout(r),t.dispose(),this._releasing=!1}}async _syncedBefore(e,t){const n=()=>({synced:!1,unsent:this._countUnsent()});let r=0;if(t())return this._syncState();for(;;){if(this._echoLost){if(!await this._awaitEchoRecovery(e)||t())return n();continue}if(this._saveHeld&&r++<Gv&&(this._releasing=!0,this._sendSealed(!0,!0)),await this._awaitAny([this._onEchoLostEmitter.event,e.event],this.whenSent(!this._releasing)),t())return n();if(!this._echoLost&&!(this._sealed.length>0&&!this._saveHeld)){if(this._saveHeld){if(r<Gv)continue;return n()}if(!this._versionController.hasDispatched())return{synced:!0,unsent:0};if(await this._awaitAny([this._versionController.onEmpty,this._onEchoLostEmitter.event,e.event]),t())return n()}}}_syncState(){return this._hasUnsynced()?{synced:!1,unsent:this._countUnsent()}:{synced:!0,unsent:0}}_settleByReceipt(e){const t=e.originId===void 0||e.originId===this._originId?e.changeId:0;for(const n of this._versionController.awaitingIds())n<=t?this._echoWatchdog.giveUpNow(n):this._echoWatchdog.resendNow(n)}_hasUnsynced(){return this._holdsUnsent()||this._sealed.length>0||this._frozenStack.hasChanges()||this._versionController.hasDispatched()}_awaitAny(e,t){return new Promise(n=>{const r=()=>{o.forEach(i=>i.dispose()),n()},o=e.map(i=>i(r));t?.then(r)})}_awaitEchoRecovery(e){return new Promise(t=>{const n=setTimeout(()=>i(!1),Yd),r=this._onEchoRecoveredEmitter.event(()=>i(!0)),o=e.event(()=>i(!1)),i=s=>{clearTimeout(n),r.dispose(),o.dispose(),t(s)}})}_armRecoveryDeadline(){clearTimeout(this._recoveryTimer),this._recoveryTimer=setTimeout(()=>{this._recoveryOverdue=!0,this._finishBarrier(!1)},Yd)}_connectionLost(){return this._recoveryOverdue||this._awaitingRefill}_clearEchoLost(){const e=this._echoLost;clearTimeout(this._recoveryTimer),this._recoveryOverdue=!1,this._echoLost=!1,this._reportedText=null,this._lostChangeIds.clear(),e&&this._onEchoRecoveredEmitter.fire()}_isCovered({guid:e,rev:t,changeId:n}){return this._coveredRev===null||t===void 0||e!==this._entityId||t>this._coveredRev?!1:!(n!==void 0&&(this._versionController.isInFlight(n)||this._versionController.isRevertedAwaiting(n)))}_applyResync({edits:e,rev:t},n,r){this._versionController.clear();try{this._resyncing=!0,this._cache.applyEdits(ir,[{range:ps(this._cache),text:r}]),this._rev=t??null,this._applyToCache(e),this._versionController.apply(this._changesToCache())}catch{}finally{this._resyncing=!1}const o=ly(this._cache.getText());if(o.length!==n.length||o.hash!==n.hash){this._awaitingRefill=!0,this._finishBarrier(!1),Nr("resync-failed",()=>({guid:this._entityId,textFingerprint:o}));return}this._coveredRev=this._rev,this._clearEchoLost(),this._flushPendingSave(),this._onReadyEmitter.fire()}_replaceText(e){this._cache.applyEdits(ir,[{range:ps(this._cache),text:e}]),super.applyEdits(ir,[{range:ps(this),text:e}])}_reportSyncDrift(e){if(this.hasChanges()||this._versionController.hasDispatched())return;const t=FM(this.getText(),this._cache.getText());if(t){const{offset:n,ownLength:r,cachedLength:o}=t;Nr("host-copy-drift",()=>({at:e,text:{offset:n,ownLength:r,cachedLength:o}}))}}_changesToCache(){const e=this._textWithoutUnsent(),t=this._cache.getText(),n=ay(e,t);if(!n)return[];const{start:r,fromEnd:o,toEnd:i}=n;return[new Gt(r,e.slice(r,o),r,t.slice(r,i))]}_applyToCache(e){return this._applyGroupsToCache(e).reduce((t,n)=>Lt(t,n),[])}_applyGroupsToCache(e){const t=[];for(const n of e){const r=n.reverse();t.push(Xo(r,this._cache)),this._cache.applyEdits(ir,r)}return t}_whenNoneDispatched(){return new Promise(e=>{if(!this._versionController.hasDispatched()){this._onReadyEmitter.fire(),e();return}const t=this._versionController.onEmpty(()=>{t.dispose(),e()})})}applyEdits(e,t){if(!this._reverting){const n=Xo(t,this);n.length&&this._canvasEdits++,this._editStack.add(n),super.applyEdits(e,t),this._editLog.push(t)}}correctOffset(e,t){const n=this._unsentLayers();return t?n.reduce((r,o)=>o.correctOffset(r,!0),e):n.reduceRight((r,o)=>o.correctOffset(r),e)}correctRange(e,t){return{start:this.correctOffset(e.start,t),end:this.correctOffset(e.end,t)}}_awaitsEcho(){return this._versionController.hasDispatched()||this._versionController.hasRevertedAwaiting()}saveChanges(e=!0,t=!1){return this._reverting?!1:(this._seal(e),this._sendSealed(e,t))}closeStep(){this._editStack.closeStep()}_dispatch(e,t,n,r,o=null,i=!1){const s=this._nextChangeId++;this._versionController.append(t,s);const a={guid:e,pushUndoStop:n,edits:so(t),changeId:s,originId:this._originId,...this._rev!==null?{baseRev:this._rev}:{},...r?{typedAt:r}:{},...o?{selection:o}:{},...i?{closesStep:i}:{}},l=()=>U.send(ue.APPLICATION_UPDATE_ENTITY,a);l(),this._echoWatchdog.watch(s,()=>{this._versionController.isInFlight(s)&&l()})}async sendAfterCurrentEdits(e,t=!1){if(this._connectionLost()&&this.hasChanges())return!1;this._seal(t);const n=this._frozenStack.hasChanges();if(!n&&!this._sealed.length)return e(),!0;const r=this._rev!==null&&(this._awaitsEcho()||this._holdsUnsent());return!n&&!r&&(this._sendSealed(),!this._sealed.length||this._saveHeld)?(e(),!0):new Promise(o=>this._freezeSealed(e,o))}_freezeSealed(e,t){this._compactSealed();for(const{stack:r,undoStop:o}of this._sealed.splice(0))this._frozenStack.hasChanges()||this._queuedBarriers.length?this._queuedBarriers.push({stack:r,undoStop:o,sends:[],resolves:[]}):(this._frozenStack.takeFrom(r),this._frozenUndoStop=o);this._setSaveHeld(!1);const n=this._queuedBarriers[this._queuedBarriers.length-1];(n?.sends??this._barrierSends).push(e),(n?.resolves??this._barrierResolves).push(t)}_releaseBarrier(){const e=this._frozenStack.get();if(!e)return;const t=this._frozenStack.typedAt(),n=this._frozenStack.selection(),r=this._frozenStack.closesStep();this._frozenStack.clear(),this._entityId&&this._dispatch(this._entityId,e.flatMap(a=>vy(a)),this._frozenUndoStop,t,n,r);const o=this._barrierSends,i=this._barrierResolves,s=this._queuedBarriers.shift();this._barrierSends=s?.sends??[],this._barrierResolves=s?.resolves??[],s&&(this._frozenStack.takeFrom(s.stack),this._frozenUndoStop=s.undoStop),this._runBarrier(o,i,!0)}_clearFrozen(){this._frozenStack.clear();for(const e of this._queuedBarriers.splice(0))this._barrierSends.push(...e.sends),this._barrierResolves.push(...e.resolves)}_finishBarrier(e){const t=this._barrierSends,n=this._barrierResolves;this._barrierSends=[],this._barrierResolves=[];for(const r of this._queuedBarriers)t.push(...r.sends.splice(0)),n.push(...r.resolves.splice(0));this._runBarrier(t,n,e)}_runBarrier(e,t,n){n&&e.forEach(r=>r()),t.forEach(r=>r(n)),this._onPendingSentEmitter.fire()}saveChangesAsync(e=!0){return new Promise(t=>{if(this.saveChanges(e),this._entityId||!this.hasChanges()||this._saveHeld){t();return}const n=setTimeout(()=>{r.dispose(),this._reportSaveTimeout(),t()},lP),r=this.onReady(()=>{r.dispose(),clearTimeout(n),t()})})}_reportSaveTimeout(){Nr("save-timeout",()=>({}))}hasChanges(){return this._editStack.hasChanges()||this._frozenStack.hasChanges()||this._sealed.length>0}},mP=class extends Vv{constructor(e,t){super(),A(this,"_baseDocument",void 0),A(this,"_mappedDocument",void 0),A(this,"_mappings",[]),A(this,"_cachedMappedDocument",new Ol),this._baseDocument=e,this._mappedDocument=t,this._baseDocument.onChanged(this._onBaseChange.bind(this),Number.MAX_SAFE_INTEGER),this._mappedDocument.onChanged(this._onMappedChange.bind(this),Number.MAX_SAFE_INTEGER)}_onBaseChange({source:e,changes:t}){if(e==="FROM_REMOTE"){const n=this._baseDocument.getText(),r=Xo(this.getMappings(n),this._baseDocument),o=In(this._mappings);if(t=Lt(o,t),t=Lt(t,r),this._mappings=r,t.length){const i=so(t);this._mappedDocument.applyEdits(e,El(i))}}}correctOffset(e,t){const n=t?this._mappings:In(this._mappings),r=xd(n,({oldPosition:i})=>i>=e),o=r>0?n[r-1]:void 0;return o&&(o.oldEnd>e?e+=o.newPosition-o.oldPosition:e+=o.newEnd-o.oldEnd),e}correctRange(e,t){return{start:this.correctOffset(e.start,t),end:this.correctOffset(e.end,t)}}getMappedReplacementRangeAtPosition(e){const t=In(this._mappings).find(({oldPosition:n,oldEnd:r})=>e>=n&&e<r);return t?{start:t.oldPosition,end:t.oldEnd}:null}hasMappedReplacementRangeInRange(e){return In(this._mappings).some(({oldPosition:t,oldEnd:n})=>t<e.end&&n>e.start)}isMappedElementInPosition(e){return!!this._mappings.find(t=>t.newPosition<e&&t.newEnd>e)}escape(e,t){const n=this.getMappings(e,!1,t);return gs(e,n)}unescape(e){const t=this.getRevertMappings(e);return gs(e,t)}registerMatcherPair(e){const t=super.registerMatcherPair(e);this.rebuildFromBase();let n=!1;return{dispose:()=>{n||(n=!0,t.dispose(),this.rebuildFromBase())}}}rebuildFromBase(e=ir){const t=this._baseDocument.getText(),n=this.getMappings(t),r=gs(t,n);this._mappings=Xo(n,this._baseDocument),this._mappedDocument.getText()!==r&&this._mappedDocument.applyEdits(e,[{range:{start:0,end:this._mappedDocument.getLength()},text:r}])}_onMappedChange({source:e,changes:t}){if(e!=="FROM_REMOTE"){const n=this._mappedDocument.getText(),r=Xo(this.getRevertMappings(n),this._mappedDocument),o=this._mappings;if(t=Lt(o,t),t=Lt(t,r),this._mappings=In(r),t.length){const i=so(t);this._baseDocument.applyEdits(e,El(i))}}}},hP="input, textarea, select, .monaco-editor",Xv='[contenteditable="true"], editor',pP=/^(Arrow(Left|Right|Up|Down)|Home|End|PageUp|PageDown|Tab)$/;function Kv(e,t){return e?.node===t?.node&&e?.offset===t?.offset}function gP(e,t){return Kv(e?.anchor,t?.anchor)&&Kv(e?.focus,t?.focus)}function Il(){const e=document.getSelection();if(!(!e?.rangeCount||!e.anchorNode||!e.focusNode))return{anchor:{node:e.anchorNode,offset:e.anchorOffset},focus:{node:e.focusNode,offset:e.focusOffset}}}var bP=class extends Ee{constructor(e,t,n){super(),A(this,"_htmlDocument",void 0),A(this,"_mapping",void 0),A(this,"_remoteDocument",void 0),A(this,"_mark",void 0),A(this,"_pending",void 0),A(this,"_actionMark",void 0),A(this,"_moved",!1),this._htmlDocument=e,this._mapping=t,this._remoteDocument=n,this._listen(window,"keydown",!0),this._listen(window,"beforeinput",!0),this._listen(document,"selectionchange",!1,()=>{this._moved||(this._moved=!gP(this._mark,this._actionMark))}),this._listen(window,"pointerdown",!0,()=>{this._moved=!0}),this._listen(window,"keydown",!1,r=>{this._moved||(this._moved=!r.defaultPrevented&&pP.test(r.key??""))}),this.addDisposable(e.beforeTextCommit(()=>this._beforeCommit())),this.addDisposable(e.onTextCommit(()=>this._afterCommit())),this.addDisposable(n.onHistoryAnswer(r=>this._restore(r))),this.addDisposable(n.onHistoryAction(()=>{this._actionMark=Il(),this._moved=!1}))}_listen(e,t,n,r){const o=i=>{this._mark=Il(),r?.(i)};e.addEventListener(t,o,n),this.addDispose(()=>e.removeEventListener(t,o,n))}_beforeCommit(){this._pending={before:this._toText(this._mark),opened:!this._remoteDocument.hasEditsAfterBoundary()}}_afterCommit(){const e=this._pending;if(this._pending=void 0,this._mark=Il(),e){const t={before:e.before,after:this._toText(this._mark)};this._remoteDocument.noteSelection(t,e.opened)}}_toText(e){const t=e&&this._htmlDocument.pointToOffset(e.anchor),n=e&&this._htmlDocument.pointToOffset(e.focus);if(t===void 0||n===void 0)return;const[r,o]=[this._mapping.correctOffset(t),this._mapping.correctOffset(n)].sort((i,s)=>i-s);return{start:r,end:o}}_toPoint(e){return this._htmlDocument.offsetToPoint(this._mapping.correctOffset(this._remoteDocument.correctOffset(e,!0),!0))}_prepareEditorFor(e,t){const n=document.activeElement?.closest(Xv);if(!n||n.contains(e.node)&&n.contains(t.node))return!0;const r=e.node.nodeType===Node.TEXT_NODE?e.node.parentElement:null,o=r?.ownerDocument.defaultView;if(!r?.contains(t.node)||!o)return!1;r.dispatchEvent(new o.MouseEvent("mouseover",{bubbles:!0}));const i=e.node.parentElement?.closest(Xv);return i?.contains(t.node)?(i.focus(),document.activeElement===i):!1}_restore({selection:e,own:t}){if(t&&this._moved||!t&&!document.hasFocus()||document.activeElement?.closest(hP))return;const n=this._toPoint(e.start),r=e.end===e.start?n:this._toPoint(e.end);!n||!r||!this._prepareEditorFor(n,r)||(document.getSelection()?.setBaseAndExtent(n.node,n.offset,r.node,r.offset),this._mark=Il())}};function yP(e){let t=e.documentElement;return t||(t=e.createElement("html"),e.appendChild(t)),t}function Cs(e){let t=e.head;if(!t){t=e.createElement("head");const n=yP(e);n.insertBefore(t,n.firstChild)}return t}function vP(e){const t=Object.create(null),n=e.getAttributeNames();for(const r of n)t[r]=e.getAttribute(r);return t}function EP(e){for(const t of document.querySelectorAll("iframe"))if(t.contentDocument===e.ownerDocument)return t}function SP(e){const t=Cs(e);if(!e.querySelector("style[amp4email-boilerplate]")){const n=e.createElement("style");n.setAttribute("amp4email-boilerplate",""),n.innerHTML="body{visibility:hidden}",t.prepend(n)}}var Yv="amp-custom";function wP(e,t){return`em-${e.replaceAll("-","_")}-${t.toLowerCase()}`}function Zv(e,t,n){for(const r of t)if(Es.isStyleRule(r)){const o=r.selectorText.split(/\+>~/).flatMap(i=>i.trim().split(" "));if(o.length===1&&o[0].trim().startsWith(".em-")){for(const i of r.style)if(r.style.getPropertyPriority(i)==="important"){for(const s of e.querySelectorAll(r.selectorText))if(ff(s)){const a=s.style;for(const l of[...a])if(l.startsWith(i)){const c=n(l,a.getPropertyValue(l)),u=s.getAttribute("class");s.setAttribute("class",u?`${c} ${u}`:c),a.removeProperty(l)}}}}}else Es.isMediaRule(r)&&Zv(e,r.cssRules,n)}function Qv(e,t){const n=t.sheet;if(n){const i=new Set;Zv(e,n.cssRules,(s,a)=>{const l=wP(s,a),c=[...n.cssRules],u=`.${l} { ${s}: ${a} }`;return!c.find(d=>Es.isStyleRule(d)&&d.selectorText===`.${l}`)&&!i.has(u)&&(i.add(u),t.innerHTML=`
|
|
4
|
+
.${l} { ${s}: ${a} };
|
|
5
|
+
${t.innerHTML}`),l}),i.size&&(t.innerHTML=`
|
|
6
|
+
${[...i].join(`
|
|
7
|
+
`)};
|
|
8
|
+
${t.innerHTML}`)}const r=t.innerHTML,o=r.replace(/!important/g,"");r!==o&&(t.innerHTML=o)}function _P(e){const t=Cs(e),n=e.querySelectorAll('link[rel="stylesheet"]'),r=[...e.querySelectorAll("style")].filter(i=>!i.hasAttribute("amp4email-boilerplate"));if(r.length===1){const i=r[0];if(i.parentElement===t&&i.getAttribute(Yv)===""){Qv(e,i);return}}const o=[];for(const i of r)o.push(i.innerHTML),i.remove();if(o.length){const i=e.createElement("style");i.innerHTML=`
|
|
9
|
+
${o.join("")}
|
|
10
|
+
`,i.setAttribute(Yv,""),t.append(i),Qv(e,i)}for(const i of n)i.remove()}var Rf="<!doctype html>";function CP(e){const t=e.doctype;if(t){if(Hy(t)===Rf)return;const n=new DOMParser().parseFromString(Rf,"text/html").doctype;e.replaceChild(n,t)}else{const n=new DOMParser().parseFromString(Rf,"text/html").doctype;e.insertBefore(n,e.firstChild)}}async function Jv(e,t={}){const n=document.createElement("amp-img"),r=await RO(e)||void 0,o=[];try{let i=e;for(;i&&ff(i);)getComputedStyle(i)?.display==="none"&&(i.style.display="initial",o.push([i,i.style.display])),i=i.parentElement;const s=r?.height?`${parseInt(r.height)}`:"",a=r?.width?`${parseInt(r.width)}`:"",l=EP(e);let c=!1;if(l){const d=l.getAttribute("width");try{let f=a?`${a}px`:"";d||(l.setAttribute("width","720px"),f=getComputedStyle(e).width||""),l.setAttribute("width",!d||parseInt(d)>320?"320px":"720px"),f!==(getComputedStyle(e).width||"")&&(c=!0)}finally{d&&l.setAttribute("width",d||"")}}const u=e.src||e.srcset.split(",")[0];e.style.width==="100%"&&e.style.removeProperty("width"),e.style.maxWidth==="100%"&&e.style.removeProperty("max-width"),t={...vP(e),alt:e.alt,width:a,height:s,src:u,layout:c?"responsive":"fixed",...t};for(const d of Object.keys(t))tr(n,d,t[d])}finally{for(const[i,s]of o)i.style.display=s}return n}async function TP(e,t){const n=[...e.querySelectorAll("img")],r=[];for(const i of n)r.push(Jv(i).then(s=>[i,s],()=>[i,void 0]));const o=[...e.querySelectorAll("picture")];for(const i of o){const s=i.querySelector("img");s?r.push(Jv(s).then(a=>[i,a],()=>[i,void 0])):r.push([i,void 0])}if(r.length){const i=await Promise.all(r);for(const[s,a]of i)a?s.replaceWith(a):s.remove();t?.()}}function AP(e){const t=e.querySelectorAll("meta");for(const o of t){const i=o.getAttribute("charset");if(i){i!=="utf-8"&&o.setAttribute("charset","utf-8");return}}const n=Cs(e),r=e.createElement("meta");r.setAttribute("charset","utf-8"),n.insertBefore(r,n.firstChild)}function kP(e,t,n){const r=n('script:not([type="application/ld+json"])'),o=e.querySelectorAll(r);for(const i of o)!i.getAttribute("src")?.startsWith("https://cdn.ampproject.org/")&&!(i.closest("amp-state")&&i.getAttribute("type")==="application/json")&&i.remove()}var eE="https://cdn.ampproject.org/v0",tE=`${eE}.js`,LP=`script[src='${tE}']`;function NP(e,t){return`${eE}/${e.toLowerCase()}-${t}.js`}async function xP(e,t,n){for(const{name:r,versions:o}of t){const i=n.replaceSelectors(r==="amp-mustache"?`script[async][custom-template='${r}']`:`script[async][custom-element='${r}']`);if(!e.querySelector(i)){const s=Cs(e),a=n.createElementFn("script"),l=NP(r,o.findLast(c=>c!=="latest")||"v0");a.setAttribute("async",""),a.setAttribute(r==="amp-mustache"?"custom-template":"custom-element",r),a.setAttribute("src",l),s.appendChild(a),s.appendChild(e.createTextNode(`
|
|
11
|
+
`))}}}var zoe=(function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"})(),Uoe=function(e,t){return new URL(e,t).href},joe={},Mf=function(t,n,r){let o=Promise.resolve();if(0)var s,a;function i(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return o.then(l=>{for(const c of l||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})},nE=void 0;async function Dl(){return nE||(nE=await Mf(()=>Promise.resolve().then(()=>_d("./rules.CL_BitCE.js")).then(e=>e.default),void 0,{}.url))}var Pf=new Map;async function OP(){if(!Pf.size){const e=await Dl(),t=e.tags;for(let n=0;n<t.length;n++){const r=t[n],{selector:o,attrs:i,attrLists:s}=r,a=s?.flatMap(l=>e.attrLists.filter(({name:c})=>c===l).flatMap(c=>c.attrs))||[];Pf.set(o,{...r,priority:n,attrs:new Map([...i,...a].map(l=>[l.name,l]))})}}return Pf}var If=new Map;async function RP(){if(!If.size){const e=await Dl();for(const t of e.declarations)If.set(t.name,t)}return If}var MP="$GLOBAL_ATTRS",Df=new Map;async function PP(){if(!Df.size){const e=(await Dl()).attrLists.find(t=>t.name===MP)?.attrs;if(e)for(const t of e)Df.set(t.name,t)}return Df}function IP(e){return En(e)&&(e.tagName.startsWith("AMP")||e.tagName==="FORM"||e.tagName==="TEMPLATE"&&e.getAttribute("type")?.toLowerCase()==="amp-mustache")}function rE(e){return NO(e)&&e.src?.startsWith("https://cdn.ampproject.org/v0")}function oE(e,t,n){if(!t)return;function r(){const i=t.compareDocumentPosition(e);if(!(i&8)){if(i&2)return t.insertBefore(e,t.firstChild),!0;if(i&4)return t.appendChild(e),!0}return!1}function o(){const i=[...e.childNodes];for(let s=i.length-1;s>=0;s--)oE(i[s],t,n)}if(En(e))switch(e.tagName.toLowerCase()){case"body":return;case n("script"):case"style":case"meta":case"title":return;case"head":case"html":o();break;default:r()||o()}else mf(e)?o():ao(e)&&(e.textContent?.trim()||e.nextSibling?.textContent?.trim()&&ao(e.nextSibling))&&r()}async function DP(e,t){const n=new Set,r=t.commit,o=h=>t.replaceSelectors(h.toLowerCase());if(t.replaceImages&&await TP(e,r),t.injectExtensions){const h=t.replaceSelectors(LP);if(!e.querySelector(h)){const m=t.createElementFn("script");m.setAttribute("src",tE),m.setAttribute("async",""),Cs(e).appendChild(m),r?.()}}t.injectRequiredTags&&(kP(e,t.createElementFn,o),CP(e),SP(e),AP(e),r?.()),t.replaceStylesAndLinks&&(_P(e),r?.());const i=await Dl(),s=await OP(),a=new Set(t.removeUnsupportedTags?e.querySelectorAll("*"):[]),l=new Map;for(let[h,m]of s)if(!m.deprecation){h=o(h);let p=[...e.querySelectorAll(h)].filter(S=>!l.has(S));m.unique&&p.length&&(p=[p[0]]),t.injectRequiredTags&&m.required&&!p.length&&(p=[...p,t.createElementFn(m.name)]);for(const S of p){if(t.injectRequiredAttributes&&S.getAttribute("on")&&!S.getAttribute("tabindex")&&S.setAttribute("tabindex","0"),t.removeUnsupportedStyles){let L=!1;for(const k of[...S.classList])k.startsWith("i-amphtml")&&(L=!0,S.classList.remove(k));L&&!S.classList.length&&S.removeAttribute("class")}const C=l.get(S);C&&C.priority>m.priority||l.set(S,m)}}r?.();for(const[h,m]of l){if(t.injectExtensions&&m.requiresExtension)for(const C of m.requiresExtension)n.add(C);const p=m.requiredParent?m.requiredParent==="$ROOT"?e:e.querySelector(m.requiredParent):null;p&&(!h.parentNode||t.moveInvalidTagPosition)?p!==h.parentNode&&(m.name==="HEAD"||En(p)&&p.tagName==="HEAD"?p.insertBefore(h,p.firstChild):p.appendChild(h)):h.parentNode||e.body.appendChild(h),t.removeUnsupportedTags&&a.delete(h),r?.();const S=await PP();if(t.removeUnsupportedAttributes||t.injectRequiredAttributes){const C=m.attrs,L=t.injectRequiredAttributes?new Set([...C].map(([y,g])=>g).filter(y=>y.required&&y.value)):void 0,k=h.getAttributeNames();for(const y of k){const g=C.get(y)||S.get(y);if(g){if(y==="id"||y==="class"||y==="style"){L?.delete(g);continue}if(t.removeUnsupportedAttributes){const v=h.getAttribute(y);if(g.value&&g.value.indexOf(v)<0){h.removeAttribute(y);continue}if(g.valueRegex&&!new RegExp(g.valueRegex).test(v)){h.removeAttribute(y);continue}if(g.disallowedValueRegex&&new RegExp(g.disallowedValueRegex).test(v)){h.removeAttribute(y);continue}const w=g.valueUrl;if(w){if(v===""){if(!w.allowEmpty){h.removeAttribute(y);continue}}else if(!(v.indexOf("<!--")>0&&v.indexOf("-->")>0)){if(!w.allowRelative)if(v.startsWith("#")||v.startsWith("/")){h.removeAttribute(y);continue}else{const b=w.protocol.length?w.protocol:["https"],E=v.substring(0,v.indexOf(":"));if(E){if(b.indexOf(E)<0){const _=b[0]+v.substring(v.indexOf(":"));if(URL.canParse(_))tr(h,y,_);else{h.removeAttribute(y);continue}}else if(!URL.canParse(v)){h.removeAttribute(y);continue}}else{const _=b[0]+v;if(URL.canParse(_))tr(h,y,_);else{h.removeAttribute(y);continue}}}}}}L?.delete(g)}else{if(y==="id"||y==="class"||y==="style")continue;t.removeUnsupportedAttributes&&h.removeAttribute(y)}}if(L)for(const y of L)tr(h,y.name,y.value[0])}r?.()}t.moveInvalidTagPosition&&(oE(e,e.body,o),r?.());for(const h of a)h.remove();if(r?.(),t.removeUnsupportedStyles){let p=function(y){const g=y.cssText.replaceAll(/\".*\"/g,"").replaceAll(/\'.*\'/g,"").replaceAll(/\/\*.*\*\/|(-moz-|-ms-|-o-|-webkit-)+\w+(?=:)/g,"").match(/[a-z-]+(?=:[^before|after|hover])/gi)||[];for(const v of g){if(!v)continue;const w=y.getPropertyValue(v);y.getPropertyPriority(v)==="important"&&y.setProperty(v,w);const b=m.get(v);b?b.value?b.value.indexOf(w)<0&&y.removeProperty(v):b.valueRegex&&(new RegExp(b.valueRegex).test(w)||y.removeProperty(v)):y.removeProperty(v)}r?.()},S=function(y){return y.constructor.name==="CSSStyleRule"},C=function(y){return y.constructor.name==="CSSMediaRule"},L=function(y){const g=y.cssRules;for(let v=g.length-1;v>=0;v--){const w=g[v];S(w)?w.selectorText.indexOf("[")>=0||w.selectorText.indexOf(":")>=0?y.deleteRule(v):(p(w.style),w.style.cssText||y.deleteRule(v)):C(w)?(L(w),w.cssRules.length||y.deleteRule(v)):y.deleteRule(v)}};var c=p,u=S,d=C,f=L;const h=e.querySelectorAll("*"),m=await RP();for(const y of h)if(ff(y)){const g=y.getAttribute("style");g&&(p(y.style),y.style.length?y.style.cssText!==g&&y.setAttribute("style",y.style.cssText):y.removeAttribute("style"))}const k=e.querySelector("style[amp-custom]");if(k){const y=k.sheet;y&&(L(y),k.innerHTML=[...y.cssRules].map(g=>g.cssText).join(`
|
|
12
|
+
`)),r?.()}}await xP(e,i.extensions.filter(({name:h})=>n.has(h)),t)}function BP(e,t){return Object.keys(t).reduce((n,r)=>n.replaceAll(r,t[r]),e)}function iE(e,t={}){const{correct:n=!0,injectExtensions:r=!0,mappedTags:o={}}=t;return DP(e,{replaceImages:n,replaceStylesAndLinks:n,injectRequiredTags:n,injectExtensions:r,formsAsAmpForms:r,injectRequiredAttributes:n,moveInvalidTagPosition:n,removeUnsupportedTags:n,removeUnsupportedAttributes:n,removeUnsupportedStyles:n,createElementFn:i=>e.createElement(o[i.toLowerCase()]||i),replaceSelectors:i=>BP(i.toLowerCase(),o),commit:t.commit})}function Bf(){U.send(ue.RELOAD),window.location.reload()}function HP(e){const t=new Ee;let n=[];function r(){n=[...new Set([...n,...document.querySelectorAll("script")])].filter(s=>y2(s)&&e.isInLetter(s));const i=new Set;for(const s of n){const a=(s.src||s.innerHTML).trim();a&&i.add(a)}return i}let o=r();return t.addDisposable(U.addListener(ue.RELOAD,Bf)),t.addDisposable(e.onChange(()=>{let i=r();for(const s of o)i.has(s)||Bf();o=i})),t}var Bl=[];function FP(e){return Bl.push(e),{dispose:()=>{const t=Bl.indexOf(e);t!==-1&&Bl.splice(t,1)}}}function Hf(e){for(const t of Bl){const n=t(e);if(n)return n}return e}function $P(){const e=document.querySelector("[em-edit]");return e?Hf(e):null}var Hl=new Set(["img","image","input","video","source","em-replace"]);function sE(e){const t=e.toLowerCase(),n=Hl.has(t);return Hl.add(t),{dispose:()=>{n||Hl.delete(t)}}}function WP(e){return Hl.has(e.toLowerCase())}var Ts=[];function qP(e){return Ts.push(e),{dispose:()=>{const t=Ts.indexOf(e);t!==-1&&Ts.splice(t,1)}}}function aE(e){return Ts.some(t=>t.isPathElement?.(e))}function zP(e,t){let n;for(const r of Ts){const o=r.caption?.(e,t);o&&(n={...n,...o})}return n}function lE(e){return e.tagName==="TD"&&e===e.closest("amp-accordion")?.querySelector(":scope > section header td")}var UP={isPathElement(e){return e.tagName==="AMP-ACCORDION"||e.tagName==="AMP-CAROUSEL"||lE(e)},caption(e,t){if(e.tagName==="AMP-ACCORDION")return{title:t.ELEMENT_PATH_ACCORDION,className:"em-element-path-item-amp"};if(e.tagName==="AMP-CAROUSEL")return{title:t.ELEMENT_PATH_CAROUSEL,className:"em-element-path-item-amp"};if(lE(e))return{title:t.ELEMENT_PATH_SECTION,className:"em-element-path-item-block"};if(e.tagName==="IMG"&&e.closest("amp-carousel"))return{title:t.ELEMENT_PATH_CAROUSEL}}},jP=class extends Ee{constructor(...e){super(...e),A(this,"hasAmp",!1)}};function VP(e,t,n=""){for(const r of e.classList)if(r.startsWith(`${t}-`))return r.replaceAll(`${t}-`,"");return n}function GP(e,t,n){const r=VP(e,t);r!==n&&(e.classList.remove(`${t}-${r}`),n&&e.classList.add(`${t}-${n}`))}function XP(){const e=new Ee;return e.addDisposable(Gx(t=>t.startsWith("amp"))),e.addDisposable(Xx(t=>t==="class"||t==="style")),e}function KP(e){const t=o=>rE(o)&&e.getOuterHtml(o)!==""||IP(o)||LO(o),n=o=>{if(t(o))return!0;if(En(o)||mf(o)){for(const i of o.querySelectorAll("*"))if(t(i))return!0}return!1},r=new jP;return r.addDisposable(FP(o=>o.closest("amp-img"))),r.addDisposable(qP(UP)),r.addDisposable(XP()),r.addDisposable(sE("amp-img")),r.addDisposable(sE("amp-anim")),r.addDisposable(e.onChange(o=>{let i=r.hasAmp,s=!1;for(const a of o){if(a.added.some(l=>n(l))){s=!0,i=!0;break}if(a.removed.some(l=>n(l))){i=n(document);break}}r.hasAmp!==i?(r.hasAmp=i,U.send(ue.APPLICATION_HAS_AMP,i),setTimeout(()=>{if(i)iE(document,{correct:!1});else{const a=[...document.querySelectorAll("script")];for(const l of a)rE(l)&&l.remove();Bf()}})):s&&setTimeout(()=>{iE(document,{correct:!1})})})),r.addDisposable(U.addListener(o=>{if(o.data?.operation==="sandbox_element_settings_set"){const i=document.querySelector("[em-edit]");if(i){const s=o.data?.settings?.ampShow;s!==void 0&&(GP(i,"em-amp-show",s==="amp"?"only":s==="html"?"disabled":void 0),e.commit())}}})),r}function YP(e,t){const n=KP(t);return e.inject(jd,n),{service:n,dispose(){n.dispose(),yn(e,jd)}}}var ZP={name:"sandbox.amp",provides:[jd],awaits:{services:[Y]},setup(e){const{service:t}=YP(e,M(e,Y));e.addService(ty,()=>({ampService:t}))}};(function(){"use strict";function e(t,n){var r,o=0,i=t.length,s,a="",l,c,u,d,f,h,m,p,S=!0,C=!1,L;r=arguments.length>1?n:{},typeof r.indent>"u"&&(r.indent=" "),typeof r.openbrace=="string"&&(S=r.openbrace==="end-of-line"),typeof r.autosemicolon=="boolean"&&(C=r.autosemicolon);function k(E){return E===" "||E===`
|
|
13
|
+
`||E===" "||E==="\r"||E==="\f"}function y(E){return E==="'"||E==='"'}function g(E){return l>="a"&&l<="z"||l>="A"&&l<="Z"||l>="0"&&l<="9"||"-_*.:#[]".indexOf(E)>=0}function v(){for(var E=h;E>0;E-=1)a+=r.indent}function w(){a=L(a),S?a+=" {":(a+=`
|
|
14
|
+
`,v(),a+="{"),c!==`
|
|
15
|
+
`&&(a+=`
|
|
16
|
+
`),h+=1}function b(){var E;h-=1,a=L(a),a.length>0&&C&&(E=a.charAt(a.length-1),E!==";"&&E!=="{"&&(a+=";")),a+=`
|
|
17
|
+
`,v(),a+="}",s.push(a),a=""}for(String.prototype.trimRight?L=function(E){return E.trimRight()}:L=function(E){return E.replace(/\s+$/,"")},f={Start:0,AtRule:1,Block:2,Selector:3,Ruleset:4,Property:5,Separator:6,Expression:7,URL:8},h=0,d=f.Start,p=!1,s=[],t=t.replace(/\r\n/g,`
|
|
18
|
+
`);o<i;){if(l=t.charAt(o),c=t.charAt(o+1),o+=1,y(m)){a+=l,l===m&&(m=null),l==="\\"&&c===m&&(a+=c,o+=1);continue}if(y(l)){a+=l,m=l;continue}if(p){a+=l,l==="*"&&c==="/"&&(p=!1,a+=c,o+=1);continue}if(l==="/"&&c==="*"){p=!0,a+=l,a+=c,o+=1;continue}if(d===f.Start){if(s.length===0&&k(l)&&a.length===0)continue;if(l<=" "||l.charCodeAt(0)>=128){d=f.Start,a+=l;continue}if(g(l)||l==="@"){if(u=L(a),u.length===0)s.length>0&&(a=`
|
|
19
|
+
|
|
20
|
+
`);else if(u.charAt(u.length-1)==="}"||u.charAt(u.length-1)===";")a=u+`
|
|
21
|
+
|
|
22
|
+
`;else for(;c=a.charAt(a.length-1),!(c!==" "&&c.charCodeAt(0)!==9);)a=a.substr(0,a.length-1);a+=l,d=l==="@"?f.AtRule:f.Selector;continue}}if(d===f.AtRule){if(l===";"){a+=l,d=f.Start;continue}if(l==="{"){u=L(a),w(),d=u==="@font-face"?f.Ruleset:f.Block;continue}a+=l;continue}if(d===f.Block){if(g(l)){if(u=L(a),u.length===0)s.length>0&&(a=`
|
|
23
|
+
|
|
24
|
+
`);else if(u.charAt(u.length-1)==="}")a=u+`
|
|
25
|
+
|
|
26
|
+
`;else for(;c=a.charAt(a.length-1),!(c!==" "&&c.charCodeAt(0)!==9);)a=a.substr(0,a.length-1);v(),a+=l,d=f.Selector;continue}if(l==="}"){b(),d=f.Start;continue}a+=l;continue}if(d===f.Selector){if(l==="{"){w(),d=f.Ruleset;continue}if(l==="}"){b(),d=f.Start;continue}a+=l;continue}if(d===f.Ruleset){if(l==="}"){b(),d=f.Start,h>0&&(d=f.Block);continue}if(l===`
|
|
27
|
+
`){a=L(a),a+=`
|
|
28
|
+
`;continue}if(!k(l)){a=L(a),a+=`
|
|
29
|
+
`,v(),a+=l,d=f.Property;continue}a+=l;continue}if(d===f.Property){if(l===":"){a=L(a),a+=": ",d=f.Expression,k(c)&&(d=f.Separator);continue}if(l==="}"){b(),d=f.Start,h>0&&(d=f.Block);continue}a+=l;continue}if(d===f.Separator){if(!k(l)){a+=l,d=f.Expression;continue}y(c)&&(d=f.Expression);continue}if(d===f.Expression){if(l==="}"){b(),d=f.Start,h>0&&(d=f.Block);continue}if(l===";"){a=L(a),a+=`;
|
|
30
|
+
`,d=f.Ruleset;continue}if(a+=l,l==="("&&a.charAt(a.length-2)==="l"&&a.charAt(a.length-3)==="r"&&a.charAt(a.length-4)==="u"){d=f.URL;continue}continue}if(d===f.URL&&l===")"&&a.charAt(a.length-1!=="\\")){a+=l,d=f.Expression;continue}a+=l}return a=s.join("")+a,a}window.cssbeautify=e})();function QP(e,t,n){n.state.update({iframeOffsetTop:e.iframeOffsetTop,scrollTop:e.scrollTop,previewHeight:e.previewHeight,applicationMode:e.mode}),typeof t<"u"&&n.state.set("codeMode",e.mode==="code");const r=document.querySelector(".em-element-path");r&&(r.style.top=n.previewHeight-n.iframeOffsetTop-65+n.scrollTop+"px");const o=document.querySelector(".em-editor-wrapper");o&&o.style.display==="none"?n.setBlockGroupControlsPosition():setTimeout(()=>{n.setBlockGroupControlsPosition()},400)}var JP=["transform","transform-origin","overflow-x","height"];function eI(e,t){return!(e>0)||!(t>0)||e<=t?1:t/e}function As(e,t){const n=t<1?`scale(${t})`:"";if(e.style.transform===n)return!1;for(const r of JP)e.style.removeProperty(r);return n?(e.style.overflowX="visible",e.style.transformOrigin="left top",e.style.transform=n):e.getAttribute("style")||e.removeAttribute("style"),!0}function tI(e,t){const n=e,r=n?.querySelector("table:first-child"),o=Math.max(n?.offsetWidth??0,r?.offsetWidth??0);return o>0?o:(As(t,1),t.scrollWidth)}function nI(e,t=window){const n=t.document.documentElement,r=n.style.transform,o=eI(tI(e,n),t.innerWidth);return As(n,o),n.style.transform!==r&&t.parentIFrame?.size?.(),o}function rI(e,t){As(document.documentElement,1);const n=t.globalHolder?.querySelector("table:first-child");if(n&&n.offsetWidth>=e.iframeWidth-2&&t.globalHolder){const r=e.iframeWidth/t.globalHolder.offsetWidth;As(document.documentElement,r),document.querySelector(".em-narrow-table")&&e.iframeWidth>370&&t.messageService.send({operation:"application_preview_alert_show",settings:{show:r<.9}})}setTimeout(()=>{t.messageService.send({operation:"application_iframe_set_height",settings:{height:document.body.getBoundingClientRect().height}})},300)}function ft(e){const t=M(e,_e);return n=>{t.commit(n)}}function lt(){return M(Pt,Y)}function oI(){return M(Pt,it)}function iI(){return M(Pt,gn)}function mt(){return Pt.getInstance(Y)!==void 0}function uo(e){M(Pt,_e).commit(e)}function sI(e){if(!mt())return e(),Promise.resolve(!0);const t=lt();return t.commit(!1),t.flushCommit(),t.sendAfterCurrentEdits(e)}function aI(){if(!mt())return!1;const e=lt();return e.commit(!1),e.flushCommit(),e.hasEditsAfterBoundary()}function lI(){return mt()?lt().markHistoryAction():void 0}function cI(e){mt()&<().noteHistoryActionSent(e)}function Ff(e){return mt()&<().holdInput(e)}function cE(e){return mt()&<().holdInputBehindQueued(e)}function uE(){mt()&<().closeUndoStep()}function $f(){return mt()&<().isHoldingInput()}function dE(){return mt()&<().hasHeldInput()}function fE(){mt()&<().releaseHeldInput()}function mE(){return mt()&<().holdsTypedEdits()}function ks(e){return mt()?lt().renderOnly(e):e()}function Fl(e){return e.nodeType===1&&e.localName==="template"&&e.namespaceURI==="http://www.w3.org/1999/xhtml"}function Wf(e){return[...e.querySelectorAll?.("template")??[]].filter(Fl)}function uI(e){return Fl(e)||Wf(e).length>0}function rn(e){const t=[...Fl(e)?[e]:[],...Wf(e)];for(const n of t)if(n.content.firstChild){for(;n.content.firstChild;)n.appendChild(n.content.firstChild);for(const r of n.children)rn(r)}}function ti(e){const t=[...Fl(e)?[e]:[],...Wf(e)];for(const n of t)for(;n.firstChild;)n.content.appendChild(n.firstChild)}var dI="style, link",fI=["insertText","insertHTML","delete","forwardDelete","insertParagraph","insertLineBreak"],mI=e=>fI.includes(e),hI=e=>/^(insert|delete)/.test(e);function hE(e,t){if(!e||e.collapsed)return;const n=t??gI(e.commonAncestorContainer);if(!n)return;const r=[...n.querySelectorAll(dI)].filter(o=>pI(o)&&e.intersectsNode(o));r.length>1&&n.append(...r)}var pI=e=>e instanceof HTMLStyleElement||e instanceof HTMLLinkElement;function gI(e){return(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest('[contenteditable="true"]')??null}function Xt(){return mt()?lt():void 0}function Dt(e){const t=Xt();return t?t.applyHidden(e):e()}function He(e,t,...n){e&&Dt(()=>t?e.classList.add(...n):e.classList.remove(...n))}function fo(e){const t=document.activeElement;t&&we(t)&&t!==document.body&&e.contains(t)&&Dt(()=>t.blur())}function qf(e){Xt()?.ownership.markService(e)}function pE(e){Xt()?.ownership.markWrapper(e)}function gE(e){Xt()?.ownership.markOuterWrapper(e)}function Ls(e,t){e.removeAllRanges(),Dt(()=>e.addRange(t))}function $l(e){const t=document.implementation.createHTMLDocument("").importNode(e,!0);nn(e,t);const n=new Map([[e,t]]),r=Xt()?.ownership,o=(i,s)=>{const a=[...s.childNodes];i.childNodes.forEach((l,c)=>{const u=a[c];n.set(l,u),o(l,u),r?.isOffModel(l)&&u.replaceWith(...u.childNodes)})};return o(e,t),ti(t),{copy:t,counterpart:i=>n.get(i)}}function Wl(e){return Cb($l(e).copy)}function je(e){return JN($l(e).copy)}function Ns(e){const t=Xt();return t?(t.flushCommit(),t.getOuterHtml(e)):e.outerHTML}function zf(e){return bE(e)}function bE(e){const t=Xt();return!t||t.isInLetter(e)||!t.isUntracked(e)&&!t.ownership.isService(e)}function Uf(e){const t=Xt();return t?t.ownership.markOf(e)?"foreign":t.isInLetter(e)?"letter":t.isBehindHidden(e)?"foreign":"new":"letter"}function jf(e,t){const n=[...e.querySelectorAll(t)].filter(zf);return n[n.length-1]??null}function yE(e,t){const n=o=>t==="next"?o.nextElementSibling:o.previousElementSibling;let r=n(e);for(;r&&!zf(r);)r=n(r);return r}function vE(e,t){return[...e.childNodes].flatMap(n=>t.isInLetter(n)?[n]:vE(n,t))}function Vf(e){fo(e);const t=Xt();if(!t)return;t.flushCommit();const n=[...e.querySelectorAll("*")].filter(r=>t.ownership.markOf(r)==="service");for(const r of n)e.contains(r)&&r.replaceWith(...vE(r,t))}function bI(e){const t=[...e.childNodes],n=Xt();if(!n)return t;let r;for(const o of n.letterChildren(e))o.isConnected||t.splice(r?t.indexOf(r)+1:0,0,o),r=o;return t}function yI(){const e=Xt();return e?{...e.scriptRunner,awake:()=>e.recordNow()}:{run:(t,n)=>n(),quiet:t=>t()}}function lr(e,t){const n=Ne(e,"dormant"),r=Pb(n);try{return t(n)}finally{Wb(r,yI())}}function EE(e,t,n){lr(n,r=>ul(e,t,r))}function xs(e,t,n){return e==="new"?lr(t,n):n(Ne(t,!0))}function cr(e,t,n,r){xs(e,r,o=>ul(t,n,o))}function ht(e){return function(...t){const n=Xt(),r=()=>Reflect.apply(e,this,t);return n?n.applyOwn(r):r()}}function ur(e,t=!1,n){const r=()=>{if(mI(e)){const i=window.getSelection();hE(i?.rangeCount?i.getRangeAt(0):void 0)}return document.execCommand(e,t,n)},o=Xt();return o?o.applyCommand(r):r()}function SE(e){const t=()=>{He(document.body,e,"mceNonEditable"),document.querySelectorAll("editor").forEach(n=>{n.setAttribute("contenteditable",e?"false":"true")})};mt()?lt().applyHidden(t):t()}function vI(){let e=!1,t=!0,n=!0;const r=new Set,o=i=>{t!==i&&(t=i,[...r].forEach(s=>{try{s()}catch{}}))};return{setApp(i){e=i},setIntegrator:o,isAppLocked:()=>e,isIntegratorLocked:()=>t,isTextLocked:()=>e||t,closeEditorInit(){n=!0},openEditorInit(){n=!1},isEditorInitClosed:()=>n,onIntegratorChange(i){const s=()=>i();return r.add(s),()=>r.delete(s)},reset(){e=!1,o(!0),n=!0}}}var Gf=vI();function EI(e){return{dispose:e.onIntegratorChange(()=>SE(e.isTextLocked()))}}function SI(e,t){return e.beforeChange(({domMutations:n})=>{const r=n.flatMap(o=>o.type==="Add"&&o.node instanceof Element?[o.node]:[]);r.length&&queueMicrotask(()=>{if(!t.isTextLocked())return;const o=r.flatMap(i=>[...i.tagName==="EDITOR"?[i]:[],...Array.from(i.querySelectorAll("editor"))]);e.applyHidden(()=>{for(const i of o)i.isConnected&&i.setAttribute("contenteditable","false")})})})}function Xf(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const i=e,s=t;return i.length===s.length&&i.every((a,l)=>Xf(a,s[l]))}const r=Object.keys(e),o=Object.keys(t);return r.length!==o.length?!1:r.every(i=>Object.prototype.hasOwnProperty.call(t,i)&&Xf(e[i],t[i]))}function wE(e,t){const n={watch(r){let o,i=!1;return e.watch(s=>{const a=t(s);i&&Xf(o,a)||(o=a,i=!0,r(a))})},select(r){return wE(n,r)}};return n}function _E(...e){let t=e[0],n=e.length>0;const r=new Set,o={get(){return n?t:void 0},set(i){t=i,n=!0;for(const s of Array.from(r))s(i)},watch(i){return r.add(i),n&&i(t),{dispose:()=>r.delete(i)}},select(i){return wE(o,i)}};return o}var ql={applicationTheme:"light",applicationMode:"default",previewHeight:0,emailWidth:0,previewPage:!1,globalHolder:null,elementPath:[],iframeOffsetTop:0,scrollTop:0,copyPasteEnabled:!0,saveBlockEnabled:!0,editImageControlEnabled:!0,elementAIimageEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterEditorEnabled:!0,blocksAddPanelEnabled:!0,blocksTemplateEnabled:!1,codeMode:!0,appName:"",isLeftButtonDown:!1,isProgrammaticSelection:!1,activeCell:[],commonStyles:{},loadStylesTimer:!1,_pushUndoStop:!1},Os=_E({...ql});function Dn(){return Os.get()}var zl=new ge,ni=new Map,V={source:Os,get(e){return Dn()[e]},getState(){return{...Dn()}},getStateRef(){return Dn()},set(e,t){if(Dn()[e]===t)return;Os.set({...Dn(),[e]:t}),zl.fire({[e]:t});const n=ni.get(e);n&&n.forEach(r=>r(t))},update(e){let t=!1;const n={};for(const r of Object.keys(e)){const o=e[r];if(Dn()[r]!==o){Os.set({...Dn(),[r]:o}),n[r]=o,t=!0;const i=ni.get(r);i&&i.forEach(s=>s(o))}}t&&zl.fire(n)},increment(e,t=1){const n=Dn()[e];typeof n=="number"&&V.set(e,n+t)},decrement(e,t=1){const n=Dn()[e];typeof n=="number"&&V.set(e,n-t)},subscribe(e){return zl.event(e)},subscribeToKey(e,t){ni.has(e)||ni.set(e,new Set);const n=ni.get(e),r=t;return n.add(r),()=>{n.delete(r),n.size===0&&ni.delete(e)}},reset(){Os.set({...ql}),zl.fire(Dn())},resetKey(e){this.set(e,ql[e])},getInitialState(){return ql}};function wI(e,t){const n=_E(),r=e.addListener(t,o=>n.set(o));return{source:n,dispose:()=>r.dispose()}}var _I=["copyPasteEnabled","saveBlockEnabled","editImageControlEnabled","elementAIimageEnabled","imageCenterStockEnabled","imageCenterGifEnabled","imageCenterEditorEnabled","blocksAddPanelEnabled","blocksTemplateEnabled"];function CI(e){const t="cd84d2b9";let n=document.getElementsByTagName("head")[0];!n&&document.documentElement&&(n=document.createElement("head"),document.documentElement.insertBefore(n,document.documentElement.firstChild));const r=`css/sandbox-${e}.css?${t}`,o=e==="light"?"dark":"light",i=document.querySelectorAll(`[href="css/sandbox-${o}.css?${t}"]`);if(!document.querySelector(`[href="${r}"]`)){const s=document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("type","text/css"),s.setAttribute("em","css"),s.setAttribute("href",r),n?.appendChild(s)}for(const s of i)s.remove()}var TI={name:"sandbox.hostFacts",provides:[jo],setup(e){const t=Object.fromEntries(Object.entries(fx).map(([n,r])=>[n,wI(U,r).source]));e.inject(jo,t)}},AI={name:"sandbox.hostFactsToState",awaits:{services:[jo,_e,Y,Ye]},setup(e){const t=M(e,jo),n=ft(e),r=M(e,Ye);t.theme.watch(o=>{V.set("applicationTheme",o),CI(o),n(!1)}),t.commonStyles.watch(o=>{o&&V.set("commonStyles",o)}),t.flags.watch(o=>{for(const i of _I)typeof o[i]<"u"&&V.set(i,o[i])}),EI(r),SI(M(e,Y),r),t.lockEditor.watch(o=>r.setIntegrator(o)),t.codeMode.watch(o=>V.set("codeMode",o)),t.appName.watch(o=>V.set("appName",o)),t.previewPage.watch(o=>{V.set("previewPage",o),He(document.body,!!o,"em-sandbox-preview")})}},kI={name:"sandbox.viewport",awaits:{services:[jo]},setup(e){M(e,jo).viewport.watch(t=>QP(t,void 0,{state:V,previewHeight:t.previewHeight,iframeOffsetTop:t.iframeOffsetTop,scrollTop:t.scrollTop,globalHolder:V.get("globalHolder"),setBlockGroupControlsPosition:()=>e.getServices(ny).forEach(n=>n()),messageService:U}))}};function xr(e){for(const t of document.querySelectorAll(`[${e}]`))t.removeAttribute(e)}function Et(e,t,n=!1){for(const r of e.querySelectorAll(t))n||!r.childNodes.length?r.remove():r.replaceWith(...r.childNodes)}function LI(e,t){if(e.data.value)document.querySelectorAll("editor").forEach(n=>{n.setAttribute("contenteditable","false")}),He(document.body,!0,"em-sandbox-discuss");else{const n=t.editLock.isTextLocked()?"false":"true";document.querySelectorAll("editor").forEach(r=>{r.setAttribute("contenteditable",n)}),He(document.body,!1,"em-sandbox-discuss","em-sandbox-discuss_set-target")}}function NI(e,t){He(document.body,!!e.data.value,"em-sandbox-discuss_set-target")}function xI(e,t){const n=e.data.value,r=document.querySelector(`[em-discuss-id="${n}"]`);r&&t.messageService.send({operation:"application_scroll-to",settings:{value:r.getBoundingClientRect().top+t.iframeOffsetTop-t.previewHeight/2}}),He(document.body,!1,"em-sandbox-discuss_set-target"),document.querySelectorAll(".em-discuss-id-new").forEach(o=>{o.removeAttribute("em-discuss-id")}),t.removeAllAttributes("em-edit"),r&&document.querySelectorAll(`[em-discuss-id="${n}"]`).forEach(o=>{o.removeAttribute("em-discuss-id")}),t.commit()}function OI(e,t){He(document.body,!1,"em-sandbox-discuss_set-target"),document.querySelectorAll(".em-discuss-id-new").forEach(n=>{n.classList.remove("em-discuss-id-new")}),t.removeAllAttributes("em-edit"),t.commit(),setTimeout(()=>{t.messageService.send({operation:"application_discuss_save_target"})},500)}function RI(e,t){const n=e.data.value,r=document.querySelector(`[em-discuss-id="${n}"]`);r?(t.messageService.send({operation:"application_scroll-to",settings:{value:r.getBoundingClientRect().top+t.iframeOffsetTop-t.previewHeight/2}}),r.classList.add("em-discuss-target-active"),setTimeout(()=>{r.classList.remove("em-discuss-target-active")},2e3)):t.messageService.send({operation:"application_discuss_no_comment"})}var MI={sandbox_lock_discuss:LI,sandbox_discuss_set_target:NI,sandbox_discuss_remove_target:xI,sandbox_discuss_reset:OI,sandbox_discuss_get_target:RI};function PI(e,t){t.editLock.setApp(!!e.data.data),SE(t.editLock.isTextLocked())}function II(e,t){t.setEditorFocus(e.data.data)}function DI(e,t){let n=e.data.data;if(typeof n!="number")return;n=oI().correctOffset(n,!0),n=iI().correctOffset(n,!0);let r=lt().getElementByPosition(n);if(r&&!(r instanceof Element)&&(r=r.parentElement),!r||!we(r))return;const o=r.getBoundingClientRect();r.tagName!=="BODY"&&o.height&&o.width&&document.querySelector("[em-edit]")!==r&&t.applicationElementSettingsSet({elem:r});const i=r.getBoundingClientRect(),s=i.top-V.get("previewHeight")/2+i.height/2;t.messageService.send({operation:"application_scroll-to",settings:{value:V.get("applicationMode")==="default"?s+V.get("iframeOffsetTop"):s}})}var BI={sandbox_lock_edit:PI,editor_change_focus:II,update_position_from_editor:DI};function HI(e,t){document.querySelectorAll("[em-optimise-error]").forEach(n=>{n.removeAttribute("em-optimise-error")}),document.querySelectorAll("img").forEach((n,r)=>{n.setAttribute("em-optimise",`image_${r}`)}),t.commit()}function FI(e,t){document.querySelectorAll("[em-optimise-error]").forEach(n=>{n.removeAttribute("em-optimise-error")}),document.querySelectorAll("a[href]").forEach((n,r)=>{n.setAttribute("em-optimise",`link_${r}`)}),t.commit()}function $I(e,t){const n=document.querySelector(`[em-optimise="${e.data.settings.elementId}"]`);n&&(e.data.settings.isError&&(n.setAttribute("em-optimise-error","true"),t.commit()),t.messageService.send({operation:"application_scroll-to",settings:{value:n.getBoundingClientRect().top+t.iframeOffsetTop-t.previewHeight/2}}),t.setCursorPosition(n),t.applicationElementSettingsSet({elem:n}))}function WI(e,t){const n=document.querySelector(`[em-optimise="${e.data.settings.elementId}"]`);n&&(t.messageService.send({operation:"application_scroll-to",settings:{value:n.getBoundingClientRect().top+t.iframeOffsetTop-t.previewHeight/2}}),t.setCursorPosition(n),t.applicationElementSettingsSet({elem:n}),e.data.settings.isError&&n.setAttribute("em-optimise-error","true"),t.commit())}var qI={sandbox_set_attr_to_images:HI,sandbox_set_attr_to_links:FI,sandbox_set_position_to_img:$I,sandbox_set_position_to_link:WI},zI={brightness:100,contrast:100,sepia:0},Ul={DARK:"dark",LIGHT:"light"},CE=!1;function UI(e){CE||(e.setFetchMethod(t=>window.fetch(t)),CE=!0)}function jI(){let e=null,t=Ul.LIGHT;return{set(n){if(t=n,n===Ul.DARK){e??(e=Mf(()=>Promise.resolve().then(()=>_d("./darkreader.CyLMh7_H.js")),void 0,{}.url)),e.then(r=>{t===Ul.DARK&&(UI(r),r.enable(zI))}).catch(r=>{e=null});return}e?.then(r=>{t===Ul.LIGHT&&r.disable()})},clear(n){return n.replaceAll(/\s*?--darkreader.+?: .*?;/g,"")}}}var jl=jI();function VI(e,t){t.initPreview(!0)}function GI(e){const t=e.data?.data?.theme;(t==="light"||t==="dark")&&jl.set(t)}var XI={init_preview:VI,sandbox_switch_theme:GI};function Sn(e,t,n,r){return{name:`sandbox.operations.${e}`,awaits:n,setup(o){const i=r(o),s={};for(const[a,l]of Object.entries(t))l&&(s[a]=c=>l(c,i()));o.addService(ry,{owner:e,handlers:s})}}}var KI={name:"sandbox.operationEnvironment",provides:[kr],setup(e){const t={iframeOffsetTop:0,previewHeight:0,elementPath:[]};V.subscribe(n=>{for(const r of["iframeOffsetTop","previewHeight","elementPath"])r in n&&n[r]!==void 0&&Object.assign(t,{[r]:n[r]})}),e.inject(kr,t)}},YI=Sn("discuss",MI,{services:[_e,kr,Ye]},e=>{const t=ft(e),n=M(e,kr),r=M(e,Ye);return()=>({commit:t,editLock:r,iframeOffsetTop:n.iframeOffsetTop,previewHeight:n.previewHeight,messageService:U,removeAllAttributes:xr})}),ZI=Sn("editor",BI,{services:[De,st,Ye]},e=>{const t=M(e,De),n=M(e,st),r=M(e,Ye);return()=>({applicationElementSettingsSet:t,editLock:r,messageService:U,setEditorFocus:o=>n.setEditorFocus(o)})}),QI=Sn("images",qI,{services:[De,vt,_e,kr]},e=>{const t=M(e,De),n=M(e,vt),r=ft(e),o=M(e,kr);return()=>({applicationElementSettingsSet:t,commit:r,iframeOffsetTop:o.iframeOffsetTop,previewHeight:o.previewHeight,messageService:U,setCursorPosition:i=>n(i)})}),JI=Sn("preview",XI,{services:[ms]},e=>()=>({initPreview:t=>M(e,ms)(t)})),eD={name:"sandbox.operationsDispatcher",setup(e){U.addListener(t=>{const n=t.data?.operation;if(!n)return;const r=e.getServices(ry).map(i=>i.handlers[n]).filter(Boolean).pop();if(!r)return;const o=i=>{};try{Promise.resolve(r(t)).catch(o)}catch(i){o(i)}})}},tD=[KI,YI,ZI,QI,JI,eD],nD=["em-block-insert","em-block-insert_bottom-document","em-block-insert_top-document","em-block-insert_bottom","em-block-insert_top","em-blockatom-insert","em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top","em-block-insert-empty","em-atom-insert-empty","em-block-insert-body","em-atom-insert-body","em-resize-start","sortable-chosen","sortable-ghost","em-vindent-table","em-vindent_low","em-vindent","em-relative","em-display-block","em-sandbox-discuss_set-target","em-sandbox-discuss","em-element-list-bullet","remove-new-editor-element","em-just-inserted","em-native-img-uploading","em-native-img-drop-target","em-native-img-drop-loading","em-native-file-drag"],rD=["style","class","align","href"],oD=new Set([...nD,"em-element-path_img"]);function iD(e){return e.split(/\s+/).filter(t=>t&&!oD.has(t)).join(" ")}var sD=32;function aD(e){return!!(e.tagName==="BODY"||e.getAttribute("em")==="atom"||e.tagName==="TABLE"&&e.hasAttribute("em"))}function lD(e){const t=[e.tagName];for(const n of rD){const r=e.getAttribute(n),o=n==="class"&&r!==null?iD(r):r;o!==null&&o!==""&&t.push(`${n}=${o}`)}return t.join("|")}function cD(e){if(!e||!e.isConnected)return"";const t=[];let n=e,r=0;for(;n&&r<sD&&(t.push(lD(n)),!aD(n));)n=n.parentElement,r++;return t.join("||")}function uD(e){let t={text:"",ancestors:""};const n=r=>({text:r?e(r):"",ancestors:cD(r)});return{remember(r){t=n(r)},forget(){t={...t,text:""}},take:n,differs(r){return t.text!==r.text||t.ancestors!==r.ancestors},accept(r){t=r}}}function dD(e,t){t.onReleased(()=>{Promise.resolve().then(()=>{t.isLocked()||e.remember(document.querySelector("[em-edit]"))})})}var TE=Promise.resolve(),AE=null;function fD(e,t){const{HTMLDocument:n,documentMapping:r,remoteDocument:o,messageService:i}=t;let s=n.getRangeByElement(e,!0);if(s){const a=r.getMappedReplacementRangeAtPosition(s.start)||r.getMappedReplacementRangeAtPosition(Math.max(s.end-1,s.start));a&&(s=a),s=r.correctRange(s),s=o.correctRange(s);const l={operation:"update_position_from_iframe",data:s};i.send(l)}}function mD(e,t){AE=e,TE=TE.finally(()=>{AE===e&&fD(e,t)})}function hD(e,t="unknown"){const n=Pt.getInstance(st);if(!n){e();return}n.controller.whenEditorLostFocus(e,t)}var pD="em-inline",Voe="br, img, em-replace, table, hr, input, button, video, audio, svg, picture, canvas, iframe, object",Rs="data-em-caret",Goe="",Bn=e=>e();function xt(e){return!!e&&e.nodeType===Node.ELEMENT_NODE&&e.hasAttribute("data-em-caret")}function mo(e){return!!e&&e.nodeType===Node.ELEMENT_NODE&&e.tagName==="EM-REPLACE"&&!e.hasAttribute("src")}function Or(e){return(e??"").replaceAll("","")}function Kf(e){return Or(e.textContent)}function gD(e){return(e.nodeType===Node.TEXT_NODE||xt(e))&&Or(e.textContent)===""}function Yf(e,t){const n=document.createRange();n.setStart(e,t),n.collapse(!0);const r=window.getSelection();r&&Ls(r,n)}function kE(e){if(!e.collapsed)return null;const{startContainer:t,startOffset:n}=e,r=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest("em-replace");if(!mo(r))return null;const o=document.createRange();if(o.selectNodeContents(r),o.setEnd(t,n),Or(o.toString())==="")return{em:r,side:"before"};const i=document.createRange();return i.selectNodeContents(r),i.setStart(t,n),Or(i.toString())===""?{em:r,side:"after"}:null}function Zf(e,t){if(!e.collapsed)return null;const n=kE(e);if(n)return n.side===(t==="backward"?"after":"before")?n.em:null;const{startContainer:r,startOffset:o}=e;let i;if(r.nodeType===Node.TEXT_NODE){const s=r.data;if(Or(t==="backward"?s.slice(0,o):s.slice(o))!=="")return null;const a=r.parentNode,l=xt(a)?a:r;i=t==="backward"?l.previousSibling:l.nextSibling}else{const s=r.childNodes;i=t==="backward"?s[o-1]??null:s[o]??null}for(;i&&gD(i);)i=t==="backward"?i.previousSibling:i.nextSibling;return mo(i)?i:null}function Vl(e,t,n=Bn){return Qf(e,t,n)}function Qf(e,t,n=Bn){const r=t==="after"?e.nextSibling:e.previousSibling;let o;if(xt(r))o=r;else{const s=document.createElement("span");s.setAttribute(Rs,""),qf(s),s.appendChild(document.createTextNode("")),n(()=>t==="after"?e.after(s):e.before(s)),o=s}let i=o.lastChild;if(!i||i.nodeType!==Node.TEXT_NODE){i=document.createTextNode("");const s=i;n(()=>o.appendChild(s))}return Yf(i,i.length),o}var LE="p, div, li, td, th, h1, h2, h3, h4, h5, h6, blockquote";function Jf(e,t=Bn,n=e.parentElement?.closest('[contenteditable="true"]')){yD(e,n)&&Qf(e,"after",t)}function bD(e,t=Bn){const n=e.parentElement?.closest('[contenteditable="true"]');SD(e,n)||Jf(e,t,n)}function NE(e,t){const n=e.parentElement?.closest(LE);return n&&t.contains(n)?n:t}function xE(e){const t=e.cloneContents();return t.querySelectorAll(`[${Rs}]`).forEach(n=>n.remove()),!/[^ \t\n\r]/.test(t.textContent??"")&&!t.querySelector("br, img, em-replace, table, hr, input, button, video, audio, svg, picture, canvas, iframe, object")}function OE(e,t){const n=document.createRange();return n.setStartAfter(e),n.setEnd(t,t.childNodes.length),xE(n)}function yD(e,t){return!!t&&OE(e,NE(e,t))}function vD(e){const{display:t}=getComputedStyle(e);return e.matches(LE)||t!==""&&t!=="inline"}function ED(e,t){for(let n=e.parentElement;n;n=n.parentElement)if(n===t?!t.hasAttribute("em-inline"):vD(n))return n;return t}function SD(e,t){if(!t)return!1;const n=document.createRange();return n.setStart(NE(e,t),0),n.setEndBefore(e),xE(n)}function RE(e){const t=xt(e)&&Kf(e)===""?e.previousSibling:null,n=t?.parentElement?.closest('[contenteditable="true"]');return t?.nodeName==="BR"&&!!n&&OE(t,ED(t,n))}function em(e,t=Bn){if(!RE(e)||!e.parentNode)return null;const n=window.getSelection(),r=!!n?.anchorNode&&e.contains(n.anchorNode),o=document.createElement("br");e.before(o),t(()=>e.remove());const i=o.parentNode;return r&&Yf(i,Array.prototype.indexOf.call(i.childNodes,o)),o}function ME(){const e=window.getSelection(),t=e?.rangeCount?e.getRangeAt(0):null,n=t?.collapsed?t.startContainer:null,r=xt(n)?n:n?.parentNode;return RE(r)?r:null}function wD(e,t=Bn,n){return Array.from(e.querySelectorAll(`[${Rs}]`)).filter(r=>r!==n).map(r=>em(r,t)).some(Boolean)}function _D(e,t=Bn,n){const r=Array.from(e.querySelectorAll(`[${Rs}]`)).filter(o=>o!==n&&Or(o.textContent)==="");r.length&&t(()=>r.forEach(o=>o.remove()))}function CD(e,t=Bn){const n=Or(e.textContent);if(n==="")return null;const r=document.createTextNode(n);return e.before(r),t(()=>e.remove()),Yf(r,r.length),r}function PE(e){if(!e.collapsed)return;const{startContainer:t}=e,n=xt(t)?t:t.parentNode;xt(n)&&(mo(n.previousSibling)?e.setStartAfter(n):e.setStartBefore(n),e.collapse(!0))}function IE(e){e.querySelectorAll(`[${Rs}]`).forEach(t=>{const n=Or(t.textContent);n===""?t.remove():t.replaceWith(t.ownerDocument.createTextNode(n))})}function TD(e,t){const n=Zf(e,t);if(!n)return null;const r=document.createRange();r.selectNode(n);const o=window.getSelection();return o&&Ls(o,r),n}function AD(e,t){const n=Array.from(e.querySelectorAll("em-replace")).find(i=>mo(i)&&t.intersectsNode(i)&&!DE(t,i));if(!n)return null;const r=document.createRange();r.selectNode(n);const o=window.getSelection();return o?.removeAllRanges(),o?.addRange(r),n}function DE(e,t){const n=document.createRange();return n.selectNode(t),e.compareBoundaryPoints(e.START_TO_START,n)<=0&&e.compareBoundaryPoints(e.END_TO_END,n)>=0}function kD(){document.execCommand("delete")}function LD(){const e=window.getSelection()?.getRangeAt(0);e?.deleteContents(),e?.collapse(!0)}function BE(e,t=Bn,n=kD){if(e.collapsed)return!1;const r=e.commonAncestorContainer,o=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;if(!Array.from(o?.querySelectorAll("em-replace")??[]).some(l=>mo(l)&&DE(e,l)))return!1;n();const i=window.getSelection();if(!i?.rangeCount)return!0;const{startContainer:s,startOffset:a}=i.getRangeAt(0);if(s.nodeType===Node.ELEMENT_NODE){const l=s.childNodes[a-1]??null,c=s.childNodes[a]??null;mo(l)?Vl(l,"after",t):!l&&mo(c)&&Vl(c,"before",t)}return!0}function HE(){const e=window.getSelection();return e?.rangeCount?Zf(e.getRangeAt(0),"backward"):null}function ND(e,t=Bn){const n=e.isConnected?e:HE();if(!n)return;const r=n.closest('[contenteditable="true"]');Dt(()=>r?.focus({preventScroll:!0})),Vl(n,"after",t)}function xD(e){const t=e.innerHTML.trim();return[t===" ",t==="<div> </div>",/^<div[^>]*> <\/div>$/.test(t),/^<[^>]*> <\/[^>]*>$/.test(t),t.replace(/<[^>]*>/g,"").trim()===" ",e.textContent?.trim()===" "||e.textContent?.trim().charCodeAt(0)===160].some(n=>n===!0)}function OD(e){window.getSelection();const t=e.startContainer,n=t.nodeType===Node.TEXT_NODE?t.parentElement:t instanceof Element?t:null;if(!n||!n.contains(e.commonAncestorContainer))return!1;const r=n.textContent??"",o=e.toString(),i=r.replace(/\s+/g," ").trim(),s=o.replace(/\s+/g," ").trim();return r===o||i===s}var FE=Symbol("held-input-replay"),$E={insertText:"insertText",insertReplacementText:"insertText",deleteContentBackward:"delete",deleteContentForward:"forwardDelete",insertParagraph:"insertParagraph",insertLineBreak:"insertLineBreak",insertOrderedList:"insertOrderedList",insertUnorderedList:"insertUnorderedList",insertHorizontalRule:"insertHorizontalRule",formatBold:"bold",formatItalic:"italic",formatUnderline:"underline",formatStrikeThrough:"strikeThrough",formatSuperscript:"superscript",formatSubscript:"subscript",formatJustifyLeft:"justifyLeft",formatJustifyCenter:"justifyCenter",formatJustifyRight:"justifyRight",formatJustifyFull:"justifyFull",formatIndent:"indent",formatOutdent:"outdent",formatRemove:"removeFormat"},WE={deleteWordBackward:["backward","word"],deleteWordForward:["forward","word"],deleteSoftLineBackward:["backward","lineboundary"],deleteSoftLineForward:["forward","lineboundary"],deleteHardLineBackward:["backward","paragraphboundary"],deleteHardLineForward:["forward","paragraphboundary"]};function RD(e){return e in $E||e in WE}var MD={Backspace:["deleteContentBackward","deleteWordBackward","deleteSoftLineBackward"],Delete:["deleteContentForward","deleteWordForward","deleteSoftLineForward"]},qE={ArrowLeft:["backward","character","word"],ArrowRight:["forward","character","word"],ArrowUp:["backward","line","paragraphboundary"],ArrowDown:["forward","line","paragraphboundary"],Home:["backward","lineboundary","documentboundary"],End:["forward","lineboundary","documentboundary"]};function tm(){return/Mac/.test(window.navigator.platform)}function zE(e){return tm()?e.altKey:e.ctrlKey}function PD(e){const t=e.ctrlKey||e.metaKey;return t&&/^[cxv]$/i.test(e.key)||e.key==="Insert"&&(t||e.shiftKey)}function ID(e){return e.key in qE||(e.ctrlKey||e.metaKey)&&e.key.length===1&&!PD(e)}function nm(e){return FE in e}function rm(e){return e.target?.closest?.('[contenteditable="true"], editor')??void 0}function UE(e){if(e.key.length===1&&!e.metaKey&&(!e.ctrlKey||e.altKey))return"insertText";if(e.key==="Enter"&&!e.ctrlKey&&!e.metaKey&&!e.altKey)return e.shiftKey?"insertLineBreak":"insertParagraph";const t=MD[e.key];if(t)return tm()&&e.metaKey?t[2]:zE(e)?t[1]:t[0]}function DD(e){const t=qE[e.key];if(!t)return;const n=tm()&&e.metaKey&&(e.key==="ArrowLeft"||e.key==="ArrowRight")?"lineboundary":zE(e)?t[2]:t[1];document.getSelection()?.modify?.(e.shiftKey?"extend":"move",t[0],n)}function om(e){return Object.defineProperty(e,FE,{value:!0}),e}function jE(e,t){return e.isConnected&&t<=(e.nodeType===Node.TEXT_NODE?e.length:e.childNodes.length)}function VE(e){if(!jE(e.startContainer,e.startOffset)||!jE(e.endContainer,e.endOffset))return;const t=document.createRange();return t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),t.toString()}function BD(e,t){return t===void 0||VE(e)!==t?!1:(document.getSelection()?.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),!0)}function HD({inputType:e,data:t}){const n=WE[e];if(n){const o=document.getSelection();o?.isCollapsed&&o.modify?.("extend",n[0],n[1]),ur(n[0]==="backward"?"delete":"forwardDelete");return}const r=$E[e];r&&ur(r,!1,t??void 0)}function GE(e,t){if(t.target&&!BD(t.target,t.targetText))return;const{inputType:n,data:r}=t,o=om(new window.InputEvent("beforeinput",{inputType:n,data:r,bubbles:!0,cancelable:!0}));e.dispatchEvent(o)&&HD(t)}function FD(e,t){const n=om(new window.KeyboardEvent("keydown",{...t,bubbles:!0,cancelable:!0}));if(Object.defineProperty(n,"keyCode",{value:t.keyCode}),!e.dispatchEvent(n))return;const r=UE(t);r?GE(e,{inputType:r,data:r==="insertText"?t.key:null}):(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()==="a"?ur("selectAll"):DD(t)}var $D='[contenteditable="true"], editor';function im(e){return(e?.nodeType===Node.ELEMENT_NODE?e:e?.parentElement)?.closest($D)??void 0}function WD(){const e=document.getSelection();if(!e?.rangeCount||!e.anchorNode||!e.focusNode||!mt())return;const t=lt(),n=t.pointToOffset({node:e.anchorNode,offset:e.anchorOffset}),r=t.pointToOffset({node:e.focusNode,offset:e.focusOffset});return n===void 0||r===void 0?void 0:{anchor:t.trackOffset(n),focus:t.trackOffset(r)}}function XE(e){e?.anchor.release(),e?.focus.release()}function KE({node:e}){const t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement,n=e.nodeType===Node.TEXT_NODE&&/^\s*$/.test(e.data)&&/\n/.test(e.data);return e.isConnected&&!!im(e)&&!n&&!t?.closest("em-replace, [data-em-caret]")}function YE(e){const t=e.current(),n=t===void 0||!mt()?void 0:lt().offsetToPoint(t);return n&&KE(n)?n:void 0}function qD(e){const t=e&&YE(e.anchor),n=e&&YE(e.focus);if(!(!t||!n))return document.getSelection()?.setBaseAndExtent(t.node,t.offset,n.node,n.offset),im(t.node)}function zD(){const e=document.getSelection(),t=e?.rangeCount?e.anchorNode:null;return t&&KE({node:t})?im(t):void 0}function UD(e){const t=qD(e)??zD();return t}function Gl(e,t){const n=WD(),r=e(()=>{mt()&<().flushCommit();const o=UD(n);XE(n),o&&t(o)});return r||XE(n),r}function sm(e){e.preventDefault(),e.stopImmediatePropagation()}function jD(e){return/^(Tab|Escape|PageUp|PageDown|F\d{1,2})$/.test(e.key)||e.key==="Enter"&&(e.ctrlKey||e.metaKey)}var ZE=e=>{if(!rm(e)||nm(e)||e.isComposing||e.keyCode===229)return;const{key:t,code:n,keyCode:r,shiftKey:o,ctrlKey:i,metaKey:s,altKey:a}=e,l={key:t,code:n,keyCode:r,shiftKey:o,ctrlKey:i,metaKey:s,altKey:a},c=u=>FD(u,l);UE(l)?$f()&&Gl(Ff,c)&&sm(e):ID(l)?dE()&&Gl(cE,c)&&sm(e):jD(l)&&dE()&&fE()},QE=()=>{fE()},JE=e=>{if(!rm(e)||!RD(e.inputType)||e.isComposing||nm(e)||!$f())return;const t=e.inputType==="insertReplacementText",n=t?e.getTargetRanges?.()[0]:void 0;if(t&&!n)return;const r={inputType:e.inputType,data:t&&e.dataTransfer?.getData("text/plain")||e.data,target:n,targetText:n&&VE(n)};Gl(Ff,o=>GE(o,r))&&sm(e)};function VD(e){return"clipboardData"in e?e.clipboardData:e.dataTransfer}var GD=["text/html","text/plain"];function XD(e,t){const n=Array.from(t.types??[]),r=Object.fromEntries(GD.filter(o=>n.includes(o)).map(o=>[o,t.getData(o)]));return om({target:e.target,clipboardData:{types:Object.keys(r),files:[],getData:o=>r[o]??""},preventDefault:()=>{},stopPropagation:()=>{}})}function KD(e,t){if(nm(e)||!$f()||!rm(e))return!1;try{const n=VD(e);if(!n||n.files?.length)return!1;const r=XD(e,n);if(!Gl(Ff,()=>t(r)))return!1}catch{return e.preventDefault(),!1}return e.preventDefault(),e.stopPropagation(),!0}function YD(){return window.addEventListener("keydown",ZE,!0),window.addEventListener("beforeinput",JE,!0),window.addEventListener("pointerdown",QE,!0),{dispose(){window.removeEventListener("keydown",ZE,!0),window.removeEventListener("beforeinput",JE,!0),window.removeEventListener("pointerdown",QE,!0)}}}function ZD(e,t){const n=t==="sup"?"sub":"sup";e.querySelectorAll(`${t}, ${n}`).forEach(r=>{const o=r.parentNode;if(o){for(;r.firstChild;)o.insertBefore(r.firstChild,r);r.remove()}})}function eS(e,t,n){const r=document.createElement(n);try{if(typeof t=="string")r.textContent=t||e.toString();else if(t instanceof DocumentFragment)r.appendChild(t);else if(t&&we(t))for(;t.firstChild;)r.appendChild(t.firstChild);else r.textContent=e.toString();e.deleteContents(),e.insertNode(r)}catch{return null}return r}function QD(e){const t=e.parentNode;if(!t)return document.createTextNode("");if(Array.from(e.childNodes).some(n=>n.nodeType===1)){const n=document.createDocumentFragment(),r=Array.from(e.childNodes);for(;e.firstChild;)n.appendChild(e.firstChild);return t.replaceChild(n,e),r[0]||document.createTextNode("")}else{const n=e.textContent||"",r=document.createTextNode(n);return t.replaceChild(r,e),r}}function JD(e,t,n){if(!e)return!1;const r=e.textContent?.trim()||"";let o="";if(n){const i=t.cloneRange(),s=i;try{s.expand&&s.expand("word"),o=i.toString().trim()}catch{return!1}}else o=t.toString().trim();return r===o}function e5(e,t){const n=e.textContent||"",r=t.toString(),o=t.startOffset,i=t.endOffset,s=document.createTextNode(n.slice(0,o)),a=document.createTextNode(r),l=document.createTextNode(n.slice(i)),c=e.parentNode;return c&&(c.insertBefore(s,e),c.insertBefore(a,e),l.textContent&&c.insertBefore(l,e),e.remove()),t.setStart(a,0),t.setEnd(a,a.length),a}function t5(e,t=[]){const n=[...new Set(["strong","em","b","i","u","sub","sup","strike",...t])].join(", ");e.querySelectorAll(n).forEach(r=>{!r.textContent?.trim()&&(!r.hasChildNodes()||Array.from(r.childNodes).every(o=>o.nodeType===Node.TEXT_NODE&&!o.textContent?.trim()))&&r.remove()})}function tS(e,t=10){const n=e.length;return n===0?!1:(e.match(/[а-яА-ЯёЁ]/g)||[]).length/n*100>t}var n5={bold:"strong|s|b",italic:"em|i",strike:"strike",underline:"u",strikeUnderline:"strike|u"};function Ms(e,t){const n=n5[t]||t,r=new RegExp(`<\\/?(${n})>`,"gi");return e.replaceAll(r,"")}var r5=["strong","em","strike","sub","sup","b","i","s","u"];function o5(e,t){if(t)for(const n of r5)t.closest(n)&&e.querySelectorAll(n).forEach(r=>{const o=r.parentNode;if(o){for(;r.firstChild;)o.insertBefore(r.firstChild,r);r.remove()}})}function i5(e,t){t&&t.closest("a")&&e.querySelectorAll("a").forEach(n=>{const r=n.parentNode;if(r){for(;n.firstChild;)r.insertBefore(n.firstChild,n);n.remove()}})}var Xoe="#1C52DC",Koe="#1C52DC",Yoe="#1C52DC";function s5(e){if(typeof e.isContentEditable=="boolean")return e.isContentEditable;const t=e.closest("[contenteditable]");return!!t&&t.getAttribute("contenteditable")!=="false"}function nS(e,t,n,r){const o=document.createRange();return o.selectNodeContents(e),r?o.setStart(t,n):o.setEnd(t,n),o.toString()!==""||!!o.cloneContents().querySelector("br, img, em-replace, table, hr, input, button, video, audio, svg, picture, canvas, iframe, object")}function a5(e){const{startContainer:t,startOffset:n}=e,r=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest("a"),o=r?.parentElement;if(!e.collapsed||!r?.textContent||!o||!s5(o))return;const{display:i}=getComputedStyle(r);if(!(i&&i!=="inline")){if(!nS(r,t,n,!0))e.setStartAfter(r);else if(!nS(r,t,n,!1))e.setStartBefore(r);else return;e.collapse(!0)}}var l5="./js/sanitize-html/sanitize-html.js",rS="data-sanitize-html-loader",Xl=null,Ps=null;function oS(){return typeof __useblocks__<"u"?__useblocks__:void 0}function c5(e){const t=oS();if(typeof t?.moduleTransport!="function"||t.blobBlocked)return null;try{return t.moduleTransport(e)}catch{return null}}function u5(){const e=oS();e&&(e.blobBlocked=!0)}function d5(){return new URL(l5,document.baseURI||window.location.href).href}function am(){const e=globalThis.sanitizeHtml;return typeof e!="function"||!("defaults"in e)?null:e}function f5(){if(am())return Promise.resolve();const e=d5();return document.querySelector(`script[${rS}]`)?Ps??Promise.resolve():(Ps||(Ps=m5(e).catch(t=>{throw Ps=null,t})),Ps)}async function m5(e){const t=c5(e);if(!t)return Kl(e);const n=await t.catch(()=>null);if(!n)return Kl(e);const r=URL.createObjectURL(n),o=await Kl(r).then(()=>!0,()=>!1);URL.revokeObjectURL(r),o||(u5(),await Kl(e))}function Kl(e){return new Promise((t,n)=>{const r=document.createElement("script");r.src=e,r.async=!0,r.setAttribute(rS,"true"),r.onload=()=>t(),r.onerror=()=>{r.remove(),n(new Error(`Failed to load sanitize-html script: ${e}`))},document.head.appendChild(r)})}async function iS(){const e=am();return e||(Xl||(Xl=(async()=>{await f5();const t=am();if(t)return t;throw new Error("sanitizeHtml not available after script load")})().catch(t=>{throw Xl=null,t})),Xl)}function Yl(e){return e?.nodeType===Node.TEXT_NODE}function h5(e,t,n){if(t?.nodeType===Node.TEXT_NODE)return e.includes(t)?{text:t,offset:n}:null;if(!t||t!==e[0]?.parentNode)return null;const r=t.childNodes[n-1];if(r?.nodeType===Node.TEXT_NODE&&e.includes(r))return{text:r,offset:r.length};const o=t.childNodes[n];return o?.nodeType===Node.TEXT_NODE&&e.includes(o)?{text:o,offset:0}:null}function sS(e,t,n,r){const o=h5(e,n,r);if(!o)return null;let i=o.text,s=0;for(;i!==t&&i.previousSibling?.nodeType===Node.TEXT_NODE;)i=i.previousSibling,s+=i.length;return{head:i,offset:s+o.offset}}function aS(e,t,n,r){return e.node===t&&e.offset>n?{...e,offset:e.offset-r}:e}function lm(e,t,n=()=>"letter"){const r=e?.previousSibling,o=t?.nextSibling,i=Yl(r)&&n(r)==="letter",s=i&&Yl(e),a=Yl(t)&&Yl(o)&&(n(o)==="letter"||i&&n(o)==="new");if(!s&&!a)return;const l=window.getSelection(),c=s?r:e,u=a?o:t;if(!c||!u)return;const d=[];for(let y=c;y;y=y===u?null:y.nextSibling)d.push(y);const f=c.parentNode,h=Array.prototype.indexOf.call(f?.childNodes??[],u),m={node:l?.anchorNode??null,offset:l?.anchorOffset??0},p={node:l?.focusNode??null,offset:l?.focusOffset??0},S=sS(d,c,m.node,m.offset),C=sS(d,c,p.node,p.offset);let L=null,k=0;for(let y=c;y;){const g=y===u?null:y.nextSibling;y.nodeType!==Node.TEXT_NODE?L=null:L?(L.appendData(y.data),y.parentNode?.removeChild(y),k++):L=y,y=g}if(l&&(S||C)){const y=S?{node:S.head,offset:S.offset}:aS(m,f,h,k),g=C?{node:C.head,offset:C.offset}:aS(p,f,h,k);y.node&&g.node&&l.setBaseAndExtent(y.node,y.offset,g.node,g.offset)}}var p5=["strong","em","i","a","br","span","ul","ol","li","strike","sub","sup","s"],g5={a:["href"],span:["data-font-size","data-bold","data-italic"],strong:["data-italic"],ul:["data-list-type"],ol:["data-list-type","data-list-start"],li:["data-list-item"]};function b5(e){const t=/^\s*(\d+(?:\.\d+)?)(px|pt|em)?\s*$/i.exec(e??"");return t?`${t[1]}${(t[2]||"px").toLowerCase()}`:null}var y5=/<span\b(?:[^>"']|"[^"]*"|'[^']*')*>/gi,v5=/\sdata-(?:buffer|metadata)=(?:"[^"]*"|'[^']*')/gi;function E5(e){return e.replace(y5,t=>t.replace(v5,""))}function S5(e){const t=window.clipboardData;return("clipboardData"in e?e.clipboardData:e.dataTransfer)||t}function w5(e){return _5(e.replace(/\r\n?/g,`
|
|
31
|
+
`).replace(/\n$/,"").replace(/&/g,"&").replace(/\n/g,"<br>"))}function _5(e){const t=new DOMParser().parseFromString(`<body>${e}`,"text/html").body;return t.querySelectorAll("script").forEach(n=>n.remove()),t.querySelectorAll("*").forEach(n=>{Array.from(n.attributes).forEach(r=>{/^on/i.test(r.name)&&n.removeAttribute(r.name)})}),t.innerHTML}var Rr=new Map,C5=3e3,T5=1e4;function A5(){const e=performance.now();return[...Rr.values()].some(t=>t.waiting&&e-t.startedAt<T5)}function k5(){for(const[e,t]of Rr)t.waiting&&(t.superseded=!0,Rr.delete(e))}function L5(){return Rr.size>0}async function N5(){let e;const t=new Promise(r=>{e=setTimeout(()=>{r()},C5)}),n=(async()=>{for(;Rr.size;)await Promise.allSettled(Rr.keys())})();await Promise.race([n,t]),clearTimeout(e)}function Zl(e,t=!1,n,r,o){if(KD(e,a=>{Zl(a,t,n,r,o)}))return Promise.resolve();if(A5())return e.preventDefault(),e.stopPropagation(),Promise.resolve();k5();const i={startedAt:performance.now(),waiting:!0,superseded:!1},s=x5(e,t,n,r,o,i);return Rr.set(s,i),s.finally(()=>Rr.delete(s))}function lS(){const e=window.getSelection();e?.rangeCount&&a5(e.getRangeAt(0))}async function x5(e,t,n,r,o,i){e.preventDefault(),e.stopPropagation();const s=S5(e);if(!s)return;const a=s.getData("text/html"),l=s.getData("text/plain");try{let c=a;if(!c||t)lS(),c=w5(l);else{const d=await iS();if(i.superseded)return;lS();const f=n?.text?.fontSize||16;let h=d(E5(c),{allowedTags:p5,allowedAttributes:g5,allowedStyles:{},transformTags:{span:function(y,g){let v="",w=!1,b=!1;if(g.style){const E=g.style.toLowerCase();(E.includes("font-weight: bold")||E.includes("font-weight:bold")||E.includes("font-weight: 700")||E.includes("font-weight:700"))&&(w=!0),(E.includes("font-style: italic")||E.includes("font-style:italic"))&&(b=!0),E.includes("text-decoration: underline")||E.includes("text-decoration:underline"),w&&b?(v="strong",g["data-italic"]="true"):w?v="strong":b&&(v="em")}return{tagName:v||"",attribs:g}},h1:function(y,g){return g["data-font-size"]=Math.round(1.5*f).toString(),g.style&&(g.style.toLowerCase().includes("font-style: italic")||g.style.toLowerCase().includes("font-style:italic"))&&(g["data-italic"]="true"),{tagName:"span",attribs:g}},h2:function(y,g){return g["data-font-size"]=Math.round(1.25*f).toString(),g.style&&(g.style.toLowerCase().includes("font-style: italic")||g.style.toLowerCase().includes("font-style:italic"))&&(g["data-italic"]="true"),{tagName:"span",attribs:g}},h3:function(y,g){return g["data-font-size"]=Math.round(1.125*f).toString(),g.style&&(g.style.toLowerCase().includes("font-style: italic")||g.style.toLowerCase().includes("font-style:italic"))&&(g["data-italic"]="true"),{tagName:"span",attribs:g}},h4:function(y,g){return g["data-font-size"]=f.toString(),g["data-bold"]="true",g.style&&(g.style.toLowerCase().includes("font-style: italic")||g.style.toLowerCase().includes("font-style:italic"))&&(g["data-italic"]="true"),{tagName:"span",attribs:g}},h5:function(y,g){return g["data-font-size"]=Math.round(.875*f).toString(),g.style&&(g.style.toLowerCase().includes("font-style: italic")||g.style.toLowerCase().includes("font-style:italic"))&&(g["data-italic"]="true"),{tagName:"span",attribs:g}},ul:function(y,g){return g["data-list-type"]="unordered",delete g.style,delete g["margin-top"],delete g["margin-bottom"],delete g["padding-inline-start"],{tagName:"ul",attribs:g}},ol:function(y,g){return g["data-list-type"]="ordered",g.start&&(g["data-list-start"]=g.start),delete g.style,delete g.start,{tagName:"ol",attribs:g}},li:function(y,g){return g["data-list-item"]="true",delete g.style,delete g.dir,delete g["aria-level"],delete g["list-style-type"],{tagName:"li",attribs:g}},p:function(y,g){return{tagName:"br",attribs:{}}},div:"br",b:function(y,g){if(g.style){const v=g.style.toLowerCase();return v.includes("font-weight: bold")||v.includes("font-weight:bold")||v.includes("font-weight: 700")||v.includes("font-weight:700")?{tagName:"strong"}:!1}return{tagName:"strong"}},i:function(y,g){if(g.style){const v=g.style.toLowerCase();return v.includes("font-style: italic")||v.includes("font-style:italic")?{tagName:"em"}:!1}return{tagName:"em"}},s:function(y,g){return{tagName:"strike",attribs:g}}},textFilter:function(y){return y.replace(/\s+/g," ")}});h=h.replace(/<[^\/>][^>]*>\s*<\/[^>]+>/g,"").replace(/(<br\s*\/?>){2,}/g,"<br>").trim();const m=document.createElement("div");m.innerHTML=h,(y=>{y.querySelectorAll("ul[data-list-type], ol[data-list-type]").forEach((g,v)=>{const w=g.getAttribute("data-list-type")==="ordered",b=g.querySelectorAll("li[data-list-item]");let E=1;w&&g.getAttribute("data-list-start")&&(E=parseInt(g.getAttribute("data-list-start"),10)||1);const _=document.createDocumentFragment(),T=g.previousSibling;T&&(T.nodeType===Node.TEXT_NODE&&T.textContent.trim()!==""||T.nodeType===Node.ELEMENT_NODE&&T.tagName!=="BR")&&_.appendChild(document.createElement("br")),b.forEach((x,N)=>{const D=document.createElement("span");D.innerHTML=w?`${E}. `:"• ",_.appendChild(D),(O=>{const q=document.createElement("div");q.innerHTML=O.innerHTML;let ee=q.firstChild;for(;ee&&ee.nodeType===1&&ee.tagName==="BR";)q.removeChild(ee),ee=q.firstChild;if(!q.hasChildNodes()){const de=document.createTextNode("");q.appendChild(de)}for(;q.firstChild;)_.appendChild(q.firstChild)})(x),N<b.length-1&&_.appendChild(document.createElement("br")),E++}),g.parentNode.replaceChild(_,g)}),y.querySelectorAll("[data-list-type], [data-list-item], [data-list-start]").forEach(g=>{g.removeAttribute("data-list-type"),g.removeAttribute("data-list-item"),g.removeAttribute("data-list-start")})})(m),m.firstChild&&m.firstChild.nodeType===Node.ELEMENT_NODE&&m.firstChild.tagName==="BR"&&m.removeChild(m.firstChild),m.querySelectorAll("[data-font-size]").forEach(y=>{const g=b5(y.getAttribute("data-font-size"));let v=g?`font-size: ${g};`:"";y.getAttribute("data-bold")==="true"&&(v+=" font-weight: bold;"),y.getAttribute("data-italic")==="true"&&(v+=" font-style: italic;"),v&&y.setAttribute("style",v.trim()),y.removeAttribute("data-font-size"),y.removeAttribute("data-bold"),y.removeAttribute("data-italic")}),m.querySelectorAll("[data-italic]").forEach(y=>{const g=document.createElement("em");g.innerHTML=y.innerHTML,y.innerHTML="",y.appendChild(g),y.removeAttribute("data-italic")}),m.querySelectorAll("a").forEach(y=>{const g=y.getAttribute("href");if(!g||g.trim()==="")y.replaceWith(...y.childNodes);else{y.setAttribute("target","_blank");const v=n?.links?.color??"#1C52DC",w=n?.links?.underline??!0?"underline":"none";y.setAttribute("style",`color: ${v}; text-decoration: ${w};`)}});const S=m.querySelectorAll("*");let C=0;S.forEach(y=>{y.tagName!=="BR"&&y.tagName!=="SPAN"&&y.textContent.replace(/[\u200B-\u200F\uFEFF\u2000-\u200A\u2028\u2029\u2060\u00A0\u1680\u180E]/g,"").trim()===""&&(y.parentNode.removeChild(y),C++)}),m.querySelectorAll("span").forEach(y=>{y.innerHTML==="• "||/^\d+\. $/.test(y.innerHTML)||y.textContent.replace(/[\u200B-\u200F\uFEFF\u2000-\u200A\u2028\u2029\u2060\u00A0\u1680\u180E]/g,"").trim()===""&&y.children.length===0&&(y.parentNode.removeChild(y),C++)});const L=window.getSelection(),k=L?.anchorNode?.nodeType===Node.ELEMENT_NODE?L.anchorNode:L?.anchorNode?.parentElement||null;o5(m,k),i5(m,k),c=m.innerHTML}const u=window.getSelection();if(u&&u.rangeCount>0){const d=u.getRangeAt(0);PE(d),d.deleteContents();const f=document.createRange().createContextualFragment(c),h=f.firstChild,m=f.lastChild;d.insertNode(f),m?.nodeType===Node.TEXT_NODE&&d.setEnd(m,m.length),d.collapse(!1),lm(h,m,Uf)}}catch{if(i.superseded)return;ur("insertText",!1,l)}i.waiting=!1,r(e),o(),await new Promise(c=>setTimeout(c,0))}var Ql=e=>e?.trim().replaceAll(/[\s\u00A0]+/g," ").replaceAll(/\n/g,"");function cS(e){let t=e;for(;t;){if(t.tagName==="TR")return t;t=t.parentElement}return null}function ho(e,t){return Array.from(e.classList).find(n=>n.includes(t))}function uS(e){return!e||!e.childNodes?!1:Array.from(e.childNodes).every(t=>t.nodeType===Node.TEXT_NODE?(t.textContent?.trim()??"")!=="":t.nodeType===Node.ELEMENT_NODE?uS(t):!1)}function B(e){const t=document.createElement(e.tag||"div");if(t.setAttribute("contentEditable","false"),e.width&&(t.style.width=e.width+"px"),e.height&&(t.style.height=e.height+"px"),e.left&&(t.style.left=e.left+"px"),e.top&&(t.style.top=e.top+"px"),e.className&&(t.className=e.className),e.style&&t.setAttribute("style",e.style),e.HTMLcontent&&(t.innerHTML=e.HTMLcontent),e.title&&t.setAttribute("title",e.title),e["data-id"]&&t.setAttribute("data-id",e["data-id"]),e.targetElement){const n=typeof e.targetElement=="string"?document.querySelector(e.targetElement):e.targetElement;if(n)switch(e.insertType){case"append":n.append(t);break;case"prepend":n.prepend(t);break;case"before":n.before(t);break;case"after":n.after(t);break;case"replaceWith":n.replaceWith(t)}}return t}function O5(e){try{return JSON.parse(e),!0}catch{return!1}}function dS(e,t,n=2){const r=e.split(""),o=t.split("");if(Math.abs(r.length-o.length)>n)return!1;let i=0;if(r.length===o.length){for(let s=0;s<r.length;s++)if(r[s]!==o[s]&&(i++,i>n))return!1}else{const s=r.length>o.length?r:o,a=r.length>o.length?o:r;let l=0,c=0;for(;l<s.length&&c<a.length;)if(s[l]!==a[c]){if(i++,i>n)return!1;l++}else l++,c++;if(l<s.length&&i++,i>1)return!1}return!0}function ri(e){const t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e))}function R5(e){const t=e.style?.fontWeight;if(typeof t=="number")return t>=600;if(typeof t=="string"){const n=t.toLowerCase();return n.includes("bold")||n.includes("black")||parseInt(n)>=600}return!1}function Jl(){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0).commonAncestorContainer;return t.nodeType===1?t:t.parentElement}function cm(e,t=null){const n=e?.innerText;for(;e!==null;){if(e.innerText===n){const r=e.parentElement;if(r===null||r.innerText!==n||r.tagName==="EDITOR"||e.tagName===t?.toUpperCase())return e.tagName===t?.toUpperCase()||!t?e:null}e=e.parentElement}return null}function Is(e,t=Jl()){e=Ql(e)??"";const n=i=>Ql(i?.textContent||"")??"",r=Array.from(t?.childNodes||[]).filter(i=>!!i&&i.nodeName!=="BR");let o=null;if(t&&t.nodeType===Node.TEXT_NODE&&n(t).includes(e)&&n(t)===e)return t;for(let i=0;i<r.length;i++){const s=r[i];if(s.nodeType===Node.TEXT_NODE&&n(s).includes(e)&&n(s)===e){o=s.parentNode;break}else if(s.nodeType===Node.ELEMENT_NODE&&(o=Is(e,s),o))break}return o}function ec(e){const t=Array.from(e),n=t.map(i=>i.clientWidth),r=n.reduce((i,s)=>i+s,0),o=n.map(i=>((i||0)/r*100).toFixed(1));t.forEach((i,s)=>{i.setAttribute("data-percent",o[s])})}function tc(e){e.elem.nodeName==="#comment"&&e.elem.textContent&&e.elem.textContent.indexOf("mso")>-1?e.elem.textContent=e.elem.textContent.replace(/width=".*"/gi,`width="${e.width}"`):e.elem.previousSibling&&tc({elem:e.elem.previousSibling,width:e.width})}function M5(e){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let o=0;for(;o<e;)t+=n.charAt(Math.floor(Math.random()*62)),o+=1;return t}var P5=e=>{if(e instanceof Text)return e.textContent||"";if(e instanceof Element){if(e.tagName==="BR")return`
|
|
32
|
+
`;if(e.classList?.contains(".em-element-path"))return"";if(e.classList?.contains("em-code"))return"⃠";if(e.tagName==="EM-REPLACE")return"⃡"}};function fS(e,t){if(!e)return"";const n=t(e);return n===void 0?[...e.childNodes].map(r=>fS(r,t)).join(""):n}function I5(e,t,n,r){e.setAttribute("style",n?.getAttribute("style")||t.getAttribute("innerStyle")||t.getAttribute("style")||""),e.style.color=r(e.style.color)??"",e.style.backgroundColor=r(e.style.backgroundColor)??"";const o=t.getAttribute("innerClass");o&&(e.className=o);const i=t.getAttribute("innerHref"),s=t.getAttribute("href"),a=n.getAttribute("href");(i!==null||s!==null||a!==null)&&(t.tagName==="A"||n.tagName==="A")&&e.setAttribute("href",i??s??a??"");const l=t.getAttribute("innerTarget");l&&e.setAttribute("target",l);const c=t.getAttribute("innerAlign");c&&e.setAttribute("align",c);const u=n.hasAttribute("em-edit")?n:n.querySelector("[em-edit]");u&&e.setAttribute("em-edit",u.getAttribute("em-edit")||"")}function D5(e,t=!0){const n=document.createRange(),r=window.getSelection();r&&(n.selectNodeContents(e),n.collapse(t),r.removeAllRanges(),r.addRange(n))}function B5(e){let t=!1;return e&&e.childNodes.forEach(n=>{if(n.nodeType===Node.TEXT_NODE&&n.nodeValue?.trim()!==""){const r=n.nodeValue?.trim()||"";/[a-zA-Zа-яА-Я]/.test(r)&&(t=!0)}}),t}function Ds(){return $P()}function H5(e,t=!1){if(e.closest("EDITOR")||!e.isConnected)return!0;let n=!1;if(!t)for(const r of Array.from(e.childNodes))if(r.tagName==="EDITOR"){if(n)return!1;n=!0}else return!1;return n}function mS(e,t){if(e instanceof Text){const n=e.textContent,r=n;n!==r&&e.replaceWith(...t(r||""))}else if(e instanceof Element){const n=[...e.childNodes];if(e.tagName==="EDITOR")e.replaceWith(...n);else if(e.tagName==="SPAN"&&e.classList.contains("mce-nbsp-wrap"))return;for(const r of n)mS(r,t)}}function F5(e=document){e.querySelectorAll('[em-edit="active"]').forEach(t=>t.removeAttribute("em-edit"))}var $5=0;function pt(e){return e>=48&&e<=57}function Mr(e){return pt(e)||e>=65&&e<=70||e>=97&&e<=102}function um(e){return e>=65&&e<=90}function W5(e){return e>=97&&e<=122}function q5(e){return um(e)||W5(e)}function z5(e){return e>=128}function nc(e){return q5(e)||z5(e)||e===95}function hS(e){return nc(e)||pt(e)||e===45}function U5(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function rc(e){return e===10||e===13||e===12}function po(e){return rc(e)||e===32||e===9}function Hn(e,t){return!(e!==92||rc(t)||t===$5)}function oc(e,t,n){return e===45?nc(t)||t===45||Hn(t,n):nc(e)?!0:e===92?Hn(e,t):!1}function dm(e,t,n){return e===43||e===45?pt(t)?2:t===46&&pt(n)?3:0:e===46?pt(t)?2:0:pt(e)?1:0}function pS(e){return e===65279||e===65534?1:0}var fm=new Array(128),Zoe=128,Qoe=130,Joe=131,eie=132,tie=133;for(let e=0;e<fm.length;e++)fm[e]=po(e)&&130||pt(e)&&131||nc(e)&&132||U5(e)&&133||e||128;function mm(e){return e<128?fm[e]:132}function oi(e,t){return t<e.length?e.charCodeAt(t):0}function hm(e,t,n){return n===13&&oi(e,t+1)===10?2:1}function ii(e,t,n){let r=e.charCodeAt(t);return um(r)&&(r=r|32),r===n}function Bs(e,t,n,r){if(n-t!==r.length||t<0||n>e.length)return!1;for(let o=t;o<n;o++){const i=r.charCodeAt(o-t);let s=e.charCodeAt(o);if(um(s)&&(s=s|32),s!==i)return!1}return!0}function j5(e,t){for(;t>=0&&po(e.charCodeAt(t));t--);return t+1}function ic(e,t){for(;t<e.length&&po(e.charCodeAt(t));t++);return t}function pm(e,t){for(;t<e.length&&pt(e.charCodeAt(t));t++);return t}function si(e,t){if(t+=2,Mr(oi(e,t-1))){for(const r=Math.min(e.length,t+5);t<r&&Mr(oi(e,t));t++);const n=oi(e,t);po(n)&&(t+=hm(e,t,n))}return t}function sc(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(!hS(n)){if(Hn(n,oi(e,t+1))){t=si(e,t)-1;continue}break}}return t}function ac(e,t){let n=e.charCodeAt(t);if((n===43||n===45)&&(n=e.charCodeAt(t+=1)),pt(n)&&(t=pm(e,t+1),n=e.charCodeAt(t)),n===46&&pt(e.charCodeAt(t+1))&&(t+=2,t=pm(e,t)),ii(e,t,101)){let r=0;n=e.charCodeAt(t+1),(n===45||n===43)&&(r=1,n=e.charCodeAt(t+2)),pt(n)&&(t=pm(e,t+1+r+1))}return t}function gm(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(n===41){t++;break}Hn(n,oi(e,t+1))&&(t=si(e,t))}return t}function gS(e){if(e.length===1&&!Mr(e.charCodeAt(0)))return e[0];let t=parseInt(e,16);return(t===0||t>=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var bS=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token"],V5=16384;function lc(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,V5)):e}var yS=10,G5=12,vS=13;function ES(e){const t=e.source,n=t.length,r=t.length>0?pS(t.charCodeAt(0)):0,o=lc(e.lines,n),i=lc(e.columns,n);let s=e.startLine,a=e.startColumn;for(let l=r;l<n;l++){const c=t.charCodeAt(l);o[l]=s,i[l]=a++,(c===yS||c===vS||c===G5)&&(c===vS&&l+1<n&&t.charCodeAt(l+1)===yS&&(l++,o[l]=s,i[l]=a),s++,a=1)}o[n]=s,i[n]=a,e.lines=o,e.columns=i,e.computed=!0}var X5=class{constructor(){this.lines=null,this.columns=null,this.computed=!1}setSource(e,t=0,n=1,r=1){this.source=e,this.startOffset=t,this.startLine=n,this.startColumn=r,this.computed=!1}getLocation(e,t){return this.computed||ES(this),{source:t,offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]}}getLocationRange(e,t,n){return this.computed||ES(this),{source:n,start:{offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]},end:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}}},on=16777215,Pr=24,K5=new Map([[2,22],[21,22],[19,20],[23,24]]),Y5=class{constructor(e,t){this.setSource(e,t)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(e="",t=()=>{}){e=String(e||"");const n=e.length,r=lc(this.offsetAndType,e.length+1),o=lc(this.balance,e.length+1);let i=0,s=0,a=0,l=-1;for(this.offsetAndType=null,this.balance=null,t(e,(c,u,d)=>{switch(c){default:o[i]=n;break;case s:{let f=a&on;for(a=o[f],s=a>>Pr,o[i]=f,o[f++]=i;f<i;f++)o[f]===n&&(o[f]=i);break}case 21:case 2:case 19:case 23:o[i]=a,s=K5.get(c),a=s<<Pr|i}r[i++]=c<<Pr|d,l===-1&&(l=u)}),r[i]=0<<Pr|n,o[i]=n,o[n]=n;a!==0;){const c=a&on;a=o[c],o[c]=n}this.source=e,this.firstCharOffset=l===-1?0:l,this.tokenCount=i,this.offsetAndType=r,this.balance=o,this.reset(),this.next()}lookupType(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e]>>Pr:0}lookupOffset(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e-1]&on:this.source.length}lookupValue(e,t){return e+=this.tokenIndex,e<this.tokenCount?Bs(this.source,this.offsetAndType[e-1]&on,this.offsetAndType[e]&on,t):!1}getTokenStart(e){return e===this.tokenIndex?this.tokenStart:e>0?e<this.tokenCount?this.offsetAndType[e-1]&on:this.offsetAndType[this.tokenCount]&on:this.firstCharOffset}substrToCursor(e){return this.source.substring(e,this.tokenStart)}isBalanceEdge(e){return this.balance[this.tokenIndex]<e}isDelim(e,t){return t?this.lookupType(t)===9&&this.source.charCodeAt(this.lookupOffset(t))===e:this.tokenType===9&&this.source.charCodeAt(this.tokenStart)===e}skip(e){let t=this.tokenIndex+e;t<this.tokenCount?(this.tokenIndex=t,this.tokenStart=this.offsetAndType[t-1]&on,t=this.offsetAndType[t],this.tokenType=t>>Pr,this.tokenEnd=t&on):(this.tokenIndex=this.tokenCount,this.next())}next(){let e=this.tokenIndex+1;e<this.tokenCount?(this.tokenIndex=e,this.tokenStart=this.tokenEnd,e=this.offsetAndType[e],this.tokenType=e>>Pr,this.tokenEnd=e&on):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===13||this.tokenType===25;)this.next()}skipUntilBalanced(e,t){let n=e,r,o;e:for(;n<this.tokenCount;n++){if(r=this.balance[n],r<e)break e;switch(o=n>0?this.offsetAndType[n-1]&on:this.firstCharOffset,t(this.source.charCodeAt(o))){case 1:break e;case 2:n++;break e;default:this.balance[r]===n&&(n=r)}}this.skip(n-this.tokenIndex)}forEachToken(e){for(let t=0,n=this.firstCharOffset;t<this.tokenCount;t++){const r=n,o=this.offsetAndType[t],i=o&on,s=o>>Pr;n=i,e(s,r,i,t)}}dump(){const e=new Array(this.tokenCount);return this.forEachToken((t,n,r,o)=>{e[o]={idx:o,type:bS[t],chunk:this.source.substring(n,r),balance:this.balance[o]}}),e}};function cc(e,t){function n(d){return d<a?e.charCodeAt(d):0}function r(){if(c=ac(e,c),oc(n(c),n(c+1),n(c+2))){u=12,c=sc(e,c);return}if(n(c)===37){u=11,c++;return}u=10}function o(){const d=c;if(c=sc(e,c),Bs(e,d,c,"url")&&n(c)===40){if(c=ic(e,c+1),n(c)===34||n(c)===39){u=2,c=d+4;return}s();return}if(n(c)===40){u=2,c++;return}u=1}function i(d){for(d||(d=n(c++)),u=5;c<e.length;c++){const f=e.charCodeAt(c);switch(mm(f)){case d:c++;return;case 130:if(rc(f)){c+=hm(e,c,f),u=6;return}break;case 92:if(c===e.length-1)break;const h=n(c+1);rc(h)?c+=hm(e,c+1,h):Hn(f,h)&&(c=si(e,c)-1)}}}function s(){for(u=7,c=ic(e,c);c<e.length;c++){const d=e.charCodeAt(c);switch(mm(d)){case 41:c++;return;case 130:if(c=ic(e,c),n(c)===41||c>=e.length){c<e.length&&c++;return}c=gm(e,c),u=8;return;case 34:case 39:case 40:case 133:c=gm(e,c),u=8;return;case 92:if(Hn(d,n(c+1))){c=si(e,c)-1;break}c=gm(e,c),u=8;return}}}e=String(e||"");const a=e.length;let l=pS(n(0)),c=l,u;for(;c<a;){const d=e.charCodeAt(c);switch(mm(d)){case 130:u=13,c=ic(e,c+1);break;case 34:i();break;case 35:hS(n(c+1))||Hn(n(c+1),n(c+2))?(u=4,c=sc(e,c+1)):(u=9,c++);break;case 39:i();break;case 40:u=21,c++;break;case 41:u=22,c++;break;case 43:dm(d,n(c+1),n(c+2))?r():(u=9,c++);break;case 44:u=18,c++;break;case 45:dm(d,n(c+1),n(c+2))?r():n(c+1)===45&&n(c+2)===62?(u=15,c=c+3):oc(d,n(c+1),n(c+2))?o():(u=9,c++);break;case 46:dm(d,n(c+1),n(c+2))?r():(u=9,c++);break;case 47:n(c+1)===42?(u=25,c=e.indexOf("*/",c+2),c=c===-1?e.length:c+2):(u=9,c++);break;case 58:u=16,c++;break;case 59:u=17,c++;break;case 60:n(c+1)===33&&n(c+2)===45&&n(c+3)===45?(u=14,c=c+4):(u=9,c++);break;case 64:oc(n(c+1),n(c+2),n(c+3))?(u=3,c=sc(e,c+1)):(u=9,c++);break;case 91:u=19,c++;break;case 92:Hn(d,n(c+1))?o():(u=9,c++);break;case 93:u=20,c++;break;case 123:u=23,c++;break;case 125:u=24,c++;break;case 131:r();break;case 132:o();break;default:u=9,c++}t(u,l,l=c)}}var ai=null,Qe=class Mn{static createItem(t){return{prev:null,next:null,data:t}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(t){return Mn.createItem(t)}allocateCursor(t,n){let r;return ai!==null?(r=ai,ai=ai.cursor,r.prev=t,r.next=n,r.cursor=this.cursor):r={prev:t,next:n,cursor:this.cursor},this.cursor=r,r}releaseCursor(){const{cursor:t}=this;this.cursor=t.cursor,t.prev=null,t.next=null,t.cursor=ai,ai=t}updateCursors(t,n,r,o){let{cursor:i}=this;for(;i!==null;)i.prev===t&&(i.prev=n),i.next===r&&(i.next=o),i=i.cursor}*[Symbol.iterator](){for(let t=this.head;t!==null;t=t.next)yield t.data}get size(){let t=0;for(let n=this.head;n!==null;n=n.next)t++;return t}get isEmpty(){return this.head===null}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(t){let n=null;this.head=null;for(let r of t){const o=Mn.createItem(r);n!==null?n.next=o:this.head=o,o.prev=n,n=o}return this.tail=n,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(t,n=this){const r=this.allocateCursor(null,this.head);for(;r.next!==null;){const o=r.next;r.next=o.next,t.call(n,o.data,o,this)}this.releaseCursor()}forEachRight(t,n=this){const r=this.allocateCursor(this.tail,null);for(;r.prev!==null;){const o=r.prev;r.prev=o.prev,t.call(n,o.data,o,this)}this.releaseCursor()}reduce(t,n,r=this){let o=this.allocateCursor(null,this.head),i=n,s;for(;o.next!==null;)s=o.next,o.next=s.next,i=t.call(r,i,s.data,s,this);return this.releaseCursor(),i}reduceRight(t,n,r=this){let o=this.allocateCursor(this.tail,null),i=n,s;for(;o.prev!==null;)s=o.prev,o.prev=s.prev,i=t.call(r,i,s.data,s,this);return this.releaseCursor(),i}some(t,n=this){for(let r=this.head;r!==null;r=r.next)if(t.call(n,r.data,r,this))return!0;return!1}map(t,n=this){const r=new Mn;for(let o=this.head;o!==null;o=o.next)r.appendData(t.call(n,o.data,o,this));return r}filter(t,n=this){const r=new Mn;for(let o=this.head;o!==null;o=o.next)t.call(n,o.data,o,this)&&r.appendData(o.data);return r}nextUntil(t,n,r=this){if(t===null)return;const o=this.allocateCursor(null,t);for(;o.next!==null;){const i=o.next;if(o.next=i.next,n.call(r,i.data,i,this))break}this.releaseCursor()}prevUntil(t,n,r=this){if(t===null)return;const o=this.allocateCursor(t,null);for(;o.prev!==null;){const i=o.prev;if(o.prev=i.prev,n.call(r,i.data,i,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){const t=new Mn;for(let n of this)t.appendData(n);return t}prepend(t){return this.updateCursors(null,t,this.head,t),this.head!==null?(this.head.prev=t,t.next=this.head):this.tail=t,this.head=t,this}prependData(t){return this.prepend(Mn.createItem(t))}append(t){return this.insert(t)}appendData(t){return this.insert(Mn.createItem(t))}insert(t,n=null){if(n!==null)if(this.updateCursors(n.prev,t,n,t),n.prev===null){if(this.head!==n)throw new Error("before doesn't belong to list");this.head=t,n.prev=t,t.next=n,this.updateCursors(null,t)}else n.prev.next=t,t.prev=n.prev,n.prev=t,t.next=n;else this.updateCursors(this.tail,t,null,t),this.tail!==null?(this.tail.next=t,t.prev=this.tail):this.head=t,this.tail=t;return this}insertData(t,n){return this.insert(Mn.createItem(t),n)}remove(t){if(this.updateCursors(t,t.prev,t,t.next),t.prev!==null)t.prev.next=t.next;else{if(this.head!==t)throw new Error("item doesn't belong to list");this.head=t.next}if(t.next!==null)t.next.prev=t.prev;else{if(this.tail!==t)throw new Error("item doesn't belong to list");this.tail=t.prev}return t.prev=null,t.next=null,t}push(t){this.insert(Mn.createItem(t))}pop(){return this.tail!==null?this.remove(this.tail):null}unshift(t){this.prepend(Mn.createItem(t))}shift(){return this.head!==null?this.remove(this.head):null}prependList(t){return this.insertList(t,this.head)}appendList(t){return this.insertList(t)}insertList(t,n){return t.head===null?this:(n!=null?(this.updateCursors(n.prev,t.tail,n,t.head),n.prev!==null?(n.prev.next=t.head,t.head.prev=n.prev):this.head=t.head,n.prev=t.tail,t.tail.next=n):(this.updateCursors(this.tail,t.tail,null,t.head),this.tail!==null?(this.tail.next=t.head,t.head.prev=this.tail):this.head=t.head,this.tail=t.tail),t.head=null,t.tail=null,this)}replace(t,n){"head"in n?this.insertList(n,t):this.insert(n,t),this.remove(t)}};function uc(e,t){const n=Object.create(SyntaxError.prototype),r=new Error;return Object.assign(n,{name:e,message:t,get stack(){return(r.stack||"").replace(/^(.+\n){1,3}/,`${e}: ${t}
|
|
33
|
+
`)}})}var SS=100,Z5=60,Q5=" ";function wS({source:e,line:t,column:n},r){function o(u,d){return i.slice(u,d).map((f,h)=>String(u+h+1).padStart(l)+" |"+f).join(`
|
|
34
|
+
`)}const i=e.split(/\r\n?|\n|\f/),s=Math.max(1,t-r)-1,a=Math.min(t+r,i.length+1),l=Math.max(4,String(a).length)+1;let c=0;n+=3*(i[t-1].substr(0,n-1).match(/\t/g)||[]).length,n>SS&&(c=n-Z5+3,n=58);for(let u=s;u<=a;u++)u>=0&&u<i.length&&(i[u]=i[u].replace(/\t/g,Q5),i[u]=(c>0&&i[u].length>c?"…":"")+i[u].substr(c,98)+(i[u].length>c+SS-1?"…":""));return[o(s,t),new Array(n+l+2).join("-")+"^",o(t,a)].filter(Boolean).join(`
|
|
35
|
+
`)}function _S(e,t,n,r,o){return Object.assign(uc("SyntaxError",e),{source:t,offset:n,line:r,column:o,sourceFragment(i){return wS({source:t,line:r,column:o},isNaN(i)?0:i)},get formattedMessage(){return`Parse error: ${e}
|
|
36
|
+
`+wS({source:t,line:r,column:o},2)}})}function J5(e){const t=this.createList();let n=!1;const r={recognizer:e};for(;!this.eof;){switch(this.tokenType){case 25:this.next();continue;case 13:n=!0,this.next();continue}let o=e.getNode.call(this,r);if(o===void 0)break;n&&(e.onWhiteSpace&&e.onWhiteSpace.call(this,o,t,r),n=!1),t.push(o)}return n&&e.onWhiteSpace&&e.onWhiteSpace.call(this,null,t,r),t}var CS=()=>{},e3=33,t3=35,bm=59,TS=123,AS=0;function n3(e){return function(){return this[e]()}}function ym(e){const t=Object.create(null);for(const n in e){const r=e[n],o=r.parse||r;o&&(t[n]=o)}return t}function r3(e){const t={context:Object.create(null),scope:Object.assign(Object.create(null),e.scope),atrule:ym(e.atrule),pseudo:ym(e.pseudo),node:ym(e.node)};for(const n in e.parseContext)switch(typeof e.parseContext[n]){case"function":t.context[n]=e.parseContext[n];break;case"string":t.context[n]=n3(e.parseContext[n])}return{config:t,...t,...t.node}}function o3(e){let t="",n="<unknown>",r=!1,o=CS,i=!1;const s=new X5,a=Object.assign(new Y5,r3(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:J5,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(c){return c===TS?1:0},consumeUntilLeftCurlyBracketOrSemicolon(c){return c===TS||c===bm?1:0},consumeUntilExclamationMarkOrSemicolon(c){return c===e3||c===bm?1:0},consumeUntilSemicolonIncluded(c){return c===bm?2:0},createList(){return new Qe},createSingleNodeList(c){return new Qe().appendData(c)},getFirstListNode(c){return c&&c.first},getLastListNode(c){return c&&c.last},parseWithFallback(c,u){const d=this.tokenIndex;try{return c.call(this)}catch(f){if(i)throw f;const h=u.call(this,d);return i=!0,o(f,h),i=!1,h}},lookupNonWSType(c){let u;do if(u=this.lookupType(c++),u!==13)return u;while(u!==AS);return AS},charCodeAt(c){return c>=0&&c<t.length?t.charCodeAt(c):0},substring(c,u){return t.substring(c,u)},substrToCursor(c){return this.source.substring(c,this.tokenStart)},cmpChar(c,u){return ii(t,c,u)},cmpStr(c,u,d){return Bs(t,c,u,d)},consume(c){const u=this.tokenStart;return this.eat(c),this.substrToCursor(u)},consumeFunctionName(){const c=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(2),c},consumeNumber(c){const u=t.substring(this.tokenStart,ac(t,this.tokenStart));return this.eat(c),u},eat(c){if(this.tokenType!==c){const u=bS[c].slice(0,-6).replace(/-/g," ").replace(/^./,h=>h.toUpperCase());let d=`${/[[\](){}]/.test(u)?`"${u}"`:u} is expected`,f=this.tokenStart;switch(c){case 1:this.tokenType===2||this.tokenType===7?(f=this.tokenEnd-1,d="Identifier is expected but function found"):d="Identifier is expected";break;case 4:this.isDelim(t3)&&(this.next(),f++,d="Name is expected");break;case 11:this.tokenType===10&&(f=this.tokenEnd,d="Percent sign is expected")}this.error(d,f)}this.next()},eatIdent(c){(this.tokenType!==1||this.lookupValue(0,c)===!1)&&this.error(`Identifier "${c}" is expected`),this.next()},eatDelim(c){this.isDelim(c)||this.error(`Delim "${String.fromCharCode(c)}" is expected`),this.next()},getLocation(c,u){return r?s.getLocationRange(c,u,n):null},getLocationFromList(c){if(r){const u=this.getFirstListNode(c),d=this.getLastListNode(c);return s.getLocationRange(u!==null?u.loc.start.offset-s.startOffset:this.tokenStart,d!==null?d.loc.end.offset-s.startOffset:this.tokenStart,n)}return null},error(c,u){const d=typeof u<"u"&&u<t.length?s.getLocation(u):this.eof?s.getLocation(j5(t,t.length-1)):s.getLocation(this.tokenStart);throw new _S(c||"Unexpected input",t,d.offset,d.line,d.column)}});return Object.assign(function(c,u){t=c,u=u||{},a.setSource(t,cc),s.setSource(t,u.offset,u.line,u.column),n=u.filename||"<unknown>",r=!!u.positions,o=typeof u.onParseError=="function"?u.onParseError:CS,i=!1,a.parseAtrulePrelude="parseAtrulePrelude"in u?!!u.parseAtrulePrelude:!0,a.parseRulePrelude="parseRulePrelude"in u?!!u.parseRulePrelude:!0,a.parseValue="parseValue"in u?!!u.parseValue:!0,a.parseCustomProperty="parseCustomProperty"in u?!!u.parseCustomProperty:!1;const{context:d="default",onComment:f}=u;if(!(d in a.context))throw new Error("Unknown context `"+d+"`");typeof f=="function"&&a.forEachToken((m,p,S)=>{if(m===25){const C=a.getLocation(p,S),L=Bs(t,S-2,S,"*/")?t.slice(p+2,S-2):t.slice(p+2,S);f(L,C)}});const h=a.context[d].call(a,u);return a.eof||a.error(),h},{SyntaxError:_S,config:a.config})}var i3=_r((e=>{var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");e.encode=function(n){if(0<=n&&n<t.length)return t[n];throw new TypeError("Must be between 0 and 63: "+n)},e.decode=function(n){var r=65,o=90,i=97,s=122,a=48,l=57,c=43,u=47,d=26,f=52;return r<=n&&n<=o?n-r:i<=n&&n<=s?n-i+d:a<=n&&n<=l?n-a+f:n==c?62:n==u?63:-1}})),s3=_r((e=>{var t=i3(),n=5,r=1<<n,o=r-1,i=r;function s(l){return l<0?(-l<<1)+1:(l<<1)+0}function a(l){var c=(l&1)===1,u=l>>1;return c?-u:u}e.encode=function(c){var u="",d,f=s(c);do d=f&o,f>>>=n,f>0&&(d|=i),u+=t.encode(d);while(f>0);return u},e.decode=function(c,u,d){var f=c.length,h=0,m=0,p,S;do{if(u>=f)throw new Error("Expected more digits in base 64 VLQ value.");if(S=t.decode(c.charCodeAt(u++)),S===-1)throw new Error("Invalid base64 digit: "+c.charAt(u-1));p=!!(S&i),S&=o,h=h+(S<<m),m+=n}while(p);d.value=a(h),d.rest=u}})),vm=_r((e=>{function t(b,E,_){if(E in b)return b[E];if(arguments.length===3)return _;throw new Error('"'+E+'" is a required argument.')}e.getArg=t;var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function o(b){var E=b.match(n);return E?{scheme:E[1],auth:E[2],host:E[3],port:E[4],path:E[5]}:null}e.urlParse=o;function i(b){var E="";return b.scheme&&(E+=b.scheme+":"),E+="//",b.auth&&(E+=b.auth+"@"),b.host&&(E+=b.host),b.port&&(E+=":"+b.port),b.path&&(E+=b.path),E}e.urlGenerate=i;var s=32;function a(b){var E=[];return function(_){for(var T=0;T<E.length;T++)if(E[T].input===_){var x=E[0];return E[0]=E[T],E[T]=x,E[0].result}var N=b(_);return E.unshift({input:_,result:N}),E.length>s&&E.pop(),N}}var l=a(function(E){var _=E,T=o(E);if(T){if(!T.path)return E;_=T.path}for(var x=e.isAbsolute(_),N=[],D=0,R=0;;)if(D=R,R=_.indexOf("/",D),R===-1){N.push(_.slice(D));break}else for(N.push(_.slice(D,R));R<_.length&&_[R]==="/";)R++;for(var O,q=0,R=N.length-1;R>=0;R--)O=N[R],O==="."?N.splice(R,1):O===".."?q++:q>0&&(O===""?(N.splice(R+1,q),q=0):(N.splice(R,2),q--));return _=N.join("/"),_===""&&(_=x?"/":"."),T?(T.path=_,i(T)):_});e.normalize=l;function c(b,E){b===""&&(b="."),E===""&&(E=".");var _=o(E),T=o(b);if(T&&(b=T.path||"/"),_&&!_.scheme)return T&&(_.scheme=T.scheme),i(_);if(_||E.match(r))return E;if(T&&!T.host&&!T.path)return T.host=E,i(T);var x=E.charAt(0)==="/"?E:l(b.replace(/\/+$/,"")+"/"+E);return T?(T.path=x,i(T)):x}e.join=c,e.isAbsolute=function(b){return b.charAt(0)==="/"||n.test(b)};function u(b,E){b===""&&(b="."),b=b.replace(/\/$/,"");for(var _=0;E.indexOf(b+"/")!==0;){var T=b.lastIndexOf("/");if(T<0||(b=b.slice(0,T),b.match(/^([^\/]+:\/)?\/*$/)))return E;++_}return Array(_+1).join("../")+E.substr(b.length+1)}e.relative=u;var d=(function(){return!("__proto__"in Object.create(null))})();function f(b){return b}function h(b){return p(b)?"$"+b:b}e.toSetString=d?f:h;function m(b){return p(b)?b.slice(1):b}e.fromSetString=d?f:m;function p(b){if(!b)return!1;var E=b.length;if(E<9||b.charCodeAt(E-1)!==95||b.charCodeAt(E-2)!==95||b.charCodeAt(E-3)!==111||b.charCodeAt(E-4)!==116||b.charCodeAt(E-5)!==111||b.charCodeAt(E-6)!==114||b.charCodeAt(E-7)!==112||b.charCodeAt(E-8)!==95||b.charCodeAt(E-9)!==95)return!1;for(var _=E-10;_>=0;_--)if(b.charCodeAt(_)!==36)return!1;return!0}function S(b,E,_){var T=y(b.source,E.source);return T!==0||(T=b.originalLine-E.originalLine,T!==0)||(T=b.originalColumn-E.originalColumn,T!==0||_)||(T=b.generatedColumn-E.generatedColumn,T!==0)||(T=b.generatedLine-E.generatedLine,T!==0)?T:y(b.name,E.name)}e.compareByOriginalPositions=S;function C(b,E,_){var T=b.originalLine-E.originalLine;return T!==0||(T=b.originalColumn-E.originalColumn,T!==0||_)||(T=b.generatedColumn-E.generatedColumn,T!==0)||(T=b.generatedLine-E.generatedLine,T!==0)?T:y(b.name,E.name)}e.compareByOriginalPositionsNoSource=C;function L(b,E,_){var T=b.generatedLine-E.generatedLine;return T!==0||(T=b.generatedColumn-E.generatedColumn,T!==0||_)||(T=y(b.source,E.source),T!==0)||(T=b.originalLine-E.originalLine,T!==0)||(T=b.originalColumn-E.originalColumn,T!==0)?T:y(b.name,E.name)}e.compareByGeneratedPositionsDeflated=L;function k(b,E,_){var T=b.generatedColumn-E.generatedColumn;return T!==0||_||(T=y(b.source,E.source),T!==0)||(T=b.originalLine-E.originalLine,T!==0)||(T=b.originalColumn-E.originalColumn,T!==0)?T:y(b.name,E.name)}e.compareByGeneratedPositionsDeflatedNoLine=k;function y(b,E){return b===E?0:b===null?1:E===null?-1:b>E?1:-1}function g(b,E){var _=b.generatedLine-E.generatedLine;return _!==0||(_=b.generatedColumn-E.generatedColumn,_!==0)||(_=y(b.source,E.source),_!==0)||(_=b.originalLine-E.originalLine,_!==0)||(_=b.originalColumn-E.originalColumn,_!==0)?_:y(b.name,E.name)}e.compareByGeneratedPositionsInflated=g;function v(b){return JSON.parse(b.replace(/^\)]}'[^\n]*\n/,""))}e.parseSourceMapInput=v;function w(b,E,_){if(E=E||"",b&&(b[b.length-1]!=="/"&&E[0]!=="/"&&(b+="/"),E=b+E),_){var T=o(_);if(!T)throw new Error("sourceMapURL could not be parsed");if(T.path){var x=T.path.lastIndexOf("/");x>=0&&(T.path=T.path.substring(0,x+1))}E=c(i(T),E)}return l(E)}e.computeSourceURL=w})),a3=_r((e=>{var t=vm(),n=Object.prototype.hasOwnProperty,r=typeof Map<"u";function o(){this._array=[],this._set=r?new Map:Object.create(null)}o.fromArray=function(s,a){for(var l=new o,c=0,u=s.length;c<u;c++)l.add(s[c],a);return l},o.prototype.size=function(){return r?this._set.size:Object.getOwnPropertyNames(this._set).length},o.prototype.add=function(s,a){var l=r?s:t.toSetString(s),c=r?this.has(s):n.call(this._set,l),u=this._array.length;(!c||a)&&this._array.push(s),c||(r?this._set.set(s,u):this._set[l]=u)},o.prototype.has=function(s){if(r)return this._set.has(s);var a=t.toSetString(s);return n.call(this._set,a)},o.prototype.indexOf=function(s){if(r){var a=this._set.get(s);if(a>=0)return a}else{var l=t.toSetString(s);if(n.call(this._set,l))return this._set[l]}throw new Error('"'+s+'" is not in the set.')},o.prototype.at=function(s){if(s>=0&&s<this._array.length)return this._array[s];throw new Error("No element indexed by "+s)},o.prototype.toArray=function(){return this._array.slice()},e.ArraySet=o})),l3=_r((e=>{var t=vm();function n(o,i){var s=o.generatedLine,a=i.generatedLine,l=o.generatedColumn,c=i.generatedColumn;return a>s||a==s&&c>=l||t.compareByGeneratedPositionsInflated(o,i)<=0}function r(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}r.prototype.unsortedForEach=function(i,s){this._array.forEach(i,s)},r.prototype.add=function(i){n(this._last,i)?(this._last=i,this._array.push(i)):(this._sorted=!1,this._array.push(i))},r.prototype.toArray=function(){return this._sorted||(this._array.sort(t.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},e.MappingList=r})),c3=_r((e=>{var t=s3(),n=vm(),r=a3().ArraySet,o=l3().MappingList;function i(s){s||(s={}),this._file=n.getArg(s,"file",null),this._sourceRoot=n.getArg(s,"sourceRoot",null),this._skipValidation=n.getArg(s,"skipValidation",!1),this._ignoreInvalidMapping=n.getArg(s,"ignoreInvalidMapping",!1),this._sources=new r,this._names=new r,this._mappings=new o,this._sourcesContents=null}i.prototype._version=3,i.fromSourceMap=function(a,l){var c=a.sourceRoot,u=new i(Object.assign(l||{},{file:a.file,sourceRoot:c}));return a.eachMapping(function(d){var f={generated:{line:d.generatedLine,column:d.generatedColumn}};d.source!=null&&(f.source=d.source,c!=null&&(f.source=n.relative(c,f.source)),f.original={line:d.originalLine,column:d.originalColumn},d.name!=null&&(f.name=d.name)),u.addMapping(f)}),a.sources.forEach(function(d){var f=d;c!==null&&(f=n.relative(c,d)),u._sources.has(f)||u._sources.add(f);var h=a.sourceContentFor(d);h!=null&&u.setSourceContent(d,h)}),u},i.prototype.addMapping=function(a){var l=n.getArg(a,"generated"),c=n.getArg(a,"original",null),u=n.getArg(a,"source",null),d=n.getArg(a,"name",null);!this._skipValidation&&this._validateMapping(l,c,u,d)===!1||(u!=null&&(u=String(u),this._sources.has(u)||this._sources.add(u)),d!=null&&(d=String(d),this._names.has(d)||this._names.add(d)),this._mappings.add({generatedLine:l.line,generatedColumn:l.column,originalLine:c!=null&&c.line,originalColumn:c!=null&&c.column,source:u,name:d}))},i.prototype.setSourceContent=function(a,l){var c=a;this._sourceRoot!=null&&(c=n.relative(this._sourceRoot,c)),l!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[n.toSetString(c)]=l):this._sourcesContents&&(delete this._sourcesContents[n.toSetString(c)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},i.prototype.applySourceMap=function(a,l,c){var u=l;if(l==null){if(a.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);u=a.file}var d=this._sourceRoot;d!=null&&(u=n.relative(d,u));var f=new r,h=new r;this._mappings.unsortedForEach(function(m){if(m.source===u&&m.originalLine!=null){var p=a.originalPositionFor({line:m.originalLine,column:m.originalColumn});p.source!=null&&(m.source=p.source,c!=null&&(m.source=n.join(c,m.source)),d!=null&&(m.source=n.relative(d,m.source)),m.originalLine=p.line,m.originalColumn=p.column,p.name!=null&&(m.name=p.name))}var S=m.source;S!=null&&!f.has(S)&&f.add(S);var C=m.name;C!=null&&!h.has(C)&&h.add(C)},this),this._sources=f,this._names=h,a.sources.forEach(function(m){var p=a.sourceContentFor(m);p!=null&&(c!=null&&(m=n.join(c,m)),d!=null&&(m=n.relative(d,m)),this.setSourceContent(m,p))},this)},i.prototype._validateMapping=function(a,l,c,u){if(l&&typeof l.line!="number"&&typeof l.column!="number"){var d="original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";if(this._ignoreInvalidMapping)return!1;throw new Error(d)}if(!(a&&"line"in a&&"column"in a&&a.line>0&&a.column>=0&&!l&&!c&&!u)){if(a&&"line"in a&&"column"in a&&l&&"line"in l&&"column"in l&&a.line>0&&a.column>=0&&l.line>0&&l.column>=0&&c)return;var d="Invalid mapping: "+JSON.stringify({generated:a,source:c,original:l,name:u});if(this._ignoreInvalidMapping)return!1;throw new Error(d)}},i.prototype._serializeMappings=function(){for(var a=0,l=1,c=0,u=0,d=0,f=0,h="",m,p,S,C,L=this._mappings.toArray(),k=0,y=L.length;k<y;k++){if(p=L[k],m="",p.generatedLine!==l)for(a=0;p.generatedLine!==l;)m+=";",l++;else if(k>0){if(!n.compareByGeneratedPositionsInflated(p,L[k-1]))continue;m+=","}m+=t.encode(p.generatedColumn-a),a=p.generatedColumn,p.source!=null&&(C=this._sources.indexOf(p.source),m+=t.encode(C-f),f=C,m+=t.encode(p.originalLine-1-u),u=p.originalLine-1,m+=t.encode(p.originalColumn-c),c=p.originalColumn,p.name!=null&&(S=this._names.indexOf(p.name),m+=t.encode(S-d),d=S)),h+=m}return h},i.prototype._generateSourcesContent=function(a,l){return a.map(function(c){if(!this._sourcesContents)return null;l!=null&&(c=n.relative(l,c));var u=n.toSetString(c);return Object.prototype.hasOwnProperty.call(this._sourcesContents,u)?this._sourcesContents[u]:null},this)},i.prototype.toJSON=function(){var a={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(a.file=this._file),this._sourceRoot!=null&&(a.sourceRoot=this._sourceRoot),this._sourcesContents&&(a.sourcesContent=this._generateSourcesContent(a.sources,a.sourceRoot)),a},i.prototype.toString=function(){return JSON.stringify(this.toJSON())},e.SourceMapGenerator=i})),u3=c3(),kS=new Set(["Atrule","Selector","Declaration"]);function d3(e){const t=new u3.SourceMapGenerator,n={line:1,column:0},r={line:0,column:0},o={line:1,column:0},i={generated:o};let s=1,a=0,l=!1;const c=e.node;e.node=function(f){if(f.loc&&f.loc.start&&kS.has(f.type)){const h=f.loc.start.line,m=f.loc.start.column-1;(r.line!==h||r.column!==m)&&(r.line=h,r.column=m,n.line=s,n.column=a,l&&(l=!1,(n.line!==o.line||n.column!==o.column)&&t.addMapping(i)),l=!0,t.addMapping({source:f.loc.source,original:r,generated:n}))}c.call(this,f),l&&kS.has(f.type)&&(o.line=s,o.column=a)};const u=e.emit;e.emit=function(f,h,m){for(let p=0;p<f.length;p++)f.charCodeAt(p)===10?(s++,a=0):a++;u(f,h,m)};const d=e.result;return e.result=function(){return l&&t.addMapping(i),{css:d(),map:t}},e}var LS=ie({safe:()=>OS,spec:()=>p3}),f3=43,m3=45,Em=(e,t)=>{if(e===9&&(e=t),typeof e=="string"){const n=e.charCodeAt(0);return n>127?32768:n<<8}return e},NS=[[1,1],[1,2],[1,7],[1,8],[1,"-"],[1,10],[1,11],[1,12],[1,15],[1,21],[3,1],[3,2],[3,7],[3,8],[3,"-"],[3,10],[3,11],[3,12],[3,15],[4,1],[4,2],[4,7],[4,8],[4,"-"],[4,10],[4,11],[4,12],[4,15],[12,1],[12,2],[12,7],[12,8],[12,"-"],[12,10],[12,11],[12,12],[12,15],["#",1],["#",2],["#",7],["#",8],["#","-"],["#",10],["#",11],["#",12],["#",15],["-",1],["-",2],["-",7],["-",8],["-","-"],["-",10],["-",11],["-",12],["-",15],[10,1],[10,2],[10,7],[10,8],[10,10],[10,11],[10,12],[10,"%"],[10,15],["@",1],["@",2],["@",7],["@",8],["@","-"],["@",15],[".",10],[".",11],[".",12],["+",10],["+",11],["+",12],["/","*"]],h3=NS.concat([[1,4],[12,4],[4,4],[3,21],[3,5],[3,16],[11,11],[11,12],[11,2],[11,"-"],[22,1],[22,2],[22,11],[22,12],[22,4],[22,"-"]]);function xS(e){const t=new Set(e.map(([n,r])=>Em(n)<<16|Em(r)));return function(n,r,o){const i=Em(r,o),s=o.charCodeAt(0);return(s===m3&&r!==1&&r!==2&&r!==15||s===f3?t.has(n<<16|s<<8):t.has(n<<16|i))&&this.emit(" ",13,!0),i}}var p3=xS(NS),OS=xS(h3),g3=92;function b3(e,t){if(typeof t=="function"){let n=null;e.children.forEach(r=>{n!==null&&t.call(this,n),this.node(r),n=r});return}e.children.forEach(this.node,this)}function y3(e){cc(e,(t,n,r)=>{this.token(t,e.slice(n,r))})}function v3(e){const t=new Map;for(let n in e.node){const r=e.node[n];typeof(r.generate||r)=="function"&&t.set(n,r.generate||r)}return function(n,r){let o="",i=0,s={node(l){if(t.has(l.type))t.get(l.type).call(a,l);else throw new Error("Unknown node type: "+l.type)},tokenBefore:OS,token(l,c){i=this.tokenBefore(i,l,c),this.emit(c,l,!1),l===9&&c.charCodeAt(0)===g3&&this.emit(`
|
|
37
|
+
`,13,!0)},emit(l){o+=l},result(){return o}};r&&(typeof r.decorator=="function"&&(s=r.decorator(s)),r.sourceMap&&(s=d3(s)),r.mode in LS&&(s.tokenBefore=LS[r.mode]));const a={node:l=>s.node(l),children:b3,token:(l,c)=>s.token(l,c),tokenize:y3};return s.node(n),s.result()}}function E3(e){return{fromPlainObject(t){return e(t,{enter(n){n.children&&!(n.children instanceof Qe)&&(n.children=new Qe().fromArray(n.children))}}),t},toPlainObject(t){return e(t,{leave(n){n.children&&n.children instanceof Qe&&(n.children=n.children.toArray())}}),t}}}var{hasOwnProperty:Sm}=Object.prototype,Hs=function(){};function RS(e){return typeof e=="function"?e:Hs}function MS(e,t){return function(n,r,o){n.type===t&&e.call(this,n,r,o)}}function S3(e,t){const n=t.structure,r=[];for(const o in n){if(Sm.call(n,o)===!1)continue;let i=n[o];const s={name:o,type:!1,nullable:!1};Array.isArray(i)||(i=[i]);for(const a of i)a===null?s.nullable=!0:typeof a=="string"?s.type="node":Array.isArray(a)&&(s.type="list");s.type&&r.push(s)}return r.length?{context:t.walkContext,fields:r}:null}function w3(e){const t={};for(const n in e.node)if(Sm.call(e.node,n)){const r=e.node[n];if(!r.structure)throw new Error("Missed `structure` field in `"+n+"` node type definition");t[n]=S3(n,r)}return t}function PS(e,t){const n=e.fields.slice(),r=e.context,o=typeof r=="string";return t&&n.reverse(),function(i,s,a,l){let c;o&&(c=s[r],s[r]=i);for(const u of n){const d=i[u.name];if(!u.nullable||d){if(u.type==="list"){if(t?d.reduceRight(l,!1):d.reduce(l,!1))return!0}else if(a(d))return!0}}o&&(s[r]=c)}}function IS({StyleSheet:e,Atrule:t,Rule:n,Block:r,DeclarationList:o}){return{Atrule:{StyleSheet:e,Atrule:t,Rule:n,Block:r},Rule:{StyleSheet:e,Atrule:t,Rule:n,Block:r},Declaration:{StyleSheet:e,Atrule:t,Rule:n,Block:r,DeclarationList:o}}}function _3(e){const t=w3(e),n={},r={},o=Symbol("break-walk"),i=Symbol("skip-node");for(const c in t)Sm.call(t,c)&&t[c]!==null&&(n[c]=PS(t[c],!1),r[c]=PS(t[c],!0));const s=IS(n),a=IS(r),l=function(c,u){function d(C,L,k){const y=f.call(S,C,L,k);return y===o?!0:y===i?!1:!!(m.hasOwnProperty(C.type)&&m[C.type](C,S,d,p)||h.call(S,C,L,k)===o)}let f=Hs,h=Hs,m=n,p=(C,L,k,y)=>C||d(L,k,y);const S={break:o,skip:i,root:c,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null};if(typeof u=="function")f=u;else if(u&&(f=RS(u.enter),h=RS(u.leave),u.reverse&&(m=r),u.visit)){if(s.hasOwnProperty(u.visit))m=u.reverse?a[u.visit]:s[u.visit];else if(!t.hasOwnProperty(u.visit))throw new Error("Bad value `"+u.visit+"` for `visit` option (should be: "+Object.keys(t).sort().join(", ")+")");f=MS(f,u.visit),h=MS(h,u.visit)}if(f===Hs&&h===Hs)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");d(c)};return l.break=o,l.skip=i,l.find=function(c,u){let d=null;return l(c,function(f,h,m){if(u.call(this,f,h,m))return d=f,o}),d},l.findLast=function(c,u){let d=null;return l(c,{reverse:!0,enter(f,h,m){if(u.call(this,f,h,m))return d=f,o}}),d},l.findAll=function(c,u){const d=[];return l(c,function(f,h,m){u.call(this,f,h,m)&&d.push(f)}),d},l}function C3(e){return e}function T3(e){const{min:t,max:n,comma:r}=e;return t===0&&n===0?r?"#?":"*":t===0&&n===1?"?":t===1&&n===0?r?"#":"+":t===1&&n===1?"":(r?"#":"")+(t===n?"{"+t+"}":"{"+t+","+(n!==0?n:"")+"}")}function A3(e){if(e.type==="Range")return" ["+(e.min===null?"-∞":e.min)+","+(e.max===null?"∞":e.max)+"]";throw new Error("Unknown node type `"+e.type+"`")}function k3(e,t,n,r){const o=e.combinator===" "||r?e.combinator:" "+e.combinator+" ",i=e.terms.map(s=>wm(s,t,n,r)).join(o);return e.explicit||n?(r||i[0]===","?"[":"[ ")+i+(r?"]":" ]"):i}function wm(e,t,n,r){let o;switch(e.type){case"Group":o=k3(e,t,n,r)+(e.disallowEmpty?"!":"");break;case"Multiplier":return wm(e.term,t,n,r)+t(T3(e),e);case"Type":o="<"+e.name+(e.opts?t(A3(e.opts),e.opts):"")+">";break;case"Property":o="<'"+e.name+"'>";break;case"Keyword":o=e.name;break;case"AtKeyword":o="@"+e.name;break;case"Function":o=e.name+"(";break;case"String":case"Token":o=e.value;break;case"Comma":o=",";break;default:throw new Error("Unknown node type `"+e.type+"`")}return t(o,e)}function _m(e,t){let n=C3,r=!1,o=!1;return typeof t=="function"?n=t:t&&(r=!!t.forceBraces,o=!!t.compact,typeof t.decorate=="function"&&(n=t.decorate)),wm(e,n,r,o)}var DS={offset:0,line:1,column:1};function L3(e,t){const n=e.tokens,r=e.longestMatch,o=r<n.length&&n[r].node||null,i=o!==t?o:null;let s=0,a=0,l=0,c="",u,d;for(let f=0;f<n.length;f++){const h=n[f].value;f===r&&(a=h.length,s=c.length),i!==null&&n[f].node===i&&(f<=r?l++:l=0),c+=h}return r===n.length||l>1?(u=dc(i||t,"end")||Fs(DS,c),d=Fs(u)):(u=dc(i,"start")||Fs(dc(t,"start")||DS,c.slice(0,s)),d=dc(i,"end")||Fs(u,c.substr(s,a))),{css:c,mismatchOffset:s,mismatchLength:a,start:u,end:d}}function dc(e,t){const n=e&&e.loc&&e.loc[t];return n?"line"in n?Fs(n):n:null}function Fs({offset:e,line:t,column:n},r){const o={offset:e,line:t,column:n};if(r){const i=r.split(/\n|\r\n?|\f/);o.offset+=r.length,o.line+=i.length-1,o.column=i.length===1?o.column+r.length:i.pop().length+1}return o}var $s=function(e,t){const n=uc("SyntaxReferenceError",e+(t?" `"+t+"`":""));return n.reference=t,n},N3=function(e,t,n,r){const o=uc("SyntaxMatchError",e),{css:i,mismatchOffset:s,mismatchLength:a,start:l,end:c}=L3(r,n);return o.rawMessage=e,o.syntax=t?_m(t):"<generic>",o.css=i,o.mismatchOffset=s,o.mismatchLength=a,o.message=e+`
|
|
38
|
+
syntax: `+o.syntax+`
|
|
39
|
+
value: `+(i||"<empty string>")+`
|
|
40
|
+
--------`+new Array(o.mismatchOffset+1).join("-")+"^",Object.assign(o,l),o.loc={source:n&&n.loc&&n.loc.source||"<unknown>",start:l,end:c},o},fc=new Map,li=new Map,mc=45,wn=x3,ci=O3;function Cm(e,t){return t=t||0,e.length-t>=2&&e.charCodeAt(t)===mc&&e.charCodeAt(t+1)===mc}function BS(e,t){if(t=t||0,e.length-t>=3&&e.charCodeAt(t)===mc&&e.charCodeAt(t+1)!==mc){const n=e.indexOf("-",t+2);if(n!==-1)return e.substring(t,n+1)}return""}function x3(e){if(fc.has(e))return fc.get(e);const t=e.toLowerCase();let n=fc.get(t);if(n===void 0){const r=Cm(t,0),o=r?"":BS(t,0);n=Object.freeze({basename:t.substr(o.length),name:t,prefix:o,vendor:o,custom:r})}return fc.set(e,n),n}function O3(e){if(li.has(e))return li.get(e);let t=e,n=e[0];n==="/"?n=e[1]==="/"?"//":"/":n!=="_"&&n!=="*"&&n!=="$"&&n!=="#"&&n!=="+"&&n!=="&"&&(n="");const r=Cm(t,n.length);if(!r&&(t=t.toLowerCase(),li.has(t))){const a=li.get(t);return li.set(e,a),a}const o=r?"":BS(t,n.length),i=t.substr(0,n.length+o.length),s=Object.freeze({basename:t.substr(i.length),name:t.substr(n.length),hack:n,vendor:o,prefix:i,custom:r});return li.set(e,s),s}var HS=["initial","inherit","unset","revert","revert-layer"],Ws=43,Fn=45,Tm=110,ui=!0,R3=!1;function Am(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function qs(e,t,n){for(;e!==null&&(e.type===13||e.type===25);)e=n(++t);return t}function Ir(e,t,n,r){if(!e)return 0;const o=e.value.charCodeAt(t);if(o===Ws||o===Fn){if(n)return 0;t++}for(;t<e.value.length;t++)if(!pt(e.value.charCodeAt(t)))return 0;return r+1}function km(e,t,n){let r=!1,o=qs(e,t,n);if(e=n(o),e===null)return t;if(e.type!==10)if(Am(e,Ws)||Am(e,Fn)){if(r=!0,o=qs(n(++o),o,n),e=n(o),e===null||e.type!==10)return 0}else return t;if(!r){const i=e.value.charCodeAt(0);if(i!==Ws&&i!==Fn)return 0}return Ir(e,r?0:1,r,o)}function M3(e,t){let n=0;if(!e)return 0;if(e.type===10)return Ir(e,0,R3,n);if(e.type===1&&e.value.charCodeAt(0)===Fn){if(!ii(e.value,1,Tm))return 0;switch(e.value.length){case 2:return km(t(++n),n,t);case 3:return e.value.charCodeAt(2)!==Fn?0:(n=qs(t(++n),n,t),e=t(n),Ir(e,0,ui,n));default:return e.value.charCodeAt(2)!==Fn?0:Ir(e,3,ui,n)}}else if(e.type===1||Am(e,Ws)&&t(n+1).type===1){if(e.type!==1&&(e=t(++n)),e===null||!ii(e.value,0,Tm))return 0;switch(e.value.length){case 1:return km(t(++n),n,t);case 2:return e.value.charCodeAt(1)!==Fn?0:(n=qs(t(++n),n,t),e=t(n),Ir(e,0,ui,n));default:return e.value.charCodeAt(1)!==Fn?0:Ir(e,2,ui,n)}}else if(e.type===12){let r=e.value.charCodeAt(0),o=r===Ws||r===Fn?1:0,i=o;for(;i<e.value.length&&pt(e.value.charCodeAt(i));i++);return i===o||!ii(e.value,i,Tm)?0:i+1===e.value.length?km(t(++n),n,t):e.value.charCodeAt(i+1)!==Fn?0:i+2===e.value.length?(n=qs(t(++n),n,t),e=t(n),Ir(e,0,ui,n)):Ir(e,i+2,ui,n)}return 0}var P3=43,FS=45,$S=63,I3=117;function Lm(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function D3(e,t){return e.value.charCodeAt(0)===t}function zs(e,t,n){let r=0;for(let o=t;o<e.value.length;o++){const i=e.value.charCodeAt(o);if(i===FS&&n&&r!==0)return zs(e,t+r+1,!1),6;if(!Mr(i)||++r>6)return 0}return r}function hc(e,t,n){if(!e)return 0;for(;Lm(n(t),$S);){if(++e>6)return 0;t++}return t}function B3(e,t){let n=0;if(e===null||e.type!==1||!ii(e.value,0,I3)||(e=t(++n),e===null))return 0;if(Lm(e,P3))return e=t(++n),e===null?0:e.type===1?hc(zs(e,0,!0),++n,t):Lm(e,$S)?hc(1,++n,t):0;if(e.type===10){const r=zs(e,1,!0);return r===0?0:(e=t(++n),e===null?n:e.type===12||e.type===10?!D3(e,FS)||!zs(e,1,!1)?0:n+1:hc(r,n,t))}return e.type===12?hc(zs(e,1,!0),++n,t):0}var H3=["calc(","-moz-calc(","-webkit-calc("],Nm=new Map([[2,22],[21,22],[19,20],[23,24]]),F3=["cm","mm","q","in","pt","pc","px","em","rem","ex","rex","cap","rcap","ch","rch","ic","ric","lh","rlh","vw","svw","lvw","dvw","vh","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"],$3=["deg","grad","rad","turn"],W3=["s","ms"],q3=["hz","khz"],z3=["dpi","dpcm","dppx","x"],U3=["fr"],j3=["db"],V3=["st"];function _n(e,t){return t<e.length?e.charCodeAt(t):0}function WS(e,t){return Bs(e,0,e.length,t)}function qS(e,t){for(let n=0;n<t.length;n++)if(WS(e,t[n]))return!0;return!1}function zS(e,t){return t!==e.length-2?!1:_n(e,t)===92&&pt(_n(e,t+1))}function pc(e,t,n){if(e&&e.type==="Range"){const r=Number(n!==void 0&&n!==t.length?t.substr(0,n):t);if(isNaN(r)||e.min!==null&&r<e.min&&typeof e.min!="string"||e.max!==null&&r>e.max&&typeof e.max!="string")return!0}return!1}function G3(e,t){let n=0,r=[],o=0;e:do{switch(e.type){case 24:case 22:case 20:if(e.type!==n)break e;if(n=r.pop(),r.length===0){o++;break e}break;case 2:case 21:case 19:case 23:r.push(n),n=Nm.get(e.type)}o++}while(e=t(o));return o}function sn(e){return function(t,n,r){return t===null?0:t.type===2&&qS(t.value,H3)?G3(t,n):e(t,n,r)}}function Pe(e){return function(t){return t===null||t.type!==e?0:1}}function X3(e){if(e===null||e.type!==1)return 0;const t=e.value.toLowerCase();return qS(t,HS)||WS(t,"default")?0:1}function K3(e){return e===null||e.type!==1||_n(e.value,0)!==45||_n(e.value,1)!==45?0:1}function Y3(e){if(e===null||e.type!==4)return 0;const t=e.value.length;if(t!==4&&t!==5&&t!==7&&t!==9)return 0;for(let n=1;n<t;n++)if(!Mr(_n(e.value,n)))return 0;return 1}function Z3(e){return e===null||e.type!==4||!oc(_n(e.value,1),_n(e.value,2),_n(e.value,3))?0:1}function Q3(e,t){if(!e)return 0;let n=0,r=[],o=0;e:do{switch(e.type){case 6:case 8:break e;case 24:case 22:case 20:if(e.type!==n)break e;n=r.pop();break;case 17:if(n===0)break e;break;case 9:if(n===0&&e.value==="!")break e;break;case 2:case 21:case 19:case 23:r.push(n),n=Nm.get(e.type)}o++}while(e=t(o));return o}function J3(e,t){if(!e)return 0;let n=0,r=[],o=0;e:do{switch(e.type){case 6:case 8:break e;case 24:case 22:case 20:if(e.type!==n)break e;n=r.pop();break;case 2:case 21:case 19:case 23:r.push(n),n=Nm.get(e.type)}o++}while(e=t(o));return o}function dr(e){return e&&(e=new Set(e)),function(t,n,r){if(t===null||t.type!==12)return 0;const o=ac(t.value,0);if(e!==null){const i=t.value.indexOf("\\",o),s=i===-1||!zS(t.value,i)?t.value.substr(o):t.value.substring(o,i);if(e.has(s.toLowerCase())===!1)return 0}return pc(r,t.value,o)?0:1}}function e4(e,t,n){return e===null||e.type!==11||pc(n,e.value,e.value.length-1)?0:1}function US(e){return typeof e!="function"&&(e=function(){return 0}),function(t,n,r){return t!==null&&t.type===10&&Number(t.value)===0?1:e(t,n,r)}}function t4(e,t,n){if(e===null)return 0;const r=ac(e.value,0);return r!==e.value.length&&!zS(e.value,r)||pc(n,e.value,r)?0:1}function n4(e,t,n){if(e===null||e.type!==10)return 0;let r=_n(e.value,0)===43||_n(e.value,0)===45?1:0;for(;r<e.value.length;r++)if(!pt(_n(e.value,r)))return 0;return pc(n,e.value,r)?0:1}var jS={"ident-token":Pe(1),"function-token":Pe(2),"at-keyword-token":Pe(3),"hash-token":Pe(4),"string-token":Pe(5),"bad-string-token":Pe(6),"url-token":Pe(7),"bad-url-token":Pe(8),"delim-token":Pe(9),"number-token":Pe(10),"percentage-token":Pe(11),"dimension-token":Pe(12),"whitespace-token":Pe(13),"CDO-token":Pe(14),"CDC-token":Pe(15),"colon-token":Pe(16),"semicolon-token":Pe(17),"comma-token":Pe(18),"[-token":Pe(19),"]-token":Pe(20),"(-token":Pe(21),")-token":Pe(22),"{-token":Pe(23),"}-token":Pe(24),string:Pe(5),ident:Pe(1),"custom-ident":X3,"custom-property-name":K3,"hex-color":Y3,"id-selector":Z3,"an-plus-b":M3,urange:B3,"declaration-value":Q3,"any-value":J3,dimension:sn(dr(null)),angle:sn(dr($3)),decibel:sn(dr(j3)),frequency:sn(dr(q3)),flex:sn(dr(U3)),length:sn(US(dr(F3))),resolution:sn(dr(z3)),semitones:sn(dr(V3)),time:sn(dr(W3)),percentage:sn(e4),zero:US(),number:sn(t4),integer:sn(n4)};function r4(e,t,n){return Object.assign(uc("SyntaxError",e),{input:t,offset:n,rawMessage:e,message:e+`
|
|
41
|
+
`+t+`
|
|
42
|
+
--`+new Array((n||t.length)+1).join("-")+"^"})}var o4=9,i4=10,s4=12,a4=13,l4=32,c4=class{constructor(e){this.str=e,this.pos=0}charCodeAt(e){return e<this.str.length?this.str.charCodeAt(e):0}charCode(){return this.charCodeAt(this.pos)}nextCharCode(){return this.charCodeAt(this.pos+1)}nextNonWsCode(e){return this.charCodeAt(this.findWsEnd(e))}findWsEnd(e){for(;e<this.str.length;e++){const t=this.str.charCodeAt(e);if(t!==a4&&t!==i4&&t!==s4&&t!==l4&&t!==o4)break}return e}substringToPos(e){return this.str.substring(this.pos,this.pos=e)}eat(e){this.charCode()!==e&&this.error("Expect `"+String.fromCharCode(e)+"`"),this.pos++}peek(){return this.pos<this.str.length?this.str.charAt(this.pos++):""}error(e){throw new r4(e,this.str,this.pos)}},u4=9,d4=10,f4=12,m4=13,h4=32,VS=33,xm=35,GS=38,gc=39,XS=40,p4=41,KS=42,Om=43,Rm=44,YS=45,Mm=60,ZS=62,Pm=63,g4=64,bc=91,Im=93,yc=123,QS=124,JS=125,e1=8734,Us=new Uint8Array(128).map((e,t)=>/[a-zA-Z0-9\-]/.test(String.fromCharCode(t))?1:0),t1={" ":1,"&&":2,"||":3,"|":4};function vc(e){return e.substringToPos(e.findWsEnd(e.pos))}function di(e){let t=e.pos;for(;t<e.str.length;t++){const n=e.str.charCodeAt(t);if(n>=128||Us[n]===0)break}return e.pos===t&&e.error("Expect a keyword"),e.substringToPos(t)}function Ec(e){let t=e.pos;for(;t<e.str.length;t++){const n=e.str.charCodeAt(t);if(n<48||n>57)break}return e.pos===t&&e.error("Expect a number"),e.substringToPos(t)}function b4(e){const t=e.str.indexOf("'",e.pos+1);return t===-1&&(e.pos=e.str.length,e.error("Expect an apostrophe")),e.substringToPos(t+1)}function n1(e){let t=null,n=null;return e.eat(yc),t=Ec(e),e.charCode()===Rm?(e.pos++,e.charCode()!==JS&&(n=Ec(e))):n=t,e.eat(JS),{min:Number(t),max:n?Number(n):0}}function y4(e){let t=null,n=!1;switch(e.charCode()){case KS:e.pos++,t={min:0,max:0};break;case Om:e.pos++,t={min:1,max:0};break;case Pm:e.pos++,t={min:0,max:1};break;case xm:e.pos++,n=!0,e.charCode()===yc?t=n1(e):e.charCode()===Pm?(e.pos++,t={min:0,max:0}):t={min:1,max:0};break;case yc:t=n1(e);break;default:return null}return{type:"Multiplier",comma:n,min:t.min,max:t.max,term:null}}function fi(e,t){const n=y4(e);return n!==null?(n.term=t,e.charCode()===xm&&e.charCodeAt(e.pos-1)===Om?fi(e,n):n):t}function Dm(e){const t=e.peek();return t===""?null:{type:"Token",value:t}}function v4(e){let t;return e.eat(Mm),e.eat(gc),t=di(e),e.eat(gc),e.eat(ZS),fi(e,{type:"Property",name:t})}function E4(e){let t=null,n=null,r=1;return e.eat(bc),e.charCode()===YS&&(e.peek(),r=-1),r==-1&&e.charCode()===e1?e.peek():(t=r*Number(Ec(e)),Us[e.charCode()]!==0&&(t+=di(e))),vc(e),e.eat(Rm),vc(e),e.charCode()===e1?e.peek():(r=1,e.charCode()===YS&&(e.peek(),r=-1),n=r*Number(Ec(e)),Us[e.charCode()]!==0&&(n+=di(e))),e.eat(Im),{type:"Range",min:t,max:n}}function S4(e){let t,n=null;return e.eat(Mm),t=di(e),e.charCode()===XS&&e.nextCharCode()===p4&&(e.pos+=2,t+="()"),e.charCodeAt(e.findWsEnd(e.pos))===bc&&(vc(e),n=E4(e)),e.eat(ZS),fi(e,{type:"Type",name:t,opts:n})}function w4(e){const t=di(e);return e.charCode()===XS?(e.pos++,{type:"Function",name:t}):fi(e,{type:"Keyword",name:t})}function _4(e,t){function n(o,i){return{type:"Group",terms:o,combinator:i,disallowEmpty:!1,explicit:!1}}let r;for(t=Object.keys(t).sort((o,i)=>t1[o]-t1[i]);t.length>0;){r=t.shift();let o=0,i=0;for(;o<e.length;o++){const s=e[o];s.type==="Combinator"&&(s.value===r?(i===-1&&(i=o-1),e.splice(o,1),o--):(i!==-1&&o-i>1&&(e.splice(i,o-i,n(e.slice(i,o),r)),o=i+1),i=-1))}i!==-1&&t.length&&e.splice(i,o-i,n(e.slice(i,o),r))}return r}function r1(e){const t=[],n={};let r,o=null,i=e.pos;for(;r=T4(e);)r.type!=="Spaces"&&(r.type==="Combinator"?((o===null||o.type==="Combinator")&&(e.pos=i,e.error("Unexpected combinator")),n[r.value]=!0):o!==null&&o.type!=="Combinator"&&(n[" "]=!0,t.push({type:"Combinator",value:" "})),t.push(r),o=r,i=e.pos);return o!==null&&o.type==="Combinator"&&(e.pos-=i,e.error("Unexpected combinator")),{type:"Group",terms:t,combinator:_4(t,n)||" ",disallowEmpty:!1,explicit:!1}}function C4(e){let t;return e.eat(bc),t=r1(e),e.eat(Im),t.explicit=!0,e.charCode()===VS&&(e.pos++,t.disallowEmpty=!0),t}function T4(e){let t=e.charCode();if(t<128&&Us[t]===1)return w4(e);switch(t){case Im:break;case bc:return fi(e,C4(e));case Mm:return e.nextCharCode()===gc?v4(e):S4(e);case QS:return{type:"Combinator",value:e.substringToPos(e.pos+(e.nextCharCode()===QS?2:1))};case GS:return e.pos++,e.eat(GS),{type:"Combinator",value:"&&"};case Rm:return e.pos++,{type:"Comma"};case gc:return fi(e,{type:"String",value:b4(e)});case h4:case u4:case d4:case m4:case f4:return{type:"Spaces",value:vc(e)};case g4:return t=e.nextCharCode(),t<128&&Us[t]===1?(e.pos++,{type:"AtKeyword",name:di(e)}):Dm(e);case KS:case Om:case Pm:case xm:case VS:break;case yc:if(t=e.nextCharCode(),t<48||t>57)return Dm(e);break;default:return Dm(e)}}function o1(e){const t=new c4(e),n=r1(t);return t.pos!==e.length&&t.error("Unexpected input"),n.terms.length===1&&n.terms[0].type==="Group"?n.terms[0]:n}var js=function(){};function i1(e){return typeof e=="function"?e:js}function A4(e,t,n){function r(s){switch(o.call(n,s),s.type){case"Group":s.terms.forEach(r);break;case"Multiplier":r(s.term);break;case"Type":case"Property":case"Keyword":case"AtKeyword":case"Function":case"String":case"Token":case"Comma":break;default:throw new Error("Unknown type: "+s.type)}i.call(n,s)}let o=js,i=js;if(typeof t=="function"?o=t:t&&(o=i1(t.enter),i=i1(t.leave)),o===js&&i===js)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");r(e,n)}var k4={decorator(e){const t=[];let n=null;return{...e,node(r){const o=n;n=r,e.node.call(this,r),n=o},emit(r,o,i){t.push({type:o,value:r,node:i?null:n})},result(){return t}}}};function L4(e){const t=[];return cc(e,(n,r,o)=>t.push({type:n,value:e.slice(r,o),node:null})),t}function N4(e,t){return typeof e=="string"?L4(e):t.generate(e,k4)}var Ce={type:"Match"},ke={type:"Mismatch"},Bm={type:"DisallowEmpty"},x4=40,O4=41;function St(e,t,n){return t===Ce&&n===ke||e===Ce&&t===Ce&&n===Ce?e:(e.type==="If"&&e.else===ke&&t===Ce&&(t=e.then,e=e.match),{type:"If",match:e,then:t,else:n})}function s1(e){return e.length>2&&e.charCodeAt(e.length-2)===x4&&e.charCodeAt(e.length-1)===O4}function a1(e){return e.type==="Keyword"||e.type==="AtKeyword"||e.type==="Function"||e.type==="Type"&&s1(e.name)}function Hm(e,t,n){switch(e){case" ":{let r=Ce;for(let o=t.length-1;o>=0;o--){const i=t[o];r=St(i,r,ke)}return r}case"|":{let r=ke,o=null;for(let i=t.length-1;i>=0;i--){let s=t[i];if(a1(s)&&(o===null&&i>0&&a1(t[i-1])&&(o=Object.create(null),r=St({type:"Enum",map:o},Ce,r)),o!==null)){const a=(s1(s.name)?s.name.slice(0,-1):s.name).toLowerCase();if(!(a in o)){o[a]=s;continue}}o=null,r=St(s,Ce,r)}return r}case"&&":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!0};let r=ke;for(let o=t.length-1;o>=0;o--){const i=t[o];let s;t.length>1?s=Hm(e,t.filter(function(a){return a!==i}),!1):s=Ce,r=St(i,s,r)}return r}case"||":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!1};let r=n?Ce:ke;for(let o=t.length-1;o>=0;o--){const i=t[o];let s;t.length>1?s=Hm(e,t.filter(function(a){return a!==i}),!0):s=Ce,r=St(i,s,r)}return r}}}function R4(e){let t=Ce,n=Fm(e.term);if(e.max===0)n=St(n,Bm,ke),t=St(n,null,ke),t.then=St(Ce,Ce,t),e.comma&&(t.then.else=St({type:"Comma",syntax:e},t,ke));else for(let r=e.min||1;r<=e.max;r++)e.comma&&t!==Ce&&(t=St({type:"Comma",syntax:e},t,ke)),t=St(n,St(Ce,Ce,t),ke);if(e.min===0)t=St(Ce,Ce,t);else for(let r=0;r<e.min-1;r++)e.comma&&t!==Ce&&(t=St({type:"Comma",syntax:e},t,ke)),t=St(n,t,ke);return t}function Fm(e){if(typeof e=="function")return{type:"Generic",fn:e};switch(e.type){case"Group":{let t=Hm(e.combinator,e.terms.map(Fm),!1);return e.disallowEmpty&&(t=St(t,Bm,ke)),t}case"Multiplier":return R4(e);case"Type":case"Property":return{type:e.type,name:e.name,syntax:e};case"Keyword":return{type:e.type,name:e.name.toLowerCase(),syntax:e};case"AtKeyword":return{type:e.type,name:"@"+e.name.toLowerCase(),syntax:e};case"Function":return{type:e.type,name:e.name.toLowerCase()+"(",syntax:e};case"String":return e.value.length===3?{type:"Token",value:e.value.charAt(1),syntax:e}:{type:e.type,value:e.value.substr(1,e.value.length-2).replace(/\\'/g,"'"),syntax:e};case"Token":return{type:e.type,value:e.value,syntax:e};case"Comma":return{type:e.type,syntax:e};default:throw new Error("Unknown node type:",e.type)}}function $m(e,t){return typeof e=="string"&&(e=o1(e)),{type:"MatchGraph",match:Fm(e),syntax:t||null,source:e}}var{hasOwnProperty:l1}=Object.prototype,M4=0,P4=1,Wm=2,c1=3,u1="Match",I4="Mismatch",D4="Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)",B4=15e3,H4=0;function F4(e){let t=null,n=null,r=e;for(;r!==null;)n=r.prev,r.prev=t,t=r,r=n;return t}function qm(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=t.charCodeAt(n);let o=e.charCodeAt(n);if(o>=65&&o<=90&&(o=o|32),o!==r)return!1}return!0}function $4(e){return e.type!==9?!1:e.value!=="?"}function d1(e){return e===null?!0:e.type===18||e.type===2||e.type===21||e.type===19||e.type===23||$4(e)}function f1(e){return e===null?!0:e.type===22||e.type===20||e.type===24||e.type===9&&e.value==="/"}function W4(e,t,n){function r(){do L++,C=L<e.length?e[L]:null;while(C!==null&&(C.type===13||C.type===25))}function o(g){const v=L+g;return v<e.length?e[v]:null}function i(g,v){return{nextState:g,matchStack:y,syntaxStack:d,thenStack:f,tokenIndex:L,prev:v}}function s(g){f={nextState:g,matchStack:y,syntaxStack:d,prev:f}}function a(g){h=i(g,h)}function l(){y={type:P4,syntax:t.syntax,token:C,prev:y},r(),m=null,L>k&&(k=L)}function c(){d={syntax:t.syntax,opts:t.syntax.opts||d!==null&&d.opts||null,prev:d},y={type:Wm,syntax:t.syntax,token:y.token,prev:y}}function u(){y.type===Wm?y=y.prev:y={type:c1,syntax:d.syntax,token:y.token,prev:y},d=d.prev}let d=null,f=null,h=null,m=null,p=0,S=null,C=null,L=-1,k=0,y={type:M4,syntax:null,token:null,prev:null};for(r();S===null&&++p<B4;)switch(t.type){case"Match":if(f===null){if(C!==null&&(L!==e.length-1||C.value!=="\\0"&&C.value!=="\\9")){t=ke;break}S=u1;break}if(t=f.nextState,t===Bm)if(f.matchStack===y){t=ke;break}else t=Ce;for(;f.syntaxStack!==d;)u();f=f.prev;break;case"Mismatch":if(m!==null&&m!==!1)(h===null||L>h.tokenIndex)&&(h=m,m=!1);else if(h===null){S=I4;break}t=h.nextState,f=h.thenStack,d=h.syntaxStack,y=h.matchStack,L=h.tokenIndex,C=L<e.length?e[L]:null,h=h.prev;break;case"MatchGraph":t=t.match;break;case"If":t.else!==ke&&a(t.else),t.then!==Ce&&s(t.then),t=t.match;break;case"MatchOnce":t={type:"MatchOnceBuffer",syntax:t,index:0,mask:0};break;case"MatchOnceBuffer":{const w=t.syntax.terms;if(t.index===w.length){if(t.mask===0||t.syntax.all){t=ke;break}t=Ce;break}if(t.mask===(1<<w.length)-1){t=Ce;break}for(;t.index<w.length;t.index++){const b=1<<t.index;if((t.mask&b)===0){a(t),s({type:"AddMatchOnce",syntax:t.syntax,mask:t.mask|b}),t=w[t.index++];break}}break}case"AddMatchOnce":t={type:"MatchOnceBuffer",syntax:t.syntax,index:0,mask:t.mask};break;case"Enum":if(C!==null){let w=C.value.toLowerCase();if(w.indexOf("\\")!==-1&&(w=w.replace(/\\[09].*$/,"")),l1.call(t.map,w)){t=t.map[w];break}}t=ke;break;case"Generic":{const w=d!==null?d.opts:null,b=L+Math.floor(t.fn(C,o,w));if(!isNaN(b)&&b>L){for(;L<b;)l();t=Ce}else t=ke;break}case"Type":case"Property":{const w=t.type==="Type"?"types":"properties",b=l1.call(n,w)?n[w][t.name]:null;if(!b||!b.match)throw new Error("Bad syntax reference: "+(t.type==="Type"?"<"+t.name+">":"<'"+t.name+"'>"));if(m!==!1&&C!==null&&t.type==="Type"&&(t.name==="custom-ident"&&C.type===1||t.name==="length"&&C.value==="0")){m===null&&(m=i(t,h)),t=ke;break}c(),t=b.match;break}case"Keyword":{const w=t.name;if(C!==null){let b=C.value;if(b.indexOf("\\")!==-1&&(b=b.replace(/\\[09].*$/,"")),qm(b,w)){l(),t=Ce;break}}t=ke;break}case"AtKeyword":case"Function":if(C!==null&&qm(C.value,t.name)){l(),t=Ce;break}t=ke;break;case"Token":if(C!==null&&C.value===t.value){l(),t=Ce;break}t=ke;break;case"Comma":C!==null&&C.type===18?d1(y.token)?t=ke:(l(),t=f1(C)?ke:Ce):t=d1(y.token)||f1(C)?Ce:ke;break;case"String":let g="",v=L;for(;v<e.length&&g.length<t.value.length;v++)g+=e[v].value;if(qm(g,t.value)){for(;L<v;)l();t=Ce}else t=ke;break;default:throw new Error("Unknown node type: "+t.type)}switch(H4+=p,S){case null:S=D4,y=null;break;case u1:for(;d!==null;)u();break;default:y=null}return{tokens:e,reason:S,iterations:p,match:y,longestMatch:k}}function m1(e,t,n){const r=W4(e,t,n||{});if(r.match===null)return r;let o=r.match,i=r.match={syntax:t.syntax||null,match:[]};const s=[i];for(o=F4(o).prev;o!==null;){switch(o.type){case Wm:i.match.push(i={syntax:o.syntax,match:[]}),s.push(i);break;case c1:s.pop(),i=s[s.length-1];break;default:i.match.push({syntax:o.syntax||null,token:o.token.value,node:o.token.node})}o=o.prev}return r}var q4=ie({getTrace:()=>h1,isKeyword:()=>j4,isProperty:()=>U4,isType:()=>z4});function h1(e){function t(o){return o===null?!1:o.type==="Type"||o.type==="Property"||o.type==="Keyword"}function n(o){if(Array.isArray(o.match)){for(let i=0;i<o.match.length;i++)if(n(o.match[i]))return t(o.syntax)&&r.unshift(o.syntax),!0}else if(o.node===e)return r=t(o.syntax)?[o.syntax]:[],!0;return!1}let r=null;return this.matched!==null&&n(this.matched),r}function z4(e,t){return zm(this,e,n=>n.type==="Type"&&n.name===t)}function U4(e,t){return zm(this,e,n=>n.type==="Property"&&n.name===t)}function j4(e){return zm(this,e,t=>t.type==="Keyword")}function zm(e,t,n){const r=h1.call(e,t);return r===null?!1:r.some(n)}function p1(e){return"node"in e?e.node:p1(e.match[0])}function g1(e){return"node"in e?e.node:g1(e.match[e.match.length-1])}function b1(e,t,n,r,o){function i(a){if(a.syntax!==null&&a.syntax.type===r&&a.syntax.name===o){const l=p1(a),c=g1(a);e.syntax.walk(t,function(u,d,f){if(u===l){const h=new Qe;do{if(h.appendData(d.data),d.data===c)break;d=d.next}while(d!==null);s.push({parent:f,nodes:h})}})}Array.isArray(a.match)&&a.match.forEach(i)}const s=[];return n.matched!==null&&i(n.matched),s}var{hasOwnProperty:Vs}=Object.prototype;function Um(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&e>=0}function y1(e){return!!e&&Um(e.offset)&&Um(e.line)&&Um(e.column)}function V4(e,t){return function(r,o){if(!r||r.constructor!==Object)return o(r,"Type of node should be an Object");for(let i in r){let s=!0;if(Vs.call(r,i)!==!1){if(i==="type")r.type!==e&&o(r,"Wrong node type `"+r.type+"`, expected `"+e+"`");else if(i==="loc"){if(r.loc===null)continue;if(r.loc&&r.loc.constructor===Object)if(typeof r.loc.source!="string")i+=".source";else if(!y1(r.loc.start))i+=".start";else if(!y1(r.loc.end))i+=".end";else continue;s=!1}else if(t.hasOwnProperty(i)){s=!1;for(let a=0;!s&&a<t[i].length;a++){const l=t[i][a];switch(l){case String:s=typeof r[i]=="string";break;case Boolean:s=typeof r[i]=="boolean";break;case null:s=r[i]===null;break;default:typeof l=="string"?s=r[i]&&r[i].type===l:Array.isArray(l)&&(s=r[i]instanceof Qe)}}}else o(r,"Unknown field `"+i+"` for "+e+" node type");s||o(r,"Bad value for `"+e+"."+i+"`")}}for(const i in t)Vs.call(t,i)&&Vs.call(r,i)===!1&&o(r,"Field `"+e+"."+i+"` is missed")}}function G4(e,t){const n=t.structure,r={type:String,loc:!0},o={type:'"'+e+'"'};for(const i in n){if(Vs.call(n,i)===!1)continue;const s=[],a=r[i]=Array.isArray(n[i])?n[i].slice():[n[i]];for(let l=0;l<a.length;l++){const c=a[l];if(c===String||c===Boolean)s.push(c.name);else if(c===null)s.push("null");else if(typeof c=="string")s.push("<"+c+">");else if(Array.isArray(c))s.push("List");else throw new Error("Wrong value `"+c+"` in `"+e+"."+i+"` structure definition")}o[i]=s.join(" | ")}return{docs:o,check:V4(e,r)}}function X4(e){const t={};if(e.node){for(const n in e.node)if(Vs.call(e.node,n)){const r=e.node[n];if(r.structure)t[n]=G4(n,r);else throw new Error("Missed `structure` field in `"+n+"` node type definition")}}return t}var K4=$m(HS.join(" | "));function jm(e,t,n){const r={};for(const o in e)e[o].syntax&&(r[o]=n?e[o].syntax:_m(e[o].syntax,{compact:t}));return r}function Y4(e,t,n){const r={};for(const[o,i]of Object.entries(e))r[o]={prelude:i.prelude&&(n?i.prelude.syntax:_m(i.prelude.syntax,{compact:t})),descriptors:i.descriptors&&jm(i.descriptors,t,n)};return r}function Z4(e){for(let t=0;t<e.length;t++)if(e[t].value.toLowerCase()==="var(")return!0;return!1}function Cn(e,t,n){return{matched:e,iterations:n,error:t,...q4}}function mi(e,t,n,r){const o=N4(n,e.syntax);let i;return Z4(o)?Cn(null,new Error("Matching for a tree with var() is not supported")):(r&&(i=m1(o,e.cssWideKeywordsSyntax,e)),(!r||!i.match)&&(i=m1(o,t.match,e),!i.match)?Cn(null,new N3(i.reason,t.syntax,n,i),i.iterations):Cn(i.match,null,i.iterations))}var v1=class{constructor(e,t,n){if(this.cssWideKeywordsSyntax=K4,this.syntax=t,this.generic=!1,this.atrules=Object.create(null),this.properties=Object.create(null),this.types=Object.create(null),this.structure=n||X4(e),e){if(e.types)for(const r in e.types)this.addType_(r,e.types[r]);if(e.generic){this.generic=!0;for(const r in jS)this.addType_(r,jS[r])}if(e.atrules)for(const r in e.atrules)this.addAtrule_(r,e.atrules[r]);if(e.properties)for(const r in e.properties)this.addProperty_(r,e.properties[r])}}checkStructure(e){function t(o,i){r.push({node:o,message:i})}const n=this.structure,r=[];return this.syntax.walk(e,function(o){n.hasOwnProperty(o.type)?n[o.type].check(o,t):t(o,"Unknown node type `"+o.type+"`")}),r.length?r:!1}createDescriptor(e,t,n,r=null){const o={type:t,name:n},i={type:t,name:n,parent:r,serializable:typeof e=="string"||e&&typeof e.type=="string",syntax:null,match:null};return typeof e=="function"?i.match=$m(e,o):(typeof e=="string"?Object.defineProperty(i,"syntax",{get(){return Object.defineProperty(i,"syntax",{value:o1(e)}),i.syntax}}):i.syntax=e,Object.defineProperty(i,"match",{get(){return Object.defineProperty(i,"match",{value:$m(i.syntax,o)}),i.match}})),i}addAtrule_(e,t){t&&(this.atrules[e]={type:"Atrule",name:e,prelude:t.prelude?this.createDescriptor(t.prelude,"AtrulePrelude",e):null,descriptors:t.descriptors?Object.keys(t.descriptors).reduce((n,r)=>(n[r]=this.createDescriptor(t.descriptors[r],"AtruleDescriptor",r,e),n),Object.create(null)):null})}addProperty_(e,t){t&&(this.properties[e]=this.createDescriptor(t,"Property",e))}addType_(e,t){t&&(this.types[e]=this.createDescriptor(t,"Type",e))}checkAtruleName(e){if(!this.getAtrule(e))return new $s("Unknown at-rule","@"+e)}checkAtrulePrelude(e,t){const n=this.checkAtruleName(e);if(n)return n;const r=this.getAtrule(e);if(!r.prelude&&t)return new SyntaxError("At-rule `@"+e+"` should not contain a prelude");if(r.prelude&&!t&&!mi(this,r.prelude,"",!1).matched)return new SyntaxError("At-rule `@"+e+"` should contain a prelude")}checkAtruleDescriptorName(e,t){const n=this.checkAtruleName(e);if(n)return n;const r=this.getAtrule(e),o=wn(t);if(!r.descriptors)return new SyntaxError("At-rule `@"+e+"` has no known descriptors");if(!r.descriptors[o.name]&&!r.descriptors[o.basename])return new $s("Unknown at-rule descriptor",t)}checkPropertyName(e){if(!this.getProperty(e))return new $s("Unknown property",e)}matchAtrulePrelude(e,t){const n=this.checkAtrulePrelude(e,t);if(n)return Cn(null,n);const r=this.getAtrule(e);return r.prelude?mi(this,r.prelude,t||"",!1):Cn(null,null)}matchAtruleDescriptor(e,t,n){const r=this.checkAtruleDescriptorName(e,t);if(r)return Cn(null,r);const o=this.getAtrule(e),i=wn(t);return mi(this,o.descriptors[i.name]||o.descriptors[i.basename],n,!1)}matchDeclaration(e){return e.type!=="Declaration"?Cn(null,new Error("Not a Declaration node")):this.matchProperty(e.property,e.value)}matchProperty(e,t){if(ci(e).custom)return Cn(null,new Error("Lexer matching doesn't applicable for custom properties"));const n=this.checkPropertyName(e);return n?Cn(null,n):mi(this,this.getProperty(e),t,!0)}matchType(e,t){const n=this.getType(e);return n?mi(this,n,t,!1):Cn(null,new $s("Unknown type",e))}match(e,t){return typeof e!="string"&&(!e||!e.type)?Cn(null,new $s("Bad syntax")):((typeof e=="string"||!e.match)&&(e=this.createDescriptor(e,"Type","anonymous")),mi(this,e,t,!1))}findValueFragments(e,t,n,r){return b1(this,t,this.matchProperty(e,t),n,r)}findDeclarationValueFragments(e,t,n){return b1(this,e.value,this.matchDeclaration(e),t,n)}findAllFragments(e,t,n){const r=[];return this.syntax.walk(e,{visit:"Declaration",enter:o=>{r.push.apply(r,this.findDeclarationValueFragments(o,t,n))}}),r}getAtrule(e,t=!0){const n=wn(e);return(n.vendor&&t?this.atrules[n.name]||this.atrules[n.basename]:this.atrules[n.name])||null}getAtrulePrelude(e,t=!0){const n=this.getAtrule(e,t);return n&&n.prelude||null}getAtruleDescriptor(e,t){return this.atrules.hasOwnProperty(e)&&this.atrules.declarators&&this.atrules[e].declarators[t]||null}getProperty(e,t=!0){const n=ci(e);return(n.vendor&&t?this.properties[n.name]||this.properties[n.basename]:this.properties[n.name])||null}getType(e){return hasOwnProperty.call(this.types,e)?this.types[e]:null}validate(){function e(r,o,i,s){if(i.has(o))return i.get(o);i.set(o,!1),s.syntax!==null&&A4(s.syntax,function(a){if(a.type!=="Type"&&a.type!=="Property")return;const l=a.type==="Type"?r.types:r.properties,c=a.type==="Type"?t:n;(!hasOwnProperty.call(l,a.name)||e(r,a.name,c,l[a.name]))&&i.set(o,!0)},this)}let t=new Map,n=new Map;for(const r in this.types)e(this,r,t,this.types[r]);for(const r in this.properties)e(this,r,n,this.properties[r]);return t=[...t.keys()].filter(r=>t.get(r)),n=[...n.keys()].filter(r=>n.get(r)),t.length||n.length?{types:t,properties:n}:null}dump(e,t){return{generic:this.generic,types:jm(this.types,!t,e),properties:jm(this.properties,!t,e),atrules:Y4(this.atrules,!t,e)}}toString(){return JSON.stringify(this.dump())}},{hasOwnProperty:hi}=Object.prototype,Q4={generic:!0,types:Vm,atrules:{prelude:_1,descriptors:_1},properties:Vm,parseContext:J4,scope:S1,atrule:["parse"],pseudo:["parse"],node:["name","structure","parse","generate","walkContext"]};function Sc(e){return e&&e.constructor===Object}function E1(e){return Sc(e)?{...e}:e}function J4(e,t){return Object.assign(e,t)}function S1(e,t){for(const n in t)hi.call(t,n)&&(Sc(e[n])?S1(e[n],t[n]):e[n]=E1(t[n]));return e}function w1(e,t){return typeof t=="string"&&/^\s*\|/.test(t)?typeof e=="string"?e+t:t.replace(/^\s*\|\s*/,""):t||null}function Vm(e,t){if(typeof t=="string")return w1(e,t);const n={...e};for(let r in t)hi.call(t,r)&&(n[r]=w1(hi.call(e,r)?e[r]:void 0,t[r]));return n}function _1(e,t){const n=Vm(e,t);return!Sc(n)||Object.keys(n).length?n:null}function Gs(e,t,n){for(const r in n)if(hi.call(n,r)!==!1){if(n[r]===!0)hi.call(t,r)&&(e[r]=E1(t[r]));else if(n[r]){if(typeof n[r]=="function"){const o=n[r];e[r]=o({},e[r]),e[r]=o(e[r]||{},t[r])}else if(Sc(n[r])){const o={};for(let i in e[r])o[i]=Gs({},e[r][i],n[r]);for(let i in t[r])o[i]=Gs(o[i]||{},t[r][i],n[r]);e[r]=o}else if(Array.isArray(n[r])){const o={},i=n[r].reduce(function(s,a){return s[a]=!0,s},{});for(const[s,a]of Object.entries(e[r]||{}))o[s]={},a&&Gs(o[s],a,i);for(const s in t[r])hi.call(t[r],s)&&(o[s]||(o[s]={}),t[r]&&t[r][s]&&Gs(o[s],t[r][s],i));e[r]=o}}}return e}var Gm=(e,t)=>Gs(e,t,Q4);function C1(e){const t=o3(e),n=_3(e),r=v3(e),{fromPlainObject:o,toPlainObject:i}=E3(n),s={lexer:null,createLexer:a=>new v1(a,s,s.lexer.structure),tokenize:cc,parse:t,generate:r,walk:n,find:n.find,findLast:n.findLast,findAll:n.findAll,fromPlainObject:o,toPlainObject:i,fork(a){const l=Gm({},e);return C1(typeof a=="function"?a(l,Object.assign):Gm(l,a))}};return s.lexer=new v1({generic:!0,types:e.types,atrules:e.atrules,properties:e.properties,node:e.node},s),s}var e8=e=>C1(Gm({},e)),t8={generic:!0,types:{"absolute-size":"xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large","alpha-value":"<number>|<percentage>","angle-percentage":"<angle>|<percentage>","angular-color-hint":"<angle-percentage>","angular-color-stop":"<color>&&<color-stop-angle>?","angular-color-stop-list":"[<angular-color-stop> [, <angular-color-hint>]?]# , <angular-color-stop>","animateable-feature":"scroll-position|contents|<custom-ident>",attachment:"scroll|fixed|local","attr()":"attr( <attr-name> <type-or-unit>? [, <attr-fallback>]? )","attr-matcher":"['~'|'|'|'^'|'$'|'*']? '='","attr-modifier":"i|s","attribute-selector":"'[' <wq-name> ']'|'[' <wq-name> <attr-matcher> [<string-token>|<ident-token>] <attr-modifier>? ']'","auto-repeat":"repeat( [auto-fill|auto-fit] , [<line-names>? <fixed-size>]+ <line-names>? )","auto-track-list":"[<line-names>? [<fixed-size>|<fixed-repeat>]]* <line-names>? <auto-repeat> [<line-names>? [<fixed-size>|<fixed-repeat>]]* <line-names>?","baseline-position":"[first|last]? baseline","basic-shape":"<inset()>|<circle()>|<ellipse()>|<polygon()>|<path()>","bg-image":"none|<image>","bg-layer":"<bg-image>||<bg-position> [/ <bg-size>]?||<repeat-style>||<attachment>||<box>||<box>","bg-position":"[[left|center|right|top|bottom|<length-percentage>]|[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]|[center|[left|right] <length-percentage>?]&&[center|[top|bottom] <length-percentage>?]]","bg-size":"[<length-percentage>|auto]{1,2}|cover|contain","blur()":"blur( <length> )","blend-mode":"normal|multiply|screen|overlay|darken|lighten|color-dodge|color-burn|hard-light|soft-light|difference|exclusion|hue|saturation|color|luminosity",box:"border-box|padding-box|content-box","brightness()":"brightness( <number-percentage> )","calc()":"calc( <calc-sum> )","calc-sum":"<calc-product> [['+'|'-'] <calc-product>]*","calc-product":"<calc-value> ['*' <calc-value>|'/' <number>]*","calc-value":"<number>|<dimension>|<percentage>|( <calc-sum> )","cf-final-image":"<image>|<color>","cf-mixing-image":"<percentage>?&&<image>","circle()":"circle( [<shape-radius>]? [at <position>]? )","clamp()":"clamp( <calc-sum>#{3} )","class-selector":"'.' <ident-token>","clip-source":"<url>",color:"<rgb()>|<rgba()>|<hsl()>|<hsla()>|<hwb()>|<lab()>|<lch()>|<hex-color>|<named-color>|currentcolor|<deprecated-system-color>","color-stop":"<color-stop-length>|<color-stop-angle>","color-stop-angle":"<angle-percentage>{1,2}","color-stop-length":"<length-percentage>{1,2}","color-stop-list":"[<linear-color-stop> [, <linear-color-hint>]?]# , <linear-color-stop>",combinator:"'>'|'+'|'~'|['||']","common-lig-values":"[common-ligatures|no-common-ligatures]","compat-auto":"searchfield|textarea|push-button|slider-horizontal|checkbox|radio|square-button|menulist|listbox|meter|progress-bar|button","composite-style":"clear|copy|source-over|source-in|source-out|source-atop|destination-over|destination-in|destination-out|destination-atop|xor","compositing-operator":"add|subtract|intersect|exclude","compound-selector":"[<type-selector>? <subclass-selector>* [<pseudo-element-selector> <pseudo-class-selector>*]*]!","compound-selector-list":"<compound-selector>#","complex-selector":"<compound-selector> [<combinator>? <compound-selector>]*","complex-selector-list":"<complex-selector>#","conic-gradient()":"conic-gradient( [from <angle>]? [at <position>]? , <angular-color-stop-list> )","contextual-alt-values":"[contextual|no-contextual]","content-distribution":"space-between|space-around|space-evenly|stretch","content-list":"[<string>|contents|<image>|<counter>|<quote>|<target>|<leader()>|<attr()>]+","content-position":"center|start|end|flex-start|flex-end","content-replacement":"<image>","contrast()":"contrast( [<number-percentage>] )",counter:"<counter()>|<counters()>","counter()":"counter( <counter-name> , <counter-style>? )","counter-name":"<custom-ident>","counter-style":"<counter-style-name>|symbols( )","counter-style-name":"<custom-ident>","counters()":"counters( <counter-name> , <string> , <counter-style>? )","cross-fade()":"cross-fade( <cf-mixing-image> , <cf-final-image>? )","cubic-bezier-timing-function":"ease|ease-in|ease-out|ease-in-out|cubic-bezier( <number [0,1]> , <number> , <number [0,1]> , <number> )","deprecated-system-color":"ActiveBorder|ActiveCaption|AppWorkspace|Background|ButtonFace|ButtonHighlight|ButtonShadow|ButtonText|CaptionText|GrayText|Highlight|HighlightText|InactiveBorder|InactiveCaption|InactiveCaptionText|InfoBackground|InfoText|Menu|MenuText|Scrollbar|ThreeDDarkShadow|ThreeDFace|ThreeDHighlight|ThreeDLightShadow|ThreeDShadow|Window|WindowFrame|WindowText","discretionary-lig-values":"[discretionary-ligatures|no-discretionary-ligatures]","display-box":"contents|none","display-inside":"flow|flow-root|table|flex|grid|ruby","display-internal":"table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption|ruby-base|ruby-text|ruby-base-container|ruby-text-container","display-legacy":"inline-block|inline-list-item|inline-table|inline-flex|inline-grid","display-listitem":"<display-outside>?&&[flow|flow-root]?&&list-item","display-outside":"block|inline|run-in","drop-shadow()":"drop-shadow( <length>{2,3} <color>? )","east-asian-variant-values":"[jis78|jis83|jis90|jis04|simplified|traditional]","east-asian-width-values":"[full-width|proportional-width]","element()":"element( <custom-ident> , [first|start|last|first-except]? )|element( <id-selector> )","ellipse()":"ellipse( [<shape-radius>{2}]? [at <position>]? )","ending-shape":"circle|ellipse","env()":"env( <custom-ident> , <declaration-value>? )","explicit-track-list":"[<line-names>? <track-size>]+ <line-names>?","family-name":"<string>|<custom-ident>+","feature-tag-value":"<string> [<integer>|on|off]?","feature-type":"@stylistic|@historical-forms|@styleset|@character-variant|@swash|@ornaments|@annotation","feature-value-block":"<feature-type> '{' <feature-value-declaration-list> '}'","feature-value-block-list":"<feature-value-block>+","feature-value-declaration":"<custom-ident> : <integer>+ ;","feature-value-declaration-list":"<feature-value-declaration>","feature-value-name":"<custom-ident>","fill-rule":"nonzero|evenodd","filter-function":"<blur()>|<brightness()>|<contrast()>|<drop-shadow()>|<grayscale()>|<hue-rotate()>|<invert()>|<opacity()>|<saturate()>|<sepia()>","filter-function-list":"[<filter-function>|<url>]+","final-bg-layer":"<'background-color'>||<bg-image>||<bg-position> [/ <bg-size>]?||<repeat-style>||<attachment>||<box>||<box>","fit-content()":"fit-content( [<length>|<percentage>] )","fixed-breadth":"<length-percentage>","fixed-repeat":"repeat( [<integer [1,∞]>] , [<line-names>? <fixed-size>]+ <line-names>? )","fixed-size":"<fixed-breadth>|minmax( <fixed-breadth> , <track-breadth> )|minmax( <inflexible-breadth> , <fixed-breadth> )","font-stretch-absolute":"normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded|<percentage>","font-variant-css21":"[normal|small-caps]","font-weight-absolute":"normal|bold|<number [1,1000]>","frequency-percentage":"<frequency>|<percentage>","general-enclosed":"[<function-token> <any-value> )]|( <ident> <any-value> )","generic-family":"serif|sans-serif|cursive|fantasy|monospace|-apple-system","generic-name":"serif|sans-serif|cursive|fantasy|monospace","geometry-box":"<shape-box>|fill-box|stroke-box|view-box",gradient:"<linear-gradient()>|<repeating-linear-gradient()>|<radial-gradient()>|<repeating-radial-gradient()>|<conic-gradient()>|<repeating-conic-gradient()>|<-legacy-gradient>","grayscale()":"grayscale( <number-percentage> )","grid-line":"auto|<custom-ident>|[<integer>&&<custom-ident>?]|[span&&[<integer>||<custom-ident>]]","historical-lig-values":"[historical-ligatures|no-historical-ligatures]","hsl()":"hsl( <hue> <percentage> <percentage> [/ <alpha-value>]? )|hsl( <hue> , <percentage> , <percentage> , <alpha-value>? )","hsla()":"hsla( <hue> <percentage> <percentage> [/ <alpha-value>]? )|hsla( <hue> , <percentage> , <percentage> , <alpha-value>? )",hue:"<number>|<angle>","hue-rotate()":"hue-rotate( <angle> )","hwb()":"hwb( [<hue>|none] [<percentage>|none] [<percentage>|none] [/ [<alpha-value>|none]]? )",image:"<url>|<image()>|<image-set()>|<element()>|<paint()>|<cross-fade()>|<gradient>","image()":"image( <image-tags>? [<image-src>? , <color>?]! )","image-set()":"image-set( <image-set-option># )","image-set-option":"[<image>|<string>] [<resolution>||type( <string> )]","image-src":"<url>|<string>","image-tags":"ltr|rtl","inflexible-breadth":"<length>|<percentage>|min-content|max-content|auto","inset()":"inset( <length-percentage>{1,4} [round <'border-radius'>]? )","invert()":"invert( <number-percentage> )","keyframes-name":"<custom-ident>|<string>","keyframe-block":"<keyframe-selector># { <declaration-list> }","keyframe-block-list":"<keyframe-block>+","keyframe-selector":"from|to|<percentage>","layer()":"layer( <layer-name> )","layer-name":"<ident> ['.' <ident>]*","leader()":"leader( <leader-type> )","leader-type":"dotted|solid|space|<string>","length-percentage":"<length>|<percentage>","line-names":"'[' <custom-ident>* ']'","line-name-list":"[<line-names>|<name-repeat>]+","line-style":"none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset","line-width":"<length>|thin|medium|thick","linear-color-hint":"<length-percentage>","linear-color-stop":"<color> <color-stop-length>?","linear-gradient()":"linear-gradient( [<angle>|to <side-or-corner>]? , <color-stop-list> )","mask-layer":"<mask-reference>||<position> [/ <bg-size>]?||<repeat-style>||<geometry-box>||[<geometry-box>|no-clip]||<compositing-operator>||<masking-mode>","mask-position":"[<length-percentage>|left|center|right] [<length-percentage>|top|center|bottom]?","mask-reference":"none|<image>|<mask-source>","mask-source":"<url>","masking-mode":"alpha|luminance|match-source","matrix()":"matrix( <number>#{6} )","matrix3d()":"matrix3d( <number>#{16} )","max()":"max( <calc-sum># )","media-and":"<media-in-parens> [and <media-in-parens>]+","media-condition":"<media-not>|<media-and>|<media-or>|<media-in-parens>","media-condition-without-or":"<media-not>|<media-and>|<media-in-parens>","media-feature":"( [<mf-plain>|<mf-boolean>|<mf-range>] )","media-in-parens":"( <media-condition> )|<media-feature>|<general-enclosed>","media-not":"not <media-in-parens>","media-or":"<media-in-parens> [or <media-in-parens>]+","media-query":"<media-condition>|[not|only]? <media-type> [and <media-condition-without-or>]?","media-query-list":"<media-query>#","media-type":"<ident>","mf-boolean":"<mf-name>","mf-name":"<ident>","mf-plain":"<mf-name> : <mf-value>","mf-range":"<mf-name> ['<'|'>']? '='? <mf-value>|<mf-value> ['<'|'>']? '='? <mf-name>|<mf-value> '<' '='? <mf-name> '<' '='? <mf-value>|<mf-value> '>' '='? <mf-name> '>' '='? <mf-value>","mf-value":"<number>|<dimension>|<ident>|<ratio>","min()":"min( <calc-sum># )","minmax()":"minmax( [<length>|<percentage>|min-content|max-content|auto] , [<length>|<percentage>|<flex>|min-content|max-content|auto] )","name-repeat":"repeat( [<integer [1,∞]>|auto-fill] , <line-names>+ )","named-color":"transparent|aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen|<-non-standard-color>","namespace-prefix":"<ident>","ns-prefix":"[<ident-token>|'*']? '|'","number-percentage":"<number>|<percentage>","numeric-figure-values":"[lining-nums|oldstyle-nums]","numeric-fraction-values":"[diagonal-fractions|stacked-fractions]","numeric-spacing-values":"[proportional-nums|tabular-nums]",nth:"<an-plus-b>|even|odd","opacity()":"opacity( [<number-percentage>] )","overflow-position":"unsafe|safe","outline-radius":"<length>|<percentage>","page-body":"<declaration>? [; <page-body>]?|<page-margin-box> <page-body>","page-margin-box":"<page-margin-box-type> '{' <declaration-list> '}'","page-margin-box-type":"@top-left-corner|@top-left|@top-center|@top-right|@top-right-corner|@bottom-left-corner|@bottom-left|@bottom-center|@bottom-right|@bottom-right-corner|@left-top|@left-middle|@left-bottom|@right-top|@right-middle|@right-bottom","page-selector-list":"[<page-selector>#]?","page-selector":"<pseudo-page>+|<ident> <pseudo-page>*","page-size":"A5|A4|A3|B5|B4|JIS-B5|JIS-B4|letter|legal|ledger","path()":"path( [<fill-rule> ,]? <string> )","paint()":"paint( <ident> , <declaration-value>? )","perspective()":"perspective( <length> )","polygon()":"polygon( <fill-rule>? , [<length-percentage> <length-percentage>]# )",position:"[[left|center|right]||[top|center|bottom]|[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]?|[[left|right] <length-percentage>]&&[[top|bottom] <length-percentage>]]","pseudo-class-selector":"':' <ident-token>|':' <function-token> <any-value> ')'","pseudo-element-selector":"':' <pseudo-class-selector>","pseudo-page":": [left|right|first|blank]",quote:"open-quote|close-quote|no-open-quote|no-close-quote","radial-gradient()":"radial-gradient( [<ending-shape>||<size>]? [at <position>]? , <color-stop-list> )","relative-selector":"<combinator>? <complex-selector>","relative-selector-list":"<relative-selector>#","relative-size":"larger|smaller","repeat-style":"repeat-x|repeat-y|[repeat|space|round|no-repeat]{1,2}","repeating-conic-gradient()":"repeating-conic-gradient( [from <angle>]? [at <position>]? , <angular-color-stop-list> )","repeating-linear-gradient()":"repeating-linear-gradient( [<angle>|to <side-or-corner>]? , <color-stop-list> )","repeating-radial-gradient()":"repeating-radial-gradient( [<ending-shape>||<size>]? [at <position>]? , <color-stop-list> )","rgb()":"rgb( <percentage>{3} [/ <alpha-value>]? )|rgb( <number>{3} [/ <alpha-value>]? )|rgb( <percentage>#{3} , <alpha-value>? )|rgb( <number>#{3} , <alpha-value>? )","rgba()":"rgba( <percentage>{3} [/ <alpha-value>]? )|rgba( <number>{3} [/ <alpha-value>]? )|rgba( <percentage>#{3} , <alpha-value>? )|rgba( <number>#{3} , <alpha-value>? )","rotate()":"rotate( [<angle>|<zero>] )","rotate3d()":"rotate3d( <number> , <number> , <number> , [<angle>|<zero>] )","rotateX()":"rotateX( [<angle>|<zero>] )","rotateY()":"rotateY( [<angle>|<zero>] )","rotateZ()":"rotateZ( [<angle>|<zero>] )","saturate()":"saturate( <number-percentage> )","scale()":"scale( <number> , <number>? )","scale3d()":"scale3d( <number> , <number> , <number> )","scaleX()":"scaleX( <number> )","scaleY()":"scaleY( <number> )","scaleZ()":"scaleZ( <number> )","self-position":"center|start|end|self-start|self-end|flex-start|flex-end","shape-radius":"<length-percentage>|closest-side|farthest-side","skew()":"skew( [<angle>|<zero>] , [<angle>|<zero>]? )","skewX()":"skewX( [<angle>|<zero>] )","skewY()":"skewY( [<angle>|<zero>] )","sepia()":"sepia( <number-percentage> )",shadow:"inset?&&<length>{2,4}&&<color>?","shadow-t":"[<length>{2,3}&&<color>?]",shape:"rect( <top> , <right> , <bottom> , <left> )|rect( <top> <right> <bottom> <left> )","shape-box":"<box>|margin-box","side-or-corner":"[left|right]||[top|bottom]","single-animation":"<time>||<easing-function>||<time>||<single-animation-iteration-count>||<single-animation-direction>||<single-animation-fill-mode>||<single-animation-play-state>||[none|<keyframes-name>]","single-animation-direction":"normal|reverse|alternate|alternate-reverse","single-animation-fill-mode":"none|forwards|backwards|both","single-animation-iteration-count":"infinite|<number>","single-animation-play-state":"running|paused","single-animation-timeline":"auto|none|<timeline-name>","single-transition":"[none|<single-transition-property>]||<time>||<easing-function>||<time>","single-transition-property":"all|<custom-ident>",size:"closest-side|farthest-side|closest-corner|farthest-corner|<length>|<length-percentage>{2}","step-position":"jump-start|jump-end|jump-none|jump-both|start|end","step-timing-function":"step-start|step-end|steps( <integer> [, <step-position>]? )","subclass-selector":"<id-selector>|<class-selector>|<attribute-selector>|<pseudo-class-selector>","supports-condition":"not <supports-in-parens>|<supports-in-parens> [and <supports-in-parens>]*|<supports-in-parens> [or <supports-in-parens>]*","supports-in-parens":"( <supports-condition> )|<supports-feature>|<general-enclosed>","supports-feature":"<supports-decl>|<supports-selector-fn>","supports-decl":"( <declaration> )","supports-selector-fn":"selector( <complex-selector> )",symbol:"<string>|<image>|<custom-ident>",target:"<target-counter()>|<target-counters()>|<target-text()>","target-counter()":"target-counter( [<string>|<url>] , <custom-ident> , <counter-style>? )","target-counters()":"target-counters( [<string>|<url>] , <custom-ident> , <string> , <counter-style>? )","target-text()":"target-text( [<string>|<url>] , [content|before|after|first-letter]? )","time-percentage":"<time>|<percentage>","timeline-name":"<custom-ident>|<string>","easing-function":"linear|<cubic-bezier-timing-function>|<step-timing-function>","track-breadth":"<length-percentage>|<flex>|min-content|max-content|auto","track-list":"[<line-names>? [<track-size>|<track-repeat>]]+ <line-names>?","track-repeat":"repeat( [<integer [1,∞]>] , [<line-names>? <track-size>]+ <line-names>? )","track-size":"<track-breadth>|minmax( <inflexible-breadth> , <track-breadth> )|fit-content( [<length>|<percentage>] )","transform-function":"<matrix()>|<translate()>|<translateX()>|<translateY()>|<scale()>|<scaleX()>|<scaleY()>|<rotate()>|<skew()>|<skewX()>|<skewY()>|<matrix3d()>|<translate3d()>|<translateZ()>|<scale3d()>|<scaleZ()>|<rotate3d()>|<rotateX()>|<rotateY()>|<rotateZ()>|<perspective()>","transform-list":"<transform-function>+","translate()":"translate( <length-percentage> , <length-percentage>? )","translate3d()":"translate3d( <length-percentage> , <length-percentage> , <length> )","translateX()":"translateX( <length-percentage> )","translateY()":"translateY( <length-percentage> )","translateZ()":"translateZ( <length> )","type-or-unit":"string|color|url|integer|number|length|angle|time|frequency|cap|ch|em|ex|ic|lh|rlh|rem|vb|vi|vw|vh|vmin|vmax|mm|Q|cm|in|pt|pc|px|deg|grad|rad|turn|ms|s|Hz|kHz|%","type-selector":"<wq-name>|<ns-prefix>? '*'","var()":"var( <custom-property-name> , <declaration-value>? )","viewport-length":"auto|<length-percentage>","visual-box":"content-box|padding-box|border-box","wq-name":"<ns-prefix>? <ident-token>","-legacy-gradient":"<-webkit-gradient()>|<-legacy-linear-gradient>|<-legacy-repeating-linear-gradient>|<-legacy-radial-gradient>|<-legacy-repeating-radial-gradient>","-legacy-linear-gradient":"-moz-linear-gradient( <-legacy-linear-gradient-arguments> )|-webkit-linear-gradient( <-legacy-linear-gradient-arguments> )|-o-linear-gradient( <-legacy-linear-gradient-arguments> )","-legacy-repeating-linear-gradient":"-moz-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )|-webkit-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )|-o-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )","-legacy-linear-gradient-arguments":"[<angle>|<side-or-corner>]? , <color-stop-list>","-legacy-radial-gradient":"-moz-radial-gradient( <-legacy-radial-gradient-arguments> )|-webkit-radial-gradient( <-legacy-radial-gradient-arguments> )|-o-radial-gradient( <-legacy-radial-gradient-arguments> )","-legacy-repeating-radial-gradient":"-moz-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )|-webkit-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )|-o-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )","-legacy-radial-gradient-arguments":"[<position> ,]? [[[<-legacy-radial-gradient-shape>||<-legacy-radial-gradient-size>]|[<length>|<percentage>]{2}] ,]? <color-stop-list>","-legacy-radial-gradient-size":"closest-side|closest-corner|farthest-side|farthest-corner|contain|cover","-legacy-radial-gradient-shape":"circle|ellipse","-non-standard-font":"-apple-system-body|-apple-system-headline|-apple-system-subheadline|-apple-system-caption1|-apple-system-caption2|-apple-system-footnote|-apple-system-short-body|-apple-system-short-headline|-apple-system-short-subheadline|-apple-system-short-caption1|-apple-system-short-footnote|-apple-system-tall-body","-non-standard-color":"-moz-ButtonDefault|-moz-ButtonHoverFace|-moz-ButtonHoverText|-moz-CellHighlight|-moz-CellHighlightText|-moz-Combobox|-moz-ComboboxText|-moz-Dialog|-moz-DialogText|-moz-dragtargetzone|-moz-EvenTreeRow|-moz-Field|-moz-FieldText|-moz-html-CellHighlight|-moz-html-CellHighlightText|-moz-mac-accentdarkestshadow|-moz-mac-accentdarkshadow|-moz-mac-accentface|-moz-mac-accentlightesthighlight|-moz-mac-accentlightshadow|-moz-mac-accentregularhighlight|-moz-mac-accentregularshadow|-moz-mac-chrome-active|-moz-mac-chrome-inactive|-moz-mac-focusring|-moz-mac-menuselect|-moz-mac-menushadow|-moz-mac-menutextselect|-moz-MenuHover|-moz-MenuHoverText|-moz-MenuBarText|-moz-MenuBarHoverText|-moz-nativehyperlinktext|-moz-OddTreeRow|-moz-win-communicationstext|-moz-win-mediatext|-moz-activehyperlinktext|-moz-default-background-color|-moz-default-color|-moz-hyperlinktext|-moz-visitedhyperlinktext|-webkit-activelink|-webkit-focus-ring-color|-webkit-link|-webkit-text","-non-standard-image-rendering":"optimize-contrast|-moz-crisp-edges|-o-crisp-edges|-webkit-optimize-contrast","-non-standard-overflow":"-moz-scrollbars-none|-moz-scrollbars-horizontal|-moz-scrollbars-vertical|-moz-hidden-unscrollable","-non-standard-width":"fill-available|min-intrinsic|intrinsic|-moz-available|-moz-fit-content|-moz-min-content|-moz-max-content|-webkit-min-content|-webkit-max-content","-webkit-gradient()":"-webkit-gradient( <-webkit-gradient-type> , <-webkit-gradient-point> [, <-webkit-gradient-point>|, <-webkit-gradient-radius> , <-webkit-gradient-point>] [, <-webkit-gradient-radius>]? [, <-webkit-gradient-color-stop>]* )","-webkit-gradient-color-stop":"from( <color> )|color-stop( [<number-zero-one>|<percentage>] , <color> )|to( <color> )","-webkit-gradient-point":"[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]","-webkit-gradient-radius":"<length>|<percentage>","-webkit-gradient-type":"linear|radial","-webkit-mask-box-repeat":"repeat|stretch|round","-webkit-mask-clip-style":"border|border-box|padding|padding-box|content|content-box|text","-ms-filter-function-list":"<-ms-filter-function>+","-ms-filter-function":"<-ms-filter-function-progid>|<-ms-filter-function-legacy>","-ms-filter-function-progid":"'progid:' [<ident-token> '.']* [<ident-token>|<function-token> <any-value>? )]","-ms-filter-function-legacy":"<ident-token>|<function-token> <any-value>? )","-ms-filter":"<string>",age:"child|young|old","attr-name":"<wq-name>","attr-fallback":"<any-value>","bg-clip":"<box>|border|text","border-radius":"<length-percentage>{1,2}",bottom:"<length>|auto","generic-voice":"[<age>? <gender> <integer>?]",gender:"male|female|neutral","lab()":"lab( [<percentage>|<number>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","lch()":"lch( [<percentage>|<number>|none] [<percentage>|<number>|none] [<hue>|none] [/ [<alpha-value>|none]]? )",left:"<length>|auto","mask-image":"<mask-reference>#",paint:"none|<color>|<url> [none|<color>]?|context-fill|context-stroke",ratio:"<number [0,∞]> [/ <number [0,∞]>]?","reversed-counter-name":"reversed( <counter-name> )",right:"<length>|auto","svg-length":"<percentage>|<length>|<number>","svg-writing-mode":"lr-tb|rl-tb|tb-rl|lr|rl|tb",top:"<length>|auto","track-group":"'(' [<string>* <track-minmax> <string>*]+ ')' ['[' <positive-integer> ']']?|<track-minmax>","track-list-v0":"[<string>* <track-group> <string>*]+|none","track-minmax":"minmax( <track-breadth> , <track-breadth> )|auto|<track-breadth>|fit-content",x:"<number>",y:"<number>",declaration:"<ident-token> : <declaration-value>? ['!' important]?","declaration-list":"[<declaration>? ';']* <declaration>?",url:"url( <string> <url-modifier>* )|<url-token>","url-modifier":"<ident>|<function-token> <any-value> )","number-zero-one":"<number [0,1]>","number-one-or-greater":"<number [1,∞]>","positive-integer":"<integer [0,∞]>","-non-standard-display":"-ms-inline-flexbox|-ms-grid|-ms-inline-grid|-webkit-flex|-webkit-inline-flex|-webkit-box|-webkit-inline-box|-moz-inline-stack|-moz-box|-moz-inline-box"},properties:{"--*":"<declaration-value>","-ms-accelerator":"false|true","-ms-block-progression":"tb|rl|bt|lr","-ms-content-zoom-chaining":"none|chained","-ms-content-zooming":"none|zoom","-ms-content-zoom-limit":"<'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'>","-ms-content-zoom-limit-max":"<percentage>","-ms-content-zoom-limit-min":"<percentage>","-ms-content-zoom-snap":"<'-ms-content-zoom-snap-type'>||<'-ms-content-zoom-snap-points'>","-ms-content-zoom-snap-points":"snapInterval( <percentage> , <percentage> )|snapList( <percentage># )","-ms-content-zoom-snap-type":"none|proximity|mandatory","-ms-filter":"<string>","-ms-flow-from":"[none|<custom-ident>]#","-ms-flow-into":"[none|<custom-ident>]#","-ms-grid-columns":"none|<track-list>|<auto-track-list>","-ms-grid-rows":"none|<track-list>|<auto-track-list>","-ms-high-contrast-adjust":"auto|none","-ms-hyphenate-limit-chars":"auto|<integer>{1,3}","-ms-hyphenate-limit-lines":"no-limit|<integer>","-ms-hyphenate-limit-zone":"<percentage>|<length>","-ms-ime-align":"auto|after","-ms-overflow-style":"auto|none|scrollbar|-ms-autohiding-scrollbar","-ms-scrollbar-3dlight-color":"<color>","-ms-scrollbar-arrow-color":"<color>","-ms-scrollbar-base-color":"<color>","-ms-scrollbar-darkshadow-color":"<color>","-ms-scrollbar-face-color":"<color>","-ms-scrollbar-highlight-color":"<color>","-ms-scrollbar-shadow-color":"<color>","-ms-scrollbar-track-color":"<color>","-ms-scroll-chaining":"chained|none","-ms-scroll-limit":"<'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-scroll-limit-x-max'> <'-ms-scroll-limit-y-max'>","-ms-scroll-limit-x-max":"auto|<length>","-ms-scroll-limit-x-min":"<length>","-ms-scroll-limit-y-max":"auto|<length>","-ms-scroll-limit-y-min":"<length>","-ms-scroll-rails":"none|railed","-ms-scroll-snap-points-x":"snapInterval( <length-percentage> , <length-percentage> )|snapList( <length-percentage># )","-ms-scroll-snap-points-y":"snapInterval( <length-percentage> , <length-percentage> )|snapList( <length-percentage># )","-ms-scroll-snap-type":"none|proximity|mandatory","-ms-scroll-snap-x":"<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'>","-ms-scroll-snap-y":"<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'>","-ms-scroll-translation":"none|vertical-to-horizontal","-ms-text-autospace":"none|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space","-ms-touch-select":"grippers|none","-ms-user-select":"none|element|text","-ms-wrap-flow":"auto|both|start|end|maximum|clear","-ms-wrap-margin":"<length>","-ms-wrap-through":"wrap|none","-moz-appearance":"none|button|button-arrow-down|button-arrow-next|button-arrow-previous|button-arrow-up|button-bevel|button-focus|caret|checkbox|checkbox-container|checkbox-label|checkmenuitem|dualbutton|groupbox|listbox|listitem|menuarrow|menubar|menucheckbox|menuimage|menuitem|menuitemtext|menulist|menulist-button|menulist-text|menulist-textfield|menupopup|menuradio|menuseparator|meterbar|meterchunk|progressbar|progressbar-vertical|progresschunk|progresschunk-vertical|radio|radio-container|radio-label|radiomenuitem|range|range-thumb|resizer|resizerpanel|scale-horizontal|scalethumbend|scalethumb-horizontal|scalethumbstart|scalethumbtick|scalethumb-vertical|scale-vertical|scrollbarbutton-down|scrollbarbutton-left|scrollbarbutton-right|scrollbarbutton-up|scrollbarthumb-horizontal|scrollbarthumb-vertical|scrollbartrack-horizontal|scrollbartrack-vertical|searchfield|separator|sheet|spinner|spinner-downbutton|spinner-textfield|spinner-upbutton|splitter|statusbar|statusbarpanel|tab|tabpanel|tabpanels|tab-scroll-arrow-back|tab-scroll-arrow-forward|textfield|textfield-multiline|toolbar|toolbarbutton|toolbarbutton-dropdown|toolbargripper|toolbox|tooltip|treeheader|treeheadercell|treeheadersortarrow|treeitem|treeline|treetwisty|treetwistyopen|treeview|-moz-mac-unified-toolbar|-moz-win-borderless-glass|-moz-win-browsertabbar-toolbox|-moz-win-communicationstext|-moz-win-communications-toolbox|-moz-win-exclude-glass|-moz-win-glass|-moz-win-mediatext|-moz-win-media-toolbox|-moz-window-button-box|-moz-window-button-box-maximized|-moz-window-button-close|-moz-window-button-maximize|-moz-window-button-minimize|-moz-window-button-restore|-moz-window-frame-bottom|-moz-window-frame-left|-moz-window-frame-right|-moz-window-titlebar|-moz-window-titlebar-maximized","-moz-binding":"<url>|none","-moz-border-bottom-colors":"<color>+|none","-moz-border-left-colors":"<color>+|none","-moz-border-right-colors":"<color>+|none","-moz-border-top-colors":"<color>+|none","-moz-context-properties":"none|[fill|fill-opacity|stroke|stroke-opacity]#","-moz-float-edge":"border-box|content-box|margin-box|padding-box","-moz-force-broken-image-icon":"0|1","-moz-image-region":"<shape>|auto","-moz-orient":"inline|block|horizontal|vertical","-moz-outline-radius":"<outline-radius>{1,4} [/ <outline-radius>{1,4}]?","-moz-outline-radius-bottomleft":"<outline-radius>","-moz-outline-radius-bottomright":"<outline-radius>","-moz-outline-radius-topleft":"<outline-radius>","-moz-outline-radius-topright":"<outline-radius>","-moz-stack-sizing":"ignore|stretch-to-fit","-moz-text-blink":"none|blink","-moz-user-focus":"ignore|normal|select-after|select-before|select-menu|select-same|select-all|none","-moz-user-input":"auto|none|enabled|disabled","-moz-user-modify":"read-only|read-write|write-only","-moz-window-dragging":"drag|no-drag","-moz-window-shadow":"default|menu|tooltip|sheet|none","-webkit-appearance":"none|button|button-bevel|caps-lock-indicator|caret|checkbox|default-button|inner-spin-button|listbox|listitem|media-controls-background|media-controls-fullscreen-background|media-current-time-display|media-enter-fullscreen-button|media-exit-fullscreen-button|media-fullscreen-button|media-mute-button|media-overlay-play-button|media-play-button|media-seek-back-button|media-seek-forward-button|media-slider|media-sliderthumb|media-time-remaining-display|media-toggle-closed-captions-button|media-volume-slider|media-volume-slider-container|media-volume-sliderthumb|menulist|menulist-button|menulist-text|menulist-textfield|meter|progress-bar|progress-bar-value|push-button|radio|scrollbarbutton-down|scrollbarbutton-left|scrollbarbutton-right|scrollbarbutton-up|scrollbargripper-horizontal|scrollbargripper-vertical|scrollbarthumb-horizontal|scrollbarthumb-vertical|scrollbartrack-horizontal|scrollbartrack-vertical|searchfield|searchfield-cancel-button|searchfield-decoration|searchfield-results-button|searchfield-results-decoration|slider-horizontal|slider-vertical|sliderthumb-horizontal|sliderthumb-vertical|square-button|textarea|textfield|-apple-pay-button","-webkit-border-before":"<'border-width'>||<'border-style'>||<color>","-webkit-border-before-color":"<color>","-webkit-border-before-style":"<'border-style'>","-webkit-border-before-width":"<'border-width'>","-webkit-box-reflect":"[above|below|right|left]? <length>? <image>?","-webkit-line-clamp":"none|<integer>","-webkit-mask":"[<mask-reference>||<position> [/ <bg-size>]?||<repeat-style>||[<box>|border|padding|content|text]||[<box>|border|padding|content]]#","-webkit-mask-attachment":"<attachment>#","-webkit-mask-clip":"[<box>|border|padding|content|text]#","-webkit-mask-composite":"<composite-style>#","-webkit-mask-image":"<mask-reference>#","-webkit-mask-origin":"[<box>|border|padding|content]#","-webkit-mask-position":"<position>#","-webkit-mask-position-x":"[<length-percentage>|left|center|right]#","-webkit-mask-position-y":"[<length-percentage>|top|center|bottom]#","-webkit-mask-repeat":"<repeat-style>#","-webkit-mask-repeat-x":"repeat|no-repeat|space|round","-webkit-mask-repeat-y":"repeat|no-repeat|space|round","-webkit-mask-size":"<bg-size>#","-webkit-overflow-scrolling":"auto|touch","-webkit-tap-highlight-color":"<color>","-webkit-text-fill-color":"<color>","-webkit-text-stroke":"<length>||<color>","-webkit-text-stroke-color":"<color>","-webkit-text-stroke-width":"<length>","-webkit-touch-callout":"default|none","-webkit-user-modify":"read-only|read-write|read-write-plaintext-only","accent-color":"auto|<color>","align-content":"normal|<baseline-position>|<content-distribution>|<overflow-position>? <content-position>","align-items":"normal|stretch|<baseline-position>|[<overflow-position>? <self-position>]","align-self":"auto|normal|stretch|<baseline-position>|<overflow-position>? <self-position>","align-tracks":"[normal|<baseline-position>|<content-distribution>|<overflow-position>? <content-position>]#",all:"initial|inherit|unset|revert|revert-layer",animation:"<single-animation>#","animation-delay":"<time>#","animation-direction":"<single-animation-direction>#","animation-duration":"<time>#","animation-fill-mode":"<single-animation-fill-mode>#","animation-iteration-count":"<single-animation-iteration-count>#","animation-name":"[none|<keyframes-name>]#","animation-play-state":"<single-animation-play-state>#","animation-timing-function":"<easing-function>#","animation-timeline":"<single-animation-timeline>#",appearance:"none|auto|textfield|menulist-button|<compat-auto>","aspect-ratio":"auto|<ratio>",azimuth:"<angle>|[[left-side|far-left|left|center-left|center|center-right|right|far-right|right-side]||behind]|leftwards|rightwards","backdrop-filter":"none|<filter-function-list>","backface-visibility":"visible|hidden",background:"[<bg-layer> ,]* <final-bg-layer>","background-attachment":"<attachment>#","background-blend-mode":"<blend-mode>#","background-clip":"<bg-clip>#","background-color":"<color>","background-image":"<bg-image>#","background-origin":"<box>#","background-position":"<bg-position>#","background-position-x":"[center|[[left|right|x-start|x-end]? <length-percentage>?]!]#","background-position-y":"[center|[[top|bottom|y-start|y-end]? <length-percentage>?]!]#","background-repeat":"<repeat-style>#","background-size":"<bg-size>#","block-overflow":"clip|ellipsis|<string>","block-size":"<'width'>",border:"<line-width>||<line-style>||<color>","border-block":"<'border-top-width'>||<'border-top-style'>||<color>","border-block-color":"<'border-top-color'>{1,2}","border-block-style":"<'border-top-style'>","border-block-width":"<'border-top-width'>","border-block-end":"<'border-top-width'>||<'border-top-style'>||<color>","border-block-end-color":"<'border-top-color'>","border-block-end-style":"<'border-top-style'>","border-block-end-width":"<'border-top-width'>","border-block-start":"<'border-top-width'>||<'border-top-style'>||<color>","border-block-start-color":"<'border-top-color'>","border-block-start-style":"<'border-top-style'>","border-block-start-width":"<'border-top-width'>","border-bottom":"<line-width>||<line-style>||<color>","border-bottom-color":"<'border-top-color'>","border-bottom-left-radius":"<length-percentage>{1,2}","border-bottom-right-radius":"<length-percentage>{1,2}","border-bottom-style":"<line-style>","border-bottom-width":"<line-width>","border-collapse":"collapse|separate","border-color":"<color>{1,4}","border-end-end-radius":"<length-percentage>{1,2}","border-end-start-radius":"<length-percentage>{1,2}","border-image":"<'border-image-source'>||<'border-image-slice'> [/ <'border-image-width'>|/ <'border-image-width'>? / <'border-image-outset'>]?||<'border-image-repeat'>","border-image-outset":"[<length>|<number>]{1,4}","border-image-repeat":"[stretch|repeat|round|space]{1,2}","border-image-slice":"<number-percentage>{1,4}&&fill?","border-image-source":"none|<image>","border-image-width":"[<length-percentage>|<number>|auto]{1,4}","border-inline":"<'border-top-width'>||<'border-top-style'>||<color>","border-inline-end":"<'border-top-width'>||<'border-top-style'>||<color>","border-inline-color":"<'border-top-color'>{1,2}","border-inline-style":"<'border-top-style'>","border-inline-width":"<'border-top-width'>","border-inline-end-color":"<'border-top-color'>","border-inline-end-style":"<'border-top-style'>","border-inline-end-width":"<'border-top-width'>","border-inline-start":"<'border-top-width'>||<'border-top-style'>||<color>","border-inline-start-color":"<'border-top-color'>","border-inline-start-style":"<'border-top-style'>","border-inline-start-width":"<'border-top-width'>","border-left":"<line-width>||<line-style>||<color>","border-left-color":"<color>","border-left-style":"<line-style>","border-left-width":"<line-width>","border-radius":"<length-percentage>{1,4} [/ <length-percentage>{1,4}]?","border-right":"<line-width>||<line-style>||<color>","border-right-color":"<color>","border-right-style":"<line-style>","border-right-width":"<line-width>","border-spacing":"<length> <length>?","border-start-end-radius":"<length-percentage>{1,2}","border-start-start-radius":"<length-percentage>{1,2}","border-style":"<line-style>{1,4}","border-top":"<line-width>||<line-style>||<color>","border-top-color":"<color>","border-top-left-radius":"<length-percentage>{1,2}","border-top-right-radius":"<length-percentage>{1,2}","border-top-style":"<line-style>","border-top-width":"<line-width>","border-width":"<line-width>{1,4}",bottom:"<length>|<percentage>|auto","box-align":"start|center|end|baseline|stretch","box-decoration-break":"slice|clone","box-direction":"normal|reverse|inherit","box-flex":"<number>","box-flex-group":"<integer>","box-lines":"single|multiple","box-ordinal-group":"<integer>","box-orient":"horizontal|vertical|inline-axis|block-axis|inherit","box-pack":"start|center|end|justify","box-shadow":"none|<shadow>#","box-sizing":"content-box|border-box","break-after":"auto|avoid|always|all|avoid-page|page|left|right|recto|verso|avoid-column|column|avoid-region|region","break-before":"auto|avoid|always|all|avoid-page|page|left|right|recto|verso|avoid-column|column|avoid-region|region","break-inside":"auto|avoid|avoid-page|avoid-column|avoid-region","caption-side":"top|bottom|block-start|block-end|inline-start|inline-end","caret-color":"auto|<color>",clear:"none|left|right|both|inline-start|inline-end",clip:"<shape>|auto","clip-path":"<clip-source>|[<basic-shape>||<geometry-box>]|none",color:"<color>","print-color-adjust":"economy|exact","color-scheme":"normal|[light|dark|<custom-ident>]+&&only?","column-count":"<integer>|auto","column-fill":"auto|balance|balance-all","column-gap":"normal|<length-percentage>","column-rule":"<'column-rule-width'>||<'column-rule-style'>||<'column-rule-color'>","column-rule-color":"<color>","column-rule-style":"<'border-style'>","column-rule-width":"<'border-width'>","column-span":"none|all","column-width":"<length>|auto",columns:"<'column-width'>||<'column-count'>",contain:"none|strict|content|[size||layout||style||paint]",content:"normal|none|[<content-replacement>|<content-list>] [/ [<string>|<counter>]+]?","content-visibility":"visible|auto|hidden","counter-increment":"[<counter-name> <integer>?]+|none","counter-reset":"[<counter-name> <integer>?|<reversed-counter-name> <integer>?]+|none","counter-set":"[<counter-name> <integer>?]+|none",cursor:"[[<url> [<x> <y>]? ,]* [auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|e-resize|n-resize|ne-resize|nw-resize|s-resize|se-resize|sw-resize|w-resize|ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing|hand|-webkit-grab|-webkit-grabbing|-webkit-zoom-in|-webkit-zoom-out|-moz-grab|-moz-grabbing|-moz-zoom-in|-moz-zoom-out]]",direction:"ltr|rtl",display:"[<display-outside>||<display-inside>]|<display-listitem>|<display-internal>|<display-box>|<display-legacy>|<-non-standard-display>","empty-cells":"show|hide",filter:"none|<filter-function-list>|<-ms-filter-function-list>",flex:"none|[<'flex-grow'> <'flex-shrink'>?||<'flex-basis'>]","flex-basis":"content|<'width'>","flex-direction":"row|row-reverse|column|column-reverse","flex-flow":"<'flex-direction'>||<'flex-wrap'>","flex-grow":"<number>","flex-shrink":"<number>","flex-wrap":"nowrap|wrap|wrap-reverse",float:"left|right|none|inline-start|inline-end",font:"[[<'font-style'>||<font-variant-css21>||<'font-weight'>||<'font-stretch'>]? <'font-size'> [/ <'line-height'>]? <'font-family'>]|caption|icon|menu|message-box|small-caption|status-bar","font-family":"[<family-name>|<generic-family>]#","font-feature-settings":"normal|<feature-tag-value>#","font-kerning":"auto|normal|none","font-language-override":"normal|<string>","font-optical-sizing":"auto|none","font-variation-settings":"normal|[<string> <number>]#","font-size":"<absolute-size>|<relative-size>|<length-percentage>","font-size-adjust":"none|[ex-height|cap-height|ch-width|ic-width|ic-height]? [from-font|<number>]","font-smooth":"auto|never|always|<absolute-size>|<length>","font-stretch":"<font-stretch-absolute>","font-style":"normal|italic|oblique <angle>?","font-synthesis":"none|[weight||style||small-caps]","font-variant":"normal|none|[<common-lig-values>||<discretionary-lig-values>||<historical-lig-values>||<contextual-alt-values>||stylistic( <feature-value-name> )||historical-forms||styleset( <feature-value-name># )||character-variant( <feature-value-name># )||swash( <feature-value-name> )||ornaments( <feature-value-name> )||annotation( <feature-value-name> )||[small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps]||<numeric-figure-values>||<numeric-spacing-values>||<numeric-fraction-values>||ordinal||slashed-zero||<east-asian-variant-values>||<east-asian-width-values>||ruby]","font-variant-alternates":"normal|[stylistic( <feature-value-name> )||historical-forms||styleset( <feature-value-name># )||character-variant( <feature-value-name># )||swash( <feature-value-name> )||ornaments( <feature-value-name> )||annotation( <feature-value-name> )]","font-variant-caps":"normal|small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps","font-variant-east-asian":"normal|[<east-asian-variant-values>||<east-asian-width-values>||ruby]","font-variant-ligatures":"normal|none|[<common-lig-values>||<discretionary-lig-values>||<historical-lig-values>||<contextual-alt-values>]","font-variant-numeric":"normal|[<numeric-figure-values>||<numeric-spacing-values>||<numeric-fraction-values>||ordinal||slashed-zero]","font-variant-position":"normal|sub|super","font-weight":"<font-weight-absolute>|bolder|lighter","forced-color-adjust":"auto|none",gap:"<'row-gap'> <'column-gap'>?",grid:"<'grid-template'>|<'grid-template-rows'> / [auto-flow&&dense?] <'grid-auto-columns'>?|[auto-flow&&dense?] <'grid-auto-rows'>? / <'grid-template-columns'>","grid-area":"<grid-line> [/ <grid-line>]{0,3}","grid-auto-columns":"<track-size>+","grid-auto-flow":"[row|column]||dense","grid-auto-rows":"<track-size>+","grid-column":"<grid-line> [/ <grid-line>]?","grid-column-end":"<grid-line>","grid-column-gap":"<length-percentage>","grid-column-start":"<grid-line>","grid-gap":"<'grid-row-gap'> <'grid-column-gap'>?","grid-row":"<grid-line> [/ <grid-line>]?","grid-row-end":"<grid-line>","grid-row-gap":"<length-percentage>","grid-row-start":"<grid-line>","grid-template":"none|[<'grid-template-rows'> / <'grid-template-columns'>]|[<line-names>? <string> <track-size>? <line-names>?]+ [/ <explicit-track-list>]?","grid-template-areas":"none|<string>+","grid-template-columns":"none|<track-list>|<auto-track-list>|subgrid <line-name-list>?","grid-template-rows":"none|<track-list>|<auto-track-list>|subgrid <line-name-list>?","hanging-punctuation":"none|[first||[force-end|allow-end]||last]",height:"auto|<length>|<percentage>|min-content|max-content|fit-content|fit-content( <length-percentage> )","hyphenate-character":"auto|<string>",hyphens:"none|manual|auto","image-orientation":"from-image|<angle>|[<angle>? flip]","image-rendering":"auto|crisp-edges|pixelated|optimizeSpeed|optimizeQuality|<-non-standard-image-rendering>","image-resolution":"[from-image||<resolution>]&&snap?","ime-mode":"auto|normal|active|inactive|disabled","initial-letter":"normal|[<number> <integer>?]","initial-letter-align":"[auto|alphabetic|hanging|ideographic]","inline-size":"<'width'>","input-security":"auto|none",inset:"<'top'>{1,4}","inset-block":"<'top'>{1,2}","inset-block-end":"<'top'>","inset-block-start":"<'top'>","inset-inline":"<'top'>{1,2}","inset-inline-end":"<'top'>","inset-inline-start":"<'top'>",isolation:"auto|isolate","justify-content":"normal|<content-distribution>|<overflow-position>? [<content-position>|left|right]","justify-items":"normal|stretch|<baseline-position>|<overflow-position>? [<self-position>|left|right]|legacy|legacy&&[left|right|center]","justify-self":"auto|normal|stretch|<baseline-position>|<overflow-position>? [<self-position>|left|right]","justify-tracks":"[normal|<content-distribution>|<overflow-position>? [<content-position>|left|right]]#",left:"<length>|<percentage>|auto","letter-spacing":"normal|<length-percentage>","line-break":"auto|loose|normal|strict|anywhere","line-clamp":"none|<integer>","line-height":"normal|<number>|<length>|<percentage>","line-height-step":"<length>","list-style":"<'list-style-type'>||<'list-style-position'>||<'list-style-image'>","list-style-image":"<image>|none","list-style-position":"inside|outside","list-style-type":"<counter-style>|<string>|none",margin:"[<length>|<percentage>|auto]{1,4}","margin-block":"<'margin-left'>{1,2}","margin-block-end":"<'margin-left'>","margin-block-start":"<'margin-left'>","margin-bottom":"<length>|<percentage>|auto","margin-inline":"<'margin-left'>{1,2}","margin-inline-end":"<'margin-left'>","margin-inline-start":"<'margin-left'>","margin-left":"<length>|<percentage>|auto","margin-right":"<length>|<percentage>|auto","margin-top":"<length>|<percentage>|auto","margin-trim":"none|in-flow|all",mask:"<mask-layer>#","mask-border":"<'mask-border-source'>||<'mask-border-slice'> [/ <'mask-border-width'>? [/ <'mask-border-outset'>]?]?||<'mask-border-repeat'>||<'mask-border-mode'>","mask-border-mode":"luminance|alpha","mask-border-outset":"[<length>|<number>]{1,4}","mask-border-repeat":"[stretch|repeat|round|space]{1,2}","mask-border-slice":"<number-percentage>{1,4} fill?","mask-border-source":"none|<image>","mask-border-width":"[<length-percentage>|<number>|auto]{1,4}","mask-clip":"[<geometry-box>|no-clip]#","mask-composite":"<compositing-operator>#","mask-image":"<mask-reference>#","mask-mode":"<masking-mode>#","mask-origin":"<geometry-box>#","mask-position":"<position>#","mask-repeat":"<repeat-style>#","mask-size":"<bg-size>#","mask-type":"luminance|alpha","masonry-auto-flow":"[pack|next]||[definite-first|ordered]","math-style":"normal|compact","max-block-size":"<'max-width'>","max-height":"none|<length-percentage>|min-content|max-content|fit-content|fit-content( <length-percentage> )","max-inline-size":"<'max-width'>","max-lines":"none|<integer>","max-width":"none|<length-percentage>|min-content|max-content|fit-content|fit-content( <length-percentage> )|<-non-standard-width>","min-block-size":"<'min-width'>","min-height":"auto|<length>|<percentage>|min-content|max-content|fit-content|fit-content( <length-percentage> )","min-inline-size":"<'min-width'>","min-width":"auto|<length>|<percentage>|min-content|max-content|fit-content|fit-content( <length-percentage> )|<-non-standard-width>","mix-blend-mode":"<blend-mode>|plus-lighter","object-fit":"fill|contain|cover|none|scale-down","object-position":"<position>",offset:"[<'offset-position'>? [<'offset-path'> [<'offset-distance'>||<'offset-rotate'>]?]?]! [/ <'offset-anchor'>]?","offset-anchor":"auto|<position>","offset-distance":"<length-percentage>","offset-path":"none|ray( [<angle>&&<size>&&contain?] )|<path()>|<url>|[<basic-shape>||<geometry-box>]","offset-position":"auto|<position>","offset-rotate":"[auto|reverse]||<angle>",opacity:"<alpha-value>",order:"<integer>",orphans:"<integer>",outline:"[<'outline-color'>||<'outline-style'>||<'outline-width'>]","outline-color":"<color>|invert","outline-offset":"<length>","outline-style":"auto|<'border-style'>","outline-width":"<line-width>",overflow:"[visible|hidden|clip|scroll|auto]{1,2}|<-non-standard-overflow>","overflow-anchor":"auto|none","overflow-block":"visible|hidden|clip|scroll|auto","overflow-clip-box":"padding-box|content-box","overflow-clip-margin":"<visual-box>||<length [0,∞]>","overflow-inline":"visible|hidden|clip|scroll|auto","overflow-wrap":"normal|break-word|anywhere","overflow-x":"visible|hidden|clip|scroll|auto","overflow-y":"visible|hidden|clip|scroll|auto","overscroll-behavior":"[contain|none|auto]{1,2}","overscroll-behavior-block":"contain|none|auto","overscroll-behavior-inline":"contain|none|auto","overscroll-behavior-x":"contain|none|auto","overscroll-behavior-y":"contain|none|auto",padding:"[<length>|<percentage>]{1,4}","padding-block":"<'padding-left'>{1,2}","padding-block-end":"<'padding-left'>","padding-block-start":"<'padding-left'>","padding-bottom":"<length>|<percentage>","padding-inline":"<'padding-left'>{1,2}","padding-inline-end":"<'padding-left'>","padding-inline-start":"<'padding-left'>","padding-left":"<length>|<percentage>","padding-right":"<length>|<percentage>","padding-top":"<length>|<percentage>","page-break-after":"auto|always|avoid|left|right|recto|verso","page-break-before":"auto|always|avoid|left|right|recto|verso","page-break-inside":"auto|avoid","paint-order":"normal|[fill||stroke||markers]",perspective:"none|<length>","perspective-origin":"<position>","place-content":"<'align-content'> <'justify-content'>?","place-items":"<'align-items'> <'justify-items'>?","place-self":"<'align-self'> <'justify-self'>?","pointer-events":"auto|none|visiblePainted|visibleFill|visibleStroke|visible|painted|fill|stroke|all|inherit",position:"static|relative|absolute|sticky|fixed|-webkit-sticky",quotes:"none|auto|[<string> <string>]+",resize:"none|both|horizontal|vertical|block|inline",right:"<length>|<percentage>|auto",rotate:"none|<angle>|[x|y|z|<number>{3}]&&<angle>","row-gap":"normal|<length-percentage>","ruby-align":"start|center|space-between|space-around","ruby-merge":"separate|collapse|auto","ruby-position":"[alternate||[over|under]]|inter-character",scale:"none|<number>{1,3}","scrollbar-color":"auto|<color>{2}","scrollbar-gutter":"auto|stable&&both-edges?","scrollbar-width":"auto|thin|none","scroll-behavior":"auto|smooth","scroll-margin":"<length>{1,4}","scroll-margin-block":"<length>{1,2}","scroll-margin-block-start":"<length>","scroll-margin-block-end":"<length>","scroll-margin-bottom":"<length>","scroll-margin-inline":"<length>{1,2}","scroll-margin-inline-start":"<length>","scroll-margin-inline-end":"<length>","scroll-margin-left":"<length>","scroll-margin-right":"<length>","scroll-margin-top":"<length>","scroll-padding":"[auto|<length-percentage>]{1,4}","scroll-padding-block":"[auto|<length-percentage>]{1,2}","scroll-padding-block-start":"auto|<length-percentage>","scroll-padding-block-end":"auto|<length-percentage>","scroll-padding-bottom":"auto|<length-percentage>","scroll-padding-inline":"[auto|<length-percentage>]{1,2}","scroll-padding-inline-start":"auto|<length-percentage>","scroll-padding-inline-end":"auto|<length-percentage>","scroll-padding-left":"auto|<length-percentage>","scroll-padding-right":"auto|<length-percentage>","scroll-padding-top":"auto|<length-percentage>","scroll-snap-align":"[none|start|end|center]{1,2}","scroll-snap-coordinate":"none|<position>#","scroll-snap-destination":"<position>","scroll-snap-points-x":"none|repeat( <length-percentage> )","scroll-snap-points-y":"none|repeat( <length-percentage> )","scroll-snap-stop":"normal|always","scroll-snap-type":"none|[x|y|block|inline|both] [mandatory|proximity]?","scroll-snap-type-x":"none|mandatory|proximity","scroll-snap-type-y":"none|mandatory|proximity","shape-image-threshold":"<alpha-value>","shape-margin":"<length-percentage>","shape-outside":"none|[<shape-box>||<basic-shape>]|<image>","tab-size":"<integer>|<length>","table-layout":"auto|fixed","text-align":"start|end|left|right|center|justify|match-parent","text-align-last":"auto|start|end|left|right|center|justify","text-combine-upright":"none|all|[digits <integer>?]","text-decoration":"<'text-decoration-line'>||<'text-decoration-style'>||<'text-decoration-color'>||<'text-decoration-thickness'>","text-decoration-color":"<color>","text-decoration-line":"none|[underline||overline||line-through||blink]|spelling-error|grammar-error","text-decoration-skip":"none|[objects||[spaces|[leading-spaces||trailing-spaces]]||edges||box-decoration]","text-decoration-skip-ink":"auto|all|none","text-decoration-style":"solid|double|dotted|dashed|wavy","text-decoration-thickness":"auto|from-font|<length>|<percentage>","text-emphasis":"<'text-emphasis-style'>||<'text-emphasis-color'>","text-emphasis-color":"<color>","text-emphasis-position":"[over|under]&&[right|left]","text-emphasis-style":"none|[[filled|open]||[dot|circle|double-circle|triangle|sesame]]|<string>","text-indent":"<length-percentage>&&hanging?&&each-line?","text-justify":"auto|inter-character|inter-word|none","text-orientation":"mixed|upright|sideways","text-overflow":"[clip|ellipsis|<string>]{1,2}","text-rendering":"auto|optimizeSpeed|optimizeLegibility|geometricPrecision","text-shadow":"none|<shadow-t>#","text-size-adjust":"none|auto|<percentage>","text-transform":"none|capitalize|uppercase|lowercase|full-width|full-size-kana","text-underline-offset":"auto|<length>|<percentage>","text-underline-position":"auto|from-font|[under||[left|right]]",top:"<length>|<percentage>|auto","touch-action":"auto|none|[[pan-x|pan-left|pan-right]||[pan-y|pan-up|pan-down]||pinch-zoom]|manipulation",transform:"none|<transform-list>","transform-box":"content-box|border-box|fill-box|stroke-box|view-box","transform-origin":"[<length-percentage>|left|center|right|top|bottom]|[[<length-percentage>|left|center|right]&&[<length-percentage>|top|center|bottom]] <length>?","transform-style":"flat|preserve-3d",transition:"<single-transition>#","transition-delay":"<time>#","transition-duration":"<time>#","transition-property":"none|<single-transition-property>#","transition-timing-function":"<easing-function>#",translate:"none|<length-percentage> [<length-percentage> <length>?]?","unicode-bidi":"normal|embed|isolate|bidi-override|isolate-override|plaintext|-moz-isolate|-moz-isolate-override|-moz-plaintext|-webkit-isolate|-webkit-isolate-override|-webkit-plaintext","user-select":"auto|text|none|contain|all","vertical-align":"baseline|sub|super|text-top|text-bottom|middle|top|bottom|<percentage>|<length>",visibility:"visible|hidden|collapse","white-space":"normal|pre|nowrap|pre-wrap|pre-line|break-spaces",widows:"<integer>",width:"auto|<length>|<percentage>|min-content|max-content|fit-content|fit-content( <length-percentage> )|fill|stretch|intrinsic|-moz-max-content|-webkit-max-content|-moz-fit-content|-webkit-fit-content","will-change":"auto|<animateable-feature>#","word-break":"normal|break-all|keep-all|break-word","word-spacing":"normal|<length>","word-wrap":"normal|break-word","writing-mode":"horizontal-tb|vertical-rl|vertical-lr|sideways-rl|sideways-lr|<svg-writing-mode>","z-index":"auto|<integer>",zoom:"normal|reset|<number>|<percentage>","-moz-background-clip":"padding|border","-moz-border-radius-bottomleft":"<'border-bottom-left-radius'>","-moz-border-radius-bottomright":"<'border-bottom-right-radius'>","-moz-border-radius-topleft":"<'border-top-left-radius'>","-moz-border-radius-topright":"<'border-bottom-right-radius'>","-moz-control-character-visibility":"visible|hidden","-moz-osx-font-smoothing":"auto|grayscale","-moz-user-select":"none|text|all|-moz-none","-ms-flex-align":"start|end|center|baseline|stretch","-ms-flex-item-align":"auto|start|end|center|baseline|stretch","-ms-flex-line-pack":"start|end|center|justify|distribute|stretch","-ms-flex-negative":"<'flex-shrink'>","-ms-flex-pack":"start|end|center|justify|distribute","-ms-flex-order":"<integer>","-ms-flex-positive":"<'flex-grow'>","-ms-flex-preferred-size":"<'flex-basis'>","-ms-interpolation-mode":"nearest-neighbor|bicubic","-ms-grid-column-align":"start|end|center|stretch","-ms-grid-row-align":"start|end|center|stretch","-ms-hyphenate-limit-last":"none|always|column|page|spread","-webkit-background-clip":"[<box>|border|padding|content|text]#","-webkit-column-break-after":"always|auto|avoid","-webkit-column-break-before":"always|auto|avoid","-webkit-column-break-inside":"always|auto|avoid","-webkit-font-smoothing":"auto|none|antialiased|subpixel-antialiased","-webkit-mask-box-image":"[<url>|<gradient>|none] [<length-percentage>{4} <-webkit-mask-box-repeat>{2}]?","-webkit-print-color-adjust":"economy|exact","-webkit-text-security":"none|circle|disc|square","-webkit-user-drag":"none|element|auto","-webkit-user-select":"auto|none|text|all","alignment-baseline":"auto|baseline|before-edge|text-before-edge|middle|central|after-edge|text-after-edge|ideographic|alphabetic|hanging|mathematical","baseline-shift":"baseline|sub|super|<svg-length>",behavior:"<url>+","clip-rule":"nonzero|evenodd",cue:"<'cue-before'> <'cue-after'>?","cue-after":"<url> <decibel>?|none","cue-before":"<url> <decibel>?|none","dominant-baseline":"auto|use-script|no-change|reset-size|ideographic|alphabetic|hanging|mathematical|central|middle|text-after-edge|text-before-edge",fill:"<paint>","fill-opacity":"<number-zero-one>","fill-rule":"nonzero|evenodd","glyph-orientation-horizontal":"<angle>","glyph-orientation-vertical":"<angle>",kerning:"auto|<svg-length>",marker:"none|<url>","marker-end":"none|<url>","marker-mid":"none|<url>","marker-start":"none|<url>",pause:"<'pause-before'> <'pause-after'>?","pause-after":"<time>|none|x-weak|weak|medium|strong|x-strong","pause-before":"<time>|none|x-weak|weak|medium|strong|x-strong",rest:"<'rest-before'> <'rest-after'>?","rest-after":"<time>|none|x-weak|weak|medium|strong|x-strong","rest-before":"<time>|none|x-weak|weak|medium|strong|x-strong","shape-rendering":"auto|optimizeSpeed|crispEdges|geometricPrecision",src:"[<url> [format( <string># )]?|local( <family-name> )]#",speak:"auto|none|normal","speak-as":"normal|spell-out||digits||[literal-punctuation|no-punctuation]",stroke:"<paint>","stroke-dasharray":"none|[<svg-length>+]#","stroke-dashoffset":"<svg-length>","stroke-linecap":"butt|round|square","stroke-linejoin":"miter|round|bevel","stroke-miterlimit":"<number-one-or-greater>","stroke-opacity":"<number-zero-one>","stroke-width":"<svg-length>","text-anchor":"start|middle|end","unicode-range":"<urange>#","voice-balance":"<number>|left|center|right|leftwards|rightwards","voice-duration":"auto|<time>","voice-family":"[[<family-name>|<generic-voice>] ,]* [<family-name>|<generic-voice>]|preserve","voice-pitch":"<frequency>&&absolute|[[x-low|low|medium|high|x-high]||[<frequency>|<semitones>|<percentage>]]","voice-range":"<frequency>&&absolute|[[x-low|low|medium|high|x-high]||[<frequency>|<semitones>|<percentage>]]","voice-rate":"[normal|x-slow|slow|medium|fast|x-fast]||<percentage>","voice-stress":"normal|strong|moderate|none|reduced","voice-volume":"silent|[[x-soft|soft|medium|loud|x-loud]||<decibel>]"},atrules:{charset:{prelude:"<string>",descriptors:null},"counter-style":{prelude:"<counter-style-name>",descriptors:{"additive-symbols":"[<integer>&&<symbol>]#",fallback:"<counter-style-name>",negative:"<symbol> <symbol>?",pad:"<integer>&&<symbol>",prefix:"<symbol>",range:"[[<integer>|infinite]{2}]#|auto","speak-as":"auto|bullets|numbers|words|spell-out|<counter-style-name>",suffix:"<symbol>",symbols:"<symbol>+",system:"cyclic|numeric|alphabetic|symbolic|additive|[fixed <integer>?]|[extends <counter-style-name>]"}},document:{prelude:"[<url>|url-prefix( <string> )|domain( <string> )|media-document( <string> )|regexp( <string> )]#",descriptors:null},"font-face":{prelude:null,descriptors:{"ascent-override":"normal|<percentage>","descent-override":"normal|<percentage>","font-display":"[auto|block|swap|fallback|optional]","font-family":"<family-name>","font-feature-settings":"normal|<feature-tag-value>#","font-variation-settings":"normal|[<string> <number>]#","font-stretch":"<font-stretch-absolute>{1,2}","font-style":"normal|italic|oblique <angle>{0,2}","font-weight":"<font-weight-absolute>{1,2}","font-variant":"normal|none|[<common-lig-values>||<discretionary-lig-values>||<historical-lig-values>||<contextual-alt-values>||stylistic( <feature-value-name> )||historical-forms||styleset( <feature-value-name># )||character-variant( <feature-value-name># )||swash( <feature-value-name> )||ornaments( <feature-value-name> )||annotation( <feature-value-name> )||[small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps]||<numeric-figure-values>||<numeric-spacing-values>||<numeric-fraction-values>||ordinal||slashed-zero||<east-asian-variant-values>||<east-asian-width-values>||ruby]","line-gap-override":"normal|<percentage>","size-adjust":"<percentage>",src:"[<url> [format( <string># )]?|local( <family-name> )]#","unicode-range":"<urange>#"}},"font-feature-values":{prelude:"<family-name>#",descriptors:null},import:{prelude:"[<string>|<url>] [layer|layer( <layer-name> )]? [supports( [<supports-condition>|<declaration>] )]? <media-query-list>?",descriptors:null},keyframes:{prelude:"<keyframes-name>",descriptors:null},layer:{prelude:"[<layer-name>#|<layer-name>?]",descriptors:null},media:{prelude:"<media-query-list>",descriptors:null},namespace:{prelude:"<namespace-prefix>? [<string>|<url>]",descriptors:null},page:{prelude:"<page-selector-list>",descriptors:{bleed:"auto|<length>",marks:"none|[crop||cross]",size:"<length>{1,2}|auto|[<page-size>||[portrait|landscape]]"}},property:{prelude:"<custom-property-name>",descriptors:{syntax:"<string>",inherits:"true|false","initial-value":"<string>"}},"scroll-timeline":{prelude:"<timeline-name>",descriptors:null},supports:{prelude:"<supports-condition>",descriptors:null},viewport:{prelude:null,descriptors:{height:"<viewport-length>{1,2}","max-height":"<viewport-length>","max-width":"<viewport-length>","max-zoom":"auto|<number>|<percentage>","min-height":"<viewport-length>","min-width":"<viewport-length>","min-zoom":"auto|<number>|<percentage>",orientation:"auto|portrait|landscape","user-zoom":"zoom|fixed","viewport-fit":"auto|contain|cover",width:"<viewport-length>{1,2}",zoom:"auto|<number>|<percentage>"}}}},n8=ie({generate:()=>s8,name:()=>o8,parse:()=>T1,structure:()=>i8}),$n=43,Kt=45,wc=110,go=!0,r8=!1;function _c(e,t){let n=this.tokenStart+e;const r=this.charCodeAt(n);for((r===$n||r===Kt)&&(t&&this.error("Number sign is not allowed"),n++);n<this.tokenEnd;n++)pt(this.charCodeAt(n))||this.error("Integer is expected",n)}function pi(e){return _c.call(this,0,e)}function Dr(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let n="";switch(t){case wc:n="N is expected";break;case Kt:n="HyphenMinus is expected"}this.error(n,this.tokenStart+e)}}function Xm(){let e=0,t=0,n=this.tokenType;for(;n===13||n===25;)n=this.lookupType(++e);if(n!==10)if(this.isDelim($n,e)||this.isDelim(Kt,e)){t=this.isDelim($n,e)?$n:Kt;do n=this.lookupType(++e);while(n===13||n===25);n!==10&&(this.skip(e),pi.call(this,go))}else return null;return e>0&&this.skip(e),t===0&&(n=this.charCodeAt(this.tokenStart),n!==$n&&n!==Kt&&this.error("Number sign is expected")),pi.call(this,t!==0),t===Kt?"-"+this.consume(10):this.consume(10)}var o8="AnPlusB",i8={a:[String,null],b:[String,null]};function T1(){const e=this.tokenStart;let t=null,n=null;if(this.tokenType===10)pi.call(this,r8),n=this.consume(10);else if(this.tokenType===1&&this.cmpChar(this.tokenStart,Kt))switch(t="-1",Dr.call(this,1,wc),this.tokenEnd-this.tokenStart){case 2:this.next(),n=Xm.call(this);break;case 3:Dr.call(this,2,Kt),this.next(),this.skipSC(),pi.call(this,go),n="-"+this.consume(10);break;default:Dr.call(this,2,Kt),_c.call(this,3,go),this.next(),n=this.substrToCursor(e+2)}else if(this.tokenType===1||this.isDelim($n)&&this.lookupType(1)===1){let r=0;switch(t="1",this.isDelim($n)&&(r=1,this.next()),Dr.call(this,0,wc),this.tokenEnd-this.tokenStart){case 1:this.next(),n=Xm.call(this);break;case 2:Dr.call(this,1,Kt),this.next(),this.skipSC(),pi.call(this,go),n="-"+this.consume(10);break;default:Dr.call(this,1,Kt),_c.call(this,2,go),this.next(),n=this.substrToCursor(e+r+1)}}else if(this.tokenType===12){const r=this.charCodeAt(this.tokenStart),o=r===$n||r===Kt;let i=this.tokenStart+o;for(;i<this.tokenEnd&&pt(this.charCodeAt(i));i++);i===this.tokenStart+o&&this.error("Integer is expected",this.tokenStart+o),Dr.call(this,i-this.tokenStart,wc),t=this.substring(e,i),i+1===this.tokenEnd?(this.next(),n=Xm.call(this)):(Dr.call(this,i-this.tokenStart+1,Kt),i+2===this.tokenEnd?(this.next(),this.skipSC(),pi.call(this,go),n="-"+this.consume(10)):(_c.call(this,i-this.tokenStart+2,go),this.next(),n=this.substrToCursor(i+1)))}else this.error();return t!==null&&t.charCodeAt(0)===$n&&(t=t.substr(1)),n!==null&&n.charCodeAt(0)===$n&&(n=n.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:n}}function s8(e){if(e.a){const t=e.a==="+1"&&"n"||e.a==="1"&&"n"||e.a==="-1"&&"-n"||e.a+"n";if(e.b){const n=e.b[0]==="-"||e.b[0]==="+"?e.b:"+"+e.b;this.tokenize(t+n)}else this.tokenize(t)}else this.tokenize(e.b)}var a8=ie({generate:()=>f8,name:()=>c8,parse:()=>k1,structure:()=>d8,walkContext:()=>u8});function A1(e){return this.Raw(e,this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function l8(){for(let e=1,t;t=this.lookupType(e);e++){if(t===24)return!0;if(t===23||t===3)return!1}return!1}var c8="Atrule",u8="atrule",d8={name:String,prelude:["AtrulePrelude","Raw",null],block:["Block",null]};function k1(){const e=this.tokenStart;let t,n,r=null,o=null;switch(this.eat(3),t=this.substrToCursor(e+1),n=t.toLowerCase(),this.skipSC(),this.eof===!1&&this.tokenType!==23&&this.tokenType!==17&&(this.parseAtrulePrelude?r=this.parseWithFallback(this.AtrulePrelude.bind(this,t),A1):r=A1.call(this,this.tokenIndex),this.skipSC()),this.tokenType){case 17:this.next();break;case 23:hasOwnProperty.call(this.atrule,n)&&typeof this.atrule[n].block=="function"?o=this.atrule[n].block.call(this):o=this.Block(l8.call(this))}return{type:"Atrule",loc:this.getLocation(e,this.tokenStart),name:t,prelude:r,block:o}}function f8(e){this.token(3,"@"+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(17,";")}var m8=ie({generate:()=>b8,name:()=>h8,parse:()=>L1,structure:()=>g8,walkContext:()=>p8}),h8="AtrulePrelude",p8="atrulePrelude",g8={children:[[]]};function L1(e){let t=null;return e!==null&&(e=e.toLowerCase()),this.skipSC(),hasOwnProperty.call(this.atrule,e)&&typeof this.atrule[e].prelude=="function"?t=this.atrule[e].prelude.call(this):t=this.readSequence(this.scope.AtrulePrelude),this.skipSC(),this.eof!==!0&&this.tokenType!==23&&this.tokenType!==17&&this.error("Semicolon or block is expected"),{type:"AtrulePrelude",loc:this.getLocationFromList(t),children:t}}function b8(e){this.children(e)}var y8=ie({generate:()=>A8,name:()=>C8,parse:()=>x1,structure:()=>T8}),v8=36,N1=42,Cc=61,E8=94,Km=124,S8=126;function w8(){this.eof&&this.error("Unexpected end of input");const e=this.tokenStart;let t=!1;return this.isDelim(N1)?(t=!0,this.next()):this.isDelim(Km)||this.eat(1),this.isDelim(Km)?this.charCodeAt(this.tokenStart+1)!==Cc?(this.next(),this.eat(1)):t&&this.error("Identifier is expected",this.tokenEnd):t&&this.error("Vertical line is expected"),{type:"Identifier",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function _8(){const e=this.tokenStart,t=this.charCodeAt(e);return t!==Cc&&t!==S8&&t!==E8&&t!==v8&&t!==N1&&t!==Km&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.next(),t!==Cc&&(this.isDelim(Cc)||this.error("Equal sign is expected"),this.next()),this.substrToCursor(e)}var C8="AttributeSelector",T8={name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]};function x1(){const e=this.tokenStart;let t,n=null,r=null,o=null;return this.eat(19),this.skipSC(),t=w8.call(this),this.skipSC(),this.tokenType!==20&&(this.tokenType!==1&&(n=_8.call(this),this.skipSC(),r=this.tokenType===5?this.String():this.Identifier(),this.skipSC()),this.tokenType===1&&(o=this.consume(1),this.skipSC())),this.eat(20),{type:"AttributeSelector",loc:this.getLocation(e,this.tokenStart),name:t,matcher:n,value:r,flags:o}}function A8(e){this.token(9,"["),this.node(e.name),e.matcher!==null&&(this.tokenize(e.matcher),this.node(e.value)),e.flags!==null&&this.token(1,e.flags),this.token(9,"]")}var k8=ie({generate:()=>M8,name:()=>x8,parse:()=>M1,structure:()=>R8,walkContext:()=>O8});function O1(e){return this.Raw(e,null,!0)}function L8(){return this.parseWithFallback(this.Rule,O1)}function R1(e){return this.Raw(e,this.consumeUntilSemicolonIncluded,!0)}function N8(){if(this.tokenType===17)return R1.call(this,this.tokenIndex);const e=this.parseWithFallback(this.Declaration,R1);return this.tokenType===17&&this.next(),e}var x8="Block",O8="block",R8={children:[["Atrule","Rule","Declaration"]]};function M1(e){const t=e?N8:L8,n=this.tokenStart;let r=this.createList();this.eat(23);e:for(;!this.eof;)switch(this.tokenType){case 24:break e;case 13:case 25:this.next();break;case 3:r.push(this.parseWithFallback(this.Atrule,O1));break;default:r.push(t.call(this))}return this.eof||this.eat(24),{type:"Block",loc:this.getLocation(n,this.tokenStart),children:r}}function M8(e){this.token(23,"{"),this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")}),this.token(24,"}")}var P8=ie({generate:()=>B8,name:()=>I8,parse:()=>P1,structure:()=>D8}),I8="Brackets",D8={children:[[]]};function P1(e,t){const n=this.tokenStart;let r=null;return this.eat(19),r=e.call(this,t),this.eof||this.eat(20),{type:"Brackets",loc:this.getLocation(n,this.tokenStart),children:r}}function B8(e){this.token(9,"["),this.children(e),this.token(9,"]")}var H8=ie({generate:()=>$8,name:()=>"CDC",parse:()=>I1,structure:()=>F8}),nie="CDC",F8=[];function I1(){const e=this.tokenStart;return this.eat(15),{type:"CDC",loc:this.getLocation(e,this.tokenStart)}}function $8(){this.token(15,"-->")}var W8=ie({generate:()=>z8,name:()=>"CDO",parse:()=>D1,structure:()=>q8}),rie="CDO",q8=[];function D1(){const e=this.tokenStart;return this.eat(14),{type:"CDO",loc:this.getLocation(e,this.tokenStart)}}function z8(){this.token(14,"<!--")}var U8=ie({generate:()=>X8,name:()=>V8,parse:()=>B1,structure:()=>G8}),j8=46,V8="ClassSelector",G8={name:String};function B1(){return this.eatDelim(j8),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(1)}}function X8(e){this.token(9,"."),this.token(1,e.name)}var K8=ie({generate:()=>tB,name:()=>J8,parse:()=>F1,structure:()=>eB}),Y8=43,H1=47,Z8=62,Q8=126,J8="Combinator",eB={name:String};function F1(){const e=this.tokenStart;let t;switch(this.tokenType){case 13:t=" ";break;case 9:switch(this.charCodeAt(this.tokenStart)){case Z8:case Y8:case Q8:this.next();break;case H1:this.next(),this.eatIdent("deep"),this.eatDelim(H1);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e)}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function tB(e){this.tokenize(e.name)}var nB=ie({generate:()=>aB,name:()=>iB,parse:()=>$1,structure:()=>sB}),rB=42,oB=47,iB="Comment",sB={value:String};function $1(){const e=this.tokenStart;let t=this.tokenEnd;return this.eat(25),t-e+2>=2&&this.charCodeAt(t-2)===rB&&this.charCodeAt(t-1)===oB&&(t-=2),{type:"Comment",loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function aB(e){this.token(25,"/*"+e.value+"*/")}var lB=ie({generate:()=>EB,name:()=>bB,parse:()=>z1,structure:()=>vB,walkContext:()=>yB}),W1=33,cB=35,uB=36,dB=38,fB=42,mB=43,q1=47;function hB(e){return this.Raw(e,this.consumeUntilExclamationMarkOrSemicolon,!0)}function pB(e){return this.Raw(e,this.consumeUntilExclamationMarkOrSemicolon,!1)}function gB(){const e=this.tokenIndex,t=this.Value();return t.type!=="Raw"&&this.eof===!1&&this.tokenType!==17&&this.isDelim(W1)===!1&&this.isBalanceEdge(e)===!1&&this.error(),t}var bB="Declaration",yB="declaration",vB={important:[Boolean,String],property:String,value:["Value","Raw"]};function z1(){const e=this.tokenStart,t=this.tokenIndex,n=SB.call(this),r=Cm(n),o=r?this.parseCustomProperty:this.parseValue,i=r?pB:hB;let s=!1,a;this.skipSC(),this.eat(16);const l=this.tokenIndex;if(r||this.skipSC(),o?a=this.parseWithFallback(gB,i):a=i.call(this,this.tokenIndex),r&&a.type==="Value"&&a.children.isEmpty){for(let c=l-this.tokenIndex;c<=0;c++)if(this.lookupType(c)===13){a.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}return this.isDelim(W1)&&(s=wB.call(this),this.skipSC()),this.eof===!1&&this.tokenType!==17&&this.isBalanceEdge(t)===!1&&this.error(),{type:"Declaration",loc:this.getLocation(e,this.tokenStart),important:s,property:n,value:a}}function EB(e){this.token(1,e.property),this.token(16,":"),this.node(e.value),e.important&&(this.token(9,"!"),this.token(1,e.important===!0?"important":e.important))}function SB(){const e=this.tokenStart;if(this.tokenType===9)switch(this.charCodeAt(this.tokenStart)){case fB:case uB:case mB:case cB:case dB:this.next();break;case q1:this.next(),this.isDelim(q1)&&this.next()}return this.tokenType===4?this.eat(4):this.eat(1),this.substrToCursor(e)}function wB(){this.eat(9),this.skipSC();const e=this.consume(1);return e==="important"?!0:e}var _B=ie({generate:()=>kB,name:()=>TB,parse:()=>U1,structure:()=>AB});function CB(e){return this.Raw(e,this.consumeUntilSemicolonIncluded,!0)}var TB="DeclarationList",AB={children:[["Declaration"]]};function U1(){const e=this.createList();for(;!this.eof;)switch(this.tokenType){case 13:case 25:case 17:this.next();break;default:e.push(this.parseWithFallback(this.Declaration,CB))}return{type:"DeclarationList",loc:this.getLocationFromList(e),children:e}}function kB(e){this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")})}var LB=ie({generate:()=>OB,name:()=>NB,parse:()=>j1,structure:()=>xB}),NB="Dimension",xB={value:String,unit:String};function j1(){const e=this.tokenStart,t=this.consumeNumber(12);return{type:"Dimension",loc:this.getLocation(e,this.tokenStart),value:t,unit:this.substring(e+t.length,this.tokenStart)}}function OB(e){this.token(12,e.value+e.unit)}var RB=ie({generate:()=>DB,name:()=>MB,parse:()=>V1,structure:()=>IB,walkContext:()=>PB}),MB="Function",PB="function",IB={name:String,children:[[]]};function V1(e,t){const n=this.tokenStart,r=this.consumeFunctionName(),o=r.toLowerCase();let i;return i=t.hasOwnProperty(o)?t[o].call(this,t):e.call(this,t),this.eof||this.eat(22),{type:"Function",loc:this.getLocation(n,this.tokenStart),name:r,children:i}}function DB(e){this.token(2,e.name+"("),this.children(e),this.token(22,")")}var BB=ie({generate:()=>$B,name:()=>HB,parse:()=>G1,structure:()=>FB,xxx:()=>"XXX"}),oie="XXX",HB="Hash",FB={value:String};function G1(){const e=this.tokenStart;return this.eat(4),{type:"Hash",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function $B(e){this.token(4,"#"+e.value)}var WB=ie({generate:()=>UB,name:()=>qB,parse:()=>X1,structure:()=>zB}),qB="Identifier",zB={name:String};function X1(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(1)}}function UB(e){this.token(1,e.name)}var jB=ie({generate:()=>XB,name:()=>VB,parse:()=>K1,structure:()=>GB}),VB="IdSelector",GB={name:String};function K1(){const e=this.tokenStart;return this.eat(4),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function XB(e){this.token(9,"#"+e.name)}var KB=ie({generate:()=>QB,name:()=>YB,parse:()=>Y1,structure:()=>ZB}),YB="MediaFeature",ZB={name:String,value:["Identifier","Number","Dimension","Ratio",null]};function Y1(){const e=this.tokenStart;let t,n=null;if(this.eat(21),this.skipSC(),t=this.consume(1),this.skipSC(),this.tokenType!==22){switch(this.eat(16),this.skipSC(),this.tokenType){case 10:this.lookupNonWSType(1)===9?n=this.Ratio():n=this.Number();break;case 12:n=this.Dimension();break;case 1:n=this.Identifier();break;default:this.error("Number, dimension, ratio or identifier is expected")}this.skipSC()}return this.eat(22),{type:"MediaFeature",loc:this.getLocation(e,this.tokenStart),name:t,value:n}}function QB(e){this.token(21,"("),this.token(1,e.name),e.value!==null&&(this.token(16,":"),this.node(e.value)),this.token(22,")")}var JB=ie({generate:()=>n9,name:()=>e9,parse:()=>Z1,structure:()=>t9}),e9="MediaQuery",t9={children:[["Identifier","MediaFeature","WhiteSpace"]]};function Z1(){const e=this.createList();let t=null;this.skipSC();e:for(;!this.eof;){switch(this.tokenType){case 25:case 13:this.next();continue;case 1:t=this.Identifier();break;case 21:t=this.MediaFeature();break;default:break e}e.push(t)}return t===null&&this.error("Identifier or parenthesis is expected"),{type:"MediaQuery",loc:this.getLocationFromList(e),children:e}}function n9(e){this.children(e)}var r9=ie({generate:()=>s9,name:()=>o9,parse:()=>Q1,structure:()=>i9}),o9="MediaQueryList",i9={children:[["MediaQuery"]]};function Q1(){const e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.MediaQuery()),this.tokenType===18);)this.next();return{type:"MediaQueryList",loc:this.getLocationFromList(e),children:e}}function s9(e){this.children(e,()=>this.token(18,","))}var a9=ie({generate:()=>c9,name:()=>"Nth",parse:()=>J1,structure:()=>l9}),iie="Nth",l9={nth:["AnPlusB","Identifier"],selector:["SelectorList",null]};function J1(){this.skipSC();const e=this.tokenStart;let t=e,n=null,r;return this.lookupValue(0,"odd")||this.lookupValue(0,"even")?r=this.Identifier():r=this.AnPlusB(),t=this.tokenStart,this.skipSC(),this.lookupValue(0,"of")&&(this.next(),n=this.SelectorList(),t=this.tokenStart),{type:"Nth",loc:this.getLocation(e,t),nth:r,selector:n}}function c9(e){this.node(e.nth),e.selector!==null&&(this.token(1,"of"),this.node(e.selector))}var u9=ie({generate:()=>m9,name:()=>d9,parse:()=>ew,structure:()=>f9}),d9="Number",f9={value:String};function ew(){return{type:"Number",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(10)}}function m9(e){this.token(10,e.value)}var h9=ie({generate:()=>b9,name:()=>p9,parse:()=>tw,structure:()=>g9}),p9="Operator",g9={value:String};function tw(){const e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function b9(e){this.tokenize(e.value)}var y9=ie({generate:()=>S9,name:()=>v9,parse:()=>nw,structure:()=>E9}),v9="Parentheses",E9={children:[[]]};function nw(e,t){const n=this.tokenStart;let r=null;return this.eat(21),r=e.call(this,t),this.eof||this.eat(22),{type:"Parentheses",loc:this.getLocation(n,this.tokenStart),children:r}}function S9(e){this.token(21,"("),this.children(e),this.token(22,")")}var w9=ie({generate:()=>T9,name:()=>_9,parse:()=>rw,structure:()=>C9}),_9="Percentage",C9={value:String};function rw(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(11)}}function T9(e){this.token(11,e.value+"%")}var A9=ie({generate:()=>x9,name:()=>k9,parse:()=>ow,structure:()=>N9,walkContext:()=>L9}),k9="PseudoClassSelector",L9="function",N9={name:String,children:[["Raw"],null]};function ow(){const e=this.tokenStart;let t=null,n,r;return this.eat(16),this.tokenType===2?(n=this.consumeFunctionName(),r=n.toLowerCase(),hasOwnProperty.call(this.pseudo,r)?(this.skipSC(),t=this.pseudo[r].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(this.tokenIndex,null,!1))),this.eat(22)):n=this.consume(1),{type:"PseudoClassSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function x9(e){this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}var O9=ie({generate:()=>I9,name:()=>R9,parse:()=>iw,structure:()=>P9,walkContext:()=>M9}),R9="PseudoElementSelector",M9="function",P9={name:String,children:[["Raw"],null]};function iw(){const e=this.tokenStart;let t=null,n,r;return this.eat(16),this.eat(16),this.tokenType===2?(n=this.consumeFunctionName(),r=n.toLowerCase(),hasOwnProperty.call(this.pseudo,r)?(this.skipSC(),t=this.pseudo[r].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(this.tokenIndex,null,!1))),this.eat(22)):n=this.consume(1),{type:"PseudoElementSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function I9(e){this.token(16,":"),this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}var D9=ie({generate:()=>W9,name:()=>F9,parse:()=>aw,structure:()=>$9}),B9=47,H9=46;function sw(){this.skipSC();const e=this.consume(10);for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);!pt(n)&&n!==H9&&this.error("Unsigned number is expected",this.tokenStart-e.length+t)}return Number(e)===0&&this.error("Zero number is not allowed",this.tokenStart-e.length),e}var F9="Ratio",$9={left:String,right:String};function aw(){const e=this.tokenStart,t=sw.call(this);let n;return this.skipSC(),this.eatDelim(B9),n=sw.call(this),{type:"Ratio",loc:this.getLocation(e,this.tokenStart),left:t,right:n}}function W9(e){this.token(10,e.left),this.token(9,"/"),this.token(10,e.right)}var q9=ie({generate:()=>j9,name:()=>"Raw",parse:()=>lw,structure:()=>U9});function z9(){return this.tokenIndex>0&&this.lookupType(-1)===13?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}var sie="Raw",U9={value:String};function lw(e,t,n){const r=this.getTokenStart(e);let o;return this.skipUntilBalanced(e,t||this.consumeUntilBalanceEnd),n&&this.tokenStart>r?o=z9.call(this):o=this.tokenStart,{type:"Raw",loc:this.getLocation(r,o),value:this.substring(r,o)}}function j9(e){this.tokenize(e.value)}var V9=ie({generate:()=>Z9,name:()=>X9,parse:()=>uw,structure:()=>Y9,walkContext:()=>K9});function cw(e){return this.Raw(e,this.consumeUntilLeftCurlyBracket,!0)}function G9(){const e=this.SelectorList();return e.type!=="Raw"&&this.eof===!1&&this.tokenType!==23&&this.error(),e}var X9="Rule",K9="rule",Y9={prelude:["SelectorList","Raw"],block:["Block"]};function uw(){const e=this.tokenIndex,t=this.tokenStart;let n,r;return this.parseRulePrelude?n=this.parseWithFallback(G9,cw):n=cw.call(this,e),r=this.Block(!0),{type:"Rule",loc:this.getLocation(t,this.tokenStart),prelude:n,block:r}}function Z9(e){this.node(e.prelude),this.node(e.block)}var Q9=ie({generate:()=>t6,name:()=>J9,parse:()=>dw,structure:()=>e6}),J9="Selector",e6={children:[["TypeSelector","IdSelector","ClassSelector","AttributeSelector","PseudoClassSelector","PseudoElementSelector","Combinator","WhiteSpace"]]};function dw(){const e=this.readSequence(this.scope.Selector);return this.getFirstListNode(e)===null&&this.error("Selector is expected"),{type:"Selector",loc:this.getLocationFromList(e),children:e}}function t6(e){this.children(e)}var n6=ie({generate:()=>s6,name:()=>r6,parse:()=>fw,structure:()=>i6,walkContext:()=>o6}),r6="SelectorList",o6="selector",i6={children:[["Selector","Raw"]]};function fw(){const e=this.createList();for(;!this.eof;){if(e.push(this.Selector()),this.tokenType===18){this.next();continue}break}return{type:"SelectorList",loc:this.getLocationFromList(e),children:e}}function s6(e){this.children(e,()=>this.token(18,","))}var Ym=92,mw=34,hw=39;function pw(e){const t=e.length,n=e.charCodeAt(0),r=n===mw||n===hw?1:0,o=r===1&&t>1&&e.charCodeAt(t-1)===n?t-2:t-1;let i="";for(let s=r;s<=o;s++){let a=e.charCodeAt(s);if(a===Ym){if(s===o){s!==t-1&&(i=e.substr(s+1));break}if(a=e.charCodeAt(++s),Hn(Ym,a)){const l=s-1,c=si(e,l);s=c-1,i+=gS(e.substring(l+1,c))}else a===13&&e.charCodeAt(s+1)===10&&s++}else i+=e[s]}return i}function Zm(e,t){const n=t?"'":'"',r=t?hw:mw;let o="",i=!1;for(let s=0;s<e.length;s++){const a=e.charCodeAt(s);if(a===0){o+="�";continue}if(a<=31||a===127){o+="\\"+a.toString(16),i=!0;continue}a===r||a===Ym?(o+="\\"+e.charAt(s),i=!1):(i&&(Mr(a)||po(a))&&(o+=" "),o+=e.charAt(s),i=!1)}return n+o+n}var a6=ie({generate:()=>u6,name:()=>l6,parse:()=>gw,structure:()=>c6}),l6="String",c6={value:String};function gw(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:pw(this.consume(5))}}function u6(e){this.token(5,Zm(e.value))}var d6=ie({generate:()=>g6,name:()=>m6,parse:()=>yw,structure:()=>p6,walkContext:()=>h6}),f6=33;function bw(e){return this.Raw(e,null,!1)}var m6="StyleSheet",h6="stylesheet",p6={children:[["Comment","CDO","CDC","Atrule","Rule","Raw"]]};function yw(){const e=this.tokenStart,t=this.createList();let n;for(;!this.eof;){switch(this.tokenType){case 13:this.next();continue;case 25:if(this.charCodeAt(this.tokenStart+2)!==f6){this.next();continue}n=this.Comment();break;case 14:n=this.CDO();break;case 15:n=this.CDC();break;case 3:n=this.parseWithFallback(this.Atrule,bw);break;default:n=this.parseWithFallback(this.Rule,bw)}t.push(n)}return{type:"StyleSheet",loc:this.getLocation(e,this.tokenStart),children:t}}function g6(e){this.children(e)}var b6=ie({generate:()=>S6,name:()=>v6,parse:()=>Ew,structure:()=>E6}),y6=42,vw=124;function Qm(){this.tokenType!==1&&this.isDelim(y6)===!1&&this.error("Identifier or asterisk is expected"),this.next()}var v6="TypeSelector",E6={name:String};function Ew(){const e=this.tokenStart;return this.isDelim(vw)?(this.next(),Qm.call(this)):(Qm.call(this),this.isDelim(vw)&&(this.next(),Qm.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function S6(e){this.tokenize(e.name)}var w6=ie({generate:()=>k6,name:()=>T6,parse:()=>_w,structure:()=>A6}),Sw=43,ww=45,Jm=63;function Xs(e,t){let n=0;for(let r=this.tokenStart+e;r<this.tokenEnd;r++){const o=this.charCodeAt(r);if(o===ww&&t&&n!==0)return Xs.call(this,e+n+1,!1),-1;Mr(o)||this.error(t&&n!==0?"Hyphen minus"+(n<6?" or hex digit":"")+" is expected":n<6?"Hex digit is expected":"Unexpected input",r),++n>6&&this.error("Too many hex digits",r)}return this.next(),n}function Tc(e){let t=0;for(;this.isDelim(Jm);)++t>e&&this.error("Too many question marks"),this.next()}function _6(e){this.charCodeAt(this.tokenStart)!==e&&this.error((e===Sw?"Plus sign":"Hyphen minus")+" is expected")}function C6(){let e=0;switch(this.tokenType){case 10:if(e=Xs.call(this,1,!0),this.isDelim(Jm)){Tc.call(this,6-e);break}if(this.tokenType===12||this.tokenType===10){_6.call(this,ww),Xs.call(this,1,!1);break}break;case 12:e=Xs.call(this,1,!0),e>0&&Tc.call(this,6-e);break;default:if(this.eatDelim(Sw),this.tokenType===1){e=Xs.call(this,0,!0),e>0&&Tc.call(this,6-e);break}if(this.isDelim(Jm)){this.next(),Tc.call(this,5);break}this.error("Hex digit or question mark is expected")}}var T6="UnicodeRange",A6={value:String};function _w(){const e=this.tokenStart;return this.eatIdent("u"),C6.call(this),{type:"UnicodeRange",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function k6(e){this.tokenize(e.value)}var L6=32,eh=92,N6=34,x6=39,O6=40,Cw=41;function R6(e){const t=e.length;let n=4,r=e.charCodeAt(t-1)===Cw?t-2:t-1,o="";for(;n<r&&po(e.charCodeAt(n));)n++;for(;n<r&&po(e.charCodeAt(r));)r--;for(let i=n;i<=r;i++){let s=e.charCodeAt(i);if(s===eh){if(i===r){i!==t-1&&(o=e.substr(i+1));break}if(s=e.charCodeAt(++i),Hn(eh,s)){const a=i-1,l=si(e,a);i=l-1,o+=gS(e.substring(a+1,l))}else s===13&&e.charCodeAt(i+1)===10&&i++}else o+=e[i]}return o}function Tw(e){let t="",n=!1;for(let r=0;r<e.length;r++){const o=e.charCodeAt(r);if(o===0){t+="�";continue}if(o<=31||o===127){t+="\\"+o.toString(16),n=!0;continue}o===L6||o===eh||o===N6||o===x6||o===O6||o===Cw?(t+="\\"+e.charAt(r),n=!1):(n&&Mr(o)&&(t+=" "),t+=e.charAt(r),n=!1)}return"url("+t+")"}var M6=ie({generate:()=>I6,name:()=>"Url",parse:()=>Aw,structure:()=>P6}),aie="Url",P6={value:String};function Aw(){const e=this.tokenStart;let t;switch(this.tokenType){case 7:t=R6(this.consume(7));break;case 2:this.cmpStr(this.tokenStart,this.tokenEnd,"url(")||this.error("Function name must be `url`"),this.eat(2),this.skipSC(),t=pw(this.consume(5)),this.skipSC(),this.eof||this.eat(22);break;default:this.error("Url or Function is expected")}return{type:"Url",loc:this.getLocation(e,this.tokenStart),value:t}}function I6(e){this.token(7,Tw(e.value))}var D6=ie({generate:()=>F6,name:()=>B6,parse:()=>kw,structure:()=>H6}),B6="Value",H6={children:[[]]};function kw(){const e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:"Value",loc:this.getLocation(e,this.tokenStart),children:t}}function F6(e){this.children(e)}var $6=ie({generate:()=>U6,name:()=>q6,parse:()=>Lw,structure:()=>z6}),W6=Object.freeze({type:"WhiteSpace",loc:null,value:" "}),q6="WhiteSpace",z6={value:String};function Lw(){return this.eat(13),W6}function U6(e){this.token(13,e.value)}var Nw=ie({AnPlusB:()=>n8,Atrule:()=>a8,AtrulePrelude:()=>m8,AttributeSelector:()=>y8,Block:()=>k8,Brackets:()=>P8,CDC:()=>H8,CDO:()=>W8,ClassSelector:()=>U8,Combinator:()=>K8,Comment:()=>nB,Declaration:()=>lB,DeclarationList:()=>_B,Dimension:()=>LB,Function:()=>RB,Hash:()=>BB,IdSelector:()=>jB,Identifier:()=>WB,MediaFeature:()=>KB,MediaQuery:()=>JB,MediaQueryList:()=>r9,Nth:()=>a9,Number:()=>u9,Operator:()=>h9,Parentheses:()=>y9,Percentage:()=>w9,PseudoClassSelector:()=>A9,PseudoElementSelector:()=>O9,Ratio:()=>D9,Raw:()=>q9,Rule:()=>V9,Selector:()=>Q9,SelectorList:()=>n6,String:()=>a6,StyleSheet:()=>d6,TypeSelector:()=>b6,UnicodeRange:()=>w6,Url:()=>M6,Value:()=>D6,WhiteSpace:()=>$6}),j6={generic:!0,...t8,node:Nw},V6=35,G6=42,xw=43,X6=45,K6=47,Y6=117;function Ow(e){switch(this.tokenType){case 4:return this.Hash();case 18:return this.Operator();case 21:return this.Parentheses(this.readSequence,e.recognizer);case 19:return this.Brackets(this.readSequence,e.recognizer);case 5:return this.String();case 12:return this.Dimension();case 11:return this.Percentage();case 10:return this.Number();case 2:return this.cmpStr(this.tokenStart,this.tokenEnd,"url(")?this.Url():this.Function(this.readSequence,e.recognizer);case 7:return this.Url();case 1:return this.cmpChar(this.tokenStart,Y6)&&this.cmpChar(this.tokenStart+1,xw)?this.UnicodeRange():this.Identifier();case 9:{const t=this.charCodeAt(this.tokenStart);if(t===K6||t===G6||t===xw||t===X6)return this.Operator();t===V6&&this.error("Hex or identifier is expected",this.tokenStart+1);break}}}var Z6={getNode:Ow},Q6=35,J6=42,e7=43,t7=47,Rw=46,n7=62,r7=124,o7=126;function i7(e,t){t.last!==null&&t.last.type!=="Combinator"&&e!==null&&e.type!=="Combinator"&&t.push({type:"Combinator",loc:null,name:" "})}function s7(){switch(this.tokenType){case 19:return this.AttributeSelector();case 4:return this.IdSelector();case 16:return this.lookupType(1)===16?this.PseudoElementSelector():this.PseudoClassSelector();case 1:return this.TypeSelector();case 10:case 11:return this.Percentage();case 12:this.charCodeAt(this.tokenStart)===Rw&&this.error("Identifier is expected",this.tokenStart+1);break;case 9:switch(this.charCodeAt(this.tokenStart)){case e7:case n7:case o7:case t7:return this.Combinator();case Rw:return this.ClassSelector();case J6:case r7:return this.TypeSelector();case Q6:return this.IdSelector()}}}var a7={onWhiteSpace:i7,getNode:s7};function l7(){return this.createSingleNodeList(this.Raw(this.tokenIndex,null,!1))}function c7(){const e=this.createList();if(this.skipSC(),e.push(this.Identifier()),this.skipSC(),this.tokenType===18){e.push(this.Operator());const t=this.tokenIndex,n=this.parseCustomProperty?this.Value(null):this.Raw(this.tokenIndex,this.consumeUntilExclamationMarkOrSemicolon,!1);if(n.type==="Value"&&n.children.isEmpty){for(let r=t-this.tokenIndex;r<=0;r++)if(this.lookupType(r)===13){n.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}e.push(n)}return e}function Mw(e){return e!==null&&e.type==="Operator"&&(e.value[e.value.length-1]==="-"||e.value[e.value.length-1]==="+")}var u7={getNode:Ow,onWhiteSpace(e,t){Mw(e)&&(e.value=" "+e.value),Mw(t.last)&&(t.last.value+=" ")},expression:l7,var:c7},d7=ie({AtrulePrelude:()=>Z6,Selector:()=>a7,Value:()=>u7}),f7={parse:{prelude:null,block(){return this.Block(!0)}}},m7={parse:{prelude(){const e=this.createList();switch(this.skipSC(),this.tokenType){case 5:e.push(this.String());break;case 7:case 2:e.push(this.Url());break;default:this.error("String or url() is expected")}return(this.lookupNonWSType(0)===1||this.lookupNonWSType(0)===21)&&e.push(this.MediaQueryList()),e},block:null}},h7={parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(){return this.Block(!1)}}},p7={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}};function g7(){return this.createSingleNodeList(this.Raw(this.tokenIndex,null,!1))}function b7(){return this.skipSC(),this.tokenType===1&&this.lookupNonWSType(1)===16?this.createSingleNodeList(this.Declaration()):Pw.call(this)}function Pw(){const e=this.createList();let t;this.skipSC();e:for(;!this.eof;){switch(this.tokenType){case 25:case 13:this.next();continue;case 2:t=this.Function(g7,this.scope.AtrulePrelude);break;case 1:t=this.Identifier();break;case 21:t=this.Parentheses(b7,this.scope.AtrulePrelude);break;default:break e}e.push(t)}return e}var y7={parse:{prelude(){const e=Pw.call(this);return this.getFirstListNode(e)===null&&this.error("Condition is expected"),e},block(){return this.Block(!1)}}},v7={"font-face":f7,import:m7,media:h7,page:p7,supports:y7},bo={parse(){return this.createSingleNodeList(this.SelectorList())}},E7={parse(){return this.createSingleNodeList(this.Selector())}},Iw={parse(){return this.createSingleNodeList(this.Identifier())}},Ac={parse(){return this.createSingleNodeList(this.Nth())}},S7={dir:Iw,has:bo,lang:Iw,matches:bo,is:bo,"-moz-any":bo,"-webkit-any":bo,where:bo,not:bo,"nth-child":Ac,"nth-last-child":Ac,"nth-last-of-type":Ac,"nth-of-type":Ac,slotted:E7},w7=ie({AnPlusB:()=>T1,Atrule:()=>k1,AtrulePrelude:()=>L1,AttributeSelector:()=>x1,Block:()=>M1,Brackets:()=>P1,CDC:()=>I1,CDO:()=>D1,ClassSelector:()=>B1,Combinator:()=>F1,Comment:()=>$1,Declaration:()=>z1,DeclarationList:()=>U1,Dimension:()=>j1,Function:()=>V1,Hash:()=>G1,IdSelector:()=>K1,Identifier:()=>X1,MediaFeature:()=>Y1,MediaQuery:()=>Z1,MediaQueryList:()=>Q1,Nth:()=>J1,Number:()=>ew,Operator:()=>tw,Parentheses:()=>nw,Percentage:()=>rw,PseudoClassSelector:()=>ow,PseudoElementSelector:()=>iw,Ratio:()=>aw,Raw:()=>lw,Rule:()=>uw,Selector:()=>dw,SelectorList:()=>fw,String:()=>gw,StyleSheet:()=>yw,TypeSelector:()=>Ew,UnicodeRange:()=>_w,Url:()=>Aw,Value:()=>kw,WhiteSpace:()=>Lw}),_7={parseContext:{default:"StyleSheet",stylesheet:"StyleSheet",atrule:"Atrule",atrulePrelude(e){return this.AtrulePrelude(e.atrule?String(e.atrule):null)},mediaQueryList:"MediaQueryList",mediaQuery:"MediaQuery",rule:"Rule",selectorList:"SelectorList",selector:"Selector",block(){return this.Block(!0)},declarationList:"DeclarationList",declaration:"Declaration",value:"Value"},scope:d7,atrule:v7,pseudo:S7,node:w7},C7={node:Nw},T7=e8({...j6,..._7,...C7});function th(e){const t={};for(const n in e){let r=e[n];r&&(Array.isArray(r)||r instanceof Qe?r=r.map(th):r.constructor===Object&&(r=th(r))),t[n]=r}return t}var{tokenize:lie,parse:A7,generate:Wn,lexer:Dw,createLexer:cie,walk:Bt,find:uie,findLast:die,findAll:fie,toPlainObject:mie,fromPlainObject:hie,fork:k7}=T7,{hasOwnProperty:L7}=Object.prototype;function nh(e,t){const n=Object.create(null);if(!Array.isArray(e))return null;for(let r of e)t&&(r=r.toLowerCase()),n[r]=!0;return n}function Bw(e){if(!e)return null;const t=nh(e.tags,!0),n=nh(e.ids),r=nh(e.classes);return t===null&&n===null&&r===null?null:{tags:t,ids:n,classes:r}}function N7(e){let t=!1;if(e.scopes&&Array.isArray(e.scopes)){t=Object.create(null);for(let n=0;n<e.scopes.length;n++){const r=e.scopes[n];if(!r||!Array.isArray(r))throw new Error("Wrong usage format");for(const o of r){if(L7.call(t,o))throw new Error(`Class can't be used for several scopes: ${o}`);t[o]=n+1}}}return{whitelist:Bw(e),blacklist:Bw(e.blacklist),scopes:t}}function yo(e){return!e||!e.children||e.children.isEmpty}function Hw(e,t){return e!==null&&e.children===t}function x7(e,t,n){if(e.block&&(this.stylesheet!==null&&(this.stylesheet.firstAtrulesAllowed=!1),yo(e.block))){n.remove(t);return}switch(e.name){case"charset":if(yo(e.prelude)){n.remove(t);return}if(t.prev){n.remove(t);return}break;case"import":if(this.stylesheet===null||!this.stylesheet.firstAtrulesAllowed){n.remove(t);return}n.prevUntil(t.prev,function(r){if(!(r.type==="Atrule"&&(r.name==="import"||r.name==="charset")))return this.root.firstAtrulesAllowed=!1,n.remove(t),!0},this);break;default:{const r=wn(e.name).basename;(r==="keyframes"||r==="media"||r==="supports")&&(yo(e.prelude)||yo(e.block))&&n.remove(t)}}}function O7(e,t,n){n.remove(t)}function R7(e,t,n){if(e.value.children&&e.value.children.isEmpty){n.remove(t);return}ci(e.property).custom&&/\S/.test(e.value.value)&&(e.value.value=e.value.value.trim())}function M7(e,t,n){(Hw(this.stylesheet,n)||Hw(this.block,n))&&n.remove(t)}var{hasOwnProperty:gi}=Object.prototype,P7=new Set(["keyframes"]);function Fw(e,t){return e.children.forEach((n,r,o)=>{let i=!1;Bt(n,function(s){if(this.selector===null||this.selector===e)switch(s.type){case"SelectorList":(this.function===null||this.function.name.toLowerCase()!=="not")&&Fw(s,t)&&(i=!0);break;case"ClassSelector":t.whitelist!==null&&t.whitelist.classes!==null&&!gi.call(t.whitelist.classes,s.name)&&(i=!0),t.blacklist!==null&&t.blacklist.classes!==null&&gi.call(t.blacklist.classes,s.name)&&(i=!0);break;case"IdSelector":t.whitelist!==null&&t.whitelist.ids!==null&&!gi.call(t.whitelist.ids,s.name)&&(i=!0),t.blacklist!==null&&t.blacklist.ids!==null&&gi.call(t.blacklist.ids,s.name)&&(i=!0);break;case"TypeSelector":s.name.charAt(s.name.length-1)!=="*"&&(t.whitelist!==null&&t.whitelist.tags!==null&&!gi.call(t.whitelist.tags,s.name.toLowerCase())&&(i=!0),t.blacklist!==null&&t.blacklist.tags!==null&&gi.call(t.blacklist.tags,s.name.toLowerCase())&&(i=!0))}}),i&&o.remove(r)}),e.children.isEmpty}function I7(e,t,n,r){if(yo(e.prelude)||yo(e.block)){n.remove(t);return}if(this.atrule&&P7.has(wn(this.atrule.name).basename))return;const{usage:o}=r;if(o&&(o.whitelist!==null||o.blacklist!==null)&&(Fw(e.prelude,o),yo(e.prelude))){n.remove(t);return}}function D7(e,t,n){if(t.data.name!=="*")return;const r=t.next&&t.next.data.type;(r==="IdSelector"||r==="ClassSelector"||r==="AttributeSelector"||r==="PseudoClassSelector"||r==="PseudoElementSelector")&&n.remove(t)}function B7(e,t,n){n.remove(t)}var $w={Atrule:x7,Comment:O7,Declaration:R7,Raw:M7,Rule:I7,TypeSelector:D7,WhiteSpace:B7};function H7(e,t){Bt(e,{leave(n,r,o){$w.hasOwnProperty(n.type)&&$w[n.type].call(this,n,r,o,t)}})}function F7(e){e.block.children.forEach(t=>{t.prelude.children.forEach(n=>{n.children.forEach((r,o)=>{r.type==="Percentage"&&r.value==="100"?o.data={type:"TypeSelector",loc:r.loc,name:"to"}:r.type==="TypeSelector"&&r.name==="from"&&(o.data={type:"Percentage",loc:r.loc,value:"0"})})})})}function $7(e){wn(e.name).basename==="keyframes"&&F7(e)}var W7=/^(-?\d|--)|[\u0000-\u002c\u002e\u002f\u003A-\u0040\u005B-\u005E\u0060\u007B-\u009f]/;function q7(e){return e===""||e==="-"?!1:!W7.test(e)}function z7(e){const t=e.value;!t||t.type!=="String"||q7(t.value)&&(e.value={type:"Identifier",loc:t.loc,name:t.value})}function U7(e){const t=e.children;t.forEachRight(function(n,r){if(n.type==="Identifier"){if(n.name==="bold")r.data={type:"Number",loc:n.loc,value:"700"};else if(n.name==="normal"){const o=r.prev;o&&o.data.type==="Operator"&&o.data.value==="/"&&this.remove(o),this.remove(r)}}}),t.isEmpty&&t.insert(t.createItem({type:"Identifier",name:"normal"}))}function j7(e){const t=e.children.head.data;if(t.type==="Identifier")switch(t.name){case"normal":e.children.head.data={type:"Number",loc:t.loc,value:"400"};break;case"bold":e.children.head.data={type:"Number",loc:t.loc,value:"700"}}}function V7(e){function t(){r.length||r.unshift({type:"Number",loc:null,value:"0"},{type:"Number",loc:null,value:"0"}),n.push.apply(n,r),r=[]}let n=[],r=[];e.children.forEach(o=>{if(o.type==="Operator"&&o.value===","){t(),n.push(o);return}o.type==="Identifier"&&(o.name==="transparent"||o.name==="none"||o.name==="repeat"||o.name==="scroll")||r.push(o)}),t(),e.children=new Qe().fromArray(n)}function Ww(e){e.children.forEach((t,n,r)=>{t.type==="Identifier"&&t.name.toLowerCase()==="none"&&(r.head===r.tail?n.data={type:"Number",loc:t.loc,value:"0"}:r.remove(n))})}var qw={font:U7,"font-weight":j7,background:V7,border:Ww,outline:Ww};function G7(e){if(!this.declaration)return;const t=ci(this.declaration.property);qw.hasOwnProperty(t.basename)&&qw[t.basename](e)}var X7=/^(?:\+|(-))?0*(\d*)(?:\.0*|(\.\d*?)0*)?$/,K7=/^([\+\-])?0*(\d*)(?:\.0*|(\.\d*?)0*)?$/,Y7=new Set(["Dimension","Hash","Identifier","Number","Raw","UnicodeRange"]);function kc(e,t){const n=t&&t.prev!==null&&Y7.has(t.prev.data.type)?K7:X7;return e=String(e).replace(n,"$1$2$3"),(e===""||e==="-")&&(e="0"),e}function Z7(e){e.value=kc(e.value)}var Q7=new Set(["calc","min","max","clamp"]),J7=new Set(["px","mm","cm","in","pt","pc","em","ex","ch","rem","vh","vw","vmin","vmax","vm"]);function eH(e,t){const n=kc(e.value);if(e.value=n,n==="0"&&this.declaration!==null&&this.atrulePrelude===null){const r=e.unit.toLowerCase();if(!J7.has(r)||this.declaration.property==="-ms-flex"||this.declaration.property==="flex"||this.function&&Q7.has(this.function.name))return;t.data={type:"Number",loc:e.loc,value:n}}}var tH=new Set(["width","min-width","max-width","height","min-height","max-height","flex","-ms-flex"]);function nH(e,t){e.value=kc(e.value),e.value==="0"&&this.declaration&&!tH.has(this.declaration.property)&&(t.data={type:"Number",loc:e.loc,value:e.value},Dw.matchDeclaration(this.declaration).isType(t.data,"length")||(t.data=e))}function rH(e){e.value=e.value.replace(/\\/g,"/")}var zw={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgrey:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",grey:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Uw={8e5:"maroon",800080:"purple",808e3:"olive",808080:"gray","00ffff":"cyan",f0ffff:"azure",f5f5dc:"beige",ffe4c4:"bisque","000000":"black","0000ff":"blue",a52a2a:"brown",ff7f50:"coral",ffd700:"gold","008000":"green","4b0082":"indigo",fffff0:"ivory",f0e68c:"khaki","00ff00":"lime",faf0e6:"linen","000080":"navy",ffa500:"orange",da70d6:"orchid",cd853f:"peru",ffc0cb:"pink",dda0dd:"plum",f00:"red",ff0000:"red",fa8072:"salmon",a0522d:"sienna",c0c0c0:"silver",fffafa:"snow",d2b48c:"tan","008080":"teal",ff6347:"tomato",ee82ee:"violet",f5deb3:"wheat",ffffff:"white",ffff00:"yellow"};function rh(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function jw(e,t,n,r){let o,i,s;if(t===0)o=i=s=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;o=rh(l,a,e+1/3),i=rh(l,a,e),s=rh(l,a,e-1/3)}return[Math.round(o*255),Math.round(i*255),Math.round(s*255),r]}function oh(e){return e=e.toString(16),e.length===1?"0"+e:e}function ih(e,t,n){let r=e.head,o=[],i=!1;for(;r!==null;){const{type:s,value:a}=r.data;switch(s){case"Number":case"Percentage":if(i)return;i=!0,o.push({type:s,value:Number(a)});break;case"Operator":if(a===","){if(!i)return;i=!1}else if(i||a!=="+")return;break;default:return}r=r.next}if(o.length===t){if(o.length===4){if(o[3].type!=="Number")return;o[3].type="Alpha"}if(n){if(o[0].type!==o[1].type||o[0].type!==o[2].type)return}else{if(o[0].type!=="Number"||o[1].type!=="Percentage"||o[2].type!=="Percentage")return;o[0].type="Angle"}return o.map(function(s){let a=Math.max(0,s.value);switch(s.type){case"Number":a=Math.min(a,255);break;case"Percentage":if(a=Math.min(a,100)/100,!n)return a;a=255*a;break;case"Angle":return(a%360+360)%360/360;case"Alpha":return Math.min(a,1)}return Math.round(a)})}}function oH(e,t){let n=e.name,r;if(n==="rgba"||n==="hsla"){if(r=ih(e.children,4,n==="rgba"),!r)return;if(n==="hsla"&&(r=jw(...r),e.name="rgba"),r[3]===0){const o=this.function&&this.function.name;if(r[0]===0&&r[1]===0&&r[2]===0||!/^(?:to|from|color-stop)$|gradient$/i.test(o)){t.data={type:"Identifier",loc:e.loc,name:"transparent"};return}}if(r[3]!==1){e.children.forEach((o,i,s)=>{if(o.type==="Operator"){o.value!==","&&s.remove(i);return}i.data={type:"Number",loc:o.loc,value:kc(r.shift())}});return}n="rgb"}if(n==="hsl"){if(r=r||ih(e.children,3,!1),!r)return;r=jw(...r),n="rgb"}if(n==="rgb"){if(r=r||ih(e.children,3,!0),!r)return;t.data={type:"Hash",loc:e.loc,value:oh(r[0])+oh(r[1])+oh(r[2])},Vw(t.data,t)}}function iH(e,t){if(this.declaration===null)return;let n=e.name.toLowerCase();if(zw.hasOwnProperty(n)&&Dw.matchDeclaration(this.declaration).isType(e,"color")){const r=zw[n];r.length+1<=n.length?t.data={type:"Hash",loc:e.loc,value:r}:(n==="grey"&&(n="gray"),e.name=n)}}function Vw(e,t){let n=e.value.toLowerCase();n.length===6&&n[0]===n[1]&&n[2]===n[3]&&n[4]===n[5]&&(n=n[0]+n[2]+n[4]),Uw[n]?t.data={type:"Identifier",loc:e.loc,name:Uw[n]}:e.value=n}var Gw={Atrule:$7,AttributeSelector:z7,Value:G7,Dimension:eH,Percentage:nH,Number:Z7,Url:rH,Hash:Vw,Identifier:iH,Function:oH};function sH(e){Bt(e,{leave(t,n,r){Gw.hasOwnProperty(t.type)&&Gw[t.type].call(this,t,n,r)}})}var aH=class{constructor(){this.map=new Map}resolve(e){let t=this.map.get(e);return t===void 0&&(t=this.map.size+1,this.map.set(e,t)),t}};function lH(){const e=new aH;return function(n){const r=Wn(n);return n.id=e.resolve(r),n.length=r.length,n.fingerprint=null,n}}function cH(e){return e.type==="Raw"?A7(e.value,{context:"selectorList"}):e}function uH(e,t){for(let n=0;n<3;n++)if(e[n]!==t[n])return e[n]>t[n]?e:t;return e}function Xw(e){return cH(e).children.reduce((t,n)=>uH(sh(n),t),[0,0,0])}function sh(e){let t=0,n=0,r=0;return e.children.forEach(o=>{switch(o.type){case"IdSelector":t++;break;case"ClassSelector":case"AttributeSelector":n++;break;case"PseudoClassSelector":switch(o.name.toLowerCase()){case"not":case"has":case"is":case"matches":case"-webkit-any":case"-moz-any":{const[i,s,a]=Xw(o.children.first);t+=i,n+=s,r+=a;break}case"nth-child":case"nth-last-child":{const i=o.children.first;if(i.type==="Nth"&&i.selector){const[s,a,l]=Xw(i.selector);t+=s,n+=a+1,r+=l}else n++;break}case"where":break;case"before":case"after":case"first-line":case"first-letter":r++;break;default:n++}break;case"TypeSelector":o.name.endsWith("*")||r++;break;case"PseudoElementSelector":r++}}),[t,n,r]}var dH=new Set(["first-letter","first-line","after","before"]),fH=new Set(["link","visited","hover","active","first-letter","first-line","after","before"]);function mH(e,t){const n=new Set;e.prelude.children.forEach(function(r){let o="*",i=0;r.children.forEach(function(s){switch(s.type){case"ClassSelector":if(t&&t.scopes){const a=t.scopes[s.name]||0;if(i!==0&&a!==i)throw new Error("Selector can't has classes from different scopes: "+Wn(r));i=a}break;case"PseudoClassSelector":{const a=s.name.toLowerCase();fH.has(a)||n.add(`:${a}`);break}case"PseudoElementSelector":{const a=s.name.toLowerCase();dH.has(a)||n.add(`::${a}`);break}case"TypeSelector":o=s.name.toLowerCase();break;case"AttributeSelector":s.flags&&n.add(`[${s.flags.toLowerCase()}]`);break;case"Combinator":o="*"}}),r.compareMarker=sh(r).toString(),r.id=null,r.id=Wn(r),i&&(r.compareMarker+=":"+i),o!=="*"&&(r.compareMarker+=","+o)}),e.pseudoSignature=n.size>0?[...n].sort().join(","):!1}function hH(e,t){const n=lH();return Bt(e,{visit:"Rule",enter(r){r.block.children.forEach(n),mH(r,t.usage)}}),Bt(e,{visit:"Atrule",enter(r){r.prelude&&(r.prelude.id=null,r.prelude.id=Wn(r.prelude)),wn(r.name).basename==="keyframes"&&(r.block.avoidRulesMerge=!0,r.block.children.forEach(function(o){o.prelude.children.forEach(function(i){i.compareMarker=i.id})}))}}),{declaration:n}}var{hasOwnProperty:Kw}=Object.prototype;function Yw(e,t,n,r){const o=t.data,i=wn(o.name).basename,s=o.name.toLowerCase()+"/"+(o.prelude?o.prelude.id:null);Kw.call(e,i)||(e[i]=Object.create(null)),r&&delete e[i][s],Kw.call(e[i],s)||(e[i][s]=new Qe),e[i][s].append(n.remove(t))}function pH(e,t){const n=Object.create(null);let r=null;e.children.forEach(function(o,i,s){if(o.type==="Atrule"){const a=wn(o.name).basename;switch(a){case"keyframes":Yw(n,i,s,!0);return;case"media":if(t.forceMediaMerge){Yw(n,i,s,!1);return}}r===null&&a!=="charset"&&a!=="import"&&(r=i)}else r===null&&(r=i)});for(const o in n)for(const i in n[o])e.children.insertList(n[o][i],o==="media"?null:r)}function Zw(e){return e.type==="Atrule"&&e.name==="media"}function gH(e,t,n){if(!Zw(e))return;const r=t.prev&&t.prev.data;!r||!Zw(r)||e.prelude&&r.prelude&&e.prelude.id===r.prelude.id&&(r.block.children.appendList(e.block.children),n.remove(t))}function bH(e,t){pH(e,t),Bt(e,{visit:"Atrule",reverse:!0,enter:gH})}var{hasOwnProperty:pie}=Object.prototype;function Qw(e,t){let n=e.head,r=t.head;for(;n!==null&&r!==null&&n.data.id===r.data.id;)n=n.next,r=r.next;return n===null&&r===null}function Jw(e,t){let n=e.head;for(;n!==null;){let r=t.head;for(;r!==null;){if(n.data.compareMarker===r.data.compareMarker)return!0;r=r.next}n=n.next}return!1}function Lc(e){switch(e.type){case"Rule":return Jw(e.prelude.children,this);case"Atrule":if(e.block)return e.block.children.some(Lc,this);break;case"Declaration":return!1}return!0}function yH(e,t,n){const r=e.prelude.children,o=e.block.children;n.prevUntil(t.prev,function(i){if(i.type!=="Rule")return Lc.call(r,i);const s=i.prelude.children,a=i.block.children;return e.pseudoSignature===i.pseudoSignature&&Qw(s,r)?(a.appendList(o),n.remove(t),!0):Jw(r,s)})}function vH(e){Bt(e,{visit:"Rule",enter:yH})}function EH(e,t,n){const r=e.prelude.children;for(;r.head!==r.tail;){const o=new Qe;o.insert(r.remove(r.head)),n.insert(n.createItem({type:"Rule",loc:e.loc,prelude:{type:"SelectorList",loc:e.prelude.loc,children:o},block:{type:"Block",loc:e.block.loc,children:e.block.children.copy()},pseudoSignature:e.pseudoSignature}),t)}}function SH(e){Bt(e,{visit:"Rule",reverse:!0,enter:EH})}var e_=1,wH=2,bi=0,Ks=1,ah=2,Nc=3,t_=["top","right","bottom","left"],_H={"margin-top":"top","margin-right":"right","margin-bottom":"bottom","margin-left":"left","padding-top":"top","padding-right":"right","padding-bottom":"bottom","padding-left":"left","border-top-color":"top","border-right-color":"right","border-bottom-color":"bottom","border-left-color":"left","border-top-width":"top","border-right-width":"right","border-bottom-width":"bottom","border-left-width":"left","border-top-style":"top","border-right-style":"right","border-bottom-style":"bottom","border-left-style":"left"},n_={margin:"margin","margin-top":"margin","margin-right":"margin","margin-bottom":"margin","margin-left":"margin",padding:"padding","padding-top":"padding","padding-right":"padding","padding-bottom":"padding","padding-left":"padding","border-color":"border-color","border-top-color":"border-color","border-right-color":"border-color","border-bottom-color":"border-color","border-left-color":"border-color","border-width":"border-width","border-top-width":"border-width","border-right-width":"border-width","border-bottom-width":"border-width","border-left-width":"border-width","border-style":"border-style","border-top-style":"border-style","border-right-style":"border-style","border-bottom-style":"border-style","border-left-style":"border-style"},CH=class{constructor(e){this.name=e,this.loc=null,this.iehack=void 0,this.sides={top:null,right:null,bottom:null,left:null}}getValueSequence(e,t){const n=[];let r="";return e.value.type!=="Value"||e.value.children.some(function(o){let i=!1;switch(o.type){case"Identifier":switch(o.name){case"\\0":case"\\9":r=o.name;return;case"inherit":case"initial":case"unset":case"revert":i=o.name}break;case"Dimension":switch(o.unit){case"rem":case"vw":case"vh":case"vmin":case"vmax":case"vm":i=o.unit}break;case"Hash":case"Number":case"Percentage":break;case"Function":if(o.name==="var")return!0;i=o.name;break;default:return!0}n.push({node:o,special:i,important:e.important})})||n.length>t||typeof this.iehack=="string"&&this.iehack!==r?!1:(this.iehack=r,n)}canOverride(e,t){const n=this.sides[e];return!n||t.important&&!n.important}add(e,t){function n(){const r=this.sides,o=_H[e];if(o){if(!(o in r))return!1;const i=this.getValueSequence(t,1);if(!i||!i.length)return!1;for(const s in r)if(r[s]!==null&&r[s].special!==i[0].special)return!1;return this.canOverride(o,i[0])&&(r[o]=i[0]),!0}else if(e===this.name){const i=this.getValueSequence(t,4);if(!i||!i.length)return!1;switch(i.length){case 1:i[Ks]=i[bi],i[ah]=i[bi],i[Nc]=i[bi];break;case 2:i[ah]=i[bi],i[Nc]=i[Ks];break;case 3:i[Nc]=i[Ks]}for(let s=0;s<4;s++)for(const a in r)if(r[a]!==null&&r[a].special!==i[s].special)return!1;for(let s=0;s<4;s++)this.canOverride(t_[s],i[s])&&(r[t_[s]]=i[s]);return!0}}return n.call(this)?(this.loc||(this.loc=t.loc),!0):!1}isOkToMinimize(){const e=this.sides.top,t=this.sides.right,n=this.sides.bottom,r=this.sides.left;if(e&&t&&n&&r){const o=e.important+t.important+n.important+r.important;return o===0||o===4}return!1}getValue(){const e=new Qe,t=this.sides,n=[t.top,t.right,t.bottom,t.left],r=[Wn(t.top.node),Wn(t.right.node),Wn(t.bottom.node),Wn(t.left.node)];r[Nc]===r[Ks]&&(n.pop(),r[ah]===r[bi]&&(n.pop(),r[Ks]===r[bi]&&n.pop()));for(let o=0;o<n.length;o++)e.appendData(n[o].node);return this.iehack&&e.appendData({type:"Identifier",loc:null,name:this.iehack}),{type:"Value",loc:null,children:e}}getDeclaration(){return{type:"Declaration",loc:this.loc,important:this.sides.top.important,property:this.name,value:this.getValue()}}};function TH(e,t,n,r){const o=e.block.children,i=e.prelude.children.first.id;return e.block.children.forEachRight(function(s,a){const l=s.property;if(!n_.hasOwnProperty(l))return;const c=n_[l];let u,d;if((!r||i===r)&&c in t&&(d=wH,u=t[c]),(!u||!u.add(l,s))&&(d=e_,u=new CH(c),!u.add(l,s))){r=null;return}t[c]=u,n.push({operation:d,block:o,item:a,shorthand:u}),r=i}),r}function AH(e,t){e.forEach(function(n){const r=n.shorthand;r.isOkToMinimize()&&(n.operation===e_?n.item.data=t(r.getDeclaration()):n.block.remove(n.item))})}function kH(e,t){const n={},r=[];Bt(e,{visit:"Rule",reverse:!0,enter(o){const i=this.block||this.stylesheet,s=(o.pseudoSignature||"")+"|"+o.prelude.children.first.id;let a,l;n.hasOwnProperty(i.id)?a=n[i.id]:(a={lastShortSelector:null},n[i.id]=a),a.hasOwnProperty(s)?l=a[s]:(l={},a[s]=l),a.lastShortSelector=TH.call(this,o,l,r,a.lastShortSelector)}}),AH(r,t.declaration)}var LH=1,NH=new Set(["src"]),r_={display:/table|ruby|flex|-(flex)?box$|grid|contents|run-in/i,"text-align":/^(start|end|match-parent|justify-all)$/i},o_={cursor:["auto","crosshair","default","move","text","wait","help","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","pointer","progress","not-allowed","no-drop","vertical-text","all-scroll","col-resize","row-resize"],overflow:["hidden","visible","scroll","auto"],position:["static","relative","absolute","fixed"]},i_={"border-width":["border"],"border-style":["border"],"border-color":["border"],"border-top":["border"],"border-right":["border"],"border-bottom":["border"],"border-left":["border"],"border-top-width":["border-top","border-width","border"],"border-right-width":["border-right","border-width","border"],"border-bottom-width":["border-bottom","border-width","border"],"border-left-width":["border-left","border-width","border"],"border-top-style":["border-top","border-style","border"],"border-right-style":["border-right","border-style","border"],"border-bottom-style":["border-bottom","border-style","border"],"border-left-style":["border-left","border-style","border"],"border-top-color":["border-top","border-color","border"],"border-right-color":["border-right","border-color","border"],"border-bottom-color":["border-bottom","border-color","border"],"border-left-color":["border-left","border-color","border"],"margin-top":["margin"],"margin-right":["margin"],"margin-bottom":["margin"],"margin-left":["margin"],"padding-top":["padding"],"padding-right":["padding"],"padding-bottom":["padding"],"padding-left":["padding"],"font-style":["font"],"font-variant":["font"],"font-weight":["font"],"font-size":["font"],"font-family":["font"],"list-style-type":["list-style"],"list-style-position":["list-style"],"list-style-image":["list-style"]};function s_(e,t,n){const r=ci(e).basename;if(r==="background")return e+":"+Wn(t.value);const o=t.id;let i=n[o];if(!i){switch(t.value.type){case"Value":const s={};let a="",l="",c=!1;t.value.children.forEach(function u(d){switch(d.type){case"Value":case"Brackets":case"Parentheses":d.children.forEach(u);break;case"Raw":c=!0;break;case"Identifier":{const{name:f}=d;a||(a=wn(f).vendor),/\\[09]/.test(f)&&(l=RegExp.lastMatch),o_.hasOwnProperty(r)?o_[r].indexOf(f)===-1&&(s[f]=!0):r_.hasOwnProperty(r)&&r_[r].test(f)&&(s[f]=!0);break}case"Function":{let{name:f}=d;a||(a=wn(f).vendor),f==="rect"&&(d.children.some(h=>h.type==="Operator"&&h.value===",")||(f="rect-backward")),s[f+"()"]=!0,d.children.forEach(u);break}case"Dimension":{const{unit:f}=d;switch(/\\[09]/.test(f)&&(l=RegExp.lastMatch),f){case"rem":case"vw":case"vh":case"vmin":case"vmax":case"vm":s[f]=!0}break}}}),i=c?"!"+LH++:"!"+Object.keys(s).sort()+"|"+l+a;break;case"Raw":i="!"+t.value.value;break;default:i=Wn(t.value)}n[o]=i}return e+i}function xH(e,t,n){const r=ci(t.property);if(i_.hasOwnProperty(r.basename)){const o=i_[r.basename];for(const i of o){const s=s_(r.prefix+i,t,n),a=e.hasOwnProperty(s)?e[s]:null;if(a&&(!t.important||a.item.data.important))return a}}}function OH(e,t,n,r,o){const i=e.block.children;i.forEachRight(function(s,a){const{property:l}=s,c=s_(l,s,o),u=r[c];u&&!NH.has(l)?s.important&&!u.item.data.important?(r[c]={block:i,item:a},u.block.remove(u.item)):i.remove(a):xH(r,s,o)?i.remove(a):(s.fingerprint=c,r[c]={block:i,item:a})}),i.isEmpty&&n.remove(t)}function RH(e){const t={},n=Object.create(null);Bt(e,{visit:"Rule",reverse:!0,enter(r,o,i){const s=this.block||this.stylesheet,a=(r.pseudoSignature||"")+"|"+r.prelude.children.first.id;let l,c;t.hasOwnProperty(s.id)?l=t[s.id]:(l={},t[s.id]=l),l.hasOwnProperty(a)?c=l[a]:(c={},l[a]=c),OH.call(this,r,o,i,c,n)}})}function MH(e,t,n){const r=e.prelude.children,o=e.block.children,i=r.first.compareMarker,s={};n.nextUntil(t.next,function(a,l){if(a.type!=="Rule")return Lc.call(r,a);if(e.pseudoSignature!==a.pseudoSignature)return!0;const c=a.prelude.children.head,u=a.block.children,d=c.data.compareMarker;if(d in s)return!0;if(r.head===r.tail&&r.first.id===c.data.id){o.appendList(u),n.remove(l);return}if(d===i)return!0;s[d]=!0})}function PH(e){Bt(e,{visit:"Rule",enter:MH})}function IH(e,t,n){this.block!==null&&this.block.avoidRulesMerge;const r=e.prelude.children,o=e.block,i=Object.create(null);let s=!0,a=!0;n.prevUntil(t.prev,function(l,c){const u=l.block,d=l.type;if(d!=="Rule"){const h=Lc.call(r,l);return!h&&d==="Atrule"&&u&&Bt(u,{visit:"Rule",enter(m){m.prelude.children.forEach(p=>{i[p.compareMarker]=!0})}}),h}if(e.pseudoSignature!==l.pseudoSignature)return!0;const f=l.prelude.children;if(a=!f.some(h=>h.compareMarker in i),!a&&!s)return!0;if(s&&Qw(f,r))return u.children.appendList(o.children),n.remove(t),!0;s&&(s=!f.some(h=>r.some(m=>m.compareMarker===h.compareMarker))),f.forEach(h=>{i[h.compareMarker]=!0})})}function DH(e){Bt(e,{visit:"Rule",reverse:!0,enter:IH})}function BH(e,t){const n=hH(e,t);t.logger("prepare",e),bH(e,t),t.logger("mergeAtrule",e),vH(e),t.logger("initialMergeRuleset",e),SH(e),t.logger("disjoinRuleset",e),kH(e,n),t.logger("restructShorthand",e),RH(e),t.logger("restructBlock",e),PH(e),t.logger("mergeRuleset",e),DH(e),t.logger("restructRuleset",e)}function HH(e,t){const n=new Qe;let r=!1,o;return e.nextUntil(e.head,(i,s,a)=>{if(i.type==="Comment"){if(!t||i.value.charAt(0)!=="!"){a.remove(s);return}if(r||o)return!0;a.remove(s),o=i;return}i.type!=="WhiteSpace"&&(r=!0),n.insert(a.remove(s))}),{comment:o,stylesheet:{type:"StyleSheet",loc:null,children:n}}}function FH(e,t,n,r){r.logger(`Compress block #${n}`,null,!0);let o=1;return e.type==="StyleSheet"&&(e.firstAtrulesAllowed=t,e.id=o++),Bt(e,{visit:"Atrule",enter(i){i.block!==null&&(i.block.id=o++)}}),r.logger("init",e),H7(e,r),r.logger("clean",e),sH(e,r),r.logger("replace",e),r.restructuring&&BH(e,r),e}function $H(e){let t="comments"in e?e.comments:"exclamation";return typeof t=="boolean"?t=t?"exclamation":!1:t!=="exclamation"&&t!=="first-exclamation"&&(t=!1),t}function WH(e){return"restructure"in e?e.restructure:"restructuring"in e?e.restructuring:!0}function qH(e){return new Qe().appendData({type:"Rule",loc:null,prelude:{type:"SelectorList",loc:null,children:new Qe().appendData({type:"Selector",loc:null,children:new Qe().appendData({type:"TypeSelector",loc:null,name:"x"})})},block:e})}function zH(e,t){e=e||{type:"StyleSheet",loc:null,children:new Qe},t=t||{};const n={logger:typeof t.logger=="function"?t.logger:function(){},restructuring:WH(t),forceMediaMerge:!!t.forceMediaMerge,usage:t.usage?N7(t.usage):!1},r=new Qe;let o=$H(t),i=!0,s,a,l=1,c;t.clone&&(e=th(e)),e.type==="StyleSheet"?(s=e.children,e.children=r):s=qH(e);do{if(a=HH(s,!!o),FH(a.stylesheet,i,l++,n),c=a.stylesheet.children,a.comment&&(r.isEmpty||r.insert(Qe.createItem({type:"Raw",value:`
|
|
43
|
+
`})),r.insert(Qe.createItem(a.comment)),c.isEmpty||r.insert(Qe.createItem({type:"Raw",value:`
|
|
44
|
+
`}))),i&&!c.isEmpty){const u=c.last;(u.type!=="Atrule"||u.name!=="import"&&u.name!=="charset")&&(i=!1)}o!=="exclamation"&&(o=!1),r.appendList(c)}while(!s.isEmpty);return{ast:e}}var UH=ie({compress:()=>zH,find:()=>YH,findAll:()=>QH,findLast:()=>ZH,fromPlainObject:()=>JH,generate:()=>XH,lexer:()=>jH,parse:()=>GH,specificity:()=>sh,toPlainObject:()=>eF,tokenize:()=>VH,walk:()=>KH});function a_(e){const t=Zm(e,!0),n=Zm(e);return t.length<n.length?t:n}var{lexer:jH,tokenize:VH,parse:GH,generate:XH,walk:KH,find:YH,findLast:ZH,findAll:QH,fromPlainObject:JH,toPlainObject:eF}=k7({node:{String:{generate(e){this.token(5,a_(e.value))}},Url:{generate(e){const t=Tw(e.value),n=a_(e.value);this.token(7,t.length<=n.length+5?t:"url("+n+")")}}}}),{parse:tF,generate:lh,compress:nF}=UH;function yi(e,t,n,r){return t.debug,r}function rF(e){let t;return function(r,o){let i=r;if(o&&(i=`[${((Date.now()-t)/1e3).toFixed(3)}s] ${i}`),e>1&&o){let s=lh(o);e===2&&s.length>256&&(s=s.substr(0,256)+"..."),i+=`
|
|
45
|
+
${s}
|
|
46
|
+
`}t=Date.now()}}function oF(e){return e={...e},typeof e.logger!="function"&&e.debug&&(e.logger=rF(e.debug)),e}function l_(e,t,n){Array.isArray(n)||(n=[n]),n.forEach(r=>r(e,t))}function iF(e,t,n){n=n||{};const r=n.filename||"<unknown>";let o;const i=yi("parsing",n,Date.now(),tF(t,{context:e,filename:r,positions:!!n.sourceMap}));n.beforeCompress&&yi("beforeCompress",n,Date.now(),l_(i,n,n.beforeCompress));const s=yi("compress",n,Date.now(),nF(i,oF(n)));return n.afterCompress&&yi("afterCompress",n,Date.now(),l_(s,n,n.afterCompress)),n.sourceMap?o=yi("generate(sourceMap: true)",n,Date.now(),(()=>{const a=lh(s.ast,{sourceMap:!0});return a.map._file=r,a.map.setSourceContent(r,t),a})()):o=yi("generate",n,Date.now(),{css:lh(s.ast),map:null}),o}function vo(e,t){return iF("stylesheet",e,t)}var c_={restructure:!0,forceMediaMerge:!0};function u_(e,t=[...e.querySelectorAll("style")],n={forceMediaMerge:!1}){if(!cssbeautify)return!1;let r=!1;if((!e.isConnected||e.ownerDocument===null)&&!(e instanceof Document)){const s=document.implementation.createDocument("http://www.w3.org/1999/xhtml","html",null);if(e instanceof HTMLHtmlElement)s.replaceChild(e,s.documentElement);else if(e instanceof HTMLBodyElement||e instanceof HTMLHeadElement)s.documentElement.appendChild(e);else{const a=s.createElement("body");s.documentElement.appendChild(a),a.appendChild(e)}}const o=!!e.querySelector('[class*="noresp-em"]'),i=new Map;for(const s of t){if(n.forceMediaMerge&&s.innerHTML){const a=`
|
|
47
|
+
`+cssbeautify(vo(s.innerHTML,c_).css,{indent:" ",autosemicolon:!0})+`
|
|
48
|
+
`;s.innerHTML!==a&&(s.textContent=a,r=!0)}if(s.sheet&&d_(e,s.sheet,o,i)){let a=aF(s.sheet);a=vo(a,c_).css,a=`
|
|
49
|
+
`+cssbeautify(a,{indent:" ",autosemicolon:!0})+`
|
|
50
|
+
`,s.innerHTML!==a&&(s.textContent=a,r=!0)}}return r}function d_(e,t,n,r,o=new Set){let i=!1,s;try{s=t.cssRules}catch{return!1}for(let a=s.length-1;a>=0;a--){const l=s[a];if(l instanceof CSSStyleRule){let c=l.selectorText;n&&c.includes(".em-")&&(c=`${c}, ${c.replace(/\.em-/g,".noresp-em-")}`),sF(e,c,r)||(t.deleteRule(a),i=!0)}else if(l instanceof CSSGroupingRule)i=d_(e,l,n,r,o)||i,l.cssRules.length||(t.deleteRule(a),i=!0);else if(l instanceof CSSFontFaceRule){const c=l.cssText;o.has(c)?(t.deleteRule(a),i=!0):o.add(c)}}return i}function sF(e,t,n){if(n.has(t))return n.get(t);let r=!1;try{r=!!e.querySelector(t)}catch{r=!0}return n.set(t,r),r}function aF(e){return Array.from(e.cssRules,t=>t.cssText).join(`
|
|
51
|
+
`)}var f_=/device-width/i,lF="not all",vi=new Map,ch=!1;function cF(e){return"media"in e&&"cssRules"in e}function m_(e,t){for(const n of Array.from(e))cF(n)&&t(n),"cssRules"in n&&m_(n.cssRules,t)}function uF(e){try{return e.cssRules}catch{return}}function dF(e){const t=e.split(",").map(n=>n.trim()).filter(n=>n&&!f_.test(n));return t.length?t.join(", "):lF}function uh(e){vi.forEach((t,n)=>{n.parentStyleSheet?.ownerNode?.isConnected||vi.delete(n)});for(const t of Array.from(e.styleSheets)){const n=uF(t);n&&m_(n,r=>{const o=r.media.mediaText;vi.has(r)||!f_.test(o)||(vi.set(r,o),r.media.mediaText=dF(o))})}}function h_(){vi.forEach((e,t)=>{t.media.mediaText=e}),vi.clear()}function fF(e){if(!ch)return e();h_();try{return e()}finally{uh(document)}}function mF(e){return e.some(t=>{const n=t.target;return n.nodeName==="STYLE"||n.parentNode?.nodeName==="STYLE"?!0:Array.from(t.addedNodes).some(r=>r.nodeName==="STYLE"||r instanceof Element&&!!r.querySelector("style"))})}function hF(e=window){if(!e.matchMedia("(pointer: coarse)").matches)return()=>{};const t=e.document;ch=!0,uh(t);const n=new MutationObserver(r=>{mF(r)&&uh(t)});return n.observe(t.documentElement,{childList:!0,characterData:!0,subtree:!0}),()=>{n.disconnect(),h_(),ch=!1}}function Ys(e){return se(e)}var gie=se("extensions.atomsHandlers"),bie=Ys("HANDLE_ATOM_INSERT"),yie=se("HeadlessMode"),vie=se("extensions.sandboxExtensions"),pF="SANDBOX_EXTENSION_SCRIPT_STATUS",Eie=se("MESSAGE_SERVICE"),Sie=Ys("SETTINGS_PANEL_EVENT"),wie=Ys("MODAL_SHOW_EVENT"),_ie=Ys("MODAL_CLOSE_EVENT"),Cie=Ys("MODAL_UPDATE_EVENT");function Tie(e){return e}var p_="SandboxApp",dh="IframePluginRegistry",gF="__sandbox__";function g_(){return zd(gF)}function bF(e=g_()){return e.getOrCreateInstance(dh,()=>new Yb)}var fh=new Y2(()=>bF()),Zs=class dN{constructor(){A(this,"container",g_()),A(this,"pluginCollection",new K2(this,fh)),this.pluginCollection.activateSync()}static get instance(){return this._instance||(this._instance=new dN)}static registerPlugin(t,n){fh.add(t,n)}static registerAll(t){for(const n of Object.keys(t)){let r=n;const o=t[r];o&&fh.add(r,o)}}static use(t){return this.instance.pluginCollection.use(t)}static initFeatures(t){this.instance.initFeatures(t)}static onLifecycle(t){return this.instance.onLifecycle(t)}use(t){return typeof t=="function"?this.pluginCollection.useByCtor(t):this.pluginCollection.useByKey(t)}initFeatures(t){this.pluginCollection.initSync(t)}onLifecycle(t){return this.pluginCollection.onLifecycle(t)}dispose(){this.pluginCollection.dispose()}};A(Zs,"_instance",void 0);var Qs="data-extension";function Js(e,t,n,r){U.send(pF,{key:e,phase:t,status:n,error:r})}function yF(){if(typeof document>"u")return;const e=document.currentScript;if(e instanceof HTMLScriptElement)return e.getAttribute(Qs)||void 0}function b_(e){return{key:e,hasSyncPlugins:!1,pendingPlugins:new Set,loadedNotified:!1,readyNotified:!1,readyFailed:!1}}function mh(e){!e.loadedNotified||e.readyNotified||e.readyFailed||(!e.hasSyncPlugins||e.pendingPlugins.size===0)&&(e.readyNotified=!0,Js(e.key,"ready","success"))}function y_(e,t){return[...document.querySelectorAll(`${e}[${Qs}]`)].find(n=>n.getAttribute(Qs)===t)}function vF({type:e,attributes:t,key:n,innerHTML:r}){const o=document.createElement(e);if(t)for(const[i,s]of Object.entries(t))s!=null&&o.setAttribute(i,String(s));return o.setAttribute(Qs,n),r&&(o.innerHTML=r),e==="script"?t.type||o.setAttribute("type","text/javascript"):e==="style"&&(t.type||o.setAttribute("type","text/css")),o}function EF(e,t={}){const n=new Ee,r=new Map,o=new Map,i=new Map,s=new WeakMap,a=u=>{let d=i.get(u);return d||(d=b_(u),i.set(u,d)),d},l=u=>{if(u.type==="created"){const h=yF();if(!h)return;const m=a(h);m.hasSyncPlugins=!0,m.pendingPlugins.add(u.plugin),s.set(u.plugin,h);return}if(u.type==="create:error")return;const d=s.get(u.plugin);if(!d)return;const f=i.get(d);if(f){if(u.type==="afterInit:success"){f.pendingPlugins.delete(u.plugin),mh(f);return}(u.type==="init:error"||u.type==="afterInit:error")&&(f.pendingPlugins.delete(u.plugin),f.readyFailed=!0,Js(d,"ready","error",`Sandbox plugin "${u.name}" failed during ${u.type==="init:error"?"init":"afterInit"}.`))}};n.addDisposable(Zs.onLifecycle(l)),n.addDisposable(U.addListener(ue.SANDBOX_ADD_EXTENSIONS,u=>{for(const d of u){if(t.surface&&d.surfaces&&!d.surfaces.includes(t.surface))continue;let f=r.get(d.key);f&&f.remove(),d.type==="script"&&i.set(d.key,b_(d.key));const h=d.parent&&document.querySelector(d.parent)||document.head;if(f=vF(d),e.ownership.markService(f),d.type==="script"){const m=f;m.src&&(m.onload=()=>{const p=a(d.key);p.loadedNotified=!0,Js(d.key,"load","success"),mh(p)},m.onerror=()=>Js(d.key,"load","error",`Failed to load sandbox script: ${m.src}`))}if(h.appendChild(f),d.type==="script"&&!f.src){const m=a(d.key);m.loadedNotified=!0,Js(d.key,"load","success"),mh(m)}r.set(d.key,f),o.set(d.key,d)}})),n.addDisposable(U.addListener(ue.SANDBOX_REMOVE_EXTENSIONS,u=>{for(const d of u){const f=y_(o.get(d)?.type,d);f&&f.remove(),r.delete(d),o.delete(d)}})),n.addDisposable(e.onChange(()=>{e.applyHidden(()=>c())}));function c(){for(const[u,d]of r){const f=o.get(u);if(!f)continue;const h=y_(f.type,u);let m=f.parent?[...document.querySelectorAll(f.parent)]:[];m.length||(m=[document.head]),h?h!==d?r.set(u,h):m.some(p=>h.parentNode===p)||m[0]?.appendChild(h):m[0]?.appendChild(d)}}return n}function SF(e){e.querySelectorAll(`[${Qs}]`).forEach(t=>t.remove())}var Eo="remove-basic-cell",wF="remove-basic-row",So="em-active-table-cell",_F="em-temporary-class",Br="em-temporary-active-cell-background-color",Hr="temporary-cell-class",xc=[Eo,wF,So,_F,Hr,Br],CF=["contenteditable","em-edit","em-state","em-hover"],v_=`<div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5a5a5a;"> </div>`,ea="em-table-menu",ta="em_version";function Oc(e){if(!e||!e.includes("em_version"))return e;try{const t=typeof document<"u"?document.baseURI:"http://localhost/",n=new URL(e,t);return n.searchParams.has("em_version")?(n.searchParams.delete(ta),/^https?:\/\//i.test(e)||e.startsWith("//")?n.href:n.pathname+n.search+n.hash):e}catch{return e}}function TF(e){try{const t=typeof document<"u"?document.baseURI:"http://localhost/",n=new URL(e,t);return n.searchParams.set(ta,String(Date.now())),/^https?:\/\//i.test(e)||e.startsWith("//")?n.href:n.pathname+n.search+n.hash}catch{return`${e}${e.includes("?")?"&":"?"}${ta}=${Date.now()}`}}var AF=/^(chrome-extension|moz-extension|safari-extension):\/\//i,kF=/local\.adguard\.org/i,LF=/^bis_/i,NF=new Set(["data-bis-config"]),Ei=/<script\b(?=[^>]*(?:\bbis_use(?:=|\s)|\bdata-bis-config(?:=|\s)|\bdata-dynamic-id(?:=|\s)|local\.adguard\.org|(?:chrome-extension|moz-extension|safari-extension):\/\/))[^>]*>[\s\S]*?<\/script>/gi,xF=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Rc=/<style\b[^>]*>[\s\S]*?<\/style>/gi,E_=/display:\s*none\s*!important/gi,S_="data-darkreader-",OF=/<(script|style)\b[\s\S]*?<\/\1\s*>|<[a-z][^\s<>]*(?:"[^"]*"|'[^']*'|[^<>"'])*?\sdata-darkreader-(?:"[^"]*"|'[^']*'|[^<>"'])*>/gi,RF=/\sdata-darkreader-[a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?/gi,MF=[".socialshare,",".advertisment,",".adHolder,",".adsbygoogle-noablate","#ab_adblock","#popmechanic-snippet","filter_ads_by_classname","clever-core-ads","--gn-ov-ad-height","pub_728x90.text-ad.textAd","html-load.com/player","content-loader.com/player",".adblock","#advblock","body { overflow: visible!important; }"],w_=new Set(["em","data-theme-varibalse","data-em-localization"]);function PF(e){return E_.lastIndex=0,(e.match(E_)||[]).length}function hh(e){const t=e.trim(),n=PF(t);if(n===0)return!1;if(t.includes(".advertisment,")&&t.includes(".adHolder,")&&(t.includes(".socialshare,")||n>=3||t.length>2e3))return!0;const r=MF.filter(o=>t.includes(o)).length;return r>=1&&(n>=3||t.length>2e3)||n>=5&&r>=1?!0:n>=20&&/\b(?:\.ad(?:s|vert|vertisment|Holder|banner|box|Container|Wrapper)?[,{]|#ad[-_]|ins\.adsbygoogle)/i.test(t)}function IF(e){if(w_.has("em")&&e.getAttribute("em")==="styles")return!1;for(const t of w_)if(e.hasAttribute(t))return!1;return hh(e.textContent||"")}function DF(e){return AF.test(e.src)||kF.test(e.src)?!0:e.hasAttribute("bis_use")||e.hasAttribute("data-bis-config")}function __(e){let t=!1;for(const n of[...e.attributes])(LF.test(n.name)||NF.has(n.name))&&(e.removeAttribute(n.name),t=!0);return t}function BF(e){Rc.lastIndex=0;for(const t of e.matchAll(Rc))if(hh(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function HF(e){let t=!1;return Rc.lastIndex=0,{html:e.replace(Rc,n=>hh(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function C_(e){let t=!1;return e instanceof Element&&__(e)&&(t=!0),e.querySelectorAll("script").forEach(n=>{DF(n)&&(n.remove(),t=!0)}),e.querySelectorAll("style").forEach(n=>{n.tagName==="STYLE"&&IF(n)&&(n.remove(),t=!0)}),e.querySelectorAll("*").forEach(n=>{__(n)&&(t=!0)}),t}function FF(e){return Ei.lastIndex=0,Ei.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||BF(e)}function $F(e){return e.toLowerCase().startsWith(S_)}function WF(e){return e.toLowerCase().includes(S_)?e.replace(OF,(t,n)=>n?t:t.replace(RF,"")):e}function qF(e){const t=WF(e);if(!FF(t))return{html:t,found:!1};let n=!1,r=t;Ei.lastIndex=0,Ei.test(r)&&(Ei.lastIndex=0,r=r.replace(Ei,""),n=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(r)||/\sdata-bis-config\s*=/.test(r))&&(r=r.replace(xF,""),n=!0);const o=HF(r);return r=o.html,n=n||o.found,{html:r,found:n}}var zF=class extends Ee{constructor(...e){super(...e),A(this,"_transforms",[]),A(this,"_byAttribute",new Map)}register(e){this._transforms.push(e);for(const t of e.attributes){const n=t.toLowerCase(),r=this._byAttribute.get(n);r?r.push(e):this._byAttribute.set(n,[e])}return{dispose:()=>this._remove(e)}}_remove(e){const t=this._transforms.indexOf(e);if(t!==-1){this._transforms.splice(t,1);for(const n of e.attributes){const r=n.toLowerCase(),o=this._byAttribute.get(r);if(!o)continue;const i=o.indexOf(e);i!==-1&&o.splice(i,1),o.length||this._byAttribute.delete(r)}}}get isEmpty(){return this._transforms.length===0}handles(e){return this._byAttribute.has(e.toLowerCase())}get attributes(){return[...this._byAttribute.keys()]}render(e,t){return this._run("render",e,t)}serialize(e,t){return this._run("serialize",e,t)}_run(e,t,n){const r=this._byAttribute.get(n.attribute.toLowerCase());if(!r?.length)return t;const o=e==="render"?r:[...r].reverse();let i=t;for(const s of o){if(i===null)break;const a=e==="render"?s.render?.(i,n):s.serialize?.(i,n);a!==void 0&&(i=a)}return i}dispose(){this._transforms.length=0,this._byAttribute.clear(),super.dispose()}};function ph(){return Pt.getInstance(Ho)}var Mc=new WeakMap;function UF(e,t,n){const r=Mc.get(e);r?r.set(t.toLowerCase(),n):Mc.set(e,new Map([[t.toLowerCase(),n]]))}function jF(e,t){const n=Mc.get(e);n?.size&&Mc.set(t,new Map(n))}function T_(e,t,n){const r=e.tagName.toLowerCase();for(const o of t.attributes){if(!e.hasAttribute(o))continue;const i=e.getAttribute(o)??"",s=t.serialize(i,{element:e,tag:r,attribute:o,stage:n});s===null?e.removeAttribute(o):s!==i&&e.setAttribute(o,s)}}function Pc(e,t={}){const n=t.pipeline??ph(),r=t.stage??"build";let o=e;if(t.clone&&(o=e.cloneNode(!0),nn(e,o),n&&!n.isEmpty&&A_(e,o)),!n||n.isEmpty)return o;o instanceof Element&&T_(o,n,r);const i=o.querySelectorAll?.("*");if(i)for(const s of i)T_(s,n,r);return o}function VF(e,t={}){const n=t.pipeline??ph(),r=uI(e);if((!n||n.isEmpty)&&!r)return Tr(e);const o=Pc(e,{...t,pipeline:n,clone:!0});return ti(o),Cb(o)}function A_(e,t){jF(e,t);const n=e.childNodes,r=t.childNodes;for(let o=0;o<n.length&&o<r.length;o++)A_(n[o],r[o])}function Ht(e,t,n,r={}){const o=gh(e,t,n,{stage:"settings",...r});o===null?e.removeAttribute(t):e.setAttribute(t,o)}function gh(e,t,n,r={}){const o=r.pipeline??ph();if(!o||!o.handles(t))return n;const i=e?.tagName.toLowerCase()??"",s=o.render(n,{element:e,tag:i,attribute:t,stage:r.stage??"build"});if(s!==n){const a=r.owner??e;a&&UF(a,t,n)}return s}function GF(e){const t=new zF,n=Nb((o,i,s)=>t.isEmpty?s:gh(o,i,s,{pipeline:t})),r=n2((o,i,s)=>t.isEmpty?s:t.serialize(s,{element:o,tag:o.tagName.toLowerCase(),attribute:i,stage:"apply"}));return e.inject(Ho,t),{pipeline:t,dispose(){r(),n(),t.dispose(),yn(e,Ho)}}}function XF(e){return Oc(e)}function k_(e){const t=(n,r)=>{const o=n.getAttribute(r);if(!o)return;const i=XF(o);i!==o&&n.setAttribute(r,i)};e.querySelectorAll("[src]").forEach(n=>t(n,"src")),e.querySelectorAll("[___src]").forEach(n=>t(n,"___src"))}var L_=[".em-code",':not(editor)[contenteditable="false"]','.em-vindent[class*="em-vindent-padding"]',"#gtx-anchor",'[data-mce-bogus="1"]','style[data-theme-varibalse="true"]','style[data-em-localization="true"]',".em-element-img-change-group",".em-element-resize-img",".em-element-editor",".em-element-vindent-bg",".em-element-gap",".em-element-gap-marker",".em-element-gap-bg",".em-gap",".em-powered-logo",".em-element-vindent-value"],KF=["contenteditable","em-edit","em-state","em-hover"],YF=["[data-mce-caret=before]","span.em-element-resize-img-container","div.em-element-img-change-group","div.em-element-block-add","meta[http-equiv=Content-Security-Policy]","[class*=mce-]","script[em=initial]",".em-editor-wrapper",".em-element-resize-height",".em-element-vindent-remove",".em-element-vindent",".em-element-vindent-value","div.iframe-resizer-inner"],N_=new Set(["normal","400"]),x_=new Set(["normal"]),ZF=new Set(["baseline","unset","initial",""]),O_=new Set(["none",""]),QF=["b","strong","em","i","u","s","strike","sup","sub"],JF=["B","STRONG","H1","H2","H3","H4","H5","H6","TH"],e$=["I","EM","CITE","VAR","DFN","ADDRESS"],t$=[[/^(thin|hairline)/i,100],[/^(extra|ultra)light/i,200],[/^light/i,300],[/^(semi|demi)bold/i,600],[/^(extra|ultra)bold/i,800],[/^bold/i,700],[/^(black|heavy)/i,900],[/^medium/i,500],[/^(regular|normal|book|italic)/i,400]],n$="___em-internal",R_=["em-block-insert-empty","em-atom-insert-empty","em-block-insert-body","em-atom-insert-body","em-resize-start","sortable-chosen","sortable-ghost","em-vindent-table","em-vindent_low","em-vindent","em-relative","em-display-block","em-sandbox-discuss_set-target","em-sandbox-discuss","em-native-img-uploading","em-native-img-drop-target","em-native-img-drop-loading","em-native-file-drag"],r$=["em-block-insert","em-block-insert_bottom-document","em-block-insert_top-document","em-block-insert_bottom","em-block-insert_top","em-blockatom-insert","em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top"],o$=[...L_,...YF].filter(e=>/\.em-(element-|gap|vindent)/.test(e)&&e!=="span.em-element-resize-img-container").join(", "),i$=KF.filter(e=>!L_.some(t=>t.includes(`[${e}`))),s$=[...R_,...r$],M_={isServiceAttribute:e=>i$.includes(e)||$F(e),isServiceClass:e=>s$.includes(e),isServicePanel:e=>e.matches(o$)||e.hasAttribute("data-em-caret")};function P_(e){xc.forEach(t=>{e.querySelectorAll(`.${t}`).forEach(n=>n.classList.remove(t))})}function Ic(e){e.querySelectorAll(".em-block-insert").forEach(n=>{n.classList.remove("em-block-insert","em-block-insert_bottom-document","em-block-insert_top-document")}),e.querySelectorAll(".em-block-insert_bottom").forEach(n=>{n.classList.remove("em-block-insert_bottom")}),e.querySelectorAll(".em-block-insert_top").forEach(n=>{n.classList.remove("em-block-insert_top")}),e.querySelectorAll(".em-blockatom-insert").forEach(n=>{n.classList.remove("em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_top-document")}),e.querySelectorAll(".em-atom-insert").forEach(n=>{n.classList.remove("em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top")}),R_.forEach(n=>{e.querySelectorAll(`.${n}`).forEach(r=>r.classList.remove(n))}),e.querySelectorAll(".em-powered-logo").forEach(n=>n.remove());for(const n of e.querySelectorAll("[class='']"))n.removeAttribute("class");const t=e instanceof Document?e.documentElement:e;t&&(Et(t,"[data-mce-caret=before]",!0),Et(t,".em-element-resize-img",!0),Et(t,"span.em-element-resize-img-container"),Et(t,"div.em-element-img-change-group",!0),Et(t,"div.em-element-block-add",!0),Et(t,"meta[http-equiv=Content-Security-Policy]",!0),Et(t,"[class*=mce-]"),Et(t,"script[em=initial]",!0),Et(t,".em-editor-wrapper",!0),Et(t,".em-element-resize-height",!0),Et(t,".em-element-vindent-remove",!0),Et(t,".em-element-vindent",!0),Et(t,".em-element-vindent-value",!0),Et(t,"div.iframe-resizer-inner"))}function a$(e,t){e.querySelectorAll("tbody").forEach(n=>n.replaceWith(...Array.from(n.childNodes))),e.querySelectorAll(".em-code").forEach(n=>n.remove()),e.querySelectorAll(':not(editor)[contenteditable="false"]').forEach(n=>n.remove()),e.querySelectorAll('.em-vindent[class*="em-vindent-padding"]').forEach(n=>n.remove()),e.querySelectorAll(".em-code").forEach(n=>n.remove()),e.querySelectorAll("[contenteditable]").forEach(n=>n.removeAttribute("contenteditable")),e.querySelectorAll("[em-edit]").forEach(n=>n.removeAttribute("em-edit")),e.querySelectorAll("[em-state]").forEach(n=>n.removeAttribute("em-state")),e.querySelectorAll("[em-hover]").forEach(n=>n.removeAttribute("em-hover")),e.querySelectorAll("#gtx-anchor").forEach(n=>n.remove()),e.querySelectorAll('[data-mce-bogus="1"]').forEach(n=>n.remove()),e.querySelectorAll("strike").forEach(n=>n.removeAttribute("style")),e.querySelectorAll("u").forEach(n=>n.removeAttribute("style")),e.querySelectorAll('style[data-theme-varibalse="true"]').forEach(n=>n.remove()),e.querySelectorAll('style[data-em-localization="true"]').forEach(n=>n.remove()),e.querySelectorAll(".em-element-img-change-group").forEach(n=>n.remove()),e.querySelectorAll(".em-element-resize-img").forEach(n=>n.remove()),e.querySelectorAll(".em-element-editor").forEach(n=>n.remove()),e.querySelectorAll(".em-element-vindent-bg").forEach(n=>n.remove()),e.querySelectorAll(".em-element-vindent-value").forEach(n=>n.remove()),e.querySelectorAll(".em-element-gap").forEach(n=>n.remove()),e.querySelectorAll(".em-element-gap-marker").forEach(n=>n.remove()),e.querySelectorAll(".em-element-gap-bg").forEach(n=>n.remove()),e.querySelectorAll(".em-gap").forEach(n=>n.remove()),e.querySelectorAll(".em-just-inserted").forEach(n=>n.classList.remove("em-just-inserted")),e.querySelectorAll(".em-native-img-uploading").forEach(n=>n.classList.remove("em-native-img-uploading")),e.querySelectorAll(".em-native-img-drop-target").forEach(n=>n.classList.remove("em-native-img-drop-target")),e.querySelectorAll(".em-native-img-upload-spin-overlay").forEach(n=>n.remove()),e.querySelectorAll(".em-element-list-bullet").forEach(n=>n.classList.remove("em-element-list-bullet")),e.querySelectorAll(".remove-new-editor-element").forEach(n=>n.classList.remove("remove-new-editor-element")),P_(e),Ic(e),IE(e),Et(e,"editor",!1),B_(e,t),k_(e),C_(e)}function Si(e){return(e??"").trim().toLowerCase()}function bh(e){const t=Array.from(e.classList).find(n=>n.startsWith("em-font-"));return t?.slice(t.lastIndexOf("-")+1)}function l$(e){const t=/^\d{3}/.exec(e);return t?Number(t[0]):t$.find(([n])=>n.test(e))?.[1]}function I_(e,t){const n=Si(e.style?.[t]);return n==="inherit"||n==="unset"?"":n}var c$=e=>{const t=I_(e,"fontWeight");if(t)return N_.has(t)||t==="initial"?"normal":"other";const n=bh(e),r=n===void 0?void 0:l$(n);return r!==void 0?r===400?"normal":"other":JF.includes(e.tagName)?"other":void 0},u$=e=>{const t=I_(e,"fontStyle");return t?x_.has(t)||t==="initial"?"normal":"other":/italic/i.test(bh(e)??"")||e$.includes(e.tagName)?"other":void 0};function d$(e,t,n,r){for(let o=e.parentElement;o&&o!==t;o=o.parentElement){const i=r(o);if(i)return i}for(let o=n instanceof Element?n:null;o;o=o.parentElement){const i=r(o);if(i)return i}}function f$(e,t){const n=bh(e)!==void 0,r=Si(e.style.fontWeight);r&&N_.has(r)&&!n&&t(c$)!=="other"&&e.style.removeProperty("font-weight");const o=Si(e.style.fontStyle);o&&x_.has(o)&&!n&&t(u$)!=="other"&&e.style.removeProperty("font-style");const i=Si(e.style.verticalAlign);i&&ZF.has(i)&&e.style.removeProperty("vertical-align");const s=Si(e.style.textDecorationLine);s&&O_.has(s)&&e.style.removeProperty("text-decoration-line");const a=Si(e.style.textDecoration);a&&O_.has(a)&&e.style.removeProperty("text-decoration");const l=e.getAttribute("style");l!==null&&l.trim()===""&&e.removeAttribute("style")}function m$(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function D_(e){if(e.attributes.length===0)return!0;for(const t of Array.from(e.attributes))if(t.name!==n$)return!1;return!0}function B_(e,t){const n=Array.from(e.querySelectorAll("span"));for(let r=n.length-1;r>=0;r-=1){const o=n[r];f$(o,i=>d$(o,e,t,i)),D_(o)&&m$(o)}for(const r of QF){const o=Array.from(e.querySelectorAll(r));for(let i=o.length-1;i>=0;i-=1){const s=o[i];s.childNodes.length===0&&D_(s)&&s.remove()}}}function h$(e){const t=[],n=v$(e);return e=b$(e,t,n),e=e.replaceAll(/<script[^>]*\bdata-amd-module-id\s*=[^>]*>[\s\S]*?<\/script>/gi,""),e=e.replaceAll(/<script[^>]*\/iframe\/js\/[^>]*>[\s\S]*?<\/script>/gi,""),e=e.replaceAll(/<style\b[^>]*ad-right-container[^>]*>[\s\S]*?<\/style>/gi,""),e=jl.clear(e),e=yh(e),t.length===0?e:S$(e,t,n)}var H_=`(<(script|style)\\b[^>]*>)([\\s\\S]*?)(?=<\\/\\2${tl})`,p$=new RegExp(H_,"gi"),g$=new RegExp(`<!--[\\s\\S]*?-->|${H_}`,"gi");function b$(e,t,n){const r=(o,i,s,a)=>!a||!E$(s,i)?i+a:(t.push(s.toLowerCase()==="style"?y$(a):a),`${i}${n}${t.length-1}${$_}`);return e.replaceAll(g$,(o,i,s,a)=>i===void 0?o.replaceAll(p$,r):r(o,i,s??"",a??""))}function y$(e){const t=yh(jl.clear(`>${e}`));return t.startsWith(">")?t.slice(1):yh(jl.clear(e))}var F_="",$_="";function v$(e){let t=F_;for(;e.includes(t);)t+=F_;return t}function E$(e,t){const n=document.createElement(e),r=/\btype\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(t);return r&&n.setAttribute("type",r[1]??r[2]??r[3]),vn(n)}function S$(e,t,n){return e.replaceAll(new RegExp(`${n}(\\d+)${$_}`,"g"),(r,o)=>t[Number(o)]??r)}function yh(e){return e=e.replaceAll(/\uFEFF/gmu,""),e=e.replaceAll(/<link[^>]*?em="css.*?>/gis,""),e=e.replaceAll(/draggable="false"|draggable="true"/gi,""),e=e.replaceAll(/ style="\s*"/gi,""),e=e.replaceAll(/<tbody.*?>/gi,"").replaceAll(/<\/tbody>/gi,""),e=e.replaceAll(/&nbsp;/gi," ").replaceAll(/&zwnj;/gi,"‌"),e=e.replaceAll(/style="transform: translateZ\(0px\);"/gi,""),e=e.replaceAll(/ +>/gi,">"),e=e.replaceAll(/&/gi,"&"),e=e.replaceAll(/"/gi,""),e=e.replaceAll(/^\s*$(?:\r\n?|\n)/gm,""),e=e.replaceAll(/ em-floatblock-width=".*?"/gi,""),e=e.replaceAll(/<div[^>]*?class="jfk-bubble.*?jfk-bubble-arrowimplafter".*?><\/div><\/div><\/div>/gis,""),e=e.replaceAll(/<span[^>]*?style="text-decoration: underline;"[^>]*?>(<a[^>]*?href.*?a>)<\/span>/gis,"$1"),e=e.replaceAll(/ rel="noopener"/gi,""),e=e.replaceAll(/ em-insert-ignore/gi,""),e=e.replaceAll(/ class="\s*"/gi,""),e=e.replaceAll(/<!--<em-root-text>(.*?)-->/gis,"$1"),e=e.replaceAll(/class="em-block.*?"/gi,""),e=e.replaceAll(/data-percent="[^"]*"/g,""),e=e.replaceAll(/em-optimise="[^"]*"/g,""),e=e.replaceAll(/em-optimise-error="[^"]*"/g,""),e=gv(e),e=e.replaceAll(/<tbody>/gi,"").replaceAll(/<\/tbody>/gi,""),e}function W_(e){switch(e.toLowerCase()){case"tr":return document.createElement("table");case"td":return document.createElement("tr");case"head":case"body":return document.createElement("html");default:return document.createElement("div")}}function w$(e,t){if(t.some(l=>l.nodeName==="HTML")){for(const l of t)e.appendChild(l);return}const n=t.find(l=>l.nodeType===Node.DOCUMENT_TYPE_NODE),r=t.find(l=>l.nodeName==="HEAD"),o=t.find(l=>l.nodeName==="BODY");n&&e.appendChild(n);const i=e.createElement("html"),s=r??e.createElement("head"),a=o??e.createElement("body");i.append(s,a);for(const l of t)l===n||l===r||l===o||l.nodeName==="HTML"||l.nodeName==="HEAD"||l.nodeName==="BODY"||a.appendChild(l);e.appendChild(i)}function q_(){const e=Array.from(document.querySelectorAll('style[em="styles"]'));return fF(()=>u_(document,e,{forceMediaMerge:!0}))}function _$(e){let t=!1;return e.beforeCommit(()=>{try{!t&&e.takeStyleDirty()&&(t=!0,q_(),e.takeStyleDirty())}finally{t=!1}})}function Dc(e){let t=e.html??"";const n=e.node,r=e.isBlock??!1,o=e.isPartial??!1;if(r||o){let i,s="div";if(n){if(s=n.tagName??"div",s==="DOCTYPE"||s==="html")return Dc({node:n});i=W_(s);const a=n.cloneNode(!0);nn(n,a),i.appendChild(a)}else{const a=t.trim(),l=a.match(/<\!?([a-zA-Z]{1,})[^>]*>/i);if(s=l?l[1]:"div",s==="DOCTYPE"||s==="html")return Dc({html:t});i=W_(s);const c=Ne(a);i.replaceChildren(...c)}Pc(i,{stage:"apply"}),a$(i,uR(n)),t=Nt(i),s.toLowerCase()==="head"&&(t=t.replace("<body></body>","")),s.toLowerCase()==="body"&&(t=t.replace("<head></head>",""))}else{const i=document.implementation.createHTMLDocument();for(const s of[...i.childNodes])s.remove();if(t)w$(i,Ne(t));else if(n){const s=n.cloneNode(!0);nn(n,s),i.appendChild(s)}i.documentElement&&(i.querySelectorAll("tbody").forEach(s=>s.replaceWith(...Array.from(s.childNodes))),i.querySelectorAll(".em-code").forEach(s=>s.remove()),i.querySelectorAll(':not(editor)[contenteditable="false"]').forEach(s=>s.remove()),i.querySelectorAll(".em-code").forEach(s=>s.remove()),i.querySelectorAll("[contenteditable]").forEach(s=>s.removeAttribute("contenteditable")),i.querySelectorAll("[em-edit]").forEach(s=>s.removeAttribute("em-edit")),i.querySelectorAll("[em-state]").forEach(s=>s.removeAttribute("em-state")),i.querySelectorAll("[em-hover]").forEach(s=>s.removeAttribute("em-hover")),i.querySelectorAll(".em-just-inserted").forEach(s=>s.classList.remove("em-just-inserted")),i.querySelectorAll(".em-native-img-uploading").forEach(s=>s.classList.remove("em-native-img-uploading")),i.querySelectorAll(".em-native-img-drop-target").forEach(s=>s.classList.remove("em-native-img-drop-target")),i.querySelectorAll(".em-native-img-upload-spin-overlay").forEach(s=>s.remove()),i.body?.classList.remove("em-native-img-drop-loading"),i.body?.classList.remove("em-native-file-drag"),i.querySelectorAll("#gtx-anchor").forEach(s=>s.remove()),i.documentElement.removeAttribute("style"),i.querySelectorAll('style[data-theme-varibalse="true"]').forEach(s=>s.remove()),i.querySelectorAll('style[data-em-localization="true"]').forEach(s=>s.remove()),SF(i),P_(i),Ic(i),IE(i),i.documentElement&&Et(i.documentElement,"editor",!1),i.querySelectorAll("ya-tr-span").forEach(s=>{s.parentNode&&(Array.from(s.childNodes).forEach(a=>s.parentNode.insertBefore(a,s)),s.remove())}),B_(i)),Pc(i,{stage:"apply"}),k_(i),C_(i),t=It(i)}return qF(h$(t)).html}function vh(){return Pt.getInstance(Qb)?.()??document.head}function Bc(){return vh().querySelector('style[em="styles"]')??document.querySelector('style[em="styles"]')}function Fe(){if(!Bc()){const e=document.createElement("style");e.setAttribute("em","styles"),vh().append(e)}}function z_(){const e=vh(),t=()=>{const r=Bc(),o=Array.from(e.querySelectorAll("style"));return r&&!o.includes(r)?[...o,r]:o};if(!t().length){const r=document.createElement("style"),o=document.querySelector('[em="block"]');if(o){const i=o.offsetWidth;r.innerHTML=`@media only screen and (max-device-width: ${i}px), only screen and (max-width: ${i}px) {}`}e.appendChild(r)}let n=null;for(const r of t()){const o=r.innerHTML.match(/@media.*?max((.|\n|\r)*?){/);if(o){n=o[0];break}}return n===null&&(n="@media only screen and (max-device-width: 660px), only screen and (max-width: 660px) {"),n}function Hc(e,t){const n=[];e.classList.forEach(r=>{r.indexOf(t)>-1&&n.push(r)}),n.forEach(r=>e.classList.remove(r))}function Fc(e){const t=e.elem.getAttribute("class");if(t){const n=t.split(" ");for(const r of n)r.indexOf("em-mob-padding_"+e.position)>-1&&e.elem.classList.remove(r)}}function Eh(){return V.get("commonStyles")}var $c={Thin:"100","Thin Italic":"100i",ExtraLight:"200","ExtraLight Italic":"200i",Light:"300","Light Italic":"300i",Regular:"400","Regular Italic":"400i",Medium:"500","Medium Italic":"500i",SemiBold:"600","SemiBold Italic":"600i",Bold:"700","Bold Italic":"700i",ExtraBold:"800","ExtraBold Italic":"800i",Black:"900","Black Italic":"900i"},C$={"Sans Serif":"sans-serif",Serif:"serif"},Wc="none",U_="b64_",T$=/^(\d+(?:_\d+)?)(px|perc)$/;function A$(e){if(e===Wc)return Wc;let t="";return new TextEncoder().encode(Oc(e)).forEach(n=>{t+=String.fromCharCode(n)}),U_+btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function k$(e){if(e===Wc)return Wc;if(!e.startsWith(U_))return e.replace(/em-doubledots/gi,":").replace(/em-dot/gi,".").replace(/em-slash/gi,"/");try{const t=atob(e.slice(4).replace(/-/g,"+").replace(/_/g,"/")),n=Uint8Array.from(t,r=>r.charCodeAt(0));return new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{return""}}function L$(e){return`url("${e.replace(/[\n\r\f]/g,"").replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`}function j_(e){return e.replace(/\./g,"_").replace(/%/g,"perc")}function V_(e){const t=e.match(T$);return t?t[1].replace("_",".")+(t[2]==="perc"?"%":"px"):e}function N$(){return Bc()}function Be(e,t){const n=N$();n&&n.insertAdjacentHTML("beforeend",`
|
|
52
|
+
${z_()}
|
|
53
|
+
.${e} { ${t} }
|
|
54
|
+
}
|
|
55
|
+
`)}function ye(e,t){const n=[];e.classList.forEach(r=>{r.indexOf(t)>-1&&n.push(r)}),n.forEach(r=>e.classList.remove(r))}function G_(e){const t=e.settings.mobileWidth;if(t.value!=null){let n="";if(t.dim?n=t.classNamePrefix+t.value+(t.dim==="%"?"perc":"px"):n=t.classNamePrefix+t.value,ye(e.elem,t.classNamePrefix),e.elem.classList.add(n),Fe(),t.dim)Be(n,`width: ${t.value}${t.dim} !important; max-width: ${t.value}${t.dim} !important; min-width: ${t.value}${t.dim} !important;`);else{const r=t.value!=="auto"?t.value:"none";Be(n,`width: ${t.value} !important; max-width: ${t.value} !important; min-width: ${r} !important;`)}}else ye(e.elem,t.classNamePrefix)}function x$(e){const t=e.settings.mobileContentWidth;if(t.value!=null){let n="";t.dim?n=t.classNamePrefix+t.value+(t.dim==="%"?"perc":"px"):n=t.classNamePrefix+t.value,ye(e.elem,t.classNamePrefix),e.elem.classList.add(n),Fe(),t.dim?Be(n,`width: ${t.value}${t.dim} !important; max-width: ${t.value}${t.dim} !important; min-width: ${t.value}${t.dim} !important;`):Be(n,`width: ${t.value} !important; max-width: ${t.value} !important; min-width: ${t.value}${t.dim} !important;`)}else ye(e.elem,t.classNamePrefix)}function wi(e){const t=e.settings.mobileHeight;if(t.value!=null){let n="";t.dim?n=t.classNamePrefix+t.value+(t.dim==="%"?"perc":"px"):n=t.classNamePrefix+t.value,ye(e.elem,t.classNamePrefix),e.elem.classList.add(n),Fe(),t.dim?Be(n,`height: ${t.value}${t.dim} !important;`):Be(n,`height: ${t.value} !important;`)}else ye(e.elem,t.classNamePrefix)}function O$(e){const t=["all","top","right","bottom","left"],n={all:"em-mob-border_all-",top:"em-mob-border_top-",right:"em-mob-border_right-",bottom:"em-mob-border_bottom-",left:"em-mob-border_left-"},r=Object.values(n);e.elem.classList.forEach(i=>{r.some(s=>i.includes(s))&&e.elem.classList.remove(i)});const o=e.settings.mobileBorder;t.forEach(i=>{const s=o[i];if(s&&(parseInt(String(s.width))||s.style||s.color)){let a=(s.classNamePrefix||n[i])+(s.width!=null?s.width+"px":"")+(s.style?"_"+s.style:"")+(s.color?"_"+s.color.substring(1):"");e.elem.classList.add(a),Fe();let l="";i==="all"?l=(s.width!=null?`border-width: ${s.width}px !important; `:"")+(s.style?`border-style: ${s.style} !important; `:"")+(s.color?`border-color: ${s.color} !important; `:""):l=(s.width!=null?`border-${i}-width: ${s.width}px !important; `:"")+(s.style?`border-${i}-style: ${s.style} !important; `:"")+(s.color?`border-${i}-color: ${s.color} !important; `:""),Be(a,l)}})}function R$(e){const t=e.settings.mobileBorderRadius;if(!t)return;const n=["all","topLeft","topRight","bottomRight","bottomLeft"].find(s=>s in t);if(!n)return;const r=t.classNamePrefix||`em-mob-border_radius_${n}-`,o=t[n],i=typeof o=="object"&&o!==null&&"value"in o?o.value:o;if(n==="all"&&i==null){Array.from(e.elem.classList).forEach(s=>{s.startsWith("em-mob-border_radius_")&&e.elem.classList.remove(s)});return}if(i!=null){const s=r+i;e.elem.classList.forEach(a=>{a.indexOf(r)>-1&&e.elem.classList.remove(a)}),n==="all"&&Array.from(e.elem.classList).forEach(a=>{a.startsWith("em-mob-border_radius_")&&e.elem.classList.remove(a)}),e.elem.classList.add(s),Fe(),Be(s,`${{all:"border-radius",topLeft:"border-top-left-radius",topRight:"border-top-right-radius",bottomRight:"border-bottom-right-radius",bottomLeft:"border-bottom-left-radius"}[n]||"border-radius"}: ${i}px !important;`),n!=="all"&&["em-mob-border_radius_topLeft","em-mob-border_radius_topRight","em-mob-border_radius_bottomLeft","em-mob-border_radius_bottomRight"].every(a=>Array.from(e.elem.classList).some(l=>l.startsWith(a)))&&ye(e.elem,"em-mob-border_radius_all-")}else e.elem.classList.forEach(s=>{s.indexOf(r)>-1&&e.elem.classList.remove(s)})}function M$(e){const t=e.settings.mobileBoxShadow,n=t.classNamePrefix||"em-mob-box_shadow-";if(t.hOffset!=null||t.vOffset!=null||t.blurRadius!=null||t.spreadRadius!=null){const r=t.hOffset!=null?`${t.hOffset}px`:"0px",o=t.vOffset!=null?`${t.vOffset}px`:"0px",i=t.blurRadius!=null?`${t.blurRadius}px`:"0px",s=t.spreadRadius!=null?`${t.spreadRadius}px`:"0px",a=t.color||"#000000",l=t.inset?" inset":"",c=n+(t.hOffset!=null?t.hOffset+"px":"0px")+"_"+(t.vOffset!=null?t.vOffset+"px":"0px")+"_"+(t.blurRadius!=null?t.blurRadius+"px":"0px")+"_"+(t.spreadRadius!=null?t.spreadRadius+"px":"0px")+"_"+(t.color?t.color.substring(1):"000000")+(t.inset?"_inset":"");ye(e.elem,n),e.elem.classList.add(c),Fe(),Be(c,`box-shadow:${l} ${r} ${o} ${i} ${s} ${a} !important;`)}else if(t.value){const r=(t.classNamePrefix||"em-mob-boxshadow_")+t.value.replace(/\s/g,"_").replace(/\(/g,"").replace(/\)/g,"").replace(/,/g,"-");ye(e.elem,t.classNamePrefix||"em-mob-boxshadow_"),e.elem.classList.add(r),Fe(),Be(r,`box-shadow: ${t.value} !important;`)}else ye(e.elem,n)}function X_(e){const t=e.fieldName??"mobileAlign",n=e.settings[t];if(n.value){const r=n.classNamePrefix+n.value;ye(e.elem,n.classNamePrefix),e.elem.classList.add(r),Fe(),Be(r,`text-align: ${n.value} !important;`)}else ye(e.elem,n.classNamePrefix)}function P$(e){const t=e.settings.mobileAlign;if(t.value){const n=t.classNamePrefix+t.value;ye(e.elem,t.classNamePrefix),e.elem.classList.add(n),Fe();let r="";t.value==="left"||t.value==="right"?r=`float: ${t.value}`:r="margin: 0 auto",Be(n,`${r} !important;`)}else ye(e.elem,t.classNamePrefix)}function Sh(e){const t=e.settings.mobileVerticalAlign;if(t.value){const n=t.classNamePrefix+t.value;ye(e.elem,t.classNamePrefix),e.elem.classList.add(n),Fe(),Be(n,`vertical-align: ${t.value} !important;`)}else ye(e.elem,t.classNamePrefix)}function I$(e){const t=e.settings.mobileDirection;if(t.value){const n=t.classNamePrefix+t.value;ye(e.elem,t.classNamePrefix),e.elem.classList.add(n),Fe(),Be(n,`direction: ${t.value} !important;`)}else ye(e.elem,t.classNamePrefix)}function D$(e){const t=e.settings.mobileBackgroundColor;if(t.value){const n=t.value!=="none"?String(t.value).substring(1):"none",r=t.classNamePrefix+n;ye(e.elem,t.classNamePrefix),e.elem.classList.add(r),Fe(),Be(r,`background-color: ${t.value!=="none"?t.value:"transparent"} !important;`)}else ye(e.elem,t.classNamePrefix)}function B$(e){const t=e.settings.mobileBackgroundImage[0];if(t.value){const n=String(t.value),r=t.classNamePrefix+A$(n);ye(e.elem,t.classNamePrefix),e.elem.classList.add(r),Fe(),Be(r,`background-image: ${n!=="none"?L$(Oc(n)):"none"} !important;`)}else ye(e.elem,t.classNamePrefix)}function H$(e){const t=e.settings.mobileBackgroundPositionX;if(t.value){const n=t.classNamePrefix+j_(String(t.value));ye(e.elem,t.classNamePrefix),e.elem.classList.add(n),Fe(),Be(n,`background-position-x: ${t.value} !important;`)}else ye(e.elem,t.classNamePrefix)}function F$(e){const t=e.settings.mobileBackgroundPositionY;if(t.value){const n=t.classNamePrefix+j_(String(t.value));ye(e.elem,t.classNamePrefix),e.elem.classList.add(n),Fe(),Be(n,`background-position-y: ${t.value} !important;`)}else ye(e.elem,t.classNamePrefix)}function $$(e){const t=e.settings.mobileBackgroundRepeat;if(t.value&&t.value!=="none"){const n=t.classNamePrefix+t.value;ye(e.elem,t.classNamePrefix),e.elem.classList.add(n),Fe(),Be(n,`background-repeat: ${t.value} !important;`)}else ye(e.elem,t.classNamePrefix)}function W$(e){const t=e.settings.mobileBackgroundSize;if(t.value){const n=t.classNamePrefix+t.value;ye(e.elem,t.classNamePrefix),e.elem.classList.add(n),Fe(),Be(n,`background-size: ${t.value} !important;`)}else ye(e.elem,t.classNamePrefix)}function na(e){const t=e.settings.mobilePadding;Fe(),["top","right","bottom","left"].forEach(n=>{const r=t[n];if(r!=null){Fc({elem:e.elem,position:n});const o=t.classNamePrefix+n+"-"+r;e.elem.classList.add(o),Be(o,`padding-${n}: ${r}px !important;`)}else r===null&&Fc({elem:e.elem,position:n})})}function K_(e){const t=e.settings.mobileFontSize;if(t.value!=null){const n=t.classNamePrefix+t.value+"px";ye(e.elem,t.classNamePrefix),e.elem.classList.add(n),Fe(),Be(n,`font-size: ${t.value}px !important;`)}else ye(e.elem,t.classNamePrefix)}function wh(e){const t=e.settings.mobileLineHeight;if(t&&t.value!==null){const n=t.classNamePrefix+t.value+"px";ye(e.elem,t.classNamePrefix),e.elem.classList.add(n),Fe(),Be(n,`line-height: ${t.value}px !important;`)}else t&&ye(e.elem,t.classNamePrefix)}function Y_(e){const t=e.settings.show,n=()=>{e.elem.style.removeProperty("display"),e.elem.tagName==="IMG"&&(e.elem.style.display="block"),e.elem.previousSibling&&e.elem.previousSibling.textContent?.indexOf("mso")!==-1&&e.elem.previousSibling.remove(),e.elem.nextSibling&&e.elem.nextSibling.textContent?.indexOf("endif")!==-1&&e.elem.nextSibling.remove()};if(t!=="all"){const r="em-show-"+e.elem.tagName?.toLowerCase()+"-"+t;if(e.elem.classList.forEach(o=>{o.indexOf("em-show-")>-1&&e.elem.classList.remove(o)}),e.elem.classList.add(r),Fe(),t==="mobile"){e.elem.style.display="none",(!e.elem.previousSibling||e.elem.previousSibling.textContent?.indexOf("mso")===-1)&&(e.elem.insertAdjacentHTML("beforebegin","<!--[if !mso]><!-->"),e.elem.insertAdjacentHTML("afterend","<!--<![endif]-->"));let o="block";e.elem.tagName==="TD"?o="table-cell":e.elem.tagName==="IMG"?o="block":e.elem.tagName==="TABLE"&&(o="table"),Be(r,`display: ${o} !important;`)}t==="desktop"&&(n(),Be(r,"display: none !important;"))}else n(),e.elem.classList.forEach(r=>{r.indexOf("em-show-")>-1&&e.elem.classList.remove(r)})}function q$(e){const t=e.settings.isContrastBlock,n=Eh();if(t){e.elem.closest('[em="block"]')?.classList.add("em-contrast-block");const r=n.block?.contrastBackgroundColor||"#1C52DC";e.elem.setAttribute("bgcolor",r),e.elem.style.backgroundColor=r;const o=e.elem.querySelectorAll('div[style*="font-family"]');o.forEach(i=>{const s=i;!s.style.display&&parseFloat(s.style.fontSize)<=20&&(s.style.color=n.text?.contrastColor||"#FFFFFF")}),o.forEach(i=>{const s=i;!s.style.display&&parseFloat(s.style.fontSize)>20&&(s.style.color=n.headings?.contrastColor||"#FFFFFF")}),e.elem.querySelectorAll('a[style*="color"]').forEach(i=>{const s=i;s.style.display||(s.style.color=n.links?.contrastColor||"#FFFFFF")}),e.elem.querySelectorAll('a[style*="font-family"]').forEach(i=>{const s=i;if(s.style.display&&s.style.display==="block"){s.style.color=n.buttons?.contrastColor||"#1C52DC";const a=s.closest("td");if(a){const l=n.buttons?.contrastBackgroundColor||"#FFFFFF";a.setAttribute("bgcolor",l),a.style.backgroundColor=l}}})}else{e.elem.closest('[em="block"]')?.classList.remove("em-contrast-block");const r=n.block?.backgroundColor||"#FFFFFF";e.elem.setAttribute("bgcolor",r),e.elem.style.backgroundColor=r;const o=e.elem.querySelectorAll('div[style*="font-family"]');o.forEach(i=>{const s=i;!s.style.display&&parseFloat(s.style.fontSize)<=20&&(s.style.color=n.text?.color||"")}),o.forEach(i=>{const s=i;!s.style.display&&parseFloat(s.style.fontSize)>20&&(s.style.color=n.headings?.color||"")}),e.elem.querySelectorAll('a[style*="color"]').forEach(i=>{const s=i;s.style.display||(s.style.color=n.links?.color||"")}),e.elem.querySelectorAll('a[style*="font-family"]').forEach(i=>{const s=i;if(s.style.display&&s.style.display==="block"){s.style.color=n.buttons?.color||"";const a=s.closest("td");if(a){const l=n.buttons?.backgroundColor||"";a.setAttribute("bgcolor",l),a.style.backgroundColor=l}}})}}function z$(){return{mobileWidth:null,mobileWidthDim:"px",mobileHeight:null,mobileHeightDim:"px",mobileBorder:{all:{width:null,style:null,color:null},top:{width:null,style:null,color:null},right:{width:null,style:null,color:null},bottom:{width:null,style:null,color:null},left:{width:null,style:null,color:null}},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},mobileBoxShadow:{hOffset:null,vOffset:null,blurRadius:null,spreadRadius:null,color:null,inset:null},mobileAlign:{value:""},mobileTextAlign:{value:""},mobileVerticalAlign:{value:""},mobileDirection:{value:""},mobileBackgroundColor:{value:""},mobileBackgroundImage:[{type:"url",value:""}],mobileBackgroundPositionX:{value:""},mobileBackgroundPositionY:{value:""},mobileBackgroundRepeat:{value:"none"},mobileBackgroundSize:{value:""},mobilePadding:{all:null,bottom:null,left:null,right:null,top:null},show:"all",mobileFontSize:null,mobileFontSizeDim:"px"}}function qe(e,t=!1){const n=z$();return e.elem?.classList?.forEach(r=>{if(r.indexOf("em-mob-width-")>-1&&(r.substring(r.length-2)==="px"?(n.mobileWidthDim="px",n.mobileWidth=parseFloat(r.substring(13,r.length-2))):r.substring(r.length-4)==="perc"?(n.mobileWidthDim="%",n.mobileWidth=parseFloat(r.substring(13,r.length-4))):r.substring(r.length-4)==="auto"&&(n.mobileWidthDim="px",n.mobileWidth="auto")),r.indexOf("em-mob-height-")>-1&&(r.substring(r.length-2)==="px"?(n.mobileHeightDim="px",n.mobileHeight=parseFloat(r.substring(14,r.length-2))):r.substring(r.length-4)==="perc"?(n.mobileHeightDim="%",n.mobileHeight=parseFloat(r.substring(14,r.length-4))):r.substring(r.length-4)==="auto"&&(n.mobileHeightDim="px",n.mobileHeight="auto")),r.indexOf("em-mob-border")>-1){if(r.substring(14,17)==="all"){const o=r.substring(18).split("_");n.mobileBorder.all.width=parseFloat(o[0]),n.mobileBorder.all.style=o[1],n.mobileBorder.all.color=o[2]?"#"+o[2]:""}if(r.substring(14,17)==="top"){const o=r.substring(18).split("_");n.mobileBorder.top.width=parseFloat(o[0]),n.mobileBorder.top.style=o[1],n.mobileBorder.top.color=o[2]?"#"+o[2]:""}if(r.substring(14,19)==="right"){const o=r.substring(20).split("_");n.mobileBorder.right.width=parseFloat(o[0]),n.mobileBorder.right.style=o[1],n.mobileBorder.right.color=o[2]?"#"+o[2]:""}if(r.substring(14,20)==="bottom"){const o=r.substring(21).split("_");n.mobileBorder.bottom.width=parseFloat(o[0]),n.mobileBorder.bottom.style=o[1],n.mobileBorder.bottom.color=o[2]?"#"+o[2]:""}if(r.substring(14,18)==="left"){const o=r.substring(19).split("_");n.mobileBorder.left.width=parseFloat(o[0]),n.mobileBorder.left.style=o[1],n.mobileBorder.left.color=o[2]?"#"+o[2]:""}}if(r.indexOf("em-mob-border_radius")>-1&&(r.substring(21,28)==="topLeft"&&(n.mobileBorderRadius.topLeft=parseFloat(r.substring(29))),r.substring(21,29)==="topRight"&&(n.mobileBorderRadius.topRight=parseFloat(r.substring(30))),r.substring(21,32)==="bottomRight"&&(n.mobileBorderRadius.bottomRight=parseFloat(r.substring(33))),r.substring(21,31)==="bottomLeft"&&(n.mobileBorderRadius.bottomLeft=parseFloat(r.substring(32))),r.substring(21,24)==="all"&&(n.mobileBorderRadius.all=parseFloat(r.substring(25)))),r.indexOf("em-mob-box_shadow")>-1){const o=r.substring(18).split("_");n.mobileBoxShadow.hOffset=parseFloat(o[0]),n.mobileBoxShadow.vOffset=parseFloat(o[1]),n.mobileBoxShadow.blurRadius=parseFloat(o[2]),n.mobileBoxShadow.spreadRadius=parseFloat(o[3]),n.mobileBoxShadow.color=o[4]?"#"+o[4]:"",n.mobileBoxShadow.inset=!!o[5]}r.indexOf("em-mob-text_align")>-1&&(n.mobileAlign.value=r.substring(18)),r.indexOf("em-mob-table_align")>-1&&(n.mobileAlign.value=r.substring(19)),r.indexOf("em-mob-vertical_align")>-1&&(n.mobileVerticalAlign.value=r.substring(22)),r.indexOf("em-mob-direction")>-1&&(n.mobileDirection.value=r.substring(17)),r.indexOf("em-mob-background_color")>-1&&(n.mobileBackgroundColor.value=r.substring(24)!=="none"?"#"+r.substring(24):"none"),r.indexOf("em-mob-background_image")>-1&&(n.mobileBackgroundImage[0].value=k$(r.substring(24))),r.indexOf("em-mob-background_position_x")>-1&&(n.mobileBackgroundPositionX.value=V_(r.substring(29))),r.indexOf("em-mob-background_position_y")>-1&&(n.mobileBackgroundPositionY.value=V_(r.substring(29))),r.indexOf("em-mob-background_repeat")>-1&&(n.mobileBackgroundRepeat.value=r.substring(25)),r.indexOf("em-mob-background_size")>-1&&(n.mobileBackgroundSize.value=r.substring(23)),r.indexOf("em-mob-padding")>-1&&(r.substring(15,18)==="all"&&(n.mobilePadding.all=parseFloat(r.substring(19))),r.substring(15,18)==="top"&&(n.mobilePadding.top=parseFloat(r.substring(19))),r.substring(15,20)==="right"&&(n.mobilePadding.right=parseFloat(r.substring(21))),r.substring(15,21)==="bottom"&&(n.mobilePadding.bottom=parseFloat(r.substring(22))),r.substring(15,19)==="left"&&(n.mobilePadding.left=parseFloat(r.substring(20)))),r.indexOf("em-show")>-1&&(r.substring(r.length-6)==="mobile"?n.show="mobile":r.substring(r.length-7)==="desktop"&&(n.show="desktop")),t&&(r==="em-amp-show-only"?n.ampShow="amp":r==="em-amp-show-disabled"&&(n.ampShow="html")),r.indexOf("em-mob-font_size")>-1&&(n.mobileFontSizeDim="px",n.mobileFontSize=r.substring(17,r.length-2)),r.indexOf("em-mob-line_height")>-1&&(n.mobileLineHeight=r.substring(19,r.length-2))}),n}var Aie="\u2028",U$=1.4,j$=16,qc=/^em-mob-height-(\d+(?:\.\d+)?)px$/,Z_="em-mob-line_height-";function Q_(e){const t=[""],n=o=>{o.childNodes.forEach(i=>{if(i.nodeType===Node.TEXT_NODE)t[t.length-1]+=i.nodeValue||"";else if(i.nodeType===Node.ELEMENT_NODE){const s=i;s.tagName==="BR"?s.hasAttribute("data-mce-bogus")||t.push(""):n(s)}})};n(e);const r=t.map(o=>o.replace(/\s+/g," ").trim());return r.length>1&&r[r.length-1]===""&&r.pop(),r}function V$(e){const t=J_(e);return t?.parentNode?.removeChild(t),!!t}function J_(e){const t=G$(e),n=t[t.length-1],r=t[t.length-2];return n?.nodeName==="BR"&&r&&r.nodeName!=="BR"?n:null}function G$(e){const t=[],n=r=>{r.childNodes.forEach(o=>{if(o.nodeType===Node.TEXT_NODE)(o.nodeValue??"").trim()&&t.push(o);else if(o.nodeType===Node.ELEMENT_NODE){const i=o;if(i.tagName==="BR"&&i.hasAttribute("data-mce-bogus"))return;i.childNodes.length?n(i):t.push(i)}})};return n(e),t}function ra(e){return Q_(e).length>1}function _h(e){return Q_(e).join("\u2028")}function eC(e){const t=e.closest("td");return!!t&&(!!t.getAttribute("height")||!!t.style.height)}function tC(e,t,n=t){iC(e),J$(e);const r=sC(e);if(ra(e)){const o=Z$(e,n);e.closest("td")?.setAttribute("valign","middle"),e.style.removeProperty("height"),e.style.lineHeight=o,r&&(r.style.removeProperty("height"),r.style.removeProperty("line-height")),oC(e)}else e.style.height=t,e.style.lineHeight=t,r&&(r.style.height=t,r.style.lineHeight=t)}function X$(e){e.style.removeProperty("height"),e.style.removeProperty("line-height"),iC(e);const t=sC(e);t&&(t.style.removeProperty("height"),t.style.removeProperty("line-height"))}function K$(e){const t=rC(e);return!t||!nC(e)?!1:(tC(e,t),ra(e)||Y$(e),!0)}function nC(e){const t=rC(e);return!!t&&ra(e)===(e.style.lineHeight===t)}function rC(e){const t=e.closest("td");return!t||!eC(e)?null:t.style.height||`${t.getAttribute("height")}px`}function Y$(e){const t=e.closest("td"),n=t?[...t.classList].find(o=>qc.test(o)):void 0,r=n?Number(qc.exec(n)?.[1]):NaN;r>0&&wh({settings:{mobileLineHeight:{classNamePrefix:Z_,value:r,dim:"px"}},elem:e})}function oC(e){const t=e.closest("td"),n=t?[...t.classList].find(o=>qc.test(o)):void 0;if(!n)return;const r=Z_+(qc.exec(n)?.[1]??"")+"px";[e,...e.querySelectorAll(`.${r}`)].forEach(o=>o.classList.remove(r))}function Z$(e,t){const n=parseFloat(e.style.lineHeight);return!(e.style.height||e.style.lineHeight===t)&&e.style.lineHeight.endsWith("px")&&n>0?e.style.lineHeight:`${Math.round(Q$(e)*U$)}px`}function Q$(e){const t=e.closest('[style*="font-size"]'),n=t?parseFloat(t.style.fontSize):NaN;if(n>0&&(t?.style.fontSize.endsWith("px")??!1))return n;const r=parseFloat(getComputedStyle(e).fontSize);return r>0?r:j$}function iC(e){e.querySelectorAll("[style]").forEach(t=>t.style.removeProperty("line-height"))}function J$(e){[e,...e.querySelectorAll("[style]")].forEach(t=>{const n=t.style.paddingLeft,r=t.style.paddingRight;t.style.removeProperty("padding"),t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),n&&(t.style.paddingLeft=n),r&&(t.style.paddingRight=r)})}function sC(e){return e.closest("editor")||e.querySelector("editor")}var Ch=/v:roundrect/i,Th=/\[if\s*!\s*mso\]/i,aC=/^\s*(?:<!)?\[endif\]\s*$/i,Ah=["background-color","border-radius","border","border-top","border-right","border-bottom","border-left","border-color","border-style","border-width","box-shadow"],eW=[...Ah,"padding","padding-top","padding-right","padding-bottom","padding-left","color","font-family","font-size","font-weight","font-style","text-align","line-height","letter-spacing","width"];function wo(e){return!!e&&e.nodeType===Node.COMMENT_NODE}var tW=/\bhref\s*=\s*(?:"([^"]*)"|'([^']*)')/i,lC=e=>e.replace(/&/gi,"&").trim();function nW(e){let t=e.nextSibling;for(;t&&(wo(t)||t.nodeType===Node.TEXT_NODE&&!t.nodeValue?.trim());)t=t.nextSibling;return t}function cC(e,t){if(t.contains(e))return!0;if(!nW(e)?.contains(t))return!1;const n=tW.exec(e.nodeValue??""),r=lC(n?.[1]??n?.[2]??""),o=lC(t.getAttribute("href")??"");return!r||!o||r===o}function zc(e){const t=[],n=r=>{r.childNodes.forEach(o=>{wo(o)&&Ch.test(o.nodeValue||"")&&t.push(o),n(o)})};return n(e),t}function uC(e,t,n){const r=n?zc(e).find(s=>cC(s,n)):Fr(e);if(!r)return!1;const o=r.nodeValue||"";if(!/<center\b[^>]*>[\s\S]*?<\/center>/i.test(o))return!1;const i=fC(t);return r.nodeValue=o.replace(/(<center\b[^>]*>)[\s\S]*?(<\/center>)/i,(s,a,l)=>`${a}${i}${l}`),!0}function Fr(e){for(const t of Array.from(e.childNodes)){if(wo(t)&&Ch.test(t.nodeValue||""))return t;const n=Fr(t);if(n)return n}return null}function dC(e){let t=e.previousSibling;for(;t&&t.nodeType===Node.TEXT_NODE&&!(t.nodeValue||"").trim();)t=t.previousSibling;return t}function rW(e){let t=e.nextSibling;for(;t&&t.nodeType===Node.TEXT_NODE&&!(t.nodeValue||"").trim();)t=t.nextSibling;return t}function qn(e){const t=parseInt(String(e??""),10);return Number.isFinite(t)?t:0}function oW(e,t){const n=_h(e);if(n.split("\u2028").join(""))return n;for(const r of t){const o=(r.nodeValue||"").match(/<center[^>]*>([\s\S]*?)<\/center>/i);if(o)return o[1].replace(/\s+/g," ").trim()}return""}function iW(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function fC(e){return(e||"").split("\u2028").map(t=>iW(t.replace(/\s+/g," ").trim())).join("<br>")}function sW(e,t){const n=e.getAttribute("bgcolor");n&&(t.style.backgroundColor||(t.style.backgroundColor=n),e.removeAttribute("bgcolor"));for(const r of Ah){const o=e.style.getPropertyValue(r);o&&(t.style.setProperty(r,o,e.style.getPropertyPriority(r)),e.style.removeProperty(r))}t.style.display||(t.style.display="block")}function aW(e,t){const n=t.getAttribute("bgcolor");n&&(!e.style.backgroundColor&&!e.getAttribute("bgcolor")&&(e.style.backgroundColor=n),t.removeAttribute("bgcolor"));for(const r of Ah){const o=t.style.getPropertyValue(r);o&&(e.style.getPropertyValue(r)||e.style.setProperty(r,o,t.style.getPropertyPriority(r)),t.style.removeProperty(r))}}function lW(e){const t=e.style.display;return t!=="inline-block"&&t!=="block"?!1:!!(e.style.backgroundColor||e.style.borderRadius)}function kh(e){if(!e)return null;for(const t of Array.from(e.querySelectorAll("[style]")))if(lW(t))return t;return null}function Lh(e){return e?!!kh(e)||!!Fr(e):!1}function cW(e,t){for(const n of eW){const r=e.style.getPropertyValue(n);r&&!t.style.getPropertyValue(n)&&t.style.setProperty(n,r,e.style.getPropertyPriority(n))}t.style.display||(t.style.display="block")}function uW(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function mC(e,t){const n=kh(t);return n?(cW(n,t),uW(n),zc(t).forEach(r=>r.parentNode?.removeChild(r)),Nh(t),!0):!1}function dW(e){for(const t of e){const n=t.nodeValue||"";if(!Ch.test(n))continue;const r=/<v:roundrect[^>]*\bstyle="([^"]*)"/i.exec(n),o=r?r[1]:"",i=/width:\s*(\d+)\s*px/i.exec(o),s=/height:\s*(\d+)\s*px/i.exec(o),a=/arcsize="(\d+)%?"/i.exec(n);return{width:i?qn(i[1]):0,height:s?qn(s[1]):0,arcsize:a?qn(a[1]):0}}return{width:0,height:0,arcsize:0}}function fW(e){const t=e.style;let n=t.borderWidth||t.borderTopWidth||"",r=t.borderStyle||t.borderTopStyle||"",o=t.borderColor||t.borderTopColor||"";if((!n||!r)&&t.border){const a=t.border.trim().split(/\s+/);n||(n=a[0]||""),r||(r=a[1]||""),o||(o=a.slice(2).join(" ")||"")}if(!r||r==="none")return null;const i=parseFloat(n);if(!Number.isFinite(i)||i<=0)return null;const s=r==="dashed"?"dash":r==="dotted"?"dot":"";return{color:G(o)||o||"#000000",weight:`${i}px`,dash:s}}var mW=new Set(["bold","bolder","600","700","800","900"]);function hW(e){const t={bold:!1,italic:!1,underline:!1,strikethrough:!1};e.querySelector("b, strong")&&(t.bold=!0),e.querySelector("i, em")&&(t.italic=!0),e.querySelector("u")&&(t.underline=!0),e.querySelector("s, strike")&&(t.strikethrough=!0);const n=[e,...Array.from(e.querySelectorAll("*"))];for(const r of n){const o=r.style;if(!o)continue;const i=(o.fontWeight||"").toLowerCase();i&&mW.has(i)&&(t.bold=!0),o.fontStyle==="italic"&&(t.italic=!0);const s=o.textDecoration||o.textDecorationLine||"";s.includes("underline")&&(t.underline=!0),s.includes("line-through")&&(t.strikethrough=!0)}return t}function pW(e){const t=[e.height?`height:${e.height}px`:"","v-text-anchor:middle",e.width?`width:${e.width}px`:""].filter(Boolean),n=[e.underline?"underline":"",e.strikethrough?"line-through":""].filter(Boolean).join(" "),r=[e.color?`color:${e.color}`:"",e.fontFamily?`font-family:${e.fontFamily}`:"",e.fontSize?`font-size:${e.fontSize}`:"",e.bold?"font-weight:bold":"",e.italic?"font-style:italic":"",n?`text-decoration:${n}`:""].filter(Boolean),o=!!e.strokeColor&&!!e.strokeWeight,i=o?`stroke="t" strokecolor="${e.strokeColor}" strokeweight="${e.strokeWeight}"`:'stroke="f"',s=o&&e.strokeDash?`<v:stroke dashstyle="${e.strokeDash}"/>`:"",a=u=>u.replace(/"/g,"'"),l=a(`${t.join(";")};`),c=a(`${r.join(";")}${r.length?";":""}`);return`[if mso]><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${a(e.href)}" style="${l}" arcsize="${e.arcsize}%" ${i} fillcolor="${e.fillcolor||"none"}"><w:anchorlock/>`+s+`<center style="${c}">${fC(e.label)}</center></v:roundrect><![endif]`}function Nh(e){const t=[],n=r=>{r.childNodes.forEach(o=>{if(wo(o)){const i=o.nodeValue||"";(Th.test(i)||aC.test(i))&&t.push(o)}n(o)})};n(e),t.forEach(r=>r.parentNode?.removeChild(r))}function gW(e){const t=e.closest("td");if(!t)return;const n=e.closest("a")||t.querySelector("a");n&&mC(t,n),zc(t).forEach(r=>r.parentNode?.removeChild(r)),Nh(t),n&&aW(t,n)}function bW(e){const t=e.ownerDocument;if(!t)return;const n=e.parentNode;if(!n)return;const r=dC(e);wo(r)&&Th.test(r.nodeValue||"")||n.insertBefore(t.createComment("[if !mso]><!"),e);const o=rW(e);wo(o)&&aC.test(o.nodeValue||"")||n.insertBefore(t.createComment("<![endif]"),e.nextSibling)}function yW(e,t){return e?.backgroundColor!==void 0?e.backgroundColor===""?"none":e.backgroundColor:t.style.backgroundColor||t.getAttribute("bgcolor")||"none"}function vW(e,t){if(t?.width?.value&&t.width.dim==="px")return qn(t.width.value);const n=e?.getAttribute("width")||"";return n&&!n.includes("%")?qn(n):0}function EW(e,t){if(t?.height?.value&&t.height.dim==="px")return qn(t.height.value);const n=e.getAttribute("height")||"";return n&&!n.includes("%")?qn(n):qn(e.style.height)}function SW(e,t){return e?.borderRadius&&e.borderRadius.all!=null?qn(e.borderRadius.all):qn(t.style.borderRadius)}function wW(e,t,n){const r=[t,n].filter(i=>i>0);if(!r.length||e<=0)return 0;const o=Math.min(...r);return Math.max(0,Math.min(100,Math.round(e/o*100)))}function xh(e,t){const n=e.closest("td");if(!n)return;const r=e.closest("a")||n.querySelector("a");if(!r)return;const o=zc(n),i=oW(r,o),s=dW(o);mC(n,r),sW(n,r),o.forEach(C=>C.parentNode?.removeChild(C)),Nh(n);const a=vW(n.closest("table"),t)||s.width,l=EW(n,t)||s.height,c=SW(t,r),u=hW(r),d=fW(r),f=wW(c,a,l)||s.arcsize,h={href:t?.href!==void 0?t.href:r.getAttribute("href")||"",fillcolor:yW(t,r),width:a,height:l,arcsize:f,label:i,color:r.style.color||"",fontFamily:r.style.fontFamily||"",fontSize:r.style.fontSize||"",bold:u.bold,italic:u.italic,underline:u.underline,strikethrough:u.strikethrough,strokeColor:d?.color||"",strokeWeight:d?.weight||"",strokeDash:d?.dash||""};bW(r);const m=n.ownerDocument;if(!m)return;const p=dC(r),S=m.createComment(pW(h));wo(p)&&Th.test(p.nodeValue||"")&&p.parentNode?p.parentNode.insertBefore(S,p):n.insertBefore(S,n.firstChild)}function Oh(e,t){const{target:n}=e;setTimeout(()=>{const r=n?.querySelector("a");if(!r)return;const o=r.closest("div, td, h1, h2, h3, h4, h5, h6, li, ul, ol, sup, sub");o&&(o.childNodes.forEach(i=>{if(i.nodeType===Node.COMMENT_NODE&&i.nodeValue?.includes("[if mso]")&&cC(i,r)){const s=r.innerHTML.length*11+40;i.nodeValue=i.nodeValue.replace(/(<center[^>]*>)(.*?)(<\/center>)/s,(a,l,c,u)=>l+r.innerHTML+u).replace(/(width:)(\d+)(px)/,(a,l,c,u)=>`${l}${s}${u}`)}}),t(!1))},0)}var hC="__emOwnEditor";function _W(e){e[hC]=!0,pE(e)}function pC(e){const t=[e.closest("editor"),...Array.from(e.querySelectorAll("editor"))],n=e.ownerDocument.activeElement;let r=!1;for(const o of t)o&&!o[hC]&&!o.contains(n)&&(o.replaceWith(...Array.from(o.childNodes)),r=!0);return r}var CW=["deleteContentBackward","deleteContentForward","deleteByCut"],TW={deleteContentBackward:"backward",deleteContentForward:"forward"};function AW(e){const{element:t,getVisibleText:n,setCursorToElement:r,hasOnlyTextNodesDeep:o,isRangeCoveringAllVisibleText:i,isEditorContentOnlyNbsp:s,commit:a,pasteFragment:l}=e,c=k=>xt(k)?Kf(k):e.mapFn(k);function u(k){return!n(k,c).trim()&&!k.querySelector(bC)}const d=k=>n(k,c).trim();function f(k,y){const g=document.createRange();g.selectNodeContents(y);const v=k.cloneRange();return v.compareBoundaryPoints(v.START_TO_START,g)<0&&v.setStart(g.startContainer,g.startOffset),v.compareBoundaryPoints(v.END_TO_END,g)>0&&v.setEnd(g.endContainer,g.endOffset),vC(n(v.cloneContents(),c).trim(),d(y))}function h(k){k.insertAdjacentHTML("beforebegin"," "),k.removeAttribute("em-edit"),k.remove()}function m(k,y,g){if(!y.collapsed)return!1;const v=document.createRange();return g?(v.setStart(y.endContainer,y.endOffset),v.setEnd(k,k.childNodes.length)):(v.setStart(k,0),v.setEnd(y.startContainer,y.startOffset)),!n(v.cloneContents(),c).trim()}function p(k,y){const g=LC(k,y);C(k),k.prepend(...g.filter(({before:v})=>v).map(({node:v})=>v)),k.append(...g.filter(({before:v})=>!v).map(({node:v})=>v))}function S(k){return k.inputType.startsWith("delete")?NC(Mh(k),()=>TC(k)):TC(k)}function C(k,y=jc(k,d)){const[g,...v]=y,w=g??k;if(!g&&(RW(k)||PW(k))){const _=document.createTextNode(" ");k.replaceChildren(_),r(_);return}const b=document.createElement(g&&g.tagName!=="EDITOR"?g.tagName:"div"),E=document.createTextNode(" ");if(g&&w.tagName===b.tagName)for(const{name:_,value:T}of Array.from(w.attributes))b.setAttribute(_,T);I5(b,g?k:$W(k),w,WW),b.getAttribute("style")||b.removeAttribute("style"),v.filter(_=>_.tagName!=="TBODY").reduce((_,T)=>_.appendChild(FW(T)),b).append(E),k.tagName==="A"||k.parentNode&&k.parentNode.tagName==="A"?k.replaceChildren(E):k.replaceChildren(b),r(E)}function L(k,y){if(y.collapsed)return!1;const g=jc(k,d);return BE(y,void 0,LD)?(u(k)&&C(k,g),t.setAttribute("em-edit","active"),a(!0),!0):!1}return function(y){const g=Mh(y),v=window.getSelection();if(!v||v.rangeCount===0)return;if(hI(y.inputType)&&hE(v.getRangeAt(0),g),y.inputType==="insertFromPaste"&&l&&!y.defaultPrevented){l(y);return}const w=TW[y.inputType];if(w&&TD(v.getRangeAt(0),w)){y.preventDefault();return}if(CW.includes(y.inputType)&&L(g,v.getRangeAt(0))){y.preventDefault();return}const b=n(g,c).trim(),E=n(v.getRangeAt(0)?.cloneContents(),c).trim(),_=v.getRangeAt(0),T=_.startContainer,x=(T.nodeType===Node.TEXT_NODE?T.parentNode:T).closest("sup, sub");if((y.inputType==="deleteContentBackward"||y.inputType==="deleteByCut")&&!v?.isCollapsed&&E){if(x&&f(_,x)&&h(x),i(_)&&vC(E,b)&&!g.querySelector(Uc)){y.preventDefault(),p(g,_),t.setAttribute("em-edit","active"),a(!0);return}t.setAttribute("em-edit","active"),a(!0)}if(y.inputType==="deleteContentBackward"&&v?.isCollapsed&&!E){T.length===1&&(x&&d(x).length===1&&h(x),t.setAttribute("em-edit","active"),a(!0));const R=()=>{S(y)&&a(!0)};if(T.nodeType!==Node.TEXT_NODE&&!i(_))return R();const O=_.startOffset;if(O===0&&!i(_))return R();const q=T.parentNode;if(!q)return R();const ee=Array.prototype.indexOf.call(q.childNodes,T);if(q.childNodes[ee-1]?.nodeType===Node.COMMENT_NODE){y.preventDefault(),T.deleteData(O-1,1);const de=document.createRange();de.setStart(T,O-1),de.collapse(!0),v.removeAllRanges(),v.addRange(de),a(!0);return}g&&s(g)&&(y.preventDefault(),y.stopImmediatePropagation())}if(y.inputType==="insertText"&&!v?.isCollapsed){y.preventDefault();let R=y.data||"";const O=v.anchorNode;i(_)&&(O.tagName==="A"||O?.parentNode&&O.parentNode.tagName==="A")&&(R=" "+y.data),_.deleteContents();const q=document.createTextNode(R||" ");_.insertNode(q),_.setStartAfter(q),_.collapse(!0),v.removeAllRanges(),v.addRange(_),lm(q,q,Uf),a(!0);return}if(OW.test(y.inputType)){const R=zW(y,v.getRangeAt(0));if(!R||(y.preventDefault(),AD(g,R))||(v.removeAllRanges(),v.addRange(R),L(g,R)))return;const O=jc(g,d);NC(Mh(y),()=>{CC("delete"),u(g)&&C(g,O)}),a();return}const N=y.inputType==="deleteContentForward",D=()=>LW(g)?_.collapsed&&!m(g,_,N)&&HW(g,d):o(g)&&!(N&&m(g,_,!0));if(y.inputType.includes("deleteContent")&&(Array.from(n(g,c).replace(xW,"")).length<2||b===E)&&!g.querySelector(Uc)&&D()){y.preventDefault(),p(g,_),a(!0);return}if(y.inputType==="insertText"&&y.data&&yC(v,y.data)){y.preventDefault(),y.stopImmediatePropagation(),a(!0);return}if(y.inputType==="deleteContentBackward"&&!v.isCollapsed&&!E&&g&&s(g)&&(y.preventDefault(),y.stopImmediatePropagation()),S(y)){a(!0);return}a()}}var Uc="em-replace, img, picture, video, audio, svg, canvas, iframe, object, hr, input, button",kW="div, p, ul, ol, table, h1, h2, h3, h4, h5, h6, blockquote, center, pre";function LW(e){return!e.hasAttribute("em-inline")&&!!e.querySelector("div, p, ul, ol, table, h1, h2, h3, h4, h5, h6, blockquote, center, pre")}var gC=`${kW}, td, th`,NW="br, ul, ol, li, pre",xW=/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g,bC=`${Uc}, table`,OW=/^delete(Word|SoftLine|HardLine)/;function yC(e,t){const n=e.anchorNode,r=n;if(r?.tagName==="A"&&!r.textContent?.trim().length){r.insertAdjacentText("beforeend",t);const o=document.createRange();return o.selectNodeContents(r),o.collapse(!1),e.removeAllRanges(),e.addRange(o),!0}if(n?.parentNode?.tagName==="A"||r?.tagName==="A"){const o=e.getRangeAt(0),i=document.createTextNode(t);return o.insertNode(i),o.setStartAfter(i),o.collapse(!0),e.removeAllRanges(),e.addRange(o),lm(i,i,Uf),!0}return!1}function vC(e,t){return e.replace(/\s+/g," ")===t.replace(/\s+/g," ")}function RW(e){return[EC(e,"previousSibling"),EC(e,"nextSibling")].some(t=>t?.nodeType===Node.TEXT_NODE?!0:!!t&&we(t)&&/^(EM-REPLACE|A|IMG|SUB|SUP|SPAN|B|STRONG|I|EM|U|S|FONT)$/.test(t.tagName))}var MW=/^(A|SPAN|B|STRONG|I|EM|U|S|STRIKE|FONT|SUB|SUP|SMALL|BIG|MARK)$/;function PW(e){return e.parentElement!==null&&MW.test(e.parentElement.tagName)}function EC(e,t){let n=e[t];for(;n?.nodeType===Node.TEXT_NODE&&!n.textContent?.trim();)n=n[t];return n}var IW=/^(AREA|BASE|BR|COL|EMBED|HR|IMG|INPUT|LINK|META|SOURCE|TRACK|WBR)$/,SC=/^(SPAN|B|STRONG|I|EM|U|S|STRIKE|FONT|SMALL|BIG|MARK)$/,DW={TABLE:["THEAD","TBODY","TFOOT","TR"],THEAD:["TR"],TBODY:["TR"],TFOOT:["TR"],TR:["TD","TH"]};function jc(e,t){const n=t(e),r=[];for(let o=wC(e,n,t);o;o=BW(o,n,t))r.push(o);return r}function wC(e,t,n){const r=_C(e,n);if(!(!r||IW.test(r.tagName)||r.tagName!=="TABLE"&&r.matches(bC)))return!(r.tagName==="A"||SC.test(r.tagName))||n(r)===t?r:void 0}function BW(e,t,n){const r=DW[e.tagName];if(r)return Array.from(e.children).find(i=>r.includes(i.tagName));if(e.tagName==="TD"||e.tagName==="TH")return wC(e,t,n);const o=_C(e,n);return o&&SC.test(o.tagName)&&n(o)===t?o:void 0}function _C(e,t){for(const n of Array.from(e.childNodes))if(!(xt(n)&&!t(n))){if(n.nodeType===Node.ELEMENT_NODE)return n;if(t(n))return}}function HW(e,t){if(e.querySelector(NW))return!1;const n=jc(e,t),r=[...n].reverse().find(o=>o.matches(gC));return r!==void 0&&t(r)===t(e)&&Array.from(e.querySelectorAll("*")).every(o=>n.some(i=>i===o)||r.contains(o)&&!o.matches(gC))}function FW(e){const t=e.cloneNode(!1);return t.removeAttribute("em-edit"),t}function $W(e){const t=e.cloneNode(!1);return t.removeAttribute("innerStyle"),t.removeAttribute("innerClass"),t}var WW=e=>G(e)??e;function qW(e){const[t]=e.getTargetRanges();if(!t||t.collapsed)return;const n=document.createRange();return n.setStart(t.startContainer,t.startOffset),n.setEnd(t.endContainer,t.endOffset),n}function zW(e,t){const n=Zf(t,e.inputType.endsWith("Backward")?"backward":"forward");if(!n)return qW(e);const r=document.createRange();return r.selectNode(n),r}var UW={deleteContentBackward:"delete",deleteContentForward:"forwardDelete",deleteByCut:"delete",deleteContent:"delete",insertText:"insertText",insertReplacementText:"insertText",formatBold:"bold",formatItalic:"italic",formatUnderline:"underline",formatStrikeThrough:"strikeThrough",formatSuperscript:"superscript",formatSubscript:"subscript",formatJustifyLeft:"justifyLeft",formatJustifyCenter:"justifyCenter",formatJustifyRight:"justifyRight",formatJustifyFull:"justifyFull",formatRemove:"removeFormat"},jW=["insertText"],Rh=!1;function CC(e,t){Rh=!0;try{ur(e,!1,t)}finally{Rh=!1}}function VW(e){const t=e.dataTransfer?.getData("text/plain")||e.data||void 0,n=e.getTargetRanges?.()[0],r=window.getSelection();if(!t||!n||!r)return;const o=document.createRange();return o.setStart(n.startContainer,n.startOffset),o.setEnd(n.endContainer,n.endOffset),r.removeAllRanges(),r.addRange(o),t}function TC(e){const t=UW[e.inputType];if(!t||e.defaultPrevented||e.isComposing||Rh)return!1;const n=e.inputType==="insertReplacementText"?VW(e):e.data??void 0;return jW.includes(t)&&!n?!1:(e.preventDefault(),CC(t,n),!0)}function Mh(e){return e.currentTarget??e.target}var Vc={sibling:"nextSibling",child:"firstChild"},AC={sibling:"previousSibling",child:"lastChild"},kC=/[^ \t\r\n\f]/,GW=`br, ${Uc}`;function XW(e){return e.nodeType===Node.ELEMENT_NODE&&getComputedStyle(e).display==="none"}function Gc(e,t,n){for(let r=e;r&&r!==t;r=r.parentNode){const o=r[n.sibling];if(o)return o}return null}function KW(e,t,n,r){if(e.nodeType===Node.TEXT_NODE){const o=e.data;return kC.test(r===Vc?o.slice(t):o.slice(0,t))?null:Gc(e,n,r)}return e.nodeType!==Node.ELEMENT_NODE?Gc(e,n,r):e.childNodes[r===Vc?t:t-1]??(e===n?null:Gc(e,n,r))}function YW(e,t,n){const r=[];let o=e;for(;o;){if(o.nodeType===Node.COMMENT_NODE||XW(o))r.push(o);else{if(o.nodeType===Node.TEXT_NODE?kC.test(o.data):o.matches?.(GW))break;if(o[n.child]){o=o[n.child];continue}}o=Gc(o,t,n)}return r}function LC(e,t){const{startContainer:n,startOffset:r,endContainer:o,endOffset:i}=t,s=(c,u,d)=>YW(KW(c,u,e,d),e,d),a=new Map,l=[[s(n,r,AC),!0],[s(o,i,Vc),!1],[s(n,r,Vc),!0],[s(o,i,AC),!1]];for(const[c,u]of l)c.filter(d=>!a.has(d)).forEach(d=>a.set(d,u));return[...a].sort(([c],[u])=>c.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1).map(([c,u])=>({node:c,before:u,previous:c.previousSibling,next:c.nextSibling}))}function ZW(e,{node:t,previous:n,next:r,before:o}){const i=a=>!!a&&a!==e&&e.contains(a),s=(o?[n,r]:[r,n]).find(i);return s?(s===n?s.after(t):s.before(t),o&&QW(t),!0):!1}function QW(e){const t=window.getSelection(),n=t?.rangeCount?t.getRangeAt(0):void 0,r=e.parentNode;n?.collapsed&&r&&n.startContainer===r&&r.childNodes[n.startOffset]===e&&(n.setStartAfter(e),n.collapse(!0))}function JW(e,t,n){const r=window.getSelection(),o=r?.rangeCount?r.getRangeAt(0):void 0;if(!r||!o||!e.contains(o.startContainer)){e.prepend(...t),e.append(...n);return}const i=o.cloneRange();i.collapse(!0);for(const a of[...t,...n].reverse())i.insertNode(a);const s=document.createRange();t.length?s.setStartAfter(t[t.length-1]):s.setStartBefore(n[0]),s.collapse(!0),r.removeAllRanges(),r.addRange(s)}function eq(e,t){const n=t.filter(({node:o})=>!e.contains(o)),r=new Set;for(const o of[...n.filter(({before:i})=>i),...n.filter(({before:i})=>!i).reverse()])ZW(e,o)||r.add(o);if(r.size){const o=i=>n.filter(s=>r.has(s)&&s.before===i).map(({node:s})=>s);JW(e,o(!0),o(!1))}}function NC(e,t){const n=window.getSelection(),r=n?.rangeCount?LC(e,n.getRangeAt(0)):[],o=t();return eq(e,r),o}function tq(e){return function(n,r){if(!n)return;n.querySelectorAll("editor")?.forEach(a=>{a.onclick=null,a.onkeyup=null,a.onmousedown=null});const o=nq(n);if(Ic(n),document.querySelectorAll(":not(.em-element-path) .em-element-path").forEach(a=>a.remove()),pC(n),H5(n,r)){n.append(...o);return}mS(n,Ne);const i=document.createElement("editor");if(_W(i),i.classList.add("em-text"),i.setAttribute("contenteditable","true"),r)rq(n)&&i.setAttribute(pD,""),n.before(i),i.replaceChildren(n),gE(i);else{const a=[...n.childNodes];n.appendChild(i),i.replaceChildren(...a)}n.append(...o);const s=i.parentElement;if(s&&!s.style.fontFamily&&!s.style.fontSize&&i.firstElementChild){const a=i.firstElementChild,l=a.getAttribute("style"),c=a.getAttribute("class"),u=a.getAttribute("href"),d=a.getAttribute("target"),f=a.getAttribute("align");l&&i.setAttribute("innerStyle",l),c&&i.setAttribute("innerClass",c),u!==null&&i.setAttribute("innerHref",u),d&&i.setAttribute("innerTarget",d),f&&i.setAttribute("innerAlign",f)}i.addEventListener("input",ht(()=>e.commit(!0)),!0),i.addEventListener("beforeinput",AW({element:n,getVisibleText:fS,mapFn:P5,setCursorToElement:D5,hasOnlyTextNodesDeep:uS,isRangeCoveringAllVisibleText:OD,isEditorContentOnlyNbsp:xD,commit:e.commit,pasteFragment:a=>{const l=c=>Oh({target:c.target},u=>e.commit(u));Zl(a,!1,V.get("commonStyles"),l,e.commit)}}))}}function nq(e){const t=[...e.children].filter(n=>M_.isServicePanel(n)&&!xt(n));return t.forEach(n=>n.remove()),t}function rq(e){const{display:t,cssFloat:n}=getComputedStyle(e);return t.startsWith("inline")||!!n&&n!=="none"}function oq({commit:e,htmlDocument:t,documentMapping:n}){const r=tq({commit:e});return{now:r,deferred:(i,s)=>{const a=t.getRangeByElement(i,!0);a&&n.hasMappedReplacementRangeInRange(a)||hD(()=>r(i,s),"editor")}}}var xC=e=>t=>t.some(n=>e(n).some(iq)),iq=e=>e instanceof Element&&(e.hasAttribute("em-edit")||e.querySelector("[em-edit]")),sq=xC(({removed:e})=>e),aq=xC(({added:e})=>e),lq=e=>t=>{sq(t)&&!aq(t)&&setTimeout(()=>{if(typeof document<"u"&&document.querySelector("[em-edit]"))return;const n=typeof document<"u"?document.querySelector('table[em-type="social"]'):null;if(n?.isConnected){xr("em-edit"),n.setAttribute("em-edit","active"),e({elem:n});return}e({elem:null})},0)},cq=200;function uq(e){let t=!1;return()=>{if(t)return;t=!0;let n;const r=()=>{t&&(t=!1,clearTimeout(n),e())};n=setTimeout(r,cq),window.requestAnimationFrame(()=>setTimeout(r,0))}}var Ve={drag:"em-icon-drag",moveUp:"em-icon-move-up",moveDown:"em-icon-move-down",merge:"em-icon-merge",unmerge:"em-icon-unmerge",add:"em-icon-add"},Oe="em-icon";function dq(e,t,n){return(t=pq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fr(){return fr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fr.apply(null,arguments)}function OC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function zn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?OC(Object(n),!0).forEach(function(r){dq(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function fq(e,t){if(e==null)return{};var n,r,o=mq(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function mq(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function hq(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pq(e){var t=hq(e,"string");return typeof t=="symbol"?t:t+""}function Ph(e){"@babel/helpers - typeof";return Ph=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ph(e)}var gq="1.15.7";function mr(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var hr=mr(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),oa=mr(/Edge/i),RC=mr(/firefox/i),ia=mr(/safari/i)&&!mr(/chrome/i)&&!mr(/android/i),Ih=mr(/iP(ad|od|hone)/i),MC=mr(/chrome/i)&&mr(/android/i),PC={capture:!1,passive:!1};function be(e,t,n){e.addEventListener(t,n,!hr&&PC)}function pe(e,t,n){e.removeEventListener(t,n,!hr&&PC)}function Xc(e,t){if(t){if(t[0]===">"&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch{return!1}return!1}}function IC(e){return e.host&&e!==document&&e.host.nodeType&&e.host!==e?e.host:e.parentNode}function Tn(e,t,n,r){if(e){n=n||document;do{if(t!=null&&(t[0]===">"?e.parentNode===n&&Xc(e,t):Xc(e,t))||r&&e===n)return e;if(e===n)break}while(e=IC(e))}return null}var DC=/\s+/g;function Yt(e,t,n){e&&t&&(e.classList?e.classList[n?"add":"remove"](t):e.className=((" "+e.className+" ").replace(DC," ").replace(" "+t+" "," ")+(n?" "+t:"")).replace(DC," "))}function ne(e,t,n){var r=e&&e.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),t===void 0?n:n[t];!(t in r)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),r[t]=n+(typeof n=="string"?"":"px")}}function _i(e,t){var n="";if(typeof e=="string")n=e;else do{var r=ne(e,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function BC(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o<i;o++)n(r[o],o);return r}return[]}function Un(){var e=document.scrollingElement;return e||document.documentElement}function tt(e,t,n,r,o){if(!(!e.getBoundingClientRect&&e!==window)){var i,s,a,l,c,u,d;if(e!==window&&e.parentNode&&e!==Un()?(i=e.getBoundingClientRect(),s=i.top,a=i.left,l=i.bottom,c=i.right,u=i.height,d=i.width):(s=0,a=0,l=window.innerHeight,c=window.innerWidth,u=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(o=o||e.parentNode,!hr))do if(o&&o.getBoundingClientRect&&(ne(o,"transform")!=="none"||n&&ne(o,"position")!=="static")){var f=o.getBoundingClientRect();s-=f.top+parseInt(ne(o,"border-top-width")),a-=f.left+parseInt(ne(o,"border-left-width")),l=s+i.height,c=a+i.width;break}while(o=o.parentNode);if(r&&e!==window){var h=_i(o||e),m=h&&h.a,p=h&&h.d;h&&(s/=p,a/=m,d/=m,u/=p,l=s+u,c=a+d)}return{top:s,left:a,bottom:l,right:c,width:d,height:u}}}function HC(e,t,n){for(var r=$r(e,!0),o=tt(e)[t];r;){var i=tt(r)[n],s=void 0;if(n==="top"||n==="left"?s=o>=i:s=o<=i,!s)return r;if(r===Un())break;r=$r(r,!1)}return!1}function Ci(e,t,n,r){for(var o=0,i=0,s=e.children;i<s.length;){if(s[i].style.display!=="none"&&s[i]!==K.ghost&&(r||s[i]!==K.dragged)&&Tn(s[i],n.draggable,e,!1)){if(o===t)return s[i];o++}i++}return null}function Dh(e,t){for(var n=e.lastElementChild;n&&(n===K.ghost||ne(n,"display")==="none"||t&&!Xc(n,t));)n=n.previousElementSibling;return n||null}function an(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==K.clone&&(!t||Xc(e,t))&&n++;return n}function FC(e){var t=0,n=0,r=Un();if(e)do{var o=_i(e),i=o.a,s=o.d;t+=e.scrollLeft*i,n+=e.scrollTop*s}while(e!==r&&(e=e.parentNode));return[t,n]}function bq(e,t){for(var n in e)if(e.hasOwnProperty(n)){for(var r in t)if(t.hasOwnProperty(r)&&t[r]===e[n][r])return Number(n)}return-1}function $r(e,t){if(!e||!e.getBoundingClientRect)return Un();var n=e,r=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=ne(n);if(n.clientWidth<n.scrollWidth&&(o.overflowX=="auto"||o.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(o.overflowY=="auto"||o.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return Un();if(r||t)return n;r=!0}}while(n=n.parentNode);return Un()}function yq(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function Bh(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}var sa;function $C(e,t){return function(){if(!sa){var n=arguments,r=this;n.length===1?e.call(r,n[0]):e.apply(r,n),sa=setTimeout(function(){sa=void 0},t)}}}function vq(){clearTimeout(sa),sa=void 0}function WC(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function qC(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}function zC(e,t,n){var r={};return Array.from(e.children).forEach(function(o){var i,s,a,l;if(!(!Tn(o,t.draggable,e,!1)||o.animated||o===n)){var c=tt(o);r.left=Math.min((i=r.left)!==null&&i!==void 0?i:1/0,c.left),r.top=Math.min((s=r.top)!==null&&s!==void 0?s:1/0,c.top),r.right=Math.max((a=r.right)!==null&&a!==void 0?a:-1/0,c.right),r.bottom=Math.max((l=r.bottom)!==null&&l!==void 0?l:-1/0,c.bottom)}}),r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}var Ft="Sortable"+new Date().getTime();function Eq(){var e=[],t;return{captureAnimationState:function(){e=[],this.options.animation&&[].slice.call(this.el.children).forEach(function(r){if(!(ne(r,"display")==="none"||r===K.ghost)){e.push({target:r,rect:tt(r)});var o=zn({},e[e.length-1].rect);if(r.thisAnimationDuration){var i=_i(r,!0);i&&(o.top-=i.f,o.left-=i.e)}r.fromRect=o}})},addAnimationState:function(r){e.push(r)},removeAnimationState:function(r){e.splice(bq(e,{target:r}),1)},animateAll:function(r){var o=this;if(!this.options.animation){clearTimeout(t),typeof r=="function"&&r();return}var i=!1,s=0;e.forEach(function(a){var l=0,c=a.target,u=c.fromRect,d=tt(c),f=c.prevFromRect,h=c.prevToRect,m=a.rect,p=_i(c,!0);p&&(d.top-=p.f,d.left-=p.e),c.toRect=d,c.thisAnimationDuration&&Bh(f,d)&&!Bh(u,d)&&(m.top-d.top)/(m.left-d.left)===(u.top-d.top)/(u.left-d.left)&&(l=wq(m,f,h,o.options)),Bh(d,u)||(c.prevFromRect=u,c.prevToRect=d,l||(l=o.options.animation),o.animate(c,m,d,l)),l&&(i=!0,s=Math.max(s,l),clearTimeout(c.animationResetTimer),c.animationResetTimer=setTimeout(function(){c.animationTime=0,c.prevFromRect=null,c.fromRect=null,c.prevToRect=null,c.thisAnimationDuration=null},l),c.thisAnimationDuration=l)}),clearTimeout(t),i?t=setTimeout(function(){typeof r=="function"&&r()},s):typeof r=="function"&&r(),e=[]},animate:function(r,o,i,s){if(s){ne(r,"transition",""),ne(r,"transform","");var a=_i(this.el),l=a&&a.a,c=a&&a.d,u=(o.left-i.left)/(l||1),d=(o.top-i.top)/(c||1);r.animatingX=!!u,r.animatingY=!!d,ne(r,"transform","translate3d("+u+"px,"+d+"px,0)"),this.forRepaintDummy=Sq(r),ne(r,"transition","transform "+s+"ms"+(this.options.easing?" "+this.options.easing:"")),ne(r,"transform","translate3d(0,0,0)"),typeof r.animated=="number"&&clearTimeout(r.animated),r.animated=setTimeout(function(){ne(r,"transition",""),ne(r,"transform",""),r.animated=!1,r.animatingX=!1,r.animatingY=!1},s)}}}}function Sq(e){return e.offsetWidth}function wq(e,t,n,r){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*r.animation}var Ti=[],Hh={initializeByDefault:!0},aa={mount:function(t){for(var n in Hh)Hh.hasOwnProperty(n)&&!(n in t)&&(t[n]=Hh[n]);Ti.forEach(function(r){if(r.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),Ti.push(t)},pluginEvent:function(t,n,r){var o=this;this.eventCanceled=!1,r.cancel=function(){o.eventCanceled=!0};var i=t+"Global";Ti.forEach(function(s){n[s.pluginName]&&(n[s.pluginName][i]&&n[s.pluginName][i](zn({sortable:n},r)),n.options[s.pluginName]&&n[s.pluginName][t]&&n[s.pluginName][t](zn({sortable:n},r)))})},initializePlugins:function(t,n,r,o){Ti.forEach(function(a){var l=a.pluginName;if(!(!t.options[l]&&!a.initializeByDefault)){var c=new a(t,n,t.options);c.sortable=t,c.options=t.options,t[l]=c,fr(r,c.defaults)}});for(var i in t.options)if(t.options.hasOwnProperty(i)){var s=this.modifyOption(t,i,t.options[i]);typeof s<"u"&&(t.options[i]=s)}},getEventProperties:function(t,n){var r={};return Ti.forEach(function(o){typeof o.eventProperties=="function"&&fr(r,o.eventProperties.call(n[o.pluginName],t))}),r},modifyOption:function(t,n,r){var o;return Ti.forEach(function(i){t[i.pluginName]&&i.optionListeners&&typeof i.optionListeners[n]=="function"&&(o=i.optionListeners[n].call(t[i.pluginName],r))}),o}};function _q(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,s=e.toEl,a=e.fromEl,l=e.oldIndex,c=e.newIndex,u=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,m=e.extraEventProperties;if(t=t||n&&n[Ft],!!t){var p,S=t.options,C="on"+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!hr&&!oa?p=new CustomEvent(r,{bubbles:!0,cancelable:!0}):(p=document.createEvent("Event"),p.initEvent(r,!0,!0)),p.to=s||n,p.from=a||n,p.item=o||n,p.clone=i,p.oldIndex=l,p.newIndex=c,p.oldDraggableIndex=u,p.newDraggableIndex=d,p.originalEvent=f,p.pullMode=h?h.lastPutMode:void 0;var L=zn(zn({},m),aa.getEventProperties(r,t));for(var k in L)p[k]=L[k];n&&n.dispatchEvent(p),S[C]&&S[C].call(t,p)}}var Cq=["evt"],$t=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=r.evt,i=fq(r,Cq);aa.pluginEvent.bind(K)(t,n,zn({dragEl:H,parentEl:Ge,ghostEl:le,rootEl:$e,nextEl:_o,lastDownEl:Kc,cloneEl:ze,cloneHidden:Wr,dragStarted:ca,putSortable:bt,activeSortable:K.active,originalEvent:o,oldIndex:Ai,oldDraggableIndex:la,newIndex:Zt,newDraggableIndex:qr,hideGhostForTarget:YC,unhideGhostForTarget:ZC,cloneNowHidden:function(){Wr=!0},cloneNowShown:function(){Wr=!1},dispatchSortableEvent:function(a){Ot({sortable:n,name:a,originalEvent:o})}},i))};function Ot(e){_q(zn({putSortable:bt,cloneEl:ze,targetEl:H,rootEl:$e,oldIndex:Ai,oldDraggableIndex:la,newIndex:Zt,newDraggableIndex:qr},e))}var H,Ge,le,$e,_o,Kc,ze,Wr,Ai,Zt,la,qr,Yc,bt,ki=!1,Zc=!1,Qc=[],Co,An,Fh,$h,UC,jC,ca,Li,ua,da=!1,Jc=!1,eu,wt,Wh=[],qh=!1,tu=[],nu=typeof document<"u",ru=Ih,VC=oa||hr?"cssFloat":"float",Tq=nu&&!MC&&!Ih&&"draggable"in document.createElement("div"),GC=(function(){if(nu){if(hr)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}})(),XC=function(t,n){var r=ne(t),o=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),i=Ci(t,0,n),s=Ci(t,1,n),a=i&&ne(i),l=s&&ne(s),c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+tt(i).width,u=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+tt(s).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&a.float&&a.float!=="none"){var d=a.float==="left"?"left":"right";return s&&(l.clear==="both"||l.clear===d)?"vertical":"horizontal"}return i&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||c>=o&&r[VC]==="none"||s&&r[VC]==="none"&&c+u>o)?"vertical":"horizontal"},Aq=function(t,n,r){var o=r?t.left:t.top,i=r?t.right:t.bottom,s=r?t.width:t.height,a=r?n.left:n.top,l=r?n.right:n.bottom,c=r?n.width:n.height;return o===a||i===l||o+s/2===a+c/2},kq=function(t,n){var r;return Qc.some(function(o){var i=o[Ft].options.emptyInsertThreshold;if(!(!i||Dh(o))){var s=tt(o),a=t>=s.left-i&&t<=s.right+i,l=n>=s.top-i&&n<=s.bottom+i;if(a&&l)return r=o}}),r},KC=function(t){function n(i,s){return function(a,l,c,u){var d=a.options.group.name&&l.options.group.name&&a.options.group.name===l.options.group.name;if(i==null&&(s||d))return!0;if(i==null||i===!1)return!1;if(s&&i==="clone")return i;if(typeof i=="function")return n(i(a,l,c,u),s)(a,l,c,u);var f=(s?a:l).options.group.name;return i===!0||typeof i=="string"&&i===f||i.join&&i.indexOf(f)>-1}}var r={},o=t.group;(!o||Ph(o)!="object")&&(o={name:o}),r.name=o.name,r.checkPull=n(o.pull,!0),r.checkPut=n(o.put),r.revertClone=o.revertClone,t.group=r},YC=function(){!GC&&le&&ne(le,"display","none")},ZC=function(){!GC&&le&&ne(le,"display","")};nu&&!MC&&document.addEventListener("click",function(e){if(Zc)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Zc=!1,!1},!0);var To=function(t){if(H){t=t.touches?t.touches[0]:t;var n=kq(t.clientX,t.clientY);if(n){var r={};for(var o in t)t.hasOwnProperty(o)&&(r[o]=t[o]);r.target=r.rootEl=n,r.preventDefault=void 0,r.stopPropagation=void 0,n[Ft]._onDragOver(r)}}},Lq=function(t){H&&H.parentNode[Ft]._isOutsideThisEl(t.target)};function K(e,t){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=fr({},t),e[Ft]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return XC(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(s,a){s.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:K.supportPointer!==!1&&"PointerEvent"in window&&(!ia||Ih),emptyInsertThreshold:5};aa.initializePlugins(this,e,n);for(var r in n)!(r in t)&&(t[r]=n[r]);KC(t);for(var o in this)o.charAt(0)==="_"&&typeof this[o]=="function"&&(this[o]=this[o].bind(this));this.nativeDraggable=t.forceFallback?!1:Tq,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?be(e,"pointerdown",this._onTapStart):(be(e,"mousedown",this._onTapStart),be(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(be(e,"dragover",this),be(e,"dragenter",this)),Qc.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),fr(this,Eq())}K.prototype={constructor:K,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(Li=null)},_getDirection:function(t,n){return typeof this.options.direction=="function"?this.options.direction.call(this,t,n,H):this.options.direction},_onTapStart:function(t){if(t.cancelable){var n=this,r=this.el,o=this.options,i=o.preventOnFilter,s=t.type,a=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,l=(a||t).target,c=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,u=o.filter;if(Dq(r),!H&&!(/mousedown|pointerdown/.test(s)&&t.button!==0||o.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&ia&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=Tn(l,o.draggable,r,!1),!(l&&l.animated)&&Kc!==l)){if(Ai=an(l),la=an(l,o.draggable),typeof u=="function"){if(u.call(this,t,l,this)){Ot({sortable:n,rootEl:c,name:"filter",targetEl:l,toEl:r,fromEl:r}),$t("filter",n,{evt:t}),i&&t.preventDefault();return}}else if(u&&(u=u.split(",").some(function(d){if(d=Tn(c,d.trim(),r,!1),d)return Ot({sortable:n,rootEl:d,name:"filter",targetEl:l,fromEl:r,toEl:r}),$t("filter",n,{evt:t}),!0}),u)){i&&t.preventDefault();return}o.handle&&!Tn(c,o.handle,r,!1)||this._prepareDragStart(t,a,l)}}},_prepareDragStart:function(t,n,r){var o=this,i=o.el,s=o.options,a=i.ownerDocument,l;if(r&&!H&&r.parentNode===i){var c=tt(r);if($e=i,H=r,Ge=H.parentNode,_o=H.nextSibling,Kc=r,Yc=s.group,K.dragged=H,Co={target:H,clientX:(n||t).clientX,clientY:(n||t).clientY},UC=Co.clientX-c.left,jC=Co.clientY-c.top,this._lastX=(n||t).clientX,this._lastY=(n||t).clientY,H.style["will-change"]="all",l=function(){if($t("delayEnded",o,{evt:t}),K.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!RC&&o.nativeDraggable&&(H.draggable=!0),o._triggerDragStart(t,n),Ot({sortable:o,name:"choose",originalEvent:t}),Yt(H,s.chosenClass,!0)},s.ignore.split(",").forEach(function(u){BC(H,u.trim(),zh)}),be(a,"dragover",To),be(a,"mousemove",To),be(a,"touchmove",To),s.supportPointer?(be(a,"pointerup",o._onDrop),!this.nativeDraggable&&be(a,"pointercancel",o._onDrop)):(be(a,"mouseup",o._onDrop),be(a,"touchend",o._onDrop),be(a,"touchcancel",o._onDrop)),RC&&this.nativeDraggable&&(this.options.touchStartThreshold=4,H.draggable=!0),$t("delayStart",this,{evt:t}),s.delay&&(!s.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(oa||hr))){if(K.eventCanceled){this._onDrop();return}s.supportPointer?(be(a,"pointerup",o._disableDelayedDrag),be(a,"pointercancel",o._disableDelayedDrag)):(be(a,"mouseup",o._disableDelayedDrag),be(a,"touchend",o._disableDelayedDrag),be(a,"touchcancel",o._disableDelayedDrag)),be(a,"mousemove",o._delayedDragTouchMoveHandler),be(a,"touchmove",o._delayedDragTouchMoveHandler),s.supportPointer&&be(a,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(l,s.delay)}else l()}},_delayedDragTouchMoveHandler:function(t){var n=t.touches?t.touches[0]:t;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){H&&zh(H),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;pe(t,"mouseup",this._disableDelayedDrag),pe(t,"touchend",this._disableDelayedDrag),pe(t,"touchcancel",this._disableDelayedDrag),pe(t,"pointerup",this._disableDelayedDrag),pe(t,"pointercancel",this._disableDelayedDrag),pe(t,"mousemove",this._delayedDragTouchMoveHandler),pe(t,"touchmove",this._delayedDragTouchMoveHandler),pe(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,n){n=n||t.pointerType=="touch"&&t,!this.nativeDraggable||n?this.options.supportPointer?be(document,"pointermove",this._onTouchMove):n?be(document,"touchmove",this._onTouchMove):be(document,"mousemove",this._onTouchMove):(be(H,"dragend",this),be($e,"dragstart",this._onDragStart));try{document.selection?iu(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,n){if(ki=!1,$e&&H){$t("dragStarted",this,{evt:n}),this.nativeDraggable&&be(document,"dragover",Lq);var r=this.options;!t&&Yt(H,r.dragClass,!1),Yt(H,r.ghostClass,!0),K.active=this,t&&this._appendGhost(),Ot({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(An){this._lastX=An.clientX,this._lastY=An.clientY,YC();for(var t=document.elementFromPoint(An.clientX,An.clientY),n=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(An.clientX,An.clientY),t!==n);)n=t;if(H.parentNode[Ft]._isOutsideThisEl(t),n)do{if(n[Ft]){var r=void 0;if(r=n[Ft]._onDragOver({clientX:An.clientX,clientY:An.clientY,target:t,rootEl:n}),r&&!this.options.dragoverBubble)break}t=n}while(n=IC(n));ZC()}},_onTouchMove:function(t){if(Co){var n=this.options,r=n.fallbackTolerance,o=n.fallbackOffset,i=t.touches?t.touches[0]:t,s=le&&_i(le,!0),a=le&&s&&s.a,l=le&&s&&s.d,c=ru&&wt&&FC(wt),u=(i.clientX-Co.clientX+o.x)/(a||1)+(c?c[0]-Wh[0]:0)/(a||1),d=(i.clientY-Co.clientY+o.y)/(l||1)+(c?c[1]-Wh[1]:0)/(l||1);if(!K.active&&!ki){if(r&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<r)return;this._onDragStart(t,!0)}if(le){s?(s.e+=u-(Fh||0),s.f+=d-($h||0)):s={a:1,b:0,c:0,d:1,e:u,f:d};var f="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");ne(le,"webkitTransform",f),ne(le,"mozTransform",f),ne(le,"msTransform",f),ne(le,"transform",f),Fh=u,$h=d,An=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!le){var t=this.options.fallbackOnBody?document.body:$e,n=tt(H,!0,ru,!0,t),r=this.options;if(ru){for(wt=t;ne(wt,"position")==="static"&&ne(wt,"transform")==="none"&&wt!==document;)wt=wt.parentNode;wt!==document.body&&wt!==document.documentElement?(wt===document&&(wt=Un()),n.top+=wt.scrollTop,n.left+=wt.scrollLeft):wt=Un(),Wh=FC(wt)}le=H.cloneNode(!0),Yt(le,r.ghostClass,!1),Yt(le,r.fallbackClass,!0),Yt(le,r.dragClass,!0),ne(le,"transition",""),ne(le,"transform",""),ne(le,"box-sizing","border-box"),ne(le,"margin",0),ne(le,"top",n.top),ne(le,"left",n.left),ne(le,"width",n.width),ne(le,"height",n.height),ne(le,"opacity","0.8"),ne(le,"position",ru?"absolute":"fixed"),ne(le,"zIndex","100000"),ne(le,"pointerEvents","none"),K.ghost=le,t.appendChild(le),ne(le,"transform-origin",UC/parseInt(le.style.width)*100+"% "+jC/parseInt(le.style.height)*100+"%")}},_onDragStart:function(t,n){var r=this,o=t.dataTransfer,i=r.options;if($t("dragStart",this,{evt:t}),K.eventCanceled){this._onDrop();return}$t("setupClone",this),K.eventCanceled||(ze=qC(H),ze.removeAttribute("id"),ze.draggable=!1,ze.style["will-change"]="",this._hideClone(),Yt(ze,this.options.chosenClass,!1),K.clone=ze),r.cloneId=iu(function(){$t("clone",r),!K.eventCanceled&&(r.options.removeCloneOnHide||$e.insertBefore(ze,H),r._hideClone(),Ot({sortable:r,name:"clone"}))}),!n&&Yt(H,i.dragClass,!0),n?(Zc=!0,r._loopId=setInterval(r._emulateDragOver,50)):(pe(document,"mouseup",r._onDrop),pe(document,"touchend",r._onDrop),pe(document,"touchcancel",r._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(r,o,H)),be(document,"drop",r),ne(H,"transform","translateZ(0)")),ki=!0,r._dragStartId=iu(r._dragStarted.bind(r,n,t)),be(document,"selectstart",r),ca=!0,window.getSelection().removeAllRanges(),ia&&ne(document.body,"user-select","none")},_onDragOver:function(t){var n=this.el,r=t.target,o,i,s,a=this.options,l=a.group,c=K.active,u=Yc===l,d=a.sort,f=bt||c,h,m=this,p=!1;if(qh)return;function S(ee,de){$t(ee,m,zn({evt:t,isOwner:u,axis:h?"vertical":"horizontal",revert:s,dragRect:o,targetRect:i,canSort:d,fromSortable:f,target:r,completed:L,onMove:function(Q,ve){return ou($e,n,H,o,Q,tt(Q),t,ve)},changed:k},de))}function C(){S("dragOverAnimationCapture"),m.captureAnimationState(),m!==f&&f.captureAnimationState()}function L(ee){return S("dragOverCompleted",{insertion:ee}),ee&&(u?c._hideClone():c._showClone(m),m!==f&&(Yt(H,bt?bt.options.ghostClass:c.options.ghostClass,!1),Yt(H,a.ghostClass,!0)),bt!==m&&m!==K.active?bt=m:m===K.active&&bt&&(bt=null),f===m&&(m._ignoreWhileAnimating=r),m.animateAll(function(){S("dragOverAnimationComplete"),m._ignoreWhileAnimating=null}),m!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(r===H&&!H.animated||r===n&&!r.animated)&&(Li=null),!a.dragoverBubble&&!t.rootEl&&r!==document&&(H.parentNode[Ft]._isOutsideThisEl(t.target),!ee&&To(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),p=!0}function k(){Zt=an(H),qr=an(H,a.draggable),Ot({sortable:m,name:"change",toEl:n,newIndex:Zt,newDraggableIndex:qr,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),r=Tn(r,a.draggable,n,!0),S("dragOver"),K.eventCanceled)return p;if(H.contains(t.target)||r.animated&&r.animatingX&&r.animatingY||m._ignoreWhileAnimating===r)return L(!1);if(Zc=!1,c&&!a.disabled&&(u?d||(s=Ge!==$e):bt===this||(this.lastPutMode=Yc.checkPull(this,c,H,t))&&l.checkPut(this,c,H,t))){if(h=this._getDirection(t,r)==="vertical",o=tt(H),S("dragOverValid"),K.eventCanceled)return p;if(s)return Ge=$e,C(),this._hideClone(),S("revert"),K.eventCanceled||(_o?$e.insertBefore(H,_o):$e.appendChild(H)),L(!0);var y=Dh(n,a.draggable);if(!y||Rq(t,h,this)&&!y.animated){if(y===H)return L(!1);if(y&&n===t.target&&(r=y),r&&(i=tt(r)),ou($e,n,H,o,r,i,t,!!r)!==!1)return C(),y&&y.nextSibling?n.insertBefore(H,y.nextSibling):n.appendChild(H),Ge=n,k(),L(!0)}else if(y&&Oq(t,h,this)){var g=Ci(n,0,a,!0);if(g===H)return L(!1);if(r=g,i=tt(r),ou($e,n,H,o,r,i,t,!1)!==!1)return C(),n.insertBefore(H,g),Ge=n,k(),L(!0)}else if(r.parentNode===n){i=tt(r);var v=0,w,b=H.parentNode!==n,E=!Aq(H.animated&&H.toRect||o,r.animated&&r.toRect||i,h),_=h?"top":"left",T=HC(r,"top","top")||HC(H,"top","top"),x=T?T.scrollTop:void 0;Li!==r&&(w=i[_],da=!1,Jc=!E&&a.invertSwap||b),v=Mq(t,r,i,h,E?1:a.swapThreshold,a.invertedSwapThreshold==null?a.swapThreshold:a.invertedSwapThreshold,Jc,Li===r);var N;if(v!==0){var D=an(H);do D-=v,N=Ge.children[D];while(N&&(ne(N,"display")==="none"||N===le))}if(v===0||N===r)return L(!1);Li=r,ua=v;var R=r.nextElementSibling,O=!1;O=v===1;var q=ou($e,n,H,o,r,i,t,O);if(q!==!1)return(q===1||q===-1)&&(O=q===1),qh=!0,setTimeout(xq,30),C(),O&&!R?n.appendChild(H):r.parentNode.insertBefore(H,O?R:r),T&&WC(T,0,x-T.scrollTop),Ge=H.parentNode,w!==void 0&&!Jc&&(eu=Math.abs(w-tt(r)[_])),k(),L(!0)}if(n.contains(H))return L(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){pe(document,"mousemove",this._onTouchMove),pe(document,"touchmove",this._onTouchMove),pe(document,"pointermove",this._onTouchMove),pe(document,"dragover",To),pe(document,"mousemove",To),pe(document,"touchmove",To)},_offUpEvents:function(){var t=this.el.ownerDocument;pe(t,"mouseup",this._onDrop),pe(t,"touchend",this._onDrop),pe(t,"pointerup",this._onDrop),pe(t,"pointercancel",this._onDrop),pe(t,"touchcancel",this._onDrop),pe(document,"selectstart",this)},_onDrop:function(t){var n=this.el,r=this.options;if(Zt=an(H),qr=an(H,r.draggable),$t("drop",this,{evt:t}),Ge=H&&H.parentNode,Zt=an(H),qr=an(H,r.draggable),K.eventCanceled){this._nulling();return}ki=!1,Jc=!1,da=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Uh(this.cloneId),Uh(this._dragStartId),this.nativeDraggable&&(pe(document,"drop",this),pe(n,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ia&&ne(document.body,"user-select",""),ne(H,"transform",""),t&&(ca&&(t.cancelable&&t.preventDefault(),!r.dropBubble&&t.stopPropagation()),le&&le.parentNode&&le.parentNode.removeChild(le),($e===Ge||bt&&bt.lastPutMode!=="clone")&&ze&&ze.parentNode&&ze.parentNode.removeChild(ze),H&&(this.nativeDraggable&&pe(H,"dragend",this),zh(H),H.style["will-change"]="",ca&&!ki&&Yt(H,bt?bt.options.ghostClass:this.options.ghostClass,!1),Yt(H,this.options.chosenClass,!1),Ot({sortable:this,name:"unchoose",toEl:Ge,newIndex:null,newDraggableIndex:null,originalEvent:t}),$e!==Ge?(Zt>=0&&(Ot({rootEl:Ge,name:"add",toEl:Ge,fromEl:$e,originalEvent:t}),Ot({sortable:this,name:"remove",toEl:Ge,originalEvent:t}),Ot({rootEl:Ge,name:"sort",toEl:Ge,fromEl:$e,originalEvent:t}),Ot({sortable:this,name:"sort",toEl:Ge,originalEvent:t})),bt&&bt.save()):Zt!==Ai&&Zt>=0&&(Ot({sortable:this,name:"update",toEl:Ge,originalEvent:t}),Ot({sortable:this,name:"sort",toEl:Ge,originalEvent:t})),K.active&&((Zt==null||Zt===-1)&&(Zt=Ai,qr=la),Ot({sortable:this,name:"end",toEl:Ge,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){$t("nulling",this),$e=H=Ge=le=_o=ze=Kc=Wr=Co=An=ca=Zt=qr=Ai=la=Li=ua=bt=Yc=K.dragged=K.ghost=K.clone=K.active=null;var t=this.el;tu.forEach(function(n){t.contains(n)&&(n.checked=!0)}),tu.length=Fh=$h=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":H&&(this._onDragOver(t),Nq(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t=[],n,r=this.el.children,o=0,i=r.length,s=this.options;o<i;o++)n=r[o],Tn(n,s.draggable,this.el,!1)&&t.push(n.getAttribute(s.dataIdAttr)||Iq(n));return t},sort:function(t,n){var r={},o=this.el;this.toArray().forEach(function(i,s){var a=o.children[s];Tn(a,this.options.draggable,o,!1)&&(r[i]=a)},this),n&&this.captureAnimationState(),t.forEach(function(i){r[i]&&(o.removeChild(r[i]),o.appendChild(r[i]))}),n&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,n){return Tn(t,n||this.options.draggable,this.el,!1)},option:function(t,n){var r=this.options;if(n===void 0)return r[t];var o=aa.modifyOption(this,t,n);typeof o<"u"?r[t]=o:r[t]=n,t==="group"&&KC(r)},destroy:function(){$t("destroy",this);var t=this.el;t[Ft]=null,pe(t,"mousedown",this._onTapStart),pe(t,"touchstart",this._onTapStart),pe(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(pe(t,"dragover",this),pe(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(n){n.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Qc.splice(Qc.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!Wr){if($t("hideClone",this),K.eventCanceled)return;ne(ze,"display","none"),this.options.removeCloneOnHide&&ze.parentNode&&ze.parentNode.removeChild(ze),Wr=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(Wr){if($t("showClone",this),K.eventCanceled)return;H.parentNode==$e&&!this.options.group.revertClone?$e.insertBefore(ze,H):_o?$e.insertBefore(ze,_o):$e.appendChild(ze),this.options.group.revertClone&&this.animate(H,ze),ne(ze,"display",""),Wr=!1}}};function Nq(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}function ou(e,t,n,r,o,i,s,a){var l,c=e[Ft],u=c.options.onMove,d;return window.CustomEvent&&!hr&&!oa?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=t,l.from=e,l.dragged=n,l.draggedRect=r,l.related=o||t,l.relatedRect=i||tt(t),l.willInsertAfter=a,l.originalEvent=s,e.dispatchEvent(l),u&&(d=u.call(c,l,s)),d}function zh(e){e.draggable=!1}function xq(){qh=!1}function Oq(e,t,n){var r=tt(Ci(n.el,0,n.options,!0)),o=zC(n.el,n.options,le),i=10;return t?e.clientX<o.left-i||e.clientY<r.top&&e.clientX<r.right:e.clientY<o.top-i||e.clientY<r.bottom&&e.clientX<r.left}function Rq(e,t,n){var r=tt(Dh(n.el,n.options.draggable)),o=zC(n.el,n.options,le),i=10;return t?e.clientX>o.right+i||e.clientY>r.bottom&&e.clientX>r.left:e.clientY>o.bottom+i||e.clientX>r.right&&e.clientY>r.top}function Mq(e,t,n,r,o,i,s,a){var l=r?e.clientY:e.clientX,c=r?n.height:n.width,u=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!s){if(a&&eu<c*o){if(!da&&(ua===1?l>u+c*i/2:l<d-c*i/2)&&(da=!0),da)f=!0;else if(ua===1?l<u+eu:l>d-eu)return-ua}else if(l>u+c*(1-o)/2&&l<d-c*(1-o)/2)return Pq(t)}return f=f||s,f&&(l<u+c*i/2||l>d-c*i/2)?l>u+c/2?1:-1:0}function Pq(e){return an(H)<an(e)?1:-1}function Iq(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,r=0;n--;)r+=t.charCodeAt(n);return r.toString(36)}function Dq(e){tu.length=0;for(var t=e.getElementsByTagName("input"),n=t.length;n--;){var r=t[n];r.checked&&tu.push(r)}}function iu(e){return setTimeout(e,0)}function Uh(e){return clearTimeout(e)}nu&&be(document,"touchmove",function(e){(K.active||ki)&&e.cancelable&&e.preventDefault()}),K.utils={on:be,off:pe,css:ne,find:BC,is:function(t,n){return!!Tn(t,n,t,!1)},extend:yq,throttle:$C,closest:Tn,toggleClass:Yt,clone:qC,index:an,nextTick:iu,cancelNextTick:Uh,detectDirection:XC,getChild:Ci,expando:Ft},K.get=function(e){return e[Ft]},K.mount=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t[0].constructor===Array&&(t=t[0]),t.forEach(function(r){if(!r.prototype||!r.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(r));r.utils&&(K.utils=zn(zn({},K.utils),r.utils)),aa.mount(r)})},K.create=function(e,t){return new K(e,t)},K.version=gq;var nt=[],fa,jh,Vh=!1,Gh,Xh,su,ma;function Bq(){function e(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var t in this)t.charAt(0)==="_"&&typeof this[t]=="function"&&(this[t]=this[t].bind(this))}return e.prototype={dragStarted:function(n){var r=n.originalEvent;this.sortable.nativeDraggable?be(document,"dragover",this._handleAutoScroll):this.options.supportPointer?be(document,"pointermove",this._handleFallbackAutoScroll):r.touches?be(document,"touchmove",this._handleFallbackAutoScroll):be(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(n){var r=n.originalEvent;!this.options.dragOverBubble&&!r.rootEl&&this._handleAutoScroll(r)},drop:function(){this.sortable.nativeDraggable?pe(document,"dragover",this._handleAutoScroll):(pe(document,"pointermove",this._handleFallbackAutoScroll),pe(document,"touchmove",this._handleFallbackAutoScroll),pe(document,"mousemove",this._handleFallbackAutoScroll)),QC(),au(),vq()},nulling:function(){su=jh=fa=Vh=ma=Gh=Xh=null,nt.length=0},_handleFallbackAutoScroll:function(n){this._handleAutoScroll(n,!0)},_handleAutoScroll:function(n,r){var o=this,i=(n.touches?n.touches[0]:n).clientX,s=(n.touches?n.touches[0]:n).clientY,a=document.elementFromPoint(i,s);if(su=n,r||this.options.forceAutoScrollFallback||oa||hr||ia){Kh(n,this.options,a,r);var l=$r(a,!0);Vh&&(!ma||i!==Gh||s!==Xh)&&(ma&&QC(),ma=setInterval(function(){var c=$r(document.elementFromPoint(i,s),!0);c!==l&&(l=c,au()),Kh(n,o.options,c,r)},10),Gh=i,Xh=s)}else{if(!this.options.bubbleScroll||$r(a,!0)===Un()){au();return}Kh(n,this.options,$r(a,!1),!1)}}},fr(e,{pluginName:"scroll",initializeByDefault:!0})}function au(){nt.forEach(function(e){clearInterval(e.pid)}),nt=[]}function QC(){clearInterval(ma)}var Kh=$C(function(e,t,n,r){if(t.scroll){var o=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,a=t.scrollSpeed,l=Un(),c=!1,u;jh!==n&&(jh=n,au(),fa=t.scroll,u=t.scrollFn,fa===!0&&(fa=$r(n,!0)));var d=0,f=fa;do{var h=f,m=tt(h),p=m.top,S=m.bottom,C=m.left,L=m.right,k=m.width,y=m.height,g=void 0,v=void 0,w=h.scrollWidth,b=h.scrollHeight,E=ne(h),_=h.scrollLeft,T=h.scrollTop;h===l?(g=k<w&&(E.overflowX==="auto"||E.overflowX==="scroll"||E.overflowX==="visible"),v=y<b&&(E.overflowY==="auto"||E.overflowY==="scroll"||E.overflowY==="visible")):(g=k<w&&(E.overflowX==="auto"||E.overflowX==="scroll"),v=y<b&&(E.overflowY==="auto"||E.overflowY==="scroll"));var x=g&&(Math.abs(L-o)<=s&&_+k<w)-(Math.abs(C-o)<=s&&!!_),N=v&&(Math.abs(S-i)<=s&&T+y<b)-(Math.abs(p-i)<=s&&!!T);if(!nt[d])for(var D=0;D<=d;D++)nt[D]||(nt[D]={});(nt[d].vx!=x||nt[d].vy!=N||nt[d].el!==h)&&(nt[d].el=h,nt[d].vx=x,nt[d].vy=N,clearInterval(nt[d].pid),(x!=0||N!=0)&&(c=!0,nt[d].pid=setInterval(function(){r&&this.layer===0&&K.active._onTouchMove(su);var R=nt[this.layer].vy?nt[this.layer].vy*a:0,O=nt[this.layer].vx?nt[this.layer].vx*a:0;typeof u=="function"&&u.call(K.dragged.parentNode[Ft],O,R,e,su,nt[this.layer].el)!=="continue"||WC(nt[this.layer].el,O,R)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&f!==l&&(f=$r(f,!1)));Vh=c}},30),JC=function(t){var n=t.originalEvent,r=t.putSortable,o=t.dragEl,i=t.activeSortable,s=t.dispatchSortableEvent,a=t.hideGhostForTarget,l=t.unhideGhostForTarget;if(n){var c=r||i;a();var u=n.changedTouches&&n.changedTouches.length?n.changedTouches[0]:n,d=document.elementFromPoint(u.clientX,u.clientY);l(),c&&!c.el.contains(d)&&(s("spill"),this.onSpill({dragEl:o,putSortable:r}))}};function Yh(){}Yh.prototype={startIndex:null,dragStart:function(t){var n=t.oldDraggableIndex;this.startIndex=n},onSpill:function(t){var n=t.dragEl,r=t.putSortable;this.sortable.captureAnimationState(),r&&r.captureAnimationState();var o=Ci(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(n,o):this.sortable.el.appendChild(n),this.sortable.animateAll(),r&&r.animateAll()},drop:JC},fr(Yh,{pluginName:"revertOnSpill"});function Zh(){}Zh.prototype={onSpill:function(t){var n=t.dragEl,r=t.putSortable||this.sortable;r.captureAnimationState(),n.parentNode&&n.parentNode.removeChild(n),r.animateAll()},drop:JC},fr(Zh,{pluginName:"removeOnSpill"}),K.mount(new Bq),K.mount(Zh,Yh);var e0=100,t0=Symbol("EMULATED_DRAG_EVENT");function Hq(e,t){return e[t0]===t}var n0=class{constructor(){A(this,"_target",null),A(this,"_interval",0),A(this,"_x",0),A(this,"_y",0)}_fireDragEvent(e,t,n,r,o){const i=new DragEvent(t,{dataTransfer:o,clientX:n,clientY:r,bubbles:!0,cancelable:!0});return i[t0]=this,Dt(()=>e.dispatchEvent(i)),!i.defaultPrevented}start(e,t,n){const r=document.elementFromPoint(e,t);return r&&!this._target&&this._fireDragEvent(r,"dragstart",e,t,n)?(this._target=r,this._x=e,this._y=t,this._interval=setInterval(()=>{this._fireDragEvent(r,"drag",this._x,this._y,n)},e0),!0):!1}enter(e,t,n){const r=document.elementFromPoint(e,t);r&&r!==this._target&&(this._fireDragEvent(r,"dragenter",e,t,n),this._target=r,this._interval||(this._interval=setInterval(()=>{this._fireDragEvent(r,"drag",this._x,this._y,n)},e0)))}over(e,t,n){this._x=e,this._y=t;const r=document.elementFromPoint(e,t);r&&(r!==this._target&&this._fireDragEvent(r,"dragenter",e,t,n),this._fireDragEvent(r,"dragover",e,t,n)),this._target&&r!==this._target&&this._fireDragEvent(this._target,"dragleave",e,t,n),this._target=r}leave(e,t,n){this._target&&(this._fireDragEvent(this._target,"dragleave",e,t,n),this._target=null),this._target=null}drop(e,t,n){this._target&&(this._fireDragEvent(this._target,"drop",e,t,n),this._target=null),this._target=null,clearInterval(this._interval)}end(e,t,n){this._target&&this._fireDragEvent(this._target,"dragend",e,t,n),this._target=null,clearInterval(this._interval)}};function lu(e){document.querySelector(".noresp-em-narrow-table")&&e.querySelectorAll("img, amp-img").forEach(t=>{const n=t;n.style.removeProperty("width"),n.style.removeProperty("max-width")})}function ha(e){const t=getComputedStyle(e);return e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0)}function Qh(e){const t=document.createElement("div");t.replaceChildren(...Ne(e.atomHTML));const n=t.querySelector("img");if(!n)return Nt(t);let r=0;return e.targetAtom.classList.contains("em-block-insert-empty")?r=600:e.targetAtom.classList.contains("em-mob-wrap")||e.targetAtom.classList.contains("noresp-em-mob-wrap")?r=ha(e.targetAtom):r=e.targetAtom.parentNode?ha(e.targetAtom.parentNode):ha(e.targetAtom),n.setAttribute("width",String(r)),document.querySelector(".noresp-em-narrow-table")?lu(t):n.style.maxWidth=r+"px",Nt(t)}function r0(e,t,n){const r=e.querySelectorAll("img"),o=r.length===1?r[0]:null,i=o?.getAttribute("width")??"";if(!o||o.classList.contains("em-countdown")||!i||i.endsWith("%"))return!1;const s=parseFloat(i),a=o.style.display;o.style.display="none";const l=ha(n);o.style.display=a;const c=s>=ha(t)?l:Math.min(s,l);return!c||c===s?!1:(o.setAttribute("width",String(c)),document.querySelector(".noresp-em-narrow-table")?lu(e):o.style.maxWidth=c+"px",!0)}function o0(e,t){const n=e.atomHTML.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");n.replaceChildren(...Ne(e.atomHTML));const r=n.querySelector("img");if(!r)return!1;const o=new Image;return o.onload=function(){const i=Math.round(this.width/2);r.setAttribute("width",String(i)),document.querySelector(".noresp-em-narrow-table")?lu(n):(r.style.maxWidth=i+"px",r.style.width="100%"),nr(e.targetElem,e.targetPlace,`
|
|
56
|
+
`+Nt(n)+`
|
|
57
|
+
`),t()},o.src=r.getAttribute("src")||"",!1}function Jh(e){const t=e.blockHTML.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");t.replaceChildren(...Ne(e.blockHTML));const n=t.querySelector("img.em-countdown");if(!n)return Nt(t);const r=n.getAttribute("em-cd-settings")||"",o=e.project==="useblocks"?"https://cdt3.useblocks.io/rndt?":"https://cdt3.emcdn.ru/rndt?",i=new URL(o+r),s=new Date;return i.searchParams.set("time",new Date(+s+432e6).toISOString()),Ht(n,"src",i.href),n.setAttribute("em-cd-settings",i.search.substring(1)),Nt(t)}function cu(e){const t=e.blockIsTr?document.createElement("table"):document.createElement("div");return t.replaceChildren(...Ne(e.blockHTML)),document.querySelector(".noresp-em-narrow-table")?t.querySelectorAll('[class^="em-mob-"], [class*=" em-mob-"]').forEach(n=>{n.className=n.className.split(" ").map(r=>r.startsWith("em-mob-")?"noresp-"+r:r).join(" ")}):t.querySelectorAll('[class^="noresp-"], [class*=" noresp-"]').forEach(n=>{n.className=n.className.split(" ").map(r=>r.startsWith("noresp-")?r.substring(7):r).join(" ")}),lu(t),Nt(t)}function Fq(e){e&&(e.removeAttribute("em-edit"),e.querySelectorAll("[em-edit]").forEach(t=>t.removeAttribute("em-edit")))}var $q=class{constructor(){A(this,"_items",new Map)}gc(){for(const[e,t]of[...this._items])e.isConnected||(this._items.delete(e),t.destroy())}get(e){return this._items.get(e)}create(e,t){const n=K.create(e,t);return this._items.set(e,n),n}entries(){return[...this._items]}},zr=new $q,Wq=Number.MAX_VALUE,qq=0;function i0(e){return typeof e=="object"?e.name:e}var zq=class{constructor(){A(this,"emulator",new n0),A(this,"x",0),A(this,"y",0),A(this,"_tracked",!1),A(this,"handleMouseMove",e=>{this.x=e.clientX,this.y=e.clientY,this.emulator.over(this.x,this.y)}),A(this,"releaseLostPress",e=>{const t=K.dragged;if(e.buttons!==0||!t)return;const n=K.active??(t.parentElement?K.get(t.parentElement):void 0),r=new window.MouseEvent("mouseup",{clientX:e.clientX,clientY:e.clientY});n?._onDrop(r)})}track(){this._tracked||(this._tracked=!0,window.addEventListener("mousedown",e=>{this.x=e.clientX,this.y=e.clientY}),window.addEventListener("mouseup",()=>this.emulator.end(this.x,this.y)),window.addEventListener("PointerEvent"in window?"pointermove":"mousemove",this.releaseLostPress,!0))}},ln=new zq,s0=K.prototype,Uq=ht(s0._onDragOver);function jq(e){zr.gc(),ln.track(),s0._onDragOver=Uq;const t=document.querySelectorAll("[em=group]");K.prototype._emulateDragOver=function(){};let n;const r=()=>{e.commit(!0)};function o(a,l){let c;function u(m,p){let S=null,C=Number.MAX_VALUE;const L=i0(K.active?.options.group);for(const[k,y]of zr.entries())if(i0(y.options.group)===L&&(!a||c&&a(k,c)!==!1)){for(const g of k.children)if(!g.classList.contains("sortable-drag")){const v=g.getBoundingClientRect(),w=m<v.left?v.left-m:m>v.right?m-v.right:0,b=p<v.top?v.top-p:p>v.bottom?p-v.bottom:0;if(w<Wq||b<qq){const E=Math.sqrt(w*w+b*b);E<C?(S=[y,g],C=E):E===C&&S[1].contains(g)&&(S=[y,g])}}}return S}function d(m){const p="TouchEvent"in window&&m instanceof TouchEvent?m.touches[0]:m,S=u(p.clientX,p.clientY);if(S){const[k,y]=S,g=y.getBoundingClientRect();var C={clientX:g.left+g.width/2,clientY:p.clientY};for(var L in m)m.hasOwnProperty(L)&&(C[L]=m[L]);C.target=y,C.rootEl=y.parentNode,C.preventDefault=void 0,C.stopPropagation=void 0,k._onDragOver(C)}}return{onStart:m=>{c=m.item,K.ghost&&qf(K.ghost),Fq(K.ghost),e.beginTextUpdate(),window.addEventListener("mousemove",d),window.addEventListener("touchmove",d),ln.emulator.start(ln.x,ln.y)?(window.addEventListener("mousemove",ln.handleMouseMove),n&&(n.dispose(),n=void 0)):m.preventDefault()},onEnd:m=>{window.removeEventListener("mousemove",d),window.removeEventListener("touchmove",d);let p=!1;m.from===m.to?ln.emulator.end(ln.x,ln.y):(p=!!l?.(m),ln.emulator.drop(ln.x,ln.y)),window.removeEventListener("mousemove",ln.handleMouseMove),e.endTextUpdate(),m.from===m.to&&m.oldIndex!==m.newIndex&&e.commit(!0),p&&e.commit(!0),n&&(n.dispose(),n=void 0),c=void 0}}}if(t.length)for(const a of t){const l=a.parentElement;l&&!zr.get(l)&&zr.create(l,{forceFallback:!0,group:"groups-sorting",handle:`.of-group .${Ve.drag}`,...o(),onMove:r})}const i=[...document.querySelectorAll("[em=block]")],s=[...document.querySelectorAll("[em=atom]")].map(a=>a.parentElement);for(const a of i){const l=a.querySelectorAll("td");for(const c of l)!c.innerHTML&&!c.hasAttribute("height")&&[...c.parentElement?.children||[]].indexOf(c)%2===0&&s.push(c)}if(s.length){const a=new Set;for(const l of s)l&&!a.has(l)&&(a.add(l),zr.get(l)||zr.create(l,{forceFallback:!0,group:"atoms-sorting",handle:`.of-atom .${Ve.drag}`,...o((c,u)=>{if(u.tagName==="TR"){if(c.tagName!=="TABLE"&&c.tagName!=="TBODY")return!1}else if(u.tagName==="TD"){if(c.tagName!=="TR")return!1}else if(u.tagName==="TABLE"){const d=e.getContext(c);if(d&&En(d)&&d.tagName==="AMP-ACCORDION"&&c.tagName==="DIV"&&[...d.querySelectorAll("section > div")].indexOf(c)>=0||e.isInExternal(c)&&c.tagName==="DIV")return!0;if(c.tagName!=="TD")return!1}},c=>r0(c.item,c.from,c.to)),onMove:r,onSort:function(){l.innerHTML.trim()===""&&(l.innerHTML="")}}))}if(i.length){const a=new Set;for(const l of i){const c=l.parentElement;c&&!a.has(c)&&(a.add(c),zr.get(c)||zr.create(c,{forceFallback:!0,group:"blocks-sorting",handle:`.of-block .${Ve.drag}`,...o(),onMove:r}))}}}var Vq=class{constructor(){A(this,"_nodes",[])}add(e){const t=this._nodes,n=new Set;for(const r of t){if(r.contains(e))return;e.contains(r)&&n.add(r)}for(const r of n){const o=t.indexOf(r);o>=0&&t.splice(o,1)}t.push(e)}remove(e){const t=new Set;for(const n of this._nodes)(e===n||e.contains(n))&&t.add(n);for(const n of t){const r=this._nodes.indexOf(n);r>=0&&this._nodes.splice(r,1)}}get nodes(){return[...this._nodes]}clear(){this._nodes.splice(0,this._nodes.length)}},ep={get textDocument(){return M(Pt,us)},commit:uo};function Gq(){const e=V.get("applicationTheme")||"light";let t=!1;try{ep.textDocument.beginUpdate();const n=[...document.querySelectorAll('[em="css"]')].map(s=>s.getAttribute("href"));let r=document.getElementsByTagName("head")[0];if(!r)if(document.documentElement)r=document.createElement("head"),document.documentElement.insertBefore(r,document.documentElement.firstChild),t=!0;else return;const o="css/sandbox.css?cd84d2b9";if(n.indexOf(o)<0){const s=document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("type","text/css"),s.setAttribute("em","css"),s.setAttribute("href",o),r.appendChild(s),t=!0}const i=`css/sandbox-${e}.css?cd84d2b9`;if(n.indexOf(i)<0){const s=document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("type","text/css"),s.setAttribute("em","css"),s.setAttribute("href",i),r.appendChild(s),t=!0}}finally{ep.textDocument.endUpdate()}t&&ep.commit(!1)}var uu=".em-prevent-action";function Xq(e){const{fingerprint:t,applicationElementSettingsSet:n}=e,r=document.querySelector("[em-edit]"),o=t.take(r);if(t.differs(o)){if(document.body?.classList.contains("em-sandbox-discuss")){t.accept(o);return}if(r){r.closest(".em-prevent-action")||(t.accept(o),n({elem:r}));return}setTimeout(()=>{const i=document.querySelector("[em-edit]"),s=t.take(i);i?t.differs(s)&&(t.accept(s),i.closest(".em-prevent-action")||n({elem:i})):(t.accept(s),n({elem:null}))},0)}}function Kq(e){const t=document.body;if(!t)return;const n=e.isAppLocked()||e.isIntegratorLocked();(e.isAppLocked()!==t.classList.contains("mceNonEditable")||e.isIntegratorLocked())&&He(t,!!n,"mceNonEditable"),He(t,!!V.get("previewPage"),"em-sandbox-preview")}function Yq(e){const{htmlDocument:t,commit:n,focusController:r}=e,o=uq(()=>jq(t));t.onChange(a=>{a.some(l=>l.added.length||l.characterDataChanged||l.reordered?.length||l.reparented?.length)&&o()}),t.onChange(()=>{Gq()}),t.onRefresh(()=>e.initPreview()),t.onChange(a=>{a.some(l=>l.removed.some(c=>c instanceof HTMLHeadElement||c instanceof HTMLLinkElement&&c.hasAttribute("em")))&&document.querySelector(".em-editor-wrapper")?.remove()});const i=new Vq;let s;t.onChange(a=>{for(const l of a)for(const c of l.added)i.add(c.parentElement??c);s||(s=setTimeout(()=>{r.whenEditorLostFocus(()=>{i.clear(),n(!1)}),s=void 0},1e3))}),t.onChange(lq(e.applicationElementSettingsSet)),t.onChange(()=>{e.selectionLock.isLocked()||(Xq(e),Kq(e.editLock))})}function Zq(e,t,n){if(!(e instanceof Element)||!e.closest(".em-prevent-action"))return;const r=document.querySelector(".em-editor-wrapper");if(!document.querySelector("[em-edit]")&&!r)return;const o=n.acquire();try{document.querySelectorAll("[em-edit]").forEach(i=>i.removeAttribute("em-edit")),r&&(r.style.display="none"),Dt(()=>document.querySelectorAll("editor").forEach(i=>i.blur())),t.forget()}finally{o.releaseLater()}}function Qq(e,t){const n=ht(r=>Zq(r.target,e,t));return window.addEventListener("mousedown",n,!0),window.addEventListener("click",n,!0),{dispose(){window.removeEventListener("mousedown",n,!0),window.removeEventListener("click",n,!0)}}}var Jq={name:"sandbox.fingerprint",provides:[qo],awaits:{services:[Y,xe]},setup(e){const t=M(e,Y),n=M(e,xe),r=uD(o=>t.getOuterHtml(o));dD(r,n),Qq(r,n),e.inject(qo,r)}},ez={name:"sandbox.setCursor",provides:[vt],awaits:{services:[Y,gn,it]},setup(e){const t={HTMLDocument:M(e,Y),documentMapping:M(e,gn),remoteDocument:M(e,it),messageService:U};e.inject(vt,n=>mD(n,t))}},tz={name:"sandbox.wrapEditor",provides:[bn],awaits:{services:[Y,gn,_e]},setup:e=>e.inject(bn,oq({commit:ft(e),htmlDocument:M(e,Y),documentMapping:M(e,gn)}))};function nz(e){const{container:t}=e;Zs.registerAll({MessageService:()=>U,FocusState:()=>e.focusController,SyncService:()=>t.getInstance(Y),SyncServiceInternals:()=>t.getInstance(it),TextDocument:()=>t.getInstance(us),Mapping:()=>t.getInstance(gn),EditorSurface:()=>({surface:e.surface})}),e.features&&e.features.length>0&&Zs.initFeatures(e.features)}var rz=e=>e,oz=e=>`table:empty::before {
|
|
58
|
+
/*content: 'Paste block here';*/
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
table:is(:empty, :has(> tbody:only-child:empty))::after {
|
|
62
|
+
content: '${e.DROP_BLOCK_HINT}' !important;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[em="block"].empty-structure td:not([height]):not([width]):empty::before {
|
|
66
|
+
/*content: 'Paste atom here';*/
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.em-block-insert:after {
|
|
70
|
+
content: '${e.PASTE_HERE}' !important;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.em-atom-insert:after,
|
|
74
|
+
.em-blockatom-insert:after {
|
|
75
|
+
content: '${e.PASTE_HERE}' !important;
|
|
76
|
+
}`,iz=class extends Ee{constructor(e){super(),A(this,"htmlDocument",void 0),A(this,"_localized",{...yx(rz)}),A(this,"_styles",""),A(this,"_onChangeLocaleEmitter",new ge),A(this,"_onDomChanged",()=>{if(!document.querySelector('[data-em-localization="true"]')&&this._styles){const t=document.querySelector("head")||document.querySelector("body");if(t){const n=document.createElement("style");n.innerHTML=this._styles,n.dataset.emLocalization="true",t.insertBefore(n,t.firstChild)}}}),A(this,"onChangeLocale",this._onChangeLocaleEmitter.event),this.htmlDocument=e,this.addDisposable(e.onChange(this._onDomChanged))}get localized(){return this._localized}setTranslations({name:e,data:t}){this._localized=t;const n=document.createElement("style");n.dataset.emLocalization="true";const r=oz(t);if(r&&this._styles!==r){this._styles=r,n.innerHTML=r;const o=document.querySelector('[data-em-localization="true"]');if(o)o.replaceWith(n);else{const i=document.querySelector("head")||document.querySelector("body");i?.insertBefore(n,i.firstChild)}this.htmlDocument.commit(!1)}this._onChangeLocaleEmitter.fire({name:e,data:t})}};function sz(e){const t=new iz(e),n=r=>{t.setTranslations(r)};return t.addDisposable(U.addListener(ue.SANDBOX_TRANSLATIONS,n)),t}function az(e,t,n){const r=new Ee;let o=[];return r.addDisposable(e.beforeChange(({treeMutations:i})=>{t.isEditorInFocus&&o.push(...i)})),r.addDisposable(t.editorLostFocus(()=>{if(o.length){const i=[];for(const s of o){const a=s.type;let l=null;a==="Add"?l=s.node:a==="Update"&&(l=s.next),l?.closed===!1&&i.push(l)}i.length&&(e.correctNodes(i),n.saveChanges(!1)),o=[]}})),r}function lz(e){const t=new Ee,n=r=>{Hq(r,e)||U.send(ue.APPLICATION_IFRAME_DRAG_EVENT,{type:r.type,clientX:r.clientX,clientY:r.clientY,value:r.dataTransfer?.getData("Text")||""})};return window.addEventListener("dragstart",n),window.addEventListener("dragover",n),window.addEventListener("drag",n),window.addEventListener("dragleave",n),window.addEventListener("dragend",n),window.addEventListener("drop",n),window.addEventListener("dragenter",n),t.addDispose(()=>{window.removeEventListener("dragstart",n),window.removeEventListener("dragover",n),window.removeEventListener("drag",n),window.removeEventListener("dragleave",n),window.removeEventListener("dragend",n),window.removeEventListener("drop",n),window.removeEventListener("dragenter",n)}),t}function cz(){const e=new n0,t=r=>{const o=new DataTransfer;switch(o.setData("Text",r.value),r.type){case"dragenter":e.enter(r.clientX,r.clientY,o);break;case"dragover":e.over(r.clientX,r.clientY,o);break;case"dragleave":e.leave(r.clientX,r.clientY,o);break;case"dragend":e.end(r.clientX,r.clientY,o);break;case"drop":e.drop(r.clientX,r.clientY,o)}},n=new Ee;return n.addDisposable(U.addListener(ue.SANDBOX_DRAG_EVENT,t)),n.addDisposable(lz(e)),n}function uz(){return NodeFilter.FILTER_ACCEPT}function dz(e){if(e instanceof Comment)return[e];const t=[];if(e){const n=document.createNodeIterator(e,NodeFilter.SHOW_COMMENT,uz);let r;for(;r=n.nextNode();)t.push(r)}return t}var fz=new Vv,mz=new Set;function a0(e){return e?fz.getUnescapedText(e,!0,mz)!==e:!1}function l0(e){return e.nodeValue?a0(e.nodeValue):!1}function hz(e){const t=e.previousSibling;if(t instanceof HTMLSpanElement&&t.classList.contains("em-code")&&t.classList.contains("em-code_var"))return t}function pa(e){const t=e?.nextSibling;if(t instanceof Comment&&l0(t))return t}function c0(e,t){if(t.ownerDocument){const n=t.ownerDocument.createRange();try{n.selectNode(t)}catch{n.selectNodeContents(t)}const r=e.compareBoundaryPoints(Range.START_TO_START,n)===1,o=e.compareBoundaryPoints(Range.END_TO_END,n)===-1;if(r&&!o)return 0;if(!r&&o)return 1;if(r&&o)return 2}return 3}function pz(){let e=!1;document.addEventListener("keydown",n=>{n.key.toLowerCase()==="arrowleft"&&(e||(e=!0,setTimeout(()=>{e=!1},50)))});const t=()=>{const n=window.getSelection();if(n?.rangeCount){const r=n.getRangeAt(0),o=document.querySelectorAll(".em-code");for(const i of o){const s=i.nextSibling;if(s instanceof Comment){if(c0(r,i)===0&&c0(r,s)===1){e?(r.setStartBefore(i),r.setEndBefore(i)):(r.setStartAfter(s),r.setEndAfter(s));return}n.containsNode(s)&&!n.containsNode(i)&&r.setStartAfter(s)}}}};return document.addEventListener("selectionchange",t),{dispose(){document.removeEventListener("selectionchange",t)}}}var gz=e=>{if(!e)return;(!e.firstChild||e.firstChild.nodeType!==Node.TEXT_NODE)&&(e.textContent="",e.appendChild(document.createTextNode(" ")));const t=e.firstChild;t.textContent===""&&(t.textContent=" ");const n=window.getSelection();if(!n)return;const r=document.createRange();r.setStart(t,1),r.collapse(!0),n.removeAllRanges();const o=e.closest('[contenteditable="true"]');Dt(()=>{n.addRange(r),o?.focus()})},u0=e=>{const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let n=null,r;for(;r=t.nextNode();)n=r;return n},bz=(e,t)=>{const n=e.startContainer,r=e.startOffset,o=u0(t);if(!o)return!1;const i=o.textContent?.length??0;return n===o&&r===i},yz=(e,t)=>{try{const n=window.getSelection();if(!n)return!1;const r=document.createRange();return r.setStart(e,t),r.collapse(!0),n.removeAllRanges(),n.addRange(r),!0}catch{return!1}};function vz(e,t,n){const{startContainer:r}=e;if(!e.collapsed||!t.isForeign(r))return null;let o=r;for(;o.parentNode&&t.isForeign(o.parentNode);)o=o.parentNode;if(!o.parentElement?.closest('[contenteditable="true"]'))return null;if(n==="ArrowLeft"||n==="ArrowRight")return{node:o,side:n==="ArrowLeft"?"before":"after"};const i=document.createRange();return i.selectNodeContents(o),i.setEnd(e.startContainer,e.startOffset),{node:o,side:i.toString()===""?"before":"after"}}function d0(e){const t=e.startContainer;return xt(t)?t:xt(t.parentNode)?t.parentNode:null}function Ez(e){const t=e.previousSibling;if(t?.nodeType===Node.ELEMENT_NODE&&t.tagName==="EM-REPLACE")return{em:t,side:"after"};const n=e.nextSibling;return n?.nodeType===Node.ELEMENT_NODE&&n.tagName==="EM-REPLACE"?{em:n,side:"before"}:null}function Sz(e){return document.createTreeWalker(e,NodeFilter.SHOW_TEXT).nextNode()}function wz({em:e,side:t}){const n=t==="after"?u0(e):Sz(e);if(!n)return;const r=document.createRange();r.setStart(n,t==="after"?Math.max(n.length-1,0):Math.min(1,n.length)),r.collapse(!0);const o=window.getSelection();o&&Ls(o,r)}function _z(e){const t=L=>e.renderOnly(L);let n=null,r=null,o=!1;const i=L=>!!n&&n.em===L.em&&n.side===L.side&&r===(L.side==="after"?"ArrowLeft":"ArrowRight"),s=L=>{wD(document,t,L)&&e.commit(!1),_D(document,t,L)},a=()=>{const L=window.getSelection();if(o||!L?.rangeCount)return;const k=L.getRangeAt(0),y=e.ownership?vz(k,e.ownership,r):null;if(y){n=null;const w=Qf(y.node,y.side,t);s(w);return}const g=kE(k);if(g&&i(g)){n=null,wz(g),s();return}if(g){const w=Vl(g.em,g.side,t);n=g,s(w);return}const v=k.collapsed?d0(k):null;n=v?Ez(v):null,s(v)},l=()=>{const L=window.getSelection(),k=L?.rangeCount?d0(L.getRangeAt(0)):null;return!!k&&e.applyOwn(()=>CD(k,t))!==null},c=L=>{!L.isComposing&&l()&&e.commit(!0)},u=()=>{o=!0},d=()=>{o=!1,l(),e.commit(!0)},f=L=>{r=L.key},h=L=>{const k=window.getSelection();k?.rangeCount&&L?.closest?.('[contenteditable="true"]')&&BE(k.getRangeAt(0),t)},m=L=>{L.key?.length===1&&!L.ctrlKey&&!L.metaKey&&!L.altKey&&h(L.target)},p=L=>{L.inputType==="insertCompositionText"&&h(L.target)},S=()=>{r=null},C=L=>bD(L,t);return e.holdCaretAfterBreak=C,document.addEventListener("selectionchange",a),document.addEventListener("input",c),document.addEventListener("compositionstart",u,!0),document.addEventListener("compositionend",d,!0),document.addEventListener("keydown",f,!0),document.addEventListener("pointerdown",S,!0),window.addEventListener("keydown",m,!0),window.addEventListener("beforeinput",p,!0),{dispose(){e.holdCaretAfterBreak===C&&(e.holdCaretAfterBreak=void 0),document.removeEventListener("selectionchange",a),document.removeEventListener("input",c),document.removeEventListener("compositionstart",u,!0),document.removeEventListener("compositionend",d,!0),document.removeEventListener("keydown",f,!0),document.removeEventListener("pointerdown",S,!0),window.removeEventListener("keydown",m,!0),window.removeEventListener("beforeinput",p,!0)}}}var f0=":scope > td, :scope > tr > td, :scope > tbody > tr > td";function Ni(e){return e.querySelector(f0)}function ga(e){return Array.from(e.querySelectorAll(f0))}function tp(e){const t=e.closest('[em="block"]');return t?Ni(t)??t.querySelector("td"):null}function m0(e){const t=e.closest('[em="block"]');return!!t&&(e===t||ga(t).includes(e))}var Cz=()=>{try{return localStorage.getItem("em-debug-project-fonts")==="1"}catch{return!1}},Ur=(e,t)=>{Cz()},jr=new Map;function Tz(e){return jr.get(e.toLowerCase())?.[0]}function np(e){return jr.get(e.toLowerCase())??[]}function Az(){return jr.size>0}function h0(){return[...jr.values()].map(e=>e[0])}function kz(e){jr=new Map;for(const t of e??[]){const n=t.family.toLowerCase();jr.set(n,[...jr.get(n)??[],t])}return jr}var Lz=e=>{const t=kz(e);Ur("iframe: project fonts map received",{count:t.size,families:[...t.keys()],entries:e})};function Nz(){const e=new Ee;return e.addDisposable(U.addListener(ue.SANDBOX_SET_PROJECT_FONTS,Lz)),e}var xz={"sans-serif":"Helvetica, Arial, sans-serif",serif:'"Times New Roman", Times, serif'};function p0(e){return e.category==="serif"?"serif":"sans-serif"}function du(e,t){const n=Tz(t);return n?(e.style.fontFamily=xz[p0(n)],!0):!1}var Oz=/(?:\/\*\s*em-project-font-[^*]*\*\/\s*)?@font-face\s*\{([^}]*)\}\s*/g,Rz=/url\(\s*(['"]?)(.*?)\1\s*\)/,Mz=e=>e.trim().replace(/^(['"])(.*)\1$/,"$2");function rp(e){return Array.from(e.matchAll(Oz),t=>{const n=new Map(t[1].split(";").map(r=>r.split(":")).filter(r=>r.length>1).map(([r,...o])=>[r.trim().toLowerCase(),o.join(":").trim()]));return{start:t.index??0,end:(t.index??0)+t[0].length,family:Mz(n.get("font-family")??""),src:Rz.exec(n.get("src")??"")?.[2]??"",weight:n.get("font-weight")||"400",style:n.get("font-style")||"normal"}})}function g0(e){return[e.family.toLowerCase(),e.src,e.weight,e.style].join("|")}function b0(e,t){return[...t].sort((n,r)=>r.start-n.start).reduce((n,r)=>n.slice(0,r.start)+n.slice(r.end),e)}function op(e,t){if(!e)return;const{minify:n,cssbeautify:r,HTMLDocument:o}=t;let i=document.head.querySelector('style[em="styles"]'),s="";i?s=o.getInnerHtml(i):(i=document.createElement("style"),i.setAttribute("em","styles"),i=document.head.insertAdjacentElement("beforeend",i));const a=document.createElement("div");a.insertAdjacentHTML("afterbegin",typeof e=="string"?e:e.join(`
|
|
77
|
+
`));let l=n(s+`
|
|
78
|
+
`+[...a.querySelectorAll("style")].map(c=>c.innerHTML).join(`
|
|
79
|
+
`),{restructure:!0,forceMediaMerge:!0}).css;l=r(l,{indent:" ",autosemicolon:!0}),i.textContent=`
|
|
80
|
+
`+l+`
|
|
81
|
+
`}function ip(e){const t=e.flatMap(n=>n instanceof Element?[...n.querySelectorAll('style[em="styles"]')]:[]);return t.forEach(n=>n.remove()),[...e,...t]}function xi(e){return(e||"").replace(/\s/g,"")}function fu(e,t){return`em-font-${xi(e)}-${xi(t)}`}function y0(e){return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g,"\\$1")}function sp(e){return fu(e[2]||"",e[3]||"")}var ap="em-font-custom";function Pz(e){return e[1]==="Project Fonts"}function lp(e,t){Pz(t)&&e.classList.add(ap)}function ba(e,t){const n=[...e.classList].filter(r=>r.startsWith(t));n.length>0&&e.classList.remove(...n)}function cp(e,t){t.forEach(n=>e.style.removeProperty(n))}function v0(e,t,n){t.backgroundColor!==void 0&&(t.backgroundColor===""?(e.removeAttribute("bgcolor"),e.style.removeProperty("background-color"),document.body.style.removeProperty("background-color"),n&&(n.style.color="transparent")):(document.body.style.backgroundColor=t.backgroundColor,e.setAttribute("bgcolor",t.backgroundColor),e.style.backgroundColor=t.backgroundColor,n&&(n.style.color=t.backgroundColor),e.closest(".full-wrap")&&e.closest("body")?.setAttribute("bgcolor",t.backgroundColor))),t.backgroundImage&&(t.backgroundColor===""?(e.style.removeProperty("background-image"),e.removeAttribute("background")):(e.style.removeProperty("background-image"),e.style.backgroundImage=t.backgroundImage[0].type+"("+t.backgroundImage[0].value+")",Ht(e,"background",t.backgroundImage[0].value))),t.backgroundPositionX&&(t.backgroundPositionX==="none"?e.style.removeProperty("background-position-x"):e.style.backgroundPositionX=t.backgroundPositionX!=="initial"?t.backgroundPositionX:""),t.backgroundPositionY&&(t.backgroundPositionY==="none"?e.style.removeProperty("background-position-y"):e.style.backgroundPositionY=t.backgroundPositionY!=="initial"?t.backgroundPositionY:""),t.backgroundRepeat&&(t.backgroundRepeat==="none"?e.style.removeProperty("background-repeat"):e.style.backgroundRepeat=t.backgroundRepeat),t.backgroundSize!==void 0&&(t.backgroundSize===""?e.style.removeProperty("background-size"):e.style.backgroundSize=t.backgroundSize)}function mu(e){const t={all:{width:null,style:null,color:null},top:{width:null,style:null,color:null},right:{width:null,style:null,color:null},bottom:{width:null,style:null,color:null},left:{width:null,style:null,color:null}};if(parseInt(e.style.border)||parseInt(e.style.borderTop)||parseInt(e.style.borderRight)||parseInt(e.style.borderBottom)||parseInt(e.style.borderLeft)||parseInt(e.style.borderTopWidth)||parseInt(e.style.borderRightWidth)||parseInt(e.style.borderBottomWidth)||parseInt(e.style.borderLeftWidth)||e.style.borderStyle||e.style.borderTopStyle||e.style.borderRightStyle||e.style.borderBottomStyle||e.style.borderLeftStyle||e.style.borderColor||e.style.borderTopColor||e.style.borderRightColor||e.style.borderBottomColor||e.style.borderLeftColor)if(e.style.border){const n=e.style.border.split(" "),r=parseInt(n[0]),o=n[1]||null,i=G(n[2]+n[3]+n[4])||null;t.all={width:r,style:o,color:i},t.top={width:r,style:o,color:i},t.right={width:r,style:o,color:i},t.bottom={width:r,style:o,color:i},t.left={width:r,style:o,color:i}}else if((e.style.borderWidth||e.style.borderStyle||e.style.borderColor)&&e.style.borderWidth.indexOf(" ")===-1&&e.style.borderStyle.indexOf(" ")===-1&&(!e.style.borderColor||(G(e.style.borderColor)||"").indexOf(" ")===-1))e.style.borderWidth&&e.style.borderWidth.indexOf(" ")===-1&&(t.all.width=parseInt(e.style.borderWidth)),e.style.borderStyle&&(t.all.style=e.style.borderStyle),e.style.borderColor&&(t.all.color=G(e.style.borderColor)||null);else{if(e.style.borderTop){const n=e.style.borderTop.split(" ");t.top.width=parseInt(n[0]),t.top.style=n[1]||null,t.top.color=G(n[2]+n[3]+n[4])||null}else e.style.borderTopWidth&&(t.top.width=parseInt(e.style.borderTopWidth)),e.style.borderTopStyle&&(t.top.style=e.style.borderTopStyle),e.style.borderTopColor&&(t.top.color=G(e.style.borderTopColor)||null);if(e.style.borderRight){const n=e.style.borderRight.split(" ");t.right.width=parseInt(n[0]),t.right.style=n[1]||null,t.right.color=G(n[2]+n[3]+n[4])||null}else e.style.borderRightWidth&&(t.right.width=parseInt(e.style.borderRightWidth)),e.style.borderRightStyle&&(t.right.style=e.style.borderRightStyle),e.style.borderRightColor&&(t.right.color=G(e.style.borderRightColor)||null);if(e.style.borderBottom){const n=e.style.borderBottom.split(" ");t.bottom.width=parseInt(n[0]),t.bottom.style=n[1]||null,t.bottom.color=G(n[2]+n[3]+n[4])||null}else e.style.borderBottomWidth&&(t.bottom.width=parseInt(e.style.borderBottomWidth)),e.style.borderBottomStyle&&(t.bottom.style=e.style.borderBottomStyle),e.style.borderBottomColor&&(t.bottom.color=G(e.style.borderBottomColor)||null);if(e.style.borderLeft){const n=e.style.borderLeft.split(" ");t.left.width=parseInt(n[0]),t.left.style=n[1]||null,t.left.color=G(n[2]+n[3]+n[4])||null}else e.style.borderLeftWidth&&(t.left.width=parseInt(e.style.borderLeftWidth)),e.style.borderLeftStyle&&(t.left.style=e.style.borderLeftStyle),e.style.borderLeftColor&&(t.left.color=G(e.style.borderLeftColor)||null)}return t}function Oi(e){const t={all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null};return(e.style.borderRadius||e.style.borderTopLeftRadius||e.style.borderTopRightRadius||e.style.borderBottomRightRadius||e.style.borderBottomLeftRadius)&&(!e.style.borderRadius||e.style.borderRadius.indexOf(" ")>-1?t.all=null:t.all=parseFloat(e.style.borderRadius),t.topLeft=e.style.borderTopLeftRadius?parseFloat(e.style.borderTopLeftRadius):null,t.topRight=e.style.borderTopRightRadius?parseFloat(e.style.borderTopRightRadius):null,t.bottomRight=e.style.borderBottomRightRadius?parseFloat(e.style.borderBottomRightRadius):null,t.bottomLeft=e.style.borderBottomLeftRadius?parseFloat(e.style.borderBottomLeftRadius):null),t}function ya(e){let t=null;if(e.style.boxShadow){const n=e.style.boxShadow.match(/[^\s\(]+(\(.+\))?/g);n&&(t={hOffset:n[1]?parseFloat(n[1]):null,vOffset:n[2]?parseFloat(n[2]):null,blurRadius:n[3]&&n[3]!=="inset"?parseFloat(n[3]):null,spreadRadius:n[4]&&n[4]!=="inset"?parseFloat(n[4]):null,color:n[0]&&G(n[0])||"",inset:n[3]==="inset"||n[4]==="inset"||n[5]==="inset"})}return t}function We(e){return e==null||e===""}function up(e){const{elem:t,settings:n}=e,{border:r}=n;r&&(r.all?!We(r.all.width)&&(r.all.style||r.all.color)?(t.style.borderWidth=r.all.width+"px",r.all.style&&(t.style.borderStyle=r.all.style),r.all.color&&(t.style.borderColor=r.all.color)):t.style.removeProperty("border"):(r.top&&(!We(r.top.width)&&(r.top.style||r.top.color)?(t.style.borderTopWidth=r.top.width+"px",r.top.style&&(t.style.borderTopStyle=r.top.style),r.top.color&&(t.style.borderTopColor=r.top.color)):t.style.removeProperty("border-top")),r.right&&(!We(r.right.width)&&(r.right.style||r.right.color)?(t.style.borderRightWidth=r.right.width+"px",r.right.style&&(t.style.borderRightStyle=r.right.style),r.right.color&&(t.style.borderRightColor=r.right.color)):t.style.removeProperty("border-right")),r.bottom&&(!We(r.bottom.width)&&(r.bottom.style||r.bottom.color)?(t.style.borderBottomWidth=r.bottom.width+"px",r.bottom.style&&(t.style.borderBottomStyle=r.bottom.style),r.bottom.color&&(t.style.borderBottomColor=r.bottom.color)):t.style.removeProperty("border-bottom")),r.left&&(!We(r.left.width)&&(r.left.style||r.left.color)?(t.style.borderLeftWidth=r.left.width+"px",r.left.style&&(t.style.borderLeftStyle=r.left.style),r.left.color&&(t.style.borderLeftColor=r.left.color)):t.style.removeProperty("border-left"))))}function E0(e){const{elem:t,settings:n}=e,{boxShadow:r}=n;if(r)if(!We(r.hOffset)&&!We(r.vOffset)){let o="";o=r.inset?"inset ":"",o+=r.hOffset+"px ",o+=r.vOffset+"px ",o+=We(r.blurRadius)?"":r.blurRadius+"px ",o+=We(r.spreadRadius)?"":r.spreadRadius+"px ",o+=r.color?r.color:"",t.style.boxShadow=o}else t.style.removeProperty("box-shadow")}function Ri(e){const{elem:t,settings:n}=e,{borderRadius:r}=n;r&&(r.all?t.style.borderRadius=r.all+"px":(We(r.topLeft)?t.style.removeProperty("border-top-left-radius"):t.style.borderTopLeftRadius=r.topLeft+"px",We(r.topRight)?t.style.removeProperty("border-top-right-radius"):t.style.borderTopRightRadius=r.topRight+"px",We(r.bottomRight)?t.style.removeProperty("border-bottom-right-radius"):t.style.borderBottomRightRadius=r.bottomRight+"px",We(r.bottomLeft)?t.style.removeProperty("border-bottom-left-radius"):t.style.borderBottomLeftRadius=r.bottomLeft+"px"))}function S0(e){let t="";if(e.nodeType===Node.COMMENT_NODE&&e.nodeValue?.includes("[if mso]")){const n=e.nodeValue.replace(/^\[if mso\]>/i,"").replace(/<!\[endif\]$/i,"").trim();t+=n}return e.childNodes.forEach(n=>{t+=S0(n)}),t}function w0(e,t,n={value:0}){e.nodeType===Node.COMMENT_NODE&&e.nodeValue?.includes("[if mso]")&&(n.value===0?e.nodeValue=`[if mso]>${t}<![endif]`:e.nodeValue="",n.value++),e.childNodes.forEach(r=>w0(r,t,n))}function Iz(e){return e?e.backgroundImage!==void 0||e.backgroundColor!==void 0||e.backgroundSize!==void 0||e.backgroundRepeat!==void 0||e.width!==void 0||e.height!==void 0:!1}var _0=/\[if[^\]]*mso[^\]]*\]/i,C0="[if gte mso 9]></v:textbox></v:rect><![endif]";function Dz(e){const t=e.style.backgroundImage;if(t&&t!=="none"){const n=t.match(/url\(["']?([^"')]+)["']?\)/i);if(n)return n[1]}return e.getAttribute("background")||e.getAttribute("data-bg-image")||""}function Bz(e){return(e.style.backgroundRepeat||"").trim().toLowerCase().startsWith("repeat")?"tile":"frame"}function Hz(e){const t=Math.round(e.getBoundingClientRect().width);if(t)return t;const n=(e.getAttribute("width")||"").trim();return n&&!n.includes("%")&&parseInt(n,10)||0}function Fz(e){const t=Hz(e),n=Pt.getInstance(Jb);return n?n(e,t):t}function $z(e,t,n,r){const o=t?` color="${t}"`:"";return`[if gte mso 9]><v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="${r?`width:${r}px;`:"mso-width-percent:1000;"}"><v:fill type="${n}" src="${e}"${o} /><v:textbox style="mso-fit-shape-to-text:true" inset="0,0,0,0"><![endif]`}function T0(e){return!!e&&e.nodeType===Node.COMMENT_NODE}function va(e){if(!T0(e))return!1;const t=e.nodeValue||"";return _0.test(t)&&/src\s*=/i.test(t)&&/v:(fill|image|rect)/i.test(t)}function dp(e){if(!T0(e))return!1;const t=e.nodeValue||"";return _0.test(t)&&/<\/v:(rect|image|textbox)>/i.test(t)&&!/src\s*=/i.test(t)}function fp(e){let t=e.previousSibling;for(;t&&t.nodeType===Node.TEXT_NODE&&!(t.nodeValue||"").trim();)t=t.previousSibling;return t}function A0(e){let t=e.nextSibling;for(;t&&t.nodeType===Node.TEXT_NODE&&!(t.nodeValue||"").trim();)t=t.nextSibling;return t}function k0(e){for(const t of Array.from(e.childNodes))(va(t)||dp(t))&&e.removeChild(t)}function Ea(e,t="inside"){return t==="around"?va(fp(e)):Array.from(e.childNodes).some(n=>va(n))}function L0(e,t="inside"){if(t==="around"){const n=e.parentNode;if(!n)return;const r=fp(e),o=A0(e);va(r)&&n.removeChild(r),dp(o)&&n.removeChild(o);return}k0(e)}function N0(e,t="inside"){const n=Dz(e);if(!n){L0(e,t);return}const r=$z(n,(e.style.backgroundColor||e.getAttribute("bgcolor")||"").trim(),Bz(e),Fz(e)),o=e.ownerDocument;if(o){if(t==="around"){const i=e.parentNode;if(!i)return;const s=fp(e);va(s)&&i.removeChild(s);const a=A0(e);dp(a)&&i.removeChild(a),i.insertBefore(o.createComment(r),e),i.insertBefore(o.createComment(C0),e.nextSibling);return}k0(e),e.insertBefore(o.createComment(r),e.firstChild),e.appendChild(o.createComment(C0))}}function Sa(e,t,n="inside"){t?.outlookBackground===!0?N0(e,n):t?.outlookBackground===!1?L0(e,n):Ea(e,n)&&Iz(t)&&N0(e,n)}function hu(e,t){return e.replace(/(^|[;\s])color:\s*[^;]*;?/i,`$1color: ${t};`)}function jn(e){return typeof e=="number"&&Number.isFinite(e)}function Wz(e){return!e||typeof e!="object"?!1:jn(e.all)||jn(e.top)||jn(e.right)||jn(e.bottom)||jn(e.left)}function qz(e,t){const n=jn(t.all)?t.all:void 0,r=jn(t.top)?t.top:n,o=jn(t.right)?t.right:n,i=jn(t.bottom)?t.bottom:n,s=jn(t.left)?t.left:n;r!==void 0&&(e.style.paddingTop=`${r}px`),o!==void 0&&(e.style.paddingRight=`${o}px`),i!==void 0&&(e.style.paddingBottom=`${i}px`),s!==void 0&&(e.style.paddingLeft=`${s}px`)}function x0(e,t){return Array.from(document.querySelectorAll("link[em-class]")).some(n=>n.getAttribute("em-class")===e&&(t===void 0||n.getAttribute("href")===t))}function O0(e){const t=document.querySelector("title");if(t){t.insertAdjacentElement("afterend",e);return}document.head.appendChild(e)}function R0(e){return e.stylesheet??bx(e.source_url)}function zz(e){return`/* ${`em-project-font-${xi(e.family)}-${e.weight}-${e.style}`} */
|
|
82
|
+
@font-face{font-family:${JSON.stringify(e.family)};src:url(${JSON.stringify(e.source_url)});font-weight:${e.weight};font-style:${e.style};font-display:swap;}`}var Uz=e=>g0({family:e.family,src:e.source_url,weight:e.weight,style:e.style});function jz(e,t){if(x0(t,e))return;const n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",e),n.setAttribute("em-class",t),O0(n)}function wa(e,t){const n=e.fontFamilyArray[1],r=e.fontFamilyArray[2],o=e.fontFamilyArray[3],i=fu(r,o);if(n==="Project Fonts"){const d=np(r),f=d[0];if(Ur("iframe: addFontFamilyClass Project Fonts",{fontFamilyArray:e.fontFamilyArray,emClass:i,entryFound:!!f,faces:d}),f){Fe();const h=document.querySelector('style[em="styles"]'),m=[...new Set(d.filter(R0).map(p=>p.source_url))];if(m.forEach(p=>jz(p,i)),h){const p=new Set(rp(h.textContent??"").map(g0)),S=d.filter(y=>!R0(y)).filter(y=>!p.has(Uz(y))).map(zz).join(`
|
|
83
|
+
`),C=S!=="";C&&h.insertAdjacentHTML("afterbegin",`${S}
|
|
84
|
+
`);const L=`.${y0(i)} {`,k=!h.textContent?.includes(L);if(k){const y=$c[o],g=(y||f.weight).replace(/i$/g,""),v=y?y.endsWith("i"):f.style!=="normal";let w=`font-family: ${JSON.stringify(f.family)}, ${p0(f)}!important;`;w+=` font-weight: ${g}!important;`,v&&(w+=" font-style: italic!important;"),h.insertAdjacentHTML("beforeend",`
|
|
85
|
+
${L} ${w} }`)}Ur("iframe: project font attached",{emClass:i,stylesheetUrls:m,faceInserted:C,classInserted:k})}else Ur("iframe: style[em=styles] not found — @font-face not injected");setTimeout(()=>{Ao({elem:document.documentElement},t),Vr(t),t&&t(!1)},0);return}Ur("iframe: Project Fonts entry missing in map — skip Google Fonts fallback",{fontFamily:r,mapSize:document.querySelectorAll('style[em="styles"]').length}),setTimeout(()=>{Ao({elem:document.documentElement},t),Vr(t)},0);return}if(!x0(i)){const d=document.createElement("link");d.setAttribute("rel","stylesheet");const f=$c[o]||"400",h=f.indexOf("i")>-1,m=f.replaceAll("i","");d.setAttribute("href",`https://fonts.googleapis.com/css2?family=${r}:ital,wght@${h?"1":"0"},${m}&display=swap`),d.setAttribute("em-class",i),O0(d)}Fe();const s=$c[o]||"400",a=s.replaceAll("i",""),l=s.indexOf("i")>-1;let c=`font-family: '${r}', ${C$[n]||"sans-serif"}!important;`;c+=` font-weight: ${a}!important;`,l&&(c+=" font-style: italic!important;");const u=document.querySelector('style[em="styles"]');u&&u.insertAdjacentHTML("beforeend",`
|
|
86
|
+
.${y0(i)} { ${c} }`),setTimeout(()=>{Ao({elem:document.documentElement},t),Vr(t)},0)}function Vz(e){const t=xi(e);return!!document.querySelector(`[class*="em-font-${t}-"], [class*="em-font-${t.toLowerCase()}-"]`)}function Vr(e){const t=document.querySelector('style[em="styles"]'),n=t?.textContent??"",r=rp(n).filter(o=>np(o.family).length>0&&!Vz(o.family));!t||r.length===0||(t.textContent=b0(n,r),Ur("iframe: clearProjectFontFaces removed stale @font-face",{removedFamilies:[...new Set(r.map(o=>o.family))]}),e&&e(!1))}function Ao(e,t){let n=!1;e.elem.querySelectorAll("link[em-class]").forEach(r=>{const o=r.getAttribute("em-class");o&&!document.querySelector("."+o)&&(n=!0,r.remove())}),n&&t&&t(!1)}function mp(e,t,n){t[0]==="Safe Fonts"?(e.style.fontFamily=t[1],Ao({elem:document.documentElement},n),Vr(n)):t[0]==="Google Fonts"&&(t[1]==="Sans Serif"?e.style.fontFamily="Helvetica, Arial, sans-serif":t[1]==="Serif"?e.style.fontFamily='"Times New Roman", Times, serif':t[1]==="Project Fonts"&&du(e,t[2]),e.classList.remove(...[...e.classList].filter(r=>r.startsWith("em-font"))),e.classList.add(fu(t[2],t[3])),wa({fontFamilyArray:t},n))}function M0(e,t){if(t){const n=e.querySelector("b");n?n.replaceWith(...n.childNodes):e.querySelector("strong")||(e.innerHTML="<strong>"+e.innerHTML+"</strong>")}else{const n=e.querySelector("strong"),r=e.querySelector("b");n?n.replaceWith(...n.childNodes):r&&r.replaceWith(...r.childNodes)}if(e.style.fontWeight){const n=e.getAttribute("style")?.replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"")||"";e.setAttribute("style",n)}}function P0(e,t){if(t){const n=e.querySelector("i");n?n.replaceWith(...n.childNodes):e.querySelector("em")||(e.innerHTML="<em>"+e.innerHTML+"</em>")}else{const n=e.querySelector("em"),r=e.querySelector("i");n?n.replaceWith(...n.childNodes):r&&r.replaceWith(...r.childNodes)}if(e.style.fontStyle){const n=e.getAttribute("style")?.replace(/(\s+)?font-style:(\s+)?.*?;/,"")||"";e.setAttribute("style",n)}}function I0(e,t){let n;t>0?n=e.style.letterSpacing?e.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${t}px`):e.getAttribute("style")+` letter-spacing: ${t}px;`:n=e.getAttribute("style")?.replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,"")||"",e.setAttribute("style",n)}function _a(e,t){e&&e.tagName==="TABLE"&&(e.classList.contains("em-vindent-table")||e.querySelector("td")?.innerHTML==="")&&e.querySelector("td")?.setAttribute("height",String(t))}function D0(e,t){const n=Eh(),r=e.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");return r.replaceChildren(...Ne(e.html)),r.querySelectorAll('[em="atom"] div[style*="font-family"]').forEach(o=>{const i=o;if(!i.style.display&&parseFloat(i.style.fontSize)<=20){const s=n.text?.fontFamily||[],a=hu((i.getAttribute("style")||"").replace(/font-size:(\s+)?.*?px/,`font-size: ${n.text?.fontSize||16}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${n.text?.lineHeight||24}px`),n.text?.color||"#000000");i.setAttribute("style",a),mp(i,s,t);const l=i.closest('[em="atom"] > tr > td');l?.style.paddingBottom?l.style.paddingBottom=(n.text?.paddingBottom||0)+"px":_a(i.nextElementSibling??i.closest("table")?.nextElementSibling,n.text?.paddingBottom||0)}else if(!i.style.display&&parseFloat(i.style.fontSize)>20){const s=n.headings?.fontFamily||[],a=hu((i.getAttribute("style")||"").replace(/font-size:(\s+)?.*?px/,`font-size: ${n.headings?.fontSize||24}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${n.headings?.lineHeight||32}px`),n.headings?.color||"#000000");i.setAttribute("style",a),mp(i,s,t),I0(i,n.headings?.letterSpacing||0),M0(i,n.headings?.bold||!1),P0(i,n.headings?.italic||!1);const l=i.closest('[em="atom"] > tr > td');l?.style.paddingTop?l.style.paddingTop=(n.headings?.paddingTop||0)+"px":_a(i.previousElementSibling,n.headings?.paddingTop||0),l?.style.paddingBottom?l.style.paddingBottom=(n.headings?.paddingBottom||0)+"px":_a(i.nextElementSibling,n.headings?.paddingBottom||0)}}),r.querySelectorAll('[em="atom"] a[style*="color"]').forEach(o=>{const i=o;if(i.style.display){if(i.style.display==="block"){const s=n.buttons?.fontFamily||[],a=hu((i.getAttribute("style")||"").replace(/font-size:(\s+)?.*?px/,`font-size: ${n.buttons?.fontSize||16}px`),n.buttons?.color||"#FFFFFF");i.setAttribute("style",a),mp(i,s,t);const l=i.closest("td"),c=!!l&&!!Fr(l)&&!Fr(i),u=c?i:l,d=n.buttons?.backgroundColor||"#1677FF";u&&(u.style.backgroundColor=d,u.tagName==="TD"&&u.setAttribute("bgcolor",d)),l&&l.setAttribute("align",n.buttons?.textAlign||"center"),I0(i,n.buttons?.letterSpacing||0),M0(i,n.buttons?.bold||!1),P0(i,n.buttons?.italic||!1);const f=i.closest('[em="atom"] > tr > td'),h=i.closest("table");f?.style.paddingTop?f.style.paddingTop=(n.buttons?.marginTop||0)+"px":h?.previousElementSibling&&_a(h.previousElementSibling,n.buttons?.marginTop||0),f?.style.paddingBottom?f.style.paddingBottom=(n.buttons?.marginBottom||0)+"px":h?.nextElementSibling&&_a(h.nextElementSibling,n.buttons?.marginBottom||0);const m=n.buttons?.padding||{};m.all&&(i.style.padding=m.all+"px"),m.top&&(i.style.paddingTop=m.top+"px"),m.right&&(i.style.paddingRight=m.right+"px"),m.bottom&&(i.style.paddingBottom=m.bottom+"px"),m.left&&(i.style.paddingLeft=m.left+"px"),u&&(n.buttons?.border&&up({settings:{border:n.buttons.border},elem:u}),n.buttons?.borderRadius&&Ri({settings:{borderRadius:n.buttons.borderRadius},elem:u})),c&&xh(i,{backgroundColor:d})}}else{const s=hu(i.getAttribute("style"),n.links?.color||"#0000FF");i.setAttribute("style",s);let a;n.links?.underline?a=i.style.textDecoration?i.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):i.getAttribute("style")+" text-decoration: underline;":a=i.style.textDecoration?i.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):i.getAttribute("style")+" text-decoration: none;",i.setAttribute("style",a)}}),r.querySelector('[em="block"]')&&n.block?.backgroundColor&&r.querySelectorAll('[em="block"]').forEach(o=>{ga(o).forEach(i=>{const s=i;s.setAttribute("bgcolor",n.block.backgroundColor),s.style.backgroundColor=n.block.backgroundColor})}),r.tagName==="DIV"?Nt(r):Nt(r.querySelector("tbody")||r)}function hp(e){const t=Eh(),n=e.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");n.replaceChildren(...Ne(e.html)),n.querySelector('[em="block"]')&&t.block?.backgroundColor&&n.querySelectorAll('[em="block"]').forEach(o=>{ga(o).forEach(i=>{const s=i;s.setAttribute("bgcolor",t.block.backgroundColor),s.style.backgroundColor=t.block.backgroundColor})});const r=t.block?.padding;return Wz(r)&&Array.from(n.querySelectorAll('[em="block"]')).flatMap(ga).forEach(o=>{qz(o,r)}),n.tagName==="DIV"?Nt(n):Nt(n.querySelector("tbody")||n)}var Gz=e=>{for(const t of Object.keys($c))if(xi(t)===e)return t;return e};function Xz(e){const t=document.querySelector('style[em="styles"]'),n=t?.textContent??"",r=new Set(np(e).filter(i=>i.stylesheet).map(i=>i.source_url)),o=rp(n).filter(i=>i.family.toLowerCase()===e.toLowerCase()&&r.has(i.src));t&&o.length&&(t.textContent=b0(n,o),Ur("iframe: dropped stylesheet @font-face",{family:e,count:o.length}))}function Kz(e){if(!Az())return;const t=document.head.innerHTML,n=new Set;for(const r of h0()){Xz(r.family);const o=`em-font-${xi(r.family)}-`;document.querySelectorAll(`[class*="${o}"]`).forEach(i=>{[...i.classList].forEach(s=>{if(!s.startsWith(o)||n.has(s))return;n.add(s);const a=s.slice(o.length),l=Gz(a);wa({fontFamilyArray:["Google Fonts","Project Fonts",r.family,l]})})})}n.size>0&&Ur("iframe: hydrated project @font-face from DOM classes",{classes:[...n],families:h0().map(r=>r.family)}),Vr(),e&&document.head.innerHTML!==t&&e(!1)}function Yz(e,t){const n=new Ee,r=()=>{requestAnimationFrame(()=>{Kz(t)})};return n.addDisposable(U.addListener(ue.SANDBOX_SET_PROJECT_FONTS,r)),n.addDisposable(e.onReady(r)),n}function B0(){U.send({operation:"sandbox_resized"})}function Zz(e,t){const n=new Ee,r=0;let o=0;n.addDisposable(t.beforeSave(()=>{o&&(clearTimeout(o),o=0)}));function i(){o||(o=setTimeout(()=>{B0(),o=0},r))}return n.addDisposable(e.onChange(s=>{const a=s.flatMap(function(l){return l.added.flatMap(c=>{if(En(c))return kO(c)?c:[...c.querySelectorAll("img")]})}).filter(l=>!!l).map(l=>l.complete?Promise.resolve():new Promise((c,u)=>{l.addEventListener("load",c),l.addEventListener("error",c)}));a.length&&Promise.all(a).then(i)})),window.addEventListener("resize",i),n.addDispose(()=>window.removeEventListener("resize",i)),n}function Qz(e=document,t=window){let n=e.body;const r=new MutationObserver(()=>{if(o(),e.body===n)return;n=e.body;const i=t.parentIFrame;i?.autoResize&&(i.autoResize(!1),n&&(i.autoResize(!0),i.size?.()))});function o(){r.disconnect(),r.observe(e,{childList:!0}),e.documentElement&&r.observe(e.documentElement,{childList:!0})}return o(),{dispose:()=>r.disconnect()}}var Jz=/^(?:ant|vscode|monaco|docs)-/;function eU(e){return Jz.test(e)}function tU(){const e="ub".trim();if(!/^[a-z][a-z0-9]*$/i.test(e))throw new Error(`[cssVars] REACT_APP_CSS_VAR_PREFIX="${e}" is not a valid CSS identifier fragment.`);return e}var nU=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function rU(){return nU}var oU=new Set;function iU(e,t,n=oU){return e.startsWith(`${t}-`)?!1:!eU(e)&&!n.has(e)}function sU(e,t){return`--${t}-${e}`}function aU(e){const t=tU();return iU(e,t,rU())?sU(e,t):`--${e}`}function lU(e){const t=new Ee;let n="";const r=o=>{document.querySelectorAll("style[em-variables]").forEach(a=>a.remove());const i=document.createElement("style");i.dataset.themeVaribalse="true";const s=Object.entries(o).map(([a,l])=>` ${aU(a)}: ${String(l)};
|
|
87
|
+
`).join("");if(s&&n!==s){n=s,i.innerHTML=`:root {
|
|
88
|
+
${s}}`;const a=document.querySelector('[data-theme-varibalse="true"]');if(a)a.replaceWith(i);else{const l=document.querySelector("head")||document.querySelector("body");l?.insertBefore(i,l.firstChild)}e.commit(!1)}};return t.addDisposable(e.onChange(()=>{if(!document.querySelector('[data-theme-varibalse="true"]')&&n){const o=document.createElement("style");o.dataset.themeVaribalse="true",o.innerHTML=`:root {
|
|
89
|
+
${n}}`;const i=document.querySelector("head")||document.querySelector("body");i?.insertBefore(o,i.firstChild),e.commit(!1)}})),t.addDisposable(U.addListener(ue.SANDBOX_SET_THEME_VARIABLES,r)),t}var H0=4e3;function cU(e){const t=window.requestIdleCallback;if(typeof t=="function"){t(e,{timeout:H0});return}window.setTimeout(e,H0)}function uU(e){const t=e.onDocumentShown(()=>{t.dispose(),cU(()=>{iS().catch(()=>{})})})}var dU={name:"sandbox.crossDomainDrag",setup:()=>cz()},fU={name:"sandbox.themeVariables",awaits:{services:[Y]},setup:e=>lU(M(e,Y))},mU={name:"sandbox.projectFonts",awaits:{services:[it,_e]},setup(e){Nz();const t=ft(e);Yz(M(e,it),n=>t(n))}},hU={name:"sandbox.pasteSanitizerPrewarm",awaits:{services:[$o]},setup:e=>uU(M(e,$o))},pU={name:"sandbox.variableSelection",setup:()=>pz()},gU={name:"sandbox.emReplaceCaret",awaits:{services:[Y]},setup:e=>_z(M(e,Y))},bU={name:"sandbox.resizeWatch",awaits:{services:[Y,it]},setup(e){Zz(M(e,Y),M(e,it)),Qz()}},yU={name:"sandbox.reset",awaits:{services:[Y]},setup:e=>HP(M(e,Y))},vU={name:"sandbox.correct",awaits:{services:[Y,st,it]},setup:e=>az(M(e,Y),M(e,st).controller,M(e,it))},EU={name:"sandbox.extensionScripts",awaits:{services:[Y,fs]},setup:e=>EF(M(e,Y),{surface:M(e,fs)})},SU={name:"sandbox.localization",provides:[Gd],awaits:{services:[Y]},setup:e=>e.inject(Gd,sz(M(e,Y)))};function wU(e=[]){return{name:"sandbox.extensions",awaits:{services:[st,fs,Y]},setup:t=>nz({container:t,focusController:M(t,st).controller,surface:M(t,fs),features:[...e]})}}function _U(e){const t=n=>function r(o,i=10){if(!CU(o)||i<0)return o;if(typeof o=="string")return n(o);if(o instanceof Array)return o.map(a=>r(a,i-1));const s=Object.entries(o).map(([a,l])=>[a,r(l,i-1)]);return Object.fromEntries(s)};return{escape:t(n=>e.escape(n,!0)),unescape:t(n=>e.unescape(n))}}function CU(e){return typeof e=="string"||typeof e=="object"&&e!==null&&!(e instanceof Element)}function F0(e){return/^(data|blob):/i.test(e.trimStart())}function $0(e,t){const n=/^(\s*)([\s\S]*?)(\s*)$/.exec(e);return!n||!n[2]?e:`${n[1]}${t(n[2])}${n[3]}`}function TU(e,t){try{let n="",r=0,o=0;for(;o<e.length;){for(;o<e.length&&/[\s,]/.test(e[o]);)o+=1;if(o>=e.length)break;const i=o;for(;o<e.length&&!/\s/.test(e[o]);)o+=1;let s=o;for(;s>i&&e[s-1]===",";)s-=1;if(n+=e.slice(r,i)+t(e.slice(i,s)),r=s,s!==o)continue;let a=0;for(;o<e.length&&(e[o]!==","||a>0);)e[o]==="("?a+=1:e[o]===")"&&(a=Math.max(0,a-1)),o+=1}return n+e.slice(r)}catch{return e}}function AU(e,t){return e.replaceAll(/url\((\s*['"]?)([^'")]+)(['"]?\s*)\)/gi,(n,r,o,i)=>`url(${r}${$0(o,t)}${i})`)}function pp(e,t,n){const r=e.toLowerCase();return r==="srcset"?TU(t,n):r==="style"?AU(t,n):$0(t,n)}var kU=["src","___src","background","poster","srcset","style"];function pu(e){return F0(e)?e:Oc(e)}function LU(){const e=new Map,t=n=>{if(F0(n))return n;const r=pu(n),o=e.get(r);return o?TF(r).replace(new RegExp(`${ta}=\\d+`),`${ta}=${o}`):n};return{transform:{name:"em-version",attributes:kU,render:(n,r)=>n&&pp(r.attribute,n,t),serialize:(n,r)=>n&&pp(r.attribute,n,pu)},requestReload(n){e.set(pu(n.trim()),String(Date.now()))},isPending(n){return e.has(pu(n.trim()))},clear(){e.clear()}}}var W0=["src","background","poster","srcset","style"];function gp(e,t=document){const n=W0.map(o=>`[${o}]`).join(","),r=[...t.querySelectorAll(n)];for(const o of r){const i=o.tagName.toLowerCase();for(const s of W0){const a=o.getAttribute(s);if(!a)continue;const l=e.serialize(a,{element:o,tag:i,attribute:s,stage:"apply"})??a,c=gh(o,s,l,{pipeline:e,stage:"apply"});c===null?a!==l&&o.removeAttribute(s):c!==a&&o.setAttribute(s,c)}}}function NU(e,t){const{pipeline:n,htmlDocument:r}=t,o=LU(),i=n.register(o.transform),s={reload(a){a&&(o.requestReload(a),r.renderOnly(()=>gp(n)))},clear(){o.clear()}};return e.inject(Vd,s),{reload:s,dispose(){i.dispose(),o.clear(),yn(e,Vd)}}}var xU=["https://emcdn.ru/843/20220715_113006_18.png","https://cdn.useblocks.io/843/230110_18_kXn4Evf.png"],OU="/static/media/",RU="empty-image";function MU(e){return e.replace(/[.-][A-Za-z0-9_-]{7,20}$/,"")}function q0(e){let t;try{t=new URL(e,document.baseURI).pathname}catch{return null}return t.includes(OU)?t:null}function PU(e){return!!e&&q0(e)!==null}function IU(e){if(!e)return!1;if(xU.includes(e))return!0;const t=q0(e);return t===null?!1:MU(t.slice(t.lastIndexOf("/")+1).replace(/\.[^.]+$/,""))===RU}var DU=1e4;function BU(e=DU){const t=new Map,n=new Map,r=(o,i)=>{URL.revokeObjectURL(i.blobUrl),t.delete(o)};return{acquire(o,i){const s=t.get(o);if(s)return s.revokeTimer&&(clearTimeout(s.revokeTimer),s.revokeTimer=void 0),s.refs+=1,s.blobUrl;const a=URL.createObjectURL(i);return t.set(o,{blobUrl:a,refs:1}),n.set(a,o),a},release(o){const i=t.get(o);i&&(i.refs-=1,!(i.refs>0||i.revokeTimer)&&(i.revokeTimer=setTimeout(()=>r(o,i),e)))},peek(o){return t.get(o)?.blobUrl},sourceOf(o){return n.get(o)},forget(o){const i=t.get(o);i&&(i.revokeTimer&&clearTimeout(i.revokeTimer),r(o,i))},get size(){return t.size},dispose(){for(const[o,i]of Array.from(t))i.revokeTimer&&clearTimeout(i.revokeTimer),r(o,i);n.clear()}}}var HU=3e3,FU=["src","___src","background","poster","srcset","style"],bp=e=>e.startsWith("blob:"),gu="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%220%22%20height%3D%220%22%2F%3E#em-wait=";function $U(e){const t=encodeURIComponent(e).replace(/[!'()*]/g,n=>`%${n.charCodeAt(0).toString(16).toUpperCase()}`);return`${gu}${t}`}var WU=new RegExp(String.raw`blob:[^\s"'()<>]+|`+gu.replace(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)+String.raw`[^\s"'()<>]*`,"g");function z0(e){if(e.startsWith(gu))try{return decodeURIComponent(e.slice(130))}catch{return}}function qU(e){const t=e.attribute.toLowerCase();if(t==="background"||t==="style"||t==="poster")return!0;const n=(e.element?.tagName??e.tag??"").toLowerCase();return n===""?!1:WP(n)}function zU(e){try{return new URL(e,document.baseURI).hostname}catch{return}}function UU(e){const t=e.store??BU(),n=e.answerTimeoutMs??HU,r=new Map,o=new Set;let i={enabled:!1,sourceHosts:[]},s=!1,a=!1;const l={hits:0,misses:0,refused:0,failed:0},c=m=>{const p=zU(m);return p?p===window.location.hostname||i.sourceHosts.includes(p):!1},u=(m,p=!1)=>{if(r.has(m)||!p&&(o.has(m)||t.peek(m)))return;const S=U.sendAsync(ue.APPLICATION_CANVAS_IMAGE_GET,p?{url:m,fresh:p}:{url:m}).then(L=>{const k=L;if(k&&"blob"in k){t.acquire(m,k.blob),l.hits+=1;return}o.add(m),l.refused+=1}).catch(()=>{o.add(m),l.failed+=1}),C=Promise.race([S,new Promise(L=>{setTimeout(()=>{r.has(m)&&(s=!0,o.add(m),l.failed+=1),L()},n)})]).then(()=>{r.delete(m),e.refresh()});r.set(m,C)},d=m=>{const p=z0(m);if(p!==void 0)return d(p);if(!m||a||bp(m)||m.startsWith("data:")||PU(m))return m;const S=t.peek(m);return S||(s||!i.enabled||o.has(m)||!c(m)?m:(l.misses+=1,u(m),$U(m)))},f=m=>bp(m)?t.sourceOf(m)??m:z0(m)??m,h=(m,p,S)=>pp(p.attribute,m,S);return{configure(m){i={enabled:m.enabled,sourceHosts:[...m.sourceHosts??[]]}},transform:{name:"image-cache",attributes:FU,render:(m,p)=>m&&qU(p)?h(m,p,d):m,serialize:(m,p)=>m&&h(m,p,f)},forget(m){t.forget(m),o.delete(m),!a&&u(m,!0)},fail(m){const p=t.sourceOf(m);return p===void 0||t.peek(p)!==m?!1:(o.add(p),t.forget(p),l.failed+=1,!0)},block(){a=!0},restoreUrls(m){return yp(m,f)},stats(){return{...l,blobs:t.size}},dispose(){t.dispose(),r.clear(),o.clear()}}}function jU(e,t,n){let r=!1;const o=s=>{const a=s;r||!String(a.blockedURI??"").startsWith("blob")||a.effectiveDirective!=="img-src"||(r=!0,t.block(),n())},i=s=>{const a=s.target,l=a?.currentSrc||a?.src||"";bp(l)&&t.fail(l)&&n()};return e.addEventListener("securitypolicyviolation",o),e.addEventListener("error",i,!0),{dispose:()=>{e.removeEventListener("securitypolicyviolation",o),e.removeEventListener("error",i,!0)}}}function VU(e,t){return!e.includes("blob:")&&!e.includes(gu)?e:e.replace(WU,n=>t(n))}function yp(e,t){if(typeof e=="string")return VU(e,t);if(Array.isArray(e)){let n=!1;const r=e.map(o=>{const i=yp(o,t);return n||(n=i!==o),i});return n?r:e}if(e&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype){let n=!1;const r={};for(const[o,i]of Object.entries(e)){const s=yp(i,t);n||(n=s!==i),r[o]=s}return n?r:e}return e}function GU(e,t){const{pipeline:n,htmlDocument:r}=t,o=()=>r.renderOnly(()=>gp(n)),i=UU({refresh:o}),s=jU(document,i,o),a=n.register(i.transform),l=U.addListener(ue.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,u=>{i.configure(u),r.renderOnly(()=>gp(n))}),c=U.setOutgoingFilter(u=>i.restoreUrls(u));return e.inject(fl,i),{cache:i,dispose(){s.dispose(),c(),l.dispose(),a.dispose(),i.dispose(),yn(e,fl)}}}function XU(e,t){const n=new fP,r=new Ol,o=new mP(n,r),i=new DM(r,n,{prepareHtml:t.prepareHtml,serviceMarkup:M_,mapHTMLRoots:e.mapHTMLRoots,...e.createRoot?{createRoot:e.createRoot}:{},...e.rootsParent?{rootsParent:e.rootsParent}:{}});i.addDisposable(new bP(i,o,n));const s=e.beforeCommit,a=s?i.beforeCommit(()=>s(i)):void 0,l=S2((c,u,d)=>i.applyForeignOutput(c,u,d));return{htmlDocument:i,remoteDocument:n,textDocument:r,documentMapping:o,onDocumentShown:c=>n.onReady(()=>c()),onDocumentReplaced:c=>n.onEntitySet(u=>c(u)),commit:c=>i.commit(c),commitLockedAsync:async c=>{const u=t.lock?.acquire();try{await i.commit(c,!0)}finally{u?.release()}},dispose(){a?.dispose(),l(),i.dispose(),n.dispose(),r.dispose()}}}function KU(e,t){const n=XU(t,{prepareHtml:M(e,ml),lock:e.getInstance(xe)}),r={commit:i=>n.commit(i),commitLockedAsync:i=>n.commitLockedAsync(i)},o=YD();return e.inject(ds,t),e.inject(it,n.remoteDocument),e.inject(us,n.textDocument),e.inject(gn,n.documentMapping),e.inject(Y,n.htmlDocument),e.inject(_e,r),{...n,dispose(){o.dispose(),n.dispose(),yn(e,ds),yn(e,it),yn(e,us),yn(e,gn),yn(e,Y),yn(e,_e)}}}function YU(){const e=new Set,t=new Set;let n=0;const r=()=>{t.forEach(i=>{try{i()}catch{}})},o=()=>{e.size===0&&n===0&&r()};return{acquire(){const i={suspended:!1};e.add(i);const s=()=>{e.delete(i)&&o()};return{release:s,releaseLater(){Promise.resolve().then(s)}}},isLocked(){for(const i of e)if(!i.suspended)return!0;return!1},lift(i){let s;for(const a of e)a.suspended||(s=a);if(!s)return i();s.suspended=!0,n+=1;try{return i()}finally{s.suspended=!1,n-=1,o()}},onReleased(i){const s=()=>i();return t.add(s),()=>t.delete(s)}}}var ZU=YU();function QU(e){e.inject(Zb,V),e.inject(xe,ZU),e.inject(Ye,Gf)}var JU=2e3;function ej(){return Math.random().toString(36).slice(2,10)}function tj(e){const t=`${e.session??ej()}.`;let n=new Map,r=new WeakMap,o=e.entityId(),i=0;const s=()=>{n=new Map,r=new WeakMap},a=()=>{for(const[d,f]of n)f.deref()||n.delete(d)},l=d=>d.isConnected&&e.isInLetter(d),c=d=>{const f=new Set;for(const h of d)for(let m=h;m&&!f.has(m);m=m.parentNode)f.add(m);for(const[h,m]of n){const p=m.deref();(!p||f.has(p))&&(n.delete(h),p&&r.delete(p))}},u=[e.onEntitySet(d=>{d!==o&&(o=d,s())}),e.onHostChange?.(c)];return{issue(d){if(!l(d))return;const f=r.get(d);if(f&&n.get(f)?.deref()===d)return f;n.size>=JU&&a(),i+=1;const h=`${t}${i.toString(36)}`;return n.set(h,new WeakRef(d)),r.set(d,h),h},sync(){e.flush()},resolve(d){if(typeof d!="string"||!d.startsWith(t))return;e.flush();const f=n.get(d)?.deref();return f&&l(f)?f:void 0},dispose(){u.forEach(d=>d?.dispose()),s()}}}function nj(e){return e.flatMap(t=>{switch(t.type){case"Update":return[];case"Add":case"Move":return t.parent?[t.parent]:[];default:return"node"in t?[t.node]:[]}})}function rj(e,t){return tj({isInLetter:n=>e.isInLetter(n),flush:()=>e.flushCommit(),entityId:()=>e.entityId,onEntitySet:n=>t.onEntitySet(n),onHostChange:n=>e.beforeChange(({domMutations:r})=>n(nj(r)))})}var oj=class extends Ee{get isEditorInFocus(){return!!this._isEditorInFocus}constructor(e){super(),A(this,"_isEditorInFocus",!1),A(this,"_context",new Map),A(this,"_editorLostFocusEmitter",this.addDisposable(new ge)),A(this,"_summaries",[]),A(this,"_onChange",t=>{this._isEditorInFocus&&this._summaries.push(...t)}),A(this,"editorLostFocus",this._editorLostFocusEmitter.event),this.addDisposable(e.onChange(this._onChange))}setFocus(e){this._isEditorInFocus!==e&&(this._isEditorInFocus=e,e||(this._editorLostFocusEmitter.fire(this._summaries),this._summaries=[],this._context.clear()))}whenEditorLostFocusAsync(e){return new Promise(t=>this.whenEditorLostFocus(t,e))}whenEditorLostFocus(e,t){if(this._isEditorInFocus){const n=this._editorLostFocusEmitter.once(e);if(t!==void 0){const r=this._context.get(t);r&&r.dispose(),this._context.set(t,n)}}else e([])}};function ij(e,t){const{htmlDocument:n,remoteDocument:r}=t,o=new oj(n);let i;const s=r.beforeSave(c=>{o.isEditorInFocus&&(i=i||c.value,c.preventDefault())}),a=()=>{typeof i=="boolean"&&(r.saveChanges(i),i=void 0)},l={controller:o,setEditorFocus(c){o.isEditorInFocus!==c&&(c&&a(),o.setFocus(c),c||a())},dispose(){s.dispose(),o.dispose(),yn(e,st)}};return e.inject(st,l),l}var sj={name:"sandbox.state",provides:[Zb,xe,Ye],setup:QU},aj={name:"sandbox.attributePipeline",provides:[Ho],setup:GF},lj={name:"sandbox.documentSync",provides:[Y,it,us,gn,_e,$o],awaits:{services:[ds,ml,xe]},setup:e=>e.inject($o,KU(e,M(e,ds)))},cj={name:"sandbox.images",provides:[fl,Vd],awaits:{services:[Ho,Y,$o]},setup(e){const t=M(e,Ho),n=M(e,Y);GU(e,{pipeline:t,htmlDocument:n});const r=NU(e,{pipeline:t,htmlDocument:n}).reload;M(e,$o).onDocumentReplaced(()=>r.clear()),U.addListener(ue.SANDBOX_IMAGE_RESET,({url:o})=>{o&&(e.getInstance(fl)?.forget(o),r.reload(o))})}},uj={name:"sandbox.mapObj",provides:[Wo],awaits:{services:[gn]},setup:e=>e.inject(Wo,_U(M(e,gn)))},dj={name:"sandbox.elementRefs",provides:[Fo],awaits:{services:[Y,it]},setup:e=>e.inject(Fo,rj(M(e,Y),M(e,it)))},fj={name:"sandbox.focus",provides:[st],awaits:{services:[Y,it]},setup:e=>ij(e,{htmlDocument:M(e,Y),remoteDocument:M(e,it)})},mj={name:"sandbox.app",provides:[p_,dh],setup(e){e.getOrCreateInstance(dh,()=>new Yb),e.injectFactory(p_,()=>Zs.instance)}},hj=[mj,sj,aj,lj,cj,TI,AI,kI,uj,dj,fj,dU,fU,mU,pU,gU,bU,yU,vU,EU,SU,hU,Jq,ez,tz,...tD],vp=null,Ep=0,pj=6e5;function gj(e){vp=e,Ep=e?Date.now():0}function U0(){const e=vp,t=Ep;return vp=null,Ep=0,!e||!t||Date.now()-t>pj||!e.isConnected||!e.matches('[em="block"]')?null:e}function bj(e,t){const n=t.getOuterHtml(e),r=document.implementation.createHTMLDocument("").body,o=r.ownerDocument.createElement(e.tagName==="TR"?"table":"div");document.querySelectorAll("style").forEach(a=>{const l=t.getOuterHtml(a);l&&o.insertAdjacentHTML("beforeend",l)}),o.insertAdjacentHTML("beforeend",`
|
|
90
|
+
`);const i=Ne(n)[0];if(!i)return null;i.querySelectorAll("style").forEach(a=>{a.remove()}),i.classList.remove("em-structure"),i.querySelectorAll(".em-structure").forEach(a=>a.classList.remove("em-structure")),o.appendChild(i),e.querySelectorAll('[class*="em-font-"]').forEach(a=>{const l=[...a.classList].find(c=>c.startsWith("em-font-")&&c!=="em-font-custom");if(l){const c=`link[em-class="${l}"]`;!o.querySelector(c)&&document.querySelector(c)&&(o.insertAdjacentHTML("afterbegin",`
|
|
91
|
+
`),o.prepend(document.querySelector(c).cloneNode(!0)))}}),r.append(o),u_(r,[...r.querySelectorAll("style")],{forceMediaMerge:!0});let s=It(r);return e.tagName==="TR"?s=s.replaceAll(/<body(.|\n|\r)*?><table>/gi,"").replaceAll(/<\/table><\/body>/gi,""):s=s.replaceAll(/<body(.|\n|\r)*?><div>/gi,"").replaceAll(/<\/div><\/body>/gi,""),s=s.replaceAll(/html {((.|\n|\r)*?)}/gi,"").replaceAll(/<style[^>]*>\s*<\/style>/gi,""),s}function yj(e,t){const{HTMLDocument:n,messageService:r}=t,o=e.closest('[em="block"]');if(!o)return;const i=bj(o,n);if(!i)return;gj(o);const s=o.getAttribute("em-block-id"),a=o.getAttribute("em-block-version");r.send({operation:"application_eblock_add",data:Dc({html:i.trim(),isBlock:!0}),settings:{...s?{emBlockId:s}:{},...a?{emBlockVersion:a}:{}}})}function bu(e){const t=document.querySelector(".em-element-editor:not(.of-atom)");if(!t)return;const n=(t.closest('[em="block"]')||t.closest('[em="group"]'))?.getBoundingClientRect().top||0;if(e.scrollTop>n+55){const r=e.scrollTop-n;t.style.top=r+8+"px"}else t.style.removeProperty("top")}function yu(e){const t=document.querySelector(".em-element-editor");if(!t)return;const n=t.getBoundingClientRect(),r=document.querySelector(".em-element-editor-widget");r&&(n.top<0?r.classList.add("sticky"):r.classList.remove("sticky"),n.top+t.offsetHeight-10-r.offsetHeight<0&&r.classList.remove("sticky"),e(!1))}var Je=()=>Ql(window.getSelection()?.toString())??"",vj=[{type:"in-line-style",name:"color"},{type:"in-line-style",name:"border-color"},{type:"in-line-style",name:"background-color"},{type:"attribute",name:"bgcolor"}],Ej={"in-line-style":e=>({selector:`[style~="${e}:"]`,toColor:t=>window.getComputedStyle(t).getPropertyValue(e)}),attribute:e=>({selector:`[${e}]`,toColor:t=>t.getAttribute(e)})},Sj=/^#[\da-f]{6}$/i,j0=()=>[...new Set(vj.flatMap(wj).map(G).filter(e=>Sj.test(e)).map(e=>e.toUpperCase()))];function wj({type:e,name:t}){const n=Ej[e],{selector:r,toColor:o}=n(t);return Array.from(document.querySelectorAll(r)).map(o)}function V0(e){return e.filter(t=>!xc.includes(t))}function _j(e){return xc.some(t=>e.classList.contains(t))?(e.classList.remove(...xc),e.classList.length||e.removeAttribute("class"),!0):!1}function Cj(e){return Array.from(e.rows).flatMap(t=>[t,...Array.from(t.cells)]).map(_j).includes(!0)}function Tj(e){const t=[];let n="",r=0,o=0;for(let i=0;i<e.length;i++){const s=e[i];n?s==="\\"?i++:s===n&&(n=""):s==='"'||s==="'"?n=s:s==="("?r++:s===")"?r=Math.max(0,r-1):s===";"&&r===0&&(t.push(e.slice(o,i)),o=i+1)}return t.push(e.slice(o)),t}function G0(e){return Tj(e??"").flatMap(t=>{const n=t.indexOf(":"),r=t.slice(0,Math.max(n,0)).trim();return r?[{name:r,value:t.slice(n+1).trim()}]:[]})}var Gr=["top","right","bottom","left"],X0=["width","style","color"];function Sp(e,t){return e===t?Gr:Gr.filter(n=>e===`${t}-${n}`)}function Aj(e,t){const n=e.toLowerCase();if(t==="padding")return Sp(n,"padding");const[r,o,i,...s]=n.split("-");return r!=="border"||s.length?[]:o===void 0||i===void 0&&X0.includes(o)?Gr:i===void 0||X0.includes(i)?Gr.filter(a=>a===o):[]}function vu(e,t,n){const r=[];let o=-1,i=0;for(const a of e){const l="managed"in a?[]:Aj(a.name,t);if("managed"in a?a.managed===t:l.length>0&&l.every(c=>n.includes(c))){o=o<0?r.length:o;continue}r.push(a),i=l.some(c=>n.includes(c))?r.length:i}const s=Math.max(o<0?r.length:o,i);return[...r.slice(0,s),{managed:t},...r.slice(s)]}var kj=['[contenteditable="false"]',".em-element-editor",'[class^="em-element-editor"]',".em-vindent"];function Lj(e){return!!e.closest("editor.em-text")}function Nj(e){e.querySelectorAll(kj.join(",")).forEach(t=>{Lj(t)||t.remove()})}function xj(e){e.querySelectorAll("editor").forEach(t=>{const n=Array.from(t.childNodes);if(t.parentNode!==e||t.querySelector("div")){t.replaceWith(...n);return}const r=t.ownerDocument.createElement("div");r.append(...n),t.replaceWith(r)})}var Oj=".em-element-resize-img, .em-element-img-change-group";function Rj(e){e.querySelectorAll(Oj).forEach(t=>t.remove()),e.querySelectorAll("span.em-element-resize-img-container").forEach(t=>t.replaceWith(...Array.from(t.childNodes)))}function Mj(e){const t=e.cloneNode(!0);return nn(e,t),ti(t),Nj(t),Rj(t),xj(t),Ke(t)}function Eu(e){if(!e)return;const t=e.trim().match(/^(-?\d+(?:\.\d+)?)px$/i);return t?Number(t[1]):void 0}function Pj(e){if(!e)return;const t=e.trim().split(/\s+/);if(t.length<3)return;const n=Eu(t[0]),r=t[1],o=t.slice(2).join(" ");if(n!==void 0&&["none","solid","dashed","dotted","double"].includes(r))return{width:n,style:r,color:o}}function Ij(e,t,n){const r=t.split(/\s+/).map(Eu),o=Sp(e,"padding"),i=e==="padding"?4:1;if(!o.length||r.length>i||r.some(f=>f===void 0))return!1;const[s,a=s,l=s,c=a]=r,u={top:s,right:a,bottom:l,left:c},d={...n.padding};return o.forEach(f=>d[f]=u[f]),n.padding=d,!0}function Dj(e,t,n){const r=Pj(t);if(!r)return!1;const o={...n.borders};return Sp(e,"border").forEach(i=>o[i]={...r}),n.borders=o,!0}function Xr(e,t,n){return n===void 0||n===""?!1:(e[t]=n,!0)}var Bj={"font-family":{family:"font-family",consume:(e,t,n)=>Xr(n,"fontFamily",t)},"font-size":{family:"font-size",consume:(e,t,n)=>Xr(n,"fontSize",Eu(t))},"line-height":{family:"line-height",consume:(e,t,n)=>Xr(n,"lineHeight",Eu(t))},color:{family:"color",consume:(e,t,n)=>Xr(n,"color",K0(t))},"background-color":{family:"background-color",consume:(e,t,n)=>Xr(n,"backgroundColor",K0(t))},"text-align":{family:"text-align",consume:(e,t,n)=>Xr(n,"textAlign",Hj(t))},"vertical-align":{family:"vertical-align",consume:(e,t,n)=>Xr(n,"verticalAlign",Fj(t))},"border-radius":{family:"border-radius",consume:(e,t,n)=>Xr(n,"borderRadius",$j(t))},...Object.fromEntries(["padding",...Gr.map(e=>`padding-${e}`)].map(e=>[e,{family:"padding",consume:Ij}])),...Object.fromEntries(["border",...Gr.map(e=>`border-${e}`)].map(e=>[e,{family:"border",consume:Dj}]))};function K0(e){if(e)return e.trim()}function Hj(e){if(!e)return;const t=e.trim().toLowerCase();return["left","center","right","justify"].find(n=>n===t)}function Fj(e){if(!e)return;const t=e.trim().toLowerCase();return["top","middle","bottom"].find(n=>n===t)}function $j(e){if(!e)return;const t=e.trim().replace(/\s+/g," ");if(t&&/^(\d+(\.\d+)?\s*(px|em|rem|%|pt)\s*){1,4}$/i.test(t))return t}function Wj(e){const t={},n=[],r=new Set;for(const o of G0(e.getAttribute("style"))){const i=o.name.toLowerCase(),s=Bj[i];s?.consume(i,o.value,t)?r.has(s.family)||(r.add(s.family),n.push({managed:s.family})):n.push(o)}return{style:Object.keys(t).length?t:void 0,styleEntries:n}}function qj(e){const t=e.getAttribute("align")?.toLowerCase();if(t==="left"||t==="center"||t==="right")return t}function zj(e){const t=e.getAttribute("valign")?.toLowerCase();if(t==="top"||t==="middle"||t==="bottom")return t}var Uj=["rowspan","colspan","class","style"];function Su(e){return Array.from(e.attributes).filter(t=>!CF.includes(t.name)).map(t=>({name:t.name,value:t.value}))}function jj(e,t,n){return Su(e).filter(({name:r})=>!Uj.includes(r)&&!(r==="align"&&t)&&!(r==="valign"&&n))}function Vj(e){return Su(e).flatMap(t=>{if(t.name!=="class")return[t];const n=t.value.split(/\s+/).filter(Boolean),r=V0(n);return r.length===n.length?[t]:r.length?[{name:"class",value:r.join(" ")}]:[]})}function Y0(e){const t=e.parentElement?.tagName;return t==="THEAD"?"thead":t==="TFOOT"?"tfoot":"tbody"}function Gj(e){const t=[];for(let n=0;n<e.length;){let r=n+1;for(;r<e.length&&e[r].parentElement===e[n].parentElement;)r++;t.push(...Array(r-n).fill(r)),n=r}return t}function Xj(e,t){const n=qj(e),r=zj(e);return{...t,contentHtml:Mj(e),classList:Array.from(e.classList),tag:e.tagName==="TH"?"th":"td",attrs:jj(e,n,r),...Wj(e),align:n,valign:r}}function Kj(e,t){for(let o=t.row;o<t.row+t.rowspan;o++)for(let i=t.col;i<t.col+t.colspan;i++){var n,r;(n=e[o])[r=i]??(n[r]=t.id)}}function Yj(e){const t=Gj(e),n=e.map(()=>[]),r=[];e.forEach((i,s)=>{let a=0;for(const l of Array.from(i.cells)){for(;n[s][a];)a++;const c=t[s]-s,u=l.rowSpan===0?c:Math.min(Math.max(1,l.rowSpan||1),c),d=Math.max(1,l.colSpan||1),f=Xj(l,{id:`cell-${r.length}`,row:s,col:a,rowspan:u,colspan:d});r.push(f),Kj(n,f),a+=d}});const o=Math.max(0,...n.map(i=>i.length));return{cells:r,cols:o,grid:n.map(i=>Array.from({length:o},(s,a)=>i[a]??null))}}function Zj(e,t){const n={};for(const r of t){const o=Y0(r);o!=="tbody"&&r.parentElement&&!n[o]&&(n[o]=Su(r.parentElement))}return{attrs:Su(e),...Object.keys(n).length?{sectionAttrs:n}:{}}}function wp(e,t){const n=Number(/^cell-(\d+)$/.exec(t)?.[1]??NaN);return Array.from(e.rows).flatMap(r=>Array.from(r.cells))[n]}function Ca(e,t){const n=Array.from(e.rows).flatMap(r=>Array.from(r.cells)).indexOf(t);return n<0?void 0:`cell-${n}`}function Mi(e){const t=Array.from(e.rows),n=t.map(r=>({section:Y0(r),attrs:Vj(r)}));return{rows:t.length,...Yj(t),rowsMeta:n,meta:Zj(e,t)}}function Z0(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}var wu=["top","right","bottom","left"];function Qj(e){if(!e)return[];const t=wu.map(n=>e[n]);return t[0]!==void 0&&t.every(n=>n===t[0])?[`padding: ${t[0]}px`]:wu.flatMap(n=>e[n]===void 0?[]:[`padding-${n}: ${e[n]}px`])}function Q0(e){return`${e.width}px ${e.style} ${e.color}`}function Jj(e,t){return!!e&&e.width===t.width&&e.style===t.style&&e.color===t.color}function eV(e){if(!e)return[];const{top:t}=e;return t&&wu.every(n=>Jj(e[n],t))?[`border: ${Q0(t)}`]:wu.flatMap(n=>{const r=e[n];return r?[`border-${n}: ${Q0(r)}`]:[]})}function tV(e){const t=new Map;if(!e)return t;const n=[["font-family",e.fontFamily?[`font-family: ${e.fontFamily}`]:[]],["font-size",e.fontSize===void 0?[]:[`font-size: ${e.fontSize}px`]],["line-height",e.lineHeight===void 0?[]:[`line-height: ${e.lineHeight}px`]],["color",e.color?[`color: ${e.color}`]:[]],["background-color",e.backgroundColor?[`background-color: ${e.backgroundColor}`]:[]],["text-align",e.textAlign?[`text-align: ${e.textAlign}`]:[]],["vertical-align",e.verticalAlign?[`vertical-align: ${e.verticalAlign}`]:[]],["border-radius",e.borderRadius?[`border-radius: ${e.borderRadius}`]:[]],["padding",Qj(e.padding)],["border",eV(e.borders)]];for(const[r,o]of n)o.length&&t.set(r,o);return t}function nV(e){const t=tV(e.style),n=[];for(const r of e.styleEntries)"managed"in r?(n.push(...t.get(r.managed)??[]),t.delete(r.managed)):n.push(`${r.name}: ${r.value}`);return t.forEach(r=>n.push(...r)),n.join("; ")}function _u(e){return e.map(({name:t,value:n})=>` ${Z0(t)}="${Z0(n)}"`).join("")}function rV(e){const t=[["rowspan",e.rowspan>1?String(e.rowspan):void 0],["colspan",e.colspan>1?String(e.colspan):void 0],["align",e.align],["valign",e.valign],["class",e.classList.filter(Boolean).join(" ")||void 0],["style",nV(e)||void 0]].flatMap(([n,r])=>r===void 0?[]:[{name:n,value:r}]);return`<${e.tag}${_u([...t,...e.attrs])}>${e.contentHtml}</${e.tag}>`}function oV(e,t,n){const r=e.grid[t].flatMap((o,i)=>{const s=o?n.get(o):void 0;return s&&s.row===t&&s.col===i?[rV(s)]:[]});return`<tr${_u(e.rowsMeta[t]?.attrs??[])}>${r.join("")}</tr>`}function iV(e,t){let n="";for(let r=0;r<t.length;){const o=e.rowsMeta[r]?.section??"tbody";let i=r+1;for(;i<t.length&&(e.rowsMeta[i]?.section??"tbody")===o;)i++;const s=t.slice(r,i).join("");n+=o==="tbody"?s:`<${o}${_u(e.meta?.sectionAttrs?.[o]??[])}>${s}</${o}>`,r=i}return n}function J0(e){if(e.rows===0||e.cols===0||!e.cells.length)return"<table></table>";const t=new Map(e.cells.map(r=>[r.id,r])),n=e.grid.map((r,o)=>oV(e,o,t));return`<table${_u(e.meta?.attrs??[])}>${iV(e,n)}</table>`}function yt(e){return{rejected:e}}function _p(e){return"rejected"in e}function pr(e,t){return e.cells.find(n=>n.id===t)}function Pi(e,t,n){const r=e.grid[t]?.[n];return r?pr(e,r):void 0}function Cp(e){let t=-1;for(const n of e.cells){const r=/^cell-(\d+)$/.exec(n.id);t=r?Math.max(t,Number(r[1])):t}return()=>`cell-${++t}`}function sV(e){return Cp(e)()}function aV(e,t,n){if(!(n.rowspan>=1&&n.colspan>=1&&n.row>=0&&n.col>=0&&n.row+n.rowspan<=e.length&&n.col+n.colspan<=t))return!1;for(let r=n.row;r<n.row+n.rowspan;r++)for(let o=n.col;o<n.col+n.colspan;o++){if(e[r][o]!==null)return!1;e[r][o]=n.id}return!0}function Ii(e){const t=Array.from({length:e.rows},()=>Array(e.cols).fill(null)),n=new Set;for(const r of e.cells){if(n.has(r.id)||!aV(t,e.cols,r))return yt("invalid-layout");n.add(r.id)}return e.rowsMeta.length!==e.rows?yt("invalid-layout"):{...e,grid:t}}function gr(e){return JSON.parse(JSON.stringify(e))}function lV(e,t){return new DOMParser().parseFromString(e,"text/html").body.firstChild?.nodeType===Node.ELEMENT_NODE?dV(e,t):" "}function cV(e){const t=gr(e);return t.contentHtml=lV(e.contentHtml," "),t.classList=V0(t.classList),t.attrs=t.attrs.filter(n=>n.name!=="id"),t}function uV(e){return{...e,contentHtml:v_,classList:[""],tag:"td",attrs:[],styleEntries:[],align:"center",valign:"top",style:{}}}function Cu(e,t){return e?{...cV(e),...t}:uV(t)}function eT(e){if(e.nodeType===Node.TEXT_NODE){const t=e.textContent||"";return!t||/^\s*$/.test(t.replace(/\u00A0/g,"X"))}return e.nodeType!==Node.ELEMENT_NODE?!0:Array.from(e.childNodes).every(t=>eT(t))}function dV(e,t){if(typeof e!="string"||typeof t!="string")return e;const n=new DOMParser().parseFromString(e,"text/html").body.firstChild;if(!n)return e;let r=!1;function o(s){if(s.nodeType===Node.TEXT_NODE&&s.textContent?.trim()){r?s.textContent="":(s.textContent=t,r=!0);return}for(const a of Array.from(s.childNodes))o(a)}function i(s,a=!1){if(s.nodeType!==Node.ELEMENT_NODE)return;const l=Array.from(s.childNodes);for(const c of l)i(c);!a&&eT(s)&&s.parentNode?.removeChild(s)}return o(n),i(n,!0),n.outerHTML||e}function fV(e){return e?{section:e.section,attrs:e.attrs.filter(t=>t.name!=="id")}:{section:"tbody",attrs:[]}}function tT(e,t,n){const r=gr(e),o=new Set;for(const s of r.cells)if(s.row<t&&t<s.row+s.rowspan){s.rowspan+=1;for(let a=s.col;a<s.col+s.colspan;a++)o.add(a)}else s.row>=t&&(s.row+=1);const i=Cp(e);for(let s=0;s<r.cols;s++)o.has(s)||r.cells.push(Cu(Pi(e,n,s),{id:i(),row:t,col:s,rowspan:1,colspan:1}));return r.rowsMeta.splice(t,0,fV(e.rowsMeta[n])),r.rows+=1,Ii(r)}function nT(e,t,n){const r=pr(e,t);if(!r)return yt("no-cell");const o=r.row+r.rowspan-1;return n==="above"?tT(e,r.row,r.row):tT(e,o+1,o)}function mV(e,t){const n=pr(e,t);if(!n)return yt("no-cell");if(e.rows<=1)return yt("last-line");const r=n.row,o=gr(e);o.cells=o.cells.filter(i=>i.row!==r||i.rowspan>1);for(const i of o.cells)i.row>r?i.row-=1:r<i.row+i.rowspan&&(i.rowspan-=1);return o.rowsMeta.splice(r,1),o.rows-=1,Ii(o)}function rT(e,t,n){const r=gr(e),o=new Set;for(const s of r.cells)if(s.col<t&&t<s.col+s.colspan){s.colspan+=1;for(let a=s.row;a<s.row+s.rowspan;a++)o.add(a)}else s.col>=t&&(s.col+=1);const i=Cp(e);for(let s=0;s<r.rows;s++)o.has(s)||r.cells.push(Cu(Pi(e,s,n),{id:i(),row:s,col:t,rowspan:1,colspan:1}));return r.cols+=1,Ii(r)}function oT(e,t,n){const r=pr(e,t);if(!r)return yt("no-cell");const o=r.col+r.colspan-1;return n==="left"?rT(e,r.col,r.col):rT(e,o+1,o)}function hV(e,t){const n=pr(e,t);if(!n)return yt("no-cell");if(e.cols<=1)return yt("last-line");const r=n.col,o=gr(e);o.cells=o.cells.filter(i=>i.col!==r||i.colspan>1);for(const i of o.cells)i.col>r?i.col-=1:r<i.col+i.colspan&&(i.colspan-=1);return o.cols-=1,Ii(o)}var pV="img, table, hr, svg, video, iframe, picture";function iT(e){const t=document.createElement("div");return Le(t,e),t}function sT(e){const t=Array.from(e.childNodes).filter(r=>r.nodeType!==Node.TEXT_NODE||(r.textContent??"").trim()!==""),[n]=t;return t.length===1&&n instanceof Element&&n.tagName==="DIV"?n:null}function gV(e){return(e.textContent??"").replace(/ /g," ").trim()===""&&!e.querySelector(pV)}function bV(e){const t=iT(e);if(gV(t))return"";const n=sT(t);return n?Ke(n):e.trim()}function yV(e,t){const n=t.map(o=>bV(o.contentHtml)).filter(o=>o!=="").join("<br>").replace(/ $/,""),r=n===""?" ":n;for(const o of[e,...t]){const i=iT(o.contentHtml),s=sT(i);if(s)return Le(s,r),Ke(i)}return n===""?v_:n}function vV(e){const t=Math.min(...e.map(r=>r.row)),n=Math.min(...e.map(r=>r.col));return{row:t,col:n,rows:Math.max(...e.map(r=>r.row+r.rowspan))-t,cols:Math.max(...e.map(r=>r.col+r.colspan))-n}}function EV(e,t,n){for(let r=t.row;r<t.row+t.rows;r++)for(let o=t.col;o<t.col+t.cols;o++){const i=e.grid[r]?.[o];if(!i||!n.has(i))return!1}return!0}function Tp(e,t,n){const r=new Set([t,...n]),o=e.cells.filter(c=>r.has(c.id));if(o.length!==r.size)return yt("no-cell");if(r.size<2)return yt("nothing-to-merge");const i=vV(o);if(!EV(e,i,r))return yt("not-rectangular");const s=gr(e),a=pr(s,t),l=[...o].sort((c,u)=>c.row-u.row||c.col-u.col);return a.contentHtml=yV(a,l),Object.assign(a,{row:i.row,col:i.col,rowspan:i.rows,colspan:i.cols}),s.cells=s.cells.filter(c=>c===a||!r.has(c.id)),Ii(s)}function SV(e,t,n){switch(t){case"left":return{row:e.row,col:e.col-n,rows:e.rowspan,cols:n};case"right":return{row:e.row,col:e.col+e.colspan,rows:e.rowspan,cols:n};case"top":return{row:e.row-n,col:e.col,rows:n,cols:e.colspan};default:return{row:e.row+e.rowspan,col:e.col,rows:n,cols:e.colspan}}}function wV(e,t){if(t.row<0||t.col<0||t.row+t.rows>e.rows||t.col+t.cols>e.cols)return null;const n=[];for(let r=t.row;r<t.row+t.rows;r++)for(let o=t.col;o<t.col+t.cols;o++)n.push(Pi(e,r,o)?.id??"");return n}function _V(e,t,n,r=1){const o=pr(e,t);if(!o)return yt("no-cell");if(r<1)return yt("nothing-to-merge");const i=wV(e,SV(o,n,r));return i?i.includes("")?yt("not-rectangular"):Tp(e,t,i):yt("out-of-table")}function aT(e,t,n,r=1){const o=pr(e,t),i=n==="cols"?o?.colspan:o?.rowspan;if(!o||i===void 0)return yt("no-cell");if(r<1||r>=i)return yt("nothing-to-split");const s=gr(e),a=pr(s,t),l={id:sV(e),row:a.row,col:a.col,rowspan:a.rowspan,colspan:a.colspan};return n==="cols"?(a.colspan-=r,s.cells.push(Cu(a,{...l,col:a.col+a.colspan,colspan:r}))):(a.rowspan-=r,s.cells.push(Cu(a,{...l,row:a.row+a.rowspan,rowspan:r}))),Ii(s)}function CV(e,t){return e.row===t.row?t.col>e.col?"right":"left":e.col===t.col?t.row>e.row?"bottom":"top":null}function Tu(e,t){return Array.from({length:Math.max(0,t-e+1)},(n,r)=>e+r)}function TV(e,t,n){switch(n){case"right":return Tu(e.col+e.colspan,t.col+t.colspan-1).map(r=>({row:e.row,col:r}));case"left":return Tu(t.col,e.col-1).map(r=>({row:e.row,col:r}));case"bottom":return Tu(e.row+e.rowspan,t.row+t.rowspan-1).map(r=>({row:r,col:e.col}));default:return Tu(t.row,e.row-1).map(r=>({row:r,col:e.col}))}}function AV(e,t,n){const r=Pi(e,t.row,t.col),o=Pi(e,n.row,n.col),i=r&&o&&r.id!==o.id?CV(r,o):null;if(!r||!o||!i)return null;const s=[...new Set(TV(r,o,i).map(a=>Pi(e,a.row,a.col)?.id??""))];return s.includes("")||_p(Tp(e,r.id,s))?null:{direction:i,cellIds:s}}function kV(e,t){const n=[];for(const r of e.cells)t.some(o=>r.classList.includes(o))&&n.push(r.id);return n}function LV(e,t,n){const r={...e,cells:e.cells.map(o=>({...o,classList:[...o.classList]}))};for(const o of r.cells)t.includes(o.id)&&(o.classList.includes(n)||o.classList.push(n));return r}function Au(e,t){return Array.from({length:t},(n,r)=>e+r)}function NV(e,t){switch(t){case"top":return Au(e.col,e.colspan).map(n=>[e.row-1,n]);case"bottom":return Au(e.col,e.colspan).map(n=>[e.row+e.rowspan,n]);case"left":return Au(e.row,e.rowspan).map(n=>[n,e.col-1]);default:return Au(e.row,e.rowspan).map(n=>[n,e.col+e.colspan])}}function lT(e,t){const n=new Set(t),r=e.cells.filter(s=>n.has(s.id)),o=([s,a])=>n.has(e.grid[s]?.[a]??""),i={};for(const s of r){const a=[];for(const l of Gr){const c=NV(s,l),u=c.filter(d=>!o(d)).length;if(u>0&&u<c.length)return Object.fromEntries(r.map(d=>[d.id,[...Gr]]));u>0&&a.push(l)}i[s.id]=a}return i}function xV(e,t,n,r){const o={width:1,style:"solid",color:"#b9b1b1"},i={...e,cells:e.cells.map(s=>{const a={...s};return a.style&&(a.style={...a.style},a.style.borders&&(a.style.borders={...a.style.borders})),a})};for(const s of i.cells)if(t.includes(s.id)){s.style||(s.style={}),s.style.borders||(s.style.borders={});for(const a of n){const l=s.style.borders[a];l?s.style.borders[a]={...l,...r}:s.style.borders[a]={...o,...r}}s.styleEntries=vu(s.styleEntries,"border",n)}return i}function OV(e,t,n){const r=gr(e);for(const o of r.cells){if(!t.includes(o.id))continue;const i=o.style?.borders;n.forEach(s=>delete i?.[s]),o.style&&i&&!Object.keys(i).length&&delete o.style.borders,o.styleEntries=vu(o.styleEntries,"border",n)}return r}function RV(e,t){return lT(e,t)}function MV(e){const t=gr(e);return t.cells.forEach(n=>{const r=n.style?.borders;if(!r)return;const o={top:n.row===0,bottom:n.row+n.rowspan===t.rows,left:n.col===0,right:n.col+n.colspan===t.cols};Object.keys(o).filter(i=>o[i]).forEach(i=>delete r[i])}),t}function PV(e,t,n,r){const o={topLeft:0,topRight:1,bottomRight:2,bottomLeft:3},i={...e,cells:e.cells.map(s=>{const a={...s};return a.style&&(a.style={...a.style}),a})};for(const s of i.cells)if(t.includes(s.id)){s.style||(s.style={});const a=(s.style.borderRadius||"0px 0px 0px 0px").split(" ").map(l=>parseInt(l.replace("px",""),10));for(const l of n){const c=o[l];c!==void 0&&(a[c]=r)}a.every(l=>l===0)?delete s.style.borderRadius:s.style.borderRadius=a.map(l=>`${l}px`).join(" ")}return i}var IV=[["topLeft","top","left"],["topRight","top","right"],["bottomLeft","bottom","left"],["bottomRight","bottom","right"]];function DV(e,t){const n={};for(const[r,o]of Object.entries(lT(e,t))){const i=IV.filter(([,s,a])=>o.includes(s)&&o.includes(a)).map(([s])=>s);i.length&&(n[r]=i)}return n}var BV={paddingLeftRight:["left","right"],paddingTopBottom:["top","bottom"],paddingLeft:["left"],paddingTop:["top"],paddingRight:["right"],paddingBottom:["bottom"]};function HV(e,t){if(!t.settings)return e;const n=Object.keys(t.settings);if(n.length===0)return e;const r=n[0],o=BV[r];if(!o)return e;const i=t.settings[r];return typeof i!="number"||isNaN(i)||!e.cells||!Array.isArray(e.cells)||e.cells.forEach(s=>{s.style||(s.style={}),s.style.padding||(s.style.padding={top:0,right:0,bottom:0,left:0});const a=s.style.padding;o.forEach(l=>a[l]=i),s.styleEntries=vu(s.styleEntries,"padding",o),s.style.padding.top===0&&s.style.padding.right===0&&s.style.padding.bottom===0&&s.style.padding.left===0&&delete s.style.padding,Object.keys(s.style).length===0&&delete s.style}),e}function FV(e,t,n,r){const o={...e,cells:e.cells.map(i=>{const s={...i};return s.style&&(s.style={...s.style},s.style.padding&&(s.style.padding={...s.style.padding})),s})};for(const i of o.cells)if(t.includes(i.id)){i.style||(i.style={}),i.style.padding||(i.style.padding={top:0,right:0,bottom:0,left:0});for(const s of n){const a=s;i.style.padding[a]=r}i.styleEntries=vu(i.styleEntries,"padding",n),["top","right","bottom","left"].forEach(s=>{i.style?.padding&&i.style.padding[s]===0&&delete i.style.padding[s]}),i.style.padding&&Object.keys(i.style.padding).length===0&&delete i.style.padding}return o}function $V(e,t,n){const r={...e,cells:e.cells.map(o=>({...o,style:o.style?{...o.style}:void 0}))};for(const o of r.cells)t.includes(o.id)&&(o.style||(o.style={}),o.style.backgroundColor=n);return r}var kie=5,cT=.5,WV=.1;function qV(e){return(100-e*5)/(e-1)}function zV(e,t,n){const r=e.reduce((l,c)=>l+Math.max(c,0),0)>0?e.map(l=>Math.max(l,0)):e.map(()=>1),o=r.map(()=>!1);let i=[];for(let l=!0;l;){l=!1;const c=r.reduce((d,f,h)=>o[h]?d:d+f,0),u=t-n*o.filter(Boolean).length;i=r.map((d,f)=>o[f]?n:c>0?u*d/c:0),i.forEach((d,f)=>{!o[f]&&d<n&&(o[f]=!0,l=!0)})}const s=i.map(l=>Math.floor(l+1e-9));let a=t-s.reduce((l,c)=>l+c,0);return i.map((l,c)=>({i:c,fraction:l-s[c]})).sort((l,c)=>c.fraction-l.fraction||l.i-c.i).forEach(({i:l})=>{a>0&&(s[l]+=1,a-=1)}),s}function Di(e,t){const n=e.length;if(n<2)return{columns:n===1?[100]:[],gap:0};const r=Math.round(Math.min(Math.max(t,0),qV(n))*100);return{columns:zV(e,1e4-r*(n-1),500).map(o=>o/100),gap:r/100}}function UV(e){if(e<2)return 0;const t=(100-e*(Math.round(100/e)-2))/(e-1);return Math.round(t/cT)*cT}function jV(e){if(e.length<2)return 0;const t=100-e.reduce((n,r)=>n+r,0);return t>0?t/(e.length-1):0}function VV(e,t){if(e.columns.length!==t.length)return!1;const n=Di(t,e.gap).columns;return e.columns.every((r,o)=>Math.abs(r-n[o])<=WV)}function GV(e){return String(Math.round(e*100)/100).replace(".","_")}function XV(e){const t=/^(\d+)(?:_(\d{1,2}))?$/.exec(e);return t?parseFloat(t[2]?`${t[1]}.${t[2]}`:t[1]):null}function Ap(e){return Di(e,UV(e.length))}function uT(e,t){return{items:e.columns,gap:e.gap,linked:VV(e,t)}}function KV(e,t,n){return t.length<2?null:e?n==="follow"&&e.items.length===t.length&&!e.linked?{columns:e.items,gap:e.gap}:Di(t,e.gap):Ap(t)}function YV(e,t){return Di(t,e.gap)}function ZV(e,t,n){return Di(e.linked?t:e.items,n)}function QV(e,t){return Di(t,e.gap)}var kp=".em-mob-wrap, .noresp-em-mob-wrap",ku="em-mob-wrap-cancel",Lp="em-mob-width-",JV="em-mob-width-100perc",eG=".em-mob-wrap.em-mob-wrap-cancel, .noresp-em-mob-wrap.em-mob-wrap-cancel",dT="em-mob-vertical_align-";function Np(e){return Array.from(e.children).some(t=>t.matches(kp))?e:e.querySelector(kp)?.parentElement??null}function Kr(e){const t=Array.from(e.children).filter(n=>n.matches(kp));return{columns:t.filter((n,r)=>r%2===0),gaps:t.filter((n,r)=>r%2===1)}}function Ta(e){return Kr(e).columns.map(t=>parseFloat(t.getAttribute("width")||"0"))}function xp(e){Array.from(e.classList).filter(t=>t.startsWith(Lp)).forEach(t=>e.classList.remove(t))}function fT(e){for(const t of Array.from(e.classList))if(t.startsWith(Lp)&&t.endsWith("perc")){const n=XV(t.slice(13,-4));if(n!==null)return n}return null}function tG(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mT(e,t,n){Fe();const r=Bc();!r||new RegExp(`${tG(e)}(?![\\w-])`).test(r.textContent??"")||r.append(document.createTextNode(`
|
|
92
|
+
${z_()}
|
|
93
|
+
${t} { ${n} }
|
|
94
|
+
}
|
|
95
|
+
`))}function hT(e,t){const n=`${Lp}${GV(t)}perc`,r=`${Math.round(t*100)/100}%`;xp(e),e.classList.add(ku,n),mT(`.${n}`,`.${n}`,`width: ${r} !important; max-width: ${r} !important;`)}function Aa(e,t){const{columns:n,gaps:r}=Kr(e);mT(".em-mob-wrap.em-mob-wrap-cancel",eG,"display: table-cell !important;"),n.forEach((o,i)=>hT(o,t.columns[i]??0)),r.forEach(o=>hT(o,t.gap))}function pT(e){const{columns:t,gaps:n}=Kr(e);t.forEach(r=>{r.classList.remove(ku),xp(r),r.classList.add(JV)}),n.forEach(r=>{r.classList.remove(ku),xp(r)})}function Op(e){return Kr(e).columns.some(t=>t.classList.contains(ku))}function nG(e){return Ap(Ta(e))}function Bi(e){const t=e?Np(e):null;return!t||!Op(t)?null:{row:t,before:Fi(t)}}function Hi(e,t){if(!e)return;const n=KV(e.before,Ta(e.row),t);n?(Aa(e.row,n),oG(e.row)):pT(e.row)}function Fi(e){const{columns:t,gaps:n}=Kr(e);if(t.length<2||!Op(e))return null;const r=Ta(e),o=t.map(fT);if(o.some(a=>a===null))return uT(Ap(r),r);const i=o,s=(n.length?fT(n[0]):null)??jV(i);return uT({columns:i,gap:Math.round(s*100)/100},r)}function gT(e){const t=Array.from(e.classList).find(n=>n.startsWith(dT));return t?t.slice(22):null}function bT(e,t){Sh({elem:e,settings:{mobileVerticalAlign:{value:t,classNamePrefix:dT}}})}function Rp(e){const t=Kr(e).columns[0];return t?gT(t):null}function rG(e,t){Kr(e).columns.forEach(n=>bT(n,t))}function oG(e){const t=Rp(e);t&&Kr(e).columns.filter(n=>gT(n)===null).forEach(n=>bT(n,t))}function iG(e){const t={all:null,top:null,right:null,bottom:null,left:null},n={all:null,top:null,right:null,bottom:null,left:null},r=qe({elem:e}),o=r.mobileWidth,i=r.mobileHeight;(e.style.padding||e.style.paddingTop||e.style.paddingRight||e.style.paddingBottom||e.style.paddingLeft)&&(!e.style.padding||e.style.padding.indexOf(" ")>-1?t.all=null:!e.style.padding&&e.style.paddingTop&&e.style.paddingRight&&e.style.paddingBottom&&e.style.paddingLeft&&e.style.paddingTop===e.style.paddingRight&&e.style.paddingRight===e.style.paddingBottom&&e.style.paddingBottom===e.style.paddingLeft?t.all=parseFloat(e.style.paddingTop):t.all=parseFloat(e.style.padding),t.top=e.style.paddingTop?parseFloat(e.style.paddingTop):null,t.right=e.style.paddingRight?parseFloat(e.style.paddingRight):null,t.bottom=e.style.paddingBottom?parseFloat(e.style.paddingBottom):null,t.left=e.style.paddingLeft?parseFloat(e.style.paddingLeft):null),(r.mobilePadding.all!==null||r.mobilePadding.top!==null||r.mobilePadding.right!==null||r.mobilePadding.bottom!==null||r.mobilePadding.left!==null)&&(r.mobilePadding.all?!r.mobilePadding.all&&r.mobilePadding.top&&r.mobilePadding.right&&r.mobilePadding.bottom&&r.mobilePadding.left&&r.mobilePadding.top===r.mobilePadding.right&&r.mobilePadding.right===r.mobilePadding.bottom&&r.mobilePadding.bottom===r.mobilePadding.left?n.all=parseFloat(String(r.mobilePadding.top)):n.all=r.mobilePadding.all!==null?parseFloat(String(r.mobilePadding.all)):null:n.all=null,n.top=r.mobilePadding.top!==null?parseFloat(String(r.mobilePadding.top)):r.mobilePadding.all===null?null:r.mobilePadding.all,n.right=r.mobilePadding.right!==null?parseFloat(String(r.mobilePadding.right)):r.mobilePadding.all===null?null:r.mobilePadding.all,n.bottom=r.mobilePadding.bottom!==null?parseFloat(String(r.mobilePadding.bottom)):r.mobilePadding.all===null?null:r.mobilePadding.all,n.left=r.mobilePadding.left!==null?parseFloat(String(r.mobilePadding.left)):r.mobilePadding.all===null?null:r.mobilePadding.all);let s=e.getAttribute("align")??"";e.parentElement?.getAttribute("em")!=="group"&&e.querySelector('[em="atom"]')&&e.querySelectorAll('[em="atom"] > tr > td').forEach(c=>{c.getAttribute("align")!==s&&(s="")});const a={padding:t,borderRadius:Oi(e),backgroundColor:e.style.backgroundColor?G(e.style.backgroundColor):e.getAttribute("bgcolor")||"",backgroundImage:[{type:"url",value:""}],backgroundPositionX:e.style.backgroundPositionX&&e.style.backgroundPositionX!=="initial"?e.style.backgroundPositionX:"",backgroundPositionY:e.style.backgroundPositionY&&e.style.backgroundPositionY!=="initial"?e.style.backgroundPositionY:"",backgroundRepeat:e.style.backgroundRepeat||"repeat",backgroundSize:e.style.backgroundSize||"auto",height:{value:e.getAttribute("height")&&e.getAttribute("height")!=="auto"?parseFloat(e.getAttribute("height")):null,dim:e.getAttribute("height")&&e.getAttribute("height")!=="auto"&&e.getAttribute("height").indexOf("%")>-1?"%":"px"},align:s,valign:e.getAttribute("valign")??"",border:mu(e),boxShadow:ya(e),mobileWidth:{value:o!==null?o:null,dim:r.mobileWidthDim},mobileHeight:{value:i!==null?i:null,dim:r.mobileHeightDim},mobileBorder:r.mobileBorder,mobileBorderRadius:r.mobileBorderRadius,mobileBoxShadow:r.mobileBoxShadow,mobileAlign:r.mobileAlign,mobileVerticalAlign:r.mobileVerticalAlign,mobileDirection:r.mobileDirection,mobileBackgroundColor:r.mobileBackgroundColor,mobileBackgroundImage:r.mobileBackgroundImage,mobileBackgroundPositionX:r.mobileBackgroundPositionX,mobileBackgroundPositionY:r.mobileBackgroundPositionY,mobileBackgroundRepeat:r.mobileBackgroundRepeat,mobileBackgroundSize:r.mobileBackgroundSize,mobilePadding:n,show:r.show,exportAsPicture:e.getAttribute("em-operation")==="exportAsPicture",outlookBackground:Ea(e,"inside")},l=e.closest("table");if(l&&l.getAttribute("em")==="atom"){const c=l.getAttribute("width");a.width={value:c&&c!=="auto"?parseFloat(c):null,dim:c&&c!=="auto"&&c.indexOf("%")>-1?"%":"px"}}else{const c=e.getAttribute("width");a.width={value:c&&c!=="auto"?parseFloat(c):null,dim:c&&c!=="auto"&&c.indexOf("%")>-1?"%":"px"}}if(e.style.backgroundImage){const c=e.style.backgroundImage;a.backgroundImage=[{type:"url",value:c?c.substring(5,c.length-2):""}]}else e.getAttribute("background")&&(a.backgroundImage=[{type:"url",value:e.getAttribute("background")||""}]);return a}function sG(e){let t=[],n=null,r=null,o="",i,s=!1,a=null,l=null;if(e.elem.closest(".em-mob-wrap, .noresp-em-mob-wrap")){const c=e.elem.closest(".em-mob-wrap, .noresp-em-mob-wrap");if(a=c.parentElement?Fi(c.parentElement):null,l=c.parentElement?Rp(c.parentElement):null,i=!0,c.parentElement.querySelectorAll(":scope > .em-mob-wrap, :scope > .noresp-em-mob-wrap").length>1)c.parentElement.querySelectorAll(":scope > .em-mob-wrap:nth-child(odd), :scope > .noresp-em-mob-wrap:nth-child(odd)").forEach(u=>{t.push({width:parseFloat(u.getAttribute("width")||"0"),current:u===c});const d=c.parentElement.querySelector(":scope > .em-mob-wrap, :scope > .noresp-em-mob-wrap");d?.nextElementSibling&&(n=parseFloat(d.nextElementSibling.getAttribute("width")||"0"),r=qe({elem:d.nextElementSibling}).mobileHeight||0),(u.classList.contains("em-mob-wrap-cancel")||u.classList.contains("noresp-em-mob-wrap-cancel"))&&(i=!1)});else{const u=c.parentElement.querySelector(":scope > .em-mob-wrap, :scope > .noresp-em-mob-wrap");t=[{width:parseFloat(u?.getAttribute("width")||"0"),current:!0}],n=0}o=c.parentElement.querySelector(".em-mob-wrap, .noresp-em-mob-wrap")?.getAttribute("valign")||"",(e.elem.querySelector(".em-mob-wrap, .noresp-em-mob-wrap")?document.querySelector('[em-edit="active"]'):e.elem.closest(".em-mob-wrap, .noresp-em-mob-wrap").parentElement.closest("td"))?.getAttribute("dir")==="rtl"&&(s=!0)}else{const c=e.elem.closest('div[style*="inline-block"]');if(c&&c.parentElement.querySelectorAll('div[style*="inline-block"]').length>1)c.parentElement.querySelectorAll('div[style*="inline-block"]').forEach(u=>{const d=u;if(!d.style.fontFamily){const f=u.firstElementChild;t.push({width:parseFloat(f?.getAttribute("width")||"0"),current:u===c});const h=f?.getAttribute("width"),m=parseFloat(d.style.width);n=m-(!h||h.indexOf("%")>-1?m:parseFloat(h))}});else{const u=c?.parentElement?.querySelector('div[style*="inline-block"]');t=[{width:parseFloat(u?.firstElementChild?.getAttribute("width")||"0"),current:!0}],n=0}o=c?.parentElement?.querySelector('div[style*="inline-block"]')?.style.verticalAlign||"",(e.elem.querySelector('div[style*="inline-block"]')?document.querySelector('[em-edit="active"]'):e.elem.closest('div[style*="inline-block"]')?.parentElement)?.getAttribute("dir")==="rtl"&&(s=!0)}return{items:t,gap:n,gapMobile:r,valign:o,wrap:i,dirRevers:s,mobile:a,mobileValign:l}}var aG='table[em-type="social"]';function lG(e){return e.closest(aG)}function cG(e,t){return t.contains(e)?!!(e.tagName==="IMG"||e.tagName==="TD"&&(e.hasAttribute("em-platform")||e.hasAttribute("data-em-platform"))||e.tagName==="A"&&e.querySelector(":scope > img")):!1}function $i(e){const t=lG(e);if(t&&e!==t&&cG(e,t))return t;const n=e.parentNode;if(!n)return!1;const r=n.tagName,o=n.style,i=n.parentNode;return r==="TD"||r==="TABLE"&&i?.style.display!=="inline-block"&&!e.closest(".em-narrow-table")&&n.getAttribute("em")!=="atom"||r==="DIV"&&(o.display==="inline-block"||o.display==="table-cell")&&o.verticalAlign||(r==="DIV"||r==="TABLE")&&uG(o)?n:$i(n)}function uG(e){return!!(e.width||e.minWidth||e.maxWidth||e.height||e.background||e.backgroundColor||e.backgroundPositionX||e.backgroundPositionY||e.backgroundImage||e.backgroundRepeat||e.backgroundSize||e.padding||e.paddingTop||e.paddingRight||e.paddingBottom||e.paddingLeft||e.border||e.borderBottom||e.borderBottomWidth||e.borderBottomStyle||e.borderBottomColor||e.borderLeft||e.borderLeftWidth||e.borderLeftStyle||e.borderLeftColor||e.borderTop||e.borderTopWidth||e.borderTopStyle||e.borderTopColor||e.borderRight||e.borderRightWidth||e.borderRightStyle||e.borderRightColor||e.borderRadius||e.borderTopLeftRadius||e.borderTopRightRadius||e.borderBottomLeftRadius||e.borderBottomRightRadius||e.boxShadow||e.textAlign||e.align||e.verticalAlign)}function Wi(){return Pt.getInstance(Gd)?.localized??{}}var yT=[];function dG(){return yT}function vT(e){const t=Wi();let n="",r="";switch(e.tagName){case"A":e.style.display==="block"?(n=t.ELEMENT_PATH_BUTTON,r="em-element-path-item-button"):(n=t.ELEMENT_PATH_LINK,r="em-element-path-item-link");break;case"IMG":e.closest('table[em-type="social"]')?n=t.ELEMENT_PATH_SOCIAL:n=t.ELEMENT_PATH_IMG,r="em-element-path-item-image";break;case"TD":e.parentElement?.getAttribute("em")==="block"?(n=t.ELEMENT_PATH_BLOCK,r="em-element-path-item-block"):e.parentElement?.getAttribute("em")==="atom"||e.closest("table")?.getAttribute("em")==="atom"?(n=t.ELEMENT_PATH_ATOM,r="em-element-path-item-atom"):e.parentElement?.getAttribute("em")==="group"?(n=t.ELEMENT_PATH_GROUP,r="em-element-path-item-group"):e.classList.contains("em-vindent")?(n=t.ELEMENT_PATH_VINDENT,r="em-element-path-item-vindent"):e.classList.contains("em-mob-wrap")||e.classList.contains("noresp-em-mob-wrap")?(n=t.ELEMENT_PATH_FLOATBLOCK,r="em-element-path-item-column"):(n=t.ELEMENT_PATH_TD,r="em-element-path-item-block");break;case"TABLE":e.getAttribute("em")==="block"?(n=t.ELEMENT_PATH_BLOCK,r="em-element-path-item-block"):e.getAttribute("em")==="atom"&&e.getAttribute("em-type")==="social"?(n=t.ELEMENT_PATH_SOCIAL,r="em-element-path-item-atom"):e.getAttribute("em")==="atom"?(n=t.ELEMENT_PATH_ATOM,r="em-element-path-item-atom"):e.getAttribute("em")==="group"?(n=t.ELEMENT_PATH_GROUP,r="em-element-path-item-group"):e.parentElement?.tagName==="BODY"?(n=t.ELEMENT_PATH_EMAIL,r="em-element-path-item-email"):(n=t.ELEMENT_PATH_TABLE,r="em-element-path-item-table");break;case"SPAN":case"B":case"I":case"EM":case"STRONG":case"P":case"H1":case"H2":case"H3":case"H4":case"H5":case"DIV":case"STRIKE":case"S":case"U":e.style.display==="inline-block"?(n=t.ELEMENT_PATH_FLOATBLOCK,r="em-element-path-item-column"):e.style.fontFamily&&e.style.fontSize&&e.style.lineHeight&&e.style.color?(n=t.ELEMENT_PATH_TEXT,r="em-element-path-item-text"):e.getAttribute("em")==="block"?(n=t.ELEMENT_PATH_BLOCK,r="em-element-path-item-block"):e.getAttribute("em")==="atom"?(n=t.ELEMENT_PATH_ATOM,r="em-element-path-item-atom"):e.getAttribute("em")==="group"?(n=t.ELEMENT_PATH_GROUP,r="em-element-path-item-group"):e.classList.contains("em-vindent")?(n=t.ELEMENT_PATH_VINDENT,r="em-element-path-item-vindent"):(n=t.ELEMENT_PATH_DIV,r="em-element-path-item-block")}const o=zP(e,t);return o?.title&&(n=o.title),o?.className&&(r=o.className),e.className&&e.className.indexOf&&e.className.indexOf("em-mob-")>-1&&(r+=" em-element-path-item-mob"),{elem:e,title:n,className:r}}var fG=new Set(["TABLE","TBODY","THEAD","TFOOT","TR","TD","TH"]);function mG(e){return Array.from(e.classList).some(t=>t.startsWith("em-element-"))}function hG(e){if(e.tagName!=="TD")return!1;const t=Array.from(e.getElementsByTagName("a")),n=t[0];if(t.length!==1||n.style.display!=="block")return!1;for(let r=n.parentElement;r&&r!==e;r=r.parentElement)if(fG.has(r.tagName))return!1;return Array.from(e.children).every(r=>r===n||r.contains(n)||mG(r))}var ET='.em-narrow-table, [em="block-contaner"]';function pG(e){const t=e.style;return hG(e)?!1:!!(e.tagName==="A"&&!e.closest(".em-element-resize-img-container")&&!e.closest('table[em-type="social"]')||e.tagName==="TD"&&!e.closest(ET)||e.tagName==="TABLE"&&e.parentElement?.style?.display!=="inline-block"&&!e.classList.contains("em-vindent-table")&&!e.closest(ET)&&e.getAttribute("em")!=="atom"&&e.parentElement?.tagName!=="BODY"||e.tagName==="DIV"&&(t.display==="inline-block"||t.display==="table-cell")&&t.verticalAlign||(e.tagName==="DIV"||e.tagName==="TABLE"||e.tagName==="TD")&&!e.classList.contains("em-narrow-table")&&!e.classList.contains("noresp-em-narrow-table")&&(t.width||t.minWidth||t.maxWidth||t.background||t.backgroundColor||t.backgroundPositionX||t.backgroundPositionY||t.backgroundImage||t.backgroundRepeat||t.backgroundSize||t.height||t.padding||t.paddingTop||t.paddingRight||t.paddingBottom||t.paddingLeft||t.border||t.borderBottom||t.borderBottomWidth||t.borderBottomStyle||t.borderBottomColor||t.borderLeft||t.borderLeftWidth||t.borderLeftStyle||t.borderLeftColor||t.borderTop||t.borderTopWidth||t.borderTopStyle||t.borderTopColor||t.borderRight||t.borderRightWidth||t.borderRightStyle||t.borderRightColor||t.borderRadius||t.borderTopLeftRadius||t.borderTopRightRadius||t.borderBottomLeftRadius||t.borderBottomRightRadius||t.boxShadow||t.textAlign||t.align||t.verticalAlign)||e.tagName!=="EDITOR"&&t.fontFamily&&t.fontSize&&t.lineHeight&&t.color||e.tagName==="TD"&&e.closest("table")?.getAttribute("em")==="atom"||e.tagName==="TD"&&e.closest("tr")?.getAttribute("em")==="block"||e.tagName==="TD"&&(e.classList.contains("em-mob-wrap")||e.classList.contains("noresp-em-mob-wrap"))||aE(e))}function gG(e){let t=[];const n=e.style;(e.tagName==="IMG"||e.tagName==="TD"||e.tagName==="TABLE"||e.tagName!=="EDITOR"&&n.fontFamily&&n.fontSize&&n.lineHeight&&n.color||e.tagName==="DIV"&&n.height&&n.lineHeight||aE(e))&&t.push(vT(e));let r=e;for(;r?.parentElement&&r.parentElement.tagName!=="BODY";)r=r.parentElement,pG(r)&&t.push(vT(r));return t=t.filter(o=>!(o.elem?.tagName==="TABLE"&&o.elem.parentElement?.tagName==="BODY")),t=t.reverse(),yT=t.map(o=>({...o})),t.map(o=>({title:o.title,className:o.className}))}function ST(e){const t=Wi(),n=e.parentNode;if(!n)return;if(n.tagName==="A")return t.LINK;if(n.tagName==="TD")return t.TABLE_COLUMN;const r=n.parentNode;if(n.tagName==="TABLE"&&!(r?.tagName==="DIV"&&r.style.display==="inline-block"))return t.TABLE;if(n.tagName==="DIV"&&(n.style.display==="inline-block"||n.style.display==="table-cell")&&n.style.verticalAlign)return t.FLOAT_BLOCK;if(n.tagName==="DIV"){const o=n.style;if(o.width||o.minWidth||o.maxWidth||o.background||o.backgroundColor||o.backgroundPositionX||o.backgroundPositionY||o.backgroundImage||o.backgroundRepeat||o.backgroundSize||o.height||o.padding||o.paddingTop||o.paddingRight||o.paddingBottom||o.paddingLeft||o.border||o.borderBottom||o.borderBottomWidth||o.borderBottomStyle||o.borderBottomColor||o.borderLeft||o.borderLeftWidth||o.borderLeftStyle||o.borderLeftColor||o.borderTop||o.borderTopWidth||o.borderTopStyle||o.borderTopColor||o.borderRight||o.borderRightWidth||o.borderRightStyle||o.borderRightColor||o.borderRadius||o.borderTopLeftRadius||o.borderTopRightRadius||o.borderBottomLeftRadius||o.borderBottomRightRadius||o.boxShadow||o.textAlign||o.align||o.verticalAlign)return t.CONTAINER}return ST(n)}function bG(e,t,n){n.clearActiveEditElements();const r=e.elem.closest("amp-accordion");r.setAttribute("em-edit","active");const o=n.HTMLDocument.getOuterHtml(r),i=n.parseFromString(o)[0].querySelectorAll("section"),s=Array.from(i).map(a=>({expanded:a.hasAttribute("expanded")}));return{type:"accordion",caption:t.ACCORDION,animate:r.hasAttribute("animate"),expandSingleSection:r.hasAttribute("expand-single-section"),sections:s}}function wT(e){return e.tagName==="AMP-ACCORDION"}var _T="em-mob-text_align-",yG=":scope > tr > td, :scope > tbody > tr > td",vG='div[style*="font-family"][style*="font-size"]';function Mp(e){return e.querySelector(yG)}function Pp(e){return e.querySelector(vG)}function EG(e,t){for(let n=e;n&&n!==t;n=n.parentElement)if(n.tagName.includes("-"))return!0;return!1}function CT(e){const t=e.closest('table[em="atom"]');if(!t||EG(e,t))return null;const n=Mp(t);return n?{atomTd:n,textDiv:Pp(n)}:null}function ka(e){const t=e.closest("div, p, td");if(!t)return null;if(t.style.textAlign)return t;const n=CT(e);return n?n.textDiv?.hasAttribute("align")?n.textDiv:n.atomTd:t}function TT(e){const t=ka(e);return t&&(t.style.textAlign||t.getAttribute("align"))||"left"}function SG(e){const t=ka(e);if(!t)return"";for(const n of t.classList)if(n.startsWith("em-mob-text_align-"))return n.slice(18);return""}function Ip(e){return{value:SG(e)}}function wG(e,t,n=_T){const r=CT(e);if(r)for(const o of[r.atomTd,r.textDiv])o&&o!==t&&Hc(o,n)}function _G(e){const t=Mp(e);if(!t)return null;const n=Pp(t);return n?.hasAttribute("align")?n:t}function CG(e,t){e.querySelectorAll('[em="atom"]').forEach(n=>{const r=_G(n);r&&t(r,n)})}function TG(e,t,n=_T){const r=Mp(e),o=r?Pp(r):null;for(const i of[r,o])i&&i!==t&&Hc(i,n)}function Lu(e){if(!e)return null;const t=(e.closest('[style*="line-height"]')||e.querySelector('[style*="line-height"]'))?.style.lineHeight?.trim();if(!t||t.toLowerCase()==="normal")return null;if(t.includes("px")){const i=parseFloat(t);return Number.isFinite(i)?i:null}const n=e.closest('[style*="font-size"]')?.style.fontSize||getComputedStyle(e).fontSize,r=parseFloat(n);if(!Number.isFinite(r)||r<=0)return null;if(t.includes("%")){const i=parseFloat(t);return Number.isFinite(i)?r*(i/100):null}const o=parseFloat(t);return Number.isFinite(o)?r*o:null}function La(e){if(!e)return[];const t=[],n=e.style.fontFamily||getComputedStyle(e).fontFamily,r=[...(e.closest('[style*="font-family"]')||e).classList].filter(s=>s.startsWith("em-font-")),o=r.includes(ap),i=r.filter(s=>s!==ap);if(i.length>0){t.push("Google Fonts"),t.push(o?"Project Fonts":n.includes("sans-serif")?"Sans Serif":"Serif");const s=i[0].slice(8),a=s.lastIndexOf("-");a>0?t.push(s.slice(0,a),s.slice(a+1)):s&&t.push(s)}else n&&t.push("Safe Fonts",n.replaceAll('"',"'"));return t}function et(e,t,n){if(!e||e.tagName==="DIV")return!1;const r=window.getSelection();let o=null;if(r&&r.rangeCount>0){const a=r.getRangeAt(0).commonAncestorContainer;o=a.nodeType===1?a:a.parentElement}const i=a=>{if(!a)return!1;const l=a.tagName.toLowerCase();return l===t||l===n},s=e.closest(t)||(n?e.closest(n):null);return i(e)||!!o&&i(o)||!!s}function Nu(e){if(!e)return!1;const t=e.style.fontWeight||getComputedStyle(e).fontWeight;return t==="bold"||t==="700"||parseInt(t,10)>=700}function Yr(e,t="background-color"){if(!e)return"";let n=e;for(;n;){const r=n.style.getPropertyValue(t);if(r&&r!=="transparent"&&r!=="inherit")return r;n=n.parentElement}return""}function AG(e){const t=e.style.backgroundImage,n=e.getAttribute("background");if(t&&t!=="none"){const r=t.match(/url\(['"]?(.*?)['"]?\)/);if(r)return[{type:"url",value:r[1]}]}return n?[{type:"url",value:n}]:[{type:"url",value:""}]}function kG(){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0).commonAncestorContainer;return t.nodeType===1?t:t.parentElement}function Na(e){return!!e.closest(".em-show-td-mobile")||!!e.closest(".em-show-table-mobile")||!!e.closest(".em-show-div-mobile")||e.classList.contains("em-show-img-mobile")||!!e.closest(".desktop_hide")}function AT(){const e=window.getSelection();if(!e||e.rangeCount===0)return!1;let t=e.anchorNode,n=e.focusNode;t?.nodeType===3&&(t=t.parentNode),n?.nodeType===3&&(n=n.parentNode);const r=t?.closest?.("a"),o=n?.closest?.("a");return!!(r?.getAttribute("href")||o?.getAttribute("href"))}function Dp(e){if(!e)return!1;for(const t of Array.from(e.childNodes))if(t.nodeType===Node.COMMENT_NODE&&t.nodeValue?.includes("[if mso]")&&t.nodeValue.includes("v:roundrect")||t.nodeType===Node.ELEMENT_NODE&&Dp(t))return!0;return!1}function kT(e,t){if(!e)return{value:null,dim:"px"};const n=e.getAttribute(t);return!n||n==="auto"?{value:null,dim:"px"}:{value:parseFloat(n),dim:n.includes("%")?"%":"px"}}function LT(e){return e===null||e==="auto"?null:typeof e=="number"?e:null}function LG(e){const t={all:null,top:null,right:null,bottom:null,left:null};return!e.style.padding&&!e.style.paddingTop&&!e.style.paddingRight&&!e.style.paddingBottom&&!e.style.paddingLeft||(!e.style.padding||e.style.padding.includes(" ")?t.all=null:!e.style.padding&&e.style.paddingTop&&e.style.paddingRight&&e.style.paddingBottom&&e.style.paddingLeft&&e.style.paddingTop===e.style.paddingRight&&e.style.paddingRight===e.style.paddingBottom&&e.style.paddingBottom===e.style.paddingLeft?t.all=parseFloat(e.style.paddingTop):t.all=parseFloat(e.style.padding)||null,t.top=e.style.paddingTop?parseFloat(e.style.paddingTop):null,t.right=e.style.paddingRight?parseFloat(e.style.paddingRight):null,t.bottom=e.style.paddingBottom?parseFloat(e.style.paddingBottom):null,t.left=e.style.paddingLeft?parseFloat(e.style.paddingLeft):null),t}function NG(e){const t={all:null,top:null,right:null,bottom:null,left:null};if(!e.all&&!e.top&&!e.right&&!e.bottom&&!e.left)return t;e.all?!e.all&&e.top&&e.right&&e.bottom&&e.left&&e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?t.all=parseFloat(e.top):t.all=parseFloat(e.all)||null:t.all=null;const n=e.all||null;return t.top=e.top!=null?parseFloat(e.top):n,t.right=e.right!=null?parseFloat(e.right):n,t.bottom=e.bottom!=null?parseFloat(e.bottom):n,t.left=e.left!=null?parseFloat(e.left):n,t}function xG(e){if(e.style.backgroundImage){const t=e.style.backgroundImage;return[{type:"url",value:t.substring(5,t.length-2)}]}return e.getAttribute("background")?[{type:"url",value:e.getAttribute("background")||""}]:[{type:"url",value:""}]}function OG(e,t){const n=e.elem.closest("a")||e.elem,r=e.elem.closest("td"),o=kh(n),i=Dp(r)&&!Dp(n)||!!o,s=o??(i?n:r),a=e.elem.closest("table"),l=a?.closest("td")?.closest("table")?.closest("td"),c=a?.closest("div, p, td"),u=c?.style.textAlign||c?.getAttribute("align")||"left",d=qe({elem:e.elem}),f=qe({elem:r}),h=l?qe({elem:l}):null,m=qe({elem:a}),p=e.elem.closest("a"),S={type:"button",caption:t.BUTTON,fontFamily:La(e.elem),fontSize:parseFloat(e.elem.closest('[style*="font-size"]')?.style.fontSize)||0,fontSizeDim:"px",lineHeight:Lu(e.elem),lineHeightDim:"px",textStrong:et(e.elem,"strong","b")||Nu(e.elem),textItalic:et(e.elem,"i","em")||!e.elem.closest('[style*="font-style: normal"]')&&(p?.style?.fontStyle==="italic"||e.elem.style?.fontStyle==="italic"),textStrikethrough:et(e.elem,"s","strike")||(e.elem.style?.textDecoration?.includes("line-through")??!1)||!!e.elem.closest('[style*=" text-decoration"]')?.style.textDecoration?.includes("line-through"),textUnderline:et(e.elem,"u")||(e.elem.style?.textDecoration?.includes("underline")??!1)||!(e.elem.style?.textDecoration?.length>0)&&e.elem.tagName==="A"||!!e.elem.closest('[style*=" text-decoration"]')?.style.textDecoration?.includes("underline"),textColor:G(Yr(e.elem,"color"))||G(getComputedStyle(e.elem).color)||"",textBackgroundColor:G(Yr(e.elem,"background-color"))||"",padding:LG(o??n),borderRadius:Oi(s),backgroundColor:s.style.backgroundColor?G(s.style.backgroundColor):s.getAttribute("bgcolor")||"",backgroundImage:xG(r),backgroundPositionX:r.style.backgroundPositionX!=="initial"?r.style.backgroundPositionX:"",backgroundPositionY:r.style.backgroundPositionY!=="initial"?r.style.backgroundPositionY:"",backgroundRepeat:r.style.backgroundRepeat||"repeat",backgroundSize:r.style.backgroundSize||"auto",width:kT(a,"width"),height:kT(r,"height"),align:u,valign:r.getAttribute("valign")??"",textAlign:r.getAttribute("align")??"",border:mu(s),boxShadow:ya(s),href:n.getAttribute("href")??"",outlookRounding:i,multiline:ra(n),outlookBackground:Ea(r,"inside"),mobileWidth:{value:LT(m.mobileWidth),dim:m.mobileWidthDim??"px"},mobileHeight:{value:LT(f.mobileHeight),dim:f.mobileHeightDim??"px"},mobileBorder:f.mobileBorder,mobileBorderRadius:f.mobileBorderRadius,mobileBoxShadow:f.mobileBoxShadow,mobileAlign:m.mobileAlign,mobileFontSize:{value:d.mobileFontSize,dim:d.mobileFontSizeDim||"px"},mobileTextAlign:Ip(e.elem),mobileVerticalAlign:h?.mobileVerticalAlign,mobileBackgroundColor:f.mobileBackgroundColor,mobileBackgroundImage:f.mobileBackgroundImage,mobileBackgroundPositionX:f.mobileBackgroundPositionX,mobileBackgroundPositionY:f.mobileBackgroundPositionY,mobileBackgroundRepeat:f.mobileBackgroundRepeat,mobileBackgroundSize:f.mobileBackgroundSize,mobilePadding:NG(d.mobilePadding),mobileLineHeight:{value:d.mobileLineHeight,dim:"px"},show:m.show,exportAsPicture:a?.getAttribute("em-operation")==="exportAsPicture"};return Na(e.elem)&&(S.showOnMobile=!0),S}function xa(e){if(Lh(e.closest("a")))return!0;const t=e.getAttribute("style");if(!t||!t.includes("display"))return!1;const n=e.style.display;return!(n!=="block"&&n!=="inline-block"||t.includes("mso-style-priority"))}function RG(e,t){return t?!1:e.tagName==="A"||e.tagName==="EM-REPLACE"&&!!e.closest("a")}function MG(e){const t=e.closest("a"),n=e.closest('a[style*="display"]');if(Lh(t))return!0;if(t&&n){const r=n.style.display;if(r==="block"||r==="inline-block")return!0}if(e.tagName==="A"){const r=e.getAttribute("style");if(r&&r.includes("display")&&e.closest("td[height]"))return!0}return!1}function NT(e,t){const n=e.getAttribute(t);return!n||n==="auto"?{value:null,dim:"px"}:{value:parseFloat(n),dim:n.includes("%")?"%":"px"}}function xT(e){return e===null||e==="auto"?null:typeof e=="number"?e:null}function OT(e){return{src:e.getAttribute("src")??"",width:NT(e,"width"),height:NT(e,"height"),alt:e.getAttribute("alt")??"",title:e.getAttribute("title")??"",link:e.closest("a")?.getAttribute("href")??null,imgReplacer:e.closest("em-replace")?.getAttribute("src")??""}}function PG(e,t,n){n.clearActiveEditElements();const r=e.elem.closest("amp-carousel");r.setAttribute("em-edit","active");const o=r.querySelectorAll("amp-img"),i=IG(o),s=Array.from(o).map((u,d)=>{const f=qe({elem:u}),h=OT(u);return{src:h.src,width:h.width,height:h.height,alt:h.alt,title:h.title,link:h.link,renderedWidth:Math.round(e.elem.getBoundingClientRect().width),renderedHeight:Math.round(e.elem.getBoundingClientRect().height),imgReplacer:h.imgReplacer,mobileWidth:{value:xT(f.mobileWidth),dim:f.mobileWidthDim??"px"},mobileHeight:{value:xT(f.mobileHeight),dim:f.mobileHeightDim??"px"},mobileBorderRadius:f.mobileBorderRadius,slideIndex:d}}),a=qe({elem:r}),l={type:"carousel",caption:t.CAROUSEL,carouselImages:s,borderRadius:Oi(r),mobileBorderRadius:a.mobileBorderRadius,loop:r.hasAttribute("loop"),autoplay:r.hasAttribute("autoplay"),link:i},c=r.closest("td");return c&&(l.maxWidth=Math.round(c.getBoundingClientRect().width)),l}function IG(e){const t=Array.from(e,n=>n.closest("a")?.getAttribute("href"));return t.length>0&&t.every(n=>n&&n===t[0])?t[0]??null:null}function Bp(e){return!!e.closest("amp-carousel")}function Vn(e){return typeof e=="string"?e:typeof e=="number"?String(e):""}function _t(e){return typeof e=="number"?Number.isFinite(e)?e:null:typeof e!="string"||!/^\s*-?\d+(\.\d+)?(px)?\s*$/.test(e)?null:parseFloat(e)}var xu=["top","right","bottom","left"],Ou={borderAll:"all",borderTop:"top",borderRight:"right",borderBottom:"bottom",borderLeft:"left"},Ru={width:1,style:"solid",color:"#b9b1b1"},RT={width:null,style:null,color:null};function Mu(e,t){if(t==="all"){const r=xu.map(i=>Mu(e,i)),[o]=r;return r.every(i=>JSON.stringify(i)===JSON.stringify(o))?o:RT}const n=e.style.getPropertyValue(`border-${t}-style`);return!n||n==="none"?RT:{width:_t(e.style.getPropertyValue(`border-${t}-width`)),style:n,color:G(e.style.getPropertyValue(`border-${t}-color`))||null}}function Hp(e){return e.style===""||"width"in e&&We(e.width)&&!e.style&&!e.color}function MT(e){return e==="all"?"border":`border-${e}`}function Pu(e){const t=MT(e),n=[t,`${t}-width`,`${t}-style`,`${t}-color`];return e==="all"?[...n,...xu.flatMap(Pu)]:n}function PT(e,t,n){cp(e,Pu(t)),e.style.setProperty(MT(t),`${n.width}px ${n.style} ${n.color}`)}function DG(e){const t=Mu(e,"all");if(t.style===null)return;cp(e,Pu("all"));const n={width:t.width??0,style:t.style,color:t.color??Ru.color};xu.forEach(r=>PT(e,r,n))}function IT(e,t,n){if(t!=="all"&&DG(e),Hp(n)){cp(e,Pu(t));return}const r=Mu(e,t==="all"?"top":t);PT(e,t,{width:_t(n.width)??r.width??Ru.width,style:n.style||r.style||Ru.style,color:n.color||r.color||Ru.color})}var Fp=/^border(-(top|right|bottom|left))?(-(width|style|color))?$/i;function BG(e,t){const n=e.style.getPropertyValue(`border-${t}-style`);if(!n||n==="none")return null;const r=e.style.getPropertyValue(`border-${t}-color`);return[e.style.getPropertyValue(`border-${t}-width`),n,G(r)||r].filter(Boolean).join(" ")}function HG(e){const t=G0(e.getAttribute("style")),n=t.findIndex(({name:a})=>Fp.test(a));if(n<0||t.some(({name:a,value:l})=>Fp.test(a)&&/!important/i.test(l)))return;const r=xu.map(a=>[a,BG(e,a)]),[,o]=r[0],i=o&&r.every(([,a])=>a===o)?[`border: ${o}`]:r.flatMap(([a,l])=>l?[`border-${a}: ${l}`]:[]),s=t.filter(({name:a})=>!Fp.test(a)).map(({name:a,value:l})=>`${a}: ${l}`);s.splice(n,0,...i),e.setAttribute("style",s.length?`${s.join("; ")};`:"")}function FG(e){const t=_t(e.getAttribute("border"));return t?{width:t,style:"solid",color:G(e.getAttribute("bordercolor")??"")||null}:null}function DT(e){const t=FG(e),n=Object.keys(Ou),r=Object.fromEntries(n.map(i=>[i,t??Mu(e,Ou[i])])),o=n.find(i=>r[i].style!==null)??"borderAll";return{...r,position:o}}function BT(e){return!!e.closest(".em-element-custom-table")}function HT(e){const{paddingTop:t,paddingRight:n,paddingBottom:r,paddingLeft:o}=e.style;return{paddingLeftRight:o===n?o:"",paddingTopBottom:t===r?t:"",paddingLeft:o,paddingRight:n,paddingTop:t,paddingBottom:r}}function $G(e){return{backgroundColor:G(e.style.backgroundColor||e.getAttribute("bgcolor")||"")||"",backgroundImage:AG(e),backgroundPositionX:e.style.backgroundPositionX||"center",backgroundPositionY:e.style.backgroundPositionY||"center",backgroundRepeat:e.style.backgroundRepeat||"repeat",backgroundSize:e.style.backgroundSize||"cover"}}function WG(e){const{position:t,...n}=DT(e),r=ya(e);return{...n,borderPosition:t,borderRadius:Oi(e),boxShadow:{color:r?.color??null,hOffset:r?.hOffset??null,vOffset:r?.vOffset??null,blurRadius:r?.blurRadius??null,spreadRadius:r?.spreadRadius??null,inset:r?.inset??null}}}function qG(e){return{mobileBoxShadow:e.mobileBoxShadow,mobileBackgroundColor:e.mobileBackgroundColor,mobileBackgroundImage:e.mobileBackgroundImage,mobileBackgroundPositionX:e.mobileBackgroundPositionX,mobileBackgroundPositionY:e.mobileBackgroundPositionY,mobileBackgroundRepeat:e.mobileBackgroundRepeat,mobileBackgroundSize:e.mobileBackgroundSize,mobileWidth:{value:e.mobileWidth!=null?e.mobileWidth:null,dim:e.mobileWidthDim},mobileHeight:{value:e.mobileHeight!=null?e.mobileHeight:null,dim:"px"},mobileBorderRadius:e.mobileBorderRadius,mobileBorder:e.mobileBorder}}function zG(e){const{position:t,borderAll:n,borderTop:r,borderRight:o,borderBottom:i,borderLeft:s}=DT(e),a=Object.fromEntries(Object.entries(HT(e)).map(([l,c])=>[`cell_${l}`,c]));return{cell_borderPosition:`cell_${t}`,cellBackgroundColor:e.getAttribute("style")?.includes("background-color:")?G(e.style.backgroundColor):"",cell_borderAll:n,cell_borderTop:r,cell_borderRight:o,cell_borderBottom:i,cell_borderLeft:s,...a}}function UG(e){const t=e.closest("a");return{linkHref:t?.getAttribute("href")?.trim()??"",textLink:!!t,linkTarget:t?.getAttribute("target")??""}}function jG(e){const t=e?.closest('div[style*="font-size"]');return e?.style?.fontSize?parseInt(e.style.fontSize,10):t?.style?.fontSize?parseInt(t.style.fontSize,10):null}function VG(e,t){const n=t.requestElemWithStyle;return{fontFamily:t.getFontFamilyFromElement(n?.closest('[style*="font-family"]')||e),fontSize:jG(n),textStrikethrough:t.textHasStyle(e,"s","strike")||n?.style.textDecoration.includes("line-through"),textUnderline:t.textHasStyle(e,"u")||n.style.textDecoration.includes("underline")||!n.style.textDecoration&&e.tagName==="A",lineHeight:t.getLineHeghtInPixels(n),textStrong:t.textHasStyle(e,"strong","b")||t.isElementHasBold(n),textItalic:t.textHasStyle(e,"i","em")||!n.closest('[style*="font-style: normal"]')&&n?.style?.fontStyle==="italic",textAlign:e.style?.textAlign||e.getAttribute("align")||e.closest("[align]")?.getAttribute("align")||"",textColor:G(e.closest('[style*="color"]')?.style.color)||G(getComputedStyle(e).color),textBackgroundColor:G(e.closest('[style*="background-color"]')?.style.backgroundColor)||G(getComputedStyle(e).backgroundColor),textValign:e.style?.verticalAlign||e.getAttribute("valign")||e.closest("[valign]")?.getAttribute("valign")||""}}function GG(e,t,n){const r=e.elem,o=r.closest("td, th")??r,i=o.closest("table"),s=qe({elem:i}),a={direction:r.getAttribute("dir")??"none",show:s.show,outlookBackground:Ea(r.closest(".em-element-custom-table")??r,"around"),customTable:{tableKey:n.tableKey(i),...HT(o),...$G(i),...WG(i),...qG(s),...zG(o),...UG(r),...VG(r,n)}};return r.getAttribute("new")&&(r.removeAttribute("new"),a.customTable.isNewLink=!0,r.setAttribute("em-edit","active")),{type:"customTable",caption:t.ELEMENT,settings:a}}function XG(){const e=new WeakMap;let t=0;return n=>{let r=e.get(n);return r||(t+=1,r=`table-${t}`,e.set(n,r)),r}}function Iu(e){return e?{value:parseFloat(e),dim:e.includes("%")?"%":"px"}:{value:null,dim:"px"}}function KG(e,t,n){const r=e.elem;return{type:"div",caption:t.CONTAINER,...n.getElementTdDiv(r),width:Iu(r.style.width),maxWidth:Iu(r.style.maxWidth),minWidth:Iu(r.style.minWidth),height:Iu(r.style.height),valign:r.style.verticalAlign??"",align:r.style.textAlign??"",direction:r.getAttribute("dir")??"none"}}function FT(e,t){const n=e==null?null:typeof e=="number"?e:Number(e);return{value:n==null||Number.isNaN(n)?null:n,dim:t==="%"?"%":"px"}}function YG(e){return e.tagName==="TABLE"&&e.getAttribute("em")==="atom"}function $T(e,t,n){return e?{fontFamily:La(e.closest('[style*="font-family"]')||e),textStrong:et(e,"strong","b")||Nu(e)||!!t?.querySelector("strong")||!!t?.querySelector("bold")||e.querySelector("span")?.style?.fontWeight?.includes("bold"),textItalic:!e.closest('[style*="font-style: normal"]')&&e.style?.fontStyle==="italic"||!!e.querySelector("em")||!!e.querySelector("i")||e.querySelector("span")?.style?.fontStyle?.includes("italic"),fontSize:parseFloat(e.closest('[style*="font-size"]')?.style.fontSize)||0,lineHeight:n.getLineHeghtInPixels(e),textColor:G(e.closest('[style*="color"]')?.style.color)||"",textBackgroundColor:G(e.closest('[style*="background-color"]')?.style.backgroundColor)||"",textStrikethrough:ZG(e),textUnderline:QG(e)}:{}}function ZG(e){return e.style?.textDecorationLine?.includes("line-through")||e.querySelector("em")?.style?.textDecorationLine?.includes("line-through")||e.querySelector("span")?.style?.textDecorationLine?.includes("line-through")||e.style?.textDecoration?.includes("line-through")||e.querySelector("em")?.style?.textDecoration?.includes("line-through")||e.querySelector("span")?.style?.textDecoration?.includes("line-through")||!!e.querySelector("strike")}function QG(e){return e.style?.textDecorationLine?.includes("underline")||e.querySelector("em")?.style?.textDecorationLine?.includes("underline")||e.querySelector("span")?.style?.textDecorationLine?.includes("underline")||e.style?.textDecoration?.includes("underline")||e.querySelector("em")?.style?.textDecoration?.includes("underline")||e.querySelector("span")?.style?.textDecoration?.includes("underline")||!!e.querySelector("underline")||!!e.querySelector("u")}function JG(e,t,n){const r=e.elem.querySelector(".em-element-list-ul")||e.elem.querySelector(".em-element-list-ol")||null,o=r?e.elem.querySelector('table[class^="em-element-list"] tr td:nth-child(2) div'):null,i=qe({elem:e.elem}),s=e.elem.querySelector("td"),a=n.getElementTdDiv(s),l=r?$T(o,r,n):{};return{type:"td",caption:t.ELEMENT,...a,mobileWidth:FT(i.mobileWidth,i.mobileWidthDim),direction:s?.getAttribute("dir")??"none",elementName:r?"List":"",...l}}function eX(e,t,n){const r=e.elem.closest("table")?.closest("td"),o=e.elem.closest("table");if(!r&&!o)return{settings:null,editTargetTd:null,shouldResetProgrammaticSelection:!0};const i=r?.querySelector('table[class^="em-element-list"] tr td:nth-child(2) div'),s=!!(r?.querySelector(".em-element-list-ul")||r?.querySelector(".em-element-list-ol")),a=qe({elem:r}),l=r?.querySelector("td"),c=n.getElementTdDiv(l),u=i?$T(i,o,n):{};return{settings:{type:"td",caption:t.ELEMENT,...c,mobileWidth:FT(a.mobileWidth,a.mobileWidthDim),direction:l?.getAttribute("dir")??"none",elementName:s?"List":"",...u},editTargetTd:l,shouldResetProgrammaticSelection:!0}}function WT(e){return e===null||e==="auto"?null:typeof e=="number"?e:null}function tX(e){return e?{value:parseFloat(e),dim:e.includes("%")?"%":"px"}:{value:null,dim:"px"}}function qT(e){return e?{value:parseFloat(e),dim:e.includes("%")?"%":"px"}:{value:null,dim:"px"}}function nX(e){const t=e.firstElementChild;if(!t)return 0;const n=t.getAttribute("width");return e.style.maxWidth?parseFloat(e.style.maxWidth)-parseFloat(n||"0"):e.style.width?n&&n.includes("0%")?0:parseFloat(e.style.width)-parseFloat(n||"0"):0}function rX(e,t){const n=e.elem,r=qe({elem:n}),o=n.firstElementChild,i=o?qe({elem:o}):null,s=WT(r.mobileWidth),a=i?WT(i.mobileWidth):null;return{type:"floatBlock",caption:t.FLOAT_BLOCK,width:tX(o?.getAttribute("width")),gap:{value:nX(n),dim:"px"},maxWidth:qT(n.style.maxWidth),minWidth:qT(n.style.minWidth),valign:n.style.verticalAlign??"",mobileWidth:{value:s,dim:r.mobileWidthDim??"px"},mobileContentWidth:{value:a,dim:i?.mobileWidthDim??"px"},mobileVerticalAlign:r.mobileVerticalAlign,show:r.show}}function zT(e){if(e.tagName!=="DIV")return!1;const t=e.style.display,n=t==="inline-block"||t==="table-cell",r=!!e.style.verticalAlign;return n&&r}function $p(e){return e.getAttribute("src")}function oX(e,t){const n=Hf(e.elem),r=$p(n),o=qe({elem:n}),i=n.closest("td"),s=i?qe({elem:i}):null;let a="img",l=t.PICTURE;e.elem.classList.contains("em-countdown")?(a="countdown",l=t.COUNTDOWN):e.elem.classList.contains("em-video")&&(a="video",l=t.VIDEO);const c=d=>d===null||d==="auto"?null:typeof d=="number"?d:null,u={type:a,caption:l,src:r??"",width:UT(n,"width"),height:UT(n,"height"),alt:n.getAttribute("alt")??"",title:n.getAttribute("title")??"",align:i?.getAttribute("align")??"undefined",valign:n.style?.verticalAlign??"undefined",border:mu(n),borderRadius:Oi(n),boxShadow:ya(n),mobileWidth:{value:c(o.mobileWidth),dim:o.mobileWidthDim??"px"},mobileHeight:{value:c(o.mobileHeight),dim:o.mobileHeightDim??"px"},mobileBorder:o.mobileBorder,mobileBorderRadius:o.mobileBorderRadius,mobileBoxShadow:o.mobileBoxShadow,mobileAlign:s?.mobileAlign,mobileVerticalAlign:o.mobileVerticalAlign,show:o.show,link:n.closest("a")?.getAttribute("href")??null,renderedWidth:Math.round(e.elem.getBoundingClientRect().width),renderedHeight:Math.round(e.elem.getBoundingClientRect().height),imgReplacer:n.closest("em-replace")?.getAttribute("src")??""};if(a==="countdown"&&(u.countdown=e.elem.getAttribute("em-cd-settings")??void 0),a==="video"){const d=e.elem.getAttribute("em-video-settings");if(d)try{u.video=JSON.parse(d.replaceAll("'",'"'))}catch{u.video={}}}return Na(e.elem)&&(u.showOnMobile=!0),i&&(u.maxWidth=Math.round(i.getBoundingClientRect().width)),u}function UT(e,t){const n=e.getAttribute(t);return!n||n==="auto"?{value:null,dim:"px"}:{value:parseFloat(n),dim:n.includes("%")?"%":"px"}}function jT(e){return e.tagName==="IMG"||e.tagName==="AMP-IMG"}function iX(e){return e.classList.contains("em-countdown")}function sX(e){return e.classList.contains("em-video")}function Oa(e){const t=String(e??"").trim();return t?G(t)??t:""}var Wp={align:"center",iconSize:40,borderRadius:0,gap:8,bgEnabled:!1,bgColor:"",borderWidth:0,borderColor:"",buttonBorderColor:"",buttonBorderWidth:0,showLabel:!1};function aX(e){if(!e)return null;const t=e.getAttribute("width")?.trim();if(t){const i=parseInt(t,10);if(!Number.isNaN(i)&&i>0)return i}const n=e.getAttribute("style")??"",r=/(?:^|;)\s*width:\s*(\d+)px/i.exec(n);if(r){const i=parseInt(r[1],10);if(!Number.isNaN(i)&&i>0)return i}const o=e.style?.width?.trim()??"";if(o){const i=parseInt(o,10);if(!Number.isNaN(i)&&i>0)return i}return e.offsetWidth>0?Math.round(e.offsetWidth):null}function lX(e,t){if(e.length===0)return t;let n=null;for(const r of e){const o=r.iconWidth;if(o==null||Number.isNaN(o)||o<=0)return t;if(n===null)n=o;else if(o!==n)return t}return n??t}function qp(e){return e.closest('table[em-type="social"]')}function cX(e){const t=e.ownerDocument;return t?Array.from(t.querySelectorAll('table[em-type="social"]')).indexOf(e):-1}function VT(e){const t=e.querySelector(":scope > tr");if(t){const r=t.querySelector(":scope > td");if(r&&we(r))return r}const n=e.querySelector("tbody > tr");if(n){const r=n.querySelector(":scope > td");if(r&&we(r))return r}return null}function qi(e){if(!e||!we(e))return"";const t=e.style?.backgroundColor?.trim()??"";return!t||t==="transparent"||t==="rgba(0, 0, 0, 0)"?"":t}function Gn(e,t){return e.hasAttribute(t)||e.hasAttribute(`data-${t}`)}function zp(e,t){return e?e.getAttribute(t)??e.getAttribute(`data-${t}`):null}function uX(e){if(!we(e))return null;const t=e.getAttribute("width")?.trim(),n=e.style.width?.trim(),r=t||n;if(!r)return null;const o=/^(\d+)/.exec(r);if(!o)return null;const i=parseInt(o[1],10);return Number.isNaN(i)||i<0?null:i}function dX(e,t){for(let n=1;n<e.length-1;n+=1){const r=e[n-1],o=e[n],i=e[n+1];if(we(r)&&we(i)&&Gn(r,"em-platform")&&Gn(i,"em-platform")&&we(o)&&!Gn(o,"em-platform")){const s=uX(o);if(s!=null){t.gap=s;return}}}}function GT(e){const t=String(e??""),n=/(?:^|;)\s*border-radius:\s*(\d+)px/i.exec(t);if(!n)return null;const r=parseInt(n[1],10);return Number.isNaN(r)||r<0?null:r}function fX(e,t){const n=VT(e)?.getAttribute("align")?.trim().toLowerCase();(n==="left"||n==="right"||n==="center")&&(t.align=n)}function mX(e,t){for(const n of e){if(!we(n)||!Gn(n,"em-platform"))continue;const r=GT(n.getAttribute("style"));if(r!=null){t.borderRadius=r;return}const o=GT(n.querySelector("img")?.getAttribute("style")??null);if(o!=null){t.borderRadius=o;return}}}function hX(e,t){for(const n of e){if(!we(n))continue;const r=n.querySelector("br"),o=r?.nextElementSibling?.tagName==="SPAN"?r.nextElementSibling:null;if(o&&o.textContent?.trim()){t.showLabel=!0;return}}t.showLabel=!1}function pX(e,t,n){const r=e.querySelector("[em-social-tray-shell], [data-em-social-tray-shell]"),o=e.querySelector("td[em-tray-cell-bg], td[data-em-tray-cell-bg]"),i=qi(r),s=qi(o&&we(o)?o:null),a=qi(e.querySelector("[em-social-tray], [data-em-social-tray]")),l=qi(t),c=qi(e),u=i||s||a||l||c;u&&(n.bgEnabled=!0,n.bgColor=u)}function gX(e){const t=VT(e);if(!t||!we(t))return"";const n=qi(t);return n||(t.getAttribute("bgcolor")?.trim()??"")}function Up(e){if(!e)return null;const t=e.style.border?.trim()??"",n=/^(\d+)px\s+solid\s+(.+)$/i.exec(t);if(!n)return null;const r=parseInt(n[1],10),o=n[2].trim();return Number.isNaN(r)||r<=0||!o?null:{w:r,color:o}}function bX(e,t){const n=Up(e);n&&(t.borderWidth=n.w,t.borderColor=n.color)}function yX(e){const t=e.closest("td[em-platform], td[data-em-platform]");if(t)return!!qp(t);const n=e.closest("td"),r=n?.previousElementSibling,o=n?.nextElementSibling;return!!(n&&!Gn(n,"em-platform")&&r&&o&&we(r)&&we(o)&&Gn(r,"em-platform")&&Gn(o,"em-platform")&&qp(n))}function vX(e,t){const n=qp(e.elem);if(!n)return{type:"social",caption:t.SOCIAL??"Social media",...Wp,hostCellBgForIconLuminance:"",blockIndex:-1,items:[]};const r={...Wp};fX(n,r),bX(n,r);const o=n.querySelector('table[role="presentation"]')||n.querySelector("table");pX(n,o,r);const i=o?.querySelector("tr"),s=i?Array.from(i.querySelectorAll(":scope > td")):[],a=s.filter(m=>we(m)&&Gn(m,"em-platform")),l=a.length>0?a:s.filter(m=>m.querySelector("img"));dX(s,r),mX(l,r),hX(l,r);let c=typeof r.buttonBorderWidth=="number"&&!Number.isNaN(r.buttonBorderWidth)?r.buttonBorderWidth:0;const u=n.querySelector("[em-social-tray-shell], [data-em-social-tray-shell]"),d=u&&we(u)?Up(u):null;if(d)c=d.w;else for(const m of l){if(!we(m))continue;const p=Up(m);if(p){c=p.w;break}}let f=l.map(m=>{if(!we(m))return{platform:"unknown",customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:"",itemBorderColor:""};const p=m,S=zp(p,"em-platform")||"unknown",C=Gn(p,"em-custom-icon"),L=p.querySelector("a"),k=p.querySelector("img"),y=L?.getAttribute("href")??"",g=L?.getAttribute("title")??k?.getAttribute("title")??"",v=k?.getAttribute("alt")??"",w=k?.getAttribute("src")??"",b=aX(k instanceof HTMLImageElement?k:null),E=k?.getAttribute("height")?.trim(),_=E?parseInt(E,10):NaN,T=!Number.isNaN(_)&&_>0,x=zp(p,"em-button-bg")?.trim()??"",N=!C&&Gn(p,"em-tray-cell-bg");let D="",R="";if(!C&&(D=x,!D&&!N&&p.style?.backgroundColor&&(D=p.style.backgroundColor.trim()),R=zp(p,"em-item-border-color")?.trim()??"",!R)){const O=p.style.border?.trim()??"",q=/^(\d+)px\s+solid\s+(.+)$/i.exec(O);q?.[2]&&(R=q[2].trim())}return{platform:S,customIcon:C,href:y,alt:v,title:g,iconSrc:w,iconWidth:b,iconHeight:T?_:b,buttonBgColor:D,itemBorderColor:R}});if(d&&f.length>0&&f.every(m=>m.customIcon||!String(m.itemBorderColor??"").trim())){const m=d.color;f=f.map(p=>p.customIcon?p:{...p,itemBorderColor:m})}const h=lX(f,Wp.iconSize);return{type:"social",caption:t.SOCIAL??"Social media",align:r.align,iconSize:h,borderRadius:r.borderRadius,gap:r.gap,bgEnabled:r.bgEnabled,bgColor:Oa(r.bgColor),borderWidth:r.borderWidth,borderColor:Oa(r.borderColor),buttonBorderColor:"",buttonBorderWidth:c,showLabel:r.showLabel,hostCellBgForIconLuminance:Oa(gX(n)),blockIndex:cX(n),items:f.map(m=>({...m,buttonBgColor:Oa(m.buttonBgColor),itemBorderColor:Oa(m.itemBorderColor)}))}}function XT(e){return e.tagName==="TBODY"&&Array.from(e.childNodes).every(KT)}function EX(e){return e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim()}function KT(e){return e.nodeType===Node.COMMENT_NODE}function cn(e){if(e.tagName!=="TABLE")return!1;const t=Array.from(e.childNodes).filter(r=>!KT(r));if(t.length===0)return!0;const n=t.filter(r=>!EX(r));return n.length===1&&n[0]instanceof Element&&XT(n[0])}function jp(e=document){for(const t of Array.from(e.querySelectorAll("table")))if(cn(t))return t;return null}function Vp(){const e=jf(document,'[em="group"]');return jf(e||document,'[em="block"]')}function br(e){const t=e.children.length===1?e.children[0]:null;return t&&XT(t)?t:e}function SX(e,t){const n=e.getAttribute(t);return!n||n==="auto"?{value:null,dim:"px"}:{value:parseFloat(n),dim:n.includes("%")?"%":"px"}}function YT(e,t){const n=e.style[t];return n?{value:parseFloat(n),dim:n.includes("%")?"%":"px"}:{value:null,dim:"px"}}function wX(e){return e===null||e==="auto"?null:typeof e=="number"?e:null}function _X(e){if(e.style.backgroundImage){const t=e.style.backgroundImage;return[{type:"url",value:t.substring(5,t.length-2)}]}return e.getAttribute("background")?[{type:"url",value:e.getAttribute("background")||""}]:[{type:"url",value:""}]}function CX(e,t){const n=e.elem;if(cn(n))return{type:"emptyTable",caption:t.TABLE};n.setAttribute("em-edit","active");const r=qe({elem:n}),o={type:"table",caption:t.TABLE,backgroundColor:n.style.backgroundColor?G(n.style.backgroundColor):"",backgroundImage:_X(n),backgroundPositionX:n.style.backgroundPositionX!=="initial"?n.style.backgroundPositionX:"",backgroundPositionY:n.style.backgroundPositionY!=="initial"?n.style.backgroundPositionY:"",backgroundRepeat:n.style.backgroundRepeat||"repeat",backgroundSize:n.style.backgroundSize||"auto",width:SX(n,"width"),maxWidth:YT(n,"maxWidth"),minWidth:YT(n,"minWidth"),align:n.getAttribute("align")??"",border:mu(n),boxShadow:ya(n),borderRadius:Oi(n),mobileWidth:{value:wX(r.mobileWidth),dim:r.mobileWidthDim??"px"},mobileBorder:r.mobileBorder,mobileBorderRadius:r.mobileBorderRadius,mobileBoxShadow:r.mobileBoxShadow,show:r.show,mobileAlign:r.mobileAlign,mobileBackgroundColor:r.mobileBackgroundColor,mobileBackgroundImage:r.mobileBackgroundImage,mobileBackgroundPositionX:r.mobileBackgroundPositionX,mobileBackgroundPositionY:r.mobileBackgroundPositionY,mobileBackgroundRepeat:r.mobileBackgroundRepeat,mobileBackgroundSize:r.mobileBackgroundSize,exportAsPicture:n.getAttribute("em-operation")==="exportAsPicture",outlookBackground:Ea(n,"around")};return Na(n)&&(o.showOnMobile=!0),o}function TX(e){return e.tagName==="TABLE"&&e.getAttribute("em")!=="atom"}function AX(e){if(e.tagName!=="TD")return e.closest("table")?.parentElement?.tagName==="BODY";if(e.classList.contains("em-vindent")||e.innerHTML===""||e.closest("table")?.getAttribute("em")==="atom"||e.firstChild?.tagName==="EDITOR")return!1;const t=!!e.querySelector('div[style*="inline-block"]'),n=!!e.querySelector(":scope > table > tr > .em-mob-wrap, :scope > table > tbody > tr > .em-mob-wrap, :scope > table > tr > td > table > tr > .em-mob-wrap, :scope > table > tbody > tr > td > table > tbody > tr > .em-mob-wrap, :scope > table > tr > td > table > tr > td > table > tr > .em-mob-wrap, :scope > table > tbody > tr > td > table > tbody > tr > td > table > tbody > tr > .em-mob-wrap, :scope > table > tr > .noresp-em-mob-wrap, :scope > table > tbody > tr > .noresp-em-mob-wrap, :scope > table > tr > td > table > tr > .noresp-em-mob-wrap, :scope > table > tbody > tr > td > table > tbody > tr > .noresp-em-mob-wrap, :scope > table > tr > td > table > tr > td > table > tr > .noresp-em-mob-wrap, :scope > table > tbody > tr > td > table > tbody > tr > td > table > tbody > tr > .noresp-em-mob-wrap");return!!(!t&&!n||t&&e.parentElement?.getAttribute("em")!=="block"&&!e.querySelector(".em-mob-wrap, .noresp-em-mob-wrap"))}function kX(e){if(e.tagName!=="TD"||e.classList.contains("em-vindent")||e.innerHTML===""||e.firstChild?.tagName==="EDITOR"||!(e.parentElement?.getAttribute("em")==="block"||e.parentElement?.parentElement?.getAttribute("em")==="block"||e.parentElement?.parentElement?.parentElement?.getAttribute("em")==="block"))return!1;const t=!!e.querySelector('div[style*="inline-block"]'),n=!!e.querySelector(":scope > table > tr > .em-mob-wrap, :scope > table > tbody > tr > .em-mob-wrap, :scope > table > tr > td > table > tr > .em-mob-wrap, :scope > table > tbody > tr > td > table > tbody > tr > .em-mob-wrap, :scope > table > tr > td > table > tr > td > table > tr > .em-mob-wrap, :scope > table > tbody > tr > td > table > tbody > tr > td > table > tbody > tr > .em-mob-wrap, :scope > table > tr > .noresp-em-mob-wrap, :scope > table > tbody > tr > .noresp-em-mob-wrap, :scope > table > tr > td > table > tr > .noresp-em-mob-wrap, :scope > table > tbody > tr > td > table > tbody > tr > .noresp-em-mob-wrap, :scope > table > tr > td > table > tr > td > table > tr > .noresp-em-mob-wrap, :scope > table > tbody > tr > td > table > tbody > tr > td > table > tbody > tr > .noresp-em-mob-wrap");return t||n}function LX(e){if(e.tagName==="TD"){if(e.innerHTML!==""||e.getAttribute("height"))return!1;const t=!e.getAttribute("width")||e.classList.contains("em-mob-wrap")||e.classList.contains("noresp-em-mob-wrap"),n=!!e.closest('[em="block"].empty-structure')||!!e.closest(".em-structure");return t&&n}return e.tagName==="DIV"?!!e.closest("amp-accordion")&&!e.innerHTML:!1}function NX(e){if(e.tagName!=="TD")return!1;const t=!!e.firstChild&&e.firstChild.tagName==="EDITOR";return t&&e.closest("table")?.getAttribute("em")==="atom"?!0:!(t||e.classList.contains("em-vindent"))}function xX(e){const t={items:[],gap:null,gapMobile:null,valign:"",wrap:void 0,dirRevers:!1,mobile:null,mobileValign:null},n=".em-mob-wrap, .noresp-em-mob-wrap",r=e.querySelector(n),o=e.querySelectorAll(n).length;if(r&&e.querySelectorAll(".em-mob-wrap:first-child, .noresp-em-mob-wrap:first-child").length===1)t.wrap=!0,e.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)").forEach(i=>{if(t.items.push({width:parseFloat(i.getAttribute("width")||"0"),current:!1}),o>1){const s=r.nextElementSibling;t.gap=parseFloat(s?.getAttribute("width")||"0");const a=qe({elem:s});t.gapMobile=a.mobileHeight||0}else t.gap=0;(i.classList.contains("em-mob-wrap-cancel")||i.classList.contains("noresp-em-mob-wrap-cancel"))&&(t.wrap=!1)}),t.valign=r.getAttribute("valign")||"",t.mobile=r.parentElement?Fi(r.parentElement):null,t.mobileValign=r.parentElement?Rp(r.parentElement):null,(r?document.querySelector('[em-edit="active"]'):e.closest(n)?.parentElement?.closest("td"))?.getAttribute("dir")==="rtl"&&(t.dirRevers=!0);else if(e.querySelector('div[style*="inline-block"]')){const i=e.querySelectorAll('div[style*="inline-block"]');if(i.length>1)i.forEach(a=>{const l=a,c=l.firstElementChild;t.items.push({width:parseFloat(c?.getAttribute("width")||"0"),current:!1});const u=c?.getAttribute("width"),d=parseFloat(l.style.width);!u||u.includes("%")?t.gap=d-d:t.gap=d-parseFloat(u)});else{const a=e.querySelector('div[style*="inline-block"]');t.items=[{width:parseFloat(a.firstElementChild?.getAttribute("width")||"0"),current:!0}],t.gap=0}const s=e.querySelector('div[style*="inline-block"]');t.valign=s?.style.verticalAlign||"",(s?document.querySelector('[em-edit="active"]'):e.closest('div[style*="inline-block"]')?.parentElement)?.getAttribute("dir")==="rtl"&&(t.dirRevers=!0)}return t}function OX(e,t,n){const r=e.elem,o={...n.getElementTdDiv(r),direction:r.getAttribute("dir")??"none"};let i="td",s=t.TABLE_COLUMN;return(r.classList.contains("em-mob-wrap")||r.classList.contains("noresp-em-mob-wrap"))&&(i="column"),r.parentElement?.getAttribute("em")==="group"?(s=t.ELEMENT_PATH_GROUP??t.GROUP,i="group"):r.closest("table")?.parentElement?.tagName==="BODY"?(s=t.GROUP,i="group"):r.classList.contains("em-mob-wrap")?s=t.FLOAT_BLOCK:r.parentElement?.getAttribute("em")==="block"&&(s=t.STRUCTURE),{type:i,caption:s,settings:o}}function RX(e,t,n){const r=e.elem,o={...n.getElementTdDiv(r),direction:r.getAttribute("dir")??"none"};return o.floatBlocks=xX(r),o.isContrastBlock=!!r.closest(".em-contrast-block"),{type:"structure",caption:t.STRUCTURE,settings:o}}function MX(e,t,n){const r=e.elem,o={...n.getElementTdDiv(r),direction:r.getAttribute("dir")??"none"};let i=t.TABLE_COLUMN,s="td";return r.parentElement?.getAttribute("em")==="group"?(i=t.ELEMENT_PATH_GROUP??t.GROUP,s="group"):r.closest("table")?.getAttribute("em")==="atom"?i=t.ELEMENT:r.parentElement?.getAttribute("em")==="block"&&(i=t.STRUCTURE),{type:s,caption:i,settings:o}}function PX(e){if(e.nodeType!==Node.ELEMENT_NODE)return[e];const t=e;return t.querySelectorAll("tbody").forEach(n=>n.replaceWith(...Array.from(n.childNodes))),t.tagName==="TBODY"?Array.from(t.childNodes):[t]}function ZT(e){return Ne(e,!0).flatMap(PX)}function zi(e,t){e.replaceChildren(...ZT(t))}function IX(e){return e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim()}function Ra(e,t){const n=ZT(t),r=n.filter(s=>!IX(s)),[o]=r,i=r.length===1&&o.nodeType===Node.ELEMENT_NODE&&o.tagName==="TABLE";e.replaceChildren(...i?Array.from(o.childNodes):n)}function DX(e,t,n){const r=document.createElement("div");return Le(r,e),r.querySelectorAll("tr").forEach(o=>{const i=o.querySelectorAll("td");if(i.length>1){const s=i[1],a=(s.getAttribute("style")||"").split(";").filter(u=>u.trim()!==""),l={};a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());l[d]=f}),l[t]=`${n}px`;const c=Object.entries(l).map(([u,d])=>`${u}: ${d}`).join("; ");s.setAttribute("style",c)}}),Ke(r)}function BX(e,t){const n=document.createElement("div");return Le(n,e),n.querySelectorAll("tr").forEach(r=>{const o=r.querySelector("td:first-child");if(o){const i=o.querySelector("div");i&&(i.innerHTML=t)}}),Ke(n)}function HX(e,t){const n=document.createElement("div");return Le(n,e),n.querySelectorAll("tr").forEach(r=>{const o=r.querySelector("td:first-child");if(o){const i=o.querySelector("div");if(i){const s=i.getAttribute("style")||"",a=s.split(";").map(l=>l.trim()).filter(l=>l);if(a.some(l=>l.startsWith("color"))){const l=a.map(c=>c.startsWith("color")?`color: ${t};`:c);i.setAttribute("style",l.join("; "))}else i.setAttribute("style",s?`${s} color: ${t};`:`color: ${t};`)}}}),Ke(n)}function FX(e,t){const n=document.createElement("div");return Le(n,e),n.querySelectorAll("tr").forEach(r=>{const o=r.querySelector("td:first-child");if(o){const i=o.querySelector("div");if(i){const s=i.getAttribute("style")||"",a=s.split(";").map(l=>l.trim()).filter(l=>l);if(a.some(l=>l.startsWith("font-size"))){const l=a.map(c=>c.startsWith("font-size")?`font-size: ${t}px;`:c);i.setAttribute("style",l.join("; "))}else i.setAttribute("style",s?`${s} font-size: ${t}px;`:`font-size: ${t}px;`)}}}),Ke(n)}function $X(e,t){if(typeof t!="boolean")throw new Error("Invalid isBold value: must be a boolean");const n=t?"bold":"normal",r=document.createElement("div");return Le(r,e),r.querySelectorAll("tr").forEach(o=>{const i=o.querySelector("td:first-child");if(i){const s=i.querySelector("div");if(s){const a=s.getAttribute("style")||"",l=a.split(";").map(c=>c.trim()).filter(c=>c);if(l.some(c=>c.startsWith("font-weight"))){const c=l.map(u=>u.startsWith("font-weight")?`font-weight: ${n};`:u);s.setAttribute("style",c.join("; "))}else s.setAttribute("style",a?`${a} font-weight: ${n};`:`font-weight: ${n};`)}}}),Ke(r)}function WX(e,t){if(typeof t!="boolean")throw new Error("Invalid isItalic value: must be a boolean");const n=t?"italic":"normal",r=document.createElement("div");return Le(r,e),r.querySelectorAll("tr").forEach(o=>{const i=o.querySelector("td:first-child");if(i){const s=i.querySelector("div");if(s){const a=s.getAttribute("style")||"",l=a.split(";").map(c=>c.trim()).filter(c=>c);if(l.some(c=>c.startsWith("font-style"))){const c=l.map(u=>u.startsWith("font-style")?`font-style: ${n};`:u);s.setAttribute("style",c.join("; "))}else s.setAttribute("style",a?`${a} font-style: ${n};`:`font-style: ${n};`)}}}),Ke(r)}function qX(e,t){if(typeof t!="boolean")throw new Error("Invalid shouldUnderline value: must be a boolean");const n=document.createElement("div");return Le(n,e),n.querySelectorAll("tr").forEach(r=>{const o=r.querySelector("td:first-child");if(o){const i=o.querySelector("div");if(i){const s=i.getAttribute("style")||"",a=s.split(";").map(d=>d.trim()).filter(d=>d);let l="none";const c=a.findIndex(d=>d.startsWith("text-decoration"));if(c!==-1){const d=a[c].match(/^text-decoration\s*:\s*(.*)$/);d&&(l=d[1].trim())}let u;t?l.includes("line-through")?u="underline line-through":u="underline":l.includes("line-through")?u="line-through":u="none",c!==-1?(a[c]=`text-decoration: ${u};`,i.setAttribute("style",a.join("; "))):i.setAttribute("style",s?`${s} text-decoration: ${u};`:`text-decoration: ${u};`)}}}),Ke(n)}function zX(e,t){if(typeof t!="boolean")throw new Error("Invalid shouldStrikethrough value: must be a boolean");const n=document.createElement("div");return Le(n,e),n.querySelectorAll("tr").forEach(r=>{const o=r.querySelector("td:first-child");if(o){const i=o.querySelector("div");if(i){const s=i.getAttribute("style")||"",a=s.split(";").map(d=>d.trim()).filter(d=>d);let l="none";const c=a.findIndex(d=>d.startsWith("text-decoration"));if(c!==-1){const d=a[c].match(/^text-decoration\s*:\s*(.*)$/);d&&(l=d[1].trim())}let u;t?l.includes("underline")?u="underline line-through":u="line-through":l.includes("underline")?u="underline":u="none",c!==-1?(a[c]=`text-decoration: ${u};`,i.setAttribute("style",a.join("; "))):i.setAttribute("style",s?`${s} text-decoration: ${u};`:`text-decoration: ${u};`)}}}),Ke(n)}function UX(e){return!e||!(e instanceof Node)?null:document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:t=>t.nodeValue?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}).nextNode()}function jX(e){if(!e||!(e instanceof Node))return null;const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:o=>o.nodeValue?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});let n=null,r;for(;r=t.nextNode();)n=r;return n}function VX(e){if(!e||!we(e))return"inside";const t=window.getSelection();if(!t||t.rangeCount===0)return"inside";const n=t.getRangeAt(0);if(!n.collapsed)return"inside";let{startContainer:r,startOffset:o}=n;if(r===e)return o===0?"start":o===e.childNodes.length?"end":"inside";const i=UX(e),s=jX(e);let a=r;return a&&a.nodeType===Node.ELEMENT_NODE&&(a=a.childNodes[0]),i&&a===i&&o===0?"start":s&&r===s&&(o===s?.nodeValue?.length||o===s?.nodeValue?.trim().length)?"end":"inside"}function QT(e){const t=e.cloneNode(!0);nn(e,t);const n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,null);let r;for(;r=n.nextNode();)r.nodeValue="";return t}function Gp(e){let t="";for(const n of e.attributes)t+=` ${n.name}="${n.value}"`;return t}function GX(e,t){const n=e.closest(`table.${t}`);if(!n)return null;const r=n.querySelector("tbody"),o=Ke(r??n).trim(),i=e.closest("tr");if(!i)return{rowHtml:o,firstCellText:"",secondCellText:"",firstCellHtmlNoText:"",secondCellHtmlNoText:"",secondCellWrapperHtml:"",secondCellInnerDivHtml:"",wrappedSecondCellHtml:"",secondCellInnerDivWrapperHtml:"",secondCellTextHTML:""};const s=i.querySelectorAll("td"),a=s[0]||null,l=s[1]||null,c=a?a.textContent.trim():"",u=l?l.textContent.trim():"",d=l?Ke(l).trim():"",f=a?Tr(QT(a)):"",h=l?Tr(QT(l)):"",m=l?`<td${Gp(l)}></td>`:"",p=l?l.querySelector("div"):null;return{rowHtml:o,firstCellText:c,secondCellText:u,firstCellHtmlNoText:f,secondCellHtmlNoText:h,secondCellWrapperHtml:m,secondCellInnerDivHtml:p?Tr(p):"",wrappedSecondCellHtml:l&&p?`<td${Gp(l)}>${Tr(p)}</td>`:"",secondCellInnerDivWrapperHtml:p?`<div${Gp(p)}></div>`:"",secondCellTextHTML:d}}function JT(e){const t=document.createElement("textarea");return t.innerHTML=e,t.value}function eA(e,t){const n=document.createElement("template");Le(n,e);const r=n.content.firstElementChild;if(!r||r.tagName.toLowerCase()!=="td")return e;const o=r.querySelector("div");return o?o.textContent=JT(t)||" ":r.insertAdjacentText("afterbegin",JT(t)),Tr(r)}function Ui(e){const t=document.createElement("template");return Le(t,e),t.content.querySelectorAll("editor").forEach(n=>{n.replaceWith(...Array.from(n.childNodes))}),t.content.querySelectorAll('[em-edit="active"]').forEach(n=>{n.removeAttribute("em-edit")}),Ke(t)}function tA(e){e.removeAttribute("id"),e.querySelectorAll("[id]").forEach(t=>t.removeAttribute("id"))}function XX(e,t,n,r=!0){const o=document.createElement("template");Le(o,e.trim());const i=o.content.querySelector(`div.${n}`);if(i){const s=i.closest("tr");if(s){const a=r?"beforebegin":"afterend";s.insertAdjacentHTML(a,t)}}return Ke(o)}function KX(e){let t=1;return e.map(n=>{if(n.cellOneText&&/^\d+\.$/.test(n.cellOneText.trim())){const o={...n,cellOneText:`${t}.`};return t++,o}if(!n.cellOneText||/^\s*$/.test(n.cellOneText))return{...n};const r={...n,cellOneText:`${t}.`};return t++,r})}function YX(e){return e.map(t=>({...t,cellOneText:t.cellOneText===""?" ":t.cellOneText,cellTwoText:t.cellTwoText===""?" ":t.cellTwoText}))}function ZX(e){if(!Array.isArray(e)||e.length===0)return e;const t=" ",n=e.map(o=>{if(!o.cellOneText)return o;let i=o.cellOneText.trim();return i.endsWith(t)||(i+=t),{...o,cellOneText:i}}),r=Math.max(...n.map(o=>o.cellOneText?o.cellOneText.length:0));return n.map(o=>{if(!o.cellOneText)return o;let i=o.cellOneText;for(;i.length<r;)i+=t;return{...o,cellOneText:i}})}function Xp(e){const t=Array.from(e.querySelectorAll("tr")).map(r=>r.querySelectorAll("td")).filter(r=>r.length>=2).map(r=>r[0].querySelector("div")),n=ZX(YX(KX(t.map(r=>({cellOneText:r?.textContent?.trim()??"",cellTwoText:""})))));t.forEach((r,o)=>{const i=n[o].cellOneText;r&&r.textContent!==i&&(r.textContent=i)})}function QX(e){e.querySelectorAll("editor").forEach(t=>t.replaceWith(...Array.from(t.childNodes))),e.querySelectorAll('[em-edit="active"]').forEach(t=>t.removeAttribute("em-edit"))}function JX(e,t,n){const r=[];let o=t;for(;o!==e;){const c=o.parentNode;if(!c)return null;r.unshift(Array.from(c.childNodes).indexOf(o)),o=c}const i=document.createRange();i.selectNodeContents(t),i.setStart(n.startContainer,n.startOffset);const s=i.extractContents(),a=e.cloneNode(!0);nn(e,a);const l=r.reduce((c,u)=>c.childNodes[u],a);return l.replaceChildren(s),[t,l].forEach(c=>{(c.textContent??"").trim()||(c.textContent=" ")}),{row:a,content:l}}function eK(e,t,n,r){const o=new DOMParser().parseFromString(e,"text/html");Rd(o,e);const i=o.querySelector(`div.${t}`);if(!i)return e;const s=i.closest("tr");if(!s)return e;const a=r==="ArrowUp"?s.previousElementSibling:s.nextElementSibling;if(a&&a.tagName==="TR"){const c=a.querySelectorAll("td")[1]||null;if(c){const u=c.querySelector("div");u&&u.classList.add(n)}}else i.classList.add(n);const l=o.querySelector("table");return l?Tr(l):e}function tK(e,t,n,r){const o=e.closest(`table.${t}`)||e.closest(`table.${n}`);o&&o.querySelectorAll("tr").forEach(i=>{const s=i.querySelector("td:nth-child(2)");if(!s)return;const a=Array.from(s.querySelectorAll("div, strong")).filter(l=>!l.closest("template"));if(a.length===0){const l=document.createElement("div");l.innerHTML=" ",s.appendChild(l)}else a.forEach(l=>{let c=je(l).trim();!c||c.replace(r,"")===""?l.innerHTML=" ":(c=c.replace(r,""),c.endsWith(" ")||(c+=" "),c=c.replace(/ +$/," "),zi(l,c))})})}function nK(e){const t=`<table><tbody><tr>${e}</tr></tbody></table>`,n=new DOMParser().parseFromString(t,"text/html");Rd(n,t);const r=n.querySelector("div");r&&(r.classList.add("remove-new-editor-element"),r.innerHTML.trim()?r.insertAdjacentHTML("beforeend"," "):r.innerHTML=" ");const o=n.querySelector("td");return o?Tr(o):""}function rK(e,t){const n=document.createElement("div");return Le(n,e),n.querySelectorAll("tr").forEach(r=>{const o=r.querySelectorAll("td");if(o.length>1){const i=o[1],s=(i.getAttribute("class")||"").split(" ").map(l=>l.trim()).filter(l=>l!=="");s.includes(t)||s.push(t);const a=s.join(" ");i.setAttribute("class",a)}}),Ke(n)}var Kp="em-element-list-ol",Yp="em-element-list-ul",oK="em-element-list-bullet",iK=`.${Kp}, .${Yp}`,sK=["DIV","P","TD","H1","H2","H3","H4","H5","H6"],aK="div, p, td, h1, h2, h3, h4, h5, h6",Xn={LIST:"margin: 0; padding: 0 0 0 20px;",LIST_ITEM:"padding-bottom: 5px;"},Ma=null;function Zp(e){const t=window.getSelection();if(t&&t.rangeCount>0){const n=t.getRangeAt(0);if(e.contains(n.startContainer))return{container:n.startContainer,offset:n.startOffset}}return Ma&&Ma.container.isConnected&&e.contains(Ma.container)?Ma:null}function lK(e){const t=[],n=Array.from(e.childNodes);let r=[],o=0;return n.forEach((i,s)=>{i.nodeType===Node.ELEMENT_NODE&&i.tagName==="BR"?(r.length>0&&t.push({html:Du(r),nodes:[...r],startIndex:o,endIndex:s-1}),r=[],o=s+1):r.push(i)}),r.length>0&&t.push({html:Du(r),nodes:[...r],startIndex:o,endIndex:n.length-1}),t}function cK(e){const t=[],n=Array.from(e.childNodes);let r=[],o=0;const i=a=>{r.length>0&&(t.push({html:Du(r),nodes:[...r],startIndex:o,endIndex:a-1}),r=[])},s=a=>a.nodeType===Node.ELEMENT_NODE&&(a.tagName==="UL"||a.tagName==="OL");return n.forEach((a,l)=>{a.nodeType===Node.ELEMENT_NODE&&a.tagName==="BR"?(i(l),o=l+1):s(a)?(i(l),t.push({html:Du([a]),nodes:[a],startIndex:l,endIndex:l}),o=l+1):r.push(a)}),i(n.length),t}function Du(e){const t=document.createElement("div");return e.forEach(n=>{const r=n.cloneNode(!0);nn(n,r),t.appendChild(r)}),ti(t),Ke(t)}function Qp(e,t){const n=Zp(t);if(!n)return 0;const r=n.container;if(!t.contains(r))return 0;for(let o=0;o<e.length;o++)for(const i of e[o].nodes)if(i===r||i.contains(r))return o;if(r===t){const o=n.offset;for(let i=0;i<e.length;i++)if(o>=e[i].startIndex&&o<=e[i].endIndex)return i;for(let i=0;i<e.length;i++)if(o===e[i].startIndex)return i;for(let i=0;i<e.length;i++)if(e[i].startIndex>=o)return i;if(e.length>0)return e.length-1}return 0}function nA(e,t,n,r){if(!n.contains(t))return r;for(let o=0;o<e.length;o++)for(const i of e[o].nodes)if(i===t||i.contains(t))return o;return r}function uK(e,t){const n=window.getSelection();if(!n||n.rangeCount===0){const a=Qp(e,t);return{start:a,end:a}}const r=n.getRangeAt(0);if(r.collapsed){const a=Qp(e,t);return{start:a,end:a}}const o=Qp(e,t),i=nA(e,r.startContainer,t,o),s=nA(e,r.endContainer,t,o);return{start:Math.min(i,s),end:Math.max(i,s)}}function rA(e){const t=Array.from(e.childNodes).filter(r=>r.nodeType!==Node.TEXT_NODE||(r.textContent??"").trim()!==""),n=t.length===1?t[0]:null;return n?.nodeName==="EDITOR"?n:e}function dK(e){e.querySelectorAll("editor").forEach(t=>t.replaceWith(...Array.from(t.childNodes)))}function oA(e){return e.nodeType===Node.TEXT_NODE&&/^[\t\n\f\r ]*$/.test(e.data)}function iA(e,t){const n=sA(t);if(n.length===0){e.append(" ");return}e.append(...n),dK(e)}function sA(e){let t=0,n=e.length-1;for(;t<=n&&oA(e[t]);)t++;for(;n>=t&&oA(e[n]);)n--;return e.slice(t,n+1)}var fK=["color","background-color","font-family","font-size","font-weight","font-style","text-decoration"];function mK(e){const t=sA(Array.from(e.childNodes)),n=document.createElement("span");return fK.forEach(r=>{const o=e.style.getPropertyValue(r);o&&n.style.setProperty(r,o,e.style.getPropertyPriority(r))}),e.className&&(n.className=e.className),!n.hasAttribute("style")&&!n.hasAttribute("class")?t:(n.append(...t),[n])}function Bu(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const{startContainer:n,startOffset:r,endContainer:o,endOffset:i}=t.getRangeAt(0),s=a=>a.nodeType===Node.TEXT_NODE&&e.contains(a);return s(n)&&s(o)?{startContainer:n,startOffset:r,endContainer:o,endOffset:i}:null}function Hu(e,t){const n=window.getSelection();if(!t||!n||!e.contains(t.startContainer)||!e.contains(t.endContainer))return!1;const r=document.createRange();return r.setStart(t.startContainer,t.startOffset),r.setEnd(t.endContainer,t.endOffset),n.removeAllRanges(),n.addRange(r),!0}function aA(e,t,n){const r=Bu(e),o=document.createElement(n);Array.from(t.attributes).forEach(s=>{o.setAttribute(s.name,s.value)}),Array.from(o.style).filter(s=>s.startsWith("margin")||s.startsWith("padding")).forEach(s=>o.style.removeProperty(s));const i=o.style.cssText;o.setAttribute("style",i?`${Xn.LIST} ${i}`:Xn.LIST),o.append(...Array.from(t.childNodes)),t.replaceWith(o),Hu(e,r)}function hK(e){return e.querySelector("br")!==null}function pK(e){const t=Zp(e);if(!t)return null;const n=t.container.nodeType===Node.ELEMENT_NODE?t.container:t.container.parentElement;if(!n)return null;const r=n.closest("ol, ul");return r&&e.contains(r)?r:null}function gK(e){const t=Zp(e);if(!t)return;const{container:n,offset:r}=t;if(n!==e)return;const o=Array.from(e.childNodes),i=r>0?o[r-1]:null,s=r<o.length?o[r]:null,a=p=>p!==null&&p.nodeType===Node.ELEMENT_NODE&&p.tagName==="BR",l=p=>p!==null&&p.nodeType===Node.TEXT_NODE&&p.data.trim()==="",c=a(i),u=a(s),d=l(s),f=r>=o.length;if(!(c&&u||c&&f||r===0&&u||c&&d))return;let h;d?(h=s,h.data=" "):(h=document.createTextNode(" "),s?e.insertBefore(h,s):e.appendChild(h));const m=window.getSelection();if(m){const p=document.createRange();p.setStart(h,0),p.collapse(!0),m.removeAllRanges(),m.addRange(p)}Ma={container:h,offset:0}}function bK(e,t){const n=rA(e),r=t?"ol":"ul";if(n.querySelector("ol, ul")){const o=pK(n);if(o){o.tagName.toLowerCase()!==r&&aA(n,o,r);return}const i=n.querySelector(":scope > ol, :scope > ul"),s=Array.from(n.childNodes).some(a=>a.nodeType===Node.ELEMENT_NODE&&a.tagName==="BR");if(i&&!s){i.tagName.toLowerCase()!==r&&aA(n,i,r);return}}hK(n)||n.querySelector(":scope > ol, :scope > ul")?(gK(n),yK(n,r)):lA(n,r)}function lA(e,t){const n=Bu(e),r=document.createElement(t);r.setAttribute("style",Xn.LIST);const o=document.createElement("li");o.setAttribute("style",Xn.LIST_ITEM),iA(o,Array.from(e.childNodes)),r.appendChild(o),e.replaceChildren(r),Hu(e,n)||cA(o)}function yK(e,t){const n=cK(e);if(n.length===0){lA(e,t);return}const{start:r,end:o}=uK(n,e),i=Bu(e),s=document.createElement(t);s.setAttribute("style",Xn.LIST);let a=null;for(let h=r;h<=o;h++){const m=document.createElement("li");m.setAttribute("style",Xn.LIST_ITEM),iA(m,n[h].nodes),s.appendChild(m),a=m}const l=document.createDocumentFragment(),c=h=>h.forEach((m,p)=>{p>0&&l.appendChild(document.createElement("br")),l.append(...m.nodes)}),u=h=>h.map(m=>m.html).join("<br>").trim()!=="",d=n.slice(0,r);u(d)&&(c(d),l.appendChild(document.createElement("br"))),l.appendChild(s);const f=n.slice(o+1);u(f)&&(l.appendChild(document.createElement("br")),c(f)),e.replaceChildren(l),!Hu(e,i)&&a&&cA(a)}function cA(e){try{const t=window.getSelection();if(t){const n=document.createRange();n.selectNodeContents(e),n.collapse(!0),t.removeAllRanges(),t.addRange(n)}}catch{}}function vK(e,t){let n=0;const r=Array.from(e.childNodes);for(const o of r){if(o===t)return n;o.nodeType===Node.ELEMENT_NODE&&o.tagName==="BR"&&n++}return n}function EK(e,t){const n=lK(e);if(t<0||t>=n.length)return;const r=n[t];if(r.nodes.length!==0)try{const o=window.getSelection();if(!o)return;const i=r.nodes[0],s=document.createRange();if(i.nodeType===Node.TEXT_NODE)s.setStart(i,0),s.collapse(!0);else if(i.nodeType===Node.ELEMENT_NODE)s.selectNodeContents(i),s.collapse(!0);else return;o.removeAllRanges(),o.addRange(s)}catch{}}function SK(e){const t=rA(e),n=t.querySelector("ol, ul");if(!n)return;const r=Bu(t),o=vK(t,n),i=document.createDocumentFragment();n.querySelectorAll(":scope > li").forEach(s=>{const a=je(s).trim();!a||a===" "||(i.hasChildNodes()&&i.appendChild(document.createElement("br")),i.append(...mK(s)))}),n.replaceWith(i.hasChildNodes()?i:" "),Hu(t,r)||EK(t,o)}function Fu(e){if(!e)return!1;const t=e.closest("ul, ol");return t?!t.closest(iK):!1}function wK(e,t,n){const r=kG()||e.elem,o=r.tagName==="EDITOR"&&r.firstChild?.nodeType===1?r.firstChild:r,i=e.elem.closest('[style*="font-family"], [style*="font-size"], [style*="line-height"]')||e.elem,s=o.style.fontFamily||o.style.fontSize||o.style.lineHeight||o.closest('[style*="font-family"], [style*="font-size"], [style*="line-height"]')?o:i,a=e.elem.closest('[style*="line-height"]')||s.querySelector('[style*="line-height"]')||s,l=r.closest('[class*="em-mob-font_size"], [style*="font-size"]')||r,c=r.closest('[class*="em-mob-line_height"]')||r.closest('[style*="line-height"]')||r,u=qe({elem:l}),d=qe({elem:c}),f=uA(e.elem,n),h=et(o,"strong","b"),m=s!==o?et(s,"strong","b"):!1,p=e.elem&&o&&e.elem.isConnected&&(o===e.elem||o.contains(e.elem))?et(e.elem,"strong","b"):!1,S=h||m||p,C=Nu(s),L=S||C,k={type:"text",caption:t.TEXT,fontFamily:La(s.closest('[style*="font-family"]')||e.elem),fontSize:parseFloat(e.elem.closest('[style*="font-size"]')?.style.fontSize)||parseFloat(getComputedStyle(e.elem).fontSize),fontSizeDim:"px",lineHeight:Lu(a),lineHeightDim:"px",textAlign:TT(e.elem),textStrong:L,textItalic:et(e.elem,"i","em")||!s.closest('[style*="font-style: normal"]')&&s.style?.fontStyle==="italic",textStrikethrough:et(e.elem,"s","strike")||(s.style?.textDecoration?.includes("line-through")??!1),textUnderline:et(e.elem,"u")||(s.style?.textDecoration?.includes("underline")??!1)||!s.style?.textDecoration&&(e.elem.tagName==="A"&&e.elem.hasAttribute("href")||AT()),textColor:Fu(r)&&G(Yr(r,"color"))||G(e.elem.closest('[style*="color"]')?.style.color)||G(getComputedStyle(e.elem).color)||"",textBackgroundColor:AK(e.elem),mobileFontSize:{value:u.mobileFontSize,dim:u.mobileFontSizeDim||"px"},mobileLineHeight:{value:d.mobileLineHeight,dim:"px"},mobileTextAlign:Ip(e.elem),linkHref:(()=>{const y=s.closest("a");if(!y)return;const g=y.getAttribute("href");if(g!==null)return g})(),textAnchor:(()=>{const y=s.closest("a");if(y&&!y.hasAttribute("href"))return y.getAttribute("name")?.trim()||void 0})(),textLink:(()=>{const y=s.closest("a");return y?!!y.hasAttribute("href"):et(e.elem,"a")||AT()})(),textReplacer:n.variableElement(e.elem),list:f,standardList:dA(e.elem),textSuperscript:et(e.elem,"sup"),textSubscript:et(e.elem,"sub")};return Na(r)&&(k.showOnMobile=!0),k}function uA(e,t){const{isElementList:n,isElementListOL:r,isElementListUL:o,requestElemBullet:i}=t;if(!n)return{isList:!1,listType:"UL"};const s=e.closest("td");return{isList:!0,listType:r?"OL":"UL",bulletsColor:n&&i?G(i.closest('[style*="color"]')?.style.color):"",betweenParagraphs:n&&parseInt(s?.style?.paddingBottom,10)||0,betweenRowCell:n&&parseInt(s?.style?.paddingLeft,10)||0,bulletFontSize:n&&i&&parseInt(i.style.fontSize,10)||0,bulletFontBold:n?i?.style.fontWeight==="bold":!1,bulletFontItalic:n?i?.style.fontStyle==="italic":!1,bulletFontFamily:r&&i?La(i):"",bulletFontUnderline:n?i?.style.textDecoration?.includes("underline")??!1:!1,bulletFontStrikethrough:n?i?.style.textDecoration?.includes("line-through")??!1:!1,bulletType:o&&i?i.innerHTML.replace(/\s| /g,""):""}}function dA(e){return Fu(e)?{listTypeOL:!!e.querySelector("ol")||!!e.closest("ol"),listTypeUL:!!e.querySelector("ul")||!!e.closest("ul")}:{listTypeOL:!1,listTypeUL:!1}}function Jp(e){if(!e)return!1;const t=e.trim().toLowerCase();return t!=="transparent"&&t!=="inherit"}var _K=new Set(["A","B","EM","I","MARK","S","SMALL","SPAN","STRIKE","STRONG","SUB","SUP","U"]);function CK(e){let t=e;for(;t&&_K.has(t.tagName);){const n=t.style.backgroundColor;if(Jp(n))return n;t=t.parentElement}return""}function TK(e,t,n){let r=e;for(;r;){const o=r.style.getPropertyValue(t);if(Jp(o))return o;if(n&&r===n)break;r=r.parentElement}return""}function AK(e){const t=CK(e);if(Jp(t))return G(t)||"";if(e.closest(".em-element-custom-table"))return G(Yr(e,"background-color"))||"";const n=e.closest("div");return G(TK(e,"background-color",n))||""}function fA(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 kK(e,t,n){const{findElementWithSelectedText:r,selectedText:o,variableElement:i,requestElemBullet:s,isElementList:a,isElementListOL:l,isElementListUL:c}=n,u=r(o,e.elem)||e.elem,d=e.elem.closest('[class*="em-mob-font_size"]')||e.elem.closest('[style*="font-size"]')||e.elem,f=e.elem.closest('[class*="em-mob-line_height"]')||e.elem.closest('[style*="line-height"]')||e.elem,h=qe({elem:d}),m=qe({elem:f}),p=uA(e.elem,n),S={type:"text",caption:t.TEXT,linkHref:(()=>{const C=e.elem.getAttribute("href");if(C!==null)return C})(),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:La(e.elem),fontSize:parseFloat(e.elem.closest('[style*="font-size"]')?.style.fontSize)||0,fontSizeDim:"px",lineHeight:Lu(e.elem),lineHeightDim:"px",textAlign:TT(e.elem),textStrong:et(u,"strong","b")||Nu(u),textItalic:et(u,"i","em")||!e.elem.closest('[style*="font-style: normal"]')&&e.elem.style?.fontStyle==="italic",textStrikethrough:et(u,"s","strike")||(e.elem.style?.textDecoration?.includes("line-through")??!1),textUnderline:et(u,"u")||(e.elem.style?.textDecoration?.includes("underline")??!1)||!(e.elem.style?.textDecoration?.length>0)&&e.elem.tagName==="A"&&e.elem.hasAttribute("href"),textColor:G(e.elem.tagName==="A"?Yr(e.elem.querySelector('[style*="color"]'),"color"):Yr(e.elem,"color"))||G(getComputedStyle(e.elem).color)||"",textBackgroundColor:G(e.elem.tagName==="A"?Yr(e.elem.querySelector('[style*="background-color"]'),"background-color"):Yr(e.elem,"background-color"))||"",mobileFontSize:{value:h.mobileFontSize,dim:h.mobileFontSizeDim||"px"},mobileLineHeight:{value:m.mobileLineHeight,dim:"px"},mobileTextAlign:Ip(e.elem),textReplacer:i(e.elem),list:p,standardList:dA(e.elem),textSuperscript:et(e.elem,"sup"),textSubscript:et(e.elem,"sub")};return Na(e.elem)&&(S.showOnMobile=!0),S}function mA(e){return e===null||e==="auto"?null:typeof e=="number"?e:null}function LK(e,t){const n=e.elem,r=qe({elem:n}),o=mA(r.mobileHeight);return{type:"vindent",caption:t.VERTICAL_INDENT,height:{value:parseFloat(n.getAttribute("height")||"0"),dim:"px"},mobileHeight:{value:o,dim:r.mobileHeightDim??"px"}}}function NK(e,t){const n=e.elem,r=qe({elem:n}),o=mA(r.mobileHeight);return{type:"vindent",caption:t.VERTICAL_INDENT,height:{value:parseFloat(n.style.height||"0"),dim:"px"},mobileHeight:{value:o,dim:r.mobileHeightDim??"px"}}}function hA(e){if(e.tagName!=="TD")return!1;if(e.classList.contains("em-vindent"))return!0;const t=e.closest("table");return e.innerHTML===""&&t?.getAttribute("width")==="100%"}function pA(e){return e.tagName!=="DIV"?!1:!e.style.fontFamily&&!!e.style.height&&!!e.style.lineHeight&&!!e.style.fontSize}function xK(e,t){return e.elem.tagName==="TD"?LK(e,t):NK(e,t)}var gA={START_POSITION:"remove-start-element-position",NEW_EDITOR:"remove-new-editor-element",ACTIVE_ELEMENT:"remove-active-element"},bA={TRIM_SPACES:/^(\s| )+|(\s| )+$/g,LT:/</g,GT:/>/g,EMPTY_TEXT:/^(?:\s| )*$/};function yA(e,t){if(!e)return!1;const n=e.closest("tr");return n?n.closest("table")?.classList.contains(t)??!1:!1}function $u(e){const t=yA(e,Kp),n=yA(e,Yp),r=t||n;let o=null;return e&&r&&(o=e.closest("table.em-element-list-ol")||e.closest("table.em-element-list-ul")),{classNameOl:Kp,classNameUl:Yp,classNameBullet:oK,isListOL:t,isListUL:n,isList:r,listType:t?"ol":n?"ul":null,tableElement:o}}function OK(e){if(!e)return null;const t=e.closest("tr");return t?t.querySelector("td:first-child div:first-child"):null}function RK(e){return e?e.querySelector(".em-element-list-ol")||e.querySelector(".em-element-list-ul"):null}function MK(e=Object.values(gA)){e.forEach(t=>{document.querySelectorAll(`.${t}`).forEach(n=>{n.classList.remove(t)})})}function PK(e){for(const t of e.classList)if(t.startsWith("em-element-"))return!1;return!0}function vA(e,t){for(const n of e.childNodes){if(n.nodeType===Node.TEXT_NODE&&n.textContent?.trim()!==""){t.push(e);break}n.nodeType===Node.ELEMENT_NODE&&vA(n,t)}}function IK(e,t,n){const r=e.getAttribute("style")||"",o={};r.split(";").forEach(function(s){if(s.trim()){const a=s.split(":");a.length>=2&&(o[a[0].trim()]=a[1].trim())}}),o[t]=n;const i=Object.keys(o).map(function(s){return o[s]?s+": "+o[s]:null}).filter(Boolean).join("; ");e.setAttribute("style",i)}function DK(e,t){let n=[];const r=t||e,o=e?.style.fontFamily||getComputedStyle(r).fontFamily,i=[...(e?.closest('[style*="font-family"]')||e).classList].filter(s=>s.startsWith("em-font-"));if(i.length>0){n=["Google Fonts"],n[1]=o.indexOf("sans-serif")>-1?"Sans Serif":"Serif";const s=i[0].match(/em-font-(.*?)-/);if(s){n[2]=s[1];const a=new RegExp(`${n[2]}-(.*)`),l=i[0].match(a);l&&(n[3]=l[1])}}else o&&(n=["Safe Fonts",o.replaceAll('"',"'")]);return n}function BK(e){if(!e)return null;try{return e.rangeCount>0?e.getRangeAt(0):null}catch{return null}}var HK="a, div, p, td, h1, h2, h3, h4, h5, h6, li, ul, ol, sup, sub";function FK(e,t=HK){if(!e)return null;const n=t.split(", ").map(o=>o.trim().toLowerCase());let r=e.nodeType===Node.ELEMENT_NODE?e:e.parentNode;for(;r&&r.nodeType===Node.ELEMENT_NODE;){const o=r;if(n.includes(o.tagName.toLowerCase())&&o.style.fontSize)return o;r=r.parentNode}return null}function $K(e,t){const{elem:n,message:r,activateSection:o}=e;if(n.closest("table")?.parentElement?.tagName!=="BODY"){r.settings.parent=t.getElementParentCaption(n);let a=n;if(n.tagName==="IMG"){const l=n.closest('div[em="atom"]'),c=n.closest(".em-element-resize-img-container");a=l||c}else n.closest("editor")?a=n.parentElement:n.tagName==="TD"&&n.classList.contains("em-vindent")?a=n.closest(".em-vindent-table"):n.tagName==="TD"&&n.parentElement?.getAttribute("em")==="block"&&(a=n.parentElement);r.settings.nextElem=!!a?.nextElementSibling&&(!a.nextElementSibling.getAttribute("contenteditable")||a.nextElementSibling.getAttribute("contenteditable")!=="false"),r.settings.prevElem=!!a?.previousElementSibling&&(!a.previousElementSibling.getAttribute("contenteditable")||a.previousElementSibling.getAttribute("contenteditable")!=="false")}else r.settings.parent=void 0;(n.closest('div[style*="inline-block"]')||n.closest(".em-mob-wrap, .noresp-em-mob-wrap"))&&(r.settings.floatBlocks=t.getStructureColumns({elem:n})),o&&(r.settings.activateSection=o),n.classList.contains("em-mob-wrap")||n.classList.contains("noresp-em-mob-wrap")||n.parentElement?.hasAttribute("em")&&n.parentElement.getAttribute("em")==="group"&&document.querySelectorAll('[em="group"]').length===1?r.settings.deletable=!1:r.settings.deletable=!0,r.settings.usedColors=t.getUsedColors(),r.settings.path=t.getElementPath(n);const i=t.getCurrentElementPath();r.type==="button"&&(r.settings.commonStyles=t.commonStyles);const s=n?.classList;return t.ampService.hasAmp&&s&&(s.contains("em-amp-show-only")?r.settings.ampShow="amp":s.contains("em-amp-show-disabled")?r.settings.ampShow="html":r.settings.ampShow="all"),r.settings=t.mapObj.unescape(r.settings),{message:r,elementPath:i}}function WK(e,t,n,r){let o=!1,i=!1;if(t.shouldResetProgrammaticSelection&&(i=!0,!t.settings||Object.keys(t.settings).length===0))return o=!0,{shouldReturn:o,isProgrammaticSelectionReset:i};if(t.removeEmEdit){if(r.removeAllAttributes("em-edit"),t.setEmEditOnTd){for(const s of e.querySelectorAll("[contenteditable]"))s.removeAttribute("contenteditable");e.querySelector("td")?.setAttribute("em-edit","active")}if(t.editTargetTd){const s=e.closest("table")?.closest("td");if(s)for(const a of s.querySelectorAll("[contenteditable]"))a.removeAttribute("contenteditable");t.editTargetTd.setAttribute("em-edit","active")}}return t.isNewLink&&(e.removeAttribute("new"),n.settings.isNewLink=!0,e.setAttribute("em-edit","active")),{shouldReturn:o,isProgrammaticSelectionReset:i}}function qK(e,t,n,r){if(!document.body.classList.contains("mceNonEditable")&&!(!t&&n)){if(r.removeAllAttributes("em-edit"),e.tagName!=="TABLE"){Hf(e).setAttribute("em-edit","active");const o=e.closest("table");if(o){for(const a of o.querySelectorAll('[contenteditable="true"]'))a.tagName!=="EDITOR"&&a.removeAttribute("contenteditable");const i=o.querySelector("editor"),s=i?.firstChild;i?.childNodes.length===1&&s?.nodeType===1&&s?.tagName==="A"&&s?.childNodes.length===1&&s?.firstChild?.nodeType===3?s.setAttribute("contenteditable","true"):i?.setAttribute("contenteditable","true")}}[...e.parentElement?.querySelectorAll("strike, s")||[]].forEach(o=>o.style.textDecoration="line-through"),[...e.parentElement?.getElementsByTagName("u")||[]].forEach(o=>o.style.textDecoration="underline")}}function zK(e,t){const n=t.getSelectedText(),r=window.getSelection(),o=t.getRangeFromSelection(r);let i=null,s=null,a=null;function l(c){let u=c;u.nodeType===Node.TEXT_NODE&&(u=u.parentNode);const d=u?.closest("em-replace");return e?d?.textContent||null:d?.getAttribute("text")||null}return o&&(n?(s=l(o.startContainer),a=l(o.endContainer),s?.length&&a?.length&&s!==a&&(s=a=null)):i=l(o.commonAncestorContainer)),n?s||a:i}function UK(e,t){let n=t.getVariableByIcon(e)||!t.htmlDocument.getMappedParent(e)?e:t.htmlDocument.getVisibleNode(e);if(n.closest("a")&&t.findOutermostParentWithText(n,"a")&&n.tagName!=="IMG"&&n.tagName!=="AMP-IMG"&&(n=t.findOutermostParentWithText(n,"a")),n?.closest(".em-vindent")){const r=n.closest('div[style*="height"][style*="line-height"]');r?n=r:n=n.closest("td")}return n.tagName==="DIV"&&n.closest("amp-accordion")&&setTimeout(()=>{t.sendResizeEvent()},350),(n?.closest(".em-element-resize-img")||n?.closest(".em-element-img-change-group")||n?.closest(".em-element-resize-img-container"))&&(n=n.closest(".em-element-resize-img-container").querySelector("img")),(n.tagName==="TD"&&n.classList.contains("em-mob-wrap")&&(n.cellIndex+1)%2===0||n.closest(".em-gap"))&&(n=tp(n)??n),n}function jK(e,t){const{elem:n,isCellCustomTable:r,listContext:o,requestElemBullet:i,variableElement:s}=e,{isListOL:a,isListUL:l,isList:c}=o;return{Locale:t.Locale,isProgrammaticSelection:t.isProgrammaticSelection,isCellCustomTable:r,extractorContext:{variableElement:s,requestElemBullet:i,isElementListOL:a,isElementListUL:l,isElementList:c},customTableContext:{tableKey:t.tableKey,parseTableElementToModel:t.parseTableElementToModel,getFontFamilyFromElement:t.getFontFamilyFromElement,textHasStyle:t.textHasStyle,isElementHasBold:t.isElementHasBold,getLineHeghtInPixels:t.getLineHeghtInPixels,activeCell:t.activeCell,CLASS_FOR_BASIC_CELL:t.CLASS_FOR_BASIC_CELL,requestElemWithStyle:t.requestElemWithStyle},elementContext:{getElementTdDiv:t.getElementTdDiv,getLineHeghtInPixels:t.getLineHeghtInPixels},linkTextContext:{variableElement:s,requestElemBullet:i,isElementListOL:a,isElementListUL:l,isElementList:c,findElementWithSelectedText:t.findElementWithSelectedText,selectedText:t.getSelectedText()},_isCarouselElement:t._isCarouselElement,_isAccordionElement:t._isAccordionElement,_isSocialBlockElement:t._isSocialBlockElement,_isImageElement:t._isImageElement,_isLinkElement:t._isLinkElement,_isButtonElement:t._isButtonElement,_isTableElement:t._isTableElement,_isCustomTableElement:t._isCustomTableElement,_isAtomElement:t._isAtomElement,_isTdColumnGroup:t._isTdColumnGroup,_isTdStructure:t._isTdStructure,_isEmptyTd:t._isEmptyTd,_isTdCell:t._isTdCell,_isVindentTd:t._isVindentTd,_isVindentDiv:t._isVindentDiv,_isFloatBlockElement:t._isFloatBlockElement,_isDivTextElement:t._isDivTextElement,_isInlineButtonElement:t._isInlineButtonElement,_extractTextSettings:t._extractTextSettings,_extractCarouselSettings:t._extractCarouselSettings,_extractAccordionSettings:t._extractAccordionSettings,_extractSocialSettings:t._extractSocialSettings,_extractImgSettings:t._extractImgSettings,_extractButtonSettings:t._extractButtonSettings,_extractLinkTextSettings:t._extractLinkTextSettings,_extractTableSettings:t._extractTableSettings,_extractCustomTableSettings:t._extractCustomTableSettings,_extractAtomElementSettings:t._extractAtomElementSettings,_extractProgrammaticElementSettings:t._extractProgrammaticElementSettings,_extractTdColumnGroupSettings:t._extractTdColumnGroupSettings,_extractTdStructureSettings:t._extractTdStructureSettings,_extractTdCellSettings:t._extractTdCellSettings,_extractVindentSettings:t._extractVindentSettings,_extractFloatBlockSettings:t._extractFloatBlockSettings,_extractDivContainerSettings:t._extractDivContainerSettings,_clearActiveEditElements:t._clearActiveEditElements,HTMLDocument:t.HTMLDocument,parseFromString:t.parseFromString,getParentElementOfSelection:t.getParentElementOfSelection}}function VK(e){return["EM-REPLACE","EDITOR","B","STRONG","U","S","STRIKE","SPAN","FONT","I","EM","P","A","H1","H2","H3","H4","H5","H6","SUP","SUB"].includes(e)}function GK(e,t,n){const{Locale:r,isProgrammaticSelection:o,isCellCustomTable:i}=n;if(!t&&!e.closest("a")&&!o&&!i){let s=e;e.querySelector("editor")&&(s=n.getParentElementOfSelection());const a=n._extractTextSettings({elem:s},r,n.extractorContext);return{type:a.type,caption:a.caption,settings:a}}if(n._isCarouselElement(e)){const s=n._extractCarouselSettings({elem:e},r,{clearActiveEditElements:n._clearActiveEditElements});return{type:s.type,caption:s.caption,settings:s}}if(n._isAccordionElement(e)){const s=n._extractAccordionSettings({elem:e},r,{clearActiveEditElements:n._clearActiveEditElements,HTMLDocument:n.HTMLDocument,parseFromString:n.parseFromString});return{type:s.type,caption:s.caption,settings:s}}if(n._isSocialBlockElement(e)){const s=n._extractSocialSettings({elem:e},r);return{type:s.type,caption:s.caption,settings:s}}if(n._isImageElement(e)){const s=n._extractImgSettings({elem:e},r);return{type:s.type,caption:s.caption,settings:s}}if(n._isLinkElement(e,i)){if(n._isButtonElement(e)){const l=n._extractButtonSettings({elem:e},r),c={type:l.type,caption:l.caption,settings:l};return e.getAttribute("new")&&(c.isNewLink=!0),c}const s=n._extractLinkTextSettings({elem:e},r,n.linkTextContext),a={type:s.type,caption:s.caption,settings:s};return e.getAttribute("new")&&(a.isNewLink=!0),a}if(n._isTableElement(e)){const s=n._extractTableSettings({elem:e},r);return{type:s.type,caption:s.caption,settings:s.type!=="emptyTable"?s:{}}}if(e.tagName==="LI"&&Fu(e)){const s=n._extractTextSettings({elem:e},r,n.extractorContext);return{type:s.type,caption:s.caption,settings:s}}if(n._isCustomTableElement(e)){const s=n._extractCustomTableSettings({elem:e},r,n.customTableContext);return{type:s.type,caption:s.caption,settings:s.settings}}if(n._isAtomElement(e)){const s=n._extractAtomElementSettings({elem:e},r,n.elementContext);return{type:s.type,caption:s.caption,settings:s,removeEmEdit:!0,setEmEditOnTd:!0}}if(o){const s=n._extractProgrammaticElementSettings({elem:e},r,n.elementContext);return s.settings?{type:s.settings.type,caption:s.settings.caption,settings:s.settings,removeEmEdit:!0,editTargetTd:s.editTargetTd,shouldResetProgrammaticSelection:s.shouldResetProgrammaticSelection}:{type:null,settings:{},shouldResetProgrammaticSelection:!0}}if(n._isTdColumnGroup(e)){const s=n._extractTdColumnGroupSettings({elem:e},r,{getElementTdDiv:n.elementContext.getElementTdDiv});return{type:s.type,caption:s.caption,settings:s.settings}}if(n._isTdStructure(e)){const s=n._extractTdStructureSettings({elem:e},r,{getElementTdDiv:n.elementContext.getElementTdDiv});return{type:s.type,caption:s.caption,settings:s.settings}}if(n._isEmptyTd(e))return{type:"emptyTd",settings:{}};if(n._isTdCell(e)){const s=n._extractTdCellSettings({elem:e},r,{getElementTdDiv:n.elementContext.getElementTdDiv});return{type:s.type,caption:s.caption,settings:s.settings}}if(n._isVindentTd(e)){const s=n._extractVindentSettings({elem:e},r);return{type:s.type,caption:s.caption,settings:s}}if(n._isVindentDiv(e)){const s=n._extractVindentSettings({elem:e},r);return{type:s.type,caption:s.caption,settings:s}}if(n._isFloatBlockElement(e)){const s=n._extractFloatBlockSettings({elem:e},r);return{type:s.type,caption:s.caption,settings:s}}if(n._isDivTextElement(e)){const s=n._extractTextSettings({elem:e},r,n.extractorContext);return{type:s.type,caption:s.caption,settings:s}}if(e.tagName==="DIV"||e.tagName==="TD"&&e.firstChild?.tagName==="EDITOR"){const s=n._extractDivContainerSettings({elem:e},r,{getElementTdDiv:n.elementContext.getElementTdDiv});return{type:s.type,caption:s.caption,settings:s}}if(VK(e.tagName)&&(e.tagName!=="EM-REPLACE"||!e.closest("a"))){if(n._isInlineButtonElement(e)){const s=n._extractButtonSettings({elem:e},r);return{type:s.type,caption:s.caption,settings:s}}if(!o){const s=n._extractTextSettings({elem:e},r,n.extractorContext);return{type:s.type,caption:s.caption,settings:s}}}return{type:null,settings:{}}}var XK={_isCarouselElement:Bp,_isAccordionElement:wT,_isSocialBlockElement:yX,_isImageElement:jT,_isLinkElement:RG,_isButtonElement:xa,_isTableElement:TX,_isCustomTableElement:BT,_isAtomElement:YG,_isTdColumnGroup:AX,_isTdStructure:kX,_isEmptyTd:LX,_isTdCell:NX,_isVindentTd:hA,_isVindentDiv:pA,_isFloatBlockElement:zT,_isDivTextElement:fA,_isInlineButtonElement:MG,_extractTextSettings:wK,_extractCarouselSettings:PG,_extractAccordionSettings:bG,_extractSocialSettings:vX,_extractImgSettings:oX,_extractButtonSettings:OG,_extractLinkTextSettings:kK,_extractTableSettings:CX,_extractCustomTableSettings:GG,_extractAtomElementSettings:JG,_extractProgrammaticElementSettings:eX,_extractTdColumnGroupSettings:OX,_extractTdStructureSettings:RX,_extractTdCellSettings:MX,_extractVindentSettings:xK,_extractFloatBlockSettings:rX,_extractDivContainerSettings:KG,_clearActiveEditElements:F5};function KK(e){const t=e.programmaticSelection??{get:()=>!!V.get("isProgrammaticSelection"),reset:()=>V.set("isProgrammaticSelection",!1)},n=XG(),r=()=>{const i={operation:"application_element_settings_set",settings:e.getMapObj().unescape({parent:void 0,nextElem:!1,prevElem:!1}),type:null};U.send(i)},o=i=>{if(e.selectionLock.isLocked())return;const s=i.elem??document.querySelector("[em-edit]"),a=e.selectionLock.acquire();try{if(xr("em-edit"),!s){setTimeout(()=>{const y=document.querySelector("[em-edit]");y?.isConnected?o({elem:y}):r()},0);return}if(s.closest(".em-prevent-action"))return;const l=UK(s,{getVariableByIcon:pa,htmlDocument:e.htmlDocument,findOutermostParentWithText:cm,sendResizeEvent:B0}),c=l.tagName==="EDITOR"&&l.firstChild?.nodeType===1?l.firstChild:l,u=$u(l),d=window.getSelection()?.isCollapsed??!0;qK(l,d,!!l.querySelector("editor"),{removeAllAttributes:xr});const f={...XK,HTMLDocument:e.htmlDocument,parseFromString:Ne,getParentElementOfSelection:Jl,getSelectedText:Je,findElementWithSelectedText:Is,parseTableElementToModel:Mi,tableKey:n,isElementHasBold:R5,Locale:Wi(),isProgrammaticSelection:t.get(),getElementTdDiv:iG,getLineHeghtInPixels:Lu,getFontFamilyFromElement:y=>DK(y,c),textHasStyle:et,activeCell:V.get("activeCell"),CLASS_FOR_BASIC_CELL:Eo,requestElemWithStyle:c},h=jK({elem:l,isCellCustomTable:!!l.closest(".em-element-custom-table"),listContext:{isListOL:u.isListOL,isListUL:u.isListUL,isList:u.isList},requestElemBullet:u.isList?OK(l):null,variableElement:(y,g=!1)=>zK(g,{getSelectedText:Je,getRangeFromSelection:BK})},f),m=GK(l,d,h),p={operation:"application_element_settings_set",type:m.type,caption:m.caption,settings:m.settings},S=WK(l,m,p,{removeAllAttributes:xr});if(S.isProgrammaticSelectionReset&&t.reset(),S.shouldReturn)return;const C=$K({elem:l,message:p,activateSection:i.activateSection},{getElementParentCaption:ST,getStructureColumns:sG,getUsedColors:j0,getElementPath:gG,getCurrentElementPath:dG,mapObj:e.getMapObj(),commonStyles:V.get("commonStyles"),...e.enrichExtras()});V.update({elementPath:C.elementPath});const L=e.elementRefOf?.(l),k=L===void 0?C.message:{...C.message,elementRef:L};return e.fingerprint.remember(l),U.send(k),k}finally{Promise.resolve().then(()=>{try{e.fingerprint.remember(document.querySelector("[em-edit]"))}finally{a.release()}})}};return o}function EA(){return V.get("emailWidth")}function YK(e){const t=e.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)");for(let n=0;n<t.length;n++){const r=t[n];if(r.classList.contains("em-insert-ignore"))continue;const o=r.getAttribute("width");if(o!=null&&o!=="")return!0}return!1}function eg(e){const t=document.createElement("table");return t.replaceChildren(...Ne(e,!0)),t}function tg(e){const t=[...e.children].filter(r=>r.tagName==="TR");if(t.length)return t.map(r=>It(r)).join(`
|
|
96
|
+
`);const n=e.querySelector("tr");return n?It(n):Nt(e)}function ng(e,t){const n=EA(),r=eg(e.blockHTML);let o=660;if(e.targetBlock.querySelector(".em-mob-wrap, .noresp-em-mob-wrap")){o=0;const s=r.querySelector(".em-mob-wrap:empty, .noresp-em-mob-wrap:empty")?660:e.project==="useblocks"?640:660;if(document.body.clientWidth>(n||s))o=e.targetBlock.clientWidth;else{const a=e.targetBlock.querySelector(".em-mob-wrap, .noresp-em-mob-wrap");if(a&&a.parentElement){a.parentElement.querySelectorAll(".em-mob-wrap, .noresp-em-mob-wrap").forEach(d=>{o+=parseFloat(d.getAttribute("width")||"0")});const l=a.parentElement.closest("td"),c=parseFloat(l?.style.paddingLeft||"0")||0,u=parseFloat(l?.style.paddingRight||"0")||0;o+=c,o+=u}}}else if(e.targetBlock.closest(".container-td"))o=parseInt(String(e.targetBlock.offsetWidth));else{const s=e.targetBlock.querySelector('table[style*="max-width"]'),a=e.targetBlock.querySelector('div[style*="max-width"]'),l=e.targetBlock.querySelector('.row-content[style*="width"]');s?o=parseInt(String(s.offsetWidth)):a?o=parseInt(String(a.offsetWidth)):l?o=parseInt(String(l.offsetWidth)):o=e.targetBlock.style.maxWidth?parseFloat(e.targetBlock.style.maxWidth):e.targetBlock.getBoundingClientRect().width}let i=r.querySelector(".em-mob-wrap:empty, .noresp-em-mob-wrap:empty")?660:e.project==="useblocks"?640:660;if(r.querySelector(".em-mob-wrap, .noresp-em-mob-wrap")){i=0;const s=r.querySelector(".em-mob-wrap, .noresp-em-mob-wrap");if(s&&s.parentElement){s.parentElement.querySelectorAll(".em-mob-wrap, .noresp-em-mob-wrap").forEach(u=>{i+=parseFloat(u.getAttribute("width")||"0")});const a=s.parentElement.closest("td"),l=parseFloat(a?.style.paddingLeft||"0")||0,c=parseFloat(a?.style.paddingRight||"0")||0;i+=l,i+=c}}if(r.querySelector('div[style*="inline-block"]')){if(o<660&&r.querySelector('div[style*="inline-block"]'))if(r.querySelectorAll('div[style*="inline-block"]').length>1)r.querySelectorAll('div[style*="inline-block"]').forEach(s=>{const a=s,l=parseFloat(a.style.width),c=l/i,u=s.firstElementChild;if(!u)return;const d=l-parseFloat(u.getAttribute("width")||"0"),f=parseFloat(String(o*c));a.style.width=f+"px",u.setAttribute("width",String(f-d)),tc({elem:a,width:f})});else{const s=r.querySelector('div[style*="inline-block"]');s.style.maxWidth=o+"px",tc({elem:s,width:o}),s.firstElementChild&&(s.firstElementChild.setAttribute("width",String(Math.round(o*.91))),s.firstElementChild.style.maxWidth=Math.round(o*.91)+"px")}}else if(r.querySelector(".em-mob-wrap, .noresp-em-mob-wrap")){const s=[];r.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)").forEach(function(a){const l=cS(a);l&&s.indexOf(l)===-1&&s.push(l)}),s.forEach(a=>{const l=a.querySelector(".em-mob-wrap, .noresp-em-mob-wrap");if(!l||!l.parentElement)return;const c=l.parentElement.closest("td"),u=parseFloat(c?.style.paddingLeft||"0")||0,d=parseFloat(c?.style.paddingRight||"0")||0;if(a.querySelectorAll(".em-mob-wrap, .noresp-em-mob-wrap").length>1){if(!YK(a))return;const f=a.querySelector(".em-mob-wrap:nth-child(even), .noresp-em-mob-wrap:nth-child(even)"),h=f?parseFloat(f.getAttribute("width")||"0"):0,m=a.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)").length;let p=0,S=0;a.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)").forEach(k=>{if(k.getAttribute("width")&&!k.classList.contains("em-insert-ignore")){const y=parseFloat(k.getAttribute("width"))/i,g=Math.round(parseFloat(String(o*y))-h/(m*2));k.setAttribute("width",String(g)),p+=g}});const C=o-(u+d+h*(m-1)+p);a.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)").forEach(k=>{if(k.getAttribute("width")&&!k.classList.contains("em-insert-ignore")){const y=parseFloat(k.getAttribute("width"))+Math.round(C/m);S+=y,k.setAttribute("width",String(y)),k.querySelector("img")&&k.querySelectorAll("img").forEach(g=>{parseFloat(g.getAttribute("width")||"0")>parseFloat(k.getAttribute("width"))+Math.round(C/m)&&(g.setAttribute("width",k.getAttribute("width")),g.style.maxWidth=k.getAttribute("width")+"px")})}}),S=S+h*(m-1)+u+d;const L=o-S;if(L!==0&&p>0){const k=a.querySelector(".em-mob-wrap:last-child, .noresp-em-mob-wrap:last-child");if(k&&!k.classList.contains("em-insert-ignore")){const y=parseFloat(k.getAttribute("width")||"0");k.setAttribute("width",String(y+L))}else{const y=a.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)");for(let g=y.length-1;g>=0;g--){const v=y[g];if(v.classList.contains("em-insert-ignore"))continue;const w=parseFloat(v.getAttribute("width")||"0");v.setAttribute("width",String(w+L));break}}}}else if(l.getAttribute("width")&&!l.classList.contains("em-insert-ignore")){const f=Math.round(o-u-d);l.setAttribute("width",String(f))}})}return tg(r)}function rg(e){const t=eg(e),n=!!document.querySelector(".noresp-em-narrow-table");return t.querySelectorAll(".em-mob-wrap[width], .noresp-em-mob-wrap[width]").forEach(r=>{const o=parseFloat(r.getAttribute("width")||"0");o&&r.querySelectorAll('[em="atom"] img:not(.em-countdown)').forEach(i=>{parseFloat(i.getAttribute("width")||"0")<=o||(i.setAttribute("width",String(o)),n||(i.style.maxWidth=o+"px"))})}),tg(t)}function og(e,t){const n=EA(),r=eg(e.blockHTML);let o=660;const i=e.targetBlock.tagName==="TR"?document.createElement("table"):document.createElement("div");if(i.style.width=n+"px",i.style.height="1000px",i.style.borderCollapse="collapse",i.setAttribute("cellpadding","0"),i.setAttribute("cellspacing","0"),i.style.position="absolute",i.style.top="-9999px",i.style.left="-9999px",document.body.appendChild(i),i.innerHTML=t.getOuterHtml(e.targetBlock),n)o=n;else{const a=i.querySelector('table[style*="max-width"]'),l=i.querySelector('div[style*="max-width"]'),c=i.querySelector('.row-content[style*="width"]');if(a)o=parseInt(String(a.offsetWidth));else if(l)o=parseInt(String(l.offsetWidth));else if(c)o=parseInt(String(c.offsetWidth));else{const u=i.querySelector(e.targetBlock.tagName);o=u?.style.maxWidth?parseFloat(u.style.maxWidth):u?.getBoundingClientRect().width||660}}document.body.removeChild(i);const s=r.querySelector("table:first-child");return s?.style.maxWidth&&(s.style.maxWidth=o+"px",tc({elem:s,width:o})),tg(r)}function Wu(e){const t=e.querySelectorAll(".em-mob-wrap, .noresp-em-mob-wrap");if(!t.length)return;const n=e.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)"),r=Array.from(n).filter(u=>!u.classList.contains("em-insert-ignore")&&u.getAttribute("width")!=null&&u.getAttribute("width")!=="");if(r.length===0)return;const o=e.parentElement?.getBoundingClientRect().width||0;let i=0,s=0;t.forEach(u=>{i+=parseFloat(u.getAttribute("width")||"0")});let a=e.querySelector(".em-mob-wrap");for(;a&&a!==e.parentElement?.parentElement;){const u=window.getComputedStyle(a),d=parseFloat(u.paddingLeft)||0,f=parseFloat(u.paddingRight)||0;(d>0||f>0)&&(s+=d+f),a=a.parentElement}const l=o-(i+s),c=r.length;r.forEach(u=>{const d=parseFloat(u.getAttribute("width")||"0")+Math.ceil(l/c);u.setAttribute("width",String(d))})}function SA(e,t){const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let r=0,o=null;for(;n.nextNode();){o=n.currentNode;const i=(o.textContent||"").length;if(r+i>=t){const s=t-r;return{node:o,offset:s}}r+=i}if(o){const i=o.textContent?.length||0;return{node:o,offset:i}}return null}function ZK(e,t,n,r){try{if(!n||n.nodeType!==Node.TEXT_NODE)return!1;const o=n.textContent?n.textContent.length:0,i=Math.min(Math.max(0,r),o);return e.setStart(n,i),e.collapse(!0),t.removeAllRanges(),t.addRange(e),!0}catch{return!1}}function QK(e,t,n){const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let o=0;for(;r.nextNode();){const i=r.currentNode;if(i===t)return o+n;o+=i.textContent?.length||0}return-1}function wA(e){return Array.from(e.rows).flatMap(t=>Array.from(t.cells))}function _A(e,t,n){const r=e.findIndex(i=>i.contains(t));if(r<0||t.nodeType!==Node.TEXT_NODE)return null;const o=QK(e[r],t,n);return o<0?null:{cell:r,offset:o}}function JK(e){const t=window.getSelection();if(!t?.rangeCount)return null;const n=t.getRangeAt(0),r=wA(e),o=_A(r,n.startContainer,n.startOffset),i=_A(r,n.endContainer,n.endOffset),s=!!n.startContainer.parentElement?.closest("editor");return o&&i?{start:o,end:i,inEditor:s}:null}function eY(e,t,n){const r=wA(e),o=r[t.start.cell]?.querySelector(":scope > div");t.inEditor&&o&&n&&n(o,!0);const i=({cell:u,offset:d})=>r[u]?SA(r[u],d):null,s=i(t.start),a=i(t.end),l=window.getSelection();if(!s||!a||!l)return;const c=document.createRange();c.setStart(s.node,s.offset),c.setEnd(a.node,a.offset),l.removeAllRanges(),l.addRange(c)}function Zr(e,t){return t===void 0?{rejected:e}:{rejected:e,key:t}}function tY(e){return"rejected"in e}function qu(e){return{status:"rejected",reason:e.rejected,...e.key===void 0?{}:{key:e.key}}}function nY(e,t){Array.from(e.attributes).forEach(n=>e.removeAttribute(n.name)),Array.from(t.attributes).forEach(n=>e.setAttribute(n.name,n.value)),e.replaceChildren(...Array.from(t.childNodes))}function CA(e,t,n){if(t.isEditLocked())return qu(Zr("locked"));const r=e.outerHTML,o=e.cloneNode(!0),i=n.movesCells?null:JK(e),s=()=>{i&&eY(e,i,t.wrapEditor)},a=()=>{nY(e,o),s()};try{const l=n.edit(e);return tY(l)?(e.outerHTML!==r&&a(),qu(l)):(Ra(e,t.tableModelToHtml(l)),s(),n.afterWrite?.(e),{status:"applied"})}catch(l){throw a(),l}}var TA=["top","right","bottom","left"],AA={cell_borderAll:"all",cell_borderTop:"top",cell_borderRight:"right",cell_borderBottom:"bottom",cell_borderLeft:"left"},ig={paddingTop:["top"],paddingRight:["right"],paddingBottom:["bottom"],paddingLeft:["left"],paddingLeftRight:["left","right"],paddingTopBottom:["top","bottom"]},rY={top:"paddingTop",right:"paddingRight",bottom:"paddingBottom",left:"paddingLeft"},kA=e=>t=>[[e,_t(t)??0]];function LA(e){const t=e??{};return TA.map(n=>[rY[n],_t(t.all??t[n])??0])}function NA(e){const t=_t(e.width);return{...t===null?{}:{width:t},...We(e.style)?{}:{style:e.style},...We(e.color)?{}:{color:Vn(e.color)}}}function oY(e){return Hp(e)||e.width===0||e.color===""}function iY(e){return(t,n,{ids:r,ctx:o})=>{const i=n??{},s=o.getExternalBorders(t,r),a=AA[e];let l=t;if(a==="all"){const u=oY(i);for(const d of Object.keys(s))l=u?o.clearCellBorders(l,[d],TA):o.updateCellBordersByIds(l,[d],s[d],NA(i)),l=o.addClassToCellsByIds(l,[d],Br);return o.addClassToCellsByIds(l,Object.keys(s),Hr)}const c=Object.keys(s).filter(u=>s[u].includes(a));return l=Hp(i)?o.clearCellBorders(l,c,[a]):o.updateCellBordersByIds(l,c,[a],NA(i)),o.addClassToCellsByIds(l,r,Hr)}}var sY=(e,t,{ids:n,ctx:r})=>{const o=r.getExternalCorners(e,n);let i=e;for(const s of Object.keys(o))i=r.updateCellBorderRadiusByIds(i,[s],o[s],_t(t)??0),i=r.addClassToCellsByIds(i,[s],Hr);return i};function xA(e){return(t,n,{ids:r,ctx:o})=>{let i=o.addClassToCellsByIds(t,r,Br);for(const[s,a]of e(n))i=o.updateCellPaddingByIds(i,r,ig[s],a);return o.addClassToCellsByIds(i,r,Hr)}}function OA(e){return(t,n,{ctx:r})=>e(n).reduce((o,[i,s])=>r.updateTablePadding(o,{settings:{[i]:s}}),t)}var RA={...Object.fromEntries(Object.keys(ig).map(e=>[e,OA(kA(e))])),...Object.fromEntries(Object.keys(ig).map(e=>[`cell_${e}`,xA(kA(e))])),padding:OA(LA),cell_padding:xA(LA),...Object.fromEntries(Object.keys(AA).map(e=>[e,iY(e)])),cellBackgroundColor:(e,t,{ids:n,ctx:r})=>r.addClassToCellsByIds(r.updateTableCellBackgroundByIds(e,n,Vn(t)),n,Hr),cell_borderPosition:(e,t,{ids:n,ctx:r})=>r.addClassToCellsByIds(e,n,Br),cell_borderRadiusAll:sY},aY=["all","topLeft","topRight","bottomRight","bottomLeft"];function Qr(e){return(t,n,{settings:r,ctx:o})=>o[e]({settings:r,elem:t})}function MA(e,t){return(n,r,{ctx:o})=>{const i=r??{},s={...i,value:We(i.value)?null:i.value};o[t]({settings:{[e]:s},elem:n})}}var lY=(e,t,{ctx:n})=>{const r=t??{};if(We(r.hOffset)&&We(r.vOffset)||r.color===""){ba(e,r.classNamePrefix||"em-mob-box_shadow-");return}n.setElementMobileBoxShadow({settings:{mobileBoxShadow:r},elem:e})},cY=(e,t,{ctx:n})=>{const r=t??{},o=aY.find(i=>i in r);if(o){if(_t(r[o])){n.setElementMobileBorderRadius({settings:{mobileBorderRadius:r},elem:e});return}ba(e,o==="all"?"em-mob-border_radius_":r.classNamePrefix||`em-mob-border_radius_${o}-`)}},uY={mobileWidth:MA("mobileWidth","setElementMobileWidth"),mobileHeight:MA("mobileHeight","setElementMobileHeight"),show:Qr("setElementShow"),mobileBackgroundColor:Qr("setElementMobileBackgroundColor"),mobileBackgroundImage:Qr("setElementMobileBackgroundImage"),mobileBackgroundPositionX:Qr("setElementMobileBackgroundPositionX"),mobileBackgroundPositionY:Qr("setElementMobileBackgroundPositionY"),mobileBackgroundRepeat:Qr("setElementMobileBackgroundRepeat"),mobileBackgroundSize:Qr("setElementMobileBackgroundSize"),mobileBorder:Qr("setElementMobileBorder"),mobileBoxShadow:lY,mobileBorderRadius:cY},zu={topLeft:"border-top-left-radius",topRight:"border-top-right-radius",bottomRight:"border-bottom-right-radius",bottomLeft:"border-bottom-left-radius"},dY={"background-size":"cover","background-repeat":"no-repeat","background-position":"center"};function sg(e){const t=_t(e.getAttribute("border"));t&&IT(e,"all",{width:t,style:"solid",color:e.getAttribute("bordercolor")||null}),["border","bordercolor","border-collapse"].forEach(n=>e.removeAttribute(n))}function PA(e){["border-radius",...Object.values(zu)].some(t=>!/^(0px\s*)*$/.test(e.style.getPropertyValue(t)))||e.style.boxShadow?e.style.borderCollapse="separate":e.style.borderCollapse==="separate"&&e.style.removeProperty("border-collapse")}function fY(e){return(t,n)=>{sg(t),IT(t,Ou[e],n??{}),t.style.borderCollapse||(t.style.borderCollapse="collapse")}}var mY=(e,t)=>{const n=t??{};sg(e);const r=_t(n.all);r?Ri({elem:e,settings:{borderRadius:{all:r}}}):("all"in n&&e.style.removeProperty("border-radius"),Object.keys(zu).forEach(o=>{const i=_t(n[o]);i?e.style.setProperty(zu[o],`${i}px`):("all"in n||o in n)&&e.style.removeProperty(zu[o])})),PA(e)},hY=(e,t)=>{const n=t??{};sg(e);const r=!We(n.color)&&!We(n.hOffset)&&!We(n.vOffset)?{hOffset:_t(n.hOffset),vOffset:_t(n.vOffset),blurRadius:_t(n.blurRadius),spreadRadius:_t(n.spreadRadius),color:Vn(n.color),inset:!!n.inset}:{hOffset:null,vOffset:null};E0({elem:e,settings:{boxShadow:r}}),PA(e)},pY=(e,t)=>{if(We(t)){e.removeAttribute("bgcolor"),e.style.removeProperty("background-color");return}e.setAttribute("bgcolor",Vn(t)),e.style.backgroundColor&&(e.style.backgroundColor=Vn(t))},gY=(e,t)=>{const n=t?.[0]?.value;if(We(n)){e.removeAttribute("data-bg-image"),e.style.removeProperty("background-image");return}e.setAttribute("data-bg-image",Vn(n)),e.style.setProperty("background-image",`url('${n}')`),Object.entries(dY).forEach(([r,o])=>{(r==="background-position"?e.style.backgroundPositionX:e.style.getPropertyValue(r))||e.style.setProperty(r,o)})};function IA(e){return(t,n)=>{const r=_t(n);v0(t,{[e]:r===null?void 0:`${r}px`})}}var bY={...Object.fromEntries(Object.keys(Ou).map(e=>[e,fY(e)])),borderRadius:mY,boxShadow:hY,backgroundColor:pY,backgroundImage:gY,backgroundPositionX:IA("backgroundPositionX"),backgroundPositionY:IA("backgroundPositionY"),backgroundSize:(e,t)=>{e.style.backgroundSize=Vn(t)},backgroundRepeat:(e,t)=>{e.style.backgroundRepeat=Vn(t)}},yY=["fontFamily","fontSize","lineHeight","textStrong","textItalic","textStrikethrough","textUnderline","textLink","textColor","textBackgroundColor","linkHref","textAlign","valign"];function vY(e){return e?.querySelector(":scope > div, :scope > editor > div")??null}function EY(e){const t=window.getSelection(),n=t&&t.rangeCount?t.getRangeAt(0):null;if(!n||n.collapsed||!e.contains(n.startContainer)||!e.contains(n.endContainer))return null;const{startContainer:r,startOffset:o,endContainer:i,endOffset:s}=n;return{startContainer:r,startOffset:o,endContainer:i,endOffset:s}}function DA(e,t){const n=document.createRange();return t&&e.contains(t.startContainer)&&e.contains(t.endContainer)?(n.setStart(t.startContainer,t.startOffset),n.setEnd(t.endContainer,t.endOffset)):n.selectNodeContents(e),n}function BA(e){const t=window.getSelection()?.anchorNode,n=(t instanceof Element?t:t?.parentElement)?.closest("a");if(n&&e.contains(n))return n;if(e.tagName==="A")return e;const r=e.querySelectorAll("a");return e.querySelector("a[em-edit]")??(r.length===1?r[0]:null)}function HA(e,{settings:t,activeElement:n}){"textAlign"in t&&(t.textAlign?e.setAttribute("align",Vn(t.textAlign)):n.style?.textAlign?n.style.removeProperty("text-align"):e.removeAttribute("align")),t.valign?e.closest("td")?.setAttribute("valign",Vn(t.valign)):t.valign===""&&e.closest("td")?.removeAttribute("valign")}function FA(e,t,n,r){const{settings:o,ctx:i}=n;i.wrapEditor(e,!0),i.textStyleProperties.some(s=>s in o)&&(i.addNewRange(t?DA(e,t):r()),i.toggleTextStyle(e,{settings:o}))}function SY(e,t){const n=EY(e),r="linkHref"in t.settings?BA(e):null;if("linkHref"in t.settings&&!r)return Zr("invalid-value","linkHref");FA(e,n,t,()=>DA(e,null)),r&&typeof t.settings.linkHref=="string"&&r.setAttribute("href",t.settings.linkHref),HA(e,t)}function wY(e,t){for(const n of e){FA(n,null,t,()=>{const o=document.createRange();return o.selectNode(n),o});const r="linkHref"in t.settings?BA(n):null;r&&typeof t.settings.linkHref=="string"&&r.setAttribute("href",t.settings.linkHref),HA(n,t)}}function _Y(e,t,n){if(!t.length)return;const r=e.querySelector(`td.${So}, td.${Br}, td.${Eo}`),o=(t.length===1&&r?[r]:t.map(i=>wp(e,i))).map(vY).filter(i=>!!i);if(t.length===1&&o.length===1)return SY(o[0],n);wY(o,n)}var CY=["borderPosition","mobileBorderPosition","outlookBackground","exportAsPicture"],$A={...bY,...uY};function TY(e){if(!e||typeof e!="object"||!Object.keys(e).length)return Zr("empty");const t={live:[],cells:[],text:!1,forCells:!1};for(const[n,r]of Object.entries(e))if($A[n])t.live.push([$A[n],r]);else if(RA[n])t.cells.push([RA[n],r]),t.forCells||(t.forCells=n.startsWith("cell"));else if(yY.includes(n))t.text=!0,t.forCells=!0;else if(!CY.includes(n))return Zr("unknown-setting",n);return t}function WA(){return document.querySelector(`.${Eo}, .${Br}, .${So}`)}function AY(e){const t=e.activeElement??WA(),n=t?.closest(".em-element-custom-table");return t&&n?{table:n,activeElement:t}:null}function kY(e){const t=e.tagName==="TD"?e.querySelector("div"):e.tagName==="TR"?e.querySelector("editor div"):null;return t?.setAttribute("em-edit","active"),t??e}function LY(e,t){if(!e.querySelector(".remove-basic-cell"))return t.activeCell??[];document.querySelectorAll(`.${Br}`).forEach(r=>{r.classList.remove(Br)});const n=t.getCellsWithClasses(t.parseTableElementToModel(e),[Eo,So]);return t.state.set("activeCell",n),n}function NY(e,t,n,r){const o=TY(t);if("rejected"in o)return o;const i=LY(e,r);if(o.forCells&&!i.length)return Zr("no-cell");const s=kY(n.activeElement);o.live.forEach(([c,u])=>c(e,u,{settings:t,ctx:r})),HG(e);const a=o.text?_Y(e,i,{settings:t,activeElement:s,ctx:r}):void 0;if(a)return a;let l=o.cells.reduce((c,[u,d])=>u(c,d,{ids:i,ctx:r}),r.parseTableElementToModel(e));return(/border-collapse:/.test(e.getAttribute("style")??"")||e.className.includes("em-mob-border_"))&&(l=r.removeOuterBorders(l)),l}function xY(e,t){[Eo,So].forEach(r=>{document.querySelectorAll(`.${r}`).forEach(o=>o.classList.remove(r))});const n=e.querySelectorAll(`.${Hr}`);n[0]?.setAttribute("em-edit",""),n.forEach(r=>r.classList.remove(Hr)),Sa(e,t,"around")}function OY(e,t){const n=AY(t);return n?CA(n.table,t,{edit:r=>NY(r,e,n,t),afterWrite:r=>xY(r,e)}):qu(Zr("no-table"))}var RY=new Set(["alt","title","link"]);function MY(e,t,n){const r=Object.keys(n.settings??{});return n.type==="img"&&r.length>0&&r.every(o=>RY.has(o))&&e.parentNode===t.parent}function PY(e){let t=e?.parentElement??null;for(;t&&!t.tagName.startsWith("AMP-");)t=t.parentElement;const n=e?.tagName??"",r=t&&e?Array.from(t.getElementsByTagName(n)).indexOf(e):-1;return{root:t,tag:n,index:r,parent:e?.parentNode??null}}function IY(e,t,n,r,o){const i=o.getMappedParent(e);if(!i?.isConnected||MY(e,n,r))return null;const s=i.tagName.startsWith("AMP-"),a=s&&i===n.root&&n.index>=0,l=s?Array.from(i.querySelectorAll("section"),f=>f.hasAttribute("expanded")):[],c=lr(o.getOuterHtml(i),([f])=>(i.parentNode?.replaceChild(f,i),f));let u=c;const d=a?c.getElementsByTagName(n.tag)[n.index]??null:null;return d?u=d:t?.tagName==="A"&&c.tagName!=="A"&&(u=c.querySelector("a")??c),u.setAttribute("em-edit","active"),{active:u,afterCommit:()=>{o.applyHidden(()=>c.querySelectorAll("section").forEach((f,h)=>{l[h]&&f.setAttribute("expanded","")}))}}}var DY=["top","right","bottom","left"];function BY(e,t){const{activeElement:n}=t;let r=!1;if(!e)return r;const o=n.closest("a"),i=n.closest("td"),s=i?Fr(i):null,a=o?Fr(o):null,l=!!s&&!a,c=Lh(o),u=e.outlookRounding===!0||e.outlookRounding!==!1&&(l||c)?o:i;if(e.exportAsPicture?n.closest("table")?.setAttribute("em-operation","exportAsPicture"):n?.closest("table")?.getAttribute("em-operation")==="exportAsPicture"&&n.closest("table")?.removeAttribute("em-operation"),e.href!==void 0&&n.closest("a")?.setAttribute("href",e.href),e.align){const m=n.closest("td")?.closest("table")?.closest("div, p, td");m&&(m.style.textAlign?m.style.textAlign=e.align:m.setAttribute("align",e.align))}else if(e.align===""){const m=n.closest("td")?.closest("table")?.closest("div, p, td");m&&(m.style.textAlign?m.style.removeProperty("text-align"):m.removeAttribute("align"))}if(e.textAlign){const m=n.closest("td");m&&(m.style.textAlign?m.style.textAlign=e.textAlign:m.setAttribute("align",e.textAlign))}else if(e.textAlign===""){const m=n.closest("td");m&&(m.style.textAlign?m.style.removeProperty("text-align"):m.removeAttribute("align"))}if(e.valign?n.closest("td")?.closest("table")?.closest("td")?.setAttribute("valign",e.valign):e.valign===""&&n.closest("td")?.closest("table")?.closest("td")?.removeAttribute("valign"),e.width){const m=n.closest("table");m&&(e.width.value?(m.setAttribute("width",e.width.value+(e.width.dim==="px"?"":"%")),m.style.width=e.width.value+e.width.dim):(m.removeAttribute("width"),m.style.removeProperty("width")))}if(e.height){const m=n.closest("td"),p=n.closest("a");if(e.height.value){const S=m?m.style.height||`${m.getAttribute("height")??""}px`:"";if(m&&(m.setAttribute("height",e.height.value+(e.height.dim==="px"?"":"%")),m.style.height=e.height.value+e.height.dim),p){const C=e.height;tC(p,`${C.value}${C.dim}`,S)}}else m&&(m.removeAttribute("height"),m.style.removeProperty("height")),p&&X$(p)}if(e.border&&u&&t.setElementBorder({settings:e,elem:u}),e.boxShadow&&u&&t.setElementBoxShadow({settings:e,elem:u}),e.backgroundColor!==void 0&&u&&(e.backgroundColor===""?(u.removeAttribute("bgcolor"),u.style.removeProperty("background-color")):(u.tagName==="TD"&&u.setAttribute("bgcolor",e.backgroundColor),u.style.backgroundColor=e.backgroundColor)),e.backgroundImage){const m=n.closest("td");m&&(e.backgroundImage[0].value===""?(m.style.removeProperty("background-image"),m.removeAttribute("background")):(m.style.removeProperty("background-image"),Ht(m,"background",FY(e))))}if(e.backgroundPositionX!==void 0){const m=n.closest("td");m&&(e.backgroundPositionX===""?m.style.removeProperty("background-position-x"):m.style.backgroundPositionX=e.backgroundPositionX)}if(e.backgroundPositionY!==void 0){const m=n.closest("td");m&&(e.backgroundPositionY===""?m.style.removeProperty("background-position-y"):m.style.backgroundPositionY=e.backgroundPositionY)}if(e.backgroundRepeat){const m=n.closest("td");m&&(e.backgroundRepeat==="none"?m.style.removeProperty("background-repeat"):m.style.backgroundRepeat=e.backgroundRepeat)}if(e.backgroundSize!==void 0){const m=n.closest("td");m&&(e.backgroundSize===""?m.style.removeProperty("background-size"):m.style.backgroundSize=e.backgroundSize)}if(e.padding){const m=n.closest("a");if(m){const p=e.padding,S=p.all!==void 0?{top:p.all,right:p.all,bottom:p.all,left:p.all}:{top:p.top,right:p.right,bottom:p.bottom,left:p.left};eC(m)&&(S.top=void 0,S.bottom=void 0);for(const C of DY){const L=S[C];L!==void 0&&m.style.setProperty(`padding-${C}`,`${L}px`)}}}if(e.borderRadius&&u&&t.setElementBorderRadius({settings:e,elem:u}),e.mobileWidth){const m=n.closest("table");m&&t.setElementMobileWidth({settings:e,elem:m}),r=!0}if(e.mobileHeight){const m=n.closest("td"),p=n.closest("a"),S=!!p&&ra(p);p&&S&&oC(p),m&&t.setElementMobileHeight({settings:e,elem:m}),S||t.setElementMobileLineHeight({settings:e,elem:n}),e.mobileHeight.value!=null&&(Fc({elem:n,position:"top"}),Fc({elem:n,position:"bottom"})),r=!0}if(e.mobileBorder){const m=n.closest("td");m&&t.setElementMobileBorder({settings:e,elem:m}),r=!0}if(e.mobileBorderRadius){const m=n.closest("td");m&&t.setElementMobileBorderRadius({settings:e,elem:m}),r=!0}if(e.mobileBoxShadow){const m=n.closest("td");m&&t.setElementMobileBoxShadow({settings:e,elem:m}),r=!0}if(e.mobileTextAlign){const m=ka(n);m&&t.setElementMobileAlign({settings:e,elem:m,fieldName:"mobileTextAlign"}),r=!0}if(e.mobileAlign){const m=n.closest("td")?.closest("table");m&&t.setElementMobileTableAlign({settings:e,elem:m}),r=!0}if(e.mobileVerticalAlign){const m=n.closest("td");m&&t.setElementMobileVerticalAlign({settings:e,elem:m}),r=!0}if(e.mobileBackgroundColor){const m=n.closest("td");m&&t.setElementMobileBackgroundColor({settings:e,elem:m}),r=!0}if(e.mobileBackgroundImage){const m=n.closest("td");m&&t.setElementMobileBackgroundImage({settings:e,elem:m}),r=!0}if(e.mobileBackgroundPositionX){const m=n.closest("td");m&&t.setElementMobileBackgroundPositionX({settings:e,elem:m}),r=!0}if(e.mobileBackgroundPositionY){const m=n.closest("td");m&&t.setElementMobileBackgroundPositionY({settings:e,elem:m}),r=!0}if(e.mobileBackgroundRepeat){const m=n.closest("td");m&&t.setElementMobileBackgroundRepeat({settings:e,elem:m}),r=!0}const d=e;if(d.mobileBackgroundSize){const m=n.closest("td");m&&t.setElementMobileBackgroundSize?.({settings:d,elem:m}),r=!0}if(e.mobilePadding&&(t.setElementMobilePadding({settings:e,elem:n}),r=!0),e.show){const m=n.closest("table");m&&t.setElementShow({settings:e,elem:m}),r=!0}const f=n.closest("a");if(f&&e.textColor!==void 0){const m=String(e.textColor||"");f.style.color=m,f.querySelectorAll('span[style*="color"], font[color]').forEach(p=>{p.style.removeProperty("color"),p.removeAttribute("color")})}if(f&&e.textBackgroundColor!==void 0){const m=String(e.textBackgroundColor||"");f.style.backgroundColor=m,f.querySelectorAll('span[style*="background-color"]').forEach(p=>{p.style.removeProperty("background-color")})}const h=["textColor","textBackgroundColor"];if(t.textStyleProperties.filter(m=>!h.includes(m)&&e.hasOwnProperty(m)).length>0)try{t.toggleTextStyle(n,{type:"button",settings:e})}catch{}return e.mobileFontSize&&(t.setElementMobileFontSize({settings:e,elem:n}),r=!0),e.textReplacer!==void 0&&HY(e.textReplacer,n,t.compareStrings),e.outlookRounding===!0?xh(n,e):e.outlookRounding===!1?gW(n):(s||c)&&xh(n,e),i&&Sa(i,e,"inside"),r}function HY(e,t,n){if(e){const r=window.getSelection();if(!r||r.rangeCount===0)return;const o=r.getRangeAt(0),i=e.replace(/~~.*$/,""),s=o?.commonAncestorContainer,a=s?.nodeType===1?s:s.parentElement;let l=a?.closest("em-replace");const c=!!(/~~/.test(e)&&l);if(c&&a){const u=e.replace(/~~.*$/,"");a.setAttribute("text",u),a.innerHTML=u}if(!l&&r.rangeCount>0&&!o.collapsed){const u=document.querySelectorAll("em-replace");if(l=Array.prototype.find.call(u,d=>d.textContent?.trim()===r.toString().trim()&&r.toString().trim()!==""),!l){const d=document.querySelector('[em-edit="active"]');d?.textContent===o.toString()&&o.selectNodeContents(d);const f=e.replace(/~~.*$/,""),h=document.createElement("em-replace");h.setAttribute("text",f),o.surroundContents(h)}}if(!l&&r.rangeCount>0&&o.collapsed){let u=document.querySelector("em-replace");if(u){const d=document.querySelectorAll("em-replace"),f=/~$/;l=Array.prototype.find.call(d,h=>{const m=e,p=h.textContent||"";return m.length===1&&f.test(p)?!0:n(p,m)}),l&&(l.setAttribute("text",e),l.textContent=e),l||(u=document.createElement("em-replace"),u.setAttribute("text",i),o.insertNode(u),u.innerHTML=i,o.collapse())}else u=document.createElement("em-replace"),u.setAttribute("text",i),o.insertNode(u),u.innerHTML=i,o.collapse()}l&&!c&&(l.getAttribute("text")===l.innerHTML&&(l.innerHTML=e),l.setAttribute("text",e))}else if(e===""){const r=t?.closest("em-replace")||t?.querySelector("em-replace");if(r){const o=r.parentNode,i=r.firstChild,s=r.lastChild;if(r.getAttribute("text")!==r.innerHTML&&o)for(;r.firstChild;)o.insertBefore(r.firstChild,r);const a=document.createRange(),l=window.getSelection();i&&s&&l&&(a.setStartBefore(i),a.setEndAfter(s),l.removeAllRanges(),l.addRange(a)),r.remove()}}}function FY(e){return e.backgroundImage?.[0]?.value??""}function $Y(e,t){const n=t.activeElement;let r=!1;if(!e)return r;e.exportAsPicture?n.setAttribute("em-operation","exportAsPicture"):n.getAttribute("em-operation")==="exportAsPicture"&&n.removeAttribute("em-operation"),e.align?n.style.textAlign?n.style.textAlign=e.align:n.setAttribute("align",e.align):e.align===""&&(n.style.textAlign?n.style.removeProperty("text-align"):n.removeAttribute("align")),e.valign?n.style.verticalAlign=e.valign:e.valign===""&&n.style.removeProperty("vertical-align"),e.width&&(e.width.value?n.style.width=e.width.value+e.width.dim:n.style.removeProperty("width")),e.minWidth&&(e.minWidth.value?n.style.minWidth=e.minWidth.value+e.minWidth.dim:n.style.removeProperty("min-width")),e.maxWidth&&(e.maxWidth.value?n.style.maxWidth=e.maxWidth.value+e.maxWidth.dim:n.style.removeProperty("max-width")),e.height&&(e.height.value?n.style.height=e.height.value+e.height.dim:n.style.removeProperty("height")),e.border&&t.setElementBorder({settings:e,elem:n}),e.boxShadow&&t.setElementBoxShadow({settings:e,elem:n}),e.backgroundColor!==void 0&&(e.backgroundColor===""?n.style.removeProperty("background-color"):n.style.backgroundColor=e.backgroundColor),e.backgroundImage&&(e.backgroundImage[0].value===""?n.style.removeProperty("background-image"):n.style.backgroundImage=e.backgroundImage[0].type+"("+e.backgroundImage[0].value+")"),e.backgroundPositionX!==void 0&&(e.backgroundPositionX===""?n.style.removeProperty("background-position-x"):n.style.backgroundPositionX=e.backgroundPositionX),e.backgroundPositionY!==void 0&&(e.backgroundPositionY===""?n.style.removeProperty("background-position-y"):n.style.backgroundPositionY=e.backgroundPositionY),e.backgroundRepeat&&(e.backgroundRepeat==="none"?n.style.removeProperty("background-repeat"):n.style.backgroundRepeat=e.backgroundRepeat),e.backgroundSize!==void 0&&(e.backgroundSize===""?n.style.removeProperty("background-size"):n.style.backgroundSize=e.backgroundSize),e.padding&&(e.padding.all!==void 0?(n.style.paddingTop=e.padding.all+"px",n.style.paddingRight=e.padding.all+"px",n.style.paddingBottom=e.padding.all+"px",n.style.paddingLeft=e.padding.all+"px"):(e.padding.top&&(n.style.paddingTop=e.padding.top+"px"),e.padding.right&&(n.style.paddingRight=e.padding.right+"px"),e.padding.bottom&&(n.style.paddingBottom=e.padding.bottom+"px"),e.padding.left&&(n.style.paddingLeft=e.padding.left+"px"))),e.borderRadius&&t.setElementBorderRadius({settings:e,elem:n}),e.mobileWidth&&(t.setElementMobileWidth({settings:e,elem:n}),r=!0),e.mobileHeight&&(t.setElementMobileHeight({settings:e,elem:n}),r=!0),e.mobileBorder&&(t.setElementMobileBorder({settings:e,elem:n}),r=!0),e.mobileBorderRadius&&(t.setElementMobileBorderRadius({settings:e,elem:n}),r=!0),e.mobileBoxShadow&&(t.setElementMobileBoxShadow({settings:e,elem:n}),r=!0),e.mobileAlign&&(t.setElementMobileAlign({settings:e,elem:n}),r=!0),e.mobileVerticalAlign&&(t.setElementMobileVerticalAlign({settings:e,elem:n}),r=!0),e.mobileDirection&&(t.setElementMobileDirection({settings:e,elem:n}),r=!0),e.mobileBackgroundColor&&(t.setElementMobileBackgroundColor({settings:e,elem:n}),r=!0),e.mobileBackgroundImage&&(t.setElementMobileBackgroundImage({settings:e,elem:n}),r=!0),e.mobileBackgroundPositionX&&(t.setElementMobileBackgroundPositionX({settings:e,elem:n}),r=!0),e.mobileBackgroundPositionY&&(t.setElementMobileBackgroundPositionY({settings:e,elem:n}),r=!0),e.mobileBackgroundRepeat&&(t.setElementMobileBackgroundRepeat({settings:e,elem:n}),r=!0);const o=e;return o.mobileBackgroundSize&&(t.setElementMobileBackgroundSize?.({settings:o,elem:n}),r=!0),e.mobilePadding&&(t.setElementMobilePadding({settings:e,elem:n}),r=!0),e.show&&(t.setElementShow({settings:e,elem:n}),r=!0),Sa(n,e,"inside"),r}function ag(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&&ag({elem:e.elem.previousSibling,width:e.width})}function WY(e,t){const n=t.activeElement;let r=!1;if(!e)return r;e.exportAsPicture?n.setAttribute("em-operation","exportAsPicture"):n.getAttribute("em-operation")==="exportAsPicture"&&n.removeAttribute("em-operation"),e.align?n.setAttribute("align",e.align):e.align===""&&n.removeAttribute("align"),e.width&&(e.width.value?(n.setAttribute("width",e.width.value+(e.width.dim==="px"?"":"%")),n.style.width=e.width.value+e.width.dim,e.width.dim==="px"&&ag({elem:n,width:e.width.value})):(n.removeAttribute("width"),n.style.removeProperty("width"))),e.maxWidth&&(e.maxWidth.value?(n.style.maxWidth=e.maxWidth.value+e.maxWidth.dim,ag({elem:n,width:e.maxWidth.value})):n.style.removeProperty("max-width")),e.minWidth&&(e.minWidth.value?n.style.minWidth=e.minWidth.value+e.minWidth.dim:n.style.removeProperty("min-width")),e.border&&t.setElementBorder({settings:e,elem:n}),e.boxShadow&&t.setElementBoxShadow({settings:e,elem:n}),e.backgroundColor!==void 0&&(e.backgroundColor===""?(n.removeAttribute("bgcolor"),n.style.removeProperty("background-color")):(n.setAttribute("bgcolor",e.backgroundColor),n.style.backgroundColor=e.backgroundColor)),e.backgroundImage&&(e.backgroundImage[0].value===""?(n.style.removeProperty("background-image"),n.removeAttribute("background")):(n.style.removeProperty("background-image"),n.style.backgroundImage=e.backgroundImage[0].type+"("+e.backgroundImage[0].value+")",Ht(n,"background",qY(e)))),e.backgroundPositionX!==void 0&&(e.backgroundPositionX===""?n.style.removeProperty("background-position-x"):n.style.backgroundPositionX=e.backgroundPositionX),e.backgroundPositionY!==void 0&&(e.backgroundPositionY===""?n.style.removeProperty("background-position-y"):n.style.backgroundPositionY=e.backgroundPositionY),e.backgroundRepeat&&(e.backgroundRepeat==="none"?n.style.removeProperty("background-repeat"):n.style.backgroundRepeat=e.backgroundRepeat),e.backgroundSize!==void 0&&(e.backgroundSize===""?n.style.removeProperty("background-size"):n.style.backgroundSize=e.backgroundSize),e.borderRadius&&t.setElementBorderRadius({settings:e,elem:n}),e.mobileAlign&&(t.setElementMobileTableAlign({settings:e,elem:n}),r=!0),e.mobileWidth&&(t.setElementMobileWidth({settings:e,elem:n}),r=!0),e.mobileBorder&&(t.setElementMobileBorder({settings:e,elem:n}),r=!0),e.mobileBorderRadius&&(t.setElementMobileBorderRadius({settings:e,elem:n}),r=!0),e.mobileBoxShadow&&(t.setElementMobileBoxShadow({settings:e,elem:n}),r=!0),e.mobileBackgroundColor&&(t.setElementMobileBackgroundColor({settings:e,elem:n}),r=!0),e.mobileBackgroundImage&&(t.setElementMobileBackgroundImage({settings:e,elem:n}),r=!0),e.mobileBackgroundPositionX&&(t.setElementMobileBackgroundPositionX({settings:e,elem:n}),r=!0),e.mobileBackgroundPositionY&&(t.setElementMobileBackgroundPositionY({settings:e,elem:n}),r=!0),e.mobileBackgroundRepeat&&(t.setElementMobileBackgroundRepeat({settings:e,elem:n}),r=!0);const o=e;return o.mobileBackgroundSize&&(t.setElementMobileBackgroundSize?.({settings:o,elem:n}),r=!0),e.show&&(t.setElementShow({settings:e,elem:n}),r=!0),Sa(n,e,"around"),r}function qY(e){return e.backgroundImage?.[0]?.value??""}function Pa(e){return!(!e.startsWith("#")||e.indexOf("#",1)!==-1)}function zY(e,t){const n=t.activeElement;let r=!1;if(!e)return r;if(typeof e.linkHref=="string"){const i=document.querySelector("[em-edit]"),s=i?.tagName==="A"?i:i?.closest("a")??n.querySelector("a");s&&(s.setAttribute("href",e.linkHref),Pa(e.linkHref)&&s.removeAttribute("target"))}if(e.exportAsPicture?n.setAttribute("em-operation","exportAsPicture"):n.getAttribute("em-operation")==="exportAsPicture"&&n.removeAttribute("em-operation"),e.align){n.style.textAlign?n.style.textAlign=e.align:n.setAttribute("align",e.align);const i=n.querySelectorAll('[em="atom"]');i.length>0&&i.forEach(s=>{s.querySelector(":scope > tr > td")?.setAttribute("align",e.align);const a=s.querySelector('div[style*="font-family"][style*="font-size"]');a?.hasAttribute("align")&&a.setAttribute("align",e.align)})}else if(e.align===""){n.style.textAlign?n.style.removeProperty("text-align"):n.removeAttribute("align");const i=n.querySelectorAll('[em="atom"]');i.length>0&&i.forEach(a=>{a.querySelector(":scope > tr > td")?.removeAttribute("align")});const s=n.closest("table");if(s?.getAttribute("em")==="atom"){const a=s.querySelector('div[style*="font-family"][style*="font-size"]');a?.hasAttribute("align")&&a.removeAttribute("align")}}if(e.valign?(n.setAttribute("valign",e.valign),n.querySelectorAll('div[style*="display"]').forEach(i=>i.style.verticalAlign=e.valign)):e.valign===""&&n.removeAttribute("valign"),e.width){const i=n.closest("table");i?.getAttribute("em")==="atom"?e.width.value?i.setAttribute("width",e.width.value+(e.width.dim==="px"?"":"%")):i.removeAttribute("width"):e.width.value?n.setAttribute("width",e.width.value+(e.width.dim==="px"?"":"%")):n.removeAttribute("width")}if(e.height)if(e.height.value){n.setAttribute("height",e.height.value+(e.height.dim==="px"?"":"%")),n.style.height=e.height.value+e.height.dim;const i=n.firstElementChild;i?.tagName==="A"&&i.style.display==="block"&&(i.style.height=e.height.value+e.height.dim,i.style.lineHeight=e.height.value+e.height.dim)}else n.removeAttribute("height"),n.style.removeProperty("height");if(e.border&&t.setElementBorder({settings:e,elem:n}),e.boxShadow&&t.setElementBoxShadow({settings:e,elem:n}),e.backgroundColor!==void 0&&(e.backgroundColor===""?(n.removeAttribute("bgcolor"),n.style.removeProperty("background-color")):(n.setAttribute("bgcolor",e.backgroundColor),n.style.backgroundColor=e.backgroundColor)),e.backgroundImage&&(e.backgroundImage[0].value===""?(n.style.removeProperty("background-image"),n.removeAttribute("background")):(n.style.removeProperty("background-image"),n.style.backgroundImage=e.backgroundImage[0].type+"("+e.backgroundImage[0].value+")",Ht(n,"background",VY(e)))),e.backgroundPositionX!==void 0&&(e.backgroundPositionX===""?n.style.removeProperty("background-position-x"):n.style.backgroundPositionX=e.backgroundPositionX),e.backgroundPositionY!==void 0&&(e.backgroundPositionY===""?n.style.removeProperty("background-position-y"):n.style.backgroundPositionY=e.backgroundPositionY),e.backgroundRepeat&&(e.backgroundRepeat==="none"?n.style.removeProperty("background-repeat"):n.style.backgroundRepeat=e.backgroundRepeat),e.backgroundSize!==void 0&&(e.backgroundSize===""?n.style.removeProperty("background-size"):n.style.backgroundSize=e.backgroundSize),e.direction&&e.direction!=="none"?(n.setAttribute("dir",e.direction),e.direction==="rtl"&&n.querySelectorAll("td").forEach(i=>{for(let s=i.firstChild;s;s=s.nextSibling)if(s.nodeType===3){s.parentNode?.setAttribute("dir","ltr");break}})):(e.direction===""||e.direction==="none")&&(n.removeAttribute("dir"),n.querySelectorAll("[dir]").forEach(i=>i.removeAttribute("dir"))),e.padding){if(e.padding.all!==void 0)n.style.paddingTop=e.padding.all+"px",n.style.paddingRight=e.padding.all+"px",n.style.paddingBottom=e.padding.all+"px",n.style.paddingLeft=e.padding.all+"px",n.querySelectorAll(".em-vindent").forEach(l=>l.remove());else{if(e.padding.top!==void 0){n.style.paddingTop=e.padding.top+"px";for(const l of n.children)l.classList.contains("em-vindent-paddingTop")&&l.remove()}if(e.padding.right!==void 0){n.style.paddingRight=e.padding.right+"px";for(const l of n.children)l.classList.contains("em-vindent-paddingRight")&&l.remove()}if(e.padding.bottom!==void 0){n.style.paddingBottom=e.padding.bottom+"px";for(const l of n.children)l.classList.contains("em-vindent-paddingBottom")&&l.remove()}if(e.padding.left!==void 0){n.style.paddingLeft=e.padding.left+"px";for(const l of n.children)l.classList.contains("em-vindent-paddingLeft")&&l.remove()}}const i=n.querySelector(".em-mob-wrap"),s=n.parentElement?.getAttribute("em")==="block",a=e.padding.left!==void 0||e.padding.right!==void 0;i&&s&&a&&n.querySelectorAll(":scope > table").forEach(l=>t.setStructureBlocksWidth(l))}if(e.borderRadius&&t.setElementBorderRadius({settings:e,elem:n}),t.textStyleProperties.some(i=>e.hasOwnProperty(i))&&!t.isElementListContainer)try{t.toggleTextStyle(n,{settings:e})}catch{}if(t.isElementListContainer&&t.requestType!=="structure"&&t.requestType!=="column"&&t.textStyleProperties.some(i=>e.hasOwnProperty(i))&&jY(e,t),e.mobileWidth){const i=n.closest("table"),s=i?.getAttribute("em")==="atom";t.setElementMobileWidth({settings:e,elem:s?i:n}),r=!0}e.mobileHeight&&(t.setElementMobileHeight({settings:e,elem:n}),r=!0),e.mobileBorder&&(t.setElementMobileBorder({settings:e,elem:n}),r=!0),e.mobileBorderRadius&&(t.setElementMobileBorderRadius({settings:e,elem:n}),r=!0),e.mobileBoxShadow&&(t.setElementMobileBoxShadow({settings:e,elem:n}),r=!0),e.mobileAlign&&(UY(e,n,t),r=!0),e.mobileVerticalAlign&&(t.setElementMobileVerticalAlign({settings:e,elem:n}),r=!0),e.mobileDirection&&(t.setElementMobileDirection({settings:e,elem:n}),r=!0),e.mobileBackgroundColor&&(t.setElementMobileBackgroundColor({settings:e,elem:n}),r=!0),e.mobileBackgroundImage&&(t.setElementMobileBackgroundImage({settings:e,elem:n}),r=!0),e.mobileBackgroundPositionX&&(t.setElementMobileBackgroundPositionX({settings:e,elem:n}),r=!0),e.mobileBackgroundPositionY&&(t.setElementMobileBackgroundPositionY({settings:e,elem:n}),r=!0),e.mobileBackgroundRepeat&&(t.setElementMobileBackgroundRepeat({settings:e,elem:n}),r=!0);const o=e;return o.mobileBackgroundSize&&(t.setElementMobileBackgroundSize?.({settings:o,elem:n}),r=!0),e.mobilePadding&&(t.setElementMobilePadding({settings:e,elem:n}),r=!0),e.show&&(t.setElementShow({settings:e,elem:n}),r=!0),"isContrastBlock"in e&&t.setContrastBlock({settings:e,elem:n}),Sa(n,e,"inside"),r}function UY(e,t,n){n.setElementMobileAlign({settings:e,elem:t});const r=e.mobileAlign?.classNamePrefix||"em-mob-text_align-";CG(t,(s,a)=>{TG(a,s,r),n.setElementMobileAlign({settings:e,elem:s})});function o(s){const a=s.querySelectorAll("table"),l=s.querySelector("table");a.length===1&&(l?.hasAttribute("width")&&l?.getAttribute("width")!=="100%"||!l?.hasAttribute("width"))&&n.setElementMobileTableAlign({elem:l,settings:{mobileAlign:{classNamePrefix:"em-mob-table_align-",value:e.mobileAlign.value}}})}const i=t.closest("table");i?.getAttribute("em")==="atom"?o(i):t.querySelectorAll('[em="atom"]').forEach(s=>o(s))}function jY(e,t){const n=t.activeElement,r=t.removeEditorTags(Wl(t.isElementListContainer)),o=t.addClassToSecondCell(r,"em-list-temp-class");zi(n,n.tagName==="TR"?`<td em-edit="active">${o}</td>`:o);const i=window.getSelection();if(!i||i.rangeCount===0)return;let s=i.getRangeAt(0);const a=n.querySelectorAll(".em-list-temp-class");if(a.length>0){t.isProgrammaticSelection.value=!0;for(let l=0;l<a.length;l++){const c=a[l].querySelector("div");if(!c)continue;t.wrapEditor(c,!0),s=i.getRangeAt(0),s.selectNode(c),t.addNewRange(s);const u=c.innerHTML!==" "||c.innerHTML===" "&&(e.fontSize||e.textColor||e.lineHeight);if(t.textStyleProperties.some(d=>e.hasOwnProperty(d))&&u)try{t.toggleTextStyle(c,{settings:e})}catch{}}n.querySelectorAll(".em-list-temp-class").forEach(l=>l.classList.remove("em-list-temp-class")),n.removeAttribute("em-edit"),n.setAttribute("em-edit","active"),setTimeout(()=>{t.isProgrammaticSelection.value=!1},100),s=i.getRangeAt(0),s.selectNode(n),t.addNewRange(s)}}function VY(e){return e.backgroundImage?.[0]?.value??""}function lg(e){e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.textContent=e.elem.textContent.replace(/width=".*?"/gi,'width="'+e.width+'"'):e.elem.previousSibling&&lg({elem:e.elem.previousSibling,width:e.width})}function qA(e,t){let n=e.previousSibling;for(;n&&!(n.nodeName==="#comment"&&n.textContent?.includes("mso"));)n=n.previousSibling;const r=n?.textContent??"",o=r.lastIndexOf("<td");if(!n||o===-1)return;const i=r.slice(o),s=/\svalign="[^"]*"/i.test(i)?i.replace(/valign="[^"]*"/i,`valign="${t}"`):i.replace("<td",`<td valign="${t}"`);n.textContent=r.slice(0,o)+s}function GY(e,t){const n=t.activeElement;let r=!1;if(!e)return r;if(e.width){const o=e.gap?.value??0;if(e.width.value!==void 0&&e.width.value!==null)if(n.style.maxWidth)if(e.width.dim==="px"){const i=parseFloat(e.width.value+o),s=Math.round(parseFloat(e.width.value)/i*100);n.style.maxWidth=i+e.width.dim,lg({elem:n,width:i}),n.firstElementChild?.tagName==="TABLE"&&(n.firstElementChild.setAttribute("width",e.width.value),n.firstElementChild.style.width=s+"%",n.firstElementChild.style.maxWidth=e.width.value+"px")}else n.style.width=parseFloat(e.width.value)+e.width.dim;else e.width.dim==="px"?(n.style.width=parseFloat(e.width.value+o)+e.width.dim,lg({elem:n,width:parseFloat(e.width.value+o)}),n.firstElementChild?.tagName==="TABLE"&&n.firstElementChild.setAttribute("width",e.width.value)):n.style.width=parseFloat(e.width.value)+e.width.dim;else n.style.removeProperty("width")}if(e.gap&&!e.width){const o=parseFloat(e.gap.value??0);n.style.maxWidth?n.parentElement?.querySelectorAll('div[style*="inline-block"]').forEach(i=>{const s=i,a=parseFloat(s.style.maxWidth),l=Math.round((a-o)/a*100);s.firstElementChild?.tagName==="TABLE"&&(s.firstElementChild.setAttribute("width",String(a-o)),s.firstElementChild.style.width=l+"%",s.firstElementChild.style.maxWidth=a-o+"px")}):n.parentElement?.querySelectorAll('div[style*="inline-block"]').forEach(i=>{const s=i;s.firstElementChild?.tagName==="TABLE"&&s.firstElementChild.setAttribute("width",String(parseFloat(s.style.width)-o))})}return e.valign&&(n.style.verticalAlign=e.valign,qA(n,n.style.verticalAlign)),e.mobileWidth&&(t.setElementMobileWidth({settings:e,elem:n}),r=!0),e.mobileContentWidth&&(t.setElementMobileContentWidth({settings:e,elem:n.firstElementChild}),r=!0),e.mobileVerticalAlign&&(t.setElementMobileVerticalAlign({settings:e,elem:n}),r=!0),e.show&&(t.setElementShow({settings:e,elem:n}),r=!0),r}function cg(e){e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.textContent=e.elem.textContent.replace(/width=".*?"/gi,'width="'+e.width+'"'):e.elem.previousSibling&&cg({elem:e.elem.previousSibling,width:e.width})}function Uu(e){return!!(e.querySelector(".em-mob-wrap")||e.closest(".em-mob-wrap")||e.querySelector(".noresp-em-mob-wrap")||e.closest(".noresp-em-mob-wrap"))}function Ia(e){return e.querySelector(".em-mob-wrap, .noresp-em-mob-wrap")?document.querySelector('[em-edit="active"]'):e.closest(".em-mob-wrap, .noresp-em-mob-wrap")?.parentElement||null}function ug(e){return e.querySelector('div[style*="inline-block"]')?document.querySelector('[em-edit="active"]'):e.closest('div[style*="inline-block"]')?.parentElement||null}function XY(e,t){const n=t.activeElement;if(Uu(n)){const r=Ia(n);if(!r)return;const o=Bi(r);r.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)").forEach((i,s)=>{i.setAttribute("width",e.items[s])}),t.setPercentsForColumns(r.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)")),Hi(o,"follow")}else{const r=ug(n);if(!r)return;r.querySelectorAll('div[style*="inline-block"]').forEach((o,i)=>{const s=o;s.style.width=e.items[i]+e.gap+"px",cg({elem:s.closest('div[style*="inline-block"]'),width:e.items[i]+e.gap}),s.firstElementChild?.tagName==="TABLE"&&s.firstElementChild.setAttribute("width",e.items[i])})}}function KY(e,t){const n=t.activeElement;if(!Uu(n))return;const r=n.querySelector(".em-mob-wrap, .noresp-em-mob-wrap")?n.querySelector(".em-mob-wrap, .noresp-em-mob-wrap")?.parentElement:n.closest(".em-mob-wrap, .noresp-em-mob-wrap")?.parentElement;if(!r)return;const o=Bi(r),i=r.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)"),s=i.length,a=e.items.length,l=e.gap;s>=a?i.forEach((c,u)=>{if(u<a)c.setAttribute("width",e.items[u]);else{const d=c.previousElementSibling;(d?.classList.contains("em-mob-wrap")||d?.classList.contains("noresp-em-mob-wrap"))&&d?.remove(),c.remove()}}):(i.forEach((c,u)=>{c.setAttribute("width",e.items[u])}),e.items.forEach((c,u)=>{let d="";r.querySelector(".em-mob-wrap")?d=`<td width="${l}" class="em-mob-wrap"></td>
|
|
97
|
+
<td width="${c}" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>`:r.querySelector(".noresp-em-mob-wrap")&&(d=`<td width="${l}" class="noresp-em-mob-wrap"></td>
|
|
98
|
+
<td width="${c}" valign="top" class="noresp-em-mob-wrap em-mob-width-100perc"></td>`),u>=s&&d&&nr(r,"beforeend",d)})),Hi(o,"follow")}function YY(e,t){const n=t.activeElement;if(Uu(n)){const r=Ia(n);if(!r)return;r.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)").forEach(o=>{o.setAttribute("valign",e.valign)})}else{const r=ug(n);if(!r)return;r.querySelectorAll('div[style*="inline-block"]').forEach(o=>{o.style.verticalAlign=e.valign,qA(o,o.style.verticalAlign)})}}function ZY(e,t){const n=t.activeElement;if(Uu(n)){const r=Ia(n);if(!r)return;const o=Bi(r);r.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)").forEach((i,s)=>{i.setAttribute("width",e.items[s])}),t.setPercentsForColumns(r.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)")),r.querySelectorAll(".em-mob-wrap:nth-child(even), .noresp-em-mob-wrap:nth-child(even)").forEach(i=>{i.setAttribute("width",e.gap)}),Hi(o,"follow")}else{const r=ug(n);if(!r)return;r.querySelectorAll('div[style*="inline-block"]').forEach((o,i)=>{const s=o;s.style.width=e.items[i]+e.gap+"px",cg({elem:s.closest('div[style*="inline-block"]'),width:e.items[i]+e.gap}),s.firstElementChild?.tagName==="TABLE"&&s.firstElementChild.setAttribute("width",e.items[i])})}}function QY(e,t){const n=t.activeElement;let r=!1;const o=Ia(n);return o&&o.querySelectorAll(".em-mob-wrap:nth-child(even), .noresp-em-mob-wrap:nth-child(even)").forEach(i=>{t.setElementMobileHeight({settings:e,elem:i}),r=!0}),r}function ju(e){const t=Ia(e),n=t?Np(t):null;return n&&Op(n)?n:null}function JY(e,t){const n=ju(t.activeElement),r=n?Fi(n):null;!n||!r||e.items.length!==r.items.length||Aa(n,YV(r,e.items))}function eZ(e,t){const n=ju(t.activeElement),r=n?Fi(n):null;!n||!r||Aa(n,ZV(r,Ta(n),e.gap))}function tZ(e,t){const n=ju(t.activeElement),r=n?Fi(n):null;!n||!r||Aa(n,QV(r,Ta(n)))}function nZ(e,t){const n=ju(t.activeElement);!n||!e.valign||rG(n,e.valign)}var dg="amp-img";function rZ(e){const t=OT(e);return{src:t.src,alt:t.alt,title:t.title,width:t.width.value,height:t.height.value,link:t.link,imgReplacer:t.imgReplacer}}function zA(e){return e==null||e===""?null:Number(e)}function oZ(e){return{src:e.src??"",alt:e.alt??"",title:e.title??"",width:zA(e.width?.value),height:zA(e.height?.value),link:e.link||null,imgReplacer:e.imgReplacer??""}}function fg(e,t,n){const r=e.closest(n);return r&&r!==t&&t.contains(r)?r:null}function iZ(e,t){let n=e;for(;n.parentElement&&n.parentElement!==t;)n=n.parentElement;if(n.parentElement===t&&n.querySelectorAll(dg).length<=1)return n;let r=e;for(;r.parentElement&&r.parentElement!==t&&(r.parentElement.tagName==="A"||r.parentElement.tagName==="EM-REPLACE");)r=r.parentElement;return r}function UA(e){e.replaceWith(...Array.from(e.childNodes))}function jA(e,t){e.parentNode?.insertBefore(t,e),t.appendChild(e)}function sZ(e,t,n,r){if(r.src!==n.src&&Ht(e,"src",r.src),r.alt!==n.alt&&e.setAttribute("alt",r.alt),r.title!==n.title&&e.setAttribute("title",r.title),r.width!==n.width&&e.setAttribute("width",String(r.width??"")),r.height!==n.height&&e.setAttribute("height",String(r.height??"")),r.imgReplacer!==n.imgReplacer){const o=fg(e,t,"em-replace");if(!r.imgReplacer)o&&UA(o);else if(o)Ht(o,"src",r.imgReplacer);else{const i=document.createElement("em-replace");Ht(i,"src",r.imgReplacer),jA(e,i)}}if(r.link!==n.link){const o=fg(e,t,"a");if(!r.link)o&&UA(o);else if(o)o.setAttribute("href",r.link);else{const i=document.createElement("a");i.setAttribute("href",r.link),jA(fg(e,t,"em-replace")??e,i)}}}function aZ(e){const t=document.createElement(dg);Ht(t,"src",e.src),t.setAttribute("alt",e.alt),t.setAttribute("title",e.title),t.setAttribute("width",String(e.width.value)),t.setAttribute("height",String(e.height.value)),t.setAttribute("layout","responsive");let n=t;if(e.imgReplacer){const r=document.createElement("em-replace");Ht(r,"src",e.imgReplacer),r.appendChild(t),n=r}if(e.link){const r=document.createElement("a");r.setAttribute("href",e.link),r.appendChild(n),n=r}return n}function lZ(e){return e.some(t=>t.slideIndex!==void 0)?e.map(t=>t.slideIndex):e.map((t,n)=>n)}function cZ(e,t){const n=Array.from(e.querySelectorAll(dg)),r=new Set,o=[];lZ(t).forEach((i,s)=>{const a=i===void 0?void 0:n[i];if(!a||r.has(a)){o.push(t[s]);return}r.add(a),sZ(a,e,rZ(a),oZ(t[s]))}),n.filter(i=>!r.has(i)).forEach(i=>iZ(i,e).remove()),o.forEach(i=>e.appendChild(aZ(i)))}function uZ(e,t){const n=e,r=t.activeElement.closest("amp-carousel");r&&VA(r,t,o=>dZ(o,n,t))}function VA(e,t,n){lr(t.HTMLDocument.getOuterHtml(e),([r])=>{r instanceof Element&&(n(r),r.setAttribute("em-edit","active"),e.replaceWith(r))}),t.commit(!0)}function dZ(e,t,n){typeof t.loop=="boolean"&&(t.loop?e.setAttribute("loop",""):e.removeAttribute("loop")),typeof t.autoplay=="boolean"&&(t.autoplay?e.setAttribute("autoplay",""):e.removeAttribute("autoplay")),Array.isArray(t.carouselImages)&&cZ(e,t.carouselImages),"borderRadius"in t&&n.setElementBorderRadius({settings:{borderRadius:t.borderRadius},elem:e})}function fZ(e,t){const n=e,r=t.activeElement.closest("amp-accordion");r&&VA(r,t,o=>mZ(o,n))}function mZ(e,t){t.animate?e.setAttribute("animate",""):e.removeAttribute("animate"),t.expandSingleSection?e.setAttribute("expand-single-section",""):e.removeAttribute("expand-single-section"),e.querySelectorAll("section").forEach((n,r)=>{t.sections[r]?.expanded?n.setAttribute("expanded",""):n.removeAttribute("expanded")})}var Kn={align:"center",iconSize:40,borderRadius:0,gap:8,bgEnabled:!1,bgColor:"",borderWidth:0,borderColor:"",buttonBorderColor:"",buttonBorderWidth:0,showLabel:!1};function hZ(e){return e.closest('table[em-type="social"]')}function GA(e){const t=e.querySelector(":scope > tr");if(t){const r=t.querySelector(":scope > td");if(r&&we(r))return r}const n=e.querySelector("tbody > tr");if(n){const r=n.querySelector(":scope > td");if(r&&we(r))return r}return null}function pZ(e,t,n){const r=GA(e),o=GA(t);if(!(!r||!o)){for(const{name:i,value:s}of Array.from(r.attributes))i.toLowerCase()!=="align"&&o.setAttribute(i,s);o.setAttribute("align",n)}}function Yn(e){return String(e??"").replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}function gZ(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function bZ(){const e=[typeof document<"u"?document.baseURI:"",typeof window<"u"?window.location?.href:""];for(const t of e)if(t)try{const n=new URL(t);if(n.protocol==="http:"||n.protocol==="https:")return n.href}catch{}return""}function yZ(e){const t=String(e??"").trim();if(!t)return"";if(/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(t))return t;const n=bZ();if(!n)return t;try{return new URL(t,n).href}catch{return t}}function vZ(e){return e>0?`<td width="${e}"> </td>`:""}function EZ(e,t){const n=hZ(t.activeElement);if(!n)return null;const r=Array.isArray(e.items)?e.items:[],o=e.align==="left"||e.align==="right"||e.align==="center"?e.align:Kn.align,i=typeof e.iconSize=="number"?e.iconSize:Kn.iconSize,s=typeof e.borderRadius=="number"?e.borderRadius:Kn.borderRadius,a=typeof e.gap=="number"?e.gap:Kn.gap,l=typeof e.bgEnabled=="boolean"?e.bgEnabled:Kn.bgEnabled,c=typeof e.bgColor=="string"?e.bgColor:Kn.bgColor,u=typeof e.borderWidth=="number"?e.borderWidth:Kn.borderWidth,d=typeof e.borderColor=="string"?e.borderColor:Kn.borderColor;let f=typeof e.buttonBorderWidth=="number"&&!Number.isNaN(e.buttonBorderWidth)?e.buttonBorderWidth:Kn.buttonBorderWidth;f=Math.max(0,Math.min(24,Math.round(f)));const h=typeof e.showLabel=="boolean"?e.showLabel:Kn.showLabel,m=[];u>0&&d&&m.push(`border:${u}px solid ${Yn(d)}`);const p=m.length?` style="${m.join(";")}"`:"",S=!!(l&&String(c).trim()),C=Math.max(0,Math.round(Number(a)||0)),L=r.length>1,k=`<table border="0" cellspacing="0" cellpadding="0">
|
|
99
|
+
<tr>${r.map(v=>{const w=Yn(v.platform||"unknown"),b=!!v.customIcon,E=Yn(v.href||""),_=String(v.title??"").trim(),T=_?` title="${Yn(_)}"`:"",x=Yn(v.alt||""),N=Yn(yZ(v.iconSrc||"")),D=v.iconWidth!=null&&!Number.isNaN(Number(v.iconWidth))?Number(v.iconWidth):i,R=v.iconHeight!=null&&!Number.isNaN(Number(v.iconHeight))?Number(v.iconHeight):i,O=b?"":typeof v.buttonBgColor=="string"?v.buttonBgColor.trim():"",q=!b&&S&&!O?String(c).trim():"",ee=b?"":O||q,de=!b&&!!q,re=b?"":typeof v.itemBorderColor=="string"?v.itemBorderColor.trim():"",Q=!b&&!!(O||re&&f>0||de);let ve=`<a href="${E}" target="_blank"${T} draggable="false"><img src="${N}" width="${D}" height="${R}" border="0" alt="${x}" draggable="false" style="display:block;${!b&&!Q&&s>0?`border-radius:${s}px;`:""}" /></a>`;if(h&&(v.title||v.alt)){const oe=gZ(String(v.title||v.alt||""));ve+=`<br/><span style="display:block;font-size:11px;line-height:1.2;margin-top:4px;max-width:96px;word-break:break-word;">${oe}</span>`}const fe=[];ee&&fe.push(`background-color:${Yn(ee)}`),re&&f>0&&fe.push(`border:${f}px solid ${Yn(re)}`),Q&&s>0&&fe.push(`border-radius:${s}px`);const Te=de?' em-tray-cell-bg="1"':"",ut=b?' em-custom-icon="1"':"",te=ee&&/^#[0-9A-Fa-f]{3,8}$/.test(ee)?` bgcolor="${Yn(ee)}"`:"",z=L?' draggable="true"':"";return`<td em-platform="${w}"${ut}${Te}${te}${fe.length?` style="${fe.join(";")}"`:""}${z}>${ve}</td>`}).filter(Boolean).reduce((v,w,b)=>(b>0&&v.push(vZ(C)),v.push(w),v),[]).join("")}
|
|
100
|
+
</tr>
|
|
101
|
+
</table>`,y=`<table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom" em-type="social"${p}><tr><td align="${Yn(o)}">
|
|
102
|
+
${k}
|
|
103
|
+
</td></tr></table>`,g=Ne(y,!0)[0];return g?(g instanceof HTMLTableElement&&pZ(n,g,o),g.setAttribute("em-edit","active"),n.replaceWith(g),t.commit(!0),g):null}function SZ(e,t){if(typeof e.textSuperscript!="boolean"&&typeof e.textSubscript!="boolean")return;const n=window.getSelection();if(!n||n.rangeCount===0)return;const r=n.getRangeAt(0),o=r.commonAncestorContainer;if(o?.tagName==="TABLE")return;const i=o.nodeType===1?o:o.parentElement;if(!i)return;function s(a,l){const c=i.closest(a),u=a==="sup"?"sub":"sup",d=i.closest(u);if(l){let f=!0;if(c&&t.isRangeMatching(c,r,r.collapsed))f=!1;else if(d)if(t.isRangeMatching(d,r,r.collapsed)){const h=t.unwrapTag(d);r.selectNodeContents(h)}else{const h=t.splitWrapper(d,r);r.selectNodeContents(h),setTimeout(()=>n.removeAllRanges(),100)}else if(c){const h=t.splitWrapper(c,r);r.selectNodeContents(h)}if(f)if(r.collapsed){const h=r.cloneRange();try{r.expand("word");const m=r.toString().trim();if(m){const p=t.wrapInTag(r,m,a),S=document.createRange();S.selectNodeContents(p),n.removeAllRanges(),n.addRange(S),t.cleanEmptyTags(p.parentNode)}else r.setStart(h.startContainer,h.startOffset),r.setEnd(h.endContainer,h.endOffset)}catch{r.setStart(h.startContainer,h.startOffset),r.setEnd(h.endContainer,h.endOffset)}}else{const h=r.cloneContents(),m=document.createElement("div");m.appendChild(h),nn(r.commonAncestorContainer,m),t.unwrapNestedTags(m,a);const p=t.wrapInTag(r,m,a),S=document.createRange();S.selectNodeContents(p),n.removeAllRanges(),n.addRange(S),t.cleanEmptyTags(p.parentNode)}}else if(r.collapsed)if(c){const f=c.parentNode,h=t.unwrapTag(c),m=document.createRange();m.selectNodeContents(h),n.removeAllRanges(),n.addRange(m),t.cleanEmptyTags(f),c.parentNode||setTimeout(()=>n.removeAllRanges(),0)}else{const f=r.startContainer.parentElement?.closest(a);if(f){const h=t.unwrapTag(f),m=document.createRange();m.selectNodeContents(h),n.removeAllRanges(),n.addRange(m),t.cleanEmptyTags(f.parentNode)}}else{let f=[];const h=r.cloneContents(),m=document.createElement("div");if(m.appendChild(h),nn(r.commonAncestorContainer,m),f=Array.from(m.querySelectorAll(a)),c){const C=Array.from(c.childNodes).some(y=>y.nodeType===1),L=t.unwrapTag(c),k=document.createRange();if(L.isConnected)k.selectNodeContents(L),n.removeAllRanges(),n.addRange(k);else{const y=c.parentNode;y&&(k.selectNodeContents(y),n.removeAllRanges(),n.addRange(k))}C&&t.applicationElementSettingsSet({elem:document.querySelector("[em-edit]")}),t.commit();return}else{const C=r.commonAncestorContainer.parentElement?.closest(a)||r.startContainer.parentElement?.closest(a);C&&f.push(C)}f.length>0&&f.forEach(C=>{C.parentNode&&t.unwrapTag(C)});const p=m.cloneNode(!0);nn(m,p);const S=p.querySelector('[em-edit="active"]');if(S){r.deleteContents(),r.insertNode(S);const C=document.createRange();C.selectNodeContents(S),n.removeAllRanges(),n.addRange(C),t.cleanEmptyTags(S.parentNode)}}t.commit()}typeof e.textSuperscript=="boolean"&&s("sup",e.textSuperscript),typeof e.textSubscript=="boolean"&&s("sub",e.textSubscript)}function wZ(e,t){if(e!==void 0){if(e===""){_Z(t.activeElement);return}CZ(e,t)}}function _Z(e){const t=e?.closest("em-replace")||e?.querySelector("em-replace");if(!t)return;const n=t.parentNode,r=t.firstChild,o=t.lastChild;if(t.getAttribute("text")!==t.innerHTML)for(;t.firstChild;)n?.insertBefore(t.firstChild,t);const i=document.createRange(),s=window.getSelection();r&&o&&s&&(i.setStartBefore(r),i.setEndAfter(o),s.removeAllRanges(),s.addRange(i)),t.remove()}function CZ(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return;const r=n.getRangeAt(0),o=e.replace(/~~.*$/,""),i=r.commonAncestorContainer,s=i.nodeType===1?i:i.parentElement;let a=s?.closest("em-replace");const l=/~~/.test(e)&&a;if(l){const c=e.replace(/~~.*$/,"");s?.setAttribute("text",c),s&&(s.innerHTML=c)}if(!a&&n.rangeCount>0&&!r.collapsed){const c=document.querySelectorAll("em-replace");if(a=Array.prototype.find.call(c,u=>u.textContent?.trim()===n.toString().trim()&&n.toString().trim()!==""),!a){const u=document.querySelector('[em-edit="active"]');u?.textContent===r.toString()&&r.selectNodeContents(u);const d=e.replace(/~~.*$/,""),f=document.createElement("em-replace");f.setAttribute("text",d),r.surroundContents(f)}}if(!a&&n.rangeCount>0&&r.collapsed){let c=document.querySelector("em-replace");if(c){const u=document.querySelectorAll("em-replace"),d=/~$/;a=Array.prototype.find.call(u,f=>{const h=e,m=f.textContent||"";return h.length===1&&d.test(m)?!0:t.compareStrings(m,h)}),a&&(a.setAttribute("text",e),a.textContent=e),a||(c=document.createElement("em-replace"),c.setAttribute("text",o),r.insertNode(c),c.innerHTML=o,r.collapse(!1))}else c=document.createElement("em-replace"),c.setAttribute("text",o),r.insertNode(c),c.innerHTML=o,r.collapse(!1)}a&&!l&&(a.getAttribute("text")===a.innerHTML&&(a.innerHTML=e),a.setAttribute("text",e))}function TZ(e){return e.trim().replace(/\s+/g,"_").replace(/[^\p{L}\p{N}\-_:.]/gu,"")}function XA(e){const t=e.commonAncestorContainer,n=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest?.("a[name]");if(!n)return null;try{const r=document.createRange();return r.selectNodeContents(n),e.compareBoundaryPoints(Range.START_TO_START,r)>=0&&e.compareBoundaryPoints(Range.END_TO_END,r)<=0?n:null}catch{return null}}function AZ(e,t){if(!e||!t)return;const n=document.createRange(),r=window.getSelection();if(r)try{if(!e.isConnected||!t.isConnected)return;n.setStartBefore(e),n.setEndAfter(t),r.removeAllRanges(),r.addRange(n)}catch{}}function kZ(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function LZ(e,t){const n=window.getSelection(),r=n?.rangeCount?n.getRangeAt(0):null;if(e===void 0||!e.trim()){let i=null;if(r&&!r.collapsed&&(i=XA(r)),i||(i=t.activeElement?.closest?.("a[name]")),i){const s=i.firstChild,a=i.lastChild;kZ(i),t.commit(),AZ(s,a)}return}const o=TZ(e);if(o&&!(!n||!r||r.collapsed))try{const i=XA(r);if(i){i.setAttribute("name",o),t.commit();return}const s=document.createElement("a");s.setAttribute("name",o);const a=r.extractContents();s.appendChild(a),r.insertNode(s);const l=document.createRange();l.selectNodeContents(s),n.removeAllRanges(),n.addRange(l),t.commit()}catch{}}var Ie=e=>Ql(e?.innerText);function NZ(e,t){return e.hasOwnProperty("textStrong")?{name:"textStrong",tags:["b","strong","a","[style*=font-weight]"],value:e.textStrong,command:"bold"}:e.hasOwnProperty("textItalic")?{name:"textItalic",tags:["em","i","[style*=font-style]","a"],value:e.textItalic,command:"italic"}:e.hasOwnProperty("textStrikethrough")?{name:"textStrikethrough",tags:["s","strike","u","[style*=text-decoration]","a"],value:e.textStrikethrough,command:"strikethrough"}:e.hasOwnProperty("textUnderline")?{name:"textUnderline",tags:["u","strike","[style*=text-decoration]","span","a"],value:e.textUnderline,command:"underline"}:e.hasOwnProperty("textColor")?{name:"textColor",tags:["a","[style*='color']","span"],value:t(e.textColor)||"",command:"foreColor"}:e.hasOwnProperty("textBackgroundColor")?{name:"textBackgroundColor",tags:["a","[style*='background-color']","[style*='color']","span"],value:t(e.textBackgroundColor)||"",command:"hilitecolor"}:e.hasOwnProperty("fontFamily")?{name:"fontFamily",tags:["[style*='font-family']","span","a"],value:e.fontFamily?.[e.fontFamily.length-1],command:"fontName"}:e.hasOwnProperty("textLink")?{name:"textLink",tags:["a","[href]","div","p","td"],value:e.textLink||"",command:"createLink"}:e.hasOwnProperty("fontSize")?{name:"fontSize",tags:["a","[style*='font-size']","span","div"],value:parseFloat(e.fontSize),command:"fontSize"}:e.hasOwnProperty("lineHeight")?{name:"lineHeight",tags:["div","[style*='line-height']","p","td"],value:parseFloat(e.lineHeight),command:null}:{}}function xZ(e,t){if(!e?.rangeCount)return;const n=e.getRangeAt(0),r=n.commonAncestorContainer;let o=n.startOffset,i=n.endOffset;const s=r.data;if(!s)return;for(;o>0&&!/\s/.test(s[o-1]);)o--;for(;i<s.length&&!/\s/.test(s[i]);)i++;const a=document.createRange();a.setStart(r,o),a.setEnd(r,i),t(a)}var OZ=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,RZ=/^rgba?\s*\(\s*(?<r>\d+)\s*,\s*(?<g>\d+)\s*,\s*(?<b>\d+)\s*(?:,\s*(?<a>(?:0?\.)?\d+)\s*)?\)$/i,mg=e=>e.toString(16).padStart(2,"0");function MZ(e){const t=RZ.exec(e)?.groups;if(!t)return;const n=Number.parseInt(t.r,10),r=Number.parseInt(t.g,10),o=Number.parseInt(t.b,10);if(![n,r,o].some(i=>!Number.isFinite(i)||i<0||i>255))return`#${mg(n)}${mg(r)}${mg(o)}`}function KA(e){return e.split("").map(t=>`${t}${t}`).join("")}function Zn(e,t){if(!e)return;const n=e.trim();if(!n)return;if(OZ.test(n)){const o=n.slice(1);return o.length===3?`#${KA(o).toLowerCase()}`:o.length===4?`#${KA(o.slice(0,3)).toLowerCase()}`:o.length===8?`#${o.slice(0,6).toLowerCase()}`:`#${o.toLowerCase()}`}const r=MZ(n);if(r)return r;if(t){const o=t(n);if(o&&o!==n)return Zn(o)}}function PZ(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function hg(e,t,n){const r=t.parentElement;let o=e.parentElement;for(;o&&o!==r;){const i=Zn(o.style.color,n);if(i)return i;o=o.parentElement}}function IZ(e,t){Array.from(e.querySelectorAll("span")).reverse().forEach(n=>{if(!n.style.color)return;const r=Zn(n.style.color,t);if(!r)return;const o=hg(n,e,t);!o||o!==r||(n.style.removeProperty("color"),n.getAttribute("style")||n.removeAttribute("style"),n.attributes.length===0&&PZ(n))})}function DZ(e){const t=e.commonAncestorContainer.nodeType===Node.ELEMENT_NODE?e.commonAncestorContainer:e.commonAncestorContainer.parentElement;if(!t)return[];if(e.commonAncestorContainer.nodeType===Node.TEXT_NODE){const o=e.commonAncestorContainer;return o.data.trim()?[o]:[]}const n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,null),r=[];for(;n.nextNode();){const o=n.currentNode;!o.data.trim()||!e.intersectsNode(o)||r.push(o)}return r}function BZ(e,t,n){const r=Zn(t,n);if(!r)return!1;const o=window.getSelection();if(!o||o.rangeCount===0)return!1;const i=o.getRangeAt(0);if(i.collapsed||!i.toString().trim())return!1;const s=DZ(i);if(!s.length||s.every(c=>{const u=c.parentElement;return u?Zn(u.style.color,n)===r?!0:hg(u,e,n)===r:!1}))return!1;const a=document.createElement("span");a.style.color=t;try{i.surroundContents(a)}catch{a.appendChild(i.extractContents()),i.insertNode(a)}const l=document.createRange();return l.selectNodeContents(a),o.removeAllRanges(),o.addRange(l),!0}function HZ(e,t,n){const r=Array.from(e.querySelectorAll('a[style*="color"]'));e.tagName==="A"&&e.style.color&&r.unshift(e),r.forEach(o=>{const i=Zn(o.style.color,t);if(!i)return;const s=hg(o,e,t)||(n?Zn(n,t):void 0);s&&Array.from(o.querySelectorAll("span")).forEach(a=>{if(!a.style.color)return;const l=Zn(a.style.color,t);l&&l!==i&&l===s&&(a.style.color=o.style.color)})})}function FZ(e){if(e.currentSettings.name!=="lineHeight")return!1;const t=e.parentElement.closest('[style*="line-height"]')||e.parentElement.closest("div, p, td");if(e.parentElement?.querySelector('[em-edit="active"]')){const n=[];e.checkForTextNodes(e.parentNode,n),n.forEach(r=>{const o=r.closest('[style*="line-height"]')||r.closest("div, p, td");o&&(o.style.lineHeight=e.currentSettings.value+"px")})}else if(e.isElementList){const n=!!e.parentElement.querySelector("div"),r=n?e.parentElement.closest("tr")?.querySelector(`.${e.classNameBullet}`):null;if(r&&(r.style.lineHeight=e.currentSettings.value+"px"),n){const o=e.parentElement.querySelector("div");o&&(o.style.lineHeight=e.currentSettings.value+"px")}else e.parentElement.style.lineHeight=e.currentSettings.value+"px"}else t&&(t.style.lineHeight=e.currentSettings.value+"px");return e.commit(),!0}function $Z(e){if(e.currentSettings.name!=="fontFamily")return!1;let t=(e.findElementWithSelectedText(e.selectedText)||e.getParentElementOfSelection())?.closest('[style*="font-family"]')||e.parentWrapper;const n=!!e.parentElement?.querySelector('[em-edit="active"]');if(!n&&(!e.range?.collapsed||e.getSelectedText()))if(e.getInnerText(e.parentWrapper)===e.selectedText)t=e.parentWrapper;else if(e.getInnerText(e.parentElement)===e.selectedText)t=e.parentElement;else{const o=document.createElement("span");e.range.commonAncestorContainer.nodeType===3?e.range.surroundContents(o):(o.appendChild(e.range.extractContents()),e.range.insertNode(o)),t=o,e.range.deleteContents(),e.range.insertNode(t),e.range.selectNode(t),e.addNewRange(e.range)}e.fontFamilyArray?e.fontFamilyArray[0]==="Safe Fonts"?(t.style.fontFamily=e.fontFamilyArray[1],e.removeClassesByPrefix(t,"em-font"),e.clearLinkTags({elem:document.documentElement})):e.fontFamilyArray[0]==="Google Fonts"&&(e.fontFamilyArray[1]==="Sans Serif"?t.style.fontFamily="Helvetica, Arial, sans-serif":e.fontFamilyArray[1]==="Serif"?t.style.fontFamily='"Times New Roman", Times, serif':e.fontFamilyArray[1]==="Project Fonts"&&du(t,e.fontFamilyArray[2]),e.removeClassesByPrefix(t,"em-font"),t.classList.add(e.createFontClassName(e.fontFamilyArray)),lp(t,e.fontFamilyArray),e.addFontFamilyClass({fontFamilyArray:e.fontFamilyArray})):t.style.removeProperty("font-family");let r;return n?(r=e.parentElement.querySelectorAll('[style*="font-family"]'),r.forEach(o=>o.style.fontFamily=t.style.fontFamily)):(r=t.querySelectorAll('[style*="font-family"]'),r.forEach(o=>o.style.fontFamily="")),e.cleanEmptySpans(e.selectedText),e.refreshElementSettings(t,e.selectedText),e.range.selectNode(t),e.addNewRange(e.range),e.commit(),!0}function WZ(e){if(e.currentSettings.command==="bold"){if(e.hasItalicClass&&e.tempStyleClass&&e.parentWrapper&&e.parentWrapper.classList.add(e.tempStyleClass),!e.isEditorTagOutside){const t=[];e.checkForTextNodes(e.parentNode,t),t.filter(n=>e.checkForWorkClass(n)).forEach(n=>{const r=n.parentElement??n;Le(n,e.removeFormattingTags(je(n),"bold")),rn(n),n.tagName!=="STRONG"?e.currentSettings.value&&Le(n,"<strong>"+je(n)+"</strong>"):e.currentSettings.value||ss(n,je(n)),rn(r)})}if(e.currentSettings.value===!0)Array.from(e.parentNode?.getElementsByTagName("b")||[]).reverse().forEach(t=>{const n=document.createElement("strong");if(Vt(n,t),t.parentNode?.replaceChild(n,t),e.getInnerText(n)===e.selectedText){const r=n.closest("span");r?.textContent===n.innerText&&!r.getAttribute("style")&&r.childNodes[0]?.nodeType===3&&r.parentNode?.replaceChild(n,r),e.refreshElementSettings(n,e.selectedText),e.range.selectNode(n),e.addNewRange(e.range)}});else if(Array.from(e.parentWrapper?.getElementsByTagName("b")||[]).reverse().forEach(t=>{const n=document.createElement("strong");Vt(n,t),t.parentNode?.replaceChild(n,t)}),e.getInnerText(e.parentWrapper)===e.selectedText){const t=e.parentWrapper||e.findElementWithSelectedText(e.selectedText,e.activeElement);t&&(e.range.selectNode(t),e.addNewRange(e.range))}e.cleanEmptySpans(e.selectedText)}}function qZ(e){if(e.currentSettings.command==="italic"){if(e.hasItalicClass&&e.tempStyleClass&&e.parentWrapper&&e.parentWrapper.classList.add(e.tempStyleClass),!e.isEditorTagOutside){const t=[];e.checkForTextNodes(e.parentNode,t),t.filter(n=>e.checkForWorkClass(n)).forEach(n=>{const r=n.parentElement??n;Le(n,e.removeFormattingTags(je(n),"italic")),rn(n),n.tagName!=="EM"?e.currentSettings.value&&Le(n,"<em>"+je(n)+"</em>"):e.currentSettings.value||ss(n,je(n)),rn(r)})}if(e.currentSettings.value)Array.from(e.parentNode?.getElementsByTagName("i")||[]).reverse().forEach(t=>{const n=document.createElement("em");if(Vt(n,t),t.parentNode?.replaceChild(n,t),e.getInnerText(n)===e.selectedText){const r=n.closest("span");r?.textContent===n.innerText&&!r.getAttribute("style")&&r.childNodes[0]?.nodeType===3&&r.parentNode?.replaceChild(n,r),e.refreshElementSettings(n,e.selectedText),e.range.selectNode(n),e.addNewRange(e.range)}});else if(Array.from(e.parentElement?.getElementsByTagName("i")||[]).reverse().forEach(t=>{const n=document.createElement("em");Vt(n,t),t.parentNode?.replaceChild(n,t)}),e.getInnerText(e.parentWrapper)===e.selectedText){const t=e.parentWrapper||e.findElementWithSelectedText(e.selectedText,e.activeElement);t&&(e.range.selectNode(t),e.addNewRange(e.range))}e.cleanEmptySpans(e.selectedText)}}function zZ(e){if(e.currentSettings.name!=="fontSize")return;const{mutableState:t}=e;if(e.getInnerText(t.parentWrapper)!==e.selectedText){let i=!1;const s=e.findParentWithFontSizeAndTag(e.activeElement||t.parentNode)||t.parentWrapper;s&&s.style.fontSize.length&&(i=s.style.fontSize,s.style.fontSize=""),ur("fontSize",!1,"1"),i&&s&&(s.style.fontSize=i);const a=window.getSelection()?.getRangeAt(0).commonAncestorContainer;t.parentElement=t.parentNode.querySelector('[size="1"]')||(a?.nodeType===1?a:a?.parentElement),t.parentElement&&(t.parentElement.style.fontSize=e.currentSettings.value+"px")}let n=null;if(t.parentElement?.tagName==="FONT"){const i=document.createElement("span");Vt(i,t.parentElement),t.parentElement.getAttribute("size")?(i.style.fontSize=e.currentSettings.value+"px",i.removeAttribute("size")):Array.from(t.parentElement.attributes).forEach(s=>i.setAttribute(s.name,s.value)),t.parentElement.parentNode?.replaceChild(i,t.parentElement),e.refreshElementSettings(i,e.selectedText),t.range.selectNode(i),e.addNewRange(t.range)}if((e.activeElement.tagName==="A"||e.activeElement.closest("a"))&&(t.parentWrapper=e.activeElement.closest("a")),e.getInnerText(t.parentWrapper)===e.selectedText){if(Array.from(t.parentWrapper?.getElementsByTagName("span")||[]).forEach(s=>s.style.fontSize=""),!t.parentWrapper?.hasAttribute("em-edit")&&e.isElementList&&t.parentWrapper&&e.isProgrammaticSelection){const s=t.parentWrapper.closest("tr")?.querySelector(`.${e.classNameBullet}`);s&&(s.style.fontSize=e.currentSettings.value+"px")}t.parentWrapper&&(t.parentWrapper.style.fontSize=e.currentSettings.value+"px");const i=t.parentWrapper?.firstChild;i?.nodeType===1&&i.tagName==="SPAN"&&i.innerText===e.selectedText&&(i.style.fontSize="")}else t.parentWrapper?.style.hasOwnProperty("font-size")&&(n=t.parentWrapper.style.fontSize,n&&t.parentWrapper.style.removeProperty("font-size"));n&&t.parentWrapper&&(t.parentWrapper.style.fontSize=n);const r=Array.from(t.parentNode?.querySelectorAll("font")||[]).reverse(),o=[];e.isEditorTagOutside?e.currentSettings.value||(t.selection=window.getSelection(),t.range=t.selection.getRangeAt(0),t.parentNode=t.selection.anchorNode?.nodeType===1?t.selection.anchorNode:t.selection.anchorNode?.parentElement,t.parentNode&&t.parentNode.style.removeProperty(e.currentStyle),e.cleanEmptySpans(e.selectedText)):(e.checkForTextNodes(t.parentNode,o),o.filter(i=>e.checkForWorkClass(i)).forEach(i=>{i.style.fontSize=e.currentSettings.value+"px",i.querySelectorAll('[style*="font-size"]').forEach(s=>{s.tagName!=="A"?s.style.removeProperty("font-size"):s.style.fontSize=e.currentSettings.value+"px"})})),e.isEditorTagOutside&&r.forEach(i=>{const s=document.createElement("span");Vt(s,i);const a=e.currentSettings.value+"px",l=i.children?.length===1&&i.firstChild?.nodeType===1?i.firstChild:null,c=[];if(e.checkForTextNodes(i,c),c.forEach(u=>{if(u.tagName==="FONT"){const d=document.createElement("span");Vt(d,u),u.getAttribute("size")?d.style.fontSize=e.getInnerText(u)===e.selectedText?a:"":Array.from(u.attributes).forEach(f=>d.setAttribute(f.name,f.value)),u.parentNode?.replaceChild(d,u)}}),l)i.parentNode?.replaceChild(l,i);else if(i.getAttribute("size")&&i.parentNode){const u=document.createElement("span");Vt(u,i),u.style.fontSize=a,i.parentNode.replaceChild(u,i)}if(!c.length&&i.tagName==="FONT"){const u=document.createElement("span");Vt(u,i),i.parentNode?.replaceChild(u,i)}}),Array.from(document.getElementsByTagName("span")).reverse().forEach(i=>{e.getInnerText(i)===e.selectedText&&i.closest('[em-edit="active"]')&&(e.refreshElementSettings(i,e.selectedText),t.range.selectNode(i),e.addNewRange(t.range))}),e.cleanEmptySpans(e.selectedText)}function UZ(e){if(e.currentSettings.command!=="strikethrough")return;const{mutableState:t}=e;let n=e.getSelectedText(),r=null;if(!e.isEditorTagOutside){const o=[];e.checkForTextNodes(e.parentNode,o),o.filter(i=>e.checkForWorkClass(i)).forEach(i=>{const s=i.parentElement??i;Le(i,e.removeFormattingTags(je(i),"strike")),rn(i),i.tagName!=="STRIKE"?e.currentSettings.value&&Le(i,"<strike>"+je(i)+"</strike>"):e.currentSettings.value||ss(i,je(i)),rn(s)})}if(e.currentSettings.value===!0){let o=n;Array.from(document?.getElementsByTagName("strike")||[]).reverse().forEach(i=>{if(e.getInnerText(i)===o&&(e.getInnerText(i.parentNode)===o&&i.parentNode.tagName==="U"&&Md(i.parentNode),r=e.findElementWithSelectedText(o),r)){const s=e.findOutermostParentWithText(r,"A");s&&(s.style.textDecoration="none"),e.refreshElementSettings(r,o),t.range.selectNode(r),e.addNewRange(t.range)}})}else{let o=n;if(e.cleanEmptySpans(o),e.getInnerText(t.parentWrapper)===o){const i=window.getSelection();if(r=e.findElementWithSelectedText(o,e.activeElement),r&&(t.range.selectNode(r),e.addNewRange(t.range),t.range.cloneContents())){const s=t.range.firstElementChild?t.range.firstElementChild:t.range.parentElement||t.range.commonAncestorContainer;s&&e.request.type!=="button"&&e.refreshElementSettings(s,o)}if(i&&i.rangeCount>0&&e.isElementList&&!r){const s=i.getRangeAt(0);let a=s.commonAncestorContainer;a.nodeType!==Node.ELEMENT_NODE&&(a=a.parentNode),a.querySelectorAll("strike").forEach(l=>{Md(l)}),a.style.textDecoration="none",a.querySelectorAll('span[style*="text-decoration"]').forEach(l=>{l.style.textDecoration=""}),e.refreshElementSettings(a,o),s.selectNodeContents(a),i.removeAllRanges(),i.addRange(s),e.addNewRange(s)}}}if(e.request.type==="button"||e.activeElement.tagName==="A"){e.request.type!=="button"&&e.activeElement.tagName==="A"&&(t.parentWrapper=e.activeElement);let o=n;if(e.getInnerText(t.parentWrapper)===o&&t.parentWrapper)t.parentWrapper.style.textDecoration=e.currentSettings.value?"line-through":"none",Array.from(t.parentWrapper.querySelectorAll('span[style*="text-decoration"]')).forEach(i=>i.style.textDecoration=""),Le(t.parentWrapper,e.removeFormattingTags(je(t.parentWrapper),"strikeUnderline")),rn(t.parentWrapper),e.refreshElementSettings(t.parentWrapper,o),t.range.selectNode(t.parentWrapper),e.addNewRange(t.range);else{const i=t.selection.getRangeAt(0),s=document.createElement("span");s.style.textDecoration=e.currentSettings.value?"line-through":"none",e.activeElement.nodeType===1&&e.activeElement.tagName==="SPAN"?(e.activeElement.style.textDecoration=e.activeElement.style.textDecoration==="line-through"?"none":"line-through",Array.from(e.activeElement.querySelectorAll('span[style*="text-decoration"]')).forEach(a=>a.style.textDecoration=""),e.refreshElementSettings(e.activeElement,o)):(s.appendChild(i.extractContents()),Array.from(s.querySelectorAll('span[style*="text-decoration"]')).forEach(a=>a.style.textDecoration=""),i.insertNode(s),r=s,e.refreshElementSettings(s,o),e.addNewRange(i))}}if(t.range.cloneContents()){if(t.range=t.selection.getRangeAt(0),r&&e.getInnerText(r)===n)t.range.selectNode(r),e.addNewRange(t.range);else{const o=t.range.commonAncestorContainer,i=o.nodeType===1?o:o.parentElement,s=t.range.firstElementChild?t.range.firstElementChild:t.range.parentElement||i;s&&e.getInnerText(s)===n&&(t.range.selectNode(s),e.addNewRange(t.range))}r&&e.refreshElementSettings(r,n)}}function jZ(e){if(e.currentSettings.command!=="underline")return;const{mutableState:t}=e,n=o=>{const i=o.parentNode;if(i){for(;o.firstChild;)i.insertBefore(o.firstChild,o);i.removeChild(o)}},r=o=>{o.querySelectorAll("u").forEach(i=>{n(i)}),o.querySelectorAll('span[style*="text-decoration"], span[style*="text-decoration-line"]').forEach(i=>{i.style.removeProperty("text-decoration"),i.style.removeProperty("text-decoration-line"),i.getAttribute("style")||i.removeAttribute("style"),i.attributes.length===0&&n(i)})};if(!e.isEditorTagOutside){const o=[];e.checkForTextNodes(e.parentNode,o),o.filter(i=>e.checkForWorkClass(i)).forEach(i=>{const s=i.parentElement??i;Le(i,e.removeFormattingTags(je(i),"underline")),rn(i),i.tagName!=="U"?e.currentSettings.value&&Le(i,"<u>"+je(i)+"</u>"):e.currentSettings.value||ss(i,je(i)),rn(s)})}if(e.currentSettings.value){const o=Array.from(e.findOutermostParentWithText(e.parentElement)?.getElementsByTagName("u")||[]).reverse();o.push(...Array.from(e.findOutermostParentWithText(e.parentElement)?.querySelectorAll("a,span[style*=text-decoration]")||[]).reverse()),o.filter(i=>e.getInnerText(i)===e.selectedText).forEach(i=>{if(e.selectedText&&e.getInnerText(i)===e.selectedText){i.style.textDecoration="underline";const s=i.firstChild;s?.tagName==="STRIKE"&&e.getInnerText(s)===e.selectedText&&[...s.attributes].forEach(a=>{i.setAttribute(a.name,a.value),s.removeAttribute(a.name)}),e.cleanStrikesInElement(i,e.getParentElementOfSelection())}}),e.cleanEmptySpans(e.selectedText),e.getInnerText(e.parentElement)===e.selectedText&&e.cleanStrikesInElement(e.parentElement,e.getParentElementOfSelection())}else{const o=e.findElementWithSelectedText(e.selectedText,e.activeElement);if(!o&&e.isElementList){let i=null;const s=window.getSelection();if(s&&s.rangeCount>0){let l=s.getRangeAt(0).commonAncestorContainer;for(l.nodeType!==Node.ELEMENT_NODE&&(l=l.parentNode);l&&l!==e.activeElement&&!["DIV"].includes(l.tagName);)l=l.parentNode;l&&l.contains(e.activeElement)&&(i=l)}const a=i?e.findOutermostParentWithText(i,"A"):null;a&&(a.style.textDecoration="none"),e.getInnerText(t.parentWrapper)===e.selectedText&&i&&(e.refreshElementSettings(i,e.selectedText),t.range.selectNode(i),e.addNewRange(t.range))}else{const i=e.findOutermostParentWithText(o,"A");i&&(i.style.textDecoration="none"),e.getInnerText(t.parentWrapper)===e.selectedText&&o&&(e.refreshElementSettings(o,e.selectedText),t.range.selectNode(o),e.addNewRange(t.range))}}if(e.request.type==="button"||e.activeElement.tagName==="A")if(e.request.type!=="button"&&e.activeElement.tagName==="A"&&(t.parentWrapper=e.activeElement),e.getInnerText(t.parentWrapper)===e.selectedText&&t.parentWrapper)t.parentWrapper.style.textDecoration=e.currentSettings.value?"underline solid":"none",Array.from(t.parentWrapper.querySelectorAll('span[style*="text-decoration"]')).forEach(o=>o.style.textDecoration=""),e.cleanStrikesInElement(t.parentWrapper,e.getParentElementOfSelection());else{const o=t.selection.getRangeAt(0);if(e.activeElement.nodeType===1&&e.activeElement.tagName==="SPAN")e.currentSettings.value?e.activeElement.style.textDecoration="underline":(e.activeElement.style.removeProperty("text-decoration"),e.activeElement.style.removeProperty("text-decoration-line")),Array.from(e.activeElement.querySelectorAll('span[style*="text-decoration"]')).forEach(i=>i.style.textDecoration=""),e.activeElement.getAttribute("style")||e.activeElement.removeAttribute("style"),e.refreshElementSettings(e.activeElement,e.selectedText);else if(e.activeElement.tagName!=="A")if(e.currentSettings.value){const i=document.createElement("span");i.style.textDecoration="underline",i.appendChild(o.extractContents()),Array.from(i.querySelectorAll('span[style*="text-decoration"]')).forEach(s=>s.style.textDecoration=""),e.refreshElementSettings(i,e.selectedText),o.insertNode(i),e.addNewRange(o)}else{const i=o.extractContents(),s=document.createElement("span");s.appendChild(i),r(s);const a=document.createDocumentFragment();for(;s.firstChild;)a.appendChild(s.firstChild);o.insertNode(a),e.addNewRange(o)}}}function VZ(e){if(!e.isColorChange)return;const{mutableState:t}=e;let n=[];if(e.tempColor&&t.parentWrapper&&(t.parentWrapper.style[e.stylePropretyName]=e.tempColor,!t.parentWrapper?.hasAttribute("em-edit")&&e.isElementList&&t.parentWrapper&&e.isProgrammaticSelection)){const s=t.parentWrapper.closest("tr")?.querySelector(`.${e.classNameBullet}`);s&&(s.style[e.stylePropretyName]=e.tempColor)}if(e.outerContextColor&&e.outerContextElement&&(e.outerContextElement.style.color=e.outerContextColor),e.getInnerText(t.parentWrapper)===e.selectedText&&t.parentWrapper){const s=e.rgbToHex(e.currentSettings.value?.toString())||"";if(e.currentStyle==="color"){const a=(e.parentElement||t.parentNode).closest("a");e.request.type==="button"||a?a&&(a.style.color=s,a.querySelectorAll('span[style*="color"]').forEach(l=>l.style.color="")):(t.parentWrapper.style.color=s,e.canselExecCommand&&(e.setCustomColor(t.parentWrapper,e.stylePropretyName,e.currentSettings.value),t.range.selectNode(t.parentWrapper),e.addNewRange(t.range)),t.parentWrapper.querySelectorAll(":not(a)").forEach(l=>{l.style.color&&e.getInnerText(l)===e.selectedText&&(l.style.color="")}))}else if(!e.canselExecCommand){const a=document.createElement("span");a.style[e.stylePropretyName]=s;const l=t.parentWrapper.firstChild;if(l?.nodeType===1&&l.tagName==="SPAN"&&e.getInnerText(l)===e.selectedText)l.style[e.stylePropretyName]=s;else{for(;t.parentWrapper.firstChild;)a.appendChild(t.parentWrapper.firstChild);t.parentWrapper.appendChild(a)}}t.parentWrapper.querySelectorAll(`span[style*="${e.stylePropretyName}"]`).forEach(a=>{a.innerText!==t.parentWrapper.innerText&&a.style.removeProperty(e.stylePropretyName)})}e.isEditorTagOutside?!e.currentSettings.value&&t.selection.isCollapsed&&(t.parentNode=t.selection.anchorNode?.nodeType===1?t.selection.anchorNode:t.selection.anchorNode?.parentElement,t.parentNode&&t.parentNode.style.removeProperty(e.stylePropretyName),e.cleanEmptySpans(e.selectedText)):(e.checkForTextNodes(t.parentNode,n),n.forEach(s=>{s.classList&&s.classList.contains(e.classNameBullet)||e.checkForWorkClass(s)&&(s.style[e.stylePropretyName]=e.currentSettings.value,s.querySelectorAll(`[style*="${e.stylePropretyName}"]`).forEach(a=>{a.tagName!=="A"?a.style.removeProperty(e.currentStyle):a.style[e.stylePropretyName]=e.currentSettings.value}))}));const r=Array.from(t.parentNode?.querySelectorAll("font")||[]).reverse();e.isEditorTagOutside&&r.forEach(s=>{const a=document.createElement("span");Vt(a,s);const l=s.getAttribute(e.currentStyle),c=e.rgbToHex(l||"").toString(),u=s.children.length===1&&s.firstChild?.nodeType===1?s.firstChild:null;let d=[];if(e.checkForTextNodes(s,d),d.forEach(f=>{if(f.tagName==="FONT"){const h=document.createElement("span");Vt(h,f),h.style[e.stylePropretyName]=c,f.parentNode?.replaceChild(h,f),e.refreshElementSettings(h,e.selectedText),t.range.selectNode(h),e.addNewRange(t.range)}else f.style[e.stylePropretyName]=c}),u)s.parentNode?.replaceChild(u,s);else if(s.getAttribute(e.currentStyle)&&s.parentNode){const f=document.createElement("span");Vt(f,s),f.style[e.stylePropretyName]=c;const h=s.closest("a");h&&h.innerText===s.innerHTML&&(h.style[e.stylePropretyName]=c),s.parentNode.replaceChild(f,s)}});const o=Array.from(t.parentWrapper?.getElementsByTagName("span")||[]).reverse();e.isEditorTagOutside&&o.forEach(s=>{s.style[e.stylePropretyName]=e.rgbToHex(s.style[e.stylePropretyName]),e.getInnerText(s)===e.selectedText&&e.canselExecCommand&&(e.setCustomColor(s,e.stylePropretyName,e.currentSettings.value),t.range.selectNode(s),e.addNewRange(t.range))});const i=t.parentWrapper||t.parentNode;e.currentStyle==="color"&&i&&(HZ(i,e.rgbToHex,e.outerContextColor||e.tempColor),IZ(i,e.rgbToHex)),i&&e.cleanEmptySpans(e.selectedText,i)}function GZ(e){const t=e.parentElement;if(!t)return!1;let n=e,r=t;for(;r;){const o=r.tagName;if(o==="TD"||o==="TH")return r.childElementCount!==1||r.firstElementChild!==n?!1:!Array.from(r.childNodes).some(i=>i.nodeType===Node.TEXT_NODE&&i.textContent?.trim()!=="");if(o==="SPAN"||o==="EDITOR"){if(r.childElementCount!==1||r.firstElementChild!==n||Array.from(r.childNodes).some(i=>i.nodeType===Node.TEXT_NODE&&i.textContent?.trim()!==""))return!1;n=r,r=r.parentElement;continue}return!1}return!1}function YA(e,t){const n=e.style.color?.trim();if(!n)return null;const r=Zn(n),o=Zn(t??"");return!r||r===o?null:n}function XZ(e){if(e.currentSettings.name!=="textLink")return;const{mutableState:t}=e;let n=t.parentNode.closest('a[href=" "]')||t.parentNode.querySelector('a[href=" "]')||e.parentElement?.querySelector('a[href=" "]')||null;if(e.isEditorTagOutside||(n=e.findOutermostParentWithText(e.activeElement,"a")),e.currentSettings.value){const r=e.findOutermostParentWithText(e.activeElement,"a")||e.findOutermostParentWithText(t.parentNode,"a")||e.findOutermostParentWithText(t.parentWrapper,"a");if(!(n||r))return;const o=e.commonStyles?.links?.underline===void 0||e.commonStyles?.links?.underline?"underline":"none";n||(n=r);const i=e.findOutermostParentWithText(n);if(i&&i!==n&&i!==t.parentWrapper&&["b","strong","a","em","i","s","strike","u","br","span"].includes(i?.tagName.toLowerCase())){const s=n.cloneNode(!1),a=je(n),l=n?.parentNode;l&&(Le(l,a),rn(l)),s.appendChild(i.cloneNode(!0)),i.parentNode&&i.parentNode.replaceChild(s,i),n=s,t.range.selectNode(n),e.addNewRange(t.range)}if(n){n.setAttribute("target","_blank"),n.setAttribute("href","");const s=e.commonStyles?.links?.color||n.closest('[style*="color"]')?.style?.color||"";n.setAttribute("style",`color: ${s}; text-decoration: ${o};`),n.setAttribute("new","true"),e.refreshElementSettings(n,e.selectedText)}}else if(n=t.parentNode.closest("a")||t.parentNode.querySelector('a[em-edit="active"]')||e.findOutermostParentWithText(e.activeElement,"a"),n)if(n.style.fontFamily||n.style.fontSize){const r=GZ(n)?"div":"span",o=document.createElement(r);if(Vt(o,n),Array.from(n.attributes).forEach(s=>{s.name!=="href"&&s.name!=="target"&&s.name!=="color"&&o.setAttribute(s.name,s.value)}),!o.style.lineHeight){const s=n.closest('[style*="line-height"]');s?.style.lineHeight&&(o.style.lineHeight=s.style.lineHeight)}o.style.textDecoration="";const i=YA(n,e.commonStyles?.links?.color);if(i?o.style.color=i:o.style.color="",n.parentNode?.replaceChild(o,n),r==="div"){let s=o.parentElement;for(;s&&s.tagName!=="TD"&&s.tagName!=="TH";){const a=s.parentElement;if(!a)break;a.replaceChild(o,s),s=o.parentElement}}e.cleanEmptySpansWithParent(e.selectedText,o),e.refreshElementSettings(o,e.selectedText),t.range.selectNodeContents(o),e.addNewRange(t.range)}else{const r=YA(n,e.commonStyles?.links?.color);if(r){const o=document.createElement("span");for(o.style.color=r;n.firstChild;)o.appendChild(n.firstChild);n.parentNode?.replaceChild(o,n),t.range=document.createRange(),t.range.selectNodeContents(o)}else{const o=Array.from(n.childNodes);o.forEach(i=>{n.parentNode?.insertBefore(i,n)}),n.parentNode?.removeChild(n),t.range=document.createRange(),t.range.setStartBefore(o[0]),t.range.setEndAfter(o[o.length-1])}if(e.addNewRange(t.range),t.range.cloneContents()){t.range=t.selection.getRangeAt(0);const o=t.range.commonAncestorContainer,i=o.nodeType===1?o:o.parentElement,s=t.range.firstElementChild?t.range.firstElementChild:t.range.parentElement||i;s&&e.refreshElementSettings(s,e.selectedText)}}}var pg='[class*="em-mob-font_size"]',KZ=`${pg}, [style*="font-size"]`,YZ="a, div, p, td, h1, h2, h3, h4, h5, h6, li, ul, ol, sup, sub",ZZ=new Set(["SPAN","STRONG","B","EM","I","U","S","STRIKE","FONT","SUP","SUB","A"]);function QZ(e,t,n){const{classNamePrefix:r,value:o}=t.mobileFontSize,i=o!=null?`${r}${o}px`:null,s=e.closest(YZ)||e;s.querySelectorAll(".em-element-path").forEach(d=>d.remove());const a=JZ(s,i!==null);if(!a||Ie(s)===Je()){n({settings:t,elem:s.closest("editor")?s:s.closest(KZ)||s}),gg(s,r,i);return}const l=eQ(s,a);if(i===null){(l?[l]:Array.from(s.querySelectorAll(pg)).filter(d=>a.intersectsNode(d))).forEach(d=>{gg(d,r,null),ZA(d,r)});return}const c=l||eS(a,a.extractContents(),"span");if(!c)return;tQ(c),n({settings:t,elem:c}),gg(c,r,i);const u=document.createRange();u.selectNodeContents(c),ri(u)}function JZ(e,t){const n=window.getSelection();if(!n?.rangeCount)return null;const r=n.getRangeAt(0);if(!e.contains(r.commonAncestorContainer))return null;if(!r.collapsed)return r;if(!t){const i=(r.startContainer.nodeType===Node.ELEMENT_NODE?r.startContainer:r.startContainer.parentElement)?.closest(pg);if(!i||i===e||!e.contains(i))return null;const s=document.createRange();return s.selectNodeContents(i),ri(s),s}xZ(n,ri);const o=n.rangeCount?n.getRangeAt(0):null;return o&&!o.collapsed?o:null}function eQ(e,t){const n=Je(),r=t.commonAncestorContainer;let o=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement,i=null;for(;o&&o!==e&&o.tagName!=="EDITOR"&&e.contains(o)&&Ie(o)===n;)i=o,o=o.parentElement;return i}function gg(e,t,n){e.querySelectorAll("*").forEach(r=>{n&&r.style.fontSize?(Hc(r,t),r.classList.add(n)):r.getAttribute("class")?.includes(t)&&ZA(r,t)})}function ZA(e,t){Hc(e,t),e.classList.length||e.removeAttribute("class");const n=e.parentNode;if(!(e.tagName!=="SPAN"||e.attributes.length||!n)){for(;e.firstChild;)n.insertBefore(e.firstChild,e);e.remove()}}function tQ(e){[e.previousSibling,e.nextSibling].forEach(t=>{if(!t||t.textContent!=="")return;if(t.nodeType===Node.TEXT_NODE){t.remove();return}const n=t,r=n.tagName==="A"&&(n.hasAttribute("name")||n.hasAttribute("id"));ZZ.has(n.tagName)&&!r&&!n.querySelector("img, br, hr, table, video, iframe")&&n.remove()})}function nQ(e,t){let n=!1;const{activeElement:r}=t;if(typeof e.linkHref=="string"&&oQ(e.linkHref,t),t.textStyleProperties.some(o=>e.hasOwnProperty(o)))try{t.toggleTextStyle(r,{settings:e})}catch{}if(e.mobileFontSize&&(QZ(r,e,t.setElementMobileFontSize),n=!0),e.mobileLineHeight){const o=r.closest('[class*="em-mob-line_height"]')||r.closest('[style*="line-height"]');t.setElementMobileLineHeight({settings:e,elem:o}),n=!0}return e.textAlign!==void 0&&iQ(e.textAlign,r),e.mobileTextAlign&&(sQ(e,r,t),n=!0),(typeof e.textSuperscript=="boolean"||typeof e.textSubscript=="boolean")&&t.handleTextScriptSettings(e,{unwrapNestedTags:t.unwrapNestedTags,wrapInTag:t.wrapInTag,unwrapTag:t.unwrapTag,isRangeMatching:t.isRangeMatching,splitWrapper:t.splitWrapper,cleanEmptyTags:t.cleanEmptyTags,applicationElementSettingsSet:t.applicationElementSettingsSet,commit:t.commit}),e.textAnchor!==void 0&&t.handleTextAnchor(e.textAnchor,{activeElement:r,commit:t.commit}),e.textReplacer!==void 0&&t.handleTextReplacer(e.textReplacer,{activeElement:r,compareStrings:t.compareStrings}),(e.hasOwnProperty("listUL")||e.hasOwnProperty("listOL"))&&rQ(e,r),t.isElementList&&lQ(e,t),n}function rQ(e,t){const n=sK.includes(t.tagName)?t:t.closest(aK);if(!n)return;const r=e.listOL!==void 0;(r?e.listOL:e.listUL)?bK(n,r):SK(n)}function oQ(e,t){let n=document.querySelector("[em-edit]");if(!n)return;let r=n.tagName==="A"?n:n.closest("a"),o=n.closest(".alignment")||n.closest(".button_block")||n.closest("td");if(o||(o=n.closest("div, p, td, h1, h2, h3, h4, h5, h6, li, ul, ol, a, sup, sub"),o||(o=document.querySelector("td")?.closest("div, p, td")||null)),!r&&o&&(r=o.querySelector("a")),r&&(r.setAttribute("href",e),Pa(e)&&r.removeAttribute("target")),o){const i=t.collectVMLContent(o);if(i){const s=document.createElement("div");s.innerHTML=i;const a=s.querySelector("v\\:roundrect"),l=s.querySelector("a");(a||l)&&(a&&a.setAttribute("href",e),l&&l.setAttribute("href",e),t.updateVMLComments(o,s.innerHTML))}}}function iQ(e,t){const n=ka(t);n&&(e?n.style.textAlign?n.style.textAlign=e:n.setAttribute("align",e):n.style.textAlign?n.style.removeProperty("text-align"):n.removeAttribute("align"))}function sQ(e,t,n){const r=ka(t);if(!r)return;const o=e.mobileTextAlign?.classNamePrefix||"em-mob-text_align-";wG(t,r,o),n.setElementMobileAlign({settings:e,elem:r,fieldName:"mobileTextAlign"})}function aQ(e,t){const n=c=>c in e,{SpacingBetweenParagraphs:r,SpacingBetweenBulletsAndText:o,BulletType:i}=e,{ColorBullets:s,BulletsSize:a,BulletsFontFamily:l=null}=e;return[!!r&&(c=>t.updateTableStyle(c,"padding-bottom",r)),!!o&&(c=>t.updateTableStyle(c,"padding-left",o)),!!i&&(c=>t.changeBullets(c,i)),!!s&&(c=>t.changeBulletsColor(c,s)),!!a&&(c=>t.changeBulletsSize(c,a)),n("BulletTextItalic")&&(c=>t.changeBulletsItalic(c,!!e.BulletTextItalic)),n("BulletTextStrong")&&(c=>t.changeBulletsWeight(c,!!e.BulletTextStrong)),n("BulletTextStrikethrough")&&(c=>t.changeBulletsStrikethrough(c,!!e.BulletTextStrikethrough)),n("BulletTextUnderline")&&(c=>t.changeBulletsUnderline(c,!!e.BulletTextUnderline)),n("BulletsFontFamily")&&t.isElementListOL&&(c=>cQ(l,c,t))].filter(c=>!!c)}function lQ(e,t){const{activeElement:n,classNameOl:r,classNameUl:o}=t,i=n.closest(`table.${r}`)||n.closest(`table.${o}`);if(!i)return;const s=aQ(e,t);if(s.length){const l=t.removeEditorTags(Wl(i));Ra(i,s.reduce((c,u)=>u(c),l))}let a=t.findElementWithSelectedText(n.textContent||"",i);a===null&&(a=i),a.hasAttribute("em-edit")||a.setAttribute("em-edit","active"),t.commit()}function cQ(e,t,n){const r=document.createElement("div");Le(r,t);const o=r.querySelector("table.em-element-list-ol");return o?(o.querySelectorAll("tr").forEach(i=>{const s=i.querySelector("td:first-child > div");s&&(e?e[0]==="Safe Fonts"?(s.style.fontFamily=e[1],n.removeClassesByPrefix(s,"em-font"),n.clearLinkTags({elem:document.documentElement})):e[0]==="Google Fonts"&&(e[1]==="Sans Serif"?s.style.fontFamily="Helvetica, Arial, sans-serif":e[1]==="Serif"?s.style.fontFamily='"Times New Roman", Times, serif':e[1]==="Project Fonts"&&du(s,e[2]),n.removeClassesByPrefix(s,"em-font"),s.classList.add(n.createFontClassName(e)),lp(s,e),n.addFontFamilyClass({fontFamilyArray:e})):s.style.removeProperty("font-family"))}),Ke(r)):t}var Vu=null;function QA(e){Vu=e}function JA(){return Vu}function yr(){Vu=null}function uQ(){return Vu?.kind==="atom"}function bg(e,t,n,r){xs(e,t,o=>{const i=document.createElement("table");i.replaceChildren(...o),[...i.querySelectorAll(":scope > tr")].reverse().forEach(s=>n.insertAdjacentElement(r,s))})}function ek(e,t){e.replaceChildren(...t),e.querySelectorAll('tr[em="block"]').forEach(n=>n.removeAttribute("em"))}function yg(e,t,n,r,o){xs(e,n,i=>{ek(t,i),r.insertAdjacentElement(o,t)})}var dQ=["em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"],fQ=["em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top"],mQ=["em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"];function tk(){document.querySelectorAll(".em-block-insert").forEach(e=>{e.classList.remove(...dQ)})}function hQ(){document.querySelectorAll(".em-atom-insert").forEach(e=>{e.classList.remove(...fQ)})}function Gu(){document.querySelectorAll(".em-blockatom-insert").forEach(e=>{e.classList.remove(...mQ)})}function vg(e,t){const n=e.getBoundingClientRect();return t>n.top+n.height/2?"bottom":"top"}function nk(e,t){const n=e.getBoundingClientRect(),r=document.body.getBoundingClientRect();return t==="bottom"?n.bottom>r.height-21:n.top<2}function Eg(e,t,n){const r=n==="atom"?"em-atom-insert":"em-block-insert",o=n==="blockatom"?"em-blockatom-insert":r;if(e.classList.add(o),t==="bottom"){e.classList.remove(`${r}_top`,`${r}_top-document`);const i=nk(e,"bottom")?`${r}_bottom-document`:`${r}_bottom`;e.classList.add(i)}else{e.classList.remove(`${r}_bottom`,`${r}_bottom-document`);const i=nk(e,"top")?`${r}_top-document`:`${r}_top`;e.classList.add(i)}}function Xu(e){return e.tagName==="TABLE"||e.tagName==="TR"?e.querySelector("[data-template-content]")??e.querySelector("td"):e}function rk(e){if(!e?.length)return null;for(let t=0;t<e.length;t++){const n=e.item(t);if(n?.type.startsWith("image/"))return n}return null}function pQ(e){if(!e?.items?.length)return null;for(let t=0;t<e.items.length;t++){const n=e.items[t];if(n.kind!=="file")continue;const r=n.getAsFile();if(r&&r.type.startsWith("image/"))return r}return null}function gQ(e){const t=rk(e.dataTransfer?.files??null);return t||pQ(e.dataTransfer??null)}function Sg(e){const t=document.body?.parentElement??document.body;if(!t)return null;const n=document.elementFromPoint(e.clientX,e.clientY);if(!n)return null;const r=n.closest(".em-element-resize-img-container");if(r){const i=r.querySelector("img");if(i&&t.contains(i))return i}const o=n.closest("img");return!o||!t.contains(o)?null:o}function Da(e){const t=e.dataTransfer?.types;return!!t&&Array.from(t).includes("Files")}function wg(e){if(!Da(e))return!1;const t=e.dataTransfer;if(!t)return!1;if(t.files?.length)return!!rk(t.files);const n=t.items;if(!n?.length)return!0;for(let r=0;r<n.length;r++){const o=n[r];if(o.kind!=="file")continue;const i=o.type||"";if(i.startsWith("image/")||i==="")return!0}return!1}var ok="em-native-img-drop-target",_g="em-native-img-uploading",bQ="em-native-img-drop-loading",Ku="em-native-file-drag",Ba=null,ko=null;function ik(){ko&&(window.removeEventListener("scroll",ko.reposition,!0),window.removeEventListener("resize",ko.reposition),ko.resizeObserver?.disconnect(),ko.overlay.remove(),ko=null)}function yQ(e){ik();const t=document.createElement("div");t.className="em-native-img-upload-spin-overlay",t.setAttribute("aria-hidden","true");const n=document.createElement("div");n.className="em-native-img-upload-spin",t.appendChild(n),document.body.appendChild(t);const r=()=>{const i=e.getBoundingClientRect();t.style.left=`${Math.round(i.left)}px`,t.style.top=`${Math.round(i.top)}px`,t.style.width=`${Math.max(Math.round(i.width),1)}px`,t.style.height=`${Math.max(Math.round(i.height),1)}px`};r(),window.addEventListener("scroll",r,!0),window.addEventListener("resize",r);let o=null;typeof ResizeObserver<"u"&&(o=new ResizeObserver(()=>r()),o.observe(e)),ko={overlay:t,reposition:r,resizeObserver:o}}function Cg(){Ba&&(Ba.classList.remove(ok),Ba=null)}function Lo(){He(document.body,!1,Ku),Cg()}function vQ(e){if(!Da(e)){Lo();return}if(!wg(e)){Lo();return}He(document.body,!0,Ku);const t=Sg(e);if(!t){Cg();return}Ba!==t&&(Cg(),Ba=t,t.classList.add(ok))}function sk(){ik(),He(document.body,!1,bQ,Ku),document.querySelectorAll(`.${_g}`).forEach(e=>{e.classList.remove(_g)})}function EQ(e,t){if(t.lockEditor||!Da(e))return!1;const n=gQ(e);if(!n)return!1;const r=Sg(e);return r?(t.applicationElementSettingsSet({elem:r}),Lo(),r.classList.add(_g),yQ(r),t.messageService.send({operation:ue.APPLICATION_NATIVE_IMAGE_DROP,file:n}),!0):!1}function SQ(e,t){if(t.lockEditor)return;document.body.classList.contains("em-block-insert-body")||t.messageService.send({operation:"application_scroll-block-show"});const n=e.target;n.getAttribute("em")==="atom"&&(He(document.body,!0,"em-atom-insert-body-inside"),t.commit(!1),t.mutableState.atomReplaced=n)}function wQ(e,t){t.lockEditor||(Lo(),e.preventDefault(),t.messageService.send({operation:"application_scroll-block-hide"}))}function _Q(e,t){if(e.preventDefault(),t.lockEditor){Lo();return}Da(e)?(wg(e)&&Sg(e)&&(e.dataTransfer.dropEffect="copy"),vQ(e)):Lo();const n=e.target;if(document.body.classList.contains("em-block-insert-body")){const r=cn(n)?null:n.closest('[em="block"]');if(r){t.mutableState.targetBlock=r;const o=Xu(r);o&&Eg(o,vg(o,e.pageY),"block")}else tk()}else if(document.body.classList.contains("em-atom-insert-body")){const r=n.closest('[em="atom"]');if(r&&r.innerHTML.trim())t.mutableState.targetBlock=r,Eg(r,vg(r,e.pageY),"atom"),Gu();else if(n.closest('[em="block"]')&&n.tagName==="TD"&&!n.innerHTML&&!n.hasAttribute("height")||n.tagName==="DIV"&&n.closest("amp-accordion")&&!n.innerHTML)Gu();else{const o=n.closest('[em="block"]');if(o){t.mutableState.targetBlock=o;const i=Xu(o);i&&(Eg(i,vg(i,e.pageY),"blockatom"),hQ())}}}}function CQ(e,t){if(t.lockEditor)return;Da(e)&&wg(e)&&He(document.body,!0,Ku);const n=e.target;if(document.body.classList.contains("em-block-insert-body")){document.querySelectorAll(".em-block-insert-empty").forEach(o=>{o.classList.remove("em-block-insert-empty")});const r=n.closest('[em="block"]');cn(n)?(n.classList.add("em-block-insert-empty"),tk()):r&&(t.mutableState.targetBlock=r)}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 r=n.closest('[em="atom"]');r&&r.innerHTML.trim()?(t.mutableState.targetBlock=r,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")})):n.closest('[em="block"]')&&n.tagName==="TD"&&!n.innerHTML&&!n.hasAttribute("height")&&(t.requireEvenEmptyCell===!1||n.parentElement&&[...n.parentElement.children].indexOf(n)%2===0)||n.tagName==="DIV"&&n.closest("amp-accordion")&&!n.innerHTML?(n.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 o=n.closest('[em="block"]');cn(n)?(n.classList.add("em-block-insert-empty"),Gu()):o?t.mutableState.targetBlock=o:Gu()}}var TQ=["em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top"];function AQ(e){return e.clientX<=0||e.clientY<=0||e.clientX>=window.innerWidth||e.clientY>=window.innerHeight}function kQ(e,t){if(t.lockEditor)return;const n=e.target;if(document.body.classList.contains("em-block-insert-body")){if(AQ(e)){document.querySelectorAll(".em-block-insert").forEach(i=>i.classList.remove(...TQ)),t.mutableState.newTargetblock=null,t.mutableState.targetBlock=null;return}const r=e.relatedTarget,o=n.closest('[em="block"]');if(r&&o&&o.contains(r))return;t.mutableState.newTargetblock=n.closest('[em="block"]'),t.mutableState.newTargetblock&&(n.closest('[em="block"]')&&(t.mutableState.newTargetblock!==t.mutableState.targetBlock||t.mutableState.newTargetblock.closest('[em="group"]')!==t.mutableState.targetBlock?.closest('[em="group"]'))?t.mutableState.newTargetblock.tagName==="DIV"?t.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"):t.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 r=e.relatedTarget,o=n.closest('[em="atom"]');if(r&&o&&o.contains(r))return;const i=n.closest('[em="block"]');if(r&&i&&i.contains(r))return;t.mutableState.newTargetblock=n.closest('[em="atom"]'),t.mutableState.newTargetblock&&(n.getAttribute("em")==="atom"&&t.mutableState.newTargetblock!==t.mutableState.targetBlock?t.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(a=>{a.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 s=n.closest('[em="block"]');s&&(n.closest('[em="block"]')&&(s!==t.mutableState.targetBlock||s.closest('[em="group"]')!==t.mutableState.targetBlock?.closest('[em="group"]'))?s.tagName==="DIV"?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"):s.querySelectorAll(".em-blockatom-insert").forEach(a=>{a.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(a=>{a.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 LQ(e,t,n){if(!e)return;let r=document.head.querySelector('style[em="styles"]'),o="";r?o=n.HTMLDocument.getInnerHtml(r):(r=document.createElement("style"),r.setAttribute("em","styles"),r=document.head.insertAdjacentElement("beforeend",r));const i=document.createElement("div");t&&(e=e.replace(/(max-device-width:|max-width:)\d+px/g,a=>a.replace(/\d+/,String(t)))),i.insertAdjacentHTML("afterbegin",e);let s=n.minify(o+`
|
|
104
|
+
`+[...i.querySelectorAll("style")].map(a=>a.innerHTML).join(`
|
|
105
|
+
`),{restructure:!0,forceMediaMerge:!0}).css;s=n.cssbeautify(s,{indent:" ",autosemicolon:!0}),r&&(r.textContent=`
|
|
106
|
+
`+s+`
|
|
107
|
+
`)}function NQ(e){for(const t of e.reverse())document.head?.prepend(t),document.head?.insertAdjacentHTML("afterbegin",`
|
|
108
|
+
`)}function xQ(e){return e.classList.contains("em-block-insert_bottom-document")||e.classList.contains("em-block-insert_bottom")?"afterend":e.classList.contains("em-block-insert_top-document")||e.classList.contains("em-block-insert_top")?"beforebegin":"afterend"}function ak(){yr(),Lo(),He(document.body,!1,"em-block-insert-body"),document.querySelectorAll(".em-block-insert-empty").forEach(e=>{e.classList.remove("em-block-insert-empty")}),He(document.body,!1,"em-atom-insert-body","em-atom-insert-body-inside"),document.querySelectorAll(".em-atom-insert-empty").forEach(e=>{e.classList.remove("em-atom-insert-empty")}),document.querySelectorAll(".sortable-chosen.sortable-ghost").forEach(e=>{e.classList.remove("sortable-chosen","sortable-ghost")})}function lk(e,t,n){const r=e.target;if(!(n.isTableElement(r)&&cn(r)||(r.tagName==="BODY"?Vp():r.closest('[em="block"]'))))return;const o=ip(n.parseFromString(t.settings.blockHTML||""));let i=o.filter(l=>l.tagName&&l.tagName!=="LINK"&&l.tagName!=="STYLE").map(l=>n.getOuterHtml(l)).join("");const s=o.filter(l=>l.tagName==="STYLE").map(l=>n.getOuterHtml(l)).join(""),a=o.filter(l=>l.tagName==="LINK"&&l.getAttribute("em-class")).filter(l=>!document.head?.querySelector(`link[em-class="${l.getAttribute("em-class")}"]`));if(LQ(s,n.emailWidth,{minify:n.minify,cssbeautify:n.cssbeautify,HTMLDocument:n.HTMLDocument}),NQ(a),t.settings.type!=="project"&&(i=n.commonStylesApplyToBlock({html:i})),i.match(/class="em-countdown"/gi)&&(i=n.uptimeCountdown({blockHTML:i})),n.isTableElement(r)&&cn(r))r.getAttribute("em")==="block"&&r.removeAttribute("em"),(i.indexOf("empty-structure")>-1||i.indexOf("em-structure")>-1)&&(i=n.setBlockMaxWidth({blockHTML:i,targetBlock:r}),i=n.setFloatBlocksWidth({blockHTML:i,targetBlock:r,project:t.settings.project})),i=n.checkBlockAdaptivity({blockHTML:i,blockIsTr:i.substring(0,3)==="<tr"}),i.substring(0,3)==="<tr"?cr("new",br(r),"beforeend",`
|
|
109
|
+
`+i+`
|
|
110
|
+
`):cr("new",br(r),"beforeend",`
|
|
111
|
+
<tr><td align="center">
|
|
112
|
+
`+i+`
|
|
113
|
+
</td></tr>
|
|
114
|
+
`),t.settings&&(n.messageService.send("application_block_inserted",{type:t.settings.type,name:t.settings.name,blockId:t.settings.blockId,project:t.settings.project}),yr());else if(r.tagName==="BODY"){const l=Vp();if(!l)return;const c="afterend";(i.indexOf("empty-structure")>-1||i.indexOf("em-structure")>-1)&&(i=n.setBlockMaxWidth({blockHTML:i,targetBlock:l}),i=n.setFloatBlocksWidth({blockHTML:i,targetBlock:l,project:t.settings.project})),i=n.checkBlockAdaptivity({blockHTML:i,blockIsTr:i.substring(0,3)==="<tr"}),bg("new",`
|
|
115
|
+
`+i+`
|
|
116
|
+
`,l,c),t.settings&&(n.messageService.send("application_block_inserted",{type:t.settings.type,name:t.settings.name,blockId:t.settings.blockId,project:t.settings.project}),yr())}else{const l=r.closest('[em="block"]');if(l){const c=Xu(l),u=c?xQ(c):"afterend";if((i.indexOf("empty-structure")>-1||i.indexOf("em-structure")>-1)&&(i=n.setBlockMaxWidth({blockHTML:i,targetBlock:l}),i=n.setFloatBlocksWidth({blockHTML:i,targetBlock:l,project:t.settings.project})),i=n.checkBlockAdaptivity({blockHTML:i,blockIsTr:i.substring(0,3)==="<tr"}),l.tagName==="TR")i.substring(0,3)==="<tr"?bg("new",`
|
|
117
|
+
`+i+`
|
|
118
|
+
`,l,u):bg("new",`
|
|
119
|
+
<tr em="block"><td align="center">
|
|
120
|
+
`+i+`
|
|
121
|
+
</td></tr>
|
|
122
|
+
`,l,u);else if(i.substring(0,3)==="<tr")if(l.tagName==="TABLE"){const d=document.createElement("table");d.setAttribute("cellspacing","0"),d.setAttribute("cellpadding","0"),d.setAttribute("align","center"),d.setAttribute("border","0"),d.setAttribute("em","block"),d.setAttribute("width",l.hasAttribute("width")?l.getAttribute("width"):String(l.getBoundingClientRect().width)),d.classList.add("em-mob-width-100perc"),yg("new",d,`
|
|
123
|
+
`+i+`
|
|
124
|
+
`,l,u)}else{const d=document.createElement("div");d.setAttribute("align","center"),d.setAttribute("em","block"),yg("new",d,`<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
|
125
|
+
`+i+`
|
|
126
|
+
</table>`,l,u)}else cr("new",l,u,`
|
|
127
|
+
`+i+`
|
|
128
|
+
`);l.querySelectorAll(".em-block-insert").forEach(d=>{d.classList.remove("em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top")}),t.settings&&(n.messageService.send("application_block_inserted",{type:t.settings.type,name:t.settings.name,blockId:t.settings.blockId,project:t.settings.project}),yr())}}}var Tg="em-live-atom";function Yu(e,t){return t?`<${Tg}></${Tg}>`:e}function OQ(e,t){const[n,...r]=document.querySelectorAll(Tg);if(r.forEach(i=>i.remove()),!n||e.contains(n)){n?.remove();return}const o=e.parentElement;Vf(e),n.replaceWith(e),o&&e.parentElement&&t(e,o,e.parentElement)}function ck(e,t=e){return e==='<table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td height="20"></td></tr></table>'?`
|
|
129
|
+
<tr em="block" class="em-structure">
|
|
130
|
+
<td align="center">
|
|
131
|
+
${t}
|
|
132
|
+
</td>
|
|
133
|
+
</tr>`:`
|
|
134
|
+
<style>
|
|
135
|
+
@media only screen and (max-device-width: 660px), only screen and (max-width: 660px) {
|
|
136
|
+
.em-mob-wrap {
|
|
137
|
+
display: block!important;
|
|
138
|
+
}
|
|
139
|
+
.em-mob-width-100perc {
|
|
140
|
+
width: 100%!important;
|
|
141
|
+
max-width: 100%!important;
|
|
142
|
+
}
|
|
143
|
+
.em-mob-padding_right-20 {
|
|
144
|
+
padding-right: 20px!important;
|
|
145
|
+
}
|
|
146
|
+
.em-mob-padding_left-20 {
|
|
147
|
+
padding-left: 20px!important;
|
|
148
|
+
}
|
|
149
|
+
</style>
|
|
150
|
+
<tr em="block" class="em-structure">
|
|
151
|
+
<td align="center" style="padding: 30px 40px;" class="em-mob-padding_left-20 em-mob-padding_right-20">
|
|
152
|
+
<table align="center" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-100perc">
|
|
153
|
+
<tr>
|
|
154
|
+
<td width="600" valign="top" class="em-mob-wrap em-mob-width-100perc">
|
|
155
|
+
${t}
|
|
156
|
+
</td>
|
|
157
|
+
</tr>
|
|
158
|
+
</table>
|
|
159
|
+
</td>
|
|
160
|
+
</tr>`}function RQ(e,t,n,r,o,i,s){t.match(/em="atom"><tr><td>\s*<img/gi)&&!t.match(/class="em-countdown"/gi)&&(t=o.setImageWidth({atomHTML:t,targetAtom:e})),t.match(/class="em-countdown"/gi)?o.insertCountdown({targetElem:e,targetPlace:"beforeend",atomHTML:t}):cr(i,e,"beforeend",`
|
|
161
|
+
`+Yu(t,s)+`
|
|
162
|
+
`),n!=null&&!s&&(e.closest(".empty-structure")||e.closest(".em-structure"))&&n.remove(),r.settings?.name&&(o.messageService.send("application_atom_inserted",r.settings.name),yr())}function MQ(e,t,n,r,o,i,s){const a=e.target,l=!!document.querySelector(".em-blockatom-insert"),c=l?a.closest('[em="block"]'):a,u=l?document.querySelector(".em-blockatom-insert"):document.querySelector(".em-block-insert-empty");t.match(/em="atom"><tr><td>\s*<img/gi)&&(t=r.setImageWidth({atomHTML:t,targetAtom:u}));let d=ck(t,Yu(t,s));t!=='<table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td height="20"></td></tr></table>'&&o(d.match(/<style((.|\n|\r)*?)<\/style>/g)),n.settings?.type!=="project"&&(d=r.commonStylesApplyToBlock({html:d}));let f=null;c.tagName==="TABLE"||c.tagName==="TR"?f=c.querySelector("[data-template-content]")??c.querySelector("td"):f=c,(d.indexOf("empty-structure")>-1||d.indexOf("em-structure")>-1)&&(d=r.setFloatBlocksWidth({blockHTML:d,targetBlock:c,project:n.settings?.project}),d=r.fitImagesToColumns(d));let h="beforeend";l&&f&&(f.classList.contains("em-block-insert_bottom-document")||f.classList.contains("em-block-insert_bottom")?h="afterend":(f.classList.contains("em-block-insert_top-document")||f.classList.contains("em-block-insert_top"))&&(h="beforebegin"));const m=!!t.match(/class="em-countdown"/gi),p=d.substring(0,3)==="<tr";if(c.tagName==="TR")if(p)if(m)r.insertCountdown({targetElem:c,targetPlace:h,atomHTML:d});else{const S=document.createElement("tr");S.setAttribute("em","block"),S.classList.add("em-structure"),xs(i,`
|
|
163
|
+
`+d+`
|
|
164
|
+
`,C=>{S.replaceChildren(...C.flatMap(L=>L instanceof Element&&L.tagName==="TR"?Array.from(L.childNodes):[L])),c.insertAdjacentElement(h,S)})}else if(m)r.insertCountdown({targetElem:c,targetPlace:h,atomHTML:`<tr em="block"><td align="center">
|
|
165
|
+
`+d+`
|
|
166
|
+
</td></tr>`});else{const S=document.createElement("tr");S.setAttribute("em","block"),xs(i,`
|
|
167
|
+
<td align="center">
|
|
168
|
+
`+d+`
|
|
169
|
+
</td>
|
|
170
|
+
`,C=>{S.replaceChildren(...C),c.insertAdjacentElement(h,S)})}else if(p)if(c.tagName==="TABLE")if(cn(a))m?r.insertCountdown({targetElem:h==="beforeend"?br(c):c,targetPlace:h,atomHTML:d}):cr(i,h==="beforeend"?br(c):c,h,d);else{const S=document.createElement("table");S.setAttribute("cellspacing","0"),S.setAttribute("cellpadding","0"),S.setAttribute("align","center"),S.setAttribute("border","0"),S.setAttribute("em","block"),S.setAttribute("width",c.hasAttribute("width")?c.getAttribute("width"):String(c.getBoundingClientRect().width)),S.classList.add("em-mob-width-100perc"),m?(ek(S,Ne(`
|
|
171
|
+
`+d+`
|
|
172
|
+
`,!0)),r.insertCountdown({targetElem:c,targetPlace:h,atomHTML:r.getOuterHtml(S)})):yg(i,S,`
|
|
173
|
+
`+d+`
|
|
174
|
+
`,c,h)}else m?r.insertCountdown({targetElem:c,targetPlace:h,atomHTML:`<div align="center"><table cellpadding="0" cellspacing="0" border="0" align="center" class="em-mob-width-100perc">
|
|
175
|
+
`+d+`
|
|
176
|
+
</table></div>`}):cr(i,c,h,`
|
|
177
|
+
<div align="center"><table cellpadding="0" cellspacing="0" border="0" align="center" class="em-mob-width-100perc">
|
|
178
|
+
`+d+`
|
|
179
|
+
</table></div>
|
|
180
|
+
`);else m?r.insertCountdown({targetElem:c,targetPlace:h,atomHTML:d}):cr(i,c,h,`
|
|
181
|
+
`+d+`
|
|
182
|
+
`);document.querySelectorAll(".em-blockatom-insert").forEach(S=>{S.classList.remove("em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top")}),n.settings?.name&&(r.messageService.send("application_atom_inserted",n.settings.name),yr())}function PQ(e,t,n,r,o){const i=document.querySelector(".em-atom-insert");if(e.match(/em="atom"><tr><td>\s*<img/gi)&&i&&(e=n.setImageWidth({atomHTML:e,targetAtom:i})),!i)return;let s="afterend";i.classList.contains("em-atom-insert_bottom-document")||i.classList.contains("em-atom-insert_bottom")?s="afterend":(i.classList.contains("em-atom-insert_top-document")||i.classList.contains("em-atom-insert_top"))&&(s="beforebegin");const a=!!e.match(/class="em-countdown"/gi);if(i.tagName==="TR"){const l=document.createElement("div");qb(l,e);const c=l.querySelector('[em="atom"]');c&&c.removeAttribute("em");let u=0;const d=i.querySelector("[colspan]");d?u=d.getAttribute("colspan")||0:u=i.childElementCount,o?.removeAttribute("em");const f=o?Yu(e,o):Nt(l),h=`
|
|
183
|
+
<tr em="atom"><td colspan="`+u+`">
|
|
184
|
+
`+f+`
|
|
185
|
+
</td></tr>
|
|
186
|
+
`;a?n.insertCountdown({targetElem:i,targetPlace:s,atomHTML:h}):cr(r,i,s,h)}else a?n.insertCountdown({targetElem:i,targetPlace:s,atomHTML:e}):cr(r,i,s,`
|
|
187
|
+
`+Yu(e,o)+`
|
|
188
|
+
`);i.classList.remove("em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top"),t.settings?.name&&(n.messageService.send("application_atom_inserted",t.settings.name),yr())}function uk(e,t){const n=t.mutableState.atomReplaced,r=e.dataTransfer?.getData("Text")||"",o=r&&t.isJsonString(r)?"new":"moved",i=o==="new"?JSON.parse(r):{settings:{atomHTML:n?Ns(n):""}},s=o==="moved"?i.settings.atomHTML:"",a=n&&s&&!s.match(/class="em-countdown"/gi)?n:null;try{IQ(e,t,o,i,a)}finally{a&&OQ(a,t.fitMovedImage)}}function IQ(e,t,n,r,o){const i=t.mutableState.atomReplaced,s=e.target,a=m=>t._setDocumentStyles(m,{minify:t.minify,cssbeautify:t.cssbeautify,HTMLDocument:t.HTMLDocument});if(!r.settings?.atomHTML)return;const l=s.closest('[em="block"]')&&s.tagName==="TD"&&!s.innerHTML&&!s.hasAttribute("height")&&(s.classList.contains("em-atom-insert-empty")||uQ()),c=s.tagName==="DIV"&&s.closest("amp-accordion")&&!s.innerHTML,u=l||c,d=!!document.querySelector(".em-blockatom-insert")||cn(s),f=s.closest('[em="atom"]');if(!u&&!d&&!f)return;let h=r.settings.atomHTML.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();if(o||a(r.settings.atomHTML.match(/<style((.|\n|\r)*?)<\/style>/g)),h=t.commonStylesApply({html:h}),u){RQ(s,h,i,r,t,n,o);return}if(d){MQ(e,h,r,t,a,n,o);return}PQ(h,r,t,n,o)}var DQ=/^[\t\n\f\r ]*$/;function BQ(e,t){const n=[...e.childNodes],r=n.every(o=>o===t||o.nodeType===Node.TEXT_NODE&&DQ.test(o.textContent??""));e.replaceWith(...r?[t]:n)}function HQ(e,t){let n=!1;const{activeElement:r}=t;if(e.link!==void 0){const o=t.getActiveEditElement();if(!o)return n;if(e.link!==""){const i=o.closest("a");if(i)i.setAttribute("href",e.link);else{const s=document.createElement("a");s.setAttribute("href",e.link),s.setAttribute("target","_blank"),o.parentNode?.insertBefore(s,o),s.appendChild(o),t.setCursorPosition(s)}}else{const i=o.closest("a");i&&(BQ(i,o),t.setCursorPosition(o))}}if(e.src!==void 0&&Wy(r)&&Ht(r,"src",e.src??""),e.src!==void 0&&sk(),e.alt!==void 0&&r.setAttribute("alt",e.alt),e.title?r.setAttribute("title",e.title):e.title===""&&r.removeAttribute("title"),e.border&&t.setElementBorder({settings:e,elem:r}),e.boxShadow&&t.setElementBoxShadow({settings:e,elem:r}),e.align&&e.align!=="undefined"?r.closest("div, p, td")?.setAttribute("align",e.align):e.align===""&&r.closest("div, p, td")?.removeAttribute("align"),e.valign?r.style.verticalAlign=e.valign:e.valign===""&&r.style.removeProperty("vertical-align"),e.width&&(e.width.value!==void 0&&e.width.value!==null?(r.setAttribute("width",e.width.value+(e.width.dim==="px"?"":"%")),r.style.width="100%",r.style.maxWidth=e.width.value+e.width.dim):(r.setAttribute("width","0"),r.style.width="100%",r.style.maxWidth="0")),e.height&&(e.height.value!==void 0&&e.height.value!==null?(r.setAttribute("height",e.height.value+(e.height.dim==="px"?"":"%")),r.style.height=e.height.value+e.height.dim):(r.removeAttribute("height"),r.style.removeProperty("height"))),e.borderRadius&&t.setElementBorderRadius({settings:e,elem:r}),e.mobileWidth&&(t.setElementMobileWidth({settings:e,elem:r}),n=!0),e.mobileHeight&&(t.setElementMobileHeight({settings:e,elem:r}),n=!0),e.mobileBorder&&(t.setElementMobileBorder({settings:e,elem:r}),n=!0),e.mobileBorderRadius&&(t.setElementMobileBorderRadius({settings:e,elem:r}),n=!0),e.mobileBoxShadow&&(t.setElementMobileBoxShadow({settings:e,elem:r}),n=!0),e.mobileAlign){const o=r.closest("div, p, td");o&&t.setElementMobileAlign({settings:e,elem:o}),n=!0,e.mobileAlign.value?r.style.display="inline-block":r.style.display="block"}if(e.mobileVerticalAlign&&(t.setElementMobileVerticalAlign({settings:e,elem:r}),n=!0),e.show&&(t.setElementShow({settings:e,elem:r}),n=!0),e.countdown){const o=new Image;o.onload=function(){r.setAttribute("width",String(Math.round(this.width/2))),r.style.maxWidth=Math.round(this.width/2)+"px"};const i=e.countdown?.link??"";o.src=i,Ht(r,"src",i),r.setAttribute("em-cd-settings",e.countdown.params)}if(e.video&&r.setAttribute("em-video-settings",JSON.stringify(e.video)),e.imgReplacer){const o=e.imgReplacer??"",i=r.closest("em-replace");if(i)Ht(i,"src",o);else{const s=document.createElement("em-replace");Ht(s,"src",o),r.parentNode?.insertBefore(s,r),s.appendChild(r)}}else if(e.imgReplacer===""){const o=r.closest("em-replace");o&&(o.parentNode?.insertBefore(r,o),o.remove())}return n}function FQ(e,t){const{activeElement:n,textStyleProperties:r,toggleTextStyle:o}=t;if(e.href!==void 0&&(n.setAttribute("href",e.href),Pa(e.href)&&n.removeAttribute("target")),e.target&&!(e.href&&Pa(e.href))&&n.setAttribute("target",e.target),r.some(i=>e.hasOwnProperty(i)))try{o(n,{settings:e})}catch{}}function $Q(e,t){const{activeElement:n,setElementMobileHeight:r}=t;let o=!1;if(e.height)if(n.tagName==="DIV"){const i=e.height.value+e.height.dim;n.style.height=i,n.style.lineHeight=i,n.style.fontSize=e.height.value>10?parseInt(e.height.value)-2+e.height.dim:"8px"}else n.tagName==="TD"&&n.setAttribute("height",String(e.height.value));return e.mobileHeight&&(r({settings:e,elem:n}),o=!0),o}function WQ(e,t){const{activeElement:n,isVariableText:r}=t,o=n.nextSibling?.nodeType===8?n.nextSibling:null;if(!o||!e.value)return;let i=e.value;i.startsWith("<!--")&&(i=i.substring(4)),i.endsWith("-->")&&(i=i.substring(0,i.length-3)),r(`<!--${i}-->`)?o.nodeValue=i:o.replaceWith(i)}function qQ(e){const t=e.settings.textReplacer;return typeof t=="string"&&t.includes("~~")}var Ha=["textStrong","textItalic","textStrikethrough","textUnderline","textColor","textBackgroundColor","textLink","lineHeight","fontSize","fontFamily"];function zQ(e){const t=u=>{e.commit(u)},n={addFontFamilyClass:u=>wa(u,t),clearLinkTags:u=>{Ao(u,t),Vr(t)}},r={setElementMobileWidth:G_,setElementMobileHeight:wi,setElementMobileBorder:O$,setElementMobileBorderRadius:R$,setElementMobileBoxShadow:M$,setElementMobileAlign:X_,setElementMobileTableAlign:P$,setElementMobileVerticalAlign:Sh,setElementMobileDirection:I$,setElementMobileBackgroundColor:D$,setElementMobileBackgroundImage:B$,setElementMobileBackgroundPositionX:H$,setElementMobileBackgroundPositionY:F$,setElementMobileBackgroundRepeat:$$,setElementMobileBackgroundSize:W$,setElementMobilePadding:na,setElementMobileFontSize:K_,setElementMobileLineHeight:wh,setElementShow:Y_},o={parseTableElementToModel:Mi,tableModelToHtml:J0,updateTablePadding:HV,getCellsWithClasses:kV,clearCellBorders:OV,updateTableCellBackgroundByIds:$V,addClassToCellsByIds:LV,getExternalBorders:RV,updateCellBordersByIds:xV,getExternalCorners:DV,updateCellBorderRadiusByIds:PV,updateCellPaddingByIds:FV,removeOuterBorders:MV},i=e.editLock??Gf,s=u=>({activeElement:u,activeCell:V.get("activeCell"),state:V,...o,wrapEditor:e.wrapEditor,addNewRange:ri,toggleTextStyle:e.toggleTextStyle,textStyleProperties:Ha,isEditLocked:()=>i.isTextLocked(),...r}),a=(u,d)=>{const f=()=>{const m=d??WA();m&&e.selectionLock.lift(()=>e.applicationElementSettingsSet({elem:m}))};let h;try{h=OY(u,s(d))}catch(m){throw f(),m}if(h.status==="applied")return!0;if(h.reason!=="empty"&&f(),h.reason!=="locked")throw new Error(`customTable: refused "${h.key??""}" (${h.reason})`);return!1},l=(u,d)=>{const{settings:f}=u,h=$u(d),m={setElementBorder:up,setElementBoxShadow:E0,setElementBorderRadius:Ri},p={activeElement:d,setPercentsForColumns:ec,setElementMobileHeight:wi};switch(u.type){case"img":case"countdown":case"video":HQ(f,{activeElement:d,getActiveEditElement:Ds,setCursorPosition:e.setCursorPosition,...m,...r});break;case"a":FQ(f,{activeElement:d,textStyleProperties:Ha,toggleTextStyle:e.toggleTextStyle});break;case"table":WY(f,{activeElement:d,...m,...r});break;case"td":case"structure":case"group":case"column":zY(f,{activeElement:d,requestType:u.type,textStyleProperties:Ha,isElementListContainer:RK(d),isProgrammaticSelection:e.programmaticSelection,...m,...r,setContrastBlock:q$,setStructureBlocksWidth:Wu,toggleTextStyle:e.toggleTextStyle,removeEditorTags:Ui,addClassToSecondCell:rK,wrapEditor:e.wrapEditor,addNewRange:ri});break;case"button":BY(f,{activeElement:d,textStyleProperties:Ha,...m,...r,toggleTextStyle:e.toggleTextStyle,compareStrings:dS});break;case"div":$Y(f,{activeElement:d,...m,...r});break;case"vindent":$Q(f,{activeElement:d,setElementMobileHeight:wi});break;case"var":WQ(f,{activeElement:d,isVariableText:a0});break;case"floatBlock":GY(f,{activeElement:d,setElementMobileWidth:G_,setElementMobileContentWidth:x$,setElementMobileVerticalAlign:Sh,setElementShow:Y_});break;case"text":nQ(f,{activeElement:d,textStyleProperties:Ha,toggleTextStyle:e.toggleTextStyle,collectVMLContent:S0,updateVMLComments:w0,removeClassesByPrefix:ba,createFontClassName:sp,...n,handleTextScriptSettings:SZ,handleTextReplacer:wZ,handleTextAnchor:LZ,unwrapNestedTags:ZD,wrapInTag:eS,unwrapTag:QD,isRangeMatching:JD,splitWrapper:e5,cleanEmptyTags:t5,applicationElementSettingsSet:e.applicationElementSettingsSet,compareStrings:dS,setElementMobileFontSize:K_,setElementMobileLineHeight:wh,setElementMobileAlign:X_,updateTableStyle:DX,changeBullets:BX,changeBulletsColor:HX,changeBulletsSize:FX,changeBulletsItalic:WX,changeBulletsWeight:$X,changeBulletsStrikethrough:zX,changeBulletsUnderline:qX,findElementWithSelectedText:Is,removeEditorTags:Ui,isElementList:h.isList,isElementListOL:h.isListOL,classNameOl:h.classNameOl,classNameUl:h.classNameUl,commit:t});break;case"floatBlocksWidths":XY(f,p);break;case"floatBlocksPreset":KY(f,p);break;case"floatBlocksValign":YY(f,p);break;case"floatBlocksGap":ZY(f,p);break;case"floatBlocksGapMobile":QY(f,p);break;case"floatBlocksMobileWidths":JY(f,p);break;case"floatBlocksMobileGap":eZ(f,p);break;case"floatBlocksMobileValign":nZ(f,p);break;case"floatBlocksMobileReset":tZ(f,p);break;case"carousel":uZ(f,{activeElement:d,HTMLDocument:e.htmlDocument,setElementBorderRadius:Ri,commit:t});break;case"accordion":fZ(f,{activeElement:d,HTMLDocument:e.htmlDocument,setElementBorderRadius:Ri,commit:t});break;case"social":{const S=EZ(f,{activeElement:d,commit:t});if(S)return S;break}case"customTable":return a(f,d)?d:null}return d},c=(u,d,f,h)=>{const m=e.selectionLock.acquire(),p=u;let S=u;e.commitLockedAsync().finally(()=>{let C;try{C=IY(S,p,d,f,{getMappedParent:L=>e.htmlDocument.getMappedParent(L)??void 0,getOuterHtml:L=>e.htmlDocument.getOuterHtml(L),applyHidden:L=>e.htmlDocument.applyHidden(L)})}catch(L){throw m.release(),L}if(!C){m.release(),e.setCursorPosition(S),h?.();return}S=C.active,e.commitLockedAsync().finally(()=>{try{C.afterCommit()}finally{m.release()}e.setCursorPosition(S),h?.()})})};return u=>{const d=e.selectionLock.acquire();try{const f=u.data;f.settings=e.getMapObj().escape(f.settings);const h=Ds();if(!h){f.type==="customTable"&&a(f.settings,null)&&e.commitLockedAsync();return}e.beforeApply?.(f,h);const m=PY(h),p=l(f,h);if(!p)return;e.afterApply?.(f,p);const S=qQ(f)?HE():null;try{q_()}catch{}c(p,m,f,S?()=>ND(S,C=>e.htmlDocument.renderOnly(C)):void 0)}catch{}finally{d.releaseLater()}}}var UQ=Bv,jQ=3,Ag=Promise.resolve(),kg={waiting:0},Lg=0;function dk(){return mt()?lt().entityId:void 0}async function VQ(e,t){let n=!1,r=!1;const o=()=>{n||(n=!0,e())},i=(async()=>{t&&await N5(),r=!0,await sI(o)})();let s;const a=new Promise(l=>{s=setTimeout(()=>{r&&mE()||(mE()?n=!0:o(),l())},UQ)});try{await Promise.race([i,a])}catch{o()}finally{clearTimeout(s)}}function fk(e,t){cE(()=>mk(e,t))||mk(e,t)}function mk(e,t){const n=Lg>0||L5();if(!n&&aI()&&(kg={waiting:0}),kg.waiting>=jQ)return;const r=kg;r.waiting++;const o=dk(),i=lI(),s=async()=>{try{await VQ(()=>{dk()===o&&(e.send({operation:ue.APPLICATION_ACTION,action:t,...i!==void 0?{actionId:i}:{}}),i!==void 0&&cI(i))},n)}finally{r.waiting--,n&&Lg--}};n?(Lg++,Ag=Ag.then(s,s)):Ag=s()}function hk(e,t){return!!e&&Array.from(e.querySelectorAll('[em="atom"]')).some(n=>n!==t)}function Zu(e){e.nodeName==="#comment"&&e.textContent?.indexOf("mso")!==-1?e.remove():e.previousSibling&&Zu(e.previousSibling)}function Fa(e){if(!e)return;if(e.parentElement?.tagName==="SECTION"||e.classList.contains("em-narrow-table")&&Array.from(e.childNodes).every(n=>n.nodeType===Node.TEXT_NODE)){e.innerHTML="";return}e.querySelectorAll(".em-element-editor").forEach(n=>n.remove()),e.querySelectorAll(".em-element-path").forEach(n=>n.remove()),e.querySelectorAll(".em-element-block-add").forEach(n=>n.remove()),e.querySelectorAll(".em-vindent-paddingTop, .em-vindent-paddingRight, .em-vindent-paddingBottom, .em-vindent-paddingLeft").forEach(n=>n.remove());const t=e.parentElement;if(e.classList.contains("em-mob-wrap")||e.classList.contains("noresp-em-mob-wrap"))e.innerHTML.trim()===""&&(e.parentElement.querySelectorAll(":scope > .em-mob-wrap, :scope > .noresp-em-mob-wrap").length>1?e.innerHTML="":(e.remove(),Fa(t)));else if(e.innerHTML.trim()==="")Zu(e),e.remove(),Fa(t);else if(t&&!t.querySelector('div[style*="display"]')){for(const n of Array.from(e.childNodes))n.nodeName==="#text"&&n.textContent?.trim()===""?(Zu(n),n.textContent=""):n.nodeName==="#comment"&&n.textContent?.indexOf("mso")!==-1&&(Zu(n),n.remove());e.innerHTML.trim()===""&&Fa(e)}}function pk(e,t){const n=e;if(!n||n.closest("editor")||n.firstElementChild?.tagName==="EDITOR")return!1;const r=t.getElementParent(n);let o=n.parentNode;if(r&&t.setCursorPosition(r),n.classList.contains("em-code")){const i=t.getVariableByIcon(n);i&&(i.parentNode?.removeChild(i),n.remove())}else if(n.tagName==="TD"&&n.innerHTML===""&&n.hasAttribute("height")){const i=n.closest("table");if(i){const s=i.previousSibling;s&&s?.textContent?.trim()===""&&s.remove(),i.remove()}}else if(n.closest(".em-element-resize-img-container"))o=n.closest(".em-element-resize-img-container").parentNode,n.closest(".em-element-resize-img-container").remove();else if(n.closest('[em="atom"]')){const i=n.closest('[em="atom"]');o=i.parentNode;const s=n.closest(".em-mob-wrap, .noresp-em-mob-wrap");n.tagName==="TD"&&!n.previousElementSibling&&!n.nextElementSibling?i.remove():n.remove(),n.tagName!=="TD"&&!hk(s,i)&&s?.textContent?.trim()===""&&(s.textContent="")}else{n.remove();const i=n.previousSibling;i&&i?.textContent?.trim()===""&&i.remove()}return Fa(o),t.commit(),U.send({operation:"application_element_settings_close"}),!0}function GQ(e,t){if(t)return e.keyCode===90?e.shiftKey?"redo":"undo":e.keyCode===89&&!e.shiftKey?"redo":void 0}var XQ={historyUndo:"undo",historyRedo:"redo"};function KQ(e,t){const n=XQ[e.inputType];return!n||!e.target?.closest?.("editor")?!1:(e.preventDefault(),e.stopPropagation(),fk(t.messageService,n),!0)}function YQ(e,t,n,r){if(!((window.navigator.platform.match("Mac")?e.code==="Backspace":e.keyCode===46||e.keyCode===8)&&!t&&n!=="start"&&!e.ctrlKey&&!e.metaKey))return!1;const o=e.target,i=o.tagName==="EDITOR"?o:o.closest("editor");if(i){if(i.querySelectorAll(".em-code")?.length){const u=ht(()=>{const d=r.getAllComments(o);for(const f of d)r.isVariableComment(f)&&(r.getVariableIcon(f)||f.remove());i.removeEventListener("input",u)});i.addEventListener("input",u)}return!0}const s=document.querySelector("[em-edit]");if(!s||s.closest("editor"))return!1;const a=r.getElementParent(s);let l=s.parentNode;const c=s.closest("editor");if(r.setCursorPosition(a),s.classList.contains("em-mob-wrap")){r.removeElementEditors();const u=s.closest("tr");if(u&&[...u.cells].every(d=>!d.textContent?.trim())){const d=s.closest("table");l=d?.parentNode||null,d?.remove()}}else if(s.classList.contains("em-code")){const u=r.getVariableByIcon(s);u&&(u.parentNode?.removeChild(u),s.remove())}else if(s.tagName==="TD"&&s.innerHTML===""&&s.hasAttribute("height")){const u=s.closest("table");if(u){const d=u.previousSibling;d&&d.textContent?.trim()===""&&d.remove(),u.remove()}}else if(s.closest(".em-element-resize-img-container")){const u=s.closest(".em-element-resize-img-container");l=u.parentNode;const d=s.closest("td")?.querySelector("editor");d&&d.innerHTML===""&&d.remove(),u.remove()}else if(s.closest('[em="atom"]')){const u=s.closest('[em="atom"]');l=u.parentNode;const d=s.closest(".em-mob-wrap, .noresp-em-mob-wrap");s.tagName==="TD"&&s.previousElementSibling===null&&s.nextElementSibling===null?u.remove():s.remove(),s.tagName!=="TD"&&d&&!hk(d,u)&&d.textContent?.trim()===""&&(d.textContent="")}else if(s.parentElement?.tagName==="TR"&&s.parentElement.getAttribute("em")==="group"&&document.querySelectorAll('[em="group"]').length===1)s.querySelector(".em-narrow-table")?.replaceChildren();else{s.remove();const u=s.previousSibling;u&&u.textContent?.trim()===""&&u.remove()}return c&&c.remove(),l&&r.removeEmptyParents(l),r.commit(),r.messageService.send({operation:"application_element_settings_close"}),!0}function ZQ(e,t){if(!(e.keyCode===39||e.key==="ArrowRight")||e.shiftKey)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0),o=r.startContainer,i=o.nodeType===Node.TEXT_NODE?o.parentElement:o;if(i?.closest("em-replace"))return!1;const s=xt(i)?i.parentElement:i,a=["strong","em","u","b","i","span","a","sub","sup","strike"];let l=null;const c=s?.closest("editor")??s?.closest('[contenteditable]:not([contenteditable="false"])')??null;for(const m of a){const p=s?.closest(m);if(p&&(!c||p!==c&&c.contains(p))){l=p;break}}if(!l||!t.isCaretAtEndOfStandardElement(r,l))return!1;if(l.tagName==="A"&&xa(l))return e.preventDefault(),!1;e.preventDefault();const u=l.nextSibling;if(u&&u.nodeType===Node.TEXT_NODE&&(u.textContent?.length||0)>0){const m=u.textContent||"";return m[0]===" "||m[0]===" "?(t.setCursorPositionSimple(u,1),!0):(u.textContent=" "+m,t.setCursorPositionSimple(u,1),t.commit(),!0)}const d=l.parentNode;if(!d)return!0;if(u&&u.nodeType===Node.ELEMENT_NODE&&u.tagName==="SPAN"&&u.textContent===" ")return t.setCursorInsideSpan(u),!0;const f=document.createElement("span"),h=document.createTextNode(" ");return f.appendChild(h),u?d.insertBefore(f,u):d.appendChild(f),t.setCursorInsideSpan(f),!0}function gk(e,t){Jf(e,ks,t)}function QQ(e,t){if(e.key!=="Backspace"&&e.keyCode!==8||e.ctrlKey||e.metaKey||e.altKey)return!1;const n=window.getSelection(),r=n?.rangeCount?n.getRangeAt(0):null,o=r?.collapsed?r.startContainer:null,i=xt(o)?o:xt(o?.parentNode)?o.parentNode:null,s=i?.previousSibling,a=s?.parentNode;if(!n||!i||Kf(i)||s?.nodeName!=="BR"||!a)return!1;e.preventDefault(),e.stopImmediatePropagation(),ks(()=>i.remove());const l=s.previousSibling,c=Array.prototype.indexOf.call(a.childNodes,s);return a.removeChild(s),l?.nodeType===Node.TEXT_NODE?n.collapse(l,l.length):n.collapse(a,c),l?.nodeName==="BR"&&Jf(l,ks),t.commit(!0),!0}var JQ=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"];function eJ(e,t){return!JQ.includes(e.key)||em(ME(),ks)===null||t.commit(!1),!1}function tJ(e,t,n,r,o){if(!(e.keyCode===13&&!n||(e.key==="Enter"||e.keyCode===13)&&e.shiftKey&&n&&r))return!1;if(e.preventDefault(),e.stopImmediatePropagation(),!t)return!0;const i=window.getSelection(),s=i&&i.rangeCount>0?i.getRangeAt(0):null;if(!s)return!0;uE();const a=i.anchorNode,l=a?.parentNode,c=l?.tagName==="A"&&!xa(l);s.collapsed||s.deleteContents(),PE(s);const u=document.createElement("br");if(a?.nextSibling===null&&c&&a.nodeType===Node.TEXT_NODE){if(i.anchorOffset===0)return l.parentNode.insertBefore(u,l),o.commit(),!0;if(i.anchorOffset===(a.textContent?.length||0))return l.after(u),s.setStartAfter(u),s.setEndAfter(u),gk(u,t),o.commit(),!0}if(n){const d=t.querySelector('div[em-edit="active"]');if(!(d&&d.contains(s.startContainer))&&d){const f=d.lastChild;f&&s.setStart(f,f.textContent?.length||0)}}return s.insertNode(u),s.setStartAfter(u),s.setEndAfter(u),i.removeAllRanges(),i.addRange(s),gk(u,t),o.commit(),!0}function nJ(e){const t=e.target,n=t?.closest?.("a")||t?.querySelector?.("a");if(!n)return!1;const r=n.closest("td")||n.parentElement;return r?uC(r,_h(n),n):!1}function rJ(e){const t=ht(r=>{const o=r.target,i=o?.closest?.("a")||o?.querySelector?.("a"),s=i?.closest("td")||i?.parentElement;!i||!s||!Fr(s)||e(!1).then(()=>{const a=!!i.closest("editor")||!!i.querySelector("editor")||!!s.querySelector("editor");s.isConnected&&i.isConnected&&a&&uC(s,_h(i),i)&&e(!1)})}),n=ht(r=>{nJ(r)&&e(!1)});return document.addEventListener("input",t,!1),document.addEventListener("focusout",n,!1),{dispose(){document.removeEventListener("input",t,!1),document.removeEventListener("focusout",n,!1)}}}var oJ=["Enter","Backspace","Delete"];function iJ(e){const t=ht(n=>{if(n.type==="keyup"&&!oJ.includes(n.key))return;const r=n.target,o=r?.closest?.("a")||r?.querySelector?.("a");!o||!xa(o)||!nC(o)&&!J_(o)||e(!1).then(()=>{if(!o.isConnected)return;const i=V$(o),s=K$(o);(i||s)&&e(!1)})});return document.addEventListener("input",t,!1),document.addEventListener("keyup",t,!1),{dispose(){document.removeEventListener("input",t,!1),document.removeEventListener("keyup",t,!1)}}}var sJ=new Set(["textStrong","textItalic","textStrikethrough","textUnderline","textLink","textColor","textBackgroundColor"]);function aJ(e){const{commit:t,addNewRange:n,refreshElementSettings:r,findElementWithSelectedText:o,getParentElementOfSelection:i,findOutermostParentWithText:s,clearLinkTags:a,addFontFamilyClass:l,getIsProgrammaticSelection:c,getCommonStyles:u}=e,d=o,f=i,h=s;function m(b,E,_){const T=!!b&&!!E&&E.tagName==="DIV"&&b.tagName==="EDITOR"&&b.parentElement===E&&E.childElementCount===1&&E.firstElementChild===b&&!Array.from(E.childNodes).some(O=>O!==b&&O.nodeType===Node.TEXT_NODE&&!!O.textContent?.trim()),x=!!b&&b.childElementCount===0&&Array.from(b.childNodes).some(O=>O.nodeType===Node.TEXT_NODE&&!!O.textContent?.trim()),N=!!b&&Ie(b).trim()===_.trim();if(!T||!x||!N||!b.hasAttribute("em-edit")||!E.parentNode)return;const D=E.parentNode,R=b.getAttribute("em-edit")||"active";for(;b.firstChild;)E.appendChild(b.firstChild);b.remove(),b.removeAttribute("em-edit"),E.setAttribute("em-edit",R),D.replaceChild(b,E),b.appendChild(E)}function p(b,E){try{return E.intersectsNode(b)}catch{const _=document.createRange();return _.selectNodeContents(b),E.compareBoundaryPoints(Range.END_TO_START,_)<0&&E.compareBoundaryPoints(Range.START_TO_END,_)>0}}function S(b){const E=b?.links||{},_=E.underline,T=E.color,x=typeof _=="boolean"?_?"underline":"none":"underline";return{color:typeof T=="string"&&T.trim()?T.trim():"inherit",textDecoration:x}}function C(b,E){if(!b||!E)return null;const _=E,T=Array.from(_.querySelectorAll("a"));_.tagName==="A"&&T.unshift(_);const x=typeof window<"u"&&window.Range?window.Range.START_TO_START:0,N=typeof window<"u"&&window.Range?window.Range.END_TO_END:2;for(const D of T){const R=document.createRange();R.selectNodeContents(D);const O=R.compareBoundaryPoints(x,b)<=0,q=R.compareBoundaryPoints(N,b)>=0;if(O&&q)return D}return null}function L(b,E,_){const T=Array.from(E?.getElementsByTagName("span")||[]).reverse();let x=!1;Ie(E)===b&&T.length&&(x=!0),T.forEach(N=>{const D=N.getAttribute("style"),R=!!D&&D.trim().length>0;let O=Array.from(N.attributes).filter(ee=>ee.name!=="style");if(!R&&O.length===1&&O[0].name==="em-edit"&&N.parentElement&&!N.parentElement.hasAttribute("em-edit")){const ee=N.getAttribute("em-edit")||"active";N.parentElement.setAttribute("em-edit",ee),N.removeAttribute("em-edit"),O=Array.from(N.attributes).filter(de=>de.name!=="style")}const q=O.length>0;if(!R&&!q){const ee=Ie(N);if(N.childNodes.length===1&&N.childNodes[0].nodeType===3){const de=N.childNodes[0];N.parentNode?.replaceChild(de,N),_.isEditorTagOutside&&Ie(E)!==b&&de.parentNode&&(_.range?.selectNode(de),n(_.range))}else{const de=Array.from(N.childNodes);de.forEach(re=>{N.parentNode?.insertBefore(re,N)}),b===ee&&(_.range=document.createRange(),_.range.setStartBefore(de[0]),_.range.setEndAfter(de[de.length-1]),n(_.range)),N.parentNode?.removeChild(N)}}}),x&&(r(E,b),_.range.selectNode(E),n(_.range))}function k(b,E){if(b?.rangeCount>0){const _=b.getRangeAt(0),T=_.commonAncestorContainer;let x=_.startOffset,N=_.endOffset;for(;T.data&&x>0&&!/\s/.test(T.data[x-1]);)x--;for(;T.data&&N<T.length&&!/\s/.test(T.data[N]);)N++;E.setStart(T,x),E.setEnd(T,N),n(E)}}function y(b,E,_){Le(b,je(b).replaceAll(/<\/?strike[^>]*>/gi,"")),rn(b),b.parentNode&&(_.selectNode(b),n(_),r(b,E))}let g=!1;function v(){document.execCommand("styleWithCSS",!1,"true"),g=!0}function w(b,E){const _=NZ(E.settings,G),T=E.settings.textColor??E.settings.textBackgroundColor;if(typeof T=="string"&&T.trim()!==""&&!G(T))return!1;const x=$u(b),{classNameOl:N,classNameUl:D,classNameBullet:R,isListOL:O,isListUL:q,isList:ee}=x;ee&&x.tableElement?.querySelectorAll("tbody > tr > td:first-child")?.forEach(W=>{const ot=W.querySelector(":scope > div")||W.querySelector(":scope > editor div");ot&&ot.classList.add(`${R}`)}),b?.querySelectorAll(".em-element-path").forEach(W=>W.remove()),em(ME(),ks);const de=Object.keys(E.settings)[0];let re=window.getSelection();if(!re||re.rangeCount===0){if(!b||!b.isConnected)return;const W=document.createRange();if(W.selectNodeContents(b),re=window.getSelection(),!re)return;re.removeAllRanges(),re.addRange(W)}let Q=re.getRangeAt(0);const ve=Q.commonAncestorContainer;let fe=ve.nodeType===1?ve:ve.parentElement,Te=re.anchorNode?.nodeType===1?re.anchorNode:re.anchorNode?.parentElement,ut=!1,te=Je();if(b||(b=re.anchorNode?.childNodes.length===1&&re.anchorNode.firstChild?.nodeType===1?re.anchorNode.firstChild:fe,b.tagName==="EDITOR"&&(b=b.parentElement)),_.name==="textLink"&&_.value===""){const W=fe?.closest?.("a, [href]")||null;W&&(Q.selectNode(W),n(Q),b=W)}if(_.name==="textUnderline"&&!_.value){let W=fe.closest(["u","strike","[style*=text-decoration]","span","a"].find(ot=>fe?.closest(ot))||"u");!W&&b?.tagName==="A"&&(W=b),W?.tagName==="A"&&(W.style.textDecoration="none",r(W,te),Q.selectNode(W),n(Q),b=W,ut=!0)}let z=E.type==="button"?(b||Te)?.closest("a"):(b||Te)?.closest("a, div, p, td, h1, h2, h3, h4, h5, h6, li, ul, ol, sup, sub");const oe=E.settings.fontFamily;let qt=null;const j=Array.from(z?.classList||[]).some(W=>(W.startsWith("em-font-")&&(qt=W),W.startsWith("em-font-")&&W.includes(_.name==="textItalic"?"Italic":"Bold")));j&&(_.name==="textItalic"||_.name==="textStrong")&&qt&&z?.classList.remove(qt);const un={range:Q,isEditorTagOutside:!1},Ct=(W=Je(),ot=z)=>{L(W,ot,un)},dn=PK,Qt=vA,Ln=(W,ot)=>{y(W,te,un.range)};let Jt,dt;de==="textColor"?Jt=dt="color":de==="textBackgroundColor"&&(Jt="backgroundColor",dt="background-color");const Rt=E.settings.hasOwnProperty("textColor")||E.settings.hasOwnProperty("textBackgroundColor"),Tt=!!fe?.closest("editor")||Ie(fe)===te||Ie(fe.querySelector("editor"))===te;un.isEditorTagOutside=Tt,E.settings.hasOwnProperty("textColor")&&_.value&&v();const vd=IK,Qn=c(),Ya=u();if(FZ({parentElement:fe,parentNode:Te,parentWrapper:z,currentSettings:_,isElementList:ee,classNameBullet:R,isEditorTagOutside:Tt,selectedText:te,range:Q,selection:re,checkForTextNodes:Qt,commit:t,getInnerText:Ie,getSelectedText:Je,addNewRange:n,refreshElementSettings:r,findElementWithSelectedText:d,getParentElementOfSelection:f,rgbToHex:G})||$Z({parentElement:fe,parentNode:Te,parentWrapper:z,currentSettings:_,isElementList:ee,classNameBullet:R,isEditorTagOutside:Tt,selectedText:te,range:Q,selection:re,checkForTextNodes:Qt,commit:t,getInnerText:Ie,getSelectedText:Je,addNewRange:n,refreshElementSettings:r,findElementWithSelectedText:d,getParentElementOfSelection:f,rgbToHex:G,fontFamilyArray:oe,removeClassesByPrefix:ba,createFontClassName:sp,clearLinkTags:a,addFontFamilyClass:l,cleanEmptySpans:Ct}))return!1;const Io=fe.closest(_.tags.find(W=>fe?.closest(W))||"span");(Q?.collapsed||!Je())&&(_.value?_.value&&Tt&&(E.type==="button"||b.tagName==="A"&&Io?Q.selectNodeContents(Io):k(re,Q)):Io&&Q.selectNodeContents(Io)),(E.type==="button"||b.tagName==="A"||b?.closest("a"))&&Je()&&Je()!==Ie(b)&&Io&&(E.settings.hasOwnProperty("textLink")||E.settings.hasOwnProperty("textUnderline"))&&(Q.selectNode(Io),n(Q),E.settings.hasOwnProperty("textUnderline")&&b.tagName==="A"&&(b.style.textDecoration=_.value?"underline":"none",ut=!0)),re=window.getSelection(),Q=re.getRangeAt(0),un.range=Q,te=Je(),Array.from(z?.querySelectorAll("span,div")||[]).reverse().forEach(W=>{W.getAttribute("style")===""&&W.removeAttribute("style"),W.hasAttribute("contenteditable")&&W.removeAttribute("contenteditable"),W.hasAttribute("em-edit")&&W.removeAttribute("em-edit"),W.hasAttribute("em-relative")&&W.removeAttribute("em-relative"),W.hasAttribute("class")&&(W.classList.remove("em-relative"),W.classList.length===0&&W.removeAttribute("class"))});let ce=null;Rt&&dt&&z?.style?.getPropertyValue?.(dt)?.trim()&&(Ie(z)===te&&(z.style[Jt]=G(_.value?.toString())||"",ut=!0),Jt==="color"&&(fe===z||b?.closest('[style*="color"]')===z)&&(ce=G(z.style[dt]),z.style.removeProperty(dt),!z?.hasAttribute("em-edit")&&ee&&z&&Qn&&z.closest("tr")?.querySelector(`.${R}`)?.style.removeProperty(dt)));let fn=null,Ed=null;if(Rt&&Jt==="color"&&["A","LI"].includes(z?.tagName)){let W=z.parentElement;for(;W&&!["BODY","HTML","TD","TH"].includes(W.tagName);){const ot=W.style.getPropertyValue("color")?.trim();if(ot){fn=G(ot)||ot,Ed=W,W.style.removeProperty("color");break}W=W.parentElement}}dt&&!(_.value.length===7||_.value.length===4)&&(ut=!0),Tt&&(!_.value&&_.name!=="fontSize"&&_.name!=="textLink"||_.value)&&(!(_.name==="textUnderline"||_.name==="textStrikethrough")||E.type!=="button")&&!ut&&(_.name!=="fontSize"&&!Rt&&Ie(z)===te?ur(_.command,!1,Rt?_.value:_.name==="textLink"?" ":void 0):Ie(z)!==te&&(E.settings.hasOwnProperty("textColor")&&v(),ur(_.command,!1,Rt?String(_.value):_.name==="textLink"?" ":void 0),E.settings.hasOwnProperty("textColor")&&_.value&&BZ(z||fe,String(_.value),G))),te=Je();{const W={parentElement:fe,parentNode:Te,parentWrapper:z,selection:re,range:Q};zZ({parentElement:fe,parentNode:Te,parentWrapper:z,currentSettings:_,isElementList:ee,classNameBullet:R,isEditorTagOutside:Tt,selectedText:te,range:Q,selection:re,checkForTextNodes:Qt,commit:t,getInnerText:Ie,getSelectedText:Je,addNewRange:n,refreshElementSettings:r,findElementWithSelectedText:d,getParentElementOfSelection:f,rgbToHex:G,activeElement:b,hasItalicClass:j,tempStyleClass:qt,checkForWorkClass:dn,removeFormattingTags:Ms,cleanEmptySpans:Ct,mutableState:W,currentStyle:Jt,isProgrammaticSelection:Qn,findParentWithFontSizeAndTag:FK}),fe=W.parentElement,Te=W.parentNode,z=W.parentWrapper,re=W.selection,Q=W.range,un.range=Q}WZ({parentElement:fe,parentNode:Te,parentWrapper:z,currentSettings:_,isElementList:ee,classNameBullet:R,isEditorTagOutside:Tt,selectedText:te,range:Q,selection:re,checkForTextNodes:Qt,commit:t,getInnerText:Ie,getSelectedText:Je,addNewRange:n,refreshElementSettings:r,findElementWithSelectedText:d,getParentElementOfSelection:f,rgbToHex:G,activeElement:b,hasItalicClass:j,tempStyleClass:qt,checkForWorkClass:dn,removeFormattingTags:Ms,cleanEmptySpans:Ct}),qZ({parentElement:fe,parentNode:Te,parentWrapper:z,currentSettings:_,isElementList:ee,classNameBullet:R,isEditorTagOutside:Tt,selectedText:te,range:Q,selection:re,checkForTextNodes:Qt,commit:t,getInnerText:Ie,getSelectedText:Je,addNewRange:n,refreshElementSettings:r,findElementWithSelectedText:d,getParentElementOfSelection:f,rgbToHex:G,activeElement:b,hasItalicClass:j,tempStyleClass:qt,checkForWorkClass:dn,removeFormattingTags:Ms,cleanEmptySpans:Ct});const Za={parentWrapper:z,range:Q,selection:re};UZ({parentElement:fe,parentNode:Te,parentWrapper:z,currentSettings:_,isElementList:ee,classNameBullet:R,isEditorTagOutside:Tt,selectedText:te,range:Q,selection:re,checkForTextNodes:Qt,commit:t,getInnerText:Ie,getSelectedText:Je,addNewRange:n,refreshElementSettings:r,findElementWithSelectedText:d,getParentElementOfSelection:f,rgbToHex:G,activeElement:b,hasItalicClass:j,tempStyleClass:qt,checkForWorkClass:dn,removeFormattingTags:Ms,cleanEmptySpans:Ct,request:E,findOutermostParentWithText:h,mutableState:Za}),z=Za.parentWrapper,Q=Za.range,un.range=Q;const es={parentWrapper:z,range:Q,selection:re};if(jZ({parentElement:fe,parentNode:Te,parentWrapper:z,currentSettings:_,isElementList:ee,classNameBullet:R,isEditorTagOutside:Tt,selectedText:te,range:Q,selection:re,checkForTextNodes:Qt,commit:t,getInnerText:Ie,getSelectedText:Je,addNewRange:n,refreshElementSettings:r,findElementWithSelectedText:d,getParentElementOfSelection:f,rgbToHex:G,activeElement:b,hasItalicClass:j,tempStyleClass:qt,checkForWorkClass:dn,removeFormattingTags:Ms,cleanEmptySpans:Ct,request:E,findOutermostParentWithText:h,cleanStrikesInElement:Ln,mutableState:es}),z=es.parentWrapper,_.value===!1&&z){const W=window.getSelection(),ot=W&&W.rangeCount>0?W.getRangeAt(0):Q,Nn={textStrong:["strong","b"],textItalic:["em","i"],textStrikethrough:["s","strike"],textUnderline:["u"]}[_.name];let xn=!1;Nn&&Nn.forEach(Se=>{Array.from(z.getElementsByTagName(Se)).reverse().forEach(Mt=>{if(!p(Mt,ot))return;const Jn=Ie(Mt);if(!Jn||Jn.trim().length===0)return;const gt=Mt.parentElement;Mt.hasAttribute("em-edit")&>&&!gt.hasAttribute("em-edit")&>.setAttribute("em-edit",Mt.getAttribute("em-edit")||"active"),Md(Mt),xn=!0,m(gt,z,te)})}),xn&&setTimeout(()=>{const Se=document.querySelector("[em-edit]")||d(te)||(z?.isConnected?z:null);Se&&r(Se,te)},0)}if(_.value===!0&&z&&Tt){const W={textStrong:"strong",textItalic:"em",textStrikethrough:"s",textUnderline:"u"},ot={textStrong:["strong","b"],textItalic:["em","i"],textStrikethrough:["s","strike"],textUnderline:["u"]},Nn=W[_.name],xn=ot[_.name];if(Nn&&xn&&te&&te.trim().length>0){const Se=z,Mt=xn.some(to=>Se.getElementsByTagName(to).length>0),Jn=(Se.style?.textDecoration||"").toLowerCase(),gt=(Se.style?.textDecorationLine||"").toLowerCase(),On=Jn.includes("underline")||gt.includes("underline"),zt=Jn.includes("line-through")||gt.includes("line-through"),Sr=_.name==="textUnderline"&&On||_.name==="textStrikethrough"&&zt,wd=Ie(Se)===te;if(!Mt&&!Sr&&wd){const to=document.createElement(Nn);for(;Se.firstChild;)to.appendChild(Se.firstChild);Se.appendChild(to);try{const Rn=document.createRange();Rn.selectNodeContents(to),n(Rn),Q=Rn,un.range=Rn}catch{}setTimeout(()=>{const Rn=document.querySelector("[em-edit]")||d(te)||(Se.isConnected?Se:null);Rn&&r(Rn,te)},0)}}}const rt={parentWrapper:z,parentNode:Te,range:Q,selection:re};VZ({parentElement:fe,parentNode:Te,parentWrapper:z,currentSettings:_,isElementList:ee,classNameBullet:R,isEditorTagOutside:Tt,selectedText:te,range:Q,selection:re,checkForTextNodes:Qt,commit:t,getInnerText:Ie,getSelectedText:Je,addNewRange:n,refreshElementSettings:r,findElementWithSelectedText:d,getParentElementOfSelection:f,rgbToHex:G,isColorChange:Rt,tempColor:ce,outerContextColor:fn,outerContextElement:Ed,stylePropretyName:dt,currentStyle:Jt,canselExecCommand:ut,isProgrammaticSelection:Qn,request:E,setCustomColor:vd,checkForWorkClass:dn,cleanEmptySpans:Ct,mutableState:rt}),z=rt.parentWrapper,Te=rt.parentNode;const eo={parentWrapper:z,parentNode:Te,range:Q,selection:re};if(XZ({parentElement:fe,parentNode:Te,parentWrapper:z,currentSettings:_,isElementList:ee,classNameBullet:R,isEditorTagOutside:Tt,selectedText:te,range:Q,selection:re,checkForTextNodes:Qt,commit:t,getInnerText:Ie,getSelectedText:Je,addNewRange:n,refreshElementSettings:r,findElementWithSelectedText:d,getParentElementOfSelection:f,rgbToHex:G,findOutermostParentWithText:h,activeElement:b,commonStyles:Ya,cleanEmptySpansWithParent:Ct,mutableState:eo}),Q=eo.range,_.name==="textLink"&&_.value===!0&&Tt&&z&&te?.trim().length>0){const W=eo.range||Q,ot=te.trim(),Nn=[...z?Array.from(z.querySelectorAll("a")):[],...z?.parentElement?Array.from(z.parentElement.querySelectorAll("a")):[]],xn=Nn.find(Se=>Ie(Se)?.trim()===ot)||Nn[0]||null;if(!(C(W,z)||C(W,z.parentElement)||xn)&&W&&!W.collapsed){const Se=document.createElement("a"),{color:Mt,textDecoration:Jn}=S(Ya);Se.setAttribute("target","_blank"),Se.setAttribute("href",""),Se.setAttribute("new","true"),Se.setAttribute("style",`color: ${Mt}; text-decoration: ${Jn};`);let gt=!1;const On=z.querySelector("editor");if(On&&Ie(On)===te&&On.querySelector("a")===null){for(;On.firstChild;)Se.appendChild(On.firstChild);On.appendChild(Se),gt=!0}try{if(!gt){const zt=W.extractContents();zt.childNodes.length>0&&(Se.appendChild(zt),W.insertNode(Se),gt=!0)}}catch{gt=!1}if(!gt&&Ie(z)===te){for(;z.firstChild;)Se.appendChild(z.firstChild);z.appendChild(Se),gt=!0}if(gt){try{const zt=document.createRange();zt.selectNodeContents(Se),n(zt),Q=zt,eo.range=zt,un.range=zt}catch{}r(Se,te)}}}const Sd=_.name==="textUnderline"&&!_.value;if((!Rt&&ut||Sd)&&Ct(te),sJ.has(_.name)){const W=eo.parentWrapper||z||d(te)||f();W&&Ct(te,W)}ee&&fe.querySelectorAll(`tr td:first-child > div.${R}, tr td:first-child > editor div.${R}`).forEach(W=>{W.classList.remove(`${R}`)});const Qa=d(te);Qa?.hasAttribute("em-edit")||Qa?.setAttribute("em-edit","active"),t()}return function(E,_){try{return w(E,_)}finally{g&&(g=!1,document.execCommand("styleWithCSS",!1,"false"))}}}function bk(e){return e.querySelector(".em-element-editor")?.remove(),e.removeAttribute("em-state"),lr(Ns(e),([t])=>(t&&e.after(t),t))}function yk(e,t){const n=bk(e);t.commit(),n&&t.setCursorPosition(n)}function vk(e,t){bk(e),t.commit()}function Ek(e,t){yk(e,t)}function Sk(e,t){if(!e.previousElementSibling)return!1;const n=e.previousElementSibling;return hf(e.parentNode,e,n),t.commit(),U.send({operation:"application_scroll-to",settings:{value:t.scrollTop-n.getBoundingClientRect().height}}),!0}function wk(e,t){if(!e.nextElementSibling)return!1;const n=e.nextElementSibling;return hf(e.parentNode,e,n.nextSibling),t.commit(),U.send({operation:"application_scroll-to",settings:{value:t.scrollTop+n.getBoundingClientRect().height}}),!0}function _k(e){e.innerHTML="",e.getAttribute("em")==="block"&&e.removeAttribute("em")}function Ck(e,t){const n=e.closest("table");e.querySelector("[em-edit]")&&U.send({operation:"application_element_settings_close"});const r=e.closest('[em="group"]');r&&n&&r.querySelectorAll('[em="block"]').length===1?_k(n):e.remove(),t.commit(),n&&t.setCursorPosition(n)}function Tk(e,t){return Vf(e),bI(t)}function lJ(e,t){const n=document.querySelector('[em-edit="active"]')?.closest('[em="block"]');if(!n)return;const r=[...n.parentElement.children].indexOf(n),o=Ni(n),i=parseFloat(o?.style.paddingTop??"")||0,s=parseFloat(o?.style.paddingBottom??"")||0;if(e.tagName==="TR"||e.tagName==="TABLE"){const a=Tk(e,e.querySelector("td")),l=[...e.parentNode.children].indexOf(e),c=Ni(e),u=parseFloat(c?.style.paddingTop??"")||0,d=parseFloat(c?.style.paddingBottom??"")||0,f=parseFloat(c?.style.borderTopLeftRadius??"")||0,h=parseFloat(c?.style.borderTopRightRadius??"")||0,m=parseFloat(c?.style.borderBottomLeftRadius??"")||0,p=parseFloat(c?.style.borderBottomRightRadius??"")||0,S=n.querySelector("td");r>l?(nr(S,"afterbegin",`<table cellpadding="0" cellspacing="0" border="0" width="100%" em="atom"><tr><td height="${i+d}"></td></tr></table>`),S.prepend(...a),o&&(o.style.paddingTop=u+"px",o.style.borderTopLeftRadius=f+"px",o.style.borderTopRightRadius=h+"px",o.querySelector(":scope > .em-vindent-paddingTop")?.remove())):(nr(S,"beforeend",`<table cellpadding="0" cellspacing="0" border="0" width="100%" em="atom"><tr><td height="${s+u}"></td></tr></table>`),S.append(...a),o&&(o.style.paddingBottom=d+"px",o.style.borderBottomLeftRadius=m+"px",o.style.borderBottomRightRadius=p+"px",o.querySelector(":scope > .em-vindent-paddingBottom")?.remove()))}else if(e.tagName==="DIV"){const a=Tk(e,e),l=Array.prototype.indexOf.call(e.parentElement.children,e);ul(n,r>l?"afterbegin":"beforeend",a)}e.remove(),document.querySelector(".em-element-editor-widget-merge")?.remove(),t.commit(),t.setCursorPosition(n)}function cJ(e,t){const n=Ni(e),r=parseFloat(n?.style.paddingTop)||0,o=parseFloat(n?.style.paddingBottom)||0,i=parseFloat(n?.style.borderTopLeftRadius)||0,s=parseFloat(n?.style.borderTopRightRadius)||0,a=parseFloat(n?.style.borderBottomLeftRadius)||0,l=parseFloat(n?.style.borderBottomRightRadius)||0,c=Ns(e);if(!c)return;Vf(e);const u=[...n?.querySelectorAll(':scope > table:not([em="atom"])')??[]].filter(zf).map(f=>({table:f,next:yE(f,"next"),prev:yE(f,"previous")})),d=u.length;u.forEach(({table:f,next:h,prev:m},p)=>{const[S]=Ne(c,!0),C=Ni(S);if(C.style.paddingTop="0",C.style.paddingBottom="0",C.style.borderRadius="0",C.replaceChildren(f),p===0?(C.style.paddingTop=r+"px",C.style.borderTopLeftRadius=i+"px",C.style.borderTopRightRadius=s+"px"):p===d-1&&(C.style.paddingBottom=o+"px",C.style.borderBottomLeftRadius=a+"px",C.style.borderBottomRightRadius=l+"px"),h?.getAttribute("em")==="atom"&&h.querySelector("td")?.hasAttribute("height")){const L=parseFloat(h.querySelector("td").getAttribute("height"))/2;C.style.paddingBottom=L+"px"}if(m?.getAttribute("em")==="atom"&&m.querySelector("td")?.hasAttribute("height")){const L=parseFloat(m.querySelector("td").getAttribute("height"))/2;C.style.paddingTop=L+"px"}e.insertAdjacentElement("beforebegin",S)}),e.remove(),t.commit()}function uJ(e,t){return e.previousElementSibling?(e.previousElementSibling.before(e),t.commit(),!0):!1}function dJ(e,t){return e.nextElementSibling?(e.nextElementSibling.after(e),t.commit(),!0):!1}function fJ(e,t){const n=document.querySelector('[em="group"]')?.cloneNode(!0);if(!n)return;const r=n.querySelector("table");r&&_k(r),e.after(n),t.commit(),U.send({operation:"application_scroll-to",settings:{value:n.getBoundingClientRect().top+n.getBoundingClientRect().height+(t.iframeOffsetTop||0)}})}function mJ(e,t){yk(e,t)}function hJ(e,t){e.querySelector("[em-edit]")&&U.send({operation:"application_element_settings_close"}),e.remove(),t.commit()}function pJ(e){return e.classList.contains("add-empty-block")?"empty":e.classList.contains("add-saved-block")?"project":e.classList.contains("add-common-block")?"common":e.classList.contains("add-template-block")?"template":e.classList.contains("add-search-block")?"search":""}function gJ(e){const t=e.closest("i");return t?t.classList.contains("add-empty-block")||t.classList.contains("add-saved-block")||t.classList.contains("add-common-block")||t.classList.contains("add-template-block")||t.classList.contains("add-search-block"):!1}function bJ(e,t,n){const r=t.closest("i");if(!r)return;n.removeAllAttributes("em-edit");const o=t.closest('[em="block"]');if(!o)return;o.tagName==="TR"?o.querySelector("TD")?.setAttribute("em-edit","active"):o.setAttribute("em-edit","active");const i={operation:"application_element_settings_set",type:"emptyTable",tab:pJ(r)},s=n.selectionLock.acquire();try{U.send(i)}finally{n.commitLockedAsync(!1).finally(()=>{s.release()})}}function yJ(e,t,n){const r=t.parentNode;r&&(r.style.backgroundColor="rgba(0,255,0,0.3)");let o="";document.head.querySelectorAll("style").forEach(a=>{o+=n.HTMLDocument.getInnerHtml(a)});const i=document.createElement("style");i.setAttribute("em","styles"),i.innerHTML=o;const s=VF(i)+`
|
|
189
|
+
`+n.HTMLDocument.getOuterHtml(e);navigator.clipboard.writeText(s),setTimeout(()=>{r&&r.style.removeProperty("background-color")},2e3)}function vJ(e,t,n){navigator.clipboard.readText().then(r=>{const o=ip(n.parseFromString(r));let i=o.filter(l=>l.tagName&&l.tagName!=="LINK"&&l.tagName!=="STYLE").map(l=>n.getOuterHtml(l)).join("");const s=o.filter(l=>l.tagName==="STYLE").map(l=>n.getOuterHtml(l)).join(""),a=o.filter(l=>l.tagName==="LINK"&&l.getAttribute("em-class")).filter(l=>!document.head?.querySelector(`link[em-class="${l.getAttribute("em-class")}"]`));if((i.indexOf("empty-structure")>-1||i.indexOf("em-structure")>-1)&&(i=n.setBlockMaxWidth({blockHTML:i,targetBlock:e}),i=n.setFloatBlocksWidth({blockHTML:i,targetBlock:e,project:n.appName})),i=n.checkBlockAdaptivity({blockHTML:i,blockIsTr:i.substring(0,3)==="<tr"}),!lr(i,l=>{const c=EJ(e,l);if(!c)return!1;s&&SJ(s,n);for(const u of a.reverse())document.head?.prepend(u),document.head?.insertAdjacentHTML("afterbegin",`
|
|
190
|
+
`);return e.removeAttribute("em-state"),e.after(c),!0})){wJ(t.parentNode);return}n.commit(),n.setCursorPosition(e)}).catch(()=>{})}function EJ(e,t){const n=e.tagName==="TR",r=document.createElement(n?"table":"div");return r.append(...t),r.querySelector('[em="block"]')?(r.querySelector(".em-element-editor")?.remove(),r.querySelector(n?"tr":'[em="block"]')):null}function SJ(e,t){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 o=document.createElement("div");t.emailWidth&&(e=e.replace(/(max-device-width:|max-width:)\d+px/g,s=>s.replace(/\d+/,String(t.emailWidth)))),t.insertAdjacentHTML(o,"afterbegin",e);let i=t.minify(r+`
|
|
191
|
+
`+[...o.querySelectorAll("style")].map(s=>s.innerHTML).join(`
|
|
192
|
+
`),{restructure:!0,forceMediaMerge:!0}).css;i=t.cssbeautify(i,{indent:" ",autosemicolon:!0}),n.textContent=`
|
|
193
|
+
`+i+`
|
|
194
|
+
`}function wJ(e){e&&(e.style.backgroundColor="rgba(255,0,0,0.3)",setTimeout(()=>{e.style.removeProperty("background-color")},2e3))}function _J(){return document.body?.classList.contains("em-sandbox-discuss")&&!document.body.classList.contains("em-sandbox-discuss_set-target")}function CJ(){return document.body?.classList.contains("em-sandbox-discuss_set-target")??!1}function TJ(e){const t=e.getAttribute("em-discuss-id");return t&&U.send({operation:"application_discuss_get_comment",settings:{targetId:t}}),!1}function AJ(e,t){let n=e;const r=n.getAttribute("em-discuss-id"),o=n.classList.contains("em-discuss-id-new");if(!r||r&&o){if(document.querySelectorAll(".em-discuss-id-new").forEach(i=>{i!==n&&(i.removeAttribute("em-discuss-id"),i.removeAttribute("contenteditable"),i.removeAttribute("em-edit"))}),n.tagName==="EDITOR"&&(n=n.parentElement),n.getAttribute("em-discuss-id"))n.removeAttribute("em-discuss-id"),n.removeAttribute("contenteditable"),n.removeAttribute("em-edit"),U.send({operation:"application_discuss_set_id",settings:{value:""}});else{const i=t.makeId(5);n.setAttribute("em-discuss-id",i),n.setAttribute("em-edit","active"),n.setAttribute("contenteditable","true"),n.classList.add("em-discuss-id-new"),U.send({operation:"application_discuss_set_id",settings:{value:i}})}t.commit()}return{handled:!0,newClickedElement:n}}function kJ(e){return function(n){document.body&&!document.body.classList.contains("mceNonEditable")&&(n.stopPropagation(),n.preventDefault()),e.setEditorFocus(!1);const r=n.target;if(document.documentElement.classList.contains("em-resize-start")||r.classList.contains("em-element-editor-widget")||r.classList.contains("em-element-block-add"))return;let o=r;if(!e.getLockEditor()){const m=o.closest(".em-narrow-table");if(m&&(cn(m)||!m.innerHTML.trim())&&e.insertTextAtomIntoEmptyNarrowTable(m))return}const i=o.closest("a");if(i instanceof HTMLAnchorElement){const m=i.getAttribute("href")||i.href||"";if(Pa(m)){const p=m.slice(1),S=document.querySelector(`a[name="${p}"]`);S&&(n.preventDefault(),S.scrollIntoView({behavior:"smooth",block:"start"}))}else i.href&&document.referrer.includes("raw")&&window.open(i.href);n.stopPropagation(),n.preventDefault()}if(o.tagName==="HTML"||o.classList.contains(Ve.drag)||o.classList.contains("em-element-editor"))return;const s=document.body,a=s?.classList.contains("mceNonEditable"),l=s?.classList.contains("em-sandbox-discuss"),c=document.referrer.includes("raw"),u=o.tagName==="A"||o.closest("a")||o.tagName==="IMG";if(a&&!l&&(!c||!u)){e.setCursorPosition(o);return}if(e.isDiscussViewMode()){e.handleDiscussViewClick(o);return}if(e.isDiscussSetTargetMode()){o=e.handleDiscussSetTargetClick(o).newClickedElement;return}o instanceof Element&&o.tagName==="EDITOR"&&(o=o.parentElement);const d=o.closest('[em="atom"]');if(d&&o.closest(".em-element-editor-widget-remove")){e.handleRemoveAtom(d);return}if(d&&o.closest(".em-element-editor-widget-edit")){e.applicationElementSettingsSet({elem:d}),e.setCursorPosition(d);return}if(d&&o.closest(".em-element-editor-widget-clone")){e.handleCloneAtom(d);return}const f=o.closest('[em="block"]');if(f&&o.classList.contains(Ve.moveUp)){e.handleMoveBlockUp(f);return}if(f&&o.classList.contains(Ve.moveDown)){e.handleMoveBlockDown(f);return}if(f&&o.closest(".em-element-editor-widget-edit")){const m=f.querySelector("td");m&&e.applicationElementSettingsSet({elem:m}),e.setCursorPosition(f);return}if(f&&o.closest(".em-element-editor-widget-remove")){e.handleRemoveBlock(f);return}if(f&&o.closest(".em-element-editor-widget-add-block")){e.addBlockToProject(o);return}if(f&&o.closest(".em-element-editor-widget-clone")){e.handleCloneBlock(f);return}if(f&&e.isAddBlockMenuClick(o)){e.handleAddBlockMenu(f,o);return}if(f&&o.closest(".em-element-editor-widget-copy")){e.handleCopyBlock(f,o);return}if(f&&o.closest(".em-element-editor-widget-paste")){e.handlePasteBlock(f,o);return}if(f&&o.classList.contains(Ve.merge)){e.handleMergeBlocks(f);return}if(f&&o.classList.contains(Ve.unmerge)){e.handleUnmergeBlocks(f);return}const h=o.closest('[em="group"]');if(h&&o.classList.contains(Ve.moveUp)){e.handleMoveGroupUp(h);return}if(h&&o.classList.contains(Ve.moveDown)){e.handleMoveGroupDown(h);return}if(h&&o.classList.contains(Ve.add)){e.handleAddGroup(h);return}if(h&&o.closest(".em-element-editor-widget-edit")){e.setCursorPosition(h);const m=h.tagName!=="TR"?h:h.querySelector("td");m&&e.applicationElementSettingsSet({elem:m});return}if(h&&o.closest(".em-element-editor-widget-clone")){e.handleCloneGroup(h);return}if(h&&o.closest(".em-element-editor-widget-remove")&&o.closest(".of-group")){e.handleRemoveGroup(h);return}if(!o.closest(".em-editor-wrapper")&&!o.closest(".em-element-path")&&!o.closest(".em-element-vindent-remove")){const m=window.getSelection();if(m?.isCollapsed)e.setCursorPosition(o);else if(m&&m.rangeCount>0){const S=m.getRangeAt(0).commonAncestorContainer,C=e.findOutermostParentWithText(S);C&&e.setCursorPosition(C);const L=e.getParentElementOfSelection();L&&(o=L)}e.applicationElementSettingsSet({elem:o});const p=document.querySelector(".em-editor-wrapper");p&&(p.style.display="none"),e.setBlockGroupControlsPosition()}o.closest(".em-element-custom-table")&&e.handleCustomTableClick(o)}}function LJ(e){const t=ht(r=>{r.target?.closest(".em-element-editor-widget-clone")||(document.querySelectorAll('.em-element-editor-widget-clone[data-open="true"]').forEach(o=>{o.setAttribute("data-open","false");const i=o.querySelector("ul");i&&(i.style.display="none")}),yu(o=>{e.commit(o)}))}),n=()=>{e.messageService.send({operation:"application_focus_in_iframe"})};return document.addEventListener("click",t),document.addEventListener("click",n),{dispose(){document.removeEventListener("click",t),document.removeEventListener("click",n)}}}var NJ=`
|
|
195
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
196
|
+
<path d="M2.21128 13.375C1.83241 13.375 1.51172 13.2438 1.24922 12.9813C0.986719 12.7188 0.855469 12.3981 0.855469 12.0192V1.98081C0.855469 1.60194 0.986719 1.28125 1.24922 1.01875C1.51172 0.75625 1.83241 0.625 2.21128 0.625H4.74966C5.12853 0.625 5.44922 0.75625 5.71172 1.01875C5.97422 1.28125 6.10547 1.60194 6.10547 1.98081V12.0192C6.10547 12.3981 5.97422 12.7188 5.71172 12.9813C5.44922 13.2438 5.12853 13.375 4.74966 13.375H2.21128ZM9.24966 13.375C8.87078 13.375 8.55009 13.2438 8.28759 12.9813C8.02509 12.7188 7.89384 12.3981 7.89384 12.0192V1.98081C7.89384 1.60194 8.02509 1.28125 8.28759 1.01875C8.55009 0.75625 8.87078 0.625 9.24966 0.625H11.788C12.1669 0.625 12.4876 0.75625 12.7501 1.01875C13.0126 1.28125 13.1438 1.60194 13.1438 1.98081V12.0192C13.1438 12.3981 13.0126 12.7188 12.7501 12.9813C12.4876 13.2438 12.1669 13.375 11.788 13.375H9.24966ZM12.0188 1.98081C12.0188 1.92306 11.9948 1.87019 11.9467 1.82219C11.8987 1.77406 11.8458 1.75 11.788 1.75H9.24966C9.19191 1.75 9.13903 1.77406 9.09103 1.82219C9.04291 1.87019 9.01884 1.92306 9.01884 1.98081V12.0192C9.01884 12.0769 9.04291 12.1298 9.09103 12.1778C9.13903 12.2259 9.19191 12.25 9.24966 12.25H11.788C11.8458 12.25 11.8987 12.2259 11.9467 12.1778C11.9948 12.1298 12.0188 12.0769 12.0188 12.0192V1.98081Z" fill="#344966"/>
|
|
197
|
+
</svg>
|
|
198
|
+
`,xJ=`
|
|
199
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
200
|
+
<path d="M1.98081 13.1442C1.60194 13.1442 1.28125 13.013 1.01875 12.7505C0.75625 12.488 0.625 12.1673 0.625 11.7884V9.25002C0.625 8.87115 0.75625 8.55046 1.01875 8.28796C1.28125 8.02546 1.60194 7.89421 1.98081 7.89421H12.0192C12.3981 7.89421 12.7188 8.02546 12.9813 8.28796C13.2438 8.55046 13.375 8.87115 13.375 9.25002V11.7884C13.375 12.1673 13.2438 12.488 12.9813 12.7505C12.7188 13.013 12.3981 13.1442 12.0192 13.1442H1.98081ZM1.98081 6.10583C1.60194 6.10583 1.28125 5.97459 1.01875 5.71209C0.75625 5.44958 0.625 5.1289 0.625 4.75002V2.21165C0.625 1.83277 0.75625 1.51208 1.01875 1.24958C1.28125 0.987085 1.60194 0.855835 1.98081 0.855835H12.0192C12.3981 0.855835 12.7188 0.987085 12.9813 1.24958C13.2438 1.51208 13.375 1.83277 13.375 2.21165V4.75002C13.375 5.1289 13.2438 5.44958 12.9813 5.71209C12.7188 5.97459 12.3981 6.10583 12.0192 6.10583H1.98081ZM12.0192 1.98083H1.98081C1.92306 1.98083 1.87019 2.0049 1.82219 2.05302C1.77406 2.10102 1.75 2.1539 1.75 2.21165V4.75002C1.75 4.80777 1.77406 4.86065 1.82219 4.90865C1.87019 4.95677 1.92306 4.98083 1.98081 4.98083H12.0192C12.0769 4.98083 12.1298 4.95677 12.1778 4.90865C12.2259 4.86065 12.25 4.80777 12.25 4.75002V2.21165C12.25 2.1539 12.2259 2.10102 12.1778 2.05302C12.1298 2.0049 12.0769 1.98083 12.0192 1.98083Z" fill="#344966"/>
|
|
201
|
+
</svg>
|
|
202
|
+
`,OJ=`
|
|
203
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="17" viewBox="0 0 14 17" fill="none" style="transform: rotate(-90deg); display: inline-block;">
|
|
204
|
+
<path d="M1.75 10.2909L1.75 14.7692C1.75 14.8366 1.77163 14.8919 1.81488 14.9351C1.85813 14.9784 1.91344 15 1.98081 15L12.0192 15C12.0866 15 12.1419 14.9784 12.1851 14.9351C12.2284 14.8919 12.25 14.8366 12.25 14.7692L12.25 10.2909L1.75 10.2909ZM0.625 4.73081C0.625 3.93713 1.75 3.93713 1.75 4.73081L1.75 9.16594L12.25 9.16594L12.25 4.73081C12.25 3.93713 13.375 3.93713 13.375 4.73081L13.375 14.7692C13.375 15.1421 13.2422 15.4613 12.9767 15.7268C12.7112 15.9923 12.3921 16.125 12.0192 16.125L1.98081 16.125C1.60794 16.125 1.28875 15.9923 1.02325 15.7268C0.75775 15.4613 0.624999 15.1421 0.624999 14.7692L0.625 4.73081ZM3.8125 3.93731C3.8125 3.77781 3.86644 3.64425 3.97431 3.53662C4.08206 3.42887 4.21563 3.375 4.375 3.375L6.4375 3.375L6.4375 1.3125C6.4375 1.15312 6.49144 1.01956 6.59931 0.911812C6.70719 0.803937 6.84081 0.75 7.00019 0.75C7.15969 0.75 7.29325 0.803937 7.40088 0.911812C7.50863 1.01956 7.5625 1.15312 7.5625 1.3125L7.5625 3.375L9.625 3.375C9.78438 3.375 9.91794 3.42894 10.0257 3.53681C10.1336 3.64469 10.1875 3.77831 10.1875 3.93769C10.1875 4.09719 10.1336 4.23075 10.0257 4.33837C9.91794 4.44612 9.78438 4.5 9.625 4.5L7.5625 4.5L7.5625 6.5625C7.5625 6.72187 7.50856 6.8555 7.40069 6.96337C7.29281 7.07113 7.15919 7.125 6.99981 7.125C6.84031 7.125 6.70675 7.07113 6.59913 6.96337C6.49138 6.8555 6.4375 6.72187 6.4375 6.5625L6.4375 4.5L4.375 4.5C4.21563 4.5 4.08206 4.44606 3.97431 4.33819C3.86644 4.23031 3.8125 4.09669 3.8125 3.93731Z" fill="#777582"/>
|
|
205
|
+
</svg>
|
|
206
|
+
`,RJ=`
|
|
207
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="17" viewBox="0 0 14 17" fill="none" style="transform: rotate(90deg); display: inline-block;">
|
|
208
|
+
<path d="M1.75 10.2909L1.75 14.7692C1.75 14.8366 1.77163 14.8919 1.81488 14.9351C1.85813 14.9784 1.91344 15 1.98081 15L12.0192 15C12.0866 15 12.1419 14.9784 12.1851 14.9351C12.2284 14.8919 12.25 14.8366 12.25 14.7692L12.25 10.2909L1.75 10.2909ZM0.625 4.73081C0.625 3.93713 1.75 3.93713 1.75 4.73081L1.75 9.16594L12.25 9.16594L12.25 4.73081C12.25 3.93713 13.375 3.93713 13.375 4.73081L13.375 14.7692C13.375 15.1421 13.2422 15.4613 12.9767 15.7268C12.7112 15.9923 12.3921 16.125 12.0192 16.125L1.98081 16.125C1.60794 16.125 1.28875 15.9923 1.02325 15.7268C0.75775 15.4613 0.624999 15.1421 0.624999 14.7692L0.625 4.73081ZM3.8125 3.93731C3.8125 3.77781 3.86644 3.64425 3.97431 3.53662C4.08206 3.42887 4.21563 3.375 4.375 3.375L6.4375 3.375L6.4375 1.3125C6.4375 1.15312 6.49144 1.01956 6.59931 0.911812C6.70719 0.803937 6.84081 0.75 7.00019 0.75C7.15969 0.75 7.29325 0.803937 7.40088 0.911812C7.50863 1.01956 7.5625 1.15312 7.5625 1.3125L7.5625 3.375L9.625 3.375C9.78438 3.375 9.91794 3.42894 10.0257 3.53681C10.1336 3.64469 10.1875 3.77831 10.1875 3.93769C10.1875 4.09719 10.1336 4.23075 10.0257 4.33837C9.91794 4.44612 9.78438 4.5 9.625 4.5L7.5625 4.5L7.5625 6.5625C7.5625 6.72187 7.50856 6.8555 7.40069 6.96337C7.29281 7.07113 7.15919 7.125 6.99981 7.125C6.84031 7.125 6.70675 7.07113 6.59913 6.96337C6.49138 6.8555 6.4375 6.72187 6.4375 6.5625L6.4375 4.5L4.375 4.5C4.21563 4.5 4.08206 4.44606 3.97431 4.33819C3.86644 4.23031 3.8125 4.09669 3.8125 3.93731Z" fill="#777582"/>
|
|
209
|
+
</svg>
|
|
210
|
+
`,MJ=`
|
|
211
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" style="transform: rotate(-90deg); display: inline-block;">
|
|
212
|
+
<path d="M15.375 6.74998C15.375 7.12885 15.2438 7.44954 14.9813 7.71204C14.7188 7.97454 14.3981 8.10579 14.0192 8.10579L3.98081 8.10579C3.60194 8.10579 3.28125 7.97454 3.01875 7.71204C2.75625 7.44954 2.625 7.12885 2.625 6.74998L2.625 4.2116C2.625 3.83273 2.75625 3.51204 3.01875 3.24954C3.28125 2.98704 3.60194 2.85579 3.98081 2.85579L14.0192 2.85579C14.3981 2.85579 14.7188 2.98704 14.9813 3.24954C15.2438 3.51204 15.375 3.83273 15.375 4.2116L15.375 6.74998ZM15.375 13.7884C15.375 14.1672 15.2438 14.4879 14.9813 14.7504C14.7188 15.0129 14.3981 15.1442 14.0192 15.1442L3.98081 15.1442C3.60194 15.1442 3.28125 15.0129 3.01875 14.7504C2.75625 14.4879 2.625 14.1672 2.625 13.7884L2.625 11.25C2.625 10.8711 2.75625 10.5504 3.01875 10.2879C3.28125 10.0254 3.60194 9.89416 3.98081 9.89416L14.0192 9.89416C14.3981 9.89416 14.7188 10.0254 14.9813 10.2879C15.2438 10.5504 15.375 10.8711 15.375 11.25L15.375 13.7884ZM3.98081 14.0192L14.0192 14.0192C14.0769 14.0192 14.1298 13.9951 14.1778 13.947C14.2259 13.899 14.25 13.8461 14.25 13.7884L14.25 11.25C14.25 11.1922 14.2259 11.1394 14.1778 11.0914C14.1298 11.0432 14.0769 11.0192 14.0192 11.0192L3.98081 11.0192C3.92306 11.0192 3.87019 11.0432 3.82219 11.0914C3.77406 11.1394 3.75 11.1922 3.75 11.25L3.75 13.7884C3.75 13.8461 3.77406 13.899 3.82219 13.947C3.87019 13.9951 3.92306 14.0192 3.98081 14.0192Z" fill="#777582"/>
|
|
213
|
+
<circle cx="9" cy="9" r="4" transform="rotate(-90 9 9)" fill="white"/>
|
|
214
|
+
<path d="M9.55102 9.55102L9.55102 11.449C9.55102 11.6051 9.49818 11.7359 9.39251 11.8415C9.28684 11.9472 9.15594 12 8.99982 12C8.84357 12 8.71273 11.9472 8.60731 11.8415C8.50175 11.7359 8.44898 11.6051 8.44898 11.449L8.44898 9.55102L6.55102 9.55102C6.3949 9.55102 6.26406 9.49818 6.15851 9.39251C6.05284 9.28684 6 9.15594 6 8.99982C6 8.84357 6.05284 8.71273 6.15851 8.60731C6.26406 8.50175 6.3949 8.44898 6.55102 8.44898L8.44898 8.44898L8.44898 6.55102C8.44898 6.3949 8.50182 6.26406 8.60749 6.15851C8.71316 6.05284 8.84406 6 9.00018 6C9.15643 6 9.28727 6.05284 9.39269 6.15851C9.49825 6.26406 9.55102 6.3949 9.55102 6.55102L9.55102 8.44898L11.449 8.44898C11.6051 8.44898 11.7359 8.50182 11.8415 8.60749C11.9472 8.71316 12 8.84406 12 9.00018C12 9.15643 11.9472 9.28727 11.8415 9.39269C11.7359 9.49824 11.6051 9.55102 11.449 9.55102L9.55102 9.55102Z" fill="#777582"/>
|
|
215
|
+
</svg>
|
|
216
|
+
`,PJ=`
|
|
217
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="17" viewBox="0 0 14 17" fill="none">
|
|
218
|
+
<path d="M1.75 10.2909L1.75 14.7692C1.75 14.8366 1.77163 14.8919 1.81488 14.9351C1.85813 14.9784 1.91344 15 1.98081 15L12.0192 15C12.0866 15 12.1419 14.9784 12.1851 14.9351C12.2284 14.8919 12.25 14.8366 12.25 14.7692L12.25 10.2909L1.75 10.2909ZM0.625 4.73081C0.625 3.93713 1.75 3.93713 1.75 4.73081L1.75 9.16594L12.25 9.16594L12.25 4.73081C12.25 3.93713 13.375 3.93713 13.375 4.73081L13.375 14.7692C13.375 15.1421 13.2422 15.4613 12.9767 15.7268C12.7112 15.9923 12.3921 16.125 12.0192 16.125L1.98081 16.125C1.60794 16.125 1.28875 15.9923 1.02325 15.7268C0.75775 15.4613 0.624999 15.1421 0.624999 14.7692L0.625 4.73081ZM3.8125 3.93731C3.8125 3.77781 3.86644 3.64425 3.97431 3.53662C4.08206 3.42887 4.21563 3.375 4.375 3.375L6.4375 3.375L6.4375 1.3125C6.4375 1.15312 6.49144 1.01956 6.59931 0.911812C6.70719 0.803937 6.84081 0.75 7.00019 0.75C7.15969 0.75 7.29325 0.803937 7.40088 0.911812C7.50863 1.01956 7.5625 1.15312 7.5625 1.3125L7.5625 3.375L9.625 3.375C9.78438 3.375 9.91794 3.42894 10.0257 3.53681C10.1336 3.64469 10.1875 3.77831 10.1875 3.93769C10.1875 4.09719 10.1336 4.23075 10.0257 4.33837C9.91794 4.44612 9.78438 4.5 9.625 4.5L7.5625 4.5L7.5625 6.5625C7.5625 6.72187 7.50856 6.8555 7.40069 6.96337C7.29281 7.07113 7.15919 7.125 6.99981 7.125C6.84031 7.125 6.70675 7.07113 6.59913 6.96337C6.49138 6.8555 6.4375 6.72187 6.4375 6.5625L6.4375 4.5L4.375 4.5C4.21563 4.5 4.08206 4.44606 3.97431 4.33819C3.86644 4.23031 3.8125 4.09669 3.8125 3.93731Z" fill="#777582"/>
|
|
219
|
+
</svg>
|
|
220
|
+
`,IJ=`
|
|
221
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="17" viewBox="0 0 14 17" fill="none" style="transform: rotate(180deg); display: inline-block;">
|
|
222
|
+
<path d="M1.75 10.2909L1.75 14.7692C1.75 14.8366 1.77163 14.8919 1.81488 14.9351C1.85813 14.9784 1.91344 15 1.98081 15L12.0192 15C12.0866 15 12.1419 14.9784 12.1851 14.9351C12.2284 14.8919 12.25 14.8366 12.25 14.7692L12.25 10.2909L1.75 10.2909ZM0.625 4.73081C0.625 3.93713 1.75 3.93713 1.75 4.73081L1.75 9.16594L12.25 9.16594L12.25 4.73081C12.25 3.93713 13.375 3.93713 13.375 4.73081L13.375 14.7692C13.375 15.1421 13.2422 15.4613 12.9767 15.7268C12.7112 15.9923 12.3921 16.125 12.0192 16.125L1.98081 16.125C1.60794 16.125 1.28875 15.9923 1.02325 15.7268C0.75775 15.4613 0.624999 15.1421 0.624999 14.7692L0.625 4.73081ZM3.8125 3.93731C3.8125 3.77781 3.86644 3.64425 3.97431 3.53662C4.08206 3.42887 4.21563 3.375 4.375 3.375L6.4375 3.375L6.4375 1.3125C6.4375 1.15312 6.49144 1.01956 6.59931 0.911812C6.70719 0.803937 6.84081 0.75 7.00019 0.75C7.15969 0.75 7.29325 0.803937 7.40088 0.911812C7.50863 1.01956 7.5625 1.15312 7.5625 1.3125L7.5625 3.375L9.625 3.375C9.78438 3.375 9.91794 3.42894 10.0257 3.53681C10.1336 3.64469 10.1875 3.77831 10.1875 3.93769C10.1875 4.09719 10.1336 4.23075 10.0257 4.33837C9.91794 4.44612 9.78438 4.5 9.625 4.5L7.5625 4.5L7.5625 6.5625C7.5625 6.72187 7.50856 6.8555 7.40069 6.96337C7.29281 7.07113 7.15919 7.125 6.99981 7.125C6.84031 7.125 6.70675 7.07113 6.59913 6.96337C6.49138 6.8555 6.4375 6.72187 6.4375 6.5625L6.4375 4.5L4.375 4.5C4.21563 4.5 4.08206 4.44606 3.97431 4.33819C3.86644 4.23031 3.8125 4.09669 3.8125 3.93731Z" fill="#777582"/>
|
|
223
|
+
</svg>
|
|
224
|
+
`,DJ=`
|
|
225
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" style="transform: rotate(90deg); display: inline-block;">
|
|
226
|
+
<path d="M15.375 6.74998C15.375 7.12885 15.2438 7.44954 14.9813 7.71204C14.7188 7.97454 14.3981 8.10579 14.0192 8.10579L3.98081 8.10579C3.60194 8.10579 3.28125 7.97454 3.01875 7.71204C2.75625 7.44954 2.625 7.12885 2.625 6.74998L2.625 4.2116C2.625 3.83273 2.75625 3.51204 3.01875 3.24954C3.28125 2.98704 3.60194 2.85579 3.98081 2.85579L14.0192 2.85579C14.3981 2.85579 14.7188 2.98704 14.9813 3.24954C15.2438 3.51204 15.375 3.83273 15.375 4.2116L15.375 6.74998ZM15.375 13.7884C15.375 14.1672 15.2438 14.4879 14.9813 14.7504C14.7188 15.0129 14.3981 15.1442 14.0192 15.1442L3.98081 15.1442C3.60194 15.1442 3.28125 15.0129 3.01875 14.7504C2.75625 14.4879 2.625 14.1672 2.625 13.7884L2.625 11.25C2.625 10.8711 2.75625 10.5504 3.01875 10.2879C3.28125 10.0254 3.60194 9.89416 3.98081 9.89416L14.0192 9.89416C14.3981 9.89416 14.7188 10.0254 14.9813 10.2879C15.2438 10.5504 15.375 10.8711 15.375 11.25L15.375 13.7884ZM3.98081 14.0192L14.0192 14.0192C14.0769 14.0192 14.1298 13.9951 14.1778 13.947C14.2259 13.899 14.25 13.8461 14.25 13.7884L14.25 11.25C14.25 11.1922 14.2259 11.1394 14.1778 11.0914C14.1298 11.0432 14.0769 11.0192 14.0192 11.0192L3.98081 11.0192C3.92306 11.0192 3.87019 11.0432 3.82219 11.0914C3.77406 11.1394 3.75 11.1922 3.75 11.25L3.75 13.7884C3.75 13.8461 3.77406 13.899 3.82219 13.947C3.87019 13.9951 3.92306 14.0192 3.98081 14.0192Z" fill="#777582"/>
|
|
227
|
+
<circle cx="9" cy="9" r="4" transform="rotate(-90 9 9)" fill="white"/>
|
|
228
|
+
<path d="M9.55102 9.55102L9.55102 11.449C9.55102 11.6051 9.49818 11.7359 9.39251 11.8415C9.28684 11.9472 9.15594 12 8.99982 12C8.84357 12 8.71273 11.9472 8.60731 11.8415C8.50175 11.7359 8.44898 11.6051 8.44898 11.449L8.44898 9.55102L6.55102 9.55102C6.3949 9.55102 6.26406 9.49818 6.15851 9.39251C6.05284 9.28684 6 9.15594 6 8.99982C6 8.84357 6.05284 8.71273 6.15851 8.60731C6.26406 8.50175 6.3949 8.44898 6.55102 8.44898L8.44898 8.44898L8.44898 6.55102C8.44898 6.3949 8.50182 6.26406 8.60749 6.15851C8.71316 6.05284 8.84406 6 9.00018 6C9.15643 6 9.28727 6.05284 9.39269 6.15851C9.49825 6.26406 9.55102 6.3949 9.55102 6.55102L9.55102 8.44898L11.449 8.44898C11.6051 8.44898 11.7359 8.50182 11.8415 8.60749C11.9472 8.71316 12 8.84406 12 9.00018C12 9.15643 11.9472 9.28727 11.8415 9.39269C11.7359 9.49824 11.6051 9.55102 11.449 9.55102L9.55102 9.55102Z" fill="#777582"/>
|
|
229
|
+
</svg>
|
|
230
|
+
`,BJ=`
|
|
231
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
|
232
|
+
<path d="M15.375 6.74998C15.375 7.12885 15.2438 7.44954 14.9813 7.71204C14.7188 7.97454 14.3981 8.10579 14.0192 8.10579L3.98081 8.10579C3.60194 8.10579 3.28125 7.97454 3.01875 7.71204C2.75625 7.44954 2.625 7.12885 2.625 6.74998L2.625 4.2116C2.625 3.83273 2.75625 3.51204 3.01875 3.24954C3.28125 2.98704 3.60194 2.85579 3.98081 2.85579L14.0192 2.85579C14.3981 2.85579 14.7188 2.98704 14.9813 3.24954C15.2438 3.51204 15.375 3.83273 15.375 4.2116L15.375 6.74998ZM15.375 13.7884C15.375 14.1672 15.2438 14.4879 14.9813 14.7504C14.7188 15.0129 14.3981 15.1442 14.0192 15.1442L3.98081 15.1442C3.60194 15.1442 3.28125 15.0129 3.01875 14.7504C2.75625 14.4879 2.625 14.1672 2.625 13.7884L2.625 11.25C2.625 10.8711 2.75625 10.5504 3.01875 10.2879C3.28125 10.0254 3.60194 9.89416 3.98081 9.89416L14.0192 9.89416C14.3981 9.89416 14.7188 10.0254 14.9813 10.2879C15.2438 10.5504 15.375 10.8711 15.375 11.25L15.375 13.7884ZM3.98081 14.0192L14.0192 14.0192C14.0769 14.0192 14.1298 13.9951 14.1778 13.947C14.2259 13.899 14.25 13.8461 14.25 13.7884L14.25 11.25C14.25 11.1922 14.2259 11.1394 14.1778 11.0914C14.1298 11.0432 14.0769 11.0192 14.0192 11.0192L3.98081 11.0192C3.92306 11.0192 3.87019 11.0432 3.82219 11.0914C3.77406 11.1394 3.75 11.1922 3.75 11.25L3.75 13.7884C3.75 13.8461 3.77406 13.899 3.82219 13.947C3.87019 13.9951 3.92306 14.0192 3.98081 14.0192Z" fill="#777582"/>
|
|
233
|
+
<circle cx="9" cy="9" r="4" transform="rotate(-90 9 9)" fill="white"/>
|
|
234
|
+
<path d="M9.55102 9.55102L9.55102 11.449C9.55102 11.6051 9.49818 11.7359 9.39251 11.8415C9.28684 11.9472 9.15594 12 8.99982 12C8.84357 12 8.71273 11.9472 8.60731 11.8415C8.50175 11.7359 8.44898 11.6051 8.44898 11.449L8.44898 9.55102L6.55102 9.55102C6.3949 9.55102 6.26406 9.49818 6.15851 9.39251C6.05284 9.28684 6 9.15594 6 8.99982C6 8.84357 6.05284 8.71273 6.15851 8.60731C6.26406 8.50175 6.3949 8.44898 6.55102 8.44898L8.44898 8.44898L8.44898 6.55102C8.44898 6.3949 8.50182 6.26406 8.60749 6.15851C8.71316 6.05284 8.84406 6 9.00018 6C9.15643 6 9.28727 6.05284 9.39269 6.15851C9.49825 6.26406 9.55102 6.3949 9.55102 6.55102L9.55102 8.44898L11.449 8.44898C11.6051 8.44898 11.7359 8.50182 11.8415 8.60749C11.9472 8.71316 12 8.84406 12 9.00018C12 9.15643 11.9472 9.28727 11.8415 9.39269C11.7359 9.49824 11.6051 9.55102 11.449 9.55102L9.55102 9.55102Z" fill="#777582"/>
|
|
235
|
+
</svg>
|
|
236
|
+
`,HJ=`
|
|
237
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" style="transform: rotate(180deg); display: inline-block;">
|
|
238
|
+
<path d="M15.375 6.74998C15.375 7.12885 15.2438 7.44954 14.9813 7.71204C14.7188 7.97454 14.3981 8.10579 14.0192 8.10579L3.98081 8.10579C3.60194 8.10579 3.28125 7.97454 3.01875 7.71204C2.75625 7.44954 2.625 7.12885 2.625 6.74998L2.625 4.2116C2.625 3.83273 2.75625 3.51204 3.01875 3.24954C3.28125 2.98704 3.60194 2.85579 3.98081 2.85579L14.0192 2.85579C14.3981 2.85579 14.7188 2.98704 14.9813 3.24954C15.2438 3.51204 15.375 3.83273 15.375 4.2116L15.375 6.74998ZM15.375 13.7884C15.375 14.1672 15.2438 14.4879 14.9813 14.7504C14.7188 15.0129 14.3981 15.1442 14.0192 15.1442L3.98081 15.1442C3.60194 15.1442 3.28125 15.0129 3.01875 14.7504C2.75625 14.4879 2.625 14.1672 2.625 13.7884L2.625 11.25C2.625 10.8711 2.75625 10.5504 3.01875 10.2879C3.28125 10.0254 3.60194 9.89416 3.98081 9.89416L14.0192 9.89416C14.3981 9.89416 14.7188 10.0254 14.9813 10.2879C15.2438 10.5504 15.375 10.8711 15.375 11.25L15.375 13.7884ZM3.98081 14.0192L14.0192 14.0192C14.0769 14.0192 14.1298 13.9951 14.1778 13.947C14.2259 13.899 14.25 13.8461 14.25 13.7884L14.25 11.25C14.25 11.1922 14.2259 11.1394 14.1778 11.0914C14.1298 11.0432 14.0769 11.0192 14.0192 11.0192L3.98081 11.0192C3.92306 11.0192 3.87019 11.0432 3.82219 11.0914C3.77406 11.1394 3.75 11.1922 3.75 11.25L3.75 13.7884C3.75 13.8461 3.77406 13.899 3.82219 13.947C3.87019 13.9951 3.92306 14.0192 3.98081 14.0192Z" fill="#777582"/>
|
|
239
|
+
<circle cx="9" cy="9" r="4" transform="rotate(-90 9 9)" fill="white"/>
|
|
240
|
+
<path d="M9.55102 9.55102L9.55102 11.449C9.55102 11.6051 9.49818 11.7359 9.39251 11.8415C9.28684 11.9472 9.15594 12 8.99982 12C8.84357 12 8.71273 11.9472 8.60731 11.8415C8.50175 11.7359 8.44898 11.6051 8.44898 11.449L8.44898 9.55102L6.55102 9.55102C6.3949 9.55102 6.26406 9.49818 6.15851 9.39251C6.05284 9.28684 6 9.15594 6 8.99982C6 8.84357 6.05284 8.71273 6.15851 8.60731C6.26406 8.50175 6.3949 8.44898 6.55102 8.44898L8.44898 8.44898L8.44898 6.55102C8.44898 6.3949 8.50182 6.26406 8.60749 6.15851C8.71316 6.05284 8.84406 6 9.00018 6C9.15643 6 9.28727 6.05284 9.39269 6.15851C9.49825 6.26406 9.55102 6.3949 9.55102 6.55102L9.55102 8.44898L11.449 8.44898C11.6051 8.44898 11.7359 8.50182 11.8415 8.60749C11.9472 8.71316 12 8.84406 12 9.00018C12 9.15643 11.9472 9.28727 11.8415 9.39269C11.7359 9.49824 11.6051 9.55102 11.449 9.55102L9.55102 9.55102Z" fill="#777582"/>
|
|
241
|
+
</svg>
|
|
242
|
+
`,FJ=`
|
|
243
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
|
244
|
+
<path d="M3 9H3.00666M5.99833 9H6.005M11.995 9H12.0017M8.99667 9H9.00333M14.9933 9H15M14.9933 15V14.4667C14.9933 13.7199 14.9933 13.3465 14.8481 13.0613C14.7204 12.8105 14.5165 12.6065 14.2657 12.4787C13.9807 12.3333 13.6075 12.3333 12.8612 12.3333H5.13215C4.38583 12.3333 4.01266 12.3333 3.72761 12.4787C3.47687 12.6065 3.273 12.8105 3.14525 13.0613C3 13.3465 3 13.7199 3 14.4667V15M14.9933 3V3.53333C14.9933 4.28007 14.9933 4.65344 14.8481 4.93865C14.7204 5.18954 14.5165 5.39351 14.2657 5.52134C13.9807 5.66667 13.6075 5.66667 12.8612 5.66667H5.13215C4.38583 5.66667 4.01266 5.66667 3.72761 5.52134C3.47686 5.39351 3.273 5.18954 3.14525 4.93865C3 4.65344 3 4.28007 3 3.53333V3" stroke="#777582" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
|
|
245
|
+
</svg>
|
|
246
|
+
`,$J=`
|
|
247
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" style="transform: rotate(90deg); display: inline-block;">
|
|
248
|
+
<path d="M3 9H3.00666M5.99833 9H6.005M11.995 9H12.0017M8.99667 9H9.00333M14.9933 9H15M14.9933 15V14.4667C14.9933 13.7199 14.9933 13.3465 14.8481 13.0613C14.7204 12.8105 14.5165 12.6065 14.2657 12.4787C13.9807 12.3333 13.6075 12.3333 12.8612 12.3333H5.13215C4.38583 12.3333 4.01266 12.3333 3.72761 12.4787C3.47687 12.6065 3.273 12.8105 3.14525 13.0613C3 13.3465 3 13.7199 3 14.4667V15M14.9933 3V3.53333C14.9933 4.28007 14.9933 4.65344 14.8481 4.93865C14.7204 5.18954 14.5165 5.39351 14.2657 5.52134C13.9807 5.66667 13.6075 5.66667 12.8612 5.66667H5.13215C4.38583 5.66667 4.01266 5.66667 3.72761 5.52134C3.47686 5.39351 3.273 5.18954 3.14525 4.93865C3 4.65344 3 4.28007 3 3.53333V3" stroke="#777582" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
|
|
249
|
+
</svg>
|
|
250
|
+
`,Ak=`
|
|
251
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
|
252
|
+
<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"/>
|
|
253
|
+
</svg>
|
|
254
|
+
`,Qu=e=>(t,{cellId:n,selected:r})=>r.length?Tp(t,n,r):_V(t,n,e),kk={"add-left-column":(e,{cellId:t})=>oT(e,t,"left"),"add-right-column":(e,{cellId:t})=>oT(e,t,"right"),"merge-right-cell":Qu("right"),"merge-left-cell":Qu("left"),"split-vertical-cell":(e,{cellId:t})=>aT(e,t,"cols"),"remove-column":(e,{cellId:t})=>hV(e,t),"add-top-row":(e,{cellId:t})=>nT(e,t,"above"),"add-bottom-row":(e,{cellId:t})=>nT(e,t,"below"),"merge-top-cell":Qu("top"),"merge-bottom-cell":Qu("bottom"),"split-horizontal-cell":(e,{cellId:t})=>aT(e,t,"rows"),"remove-row":(e,{cellId:t})=>mV(e,t)};function WJ(e,t,n){const r=t.cells.find(i=>i.id===n);if(r)return{row:r.row,col:r.col};const o=e.cells.find(i=>i.id===n);return{row:Math.max(0,Math.min(o?.row??0,t.rows-1)),col:Math.max(0,Math.min(o?.col??0,t.cols-1))}}var qJ=[{group:"columns",icon:NJ,localeKey:"TABLE_MENU_COLUMNS"},{group:"rows",icon:xJ,localeKey:"TABLE_MENU_ROWS"}],Lk=[{group:"columns",id:"add-left-column",icon:OJ,localeKey:"INSERT_COLUMN_BEFORE_TABLE"},{group:"columns",id:"add-right-column",icon:RJ,localeKey:"INSERT_COLUMN_AFTER_TABLE"},{group:"columns",id:"merge-right-cell",icon:DJ,localeKey:"MERGE_RIGHT_CELL_TABLE"},{group:"columns",id:"merge-left-cell",icon:MJ,localeKey:"MERGE_LEFT_CELL_TABLE"},{group:"columns",id:"split-vertical-cell",icon:$J,localeKey:"SPLIT_CELL_TABLE"},{group:"columns",id:"remove-column",icon:Ak,localeKey:"REMOVE_COLUMN_TABLE"},{group:"rows",id:"add-top-row",icon:PJ,localeKey:"INSERT_ROW_BEFORE_TABLE"},{group:"rows",id:"add-bottom-row",icon:IJ,localeKey:"INSERT_ROW_AFTER_TABLE"},{group:"rows",id:"merge-top-cell",icon:BJ,localeKey:"MERGE_TOP_CELL_TABLE"},{group:"rows",id:"merge-bottom-cell",icon:HJ,localeKey:"MERGE_BOTTOM_CELL_TABLE"},{group:"rows",id:"split-horizontal-cell",icon:FJ,localeKey:"SPLIT_CELL_TABLE"},{group:"rows",id:"remove-row",icon:Ak,localeKey:"REMOVE_ROW_TABLE"}],Nk={left:"merge-left-cell",right:"merge-right-cell",top:"merge-top-cell",bottom:"merge-bottom-cell"},zJ={row:["add-left-column","add-right-column","remove-column"],col:["add-top-row","add-bottom-row","remove-row"]};function UJ(e){const t=e==="left"||e==="right"?"row":"col";return[...Object.values(Nk).filter(n=>n!==Nk[e]),...zJ[t]]}function jJ(e,t,n,r){const o=r&&n.length?UJ(r):[],i=r?n:[];return new Set(Lk.map(s=>s.id).filter(s=>!o.includes(s)&&!_p(kk[s](e,{cellId:t,selected:i}))))}var VJ="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;",GJ="cursor: pointer; flex: 1; margin: auto; padding-top: 2px;",XJ="display: none; position: absolute; top: -3px; left: 0; width: 24px; background: #FFFFFF; border: 1px solid #ccc; box-shadow: 0 2px 5px rgba(0,0,0,0.2); border-radius: 5px; z-index: 1000; list-style: none; padding: 5px 0; margin: 0; text-align: left;",KJ="padding: 3px; cursor: pointer; font-size: 14px; background-color: #E2DEDD; border-radius: 5px; margin: 1px; margin-top: -4px",YJ="cursor: pointer; margin: auto; margin-top: 5px";function Ju(e,t){return B({...t,targetElement:e,insertType:"append"})}function $a(e){Dt(e)}function ZJ(){const e=Wi(),t=B({className:ea,style:VJ});for(const{group:n,icon:r,localeKey:o}of qJ){const i=Ju(t,{className:`${ea}-group`,style:GJ,HTMLcontent:r,title:e[o]});i.setAttribute("data-group",n);const s=Ju(i,{tag:"ul",className:`${ea}-list`,style:XJ});Ju(s,{tag:"li",className:`${ea}-head`,style:KJ,HTMLcontent:r});for(const a of Lk.filter(l=>l.group===n))Ju(s,{tag:"li",className:`${ea}-item`,style:YJ,HTMLcontent:a.icon,title:e[a.localeKey],"data-id":a.id})}return t}function QJ(e){return e.querySelector(":scope > ul")}function JJ(e,{target:t,selection:n}){const r=n.base(),o=Mi(t.table),i=r&&Ca(t.table,r);if(!i)return!1;const s=n.selected().map(l=>Ca(t.table,l)).filter(l=>!!l),a=jJ(o,i,s,n.direction());return e.querySelectorAll("[data-id]").forEach(l=>{l.style.display=a.has(l.getAttribute("data-id"))?"block":"none"}),!0}function xk(e,t){e.querySelectorAll(":scope > div > ul").forEach(n=>{n!==t&&(n.style.display="none")})}function eee(e,t){e.stopPropagation(),e.preventDefault();const n=e.target instanceof Element?e.target:null,r=n?.closest("[data-id]");if(r){t.choose(r.getAttribute("data-id"));return}const o=n?.closest("[data-group]");o&&!n?.closest("ul")&&$a(()=>t.show(o))}function tee(e,t){e.addEventListener("click",ht(n=>eee(n,t))),e.querySelectorAll("[data-group]").forEach(n=>{n.addEventListener("mouseenter",ht(()=>$a(()=>t.show(n)))),n.addEventListener("mouseleave",ht(()=>$a(()=>t.hide())))})}function nee(e){let t=null,n=!1;const r=()=>{const s=t?.root;t=null,s&&$a(()=>s.remove())},o={show(s){const a=QJ(s);if(!t||!a||e.isEditLocked()||!JJ(a,t)){r();return}xk(t.root,a),a.style.display="block"},hide(){t&&xk(t.root)},choose(s){const a=t;r(),a&&e.run(s,a.target,a.selection)}},i=ht(s=>{const a=t?.target.table;a&&(!a.isConnected||!(s.target instanceof Node)||!a.contains(s.target))&&r()});return document.addEventListener("click",i),{open(s,a){if(r(),n||e.isEditLocked())return;const l=ZJ();qf(l),tee(l,o),t={root:l,target:s,selection:a},$a(()=>s.table.append(l))},close:r,destroy(){r(),n=!0,document.removeEventListener("click",i)}}}function ree(e,t){return t.map(n=>Ca(e,n)).filter(n=>!!n)}function oee(e,t){const n=Mi(e).grid[t.row]?.[t.col];return n&&wp(e,n)||null}function iee(e,t,n,r){const o=oee(t.table,e);o&&(n.start(o),r.reopen({...t,td:o},n),r.applicationElementSettingsSet({elem:o}))}function see(e,t,n,r){const o=n.base();if(!o)return qu(Zr("no-cell"));const i={},s=CA(t.table,{isEditLocked:r.isEditLocked,tableModelToHtml:J0},{movesCells:!0,edit:a=>{const l=Mi(a),c=Ca(a,o);if(!c)return Zr("no-cell");const u=kk[e](l,{cellId:c,selected:ree(a,n.selected())});return _p(u)||(i.focus=WJ(l,u,c)),u}});if(s.status==="rejected"){if(s.reason!=="locked")throw new Error(`tableMenu: refused "${e}" (${s.reason})`);return s}return r.commit(),i.focus&&iee(i.focus,t,n,r),s}var aee=".em-element-custom-table";function lee(e,t){let n=t.closest("td, th");for(;n&&e.contains(n);){if(n.parentElement?.closest("table")===e)return n;n=n.parentElement?.closest("td, th")??null}return null}function cee(e){return e.closest('[em="block"]')??e}function Ng(e){if(!(e instanceof Element)||e.closest(".em-table-menu"))return null;const t=e.closest(aee),n=t&&lee(t,e);return t&&n?{table:t,td:n,block:cee(t)}:null}function uee(e){const t=nee({isEditLocked:e.isEditLocked,run:(n,r,o)=>{see(n,r,o,{...e,reopen:(i,s)=>t.open(i,s)})}});return n=>{const r=Ng(n);if(!r)return!1;const o=e.selections.of(r.table);return o.base()!==r.td&&o.start(r.td),t.open(r,o),!0}}function dee(){bu({scrollTop:V.get("scrollTop")})}function fee(e){const{htmlDocument:t,commit:n}=e,r=()=>({commit:n,setCursorPosition:e.setCursorPosition,scrollTop:V.get("scrollTop"),iframeOffsetTop:V.get("iframeOffsetTop"),applicationElementSettingsSet:e.applicationElementSettingsSet}),o=kJ({getLockEditor:()=>e.editLock.isIntegratorLocked(),setEditorFocus:e.setEditorFocus,setCursorPosition:e.setCursorPosition,getParentElementOfSelection:Jl,findOutermostParentWithText:cm,setBlockGroupControlsPosition:dee,applicationElementSettingsSet:e.applicationElementSettingsSet,insertTextAtomIntoEmptyNarrowTable:e.insertTextAtomIntoEmptyNarrowTable??(()=>!1),handleRemoveAtom:i=>pk(i,{getElementParent:s=>$i(s),setCursorPosition:e.setCursorPosition,getVariableByIcon:pa,commit:n}),handleCloneAtom:i=>vk(i,r()),handleMoveBlockUp:i=>Sk(i,r()),handleMoveBlockDown:i=>wk(i,r()),handleRemoveBlock:i=>Ck(i,r()),handleCloneBlock:i=>Ek(i,r()),handleCopyBlock:(i,s)=>yJ(i,s,{HTMLDocument:t}),handlePasteBlock:(i,s)=>vJ(i,s,{HTMLDocument:t,parseFromString:Ne,getOuterHtml:It,minify:vo,cssbeautify,insertAdjacentHTML:nr,setBlockMaxWidth:a=>og(a,t),setFloatBlocksWidth:a=>ng(a,t),checkBlockAdaptivity:cu,commit:n,setCursorPosition:e.setCursorPosition,emailWidth:V.get("emailWidth"),appName:V.get("appName")}),handleMergeBlocks:i=>lJ(i,r()),handleUnmergeBlocks:i=>cJ(i,r()),isAddBlockMenuClick:gJ,handleAddBlockMenu:(i,s)=>bJ(i,s,{removeAllAttributes:xr,selectionLock:e.selectionLock,commitLockedAsync:e.commitLockedAsync}),addBlockToProject:i=>yj(i,{HTMLDocument:t,messageService:e.messageService}),handleMoveGroupUp:i=>uJ(i,r()),handleMoveGroupDown:i=>dJ(i,r()),handleAddGroup:i=>fJ(i,r()),handleCloneGroup:i=>mJ(i,r()),handleRemoveGroup:i=>hJ(i,r()),isDiscussViewMode:_J,isDiscussSetTargetMode:CJ,handleDiscussViewClick:TJ,handleDiscussSetTargetClick:i=>AJ(i,{makeId:M5,commit:n}),handleCustomTableClick:uee({selections:e.tableSelections,isEditLocked:()=>e.editLock.isTextLocked(),commit:()=>n(),applicationElementSettingsSet:e.applicationElementSettingsSet})});document.onclick=ht(o),LJ({commit:n,messageService:e.messageService})}function Ok(e,t){const n=JSON.stringify({settings:t});return{target:e,dataTransfer:{getData:r=>r==="Text"?n:""},preventDefault:()=>{},stopPropagation:()=>{}}}function mee(e){return!e.closest(".em-element-editor-widget")}function hee(e,t){if(t.lockEditor||!e.isTrusted)return!1;const n=JA();if(!n)return!1;const r=e.target;if(!(r instanceof Element)||!we(r)||!mee(r))return!1;try{if(n.kind==="atom"){const o={settings:{atomHTML:typeof n.settings.atomHTML=="string"?n.settings.atomHTML:n.settings.atomHTML?.html,name:n.settings.name}};if(!o.settings.atomHTML)return!1;uk(Ok(r,o.settings),t.atomDropCtx)}else if(n.kind==="block"&&document.body.classList.contains("em-block-insert-body")){const o={settings:{blockHTML:n.settings.blockHTML,type:n.settings.type,name:n.settings.name,project:n.settings.project,blockId:n.settings.blockId}};if(!o.settings.blockHTML)return!1;lk(Ok(r,o.settings),o,t.blockDropCtx)}else return!1;if(!JA())return e.preventDefault(),e.stopPropagation(),ak(),t.commit(),!0}catch{return!1}return!1}var Rk="application/x-emailmaker-social-reorder";function xg(e){return e.closest('table[em-type="social"]')}function Mk(e){return(e.querySelector('table[role="presentation"]')||e.querySelector("table"))?.querySelector("tr")}function Pk(e){return Array.from(e.querySelectorAll(":scope > td[em-platform], :scope > td[data-em-platform]"))}function pee(e){return Array.from(e.querySelectorAll(":scope > td:not([em-platform]):not([data-em-platform])")).find(t=>{const n=t;return n.getAttribute("width")!=null||n.innerHTML===" "||n.textContent===" "})}function gee(e,t){const n=pee(e);e.replaceChildren(),t.forEach((r,o)=>{o>0&&n&&e.appendChild(n.cloneNode(!0)),r.removeAttribute("em-index"),r.removeAttribute("data-em-index"),e.appendChild(r)})}function bee(e,t){if(t.lockEditor)return;const n=e.target?.closest?.("td[em-platform], td[data-em-platform]");if(!n||n.getAttribute("draggable")!=="true")return;const r=xg(n);if(!r)return;const o=Mk(r);if(!o)return;const i=Pk(o);if(i.length<2)return;const s=i.indexOf(n);if(s<0)return;const a=e.dataTransfer;if(!a)return;const l=String(s);a.setData("text/plain",l),a.setData(Rk,l),a.effectAllowed="move"}function yee(e,t){const n=e.dataTransfer;if(!n||!Array.from(n.types||[]).includes("application/x-emailmaker-social-reorder"))return!1;let r=n.getData(Rk);r||(r=n.getData("text/plain"));const o=parseInt(r,10);if(Number.isNaN(o))return!1;const i=e.target.closest?.("td[em-platform], td[data-em-platform]");if(!i)return!1;const s=xg(i);if(!s)return!1;const a=Mk(s);if(!a)return!1;const l=Pk(a);if(l.length<2)return!1;const c=l.indexOf(i);if(c<0)return!1;const u=l[o];if(!u||xg(u)!==s)return!1;if(o===c)return!0;const d=[...l];return d.splice(o,1),d.splice(c,0,u),gee(a,d),s.setAttribute("em-edit","active"),t.applicationElementSettingsSet({elem:s}),!0}function vee(){return{targetBlock:null,newTargetblock:null,atomReplaced:null}}function Eee(e){const t=document.querySelector(".em-just-inserted");if(!t)return;e.applicationElementSettingsSet({elem:t}),t.classList.remove("em-just-inserted"),e.commit();const n=$p(t);setTimeout(()=>e.messageService.send({operation:"application_open-image-ai-popup",src:n}),1e3)}function See(e,t,n){if(t.editLock.isIntegratorLocked())return;let r;try{e.preventDefault(),e.stopPropagation();const o=EQ(e,{lockEditor:!1,applicationElementSettingsSet:t.applicationElementSettingsSet,messageService:t.messageService})||yee(e,{applicationElementSettingsSet:t.applicationElementSettingsSet});if(r=t.selectionLock.acquire(),!o){if(document.body.classList.contains("em-block-insert-body"))try{const i=JSON.parse(e.dataTransfer?.getData("Text")||"{}");lk(e,i,{...t.blockDropContext(),mutableState:n})}catch{}else if(document.body.classList.contains("em-atom-insert-body")||document.body.classList.contains("em-atom-insert-body-inside"))try{uk(e,{...t.atomDropContext(),mutableState:n})}catch{}}ak(),t.commit()}finally{Promise.resolve().then(()=>{r?.release(),Eee(t)})}}function wee(e){const{dragState:t}=e,n=(r,o,i)=>document.addEventListener(r,ht(o),i);document.addEventListener("drag",r=>r.preventDefault(),!1),n("dragstart",r=>bee(r,{lockEditor:e.editLock.isIntegratorLocked()}),!0),n("dragstart",r=>SQ(r,{lockEditor:e.editLock.isIntegratorLocked(),commit:o=>{e.commit(o)},messageService:e.messageService,mutableState:t}),!1),n("dragover",r=>_Q(r,{lockEditor:e.editLock.isIntegratorLocked(),mutableState:t}),!1),n("dragenter",r=>CQ(r,{lockEditor:e.editLock.isIntegratorLocked(),mutableState:t,requireEvenEmptyCell:e.requireEvenEmptyCell}),!1),n("dragleave",r=>kQ(r,{lockEditor:e.editLock.isIntegratorLocked(),mutableState:t}),!1),n("drop",r=>See(r,e,t),!1),n("dragend",r=>wQ(r,{lockEditor:e.editLock.isIntegratorLocked(),messageService:e.messageService}),!1)}function _ee(e){const{htmlDocument:t}=e,n=f=>e.commit(f),r=vee(),o=e.commonStylesApply??(f=>D0(f,h=>e.commit(h))),i=f=>{o0(f,()=>e.commit())},s=f=>og(f,t),a=f=>ng(f,t),l=()=>({messageService:e.messageService,isJsonString:O5,getOuterHtml:It,minify:vo,cssbeautify,HTMLDocument:t,_setDocumentStyles:(f,h)=>op(f,h),commonStylesApply:o,commonStylesApplyToBlock:hp,setImageWidth:Qh,fitMovedImage:r0,setFloatBlocksWidth:a,fitImagesToColumns:rg,insertCountdown:i}),c=()=>({...l(),lockEditor:e.editLock.isIntegratorLocked(),commit:n,emailWidth:V.get("emailWidth")??null,parseFromString:f=>Ne(f),isTableElement:OO,uptimeCountdown:Jh,setBlockMaxWidth:s,checkBlockAdaptivity:cu,applicationElementSettingsSet:e.applicationElementSettingsSet});return{insertContext:()=>({selectionLock:e.selectionLock,commit:()=>e.commit(),lockEditor:e.editLock.isIntegratorLocked(),emailWidth:V.get("emailWidth"),iframeOffsetTop:V.get("iframeOffsetTop"),previewHeight:V.get("previewHeight"),parseFromString:f=>Ne(f),getOuterHtml:It,HTMLDocument:t,minify:vo,cssbeautify,insertAdjacentHTML:(f,h,m)=>EE(f,h,m),messageService:e.messageService,setDocumentStyles:f=>op(f,{minify:vo,cssbeautify,HTMLDocument:t}),setImageWidth:Qh,commonStylesApply:o,commonStylesApplyToBlock:hp,insertCountdown:i,uptimeCountdown:Jh,setBlockMaxWidth:s,setFloatBlocksWidth:a,fitImagesToColumns:rg,checkBlockAdaptivity:cu,setAtomReplaced:f=>{r.atomReplaced=f},assetsRoot:e.assetsRoot}),register:()=>{document.addEventListener("click",ht(f=>{e.editLock.isIntegratorLocked()||hee(f,{lockEditor:!1,commit:n,atomDropCtx:{...l(),mutableState:r},blockDropCtx:{...c(),mutableState:r}})}),!0),wee({dragState:r,commit:n,messageService:e.messageService,applicationElementSettingsSet:e.applicationElementSettingsSet,selectionLock:e.selectionLock,editLock:e.editLock,atomDropContext:l,blockDropContext:c,requireEvenEmptyCell:e.requireEvenEmptyCell})}}}function Cee(e){let t=!1;const n=o=>{t=!!o.target?.nodeName},r=o=>{t&&e.handlePasteTextFragment(o,!1,e.getCommonStyles(),e.changeMsoValue,()=>{e.commit()})};return document.addEventListener("contextmenu",n),document.addEventListener("paste",r),{setFromContextMenu(o){t=o},dispose(){document.removeEventListener("contextmenu",n),document.removeEventListener("paste",r)}}}var Ik='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 15 4 L 15 24.0625 L 8.21875 17.28125 L 6.78125 18.71875 L 15.28125 27.21875 L 16 27.90625 L 16.71875 27.21875 L 25.21875 18.71875 L 23.78125 17.28125 L 17 24.0625 L 17 4 Z"/></svg>',Dk='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 16 4.09375 L 15.28125 4.78125 L 6.78125 13.28125 L 8.21875 14.71875 L 15 7.9375 L 15 28 L 17 28 L 17 7.9375 L 23.78125 14.71875 L 25.21875 13.28125 L 16.71875 4.78125 Z"/></svg>',Og='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 12 6 C 10.894531 6 10 6.894531 10 8 C 10 9.105469 10.894531 10 12 10 C 13.105469 10 14 9.105469 14 8 C 14 6.894531 13.105469 6 12 6 Z M 20 6 C 18.894531 6 18 6.894531 18 8 C 18 9.105469 18.894531 10 20 10 C 21.105469 10 22 9.105469 22 8 C 22 6.894531 21.105469 6 20 6 Z M 12 14 C 10.894531 14 10 14.894531 10 16 C 10 17.105469 10.894531 18 12 18 C 13.105469 18 14 17.105469 14 16 C 14 14.894531 13.105469 14 12 14 Z M 20 14 C 18.894531 14 18 14.894531 18 16 C 18 17.105469 18.894531 18 20 18 C 21.105469 18 22 17.105469 22 16 C 22 14.894531 21.105469 14 20 14 Z M 12 22 C 10.894531 22 10 22.894531 10 24 C 10 25.105469 10.894531 26 12 26 C 13.105469 26 14 25.105469 14 24 C 14 22.894531 13.105469 22 12 22 Z M 20 22 C 18.894531 22 18 22.894531 18 24 C 18 25.105469 18.894531 26 20 26 C 21.105469 26 22 25.105469 22 24 C 22 22.894531 21.105469 22 20 22 Z"/></svg>',Tee='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 15 3 C 13.742188 3 12.847656 3.890625 12.40625 5 L 5 5 L 5 28 L 13 28 L 13 30 L 27 30 L 27 14 L 25 14 L 25 5 L 17.59375 5 C 17.152344 3.890625 16.257813 3 15 3 Z M 15 5 C 15.554688 5 16 5.445313 16 6 L 16 7 L 19 7 L 19 9 L 11 9 L 11 7 L 14 7 L 14 6 C 14 5.445313 14.445313 5 15 5 Z M 7 7 L 9 7 L 9 11 L 21 11 L 21 7 L 23 7 L 23 14 L 13 14 L 13 26 L 7 26 Z M 15 16 L 25 16 L 25 28 L 15 28 Z"/></svg>',Aee='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 16 2 C 14.742188 2 13.847656 2.890625 13.40625 4 L 5 4 L 5 29 L 27 29 L 27 4 L 18.59375 4 C 18.152344 2.890625 17.257813 2 16 2 Z M 16 4 C 16.554688 4 17 4.445313 17 5 L 17 6 L 20 6 L 20 8 L 12 8 L 12 6 L 15 6 L 15 5 C 15 4.445313 15.445313 4 16 4 Z M 7 6 L 10 6 L 10 10 L 22 10 L 22 6 L 25 6 L 25 27 L 7 27 Z M 21.28125 13.28125 L 15 19.5625 L 11.71875 16.28125 L 10.28125 17.71875 L 14.28125 21.71875 L 15 22.40625 L 15.71875 21.71875 L 22.71875 14.71875 Z"/></svg>',ed='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 4 4 L 4 24 L 11 24 L 11 22 L 6 22 L 6 6 L 18 6 L 18 7 L 20 7 L 20 4 Z M 12 8 L 12 28 L 28 28 L 28 8 Z M 14 10 L 26 10 L 26 26 L 14 26 Z"/></svg>',kee='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 5 5 L 5 9 L 6 9 L 6 23 L 5 23 L 5 27 L 9 27 L 9 26 L 23 26 L 23 27 L 27 27 L 27 23 L 26 23 L 26 9 L 27 9 L 27 5 L 23 5 L 23 6 L 9 6 L 9 5 Z M 9 8 L 23 8 L 23 9 L 24 9 L 24 23 L 23 23 L 23 24 L 9 24 L 9 23 L 8 23 L 8 9 L 9 9 Z M 10 10 L 10 18 L 14 18 L 14 22 L 22 22 L 22 14 L 18 14 L 18 10 Z M 12 12 L 16 12 L 16 16 L 12 16 Z M 18 16 L 20 16 L 20 20 L 16 20 L 16 18 L 18 18 Z"/></svg>',Lee='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 5 5 L 5 9 L 6 9 L 6 19 L 5 19 L 5 23 L 9 23 L 9 22 L 11 22 L 11 24 L 10 24 L 10 28 L 14 28 L 14 27 L 24 27 L 24 28 L 28 28 L 28 24 L 27 24 L 27 14 L 28 14 L 28 10 L 24 10 L 24 11 L 22 11 L 22 9 L 23 9 L 23 5 L 19 5 L 19 6 L 9 6 L 9 5 Z M 9 8 L 19 8 L 19 9 L 20 9 L 20 19 L 19 19 L 19 20 L 9 20 L 9 19 L 8 19 L 8 9 L 9 9 Z M 22 13 L 24 13 L 24 14 L 25 14 L 25 24 L 24 24 L 24 25 L 14 25 L 14 24 L 13 24 L 13 22 L 19 22 L 19 23 L 23 23 L 23 19 L 22 19 Z"/></svg>',Wa='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 23.90625 3.96875 C 22.859375 3.96875 21.8125 4.375 21 5.1875 L 5.1875 21 L 5.125 21.3125 L 4.03125 26.8125 L 3.71875 28.28125 L 5.1875 27.96875 L 10.6875 26.875 L 11 26.8125 L 26.8125 11 C 28.4375 9.375 28.4375 6.8125 26.8125 5.1875 C 26 4.375 24.953125 3.96875 23.90625 3.96875 Z M 23.90625 5.875 C 24.410156 5.875 24.917969 6.105469 25.40625 6.59375 C 26.378906 7.566406 26.378906 8.621094 25.40625 9.59375 L 24.6875 10.28125 L 21.71875 7.3125 L 22.40625 6.59375 C 22.894531 6.105469 23.402344 5.875 23.90625 5.875 Z M 20.3125 8.71875 L 23.28125 11.6875 L 11.1875 23.78125 C 10.53125 22.5 9.5 21.46875 8.21875 20.8125 Z M 6.9375 22.4375 C 8.136719 22.921875 9.078125 23.863281 9.5625 25.0625 L 6.28125 25.71875 Z"/></svg>',Bk='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 15 5 L 15 15 L 5 15 L 5 17 L 15 17 L 15 27 L 17 27 L 17 17 L 27 17 L 27 15 L 17 15 L 17 5 Z"/></svg>',Nee='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 5 5 L 5 27 L 27 27 L 27 9.59375 L 26.71875 9.28125 L 22.71875 5.28125 L 22.40625 5 Z M 7 7 L 10 7 L 10 13 L 22 13 L 22 7.4375 L 25 10.4375 L 25 25 L 23 25 L 23 16 L 9 16 L 9 25 L 7 25 Z M 12 7 L 16 7 L 16 9 L 18 9 L 18 7 L 20 7 L 20 11 L 12 11 Z M 11 18 L 21 18 L 21 25 L 11 25 Z"/></svg>',Rg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 15 4 C 14.476563 4 13.941406 4.183594 13.5625 4.5625 C 13.183594 4.941406 13 5.476563 13 6 L 13 7 L 7 7 L 7 9 L 8 9 L 8 25 C 8 26.644531 9.355469 28 11 28 L 23 28 C 24.644531 28 26 26.644531 26 25 L 26 9 L 27 9 L 27 7 L 21 7 L 21 6 C 21 5.476563 20.816406 4.941406 20.4375 4.5625 C 20.058594 4.183594 19.523438 4 19 4 Z M 15 6 L 19 6 L 19 7 L 15 7 Z M 10 9 L 24 9 L 24 25 C 24 25.554688 23.554688 26 23 26 L 11 26 C 10.445313 26 10 25.554688 10 25 Z M 12 12 L 12 23 L 14 23 L 14 12 Z M 16 12 L 16 23 L 18 23 L 18 12 Z M 20 12 L 20 23 L 22 23 L 22 12 Z"/></svg>';function Re(e,t,n=""){const r=`class="${t}" width="1em" height="1em" fill="currentColor" aria-hidden="true"`;return e.replace("<svg",`<svg ${r}${n?` ${n}`:""}`)}var td={getLocale:Wi,commit:uo},xee=".em-prevent-action";function Oee(){return V.get("emailWidth")||475}function Ree(){return V.get("copyPasteEnabled")||!1}function Mee(){return V.get("saveBlockEnabled")||!1}function Pee(){return V.get("blocksAddPanelEnabled")||!1}function Iee(){return V.get("blocksTemplateEnabled")||!1}function Dee(){return V.get("codeMode")||!1}var Hk=".em-mob-wrap, .noresp-em-mob-wrap";function Fk(e){return Array.from(document.querySelectorAll(e)).find(m0)??null}function nd(e,t){const n=td.getLocale(),r=Oee(),o=Ree(),i=Mee(),s=Pee(),a=Dee();if(t==="atom"){e.setAttribute("em-state","active"),e.getBoundingClientRect().left<50&&e.setAttribute("em-state","active-inside");const l=B({targetElement:e,insertType:"append",className:"em-element-editor",width:82,height:26});l.classList.add("of-atom"),document.body.getBoundingClientRect().height>70&&e.getBoundingClientRect().top+70>document.body.getBoundingClientRect().height&&l.classList.add("out-of-iframe"),e.getBoundingClientRect().top<25&&l.classList.add("em-top-crossed");const c=B({targetElement:l,insertType:"append",className:"em-element-editor-widget"});B({targetElement:c,insertType:"append",className:"em-element-editor-widget-drug",HTMLcontent:Re(Og,`${Oe} ${Ve.drag}`,'style="transform: rotate(90deg)"'),title:n.REORDER_ATOM}),B({targetElement:c,insertType:"append",className:"em-element-editor-widget-edit",HTMLcontent:Re(Wa,`${Oe} em-analytics__atoms-panel-edit`),title:n.EDIT_ATOM}),B({targetElement:c,insertType:"append",className:"em-element-editor-widget-clone",HTMLcontent:Re(ed,`${Oe} em-analytics__atoms-panel-clone`),title:n.CLONE_ATOM}),B({targetElement:c,insertType:"append",className:"em-element-editor-widget-remove",HTMLcontent:Re(Rg,`${Oe} em-analytics__atoms-panel-remove`),title:n.REMOVE_ATOM}),yu(td.commit)}if(t==="block"){e.setAttribute("em-state","active");const l=B({targetElement:e,insertType:"append",className:"em-element-editor"});l.classList.add("of-block"),e.getBoundingClientRect().left<35&&e.setAttribute("em-state","active-inside"),(document.body.getBoundingClientRect().height>130&&e.getBoundingClientRect().top+130>document.body.getBoundingClientRect().height||document.documentElement.clientWidth<r&&e.getBoundingClientRect().top-34<0)&&l.classList.add("out-of-iframe");const c=B({targetElement:l,insertType:"append",className:"em-element-editor-widget"}),u=B({targetElement:c,insertType:"append",className:"em-element-editor-group"});if(B({targetElement:u,insertType:"append",className:"em-element-editor-widget-drug",HTMLcontent:Re(Og,`${Oe} ${Ve.drag}`),title:n.REORDER_BLOCK}),B({targetElement:u,insertType:"append",className:"em-element-editor-widget-up"+(e.closest('[em="block"]')?.previousElementSibling?"":" em-element-editor-widget-noactive"),HTMLcontent:Re(Dk,`${Oe} ${Ve.moveUp}`),title:n.REORDER_BLOCK_UP}),B({targetElement:u,insertType:"append",className:"em-element-editor-widget-down"+(e.closest('[em="block"]')?.nextElementSibling?"":" em-element-editor-widget-noactive"),HTMLcontent:Re(Ik,`${Oe} ${Ve.moveDown}`),title:n.REORDER_BLOCK_DOWN}),B({targetElement:c,insertType:"append",className:"em-element-editor-widget-edit",HTMLcontent:Re(Wa,`${Oe} em-analytics__blocks-panel-edit`),title:n.EDIT_BLOCK}),o){const m=B({targetElement:c,insertType:"append",className:"em-element-editor-group"});B({targetElement:m,insertType:"append",className:"em-element-editor-widget-clone",HTMLcontent:Re(ed,`${Oe} em-analytics__blocks-panel-clone`),title:n.CLONE_BLOCK}),B({targetElement:m,insertType:"append",className:"em-element-editor-widget-copy",HTMLcontent:Re(Aee,`${Oe} em-analytics__blocks-panel-copy`),title:n.COPY_BLOCK_TO_CLIPBOARD}),B({targetElement:m,insertType:"append",className:"em-element-editor-widget-paste",HTMLcontent:Re(Tee,`${Oe} em-analytics__blocks-panel-paste`),title:n.PASTE_BLOCK_FROM_CLIPBOARD})}else B({targetElement:c,insertType:"append",className:"em-element-editor-widget-clone",HTMLcontent:Re(ed,`${Oe} em-analytics__blocks-panel-clone`),title:n.CLONE_BLOCK});if(e.closest(xee))return;const d=Fk('[em-edit="active"]'),f=Fk('[em-state^="active"]');if(d&&f&&(d.querySelector(Hk)&&f.querySelector(Hk)||d.closest(".em-structure")&&f.closest(".em-structure"))&&d!==c.closest('[em-edit="active"]')&&B({targetElement:c,insertType:"append",className:"em-element-editor-widget-merge",HTMLcontent:Re(kee,`${Oe} ${Ve.merge} em-analytics__blocks-panel-merge`),title:n.MERGE_BLOCK}),ga(c.closest('[em="block"]')??c).flatMap(m=>Array.from(m.querySelectorAll(":scope > table"))).length>1&&c.closest('[em="block"]')?.querySelectorAll(".em-mob-wrap")&&B({targetElement:c,insertType:"append",className:"em-element-editor-widget-unmerge",HTMLcontent:Re(Lee,`${Oe} ${Ve.unmerge} em-analytics__blocks-panel-unmerge`),title:n.UNMERGE_BLOCK}),i&&B({targetElement:c,insertType:"append",className:"em-element-editor-widget-add-block",HTMLcontent:Re(Nee,`${Oe} em-analytics__blocks-panel-save`),title:n.SAVE_TO_BLOCKS}),B({targetElement:c,insertType:"append",className:"em-element-editor-widget-remove",HTMLcontent:Re(Rg,`${Oe} em-analytics__blocks-panel-remove`),title:n.REMOVE_BLOCK}),s&&!e.querySelector(".em-element-block-add")&&!a){const m=B({targetElement:e,insertType:"append",className:"em-element-block-add"});e.getBoundingClientRect().bottom+1>document.body.getBoundingClientRect().height&&m.classList.add("out-of-iframe"),B({targetElement:m,insertType:"append",className:"em-element-block-add-plus",HTMLcontent:`${Re(Bk,`${Oe} ${Ve.add}`)} ${n.ADD_BLOCK}`,title:n.ADD_BLOCK});const p=B({targetElement:m,insertType:"append",className:"em-element-block-add-icons"});B({targetElement:p,insertType:"append",className:"add-empty-block",tag:"i",HTMLcontent:'<svg viewBox="64 64 896 896" focusable="false" data-icon="border-outer" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM484 366h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zM302 548h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm364 0h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-182 0h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm0 182h56c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8z"></path></svg>',title:n.ADD_EMPTY_BLOCK}),B({targetElement:p,insertType:"append",className:"add-saved-block",tag:"i",HTMLcontent:'<svg viewBox="64 64 896 896" focusable="false" data-icon="appstore-add" width="1em" height="1em" fill="currentColor" aria-hidden="true"><defs><style></style></defs><path d="M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zm52 132H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200zM424 712H296V584c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v128H104c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h128v128c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V776h128c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"></path></svg>',title:n.ADD_SAVED_BLOCK}),B({targetElement:p,insertType:"append",className:"add-common-block",tag:"i",HTMLcontent:'<svg viewBox="64 64 896 896" focusable="false" data-icon="appstore" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z"></path></svg>',title:n.ADD_COMMON_BLOCK}),Iee()&&B({targetElement:p,insertType:"append",className:"add-template-block",tag:"i",HTMLcontent:'<svg viewBox="64 64 896 896" focusable="false" data-icon="build" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M916 210H376c-17.7 0-32 14.3-32 32v236H108c-17.7 0-32 14.3-32 32v272c0 17.7 14.3 32 32 32h540c17.7 0 32-14.3 32-32V546h236c17.7 0 32-14.3 32-32V242c0-17.7-14.3-32-32-32zm-504 68h200v200H412V278zm-68 468H144V546h200v200zm268 0H412V546h200v200zm268-268H680V278h200v200z"></path></svg>',title:n.ADD_TEMPLATE_BLOCK}),B({targetElement:p,insertType:"append",className:"add-search-block",tag:"i",HTMLcontent:'<svg viewBox="64 64 896 896" focusable="false" data-icon="search" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"></path></svg>',title:n.ADD_SEARCH_BLOCK})}yu(td.commit);const h=e.closest('[em="block"]');h&&(h.onmouseleave=function(){ji(void 0)})}if(t==="group"){e.tagName==="TR"?e.querySelector("td")?.setAttribute("em-state","active"):e.setAttribute("em-state","active");const l=B({targetElement:e,insertType:"append",className:"em-element-editor"});l.classList.add("of-group"),document.body.getBoundingClientRect().height>130&&e.getBoundingClientRect().top+130>document.body.getBoundingClientRect().height&&l.classList.add("out-of-iframe");const c=B({targetElement:l,insertType:"append",className:"em-element-editor-widget"}),u=B({targetElement:c,insertType:"append",className:"em-element-editor-group"});B({targetElement:u,insertType:"append",className:"em-element-editor-widget-drug",HTMLcontent:Re(Og,`${Oe} ${Ve.drag}`),title:n.REORDER_BLOCK}),B({targetElement:u,insertType:"append",className:"em-element-editor-widget-up"+(e.closest('[em="group"]')?.previousElementSibling?"":" em-element-editor-widget-noactive"),HTMLcontent:Re(Dk,`${Oe} ${Ve.moveUp}`),title:n.REORDER_BLOCK_UP}),B({targetElement:u,insertType:"append",className:"em-element-editor-widget-down"+(e.closest('[em="group"]')?.nextElementSibling?"":" em-element-editor-widget-noactive"),HTMLcontent:Re(Ik,`${Oe} ${Ve.moveDown}`),title:n.REORDER_BLOCK_DOWN}),B({targetElement:c,insertType:"append",className:"em-element-editor-widget-add",HTMLcontent:Re(Bk,`${Oe} ${Ve.add} em-analytics__groups-panel-add`),title:n.ADD_GROUP}),B({targetElement:c,insertType:"append",className:"em-element-editor-widget-edit",HTMLcontent:Re(Wa,`${Oe} em-analytics__groups-panel-edit`),title:n.EDIT_GROUP}),B({targetElement:c,insertType:"append",className:"em-element-editor-widget-clone",HTMLcontent:Re(ed,`${Oe} em-analytics__groups-panel-clone`),title:n.CLONE_GROUP}),document.querySelectorAll('[em="group"]').length>1&&B({targetElement:c,insertType:"append",className:"em-element-editor-widget-remove",HTMLcontent:Re(Rg,`${Oe} em-analytics__groups-panel-remove`),title:n.REMOVE_GROUP}),yu(td.commit)}}function ji(e){if(document.documentElement.classList.contains("em-resize-start"))return;const t=V.get("isLeftButtonDown")||!1;e&&e.closest("[em]")?.getAttribute("em")==="atom"?(document.querySelectorAll('[em="atom"] .em-element-editor, [em="atom"] .em-vindent-paddingTop, [em="atom"] .em-vindent-paddingRight, [em="atom"] .em-vindent-paddingBottom, [em="atom"] .em-vindent-paddingLeft, td.em-vindent .em-element-vindent-value, div[style*="height"][style*="line-height"].em-vindent .em-element-vindent-value').forEach(n=>{n.closest('[em="atom"]')!==e&&!t&&n.remove()}),document.querySelectorAll('[em="group"] .em-element-editor.of-group').forEach(n=>{n.remove()}),document.querySelectorAll('[em="atom"][em-state], [em="atom"] [em-state]').forEach(n=>{n.closest('[em="atom"]')!==e&&n.removeAttribute("em-state")})):e&&e.closest("[em]")?.getAttribute("em")==="block"?(document.querySelectorAll('[em="block"] .em-element-editor, .em-element-block-add, [em="block"] .em-vindent-paddingTop, [em="block"] .em-vindent-paddingRight, [em="block"] .em-vindent-paddingBottom, [em="block"] .em-vindent-paddingLeft, td.em-vindent .em-element-vindent-value, div[style*="height"][style*="line-height"].em-vindent .em-element-vindent-value, .em-gap').forEach(n=>{n.closest('[em="block"]')!==e&&!t&&n.remove()}),document.querySelectorAll('[em="group"] .em-element-editor.of-group, [em="atom"] .em-element-editor').forEach(n=>{n.remove()}),document.querySelectorAll("[em-state]").forEach(n=>{(n.closest('[em="block"]')!==e||n.closest('[em="atom"]'))&&n.removeAttribute("em-state")})):(e&&e.closest("[em]")?.getAttribute("em")==="group"||e===void 0)&&(document.querySelectorAll('[em="block"] .em-element-editor, .em-element-block-add, [em="block"] .em-vindent-paddingTop, [em="block"] .em-vindent-paddingRight, [em="block"] .em-vindent-paddingBottom, [em="block"] .em-vindent-paddingLeft, td.em-vindent .em-element-vindent-value, div[style*="height"][style*="line-height"].em-vindent .em-element-vindent-value, .em-gap').forEach(n=>{t||n.remove()}),document.querySelectorAll('[em="atom"] .em-element-editor, [em="atom"] .em-vindent-paddingTop, [em="atom"] .em-vindent-paddingRight, [em="atom"] .em-vindent-paddingBottom, [em="atom"] .em-vindent-paddingLeft, td.em-vindent .em-element-vindent-value, div[style*="height"][style*="line-height"].em-vindent .em-element-vindent-value').forEach(n=>{t||n.remove()}),document.querySelectorAll('[em="group"] .em-element-editor, [em="group"] .em-vindent-paddingTop, [em="group"] .em-vindent-paddingRight, [em="group"] .em-vindent-paddingBottom, [em="group"] .em-vindent-paddingLeft, td.em-vindent .em-element-vindent-value, div[style*="height"][style*="line-height"].em-vindent .em-element-vindent-value').forEach(n=>{n.closest('[em="group"]')!==e&&!t&&n.remove()}),document.querySelectorAll("[em-state]").forEach(n=>{(n.closest('[em="group"]')!==e||n.closest('[em="block"]')||n.closest('[em="atom"]'))&&n.removeAttribute("em-state")})),document.querySelectorAll(".em-block-insert").forEach(n=>n.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(n=>n.classList.remove("em-block-insert-empty")),document.querySelectorAll('[em-hover="true"]').forEach(n=>n.removeAttribute("em-hover"))}function Bee(e,t){if(!e?.isConnected)return;let n;if(n=e.closest('[em="atom"]')){if(ji(n),n.querySelector(".em-element-editor.of-atom")||nd(n.tagName==="TR"?n.querySelector("td"):n,"atom"),!n.closest('[em="block"]')?.querySelector(".em-element-editor.of-block")){document.querySelectorAll('[em="block"] > td > .em-element-editor, [em="block"] > td > .em-element-block-add').forEach(o=>{o.remove()}),document.querySelectorAll("[em-state]").forEach(o=>{o.removeAttribute("em-state")});const r=n.closest('[em="block"]');r&&nd(r.tagName==="TR"?r.querySelector("td"):r,"block"),t.setBlockGroupControlsPosition()}}else(n=e.closest('[em="block"]'))?(ji(n),n.querySelector(".em-element-editor.of-block")||(nd(n.tagName==="TR"?n.querySelector("td"):n,"block"),t.setBlockGroupControlsPosition())):(n=e.closest('[em="group"]'))&&(ji(n),n.querySelector(".em-element-editor.of-group")||(nd(n.tagName==="TR"?n.querySelector("td"):n,"group"),t.setBlockGroupControlsPosition()));e.closest(".em-element-path")||document.querySelectorAll('[em-hover="true"]').forEach(function(r){r.removeAttribute("em-hover")}),!e.closest(".em-editor-wrapper")&&!e.closest(".em-element-editor")&&!e.closest(".em-vindent")&&!e.closest(".em-gap")&&!e.closest(".em-element-resize-img")&&!e.closest(".em-element-img-change-group")&&!e.closest(".em-element-block-add")&&!e.closest(".em-element-path")&&e.tagName!=="IMG"?e.setAttribute("em-hover","true"):e.tagName==="IMG"&&e.parentElement?.setAttribute("em-hover","true"),t.commit(!1)}var{START_POSITION:qa,NEW_EDITOR:Mg}=gA,{TRIM_SPACES:za,EMPTY_TEXT:Hee}=bA;function Fee(e,t){const{activeElem:n,listContext:r,cursorPositionType:o,isTargetCell:i,commit:s,wrapEditor:a,removeTemporaryListClasses:l}=t,{classNameOl:c,classNameUl:u,isList:d}=r;if(!((e.key==="Enter"||e.keyCode===13)&&d&&i&&!e.shiftKey))return!1;if(e.preventDefault(),e.stopImmediatePropagation(),!n)return!0;const f=n.closest(`table.${c}`)||n.closest(`table.${u}`),h=n.closest(`table.${c}`)?c:u;if(!f)return!0;const m=$l(f).counterpart(n)??n,p=GX(m,h);if(!p)return!0;const{firstCellText:S,firstCellHtmlNoText:C,wrappedSecondCellHtml:L}=p;return o==="start"||o==="end"?$ee(n,f,h,c,u,o,S,C,L,a):o==="inside"&&Wee(n,f,h,c,a),l(),s(),!0}function $ee(e,t,n,r,o,i,s,a,l,c){const u=e.querySelector("div");u&&u.classList.add(qa);const d=eA(a,s),f=eA(l," "),h=i==="end"?nK(f):f,m=Wl(t),p="<tr>"+d+h+"</tr>",S=Ui(m),C=XX(S,p,qa,i==="start"),L=Ui(C);fo(t),Ra(t,L);const k=t.querySelector(`.${qa}`)?.closest("tr"),y=i==="start"?k?.previousElementSibling:k?.nextElementSibling;y&&tA(y),n===r&&Xp(t),tK(t,r,o,za);const g=i==="start"?t.querySelector(".remove-start-element-position"):t.querySelector(".remove-new-editor-element");return g&&$k(g,t,c),g}function Wee(e,t,n,r,o){const i=window.getSelection(),s=e.closest("tr"),a=e.querySelector("div");if(!i||i.rangeCount===0||!s||!a)return null;const l=i.getRangeAt(0),c=a.contains(l.startContainer)?JX(s,a,l):null;return c?(tA(c.row),s.after(c.row),fo(t),QX(t),c.content.classList.add(Mg),n===r&&Xp(t),$k(c.content,t,o,!0),c.content):null}function $k(e,t,n,r=!1){e.textContent&&e.textContent.length>0&&zi(e,je(e).replace(za,"")),Hee.test(e.textContent||"")&&(e.textContent=" "),n(e,!0);const o=t.querySelector("editor"),i=o?.querySelector("div");if(i){const s=window.getSelection();if(s&&s.rangeCount>0){const a=s.getRangeAt(0);a.selectNodeContents(i),a.collapse(!0),Ls(s,a)}}r&&o&&Dt(()=>o.focus())}function qee(e,t){const{activeElem:n,listContext:r,cursorPositionType:o,isTargetCell:i,isEmptyText:s,commit:a,wrapEditor:l,removeTemporaryListClasses:c}=t,{classNameOl:u,classNameUl:d,isList:f}=r,h=(e.keyCode===38||e.key==="ArrowUp")&&o==="start",m=(e.keyCode===40||e.key==="ArrowDown")&&(!s&&o==="end"||s&&o==="start");if(!(h||m)||!f||!i||!n)return!1;e.preventDefault(),e.stopImmediatePropagation();const p=e.key==="ArrowUp"?"ArrowUp":"ArrowDown",S=n.closest(`table.${u}`)||n.closest(`table.${d}`);if(!S)return!0;const C=n.querySelector("div");C&&C.classList.add(qa);const L=Wl(S),k=Ui(L),y=eK(k,qa,Mg,p);fo(S),Ra(S,y);const g=S.querySelector(".remove-new-editor-element");if(g){l(g,!0);const v=S.querySelector("editor"),w=v?.querySelector("div")?.childNodes[0],b=window.getSelection();if(b&&b.rangeCount>0){const E=b.getRangeAt(0);if(w&&w.nodeType===Node.TEXT_NODE){const _=w.textContent||"";E.setStart(w,_.replace(za,"").length)}else v&&E.selectNodeContents(v);E.collapse(!0),Ls(b,E)}}return c(),a(),!0}function zee(e,t,n){return(e.keyCode===39||e.key==="ArrowRight")&&(t==="end"||n)?(e.preventDefault(),e.stopImmediatePropagation(),!0):!1}function Uee(e,t){const n=window.navigator.platform.match("Mac"),{activeElem:r,listContext:o,cursorPositionType:i,isTargetCell:s,isEmptyText:a,parentElement:l,commit:c,wrapEditor:u,removeTemporaryListClasses:d,findNodeAtPosition:f}=t,h=(...ve)=>Dt(()=>t.setCursorSafely(...ve)),{classNameOl:m,classNameUl:p,isList:S}=o;if(!((n?e.code==="Backspace":e.keyCode===46||e.keyCode===8)&&S)||!(!s||s&&(i==="start"||a&&i==="inside"||a&&i==="end"))||!r||!l)return!1;e.preventDefault(),e.stopImmediatePropagation();const C=r.closest(`table.${m}`)?m:p,L=l.closest("tr");if(!L)return!0;const k=L.previousElementSibling;if(!k&&!s)return!0;const y=s?r.querySelector("div"):L.querySelector("tr td:nth-child(2)")?.querySelector("div"),g=y?je(y):"",v=g?g.split(" ")[0]:"";v.replace(za,"");const w=k?.querySelector("tr td:nth-of-type(2)");if(!w)return!0;const b=w.querySelector("div");if(!b)return!0;b.classList.add(Mg);const E=je(b),_=`${E}${g}`;fo(L.parentNode??L),L.remove();const T=b.closest(`table.${m}`)||b.closest(`table.${p}`);if(!T)return!0;const x=je(T),N=Ui(x);Ra(T,N),C===m&&Xp(T);const D=T.querySelector(".remove-new-editor-element");if(!D)return d(),c(),!0;const R=_.replace(za,"");zi(D,`${R} `),u(D,!0);const O=D.closest("editor");if(!O)return d(),c(),!0;const q=window.getSelection(),ee=document.createRange(),de=O.querySelector("div");if(!de||!q)return d(),c(),!0;const re=O.textContent||"",Q=v?re.indexOf(v):-1;if(Q!==-1&&v){const ve=f(de,Q);if(ve)h(ee,q,ve.node,ve.offset);else{const fe=de.childNodes[0];fe&&h(ee,q,fe,0)}}else{const ve=document.createElement("div");ve.innerHTML=E;const fe=(ve.textContent||"").length,Te=f(de,fe);if(Te)h(ee,q,Te.node,Te.offset);else{const ut=document.createTreeWalker(de,NodeFilter.SHOW_TEXT,null);let te=null;for(;ut.nextNode();)te=ut.currentNode;te&&h(ee,q,te,(te.textContent||"").length)}}return Dt(()=>O.focus()),d(),c(),!0}function jee(e,t,n){return(window.navigator.platform.match("Mac")?e.code==="Backspace":e.keyCode===46||e.keyCode===8)?!1:t&&!n?(e.preventDefault(),e.stopPropagation(),!0):!1}function Vee(e){if(!e)return!1;const t=e.closest("li");return Fu(t)}function Gee(e){const t=window.getSelection(),n=e.textContent||"",r=n.trim();if(!r||r===" ")return{position:"empty",offset:0,textContent:""};if(!t||t.rangeCount===0)return{position:"middle",offset:0,textContent:n};const o=t.getRangeAt(0);if(!e.contains(o.startContainer))return{position:"middle",offset:0,textContent:n};const i=document.createRange();i.selectNodeContents(e),i.setEnd(o.startContainer,o.startOffset);const s=i.toString().length;return s===0?{position:"start",offset:0,textContent:n}:s>=r.length?{position:"end",offset:s,textContent:n}:{position:"middle",offset:s,textContent:n}}function Xee(e,t){const n=Array.from(t.querySelectorAll(":scope > li")),r=n.indexOf(e);return r===0?"first":r===n.length-1?"last":"middle"}function Kee(e){const t=window.getSelection();if(!t||t.rangeCount===0)return je(e);const n=t.getRangeAt(0),r=document.createRange();return r.selectNodeContents(e),r.setEnd(n.startContainer,n.startOffset),Wk(e,r)}function Wk(e,t){const n=document.createElement("div");return n.appendChild(t.cloneContents()),nn(e,n),ti(n),Ke(n)}function Yee(e){const t=window.getSelection();if(!t||t.rangeCount===0)return"";const n=t.getRangeAt(0),r=document.createRange();return r.selectNodeContents(e),r.setStart(n.endContainer,n.endOffset),Wk(e,r)}function Vi(e){const t=window.getSelection();if(!t)return;const n=document.createRange();n.selectNodeContents(e),n.collapse(!0),t.removeAllRanges(),t.addRange(n)}function Ua(e,t){e.hasAttribute("em-edit")&&(e.removeAttribute("em-edit"),t.setAttribute("em-edit","active"))}function Zee(e,t){const n=document.createElement("br"),r=document.createElement("span");return r.innerHTML=" ",Ua(e,r),t.parentNode?.insertBefore(r,t),t.parentNode?.insertBefore(n,r),e.remove(),t.querySelectorAll("li").length===0&&t.remove(),Vi(r),r}function Qee(e,t){const n=Array.from(t.querySelectorAll(":scope > li")),r=n.indexOf(e),o=n.slice(r+1),i=document.createElement(t.tagName.toLowerCase());t.getAttribute("style")&&i.setAttribute("style",t.getAttribute("style")),o.forEach(l=>{i.appendChild(l)});const s=document.createElement("br"),a=document.createElement("span");return a.innerHTML=" ",Ua(e,a),i.children.length>0&&t.parentNode?.insertBefore(i,t.nextSibling),t.parentNode?.insertBefore(a,t.nextSibling),t.parentNode?.insertBefore(s,a),e.remove(),t.querySelectorAll("li").length===0&&t.remove(),Vi(a),a}function Jee(e,t){if(!((e.key==="Enter"||e.keyCode===13)&&!e.shiftKey))return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0).startContainer,o=r.nodeType===Node.TEXT_NODE?r.parentElement:r;if(!Vee(o))return!1;const i=o?.closest("li");if(!i)return!1;const s=i.closest("ul, ol");if(!s)return!1;e.preventDefault(),e.stopImmediatePropagation();const a=Gee(i),l=Xee(i,s);switch(a.position){case"empty":ete(i,s,l,t);break;case"start":tte(i,s,t);break;case"end":nte(i,s,t);break;case"middle":rte(i,s,t)}return t.commit(),!0}function ete(e,t,n,r){switch(n){case"last":const o=document.createElement("li");o.setAttribute("style",Xn.LIST_ITEM),o.innerHTML=" ",e.after(o),Ua(e,o),Vi(o);break;case"first":Zee(e,t);break;case"middle":Qee(e,t)}}function tte(e,t,n){const r=document.createElement("li");r.setAttribute("style",Xn.LIST_ITEM),r.innerHTML=" ",e.before(r),Vi(e)}function nte(e,t,n){const r=document.createElement("li");r.setAttribute("style",Xn.LIST_ITEM),r.innerHTML=" ",e.after(r),Ua(e,r),Vi(r)}function rte(e,t,n){const r=Kee(e),o=Yee(e);zi(e,r||" ");const i=document.createElement("li");i.setAttribute("style",Xn.LIST_ITEM),zi(i,o||" "),e.after(i),Ua(e,i),Vi(i)}function ote(e){const t=r=>Oh({target:r.target},o=>e.commit(o)),n=()=>V.get("commonStyles");return function(o){const i=window.getSelection(),s=(i?.rangeCount?i.getRangeAt(0):null)?.commonAncestorContainer,a=s?.nodeType===1?s:s?.parentElement,l=a?.closest("editor"),c=window.navigator.platform.match("Mac"),u=l?VX(l):null,d=l?.closest("tr")?.querySelector("tr td:nth-of-type(2) div"),f=o.target,h=$u(f),{isList:m}=h,p=d?.textContent===l?.textContent,S=l?bA.EMPTY_TEXT.test(l.textContent||""):!1,C=c?o.metaKey:o.ctrlKey;if(C&&o.keyCode===83){o.preventDefault(),e.messageService.send({operation:"application_action",action:"save_email"});return}const L=GQ(o,!!C);if(L){o.preventDefault(),fk(e.messageService,L);return}if(o.altKey&&o.keyCode===88){o.preventDefault(),e.messageService.send({operation:"application_action",action:"toggle_editor"});return}if(QQ(o,{commit:e.commit}))return;eJ(o,{commit:e.commit}),o.key==="Enter"&&!o.ctrlKey&&!o.metaKey&&!o.altKey&&!o.isComposing&&uE();const k={getElementParent:b=>$i(b),setCursorPosition:e.setCursorPosition,removeElementEditors:()=>ji(void 0),getVariableByIcon:pa,removeEmptyParents:Fa,getAllComments:dz,isVariableComment:l0,getVariableIcon:b=>hz(b),commit:e.commit,messageService:e.messageService};if(YQ(o,m,u,k))return;if(o.keyCode===27){const b=document.querySelector(".em-editor-wrapper");b?.style&&(b.style.display="none"),xr("em-edit"),Dt(()=>document.querySelectorAll("editor").forEach(E=>E.blur())),i?.removeAllRanges(),e.applicationElementSettingsSet({elem:null}),e.messageService.send({operation:"application_close-image-edit-popup"});return}C&&o.keyCode===66&&(o.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"toggle_strong"}));const y=c?o.keyCode===88:o.keyCode===53;if((c?o.metaKey:o.altKey)&&o.shiftKey&&y&&(o.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"toggle_strikethrough"})),C&&o.shiftKey&&o.keyCode===76&&(o.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"textAlign_left"})),C&&o.shiftKey&&o.keyCode===82&&(o.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"textAlign_right"})),C&&o.shiftKey&&o.keyCode===69&&(o.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"textAlign_center"})),C&&o.keyCode===73&&(o.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"toggle_italic"})),C&&o.keyCode===85&&(o.preventDefault(),l&&e.messageService.send({operation:"application_action",action:"toggle_underline"})),Jee(o,{commit:e.commit})||tJ(o,l,m,p,{commit:e.commit}))return;if(C&&o.keyCode===86){e.setIsPasteFromContextMenu(!1);const b=E=>{Zl(E,!1,n(),t,e.commit),document.removeEventListener("paste",b)};document.addEventListener("paste",b)}else t(o);const g={activeElem:l,listContext:h,cursorPositionType:u,isTargetCell:p,isEmptyText:S,commit:e.commit,wrapEditor:e.wrapEditor,removeTemporaryListClasses:()=>MK()};if(Fee(o,g)||(zee(o,u,S),qee(o,g)))return;const v={...g,parentElement:a,findNodeAtPosition:SA,setCursorSafely:ZK};if(Uee(o,v)||jee(o,m,p))return;const w={setCursorInsideSpan:gz,isCaretAtEndOfStandardElement:bz,setCursorPositionSimple:yz,commit:e.commit};ZQ(o,w)&&e.commit()}}function ite(e,t){if(!(document.body?.classList.contains("mceNonEditable")||t.isIntegratorLocked())&&!(!e.target?.closest?.('[contenteditable="true"]')||!e.key||e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1){e.preventDefault(),e.stopImmediatePropagation();const n=window.getSelection();if(n?.isCollapsed&&n.rangeCount>0&&yC(n,e.key)){uo(!0);return}ur("insertText",!1,e.key)}}function ste(e){const t=n=>ite(n,e);return document.addEventListener("keydown",t,!0),{dispose(){document.removeEventListener("keydown",t,!0)}}}function ate(e){const t=Cee({handlePasteTextFragment:Zl,getCommonStyles:()=>V.get("commonStyles"),changeMsoValue:n=>Oh({target:n.target},r=>e.commit(r)),commit:e.commit});document.addEventListener("keydown",ote({...e,setIsPasteFromContextMenu:n=>t.setFromContextMenu(n)}),!1),document.addEventListener("beforeinput",n=>KQ(n,e),!0),ste(e.editLock)}var lte='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M 16 4 C 10.886719 4 6.617188 7.160156 4.875 11.625 L 6.71875 12.375 C 8.175781 8.640625 11.710938 6 16 6 C 19.242188 6 22.132813 7.589844 23.9375 10 L 20 10 L 20 12 L 27 12 L 27 5 L 25 5 L 25 8.09375 C 22.808594 5.582031 19.570313 4 16 4 Z M 25.28125 19.625 C 23.824219 23.359375 20.289063 26 16 26 C 12.722656 26 9.84375 24.386719 8.03125 22 L 12 22 L 12 20 L 5 20 L 5 27 L 7 27 L 7 23.90625 C 9.1875 26.386719 12.394531 28 16 28 C 21.113281 28 25.382813 24.839844 27.125 20.375 Z"/></svg>',rd=4;function cte(e,t){return e.left<rd||e.right-e.left>t-8?rd-e.left:e.right>t-rd?t-rd-e.right:0}var Gi=null,Pg=null;function Ig(e,t){if(typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in document))return;Gi||(Gi=new CSSStyleSheet),document.adoptedStyleSheets.includes(Gi)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,Gi]),Gi.replaceSync("");const n=e.getBoundingClientRect();if(n.width===0)return;Pg=e;const r=Math.round(cte(n,document.documentElement.clientWidth));r!==0&&Gi.replaceSync(`${t} { margin-left: ${r}px; }`)}function ute(e,t,n){e.addEventListener("mouseenter",()=>{Pg=null,Ig(t,n)}),e.addEventListener("mousemove",()=>{Pg!==t&&Ig(t,n)}),t.addEventListener("mouseenter",()=>Ig(t,n))}function No(e,t){return{settings:e,elem:t}}var Xe={applicationElementSettingsSet:e=>M(Pt,De)(e),setCursorPosition:e=>M(Pt,vt)(e),commit:uo};function dte(){return V.get("emailWidth")||475}function od(){return document.documentElement.clientWidth<=dte()}function Dg(e,t,n,r){const o=e;o.style.cursor=n,o.mousemove=t;const i=()=>{window.getSelection()?.removeAllRanges(),Xe.applicationElementSettingsSet({elem:e});const s=document.querySelector("[em-edit]");s&&Xe.setCursorPosition(s),He(document.documentElement,!0,"em-resize-start")};o.addEventListener("touchstart",s=>{const a=s.touches[0];if(s.touches.length!==1||!a)return;s.preventDefault(),i();let l={x:a.clientX,y:a.clientY};const c={x:0,y:0},u=document.documentElement,d=h=>{const m=h.touches[0];if(!m)return;h.preventDefault(),c.x+=m.clientX-l.x,c.y+=m.clientY-l.y,l={x:m.clientX,y:m.clientY};const p={x:Math.trunc(c.x),y:Math.trunc(c.y)};p.x===0&&p.y===0||(c.x-=p.x,c.y-=p.y,o.mousemove({movementX:p.x,movementY:p.y}))},f=()=>{u.removeEventListener("touchmove",d),u.removeEventListener("touchend",f),u.removeEventListener("touchcancel",f),o.stopDrag()};u.addEventListener("touchmove",d,{passive:!1}),u.addEventListener("touchend",f),u.addEventListener("touchcancel",f)},{passive:!1}),o.onmousedown=function(){i();try{document.documentElement.addEventListener("mousemove",o.doDrag,!1),document.documentElement.addEventListener("mouseup",o.stopDrag,!1)}catch{}},o.doDrag=function(s){if(s.which!=1){o.stopDrag();return}o.mousemove(s)},o.stopDrag=function(){document.documentElement.removeEventListener("mousemove",o.doDrag,!1),document.documentElement.removeEventListener("mouseup",o.stopDrag,!1),r&&r(),setTimeout(()=>{He(document.documentElement,!1,"em-resize-start"),Xe.commit(!1)})}}function xo(e,t,n){Dg(e,t,"ns-resize",n)}function ja(e,t,n){Dg(e,t,"ew-resize",n)}function fte(e,t,n){Dg(e,t,"nwse-resize",n)}function Oo(e,t){let n=null,r=0;const o=od();if(e.closest('div[style*="font-size"][style*="line-height"]')){if(n=e.closest('div[style*="height"][style*="line-height"]'),!n)return;r=n.clientHeight+t,o?wi(No({mobileHeight:{value:r>0?r:0,dim:"px",classNamePrefix:"em-mob-height-"}},n)):(n.style.height=r+"px",n.style.lineHeight=r+"px")}else if(e.closest(".em-gap")){if(n=e.closest(".em-gap"),!n)return;n.classList.add("em-hover"),r=n.clientHeight+t,n.closest("tr")?.querySelectorAll(".em-gap").forEach(i=>{const s={mobileHeight:{value:r>0?r:0,dim:"px",classNamePrefix:"em-mob-height-"}},a=i.closest(".em-mob-wrap, .noresp-em-mob-wrap");wi(No(s,a)),i.style.height=r+"px";const l=i.querySelector(".em-element-gap-value");l&&(l.innerHTML=r+"px")})}else if(e.closest(".em-vindent")?.classList.contains("em-vindent-paddingTop")){if(n=e.closest(".em-vindent-paddingTop"),!n)return;const i=n.parentElement;n.classList.add("em-hover"),r=n.clientHeight+t,n.style.height=r+"px",o&&i?na(No({mobilePadding:{top:r>0?r:0,classNamePrefix:"em-mob-padding_"}},i)):i&&(i.style.paddingTop=r+"px")}else if(e.closest(".em-vindent")?.classList.contains("em-vindent-paddingBottom")){if(n=e.closest(".em-vindent-paddingBottom"),!n)return;const i=n.parentElement;n.classList.add("em-hover"),r=n.clientHeight+t,n.style.height=r+"px",o&&i?na(No({mobilePadding:{bottom:r>0?r:0,classNamePrefix:"em-mob-padding_"}},i)):i&&(i.style.paddingBottom=r+"px")}else{if(n=e.closest("td"),!n)return;r=n.clientHeight+t,o?wi(No({mobileHeight:{value:r>0?r:0,dim:"px",classNamePrefix:"em-mob-height-"}},n)):n.setAttribute("height",String(r))}if(n&&!e.closest(".em-gap")){if(r>=0){const i=n.querySelector(".em-element-vindent-value");i&&(i.innerHTML=r+"px")}r<30?n.classList.add("em-vindent_low"):n.classList.remove("em-vindent_low")}n&&Xe.commit()}function Ro(e){let t=null;const n=od();if(e.closest('div[style*="height"][style*="line-height"]')){if(t=e.closest('div[style*="height"][style*="line-height"]'),!t)return;parseInt(t.style.height)<=0?t.remove():Xe.applicationElementSettingsSet({elem:t})}else if(e.closest(".em-gap")){if(t=e.closest(".em-gap"),!t)return;Xe.applicationElementSettingsSet({elem:tp(t)})}else if(e.closest(".em-vindent")?.classList.contains("em-vindent-paddingTop")){if(t=e.closest(".em-vindent-paddingTop"),!t)return;t.classList.remove("em-hover");const r=t.parentElement;parseInt(t.style.height)<=0?n&&r?Xe.applicationElementSettingsSet({elem:r}):r&&r.style.removeProperty("padding-top"):r&&Xe.applicationElementSettingsSet({elem:r})}else if(e.closest(".em-vindent")?.classList.contains("em-vindent-paddingBottom")){if(t=e.closest(".em-vindent-paddingBottom"),!t)return;t.classList.remove("em-hover");const r=t.parentElement;parseInt(t.style.height)<=0?n&&r?Xe.applicationElementSettingsSet({elem:r}):r&&r.style.removeProperty("padding-bottom"):r&&Xe.applicationElementSettingsSet({elem:r})}else{if(t=e.closest("td"),!t)return;const r=t.getAttribute("height");r&&parseInt(r)<=0?t.closest("table")?.remove():Xe.applicationElementSettingsSet({elem:t})}t&&Xe.commit()}function Xi(e,t){let n=null,r=0;const o=od();if(e.closest(".em-element-resize-img-container")){const i=e.closest(".em-element-resize-img-container")?.querySelector("img");if(!i)return;const s=i.clientWidth+t;i.style.maxWidth=s+"px",i.setAttribute("width",String(s)),Xe.commit()}else if(e.closest(".em-gap")){if(n=e.closest(".em-gap"),!n)return;if(n.classList.add("em-hover"),r=n.clientWidth+t,r>=0){const i=n.clientWidth,s=Array.from(n.closest("tr")?.querySelectorAll(".em-mob-wrap:nth-child(odd)")||[]).map(u=>u.clientWidth),a=s.reduce((u,d)=>u+d,0),l=a+(s.length-1)*i,c=n.closest("tr");if(!c)return;if(l-3<=c.clientWidth||t<=0){let u=Array.from(c.querySelectorAll(".em-mob-wrap:nth-child(odd)")).filter(S=>S.dataset.percent).map(S=>S.dataset.percent);u.length||(u=s.map(S=>((S||0)/a*100).toFixed(1)),ec(c.querySelectorAll(".em-mob-wrap:nth-child(odd)")));const d=l-(s.length-1)*r,f=(S,C)=>Math.round(C*parseFloat(S)/100);let h=s.map((S,C)=>f(u[C],d));const m=l-(h.reduce((S,C)=>S+C,0)+(s.length-1)*r);if(m!==0){const S=h.length-Math.abs(m);h=h.map((C,L)=>S<=L?C+(m>0?1:-1):C)}const p=h;c.querySelectorAll(".em-mob-wrap:nth-child(odd)").forEach((S,C)=>{Array.from(S.querySelectorAll("table[width]")).filter(L=>!L.getAttribute("width")?.includes("%")).forEach(L=>{+(L.getAttribute("width")||0)<=p[C]&&(L.style.maxWidth=String(p[C]),L.setAttribute("width","100%"))})}),n.style.width=r+"px",c.querySelectorAll(".em-mob-wrap:nth-child(odd)").forEach((S,C)=>S.setAttribute("width",String(p[C]))),c.querySelectorAll(".em-gap").forEach(S=>{S.parentElement?.setAttribute("width",String(r)),S.style.width=r+"px";const C=S.querySelector(".em-element-gap-value");C&&(C.innerHTML=r+"px")})}}}else if(e.closest(".em-vindent")?.classList.contains("em-vindent-paddingLeft")){if(n=e.closest(".em-vindent-paddingLeft"),!n)return;const i=n.parentElement;n.classList.add("em-hover"),r=n.clientWidth+t,n.style.width=r+"px",o&&i?na(No({mobilePadding:{left:r>0?r:0,classNamePrefix:"em-mob-padding_"}},i)):i&&(i.style.paddingLeft=r+"px",i.querySelectorAll(":scope > table").forEach(s=>Wu(s)))}else if(e.closest(".em-vindent")?.classList.contains("em-vindent-paddingRight")){if(n=e.closest(".em-vindent-paddingRight"),!n)return;const i=n.parentElement;n.classList.add("em-hover"),r=n.clientWidth+t,n.style.width=r+"px",o&&i?na(No({mobilePadding:{right:r>0?r:0,classNamePrefix:"em-mob-padding_"}},i)):i&&(i.style.paddingRight=r+"px",i.querySelectorAll(":scope > table").forEach(s=>Wu(s)))}if(n&&!e.closest(".em-gap")){if(r>=0){const i=n.querySelector(".em-element-vindent-value, .em-element-gap-value");i&&(i.innerHTML=r+"px")}r<30?n.classList.add("em-vindent_low"):n.classList.remove("em-vindent_low")}n&&Xe.commit()}function Ki(e){let t=null;const n=od();if(e.closest(".em-element-resize-img-container")){const r=e.closest(".em-element-resize-img-container")?.querySelector("img");r&&(Xe.applicationElementSettingsSet({elem:r}),Xe.commit())}else if(e.closest(".em-gap"))t=e.closest(".em-gap"),t&&Xe.applicationElementSettingsSet({elem:tp(t)});else if(e.closest(".em-vindent")?.classList.contains("em-vindent-paddingLeft")){if(t=e.closest(".em-vindent-paddingLeft"),!t)return;t.classList.remove("em-hover");const r=t.parentElement;parseInt(t.style.width)<=0?n&&r?Xe.applicationElementSettingsSet({elem:r}):r&&r.style.removeProperty("padding-left"):r&&Xe.applicationElementSettingsSet({elem:r})}else if(e.closest(".em-vindent")?.classList.contains("em-vindent-paddingRight")){if(t=e.closest(".em-vindent-paddingRight"),!t)return;t.classList.remove("em-hover");const r=t.parentElement;parseInt(t.style.width)<=0?n&&r?Xe.applicationElementSettingsSet({elem:r}):r&&r.style.removeProperty("padding-right"):r&&Xe.applicationElementSettingsSet({elem:r})}t&&Xe.commit()}var qk={getLocale:Wi,commit:uo,messageService:U},mte=".em-prevent-action",zk=new WeakSet;function hte(){return V.get("emailWidth")||475}function pte(){return V.get("isLeftButtonDown")||!1}function gte(){return V.get("editImageControlEnabled")||!1}function Uk(){return V.get("imageCenterEditorEnabled")||!1}function bte(){return V.get("imageCenterStockEnabled")||!1}function yte(){return V.get("imageCenterGifEnabled")||!1}function vte(){return V.get("elementAIimageEnabled")||!1}function Ete(e){if(document.body?.classList.contains("em-native-file-drag"))return;const t=qk.getLocale(),n=hte(),r=pte(),o=Uk(),i=document.documentElement.clientWidth<=(n||475);if(document.body&&!document.body.classList.contains("mceNonEditable")&&!r){if(e.tagName==="TD"&&e.innerHTML===""&&e.getAttribute("height")&&!e.classList.contains("em-vindent")&&!e.closest("editor")){e.classList.add("em-vindent"),e.closest("table")?.classList.add("em-vindent-table"),parseInt(e.getAttribute("height")||"0")<30&&e.classList.add("em-vindent_low");const m=B({targetElement:e,insertType:"append",className:"em-element-resize-height"});B({targetElement:e,insertType:"append",className:"em-element-vindent"}),B({targetElement:e,insertType:"append",className:"em-element-vindent-bg"}),xo(m,function(p){Oo(m,p.movementY)},function(){Ro(m)})}if(e.closest(mte))return;if((e.classList.contains("em-vindent")||e.closest(".em-vindent"))&&e.getAttribute("height")&&!e.querySelector(".em-element-vindent-value")){const m=ho(e,"em-mob-height"),p=m?parseFloat(m.substring(14,m.length-2)):void 0;B({targetElement:e.querySelector(".em-element-vindent"),insertType:"append",className:"em-element-vindent-value",HTMLcontent:i?(p||e.getAttribute("height"))+"px":e.getAttribute("height")+"px"}),!i||!p?parseInt(e.getAttribute("height")||"0")<30?e.classList.add("em-vindent_low"):e.classList.remove("em-vindent_low"):p<30?e.classList.add("em-vindent_low"):e.classList.remove("em-vindent_low")}if(e.tagName==="DIV"&&e.style.height&&e.style.fontSize&&!e.classList.contains("em-vindent")&&!e.closest("editor")&&e.style.height&&e.style.lineHeight&&!e.style.fontFamily){e.classList.add("em-vindent"),parseFloat(e.style.height)<30&&e.classList.add("em-vindent_low");const m=B({targetElement:e,insertType:"append",className:"em-element-resize-height"}),p=B({targetElement:e,insertType:"append",className:"em-element-vindent"});B({targetElement:p,insertType:"append",className:"em-element-vindent-value",HTMLcontent:e.style.height}),B({targetElement:e,insertType:"append",className:"em-element-vindent-bg"}),xo(m,function(S){Oo(m,S.movementY)},function(){Ro(m)})}if((e.classList.contains("em-vindent")||e.closest(".em-vindent"))&&e.style.height&&e.style.fontSize&&!e.querySelector(".em-element-vindent-value")){const m=ho(e,"em-mob-height"),p=m?parseFloat(m.substring(14,m.length-2)):void 0;B({targetElement:e.querySelector(".em-element-vindent"),insertType:"append",className:"em-element-vindent-value",HTMLcontent:i?(p||parseFloat(e.style.height))+"px":parseFloat(e.style.height)+"px"}),!i||!p?parseFloat(e.style.height)<30?e.classList.add("em-vindent_low"):e.classList.remove("em-vindent_low"):p<30?e.classList.add("em-vindent_low"):e.classList.remove("em-vindent_low")}const s=ho(e,"em-mob-padding_top"),a=s?parseFloat(s.substring(19)):void 0,l=ho(e,"em-mob-padding_bottom"),c=l?parseFloat(l.substring(22)):void 0,u=ho(e,"em-mob-padding_left"),d=u?parseFloat(u.substring(20)):void 0,f=ho(e,"em-mob-padding_right"),h=f?parseFloat(f.substring(21)):void 0;if((e.style.padding||e.style.paddingTop||e.style.paddingBottom||e.style.paddingLeft||e.style.paddingRight)&&!e.closest("editor")&&(e.tagName!=="A"||e.style.height)){if(e.style.paddingTop&&!e.querySelector(":scope > .em-vindent-paddingTop")&&!e.querySelector(":scope > editor > .em-vindent-paddingTop")&&(!a||!i)){const m=B({targetElement:e,insertType:"append",className:"em-vindent em-vindent-paddingTop",style:`height: ${e.style.paddingTop}`});e.getBoundingClientRect().top<30&&m.classList.add("top-crossed")}e.style.paddingBottom&&!e.querySelector(":scope > .em-vindent-paddingBottom")&&!e.querySelector(":scope > editor > .em-vindent-paddingBottom")&&(!c||!i)&&B({targetElement:e,insertType:"append",className:"em-vindent em-vindent-paddingBottom",style:`height: ${e.style.paddingBottom}`}),e.style.paddingLeft&&!e.querySelector(":scope > .em-vindent-paddingLeft")&&!e.querySelector(":scope > editor > .em-vindent-paddingLeft")&&(!d||!i)&&B({targetElement:e,insertType:"append",className:"em-vindent em-vindent-paddingLeft",style:`width: ${e.style.paddingLeft}`}),e.style.paddingRight&&!e.querySelector(":scope > .em-vindent-paddingRight")&&!e.querySelector(":scope > editor > .em-vindent-paddingRight")&&(!h||!i)&&B({targetElement:e,insertType:"append",className:"em-vindent em-vindent-paddingRight",style:`width: ${e.style.paddingRight}`}),e.querySelectorAll('[class*="em-vindent-padding"]').forEach(m=>{if(!m.querySelector(".em-element-resize-height")){const p=m;(parseFloat(p.style.height)<30||parseFloat(p.style.width)<30)&&m.classList.add("em-vindent_low");const S=B({targetElement:p,insertType:"append",className:"em-element-resize-height"});B({targetElement:p,insertType:"append",className:"em-element-vindent-marker"}),B({targetElement:p,insertType:"append",className:"em-element-vindent-bg"});const C=B({targetElement:p,insertType:"append",className:"em-element-vindent"});let L="";p.className.indexOf("paddingTop")>-1?(L=e.style.paddingTop,xo(S,function(k){Oo(S,k.movementY)},function(){Ro(S)})):p.className.indexOf("paddingBottom")>-1?(L=e.style.paddingBottom,xo(S,function(k){Oo(S,k.movementY)},function(){Ro(S)})):p.className.indexOf("paddingLeft")>-1?(L=e.style.paddingLeft,ja(S,function(k){Xi(S,k.movementX)},function(){Ki(S)})):p.className.indexOf("paddingRight")>-1&&(L=e.style.paddingRight,ja(S,function(k){Xi(S,-k.movementX)},function(){Ki(S)})),B({targetElement:C,insertType:"append",className:"em-element-vindent-value",HTMLcontent:L})}})}if(e.className.length&&e.className?.includes("em-mob-padding")&&!e.closest("editor")&&i&&(a&&!e.querySelector(":scope > .em-vindent-paddingTop")&&B({targetElement:e,insertType:"append",className:"em-vindent em-vindent-paddingTop",style:`height: ${a}px`}),c&&!e.querySelector(":scope > .em-vindent-paddingBottom")&&B({targetElement:e,insertType:"append",className:"em-vindent em-vindent-paddingBottom",style:`height: ${c}px`}),d&&!e.querySelector(":scope > .em-vindent-paddingLeft")&&B({targetElement:e,insertType:"append",className:"em-vindent em-vindent-paddingLeft",style:`width: ${d}px`}),h&&!e.querySelector(":scope > .em-vindent-paddingRight")&&B({targetElement:e,insertType:"append",className:"em-vindent em-vindent-paddingRight",style:`width: ${h}px`}),e.querySelectorAll('[class*="em-vindent-padding"]').forEach(m=>{if(!m.querySelector(".em-element-resize-height")){const p=m;(parseFloat(p.style.height)<30||parseFloat(p.style.width)<30)&&m.classList.add("em-vindent_low");const S=B({targetElement:p,insertType:"append",className:"em-element-resize-height"});B({targetElement:p,insertType:"append",className:"em-element-vindent-marker"}),B({targetElement:p,insertType:"append",className:"em-element-vindent-bg"});const C=B({targetElement:p,insertType:"append",className:"em-element-vindent"});let L="";p.className.indexOf("paddingTop")>-1?(L=a,xo(S,function(k){Oo(S,k.movementY)},function(){Ro(S)})):p.className.indexOf("paddingBottom")>-1?(L=c,xo(S,function(k){Oo(S,k.movementY)},function(){Ro(S)})):p.className.indexOf("paddingLeft")>-1?(L=d,ja(S,function(k){Xi(S,k.movementX)},function(){Ki(S)})):p.className.indexOf("paddingRight")>-1&&(L=h,ja(S,function(k){Xi(S,-k.movementX)},function(){Ki(S)})),B({targetElement:C,insertType:"append",className:"em-element-vindent-value",HTMLcontent:String(L)})}})),e.closest('[em="block"]')?.querySelector(".em-mob-wrap, .noresp-em-mob-wrap")&&(e.closest('[em="block"]')?.querySelectorAll(".em-mob-wrap, .noresp-em-mob-wrap").length||0)>2&&!e.closest('[em="block"]')?.querySelector(".em-mob-wrap .em-gap, .noresp-em-mob-wrap .em-gap")){const m=ho(e.closest('[em="block"]')?.querySelector(".em-mob-wrap:nth-child(even), .noresp-em-mob-wrap:nth-child(even)"),"em-mob-height"),p=m?parseFloat(m.substring(14,m.length-2)):void 0;e.closest('[em="block"]')?.querySelectorAll(".em-mob-wrap:nth-child(even), .noresp-em-mob-wrap:nth-child(even)").forEach(S=>{B({targetElement:S,insertType:"append",className:"em-gap",style:i?`height: ${p}px;`:`width: ${S.getAttribute("width")}px;`})}),e.closest('[em="block"]')?.querySelectorAll(".em-gap").forEach(S=>{if(!S.querySelector(".em-element-resize-height")){const C=S,L=B({targetElement:C,insertType:"append",className:"em-element-resize-height"});B({targetElement:C,insertType:"append",className:"em-element-gap-marker"}),B({targetElement:C,insertType:"append",className:"em-element-gap-bg"});const k=B({targetElement:C,insertType:"append",className:"em-element-gap"});let y="";i?(y=C.style.height,xo(L,function(g){Oo(L,g.movementY)},function(){Ro(L)})):(y=C.style.width,ja(L,function(g){Xi(L,g.movementX)},function(){Ki(L)})),B({targetElement:k,insertType:"append",className:"em-element-gap-value",HTMLcontent:y})}})}if(e.tagName==="IMG"){const m=e;if(m.closest("td[em-platform], td[data-em-platform]"))return;if(m.closest(".em-element-resize-img-container")||m.closest('div[style*="font-size"][style*="line-height"][style*="font-family"]')||m.closest("editor")||m.classList.contains("em-video")){if(m.closest(".em-element-resize-img-container")){const L=m.closest(".em-element-resize-img-container"),k=L.querySelector(".em-element-img-edit");!m.getAttribute("src")?.includes(".gif")&&o?k||B({targetElement:L.querySelector(".em-element-img-change-group"),insertType:"prepend",className:"em-element-img-edit",tag:"i",HTMLcontent:Re(Wa,`${Oe}`),title:t.CHANGE_IMAGE_EDIT}):L.querySelector(".em-element-img-edit")?.remove()}return}const p=document.createElement("span");p.classList.add("em-element-resize-img-container"),pE(p),gE(p);const S=m.parentElement instanceof HTMLAnchorElement?m.parentElement:m;S.parentElement?.insertBefore(p,S),p.appendChild(S);const C=B({targetElement:p,insertType:"append",tag:"span",className:"em-element-resize-img"});fte(C,function(L){Xi(C,L.movementX)},function(){Ki(C)}),m?.style.maxWidth&&m?.style.display==="block"&&m.closest(".em-element-resize-img-container")?.classList.add("em-display-block"),Ste(m,p)}}}function Ste(e,t){const n=qk;if(!n||t.querySelector(".em-element-img-change-group"))return;const r=n.getLocale(),o=gte(),i=Uk(),s=bte(),a=yte(),l=vte();if(o&&e.getBoundingClientRect().width>40&&e.getBoundingClientRect().height>40&&!e.classList.contains("em-countdown")){const c=B({targetElement:t,insertType:"append",className:"em-element-img-change-group"});if(B({targetElement:c,insertType:"append",className:"em-element-img-change",HTMLcontent:'<svg viewBox="0 0 20 20" focusable="false" data-icon="bg-colors" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M3.75 17.5C3.41667 17.5 3.125 17.375 2.875 17.125C2.625 16.875 2.5 16.5833 2.5 16.25V3.75C2.5 3.41667 2.625 3.125 2.875 2.875C3.125 2.625 3.41667 2.5 3.75 2.5H16.25C16.5833 2.5 16.875 2.625 17.125 2.875C17.375 3.125 17.5 3.41667 17.5 3.75V16.25C17.5 16.5833 17.375 16.875 17.125 17.125C16.875 17.375 16.5833 17.5 16.25 17.5H3.75ZM3.75 16.25H16.25V3.75H3.75V16.25ZM4.91667 14.2292H15.1042L12.0417 10.1458L9.29167 13.7083L7.35417 11.0625L4.91667 14.2292Z"></path></svg>',title:r.CHANGE_IMAGE}),!e.getAttribute("src")?.includes(".gif")&&i&&B({targetElement:c,insertType:"append",className:"em-element-img-edit",tag:"i",HTMLcontent:Re(Wa,`${Oe}`),title:r.CHANGE_IMAGE_EDIT}),s&&B({targetElement:c,insertType:"append",className:"em-element-img-stock",tag:"i",HTMLcontent:'<svg viewBox="0 0 12 12" focusable="false" data-icon="ai" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M4.12726 7.18183H9.6909L7.86364 4.76364L6.44545 6.63637L5.4909 5.49092L4.12726 7.18183ZM0.909082 11.3636C0.659082 11.3636 0.445068 11.2746 0.267041 11.0966C0.0890136 10.9186 0 10.7046 0 10.4546V2.99999H0.909082V10.4546H10.7273V11.3636H0.909082ZM2.72726 9.54546C2.47726 9.54546 2.26325 9.45644 2.08522 9.27842C1.90719 9.10039 1.81818 8.88638 1.81818 8.63638V1.90908C1.81818 1.65908 1.90719 1.44507 2.08522 1.26704C2.26325 1.08901 2.47726 1 2.72726 1H5.81817L6.90908 2.09091H11.0909C11.3409 2.09091 11.5549 2.17992 11.733 2.35795C11.911 2.53598 12 2.74999 12 2.99999V8.63638C12 8.88638 11.911 9.10039 11.733 9.27842C11.5549 9.45644 11.3409 9.54546 11.0909 9.54546H2.72726ZM2.72726 8.63638H11.0909V2.99999H6.53182L5.44091 1.90908H2.72726V8.63638Z"></path></svg>',title:r.CHANGE_IMAGE_STOCK}),B({targetElement:c,insertType:"append",className:"em-element-img-changeto",tag:"i",HTMLcontent:Re(lte,`${Oe}`),title:r.CHANGE_IMAGE_CHANGETO}),a&&B({targetElement:c,insertType:"append",className:"em-element-img-gif",tag:"i",HTMLcontent:'<svg viewBox="0 0 12 12" focusable="false" data-icon="ai" width="1em" height="1em" fill="currentColor" aria-hidden="true"><<path d="M5.68571 8.14286V3H6.79999V8.14286H5.68571ZM0.771429 8.14286C0.54 8.14286 0.353571 8.06786 0.212143 7.91786C0.0707142 7.76786 0 7.58571 0 7.37143V3.77143C0 3.55714 0.0707142 3.375 0.212143 3.225C0.353571 3.075 0.54 3 0.771429 3H3.40001C3.63144 3 3.81786 3.075 3.95929 3.225C4.10072 3.375 4.17144 3.55714 4.17144 3.77143V4.11429H1.11429V7.02857H3.05715V5.57143H4.17144V7.37143C4.17144 7.58571 4.10072 7.76786 3.95929 7.91786C3.81786 8.06786 3.63144 8.14286 3.40001 8.14286H0.771429ZM8.25714 8.14286V3H12V4.11429H9.37142V5.25714H11.1V6.37142H9.37142V8.14286H8.25714Z"></path></svg>',title:r.CHANGE_IMAGE_GIF}),l&&B({targetElement:c,insertType:"append",className:"em-element-img-ai",tag:"i",HTMLcontent:'<svg viewBox="0 0 12 12" focusable="false" data-icon="ai" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M2.45454 11.7273C2.45454 11.7273 2.16994 10.446 1.66154 9.88113C1.15314 9.31625 0 9 0 9C0 9 1.15314 8.68374 1.66154 8.11887C2.16994 7.554 2.45454 6.27273 2.45454 6.27273C2.45454 6.27273 2.73915 7.554 3.24755 8.11887C3.75594 8.68374 4.90909 9 4.90909 9C4.90909 9 3.75594 9.31625 3.24755 9.88113C2.73915 10.446 2.45454 11.7273 2.45454 11.7273Z"></path><path d="M7.63636 9C7.63636 9 7.1304 6.94996 6.22658 6.04614C5.32276 5.14233 3.27273 4.63636 3.27273 4.63636C3.27273 4.63636 5.32276 4.1304 6.22658 3.22657C7.1304 2.32275 7.63636 0.272728 7.63636 0.272728C7.63636 0.272728 8.14233 2.32275 9.04615 3.22657C9.94996 4.1304 12 4.63636 12 4.63636C12 4.63636 9.94996 5.14233 9.04615 6.04614C8.14233 6.94996 7.63636 9 7.63636 9Z"></path><path d="M1.63636 4.09091C1.63636 4.09091 1.44663 3.19402 1.10769 2.7986C0.768758 2.40318 0 2.18182 0 2.18182C0 2.18182 0.768758 1.96046 1.10769 1.56503C1.44663 1.16961 1.63636 0.272728 1.63636 0.272728C1.63636 0.272728 1.8261 1.16961 2.16503 1.56503C2.50397 1.96046 3.27273 2.18182 3.27273 2.18182C3.27273 2.18182 2.50397 2.40318 2.16503 2.7986C1.8261 3.19402 1.63636 4.09091 1.63636 4.09091Z"></path><path d="M10.6364 11.7273C10.6364 11.7273 10.4782 11.0866 10.1958 10.8042C9.91336 10.5218 9.27273 10.3636 9.27273 10.3636C9.27273 10.3636 9.91336 10.2055 10.1958 9.92307C10.4782 9.64064 10.6364 9 10.6364 9C10.6364 9 10.7945 9.64064 11.0769 9.92307C11.3594 10.2055 12 10.3636 12 10.3636C12 10.3636 11.3594 10.5218 11.0769 10.8042C10.7945 11.0866 10.6364 11.7273 10.6364 11.7273Z"></path></svg>',title:r.CHANGE_IMAGE_AI}),n.commit(!1),zk.has(c))return;zk.add(c),ute(t,c,".em-element-resize-img-container:hover > .em-element-img-change-group:hover"),c.addEventListener("click",function(u){const d=u.target.closest('i[class*="em-element-img"]'),f=e.getAttribute("src");let h="application_open-image-edit-popup";e.classList.contains("em-ai-img")||d?.classList.contains("em-element-img-ai")?h="application_open-image-ai-popup":IU(f)||d?.classList.contains("em-element-img-changeto")?h="application_open-image-upload-popup":d?.classList.contains("em-element-img-gif")?h="application_open-image-gif-popup":d?.classList.contains("em-element-img-stock")&&(h="application_open-image-stock-popup");const m={operation:h,src:f};setTimeout(()=>{n.messageService.send(m)},100)})}}function jk(e){const t=e.ownerDocument.activeElement;return!!t&&we(t)&&t!==e.ownerDocument.body&&t.closest('[contenteditable="true"]')!==null&&e.contains(t)}function wte(e){return!!e.parentElement?.matches('body>[em="block-contaner"]')}function _te(e){const t=(n,r)=>{if(!jk(n)){if(r&&wte(n)){n.querySelector("editor")||e.wrapEditor(n);return}e.wrapEditor(n,r)}};return function(r){let o=r.target;const i=e.selectionLock.acquire();try{o=e.getVisibleNode(o);const s=e.isInExternal(o),a=document.body;if(a?.classList.contains("mceNonEditable")&&!a.classList.contains("em-sandbox-discuss")||a?.classList.contains("em-sandbox-discuss")&&!a.classList.contains("em-sandbox-discuss_set-target"))return;if(a?.classList.contains("em-sandbox-discuss_set-target")){document.querySelectorAll('[em-hover="true"]').forEach(f=>{f.removeAttribute("em-hover"),f.removeAttribute("contenteditable")}),o.closest(".em-element-vindent")||(o.setAttribute("em-hover","true"),o.setAttribute("contenteditable","true"));return}if(o.tagName!=="BODY"){const f=o.parentElement;pC(o)&&!o.isConnected&&f&&(o=f)}if(o&&(o?.closest('[em="atom"]')||!s)&&o.getAttribute("contenteditable")!=="false"&&o.parentElement?.getAttribute("contenteditable")!=="false"&&o.tagName!=="BODY"&&o.parentElement?.tagName!=="SECTION"){const f=!o.closest("editor")&&!jk(o),h=!e.getLockEditorInit(),m=o.tagName!=="IMG",p=!(o.childElementCount===1&&o.firstElementChild?.tagName==="IMG"&&(o.textContent?.trim()??"")==="");if(f&&h&&m&&p){let S=o;do if(S=S.closest("div, p, h1, h2, h3, h4, h5")||S.closest("span, b, strong, i, em, s, a, sup, sub"),S)if(!e.isVisible(S))S=S.parentElement;else break;while(S);if(o.tagName==="LI"&&o.style.fontFamily&&o.style.fontSize){const C=o.closest("ul, ol");C&&t(C,!0)}else if(o.tagName==="TD"&&o.style.fontFamily&&o.style.fontSize&&!o.querySelector("editor"))t(o);else if(S&&S.style.fontFamily&&S.style.fontSize&&(o.tagName==="LI"||!o.querySelector("img")))if(o.tagName==="LI"){const C=o.closest("ul, ol");C&&t(C,!0)}else o.querySelector("img")||t(o,!0);else if(S&&S.closest('[style*="font-family"][style*="font-size"]')){const C=S.closest('[style*="font-family"][style*="font-size"]');C&&C.tagName!=="BODY"&&C.tagName!=="TD"&&C.tagName!=="TABLE"?t(C,!1):C?.tagName==="TD"&&!C.querySelector("editor")&&!C.closest(".em-element-custom-table")&&t(C)}else if(S&&S?.tagName==="DIV"&&!S.querySelector("table")){const C=!!S.style.height?.length,L=S.className.includes("em-element-img-change-group"),k=S.querySelector("img")?.parentNode,y=!!S.querySelector("img")&&k&&!e.hasTextNodeInElement(k);!C&&!L&&!y&&t(S,!0)}else for(let C=0;C<o.childNodes.length;C++){const L=o.childNodes[C];if(L.nodeName==="#text"&&(L.textContent?.trim().length??0)>0&&!o.querySelector("table")){const k=o.tagName==="P"?o.parentElement:o;k&&t(k);break}}}}(o?.closest('[em="atom"]')||!s)&&!e.getIsLeftButtonDown()&&e.implementElementsEditors(o),o?.classList.contains("em-element-vindent-bg")&&(o=o.closest(".em-vindent")),o?.closest(".em-gap")?o.closest("tr")?.querySelectorAll(".em-mob-wrap:nth-child(even) .em-gap").forEach(f=>f.classList.add("em-hover")):e.getIsLeftButtonDown()||document.querySelectorAll(".em-gap").forEach(f=>f.classList.remove("em-hover"));const l=e.getLoadStylesTimer(),c=!!o.style.padding||!!o.style.paddingTop||!!o.style.paddingBottom||!!o.style.paddingLeft||!!o.style.paddingRight,u=o.closest('[em="block"]'),d=!!u?.querySelector(".em-mob-wrap, .noresp-em-mob-wrap")&&(u?.querySelectorAll(".em-mob-wrap, .noresp-em-mob-wrap").length??0)>2;l&&(o.tagName==="TD"&&(o.innerHTML===""||o.querySelector(".em-element-vindent"))&&o.getAttribute("height")||o.tagName==="DIV"&&o.style.height&&o.style.fontSize||o.tagName==="IMG"||c||d)&&e.implementResizableElems(o)}catch{}finally{i.releaseLater()}}}function Cte(e){return function(){e.removeElementEditors(),document.querySelectorAll('[em="group"] .em-element-editor, .em-element-path, .em-element-block-add').forEach(n=>{n.remove(),e.commit(!1)})}}function id(e){e.button===0&&V.set("isLeftButtonDown",!1)}function Vk(e){e.shiftKey||e.button===2||window.getSelection()?.removeAllRanges(),e.button===0&&V.set("isLeftButtonDown",!0)}function Tte(e){const t=()=>e.openEditorInit();return document.addEventListener("mousedown",Vk),document.addEventListener("mouseup",id),document.addEventListener("dragend",id),window.addEventListener("mousemove",t),{dispose(){document.removeEventListener("mousedown",Vk),document.removeEventListener("mouseup",id),document.removeEventListener("dragend",id),window.removeEventListener("mousemove",t)}}}function Ate(e,t,n){if(e.caretPositionFromPoint){const r=e.caretPositionFromPoint(t,n);if(!r)return null;const o=e.createRange();return o.setStart(r.offsetNode,r.offset),o.collapse(!0),o}return e.caretRangeFromPoint?.(t,n)??null}function kte(e){return function(n){const r=n.target;if(n.button!==0||n.shiftKey||!r||!we(r)||e.isEditLocked()||document.body?.classList.contains("mceNonEditable")||r.closest("editor")||(e.unlockEditorInit(),e.handleMouseover(n),r.closest("em-replace")))return;const o=(r.isConnected?r:document.elementFromPoint(n.clientX,n.clientY))?.closest("editor");if(!o)return;const i=Ate(document,n.clientX,n.clientY);if(i&&o.contains(i.startContainer)){const s=window.getSelection();s?.removeAllRanges(),s?.addRange(i)}}}function Gk(e,t,n){const r=Ca(e,n),o=r===void 0?void 0:t.cells.find(i=>i.id===r);return o?{row:o.row,col:o.col}:null}function Lte(){const e=new Map,t=r=>{He(r,!1,e.get(r)),e.delete(r)},n=(r,o)=>{He(r,!0,o),e.set(r,o)};return{paint(r){const o=new Set(r);[...e].filter(([i,s])=>s==="em-active-table-cell"&&!o.has(i)).forEach(([i])=>t(i)),r.filter(i=>!e.has(i)).forEach(i=>n(i,So))},mark:n,highlighted(){return[...e].filter(([,r])=>r===So).map(([r])=>r)},clear(){[...e.keys()].forEach(t)}}}function Nte(e,t){const n=Lte();let r=null,o=null,i=null;const s=()=>r&&e.contains(r)&&r.classList.contains("remove-basic-cell")?r:null,a={base:s,direction:()=>s()?i:null,selected:()=>s()?n.highlighted().filter(l=>e.contains(l)):[],start(l){t.activate(a),a.clear(),r=l,n.mark(l,Eo)},clear(){r=null,o=null,i=null,n.clear(),Cj(e)&&e.isConnected&&t.commit(!0)}};return{selection:a,press(l){a.start(l);const c=Mi(e),u=Gk(e,c,l);o=u?{model:c,base:u}:null},hover(l){const c=o&&Gk(e,o.model,l);if(!o||!c)return;const u=AV(o.model,o.base,c);i=u?.direction??null;const d=(u?.cellIds??[]).map(f=>wp(e,f));n.paint(d.filter(f=>!!f))},release(){o=null}}}function sd(e,t,n,r){const o=ht(r);t.addEventListener(n,o),e.addEventListener("abort",()=>t.removeEventListener(n,o),{once:!0})}function xte(e,t,n){const r=new AbortController,o=()=>e.isConnected?!1:(r.abort(),t.selection.clear(),n.forget(e,t.selection),!0),i=u=>{const d=Ng(u.target);return d?.table===e?d.td:null},s=u=>{const d=u.button===0?i(u):null;d&&t.press(d)},a=u=>{if((u.buttons&1)===0){t.release();return}const d=i(u);d&&t.hover(d)},l=()=>{o()||t.release()},c=u=>{!o()&&u.target instanceof Node&&!e.contains(u.target)&&t.selection.clear()};sd(r.signal,e,"mousedown",s),sd(r.signal,e,"mouseover",a),sd(r.signal,document,"mouseup",l),sd(r.signal,document,"click",c)}function Ote(e){return t=>{const n=Ng(t.target);n&&e.of(n.table)}}function Rte(e){const t=new WeakMap;let n=null;const r={commit:e.commit,activate(o){n&&n!==o&&n.clear(),n=o},forget(o,i){t.delete(o),n=n===i?null:n}};return{of(o){const i=t.get(o);if(i)return i;const s=Nte(o,r);return xte(o,s,r),t.set(o,s.selection),s.selection}}}var Mte=1e3;function Pte(e){setTimeout(()=>V.set("loadStylesTimer",!0),Mte);const t=_te({getVisibleNode:n=>e.htmlDocument.getVisibleNode(n),isInExternal:n=>e.htmlDocument.isInExternal(n),isVisible:n=>e.htmlDocument.isVisible(n),selectionLock:e.selectionLock,getLockEditorInit:()=>e.editLock.isEditorInitClosed(),getIsLeftButtonDown:()=>!!V.get("isLeftButtonDown"),getLoadStylesTimer:()=>!!V.get("loadStylesTimer"),hasTextNodeInElement:B5,wrapEditor:e.wrapEditor,implementElementsEditors:n=>Bee(n,{setBlockGroupControlsPosition:()=>bu({scrollTop:V.get("scrollTop")}),commit:e.commit}),implementResizableElems:n=>Ete(e.htmlDocument.getVisibleNode(n)),commit:e.commit});document.onmouseover=ht(n=>{t(n),e.onHover?.(n.target)}),document.onmouseleave=Cte({removeElementEditors:()=>ji(void 0),commit:e.commit}),document.addEventListener("mousedown",kte({isEditLocked:()=>e.editLock.isTextLocked(),unlockEditorInit:()=>e.editLock.openEditorInit(),handleMouseover:t}),!0),document.addEventListener("mousedown",ht(Ote(e.tableSelections)),!0),Tte(e.editLock)}function Ite(e){return t=>M(e,ms)(t)}function Dte(e){return e?.nodeType===Node.ELEMENT_NODE?e:e?.parentElement??null}var Bte={name:"sandbox.elementSettings",provides:[De],awaits:{services:[Y,Wo,qo,xe,Fo]},setup(e){const t=M(e,Wo),n=M(e,Fo);e.inject(De,KK({htmlDocument:M(e,Y),getMapObj:()=>t,fingerprint:M(e,qo),selectionLock:M(e,xe),enrichExtras:()=>e.getServices(ty).reduce((r,o)=>({...r,...o()}),{}),elementRefOf:r=>n.issue(r)}))}},Hte={name:"sandbox.documentChange",awaits:{services:[Y,qo,De,st,_e,ms,xe,Ye]},setup:e=>Yq({htmlDocument:M(e,Y),fingerprint:M(e,qo),initPreview:Ite(e),applicationElementSettingsSet:M(e,De),commit:ft(e),focusController:M(e,st).controller,selectionLock:M(e,xe),editLock:M(e,Ye)})},Fte={name:"sandbox.toggleTextStyle",provides:[hl],awaits:{services:[De,_e,xe]},setup(e){const t=M(e,De),n=ft(e),r=M(e,xe),o=(i,s=Je())=>{let a=Dte(Is(s,i)||i);if(a?.tagName==="EDITOR"&&(a=a.firstElementChild),!a)return;const l=a;r.lift(()=>t({elem:l}))};e.inject(hl,aJ({commit:n,addNewRange:ri,refreshElementSettings:o,findElementWithSelectedText:Is,getParentElementOfSelection:Jl,findOutermostParentWithText:cm,clearLinkTags:i=>{Ao(i,n),Vr(n)},addFontFamilyClass:i=>wa(i,n),getIsProgrammaticSelection:()=>!!V.get("isProgrammaticSelection"),getCommonStyles:()=>V.get("commonStyles")??{}}))}},$te={name:"sandbox.insert",provides:[Ar],awaits:{services:[Y,De,_e,Xd,xe,Ye]},setup:e=>e.inject(Ar,_ee({htmlDocument:M(e,Y),commit:ft(e),messageService:U,applicationElementSettingsSet:M(e,De),selectionLock:M(e,xe),editLock:M(e,Ye),...M(e,Xd)}))},Wte={name:"sandbox.elementSettingsApply",provides:[Uo],awaits:{services:[Y,Wo,_e,vt,De,hl,bn,st,xe]},setup(e){const t=M(e,_e),n=M(e,Wo),r=M(e,vt),o=M(e,De);let i=null;const s=l=>{i??(i=zQ({htmlDocument:M(e,Y),getMapObj:()=>n,commit:ft(e),commitLockedAsync:c=>t.commitLockedAsync(c),setCursorPosition:r,applicationElementSettingsSet:o,selectionLock:M(e,xe),toggleTextStyle:M(e,hl),wrapEditor:M(e,bn).now,programmaticSelection:{get value(){return!!V.get("isProgrammaticSelection")},set value(c){V.set("isProgrammaticSelection",c)}}})),i(l)},a=M(e,st).controller;e.inject(Uo,l=>a.whenEditorLostFocus(()=>s(l)))}},qte={name:"sandbox.tableSelections",provides:[zo],awaits:{services:[_e]},setup:e=>e.inject(zo,Rte({commit:ft(e)}))},zte={name:"sandbox.mouse",awaits:{services:[Y,bn,_e,xe,Ye,zo]},setup:e=>Pte({htmlDocument:M(e,Y),commit:ft(e),selectionLock:M(e,xe),editLock:M(e,Ye),wrapEditor:M(e,bn).deferred,tableSelections:M(e,zo)})},Ute={name:"sandbox.click",awaits:{services:[Y,_e,vt,st,De,bn,xe,Ye,zo]},setup(e){const t=M(e,_e),n=M(e,st);fee({htmlDocument:M(e,Y),commit:ft(e),commitLockedAsync:r=>t.commitLockedAsync(r),messageService:U,setCursorPosition:M(e,vt),setEditorFocus:r=>n.setEditorFocus(r),applicationElementSettingsSet:M(e,De),selectionLock:M(e,xe),editLock:M(e,Ye),wrapEditor:M(e,bn).now,tableSelections:M(e,zo),insertTextAtomIntoEmptyNarrowTable:r=>e.getInstance(ey)?.(r)??!1})}},jte={name:"sandbox.keyboard",awaits:{services:[_e,vt,De,bn,Ye]},setup:e=>ate({editLock:M(e,Ye),commit:ft(e),messageService:U,setCursorPosition:M(e,vt),applicationElementSettingsSet:M(e,De),wrapEditor:M(e,bn).now})},Vte={name:"sandbox.cssFilterOnCommit",awaits:{services:[Y]},setup:e=>_$(M(e,Y))},Gte={name:"sandbox.vmlButtonLabelSync",awaits:{services:[_e]},setup(e){const t=M(e,_e);rJ(n=>t.commit(n))}},Xte={name:"sandbox.buttonLineLayoutSync",awaits:{services:[_e]},setup(e){const t=M(e,_e);iJ(n=>t.commit(n))}},Kte={name:"sandbox.insertListeners",awaits:{services:[Ar]},setup:e=>M(e,Ar).register()};function Xk(e,t,n,r=""){lr(t.HTMLDocument.getOuterHtml(e)+r,([o,...i])=>!(o instanceof Element)||!n(o,i)?!1:(o.setAttribute("em-edit","active"),e.replaceWith(o),!0))&&t.commit(!0)}function Kk(e,t){const n=t.selectionLock.acquire();try{const r=t.getActiveEditElement();if(!r)return;const o=r.closest("amp-accordion");if(!o)return;const i=o.querySelector("section");if(!i)return;Xk(o,t,(a,[l])=>{if(!(l instanceof Element))return!1;const c=l.querySelector(":scope > header td div");if(c){const d=Array.from(c.childNodes).find(f=>f.nodeType===Node.TEXT_NODE);d&&(d.nodeValue=e.section)}const u=l.querySelector(":scope > div");return u&&(u.innerHTML=`<table cellpadding="0" cellspacing="0" border="0" width="100%" em="atom">
|
|
255
|
+
<tr>
|
|
256
|
+
<td style="padding: 10px 0;">
|
|
257
|
+
<div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5a5a5a;">${e.text}</div>
|
|
258
|
+
</td>
|
|
259
|
+
</tr></table>`),a.append(l),!0},t.HTMLDocument.getOuterHtml(i))}catch{}finally{n.releaseLater()}}function Yk(e,t){const n=t.selectionLock.acquire();try{const r=t.getActiveEditElement();if(!r)return;const o=r.closest("amp-accordion");if(!o)return;Xk(o,t,i=>(i.querySelectorAll("section")[e.index]?.remove(),!0))}catch{}finally{n.releaseLater()}}function Zk(e){return{selectionLock:e.selectionLock,commit:e.commit,getActiveEditElement:e.getActiveEditElement,HTMLDocument:e.HTMLDocument}}function Yte(e,t){!t.selectionLock||!t.HTMLDocument||!t.getActiveEditElement||Kk(e.data.settings,Zk(t))}function Zte(e,t){!t.selectionLock||!t.HTMLDocument||!t.getActiveEditElement||Yk(e.data.settings,Zk(t))}var Qte={sandbox_accordion_add_section:Yte,sandbox_accordion_remove_section:Zte};function Jte(e,t){yr(),He(document.body,!1,"em-block-insert-body","em-atom-insert-body");const n=document.querySelector(".em-block-insert");n&&n.classList.remove("em-block-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top");const r=document.querySelector(".em-block-insert-empty");r&&r.classList.remove("em-block-insert-empty");const o=document.querySelector(".em-atom-insert");o&&o.classList.remove("em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top");const i=document.querySelector(".em-atom-insert-empty");i&&i.classList.remove("em-atom-insert-empty"),document.querySelectorAll(".em-blockatom-insert").forEach(s=>{s.classList.remove("em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_bottom","em-block-insert_top-document","em-block-insert_top")}),t.messageService.send({operation:"application_scroll-block-hide"})}function ene(e,t){const{htmlDocument:n}=t;t.messageService.send({operation:"application_email_content_get",htmlCode:n.getOuterHtml(document.body)||n.getRootsHtml()})}var tne={"sandbox_drag-cancel":Jte,sandbox_email_content_get:ene};function nne(e,t){const n=e.data.settings?.emBlockId;if(n==null||n==="")return;const r=e.data.settings?.emBlockVersion;let o=U0()??null;if(!o){const i=Array.from(document.querySelectorAll('[em="block"]:not([em="block"] [em="block"])')),s=i.filter(a=>a.getAttribute("em-block-id")===String(n));o=s.length===1?s[0]:s.length===0&&i.length===1?i[0]:null}o&&(o.setAttribute("em-block-id",String(n)),r!=null&&r!==""&&o.setAttribute("em-block-version",String(r)),t.commit())}function rne(e,t){const n=U0();!n||!n.hasAttribute("em-block-id")||(n.removeAttribute("em-block-id"),n.removeAttribute("em-block-version"),t.commit())}var one={sandbox_eblock_set_em_block_id:nne,sandbox_eblock_clear_em_block_id:rne};function Qk(e){return e.replace(/\b(\d{1,3}(?:[ \xA0]\d{3})*(?:[.,]\d+)?)\b/g,t=>t.replace(/[ \xA0]/g,"").replace(/\B(?=(\d{3})+(?!\d))/g," ")).replace(/(\d[\d ]*[.,]?\d+)(?:\s| )?(?=(?:руб(?:\.|лей)?|р\.|долл(?:\.|аров)?|\$|₽|€|£|¥|USD|EUR|RUB))/gi,"$1 ").replace(/(\d[\d ]*[.,]?\d+) (руб(?:\.|лей)?|р\.|долл(?:\.|аров)?|\$|₽|€|£|¥|USD|EUR|RUB)/gi,"$1 $2")}function Jk(e,t){for(const n of e)n.type===I.HTML&&!al(n,n.parent)&&(n.content=t(n.content??"")),Jk(n.children,t)}function ine(e,t){const n=pn(e);Jk(n.roots,t);const r=document.createDocumentFragment(),o=Nb(void 0);try{r.append(...n.roots.map(i=>ro(i,!0,!0)))}finally{o()}return ti(r),r}var sne=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28"><rect width="28" height="28" rx="3" fill="#e5e7eb"/><circle cx="18.5" cy="9.5" r="2.5" fill="#9ca3af"/><path d="M5 21l6-7 4 4.5 3-3 5 5.5z" fill="#9ca3af"/></svg>')}`;function ad(e){e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.remove():e.elem.previousSibling&&ad({elem:e.elem.previousSibling})}function ld(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(n=>n.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(n=>n.remove()),e.elem.querySelector(".em-element-block-add")&&e.elem.querySelectorAll(".em-element-block-add").forEach(n=>n.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(n=>n.remove());const t=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(),ld({elem:t})));else if(e.elem.innerHTML.trim()==="")ad({elem:e.elem}),e.elem.remove(),ld({elem:t});else if(t&&!t.querySelector('div[style*="display"]')){for(const n of e.elem.childNodes)n.nodeName==="#text"&&n.textContent?.trim()===""?(ad({elem:n}),n.textContent=""):n.nodeName==="#comment"&&n.textContent?.indexOf("mso")!==-1&&(ad({elem:n}),n.remove());e.elem.innerHTML.trim()===""&&ld({elem:e.elem})}return!0}function ane(e){const t=document.querySelector("[em-edit]");if(!t)return;const n=e.getElementParent(t);let r=t.parentNode;const o=t.closest("editor");if(e.setCursorPosition(n),t.classList.contains("em-code")){const i=e.getVariableByIcon?.(t);i&&(i.parentNode?.removeChild(i),t.remove())}else if(t.tagName==="TD"&&t.innerHTML===""&&t.hasAttribute("height")){const i=t.closest("table");if(i){const s=i.previousSibling;s&&s?.textContent?.trim()===""&&s.remove(),i.remove()}}else if(t.closest(".em-element-resize-img-container"))r=t.closest(".em-element-resize-img-container").parentNode,t.closest("td")?.querySelector("editor")?.innerHTML===""&&t.closest("td")?.querySelector("editor")?.remove(),t.closest(".em-element-resize-img-container")?.remove();else if(t.closest('[em="atom"]')){const i=t.closest(".em-mob-wrap, .noresp-em-mob-wrap"),s=t.closest('[em="atom"]');t.tagName==="TD"&&t.previousElementSibling===null&&t.nextElementSibling===null?(r=s.parentNode,s?.remove()):(r=t.closest("td"),t.remove());const a=!!i&&Array.from(i.querySelectorAll('[em="atom"]')).some(l=>l!==s);t.tagName!=="TD"&&i&&!a&&i.textContent?.trim()===""&&(i.textContent="")}else{t.remove();const i=t.previousSibling;i&&i?.textContent?.trim()===""&&i.remove(),t.remove()}o&&(fo(o),o.remove()),ld({elem:r}),e.commit(),e.messageService.send({operation:"application_element_settings_close"})}function eL(e,t){const n=document.querySelector("[em-edit]");if(n)if(e.action==="add_p"){let r=null;if(["DIV","P","TD","EDITOR","B","STRONG","SPAN","I","EM","A"].includes(n.tagName)){if(n.closest("div")?.style.fontFamily?r=n.closest("div"):n.closest("p")?.style.fontFamily?r=n.closest("p"):r=n,r&&t.HTMLDocument){const o=t.HTMLDocument.getOuterHtml(r),i=r.closest("table"),s=`<table cellpadding="0" cellspacing="0" border="0" width="100%" em="atom"><tr><td style="padding-bottom: 10px;">${o}</td></tr></table>`;nr(i?.getAttribute("em")==="atom"?i:r,"afterend",s)}t.commit()}t.setCursorPosition(n)}else if(e.action==="add_img"){if(window.getSelection){const r=document.createElement("img");r.setAttribute("src",sne),r.setAttribute("width","28"),r.setAttribute("border","0"),r.setAttribute("alt",""),r.style.display="inline-block",r.style.verticalAlign="text-bottom";const o=window.getSelection();if(o?.getRangeAt&&o.rangeCount){const i=o.getRangeAt(0);i.deleteContents(),i.insertNode(r)}else document.querySelector("[em-edit]")?.prepend(r);t.commit()}}else(e.action==="typograf"||e.action==="typograf_all")&&mne(e,t).catch(r=>{})}var lne=/^(script|style|noscript|xmp|iframe|noembed|noframes)$/i,tL=/^[ \t\n\r\f]*$/;function nL(e,t,n){const{copy:r,counterpart:o}=$l(e),i=cne(e,o),s=c=>{const u=i.get(c);return!!u&&bE(u)},a=ine(t(r.innerHTML),n),l=new Map;oL(r,a,l,s)&&i.forEach((c,u)=>l.get(u)?.(c))}function cne(e,t){const n=new Map,r=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ALL);for(let o=r.nextNode();o;o=r.nextNode()){const i=t(o);i&&n.set(i,o)}return n}function rL(e){return[...(e instanceof HTMLTemplateElement?e.content:e).childNodes]}function oL(e,t,n,r){const o=rL(e),i=rL(t),s=n.size;let a=!1,l=0;for(let c=0;c<o.length;){const u=o[c],d=i[l];if(u.nodeType===Node.TEXT_NODE){const f=fne(o,c);c+=f.length;const h=d?.nodeType===Node.TEXT_NODE;if(!h&&!f.every(m=>tL.test(m.data))||(l+=h?1:0,!iL(f,h?d.data:"",n,r)))return!1;continue}if(!d||d.nodeType!==u.nodeType||!dne(u,d,r(u)))return!1;if(c+=1,l+=1,u.nodeType===Node.COMMENT_NODE){if(!iL([u],d.data,n,r))return!1}else if(u.nodeType===Node.ELEMENT_NODE&&(a||(a=r(u)&&!une(u,d)),!lne.test(u.nodeName)&&!oL(u,d,n,r)))return!1}return a&&[...n.keys()].slice(s).forEach(c=>n.delete(c)),l===i.length}function une(e,t){return e.attributes.length===t.attributes.length&&[...e.attributes].every(n=>t.getAttribute(n.name)===n.value)}function dne(e,t,n){return t.nodeName===e.nodeName||!n&&t.nodeName.toLowerCase()===e.nodeName.toLowerCase()}function fne(e,t){const n=[];for(let r=t;r<e.length&&e[r].nodeType===Node.TEXT_NODE;r+=1)n.push(e[r]);return n}function iL(e,t,n,r){if(e.map(i=>i.data).join("")===t)return!0;const o=e.filter(r);return o.length===0?!0:e.some(i=>!r(i)&&!tL.test(i.data))?!1:(o.forEach((i,s)=>n.set(i,a=>a.data=s===0?t:"")),!0)}var sL=()=>Mf(()=>Promise.resolve().then(()=>_d("./typograf.all.CGEpDoct.js")),void 0,{}.url);async function mne(e,t){const{default:n}=await sL();let r=document.querySelector("[em-edit]")?.closest("div")||document.querySelector("[em-edit]")?.closest("editor")||null;const o=e.action==="typograf"?r?.innerText:document.body.innerText,i=t.hasRussianText?.(o||"")??!1,s=new n({locale:[e.locale==="ru_RU"||i?"ru":"en-US"],htmlEntity:{type:"name",onlyInvisible:!0,list:["nbsp","shy","mdash","ndash","laquo","raquo"]}});s.disableRule("ru/punctuation/*"),s.disableRule("common/punctuation/*"),s.enableRule("common/punctuation/quote"),s.setSetting("common/punctuation/quote","ru",{left:"«",right:"»",removeDuplicateQuotes:!0}),s.setSetting("common/punctuation/quote","en-US",{left:'"',right:'"',removeDuplicateQuotes:!0}),s.disableRule("ru/dash/kakto"),s.disableRule("ru/dash/taki"),s.disableRule("ru/dash/izpod"),s.disableRule("ru/dash/izza"),s.disableRule("ru/dash/ka"),s.disableRule("ru/dash/to"),s.disableRule("ru/dash/koe"),s.disableRule("common/nbsp/nowrap"),s.disableRule("common/nbsp/dpi"),s.disableRule("common/nbsp/afterParagraphMark"),s.enableRule("common/nbsp/afterNumber"),s.disableRule("common/html/quot"),s.disableRule("ru/date/*"),s.disableRule("common/number/mathSigns"),s.disableRule("ru/number/ordinals"),s.disableRule("ru/number/comma"),s.disableRule("ru/symbols/NN"),s.disableRule("common/symbols/cf"),s.disableRule("ru/other/phone-number"),s.addSafeTag('<[^>]+class="preheader"[^>]*>',"</[^>]+>"),s.addSafeTag("<!--","-->");const a=l=>s.execute(l);fo(document.body),e.action==="typograf_all"?nL(document.body,a,Qk):r?.parentElement&&(r=r.parentElement,r?.parentElement&&nL(r.parentElement,a,Qk)),document.querySelectorAll(".em-element-resize-img").forEach(l=>l.remove()),document.querySelectorAll(".em-element-resize-img-container").forEach(l=>l.replaceWith(...l.childNodes)),document.querySelectorAll(".em-element-img-change-group").forEach(l=>l.remove()),document.querySelectorAll("editor").forEach(l=>l.replaceWith(...l.childNodes)),t.commit()}function aL(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function Bg(e){if(!e||e.tagName!=="A")return!1;const t=e.getAttribute("style");if(!t||!t.includes("display"))return!1;const n=e.style.display;return!(n!=="block"&&n!=="inline-block"||t.includes("mso-style-priority"))}function hne(e,t){const n=e.closest("a");if(Bg(n))return n;if(!t)return null;const r=aL(t.anchorNode)?.closest("a")??null;if(Bg(r))return r;const o=aL(t.focusNode)?.closest("a")??null;return Bg(o)?o:null}function lL(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"&&m0(e)?e.closest('[em="block"]')??e:e}function cL(e){return e?e.classList.contains("em-vindent-table")?e.querySelector("td"):e.classList.contains("em-element-resize-img-container")?e.querySelector("img"):e.getAttribute("em")==="block"&&e.tagName!=="DIV"?Ni(e)??e:e:null}function pne(e){const t=document.querySelector("[em-edit]");if(!t)return;const n=window.getSelection();if(hne(t,n)&&n&&!n.isCollapsed)try{n.collapseToEnd()}catch{}const r=e.getElementParent(t);r instanceof Element&&(e.setCursorPosition(r),e.applicationElementSettingsSet({elem:r}))}function gne(e){const t=document.querySelector("[em-edit]");if(!t)return;const n=cL(lL(t).previousElementSibling);n&&(e.setCursorPosition(n),e.applicationElementSettingsSet({elem:n}))}function bne(e){const t=document.querySelector("[em-edit]");if(!t)return;const n=cL(lL(t).nextElementSibling);n&&(e.setCursorPosition(n),e.applicationElementSettingsSet({elem:n}))}function yne(e,t){t.removeAllAttributes("em-edit");const n=document.querySelector(".em-editor-wrapper");n&&(n.style.display="none"),Dt(()=>document.querySelectorAll("editor").forEach(r=>{r.blur()}))}function vne(e,t){const n=t.elementPath[e.data.index??0];if(n?.elem){const r=n.elem;t.applicationElementSettingsSet({elem:r}),t.setCursorPosition(r)}}function Ene(e,t){t.removeAllAttributes("em-state");const n=t.elementPath[e.data.index??0];n?.elem&&n.elem.setAttribute("em-state","active")}function Sne(e,t){if(!t.getElementParent)return;const n={setCursorPosition:t.setCursorPosition,getElementParent:t.getElementParent,applicationElementSettingsSet:t.applicationElementSettingsSet};pne(n)}function wne(e,t){if(!t.getElementParent)return;const n={setCursorPosition:t.setCursorPosition,getElementParent:t.getElementParent,applicationElementSettingsSet:t.applicationElementSettingsSet};gne(n)}function _ne(e,t){if(!t.getElementParent)return;const n={setCursorPosition:t.setCursorPosition,getElementParent:t.getElementParent,applicationElementSettingsSet:t.applicationElementSettingsSet};bne(n)}function Cne(e,t){if(!t.getElementParent)return;const n={commit:t.commit,setCursorPosition:t.setCursorPosition,getElementParent:t.getElementParent,messageService:t.messageService,getVariableByIcon:t.getVariableByIcon};ane(n)}function Tne(e,t){if(!t.getElementParent)return;const n={action:e.data.action,locale:e.data.locale},r={commit:t.commit,setCursorPosition:t.setCursorPosition,getElementParent:t.getElementParent,messageService:t.messageService,HTMLDocument:t.HTMLDocument,hasRussianText:t.hasRussianText};eL(n,r)}var Ane={sandbox_element_active_reset:yne,sandbox_element_active_set:vne,sandbox_element_hover_set:Ene,sandbox_element_parent_get:Sne,sandbox_element_prev_get:wne,sandbox_element_next_get:_ne,sandbox_element_remove:Cne,sandbox_element_text:Tne},vr=".em-mob-wrap, .noresp-em-mob-wrap",Wt=".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)",ct='div[style*="inline-block"]';function Mo(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&&Mo({elem:e.elem.previousSibling,width:e.width})}function uL(e){const t=e.removedBlockIndex===0?"nextSibling":"previousSibling";e.elem.nodeName==="#comment"&&e.elem.textContent?.indexOf("mso")!==-1?e.elem.remove():e.elem[t]&&uL({elem:e.elem[t],removedBlockIndex:e.removedBlockIndex})}function cd(e){return!!e.querySelector(vr)||!!e.closest(vr)}function Va(e){return e.querySelector(vr)?document.querySelector('[em-edit="active"]'):e.closest(vr).parentElement}function ud(e){return e.querySelector(ct)?document.querySelector('[em-edit="active"]'):e.closest(ct).parentElement}function dL(e,t){const n=document.querySelector("[em-edit]");if(!n)return;const r=t.selectionLock.acquire();try{if(cd(n)){const o=Va(n),i=Bi(o),s=e.minWidth,a=o.querySelectorAll(Wt).length,l=a>1?parseFloat(String(e.gap)):20,c=a>1?parseFloat(String(e.gapMobile||e.gap)):20;let u="";o.querySelector(".em-mob-wrap")?u=`<td width="${l}" class="em-mob-wrap em-mob-height-${c}px"></td>
|
|
260
|
+
<td width="${s}" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>`:o.querySelector(".noresp-em-mob-wrap")&&(u=`<td width="${l}" class="noresp-em-mob-wrap noresp-em-mob-height-${c}px"></td>
|
|
261
|
+
<td width="${s}" valign="top" class="noresp-em-mob-wrap em-mob-width-100perc"></td>`);let d=0,f=0,h=0;o.querySelectorAll(Wt).forEach(p=>{parseFloat(p.getAttribute("width")||"0")>s&&h++,d+=parseFloat(p.getAttribute("width")||"0")});const m=(s+l)/h;if(o.querySelectorAll(Wt).forEach(p=>{if(parseFloat(p.getAttribute("width")||"0")>s){const S=Math.round(parseFloat(p.getAttribute("width")||"0")-m);p.setAttribute("width",String(S))}}),nr(o.querySelectorAll(Wt)[a-1],"afterend",u),o.querySelectorAll(Wt).forEach(p=>{f+=parseFloat(p.getAttribute("width")||"0")}),d-f-l!==0){const p=o.querySelector(vr),S=parseFloat(p.getAttribute("width")||"0")+(d-f-l);p.setAttribute("width",String(S))}Hi(i,"relayout"),t.setPercentsForColumns(o.querySelectorAll(Wt)),t.commit()}else{const o=ud(n),i=e.minWidth,s=o.querySelectorAll(ct).length,a=s>1?parseFloat(String(e.gap)):20,l='<!--[if (gte mso 9)|(IE)]></td><td width="'+(i+a)+`" valign="top"><![endif]-->
|
|
262
|
+
<div style="display: inline-block; width: `+(i+a)+`px; vertical-align: top;" class="em-mob-width-100perc">
|
|
263
|
+
<table width="`+i+`" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-91perc">
|
|
264
|
+
<tr>
|
|
265
|
+
<td align="left"></td>
|
|
266
|
+
</tr>
|
|
267
|
+
</table>
|
|
268
|
+
<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
|
|
269
|
+
</div>`;let c=0,u=0,d=0;if(s===1){const h=n.querySelector(ct)?o.querySelector(ct):n.closest(ct);h.style.removeProperty("max-width"),h.firstElementChild?.style.removeProperty("max-width"),h.firstElementChild?.style.removeProperty("width")}o.querySelectorAll(ct).forEach(h=>{const m=parseFloat(h.firstElementChild?.getAttribute("width")||"0");m>i&&d++,c+=m});const f=(i+a)/d;if(o.querySelectorAll(ct).forEach(h=>{const m=h;if(parseFloat(m.firstElementChild?.getAttribute("width")||"0")>i){const p=Math.round(parseFloat(m.style.width)-f),S=p-a;m.style.width=p+"px",Mo({elem:m,width:p}),m.firstElementChild?.tagName==="TABLE"&&m.firstElementChild.setAttribute("width",String(S))}}),nr(o.querySelectorAll(ct)[s-1],"afterend",l),o.querySelectorAll(ct).forEach(h=>{u+=parseFloat(h.firstElementChild?.getAttribute("width")||"0")}),c-u-a!==0){const h=o.querySelector(ct),m=parseFloat(h.style.width)+(c-u-a);h.style.width=m+"px",Mo({elem:h,width:m}),h.firstElementChild?.tagName==="TABLE"&&h.firstElementChild.setAttribute("width",String(m-a))}t.commit()}}catch{}finally{r.releaseLater()}}function fL(e,t){const n=document.querySelector("[em-edit]");if(!n)return;let r=null;const o=t.selectionLock.acquire();try{if(cd(n)){const i=Va(n),s=Bi(i);let a=0;const l=parseFloat(String(e.gap));i.querySelectorAll(Wt).forEach((d,f)=>{f===e.removedBlockIndex&&(a=parseFloat(d.getAttribute("width")||"0"),d===n.closest(vr)&&(n.closest(".em-structure > td")?.setAttribute("em-edit","active"),r=n.closest(".em-structure > td")),d.nextElementSibling&&d.previousElementSibling?d.previousElementSibling.remove():d.nextElementSibling&&!d.previousElementSibling?d.nextElementSibling.remove():!d.nextElementSibling&&d.previousElementSibling&&d.previousElementSibling.remove(),d.remove())});const c=i.querySelectorAll(Wt).length,u=Math.floor((a+l)/c);if(i.querySelectorAll(Wt).forEach(d=>{const f=Math.round(parseFloat(d.getAttribute("width")||"0")+u);d.setAttribute("width",String(f))}),c===1){const d=i.querySelector(vr),f=d.closest("table").parentElement;d.setAttribute("width",String(f.getBoundingClientRect().width-parseFloat(f.style.paddingLeft||"0")-parseFloat(f.style.paddingRight||"0")))}Hi(s,"relayout"),t.setPercentsForColumns(i.querySelectorAll(Wt))}else{const i=ud(n);let s=0;const a=parseFloat(String(e.gap));i.querySelectorAll(ct).forEach((u,d)=>{d===e.removedBlockIndex&&(s=parseFloat(u.style.width),u===n.closest(ct)&&n.closest(".em-structure > td")?.setAttribute("em-edit","active"),uL({elem:u,removedBlockIndex:e.removedBlockIndex}),u.remove())});const l=i.querySelectorAll(ct).length,c=Math.round(s/l);if(i.querySelectorAll(ct).forEach(u=>{const d=u,f=Math.round(parseFloat(d.style.width)+c),h=f-a;d.style.width=f+"px",Mo({elem:d,width:f}),d.firstElementChild?.tagName==="TABLE"&&d.firstElementChild.setAttribute("width",String(h))}),l===1){const u=i.querySelector(ct);u.style.width="100%",u.style.maxWidth=i.closest("table")?.style.maxWidth||"",Mo({elem:u,width:i.closest("table")?.style.maxWidth||""}),u.firstElementChild.style.width="91%",u.firstElementChild.style.maxWidth=parseFloat(u.firstElementChild?.getAttribute("width")||"0")+"px"}}}finally{t.commit(),Promise.resolve().then(()=>{o.release(),r&&t.applicationElementSettingsSet&&t.applicationElementSettingsSet({elem:r})})}}function mL(e,t){const n=document.createComment("em-swap");e.replaceWith(n),t.replaceWith(e),n.replaceWith(t)}function kne(e){e instanceof Element&&(e.querySelectorAll("editor").forEach(t=>{t.replaceWith(...Array.from(t.childNodes))}),e.querySelectorAll("[em-edit]").forEach(t=>t.removeAttribute("em-edit")),e.removeAttribute("em-edit"),e.querySelectorAll("[em-temp]").forEach(t=>t.remove()))}function hL(e,t=""){lr(t+Ns(e),n=>{n.forEach(kne),e.after(...n)})}function Lne(e,t){const n=document.querySelector("[em-edit]");if(!n)return;const{copiedBlockIndex:r,widths:o}=e,i=parseFloat(String(e.gap))||0,s=t.selectionLock.acquire();try{if(cd(n)){const a=Va(n),l=Bi(a),c=a.querySelectorAll(Wt)[r];if(!c)return;const u=c.nextElementSibling||c.previousElementSibling;hL(c,u?Ns(u):a.querySelector(".noresp-em-mob-wrap")?`<td width="${i}" class="noresp-em-mob-wrap noresp-em-mob-height-${i}px"></td>`:`<td width="${i}" class="em-mob-wrap em-mob-height-${i}px"></td>`);const d=a.querySelectorAll(Wt);d.forEach((f,h)=>{o[h]!=null&&f.setAttribute("width",String(o[h]))}),Hi(l,"relayout"),t.setPercentsForColumns(d),t.commit()}else{const a=ud(n),l=a.querySelectorAll(ct)[r];if(!l)return;hL(l,'<!--[if (gte mso 9)|(IE)]></td><td width="'+((o[r+1]??o[r]??0)+i)+`" valign="top"><![endif]-->
|
|
270
|
+
`),a.querySelectorAll(ct).forEach((c,u)=>{const d=c,f=o[u];if(f==null)return;const h=f+i;d.style.width=h+"px",Mo({elem:d,width:h}),d.firstElementChild?.tagName==="TABLE"&&d.firstElementChild.setAttribute("width",String(f))}),t.commit()}}catch{}finally{s.releaseLater()}}function pL(e,t){const n=document.querySelector("[em-edit]");if(!n)return;const{indexA:r,indexB:o}=e;if(r===o)return;const i=t.selectionLock.acquire();try{if(cd(n)){const s=Va(n),a=s.querySelectorAll(Wt),l=a[r],c=a[o];if(!l||!c)return;mL(l,c),t.setPercentsForColumns(s.querySelectorAll(Wt)),t.commit()}else{const s=ud(n).querySelectorAll(ct),a=s[r],l=s[o];if(!a||!l)return;mL(a,l),[a,l].forEach(c=>{Mo({elem:c,width:parseFloat(c.style.width)})}),t.commit()}}finally{i.releaseLater()}}function Nne(e,t){const n=t.selectionLock.acquire();try{const r=document.querySelector("[em-edit]");if(!r)return;const o=Np(Va(r));if(!o)return;e.wrap?pT(o):Aa(o,nG(o)),t.commit()}catch{}finally{n.releaseLater()}}function xne(e,t){const n=t.selectionLock.acquire();try{const r=document.querySelector("[em-edit]");if(!r)return;const o=r.querySelector(vr)?document.querySelector('[em-edit="active"]'):r.closest(vr)?.parentElement?.closest("td");if(!o)return;e.dirRevert?(o.setAttribute("dir","rtl"),o.querySelectorAll("td").forEach(i=>{for(let s=i.firstChild;s;s=s.nextSibling)if(s.nodeType===3){s.parentNode?.setAttribute("dir","ltr");break}})):(o.removeAttribute("dir"),o.querySelectorAll("[dir]").forEach(i=>i.removeAttribute("dir"))),t.commit()}catch{}finally{n.releaseLater()}}function Yi(e){return{selectionLock:e.selectionLock,commit:e.commit,setPercentsForColumns:e.setPercentsForColumns,emailWidth:e.emailWidth,applicationElementSettingsSet:e.applicationElementSettingsSet}}function One(e,t){!t.selectionLock||!t.setPercentsForColumns||dL(e.data.settings,Yi(t))}function Rne(e,t){!t.selectionLock||!t.setPercentsForColumns||fL(e.data.settings,Yi(t))}function Mne(e,t){!t.selectionLock||!t.setPercentsForColumns||Lne(e.data.settings,Yi(t))}function Pne(e,t){!t.selectionLock||!t.setPercentsForColumns||pL(e.data.settings,Yi(t))}function Ine(e,t){!t.selectionLock||!t.setPercentsForColumns||Nne(e.data.settings,Yi(t))}function Dne(e,t){!t.selectionLock||!t.setPercentsForColumns||xne(e.data.settings,Yi(t))}var Bne={sandbox_floatBlock_add:One,sandbox_floatBlock_remove:Rne,sandbox_floatBlock_copy:Mne,sandbox_floatBlock_swap:Pne,sandbox_floatblock_wrap:Ine,sandbox_floatblock_dir:Dne},Hne='<table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td height="20"></td></tr></table>',Fne=['[em="block"].empty-structure td[em-edit="active"]:not([height]):not([width]):empty','[em="block"].empty-structure td[em-edit="active"]:not([height]):not([width])','.em-structure td[em-edit="active"]:not([height]):not([width]):empty','.em-structure td[em-edit="active"]:not([height]):not([width])','.em-structure td.em-mob-wrap[em-edit="active"]','.em-structure td.noresp-em-mob-wrap[em-edit="active"]'];function gL(){yr(),He(document.body,!1,"em-block-insert-body","em-atom-insert-body","em-atom-insert-body-inside"),document.querySelectorAll(".em-block-insert-empty").forEach(e=>e.classList.remove("em-block-insert-empty")),document.querySelectorAll(".em-atom-insert-empty").forEach(e=>e.classList.remove("em-atom-insert-empty"))}function bL(){const e=document.querySelectorAll('[em="block"]');return e.length?e[e.length-1]:null}function yL(){for(const e of Fne){const t=document.querySelector(e);if(t)return t}return null}function vL(e){const t=e.querySelectorAll('[em="atom"]');return t.length?t[t.length-1]:e}function EL(e){const t=e.querySelectorAll('[em="atom"]');if(t.length)return t[t.length-1];const n=e.querySelector("td.em-mob-wrap")??e.querySelector("td.noresp-em-mob-wrap")??e.querySelector('td[em-edit="active"]:not([height]):not([width])');return n||(we(e)?Xu(e):null)}function $ne(e,t,n){const r=e.getAttribute("em")==="atom",o=r?"afterend":"beforeend",i=r?e.parentElement:e;return t.match(/class="em-countdown"/gi)?n.insertCountdown({targetElem:e,targetPlace:o,atomHTML:t}):n.insertAdjacentHTML(e,o,t),Wne(i,e,r)}function Wne(e,t,n){if(n){const r=t.nextElementSibling;if(r?.getAttribute("em")==="atom")return r}if(e){const r=e.querySelectorAll('[em="atom"]');if(r.length)return r[r.length-1]}return null}function Hg(e,t,n){return t.match(/em="atom"><tr><td>\s*<img/gi)&&(t=n.setImageWidth({atomHTML:t,targetAtom:e})),t=n.commonStylesApply({html:t}),$ne(e,t,n)}function qne(e,t){if(!e||document.querySelector('[em="block"][em-edit="active"], [em="block"] [em-edit="active"]')||document.documentElement.scrollHeight+(t.iframeOffsetTop||0)<=(t.previewHeight||0))return;const n=e.getBoundingClientRect();t.messageService.send({operation:"application_scroll-to",settings:{value:n.top+n.height}})}function zne(e,t){const n=jp();if(!n)return null;e.match(/em="atom"><tr><td>\s*<img/gi)&&(e=t.setImageWidth({atomHTML:e,targetAtom:n})),e=t.commonStylesApply({html:e});let r=ck(e);if(e!==Hne){const i=r.match(/<style((.|\n|\r)*?)<\/style>/g);t.setDocumentStyles(i)}r=t.commonStylesApplyToBlock({html:r}),(r.indexOf("empty-structure")>-1||r.indexOf("em-structure")>-1)&&(r=t.setFloatBlocksWidth({blockHTML:r,targetBlock:n}),r=t.fitImagesToColumns(r));const o=!!e.match(/class="em-countdown"/gi);return r.substring(0,3)!=="<tr"||!cn(n)?null:(o?t.insertCountdown({targetElem:br(n),targetPlace:"beforeend",atomHTML:r}):t.insertAdjacentHTML(br(n),"beforeend",r),n.querySelector('[em="block"]:last-child')??n.lastElementChild)}function SL(e){return typeof e=="string"?e:e&&typeof e=="object"&&typeof e.html=="string"?e.html:""}function wL(e,t){e&&t.messageService.send(ue.APPLICATION_ATOM_INSERTED,e),gL()}function _L(e,t){t.messageService.send("application_block_inserted",{type:e.type,name:e.name,blockId:e.blockId,project:e.project}),gL()}function CL(e,t){const n=SL(e.atomHTML),r=n.match(/<style((.|\n|\r)*?)<\/style>/g);return t.setDocumentStyles(r),n.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim()}function Une(e,t){if(!yL()&&!bL()&&!jp())return!1;let n=CL(e,t);if(!n)return!1;let r=null;const o=yL();if(o)r=Hg(vL(o),n,t);else{const i=bL();if(i){const s=EL(i);s&&(r=Hg(s,n,t))}else r=zne(n,t)}return r?(qne(r,t),!0):!1}function TL(e,t){const n=document.createElement("table");n.setAttribute("cellspacing","0"),n.setAttribute("cellpadding","0"),n.setAttribute("align","center"),n.setAttribute("border","0"),n.setAttribute("em","block"),n.setAttribute("width",e.getAttribute("width")??String(e.getBoundingClientRect().width)),n.classList.add("em-mob-width-100perc"),lr(`
|
|
271
|
+
`+t+`
|
|
272
|
+
`,r=>{n.replaceChildren(...r),n.querySelectorAll('tr[em="block"]').forEach(o=>o.removeAttribute("em")),e.insertAdjacentElement("afterend",n)})}function jne(e,t,n){if(e.tagName==="TR"){t.substring(0,3)==="<tr"?n.insertAdjacentHTML(e,"afterend",t):n.insertAdjacentHTML(e,"afterend",'<tr em="block"><td align="center">'+t+"</td></tr>");return}t.substring(0,3)==="<tr"?TL(e,t):n.insertAdjacentHTML(e,"afterend",t)}function Fg(e,t,n){if(!e.blockHTML?.trim())return!1;const r=jp(),o=r?null:document.querySelector('[em="block"][em-edit="active"], [em="block"] [em-edit="active"]')?.closest('[em="block"]')??Vp();if(!n&&!r&&!o)return!1;const i=ip(t.parseFromString(e.blockHTML));let s=i.filter(h=>h.tagName&&h.tagName!=="LINK"&&h.tagName!=="STYLE").map(h=>t.getOuterHtml(h)).join(""),a=i.filter(h=>h.tagName==="STYLE").map(h=>t.getOuterHtml(h)).join("");const l=t.assetsRoot?.()??document.head,c=i.filter(h=>h.tagName==="LINK"&&h.getAttribute("em-class")).filter(h=>!l?.querySelector(`link[em-class="${h.getAttribute("em-class")}"]`));if(a){let h=l?.querySelector('style[em="styles"]'),m="";h?m=t.HTMLDocument.getInnerHtml(h):(h=document.createElement("style"),h.setAttribute("em","styles"),h=l?.insertAdjacentElement("beforeend",h));const p=document.createElement("div");t.emailWidth&&(a=a.replace(/(max-device-width:|max-width:)\d+px/g,C=>C.replace(/\d+/,String(t.emailWidth)))),p.insertAdjacentHTML("afterbegin",a);let S=t.minify(m+`
|
|
273
|
+
`+[...p.querySelectorAll("style")].map(C=>C.innerHTML).join(`
|
|
274
|
+
`),{restructure:!0,forceMediaMerge:!0}).css;S=t.cssbeautify(S,{indent:" ",autosemicolon:!0}),h.textContent=`
|
|
275
|
+
`+S+`
|
|
276
|
+
`}for(const h of c.reverse())l?.prepend(h),l?.insertAdjacentHTML("afterbegin",`
|
|
277
|
+
`);if(e.type!=="project"&&(s=t.commonStylesApplyToBlock({html:s})),s.match(/class="em-countdown"/gi)&&(s=t.uptimeCountdown({blockHTML:s})),n)return(s.indexOf("empty-structure")>-1||s.indexOf("em-structure")>-1)&&(s=t.setBlockMaxWidth({blockHTML:s,targetBlock:n}),s=t.setFloatBlocksWidth({blockHTML:s,targetBlock:n,project:e.project})),s=t.checkBlockAdaptivity({blockHTML:s,blockIsTr:s.substring(0,3)==="<tr"}),jne(n,s,t),!0;let u=null,d=null,f=!1;return r?(u=r,d=u,(s.indexOf("empty-structure")>-1||s.indexOf("em-structure")>-1)&&(s=t.setBlockMaxWidth({blockHTML:s,targetBlock:u}),s=t.setFloatBlocksWidth({blockHTML:s,targetBlock:u,project:e.project})),s=t.checkBlockAdaptivity({blockHTML:s,blockIsTr:s.substring(0,3)==="<tr"}),s.substring(0,3)==="<tr"?t.insertAdjacentHTML(br(r),"beforeend",s):t.insertAdjacentHTML(br(r),"beforeend",'<tr><td align="center">'+s+"</td></tr>"),f=!0):o&&(u=o,(s.indexOf("empty-structure")>-1||s.indexOf("em-structure")>-1)&&(s=t.setBlockMaxWidth({blockHTML:s,targetBlock:u}),s=t.setFloatBlocksWidth({blockHTML:s,targetBlock:u,project:e.project})),s=t.checkBlockAdaptivity({blockHTML:s,blockIsTr:s.substring(0,3)==="<tr"}),u?.tagName==="TR"?(s.substring(0,3)==="<tr"?t.insertAdjacentHTML(u,"afterend",s):t.insertAdjacentHTML(u,"afterend",'<tr em="block"><td align="center">'+s+"</td></tr>"),f=!0):u&&(s.substring(0,3)==="<tr"?TL(u,s):t.insertAdjacentHTML(u,"afterend",s),f=!0),d=u?.nextSibling),f&&!document.querySelector('[em="block"][em-edit="active"], [em="block"] [em-edit="active"]')&&document.documentElement.scrollHeight+(t.iframeOffsetTop||0)>(t.previewHeight||0)&&d&&t.messageService.send({operation:"application_scroll-to",settings:{value:d.getBoundingClientRect().top+d.getBoundingClientRect().height}}),f}function Vne(e,t){if(t.lockEditor||!SL(e.atomHTML).trim())return;const n=t.selectionLock.acquire();try{t.setAtomReplaced?.(null),QA({kind:"atom",settings:e}),e.action!=="insert"&&He(document.body,!0,"em-atom-insert-body"),e.action==="insert"&&Une(e,t)&&wL(e.name,t),t.commit()}catch{}finally{n.releaseLater()}}function Gne(e){return e.replace(/["\\]/g,"\\$&")}function Xne(e,t){if(t.lockEditor)return 0;const n=e.emBlockId;if(!n||!e.blockHTML?.trim())return 0;const r=`[em="block"][em-block-id="${Gne(String(n))}"]`,o=Array.from(document.querySelectorAll(r));if(!o.length)return 0;let i=0;const s=t.selectionLock.acquire();try{for(const a of o)Fg({action:"insert",blockHTML:e.blockHTML,type:e.type,project:e.project,name:e.name},t,a)&&(a.remove(),i+=1);t.commit()}finally{s.releaseLater()}return i}function Kne(e,t){if(t.lockEditor||!e.blockHTML?.trim())return;const n=t.selectionLock.acquire();try{QA({kind:"block",settings:e}),He(document.body,!0,"em-block-insert-body"),e.action==="insert"&&Fg(e,t)&&_L(e,t),t.commit()}finally{n.releaseLater()}}function Yne(e){const t=[...document.querySelectorAll('[em="block"]')].filter(n=>!e.has(n));return t.filter(n=>!t.some(r=>r!==n&&r.contains(n)))}function Zne(e,t,n){if(t.lockEditor||!e.blockHTML?.trim())return null;const r=new Set(document.querySelectorAll('[em="block"]')),o=t.selectionLock.acquire();try{if(!Fg({...e,action:"insert"},t,n?.target))return null;const i=Yne(r);return n?.place==="before"&&i.length&&n.target.before(...i),_L(e,t),t.commit(),i[0]??null}finally{o.releaseLater()}}function Qne(e,t,n){if(t.lockEditor)return null;const r=t.selectionLock.acquire();try{const o=CL(e,t);if(!o)return null;const i=()=>n.target.getAttribute("em")==="block"?EL(n.target):vL(n.target),s=n.place==="inside"?i():n.target,a=s?Hg(s,o,t):null;return a&&n.place==="before"&&n.target.before(a),a&&wL(e.name,t),t.commit(),a}finally{r.releaseLater()}}function Jne(e,t){const n=t.getInsertContext?.();if(!n)return;const r=e.data.settings??{};Vne({action:e.data.action,atomHTML:r.atomHTML,name:r.name},n)}function ere(e,t){const n=t.getInsertContext?.();if(!n)return;const r=e.data.settings??{};Kne({action:e.data.action,blockHTML:r.blockHTML,type:r.type,project:r.project,name:r.name,blockId:r.blockId},n)}function tre(e,t){t.setElementSettings?.(e)}var nre={"sandbox_atom-insert":Jne,"sandbox_block-insert":ere,sandbox_element_settings_set:tre},rre=Sn("elements",Ane,{services:[De,vt,_e,kr]},e=>{const t=M(e,De),n=M(e,vt),r=ft(e),o=M(e,kr);return()=>({HTMLDocument:{getOuterHtml:It},applicationElementSettingsSet:t,commit:r,elementPath:o.elementPath,getElementParent:i=>$i(i),getVariableByIcon:pa,hasRussianText:tS,messageService:U,removeAllAttributes:xr,setCursorPosition:i=>n(i)})}),ore=Sn("display",tne,{services:[Y]},e=>{const t=M(e,Y);return()=>({messageService:U,htmlDocument:t})}),ire=Sn("floatBlock",Bne,{services:[De,_e,xe]},e=>{const t=M(e,De),n=ft(e),r=M(e,xe);let o=600;return V.subscribe(i=>{i.emailWidth!==void 0&&(o=i.emailWidth)}),()=>({applicationElementSettingsSet:t,commit:n,emailWidth:o,selectionLock:r,setPercentsForColumns:i=>ec(i)})}),sre=Sn("accordion",Qte,{services:[_e,xe]},e=>{const t=ft(e),n=M(e,xe);return()=>({HTMLDocument:{getOuterHtml:It},commit:t,selectionLock:n,getActiveEditElement:Ds,parseFromString:r=>Ne(r)})}),are=Sn("eblock",one,{services:[_e]},e=>{const t=ft(e);return()=>({commit:t})}),lre=Sn("palette",nre,{services:[Ar,Uo]},e=>{const t=M(e,Ar),n=M(e,Uo);return()=>({getInsertContext:t.insertContext,setElementSettings:n})}),cre=Sn("nativeImageDrop",{[ue.SANDBOX_NATIVE_IMAGE_DROP_CLEAR]:()=>sk()},void 0,()=>()=>({})),ure=[rre,ore,ire,sre,are,lre,cre];function AL(e){const t=e.activeElement;return!!t&&!!t.closest('[contenteditable="true"]')&&e.hasFocus()}function dre(e){return AL(e)?new Promise(t=>{const n=()=>{setTimeout(()=>{AL(e)||(e.removeEventListener("focusout",n,!0),e.defaultView?.removeEventListener("blur",n),t())},0)};e.addEventListener("focusout",n,!0),e.defaultView?.addEventListener("blur",n)}):Promise.resolve()}function dd(){let e=null;if(document.querySelector(".preheader"))document.querySelectorAll(".preheader").length>1?document.querySelectorAll(".preheader").forEach(t=>{t.innerHTML.match(/[a-zA-Zа-яА-Я0-9]/gi)&&(e=t)}):e=document.querySelector(".preheader");else if(document.querySelector(".mcnPreviewText"))e=document.querySelector(".mcnPreviewText");else if(document.querySelector(".mail_preheader"))e=document.querySelector(".mail_preheader");else if(document.querySelector(".dvPreheader"))e=document.querySelector(".dvPreheader");else if(document.querySelector('[class*="letteros"]')||document.querySelector("[letteros-link]"))e=document.querySelector("body > div");else for(let t of document.querySelectorAll('[style*="display:none"], [style*="display: none"]'))if(we(t)&&(parseInt(t.style.opacity)==0||t.style["mso-hide"]=="all"||t.style.overflow=="hidden"||parseInt(t.style.maxHeight)==0||parseInt(t.style.width)==0)&&t.tagName!="IMG"&&t.tagName!="TABLE"&&[...t.childNodes].filter(n=>n.nodeType==Node.TEXT_NODE).length>0){e=t;break}return e&&e.querySelector("div")?e=e.querySelector("div"):e&&e.querySelector("span")&&!e.querySelector("span")?.classList.contains("em-code")&&(e=e.querySelector("span")),e??void 0}function kL(e){return!!e&&!document.querySelector("title")}function $g(){const e=document.querySelector("title")?.textContent?.replaceAll(" "," ").replaceAll("‌","").replace(/\u200C/g,"").replaceAll("<!--","").replaceAll("-->","")||"";return dx(e).replace(/\s+/g," ").trim()}function Ga(e=dd()){const t=document.createElement("div");return t.innerHTML=e?.innerHTML||"",t.querySelectorAll(".em-code").forEach(n=>n.remove()),Nt(t).trim().replaceAll(/<vk-snippet-end\/>/g,"").replaceAll(/[\u034F\u200C\u2007\uFEFF]+/g,"").replaceAll("&","&").replaceAll("͏","").replaceAll("","").replaceAll(" ","").replaceAll("‌","").replace(/\u200C/g,"").replaceAll("<!--","").replaceAll("-->","").replace(/(?: |\s)+$/,"").trim()}function Wg(e){e.nodeName=="#comment"&&e.textContent&&e.textContent.indexOf("mso")>=0?e.remove():e.previousSibling&&Wg(e.previousSibling)}function qg(e){e.nodeName=="#comment"&&e.textContent&&e.textContent.indexOf("endif")>=0?e.remove():e.nextSibling&&qg(e.nextSibling)}var fre="͏‌  ",LL="#f0f1f3",NL='<span style="display:none !important;font-size:0;height:0;line-height:0;max-height:0;max-width:0;opacity:0;overflow:hidden;visibility:hidden;width:0">⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀'+new Array(200).fill(" ‌").join("")+"</span>";function fd(e){return!!e&&we(e)&&e.tagName==="SPAN"&&e.style&&e.style.display==="none"&&e.style.fontSize==="0px"&&e.style.visibility==="hidden"}function xL(e){const t=e.nextSibling;return t&&Ss(t)&&t.data==="<![endif]"?t:null}function mre(e){const t=xL(e);t&&t.nextSibling&&fd(t.nextSibling)?t.nextSibling.remove():!t&&e.nextSibling&&fd(e.nextSibling)&&e.nextSibling.remove();const n=Ne(NL);n.length&&(t&&t.parentNode?t.parentNode.insertBefore(n[0],t.nextSibling):e.parentNode&&e.parentNode.insertBefore(n[0],e.nextSibling))}var OL=e=>{Wg(e),qg(e);const t=e.nextElementSibling;t&&we(t)&&t.style&&t.style.color==="transparent"&&(Wg(t),qg(t),t.remove());const n=we(e)?xL(e):null;for(n&&n.nextSibling&&fd(n.nextSibling)?n.nextSibling.remove():e.nextSibling&&fd(e.nextSibling)&&e.nextSibling.remove();e.previousSibling&&ao(e.previousSibling)&&e.previousSibling.data.trim()==="";)e.previousSibling.remove();for(;e.nextSibling&&ao(e.nextSibling)&&e.nextSibling.data.trim()==="";)e.nextSibling.remove();e.remove()};function hre(e){return!(e.tagName!=="DIV"||G(e.style.color)!==LL||e.style.lineHeight!=="0px"||e.style.fontSize!=="0px"||!e.previousSibling||!Ss(e.previousSibling)||e.previousSibling.data!=="[if !mso]><!"||!e.nextSibling||!Ss(e.nextSibling)||e.nextSibling.data!=="<![endif]")}function pre(e,t){let n=dd(),r="";(e.length||t)&&(e=e.endsWith(" ")?e:e+" ",e=e+"<vk-snippet-end>͏</vk-snippet-end>͏",r=e.padEnd(e.length+5460,fre));const o=Ne(r);if(n&&!hre(n)&&(OL(n),n=null),n)o.length?(n.replaceChildren(...o),mre(n)):OL(n);else if(o.length){const i=document.createElement("div");i.classList.add("preheader"),i.style.color=LL,i.style.lineHeight=i.style.fontSize="0px",i.replaceChildren(...o),document.body?.prepend(i),i.insertAdjacentHTML("afterend",NL)}}function gre(e,t){return!!t&&(Ga()||"")!==e}function bre(e,t){return!!t&&(document.querySelector("title")?.textContent??"")!==e}function yre(){return document.querySelector("title")?.textContent??void 0}async function RL(e,t,n,r){const o=n();await e.whenSent(),t()&&n()===o&&r()}function vre(e,t){let n;const r=new Ee;let o=!1,i="",s=0;const a=u=>{o=!1,n=void 0,i=u.guid,s+=1},l=u=>(o=!0,n=Ga()||"",U.sendAsync(ue.APPLICATION_PREHEADER_UPDATE,{guid:i,value:n})),c=async({guid:u,value:d,force:f,fromAI:h,echo:m,undoStep:p})=>{if(f||await t.whenEditorLostFocusAsync("preheader"),typeof d=="string"&&u===i&&(n!==d||gre(d,f))){const S=s;n=d,pre(d),await e.commit(!!h||!!p,!0),(h||m)&&await RL(e,()=>S===s,()=>Ga(),()=>U.send(ue.APPLICATION_PREHEADER_UPDATE,{guid:i,value:n,forced:!!m&&!h}))}};return r.addDisposable(U.addListenerAsync(ue.SANDBOX_PREHEADER_UPDATE,c)),r.addDisposable(U.addListenerAsync(ue.SANDBOX_INIT_START,a)),r.addDisposable(U.addListenerAsync(ue.SANDBOX_INITED,l)),r.addDisposable(e.onChange(()=>{if(o){const u=Ga()||"";u!==n&&(n=u,U.send(ue.APPLICATION_PREHEADER_UPDATE,{guid:i,value:n}))}})),r}function Ere(e,t){let n;const r=new Ee;let o="",i=!1,s=0;const a=u=>{i=!1,n=void 0,o=u.guid,s+=1},l=u=>{if(!(u?.guid&&o&&u.guid!==o))return i=!0,kL(n)||(n=$g()||""),U.sendAsync(ue.APPLICATION_SUBJECT_UPDATE,{guid:o,value:n})},c=async({guid:u,value:d,force:f,fromAI:h,echo:m,undoStep:p})=>{if(f||await t.whenEditorLostFocusAsync("subject"),typeof d=="string"&&u===o&&(n!==d||bre(d,f))){const S=s;n=d,document.title=d,await e.commit(!!h||!!p,!0),(h||m)&&await RL(e,()=>S===s,yre,()=>U.send(ue.APPLICATION_SUBJECT_UPDATE,{value:d,guid:o,forced:!!m&&!h}))}};return r.addDisposable(U.addListenerAsync(ue.SANDBOX_SUBJECT_UPDATE,c)),r.addDisposable(U.addListenerAsync(ue.SANDBOX_INIT_START,a)),r.addDisposable(U.addListenerAsync(ue.SANDBOX_INITED,l)),r.addDisposable(e.onChange(()=>{if(i){if(kL(n))return;const u=$g()||"";u!==n&&(n=u,U.send(ue.APPLICATION_SUBJECT_UPDATE,{value:u,guid:o}))}})),r}var kn=e=>!!e?.closest(uu),zg=e=>e.matches(".em-prevent-action")||!!e.querySelector(".em-prevent-action");function md(){const e=dd();return e&&!e.closest('[em="atom"]')&&!e.querySelector('[em="atom"], [em="block"]')?e:void 0}function ML(e){const t=md();return!!t&&(t.contains(e)||e.contains(t))}function Sre(e){const t=new Map,n=md();return[...Array.from(e.querySelectorAll(uu)),...n?[n]:[]].forEach(r=>{const o=e.ownerDocument.createTreeWalker(r,NodeFilter.SHOW_TEXT);for(let i=o.nextNode();i;i=o.nextNode())t.set(i,i.data)}),t}function wre(e){e.forEach((t,n)=>{n.data!==t&&(n.data=t)})}function Zi(e){return"ok"in e}var Z=(e,t)=>({ok:!1,code:e,message:t}),Jr=Z("staleElement","The element reference is stale: read element.getTree again and use a fresh reference."),_re=Z("readOnly","The document is read-only."),hd=Z("unavailable","The canvas is busy with another edit; try again."),PL=Z("unavailable","The user is editing text right now; try again in a moment."),Er=Z("readOnly","The element is locked by the integrator and cannot be changed."),Ug=Z("readOnly","A locked element of the integrator is inside, so this cannot be removed; remove what is around it instead."),jg=Z("readOnly","This is or holds the preheader of the email; change it with document.setHeaders."),Cre=80,Tre=["img","countdown","video","button","a","vindent","social","customTable","carousel","accordion","var"];function Po(e){const t=e.closest('[em="block"]');return t&&(t===e||t.querySelector("td")===e)?t:null}function Xa(e){return e.querySelector("td")??e}function Are(e){return e.getAttribute("em-type")==="social"||e.querySelector("td[em-platform], td[data-em-platform]")?"social":BT(e)||e.querySelector(".em-element-custom-table")?"customTable":"td"}function IL(e){return e.tagName==="TD"&&(e.classList.contains("em-mob-wrap")||e.classList.contains("noresp-em-mob-wrap"))}function DL(e){return IL(e)&&e.matches(":nth-child(even)")}function pd(e){return e.getAttribute("em")==="block"?"structure":e.getAttribute("em")==="atom"?Are(e):DL(e)?null:IL(e)?"column":zT(e)?"floatBlock":Bp(e)&&!(e.parentElement&&Bp(e.parentElement))?"carousel":wT(e)?"accordion":jT(e)?iX(e)?"countdown":sX(e)||e.closest(".em-video")?"video":"img":e.tagName==="A"?xa(e)?"button":"a":e.tagName==="EM-REPLACE"?"var":hA(e)||pA(e)?"vindent":fA(e)?"text":null}function kre(e,t,n=Cre){const r=[];let o=0;const i=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let a=i.nextNode();a&&o<=n;a=i.nextNode())t(a)&&a.nodeValue&&(r.push(a.nodeValue),o+=a.nodeValue.length);const s=r.join(" ").replace(/\s+/g," ").trim();return s.length>n?`${s.slice(0,n)}…`:s}function Lre(e,t){const n={};if(t==="img"){const r=e.tagName==="IMG"?e:e.querySelector("img");n.src=r?$p(Pc(r,{clone:!0}))??void 0:void 0,n.alt=r?.getAttribute("alt")??""}else if(t==="a"||t==="button")n.href=e.getAttribute("href")??"";else return;return n}function BL(e,t){let n=t.budget,r=!1,o=!1;const i=(s,a)=>{const l=[];for(const c of Array.from(s.children)){if(o)break;const u=e.isInLetter(c)?pd(c):null;if(!u){l.push(...i(c,a));continue}const d=e.issue(u==="structure"?Xa(c):c);if(!d)continue;if(n<=0){r=o=!0;break}n-=1;const f={element:d,type:u},h=kre(c,p=>e.isInLetter(p),t.textLimit);h&&(f.text=h);const m=Lre(c,u);if(m&&(f.attrs=m),!Tre.includes(u))if(a<t.depth){const p=i(c,a+1);p.length&&(f.children=p)}else c.querySelector('[em="atom"], img, a, td.em-mob-wrap')&&(r=!0);l.push(f)}return l};return{nodes:i(t.root,1),truncated:r}}var Nre=`em-replace, style, script, ${uu}`,HL=20,gd="[\\p{L}\\p{N}\\p{M}]",Vg=new RegExp(`^${gd}`,"u"),Gg=new RegExp(`${gd}$`,"u"),FL="a, abbr, b, big, cite, code, del, dfn, em, em-replace, font, i, ins, kbd, mark, nobr, q, s, samp, small, span, strike, strong, sub, sup, tt, u, var",Lie="ul, ol, table",$L=["text","button","a"],WL=`ul, ol, table, img, em-replace, ${uu}`;function Xg(e){if($L.includes(pd(e)??""))return e;const t=Array.from(e.querySelectorAll("*")).filter(n=>$L.includes(pd(n)??""));return t.length===1?t[0]:null}function qL(e){let t=e;for(;t.children.length===1&&!t.firstElementChild?.matches("em-replace")&&t.textContent?.trim()&&t.firstElementChild?.textContent?.trim()===t.textContent.trim();)t=t.firstElementChild;return t}function xre(e){let t=e;for(;t.children.length===1&&!t.textContent?.trim();)t=t.children[0];return t.tagName==="BR"?t:void 0}function zL(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r\n?/g,`
|
|
278
|
+
`).replace(/\n/g,"<br>")}function Ore(e,t,n){const r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=t?"g":"gi";if(!n)return new RegExp(r,o);const i=Vg.test(e),s=Gg.test(e);return new RegExp(`${i?`(?<!${gd})`:""}${r}${s?`(?!${gd})`:""}`,`${o}u`)}function UL(e){let t=e.parentElement;for(;t?.matches(FL);)t=t.parentElement;return t}function jL(e,t){const n=UL(e);if(!n)return"";const r=e.ownerDocument.createTreeWalker(n,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);r.currentNode=e;const o=()=>t?r.nextNode():r.previousNode();for(let i=o();i;i=o())if(i.nodeType!==Node.TEXT_NODE){if(!i.matches(FL))return""}else if(i.nodeValue)return UL(i)===n?i.nodeValue:"";return""}function Rre(e,t,n){const r=n===0&&Vg.test(t),o=n+t.length===e.length&&Gg.test(t);return r&&Gg.test(jL(e,!1))||o&&Vg.test(jL(e,!0))}function VL(e){return e.replace(/\s+/g," ").trim()}function Mre(e,t,n,r){const o=e.slice(Math.max(0,t-HL),t),i=e.slice(t+n.length,t+n.length+HL);return{before:VL(o+n+i),after:VL(o+r+i)}}function Pre(e){const t=Xg(e);return t&&pd(t)==="text"?t:Z("invalidArgs","Typograf runs on a text element or on the whole email.")}function Ire(e,{startWait:t,released:n,settle:r,writable:o,edit:i,selectChecked:s,readSelected:a,doneInTime:l,typografLoaded:c}){return{replaceText:async({find:u,replace:d,matchCase:f,wholeWord:h,root:m})=>{if(typeof u!="string"||!u||typeof d!="string")return Z("invalidArgs",'"find" must be a non-empty string and "replace" a string.');const p=t(oo),S=await o(p);if(S)return S;if(!await n(p))return hd;const C=m===void 0?e.root():e.refs.resolve(m);if(!C)return Jr;const L=h!==!1,k=Ore(u,f===!0,L);let y=0;const g=[];return e.applyOwn(()=>{const v=C.ownerDocument.createTreeWalker(C,NodeFilter.SHOW_TEXT),w=md(),b=[];for(let E=v.nextNode();E;E=v.nextNode())e.isInLetter(E)&&!E.parentElement?.closest(Nre)&&!w?.contains(E)&&b.push(E);b.forEach(E=>{const _=E.nodeValue??"",T=_.replace(k,(x,N)=>L&&Rre(E,x,N)?x:(y+=1,g.length<5&&g.push(Mre(_,N,x,d)),d));T!==_&&(E.nodeValue=T)})}),y===0?{ok:!0,value:{replaced:y}}:(await r(()=>({ok:!0})),{ok:!0,value:{replaced:y,examples:g}})},setProps:async({element:u,props:d})=>{if(!d||typeof d!="object"||Array.isArray(d))return Z("invalidArgs",'"props" must be an object of inspector settings.');const f=t(oo),h=await o(f);if(h)return h;const m=await a(u,f,S=>kn(S)?Er:S);if(Zi(m))return m;if(m.sent.type==="customTable")return Z("invalidArgs","Table cells are edited in the table editor, not by element.setProps.");const p=e.letterText();return e.applySettings(m.sent.type,{...d}),r(()=>({ok:!0,element:e.activeElement()??m.element,unchanged:!e.selectionLock.isLocked()&&e.letterText()===p}))},setText:({element:u,text:d})=>typeof d!="string"?Promise.resolve(Z("invalidArgs",'"text" must be a string.')):i(u,f=>{const h=f&&Xg(f);if(!h)return Z("invalidArgs","Text is set on a text, header, button or link element; pass its reference or the reference of its cell.");const m=qL(h);return kn(h)?Er:ML(h)?jg:m.matches(WL)||m.querySelector(WL)?Z("invalidArgs","The element holds a list, a table, a picture, a variable or a locked part that new text would erase; use text.replace."):(qb(m,zL(d)),{ok:!0,element:h})}),insertVariable:({element:u,variable:d})=>typeof d!="string"||!d.trim()?Promise.resolve(Z("invalidArgs",'"variable" must be a non-empty string.')):i(u,f=>{const h=f&&Xg(f);if(!h)return Z("invalidArgs","A variable goes into a text, header, button or link element; pass its reference or the reference of its cell.");const m=qL(h),p=xre(m),S=p?.parentElement??m;if(kn(S))return Er;if(md()?.contains(h))return jg;if(h.matches("ul, ol, table")||h.querySelector("ul, ol, table"))return Z("invalidArgs","The element holds a list or a table; a variable cannot be appended to it.");const C=h.ownerDocument.createElement("em-replace");return C.setAttribute("text",d),C.textContent=d,p?.remove(),S.append(C),{ok:!0,element:h}}),typograf:async({element:u})=>{const d=t(oo),f=await o(d);if(f)return f;if(u===void 0){if(!await n(d))return hd;const p=e.activeElement()?void 0:Array.from(e.root().querySelectorAll('[em="block"]')).find(C=>!kn(Xa(C)));if(!e.activeElement()&&!p)return{ok:!0};const S=p?s(Xa(p)):void 0;if(S&&Zi(S))return S}else{const p=await a(u,d,Pre);if(Zi(p))return p;if(!p.element.contains(e.activeElement()))return Z("unavailable","The element could not be selected; try again.")}if(!await c(d))return Z("unavailable","Typograf did not finish; try again.");const h=Sre(e.root()),m=await l(()=>e.typograf(u===void 0?"typograf_all":"typograf"));return e.applyOwn(()=>wre(h)),m?r(()=>({ok:!0})):Z("unavailable","Typograf did not finish; try again.")}}}function Kg(e){return e?.closest("amp-accordion")??null}var Dre=".em-mob-wrap, .noresp-em-mob-wrap",Bre=".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)",Hre='div[style*="inline-block"]';function Fre(e){const t=e.settings?.floatBlocks;return Array.isArray(t?.items)?t:void 0}function $re(e){const t=e.closest('[em="block"]');return t?Xa(t):void 0}function Qi(e){return Array.from(e.querySelectorAll(e.querySelector(Dre)?Bre:Hre))}function Wre(e){return Kg(e)??Z("invalidArgs","Pass an accordion reference.")}var Yg=e=>e.querySelectorAll("section").length;function GL(e){const t=Wre(e);return"ok"in t||!kn(t)?t:Er}function qre(e,t){const n=e.querySelector(":scope > header");if(!n)return;const r=n.ownerDocument.createTreeWalker(n,NodeFilter.SHOW_TEXT),o=[];for(let l=r.nextNode();l;l=r.nextNode())o.push(l);const i=l=>{let c=0;for(let u=l.parentElement;u&&u!==n;u=u.parentElement)c+=1;return c},s=o.filter(l=>l.data.trim()),a=s.reduce((l,c)=>!l||i(c)>i(l)?c:l,void 0);a&&(a.data=t,s.filter(l=>l!==a&&l.data===t).forEach(l=>l.data=""))}var zre=mx/2,XL=5e3;function Ure(e){return e.getAttribute("em")==="block"?Xa(e):e}function jre(e){const t=p=>{let S=!1;const C=[];return e.later(()=>{S=!0,C.splice(0).forEach(L=>L())},p),{expired:()=>S,onExpire:L=>S?L():void C.push(L)}},n=p=>new Promise(S=>{if(p?.expired()){S(!1);return}if(!e.selectionLock.isLocked()){S(!0);return}let C=!1;const L=y=>{C||(C=!0,k(),S(y))},k=e.selectionLock.onReleased(()=>L(!0));(p??t(zre)).onExpire(()=>L(!1))}),r=p=>{if(!p.ok)return p;const S=p.element?.isConnected?e.refs.issue(Ure(p.element)):void 0,C=p.columns?.flatMap(k=>e.refs.issue(k)??[]),L={...S?{element:S}:{},...C?{columns:C}:{},...p.sections===void 0?{}:{sections:p.sections},...p.unchanged?{unchanged:!0}:{}};return{ok:!0,value:Object.keys(L).length?L:void 0}},o=async p=>(await n(),await e.commit(),await e.whenSent(),r(p())),i=(p,S)=>new Promise(C=>{let L=!1;const k=y=>{L||(L=!0,C(y))};S(k),e.later(()=>k(!1),p)}),s=p=>new Promise(S=>{if(p.expired()){S(!1);return}p.onExpire(()=>S(!1)),e.whenEditorLostFocus().then(()=>S(!0))}),a=async p=>await s(p)?e.editLock.isTextLocked()?_re:void 0:PL,l=async(p,S)=>{const C=t(oo),L=await a(C);if(L)return L;if(!await n(C))return hd;const k=p===void 0?void 0:e.refs.resolve(p);if(p!==void 0&&!k)return Jr;const y=e.applyOwn(()=>S(k));return y.ok?o(()=>y):y},c=p=>{const S=e.select(p);return!S||!S.type?Z("invalidArgs","This element has no settings in the inspector; pick another element from element.getTree."):{element:p,sent:S}},u=async(p,S,C)=>{if(!await s(S))return PL;if(!await n(S))return hd;const L=e.refs.resolve(p);if(!L)return Jr;const k=C?C(L):L;return"ok"in k?k:c(k)},d=async(p,S,C)=>{const L=t(oo),k=await a(L);if(k)return k;const y=await u(p,L,S);if(Zi(y))return y;const g=e.applyOwn(()=>C(y));return g.ok?o(()=>g):g};return{startWait:t,released:n,settle:o,writable:a,edit:l,selectChecked:c,readSelected:u,editSelected:d,editRow:async(p,S,C)=>{let L,k,y=[];const g=await d(p,v=>(L=v,y=S.map(w=>e.refs.resolve(w)).filter(w=>w!==void 0),y.length<S.length?Jr:kn(v)||y.some(kn)?Er:$re(v)??Z("invalidArgs","Pass a row or a column reference.")),v=>{const w=e.activeElement();return!w||!v.element.contains(w)?Z("unavailable","The row could not be selected; try again."):(k=v.element,C({cell:k,origin:L,others:y,floatBlocks:Fre(v.sent)}))});return g.ok&&k?.isConnected&&e.select(k),g},doneInTime:p=>i(XL,S=>{p().then(()=>S(!0),()=>S(!1))}),typografLoaded:p=>i(XL,S=>{p.onExpire(()=>S(!1)),e.loadTypograf().then(()=>S(!p.expired()),()=>S(!1))})}}var Vre=4,Gre=8,Xre=300,Kre=2e3,Yre=500,Zre=1500,Qre=1e4,KL="agent",Jre=["usedColors","nextElem","prevElem"];function YL(e,t,n,r){return typeof e=="number"&&Number.isFinite(e)?Math.min(Math.max(Math.round(e),n),r):t}function ZL(e){return e.flatMap(({children:t,...n})=>[n,...ZL(t??[])])}function eoe(e){return Object.fromEntries(Object.entries(e).filter(([t])=>!Jre.includes(t)))}function toe(e,{settle:t,startWait:n,readSelected:r}){const o=new WeakMap;return{settle:()=>t(()=>({ok:!0})),tree:async({root:i,depth:s})=>{e.refs.sync();const a=i===void 0?e.root():e.refs.resolve(i);return a?{ok:!0,value:BL({issue:l=>e.refs.issue(l),isInLetter:l=>e.isInLetter(l)},{root:a,depth:YL(s,Vre,1,Gre),budget:Xre})}:Jr},find:async({root:i})=>{e.refs.sync();const s=i===void 0?e.root():e.refs.resolve(i);if(!s)return Jr;const a=BL({issue:l=>e.refs.issue(l),isInLetter:l=>e.isInLetter(l)},{root:s,depth:Number.MAX_SAFE_INTEGER,budget:Kre,textLimit:Yre});return{ok:!0,value:{nodes:ZL(a.nodes),truncated:a.truncated}}},get:async({element:i})=>{const s=await r(i,n(oo));if(Zi(s))return s;const{element:a,sent:l}=s;return{ok:!0,value:{element:l.elementRef??e.refs.issue(a)??i,type:l.type,caption:l.caption,settings:eoe(l.settings??{})}}},select:async({element:i})=>{const s=await r(i,n(oo));return Zi(s)?s:{ok:!0,value:{element:s.sent.elementRef??e.refs.issue(s.element)??i}}},highlight:async({element:i,durationMs:s})=>{const a=e.refs.resolve(i);if(!a)return Jr;const l=(o.get(a)??0)+1;return o.set(a,l),e.applyHidden(()=>a.setAttribute("em-hover",KL)),e.later(()=>{o.get(a)===l&&a.getAttribute("em-hover")===KL&&e.applyHidden(()=>a.removeAttribute("em-hover"))},YL(s,Zre,300,Qre)),{ok:!0}}}}function bd(e){return Po(e)?null:e.closest('[em="atom"]')}function noe(e,{edit:t,editRow:n,editSelected:r}){const o=s=>Kg(e.activeElement())===s,i=s=>{const a=Kg(e.activeElement());return a&&Yg(a)===s?{ok:!0,element:a,sections:s}:Z("unavailable","The section change did not apply; read the tree again.")};return{delete:({element:s})=>t(s,a=>{const l=a&&Po(a),c=a&&bd(a);if(kn(a))return Er;const u=l??c;if(u&&zg(u))return Ug;const d=u??a;if(d&&ML(d))return jg;if(l)e.removeBlock(l);else if(c){if(!e.removeAtom(c))return Z("unavailable","The element is being edited right now; try again.")}else return Z("invalidArgs","Only blocks and elements can be deleted; columns and cells go with their block.");return{ok:!0}}),clone:({element:s})=>t(s,a=>{const l=a&&Po(a),c=a&&bd(a),u=l??c;return u?kn(a)?Er:(l?e.cloneBlock(u):e.cloneAtom(u),{ok:!0,element:u.nextElementSibling}):Z("invalidArgs","Only blocks and elements can be cloned.")}),move:({element:s,direction:a})=>t(s,l=>{const c=l&&Po(l);return c?kn(l)?Er:e.moveBlock(c,a)?{ok:!0,element:c}:Z("cannotMove",`The block is already the ${a==="up"?"first":"last"} one.`):Z("invalidArgs",'Only blocks move; pass a block reference (kind "row").')}),insertBlock:({block:s,at:a})=>t(a?.element,l=>{const c=l&&(Po(l)??l.closest('[em="block"]'));if(a&&!c)return Z("invalidArgs",'Blocks are inserted next to a block; pass a block reference (kind "row").');const u=e.insertBlock(s,c&&a?{target:c,place:a.place}:void 0);return u?{ok:!0,element:u}:Z("invalidArgs","The block could not be inserted here.")}),insertAtom:({atom:s,at:a})=>t(a.element,l=>{if(!l)return Jr;if(kn(l))return Er;if(a.place==="inside"&&DL(l))return Z("invalidArgs","This is the gap between columns, not a column; pass a column from element.getTree.");const c=a.place==="inside"?bd(l)?null:Po(l)??l:bd(l);if(!c)return Z("invalidArgs",a.place==="inside"?"Elements are inserted inside a row or a column, not inside another element.":'Use "before" or "after" with an element reference, or "inside" with a row or a column.');const u=e.insertAtom(s,{target:c,place:a.place});return u?{ok:!0,element:u}:Z("invalidArgs","The element could not be inserted here.")}),addColumn:({element:s})=>n(s,[],({cell:a,origin:l,floatBlocks:c})=>{const u=Qi(a);if(!Po(l)&&!u.includes(l))return Z("invalidArgs","A column is added to a row; pass a row or a column reference.");if(u.length===0||!c)return Z("invalidArgs","This row has no column layout to add a column to.");if(u.length>=8)return Z("invalidArgs","A row holds at most 8 columns.");if(!c.items.some(f=>f.width>30))return Z("invalidArgs","The columns are too narrow to make room for a new one.");e.addColumn({minWidth:30,gap:c.gap??0,gapMobile:c.gapMobile??0});const d=Qi(a);return d.length===u.length+1?{ok:!0,element:a,columns:d}:Z("unavailable","The column could not be added.")}),removeColumn:({element:s})=>n(s,[],({cell:a,origin:l,floatBlocks:c})=>{const u=Qi(a),d=u.indexOf(l);if(d<0)return Z("invalidArgs","Pass a column reference; a gap between columns is not a column.");if(u.length<2)return Z("invalidArgs","A row keeps at least one column; delete the row instead.");if(typeof c?.gap!="number"||!Number.isFinite(c.gap))return Z("invalidArgs","This row has no column layout to remove a column from.");if(zg(l))return Ug;e.removeColumn({removedBlockIndex:d,gap:c.gap});const f=Qi(a);return f.length===u.length-1?{ok:!0,element:a,columns:f}:Z("unavailable","The column could not be removed.")}),swapColumns:({element:s,with:a})=>n(s,[a],({cell:l,origin:c,others:[u]})=>{const d=Qi(l),[f,h]=[d.indexOf(c),d.indexOf(u)];if(f<0||h<0||f===h)return Z("invalidArgs","Pass two different columns of the same row.");e.swapColumns({indexA:f,indexB:h});const m=Qi(l);return m[f]===d[h]?{ok:!0,element:l,columns:m}:Z("unavailable","The columns could not be swapped.")}),addAccordionSection:({element:s,title:a,text:l})=>typeof a!="string"||typeof l!="string"?Promise.resolve(Z("invalidArgs",'"title" and "text" must be strings.')):r(s,GL,c=>{const u=Yg(c.element);if(!o(c.element))return Z("unavailable","The accordion could not be selected; try again.");if(u===0)return Z("invalidArgs","The accordion has no section to copy.");e.addSection({section:a,text:zL(l)});const d=i(u+1),f=d.ok?d.element?.querySelector(":scope > section:last-of-type"):void 0;return f&&qre(f,a),d}),removeAccordionSection:({element:s,index:a})=>r(s,GL,l=>{const c=Yg(l.element);return!Number.isInteger(a)||a<0||a>=c?Z("invalidArgs",`"index" must be a section number from 0 to ${c-1}.`):c<2?Z("invalidArgs","An accordion keeps at least one section; delete the accordion instead."):zg(l.element.querySelectorAll("section")[a])?Ug:o(l.element)?(e.removeSection({index:a}),i(c-1)):Z("unavailable","The accordion could not be selected; try again.")})}}function roe(e){const t=jre(e),n={...toe(e,t),...Ire(e,t),...noe(e,t)};return r=>{const o=n[r?.op];return o?o(r):Promise.resolve(Z("invalidArgs",`Unknown element operation "${String(r?.op)}".`))}}var ooe={name:"sandbox.agentElements",awaits:{services:[Fo,Y,it,_e,xe,Ye,st,De,Uo,vt,Ar]},setup(e){const t=M(e,Y),n=M(e,it),r=M(e,_e),o=M(e,st),i=M(e,De),s=M(e,Uo),a=M(e,vt),l=M(e,Ar),c=()=>{r.commit()},u=()=>({commit:c,setCursorPosition:a,scrollTop:V.get("scrollTop")}),d=M(e,xe),f={selectionLock:d,commit:c,setPercentsForColumns:p=>ec(p),applicationElementSettingsSet:i},h={selectionLock:d,commit:p=>{r.commit(p)},getActiveEditElement:Ds,HTMLDocument:{getOuterHtml:It}},m=roe({refs:M(e,Fo),isInLetter:p=>t.isInLetter(p),applyOwn:p=>t.applyOwn(p),applyHidden:p=>t.applyHidden(p),commit:()=>r.commit(!0),whenSent:()=>t.whenSent(),selectionLock:d,editLock:M(e,Ye),whenEditorLostFocus:async()=>{await o.controller.whenEditorLostFocusAsync("agent"),await dre(document)},root:()=>document.body,select:p=>{o.setEditorFocus(!1),window.getSelection()?.removeAllRanges();const S=i({elem:p});return a(p),S},applySettings:(p,S)=>s({data:{operation:ue.SANDBOX_ELEMENT_SETTINGS_SET,type:p,settings:S}}),letterText:()=>n.getText(),activeElement:()=>Ds(),removeAtom:p=>pk(p,{getElementParent:S=>$i(S),setCursorPosition:a,getVariableByIcon:pa,commit:c}),removeBlock:p=>Ck(p,u()),cloneAtom:p=>vk(p,u()),cloneBlock:p=>Ek(p,u()),moveBlock:(p,S)=>S==="up"?Sk(p,u()):wk(p,u()),insertBlock:(p,S)=>Zne(p,l.insertContext(),S),insertAtom:(p,S)=>Qne(p,l.insertContext(),S),addColumn:p=>dL(p,f),removeColumn:p=>fL(p,f),swapColumns:p=>pL(p,f),addSection:p=>Kk(p,h),removeSection:p=>Yk(p,h),loadTypograf:sL,typograf:p=>new Promise(S=>eL({action:p},{commit:()=>{c(),S()},setCursorPosition:a,getElementParent:C=>$i(C),messageService:U,HTMLDocument:{getOuterHtml:It},hasRussianText:tS})),later:(p,S)=>{setTimeout(p,S)}});U.addListenerAsync(ue.SANDBOX_ELEMENT_OPERATION,m)}},ioe={name:"sandbox.prepareHtml",provides:[ml],setup:e=>e.inject(ml,t=>Dc({node:t,isPartial:!0}))},soe={name:"sandbox.blockControlsViewport",setup:e=>e.addService(ny,()=>bu({scrollTop:V.get("scrollTop")}))},aoe=[ioe,soe,Bte,Hte,Fte,$te,Wte,...ure,qte,zte,Ute,jte,Vte,Gte,Xte,Kte,ooe],loe="__emmDiagnostics__",coe="diagnostics";function uoe(){try{const e=new URLSearchParams(window.location.search).get(coe);return e!==null&&e!=="0"}catch{return!1}}function Zg(e){try{window.parent.postMessage({mark:loe,...e},"*")}catch{}}function doe(){const e=window.performance.getEntriesByType("resource").map(t=>{const n=t;return{name:n.name,initiatorType:n.initiatorType,startTime:n.startTime,responseEnd:n.responseEnd,transferSize:n.transferSize,decodedBodySize:n.decodedBodySize}});Zg({type:"resources",timeOrigin:window.performance.timeOrigin,items:e})}function Ji(){return window.performance.timeOrigin+window.performance.now()}function foe(){return Array.from(document.images).every(e=>e.complete)}function moe(e,t){const r=window.setInterval(()=>{!foe()||Ji()-e()<500||(window.clearInterval(r),Zg({type:"settled",at:Math.max(e(),t)}),doe())},100)}function hoe(){if(!uoe()||typeof MutationObserver!="function")return;let e=!1,t=Ji();new MutationObserver(()=>{t=Ji(),!e&&(e=!0,window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const n=Ji();Zg({type:"paint",at:n}),moe(()=>t,n)})}))}).observe(document.documentElement,{childList:!0,subtree:!0,characterData:!0}),window.addEventListener("load",()=>{t=Ji()}),document.addEventListener("load",()=>{t=Ji()},!0)}var poe=500,goe=300,Ka,yd=!1;function QL(){if(yd)return;yd=!0;let e=!1;const t=window.setTimeout(()=>{e||(e=!0,Ka=!1,yd=!1)},goe);window.requestAnimationFrame(()=>{e||(e=!0,window.clearTimeout(t),Ka=!0,yd=!1)})}function boe(){return Ka===!1?(QL(),Promise.resolve()):new Promise(e=>{let t=!1;const n=()=>{t||(t=!0,e())},r=window.setTimeout(()=>{Ka=!1,n()},poe);window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{window.clearTimeout(r),Ka=!0,n()})})})}var yoe=1;function voe(){QL();const e=async(t,n)=>{await n?.(t),await boe()};U.addListenerAsync(ue.SANDBOX_INITED,e,yoe)}var Eoe=16,JL=100,Soe=.95,eN=.02;function tN(e,t){return t===WheelEvent.DOM_DELTA_LINE?e*Eoe:t===WheelEvent.DOM_DELTA_PAGE?e*window.innerHeight:e}function nN(e,t,n){if(n===0)return!1;const r=getComputedStyle(e),o=t==="y"?r.overflowY:r.overflowX;if(o!=="auto"&&o!=="scroll"&&o!=="overlay")return!1;const i=t==="y"?e.scrollTop:Math.abs(e.scrollLeft),s=t==="y"?e.scrollHeight-e.clientHeight:e.scrollWidth-e.clientWidth;return s<=0?!1:(t==="x"&&e.scrollLeft<0?-n:n)>0?i<s-.5:i>.5}function rN(e,t,n){const r=document.scrollingElement??document.documentElement;for(let o=e instanceof Element?e:null;o;o=o.parentElement){if(o===r||o===document.body)return!1;if(nN(o,"y",n)||nN(o,"x",t))return!0}return!1}function woe(){let e=0,t=0,n=!1;const r=()=>{n=!1;const d=e,f=t;e=0,t=0,!(d===0&&f===0)&&U.send(ue.SANDBOX_WHEEL,{deltaX:d,deltaY:f})},o=(d,f)=>{e+=d,t+=f,n||(n=!0,window.requestAnimationFrame(r))};window.addEventListener("wheel",d=>{d.ctrlKey||rN(d.target,d.deltaX,d.deltaY)||(d.preventDefault(),o(tN(d.deltaX,d.deltaMode),tN(d.deltaY,d.deltaMode)))},{passive:!1});let i,s=!1,a={x:0,y:0},l;const c=()=>{l!==void 0&&(window.cancelAnimationFrame(l),l=void 0)},u=()=>{let{x:d,y:f}=a,h=performance.now();const m=p=>{const S=p>h?Math.min(p-h,50):16;h=p;const C=Math.pow(Soe,S/16);if(d*=C,f*=C,Math.abs(d)<eN&&Math.abs(f)<eN){l=void 0;return}o(d*S,f*S),l=window.requestAnimationFrame(m)};l=window.requestAnimationFrame(m)};window.addEventListener("touchstart",d=>{c(),s=!1,a={x:0,y:0};const f=d.touches.length===1?d.touches[0]:void 0;i=f?{x:f.screenX,y:f.screenY,at:d.timeStamp}:void 0},{passive:!0}),window.addEventListener("touchmove",d=>{const f=d.touches.length===1?d.touches[0]:void 0;if(document.documentElement.classList.contains("em-resize-start")){i=void 0,s=!1;return}if(!f||!i){i=void 0,s=!1;return}const h=i.x-f.screenX,m=i.y-f.screenY,p=d.timeStamp-i.at;if(i={x:f.screenX,y:f.screenY,at:d.timeStamp},!rN(d.target,h,m)){if(d.cancelable&&d.preventDefault(),s=!0,p>0){const S=Math.min(p/JL,1);a={x:a.x*(1-S)+h/p*S,y:a.y*(1-S)+m/p*S}}o(h,m)}},{passive:!1}),window.addEventListener("touchend",d=>{const f=i?d.timeStamp-i.at:1/0;s&&d.touches.length===0&&f<JL&&u(),i=void 0,s=!1},{passive:!0}),window.addEventListener("touchcancel",()=>{i=void 0,s=!1})}var _oe={name:"sandbox.diagnosticsAgent",setup:()=>hoe()},Coe={name:"sandbox.paintGate",setup:()=>voe()},Toe={name:"sandbox.wheelBridge",setup:()=>woe()},Aoe={name:"sandbox.deviceWidthMediaGuard",setup:()=>hF()};function koe(){return Math.ceil(document.documentElement.getBoundingClientRect().height)}function Loe(){return Math.max(document.body?.scrollWidth??0,document.documentElement?.scrollWidth??0)}window.iFrameResizer={heightCalculationMethod:koe,widthCalculationMethod:Loe};var Noe=_r(((e,t)=>{(function(n){if(typeof window<"u"){var r=!0,o=10,i="",s=0,a="",l=null,c="",u=!1,d={resize:1,click:1},f=128,h=!0,m=1,p="bodyOffset",S=p,C=!0,L="",k={},y=32,g=null,v=!1,w=!1,b="[iFrameSizer]",E=b.length,_="",T={max:1,min:1,bodyScroll:1,documentElementScroll:1},x="child",N=!0,D=window.parent,R="*",O=0,q=!1,ee=null,de=16,re=1,Q="scroll",ve=Q,fe=window,Te=function(){fn("onMessage function not defined")},ut=function(){},te=function(){},z={height:function(){return fn("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return fn("Custom width calculation function not defined"),document.body.scrollWidth}},oe={},qt=!1;try{var j=Object.create({},{passive:{get:function(){qt=!0}}});window.addEventListener("test",vd,j),window.removeEventListener("test",vd,j)}catch{}var un,Ct,dn,Qt,Ln,Jt,dt={bodyOffset:function(){return document.body.offsetHeight+xn("marginTop")+xn("marginBottom")},offset:function(){return dt.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return z.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,Mt(dt))},min:function(){return Math.min.apply(null,Mt(dt))},grow:function(){return dt.max()},lowestElement:function(){return Math.max(dt.bodyOffset()||dt.documentElementOffset(),Se("bottom",gt()))},taggedElement:function(){return Jn("bottom","data-iframe-height")}},Rt={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return z.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(Rt.bodyScroll(),Rt.documentElementScroll())},max:function(){return Math.max.apply(null,Mt(Rt))},min:function(){return Math.min.apply(null,Mt(Rt))},rightMostElement:function(){return Se("right",gt())},taggedElement:function(){return Jn("right","data-iframe-width")}},Tt=(un=On,Ln=null,Jt=0,function(){var P=Date.now(),$=de-(P-(Jt=Jt||P));return Ct=this,dn=arguments,$<=0||de<$?(Ln&&(clearTimeout(Ln),Ln=null),Jt=P,Qt=un.apply(Ct,dn),Ln||(Ct=dn=null)):Ln=Ln||setTimeout(zt,$),Qt});Qn(window,"message",function(P){var $={init:function(){L=P.data,D=P.source,Ed(),h=!1,setTimeout(function(){C=!1},f)},reset:function(){C?ce("Page reset ignored by init"):(ce("Page size reset by host page"),to("resetPage"))},resize:function(){Sr("resizeParent","Parent window requested size check")},moveToAnchor:function(){k.findTarget(Ae())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var Me=Ae();ce("PageInfoFromParent called from parent: "+Me),te(JSON.parse(Me)),ce(" --")},message:function(){var Me=Ae();ce("onMessage called from parent: "+Me),Te(JSON.parse(Me)),ce(" --")}};function he(){return P.data.split("]")[1].split(":")[0]}function Ae(){return P.data.substr(P.data.indexOf(":")+1)}function X(){return P.data.split(":")[2]in{true:1,false:1}}function J(){var Me=he();Me in $?$[Me]():(typeof t>"u"||!t.exports)&&"iFrameResize"in window||"jQuery"in window&&"iFrameResize"in window.jQuery.prototype||X()||fn("Unexpected message ("+P.data+")")}b===(""+P.data).substr(0,E)&&(h===!1?J():X()?$.init():ce('Ignored message of type "'+he()+'". Received before initialization.'))}),Qn(window,"readystatechange",iN),iN()}function vd(){}function Qn(P,$,he,Ae){P.addEventListener($,he,!!qt&&(Ae||{}))}function Ya(P){return P.charAt(0).toUpperCase()+P.slice(1)}function Io(P){return b+"["+_+"] "+P}function ce(P){v&&window.console}function fn(P){window.console}function Ed(){function P(X){return X==="true"}var $;function he(X){mn(0,0,X.type,X.screenY+":"+X.screenX)}function Ae(X,J){ce("Add event listener: "+J),Qn(window.document,X,he)}$=L.substr(E).split(":"),_=$[0],s=n!==$[1]?Number($[1]):s,u=n!==$[2]?P($[2]):u,v=n!==$[3]?P($[3]):v,y=n!==$[4]?Number($[4]):y,r=n!==$[6]?P($[6]):r,a=$[7],S=n!==$[8]?$[8]:S,i=$[9],c=$[10],O=n!==$[11]?Number($[11]):O,k.enable=n!==$[12]&&P($[12]),x=n!==$[13]?$[13]:x,ve=n!==$[14]?$[14]:ve,w=n!==$[15]?!!$[15]:w,ce("Initialising iFrame ("+window.location.href+")"),(function(){function X(J,Me){return typeof J=="function"&&(ce("Setup custom "+Me+"CalcMethod"),z[Me]=J,J="custom"),J}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&((function(){var J=window.iFrameResizer;ce("Reading data from page: "+JSON.stringify(J)),Object.keys(J).forEach(Za,J),Te="onMessage"in J?J.onMessage:Te,ut="onReady"in J?J.onReady:ut,R="targetOrigin"in J?J.targetOrigin:R,S="heightCalculationMethod"in J?J.heightCalculationMethod:S,ve="widthCalculationMethod"in J?J.widthCalculationMethod:ve})(),S=X(S,"height"),ve=X(ve,"width")),ce("TargetOrigin for parent set to: "+R)})(),(function(){n===a&&(a=s+"px"),es("margin",(function(X,J){return J.indexOf("-")!==-1&&(fn("Negative CSS value ignored for "+X),J=""),J})("margin",a))})(),es("background",i),es("padding",c),($=document.createElement("div")).style.clear="both",$.classList.add("iframe-resizer-inner"),$.style.display="block",$.style.height="0",document.body.appendChild($),Qa(),W(),document.documentElement.style.height="",document.body.style.height="",ce('HTML & body height set to "auto"'),ce("Enable public methods"),fe.parentIFrame={autoResize:function(X){return X===!0&&r===!1?(r=!0,ot()):X===!1&&r===!0&&(r=!1,eo("remove"),l!==null&&l.disconnect(),clearInterval(g)),mn(0,0,"autoResize",JSON.stringify(r)),r},close:function(){mn(0,0,"close")},getId:function(){return _},getPageInfo:function(X){typeof X=="function"?(te=X,mn(0,0,"pageInfo")):(te=function(){},mn(0,0,"pageInfoStop"))},moveToAnchor:function(X){k.findTarget(X)},reset:function(){Rn("parentIFrame.reset")},scrollTo:function(X,J){mn(J,X,"scrollTo")},scrollToOffset:function(X,J){mn(J,X,"scrollToOffset")},sendMessage:function(X,J){mn(0,0,"message",JSON.stringify(X),J)},setHeightCalculationMethod:function(X){S=X,Qa()},setWidthCalculationMethod:function(X){ve=X,W()},setTargetOrigin:function(X){ce("Set targetOrigin: "+X),R=X},size:function(X,J){Sr("size","parentIFrame.size("+((X||"")+(J?","+J:""))+")",X,J)}},w===!0&&(Ae("mouseenter","Mouse Enter"),Ae("mouseleave","Mouse Leave")),ot(),k=(function(){function X(jt){var me=jt.getBoundingClientRect(),jt={x:window.pageXOffset!==n?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==n?window.pageYOffset:document.documentElement.scrollTop};return{x:parseInt(me.left,10)+parseInt(jt.x,10),y:parseInt(me.top,10)+parseInt(jt.y,10)}}function J(tn){var me,jt=tn.split("#")[1]||tn,tn=decodeURIComponent(jt),sN=document.getElementById(tn)||document.getElementsByName(tn)[0];n!==sN?(me=X(me=sN),ce("Moving to in page link (#"+jt+") at x: "+me.x+" y: "+me.y),mn(me.y,me.x,"scrollToOffset")):(ce("In page link (#"+jt+") not found in iFrame, so sending to parent"),mn(0,0,"inPageLink","#"+jt))}function Me(){var en=window.location.hash,me=window.location.href;en!==""&&en!=="#"&&J(me)}function Ut(){Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),function(en){en.getAttribute("href")!=="#"&&Qn(en,"click",function(me){me.preventDefault(),J(this.getAttribute("href"))})})}function Ja(){Array.prototype.forEach&&document.querySelectorAll?(ce("Setting up location.hash handlers"),Ut(),Qn(window,"hashchange",Me),setTimeout(Me,f)):fn("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return k.enable?Ja():ce("In page linking not enabled"),{findTarget:J}})(),Sr("init","Init message from host page"),ut()}function Za(P){var $=P.split("Callback");$.length===2&&(this[$="on"+$[0].charAt(0).toUpperCase()+$[0].slice(1)]=this[P],delete this[P],fn("Deprecated: '"+P+"' has been renamed '"+$+"'. The old method will be removed in the next major version."))}function es(P,$){n!==$&&$!==""&&$!=="null"&&ce("Body "+P+' set to "'+(document.body.style[P]=$)+'"')}function rt(P){var $={add:function(he){function Ae(){Sr(P.eventName,P.eventType)}oe[he]=Ae,Qn(window,he,Ae,{passive:!0})},remove:function(he){var Ae,X=oe[he];delete oe[he],Ae=window,he=he,X=X,Ae.removeEventListener(he,X,!1)}};P.eventNames&&Array.prototype.map?(P.eventName=P.eventNames[0],P.eventNames.map($[P.method])):$[P.method](P.eventName),ce(Ya(P.method)+" event listener: "+P.eventType)}function eo(P){rt({method:P,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),rt({method:P,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),rt({method:P,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),rt({method:P,eventType:"Input",eventName:"input"}),rt({method:P,eventType:"Mouse Up",eventName:"mouseup"}),rt({method:P,eventType:"Mouse Down",eventName:"mousedown"}),rt({method:P,eventType:"Orientation Change",eventName:"orientationchange"}),rt({method:P,eventType:"Print",eventNames:["afterprint","beforeprint"]}),rt({method:P,eventType:"Ready State Change",eventName:"readystatechange"}),rt({method:P,eventType:"Touch Start",eventName:"touchstart"}),rt({method:P,eventType:"Touch End",eventName:"touchend"}),rt({method:P,eventType:"Touch Cancel",eventName:"touchcancel"}),rt({method:P,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),rt({method:P,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),rt({method:P,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),x==="child"&&rt({method:P,eventType:"IFrame Resized",eventName:"resize"})}function Sd(P,$,he,Ae){return $!==P&&(P in he||(fn(P+" is not a valid option for "+Ae+"CalculationMethod."),P=$),ce(Ae+' calculation method set to "'+P+'"')),P}function Qa(){S=Sd(S,p,dt,"height")}function W(){ve=Sd(ve,Q,Rt,"width")}function ot(){var P;r===!0?(eo("add"),P=y<0,window.MutationObserver||window.WebKitMutationObserver?P?Nn():l=(function(){function $(me){function jt(tn){tn.complete===!1&&(ce("Attach listeners to "+tn.src),tn.addEventListener("load",X,!1),tn.addEventListener("error",J,!1),Ut.push(tn))}me.type==="attributes"&&me.attributeName==="src"?jt(me.target):me.type==="childList"&&Array.prototype.forEach.call(me.target.querySelectorAll("img"),jt)}function he(me){ce("Remove listeners from "+me.src),me.removeEventListener("load",X,!1),me.removeEventListener("error",J,!1),me=me,Ut.splice(Ut.indexOf(me),1)}function Ae(me,jt,tn){he(me.target),Sr(jt,tn+": "+me.target.src)}function X(me){Ae(me,"imageLoad","Image loaded")}function J(me){Ae(me,"imageLoadFailed","Image load failed")}function Me(me){Sr("mutationObserver","mutationObserver: "+me[0].target+" "+me[0].type),me.forEach($)}var Ut=[],Ja=window.MutationObserver||window.WebKitMutationObserver,en=(function(){var me=document.querySelector("body");return en=new Ja(Me),ce("Create body MutationObserver"),en.observe(me,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}),en})();return{disconnect:function(){"disconnect"in en&&(ce("Disconnect body MutationObserver"),en.disconnect(),Ut.forEach(he))}}})():(ce("MutationObserver not supported in this browser!"),Nn())):ce("Auto Resize disabled")}function Nn(){y!==0&&(ce("setInterval: "+y+"ms"),g=setInterval(function(){Sr("interval","setInterval: "+y)},Math.abs(y)))}function xn(P,$){var he=0;return $=$||document.body,he=(he=document.defaultView.getComputedStyle($,null))!==null?he[P]:0,parseInt(he,o)}function Se(P,$){for(var he,Ae=$.length,X=0,J=Ya(P),Me=Date.now(),Ut=0;Ut<Ae;Ut++)X<(he=$[Ut].getBoundingClientRect()[P]+xn("margin"+J,$[Ut]))&&(X=he);return Me=Date.now()-Me,ce("Parsed "+Ae+" HTML elements"),ce("Element position calculated in "+Me+"ms"),de/2<(Me=Me)&&ce("Event throttle increased to "+(de=2*Me)+"ms"),X}function Mt(P){return[P.bodyOffset(),P.bodyScroll(),P.documentElementOffset(),P.documentElementScroll()]}function Jn(P,$){var he=document.querySelectorAll("["+$+"]");return he.length===0&&(fn("No tagged elements ("+$+") found on page"),document.querySelectorAll("body *")),Se(P,he)}function gt(){return document.querySelectorAll("body *")}function On(P,$,he,Ae){function X(){P in{init:1,interval:1,size:1}||!(S in T||u&&ve in T)?P in{interval:1}||ce("No change in size detected"):Rn($)}var J,Me;function Ut(Ja,en){return!(Math.abs(Ja-en)<=O)}J=n!==he?he:dt[S](),Me=n!==Ae?Ae:Rt[ve](),Ut(m,J)||u&&Ut(re,Me)||P==="init"?(wd(),mn(m=J,re=Me,P)):X()}function zt(){Jt=Date.now(),Ln=null,Qt=un.apply(Ct,dn),Ln||(Ct=dn=null)}function Sr(P,$,he,Ae){q&&P in d?ce("Trigger event cancelled: "+P):(P in{reset:1,resetPage:1,init:1}||ce("Trigger event: "+$),(P==="init"?On:Tt)(P,$,he,Ae))}function wd(){q||(q=!0,ce("Trigger event lock on")),clearTimeout(ee),ee=setTimeout(function(){q=!1,ce("Trigger event lock off"),ce("--")},f)}function to(P){m=dt[S](),re=Rt[ve](),mn(m,re,P)}function Rn(P){var $=S;S=p,ce("Reset trigger event: "+P),wd(),to("reset"),S=$}function mn(P,$,he,Ae,X){var J;N===!0&&(n===X?X=R:ce("Message targetOrigin: "+X),ce("Sending message to host page ("+(J=_+":"+(P+":"+$)+":"+he+(n!==Ae?":"+Ae:""))+")"),D.postMessage(b+J,X))}function iN(){document.readyState!=="loading"&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}})()})),xoe=[{name:"Stripo (es-header/content/footer)",detect:()=>!!(document.querySelector(".es-header")||document.querySelector(".es-content")||document.querySelector(".es-footer")),apply:()=>{document.querySelectorAll(".es-header, .es-content, .es-footer").forEach(e=>{e.setAttribute("em","group")}),document.querySelectorAll(".es-header-body > tr").forEach(e=>{e.setAttribute("em","block")}),document.querySelectorAll(".es-content-body > tr").forEach(e=>{e.setAttribute("em","block")}),document.querySelectorAll(".es-footer-body > tr").forEach(e=>{e.setAttribute("em","block")})}},{name:"Stripo (es-wrapper)",detect:()=>!!document.querySelector(".es-wrapper"),apply:()=>{document.querySelectorAll(".es-wrapper > tr > td > table > tr").forEach(e=>{e.setAttribute("em","group")}),document.querySelectorAll(".es-wrapper > tr > td > table > tr > td > table > tr").forEach(e=>{e.setAttribute("em","block")})}},{name:"Sandsay",detect:()=>!!(document.querySelector("[data-template-wrapper]")&&document.querySelector("[data-template-content]")),apply:()=>{document.querySelectorAll("[data-template-wrapper] > table[data-block-id]").forEach(e=>{e.setAttribute("em","block")})}},{name:"Beefree",detect:()=>!!(document.querySelector(".nl-container")&&document.querySelector(".row")),apply:()=>{document.querySelectorAll('.row[em="block"]').forEach(e=>{e.removeAttribute("em")}),document.querySelectorAll(".row").forEach(e=>{e.setAttribute("em","group")}),document.querySelectorAll(".row-content").forEach(e=>{e.setAttribute("em","block")})}},{name:"Chamaileon",detect:()=>!!document.querySelector(".main-container"),apply:()=>{document.querySelectorAll(".main-container > tr > td > table").forEach(e=>{e.setAttribute("em","block")})}},{name:"Chamaileon (email-container)",detect:()=>!!document.querySelector(".email-container"),apply:()=>{document.querySelectorAll(".email-container > tr > td > table > tr > td > table > tr").forEach(e=>{e.setAttribute("em","block")})}},{name:"Mindbox",detect:()=>!!(document.querySelector(".nl-container")&&!document.querySelector(".row")),apply:()=>{document.querySelectorAll(".nl-container > tr > td > div").forEach(e=>{e.setAttribute("em","block")})}},{name:"Unlayer",detect:()=>!!(document.querySelector(".clean-body.u_body")&&!document.querySelector(".row")),apply:()=>{document.querySelectorAll(".u-row-container").forEach(e=>{e.setAttribute("em","block")})}},{name:"Postcards",detect:()=>!!(document.querySelector(".pc-email-body")&&!document.querySelector(".row")),apply:()=>{document.querySelectorAll('.pc-email-container > tr > td > table[role="presentation"]').forEach(e=>{e.setAttribute("em","block")})}},{name:"Topol",detect:()=>!!(document.querySelector(".hide_section_on_mobile")||document.querySelector(".mj-column-per-100")||document.querySelector(".outlook-group-fix")),apply:()=>{document.querySelectorAll("body > div > div").forEach(e=>{e.setAttribute("em","block")})}},{name:"Sender",detect:()=>!!document.querySelector(".e-c.sect"),apply:()=>{document.querySelectorAll(".e-c.sect").forEach(e=>{e.setAttribute("em","block")})}},{name:"Letteros",detect:()=>!!(!document.querySelector("[mailfit-module]")&&(document.querySelector('[class*="letteros"]')||document.querySelector("[letteros-link]"))),apply:()=>{document.querySelectorAll("body > div > table > tr").forEach(e=>{e.setAttribute("em","group")}),document.querySelectorAll("body > div > table > tr > td > table > tr").forEach(e=>{e.setAttribute("em","block")}),document.querySelectorAll('[style*="overflow"]').forEach(e=>{e.style.removeProperty("overflow")})}},{name:"Letteros (letteros-element)",detect:()=>!!document.querySelector("[letteros-element]"),apply:()=>{document.querySelectorAll("[letteros-body]").forEach(e=>{e.setAttribute("em","group")}),document.querySelectorAll("[letteros-element]").forEach(e=>{e.setAttribute("em","block")})}},{name:"Ascona",detect:()=>!!(document.querySelector(".mail_preheader")&&document.body.classList.contains("body")),apply:()=>{document.querySelectorAll("#mailsub > table > tr").forEach(e=>{e.setAttribute("em","group"),e.querySelectorAll(":scope > td > div > table > tr").forEach(t=>{t.setAttribute("em","block")})})}},{name:"Mailfit",detect:()=>!!document.querySelector("[mailfit-module]"),apply:()=>{document.querySelectorAll("body > div > table > tr").forEach(e=>{e.setAttribute("em","group")}),document.querySelectorAll("[mailfit-module]").forEach(e=>{e.setAttribute("em","block")})}},{name:"CashCowAgency",detect:()=>!!document.querySelector(".container-div"),apply:()=>{document.querySelectorAll("body > center").forEach(e=>{e.setAttribute("em","group")}),document.querySelectorAll(".container-td > table").forEach(e=>{e.setAttribute("em","block")})}},{name:"MakeMail",detect:()=>!!(document.querySelector(".mail")&&document.querySelector(".container")),apply:()=>{document.querySelectorAll(".container").forEach(e=>{e.setAttribute("em","block")})}},{name:"data-axle.com",detect:()=>!!document.querySelector(".full-width-container-inner"),apply:()=>{document.querySelectorAll(".full-width-container-inner > table").forEach(e=>{e.setAttribute("em","block")})}},{name:"Miro",detect:()=>!!document.querySelector(".content__tablet_fullWidth"),apply:()=>{document.querySelectorAll(".content__tablet_fullWidth").forEach(e=>{for(const t of Array.from(e.children))if(t.children.length>1)for(const n of Array.from(t.children))n.setAttribute("em","block");else for(const n of Array.from(t.children))for(const r of Array.from(n.children))for(const o of Array.from(r.children))o.setAttribute("em","block")})}},{name:"WIM (full-wrap)",detect:()=>!!(document.body.classList.contains("body")&&document.querySelector("[alink]")&&document.querySelector(".full-wrap")),apply:()=>{document.querySelectorAll(".full-wrap > tr > td > div > table > tr").forEach(e=>{e.setAttribute("em","group"),e.querySelectorAll(":scope > td > div > table > tr, :scope > td > table > tr").forEach(t=>{t.setAttribute("em","block")})})}},{name:"WIM",detect:()=>!!(document.body.classList.contains("body")&&document.querySelector("[alink]")&&!document.querySelector(".full-wrap")),apply:()=>{document.querySelectorAll('body > table > tr > td > table > tr, body > div[style*="-webkit-text-size-adjust"] > table > tr > td > table > tr, body > table > tbody > tr > td > table > tbody > tr, body > div[style*="-webkit-text-size-adjust"] > table > tbody > tr > td > table > tbody > tr').forEach(e=>{e.setAttribute("em","group"),e.querySelectorAll(":scope > td > table > tr > td > table > tr").forEach(t=>{t.setAttribute("em","block")})})}},{name:"Emailify",detect:()=>document.body.classList.contains("emailify"),apply:()=>{document.querySelectorAll("body > div > div > table > tr").forEach(e=>{e.setAttribute("em","block")})}}];function Ooe(){document.querySelectorAll('body > table > tr, body > div[style*="-webkit-text-size-adjust"] > table > tr').forEach(e=>{e.setAttribute("em","group")}),document.querySelectorAll('body > table > tr > td > table > tr, body > div[style*="-webkit-text-size-adjust"] > table > tr > td > table > tr, body > table > tbody > tr > td > table > tbody > tr, body > div[style*="-webkit-text-size-adjust"] > table > tbody > tr > td > table > tbody > tr').forEach(e=>{e.setAttribute("em","block")})}function Roe(e){const t=document.querySelector("[em=blocks]");if(t){for(const n of Array.from(t.children))n.setAttribute("em","block");t.removeAttribute("em"),uo();return}if(e){let n=!1;for(const r of xoe)if(r.detect()){r.apply(),n=!0;break}n||Ooe()}oN(),document.querySelector(".em-narrow-table, .noresp-em-narrow-table")||U.send({operation:"application_template_not_em_alert_show"}),uo()}function oN(){const e=document.querySelector("[em=atoms]");if(e){for(const t of Array.from(e.children))t.setAttribute("em","atom");e.removeAttribute("em")}document.documentElement?.style.height&&document.documentElement.style.removeProperty("height"),document.body?.style.height&&document.body.style.removeProperty("height")}Object.defineProperty(F,"CANVAS_CORE_UNITS",{enumerable:!0,get:function(){return hj}}),Object.defineProperty(F,"EDIT_LOCK_ID",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(F,"EMAIL_LAYOUT_UNITS",{enumerable:!0,get:function(){return aoe}}),Object.defineProperty(F,"EVENT_TYPES",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(F,"FOCUS_ID",{enumerable:!0,get:function(){return st}}),Object.defineProperty(F,"HTML_DOCUMENT_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(F,"INIT_PREVIEW_ID",{enumerable:!0,get:function(){return ms}}),Object.defineProperty(F,"INSERT_POLICY_ID",{enumerable:!0,get:function(){return Xd}}),Object.defineProperty(F,"NARROW_TABLE_TEXT_ATOM_ID",{enumerable:!0,get:function(){return ey}}),Object.defineProperty(F,"Node",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(F,"NodeType",{enumerable:!0,get:function(){return I}}),Object.defineProperty(F,"SELECTION_LOCK_ID",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(F,"SET_CURSOR_ID",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(F,"STYLE_ROOT_ID",{enumerable:!0,get:function(){return Qb}}),Object.defineProperty(F,"SYNC_COMMIT_ID",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(F,"VML_WIDTH_RESOLVER_ID",{enumerable:!0,get:function(){return Jb}}),Object.defineProperty(F,"WRAP_EDITOR_ID",{enumerable:!0,get:function(){return bn}}),Object.defineProperty(F,"_defineProperty",{enumerable:!0,get:function(){return A}}),Object.defineProperty(F,"addFontFamilyClass",{enumerable:!0,get:function(){return wa}}),Object.defineProperty(F,"ampUnit",{enumerable:!0,get:function(){return ZP}}),Object.defineProperty(F,"applyProjectFontInlineFallback",{enumerable:!0,get:function(){return du}}),Object.defineProperty(F,"applyRootScale",{enumerable:!0,get:function(){return As}}),Object.defineProperty(F,"buildEmFontClassName",{enumerable:!0,get:function(){return fu}}),Object.defineProperty(F,"checkBlockAdaptivity",{enumerable:!0,get:function(){return cu}}),Object.defineProperty(F,"clearLinkTags",{enumerable:!0,get:function(){return Ao}}),Object.defineProperty(F,"clearProjectFontFaces",{enumerable:!0,get:function(){return Vr}}),Object.defineProperty(F,"commitOf",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(F,"commonStylesApply",{enumerable:!0,get:function(){return D0}}),Object.defineProperty(F,"commonStylesApplyToBlock",{enumerable:!0,get:function(){return hp}}),Object.defineProperty(F,"createFontClassName",{enumerable:!0,get:function(){return sp}}),Object.defineProperty(F,"createIdentifier",{enumerable:!0,get:function(){return se}}),Object.defineProperty(F,"defineSurface",{enumerable:!0,get:function(){return Q2}}),Object.defineProperty(F,"defineUnit",{enumerable:!0,get:function(){return L2}}),Object.defineProperty(F,"deviceWidthMediaGuardUnit",{enumerable:!0,get:function(){return Aoe}}),Object.defineProperty(F,"diagnosticsAgentUnit",{enumerable:!0,get:function(){return _oe}}),Object.defineProperty(F,"editLock",{enumerable:!0,get:function(){return Gf}}),Object.defineProperty(F,"elMarkupHelper",{enumerable:!0,get:function(){return Roe}}),Object.defineProperty(F,"extensionsUnit",{enumerable:!0,get:function(){return wU}}),Object.defineProperty(F,"findParentTr",{enumerable:!0,get:function(){return cS}}),Object.defineProperty(F,"fitEmailToWidth",{enumerable:!0,get:function(){return nI}}),Object.defineProperty(F,"fitImagesToColumns",{enumerable:!0,get:function(){return rg}}),Object.defineProperty(F,"getOuterHtml",{enumerable:!0,get:function(){return It}}),Object.defineProperty(F,"getPreheader",{enumerable:!0,get:function(){return Ga}}),Object.defineProperty(F,"getPreheaderElem",{enumerable:!0,get:function(){return dd}}),Object.defineProperty(F,"getSubject",{enumerable:!0,get:function(){return $g}}),Object.defineProperty(F,"getUsedColors",{enumerable:!0,get:function(){return j0}}),Object.defineProperty(F,"globalBlockReplace",{enumerable:!0,get:function(){return Xne}}),Object.defineProperty(F,"iframeSetSize",{enumerable:!0,get:function(){return rI}}),Object.defineProperty(F,"implementPolyfills",{enumerable:!0,get:function(){return nb}}),Object.defineProperty(F,"insertAdjacentHTML",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(F,"insertCountdown",{enumerable:!0,get:function(){return o0}}),Object.defineProperty(F,"insertNewHTML",{enumerable:!0,get:function(){return EE}}),Object.defineProperty(F,"isEmptyTable",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(F,"markAtomsAndClearRootHeight",{enumerable:!0,get:function(){return oN}}),Object.defineProperty(F,"markProjectFontClass",{enumerable:!0,get:function(){return lp}}),Object.defineProperty(F,"messageService",{enumerable:!0,get:function(){return U}}),Object.defineProperty(F,"minifyStylesheet",{enumerable:!0,get:function(){return vo}}),Object.defineProperty(F,"paintGateUnit",{enumerable:!0,get:function(){return Coe}}),Object.defineProperty(F,"parseFromString",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(F,"registerPreheaderService",{enumerable:!0,get:function(){return vre}}),Object.defineProperty(F,"registerSubjectService",{enumerable:!0,get:function(){return Ere}}),Object.defineProperty(F,"removeClassesByPrefix",{enumerable:!0,get:function(){return ba}}),Object.defineProperty(F,"removeHiddenClasses",{enumerable:!0,get:function(){return Ic}}),Object.defineProperty(F,"requireService",{enumerable:!0,get:function(){return M}}),Object.defineProperty(F,"require_iframeResizer_contentWindow_min",{enumerable:!0,get:function(){return Noe}}),Object.defineProperty(F,"rgbToHex",{enumerable:!0,get:function(){return G}}),Object.defineProperty(F,"rowsHost",{enumerable:!0,get:function(){return br}}),Object.defineProperty(F,"setBlockGroupControlsPosition",{enumerable:!0,get:function(){return bu}}),Object.defineProperty(F,"setBlockMaxWidth",{enumerable:!0,get:function(){return og}}),Object.defineProperty(F,"setDocumentStyles",{enumerable:!0,get:function(){return op}}),Object.defineProperty(F,"setElementBorder",{enumerable:!0,get:function(){return up}}),Object.defineProperty(F,"setElementBorderRadius",{enumerable:!0,get:function(){return Ri}}),Object.defineProperty(F,"setEmailBackgroundSettings",{enumerable:!0,get:function(){return v0}}),Object.defineProperty(F,"setFloatBlocksWidth",{enumerable:!0,get:function(){return ng}}),Object.defineProperty(F,"setImageWidth",{enumerable:!0,get:function(){return Qh}}),Object.defineProperty(F,"setStructureBlocksWidth",{enumerable:!0,get:function(){return Wu}}),Object.defineProperty(F,"startSandbox",{enumerable:!0,get:function(){return J2}}),Object.defineProperty(F,"state",{enumerable:!0,get:function(){return V}}),Object.defineProperty(F,"uptimeCountdown",{enumerable:!0,get:function(){return Jh}}),Object.defineProperty(F,"wheelBridgeUnit",{enumerable:!0,get:function(){return Toe}}),Object.defineProperty(F,"withForeignListenersPaused",{enumerable:!0,get:function(){return Dt}})});
|