@xyne/xyne-cli-linux-x64 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/node_modules/@opentui/core/node_modules/diff/CONTRIBUTING.md +28 -0
  2. package/node_modules/@opentui/core/node_modules/diff/LICENSE +29 -0
  3. package/node_modules/@opentui/core/node_modules/diff/README.md +378 -0
  4. package/node_modules/@opentui/core/node_modules/diff/dist/diff.js +1674 -0
  5. package/node_modules/@opentui/core/node_modules/diff/dist/diff.min.js +1 -0
  6. package/node_modules/@opentui/core/node_modules/diff/eslint.config.mjs +182 -0
  7. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.d.ts +8 -0
  8. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.d.ts.map +1 -0
  9. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.js +24 -0
  10. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.d.ts +6 -0
  11. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.d.ts.map +1 -0
  12. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.js +34 -0
  13. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.d.ts +19 -0
  14. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.d.ts.map +1 -0
  15. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.js +40 -0
  16. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.d.ts +20 -0
  17. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.d.ts.map +1 -0
  18. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.js +265 -0
  19. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.d.ts +19 -0
  20. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.d.ts.map +1 -0
  21. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.js +31 -0
  22. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.d.ts +18 -0
  23. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.d.ts.map +1 -0
  24. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.js +34 -0
  25. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.d.ts +24 -0
  26. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.d.ts.map +1 -0
  27. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.js +105 -0
  28. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.d.ts +24 -0
  29. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.d.ts.map +1 -0
  30. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.js +89 -0
  31. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.d.ts +21 -0
  32. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.d.ts.map +1 -0
  33. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.js +67 -0
  34. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.d.ts +35 -0
  35. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.d.ts.map +1 -0
  36. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.js +307 -0
  37. package/node_modules/@opentui/core/node_modules/diff/libcjs/index.d.ts +20 -0
  38. package/node_modules/@opentui/core/node_modules/diff/libcjs/index.d.ts.map +1 -0
  39. package/node_modules/@opentui/core/node_modules/diff/libcjs/index.js +61 -0
  40. package/node_modules/@opentui/core/node_modules/diff/libcjs/package.json +1 -0
  41. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.d.ts +62 -0
  42. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.d.ts.map +1 -0
  43. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.js +267 -0
  44. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.d.ts +100 -0
  45. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.d.ts.map +1 -0
  46. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.js +223 -0
  47. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.d.ts +17 -0
  48. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.d.ts.map +1 -0
  49. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.js +61 -0
  50. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.d.ts +8 -0
  51. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.d.ts.map +1 -0
  52. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.js +133 -0
  53. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.d.ts +9 -0
  54. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.d.ts.map +1 -0
  55. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.js +37 -0
  56. package/node_modules/@opentui/core/node_modules/diff/libcjs/types.d.ts +213 -0
  57. package/node_modules/@opentui/core/node_modules/diff/libcjs/types.d.ts.map +1 -0
  58. package/node_modules/@opentui/core/node_modules/diff/libcjs/types.js +2 -0
  59. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.d.ts +3 -0
  60. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.d.ts.map +1 -0
  61. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.js +21 -0
  62. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.d.ts +2 -0
  63. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.d.ts.map +1 -0
  64. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.js +40 -0
  65. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.d.ts +4 -0
  66. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.d.ts.map +1 -0
  67. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.js +17 -0
  68. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.d.ts +18 -0
  69. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.d.ts.map +1 -0
  70. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.js +141 -0
  71. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.d.ts +8 -0
  72. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.d.ts.map +1 -0
  73. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.js +21 -0
  74. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.d.ts +6 -0
  75. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.d.ts.map +1 -0
  76. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.js +31 -0
  77. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.d.ts +19 -0
  78. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.d.ts.map +1 -0
  79. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.js +16 -0
  80. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.d.ts +20 -0
  81. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.d.ts.map +1 -0
  82. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.js +253 -0
  83. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.d.ts +19 -0
  84. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.d.ts.map +1 -0
  85. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.js +7 -0
  86. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.d.ts +18 -0
  87. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.d.ts.map +1 -0
  88. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.js +10 -0
  89. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.d.ts +24 -0
  90. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.d.ts.map +1 -0
  91. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.js +78 -0
  92. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.d.ts +24 -0
  93. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.d.ts.map +1 -0
  94. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.js +65 -0
  95. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.d.ts +21 -0
  96. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.d.ts.map +1 -0
  97. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.js +43 -0
  98. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.d.ts +35 -0
  99. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.d.ts.map +1 -0
  100. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.js +276 -0
  101. package/node_modules/@opentui/core/node_modules/diff/libesm/index.d.ts +20 -0
  102. package/node_modules/@opentui/core/node_modules/diff/libesm/index.d.ts.map +1 -0
  103. package/node_modules/@opentui/core/node_modules/diff/libesm/index.js +30 -0
  104. package/node_modules/@opentui/core/node_modules/diff/libesm/package.json +1 -0
  105. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.d.ts +62 -0
  106. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.d.ts.map +1 -0
  107. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.js +257 -0
  108. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.d.ts +100 -0
  109. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.d.ts.map +1 -0
  110. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.js +201 -0
  111. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.d.ts +17 -0
  112. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.d.ts.map +1 -0
  113. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.js +44 -0
  114. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.d.ts +8 -0
  115. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.d.ts.map +1 -0
  116. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.js +130 -0
  117. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.d.ts +9 -0
  118. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.d.ts.map +1 -0
  119. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.js +23 -0
  120. package/node_modules/@opentui/core/node_modules/diff/libesm/types.d.ts +213 -0
  121. package/node_modules/@opentui/core/node_modules/diff/libesm/types.d.ts.map +1 -0
  122. package/node_modules/@opentui/core/node_modules/diff/libesm/types.js +1 -0
  123. package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.d.ts +3 -0
  124. package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.d.ts.map +1 -0
  125. package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.js +17 -0
  126. package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.d.ts +2 -0
  127. package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.d.ts.map +1 -0
  128. package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.js +37 -0
  129. package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.d.ts +4 -0
  130. package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.d.ts.map +1 -0
  131. package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.js +14 -0
  132. package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.d.ts +18 -0
  133. package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.d.ts.map +1 -0
  134. package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.js +128 -0
  135. package/node_modules/@opentui/core/node_modules/diff/package.json +131 -0
  136. package/node_modules/@opentui/core/node_modules/diff/release-notes.md +397 -0
  137. package/node_modules/@opentui/core/node_modules/marked/LICENSE.md +44 -0
  138. package/node_modules/@opentui/core/node_modules/marked/README.md +107 -0
  139. package/node_modules/@opentui/core/node_modules/marked/bin/main.js +283 -0
  140. package/node_modules/@opentui/core/node_modules/marked/bin/marked.js +16 -0
  141. package/node_modules/@opentui/core/node_modules/marked/lib/marked.d.ts +756 -0
  142. package/node_modules/@opentui/core/node_modules/marked/lib/marked.esm.js +72 -0
  143. package/node_modules/@opentui/core/node_modules/marked/lib/marked.esm.js.map +7 -0
  144. package/node_modules/@opentui/core/node_modules/marked/lib/marked.umd.js +74 -0
  145. package/node_modules/@opentui/core/node_modules/marked/lib/marked.umd.js.map +7 -0
  146. package/node_modules/@opentui/core/node_modules/marked/man/marked.1 +113 -0
  147. package/node_modules/@opentui/core/node_modules/marked/man/marked.1.md +93 -0
  148. package/node_modules/@opentui/core/node_modules/marked/package.json +103 -0
  149. package/package.json +1 -1
  150. package/xyne-linux-x64 +0 -0
@@ -0,0 +1 @@
1
+ ((global,factory)=>{"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory((global="undefined"!=typeof globalThis?globalThis:global||self).Diff={})})(this,function(exports){class Diff{diff(oldStr,newStr,options={}){let callback;"function"==typeof options?(callback=options,options={}):"callback"in options&&(callback=options.callback);oldStr=this.castInput(oldStr,options),newStr=this.castInput(newStr,options),oldStr=this.removeEmpty(this.tokenize(oldStr,options)),newStr=this.removeEmpty(this.tokenize(newStr,options));return this.diffWithOptionsObj(oldStr,newStr,options,callback)}diffWithOptionsObj(oldTokens,newTokens,options,callback){let _a,done=value=>{if(value=this.postProcess(value,options),!callback)return value;setTimeout(function(){callback(value)},0)},newLen=newTokens.length,oldLen=oldTokens.length,editLength=1,maxEditLength=newLen+oldLen;null!=options.maxEditLength&&(maxEditLength=Math.min(maxEditLength,options.maxEditLength));var maxExecutionTime=null!=(_a=options.timeout)?_a:1/0;let abortAfterTimestamp=Date.now()+maxExecutionTime,bestPath=[{oldPos:-1,lastComponent:void 0}],newPos=this.extractCommon(bestPath[0],newTokens,oldTokens,0,options);if(bestPath[0].oldPos+1>=oldLen&&newPos+1>=newLen)return done(this.buildValues(bestPath[0].lastComponent,newTokens,oldTokens));let minDiagonalToConsider=-1/0,maxDiagonalToConsider=1/0,execEditLength=()=>{for(let diagonalPath=Math.max(minDiagonalToConsider,-editLength);diagonalPath<=Math.min(maxDiagonalToConsider,editLength);diagonalPath+=2){let basePath;var removePath=bestPath[diagonalPath-1],addPath=bestPath[diagonalPath+1];removePath&&(bestPath[diagonalPath-1]=void 0);let canAdd=!1;addPath&&(addPathNewPos=addPath.oldPos-diagonalPath,canAdd=addPath&&0<=addPathNewPos&&addPathNewPos<newLen);var addPathNewPos=removePath&&removePath.oldPos+1<oldLen;if(canAdd||addPathNewPos){if(basePath=!addPathNewPos||canAdd&&removePath.oldPos<addPath.oldPos?this.addToPath(addPath,!0,!1,0,options):this.addToPath(removePath,!1,!0,1,options),newPos=this.extractCommon(basePath,newTokens,oldTokens,diagonalPath,options),basePath.oldPos+1>=oldLen&&newPos+1>=newLen)return done(this.buildValues(basePath.lastComponent,newTokens,oldTokens))||!0;(bestPath[diagonalPath]=basePath).oldPos+1>=oldLen&&(maxDiagonalToConsider=Math.min(maxDiagonalToConsider,diagonalPath-1)),newPos+1>=newLen&&(minDiagonalToConsider=Math.max(minDiagonalToConsider,diagonalPath+1))}else bestPath[diagonalPath]=void 0}editLength++};if(callback)!function exec(){setTimeout(function(){if(editLength>maxEditLength||Date.now()>abortAfterTimestamp)return callback(void 0);execEditLength()||exec()},0)}();else for(;editLength<=maxEditLength&&Date.now()<=abortAfterTimestamp;){var ret=execEditLength();if(ret)return ret}}addToPath(path,added,removed,oldPosInc,options){var last=path.lastComponent;return last&&!options.oneChangePerToken&&last.added===added&&last.removed===removed?{oldPos:path.oldPos+oldPosInc,lastComponent:{count:last.count+1,added:added,removed:removed,previousComponent:last.previousComponent}}:{oldPos:path.oldPos+oldPosInc,lastComponent:{count:1,added:added,removed:removed,previousComponent:last}}}extractCommon(basePath,newTokens,oldTokens,diagonalPath,options){var newLen=newTokens.length,oldLen=oldTokens.length;let oldPos=basePath.oldPos,newPos=oldPos-diagonalPath,commonCount=0;for(;newPos+1<newLen&&oldPos+1<oldLen&&this.equals(oldTokens[oldPos+1],newTokens[newPos+1],options);)newPos++,oldPos++,commonCount++,options.oneChangePerToken&&(basePath.lastComponent={count:1,previousComponent:basePath.lastComponent,added:!1,removed:!1});return commonCount&&!options.oneChangePerToken&&(basePath.lastComponent={count:commonCount,previousComponent:basePath.lastComponent,added:!1,removed:!1}),basePath.oldPos=oldPos,newPos}equals(left,right,options){return options.comparator?options.comparator(left,right):left===right||!!options.ignoreCase&&left.toLowerCase()===right.toLowerCase()}removeEmpty(array){var ret=[];for(let i=0;i<array.length;i++)array[i]&&ret.push(array[i]);return ret}castInput(value,options){return value}tokenize(value,options){return Array.from(value)}join(chars){return chars.join("")}postProcess(changeObjects,options){return changeObjects}get useLongestToken(){return!1}buildValues(lastComponent,newTokens,oldTokens){for(var nextComponent,components=[];lastComponent;)components.push(lastComponent),nextComponent=lastComponent.previousComponent,delete lastComponent.previousComponent,lastComponent=nextComponent;components.reverse();var componentLen=components.length;let componentPos=0,newPos=0,oldPos=0;for(;componentPos<componentLen;componentPos++){var component=components[componentPos];if(component.removed)component.value=this.join(oldTokens.slice(oldPos,oldPos+component.count)),oldPos+=component.count;else{if(!component.added&&this.useLongestToken){let value=newTokens.slice(newPos,newPos+component.count);value=value.map(function(value,i){i=oldTokens[oldPos+i];return i.length>value.length?i:value}),component.value=this.join(value)}else component.value=this.join(newTokens.slice(newPos,newPos+component.count));newPos+=component.count,component.added||(oldPos+=component.count)}}return components}}class CharacterDiff extends Diff{}let characterDiff=new CharacterDiff;function longestCommonPrefix(str1,str2){let i;for(i=0;i<str1.length&&i<str2.length;i++)if(str1[i]!=str2[i])return str1.slice(0,i);return str1.slice(0,i)}function longestCommonSuffix(str1,str2){let i;if(!str1||!str2||str1[str1.length-1]!=str2[str2.length-1])return"";for(i=0;i<str1.length&&i<str2.length;i++)if(str1[str1.length-(i+1)]!=str2[str2.length-(i+1)])return str1.slice(-i);return str1.slice(-i)}function replacePrefix(string,oldPrefix,newPrefix){if(string.slice(0,oldPrefix.length)!=oldPrefix)throw Error(`string ${JSON.stringify(string)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);return newPrefix+string.slice(oldPrefix.length)}function replaceSuffix(string,oldSuffix,newSuffix){if(!oldSuffix)return string+newSuffix;if(string.slice(-oldSuffix.length)!=oldSuffix)throw Error(`string ${JSON.stringify(string)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);return string.slice(0,-oldSuffix.length)+newSuffix}function removePrefix(string,oldPrefix){return replacePrefix(string,oldPrefix,"")}function removeSuffix(string,oldSuffix){return replaceSuffix(string,oldSuffix,"")}function maximumOverlap(string1,string2){return string2.slice(0,((a,b)=>{let startA=0,endB=(a.length>b.length&&(startA=a.length-b.length),b.length),map=(a.length<b.length&&(endB=a.length),Array(endB)),k=0;map[0]=0;for(let j=1;j<endB;j++){for(b[j]==b[k]?map[j]=map[k]:map[j]=k;0<k&&b[j]!=b[k];)k=map[k];b[j]==b[k]&&k++}k=0;for(let i=startA;i<a.length;i++){for(;0<k&&a[i]!=b[k];)k=map[k];a[i]==b[k]&&k++}return k})(string1,string2))}function trailingWs(string){let i;for(i=string.length-1;0<=i&&string[i].match(/\s/);i--);return string.substring(i+1)}function leadingWs(string){string=string.match(/^\s*/);return string?string[0]:""}let extendedWordChars="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",tokenizeIncludingWhitespace=new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`,"ug");class WordDiff extends Diff{equals(left,right,options){return options.ignoreCase&&(left=left.toLowerCase(),right=right.toLowerCase()),left.trim()===right.trim()}tokenize(value,options={}){let parts;if(options.intlSegmenter){options=options.intlSegmenter;if("word"!=options.resolvedOptions().granularity)throw new Error('The segmenter passed must have a granularity of "word"');parts=Array.from(options.segment(value),segment=>segment.segment)}else parts=value.match(tokenizeIncludingWhitespace)||[];let tokens=[],prevPart=null;return parts.forEach(part=>{/\s/.test(part)?null==prevPart?tokens.push(part):tokens.push(tokens.pop()+part):null!=prevPart&&/\s/.test(prevPart)?tokens[tokens.length-1]==prevPart?tokens.push(tokens.pop()+part):tokens.push(prevPart+part):tokens.push(part),prevPart=part}),tokens}join(tokens){return tokens.map((token,i)=>0==i?token:token.replace(/^\s+/,"")).join("")}postProcess(changes,options){if(changes&&!options.oneChangePerToken){let lastKeep=null,insertion=null,deletion=null;changes.forEach(change=>{change.added?insertion=change:deletion=change.removed?change:((insertion||deletion)&&dedupeWhitespaceInChangeObjects(lastKeep,deletion,insertion,change),lastKeep=change,insertion=null)}),(insertion||deletion)&&dedupeWhitespaceInChangeObjects(lastKeep,deletion,insertion,null)}return changes}}let wordDiff=new WordDiff;function dedupeWhitespaceInChangeObjects(startKeep,deletion,insertion,endKeep){if(deletion&&insertion){var oldWsPrefix=leadingWs(deletion.value),oldWsSuffix=trailingWs(deletion.value),newWsPrefix=leadingWs(insertion.value),newWsSuffix=trailingWs(insertion.value);startKeep&&(oldWsPrefix=longestCommonPrefix(oldWsPrefix,newWsPrefix),startKeep.value=replaceSuffix(startKeep.value,newWsPrefix,oldWsPrefix),deletion.value=removePrefix(deletion.value,oldWsPrefix),insertion.value=removePrefix(insertion.value,oldWsPrefix)),endKeep&&(newWsPrefix=longestCommonSuffix(oldWsSuffix,newWsSuffix),endKeep.value=replacePrefix(endKeep.value,newWsSuffix,newWsPrefix),deletion.value=removeSuffix(deletion.value,newWsPrefix),insertion.value=removeSuffix(insertion.value,newWsPrefix))}else if(insertion){if(startKeep&&(oldWsPrefix=leadingWs(insertion.value),insertion.value=insertion.value.substring(oldWsPrefix.length)),endKeep){let ws=leadingWs(endKeep.value);endKeep.value=endKeep.value.substring(ws.length)}}else if(startKeep&&endKeep){oldWsSuffix=leadingWs(endKeep.value),newWsSuffix=leadingWs(deletion.value),newWsPrefix=trailingWs(deletion.value),insertion=longestCommonPrefix(oldWsSuffix,newWsSuffix),oldWsPrefix=(deletion.value=removePrefix(deletion.value,insertion),longestCommonSuffix(removePrefix(oldWsSuffix,insertion),newWsPrefix));deletion.value=removeSuffix(deletion.value,oldWsPrefix),endKeep.value=replacePrefix(endKeep.value,oldWsSuffix,oldWsPrefix),startKeep.value=replaceSuffix(startKeep.value,oldWsSuffix,oldWsSuffix.slice(0,oldWsSuffix.length-oldWsPrefix.length))}else if(endKeep){newWsSuffix=leadingWs(endKeep.value),insertion=maximumOverlap(trailingWs(deletion.value),newWsSuffix);deletion.value=removeSuffix(deletion.value,insertion)}else if(startKeep){let overlap=maximumOverlap(trailingWs(startKeep.value),leadingWs(deletion.value));deletion.value=removePrefix(deletion.value,overlap)}}class WordsWithSpaceDiff extends Diff{tokenize(value){var regex=new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`,"ug");return value.match(regex)||[]}}let wordsWithSpaceDiff=new WordsWithSpaceDiff;function diffWordsWithSpace(oldStr,newStr,options){return wordsWithSpaceDiff.diff(oldStr,newStr,options)}class LineDiff extends Diff{constructor(){super(...arguments),this.tokenize=tokenize}equals(left,right,options){return options.ignoreWhitespace?(options.newlineIsToken&&left.includes("\n")||(left=left.trim()),options.newlineIsToken&&right.includes("\n")||(right=right.trim())):options.ignoreNewlineAtEof&&!options.newlineIsToken&&(left.endsWith("\n")&&(left=left.slice(0,-1)),right.endsWith("\n"))&&(right=right.slice(0,-1)),super.equals(left,right,options)}}let lineDiff=new LineDiff;function diffLines(oldStr,newStr,options){return lineDiff.diff(oldStr,newStr,options)}function tokenize(value,options){var retLines=[],linesAndNewlines=(value=options.stripTrailingCr?value.replace(/\r\n/g,"\n"):value).split(/(\n|\r\n)/);linesAndNewlines[linesAndNewlines.length-1]||linesAndNewlines.pop();for(let i=0;i<linesAndNewlines.length;i++){var line=linesAndNewlines[i];i%2&&!options.newlineIsToken?retLines[retLines.length-1]+=line:retLines.push(line)}return retLines}class SentenceDiff extends Diff{tokenize(value){var _a,char,result=[];let tokenStartI=0;for(let i=0;i<value.length;i++){if(i==value.length-1){result.push(value.slice(tokenStartI));break}if(("."==(char=value[i])||"!"==char||"?"==char)&&value[i+1].match(/\s/)){for(result.push(value.slice(tokenStartI,i+1)),i=tokenStartI=i+1;null!=(_a=value[i+1])&&_a.match(/\s/);)i++;result.push(value.slice(tokenStartI,i+1)),tokenStartI=i+1}}return result}}let sentenceDiff=new SentenceDiff;class CssDiff extends Diff{tokenize(value){return value.split(/([{}:;,]|\s+)/)}}let cssDiff=new CssDiff;class JsonDiff extends Diff{constructor(){super(...arguments),this.tokenize=tokenize}get useLongestToken(){return!0}castInput(value,options){let{undefinedReplacement,stringifyReplacer=(k,v)=>void 0===v?undefinedReplacement:v}=options;return"string"==typeof value?value:JSON.stringify(canonicalize(value,null,null,stringifyReplacer),null," ")}equals(left,right,options){return super.equals(left.replace(/,([\r\n])/g,"$1"),right.replace(/,([\r\n])/g,"$1"),options)}}let jsonDiff=new JsonDiff;function canonicalize(obj,stack,replacementStack,replacer,key){stack=stack||[],replacementStack=replacementStack||[],replacer&&(obj=replacer(void 0===key?"":key,obj));let i;for(i=0;i<stack.length;i+=1)if(stack[i]===obj)return replacementStack[i];let canonicalizedObj;if("[object Array]"===Object.prototype.toString.call(obj)){for(stack.push(obj),canonicalizedObj=new Array(obj.length),replacementStack.push(canonicalizedObj),i=0;i<obj.length;i+=1)canonicalizedObj[i]=canonicalize(obj[i],stack,replacementStack,replacer,String(i));stack.pop(),replacementStack.pop()}else if("object"==typeof(obj=obj&&obj.toJSON?obj.toJSON():obj)&&null!==obj){stack.push(obj),canonicalizedObj={},replacementStack.push(canonicalizedObj);var sortedKeys=[];let key;for(key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&sortedKeys.push(key);for(sortedKeys.sort(),i=0;i<sortedKeys.length;i+=1)key=sortedKeys[i],canonicalizedObj[key]=canonicalize(obj[key],stack,replacementStack,replacer,key);stack.pop(),replacementStack.pop()}else canonicalizedObj=obj;return canonicalizedObj}class ArrayDiff extends Diff{tokenize(value){return value.slice()}join(value){return value}removeEmpty(value){return value}}let arrayDiff=new ArrayDiff;function parsePatch(uniDiff){let diffstr=uniDiff.split(/\n/),list=[],i=0;function parseIndex(){var index={};for(list.push(index);i<diffstr.length;){var line=diffstr[i];if(/^(---|\+\+\+|@@)\s/.test(line))break;line=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);line&&(index.index=line[1]),i++}for(parseFileHeader(index),parseFileHeader(index),index.hunks=[];i<diffstr.length;){let line=diffstr[i];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(line))break;if(/^@@/.test(line))index.hunks.push((()=>{var chunkHeaderIndex=i,chunkHeaderLine=diffstr[i++],hunk={oldStart:+(chunkHeaderLine=chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/))[1],oldLines:void 0===chunkHeaderLine[2]?1:+chunkHeaderLine[2],newStart:+chunkHeaderLine[3],newLines:void 0===chunkHeaderLine[4]?1:+chunkHeaderLine[4],lines:[]};0===hunk.oldLines&&(hunk.oldStart+=1),0===hunk.newLines&&(hunk.newStart+=1);let addCount=0,removeCount=0;for(;i<diffstr.length&&(removeCount<hunk.oldLines||addCount<hunk.newLines||null!=(_a=diffstr[i])&&_a.startsWith("\\"));i++){var _a=0==diffstr[i].length&&i!=diffstr.length-1?" ":diffstr[i][0];if("+"!==_a&&"-"!==_a&&" "!==_a&&"\\"!==_a)throw new Error(`Hunk at line ${chunkHeaderIndex+1} contained invalid line `+diffstr[i]);hunk.lines.push(diffstr[i]),"+"===_a?addCount++:"-"===_a?removeCount++:" "===_a&&(addCount++,removeCount++)}if(addCount||1!==hunk.newLines||(hunk.newLines=0),removeCount||1!==hunk.oldLines||(hunk.oldLines=0),addCount!==hunk.newLines)throw new Error("Added line count did not match for hunk at line "+(chunkHeaderIndex+1));if(removeCount===hunk.oldLines)return hunk;throw new Error("Removed line count did not match for hunk at line "+(chunkHeaderIndex+1))})());else{if(line)throw new Error("Unknown line "+(i+1)+" "+JSON.stringify(line));i++}}}function parseFileHeader(index){var fileHeader=/^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]);if(fileHeader){var data=fileHeader[2].split("\t",2),header=(data[1]||"").trim();let fileName=data[0].replace(/\\\\/g,"\\");/^".*"$/.test(fileName)&&(fileName=fileName.substr(1,fileName.length-2)),"---"===fileHeader[1]?(index.oldFileName=fileName,index.oldHeader=header):(index.newFileName=fileName,index.newHeader=header),i++}}for(;i<diffstr.length;)parseIndex();return list}function applyPatch(source,patch,options={}){let patches;if(1<(patches="string"==typeof patch?parsePatch(patch):Array.isArray(patch)?patch:[patch]).length)throw new Error("applyPatch only works with a single input.");return((source,patch,options={})=>{!options.autoConvertLineEndings&&null!=options.autoConvertLineEndings||((string=>string.includes("\r\n")&&!string.startsWith("\n")&&!string.match(/[^\r]\n/))(source)&&(patch=>!(patch=Array.isArray(patch)?patch:[patch]).some(index=>index.hunks.some(hunk=>hunk.lines.some(line=>!line.startsWith("\\")&&line.endsWith("\r")))))(patch)?patch=function unixToWin(patch){return Array.isArray(patch)?patch.map(p=>unixToWin(p)):Object.assign(Object.assign({},patch),{hunks:patch.hunks.map(hunk=>Object.assign(Object.assign({},hunk),{lines:hunk.lines.map((line,i)=>line.startsWith("\\")||line.endsWith("\r")||null!=(i=hunk.lines[i+1])&&i.startsWith("\\")?line:line+"\r")}))})}(patch):(string=>!string.includes("\r\n")&&string.includes("\n"))(source)&&(patch=>(patch=Array.isArray(patch)?patch:[patch]).some(index=>index.hunks.some(hunk=>hunk.lines.some(line=>line.endsWith("\r"))))&&patch.every(index=>index.hunks.every(hunk=>hunk.lines.every((line,i)=>line.startsWith("\\")||line.endsWith("\r")||(null==(line=hunk.lines[i+1])?void 0:line.startsWith("\\"))))))(patch)&&(patch=function winToUnix(patch){return Array.isArray(patch)?patch.map(p=>winToUnix(p)):Object.assign(Object.assign({},patch),{hunks:patch.hunks.map(hunk=>Object.assign(Object.assign({},hunk),{lines:hunk.lines.map(line=>line.endsWith("\r")?line.substring(0,line.length-1):line)}))})}(patch)));let lines=source.split("\n"),hunks=patch.hunks,compareLine=options.compareLine||((lineNumber,line,operation,patchContent)=>line===patchContent),fuzzFactor=options.fuzzFactor||0,minLine=0;if(fuzzFactor<0||!Number.isInteger(fuzzFactor))throw new Error("fuzzFactor must be a non-negative integer");if(!hunks.length)return source;let prevLine="",removeEOFNL=!1,addEOFNL=!1;for(let i=0;i<hunks[hunks.length-1].lines.length;i++){var line=hunks[hunks.length-1].lines[i];"\\"==line[0]&&("+"==prevLine[0]?removeEOFNL=!0:"-"==prevLine[0]&&(addEOFNL=!0)),prevLine=line}if(removeEOFNL){if(addEOFNL){if(!fuzzFactor&&""==lines[lines.length-1])return!1}else if(""==lines[lines.length-1])lines.pop();else if(!fuzzFactor)return!1}else if(addEOFNL)if(""!=lines[lines.length-1])lines.push("");else if(!fuzzFactor)return!1;let resultLines=[],prevHunkOffset=0;for(let i=0;i<hunks.length;i++){var hunk=hunks[i];let hunkResult;var maxLine=lines.length-hunk.oldLines+fuzzFactor;let toPos;for(let maxErrors=0;maxErrors<=fuzzFactor;maxErrors++){for(var iterator=((start,minLine,maxLine)=>{let wantForward=!0,backwardExhausted=!1,forwardExhausted=!1,localOffset=1;return function iterator(){if(wantForward&&!forwardExhausted){if(backwardExhausted?localOffset++:wantForward=!1,start+localOffset<=maxLine)return start+localOffset;forwardExhausted=!0}if(!backwardExhausted)return forwardExhausted||(wantForward=!0),minLine<=start-localOffset?start-localOffset++:(backwardExhausted=!0,iterator())}})(toPos=hunk.oldStart+prevHunkOffset-1,minLine,maxLine);void 0!==toPos&&!(hunkResult=function applyHunk(hunkLines,toPos,maxErrors,hunkLinesI=0,lastContextLineMatched=!0,patchedLines=[],patchedLinesLength=0){let nConsecutiveOldContextLines=0,nextContextLineMustMatch=!1;for(;hunkLinesI<hunkLines.length;hunkLinesI++){var operation=0<(hunkLine=hunkLines[hunkLinesI]).length?hunkLine[0]:" ",hunkLine=0<hunkLine.length?hunkLine.substr(1):hunkLine;if("-"===operation){if(!compareLine(toPos+1,lines[toPos],operation,hunkLine))return maxErrors&&null!=lines[toPos]?(patchedLines[patchedLinesLength]=lines[toPos],applyHunk(hunkLines,toPos+1,maxErrors-1,hunkLinesI,!1,patchedLines,patchedLinesLength+1)):null;toPos++,nConsecutiveOldContextLines=0}if("+"===operation){if(!lastContextLineMatched)return null;patchedLines[patchedLinesLength]=hunkLine,patchedLinesLength++,nConsecutiveOldContextLines=0,nextContextLineMustMatch=!0}if(" "===operation){if(nConsecutiveOldContextLines++,patchedLines[patchedLinesLength]=lines[toPos],!compareLine(toPos+1,lines[toPos],operation,hunkLine))return nextContextLineMustMatch||!maxErrors?null:lines[toPos]&&(applyHunk(hunkLines,toPos+1,maxErrors-1,hunkLinesI+1,!1,patchedLines,patchedLinesLength+1)||applyHunk(hunkLines,toPos+1,maxErrors-1,hunkLinesI,!1,patchedLines,patchedLinesLength+1))||applyHunk(hunkLines,toPos,maxErrors-1,hunkLinesI+1,!1,patchedLines,patchedLinesLength);patchedLinesLength++,lastContextLineMatched=!0,nextContextLineMustMatch=!1,toPos++}}return patchedLinesLength-=nConsecutiveOldContextLines,toPos-=nConsecutiveOldContextLines,patchedLines.length=patchedLinesLength,{patchedLines:patchedLines,oldLineLastI:toPos-1}}(hunk.lines,toPos,maxErrors));toPos=iterator());if(hunkResult)break}if(!hunkResult)return!1;for(let i=minLine;i<toPos;i++)resultLines.push(lines[i]);for(let i=0;i<hunkResult.patchedLines.length;i++){var line=hunkResult.patchedLines[i];resultLines.push(line)}minLine=hunkResult.oldLineLastI+1,prevHunkOffset=toPos+1-hunk.oldStart}for(let i=minLine;i<lines.length;i++)resultLines.push(lines[i]);return resultLines.join("\n")})(source,patches[0],options)}function structuredPatch(oldFileName,newFileName,oldStr,newStr,oldHeader,newHeader,options){let optionsObj,context=(void 0===(optionsObj=options?"function"==typeof options?{callback:options}:options:{}).context&&(optionsObj.context=4),optionsObj.context);if(optionsObj.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(!optionsObj.callback)return diffLinesResultToPatch(diffLines(oldStr,newStr,optionsObj));{let callback=optionsObj.callback;diffLines(oldStr,newStr,Object.assign(Object.assign({},optionsObj),{callback:diff=>{diff=diffLinesResultToPatch(diff);callback(diff)}}))}function diffLinesResultToPatch(diff){if(diff){diff.push({value:"",lines:[]});var hunks=[];let oldRangeStart=0,newRangeStart=0,curRange=[],oldLine=1,newLine=1;for(let i=0;i<diff.length;i++){var line,current=diff[i],lines=current.lines||(text=>{var hasTrailingNl=text.endsWith("\n"),text=text.split("\n").map(line=>line+"\n");return hasTrailingNl?text.pop():text.push(text.pop().slice(0,-1)),text})(current.value);if(current.lines=lines,current.added||current.removed){oldRangeStart||(prev=diff[i-1],oldRangeStart=oldLine,newRangeStart=newLine,prev&&(curRange=0<context?contextLines(prev.lines.slice(-context)):[],oldRangeStart-=curRange.length,newRangeStart-=curRange.length));for(line of lines)curRange.push((current.added?"+":"-")+line);current.added?newLine+=lines.length:oldLine+=lines.length}else{if(oldRangeStart)if(lines.length<=2*context&&i<diff.length-2)for(let line of contextLines(lines))curRange.push(line);else{var prev=Math.min(lines.length,context);for(let line of contextLines(lines.slice(0,prev)))curRange.push(line);var hunk={oldStart:oldRangeStart,oldLines:oldLine-oldRangeStart+prev,newStart:newRangeStart,newLines:newLine-newRangeStart+prev,lines:curRange};hunks.push(hunk),oldRangeStart=0,newRangeStart=0,curRange=[]}oldLine+=lines.length,newLine+=lines.length}}for(let hunk of hunks)for(let i=0;i<hunk.lines.length;i++)hunk.lines[i].endsWith("\n")?hunk.lines[i]=hunk.lines[i].slice(0,-1):(hunk.lines.splice(i+1,0,"\"),i++);return{oldFileName:oldFileName,newFileName:newFileName,oldHeader:oldHeader,newHeader:newHeader,hunks:hunks};function contextLines(lines){return lines.map(function(entry){return" "+entry})}}}}function formatPatch(patch){if(Array.isArray(patch))return patch.map(formatPatch).join("\n");var ret=[];patch.oldFileName==patch.newFileName&&ret.push("Index: "+patch.oldFileName),ret.push("==================================================================="),ret.push("--- "+patch.oldFileName+(void 0===patch.oldHeader?"":"\t"+patch.oldHeader)),ret.push("+++ "+patch.newFileName+(void 0===patch.newHeader?"":"\t"+patch.newHeader));for(let i=0;i<patch.hunks.length;i++){var line,hunk=patch.hunks[i];0===hunk.oldLines&&--hunk.oldStart,0===hunk.newLines&&--hunk.newStart,ret.push("@@ -"+hunk.oldStart+","+hunk.oldLines+" +"+hunk.newStart+","+hunk.newLines+" @@");for(line of hunk.lines)ret.push(line)}return ret.join("\n")+"\n"}function createTwoFilesPatch(oldFileName,newFileName,oldStr,newStr,oldHeader,newHeader,options){if(null!=(options="function"==typeof options?{callback:options}:options)&&options.callback){let callback=options.callback;structuredPatch(oldFileName,newFileName,oldStr,newStr,oldHeader,newHeader,Object.assign(Object.assign({},options),{callback:patchObj=>{patchObj?callback(formatPatch(patchObj)):callback(void 0)}}))}else{oldFileName=structuredPatch(oldFileName,newFileName,oldStr,newStr,oldHeader,newHeader,options);if(oldFileName)return formatPatch(oldFileName)}}exports.Diff=Diff,exports.applyPatch=applyPatch,exports.applyPatches=function(uniDiff,options){let spDiff="string"==typeof uniDiff?parsePatch(uniDiff):uniDiff,currentIndex=0;!function processIndex(){let index=spDiff[currentIndex++];if(!index)return options.complete();options.loadFile(index,function(err,data){if(err)return options.complete(err);err=applyPatch(data,index,options),options.patched(index,err,function(err){if(err)return options.complete(err);processIndex()})})}()},exports.arrayDiff=arrayDiff,exports.canonicalize=canonicalize,exports.characterDiff=characterDiff,exports.convertChangesToDMP=function(changes){var ret=[];let change,operation;for(let i=0;i<changes.length;i++)change=changes[i],operation=change.added?1:change.removed?-1:0,ret.push([operation,change.value]);return ret},exports.convertChangesToXML=function(changes){var ret=[];for(let i=0;i<changes.length;i++){var change=changes[i];change.added?ret.push("<ins>"):change.removed&&ret.push("<del>"),ret.push((s=>{let n=s;return n=(n=(n=(n=n.replace(/&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/"/g,"&quot;")})(change.value)),change.added?ret.push("</ins>"):change.removed&&ret.push("</del>")}return ret.join("")},exports.createPatch=function(fileName,oldStr,newStr,oldHeader,newHeader,options){return createTwoFilesPatch(fileName,fileName,oldStr,newStr,oldHeader,newHeader,options)},exports.createTwoFilesPatch=createTwoFilesPatch,exports.cssDiff=cssDiff,exports.diffArrays=function(oldArr,newArr,options){return arrayDiff.diff(oldArr,newArr,options)},exports.diffChars=function(oldStr,newStr,options){return characterDiff.diff(oldStr,newStr,options)},exports.diffCss=function(oldStr,newStr,options){return cssDiff.diff(oldStr,newStr,options)},exports.diffJson=function(oldStr,newStr,options){return jsonDiff.diff(oldStr,newStr,options)},exports.diffLines=diffLines,exports.diffSentences=function(oldStr,newStr,options){return sentenceDiff.diff(oldStr,newStr,options)},exports.diffTrimmedLines=function(oldStr,newStr,options){return options=((options,defaults)=>{if("function"==typeof options)defaults.callback=options;else if(options)for(var name in options)Object.prototype.hasOwnProperty.call(options,name)&&(defaults[name]=options[name]);return defaults})(options,{ignoreWhitespace:!0}),lineDiff.diff(oldStr,newStr,options)},exports.diffWords=function(oldStr,newStr,options){return null==(null==options?void 0:options.ignoreWhitespace)||options.ignoreWhitespace?wordDiff.diff(oldStr,newStr,options):diffWordsWithSpace(oldStr,newStr,options)},exports.diffWordsWithSpace=diffWordsWithSpace,exports.formatPatch=formatPatch,exports.jsonDiff=jsonDiff,exports.lineDiff=lineDiff,exports.parsePatch=parsePatch,exports.reversePatch=function reversePatch(structuredPatch){return Array.isArray(structuredPatch)?structuredPatch.map(patch=>reversePatch(patch)).reverse():Object.assign(Object.assign({},structuredPatch),{oldFileName:structuredPatch.newFileName,oldHeader:structuredPatch.newHeader,newFileName:structuredPatch.oldFileName,newHeader:structuredPatch.oldHeader,hunks:structuredPatch.hunks.map(hunk=>({oldLines:hunk.newLines,oldStart:hunk.newStart,newLines:hunk.oldLines,newStart:hunk.oldStart,lines:hunk.lines.map(l=>l.startsWith("-")?"+"+l.slice(1):l.startsWith("+")?"-"+l.slice(1):l)}))})},exports.sentenceDiff=sentenceDiff,exports.structuredPatch=structuredPatch,exports.wordDiff=wordDiff,exports.wordsWithSpaceDiff=wordsWithSpaceDiff});
@@ -0,0 +1,182 @@
1
+ // @ts-check
2
+
3
+ import eslint from '@eslint/js';
4
+ import tseslint from 'typescript-eslint';
5
+ import globals from "globals";
6
+
7
+ export default tseslint.config(
8
+ {
9
+ ignores: [
10
+ "**/*", // ignore everything...
11
+ "!src/**/", "!src/**/*.ts", // ... except our TypeScript source files...
12
+ "!test/**/", "!test/**/*.js", // ... and our tests
13
+ ],
14
+ },
15
+ eslint.configs.recommended,
16
+ tseslint.configs.recommended,
17
+ {
18
+ files: ['src/**/*.ts'],
19
+ languageOptions: {
20
+ parserOptions: {
21
+ projectService: true,
22
+ tsconfigRootDir: import.meta.dirname,
23
+ },
24
+ },
25
+ extends: [tseslint.configs.recommendedTypeChecked],
26
+ rules: {
27
+ // Not sure if these actually serve a purpose, but they provide a way to enforce SOME of what
28
+ // would be imposed by having "verbatimModuleSyntax": true in our tsconfig.json without
29
+ // actually doing that.
30
+ "@typescript-eslint/consistent-type-imports": 2,
31
+ "@typescript-eslint/consistent-type-exports": 2,
32
+
33
+ // Things from the recommendedTypeChecked shared config that are disabled simply because they
34
+ // caused lots of errors in our existing code when tried. Plausibly useful to turn on if
35
+ // possible and somebody fancies doing the work:
36
+ "@typescript-eslint/no-unsafe-argument": 0,
37
+ "@typescript-eslint/no-unsafe-assignment": 0,
38
+ "@typescript-eslint/no-unsafe-call": 0,
39
+ "@typescript-eslint/no-unsafe-member-access": 0,
40
+ "@typescript-eslint/no-unsafe-return": 0,
41
+ }
42
+ },
43
+ {
44
+ languageOptions: {
45
+ globals: {
46
+ ...globals.browser,
47
+ },
48
+ },
49
+
50
+ rules: {
51
+ // Possible Errors //
52
+ //-----------------//
53
+ "comma-dangle": [2, "never"],
54
+ "no-console": 1, // Allow for debugging
55
+ "no-debugger": 1, // Allow for debugging
56
+ "no-extra-parens": [2, "functions"],
57
+ "no-extra-semi": 2,
58
+ "no-negated-in-lhs": 2,
59
+ "no-unreachable": 1, // Optimizer and coverage will handle/highlight this and can be useful for debugging
60
+
61
+ // Best Practices //
62
+ //----------------//
63
+ curly: 2,
64
+ "default-case": 1,
65
+ "dot-notation": [2, {
66
+ allowKeywords: false,
67
+ }],
68
+ "guard-for-in": 1,
69
+ "no-alert": 2,
70
+ "no-caller": 2,
71
+ "no-div-regex": 1,
72
+ "no-eval": 2,
73
+ "no-extend-native": 2,
74
+ "no-extra-bind": 2,
75
+ "no-floating-decimal": 2,
76
+ "no-implied-eval": 2,
77
+ "no-iterator": 2,
78
+ "no-labels": 2,
79
+ "no-lone-blocks": 2,
80
+ "no-multi-spaces": 2,
81
+ "no-multi-str": 1,
82
+ "no-native-reassign": 2,
83
+ "no-new": 2,
84
+ "no-new-func": 2,
85
+ "no-new-wrappers": 2,
86
+ "no-octal-escape": 2,
87
+ "no-process-env": 2,
88
+ "no-proto": 2,
89
+ "no-return-assign": 2,
90
+ "no-script-url": 2,
91
+ "no-self-compare": 2,
92
+ "no-sequences": 2,
93
+ "no-throw-literal": 2,
94
+ "no-unused-expressions": 2,
95
+ "no-warning-comments": 1,
96
+ radix: 2,
97
+ "wrap-iife": 2,
98
+
99
+ // Variables //
100
+ //-----------//
101
+ "no-catch-shadow": 2,
102
+ "no-label-var": 2,
103
+ "no-undef-init": 2,
104
+
105
+ // Node.js //
106
+ //---------//
107
+
108
+ // Stylistic //
109
+ //-----------//
110
+ "brace-style": [2, "1tbs", {
111
+ allowSingleLine: true,
112
+ }],
113
+ camelcase: 2,
114
+ "comma-spacing": [2, {
115
+ before: false,
116
+ after: true,
117
+ }],
118
+ "comma-style": [2, "last"],
119
+ "consistent-this": [1, "self"],
120
+ "eol-last": 2,
121
+ "func-style": [2, "declaration"],
122
+ "key-spacing": [2, {
123
+ beforeColon: false,
124
+ afterColon: true,
125
+ }],
126
+ "new-cap": 2,
127
+ "new-parens": 2,
128
+ "no-array-constructor": 2,
129
+ "no-lonely-if": 2,
130
+ "no-mixed-spaces-and-tabs": 2,
131
+ "no-nested-ternary": 1,
132
+ "no-new-object": 2,
133
+ "no-spaced-func": 2,
134
+ "no-trailing-spaces": 2,
135
+ "quote-props": [2, "as-needed", {
136
+ keywords: true,
137
+ }],
138
+ quotes: [2, "single", "avoid-escape"],
139
+ semi: 2,
140
+ "semi-spacing": [2, {
141
+ before: false,
142
+ after: true,
143
+ }],
144
+ "space-before-blocks": [2, "always"],
145
+ "space-before-function-paren": [2, {
146
+ anonymous: "never",
147
+ named: "never",
148
+ }],
149
+ "space-in-parens": [2, "never"],
150
+ "space-infix-ops": 2,
151
+ "space-unary-ops": 2,
152
+ "spaced-comment": [2, "always"],
153
+ "wrap-regex": 1,
154
+ "no-var": 2,
155
+
156
+ // Typescript //
157
+ //------------//
158
+ "@typescript-eslint/no-explicit-any": 0, // Very strict rule, incompatible with our code
159
+
160
+ // We use these intentionally - e.g.
161
+ // export interface DiffCssOptions extends CommonDiffOptions {}
162
+ // for the options argument to diffCss which currently takes no options beyond the ones
163
+ // common to all diffFoo functions. Doing this allows consistency (one options interface per
164
+ // diffFoo function) and future-proofs against the API having to change in future if we add a
165
+ // non-common option to one of these functions.
166
+ "@typescript-eslint/no-empty-object-type": [2, {allowInterfaces: 'with-single-extends'}],
167
+ },
168
+ },
169
+ {
170
+ files: ['test/**/*.js'],
171
+ languageOptions: {
172
+ globals: {
173
+ ...globals.node,
174
+ ...globals.mocha,
175
+ },
176
+ },
177
+ rules: {
178
+ "no-unused-expressions": 0, // Needs disabling to support Chai `.to.be.undefined` etc syntax
179
+ "@typescript-eslint/no-unused-expressions": 0, // (as above)
180
+ },
181
+ }
182
+ );
@@ -0,0 +1,8 @@
1
+ import type { ChangeObject } from '../types.js';
2
+ type DmpOperation = 1 | 0 | -1;
3
+ /**
4
+ * converts a list of change objects to the format returned by Google's [diff-match-patch](https://github.com/google/diff-match-patch) library
5
+ */
6
+ export declare function convertChangesToDMP<ValueT>(changes: ChangeObject<ValueT>[]): [DmpOperation, ValueT][];
7
+ export {};
8
+ //# sourceMappingURL=dmp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dmp.d.ts","sourceRoot":"","sources":["../../src/convert/dmp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAE9C,KAAK,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/B;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,CAiBrG"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertChangesToDMP = convertChangesToDMP;
4
+ /**
5
+ * converts a list of change objects to the format returned by Google's [diff-match-patch](https://github.com/google/diff-match-patch) library
6
+ */
7
+ function convertChangesToDMP(changes) {
8
+ var ret = [];
9
+ var change, operation;
10
+ for (var i = 0; i < changes.length; i++) {
11
+ change = changes[i];
12
+ if (change.added) {
13
+ operation = 1;
14
+ }
15
+ else if (change.removed) {
16
+ operation = -1;
17
+ }
18
+ else {
19
+ operation = 0;
20
+ }
21
+ ret.push([operation, change.value]);
22
+ }
23
+ return ret;
24
+ }
@@ -0,0 +1,6 @@
1
+ import type { ChangeObject } from '../types.js';
2
+ /**
3
+ * converts a list of change objects to a serialized XML format
4
+ */
5
+ export declare function convertChangesToXML(changes: ChangeObject<string>[]): string;
6
+ //# sourceMappingURL=xml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../src/convert/xml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,CAmB3E"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertChangesToXML = convertChangesToXML;
4
+ /**
5
+ * converts a list of change objects to a serialized XML format
6
+ */
7
+ function convertChangesToXML(changes) {
8
+ var ret = [];
9
+ for (var i = 0; i < changes.length; i++) {
10
+ var change = changes[i];
11
+ if (change.added) {
12
+ ret.push('<ins>');
13
+ }
14
+ else if (change.removed) {
15
+ ret.push('<del>');
16
+ }
17
+ ret.push(escapeHTML(change.value));
18
+ if (change.added) {
19
+ ret.push('</ins>');
20
+ }
21
+ else if (change.removed) {
22
+ ret.push('</del>');
23
+ }
24
+ }
25
+ return ret.join('');
26
+ }
27
+ function escapeHTML(s) {
28
+ var n = s;
29
+ n = n.replace(/&/g, '&amp;');
30
+ n = n.replace(/</g, '&lt;');
31
+ n = n.replace(/>/g, '&gt;');
32
+ n = n.replace(/"/g, '&quot;');
33
+ return n;
34
+ }
@@ -0,0 +1,19 @@
1
+ import Diff from './base.js';
2
+ import type { ChangeObject, DiffArraysOptionsNonabortable, CallbackOptionNonabortable, DiffArraysOptionsAbortable, DiffCallbackNonabortable, CallbackOptionAbortable } from '../types.js';
3
+ declare class ArrayDiff<T> extends Diff<T, Array<T>> {
4
+ tokenize(value: Array<T>): T[];
5
+ join(value: Array<T>): T[];
6
+ removeEmpty(value: Array<T>): T[];
7
+ }
8
+ export declare const arrayDiff: ArrayDiff<unknown>;
9
+ /**
10
+ * diffs two arrays of tokens, comparing each item for strict equality (===).
11
+ * @returns a list of change objects.
12
+ */
13
+ export declare function diffArrays<T>(oldArr: T[], newArr: T[], options: DiffCallbackNonabortable<T[]>): undefined;
14
+ export declare function diffArrays<T>(oldArr: T[], newArr: T[], options: DiffArraysOptionsAbortable<T> & CallbackOptionAbortable<T[]>): undefined;
15
+ export declare function diffArrays<T>(oldArr: T[], newArr: T[], options: DiffArraysOptionsNonabortable<T> & CallbackOptionNonabortable<T[]>): undefined;
16
+ export declare function diffArrays<T>(oldArr: T[], newArr: T[], options: DiffArraysOptionsAbortable<T>): ChangeObject<T[]>[] | undefined;
17
+ export declare function diffArrays<T>(oldArr: T[], newArr: T[], options?: DiffArraysOptionsNonabortable<T>): ChangeObject<T[]>[];
18
+ export {};
19
+ //# sourceMappingURL=array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/diff/array.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,EAAC,YAAY,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,uBAAuB,EAAC,MAAM,aAAa,CAAC;AAExL,cAAM,SAAS,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAIxB,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAIpB,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;CAG5B;AAED,eAAO,MAAM,SAAS,oBAAkB,CAAC;AAEzC;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,MAAM,EAAE,CAAC,EAAE,EACX,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,EAAE,wBAAwB,CAAC,CAAC,EAAE,CAAC,GACrC,SAAS,CAAC;AACb,wBAAgB,UAAU,CAAC,CAAC,EAC1B,MAAM,EAAE,CAAC,EAAE,EACX,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,EAAE,0BAA0B,CAAC,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAAC,EAAE,CAAC,GACpE,SAAS,CAAA;AACZ,wBAAgB,UAAU,CAAC,CAAC,EAC1B,MAAM,EAAE,CAAC,EAAE,EACX,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,EAAE,6BAA6B,CAAC,CAAC,CAAC,GAAG,0BAA0B,CAAC,CAAC,EAAE,CAAC,GAC1E,SAAS,CAAA;AACZ,wBAAgB,UAAU,CAAC,CAAC,EAC1B,MAAM,EAAE,CAAC,EAAE,EACX,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,EAAE,0BAA0B,CAAC,CAAC,CAAC,GACrC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,CAAA;AAClC,wBAAgB,UAAU,CAAC,CAAC,EAC1B,MAAM,EAAE,CAAC,EAAE,EACX,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,CAAC,EAAE,6BAA6B,CAAC,CAAC,CAAC,GACzC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.arrayDiff = void 0;
19
+ exports.diffArrays = diffArrays;
20
+ var base_js_1 = require("./base.js");
21
+ var ArrayDiff = /** @class */ (function (_super) {
22
+ __extends(ArrayDiff, _super);
23
+ function ArrayDiff() {
24
+ return _super !== null && _super.apply(this, arguments) || this;
25
+ }
26
+ ArrayDiff.prototype.tokenize = function (value) {
27
+ return value.slice();
28
+ };
29
+ ArrayDiff.prototype.join = function (value) {
30
+ return value;
31
+ };
32
+ ArrayDiff.prototype.removeEmpty = function (value) {
33
+ return value;
34
+ };
35
+ return ArrayDiff;
36
+ }(base_js_1.default));
37
+ exports.arrayDiff = new ArrayDiff();
38
+ function diffArrays(oldArr, newArr, options) {
39
+ return exports.arrayDiff.diff(oldArr, newArr, options);
40
+ }
@@ -0,0 +1,20 @@
1
+ import type { ChangeObject, AllDiffOptions, AbortableDiffOptions, DiffCallbackNonabortable, CallbackOptionAbortable, CallbackOptionNonabortable } from '../types.js';
2
+ export default class Diff<TokenT, ValueT extends Iterable<TokenT> = Iterable<TokenT>, InputValueT = ValueT> {
3
+ diff(oldStr: InputValueT, newStr: InputValueT, options: DiffCallbackNonabortable<ValueT>): undefined;
4
+ diff(oldStr: InputValueT, newStr: InputValueT, options: AllDiffOptions & AbortableDiffOptions & CallbackOptionAbortable<ValueT>): undefined;
5
+ diff(oldStr: InputValueT, newStr: InputValueT, options: AllDiffOptions & CallbackOptionNonabortable<ValueT>): undefined;
6
+ diff(oldStr: InputValueT, newStr: InputValueT, options: AllDiffOptions & AbortableDiffOptions): ChangeObject<ValueT>[] | undefined;
7
+ diff(oldStr: InputValueT, newStr: InputValueT, options?: AllDiffOptions): ChangeObject<ValueT>[];
8
+ private diffWithOptionsObj;
9
+ private addToPath;
10
+ private extractCommon;
11
+ equals(left: TokenT, right: TokenT, options: AllDiffOptions): boolean;
12
+ removeEmpty(array: TokenT[]): TokenT[];
13
+ castInput(value: InputValueT, options: AllDiffOptions): ValueT;
14
+ tokenize(value: ValueT, options: AllDiffOptions): TokenT[];
15
+ join(chars: TokenT[]): ValueT;
16
+ postProcess(changeObjects: ChangeObject<ValueT>[], options: AllDiffOptions): ChangeObject<ValueT>[];
17
+ get useLongestToken(): boolean;
18
+ private buildValues;
19
+ }
20
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/diff/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,0BAA0B,EAA4D,MAAM,aAAa,CAAC;AAuB9N,MAAM,CAAC,OAAO,OAAO,IAAI,CACvB,MAAM,EACN,MAAM,SAAS,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,EAClD,WAAW,GAAG,MAAM;IAEpB,IAAI,CACF,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACxC,SAAS;IACZ,IAAI,CACF,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,cAAc,GAAG,oBAAoB,GAAG,uBAAuB,CAAC,MAAM,CAAC,GAC/E,SAAS;IACZ,IAAI,CACF,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,cAAc,GAAG,0BAA0B,CAAC,MAAM,CAAC,GAC3D,SAAS;IACZ,IAAI,CACF,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,cAAc,GAAG,oBAAoB,GAC7C,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS;IACrC,IAAI,CACF,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,cAAc,GACvB,YAAY,CAAC,MAAM,CAAC,EAAE;IAwBzB,OAAO,CAAC,kBAAkB;IA0I1B,OAAO,CAAC,SAAS;IAqBjB,OAAO,CAAC,aAAa;IA8BrB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO;IASrE,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAWtC,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM;IAK9D,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,EAAE;IAI1D,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IAQ7B,WAAW,CACT,aAAa,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,EAErC,OAAO,EAAE,cAAc,GACtB,YAAY,CAAC,MAAM,CAAC,EAAE;IAIzB,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED,OAAO,CAAC,WAAW;CAkDpB"}