1(function(t){"use strict";var l={equal:0,delete:1,insert:2,none:3,replace:4};function f(t,e,r){this.startInOld=t;this.startInNew=e;this.size=r}f.prototype.getEndInOld=function(){return this.startInOld+this.size};f.prototype.getEndInNew=function(){return this.startInNew+this.size};function h(){this.blockSize=0;this.repeatingWordsAccuracy=0;this.ignoreWhitespaceDifferences=!1;this.ignoreClassAttributes=!1}var r=/^\s*<\/?[^>]+>\s*$/;var n=/<[^\s>]+/;var e=/^(\s| )+$/;var s=/[\w\#@]+/;var i=["<img"];function c(e){var t=i.some(function(t){return e!==null&&e.startsWith(t)});return!t&&r.test(e)}function d(t,e,r){return["<",e,' class="',r,'">',t,"</",e,">"].join("")}function p(t){return t==="<"}function w(t){return t==="&"}function g(t){return t===";"}function v(t){return e.test(t)}function o(t){if(!c(t))return t;var e=n.exec(t)[0];return e+(t.endsWith("/>")?"/>":">")}function a(t){if(!r.test(t))return t;return t.replace(/\s+class\s*=\s*["'][^"']*["']/gi,"").replace(/\s+class\s*=\s*\S+/gi,"")}function I(t){return s.test(t)}function W(t,e,r){t.push(e);if(t.length>r){t.shift()}return t.length!==r?null:t.join("")}function u(t,e,r,n,s,i,o){this.oldWords=t;this.newWords=e;this.startInOld=r;this.endInOld=n;this.startInNew=s;this.endInNew=i;this.options=o;this.wordIndices=null}u.prototype.indexNewWords=function(){this.wordIndices=new Map;var t=[];for(var e=this.startInNew;e<this.endInNew;e++){var r=W(t,this.normalizeForIndex(this.newWords[e]),this.options.blockSize);if(r!==null){if(this.wordIndices.has(r)){this.wordIndices.get(r).push(e)}else{this.wordIndices.set(r,[e])}}}};u.prototype.normalizeForIndex=function(t){if(this.options.ignoreClassAttributes){t=a(t)}t=o(t);if(this.options.ignoreWhitespaceDifferences&&v(t)){return" "}return t};u.prototype.findMatch=function(){this.indexNewWords();this.removeRepeatingWords();if(this.wordIndices.size===0){return null}var t=this.startInOld;var e=this.startInNew;var r=0;var n=new Map;var s=this.options.blockSize;var i=[];for(var o=this.startInOld;o<this.endInOld;o++){var a=W(i,this.normalizeForIndex(this.oldWords[o]),s);if(a===null)continue;var h=new Map;if(this.wordIndices.has(a)){var c=this.wordIndices.get(a);for(var l=0;l<c.length;l++){var d=c[l];var u=(n.has(d-1)?n.get(d-1):0)+1;h.set(d,u);if(u>r){t=o-u-s+2;e=d-u-s+2;r=u}}n=h}else{n=h}}return r!==0?new f(t,e,r+s-1):null};u.prototype.removeRepeatingWords=function(){var e=this.newWords.length+this.options.repeatingWordsAccuracy;
1var t=Array.from(this.wordIndices.entries()).filter(function(t){return t[1].length>e}).map(function(t){return t[0]});for(var r=0;r<t.length;r++){this.wordIndices.delete(t[r])}};function O(t,e,r,n,s){this.action=t;this.startInOld=e;this.endInOld=r;this.startInNew=n;this.endInNew=s}var m={character:0,tag:1,whitespace:2,entity:3};function b(t,e){var r={mode:m.character,currentWord:[],words:[]};var n=y(t,e);var s=n.size>0;var i=!1;var o=-1;for(var a=0;a<t.length;a++){var h=t[a];if(s){if(o===a){o=-1;i=!1}var c=0;if(n.has(a)){i=!0;c=n.get(a);o=c}if(i){r.currentWord.push(h);r.mode=m.character;continue}}switch(r.mode){case m.character:if(p(h)){k(r,h,m.tag)}else if(w(h)){k(r,h,m.entity)}else if(v(h)){k(r,h,m.whitespace)}else if(I(h)&&(r.currentWord.length===0||I(r.currentWord[r.currentWord.length-1]))){r.currentWord.push(h)}else{k(r,h,m.character)}break;case m.tag:if(h===">"){r.currentWord.push(h);r.words.push(r.currentWord.join(""));r.currentWord=[];r.mode=v(h)?m.whitespace:m.character}else{r.currentWord.push(h)}break;case m.whitespace:if(p(h)){k(r,h,m.tag)}else if(w(h)){k(r,h,m.entity)}else if(v(h)){r.currentWord.push(h)}else{k(r,h,m.character)}break;case m.entity:if(p(h)){k(r,h,m.tag)}else if(v(h)){k(r,h,m.whitespace)}else if(g(h)){var l=!0;if(r.currentWord.length!==0){r.currentWord.push(h);r.words.push(r.currentWord.join(""));if(r.words.length>2&&v(r.words[r.words.length-2])&&v(r.words[r.words.length-1])){var d=r.words[r.words.length-2];var u=r.words[r.words.length-1];r.words.splice(r.words.length-2,2);r.currentWord=[(d+u).split()];r.mode=m.whitespace;l=!1}}if(l){r.currentWord=[];r.mode=m.character}}else if(I(h)){r.currentWord.push(h)}else{k(r,h,m.character)}break}}if(r.currentWord.length!==0){r.words.push(r.currentWord.join(""))}return r.words}function y(t,e){var r=new Map;if(e===null)return r;for(var n=0;n<e.length;n++){var s=e[n];var i;while((i=s.exec(t))!==null){if(r.has(i.index)){throw new Error("One or more block expressions result in a text sequence that overlaps. Current expression: "+s.toString())}r.set(i.index,i.index+i[0].length)}}return r}function k(t,e,r){if(t.currentWord.length!==0){t.words.push(t.currentWord.join(""))}t.currentWord=[e];t.mode=r}var x=4;var N=new Map([["</strong>",0],["</em>",0],["</b>",0],["</i>",0],["</big>",0],["</small>",0],["</u>",0],["</sub>",0],["</strike>",0],["</s>",0]]);var E=/<((strong)|(b)|(i)|(em)|(big)|(small)|(u)|(sub)|(sup)|(strike)|(s))[\>\s]+/gi;function T(t,e){if(!(this instanceof T)){return new T(t,e)}this.content=[];this.newText=e;this.oldText=t;this.specialTagDiffStack=[];this.newWords=[];this.oldWords=[];this.matchGranularity=0;this.blockExpressions=[];this.repeatingWordsAccuracy=1;this.ignoreWhiteSpaceDifferences=!1;this.ignoreClassAttributes=!1;this.orphanMatchThreshold=0}T.prototype.build=function(){if(this.oldText===this.newText){return this.newText}this.splitInputsIntoWords();this.matchGranularity=Math.min(x,this.oldWords.length,this.newWords.length);var t=this.operations();for(var e=0;e<t.length;e++){this.performOperation(t[e])}return this.content.join("")};T.prototype.addBlockExpression=function(t){this.blockExpressions.push(t)};T.prototype.splitInputsIntoWords=function(){this.oldWords=b(this.oldText,this.blockExpressions);this.oldText=null;this.newWords=b(this.newText,this.blockExpressions);this.newText=null};T.prototype.performOperation=function(t){switch(t.action){case l.equal:this.processEqualOperation(t);break;case l.delete:this.processDeleteOperation(t,"diffdel");break;case l.insert:this.processInsertOperation(t,"diffins");break;case l.none:break;case l.replace:this.processReplaceOperation(t);break}};T.prototype.processReplaceOperation=function(t){this.processDeleteOperation(t,"diffmod");this.processInsertOperation(t,"diffmod")};T.prototype.processInsertOperation=function(r,t){var e=this;var n=this.newWords.filter(function(t,e){return e>=r.startInNew&&e<r.endInNew});this.insertTag("ins",t,n)};T.prototype.processDeleteOperation=function(r,t){var e=this;var n=this.oldWords.filter(function(t,e){return e>=r.startInOld&&e<r.endInOld});this.insertTag("del",t,n)};T.prototype.processEqualOperation=function(r){var t=this;var e=this.newWords.filter(function(t,e){return e>=r.startInNew&&e<r.endInNew});this.content.push(e.join(""))};T.prototype.insertTag=function(t,e,r){while(r.length){var n=this.extractConsecutiveWords(r,function(t){return!c(t)});var s="";var i=!1;if(n.length!==0){var o=d(n.join(""),t,e);this.content.push(o)}else{if(E.test(r[0])){this.specialTagDiffStack.push(r[0]);s='<ins class="mod">';if(t==="del"){r.shift();while(r.length>0&&E.test(r[0])){r.shift()}}}
1else if(N.has(r[0])){var a=this.specialTagDiffStack.length===0?null:this.specialTagDiffStack.pop();if(a!==null&&a===r[0].replace(/\//g,"")){s="</ins>";i=!0}if(t==="del"){r.shift();while(r.length>0&&N.has(r[0])){r.shift()}}}if(r.length===0&&s.length===0){break}if(i){this.content.push(s+this.extractConsecutiveWords(r,c).join(""))}else{this.content.push(this.extractConsecutiveWords(r,c).join("")+s)}}}};T.prototype.extractConsecutiveWords=function(r,t){var n=null;for(var e=0;e<r.length;e++){var s=r[e];if(e===0&&s===" "){r[e]=" "}if(!t(s)){n=e;break}}if(n!==null){var i=r.filter(function(t,e){return e>=0&&e<n});if(n>0){r.splice(0,n)}return i}else{var i=r.filter(function(t,e){return e>=0&&e<r.length});r.splice(0,r.length);return i}};T.prototype.operations=function(){var t=0;var e=0;var r=[];var n=this.matchingBlocks();n.push(new f(this.oldWords.length,this.newWords.length,0));var s=this.removeOrphans(n);for(var i=0;i<s.length;i++){var o=s[i];var a=t===o.startInOld;var h=e===o.startInNew;var c;if(!a&&!h){c=l.replace}else if(a&&!h){c=l.insert}else if(!a){c=l.delete}else{c=l.none}if(c!==l.none){r.push(new O(c,t,o.startInOld,e,o.startInNew))}if(o.size!==0){r.push(new O(l.equal,o.startInOld,o.getEndInOld(),o.startInNew,o.getEndInNew()))}t=o.getEndInOld();e=o.getEndInNew()}return r};T.prototype.removeOrphans=function(t){var e=null;var r=null;var n=[];for(var s=0;s<t.length;s++){var i=t[s];if(r===null){e=new f(0,0,0);r=i;continue}if(e.getEndInOld()===r.startInOld&&e.getEndInNew()===r.startInNew||r.getEndInOld()===i.startInOld&&r.getEndInNew()===i.startInNew){n.push(r);e=r;r=i;continue}var o=function(t,e){return t+e.length};var a=this.oldWords.slice(e.getEndInOld(),i.startInOld).reduce(o,0);var h=this.newWords.slice(e.getEndInNew(),i.startInNew).reduce(o,0);var c=this.newWords.slice(r.startInNew,r.getEndInNew()).reduce(o,0);if(c>Math.max(a,h)*this.orphanMatchThreshold){n.push(r)}e=r;r=i}n.push(r);return n};T.prototype.matchingBlocks=function(){var t=[];this.findMatchingBlocks(0,this.oldWords.length,0,this.newWords.length,t);return t};T.prototype.findMatchingBlocks=function(t,e,r,n,s){var i=this.findMatch(t,e,r,n);if(i!==null){if(t<i.startInOld&&r<i.startInNew){this.findMatchingBlocks(t,i.startInOld,r,i.startInNew,s)}s.push(i);if(i.getEndInOld()<e&&i.getEndInNew()<n){this.findMatchingBlocks(i.getEndInOld(),e,i.getEndInNew(),n,s)}}};T.prototype.findMatch=function(t,e,r,n){for(var s=this.matchGranularity;s>0;s--){var i=new h;i.blockSize=s;i.repeatingWordsAccuracy=this.repeatingWordsAccuracy;i.ignoreWhitespaceDifferences=this.ignoreWhiteSpaceDifferences;i.ignoreClassAttributes=this.ignoreClassAttributes;var o=new u(this.oldWords,this.newWords,t,e,r,n,i);var a=o.findMatch();if(a!==null){return a}}return null};T.execute=function(t,e){return new T(t,e).build()};t.HtmlDiff=T})(window);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.