@openui5/sap.ui.codeeditor 1.120.6 → 1.121.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 (457) hide show
  1. package/.reuse/dep5 +23 -21
  2. package/THIRDPARTY.txt +6 -43
  3. package/package.json +2 -2
  4. package/src/sap/ui/codeeditor/.library +2 -2
  5. package/src/sap/ui/codeeditor/CodeEditor.js +41 -27
  6. package/src/sap/ui/codeeditor/js/ace/ace.js +16262 -16597
  7. package/src/sap/ui/codeeditor/js/ace/css/ace.css +358 -86
  8. package/src/sap/ui/codeeditor/js/ace/css/ambiance-3.png +0 -0
  9. package/src/sap/ui/codeeditor/js/ace/css/chrome-2.png +0 -0
  10. package/src/sap/ui/codeeditor/js/ace/css/cloud9_day-1.png +0 -0
  11. package/src/sap/ui/codeeditor/js/ace/css/cloud9_day-2.png +0 -0
  12. package/src/sap/ui/codeeditor/js/ace/css/cloud9_night-1.png +0 -0
  13. package/src/sap/ui/codeeditor/js/ace/css/cloud9_night-2.png +0 -0
  14. package/src/sap/ui/codeeditor/js/ace/css/cloud9_night_low_color-1.png +0 -0
  15. package/src/sap/ui/codeeditor/js/ace/css/cloud9_night_low_color-2.png +0 -0
  16. package/src/sap/ui/codeeditor/js/ace/css/clouds-2.png +0 -0
  17. package/src/sap/ui/codeeditor/js/ace/css/clouds_midnight-2.png +0 -0
  18. package/src/sap/ui/codeeditor/js/ace/css/cobalt-2.png +0 -0
  19. package/src/sap/ui/codeeditor/js/ace/css/crimson_editor-2.png +0 -0
  20. package/src/sap/ui/codeeditor/js/ace/css/dawn-2.png +0 -0
  21. package/src/sap/ui/codeeditor/js/ace/css/dracula-2.png +0 -0
  22. package/src/sap/ui/codeeditor/js/ace/css/dreamweaver-2.png +0 -0
  23. package/src/sap/ui/codeeditor/js/ace/css/eclipse-2.png +0 -0
  24. package/src/sap/ui/codeeditor/js/ace/css/github-2.png +0 -0
  25. package/src/sap/ui/codeeditor/js/ace/css/github_dark-1.png +0 -0
  26. package/src/sap/ui/codeeditor/js/ace/css/github_dark-2.png +0 -0
  27. package/src/sap/ui/codeeditor/js/ace/css/gob-2.png +0 -0
  28. package/src/sap/ui/codeeditor/js/ace/css/gruvbox-2.png +0 -0
  29. package/src/sap/ui/codeeditor/js/ace/css/gruvbox_dark_hard-1.png +0 -0
  30. package/src/sap/ui/codeeditor/js/ace/css/gruvbox_light_hard-1.png +0 -0
  31. package/src/sap/ui/codeeditor/js/ace/css/gruvbox_light_hard-2.png +0 -0
  32. package/src/sap/ui/codeeditor/js/ace/css/idle_fingers-2.png +0 -0
  33. package/src/sap/ui/codeeditor/js/ace/css/iplastic-3.png +0 -0
  34. package/src/sap/ui/codeeditor/js/ace/css/katzenmilch-1.png +0 -0
  35. package/src/sap/ui/codeeditor/js/ace/css/katzenmilch-2.png +0 -0
  36. package/src/sap/ui/codeeditor/js/ace/css/kr_theme-2.png +0 -0
  37. package/src/sap/ui/codeeditor/js/ace/css/kuroir-1.png +0 -0
  38. package/src/sap/ui/codeeditor/js/ace/css/kuroir-2.png +0 -0
  39. package/src/sap/ui/codeeditor/js/ace/css/main-10.png +0 -0
  40. package/src/sap/ui/codeeditor/js/ace/css/main-11.png +0 -0
  41. package/src/sap/ui/codeeditor/js/ace/css/main-12.png +0 -0
  42. package/src/sap/ui/codeeditor/js/ace/css/main-13.png +0 -0
  43. package/src/sap/ui/codeeditor/js/ace/css/main-14.png +0 -0
  44. package/src/sap/ui/codeeditor/js/ace/css/main-15.png +0 -0
  45. package/src/sap/ui/codeeditor/js/ace/css/main-16.png +0 -0
  46. package/src/sap/ui/codeeditor/js/ace/css/main-17.png +0 -0
  47. package/src/sap/ui/codeeditor/js/ace/css/main-18.png +0 -0
  48. package/src/sap/ui/codeeditor/js/ace/css/main-19.png +0 -0
  49. package/src/sap/ui/codeeditor/js/ace/css/main-20.png +0 -0
  50. package/src/sap/ui/codeeditor/js/ace/css/main-21.png +0 -0
  51. package/src/sap/ui/codeeditor/js/ace/css/main-22.png +0 -0
  52. package/src/sap/ui/codeeditor/js/ace/css/main-22.svg +1 -0
  53. package/src/sap/ui/codeeditor/js/ace/css/main-23.png +0 -0
  54. package/src/sap/ui/codeeditor/js/ace/css/main-5.svg +7 -0
  55. package/src/sap/ui/codeeditor/js/ace/css/main-6.svg +7 -0
  56. package/src/sap/ui/codeeditor/js/ace/css/main-7.svg +9 -0
  57. package/src/sap/ui/codeeditor/js/ace/css/main-8.png +0 -0
  58. package/src/sap/ui/codeeditor/js/ace/css/main-8.svg +4 -0
  59. package/src/sap/ui/codeeditor/js/ace/css/main-9.png +0 -0
  60. package/src/sap/ui/codeeditor/js/ace/css/main-9.svg +4 -0
  61. package/src/sap/ui/codeeditor/js/ace/css/merbivore-2.png +0 -0
  62. package/src/sap/ui/codeeditor/js/ace/css/merbivore_soft-2.png +0 -0
  63. package/src/sap/ui/codeeditor/js/ace/css/mono_industrial-2.png +0 -0
  64. package/src/sap/ui/codeeditor/js/ace/css/monokai-2.png +0 -0
  65. package/src/sap/ui/codeeditor/js/ace/css/one_dark-2.png +0 -0
  66. package/src/sap/ui/codeeditor/js/ace/css/pastel_on_dark-2.png +0 -0
  67. package/src/sap/ui/codeeditor/js/ace/css/solarized_dark-2.png +0 -0
  68. package/src/sap/ui/codeeditor/js/ace/css/solarized_light-2.png +0 -0
  69. package/src/sap/ui/codeeditor/js/ace/css/sqlserver-2.png +0 -0
  70. package/src/sap/ui/codeeditor/js/ace/css/terminal-2.png +0 -0
  71. package/src/sap/ui/codeeditor/js/ace/css/textmate-2.png +0 -0
  72. package/src/sap/ui/codeeditor/js/ace/css/theme/ambiance.css +120 -68
  73. package/src/sap/ui/codeeditor/js/ace/css/theme/chaos.css +79 -66
  74. package/src/sap/ui/codeeditor/js/ace/css/theme/chrome.css +82 -43
  75. package/src/sap/ui/codeeditor/js/ace/css/theme/cloud9_day.css +160 -0
  76. package/src/sap/ui/codeeditor/js/ace/css/theme/cloud9_night.css +146 -0
  77. package/src/sap/ui/codeeditor/js/ace/css/theme/cloud9_night_low_color.css +134 -0
  78. package/src/sap/ui/codeeditor/js/ace/css/theme/clouds.css +59 -31
  79. package/src/sap/ui/codeeditor/js/ace/css/theme/clouds_midnight.css +60 -32
  80. package/src/sap/ui/codeeditor/js/ace/css/theme/cobalt.css +71 -38
  81. package/src/sap/ui/codeeditor/js/ace/css/theme/crimson_editor.css +79 -42
  82. package/src/sap/ui/codeeditor/js/ace/css/theme/dawn.css +70 -40
  83. package/src/sap/ui/codeeditor/js/ace/css/theme/dracula.css +95 -49
  84. package/src/sap/ui/codeeditor/js/ace/css/theme/dreamweaver.css +95 -49
  85. package/src/sap/ui/codeeditor/js/ace/css/theme/eclipse.css +62 -33
  86. package/src/sap/ui/codeeditor/js/ace/css/theme/github.css +71 -38
  87. package/src/sap/ui/codeeditor/js/ace/css/theme/github_dark.css +134 -0
  88. package/src/sap/ui/codeeditor/js/ace/css/theme/gob.css +68 -38
  89. package/src/sap/ui/codeeditor/js/ace/css/theme/gruvbox.css +54 -28
  90. package/src/sap/ui/codeeditor/js/ace/css/theme/gruvbox_dark_hard.css +163 -0
  91. package/src/sap/ui/codeeditor/js/ace/css/theme/gruvbox_light_hard.css +167 -0
  92. package/src/sap/ui/codeeditor/js/ace/css/theme/idle_fingers.css +62 -34
  93. package/src/sap/ui/codeeditor/js/ace/css/theme/iplastic.css +76 -45
  94. package/src/sap/ui/codeeditor/js/ace/css/theme/katzenmilch.css +91 -53
  95. package/src/sap/ui/codeeditor/js/ace/css/theme/kr_theme.css +67 -36
  96. package/src/sap/ui/codeeditor/js/ace/css/theme/kuroir.css +43 -17
  97. package/src/sap/ui/codeeditor/js/ace/css/theme/merbivore.css +57 -31
  98. package/src/sap/ui/codeeditor/js/ace/css/theme/merbivore_soft.css +57 -31
  99. package/src/sap/ui/codeeditor/js/ace/css/theme/mono_industrial.css +66 -36
  100. package/src/sap/ui/codeeditor/js/ace/css/theme/monokai.css +63 -35
  101. package/src/sap/ui/codeeditor/js/ace/css/theme/nord_dark.css +55 -29
  102. package/src/sap/ui/codeeditor/js/ace/css/theme/one_dark.css +88 -47
  103. package/src/sap/ui/codeeditor/js/ace/css/theme/pastel_on_dark.css +70 -38
  104. package/src/sap/ui/codeeditor/js/ace/css/theme/solarized_dark.css +52 -28
  105. package/src/sap/ui/codeeditor/js/ace/css/theme/solarized_light.css +55 -29
  106. package/src/sap/ui/codeeditor/js/ace/css/theme/sqlserver.css +90 -48
  107. package/src/sap/ui/codeeditor/js/ace/css/theme/terminal.css +64 -34
  108. package/src/sap/ui/codeeditor/js/ace/css/theme/textmate.css +82 -43
  109. package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow.css +61 -33
  110. package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night.css +61 -33
  111. package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night_blue.css +59 -32
  112. package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night_bright.css +71 -40
  113. package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night_eighties.css +61 -33
  114. package/src/sap/ui/codeeditor/js/ace/css/theme/twilight.css +66 -36
  115. package/src/sap/ui/codeeditor/js/ace/css/theme/vibrant_ink.css +59 -32
  116. package/src/sap/ui/codeeditor/js/ace/css/theme/xcode.css +54 -28
  117. package/src/sap/ui/codeeditor/js/ace/css/tomorrow-2.png +0 -0
  118. package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night-2.png +0 -0
  119. package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night_blue-2.png +0 -0
  120. package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night_bright-2.png +0 -0
  121. package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night_eighties-2.png +0 -0
  122. package/src/sap/ui/codeeditor/js/ace/css/twilight-2.png +0 -0
  123. package/src/sap/ui/codeeditor/js/ace/css/vibrant_ink-2.png +0 -0
  124. package/src/sap/ui/codeeditor/js/ace/css/xcode-2.png +0 -0
  125. package/src/sap/ui/codeeditor/js/ace/ext-beautify.js +90 -91
  126. package/src/sap/ui/codeeditor/js/ace/ext-code_lens.js +39 -75
  127. package/src/sap/ui/codeeditor/js/ace/ext-command_bar.js +457 -0
  128. package/src/sap/ui/codeeditor/js/ace/ext-elastic_tabstops_lite.js +47 -97
  129. package/src/sap/ui/codeeditor/js/ace/ext-emmet.js +496 -552
  130. package/src/sap/ui/codeeditor/js/ace/ext-hardwrap.js +47 -16
  131. package/src/sap/ui/codeeditor/js/ace/ext-inline_autocomplete.js +3269 -0
  132. package/src/sap/ui/codeeditor/js/ace/ext-keybinding_menu.js +45 -105
  133. package/src/sap/ui/codeeditor/js/ace/ext-language_tools.js +1438 -1128
  134. package/src/sap/ui/codeeditor/js/ace/ext-linking.js +8 -16
  135. package/src/sap/ui/codeeditor/js/ace/ext-modelist.js +198 -185
  136. package/src/sap/ui/codeeditor/js/ace/ext-options.js +405 -443
  137. package/src/sap/ui/codeeditor/js/ace/ext-prompt.js +1682 -1508
  138. package/src/sap/ui/codeeditor/js/ace/ext-rtl.js +26 -28
  139. package/src/sap/ui/codeeditor/js/ace/ext-searchbox.js +160 -332
  140. package/src/sap/ui/codeeditor/js/ace/ext-settings_menu.js +409 -446
  141. package/src/sap/ui/codeeditor/js/ace/ext-simple_tokenizer.js +45 -0
  142. package/src/sap/ui/codeeditor/js/ace/ext-spellcheck.js +4 -10
  143. package/src/sap/ui/codeeditor/js/ace/ext-split.js +41 -63
  144. package/src/sap/ui/codeeditor/js/ace/ext-statusbar.js +19 -27
  145. package/src/sap/ui/codeeditor/js/ace/ext-themelist.js +45 -41
  146. package/src/sap/ui/codeeditor/js/ace/ext-whitespace.js +62 -83
  147. package/src/sap/ui/codeeditor/js/ace/keybinding-emacs.js +442 -551
  148. package/src/sap/ui/codeeditor/js/ace/keybinding-sublime.js +338 -351
  149. package/src/sap/ui/codeeditor/js/ace/keybinding-vim.js +5242 -4758
  150. package/src/sap/ui/codeeditor/js/ace/keybinding-vscode.js +228 -235
  151. package/src/sap/ui/codeeditor/js/ace/mode-abap.js +72 -93
  152. package/src/sap/ui/codeeditor/js/ace/mode-abc.js +136 -164
  153. package/src/sap/ui/codeeditor/js/ace/mode-actionscript.js +109 -150
  154. package/src/sap/ui/codeeditor/js/ace/mode-ada.js +45 -74
  155. package/src/sap/ui/codeeditor/js/ace/mode-alda.js +77 -109
  156. package/src/sap/ui/codeeditor/js/ace/mode-apache_conf.js +196 -241
  157. package/src/sap/ui/codeeditor/js/ace/mode-apex.js +192 -247
  158. package/src/sap/ui/codeeditor/js/ace/mode-applescript.js +56 -102
  159. package/src/sap/ui/codeeditor/js/ace/mode-aql.js +85 -95
  160. package/src/sap/ui/codeeditor/js/ace/mode-asciidoc.js +120 -158
  161. package/src/sap/ui/codeeditor/js/ace/mode-asl.js +233 -298
  162. package/src/sap/ui/codeeditor/js/ace/mode-assembly_x86.js +78 -101
  163. package/src/sap/ui/codeeditor/js/ace/mode-astro.js +2414 -0
  164. package/src/sap/ui/codeeditor/js/ace/mode-autohotkey.js +80 -116
  165. package/src/sap/ui/codeeditor/js/ace/mode-batchfile.js +74 -105
  166. package/src/sap/ui/codeeditor/js/ace/mode-bibtex.js +318 -0
  167. package/src/sap/ui/codeeditor/js/ace/mode-c9search.js +72 -115
  168. package/src/sap/ui/codeeditor/js/ace/mode-c_cpp.js +171 -257
  169. package/src/sap/ui/codeeditor/js/ace/mode-cirru.js +97 -115
  170. package/src/sap/ui/codeeditor/js/ace/mode-clojure.js +126 -119
  171. package/src/sap/ui/codeeditor/js/ace/mode-cobol.js +48 -67
  172. package/src/sap/ui/codeeditor/js/ace/mode-coffee.js +203 -268
  173. package/src/sap/ui/codeeditor/js/ace/mode-coldfusion.js +1029 -1276
  174. package/src/sap/ui/codeeditor/js/ace/mode-crystal.js +337 -393
  175. package/src/sap/ui/codeeditor/js/ace/mode-csharp.js +127 -216
  176. package/src/sap/ui/codeeditor/js/ace/mode-csound_document.js +1539 -1569
  177. package/src/sap/ui/codeeditor/js/ace/mode-csound_orchestra.js +786 -898
  178. package/src/sap/ui/codeeditor/js/ace/mode-csound_score.js +184 -237
  179. package/src/sap/ui/codeeditor/js/ace/mode-csp.js +37 -37
  180. package/src/sap/ui/codeeditor/js/ace/mode-css.js +293 -384
  181. package/src/sap/ui/codeeditor/js/ace/mode-curly.js +1019 -1262
  182. package/src/sap/ui/codeeditor/js/ace/mode-cuttlefish.js +56 -0
  183. package/src/sap/ui/codeeditor/js/ace/mode-d.js +163 -233
  184. package/src/sap/ui/codeeditor/js/ace/mode-dart.js +330 -427
  185. package/src/sap/ui/codeeditor/js/ace/mode-diff.js +20 -38
  186. package/src/sap/ui/codeeditor/js/ace/mode-django.js +1032 -1271
  187. package/src/sap/ui/codeeditor/js/ace/mode-dockerfile.js +211 -284
  188. package/src/sap/ui/codeeditor/js/ace/mode-dot.js +131 -200
  189. package/src/sap/ui/codeeditor/js/ace/mode-drools.js +408 -349
  190. package/src/sap/ui/codeeditor/js/ace/mode-edifact.js +89 -125
  191. package/src/sap/ui/codeeditor/js/ace/mode-eiffel.js +47 -62
  192. package/src/sap/ui/codeeditor/js/ace/mode-ejs.js +1350 -1666
  193. package/src/sap/ui/codeeditor/js/ace/mode-elixir.js +349 -407
  194. package/src/sap/ui/codeeditor/js/ace/mode-elm.js +136 -168
  195. package/src/sap/ui/codeeditor/js/ace/mode-erlang.js +707 -881
  196. package/src/sap/ui/codeeditor/js/ace/mode-flix.js +164 -0
  197. package/src/sap/ui/codeeditor/js/ace/mode-forth.js +128 -172
  198. package/src/sap/ui/codeeditor/js/ace/mode-fortran.js +177 -246
  199. package/src/sap/ui/codeeditor/js/ace/mode-fsharp.js +92 -131
  200. package/src/sap/ui/codeeditor/js/ace/mode-fsl.js +91 -124
  201. package/src/sap/ui/codeeditor/js/ace/mode-ftl.js +813 -748
  202. package/src/sap/ui/codeeditor/js/ace/mode-gcode.js +52 -71
  203. package/src/sap/ui/codeeditor/js/ace/mode-gherkin.js +105 -119
  204. package/src/sap/ui/codeeditor/js/ace/mode-gitignore.js +12 -22
  205. package/src/sap/ui/codeeditor/js/ace/mode-glsl.js +184 -289
  206. package/src/sap/ui/codeeditor/js/ace/mode-gobstones.js +686 -623
  207. package/src/sap/ui/codeeditor/js/ace/mode-golang.js +167 -239
  208. package/src/sap/ui/codeeditor/js/ace/mode-graphqlschema.js +48 -88
  209. package/src/sap/ui/codeeditor/js/ace/mode-groovy.js +577 -471
  210. package/src/sap/ui/codeeditor/js/ace/mode-haml.js +1062 -1026
  211. package/src/sap/ui/codeeditor/js/ace/mode-handlebars.js +1061 -1305
  212. package/src/sap/ui/codeeditor/js/ace/mode-haskell.js +199 -255
  213. package/src/sap/ui/codeeditor/js/ace/mode-haskell_cabal.js +81 -87
  214. package/src/sap/ui/codeeditor/js/ace/mode-haxe.js +111 -184
  215. package/src/sap/ui/codeeditor/js/ace/mode-hjson.js +164 -199
  216. package/src/sap/ui/codeeditor/js/ace/mode-html.js +1009 -1239
  217. package/src/sap/ui/codeeditor/js/ace/mode-html_elixir.js +1402 -1705
  218. package/src/sap/ui/codeeditor/js/ace/mode-html_ruby.js +1390 -1706
  219. package/src/sap/ui/codeeditor/js/ace/mode-ini.js +58 -82
  220. package/src/sap/ui/codeeditor/js/ace/mode-io.js +85 -123
  221. package/src/sap/ui/codeeditor/js/ace/mode-ion.js +477 -0
  222. package/src/sap/ui/codeeditor/js/ace/mode-jack.js +109 -162
  223. package/src/sap/ui/codeeditor/js/ace/mode-jade.js +1339 -1344
  224. package/src/sap/ui/codeeditor/js/ace/mode-java.js +710 -498
  225. package/src/sap/ui/codeeditor/js/ace/mode-javascript.js +441 -354
  226. package/src/sap/ui/codeeditor/js/ace/mode-jexl.js +270 -0
  227. package/src/sap/ui/codeeditor/js/ace/mode-json.js +93 -147
  228. package/src/sap/ui/codeeditor/js/ace/mode-json5.js +128 -180
  229. package/src/sap/ui/codeeditor/js/ace/mode-jsoniq.js +58 -112
  230. package/src/sap/ui/codeeditor/js/ace/mode-jsp.js +1045 -865
  231. package/src/sap/ui/codeeditor/js/ace/mode-jssm.js +158 -190
  232. package/src/sap/ui/codeeditor/js/ace/mode-jsx.js +121 -194
  233. package/src/sap/ui/codeeditor/js/ace/mode-julia.js +128 -177
  234. package/src/sap/ui/codeeditor/js/ace/mode-kotlin.js +262 -614
  235. package/src/sap/ui/codeeditor/js/ace/mode-latex.js +94 -138
  236. package/src/sap/ui/codeeditor/js/ace/mode-latte.js +1120 -1366
  237. package/src/sap/ui/codeeditor/js/ace/mode-less.js +342 -442
  238. package/src/sap/ui/codeeditor/js/ace/mode-liquid.js +1353 -1414
  239. package/src/sap/ui/codeeditor/js/ace/mode-lisp.js +65 -73
  240. package/src/sap/ui/codeeditor/js/ace/mode-livescript.js +217 -224
  241. package/src/sap/ui/codeeditor/js/ace/mode-logiql.js +97 -142
  242. package/src/sap/ui/codeeditor/js/ace/mode-logtalk.js +187 -227
  243. package/src/sap/ui/codeeditor/js/ace/mode-lsl.js +99 -155
  244. package/src/sap/ui/codeeditor/js/ace/mode-lua.js +152 -211
  245. package/src/sap/ui/codeeditor/js/ace/mode-luapage.js +1167 -1470
  246. package/src/sap/ui/codeeditor/js/ace/mode-lucene.js +25 -34
  247. package/src/sap/ui/codeeditor/js/ace/mode-makefile.js +244 -282
  248. package/src/sap/ui/codeeditor/js/ace/mode-markdown.js +1858 -2177
  249. package/src/sap/ui/codeeditor/js/ace/mode-mask.js +964 -1007
  250. package/src/sap/ui/codeeditor/js/ace/mode-matlab.js +197 -221
  251. package/src/sap/ui/codeeditor/js/ace/mode-maze.js +127 -163
  252. package/src/sap/ui/codeeditor/js/ace/mode-mediawiki.js +464 -476
  253. package/src/sap/ui/codeeditor/js/ace/mode-mel.js +90 -140
  254. package/src/sap/ui/codeeditor/js/ace/mode-mips.js +101 -134
  255. package/src/sap/ui/codeeditor/js/ace/mode-mixal.js +63 -75
  256. package/src/sap/ui/codeeditor/js/ace/mode-mushcode.js +537 -576
  257. package/src/sap/ui/codeeditor/js/ace/mode-mysql.js +85 -102
  258. package/src/sap/ui/codeeditor/js/ace/mode-nasal.js +513 -0
  259. package/src/sap/ui/codeeditor/js/ace/mode-nginx.js +119 -155
  260. package/src/sap/ui/codeeditor/js/ace/mode-nim.js +159 -197
  261. package/src/sap/ui/codeeditor/js/ace/mode-nix.js +283 -375
  262. package/src/sap/ui/codeeditor/js/ace/mode-nsis.js +139 -172
  263. package/src/sap/ui/codeeditor/js/ace/mode-nunjucks.js +1138 -1378
  264. package/src/sap/ui/codeeditor/js/ace/mode-objectivec.js +400 -514
  265. package/src/sap/ui/codeeditor/js/ace/mode-ocaml.js +77 -120
  266. package/src/sap/ui/codeeditor/js/ace/mode-odin.js +449 -0
  267. package/src/sap/ui/codeeditor/js/ace/mode-partiql.js +750 -0
  268. package/src/sap/ui/codeeditor/js/ace/mode-pascal.js +28 -47
  269. package/src/sap/ui/codeeditor/js/ace/mode-perl.js +122 -185
  270. package/src/sap/ui/codeeditor/js/ace/mode-pgsql.js +974 -851
  271. package/src/sap/ui/codeeditor/js/ace/mode-php.js +2282 -1502
  272. package/src/sap/ui/codeeditor/js/ace/mode-php_laravel_blade.js +2463 -1696
  273. package/src/sap/ui/codeeditor/js/ace/mode-pig.js +133 -165
  274. package/src/sap/ui/codeeditor/js/ace/mode-plain_text.js +5 -10
  275. package/src/sap/ui/codeeditor/js/ace/mode-plsql.js +268 -0
  276. package/src/sap/ui/codeeditor/js/ace/mode-powershell.js +332 -183
  277. package/src/sap/ui/codeeditor/js/ace/mode-praat.js +168 -234
  278. package/src/sap/ui/codeeditor/js/ace/mode-prisma.js +292 -324
  279. package/src/sap/ui/codeeditor/js/ace/mode-prolog.js +180 -246
  280. package/src/sap/ui/codeeditor/js/ace/mode-properties.js +26 -37
  281. package/src/sap/ui/codeeditor/js/ace/mode-protobuf.js +232 -327
  282. package/src/sap/ui/codeeditor/js/ace/mode-prql.js +320 -0
  283. package/src/sap/ui/codeeditor/js/ace/mode-puppet.js +68 -120
  284. package/src/sap/ui/codeeditor/js/ace/mode-python.js +338 -370
  285. package/src/sap/ui/codeeditor/js/ace/mode-qml.js +244 -279
  286. package/src/sap/ui/codeeditor/js/ace/mode-r.js +295 -220
  287. package/src/sap/ui/codeeditor/js/ace/mode-raku.js +356 -433
  288. package/src/sap/ui/codeeditor/js/ace/mode-razor.js +1130 -1374
  289. package/src/sap/ui/codeeditor/js/ace/mode-rdoc.js +214 -171
  290. package/src/sap/ui/codeeditor/js/ace/mode-red.js +212 -274
  291. package/src/sap/ui/codeeditor/js/ace/mode-redshift.js +181 -220
  292. package/src/sap/ui/codeeditor/js/ace/mode-rhtml.js +1325 -1443
  293. package/src/sap/ui/codeeditor/js/ace/mode-robot.js +168 -0
  294. package/src/sap/ui/codeeditor/js/ace/mode-rst.js +217 -229
  295. package/src/sap/ui/codeeditor/js/ace/mode-ruby.js +338 -420
  296. package/src/sap/ui/codeeditor/js/ace/mode-rust.js +258 -155
  297. package/src/sap/ui/codeeditor/js/ace/mode-sac.js +349 -0
  298. package/src/sap/ui/codeeditor/js/ace/mode-sass.js +257 -309
  299. package/src/sap/ui/codeeditor/js/ace/mode-scad.js +127 -191
  300. package/src/sap/ui/codeeditor/js/ace/mode-scala.js +572 -468
  301. package/src/sap/ui/codeeditor/js/ace/mode-scheme.js +104 -126
  302. package/src/sap/ui/codeeditor/js/ace/mode-scrypt.js +181 -228
  303. package/src/sap/ui/codeeditor/js/ace/mode-scss.js +364 -472
  304. package/src/sap/ui/codeeditor/js/ace/mode-sh.js +204 -266
  305. package/src/sap/ui/codeeditor/js/ace/mode-sjs.js +477 -405
  306. package/src/sap/ui/codeeditor/js/ace/mode-slim.js +2631 -3161
  307. package/src/sap/ui/codeeditor/js/ace/mode-smarty.js +1075 -1334
  308. package/src/sap/ui/codeeditor/js/ace/mode-smithy.js +276 -327
  309. package/src/sap/ui/codeeditor/js/ace/mode-snippets.js +78 -102
  310. package/src/sap/ui/codeeditor/js/ace/mode-soy_template.js +1251 -1548
  311. package/src/sap/ui/codeeditor/js/ace/mode-space.js +47 -63
  312. package/src/sap/ui/codeeditor/js/ace/mode-sparql.js +139 -171
  313. package/src/sap/ui/codeeditor/js/ace/mode-sql.js +77 -133
  314. package/src/sap/ui/codeeditor/js/ace/mode-sqlserver.js +138 -192
  315. package/src/sap/ui/codeeditor/js/ace/mode-stylus.js +306 -338
  316. package/src/sap/ui/codeeditor/js/ace/mode-svg.js +642 -794
  317. package/src/sap/ui/codeeditor/js/ace/mode-swift.js +96 -150
  318. package/src/sap/ui/codeeditor/js/ace/mode-tcl.js +151 -200
  319. package/src/sap/ui/codeeditor/js/ace/mode-terraform.js +78 -132
  320. package/src/sap/ui/codeeditor/js/ace/mode-tex.js +148 -96
  321. package/src/sap/ui/codeeditor/js/ace/mode-textile.js +45 -70
  322. package/src/sap/ui/codeeditor/js/ace/mode-toml.js +63 -87
  323. package/src/sap/ui/codeeditor/js/ace/mode-tsx.js +462 -384
  324. package/src/sap/ui/codeeditor/js/ace/mode-turtle.js +119 -151
  325. package/src/sap/ui/codeeditor/js/ace/mode-twig.js +1099 -1350
  326. package/src/sap/ui/codeeditor/js/ace/mode-typescript.js +455 -376
  327. package/src/sap/ui/codeeditor/js/ace/mode-vala.js +382 -505
  328. package/src/sap/ui/codeeditor/js/ace/mode-vbscript.js +231 -264
  329. package/src/sap/ui/codeeditor/js/ace/mode-velocity.js +1116 -1388
  330. package/src/sap/ui/codeeditor/js/ace/mode-verilog.js +61 -81
  331. package/src/sap/ui/codeeditor/js/ace/mode-vhdl.js +57 -79
  332. package/src/sap/ui/codeeditor/js/ace/mode-visualforce.js +1046 -1292
  333. package/src/sap/ui/codeeditor/js/ace/mode-wollok.js +525 -417
  334. package/src/sap/ui/codeeditor/js/ace/mode-xml.js +182 -389
  335. package/src/sap/ui/codeeditor/js/ace/mode-xquery.js +58 -112
  336. package/src/sap/ui/codeeditor/js/ace/mode-yaml.js +202 -137
  337. package/src/sap/ui/codeeditor/js/ace/mode-zeek.js +237 -274
  338. package/src/sap/ui/codeeditor/js/ace/snippets/abc.js +5 -34
  339. package/src/sap/ui/codeeditor/js/ace/snippets/actionscript.js +5 -160
  340. package/src/sap/ui/codeeditor/js/ace/snippets/astro.js +9 -0
  341. package/src/sap/ui/codeeditor/js/ace/snippets/bibtex.js +9 -0
  342. package/src/sap/ui/codeeditor/js/ace/snippets/c_cpp.js +5 -134
  343. package/src/sap/ui/codeeditor/js/ace/snippets/clojure.js +5 -93
  344. package/src/sap/ui/codeeditor/js/ace/snippets/coffee.js +5 -98
  345. package/src/sap/ui/codeeditor/js/ace/snippets/csound_document.js +5 -13
  346. package/src/sap/ui/codeeditor/js/ace/snippets/csound_orchestra.js +5 -50
  347. package/src/sap/ui/codeeditor/js/ace/snippets/css.js +5 -970
  348. package/src/sap/ui/codeeditor/js/ace/snippets/cuttlefish.js +9 -0
  349. package/src/sap/ui/codeeditor/js/ace/snippets/dart.js +5 -86
  350. package/src/sap/ui/codeeditor/js/ace/snippets/diff.js +5 -14
  351. package/src/sap/ui/codeeditor/js/ace/snippets/django.js +5 -111
  352. package/src/sap/ui/codeeditor/js/ace/snippets/drools.js +5 -22
  353. package/src/sap/ui/codeeditor/js/ace/snippets/edifact.js +8 -246
  354. package/src/sap/ui/codeeditor/js/ace/snippets/erlang.js +5 -163
  355. package/src/sap/ui/codeeditor/js/ace/snippets/flix.js +9 -0
  356. package/src/sap/ui/codeeditor/js/ace/snippets/fsl.js +6 -4
  357. package/src/sap/ui/codeeditor/js/ace/snippets/gobstones.js +5 -1707
  358. package/src/sap/ui/codeeditor/js/ace/snippets/graphqlschema.js +5 -35
  359. package/src/sap/ui/codeeditor/js/ace/snippets/haml.js +5 -23
  360. package/src/sap/ui/codeeditor/js/ace/snippets/haskell.js +5 -85
  361. package/src/sap/ui/codeeditor/js/ace/snippets/html.js +5 -856
  362. package/src/sap/ui/codeeditor/js/ace/snippets/io.js +1 -3
  363. package/src/sap/ui/codeeditor/js/ace/snippets/ion.js +9 -0
  364. package/src/sap/ui/codeeditor/js/ace/snippets/java.js +5 -243
  365. package/src/sap/ui/codeeditor/js/ace/snippets/javascript.js +5 -198
  366. package/src/sap/ui/codeeditor/js/ace/snippets/jexl.js +9 -0
  367. package/src/sap/ui/codeeditor/js/ace/snippets/jsoniq.js +44 -41
  368. package/src/sap/ui/codeeditor/js/ace/snippets/jsp.js +5 -102
  369. package/src/sap/ui/codeeditor/js/ace/snippets/liquid.js +5 -884
  370. package/src/sap/ui/codeeditor/js/ace/snippets/lsl.js +5 -1235
  371. package/src/sap/ui/codeeditor/js/ace/snippets/lua.js +5 -24
  372. package/src/sap/ui/codeeditor/js/ace/snippets/makefile.js +5 -7
  373. package/src/sap/ui/codeeditor/js/ace/snippets/markdown.js +5 -91
  374. package/src/sap/ui/codeeditor/js/ace/snippets/maze.js +5 -12
  375. package/src/sap/ui/codeeditor/js/ace/snippets/nasal.js +9 -0
  376. package/src/sap/ui/codeeditor/js/ace/snippets/odin.js +9 -0
  377. package/src/sap/ui/codeeditor/js/ace/snippets/partiql.js +9 -0
  378. package/src/sap/ui/codeeditor/js/ace/snippets/perl.js +5 -350
  379. package/src/sap/ui/codeeditor/js/ace/snippets/php.js +5 -386
  380. package/src/sap/ui/codeeditor/js/ace/snippets/plsql.js +9 -0
  381. package/src/sap/ui/codeeditor/js/ace/snippets/prql.js +9 -0
  382. package/src/sap/ui/codeeditor/js/ace/snippets/python.js +5 -161
  383. package/src/sap/ui/codeeditor/js/ace/snippets/r.js +5 -124
  384. package/src/sap/ui/codeeditor/js/ace/snippets/razor.js +5 -6
  385. package/src/sap/ui/codeeditor/js/ace/snippets/robot.js +16 -0
  386. package/src/sap/ui/codeeditor/js/ace/snippets/rst.js +5 -25
  387. package/src/sap/ui/codeeditor/js/ace/snippets/ruby.js +5 -931
  388. package/src/sap/ui/codeeditor/js/ace/snippets/sac.js +9 -0
  389. package/src/sap/ui/codeeditor/js/ace/snippets/sh.js +5 -86
  390. package/src/sap/ui/codeeditor/js/ace/snippets/snippets.js +5 -12
  391. package/src/sap/ui/codeeditor/js/ace/snippets/sql.js +5 -29
  392. package/src/sap/ui/codeeditor/js/ace/snippets/sqlserver.js +5 -72
  393. package/src/sap/ui/codeeditor/js/ace/snippets/tcl.js +5 -95
  394. package/src/sap/ui/codeeditor/js/ace/snippets/tex.js +5 -193
  395. package/src/sap/ui/codeeditor/js/ace/snippets/textile.js +5 -33
  396. package/src/sap/ui/codeeditor/js/ace/snippets/vala.js +1 -2
  397. package/src/sap/ui/codeeditor/js/ace/snippets/velocity.js +5 -31
  398. package/src/sap/ui/codeeditor/js/ace/snippets/wollok.js +5 -87
  399. package/src/sap/ui/codeeditor/js/ace/snippets/xquery.js +44 -41
  400. package/src/sap/ui/codeeditor/js/ace/theme-ambiance.js +5 -172
  401. package/src/sap/ui/codeeditor/js/ace/theme-chaos.js +5 -150
  402. package/src/sap/ui/codeeditor/js/ace/theme-chrome.js +6 -123
  403. package/src/sap/ui/codeeditor/js/ace/theme-cloud9_day.js +19 -0
  404. package/src/sap/ui/codeeditor/js/ace/theme-cloud9_night.js +18 -0
  405. package/src/sap/ui/codeeditor/js/ace/theme-cloud9_night_low_color.js +18 -0
  406. package/src/sap/ui/codeeditor/js/ace/theme-clouds.js +6 -90
  407. package/src/sap/ui/codeeditor/js/ace/theme-clouds_midnight.js +6 -91
  408. package/src/sap/ui/codeeditor/js/ace/theme-cobalt.js +6 -108
  409. package/src/sap/ui/codeeditor/js/ace/theme-crimson_editor.js +6 -113
  410. package/src/sap/ui/codeeditor/js/ace/theme-dawn.js +6 -103
  411. package/src/sap/ui/codeeditor/js/ace/theme-dracula.js +6 -122
  412. package/src/sap/ui/codeeditor/js/ace/theme-dreamweaver.js +7 -137
  413. package/src/sap/ui/codeeditor/js/ace/theme-eclipse.js +6 -92
  414. package/src/sap/ui/codeeditor/js/ace/theme-github.js +7 -99
  415. package/src/sap/ui/codeeditor/js/ace/theme-github_dark.js +18 -0
  416. package/src/sap/ui/codeeditor/js/ace/theme-gob.js +6 -107
  417. package/src/sap/ui/codeeditor/js/ace/theme-gruvbox.js +5 -76
  418. package/src/sap/ui/codeeditor/js/ace/theme-gruvbox_dark_hard.js +18 -0
  419. package/src/sap/ui/codeeditor/js/ace/theme-gruvbox_light_hard.js +18 -0
  420. package/src/sap/ui/codeeditor/js/ace/theme-idle_fingers.js +6 -91
  421. package/src/sap/ui/codeeditor/js/ace/theme-iplastic.js +6 -116
  422. package/src/sap/ui/codeeditor/js/ace/theme-katzenmilch.js +6 -116
  423. package/src/sap/ui/codeeditor/js/ace/theme-kr_theme.js +6 -99
  424. package/src/sap/ui/codeeditor/js/ace/theme-kuroir.js +6 -56
  425. package/src/sap/ui/codeeditor/js/ace/theme-merbivore.js +6 -90
  426. package/src/sap/ui/codeeditor/js/ace/theme-merbivore_soft.js +6 -91
  427. package/src/sap/ui/codeeditor/js/ace/theme-mono_industrial.js +6 -102
  428. package/src/sap/ui/codeeditor/js/ace/theme-monokai.js +6 -100
  429. package/src/sap/ui/codeeditor/js/ace/theme-nord_dark.js +6 -89
  430. package/src/sap/ui/codeeditor/js/ace/theme-one_dark.js +10 -131
  431. package/src/sap/ui/codeeditor/js/ace/theme-pastel_on_dark.js +6 -103
  432. package/src/sap/ui/codeeditor/js/ace/theme-solarized_dark.js +6 -83
  433. package/src/sap/ui/codeeditor/js/ace/theme-solarized_light.js +6 -86
  434. package/src/sap/ui/codeeditor/js/ace/theme-sqlserver.js +6 -133
  435. package/src/sap/ui/codeeditor/js/ace/theme-terminal.js +6 -109
  436. package/src/sap/ui/codeeditor/js/ace/theme-textmate.js +3 -124
  437. package/src/sap/ui/codeeditor/js/ace/theme-tomorrow.js +6 -103
  438. package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night.js +6 -103
  439. package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night_blue.js +6 -101
  440. package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night_bright.js +6 -116
  441. package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night_eighties.js +6 -103
  442. package/src/sap/ui/codeeditor/js/ace/theme-twilight.js +6 -104
  443. package/src/sap/ui/codeeditor/js/ace/theme-vibrant_ink.js +6 -89
  444. package/src/sap/ui/codeeditor/js/ace/theme-xcode.js +6 -83
  445. package/src/sap/ui/codeeditor/js/ace/worker-base.js +516 -595
  446. package/src/sap/ui/codeeditor/js/ace/worker-coffee.js +496 -575
  447. package/src/sap/ui/codeeditor/js/ace/worker-css.js +501 -578
  448. package/src/sap/ui/codeeditor/js/ace/worker-html.js +515 -584
  449. package/src/sap/ui/codeeditor/js/ace/worker-javascript.js +2964 -2551
  450. package/src/sap/ui/codeeditor/js/ace/worker-json.js +496 -575
  451. package/src/sap/ui/codeeditor/js/ace/worker-lua.js +497 -576
  452. package/src/sap/ui/codeeditor/js/ace/worker-php.js +2906 -2795
  453. package/src/sap/ui/codeeditor/js/ace/worker-xml.js +496 -575
  454. package/src/sap/ui/codeeditor/js/ace/worker-xquery.js +496 -575
  455. package/src/sap/ui/codeeditor/js/ace/worker-yaml.js +5851 -0
  456. package/src/sap/ui/codeeditor/library.js +6 -5
  457. package/LICENSES/BSD-2-Clause.txt +0 -22
@@ -0,0 +1,3269 @@
1
+ ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"], function(require, exports, module){"use strict";
2
+ var dom = require("./lib/dom");
3
+ var oop = require("./lib/oop");
4
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
5
+ var lang = require("./lib/lang");
6
+ var Range = require("./range").Range;
7
+ var RangeList = require("./range_list").RangeList;
8
+ var HashHandler = require("./keyboard/hash_handler").HashHandler;
9
+ var Tokenizer = require("./tokenizer").Tokenizer;
10
+ var clipboard = require("./clipboard");
11
+ var VARIABLES = {
12
+ CURRENT_WORD: function (editor) {
13
+ return editor.session.getTextRange(editor.session.getWordRange());
14
+ },
15
+ SELECTION: function (editor, name, indentation) {
16
+ var text = editor.session.getTextRange();
17
+ if (indentation)
18
+ return text.replace(/\n\r?([ \t]*\S)/g, "\n" + indentation + "$1");
19
+ return text;
20
+ },
21
+ CURRENT_LINE: function (editor) {
22
+ return editor.session.getLine(editor.getCursorPosition().row);
23
+ },
24
+ PREV_LINE: function (editor) {
25
+ return editor.session.getLine(editor.getCursorPosition().row - 1);
26
+ },
27
+ LINE_INDEX: function (editor) {
28
+ return editor.getCursorPosition().row;
29
+ },
30
+ LINE_NUMBER: function (editor) {
31
+ return editor.getCursorPosition().row + 1;
32
+ },
33
+ SOFT_TABS: function (editor) {
34
+ return editor.session.getUseSoftTabs() ? "YES" : "NO";
35
+ },
36
+ TAB_SIZE: function (editor) {
37
+ return editor.session.getTabSize();
38
+ },
39
+ CLIPBOARD: function (editor) {
40
+ return clipboard.getText && clipboard.getText();
41
+ },
42
+ FILENAME: function (editor) {
43
+ return /[^/\\]*$/.exec(this.FILEPATH(editor))[0];
44
+ },
45
+ FILENAME_BASE: function (editor) {
46
+ return /[^/\\]*$/.exec(this.FILEPATH(editor))[0].replace(/\.[^.]*$/, "");
47
+ },
48
+ DIRECTORY: function (editor) {
49
+ return this.FILEPATH(editor).replace(/[^/\\]*$/, "");
50
+ },
51
+ FILEPATH: function (editor) { return "/not implemented.txt"; },
52
+ WORKSPACE_NAME: function () { return "Unknown"; },
53
+ FULLNAME: function () { return "Unknown"; },
54
+ BLOCK_COMMENT_START: function (editor) {
55
+ var mode = editor.session.$mode || {};
56
+ return mode.blockComment && mode.blockComment.start || "";
57
+ },
58
+ BLOCK_COMMENT_END: function (editor) {
59
+ var mode = editor.session.$mode || {};
60
+ return mode.blockComment && mode.blockComment.end || "";
61
+ },
62
+ LINE_COMMENT: function (editor) {
63
+ var mode = editor.session.$mode || {};
64
+ return mode.lineCommentStart || "";
65
+ },
66
+ CURRENT_YEAR: date.bind(null, { year: "numeric" }),
67
+ CURRENT_YEAR_SHORT: date.bind(null, { year: "2-digit" }),
68
+ CURRENT_MONTH: date.bind(null, { month: "numeric" }),
69
+ CURRENT_MONTH_NAME: date.bind(null, { month: "long" }),
70
+ CURRENT_MONTH_NAME_SHORT: date.bind(null, { month: "short" }),
71
+ CURRENT_DATE: date.bind(null, { day: "2-digit" }),
72
+ CURRENT_DAY_NAME: date.bind(null, { weekday: "long" }),
73
+ CURRENT_DAY_NAME_SHORT: date.bind(null, { weekday: "short" }),
74
+ CURRENT_HOUR: date.bind(null, { hour: "2-digit", hour12: false }),
75
+ CURRENT_MINUTE: date.bind(null, { minute: "2-digit" }),
76
+ CURRENT_SECOND: date.bind(null, { second: "2-digit" })
77
+ };
78
+ VARIABLES.SELECTED_TEXT = VARIABLES.SELECTION;
79
+ function date(dateFormat) {
80
+ var str = new Date().toLocaleString("en-us", dateFormat);
81
+ return str.length == 1 ? "0" + str : str;
82
+ }
83
+ var SnippetManager = /** @class */ (function () {
84
+ function SnippetManager() {
85
+ this.snippetMap = {};
86
+ this.snippetNameMap = {};
87
+ this.variables = VARIABLES;
88
+ }
89
+ SnippetManager.prototype.getTokenizer = function () {
90
+ return SnippetManager.$tokenizer || this.createTokenizer();
91
+ };
92
+ SnippetManager.prototype.createTokenizer = function () {
93
+ function TabstopToken(str) {
94
+ str = str.substr(1);
95
+ if (/^\d+$/.test(str))
96
+ return [{ tabstopId: parseInt(str, 10) }];
97
+ return [{ text: str }];
98
+ }
99
+ function escape(ch) {
100
+ return "(?:[^\\\\" + ch + "]|\\\\.)";
101
+ }
102
+ var formatMatcher = {
103
+ regex: "/(" + escape("/") + "+)/",
104
+ onMatch: function (val, state, stack) {
105
+ var ts = stack[0];
106
+ ts.fmtString = true;
107
+ ts.guard = val.slice(1, -1);
108
+ ts.flag = "";
109
+ return "";
110
+ },
111
+ next: "formatString"
112
+ };
113
+ SnippetManager.$tokenizer = new Tokenizer({
114
+ start: [
115
+ { regex: /\\./, onMatch: function (val, state, stack) {
116
+ var ch = val[1];
117
+ if (ch == "}" && stack.length) {
118
+ val = ch;
119
+ }
120
+ else if ("`$\\".indexOf(ch) != -1) {
121
+ val = ch;
122
+ }
123
+ return [val];
124
+ } },
125
+ { regex: /}/, onMatch: function (val, state, stack) {
126
+ return [stack.length ? stack.shift() : val];
127
+ } },
128
+ { regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken },
129
+ { regex: /\$\{[\dA-Z_a-z]+/, onMatch: function (str, state, stack) {
130
+ var t = TabstopToken(str.substr(1));
131
+ stack.unshift(t[0]);
132
+ return t;
133
+ }, next: "snippetVar" },
134
+ { regex: /\n/, token: "newline", merge: false }
135
+ ],
136
+ snippetVar: [
137
+ { regex: "\\|" + escape("\\|") + "*\\|", onMatch: function (val, state, stack) {
138
+ var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function (operator) {
139
+ return operator.length == 2 ? operator[1] : "\x00";
140
+ }).split("\x00").map(function (value) {
141
+ return { value: value };
142
+ });
143
+ stack[0].choices = choices;
144
+ return [choices[0]];
145
+ }, next: "start" },
146
+ formatMatcher,
147
+ { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start" }
148
+ ],
149
+ formatString: [
150
+ { regex: /:/, onMatch: function (val, state, stack) {
151
+ if (stack.length && stack[0].expectElse) {
152
+ stack[0].expectElse = false;
153
+ stack[0].ifEnd = { elseEnd: stack[0] };
154
+ return [stack[0].ifEnd];
155
+ }
156
+ return ":";
157
+ } },
158
+ { regex: /\\./, onMatch: function (val, state, stack) {
159
+ var ch = val[1];
160
+ if (ch == "}" && stack.length)
161
+ val = ch;
162
+ else if ("`$\\".indexOf(ch) != -1)
163
+ val = ch;
164
+ else if (ch == "n")
165
+ val = "\n";
166
+ else if (ch == "t")
167
+ val = "\t";
168
+ else if ("ulULE".indexOf(ch) != -1)
169
+ val = { changeCase: ch, local: ch > "a" };
170
+ return [val];
171
+ } },
172
+ { regex: "/\\w*}", onMatch: function (val, state, stack) {
173
+ var next = stack.shift();
174
+ if (next)
175
+ next.flag = val.slice(1, -1);
176
+ this.next = next && next.tabstopId ? "start" : "";
177
+ return [next || val];
178
+ }, next: "start" },
179
+ { regex: /\$(?:\d+|\w+)/, onMatch: function (val, state, stack) {
180
+ return [{ text: val.slice(1) }];
181
+ } },
182
+ { regex: /\${\w+/, onMatch: function (val, state, stack) {
183
+ var token = { text: val.slice(2) };
184
+ stack.unshift(token);
185
+ return [token];
186
+ }, next: "formatStringVar" },
187
+ { regex: /\n/, token: "newline", merge: false },
188
+ { regex: /}/, onMatch: function (val, state, stack) {
189
+ var next = stack.shift();
190
+ this.next = next && next.tabstopId ? "start" : "";
191
+ return [next || val];
192
+ }, next: "start" }
193
+ ],
194
+ formatStringVar: [
195
+ { regex: /:\/\w+}/, onMatch: function (val, state, stack) {
196
+ var ts = stack[0];
197
+ ts.formatFunction = val.slice(2, -1);
198
+ return [stack.shift()];
199
+ }, next: "formatString" },
200
+ formatMatcher,
201
+ { regex: /:[\?\-+]?/, onMatch: function (val, state, stack) {
202
+ if (val[1] == "+")
203
+ stack[0].ifEnd = stack[0];
204
+ if (val[1] == "?")
205
+ stack[0].expectElse = true;
206
+ }, next: "formatString" },
207
+ { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString" }
208
+ ]
209
+ });
210
+ return SnippetManager.$tokenizer;
211
+ };
212
+ SnippetManager.prototype.tokenizeTmSnippet = function (str, startState) {
213
+ return this.getTokenizer().getLineTokens(str, startState).tokens.map(function (x) {
214
+ return x.value || x;
215
+ });
216
+ };
217
+ SnippetManager.prototype.getVariableValue = function (editor, name, indentation) {
218
+ if (/^\d+$/.test(name))
219
+ return (this.variables.__ || {})[name] || "";
220
+ if (/^[A-Z]\d+$/.test(name))
221
+ return (this.variables[name[0] + "__"] || {})[name.substr(1)] || "";
222
+ name = name.replace(/^TM_/, "");
223
+ if (!this.variables.hasOwnProperty(name))
224
+ return "";
225
+ var value = this.variables[name];
226
+ if (typeof value == "function")
227
+ value = this.variables[name](editor, name, indentation);
228
+ return value == null ? "" : value;
229
+ };
230
+ SnippetManager.prototype.tmStrFormat = function (str, ch, editor) {
231
+ if (!ch.fmt)
232
+ return str;
233
+ var flag = ch.flag || "";
234
+ var re = ch.guard;
235
+ re = new RegExp(re, flag.replace(/[^gim]/g, ""));
236
+ var fmtTokens = typeof ch.fmt == "string" ? this.tokenizeTmSnippet(ch.fmt, "formatString") : ch.fmt;
237
+ var _self = this;
238
+ var formatted = str.replace(re, function () {
239
+ var oldArgs = _self.variables.__;
240
+ _self.variables.__ = [].slice.call(arguments);
241
+ var fmtParts = _self.resolveVariables(fmtTokens, editor);
242
+ var gChangeCase = "E";
243
+ for (var i = 0; i < fmtParts.length; i++) {
244
+ var ch = fmtParts[i];
245
+ if (typeof ch == "object") {
246
+ fmtParts[i] = "";
247
+ if (ch.changeCase && ch.local) {
248
+ var next = fmtParts[i + 1];
249
+ if (next && typeof next == "string") {
250
+ if (ch.changeCase == "u")
251
+ fmtParts[i] = next[0].toUpperCase();
252
+ else
253
+ fmtParts[i] = next[0].toLowerCase();
254
+ fmtParts[i + 1] = next.substr(1);
255
+ }
256
+ }
257
+ else if (ch.changeCase) {
258
+ gChangeCase = ch.changeCase;
259
+ }
260
+ }
261
+ else if (gChangeCase == "U") {
262
+ fmtParts[i] = ch.toUpperCase();
263
+ }
264
+ else if (gChangeCase == "L") {
265
+ fmtParts[i] = ch.toLowerCase();
266
+ }
267
+ }
268
+ _self.variables.__ = oldArgs;
269
+ return fmtParts.join("");
270
+ });
271
+ return formatted;
272
+ };
273
+ SnippetManager.prototype.tmFormatFunction = function (str, ch, editor) {
274
+ if (ch.formatFunction == "upcase")
275
+ return str.toUpperCase();
276
+ if (ch.formatFunction == "downcase")
277
+ return str.toLowerCase();
278
+ return str;
279
+ };
280
+ SnippetManager.prototype.resolveVariables = function (snippet, editor) {
281
+ var result = [];
282
+ var indentation = "";
283
+ var afterNewLine = true;
284
+ for (var i = 0; i < snippet.length; i++) {
285
+ var ch = snippet[i];
286
+ if (typeof ch == "string") {
287
+ result.push(ch);
288
+ if (ch == "\n") {
289
+ afterNewLine = true;
290
+ indentation = "";
291
+ }
292
+ else if (afterNewLine) {
293
+ indentation = /^\t*/.exec(ch)[0];
294
+ afterNewLine = /\S/.test(ch);
295
+ }
296
+ continue;
297
+ }
298
+ if (!ch)
299
+ continue;
300
+ afterNewLine = false;
301
+ if (ch.fmtString) {
302
+ var j = snippet.indexOf(ch, i + 1);
303
+ if (j == -1)
304
+ j = snippet.length;
305
+ ch.fmt = snippet.slice(i + 1, j);
306
+ i = j;
307
+ }
308
+ if (ch.text) {
309
+ var value = this.getVariableValue(editor, ch.text, indentation) + "";
310
+ if (ch.fmtString)
311
+ value = this.tmStrFormat(value, ch, editor);
312
+ if (ch.formatFunction)
313
+ value = this.tmFormatFunction(value, ch, editor);
314
+ if (value && !ch.ifEnd) {
315
+ result.push(value);
316
+ gotoNext(ch);
317
+ }
318
+ else if (!value && ch.ifEnd) {
319
+ gotoNext(ch.ifEnd);
320
+ }
321
+ }
322
+ else if (ch.elseEnd) {
323
+ gotoNext(ch.elseEnd);
324
+ }
325
+ else if (ch.tabstopId != null) {
326
+ result.push(ch);
327
+ }
328
+ else if (ch.changeCase != null) {
329
+ result.push(ch);
330
+ }
331
+ }
332
+ function gotoNext(ch) {
333
+ var i1 = snippet.indexOf(ch, i + 1);
334
+ if (i1 != -1)
335
+ i = i1;
336
+ }
337
+ return result;
338
+ };
339
+ SnippetManager.prototype.getDisplayTextForSnippet = function (editor, snippetText) {
340
+ var processedSnippet = processSnippetText.call(this, editor, snippetText);
341
+ return processedSnippet.text;
342
+ };
343
+ SnippetManager.prototype.insertSnippetForSelection = function (editor, snippetText, options) {
344
+ if (options === void 0) { options = {}; }
345
+ var processedSnippet = processSnippetText.call(this, editor, snippetText, options);
346
+ var range = editor.getSelectionRange();
347
+ var end = editor.session.replace(range, processedSnippet.text);
348
+ var tabstopManager = new TabstopManager(editor);
349
+ var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
350
+ tabstopManager.addTabstops(processedSnippet.tabstops, range.start, end, selectionId);
351
+ };
352
+ SnippetManager.prototype.insertSnippet = function (editor, snippetText, options) {
353
+ if (options === void 0) { options = {}; }
354
+ var self = this;
355
+ if (editor.inVirtualSelectionMode)
356
+ return self.insertSnippetForSelection(editor, snippetText, options);
357
+ editor.forEachSelection(function () {
358
+ self.insertSnippetForSelection(editor, snippetText, options);
359
+ }, null, { keepOrder: true });
360
+ if (editor.tabstopManager)
361
+ editor.tabstopManager.tabNext();
362
+ };
363
+ SnippetManager.prototype.$getScope = function (editor) {
364
+ var scope = editor.session.$mode.$id || "";
365
+ scope = scope.split("/").pop();
366
+ if (scope === "html" || scope === "php") {
367
+ if (scope === "php" && !editor.session.$mode.inlinePhp)
368
+ scope = "html";
369
+ var c = editor.getCursorPosition();
370
+ var state = editor.session.getState(c.row);
371
+ if (typeof state === "object") {
372
+ state = state[0];
373
+ }
374
+ if (state.substring) {
375
+ if (state.substring(0, 3) == "js-")
376
+ scope = "javascript";
377
+ else if (state.substring(0, 4) == "css-")
378
+ scope = "css";
379
+ else if (state.substring(0, 4) == "php-")
380
+ scope = "php";
381
+ }
382
+ }
383
+ return scope;
384
+ };
385
+ SnippetManager.prototype.getActiveScopes = function (editor) {
386
+ var scope = this.$getScope(editor);
387
+ var scopes = [scope];
388
+ var snippetMap = this.snippetMap;
389
+ if (snippetMap[scope] && snippetMap[scope].includeScopes) {
390
+ scopes.push.apply(scopes, snippetMap[scope].includeScopes);
391
+ }
392
+ scopes.push("_");
393
+ return scopes;
394
+ };
395
+ SnippetManager.prototype.expandWithTab = function (editor, options) {
396
+ var self = this;
397
+ var result = editor.forEachSelection(function () {
398
+ return self.expandSnippetForSelection(editor, options);
399
+ }, null, { keepOrder: true });
400
+ if (result && editor.tabstopManager)
401
+ editor.tabstopManager.tabNext();
402
+ return result;
403
+ };
404
+ SnippetManager.prototype.expandSnippetForSelection = function (editor, options) {
405
+ var cursor = editor.getCursorPosition();
406
+ var line = editor.session.getLine(cursor.row);
407
+ var before = line.substring(0, cursor.column);
408
+ var after = line.substr(cursor.column);
409
+ var snippetMap = this.snippetMap;
410
+ var snippet;
411
+ this.getActiveScopes(editor).some(function (scope) {
412
+ var snippets = snippetMap[scope];
413
+ if (snippets)
414
+ snippet = this.findMatchingSnippet(snippets, before, after);
415
+ return !!snippet;
416
+ }, this);
417
+ if (!snippet)
418
+ return false;
419
+ if (options && options.dryRun)
420
+ return true;
421
+ editor.session.doc.removeInLine(cursor.row, cursor.column - snippet.replaceBefore.length, cursor.column + snippet.replaceAfter.length);
422
+ this.variables.M__ = snippet.matchBefore;
423
+ this.variables.T__ = snippet.matchAfter;
424
+ this.insertSnippetForSelection(editor, snippet.content);
425
+ this.variables.M__ = this.variables.T__ = null;
426
+ return true;
427
+ };
428
+ SnippetManager.prototype.findMatchingSnippet = function (snippetList, before, after) {
429
+ for (var i = snippetList.length; i--;) {
430
+ var s = snippetList[i];
431
+ if (s.startRe && !s.startRe.test(before))
432
+ continue;
433
+ if (s.endRe && !s.endRe.test(after))
434
+ continue;
435
+ if (!s.startRe && !s.endRe)
436
+ continue;
437
+ s.matchBefore = s.startRe ? s.startRe.exec(before) : [""];
438
+ s.matchAfter = s.endRe ? s.endRe.exec(after) : [""];
439
+ s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : "";
440
+ s.replaceAfter = s.endTriggerRe ? s.endTriggerRe.exec(after)[0] : "";
441
+ return s;
442
+ }
443
+ };
444
+ SnippetManager.prototype.register = function (snippets, scope) {
445
+ var snippetMap = this.snippetMap;
446
+ var snippetNameMap = this.snippetNameMap;
447
+ var self = this;
448
+ if (!snippets)
449
+ snippets = [];
450
+ function wrapRegexp(src) {
451
+ if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
452
+ src = "(?:" + src + ")";
453
+ return src || "";
454
+ }
455
+ function guardedRegexp(re, guard, opening) {
456
+ re = wrapRegexp(re);
457
+ guard = wrapRegexp(guard);
458
+ if (opening) {
459
+ re = guard + re;
460
+ if (re && re[re.length - 1] != "$")
461
+ re = re + "$";
462
+ }
463
+ else {
464
+ re = re + guard;
465
+ if (re && re[0] != "^")
466
+ re = "^" + re;
467
+ }
468
+ return new RegExp(re);
469
+ }
470
+ function addSnippet(s) {
471
+ if (!s.scope)
472
+ s.scope = scope || "_";
473
+ scope = s.scope;
474
+ if (!snippetMap[scope]) {
475
+ snippetMap[scope] = [];
476
+ snippetNameMap[scope] = {};
477
+ }
478
+ var map = snippetNameMap[scope];
479
+ if (s.name) {
480
+ var old = map[s.name];
481
+ if (old)
482
+ self.unregister(old);
483
+ map[s.name] = s;
484
+ }
485
+ snippetMap[scope].push(s);
486
+ if (s.prefix)
487
+ s.tabTrigger = s.prefix;
488
+ if (!s.content && s.body)
489
+ s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body;
490
+ if (s.tabTrigger && !s.trigger) {
491
+ if (!s.guard && /^\w/.test(s.tabTrigger))
492
+ s.guard = "\\b";
493
+ s.trigger = lang.escapeRegExp(s.tabTrigger);
494
+ }
495
+ if (!s.trigger && !s.guard && !s.endTrigger && !s.endGuard)
496
+ return;
497
+ s.startRe = guardedRegexp(s.trigger, s.guard, true);
498
+ s.triggerRe = new RegExp(s.trigger);
499
+ s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
500
+ s.endTriggerRe = new RegExp(s.endTrigger);
501
+ }
502
+ if (Array.isArray(snippets)) {
503
+ snippets.forEach(addSnippet);
504
+ }
505
+ else {
506
+ Object.keys(snippets).forEach(function (key) {
507
+ addSnippet(snippets[key]);
508
+ });
509
+ }
510
+ this._signal("registerSnippets", { scope: scope });
511
+ };
512
+ SnippetManager.prototype.unregister = function (snippets, scope) {
513
+ var snippetMap = this.snippetMap;
514
+ var snippetNameMap = this.snippetNameMap;
515
+ function removeSnippet(s) {
516
+ var nameMap = snippetNameMap[s.scope || scope];
517
+ if (nameMap && nameMap[s.name]) {
518
+ delete nameMap[s.name];
519
+ var map = snippetMap[s.scope || scope];
520
+ var i = map && map.indexOf(s);
521
+ if (i >= 0)
522
+ map.splice(i, 1);
523
+ }
524
+ }
525
+ if (snippets.content)
526
+ removeSnippet(snippets);
527
+ else if (Array.isArray(snippets))
528
+ snippets.forEach(removeSnippet);
529
+ };
530
+ SnippetManager.prototype.parseSnippetFile = function (str) {
531
+ str = str.replace(/\r/g, "");
532
+ var list = [], snippet = {};
533
+ var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
534
+ var m;
535
+ while (m = re.exec(str)) {
536
+ if (m[1]) {
537
+ try {
538
+ snippet = JSON.parse(m[1]);
539
+ list.push(snippet);
540
+ }
541
+ catch (e) { }
542
+ }
543
+ if (m[4]) {
544
+ snippet.content = m[4].replace(/^\t/gm, "");
545
+ list.push(snippet);
546
+ snippet = {};
547
+ }
548
+ else {
549
+ var key = m[2], val = m[3];
550
+ if (key == "regex") {
551
+ var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
552
+ snippet.guard = guardRe.exec(val)[1];
553
+ snippet.trigger = guardRe.exec(val)[1];
554
+ snippet.endTrigger = guardRe.exec(val)[1];
555
+ snippet.endGuard = guardRe.exec(val)[1];
556
+ }
557
+ else if (key == "snippet") {
558
+ snippet.tabTrigger = val.match(/^\S*/)[0];
559
+ if (!snippet.name)
560
+ snippet.name = val;
561
+ }
562
+ else if (key) {
563
+ snippet[key] = val;
564
+ }
565
+ }
566
+ }
567
+ return list;
568
+ };
569
+ SnippetManager.prototype.getSnippetByName = function (name, editor) {
570
+ var snippetMap = this.snippetNameMap;
571
+ var snippet;
572
+ this.getActiveScopes(editor).some(function (scope) {
573
+ var snippets = snippetMap[scope];
574
+ if (snippets)
575
+ snippet = snippets[name];
576
+ return !!snippet;
577
+ }, this);
578
+ return snippet;
579
+ };
580
+ return SnippetManager;
581
+ }());
582
+ oop.implement(SnippetManager.prototype, EventEmitter);
583
+ var processSnippetText = function (editor, snippetText, options) {
584
+ if (options === void 0) { options = {}; }
585
+ var cursor = editor.getCursorPosition();
586
+ var line = editor.session.getLine(cursor.row);
587
+ var tabString = editor.session.getTabString();
588
+ var indentString = line.match(/^\s*/)[0];
589
+ if (cursor.column < indentString.length)
590
+ indentString = indentString.slice(0, cursor.column);
591
+ snippetText = snippetText.replace(/\r/g, "");
592
+ var tokens = this.tokenizeTmSnippet(snippetText);
593
+ tokens = this.resolveVariables(tokens, editor);
594
+ tokens = tokens.map(function (x) {
595
+ if (x == "\n" && !options.excludeExtraIndent)
596
+ return x + indentString;
597
+ if (typeof x == "string")
598
+ return x.replace(/\t/g, tabString);
599
+ return x;
600
+ });
601
+ var tabstops = [];
602
+ tokens.forEach(function (p, i) {
603
+ if (typeof p != "object")
604
+ return;
605
+ var id = p.tabstopId;
606
+ var ts = tabstops[id];
607
+ if (!ts) {
608
+ ts = tabstops[id] = [];
609
+ ts.index = id;
610
+ ts.value = "";
611
+ ts.parents = {};
612
+ }
613
+ if (ts.indexOf(p) !== -1)
614
+ return;
615
+ if (p.choices && !ts.choices)
616
+ ts.choices = p.choices;
617
+ ts.push(p);
618
+ var i1 = tokens.indexOf(p, i + 1);
619
+ if (i1 === -1)
620
+ return;
621
+ var value = tokens.slice(i + 1, i1);
622
+ var isNested = value.some(function (t) { return typeof t === "object"; });
623
+ if (isNested && !ts.value) {
624
+ ts.value = value;
625
+ }
626
+ else if (value.length && (!ts.value || typeof ts.value !== "string")) {
627
+ ts.value = value.join("");
628
+ }
629
+ });
630
+ tabstops.forEach(function (ts) { ts.length = 0; });
631
+ var expanding = {};
632
+ function copyValue(val) {
633
+ var copy = [];
634
+ for (var i = 0; i < val.length; i++) {
635
+ var p = val[i];
636
+ if (typeof p == "object") {
637
+ if (expanding[p.tabstopId])
638
+ continue;
639
+ var j = val.lastIndexOf(p, i - 1);
640
+ p = copy[j] || { tabstopId: p.tabstopId };
641
+ }
642
+ copy[i] = p;
643
+ }
644
+ return copy;
645
+ }
646
+ for (var i = 0; i < tokens.length; i++) {
647
+ var p = tokens[i];
648
+ if (typeof p != "object")
649
+ continue;
650
+ var id = p.tabstopId;
651
+ var ts = tabstops[id];
652
+ var i1 = tokens.indexOf(p, i + 1);
653
+ if (expanding[id]) {
654
+ if (expanding[id] === p) {
655
+ delete expanding[id];
656
+ Object.keys(expanding).forEach(function (parentId) {
657
+ ts.parents[parentId] = true;
658
+ });
659
+ }
660
+ continue;
661
+ }
662
+ expanding[id] = p;
663
+ var value = ts.value;
664
+ if (typeof value !== "string")
665
+ value = copyValue(value);
666
+ else if (p.fmt)
667
+ value = this.tmStrFormat(value, p, editor);
668
+ tokens.splice.apply(tokens, [i + 1, Math.max(0, i1 - i)].concat(value, p));
669
+ if (ts.indexOf(p) === -1)
670
+ ts.push(p);
671
+ }
672
+ var row = 0, column = 0;
673
+ var text = "";
674
+ tokens.forEach(function (t) {
675
+ if (typeof t === "string") {
676
+ var lines = t.split("\n");
677
+ if (lines.length > 1) {
678
+ column = lines[lines.length - 1].length;
679
+ row += lines.length - 1;
680
+ }
681
+ else
682
+ column += t.length;
683
+ text += t;
684
+ }
685
+ else if (t) {
686
+ if (!t.start)
687
+ t.start = { row: row, column: column };
688
+ else
689
+ t.end = { row: row, column: column };
690
+ }
691
+ });
692
+ return {
693
+ text: text,
694
+ tabstops: tabstops,
695
+ tokens: tokens
696
+ };
697
+ };
698
+ var TabstopManager = /** @class */ (function () {
699
+ function TabstopManager(editor) {
700
+ this.index = 0;
701
+ this.ranges = [];
702
+ this.tabstops = [];
703
+ if (editor.tabstopManager)
704
+ return editor.tabstopManager;
705
+ editor.tabstopManager = this;
706
+ this.$onChange = this.onChange.bind(this);
707
+ this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
708
+ this.$onChangeSession = this.onChangeSession.bind(this);
709
+ this.$onAfterExec = this.onAfterExec.bind(this);
710
+ this.attach(editor);
711
+ }
712
+ TabstopManager.prototype.attach = function (editor) {
713
+ this.$openTabstops = null;
714
+ this.selectedTabstop = null;
715
+ this.editor = editor;
716
+ this.session = editor.session;
717
+ this.editor.on("change", this.$onChange);
718
+ this.editor.on("changeSelection", this.$onChangeSelection);
719
+ this.editor.on("changeSession", this.$onChangeSession);
720
+ this.editor.commands.on("afterExec", this.$onAfterExec);
721
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
722
+ };
723
+ TabstopManager.prototype.detach = function () {
724
+ this.tabstops.forEach(this.removeTabstopMarkers, this);
725
+ this.ranges.length = 0;
726
+ this.tabstops.length = 0;
727
+ this.selectedTabstop = null;
728
+ this.editor.off("change", this.$onChange);
729
+ this.editor.off("changeSelection", this.$onChangeSelection);
730
+ this.editor.off("changeSession", this.$onChangeSession);
731
+ this.editor.commands.off("afterExec", this.$onAfterExec);
732
+ this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
733
+ this.editor.tabstopManager = null;
734
+ this.session = null;
735
+ this.editor = null;
736
+ };
737
+ TabstopManager.prototype.onChange = function (delta) {
738
+ var isRemove = delta.action[0] == "r";
739
+ var selectedTabstop = this.selectedTabstop || {};
740
+ var parents = selectedTabstop.parents || {};
741
+ var tabstops = this.tabstops.slice();
742
+ for (var i = 0; i < tabstops.length; i++) {
743
+ var ts = tabstops[i];
744
+ var active = ts == selectedTabstop || parents[ts.index];
745
+ ts.rangeList.$bias = active ? 0 : 1;
746
+ if (delta.action == "remove" && ts !== selectedTabstop) {
747
+ var parentActive = ts.parents && ts.parents[selectedTabstop.index];
748
+ var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
749
+ startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
750
+ var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
751
+ endIndex = endIndex < 0 ? -endIndex - 1 : endIndex - 1;
752
+ var toRemove = ts.rangeList.ranges.slice(startIndex, endIndex);
753
+ for (var j = 0; j < toRemove.length; j++)
754
+ this.removeRange(toRemove[j]);
755
+ }
756
+ ts.rangeList.$onChange(delta);
757
+ }
758
+ var session = this.session;
759
+ if (!this.$inChange && isRemove && session.getLength() == 1 && !session.getValue())
760
+ this.detach();
761
+ };
762
+ TabstopManager.prototype.updateLinkedFields = function () {
763
+ var ts = this.selectedTabstop;
764
+ if (!ts || !ts.hasLinkedRanges || !ts.firstNonLinked)
765
+ return;
766
+ this.$inChange = true;
767
+ var session = this.session;
768
+ var text = session.getTextRange(ts.firstNonLinked);
769
+ for (var i = 0; i < ts.length; i++) {
770
+ var range = ts[i];
771
+ if (!range.linked)
772
+ continue;
773
+ var original = range.original;
774
+ var fmt = exports.snippetManager.tmStrFormat(text, original, this.editor);
775
+ session.replace(range, fmt);
776
+ }
777
+ this.$inChange = false;
778
+ };
779
+ TabstopManager.prototype.onAfterExec = function (e) {
780
+ if (e.command && !e.command.readOnly)
781
+ this.updateLinkedFields();
782
+ };
783
+ TabstopManager.prototype.onChangeSelection = function () {
784
+ if (!this.editor)
785
+ return;
786
+ var lead = this.editor.selection.lead;
787
+ var anchor = this.editor.selection.anchor;
788
+ var isEmpty = this.editor.selection.isEmpty();
789
+ for (var i = 0; i < this.ranges.length; i++) {
790
+ if (this.ranges[i].linked)
791
+ continue;
792
+ var containsLead = this.ranges[i].contains(lead.row, lead.column);
793
+ var containsAnchor = isEmpty || this.ranges[i].contains(anchor.row, anchor.column);
794
+ if (containsLead && containsAnchor)
795
+ return;
796
+ }
797
+ this.detach();
798
+ };
799
+ TabstopManager.prototype.onChangeSession = function () {
800
+ this.detach();
801
+ };
802
+ TabstopManager.prototype.tabNext = function (dir) {
803
+ var max = this.tabstops.length;
804
+ var index = this.index + (dir || 1);
805
+ index = Math.min(Math.max(index, 1), max);
806
+ if (index == max)
807
+ index = 0;
808
+ this.selectTabstop(index);
809
+ if (index === 0)
810
+ this.detach();
811
+ };
812
+ TabstopManager.prototype.selectTabstop = function (index) {
813
+ this.$openTabstops = null;
814
+ var ts = this.tabstops[this.index];
815
+ if (ts)
816
+ this.addTabstopMarkers(ts);
817
+ this.index = index;
818
+ ts = this.tabstops[this.index];
819
+ if (!ts || !ts.length)
820
+ return;
821
+ this.selectedTabstop = ts;
822
+ var range = ts.firstNonLinked || ts;
823
+ if (ts.choices)
824
+ range.cursor = range.start;
825
+ if (!this.editor.inVirtualSelectionMode) {
826
+ var sel = this.editor.multiSelect;
827
+ sel.toSingleRange(range);
828
+ for (var i = 0; i < ts.length; i++) {
829
+ if (ts.hasLinkedRanges && ts[i].linked)
830
+ continue;
831
+ sel.addRange(ts[i].clone(), true);
832
+ }
833
+ }
834
+ else {
835
+ this.editor.selection.fromOrientedRange(range);
836
+ }
837
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
838
+ if (this.selectedTabstop && this.selectedTabstop.choices)
839
+ this.editor.execCommand("startAutocomplete", { matches: this.selectedTabstop.choices });
840
+ };
841
+ TabstopManager.prototype.addTabstops = function (tabstops, start, end) {
842
+ var useLink = this.useLink || !this.editor.getOption("enableMultiselect");
843
+ if (!this.$openTabstops)
844
+ this.$openTabstops = [];
845
+ if (!tabstops[0]) {
846
+ var p = Range.fromPoints(end, end);
847
+ moveRelative(p.start, start);
848
+ moveRelative(p.end, start);
849
+ tabstops[0] = [p];
850
+ tabstops[0].index = 0;
851
+ }
852
+ var i = this.index;
853
+ var arg = [i + 1, 0];
854
+ var ranges = this.ranges;
855
+ tabstops.forEach(function (ts, index) {
856
+ var dest = this.$openTabstops[index] || ts;
857
+ for (var i = 0; i < ts.length; i++) {
858
+ var p = ts[i];
859
+ var range = Range.fromPoints(p.start, p.end || p.start);
860
+ movePoint(range.start, start);
861
+ movePoint(range.end, start);
862
+ range.original = p;
863
+ range.tabstop = dest;
864
+ ranges.push(range);
865
+ if (dest != ts)
866
+ dest.unshift(range);
867
+ else
868
+ dest[i] = range;
869
+ if (p.fmtString || (dest.firstNonLinked && useLink)) {
870
+ range.linked = true;
871
+ dest.hasLinkedRanges = true;
872
+ }
873
+ else if (!dest.firstNonLinked)
874
+ dest.firstNonLinked = range;
875
+ }
876
+ if (!dest.firstNonLinked)
877
+ dest.hasLinkedRanges = false;
878
+ if (dest === ts) {
879
+ arg.push(dest);
880
+ this.$openTabstops[index] = dest;
881
+ }
882
+ this.addTabstopMarkers(dest);
883
+ dest.rangeList = dest.rangeList || new RangeList();
884
+ dest.rangeList.$bias = 0;
885
+ dest.rangeList.addList(dest);
886
+ }, this);
887
+ if (arg.length > 2) {
888
+ if (this.tabstops.length)
889
+ arg.push(arg.splice(2, 1)[0]);
890
+ this.tabstops.splice.apply(this.tabstops, arg);
891
+ }
892
+ };
893
+ TabstopManager.prototype.addTabstopMarkers = function (ts) {
894
+ var session = this.session;
895
+ ts.forEach(function (range) {
896
+ if (!range.markerId)
897
+ range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
898
+ });
899
+ };
900
+ TabstopManager.prototype.removeTabstopMarkers = function (ts) {
901
+ var session = this.session;
902
+ ts.forEach(function (range) {
903
+ session.removeMarker(range.markerId);
904
+ range.markerId = null;
905
+ });
906
+ };
907
+ TabstopManager.prototype.removeRange = function (range) {
908
+ var i = range.tabstop.indexOf(range);
909
+ if (i != -1)
910
+ range.tabstop.splice(i, 1);
911
+ i = this.ranges.indexOf(range);
912
+ if (i != -1)
913
+ this.ranges.splice(i, 1);
914
+ i = range.tabstop.rangeList.ranges.indexOf(range);
915
+ if (i != -1)
916
+ range.tabstop.splice(i, 1);
917
+ this.session.removeMarker(range.markerId);
918
+ if (!range.tabstop.length) {
919
+ i = this.tabstops.indexOf(range.tabstop);
920
+ if (i != -1)
921
+ this.tabstops.splice(i, 1);
922
+ if (!this.tabstops.length)
923
+ this.detach();
924
+ }
925
+ };
926
+ return TabstopManager;
927
+ }());
928
+ TabstopManager.prototype.keyboardHandler = new HashHandler();
929
+ TabstopManager.prototype.keyboardHandler.bindKeys({
930
+ "Tab": function (editor) {
931
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
932
+ return;
933
+ editor.tabstopManager.tabNext(1);
934
+ editor.renderer.scrollCursorIntoView();
935
+ },
936
+ "Shift-Tab": function (editor) {
937
+ editor.tabstopManager.tabNext(-1);
938
+ editor.renderer.scrollCursorIntoView();
939
+ },
940
+ "Esc": function (editor) {
941
+ editor.tabstopManager.detach();
942
+ }
943
+ });
944
+ var movePoint = function (point, diff) {
945
+ if (point.row == 0)
946
+ point.column += diff.column;
947
+ point.row += diff.row;
948
+ };
949
+ var moveRelative = function (point, start) {
950
+ if (point.row == start.row)
951
+ point.column -= start.column;
952
+ point.row -= start.row;
953
+ };
954
+ dom.importCssString("\n.ace_snippet-marker {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n background: rgba(194, 193, 208, 0.09);\n border: 1px dotted rgba(211, 208, 235, 0.62);\n position: absolute;\n}", "snippets.css", false);
955
+ exports.snippetManager = new SnippetManager();
956
+ var Editor = require("./editor").Editor;
957
+ (function () {
958
+ this.insertSnippet = function (content, options) {
959
+ return exports.snippetManager.insertSnippet(this, content, options);
960
+ };
961
+ this.expandSnippet = function (options) {
962
+ return exports.snippetManager.expandWithTab(this, options);
963
+ };
964
+ }).call(Editor.prototype);
965
+
966
+ });
967
+
968
+ ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"], function(require, exports, module){"use strict";
969
+ var AceInlineScreenReader = /** @class */ (function () {
970
+ function AceInlineScreenReader(editor) {
971
+ this.editor = editor;
972
+ this.screenReaderDiv = document.createElement("div");
973
+ this.screenReaderDiv.classList.add("ace_screenreader-only");
974
+ this.editor.container.appendChild(this.screenReaderDiv);
975
+ }
976
+ AceInlineScreenReader.prototype.setScreenReaderContent = function (content) {
977
+ if (!this.popup && this.editor.completer && this.editor.completer.popup) {
978
+ this.popup = this.editor.completer.popup;
979
+ this.popup.renderer.on("afterRender", function () {
980
+ var row = this.popup.getRow();
981
+ var t = this.popup.renderer.$textLayer;
982
+ var selected = t.element.childNodes[row - t.config.firstRow];
983
+ if (selected) {
984
+ var idString = "doc-tooltip ";
985
+ for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
986
+ idString += "ace-inline-screenreader-line-".concat(lineIndex, " ");
987
+ }
988
+ selected.setAttribute("aria-describedby", idString);
989
+ }
990
+ }.bind(this));
991
+ }
992
+ while (this.screenReaderDiv.firstChild) {
993
+ this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);
994
+ }
995
+ this._lines = content.split(/\r\n|\r|\n/);
996
+ var codeElement = this.createCodeBlock();
997
+ this.screenReaderDiv.appendChild(codeElement);
998
+ };
999
+ AceInlineScreenReader.prototype.destroy = function () {
1000
+ this.screenReaderDiv.remove();
1001
+ };
1002
+ AceInlineScreenReader.prototype.createCodeBlock = function () {
1003
+ var container = document.createElement("pre");
1004
+ container.setAttribute("id", "ace-inline-screenreader");
1005
+ for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
1006
+ var codeElement = document.createElement("code");
1007
+ codeElement.setAttribute("id", "ace-inline-screenreader-line-".concat(lineIndex));
1008
+ var line = document.createTextNode(this._lines[lineIndex]);
1009
+ codeElement.appendChild(line);
1010
+ container.appendChild(codeElement);
1011
+ }
1012
+ return container;
1013
+ };
1014
+ return AceInlineScreenReader;
1015
+ }());
1016
+ exports.AceInlineScreenReader = AceInlineScreenReader;
1017
+
1018
+ });
1019
+
1020
+ ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"], function(require, exports, module){"use strict";
1021
+ var snippetManager = require("../snippets").snippetManager;
1022
+ var AceInlineScreenReader = require("./inline_screenreader").AceInlineScreenReader;
1023
+ var AceInline = /** @class */ (function () {
1024
+ function AceInline() {
1025
+ this.editor = null;
1026
+ }
1027
+ AceInline.prototype.show = function (editor, completion, prefix) {
1028
+ prefix = prefix || "";
1029
+ if (editor && this.editor && this.editor !== editor) {
1030
+ this.hide();
1031
+ this.editor = null;
1032
+ this.inlineScreenReader = null;
1033
+ }
1034
+ if (!editor || !completion) {
1035
+ return false;
1036
+ }
1037
+ if (!this.inlineScreenReader) {
1038
+ this.inlineScreenReader = new AceInlineScreenReader(editor);
1039
+ }
1040
+ var displayText = completion.snippet ? snippetManager.getDisplayTextForSnippet(editor, completion.snippet) : completion.value;
1041
+ if (completion.hideInlinePreview || !displayText || !displayText.startsWith(prefix)) {
1042
+ return false;
1043
+ }
1044
+ this.editor = editor;
1045
+ this.inlineScreenReader.setScreenReaderContent(displayText);
1046
+ displayText = displayText.slice(prefix.length);
1047
+ if (displayText === "") {
1048
+ editor.removeGhostText();
1049
+ }
1050
+ else {
1051
+ editor.setGhostText(displayText);
1052
+ }
1053
+ return true;
1054
+ };
1055
+ AceInline.prototype.isOpen = function () {
1056
+ if (!this.editor) {
1057
+ return false;
1058
+ }
1059
+ return !!this.editor.renderer.$ghostText;
1060
+ };
1061
+ AceInline.prototype.hide = function () {
1062
+ if (!this.editor) {
1063
+ return false;
1064
+ }
1065
+ this.editor.removeGhostText();
1066
+ return true;
1067
+ };
1068
+ AceInline.prototype.destroy = function () {
1069
+ this.hide();
1070
+ this.editor = null;
1071
+ if (this.inlineScreenReader) {
1072
+ this.inlineScreenReader.destroy();
1073
+ this.inlineScreenReader = null;
1074
+ }
1075
+ };
1076
+ return AceInline;
1077
+ }());
1078
+ exports.AceInline = AceInline;
1079
+
1080
+ });
1081
+
1082
+ ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/config"], function(require, exports, module){"use strict";
1083
+ var Renderer = require("../virtual_renderer").VirtualRenderer;
1084
+ var Editor = require("../editor").Editor;
1085
+ var Range = require("../range").Range;
1086
+ var event = require("../lib/event");
1087
+ var lang = require("../lib/lang");
1088
+ var dom = require("../lib/dom");
1089
+ var nls = require("../config").nls;
1090
+ var getAriaId = function (index) {
1091
+ return "suggest-aria-id:".concat(index);
1092
+ };
1093
+ var $singleLineEditor = function (el) {
1094
+ var renderer = new Renderer(el);
1095
+ renderer.$maxLines = 4;
1096
+ var editor = new Editor(renderer);
1097
+ editor.setHighlightActiveLine(false);
1098
+ editor.setShowPrintMargin(false);
1099
+ editor.renderer.setShowGutter(false);
1100
+ editor.renderer.setHighlightGutterLine(false);
1101
+ editor.$mouseHandler.$focusTimeout = 0;
1102
+ editor.$highlightTagPending = true;
1103
+ return editor;
1104
+ };
1105
+ var AcePopup = /** @class */ (function () {
1106
+ function AcePopup(parentNode) {
1107
+ var el = dom.createElement("div");
1108
+ var popup = new $singleLineEditor(el);
1109
+ if (parentNode) {
1110
+ parentNode.appendChild(el);
1111
+ }
1112
+ el.style.display = "none";
1113
+ popup.renderer.content.style.cursor = "default";
1114
+ popup.renderer.setStyle("ace_autocomplete");
1115
+ popup.renderer.$textLayer.element.setAttribute("role", "listbox");
1116
+ popup.renderer.$textLayer.element.setAttribute("aria-label", nls("Autocomplete suggestions"));
1117
+ popup.renderer.textarea.setAttribute("aria-hidden", "true");
1118
+ popup.setOption("displayIndentGuides", false);
1119
+ popup.setOption("dragDelay", 150);
1120
+ var noop = function () { };
1121
+ popup.focus = noop;
1122
+ popup.$isFocused = true;
1123
+ popup.renderer.$cursorLayer.restartTimer = noop;
1124
+ popup.renderer.$cursorLayer.element.style.opacity = 0;
1125
+ popup.renderer.$maxLines = 8;
1126
+ popup.renderer.$keepTextAreaAtCursor = false;
1127
+ popup.setHighlightActiveLine(false);
1128
+ popup.session.highlight("");
1129
+ popup.session.$searchHighlight.clazz = "ace_highlight-marker";
1130
+ popup.on("mousedown", function (e) {
1131
+ var pos = e.getDocumentPosition();
1132
+ popup.selection.moveToPosition(pos);
1133
+ selectionMarker.start.row = selectionMarker.end.row = pos.row;
1134
+ e.stop();
1135
+ });
1136
+ var lastMouseEvent;
1137
+ var hoverMarker = new Range(-1, 0, -1, Infinity);
1138
+ var selectionMarker = new Range(-1, 0, -1, Infinity);
1139
+ selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
1140
+ popup.setSelectOnHover = function (val) {
1141
+ if (!val) {
1142
+ hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
1143
+ }
1144
+ else if (hoverMarker.id) {
1145
+ popup.session.removeMarker(hoverMarker.id);
1146
+ hoverMarker.id = null;
1147
+ }
1148
+ };
1149
+ popup.setSelectOnHover(false);
1150
+ popup.on("mousemove", function (e) {
1151
+ if (!lastMouseEvent) {
1152
+ lastMouseEvent = e;
1153
+ return;
1154
+ }
1155
+ if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
1156
+ return;
1157
+ }
1158
+ lastMouseEvent = e;
1159
+ lastMouseEvent.scrollTop = popup.renderer.scrollTop;
1160
+ popup.isMouseOver = true;
1161
+ var row = lastMouseEvent.getDocumentPosition().row;
1162
+ if (hoverMarker.start.row != row) {
1163
+ if (!hoverMarker.id)
1164
+ popup.setRow(row);
1165
+ setHoverMarker(row);
1166
+ }
1167
+ });
1168
+ popup.renderer.on("beforeRender", function () {
1169
+ if (lastMouseEvent && hoverMarker.start.row != -1) {
1170
+ lastMouseEvent.$pos = null;
1171
+ var row = lastMouseEvent.getDocumentPosition().row;
1172
+ if (!hoverMarker.id)
1173
+ popup.setRow(row);
1174
+ setHoverMarker(row, true);
1175
+ }
1176
+ });
1177
+ popup.renderer.on("afterRender", function () {
1178
+ var row = popup.getRow();
1179
+ var t = popup.renderer.$textLayer;
1180
+ var selected = t.element.childNodes[row - t.config.firstRow];
1181
+ var el = document.activeElement; // Active element is textarea of main editor
1182
+ if (selected !== t.selectedNode && t.selectedNode) {
1183
+ dom.removeCssClass(t.selectedNode, "ace_selected");
1184
+ el.removeAttribute("aria-activedescendant");
1185
+ t.selectedNode.removeAttribute("id");
1186
+ }
1187
+ t.selectedNode = selected;
1188
+ if (selected) {
1189
+ dom.addCssClass(selected, "ace_selected");
1190
+ var ariaId = getAriaId(row);
1191
+ selected.id = ariaId;
1192
+ t.element.setAttribute("aria-activedescendant", ariaId);
1193
+ el.setAttribute("aria-activedescendant", ariaId);
1194
+ selected.setAttribute("role", "option");
1195
+ selected.setAttribute("aria-label", popup.getData(row).value);
1196
+ selected.setAttribute("aria-setsize", popup.data.length);
1197
+ selected.setAttribute("aria-posinset", row + 1);
1198
+ selected.setAttribute("aria-describedby", "doc-tooltip");
1199
+ }
1200
+ });
1201
+ var hideHoverMarker = function () { setHoverMarker(-1); };
1202
+ var setHoverMarker = function (row, suppressRedraw) {
1203
+ if (row !== hoverMarker.start.row) {
1204
+ hoverMarker.start.row = hoverMarker.end.row = row;
1205
+ if (!suppressRedraw)
1206
+ popup.session._emit("changeBackMarker");
1207
+ popup._emit("changeHoverMarker");
1208
+ }
1209
+ };
1210
+ popup.getHoveredRow = function () {
1211
+ return hoverMarker.start.row;
1212
+ };
1213
+ event.addListener(popup.container, "mouseout", function () {
1214
+ popup.isMouseOver = false;
1215
+ hideHoverMarker();
1216
+ });
1217
+ popup.on("hide", hideHoverMarker);
1218
+ popup.on("changeSelection", hideHoverMarker);
1219
+ popup.session.doc.getLength = function () {
1220
+ return popup.data.length;
1221
+ };
1222
+ popup.session.doc.getLine = function (i) {
1223
+ var data = popup.data[i];
1224
+ if (typeof data == "string")
1225
+ return data;
1226
+ return (data && data.value) || "";
1227
+ };
1228
+ var bgTokenizer = popup.session.bgTokenizer;
1229
+ bgTokenizer.$tokenizeRow = function (row) {
1230
+ var data = popup.data[row];
1231
+ var tokens = [];
1232
+ if (!data)
1233
+ return tokens;
1234
+ if (typeof data == "string")
1235
+ data = { value: data };
1236
+ var caption = data.caption || data.value || data.name;
1237
+ function addToken(value, className) {
1238
+ value && tokens.push({
1239
+ type: (data.className || "") + (className || ""),
1240
+ value: value
1241
+ });
1242
+ }
1243
+ var lower = caption.toLowerCase();
1244
+ var filterText = (popup.filterText || "").toLowerCase();
1245
+ var lastIndex = 0;
1246
+ var lastI = 0;
1247
+ for (var i = 0; i <= filterText.length; i++) {
1248
+ if (i != lastI && (data.matchMask & (1 << i) || i == filterText.length)) {
1249
+ var sub = filterText.slice(lastI, i);
1250
+ lastI = i;
1251
+ var index = lower.indexOf(sub, lastIndex);
1252
+ if (index == -1)
1253
+ continue;
1254
+ addToken(caption.slice(lastIndex, index), "");
1255
+ lastIndex = index + sub.length;
1256
+ addToken(caption.slice(index, lastIndex), "completion-highlight");
1257
+ }
1258
+ }
1259
+ addToken(caption.slice(lastIndex, caption.length), "");
1260
+ tokens.push({ type: "completion-spacer", value: " " });
1261
+ if (data.meta)
1262
+ tokens.push({ type: "completion-meta", value: data.meta });
1263
+ if (data.message)
1264
+ tokens.push({ type: "completion-message", value: data.message });
1265
+ return tokens;
1266
+ };
1267
+ bgTokenizer.$updateOnChange = noop;
1268
+ bgTokenizer.start = noop;
1269
+ popup.session.$computeWidth = function () {
1270
+ return this.screenWidth = 0;
1271
+ };
1272
+ popup.isOpen = false;
1273
+ popup.isTopdown = false;
1274
+ popup.autoSelect = true;
1275
+ popup.filterText = "";
1276
+ popup.isMouseOver = false;
1277
+ popup.data = [];
1278
+ popup.setData = function (list, filterText) {
1279
+ popup.filterText = filterText || "";
1280
+ popup.setValue(lang.stringRepeat("\n", list.length), -1);
1281
+ popup.data = list || [];
1282
+ popup.setRow(0);
1283
+ };
1284
+ popup.getData = function (row) {
1285
+ return popup.data[row];
1286
+ };
1287
+ popup.getRow = function () {
1288
+ return selectionMarker.start.row;
1289
+ };
1290
+ popup.setRow = function (line) {
1291
+ line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length - 1, line));
1292
+ if (selectionMarker.start.row != line) {
1293
+ popup.selection.clearSelection();
1294
+ selectionMarker.start.row = selectionMarker.end.row = line || 0;
1295
+ popup.session._emit("changeBackMarker");
1296
+ popup.moveCursorTo(line || 0, 0);
1297
+ if (popup.isOpen)
1298
+ popup._signal("select");
1299
+ }
1300
+ };
1301
+ popup.on("changeSelection", function () {
1302
+ if (popup.isOpen)
1303
+ popup.setRow(popup.selection.lead.row);
1304
+ popup.renderer.scrollCursorIntoView();
1305
+ });
1306
+ popup.hide = function () {
1307
+ this.container.style.display = "none";
1308
+ popup.anchorPos = null;
1309
+ popup.anchor = null;
1310
+ if (popup.isOpen) {
1311
+ popup.isOpen = false;
1312
+ this._signal("hide");
1313
+ }
1314
+ };
1315
+ popup.tryShow = function (pos, lineHeight, anchor, forceShow) {
1316
+ if (!forceShow && popup.isOpen && popup.anchorPos && popup.anchor &&
1317
+ popup.anchorPos.top === pos.top && popup.anchorPos.left === pos.left &&
1318
+ popup.anchor === anchor) {
1319
+ return true;
1320
+ }
1321
+ var el = this.container;
1322
+ var screenHeight = window.innerHeight;
1323
+ var screenWidth = window.innerWidth;
1324
+ var renderer = this.renderer;
1325
+ var maxH = renderer.$maxLines * lineHeight * 1.4;
1326
+ var dims = { top: 0, bottom: 0, left: 0 };
1327
+ var spaceBelow = screenHeight - pos.top - 3 * this.$borderSize - lineHeight;
1328
+ var spaceAbove = pos.top - 3 * this.$borderSize;
1329
+ if (!anchor) {
1330
+ if (spaceAbove <= spaceBelow || spaceBelow >= maxH) {
1331
+ anchor = "bottom";
1332
+ }
1333
+ else {
1334
+ anchor = "top";
1335
+ }
1336
+ }
1337
+ if (anchor === "top") {
1338
+ dims.bottom = pos.top - this.$borderSize;
1339
+ dims.top = dims.bottom - maxH;
1340
+ }
1341
+ else if (anchor === "bottom") {
1342
+ dims.top = pos.top + lineHeight + this.$borderSize;
1343
+ dims.bottom = dims.top + maxH;
1344
+ }
1345
+ var fitsX = dims.top >= 0 && dims.bottom <= screenHeight;
1346
+ if (!forceShow && !fitsX) {
1347
+ return false;
1348
+ }
1349
+ if (!fitsX) {
1350
+ if (anchor === "top") {
1351
+ renderer.$maxPixelHeight = spaceAbove;
1352
+ }
1353
+ else {
1354
+ renderer.$maxPixelHeight = spaceBelow;
1355
+ }
1356
+ }
1357
+ else {
1358
+ renderer.$maxPixelHeight = null;
1359
+ }
1360
+ if (anchor === "top") {
1361
+ el.style.top = "";
1362
+ el.style.bottom = (screenHeight - dims.bottom) + "px";
1363
+ popup.isTopdown = false;
1364
+ }
1365
+ else {
1366
+ el.style.top = dims.top + "px";
1367
+ el.style.bottom = "";
1368
+ popup.isTopdown = true;
1369
+ }
1370
+ el.style.display = "";
1371
+ var left = pos.left;
1372
+ if (left + el.offsetWidth > screenWidth)
1373
+ left = screenWidth - el.offsetWidth;
1374
+ el.style.left = left + "px";
1375
+ el.style.right = "";
1376
+ if (!popup.isOpen) {
1377
+ popup.isOpen = true;
1378
+ this._signal("show");
1379
+ lastMouseEvent = null;
1380
+ }
1381
+ popup.anchorPos = pos;
1382
+ popup.anchor = anchor;
1383
+ return true;
1384
+ };
1385
+ popup.show = function (pos, lineHeight, topdownOnly) {
1386
+ this.tryShow(pos, lineHeight, topdownOnly ? "bottom" : undefined, true);
1387
+ };
1388
+ popup.goTo = function (where) {
1389
+ var row = this.getRow();
1390
+ var max = this.session.getLength() - 1;
1391
+ switch (where) {
1392
+ case "up":
1393
+ row = row <= 0 ? max : row - 1;
1394
+ break;
1395
+ case "down":
1396
+ row = row >= max ? -1 : row + 1;
1397
+ break;
1398
+ case "start":
1399
+ row = 0;
1400
+ break;
1401
+ case "end":
1402
+ row = max;
1403
+ break;
1404
+ }
1405
+ this.setRow(row);
1406
+ };
1407
+ popup.getTextLeftOffset = function () {
1408
+ return this.$borderSize + this.renderer.$padding + this.$imageSize;
1409
+ };
1410
+ popup.$imageSize = 0;
1411
+ popup.$borderSize = 1;
1412
+ return popup;
1413
+ }
1414
+ return AcePopup;
1415
+ }());
1416
+ dom.importCssString("\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #CAD6FA;\n z-index: 1;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #3a674e;\n}\n.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid #abbffe;\n margin-top: -1px;\n background: rgba(233,233,253,0.4);\n position: absolute;\n z-index: 2;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid rgba(109, 150, 13, 0.8);\n background: rgba(58, 103, 78, 0.62);\n}\n.ace_completion-meta {\n opacity: 0.5;\n margin-left: 0.9em;\n}\n.ace_completion-message {\n margin-left: 0.9em;\n color: blue;\n}\n.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #2d69c7;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #93ca12;\n}\n.ace_editor.ace_autocomplete {\n width: 300px;\n z-index: 200000;\n border: 1px lightgray solid;\n position: fixed;\n box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n line-height: 1.4;\n background: #fefefe;\n color: #111;\n}\n.ace_dark.ace_editor.ace_autocomplete {\n border: 1px #484747 solid;\n box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\n line-height: 1.4;\n background: #25282c;\n color: #c1c1c1;\n}\n.ace_autocomplete .ace_text-layer {\n width: calc(100% - 8px);\n}\n.ace_autocomplete .ace_line {\n display: flex;\n align-items: center;\n}\n.ace_autocomplete .ace_line > * {\n min-width: 0;\n flex: 0 0 auto;\n}\n.ace_autocomplete .ace_line .ace_ {\n flex: 0 1 auto;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.ace_autocomplete .ace_completion-spacer {\n flex: 1;\n}\n.ace_autocomplete.ace_loading:after {\n content: \"\";\n position: absolute;\n top: 0px;\n height: 2px;\n width: 8%;\n background: blue;\n z-index: 100;\n animation: ace_progress 3s infinite linear;\n animation-delay: 300ms;\n transform: translateX(-100%) scaleX(1);\n}\n@keyframes ace_progress {\n 0% { transform: translateX(-100%) scaleX(1) }\n 50% { transform: translateX(625%) scaleX(2) } \n 100% { transform: translateX(1500%) scaleX(3) } \n}\n@media (prefers-reduced-motion) {\n .ace_autocomplete.ace_loading:after {\n transform: translateX(625%) scaleX(2);\n animation: none;\n }\n}\n", "autocompletion.css", false);
1417
+ exports.AcePopup = AcePopup;
1418
+ exports.$singleLineEditor = $singleLineEditor;
1419
+ exports.getAriaId = getAriaId;
1420
+
1421
+ });
1422
+
1423
+ ace.define("ace/autocomplete/util",["require","exports","module"], function(require, exports, module){"use strict";
1424
+ exports.parForEach = function (array, fn, callback) {
1425
+ var completed = 0;
1426
+ var arLength = array.length;
1427
+ if (arLength === 0)
1428
+ callback();
1429
+ for (var i = 0; i < arLength; i++) {
1430
+ fn(array[i], function (result, err) {
1431
+ completed++;
1432
+ if (completed === arLength)
1433
+ callback(result, err);
1434
+ });
1435
+ }
1436
+ };
1437
+ var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
1438
+ exports.retrievePrecedingIdentifier = function (text, pos, regex) {
1439
+ regex = regex || ID_REGEX;
1440
+ var buf = [];
1441
+ for (var i = pos - 1; i >= 0; i--) {
1442
+ if (regex.test(text[i]))
1443
+ buf.push(text[i]);
1444
+ else
1445
+ break;
1446
+ }
1447
+ return buf.reverse().join("");
1448
+ };
1449
+ exports.retrieveFollowingIdentifier = function (text, pos, regex) {
1450
+ regex = regex || ID_REGEX;
1451
+ var buf = [];
1452
+ for (var i = pos; i < text.length; i++) {
1453
+ if (regex.test(text[i]))
1454
+ buf.push(text[i]);
1455
+ else
1456
+ break;
1457
+ }
1458
+ return buf;
1459
+ };
1460
+ exports.getCompletionPrefix = function (editor) {
1461
+ var pos = editor.getCursorPosition();
1462
+ var line = editor.session.getLine(pos.row);
1463
+ var prefix;
1464
+ editor.completers.forEach(function (completer) {
1465
+ if (completer.identifierRegexps) {
1466
+ completer.identifierRegexps.forEach(function (identifierRegex) {
1467
+ if (!prefix && identifierRegex)
1468
+ prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
1469
+ }.bind(this));
1470
+ }
1471
+ }.bind(this));
1472
+ return prefix || this.retrievePrecedingIdentifier(line, pos.column);
1473
+ };
1474
+ exports.triggerAutocomplete = function (editor) {
1475
+ var pos = editor.getCursorPosition();
1476
+ var line = editor.session.getLine(pos.row);
1477
+ var column = (pos.column === 0) ? 0 : pos.column - 1;
1478
+ var previousChar = line[column];
1479
+ return editor.completers.some(function (el) {
1480
+ if (el.triggerCharacters && Array.isArray(el.triggerCharacters)) {
1481
+ return el.triggerCharacters.includes(previousChar);
1482
+ }
1483
+ });
1484
+ };
1485
+
1486
+ });
1487
+
1488
+ ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/inline","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config","ace/lib/event"], function(require, exports, module){"use strict";
1489
+ var HashHandler = require("./keyboard/hash_handler").HashHandler;
1490
+ var AcePopup = require("./autocomplete/popup").AcePopup;
1491
+ var AceInline = require("./autocomplete/inline").AceInline;
1492
+ var getAriaId = require("./autocomplete/popup").getAriaId;
1493
+ var util = require("./autocomplete/util");
1494
+ var lang = require("./lib/lang");
1495
+ var dom = require("./lib/dom");
1496
+ var snippetManager = require("./snippets").snippetManager;
1497
+ var config = require("./config");
1498
+ var event = require("./lib/event");
1499
+ var destroyCompleter = function (e, editor) {
1500
+ editor.completer && editor.completer.destroy();
1501
+ };
1502
+ var Autocomplete = /** @class */ (function () {
1503
+ function Autocomplete() {
1504
+ this.autoInsert = false;
1505
+ this.autoSelect = true;
1506
+ this.autoShown = false;
1507
+ this.exactMatch = false;
1508
+ this.inlineEnabled = false;
1509
+ this.keyboardHandler = new HashHandler();
1510
+ this.keyboardHandler.bindKeys(this.commands);
1511
+ this.parentNode = null;
1512
+ this.setSelectOnHover = false;
1513
+ this.stickySelectionDelay = 500;
1514
+ this.blurListener = this.blurListener.bind(this);
1515
+ this.changeListener = this.changeListener.bind(this);
1516
+ this.mousedownListener = this.mousedownListener.bind(this);
1517
+ this.mousewheelListener = this.mousewheelListener.bind(this);
1518
+ this.onLayoutChange = this.onLayoutChange.bind(this);
1519
+ this.changeTimer = lang.delayedCall(function () {
1520
+ this.updateCompletions(true);
1521
+ }.bind(this));
1522
+ this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
1523
+ this.stickySelectionTimer = lang.delayedCall(function () {
1524
+ this.stickySelection = true;
1525
+ }.bind(this), this.stickySelectionDelay);
1526
+ this.$firstOpenTimer = lang.delayedCall(function () {
1527
+ var initialPosition = this.completionProvider && this.completionProvider.initialPosition;
1528
+ if (this.autoShown || (this.popup && this.popup.isOpen) || !initialPosition)
1529
+ return;
1530
+ var completionsForEmpty = [{
1531
+ caption: config.nls("Loading..."),
1532
+ value: ""
1533
+ }];
1534
+ this.completions = new FilteredList(completionsForEmpty);
1535
+ this.openPopup(this.editor, initialPosition.prefix, false);
1536
+ this.popup.renderer.setStyle("ace_loading", true);
1537
+ }.bind(this), this.stickySelectionDelay);
1538
+ }
1539
+ Autocomplete.prototype.$init = function () {
1540
+ this.popup = new AcePopup(this.parentNode || document.body || document.documentElement);
1541
+ this.popup.on("click", function (e) {
1542
+ this.insertMatch();
1543
+ e.stop();
1544
+ }.bind(this));
1545
+ this.popup.focus = this.editor.focus.bind(this.editor);
1546
+ this.popup.on("show", this.$onPopupShow.bind(this));
1547
+ this.popup.on("hide", this.$onHidePopup.bind(this));
1548
+ this.popup.on("select", this.$onPopupChange.bind(this));
1549
+ event.addListener(this.popup.container, "mouseout", this.mouseOutListener.bind(this));
1550
+ this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
1551
+ return this.popup;
1552
+ };
1553
+ Autocomplete.prototype.$initInline = function () {
1554
+ if (!this.inlineEnabled || this.inlineRenderer)
1555
+ return;
1556
+ this.inlineRenderer = new AceInline();
1557
+ return this.inlineRenderer;
1558
+ };
1559
+ Autocomplete.prototype.getPopup = function () {
1560
+ return this.popup || this.$init();
1561
+ };
1562
+ Autocomplete.prototype.$onHidePopup = function () {
1563
+ if (this.inlineRenderer) {
1564
+ this.inlineRenderer.hide();
1565
+ }
1566
+ this.hideDocTooltip();
1567
+ this.stickySelectionTimer.cancel();
1568
+ this.stickySelection = false;
1569
+ };
1570
+ Autocomplete.prototype.$onPopupChange = function (hide) {
1571
+ if (this.inlineRenderer && this.inlineEnabled) {
1572
+ var completion = hide ? null : this.popup.getData(this.popup.getRow());
1573
+ var prefix = util.getCompletionPrefix(this.editor);
1574
+ if (!this.inlineRenderer.show(this.editor, completion, prefix)) {
1575
+ this.inlineRenderer.hide();
1576
+ }
1577
+ if (this.popup.isMouseOver && this.setSelectOnHover) {
1578
+ this.tooltipTimer.call(null, null);
1579
+ return;
1580
+ }
1581
+ }
1582
+ this.$updatePopupPosition();
1583
+ this.tooltipTimer.call(null, null);
1584
+ };
1585
+ Autocomplete.prototype.$onPopupShow = function (hide) {
1586
+ this.$onPopupChange(hide);
1587
+ this.stickySelection = false;
1588
+ if (this.stickySelectionDelay >= 0)
1589
+ this.stickySelectionTimer.schedule(this.stickySelectionDelay);
1590
+ };
1591
+ Autocomplete.prototype.observeLayoutChanges = function () {
1592
+ if (this.$elements || !this.editor)
1593
+ return;
1594
+ window.addEventListener("resize", this.onLayoutChange, { passive: true });
1595
+ window.addEventListener("wheel", this.mousewheelListener);
1596
+ var el = this.editor.container.parentNode;
1597
+ var elements = [];
1598
+ while (el) {
1599
+ elements.push(el);
1600
+ el.addEventListener("scroll", this.onLayoutChange, { passive: true });
1601
+ el = el.parentNode;
1602
+ }
1603
+ this.$elements = elements;
1604
+ };
1605
+ Autocomplete.prototype.unObserveLayoutChanges = function () {
1606
+ var _this = this;
1607
+ window.removeEventListener("resize", this.onLayoutChange, { passive: true });
1608
+ window.removeEventListener("wheel", this.mousewheelListener);
1609
+ this.$elements && this.$elements.forEach(function (el) {
1610
+ el.removeEventListener("scroll", _this.onLayoutChange, { passive: true });
1611
+ });
1612
+ this.$elements = null;
1613
+ };
1614
+ Autocomplete.prototype.onLayoutChange = function () {
1615
+ if (!this.popup.isOpen)
1616
+ return this.unObserveLayoutChanges();
1617
+ this.$updatePopupPosition();
1618
+ this.updateDocTooltip();
1619
+ };
1620
+ Autocomplete.prototype.$updatePopupPosition = function () {
1621
+ var editor = this.editor;
1622
+ var renderer = editor.renderer;
1623
+ var lineHeight = renderer.layerConfig.lineHeight;
1624
+ var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
1625
+ pos.left -= this.popup.getTextLeftOffset();
1626
+ var rect = editor.container.getBoundingClientRect();
1627
+ pos.top += rect.top - renderer.layerConfig.offset;
1628
+ pos.left += rect.left - editor.renderer.scrollLeft;
1629
+ pos.left += renderer.gutterWidth;
1630
+ var posGhostText = {
1631
+ top: pos.top,
1632
+ left: pos.left
1633
+ };
1634
+ if (renderer.$ghostText && renderer.$ghostTextWidget) {
1635
+ if (this.base.row === renderer.$ghostText.position.row) {
1636
+ posGhostText.top += renderer.$ghostTextWidget.el.offsetHeight;
1637
+ }
1638
+ }
1639
+ if (this.popup.tryShow(posGhostText, lineHeight, "bottom")) {
1640
+ return;
1641
+ }
1642
+ if (this.popup.tryShow(pos, lineHeight, "top")) {
1643
+ return;
1644
+ }
1645
+ this.popup.show(pos, lineHeight);
1646
+ };
1647
+ Autocomplete.prototype.openPopup = function (editor, prefix, keepPopupPosition) {
1648
+ this.$firstOpenTimer.cancel();
1649
+ if (!this.popup)
1650
+ this.$init();
1651
+ if (this.inlineEnabled && !this.inlineRenderer)
1652
+ this.$initInline();
1653
+ this.popup.autoSelect = this.autoSelect;
1654
+ this.popup.setSelectOnHover(this.setSelectOnHover);
1655
+ var previousSelectedItem = this.popup.data[this.popup.getRow()];
1656
+ this.popup.setData(this.completions.filtered, this.completions.filterText);
1657
+ if (this.editor.textInput.setAriaOptions) {
1658
+ this.editor.textInput.setAriaOptions({
1659
+ activeDescendant: getAriaId(this.popup.getRow()),
1660
+ inline: this.inlineEnabled
1661
+ });
1662
+ }
1663
+ editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
1664
+ var newRow = this.popup.data.indexOf(previousSelectedItem);
1665
+ if (newRow && this.stickySelection)
1666
+ this.popup.setRow(this.autoSelect ? newRow : -1);
1667
+ else
1668
+ this.popup.setRow(this.autoSelect ? 0 : -1);
1669
+ if (!keepPopupPosition) {
1670
+ this.popup.setTheme(editor.getTheme());
1671
+ this.popup.setFontSize(editor.getFontSize());
1672
+ this.$updatePopupPosition();
1673
+ if (this.tooltipNode) {
1674
+ this.updateDocTooltip();
1675
+ }
1676
+ }
1677
+ else if (keepPopupPosition && !prefix) {
1678
+ this.detach();
1679
+ }
1680
+ this.changeTimer.cancel();
1681
+ this.observeLayoutChanges();
1682
+ };
1683
+ Autocomplete.prototype.detach = function () {
1684
+ if (this.editor) {
1685
+ this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
1686
+ this.editor.off("changeSelection", this.changeListener);
1687
+ this.editor.off("blur", this.blurListener);
1688
+ this.editor.off("mousedown", this.mousedownListener);
1689
+ this.editor.off("mousewheel", this.mousewheelListener);
1690
+ }
1691
+ this.$firstOpenTimer.cancel();
1692
+ this.changeTimer.cancel();
1693
+ this.hideDocTooltip();
1694
+ if (this.completionProvider) {
1695
+ this.completionProvider.detach();
1696
+ }
1697
+ if (this.popup && this.popup.isOpen)
1698
+ this.popup.hide();
1699
+ if (this.base)
1700
+ this.base.detach();
1701
+ this.activated = false;
1702
+ this.completionProvider = this.completions = this.base = null;
1703
+ this.unObserveLayoutChanges();
1704
+ };
1705
+ Autocomplete.prototype.changeListener = function (e) {
1706
+ var cursor = this.editor.selection.lead;
1707
+ if (cursor.row != this.base.row || cursor.column < this.base.column) {
1708
+ this.detach();
1709
+ }
1710
+ if (this.activated)
1711
+ this.changeTimer.schedule();
1712
+ else
1713
+ this.detach();
1714
+ };
1715
+ Autocomplete.prototype.blurListener = function (e) {
1716
+ var el = document.activeElement;
1717
+ var text = this.editor.textInput.getElement();
1718
+ var fromTooltip = e.relatedTarget && this.tooltipNode && this.tooltipNode.contains(e.relatedTarget);
1719
+ var container = this.popup && this.popup.container;
1720
+ if (el != text && el.parentNode != container && !fromTooltip
1721
+ && el != this.tooltipNode && e.relatedTarget != text) {
1722
+ this.detach();
1723
+ }
1724
+ };
1725
+ Autocomplete.prototype.mousedownListener = function (e) {
1726
+ this.detach();
1727
+ };
1728
+ Autocomplete.prototype.mousewheelListener = function (e) {
1729
+ if (!this.popup.isMouseOver)
1730
+ this.detach();
1731
+ };
1732
+ Autocomplete.prototype.mouseOutListener = function (e) {
1733
+ if (this.popup.isOpen)
1734
+ this.$updatePopupPosition();
1735
+ };
1736
+ Autocomplete.prototype.goTo = function (where) {
1737
+ this.popup.goTo(where);
1738
+ };
1739
+ Autocomplete.prototype.insertMatch = function (data, options) {
1740
+ if (!data)
1741
+ data = this.popup.getData(this.popup.getRow());
1742
+ if (!data)
1743
+ return false;
1744
+ if (data.value === "") // Explicitly given nothing to insert, e.g. "No suggestion state"
1745
+ return this.detach();
1746
+ var completions = this.completions;
1747
+ var result = this.getCompletionProvider().insertMatch(this.editor, data, completions.filterText, options);
1748
+ if (this.completions == completions)
1749
+ this.detach();
1750
+ return result;
1751
+ };
1752
+ Autocomplete.prototype.showPopup = function (editor, options) {
1753
+ if (this.editor)
1754
+ this.detach();
1755
+ this.activated = true;
1756
+ this.editor = editor;
1757
+ if (editor.completer != this) {
1758
+ if (editor.completer)
1759
+ editor.completer.detach();
1760
+ editor.completer = this;
1761
+ }
1762
+ editor.on("changeSelection", this.changeListener);
1763
+ editor.on("blur", this.blurListener);
1764
+ editor.on("mousedown", this.mousedownListener);
1765
+ editor.on("mousewheel", this.mousewheelListener);
1766
+ this.updateCompletions(false, options);
1767
+ };
1768
+ Autocomplete.prototype.getCompletionProvider = function (initialPosition) {
1769
+ if (!this.completionProvider)
1770
+ this.completionProvider = new CompletionProvider(initialPosition);
1771
+ return this.completionProvider;
1772
+ };
1773
+ Autocomplete.prototype.gatherCompletions = function (editor, callback) {
1774
+ return this.getCompletionProvider().gatherCompletions(editor, callback);
1775
+ };
1776
+ Autocomplete.prototype.updateCompletions = function (keepPopupPosition, options) {
1777
+ if (keepPopupPosition && this.base && this.completions) {
1778
+ var pos = this.editor.getCursorPosition();
1779
+ var prefix = this.editor.session.getTextRange({ start: this.base, end: pos });
1780
+ if (prefix == this.completions.filterText)
1781
+ return;
1782
+ this.completions.setFilter(prefix);
1783
+ if (!this.completions.filtered.length)
1784
+ return this.detach();
1785
+ if (this.completions.filtered.length == 1
1786
+ && this.completions.filtered[0].value == prefix
1787
+ && !this.completions.filtered[0].snippet)
1788
+ return this.detach();
1789
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1790
+ return;
1791
+ }
1792
+ if (options && options.matches) {
1793
+ var pos = this.editor.getSelectionRange().start;
1794
+ this.base = this.editor.session.doc.createAnchor(pos.row, pos.column);
1795
+ this.base.$insertRight = true;
1796
+ this.completions = new FilteredList(options.matches);
1797
+ return this.openPopup(this.editor, "", keepPopupPosition);
1798
+ }
1799
+ var session = this.editor.getSession();
1800
+ var pos = this.editor.getCursorPosition();
1801
+ var prefix = util.getCompletionPrefix(this.editor);
1802
+ this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
1803
+ this.base.$insertRight = true;
1804
+ var completionOptions = {
1805
+ exactMatch: this.exactMatch,
1806
+ ignoreCaption: this.ignoreCaption
1807
+ };
1808
+ this.getCompletionProvider({
1809
+ prefix: prefix,
1810
+ pos: pos
1811
+ }).provideCompletions(this.editor, completionOptions, function (err, completions, finished) {
1812
+ var filtered = completions.filtered;
1813
+ var prefix = util.getCompletionPrefix(this.editor);
1814
+ this.$firstOpenTimer.cancel();
1815
+ if (finished) {
1816
+ if (!filtered.length) {
1817
+ var emptyMessage = !this.autoShown && this.emptyMessage;
1818
+ if (typeof emptyMessage == "function")
1819
+ emptyMessage = this.emptyMessage(prefix);
1820
+ if (emptyMessage) {
1821
+ var completionsForEmpty = [{
1822
+ caption: emptyMessage,
1823
+ value: ""
1824
+ }];
1825
+ this.completions = new FilteredList(completionsForEmpty);
1826
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1827
+ return;
1828
+ }
1829
+ return this.detach();
1830
+ }
1831
+ if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
1832
+ return this.detach();
1833
+ if (this.autoInsert && !this.autoShown && filtered.length == 1)
1834
+ return this.insertMatch(filtered[0]);
1835
+ }
1836
+ this.completions = completions;
1837
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1838
+ this.popup.renderer.setStyle("ace_loading", !finished);
1839
+ }.bind(this));
1840
+ if (!this.autoShown && !(this.popup && this.popup.isOpen)) {
1841
+ this.$firstOpenTimer.delay(this.stickySelectionDelay / 2);
1842
+ }
1843
+ };
1844
+ Autocomplete.prototype.cancelContextMenu = function () {
1845
+ this.editor.$mouseHandler.cancelContextMenu();
1846
+ };
1847
+ Autocomplete.prototype.updateDocTooltip = function () {
1848
+ var popup = this.popup;
1849
+ var all = this.completions.filtered;
1850
+ var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]);
1851
+ var doc = null;
1852
+ if (!selected || !this.editor || !this.popup.isOpen)
1853
+ return this.hideDocTooltip();
1854
+ var completersLength = this.editor.completers.length;
1855
+ for (var i = 0; i < completersLength; i++) {
1856
+ var completer = this.editor.completers[i];
1857
+ if (completer.getDocTooltip && selected.completerId === completer.id) {
1858
+ doc = completer.getDocTooltip(selected);
1859
+ break;
1860
+ }
1861
+ }
1862
+ if (!doc && typeof selected != "string")
1863
+ doc = selected;
1864
+ if (typeof doc == "string")
1865
+ doc = { docText: doc };
1866
+ if (!doc || !(doc.docHTML || doc.docText))
1867
+ return this.hideDocTooltip();
1868
+ this.showDocTooltip(doc);
1869
+ };
1870
+ Autocomplete.prototype.showDocTooltip = function (item) {
1871
+ if (!this.tooltipNode) {
1872
+ this.tooltipNode = dom.createElement("div");
1873
+ this.tooltipNode.style.margin = 0;
1874
+ this.tooltipNode.style.pointerEvents = "auto";
1875
+ this.tooltipNode.tabIndex = -1;
1876
+ this.tooltipNode.onblur = this.blurListener.bind(this);
1877
+ this.tooltipNode.onclick = this.onTooltipClick.bind(this);
1878
+ this.tooltipNode.id = "doc-tooltip";
1879
+ this.tooltipNode.setAttribute("role", "tooltip");
1880
+ }
1881
+ var theme = this.editor.renderer.theme;
1882
+ this.tooltipNode.className = "ace_tooltip ace_doc-tooltip " +
1883
+ (theme.isDark ? "ace_dark " : "") + (theme.cssClass || "");
1884
+ var tooltipNode = this.tooltipNode;
1885
+ if (item.docHTML) {
1886
+ tooltipNode.innerHTML = item.docHTML;
1887
+ }
1888
+ else if (item.docText) {
1889
+ tooltipNode.textContent = item.docText;
1890
+ }
1891
+ if (!tooltipNode.parentNode)
1892
+ this.popup.container.appendChild(this.tooltipNode);
1893
+ var popup = this.popup;
1894
+ var rect = popup.container.getBoundingClientRect();
1895
+ tooltipNode.style.top = popup.container.style.top;
1896
+ tooltipNode.style.bottom = popup.container.style.bottom;
1897
+ tooltipNode.style.display = "block";
1898
+ if (window.innerWidth - rect.right < 320) {
1899
+ if (rect.left < 320) {
1900
+ if (popup.isTopdown) {
1901
+ tooltipNode.style.top = rect.bottom + "px";
1902
+ tooltipNode.style.left = rect.left + "px";
1903
+ tooltipNode.style.right = "";
1904
+ tooltipNode.style.bottom = "";
1905
+ }
1906
+ else {
1907
+ tooltipNode.style.top = popup.container.offsetTop - tooltipNode.offsetHeight + "px";
1908
+ tooltipNode.style.left = rect.left + "px";
1909
+ tooltipNode.style.right = "";
1910
+ tooltipNode.style.bottom = "";
1911
+ }
1912
+ }
1913
+ else {
1914
+ tooltipNode.style.right = window.innerWidth - rect.left + "px";
1915
+ tooltipNode.style.left = "";
1916
+ }
1917
+ }
1918
+ else {
1919
+ tooltipNode.style.left = (rect.right + 1) + "px";
1920
+ tooltipNode.style.right = "";
1921
+ }
1922
+ };
1923
+ Autocomplete.prototype.hideDocTooltip = function () {
1924
+ this.tooltipTimer.cancel();
1925
+ if (!this.tooltipNode)
1926
+ return;
1927
+ var el = this.tooltipNode;
1928
+ if (!this.editor.isFocused() && document.activeElement == el)
1929
+ this.editor.focus();
1930
+ this.tooltipNode = null;
1931
+ if (el.parentNode)
1932
+ el.parentNode.removeChild(el);
1933
+ };
1934
+ Autocomplete.prototype.onTooltipClick = function (e) {
1935
+ var a = e.target;
1936
+ while (a && a != this.tooltipNode) {
1937
+ if (a.nodeName == "A" && a.href) {
1938
+ a.rel = "noreferrer";
1939
+ a.target = "_blank";
1940
+ break;
1941
+ }
1942
+ a = a.parentNode;
1943
+ }
1944
+ };
1945
+ Autocomplete.prototype.destroy = function () {
1946
+ this.detach();
1947
+ if (this.popup) {
1948
+ this.popup.destroy();
1949
+ var el = this.popup.container;
1950
+ if (el && el.parentNode)
1951
+ el.parentNode.removeChild(el);
1952
+ }
1953
+ if (this.editor && this.editor.completer == this) {
1954
+ this.editor.off("destroy", destroyCompleter);
1955
+ this.editor.completer = null;
1956
+ }
1957
+ this.inlineRenderer = this.popup = this.editor = null;
1958
+ };
1959
+ return Autocomplete;
1960
+ }());
1961
+ Autocomplete.prototype.commands = {
1962
+ "Up": function (editor) { editor.completer.goTo("up"); },
1963
+ "Down": function (editor) { editor.completer.goTo("down"); },
1964
+ "Ctrl-Up|Ctrl-Home": function (editor) { editor.completer.goTo("start"); },
1965
+ "Ctrl-Down|Ctrl-End": function (editor) { editor.completer.goTo("end"); },
1966
+ "Esc": function (editor) { editor.completer.detach(); },
1967
+ "Return": function (editor) { return editor.completer.insertMatch(); },
1968
+ "Shift-Return": function (editor) { editor.completer.insertMatch(null, { deleteSuffix: true }); },
1969
+ "Tab": function (editor) {
1970
+ var result = editor.completer.insertMatch();
1971
+ if (!result && !editor.tabstopManager)
1972
+ editor.completer.goTo("down");
1973
+ else
1974
+ return result;
1975
+ },
1976
+ "PageUp": function (editor) { editor.completer.popup.gotoPageUp(); },
1977
+ "PageDown": function (editor) { editor.completer.popup.gotoPageDown(); }
1978
+ };
1979
+ Autocomplete.for = function (editor) {
1980
+ if (editor.completer instanceof Autocomplete) {
1981
+ return editor.completer;
1982
+ }
1983
+ if (editor.completer) {
1984
+ editor.completer.destroy();
1985
+ editor.completer = null;
1986
+ }
1987
+ if (config.get("sharedPopups")) {
1988
+ if (!Autocomplete.$sharedInstance)
1989
+ Autocomplete.$sharedInstance = new Autocomplete();
1990
+ editor.completer = Autocomplete.$sharedInstance;
1991
+ }
1992
+ else {
1993
+ editor.completer = new Autocomplete();
1994
+ editor.once("destroy", destroyCompleter);
1995
+ }
1996
+ return editor.completer;
1997
+ };
1998
+ Autocomplete.startCommand = {
1999
+ name: "startAutocomplete",
2000
+ exec: function (editor, options) {
2001
+ var completer = Autocomplete.for(editor);
2002
+ completer.autoInsert = false;
2003
+ completer.autoSelect = true;
2004
+ completer.autoShown = false;
2005
+ completer.showPopup(editor, options);
2006
+ completer.cancelContextMenu();
2007
+ },
2008
+ bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
2009
+ };
2010
+ var CompletionProvider = /** @class */ (function () {
2011
+ function CompletionProvider(initialPosition) {
2012
+ this.initialPosition = initialPosition;
2013
+ this.active = true;
2014
+ }
2015
+ CompletionProvider.prototype.insertByIndex = function (editor, index, options) {
2016
+ if (!this.completions || !this.completions.filtered) {
2017
+ return false;
2018
+ }
2019
+ return this.insertMatch(editor, this.completions.filtered[index], options);
2020
+ };
2021
+ CompletionProvider.prototype.insertMatch = function (editor, data, options) {
2022
+ if (!data)
2023
+ return false;
2024
+ editor.startOperation({ command: { name: "insertMatch" } });
2025
+ if (data.completer && data.completer.insertMatch) {
2026
+ data.completer.insertMatch(editor, data);
2027
+ }
2028
+ else {
2029
+ if (!this.completions)
2030
+ return false;
2031
+ var replaceBefore = this.completions.filterText.length;
2032
+ var replaceAfter = 0;
2033
+ if (data.range && data.range.start.row === data.range.end.row) {
2034
+ replaceBefore -= this.initialPosition.prefix.length;
2035
+ replaceBefore += this.initialPosition.pos.column - data.range.start.column;
2036
+ replaceAfter += data.range.end.column - this.initialPosition.pos.column;
2037
+ }
2038
+ if (replaceBefore || replaceAfter) {
2039
+ var ranges;
2040
+ if (editor.selection.getAllRanges) {
2041
+ ranges = editor.selection.getAllRanges();
2042
+ }
2043
+ else {
2044
+ ranges = [editor.getSelectionRange()];
2045
+ }
2046
+ for (var i = 0, range; range = ranges[i]; i++) {
2047
+ range.start.column -= replaceBefore;
2048
+ range.end.column += replaceAfter;
2049
+ editor.session.remove(range);
2050
+ }
2051
+ }
2052
+ if (data.snippet) {
2053
+ snippetManager.insertSnippet(editor, data.snippet);
2054
+ }
2055
+ else {
2056
+ this.$insertString(editor, data);
2057
+ }
2058
+ if (data.command && data.command === "startAutocomplete") {
2059
+ editor.execCommand(data.command);
2060
+ }
2061
+ }
2062
+ editor.endOperation();
2063
+ return true;
2064
+ };
2065
+ CompletionProvider.prototype.$insertString = function (editor, data) {
2066
+ var text = data.value || data;
2067
+ editor.execCommand("insertstring", text);
2068
+ };
2069
+ CompletionProvider.prototype.gatherCompletions = function (editor, callback) {
2070
+ var session = editor.getSession();
2071
+ var pos = editor.getCursorPosition();
2072
+ var prefix = util.getCompletionPrefix(editor);
2073
+ var matches = [];
2074
+ this.completers = editor.completers;
2075
+ var total = editor.completers.length;
2076
+ editor.completers.forEach(function (completer, i) {
2077
+ completer.getCompletions(editor, session, pos, prefix, function (err, results) {
2078
+ if (completer.hideInlinePreview)
2079
+ results = results.map(function (result) {
2080
+ return Object.assign(result, { hideInlinePreview: completer.hideInlinePreview });
2081
+ });
2082
+ if (!err && results)
2083
+ matches = matches.concat(results);
2084
+ callback(null, {
2085
+ prefix: util.getCompletionPrefix(editor),
2086
+ matches: matches,
2087
+ finished: (--total === 0)
2088
+ });
2089
+ });
2090
+ });
2091
+ return true;
2092
+ };
2093
+ CompletionProvider.prototype.provideCompletions = function (editor, options, callback) {
2094
+ var processResults = function (results) {
2095
+ var prefix = results.prefix;
2096
+ var matches = results.matches;
2097
+ this.completions = new FilteredList(matches);
2098
+ if (options.exactMatch)
2099
+ this.completions.exactMatch = true;
2100
+ if (options.ignoreCaption)
2101
+ this.completions.ignoreCaption = true;
2102
+ this.completions.setFilter(prefix);
2103
+ if (results.finished || this.completions.filtered.length)
2104
+ callback(null, this.completions, results.finished);
2105
+ }.bind(this);
2106
+ var isImmediate = true;
2107
+ var immediateResults = null;
2108
+ this.gatherCompletions(editor, function (err, results) {
2109
+ if (!this.active) {
2110
+ return;
2111
+ }
2112
+ if (err) {
2113
+ callback(err, [], true);
2114
+ this.detach();
2115
+ }
2116
+ var prefix = results.prefix;
2117
+ if (prefix.indexOf(results.prefix) !== 0)
2118
+ return;
2119
+ if (isImmediate) {
2120
+ immediateResults = results;
2121
+ return;
2122
+ }
2123
+ processResults(results);
2124
+ }.bind(this));
2125
+ isImmediate = false;
2126
+ if (immediateResults) {
2127
+ var results = immediateResults;
2128
+ immediateResults = null;
2129
+ processResults(results);
2130
+ }
2131
+ };
2132
+ CompletionProvider.prototype.detach = function () {
2133
+ this.active = false;
2134
+ this.completers && this.completers.forEach(function (completer) {
2135
+ if (typeof completer.cancel === "function") {
2136
+ completer.cancel();
2137
+ }
2138
+ });
2139
+ };
2140
+ return CompletionProvider;
2141
+ }());
2142
+ var FilteredList = /** @class */ (function () {
2143
+ function FilteredList(array, filterText) {
2144
+ this.all = array;
2145
+ this.filtered = array;
2146
+ this.filterText = filterText || "";
2147
+ this.exactMatch = false;
2148
+ this.ignoreCaption = false;
2149
+ }
2150
+ FilteredList.prototype.setFilter = function (str) {
2151
+ if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
2152
+ var matches = this.filtered;
2153
+ else
2154
+ var matches = this.all;
2155
+ this.filterText = str;
2156
+ matches = this.filterCompletions(matches, this.filterText);
2157
+ matches = matches.sort(function (a, b) {
2158
+ return b.exactMatch - a.exactMatch || b.$score - a.$score
2159
+ || (a.caption || a.value).localeCompare(b.caption || b.value);
2160
+ });
2161
+ var prev = null;
2162
+ matches = matches.filter(function (item) {
2163
+ var caption = item.snippet || item.caption || item.value;
2164
+ if (caption === prev)
2165
+ return false;
2166
+ prev = caption;
2167
+ return true;
2168
+ });
2169
+ this.filtered = matches;
2170
+ };
2171
+ FilteredList.prototype.filterCompletions = function (items, needle) {
2172
+ var results = [];
2173
+ var upper = needle.toUpperCase();
2174
+ var lower = needle.toLowerCase();
2175
+ loop: for (var i = 0, item; item = items[i]; i++) {
2176
+ var caption = (!this.ignoreCaption && item.caption) || item.value || item.snippet;
2177
+ if (!caption)
2178
+ continue;
2179
+ var lastIndex = -1;
2180
+ var matchMask = 0;
2181
+ var penalty = 0;
2182
+ var index, distance;
2183
+ if (this.exactMatch) {
2184
+ if (needle !== caption.substr(0, needle.length))
2185
+ continue loop;
2186
+ }
2187
+ else {
2188
+ var fullMatchIndex = caption.toLowerCase().indexOf(lower);
2189
+ if (fullMatchIndex > -1) {
2190
+ penalty = fullMatchIndex;
2191
+ }
2192
+ else {
2193
+ for (var j = 0; j < needle.length; j++) {
2194
+ var i1 = caption.indexOf(lower[j], lastIndex + 1);
2195
+ var i2 = caption.indexOf(upper[j], lastIndex + 1);
2196
+ index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
2197
+ if (index < 0)
2198
+ continue loop;
2199
+ distance = index - lastIndex - 1;
2200
+ if (distance > 0) {
2201
+ if (lastIndex === -1)
2202
+ penalty += 10;
2203
+ penalty += distance;
2204
+ matchMask = matchMask | (1 << j);
2205
+ }
2206
+ lastIndex = index;
2207
+ }
2208
+ }
2209
+ }
2210
+ item.matchMask = matchMask;
2211
+ item.exactMatch = penalty ? 0 : 1;
2212
+ item.$score = (item.score || 0) - penalty;
2213
+ results.push(item);
2214
+ }
2215
+ return results;
2216
+ };
2217
+ return FilteredList;
2218
+ }());
2219
+ exports.Autocomplete = Autocomplete;
2220
+ exports.CompletionProvider = CompletionProvider;
2221
+ exports.FilteredList = FilteredList;
2222
+
2223
+ });
2224
+
2225
+ ace.define("ace/ext/command_bar",["require","exports","module","ace/tooltip","ace/lib/event_emitter","ace/lib/lang","ace/lib/dom","ace/lib/oop","ace/lib/useragent"], function(require, exports, module){var __values = (this && this.__values) || function(o) {
2226
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
2227
+ if (m) return m.call(o);
2228
+ if (o && typeof o.length === "number") return {
2229
+ next: function () {
2230
+ if (o && i >= o.length) o = void 0;
2231
+ return { value: o && o[i++], done: !o };
2232
+ }
2233
+ };
2234
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
2235
+ };
2236
+ var Tooltip = require("../tooltip").Tooltip;
2237
+ var EventEmitter = require("../lib/event_emitter").EventEmitter;
2238
+ var lang = require("../lib/lang");
2239
+ var dom = require("../lib/dom");
2240
+ var oop = require("../lib/oop");
2241
+ var useragent = require("../lib/useragent");
2242
+ var BUTTON_CLASS_NAME = 'command_bar_tooltip_button';
2243
+ var VALUE_CLASS_NAME = 'command_bar_button_value';
2244
+ var CAPTION_CLASS_NAME = 'command_bar_button_caption';
2245
+ var KEYBINDING_CLASS_NAME = 'command_bar_keybinding';
2246
+ var TOOLTIP_CLASS_NAME = 'command_bar_tooltip';
2247
+ var MORE_OPTIONS_BUTTON_ID = 'MoreOptionsButton';
2248
+ var defaultDelay = 100;
2249
+ var defaultMaxElements = 4;
2250
+ var minPosition = function (posA, posB) {
2251
+ if (posB.row > posA.row) {
2252
+ return posA;
2253
+ }
2254
+ else if (posB.row === posA.row && posB.column > posA.column) {
2255
+ return posA;
2256
+ }
2257
+ return posB;
2258
+ };
2259
+ var keyDisplayMap = {
2260
+ "Ctrl": { mac: "^" },
2261
+ "Option": { mac: "⌥" },
2262
+ "Command": { mac: "⌘" },
2263
+ "Cmd": { mac: "⌘" },
2264
+ "Shift": "⇧",
2265
+ "Left": "←",
2266
+ "Right": "→",
2267
+ "Up": "↑",
2268
+ "Down": "↓"
2269
+ };
2270
+ var CommandBarTooltip = /** @class */ (function () {
2271
+ function CommandBarTooltip(parentNode, options) {
2272
+ var e_1, _a;
2273
+ options = options || {};
2274
+ this.parentNode = parentNode;
2275
+ this.tooltip = new Tooltip(this.parentNode);
2276
+ this.moreOptions = new Tooltip(this.parentNode);
2277
+ this.maxElementsOnTooltip = options.maxElementsOnTooltip || defaultMaxElements;
2278
+ this.$alwaysShow = options.alwaysShow || false;
2279
+ this.eventListeners = {};
2280
+ this.elements = {};
2281
+ this.commands = {};
2282
+ this.tooltipEl = dom.buildDom(['div', { class: TOOLTIP_CLASS_NAME }], this.tooltip.getElement());
2283
+ this.moreOptionsEl = dom.buildDom(['div', { class: TOOLTIP_CLASS_NAME + " tooltip_more_options" }], this.moreOptions.getElement());
2284
+ this.$showTooltipTimer = lang.delayedCall(this.$showTooltip.bind(this), options.showDelay || defaultDelay);
2285
+ this.$hideTooltipTimer = lang.delayedCall(this.$hideTooltip.bind(this), options.hideDelay || defaultDelay);
2286
+ this.$tooltipEnter = this.$tooltipEnter.bind(this);
2287
+ this.$onMouseMove = this.$onMouseMove.bind(this);
2288
+ this.$onChangeScroll = this.$onChangeScroll.bind(this);
2289
+ this.$onEditorChangeSession = this.$onEditorChangeSession.bind(this);
2290
+ this.$scheduleTooltipForHide = this.$scheduleTooltipForHide.bind(this);
2291
+ this.$preventMouseEvent = this.$preventMouseEvent.bind(this);
2292
+ try {
2293
+ for (var _b = __values(["mousedown", "mouseup", "click"]), _c = _b.next(); !_c.done; _c = _b.next()) {
2294
+ var event = _c.value;
2295
+ this.tooltip.getElement().addEventListener(event, this.$preventMouseEvent);
2296
+ this.moreOptions.getElement().addEventListener(event, this.$preventMouseEvent);
2297
+ }
2298
+ }
2299
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2300
+ finally {
2301
+ try {
2302
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2303
+ }
2304
+ finally { if (e_1) throw e_1.error; }
2305
+ }
2306
+ }
2307
+ CommandBarTooltip.prototype.registerCommand = function (id, command) {
2308
+ var registerForMainTooltip = Object.keys(this.commands).length < this.maxElementsOnTooltip;
2309
+ if (!registerForMainTooltip && !this.elements[MORE_OPTIONS_BUTTON_ID]) {
2310
+ this.$createCommand(MORE_OPTIONS_BUTTON_ID, {
2311
+ name: "···",
2312
+ exec: function () {
2313
+ this.$shouldHideMoreOptions = false;
2314
+ this.$setMoreOptionsVisibility(!this.isMoreOptionsShown());
2315
+ }.bind(this),
2316
+ type: "checkbox",
2317
+ getValue: function () {
2318
+ return this.isMoreOptionsShown();
2319
+ }.bind(this),
2320
+ enabled: true
2321
+ }, true);
2322
+ }
2323
+ this.$createCommand(id, command, registerForMainTooltip);
2324
+ if (this.isShown()) {
2325
+ this.updatePosition();
2326
+ }
2327
+ };
2328
+ CommandBarTooltip.prototype.isShown = function () {
2329
+ return !!this.tooltip && this.tooltip.isOpen;
2330
+ };
2331
+ CommandBarTooltip.prototype.isMoreOptionsShown = function () {
2332
+ return !!this.moreOptions && this.moreOptions.isOpen;
2333
+ };
2334
+ CommandBarTooltip.prototype.getAlwaysShow = function () {
2335
+ return this.$alwaysShow;
2336
+ };
2337
+ CommandBarTooltip.prototype.setAlwaysShow = function (alwaysShow) {
2338
+ this.$alwaysShow = alwaysShow;
2339
+ this.$updateOnHoverHandlers(!this.$alwaysShow);
2340
+ this._signal("alwaysShow", this.$alwaysShow);
2341
+ };
2342
+ CommandBarTooltip.prototype.attach = function (editor) {
2343
+ if (!editor || (this.isShown() && this.editor === editor)) {
2344
+ return;
2345
+ }
2346
+ this.detach();
2347
+ this.editor = editor;
2348
+ this.editor.on("changeSession", this.$onEditorChangeSession);
2349
+ if (this.editor.session) {
2350
+ this.editor.session.on("changeScrollLeft", this.$onChangeScroll);
2351
+ this.editor.session.on("changeScrollTop", this.$onChangeScroll);
2352
+ }
2353
+ if (this.getAlwaysShow()) {
2354
+ this.$showTooltip();
2355
+ }
2356
+ else {
2357
+ this.$updateOnHoverHandlers(true);
2358
+ }
2359
+ };
2360
+ CommandBarTooltip.prototype.updatePosition = function () {
2361
+ if (!this.editor) {
2362
+ return;
2363
+ }
2364
+ var renderer = this.editor.renderer;
2365
+ var ranges;
2366
+ if (this.editor.selection.getAllRanges) {
2367
+ ranges = this.editor.selection.getAllRanges();
2368
+ }
2369
+ else {
2370
+ ranges = [this.editor.getSelectionRange()];
2371
+ }
2372
+ if (!ranges.length) {
2373
+ return;
2374
+ }
2375
+ var minPos = minPosition(ranges[0].start, ranges[0].end);
2376
+ for (var i = 0, range; range = ranges[i]; i++) {
2377
+ minPos = minPosition(minPos, minPosition(range.start, range.end));
2378
+ }
2379
+ var pos = renderer.$cursorLayer.getPixelPosition(minPos, true);
2380
+ var tooltipEl = this.tooltip.getElement();
2381
+ var screenWidth = window.innerWidth;
2382
+ var screenHeight = window.innerHeight;
2383
+ var rect = this.editor.container.getBoundingClientRect();
2384
+ pos.top += rect.top - renderer.layerConfig.offset;
2385
+ pos.left += rect.left + renderer.gutterWidth - renderer.scrollLeft;
2386
+ var cursorVisible = pos.top >= rect.top && pos.top <= rect.bottom &&
2387
+ pos.left >= rect.left + renderer.gutterWidth && pos.left <= rect.right;
2388
+ if (!cursorVisible && this.isShown()) {
2389
+ this.$hideTooltip();
2390
+ return;
2391
+ }
2392
+ else if (cursorVisible && !this.isShown() && this.getAlwaysShow()) {
2393
+ this.$showTooltip();
2394
+ return;
2395
+ }
2396
+ var top = pos.top - tooltipEl.offsetHeight;
2397
+ var left = Math.min(screenWidth - tooltipEl.offsetWidth, pos.left);
2398
+ var tooltipFits = top >= 0 && top + tooltipEl.offsetHeight <= screenHeight &&
2399
+ left >= 0 && left + tooltipEl.offsetWidth <= screenWidth;
2400
+ if (!tooltipFits) {
2401
+ this.$hideTooltip();
2402
+ return;
2403
+ }
2404
+ this.tooltip.setPosition(left, top);
2405
+ if (this.isMoreOptionsShown()) {
2406
+ top = top + tooltipEl.offsetHeight;
2407
+ left = this.elements[MORE_OPTIONS_BUTTON_ID].getBoundingClientRect().left;
2408
+ var moreOptionsEl = this.moreOptions.getElement();
2409
+ var screenHeight = window.innerHeight;
2410
+ if (top + moreOptionsEl.offsetHeight > screenHeight) {
2411
+ top -= tooltipEl.offsetHeight + moreOptionsEl.offsetHeight;
2412
+ }
2413
+ if (left + moreOptionsEl.offsetWidth > screenWidth) {
2414
+ left = screenWidth - moreOptionsEl.offsetWidth;
2415
+ }
2416
+ this.moreOptions.setPosition(left, top);
2417
+ }
2418
+ };
2419
+ CommandBarTooltip.prototype.update = function () {
2420
+ Object.keys(this.elements).forEach(this.$updateElement.bind(this));
2421
+ };
2422
+ CommandBarTooltip.prototype.detach = function () {
2423
+ this.tooltip.hide();
2424
+ this.moreOptions.hide();
2425
+ this.$updateOnHoverHandlers(false);
2426
+ if (this.editor) {
2427
+ this.editor.off("changeSession", this.$onEditorChangeSession);
2428
+ if (this.editor.session) {
2429
+ this.editor.session.off("changeScrollLeft", this.$onChangeScroll);
2430
+ this.editor.session.off("changeScrollTop", this.$onChangeScroll);
2431
+ }
2432
+ }
2433
+ this.$mouseInTooltip = false;
2434
+ this.editor = null;
2435
+ };
2436
+ CommandBarTooltip.prototype.destroy = function () {
2437
+ if (this.tooltip && this.moreOptions) {
2438
+ this.detach();
2439
+ this.tooltip.destroy();
2440
+ this.moreOptions.destroy();
2441
+ }
2442
+ this.eventListeners = {};
2443
+ this.commands = {};
2444
+ this.elements = {};
2445
+ this.tooltip = this.moreOptions = this.parentNode = null;
2446
+ };
2447
+ CommandBarTooltip.prototype.$createCommand = function (id, command, forMainTooltip) {
2448
+ var parentEl = forMainTooltip ? this.tooltipEl : this.moreOptionsEl;
2449
+ var keyParts = [];
2450
+ var bindKey = command.bindKey;
2451
+ if (bindKey) {
2452
+ if (typeof bindKey === 'object') {
2453
+ bindKey = useragent.isMac ? bindKey.mac : bindKey.win;
2454
+ }
2455
+ bindKey = bindKey.split("|")[0];
2456
+ keyParts = bindKey.split("-");
2457
+ keyParts = keyParts.map(function (key) {
2458
+ if (keyDisplayMap[key]) {
2459
+ if (typeof keyDisplayMap[key] === 'string') {
2460
+ return keyDisplayMap[key];
2461
+ }
2462
+ else if (useragent.isMac && keyDisplayMap[key].mac) {
2463
+ return keyDisplayMap[key].mac;
2464
+ }
2465
+ }
2466
+ return key;
2467
+ });
2468
+ }
2469
+ var buttonNode;
2470
+ if (forMainTooltip && command.iconCssClass) {
2471
+ buttonNode = [
2472
+ 'div',
2473
+ {
2474
+ class: ["ace_icon_svg", command.iconCssClass].join(" "),
2475
+ "aria-label": command.name + " (" + command.bindKey + ")"
2476
+ }
2477
+ ];
2478
+ }
2479
+ else {
2480
+ buttonNode = [
2481
+ ['div', { class: VALUE_CLASS_NAME }],
2482
+ ['div', { class: CAPTION_CLASS_NAME }, command.name]
2483
+ ];
2484
+ if (keyParts.length) {
2485
+ buttonNode.push([
2486
+ 'div',
2487
+ { class: KEYBINDING_CLASS_NAME },
2488
+ keyParts.map(function (keyPart) {
2489
+ return ['div', keyPart];
2490
+ })
2491
+ ]);
2492
+ }
2493
+ }
2494
+ dom.buildDom(['div', { class: [BUTTON_CLASS_NAME, command.cssClass || ""].join(" "), ref: id }, buttonNode], parentEl, this.elements);
2495
+ this.commands[id] = command;
2496
+ var eventListener = function (e) {
2497
+ if (this.editor) {
2498
+ this.editor.focus();
2499
+ }
2500
+ this.$shouldHideMoreOptions = this.isMoreOptionsShown();
2501
+ if (!this.elements[id].disabled && command.exec) {
2502
+ command.exec(this.editor);
2503
+ }
2504
+ if (this.$shouldHideMoreOptions) {
2505
+ this.$setMoreOptionsVisibility(false);
2506
+ }
2507
+ this.update();
2508
+ e.preventDefault();
2509
+ }.bind(this);
2510
+ this.eventListeners[id] = eventListener;
2511
+ this.elements[id].addEventListener('click', eventListener.bind(this));
2512
+ this.$updateElement(id);
2513
+ };
2514
+ CommandBarTooltip.prototype.$setMoreOptionsVisibility = function (visible) {
2515
+ if (visible) {
2516
+ this.moreOptions.setTheme(this.editor.renderer.theme);
2517
+ this.moreOptions.setClassName(TOOLTIP_CLASS_NAME + "_wrapper");
2518
+ this.moreOptions.show();
2519
+ this.update();
2520
+ this.updatePosition();
2521
+ }
2522
+ else {
2523
+ this.moreOptions.hide();
2524
+ }
2525
+ };
2526
+ CommandBarTooltip.prototype.$onEditorChangeSession = function (e) {
2527
+ if (e.oldSession) {
2528
+ e.oldSession.off("changeScrollTop", this.$onChangeScroll);
2529
+ e.oldSession.off("changeScrollLeft", this.$onChangeScroll);
2530
+ }
2531
+ this.detach();
2532
+ };
2533
+ CommandBarTooltip.prototype.$onChangeScroll = function () {
2534
+ if (this.editor.renderer && (this.isShown() || this.getAlwaysShow())) {
2535
+ this.editor.renderer.once("afterRender", this.updatePosition.bind(this));
2536
+ }
2537
+ };
2538
+ CommandBarTooltip.prototype.$onMouseMove = function (e) {
2539
+ if (this.$mouseInTooltip) {
2540
+ return;
2541
+ }
2542
+ var cursorPosition = this.editor.getCursorPosition();
2543
+ var cursorScreenPosition = this.editor.renderer.textToScreenCoordinates(cursorPosition.row, cursorPosition.column);
2544
+ var lineHeight = this.editor.renderer.lineHeight;
2545
+ var isInCurrentLine = e.clientY >= cursorScreenPosition.pageY && e.clientY < cursorScreenPosition.pageY + lineHeight;
2546
+ if (isInCurrentLine) {
2547
+ if (!this.isShown() && !this.$showTooltipTimer.isPending()) {
2548
+ this.$showTooltipTimer.delay();
2549
+ }
2550
+ if (this.$hideTooltipTimer.isPending()) {
2551
+ this.$hideTooltipTimer.cancel();
2552
+ }
2553
+ }
2554
+ else {
2555
+ if (this.isShown() && !this.$hideTooltipTimer.isPending()) {
2556
+ this.$hideTooltipTimer.delay();
2557
+ }
2558
+ if (this.$showTooltipTimer.isPending()) {
2559
+ this.$showTooltipTimer.cancel();
2560
+ }
2561
+ }
2562
+ };
2563
+ CommandBarTooltip.prototype.$preventMouseEvent = function (e) {
2564
+ if (this.editor) {
2565
+ this.editor.focus();
2566
+ }
2567
+ e.preventDefault();
2568
+ };
2569
+ CommandBarTooltip.prototype.$scheduleTooltipForHide = function () {
2570
+ this.$mouseInTooltip = false;
2571
+ this.$showTooltipTimer.cancel();
2572
+ this.$hideTooltipTimer.delay();
2573
+ };
2574
+ CommandBarTooltip.prototype.$tooltipEnter = function () {
2575
+ this.$mouseInTooltip = true;
2576
+ if (this.$showTooltipTimer.isPending()) {
2577
+ this.$showTooltipTimer.cancel();
2578
+ }
2579
+ if (this.$hideTooltipTimer.isPending()) {
2580
+ this.$hideTooltipTimer.cancel();
2581
+ }
2582
+ };
2583
+ CommandBarTooltip.prototype.$updateOnHoverHandlers = function (enableHover) {
2584
+ var tooltipEl = this.tooltip.getElement();
2585
+ var moreOptionsEl = this.moreOptions.getElement();
2586
+ if (enableHover) {
2587
+ if (this.editor) {
2588
+ this.editor.on("mousemove", this.$onMouseMove);
2589
+ this.editor.renderer.getMouseEventTarget().addEventListener("mouseout", this.$scheduleTooltipForHide, true);
2590
+ }
2591
+ tooltipEl.addEventListener('mouseenter', this.$tooltipEnter);
2592
+ tooltipEl.addEventListener('mouseleave', this.$scheduleTooltipForHide);
2593
+ moreOptionsEl.addEventListener('mouseenter', this.$tooltipEnter);
2594
+ moreOptionsEl.addEventListener('mouseleave', this.$scheduleTooltipForHide);
2595
+ }
2596
+ else {
2597
+ if (this.editor) {
2598
+ this.editor.off("mousemove", this.$onMouseMove);
2599
+ this.editor.renderer.getMouseEventTarget().removeEventListener("mouseout", this.$scheduleTooltipForHide, true);
2600
+ }
2601
+ tooltipEl.removeEventListener('mouseenter', this.$tooltipEnter);
2602
+ tooltipEl.removeEventListener('mouseleave', this.$scheduleTooltipForHide);
2603
+ moreOptionsEl.removeEventListener('mouseenter', this.$tooltipEnter);
2604
+ moreOptionsEl.removeEventListener('mouseleave', this.$scheduleTooltipForHide);
2605
+ }
2606
+ };
2607
+ CommandBarTooltip.prototype.$showTooltip = function () {
2608
+ if (this.isShown()) {
2609
+ return;
2610
+ }
2611
+ this.tooltip.setTheme(this.editor.renderer.theme);
2612
+ this.tooltip.setClassName(TOOLTIP_CLASS_NAME + "_wrapper");
2613
+ this.tooltip.show();
2614
+ this.update();
2615
+ this.updatePosition();
2616
+ this._signal("show");
2617
+ };
2618
+ CommandBarTooltip.prototype.$hideTooltip = function () {
2619
+ this.$mouseInTooltip = false;
2620
+ if (!this.isShown()) {
2621
+ return;
2622
+ }
2623
+ this.moreOptions.hide();
2624
+ this.tooltip.hide();
2625
+ this._signal("hide");
2626
+ };
2627
+ CommandBarTooltip.prototype.$updateElement = function (id) {
2628
+ var command = this.commands[id];
2629
+ if (!command) {
2630
+ return;
2631
+ }
2632
+ var el = this.elements[id];
2633
+ var commandEnabled = command.enabled;
2634
+ if (typeof commandEnabled === 'function') {
2635
+ commandEnabled = commandEnabled(this.editor);
2636
+ }
2637
+ if (typeof command.getValue === 'function') {
2638
+ var value = command.getValue(this.editor);
2639
+ if (command.type === 'text') {
2640
+ el.textContent = value;
2641
+ }
2642
+ else if (command.type === 'checkbox') {
2643
+ var domCssFn = value ? dom.addCssClass : dom.removeCssClass;
2644
+ var isOnTooltip = el.parentElement === this.tooltipEl;
2645
+ el.ariaChecked = value;
2646
+ if (isOnTooltip) {
2647
+ domCssFn(el, "ace_selected");
2648
+ }
2649
+ else {
2650
+ el = el.querySelector("." + VALUE_CLASS_NAME);
2651
+ domCssFn(el, "ace_checkmark");
2652
+ }
2653
+ }
2654
+ }
2655
+ if (commandEnabled && el.disabled) {
2656
+ dom.removeCssClass(el, "ace_disabled");
2657
+ el.ariaDisabled = el.disabled = false;
2658
+ el.removeAttribute("disabled");
2659
+ }
2660
+ else if (!commandEnabled && !el.disabled) {
2661
+ dom.addCssClass(el, "ace_disabled");
2662
+ el.ariaDisabled = el.disabled = true;
2663
+ el.setAttribute("disabled", "");
2664
+ }
2665
+ };
2666
+ return CommandBarTooltip;
2667
+ }());
2668
+ oop.implement(CommandBarTooltip.prototype, EventEmitter);
2669
+ dom.importCssString("\n.ace_tooltip.".concat(TOOLTIP_CLASS_NAME, "_wrapper {\n padding: 0;\n}\n\n.ace_tooltip .").concat(TOOLTIP_CLASS_NAME, " {\n padding: 1px 5px;\n display: flex;\n pointer-events: auto;\n}\n\n.ace_tooltip .").concat(TOOLTIP_CLASS_NAME, ".tooltip_more_options {\n padding: 1px;\n flex-direction: column;\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, " {\n display: inline-flex;\n cursor: pointer;\n margin: 1px;\n border-radius: 2px;\n padding: 2px 5px;\n align-items: center;\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, ".ace_selected,\ndiv.").concat(BUTTON_CLASS_NAME, ":hover:not(.ace_disabled) {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, ".ace_disabled {\n color: #777;\n pointer-events: none;\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, " .ace_icon_svg {\n height: 12px;\n background-color: #000;\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, ".ace_disabled .ace_icon_svg {\n background-color: #777;\n}\n\n.").concat(TOOLTIP_CLASS_NAME, ".tooltip_more_options .").concat(BUTTON_CLASS_NAME, " {\n display: flex;\n}\n\n.").concat(TOOLTIP_CLASS_NAME, ".").concat(VALUE_CLASS_NAME, " {\n display: none;\n}\n\n.").concat(TOOLTIP_CLASS_NAME, ".tooltip_more_options .").concat(VALUE_CLASS_NAME, " {\n display: inline-block;\n width: 12px;\n}\n\n.").concat(CAPTION_CLASS_NAME, " {\n display: inline-block;\n}\n\n.").concat(KEYBINDING_CLASS_NAME, " {\n margin: 0 2px;\n display: inline-block;\n font-size: 8px;\n}\n\n.").concat(TOOLTIP_CLASS_NAME, ".tooltip_more_options .").concat(KEYBINDING_CLASS_NAME, " {\n margin-left: auto;\n}\n\n.").concat(KEYBINDING_CLASS_NAME, " div {\n display: inline-block;\n min-width: 8px;\n padding: 2px;\n margin: 0 1px;\n border-radius: 2px;\n background-color: #ccc;\n text-align: center;\n}\n\n.ace_dark.ace_tooltip .").concat(TOOLTIP_CLASS_NAME, " {\n background-color: #373737;\n color: #eee;\n}\n\n.ace_dark div.").concat(BUTTON_CLASS_NAME, ".ace_disabled {\n color: #979797;\n}\n\n.ace_dark div.").concat(BUTTON_CLASS_NAME, ".ace_selected,\n.ace_dark div.").concat(BUTTON_CLASS_NAME, ":hover:not(.ace_disabled) {\n background-color: rgba(255, 255, 255, 0.1);\n}\n\n.ace_dark div.").concat(BUTTON_CLASS_NAME, " .ace_icon_svg {\n background-color: #eee;\n}\n\n.ace_dark div.").concat(BUTTON_CLASS_NAME, ".ace_disabled .ace_icon_svg {\n background-color: #979797;\n}\n\n.ace_dark .").concat(BUTTON_CLASS_NAME, ".ace_disabled {\n color: #979797;\n}\n\n.ace_dark .").concat(KEYBINDING_CLASS_NAME, " div {\n background-color: #575757;\n}\n\n.ace_checkmark::before {\n content: '\u2713';\n}\n"), "commandbar.css", false);
2670
+ exports.CommandBarTooltip = CommandBarTooltip;
2671
+ exports.TOOLTIP_CLASS_NAME = TOOLTIP_CLASS_NAME;
2672
+ exports.BUTTON_CLASS_NAME = BUTTON_CLASS_NAME;
2673
+
2674
+ });
2675
+
2676
+ ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"], function(require, exports, module){var Range = require("../range").Range;
2677
+ var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;
2678
+ function getWordIndex(doc, pos) {
2679
+ var textBefore = doc.getTextRange(Range.fromPoints({
2680
+ row: 0,
2681
+ column: 0
2682
+ }, pos));
2683
+ return textBefore.split(splitRegex).length - 1;
2684
+ }
2685
+ function wordDistance(doc, pos) {
2686
+ var prefixPos = getWordIndex(doc, pos);
2687
+ var words = doc.getValue().split(splitRegex);
2688
+ var wordScores = Object.create(null);
2689
+ var currentWord = words[prefixPos];
2690
+ words.forEach(function (word, idx) {
2691
+ if (!word || word === currentWord)
2692
+ return;
2693
+ var distance = Math.abs(prefixPos - idx);
2694
+ var score = words.length - distance;
2695
+ if (wordScores[word]) {
2696
+ wordScores[word] = Math.max(score, wordScores[word]);
2697
+ }
2698
+ else {
2699
+ wordScores[word] = score;
2700
+ }
2701
+ });
2702
+ return wordScores;
2703
+ }
2704
+ exports.getCompletions = function (editor, session, pos, prefix, callback) {
2705
+ var wordScore = wordDistance(session, pos);
2706
+ var wordList = Object.keys(wordScore);
2707
+ callback(null, wordList.map(function (word) {
2708
+ return {
2709
+ caption: word,
2710
+ value: word,
2711
+ score: wordScore[word],
2712
+ meta: "local"
2713
+ };
2714
+ }));
2715
+ };
2716
+
2717
+ });
2718
+
2719
+ ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"], function(require, exports, module){"use strict";
2720
+ var snippetManager = require("../snippets").snippetManager;
2721
+ var Autocomplete = require("../autocomplete").Autocomplete;
2722
+ var config = require("../config");
2723
+ var lang = require("../lib/lang");
2724
+ var util = require("../autocomplete/util");
2725
+ var textCompleter = require("../autocomplete/text_completer");
2726
+ var keyWordCompleter = {
2727
+ getCompletions: function (editor, session, pos, prefix, callback) {
2728
+ if (session.$mode.completer) {
2729
+ return session.$mode.completer.getCompletions(editor, session, pos, prefix, callback);
2730
+ }
2731
+ var state = editor.session.getState(pos.row);
2732
+ var completions = session.$mode.getCompletions(state, session, pos, prefix);
2733
+ completions = completions.map(function (el) {
2734
+ el.completerId = keyWordCompleter.id;
2735
+ return el;
2736
+ });
2737
+ callback(null, completions);
2738
+ },
2739
+ id: "keywordCompleter"
2740
+ };
2741
+ var transformSnippetTooltip = function (str) {
2742
+ var record = {};
2743
+ return str.replace(/\${(\d+)(:(.*?))?}/g, function (_, p1, p2, p3) {
2744
+ return (record[p1] = p3 || '');
2745
+ }).replace(/\$(\d+?)/g, function (_, p1) {
2746
+ return record[p1];
2747
+ });
2748
+ };
2749
+ var snippetCompleter = {
2750
+ getCompletions: function (editor, session, pos, prefix, callback) {
2751
+ var scopes = [];
2752
+ var token = session.getTokenAt(pos.row, pos.column);
2753
+ if (token && token.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/))
2754
+ scopes.push('html-tag');
2755
+ else
2756
+ scopes = snippetManager.getActiveScopes(editor);
2757
+ var snippetMap = snippetManager.snippetMap;
2758
+ var completions = [];
2759
+ scopes.forEach(function (scope) {
2760
+ var snippets = snippetMap[scope] || [];
2761
+ for (var i = snippets.length; i--;) {
2762
+ var s = snippets[i];
2763
+ var caption = s.name || s.tabTrigger;
2764
+ if (!caption)
2765
+ continue;
2766
+ completions.push({
2767
+ caption: caption,
2768
+ snippet: s.content,
2769
+ meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet",
2770
+ completerId: snippetCompleter.id
2771
+ });
2772
+ }
2773
+ }, this);
2774
+ callback(null, completions);
2775
+ },
2776
+ getDocTooltip: function (item) {
2777
+ if (item.snippet && !item.docHTML) {
2778
+ item.docHTML = [
2779
+ "<b>", lang.escapeHTML(item.caption), "</b>", "<hr></hr>",
2780
+ lang.escapeHTML(transformSnippetTooltip(item.snippet))
2781
+ ].join("");
2782
+ }
2783
+ },
2784
+ id: "snippetCompleter"
2785
+ };
2786
+ var completers = [snippetCompleter, textCompleter, keyWordCompleter];
2787
+ exports.setCompleters = function (val) {
2788
+ completers.length = 0;
2789
+ if (val)
2790
+ completers.push.apply(completers, val);
2791
+ };
2792
+ exports.addCompleter = function (completer) {
2793
+ completers.push(completer);
2794
+ };
2795
+ exports.textCompleter = textCompleter;
2796
+ exports.keyWordCompleter = keyWordCompleter;
2797
+ exports.snippetCompleter = snippetCompleter;
2798
+ var expandSnippet = {
2799
+ name: "expandSnippet",
2800
+ exec: function (editor) {
2801
+ return snippetManager.expandWithTab(editor);
2802
+ },
2803
+ bindKey: "Tab"
2804
+ };
2805
+ var onChangeMode = function (e, editor) {
2806
+ loadSnippetsForMode(editor.session.$mode);
2807
+ };
2808
+ var loadSnippetsForMode = function (mode) {
2809
+ if (typeof mode == "string")
2810
+ mode = config.$modes[mode];
2811
+ if (!mode)
2812
+ return;
2813
+ if (!snippetManager.files)
2814
+ snippetManager.files = {};
2815
+ loadSnippetFile(mode.$id, mode.snippetFileId);
2816
+ if (mode.modes)
2817
+ mode.modes.forEach(loadSnippetsForMode);
2818
+ };
2819
+ var loadSnippetFile = function (id, snippetFilePath) {
2820
+ if (!snippetFilePath || !id || snippetManager.files[id])
2821
+ return;
2822
+ snippetManager.files[id] = {};
2823
+ config.loadModule(snippetFilePath, function (m) {
2824
+ if (!m)
2825
+ return;
2826
+ snippetManager.files[id] = m;
2827
+ if (!m.snippets && m.snippetText)
2828
+ m.snippets = snippetManager.parseSnippetFile(m.snippetText);
2829
+ snippetManager.register(m.snippets || [], m.scope);
2830
+ if (m.includeScopes) {
2831
+ snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
2832
+ m.includeScopes.forEach(function (x) {
2833
+ loadSnippetsForMode("ace/mode/" + x);
2834
+ });
2835
+ }
2836
+ });
2837
+ };
2838
+ var doLiveAutocomplete = function (e) {
2839
+ var editor = e.editor;
2840
+ var hasCompleter = editor.completer && editor.completer.activated;
2841
+ if (e.command.name === "backspace") {
2842
+ if (hasCompleter && !util.getCompletionPrefix(editor))
2843
+ editor.completer.detach();
2844
+ }
2845
+ else if (e.command.name === "insertstring" && !hasCompleter) {
2846
+ lastExecEvent = e;
2847
+ var delay = e.editor.$liveAutocompletionDelay;
2848
+ if (delay) {
2849
+ liveAutocompleteTimer.delay(delay);
2850
+ }
2851
+ else {
2852
+ showLiveAutocomplete(e);
2853
+ }
2854
+ }
2855
+ };
2856
+ var lastExecEvent;
2857
+ var liveAutocompleteTimer = lang.delayedCall(function () {
2858
+ showLiveAutocomplete(lastExecEvent);
2859
+ }, 0);
2860
+ var showLiveAutocomplete = function (e) {
2861
+ var editor = e.editor;
2862
+ var prefix = util.getCompletionPrefix(editor);
2863
+ var triggerAutocomplete = util.triggerAutocomplete(editor);
2864
+ if (prefix && prefix.length >= editor.$liveAutocompletionThreshold || triggerAutocomplete) {
2865
+ var completer = Autocomplete.for(editor);
2866
+ completer.autoShown = true;
2867
+ completer.showPopup(editor);
2868
+ }
2869
+ };
2870
+ var Editor = require("../editor").Editor;
2871
+ require("../config").defineOptions(Editor.prototype, "editor", {
2872
+ enableBasicAutocompletion: {
2873
+ set: function (val) {
2874
+ if (val) {
2875
+ if (!this.completers)
2876
+ this.completers = Array.isArray(val) ? val : completers;
2877
+ this.commands.addCommand(Autocomplete.startCommand);
2878
+ }
2879
+ else {
2880
+ this.commands.removeCommand(Autocomplete.startCommand);
2881
+ }
2882
+ },
2883
+ value: false
2884
+ },
2885
+ enableLiveAutocompletion: {
2886
+ set: function (val) {
2887
+ if (val) {
2888
+ if (!this.completers)
2889
+ this.completers = Array.isArray(val) ? val : completers;
2890
+ this.commands.on('afterExec', doLiveAutocomplete);
2891
+ }
2892
+ else {
2893
+ this.commands.off('afterExec', doLiveAutocomplete);
2894
+ }
2895
+ },
2896
+ value: false
2897
+ },
2898
+ liveAutocompletionDelay: {
2899
+ initialValue: 0
2900
+ },
2901
+ liveAutocompletionThreshold: {
2902
+ initialValue: 0
2903
+ },
2904
+ enableSnippets: {
2905
+ set: function (val) {
2906
+ if (val) {
2907
+ this.commands.addCommand(expandSnippet);
2908
+ this.on("changeMode", onChangeMode);
2909
+ onChangeMode(null, this);
2910
+ }
2911
+ else {
2912
+ this.commands.removeCommand(expandSnippet);
2913
+ this.off("changeMode", onChangeMode);
2914
+ }
2915
+ },
2916
+ value: false
2917
+ }
2918
+ });
2919
+
2920
+ });
2921
+
2922
+ ace.define("ace/ext/inline_autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/inline","ace/autocomplete","ace/autocomplete","ace/editor","ace/autocomplete/util","ace/lib/dom","ace/lib/lang","ace/ext/command_bar","ace/ext/command_bar","ace/ext/language_tools","ace/ext/language_tools","ace/ext/language_tools","ace/config"], function(require, exports, module){"use strict";
2923
+ var HashHandler = require("../keyboard/hash_handler").HashHandler;
2924
+ var AceInline = require("../autocomplete/inline").AceInline;
2925
+ var FilteredList = require("../autocomplete").FilteredList;
2926
+ var CompletionProvider = require("../autocomplete").CompletionProvider;
2927
+ var Editor = require("../editor").Editor;
2928
+ var util = require("../autocomplete/util");
2929
+ var dom = require("../lib/dom");
2930
+ var lang = require("../lib/lang");
2931
+ var CommandBarTooltip = require("./command_bar").CommandBarTooltip;
2932
+ var BUTTON_CLASS_NAME = require("./command_bar").BUTTON_CLASS_NAME;
2933
+ var snippetCompleter = require("./language_tools").snippetCompleter;
2934
+ var textCompleter = require("./language_tools").textCompleter;
2935
+ var keyWordCompleter = require("./language_tools").keyWordCompleter;
2936
+ var destroyCompleter = function (e, editor) {
2937
+ editor.completer && editor.completer.destroy();
2938
+ };
2939
+ var InlineAutocomplete = /** @class */ (function () {
2940
+ function InlineAutocomplete(editor) {
2941
+ this.editor = editor;
2942
+ this.keyboardHandler = new HashHandler(this.commands);
2943
+ this.$index = -1;
2944
+ this.blurListener = this.blurListener.bind(this);
2945
+ this.changeListener = this.changeListener.bind(this);
2946
+ this.changeTimer = lang.delayedCall(function () {
2947
+ this.updateCompletions();
2948
+ }.bind(this));
2949
+ }
2950
+ InlineAutocomplete.prototype.getInlineRenderer = function () {
2951
+ if (!this.inlineRenderer)
2952
+ this.inlineRenderer = new AceInline();
2953
+ return this.inlineRenderer;
2954
+ };
2955
+ InlineAutocomplete.prototype.getInlineTooltip = function () {
2956
+ if (!this.inlineTooltip) {
2957
+ this.inlineTooltip = InlineAutocomplete.createInlineTooltip(document.body || document.documentElement);
2958
+ }
2959
+ return this.inlineTooltip;
2960
+ };
2961
+ InlineAutocomplete.prototype.show = function (options) {
2962
+ this.activated = true;
2963
+ if (this.editor.completer !== this) {
2964
+ if (this.editor.completer)
2965
+ this.editor.completer.detach();
2966
+ this.editor.completer = this;
2967
+ }
2968
+ this.editor.on("changeSelection", this.changeListener);
2969
+ this.editor.on("blur", this.blurListener);
2970
+ this.updateCompletions(options);
2971
+ };
2972
+ InlineAutocomplete.prototype.$open = function () {
2973
+ if (this.editor.textInput.setAriaOptions) {
2974
+ this.editor.textInput.setAriaOptions({});
2975
+ }
2976
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
2977
+ this.getInlineTooltip().attach(this.editor);
2978
+ if (this.$index === -1) {
2979
+ this.setIndex(0);
2980
+ }
2981
+ else {
2982
+ this.$showCompletion();
2983
+ }
2984
+ this.changeTimer.cancel();
2985
+ };
2986
+ InlineAutocomplete.prototype.insertMatch = function () {
2987
+ var result = this.getCompletionProvider().insertByIndex(this.editor, this.$index);
2988
+ this.detach();
2989
+ return result;
2990
+ };
2991
+ InlineAutocomplete.prototype.changeListener = function (e) {
2992
+ var cursor = this.editor.selection.lead;
2993
+ if (cursor.row != this.base.row || cursor.column < this.base.column) {
2994
+ this.detach();
2995
+ }
2996
+ if (this.activated)
2997
+ this.changeTimer.schedule();
2998
+ else
2999
+ this.detach();
3000
+ };
3001
+ InlineAutocomplete.prototype.blurListener = function (e) {
3002
+ this.detach();
3003
+ };
3004
+ InlineAutocomplete.prototype.goTo = function (where) {
3005
+ if (!this.completions || !this.completions.filtered) {
3006
+ return;
3007
+ }
3008
+ var completionLength = this.completions.filtered.length;
3009
+ switch (where.toLowerCase()) {
3010
+ case "prev":
3011
+ this.setIndex((this.$index - 1 + completionLength) % completionLength);
3012
+ break;
3013
+ case "next":
3014
+ this.setIndex((this.$index + 1 + completionLength) % completionLength);
3015
+ break;
3016
+ case "first":
3017
+ this.setIndex(0);
3018
+ break;
3019
+ case "last":
3020
+ this.setIndex(this.completions.filtered.length - 1);
3021
+ break;
3022
+ }
3023
+ };
3024
+ InlineAutocomplete.prototype.getLength = function () {
3025
+ if (!this.completions || !this.completions.filtered) {
3026
+ return 0;
3027
+ }
3028
+ return this.completions.filtered.length;
3029
+ };
3030
+ InlineAutocomplete.prototype.getData = function (index) {
3031
+ if (index == undefined || index === null) {
3032
+ return this.completions.filtered[this.$index];
3033
+ }
3034
+ else {
3035
+ return this.completions.filtered[index];
3036
+ }
3037
+ };
3038
+ InlineAutocomplete.prototype.getIndex = function () {
3039
+ return this.$index;
3040
+ };
3041
+ InlineAutocomplete.prototype.isOpen = function () {
3042
+ return this.$index >= 0;
3043
+ };
3044
+ InlineAutocomplete.prototype.setIndex = function (value) {
3045
+ if (!this.completions || !this.completions.filtered) {
3046
+ return;
3047
+ }
3048
+ var newIndex = Math.max(-1, Math.min(this.completions.filtered.length - 1, value));
3049
+ if (newIndex !== this.$index) {
3050
+ this.$index = newIndex;
3051
+ this.$showCompletion();
3052
+ }
3053
+ };
3054
+ InlineAutocomplete.prototype.getCompletionProvider = function (initialPosition) {
3055
+ if (!this.completionProvider)
3056
+ this.completionProvider = new CompletionProvider(initialPosition);
3057
+ return this.completionProvider;
3058
+ };
3059
+ InlineAutocomplete.prototype.$showCompletion = function () {
3060
+ if (!this.getInlineRenderer().show(this.editor, this.completions.filtered[this.$index], this.completions.filterText)) {
3061
+ this.getInlineRenderer().hide();
3062
+ }
3063
+ if (this.inlineTooltip && this.inlineTooltip.isShown()) {
3064
+ this.inlineTooltip.update();
3065
+ }
3066
+ };
3067
+ InlineAutocomplete.prototype.$updatePrefix = function () {
3068
+ var pos = this.editor.getCursorPosition();
3069
+ var prefix = this.editor.session.getTextRange({ start: this.base, end: pos });
3070
+ this.completions.setFilter(prefix);
3071
+ if (!this.completions.filtered.length)
3072
+ return this.detach();
3073
+ if (this.completions.filtered.length == 1
3074
+ && this.completions.filtered[0].value == prefix
3075
+ && !this.completions.filtered[0].snippet)
3076
+ return this.detach();
3077
+ this.$open(this.editor, prefix);
3078
+ return prefix;
3079
+ };
3080
+ InlineAutocomplete.prototype.updateCompletions = function (options) {
3081
+ var prefix = "";
3082
+ if (options && options.matches) {
3083
+ var pos = this.editor.getSelectionRange().start;
3084
+ this.base = this.editor.session.doc.createAnchor(pos.row, pos.column);
3085
+ this.base.$insertRight = true;
3086
+ this.completions = new FilteredList(options.matches);
3087
+ return this.$open(this.editor, "");
3088
+ }
3089
+ if (this.base && this.completions) {
3090
+ prefix = this.$updatePrefix();
3091
+ }
3092
+ var session = this.editor.getSession();
3093
+ var pos = this.editor.getCursorPosition();
3094
+ var prefix = util.getCompletionPrefix(this.editor);
3095
+ this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
3096
+ this.base.$insertRight = true;
3097
+ var options = {
3098
+ exactMatch: true,
3099
+ ignoreCaption: true
3100
+ };
3101
+ this.getCompletionProvider({
3102
+ prefix: prefix,
3103
+ base: this.base,
3104
+ pos: pos
3105
+ }).provideCompletions(this.editor, options, function (err, completions, finished) {
3106
+ var filtered = completions.filtered;
3107
+ var prefix = util.getCompletionPrefix(this.editor);
3108
+ if (finished) {
3109
+ if (!filtered.length)
3110
+ return this.detach();
3111
+ if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
3112
+ return this.detach();
3113
+ }
3114
+ this.completions = completions;
3115
+ this.$open(this.editor, prefix);
3116
+ }.bind(this));
3117
+ };
3118
+ InlineAutocomplete.prototype.detach = function () {
3119
+ if (this.editor) {
3120
+ this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
3121
+ this.editor.off("changeSelection", this.changeListener);
3122
+ this.editor.off("blur", this.blurListener);
3123
+ }
3124
+ this.changeTimer.cancel();
3125
+ if (this.inlineTooltip) {
3126
+ this.inlineTooltip.detach();
3127
+ }
3128
+ this.setIndex(-1);
3129
+ if (this.completionProvider) {
3130
+ this.completionProvider.detach();
3131
+ }
3132
+ if (this.inlineRenderer && this.inlineRenderer.isOpen()) {
3133
+ this.inlineRenderer.hide();
3134
+ }
3135
+ if (this.base)
3136
+ this.base.detach();
3137
+ this.activated = false;
3138
+ this.completionProvider = this.completions = this.base = null;
3139
+ };
3140
+ InlineAutocomplete.prototype.destroy = function () {
3141
+ this.detach();
3142
+ if (this.inlineRenderer)
3143
+ this.inlineRenderer.destroy();
3144
+ if (this.inlineTooltip)
3145
+ this.inlineTooltip.destroy();
3146
+ if (this.editor && this.editor.completer == this) {
3147
+ this.editor.off("destroy", destroyCompleter);
3148
+ this.editor.completer = null;
3149
+ }
3150
+ this.inlineTooltip = this.editor = this.inlineRenderer = null;
3151
+ };
3152
+ return InlineAutocomplete;
3153
+ }());
3154
+ InlineAutocomplete.prototype.commands = {
3155
+ "Previous": {
3156
+ bindKey: "Alt-[",
3157
+ name: "Previous",
3158
+ exec: function (editor) {
3159
+ editor.completer.goTo("prev");
3160
+ }
3161
+ },
3162
+ "Next": {
3163
+ bindKey: "Alt-]",
3164
+ name: "Next",
3165
+ exec: function (editor) {
3166
+ editor.completer.goTo("next");
3167
+ }
3168
+ },
3169
+ "Accept": {
3170
+ bindKey: { win: "Tab|Ctrl-Right", mac: "Tab|Cmd-Right" },
3171
+ name: "Accept",
3172
+ exec: function (editor) {
3173
+ return editor.completer.insertMatch();
3174
+ }
3175
+ },
3176
+ "Close": {
3177
+ bindKey: "Esc",
3178
+ name: "Close",
3179
+ exec: function (editor) {
3180
+ editor.completer.detach();
3181
+ }
3182
+ }
3183
+ };
3184
+ InlineAutocomplete.for = function (editor) {
3185
+ if (editor.completer instanceof InlineAutocomplete) {
3186
+ return editor.completer;
3187
+ }
3188
+ if (editor.completer) {
3189
+ editor.completer.destroy();
3190
+ editor.completer = null;
3191
+ }
3192
+ editor.completer = new InlineAutocomplete(editor);
3193
+ editor.once("destroy", destroyCompleter);
3194
+ return editor.completer;
3195
+ };
3196
+ InlineAutocomplete.startCommand = {
3197
+ name: "startInlineAutocomplete",
3198
+ exec: function (editor, options) {
3199
+ var completer = InlineAutocomplete.for(editor);
3200
+ completer.show(options);
3201
+ },
3202
+ bindKey: { win: "Alt-C", mac: "Option-C" }
3203
+ };
3204
+ var completers = [snippetCompleter, textCompleter, keyWordCompleter];
3205
+ require("../config").defineOptions(Editor.prototype, "editor", {
3206
+ enableInlineAutocompletion: {
3207
+ set: function (val) {
3208
+ if (val) {
3209
+ if (!this.completers)
3210
+ this.completers = Array.isArray(val) ? val : completers;
3211
+ this.commands.addCommand(InlineAutocomplete.startCommand);
3212
+ }
3213
+ else {
3214
+ this.commands.removeCommand(InlineAutocomplete.startCommand);
3215
+ }
3216
+ },
3217
+ value: false
3218
+ }
3219
+ });
3220
+ InlineAutocomplete.createInlineTooltip = function (parentEl) {
3221
+ var inlineTooltip = new CommandBarTooltip(parentEl);
3222
+ inlineTooltip.registerCommand("Previous", Object.assign({}, InlineAutocomplete.prototype.commands["Previous"], {
3223
+ enabled: true,
3224
+ type: "button",
3225
+ iconCssClass: "ace_arrow_rotated"
3226
+ }));
3227
+ inlineTooltip.registerCommand("Position", {
3228
+ enabled: false,
3229
+ getValue: function (editor) {
3230
+ return editor ? [editor.completer.getIndex() + 1, editor.completer.getLength()].join("/") : "";
3231
+ },
3232
+ type: "text",
3233
+ cssClass: "completion_position"
3234
+ });
3235
+ inlineTooltip.registerCommand("Next", Object.assign({}, InlineAutocomplete.prototype.commands["Next"], {
3236
+ enabled: true,
3237
+ type: "button",
3238
+ iconCssClass: "ace_arrow"
3239
+ }));
3240
+ inlineTooltip.registerCommand("Accept", Object.assign({}, InlineAutocomplete.prototype.commands["Accept"], {
3241
+ enabled: function (editor) {
3242
+ return !!editor && editor.completer.getIndex() >= 0;
3243
+ },
3244
+ type: "button"
3245
+ }));
3246
+ inlineTooltip.registerCommand("ShowTooltip", {
3247
+ name: "Always Show Tooltip",
3248
+ exec: function () {
3249
+ inlineTooltip.setAlwaysShow(!inlineTooltip.getAlwaysShow());
3250
+ },
3251
+ enabled: true,
3252
+ getValue: function () {
3253
+ return inlineTooltip.getAlwaysShow();
3254
+ },
3255
+ type: "checkbox"
3256
+ });
3257
+ return inlineTooltip;
3258
+ };
3259
+ dom.importCssString("\n\n.ace_icon_svg.ace_arrow,\n.ace_icon_svg.ace_arrow_rotated {\n -webkit-mask-image: url(\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTUuODM3MDEgMTVMNC41ODc1MSAxMy43MTU1TDEwLjE0NjggOEw0LjU4NzUxIDIuMjg0NDZMNS44MzcwMSAxTDEyLjY0NjUgOEw1LjgzNzAxIDE1WiIgZmlsbD0iYmxhY2siLz48L3N2Zz4=\");\n}\n\n.ace_icon_svg.ace_arrow_rotated {\n transform: rotate(180deg);\n}\n\ndiv.".concat(BUTTON_CLASS_NAME, ".completion_position {\n padding: 0;\n}\n"), "inlineautocomplete.css", false);
3260
+ exports.InlineAutocomplete = InlineAutocomplete;
3261
+
3262
+ }); (function() {
3263
+ ace.require(["ace/ext/inline_autocomplete"], function(m) {
3264
+ if (typeof module == "object" && typeof exports == "object" && module) {
3265
+ module.exports = m;
3266
+ }
3267
+ });
3268
+ })();
3269
+