c0ckp1t 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (676) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +5 -0
  3. package/c0ckp1t-demo/Constants.mjs +125 -0
  4. package/c0ckp1t-demo/components/sidebar.vue +82 -0
  5. package/c0ckp1t-demo/main.vue +39 -0
  6. package/c0ckp1t-demo/pages/devices.vue +63 -0
  7. package/c0ckp1t-demo/pages/homepage.vue +63 -0
  8. package/c0ckp1t-demo/pages/report.vue +63 -0
  9. package/c0ckp1t-demo/store.mjs +133 -0
  10. package/components/ExecButton.vue +62 -0
  11. package/components/FsTree.vue +550 -0
  12. package/components/Markdown.mjs +274 -0
  13. package/components/MarkdownUtils.mjs +180 -0
  14. package/components/Tree.mjs +175 -0
  15. package/components/code-mirror.vue +445 -0
  16. package/components/vue3-ace-editor.vue +331 -0
  17. package/components/xbutton.vue +45 -0
  18. package/components/xcard-h.vue +175 -0
  19. package/components/xcard.vue +76 -0
  20. package/components/xcheck.vue +35 -0
  21. package/components/xcheckbox.vue +52 -0
  22. package/components/xcode.vue +139 -0
  23. package/components/xcollapse.vue +52 -0
  24. package/components/xcolor.vue +84 -0
  25. package/components/xdropdown.vue +104 -0
  26. package/components/xdropdown2.vue +140 -0
  27. package/components/xhidden.vue +30 -0
  28. package/components/xinput.vue +101 -0
  29. package/components/xinput2.vue +101 -0
  30. package/components/xjson.vue +95 -0
  31. package/components/xkv.vue +41 -0
  32. package/components/xlabel.vue +56 -0
  33. package/components/xlist.vue +83 -0
  34. package/components/xmap.vue +106 -0
  35. package/components/xmarkdown.vue +269 -0
  36. package/components/xnav.vue +98 -0
  37. package/components/xsection.vue +164 -0
  38. package/components/xsound.vue +251 -0
  39. package/components/xtable-open.vue +179 -0
  40. package/components/xtabs.vue +72 -0
  41. package/components/xterminal.vue +456 -0
  42. package/components/xtextarea.vue +83 -0
  43. package/components/xtoggle.vue +68 -0
  44. package/components/xtoggle3.vue +67 -0
  45. package/components/xtree.vue +140 -0
  46. package/components/xupload.vue +129 -0
  47. package/core/Content.mjs +92 -0
  48. package/core/DocUtils.mjs +189 -0
  49. package/core/GlobalStore.mjs +329 -0
  50. package/core/Island.mjs +429 -0
  51. package/core/IslandDefault.mjs +229 -0
  52. package/core/JsUtils.mjs +483 -0
  53. package/core/Logging.mjs +59 -0
  54. package/core/Page404.vue +152 -0
  55. package/core/PageFallback.vue +168 -0
  56. package/core/PageMain.vue +181 -0
  57. package/core/Theme.mjs +1759 -0
  58. package/core/VueUtils.mjs +200 -0
  59. package/core/WsUtils.mjs +274 -0
  60. package/core/img/Flag_of_the_United_States.svg +25 -0
  61. package/core/img/logo_v1.svg +98 -0
  62. package/core/img/logo_v2.svg +98 -0
  63. package/core/img/state-uniqueId-8k.wav +0 -0
  64. package/core/main-offcanvas.vue +99 -0
  65. package/core/nodes/_api.vue +82 -0
  66. package/core/nodes/node-container.vue +103 -0
  67. package/core/nodes/node.vue +246 -0
  68. package/core/nodes/place-holder.vue +47 -0
  69. package/core/nodes/root.vue +52 -0
  70. package/core/notify/NotifyUtils.mjs +150 -0
  71. package/core/notify/toast.vue +150 -0
  72. package/core/pages/About.vue +57 -0
  73. package/core/pages/Cache.vue +155 -0
  74. package/core/pages/Connection.vue +192 -0
  75. package/core/pages/Connections.vue +102 -0
  76. package/core/pages/Documentation.vue +263 -0
  77. package/core/pages/Notifies.vue +156 -0
  78. package/core/pages/Traffic.vue +152 -0
  79. package/core/pages/connections/connection-header-details.vue +80 -0
  80. package/core/pages/connections/page-connection-default.vue +92 -0
  81. package/core/pages/connections/page-connection.vue +176 -0
  82. package/core/pages/connections/ws-connection.vue +146 -0
  83. package/core/pages/frontend/Bootstrap.vue +1140 -0
  84. package/core/pages/frontend/Components.vue +56 -0
  85. package/core/pages/frontend/ComponentsAdv.vue +203 -0
  86. package/core/pages/frontend/ComponentsBasic.vue +336 -0
  87. package/core/pages/frontend/Theme.vue +473 -0
  88. package/core/pages/frontend/component-view.vue +65 -0
  89. package/core/pages/traffic/WsLogUtils.mjs +91 -0
  90. package/core/pages/traffic/log-ws-exec.vue +124 -0
  91. package/core/pages/traffic/log-ws-exec2.vue +129 -0
  92. package/core/sfc/code-item.vue +169 -0
  93. package/core/sfc/connection-header.vue +62 -0
  94. package/core/sfc/info-api.vue +158 -0
  95. package/core/sfc/md-toc.vue +346 -0
  96. package/core/sfc/scroll-to-top.vue +69 -0
  97. package/core/sfc/task.vue +98 -0
  98. package/core/sfc/text-to-md.vue +25 -0
  99. package/core/sfc/toc-list.vue +175 -0
  100. package/core/ws-client/AuthNState.mjs +84 -0
  101. package/core/ws-client/Connection.mjs +580 -0
  102. package/core/ws-client/Session.mjs +72 -0
  103. package/core/ws-client/WsClient.mjs +230 -0
  104. package/core/ws-client/WsLogUtils.mjs +91 -0
  105. package/core/ws-client/ws-connection.vue +144 -0
  106. package/css/Changa-Medium.ttf +0 -0
  107. package/css/Makefile +10 -0
  108. package/css/README.md +25 -0
  109. package/css/bootstrap-c0ckp1t.css +11861 -0
  110. package/css/bootstrap.min.css +6 -0
  111. package/css/fontawesome/brands.min.css +6 -0
  112. package/css/fontawesome/fontawesome.min.css +8 -0
  113. package/css/fontawesome/regular.min.css +6 -0
  114. package/css/fontawesome/solid.min.css +6 -0
  115. package/css/webfonts/fa-brands-400.woff2 +0 -0
  116. package/css/webfonts/fa-regular-400.woff2 +0 -0
  117. package/css/webfonts/fa-solid-900.woff2 +0 -0
  118. package/docs/Introduction.md +3 -0
  119. package/favicon-192x192.png +0 -0
  120. package/favicon-32x32.png +0 -0
  121. package/favicon-64x64.png +0 -0
  122. package/favicon.ico +0 -0
  123. package/index-cdn.html +66 -0
  124. package/js_ext/Makefile +26 -0
  125. package/js_ext/ace-editor/ace.js +22037 -0
  126. package/js_ext/ace-editor/ext-beautify.js +343 -0
  127. package/js_ext/ace-editor/ext-code_lens.js +204 -0
  128. package/js_ext/ace-editor/ext-command_bar.js +469 -0
  129. package/js_ext/ace-editor/ext-diff.js +4265 -0
  130. package/js_ext/ace-editor/ext-elastic_tabstops_lite.js +238 -0
  131. package/js_ext/ace-editor/ext-emmet.js +1303 -0
  132. package/js_ext/ace-editor/ext-error_marker.js +9 -0
  133. package/js_ext/ace-editor/ext-hardwrap.js +127 -0
  134. package/js_ext/ace-editor/ext-inline_autocomplete.js +3547 -0
  135. package/js_ext/ace-editor/ext-keybinding_menu.js +185 -0
  136. package/js_ext/ace-editor/ext-language_tools.js +2724 -0
  137. package/js_ext/ace-editor/ext-linking.js +66 -0
  138. package/js_ext/ace-editor/ext-modelist.js +276 -0
  139. package/js_ext/ace-editor/ext-options.js +859 -0
  140. package/js_ext/ace-editor/ext-prompt.js +3161 -0
  141. package/js_ext/ace-editor/ext-rtl.js +146 -0
  142. package/js_ext/ace-editor/ext-searchbox.js +385 -0
  143. package/js_ext/ace-editor/ext-settings_menu.js +859 -0
  144. package/js_ext/ace-editor/ext-simple_tokenizer.js +137 -0
  145. package/js_ext/ace-editor/ext-spellcheck.js +79 -0
  146. package/js_ext/ace-editor/ext-split.js +203 -0
  147. package/js_ext/ace-editor/ext-static_highlight.js +194 -0
  148. package/js_ext/ace-editor/ext-statusbar.js +63 -0
  149. package/js_ext/ace-editor/ext-textarea.js +400 -0
  150. package/js_ext/ace-editor/ext-themelist.js +80 -0
  151. package/js_ext/ace-editor/ext-whitespace.js +201 -0
  152. package/js_ext/ace-editor/keybinding-emacs.js +1067 -0
  153. package/js_ext/ace-editor/keybinding-sublime.js +409 -0
  154. package/js_ext/ace-editor/keybinding-vim.js +7101 -0
  155. package/js_ext/ace-editor/keybinding-vscode.js +255 -0
  156. package/js_ext/ace-editor/mode-abap.js +200 -0
  157. package/js_ext/ace-editor/mode-abc.js +243 -0
  158. package/js_ext/ace-editor/mode-actionscript.js +234 -0
  159. package/js_ext/ace-editor/mode-ada.js +108 -0
  160. package/js_ext/ace-editor/mode-alda.js +279 -0
  161. package/js_ext/ace-editor/mode-apache_conf.js +318 -0
  162. package/js_ext/ace-editor/mode-apex.js +402 -0
  163. package/js_ext/ace-editor/mode-applescript.js +232 -0
  164. package/js_ext/ace-editor/mode-aql.js +92 -0
  165. package/js_ext/ace-editor/mode-asciidoc.js +311 -0
  166. package/js_ext/ace-editor/mode-asl.js +357 -0
  167. package/js_ext/ace-editor/mode-assembly_arm32.js +185 -0
  168. package/js_ext/ace-editor/mode-assembly_x86.js +170 -0
  169. package/js_ext/ace-editor/mode-astro.js +2474 -0
  170. package/js_ext/ace-editor/mode-autohotkey.js +208 -0
  171. package/js_ext/ace-editor/mode-basic.js +201 -0
  172. package/js_ext/ace-editor/mode-batchfile.js +199 -0
  173. package/js_ext/ace-editor/mode-bibtex.js +318 -0
  174. package/js_ext/ace-editor/mode-c9search.js +250 -0
  175. package/js_ext/ace-editor/mode-c_cpp.js +417 -0
  176. package/js_ext/ace-editor/mode-cirru.js +192 -0
  177. package/js_ext/ace-editor/mode-clojure.js +322 -0
  178. package/js_ext/ace-editor/mode-clue.js +361 -0
  179. package/js_ext/ace-editor/mode-cobol.js +82 -0
  180. package/js_ext/ace-editor/mode-coffee.js +335 -0
  181. package/js_ext/ace-editor/mode-coldfusion.js +2409 -0
  182. package/js_ext/ace-editor/mode-crystal.js +586 -0
  183. package/js_ext/ace-editor/mode-csharp.js +413 -0
  184. package/js_ext/ace-editor/mode-csound_document.js +4072 -0
  185. package/js_ext/ace-editor/mode-csound_orchestra.js +2923 -0
  186. package/js_ext/ace-editor/mode-csound_score.js +409 -0
  187. package/js_ext/ace-editor/mode-csp.js +59 -0
  188. package/js_ext/ace-editor/mode-css.js +632 -0
  189. package/js_ext/ace-editor/mode-csv.js +97 -0
  190. package/js_ext/ace-editor/mode-curly.js +2381 -0
  191. package/js_ext/ace-editor/mode-cuttlefish.js +56 -0
  192. package/js_ext/ace-editor/mode-d.js +450 -0
  193. package/js_ext/ace-editor/mode-dart.js +618 -0
  194. package/js_ext/ace-editor/mode-diff.js +129 -0
  195. package/js_ext/ace-editor/mode-django.js +2422 -0
  196. package/js_ext/ace-editor/mode-dockerfile.js +427 -0
  197. package/js_ext/ace-editor/mode-dot.js +348 -0
  198. package/js_ext/ace-editor/mode-drools.js +607 -0
  199. package/js_ext/ace-editor/mode-edifact.js +130 -0
  200. package/js_ext/ace-editor/mode-eiffel.js +120 -0
  201. package/js_ext/ace-editor/mode-ejs.js +3277 -0
  202. package/js_ext/ace-editor/mode-elixir.js +443 -0
  203. package/js_ext/ace-editor/mode-elm.js +274 -0
  204. package/js_ext/ace-editor/mode-erlang.js +836 -0
  205. package/js_ext/ace-editor/mode-flix.js +164 -0
  206. package/js_ext/ace-editor/mode-forth.js +253 -0
  207. package/js_ext/ace-editor/mode-fortran.js +361 -0
  208. package/js_ext/ace-editor/mode-fsharp.js +277 -0
  209. package/js_ext/ace-editor/mode-fsl.js +226 -0
  210. package/js_ext/ace-editor/mode-ftl.js +1255 -0
  211. package/js_ext/ace-editor/mode-gcode.js +74 -0
  212. package/js_ext/ace-editor/mode-gherkin.js +154 -0
  213. package/js_ext/ace-editor/mode-gitignore.js +49 -0
  214. package/js_ext/ace-editor/mode-glsl.js +475 -0
  215. package/js_ext/ace-editor/mode-gobstones.js +1459 -0
  216. package/js_ext/ace-editor/mode-golang.js +341 -0
  217. package/js_ext/ace-editor/mode-graphqlschema.js +174 -0
  218. package/js_ext/ace-editor/mode-groovy.js +1401 -0
  219. package/js_ext/ace-editor/mode-haml.js +1906 -0
  220. package/js_ext/ace-editor/mode-handlebars.js +2438 -0
  221. package/js_ext/ace-editor/mode-haskell.js +324 -0
  222. package/js_ext/ace-editor/mode-haskell_cabal.js +135 -0
  223. package/js_ext/ace-editor/mode-haxe.js +313 -0
  224. package/js_ext/ace-editor/mode-hjson.js +318 -0
  225. package/js_ext/ace-editor/mode-html.js +2339 -0
  226. package/js_ext/ace-editor/mode-html_elixir.js +2845 -0
  227. package/js_ext/ace-editor/mode-html_ruby.js +3294 -0
  228. package/js_ext/ace-editor/mode-ini.js +138 -0
  229. package/js_ext/ace-editor/mode-io.js +210 -0
  230. package/js_ext/ace-editor/mode-ion.js +477 -0
  231. package/js_ext/ace-editor/mode-jack.js +293 -0
  232. package/js_ext/ace-editor/mode-jade.js +2017 -0
  233. package/js_ext/ace-editor/mode-java.js +1565 -0
  234. package/js_ext/ace-editor/mode-javascript.js +1191 -0
  235. package/js_ext/ace-editor/mode-jexl.js +270 -0
  236. package/js_ext/ace-editor/mode-json.js +275 -0
  237. package/js_ext/ace-editor/mode-json5.js +308 -0
  238. package/js_ext/ace-editor/mode-jsoniq.js +2577 -0
  239. package/js_ext/ace-editor/mode-jsp.js +1618 -0
  240. package/js_ext/ace-editor/mode-jssm.js +293 -0
  241. package/js_ext/ace-editor/mode-jsx.js +1209 -0
  242. package/js_ext/ace-editor/mode-julia.js +254 -0
  243. package/js_ext/ace-editor/mode-kotlin.js +445 -0
  244. package/js_ext/ace-editor/mode-latex.js +252 -0
  245. package/js_ext/ace-editor/mode-latte.js +2522 -0
  246. package/js_ext/ace-editor/mode-less.js +742 -0
  247. package/js_ext/ace-editor/mode-liquid.js +2741 -0
  248. package/js_ext/ace-editor/mode-lisp.js +104 -0
  249. package/js_ext/ace-editor/mode-livescript.js +272 -0
  250. package/js_ext/ace-editor/mode-logiql.js +272 -0
  251. package/js_ext/ace-editor/mode-logtalk.js +309 -0
  252. package/js_ext/ace-editor/mode-lsl.js +287 -0
  253. package/js_ext/ace-editor/mode-lua.js +393 -0
  254. package/js_ext/ace-editor/mode-luapage.js +2785 -0
  255. package/js_ext/ace-editor/mode-lucene.js +145 -0
  256. package/js_ext/ace-editor/mode-makefile.js +374 -0
  257. package/js_ext/ace-editor/mode-markdown.js +2935 -0
  258. package/js_ext/ace-editor/mode-mask.js +1757 -0
  259. package/js_ext/ace-editor/mode-matlab.js +239 -0
  260. package/js_ext/ace-editor/mode-maze.js +256 -0
  261. package/js_ext/ace-editor/mode-mediawiki.js +580 -0
  262. package/js_ext/ace-editor/mode-mel.js +213 -0
  263. package/js_ext/ace-editor/mode-mips.js +231 -0
  264. package/js_ext/ace-editor/mode-mixal.js +110 -0
  265. package/js_ext/ace-editor/mode-mushcode.js +642 -0
  266. package/js_ext/ace-editor/mode-mysql.js +150 -0
  267. package/js_ext/ace-editor/mode-nasal.js +513 -0
  268. package/js_ext/ace-editor/mode-nginx.js +262 -0
  269. package/js_ext/ace-editor/mode-nim.js +325 -0
  270. package/js_ext/ace-editor/mode-nix.js +555 -0
  271. package/js_ext/ace-editor/mode-nsis.js +279 -0
  272. package/js_ext/ace-editor/mode-nunjucks.js +2677 -0
  273. package/js_ext/ace-editor/mode-objectivec.js +626 -0
  274. package/js_ext/ace-editor/mode-ocaml.js +378 -0
  275. package/js_ext/ace-editor/mode-odin.js +449 -0
  276. package/js_ext/ace-editor/mode-partiql.js +750 -0
  277. package/js_ext/ace-editor/mode-pascal.js +204 -0
  278. package/js_ext/ace-editor/mode-perl.js +318 -0
  279. package/js_ext/ace-editor/mode-pgsql.js +1860 -0
  280. package/js_ext/ace-editor/mode-php.js +14072 -0
  281. package/js_ext/ace-editor/mode-php_laravel_blade.js +14260 -0
  282. package/js_ext/ace-editor/mode-pig.js +278 -0
  283. package/js_ext/ace-editor/mode-plain_text.js +27 -0
  284. package/js_ext/ace-editor/mode-plsql.js +268 -0
  285. package/js_ext/ace-editor/mode-powershell.js +567 -0
  286. package/js_ext/ace-editor/mode-praat.js +412 -0
  287. package/js_ext/ace-editor/mode-prisma.js +457 -0
  288. package/js_ext/ace-editor/mode-prolog.js +305 -0
  289. package/js_ext/ace-editor/mode-properties.js +69 -0
  290. package/js_ext/ace-editor/mode-protobuf.js +498 -0
  291. package/js_ext/ace-editor/mode-prql.js +323 -0
  292. package/js_ext/ace-editor/mode-puppet.js +316 -0
  293. package/js_ext/ace-editor/mode-python.js +476 -0
  294. package/js_ext/ace-editor/mode-qml.js +346 -0
  295. package/js_ext/ace-editor/mode-r.js +387 -0
  296. package/js_ext/ace-editor/mode-raku.js +516 -0
  297. package/js_ext/ace-editor/mode-razor.js +2697 -0
  298. package/js_ext/ace-editor/mode-rdoc.js +286 -0
  299. package/js_ext/ace-editor/mode-red.js +388 -0
  300. package/js_ext/ace-editor/mode-redshift.js +321 -0
  301. package/js_ext/ace-editor/mode-rhtml.js +2750 -0
  302. package/js_ext/ace-editor/mode-robot.js +168 -0
  303. package/js_ext/ace-editor/mode-rst.js +245 -0
  304. package/js_ext/ace-editor/mode-ruby.js +921 -0
  305. package/js_ext/ace-editor/mode-rust.js +393 -0
  306. package/js_ext/ace-editor/mode-sac.js +349 -0
  307. package/js_ext/ace-editor/mode-sass.js +480 -0
  308. package/js_ext/ace-editor/mode-scad.js +350 -0
  309. package/js_ext/ace-editor/mode-scala.js +1395 -0
  310. package/js_ext/ace-editor/mode-scheme.js +210 -0
  311. package/js_ext/ace-editor/mode-scrypt.js +317 -0
  312. package/js_ext/ace-editor/mode-scss.js +768 -0
  313. package/js_ext/ace-editor/mode-sh.js +387 -0
  314. package/js_ext/ace-editor/mode-sjs.js +1393 -0
  315. package/js_ext/ace-editor/mode-slim.js +4770 -0
  316. package/js_ext/ace-editor/mode-smarty.js +2436 -0
  317. package/js_ext/ace-editor/mode-smithy.js +456 -0
  318. package/js_ext/ace-editor/mode-snippets.js +183 -0
  319. package/js_ext/ace-editor/mode-soy_template.js +2611 -0
  320. package/js_ext/ace-editor/mode-space.js +151 -0
  321. package/js_ext/ace-editor/mode-sparql.js +288 -0
  322. package/js_ext/ace-editor/mode-sql.js +221 -0
  323. package/js_ext/ace-editor/mode-sqlserver.js +391 -0
  324. package/js_ext/ace-editor/mode-stylus.js +443 -0
  325. package/js_ext/ace-editor/mode-svg.js +1487 -0
  326. package/js_ext/ace-editor/mode-swift.js +342 -0
  327. package/js_ext/ace-editor/mode-tcl.js +338 -0
  328. package/js_ext/ace-editor/mode-terraform.js +346 -0
  329. package/js_ext/ace-editor/mode-tex.js +212 -0
  330. package/js_ext/ace-editor/mode-text.js +9 -0
  331. package/js_ext/ace-editor/mode-textile.js +125 -0
  332. package/js_ext/ace-editor/mode-toml.js +129 -0
  333. package/js_ext/ace-editor/mode-tsv.js +124 -0
  334. package/js_ext/ace-editor/mode-tsx.js +1276 -0
  335. package/js_ext/ace-editor/mode-turtle.js +264 -0
  336. package/js_ext/ace-editor/mode-twig.js +2502 -0
  337. package/js_ext/ace-editor/mode-typescript.js +1254 -0
  338. package/js_ext/ace-editor/mode-vala.js +554 -0
  339. package/js_ext/ace-editor/mode-vbscript.js +731 -0
  340. package/js_ext/ace-editor/mode-velocity.js +2580 -0
  341. package/js_ext/ace-editor/mode-verilog.js +98 -0
  342. package/js_ext/ace-editor/mode-vhdl.js +94 -0
  343. package/js_ext/ace-editor/mode-visualforce.js +2454 -0
  344. package/js_ext/ace-editor/mode-vue.js +3834 -0
  345. package/js_ext/ace-editor/mode-wollok.js +1329 -0
  346. package/js_ext/ace-editor/mode-xml.js +477 -0
  347. package/js_ext/ace-editor/mode-xquery.js +2589 -0
  348. package/js_ext/ace-editor/mode-yaml.js +395 -0
  349. package/js_ext/ace-editor/mode-zeek.js +502 -0
  350. package/js_ext/ace-editor/mode-zig.js +585 -0
  351. package/js_ext/ace-editor/snippets/abap.js +9 -0
  352. package/js_ext/ace-editor/snippets/abc.js +16 -0
  353. package/js_ext/ace-editor/snippets/actionscript.js +16 -0
  354. package/js_ext/ace-editor/snippets/ada.js +9 -0
  355. package/js_ext/ace-editor/snippets/alda.js +9 -0
  356. package/js_ext/ace-editor/snippets/apache_conf.js +9 -0
  357. package/js_ext/ace-editor/snippets/apex.js +9 -0
  358. package/js_ext/ace-editor/snippets/applescript.js +9 -0
  359. package/js_ext/ace-editor/snippets/aql.js +9 -0
  360. package/js_ext/ace-editor/snippets/asciidoc.js +9 -0
  361. package/js_ext/ace-editor/snippets/asl.js +9 -0
  362. package/js_ext/ace-editor/snippets/assembly_arm32.js +9 -0
  363. package/js_ext/ace-editor/snippets/assembly_x86.js +9 -0
  364. package/js_ext/ace-editor/snippets/astro.js +9 -0
  365. package/js_ext/ace-editor/snippets/autohotkey.js +9 -0
  366. package/js_ext/ace-editor/snippets/basic.js +9 -0
  367. package/js_ext/ace-editor/snippets/batchfile.js +9 -0
  368. package/js_ext/ace-editor/snippets/bibtex.js +9 -0
  369. package/js_ext/ace-editor/snippets/c9search.js +9 -0
  370. package/js_ext/ace-editor/snippets/c_cpp.js +16 -0
  371. package/js_ext/ace-editor/snippets/cirru.js +9 -0
  372. package/js_ext/ace-editor/snippets/clojure.js +16 -0
  373. package/js_ext/ace-editor/snippets/clue.js +9 -0
  374. package/js_ext/ace-editor/snippets/cobol.js +9 -0
  375. package/js_ext/ace-editor/snippets/coffee.js +16 -0
  376. package/js_ext/ace-editor/snippets/coldfusion.js +9 -0
  377. package/js_ext/ace-editor/snippets/crystal.js +9 -0
  378. package/js_ext/ace-editor/snippets/csharp.js +9 -0
  379. package/js_ext/ace-editor/snippets/csound_document.js +16 -0
  380. package/js_ext/ace-editor/snippets/csound_orchestra.js +16 -0
  381. package/js_ext/ace-editor/snippets/csound_score.js +9 -0
  382. package/js_ext/ace-editor/snippets/csp.js +9 -0
  383. package/js_ext/ace-editor/snippets/css.js +16 -0
  384. package/js_ext/ace-editor/snippets/csv.js +9 -0
  385. package/js_ext/ace-editor/snippets/curly.js +9 -0
  386. package/js_ext/ace-editor/snippets/cuttlefish.js +9 -0
  387. package/js_ext/ace-editor/snippets/d.js +9 -0
  388. package/js_ext/ace-editor/snippets/dart.js +16 -0
  389. package/js_ext/ace-editor/snippets/diff.js +16 -0
  390. package/js_ext/ace-editor/snippets/django.js +16 -0
  391. package/js_ext/ace-editor/snippets/dockerfile.js +9 -0
  392. package/js_ext/ace-editor/snippets/dot.js +9 -0
  393. package/js_ext/ace-editor/snippets/drools.js +16 -0
  394. package/js_ext/ace-editor/snippets/edifact.js +16 -0
  395. package/js_ext/ace-editor/snippets/eiffel.js +9 -0
  396. package/js_ext/ace-editor/snippets/ejs.js +9 -0
  397. package/js_ext/ace-editor/snippets/elixir.js +9 -0
  398. package/js_ext/ace-editor/snippets/elm.js +9 -0
  399. package/js_ext/ace-editor/snippets/erlang.js +16 -0
  400. package/js_ext/ace-editor/snippets/flix.js +9 -0
  401. package/js_ext/ace-editor/snippets/forth.js +9 -0
  402. package/js_ext/ace-editor/snippets/fortran.js +9 -0
  403. package/js_ext/ace-editor/snippets/fsharp.js +9 -0
  404. package/js_ext/ace-editor/snippets/fsl.js +16 -0
  405. package/js_ext/ace-editor/snippets/ftl.js +9 -0
  406. package/js_ext/ace-editor/snippets/gcode.js +9 -0
  407. package/js_ext/ace-editor/snippets/gherkin.js +9 -0
  408. package/js_ext/ace-editor/snippets/gitignore.js +9 -0
  409. package/js_ext/ace-editor/snippets/glsl.js +9 -0
  410. package/js_ext/ace-editor/snippets/gobstones.js +16 -0
  411. package/js_ext/ace-editor/snippets/golang.js +9 -0
  412. package/js_ext/ace-editor/snippets/graphqlschema.js +16 -0
  413. package/js_ext/ace-editor/snippets/groovy.js +9 -0
  414. package/js_ext/ace-editor/snippets/haml.js +16 -0
  415. package/js_ext/ace-editor/snippets/handlebars.js +9 -0
  416. package/js_ext/ace-editor/snippets/haskell.js +16 -0
  417. package/js_ext/ace-editor/snippets/haskell_cabal.js +9 -0
  418. package/js_ext/ace-editor/snippets/haxe.js +9 -0
  419. package/js_ext/ace-editor/snippets/hjson.js +9 -0
  420. package/js_ext/ace-editor/snippets/html.js +16 -0
  421. package/js_ext/ace-editor/snippets/html_elixir.js +9 -0
  422. package/js_ext/ace-editor/snippets/html_ruby.js +9 -0
  423. package/js_ext/ace-editor/snippets/ini.js +9 -0
  424. package/js_ext/ace-editor/snippets/io.js +74 -0
  425. package/js_ext/ace-editor/snippets/ion.js +9 -0
  426. package/js_ext/ace-editor/snippets/jack.js +9 -0
  427. package/js_ext/ace-editor/snippets/jade.js +9 -0
  428. package/js_ext/ace-editor/snippets/java.js +16 -0
  429. package/js_ext/ace-editor/snippets/javascript.js +16 -0
  430. package/js_ext/ace-editor/snippets/jexl.js +9 -0
  431. package/js_ext/ace-editor/snippets/json.js +9 -0
  432. package/js_ext/ace-editor/snippets/json5.js +9 -0
  433. package/js_ext/ace-editor/snippets/jsoniq.js +78 -0
  434. package/js_ext/ace-editor/snippets/jsp.js +16 -0
  435. package/js_ext/ace-editor/snippets/jssm.js +9 -0
  436. package/js_ext/ace-editor/snippets/jsx.js +9 -0
  437. package/js_ext/ace-editor/snippets/julia.js +9 -0
  438. package/js_ext/ace-editor/snippets/kotlin.js +9 -0
  439. package/js_ext/ace-editor/snippets/latex.js +9 -0
  440. package/js_ext/ace-editor/snippets/latte.js +9 -0
  441. package/js_ext/ace-editor/snippets/less.js +9 -0
  442. package/js_ext/ace-editor/snippets/liquid.js +16 -0
  443. package/js_ext/ace-editor/snippets/lisp.js +9 -0
  444. package/js_ext/ace-editor/snippets/livescript.js +9 -0
  445. package/js_ext/ace-editor/snippets/logiql.js +9 -0
  446. package/js_ext/ace-editor/snippets/logtalk.js +9 -0
  447. package/js_ext/ace-editor/snippets/lsl.js +16 -0
  448. package/js_ext/ace-editor/snippets/lua.js +16 -0
  449. package/js_ext/ace-editor/snippets/luapage.js +9 -0
  450. package/js_ext/ace-editor/snippets/lucene.js +9 -0
  451. package/js_ext/ace-editor/snippets/makefile.js +16 -0
  452. package/js_ext/ace-editor/snippets/markdown.js +16 -0
  453. package/js_ext/ace-editor/snippets/mask.js +9 -0
  454. package/js_ext/ace-editor/snippets/matlab.js +9 -0
  455. package/js_ext/ace-editor/snippets/maze.js +16 -0
  456. package/js_ext/ace-editor/snippets/mediawiki.js +9 -0
  457. package/js_ext/ace-editor/snippets/mel.js +9 -0
  458. package/js_ext/ace-editor/snippets/mips.js +9 -0
  459. package/js_ext/ace-editor/snippets/mixal.js +9 -0
  460. package/js_ext/ace-editor/snippets/mushcode.js +9 -0
  461. package/js_ext/ace-editor/snippets/mysql.js +9 -0
  462. package/js_ext/ace-editor/snippets/nasal.js +9 -0
  463. package/js_ext/ace-editor/snippets/nginx.js +9 -0
  464. package/js_ext/ace-editor/snippets/nim.js +9 -0
  465. package/js_ext/ace-editor/snippets/nix.js +9 -0
  466. package/js_ext/ace-editor/snippets/nsis.js +9 -0
  467. package/js_ext/ace-editor/snippets/nunjucks.js +9 -0
  468. package/js_ext/ace-editor/snippets/objectivec.js +9 -0
  469. package/js_ext/ace-editor/snippets/ocaml.js +9 -0
  470. package/js_ext/ace-editor/snippets/odin.js +9 -0
  471. package/js_ext/ace-editor/snippets/partiql.js +9 -0
  472. package/js_ext/ace-editor/snippets/pascal.js +9 -0
  473. package/js_ext/ace-editor/snippets/perl.js +16 -0
  474. package/js_ext/ace-editor/snippets/pgsql.js +9 -0
  475. package/js_ext/ace-editor/snippets/php.js +16 -0
  476. package/js_ext/ace-editor/snippets/php_laravel_blade.js +9 -0
  477. package/js_ext/ace-editor/snippets/pig.js +9 -0
  478. package/js_ext/ace-editor/snippets/plain_text.js +9 -0
  479. package/js_ext/ace-editor/snippets/plsql.js +9 -0
  480. package/js_ext/ace-editor/snippets/powershell.js +9 -0
  481. package/js_ext/ace-editor/snippets/praat.js +9 -0
  482. package/js_ext/ace-editor/snippets/prisma.js +9 -0
  483. package/js_ext/ace-editor/snippets/prolog.js +9 -0
  484. package/js_ext/ace-editor/snippets/properties.js +9 -0
  485. package/js_ext/ace-editor/snippets/protobuf.js +9 -0
  486. package/js_ext/ace-editor/snippets/prql.js +9 -0
  487. package/js_ext/ace-editor/snippets/puppet.js +9 -0
  488. package/js_ext/ace-editor/snippets/python.js +16 -0
  489. package/js_ext/ace-editor/snippets/qml.js +9 -0
  490. package/js_ext/ace-editor/snippets/r.js +16 -0
  491. package/js_ext/ace-editor/snippets/raku.js +9 -0
  492. package/js_ext/ace-editor/snippets/razor.js +16 -0
  493. package/js_ext/ace-editor/snippets/rdoc.js +9 -0
  494. package/js_ext/ace-editor/snippets/red.js +9 -0
  495. package/js_ext/ace-editor/snippets/redshift.js +9 -0
  496. package/js_ext/ace-editor/snippets/rhtml.js +9 -0
  497. package/js_ext/ace-editor/snippets/robot.js +16 -0
  498. package/js_ext/ace-editor/snippets/rst.js +16 -0
  499. package/js_ext/ace-editor/snippets/ruby.js +16 -0
  500. package/js_ext/ace-editor/snippets/rust.js +9 -0
  501. package/js_ext/ace-editor/snippets/sac.js +9 -0
  502. package/js_ext/ace-editor/snippets/sass.js +9 -0
  503. package/js_ext/ace-editor/snippets/scad.js +9 -0
  504. package/js_ext/ace-editor/snippets/scala.js +9 -0
  505. package/js_ext/ace-editor/snippets/scheme.js +9 -0
  506. package/js_ext/ace-editor/snippets/scrypt.js +9 -0
  507. package/js_ext/ace-editor/snippets/scss.js +9 -0
  508. package/js_ext/ace-editor/snippets/sh.js +16 -0
  509. package/js_ext/ace-editor/snippets/sjs.js +9 -0
  510. package/js_ext/ace-editor/snippets/slim.js +9 -0
  511. package/js_ext/ace-editor/snippets/smarty.js +9 -0
  512. package/js_ext/ace-editor/snippets/smithy.js +9 -0
  513. package/js_ext/ace-editor/snippets/snippets.js +16 -0
  514. package/js_ext/ace-editor/snippets/soy_template.js +9 -0
  515. package/js_ext/ace-editor/snippets/space.js +9 -0
  516. package/js_ext/ace-editor/snippets/sparql.js +9 -0
  517. package/js_ext/ace-editor/snippets/sql.js +16 -0
  518. package/js_ext/ace-editor/snippets/sqlserver.js +16 -0
  519. package/js_ext/ace-editor/snippets/stylus.js +9 -0
  520. package/js_ext/ace-editor/snippets/svg.js +9 -0
  521. package/js_ext/ace-editor/snippets/swift.js +9 -0
  522. package/js_ext/ace-editor/snippets/tcl.js +16 -0
  523. package/js_ext/ace-editor/snippets/terraform.js +9 -0
  524. package/js_ext/ace-editor/snippets/tex.js +16 -0
  525. package/js_ext/ace-editor/snippets/text.js +9 -0
  526. package/js_ext/ace-editor/snippets/textile.js +16 -0
  527. package/js_ext/ace-editor/snippets/toml.js +9 -0
  528. package/js_ext/ace-editor/snippets/tsv.js +9 -0
  529. package/js_ext/ace-editor/snippets/tsx.js +9 -0
  530. package/js_ext/ace-editor/snippets/turtle.js +9 -0
  531. package/js_ext/ace-editor/snippets/twig.js +9 -0
  532. package/js_ext/ace-editor/snippets/typescript.js +9 -0
  533. package/js_ext/ace-editor/snippets/vala.js +199 -0
  534. package/js_ext/ace-editor/snippets/vbscript.js +9 -0
  535. package/js_ext/ace-editor/snippets/velocity.js +17 -0
  536. package/js_ext/ace-editor/snippets/verilog.js +9 -0
  537. package/js_ext/ace-editor/snippets/vhdl.js +9 -0
  538. package/js_ext/ace-editor/snippets/visualforce.js +9 -0
  539. package/js_ext/ace-editor/snippets/vue.js +9 -0
  540. package/js_ext/ace-editor/snippets/wollok.js +16 -0
  541. package/js_ext/ace-editor/snippets/xml.js +9 -0
  542. package/js_ext/ace-editor/snippets/xquery.js +78 -0
  543. package/js_ext/ace-editor/snippets/yaml.js +9 -0
  544. package/js_ext/ace-editor/snippets/zeek.js +9 -0
  545. package/js_ext/ace-editor/snippets/zig.js +9 -0
  546. package/js_ext/ace-editor/theme-ambiance.js +18 -0
  547. package/js_ext/ace-editor/theme-chaos.js +18 -0
  548. package/js_ext/ace-editor/theme-chrome.js +18 -0
  549. package/js_ext/ace-editor/theme-cloud9_day.js +19 -0
  550. package/js_ext/ace-editor/theme-cloud9_night.js +18 -0
  551. package/js_ext/ace-editor/theme-cloud9_night_low_color.js +18 -0
  552. package/js_ext/ace-editor/theme-cloud_editor.js +19 -0
  553. package/js_ext/ace-editor/theme-cloud_editor_dark.js +19 -0
  554. package/js_ext/ace-editor/theme-clouds.js +18 -0
  555. package/js_ext/ace-editor/theme-clouds_midnight.js +18 -0
  556. package/js_ext/ace-editor/theme-cobalt.js +18 -0
  557. package/js_ext/ace-editor/theme-crimson_editor.js +18 -0
  558. package/js_ext/ace-editor/theme-dawn.js +18 -0
  559. package/js_ext/ace-editor/theme-dracula.js +19 -0
  560. package/js_ext/ace-editor/theme-dreamweaver.js +18 -0
  561. package/js_ext/ace-editor/theme-eclipse.js +19 -0
  562. package/js_ext/ace-editor/theme-github.js +18 -0
  563. package/js_ext/ace-editor/theme-github_dark.js +18 -0
  564. package/js_ext/ace-editor/theme-github_light_default.js +18 -0
  565. package/js_ext/ace-editor/theme-gob.js +18 -0
  566. package/js_ext/ace-editor/theme-gruvbox.js +18 -0
  567. package/js_ext/ace-editor/theme-gruvbox_dark_hard.js +18 -0
  568. package/js_ext/ace-editor/theme-gruvbox_light_hard.js +18 -0
  569. package/js_ext/ace-editor/theme-idle_fingers.js +18 -0
  570. package/js_ext/ace-editor/theme-iplastic.js +18 -0
  571. package/js_ext/ace-editor/theme-katzenmilch.js +18 -0
  572. package/js_ext/ace-editor/theme-kr_theme.js +18 -0
  573. package/js_ext/ace-editor/theme-kuroir.js +18 -0
  574. package/js_ext/ace-editor/theme-merbivore.js +18 -0
  575. package/js_ext/ace-editor/theme-merbivore_soft.js +18 -0
  576. package/js_ext/ace-editor/theme-mono_industrial.js +18 -0
  577. package/js_ext/ace-editor/theme-monokai.js +18 -0
  578. package/js_ext/ace-editor/theme-nord_dark.js +19 -0
  579. package/js_ext/ace-editor/theme-one_dark.js +18 -0
  580. package/js_ext/ace-editor/theme-pastel_on_dark.js +18 -0
  581. package/js_ext/ace-editor/theme-solarized_dark.js +18 -0
  582. package/js_ext/ace-editor/theme-solarized_light.js +18 -0
  583. package/js_ext/ace-editor/theme-sqlserver.js +18 -0
  584. package/js_ext/ace-editor/theme-terminal.js +18 -0
  585. package/js_ext/ace-editor/theme-textmate.js +16 -0
  586. package/js_ext/ace-editor/theme-tomorrow.js +18 -0
  587. package/js_ext/ace-editor/theme-tomorrow_night.js +18 -0
  588. package/js_ext/ace-editor/theme-tomorrow_night_blue.js +18 -0
  589. package/js_ext/ace-editor/theme-tomorrow_night_bright.js +18 -0
  590. package/js_ext/ace-editor/theme-tomorrow_night_eighties.js +18 -0
  591. package/js_ext/ace-editor/theme-twilight.js +18 -0
  592. package/js_ext/ace-editor/theme-vibrant_ink.js +18 -0
  593. package/js_ext/ace-editor/theme-xcode.js +18 -0
  594. package/js_ext/ace-editor/worker-base.js +1332 -0
  595. package/js_ext/ace-editor/worker-coffee.js +1381 -0
  596. package/js_ext/ace-editor/worker-css.js +8913 -0
  597. package/js_ext/ace-editor/worker-html.js +10843 -0
  598. package/js_ext/ace-editor/worker-javascript.js +15353 -0
  599. package/js_ext/ace-editor/worker-json.js +1626 -0
  600. package/js_ext/ace-editor/worker-lua.js +3519 -0
  601. package/js_ext/ace-editor/worker-php.js +3788 -0
  602. package/js_ext/ace-editor/worker-xml.js +3122 -0
  603. package/js_ext/ace-editor/worker-xquery.js +57579 -0
  604. package/js_ext/ace-editor/worker-yaml.js +5819 -0
  605. package/js_ext/bootstrap.bundle.min.js +7 -0
  606. package/js_ext/highlight/default.min.css +9 -0
  607. package/js_ext/highlight/go.min.js +14 -0
  608. package/js_ext/highlight/highlight.min.js +1207 -0
  609. package/js_ext/highlight/stackoverflow-dark.min.css +13 -0
  610. package/js_ext/idb-keyval-6.2.2.mjs +7 -0
  611. package/js_ext/json-viewer.bundle.js +52 -0
  612. package/js_ext/loglevel-plugin-prefix.min.js +1 -0
  613. package/js_ext/loglevel.min.js +2 -0
  614. package/js_ext/markdown/auto-render.min.js +1 -0
  615. package/js_ext/markdown/auto-render.mjs +245 -0
  616. package/js_ext/markdown/fonts/KaTeX_AMS-Regular.woff +0 -0
  617. package/js_ext/markdown/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  618. package/js_ext/markdown/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  619. package/js_ext/markdown/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  620. package/js_ext/markdown/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  621. package/js_ext/markdown/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  622. package/js_ext/markdown/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  623. package/js_ext/markdown/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  624. package/js_ext/markdown/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  625. package/js_ext/markdown/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  626. package/js_ext/markdown/fonts/KaTeX_Main-Bold.woff +0 -0
  627. package/js_ext/markdown/fonts/KaTeX_Main-Bold.woff2 +0 -0
  628. package/js_ext/markdown/fonts/KaTeX_Main-Italic.woff +0 -0
  629. package/js_ext/markdown/fonts/KaTeX_Main-Italic.woff2 +0 -0
  630. package/js_ext/markdown/fonts/KaTeX_Main-Regular.woff +0 -0
  631. package/js_ext/markdown/fonts/KaTeX_Main-Regular.woff2 +0 -0
  632. package/js_ext/markdown/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  633. package/js_ext/markdown/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  634. package/js_ext/markdown/fonts/KaTeX_Math-Italic.woff +0 -0
  635. package/js_ext/markdown/fonts/KaTeX_Math-Italic.woff2 +0 -0
  636. package/js_ext/markdown/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  637. package/js_ext/markdown/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  638. package/js_ext/markdown/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  639. package/js_ext/markdown/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  640. package/js_ext/markdown/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  641. package/js_ext/markdown/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  642. package/js_ext/markdown/fonts/KaTeX_Script-Regular.ttf +0 -0
  643. package/js_ext/markdown/fonts/KaTeX_Script-Regular.woff +0 -0
  644. package/js_ext/markdown/fonts/KaTeX_Script-Regular.woff2 +0 -0
  645. package/js_ext/markdown/fonts/KaTeX_Size1-Regular.ttf +0 -0
  646. package/js_ext/markdown/fonts/KaTeX_Size1-Regular.woff +0 -0
  647. package/js_ext/markdown/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  648. package/js_ext/markdown/fonts/KaTeX_Size2-Regular.woff +0 -0
  649. package/js_ext/markdown/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  650. package/js_ext/markdown/fonts/KaTeX_Size3-Regular.woff +0 -0
  651. package/js_ext/markdown/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  652. package/js_ext/markdown/fonts/KaTeX_Size4-Regular.ttf +0 -0
  653. package/js_ext/markdown/fonts/KaTeX_Size4-Regular.woff +0 -0
  654. package/js_ext/markdown/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  655. package/js_ext/markdown/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  656. package/js_ext/markdown/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  657. package/js_ext/markdown/katex.min.css +1 -0
  658. package/js_ext/markdown/katex.min.js +1 -0
  659. package/js_ext/markdown/katex.mjs +18416 -0
  660. package/js_ext/markdown/markdown-it.min.js +3 -0
  661. package/js_ext/markdown/markdownItAnchor.umd.js +2 -0
  662. package/js_ext/mitt.mjs +2 -0
  663. package/js_ext/moment.min.js +1 -0
  664. package/js_ext/msgpack.mjs +1612 -0
  665. package/js_ext/rxjs.umd.min.js +195 -0
  666. package/js_ext/rxjs.umd.min.js.map +1 -0
  667. package/js_ext/vue-router.esm-browser.prod.js +6 -0
  668. package/js_ext/vue.esm-browser.min.js +18 -0
  669. package/js_ext/vue.esm-browser.prod.min.js +3 -0
  670. package/js_ext/vue3-sfc-loader.esm.js +1840 -0
  671. package/js_ext/vue3-sfc-loader.esm.js.map +4 -0
  672. package/js_ext/vue3-sfc-loader.js +1839 -0
  673. package/js_ext/wavesurfer.esm.mjs +1 -0
  674. package/js_ext/xstate.web.mjs +15 -0
  675. package/package.json +50 -0
  676. package/style.css +31 -0
@@ -0,0 +1,4265 @@
1
+ ace.define("ace/ext/diff/scroll_diff_decorator",["require","exports","module","ace/layer/decorators"], function(require, exports, module){var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __values = (this && this.__values) || function(o) {
17
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
18
+ if (m) return m.call(o);
19
+ if (o && typeof o.length === "number") return {
20
+ next: function () {
21
+ if (o && i >= o.length) o = void 0;
22
+ return { value: o && o[i++], done: !o };
23
+ }
24
+ };
25
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
26
+ };
27
+ var Decorator = require("../../layer/decorators").Decorator;
28
+ var ScrollDiffDecorator = /** @class */ (function (_super) {
29
+ __extends(ScrollDiffDecorator, _super);
30
+ function ScrollDiffDecorator(scrollbarV, renderer, forInlineDiff) {
31
+ var _this = _super.call(this, scrollbarV, renderer) || this;
32
+ _this.colors.dark["delete"] = "rgba(255, 18, 18, 1)";
33
+ _this.colors.dark["insert"] = "rgba(18, 136, 18, 1)";
34
+ _this.colors.light["delete"] = "rgb(255,51,51)";
35
+ _this.colors.light["insert"] = "rgb(32,133,72)";
36
+ _this.$zones = [];
37
+ _this.$forInlineDiff = forInlineDiff;
38
+ return _this;
39
+ }
40
+ ScrollDiffDecorator.prototype.addZone = function (startRow, endRow, type) {
41
+ this.$zones.push({
42
+ startRow: startRow,
43
+ endRow: endRow,
44
+ type: type
45
+ });
46
+ };
47
+ ScrollDiffDecorator.prototype.setSessions = function (sessionA, sessionB) {
48
+ this.sessionA = sessionA;
49
+ this.sessionB = sessionB;
50
+ };
51
+ ScrollDiffDecorator.prototype.$updateDecorators = function (config) {
52
+ if (typeof this.canvas.getContext !== "function") {
53
+ return;
54
+ }
55
+ _super.prototype.$updateDecorators.call(this, config);
56
+ if (this.$zones.length > 0) {
57
+ var colors = (this.renderer.theme.isDark === true) ? this.colors.dark : this.colors.light;
58
+ var ctx = this.canvas.getContext("2d");
59
+ this.$setDiffDecorators(ctx, colors);
60
+ }
61
+ };
62
+ ScrollDiffDecorator.prototype.$transformPosition = function (row, type) {
63
+ if (type == "delete") {
64
+ return this.sessionA.documentToScreenRow(row, 0);
65
+ }
66
+ else {
67
+ return this.sessionB.documentToScreenRow(row, 0);
68
+ }
69
+ };
70
+ ScrollDiffDecorator.prototype.$setDiffDecorators = function (ctx, colors) {
71
+ var e_1, _a;
72
+ var _this = this;
73
+ function compare(a, b) {
74
+ if (a.from === b.from) {
75
+ return a.to - b.to;
76
+ }
77
+ return a.from - b.from;
78
+ }
79
+ var zones = this.$zones;
80
+ if (zones) {
81
+ var resolvedZones = [];
82
+ var deleteZones = zones.filter(function (z) { return z.type === "delete"; });
83
+ var insertZones = zones.filter(function (z) { return z.type === "insert"; });
84
+ [deleteZones, insertZones].forEach(function (typeZones) {
85
+ typeZones.forEach(function (zone, i) {
86
+ var offset1 = _this.$transformPosition(zone.startRow, zone.type) * _this.lineHeight;
87
+ var offset2 = _this.$transformPosition(zone.endRow, zone.type) * _this.lineHeight + _this.lineHeight;
88
+ var y1 = Math.round(_this.heightRatio * offset1);
89
+ var y2 = Math.round(_this.heightRatio * offset2);
90
+ var padding = 1;
91
+ var ycenter = Math.round((y1 + y2) / 2);
92
+ var halfHeight = (y2 - ycenter);
93
+ if (halfHeight < _this.halfMinDecorationHeight) {
94
+ halfHeight = _this.halfMinDecorationHeight;
95
+ }
96
+ var previousZone = resolvedZones[resolvedZones.length - 1];
97
+ if (i > 0 && previousZone && previousZone.type === zone.type && ycenter - halfHeight < previousZone.to + padding) {
98
+ ycenter = resolvedZones[resolvedZones.length - 1].to + padding + halfHeight;
99
+ }
100
+ if (ycenter - halfHeight < 0) {
101
+ ycenter = halfHeight;
102
+ }
103
+ if (ycenter + halfHeight > _this.canvasHeight) {
104
+ ycenter = _this.canvasHeight - halfHeight;
105
+ }
106
+ resolvedZones.push({
107
+ type: zone.type,
108
+ from: ycenter - halfHeight,
109
+ to: ycenter + halfHeight,
110
+ color: colors[zone.type] || null
111
+ });
112
+ });
113
+ });
114
+ resolvedZones = resolvedZones.sort(compare);
115
+ try {
116
+ for (var resolvedZones_1 = __values(resolvedZones), resolvedZones_1_1 = resolvedZones_1.next(); !resolvedZones_1_1.done; resolvedZones_1_1 = resolvedZones_1.next()) {
117
+ var zone = resolvedZones_1_1.value;
118
+ ctx.fillStyle = zone.color || null;
119
+ var zoneFrom = zone.from;
120
+ var zoneTo = zone.to;
121
+ var zoneHeight = zoneTo - zoneFrom;
122
+ if (this.$forInlineDiff) {
123
+ ctx.fillRect(this.oneZoneWidth, zoneFrom, 2 * this.oneZoneWidth, zoneHeight);
124
+ }
125
+ else {
126
+ if (zone.type == "delete") {
127
+ ctx.fillRect(this.oneZoneWidth, zoneFrom, this.oneZoneWidth, zoneHeight);
128
+ }
129
+ else {
130
+ ctx.fillRect(2 * this.oneZoneWidth, zoneFrom, this.oneZoneWidth, zoneHeight);
131
+ }
132
+ }
133
+ }
134
+ }
135
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
136
+ finally {
137
+ try {
138
+ if (resolvedZones_1_1 && !resolvedZones_1_1.done && (_a = resolvedZones_1.return)) _a.call(resolvedZones_1);
139
+ }
140
+ finally { if (e_1) throw e_1.error; }
141
+ }
142
+ }
143
+ };
144
+ ScrollDiffDecorator.prototype.setZoneWidth = function () {
145
+ this.oneZoneWidth = Math.round(this.canvasWidth / 3);
146
+ };
147
+ return ScrollDiffDecorator;
148
+ }(Decorator));
149
+ exports.ScrollDiffDecorator = ScrollDiffDecorator;
150
+
151
+ });
152
+
153
+ ace.define("ace/ext/diff/styles-css.js",["require","exports","module"], function(require, exports, module){exports.cssText = "\n/*\n * Line Markers\n */\n.ace_diff {\n position: absolute;\n z-index: 0;\n}\n.ace_diff.inline {\n z-index: 20;\n}\n/*\n * Light Colors \n */\n.ace_diff.insert {\n background-color: #EFFFF1;\n}\n.ace_diff.delete {\n background-color: #FFF1F1;\n}\n.ace_diff.aligned_diff {\n background: rgba(206, 194, 191, 0.26);\n background: repeating-linear-gradient(\n 45deg,\n rgba(122, 111, 108, 0.26),\n rgba(122, 111, 108, 0.26) 5px,\n rgba(0, 0, 0, 0) 5px,\n rgba(0, 0, 0, 0) 10px \n );\n}\n\n.ace_diff.insert.inline {\n background-color: rgb(74 251 74 / 18%); \n}\n.ace_diff.delete.inline {\n background-color: rgb(251 74 74 / 15%);\n}\n\n.ace_diff.delete.inline.empty {\n background-color: rgba(255, 128, 79, 0.7);\n width: 2px !important;\n}\n\n.ace_diff.insert.inline.empty {\n background-color: rgba(49, 230, 96, 0.7);\n width: 2px !important;\n}\n\n.ace_diff-active-line {\n border-bottom: 1px solid;\n border-top: 1px solid;\n background: transparent;\n position: absolute;\n box-sizing: border-box;\n border-color: #9191ac;\n}\n\n.ace_dark .ace_diff-active-line {\n background: transparent;\n border-color: #75777a;\n}\n \n\n/* gutter changes */\n.ace_mini-diff_gutter-enabled > .ace_gutter-cell,\n.ace_mini-diff_gutter-enabled > .ace_gutter-cell_svg-icons {\n padding-right: 13px;\n}\n\n.ace_mini-diff_gutter_other > .ace_gutter-cell,\n.ace_mini-diff_gutter_other > .ace_gutter-cell_svg-icons {\n display: none;\n}\n\n.ace_mini-diff_gutter_other {\n pointer-events: none;\n}\n\n\n.ace_mini-diff_gutter-enabled > .mini-diff-added {\n background-color: #EFFFF1;\n border-left: 3px solid #2BB534;\n padding-left: 16px;\n display: block;\n}\n\n.ace_mini-diff_gutter-enabled > .mini-diff-deleted {\n background-color: #FFF1F1;\n border-left: 3px solid #EA7158;\n padding-left: 16px;\n display: block;\n}\n\n\n.ace_mini-diff_gutter-enabled > .mini-diff-added:after {\n position: absolute;\n right: 2px;\n content: \"+\";\n background-color: inherit;\n}\n\n.ace_mini-diff_gutter-enabled > .mini-diff-deleted:after {\n position: absolute;\n right: 2px;\n content: \"-\";\n background-color: inherit;\n}\n.ace_fade-fold-widgets:hover > .ace_folding-enabled > .mini-diff-added:after,\n.ace_fade-fold-widgets:hover > .ace_folding-enabled > .mini-diff-deleted:after {\n display: none;\n}\n\n.ace_diff_other .ace_selection {\n filter: drop-shadow(1px 2px 3px darkgray);\n}\n\n.ace_hidden_marker-layer .ace_bracket,\n.ace_hidden_marker-layer .ace_error_bracket {\n display: none;\n}\n\n\n\n/*\n * Dark Colors \n */\n\n.ace_dark .ace_diff.insert {\n background-color: #212E25;\n}\n.ace_dark .ace_diff.delete {\n background-color: #3F2222;\n}\n\n.ace_dark .ace_mini-diff_gutter-enabled > .mini-diff-added {\n background-color: #212E25;\n border-left-color:#00802F;\n}\n\n.ace_dark .ace_mini-diff_gutter-enabled > .mini-diff-deleted {\n background-color: #3F2222;\n border-left-color: #9C3838;\n}\n\n";
154
+
155
+ });
156
+
157
+ ace.define("ace/ext/diff/gutter_decorator",["require","exports","module","ace/lib/dom"], function(require, exports, module){var dom = require("../../lib/dom");
158
+ var MinimalGutterDiffDecorator = /** @class */ (function () {
159
+ function MinimalGutterDiffDecorator(editor, type) {
160
+ this.gutterClass = "ace_mini-diff_gutter-enabled";
161
+ this.gutterCellsClasses = {
162
+ add: "mini-diff-added",
163
+ delete: "mini-diff-deleted",
164
+ };
165
+ this.editor = editor;
166
+ this.type = type;
167
+ this.chunks = [];
168
+ this.attachToEditor();
169
+ }
170
+ MinimalGutterDiffDecorator.prototype.attachToEditor = function () {
171
+ this.renderGutters = this.renderGutters.bind(this);
172
+ dom.addCssClass(this.editor.renderer.$gutterLayer.element, this.gutterClass);
173
+ this.editor.renderer.$gutterLayer.on("afterRender", this.renderGutters);
174
+ };
175
+ MinimalGutterDiffDecorator.prototype.renderGutters = function (e, gutterLayer) {
176
+ var _this = this;
177
+ var cells = this.editor.renderer.$gutterLayer.$lines.cells;
178
+ cells.forEach(function (cell) {
179
+ cell.element.classList.remove(Object.values(_this.gutterCellsClasses));
180
+ });
181
+ var dir = this.type === -1 ? "old" : "new";
182
+ var diffClass = this.type === -1 ? this.gutterCellsClasses.delete : this.gutterCellsClasses.add;
183
+ this.chunks.forEach(function (lineChange) {
184
+ var startRow = lineChange[dir].start.row;
185
+ var endRow = lineChange[dir].end.row - 1;
186
+ cells.forEach(function (cell) {
187
+ if (cell.row >= startRow && cell.row <= endRow) {
188
+ cell.element.classList.add(diffClass);
189
+ }
190
+ });
191
+ });
192
+ };
193
+ MinimalGutterDiffDecorator.prototype.setDecorations = function (changes) {
194
+ this.chunks = changes;
195
+ this.renderGutters();
196
+ };
197
+ MinimalGutterDiffDecorator.prototype.dispose = function () {
198
+ dom.removeCssClass(this.editor.renderer.$gutterLayer.element, this.gutterClass);
199
+ this.editor.renderer.$gutterLayer.off("afterRender", this.renderGutters);
200
+ };
201
+ return MinimalGutterDiffDecorator;
202
+ }());
203
+ exports.MinimalGutterDiffDecorator = MinimalGutterDiffDecorator;
204
+
205
+ });
206
+
207
+ ace.define("ace/ext/diff/base_diff_view",["require","exports","module","ace/lib/oop","ace/range","ace/lib/dom","ace/config","ace/line_widgets","ace/ext/diff/scroll_diff_decorator","ace/ext/diff/styles-css.js","ace/editor","ace/virtual_renderer","ace/undomanager","ace/layer/decorators","ace/theme/textmate","ace/multi_select","ace/edit_session","ace/ext/diff/gutter_decorator"], function(require, exports, module){"use strict";
208
+ var __read = (this && this.__read) || function (o, n) {
209
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
210
+ if (!m) return o;
211
+ var i = m.call(o), r, ar = [], e;
212
+ try {
213
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
214
+ }
215
+ catch (error) { e = { error: error }; }
216
+ finally {
217
+ try {
218
+ if (r && !r.done && (m = i["return"])) m.call(i);
219
+ }
220
+ finally { if (e) throw e.error; }
221
+ }
222
+ return ar;
223
+ };
224
+ var oop = require("../../lib/oop");
225
+ var Range = require("../../range").Range;
226
+ var dom = require("../../lib/dom");
227
+ var config = require("../../config");
228
+ var LineWidgets = require("../../line_widgets").LineWidgets;
229
+ var ScrollDiffDecorator = require("./scroll_diff_decorator").ScrollDiffDecorator;
230
+ var css = require("./styles-css.js").cssText;
231
+ var Editor = require("../../editor").Editor;
232
+ var Renderer = require("../../virtual_renderer").VirtualRenderer;
233
+ var UndoManager = require("../../undomanager").UndoManager;
234
+ var Decorator = require("../../layer/decorators").Decorator;
235
+ require("../../theme/textmate");
236
+ require("../../multi_select");
237
+ var EditSession = require("../../edit_session").EditSession;
238
+ var MinimalGutterDiffDecorator = require("./gutter_decorator").MinimalGutterDiffDecorator;
239
+ var dummyDiffProvider = {
240
+ compute: function (val1, val2, options) {
241
+ return [];
242
+ }
243
+ };
244
+ dom.importCssString(css, "diffview.css", false);
245
+ var BaseDiffView = /** @class */ (function () {
246
+ function BaseDiffView(inlineDiffEditor, container) {
247
+ this.onChangeTheme = this.onChangeTheme.bind(this);
248
+ this.onInput = this.onInput.bind(this);
249
+ this.onChangeFold = this.onChangeFold.bind(this);
250
+ this.realign = this.realign.bind(this);
251
+ this.onSelect = this.onSelect.bind(this);
252
+ this.onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
253
+ this.realignPending = false; this.diffSession; this.chunks;
254
+ this.inlineDiffEditor = inlineDiffEditor || false;
255
+ this.currentDiffIndex = 0;
256
+ this.diffProvider = dummyDiffProvider;
257
+ if (container) {
258
+ this.container = container;
259
+ }
260
+ this.$ignoreTrimWhitespace = false;
261
+ this.$maxDiffs = 5000;
262
+ this.$maxComputationTimeMs = 150;
263
+ this.$syncSelections = false;
264
+ this.$foldUnchangedOnInput = false;
265
+ this.markerB = new DiffHighlight(this, 1);
266
+ this.markerA = new DiffHighlight(this, -1);
267
+ }
268
+ BaseDiffView.prototype.$setupModels = function (diffModel) {
269
+ if (diffModel.diffProvider) {
270
+ this.setProvider(diffModel.diffProvider);
271
+ }
272
+ this.showSideA = diffModel.inline == undefined ? true : diffModel.inline === "a";
273
+ var diffEditorOptions = /**@type {Partial<import("../../../ace-internal").Ace.EditorOptions>}*/ ({
274
+ scrollPastEnd: 0.5,
275
+ highlightActiveLine: false,
276
+ highlightGutterLine: false,
277
+ animatedScroll: true,
278
+ customScrollbar: true,
279
+ vScrollBarAlwaysVisible: true,
280
+ fadeFoldWidgets: true,
281
+ showFoldWidgets: true,
282
+ selectionStyle: "text",
283
+ });
284
+ this.savedOptionsA = diffModel.editorA && diffModel.editorA.getOptions(diffEditorOptions);
285
+ this.savedOptionsB = diffModel.editorB && diffModel.editorB.getOptions(diffEditorOptions);
286
+ if (!this.inlineDiffEditor || diffModel.inline === "a") {
287
+ this.editorA = diffModel.editorA || this.$setupModel(diffModel.sessionA, diffModel.valueA);
288
+ this.container && this.container.appendChild(this.editorA.container);
289
+ this.editorA.setOptions(diffEditorOptions);
290
+ }
291
+ if (!this.inlineDiffEditor || diffModel.inline === "b") {
292
+ this.editorB = diffModel.editorB || this.$setupModel(diffModel.sessionB, diffModel.valueB);
293
+ this.container && this.container.appendChild(this.editorB.container);
294
+ this.editorB.setOptions(diffEditorOptions);
295
+ }
296
+ if (this.inlineDiffEditor) {
297
+ this.activeEditor = this.showSideA ? this.editorA : this.editorB;
298
+ this.otherSession = this.showSideA ? this.sessionB : this.sessionA;
299
+ var cloneOptions = this.activeEditor.getOptions();
300
+ cloneOptions.readOnly = true;
301
+ delete cloneOptions.mode;
302
+ this.otherEditor = new Editor(new Renderer(null), undefined, cloneOptions);
303
+ if (this.showSideA) {
304
+ this.editorB = this.otherEditor;
305
+ }
306
+ else {
307
+ this.editorA = this.otherEditor;
308
+ }
309
+ }
310
+ this.setDiffSession({
311
+ sessionA: diffModel.sessionA || (diffModel.editorA ? diffModel.editorA.session : new EditSession(diffModel.valueA || "")),
312
+ sessionB: diffModel.sessionB || (diffModel.editorB ? diffModel.editorB.session : new EditSession(diffModel.valueB || "")),
313
+ chunks: []
314
+ });
315
+ if (this.otherEditor && this.activeEditor) {
316
+ this.otherSession.setOption("wrap", this.activeEditor.getOption("wrap"));
317
+ }
318
+ this.setupScrollbars();
319
+ };
320
+ BaseDiffView.prototype.addGutterDecorators = function () {
321
+ if (!this.gutterDecoratorA)
322
+ this.gutterDecoratorA = new MinimalGutterDiffDecorator(this.editorA, -1);
323
+ if (!this.gutterDecoratorB)
324
+ this.gutterDecoratorB = new MinimalGutterDiffDecorator(this.editorB, 1);
325
+ };
326
+ BaseDiffView.prototype.$setupModel = function (session, value) {
327
+ var editor = new Editor(new Renderer(), session);
328
+ editor.session.setUndoManager(new UndoManager());
329
+ if (value != undefined) {
330
+ editor.setValue(value, -1);
331
+ }
332
+ return editor;
333
+ };
334
+ BaseDiffView.prototype.foldUnchanged = function () {
335
+ var chunks = this.chunks;
336
+ var placeholder = "-".repeat(120);
337
+ var prev = {
338
+ old: new Range(0, 0, 0, 0),
339
+ new: new Range(0, 0, 0, 0)
340
+ };
341
+ var foldsChanged = false;
342
+ for (var i = 0; i < chunks.length + 1; i++) {
343
+ var current = chunks[i] || {
344
+ old: new Range(this.sessionA.getLength(), 0, this.sessionA.getLength(), 0),
345
+ new: new Range(this.sessionB.getLength(), 0, this.sessionB.getLength(), 0)
346
+ };
347
+ var l = current.new.start.row - prev.new.end.row - 5;
348
+ if (l > 2) {
349
+ var s = prev.old.end.row + 2;
350
+ var fold1 = this.sessionA.addFold(placeholder, new Range(s, 0, s + l, Number.MAX_VALUE));
351
+ s = prev.new.end.row + 2;
352
+ var fold2 = this.sessionB.addFold(placeholder, new Range(s, 0, s + l, Number.MAX_VALUE));
353
+ if (fold1 || fold2)
354
+ foldsChanged = true;
355
+ if (fold2 && fold1) {
356
+ fold1["other"] = fold2;
357
+ fold2["other"] = fold1;
358
+ }
359
+ }
360
+ prev = current;
361
+ }
362
+ return foldsChanged;
363
+ };
364
+ BaseDiffView.prototype.unfoldUnchanged = function () {
365
+ var folds = this.sessionA.getAllFolds();
366
+ for (var i = folds.length - 1; i >= 0; i--) {
367
+ var fold = folds[i];
368
+ if (fold.placeholder.length == 120) {
369
+ this.sessionA.removeFold(fold);
370
+ }
371
+ }
372
+ };
373
+ BaseDiffView.prototype.toggleFoldUnchanged = function () {
374
+ if (!this.foldUnchanged()) {
375
+ this.unfoldUnchanged();
376
+ }
377
+ };
378
+ BaseDiffView.prototype.setDiffSession = function (session) {
379
+ if (this.diffSession) {
380
+ this.$detachSessionsEventHandlers();
381
+ this.clearSelectionMarkers();
382
+ }
383
+ this.diffSession = session;
384
+ this.sessionA = this.sessionB = null;
385
+ if (this.diffSession) {
386
+ this.chunks = this.diffSession.chunks || [];
387
+ this.editorA && this.editorA.setSession(session.sessionA);
388
+ this.editorB && this.editorB.setSession(session.sessionB);
389
+ this.sessionA = this.diffSession.sessionA;
390
+ this.sessionB = this.diffSession.sessionB;
391
+ this.$attachSessionsEventHandlers();
392
+ this.initSelectionMarkers();
393
+ }
394
+ this.otherSession = this.showSideA ? this.sessionB : this.sessionA;
395
+ };
396
+ BaseDiffView.prototype.$attachSessionsEventHandlers = function () {
397
+ };
398
+ BaseDiffView.prototype.$detachSessionsEventHandlers = function () {
399
+ };
400
+ BaseDiffView.prototype.getDiffSession = function () {
401
+ return this.diffSession;
402
+ };
403
+ BaseDiffView.prototype.setTheme = function (theme) {
404
+ this.editorA && this.editorA.setTheme(theme);
405
+ this.editorB && this.editorB.setTheme(theme);
406
+ };
407
+ BaseDiffView.prototype.getTheme = function () {
408
+ return (this.editorA || this.editorB).getTheme();
409
+ };
410
+ BaseDiffView.prototype.onChangeTheme = function (e) {
411
+ var theme = e && e.theme || this.getTheme();
412
+ if (this.editorA && this.editorA.getTheme() !== theme) {
413
+ this.editorA.setTheme(theme);
414
+ }
415
+ if (this.editorB && this.editorB.getTheme() !== theme) {
416
+ this.editorB.setTheme(theme);
417
+ }
418
+ };
419
+ BaseDiffView.prototype.resize = function (force) {
420
+ this.editorA && this.editorA.resize(force);
421
+ this.editorB && this.editorB.resize(force);
422
+ };
423
+ BaseDiffView.prototype.scheduleOnInput = function () {
424
+ var _this = this;
425
+ if (this.$onInputTimer)
426
+ return;
427
+ this.$onInputTimer = setTimeout(function () {
428
+ _this.$onInputTimer = null;
429
+ _this.onInput();
430
+ });
431
+ };
432
+ BaseDiffView.prototype.onInput = function () {
433
+ var _this = this;
434
+ if (this.$onInputTimer)
435
+ clearTimeout(this.$onInputTimer);
436
+ var val1 = this.sessionA.doc.getAllLines();
437
+ var val2 = this.sessionB.doc.getAllLines();
438
+ this.selectionRangeA = null;
439
+ this.selectionRangeB = null;
440
+ var chunks = this.$diffLines(val1, val2);
441
+ this.diffSession.chunks = this.chunks = chunks;
442
+ this.gutterDecoratorA && this.gutterDecoratorA.setDecorations(chunks);
443
+ this.gutterDecoratorB && this.gutterDecoratorB.setDecorations(chunks);
444
+ if (this.chunks && this.chunks.length > this.$maxDiffs) {
445
+ return;
446
+ }
447
+ this.align();
448
+ this.editorA && this.editorA.renderer.updateBackMarkers();
449
+ this.editorB && this.editorB.renderer.updateBackMarkers();
450
+ setTimeout(function () {
451
+ _this.updateScrollBarDecorators();
452
+ }, 0);
453
+ if (this.$foldUnchangedOnInput) {
454
+ this.foldUnchanged();
455
+ }
456
+ };
457
+ BaseDiffView.prototype.setupScrollbars = function () {
458
+ var _this = this;
459
+ var setupScrollBar = function (renderer) {
460
+ setTimeout(function () {
461
+ _this.$setScrollBarDecorators(renderer);
462
+ _this.updateScrollBarDecorators();
463
+ }, 0);
464
+ };
465
+ if (this.inlineDiffEditor) {
466
+ setupScrollBar(this.activeEditor.renderer);
467
+ }
468
+ else {
469
+ setupScrollBar(this.editorA.renderer);
470
+ setupScrollBar(this.editorB.renderer);
471
+ }
472
+ };
473
+ BaseDiffView.prototype.$setScrollBarDecorators = function (renderer) {
474
+ if (renderer.$scrollDecorator) {
475
+ renderer.$scrollDecorator.destroy();
476
+ }
477
+ renderer.$scrollDecorator = new ScrollDiffDecorator(renderer.scrollBarV, renderer, this.inlineDiffEditor);
478
+ renderer.$scrollDecorator.setSessions(this.sessionA, this.sessionB);
479
+ renderer.scrollBarV.setVisible(true);
480
+ renderer.scrollBarV.element.style.bottom = renderer.scrollBarH.getHeight() + "px";
481
+ };
482
+ BaseDiffView.prototype.$resetDecorators = function (renderer) {
483
+ if (renderer.$scrollDecorator) {
484
+ renderer.$scrollDecorator.destroy();
485
+ }
486
+ renderer.$scrollDecorator = new Decorator(renderer.scrollBarV, renderer);
487
+ };
488
+ BaseDiffView.prototype.updateScrollBarDecorators = function () {
489
+ var _this = this;
490
+ if (this.inlineDiffEditor) {
491
+ if (!this.activeEditor) {
492
+ return;
493
+ }
494
+ this.activeEditor.renderer.$scrollDecorator.$zones = [];
495
+ }
496
+ else {
497
+ if (!this.editorA || !this.editorB) {
498
+ return;
499
+ }
500
+ this.editorA.renderer.$scrollDecorator.$zones = [];
501
+ this.editorB.renderer.$scrollDecorator.$zones = [];
502
+ }
503
+ var updateDecorators = function (editor, change) {
504
+ if (!editor) {
505
+ return;
506
+ }
507
+ if (typeof editor.renderer.$scrollDecorator.addZone !== "function") {
508
+ return;
509
+ }
510
+ if (change.old.start.row != change.old.end.row) {
511
+ editor.renderer.$scrollDecorator.addZone(change.old.start.row, change.old.end.row - 1, "delete");
512
+ }
513
+ if (change.new.start.row != change.new.end.row) {
514
+ editor.renderer.$scrollDecorator.addZone(change.new.start.row, change.new.end.row - 1, "insert");
515
+ }
516
+ };
517
+ if (this.inlineDiffEditor) {
518
+ this.chunks && this.chunks.forEach(function (lineChange) {
519
+ updateDecorators(_this.activeEditor, lineChange);
520
+ });
521
+ this.activeEditor.renderer.$scrollDecorator.$updateDecorators(this.activeEditor.renderer.layerConfig);
522
+ }
523
+ else {
524
+ this.chunks && this.chunks.forEach(function (lineChange) {
525
+ updateDecorators(_this.editorA, lineChange);
526
+ updateDecorators(_this.editorB, lineChange);
527
+ });
528
+ this.editorA.renderer.$scrollDecorator.$updateDecorators(this.editorA.renderer.layerConfig);
529
+ this.editorB.renderer.$scrollDecorator.$updateDecorators(this.editorB.renderer.layerConfig);
530
+ }
531
+ };
532
+ BaseDiffView.prototype.$diffLines = function (val1, val2) {
533
+ return this.diffProvider.compute(val1, val2, {
534
+ ignoreTrimWhitespace: this.$ignoreTrimWhitespace,
535
+ maxComputationTimeMs: this.$maxComputationTimeMs
536
+ });
537
+ };
538
+ BaseDiffView.prototype.setProvider = function (provider) {
539
+ this.diffProvider = provider;
540
+ };
541
+ BaseDiffView.prototype.$addWidget = function (session, w) {
542
+ var lineWidget = session.lineWidgets[w.row];
543
+ if (lineWidget) {
544
+ w.rowsAbove += lineWidget.rowsAbove > w.rowsAbove ? lineWidget.rowsAbove : w.rowsAbove;
545
+ w.rowCount += lineWidget.rowCount;
546
+ }
547
+ session.lineWidgets[w.row] = w;
548
+ session.widgetManager.lineWidgets[w.row] = w;
549
+ session.$resetRowCache(w.row);
550
+ var fold = session.getFoldAt(w.row, 0);
551
+ if (fold) {
552
+ session.widgetManager.updateOnFold({
553
+ data: fold,
554
+ action: "add",
555
+ }, session);
556
+ }
557
+ };
558
+ BaseDiffView.prototype.$initWidgets = function (editor) {
559
+ var session = editor.session;
560
+ if (!session.widgetManager) {
561
+ session.widgetManager = new LineWidgets(session);
562
+ session.widgetManager.attach(editor);
563
+ }
564
+ editor.session.lineWidgets = [];
565
+ editor.session.widgetManager.lineWidgets = [];
566
+ editor.session.$resetRowCache(0);
567
+ };
568
+ BaseDiffView.prototype.$screenRow = function (pos, session) {
569
+ var row = session.documentToScreenPosition(pos).row;
570
+ var afterEnd = pos.row - session.getLength() + 1;
571
+ if (afterEnd > 0) {
572
+ row += afterEnd;
573
+ }
574
+ return row;
575
+ };
576
+ BaseDiffView.prototype.align = function () { };
577
+ BaseDiffView.prototype.onChangeWrapLimit = function (e, session) { };
578
+ BaseDiffView.prototype.onSelect = function (e, selection) {
579
+ this.searchHighlight(selection);
580
+ this.syncSelect(selection);
581
+ };
582
+ BaseDiffView.prototype.syncSelect = function (selection) {
583
+ if (this.$updatingSelection)
584
+ return;
585
+ var isOld = selection.session === this.sessionA;
586
+ var selectionRange = selection.getRange();
587
+ var currSelectionRange = isOld ? this.selectionRangeA : this.selectionRangeB;
588
+ if (currSelectionRange && selectionRange.isEqual(currSelectionRange))
589
+ return;
590
+ if (isOld) {
591
+ this.selectionRangeA = selectionRange;
592
+ }
593
+ else {
594
+ this.selectionRangeB = selectionRange;
595
+ }
596
+ this.$updatingSelection = true;
597
+ var newRange = this.transformRange(selectionRange, isOld);
598
+ if (this.$syncSelections) {
599
+ (isOld ? this.editorB : this.editorA).session.selection.setSelectionRange(newRange);
600
+ }
601
+ this.$updatingSelection = false;
602
+ if (isOld) {
603
+ this.selectionRangeA = selectionRange;
604
+ this.selectionRangeB = newRange;
605
+ }
606
+ else {
607
+ this.selectionRangeA = newRange;
608
+ this.selectionRangeB = selectionRange;
609
+ }
610
+ this.updateSelectionMarker(this.syncSelectionMarkerA, this.sessionA, this.selectionRangeA);
611
+ this.updateSelectionMarker(this.syncSelectionMarkerB, this.sessionB, this.selectionRangeB);
612
+ };
613
+ BaseDiffView.prototype.updateSelectionMarker = function (marker, session, range) {
614
+ marker.setRange(range);
615
+ session._signal("changeFrontMarker");
616
+ };
617
+ BaseDiffView.prototype.onChangeFold = function (ev, session) {
618
+ var fold = ev.data;
619
+ if (this.$syncingFold || !fold || !ev.action)
620
+ return;
621
+ this.scheduleRealign();
622
+ var isOrig = session === this.sessionA;
623
+ var other = isOrig ? this.sessionB : this.sessionA;
624
+ if (ev.action === "remove") {
625
+ if (fold.other) {
626
+ fold.other.other = null;
627
+ other.removeFold(fold.other);
628
+ }
629
+ else if (fold.lineWidget) {
630
+ other.widgetManager.addLineWidget(fold.lineWidget);
631
+ fold.lineWidget = null;
632
+ if (other["$editor"]) {
633
+ other["$editor"].renderer.updateBackMarkers();
634
+ }
635
+ }
636
+ }
637
+ if (ev.action === "add") {
638
+ var range = this.transformRange(fold.range, isOrig);
639
+ if (range.isEmpty()) {
640
+ var row = range.start.row + 1;
641
+ if (other.lineWidgets[row]) {
642
+ fold.lineWidget = other.lineWidgets[row];
643
+ other.widgetManager.removeLineWidget(fold.lineWidget);
644
+ if (other["$editor"]) {
645
+ other["$editor"].renderer.updateBackMarkers();
646
+ }
647
+ }
648
+ }
649
+ else {
650
+ this.$syncingFold = true;
651
+ fold.other = other.addFold(fold.placeholder, range);
652
+ if (fold.other) {
653
+ fold.other.other = fold;
654
+ }
655
+ this.$syncingFold = false;
656
+ }
657
+ }
658
+ };
659
+ BaseDiffView.prototype.scheduleRealign = function () {
660
+ if (!this.realignPending) {
661
+ this.realignPending = true;
662
+ this.editorA.renderer.on("beforeRender", this.realign);
663
+ this.editorB.renderer.on("beforeRender", this.realign);
664
+ }
665
+ };
666
+ BaseDiffView.prototype.realign = function () {
667
+ this.realignPending = true;
668
+ this.editorA.renderer.off("beforeRender", this.realign);
669
+ this.editorB.renderer.off("beforeRender", this.realign);
670
+ this.align();
671
+ this.realignPending = false;
672
+ };
673
+ BaseDiffView.prototype.detach = function () {
674
+ if (!this.editorA || !this.editorB)
675
+ return;
676
+ if (this.savedOptionsA)
677
+ this.editorA.setOptions(this.savedOptionsA);
678
+ if (this.savedOptionsB)
679
+ this.editorB.setOptions(this.savedOptionsB);
680
+ this.editorA.renderer.off("beforeRender", this.realign);
681
+ this.editorB.renderer.off("beforeRender", this.realign);
682
+ this.$detachEventHandlers();
683
+ this.$removeLineWidgets(this.sessionA);
684
+ this.$removeLineWidgets(this.sessionB);
685
+ this.gutterDecoratorA && this.gutterDecoratorA.dispose();
686
+ this.gutterDecoratorB && this.gutterDecoratorB.dispose();
687
+ this.sessionA.selection.clearSelection();
688
+ this.sessionB.selection.clearSelection();
689
+ if (this.savedOptionsA && this.savedOptionsA.customScrollbar) {
690
+ this.$resetDecorators(this.editorA.renderer);
691
+ }
692
+ if (this.savedOptionsB && this.savedOptionsB.customScrollbar) {
693
+ this.$resetDecorators(this.editorB.renderer);
694
+ }
695
+ };
696
+ BaseDiffView.prototype.$removeLineWidgets = function (session) {
697
+ session.lineWidgets = [];
698
+ session.widgetManager.lineWidgets = [];
699
+ session._signal("changeFold", { data: { start: { row: 0 } } });
700
+ };
701
+ BaseDiffView.prototype.$detachEventHandlers = function () {
702
+ };
703
+ BaseDiffView.prototype.destroy = function () {
704
+ this.detach();
705
+ this.editorA && this.editorA.destroy();
706
+ this.editorB && this.editorB.destroy();
707
+ this.editorA = this.editorB = null;
708
+ };
709
+ BaseDiffView.prototype.gotoNext = function (dir) {
710
+ var ace = this.activeEditor || this.editorA;
711
+ if (this.inlineDiffEditor) {
712
+ ace = this.editorA;
713
+ }
714
+ var sideA = ace == this.editorA;
715
+ var row = ace.selection.lead.row;
716
+ var i = this.findChunkIndex(this.chunks, row, sideA);
717
+ var chunk = this.chunks[i + dir] || this.chunks[i];
718
+ var scrollTop = ace.session.getScrollTop();
719
+ if (chunk) {
720
+ var range = chunk[sideA ? "old" : "new"];
721
+ var line = Math.max(range.start.row, range.end.row - 1);
722
+ ace.selection.setRange(new Range(line, 0, line, 0));
723
+ }
724
+ ace.renderer.scrollSelectionIntoView(ace.selection.lead, ace.selection.anchor, 0.5);
725
+ ace.renderer.animateScrolling(scrollTop);
726
+ };
727
+ BaseDiffView.prototype.firstDiffSelected = function () {
728
+ return this.currentDiffIndex <= 1;
729
+ };
730
+ BaseDiffView.prototype.lastDiffSelected = function () {
731
+ return this.currentDiffIndex > this.chunks.length - 1;
732
+ };
733
+ BaseDiffView.prototype.transformRange = function (range, isOriginal) {
734
+ return Range.fromPoints(this.transformPosition(range.start, isOriginal), this.transformPosition(range.end, isOriginal));
735
+ };
736
+ BaseDiffView.prototype.transformPosition = function (pos, isOriginal) {
737
+ var chunkIndex = this.findChunkIndex(this.chunks, pos.row, isOriginal);
738
+ var chunk = this.chunks[chunkIndex];
739
+ var clonePos = this.sessionB.doc.clonePos;
740
+ var result = clonePos(pos);
741
+ var _a = __read(isOriginal ? ["old", "new"] : ["new", "old"], 2), from = _a[0], to = _a[1];
742
+ var deltaChar = 0;
743
+ var ignoreIndent = false;
744
+ if (chunk) {
745
+ if (chunk[from].end.row <= pos.row) {
746
+ result.row -= chunk[from].end.row - chunk[to].end.row;
747
+ }
748
+ else if (chunk.charChanges) {
749
+ for (var i = 0; i < chunk.charChanges.length; i++) {
750
+ var change = chunk.charChanges[i];
751
+ var fromRange = change[from];
752
+ var toRange = change[to];
753
+ if (fromRange.end.row < pos.row)
754
+ continue;
755
+ if (fromRange.start.row > pos.row)
756
+ break;
757
+ if (fromRange.isMultiLine() && fromRange.contains(pos.row, pos.column)) {
758
+ result.row = toRange.start.row + pos.row - fromRange.start.row;
759
+ var maxRow = toRange.end.row;
760
+ if (toRange.end.column === 0)
761
+ maxRow--;
762
+ if (result.row > maxRow) {
763
+ result.row = maxRow;
764
+ result.column = (isOriginal ? this.sessionB : this.sessionA).getLine(maxRow).length;
765
+ ignoreIndent = true;
766
+ }
767
+ result.row = Math.min(result.row, maxRow);
768
+ }
769
+ else {
770
+ result.row = toRange.start.row;
771
+ if (fromRange.start.column > pos.column)
772
+ break;
773
+ ignoreIndent = true;
774
+ if (!fromRange.isEmpty() && fromRange.contains(pos.row, pos.column)) {
775
+ result.column = toRange.start.column;
776
+ deltaChar = pos.column - fromRange.start.column;
777
+ deltaChar = Math.min(deltaChar, toRange.end.column - toRange.start.column);
778
+ }
779
+ else {
780
+ result = clonePos(toRange.end);
781
+ deltaChar = pos.column - fromRange.end.column;
782
+ }
783
+ }
784
+ }
785
+ }
786
+ else if (chunk[from].start.row <= pos.row) {
787
+ result.row += chunk[to].start.row - chunk[from].start.row;
788
+ if (result.row >= chunk[to].end.row) {
789
+ result.row = chunk[to].end.row - 1;
790
+ result.column = (isOriginal ? this.sessionB : this.sessionA).getLine(result.row).length;
791
+ }
792
+ }
793
+ }
794
+ if (!ignoreIndent) { //TODO:
795
+ var _b = __read(isOriginal ? [this.sessionA, this.sessionB] : [
796
+ this.sessionB, this.sessionA
797
+ ], 2), fromEditSession = _b[0], toEditSession = _b[1];
798
+ deltaChar -= this.$getDeltaIndent(fromEditSession, toEditSession, pos.row, result.row);
799
+ }
800
+ result.column += deltaChar;
801
+ return result;
802
+ };
803
+ BaseDiffView.prototype.$getDeltaIndent = function (fromEditSession, toEditSession, fromLine, toLine) {
804
+ var origIndent = this.$getIndent(fromEditSession, fromLine);
805
+ var editIndent = this.$getIndent(toEditSession, toLine);
806
+ return origIndent - editIndent;
807
+ };
808
+ BaseDiffView.prototype.$getIndent = function (editSession, line) {
809
+ return editSession.getLine(line).match(/^\s*/)[0].length;
810
+ };
811
+ BaseDiffView.prototype.printDiffs = function () {
812
+ this.chunks.forEach(function (diff) {
813
+ console.log(diff.toString());
814
+ });
815
+ };
816
+ BaseDiffView.prototype.findChunkIndex = function (chunks, row, isOriginal) {
817
+ for (var i = 0; i < chunks.length; i++) {
818
+ var ch = chunks[i];
819
+ var chunk = isOriginal ? ch.old : ch.new;
820
+ if (chunk.end.row < row)
821
+ continue;
822
+ if (chunk.start.row > row)
823
+ break;
824
+ }
825
+ this.currentDiffIndex = i;
826
+ return i - 1;
827
+ };
828
+ BaseDiffView.prototype.searchHighlight = function (selection) {
829
+ if (this.$syncSelections || this.inlineDiffEditor) {
830
+ return;
831
+ }
832
+ var currSession = selection.session;
833
+ var otherSession = currSession === this.sessionA
834
+ ? this.sessionB : this.sessionA;
835
+ otherSession.highlight(currSession.$searchHighlight.regExp);
836
+ otherSession._signal("changeBackMarker");
837
+ };
838
+ BaseDiffView.prototype.initSelectionMarkers = function () {
839
+ this.syncSelectionMarkerA = new SyncSelectionMarker();
840
+ this.syncSelectionMarkerB = new SyncSelectionMarker();
841
+ this.sessionA.addDynamicMarker(this.syncSelectionMarkerA, true);
842
+ this.sessionB.addDynamicMarker(this.syncSelectionMarkerB, true);
843
+ };
844
+ BaseDiffView.prototype.clearSelectionMarkers = function () {
845
+ this.sessionA.removeMarker(this.syncSelectionMarkerA.id);
846
+ this.sessionB.removeMarker(this.syncSelectionMarkerB.id);
847
+ };
848
+ return BaseDiffView;
849
+ }());
850
+ config.defineOptions(BaseDiffView.prototype, "DiffView", {
851
+ showOtherLineNumbers: {
852
+ set: function (value) {
853
+ if (this.gutterLayer) {
854
+ this.gutterLayer.$renderer = value ? null : emptyGutterRenderer;
855
+ this.editorA.renderer.updateFull();
856
+ }
857
+ },
858
+ initialValue: true
859
+ },
860
+ folding: {
861
+ set: function (value) {
862
+ this.editorA.setOption("showFoldWidgets", value);
863
+ this.editorB.setOption("showFoldWidgets", value);
864
+ if (!value) {
865
+ var posA = [];
866
+ var posB = [];
867
+ if (this.chunks) {
868
+ this.chunks.forEach(function (x) {
869
+ posA.push(x.old.start, x.old.end);
870
+ posB.push(x.new.start, x.new.end);
871
+ });
872
+ }
873
+ this.sessionA.unfold(posA);
874
+ this.sessionB.unfold(posB);
875
+ }
876
+ }
877
+ },
878
+ syncSelections: {
879
+ set: function (value) {
880
+ },
881
+ },
882
+ ignoreTrimWhitespace: {
883
+ set: function (value) {
884
+ this.scheduleOnInput();
885
+ },
886
+ },
887
+ wrap: {
888
+ set: function (value) {
889
+ this.sessionA.setOption("wrap", value);
890
+ this.sessionB.setOption("wrap", value);
891
+ }
892
+ },
893
+ maxDiffs: {
894
+ value: 5000,
895
+ },
896
+ theme: {
897
+ set: function (value) {
898
+ this.setTheme(value);
899
+ },
900
+ get: function () {
901
+ return this.editorA.getTheme();
902
+ }
903
+ },
904
+ });
905
+ var emptyGutterRenderer = {
906
+ getText: function name(params) {
907
+ return "";
908
+ },
909
+ getWidth: function () {
910
+ return 0;
911
+ }
912
+ };
913
+ exports.BaseDiffView = BaseDiffView;
914
+ var DiffChunk = /** @class */ (function () {
915
+ function DiffChunk(originalRange, modifiedRange, charChanges) {
916
+ this.old = originalRange;
917
+ this.new = modifiedRange;
918
+ this.charChanges = charChanges && charChanges.map(function (m) { return new DiffChunk(new Range(m.originalStartLineNumber, m.originalStartColumn, m.originalEndLineNumber, m.originalEndColumn), new Range(m.modifiedStartLineNumber, m.modifiedStartColumn, m.modifiedEndLineNumber, m.modifiedEndColumn)); });
919
+ }
920
+ return DiffChunk;
921
+ }());
922
+ var DiffHighlight = /** @class */ (function () {
923
+ function DiffHighlight(diffView, type) { this.id;
924
+ this.diffView = diffView;
925
+ this.type = type;
926
+ }
927
+ DiffHighlight.prototype.update = function (html, markerLayer, session, config) {
928
+ var dir, operation, opOperation;
929
+ var diffView = this.diffView;
930
+ if (this.type === -1) { // original editor
931
+ dir = "old";
932
+ operation = "delete";
933
+ opOperation = "insert";
934
+ }
935
+ else { //modified editor
936
+ dir = "new";
937
+ operation = "insert";
938
+ opOperation = "delete";
939
+ }
940
+ var ignoreTrimWhitespace = diffView.$ignoreTrimWhitespace;
941
+ var lineChanges = diffView.chunks;
942
+ if (session.lineWidgets && !diffView.inlineDiffEditor) {
943
+ for (var row = config.firstRow; row <= config.lastRow; row++) {
944
+ var lineWidget = session.lineWidgets[row];
945
+ if (!lineWidget || lineWidget.hidden)
946
+ continue;
947
+ var start = session.documentToScreenRow(row, 0);
948
+ if (lineWidget.rowsAbove > 0) {
949
+ var range = new Range(start - lineWidget.rowsAbove, 0, start - 1, Number.MAX_VALUE);
950
+ markerLayer.drawFullLineMarker(html, range, "ace_diff aligned_diff", config);
951
+ }
952
+ var end = start + lineWidget.rowCount - (lineWidget.rowsAbove || 0);
953
+ var range = new Range(start + 1, 0, end, Number.MAX_VALUE);
954
+ markerLayer.drawFullLineMarker(html, range, "ace_diff aligned_diff", config);
955
+ }
956
+ }
957
+ lineChanges.forEach(function (lineChange) {
958
+ var startRow = lineChange[dir].start.row;
959
+ var endRow = lineChange[dir].end.row;
960
+ if (endRow < config.firstRow || startRow > config.lastRow)
961
+ return;
962
+ var range = new Range(startRow, 0, endRow - 1, 1 << 30);
963
+ if (startRow !== endRow) {
964
+ range = range.toScreenRange(session);
965
+ markerLayer.drawFullLineMarker(html, range, "ace_diff " + operation, config);
966
+ }
967
+ if (lineChange.charChanges) {
968
+ for (var i = 0; i < lineChange.charChanges.length; i++) {
969
+ var changeRange = lineChange.charChanges[i][dir];
970
+ if (changeRange.end.column == 0 && changeRange.end.row > changeRange.start.row && changeRange.end.row == lineChange[dir].end.row) {
971
+ changeRange.end.row--;
972
+ changeRange.end.column = Number.MAX_VALUE;
973
+ }
974
+ if (ignoreTrimWhitespace) {
975
+ for (var lineNumber = changeRange.start.row; lineNumber <= changeRange.end.row; lineNumber++) {
976
+ var startColumn = void 0;
977
+ var endColumn = void 0;
978
+ var sessionLineStart = session.getLine(lineNumber).match(/^\s*/)[0].length;
979
+ var sessionLineEnd = session.getLine(lineNumber).length;
980
+ if (lineNumber === changeRange.start.row) {
981
+ startColumn = changeRange.start.column;
982
+ }
983
+ else {
984
+ startColumn = sessionLineStart;
985
+ }
986
+ if (lineNumber === changeRange.end.row) {
987
+ endColumn = changeRange.end.column;
988
+ }
989
+ else {
990
+ endColumn = sessionLineEnd;
991
+ }
992
+ var range_1 = new Range(lineNumber, startColumn, lineNumber, endColumn);
993
+ var screenRange = range_1.toScreenRange(session);
994
+ if (sessionLineStart === startColumn && sessionLineEnd === endColumn) {
995
+ continue;
996
+ }
997
+ var cssClass = "inline " + operation;
998
+ if (range_1.isEmpty() && startColumn !== 0) {
999
+ cssClass = "inline " + opOperation + " empty";
1000
+ }
1001
+ markerLayer.drawSingleLineMarker(html, screenRange, "ace_diff " + cssClass, config);
1002
+ }
1003
+ }
1004
+ else {
1005
+ var range_2 = new Range(changeRange.start.row, changeRange.start.column, changeRange.end.row, changeRange.end.column);
1006
+ var screenRange = range_2.toScreenRange(session);
1007
+ var cssClass = "inline " + operation;
1008
+ if (range_2.isEmpty() && changeRange.start.column !== 0) {
1009
+ cssClass = "inline empty " + opOperation;
1010
+ }
1011
+ if (screenRange.isMultiLine()) {
1012
+ markerLayer.drawTextMarker(html, screenRange, "ace_diff " + cssClass, config);
1013
+ }
1014
+ else {
1015
+ markerLayer.drawSingleLineMarker(html, screenRange, "ace_diff " + cssClass, config);
1016
+ }
1017
+ }
1018
+ }
1019
+ }
1020
+ });
1021
+ };
1022
+ return DiffHighlight;
1023
+ }());
1024
+ var SyncSelectionMarker = /** @class */ (function () {
1025
+ function SyncSelectionMarker() { this.id;
1026
+ this.type = "fullLine";
1027
+ this.clazz = "ace_diff-active-line";
1028
+ }
1029
+ SyncSelectionMarker.prototype.update = function (html, markerLayer, session, config) {
1030
+ };
1031
+ SyncSelectionMarker.prototype.setRange = function (range) {
1032
+ var newRange = range.clone();
1033
+ newRange.end.column++;
1034
+ this.range = newRange;
1035
+ };
1036
+ return SyncSelectionMarker;
1037
+ }());
1038
+ exports.DiffChunk = DiffChunk;
1039
+ exports.DiffHighlight = DiffHighlight;
1040
+
1041
+ });
1042
+
1043
+ ace.define("ace/ext/diff/inline_diff_view",["require","exports","module","ace/ext/diff/base_diff_view","ace/virtual_renderer","ace/config"], function(require, exports, module){"use strict";
1044
+ var __extends = (this && this.__extends) || (function () {
1045
+ var extendStatics = function (d, b) {
1046
+ extendStatics = Object.setPrototypeOf ||
1047
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
1048
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
1049
+ return extendStatics(d, b);
1050
+ };
1051
+ return function (d, b) {
1052
+ if (typeof b !== "function" && b !== null)
1053
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1054
+ extendStatics(d, b);
1055
+ function __() { this.constructor = d; }
1056
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1057
+ };
1058
+ })();
1059
+ var BaseDiffView = require("./base_diff_view").BaseDiffView;
1060
+ var Renderer = require("../../virtual_renderer").VirtualRenderer;
1061
+ var config = require("../../config");
1062
+ var InlineDiffView = /** @class */ (function (_super) {
1063
+ __extends(InlineDiffView, _super);
1064
+ function InlineDiffView(diffModel, container) {
1065
+ var _this = this;
1066
+ diffModel = diffModel || {};
1067
+ diffModel.inline = diffModel.inline || "a";
1068
+ _this = _super.call(this, true, container) || this;
1069
+ _this.init(diffModel);
1070
+ return _this;
1071
+ }
1072
+ InlineDiffView.prototype.init = function (diffModel) {
1073
+ this.onSelect = this.onSelect.bind(this);
1074
+ this.onAfterRender = this.onAfterRender.bind(this);
1075
+ this.$setupModels(diffModel);
1076
+ this.onChangeTheme();
1077
+ config.resetOptions(this);
1078
+ config["_signal"]("diffView", this);
1079
+ var padding = this.activeEditor.renderer.$padding;
1080
+ this.addGutterDecorators();
1081
+ this.otherEditor.renderer.setPadding(padding);
1082
+ this.textLayer = this.otherEditor.renderer.$textLayer;
1083
+ this.markerLayer = this.otherEditor.renderer.$markerBack;
1084
+ this.gutterLayer = this.otherEditor.renderer.$gutterLayer;
1085
+ this.cursorLayer = this.otherEditor.renderer.$cursorLayer;
1086
+ this.otherEditor.renderer.$updateCachedSize = function () {
1087
+ };
1088
+ var textLayerElement = this.activeEditor.renderer.$textLayer.element;
1089
+ textLayerElement.parentNode.insertBefore(this.textLayer.element, textLayerElement);
1090
+ var markerLayerElement = this.activeEditor.renderer.$markerBack.element;
1091
+ markerLayerElement.parentNode.insertBefore(this.markerLayer.element, markerLayerElement.nextSibling);
1092
+ var gutterLayerElement = this.activeEditor.renderer.$gutterLayer.element;
1093
+ gutterLayerElement.parentNode.insertBefore(this.gutterLayer.element, gutterLayerElement.nextSibling);
1094
+ gutterLayerElement.style.position = "absolute";
1095
+ this.gutterLayer.element.style.position = "absolute";
1096
+ this.gutterLayer.element.style.width = "100%";
1097
+ this.gutterLayer.element.classList.add("ace_mini-diff_gutter_other");
1098
+ this.gutterLayer.$updateGutterWidth = function () { };
1099
+ this.initMouse();
1100
+ this.initTextInput();
1101
+ this.initTextLayer();
1102
+ this.initRenderer();
1103
+ this.$attachEventHandlers();
1104
+ this.selectEditor(this.activeEditor);
1105
+ };
1106
+ InlineDiffView.prototype.initRenderer = function (restore) {
1107
+ var _this = this;
1108
+ if (restore) {
1109
+ delete this.activeEditor.renderer.$getLongestLine;
1110
+ }
1111
+ else {
1112
+ this.editorA.renderer.$getLongestLine =
1113
+ this.editorB.renderer.$getLongestLine = function () {
1114
+ var getLongestLine = Renderer.prototype.$getLongestLine;
1115
+ return Math.max(getLongestLine.call(_this.editorA.renderer), getLongestLine.call(_this.editorB.renderer));
1116
+ };
1117
+ }
1118
+ };
1119
+ InlineDiffView.prototype.initTextLayer = function () {
1120
+ var renderLine = this.textLayer.$renderLine;
1121
+ var diffView = this;
1122
+ this.otherEditor.renderer.$textLayer.$renderLine = function (parent, row, foldLIne) {
1123
+ if (isVisibleRow(diffView.chunks, row)) {
1124
+ renderLine.call(this, parent, row, foldLIne);
1125
+ }
1126
+ };
1127
+ var side = this.showSideA ? "new" : "old";
1128
+ function isVisibleRow(chunks, row) {
1129
+ var min = 0;
1130
+ var max = chunks.length - 1;
1131
+ var result = -1;
1132
+ while (min < max) {
1133
+ var mid = Math.floor((min + max) / 2);
1134
+ var chunkStart = chunks[mid][side].start.row;
1135
+ if (chunkStart < row) {
1136
+ result = mid;
1137
+ min = mid + 1;
1138
+ }
1139
+ else if (chunkStart > row) {
1140
+ max = mid - 1;
1141
+ }
1142
+ else {
1143
+ result = mid;
1144
+ break;
1145
+ }
1146
+ }
1147
+ if (chunks[result + 1] && chunks[result + 1][side].start.row <= row) {
1148
+ result++;
1149
+ }
1150
+ var range = chunks[result] && chunks[result][side];
1151
+ if (range && range.end.row > row) {
1152
+ return true;
1153
+ }
1154
+ return false;
1155
+ }
1156
+ };
1157
+ InlineDiffView.prototype.initTextInput = function (restore) {
1158
+ if (restore) {
1159
+ this.otherEditor.textInput = this.othertextInput;
1160
+ this.otherEditor.container = this.otherEditorContainer;
1161
+ }
1162
+ else {
1163
+ this.othertextInput = this.otherEditor.textInput;
1164
+ this.otherEditor.textInput = this.activeEditor.textInput;
1165
+ this.otherEditorContainer = this.otherEditor.container;
1166
+ this.otherEditor.container = this.activeEditor.container;
1167
+ }
1168
+ };
1169
+ InlineDiffView.prototype.selectEditor = function (editor) {
1170
+ if (editor == this.activeEditor) {
1171
+ this.otherEditor.selection.clearSelection();
1172
+ this.activeEditor.textInput.setHost(this.activeEditor);
1173
+ this.activeEditor.setStyle("ace_diff_other", false);
1174
+ this.cursorLayer.element.remove();
1175
+ this.activeEditor.renderer.$cursorLayer.element.style.display = "block";
1176
+ if (this.showSideA) {
1177
+ this.sessionA.removeMarker(this.syncSelectionMarkerA.id);
1178
+ this.sessionA.addDynamicMarker(this.syncSelectionMarkerA, true);
1179
+ }
1180
+ this.markerLayer.element.classList.add("ace_hidden_marker-layer");
1181
+ this.activeEditor.renderer.$markerBack.element.classList.remove("ace_hidden_marker-layer");
1182
+ this.removeBracketHighlight(this.otherEditor);
1183
+ }
1184
+ else {
1185
+ this.activeEditor.selection.clearSelection();
1186
+ this.activeEditor.textInput.setHost(this.otherEditor);
1187
+ this.activeEditor.setStyle("ace_diff_other");
1188
+ this.activeEditor.renderer.$cursorLayer.element.parentNode.appendChild(this.cursorLayer.element);
1189
+ this.activeEditor.renderer.$cursorLayer.element.style.display = "none";
1190
+ if (this.activeEditor.$isFocused) {
1191
+ this.otherEditor.onFocus();
1192
+ }
1193
+ if (this.showSideA) {
1194
+ this.sessionA.removeMarker(this.syncSelectionMarkerA.id);
1195
+ }
1196
+ this.markerLayer.element.classList.remove("ace_hidden_marker-layer");
1197
+ this.activeEditor.renderer.$markerBack.element.classList.add("ace_hidden_marker-layer");
1198
+ this.removeBracketHighlight(this.activeEditor);
1199
+ }
1200
+ };
1201
+ InlineDiffView.prototype.removeBracketHighlight = function (editor) {
1202
+ var session = editor.session;
1203
+ if (session.$bracketHighlight) {
1204
+ session.$bracketHighlight.markerIds.forEach(function (id) {
1205
+ session.removeMarker(id);
1206
+ });
1207
+ session.$bracketHighlight = null;
1208
+ }
1209
+ };
1210
+ InlineDiffView.prototype.initMouse = function () {
1211
+ var _this = this;
1212
+ this.otherEditor.renderer.$loop = this.activeEditor.renderer.$loop;
1213
+ this.otherEditor.renderer.scroller = {
1214
+ getBoundingClientRect: function () {
1215
+ return _this.activeEditor.renderer.scroller.getBoundingClientRect();
1216
+ },
1217
+ style: this.activeEditor.renderer.scroller.style,
1218
+ };
1219
+ var forwardEvent = function (ev) {
1220
+ if (!ev.domEvent)
1221
+ return;
1222
+ var screenPos = ev.editor.renderer.pixelToScreenCoordinates(ev.clientX, ev.clientY);
1223
+ var sessionA = _this.activeEditor.session;
1224
+ var sessionB = _this.otherEditor.session;
1225
+ var posA = sessionA.screenToDocumentPosition(screenPos.row, screenPos.column, screenPos.offsetX);
1226
+ var posB = sessionB.screenToDocumentPosition(screenPos.row, screenPos.column, screenPos.offsetX);
1227
+ var posAx = sessionA.documentToScreenPosition(posA);
1228
+ var posBx = sessionB.documentToScreenPosition(posB);
1229
+ if (ev.editor == _this.activeEditor) {
1230
+ if (posBx.row == screenPos.row && posAx.row != screenPos.row) {
1231
+ if (ev.type == "mousedown") {
1232
+ _this.selectEditor(_this.otherEditor);
1233
+ }
1234
+ ev.propagationStopped = true;
1235
+ ev.defaultPrevented = true;
1236
+ _this.otherEditor.$mouseHandler.onMouseEvent(ev.type, ev.domEvent);
1237
+ }
1238
+ else if (ev.type == "mousedown") {
1239
+ _this.selectEditor(_this.activeEditor);
1240
+ }
1241
+ }
1242
+ };
1243
+ var events = [
1244
+ "mousedown",
1245
+ "click",
1246
+ "mouseup",
1247
+ "dblclick",
1248
+ "tripleclick",
1249
+ "quadclick",
1250
+ ];
1251
+ events.forEach(function (event) {
1252
+ _this.activeEditor.on(event, forwardEvent, true);
1253
+ _this.activeEditor.on("gutter" + event, forwardEvent, true);
1254
+ });
1255
+ var onFocus = function (e) {
1256
+ _this.activeEditor.onFocus(e);
1257
+ };
1258
+ var onBlur = function (e) {
1259
+ _this.activeEditor.onBlur(e);
1260
+ };
1261
+ this.otherEditor.on("focus", onFocus);
1262
+ this.otherEditor.on("blur", onBlur);
1263
+ this.onMouseDetach = function () {
1264
+ events.forEach(function (event) {
1265
+ _this.activeEditor.off(event, forwardEvent, true);
1266
+ _this.activeEditor.off("gutter" + event, forwardEvent, true);
1267
+ });
1268
+ _this.otherEditor.off("focus", onFocus);
1269
+ _this.otherEditor.off("blur", onBlur);
1270
+ };
1271
+ };
1272
+ InlineDiffView.prototype.align = function () {
1273
+ var diffView = this;
1274
+ this.$initWidgets(diffView.editorA);
1275
+ this.$initWidgets(diffView.editorB);
1276
+ diffView.chunks.forEach(function (ch) {
1277
+ var diff1 = diffView.$screenRow(ch.old.end, diffView.sessionA)
1278
+ - diffView.$screenRow(ch.old.start, diffView.sessionA);
1279
+ var diff2 = diffView.$screenRow(ch.new.end, diffView.sessionB)
1280
+ - diffView.$screenRow(ch.new.start, diffView.sessionB);
1281
+ diffView.$addWidget(diffView.sessionA, {
1282
+ rowCount: diff2,
1283
+ rowsAbove: ch.old.end.row === 0 ? diff2 : 0,
1284
+ row: ch.old.end.row === 0 ? 0 : ch.old.end.row - 1
1285
+ });
1286
+ diffView.$addWidget(diffView.sessionB, {
1287
+ rowCount: diff1,
1288
+ rowsAbove: diff1,
1289
+ row: ch.new.start.row,
1290
+ });
1291
+ });
1292
+ diffView.sessionA["_emit"]("changeFold", { data: { start: { row: 0 } } });
1293
+ diffView.sessionB["_emit"]("changeFold", { data: { start: { row: 0 } } });
1294
+ };
1295
+ InlineDiffView.prototype.onChangeWrapLimit = function (e, session) {
1296
+ this.otherSession.setOption("wrap", session.getOption("wrap"));
1297
+ this.otherSession.adjustWrapLimit(session.$wrapLimit);
1298
+ this.scheduleRealign();
1299
+ this.activeEditor.renderer.updateFull();
1300
+ };
1301
+ InlineDiffView.prototype.$attachSessionsEventHandlers = function () {
1302
+ this.$attachSessionEventHandlers(this.editorA, this.markerA);
1303
+ this.$attachSessionEventHandlers(this.editorB, this.markerB);
1304
+ var session = this.activeEditor.session;
1305
+ session.on("changeWrapLimit", this.onChangeWrapLimit);
1306
+ session.on("changeWrapMode", this.onChangeWrapLimit);
1307
+ };
1308
+ InlineDiffView.prototype.$attachSessionEventHandlers = function (editor, marker) {
1309
+ editor.session.on("changeFold", this.onChangeFold);
1310
+ editor.session.addDynamicMarker(marker);
1311
+ editor.selection.on("changeCursor", this.onSelect);
1312
+ editor.selection.on("changeSelection", this.onSelect);
1313
+ };
1314
+ InlineDiffView.prototype.$detachSessionsEventHandlers = function () {
1315
+ this.$detachSessionHandlers(this.editorA, this.markerA);
1316
+ this.$detachSessionHandlers(this.editorB, this.markerB);
1317
+ this.otherSession.bgTokenizer.lines.fill(undefined);
1318
+ var session = this.activeEditor.session;
1319
+ session.off("changeWrapLimit", this.onChangeWrapLimit);
1320
+ session.off("changeWrapMode", this.onChangeWrapLimit);
1321
+ };
1322
+ InlineDiffView.prototype.$detachSessionHandlers = function (editor, marker) {
1323
+ editor.session.removeMarker(marker.id);
1324
+ editor.selection.off("changeCursor", this.onSelect);
1325
+ editor.selection.off("changeSelection", this.onSelect);
1326
+ editor.session.off("changeFold", this.onChangeFold);
1327
+ };
1328
+ InlineDiffView.prototype.$attachEventHandlers = function () {
1329
+ this.activeEditor.on("input", this.onInput);
1330
+ this.activeEditor.renderer.on("afterRender", this.onAfterRender);
1331
+ this.otherSession.on("change", this.onInput);
1332
+ };
1333
+ InlineDiffView.prototype.$detachEventHandlers = function () {
1334
+ this.$detachSessionsEventHandlers();
1335
+ this.activeEditor.off("input", this.onInput);
1336
+ this.activeEditor.renderer.off("afterRender", this.onAfterRender);
1337
+ this.otherSession.off("change", this.onInput);
1338
+ this.textLayer.element.textContent = "";
1339
+ this.textLayer.element.remove();
1340
+ this.gutterLayer.element.textContent = "";
1341
+ this.gutterLayer.element.remove();
1342
+ this.markerLayer.element.textContent = "";
1343
+ this.markerLayer.element.remove();
1344
+ this.onMouseDetach();
1345
+ this.selectEditor(this.activeEditor);
1346
+ this.clearSelectionMarkers();
1347
+ this.otherEditor.setSession(null);
1348
+ this.otherEditor.renderer.$loop = null;
1349
+ this.initTextInput(true);
1350
+ this.initRenderer(true);
1351
+ this.otherEditor.destroy();
1352
+ };
1353
+ InlineDiffView.prototype.onAfterRender = function (changes, renderer) {
1354
+ var config = renderer.layerConfig;
1355
+ var session = this.otherSession;
1356
+ var cloneRenderer = this.otherEditor.renderer;
1357
+ session.$scrollTop = renderer.scrollTop;
1358
+ session.$scrollLeft = renderer.scrollLeft;
1359
+ [
1360
+ "characterWidth",
1361
+ "lineHeight",
1362
+ "scrollTop",
1363
+ "scrollLeft",
1364
+ "scrollMargin",
1365
+ "$padding",
1366
+ "$size",
1367
+ "layerConfig",
1368
+ "$horizScroll",
1369
+ "$vScroll",
1370
+ ].forEach(function (prop) {
1371
+ cloneRenderer[prop] = renderer[prop];
1372
+ });
1373
+ cloneRenderer.$computeLayerConfig();
1374
+ var newConfig = cloneRenderer.layerConfig;
1375
+ this.gutterLayer.update(newConfig);
1376
+ newConfig.firstRowScreen = config.firstRowScreen;
1377
+ cloneRenderer.$cursorLayer.config = newConfig;
1378
+ cloneRenderer.$cursorLayer.update(newConfig);
1379
+ if (changes & cloneRenderer.CHANGE_LINES
1380
+ || changes & cloneRenderer.CHANGE_FULL
1381
+ || changes & cloneRenderer.CHANGE_SCROLL
1382
+ || changes & cloneRenderer.CHANGE_TEXT)
1383
+ this.textLayer.update(newConfig);
1384
+ this.markerLayer.setMarkers(this.otherSession.getMarkers());
1385
+ this.markerLayer.update(newConfig);
1386
+ };
1387
+ InlineDiffView.prototype.detach = function () {
1388
+ _super.prototype.detach.call(this);
1389
+ this.otherEditor && this.otherEditor.destroy();
1390
+ };
1391
+ return InlineDiffView;
1392
+ }(BaseDiffView));
1393
+ exports.InlineDiffView = InlineDiffView;
1394
+
1395
+ });
1396
+
1397
+ ace.define("ace/ext/diff/split_diff_view",["require","exports","module","ace/ext/diff/base_diff_view","ace/config"], function(require, exports, module){"use strict";
1398
+ var __extends = (this && this.__extends) || (function () {
1399
+ var extendStatics = function (d, b) {
1400
+ extendStatics = Object.setPrototypeOf ||
1401
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
1402
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
1403
+ return extendStatics(d, b);
1404
+ };
1405
+ return function (d, b) {
1406
+ if (typeof b !== "function" && b !== null)
1407
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1408
+ extendStatics(d, b);
1409
+ function __() { this.constructor = d; }
1410
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1411
+ };
1412
+ })();
1413
+ var BaseDiffView = require("./base_diff_view").BaseDiffView;
1414
+ var config = require("../../config");
1415
+ var SplitDiffView = /** @class */ (function (_super) {
1416
+ __extends(SplitDiffView, _super);
1417
+ function SplitDiffView(diffModel) {
1418
+ var _this = this;
1419
+ diffModel = diffModel || {};
1420
+ _this = _super.call(this) || this;
1421
+ _this.init(diffModel);
1422
+ return _this;
1423
+ }
1424
+ SplitDiffView.prototype.init = function (diffModel) {
1425
+ this.onChangeTheme = this.onChangeTheme.bind(this);
1426
+ this.onMouseWheel = this.onMouseWheel.bind(this);
1427
+ this.onScroll = this.onScroll.bind(this);
1428
+ this.$setupModels(diffModel);
1429
+ this.addGutterDecorators();
1430
+ this.onChangeTheme();
1431
+ config.resetOptions(this);
1432
+ config["_signal"]("diffView", this);
1433
+ this.$attachEventHandlers();
1434
+ };
1435
+ SplitDiffView.prototype.onChangeWrapLimit = function () {
1436
+ this.scheduleRealign();
1437
+ };
1438
+ SplitDiffView.prototype.align = function () {
1439
+ var diffView = this;
1440
+ this.$initWidgets(diffView.editorA);
1441
+ this.$initWidgets(diffView.editorB);
1442
+ diffView.chunks.forEach(function (ch) {
1443
+ var diff1 = diffView.$screenRow(ch.old.start, diffView.sessionA);
1444
+ var diff2 = diffView.$screenRow(ch.new.start, diffView.sessionB);
1445
+ if (diff1 < diff2) {
1446
+ diffView.$addWidget(diffView.sessionA, {
1447
+ rowCount: diff2 - diff1,
1448
+ rowsAbove: ch.old.start.row === 0 ? diff2 - diff1 : 0,
1449
+ row: ch.old.start.row === 0 ? 0 : ch.old.start.row - 1
1450
+ });
1451
+ }
1452
+ else if (diff1 > diff2) {
1453
+ diffView.$addWidget(diffView.sessionB, {
1454
+ rowCount: diff1 - diff2,
1455
+ rowsAbove: ch.new.start.row === 0 ? diff1 - diff2 : 0,
1456
+ row: ch.new.start.row === 0 ? 0 : ch.new.start.row - 1
1457
+ });
1458
+ }
1459
+ var diff1 = diffView.$screenRow(ch.old.end, diffView.sessionA);
1460
+ var diff2 = diffView.$screenRow(ch.new.end, diffView.sessionB);
1461
+ if (diff1 < diff2) {
1462
+ diffView.$addWidget(diffView.sessionA, {
1463
+ rowCount: diff2 - diff1,
1464
+ rowsAbove: ch.old.end.row === 0 ? diff2 - diff1 : 0,
1465
+ row: ch.old.end.row === 0 ? 0 : ch.old.end.row - 1
1466
+ });
1467
+ }
1468
+ else if (diff1 > diff2) {
1469
+ diffView.$addWidget(diffView.sessionB, {
1470
+ rowCount: diff1 - diff2,
1471
+ rowsAbove: ch.new.end.row === 0 ? diff1 - diff2 : 0,
1472
+ row: ch.new.end.row === 0 ? 0 : ch.new.end.row - 1
1473
+ });
1474
+ }
1475
+ });
1476
+ diffView.sessionA["_emit"]("changeFold", { data: { start: { row: 0 } } });
1477
+ diffView.sessionB["_emit"]("changeFold", { data: { start: { row: 0 } } });
1478
+ };
1479
+ SplitDiffView.prototype.onScroll = function (e, session) {
1480
+ this.syncScroll(this.sessionA === session ? this.editorA.renderer : this.editorB.renderer);
1481
+ };
1482
+ SplitDiffView.prototype.syncScroll = function (renderer) {
1483
+ if (this.$syncScroll == false)
1484
+ return;
1485
+ var r1 = this.editorA.renderer;
1486
+ var r2 = this.editorB.renderer;
1487
+ var isOrig = renderer == r1;
1488
+ if (r1["$scrollAnimation"] && r2["$scrollAnimation"])
1489
+ return;
1490
+ var now = Date.now();
1491
+ if (this.scrollSetBy != renderer && now - this.scrollSetAt < 500)
1492
+ return;
1493
+ var r = isOrig ? r1 : r2;
1494
+ if (this.scrollSetBy != renderer) {
1495
+ if (isOrig && this.scrollA == r.session.getScrollTop())
1496
+ return;
1497
+ else if (!isOrig && this.scrollB
1498
+ == r.session.getScrollTop())
1499
+ return;
1500
+ }
1501
+ var rOther = isOrig ? r2 : r1;
1502
+ var targetPos = r.session.getScrollTop();
1503
+ this.$syncScroll = false;
1504
+ if (isOrig) {
1505
+ this.scrollA = r.session.getScrollTop();
1506
+ this.scrollB = targetPos;
1507
+ }
1508
+ else {
1509
+ this.scrollA = targetPos;
1510
+ this.scrollB = r.session.getScrollTop();
1511
+ }
1512
+ this.scrollSetBy = renderer;
1513
+ rOther.session.setScrollTop(targetPos);
1514
+ this.$syncScroll = true;
1515
+ this.scrollSetAt = now;
1516
+ };
1517
+ SplitDiffView.prototype.onMouseWheel = function (ev) {
1518
+ if (ev.getAccelKey())
1519
+ return;
1520
+ if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) {
1521
+ ev.wheelX = ev.wheelY;
1522
+ ev.wheelY = 0;
1523
+ }
1524
+ var editor = ev.editor;
1525
+ var isScrolable = editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
1526
+ if (!isScrolable) {
1527
+ var other = editor == this.editorA ? this.editorB : this.editorA;
1528
+ if (other.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed))
1529
+ other.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
1530
+ return ev.stop();
1531
+ }
1532
+ };
1533
+ SplitDiffView.prototype.$attachSessionsEventHandlers = function () {
1534
+ this.$attachSessionEventHandlers(this.editorA, this.markerA);
1535
+ this.$attachSessionEventHandlers(this.editorB, this.markerB);
1536
+ };
1537
+ SplitDiffView.prototype.$attachSessionEventHandlers = function (editor, marker) {
1538
+ editor.session.on("changeScrollTop", this.onScroll);
1539
+ editor.session.on("changeFold", this.onChangeFold);
1540
+ editor.session.addDynamicMarker(marker);
1541
+ editor.selection.on("changeCursor", this.onSelect);
1542
+ editor.selection.on("changeSelection", this.onSelect);
1543
+ editor.session.on("changeWrapLimit", this.onChangeWrapLimit);
1544
+ editor.session.on("changeWrapMode", this.onChangeWrapLimit);
1545
+ };
1546
+ SplitDiffView.prototype.$detachSessionsEventHandlers = function () {
1547
+ this.$detachSessionHandlers(this.editorA, this.markerA);
1548
+ this.$detachSessionHandlers(this.editorB, this.markerB);
1549
+ };
1550
+ SplitDiffView.prototype.$detachSessionHandlers = function (editor, marker) {
1551
+ editor.session.off("changeScrollTop", this.onScroll);
1552
+ editor.session.off("changeFold", this.onChangeFold);
1553
+ editor.session.removeMarker(marker.id);
1554
+ editor.selection.off("changeCursor", this.onSelect);
1555
+ editor.selection.off("changeSelection", this.onSelect);
1556
+ editor.session.off("changeWrapLimit", this.onChangeWrapLimit);
1557
+ editor.session.off("changeWrapMode", this.onChangeWrapLimit);
1558
+ };
1559
+ SplitDiffView.prototype.$attachEventHandlers = function () {
1560
+ this.editorA.renderer.on("themeChange", this.onChangeTheme);
1561
+ this.editorB.renderer.on("themeChange", this.onChangeTheme);
1562
+ this.editorA.on("mousewheel", this.onMouseWheel);
1563
+ this.editorB.on("mousewheel", this.onMouseWheel);
1564
+ this.editorA.on("input", this.onInput);
1565
+ this.editorB.on("input", this.onInput);
1566
+ };
1567
+ SplitDiffView.prototype.$detachEventHandlers = function () {
1568
+ this.$detachSessionsEventHandlers();
1569
+ this.clearSelectionMarkers();
1570
+ this.editorA.renderer.off("themeChange", this.onChangeTheme);
1571
+ this.editorB.renderer.off("themeChange", this.onChangeTheme);
1572
+ this.$detachEditorEventHandlers(this.editorA);
1573
+ this.$detachEditorEventHandlers(this.editorB);
1574
+ };
1575
+ SplitDiffView.prototype.$detachEditorEventHandlers = function (editor) {
1576
+ editor.off("mousewheel", this.onMouseWheel);
1577
+ editor.off("input", this.onInput);
1578
+ };
1579
+ return SplitDiffView;
1580
+ }(BaseDiffView));
1581
+ exports.SplitDiffView = SplitDiffView;
1582
+
1583
+ });
1584
+
1585
+ ace.define("ace/ext/diff/providers/default",["require","exports","module","ace/range","ace/ext/diff/base_diff_view"], function(require, exports, module){'use strict';
1586
+ var __extends = (this && this.__extends) || (function () {
1587
+ var extendStatics = function (d, b) {
1588
+ extendStatics = Object.setPrototypeOf ||
1589
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
1590
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
1591
+ return extendStatics(d, b);
1592
+ };
1593
+ return function (d, b) {
1594
+ if (typeof b !== "function" && b !== null)
1595
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1596
+ extendStatics(d, b);
1597
+ function __() { this.constructor = d; }
1598
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1599
+ };
1600
+ })();
1601
+ var __generator = (this && this.__generator) || function (thisArg, body) {
1602
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
1603
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1604
+ function verb(n) { return function (v) { return step([n, v]); }; }
1605
+ function step(op) {
1606
+ if (f) throw new TypeError("Generator is already executing.");
1607
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
1608
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1609
+ if (y = 0, t) op = [op[0] & 2, t.value];
1610
+ switch (op[0]) {
1611
+ case 0: case 1: t = op; break;
1612
+ case 4: _.label++; return { value: op[1], done: false };
1613
+ case 5: _.label++; y = op[1]; op = [0]; continue;
1614
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
1615
+ default:
1616
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
1617
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
1618
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
1619
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
1620
+ if (t[2]) _.ops.pop();
1621
+ _.trys.pop(); continue;
1622
+ }
1623
+ op = body.call(thisArg, _);
1624
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
1625
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1626
+ }
1627
+ };
1628
+ var __values = (this && this.__values) || function(o) {
1629
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
1630
+ if (m) return m.call(o);
1631
+ if (o && typeof o.length === "number") return {
1632
+ next: function () {
1633
+ if (o && i >= o.length) o = void 0;
1634
+ return { value: o && o[i++], done: !o };
1635
+ }
1636
+ };
1637
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
1638
+ };
1639
+ var _a;
1640
+ var _b, _c, _d, _e, _f;
1641
+ function equals(one, other, itemEquals) {
1642
+ if (itemEquals === void 0) { itemEquals = function (a, b) { return a === b; }; }
1643
+ if (one === other) {
1644
+ return true;
1645
+ }
1646
+ if (!one || !other) {
1647
+ return false;
1648
+ }
1649
+ if (one.length !== other.length) {
1650
+ return false;
1651
+ }
1652
+ for (var i = 0, len = one.length; i < len; i++) {
1653
+ if (!itemEquals(one[i], other[i])) {
1654
+ return false;
1655
+ }
1656
+ }
1657
+ return true;
1658
+ }
1659
+ function groupAdjacentBy(items, shouldBeGrouped) {
1660
+ var currentGroup, last, items_1, items_1_1, item, e_1_1;
1661
+ var e_1, _a;
1662
+ return __generator(this, function (_g) {
1663
+ switch (_g.label) {
1664
+ case 0:
1665
+ _g.trys.push([0, 8, 9, 10]);
1666
+ items_1 = __values(items), items_1_1 = items_1.next();
1667
+ _g.label = 1;
1668
+ case 1:
1669
+ if (!!items_1_1.done) return [3 /*break*/, 7];
1670
+ item = items_1_1.value;
1671
+ if (!(last !== undefined && shouldBeGrouped(last, item))) return [3 /*break*/, 2];
1672
+ currentGroup.push(item);
1673
+ return [3 /*break*/, 5];
1674
+ case 2:
1675
+ if (!currentGroup) return [3 /*break*/, 4];
1676
+ return [4 /*yield*/, currentGroup];
1677
+ case 3:
1678
+ _g.sent();
1679
+ _g.label = 4;
1680
+ case 4:
1681
+ currentGroup = [item];
1682
+ _g.label = 5;
1683
+ case 5:
1684
+ last = item;
1685
+ _g.label = 6;
1686
+ case 6:
1687
+ items_1_1 = items_1.next();
1688
+ return [3 /*break*/, 1];
1689
+ case 7: return [3 /*break*/, 10];
1690
+ case 8:
1691
+ e_1_1 = _g.sent();
1692
+ e_1 = { error: e_1_1 };
1693
+ return [3 /*break*/, 10];
1694
+ case 9:
1695
+ try {
1696
+ if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
1697
+ }
1698
+ finally { if (e_1) throw e_1.error; }
1699
+ return [7 /*endfinally*/];
1700
+ case 10:
1701
+ if (!currentGroup) return [3 /*break*/, 12];
1702
+ return [4 /*yield*/, currentGroup];
1703
+ case 11:
1704
+ _g.sent();
1705
+ _g.label = 12;
1706
+ case 12: return [2 /*return*/];
1707
+ }
1708
+ });
1709
+ }
1710
+ function forEachAdjacent(arr, f) {
1711
+ for (var i = 0; i <= arr.length; i++) {
1712
+ f(i === 0 ? undefined : arr[i - 1], i === arr.length ? undefined : arr[i]);
1713
+ }
1714
+ }
1715
+ function forEachWithNeighbors(arr, f) {
1716
+ for (var i = 0; i < arr.length; i++) {
1717
+ f(i === 0 ? undefined : arr[i - 1], arr[i], i + 1 === arr.length ? undefined : arr[i + 1]);
1718
+ }
1719
+ }
1720
+ function pushMany(arr, items) {
1721
+ var e_2, _a;
1722
+ try {
1723
+ for (var items_2 = __values(items), items_2_1 = items_2.next(); !items_2_1.done; items_2_1 = items_2.next()) {
1724
+ var item = items_2_1.value;
1725
+ arr.push(item);
1726
+ }
1727
+ }
1728
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1729
+ finally {
1730
+ try {
1731
+ if (items_2_1 && !items_2_1.done && (_a = items_2.return)) _a.call(items_2);
1732
+ }
1733
+ finally { if (e_2) throw e_2.error; }
1734
+ }
1735
+ }
1736
+ function compareBy(selector, comparator) {
1737
+ return function (a, b) { return comparator(selector(a), selector(b)); };
1738
+ }
1739
+ var numberComparator = function (a, b) { return a - b; };
1740
+ function reverseOrder(comparator) {
1741
+ return function (a, b) { return -comparator(a, b); };
1742
+ }
1743
+ var BugIndicatingError = /** @class */ (function (_super) {
1744
+ __extends(BugIndicatingError, _super);
1745
+ function BugIndicatingError(message) {
1746
+ var _this = _super.call(this, message || "An unexpected bug occurred.") || this;
1747
+ Object.setPrototypeOf(_this, BugIndicatingError.prototype);
1748
+ return _this;
1749
+ }
1750
+ return BugIndicatingError;
1751
+ }(Error));
1752
+ function assert(condition, message) {
1753
+ if (message === void 0) { message = "unexpected state"; }
1754
+ if (!condition) {
1755
+ throw new BugIndicatingError("Assertion Failed: ".concat(message));
1756
+ }
1757
+ }
1758
+ function assertFn(condition) {
1759
+ condition();
1760
+ }
1761
+ function checkAdjacentItems(items, predicate) {
1762
+ var i = 0;
1763
+ while (i < items.length - 1) {
1764
+ var a = items[i];
1765
+ var b = items[i + 1];
1766
+ if (!predicate(a, b)) {
1767
+ return false;
1768
+ }
1769
+ i++;
1770
+ }
1771
+ return true;
1772
+ }
1773
+ var OffsetRange = /** @class */ (function () {
1774
+ function OffsetRange(start, endExclusive) {
1775
+ this.start = start;
1776
+ this.endExclusive = endExclusive;
1777
+ if (start > endExclusive) {
1778
+ throw new BugIndicatingError("Invalid range: ".concat(this.toString()));
1779
+ }
1780
+ }
1781
+ OffsetRange.fromTo = function (start, endExclusive) {
1782
+ return new OffsetRange(start, endExclusive);
1783
+ };
1784
+ OffsetRange.addRange = function (range, sortedRanges) {
1785
+ var i = 0;
1786
+ while (i < sortedRanges.length && sortedRanges[i].endExclusive < range.start) {
1787
+ i++;
1788
+ }
1789
+ var j = i;
1790
+ while (j < sortedRanges.length && sortedRanges[j].start <= range.endExclusive) {
1791
+ j++;
1792
+ }
1793
+ if (i === j) {
1794
+ sortedRanges.splice(i, 0, range);
1795
+ }
1796
+ else {
1797
+ var start = Math.min(range.start, sortedRanges[i].start);
1798
+ var end = Math.max(range.endExclusive, sortedRanges[j - 1].endExclusive);
1799
+ sortedRanges.splice(i, j - i, new OffsetRange(start, end));
1800
+ }
1801
+ };
1802
+ OffsetRange.tryCreate = function (start, endExclusive) {
1803
+ if (start > endExclusive) {
1804
+ return undefined;
1805
+ }
1806
+ return new OffsetRange(start, endExclusive);
1807
+ };
1808
+ OffsetRange.ofLength = function (length) {
1809
+ return new OffsetRange(0, length);
1810
+ };
1811
+ OffsetRange.ofStartAndLength = function (start, length) {
1812
+ return new OffsetRange(start, start + length);
1813
+ };
1814
+ OffsetRange.emptyAt = function (offset) {
1815
+ return new OffsetRange(offset, offset);
1816
+ };
1817
+ Object.defineProperty(OffsetRange.prototype, "isEmpty", {
1818
+ get: function () {
1819
+ return this.start === this.endExclusive;
1820
+ },
1821
+ enumerable: false,
1822
+ configurable: true
1823
+ });
1824
+ OffsetRange.prototype.delta = function (offset) {
1825
+ return new OffsetRange(this.start + offset, this.endExclusive + offset);
1826
+ };
1827
+ OffsetRange.prototype.deltaStart = function (offset) {
1828
+ return new OffsetRange(this.start + offset, this.endExclusive);
1829
+ };
1830
+ OffsetRange.prototype.deltaEnd = function (offset) {
1831
+ return new OffsetRange(this.start, this.endExclusive + offset);
1832
+ };
1833
+ Object.defineProperty(OffsetRange.prototype, "length", {
1834
+ get: function () {
1835
+ return this.endExclusive - this.start;
1836
+ },
1837
+ enumerable: false,
1838
+ configurable: true
1839
+ });
1840
+ OffsetRange.prototype.toString = function () {
1841
+ return "[".concat(this.start, ", ").concat(this.endExclusive, ")");
1842
+ };
1843
+ OffsetRange.prototype.equals = function (other) {
1844
+ return this.start === other.start && this.endExclusive === other.endExclusive;
1845
+ };
1846
+ OffsetRange.prototype.containsRange = function (other) {
1847
+ return this.start <= other.start && other.endExclusive <= this.endExclusive;
1848
+ };
1849
+ OffsetRange.prototype.contains = function (offset) {
1850
+ return this.start <= offset && offset < this.endExclusive;
1851
+ };
1852
+ OffsetRange.prototype.join = function (other) {
1853
+ return new OffsetRange(Math.min(this.start, other.start), Math.max(this.endExclusive, other.endExclusive));
1854
+ };
1855
+ OffsetRange.prototype.intersect = function (other) {
1856
+ var start = Math.max(this.start, other.start);
1857
+ var end = Math.min(this.endExclusive, other.endExclusive);
1858
+ if (start <= end) {
1859
+ return new OffsetRange(start, end);
1860
+ }
1861
+ return undefined;
1862
+ };
1863
+ OffsetRange.prototype.intersectionLength = function (range) {
1864
+ var start = Math.max(this.start, range.start);
1865
+ var end = Math.min(this.endExclusive, range.endExclusive);
1866
+ return Math.max(0, end - start);
1867
+ };
1868
+ OffsetRange.prototype.intersects = function (other) {
1869
+ var start = Math.max(this.start, other.start);
1870
+ var end = Math.min(this.endExclusive, other.endExclusive);
1871
+ return start < end;
1872
+ };
1873
+ OffsetRange.prototype.intersectsOrTouches = function (other) {
1874
+ var start = Math.max(this.start, other.start);
1875
+ var end = Math.min(this.endExclusive, other.endExclusive);
1876
+ return start <= end;
1877
+ };
1878
+ OffsetRange.prototype.isBefore = function (other) {
1879
+ return this.endExclusive <= other.start;
1880
+ };
1881
+ OffsetRange.prototype.isAfter = function (other) {
1882
+ return this.start >= other.endExclusive;
1883
+ };
1884
+ OffsetRange.prototype.slice = function (arr) {
1885
+ return arr.slice(this.start, this.endExclusive);
1886
+ };
1887
+ OffsetRange.prototype.substring = function (str) {
1888
+ return str.substring(this.start, this.endExclusive);
1889
+ };
1890
+ OffsetRange.prototype.clip = function (value) {
1891
+ if (this.isEmpty) {
1892
+ throw new BugIndicatingError("Invalid clipping range: ".concat(this.toString()));
1893
+ }
1894
+ return Math.max(this.start, Math.min(this.endExclusive - 1, value));
1895
+ };
1896
+ OffsetRange.prototype.clipCyclic = function (value) {
1897
+ if (this.isEmpty) {
1898
+ throw new BugIndicatingError("Invalid clipping range: ".concat(this.toString()));
1899
+ }
1900
+ if (value < this.start) {
1901
+ return this.endExclusive - (this.start - value) % this.length;
1902
+ }
1903
+ if (value >= this.endExclusive) {
1904
+ return this.start + (value - this.start) % this.length;
1905
+ }
1906
+ return value;
1907
+ };
1908
+ OffsetRange.prototype.map = function (f) {
1909
+ var result = [];
1910
+ for (var i = this.start; i < this.endExclusive; i++) {
1911
+ result.push(f(i));
1912
+ }
1913
+ return result;
1914
+ };
1915
+ OffsetRange.prototype.forEach = function (f) {
1916
+ for (var i = this.start; i < this.endExclusive; i++) {
1917
+ f(i);
1918
+ }
1919
+ };
1920
+ return OffsetRange;
1921
+ }());
1922
+ var Position = /** @class */ (function () {
1923
+ function Position(lineNumber, column) {
1924
+ this.lineNumber = lineNumber;
1925
+ this.column = column;
1926
+ }
1927
+ Position.prototype.equals = function (other) {
1928
+ return Position.equals(this, other);
1929
+ };
1930
+ Position.equals = function (a, b) {
1931
+ if (!a && !b) {
1932
+ return true;
1933
+ }
1934
+ return !!a && !!b && a.lineNumber === b.lineNumber && a.column === b.column;
1935
+ };
1936
+ Position.prototype.isBefore = function (other) {
1937
+ return Position.isBefore(this, other);
1938
+ };
1939
+ Position.isBefore = function (a, b) {
1940
+ if (a.lineNumber < b.lineNumber) {
1941
+ return true;
1942
+ }
1943
+ if (b.lineNumber < a.lineNumber) {
1944
+ return false;
1945
+ }
1946
+ return a.column < b.column;
1947
+ };
1948
+ Position.prototype.isBeforeOrEqual = function (other) {
1949
+ return Position.isBeforeOrEqual(this, other);
1950
+ };
1951
+ Position.isBeforeOrEqual = function (a, b) {
1952
+ if (a.lineNumber < b.lineNumber) {
1953
+ return true;
1954
+ }
1955
+ if (b.lineNumber < a.lineNumber) {
1956
+ return false;
1957
+ }
1958
+ return a.column <= b.column;
1959
+ };
1960
+ return Position;
1961
+ }());
1962
+ var Range = /** @class */ (function () {
1963
+ function Range(startLineNumber, startColumn, endLineNumber, endColumn) {
1964
+ if (startLineNumber > endLineNumber || startLineNumber === endLineNumber && startColumn > endColumn) {
1965
+ this.startLineNumber = endLineNumber;
1966
+ this.startColumn = endColumn;
1967
+ this.endLineNumber = startLineNumber;
1968
+ this.endColumn = startColumn;
1969
+ }
1970
+ else {
1971
+ this.startLineNumber = startLineNumber;
1972
+ this.startColumn = startColumn;
1973
+ this.endLineNumber = endLineNumber;
1974
+ this.endColumn = endColumn;
1975
+ }
1976
+ }
1977
+ Range.prototype.isEmpty = function () {
1978
+ return Range.isEmpty(this);
1979
+ };
1980
+ Range.isEmpty = function (range) {
1981
+ return range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn;
1982
+ };
1983
+ Range.prototype.containsPosition = function (position) {
1984
+ return Range.containsPosition(this, position);
1985
+ };
1986
+ Range.containsPosition = function (range, position) {
1987
+ if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {
1988
+ return false;
1989
+ }
1990
+ if (position.lineNumber === range.startLineNumber && position.column < range.startColumn) {
1991
+ return false;
1992
+ }
1993
+ if (position.lineNumber === range.endLineNumber && position.column > range.endColumn) {
1994
+ return false;
1995
+ }
1996
+ return true;
1997
+ };
1998
+ Range.prototype.containsRange = function (range) {
1999
+ return Range.containsRange(this, range);
2000
+ };
2001
+ Range.containsRange = function (range, otherRange) {
2002
+ if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {
2003
+ return false;
2004
+ }
2005
+ if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {
2006
+ return false;
2007
+ }
2008
+ if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn < range.startColumn) {
2009
+ return false;
2010
+ }
2011
+ if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn > range.endColumn) {
2012
+ return false;
2013
+ }
2014
+ return true;
2015
+ };
2016
+ Range.prototype.strictContainsRange = function (range) {
2017
+ return Range.strictContainsRange(this, range);
2018
+ };
2019
+ Range.strictContainsRange = function (range, otherRange) {
2020
+ if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {
2021
+ return false;
2022
+ }
2023
+ if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {
2024
+ return false;
2025
+ }
2026
+ if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn <= range.startColumn) {
2027
+ return false;
2028
+ }
2029
+ if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn >= range.endColumn) {
2030
+ return false;
2031
+ }
2032
+ return true;
2033
+ };
2034
+ Range.prototype.plusRange = function (range) {
2035
+ return Range.plusRange(this, range);
2036
+ };
2037
+ Range.plusRange = function (a, b) {
2038
+ var startLineNumber;
2039
+ var startColumn;
2040
+ var endLineNumber;
2041
+ var endColumn;
2042
+ if (b.startLineNumber < a.startLineNumber) {
2043
+ startLineNumber = b.startLineNumber;
2044
+ startColumn = b.startColumn;
2045
+ }
2046
+ else if (b.startLineNumber === a.startLineNumber) {
2047
+ startLineNumber = b.startLineNumber;
2048
+ startColumn = Math.min(b.startColumn, a.startColumn);
2049
+ }
2050
+ else {
2051
+ startLineNumber = a.startLineNumber;
2052
+ startColumn = a.startColumn;
2053
+ }
2054
+ if (b.endLineNumber > a.endLineNumber) {
2055
+ endLineNumber = b.endLineNumber;
2056
+ endColumn = b.endColumn;
2057
+ }
2058
+ else if (b.endLineNumber === a.endLineNumber) {
2059
+ endLineNumber = b.endLineNumber;
2060
+ endColumn = Math.max(b.endColumn, a.endColumn);
2061
+ }
2062
+ else {
2063
+ endLineNumber = a.endLineNumber;
2064
+ endColumn = a.endColumn;
2065
+ }
2066
+ return new Range(startLineNumber, startColumn, endLineNumber, endColumn);
2067
+ };
2068
+ Range.prototype.intersectRanges = function (range) {
2069
+ return Range.intersectRanges(this, range);
2070
+ };
2071
+ Range.intersectRanges = function (a, b) {
2072
+ var resultStartLineNumber = a.startLineNumber;
2073
+ var resultStartColumn = a.startColumn;
2074
+ var resultEndLineNumber = a.endLineNumber;
2075
+ var resultEndColumn = a.endColumn;
2076
+ var otherStartLineNumber = b.startLineNumber;
2077
+ var otherStartColumn = b.startColumn;
2078
+ var otherEndLineNumber = b.endLineNumber;
2079
+ var otherEndColumn = b.endColumn;
2080
+ if (resultStartLineNumber < otherStartLineNumber) {
2081
+ resultStartLineNumber = otherStartLineNumber;
2082
+ resultStartColumn = otherStartColumn;
2083
+ }
2084
+ else if (resultStartLineNumber === otherStartLineNumber) {
2085
+ resultStartColumn = Math.max(resultStartColumn, otherStartColumn);
2086
+ }
2087
+ if (resultEndLineNumber > otherEndLineNumber) {
2088
+ resultEndLineNumber = otherEndLineNumber;
2089
+ resultEndColumn = otherEndColumn;
2090
+ }
2091
+ else if (resultEndLineNumber === otherEndLineNumber) {
2092
+ resultEndColumn = Math.min(resultEndColumn, otherEndColumn);
2093
+ }
2094
+ if (resultStartLineNumber > resultEndLineNumber) {
2095
+ return null;
2096
+ }
2097
+ if (resultStartLineNumber === resultEndLineNumber && resultStartColumn > resultEndColumn) {
2098
+ return null;
2099
+ }
2100
+ return new Range(resultStartLineNumber, resultStartColumn, resultEndLineNumber, resultEndColumn);
2101
+ };
2102
+ Range.prototype.equalsRange = function (other) {
2103
+ return Range.equalsRange(this, other);
2104
+ };
2105
+ Range.equalsRange = function (a, b) {
2106
+ if (!a && !b) {
2107
+ return true;
2108
+ }
2109
+ return !!a && !!b && a.startLineNumber === b.startLineNumber && a.startColumn === b.startColumn && a.endLineNumber === b.endLineNumber && a.endColumn === b.endColumn;
2110
+ };
2111
+ Range.prototype.getEndPosition = function () {
2112
+ return Range.getEndPosition(this);
2113
+ };
2114
+ Range.getEndPosition = function (range) {
2115
+ return new Position(range.endLineNumber, range.endColumn);
2116
+ };
2117
+ Range.prototype.getStartPosition = function () {
2118
+ return Range.getStartPosition(this);
2119
+ };
2120
+ Range.getStartPosition = function (range) {
2121
+ return new Position(range.startLineNumber, range.startColumn);
2122
+ };
2123
+ Range.prototype.collapseToStart = function () {
2124
+ return Range.collapseToStart(this);
2125
+ };
2126
+ Range.collapseToStart = function (range) {
2127
+ return new Range(range.startLineNumber, range.startColumn, range.startLineNumber, range.startColumn);
2128
+ };
2129
+ Range.prototype.collapseToEnd = function () {
2130
+ return Range.collapseToEnd(this);
2131
+ };
2132
+ Range.collapseToEnd = function (range) {
2133
+ return new Range(range.endLineNumber, range.endColumn, range.endLineNumber, range.endColumn);
2134
+ };
2135
+ Range.fromPositions = function (start, end) {
2136
+ if (end === void 0) { end = start; }
2137
+ return new Range(start.lineNumber, start.column, end.lineNumber, end.column);
2138
+ };
2139
+ return Range;
2140
+ }());
2141
+ function findLastMonotonous(array, predicate) {
2142
+ var idx = findLastIdxMonotonous(array, predicate);
2143
+ return idx === -1 ? undefined : array[idx];
2144
+ }
2145
+ function findLastIdxMonotonous(array, predicate, startIdx, endIdxEx) {
2146
+ if (startIdx === void 0) { startIdx = 0; }
2147
+ if (endIdxEx === void 0) { endIdxEx = array.length; }
2148
+ var i = startIdx;
2149
+ var j = endIdxEx;
2150
+ while (i < j) {
2151
+ var k = Math.floor((i + j) / 2);
2152
+ if (predicate(array[k])) {
2153
+ i = k + 1;
2154
+ }
2155
+ else {
2156
+ j = k;
2157
+ }
2158
+ }
2159
+ return i - 1;
2160
+ }
2161
+ function findFirstMonotonous(array, predicate) {
2162
+ var idx = findFirstIdxMonotonousOrArrLen(array, predicate);
2163
+ return idx === array.length ? undefined : array[idx];
2164
+ }
2165
+ function findFirstIdxMonotonousOrArrLen(array, predicate, startIdx, endIdxEx) {
2166
+ if (startIdx === void 0) { startIdx = 0; }
2167
+ if (endIdxEx === void 0) { endIdxEx = array.length; }
2168
+ var i = startIdx;
2169
+ var j = endIdxEx;
2170
+ while (i < j) {
2171
+ var k = Math.floor((i + j) / 2);
2172
+ if (predicate(array[k])) {
2173
+ j = k;
2174
+ }
2175
+ else {
2176
+ i = k + 1;
2177
+ }
2178
+ }
2179
+ return i;
2180
+ }
2181
+ var MonotonousArray = /** @class */ (function () {
2182
+ function MonotonousArray(_array) {
2183
+ this._array = _array;
2184
+ this._findLastMonotonousLastIdx = 0;
2185
+ }
2186
+ MonotonousArray.prototype.findLastMonotonous = function (predicate) {
2187
+ var e_3, _a;
2188
+ if (_b.assertInvariants) {
2189
+ if (this._prevFindLastPredicate) {
2190
+ try {
2191
+ for (var _g = __values(this._array), _h = _g.next(); !_h.done; _h = _g.next()) {
2192
+ var item = _h.value;
2193
+ if (this._prevFindLastPredicate(item) && !predicate(item)) {
2194
+ throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.");
2195
+ }
2196
+ }
2197
+ }
2198
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
2199
+ finally {
2200
+ try {
2201
+ if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
2202
+ }
2203
+ finally { if (e_3) throw e_3.error; }
2204
+ }
2205
+ }
2206
+ this._prevFindLastPredicate = predicate;
2207
+ }
2208
+ var idx = findLastIdxMonotonous(this._array, predicate, this._findLastMonotonousLastIdx);
2209
+ this._findLastMonotonousLastIdx = idx + 1;
2210
+ return idx === -1 ? undefined : this._array[idx];
2211
+ };
2212
+ return MonotonousArray;
2213
+ }());
2214
+ _b = MonotonousArray;
2215
+ (function () {
2216
+ _b.assertInvariants = false;
2217
+ })();
2218
+ var LineRange = /** @class */ (function () {
2219
+ function LineRange(startLineNumber, endLineNumberExclusive) {
2220
+ if (startLineNumber > endLineNumberExclusive) {
2221
+ throw new BugIndicatingError("startLineNumber ".concat(startLineNumber, " cannot be after endLineNumberExclusive ").concat(endLineNumberExclusive));
2222
+ }
2223
+ this.startLineNumber = startLineNumber;
2224
+ this.endLineNumberExclusive = endLineNumberExclusive;
2225
+ }
2226
+ LineRange.fromRangeInclusive = function (range) {
2227
+ return new LineRange(range.startLineNumber, range.endLineNumber + 1);
2228
+ };
2229
+ LineRange.join = function (lineRanges) {
2230
+ if (lineRanges.length === 0) {
2231
+ throw new BugIndicatingError("lineRanges cannot be empty");
2232
+ }
2233
+ var startLineNumber = lineRanges[0].startLineNumber;
2234
+ var endLineNumberExclusive = lineRanges[0].endLineNumberExclusive;
2235
+ for (var i = 1; i < lineRanges.length; i++) {
2236
+ startLineNumber = Math.min(startLineNumber, lineRanges[i].startLineNumber);
2237
+ endLineNumberExclusive = Math.max(endLineNumberExclusive, lineRanges[i].endLineNumberExclusive);
2238
+ }
2239
+ return new LineRange(startLineNumber, endLineNumberExclusive);
2240
+ };
2241
+ LineRange.ofLength = function (startLineNumber, length) {
2242
+ return new LineRange(startLineNumber, startLineNumber + length);
2243
+ };
2244
+ Object.defineProperty(LineRange.prototype, "isEmpty", {
2245
+ get: function () {
2246
+ return this.startLineNumber === this.endLineNumberExclusive;
2247
+ },
2248
+ enumerable: false,
2249
+ configurable: true
2250
+ });
2251
+ LineRange.prototype.delta = function (offset) {
2252
+ return new LineRange(this.startLineNumber + offset, this.endLineNumberExclusive + offset);
2253
+ };
2254
+ Object.defineProperty(LineRange.prototype, "length", {
2255
+ get: function () {
2256
+ return this.endLineNumberExclusive - this.startLineNumber;
2257
+ },
2258
+ enumerable: false,
2259
+ configurable: true
2260
+ });
2261
+ LineRange.prototype.join = function (other) {
2262
+ return new LineRange(Math.min(this.startLineNumber, other.startLineNumber), Math.max(this.endLineNumberExclusive, other.endLineNumberExclusive));
2263
+ };
2264
+ LineRange.prototype.intersect = function (other) {
2265
+ var startLineNumber = Math.max(this.startLineNumber, other.startLineNumber);
2266
+ var endLineNumberExclusive = Math.min(this.endLineNumberExclusive, other.endLineNumberExclusive);
2267
+ if (startLineNumber <= endLineNumberExclusive) {
2268
+ return new LineRange(startLineNumber, endLineNumberExclusive);
2269
+ }
2270
+ return undefined;
2271
+ };
2272
+ LineRange.prototype.overlapOrTouch = function (other) {
2273
+ return this.startLineNumber <= other.endLineNumberExclusive && other.startLineNumber <= this.endLineNumberExclusive;
2274
+ };
2275
+ LineRange.prototype.toInclusiveRange = function () {
2276
+ if (this.isEmpty) {
2277
+ return null;
2278
+ }
2279
+ return new Range(this.startLineNumber, 1, this.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER);
2280
+ };
2281
+ LineRange.prototype.toOffsetRange = function () {
2282
+ return new OffsetRange(this.startLineNumber - 1, this.endLineNumberExclusive - 1);
2283
+ };
2284
+ return LineRange;
2285
+ }());
2286
+ var LineRangeSet = /** @class */ (function () {
2287
+ function LineRangeSet(_normalizedRanges) {
2288
+ if (_normalizedRanges === void 0) { _normalizedRanges = []; }
2289
+ this._normalizedRanges = _normalizedRanges;
2290
+ }
2291
+ Object.defineProperty(LineRangeSet.prototype, "ranges", {
2292
+ get: function () {
2293
+ return this._normalizedRanges;
2294
+ },
2295
+ enumerable: false,
2296
+ configurable: true
2297
+ });
2298
+ LineRangeSet.prototype.addRange = function (range) {
2299
+ if (range.length === 0) {
2300
+ return;
2301
+ }
2302
+ var joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, function (r) { return r.endLineNumberExclusive >= range.startLineNumber; });
2303
+ var joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, function (r) { return r.startLineNumber <= range.endLineNumberExclusive; }) + 1;
2304
+ if (joinRangeStartIdx === joinRangeEndIdxExclusive) {
2305
+ this._normalizedRanges.splice(joinRangeStartIdx, 0, range);
2306
+ }
2307
+ else if (joinRangeStartIdx === joinRangeEndIdxExclusive - 1) {
2308
+ var joinRange = this._normalizedRanges[joinRangeStartIdx];
2309
+ this._normalizedRanges[joinRangeStartIdx] = joinRange.join(range);
2310
+ }
2311
+ else {
2312
+ var joinRange = this._normalizedRanges[joinRangeStartIdx].join(this._normalizedRanges[joinRangeEndIdxExclusive - 1]).join(range);
2313
+ this._normalizedRanges.splice(joinRangeStartIdx, joinRangeEndIdxExclusive - joinRangeStartIdx, joinRange);
2314
+ }
2315
+ };
2316
+ LineRangeSet.prototype.contains = function (lineNumber) {
2317
+ var rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, function (r) { return r.startLineNumber <= lineNumber; });
2318
+ return !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > lineNumber;
2319
+ };
2320
+ LineRangeSet.prototype.subtractFrom = function (range) {
2321
+ var joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, function (r) { return r.endLineNumberExclusive >= range.startLineNumber; });
2322
+ var joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, function (r) { return r.startLineNumber <= range.endLineNumberExclusive; }) + 1;
2323
+ if (joinRangeStartIdx === joinRangeEndIdxExclusive) {
2324
+ return new LineRangeSet([range]);
2325
+ }
2326
+ var result = [];
2327
+ var startLineNumber = range.startLineNumber;
2328
+ for (var i = joinRangeStartIdx; i < joinRangeEndIdxExclusive; i++) {
2329
+ var r = this._normalizedRanges[i];
2330
+ if (r.startLineNumber > startLineNumber) {
2331
+ result.push(new LineRange(startLineNumber, r.startLineNumber));
2332
+ }
2333
+ startLineNumber = r.endLineNumberExclusive;
2334
+ }
2335
+ if (startLineNumber < range.endLineNumberExclusive) {
2336
+ result.push(new LineRange(startLineNumber, range.endLineNumberExclusive));
2337
+ }
2338
+ return new LineRangeSet(result);
2339
+ };
2340
+ LineRangeSet.prototype.getIntersection = function (other) {
2341
+ var result = [];
2342
+ var i1 = 0;
2343
+ var i2 = 0;
2344
+ while (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {
2345
+ var r1 = this._normalizedRanges[i1];
2346
+ var r2 = other._normalizedRanges[i2];
2347
+ var i = r1.intersect(r2);
2348
+ if (i && !i.isEmpty) {
2349
+ result.push(i);
2350
+ }
2351
+ if (r1.endLineNumberExclusive < r2.endLineNumberExclusive) {
2352
+ i1++;
2353
+ }
2354
+ else {
2355
+ i2++;
2356
+ }
2357
+ }
2358
+ return new LineRangeSet(result);
2359
+ };
2360
+ LineRangeSet.prototype.getWithDelta = function (value) {
2361
+ return new LineRangeSet(this._normalizedRanges.map(function (r) { return r.delta(value); }));
2362
+ };
2363
+ return LineRangeSet;
2364
+ }());
2365
+ var TextLength = /** @class */ (function () {
2366
+ function TextLength(lineCount, columnCount) {
2367
+ this.lineCount = lineCount;
2368
+ this.columnCount = columnCount;
2369
+ }
2370
+ TextLength.prototype.toLineRange = function () {
2371
+ return LineRange.ofLength(1, this.lineCount);
2372
+ };
2373
+ TextLength.prototype.addToPosition = function (position) {
2374
+ if (this.lineCount === 0) {
2375
+ return new Position(position.lineNumber, position.column + this.columnCount);
2376
+ }
2377
+ else {
2378
+ return new Position(position.lineNumber + this.lineCount, this.columnCount + 1);
2379
+ }
2380
+ };
2381
+ return TextLength;
2382
+ }());
2383
+ _c = TextLength;
2384
+ (function () {
2385
+ _c.zero = new _c(0, 0);
2386
+ })();
2387
+ var LineBasedText = /** @class */ (function () {
2388
+ function LineBasedText(_getLineContent, _lineCount) {
2389
+ assert(_lineCount >= 1);
2390
+ this._getLineContent = _getLineContent;
2391
+ this._lineCount = _lineCount;
2392
+ }
2393
+ LineBasedText.prototype.getValueOfRange = function (range) {
2394
+ if (range.startLineNumber === range.endLineNumber) {
2395
+ return this._getLineContent(range.startLineNumber).substring(range.startColumn - 1, range.endColumn - 1);
2396
+ }
2397
+ var result = this._getLineContent(range.startLineNumber).substring(range.startColumn - 1);
2398
+ for (var i = range.startLineNumber + 1; i < range.endLineNumber; i++) {
2399
+ result += "\n" + this._getLineContent(i);
2400
+ }
2401
+ result += "\n" + this._getLineContent(range.endLineNumber).substring(0, range.endColumn - 1);
2402
+ return result;
2403
+ };
2404
+ LineBasedText.prototype.getLineLength = function (lineNumber) {
2405
+ return this._getLineContent(lineNumber).length;
2406
+ };
2407
+ Object.defineProperty(LineBasedText.prototype, "length", {
2408
+ get: function () {
2409
+ var lastLine = this._getLineContent(this._lineCount);
2410
+ return new TextLength(this._lineCount - 1, lastLine.length);
2411
+ },
2412
+ enumerable: false,
2413
+ configurable: true
2414
+ });
2415
+ return LineBasedText;
2416
+ }());
2417
+ var ArrayText = /** @class */ (function (_super) {
2418
+ __extends(ArrayText, _super);
2419
+ function ArrayText(lines) {
2420
+ return _super.call(this, function (lineNumber) { return lines[lineNumber - 1]; }, lines.length) || this;
2421
+ }
2422
+ return ArrayText;
2423
+ }(LineBasedText));
2424
+ var LinesDiff = /** @class */ (function () {
2425
+ function LinesDiff(changes, moves, hitTimeout) {
2426
+ this.changes = changes;
2427
+ this.moves = moves;
2428
+ this.hitTimeout = hitTimeout;
2429
+ }
2430
+ return LinesDiff;
2431
+ }());
2432
+ var MovedText = /** @class */ (function () {
2433
+ function MovedText(lineRangeMapping, changes) {
2434
+ this.lineRangeMapping = lineRangeMapping;
2435
+ this.changes = changes;
2436
+ }
2437
+ return MovedText;
2438
+ }());
2439
+ var LineRangeMapping = /** @class */ (function () {
2440
+ function LineRangeMapping(originalRange, modifiedRange) {
2441
+ this.original = originalRange;
2442
+ this.modified = modifiedRange;
2443
+ }
2444
+ LineRangeMapping.prototype.join = function (other) {
2445
+ return new LineRangeMapping(this.original.join(other.original), this.modified.join(other.modified));
2446
+ };
2447
+ Object.defineProperty(LineRangeMapping.prototype, "changedLineCount", {
2448
+ get: function () {
2449
+ return Math.max(this.original.length, this.modified.length);
2450
+ },
2451
+ enumerable: false,
2452
+ configurable: true
2453
+ });
2454
+ LineRangeMapping.prototype.toRangeMapping = function () {
2455
+ var origInclusiveRange = this.original.toInclusiveRange();
2456
+ var modInclusiveRange = this.modified.toInclusiveRange();
2457
+ if (origInclusiveRange && modInclusiveRange) {
2458
+ return new RangeMapping(origInclusiveRange, modInclusiveRange);
2459
+ }
2460
+ else if (this.original.startLineNumber === 1 || this.modified.startLineNumber === 1) {
2461
+ if (!(this.modified.startLineNumber === 1 && this.original.startLineNumber === 1)) {
2462
+ throw new BugIndicatingError("not a valid diff");
2463
+ }
2464
+ return new RangeMapping(new Range(this.original.startLineNumber, 1, this.original.endLineNumberExclusive, 1), new Range(this.modified.startLineNumber, 1, this.modified.endLineNumberExclusive, 1));
2465
+ }
2466
+ else {
2467
+ return new RangeMapping(new Range(this.original.startLineNumber - 1, Number.MAX_SAFE_INTEGER, this.original.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), new Range(this.modified.startLineNumber - 1, Number.MAX_SAFE_INTEGER, this.modified.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER));
2468
+ }
2469
+ };
2470
+ LineRangeMapping.prototype.toRangeMapping2 = function (original, modified) {
2471
+ if (isValidLineNumber(this.original.endLineNumberExclusive, original) && isValidLineNumber(this.modified.endLineNumberExclusive, modified)) {
2472
+ return new RangeMapping(new Range(this.original.startLineNumber, 1, this.original.endLineNumberExclusive, 1), new Range(this.modified.startLineNumber, 1, this.modified.endLineNumberExclusive, 1));
2473
+ }
2474
+ if (!this.original.isEmpty && !this.modified.isEmpty) {
2475
+ return new RangeMapping(Range.fromPositions(new Position(this.original.startLineNumber, 1), normalizePosition(new Position(this.original.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), original)), Range.fromPositions(new Position(this.modified.startLineNumber, 1), normalizePosition(new Position(this.modified.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), modified)));
2476
+ }
2477
+ if (this.original.startLineNumber > 1 && this.modified.startLineNumber > 1) {
2478
+ return new RangeMapping(Range.fromPositions(normalizePosition(new Position(this.original.startLineNumber - 1, Number.MAX_SAFE_INTEGER), original), normalizePosition(new Position(this.original.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), original)), Range.fromPositions(normalizePosition(new Position(this.modified.startLineNumber - 1, Number.MAX_SAFE_INTEGER), modified), normalizePosition(new Position(this.modified.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER), modified)));
2479
+ }
2480
+ throw new BugIndicatingError();
2481
+ };
2482
+ return LineRangeMapping;
2483
+ }());
2484
+ function normalizePosition(position, content) {
2485
+ if (position.lineNumber < 1) {
2486
+ return new Position(1, 1);
2487
+ }
2488
+ if (position.lineNumber > content.length) {
2489
+ return new Position(content.length, content[content.length - 1].length + 1);
2490
+ }
2491
+ var line = content[position.lineNumber - 1];
2492
+ if (position.column > line.length + 1) {
2493
+ return new Position(position.lineNumber, line.length + 1);
2494
+ }
2495
+ return position;
2496
+ }
2497
+ function isValidLineNumber(lineNumber, lines) {
2498
+ return lineNumber >= 1 && lineNumber <= lines.length;
2499
+ }
2500
+ var DetailedLineRangeMapping = /** @class */ (function (_super) {
2501
+ __extends(DetailedLineRangeMapping, _super);
2502
+ function DetailedLineRangeMapping(originalRange, modifiedRange, innerChanges) {
2503
+ var _this = _super.call(this, originalRange, modifiedRange) || this;
2504
+ _this.innerChanges = innerChanges;
2505
+ return _this;
2506
+ }
2507
+ DetailedLineRangeMapping.fromRangeMappings = function (rangeMappings) {
2508
+ var originalRange = LineRange.join(rangeMappings.map(function (r) { return LineRange.fromRangeInclusive(r.originalRange); }));
2509
+ var modifiedRange = LineRange.join(rangeMappings.map(function (r) { return LineRange.fromRangeInclusive(r.modifiedRange); }));
2510
+ return new DetailedLineRangeMapping(originalRange, modifiedRange, rangeMappings);
2511
+ };
2512
+ DetailedLineRangeMapping.prototype.flip = function () {
2513
+ var _a;
2514
+ return new DetailedLineRangeMapping(this.modified, this.original, (_a = this.innerChanges) === null || _a === void 0 ? void 0 : _a.map(function (c) { return c.flip(); }));
2515
+ };
2516
+ DetailedLineRangeMapping.prototype.withInnerChangesFromLineRanges = function () {
2517
+ return new DetailedLineRangeMapping(this.original, this.modified, [this.toRangeMapping()]);
2518
+ };
2519
+ return DetailedLineRangeMapping;
2520
+ }(LineRangeMapping));
2521
+ var RangeMapping = /** @class */ (function () {
2522
+ function RangeMapping(originalRange, modifiedRange) {
2523
+ this.originalRange = originalRange;
2524
+ this.modifiedRange = modifiedRange;
2525
+ }
2526
+ RangeMapping.join = function (rangeMappings) {
2527
+ if (rangeMappings.length === 0) {
2528
+ throw new BugIndicatingError("Cannot join an empty list of range mappings");
2529
+ }
2530
+ var result = rangeMappings[0];
2531
+ for (var i = 1; i < rangeMappings.length; i++) {
2532
+ result = result.join(rangeMappings[i]);
2533
+ }
2534
+ return result;
2535
+ };
2536
+ RangeMapping.assertSorted = function (rangeMappings) {
2537
+ for (var i = 1; i < rangeMappings.length; i++) {
2538
+ var previous = rangeMappings[i - 1];
2539
+ var current = rangeMappings[i];
2540
+ if (!(previous.originalRange.getEndPosition().isBeforeOrEqual(current.originalRange.getStartPosition()) && previous.modifiedRange.getEndPosition().isBeforeOrEqual(current.modifiedRange.getStartPosition()))) {
2541
+ throw new BugIndicatingError("Range mappings must be sorted");
2542
+ }
2543
+ }
2544
+ };
2545
+ RangeMapping.prototype.flip = function () {
2546
+ return new RangeMapping(this.modifiedRange, this.originalRange);
2547
+ };
2548
+ RangeMapping.prototype.join = function (other) {
2549
+ return new RangeMapping(this.originalRange.plusRange(other.originalRange), this.modifiedRange.plusRange(other.modifiedRange));
2550
+ };
2551
+ return RangeMapping;
2552
+ }());
2553
+ function lineRangeMappingFromRangeMappings(alignments, originalLines, modifiedLines, dontAssertStartLine) {
2554
+ var e_4, _a;
2555
+ if (dontAssertStartLine === void 0) { dontAssertStartLine = false; }
2556
+ var changes = [];
2557
+ try {
2558
+ for (var _g = __values(groupAdjacentBy(alignments.map(function (a) { return getLineRangeMapping(a, originalLines, modifiedLines); }), function (a1, a2) { return a1.original.overlapOrTouch(a2.original) || a1.modified.overlapOrTouch(a2.modified); })), _h = _g.next(); !_h.done; _h = _g.next()) {
2559
+ var g = _h.value;
2560
+ var first = g[0];
2561
+ var last = g[g.length - 1];
2562
+ changes.push(new DetailedLineRangeMapping(first.original.join(last.original), first.modified.join(last.modified), g.map(function (a) { return a.innerChanges[0]; })));
2563
+ }
2564
+ }
2565
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
2566
+ finally {
2567
+ try {
2568
+ if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
2569
+ }
2570
+ finally { if (e_4) throw e_4.error; }
2571
+ }
2572
+ assertFn(function () {
2573
+ if (!dontAssertStartLine && changes.length > 0) {
2574
+ if (changes[0].modified.startLineNumber !== changes[0].original.startLineNumber) {
2575
+ return false;
2576
+ }
2577
+ if (modifiedLines.length.lineCount - changes[changes.length - 1].modified.endLineNumberExclusive !== originalLines.length.lineCount - changes[changes.length - 1].original.endLineNumberExclusive) {
2578
+ return false;
2579
+ }
2580
+ }
2581
+ return checkAdjacentItems(changes, function (m1, m2) { return m2.original.startLineNumber - m1.original.endLineNumberExclusive === m2.modified.startLineNumber - m1.modified.endLineNumberExclusive && // There has to be an unchanged line in between (otherwise both diffs should have been joined)
2582
+ m1.original.endLineNumberExclusive < m2.original.startLineNumber && m1.modified.endLineNumberExclusive < m2.modified.startLineNumber; });
2583
+ });
2584
+ return changes;
2585
+ }
2586
+ function getLineRangeMapping(rangeMapping, originalLines, modifiedLines) {
2587
+ var lineStartDelta = 0;
2588
+ var lineEndDelta = 0;
2589
+ if (rangeMapping.modifiedRange.endColumn === 1 && rangeMapping.originalRange.endColumn === 1 && rangeMapping.originalRange.startLineNumber + lineStartDelta <= rangeMapping.originalRange.endLineNumber && rangeMapping.modifiedRange.startLineNumber + lineStartDelta <= rangeMapping.modifiedRange.endLineNumber) {
2590
+ lineEndDelta = -1;
2591
+ }
2592
+ if (rangeMapping.modifiedRange.startColumn - 1 >= modifiedLines.getLineLength(rangeMapping.modifiedRange.startLineNumber) && rangeMapping.originalRange.startColumn - 1 >= originalLines.getLineLength(rangeMapping.originalRange.startLineNumber) && rangeMapping.originalRange.startLineNumber <= rangeMapping.originalRange.endLineNumber + lineEndDelta && rangeMapping.modifiedRange.startLineNumber <= rangeMapping.modifiedRange.endLineNumber + lineEndDelta) {
2593
+ lineStartDelta = 1;
2594
+ }
2595
+ var originalLineRange = new LineRange(rangeMapping.originalRange.startLineNumber + lineStartDelta, rangeMapping.originalRange.endLineNumber + 1 + lineEndDelta);
2596
+ var modifiedLineRange = new LineRange(rangeMapping.modifiedRange.startLineNumber + lineStartDelta, rangeMapping.modifiedRange.endLineNumber + 1 + lineEndDelta);
2597
+ return new DetailedLineRangeMapping(originalLineRange, modifiedLineRange, [rangeMapping]);
2598
+ }
2599
+ var DiffAlgorithmResult = /** @class */ (function () {
2600
+ function DiffAlgorithmResult(diffs, hitTimeout) {
2601
+ this.diffs = diffs;
2602
+ this.hitTimeout = hitTimeout;
2603
+ }
2604
+ DiffAlgorithmResult.trivial = function (seq1, seq2) {
2605
+ return new DiffAlgorithmResult([new SequenceDiff(OffsetRange.ofLength(seq1.length), OffsetRange.ofLength(seq2.length))], false);
2606
+ };
2607
+ DiffAlgorithmResult.trivialTimedOut = function (seq1, seq2) {
2608
+ return new DiffAlgorithmResult([new SequenceDiff(OffsetRange.ofLength(seq1.length), OffsetRange.ofLength(seq2.length))], true);
2609
+ };
2610
+ return DiffAlgorithmResult;
2611
+ }());
2612
+ var SequenceDiff = /** @class */ (function () {
2613
+ function SequenceDiff(seq1Range, seq2Range) {
2614
+ this.seq1Range = seq1Range;
2615
+ this.seq2Range = seq2Range;
2616
+ }
2617
+ SequenceDiff.invert = function (sequenceDiffs, doc1Length) {
2618
+ var result = [];
2619
+ forEachAdjacent(sequenceDiffs, function (a, b) {
2620
+ result.push(SequenceDiff.fromOffsetPairs(a ? a.getEndExclusives() : OffsetPair.zero, b ? b.getStarts() : new OffsetPair(doc1Length, (a ? a.seq2Range.endExclusive - a.seq1Range.endExclusive : 0) + doc1Length)));
2621
+ });
2622
+ return result;
2623
+ };
2624
+ SequenceDiff.fromOffsetPairs = function (start, endExclusive) {
2625
+ return new SequenceDiff(new OffsetRange(start.offset1, endExclusive.offset1), new OffsetRange(start.offset2, endExclusive.offset2));
2626
+ };
2627
+ SequenceDiff.assertSorted = function (sequenceDiffs) {
2628
+ var e_5, _a;
2629
+ var last = undefined;
2630
+ try {
2631
+ for (var sequenceDiffs_1 = __values(sequenceDiffs), sequenceDiffs_1_1 = sequenceDiffs_1.next(); !sequenceDiffs_1_1.done; sequenceDiffs_1_1 = sequenceDiffs_1.next()) {
2632
+ var cur = sequenceDiffs_1_1.value;
2633
+ if (last) {
2634
+ if (!(last.seq1Range.endExclusive <= cur.seq1Range.start && last.seq2Range.endExclusive <= cur.seq2Range.start)) {
2635
+ throw new BugIndicatingError("Sequence diffs must be sorted");
2636
+ }
2637
+ }
2638
+ last = cur;
2639
+ }
2640
+ }
2641
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
2642
+ finally {
2643
+ try {
2644
+ if (sequenceDiffs_1_1 && !sequenceDiffs_1_1.done && (_a = sequenceDiffs_1.return)) _a.call(sequenceDiffs_1);
2645
+ }
2646
+ finally { if (e_5) throw e_5.error; }
2647
+ }
2648
+ };
2649
+ SequenceDiff.prototype.swap = function () {
2650
+ return new SequenceDiff(this.seq2Range, this.seq1Range);
2651
+ };
2652
+ SequenceDiff.prototype.join = function (other) {
2653
+ return new SequenceDiff(this.seq1Range.join(other.seq1Range), this.seq2Range.join(other.seq2Range));
2654
+ };
2655
+ SequenceDiff.prototype.delta = function (offset) {
2656
+ if (offset === 0) {
2657
+ return this;
2658
+ }
2659
+ return new SequenceDiff(this.seq1Range.delta(offset), this.seq2Range.delta(offset));
2660
+ };
2661
+ SequenceDiff.prototype.deltaStart = function (offset) {
2662
+ if (offset === 0) {
2663
+ return this;
2664
+ }
2665
+ return new SequenceDiff(this.seq1Range.deltaStart(offset), this.seq2Range.deltaStart(offset));
2666
+ };
2667
+ SequenceDiff.prototype.deltaEnd = function (offset) {
2668
+ if (offset === 0) {
2669
+ return this;
2670
+ }
2671
+ return new SequenceDiff(this.seq1Range.deltaEnd(offset), this.seq2Range.deltaEnd(offset));
2672
+ };
2673
+ SequenceDiff.prototype.intersect = function (other) {
2674
+ var i1 = this.seq1Range.intersect(other.seq1Range);
2675
+ var i2 = this.seq2Range.intersect(other.seq2Range);
2676
+ if (!i1 || !i2) {
2677
+ return undefined;
2678
+ }
2679
+ return new SequenceDiff(i1, i2);
2680
+ };
2681
+ SequenceDiff.prototype.getStarts = function () {
2682
+ return new OffsetPair(this.seq1Range.start, this.seq2Range.start);
2683
+ };
2684
+ SequenceDiff.prototype.getEndExclusives = function () {
2685
+ return new OffsetPair(this.seq1Range.endExclusive, this.seq2Range.endExclusive);
2686
+ };
2687
+ return SequenceDiff;
2688
+ }());
2689
+ var OffsetPair = /** @class */ (function () {
2690
+ function OffsetPair(offset1, offset2) {
2691
+ this.offset1 = offset1;
2692
+ this.offset2 = offset2;
2693
+ }
2694
+ OffsetPair.prototype.delta = function (offset) {
2695
+ if (offset === 0) {
2696
+ return this;
2697
+ }
2698
+ return new _d(this.offset1 + offset, this.offset2 + offset);
2699
+ };
2700
+ OffsetPair.prototype.equals = function (other) {
2701
+ return this.offset1 === other.offset1 && this.offset2 === other.offset2;
2702
+ };
2703
+ return OffsetPair;
2704
+ }());
2705
+ _d = OffsetPair;
2706
+ (function () {
2707
+ _d.zero = new _d(0, 0);
2708
+ })();
2709
+ (function () {
2710
+ _d.max = new _d(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER);
2711
+ })();
2712
+ var InfiniteTimeout = /** @class */ (function () {
2713
+ function InfiniteTimeout() {
2714
+ }
2715
+ InfiniteTimeout.prototype.isValid = function () {
2716
+ return true;
2717
+ };
2718
+ return InfiniteTimeout;
2719
+ }());
2720
+ _e = InfiniteTimeout;
2721
+ (function () {
2722
+ _e.instance = new _e();
2723
+ })();
2724
+ var DateTimeout = /** @class */ (function () {
2725
+ function DateTimeout(timeout) {
2726
+ this.timeout = timeout;
2727
+ this.startTime = Date.now();
2728
+ this.valid = true;
2729
+ if (timeout <= 0) {
2730
+ throw new BugIndicatingError("timeout must be positive");
2731
+ }
2732
+ }
2733
+ DateTimeout.prototype.isValid = function () {
2734
+ var valid = Date.now() - this.startTime < this.timeout;
2735
+ if (!valid && this.valid) {
2736
+ this.valid = false;
2737
+ }
2738
+ return this.valid;
2739
+ };
2740
+ DateTimeout.prototype.disable = function () {
2741
+ this.timeout = Number.MAX_SAFE_INTEGER;
2742
+ this.isValid = function () { return true; };
2743
+ this.valid = true;
2744
+ };
2745
+ return DateTimeout;
2746
+ }());
2747
+ var Array2D = /** @class */ (function () {
2748
+ function Array2D(width, height) {
2749
+ this.width = width;
2750
+ this.height = height;
2751
+ this.array = [];
2752
+ this.array = new Array(width * height);
2753
+ }
2754
+ Array2D.prototype.get = function (x, y) {
2755
+ return this.array[x + y * this.width];
2756
+ };
2757
+ Array2D.prototype.set = function (x, y, value) {
2758
+ this.array[x + y * this.width] = value;
2759
+ };
2760
+ return Array2D;
2761
+ }());
2762
+ function isSpace(charCode) {
2763
+ return charCode === 32 || charCode === 9;
2764
+ }
2765
+ var LineRangeFragment = /** @class */ (function () {
2766
+ function LineRangeFragment(range, lines, source) {
2767
+ this.range = range;
2768
+ this.lines = lines;
2769
+ this.source = source;
2770
+ this.histogram = [];
2771
+ var counter = 0;
2772
+ for (var i = range.startLineNumber - 1; i < range.endLineNumberExclusive - 1; i++) {
2773
+ var line = lines[i];
2774
+ for (var j = 0; j < line.length; j++) {
2775
+ counter++;
2776
+ var chr = line[j];
2777
+ var key2 = _f.getKey(chr);
2778
+ this.histogram[key2] = (this.histogram[key2] || 0) + 1;
2779
+ }
2780
+ counter++;
2781
+ var key = _f.getKey("\n");
2782
+ this.histogram[key] = (this.histogram[key] || 0) + 1;
2783
+ }
2784
+ this.totalCount = counter;
2785
+ }
2786
+ LineRangeFragment.getKey = function (chr) {
2787
+ var key = this.chrKeys.get(chr);
2788
+ if (key === undefined) {
2789
+ key = this.chrKeys.size;
2790
+ this.chrKeys.set(chr, key);
2791
+ }
2792
+ return key;
2793
+ };
2794
+ LineRangeFragment.prototype.computeSimilarity = function (other) {
2795
+ var _a, _g;
2796
+ var sumDifferences = 0;
2797
+ var maxLength = Math.max(this.histogram.length, other.histogram.length);
2798
+ for (var i = 0; i < maxLength; i++) {
2799
+ sumDifferences += Math.abs(((_a = this.histogram[i]) !== null && _a !== void 0 ? _a : 0) - ((_g = other.histogram[i]) !== null && _g !== void 0 ? _g : 0));
2800
+ }
2801
+ return 1 - sumDifferences / (this.totalCount + other.totalCount);
2802
+ };
2803
+ return LineRangeFragment;
2804
+ }());
2805
+ _f = LineRangeFragment;
2806
+ (function () {
2807
+ _f.chrKeys = /* @__PURE__ */ new Map();
2808
+ })();
2809
+ var DynamicProgrammingDiffing = /** @class */ (function () {
2810
+ function DynamicProgrammingDiffing() {
2811
+ }
2812
+ DynamicProgrammingDiffing.prototype.compute = function (sequence1, sequence2, timeout, equalityScore) {
2813
+ if (timeout === void 0) { timeout = InfiniteTimeout.instance; }
2814
+ if (sequence1.length === 0 || sequence2.length === 0) {
2815
+ return DiffAlgorithmResult.trivial(sequence1, sequence2);
2816
+ }
2817
+ var lcsLengths = new Array2D(sequence1.length, sequence2.length);
2818
+ var directions = new Array2D(sequence1.length, sequence2.length);
2819
+ var lengths = new Array2D(sequence1.length, sequence2.length);
2820
+ for (var s12 = 0; s12 < sequence1.length; s12++) {
2821
+ for (var s22 = 0; s22 < sequence2.length; s22++) {
2822
+ if (!timeout.isValid()) {
2823
+ return DiffAlgorithmResult.trivialTimedOut(sequence1, sequence2);
2824
+ }
2825
+ var horizontalLen = s12 === 0 ? 0 : lcsLengths.get(s12 - 1, s22);
2826
+ var verticalLen = s22 === 0 ? 0 : lcsLengths.get(s12, s22 - 1);
2827
+ var extendedSeqScore = void 0;
2828
+ if (sequence1.getElement(s12) === sequence2.getElement(s22)) {
2829
+ if (s12 === 0 || s22 === 0) {
2830
+ extendedSeqScore = 0;
2831
+ }
2832
+ else {
2833
+ extendedSeqScore = lcsLengths.get(s12 - 1, s22 - 1);
2834
+ }
2835
+ if (s12 > 0 && s22 > 0 && directions.get(s12 - 1, s22 - 1) === 3) {
2836
+ extendedSeqScore += lengths.get(s12 - 1, s22 - 1);
2837
+ }
2838
+ extendedSeqScore += equalityScore ? equalityScore(s12, s22) : 1;
2839
+ }
2840
+ else {
2841
+ extendedSeqScore = -1;
2842
+ }
2843
+ var newValue = Math.max(horizontalLen, verticalLen, extendedSeqScore);
2844
+ if (newValue === extendedSeqScore) {
2845
+ var prevLen = s12 > 0 && s22 > 0 ? lengths.get(s12 - 1, s22 - 1) : 0;
2846
+ lengths.set(s12, s22, prevLen + 1);
2847
+ directions.set(s12, s22, 3);
2848
+ }
2849
+ else if (newValue === horizontalLen) {
2850
+ lengths.set(s12, s22, 0);
2851
+ directions.set(s12, s22, 1);
2852
+ }
2853
+ else if (newValue === verticalLen) {
2854
+ lengths.set(s12, s22, 0);
2855
+ directions.set(s12, s22, 2);
2856
+ }
2857
+ lcsLengths.set(s12, s22, newValue);
2858
+ }
2859
+ }
2860
+ var result = [];
2861
+ var lastAligningPosS1 = sequence1.length;
2862
+ var lastAligningPosS2 = sequence2.length;
2863
+ function reportDecreasingAligningPositions(s12, s22) {
2864
+ if (s12 + 1 !== lastAligningPosS1 || s22 + 1 !== lastAligningPosS2) {
2865
+ result.push(new SequenceDiff(new OffsetRange(s12 + 1, lastAligningPosS1), new OffsetRange(s22 + 1, lastAligningPosS2)));
2866
+ }
2867
+ lastAligningPosS1 = s12;
2868
+ lastAligningPosS2 = s22;
2869
+ }
2870
+ var s1 = sequence1.length - 1;
2871
+ var s2 = sequence2.length - 1;
2872
+ while (s1 >= 0 && s2 >= 0) {
2873
+ if (directions.get(s1, s2) === 3) {
2874
+ reportDecreasingAligningPositions(s1, s2);
2875
+ s1--;
2876
+ s2--;
2877
+ }
2878
+ else {
2879
+ if (directions.get(s1, s2) === 1) {
2880
+ s1--;
2881
+ }
2882
+ else {
2883
+ s2--;
2884
+ }
2885
+ }
2886
+ }
2887
+ reportDecreasingAligningPositions(-1, -1);
2888
+ result.reverse();
2889
+ return new DiffAlgorithmResult(result, false);
2890
+ };
2891
+ return DynamicProgrammingDiffing;
2892
+ }());
2893
+ var MyersDiffAlgorithm = /** @class */ (function () {
2894
+ function MyersDiffAlgorithm() {
2895
+ }
2896
+ MyersDiffAlgorithm.prototype.compute = function (seq1, seq2, timeout) {
2897
+ if (timeout === void 0) { timeout = InfiniteTimeout.instance; }
2898
+ if (seq1.length === 0 || seq2.length === 0) {
2899
+ return DiffAlgorithmResult.trivial(seq1, seq2);
2900
+ }
2901
+ var seqX = seq1;
2902
+ var seqY = seq2;
2903
+ function getXAfterSnake(x, y) {
2904
+ while (x < seqX.length && y < seqY.length && seqX.getElement(x) === seqY.getElement(y)) {
2905
+ x++;
2906
+ y++;
2907
+ }
2908
+ return x;
2909
+ }
2910
+ var d = 0;
2911
+ var V = new FastInt32Array();
2912
+ V.set(0, getXAfterSnake(0, 0));
2913
+ var paths = new FastArrayNegativeIndices();
2914
+ paths.set(0, V.get(0) === 0 ? null : new SnakePath(null, 0, 0, V.get(0)));
2915
+ var k = 0;
2916
+ loop: while (true) {
2917
+ d++;
2918
+ if (!timeout.isValid()) {
2919
+ return DiffAlgorithmResult.trivialTimedOut(seqX, seqY);
2920
+ }
2921
+ var lowerBound = -Math.min(d, seqY.length + d % 2);
2922
+ var upperBound = Math.min(d, seqX.length + d % 2);
2923
+ for (k = lowerBound; k <= upperBound; k += 2) {
2924
+ var maxXofDLineTop = k === upperBound ? -1 : V.get(k + 1);
2925
+ var maxXofDLineLeft = k === lowerBound ? -1 : V.get(k - 1) + 1;
2926
+ var x = Math.min(Math.max(maxXofDLineTop, maxXofDLineLeft), seqX.length);
2927
+ var y = x - k;
2928
+ if (x > seqX.length || y > seqY.length) {
2929
+ continue;
2930
+ }
2931
+ var newMaxX = getXAfterSnake(x, y);
2932
+ V.set(k, newMaxX);
2933
+ var lastPath = x === maxXofDLineTop ? paths.get(k + 1) : paths.get(k - 1);
2934
+ paths.set(k, newMaxX !== x ? new SnakePath(lastPath, x, y, newMaxX - x) : lastPath);
2935
+ if (V.get(k) === seqX.length && V.get(k) - k === seqY.length) {
2936
+ break loop;
2937
+ }
2938
+ }
2939
+ }
2940
+ var path = paths.get(k);
2941
+ var result = [];
2942
+ var lastAligningPosS1 = seqX.length;
2943
+ var lastAligningPosS2 = seqY.length;
2944
+ while (true) {
2945
+ var endX = path ? path.x + path.length : 0;
2946
+ var endY = path ? path.y + path.length : 0;
2947
+ if (endX !== lastAligningPosS1 || endY !== lastAligningPosS2) {
2948
+ result.push(new SequenceDiff(new OffsetRange(endX, lastAligningPosS1), new OffsetRange(endY, lastAligningPosS2)));
2949
+ }
2950
+ if (!path) {
2951
+ break;
2952
+ }
2953
+ lastAligningPosS1 = path.x;
2954
+ lastAligningPosS2 = path.y;
2955
+ path = path.prev;
2956
+ }
2957
+ result.reverse();
2958
+ return new DiffAlgorithmResult(result, false);
2959
+ };
2960
+ return MyersDiffAlgorithm;
2961
+ }());
2962
+ var SnakePath = /** @class */ (function () {
2963
+ function SnakePath(prev, x, y, length) {
2964
+ this.prev = prev;
2965
+ this.x = x;
2966
+ this.y = y;
2967
+ this.length = length;
2968
+ }
2969
+ return SnakePath;
2970
+ }());
2971
+ var FastInt32Array = /** @class */ (function () {
2972
+ function FastInt32Array() {
2973
+ this.positiveArr = new Int32Array(10);
2974
+ this.negativeArr = new Int32Array(10);
2975
+ }
2976
+ FastInt32Array.prototype.get = function (idx) {
2977
+ if (idx < 0) {
2978
+ idx = -idx - 1;
2979
+ return this.negativeArr[idx];
2980
+ }
2981
+ else {
2982
+ return this.positiveArr[idx];
2983
+ }
2984
+ };
2985
+ FastInt32Array.prototype.set = function (idx, value) {
2986
+ if (idx < 0) {
2987
+ idx = -idx - 1;
2988
+ if (idx >= this.negativeArr.length) {
2989
+ var arr = this.negativeArr;
2990
+ this.negativeArr = new Int32Array(arr.length * 2);
2991
+ this.negativeArr.set(arr);
2992
+ }
2993
+ this.negativeArr[idx] = value;
2994
+ }
2995
+ else {
2996
+ if (idx >= this.positiveArr.length) {
2997
+ var arr = this.positiveArr;
2998
+ this.positiveArr = new Int32Array(arr.length * 2);
2999
+ this.positiveArr.set(arr);
3000
+ }
3001
+ this.positiveArr[idx] = value;
3002
+ }
3003
+ };
3004
+ return FastInt32Array;
3005
+ }());
3006
+ var FastArrayNegativeIndices = /** @class */ (function () {
3007
+ function FastArrayNegativeIndices() {
3008
+ this.positiveArr = [];
3009
+ this.negativeArr = [];
3010
+ }
3011
+ FastArrayNegativeIndices.prototype.get = function (idx) {
3012
+ if (idx < 0) {
3013
+ idx = -idx - 1;
3014
+ return this.negativeArr[idx];
3015
+ }
3016
+ else {
3017
+ return this.positiveArr[idx];
3018
+ }
3019
+ };
3020
+ FastArrayNegativeIndices.prototype.set = function (idx, value) {
3021
+ if (idx < 0) {
3022
+ idx = -idx - 1;
3023
+ this.negativeArr[idx] = value;
3024
+ }
3025
+ else {
3026
+ this.positiveArr[idx] = value;
3027
+ }
3028
+ };
3029
+ return FastArrayNegativeIndices;
3030
+ }());
3031
+ var SetMap = /** @class */ (function () {
3032
+ function SetMap() {
3033
+ this.map = /* @__PURE__ */ new Map();
3034
+ }
3035
+ SetMap.prototype.add = function (key, value) {
3036
+ var values = this.map.get(key);
3037
+ if (!values) {
3038
+ values = /* @__PURE__ */ new Set();
3039
+ this.map.set(key, values);
3040
+ }
3041
+ values.add(value);
3042
+ };
3043
+ SetMap.prototype.forEach = function (key, fn) {
3044
+ var values = this.map.get(key);
3045
+ if (!values) {
3046
+ return;
3047
+ }
3048
+ values.forEach(fn);
3049
+ };
3050
+ SetMap.prototype.get = function (key) {
3051
+ var values = this.map.get(key);
3052
+ if (!values) {
3053
+ return /* @__PURE__ */ new Set();
3054
+ }
3055
+ return values;
3056
+ };
3057
+ return SetMap;
3058
+ }());
3059
+ var LinesSliceCharSequence = /** @class */ (function () {
3060
+ function LinesSliceCharSequence(lines, range, considerWhitespaceChanges) {
3061
+ this.lines = lines;
3062
+ this.range = range;
3063
+ this.considerWhitespaceChanges = considerWhitespaceChanges;
3064
+ this.elements = [];
3065
+ this.firstElementOffsetByLineIdx = [];
3066
+ this.lineStartOffsets = [];
3067
+ this.trimmedWsLengthsByLineIdx = [];
3068
+ this.firstElementOffsetByLineIdx.push(0);
3069
+ for (var lineNumber = this.range.startLineNumber; lineNumber <= this.range.endLineNumber; lineNumber++) {
3070
+ var line = lines[lineNumber - 1];
3071
+ var lineStartOffset = 0;
3072
+ if (lineNumber === this.range.startLineNumber && this.range.startColumn > 1) {
3073
+ lineStartOffset = this.range.startColumn - 1;
3074
+ line = line.substring(lineStartOffset);
3075
+ }
3076
+ this.lineStartOffsets.push(lineStartOffset);
3077
+ var trimmedWsLength = 0;
3078
+ if (!considerWhitespaceChanges) {
3079
+ var trimmedStartLine = line.trimStart();
3080
+ trimmedWsLength = line.length - trimmedStartLine.length;
3081
+ line = trimmedStartLine.trimEnd();
3082
+ }
3083
+ this.trimmedWsLengthsByLineIdx.push(trimmedWsLength);
3084
+ var lineLength = lineNumber === this.range.endLineNumber ? Math.min(this.range.endColumn - 1 - lineStartOffset - trimmedWsLength, line.length) : line.length;
3085
+ for (var i = 0; i < lineLength; i++) {
3086
+ this.elements.push(line.charCodeAt(i));
3087
+ }
3088
+ if (lineNumber < this.range.endLineNumber) {
3089
+ this.elements.push("\n".charCodeAt(0));
3090
+ this.firstElementOffsetByLineIdx.push(this.elements.length);
3091
+ }
3092
+ }
3093
+ }
3094
+ LinesSliceCharSequence.prototype.toString = function () {
3095
+ return "Slice: \"".concat(this.text, "\"");
3096
+ };
3097
+ Object.defineProperty(LinesSliceCharSequence.prototype, "text", {
3098
+ get: function () {
3099
+ return this.getText(new OffsetRange(0, this.length));
3100
+ },
3101
+ enumerable: false,
3102
+ configurable: true
3103
+ });
3104
+ LinesSliceCharSequence.prototype.getText = function (range) {
3105
+ return this.elements.slice(range.start, range.endExclusive).map(function (e) { return String.fromCharCode(e); }).join("");
3106
+ };
3107
+ LinesSliceCharSequence.prototype.getElement = function (offset) {
3108
+ return this.elements[offset];
3109
+ };
3110
+ Object.defineProperty(LinesSliceCharSequence.prototype, "length", {
3111
+ get: function () {
3112
+ return this.elements.length;
3113
+ },
3114
+ enumerable: false,
3115
+ configurable: true
3116
+ });
3117
+ LinesSliceCharSequence.prototype.getBoundaryScore = function (length) {
3118
+ var prevCategory = getCategory(length > 0 ? this.elements[length - 1] : -1);
3119
+ var nextCategory = getCategory(length < this.elements.length ? this.elements[length] : -1);
3120
+ if (prevCategory === 7 /* LineBreakCR */ && nextCategory === 8 /* LineBreakLF */) {
3121
+ return 0;
3122
+ }
3123
+ if (prevCategory === 8 /* LineBreakLF */) {
3124
+ return 150;
3125
+ }
3126
+ var score2 = 0;
3127
+ if (prevCategory !== nextCategory) {
3128
+ score2 += 10;
3129
+ if (prevCategory === 0 /* WordLower */ && nextCategory === 1 /* WordUpper */) {
3130
+ score2 += 1;
3131
+ }
3132
+ }
3133
+ score2 += getCategoryBoundaryScore(prevCategory);
3134
+ score2 += getCategoryBoundaryScore(nextCategory);
3135
+ return score2;
3136
+ };
3137
+ LinesSliceCharSequence.prototype.translateOffset = function (offset, preference) {
3138
+ if (preference === void 0) { preference = "right"; }
3139
+ var i = findLastIdxMonotonous(this.firstElementOffsetByLineIdx, function (value) { return value <= offset; });
3140
+ var lineOffset = offset - this.firstElementOffsetByLineIdx[i];
3141
+ return new Position(this.range.startLineNumber + i, 1 + this.lineStartOffsets[i] + lineOffset + (lineOffset === 0 && preference === "left" ? 0 : this.trimmedWsLengthsByLineIdx[i]));
3142
+ };
3143
+ LinesSliceCharSequence.prototype.translateRange = function (range) {
3144
+ var pos1 = this.translateOffset(range.start, "right");
3145
+ var pos2 = this.translateOffset(range.endExclusive, "left");
3146
+ if (pos2.isBefore(pos1)) {
3147
+ return Range.fromPositions(pos2, pos2);
3148
+ }
3149
+ return Range.fromPositions(pos1, pos2);
3150
+ };
3151
+ LinesSliceCharSequence.prototype.findWordContaining = function (offset) {
3152
+ if (offset < 0 || offset >= this.elements.length) {
3153
+ return undefined;
3154
+ }
3155
+ if (!isWordChar(this.elements[offset])) {
3156
+ return undefined;
3157
+ }
3158
+ var start = offset;
3159
+ while (start > 0 && isWordChar(this.elements[start - 1])) {
3160
+ start--;
3161
+ }
3162
+ var end = offset;
3163
+ while (end < this.elements.length && isWordChar(this.elements[end])) {
3164
+ end++;
3165
+ }
3166
+ return new OffsetRange(start, end);
3167
+ };
3168
+ LinesSliceCharSequence.prototype.findSubWordContaining = function (offset) {
3169
+ if (offset < 0 || offset >= this.elements.length) {
3170
+ return undefined;
3171
+ }
3172
+ if (!isWordChar(this.elements[offset])) {
3173
+ return undefined;
3174
+ }
3175
+ var start = offset;
3176
+ while (start > 0 && isWordChar(this.elements[start - 1]) && !isUpperCase(this.elements[start])) {
3177
+ start--;
3178
+ }
3179
+ var end = offset;
3180
+ while (end < this.elements.length && isWordChar(this.elements[end]) && !isUpperCase(this.elements[end])) {
3181
+ end++;
3182
+ }
3183
+ return new OffsetRange(start, end);
3184
+ };
3185
+ LinesSliceCharSequence.prototype.countLinesIn = function (range) {
3186
+ return this.translateOffset(range.endExclusive).lineNumber - this.translateOffset(range.start).lineNumber;
3187
+ };
3188
+ LinesSliceCharSequence.prototype.isStronglyEqual = function (offset1, offset2) {
3189
+ return this.elements[offset1] === this.elements[offset2];
3190
+ };
3191
+ LinesSliceCharSequence.prototype.extendToFullLines = function (range) {
3192
+ var _a, _g;
3193
+ var start = (_a = findLastMonotonous(this.firstElementOffsetByLineIdx, function (x) { return x <= range.start; })) !== null && _a !== void 0 ? _a : 0;
3194
+ var end = (_g = findFirstMonotonous(this.firstElementOffsetByLineIdx, function (x) { return range.endExclusive <= x; })) !== null && _g !== void 0 ? _g : this.elements.length;
3195
+ return new OffsetRange(start, end);
3196
+ };
3197
+ return LinesSliceCharSequence;
3198
+ }());
3199
+ function isWordChar(charCode) {
3200
+ return charCode >= 97 && charCode <= 122 || charCode >= 65 && charCode <= 90 || charCode >= 48 && charCode <= 57;
3201
+ }
3202
+ function isUpperCase(charCode) {
3203
+ return charCode >= 65 && charCode <= 90;
3204
+ }
3205
+ var score = (_a = {},
3206
+ _a[0 /* WordLower */] = 0,
3207
+ _a[1 /* WordUpper */] = 0,
3208
+ _a[2 /* WordNumber */] = 0,
3209
+ _a[3 /* End */] = 10,
3210
+ _a[4 /* Other */] = 2,
3211
+ _a[5 /* Separator */] = 30,
3212
+ _a[6 /* Space */] = 3,
3213
+ _a[7 /* LineBreakCR */] = 10,
3214
+ _a[8 /* LineBreakLF */] = 10,
3215
+ _a);
3216
+ function getCategoryBoundaryScore(category) {
3217
+ return score[category];
3218
+ }
3219
+ function getCategory(charCode) {
3220
+ if (charCode === 10) {
3221
+ return 8 /* LineBreakLF */;
3222
+ }
3223
+ else if (charCode === 13) {
3224
+ return 7 /* LineBreakCR */;
3225
+ }
3226
+ else if (isSpace(charCode)) {
3227
+ return 6 /* Space */;
3228
+ }
3229
+ else if (charCode >= 97 && charCode <= 122) {
3230
+ return 0 /* WordLower */;
3231
+ }
3232
+ else if (charCode >= 65 && charCode <= 90) {
3233
+ return 1 /* WordUpper */;
3234
+ }
3235
+ else if (charCode >= 48 && charCode <= 57) {
3236
+ return 2 /* WordNumber */;
3237
+ }
3238
+ else if (charCode === -1) {
3239
+ return 3 /* End */;
3240
+ }
3241
+ else if (charCode === 44 || charCode === 59) {
3242
+ return 5 /* Separator */;
3243
+ }
3244
+ else {
3245
+ return 4 /* Other */;
3246
+ }
3247
+ }
3248
+ function computeMovedLines(changes, originalLines, modifiedLines, hashedOriginalLines, hashedModifiedLines, timeout) {
3249
+ var _a = computeMovesFromSimpleDeletionsToSimpleInsertions(changes, originalLines, modifiedLines, timeout), moves = _a.moves, excludedChanges = _a.excludedChanges;
3250
+ if (!timeout.isValid()) {
3251
+ return [];
3252
+ }
3253
+ var filteredChanges = changes.filter(function (c) { return !excludedChanges.has(c); });
3254
+ var unchangedMoves = computeUnchangedMoves(filteredChanges, hashedOriginalLines, hashedModifiedLines, originalLines, modifiedLines, timeout);
3255
+ pushMany(moves, unchangedMoves);
3256
+ moves = joinCloseConsecutiveMoves(moves);
3257
+ moves = moves.filter(function (current) {
3258
+ var lines = current.original.toOffsetRange().slice(originalLines).map(function (l) { return l.trim(); });
3259
+ var originalText = lines.join("\n");
3260
+ return originalText.length >= 15 && countWhere(lines, function (l) { return l.length >= 2; }) >= 2;
3261
+ });
3262
+ moves = removeMovesInSameDiff(changes, moves);
3263
+ return moves;
3264
+ }
3265
+ function countWhere(arr, predicate) {
3266
+ var e_6, _a;
3267
+ var count = 0;
3268
+ try {
3269
+ for (var arr_1 = __values(arr), arr_1_1 = arr_1.next(); !arr_1_1.done; arr_1_1 = arr_1.next()) {
3270
+ var t = arr_1_1.value;
3271
+ if (predicate(t)) {
3272
+ count++;
3273
+ }
3274
+ }
3275
+ }
3276
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
3277
+ finally {
3278
+ try {
3279
+ if (arr_1_1 && !arr_1_1.done && (_a = arr_1.return)) _a.call(arr_1);
3280
+ }
3281
+ finally { if (e_6) throw e_6.error; }
3282
+ }
3283
+ return count;
3284
+ }
3285
+ function computeMovesFromSimpleDeletionsToSimpleInsertions(changes, originalLines, modifiedLines, timeout) {
3286
+ var e_7, _a, e_8, _g;
3287
+ var moves = [];
3288
+ var deletions = changes.filter(function (c) { return c.modified.isEmpty && c.original.length >= 3; }).map(function (d) { return new LineRangeFragment(d.original, originalLines, d); });
3289
+ var insertions = new Set(changes.filter(function (c) { return c.original.isEmpty && c.modified.length >= 3; }).map(function (d) { return new LineRangeFragment(d.modified, modifiedLines, d); }));
3290
+ var excludedChanges = /* @__PURE__ */ new Set();
3291
+ try {
3292
+ for (var deletions_1 = __values(deletions), deletions_1_1 = deletions_1.next(); !deletions_1_1.done; deletions_1_1 = deletions_1.next()) {
3293
+ var deletion = deletions_1_1.value;
3294
+ var highestSimilarity = -1;
3295
+ var best = void 0;
3296
+ try {
3297
+ for (var insertions_1 = (e_8 = void 0, __values(insertions)), insertions_1_1 = insertions_1.next(); !insertions_1_1.done; insertions_1_1 = insertions_1.next()) {
3298
+ var insertion = insertions_1_1.value;
3299
+ var similarity = deletion.computeSimilarity(insertion);
3300
+ if (similarity > highestSimilarity) {
3301
+ highestSimilarity = similarity;
3302
+ best = insertion;
3303
+ }
3304
+ }
3305
+ }
3306
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
3307
+ finally {
3308
+ try {
3309
+ if (insertions_1_1 && !insertions_1_1.done && (_g = insertions_1.return)) _g.call(insertions_1);
3310
+ }
3311
+ finally { if (e_8) throw e_8.error; }
3312
+ }
3313
+ if (highestSimilarity > 0.9 && best) {
3314
+ insertions.delete(best);
3315
+ moves.push(new LineRangeMapping(deletion.range, best.range));
3316
+ excludedChanges.add(deletion.source);
3317
+ excludedChanges.add(best.source);
3318
+ }
3319
+ if (!timeout.isValid()) {
3320
+ return { moves: moves, excludedChanges: excludedChanges };
3321
+ }
3322
+ }
3323
+ }
3324
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
3325
+ finally {
3326
+ try {
3327
+ if (deletions_1_1 && !deletions_1_1.done && (_a = deletions_1.return)) _a.call(deletions_1);
3328
+ }
3329
+ finally { if (e_7) throw e_7.error; }
3330
+ }
3331
+ return { moves: moves, excludedChanges: excludedChanges };
3332
+ }
3333
+ function computeUnchangedMoves(changes, hashedOriginalLines, hashedModifiedLines, originalLines, modifiedLines, timeout) {
3334
+ var e_9, _a, e_10, _g, e_11, _h, e_12, _j;
3335
+ var moves = [];
3336
+ var original3LineHashes = new SetMap();
3337
+ try {
3338
+ for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
3339
+ var change = changes_1_1.value;
3340
+ for (var i = change.original.startLineNumber; i < change.original.endLineNumberExclusive - 2; i++) {
3341
+ var key = "".concat(hashedOriginalLines[i - 1], ":").concat(hashedOriginalLines[i + 1 - 1], ":").concat(hashedOriginalLines[i + 2 - 1]);
3342
+ original3LineHashes.add(key, { range: new LineRange(i, i + 3) });
3343
+ }
3344
+ }
3345
+ }
3346
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
3347
+ finally {
3348
+ try {
3349
+ if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
3350
+ }
3351
+ finally { if (e_9) throw e_9.error; }
3352
+ }
3353
+ var possibleMappings = [];
3354
+ changes.sort(compareBy(function (c) { return c.modified.startLineNumber; }, numberComparator));
3355
+ var _loop_1 = function (change) {
3356
+ var lastMappings = [];
3357
+ var _loop_3 = function (i) {
3358
+ var key = "".concat(hashedModifiedLines[i - 1], ":").concat(hashedModifiedLines[i + 1 - 1], ":").concat(hashedModifiedLines[i + 2 - 1]);
3359
+ var currentModifiedRange = new LineRange(i, i + 3);
3360
+ var nextMappings = [];
3361
+ original3LineHashes.forEach(key, function (_a) {
3362
+ var e_13, _g;
3363
+ var range = _a.range;
3364
+ try {
3365
+ for (var lastMappings_1 = (e_13 = void 0, __values(lastMappings)), lastMappings_1_1 = lastMappings_1.next(); !lastMappings_1_1.done; lastMappings_1_1 = lastMappings_1.next()) {
3366
+ var lastMapping = lastMappings_1_1.value;
3367
+ if (lastMapping.originalLineRange.endLineNumberExclusive + 1 === range.endLineNumberExclusive && lastMapping.modifiedLineRange.endLineNumberExclusive + 1 === currentModifiedRange.endLineNumberExclusive) {
3368
+ lastMapping.originalLineRange = new LineRange(lastMapping.originalLineRange.startLineNumber, range.endLineNumberExclusive);
3369
+ lastMapping.modifiedLineRange = new LineRange(lastMapping.modifiedLineRange.startLineNumber, currentModifiedRange.endLineNumberExclusive);
3370
+ nextMappings.push(lastMapping);
3371
+ return;
3372
+ }
3373
+ }
3374
+ }
3375
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
3376
+ finally {
3377
+ try {
3378
+ if (lastMappings_1_1 && !lastMappings_1_1.done && (_g = lastMappings_1.return)) _g.call(lastMappings_1);
3379
+ }
3380
+ finally { if (e_13) throw e_13.error; }
3381
+ }
3382
+ var mapping = {
3383
+ modifiedLineRange: currentModifiedRange,
3384
+ originalLineRange: range
3385
+ };
3386
+ possibleMappings.push(mapping);
3387
+ nextMappings.push(mapping);
3388
+ });
3389
+ lastMappings = nextMappings;
3390
+ };
3391
+ for (var i = change.modified.startLineNumber; i < change.modified.endLineNumberExclusive - 2; i++) {
3392
+ _loop_3(i);
3393
+ }
3394
+ if (!timeout.isValid()) {
3395
+ return { value: [] };
3396
+ }
3397
+ };
3398
+ try {
3399
+ for (var changes_2 = __values(changes), changes_2_1 = changes_2.next(); !changes_2_1.done; changes_2_1 = changes_2.next()) {
3400
+ var change = changes_2_1.value;
3401
+ var state_1 = _loop_1(change);
3402
+ if (typeof state_1 === "object")
3403
+ return state_1.value;
3404
+ }
3405
+ }
3406
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
3407
+ finally {
3408
+ try {
3409
+ if (changes_2_1 && !changes_2_1.done && (_g = changes_2.return)) _g.call(changes_2);
3410
+ }
3411
+ finally { if (e_10) throw e_10.error; }
3412
+ }
3413
+ possibleMappings.sort(reverseOrder(compareBy(function (m) { return m.modifiedLineRange.length; }, numberComparator)));
3414
+ var modifiedSet = new LineRangeSet();
3415
+ var originalSet = new LineRangeSet();
3416
+ try {
3417
+ for (var possibleMappings_1 = __values(possibleMappings), possibleMappings_1_1 = possibleMappings_1.next(); !possibleMappings_1_1.done; possibleMappings_1_1 = possibleMappings_1.next()) {
3418
+ var mapping = possibleMappings_1_1.value;
3419
+ var diffOrigToMod = mapping.modifiedLineRange.startLineNumber - mapping.originalLineRange.startLineNumber;
3420
+ var modifiedSections = modifiedSet.subtractFrom(mapping.modifiedLineRange);
3421
+ var originalTranslatedSections = originalSet.subtractFrom(mapping.originalLineRange).getWithDelta(diffOrigToMod);
3422
+ var modifiedIntersectedSections = modifiedSections.getIntersection(originalTranslatedSections);
3423
+ try {
3424
+ for (var _k = (e_12 = void 0, __values(modifiedIntersectedSections.ranges)), _l = _k.next(); !_l.done; _l = _k.next()) {
3425
+ var s = _l.value;
3426
+ if (s.length < 3) {
3427
+ continue;
3428
+ }
3429
+ var modifiedLineRange = s;
3430
+ var originalLineRange = s.delta(-diffOrigToMod);
3431
+ moves.push(new LineRangeMapping(originalLineRange, modifiedLineRange));
3432
+ modifiedSet.addRange(modifiedLineRange);
3433
+ originalSet.addRange(originalLineRange);
3434
+ }
3435
+ }
3436
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
3437
+ finally {
3438
+ try {
3439
+ if (_l && !_l.done && (_j = _k.return)) _j.call(_k);
3440
+ }
3441
+ finally { if (e_12) throw e_12.error; }
3442
+ }
3443
+ }
3444
+ }
3445
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
3446
+ finally {
3447
+ try {
3448
+ if (possibleMappings_1_1 && !possibleMappings_1_1.done && (_h = possibleMappings_1.return)) _h.call(possibleMappings_1);
3449
+ }
3450
+ finally { if (e_11) throw e_11.error; }
3451
+ }
3452
+ moves.sort(compareBy(function (m) { return m.original.startLineNumber; }, numberComparator));
3453
+ var monotonousChanges = new MonotonousArray(changes);
3454
+ var _loop_2 = function (i) {
3455
+ var move = moves[i];
3456
+ var firstTouchingChangeOrig = monotonousChanges.findLastMonotonous(function (c) { return c.original.startLineNumber <= move.original.startLineNumber; });
3457
+ var firstTouchingChangeMod = findLastMonotonous(changes, function (c) { return c.modified.startLineNumber <= move.modified.startLineNumber; });
3458
+ var linesAbove = Math.max(move.original.startLineNumber - firstTouchingChangeOrig.original.startLineNumber, move.modified.startLineNumber - firstTouchingChangeMod.modified.startLineNumber);
3459
+ var lastTouchingChangeOrig = monotonousChanges.findLastMonotonous(function (c) { return c.original.startLineNumber < move.original.endLineNumberExclusive; });
3460
+ var lastTouchingChangeMod = findLastMonotonous(changes, function (c) { return c.modified.startLineNumber < move.modified.endLineNumberExclusive; });
3461
+ var linesBelow = Math.max(lastTouchingChangeOrig.original.endLineNumberExclusive - move.original.endLineNumberExclusive, lastTouchingChangeMod.modified.endLineNumberExclusive - move.modified.endLineNumberExclusive);
3462
+ var extendToTop = void 0;
3463
+ for (extendToTop = 0; extendToTop < linesAbove; extendToTop++) {
3464
+ var origLine = move.original.startLineNumber - extendToTop - 1;
3465
+ var modLine = move.modified.startLineNumber - extendToTop - 1;
3466
+ if (origLine > originalLines.length || modLine > modifiedLines.length) {
3467
+ break;
3468
+ }
3469
+ if (modifiedSet.contains(modLine) || originalSet.contains(origLine)) {
3470
+ break;
3471
+ }
3472
+ if (!areLinesSimilar(originalLines[origLine - 1], modifiedLines[modLine - 1], timeout)) {
3473
+ break;
3474
+ }
3475
+ }
3476
+ if (extendToTop > 0) {
3477
+ originalSet.addRange(new LineRange(move.original.startLineNumber - extendToTop, move.original.startLineNumber));
3478
+ modifiedSet.addRange(new LineRange(move.modified.startLineNumber - extendToTop, move.modified.startLineNumber));
3479
+ }
3480
+ var extendToBottom = void 0;
3481
+ for (extendToBottom = 0; extendToBottom < linesBelow; extendToBottom++) {
3482
+ var origLine = move.original.endLineNumberExclusive + extendToBottom;
3483
+ var modLine = move.modified.endLineNumberExclusive + extendToBottom;
3484
+ if (origLine > originalLines.length || modLine > modifiedLines.length) {
3485
+ break;
3486
+ }
3487
+ if (modifiedSet.contains(modLine) || originalSet.contains(origLine)) {
3488
+ break;
3489
+ }
3490
+ if (!areLinesSimilar(originalLines[origLine - 1], modifiedLines[modLine - 1], timeout)) {
3491
+ break;
3492
+ }
3493
+ }
3494
+ if (extendToBottom > 0) {
3495
+ originalSet.addRange(new LineRange(move.original.endLineNumberExclusive, move.original.endLineNumberExclusive + extendToBottom));
3496
+ modifiedSet.addRange(new LineRange(move.modified.endLineNumberExclusive, move.modified.endLineNumberExclusive + extendToBottom));
3497
+ }
3498
+ if (extendToTop > 0 || extendToBottom > 0) {
3499
+ moves[i] = new LineRangeMapping(new LineRange(move.original.startLineNumber - extendToTop, move.original.endLineNumberExclusive + extendToBottom), new LineRange(move.modified.startLineNumber - extendToTop, move.modified.endLineNumberExclusive + extendToBottom));
3500
+ }
3501
+ };
3502
+ for (var i = 0; i < moves.length; i++) {
3503
+ _loop_2(i);
3504
+ }
3505
+ return moves;
3506
+ }
3507
+ function areLinesSimilar(line1, line2, timeout) {
3508
+ var e_14, _a;
3509
+ if (line1.trim() === line2.trim()) {
3510
+ return true;
3511
+ }
3512
+ if (line1.length > 300 && line2.length > 300) {
3513
+ return false;
3514
+ }
3515
+ var myersDiffingAlgorithm = new MyersDiffAlgorithm();
3516
+ var result = myersDiffingAlgorithm.compute(new LinesSliceCharSequence([line1], new Range(1, 1, 1, line1.length), false), new LinesSliceCharSequence([line2], new Range(1, 1, 1, line2.length), false), timeout);
3517
+ var commonNonSpaceCharCount = 0;
3518
+ var inverted = SequenceDiff.invert(result.diffs, line1.length);
3519
+ try {
3520
+ for (var inverted_1 = __values(inverted), inverted_1_1 = inverted_1.next(); !inverted_1_1.done; inverted_1_1 = inverted_1.next()) {
3521
+ var seq = inverted_1_1.value;
3522
+ seq.seq1Range.forEach(function (idx) {
3523
+ if (!isSpace(line1.charCodeAt(idx))) {
3524
+ commonNonSpaceCharCount++;
3525
+ }
3526
+ });
3527
+ }
3528
+ }
3529
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
3530
+ finally {
3531
+ try {
3532
+ if (inverted_1_1 && !inverted_1_1.done && (_a = inverted_1.return)) _a.call(inverted_1);
3533
+ }
3534
+ finally { if (e_14) throw e_14.error; }
3535
+ }
3536
+ function countNonWsChars(str) {
3537
+ var count = 0;
3538
+ for (var i = 0; i < line1.length; i++) {
3539
+ if (!isSpace(str.charCodeAt(i))) {
3540
+ count++;
3541
+ }
3542
+ }
3543
+ return count;
3544
+ }
3545
+ var longerLineLength = countNonWsChars(line1.length > line2.length ? line1 : line2);
3546
+ var r = commonNonSpaceCharCount / longerLineLength > 0.6 && longerLineLength > 10;
3547
+ return r;
3548
+ }
3549
+ function joinCloseConsecutiveMoves(moves) {
3550
+ if (moves.length === 0) {
3551
+ return moves;
3552
+ }
3553
+ moves.sort(compareBy(function (m) { return m.original.startLineNumber; }, numberComparator));
3554
+ var result = [moves[0]];
3555
+ for (var i = 1; i < moves.length; i++) {
3556
+ var last = result[result.length - 1];
3557
+ var current = moves[i];
3558
+ var originalDist = current.original.startLineNumber - last.original.endLineNumberExclusive;
3559
+ var modifiedDist = current.modified.startLineNumber - last.modified.endLineNumberExclusive;
3560
+ var currentMoveAfterLast = originalDist >= 0 && modifiedDist >= 0;
3561
+ if (currentMoveAfterLast && originalDist + modifiedDist <= 2) {
3562
+ result[result.length - 1] = last.join(current);
3563
+ continue;
3564
+ }
3565
+ result.push(current);
3566
+ }
3567
+ return result;
3568
+ }
3569
+ function removeMovesInSameDiff(changes, moves) {
3570
+ var changesMonotonous = new MonotonousArray(changes);
3571
+ moves = moves.filter(function (m) {
3572
+ var diffBeforeEndOfMoveOriginal = changesMonotonous.findLastMonotonous(function (c) { return c.original.startLineNumber < m.original.endLineNumberExclusive; }) || new LineRangeMapping(new LineRange(1, 1), new LineRange(1, 1));
3573
+ var diffBeforeEndOfMoveModified = findLastMonotonous(changes, function (c) { return c.modified.startLineNumber < m.modified.endLineNumberExclusive; });
3574
+ var differentDiffs = diffBeforeEndOfMoveOriginal !== diffBeforeEndOfMoveModified;
3575
+ return differentDiffs;
3576
+ });
3577
+ return moves;
3578
+ }
3579
+ function optimizeSequenceDiffs(sequence1, sequence2, sequenceDiffs) {
3580
+ var result = sequenceDiffs;
3581
+ result = joinSequenceDiffsByShifting(sequence1, sequence2, result);
3582
+ result = joinSequenceDiffsByShifting(sequence1, sequence2, result);
3583
+ result = shiftSequenceDiffs(sequence1, sequence2, result);
3584
+ return result;
3585
+ }
3586
+ function joinSequenceDiffsByShifting(sequence1, sequence2, sequenceDiffs) {
3587
+ if (sequenceDiffs.length === 0) {
3588
+ return sequenceDiffs;
3589
+ }
3590
+ var result = [];
3591
+ result.push(sequenceDiffs[0]);
3592
+ for (var i = 1; i < sequenceDiffs.length; i++) {
3593
+ var prevResult = result[result.length - 1];
3594
+ var cur = sequenceDiffs[i];
3595
+ if (cur.seq1Range.isEmpty || cur.seq2Range.isEmpty) {
3596
+ var length = cur.seq1Range.start - prevResult.seq1Range.endExclusive;
3597
+ var d = void 0;
3598
+ for (d = 1; d <= length; d++) {
3599
+ if (sequence1.getElement(cur.seq1Range.start - d) !== sequence1.getElement(cur.seq1Range.endExclusive - d) || sequence2.getElement(cur.seq2Range.start - d) !== sequence2.getElement(cur.seq2Range.endExclusive - d)) {
3600
+ break;
3601
+ }
3602
+ }
3603
+ d--;
3604
+ if (d === length) {
3605
+ result[result.length - 1] = new SequenceDiff(new OffsetRange(prevResult.seq1Range.start, cur.seq1Range.endExclusive - length), new OffsetRange(prevResult.seq2Range.start, cur.seq2Range.endExclusive - length));
3606
+ continue;
3607
+ }
3608
+ cur = cur.delta(-d);
3609
+ }
3610
+ result.push(cur);
3611
+ }
3612
+ var result2 = [];
3613
+ for (var i = 0; i < result.length - 1; i++) {
3614
+ var nextResult = result[i + 1];
3615
+ var cur = result[i];
3616
+ if (cur.seq1Range.isEmpty || cur.seq2Range.isEmpty) {
3617
+ var length = nextResult.seq1Range.start - cur.seq1Range.endExclusive;
3618
+ var d = void 0;
3619
+ for (d = 0; d < length; d++) {
3620
+ if (!sequence1.isStronglyEqual(cur.seq1Range.start + d, cur.seq1Range.endExclusive + d) || !sequence2.isStronglyEqual(cur.seq2Range.start + d, cur.seq2Range.endExclusive + d)) {
3621
+ break;
3622
+ }
3623
+ }
3624
+ if (d === length) {
3625
+ result[i + 1] = new SequenceDiff(new OffsetRange(cur.seq1Range.start + length, nextResult.seq1Range.endExclusive), new OffsetRange(cur.seq2Range.start + length, nextResult.seq2Range.endExclusive));
3626
+ continue;
3627
+ }
3628
+ if (d > 0) {
3629
+ cur = cur.delta(d);
3630
+ }
3631
+ }
3632
+ result2.push(cur);
3633
+ }
3634
+ if (result.length > 0) {
3635
+ result2.push(result[result.length - 1]);
3636
+ }
3637
+ return result2;
3638
+ }
3639
+ function shiftSequenceDiffs(sequence1, sequence2, sequenceDiffs) {
3640
+ if (!sequence1.getBoundaryScore || !sequence2.getBoundaryScore) {
3641
+ return sequenceDiffs;
3642
+ }
3643
+ for (var i = 0; i < sequenceDiffs.length; i++) {
3644
+ var prevDiff = i > 0 ? sequenceDiffs[i - 1] : undefined;
3645
+ var diff = sequenceDiffs[i];
3646
+ var nextDiff = i + 1 < sequenceDiffs.length ? sequenceDiffs[i + 1] : undefined;
3647
+ var seq1ValidRange = new OffsetRange(prevDiff ? prevDiff.seq1Range.endExclusive + 1 : 0, nextDiff ? nextDiff.seq1Range.start - 1 : sequence1.length);
3648
+ var seq2ValidRange = new OffsetRange(prevDiff ? prevDiff.seq2Range.endExclusive + 1 : 0, nextDiff ? nextDiff.seq2Range.start - 1 : sequence2.length);
3649
+ if (diff.seq1Range.isEmpty) {
3650
+ sequenceDiffs[i] = shiftDiffToBetterPosition(diff, sequence1, sequence2, seq1ValidRange, seq2ValidRange);
3651
+ }
3652
+ else if (diff.seq2Range.isEmpty) {
3653
+ sequenceDiffs[i] = shiftDiffToBetterPosition(diff.swap(), sequence2, sequence1, seq2ValidRange, seq1ValidRange).swap();
3654
+ }
3655
+ }
3656
+ return sequenceDiffs;
3657
+ }
3658
+ function shiftDiffToBetterPosition(diff, sequence1, sequence2, seq1ValidRange, seq2ValidRange) {
3659
+ var maxShiftLimit = 100;
3660
+ var deltaBefore = 1;
3661
+ while (diff.seq1Range.start - deltaBefore >= seq1ValidRange.start && diff.seq2Range.start - deltaBefore >= seq2ValidRange.start && sequence2.isStronglyEqual(diff.seq2Range.start - deltaBefore, diff.seq2Range.endExclusive - deltaBefore) && deltaBefore < maxShiftLimit) {
3662
+ deltaBefore++;
3663
+ }
3664
+ deltaBefore--;
3665
+ var deltaAfter = 0;
3666
+ while (diff.seq1Range.start + deltaAfter < seq1ValidRange.endExclusive && diff.seq2Range.endExclusive + deltaAfter < seq2ValidRange.endExclusive && sequence2.isStronglyEqual(diff.seq2Range.start + deltaAfter, diff.seq2Range.endExclusive + deltaAfter) && deltaAfter < maxShiftLimit) {
3667
+ deltaAfter++;
3668
+ }
3669
+ if (deltaBefore === 0 && deltaAfter === 0) {
3670
+ return diff;
3671
+ }
3672
+ var bestDelta = 0;
3673
+ var bestScore = -1;
3674
+ for (var delta = -deltaBefore; delta <= deltaAfter; delta++) {
3675
+ var seq2OffsetStart = diff.seq2Range.start + delta;
3676
+ var seq2OffsetEndExclusive = diff.seq2Range.endExclusive + delta;
3677
+ var seq1Offset = diff.seq1Range.start + delta;
3678
+ var score_1 = sequence1.getBoundaryScore(seq1Offset) + sequence2.getBoundaryScore(seq2OffsetStart) + sequence2.getBoundaryScore(seq2OffsetEndExclusive);
3679
+ if (score_1 > bestScore) {
3680
+ bestScore = score_1;
3681
+ bestDelta = delta;
3682
+ }
3683
+ }
3684
+ return diff.delta(bestDelta);
3685
+ }
3686
+ function removeShortMatches(sequence1, sequence2, sequenceDiffs) {
3687
+ var e_15, _a;
3688
+ var result = [];
3689
+ try {
3690
+ for (var sequenceDiffs_2 = __values(sequenceDiffs), sequenceDiffs_2_1 = sequenceDiffs_2.next(); !sequenceDiffs_2_1.done; sequenceDiffs_2_1 = sequenceDiffs_2.next()) {
3691
+ var s = sequenceDiffs_2_1.value;
3692
+ var last = result[result.length - 1];
3693
+ if (!last) {
3694
+ result.push(s);
3695
+ continue;
3696
+ }
3697
+ if (s.seq1Range.start - last.seq1Range.endExclusive <= 2 || s.seq2Range.start - last.seq2Range.endExclusive <= 2) {
3698
+ result[result.length - 1] = new SequenceDiff(last.seq1Range.join(s.seq1Range), last.seq2Range.join(s.seq2Range));
3699
+ }
3700
+ else {
3701
+ result.push(s);
3702
+ }
3703
+ }
3704
+ }
3705
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
3706
+ finally {
3707
+ try {
3708
+ if (sequenceDiffs_2_1 && !sequenceDiffs_2_1.done && (_a = sequenceDiffs_2.return)) _a.call(sequenceDiffs_2);
3709
+ }
3710
+ finally { if (e_15) throw e_15.error; }
3711
+ }
3712
+ return result;
3713
+ }
3714
+ function extendDiffsToEntireWordIfAppropriate(sequence1, sequence2, sequenceDiffs, findParent, force) {
3715
+ if (force === void 0) { force = false; }
3716
+ var equalMappings = SequenceDiff.invert(sequenceDiffs, sequence1.length);
3717
+ var additional = [];
3718
+ var lastPoint = new OffsetPair(0, 0);
3719
+ function scanWord(pair, equalMapping) {
3720
+ if (pair.offset1 < lastPoint.offset1 || pair.offset2 < lastPoint.offset2) {
3721
+ return;
3722
+ }
3723
+ var w1 = findParent(sequence1, pair.offset1);
3724
+ var w2 = findParent(sequence2, pair.offset2);
3725
+ if (!w1 || !w2) {
3726
+ return;
3727
+ }
3728
+ var w = new SequenceDiff(w1, w2);
3729
+ var equalPart = w.intersect(equalMapping);
3730
+ var equalChars1 = equalPart.seq1Range.length;
3731
+ var equalChars2 = equalPart.seq2Range.length;
3732
+ while (equalMappings.length > 0) {
3733
+ var next = equalMappings[0];
3734
+ var intersects = next.seq1Range.intersects(w.seq1Range) || next.seq2Range.intersects(w.seq2Range);
3735
+ if (!intersects) {
3736
+ break;
3737
+ }
3738
+ var v1 = findParent(sequence1, next.seq1Range.start);
3739
+ var v2 = findParent(sequence2, next.seq2Range.start);
3740
+ var v = new SequenceDiff(v1, v2);
3741
+ var equalPart2 = v.intersect(next);
3742
+ equalChars1 += equalPart2.seq1Range.length;
3743
+ equalChars2 += equalPart2.seq2Range.length;
3744
+ w = w.join(v);
3745
+ if (w.seq1Range.endExclusive >= next.seq1Range.endExclusive) {
3746
+ equalMappings.shift();
3747
+ }
3748
+ else {
3749
+ break;
3750
+ }
3751
+ }
3752
+ if (force && equalChars1 + equalChars2 < w.seq1Range.length + w.seq2Range.length || equalChars1 + equalChars2 < (w.seq1Range.length + w.seq2Range.length) * 2 / 3) {
3753
+ additional.push(w);
3754
+ }
3755
+ lastPoint = w.getEndExclusives();
3756
+ }
3757
+ while (equalMappings.length > 0) {
3758
+ var next = equalMappings.shift();
3759
+ if (next.seq1Range.isEmpty) {
3760
+ continue;
3761
+ }
3762
+ scanWord(next.getStarts(), next);
3763
+ scanWord(next.getEndExclusives().delta(-1), next);
3764
+ }
3765
+ var merged = mergeSequenceDiffs(sequenceDiffs, additional);
3766
+ return merged;
3767
+ }
3768
+ function mergeSequenceDiffs(sequenceDiffs1, sequenceDiffs2) {
3769
+ var result = [];
3770
+ while (sequenceDiffs1.length > 0 || sequenceDiffs2.length > 0) {
3771
+ var sd1 = sequenceDiffs1[0];
3772
+ var sd2 = sequenceDiffs2[0];
3773
+ var next = void 0;
3774
+ if (sd1 && (!sd2 || sd1.seq1Range.start < sd2.seq1Range.start)) {
3775
+ next = sequenceDiffs1.shift();
3776
+ }
3777
+ else {
3778
+ next = sequenceDiffs2.shift();
3779
+ }
3780
+ if (result.length > 0 && result[result.length - 1].seq1Range.endExclusive >= next.seq1Range.start) {
3781
+ result[result.length - 1] = result[result.length - 1].join(next);
3782
+ }
3783
+ else {
3784
+ result.push(next);
3785
+ }
3786
+ }
3787
+ return result;
3788
+ }
3789
+ function removeVeryShortMatchingLinesBetweenDiffs(sequence1, _sequence2, sequenceDiffs) {
3790
+ var diffs = sequenceDiffs;
3791
+ if (diffs.length === 0) {
3792
+ return diffs;
3793
+ }
3794
+ var counter = 0;
3795
+ var shouldRepeat;
3796
+ do {
3797
+ shouldRepeat = false;
3798
+ var result = [
3799
+ diffs[0]
3800
+ ];
3801
+ var _loop_4 = function (i) {
3802
+ var shouldJoinDiffs = function (before, after) {
3803
+ var unchangedRange = new OffsetRange(lastResult.seq1Range.endExclusive, cur.seq1Range.start);
3804
+ var unchangedText = sequence1.getText(unchangedRange);
3805
+ var unchangedTextWithoutWs = unchangedText.replace(/\s/g, "");
3806
+ if (unchangedTextWithoutWs.length <= 4 && (before.seq1Range.length + before.seq2Range.length > 5 || after.seq1Range.length + after.seq2Range.length > 5)) {
3807
+ return true;
3808
+ }
3809
+ return false;
3810
+ };
3811
+ var cur = diffs[i];
3812
+ var lastResult = result[result.length - 1];
3813
+ var shouldJoin = shouldJoinDiffs(lastResult, cur);
3814
+ if (shouldJoin) {
3815
+ shouldRepeat = true;
3816
+ result[result.length - 1] = result[result.length - 1].join(cur);
3817
+ }
3818
+ else {
3819
+ result.push(cur);
3820
+ }
3821
+ };
3822
+ for (var i = 1; i < diffs.length; i++) {
3823
+ _loop_4(i);
3824
+ }
3825
+ diffs = result;
3826
+ } while (counter++ < 10 && shouldRepeat);
3827
+ return diffs;
3828
+ }
3829
+ function removeVeryShortMatchingTextBetweenLongDiffs(sequence1, sequence2, sequenceDiffs) {
3830
+ var diffs = sequenceDiffs;
3831
+ if (diffs.length === 0) {
3832
+ return diffs;
3833
+ }
3834
+ var counter = 0;
3835
+ var shouldRepeat;
3836
+ do {
3837
+ shouldRepeat = false;
3838
+ var result = [
3839
+ diffs[0]
3840
+ ];
3841
+ var _loop_5 = function (i) {
3842
+ var shouldJoinDiffs = function (before, after) {
3843
+ var unchangedRange = new OffsetRange(lastResult.seq1Range.endExclusive, cur.seq1Range.start);
3844
+ var unchangedLineCount = sequence1.countLinesIn(unchangedRange);
3845
+ if (unchangedLineCount > 5 || unchangedRange.length > 500) {
3846
+ return false;
3847
+ }
3848
+ var unchangedText = sequence1.getText(unchangedRange).trim();
3849
+ if (unchangedText.length > 20 || unchangedText.split(/\r\n|\r|\n/).length > 1) {
3850
+ return false;
3851
+ }
3852
+ var beforeLineCount1 = sequence1.countLinesIn(before.seq1Range);
3853
+ var beforeSeq1Length = before.seq1Range.length;
3854
+ var beforeLineCount2 = sequence2.countLinesIn(before.seq2Range);
3855
+ var beforeSeq2Length = before.seq2Range.length;
3856
+ var afterLineCount1 = sequence1.countLinesIn(after.seq1Range);
3857
+ var afterSeq1Length = after.seq1Range.length;
3858
+ var afterLineCount2 = sequence2.countLinesIn(after.seq2Range);
3859
+ var afterSeq2Length = after.seq2Range.length;
3860
+ var max = 2 * 40 + 50;
3861
+ function cap(v) {
3862
+ return Math.min(v, max);
3863
+ }
3864
+ if (Math.pow(Math.pow(cap(beforeLineCount1 * 40 + beforeSeq1Length), 1.5) + Math.pow(cap(beforeLineCount2 * 40 + beforeSeq2Length), 1.5), 1.5) + Math.pow(Math.pow(cap(afterLineCount1 * 40 + afterSeq1Length), 1.5) + Math.pow(cap(afterLineCount2 * 40 + afterSeq2Length), 1.5), 1.5) > Math.pow((Math.pow(max, 1.5)), 1.5) * 1.3) {
3865
+ return true;
3866
+ }
3867
+ return false;
3868
+ };
3869
+ var cur = diffs[i];
3870
+ var lastResult = result[result.length - 1];
3871
+ var shouldJoin = shouldJoinDiffs(lastResult, cur);
3872
+ if (shouldJoin) {
3873
+ shouldRepeat = true;
3874
+ result[result.length - 1] = result[result.length - 1].join(cur);
3875
+ }
3876
+ else {
3877
+ result.push(cur);
3878
+ }
3879
+ };
3880
+ for (var i = 1; i < diffs.length; i++) {
3881
+ _loop_5(i);
3882
+ }
3883
+ diffs = result;
3884
+ } while (counter++ < 10 && shouldRepeat);
3885
+ var newDiffs = [];
3886
+ forEachWithNeighbors(diffs, function (prev, cur, next) {
3887
+ var newDiff = cur;
3888
+ function shouldMarkAsChanged(text) {
3889
+ return text.length > 0 && text.trim().length <= 3 && cur.seq1Range.length + cur.seq2Range.length > 100;
3890
+ }
3891
+ var fullRange1 = sequence1.extendToFullLines(cur.seq1Range);
3892
+ var prefix = sequence1.getText(new OffsetRange(fullRange1.start, cur.seq1Range.start));
3893
+ if (shouldMarkAsChanged(prefix)) {
3894
+ newDiff = newDiff.deltaStart(-prefix.length);
3895
+ }
3896
+ var suffix = sequence1.getText(new OffsetRange(cur.seq1Range.endExclusive, fullRange1.endExclusive));
3897
+ if (shouldMarkAsChanged(suffix)) {
3898
+ newDiff = newDiff.deltaEnd(suffix.length);
3899
+ }
3900
+ var availableSpace = SequenceDiff.fromOffsetPairs(prev ? prev.getEndExclusives() : OffsetPair.zero, next ? next.getStarts() : OffsetPair.max);
3901
+ var result = newDiff.intersect(availableSpace);
3902
+ if (newDiffs.length > 0 && result.getStarts().equals(newDiffs[newDiffs.length - 1].getEndExclusives())) {
3903
+ newDiffs[newDiffs.length - 1] = newDiffs[newDiffs.length - 1].join(result);
3904
+ }
3905
+ else {
3906
+ newDiffs.push(result);
3907
+ }
3908
+ });
3909
+ return newDiffs;
3910
+ }
3911
+ var LineSequence = /** @class */ (function () {
3912
+ function LineSequence(trimmedHash, lines) {
3913
+ this.trimmedHash = trimmedHash;
3914
+ this.lines = lines;
3915
+ }
3916
+ LineSequence.prototype.getElement = function (offset) {
3917
+ return this.trimmedHash[offset];
3918
+ };
3919
+ Object.defineProperty(LineSequence.prototype, "length", {
3920
+ get: function () {
3921
+ return this.trimmedHash.length;
3922
+ },
3923
+ enumerable: false,
3924
+ configurable: true
3925
+ });
3926
+ LineSequence.prototype.getBoundaryScore = function (length) {
3927
+ var indentationBefore = length === 0 ? 0 : getIndentation(this.lines[length - 1]);
3928
+ var indentationAfter = length === this.lines.length ? 0 : getIndentation(this.lines[length]);
3929
+ return 1e3 - (indentationBefore + indentationAfter);
3930
+ };
3931
+ LineSequence.prototype.getText = function (range) {
3932
+ return this.lines.slice(range.start, range.endExclusive).join("\n");
3933
+ };
3934
+ LineSequence.prototype.isStronglyEqual = function (offset1, offset2) {
3935
+ return this.lines[offset1] === this.lines[offset2];
3936
+ };
3937
+ return LineSequence;
3938
+ }());
3939
+ function getIndentation(str) {
3940
+ var i = 0;
3941
+ while (i < str.length && (str.charCodeAt(i) === 32 || str.charCodeAt(i) === 9)) {
3942
+ i++;
3943
+ }
3944
+ return i;
3945
+ }
3946
+ var DefaultLinesDiffComputer = /** @class */ (function () {
3947
+ function DefaultLinesDiffComputer() {
3948
+ this.dynamicProgrammingDiffing = new DynamicProgrammingDiffing();
3949
+ this.myersDiffingAlgorithm = new MyersDiffAlgorithm();
3950
+ }
3951
+ DefaultLinesDiffComputer.prototype.computeDiff = function (originalLines, modifiedLines, options) {
3952
+ var e_16, _a;
3953
+ var _this = this;
3954
+ if (originalLines.length <= 1 && equals(originalLines, modifiedLines, function (a, b) { return a === b; })) {
3955
+ return new LinesDiff([], [], false);
3956
+ }
3957
+ if (originalLines.length === 1 && originalLines[0].length === 0 || modifiedLines.length === 1 && modifiedLines[0].length === 0) {
3958
+ return new LinesDiff([
3959
+ new DetailedLineRangeMapping(new LineRange(1, originalLines.length + 1), new LineRange(1, modifiedLines.length + 1), [
3960
+ new RangeMapping(new Range(1, 1, originalLines.length, originalLines[originalLines.length - 1].length + 1), new Range(1, 1, modifiedLines.length, modifiedLines[modifiedLines.length - 1].length + 1))
3961
+ ])
3962
+ ], [], false);
3963
+ }
3964
+ var timeout = options.maxComputationTimeMs === 0 ? InfiniteTimeout.instance : new DateTimeout(options.maxComputationTimeMs);
3965
+ var considerWhitespaceChanges = !options.ignoreTrimWhitespace;
3966
+ var perfectHashes = /* @__PURE__ */ new Map();
3967
+ function getOrCreateHash(text) {
3968
+ var hash = perfectHashes.get(text);
3969
+ if (hash === undefined) {
3970
+ hash = perfectHashes.size;
3971
+ perfectHashes.set(text, hash);
3972
+ }
3973
+ return hash;
3974
+ }
3975
+ var originalLinesHashes = originalLines.map(function (l) { return getOrCreateHash(l.trim()); });
3976
+ var modifiedLinesHashes = modifiedLines.map(function (l) { return getOrCreateHash(l.trim()); });
3977
+ var sequence1 = new LineSequence(originalLinesHashes, originalLines);
3978
+ var sequence2 = new LineSequence(modifiedLinesHashes, modifiedLines);
3979
+ var lineAlignmentResult = (function () {
3980
+ if (sequence1.length + sequence2.length < 1700) {
3981
+ return _this.dynamicProgrammingDiffing.compute(sequence1, sequence2, timeout, function (offset1, offset2) { return originalLines[offset1] === modifiedLines[offset2] ? modifiedLines[offset2].length === 0 ? 0.1 : 1 + Math.log(1 + modifiedLines[offset2].length) : 0.99; });
3982
+ }
3983
+ return _this.myersDiffingAlgorithm.compute(sequence1, sequence2, timeout);
3984
+ })();
3985
+ var lineAlignments = lineAlignmentResult.diffs;
3986
+ var hitTimeout = lineAlignmentResult.hitTimeout;
3987
+ lineAlignments = optimizeSequenceDiffs(sequence1, sequence2, lineAlignments);
3988
+ lineAlignments = removeVeryShortMatchingLinesBetweenDiffs(sequence1, sequence2, lineAlignments);
3989
+ var alignments = [];
3990
+ var scanForWhitespaceChanges = function (equalLinesCount) {
3991
+ var e_17, _a;
3992
+ if (!considerWhitespaceChanges) {
3993
+ return;
3994
+ }
3995
+ for (var i = 0; i < equalLinesCount; i++) {
3996
+ var seq1Offset = seq1LastStart + i;
3997
+ var seq2Offset = seq2LastStart + i;
3998
+ if (originalLines[seq1Offset] !== modifiedLines[seq2Offset]) {
3999
+ var characterDiffs = _this.refineDiff(originalLines, modifiedLines, new SequenceDiff(new OffsetRange(seq1Offset, seq1Offset + 1), new OffsetRange(seq2Offset, seq2Offset + 1)), timeout, considerWhitespaceChanges, options);
4000
+ try {
4001
+ for (var _g = (e_17 = void 0, __values(characterDiffs.mappings)), _h = _g.next(); !_h.done; _h = _g.next()) {
4002
+ var a = _h.value;
4003
+ alignments.push(a);
4004
+ }
4005
+ }
4006
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
4007
+ finally {
4008
+ try {
4009
+ if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
4010
+ }
4011
+ finally { if (e_17) throw e_17.error; }
4012
+ }
4013
+ if (characterDiffs.hitTimeout) {
4014
+ hitTimeout = true;
4015
+ }
4016
+ }
4017
+ }
4018
+ };
4019
+ var seq1LastStart = 0;
4020
+ var seq2LastStart = 0;
4021
+ var _loop_6 = function (diff) {
4022
+ var e_18, _g;
4023
+ assertFn(function () { return diff.seq1Range.start - seq1LastStart === diff.seq2Range.start - seq2LastStart; });
4024
+ var equalLinesCount = diff.seq1Range.start - seq1LastStart;
4025
+ scanForWhitespaceChanges(equalLinesCount);
4026
+ seq1LastStart = diff.seq1Range.endExclusive;
4027
+ seq2LastStart = diff.seq2Range.endExclusive;
4028
+ var characterDiffs = this_1.refineDiff(originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options);
4029
+ if (characterDiffs.hitTimeout) {
4030
+ hitTimeout = true;
4031
+ }
4032
+ try {
4033
+ for (var _h = (e_18 = void 0, __values(characterDiffs.mappings)), _j = _h.next(); !_j.done; _j = _h.next()) {
4034
+ var a = _j.value;
4035
+ alignments.push(a);
4036
+ }
4037
+ }
4038
+ catch (e_18_1) { e_18 = { error: e_18_1 }; }
4039
+ finally {
4040
+ try {
4041
+ if (_j && !_j.done && (_g = _h.return)) _g.call(_h);
4042
+ }
4043
+ finally { if (e_18) throw e_18.error; }
4044
+ }
4045
+ };
4046
+ var this_1 = this;
4047
+ try {
4048
+ for (var lineAlignments_1 = __values(lineAlignments), lineAlignments_1_1 = lineAlignments_1.next(); !lineAlignments_1_1.done; lineAlignments_1_1 = lineAlignments_1.next()) {
4049
+ var diff = lineAlignments_1_1.value;
4050
+ _loop_6(diff);
4051
+ }
4052
+ }
4053
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
4054
+ finally {
4055
+ try {
4056
+ if (lineAlignments_1_1 && !lineAlignments_1_1.done && (_a = lineAlignments_1.return)) _a.call(lineAlignments_1);
4057
+ }
4058
+ finally { if (e_16) throw e_16.error; }
4059
+ }
4060
+ scanForWhitespaceChanges(originalLines.length - seq1LastStart);
4061
+ var changes = lineRangeMappingFromRangeMappings(alignments, new ArrayText(originalLines), new ArrayText(modifiedLines));
4062
+ var moves = [];
4063
+ if (options.computeMoves) {
4064
+ moves = this.computeMoves(changes, originalLines, modifiedLines, originalLinesHashes, modifiedLinesHashes, timeout, considerWhitespaceChanges, options);
4065
+ }
4066
+ assertFn(function () {
4067
+ var e_19, _a, e_20, _g;
4068
+ function validatePosition(pos, lines) {
4069
+ if (pos.lineNumber < 1 || pos.lineNumber > lines.length) {
4070
+ return false;
4071
+ }
4072
+ var line = lines[pos.lineNumber - 1];
4073
+ if (pos.column < 1 || pos.column > line.length + 1) {
4074
+ return false;
4075
+ }
4076
+ return true;
4077
+ }
4078
+ function validateRange(range, lines) {
4079
+ if (range.startLineNumber < 1 || range.startLineNumber > lines.length + 1) {
4080
+ return false;
4081
+ }
4082
+ if (range.endLineNumberExclusive < 1 || range.endLineNumberExclusive > lines.length + 1) {
4083
+ return false;
4084
+ }
4085
+ return true;
4086
+ }
4087
+ try {
4088
+ for (var changes_3 = __values(changes), changes_3_1 = changes_3.next(); !changes_3_1.done; changes_3_1 = changes_3.next()) {
4089
+ var c = changes_3_1.value;
4090
+ if (!c.innerChanges) {
4091
+ return false;
4092
+ }
4093
+ try {
4094
+ for (var _h = (e_20 = void 0, __values(c.innerChanges)), _j = _h.next(); !_j.done; _j = _h.next()) {
4095
+ var ic = _j.value;
4096
+ var valid = validatePosition(ic.modifiedRange.getStartPosition(), modifiedLines) && validatePosition(ic.modifiedRange.getEndPosition(), modifiedLines) && validatePosition(ic.originalRange.getStartPosition(), originalLines) && validatePosition(ic.originalRange.getEndPosition(), originalLines);
4097
+ if (!valid) {
4098
+ return false;
4099
+ }
4100
+ }
4101
+ }
4102
+ catch (e_20_1) { e_20 = { error: e_20_1 }; }
4103
+ finally {
4104
+ try {
4105
+ if (_j && !_j.done && (_g = _h.return)) _g.call(_h);
4106
+ }
4107
+ finally { if (e_20) throw e_20.error; }
4108
+ }
4109
+ if (!validateRange(c.modified, modifiedLines) || !validateRange(c.original, originalLines)) {
4110
+ return false;
4111
+ }
4112
+ }
4113
+ }
4114
+ catch (e_19_1) { e_19 = { error: e_19_1 }; }
4115
+ finally {
4116
+ try {
4117
+ if (changes_3_1 && !changes_3_1.done && (_a = changes_3.return)) _a.call(changes_3);
4118
+ }
4119
+ finally { if (e_19) throw e_19.error; }
4120
+ }
4121
+ return true;
4122
+ });
4123
+ return new LinesDiff(changes, moves, hitTimeout);
4124
+ };
4125
+ DefaultLinesDiffComputer.prototype.computeMoves = function (changes, originalLines, modifiedLines, hashedOriginalLines, hashedModifiedLines, timeout, considerWhitespaceChanges, options) {
4126
+ var _this = this;
4127
+ var moves = computeMovedLines(changes, originalLines, modifiedLines, hashedOriginalLines, hashedModifiedLines, timeout);
4128
+ var movesWithDiffs = moves.map(function (m) {
4129
+ var moveChanges = _this.refineDiff(originalLines, modifiedLines, new SequenceDiff(m.original.toOffsetRange(), m.modified.toOffsetRange()), timeout, considerWhitespaceChanges, options);
4130
+ var mappings = lineRangeMappingFromRangeMappings(moveChanges.mappings, new ArrayText(originalLines), new ArrayText(modifiedLines), true);
4131
+ return new MovedText(m, mappings);
4132
+ });
4133
+ return movesWithDiffs;
4134
+ };
4135
+ DefaultLinesDiffComputer.prototype.refineDiff = function (originalLines, modifiedLines, diff, timeout, considerWhitespaceChanges, options) {
4136
+ var lineRangeMapping = toLineRangeMapping(diff);
4137
+ var rangeMapping = lineRangeMapping.toRangeMapping2(originalLines, modifiedLines);
4138
+ var slice1 = new LinesSliceCharSequence(originalLines, rangeMapping.originalRange, considerWhitespaceChanges);
4139
+ var slice2 = new LinesSliceCharSequence(modifiedLines, rangeMapping.modifiedRange, considerWhitespaceChanges);
4140
+ var diffResult = slice1.length + slice2.length < 500 ? this.dynamicProgrammingDiffing.compute(slice1, slice2, timeout) : this.myersDiffingAlgorithm.compute(slice1, slice2, timeout);
4141
+ var diffs = diffResult.diffs;
4142
+ diffs = optimizeSequenceDiffs(slice1, slice2, diffs);
4143
+ diffs = extendDiffsToEntireWordIfAppropriate(slice1, slice2, diffs, function (seq, idx) { return seq.findWordContaining(idx); });
4144
+ if (options.extendToSubwords) {
4145
+ diffs = extendDiffsToEntireWordIfAppropriate(slice1, slice2, diffs, function (seq, idx) { return seq.findSubWordContaining(idx); }, true);
4146
+ }
4147
+ diffs = removeShortMatches(slice1, slice2, diffs);
4148
+ diffs = removeVeryShortMatchingTextBetweenLongDiffs(slice1, slice2, diffs);
4149
+ var result = diffs.map(function (d) { return new RangeMapping(slice1.translateRange(d.seq1Range), slice2.translateRange(d.seq2Range)); });
4150
+ return {
4151
+ mappings: result,
4152
+ hitTimeout: diffResult.hitTimeout
4153
+ };
4154
+ };
4155
+ return DefaultLinesDiffComputer;
4156
+ }());
4157
+ function toLineRangeMapping(sequenceDiff) {
4158
+ return new LineRangeMapping(new LineRange(sequenceDiff.seq1Range.start + 1, sequenceDiff.seq1Range.endExclusive + 1), new LineRange(sequenceDiff.seq2Range.start + 1, sequenceDiff.seq2Range.endExclusive + 1));
4159
+ }
4160
+ function computeDiff(originalLines, modifiedLines, options) {
4161
+ var diffComputer = new DefaultLinesDiffComputer();
4162
+ var result = diffComputer.computeDiff(originalLines, modifiedLines, options);
4163
+ return result === null || result === void 0 ? void 0 : result.changes.map(function (changes) {
4164
+ var originalStartLineNumber;
4165
+ var originalEndLineNumber;
4166
+ var modifiedStartLineNumber;
4167
+ var modifiedEndLineNumber;
4168
+ var innerChanges = changes.innerChanges;
4169
+ originalStartLineNumber = changes.original.startLineNumber - 1;
4170
+ originalEndLineNumber = changes.original.endLineNumberExclusive - 1;
4171
+ modifiedStartLineNumber = changes.modified.startLineNumber - 1;
4172
+ modifiedEndLineNumber = changes.modified.endLineNumberExclusive - 1;
4173
+ return {
4174
+ origStart: originalStartLineNumber,
4175
+ origEnd: originalEndLineNumber,
4176
+ editStart: modifiedStartLineNumber,
4177
+ editEnd: modifiedEndLineNumber,
4178
+ charChanges: innerChanges === null || innerChanges === void 0 ? void 0 : innerChanges.map(function (m) { return ({
4179
+ originalStartLineNumber: m.originalRange.startLineNumber - 1,
4180
+ originalStartColumn: m.originalRange.startColumn - 1,
4181
+ originalEndLineNumber: m.originalRange.endLineNumber - 1,
4182
+ originalEndColumn: m.originalRange.endColumn - 1,
4183
+ modifiedStartLineNumber: m.modifiedRange.startLineNumber - 1,
4184
+ modifiedStartColumn: m.modifiedRange.startColumn - 1,
4185
+ modifiedEndLineNumber: m.modifiedRange.endLineNumber - 1,
4186
+ modifiedEndColumn: m.modifiedRange.endColumn - 1
4187
+ }); })
4188
+ };
4189
+ });
4190
+ }
4191
+ exports.computeDiff = computeDiff;
4192
+ var AceRange = require("../../../range").Range;
4193
+ var DiffChunk = require("../base_diff_view").DiffChunk;
4194
+ var DiffProvider = /** @class */ (function () {
4195
+ function DiffProvider() {
4196
+ }
4197
+ DiffProvider.prototype.compute = function (originalLines, modifiedLines, opts) {
4198
+ if (!opts)
4199
+ opts = {};
4200
+ if (!opts.maxComputationTimeMs)
4201
+ opts.maxComputationTimeMs = 500;
4202
+ var chunks = computeDiff(originalLines, modifiedLines, opts) || [];
4203
+ return chunks.map(function (c) { return new DiffChunk(new AceRange(c.origStart, 0, c.origEnd, 0), new AceRange(c.editStart, 0, c.editEnd, 0), c.charChanges); });
4204
+ };
4205
+ return DiffProvider;
4206
+ }());
4207
+ exports.DiffProvider = DiffProvider;
4208
+
4209
+ });
4210
+
4211
+ ace.define("ace/ext/diff",["require","exports","module","ace/ext/diff/inline_diff_view","ace/ext/diff/split_diff_view","ace/ext/diff/providers/default"], function(require, exports, module){/**
4212
+ * ## Diff extension
4213
+ *
4214
+ * Provides side-by-side and inline diff view capabilities for comparing code differences between two versions.
4215
+ * Supports visual highlighting of additions, deletions, and modifications with customizable diff providers
4216
+ * and rendering options. Includes features for synchronized scrolling, line number alignment, and
4217
+ * various diff computation algorithms.
4218
+ *
4219
+ * **Components:**
4220
+ * - `InlineDiffView`: Single editor view showing changes inline with markers
4221
+ * - `SplitDiffView`: Side-by-side comparison view with two synchronized editors
4222
+ * - `DiffProvider`: Configurable algorithms for computing differences
4223
+ *
4224
+ * **Usage:**
4225
+ * ```javascript
4226
+ * const diffView = createDiffView({
4227
+ * valueA: originalContent,
4228
+ * valueB: modifiedContent,
4229
+ * inline: false // or 'a'/'b' for inline view
4230
+ * });
4231
+ * ```
4232
+ *
4233
+ * @module
4234
+ */
4235
+ var InlineDiffView = require("./diff/inline_diff_view").InlineDiffView;
4236
+ var SplitDiffView = require("./diff/split_diff_view").SplitDiffView;
4237
+ var DiffProvider = require("./diff/providers/default").DiffProvider;
4238
+ function createDiffView(diffModel, options) {
4239
+ diffModel = diffModel || {};
4240
+ diffModel.diffProvider = diffModel.diffProvider || new DiffProvider(); //use default diff provider;
4241
+ var diffView;
4242
+ if (diffModel.inline) {
4243
+ diffView = new InlineDiffView(diffModel);
4244
+ }
4245
+ else {
4246
+ diffView = new SplitDiffView(diffModel);
4247
+ }
4248
+ if (options) {
4249
+ diffView.setOptions(options);
4250
+ }
4251
+ return diffView;
4252
+ }
4253
+ exports.InlineDiffView = InlineDiffView;
4254
+ exports.SplitDiffView = SplitDiffView;
4255
+ exports.DiffProvider = DiffProvider;
4256
+ exports.createDiffView = createDiffView;
4257
+
4258
+ }); (function() {
4259
+ ace.require(["ace/ext/diff"], function(m) {
4260
+ if (typeof module == "object" && typeof exports == "object" && module) {
4261
+ module.exports = m;
4262
+ }
4263
+ });
4264
+ })();
4265
+