function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var n=function(e){return e&&"object"===r(e)&&!Array.isArray(e)},a=function e(t,r){var a=Object.assign({},t);return n(t)&&n(r)&&Object.keys(r).forEach((function(i){n(r[i])&&i in t?a[i]=e(t[i],r[i]):Object.assign(a,function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},i,r[i]))})),a},i={youtube:'<div class="embed"><iframe class="embed-youtube" frameborder="0" src="<%data.embed%>" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen <%data.length%>></iframe></div>',twitter:'<blockquote class="twitter-tweet" class="embed-twitter" <%data.length%>><a href="<%data.source%>"></a></blockquote> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"><\/script>',instagram:'<blockquote class="instagram-media" <%data.length%>><a href="<%data.embed%>/captioned"></a></blockquote><script async defer src="//www.instagram.com/embed.js"><\/script>',codepen:'<div class="embed"><iframe <%data.length%> scrolling="no" src="<%data.embed%>" frameborder="no" loading="lazy" allowtransparency="true" allowfullscreen="true"></iframe></div>',defaultMarkup:'<div class="embed"><iframe src="<%data.embed%>" <%data.length%> class="embed-unknown" allowfullscreen="true" frameborder="0" ></iframe></div>'},o={paragraph:function(e,t){return'<p class="'.concat(t.paragraph.pClass,'"> ').concat(e.text," </p>")},header:function(e){return"<h".concat(e.level,">").concat(e.text,"</h").concat(e.level,">")},list:function(e){var t="ordered"===e.style?"ol":"ul",r=e.items.reduce((function(e,t){return e+"<li>".concat(t,"</li>")}),"");return"<".concat(t,">").concat(r,"</").concat(t,">")},quote:function(e,t){var r="";return t.quote.applyAlignment&&(r='style="text-align: '.concat(e.alignment,';"')),"<blockquote ".concat(r,"><p>").concat(e.text,"</p><cite>").concat(e.caption,"</cite></blockquote>")},table:function(e){var t=e.content.map((function(e){return"<tr>".concat(e.reduce((function(e,t){return e+"<td>".concat(t,"</td>")}),""),"</tr>")}));return"<table><tbody>".concat(t.join(""),"</tbody></table>")},image:function(e,t){var r,n="".concat(e.stretched?"img-fullwidth":""," ").concat(e.withBorder?"img-border":""," ").concat(e.withBackground?"img-bg":""),a=t.image.imgClass||"";if(r=e.url?e.url:"absolute"===t.image.path?e.file.url:t.image.path.replace(/<(.+)>/,(function(t,r){return e.file[r]})),"img"===t.image.use)return'<img class="'.concat(n," ").concat(a,'" src="').concat(r,'" alt="').concat(e.caption,'">');if("figure"===t.image.use){var i=t.image.figCapClass||"";return'<figure class="'.concat(t.image.figureClass||"",'"><img class="').concat(a," ").concat(n,'" src="').concat(r,'" alt="').concat(e.caption,'"><figcaption class="').concat(i,'">').concat(e.caption,"</figcaption></figure>")}},code:function(e,t){var r=function(e){return(e=(e=e.replace(/&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")}(e.code);return'<pre><code class="'.concat(t.code.codeBlockClass,'">').concat(r,"</code></pre>")},raw:function(e){return e.html},delimiter:function(){return"<br />"},embed:function(e,t){e.length=t.embed.useProvidedLength?'width="'.concat(e.width,'" height="').concat(e.height,'"'):"";var r=new RegExp(/<%data\.(.+?)%>/,"gm");return t.embedMarkups[e.service]?t.embedMarkups[e.service].replace(r,(function(t,r){return e[r]})):t.embedMarkups.defaultMarkup.replace(r,(function(t,r){return e[r]}))}},c={image:{use:"figure",imgClass:"img",figureClass:"fig-img",figCapClass:"fig-cap",path:"absolute"},paragraph:{pClass:"paragraph"},code:{codeBlockClass:"code-block"},embed:{useProvidedLength:!1},quote:{applyAlignment:!1}},u=function(){function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e(this,r),this.config=a(c,t),this.config.embedMarkups=Object.assign(i,u),this.parsers=Object.assign(o,n)}var n,u;return n=r,(u=[{key:"parse",value:function(e){var t=this;return e.blocks.map((function(e){var r=t.parseBlock(e);return r instanceof Error?"":r})).join("")}},{key:"parseBlock",value:function(e){if(!this.parsers[e.type])return new Error("".concat(e.type," is not supported! Define your own custom function."));try{return this.parsers[e.type](e.data,this.config)}catch(e){return e}}}])&&t(n.prototype,u),r}();export{u as e}