System.register([],function(_export,_context){"use strict";function t(t,n){var o=document.getSelection();if(!o||0===o.rangeCount)return;var e=o.getRangeAt(0);function c(t){t.style.margin="0";}function r(t){var n=document.getSelection();if(!n)return;var o=document.createRange();o.selectNodeContents(t),o.collapse(!0),n.removeAllRanges(),n.addRange(o);}function i(n){for(;n&&n!==t;){if(n instanceof HTMLElement){var _t=getComputedStyle(n).display;if(n.tagName.match(/^(P|DIV|H[1-6]|LI)$/)||"block"===_t||"list-item"===_t)return n;}n=n.parentNode;}return null;}function u(t,n){var o=document.createElement(n);for(c(o);t.firstChild;)o.appendChild(t.firstChild);t.replaceWith(o);}if(e.collapsed){var _f$textContent;var _o=i(e.startContainer),_d=_o===null||_o===void 0?void 0:_o.closest("ul,ol");if(_d&&_d.tagName.toLowerCase()===n)return void function(t,_o$parentNode){var n=t.closest("li");if(!n)return;var o=n.parentElement,e=document.createElement("p");for(n.style.textAlign&&(e.style.textAlign=n.style.textAlign);n.firstChild;)e.appendChild(n.firstChild);(_o$parentNode=o.parentNode)!==null&&_o$parentNode!==void 0&&_o$parentNode.insertBefore(e,o.nextSibling),n.remove(),0===o.childNodes.length&&o.remove(),r(e);}(_o);if(_d&&_d.tagName.toLowerCase()!==n)return void u(_d,n);if(!_o||_o===t||0===_o.childNodes.length||(f=_o,!((_f$textContent=f.textContent)!==null&&_f$textContent!==void 0&&_f$textContent.trim())&&!f.querySelector("img,br"))){var _t2=document.createElement(n),_o2=document.createElement("li");return _o2.appendChild(document.createElement("br")),_t2.appendChild(_o2),c(_t2),e.insertNode(_t2),void r(_o2);}var _s=document.createElement(n);c(_s);var _l=document.createElement("li");for(_o.style.textAlign&&(_l.style.textAlign=_o.style.textAlign);_o.firstChild;)_l.appendChild(_o.firstChild);return _s.appendChild(_l),_o.replaceWith(_s),void r(_l);}var f;var d=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:function acceptNode(t){if(!(t instanceof HTMLElement))return NodeFilter.FILTER_SKIP;if(!/^(P|DIV|LI|H[1-6])$/.test(t.tagName))return NodeFilter.FILTER_SKIP;var n=document.createRange();n.selectNodeContents(t);return e.compareBoundaryPoints(Range.END_TO_START,n)<0&&e.compareBoundaryPoints(Range.START_TO_END,n)>0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT;}});var l;for(;l=s.nextNode();)d.push(l);if(0===d.length){var _t3=i(e.startContainer);_t3&&d.push(_t3);}var m=d[0].closest("li");if(m){var _t4=m.closest("ul,ol");if(!_t4)return;return void(_t4.tagName.toLowerCase()===n?function(t){var n=document.createDocumentFragment();Array.from(t.querySelectorAll("li")).forEach(function(t){var o=document.createElement("p");for(t.style.textAlign&&(o.style.textAlign=t.style.textAlign);t.firstChild;)o.appendChild(t.firstChild);n.appendChild(o);}),t.replaceWith(n);}(_t4):u(_t4,n));}var a=document.createElement(n);c(a);for(var _i=0,_d2=d;_i<_d2.length;_i++){var _t5=_d2[_i];var _n=document.createElement("li");for(_t5.style.textAlign&&(_n.style.textAlign=_t5.style.textAlign);_t5.firstChild;)_n.appendChild(_t5.firstChild);a.appendChild(_n);}d[0].replaceWith(a);for(var _t6=1;_t6<d.length;_t6++)d[_t6].remove();}_export("t",t);return{setters:[],execute:function execute(){}};});
//# sourceMappingURL=list-utils.cjs.js.map
