!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).ContentsOutline=t()}(this,function(){"use strict";var a=function(e,n){var i=[];return[].slice.call(e).forEach(function(e){var t=new r(e,n);t&&i.push(t)}),i},d=function(e,t){var n,i,r,o,c,a,d,l,u,f;"true"===e.getAttribute("data-initialized")||(n=e.querySelector(".contents-outline"))&&(t.headings.length<1&&e.parentNode.removeChild(e),t.headings.sort(function(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}),i=0,[].slice.call(t.headings).forEach(function(e){var t;e.getAttribute("id")||(t=function e(t,n){return document.getElementById("".concat(t).concat(n))?e(t,n+1):n}("co-index-",i),e.setAttribute("id","co-index-".concat(t)),i=t+1)}),r=function(e){return e?parseInt(e.tagName.replace("H","")):void 0},a=[{level:c=void(o=0),tree:document.createElement("ol")}],d=function(e){var t=document.createElement("li"),n=document.createElement("a");return n.textContent=e.textContent.replace(/[\n\r]/g,""),n.setAttribute("href","#".concat(e.getAttribute("id"))),t.appendChild(n),t},l=function(e){var t,n;a[o]?a[o].tree.appendChild(d(e)):(a[o]={},a[o].tree=(t=e,(n=document.createElement("ol")).appendChild(d(t)),n),[].slice.call(a[o-1].tree.children).slice(-1)[0].appendChild(a[o].tree)),a[o].level=r(e)},u=function(e){var t,n=r(c),i=r(e);n