!function(e,t){"object"==typeofexports&&"undefined"!=typeofmodule?module.exports=t():"function"==typeofdefine&&define.amd?define(t):e.Mark=t()}(this,function(){"use strict";functione(t){return(e="function"==typeofSymbol&&"symbol"==typeofSymbol.iterator?function(e){returntypeofe}:function(e){returne&&"function"==typeofSymbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeofe})(t)}functiont(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functionn(e,t){for(varn=0;n<t.length;n++){varr=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}functionr(e,t,r){returnt&&n(e.prototype,t),r&&n(e,r),e}functiono(){return(o=Object.assign||function(e){for(vart=1;t<arguments.length;t++){varn=arguments[t];for(varrinn)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}returne}).apply(this,arguments)}vari=
function(){functionn(e){t(this,n),this.ctx=e,this.ie=!1;varr=window.navigator.userAgent;(r.indexOf("MSIE")>-1||r.indexOf("Trident")>-1)&&(this.ie=!0)}returnr(n,[{key:"log",value:function(t){varn=arguments.length>1&&void0!==arguments[1]?arguments[1]:"debug",r=this.opt.log;this.opt.debug&&"object"===e(r)&&"function"==typeofr[n]&&r[n]("mark.js: ".concat(t))}},{key:"getSeparatedKeywords",value:function(e){vart=this,n=[];returne.forEach(function(e){t.opt.separateWordSearch?e.split(" ").forEach(function(e){e.trim()&&-1===n.indexOf(e)&&n.push(e)}):e.trim()&&-1===n.indexOf(e)&&n.push(e)}),{keywords:n.sort(function(e,t){returnt.length-e.length}),length:n.length}}},{key:"isNumeric",value:function(e){returnNumber(parseFloat(e))==e}},{key:"checkRanges",value:function(e){vart=this;if(!Array.isArray(e)||"[object Object]"!==Object.prototype.toString.call(e[0]))returnthis.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];varn=[],r=0;returne.sort(function(e,t){returne.start-t.start}).forEach(function(e){varo=t.callNoMatchOnInvalidRanges(e,r),i=o.start,a=o.end;o.valid&&(e.start=i,e.length=a-i,n.push(e),r=a)}),n}},{key:"callNoMatchOnInvalidRanges",value:function(e,t){varn,r,o=!1;returne&&void0!==e.start?(r=(n=parseInt(e.start,10))+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&r-t>0&&r-n>0?o=!0:(this.log("Ignoring invalid or overlapping range: "+"".concat(JSON.stringify(e))),this.opt.noMatch(e))):(this.log("Ignoring invalid range: ".concat(JSON.stringify(e))),this.opt.noMatch(e)),{start:n,end:r,valid:o}}},{key:"checkWhitespaceRanges",value:function(e,t,n){varr,o=!0,i=n.length,a=t-i,s=parseInt(e.start,10)-a;return(r=(s=s>i?i:s)+parseInt(e.length,10))>i&&(r=i,this.log("End range automatically set to the max value of ".concat(i))),s<0||r-s<0||s>i||r>i?(o=!1,this.log("Invalid range: ".concat(JSON.stringify(e))),this.opt.noMatch(e)):""===n.substring(s,r).replace(/\s+/g,"")&&(o=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:s,end:r,valid:o}}},{key:"getTextNodes",value:function(e){vart=this,n="",r=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,function(e){r.push({start:n.length,end:(n+=e.textContent).length,node:e})},function(e){returnt.matchesExclude(e.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},function(){e({value:n,nodes:r})})}},{key:"matchesExclude",value:function(e){returni.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(e,t,n){varr=this.opt.element?this.opt.element:"mark",o=e.splitText(t),i=o.splitText(n-t),a=document.createElement(r);returna.setAttribute("data-markjs","true"),this.opt.className&&a.setAttribute("class",this.opt.className),a.textContent=o.textContent,o.parentNode.replaceChild(a,o),i}},{key:"wrapRangeInMappedTextNode",value:function(e,t,n,r,o){vari=this;e.nodes.every(function(a,s){varc=e.nodes[s+1];if(void0===c||c.start>t){if(!r(a.node))return!1;varu=t-a.start,l=(n>a.end?a.end:n)-a.start,h=e.value.substr(0,a.start),f=e.value.substr(l+a.start);if(a.node=i.wrapRangeInTextNode(a.node,u,l),e.value=h+f,e.nodes.forEach(function(t,n){n>=s&&(e.nodes[n].start>0&&n!==s&&(e.nodes[n].start-=l),e.nodes[n].end-=l)}),n-=l,o(a.node.previousSibling,a.start),!(n>a.end))return!1;t=a.end}return!0})}},{key:"wrapGroups",value:function(e,t,n,r){returnr((e=this.wrapRangeInTextNode(e,t,t+n)).previousSibling),e}},{key:"separateGroups",value:function(e,t,n,r,o){for(vari=t.length,a=1;a<i;a++){vars=e.textContent.indexOf(t[a]);t[a]&&s>-1&&r(t[a],e)&&(e=this.wrapGroups(e,s,t[a].length,o))}returne}},{key:"wrapMatches",value:function(e,t,n,r,o){vari=this,a=0===t?0:t+1;this.getTextNodes(function(t){t.nodes.forEach(function(t){varo;for(t=t.node;null!==(o=e.exec(t.textContent))&&""!==o[a];){if(i.opt.separateGroups)t=i.separateGroups(t,o,a,n,r);else{if(!n(o[a],t))continue;vars=o.index;if(0!==a)for(varc=1;c<a;c++)s+=o[c].length;t=i.wrapGroups(t,s,o[a].length,r)}e.lastIndex=0}}),o()})}},{key:"wrapMatchesAcrossElements",value:functio