mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-12-26 12:18:21 +01:00
1 line
34 KiB
JavaScript
1 line
34 KiB
JavaScript
(function(){}).call(this),parcelRequire=function(t,e,n,i){var r,s="function"==typeof parcelRequire&&parcelRequire,o="function"==typeof require&&require;function a(n,i){if(!e[n]){if(!t[n]){var r="function"==typeof parcelRequire&&parcelRequire;if(!i&&r)return r(n,!0);if(s)return s(n,!0);if(o&&"string"==typeof n)return o(n);var f=new Error("Cannot find module '"+n+"'");throw f.code="MODULE_NOT_FOUND",f}l.resolve=function(e){return t[n][1][e]||e},l.cache={};var h=e[n]=new a.Module(n);t[n][0].call(h.exports,l,h,h.exports,this)}return e[n].exports;function l(t){return a(l.resolve(t))}}a.isParcelRequire=!0,a.Module=function(t){this.id=t,this.bundle=a,this.exports={}},a.modules=t,a.cache=e,a.parent=s,a.register=function(e,n){t[e]=[function(t,e){e.exports=n},{}]};for(var f=0;f<n.length;f++)try{a(n[f])}catch(t){r||(r=t)}if(n.length){var h=a(n[n.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=h:"function"==typeof define&&define.amd?define((function(){return h})):this.AceDiff=h}if(parcelRequire=a,r)throw r;return a}({k8CM:[function(t,e,n){var i=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},r=-1;i.Diff=function(t,e){return[t,e]},i.prototype.diff_main=function(t,e,n,r){void 0===r&&(r=this.Diff_Timeout<=0?Number.MAX_VALUE:(new Date).getTime()+1e3*this.Diff_Timeout);var s=r;if(null==t||null==e)throw new Error("Null input. (diff_main)");if(t==e)return t?[new i.Diff(0,t)]:[];void 0===n&&(n=!0);var o=n,a=this.diff_commonPrefix(t,e),f=t.substring(0,a);t=t.substring(a),e=e.substring(a),a=this.diff_commonSuffix(t,e);var h=t.substring(t.length-a);t=t.substring(0,t.length-a),e=e.substring(0,e.length-a);var l=this.diff_compute_(t,e,o,s);return f&&l.unshift(new i.Diff(0,f)),h&&l.push(new i.Diff(0,h)),this.diff_cleanupMerge(l),l},i.prototype.diff_compute_=function(t,e,n,s){var o;if(!t)return[new i.Diff(1,e)];if(!e)return[new i.Diff(r,t)];var a=t.length>e.length?t:e,f=t.length>e.length?e:t,h=a.indexOf(f);if(-1!=h)return o=[new i.Diff(1,a.substring(0,h)),new i.Diff(0,f),new i.Diff(1,a.substring(h+f.length))],t.length>e.length&&(o[0][0]=o[2][0]=r),o;if(1==f.length)return[new i.Diff(r,t),new i.Diff(1,e)];var l=this.diff_halfMatch_(t,e);if(l){var c=l[0],g=l[1],u=l[2],d=l[3],p=l[4],_=this.diff_main(c,u,n,s),m=this.diff_main(g,d,n,s);return _.concat([new i.Diff(0,p)],m)}return n&&t.length>100&&e.length>100?this.diff_lineMode_(t,e,s):this.diff_bisect_(t,e,s)},i.prototype.diff_lineMode_=function(t,e,n){var s=this.diff_linesToChars_(t,e);t=s.chars1,e=s.chars2;var o=s.lineArray,a=this.diff_main(t,e,!1,n);this.diff_charsToLines_(a,o),this.diff_cleanupSemantic(a),a.push(new i.Diff(0,""));for(var f=0,h=0,l=0,c="",g="";f<a.length;){switch(a[f][0]){case 1:l++,g+=a[f][1];break;case r:h++,c+=a[f][1];break;case 0:if(h>=1&&l>=1){a.splice(f-h-l,h+l),f=f-h-l;for(var u=this.diff_main(c,g,!1,n),d=u.length-1;d>=0;d--)a.splice(f,0,u[d]);f+=u.length}l=0,h=0,c="",g=""}f++}return a.pop(),a},i.prototype.diff_bisect_=function(t,e,n){for(var s=t.length,o=e.length,a=Math.ceil((s+o)/2),f=a,h=2*a,l=new Array(h),c=new Array(h),g=0;g<h;g++)l[g]=-1,c[g]=-1;l[f+1]=0,c[f+1]=0;for(var u=s-o,d=u%2!=0,p=0,_=0,m=0,v=0,b=0;b<a&&!((new Date).getTime()>n);b++){for(var L=-b+p;L<=b-_;L+=2){for(var y=f+L,E=(C=L==-b||L!=b&&l[y-1]<l[y+1]?l[y+1]:l[y-1]+1)-L;C<s&&E<o&&t.charAt(C)==e.charAt(E);)C++,E++;if(l[y]=C,C>s)_+=2;else if(E>o)p+=2;else if(d&&(x=f+u-L)>=0&&x<h&&-1!=c[x]&&C>=(D=s-c[x]))return this.diff_bisectSplit_(t,e,C,E,n)}for(var w=-b+m;w<=b-v;w+=2){for(var D,x=f+w,S=(D=w==-b||w!=b&&c[x-1]<c[x+1]?c[x+1]:c[x-1]+1)-w;D<s&&S<o&&t.charAt(s-D-1)==e.charAt(o-S-1);)D++,S++;if(c[x]=D,D>s)v+=2;else if(S>o)m+=2;else if(!d){var C;if((y=f+u-w)>=0&&y<h&&-1!=l[y]&&(E=f+(C=l[y])-y,C>=(D=s-D)))return this.diff_bisectSplit_(t,e,C,E,n)}}}return[new i.Diff(r,t),new i.Diff(1,e)]},i.prototype.diff_bisectSplit_=function(t,e,n,i,r){var s=t.substring(0,n),o=e.substring(0,i),a=t.substring(n),f=e.substring(i),h=this.diff_main(s,o,!1,r),l=this.diff_main(a,f,!1,r);return h.concat(l)},i.prototype.diff_linesToChars_=function(t,e){var n=[],i={};function r(t){for(var e="",r=0,o=-1,a=n.length;o<t.length-1;){-1==(o=t.indexOf("\n",r))&&(o=t.length-1);var f=t.substring(r,o+1);(i.hasOwnProperty?i.hasOwnProperty(f):void 0!==i[f])?e+=String.fromCharCode(i[f]):(a==s&&(f=t.substring(r),o=t.length),e+=String.fromCharCode(a),i[f]=a,n[a++]=f),r=o+1}return e}n[0]="";var s=4e4,o=r(t);return s=65535,{chars1:o,chars2:r(e),lineArray:n}},i.prototype.diff_charsToLines_=function(t,e){for(var n=0;n<t.length;n++){for(var i=t[n][1],r=[],s=0;s<i.length;s++)r[s]=e[i.charCodeAt(s)];t[n][1]=r.join("")}},i.prototype.diff_commonPrefix=function(t,e){if(!t||!e||t.charAt(0)!=e.charAt(0))return 0;for(var n=0,i=Math.min(t.length,e.length),r=i,s=0;n<r;)t.substring(s,r)==e.substring(s,r)?s=n=r:i=r,r=Math.floor((i-n)/2+n);return r},i.prototype.diff_commonSuffix=function(t,e){if(!t||!e||t.charAt(t.length-1)!=e.charAt(e.length-1))return 0;for(var n=0,i=Math.min(t.length,e.length),r=i,s=0;n<r;)t.substring(t.length-r,t.length-s)==e.substring(e.length-r,e.length-s)?s=n=r:i=r,r=Math.floor((i-n)/2+n);return r},i.prototype.diff_commonOverlap_=function(t,e){var n=t.length,i=e.length;if(0==n||0==i)return 0;n>i?t=t.substring(n-i):n<i&&(e=e.substring(0,n));var r=Math.min(n,i);if(t==e)return r;for(var s=0,o=1;;){var a=t.substring(r-o),f=e.indexOf(a);if(-1==f)return s;o+=f,0!=f&&t.substring(r-o)!=e.substring(0,o)||(s=o,o++)}},i.prototype.diff_halfMatch_=function(t,e){if(this.Diff_Timeout<=0)return null;var n=t.length>e.length?t:e,i=t.length>e.length?e:t;if(n.length<4||2*i.length<n.length)return null;var r=this;function s(t,e,n){for(var i,s,o,a,f=t.substring(n,n+Math.floor(t.length/4)),h=-1,l="";-1!=(h=e.indexOf(f,h+1));){var c=r.diff_commonPrefix(t.substring(n),e.substring(h)),g=r.diff_commonSuffix(t.substring(0,n),e.substring(0,h));l.length<g+c&&(l=e.substring(h-g,h)+e.substring(h,h+c),i=t.substring(0,n-g),s=t.substring(n+c),o=e.substring(0,h-g),a=e.substring(h+c))}return 2*l.length>=t.length?[i,s,o,a,l]:null}var o,a,f,h,l,c=s(n,i,Math.ceil(n.length/4)),g=s(n,i,Math.ceil(n.length/2));return c||g?(o=g?c&&c[4].length>g[4].length?c:g:c,t.length>e.length?(a=o[0],f=o[1],h=o[2],l=o[3]):(h=o[0],l=o[1],a=o[2],f=o[3]),[a,f,h,l,o[4]]):null},i.prototype.diff_cleanupSemantic=function(t){for(var e=!1,n=[],s=0,o=null,a=0,f=0,h=0,l=0,c=0;a<t.length;)0==t[a][0]?(n[s++]=a,f=l,h=c,l=0,c=0,o=t[a][1]):(1==t[a][0]?l+=t[a][1].length:c+=t[a][1].length,o&&o.length<=Math.max(f,h)&&o.length<=Math.max(l,c)&&(t.splice(n[s-1],0,new i.Diff(r,o)),t[n[s-1]+1][0]=1,s--,a=--s>0?n[s-1]:-1,f=0,h=0,l=0,c=0,o=null,e=!0)),a++;for(e&&this.diff_cleanupMerge(t),this.diff_cleanupSemanticLossless(t),a=1;a<t.length;){if(t[a-1][0]==r&&1==t[a][0]){var g=t[a-1][1],u=t[a][1],d=this.diff_commonOverlap_(g,u),p=this.diff_commonOverlap_(u,g);d>=p?(d>=g.length/2||d>=u.length/2)&&(t.splice(a,0,new i.Diff(0,u.substring(0,d))),t[a-1][1]=g.substring(0,g.length-d),t[a+1][1]=u.substring(d),a++):(p>=g.length/2||p>=u.length/2)&&(t.splice(a,0,new i.Diff(0,g.substring(0,p))),t[a-1][0]=1,t[a-1][1]=u.substring(0,u.length-p),t[a+1][0]=r,t[a+1][1]=g.substring(p),a++),a++}a++}},i.prototype.diff_cleanupSemanticLossless=function(t){function e(t,e){if(!t||!e)return 6;var n=t.charAt(t.length-1),r=e.charAt(0),s=n.match(i.nonAlphaNumericRegex_),o=r.match(i.nonAlphaNumericRegex_),a=s&&n.match(i.whitespaceRegex_),f=o&&r.match(i.whitespaceRegex_),h=a&&n.match(i.linebreakRegex_),l=f&&r.match(i.linebreakRegex_),c=h&&t.match(i.blanklineEndRegex_),g=l&&e.match(i.blanklineStartRegex_);return c||g?5:h||l?4:s&&!a&&f?3:a||f?2:s||o?1:0}for(var n=1;n<t.length-1;){if(0==t[n-1][0]&&0==t[n+1][0]){var r=t[n-1][1],s=t[n][1],o=t[n+1][1],a=this.diff_commonSuffix(r,s);if(a){var f=s.substring(s.length-a);r=r.substring(0,r.length-a),s=f+s.substring(0,s.length-a),o=f+o}for(var h=r,l=s,c=o,g=e(r,s)+e(s,o);s.charAt(0)===o.charAt(0);){r+=s.charAt(0),s=s.substring(1)+o.charAt(0),o=o.substring(1);var u=e(r,s)+e(s,o);u>=g&&(g=u,h=r,l=s,c=o)}t[n-1][1]!=h&&(h?t[n-1][1]=h:(t.splice(n-1,1),n--),t[n][1]=l,c?t[n+1][1]=c:(t.splice(n+1,1),n--))}n++}},i.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,i.whitespaceRegex_=/\s/,i.linebreakRegex_=/[\r\n]/,i.blanklineEndRegex_=/\n\r?\n$/,i.blanklineStartRegex_=/^\r?\n\r?\n/,i.prototype.diff_cleanupEfficiency=function(t){for(var e=!1,n=[],s=0,o=null,a=0,f=!1,h=!1,l=!1,c=!1;a<t.length;)0==t[a][0]?(t[a][1].length<this.Diff_EditCost&&(l||c)?(n[s++]=a,f=l,h=c,o=t[a][1]):(s=0,o=null),l=c=!1):(t[a][0]==r?c=!0:l=!0,o&&(f&&h&&l&&c||o.length<this.Diff_EditCost/2&&f+h+l+c==3)&&(t.splice(n[s-1],0,new i.Diff(r,o)),t[n[s-1]+1][0]=1,s--,o=null,f&&h?(l=c=!0,s=0):(a=--s>0?n[s-1]:-1,l=c=!1),e=!0)),a++;e&&this.diff_cleanupMerge(t)},i.prototype.diff_cleanupMerge=function(t){t.push(new i.Diff(0,""));for(var e,n=0,s=0,o=0,a="",f="";n<t.length;)switch(t[n][0]){case 1:o++,f+=t[n][1],n++;break;case r:s++,a+=t[n][1],n++;break;case 0:s+o>1?(0!==s&&0!==o&&(0!==(e=this.diff_commonPrefix(f,a))&&(n-s-o>0&&0==t[n-s-o-1][0]?t[n-s-o-1][1]+=f.substring(0,e):(t.splice(0,0,new i.Diff(0,f.substring(0,e))),n++),f=f.substring(e),a=a.substring(e)),0!==(e=this.diff_commonSuffix(f,a))&&(t[n][1]=f.substring(f.length-e)+t[n][1],f=f.substring(0,f.length-e),a=a.substring(0,a.length-e))),n-=s+o,t.splice(n,s+o),a.length&&(t.splice(n,0,new i.Diff(r,a)),n++),f.length&&(t.splice(n,0,new i.Diff(1,f)),n++),n++):0!==n&&0==t[n-1][0]?(t[n-1][1]+=t[n][1],t.splice(n,1)):n++,o=0,s=0,a="",f=""}""===t[t.length-1][1]&&t.pop();var h=!1;for(n=1;n<t.length-1;)0==t[n-1][0]&&0==t[n+1][0]&&(t[n][1].substring(t[n][1].length-t[n-1][1].length)==t[n-1][1]?(t[n][1]=t[n-1][1]+t[n][1].substring(0,t[n][1].length-t[n-1][1].length),t[n+1][1]=t[n-1][1]+t[n+1][1],t.splice(n-1,1),h=!0):t[n][1].substring(0,t[n+1][1].length)==t[n+1][1]&&(t[n-1][1]+=t[n+1][1],t[n][1]=t[n][1].substring(t[n+1][1].length)+t[n+1][1],t.splice(n+1,1),h=!0)),n++;h&&this.diff_cleanupMerge(t)},i.prototype.diff_xIndex=function(t,e){var n,i=0,s=0,o=0,a=0;for(n=0;n<t.length&&(1!==t[n][0]&&(i+=t[n][1].length),t[n][0]!==r&&(s+=t[n][1].length),!(i>e));n++)o=i,a=s;return t.length!=n&&t[n][0]===r?a:a+(e-o)},i.prototype.diff_prettyHtml=function(t){for(var e=[],n=/&/g,i=/</g,s=/>/g,o=/\n/g,a=0;a<t.length;a++){var f=t[a][0],h=t[a][1].replace(n,"&").replace(i,"<").replace(s,">").replace(o,"¶<br>");switch(f){case 1:e[a]='<ins style="background:#e6ffe6;">'+h+"</ins>";break;case r:e[a]='<del style="background:#ffe6e6;">'+h+"</del>";break;case 0:e[a]="<span>"+h+"</span>"}}return e.join("")},i.prototype.diff_text1=function(t){for(var e=[],n=0;n<t.length;n++)1!==t[n][0]&&(e[n]=t[n][1]);return e.join("")},i.prototype.diff_text2=function(t){for(var e=[],n=0;n<t.length;n++)t[n][0]!==r&&(e[n]=t[n][1]);return e.join("")},i.prototype.diff_levenshtein=function(t){for(var e=0,n=0,i=0,s=0;s<t.length;s++){var o=t[s][0],a=t[s][1];switch(o){case 1:n+=a.length;break;case r:i+=a.length;break;case 0:e+=Math.max(n,i),n=0,i=0}}return e+Math.max(n,i)},i.prototype.diff_toDelta=function(t){for(var e=[],n=0;n<t.length;n++)switch(t[n][0]){case 1:e[n]="+"+encodeURI(t[n][1]);break;case r:e[n]="-"+t[n][1].length;break;case 0:e[n]="="+t[n][1].length}return e.join("\t").replace(/%20/g," ")},i.prototype.diff_fromDelta=function(t,e){for(var n=[],s=0,o=0,a=e.split(/\t/g),f=0;f<a.length;f++){var h=a[f].substring(1);switch(a[f].charAt(0)){case"+":try{n[s++]=new i.Diff(1,decodeURI(h))}catch(t){throw new Error("Illegal escape in diff_fromDelta: "+h)}break;case"-":case"=":var l=parseInt(h,10);if(isNaN(l)||l<0)throw new Error("Invalid number in diff_fromDelta: "+h);var c=t.substring(o,o+=l);"="==a[f].charAt(0)?n[s++]=new i.Diff(0,c):n[s++]=new i.Diff(r,c);break;default:if(a[f])throw new Error("Invalid diff operation in diff_fromDelta: "+a[f])}}if(o!=t.length)throw new Error("Delta length ("+o+") does not equal source text length ("+t.length+").");return n},i.prototype.match_main=function(t,e,n){if(null==t||null==e||null==n)throw new Error("Null input. (match_main)");return n=Math.max(0,Math.min(n,t.length)),t==e?0:t.length?t.substring(n,n+e.length)==e?n:this.match_bitap_(t,e,n):-1},i.prototype.match_bitap_=function(t,e,n){if(e.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var i=this.match_alphabet_(e),r=this;function s(t,i){var s=t/e.length,o=Math.abs(n-i);return r.Match_Distance?s+o/r.Match_Distance:o?1:s}var o=this.Match_Threshold,a=t.indexOf(e,n);-1!=a&&(o=Math.min(s(0,a),o),-1!=(a=t.lastIndexOf(e,n+e.length))&&(o=Math.min(s(0,a),o)));var f,h,l=1<<e.length-1;a=-1;for(var c,g=e.length+t.length,u=0;u<e.length;u++){for(f=0,h=g;f<h;)s(u,n+h)<=o?f=h:g=h,h=Math.floor((g-f)/2+f);g=h;var d=Math.max(1,n-h+1),p=Math.min(n+h,t.length)+e.length,_=Array(p+2);_[p+1]=(1<<u)-1;for(var m=p;m>=d;m--){var v=i[t.charAt(m-1)];if(_[m]=0===u?(_[m+1]<<1|1)&v:(_[m+1]<<1|1)&v|(c[m+1]|c[m])<<1|1|c[m+1],_[m]&l){var b=s(u,m-1);if(b<=o){if(o=b,!((a=m-1)>n))break;d=Math.max(1,2*n-a)}}}if(s(u+1,n)>o)break;c=_}return a},i.prototype.match_alphabet_=function(t){for(var e={},n=0;n<t.length;n++)e[t.charAt(n)]=0;for(n=0;n<t.length;n++)e[t.charAt(n)]|=1<<t.length-n-1;return e},i.prototype.patch_addContext_=function(t,e){if(0!=e.length){if(null===t.start2)throw Error("patch not initialized");for(var n=e.substring(t.start2,t.start2+t.length1),r=0;e.indexOf(n)!=e.lastIndexOf(n)&&n.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)r+=this.Patch_Margin,n=e.substring(t.start2-r,t.start2+t.length1+r);r+=this.Patch_Margin;var s=e.substring(t.start2-r,t.start2);s&&t.diffs.unshift(new i.Diff(0,s));var o=e.substring(t.start2+t.length1,t.start2+t.length1+r);o&&t.diffs.push(new i.Diff(0,o)),t.start1-=s.length,t.start2-=s.length,t.length1+=s.length+o.length,t.length2+=s.length+o.length}},i.prototype.patch_make=function(t,e,n){var s,o;if("string"==typeof t&&"string"==typeof e&&void 0===n)s=t,(o=this.diff_main(s,e,!0)).length>2&&(this.diff_cleanupSemantic(o),this.diff_cleanupEfficiency(o));else if(t&&"object"==typeof t&&void 0===e&&void 0===n)o=t,s=this.diff_text1(o);else if("string"==typeof t&&e&&"object"==typeof e&&void 0===n)s=t,o=e;else{if("string"!=typeof t||"string"!=typeof e||!n||"object"!=typeof n)throw new Error("Unknown call format to patch_make.");s=t,o=n}if(0===o.length)return[];for(var a=[],f=new i.patch_obj,h=0,l=0,c=0,g=s,u=s,d=0;d<o.length;d++){var p=o[d][0],_=o[d][1];switch(h||0===p||(f.start1=l,f.start2=c),p){case 1:f.diffs[h++]=o[d],f.length2+=_.length,u=u.substring(0,c)+_+u.substring(c);break;case r:f.length1+=_.length,f.diffs[h++]=o[d],u=u.substring(0,c)+u.substring(c+_.length);break;case 0:_.length<=2*this.Patch_Margin&&h&&o.length!=d+1?(f.diffs[h++]=o[d],f.length1+=_.length,f.length2+=_.length):_.length>=2*this.Patch_Margin&&h&&(this.patch_addContext_(f,g),a.push(f),f=new i.patch_obj,h=0,g=u,l=c)}1!==p&&(l+=_.length),p!==r&&(c+=_.length)}return h&&(this.patch_addContext_(f,g),a.push(f)),a},i.prototype.patch_deepCopy=function(t){for(var e=[],n=0;n<t.length;n++){var r=t[n],s=new i.patch_obj;s.diffs=[];for(var o=0;o<r.diffs.length;o++)s.diffs[o]=new i.Diff(r.diffs[o][0],r.diffs[o][1]);s.start1=r.start1,s.start2=r.start2,s.length1=r.length1,s.length2=r.length2,e[n]=s}return e},i.prototype.patch_apply=function(t,e){if(0==t.length)return[e,[]];t=this.patch_deepCopy(t);var n=this.patch_addPadding(t);e=n+e+n,this.patch_splitMax(t);for(var i=0,s=[],o=0;o<t.length;o++){var a,f,h=t[o].start2+i,l=this.diff_text1(t[o].diffs),c=-1;if(l.length>this.Match_MaxBits?-1!=(a=this.match_main(e,l.substring(0,this.Match_MaxBits),h))&&(-1==(c=this.match_main(e,l.substring(l.length-this.Match_MaxBits),h+l.length-this.Match_MaxBits))||a>=c)&&(a=-1):a=this.match_main(e,l,h),-1==a)s[o]=!1,i-=t[o].length2-t[o].length1;else if(s[o]=!0,i=a-h,l==(f=-1==c?e.substring(a,a+l.length):e.substring(a,c+this.Match_MaxBits)))e=e.substring(0,a)+this.diff_text2(t[o].diffs)+e.substring(a+l.length);else{var g=this.diff_main(l,f,!1);if(l.length>this.Match_MaxBits&&this.diff_levenshtein(g)/l.length>this.Patch_DeleteThreshold)s[o]=!1;else{this.diff_cleanupSemanticLossless(g);for(var u,d=0,p=0;p<t[o].diffs.length;p++){var _=t[o].diffs[p];0!==_[0]&&(u=this.diff_xIndex(g,d)),1===_[0]?e=e.substring(0,a+u)+_[1]+e.substring(a+u):_[0]===r&&(e=e.substring(0,a+u)+e.substring(a+this.diff_xIndex(g,d+_[1].length))),_[0]!==r&&(d+=_[1].length)}}}}return[e=e.substring(n.length,e.length-n.length),s]},i.prototype.patch_addPadding=function(t){for(var e=this.Patch_Margin,n="",r=1;r<=e;r++)n+=String.fromCharCode(r);for(r=0;r<t.length;r++)t[r].start1+=e,t[r].start2+=e;var s=t[0],o=s.diffs;if(0==o.length||0!=o[0][0])o.unshift(new i.Diff(0,n)),s.start1-=e,s.start2-=e,s.length1+=e,s.length2+=e;else if(e>o[0][1].length){var a=e-o[0][1].length;o[0][1]=n.substring(o[0][1].length)+o[0][1],s.start1-=a,s.start2-=a,s.length1+=a,s.length2+=a}return 0==(o=(s=t[t.length-1]).diffs).length||0!=o[o.length-1][0]?(o.push(new i.Diff(0,n)),s.length1+=e,s.length2+=e):e>o[o.length-1][1].length&&(a=e-o[o.length-1][1].length,o[o.length-1][1]+=n.substring(0,a),s.length1+=a,s.length2+=a),n},i.prototype.patch_splitMax=function(t){for(var e=this.Match_MaxBits,n=0;n<t.length;n++)if(!(t[n].length1<=e)){var s=t[n];t.splice(n--,1);for(var o=s.start1,a=s.start2,f="";0!==s.diffs.length;){var h=new i.patch_obj,l=!0;for(h.start1=o-f.length,h.start2=a-f.length,""!==f&&(h.length1=h.length2=f.length,h.diffs.push(new i.Diff(0,f)));0!==s.diffs.length&&h.length1<e-this.Patch_Margin;){var c=s.diffs[0][0],g=s.diffs[0][1];1===c?(h.length2+=g.length,a+=g.length,h.diffs.push(s.diffs.shift()),l=!1):c===r&&1==h.diffs.length&&0==h.diffs[0][0]&&g.length>2*e?(h.length1+=g.length,o+=g.length,l=!1,h.diffs.push(new i.Diff(c,g)),s.diffs.shift()):(g=g.substring(0,e-h.length1-this.Patch_Margin),h.length1+=g.length,o+=g.length,0===c?(h.length2+=g.length,a+=g.length):l=!1,h.diffs.push(new i.Diff(c,g)),g==s.diffs[0][1]?s.diffs.shift():s.diffs[0][1]=s.diffs[0][1].substring(g.length))}f=(f=this.diff_text2(h.diffs)).substring(f.length-this.Patch_Margin);var u=this.diff_text1(s.diffs).substring(0,this.Patch_Margin);""!==u&&(h.length1+=u.length,h.length2+=u.length,0!==h.diffs.length&&0===h.diffs[h.diffs.length-1][0]?h.diffs[h.diffs.length-1][1]+=u:h.diffs.push(new i.Diff(0,u))),l||t.splice(++n,0,h)}}},i.prototype.patch_toText=function(t){for(var e=[],n=0;n<t.length;n++)e[n]=t[n];return e.join("")},i.prototype.patch_fromText=function(t){var e=[];if(!t)return e;for(var n=t.split("\n"),s=0,o=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;s<n.length;){var a=n[s].match(o);if(!a)throw new Error("Invalid patch string: "+n[s]);var f=new i.patch_obj;for(e.push(f),f.start1=parseInt(a[1],10),""===a[2]?(f.start1--,f.length1=1):"0"==a[2]?f.length1=0:(f.start1--,f.length1=parseInt(a[2],10)),f.start2=parseInt(a[3],10),""===a[4]?(f.start2--,f.length2=1):"0"==a[4]?f.length2=0:(f.start2--,f.length2=parseInt(a[4],10)),s++;s<n.length;){var h=n[s].charAt(0);try{var l=decodeURI(n[s].substring(1))}catch(t){throw new Error("Illegal escape in patch_fromText: "+l)}if("-"==h)f.diffs.push(new i.Diff(r,l));else if("+"==h)f.diffs.push(new i.Diff(1,l));else if(" "==h)f.diffs.push(new i.Diff(0,l));else{if("@"==h)break;if(""!==h)throw new Error('Invalid patch mode "'+h+'" in: '+l)}s++}}return e},(i.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0}).prototype.toString=function(){for(var t,e=["@@ -"+(0===this.length1?this.start1+",0":1==this.length1?this.start1+1:this.start1+1+","+this.length1)+" +"+(0===this.length2?this.start2+",0":1==this.length2?this.start2+1:this.start2+1+","+this.length2)+" @@\n"],n=0;n<this.diffs.length;n++){switch(this.diffs[n][0]){case 1:t="+";break;case r:t="-";break;case 0:t=" "}e[n+1]=t+encodeURI(this.diffs[n][1])+"\n"}return e.join("").replace(/%20/g," ")},e.exports=i,e.exports.diff_match_patch=i,e.exports.DIFF_DELETE=r,e.exports.DIFF_INSERT=1,e.exports.DIFF_EQUAL=0},{}],iSlp:[function(t,e,n){function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t){return t&&"object"===i(t)&&!Array.isArray(t)&&null!==t}e.exports=function t(e,n){return r(e)&&r(n)&&Object.keys(n).forEach((function(i){r(n[i])?(e[i]&&r(e[i])||(e[i]=n[i]),t(e[i],n[i])):Object.assign(e,function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}({},i,n[i]))})),e}},{}],Os6R:[function(t,e,n){e.exports=function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=null,s=!0;return function(){for(var o=arguments.length,a=new Array(o),f=0;f<o;f++)a[f]=arguments[f];var h=function(){t.apply(n,a),r=null};i&&s&&(s=!1,h()),r||(r=setTimeout(h,e))}}},{}],gTec:[function(t,e,n){e.exports=function(t,e){var n,i=this;return function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];var a=i;clearTimeout(n),n=setTimeout((function(){return t.apply(a,s)}),e)}}},{}],xRfK:[function(t,e,n){e.exports=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/\r\n/g,"\n")}},{}],j8WE:[function(t,e,n){e.exports=function(t,e,n,i){var r=t+(n-t)/2;return"M ".concat(t," ").concat(e," C ").concat(r,",").concat(e," ").concat(r,",").concat(i," ").concat(n,",").concat(i)}},{}],iJA9:[function(t,e,n){e.exports={DIFF_EQUAL:0,DIFF_DELETE:-1,DIFF_INSERT:1,EDITOR_RIGHT:"right",EDITOR_LEFT:"left",RTL:"rtl",LTR:"ltr",SVG_NS:"http://www.w3.org/2000/svg",DIFF_GRANULARITY_SPECIFIC:"specific",DIFF_GRANULARITY_BROAD:"broad"}},{}],gWhB:[function(t,e,n){var i=t("../constants");e.exports=function(t,e){var n=t.options.mode;return e===i.EDITOR_LEFT&&null!==t.options.left.mode&&(n=t.options.left.mode),e===i.EDITOR_RIGHT&&null!==t.options.right.mode&&(n=t.options.right.mode),n}},{"../constants":"iJA9"}],IRlp:[function(t,e,n){var i=t("../constants");e.exports=function(t,e){var n=t.options.theme;return e===i.EDITOR_LEFT&&null!==t.options.left.theme&&(n=t.options.left.theme),e===i.EDITOR_RIGHT&&null!==t.options.right.theme&&(n=t.options.right.theme),n}},{"../constants":"iJA9"}],L8P8:[function(t,e,n){e.exports=function(t,e){return t.ace.getSession().doc.getLine(e)}},{}],gpkQ:[function(t,e,n){e.exports=function(t){return document.getElementById(t.options.left.id).offsetHeight}},{}],QEUm:[function(t,e,n){e.exports=function(t){var e=document.createElement("div"),n={class:t.className,style:"top:".concat(t.topOffset,"px"),title:t.tooltip,"data-diff-index":t.diffIndex};for(var i in n)e.setAttribute(i,n[i]);return e.innerHTML=t.arrowContent,e}},{}],f1Db:[function(t,e,n){e.exports=function(t,e){var n=Math.random().toString(36).substr(2,5),i="js-".concat(e,"-").concat(n),r=t.querySelector(".".concat(e));if(r)return r.id=r.id||i,r.id;var s=document.createElement("div");return t.appendChild(s),s.className=e,s.id=i,s.id}},{}],FPMV:[function(t,e,n){e.exports={on:function(t,e,n,i){var r="document"===t?document:document.querySelector(t);r.addEventListener(e,(function(t){for(var e=r.querySelectorAll(n),s=t.target,o=0,a=e.length;o<a;o+=1)for(var f=s,h=e[o];f&&f!==r;)f===h&&i.call(h,t),f=f.parentNode}))}}},{}],Focm:[function(t,e,n){var i,r=t("diff-match-patch"),s=t("./helpers/merge"),o=t("./helpers/throttle"),a=t("./helpers/debounce"),f=t("./helpers/normalizeContent"),h=t("./visuals/getCurve"),l=t("./visuals/getMode"),c=t("./visuals/getTheme"),g=t("./visuals/getLine"),u=t("./visuals/getEditorHeight"),d=t("./visuals/createArrow"),p=t("./dom/ensureElement"),_=t("./dom/query"),m=t("./constants");function v(t){if(t.Range)return t.Range;var e=t.acequire||t.require;return!!e&&e("ace/range")}function b(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!(this instanceof b))return new b(t);var e=this;e.options=s({ace:window?window.ace:void 0,mode:null,theme:null,element:null,diffGranularity:m.DIFF_GRANULARITY_BROAD,lockScrolling:!1,showDiffs:!0,showConnectors:!0,maxDiffs:5e3,left:{id:null,content:null,mode:null,theme:null,editable:!0,copyLinkEnabled:!0},right:{id:null,content:null,mode:null,theme:null,editable:!0,copyLinkEnabled:!0},classes:{gutterID:"acediff__gutter",diff:"acediff__diffLine",connector:"acediff__connector",newCodeConnectorLink:"acediff__newCodeConnector",newCodeConnectorLinkContent:"→",deletedCodeConnectorLink:"acediff__deletedCodeConnector",deletedCodeConnectorLinkContent:"←",copyRightContainer:"acediff__copy--right",copyLeftContainer:"acediff__copy--left"},connectorYOffset:0},t);var n=e.options.ace;if(!n){var r="No ace editor found nor supplied - `options.ace` or `window.ace` is missing";return console.error(r),new Error(r)}if(!(i=v(n))){var o="Could not require Range module for Ace. Depends on your bundling strategy, but it usually comes with Ace itself. See https://ace.c9.io/api/range.html, open an issue on GitHub ace-diff/ace-diff";return console.error(o),new Error(o)}if(null===e.options.element){var a="You need to specify an element for Ace-diff - `options.element` is missing";return console.error(a),new Error(a)}if(e.options.element instanceof HTMLElement?e.el=e.options.element:e.el=document.body.querySelector(e.options.element),!e.el){var h="Can't find the specified element ".concat(e.options.element);return console.error(h),new Error(h)}e.options.left.id=p(e.el,"acediff__left"),e.options.classes.gutterID=p(e.el,"acediff__gutter"),e.options.right.id=p(e.el,"acediff__right"),e.el.innerHTML='<div class="acediff__wrap">'.concat(e.el.innerHTML,"</div>"),e.editors={left:{ace:n.edit(e.options.left.id),markers:[],lineLengths:[]},right:{ace:n.edit(e.options.right.id),markers:[],lineLengths:[]},editorHeight:null},e.editors.left.ace.getSession().setMode(l(e,m.EDITOR_LEFT)),e.editors.right.ace.getSession().setMode(l(e,m.EDITOR_RIGHT)),e.editors.left.ace.setReadOnly(!e.options.left.editable),e.editors.right.ace.setReadOnly(!e.options.right.editable),e.editors.left.ace.setTheme(c(e,m.EDITOR_LEFT)),e.editors.right.ace.setTheme(c(e,m.EDITOR_RIGHT)),e.editors.left.ace.setValue(f(e.options.left.content),-1),e.editors.right.ace.setValue(f(e.options.right.content),-1),e.editors.editorHeight=u(e),setTimeout((function(){e.lineHeight=e.editors.left.ace.renderer.lineHeight,y(e),O(e),A(e),e.diff()}),1)}b.prototype={setOptions:function(t){s(this.options,t),this.diff()},getNumDiffs:function(){return this.diffs.length},getEditors:function(){return{left:this.editors.left.ace,right:this.editors.right.ace}},diff:function(){var t=this,e=new r,n=this.editors.left.ace.getSession().getValue(),i=this.editors.right.ace.getSession().getValue(),s=e.diff_main(i,n);e.diff_cleanupSemantic(s),this.editors.left.lineLengths=w(this.editors.left),this.editors.right.lineLengths=w(this.editors.right);var o=[],a={left:0,right:0};s.forEach((function(e,n,i){var r=e[0],f=e[1];i[n+1]&&f.endsWith("\n")&&i[n+1][1].startsWith("\n")&&(f+="\n",s[n][1]=f,s[n+1][1]=s[n+1][1].replace(/^\n/,"")),0!==f.length&&(r===m.DIFF_EQUAL?(a.left+=f.length,a.right+=f.length):r===m.DIFF_DELETE?(o.push(C(t,m.DIFF_DELETE,a.left,a.right,f)),a.right+=f.length):r===m.DIFF_INSERT&&(o.push(C(t,m.DIFF_INSERT,a.left,a.right,f)),a.left+=f.length))}),this),this.diffs=function(t,e){var n=[];function i(e){return t.options.diffGranularity===m.DIFF_GRANULARITY_SPECIFIC?e<1:e<=1}e.forEach((function(t,e){if(0!==e){for(var r=!1,s=0;s<n.length;s+=1)if(i(Math.abs(t.leftStartLine-n[s].leftEndLine))&&i(Math.abs(t.rightStartLine-n[s].rightEndLine))){n[s].leftStartLine=Math.min(t.leftStartLine,n[s].leftStartLine),n[s].rightStartLine=Math.min(t.rightStartLine,n[s].rightStartLine),n[s].leftEndLine=Math.max(t.leftEndLine,n[s].leftEndLine),n[s].rightEndLine=Math.max(t.rightEndLine,n[s].rightEndLine),r=!0;break}r||n.push(t)}else n.push(t)}));var r=[];return n.forEach((function(t){t.leftStartLine===t.leftEndLine&&t.rightStartLine===t.rightEndLine||r.push(t)})),r}(this,o),this.diffs.length>this.options.maxDiffs||(S(this),F(this))},destroy:function(){var t=this.editors.left.ace.getValue();this.editors.left.ace.destroy();var e=this.editors.left.ace.container,n=e.cloneNode(!1);n.textContent=t,e.parentNode.replaceChild(n,e);var i=this.editors.right.ace.getValue();this.editors.right.ace.destroy(),(n=(e=this.editors.right.ace.container).cloneNode(!1)).textContent=i,e.parentNode.replaceChild(n,e),document.getElementById(this.options.classes.gutterID).innerHTML="",L()}};var L=function(){};function y(t){t.editors.left.ace.getSession().on("changeScrollTop",o((function(){x(t)}),16)),t.editors.right.ace.getSession().on("changeScrollTop",o((function(){x(t)}),16));var e=t.diff.bind(t);t.editors.left.ace.on("change",e),t.editors.right.ace.on("change",e),t.options.left.copyLinkEnabled&&_.on("#".concat(t.options.classes.gutterID),"click",".".concat(t.options.classes.newCodeConnectorLink),(function(e){E(t,e,m.LTR)})),t.options.right.copyLinkEnabled&&_.on("#".concat(t.options.classes.gutterID),"click",".".concat(t.options.classes.deletedCodeConnectorLink),(function(e){E(t,e,m.RTL)}));var n=a((function(){t.editors.availableHeight=document.getElementById(t.options.left.id).offsetHeight,t.diff()}),250);window.addEventListener("resize",n),L=function(){window.removeEventListener("resize",n)}}function E(t,e,n){var r,s,o,a,f,h,l=parseInt(e.target.getAttribute("data-diff-index"),10),c=t.diffs[l];n===m.LTR?(r=t.editors.left,s=t.editors.right,o=c.leftStartLine,a=c.leftEndLine,f=c.rightStartLine,h=c.rightEndLine):(r=t.editors.right,s=t.editors.left,o=c.rightStartLine,a=c.rightEndLine,f=c.leftStartLine,h=c.leftEndLine);for(var u="",d=o;d<a;d+=1)u+="".concat(g(r,d),"\n");var p=s.ace.getSession().getScrollTop();s.ace.getSession().replace(new i(f,0,h,0),u),s.ace.getSession().setScrollTop(parseInt(p,10)),t.diff()}function w(t){var e=t.ace.getSession().doc.getAllLines(),n=[];return e.forEach((function(t){n.push(t.length+1)})),n}function D(t,e,n,r,s){var o=t.editors[e];r<n&&(r=n);var a="".concat(s," ").concat(r>n?"lines":"targetOnly");o.markers.push(o.ace.session.addMarker(new i(n,0,r-1,1),a,"fullLine"))}function x(t){S(t),F(t),function(t){var e=t.editors.left.ace.getSession().getScrollTop(),n=t.editors.right.ace.getSession().getScrollTop();t.copyRightContainer.style.cssText="top: ".concat(-e,"px"),t.copyLeftContainer.style.cssText="top: ".concat(-n,"px")}(t)}function S(t){t.editors.left.markers.forEach((function(e){t.editors.left.ace.getSession().removeMarker(e)}),t),t.editors.right.markers.forEach((function(e){t.editors.right.ace.getSession().removeMarker(e)}),t)}function C(t,e,n,i,r){var s={},o=/^\n/.test(r);if(e===m.DIFF_INSERT){var a=M(t.editors.left,n,r),f=T(t.editors.right,i),h=I(t.editors.right,f),l=I(t.editors.left,a.startLine),c=f;0===I(t.editors.left,a.startLine)&&o&&(o=!1),0===a.startChar&&R(t.editors.right,i,o)&&(c=f+1);var g=a.startLine===a.endLine,u=0;(a.startChar>0||g&&r.length<l)&&h>0&&a.startChar<l&&u++,s={leftStartLine:a.startLine,leftEndLine:a.endLine+1,rightStartLine:c,rightEndLine:c+u}}else{a=M(t.editors.right,i,r),f=T(t.editors.left,n),h=I(t.editors.left,f);var d=I(t.editors.right,a.startLine),p=f;0===I(t.editors.right,a.startLine)&&o&&(o=!1),0===a.startChar&&R(t.editors.left,n,o)&&(p=f+1),g=a.startLine===a.endLine,u=0,(a.startChar>0||g&&r.length<d)&&h>0&&a.startChar<d&&u++,s={leftStartLine:p,leftEndLine:p+u,rightStartLine:a.startLine,rightEndLine:a.endLine+1}}return s}function M(t,e,n){var i={startLine:0,startChar:0,endLine:0,endChar:0},r=e+n.length,s=0,o=!1,a=!1;t.lineLengths.forEach((function(t,n){s+=t,!o&&e<s&&(i.startLine=n,i.startChar=e-s+t,o=!0),!a&&r<=s&&(i.endLine=n,i.endChar=r-s+t,a=!0)})),i.startChar>0&&I(t,i.startLine)===i.startChar&&(i.startLine++,i.startChar=0),0===i.endChar&&i.endLine--;var f=/\n$/.test(n);return i.startChar>0&&f&&i.endLine++,i}function I(t,e){return g(t,e).length}function T(t,e){for(var n=t.ace.getSession().doc.getAllLines(),i=0,r=0,s=0;s<n.length;s+=1)if(e<=(r+=n[s].length+1)){i=s;break}return i}function R(t,e,n){for(var i=t.ace.getSession().doc.getAllLines(),r=0,s=0;s<i.length;s+=1){var o=r+=i[s].length+1;if(n&&(o-=1),e===o)break}return R}function A(t){t.gutterHeight=document.getElementById(t.options.classes.gutterID).clientHeight,t.gutterWidth=document.getElementById(t.options.classes.gutterID).clientWidth;var e=k(t,m.EDITOR_LEFT),n=k(t,m.EDITOR_RIGHT),i=Math.max(e,n,t.gutterHeight);t.gutterSVG=document.createElementNS(m.SVG_NS,"svg"),t.gutterSVG.setAttribute("width",t.gutterWidth),t.gutterSVG.setAttribute("height",i),document.getElementById(t.options.classes.gutterID).appendChild(t.gutterSVG)}function k(t,e){return(e===m.EDITOR_LEFT?t.editors.left:t.editors.right).ace.getSession().getLength()*t.lineHeight}function O(t){t.copyRightContainer=document.createElement("div"),t.copyRightContainer.setAttribute("class",t.options.classes.copyRightContainer),t.copyLeftContainer=document.createElement("div"),t.copyLeftContainer.setAttribute("class",t.options.classes.copyLeftContainer),document.getElementById(t.options.classes.gutterID).appendChild(t.copyRightContainer),document.getElementById(t.options.classes.gutterID).appendChild(t.copyLeftContainer)}function F(t){(function(t){document.getElementById(t.options.classes.gutterID).removeChild(t.gutterSVG),A(t)})(t),function(t){t.copyLeftContainer.innerHTML="",t.copyRightContainer.innerHTML=""}(t),t.diffs.forEach((function(e,n){t.options.showDiffs&&(D(t,m.EDITOR_LEFT,e.leftStartLine,e.leftEndLine,t.options.classes.diff),D(t,m.EDITOR_RIGHT,e.rightStartLine,e.rightEndLine,t.options.classes.diff),t.options.showConnectors&&function(t,e,n,i,r){var s=t.editors.left.ace.getSession().getScrollTop(),o=t.editors.right.ace.getSession().getScrollTop();t.connectorYOffset=1;var a=e*t.lineHeight-s+.5,f=t.gutterWidth+1,l=i*t.lineHeight-o+.5,c=n*t.lineHeight-s+t.connectorYOffset+.5,g=t.gutterWidth+1,u=r*t.lineHeight-o+t.connectorYOffset+.5,d=h(-1,a,f,l),p=h(g,u,-1,c),_="L".concat(f,",").concat(l," ").concat(g,",").concat(u),v="L".concat(-1,",").concat(c," ").concat(-1,",").concat(a),b="".concat(d," ").concat(_," ").concat(p," ").concat(v),L=document.createElementNS(m.SVG_NS,"path");L.setAttribute("d",b),L.setAttribute("class",t.options.classes.connector),t.gutterSVG.appendChild(L)}(t,e.leftStartLine,e.leftEndLine,e.rightStartLine,e.rightEndLine),function(t,e,n){if(e.leftEndLine>e.leftStartLine&&t.options.left.copyLinkEnabled){var i=d({className:t.options.classes.newCodeConnectorLink,topOffset:e.leftStartLine*t.lineHeight,tooltip:"Copy to right",diffIndex:n,arrowContent:t.options.classes.newCodeConnectorLinkContent});t.copyRightContainer.appendChild(i)}if(e.rightEndLine>e.rightStartLine&&t.options.right.copyLinkEnabled){var r=d({className:t.options.classes.deletedCodeConnectorLink,topOffset:e.rightStartLine*t.lineHeight,tooltip:"Copy to left",diffIndex:n,arrowContent:t.options.classes.deletedCodeConnectorLinkContent});t.copyLeftContainer.appendChild(r)}}(t,e,n))}),t)}e.exports=b},{"diff-match-patch":"k8CM","./helpers/merge":"iSlp","./helpers/throttle":"Os6R","./helpers/debounce":"gTec","./helpers/normalizeContent":"xRfK","./visuals/getCurve":"j8WE","./visuals/getMode":"gWhB","./visuals/getTheme":"IRlp","./visuals/getLine":"L8P8","./visuals/getEditorHeight":"gpkQ","./visuals/createArrow":"QEUm","./dom/ensureElement":"f1Db","./dom/query":"FPMV","./constants":"iJA9"}]},{},["Focm"]); |