weml-monaco 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@
9
9
  `:this.childNodes.reduce(function(n,r){return n+=r.rawText},"")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textContent",{get:function(){return kn(this.rawText)},set:function(n){var r=[new $t.default(n,this)];this.childNodes=r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return kn(this.rawText)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"structuredText",{get:function(){var n=[],r=[n];function a(i){if(i.nodeType===He.default.ELEMENT_NODE)oi.has(i.rawTagName)?(n.length>0&&r.push(n=[]),i.childNodes.forEach(a),n.length>0&&r.push(n=[])):i.childNodes.forEach(a);else if(i.nodeType===He.default.TEXT_NODE)if(i.isWhitespace)n.prependWhitespace=!0;else{var u=i.trimmedText;n.prependWhitespace&&(u=" ".concat(u),n.prependWhitespace=!1),n.push(u)}}return a(this),r.map(function(i){return i.join("").replace(/\s{2,}/g," ")}).join(`
10
10
  `).replace(/\s+$/,"")},enumerable:!1,configurable:!0}),t.prototype.toString=function(){var n=this.rawTagName;if(n){var r=this.rawAttrs?" ".concat(this.rawAttrs):"";return this.voidTag.formatNode(n,r,this.innerHTML)}return this.innerHTML},Object.defineProperty(t.prototype,"innerHTML",{get:function(){return this.childNodes.map(function(n){return n.toString()}).join("")},set:function(n){var r=jt(n,this._parseOptions),a=r.childNodes.length?r.childNodes:[new $t.default(n,this)];Ze(a,this),Ze(this.childNodes,null),this.childNodes=a},enumerable:!1,configurable:!0}),t.prototype.set_content=function(n,r){if(r===void 0&&(r={}),n instanceof ui.default)n=[n];else if(typeof n=="string"){r=Gt(Gt({},this._parseOptions),r);var a=jt(n,r);n=a.childNodes.length?a.childNodes:[new $t.default(a.innerHTML,this)]}return Ze(this.childNodes,null),Ze(n,this),this.childNodes=n,this},t.prototype.replaceWith=function(){for(var n=this,r=[],a=0;a<arguments.length;a++)r[a]=arguments[a];var i=this.parentNode,u=r.map(function(s){if(s instanceof ui.default)return[s];if(typeof s=="string"){var l=jt(s,n._parseOptions);return l.childNodes.length?l.childNodes:[new $t.default(s,n)]}return[]}).flat(),o=i.childNodes.findIndex(function(s){return s===n});return Ze([this],null),i.childNodes=Fn(Fn(Fn([],i.childNodes.slice(0,o),!0),Ze(u,i),!0),i.childNodes.slice(o+1),!0),this},Object.defineProperty(t.prototype,"outerHTML",{get:function(){return this.toString()},enumerable:!1,configurable:!0}),t.prototype.trimRight=function(n){for(var r=0;r<this.childNodes.length;r++){var a=this.childNodes[r];if(a.nodeType===He.default.ELEMENT_NODE)a.trimRight(n);else{var i=a.rawText.search(n);i>-1&&(a.rawText=a.rawText.substr(0,i),this.childNodes.length=r+1)}}return this},Object.defineProperty(t.prototype,"structure",{get:function(){var n=[],r=0;function a(u){n.push(" ".repeat(r)+u)}function i(u){var o=u.id?"#".concat(u.id):"",s=u.classList.length?".".concat(u.classList.value.join(".")):"";a("".concat(u.rawTagName).concat(o).concat(s)),r++,u.childNodes.forEach(function(l){l.nodeType===He.default.ELEMENT_NODE?i(l):l.nodeType===He.default.TEXT_NODE&&(l.isWhitespace||a("#text"))}),r--}return i(this),n.join(`
11
11
  `)},enumerable:!1,configurable:!0}),t.prototype.removeWhitespace=function(){var n=this,r=0;return this.childNodes.forEach(function(a){if(a.nodeType===He.default.TEXT_NODE){if(a.isWhitespace)return;a.rawText=a.trimmedRawText}else a.nodeType===He.default.ELEMENT_NODE&&a.removeWhitespace();n.childNodes[r++]=a}),this.childNodes.length=r,this},t.prototype.querySelectorAll=function(n){return(0,ii.selectAll)(n,this,{xmlMode:!0,adapter:si.default})},t.prototype.querySelector=function(n){return(0,ii.selectOne)(n,this,{xmlMode:!0,adapter:si.default})},t.prototype.getElementsByTagName=function(n){for(var r=n.toUpperCase(),a=[],i=[],u=this,o=0;o!==void 0;){var s=void 0;do s=u.childNodes[o++];while(o<u.childNodes.length&&s===void 0);if(s===void 0){u=u.parentNode,o=i.pop();continue}s.nodeType===He.default.ELEMENT_NODE&&((n==="*"||s.tagName===r)&&a.push(s),s.childNodes.length>0&&(i.push(o),u=s,o=0))}return a},t.prototype.getElementById=function(n){for(var r=[],a=this,i=0;i!==void 0;){var u=void 0;do u=a.childNodes[i++];while(i<a.childNodes.length&&u===void 0);if(u===void 0){a=a.parentNode,i=r.pop();continue}if(u.nodeType===He.default.ELEMENT_NODE){if(u.id===n)return u;u.childNodes.length>0&&(r.push(i),a=u,i=0)}}return null},t.prototype.closest=function(n){var r=new Map,a=this,i=null;function u(s,l){for(var c=null,d=0,h=l.length;d<h&&!c;d++){var f=l[d];if(s(f))c=f;else{var w=r.get(f);w&&(c=u(s,[w]))}}return c}for(;a;)r.set(a,i),i=a,a=a.parentNode;for(a=this;a;){var o=(0,ii.selectOne)(n,a,{xmlMode:!0,adapter:Gt(Gt({},si.default),{getChildren:function(s){var l=r.get(s);return l&&[l]},getSiblings:function(s){return[s]},findOne:u,findAll:function(){return[]}})});if(o)return o;a=a.parentNode}return null},t.prototype.appendChild=function(n){return n.remove(),this.childNodes.push(n),n.parentNode=this,n},Object.defineProperty(t.prototype,"firstChild",{get:function(){return this.childNodes[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return(0,Vt.default)(this.childNodes)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attrs",{get:function(){if(this._attrs)return this._attrs;this._attrs={};var n=this.rawAttributes;for(var r in n){var a=n[r]||"";this._attrs[r.toLowerCase()]=kn(a)}return this._attrs},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var n={},r=this.rawAttributes;for(var a in r){var i=r[a]||"";n[a]=kn(i)}return n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rawAttributes",{get:function(){if(this._rawAttrs)return this._rawAttrs;var n={};if(this.rawAttrs)for(var r=/([a-zA-Z()[\]#@$.?:][a-zA-Z0-9-_:()[\]#]*)(?:\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+))?/g,a=void 0;a=r.exec(this.rawAttrs);){var i=a[1],u=a[2]||null;u&&(u[0]==="'"||u[0]==='"')&&(u=u.slice(1,u.length-1)),n[i]=n[i]||u}return this._rawAttrs=n,n},enumerable:!1,configurable:!0}),t.prototype.removeAttribute=function(n){var r=this,a=this.rawAttributes;return delete a[n],this._attrs&&delete this._attrs[n],this.rawAttrs=Object.keys(a).map(function(i){var u=r.quoteAttribute(a[i]);return u==="null"||u==='""'?i:"".concat(i,"=").concat(u)}).join(" "),n==="id"&&(this.id=""),this},t.prototype.hasAttribute=function(n){return n.toLowerCase()in this.attrs},t.prototype.getAttribute=function(n){return this.attrs[n.toLowerCase()]},t.prototype.setAttribute=function(n,r){var a=this;if(arguments.length<2)throw new Error("Failed to execute 'setAttribute' on 'Element'");var i=n.toLowerCase(),u=this.rawAttributes;for(var o in u)if(o.toLowerCase()===i){n=o;break}return u[n]=String(r),this._attrs&&(this._attrs[i]=kn(u[n])),this.rawAttrs=Object.keys(u).map(function(s){var l=a.quoteAttribute(u[s]);return l==="null"||l==='""'?s:"".concat(s,"=").concat(l)}).join(" "),n==="id"&&(this.id=r),this},t.prototype.setAttributes=function(n){var r=this;return this._attrs&&delete this._attrs,this._rawAttrs&&delete this._rawAttrs,this.rawAttrs=Object.keys(n).map(function(a){var i=n[a];return i==="null"||i==='""'?a:"".concat(a,"=").concat(r.quoteAttribute(String(i)))}).join(" "),this},t.prototype.insertAdjacentHTML=function(n,r){var a,i,u,o=this;if(arguments.length<2)throw new Error("2 arguments required");var s=jt(r,this._parseOptions);if(n==="afterend"){var l=this.parentNode.childNodes.findIndex(function(c){return c===o});Ze(s.childNodes,this.parentNode),(a=this.parentNode.childNodes).splice.apply(a,Fn([l+1,0],s.childNodes,!1))}else if(n==="afterbegin")Ze(s.childNodes,this),(i=this.childNodes).unshift.apply(i,s.childNodes);else if(n==="beforeend")s.childNodes.forEach(function(c){o.appendChild(c)});else if(n==="beforebegin"){var l=this.parentNode.childNodes.findIndex(function(d){return d===o});Ze(s.childNodes,this.parentNode),(u=this.parentNode.childNodes).splice.apply(u,Fn([l,0],s.childNodes,!1))}else throw new Error("The value provided ('".concat(n,"') is not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'"));return this},Object.defineProperty(t.prototype,"nextSibling",{get:function(){if(this.parentNode){for(var n=this.parentNode.childNodes,r=0;r<n.length;){var a=n[r++];if(this===a)return n[r]||null}return null}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"nextElementSibling",{get:function(){if(this.parentNode){for(var n=this.parentNode.childNodes,r=0,a=!1;r<n.length;){var i=n[r++];if(a){if(i instanceof t)return i||null}else this===i&&(a=!0)}return null}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"previousSibling",{get:function(){if(this.parentNode){for(var n=this.parentNode.childNodes,r=n.length;r>0;){var a=n[--r];if(this===a)return n[r-1]||null}return null}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"previousElementSibling",{get:function(){if(this.parentNode){for(var n=this.parentNode.childNodes,r=n.length,a=!1;r>0;){var i=n[--r];if(a){if(i instanceof t)return i||null}else this===i&&(a=!0)}return null}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"classNames",{get:function(){return this.classList.toString()},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return jt(this.toString(),this._parseOptions).firstChild},t})(ui.default);fe.default=li;var Xe=/<!--[\s\S]*?-->|<(\/?)([a-zA-Z][-.:0-9_a-zA-Z]*)((?:\s+[^>]*?(?:(?:'[^']*')|(?:"[^"]*"))?)*)\s*(\/?)>/g,Ip=/(?:^|\s)(id|class)\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+)/gi,wo={li:{li:!0,LI:!0},LI:{li:!0,LI:!0},p:{p:!0,div:!0,P:!0,DIV:!0},P:{p:!0,div:!0,P:!0,DIV:!0},b:{div:!0,DIV:!0},B:{div:!0,DIV:!0},td:{td:!0,th:!0,TD:!0,TH:!0},TD:{td:!0,th:!0,TD:!0,TH:!0},th:{td:!0,th:!0,TD:!0,TH:!0},TH:{td:!0,th:!0,TD:!0,TH:!0},h1:{h1:!0,H1:!0},H1:{h1:!0,H1:!0},h2:{h2:!0,H2:!0},H2:{h2:!0,H2:!0},h3:{h3:!0,H3:!0},H3:{h3:!0,H3:!0},h4:{h4:!0,H4:!0},H4:{h4:!0,H4:!0},h5:{h5:!0,H5:!0},H5:{h5:!0,H5:!0},h6:{h6:!0,H6:!0},H6:{h6:!0,H6:!0}},vo={li:{ul:!0,ol:!0,UL:!0,OL:!0},LI:{ul:!0,ol:!0,UL:!0,OL:!0},a:{div:!0,DIV:!0},A:{div:!0,DIV:!0},b:{div:!0,DIV:!0},B:{div:!0,DIV:!0},i:{div:!0,DIV:!0},I:{div:!0,DIV:!0},p:{div:!0,DIV:!0},P:{div:!0,DIV:!0},td:{tr:!0,table:!0,TR:!0,TABLE:!0},TD:{tr:!0,table:!0,TR:!0,TABLE:!0},th:{tr:!0,table:!0,TR:!0,TABLE:!0},TH:{tr:!0,table:!0,TR:!0,TABLE:!0}},Mn="documentfragmentcontainer";function Ao(e,t){var n,r;t===void 0&&(t={});var a=new _o.default((n=t?.voidTag)===null||n===void 0?void 0:n.closingSlash,(r=t?.voidTag)===null||r===void 0?void 0:r.tags),i=t.blockTextElements||{script:!0,noscript:!0,style:!0,pre:!0},u=Object.keys(i),o=u.map(function(re){return new RegExp("^".concat(re,"$"),"i")}),s=u.filter(function(re){return!!i[re]}).map(function(re){return new RegExp("^".concat(re,"$"),"i")});function l(re){return s.some(function(je){return je.test(re)})}function c(re){return o.some(function(je){return je.test(re)})}var d=function(re,je){return[re-O,je-O]},h=new li(null,{},"",null,[0,e.length],a,t),f=h,w=[h],m=-1,S=void 0,C;e="<".concat(Mn,">").concat(e,"</").concat(Mn,">");for(var D=t.lowerCaseTagName,L=t.fixNestedATags,N=e.length-(Mn.length+2),O=Mn.length+2;C=Xe.exec(e);){var U=C[0],b=C[1],p=C[2],_=C[3],q=C[4],y=U.length,T=Xe.lastIndex-y,M=Xe.lastIndex;if(m>-1&&m+y<M){var R=e.substring(m,T);f.appendChild(new $t.default(R,f,d(m,T)))}if(m=Xe.lastIndex,p!==Mn){if(U[1]==="!"){if(t.comment){var R=e.substring(T+4,M-3);f.appendChild(new xp.default(R,f,d(T,M)))}continue}if(D&&(p=p.toLowerCase()),!b){for(var g={},A=void 0;A=Ip.exec(_);){var v=A[1],k=A[2],B=k[0]==="'"||k[0]==='"';g[v.toLowerCase()]=B?k.slice(1,k.length-1):k}var F=f.rawTagName;!q&&wo[F]&&wo[F][p]&&(w.pop(),f=(0,Vt.default)(w)),L&&(p==="a"||p==="A")&&(S!==void 0&&(w.splice(S),f=(0,Vt.default)(w)),S=w.length);var I=Xe.lastIndex,H=I-y;if(f=f.appendChild(new li(p,g,_.slice(1),null,d(H,I),a,t)),w.push(f),c(p)){var W="</".concat(p,">"),G=D?e.toLocaleLowerCase().indexOf(W,Xe.lastIndex):e.indexOf(W,Xe.lastIndex),Z=G===-1?N:G;if(l(p)){var R=e.substring(I,Z);R.length>0&&/\S/.test(R)&&f.appendChild(new $t.default(R,f,d(I,Z)))}G===-1?m=Xe.lastIndex=e.length+1:(m=Xe.lastIndex=G+W.length,b="/")}}if(b||q||a.isVoidElement(p))for(;;)if(S!=null&&(p==="a"||p==="A")&&(S=void 0),f.rawTagName===p){f.range[1]=d(-1,Math.max(m,M))[1],w.pop(),f=(0,Vt.default)(w);break}else{var F=f.tagName;if(vo[F]&&vo[F][p]){w.pop(),f=(0,Vt.default)(w);continue}break}}}return w}fe.base_parse=Ao;function jt(e,t){t===void 0&&(t={});for(var n=Ao(e,t),r=n[0],a=function(){var i=n.pop(),u=(0,Vt.default)(n);i.parentNode&&i.parentNode.parentNode&&(i.parentNode===u&&i.tagName===u.tagName?t.parseNoneClosedTags!==!0&&(u.removeChild(i),i.childNodes.forEach(function(o){u.parentNode.appendChild(o)}),n.pop()):t.parseNoneClosedTags!==!0&&(u.removeChild(i),i.childNodes.forEach(function(o){u.appendChild(o)})))};n.length>1;)a();return r}fe.parse=jt;function Ze(e,t){return e.map(function(n){return n.parentNode=t,n})}});var yo=j(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.default=void 0;var Np=kr();Object.defineProperty(Mr,"default",{enumerable:!0,get:function(){return Np.parse}})});var To=j(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});var qp=kr();function Op(e,t){t===void 0&&(t={});var n=(0,qp.base_parse)(e,t);return n.length===1}ci.default=Op});var Mo=j(ue=>{"use strict";var xt=ue&&ue.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ue,"__esModule",{value:!0});ue.NodeType=ue.TextNode=ue.Node=ue.valid=ue.CommentNode=ue.HTMLElement=ue.parse=void 0;var Co=xt(ha());ue.CommentNode=Co.default;var Do=xt(kr());ue.HTMLElement=Do.default;var Eo=xt(pn());ue.Node=Eo.default;var xo=xt(ai());ue.TextNode=xo.default;var So=xt(Nt());ue.NodeType=So.default;var Fo=xt(yo()),ko=xt(To());ue.valid=ko.default;function Je(e,t){return t===void 0&&(t={}),(0,Fo.default)(e,t)}ue.default=Je;ue.parse=Je;Je.parse=Fo.default;Je.HTMLElement=Do.default;Je.CommentNode=Co.default;Je.valid=ko.default;Je.Node=Eo.default;Je.TextNode=xo.default;Je.NodeType=So.default});var Go=j((Fm,Ai)=>{"use strict";var{parse:Hp,TextNode:di}=Mo(),St=new Set(["div","w-para","w-heading","w-para-group","w-list","w-li","table","thead","tbody","tr","td","th","figure","figcaption","w-toc","w-note","w-note-body","w-note-para"]),Rr=new Set(["w-text-block","w-note-header"]),Up=new Set(["w-format","w-lang","w-entity","w-non-egw","a","w-anchor","w-sent","w-page","w-color"]),Yt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","param"]),zp=new Set(["w-format","w-lang","w-color","w-non-egw","w-sent"]),Pp=/&(#[xX][0-9a-fA-F]+|#[0-9]+|[a-zA-Z][a-zA-Z0-9]*);?/g,Lo="\uE000",Ro="\uE001",Wp=Yt,jp=new Set(["class","headers","rel","rev"]),No=new Set([9,10,11,12,13,28,29,30,31,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288,65279]);function Gp(e){let{html:t,entities:n,marker:r}=Vp(e),a=Hp($p(t));qo(a);let i=a.querySelector("head title");i&&In(i,!0);let u=a.querySelector("body");return u&&Br(u),hi(ef(a,n,r),n,r)}function Vp(e){let t=1,n=Lo.repeat(t)+Ro;for(;e.includes(n);)t+=1,n=Lo.repeat(t)+Ro;let r=[];return{html:e.replace(Pp,i=>{let u=r.length;return r.push(i),`${n}${u}${n}`}),entities:r,marker:n}}function hi(e,t,n){let r=[],a=0;for(;a<e.length;){let i=e.indexOf(n,a);if(i<0){r.push(e.slice(a));break}r.push(e.slice(a,i));let u=i+n.length,o=e.indexOf(n,u),s=o>=0?e.slice(u,o):"",l=Number(s);if(o<0||!/^[0-9]+$/.test(s)||!Number.isSafeInteger(l)||l>=t.length)throw new Error("Invalid internal entity placeholder.");r.push(t[l]),a=o+n.length}return r.join("")}function $p(e){function t(a){let i=0,u=new Set([" "," ",`
12
- `,"\f","\r","\v"]);for(;i<a.length;){for(;i<a.length&&u.has(a[i]);)i+=1;if(i>=a.length||a[i]==="/")return!1;for(;i<a.length&&!u.has(a[i])&&!["=","/"].includes(a[i]);)i+=1;for(;i<a.length&&u.has(a[i]);)i+=1;if(i>=a.length||a[i]!=="=")continue;for(i+=1;i<a.length&&u.has(a[i]);)i+=1;if(i>=a.length)return!1;if(a[i]==='"'||a[i]==="'"){let s=a[i];for(i+=1;i<a.length&&a[i]!==s;)i+=1;i<a.length&&(i+=1);continue}let o=i;for(;i<a.length&&!u.has(a[i]);)i+=1;if(i===a.length)return o<a.length&&a.endsWith("/")}return!1}let n=[],r=0;for(;r<e.length;){if(e[r]!=="<"){n.push(e[r++]);continue}let a=r;if(e.startsWith("<!--",r)||e.startsWith("<?",r)){let w=e.startsWith("<!--",r)?"-->":"?>",m=e.indexOf(w,r+2);m=m<0?e.length:m+w.length,n.push(e.slice(a,m)),r=m;continue}let{end:i}=fi(e,r+1);if(i<0){n.push(e.slice(r));break}let u=r+1;if(e[u]==="!"){n.push(e.slice(a,i+1)),r=i+1;continue}let o=e[u]==="/";if(o&&u++,u>=i||!_i(e[u])){n.push(e[r++]);continue}let s=u++;for(;u<i&&Wo(e[u]);)u++;let l=e.slice(s,u),c=[],d=null,h=!1;for(let w=u;w<i;w++){let m=e[w];if(d!==null){c.push(m),m===d&&(d=null);continue}mi(m)?(h||c.push(" "),h=!0):(h=!1,c.push(m),(m==='"'||m==="'")&&(d=m))}let f=c.join("").replace(/ +$/,"");!o&&Yt.has(l.toLowerCase())?(f.endsWith("/")&&!t(f)&&(f=f.slice(0,-1).replace(/ +$/,"")),n.push(`<${l.toLowerCase()}${f} />`)):n.push(e.slice(a,u),f,">"),r=i+1}return n.join("")}function qo(e){for(let n of[...e.childNodes]){if(n.nodeType===8){e.removeChild(n);continue}if(n.nodeType!==1)continue;qo(n);let r=Object.keys(n.rawAttributes).some(a=>a.toLowerCase()==="id");if(zp.has(n.rawTagName.toLowerCase())&&!r&&n.childNodes.every(a=>a.nodeType===3&&jo(a.rawText))){let a=new di(n.childNodes.some(i=>i.rawText.length>0)?" ":"",e);e.exchangeChild(n,a)}}let t=null;for(let n of[...e.childNodes])n.nodeType===3?t!==null?(t.rawText+=n.rawText,e.removeChild(n)):t=n:t=null}function Br(e){e.childNodes=e.childNodes.filter(t=>{if(t.nodeType!==3)return!0;let n=Hn(t.rawText);return n?(t.rawText=n,!0):(t.parentNode=null,!1)});for(let t of[...e.childNodes]){if(t.nodeType!==1)continue;let n=t.rawTagName.toLowerCase();Rr.has(n)?bi(t):St.has(n)?Br(t):Ln(t)&&In(t,!0)}}function bi(e){vi(e)?wi(e):In(e,!0)}function wi(e){for(let t of[...e.childNodes]){if(t.nodeType!==1)continue;let n=t.rawTagName.toLowerCase();Ln(t)?vi(t)?wi(t):In(t,!1):St.has(n)?Br(t):Rr.has(n)&&bi(t)}for(let t of[...e.childNodes])t.nodeType===1&&Ln(t)&&Oo(t);for(let t of[...e.childNodes])t.nodeType===3&&(t.rawText=Nn(t.rawText));for(let t of[...e.childNodes])if(t.nodeType===1&&t.rawTagName.toLowerCase()==="br"){let n=t.previousSibling;n&&n.nodeType===3&&(n.rawText=On(n.rawText));let r=t.nextSibling;r&&r.nodeType===3&&(r.rawText=qn(r.rawText))}Yp(e);for(let t of[...e.childNodes])t.nodeType===3&&t.rawText===""&&t.remove()}function Yp(e){let t=[...e.childNodes];if(t.length===0)return;let n=t[0],r=t[t.length-1];t.length===1?n.nodeType===3&&(n.rawText=Hn(n.rawText)):(n.nodeType===3&&(n.rawText=qn(n.rawText)),r.nodeType===3&&(r.rawText=On(r.rawText)))}function In(e,t){for(let n of[...e.childNodes]){if(n.nodeType!==1)continue;let r=n.rawTagName.toLowerCase();Ln(n)?vi(n)?wi(n):In(n,!1):St.has(r)?Br(n):Rr.has(r)&&bi(n)}for(let n of[...e.childNodes])n.nodeType===1&&Ln(n)&&Oo(n);for(let n of[...e.childNodes])n.nodeType===3&&(n.rawText=Nn(n.rawText));for(let n of[...e.childNodes])if(n.nodeType===1&&n.rawTagName.toLowerCase()==="br"){let r=n.previousSibling;r&&r.nodeType===3&&(r.rawText=On(r.rawText));let a=n.nextSibling;a&&a.nodeType===3&&(a.rawText=qn(a.rawText))}t&&Kp(e);for(let n of[...e.childNodes])n.nodeType===3&&n.rawText===""&&n.remove()}function Xp(e,t){let n=e.parentNode;n&&(t.parentNode=n,n.childNodes.splice(n.childNodes.indexOf(e),0,t))}function Zp(e,t){let n=e.parentNode;n&&(t.parentNode=n,n.childNodes.splice(n.childNodes.indexOf(e)+1,0,t))}function Oo(e){let t=Jp(e),n=Qp(e);if(t){let r=e.previousSibling;r&&r.nodeType===3?r.rawText+=t:Xp(e,new di(t))}if(n){let r=e.nextSibling;r&&r.nodeType===3?r.rawText=n+r.rawText:Zp(e,new di(n))}}function Jp(e){let t=Ho(e);if(!t)return"";let n=t.rawText,r=qn(n);return r===n?"":(t.rawText=r," ")}function Qp(e){let t=Uo(e);if(!t)return"";let n=t.rawText,r=On(n);return r===n?"":(t.rawText=r," ")}function Ho(e){for(let t of e.childNodes){if(t.nodeType===3)return t;if(t.nodeType!==8&&t.nodeType===1){let n=t.rawTagName.toLowerCase();return St.has(n)||Yt.has(n)?null:Ho(t)}}return null}function Uo(e){let t=[...e.childNodes];for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.nodeType===3)return r;if(r.nodeType!==8&&r.nodeType===1){let a=r.rawTagName.toLowerCase();return St.has(a)||Yt.has(a)?null:Uo(r)}}return null}function Kp(e){let t=[...e.childNodes];if(t.length===0)return;let n=t[0],r=t[t.length-1];n===r?n.nodeType===3&&(n.rawText=Hn(n.rawText)):(n.nodeType===3&&(n.rawText=qn(n.rawText)),r.nodeType===3&&(r.rawText=On(r.rawText)))}function vi(e){return[...e.childNodes].some(t=>t.nodeType===1&&t.rawTagName.toLowerCase()==="w-sent")}function Ln(e){if(e.nodeType!==1)return!1;let t=e.rawTagName.toLowerCase();return Up.has(t)||!St.has(t)&&!Rr.has(t)&&!Yt.has(t)}function ef(e,t,n){let r=[`<!DOCTYPE html>
12
+ `,"\f","\r","\v"]);for(;i<a.length;){for(;i<a.length&&u.has(a[i]);)i+=1;if(i>=a.length||a[i]==="/")return!1;for(;i<a.length&&!u.has(a[i])&&!["=","/"].includes(a[i]);)i+=1;for(;i<a.length&&u.has(a[i]);)i+=1;if(i>=a.length||a[i]!=="=")continue;for(i+=1;i<a.length&&u.has(a[i]);)i+=1;if(i>=a.length)return!1;if(a[i]==='"'||a[i]==="'"){let s=a[i];for(i+=1;i<a.length&&a[i]!==s;)i+=1;i<a.length&&(i+=1);continue}let o=i;for(;i<a.length&&!u.has(a[i]);)i+=1;if(i===a.length)return o<a.length&&a.endsWith("/")}return!1}let n=[],r=0;for(;r<e.length;){if(e[r]!=="<"){n.push(e[r++]);continue}let a=r;if(e.startsWith("<!--",r)||e.startsWith("<?",r)){let w=e.startsWith("<!--",r)?"-->":"?>",m=e.indexOf(w,r+2);m=m<0?e.length:m+w.length,n.push(e.slice(a,m)),r=m;continue}let{end:i}=fi(e,r+1);if(i<0){n.push(e.slice(r));break}let u=r+1;if(e[u]==="!"){n.push(e.slice(a,i+1)),r=i+1;continue}let o=e[u]==="/";if(o&&u++,u>=i||!_i(e[u])){n.push(e[r++]);continue}let s=u++;for(;u<i&&Wo(e[u]);)u++;let l=e.slice(s,u),c=[],d=null,h=!1;for(let w=u;w<i;w++){let m=e[w];if(d!==null){c.push(m),m===d&&(d=null);continue}mi(m)?(h||c.push(" "),h=!0):(h=!1,c.push(m),(m==='"'||m==="'")&&(d=m))}let f=c.join("").replace(/ +$/,"");!o&&Yt.has(l.toLowerCase())?(f.endsWith("/")&&!t(f)&&(f=f.slice(0,-1).replace(/ +$/,"")),n.push(`<${l.toLowerCase()}${f} />`)):n.push(e.slice(a,u),f,">"),r=i+1}return n.join("")}function qo(e){for(let n of[...e.childNodes]){if(n.nodeType===8){e.removeChild(n);continue}if(n.nodeType!==1)continue;qo(n);let r=Object.keys(n.rawAttributes).some(a=>a.toLowerCase()==="id");if(zp.has(n.rawTagName.toLowerCase())&&!r&&n.childNodes.every(a=>a.nodeType===3&&jo(a.rawText))){let a=new di(n.childNodes.some(i=>i.rawText.length>0)?" ":"",e);e.exchangeChild(n,a)}}let t=null;for(let n of[...e.childNodes])n.nodeType===3?t!==null?(t.rawText+=n.rawText,e.removeChild(n)):t=n:t=null}function Br(e){e.childNodes=e.childNodes.filter(t=>{if(t.nodeType!==3)return!0;let n=Hn(t.rawText);return n?(t.rawText=n,!0):(t.parentNode=null,!1)});for(let t of[...e.childNodes]){if(t.nodeType!==1)continue;let n=t.rawTagName.toLowerCase();Rr.has(n)?bi(t):St.has(n)?Br(t):Ln(t)&&In(t,!0)}}function bi(e){vi(e)?wi(e,!0):In(e,!0)}function wi(e,t){for(let n of[...e.childNodes]){if(n.nodeType!==1)continue;let r=n.rawTagName.toLowerCase();Ln(n)?vi(n)?wi(n,!1):In(n,!1):St.has(r)?Br(n):Rr.has(r)&&bi(n)}for(let n of[...e.childNodes])n.nodeType===1&&Ln(n)&&Oo(n);for(let n of[...e.childNodes])n.nodeType===3&&(n.rawText=Nn(n.rawText));for(let n of[...e.childNodes])if(n.nodeType===1&&n.rawTagName.toLowerCase()==="br"){let r=n.previousSibling;r&&r.nodeType===3&&(r.rawText=On(r.rawText));let a=n.nextSibling;a&&a.nodeType===3&&(a.rawText=qn(a.rawText))}t&&Yp(e);for(let n of[...e.childNodes])n.nodeType===3&&n.rawText===""&&n.remove()}function Yp(e){let t=[...e.childNodes];if(t.length===0)return;let n=t[0],r=t[t.length-1];t.length===1?n.nodeType===3&&(n.rawText=Hn(n.rawText)):(n.nodeType===3&&(n.rawText=qn(n.rawText)),r.nodeType===3&&(r.rawText=On(r.rawText)))}function In(e,t){for(let n of[...e.childNodes]){if(n.nodeType!==1)continue;let r=n.rawTagName.toLowerCase();Ln(n)?vi(n)?wi(n,!1):In(n,!1):St.has(r)?Br(n):Rr.has(r)&&bi(n)}for(let n of[...e.childNodes])n.nodeType===1&&Ln(n)&&Oo(n);for(let n of[...e.childNodes])n.nodeType===3&&(n.rawText=Nn(n.rawText));for(let n of[...e.childNodes])if(n.nodeType===1&&n.rawTagName.toLowerCase()==="br"){let r=n.previousSibling;r&&r.nodeType===3&&(r.rawText=On(r.rawText));let a=n.nextSibling;a&&a.nodeType===3&&(a.rawText=qn(a.rawText))}t&&Kp(e);for(let n of[...e.childNodes])n.nodeType===3&&n.rawText===""&&n.remove()}function Xp(e,t){let n=e.parentNode;n&&(t.parentNode=n,n.childNodes.splice(n.childNodes.indexOf(e),0,t))}function Zp(e,t){let n=e.parentNode;n&&(t.parentNode=n,n.childNodes.splice(n.childNodes.indexOf(e)+1,0,t))}function Oo(e){let t=Jp(e),n=Qp(e);if(t){let r=e.previousSibling;r&&r.nodeType===3?r.rawText+=t:Xp(e,new di(t))}if(n){let r=e.nextSibling;r&&r.nodeType===3?r.rawText=n+r.rawText:Zp(e,new di(n))}}function Jp(e){let t=Ho(e);if(!t)return"";let n=t.rawText,r=qn(n);return r===n?"":(t.rawText=r," ")}function Qp(e){let t=Uo(e);if(!t)return"";let n=t.rawText,r=On(n);return r===n?"":(t.rawText=r," ")}function Ho(e){for(let t of e.childNodes){if(t.nodeType===3)return t;if(t.nodeType!==8&&t.nodeType===1){let n=t.rawTagName.toLowerCase();return St.has(n)||Yt.has(n)?null:Ho(t)}}return null}function Uo(e){let t=[...e.childNodes];for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.nodeType===3)return r;if(r.nodeType!==8&&r.nodeType===1){let a=r.rawTagName.toLowerCase();return St.has(a)||Yt.has(a)?null:Uo(r)}}return null}function Kp(e){let t=[...e.childNodes];if(t.length===0)return;let n=t[0],r=t[t.length-1];n===r?n.nodeType===3&&(n.rawText=Hn(n.rawText)):(n.nodeType===3&&(n.rawText=qn(n.rawText)),r.nodeType===3&&(r.rawText=On(r.rawText)))}function vi(e){return[...e.childNodes].some(t=>t.nodeType===1&&t.rawTagName.toLowerCase()==="w-sent")}function Ln(e){if(e.nodeType!==1)return!1;let t=e.rawTagName.toLowerCase();return Up.has(t)||!St.has(t)&&!Rr.has(t)&&!Yt.has(t)}function ef(e,t,n){let r=[`<!DOCTYPE html>
13
13
  `],a=e.querySelector("html");r.push(`<html${zo(a?a.rawAttrs:"",t,n)}>
14
14
 
15
15
  `);let i=e.querySelector("head");if(r.push(`<head>
package/dist/index.mjs CHANGED
@@ -6361,15 +6361,15 @@ var require_wemlContentNormalizeV2 = __commonJS({
6361
6361
  }
6362
6362
  }
6363
6363
  function processInlineContainer(node) {
6364
- if (hasDirectSentChildren(node)) processSentContainer(node);
6364
+ if (hasDirectSentChildren(node)) processSentContainer(node, true);
6365
6365
  else processInlineContent(node, true);
6366
6366
  }
6367
- function processSentContainer(node) {
6367
+ function processSentContainer(node, trimEdges) {
6368
6368
  for (const child of [...node.childNodes]) {
6369
6369
  if (child.nodeType !== 1) continue;
6370
6370
  const name = child.rawTagName.toLowerCase();
6371
6371
  if (isInlineTextElement(child)) {
6372
- if (hasDirectSentChildren(child)) processSentContainer(child);
6372
+ if (hasDirectSentChildren(child)) processSentContainer(child, false);
6373
6373
  else processInlineContent(child, false);
6374
6374
  } else if (BLOCK_ELEMENTS.has(name)) {
6375
6375
  processBlockElement(child);
@@ -6393,7 +6393,7 @@ var require_wemlContentNormalizeV2 = __commonJS({
6393
6393
  if (next && next.nodeType === 3) next.rawText = trimStartWhitespace(next.rawText);
6394
6394
  }
6395
6395
  }
6396
- trimContainerEdges(node);
6396
+ if (trimEdges) trimContainerEdges(node);
6397
6397
  for (const child of [...node.childNodes]) {
6398
6398
  if (child.nodeType === 3 && child.rawText === "") child.remove();
6399
6399
  }
@@ -6415,7 +6415,7 @@ var require_wemlContentNormalizeV2 = __commonJS({
6415
6415
  if (child.nodeType !== 1) continue;
6416
6416
  const name = child.rawTagName.toLowerCase();
6417
6417
  if (isInlineTextElement(child)) {
6418
- if (hasDirectSentChildren(child)) processSentContainer(child);
6418
+ if (hasDirectSentChildren(child)) processSentContainer(child, false);
6419
6419
  else processInlineContent(child, false);
6420
6420
  } else if (BLOCK_ELEMENTS.has(name)) {
6421
6421
  processBlockElement(child);