text: /**
  * Inner class for the matches that have been made
  * @author Mark Hillman <mark@markhillman.info>
  *
  *   @class
  *   @param {number} index - The position that this match was found at in the
  *       main text
  *   @param {string} classes - A string which will be added to the class variable
  *       in the span tag, this should also include the type
  *   @param {string} type - This is the match type, e.g keyword, wrapping
  *   @param {number} length - This is the length of the match
  *   @param {string} match - This is the actual contents of the match
  *   @param {number} precedence - This is the precedence level of the match type
  */var Match=function(e,t,n,r,i,s){this.index=e,this.classes=t,this.type=n,this.length=r,this.match=i,this.precedence=s},RegexHighlighter=function(e){this.returnClassName=e,typeof this.returnClassName=="undefined"&&(this.returnClassName="regex-highlight")};RegexHighlighter.prototype.sortArrayByObjectsIndex=function(e){e.sort(function(t,n){return t.index==n.index?t.precedence-n.precedence:t.index-n.index})},RegexHighlighter.prototype.removeDuplicateObjectsFromArray=function(e,t){for(var n=1;n<e.length;n++){var r=t(e[n-1],e[n]);r<0?(e.splice(n-1,1),n--):r>0&&(e.splice(n,1),n--)}},RegexHighlighter.prototype.wrapTextWithSpan=function(e,t,n,r){if(typeof e=="undefined")return!1;typeof t=="undefined"&&(t=""),typeof n=="undefined"&&(n=0),typeof r=="undefined"&&(r=e.length);var i=e.substring(0,n),s=e.substring(n,r),o=e.substring(r);return i+"<span class='"+t+"'>"+s+"</span>"+o},RegexHighlighter.prototype.getMatchesArrayFromRegex=function(e,t){var n=[],r=1;for(var i=0;i<e.length;i++){var s=e[i],o=s.type,u=s.regexes,a;if(s.precedence){if(isNaN(s.precedence)){var f=!1;for(var l=0;l<n.length;l++)if(s.precedence==n[l].type){a=n[l].precedence,f=!0;break}f||(a=r)}else a=parseInt(s.precedence);r--}else a=r;for(var l=0;l<u.length;l++){var c,h;typeof u[l]=="string"?(c=u[l],h=0):(c=u[l].regexString,h=u[l].captureGroup);var p=this.findRegexMatches(t,c,h,o,a);n.push.apply(n,p)}r++}return n},RegexHighlighter.prototype.findRegexMatches=function(e,t,n,r,i){var s=[],o=new RegExp(t,"gm");while(match=o.exec(e)){var u=match.index;n>=match.length&&(n=0);var a=match[n],f=match[0].indexOf(a);matchObject=new Match(u+f,this.returnClassName+" "+r,r,a.length,a,i),s.push(matchObject)}return s},RegexHighlighter.prototype.defaultDuplicateFunction=function(e,t){return e.index==t.index?e.precedence==t.precedence?e.length==t.length?-1:e.length-t.length:e.precedence-t.precedence:t.index>e.index&&t.index+t.length<e.index+e.length?1:t.index>e.index&&t.index<e.index+e.length&&t.index+t.length>=e.index+e.length?e.precedence!=t.precedence?e.precedence-t.precedence:e.length!=t.length?e.length-t.length:-1:0},RegexHighlighter.prototype.insertSyntaxHighlighting=function(e,t,n){typeof n=="undefined"&&(n=this.defaultDuplicateFunction),t=t.replaceAll("<br>","\n").replaceAll("&lt;","<").replaceAll("&gt;",">");var r=this.getMatchesArrayFromRegex(e,t);return this.sortArrayByObjectsIndex(r),this.removeDuplicateObjectsFromArray(r,n),this.assembleNewStringFromMatchArray(t,r)},RegexHighlighter.prototype.insertSyntaxHighlightingByClass=function(e,t){if(typeof e=="undefined")return!1;typeof t=="undefined"&&(t="regex-color");var n=document.getElementsByClassName(t),r=[];for(var i=0;i<n.length;i++){var s=n[i],o=s.innerHTML;result=this.insertSyntaxHighlighting(e,o),result&&(s.innerHTML=result)}return!0},RegexHighlighter.prototype.loadSyntaxHighlightingByClass=function(e,t){typeof t=="undefined"&&(t="languages/"),typeof e=="undefined"&&(e="regex-color");var n=document.getElementsByClassName(e);for(var r=0;r<n.length;r++){var i=n[r],s=i.className.split(" ");if(s.length>1){var o=s[1];this.ajaxGET(t+o+".json",function(e,t){var n=JSON.parse(e),r=this.insertSyntaxHighlighting(n,t.innerHTML);r&&(t.innerHTML=r)}.bind(this),i)}}},RegexHighlighter.prototype.assembleNewStringFromMatchArray=function(e,t){var n=0;for(var r=0;r<t.length;r++){var i=t[r],s=i.index+n,o=i.classes,u=i.length;e=this.wrapTextWithSpan(e,o,s,s+u),n+=("<span class=''></span>"+o).length}return e},RegexHighlighter.prototype.ajaxGET=function(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){r.readyState==4&&r.status==200&&t(r.responseText,n)},r.open("GET",e,!0),r.send()},String.prototype.replaceAll=function(e,t){var n=this;return n.replace(new RegExp(e,"g"),t)};