c0ckp1t 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (676) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +5 -0
  3. package/c0ckp1t-demo/Constants.mjs +125 -0
  4. package/c0ckp1t-demo/components/sidebar.vue +82 -0
  5. package/c0ckp1t-demo/main.vue +39 -0
  6. package/c0ckp1t-demo/pages/devices.vue +63 -0
  7. package/c0ckp1t-demo/pages/homepage.vue +63 -0
  8. package/c0ckp1t-demo/pages/report.vue +63 -0
  9. package/c0ckp1t-demo/store.mjs +133 -0
  10. package/components/ExecButton.vue +62 -0
  11. package/components/FsTree.vue +550 -0
  12. package/components/Markdown.mjs +274 -0
  13. package/components/MarkdownUtils.mjs +180 -0
  14. package/components/Tree.mjs +175 -0
  15. package/components/code-mirror.vue +445 -0
  16. package/components/vue3-ace-editor.vue +331 -0
  17. package/components/xbutton.vue +45 -0
  18. package/components/xcard-h.vue +175 -0
  19. package/components/xcard.vue +76 -0
  20. package/components/xcheck.vue +35 -0
  21. package/components/xcheckbox.vue +52 -0
  22. package/components/xcode.vue +139 -0
  23. package/components/xcollapse.vue +52 -0
  24. package/components/xcolor.vue +84 -0
  25. package/components/xdropdown.vue +104 -0
  26. package/components/xdropdown2.vue +140 -0
  27. package/components/xhidden.vue +30 -0
  28. package/components/xinput.vue +101 -0
  29. package/components/xinput2.vue +101 -0
  30. package/components/xjson.vue +95 -0
  31. package/components/xkv.vue +41 -0
  32. package/components/xlabel.vue +56 -0
  33. package/components/xlist.vue +83 -0
  34. package/components/xmap.vue +106 -0
  35. package/components/xmarkdown.vue +269 -0
  36. package/components/xnav.vue +98 -0
  37. package/components/xsection.vue +164 -0
  38. package/components/xsound.vue +251 -0
  39. package/components/xtable-open.vue +179 -0
  40. package/components/xtabs.vue +72 -0
  41. package/components/xterminal.vue +456 -0
  42. package/components/xtextarea.vue +83 -0
  43. package/components/xtoggle.vue +68 -0
  44. package/components/xtoggle3.vue +67 -0
  45. package/components/xtree.vue +140 -0
  46. package/components/xupload.vue +129 -0
  47. package/core/Content.mjs +92 -0
  48. package/core/DocUtils.mjs +189 -0
  49. package/core/GlobalStore.mjs +329 -0
  50. package/core/Island.mjs +429 -0
  51. package/core/IslandDefault.mjs +229 -0
  52. package/core/JsUtils.mjs +483 -0
  53. package/core/Logging.mjs +59 -0
  54. package/core/Page404.vue +152 -0
  55. package/core/PageFallback.vue +168 -0
  56. package/core/PageMain.vue +181 -0
  57. package/core/Theme.mjs +1759 -0
  58. package/core/VueUtils.mjs +200 -0
  59. package/core/WsUtils.mjs +274 -0
  60. package/core/img/Flag_of_the_United_States.svg +25 -0
  61. package/core/img/logo_v1.svg +98 -0
  62. package/core/img/logo_v2.svg +98 -0
  63. package/core/img/state-uniqueId-8k.wav +0 -0
  64. package/core/main-offcanvas.vue +99 -0
  65. package/core/nodes/_api.vue +82 -0
  66. package/core/nodes/node-container.vue +103 -0
  67. package/core/nodes/node.vue +246 -0
  68. package/core/nodes/place-holder.vue +47 -0
  69. package/core/nodes/root.vue +52 -0
  70. package/core/notify/NotifyUtils.mjs +150 -0
  71. package/core/notify/toast.vue +150 -0
  72. package/core/pages/About.vue +57 -0
  73. package/core/pages/Cache.vue +155 -0
  74. package/core/pages/Connection.vue +192 -0
  75. package/core/pages/Connections.vue +102 -0
  76. package/core/pages/Documentation.vue +263 -0
  77. package/core/pages/Notifies.vue +156 -0
  78. package/core/pages/Traffic.vue +152 -0
  79. package/core/pages/connections/connection-header-details.vue +80 -0
  80. package/core/pages/connections/page-connection-default.vue +92 -0
  81. package/core/pages/connections/page-connection.vue +176 -0
  82. package/core/pages/connections/ws-connection.vue +146 -0
  83. package/core/pages/frontend/Bootstrap.vue +1140 -0
  84. package/core/pages/frontend/Components.vue +56 -0
  85. package/core/pages/frontend/ComponentsAdv.vue +203 -0
  86. package/core/pages/frontend/ComponentsBasic.vue +336 -0
  87. package/core/pages/frontend/Theme.vue +473 -0
  88. package/core/pages/frontend/component-view.vue +65 -0
  89. package/core/pages/traffic/WsLogUtils.mjs +91 -0
  90. package/core/pages/traffic/log-ws-exec.vue +124 -0
  91. package/core/pages/traffic/log-ws-exec2.vue +129 -0
  92. package/core/sfc/code-item.vue +169 -0
  93. package/core/sfc/connection-header.vue +62 -0
  94. package/core/sfc/info-api.vue +158 -0
  95. package/core/sfc/md-toc.vue +346 -0
  96. package/core/sfc/scroll-to-top.vue +69 -0
  97. package/core/sfc/task.vue +98 -0
  98. package/core/sfc/text-to-md.vue +25 -0
  99. package/core/sfc/toc-list.vue +175 -0
  100. package/core/ws-client/AuthNState.mjs +84 -0
  101. package/core/ws-client/Connection.mjs +580 -0
  102. package/core/ws-client/Session.mjs +72 -0
  103. package/core/ws-client/WsClient.mjs +230 -0
  104. package/core/ws-client/WsLogUtils.mjs +91 -0
  105. package/core/ws-client/ws-connection.vue +144 -0
  106. package/css/Changa-Medium.ttf +0 -0
  107. package/css/Makefile +10 -0
  108. package/css/README.md +25 -0
  109. package/css/bootstrap-c0ckp1t.css +11861 -0
  110. package/css/bootstrap.min.css +6 -0
  111. package/css/fontawesome/brands.min.css +6 -0
  112. package/css/fontawesome/fontawesome.min.css +8 -0
  113. package/css/fontawesome/regular.min.css +6 -0
  114. package/css/fontawesome/solid.min.css +6 -0
  115. package/css/webfonts/fa-brands-400.woff2 +0 -0
  116. package/css/webfonts/fa-regular-400.woff2 +0 -0
  117. package/css/webfonts/fa-solid-900.woff2 +0 -0
  118. package/docs/Introduction.md +3 -0
  119. package/favicon-192x192.png +0 -0
  120. package/favicon-32x32.png +0 -0
  121. package/favicon-64x64.png +0 -0
  122. package/favicon.ico +0 -0
  123. package/index-cdn.html +66 -0
  124. package/js_ext/Makefile +26 -0
  125. package/js_ext/ace-editor/ace.js +22037 -0
  126. package/js_ext/ace-editor/ext-beautify.js +343 -0
  127. package/js_ext/ace-editor/ext-code_lens.js +204 -0
  128. package/js_ext/ace-editor/ext-command_bar.js +469 -0
  129. package/js_ext/ace-editor/ext-diff.js +4265 -0
  130. package/js_ext/ace-editor/ext-elastic_tabstops_lite.js +238 -0
  131. package/js_ext/ace-editor/ext-emmet.js +1303 -0
  132. package/js_ext/ace-editor/ext-error_marker.js +9 -0
  133. package/js_ext/ace-editor/ext-hardwrap.js +127 -0
  134. package/js_ext/ace-editor/ext-inline_autocomplete.js +3547 -0
  135. package/js_ext/ace-editor/ext-keybinding_menu.js +185 -0
  136. package/js_ext/ace-editor/ext-language_tools.js +2724 -0
  137. package/js_ext/ace-editor/ext-linking.js +66 -0
  138. package/js_ext/ace-editor/ext-modelist.js +276 -0
  139. package/js_ext/ace-editor/ext-options.js +859 -0
  140. package/js_ext/ace-editor/ext-prompt.js +3161 -0
  141. package/js_ext/ace-editor/ext-rtl.js +146 -0
  142. package/js_ext/ace-editor/ext-searchbox.js +385 -0
  143. package/js_ext/ace-editor/ext-settings_menu.js +859 -0
  144. package/js_ext/ace-editor/ext-simple_tokenizer.js +137 -0
  145. package/js_ext/ace-editor/ext-spellcheck.js +79 -0
  146. package/js_ext/ace-editor/ext-split.js +203 -0
  147. package/js_ext/ace-editor/ext-static_highlight.js +194 -0
  148. package/js_ext/ace-editor/ext-statusbar.js +63 -0
  149. package/js_ext/ace-editor/ext-textarea.js +400 -0
  150. package/js_ext/ace-editor/ext-themelist.js +80 -0
  151. package/js_ext/ace-editor/ext-whitespace.js +201 -0
  152. package/js_ext/ace-editor/keybinding-emacs.js +1067 -0
  153. package/js_ext/ace-editor/keybinding-sublime.js +409 -0
  154. package/js_ext/ace-editor/keybinding-vim.js +7101 -0
  155. package/js_ext/ace-editor/keybinding-vscode.js +255 -0
  156. package/js_ext/ace-editor/mode-abap.js +200 -0
  157. package/js_ext/ace-editor/mode-abc.js +243 -0
  158. package/js_ext/ace-editor/mode-actionscript.js +234 -0
  159. package/js_ext/ace-editor/mode-ada.js +108 -0
  160. package/js_ext/ace-editor/mode-alda.js +279 -0
  161. package/js_ext/ace-editor/mode-apache_conf.js +318 -0
  162. package/js_ext/ace-editor/mode-apex.js +402 -0
  163. package/js_ext/ace-editor/mode-applescript.js +232 -0
  164. package/js_ext/ace-editor/mode-aql.js +92 -0
  165. package/js_ext/ace-editor/mode-asciidoc.js +311 -0
  166. package/js_ext/ace-editor/mode-asl.js +357 -0
  167. package/js_ext/ace-editor/mode-assembly_arm32.js +185 -0
  168. package/js_ext/ace-editor/mode-assembly_x86.js +170 -0
  169. package/js_ext/ace-editor/mode-astro.js +2474 -0
  170. package/js_ext/ace-editor/mode-autohotkey.js +208 -0
  171. package/js_ext/ace-editor/mode-basic.js +201 -0
  172. package/js_ext/ace-editor/mode-batchfile.js +199 -0
  173. package/js_ext/ace-editor/mode-bibtex.js +318 -0
  174. package/js_ext/ace-editor/mode-c9search.js +250 -0
  175. package/js_ext/ace-editor/mode-c_cpp.js +417 -0
  176. package/js_ext/ace-editor/mode-cirru.js +192 -0
  177. package/js_ext/ace-editor/mode-clojure.js +322 -0
  178. package/js_ext/ace-editor/mode-clue.js +361 -0
  179. package/js_ext/ace-editor/mode-cobol.js +82 -0
  180. package/js_ext/ace-editor/mode-coffee.js +335 -0
  181. package/js_ext/ace-editor/mode-coldfusion.js +2409 -0
  182. package/js_ext/ace-editor/mode-crystal.js +586 -0
  183. package/js_ext/ace-editor/mode-csharp.js +413 -0
  184. package/js_ext/ace-editor/mode-csound_document.js +4072 -0
  185. package/js_ext/ace-editor/mode-csound_orchestra.js +2923 -0
  186. package/js_ext/ace-editor/mode-csound_score.js +409 -0
  187. package/js_ext/ace-editor/mode-csp.js +59 -0
  188. package/js_ext/ace-editor/mode-css.js +632 -0
  189. package/js_ext/ace-editor/mode-csv.js +97 -0
  190. package/js_ext/ace-editor/mode-curly.js +2381 -0
  191. package/js_ext/ace-editor/mode-cuttlefish.js +56 -0
  192. package/js_ext/ace-editor/mode-d.js +450 -0
  193. package/js_ext/ace-editor/mode-dart.js +618 -0
  194. package/js_ext/ace-editor/mode-diff.js +129 -0
  195. package/js_ext/ace-editor/mode-django.js +2422 -0
  196. package/js_ext/ace-editor/mode-dockerfile.js +427 -0
  197. package/js_ext/ace-editor/mode-dot.js +348 -0
  198. package/js_ext/ace-editor/mode-drools.js +607 -0
  199. package/js_ext/ace-editor/mode-edifact.js +130 -0
  200. package/js_ext/ace-editor/mode-eiffel.js +120 -0
  201. package/js_ext/ace-editor/mode-ejs.js +3277 -0
  202. package/js_ext/ace-editor/mode-elixir.js +443 -0
  203. package/js_ext/ace-editor/mode-elm.js +274 -0
  204. package/js_ext/ace-editor/mode-erlang.js +836 -0
  205. package/js_ext/ace-editor/mode-flix.js +164 -0
  206. package/js_ext/ace-editor/mode-forth.js +253 -0
  207. package/js_ext/ace-editor/mode-fortran.js +361 -0
  208. package/js_ext/ace-editor/mode-fsharp.js +277 -0
  209. package/js_ext/ace-editor/mode-fsl.js +226 -0
  210. package/js_ext/ace-editor/mode-ftl.js +1255 -0
  211. package/js_ext/ace-editor/mode-gcode.js +74 -0
  212. package/js_ext/ace-editor/mode-gherkin.js +154 -0
  213. package/js_ext/ace-editor/mode-gitignore.js +49 -0
  214. package/js_ext/ace-editor/mode-glsl.js +475 -0
  215. package/js_ext/ace-editor/mode-gobstones.js +1459 -0
  216. package/js_ext/ace-editor/mode-golang.js +341 -0
  217. package/js_ext/ace-editor/mode-graphqlschema.js +174 -0
  218. package/js_ext/ace-editor/mode-groovy.js +1401 -0
  219. package/js_ext/ace-editor/mode-haml.js +1906 -0
  220. package/js_ext/ace-editor/mode-handlebars.js +2438 -0
  221. package/js_ext/ace-editor/mode-haskell.js +324 -0
  222. package/js_ext/ace-editor/mode-haskell_cabal.js +135 -0
  223. package/js_ext/ace-editor/mode-haxe.js +313 -0
  224. package/js_ext/ace-editor/mode-hjson.js +318 -0
  225. package/js_ext/ace-editor/mode-html.js +2339 -0
  226. package/js_ext/ace-editor/mode-html_elixir.js +2845 -0
  227. package/js_ext/ace-editor/mode-html_ruby.js +3294 -0
  228. package/js_ext/ace-editor/mode-ini.js +138 -0
  229. package/js_ext/ace-editor/mode-io.js +210 -0
  230. package/js_ext/ace-editor/mode-ion.js +477 -0
  231. package/js_ext/ace-editor/mode-jack.js +293 -0
  232. package/js_ext/ace-editor/mode-jade.js +2017 -0
  233. package/js_ext/ace-editor/mode-java.js +1565 -0
  234. package/js_ext/ace-editor/mode-javascript.js +1191 -0
  235. package/js_ext/ace-editor/mode-jexl.js +270 -0
  236. package/js_ext/ace-editor/mode-json.js +275 -0
  237. package/js_ext/ace-editor/mode-json5.js +308 -0
  238. package/js_ext/ace-editor/mode-jsoniq.js +2577 -0
  239. package/js_ext/ace-editor/mode-jsp.js +1618 -0
  240. package/js_ext/ace-editor/mode-jssm.js +293 -0
  241. package/js_ext/ace-editor/mode-jsx.js +1209 -0
  242. package/js_ext/ace-editor/mode-julia.js +254 -0
  243. package/js_ext/ace-editor/mode-kotlin.js +445 -0
  244. package/js_ext/ace-editor/mode-latex.js +252 -0
  245. package/js_ext/ace-editor/mode-latte.js +2522 -0
  246. package/js_ext/ace-editor/mode-less.js +742 -0
  247. package/js_ext/ace-editor/mode-liquid.js +2741 -0
  248. package/js_ext/ace-editor/mode-lisp.js +104 -0
  249. package/js_ext/ace-editor/mode-livescript.js +272 -0
  250. package/js_ext/ace-editor/mode-logiql.js +272 -0
  251. package/js_ext/ace-editor/mode-logtalk.js +309 -0
  252. package/js_ext/ace-editor/mode-lsl.js +287 -0
  253. package/js_ext/ace-editor/mode-lua.js +393 -0
  254. package/js_ext/ace-editor/mode-luapage.js +2785 -0
  255. package/js_ext/ace-editor/mode-lucene.js +145 -0
  256. package/js_ext/ace-editor/mode-makefile.js +374 -0
  257. package/js_ext/ace-editor/mode-markdown.js +2935 -0
  258. package/js_ext/ace-editor/mode-mask.js +1757 -0
  259. package/js_ext/ace-editor/mode-matlab.js +239 -0
  260. package/js_ext/ace-editor/mode-maze.js +256 -0
  261. package/js_ext/ace-editor/mode-mediawiki.js +580 -0
  262. package/js_ext/ace-editor/mode-mel.js +213 -0
  263. package/js_ext/ace-editor/mode-mips.js +231 -0
  264. package/js_ext/ace-editor/mode-mixal.js +110 -0
  265. package/js_ext/ace-editor/mode-mushcode.js +642 -0
  266. package/js_ext/ace-editor/mode-mysql.js +150 -0
  267. package/js_ext/ace-editor/mode-nasal.js +513 -0
  268. package/js_ext/ace-editor/mode-nginx.js +262 -0
  269. package/js_ext/ace-editor/mode-nim.js +325 -0
  270. package/js_ext/ace-editor/mode-nix.js +555 -0
  271. package/js_ext/ace-editor/mode-nsis.js +279 -0
  272. package/js_ext/ace-editor/mode-nunjucks.js +2677 -0
  273. package/js_ext/ace-editor/mode-objectivec.js +626 -0
  274. package/js_ext/ace-editor/mode-ocaml.js +378 -0
  275. package/js_ext/ace-editor/mode-odin.js +449 -0
  276. package/js_ext/ace-editor/mode-partiql.js +750 -0
  277. package/js_ext/ace-editor/mode-pascal.js +204 -0
  278. package/js_ext/ace-editor/mode-perl.js +318 -0
  279. package/js_ext/ace-editor/mode-pgsql.js +1860 -0
  280. package/js_ext/ace-editor/mode-php.js +14072 -0
  281. package/js_ext/ace-editor/mode-php_laravel_blade.js +14260 -0
  282. package/js_ext/ace-editor/mode-pig.js +278 -0
  283. package/js_ext/ace-editor/mode-plain_text.js +27 -0
  284. package/js_ext/ace-editor/mode-plsql.js +268 -0
  285. package/js_ext/ace-editor/mode-powershell.js +567 -0
  286. package/js_ext/ace-editor/mode-praat.js +412 -0
  287. package/js_ext/ace-editor/mode-prisma.js +457 -0
  288. package/js_ext/ace-editor/mode-prolog.js +305 -0
  289. package/js_ext/ace-editor/mode-properties.js +69 -0
  290. package/js_ext/ace-editor/mode-protobuf.js +498 -0
  291. package/js_ext/ace-editor/mode-prql.js +323 -0
  292. package/js_ext/ace-editor/mode-puppet.js +316 -0
  293. package/js_ext/ace-editor/mode-python.js +476 -0
  294. package/js_ext/ace-editor/mode-qml.js +346 -0
  295. package/js_ext/ace-editor/mode-r.js +387 -0
  296. package/js_ext/ace-editor/mode-raku.js +516 -0
  297. package/js_ext/ace-editor/mode-razor.js +2697 -0
  298. package/js_ext/ace-editor/mode-rdoc.js +286 -0
  299. package/js_ext/ace-editor/mode-red.js +388 -0
  300. package/js_ext/ace-editor/mode-redshift.js +321 -0
  301. package/js_ext/ace-editor/mode-rhtml.js +2750 -0
  302. package/js_ext/ace-editor/mode-robot.js +168 -0
  303. package/js_ext/ace-editor/mode-rst.js +245 -0
  304. package/js_ext/ace-editor/mode-ruby.js +921 -0
  305. package/js_ext/ace-editor/mode-rust.js +393 -0
  306. package/js_ext/ace-editor/mode-sac.js +349 -0
  307. package/js_ext/ace-editor/mode-sass.js +480 -0
  308. package/js_ext/ace-editor/mode-scad.js +350 -0
  309. package/js_ext/ace-editor/mode-scala.js +1395 -0
  310. package/js_ext/ace-editor/mode-scheme.js +210 -0
  311. package/js_ext/ace-editor/mode-scrypt.js +317 -0
  312. package/js_ext/ace-editor/mode-scss.js +768 -0
  313. package/js_ext/ace-editor/mode-sh.js +387 -0
  314. package/js_ext/ace-editor/mode-sjs.js +1393 -0
  315. package/js_ext/ace-editor/mode-slim.js +4770 -0
  316. package/js_ext/ace-editor/mode-smarty.js +2436 -0
  317. package/js_ext/ace-editor/mode-smithy.js +456 -0
  318. package/js_ext/ace-editor/mode-snippets.js +183 -0
  319. package/js_ext/ace-editor/mode-soy_template.js +2611 -0
  320. package/js_ext/ace-editor/mode-space.js +151 -0
  321. package/js_ext/ace-editor/mode-sparql.js +288 -0
  322. package/js_ext/ace-editor/mode-sql.js +221 -0
  323. package/js_ext/ace-editor/mode-sqlserver.js +391 -0
  324. package/js_ext/ace-editor/mode-stylus.js +443 -0
  325. package/js_ext/ace-editor/mode-svg.js +1487 -0
  326. package/js_ext/ace-editor/mode-swift.js +342 -0
  327. package/js_ext/ace-editor/mode-tcl.js +338 -0
  328. package/js_ext/ace-editor/mode-terraform.js +346 -0
  329. package/js_ext/ace-editor/mode-tex.js +212 -0
  330. package/js_ext/ace-editor/mode-text.js +9 -0
  331. package/js_ext/ace-editor/mode-textile.js +125 -0
  332. package/js_ext/ace-editor/mode-toml.js +129 -0
  333. package/js_ext/ace-editor/mode-tsv.js +124 -0
  334. package/js_ext/ace-editor/mode-tsx.js +1276 -0
  335. package/js_ext/ace-editor/mode-turtle.js +264 -0
  336. package/js_ext/ace-editor/mode-twig.js +2502 -0
  337. package/js_ext/ace-editor/mode-typescript.js +1254 -0
  338. package/js_ext/ace-editor/mode-vala.js +554 -0
  339. package/js_ext/ace-editor/mode-vbscript.js +731 -0
  340. package/js_ext/ace-editor/mode-velocity.js +2580 -0
  341. package/js_ext/ace-editor/mode-verilog.js +98 -0
  342. package/js_ext/ace-editor/mode-vhdl.js +94 -0
  343. package/js_ext/ace-editor/mode-visualforce.js +2454 -0
  344. package/js_ext/ace-editor/mode-vue.js +3834 -0
  345. package/js_ext/ace-editor/mode-wollok.js +1329 -0
  346. package/js_ext/ace-editor/mode-xml.js +477 -0
  347. package/js_ext/ace-editor/mode-xquery.js +2589 -0
  348. package/js_ext/ace-editor/mode-yaml.js +395 -0
  349. package/js_ext/ace-editor/mode-zeek.js +502 -0
  350. package/js_ext/ace-editor/mode-zig.js +585 -0
  351. package/js_ext/ace-editor/snippets/abap.js +9 -0
  352. package/js_ext/ace-editor/snippets/abc.js +16 -0
  353. package/js_ext/ace-editor/snippets/actionscript.js +16 -0
  354. package/js_ext/ace-editor/snippets/ada.js +9 -0
  355. package/js_ext/ace-editor/snippets/alda.js +9 -0
  356. package/js_ext/ace-editor/snippets/apache_conf.js +9 -0
  357. package/js_ext/ace-editor/snippets/apex.js +9 -0
  358. package/js_ext/ace-editor/snippets/applescript.js +9 -0
  359. package/js_ext/ace-editor/snippets/aql.js +9 -0
  360. package/js_ext/ace-editor/snippets/asciidoc.js +9 -0
  361. package/js_ext/ace-editor/snippets/asl.js +9 -0
  362. package/js_ext/ace-editor/snippets/assembly_arm32.js +9 -0
  363. package/js_ext/ace-editor/snippets/assembly_x86.js +9 -0
  364. package/js_ext/ace-editor/snippets/astro.js +9 -0
  365. package/js_ext/ace-editor/snippets/autohotkey.js +9 -0
  366. package/js_ext/ace-editor/snippets/basic.js +9 -0
  367. package/js_ext/ace-editor/snippets/batchfile.js +9 -0
  368. package/js_ext/ace-editor/snippets/bibtex.js +9 -0
  369. package/js_ext/ace-editor/snippets/c9search.js +9 -0
  370. package/js_ext/ace-editor/snippets/c_cpp.js +16 -0
  371. package/js_ext/ace-editor/snippets/cirru.js +9 -0
  372. package/js_ext/ace-editor/snippets/clojure.js +16 -0
  373. package/js_ext/ace-editor/snippets/clue.js +9 -0
  374. package/js_ext/ace-editor/snippets/cobol.js +9 -0
  375. package/js_ext/ace-editor/snippets/coffee.js +16 -0
  376. package/js_ext/ace-editor/snippets/coldfusion.js +9 -0
  377. package/js_ext/ace-editor/snippets/crystal.js +9 -0
  378. package/js_ext/ace-editor/snippets/csharp.js +9 -0
  379. package/js_ext/ace-editor/snippets/csound_document.js +16 -0
  380. package/js_ext/ace-editor/snippets/csound_orchestra.js +16 -0
  381. package/js_ext/ace-editor/snippets/csound_score.js +9 -0
  382. package/js_ext/ace-editor/snippets/csp.js +9 -0
  383. package/js_ext/ace-editor/snippets/css.js +16 -0
  384. package/js_ext/ace-editor/snippets/csv.js +9 -0
  385. package/js_ext/ace-editor/snippets/curly.js +9 -0
  386. package/js_ext/ace-editor/snippets/cuttlefish.js +9 -0
  387. package/js_ext/ace-editor/snippets/d.js +9 -0
  388. package/js_ext/ace-editor/snippets/dart.js +16 -0
  389. package/js_ext/ace-editor/snippets/diff.js +16 -0
  390. package/js_ext/ace-editor/snippets/django.js +16 -0
  391. package/js_ext/ace-editor/snippets/dockerfile.js +9 -0
  392. package/js_ext/ace-editor/snippets/dot.js +9 -0
  393. package/js_ext/ace-editor/snippets/drools.js +16 -0
  394. package/js_ext/ace-editor/snippets/edifact.js +16 -0
  395. package/js_ext/ace-editor/snippets/eiffel.js +9 -0
  396. package/js_ext/ace-editor/snippets/ejs.js +9 -0
  397. package/js_ext/ace-editor/snippets/elixir.js +9 -0
  398. package/js_ext/ace-editor/snippets/elm.js +9 -0
  399. package/js_ext/ace-editor/snippets/erlang.js +16 -0
  400. package/js_ext/ace-editor/snippets/flix.js +9 -0
  401. package/js_ext/ace-editor/snippets/forth.js +9 -0
  402. package/js_ext/ace-editor/snippets/fortran.js +9 -0
  403. package/js_ext/ace-editor/snippets/fsharp.js +9 -0
  404. package/js_ext/ace-editor/snippets/fsl.js +16 -0
  405. package/js_ext/ace-editor/snippets/ftl.js +9 -0
  406. package/js_ext/ace-editor/snippets/gcode.js +9 -0
  407. package/js_ext/ace-editor/snippets/gherkin.js +9 -0
  408. package/js_ext/ace-editor/snippets/gitignore.js +9 -0
  409. package/js_ext/ace-editor/snippets/glsl.js +9 -0
  410. package/js_ext/ace-editor/snippets/gobstones.js +16 -0
  411. package/js_ext/ace-editor/snippets/golang.js +9 -0
  412. package/js_ext/ace-editor/snippets/graphqlschema.js +16 -0
  413. package/js_ext/ace-editor/snippets/groovy.js +9 -0
  414. package/js_ext/ace-editor/snippets/haml.js +16 -0
  415. package/js_ext/ace-editor/snippets/handlebars.js +9 -0
  416. package/js_ext/ace-editor/snippets/haskell.js +16 -0
  417. package/js_ext/ace-editor/snippets/haskell_cabal.js +9 -0
  418. package/js_ext/ace-editor/snippets/haxe.js +9 -0
  419. package/js_ext/ace-editor/snippets/hjson.js +9 -0
  420. package/js_ext/ace-editor/snippets/html.js +16 -0
  421. package/js_ext/ace-editor/snippets/html_elixir.js +9 -0
  422. package/js_ext/ace-editor/snippets/html_ruby.js +9 -0
  423. package/js_ext/ace-editor/snippets/ini.js +9 -0
  424. package/js_ext/ace-editor/snippets/io.js +74 -0
  425. package/js_ext/ace-editor/snippets/ion.js +9 -0
  426. package/js_ext/ace-editor/snippets/jack.js +9 -0
  427. package/js_ext/ace-editor/snippets/jade.js +9 -0
  428. package/js_ext/ace-editor/snippets/java.js +16 -0
  429. package/js_ext/ace-editor/snippets/javascript.js +16 -0
  430. package/js_ext/ace-editor/snippets/jexl.js +9 -0
  431. package/js_ext/ace-editor/snippets/json.js +9 -0
  432. package/js_ext/ace-editor/snippets/json5.js +9 -0
  433. package/js_ext/ace-editor/snippets/jsoniq.js +78 -0
  434. package/js_ext/ace-editor/snippets/jsp.js +16 -0
  435. package/js_ext/ace-editor/snippets/jssm.js +9 -0
  436. package/js_ext/ace-editor/snippets/jsx.js +9 -0
  437. package/js_ext/ace-editor/snippets/julia.js +9 -0
  438. package/js_ext/ace-editor/snippets/kotlin.js +9 -0
  439. package/js_ext/ace-editor/snippets/latex.js +9 -0
  440. package/js_ext/ace-editor/snippets/latte.js +9 -0
  441. package/js_ext/ace-editor/snippets/less.js +9 -0
  442. package/js_ext/ace-editor/snippets/liquid.js +16 -0
  443. package/js_ext/ace-editor/snippets/lisp.js +9 -0
  444. package/js_ext/ace-editor/snippets/livescript.js +9 -0
  445. package/js_ext/ace-editor/snippets/logiql.js +9 -0
  446. package/js_ext/ace-editor/snippets/logtalk.js +9 -0
  447. package/js_ext/ace-editor/snippets/lsl.js +16 -0
  448. package/js_ext/ace-editor/snippets/lua.js +16 -0
  449. package/js_ext/ace-editor/snippets/luapage.js +9 -0
  450. package/js_ext/ace-editor/snippets/lucene.js +9 -0
  451. package/js_ext/ace-editor/snippets/makefile.js +16 -0
  452. package/js_ext/ace-editor/snippets/markdown.js +16 -0
  453. package/js_ext/ace-editor/snippets/mask.js +9 -0
  454. package/js_ext/ace-editor/snippets/matlab.js +9 -0
  455. package/js_ext/ace-editor/snippets/maze.js +16 -0
  456. package/js_ext/ace-editor/snippets/mediawiki.js +9 -0
  457. package/js_ext/ace-editor/snippets/mel.js +9 -0
  458. package/js_ext/ace-editor/snippets/mips.js +9 -0
  459. package/js_ext/ace-editor/snippets/mixal.js +9 -0
  460. package/js_ext/ace-editor/snippets/mushcode.js +9 -0
  461. package/js_ext/ace-editor/snippets/mysql.js +9 -0
  462. package/js_ext/ace-editor/snippets/nasal.js +9 -0
  463. package/js_ext/ace-editor/snippets/nginx.js +9 -0
  464. package/js_ext/ace-editor/snippets/nim.js +9 -0
  465. package/js_ext/ace-editor/snippets/nix.js +9 -0
  466. package/js_ext/ace-editor/snippets/nsis.js +9 -0
  467. package/js_ext/ace-editor/snippets/nunjucks.js +9 -0
  468. package/js_ext/ace-editor/snippets/objectivec.js +9 -0
  469. package/js_ext/ace-editor/snippets/ocaml.js +9 -0
  470. package/js_ext/ace-editor/snippets/odin.js +9 -0
  471. package/js_ext/ace-editor/snippets/partiql.js +9 -0
  472. package/js_ext/ace-editor/snippets/pascal.js +9 -0
  473. package/js_ext/ace-editor/snippets/perl.js +16 -0
  474. package/js_ext/ace-editor/snippets/pgsql.js +9 -0
  475. package/js_ext/ace-editor/snippets/php.js +16 -0
  476. package/js_ext/ace-editor/snippets/php_laravel_blade.js +9 -0
  477. package/js_ext/ace-editor/snippets/pig.js +9 -0
  478. package/js_ext/ace-editor/snippets/plain_text.js +9 -0
  479. package/js_ext/ace-editor/snippets/plsql.js +9 -0
  480. package/js_ext/ace-editor/snippets/powershell.js +9 -0
  481. package/js_ext/ace-editor/snippets/praat.js +9 -0
  482. package/js_ext/ace-editor/snippets/prisma.js +9 -0
  483. package/js_ext/ace-editor/snippets/prolog.js +9 -0
  484. package/js_ext/ace-editor/snippets/properties.js +9 -0
  485. package/js_ext/ace-editor/snippets/protobuf.js +9 -0
  486. package/js_ext/ace-editor/snippets/prql.js +9 -0
  487. package/js_ext/ace-editor/snippets/puppet.js +9 -0
  488. package/js_ext/ace-editor/snippets/python.js +16 -0
  489. package/js_ext/ace-editor/snippets/qml.js +9 -0
  490. package/js_ext/ace-editor/snippets/r.js +16 -0
  491. package/js_ext/ace-editor/snippets/raku.js +9 -0
  492. package/js_ext/ace-editor/snippets/razor.js +16 -0
  493. package/js_ext/ace-editor/snippets/rdoc.js +9 -0
  494. package/js_ext/ace-editor/snippets/red.js +9 -0
  495. package/js_ext/ace-editor/snippets/redshift.js +9 -0
  496. package/js_ext/ace-editor/snippets/rhtml.js +9 -0
  497. package/js_ext/ace-editor/snippets/robot.js +16 -0
  498. package/js_ext/ace-editor/snippets/rst.js +16 -0
  499. package/js_ext/ace-editor/snippets/ruby.js +16 -0
  500. package/js_ext/ace-editor/snippets/rust.js +9 -0
  501. package/js_ext/ace-editor/snippets/sac.js +9 -0
  502. package/js_ext/ace-editor/snippets/sass.js +9 -0
  503. package/js_ext/ace-editor/snippets/scad.js +9 -0
  504. package/js_ext/ace-editor/snippets/scala.js +9 -0
  505. package/js_ext/ace-editor/snippets/scheme.js +9 -0
  506. package/js_ext/ace-editor/snippets/scrypt.js +9 -0
  507. package/js_ext/ace-editor/snippets/scss.js +9 -0
  508. package/js_ext/ace-editor/snippets/sh.js +16 -0
  509. package/js_ext/ace-editor/snippets/sjs.js +9 -0
  510. package/js_ext/ace-editor/snippets/slim.js +9 -0
  511. package/js_ext/ace-editor/snippets/smarty.js +9 -0
  512. package/js_ext/ace-editor/snippets/smithy.js +9 -0
  513. package/js_ext/ace-editor/snippets/snippets.js +16 -0
  514. package/js_ext/ace-editor/snippets/soy_template.js +9 -0
  515. package/js_ext/ace-editor/snippets/space.js +9 -0
  516. package/js_ext/ace-editor/snippets/sparql.js +9 -0
  517. package/js_ext/ace-editor/snippets/sql.js +16 -0
  518. package/js_ext/ace-editor/snippets/sqlserver.js +16 -0
  519. package/js_ext/ace-editor/snippets/stylus.js +9 -0
  520. package/js_ext/ace-editor/snippets/svg.js +9 -0
  521. package/js_ext/ace-editor/snippets/swift.js +9 -0
  522. package/js_ext/ace-editor/snippets/tcl.js +16 -0
  523. package/js_ext/ace-editor/snippets/terraform.js +9 -0
  524. package/js_ext/ace-editor/snippets/tex.js +16 -0
  525. package/js_ext/ace-editor/snippets/text.js +9 -0
  526. package/js_ext/ace-editor/snippets/textile.js +16 -0
  527. package/js_ext/ace-editor/snippets/toml.js +9 -0
  528. package/js_ext/ace-editor/snippets/tsv.js +9 -0
  529. package/js_ext/ace-editor/snippets/tsx.js +9 -0
  530. package/js_ext/ace-editor/snippets/turtle.js +9 -0
  531. package/js_ext/ace-editor/snippets/twig.js +9 -0
  532. package/js_ext/ace-editor/snippets/typescript.js +9 -0
  533. package/js_ext/ace-editor/snippets/vala.js +199 -0
  534. package/js_ext/ace-editor/snippets/vbscript.js +9 -0
  535. package/js_ext/ace-editor/snippets/velocity.js +17 -0
  536. package/js_ext/ace-editor/snippets/verilog.js +9 -0
  537. package/js_ext/ace-editor/snippets/vhdl.js +9 -0
  538. package/js_ext/ace-editor/snippets/visualforce.js +9 -0
  539. package/js_ext/ace-editor/snippets/vue.js +9 -0
  540. package/js_ext/ace-editor/snippets/wollok.js +16 -0
  541. package/js_ext/ace-editor/snippets/xml.js +9 -0
  542. package/js_ext/ace-editor/snippets/xquery.js +78 -0
  543. package/js_ext/ace-editor/snippets/yaml.js +9 -0
  544. package/js_ext/ace-editor/snippets/zeek.js +9 -0
  545. package/js_ext/ace-editor/snippets/zig.js +9 -0
  546. package/js_ext/ace-editor/theme-ambiance.js +18 -0
  547. package/js_ext/ace-editor/theme-chaos.js +18 -0
  548. package/js_ext/ace-editor/theme-chrome.js +18 -0
  549. package/js_ext/ace-editor/theme-cloud9_day.js +19 -0
  550. package/js_ext/ace-editor/theme-cloud9_night.js +18 -0
  551. package/js_ext/ace-editor/theme-cloud9_night_low_color.js +18 -0
  552. package/js_ext/ace-editor/theme-cloud_editor.js +19 -0
  553. package/js_ext/ace-editor/theme-cloud_editor_dark.js +19 -0
  554. package/js_ext/ace-editor/theme-clouds.js +18 -0
  555. package/js_ext/ace-editor/theme-clouds_midnight.js +18 -0
  556. package/js_ext/ace-editor/theme-cobalt.js +18 -0
  557. package/js_ext/ace-editor/theme-crimson_editor.js +18 -0
  558. package/js_ext/ace-editor/theme-dawn.js +18 -0
  559. package/js_ext/ace-editor/theme-dracula.js +19 -0
  560. package/js_ext/ace-editor/theme-dreamweaver.js +18 -0
  561. package/js_ext/ace-editor/theme-eclipse.js +19 -0
  562. package/js_ext/ace-editor/theme-github.js +18 -0
  563. package/js_ext/ace-editor/theme-github_dark.js +18 -0
  564. package/js_ext/ace-editor/theme-github_light_default.js +18 -0
  565. package/js_ext/ace-editor/theme-gob.js +18 -0
  566. package/js_ext/ace-editor/theme-gruvbox.js +18 -0
  567. package/js_ext/ace-editor/theme-gruvbox_dark_hard.js +18 -0
  568. package/js_ext/ace-editor/theme-gruvbox_light_hard.js +18 -0
  569. package/js_ext/ace-editor/theme-idle_fingers.js +18 -0
  570. package/js_ext/ace-editor/theme-iplastic.js +18 -0
  571. package/js_ext/ace-editor/theme-katzenmilch.js +18 -0
  572. package/js_ext/ace-editor/theme-kr_theme.js +18 -0
  573. package/js_ext/ace-editor/theme-kuroir.js +18 -0
  574. package/js_ext/ace-editor/theme-merbivore.js +18 -0
  575. package/js_ext/ace-editor/theme-merbivore_soft.js +18 -0
  576. package/js_ext/ace-editor/theme-mono_industrial.js +18 -0
  577. package/js_ext/ace-editor/theme-monokai.js +18 -0
  578. package/js_ext/ace-editor/theme-nord_dark.js +19 -0
  579. package/js_ext/ace-editor/theme-one_dark.js +18 -0
  580. package/js_ext/ace-editor/theme-pastel_on_dark.js +18 -0
  581. package/js_ext/ace-editor/theme-solarized_dark.js +18 -0
  582. package/js_ext/ace-editor/theme-solarized_light.js +18 -0
  583. package/js_ext/ace-editor/theme-sqlserver.js +18 -0
  584. package/js_ext/ace-editor/theme-terminal.js +18 -0
  585. package/js_ext/ace-editor/theme-textmate.js +16 -0
  586. package/js_ext/ace-editor/theme-tomorrow.js +18 -0
  587. package/js_ext/ace-editor/theme-tomorrow_night.js +18 -0
  588. package/js_ext/ace-editor/theme-tomorrow_night_blue.js +18 -0
  589. package/js_ext/ace-editor/theme-tomorrow_night_bright.js +18 -0
  590. package/js_ext/ace-editor/theme-tomorrow_night_eighties.js +18 -0
  591. package/js_ext/ace-editor/theme-twilight.js +18 -0
  592. package/js_ext/ace-editor/theme-vibrant_ink.js +18 -0
  593. package/js_ext/ace-editor/theme-xcode.js +18 -0
  594. package/js_ext/ace-editor/worker-base.js +1332 -0
  595. package/js_ext/ace-editor/worker-coffee.js +1381 -0
  596. package/js_ext/ace-editor/worker-css.js +8913 -0
  597. package/js_ext/ace-editor/worker-html.js +10843 -0
  598. package/js_ext/ace-editor/worker-javascript.js +15353 -0
  599. package/js_ext/ace-editor/worker-json.js +1626 -0
  600. package/js_ext/ace-editor/worker-lua.js +3519 -0
  601. package/js_ext/ace-editor/worker-php.js +3788 -0
  602. package/js_ext/ace-editor/worker-xml.js +3122 -0
  603. package/js_ext/ace-editor/worker-xquery.js +57579 -0
  604. package/js_ext/ace-editor/worker-yaml.js +5819 -0
  605. package/js_ext/bootstrap.bundle.min.js +7 -0
  606. package/js_ext/highlight/default.min.css +9 -0
  607. package/js_ext/highlight/go.min.js +14 -0
  608. package/js_ext/highlight/highlight.min.js +1207 -0
  609. package/js_ext/highlight/stackoverflow-dark.min.css +13 -0
  610. package/js_ext/idb-keyval-6.2.2.mjs +7 -0
  611. package/js_ext/json-viewer.bundle.js +52 -0
  612. package/js_ext/loglevel-plugin-prefix.min.js +1 -0
  613. package/js_ext/loglevel.min.js +2 -0
  614. package/js_ext/markdown/auto-render.min.js +1 -0
  615. package/js_ext/markdown/auto-render.mjs +245 -0
  616. package/js_ext/markdown/fonts/KaTeX_AMS-Regular.woff +0 -0
  617. package/js_ext/markdown/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  618. package/js_ext/markdown/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  619. package/js_ext/markdown/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  620. package/js_ext/markdown/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  621. package/js_ext/markdown/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  622. package/js_ext/markdown/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  623. package/js_ext/markdown/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  624. package/js_ext/markdown/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  625. package/js_ext/markdown/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  626. package/js_ext/markdown/fonts/KaTeX_Main-Bold.woff +0 -0
  627. package/js_ext/markdown/fonts/KaTeX_Main-Bold.woff2 +0 -0
  628. package/js_ext/markdown/fonts/KaTeX_Main-Italic.woff +0 -0
  629. package/js_ext/markdown/fonts/KaTeX_Main-Italic.woff2 +0 -0
  630. package/js_ext/markdown/fonts/KaTeX_Main-Regular.woff +0 -0
  631. package/js_ext/markdown/fonts/KaTeX_Main-Regular.woff2 +0 -0
  632. package/js_ext/markdown/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  633. package/js_ext/markdown/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  634. package/js_ext/markdown/fonts/KaTeX_Math-Italic.woff +0 -0
  635. package/js_ext/markdown/fonts/KaTeX_Math-Italic.woff2 +0 -0
  636. package/js_ext/markdown/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  637. package/js_ext/markdown/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  638. package/js_ext/markdown/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  639. package/js_ext/markdown/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  640. package/js_ext/markdown/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  641. package/js_ext/markdown/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  642. package/js_ext/markdown/fonts/KaTeX_Script-Regular.ttf +0 -0
  643. package/js_ext/markdown/fonts/KaTeX_Script-Regular.woff +0 -0
  644. package/js_ext/markdown/fonts/KaTeX_Script-Regular.woff2 +0 -0
  645. package/js_ext/markdown/fonts/KaTeX_Size1-Regular.ttf +0 -0
  646. package/js_ext/markdown/fonts/KaTeX_Size1-Regular.woff +0 -0
  647. package/js_ext/markdown/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  648. package/js_ext/markdown/fonts/KaTeX_Size2-Regular.woff +0 -0
  649. package/js_ext/markdown/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  650. package/js_ext/markdown/fonts/KaTeX_Size3-Regular.woff +0 -0
  651. package/js_ext/markdown/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  652. package/js_ext/markdown/fonts/KaTeX_Size4-Regular.ttf +0 -0
  653. package/js_ext/markdown/fonts/KaTeX_Size4-Regular.woff +0 -0
  654. package/js_ext/markdown/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  655. package/js_ext/markdown/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  656. package/js_ext/markdown/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  657. package/js_ext/markdown/katex.min.css +1 -0
  658. package/js_ext/markdown/katex.min.js +1 -0
  659. package/js_ext/markdown/katex.mjs +18416 -0
  660. package/js_ext/markdown/markdown-it.min.js +3 -0
  661. package/js_ext/markdown/markdownItAnchor.umd.js +2 -0
  662. package/js_ext/mitt.mjs +2 -0
  663. package/js_ext/moment.min.js +1 -0
  664. package/js_ext/msgpack.mjs +1612 -0
  665. package/js_ext/rxjs.umd.min.js +195 -0
  666. package/js_ext/rxjs.umd.min.js.map +1 -0
  667. package/js_ext/vue-router.esm-browser.prod.js +6 -0
  668. package/js_ext/vue.esm-browser.min.js +18 -0
  669. package/js_ext/vue.esm-browser.prod.min.js +3 -0
  670. package/js_ext/vue3-sfc-loader.esm.js +1840 -0
  671. package/js_ext/vue3-sfc-loader.esm.js.map +4 -0
  672. package/js_ext/vue3-sfc-loader.js +1839 -0
  673. package/js_ext/wavesurfer.esm.mjs +1 -0
  674. package/js_ext/xstate.web.mjs +15 -0
  675. package/package.json +50 -0
  676. package/style.css +31 -0
@@ -0,0 +1,2724 @@
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 = [], /**@type{Snippet}*/ 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
+ this.updateTabstopMarkers();
810
+ if (index === 0) {
811
+ this.detach();
812
+ }
813
+ };
814
+ TabstopManager.prototype.selectTabstop = function (index) {
815
+ this.$openTabstops = null;
816
+ var ts = this.tabstops[this.index];
817
+ if (ts)
818
+ this.addTabstopMarkers(ts);
819
+ this.index = index;
820
+ ts = this.tabstops[this.index];
821
+ if (!ts || !ts.length)
822
+ return;
823
+ this.selectedTabstop = ts;
824
+ var range = ts.firstNonLinked || ts;
825
+ if (ts.choices)
826
+ range.cursor = range.start;
827
+ if (!this.editor.inVirtualSelectionMode) {
828
+ var sel = this.editor.multiSelect;
829
+ sel.toSingleRange(range);
830
+ for (var i = 0; i < ts.length; i++) {
831
+ if (ts.hasLinkedRanges && ts[i].linked)
832
+ continue;
833
+ sel.addRange(ts[i].clone(), true);
834
+ }
835
+ }
836
+ else {
837
+ this.editor.selection.fromOrientedRange(range);
838
+ }
839
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
840
+ if (this.selectedTabstop && this.selectedTabstop.choices)
841
+ this.editor.execCommand("startAutocomplete", { matches: this.selectedTabstop.choices });
842
+ };
843
+ TabstopManager.prototype.addTabstops = function (tabstops, start, end) {
844
+ var useLink = this.useLink || !this.editor.getOption("enableMultiselect");
845
+ if (!this.$openTabstops)
846
+ this.$openTabstops = [];
847
+ if (!tabstops[0]) {
848
+ var p = Range.fromPoints(end, end);
849
+ moveRelative(p.start, start);
850
+ moveRelative(p.end, start);
851
+ tabstops[0] = [p];
852
+ tabstops[0].index = 0;
853
+ }
854
+ var i = this.index;
855
+ var arg = [i + 1, 0];
856
+ var ranges = this.ranges;
857
+ var snippetId = this.snippetId = (this.snippetId || 0) + 1;
858
+ tabstops.forEach(function (ts, index) {
859
+ var dest = this.$openTabstops[index] || ts;
860
+ dest.snippetId = snippetId;
861
+ for (var i = 0; i < ts.length; i++) {
862
+ var p = ts[i];
863
+ var range = Range.fromPoints(p.start, p.end || p.start);
864
+ movePoint(range.start, start);
865
+ movePoint(range.end, start);
866
+ range.original = p;
867
+ range.tabstop = dest;
868
+ ranges.push(range);
869
+ if (dest != ts)
870
+ dest.unshift(range);
871
+ else
872
+ dest[i] = range;
873
+ if (p.fmtString || (dest.firstNonLinked && useLink)) {
874
+ range.linked = true;
875
+ dest.hasLinkedRanges = true;
876
+ }
877
+ else if (!dest.firstNonLinked)
878
+ dest.firstNonLinked = range;
879
+ }
880
+ if (!dest.firstNonLinked)
881
+ dest.hasLinkedRanges = false;
882
+ if (dest === ts) {
883
+ arg.push(dest);
884
+ this.$openTabstops[index] = dest;
885
+ }
886
+ this.addTabstopMarkers(dest);
887
+ dest.rangeList = dest.rangeList || new RangeList();
888
+ dest.rangeList.$bias = 0;
889
+ dest.rangeList.addList(dest);
890
+ }, this);
891
+ if (arg.length > 2) {
892
+ if (this.tabstops.length)
893
+ arg.push(arg.splice(2, 1)[0]);
894
+ this.tabstops.splice.apply(this.tabstops, arg);
895
+ }
896
+ };
897
+ TabstopManager.prototype.addTabstopMarkers = function (ts) {
898
+ var session = this.session;
899
+ ts.forEach(function (range) {
900
+ if (!range.markerId)
901
+ range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
902
+ });
903
+ };
904
+ TabstopManager.prototype.removeTabstopMarkers = function (ts) {
905
+ var session = this.session;
906
+ ts.forEach(function (range) {
907
+ session.removeMarker(range.markerId);
908
+ range.markerId = null;
909
+ });
910
+ };
911
+ TabstopManager.prototype.updateTabstopMarkers = function () {
912
+ if (!this.selectedTabstop)
913
+ return;
914
+ var currentSnippetId = this.selectedTabstop.snippetId;
915
+ if (this.selectedTabstop.index === 0) {
916
+ currentSnippetId--;
917
+ }
918
+ this.tabstops.forEach(function (ts) {
919
+ if (ts.snippetId === currentSnippetId)
920
+ this.addTabstopMarkers(ts);
921
+ else
922
+ this.removeTabstopMarkers(ts);
923
+ }, this);
924
+ };
925
+ TabstopManager.prototype.removeRange = function (range) {
926
+ var i = range.tabstop.indexOf(range);
927
+ if (i != -1)
928
+ range.tabstop.splice(i, 1);
929
+ i = this.ranges.indexOf(range);
930
+ if (i != -1)
931
+ this.ranges.splice(i, 1);
932
+ i = range.tabstop.rangeList.ranges.indexOf(range);
933
+ if (i != -1)
934
+ range.tabstop.splice(i, 1);
935
+ this.session.removeMarker(range.markerId);
936
+ if (!range.tabstop.length) {
937
+ i = this.tabstops.indexOf(range.tabstop);
938
+ if (i != -1)
939
+ this.tabstops.splice(i, 1);
940
+ if (!this.tabstops.length)
941
+ this.detach();
942
+ }
943
+ };
944
+ return TabstopManager;
945
+ }());
946
+ TabstopManager.prototype.keyboardHandler = new HashHandler();
947
+ TabstopManager.prototype.keyboardHandler.bindKeys({
948
+ "Tab": function (editor) {
949
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
950
+ return;
951
+ editor.tabstopManager.tabNext(1);
952
+ editor.renderer.scrollCursorIntoView();
953
+ },
954
+ "Shift-Tab": function (editor) {
955
+ editor.tabstopManager.tabNext(-1);
956
+ editor.renderer.scrollCursorIntoView();
957
+ },
958
+ "Esc": function (editor) {
959
+ editor.tabstopManager.detach();
960
+ }
961
+ });
962
+ var movePoint = function (point, diff) {
963
+ if (point.row == 0)
964
+ point.column += diff.column;
965
+ point.row += diff.row;
966
+ };
967
+ var moveRelative = function (point, start) {
968
+ if (point.row == start.row)
969
+ point.column -= start.column;
970
+ point.row -= start.row;
971
+ };
972
+ 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);
973
+ exports.snippetManager = new SnippetManager();
974
+ var Editor = require("./editor").Editor;
975
+ (function () {
976
+ this.insertSnippet = function (content, options) {
977
+ return exports.snippetManager.insertSnippet(this, content, options);
978
+ };
979
+ this.expandSnippet = function (options) {
980
+ return exports.snippetManager.expandWithTab(this, options);
981
+ };
982
+ }).call(Editor.prototype);
983
+
984
+ });
985
+
986
+ 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","ace/lib/useragent"], function(require, exports, module){"use strict";
987
+ var Renderer = require("../virtual_renderer").VirtualRenderer;
988
+ var Editor = require("../editor").Editor;
989
+ var Range = require("../range").Range;
990
+ var event = require("../lib/event");
991
+ var lang = require("../lib/lang");
992
+ var dom = require("../lib/dom");
993
+ var nls = require("../config").nls;
994
+ var userAgent = require("./../lib/useragent");
995
+ var getAriaId = function (index) {
996
+ return "suggest-aria-id:".concat(index);
997
+ };
998
+ var popupAriaRole = userAgent.isSafari ? "menu" : "listbox";
999
+ var optionAriaRole = userAgent.isSafari ? "menuitem" : "option";
1000
+ var ariaActiveState = userAgent.isSafari ? "aria-current" : "aria-selected";
1001
+ var $singleLineEditor = function (el) {
1002
+ var renderer = new Renderer(el);
1003
+ renderer.$maxLines = 4;
1004
+ var editor = new Editor(renderer);
1005
+ editor.setHighlightActiveLine(false);
1006
+ editor.setShowPrintMargin(false);
1007
+ editor.renderer.setShowGutter(false);
1008
+ editor.renderer.setHighlightGutterLine(false);
1009
+ editor.$mouseHandler.$focusTimeout = 0;
1010
+ editor.$highlightTagPending = true;
1011
+ return editor;
1012
+ };
1013
+ var AcePopup = /** @class */ (function () {
1014
+ function AcePopup(parentNode) {
1015
+ var el = dom.createElement("div");
1016
+ var popup = $singleLineEditor(el);
1017
+ if (parentNode) {
1018
+ parentNode.appendChild(el);
1019
+ }
1020
+ el.style.display = "none";
1021
+ popup.renderer.content.style.cursor = "default";
1022
+ popup.renderer.setStyle("ace_autocomplete");
1023
+ popup.renderer.$textLayer.element.setAttribute("role", popupAriaRole);
1024
+ popup.renderer.$textLayer.element.setAttribute("aria-roledescription", nls("autocomplete.popup.aria-roledescription", "Autocomplete suggestions"));
1025
+ popup.renderer.$textLayer.element.setAttribute("aria-label", nls("autocomplete.popup.aria-label", "Autocomplete suggestions"));
1026
+ popup.renderer.textarea.setAttribute("aria-hidden", "true");
1027
+ popup.setOption("displayIndentGuides", false);
1028
+ popup.setOption("dragDelay", 150);
1029
+ var noop = function () { };
1030
+ popup.focus = noop;
1031
+ popup.$isFocused = true;
1032
+ popup.renderer.$cursorLayer.restartTimer = noop;
1033
+ popup.renderer.$cursorLayer.element.style.opacity = "0";
1034
+ popup.renderer.$maxLines = 8;
1035
+ popup.renderer.$keepTextAreaAtCursor = false;
1036
+ popup.setHighlightActiveLine(false);
1037
+ popup.session.highlight("");
1038
+ popup.session.$searchHighlight.clazz = "ace_highlight-marker";
1039
+ popup.on("mousedown", function (e) {
1040
+ var pos = e.getDocumentPosition();
1041
+ popup.selection.moveToPosition(pos);
1042
+ selectionMarker.start.row = selectionMarker.end.row = pos.row;
1043
+ e.stop();
1044
+ });
1045
+ var lastMouseEvent;
1046
+ var hoverMarker = new Range(-1, 0, -1, Infinity);
1047
+ var selectionMarker = new Range(-1, 0, -1, Infinity);
1048
+ selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
1049
+ popup.setSelectOnHover = function (val) {
1050
+ if (!val) {
1051
+ hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
1052
+ }
1053
+ else if (hoverMarker.id) {
1054
+ popup.session.removeMarker(hoverMarker.id);
1055
+ hoverMarker.id = null;
1056
+ }
1057
+ };
1058
+ popup.setSelectOnHover(false);
1059
+ popup.on("mousemove", function (e) {
1060
+ if (!lastMouseEvent) {
1061
+ lastMouseEvent = e;
1062
+ return;
1063
+ }
1064
+ if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
1065
+ return;
1066
+ }
1067
+ lastMouseEvent = e;
1068
+ lastMouseEvent.scrollTop = popup.renderer.scrollTop;
1069
+ popup.isMouseOver = true;
1070
+ var row = lastMouseEvent.getDocumentPosition().row;
1071
+ if (hoverMarker.start.row != row) {
1072
+ if (!hoverMarker.id)
1073
+ popup.setRow(row);
1074
+ setHoverMarker(row);
1075
+ }
1076
+ });
1077
+ popup.renderer.on("beforeRender", function () {
1078
+ if (lastMouseEvent && hoverMarker.start.row != -1) {
1079
+ lastMouseEvent.$pos = null;
1080
+ var row = lastMouseEvent.getDocumentPosition().row;
1081
+ if (!hoverMarker.id)
1082
+ popup.setRow(row);
1083
+ setHoverMarker(row, true);
1084
+ }
1085
+ });
1086
+ popup.renderer.on("afterRender", function () {
1087
+ var t = popup.renderer.$textLayer;
1088
+ for (var row = t.config.firstRow, l = t.config.lastRow; row <= l; row++) {
1089
+ var popupRowElement = /** @type {HTMLElement|null} */ (t.element.childNodes[row - t.config.firstRow]);
1090
+ popupRowElement.setAttribute("role", optionAriaRole);
1091
+ popupRowElement.setAttribute("aria-roledescription", nls("autocomplete.popup.item.aria-roledescription", "item"));
1092
+ popupRowElement.setAttribute("aria-setsize", popup.data.length);
1093
+ popupRowElement.setAttribute("aria-describedby", "doc-tooltip");
1094
+ popupRowElement.setAttribute("aria-posinset", row + 1);
1095
+ var rowData = popup.getData(row);
1096
+ if (rowData) {
1097
+ var ariaLabel = "".concat(rowData.caption || rowData.value).concat(rowData.meta ? ", ".concat(rowData.meta) : '');
1098
+ popupRowElement.setAttribute("aria-label", ariaLabel);
1099
+ }
1100
+ var highlightedSpans = popupRowElement.querySelectorAll(".ace_completion-highlight");
1101
+ highlightedSpans.forEach(function (span) {
1102
+ span.setAttribute("role", "mark");
1103
+ });
1104
+ }
1105
+ });
1106
+ popup.renderer.on("afterRender", function () {
1107
+ var row = popup.getRow();
1108
+ var t = popup.renderer.$textLayer;
1109
+ var selected = /** @type {HTMLElement|null} */ (t.element.childNodes[row - t.config.firstRow]);
1110
+ var el = document.activeElement; // Active element is textarea of main editor
1111
+ if (selected !== popup.selectedNode && popup.selectedNode) {
1112
+ dom.removeCssClass(popup.selectedNode, "ace_selected");
1113
+ popup.selectedNode.removeAttribute(ariaActiveState);
1114
+ popup.selectedNode.removeAttribute("id");
1115
+ }
1116
+ el.removeAttribute("aria-activedescendant");
1117
+ popup.selectedNode = selected;
1118
+ if (selected) {
1119
+ var ariaId = getAriaId(row);
1120
+ dom.addCssClass(selected, "ace_selected");
1121
+ selected.id = ariaId;
1122
+ t.element.setAttribute("aria-activedescendant", ariaId);
1123
+ el.setAttribute("aria-activedescendant", ariaId);
1124
+ selected.setAttribute(ariaActiveState, "true");
1125
+ }
1126
+ });
1127
+ var hideHoverMarker = function () { setHoverMarker(-1); };
1128
+ var setHoverMarker = function (row, suppressRedraw) {
1129
+ if (row !== hoverMarker.start.row) {
1130
+ hoverMarker.start.row = hoverMarker.end.row = row;
1131
+ if (!suppressRedraw)
1132
+ popup.session._emit("changeBackMarker");
1133
+ popup._emit("changeHoverMarker");
1134
+ }
1135
+ };
1136
+ popup.getHoveredRow = function () {
1137
+ return hoverMarker.start.row;
1138
+ };
1139
+ event.addListener(popup.container, "mouseout", function () {
1140
+ popup.isMouseOver = false;
1141
+ hideHoverMarker();
1142
+ });
1143
+ popup.on("hide", hideHoverMarker);
1144
+ popup.on("changeSelection", hideHoverMarker);
1145
+ popup.session.doc.getLength = function () {
1146
+ return popup.data.length;
1147
+ };
1148
+ popup.session.doc.getLine = function (i) {
1149
+ var data = popup.data[i];
1150
+ if (typeof data == "string")
1151
+ return data;
1152
+ return (data && data.value) || "";
1153
+ };
1154
+ var bgTokenizer = popup.session.bgTokenizer;
1155
+ bgTokenizer.$tokenizeRow = function (row) {
1156
+ var data = popup.data[row];
1157
+ var tokens = [];
1158
+ if (!data)
1159
+ return tokens;
1160
+ if (typeof data == "string")
1161
+ data = { value: data };
1162
+ var caption = data.caption || data.value || data.name;
1163
+ function addToken(value, className) {
1164
+ value && tokens.push({
1165
+ type: (data.className || "") + (className || ""),
1166
+ value: value
1167
+ });
1168
+ }
1169
+ var lower = caption.toLowerCase();
1170
+ var filterText = (popup.filterText || "").toLowerCase();
1171
+ var lastIndex = 0;
1172
+ var lastI = 0;
1173
+ for (var i = 0; i <= filterText.length; i++) {
1174
+ if (i != lastI && (data.matchMask & (1 << i) || i == filterText.length)) {
1175
+ var sub = filterText.slice(lastI, i);
1176
+ lastI = i;
1177
+ var index = lower.indexOf(sub, lastIndex);
1178
+ if (index == -1)
1179
+ continue;
1180
+ addToken(caption.slice(lastIndex, index), "");
1181
+ lastIndex = index + sub.length;
1182
+ addToken(caption.slice(index, lastIndex), "completion-highlight");
1183
+ }
1184
+ }
1185
+ addToken(caption.slice(lastIndex, caption.length), "");
1186
+ tokens.push({ type: "completion-spacer", value: " " });
1187
+ if (data.meta)
1188
+ tokens.push({ type: "completion-meta", value: data.meta });
1189
+ if (data.message)
1190
+ tokens.push({ type: "completion-message", value: data.message });
1191
+ return tokens;
1192
+ };
1193
+ bgTokenizer.$updateOnChange = noop;
1194
+ bgTokenizer.start = noop;
1195
+ popup.session.$computeWidth = function () {
1196
+ return this.screenWidth = 0;
1197
+ };
1198
+ popup.isOpen = false;
1199
+ popup.isTopdown = false;
1200
+ popup.autoSelect = true;
1201
+ popup.filterText = "";
1202
+ popup.isMouseOver = false;
1203
+ popup.data = [];
1204
+ popup.setData = function (list, filterText) {
1205
+ popup.filterText = filterText || "";
1206
+ popup.setValue(lang.stringRepeat("\n", list.length), -1);
1207
+ popup.data = list || [];
1208
+ popup.setRow(0);
1209
+ };
1210
+ popup.getData = function (row) {
1211
+ return popup.data[row];
1212
+ };
1213
+ popup.getRow = function () {
1214
+ return selectionMarker.start.row;
1215
+ };
1216
+ popup.setRow = function (line) {
1217
+ line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length - 1, line));
1218
+ if (selectionMarker.start.row != line) {
1219
+ popup.selection.clearSelection();
1220
+ selectionMarker.start.row = selectionMarker.end.row = line || 0;
1221
+ popup.session._emit("changeBackMarker");
1222
+ popup.moveCursorTo(line || 0, 0);
1223
+ if (popup.isOpen)
1224
+ popup._signal("select");
1225
+ }
1226
+ };
1227
+ popup.on("changeSelection", function () {
1228
+ if (popup.isOpen)
1229
+ popup.setRow(popup.selection.lead.row);
1230
+ popup.renderer.scrollCursorIntoView();
1231
+ });
1232
+ popup.hide = function () {
1233
+ this.container.style.display = "none";
1234
+ popup.anchorPos = null;
1235
+ popup.anchor = null;
1236
+ if (popup.isOpen) {
1237
+ popup.isOpen = false;
1238
+ this._signal("hide");
1239
+ }
1240
+ };
1241
+ popup.tryShow = function (pos, lineHeight, anchor, forceShow) {
1242
+ if (!forceShow && popup.isOpen && popup.anchorPos && popup.anchor &&
1243
+ popup.anchorPos.top === pos.top && popup.anchorPos.left === pos.left &&
1244
+ popup.anchor === anchor) {
1245
+ return true;
1246
+ }
1247
+ var el = this.container;
1248
+ var scrollBarSize = this.renderer.scrollBar.width || 10;
1249
+ var screenHeight = window.innerHeight - scrollBarSize;
1250
+ var screenWidth = window.innerWidth - scrollBarSize;
1251
+ var renderer = this.renderer;
1252
+ var maxH = renderer.$maxLines * lineHeight * 1.4;
1253
+ var dims = { top: 0, bottom: 0, left: 0 };
1254
+ var spaceBelow = screenHeight - pos.top - 3 * this.$borderSize - lineHeight;
1255
+ var spaceAbove = pos.top - 3 * this.$borderSize;
1256
+ if (!anchor) {
1257
+ if (spaceAbove <= spaceBelow || spaceBelow >= maxH) {
1258
+ anchor = "bottom";
1259
+ }
1260
+ else {
1261
+ anchor = "top";
1262
+ }
1263
+ }
1264
+ if (anchor === "top") {
1265
+ dims.bottom = pos.top - this.$borderSize;
1266
+ dims.top = dims.bottom - maxH;
1267
+ }
1268
+ else if (anchor === "bottom") {
1269
+ dims.top = pos.top + lineHeight + this.$borderSize;
1270
+ dims.bottom = dims.top + maxH;
1271
+ }
1272
+ var fitsX = dims.top >= 0 && dims.bottom <= screenHeight;
1273
+ if (!forceShow && !fitsX) {
1274
+ return false;
1275
+ }
1276
+ if (!fitsX) {
1277
+ if (anchor === "top") {
1278
+ renderer.$maxPixelHeight = spaceAbove;
1279
+ }
1280
+ else {
1281
+ renderer.$maxPixelHeight = spaceBelow;
1282
+ }
1283
+ }
1284
+ else {
1285
+ renderer.$maxPixelHeight = null;
1286
+ }
1287
+ if (anchor === "top") {
1288
+ el.style.top = "";
1289
+ el.style.bottom = (screenHeight + scrollBarSize - dims.bottom) + "px";
1290
+ popup.isTopdown = false;
1291
+ }
1292
+ else {
1293
+ el.style.top = dims.top + "px";
1294
+ el.style.bottom = "";
1295
+ popup.isTopdown = true;
1296
+ }
1297
+ el.style.display = "";
1298
+ var left = pos.left;
1299
+ if (left + el.offsetWidth > screenWidth)
1300
+ left = screenWidth - el.offsetWidth;
1301
+ el.style.left = left + "px";
1302
+ el.style.right = "";
1303
+ dom.$fixPositionBug(el);
1304
+ if (!popup.isOpen) {
1305
+ popup.isOpen = true;
1306
+ this._signal("show");
1307
+ lastMouseEvent = null;
1308
+ }
1309
+ popup.anchorPos = pos;
1310
+ popup.anchor = anchor;
1311
+ return true;
1312
+ };
1313
+ popup.show = function (pos, lineHeight, topdownOnly) {
1314
+ this.tryShow(pos, lineHeight, topdownOnly ? "bottom" : undefined, true);
1315
+ };
1316
+ popup.goTo = function (where) {
1317
+ var row = this.getRow();
1318
+ var max = this.session.getLength() - 1;
1319
+ switch (where) {
1320
+ case "up":
1321
+ row = row <= 0 ? max : row - 1;
1322
+ break;
1323
+ case "down":
1324
+ row = row >= max ? -1 : row + 1;
1325
+ break;
1326
+ case "start":
1327
+ row = 0;
1328
+ break;
1329
+ case "end":
1330
+ row = max;
1331
+ break;
1332
+ }
1333
+ this.setRow(row);
1334
+ };
1335
+ popup.getTextLeftOffset = function () {
1336
+ return this.$borderSize + this.renderer.$padding + this.$imageSize;
1337
+ };
1338
+ popup.$imageSize = 0;
1339
+ popup.$borderSize = 1;
1340
+ return popup;
1341
+ }
1342
+ return AcePopup;
1343
+ }());
1344
+ 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 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);
1345
+ exports.AcePopup = AcePopup;
1346
+ exports.$singleLineEditor = $singleLineEditor;
1347
+ exports.getAriaId = getAriaId;
1348
+
1349
+ });
1350
+
1351
+ ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"], function(require, exports, module){"use strict";
1352
+ var AceInlineScreenReader = /** @class */ (function () {
1353
+ function AceInlineScreenReader(editor) {
1354
+ this.editor = editor;
1355
+ this.screenReaderDiv = document.createElement("div");
1356
+ this.screenReaderDiv.classList.add("ace_screenreader-only");
1357
+ this.editor.container.appendChild(this.screenReaderDiv);
1358
+ }
1359
+ AceInlineScreenReader.prototype.setScreenReaderContent = function (content) {
1360
+ if (!this.popup && this.editor.completer && /**@type{import("../autocomplete").Autocomplete}*/ (this.editor.completer).popup) {
1361
+ this.popup = /**@type{import("../autocomplete").Autocomplete}*/ (this.editor.completer).popup;
1362
+ this.popup.renderer.on("afterRender", function () {
1363
+ var row = this.popup.getRow();
1364
+ var t = this.popup.renderer.$textLayer;
1365
+ var selected = t.element.childNodes[row - t.config.firstRow];
1366
+ if (selected) {
1367
+ var idString = "doc-tooltip ";
1368
+ for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
1369
+ idString += "ace-inline-screenreader-line-".concat(lineIndex, " ");
1370
+ }
1371
+ selected.setAttribute("aria-describedby", idString);
1372
+ }
1373
+ }.bind(this));
1374
+ }
1375
+ while (this.screenReaderDiv.firstChild) {
1376
+ this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);
1377
+ }
1378
+ this._lines = content.split(/\r\n|\r|\n/);
1379
+ var codeElement = this.createCodeBlock();
1380
+ this.screenReaderDiv.appendChild(codeElement);
1381
+ };
1382
+ AceInlineScreenReader.prototype.destroy = function () {
1383
+ this.screenReaderDiv.remove();
1384
+ };
1385
+ AceInlineScreenReader.prototype.createCodeBlock = function () {
1386
+ var container = document.createElement("pre");
1387
+ container.setAttribute("id", "ace-inline-screenreader");
1388
+ for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
1389
+ var codeElement = document.createElement("code");
1390
+ codeElement.setAttribute("id", "ace-inline-screenreader-line-".concat(lineIndex));
1391
+ var line = document.createTextNode(this._lines[lineIndex]);
1392
+ codeElement.appendChild(line);
1393
+ container.appendChild(codeElement);
1394
+ }
1395
+ return container;
1396
+ };
1397
+ return AceInlineScreenReader;
1398
+ }());
1399
+ exports.AceInlineScreenReader = AceInlineScreenReader;
1400
+
1401
+ });
1402
+
1403
+ ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"], function(require, exports, module){"use strict";
1404
+ var snippetManager = require("../snippets").snippetManager;
1405
+ var AceInlineScreenReader = require("./inline_screenreader").AceInlineScreenReader;
1406
+ var AceInline = /** @class */ (function () {
1407
+ function AceInline() {
1408
+ this.editor = null;
1409
+ }
1410
+ AceInline.prototype.show = function (editor, completion, prefix) {
1411
+ prefix = prefix || "";
1412
+ if (editor && this.editor && this.editor !== editor) {
1413
+ this.hide();
1414
+ this.editor = null;
1415
+ this.inlineScreenReader = null;
1416
+ }
1417
+ if (!editor || !completion) {
1418
+ return false;
1419
+ }
1420
+ if (!this.inlineScreenReader) {
1421
+ this.inlineScreenReader = new AceInlineScreenReader(editor);
1422
+ }
1423
+ var displayText = completion.snippet ? snippetManager.getDisplayTextForSnippet(editor, completion.snippet) : completion.value;
1424
+ if (completion.hideInlinePreview || !displayText || !displayText.startsWith(prefix)) {
1425
+ return false;
1426
+ }
1427
+ this.editor = editor;
1428
+ this.inlineScreenReader.setScreenReaderContent(displayText);
1429
+ displayText = displayText.slice(prefix.length);
1430
+ if (displayText === "") {
1431
+ editor.removeGhostText();
1432
+ }
1433
+ else {
1434
+ editor.setGhostText(displayText);
1435
+ }
1436
+ return true;
1437
+ };
1438
+ AceInline.prototype.isOpen = function () {
1439
+ if (!this.editor) {
1440
+ return false;
1441
+ }
1442
+ return !!this.editor.renderer.$ghostText;
1443
+ };
1444
+ AceInline.prototype.hide = function () {
1445
+ if (!this.editor) {
1446
+ return false;
1447
+ }
1448
+ this.editor.removeGhostText();
1449
+ return true;
1450
+ };
1451
+ AceInline.prototype.destroy = function () {
1452
+ this.hide();
1453
+ this.editor = null;
1454
+ if (this.inlineScreenReader) {
1455
+ this.inlineScreenReader.destroy();
1456
+ this.inlineScreenReader = null;
1457
+ }
1458
+ };
1459
+ return AceInline;
1460
+ }());
1461
+ exports.AceInline = AceInline;
1462
+
1463
+ });
1464
+
1465
+ ace.define("ace/autocomplete/util",["require","exports","module"], function(require, exports, module){"use strict";
1466
+ exports.parForEach = function (array, fn, callback) {
1467
+ var completed = 0;
1468
+ var arLength = array.length;
1469
+ if (arLength === 0)
1470
+ callback();
1471
+ for (var i = 0; i < arLength; i++) {
1472
+ fn(array[i], function (result, err) {
1473
+ completed++;
1474
+ if (completed === arLength)
1475
+ callback(result, err);
1476
+ });
1477
+ }
1478
+ };
1479
+ var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
1480
+ exports.retrievePrecedingIdentifier = function (text, pos, regex) {
1481
+ regex = regex || ID_REGEX;
1482
+ var buf = [];
1483
+ for (var i = pos - 1; i >= 0; i--) {
1484
+ if (regex.test(text[i]))
1485
+ buf.push(text[i]);
1486
+ else
1487
+ break;
1488
+ }
1489
+ return buf.reverse().join("");
1490
+ };
1491
+ exports.retrieveFollowingIdentifier = function (text, pos, regex) {
1492
+ regex = regex || ID_REGEX;
1493
+ var buf = [];
1494
+ for (var i = pos; i < text.length; i++) {
1495
+ if (regex.test(text[i]))
1496
+ buf.push(text[i]);
1497
+ else
1498
+ break;
1499
+ }
1500
+ return buf;
1501
+ };
1502
+ exports.getCompletionPrefix = function (editor) {
1503
+ var pos = editor.getCursorPosition();
1504
+ var line = editor.session.getLine(pos.row);
1505
+ var prefix;
1506
+ editor.completers.forEach(function (completer) {
1507
+ if (completer.identifierRegexps) {
1508
+ completer.identifierRegexps.forEach(function (identifierRegex) {
1509
+ if (!prefix && identifierRegex)
1510
+ prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
1511
+ }.bind(this));
1512
+ }
1513
+ }.bind(this));
1514
+ return prefix || this.retrievePrecedingIdentifier(line, pos.column);
1515
+ };
1516
+ exports.triggerAutocomplete = function (editor, previousChar) {
1517
+ var previousChar = previousChar == null
1518
+ ? editor.session.getPrecedingCharacter()
1519
+ : previousChar;
1520
+ return editor.completers.some(function (completer) {
1521
+ if (completer.triggerCharacters && Array.isArray(completer.triggerCharacters)) {
1522
+ return completer.triggerCharacters.includes(previousChar);
1523
+ }
1524
+ });
1525
+ };
1526
+
1527
+ });
1528
+
1529
+ 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","ace/lib/scroll"], function(require, exports, module){"use strict";
1530
+ var HashHandler = require("./keyboard/hash_handler").HashHandler;
1531
+ var AcePopup = require("./autocomplete/popup").AcePopup;
1532
+ var AceInline = require("./autocomplete/inline").AceInline;
1533
+ var getAriaId = require("./autocomplete/popup").getAriaId;
1534
+ var util = require("./autocomplete/util");
1535
+ var lang = require("./lib/lang");
1536
+ var dom = require("./lib/dom");
1537
+ var snippetManager = require("./snippets").snippetManager;
1538
+ var config = require("./config");
1539
+ var event = require("./lib/event");
1540
+ var preventParentScroll = require("./lib/scroll").preventParentScroll;
1541
+ var destroyCompleter = function (e, editor) {
1542
+ editor.completer && editor.completer.destroy();
1543
+ };
1544
+ var Autocomplete = /** @class */ (function () {
1545
+ function Autocomplete() {
1546
+ this.autoInsert = false;
1547
+ this.autoSelect = true;
1548
+ this.autoShown = false;
1549
+ this.exactMatch = false;
1550
+ this.inlineEnabled = false;
1551
+ this.keyboardHandler = new HashHandler();
1552
+ this.keyboardHandler.bindKeys(this.commands);
1553
+ this.parentNode = null;
1554
+ this.setSelectOnHover = false;
1555
+ this.hasSeen = new Set();
1556
+ this.showLoadingState = false;
1557
+ this.stickySelectionDelay = 500;
1558
+ this.blurListener = this.blurListener.bind(this);
1559
+ this.changeListener = this.changeListener.bind(this);
1560
+ this.mousedownListener = this.mousedownListener.bind(this);
1561
+ this.mousewheelListener = this.mousewheelListener.bind(this);
1562
+ this.onLayoutChange = this.onLayoutChange.bind(this);
1563
+ this.changeTimer = lang.delayedCall(function () {
1564
+ this.updateCompletions(true);
1565
+ }.bind(this));
1566
+ this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
1567
+ this.popupTimer = lang.delayedCall(this.$updatePopupPosition.bind(this), 50);
1568
+ this.stickySelectionTimer = lang.delayedCall(function () {
1569
+ this.stickySelection = true;
1570
+ }.bind(this), this.stickySelectionDelay);
1571
+ this.$firstOpenTimer = lang.delayedCall(/**@this{Autocomplete}*/ function () {
1572
+ var initialPosition = this.completionProvider && this.completionProvider.initialPosition;
1573
+ if (this.autoShown || (this.popup && this.popup.isOpen) || !initialPosition || this.editor.completers.length === 0)
1574
+ return;
1575
+ this.completions = new FilteredList(Autocomplete.completionsForLoading);
1576
+ this.openPopup(this.editor, initialPosition.prefix, false);
1577
+ this.popup.renderer.setStyle("ace_loading", true);
1578
+ }.bind(this), this.stickySelectionDelay);
1579
+ }
1580
+ Object.defineProperty(Autocomplete, "completionsForLoading", {
1581
+ get: function () {
1582
+ return [{
1583
+ caption: config.nls("autocomplete.loading", "Loading..."),
1584
+ value: ""
1585
+ }];
1586
+ },
1587
+ enumerable: false,
1588
+ configurable: true
1589
+ });
1590
+ Autocomplete.prototype.$init = function () {
1591
+ this.popup = new AcePopup(this.parentNode || document.body || document.documentElement);
1592
+ this.popup.on("click", function (e) {
1593
+ this.insertMatch();
1594
+ e.stop();
1595
+ }.bind(this));
1596
+ this.popup.focus = this.editor.focus.bind(this.editor);
1597
+ this.popup.on("show", this.$onPopupShow.bind(this));
1598
+ this.popup.on("hide", this.$onHidePopup.bind(this));
1599
+ this.popup.on("select", this.$onPopupChange.bind(this));
1600
+ event.addListener(this.popup.container, "mouseout", this.mouseOutListener.bind(this));
1601
+ this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
1602
+ this.popup.renderer.on("afterRender", this.$onPopupRender.bind(this));
1603
+ return this.popup;
1604
+ };
1605
+ Autocomplete.prototype.$initInline = function () {
1606
+ if (!this.inlineEnabled || this.inlineRenderer)
1607
+ return;
1608
+ this.inlineRenderer = new AceInline();
1609
+ return this.inlineRenderer;
1610
+ };
1611
+ Autocomplete.prototype.getPopup = function () {
1612
+ return this.popup || this.$init();
1613
+ };
1614
+ Autocomplete.prototype.$onHidePopup = function () {
1615
+ if (this.inlineRenderer) {
1616
+ this.inlineRenderer.hide();
1617
+ }
1618
+ this.hideDocTooltip();
1619
+ this.stickySelectionTimer.cancel();
1620
+ this.popupTimer.cancel();
1621
+ this.stickySelection = false;
1622
+ };
1623
+ Autocomplete.prototype.$seen = function (completion) {
1624
+ if (!this.hasSeen.has(completion) && completion && completion.completer && completion.completer.onSeen && typeof completion.completer.onSeen === "function") {
1625
+ completion.completer.onSeen(this.editor, completion);
1626
+ this.hasSeen.add(completion);
1627
+ }
1628
+ };
1629
+ Autocomplete.prototype.$onPopupChange = function (hide) {
1630
+ if (this.inlineRenderer && this.inlineEnabled) {
1631
+ var completion = hide ? null : this.popup.getData(this.popup.getRow());
1632
+ this.$updateGhostText(completion);
1633
+ if (this.popup.isMouseOver && this.setSelectOnHover) {
1634
+ this.tooltipTimer.call(null, null);
1635
+ return;
1636
+ }
1637
+ this.popupTimer.schedule();
1638
+ this.tooltipTimer.schedule();
1639
+ }
1640
+ else {
1641
+ this.popupTimer.call(null, null);
1642
+ this.tooltipTimer.call(null, null);
1643
+ }
1644
+ };
1645
+ Autocomplete.prototype.$updateGhostText = function (completion) {
1646
+ var row = this.base.row;
1647
+ var column = this.base.column;
1648
+ var cursorColumn = this.editor.getCursorPosition().column;
1649
+ var prefix = this.editor.session.getLine(row).slice(column, cursorColumn);
1650
+ if (!this.inlineRenderer.show(this.editor, completion, prefix)) {
1651
+ this.inlineRenderer.hide();
1652
+ }
1653
+ else {
1654
+ this.$seen(completion);
1655
+ }
1656
+ };
1657
+ Autocomplete.prototype.$onPopupRender = function () {
1658
+ var inlineEnabled = this.inlineRenderer && this.inlineEnabled;
1659
+ if (this.completions && this.completions.filtered && this.completions.filtered.length > 0) {
1660
+ for (var i = this.popup.getFirstVisibleRow(); i <= this.popup.getLastVisibleRow(); i++) {
1661
+ var completion = this.popup.getData(i);
1662
+ if (completion && (!inlineEnabled || completion.hideInlinePreview)) {
1663
+ this.$seen(completion);
1664
+ }
1665
+ }
1666
+ }
1667
+ };
1668
+ Autocomplete.prototype.$onPopupShow = function (hide) {
1669
+ this.$onPopupChange(hide);
1670
+ this.stickySelection = false;
1671
+ if (this.stickySelectionDelay >= 0)
1672
+ this.stickySelectionTimer.schedule(this.stickySelectionDelay);
1673
+ };
1674
+ Autocomplete.prototype.observeLayoutChanges = function () {
1675
+ if (this.$elements || !this.editor)
1676
+ return;
1677
+ window.addEventListener("resize", this.onLayoutChange, { passive: true });
1678
+ window.addEventListener("wheel", this.mousewheelListener);
1679
+ var el = this.editor.container.parentNode;
1680
+ var elements = [];
1681
+ while (el) {
1682
+ elements.push(el);
1683
+ el.addEventListener("scroll", this.onLayoutChange, { passive: true });
1684
+ el = el.parentNode;
1685
+ }
1686
+ this.$elements = elements;
1687
+ };
1688
+ Autocomplete.prototype.unObserveLayoutChanges = function () {
1689
+ var _this = this;
1690
+ window.removeEventListener("resize", this.onLayoutChange, { passive: true });
1691
+ window.removeEventListener("wheel", this.mousewheelListener);
1692
+ this.$elements && this.$elements.forEach(function (el) {
1693
+ el.removeEventListener("scroll", _this.onLayoutChange, { passive: true });
1694
+ });
1695
+ this.$elements = null;
1696
+ };
1697
+ Autocomplete.prototype.onLayoutChange = function () {
1698
+ if (!this.popup.isOpen)
1699
+ return this.unObserveLayoutChanges();
1700
+ this.$updatePopupPosition();
1701
+ this.updateDocTooltip();
1702
+ };
1703
+ Autocomplete.prototype.$updatePopupPosition = function () {
1704
+ var editor = this.editor;
1705
+ var renderer = editor.renderer;
1706
+ var lineHeight = renderer.layerConfig.lineHeight;
1707
+ var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
1708
+ pos.left -= this.popup.getTextLeftOffset();
1709
+ var rect = editor.container.getBoundingClientRect();
1710
+ pos.top += rect.top - renderer.layerConfig.offset;
1711
+ pos.left += rect.left - editor.renderer.scrollLeft;
1712
+ pos.left += renderer.gutterWidth;
1713
+ var posGhostText = {
1714
+ top: pos.top,
1715
+ left: pos.left
1716
+ };
1717
+ if (renderer.$ghostText && renderer.$ghostTextWidget) {
1718
+ if (this.base.row === renderer.$ghostText.position.row) {
1719
+ posGhostText.top += renderer.$ghostTextWidget.el.offsetHeight;
1720
+ }
1721
+ }
1722
+ var editorContainerBottom = editor.container.getBoundingClientRect().bottom - lineHeight;
1723
+ var lowestPosition = editorContainerBottom < posGhostText.top ?
1724
+ { top: editorContainerBottom, left: posGhostText.left } :
1725
+ posGhostText;
1726
+ if (this.popup.tryShow(lowestPosition, lineHeight, "bottom")) {
1727
+ return;
1728
+ }
1729
+ if (this.popup.tryShow(pos, lineHeight, "top")) {
1730
+ return;
1731
+ }
1732
+ this.popup.show(pos, lineHeight);
1733
+ };
1734
+ Autocomplete.prototype.openPopup = function (editor, prefix, keepPopupPosition) {
1735
+ this.$firstOpenTimer.cancel();
1736
+ if (!this.popup)
1737
+ this.$init();
1738
+ if (this.inlineEnabled && !this.inlineRenderer)
1739
+ this.$initInline();
1740
+ this.popup.autoSelect = this.autoSelect;
1741
+ this.popup.setSelectOnHover(this.setSelectOnHover);
1742
+ var oldRow = this.popup.getRow();
1743
+ var previousSelectedItem = this.popup.data[oldRow];
1744
+ this.popup.setData(this.completions.filtered, this.completions.filterText);
1745
+ if (this.editor.textInput.setAriaOptions) {
1746
+ this.editor.textInput.setAriaOptions({
1747
+ activeDescendant: getAriaId(this.popup.getRow()),
1748
+ inline: this.inlineEnabled
1749
+ });
1750
+ }
1751
+ editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
1752
+ var newRow;
1753
+ if (this.stickySelection)
1754
+ newRow = this.popup.data.indexOf(previousSelectedItem);
1755
+ if (!newRow || newRow === -1)
1756
+ newRow = 0;
1757
+ this.popup.setRow(this.autoSelect ? newRow : -1);
1758
+ if (newRow === oldRow && previousSelectedItem !== this.completions.filtered[newRow])
1759
+ this.$onPopupChange();
1760
+ var inlineEnabled = this.inlineRenderer && this.inlineEnabled;
1761
+ if (newRow === oldRow && inlineEnabled) {
1762
+ var completion = this.popup.getData(this.popup.getRow());
1763
+ this.$updateGhostText(completion);
1764
+ }
1765
+ if (!keepPopupPosition) {
1766
+ this.popup.setTheme(editor.getTheme());
1767
+ this.popup.setFontSize(editor.getFontSize());
1768
+ this.$updatePopupPosition();
1769
+ if (this.tooltipNode) {
1770
+ this.updateDocTooltip();
1771
+ }
1772
+ }
1773
+ this.changeTimer.cancel();
1774
+ this.observeLayoutChanges();
1775
+ };
1776
+ Autocomplete.prototype.detach = function () {
1777
+ if (this.editor) {
1778
+ this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
1779
+ this.editor.off("changeSelection", this.changeListener);
1780
+ this.editor.off("blur", this.blurListener);
1781
+ this.editor.off("mousedown", this.mousedownListener);
1782
+ this.editor.off("mousewheel", this.mousewheelListener);
1783
+ }
1784
+ this.$firstOpenTimer.cancel();
1785
+ this.changeTimer.cancel();
1786
+ this.hideDocTooltip();
1787
+ if (this.completionProvider) {
1788
+ this.completionProvider.detach();
1789
+ }
1790
+ if (this.popup && this.popup.isOpen)
1791
+ this.popup.hide();
1792
+ if (this.popup && this.popup.renderer) {
1793
+ this.popup.renderer.off("afterRender", this.$onPopupRender);
1794
+ }
1795
+ if (this.base)
1796
+ this.base.detach();
1797
+ this.activated = false;
1798
+ this.completionProvider = this.completions = this.base = null;
1799
+ this.unObserveLayoutChanges();
1800
+ };
1801
+ Autocomplete.prototype.changeListener = function (e) {
1802
+ var cursor = this.editor.selection.lead;
1803
+ if (cursor.row != this.base.row || cursor.column < this.base.column) {
1804
+ this.detach();
1805
+ }
1806
+ if (this.activated)
1807
+ this.changeTimer.schedule();
1808
+ else
1809
+ this.detach();
1810
+ };
1811
+ Autocomplete.prototype.blurListener = function (e) {
1812
+ var el = document.activeElement;
1813
+ var text = this.editor.textInput.getElement();
1814
+ var fromTooltip = e.relatedTarget && this.tooltipNode && this.tooltipNode.contains(e.relatedTarget);
1815
+ var container = this.popup && this.popup.container;
1816
+ if (el != text && el.parentNode != container && !fromTooltip
1817
+ && el != this.tooltipNode && e.relatedTarget != text) {
1818
+ this.detach();
1819
+ }
1820
+ };
1821
+ Autocomplete.prototype.mousedownListener = function (e) {
1822
+ this.detach();
1823
+ };
1824
+ Autocomplete.prototype.mousewheelListener = function (e) {
1825
+ if (this.popup && !this.popup.isMouseOver)
1826
+ this.detach();
1827
+ };
1828
+ Autocomplete.prototype.mouseOutListener = function (e) {
1829
+ if (this.popup.isOpen)
1830
+ this.$updatePopupPosition();
1831
+ };
1832
+ Autocomplete.prototype.goTo = function (where) {
1833
+ this.popup.goTo(where);
1834
+ };
1835
+ Autocomplete.prototype.insertMatch = function (data, options) {
1836
+ if (!data)
1837
+ data = this.popup.getData(this.popup.getRow());
1838
+ if (!data)
1839
+ return false;
1840
+ if (data.value === "") // Explicitly given nothing to insert, e.g. "No suggestion state"
1841
+ return this.detach();
1842
+ var completions = this.completions;
1843
+ var result = this.getCompletionProvider().insertMatch(this.editor, data, completions.filterText, options);
1844
+ if (this.completions == completions)
1845
+ this.detach();
1846
+ return result;
1847
+ };
1848
+ Autocomplete.prototype.showPopup = function (editor, options) {
1849
+ if (this.editor)
1850
+ this.detach();
1851
+ this.activated = true;
1852
+ this.editor = editor;
1853
+ if (editor.completer != this) {
1854
+ if (editor.completer)
1855
+ editor.completer.detach();
1856
+ editor.completer = this;
1857
+ }
1858
+ editor.on("changeSelection", this.changeListener);
1859
+ editor.on("blur", this.blurListener);
1860
+ editor.on("mousedown", this.mousedownListener);
1861
+ editor.on("mousewheel", this.mousewheelListener);
1862
+ this.updateCompletions(false, options);
1863
+ };
1864
+ Autocomplete.prototype.getCompletionProvider = function (initialPosition) {
1865
+ if (!this.completionProvider)
1866
+ this.completionProvider = new CompletionProvider(initialPosition);
1867
+ return this.completionProvider;
1868
+ };
1869
+ Autocomplete.prototype.gatherCompletions = function (editor, callback) {
1870
+ return this.getCompletionProvider().gatherCompletions(editor, callback);
1871
+ };
1872
+ Autocomplete.prototype.updateCompletions = function (keepPopupPosition, options) {
1873
+ if (keepPopupPosition && this.base && this.completions) {
1874
+ var pos = this.editor.getCursorPosition();
1875
+ var prefix = this.editor.session.getTextRange({ start: this.base, end: pos });
1876
+ if (prefix == this.completions.filterText)
1877
+ return;
1878
+ this.completions.setFilter(prefix);
1879
+ if (!this.completions.filtered.length)
1880
+ return this.detach();
1881
+ if (this.completions.filtered.length == 1
1882
+ && this.completions.filtered[0].value == prefix
1883
+ && !this.completions.filtered[0].snippet)
1884
+ return this.detach();
1885
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1886
+ return;
1887
+ }
1888
+ if (options && options.matches) {
1889
+ var pos = this.editor.getSelectionRange().start;
1890
+ this.base = this.editor.session.doc.createAnchor(pos.row, pos.column);
1891
+ this.base.$insertRight = true;
1892
+ this.completions = new FilteredList(options.matches);
1893
+ this.getCompletionProvider().completions = this.completions;
1894
+ return this.openPopup(this.editor, "", keepPopupPosition);
1895
+ }
1896
+ var session = this.editor.getSession();
1897
+ var pos = this.editor.getCursorPosition();
1898
+ var prefix = util.getCompletionPrefix(this.editor);
1899
+ this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
1900
+ this.base.$insertRight = true;
1901
+ var completionOptions = {
1902
+ exactMatch: this.exactMatch,
1903
+ ignoreCaption: this.ignoreCaption
1904
+ };
1905
+ this.getCompletionProvider({
1906
+ prefix: prefix,
1907
+ pos: pos
1908
+ }).provideCompletions(this.editor, completionOptions,
1909
+ function (err, completions, finished) {
1910
+ var filtered = completions.filtered;
1911
+ var prefix = util.getCompletionPrefix(this.editor);
1912
+ this.$firstOpenTimer.cancel();
1913
+ if (finished) {
1914
+ if (!filtered.length) {
1915
+ var emptyMessage = !this.autoShown && this.emptyMessage;
1916
+ if (typeof emptyMessage == "function")
1917
+ emptyMessage = this.emptyMessage(prefix);
1918
+ if (emptyMessage) {
1919
+ var completionsForEmpty = [{
1920
+ caption: emptyMessage,
1921
+ value: ""
1922
+ }
1923
+ ];
1924
+ this.completions = new FilteredList(completionsForEmpty);
1925
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1926
+ this.popup.renderer.setStyle("ace_loading", false);
1927
+ this.popup.renderer.setStyle("ace_empty-message", true);
1928
+ return;
1929
+ }
1930
+ return this.detach();
1931
+ }
1932
+ if (filtered.length == 1 && filtered[0].value == prefix
1933
+ && !filtered[0].snippet)
1934
+ return this.detach();
1935
+ if (this.autoInsert && !this.autoShown && filtered.length == 1)
1936
+ return this.insertMatch(filtered[0]);
1937
+ }
1938
+ this.completions = !finished && this.showLoadingState ?
1939
+ new FilteredList(Autocomplete.completionsForLoading.concat(filtered), completions.filterText) :
1940
+ completions;
1941
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1942
+ this.popup.renderer.setStyle("ace_empty-message", false);
1943
+ this.popup.renderer.setStyle("ace_loading", !finished);
1944
+ }.bind(this));
1945
+ if (this.showLoadingState && !this.autoShown && !(this.popup && this.popup.isOpen)) {
1946
+ this.$firstOpenTimer.delay(this.stickySelectionDelay / 2);
1947
+ }
1948
+ };
1949
+ Autocomplete.prototype.cancelContextMenu = function () {
1950
+ this.editor.$mouseHandler.cancelContextMenu();
1951
+ };
1952
+ Autocomplete.prototype.updateDocTooltip = function () {
1953
+ var popup = this.popup;
1954
+ var all = this.completions && this.completions.filtered;
1955
+ var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]);
1956
+ var doc = null;
1957
+ if (!selected || !this.editor || !this.popup.isOpen)
1958
+ return this.hideDocTooltip();
1959
+ var completersLength = this.editor.completers.length;
1960
+ for (var i = 0; i < completersLength; i++) {
1961
+ var completer = this.editor.completers[i];
1962
+ if (completer.getDocTooltip && selected.completerId === completer.id) {
1963
+ doc = completer.getDocTooltip(selected);
1964
+ break;
1965
+ }
1966
+ }
1967
+ if (!doc && typeof selected != "string")
1968
+ doc = selected;
1969
+ if (typeof doc == "string")
1970
+ doc = { docText: doc };
1971
+ if (!doc || !(doc.docHTML || doc.docText))
1972
+ return this.hideDocTooltip();
1973
+ this.showDocTooltip(doc);
1974
+ };
1975
+ Autocomplete.prototype.showDocTooltip = function (item) {
1976
+ if (!this.tooltipNode) {
1977
+ this.tooltipNode = dom.createElement("div");
1978
+ this.tooltipNode.style.margin = "0";
1979
+ this.tooltipNode.style.pointerEvents = "auto";
1980
+ this.tooltipNode.style.overscrollBehavior = "contain";
1981
+ this.tooltipNode.tabIndex = -1;
1982
+ this.tooltipNode.onblur = this.blurListener.bind(this);
1983
+ this.tooltipNode.onclick = this.onTooltipClick.bind(this);
1984
+ this.tooltipNode.id = "doc-tooltip";
1985
+ this.tooltipNode.setAttribute("role", "tooltip");
1986
+ this.tooltipNode.addEventListener("wheel", preventParentScroll);
1987
+ }
1988
+ var theme = this.editor.renderer.theme;
1989
+ this.tooltipNode.className = "ace_tooltip ace_doc-tooltip " +
1990
+ (theme.isDark ? "ace_dark " : "") + (theme.cssClass || "");
1991
+ var tooltipNode = this.tooltipNode;
1992
+ if (item.docHTML) {
1993
+ tooltipNode.innerHTML = item.docHTML;
1994
+ }
1995
+ else if (item.docText) {
1996
+ tooltipNode.textContent = item.docText;
1997
+ }
1998
+ if (!tooltipNode.parentNode)
1999
+ this.popup.container.appendChild(this.tooltipNode);
2000
+ var popup = this.popup;
2001
+ var rect = popup.container.getBoundingClientRect();
2002
+ var targetWidth = 400;
2003
+ var targetHeight = 300;
2004
+ var scrollBarSize = popup.renderer.scrollBar.width || 10;
2005
+ var leftSize = rect.left;
2006
+ var rightSize = window.innerWidth - rect.right - scrollBarSize;
2007
+ var topSize = popup.isTopdown ? window.innerHeight - scrollBarSize - rect.bottom : rect.top;
2008
+ var scores = [
2009
+ Math.min(rightSize / targetWidth, 1),
2010
+ Math.min(leftSize / targetWidth, 1),
2011
+ Math.min(topSize / targetHeight, 1) * 0.9,
2012
+ ];
2013
+ var max = Math.max.apply(Math, scores);
2014
+ var tooltipStyle = tooltipNode.style;
2015
+ tooltipStyle.display = "block";
2016
+ if (max == scores[0] || scores[0] >= 1) {
2017
+ tooltipStyle.left = (rect.right + 1) + "px";
2018
+ tooltipStyle.right = "";
2019
+ tooltipStyle.maxWidth = targetWidth * max + "px";
2020
+ tooltipStyle.top = rect.top + "px";
2021
+ tooltipStyle.bottom = "";
2022
+ tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.top, targetHeight) + "px";
2023
+ }
2024
+ else if (max == scores[1] || scores[1] >= 1) {
2025
+ tooltipStyle.right = window.innerWidth - rect.left + "px";
2026
+ tooltipStyle.left = "";
2027
+ tooltipStyle.maxWidth = targetWidth * max + "px";
2028
+ tooltipStyle.top = rect.top + "px";
2029
+ tooltipStyle.bottom = "";
2030
+ tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.top, targetHeight) + "px";
2031
+ }
2032
+ else if (max == scores[2]) {
2033
+ tooltipStyle.left = rect.left + "px";
2034
+ tooltipStyle.right = "";
2035
+ tooltipStyle.maxWidth = Math.min(targetWidth, window.innerWidth - rect.left) + "px";
2036
+ if (popup.isTopdown) {
2037
+ tooltipStyle.top = rect.bottom + "px";
2038
+ tooltipStyle.bottom = "";
2039
+ tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.bottom, targetHeight) + "px";
2040
+ }
2041
+ else {
2042
+ tooltipStyle.top = "";
2043
+ tooltipStyle.bottom = (window.innerHeight - rect.top) + "px";
2044
+ tooltipStyle.maxHeight = Math.min(rect.top, targetHeight) + "px";
2045
+ }
2046
+ }
2047
+ dom.$fixPositionBug(tooltipNode);
2048
+ };
2049
+ Autocomplete.prototype.hideDocTooltip = function () {
2050
+ this.tooltipTimer.cancel();
2051
+ if (!this.tooltipNode)
2052
+ return;
2053
+ var el = this.tooltipNode;
2054
+ if (!this.editor.isFocused() && document.activeElement == el)
2055
+ this.editor.focus();
2056
+ this.tooltipNode = null;
2057
+ if (el.parentNode)
2058
+ el.parentNode.removeChild(el);
2059
+ };
2060
+ Autocomplete.prototype.onTooltipClick = function (e) {
2061
+ var a = e.target;
2062
+ while (a && a != this.tooltipNode) {
2063
+ if (a.nodeName == "A" && a.href) {
2064
+ a.rel = "noreferrer";
2065
+ a.target = "_blank";
2066
+ break;
2067
+ }
2068
+ a = a.parentNode;
2069
+ }
2070
+ };
2071
+ Autocomplete.prototype.destroy = function () {
2072
+ this.detach();
2073
+ if (this.popup) {
2074
+ this.popup.destroy();
2075
+ var el = this.popup.container;
2076
+ if (el && el.parentNode)
2077
+ el.parentNode.removeChild(el);
2078
+ }
2079
+ if (this.editor && this.editor.completer == this) {
2080
+ this.editor.off("destroy", destroyCompleter);
2081
+ this.editor.completer = null;
2082
+ }
2083
+ this.inlineRenderer = this.popup = this.editor = null;
2084
+ };
2085
+ Autocomplete.for = function (editor) {
2086
+ if (editor.completer instanceof Autocomplete) {
2087
+ return editor.completer;
2088
+ }
2089
+ if (editor.completer) {
2090
+ editor.completer.destroy();
2091
+ editor.completer = null;
2092
+ }
2093
+ if (config.get("sharedPopups")) {
2094
+ if (!Autocomplete["$sharedInstance"])
2095
+ Autocomplete["$sharedInstance"] = new Autocomplete();
2096
+ editor.completer = Autocomplete["$sharedInstance"];
2097
+ }
2098
+ else {
2099
+ editor.completer = new Autocomplete();
2100
+ editor.once("destroy", destroyCompleter);
2101
+ }
2102
+ return editor.completer;
2103
+ };
2104
+ return Autocomplete;
2105
+ }());
2106
+ Autocomplete.prototype.commands = {
2107
+ "Up": function (editor) { editor.completer.goTo("up"); },
2108
+ "Down": function (editor) { editor.completer.goTo("down"); },
2109
+ "Ctrl-Up|Ctrl-Home": function (editor) { editor.completer.goTo("start"); },
2110
+ "Ctrl-Down|Ctrl-End": function (editor) { editor.completer.goTo("end"); },
2111
+ "Esc": function (editor) { editor.completer.detach(); },
2112
+ "Return": function (editor) { return editor.completer.insertMatch(); },
2113
+ "Shift-Return": function (editor) { editor.completer.insertMatch(null, { deleteSuffix: true }); },
2114
+ "Tab": function (editor) {
2115
+ var result = editor.completer.insertMatch();
2116
+ if (!result && !editor.tabstopManager)
2117
+ editor.completer.goTo("down");
2118
+ else
2119
+ return result;
2120
+ },
2121
+ "Backspace": function (editor) {
2122
+ editor.execCommand("backspace");
2123
+ var prefix = util.getCompletionPrefix(editor);
2124
+ if (!prefix && editor.completer)
2125
+ editor.completer.detach();
2126
+ },
2127
+ "PageUp": function (editor) { editor.completer.popup.gotoPageUp(); },
2128
+ "PageDown": function (editor) { editor.completer.popup.gotoPageDown(); }
2129
+ };
2130
+ Autocomplete.startCommand = {
2131
+ name: "startAutocomplete",
2132
+ exec: function (editor, options) {
2133
+ var completer = Autocomplete.for(editor);
2134
+ completer.autoInsert = false;
2135
+ completer.autoSelect = true;
2136
+ completer.autoShown = false;
2137
+ completer.showPopup(editor, options);
2138
+ completer.cancelContextMenu();
2139
+ },
2140
+ bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
2141
+ };
2142
+ var CompletionProvider = /** @class */ (function () {
2143
+ function CompletionProvider(initialPosition) {
2144
+ this.initialPosition = initialPosition;
2145
+ this.active = true;
2146
+ }
2147
+ CompletionProvider.prototype.insertByIndex = function (editor, index, options) {
2148
+ if (!this.completions || !this.completions.filtered) {
2149
+ return false;
2150
+ }
2151
+ return this.insertMatch(editor, this.completions.filtered[index], options);
2152
+ };
2153
+ CompletionProvider.prototype.insertMatch = function (editor, data, options) {
2154
+ if (!data)
2155
+ return false;
2156
+ editor.startOperation({ command: { name: "insertMatch" } });
2157
+ if (data.completer && data.completer.insertMatch) {
2158
+ data.completer.insertMatch(editor, data);
2159
+ }
2160
+ else {
2161
+ if (!this.completions)
2162
+ return false;
2163
+ var replaceBefore = this.completions.filterText.length;
2164
+ var replaceAfter = 0;
2165
+ if (data.range && data.range.start.row === data.range.end.row) {
2166
+ replaceBefore -= this.initialPosition.prefix.length;
2167
+ replaceBefore += this.initialPosition.pos.column - data.range.start.column;
2168
+ replaceAfter += data.range.end.column - this.initialPosition.pos.column;
2169
+ }
2170
+ if (replaceBefore || replaceAfter) {
2171
+ var ranges;
2172
+ if (editor.selection.getAllRanges) {
2173
+ ranges = editor.selection.getAllRanges();
2174
+ }
2175
+ else {
2176
+ ranges = [editor.getSelectionRange()];
2177
+ }
2178
+ for (var i = 0, range; range = ranges[i]; i++) {
2179
+ range.start.column -= replaceBefore;
2180
+ range.end.column += replaceAfter;
2181
+ editor.session.remove(range);
2182
+ }
2183
+ }
2184
+ if (data.snippet) {
2185
+ snippetManager.insertSnippet(editor, data.snippet);
2186
+ }
2187
+ else {
2188
+ this.$insertString(editor, data);
2189
+ }
2190
+ if (data.completer && data.completer.onInsert && typeof data.completer.onInsert == "function") {
2191
+ data.completer.onInsert(editor, data);
2192
+ }
2193
+ if (data.command && data.command === "startAutocomplete") {
2194
+ editor.execCommand(data.command);
2195
+ }
2196
+ }
2197
+ editor.endOperation();
2198
+ return true;
2199
+ };
2200
+ CompletionProvider.prototype.$insertString = function (editor, data) {
2201
+ var text = data.value || data;
2202
+ editor.execCommand("insertstring", text);
2203
+ };
2204
+ CompletionProvider.prototype.gatherCompletions = function (editor, callback) {
2205
+ var session = editor.getSession();
2206
+ var pos = editor.getCursorPosition();
2207
+ var prefix = util.getCompletionPrefix(editor);
2208
+ var matches = [];
2209
+ this.completers = editor.completers;
2210
+ var total = editor.completers.length;
2211
+ editor.completers.forEach(function (completer, i) {
2212
+ completer.getCompletions(editor, session, pos, prefix, function (err, results) {
2213
+ if (completer.hideInlinePreview)
2214
+ results = results.map(function (result) {
2215
+ return Object.assign(result, { hideInlinePreview: completer.hideInlinePreview });
2216
+ });
2217
+ if (!err && results)
2218
+ matches = matches.concat(results);
2219
+ callback(null, {
2220
+ prefix: util.getCompletionPrefix(editor),
2221
+ matches: matches,
2222
+ finished: (--total === 0)
2223
+ });
2224
+ });
2225
+ });
2226
+ return true;
2227
+ };
2228
+ CompletionProvider.prototype.provideCompletions = function (editor, options, callback) {
2229
+ var processResults = function (results) {
2230
+ var prefix = results.prefix;
2231
+ var matches = results.matches;
2232
+ this.completions = new FilteredList(matches);
2233
+ if (options.exactMatch)
2234
+ this.completions.exactMatch = true;
2235
+ if (options.ignoreCaption)
2236
+ this.completions.ignoreCaption = true;
2237
+ this.completions.setFilter(prefix);
2238
+ if (results.finished || this.completions.filtered.length)
2239
+ callback(null, this.completions, results.finished);
2240
+ }.bind(this);
2241
+ var isImmediate = true;
2242
+ var immediateResults = null;
2243
+ this.gatherCompletions(editor, function (err, results) {
2244
+ if (!this.active) {
2245
+ return;
2246
+ }
2247
+ if (err) {
2248
+ callback(err, [], true);
2249
+ this.detach();
2250
+ }
2251
+ var prefix = results.prefix;
2252
+ if (prefix.indexOf(results.prefix) !== 0)
2253
+ return;
2254
+ if (isImmediate) {
2255
+ immediateResults = results;
2256
+ return;
2257
+ }
2258
+ processResults(results);
2259
+ }.bind(this));
2260
+ isImmediate = false;
2261
+ if (immediateResults) {
2262
+ var results = immediateResults;
2263
+ immediateResults = null;
2264
+ processResults(results);
2265
+ }
2266
+ };
2267
+ CompletionProvider.prototype.detach = function () {
2268
+ this.active = false;
2269
+ this.completers && this.completers.forEach(function (completer) {
2270
+ if (typeof completer.cancel === "function") {
2271
+ completer.cancel();
2272
+ }
2273
+ });
2274
+ };
2275
+ return CompletionProvider;
2276
+ }());
2277
+ var FilteredList = /** @class */ (function () {
2278
+ function FilteredList(array, filterText) {
2279
+ this.all = array;
2280
+ this.filtered = array;
2281
+ this.filterText = filterText || "";
2282
+ this.exactMatch = false;
2283
+ this.ignoreCaption = false;
2284
+ }
2285
+ FilteredList.prototype.setFilter = function (str) {
2286
+ if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
2287
+ var matches = this.filtered;
2288
+ else
2289
+ var matches = this.all;
2290
+ this.filterText = str;
2291
+ matches = this.filterCompletions(matches, this.filterText);
2292
+ matches = matches.sort(function (a, b) {
2293
+ return b.exactMatch - a.exactMatch || b.$score - a.$score
2294
+ || (a.caption || a.value).localeCompare(b.caption || b.value);
2295
+ });
2296
+ var prev = null;
2297
+ matches = matches.filter(function (item) {
2298
+ var caption = item.snippet || item.caption || item.value;
2299
+ if (caption === prev)
2300
+ return false;
2301
+ prev = caption;
2302
+ return true;
2303
+ });
2304
+ this.filtered = matches;
2305
+ };
2306
+ FilteredList.prototype.filterCompletions = function (items, needle) {
2307
+ var results = [];
2308
+ var upper = needle.toUpperCase();
2309
+ var lower = needle.toLowerCase();
2310
+ loop: for (var i = 0, item; item = items[i]; i++) {
2311
+ if (item.skipFilter) {
2312
+ item.$score = item.score;
2313
+ results.push(item);
2314
+ continue;
2315
+ }
2316
+ var caption = (!this.ignoreCaption && item.caption) || item.value || item.snippet;
2317
+ if (!caption)
2318
+ continue;
2319
+ var lastIndex = -1;
2320
+ var matchMask = 0;
2321
+ var penalty = 0;
2322
+ var index, distance;
2323
+ if (this.exactMatch) {
2324
+ if (needle !== caption.substr(0, needle.length))
2325
+ continue loop;
2326
+ }
2327
+ else {
2328
+ var fullMatchIndex = caption.toLowerCase().indexOf(lower);
2329
+ if (fullMatchIndex > -1) {
2330
+ penalty = fullMatchIndex;
2331
+ }
2332
+ else {
2333
+ for (var j = 0; j < needle.length; j++) {
2334
+ var i1 = caption.indexOf(lower[j], lastIndex + 1);
2335
+ var i2 = caption.indexOf(upper[j], lastIndex + 1);
2336
+ index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
2337
+ if (index < 0)
2338
+ continue loop;
2339
+ distance = index - lastIndex - 1;
2340
+ if (distance > 0) {
2341
+ if (lastIndex === -1)
2342
+ penalty += 10;
2343
+ penalty += distance;
2344
+ matchMask = matchMask | (1 << j);
2345
+ }
2346
+ lastIndex = index;
2347
+ }
2348
+ }
2349
+ }
2350
+ item.matchMask = matchMask;
2351
+ item.exactMatch = penalty ? 0 : 1;
2352
+ item.$score = (item.score || 0) - penalty;
2353
+ results.push(item);
2354
+ }
2355
+ return results;
2356
+ };
2357
+ return FilteredList;
2358
+ }());
2359
+ exports.Autocomplete = Autocomplete;
2360
+ exports.CompletionProvider = CompletionProvider;
2361
+ exports.FilteredList = FilteredList;
2362
+
2363
+ });
2364
+
2365
+ ace.define("ace/marker_group",["require","exports","module"], function(require, exports, module){"use strict";
2366
+ var MarkerGroup = /** @class */ (function () {
2367
+ function MarkerGroup(session, options) {
2368
+ if (options)
2369
+ this.markerType = options.markerType;
2370
+ this.markers = [];
2371
+ this.session = session;
2372
+ session.addDynamicMarker(this);
2373
+ }
2374
+ MarkerGroup.prototype.getMarkerAtPosition = function (pos) {
2375
+ return this.markers.find(function (marker) {
2376
+ return marker.range.contains(pos.row, pos.column);
2377
+ });
2378
+ };
2379
+ MarkerGroup.prototype.markersComparator = function (a, b) {
2380
+ return a.range.start.row - b.range.start.row;
2381
+ };
2382
+ MarkerGroup.prototype.setMarkers = function (markers) {
2383
+ this.markers = markers.sort(this.markersComparator).slice(0, this.MAX_MARKERS);
2384
+ this.session._signal("changeBackMarker");
2385
+ };
2386
+ MarkerGroup.prototype.update = function (html, markerLayer, session, config) {
2387
+ if (!this.markers || !this.markers.length)
2388
+ return;
2389
+ var visibleRangeStartRow = config.firstRow, visibleRangeEndRow = config.lastRow;
2390
+ var foldLine;
2391
+ var markersOnOneLine = 0;
2392
+ var lastRow = 0;
2393
+ for (var i = 0; i < this.markers.length; i++) {
2394
+ var marker = this.markers[i];
2395
+ if (marker.range.end.row < visibleRangeStartRow)
2396
+ continue;
2397
+ if (marker.range.start.row > visibleRangeEndRow)
2398
+ continue;
2399
+ if (marker.range.start.row === lastRow) {
2400
+ markersOnOneLine++;
2401
+ }
2402
+ else {
2403
+ lastRow = marker.range.start.row;
2404
+ markersOnOneLine = 0;
2405
+ }
2406
+ if (markersOnOneLine > 200) {
2407
+ continue;
2408
+ }
2409
+ var markerVisibleRange = marker.range.clipRows(visibleRangeStartRow, visibleRangeEndRow);
2410
+ if (markerVisibleRange.start.row === markerVisibleRange.end.row
2411
+ && markerVisibleRange.start.column === markerVisibleRange.end.column) {
2412
+ continue; // visible range is empty
2413
+ }
2414
+ var screenRange = markerVisibleRange.toScreenRange(session);
2415
+ if (screenRange.isEmpty()) {
2416
+ foldLine = session.getNextFoldLine(markerVisibleRange.end.row, foldLine);
2417
+ if (foldLine && foldLine.end.row > markerVisibleRange.end.row) {
2418
+ visibleRangeStartRow = foldLine.end.row;
2419
+ }
2420
+ continue;
2421
+ }
2422
+ if (this.markerType === "fullLine") {
2423
+ markerLayer.drawFullLineMarker(html, screenRange, marker.className, config);
2424
+ }
2425
+ else if (screenRange.isMultiLine()) {
2426
+ if (this.markerType === "line")
2427
+ markerLayer.drawMultiLineMarker(html, screenRange, marker.className, config);
2428
+ else
2429
+ markerLayer.drawTextMarker(html, screenRange, marker.className, config);
2430
+ }
2431
+ else {
2432
+ markerLayer.drawSingleLineMarker(html, screenRange, marker.className + " ace_br15", config);
2433
+ }
2434
+ }
2435
+ };
2436
+ return MarkerGroup;
2437
+ }());
2438
+ MarkerGroup.prototype.MAX_MARKERS = 10000;
2439
+ exports.MarkerGroup = MarkerGroup;
2440
+
2441
+ });
2442
+
2443
+ ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"], function(require, exports, module){var Range = require("../range").Range;
2444
+ var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;
2445
+ function getWordIndex(doc, pos) {
2446
+ var textBefore = doc.getTextRange(Range.fromPoints({
2447
+ row: 0,
2448
+ column: 0
2449
+ }, pos));
2450
+ return textBefore.split(splitRegex).length - 1;
2451
+ }
2452
+ function wordDistance(doc, pos) {
2453
+ var prefixPos = getWordIndex(doc, pos);
2454
+ var words = doc.getValue().split(splitRegex);
2455
+ var wordScores = Object.create(null);
2456
+ var currentWord = words[prefixPos];
2457
+ words.forEach(function (word, idx) {
2458
+ if (!word || word === currentWord)
2459
+ return;
2460
+ var distance = Math.abs(prefixPos - idx);
2461
+ var score = words.length - distance;
2462
+ if (wordScores[word]) {
2463
+ wordScores[word] = Math.max(score, wordScores[word]);
2464
+ }
2465
+ else {
2466
+ wordScores[word] = score;
2467
+ }
2468
+ });
2469
+ return wordScores;
2470
+ }
2471
+ exports.id = "textCompleter";
2472
+ exports.getCompletions = function (editor, session, pos, prefix, callback) {
2473
+ var wordScore = wordDistance(session, pos);
2474
+ var wordList = Object.keys(wordScore);
2475
+ callback(null, wordList.map(function (word) {
2476
+ return {
2477
+ caption: word,
2478
+ value: word,
2479
+ score: wordScore[word],
2480
+ meta: "local"
2481
+ };
2482
+ }));
2483
+ };
2484
+
2485
+ });
2486
+
2487
+ ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/marker_group","ace/autocomplete/text_completer","ace/editor","ace/config"], function(require, exports, module){/**
2488
+ * ## Language Tools extension for Ace Editor
2489
+ *
2490
+ * Provides autocompletion, snippets, and language intelligence features for the Ace code editor.
2491
+ * This extension integrates multiple completion providers including keyword completion, snippet expansion,
2492
+ * and text-based completion to enhance the coding experience with contextual suggestions and automated code generation.
2493
+ *
2494
+ * **Configuration Options:**
2495
+ * - `enableBasicAutocompletion`: Enable/disable basic completion functionality
2496
+ * - `enableLiveAutocompletion`: Enable/disable real-time completion suggestions
2497
+ * - `enableSnippets`: Enable/disable snippet expansion with Tab key
2498
+ * - `liveAutocompletionDelay`: Delay before showing live completion popup
2499
+ * - `liveAutocompletionThreshold`: Minimum prefix length to trigger completion
2500
+ *
2501
+ * **Usage:**
2502
+ * ```javascript
2503
+ * editor.setOptions({
2504
+ * enableBasicAutocompletion: true,
2505
+ * enableLiveAutocompletion: true,
2506
+ * enableSnippets: true
2507
+ * });
2508
+ * ```
2509
+ *
2510
+ * @module
2511
+ */
2512
+ "use strict";
2513
+ var snippetManager = require("../snippets").snippetManager;
2514
+ var Autocomplete = require("../autocomplete").Autocomplete;
2515
+ var config = require("../config");
2516
+ var lang = require("../lib/lang");
2517
+ var util = require("../autocomplete/util");
2518
+ var MarkerGroup = require("../marker_group").MarkerGroup;
2519
+ var textCompleter = require("../autocomplete/text_completer");
2520
+ var keyWordCompleter = {
2521
+ getCompletions: function (editor, session, pos, prefix, callback) {
2522
+ if (session.$mode.completer) {
2523
+ return session.$mode.completer.getCompletions(editor, session, pos, prefix, callback);
2524
+ }
2525
+ var state = editor.session.getState(pos.row);
2526
+ var completions = session.$mode.getCompletions(state, session, pos, prefix);
2527
+ completions = completions.map(function (el) {
2528
+ el.completerId = keyWordCompleter.id;
2529
+ return el;
2530
+ });
2531
+ callback(null, completions);
2532
+ },
2533
+ id: "keywordCompleter"
2534
+ };
2535
+ var transformSnippetTooltip = function (str) {
2536
+ var record = {};
2537
+ return str.replace(/\${(\d+)(:(.*?))?}/g, function (_, p1, p2, p3) {
2538
+ return (record[p1] = p3 || '');
2539
+ }).replace(/\$(\d+?)/g, function (_, p1) {
2540
+ return record[p1];
2541
+ });
2542
+ };
2543
+ var snippetCompleter = {
2544
+ getCompletions: function (editor, session, pos, prefix, callback) {
2545
+ var scopes = [];
2546
+ var token = session.getTokenAt(pos.row, pos.column);
2547
+ if (token && token.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/))
2548
+ scopes.push('html-tag');
2549
+ else
2550
+ scopes = snippetManager.getActiveScopes(editor);
2551
+ var snippetMap = snippetManager.snippetMap;
2552
+ var completions = [];
2553
+ scopes.forEach(function (scope) {
2554
+ var snippets = snippetMap[scope] || [];
2555
+ for (var i = snippets.length; i--;) {
2556
+ var s = snippets[i];
2557
+ var caption = s.name || s.tabTrigger;
2558
+ if (!caption)
2559
+ continue;
2560
+ completions.push({
2561
+ caption: caption,
2562
+ snippet: s.content,
2563
+ meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet",
2564
+ completerId: snippetCompleter.id
2565
+ });
2566
+ }
2567
+ }, this);
2568
+ callback(null, completions);
2569
+ },
2570
+ getDocTooltip: function (item) {
2571
+ if (item.snippet && !item.docHTML) {
2572
+ item.docHTML = [
2573
+ "<b>", lang.escapeHTML(item.caption), "</b>", "<hr></hr>",
2574
+ lang.escapeHTML(transformSnippetTooltip(item.snippet))
2575
+ ].join("");
2576
+ }
2577
+ },
2578
+ id: "snippetCompleter"
2579
+ };
2580
+ var completers = [snippetCompleter, textCompleter, keyWordCompleter];
2581
+ exports.setCompleters = function (val) {
2582
+ completers.length = 0;
2583
+ if (val)
2584
+ completers.push.apply(completers, val);
2585
+ };
2586
+ exports.addCompleter = function (completer) {
2587
+ completers.push(completer);
2588
+ };
2589
+ exports.textCompleter = textCompleter;
2590
+ exports.keyWordCompleter = keyWordCompleter;
2591
+ exports.snippetCompleter = snippetCompleter;
2592
+ var expandSnippet = {
2593
+ name: "expandSnippet",
2594
+ exec: function (editor) {
2595
+ return snippetManager.expandWithTab(editor);
2596
+ },
2597
+ bindKey: "Tab"
2598
+ };
2599
+ var onChangeMode = function (e, editor) {
2600
+ loadSnippetsForMode(editor.session.$mode);
2601
+ };
2602
+ var loadSnippetsForMode = function (mode) {
2603
+ if (typeof mode == "string")
2604
+ mode = config.$modes[mode];
2605
+ if (!mode)
2606
+ return;
2607
+ if (!snippetManager.files)
2608
+ snippetManager.files = {};
2609
+ loadSnippetFile(mode.$id, mode.snippetFileId);
2610
+ if (mode.modes)
2611
+ mode.modes.forEach(loadSnippetsForMode);
2612
+ };
2613
+ var loadSnippetFile = function (id, snippetFilePath) {
2614
+ if (!snippetFilePath || !id || snippetManager.files[id])
2615
+ return;
2616
+ snippetManager.files[id] = {};
2617
+ config.loadModule(snippetFilePath, function (m) {
2618
+ if (!m)
2619
+ return;
2620
+ snippetManager.files[id] = m;
2621
+ if (!m.snippets && m.snippetText)
2622
+ m.snippets = snippetManager.parseSnippetFile(m.snippetText);
2623
+ snippetManager.register(m.snippets || [], m.scope);
2624
+ if (m.includeScopes) {
2625
+ snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
2626
+ m.includeScopes.forEach(function (x) {
2627
+ loadSnippetsForMode("ace/mode/" + x);
2628
+ });
2629
+ }
2630
+ });
2631
+ };
2632
+ var doLiveAutocomplete = function (e) {
2633
+ var editor = e.editor;
2634
+ var hasCompleter = editor.completer && editor.completer.activated;
2635
+ if (e.command.name === "backspace") {
2636
+ if (hasCompleter && !util.getCompletionPrefix(editor))
2637
+ editor.completer.detach();
2638
+ }
2639
+ else if (e.command.name === "insertstring" && !hasCompleter) {
2640
+ lastExecEvent = e;
2641
+ var delay = e.editor.$liveAutocompletionDelay;
2642
+ if (delay) {
2643
+ liveAutocompleteTimer.delay(delay);
2644
+ }
2645
+ else {
2646
+ showLiveAutocomplete(e);
2647
+ }
2648
+ }
2649
+ };
2650
+ var lastExecEvent;
2651
+ var liveAutocompleteTimer = lang.delayedCall(function () {
2652
+ showLiveAutocomplete(lastExecEvent);
2653
+ }, 0);
2654
+ var showLiveAutocomplete = function (e) {
2655
+ var editor = e.editor;
2656
+ var prefix = util.getCompletionPrefix(editor);
2657
+ var previousChar = e.args;
2658
+ var triggerAutocomplete = util.triggerAutocomplete(editor, previousChar);
2659
+ if (prefix && prefix.length >= editor.$liveAutocompletionThreshold || triggerAutocomplete) {
2660
+ var completer = Autocomplete.for(editor);
2661
+ completer.autoShown = true;
2662
+ completer.showPopup(editor);
2663
+ }
2664
+ };
2665
+ var Editor = require("../editor").Editor;
2666
+ require("../config").defineOptions(Editor.prototype, "editor", {
2667
+ enableBasicAutocompletion: {
2668
+ set: function (val) {
2669
+ if (val) {
2670
+ Autocomplete.for(this);
2671
+ if (!this.completers)
2672
+ this.completers = Array.isArray(val) ? val : completers;
2673
+ this.commands.addCommand(Autocomplete.startCommand);
2674
+ }
2675
+ else {
2676
+ this.commands.removeCommand(Autocomplete.startCommand);
2677
+ }
2678
+ },
2679
+ value: false
2680
+ },
2681
+ enableLiveAutocompletion: {
2682
+ set: function (val) {
2683
+ if (val) {
2684
+ if (!this.completers)
2685
+ this.completers = Array.isArray(val) ? val : completers;
2686
+ this.commands.on('afterExec', doLiveAutocomplete);
2687
+ }
2688
+ else {
2689
+ this.commands.off('afterExec', doLiveAutocomplete);
2690
+ }
2691
+ },
2692
+ value: false
2693
+ },
2694
+ liveAutocompletionDelay: {
2695
+ initialValue: 0
2696
+ },
2697
+ liveAutocompletionThreshold: {
2698
+ initialValue: 0
2699
+ },
2700
+ enableSnippets: {
2701
+ set: function (val) {
2702
+ if (val) {
2703
+ this.commands.addCommand(expandSnippet);
2704
+ this.on("changeMode", onChangeMode);
2705
+ onChangeMode(null, this);
2706
+ }
2707
+ else {
2708
+ this.commands.removeCommand(expandSnippet);
2709
+ this.off("changeMode", onChangeMode);
2710
+ }
2711
+ },
2712
+ value: false
2713
+ }
2714
+ });
2715
+ exports.MarkerGroup = MarkerGroup;
2716
+
2717
+ }); (function() {
2718
+ ace.require(["ace/ext/language_tools"], function(m) {
2719
+ if (typeof module == "object" && typeof exports == "object" && module) {
2720
+ module.exports = m;
2721
+ }
2722
+ });
2723
+ })();
2724
+