var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.checkStringArgs=function(b,d,a){if(null==b)throw new TypeError("The 'this' value for String.prototype."+a+" must not be null or undefined");if(d instanceof RegExp)throw new TypeError("First argument to String.prototype."+a+" must not be a regular expression");return b+""};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1; $jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,d,a){b!=Array.prototype&&b!=Object.prototype&&(b[d]=a.value)};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this); $jscomp.polyfill=function(b,d,a,c){if(d){a=$jscomp.global;b=b.split(".");for(c=0;cb||1342177279>>=1)a+=a;return c}},"es6","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)}; $jscomp.Symbol=function(){var b=0;return function(d){return $jscomp.SYMBOL_PREFIX+(d||"")+b++}}();$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.iterator;b||(b=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[b]&&$jscomp.defineProperty(Array.prototype,b,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}}; $jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.asyncIterator;b||(b=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.arrayIterator=function(b){var d=0;return $jscomp.iteratorPrototype(function(){return d=h.nbLine?a.json2+="\n".repeat(e.nbLine-h.nbLine):a.json1+="\n".repeat(h.nbLine-e.nbLine);return{diff:b}}if(Array.isArray(b)){a.json1+=(c&&c.array?a.tab:"")+"[\n";a.json2+=(c&&c.array?a.tab:"")+"[\n";a.currentLine+=1;a.tab+="\t";var k=[],g=0;b.forEach(function(e,f){g++;(e=compareJSON(e,d[f],a,{tree:c.tree.concat([[f]]), array:!0,coma1:f!=b.length-1,coma2:f=b.length&&(g++,(d=compareJSON(b[e],d,a,{tree:c.tree.concat([[e]]),array:!0,coma2:ga+1)&&b.stepDiff.push(c); a=c.line});document.getElementById("nb-diff").innerHTML=nbDiff+" difference(s) between the two JSON documents";document.getElementById("result").style.display=""}currentDiff=null;function removeSelectionPrevious(b,d){null!==d&&(b.removeLineClass(d,"background","text-compare-select-top"),b.removeLineClass(d,"background","text-compare-select-bottom"),b.removeLineClass(d,"background","text-compare-select-middle"))} function jumpToLine(b,d){var a=b.charCoords({line:d,ch:0},"local").top,c=b.getScrollerElement().offsetHeight/4;b.scrollTo(null,a-c);b.addLineClass(d,"background","text-compare-select-top");b.addLineClass(d,"background","text-compare-select-bottom");b.addLineClass(d,"background","text-compare-select-middle")} function previous(){resultToDraw.stepDiff.sort(function(b,d){return d.line-b.line});resultToDraw.stepDiff.some(function(b){return null==currentDiff||b.lineeditorHeight&&(editorHeight=450);myCodeMirrorResult1.setSize(null,editorHeight);myCodeMirrorResult2.setSize(null,editorHeight)} function next(){resultToDraw.stepDiff.sort(function(b,d){return b.line-d.line});resultToDraw.stepDiff.some(function(b){return null==currentDiff||b.line>currentDiff?(removeSelectionPrevious(myCodeMirrorResult1,currentDiff),removeSelectionPrevious(myCodeMirrorResult2,currentDiff),currentDiff=b.line,jumpToLine(myCodeMirrorResult1,currentDiff),jumpToLine(myCodeMirrorResult2,currentDiff),!0):!1})} function loadURL(b){var d=new URL(window.location.href),a=d.searchParams.get("url1");d=d.searchParams.get("url2");var c=0;a&&a.length&&c++;d&&d.length&&c++;if(0==c)return b();a&&a.length&&(currentEditor=myCodeMirrorText1,document.getElementById("url").value=a,loadFromURL(function(){c--;0==c&&b()}));d&&d.length&&(currentEditor=myCodeMirrorText2,document.getElementById("url").value=d,loadFromURL(function(){c--;0==c&&b()}))} addEvent(window,"load",function(){myCodeMirrorText1=services.codeMirror.create("editor-container-text",{mode:"application/json",lineNumbers:!0});myCodeMirrorText2=services.codeMirror.create("editor-container-text-2",{mode:"application/json",lineNumbers:!0});myCodeMirrorResult1=services.codeMirror.create("editor-container-result1",{mode:"application/json",readOnly:!0,lineNumbers:!1,viewportMargin:Infinity});myCodeMirrorResult2=services.codeMirror.create("editor-container-result2",{mode:"application/json", readOnly:!0,lineNumbers:!1,viewportMargin:Infinity});myCodeMirrorResultDiff=services.codeMirror.create("editor-container-result-diff",{mode:"application/json",readOnly:!0,lineNumbers:!1,viewportMargin:Infinity,lineWrapping:!0});myCodeMirrorText1.setSize(null,editorHeight-50);myCodeMirrorText2.setSize(null,editorHeight-50);myCodeMirrorResultDiff.setSize(null,editorHeight);myCodeMirrorResult1.setSize(null,editorHeight);myCodeMirrorResult2.setSize(null,editorHeight);services.file.dragAndDrop(dropZone, ReadModeEnum.TEXT,function(b){b&&myCodeMirrorText1.setValue(b)});services.file.dragAndDrop(dropZone2,ReadModeEnum.TEXT,function(b){b&&myCodeMirrorText2.setValue(b)});setTimeout(function(){document.getElementById("result").style.display="none"},5);dialogLoadFromURL=new A11yDialog(document.getElementById("dialog-load-from-url"));document.getElementById("remove-horizontal-scrolling").addEventListener("change",function(){myCodeMirrorResult1.setOption("lineWrapping","Yes"===document.getElementById("remove-horizontal-scrolling").value); myCodeMirrorResult2.setOption("lineWrapping","Yes"===document.getElementById("remove-horizontal-scrolling").value)});document.getElementById("download-diff").addEventListener("click",function(){var b=new Blob([myCodeMirrorResultDiff.getValue("\n")],{type:"application/json"});if(navigator.msSaveBlob)navigator.msSaveBlob(b,"diff.json");else{var d=document.createElement("a");void 0!==d.download&&(b=URL.createObjectURL(b),d.setAttribute("href",b),d.setAttribute("download","diff.json"),d.style.visibility= "hidden",document.body.appendChild(d),d.click(),document.body.removeChild(d))}});document.getElementById("copy-diff").addEventListener("click",function(){var b=document.createElement("textarea");b.textContent=myCodeMirrorResultDiff.getValue("\n");document.body.appendChild(b);var d=document.getSelection(),a=document.createRange();a.selectNode(b);d.removeAllRanges();d.addRange(a);document.execCommand("copy");d.removeAllRanges();document.body.removeChild(b)});loadURL(function(){myCodeMirrorText1.on("change", onChangeText);myCodeMirrorText2.on("change",onChangeText);myCodeMirrorResult1.on("scroll",function(){onScroll(myCodeMirrorResult1)});myCodeMirrorResult2.on("scroll",function(){onScroll(myCodeMirrorResult2)});setTimeout(function(){onChangeText();next()},10)})});