text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).HTMLParser={})}(this,function(e){"use strict";const t=/[^><\/ ]+/,n=new RegExp(`${t.source}="[^"]*"`),c=new RegExp(`${t.source}='[^']*'`),o=new RegExp(`${t.source}`),s=new RegExp(`(${n.source})|(${c.source})|(${o.source})`),r=`<${t.source}( +(${s.source}))* *>`,u=`^\\<(${t.source})`,i=`^</(${t.source})>`,l=/^(<!--(.*?)-->)/;function a(e){e=e.replace(/[\n\r]/g,"").trim();const t=[],n=[];for(;e;){let t,a,f,d;if(d=e.match(l)){const e=new p("comment");e.text=d[2],o(e),c(d[0].length)}else if(f=e.match(new RegExp(u))){const t=f[1];let u=e.match(new RegExp(r))[0].length;const i=e.slice(0,u).replace(t,"").match(new RegExp(s.source,"g")),l=new p(t);i&&(l.attrs=i.map(e=>{let t=e.indexOf("=");return t=t<0?e.length:t,{key:e.slice(0,t).replace(/[:@]/,""),value:e.slice(t+1).replace(/[\"\'"]/g,"")}})),o(l),n.push(l),c(u)}else if(a=e.match(new RegExp(i)))n.pop(),c(a[0].length);else if(t=e.match(new RegExp("^[^<]*"))){const n=e.indexOf("<"),s=new p("text");s.text=t[0],o(s),c(n)}}function c(t){e=e.slice(t)}function o(e){n.length?n[n.length-1].children.push(e):t.push(e)}return t}class p{constructor(e){this.attrs=[],this.children=[],this.tag=e}}const f=e=>{const t=document.createDocumentFragment();for(const n of e)if("text"===n.tag){const e=document.createTextNode(n.text);t.appendChild(e)}else if("comment"===n.tag){const e=document.createComment(n.text);t.appendChild(e)}else{const e=document.createElement(n.tag);for(const t of n.attrs)e.setAttribute(t.key,t.value);e.appendChild(f(n.children)),t.appendChild(e)}return t};e.generate=f,e.parse=a,e.toDOM=function(e){const t=a(e);return f(t)},Object.defineProperty(e,"__esModule",{value:!0})});
  