appmap 0.60.0 → 0.62.1

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 (998) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -16
  3. data/ARCHITECTURE.md +68 -0
  4. data/CHANGELOG.md +33 -0
  5. data/exe/appmap-index +7 -0
  6. data/lib/appmap.rb +2 -0
  7. data/lib/appmap/agent.rb +0 -11
  8. data/lib/appmap/command/agent_setup/status.rb +1 -1
  9. data/lib/appmap/command/index.rb +25 -0
  10. data/lib/appmap/command/inspect.rb +0 -1
  11. data/lib/appmap/config.rb +8 -1
  12. data/lib/appmap/depends.rb +2 -0
  13. data/lib/appmap/depends/api.rb +84 -0
  14. data/lib/appmap/depends/configuration.rb +59 -0
  15. data/lib/appmap/depends/node_cli.rb +44 -0
  16. data/lib/appmap/depends/rake_tasks.rb +58 -0
  17. data/lib/appmap/depends/test_file_inspector.rb +89 -0
  18. data/lib/appmap/depends/test_runner.rb +106 -0
  19. data/lib/appmap/depends/util.rb +34 -0
  20. data/lib/appmap/service/integration_test_path_finder.rb +29 -25
  21. data/lib/appmap/service/test_command_provider.rb +5 -7
  22. data/lib/appmap/service/validator/config_validator.rb +9 -0
  23. data/lib/appmap/version.rb +1 -1
  24. data/node_modules/@appland/cli/CHANGELOG.md +96 -0
  25. data/node_modules/@appland/cli/package.json +49 -0
  26. data/node_modules/@appland/cli/src/appMapCatalog.js +39 -0
  27. data/node_modules/@appland/cli/src/appland/getAppMap.js +55 -0
  28. data/node_modules/@appland/cli/src/appland/listAppMaps.js +58 -0
  29. data/node_modules/@appland/cli/src/appland/settings.js +62 -0
  30. data/node_modules/@appland/cli/src/appland/types.d.ts +16 -0
  31. data/node_modules/@appland/cli/src/cli.js +576 -0
  32. data/node_modules/@appland/cli/src/database.js +197 -0
  33. data/node_modules/@appland/cli/src/depends.js +157 -0
  34. data/node_modules/@appland/cli/src/fingerprint/algorithms.js +71 -0
  35. data/node_modules/@appland/cli/src/fingerprint/canonicalize.js +70 -0
  36. data/node_modules/@appland/cli/src/fingerprint/canonicalize/base.js +58 -0
  37. data/node_modules/@appland/cli/src/fingerprint/canonicalize/classDependencies.js +36 -0
  38. data/node_modules/@appland/cli/src/fingerprint/canonicalize/classes.js +14 -0
  39. data/node_modules/@appland/cli/src/fingerprint/canonicalize/eventTree.js +19 -0
  40. data/node_modules/@appland/cli/src/fingerprint/canonicalize/httpClientRequests.js +18 -0
  41. data/node_modules/@appland/cli/src/fingerprint/canonicalize/httpServerRequests.js +18 -0
  42. data/node_modules/@appland/cli/src/fingerprint/canonicalize/info.js +55 -0
  43. data/node_modules/@appland/cli/src/fingerprint/canonicalize/labels.js +10 -0
  44. data/node_modules/@appland/cli/src/fingerprint/canonicalize/packageDependencies.js +36 -0
  45. data/node_modules/@appland/cli/src/fingerprint/canonicalize/packages.js +14 -0
  46. data/node_modules/@appland/cli/src/fingerprint/canonicalize/sqlNormalized.js +19 -0
  47. data/node_modules/@appland/cli/src/fingerprint/canonicalize/sqlTables.js +24 -0
  48. data/node_modules/@appland/cli/src/fingerprint/canonicalize/trace.js +57 -0
  49. data/node_modules/@appland/cli/src/fingerprint/canonicalize/unique.js +8 -0
  50. data/node_modules/@appland/cli/src/fingerprint/canonicalize/update.js +85 -0
  51. data/node_modules/@appland/cli/src/fingerprint/fingerprintDirectoryCommand.js +30 -0
  52. data/node_modules/@appland/cli/src/fingerprint/fingerprintQueue.js +30 -0
  53. data/node_modules/@appland/cli/src/fingerprint/fingerprintWatchCommand.js +64 -0
  54. data/node_modules/@appland/cli/src/fingerprint/fingerprinter.js +186 -0
  55. data/node_modules/@appland/cli/src/fingerprint/index.js +24 -0
  56. data/node_modules/@appland/cli/src/functionStats.js +168 -0
  57. data/node_modules/@appland/cli/src/inspect.js +7 -0
  58. data/node_modules/@appland/cli/src/inspect/fields.js +66 -0
  59. data/node_modules/@appland/cli/src/inspect/filter.js +105 -0
  60. data/node_modules/@appland/cli/src/inspect/home.js +64 -0
  61. data/node_modules/@appland/cli/src/inspect/print.js +231 -0
  62. data/node_modules/@appland/cli/src/inspect/reset.js +10 -0
  63. data/node_modules/@appland/cli/src/inspect/types.d.ts +11 -0
  64. data/node_modules/@appland/cli/src/inspect/undoFilter.js +10 -0
  65. data/node_modules/@appland/cli/src/inventoryCommand.js +59 -0
  66. data/node_modules/@appland/cli/src/search/codeObjectMatcher.js +75 -0
  67. data/node_modules/@appland/cli/src/search/constants.js +5 -0
  68. data/node_modules/@appland/cli/src/search/findCodeObjects.js +293 -0
  69. data/node_modules/@appland/cli/src/search/findEvents.js +184 -0
  70. data/node_modules/@appland/cli/src/search/matchFilter.js +65 -0
  71. data/node_modules/@appland/cli/src/search/matchSpec.js +198 -0
  72. data/node_modules/@appland/cli/src/search/trigram.js +107 -0
  73. data/node_modules/@appland/cli/src/search/types.d.ts +107 -0
  74. data/node_modules/@appland/cli/src/search/utils.js +4 -0
  75. data/node_modules/@appland/cli/src/swagger/README.md +75 -0
  76. data/node_modules/@appland/cli/src/swagger/command.js +42 -0
  77. data/node_modules/@appland/cli/src/swagger/method.js +173 -0
  78. data/node_modules/@appland/cli/src/swagger/model.js +54 -0
  79. data/node_modules/@appland/cli/src/swagger/path.js +38 -0
  80. data/node_modules/@appland/cli/src/swagger/response.js +34 -0
  81. data/node_modules/@appland/cli/src/swagger/schema.js +38 -0
  82. data/node_modules/@appland/cli/src/swagger/securitySchemes.js +60 -0
  83. data/node_modules/@appland/cli/src/swagger/settings.js +9 -0
  84. data/node_modules/@appland/cli/src/swagger/util.js +79 -0
  85. data/node_modules/@appland/cli/src/utils.js +164 -0
  86. data/node_modules/@appland/cli/tests/unit/depends.spec.js +55 -0
  87. data/node_modules/@appland/cli/tests/unit/fingerprint/canonicalize.spec.js +42 -0
  88. data/node_modules/@appland/cli/tests/unit/fingerprint/sql.spec.js +40 -0
  89. data/node_modules/@appland/cli/tests/unit/fixtures/app/controllers/organizations_controller.rb +1 -0
  90. data/node_modules/@appland/cli/tests/unit/fixtures/app/models/configuration.rb +1 -0
  91. data/node_modules/@appland/cli/tests/unit/fixtures/app/models/show.rb +1 -0
  92. data/node_modules/@appland/cli/tests/unit/fixtures/app/models/user.rb +1 -0
  93. data/node_modules/@appland/cli/tests/unit/fixtures/canonicalize/revoke_api_key.info.json +246 -0
  94. data/node_modules/@appland/cli/tests/unit/fixtures/canonicalize/revoke_api_key.trace.json +289 -0
  95. data/node_modules/@appland/cli/tests/unit/fixtures/canonicalize/revoke_api_key.update.json +78 -0
  96. data/node_modules/@appland/cli/tests/unit/fixtures/revoke_api_key.appmap.json +899 -0
  97. data/node_modules/@appland/cli/tests/unit/fixtures/user_page_scenario.appmap.json +1774 -0
  98. data/node_modules/@appland/cli/tests/unit/inspect.spec.js +94 -0
  99. data/node_modules/@appland/models/CHANGELOG.md +83 -0
  100. data/node_modules/@appland/models/README.md +8 -0
  101. data/node_modules/@appland/models/dist/index.cjs +4250 -0
  102. data/node_modules/@appland/models/dist/index.js +4193 -0
  103. data/node_modules/@appland/models/package.json +50 -0
  104. data/node_modules/@rollup/plugin-alias/CHANGELOG.md +92 -0
  105. data/node_modules/@rollup/plugin-alias/LICENSE +21 -0
  106. data/node_modules/@rollup/plugin-alias/README.md +174 -0
  107. data/node_modules/@rollup/plugin-alias/dist/index.es.js +95 -0
  108. data/node_modules/@rollup/plugin-alias/dist/index.js +101 -0
  109. data/node_modules/@rollup/plugin-alias/package.json +78 -0
  110. data/node_modules/@rollup/plugin-alias/types/index.d.ts +36 -0
  111. data/node_modules/ansi-regex/index.d.ts +37 -0
  112. data/node_modules/ansi-regex/index.js +10 -0
  113. data/node_modules/ansi-regex/license +9 -0
  114. data/node_modules/ansi-regex/package.json +55 -0
  115. data/node_modules/ansi-regex/readme.md +78 -0
  116. data/node_modules/ansi-styles/index.d.ts +345 -0
  117. data/node_modules/ansi-styles/index.js +163 -0
  118. data/node_modules/ansi-styles/license +9 -0
  119. data/node_modules/ansi-styles/package.json +56 -0
  120. data/node_modules/ansi-styles/readme.md +152 -0
  121. data/node_modules/anymatch/LICENSE +15 -0
  122. data/node_modules/anymatch/README.md +87 -0
  123. data/node_modules/anymatch/index.d.ts +19 -0
  124. data/node_modules/anymatch/index.js +104 -0
  125. data/node_modules/anymatch/package.json +48 -0
  126. data/node_modules/argparse/CHANGELOG.md +185 -0
  127. data/node_modules/argparse/LICENSE +21 -0
  128. data/node_modules/argparse/README.md +257 -0
  129. data/node_modules/argparse/index.js +3 -0
  130. data/node_modules/argparse/lib/action.js +146 -0
  131. data/node_modules/argparse/lib/action/append.js +53 -0
  132. data/node_modules/argparse/lib/action/append/constant.js +47 -0
  133. data/node_modules/argparse/lib/action/count.js +40 -0
  134. data/node_modules/argparse/lib/action/help.js +47 -0
  135. data/node_modules/argparse/lib/action/store.js +50 -0
  136. data/node_modules/argparse/lib/action/store/constant.js +43 -0
  137. data/node_modules/argparse/lib/action/store/false.js +27 -0
  138. data/node_modules/argparse/lib/action/store/true.js +26 -0
  139. data/node_modules/argparse/lib/action/subparsers.js +149 -0
  140. data/node_modules/argparse/lib/action/version.js +47 -0
  141. data/node_modules/argparse/lib/action_container.js +482 -0
  142. data/node_modules/argparse/lib/argparse.js +14 -0
  143. data/node_modules/argparse/lib/argument/error.js +50 -0
  144. data/node_modules/argparse/lib/argument/exclusive.js +54 -0
  145. data/node_modules/argparse/lib/argument/group.js +75 -0
  146. data/node_modules/argparse/lib/argument_parser.js +1161 -0
  147. data/node_modules/argparse/lib/const.js +21 -0
  148. data/node_modules/argparse/lib/help/added_formatters.js +87 -0
  149. data/node_modules/argparse/lib/help/formatter.js +795 -0
  150. data/node_modules/argparse/lib/namespace.js +76 -0
  151. data/node_modules/argparse/lib/utils.js +57 -0
  152. data/node_modules/argparse/package.json +34 -0
  153. data/node_modules/async/CHANGELOG.md +331 -0
  154. data/node_modules/async/LICENSE +19 -0
  155. data/node_modules/async/README.md +60 -0
  156. data/node_modules/async/all.js +54 -0
  157. data/node_modules/async/allLimit.js +46 -0
  158. data/node_modules/async/allSeries.js +45 -0
  159. data/node_modules/async/any.js +56 -0
  160. data/node_modules/async/anyLimit.js +47 -0
  161. data/node_modules/async/anySeries.js +46 -0
  162. data/node_modules/async/apply.js +55 -0
  163. data/node_modules/async/applyEach.js +57 -0
  164. data/node_modules/async/applyEachSeries.js +37 -0
  165. data/node_modules/async/asyncify.js +118 -0
  166. data/node_modules/async/auto.js +267 -0
  167. data/node_modules/async/autoInject.js +156 -0
  168. data/node_modules/async/bower.json +17 -0
  169. data/node_modules/async/cargo.js +63 -0
  170. data/node_modules/async/cargoQueue.js +71 -0
  171. data/node_modules/async/compose.js +55 -0
  172. data/node_modules/async/concat.js +47 -0
  173. data/node_modules/async/concatLimit.js +60 -0
  174. data/node_modules/async/concatSeries.js +41 -0
  175. data/node_modules/async/constant.js +55 -0
  176. data/node_modules/async/detect.js +61 -0
  177. data/node_modules/async/detectLimit.js +48 -0
  178. data/node_modules/async/detectSeries.js +47 -0
  179. data/node_modules/async/dir.js +43 -0
  180. data/node_modules/async/dist/async.js +4846 -0
  181. data/node_modules/async/dist/async.min.js +1 -0
  182. data/node_modules/async/dist/async.mjs +4734 -0
  183. data/node_modules/async/doDuring.js +68 -0
  184. data/node_modules/async/doUntil.js +46 -0
  185. data/node_modules/async/doWhilst.js +68 -0
  186. data/node_modules/async/during.js +78 -0
  187. data/node_modules/async/each.js +88 -0
  188. data/node_modules/async/eachLimit.js +50 -0
  189. data/node_modules/async/eachOf.js +116 -0
  190. data/node_modules/async/eachOfLimit.js +47 -0
  191. data/node_modules/async/eachOfSeries.js +39 -0
  192. data/node_modules/async/eachSeries.js +44 -0
  193. data/node_modules/async/ensureAsync.js +67 -0
  194. data/node_modules/async/every.js +54 -0
  195. data/node_modules/async/everyLimit.js +46 -0
  196. data/node_modules/async/everySeries.js +45 -0
  197. data/node_modules/async/filter.js +53 -0
  198. data/node_modules/async/filterLimit.js +45 -0
  199. data/node_modules/async/filterSeries.js +43 -0
  200. data/node_modules/async/find.js +61 -0
  201. data/node_modules/async/findLimit.js +48 -0
  202. data/node_modules/async/findSeries.js +47 -0
  203. data/node_modules/async/flatMap.js +47 -0
  204. data/node_modules/async/flatMapLimit.js +60 -0
  205. data/node_modules/async/flatMapSeries.js +41 -0
  206. data/node_modules/async/foldl.js +77 -0
  207. data/node_modules/async/foldr.js +41 -0
  208. data/node_modules/async/forEach.js +88 -0
  209. data/node_modules/async/forEachLimit.js +50 -0
  210. data/node_modules/async/forEachOf.js +116 -0
  211. data/node_modules/async/forEachOfLimit.js +47 -0
  212. data/node_modules/async/forEachOfSeries.js +39 -0
  213. data/node_modules/async/forEachSeries.js +44 -0
  214. data/node_modules/async/forever.js +68 -0
  215. data/node_modules/async/groupBy.js +54 -0
  216. data/node_modules/async/groupByLimit.js +71 -0
  217. data/node_modules/async/groupBySeries.js +36 -0
  218. data/node_modules/async/index.js +588 -0
  219. data/node_modules/async/inject.js +77 -0
  220. data/node_modules/async/internal/DoublyLinkedList.js +92 -0
  221. data/node_modules/async/internal/Heap.js +120 -0
  222. data/node_modules/async/internal/applyEach.js +29 -0
  223. data/node_modules/async/internal/asyncEachOfLimit.js +75 -0
  224. data/node_modules/async/internal/awaitify.js +27 -0
  225. data/node_modules/async/internal/breakLoop.js +10 -0
  226. data/node_modules/async/internal/consoleFunc.js +27 -0
  227. data/node_modules/async/internal/createTester.js +40 -0
  228. data/node_modules/async/internal/eachOfLimit.js +90 -0
  229. data/node_modules/async/internal/filter.js +55 -0
  230. data/node_modules/async/internal/getIterator.js +11 -0
  231. data/node_modules/async/internal/initialParams.js +14 -0
  232. data/node_modules/async/internal/isArrayLike.js +10 -0
  233. data/node_modules/async/internal/iterator.js +54 -0
  234. data/node_modules/async/internal/map.js +30 -0
  235. data/node_modules/async/internal/once.js +17 -0
  236. data/node_modules/async/internal/onlyOnce.js +15 -0
  237. data/node_modules/async/internal/parallel.js +34 -0
  238. data/node_modules/async/internal/promiseCallback.js +23 -0
  239. data/node_modules/async/internal/queue.js +291 -0
  240. data/node_modules/async/internal/range.js +14 -0
  241. data/node_modules/async/internal/reject.js +26 -0
  242. data/node_modules/async/internal/setImmediate.js +30 -0
  243. data/node_modules/async/internal/withoutIndex.js +10 -0
  244. data/node_modules/async/internal/wrapAsync.js +34 -0
  245. data/node_modules/async/log.js +41 -0
  246. data/node_modules/async/map.js +62 -0
  247. data/node_modules/async/mapLimit.js +45 -0
  248. data/node_modules/async/mapSeries.js +44 -0
  249. data/node_modules/async/mapValues.js +62 -0
  250. data/node_modules/async/mapValuesLimit.js +61 -0
  251. data/node_modules/async/mapValuesSeries.js +37 -0
  252. data/node_modules/async/memoize.js +91 -0
  253. data/node_modules/async/nextTick.js +52 -0
  254. data/node_modules/async/package.json +82 -0
  255. data/node_modules/async/parallel.js +91 -0
  256. data/node_modules/async/parallelLimit.js +41 -0
  257. data/node_modules/async/priorityQueue.js +84 -0
  258. data/node_modules/async/queue.js +167 -0
  259. data/node_modules/async/race.js +67 -0
  260. data/node_modules/async/reduce.js +77 -0
  261. data/node_modules/async/reduceRight.js +41 -0
  262. data/node_modules/async/reflect.js +78 -0
  263. data/node_modules/async/reflectAll.js +93 -0
  264. data/node_modules/async/reject.js +53 -0
  265. data/node_modules/async/rejectLimit.js +45 -0
  266. data/node_modules/async/rejectSeries.js +43 -0
  267. data/node_modules/async/retry.js +159 -0
  268. data/node_modules/async/retryable.js +77 -0
  269. data/node_modules/async/select.js +53 -0
  270. data/node_modules/async/selectLimit.js +45 -0
  271. data/node_modules/async/selectSeries.js +43 -0
  272. data/node_modules/async/seq.js +79 -0
  273. data/node_modules/async/series.js +86 -0
  274. data/node_modules/async/setImmediate.js +45 -0
  275. data/node_modules/async/some.js +56 -0
  276. data/node_modules/async/someLimit.js +47 -0
  277. data/node_modules/async/someSeries.js +46 -0
  278. data/node_modules/async/sortBy.js +88 -0
  279. data/node_modules/async/timeout.js +89 -0
  280. data/node_modules/async/times.js +50 -0
  281. data/node_modules/async/timesLimit.js +43 -0
  282. data/node_modules/async/timesSeries.js +32 -0
  283. data/node_modules/async/transform.js +81 -0
  284. data/node_modules/async/tryEach.js +78 -0
  285. data/node_modules/async/unmemoize.js +25 -0
  286. data/node_modules/async/until.js +61 -0
  287. data/node_modules/async/waterfall.js +105 -0
  288. data/node_modules/async/whilst.js +78 -0
  289. data/node_modules/async/wrapSync.js +118 -0
  290. data/node_modules/at-least-node/LICENSE +6 -0
  291. data/node_modules/at-least-node/README.md +25 -0
  292. data/node_modules/at-least-node/index.js +5 -0
  293. data/node_modules/at-least-node/package.json +32 -0
  294. data/node_modules/balanced-match/LICENSE.md +21 -0
  295. data/node_modules/balanced-match/README.md +97 -0
  296. data/node_modules/balanced-match/index.js +62 -0
  297. data/node_modules/balanced-match/package.json +48 -0
  298. data/node_modules/binary-extensions/binary-extensions.json +260 -0
  299. data/node_modules/binary-extensions/binary-extensions.json.d.ts +3 -0
  300. data/node_modules/binary-extensions/index.d.ts +14 -0
  301. data/node_modules/binary-extensions/index.js +1 -0
  302. data/node_modules/binary-extensions/license +9 -0
  303. data/node_modules/binary-extensions/package.json +38 -0
  304. data/node_modules/binary-extensions/readme.md +41 -0
  305. data/node_modules/brace-expansion/LICENSE +21 -0
  306. data/node_modules/brace-expansion/README.md +129 -0
  307. data/node_modules/brace-expansion/index.js +201 -0
  308. data/node_modules/brace-expansion/package.json +47 -0
  309. data/node_modules/braces/CHANGELOG.md +184 -0
  310. data/node_modules/braces/LICENSE +21 -0
  311. data/node_modules/braces/README.md +593 -0
  312. data/node_modules/braces/index.js +170 -0
  313. data/node_modules/braces/lib/compile.js +57 -0
  314. data/node_modules/braces/lib/constants.js +57 -0
  315. data/node_modules/braces/lib/expand.js +113 -0
  316. data/node_modules/braces/lib/parse.js +333 -0
  317. data/node_modules/braces/lib/stringify.js +32 -0
  318. data/node_modules/braces/lib/utils.js +112 -0
  319. data/node_modules/braces/package.json +77 -0
  320. data/node_modules/chokidar/LICENSE +21 -0
  321. data/node_modules/chokidar/README.md +308 -0
  322. data/node_modules/chokidar/index.js +973 -0
  323. data/node_modules/chokidar/lib/constants.js +65 -0
  324. data/node_modules/chokidar/lib/fsevents-handler.js +524 -0
  325. data/node_modules/chokidar/lib/nodefs-handler.js +646 -0
  326. data/node_modules/chokidar/package.json +78 -0
  327. data/node_modules/chokidar/types/index.d.ts +187 -0
  328. data/node_modules/cli-progress/CHANGES.md +169 -0
  329. data/node_modules/cli-progress/LICENSE.md +24 -0
  330. data/node_modules/cli-progress/README.md +446 -0
  331. data/node_modules/cli-progress/cli-progress.js +21 -0
  332. data/node_modules/cli-progress/lib/eta.js +73 -0
  333. data/node_modules/cli-progress/lib/format-bar.js +11 -0
  334. data/node_modules/cli-progress/lib/format-time.js +34 -0
  335. data/node_modules/cli-progress/lib/format-value.js +22 -0
  336. data/node_modules/cli-progress/lib/formatter.js +80 -0
  337. data/node_modules/cli-progress/lib/generic-bar.js +212 -0
  338. data/node_modules/cli-progress/lib/multi-bar.js +201 -0
  339. data/node_modules/cli-progress/lib/options.js +95 -0
  340. data/node_modules/cli-progress/lib/single-bar.js +124 -0
  341. data/node_modules/cli-progress/lib/terminal.js +159 -0
  342. data/node_modules/cli-progress/package.json +46 -0
  343. data/node_modules/cli-progress/presets/index.js +11 -0
  344. data/node_modules/cli-progress/presets/legacy.js +6 -0
  345. data/node_modules/cli-progress/presets/rect.js +5 -0
  346. data/node_modules/cli-progress/presets/shades-classic.js +6 -0
  347. data/node_modules/cli-progress/presets/shades-grey.js +8 -0
  348. data/node_modules/cliui/CHANGELOG.md +121 -0
  349. data/node_modules/cliui/LICENSE.txt +14 -0
  350. data/node_modules/cliui/README.md +141 -0
  351. data/node_modules/cliui/build/index.cjs +302 -0
  352. data/node_modules/cliui/build/lib/index.js +287 -0
  353. data/node_modules/cliui/build/lib/string-utils.js +27 -0
  354. data/node_modules/cliui/index.mjs +13 -0
  355. data/node_modules/cliui/package.json +83 -0
  356. data/node_modules/color-convert/CHANGELOG.md +54 -0
  357. data/node_modules/color-convert/LICENSE +21 -0
  358. data/node_modules/color-convert/README.md +68 -0
  359. data/node_modules/color-convert/conversions.js +839 -0
  360. data/node_modules/color-convert/index.js +81 -0
  361. data/node_modules/color-convert/package.json +48 -0
  362. data/node_modules/color-convert/route.js +97 -0
  363. data/node_modules/color-name/LICENSE +8 -0
  364. data/node_modules/color-name/README.md +11 -0
  365. data/node_modules/color-name/index.js +152 -0
  366. data/node_modules/color-name/package.json +28 -0
  367. data/node_modules/colors/LICENSE +25 -0
  368. data/node_modules/colors/README.md +221 -0
  369. data/node_modules/colors/examples/normal-usage.js +82 -0
  370. data/node_modules/colors/examples/safe-string.js +79 -0
  371. data/node_modules/colors/index.d.ts +136 -0
  372. data/node_modules/colors/lib/colors.js +211 -0
  373. data/node_modules/colors/lib/custom/trap.js +46 -0
  374. data/node_modules/colors/lib/custom/zalgo.js +110 -0
  375. data/node_modules/colors/lib/extendStringPrototype.js +110 -0
  376. data/node_modules/colors/lib/index.js +13 -0
  377. data/node_modules/colors/lib/maps/america.js +10 -0
  378. data/node_modules/colors/lib/maps/rainbow.js +12 -0
  379. data/node_modules/colors/lib/maps/random.js +11 -0
  380. data/node_modules/colors/lib/maps/zebra.js +5 -0
  381. data/node_modules/colors/lib/styles.js +95 -0
  382. data/node_modules/colors/lib/system/has-flag.js +35 -0
  383. data/node_modules/colors/lib/system/supports-colors.js +151 -0
  384. data/node_modules/colors/package.json +45 -0
  385. data/node_modules/colors/safe.d.ts +48 -0
  386. data/node_modules/colors/safe.js +10 -0
  387. data/node_modules/colors/themes/generic-logging.js +12 -0
  388. data/node_modules/concat-map/LICENSE +18 -0
  389. data/node_modules/concat-map/README.markdown +62 -0
  390. data/node_modules/concat-map/example/map.js +6 -0
  391. data/node_modules/concat-map/index.js +13 -0
  392. data/node_modules/concat-map/package.json +43 -0
  393. data/node_modules/concat-map/test/map.js +39 -0
  394. data/node_modules/console-table-printer/CHANGELOG.md +96 -0
  395. data/node_modules/console-table-printer/LICENSE +21 -0
  396. data/node_modules/console-table-printer/README.md +180 -0
  397. data/node_modules/console-table-printer/dist/index.d.ts +4 -0
  398. data/node_modules/console-table-printer/dist/index.js +10 -0
  399. data/node_modules/console-table-printer/dist/src/console-table-printer.d.ts +14 -0
  400. data/node_modules/console-table-printer/dist/src/console-table-printer.js +32 -0
  401. data/node_modules/console-table-printer/dist/src/internalTable/input-converter.d.ts +6 -0
  402. data/node_modules/console-table-printer/dist/src/internalTable/input-converter.js +15 -0
  403. data/node_modules/console-table-printer/dist/src/internalTable/internal-table-printer.d.ts +4 -0
  404. data/node_modules/console-table-printer/dist/src/internalTable/internal-table-printer.js +115 -0
  405. data/node_modules/console-table-printer/dist/src/internalTable/internal-table.d.ts +25 -0
  406. data/node_modules/console-table-printer/dist/src/internalTable/internal-table.js +80 -0
  407. data/node_modules/console-table-printer/dist/src/internalTable/table-pre-processors.d.ts +3 -0
  408. data/node_modules/console-table-printer/dist/src/internalTable/table-pre-processors.js +43 -0
  409. data/node_modules/console-table-printer/dist/src/models/common.d.ts +10 -0
  410. data/node_modules/console-table-printer/dist/src/models/common.js +2 -0
  411. data/node_modules/console-table-printer/dist/src/models/external-table.d.ts +26 -0
  412. data/node_modules/console-table-printer/dist/src/models/external-table.js +2 -0
  413. data/node_modules/console-table-printer/dist/src/models/internal-table.d.ts +21 -0
  414. data/node_modules/console-table-printer/dist/src/models/internal-table.js +2 -0
  415. data/node_modules/console-table-printer/dist/src/utils/colored-console-line.d.ts +8 -0
  416. data/node_modules/console-table-printer/dist/src/utils/colored-console-line.js +29 -0
  417. data/node_modules/console-table-printer/dist/src/utils/console-utils.d.ts +2 -0
  418. data/node_modules/console-table-printer/dist/src/utils/console-utils.js +8 -0
  419. data/node_modules/console-table-printer/dist/src/utils/string-utils.d.ts +4 -0
  420. data/node_modules/console-table-printer/dist/src/utils/string-utils.js +54 -0
  421. data/node_modules/console-table-printer/dist/src/utils/table-constants.d.ts +10 -0
  422. data/node_modules/console-table-printer/dist/src/utils/table-constants.js +49 -0
  423. data/node_modules/console-table-printer/dist/src/utils/table-helpers.d.ts +26 -0
  424. data/node_modules/console-table-printer/dist/src/utils/table-helpers.js +91 -0
  425. data/node_modules/console-table-printer/package.json +51 -0
  426. data/node_modules/cross-env/CHANGELOG.md +5 -0
  427. data/node_modules/cross-env/LICENSE +20 -0
  428. data/node_modules/cross-env/README.md +291 -0
  429. data/node_modules/cross-env/package.json +54 -0
  430. data/node_modules/cross-env/src/bin/cross-env-shell.js +5 -0
  431. data/node_modules/cross-env/src/bin/cross-env.js +5 -0
  432. data/node_modules/cross-env/src/command.js +32 -0
  433. data/node_modules/cross-env/src/index.js +95 -0
  434. data/node_modules/cross-env/src/is-windows.js +2 -0
  435. data/node_modules/cross-env/src/variable.js +69 -0
  436. data/node_modules/cross-spawn/CHANGELOG.md +130 -0
  437. data/node_modules/cross-spawn/LICENSE +21 -0
  438. data/node_modules/cross-spawn/README.md +96 -0
  439. data/node_modules/cross-spawn/index.js +39 -0
  440. data/node_modules/cross-spawn/lib/enoent.js +59 -0
  441. data/node_modules/cross-spawn/lib/parse.js +91 -0
  442. data/node_modules/cross-spawn/lib/util/escape.js +45 -0
  443. data/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
  444. data/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
  445. data/node_modules/cross-spawn/package.json +73 -0
  446. data/node_modules/crypto-js/CONTRIBUTING.md +28 -0
  447. data/node_modules/crypto-js/LICENSE +24 -0
  448. data/node_modules/crypto-js/README.md +249 -0
  449. data/node_modules/crypto-js/aes.js +234 -0
  450. data/node_modules/crypto-js/bower.json +35 -0
  451. data/node_modules/crypto-js/cipher-core.js +890 -0
  452. data/node_modules/crypto-js/core.js +797 -0
  453. data/node_modules/crypto-js/crypto-js.js +6059 -0
  454. data/node_modules/crypto-js/docs/QuickStartGuide.wiki +470 -0
  455. data/node_modules/crypto-js/enc-base64.js +136 -0
  456. data/node_modules/crypto-js/enc-hex.js +18 -0
  457. data/node_modules/crypto-js/enc-latin1.js +18 -0
  458. data/node_modules/crypto-js/enc-utf16.js +149 -0
  459. data/node_modules/crypto-js/enc-utf8.js +18 -0
  460. data/node_modules/crypto-js/evpkdf.js +134 -0
  461. data/node_modules/crypto-js/format-hex.js +66 -0
  462. data/node_modules/crypto-js/format-openssl.js +18 -0
  463. data/node_modules/crypto-js/hmac-md5.js +18 -0
  464. data/node_modules/crypto-js/hmac-ripemd160.js +18 -0
  465. data/node_modules/crypto-js/hmac-sha1.js +18 -0
  466. data/node_modules/crypto-js/hmac-sha224.js +18 -0
  467. data/node_modules/crypto-js/hmac-sha256.js +18 -0
  468. data/node_modules/crypto-js/hmac-sha3.js +18 -0
  469. data/node_modules/crypto-js/hmac-sha384.js +18 -0
  470. data/node_modules/crypto-js/hmac-sha512.js +18 -0
  471. data/node_modules/crypto-js/hmac.js +143 -0
  472. data/node_modules/crypto-js/index.js +18 -0
  473. data/node_modules/crypto-js/lib-typedarrays.js +76 -0
  474. data/node_modules/crypto-js/md5.js +268 -0
  475. data/node_modules/crypto-js/mode-cfb.js +80 -0
  476. data/node_modules/crypto-js/mode-ctr-gladman.js +116 -0
  477. data/node_modules/crypto-js/mode-ctr.js +58 -0
  478. data/node_modules/crypto-js/mode-ecb.js +40 -0
  479. data/node_modules/crypto-js/mode-ofb.js +54 -0
  480. data/node_modules/crypto-js/package.json +38 -0
  481. data/node_modules/crypto-js/pad-ansix923.js +49 -0
  482. data/node_modules/crypto-js/pad-iso10126.js +44 -0
  483. data/node_modules/crypto-js/pad-iso97971.js +40 -0
  484. data/node_modules/crypto-js/pad-nopadding.js +30 -0
  485. data/node_modules/crypto-js/pad-pkcs7.js +18 -0
  486. data/node_modules/crypto-js/pad-zeropadding.js +47 -0
  487. data/node_modules/crypto-js/pbkdf2.js +145 -0
  488. data/node_modules/crypto-js/rabbit-legacy.js +190 -0
  489. data/node_modules/crypto-js/rabbit.js +192 -0
  490. data/node_modules/crypto-js/rc4.js +139 -0
  491. data/node_modules/crypto-js/ripemd160.js +267 -0
  492. data/node_modules/crypto-js/sha1.js +150 -0
  493. data/node_modules/crypto-js/sha224.js +80 -0
  494. data/node_modules/crypto-js/sha256.js +199 -0
  495. data/node_modules/crypto-js/sha3.js +326 -0
  496. data/node_modules/crypto-js/sha384.js +83 -0
  497. data/node_modules/crypto-js/sha512.js +326 -0
  498. data/node_modules/crypto-js/tripledes.js +779 -0
  499. data/node_modules/crypto-js/x64-core.js +304 -0
  500. data/node_modules/diff/CONTRIBUTING.md +39 -0
  501. data/node_modules/diff/LICENSE +31 -0
  502. data/node_modules/diff/README.md +208 -0
  503. data/node_modules/diff/dist/diff.js +1582 -0
  504. data/node_modules/diff/lib/convert/dmp.js +32 -0
  505. data/node_modules/diff/lib/convert/xml.js +42 -0
  506. data/node_modules/diff/lib/diff/array.js +45 -0
  507. data/node_modules/diff/lib/diff/base.js +304 -0
  508. data/node_modules/diff/lib/diff/character.js +37 -0
  509. data/node_modules/diff/lib/diff/css.js +41 -0
  510. data/node_modules/diff/lib/diff/json.js +163 -0
  511. data/node_modules/diff/lib/diff/line.js +89 -0
  512. data/node_modules/diff/lib/diff/sentence.js +41 -0
  513. data/node_modules/diff/lib/diff/word.js +108 -0
  514. data/node_modules/diff/lib/index.es6.js +1553 -0
  515. data/node_modules/diff/lib/index.js +216 -0
  516. data/node_modules/diff/lib/index.mjs +1553 -0
  517. data/node_modules/diff/lib/patch/apply.js +238 -0
  518. data/node_modules/diff/lib/patch/create.js +267 -0
  519. data/node_modules/diff/lib/patch/merge.js +613 -0
  520. data/node_modules/diff/lib/patch/parse.js +167 -0
  521. data/node_modules/diff/lib/util/array.js +32 -0
  522. data/node_modules/diff/lib/util/distance-iterator.js +57 -0
  523. data/node_modules/diff/lib/util/params.js +24 -0
  524. data/node_modules/diff/package.json +87 -0
  525. data/node_modules/diff/release-notes.md +303 -0
  526. data/node_modules/diff/runtime.js +3 -0
  527. data/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  528. data/node_modules/emoji-regex/README.md +73 -0
  529. data/node_modules/emoji-regex/es2015/index.js +6 -0
  530. data/node_modules/emoji-regex/es2015/text.js +6 -0
  531. data/node_modules/emoji-regex/index.d.ts +23 -0
  532. data/node_modules/emoji-regex/index.js +6 -0
  533. data/node_modules/emoji-regex/package.json +50 -0
  534. data/node_modules/emoji-regex/text.js +6 -0
  535. data/node_modules/escalade/dist/index.js +22 -0
  536. data/node_modules/escalade/dist/index.mjs +22 -0
  537. data/node_modules/escalade/index.d.ts +3 -0
  538. data/node_modules/escalade/license +9 -0
  539. data/node_modules/escalade/package.json +61 -0
  540. data/node_modules/escalade/readme.md +211 -0
  541. data/node_modules/escalade/sync/index.d.ts +2 -0
  542. data/node_modules/escalade/sync/index.js +18 -0
  543. data/node_modules/escalade/sync/index.mjs +18 -0
  544. data/node_modules/esprima/ChangeLog +235 -0
  545. data/node_modules/esprima/LICENSE.BSD +21 -0
  546. data/node_modules/esprima/README.md +46 -0
  547. data/node_modules/esprima/bin/esparse.js +139 -0
  548. data/node_modules/esprima/bin/esvalidate.js +236 -0
  549. data/node_modules/esprima/dist/esprima.js +6709 -0
  550. data/node_modules/esprima/package.json +112 -0
  551. data/node_modules/fill-range/LICENSE +21 -0
  552. data/node_modules/fill-range/README.md +237 -0
  553. data/node_modules/fill-range/index.js +249 -0
  554. data/node_modules/fill-range/package.json +69 -0
  555. data/node_modules/fs-extra/CHANGELOG.md +902 -0
  556. data/node_modules/fs-extra/LICENSE +15 -0
  557. data/node_modules/fs-extra/README.md +264 -0
  558. data/node_modules/fs-extra/lib/copy-sync/copy-sync.js +166 -0
  559. data/node_modules/fs-extra/lib/copy-sync/index.js +5 -0
  560. data/node_modules/fs-extra/lib/copy/copy.js +232 -0
  561. data/node_modules/fs-extra/lib/copy/index.js +6 -0
  562. data/node_modules/fs-extra/lib/empty/index.js +48 -0
  563. data/node_modules/fs-extra/lib/ensure/file.js +69 -0
  564. data/node_modules/fs-extra/lib/ensure/index.js +23 -0
  565. data/node_modules/fs-extra/lib/ensure/link.js +61 -0
  566. data/node_modules/fs-extra/lib/ensure/symlink-paths.js +99 -0
  567. data/node_modules/fs-extra/lib/ensure/symlink-type.js +31 -0
  568. data/node_modules/fs-extra/lib/ensure/symlink.js +63 -0
  569. data/node_modules/fs-extra/lib/fs/index.js +130 -0
  570. data/node_modules/fs-extra/lib/index.js +27 -0
  571. data/node_modules/fs-extra/lib/json/index.js +16 -0
  572. data/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
  573. data/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
  574. data/node_modules/fs-extra/lib/json/output-json.js +12 -0
  575. data/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
  576. data/node_modules/fs-extra/lib/mkdirs/make-dir.js +141 -0
  577. data/node_modules/fs-extra/lib/move-sync/index.js +5 -0
  578. data/node_modules/fs-extra/lib/move-sync/move-sync.js +47 -0
  579. data/node_modules/fs-extra/lib/move/index.js +6 -0
  580. data/node_modules/fs-extra/lib/move/move.js +65 -0
  581. data/node_modules/fs-extra/lib/output/index.js +40 -0
  582. data/node_modules/fs-extra/lib/path-exists/index.js +12 -0
  583. data/node_modules/fs-extra/lib/remove/index.js +9 -0
  584. data/node_modules/fs-extra/lib/remove/rimraf.js +302 -0
  585. data/node_modules/fs-extra/lib/util/stat.js +139 -0
  586. data/node_modules/fs-extra/lib/util/utimes.js +26 -0
  587. data/node_modules/fs-extra/package.json +70 -0
  588. data/node_modules/fs.realpath/LICENSE +43 -0
  589. data/node_modules/fs.realpath/README.md +33 -0
  590. data/node_modules/fs.realpath/index.js +66 -0
  591. data/node_modules/fs.realpath/old.js +303 -0
  592. data/node_modules/fs.realpath/package.json +26 -0
  593. data/node_modules/fsevents/LICENSE +22 -0
  594. data/node_modules/fsevents/README.md +83 -0
  595. data/node_modules/fsevents/fsevents.d.ts +46 -0
  596. data/node_modules/fsevents/fsevents.js +82 -0
  597. data/node_modules/fsevents/fsevents.node +0 -0
  598. data/node_modules/fsevents/package.json +62 -0
  599. data/node_modules/get-caller-file/LICENSE.md +6 -0
  600. data/node_modules/get-caller-file/README.md +41 -0
  601. data/node_modules/get-caller-file/index.d.ts +2 -0
  602. data/node_modules/get-caller-file/index.js +22 -0
  603. data/node_modules/get-caller-file/index.js.map +1 -0
  604. data/node_modules/get-caller-file/package.json +42 -0
  605. data/node_modules/glob-parent/CHANGELOG.md +110 -0
  606. data/node_modules/glob-parent/LICENSE +15 -0
  607. data/node_modules/glob-parent/README.md +137 -0
  608. data/node_modules/glob-parent/index.js +42 -0
  609. data/node_modules/glob-parent/package.json +48 -0
  610. data/node_modules/glob/LICENSE +21 -0
  611. data/node_modules/glob/README.md +375 -0
  612. data/node_modules/glob/changelog.md +67 -0
  613. data/node_modules/glob/common.js +234 -0
  614. data/node_modules/glob/glob.js +788 -0
  615. data/node_modules/glob/package.json +51 -0
  616. data/node_modules/glob/sync.js +484 -0
  617. data/node_modules/graceful-fs/LICENSE +15 -0
  618. data/node_modules/graceful-fs/README.md +133 -0
  619. data/node_modules/graceful-fs/clone.js +23 -0
  620. data/node_modules/graceful-fs/graceful-fs.js +373 -0
  621. data/node_modules/graceful-fs/legacy-streams.js +118 -0
  622. data/node_modules/graceful-fs/package.json +50 -0
  623. data/node_modules/graceful-fs/polyfills.js +346 -0
  624. data/node_modules/inflight/LICENSE +15 -0
  625. data/node_modules/inflight/README.md +37 -0
  626. data/node_modules/inflight/inflight.js +54 -0
  627. data/node_modules/inflight/package.json +29 -0
  628. data/node_modules/inherits/LICENSE +16 -0
  629. data/node_modules/inherits/README.md +42 -0
  630. data/node_modules/inherits/inherits.js +9 -0
  631. data/node_modules/inherits/inherits_browser.js +27 -0
  632. data/node_modules/inherits/package.json +29 -0
  633. data/node_modules/is-binary-path/index.d.ts +17 -0
  634. data/node_modules/is-binary-path/index.js +7 -0
  635. data/node_modules/is-binary-path/license +9 -0
  636. data/node_modules/is-binary-path/package.json +40 -0
  637. data/node_modules/is-binary-path/readme.md +34 -0
  638. data/node_modules/is-extglob/LICENSE +21 -0
  639. data/node_modules/is-extglob/README.md +107 -0
  640. data/node_modules/is-extglob/index.js +20 -0
  641. data/node_modules/is-extglob/package.json +69 -0
  642. data/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
  643. data/node_modules/is-fullwidth-code-point/index.js +50 -0
  644. data/node_modules/is-fullwidth-code-point/license +9 -0
  645. data/node_modules/is-fullwidth-code-point/package.json +42 -0
  646. data/node_modules/is-fullwidth-code-point/readme.md +39 -0
  647. data/node_modules/is-glob/LICENSE +21 -0
  648. data/node_modules/is-glob/README.md +206 -0
  649. data/node_modules/is-glob/index.js +48 -0
  650. data/node_modules/is-glob/package.json +81 -0
  651. data/node_modules/is-number/LICENSE +21 -0
  652. data/node_modules/is-number/README.md +187 -0
  653. data/node_modules/is-number/index.js +18 -0
  654. data/node_modules/is-number/package.json +82 -0
  655. data/node_modules/isexe/LICENSE +15 -0
  656. data/node_modules/isexe/README.md +51 -0
  657. data/node_modules/isexe/index.js +57 -0
  658. data/node_modules/isexe/mode.js +41 -0
  659. data/node_modules/isexe/package.json +31 -0
  660. data/node_modules/isexe/test/basic.js +221 -0
  661. data/node_modules/isexe/windows.js +42 -0
  662. data/node_modules/js-yaml/CHANGELOG.md +557 -0
  663. data/node_modules/js-yaml/LICENSE +21 -0
  664. data/node_modules/js-yaml/README.md +299 -0
  665. data/node_modules/js-yaml/bin/js-yaml.js +132 -0
  666. data/node_modules/js-yaml/dist/js-yaml.js +3989 -0
  667. data/node_modules/js-yaml/dist/js-yaml.min.js +1 -0
  668. data/node_modules/js-yaml/index.js +7 -0
  669. data/node_modules/js-yaml/lib/js-yaml.js +39 -0
  670. data/node_modules/js-yaml/lib/js-yaml/common.js +59 -0
  671. data/node_modules/js-yaml/lib/js-yaml/dumper.js +850 -0
  672. data/node_modules/js-yaml/lib/js-yaml/exception.js +43 -0
  673. data/node_modules/js-yaml/lib/js-yaml/loader.js +1644 -0
  674. data/node_modules/js-yaml/lib/js-yaml/mark.js +76 -0
  675. data/node_modules/js-yaml/lib/js-yaml/schema.js +108 -0
  676. data/node_modules/js-yaml/lib/js-yaml/schema/core.js +18 -0
  677. data/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +25 -0
  678. data/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +28 -0
  679. data/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +17 -0
  680. data/node_modules/js-yaml/lib/js-yaml/schema/json.js +25 -0
  681. data/node_modules/js-yaml/lib/js-yaml/type.js +61 -0
  682. data/node_modules/js-yaml/lib/js-yaml/type/binary.js +138 -0
  683. data/node_modules/js-yaml/lib/js-yaml/type/bool.js +35 -0
  684. data/node_modules/js-yaml/lib/js-yaml/type/float.js +116 -0
  685. data/node_modules/js-yaml/lib/js-yaml/type/int.js +173 -0
  686. data/node_modules/js-yaml/lib/js-yaml/type/js/function.js +93 -0
  687. data/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +60 -0
  688. data/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +28 -0
  689. data/node_modules/js-yaml/lib/js-yaml/type/map.js +8 -0
  690. data/node_modules/js-yaml/lib/js-yaml/type/merge.js +12 -0
  691. data/node_modules/js-yaml/lib/js-yaml/type/null.js +34 -0
  692. data/node_modules/js-yaml/lib/js-yaml/type/omap.js +44 -0
  693. data/node_modules/js-yaml/lib/js-yaml/type/pairs.js +53 -0
  694. data/node_modules/js-yaml/lib/js-yaml/type/seq.js +8 -0
  695. data/node_modules/js-yaml/lib/js-yaml/type/set.js +29 -0
  696. data/node_modules/js-yaml/lib/js-yaml/type/str.js +8 -0
  697. data/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +88 -0
  698. data/node_modules/js-yaml/package.json +49 -0
  699. data/node_modules/jsonfile/CHANGELOG.md +171 -0
  700. data/node_modules/jsonfile/LICENSE +15 -0
  701. data/node_modules/jsonfile/README.md +230 -0
  702. data/node_modules/jsonfile/index.js +88 -0
  703. data/node_modules/jsonfile/package.json +40 -0
  704. data/node_modules/jsonfile/utils.js +14 -0
  705. data/node_modules/lru-cache/LICENSE +15 -0
  706. data/node_modules/lru-cache/README.md +166 -0
  707. data/node_modules/lru-cache/index.js +334 -0
  708. data/node_modules/lru-cache/package.json +34 -0
  709. data/node_modules/minimatch/LICENSE +15 -0
  710. data/node_modules/minimatch/README.md +209 -0
  711. data/node_modules/minimatch/minimatch.js +923 -0
  712. data/node_modules/minimatch/package.json +30 -0
  713. data/node_modules/normalize-path/LICENSE +21 -0
  714. data/node_modules/normalize-path/README.md +127 -0
  715. data/node_modules/normalize-path/index.js +35 -0
  716. data/node_modules/normalize-path/package.json +77 -0
  717. data/node_modules/once/LICENSE +15 -0
  718. data/node_modules/once/README.md +79 -0
  719. data/node_modules/once/once.js +42 -0
  720. data/node_modules/once/package.json +33 -0
  721. data/node_modules/path-is-absolute/index.js +20 -0
  722. data/node_modules/path-is-absolute/license +21 -0
  723. data/node_modules/path-is-absolute/package.json +43 -0
  724. data/node_modules/path-is-absolute/readme.md +59 -0
  725. data/node_modules/path-key/index.d.ts +40 -0
  726. data/node_modules/path-key/index.js +16 -0
  727. data/node_modules/path-key/license +9 -0
  728. data/node_modules/path-key/package.json +39 -0
  729. data/node_modules/path-key/readme.md +61 -0
  730. data/node_modules/picomatch/CHANGELOG.md +126 -0
  731. data/node_modules/picomatch/LICENSE +21 -0
  732. data/node_modules/picomatch/README.md +707 -0
  733. data/node_modules/picomatch/index.js +3 -0
  734. data/node_modules/picomatch/lib/constants.js +179 -0
  735. data/node_modules/picomatch/lib/parse.js +1084 -0
  736. data/node_modules/picomatch/lib/picomatch.js +342 -0
  737. data/node_modules/picomatch/lib/scan.js +391 -0
  738. data/node_modules/picomatch/lib/utils.js +64 -0
  739. data/node_modules/picomatch/package.json +81 -0
  740. data/node_modules/readdirp/LICENSE +21 -0
  741. data/node_modules/readdirp/README.md +122 -0
  742. data/node_modules/readdirp/index.d.ts +43 -0
  743. data/node_modules/readdirp/index.js +287 -0
  744. data/node_modules/readdirp/package.json +122 -0
  745. data/node_modules/require-directory/LICENSE +22 -0
  746. data/node_modules/require-directory/README.markdown +184 -0
  747. data/node_modules/require-directory/index.js +86 -0
  748. data/node_modules/require-directory/package.json +40 -0
  749. data/node_modules/semver/CHANGELOG.md +111 -0
  750. data/node_modules/semver/LICENSE +15 -0
  751. data/node_modules/semver/README.md +566 -0
  752. data/node_modules/semver/bin/semver.js +173 -0
  753. data/node_modules/semver/classes/comparator.js +135 -0
  754. data/node_modules/semver/classes/index.js +5 -0
  755. data/node_modules/semver/classes/range.js +510 -0
  756. data/node_modules/semver/classes/semver.js +287 -0
  757. data/node_modules/semver/functions/clean.js +6 -0
  758. data/node_modules/semver/functions/cmp.js +48 -0
  759. data/node_modules/semver/functions/coerce.js +51 -0
  760. data/node_modules/semver/functions/compare-build.js +7 -0
  761. data/node_modules/semver/functions/compare-loose.js +3 -0
  762. data/node_modules/semver/functions/compare.js +5 -0
  763. data/node_modules/semver/functions/diff.js +23 -0
  764. data/node_modules/semver/functions/eq.js +3 -0
  765. data/node_modules/semver/functions/gt.js +3 -0
  766. data/node_modules/semver/functions/gte.js +3 -0
  767. data/node_modules/semver/functions/inc.js +15 -0
  768. data/node_modules/semver/functions/lt.js +3 -0
  769. data/node_modules/semver/functions/lte.js +3 -0
  770. data/node_modules/semver/functions/major.js +3 -0
  771. data/node_modules/semver/functions/minor.js +3 -0
  772. data/node_modules/semver/functions/neq.js +3 -0
  773. data/node_modules/semver/functions/parse.js +33 -0
  774. data/node_modules/semver/functions/patch.js +3 -0
  775. data/node_modules/semver/functions/prerelease.js +6 -0
  776. data/node_modules/semver/functions/rcompare.js +3 -0
  777. data/node_modules/semver/functions/rsort.js +3 -0
  778. data/node_modules/semver/functions/satisfies.js +10 -0
  779. data/node_modules/semver/functions/sort.js +3 -0
  780. data/node_modules/semver/functions/valid.js +6 -0
  781. data/node_modules/semver/index.js +48 -0
  782. data/node_modules/semver/internal/constants.js +17 -0
  783. data/node_modules/semver/internal/debug.js +9 -0
  784. data/node_modules/semver/internal/identifiers.js +23 -0
  785. data/node_modules/semver/internal/parse-options.js +11 -0
  786. data/node_modules/semver/internal/re.js +182 -0
  787. data/node_modules/semver/package.json +41 -0
  788. data/node_modules/semver/preload.js +2 -0
  789. data/node_modules/semver/range.bnf +16 -0
  790. data/node_modules/semver/ranges/gtr.js +4 -0
  791. data/node_modules/semver/ranges/intersects.js +7 -0
  792. data/node_modules/semver/ranges/ltr.js +4 -0
  793. data/node_modules/semver/ranges/max-satisfying.js +25 -0
  794. data/node_modules/semver/ranges/min-satisfying.js +24 -0
  795. data/node_modules/semver/ranges/min-version.js +60 -0
  796. data/node_modules/semver/ranges/outside.js +80 -0
  797. data/node_modules/semver/ranges/simplify.js +44 -0
  798. data/node_modules/semver/ranges/subset.js +222 -0
  799. data/node_modules/semver/ranges/to-comparators.js +8 -0
  800. data/node_modules/semver/ranges/valid.js +11 -0
  801. data/node_modules/shebang-command/index.js +19 -0
  802. data/node_modules/shebang-command/license +9 -0
  803. data/node_modules/shebang-command/package.json +34 -0
  804. data/node_modules/shebang-command/readme.md +34 -0
  805. data/node_modules/shebang-regex/index.d.ts +22 -0
  806. data/node_modules/shebang-regex/index.js +2 -0
  807. data/node_modules/shebang-regex/license +9 -0
  808. data/node_modules/shebang-regex/package.json +35 -0
  809. data/node_modules/shebang-regex/readme.md +33 -0
  810. data/node_modules/simple-wcswidth/CHANGELOG.md +13 -0
  811. data/node_modules/simple-wcswidth/LICENSE +21 -0
  812. data/node_modules/simple-wcswidth/README.md +100 -0
  813. data/node_modules/simple-wcswidth/dist/index.d.ts +3 -0
  814. data/node_modules/simple-wcswidth/dist/index.js +10 -0
  815. data/node_modules/simple-wcswidth/dist/src/binary-search.d.ts +3 -0
  816. data/node_modules/simple-wcswidth/dist/src/binary-search.js +24 -0
  817. data/node_modules/simple-wcswidth/dist/src/models.d.ts +4 -0
  818. data/node_modules/simple-wcswidth/dist/src/models.js +2 -0
  819. data/node_modules/simple-wcswidth/dist/src/non-spacing-chars.d.ts +3 -0
  820. data/node_modules/simple-wcswidth/dist/src/non-spacing-chars.js +149 -0
  821. data/node_modules/simple-wcswidth/dist/src/wcswidth.d.ts +2 -0
  822. data/node_modules/simple-wcswidth/dist/src/wcswidth.js +20 -0
  823. data/node_modules/simple-wcswidth/dist/src/wcwidth.d.ts +2 -0
  824. data/node_modules/simple-wcswidth/dist/src/wcwidth.js +67 -0
  825. data/node_modules/simple-wcswidth/package.json +44 -0
  826. data/node_modules/slash/index.d.ts +25 -0
  827. data/node_modules/slash/index.js +11 -0
  828. data/node_modules/slash/license +9 -0
  829. data/node_modules/slash/package.json +35 -0
  830. data/node_modules/slash/readme.md +44 -0
  831. data/node_modules/sprintf-js/LICENSE +24 -0
  832. data/node_modules/sprintf-js/README.md +88 -0
  833. data/node_modules/sprintf-js/bower.json +14 -0
  834. data/node_modules/sprintf-js/demo/angular.html +20 -0
  835. data/node_modules/sprintf-js/dist/angular-sprintf.min.js +4 -0
  836. data/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +1 -0
  837. data/node_modules/sprintf-js/dist/angular-sprintf.min.map +1 -0
  838. data/node_modules/sprintf-js/dist/sprintf.min.js +4 -0
  839. data/node_modules/sprintf-js/dist/sprintf.min.js.map +1 -0
  840. data/node_modules/sprintf-js/dist/sprintf.min.map +1 -0
  841. data/node_modules/sprintf-js/gruntfile.js +36 -0
  842. data/node_modules/sprintf-js/package.json +22 -0
  843. data/node_modules/sprintf-js/src/angular-sprintf.js +18 -0
  844. data/node_modules/sprintf-js/src/sprintf.js +208 -0
  845. data/node_modules/sprintf-js/test/test.js +82 -0
  846. data/node_modules/sqlite-parser/CHANGELOG.md +1263 -0
  847. data/node_modules/sqlite-parser/LICENSE +22 -0
  848. data/node_modules/sqlite-parser/README.md +187 -0
  849. data/node_modules/sqlite-parser/bin/sqlite-parser +7 -0
  850. data/node_modules/sqlite-parser/dist/sqlite-parser.js +19 -0
  851. data/node_modules/sqlite-parser/lib/index.js +6 -0
  852. data/node_modules/sqlite-parser/lib/parser.js +6 -0
  853. data/node_modules/sqlite-parser/lib/streaming-shim.js +6 -0
  854. data/node_modules/sqlite-parser/lib/streaming.js +6 -0
  855. data/node_modules/sqlite-parser/lib/tracer.js +6 -0
  856. data/node_modules/sqlite-parser/package.json +75 -0
  857. data/node_modules/string-width/index.d.ts +29 -0
  858. data/node_modules/string-width/index.js +47 -0
  859. data/node_modules/string-width/license +9 -0
  860. data/node_modules/string-width/package.json +56 -0
  861. data/node_modules/string-width/readme.md +50 -0
  862. data/node_modules/strip-ansi/index.d.ts +17 -0
  863. data/node_modules/strip-ansi/index.js +4 -0
  864. data/node_modules/strip-ansi/license +9 -0
  865. data/node_modules/strip-ansi/package.json +54 -0
  866. data/node_modules/strip-ansi/readme.md +46 -0
  867. data/node_modules/to-regex-range/LICENSE +21 -0
  868. data/node_modules/to-regex-range/README.md +305 -0
  869. data/node_modules/to-regex-range/index.js +288 -0
  870. data/node_modules/to-regex-range/package.json +88 -0
  871. data/node_modules/universalify/LICENSE +20 -0
  872. data/node_modules/universalify/README.md +76 -0
  873. data/node_modules/universalify/index.js +24 -0
  874. data/node_modules/universalify/package.json +34 -0
  875. data/node_modules/which/CHANGELOG.md +166 -0
  876. data/node_modules/which/LICENSE +15 -0
  877. data/node_modules/which/README.md +54 -0
  878. data/node_modules/which/bin/node-which +52 -0
  879. data/node_modules/which/package.json +43 -0
  880. data/node_modules/which/which.js +125 -0
  881. data/node_modules/wrap-ansi/index.js +216 -0
  882. data/node_modules/wrap-ansi/license +9 -0
  883. data/node_modules/wrap-ansi/package.json +62 -0
  884. data/node_modules/wrap-ansi/readme.md +91 -0
  885. data/node_modules/wrappy/LICENSE +15 -0
  886. data/node_modules/wrappy/README.md +36 -0
  887. data/node_modules/wrappy/package.json +29 -0
  888. data/node_modules/wrappy/wrappy.js +33 -0
  889. data/node_modules/y18n/CHANGELOG.md +100 -0
  890. data/node_modules/y18n/LICENSE +13 -0
  891. data/node_modules/y18n/README.md +127 -0
  892. data/node_modules/y18n/build/index.cjs +203 -0
  893. data/node_modules/y18n/build/lib/cjs.js +6 -0
  894. data/node_modules/y18n/build/lib/index.js +174 -0
  895. data/node_modules/y18n/build/lib/platform-shims/node.js +19 -0
  896. data/node_modules/y18n/index.mjs +8 -0
  897. data/node_modules/y18n/package.json +70 -0
  898. data/node_modules/yallist/LICENSE +15 -0
  899. data/node_modules/yallist/README.md +204 -0
  900. data/node_modules/yallist/iterator.js +8 -0
  901. data/node_modules/yallist/package.json +29 -0
  902. data/node_modules/yallist/yallist.js +426 -0
  903. data/node_modules/yargs-parser/CHANGELOG.md +263 -0
  904. data/node_modules/yargs-parser/LICENSE.txt +14 -0
  905. data/node_modules/yargs-parser/README.md +518 -0
  906. data/node_modules/yargs-parser/browser.js +29 -0
  907. data/node_modules/yargs-parser/build/index.cjs +1042 -0
  908. data/node_modules/yargs-parser/build/lib/index.js +59 -0
  909. data/node_modules/yargs-parser/build/lib/string-utils.js +65 -0
  910. data/node_modules/yargs-parser/build/lib/tokenize-arg-string.js +40 -0
  911. data/node_modules/yargs-parser/build/lib/yargs-parser-types.js +12 -0
  912. data/node_modules/yargs-parser/build/lib/yargs-parser.js +1037 -0
  913. data/node_modules/yargs-parser/package.json +87 -0
  914. data/node_modules/yargs/CHANGELOG.md +151 -0
  915. data/node_modules/yargs/LICENSE +21 -0
  916. data/node_modules/yargs/README.md +204 -0
  917. data/node_modules/yargs/browser.mjs +7 -0
  918. data/node_modules/yargs/build/index.cjs +1 -0
  919. data/node_modules/yargs/build/lib/argsert.js +62 -0
  920. data/node_modules/yargs/build/lib/command.js +436 -0
  921. data/node_modules/yargs/build/lib/completion-templates.js +48 -0
  922. data/node_modules/yargs/build/lib/completion.js +166 -0
  923. data/node_modules/yargs/build/lib/middleware.js +85 -0
  924. data/node_modules/yargs/build/lib/parse-command.js +32 -0
  925. data/node_modules/yargs/build/lib/typings/common-types.js +9 -0
  926. data/node_modules/yargs/build/lib/typings/yargs-parser-types.js +1 -0
  927. data/node_modules/yargs/build/lib/usage.js +567 -0
  928. data/node_modules/yargs/build/lib/utils/apply-extends.js +59 -0
  929. data/node_modules/yargs/build/lib/utils/is-promise.js +5 -0
  930. data/node_modules/yargs/build/lib/utils/levenshtein.js +26 -0
  931. data/node_modules/yargs/build/lib/utils/maybe-async-result.js +17 -0
  932. data/node_modules/yargs/build/lib/utils/obj-filter.js +10 -0
  933. data/node_modules/yargs/build/lib/utils/process-argv.js +17 -0
  934. data/node_modules/yargs/build/lib/utils/set-blocking.js +12 -0
  935. data/node_modules/yargs/build/lib/utils/which-module.js +10 -0
  936. data/node_modules/yargs/build/lib/validation.js +279 -0
  937. data/node_modules/yargs/build/lib/yargs-factory.js +1452 -0
  938. data/node_modules/yargs/build/lib/yerror.js +7 -0
  939. data/node_modules/yargs/helpers/helpers.mjs +10 -0
  940. data/node_modules/yargs/helpers/index.js +14 -0
  941. data/node_modules/yargs/helpers/package.json +3 -0
  942. data/node_modules/yargs/index.cjs +43 -0
  943. data/node_modules/yargs/index.mjs +8 -0
  944. data/node_modules/yargs/lib/platform-shims/browser.mjs +94 -0
  945. data/node_modules/yargs/lib/platform-shims/esm.mjs +67 -0
  946. data/node_modules/yargs/locales/be.json +46 -0
  947. data/node_modules/yargs/locales/de.json +46 -0
  948. data/node_modules/yargs/locales/en.json +51 -0
  949. data/node_modules/yargs/locales/es.json +46 -0
  950. data/node_modules/yargs/locales/fi.json +49 -0
  951. data/node_modules/yargs/locales/fr.json +53 -0
  952. data/node_modules/yargs/locales/hi.json +49 -0
  953. data/node_modules/yargs/locales/hu.json +46 -0
  954. data/node_modules/yargs/locales/id.json +50 -0
  955. data/node_modules/yargs/locales/it.json +46 -0
  956. data/node_modules/yargs/locales/ja.json +51 -0
  957. data/node_modules/yargs/locales/ko.json +49 -0
  958. data/node_modules/yargs/locales/nb.json +44 -0
  959. data/node_modules/yargs/locales/nl.json +49 -0
  960. data/node_modules/yargs/locales/nn.json +44 -0
  961. data/node_modules/yargs/locales/pirate.json +13 -0
  962. data/node_modules/yargs/locales/pl.json +49 -0
  963. data/node_modules/yargs/locales/pt.json +45 -0
  964. data/node_modules/yargs/locales/pt_BR.json +48 -0
  965. data/node_modules/yargs/locales/ru.json +46 -0
  966. data/node_modules/yargs/locales/th.json +46 -0
  967. data/node_modules/yargs/locales/tr.json +48 -0
  968. data/node_modules/yargs/locales/uk_UA.json +51 -0
  969. data/node_modules/yargs/locales/zh_CN.json +48 -0
  970. data/node_modules/yargs/locales/zh_TW.json +47 -0
  971. data/node_modules/yargs/package.json +116 -0
  972. data/node_modules/yargs/yargs +9 -0
  973. data/package.json +1 -1
  974. data/spec/depends/api_spec.rb +184 -0
  975. data/spec/depends/spec_helper.rb +27 -0
  976. data/spec/fixtures/depends/.gitignore +2 -0
  977. data/spec/fixtures/depends/app/controllers/api/api_keys_controller.rb +2 -0
  978. data/spec/fixtures/depends/app/controllers/organizations_controller.rb +2 -0
  979. data/spec/fixtures/depends/app/models/api_key.rb +2 -0
  980. data/spec/fixtures/depends/app/models/configuration.rb +2 -0
  981. data/spec/fixtures/depends/app/models/show.rb +2 -0
  982. data/spec/fixtures/depends/app/models/user.rb +2 -0
  983. data/spec/fixtures/depends/revoke_api_key.appmap.json +901 -0
  984. data/spec/fixtures/depends/spec/actual_rspec_test.rb +7 -0
  985. data/spec/fixtures/depends/spec/api_spec.rb +2 -0
  986. data/spec/fixtures/depends/spec/user_spec.rb +2 -0
  987. data/spec/fixtures/depends/test/actual_minitest_test.rb +5 -0
  988. data/spec/fixtures/depends/user_page_scenario.appmap.json +1776 -0
  989. data/spec/fixtures/rails5_users_app/create_app +3 -3
  990. data/spec/fixtures/rails6_users_app/create_app +3 -3
  991. data/spec/fixtures/rails6_users_app/lib/tasks/appmap.rake +11 -1
  992. data/spec/service/config_analyzer_spec.rb +3 -3
  993. data/spec/service/integration_test_path_finder_spec.rb +24 -0
  994. data/test/agent_setup_status_test.rb +7 -4
  995. data/test/agent_setup_validate_test.rb +19 -2
  996. data/test/test_helper.rb +3 -0
  997. data/yarn.lock +23 -9
  998. metadata +984 -7
@@ -0,0 +1,1582 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = global || self, factory(global.Diff = {}));
5
+ }(this, (function (exports) { 'use strict';
6
+
7
+ function Diff() {}
8
+ Diff.prototype = {
9
+ diff: function diff(oldString, newString) {
10
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
11
+ var callback = options.callback;
12
+
13
+ if (typeof options === 'function') {
14
+ callback = options;
15
+ options = {};
16
+ }
17
+
18
+ this.options = options;
19
+ var self = this;
20
+
21
+ function done(value) {
22
+ if (callback) {
23
+ setTimeout(function () {
24
+ callback(undefined, value);
25
+ }, 0);
26
+ return true;
27
+ } else {
28
+ return value;
29
+ }
30
+ } // Allow subclasses to massage the input prior to running
31
+
32
+
33
+ oldString = this.castInput(oldString);
34
+ newString = this.castInput(newString);
35
+ oldString = this.removeEmpty(this.tokenize(oldString));
36
+ newString = this.removeEmpty(this.tokenize(newString));
37
+ var newLen = newString.length,
38
+ oldLen = oldString.length;
39
+ var editLength = 1;
40
+ var maxEditLength = newLen + oldLen;
41
+ var bestPath = [{
42
+ newPos: -1,
43
+ components: []
44
+ }]; // Seed editLength = 0, i.e. the content starts with the same values
45
+
46
+ var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
47
+
48
+ if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
49
+ // Identity per the equality and tokenizer
50
+ return done([{
51
+ value: this.join(newString),
52
+ count: newString.length
53
+ }]);
54
+ } // Main worker method. checks all permutations of a given edit length for acceptance.
55
+
56
+
57
+ function execEditLength() {
58
+ for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
59
+ var basePath = void 0;
60
+
61
+ var addPath = bestPath[diagonalPath - 1],
62
+ removePath = bestPath[diagonalPath + 1],
63
+ _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
64
+
65
+ if (addPath) {
66
+ // No one else is going to attempt to use this value, clear it
67
+ bestPath[diagonalPath - 1] = undefined;
68
+ }
69
+
70
+ var canAdd = addPath && addPath.newPos + 1 < newLen,
71
+ canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
72
+
73
+ if (!canAdd && !canRemove) {
74
+ // If this path is a terminal then prune
75
+ bestPath[diagonalPath] = undefined;
76
+ continue;
77
+ } // Select the diagonal that we want to branch from. We select the prior
78
+ // path whose position in the new string is the farthest from the origin
79
+ // and does not pass the bounds of the diff graph
80
+
81
+
82
+ if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
83
+ basePath = clonePath(removePath);
84
+ self.pushComponent(basePath.components, undefined, true);
85
+ } else {
86
+ basePath = addPath; // No need to clone, we've pulled it from the list
87
+
88
+ basePath.newPos++;
89
+ self.pushComponent(basePath.components, true, undefined);
90
+ }
91
+
92
+ _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
93
+
94
+ if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
95
+ return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
96
+ } else {
97
+ // Otherwise track this path as a potential candidate and continue.
98
+ bestPath[diagonalPath] = basePath;
99
+ }
100
+ }
101
+
102
+ editLength++;
103
+ } // Performs the length of edit iteration. Is a bit fugly as this has to support the
104
+ // sync and async mode which is never fun. Loops over execEditLength until a value
105
+ // is produced.
106
+
107
+
108
+ if (callback) {
109
+ (function exec() {
110
+ setTimeout(function () {
111
+ // This should not happen, but we want to be safe.
112
+
113
+ /* istanbul ignore next */
114
+ if (editLength > maxEditLength) {
115
+ return callback();
116
+ }
117
+
118
+ if (!execEditLength()) {
119
+ exec();
120
+ }
121
+ }, 0);
122
+ })();
123
+ } else {
124
+ while (editLength <= maxEditLength) {
125
+ var ret = execEditLength();
126
+
127
+ if (ret) {
128
+ return ret;
129
+ }
130
+ }
131
+ }
132
+ },
133
+ pushComponent: function pushComponent(components, added, removed) {
134
+ var last = components[components.length - 1];
135
+
136
+ if (last && last.added === added && last.removed === removed) {
137
+ // We need to clone here as the component clone operation is just
138
+ // as shallow array clone
139
+ components[components.length - 1] = {
140
+ count: last.count + 1,
141
+ added: added,
142
+ removed: removed
143
+ };
144
+ } else {
145
+ components.push({
146
+ count: 1,
147
+ added: added,
148
+ removed: removed
149
+ });
150
+ }
151
+ },
152
+ extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
153
+ var newLen = newString.length,
154
+ oldLen = oldString.length,
155
+ newPos = basePath.newPos,
156
+ oldPos = newPos - diagonalPath,
157
+ commonCount = 0;
158
+
159
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
160
+ newPos++;
161
+ oldPos++;
162
+ commonCount++;
163
+ }
164
+
165
+ if (commonCount) {
166
+ basePath.components.push({
167
+ count: commonCount
168
+ });
169
+ }
170
+
171
+ basePath.newPos = newPos;
172
+ return oldPos;
173
+ },
174
+ equals: function equals(left, right) {
175
+ if (this.options.comparator) {
176
+ return this.options.comparator(left, right);
177
+ } else {
178
+ return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
179
+ }
180
+ },
181
+ removeEmpty: function removeEmpty(array) {
182
+ var ret = [];
183
+
184
+ for (var i = 0; i < array.length; i++) {
185
+ if (array[i]) {
186
+ ret.push(array[i]);
187
+ }
188
+ }
189
+
190
+ return ret;
191
+ },
192
+ castInput: function castInput(value) {
193
+ return value;
194
+ },
195
+ tokenize: function tokenize(value) {
196
+ return value.split('');
197
+ },
198
+ join: function join(chars) {
199
+ return chars.join('');
200
+ }
201
+ };
202
+
203
+ function buildValues(diff, components, newString, oldString, useLongestToken) {
204
+ var componentPos = 0,
205
+ componentLen = components.length,
206
+ newPos = 0,
207
+ oldPos = 0;
208
+
209
+ for (; componentPos < componentLen; componentPos++) {
210
+ var component = components[componentPos];
211
+
212
+ if (!component.removed) {
213
+ if (!component.added && useLongestToken) {
214
+ var value = newString.slice(newPos, newPos + component.count);
215
+ value = value.map(function (value, i) {
216
+ var oldValue = oldString[oldPos + i];
217
+ return oldValue.length > value.length ? oldValue : value;
218
+ });
219
+ component.value = diff.join(value);
220
+ } else {
221
+ component.value = diff.join(newString.slice(newPos, newPos + component.count));
222
+ }
223
+
224
+ newPos += component.count; // Common case
225
+
226
+ if (!component.added) {
227
+ oldPos += component.count;
228
+ }
229
+ } else {
230
+ component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
231
+ oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
232
+ // The diffing algorithm is tied to add then remove output and this is the simplest
233
+ // route to get the desired output with minimal overhead.
234
+
235
+ if (componentPos && components[componentPos - 1].added) {
236
+ var tmp = components[componentPos - 1];
237
+ components[componentPos - 1] = components[componentPos];
238
+ components[componentPos] = tmp;
239
+ }
240
+ }
241
+ } // Special case handle for when one terminal is ignored (i.e. whitespace).
242
+ // For this case we merge the terminal into the prior string and drop the change.
243
+ // This is only available for string mode.
244
+
245
+
246
+ var lastComponent = components[componentLen - 1];
247
+
248
+ if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
249
+ components[componentLen - 2].value += lastComponent.value;
250
+ components.pop();
251
+ }
252
+
253
+ return components;
254
+ }
255
+
256
+ function clonePath(path) {
257
+ return {
258
+ newPos: path.newPos,
259
+ components: path.components.slice(0)
260
+ };
261
+ }
262
+
263
+ var characterDiff = new Diff();
264
+ function diffChars(oldStr, newStr, options) {
265
+ return characterDiff.diff(oldStr, newStr, options);
266
+ }
267
+
268
+ function generateOptions(options, defaults) {
269
+ if (typeof options === 'function') {
270
+ defaults.callback = options;
271
+ } else if (options) {
272
+ for (var name in options) {
273
+ /* istanbul ignore else */
274
+ if (options.hasOwnProperty(name)) {
275
+ defaults[name] = options[name];
276
+ }
277
+ }
278
+ }
279
+
280
+ return defaults;
281
+ }
282
+
283
+ //
284
+ // Ranges and exceptions:
285
+ // Latin-1 Supplement, 0080–00FF
286
+ // - U+00D7 × Multiplication sign
287
+ // - U+00F7 ÷ Division sign
288
+ // Latin Extended-A, 0100–017F
289
+ // Latin Extended-B, 0180–024F
290
+ // IPA Extensions, 0250–02AF
291
+ // Spacing Modifier Letters, 02B0–02FF
292
+ // - U+02C7 ˇ &#711; Caron
293
+ // - U+02D8 ˘ &#728; Breve
294
+ // - U+02D9 ˙ &#729; Dot Above
295
+ // - U+02DA ˚ &#730; Ring Above
296
+ // - U+02DB ˛ &#731; Ogonek
297
+ // - U+02DC ˜ &#732; Small Tilde
298
+ // - U+02DD ˝ &#733; Double Acute Accent
299
+ // Latin Extended Additional, 1E00–1EFF
300
+
301
+ var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
302
+ var reWhitespace = /\S/;
303
+ var wordDiff = new Diff();
304
+
305
+ wordDiff.equals = function (left, right) {
306
+ if (this.options.ignoreCase) {
307
+ left = left.toLowerCase();
308
+ right = right.toLowerCase();
309
+ }
310
+
311
+ return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
312
+ };
313
+
314
+ wordDiff.tokenize = function (value) {
315
+ // All whitespace symbols except newline group into one token, each newline - in separate token
316
+ var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
317
+
318
+ for (var i = 0; i < tokens.length - 1; i++) {
319
+ // If we have an empty string in the next field and we have only word chars before and after, merge
320
+ if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
321
+ tokens[i] += tokens[i + 2];
322
+ tokens.splice(i + 1, 2);
323
+ i--;
324
+ }
325
+ }
326
+
327
+ return tokens;
328
+ };
329
+
330
+ function diffWords(oldStr, newStr, options) {
331
+ options = generateOptions(options, {
332
+ ignoreWhitespace: true
333
+ });
334
+ return wordDiff.diff(oldStr, newStr, options);
335
+ }
336
+ function diffWordsWithSpace(oldStr, newStr, options) {
337
+ return wordDiff.diff(oldStr, newStr, options);
338
+ }
339
+
340
+ var lineDiff = new Diff();
341
+
342
+ lineDiff.tokenize = function (value) {
343
+ var retLines = [],
344
+ linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
345
+
346
+ if (!linesAndNewlines[linesAndNewlines.length - 1]) {
347
+ linesAndNewlines.pop();
348
+ } // Merge the content and line separators into single tokens
349
+
350
+
351
+ for (var i = 0; i < linesAndNewlines.length; i++) {
352
+ var line = linesAndNewlines[i];
353
+
354
+ if (i % 2 && !this.options.newlineIsToken) {
355
+ retLines[retLines.length - 1] += line;
356
+ } else {
357
+ if (this.options.ignoreWhitespace) {
358
+ line = line.trim();
359
+ }
360
+
361
+ retLines.push(line);
362
+ }
363
+ }
364
+
365
+ return retLines;
366
+ };
367
+
368
+ function diffLines(oldStr, newStr, callback) {
369
+ return lineDiff.diff(oldStr, newStr, callback);
370
+ }
371
+ function diffTrimmedLines(oldStr, newStr, callback) {
372
+ var options = generateOptions(callback, {
373
+ ignoreWhitespace: true
374
+ });
375
+ return lineDiff.diff(oldStr, newStr, options);
376
+ }
377
+
378
+ var sentenceDiff = new Diff();
379
+
380
+ sentenceDiff.tokenize = function (value) {
381
+ return value.split(/(\S.+?[.!?])(?=\s+|$)/);
382
+ };
383
+
384
+ function diffSentences(oldStr, newStr, callback) {
385
+ return sentenceDiff.diff(oldStr, newStr, callback);
386
+ }
387
+
388
+ var cssDiff = new Diff();
389
+
390
+ cssDiff.tokenize = function (value) {
391
+ return value.split(/([{}:;,]|\s+)/);
392
+ };
393
+
394
+ function diffCss(oldStr, newStr, callback) {
395
+ return cssDiff.diff(oldStr, newStr, callback);
396
+ }
397
+
398
+ function _typeof(obj) {
399
+ "@babel/helpers - typeof";
400
+
401
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
402
+ _typeof = function (obj) {
403
+ return typeof obj;
404
+ };
405
+ } else {
406
+ _typeof = function (obj) {
407
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
408
+ };
409
+ }
410
+
411
+ return _typeof(obj);
412
+ }
413
+
414
+ function _toConsumableArray(arr) {
415
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
416
+ }
417
+
418
+ function _arrayWithoutHoles(arr) {
419
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
420
+ }
421
+
422
+ function _iterableToArray(iter) {
423
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
424
+ }
425
+
426
+ function _unsupportedIterableToArray(o, minLen) {
427
+ if (!o) return;
428
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
429
+ var n = Object.prototype.toString.call(o).slice(8, -1);
430
+ if (n === "Object" && o.constructor) n = o.constructor.name;
431
+ if (n === "Map" || n === "Set") return Array.from(o);
432
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
433
+ }
434
+
435
+ function _arrayLikeToArray(arr, len) {
436
+ if (len == null || len > arr.length) len = arr.length;
437
+
438
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
439
+
440
+ return arr2;
441
+ }
442
+
443
+ function _nonIterableSpread() {
444
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
445
+ }
446
+
447
+ var objectPrototypeToString = Object.prototype.toString;
448
+ var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
449
+ // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
450
+
451
+ jsonDiff.useLongestToken = true;
452
+ jsonDiff.tokenize = lineDiff.tokenize;
453
+
454
+ jsonDiff.castInput = function (value) {
455
+ var _this$options = this.options,
456
+ undefinedReplacement = _this$options.undefinedReplacement,
457
+ _this$options$stringi = _this$options.stringifyReplacer,
458
+ stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) {
459
+ return typeof v === 'undefined' ? undefinedReplacement : v;
460
+ } : _this$options$stringi;
461
+ return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
462
+ };
463
+
464
+ jsonDiff.equals = function (left, right) {
465
+ return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
466
+ };
467
+
468
+ function diffJson(oldObj, newObj, options) {
469
+ return jsonDiff.diff(oldObj, newObj, options);
470
+ } // This function handles the presence of circular references by bailing out when encountering an
471
+ // object that is already on the "stack" of items being processed. Accepts an optional replacer
472
+
473
+ function canonicalize(obj, stack, replacementStack, replacer, key) {
474
+ stack = stack || [];
475
+ replacementStack = replacementStack || [];
476
+
477
+ if (replacer) {
478
+ obj = replacer(key, obj);
479
+ }
480
+
481
+ var i;
482
+
483
+ for (i = 0; i < stack.length; i += 1) {
484
+ if (stack[i] === obj) {
485
+ return replacementStack[i];
486
+ }
487
+ }
488
+
489
+ var canonicalizedObj;
490
+
491
+ if ('[object Array]' === objectPrototypeToString.call(obj)) {
492
+ stack.push(obj);
493
+ canonicalizedObj = new Array(obj.length);
494
+ replacementStack.push(canonicalizedObj);
495
+
496
+ for (i = 0; i < obj.length; i += 1) {
497
+ canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
498
+ }
499
+
500
+ stack.pop();
501
+ replacementStack.pop();
502
+ return canonicalizedObj;
503
+ }
504
+
505
+ if (obj && obj.toJSON) {
506
+ obj = obj.toJSON();
507
+ }
508
+
509
+ if (_typeof(obj) === 'object' && obj !== null) {
510
+ stack.push(obj);
511
+ canonicalizedObj = {};
512
+ replacementStack.push(canonicalizedObj);
513
+
514
+ var sortedKeys = [],
515
+ _key;
516
+
517
+ for (_key in obj) {
518
+ /* istanbul ignore else */
519
+ if (obj.hasOwnProperty(_key)) {
520
+ sortedKeys.push(_key);
521
+ }
522
+ }
523
+
524
+ sortedKeys.sort();
525
+
526
+ for (i = 0; i < sortedKeys.length; i += 1) {
527
+ _key = sortedKeys[i];
528
+ canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
529
+ }
530
+
531
+ stack.pop();
532
+ replacementStack.pop();
533
+ } else {
534
+ canonicalizedObj = obj;
535
+ }
536
+
537
+ return canonicalizedObj;
538
+ }
539
+
540
+ var arrayDiff = new Diff();
541
+
542
+ arrayDiff.tokenize = function (value) {
543
+ return value.slice();
544
+ };
545
+
546
+ arrayDiff.join = arrayDiff.removeEmpty = function (value) {
547
+ return value;
548
+ };
549
+
550
+ function diffArrays(oldArr, newArr, callback) {
551
+ return arrayDiff.diff(oldArr, newArr, callback);
552
+ }
553
+
554
+ function parsePatch(uniDiff) {
555
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
556
+ var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
557
+ delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
558
+ list = [],
559
+ i = 0;
560
+
561
+ function parseIndex() {
562
+ var index = {};
563
+ list.push(index); // Parse diff metadata
564
+
565
+ while (i < diffstr.length) {
566
+ var line = diffstr[i]; // File header found, end parsing diff metadata
567
+
568
+ if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
569
+ break;
570
+ } // Diff index
571
+
572
+
573
+ var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
574
+
575
+ if (header) {
576
+ index.index = header[1];
577
+ }
578
+
579
+ i++;
580
+ } // Parse file headers if they are defined. Unified diff requires them, but
581
+ // there's no technical issues to have an isolated hunk without file header
582
+
583
+
584
+ parseFileHeader(index);
585
+ parseFileHeader(index); // Parse hunks
586
+
587
+ index.hunks = [];
588
+
589
+ while (i < diffstr.length) {
590
+ var _line = diffstr[i];
591
+
592
+ if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
593
+ break;
594
+ } else if (/^@@/.test(_line)) {
595
+ index.hunks.push(parseHunk());
596
+ } else if (_line && options.strict) {
597
+ // Ignore unexpected content unless in strict mode
598
+ throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
599
+ } else {
600
+ i++;
601
+ }
602
+ }
603
+ } // Parses the --- and +++ headers, if none are found, no lines
604
+ // are consumed.
605
+
606
+
607
+ function parseFileHeader(index) {
608
+ var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
609
+
610
+ if (fileHeader) {
611
+ var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
612
+ var data = fileHeader[2].split('\t', 2);
613
+ var fileName = data[0].replace(/\\\\/g, '\\');
614
+
615
+ if (/^".*"$/.test(fileName)) {
616
+ fileName = fileName.substr(1, fileName.length - 2);
617
+ }
618
+
619
+ index[keyPrefix + 'FileName'] = fileName;
620
+ index[keyPrefix + 'Header'] = (data[1] || '').trim();
621
+ i++;
622
+ }
623
+ } // Parses a hunk
624
+ // This assumes that we are at the start of a hunk.
625
+
626
+
627
+ function parseHunk() {
628
+ var chunkHeaderIndex = i,
629
+ chunkHeaderLine = diffstr[i++],
630
+ chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
631
+ var hunk = {
632
+ oldStart: +chunkHeader[1],
633
+ oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2],
634
+ newStart: +chunkHeader[3],
635
+ newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4],
636
+ lines: [],
637
+ linedelimiters: []
638
+ }; // Unified Diff Format quirk: If the chunk size is 0,
639
+ // the first number is one lower than one would expect.
640
+ // https://www.artima.com/weblogs/viewpost.jsp?thread=164293
641
+
642
+ if (hunk.oldLines === 0) {
643
+ hunk.oldStart += 1;
644
+ }
645
+
646
+ if (hunk.newLines === 0) {
647
+ hunk.newStart += 1;
648
+ }
649
+
650
+ var addCount = 0,
651
+ removeCount = 0;
652
+
653
+ for (; i < diffstr.length; i++) {
654
+ // Lines starting with '---' could be mistaken for the "remove line" operation
655
+ // But they could be the header for the next file. Therefore prune such cases out.
656
+ if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
657
+ break;
658
+ }
659
+
660
+ var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
661
+
662
+ if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
663
+ hunk.lines.push(diffstr[i]);
664
+ hunk.linedelimiters.push(delimiters[i] || '\n');
665
+
666
+ if (operation === '+') {
667
+ addCount++;
668
+ } else if (operation === '-') {
669
+ removeCount++;
670
+ } else if (operation === ' ') {
671
+ addCount++;
672
+ removeCount++;
673
+ }
674
+ } else {
675
+ break;
676
+ }
677
+ } // Handle the empty block count case
678
+
679
+
680
+ if (!addCount && hunk.newLines === 1) {
681
+ hunk.newLines = 0;
682
+ }
683
+
684
+ if (!removeCount && hunk.oldLines === 1) {
685
+ hunk.oldLines = 0;
686
+ } // Perform optional sanity checking
687
+
688
+
689
+ if (options.strict) {
690
+ if (addCount !== hunk.newLines) {
691
+ throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
692
+ }
693
+
694
+ if (removeCount !== hunk.oldLines) {
695
+ throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
696
+ }
697
+ }
698
+
699
+ return hunk;
700
+ }
701
+
702
+ while (i < diffstr.length) {
703
+ parseIndex();
704
+ }
705
+
706
+ return list;
707
+ }
708
+
709
+ // Iterator that traverses in the range of [min, max], stepping
710
+ // by distance from a given start position. I.e. for [0, 4], with
711
+ // start of 2, this will iterate 2, 3, 1, 4, 0.
712
+ function distanceIterator (start, minLine, maxLine) {
713
+ var wantForward = true,
714
+ backwardExhausted = false,
715
+ forwardExhausted = false,
716
+ localOffset = 1;
717
+ return function iterator() {
718
+ if (wantForward && !forwardExhausted) {
719
+ if (backwardExhausted) {
720
+ localOffset++;
721
+ } else {
722
+ wantForward = false;
723
+ } // Check if trying to fit beyond text length, and if not, check it fits
724
+ // after offset location (or desired location on first iteration)
725
+
726
+
727
+ if (start + localOffset <= maxLine) {
728
+ return localOffset;
729
+ }
730
+
731
+ forwardExhausted = true;
732
+ }
733
+
734
+ if (!backwardExhausted) {
735
+ if (!forwardExhausted) {
736
+ wantForward = true;
737
+ } // Check if trying to fit before text beginning, and if not, check it fits
738
+ // before offset location
739
+
740
+
741
+ if (minLine <= start - localOffset) {
742
+ return -localOffset++;
743
+ }
744
+
745
+ backwardExhausted = true;
746
+ return iterator();
747
+ } // We tried to fit hunk before text beginning and beyond text length, then
748
+ // hunk can't fit on the text. Return undefined
749
+
750
+ };
751
+ }
752
+
753
+ function applyPatch(source, uniDiff) {
754
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
755
+
756
+ if (typeof uniDiff === 'string') {
757
+ uniDiff = parsePatch(uniDiff);
758
+ }
759
+
760
+ if (Array.isArray(uniDiff)) {
761
+ if (uniDiff.length > 1) {
762
+ throw new Error('applyPatch only works with a single input.');
763
+ }
764
+
765
+ uniDiff = uniDiff[0];
766
+ } // Apply the diff to the input
767
+
768
+
769
+ var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
770
+ delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
771
+ hunks = uniDiff.hunks,
772
+ compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) {
773
+ return line === patchContent;
774
+ },
775
+ errorCount = 0,
776
+ fuzzFactor = options.fuzzFactor || 0,
777
+ minLine = 0,
778
+ offset = 0,
779
+ removeEOFNL,
780
+ addEOFNL;
781
+ /**
782
+ * Checks if the hunk exactly fits on the provided location
783
+ */
784
+
785
+
786
+ function hunkFits(hunk, toPos) {
787
+ for (var j = 0; j < hunk.lines.length; j++) {
788
+ var line = hunk.lines[j],
789
+ operation = line.length > 0 ? line[0] : ' ',
790
+ content = line.length > 0 ? line.substr(1) : line;
791
+
792
+ if (operation === ' ' || operation === '-') {
793
+ // Context sanity check
794
+ if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
795
+ errorCount++;
796
+
797
+ if (errorCount > fuzzFactor) {
798
+ return false;
799
+ }
800
+ }
801
+
802
+ toPos++;
803
+ }
804
+ }
805
+
806
+ return true;
807
+ } // Search best fit offsets for each hunk based on the previous ones
808
+
809
+
810
+ for (var i = 0; i < hunks.length; i++) {
811
+ var hunk = hunks[i],
812
+ maxLine = lines.length - hunk.oldLines,
813
+ localOffset = 0,
814
+ toPos = offset + hunk.oldStart - 1;
815
+ var iterator = distanceIterator(toPos, minLine, maxLine);
816
+
817
+ for (; localOffset !== undefined; localOffset = iterator()) {
818
+ if (hunkFits(hunk, toPos + localOffset)) {
819
+ hunk.offset = offset += localOffset;
820
+ break;
821
+ }
822
+ }
823
+
824
+ if (localOffset === undefined) {
825
+ return false;
826
+ } // Set lower text limit to end of the current hunk, so next ones don't try
827
+ // to fit over already patched text
828
+
829
+
830
+ minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
831
+ } // Apply patch hunks
832
+
833
+
834
+ var diffOffset = 0;
835
+
836
+ for (var _i = 0; _i < hunks.length; _i++) {
837
+ var _hunk = hunks[_i],
838
+ _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
839
+
840
+ diffOffset += _hunk.newLines - _hunk.oldLines;
841
+
842
+ for (var j = 0; j < _hunk.lines.length; j++) {
843
+ var line = _hunk.lines[j],
844
+ operation = line.length > 0 ? line[0] : ' ',
845
+ content = line.length > 0 ? line.substr(1) : line,
846
+ delimiter = _hunk.linedelimiters[j];
847
+
848
+ if (operation === ' ') {
849
+ _toPos++;
850
+ } else if (operation === '-') {
851
+ lines.splice(_toPos, 1);
852
+ delimiters.splice(_toPos, 1);
853
+ /* istanbul ignore else */
854
+ } else if (operation === '+') {
855
+ lines.splice(_toPos, 0, content);
856
+ delimiters.splice(_toPos, 0, delimiter);
857
+ _toPos++;
858
+ } else if (operation === '\\') {
859
+ var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
860
+
861
+ if (previousOperation === '+') {
862
+ removeEOFNL = true;
863
+ } else if (previousOperation === '-') {
864
+ addEOFNL = true;
865
+ }
866
+ }
867
+ }
868
+ } // Handle EOFNL insertion/removal
869
+
870
+
871
+ if (removeEOFNL) {
872
+ while (!lines[lines.length - 1]) {
873
+ lines.pop();
874
+ delimiters.pop();
875
+ }
876
+ } else if (addEOFNL) {
877
+ lines.push('');
878
+ delimiters.push('\n');
879
+ }
880
+
881
+ for (var _k = 0; _k < lines.length - 1; _k++) {
882
+ lines[_k] = lines[_k] + delimiters[_k];
883
+ }
884
+
885
+ return lines.join('');
886
+ } // Wrapper that supports multiple file patches via callbacks.
887
+
888
+ function applyPatches(uniDiff, options) {
889
+ if (typeof uniDiff === 'string') {
890
+ uniDiff = parsePatch(uniDiff);
891
+ }
892
+
893
+ var currentIndex = 0;
894
+
895
+ function processIndex() {
896
+ var index = uniDiff[currentIndex++];
897
+
898
+ if (!index) {
899
+ return options.complete();
900
+ }
901
+
902
+ options.loadFile(index, function (err, data) {
903
+ if (err) {
904
+ return options.complete(err);
905
+ }
906
+
907
+ var updatedContent = applyPatch(data, index, options);
908
+ options.patched(index, updatedContent, function (err) {
909
+ if (err) {
910
+ return options.complete(err);
911
+ }
912
+
913
+ processIndex();
914
+ });
915
+ });
916
+ }
917
+
918
+ processIndex();
919
+ }
920
+
921
+ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
922
+ if (!options) {
923
+ options = {};
924
+ }
925
+
926
+ if (typeof options.context === 'undefined') {
927
+ options.context = 4;
928
+ }
929
+
930
+ var diff = diffLines(oldStr, newStr, options);
931
+ diff.push({
932
+ value: '',
933
+ lines: []
934
+ }); // Append an empty value to make cleanup easier
935
+
936
+ function contextLines(lines) {
937
+ return lines.map(function (entry) {
938
+ return ' ' + entry;
939
+ });
940
+ }
941
+
942
+ var hunks = [];
943
+ var oldRangeStart = 0,
944
+ newRangeStart = 0,
945
+ curRange = [],
946
+ oldLine = 1,
947
+ newLine = 1;
948
+
949
+ var _loop = function _loop(i) {
950
+ var current = diff[i],
951
+ lines = current.lines || current.value.replace(/\n$/, '').split('\n');
952
+ current.lines = lines;
953
+
954
+ if (current.added || current.removed) {
955
+ var _curRange;
956
+
957
+ // If we have previous context, start with that
958
+ if (!oldRangeStart) {
959
+ var prev = diff[i - 1];
960
+ oldRangeStart = oldLine;
961
+ newRangeStart = newLine;
962
+
963
+ if (prev) {
964
+ curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
965
+ oldRangeStart -= curRange.length;
966
+ newRangeStart -= curRange.length;
967
+ }
968
+ } // Output our changes
969
+
970
+
971
+ (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) {
972
+ return (current.added ? '+' : '-') + entry;
973
+ }))); // Track the updated file position
974
+
975
+
976
+ if (current.added) {
977
+ newLine += lines.length;
978
+ } else {
979
+ oldLine += lines.length;
980
+ }
981
+ } else {
982
+ // Identical context lines. Track line changes
983
+ if (oldRangeStart) {
984
+ // Close out any changes that have been output (or join overlapping)
985
+ if (lines.length <= options.context * 2 && i < diff.length - 2) {
986
+ var _curRange2;
987
+
988
+ // Overlapping
989
+ (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines)));
990
+ } else {
991
+ var _curRange3;
992
+
993
+ // end the range and output
994
+ var contextSize = Math.min(lines.length, options.context);
995
+
996
+ (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize))));
997
+
998
+ var hunk = {
999
+ oldStart: oldRangeStart,
1000
+ oldLines: oldLine - oldRangeStart + contextSize,
1001
+ newStart: newRangeStart,
1002
+ newLines: newLine - newRangeStart + contextSize,
1003
+ lines: curRange
1004
+ };
1005
+
1006
+ if (i >= diff.length - 2 && lines.length <= options.context) {
1007
+ // EOF is inside this hunk
1008
+ var oldEOFNewline = /\n$/.test(oldStr);
1009
+ var newEOFNewline = /\n$/.test(newStr);
1010
+ var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
1011
+
1012
+ if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
1013
+ // special case: old has no eol and no trailing context; no-nl can end up before adds
1014
+ // however, if the old file is empty, do not output the no-nl line
1015
+ curRange.splice(hunk.oldLines, 0, '\');
1016
+ }
1017
+
1018
+ if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
1019
+ curRange.push('\');
1020
+ }
1021
+ }
1022
+
1023
+ hunks.push(hunk);
1024
+ oldRangeStart = 0;
1025
+ newRangeStart = 0;
1026
+ curRange = [];
1027
+ }
1028
+ }
1029
+
1030
+ oldLine += lines.length;
1031
+ newLine += lines.length;
1032
+ }
1033
+ };
1034
+
1035
+ for (var i = 0; i < diff.length; i++) {
1036
+ _loop(i);
1037
+ }
1038
+
1039
+ return {
1040
+ oldFileName: oldFileName,
1041
+ newFileName: newFileName,
1042
+ oldHeader: oldHeader,
1043
+ newHeader: newHeader,
1044
+ hunks: hunks
1045
+ };
1046
+ }
1047
+ function formatPatch(diff) {
1048
+ var ret = [];
1049
+
1050
+ if (diff.oldFileName == diff.newFileName) {
1051
+ ret.push('Index: ' + diff.oldFileName);
1052
+ }
1053
+
1054
+ ret.push('===================================================================');
1055
+ ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
1056
+ ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
1057
+
1058
+ for (var i = 0; i < diff.hunks.length; i++) {
1059
+ var hunk = diff.hunks[i]; // Unified Diff Format quirk: If the chunk size is 0,
1060
+ // the first number is one lower than one would expect.
1061
+ // https://www.artima.com/weblogs/viewpost.jsp?thread=164293
1062
+
1063
+ if (hunk.oldLines === 0) {
1064
+ hunk.oldStart -= 1;
1065
+ }
1066
+
1067
+ if (hunk.newLines === 0) {
1068
+ hunk.newStart -= 1;
1069
+ }
1070
+
1071
+ ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
1072
+ ret.push.apply(ret, hunk.lines);
1073
+ }
1074
+
1075
+ return ret.join('\n') + '\n';
1076
+ }
1077
+ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
1078
+ return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options));
1079
+ }
1080
+ function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
1081
+ return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
1082
+ }
1083
+
1084
+ function arrayEqual(a, b) {
1085
+ if (a.length !== b.length) {
1086
+ return false;
1087
+ }
1088
+
1089
+ return arrayStartsWith(a, b);
1090
+ }
1091
+ function arrayStartsWith(array, start) {
1092
+ if (start.length > array.length) {
1093
+ return false;
1094
+ }
1095
+
1096
+ for (var i = 0; i < start.length; i++) {
1097
+ if (start[i] !== array[i]) {
1098
+ return false;
1099
+ }
1100
+ }
1101
+
1102
+ return true;
1103
+ }
1104
+
1105
+ function calcLineCount(hunk) {
1106
+ var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines),
1107
+ oldLines = _calcOldNewLineCount.oldLines,
1108
+ newLines = _calcOldNewLineCount.newLines;
1109
+
1110
+ if (oldLines !== undefined) {
1111
+ hunk.oldLines = oldLines;
1112
+ } else {
1113
+ delete hunk.oldLines;
1114
+ }
1115
+
1116
+ if (newLines !== undefined) {
1117
+ hunk.newLines = newLines;
1118
+ } else {
1119
+ delete hunk.newLines;
1120
+ }
1121
+ }
1122
+ function merge(mine, theirs, base) {
1123
+ mine = loadPatch(mine, base);
1124
+ theirs = loadPatch(theirs, base);
1125
+ var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning.
1126
+ // Leaving sanity checks on this to the API consumer that may know more about the
1127
+ // meaning in their own context.
1128
+
1129
+ if (mine.index || theirs.index) {
1130
+ ret.index = mine.index || theirs.index;
1131
+ }
1132
+
1133
+ if (mine.newFileName || theirs.newFileName) {
1134
+ if (!fileNameChanged(mine)) {
1135
+ // No header or no change in ours, use theirs (and ours if theirs does not exist)
1136
+ ret.oldFileName = theirs.oldFileName || mine.oldFileName;
1137
+ ret.newFileName = theirs.newFileName || mine.newFileName;
1138
+ ret.oldHeader = theirs.oldHeader || mine.oldHeader;
1139
+ ret.newHeader = theirs.newHeader || mine.newHeader;
1140
+ } else if (!fileNameChanged(theirs)) {
1141
+ // No header or no change in theirs, use ours
1142
+ ret.oldFileName = mine.oldFileName;
1143
+ ret.newFileName = mine.newFileName;
1144
+ ret.oldHeader = mine.oldHeader;
1145
+ ret.newHeader = mine.newHeader;
1146
+ } else {
1147
+ // Both changed... figure it out
1148
+ ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
1149
+ ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
1150
+ ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
1151
+ ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
1152
+ }
1153
+ }
1154
+
1155
+ ret.hunks = [];
1156
+ var mineIndex = 0,
1157
+ theirsIndex = 0,
1158
+ mineOffset = 0,
1159
+ theirsOffset = 0;
1160
+
1161
+ while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
1162
+ var mineCurrent = mine.hunks[mineIndex] || {
1163
+ oldStart: Infinity
1164
+ },
1165
+ theirsCurrent = theirs.hunks[theirsIndex] || {
1166
+ oldStart: Infinity
1167
+ };
1168
+
1169
+ if (hunkBefore(mineCurrent, theirsCurrent)) {
1170
+ // This patch does not overlap with any of the others, yay.
1171
+ ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
1172
+ mineIndex++;
1173
+ theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
1174
+ } else if (hunkBefore(theirsCurrent, mineCurrent)) {
1175
+ // This patch does not overlap with any of the others, yay.
1176
+ ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
1177
+ theirsIndex++;
1178
+ mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
1179
+ } else {
1180
+ // Overlap, merge as best we can
1181
+ var mergedHunk = {
1182
+ oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
1183
+ oldLines: 0,
1184
+ newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
1185
+ newLines: 0,
1186
+ lines: []
1187
+ };
1188
+ mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
1189
+ theirsIndex++;
1190
+ mineIndex++;
1191
+ ret.hunks.push(mergedHunk);
1192
+ }
1193
+ }
1194
+
1195
+ return ret;
1196
+ }
1197
+
1198
+ function loadPatch(param, base) {
1199
+ if (typeof param === 'string') {
1200
+ if (/^@@/m.test(param) || /^Index:/m.test(param)) {
1201
+ return parsePatch(param)[0];
1202
+ }
1203
+
1204
+ if (!base) {
1205
+ throw new Error('Must provide a base reference or pass in a patch');
1206
+ }
1207
+
1208
+ return structuredPatch(undefined, undefined, base, param);
1209
+ }
1210
+
1211
+ return param;
1212
+ }
1213
+
1214
+ function fileNameChanged(patch) {
1215
+ return patch.newFileName && patch.newFileName !== patch.oldFileName;
1216
+ }
1217
+
1218
+ function selectField(index, mine, theirs) {
1219
+ if (mine === theirs) {
1220
+ return mine;
1221
+ } else {
1222
+ index.conflict = true;
1223
+ return {
1224
+ mine: mine,
1225
+ theirs: theirs
1226
+ };
1227
+ }
1228
+ }
1229
+
1230
+ function hunkBefore(test, check) {
1231
+ return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
1232
+ }
1233
+
1234
+ function cloneHunk(hunk, offset) {
1235
+ return {
1236
+ oldStart: hunk.oldStart,
1237
+ oldLines: hunk.oldLines,
1238
+ newStart: hunk.newStart + offset,
1239
+ newLines: hunk.newLines,
1240
+ lines: hunk.lines
1241
+ };
1242
+ }
1243
+
1244
+ function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
1245
+ // This will generally result in a conflicted hunk, but there are cases where the context
1246
+ // is the only overlap where we can successfully merge the content here.
1247
+ var mine = {
1248
+ offset: mineOffset,
1249
+ lines: mineLines,
1250
+ index: 0
1251
+ },
1252
+ their = {
1253
+ offset: theirOffset,
1254
+ lines: theirLines,
1255
+ index: 0
1256
+ }; // Handle any leading content
1257
+
1258
+ insertLeading(hunk, mine, their);
1259
+ insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each.
1260
+
1261
+ while (mine.index < mine.lines.length && their.index < their.lines.length) {
1262
+ var mineCurrent = mine.lines[mine.index],
1263
+ theirCurrent = their.lines[their.index];
1264
+
1265
+ if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
1266
+ // Both modified ...
1267
+ mutualChange(hunk, mine, their);
1268
+ } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
1269
+ var _hunk$lines;
1270
+
1271
+ // Mine inserted
1272
+ (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine)));
1273
+ } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
1274
+ var _hunk$lines2;
1275
+
1276
+ // Theirs inserted
1277
+ (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their)));
1278
+ } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
1279
+ // Mine removed or edited
1280
+ removal(hunk, mine, their);
1281
+ } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
1282
+ // Their removed or edited
1283
+ removal(hunk, their, mine, true);
1284
+ } else if (mineCurrent === theirCurrent) {
1285
+ // Context identity
1286
+ hunk.lines.push(mineCurrent);
1287
+ mine.index++;
1288
+ their.index++;
1289
+ } else {
1290
+ // Context mismatch
1291
+ conflict(hunk, collectChange(mine), collectChange(their));
1292
+ }
1293
+ } // Now push anything that may be remaining
1294
+
1295
+
1296
+ insertTrailing(hunk, mine);
1297
+ insertTrailing(hunk, their);
1298
+ calcLineCount(hunk);
1299
+ }
1300
+
1301
+ function mutualChange(hunk, mine, their) {
1302
+ var myChanges = collectChange(mine),
1303
+ theirChanges = collectChange(their);
1304
+
1305
+ if (allRemoves(myChanges) && allRemoves(theirChanges)) {
1306
+ // Special case for remove changes that are supersets of one another
1307
+ if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
1308
+ var _hunk$lines3;
1309
+
1310
+ (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges));
1311
+
1312
+ return;
1313
+ } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
1314
+ var _hunk$lines4;
1315
+
1316
+ (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges));
1317
+
1318
+ return;
1319
+ }
1320
+ } else if (arrayEqual(myChanges, theirChanges)) {
1321
+ var _hunk$lines5;
1322
+
1323
+ (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges));
1324
+
1325
+ return;
1326
+ }
1327
+
1328
+ conflict(hunk, myChanges, theirChanges);
1329
+ }
1330
+
1331
+ function removal(hunk, mine, their, swap) {
1332
+ var myChanges = collectChange(mine),
1333
+ theirChanges = collectContext(their, myChanges);
1334
+
1335
+ if (theirChanges.merged) {
1336
+ var _hunk$lines6;
1337
+
1338
+ (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged));
1339
+ } else {
1340
+ conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
1341
+ }
1342
+ }
1343
+
1344
+ function conflict(hunk, mine, their) {
1345
+ hunk.conflict = true;
1346
+ hunk.lines.push({
1347
+ conflict: true,
1348
+ mine: mine,
1349
+ theirs: their
1350
+ });
1351
+ }
1352
+
1353
+ function insertLeading(hunk, insert, their) {
1354
+ while (insert.offset < their.offset && insert.index < insert.lines.length) {
1355
+ var line = insert.lines[insert.index++];
1356
+ hunk.lines.push(line);
1357
+ insert.offset++;
1358
+ }
1359
+ }
1360
+
1361
+ function insertTrailing(hunk, insert) {
1362
+ while (insert.index < insert.lines.length) {
1363
+ var line = insert.lines[insert.index++];
1364
+ hunk.lines.push(line);
1365
+ }
1366
+ }
1367
+
1368
+ function collectChange(state) {
1369
+ var ret = [],
1370
+ operation = state.lines[state.index][0];
1371
+
1372
+ while (state.index < state.lines.length) {
1373
+ var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
1374
+
1375
+ if (operation === '-' && line[0] === '+') {
1376
+ operation = '+';
1377
+ }
1378
+
1379
+ if (operation === line[0]) {
1380
+ ret.push(line);
1381
+ state.index++;
1382
+ } else {
1383
+ break;
1384
+ }
1385
+ }
1386
+
1387
+ return ret;
1388
+ }
1389
+
1390
+ function collectContext(state, matchChanges) {
1391
+ var changes = [],
1392
+ merged = [],
1393
+ matchIndex = 0,
1394
+ contextChanges = false,
1395
+ conflicted = false;
1396
+
1397
+ while (matchIndex < matchChanges.length && state.index < state.lines.length) {
1398
+ var change = state.lines[state.index],
1399
+ match = matchChanges[matchIndex]; // Once we've hit our add, then we are done
1400
+
1401
+ if (match[0] === '+') {
1402
+ break;
1403
+ }
1404
+
1405
+ contextChanges = contextChanges || change[0] !== ' ';
1406
+ merged.push(match);
1407
+ matchIndex++; // Consume any additions in the other block as a conflict to attempt
1408
+ // to pull in the remaining context after this
1409
+
1410
+ if (change[0] === '+') {
1411
+ conflicted = true;
1412
+
1413
+ while (change[0] === '+') {
1414
+ changes.push(change);
1415
+ change = state.lines[++state.index];
1416
+ }
1417
+ }
1418
+
1419
+ if (match.substr(1) === change.substr(1)) {
1420
+ changes.push(change);
1421
+ state.index++;
1422
+ } else {
1423
+ conflicted = true;
1424
+ }
1425
+ }
1426
+
1427
+ if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
1428
+ conflicted = true;
1429
+ }
1430
+
1431
+ if (conflicted) {
1432
+ return changes;
1433
+ }
1434
+
1435
+ while (matchIndex < matchChanges.length) {
1436
+ merged.push(matchChanges[matchIndex++]);
1437
+ }
1438
+
1439
+ return {
1440
+ merged: merged,
1441
+ changes: changes
1442
+ };
1443
+ }
1444
+
1445
+ function allRemoves(changes) {
1446
+ return changes.reduce(function (prev, change) {
1447
+ return prev && change[0] === '-';
1448
+ }, true);
1449
+ }
1450
+
1451
+ function skipRemoveSuperset(state, removeChanges, delta) {
1452
+ for (var i = 0; i < delta; i++) {
1453
+ var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
1454
+
1455
+ if (state.lines[state.index + i] !== ' ' + changeContent) {
1456
+ return false;
1457
+ }
1458
+ }
1459
+
1460
+ state.index += delta;
1461
+ return true;
1462
+ }
1463
+
1464
+ function calcOldNewLineCount(lines) {
1465
+ var oldLines = 0;
1466
+ var newLines = 0;
1467
+ lines.forEach(function (line) {
1468
+ if (typeof line !== 'string') {
1469
+ var myCount = calcOldNewLineCount(line.mine);
1470
+ var theirCount = calcOldNewLineCount(line.theirs);
1471
+
1472
+ if (oldLines !== undefined) {
1473
+ if (myCount.oldLines === theirCount.oldLines) {
1474
+ oldLines += myCount.oldLines;
1475
+ } else {
1476
+ oldLines = undefined;
1477
+ }
1478
+ }
1479
+
1480
+ if (newLines !== undefined) {
1481
+ if (myCount.newLines === theirCount.newLines) {
1482
+ newLines += myCount.newLines;
1483
+ } else {
1484
+ newLines = undefined;
1485
+ }
1486
+ }
1487
+ } else {
1488
+ if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
1489
+ newLines++;
1490
+ }
1491
+
1492
+ if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
1493
+ oldLines++;
1494
+ }
1495
+ }
1496
+ });
1497
+ return {
1498
+ oldLines: oldLines,
1499
+ newLines: newLines
1500
+ };
1501
+ }
1502
+
1503
+ // See: http://code.google.com/p/google-diff-match-patch/wiki/API
1504
+ function convertChangesToDMP(changes) {
1505
+ var ret = [],
1506
+ change,
1507
+ operation;
1508
+
1509
+ for (var i = 0; i < changes.length; i++) {
1510
+ change = changes[i];
1511
+
1512
+ if (change.added) {
1513
+ operation = 1;
1514
+ } else if (change.removed) {
1515
+ operation = -1;
1516
+ } else {
1517
+ operation = 0;
1518
+ }
1519
+
1520
+ ret.push([operation, change.value]);
1521
+ }
1522
+
1523
+ return ret;
1524
+ }
1525
+
1526
+ function convertChangesToXML(changes) {
1527
+ var ret = [];
1528
+
1529
+ for (var i = 0; i < changes.length; i++) {
1530
+ var change = changes[i];
1531
+
1532
+ if (change.added) {
1533
+ ret.push('<ins>');
1534
+ } else if (change.removed) {
1535
+ ret.push('<del>');
1536
+ }
1537
+
1538
+ ret.push(escapeHTML(change.value));
1539
+
1540
+ if (change.added) {
1541
+ ret.push('</ins>');
1542
+ } else if (change.removed) {
1543
+ ret.push('</del>');
1544
+ }
1545
+ }
1546
+
1547
+ return ret.join('');
1548
+ }
1549
+
1550
+ function escapeHTML(s) {
1551
+ var n = s;
1552
+ n = n.replace(/&/g, '&amp;');
1553
+ n = n.replace(/</g, '&lt;');
1554
+ n = n.replace(/>/g, '&gt;');
1555
+ n = n.replace(/"/g, '&quot;');
1556
+ return n;
1557
+ }
1558
+
1559
+ exports.Diff = Diff;
1560
+ exports.applyPatch = applyPatch;
1561
+ exports.applyPatches = applyPatches;
1562
+ exports.canonicalize = canonicalize;
1563
+ exports.convertChangesToDMP = convertChangesToDMP;
1564
+ exports.convertChangesToXML = convertChangesToXML;
1565
+ exports.createPatch = createPatch;
1566
+ exports.createTwoFilesPatch = createTwoFilesPatch;
1567
+ exports.diffArrays = diffArrays;
1568
+ exports.diffChars = diffChars;
1569
+ exports.diffCss = diffCss;
1570
+ exports.diffJson = diffJson;
1571
+ exports.diffLines = diffLines;
1572
+ exports.diffSentences = diffSentences;
1573
+ exports.diffTrimmedLines = diffTrimmedLines;
1574
+ exports.diffWords = diffWords;
1575
+ exports.diffWordsWithSpace = diffWordsWithSpace;
1576
+ exports.merge = merge;
1577
+ exports.parsePatch = parsePatch;
1578
+ exports.structuredPatch = structuredPatch;
1579
+
1580
+ Object.defineProperty(exports, '__esModule', { value: true });
1581
+
1582
+ })));