@axdspub/axiom-ui-forms 0.2.7 → 0.2.9

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 (416) hide show
  1. package/library/axiom-ui-forms.d.ts +55 -6
  2. package/library/esm/_virtual/formats.js +4 -0
  3. package/library/esm/_virtual/formats.js.map +1 -0
  4. package/library/esm/_virtual/index.js +6 -2
  5. package/library/esm/_virtual/index.js.map +1 -1
  6. package/library/esm/_virtual/index10.js +2 -2
  7. package/library/esm/_virtual/index11.js +2 -2
  8. package/library/esm/_virtual/index12.js +6 -2
  9. package/library/esm/_virtual/index12.js.map +1 -1
  10. package/library/esm/_virtual/index13.js +8 -0
  11. package/library/esm/_virtual/index13.js.map +1 -0
  12. package/library/esm/_virtual/index14.js +4 -0
  13. package/library/esm/_virtual/index14.js.map +1 -0
  14. package/library/esm/_virtual/index15.js +4 -0
  15. package/library/esm/_virtual/index15.js.map +1 -0
  16. package/library/esm/_virtual/index16.js +4 -0
  17. package/library/esm/_virtual/index16.js.map +1 -0
  18. package/library/esm/_virtual/index17.js +4 -0
  19. package/library/esm/_virtual/index17.js.map +1 -0
  20. package/library/esm/_virtual/index2.js +2 -2
  21. package/library/esm/_virtual/index4.js +2 -2
  22. package/library/esm/_virtual/index4.js.map +1 -1
  23. package/library/esm/_virtual/index5.js +2 -2
  24. package/library/esm/_virtual/index6.js +2 -2
  25. package/library/esm/_virtual/index6.js.map +1 -1
  26. package/library/esm/_virtual/index7.js +2 -2
  27. package/library/esm/_virtual/index8.js +2 -2
  28. package/library/esm/_virtual/limit.js +4 -0
  29. package/library/esm/_virtual/limit.js.map +1 -0
  30. package/library/esm/_virtual/utilities.js +4 -0
  31. package/library/esm/_virtual/utilities.js.map +1 -0
  32. package/library/esm/node_modules/@axdspub/axiom-ui-utilities/library/index.js +241 -9
  33. package/library/esm/node_modules/@axdspub/axiom-ui-utilities/library/index.js.map +1 -1
  34. package/library/esm/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
  35. package/library/esm/node_modules/@babel/runtime/helpers/esm/extends.js.map +1 -0
  36. package/library/esm/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
  37. package/library/esm/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -0
  38. package/library/esm/node_modules/@codemirror/autocomplete/dist/index.js +1652 -0
  39. package/library/esm/node_modules/@codemirror/autocomplete/dist/index.js.map +1 -0
  40. package/library/esm/node_modules/@codemirror/commands/dist/index.js +1444 -0
  41. package/library/esm/node_modules/@codemirror/commands/dist/index.js.map +1 -0
  42. package/library/esm/node_modules/@codemirror/lang-json/dist/index.js +33 -0
  43. package/library/esm/node_modules/@codemirror/lang-json/dist/index.js.map +1 -0
  44. package/library/esm/node_modules/@codemirror/lang-yaml/dist/index.js +59 -0
  45. package/library/esm/node_modules/@codemirror/lang-yaml/dist/index.js.map +1 -0
  46. package/library/esm/node_modules/@codemirror/language/dist/index.js +1821 -0
  47. package/library/esm/node_modules/@codemirror/language/dist/index.js.map +1 -0
  48. package/library/esm/node_modules/@codemirror/lint/dist/index.js +589 -0
  49. package/library/esm/node_modules/@codemirror/lint/dist/index.js.map +1 -0
  50. package/library/esm/node_modules/@codemirror/search/dist/index.js +1227 -0
  51. package/library/esm/node_modules/@codemirror/search/dist/index.js.map +1 -0
  52. package/library/esm/node_modules/@codemirror/state/dist/index.js +3882 -0
  53. package/library/esm/node_modules/@codemirror/state/dist/index.js.map +1 -0
  54. package/library/esm/node_modules/@codemirror/theme-one-dark/dist/index.js +114 -0
  55. package/library/esm/node_modules/@codemirror/theme-one-dark/dist/index.js.map +1 -0
  56. package/library/esm/node_modules/@codemirror/view/dist/index.js +11052 -0
  57. package/library/esm/node_modules/@codemirror/view/dist/index.js.map +1 -0
  58. package/library/esm/node_modules/@lezer/common/dist/index.js +1704 -0
  59. package/library/esm/node_modules/@lezer/common/dist/index.js.map +1 -0
  60. package/library/esm/node_modules/@lezer/highlight/dist/index.js +876 -0
  61. package/library/esm/node_modules/@lezer/highlight/dist/index.js.map +1 -0
  62. package/library/esm/node_modules/@lezer/json/dist/index.js +38 -0
  63. package/library/esm/node_modules/@lezer/json/dist/index.js.map +1 -0
  64. package/library/esm/node_modules/@lezer/lr/dist/index.js +1855 -0
  65. package/library/esm/node_modules/@lezer/lr/dist/index.js.map +1 -0
  66. package/library/esm/node_modules/@lezer/yaml/dist/index.js +392 -0
  67. package/library/esm/node_modules/@lezer/yaml/dist/index.js.map +1 -0
  68. package/library/esm/node_modules/@marijn/find-cluster-break/src/index.js +83 -0
  69. package/library/esm/node_modules/@marijn/find-cluster-break/src/index.js.map +1 -0
  70. package/library/esm/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js +67 -1
  71. package/library/esm/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js.map +1 -1
  72. package/library/esm/node_modules/@uiw/codemirror-extensions-basic-setup/esm/index.js +100 -0
  73. package/library/esm/node_modules/@uiw/codemirror-extensions-basic-setup/esm/index.js.map +1 -0
  74. package/library/esm/node_modules/@uiw/react-codemirror/esm/getDefaultExtensions.js +58 -0
  75. package/library/esm/node_modules/@uiw/react-codemirror/esm/getDefaultExtensions.js.map +1 -0
  76. package/library/esm/node_modules/@uiw/react-codemirror/esm/index.js +89 -0
  77. package/library/esm/node_modules/@uiw/react-codemirror/esm/index.js.map +1 -0
  78. package/library/esm/node_modules/@uiw/react-codemirror/esm/theme/light.js +12 -0
  79. package/library/esm/node_modules/@uiw/react-codemirror/esm/theme/light.js.map +1 -0
  80. package/library/esm/node_modules/@uiw/react-codemirror/esm/useCodeMirror.js +151 -0
  81. package/library/esm/node_modules/@uiw/react-codemirror/esm/useCodeMirror.js.map +1 -0
  82. package/library/esm/node_modules/@uiw/react-codemirror/esm/utils.js +19 -0
  83. package/library/esm/node_modules/@uiw/react-codemirror/esm/utils.js.map +1 -0
  84. package/library/esm/node_modules/@ungap/structured-clone/esm/deserialize.js +77 -0
  85. package/library/esm/node_modules/@ungap/structured-clone/esm/deserialize.js.map +1 -0
  86. package/library/esm/node_modules/@ungap/structured-clone/esm/index.js +25 -0
  87. package/library/esm/node_modules/@ungap/structured-clone/esm/index.js.map +1 -0
  88. package/library/esm/node_modules/@ungap/structured-clone/esm/serialize.js +159 -0
  89. package/library/esm/node_modules/@ungap/structured-clone/esm/serialize.js.map +1 -0
  90. package/library/esm/node_modules/@ungap/structured-clone/esm/types.js +14 -0
  91. package/library/esm/node_modules/@ungap/structured-clone/esm/types.js.map +1 -0
  92. package/library/esm/node_modules/ajv/dist/compile/codegen/index.js +1 -1
  93. package/library/esm/node_modules/ajv/dist/compile/index.js +1 -1
  94. package/library/esm/node_modules/ajv/dist/vocabularies/applicator/index.js +1 -1
  95. package/library/esm/node_modules/ajv/dist/vocabularies/core/index.js +1 -1
  96. package/library/esm/node_modules/ajv/dist/vocabularies/discriminator/index.js +1 -1
  97. package/library/esm/node_modules/ajv/dist/vocabularies/validation/index.js +1 -1
  98. package/library/esm/node_modules/ajv-formats/dist/formats.js +221 -0
  99. package/library/esm/node_modules/ajv-formats/dist/formats.js.map +1 -0
  100. package/library/esm/node_modules/ajv-formats/dist/index.js +53 -0
  101. package/library/esm/node_modules/ajv-formats/dist/index.js.map +1 -0
  102. package/library/esm/node_modules/ajv-formats/dist/limit.js +84 -0
  103. package/library/esm/node_modules/ajv-formats/dist/limit.js.map +1 -0
  104. package/library/esm/node_modules/bail/index.js +15 -0
  105. package/library/esm/node_modules/bail/index.js.map +1 -0
  106. package/library/esm/node_modules/comma-separated-tokens/index.js +37 -0
  107. package/library/esm/node_modules/comma-separated-tokens/index.js.map +1 -0
  108. package/library/esm/node_modules/crelt/index.js +30 -0
  109. package/library/esm/node_modules/crelt/index.js.map +1 -0
  110. package/library/esm/node_modules/decode-named-character-reference/index.dom.js +39 -0
  111. package/library/esm/node_modules/decode-named-character-reference/index.dom.js.map +1 -0
  112. package/library/esm/node_modules/devlop/lib/default.js +6 -0
  113. package/library/esm/node_modules/devlop/lib/default.js.map +1 -0
  114. package/library/esm/node_modules/estree-util-is-identifier-name/lib/index.js +31 -0
  115. package/library/esm/node_modules/estree-util-is-identifier-name/lib/index.js.map +1 -0
  116. package/library/esm/node_modules/extend/index.js +127 -0
  117. package/library/esm/node_modules/extend/index.js.map +1 -0
  118. package/library/esm/node_modules/fast-uri/index.js +1 -1
  119. package/library/esm/node_modules/hast-util-to-jsx-runtime/lib/index.js +791 -0
  120. package/library/esm/node_modules/hast-util-to-jsx-runtime/lib/index.js.map +1 -0
  121. package/library/esm/node_modules/hast-util-whitespace/lib/index.js +37 -0
  122. package/library/esm/node_modules/hast-util-whitespace/lib/index.js.map +1 -0
  123. package/library/esm/node_modules/html-url-attributes/lib/index.js +34 -0
  124. package/library/esm/node_modules/html-url-attributes/lib/index.js.map +1 -0
  125. package/library/esm/node_modules/inline-style-parser/index.js +268 -0
  126. package/library/esm/node_modules/inline-style-parser/index.js.map +1 -0
  127. package/library/esm/node_modules/js-yaml/dist/js-yaml.js +3850 -0
  128. package/library/esm/node_modules/js-yaml/dist/js-yaml.js.map +1 -0
  129. package/library/esm/node_modules/json-schema-traverse/index.js +1 -1
  130. package/library/esm/node_modules/mdast-util-from-markdown/lib/index.js +1181 -0
  131. package/library/esm/node_modules/mdast-util-from-markdown/lib/index.js.map +1 -0
  132. package/library/esm/node_modules/mdast-util-to-hast/lib/footer.js +197 -0
  133. package/library/esm/node_modules/mdast-util-to-hast/lib/footer.js.map +1 -0
  134. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/blockquote.js +31 -0
  135. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/blockquote.js.map +1 -0
  136. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/break.js +27 -0
  137. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/break.js.map +1 -0
  138. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/code.js +51 -0
  139. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/code.js.map +1 -0
  140. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/delete.js +31 -0
  141. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/delete.js.map +1 -0
  142. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/emphasis.js +31 -0
  143. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/emphasis.js.map +1 -0
  144. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js +74 -0
  145. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js.map +1 -0
  146. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/heading.js +31 -0
  147. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/heading.js.map +1 -0
  148. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/html.js +32 -0
  149. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/html.js.map +1 -0
  150. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/image-reference.js +45 -0
  151. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/image-reference.js.map +1 -0
  152. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/image.js +40 -0
  153. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/image.js.map +1 -0
  154. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/index.js +67 -0
  155. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/index.js.map +1 -0
  156. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/inline-code.js +36 -0
  157. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/inline-code.js.map +1 -0
  158. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/link-reference.js +50 -0
  159. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/link-reference.js.map +1 -0
  160. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/link.js +41 -0
  161. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/link.js.map +1 -0
  162. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/list-item.js +126 -0
  163. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/list-item.js.map +1 -0
  164. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/list.js +57 -0
  165. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/list.js.map +1 -0
  166. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/paragraph.js +31 -0
  167. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/paragraph.js.map +1 -0
  168. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/root.js +27 -0
  169. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/root.js.map +1 -0
  170. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/strong.js +31 -0
  171. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/strong.js.map +1 -0
  172. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/table-cell.js +33 -0
  173. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/table-cell.js.map +1 -0
  174. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/table-row.js +70 -0
  175. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/table-row.js.map +1 -0
  176. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/table.js +65 -0
  177. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/table.js.map +1 -0
  178. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/text.js +29 -0
  179. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/text.js.map +1 -0
  180. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js +31 -0
  181. package/library/esm/node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js.map +1 -0
  182. package/library/esm/node_modules/mdast-util-to-hast/lib/index.js +105 -0
  183. package/library/esm/node_modules/mdast-util-to-hast/lib/index.js.map +1 -0
  184. package/library/esm/node_modules/mdast-util-to-hast/lib/revert.js +56 -0
  185. package/library/esm/node_modules/mdast-util-to-hast/lib/revert.js.map +1 -0
  186. package/library/esm/node_modules/mdast-util-to-hast/lib/state.js +322 -0
  187. package/library/esm/node_modules/mdast-util-to-hast/lib/state.js.map +1 -0
  188. package/library/esm/node_modules/mdast-util-to-string/lib/index.js +111 -0
  189. package/library/esm/node_modules/mdast-util-to-string/lib/index.js.map +1 -0
  190. package/library/esm/node_modules/micromark/lib/constructs.js +108 -0
  191. package/library/esm/node_modules/micromark/lib/constructs.js.map +1 -0
  192. package/library/esm/node_modules/micromark/lib/create-tokenizer.js +576 -0
  193. package/library/esm/node_modules/micromark/lib/create-tokenizer.js.map +1 -0
  194. package/library/esm/node_modules/micromark/lib/initialize/content.js +83 -0
  195. package/library/esm/node_modules/micromark/lib/initialize/content.js.map +1 -0
  196. package/library/esm/node_modules/micromark/lib/initialize/document.js +361 -0
  197. package/library/esm/node_modules/micromark/lib/initialize/document.js.map +1 -0
  198. package/library/esm/node_modules/micromark/lib/initialize/flow.js +62 -0
  199. package/library/esm/node_modules/micromark/lib/initialize/flow.js.map +1 -0
  200. package/library/esm/node_modules/micromark/lib/initialize/text.js +213 -0
  201. package/library/esm/node_modules/micromark/lib/initialize/text.js.map +1 -0
  202. package/library/esm/node_modules/micromark/lib/parse.js +60 -0
  203. package/library/esm/node_modules/micromark/lib/parse.js.map +1 -0
  204. package/library/esm/node_modules/micromark/lib/postprocess.js +22 -0
  205. package/library/esm/node_modules/micromark/lib/postprocess.js.map +1 -0
  206. package/library/esm/node_modules/micromark/lib/preprocess.js +118 -0
  207. package/library/esm/node_modules/micromark/lib/preprocess.js.map +1 -0
  208. package/library/esm/node_modules/micromark-core-commonmark/lib/attention.js +245 -0
  209. package/library/esm/node_modules/micromark-core-commonmark/lib/attention.js.map +1 -0
  210. package/library/esm/node_modules/micromark-core-commonmark/lib/autolink.js +237 -0
  211. package/library/esm/node_modules/micromark-core-commonmark/lib/autolink.js.map +1 -0
  212. package/library/esm/node_modules/micromark-core-commonmark/lib/blank-line.js +65 -0
  213. package/library/esm/node_modules/micromark-core-commonmark/lib/blank-line.js.map +1 -0
  214. package/library/esm/node_modules/micromark-core-commonmark/lib/block-quote.js +147 -0
  215. package/library/esm/node_modules/micromark-core-commonmark/lib/block-quote.js.map +1 -0
  216. package/library/esm/node_modules/micromark-core-commonmark/lib/character-escape.js +68 -0
  217. package/library/esm/node_modules/micromark-core-commonmark/lib/character-escape.js.map +1 -0
  218. package/library/esm/node_modules/micromark-core-commonmark/lib/character-reference.js +153 -0
  219. package/library/esm/node_modules/micromark-core-commonmark/lib/character-reference.js.map +1 -0
  220. package/library/esm/node_modules/micromark-core-commonmark/lib/code-fenced.js +464 -0
  221. package/library/esm/node_modules/micromark-core-commonmark/lib/code-fenced.js.map +1 -0
  222. package/library/esm/node_modules/micromark-core-commonmark/lib/code-indented.js +181 -0
  223. package/library/esm/node_modules/micromark-core-commonmark/lib/code-indented.js.map +1 -0
  224. package/library/esm/node_modules/micromark-core-commonmark/lib/code-text.js +228 -0
  225. package/library/esm/node_modules/micromark-core-commonmark/lib/code-text.js.map +1 -0
  226. package/library/esm/node_modules/micromark-core-commonmark/lib/content.js +167 -0
  227. package/library/esm/node_modules/micromark-core-commonmark/lib/content.js.map +1 -0
  228. package/library/esm/node_modules/micromark-core-commonmark/lib/definition.js +258 -0
  229. package/library/esm/node_modules/micromark-core-commonmark/lib/definition.js.map +1 -0
  230. package/library/esm/node_modules/micromark-core-commonmark/lib/hard-break-escape.js +64 -0
  231. package/library/esm/node_modules/micromark-core-commonmark/lib/hard-break-escape.js.map +1 -0
  232. package/library/esm/node_modules/micromark-core-commonmark/lib/heading-atx.js +199 -0
  233. package/library/esm/node_modules/micromark-core-commonmark/lib/heading-atx.js.map +1 -0
  234. package/library/esm/node_modules/micromark-core-commonmark/lib/html-flow.js +880 -0
  235. package/library/esm/node_modules/micromark-core-commonmark/lib/html-flow.js.map +1 -0
  236. package/library/esm/node_modules/micromark-core-commonmark/lib/html-text.js +682 -0
  237. package/library/esm/node_modules/micromark-core-commonmark/lib/html-text.js.map +1 -0
  238. package/library/esm/node_modules/micromark-core-commonmark/lib/label-end.js +564 -0
  239. package/library/esm/node_modules/micromark-core-commonmark/lib/label-end.js.map +1 -0
  240. package/library/esm/node_modules/micromark-core-commonmark/lib/label-start-image.js +106 -0
  241. package/library/esm/node_modules/micromark-core-commonmark/lib/label-start-image.js.map +1 -0
  242. package/library/esm/node_modules/micromark-core-commonmark/lib/label-start-link.js +59 -0
  243. package/library/esm/node_modules/micromark-core-commonmark/lib/label-start-link.js.map +1 -0
  244. package/library/esm/node_modules/micromark-core-commonmark/lib/line-ending.js +36 -0
  245. package/library/esm/node_modules/micromark-core-commonmark/lib/line-ending.js.map +1 -0
  246. package/library/esm/node_modules/micromark-core-commonmark/lib/list.js +217 -0
  247. package/library/esm/node_modules/micromark-core-commonmark/lib/list.js.map +1 -0
  248. package/library/esm/node_modules/micromark-core-commonmark/lib/setext-underline.js +189 -0
  249. package/library/esm/node_modules/micromark-core-commonmark/lib/setext-underline.js.map +1 -0
  250. package/library/esm/node_modules/micromark-core-commonmark/lib/thematic-break.js +106 -0
  251. package/library/esm/node_modules/micromark-core-commonmark/lib/thematic-break.js.map +1 -0
  252. package/library/esm/node_modules/micromark-factory-destination/index.js +210 -0
  253. package/library/esm/node_modules/micromark-factory-destination/index.js.map +1 -0
  254. package/library/esm/node_modules/micromark-factory-label/index.js +152 -0
  255. package/library/esm/node_modules/micromark-factory-label/index.js.map +1 -0
  256. package/library/esm/node_modules/micromark-factory-space/index.js +68 -0
  257. package/library/esm/node_modules/micromark-factory-space/index.js.map +1 -0
  258. package/library/esm/node_modules/micromark-factory-title/index.js +162 -0
  259. package/library/esm/node_modules/micromark-factory-title/index.js.map +1 -0
  260. package/library/esm/node_modules/micromark-factory-whitespace/index.js +48 -0
  261. package/library/esm/node_modules/micromark-factory-whitespace/index.js.map +1 -0
  262. package/library/esm/node_modules/micromark-util-character/index.js +249 -0
  263. package/library/esm/node_modules/micromark-util-character/index.js.map +1 -0
  264. package/library/esm/node_modules/micromark-util-chunked/index.js +84 -0
  265. package/library/esm/node_modules/micromark-util-chunked/index.js.map +1 -0
  266. package/library/esm/node_modules/micromark-util-classify-character/index.js +31 -0
  267. package/library/esm/node_modules/micromark-util-classify-character/index.js.map +1 -0
  268. package/library/esm/node_modules/micromark-util-combine-extensions/index.js +96 -0
  269. package/library/esm/node_modules/micromark-util-combine-extensions/index.js.map +1 -0
  270. package/library/esm/node_modules/micromark-util-decode-numeric-character-reference/index.js +35 -0
  271. package/library/esm/node_modules/micromark-util-decode-numeric-character-reference/index.js.map +1 -0
  272. package/library/esm/node_modules/micromark-util-decode-string/index.js +49 -0
  273. package/library/esm/node_modules/micromark-util-decode-string/index.js.map +1 -0
  274. package/library/esm/node_modules/micromark-util-html-tag-name/index.js +96 -0
  275. package/library/esm/node_modules/micromark-util-html-tag-name/index.js.map +1 -0
  276. package/library/esm/node_modules/micromark-util-normalize-identifier/index.js +36 -0
  277. package/library/esm/node_modules/micromark-util-normalize-identifier/index.js.map +1 -0
  278. package/library/esm/node_modules/micromark-util-resolve-all/index.js +35 -0
  279. package/library/esm/node_modules/micromark-util-resolve-all/index.js.map +1 -0
  280. package/library/esm/node_modules/micromark-util-sanitize-uri/index.js +67 -0
  281. package/library/esm/node_modules/micromark-util-sanitize-uri/index.js.map +1 -0
  282. package/library/esm/node_modules/micromark-util-subtokenize/index.js +227 -0
  283. package/library/esm/node_modules/micromark-util-subtokenize/index.js.map +1 -0
  284. package/library/esm/node_modules/micromark-util-subtokenize/lib/splice-buffer.js +254 -0
  285. package/library/esm/node_modules/micromark-util-subtokenize/lib/splice-buffer.js.map +1 -0
  286. package/library/esm/node_modules/property-information/index.js +16 -0
  287. package/library/esm/node_modules/property-information/index.js.map +1 -0
  288. package/library/esm/node_modules/property-information/lib/aria.js +64 -0
  289. package/library/esm/node_modules/property-information/lib/aria.js.map +1 -0
  290. package/library/esm/node_modules/property-information/lib/find.js +101 -0
  291. package/library/esm/node_modules/property-information/lib/find.js.map +1 -0
  292. package/library/esm/node_modules/property-information/lib/hast-to-react.js +33 -0
  293. package/library/esm/node_modules/property-information/lib/hast-to-react.js.map +1 -0
  294. package/library/esm/node_modules/property-information/lib/html.js +318 -0
  295. package/library/esm/node_modules/property-information/lib/html.js.map +1 -0
  296. package/library/esm/node_modules/property-information/lib/normalize.js +15 -0
  297. package/library/esm/node_modules/property-information/lib/normalize.js.map +1 -0
  298. package/library/esm/node_modules/property-information/lib/svg.js +564 -0
  299. package/library/esm/node_modules/property-information/lib/svg.js.map +1 -0
  300. package/library/esm/node_modules/property-information/lib/util/case-insensitive-transform.js +16 -0
  301. package/library/esm/node_modules/property-information/lib/util/case-insensitive-transform.js.map +1 -0
  302. package/library/esm/node_modules/property-information/lib/util/case-sensitive-transform.js +14 -0
  303. package/library/esm/node_modules/property-information/lib/util/case-sensitive-transform.js.map +1 -0
  304. package/library/esm/node_modules/property-information/lib/util/create.js +47 -0
  305. package/library/esm/node_modules/property-information/lib/util/create.js.map +1 -0
  306. package/library/esm/node_modules/property-information/lib/util/defined-info.js +64 -0
  307. package/library/esm/node_modules/property-information/lib/util/defined-info.js.map +1 -0
  308. package/library/esm/node_modules/property-information/lib/util/info.js +35 -0
  309. package/library/esm/node_modules/property-information/lib/util/info.js.map +1 -0
  310. package/library/esm/node_modules/property-information/lib/util/merge.js +31 -0
  311. package/library/esm/node_modules/property-information/lib/util/merge.js.map +1 -0
  312. package/library/esm/node_modules/property-information/lib/util/schema.js +32 -0
  313. package/library/esm/node_modules/property-information/lib/util/schema.js.map +1 -0
  314. package/library/esm/node_modules/property-information/lib/util/types.js +16 -0
  315. package/library/esm/node_modules/property-information/lib/util/types.js.map +1 -0
  316. package/library/esm/node_modules/property-information/lib/xlink.js +20 -0
  317. package/library/esm/node_modules/property-information/lib/xlink.js.map +1 -0
  318. package/library/esm/node_modules/property-information/lib/xml.js +12 -0
  319. package/library/esm/node_modules/property-information/lib/xml.js.map +1 -0
  320. package/library/esm/node_modules/property-information/lib/xmlns.js +12 -0
  321. package/library/esm/node_modules/property-information/lib/xmlns.js.map +1 -0
  322. package/library/esm/node_modules/react-markdown/lib/index.js +267 -0
  323. package/library/esm/node_modules/react-markdown/lib/index.js.map +1 -0
  324. package/library/esm/node_modules/react-router/dist/development/chunk-HA7DTUK3.js +1 -1
  325. package/library/esm/node_modules/react-router/node_modules/cookie/dist/index.js +1 -1
  326. package/library/esm/node_modules/remark-parse/lib/index.js +43 -0
  327. package/library/esm/node_modules/remark-parse/lib/index.js.map +1 -0
  328. package/library/esm/node_modules/remark-rehype/lib/index.js +132 -0
  329. package/library/esm/node_modules/remark-rehype/lib/index.js.map +1 -0
  330. package/library/esm/node_modules/space-separated-tokens/index.js +23 -0
  331. package/library/esm/node_modules/space-separated-tokens/index.js.map +1 -0
  332. package/library/esm/node_modules/style-mod/src/style-mod.js +175 -0
  333. package/library/esm/node_modules/style-mod/src/style-mod.js.map +1 -0
  334. package/library/esm/node_modules/style-to-js/cjs/index.js +38 -0
  335. package/library/esm/node_modules/style-to-js/cjs/index.js.map +1 -0
  336. package/library/esm/node_modules/style-to-js/cjs/utilities.js +58 -0
  337. package/library/esm/node_modules/style-to-js/cjs/utilities.js.map +1 -0
  338. package/library/esm/node_modules/style-to-object/cjs/index.js +56 -0
  339. package/library/esm/node_modules/style-to-object/cjs/index.js.map +1 -0
  340. package/library/esm/node_modules/trim-lines/index.js +72 -0
  341. package/library/esm/node_modules/trim-lines/index.js.map +1 -0
  342. package/library/esm/node_modules/trough/lib/index.js +209 -0
  343. package/library/esm/node_modules/trough/lib/index.js.map +1 -0
  344. package/library/esm/node_modules/unified/lib/callable-instance.js +47 -0
  345. package/library/esm/node_modules/unified/lib/callable-instance.js.map +1 -0
  346. package/library/esm/node_modules/unified/lib/index.js +979 -0
  347. package/library/esm/node_modules/unified/lib/index.js.map +1 -0
  348. package/library/esm/node_modules/unified/node_modules/is-plain-obj/index.js +11 -0
  349. package/library/esm/node_modules/unified/node_modules/is-plain-obj/index.js.map +1 -0
  350. package/library/esm/node_modules/unist-util-is/lib/index.js +179 -0
  351. package/library/esm/node_modules/unist-util-is/lib/index.js.map +1 -0
  352. package/library/esm/node_modules/unist-util-position/lib/index.js +98 -0
  353. package/library/esm/node_modules/unist-util-position/lib/index.js.map +1 -0
  354. package/library/esm/node_modules/unist-util-stringify-position/lib/index.js +87 -0
  355. package/library/esm/node_modules/unist-util-stringify-position/lib/index.js.map +1 -0
  356. package/library/esm/node_modules/unist-util-visit/lib/index.js +95 -0
  357. package/library/esm/node_modules/unist-util-visit/lib/index.js.map +1 -0
  358. package/library/esm/node_modules/unist-util-visit-parents/lib/color.js +10 -0
  359. package/library/esm/node_modules/unist-util-visit-parents/lib/color.js.map +1 -0
  360. package/library/esm/node_modules/unist-util-visit-parents/lib/index.js +188 -0
  361. package/library/esm/node_modules/unist-util-visit-parents/lib/index.js.map +1 -0
  362. package/library/esm/node_modules/vfile/lib/index.js +644 -0
  363. package/library/esm/node_modules/vfile/lib/index.js.map +1 -0
  364. package/library/esm/node_modules/vfile/lib/minpath.browser.js +427 -0
  365. package/library/esm/node_modules/vfile/lib/minpath.browser.js.map +1 -0
  366. package/library/esm/node_modules/vfile/lib/minproc.browser.js +11 -0
  367. package/library/esm/node_modules/vfile/lib/minproc.browser.js.map +1 -0
  368. package/library/esm/node_modules/vfile/lib/minurl.browser.js +77 -0
  369. package/library/esm/node_modules/vfile/lib/minurl.browser.js.map +1 -0
  370. package/library/esm/node_modules/vfile/lib/minurl.shared.js +34 -0
  371. package/library/esm/node_modules/vfile/lib/minurl.shared.js.map +1 -0
  372. package/library/esm/node_modules/vfile-message/lib/index.js +305 -0
  373. package/library/esm/node_modules/vfile-message/lib/index.js.map +1 -0
  374. package/library/esm/node_modules/w3c-keyname/index.js +122 -0
  375. package/library/esm/node_modules/w3c-keyname/index.js.map +1 -0
  376. package/library/esm/src/Form/Components/FieldCreator.js +0 -1
  377. package/library/esm/src/Form/Components/FieldCreator.js.map +1 -1
  378. package/library/esm/src/Form/Components/FieldLabel.js +13 -3
  379. package/library/esm/src/Form/Components/FieldLabel.js.map +1 -1
  380. package/library/esm/src/Form/Components/InlineMarkdown.js +15 -0
  381. package/library/esm/src/Form/Components/InlineMarkdown.js.map +1 -0
  382. package/library/esm/src/Form/Components/Inputs/Boolean.js +5 -2
  383. package/library/esm/src/Form/Components/Inputs/Boolean.js.map +1 -1
  384. package/library/esm/src/Form/Components/Inputs/Constant.js +18 -0
  385. package/library/esm/src/Form/Components/Inputs/Constant.js.map +1 -0
  386. package/library/esm/src/Form/Components/Inputs/GeoJSONInputLoader.js +1 -1
  387. package/library/esm/src/Form/Components/Inputs/Geometry.js +290 -329
  388. package/library/esm/src/Form/Components/Inputs/Geometry.js.map +1 -1
  389. package/library/esm/src/Form/Components/Inputs/JSON.js +132 -0
  390. package/library/esm/src/Form/Components/Inputs/JSON.js.map +1 -0
  391. package/library/esm/src/Form/Components/Inputs/JSONInputLoader.js +19 -0
  392. package/library/esm/src/Form/Components/Inputs/JSONInputLoader.js.map +1 -0
  393. package/library/esm/src/Form/Components/Inputs/Number.js +78 -8
  394. package/library/esm/src/Form/Components/Inputs/Number.js.map +1 -1
  395. package/library/esm/src/Form/Components/Inputs/OneOfInput.js +9 -0
  396. package/library/esm/src/Form/Components/Inputs/OneOfInput.js.map +1 -0
  397. package/library/esm/src/Form/Components/Inputs/String.js +9 -3
  398. package/library/esm/src/Form/Components/Inputs/String.js.map +1 -1
  399. package/library/esm/src/Form/Components/Inputs/inputMap.js +7 -3
  400. package/library/esm/src/Form/Components/Inputs/inputMap.js.map +1 -1
  401. package/library/esm/src/Form/Creator/FormCreator.js +42 -49
  402. package/library/esm/src/Form/Creator/FormCreator.js.map +1 -1
  403. package/library/esm/src/Form/Creator/FormHeader.js +7 -5
  404. package/library/esm/src/Form/Creator/FormHeader.js.map +1 -1
  405. package/library/esm/src/Form/Creator/Page.js +4 -3
  406. package/library/esm/src/Form/Creator/Page.js.map +1 -1
  407. package/library/esm/src/Form/Manage/CopyableJSONOutput.js +41 -0
  408. package/library/esm/src/Form/Manage/CopyableJSONOutput.js.map +1 -0
  409. package/library/esm/src/Form/helpers.js +12 -2
  410. package/library/esm/src/Form/helpers.js.map +1 -1
  411. package/library/esm/src/Form/schemaToFormHelpers.js +209 -18
  412. package/library/esm/src/Form/schemaToFormHelpers.js.map +1 -1
  413. package/library/esm/src/library.js +2 -2
  414. package/package.json +8 -1
  415. package/library/esm/src/Form/Components/Inputs/JSONString.js +0 -34
  416. package/library/esm/src/Form/Components/Inputs/JSONString.js.map +0 -1
@@ -0,0 +1,1652 @@
1
+ import { Prec, StateField, Facet, combineConfig, StateEffect, Annotation, EditorSelection, codePointAt, codePointSize, fromCodePoint, RangeSet, MapMode, RangeValue, CharCategory } from '../../state/dist/index.js';
2
+ import { ViewPlugin, EditorView, showTooltip, logException, getTooltip, keymap, Direction } from '../../view/dist/index.js';
3
+ import { syntaxTree } from '../../language/dist/index.js';
4
+
5
+ /**
6
+ An instance of this is passed to completion source functions.
7
+ */
8
+ class CompletionContext {
9
+ /**
10
+ Create a new completion context. (Mostly useful for testing
11
+ completion sources—in the editor, the extension will create
12
+ these for you.)
13
+ */
14
+ constructor(
15
+ /**
16
+ The editor state that the completion happens in.
17
+ */
18
+ state,
19
+ /**
20
+ The position at which the completion is happening.
21
+ */
22
+ pos,
23
+ /**
24
+ Indicates whether completion was activated explicitly, or
25
+ implicitly by typing. The usual way to respond to this is to
26
+ only return completions when either there is part of a
27
+ completable entity before the cursor, or `explicit` is true.
28
+ */
29
+ explicit,
30
+ /**
31
+ The editor view. May be undefined if the context was created
32
+ in a situation where there is no such view available, such as
33
+ in synchronous updates via
34
+ [`CompletionResult.update`](https://codemirror.net/6/docs/ref/#autocomplete.CompletionResult.update)
35
+ or when called by test code.
36
+ */
37
+ view) {
38
+ this.state = state;
39
+ this.pos = pos;
40
+ this.explicit = explicit;
41
+ this.view = view;
42
+ /**
43
+ @internal
44
+ */
45
+ this.abortListeners = [];
46
+ /**
47
+ @internal
48
+ */
49
+ this.abortOnDocChange = false;
50
+ }
51
+ /**
52
+ Get the extent, content, and (if there is a token) type of the
53
+ token before `this.pos`.
54
+ */
55
+ tokenBefore(types) {
56
+ let token = syntaxTree(this.state).resolveInner(this.pos, -1);
57
+ while (token && types.indexOf(token.name) < 0)
58
+ token = token.parent;
59
+ return token ? { from: token.from, to: this.pos,
60
+ text: this.state.sliceDoc(token.from, this.pos),
61
+ type: token.type } : null;
62
+ }
63
+ /**
64
+ Get the match of the given expression directly before the
65
+ cursor.
66
+ */
67
+ matchBefore(expr) {
68
+ let line = this.state.doc.lineAt(this.pos);
69
+ let start = Math.max(line.from, this.pos - 250);
70
+ let str = line.text.slice(start - line.from, this.pos - line.from);
71
+ let found = str.search(ensureAnchor(expr, false));
72
+ return found < 0 ? null : { from: start + found, to: this.pos, text: str.slice(found) };
73
+ }
74
+ /**
75
+ Yields true when the query has been aborted. Can be useful in
76
+ asynchronous queries to avoid doing work that will be ignored.
77
+ */
78
+ get aborted() { return this.abortListeners == null; }
79
+ /**
80
+ Allows you to register abort handlers, which will be called when
81
+ the query is
82
+ [aborted](https://codemirror.net/6/docs/ref/#autocomplete.CompletionContext.aborted).
83
+
84
+ By default, running queries will not be aborted for regular
85
+ typing or backspacing, on the assumption that they are likely to
86
+ return a result with a
87
+ [`validFor`](https://codemirror.net/6/docs/ref/#autocomplete.CompletionResult.validFor) field that
88
+ allows the result to be used after all. Passing `onDocChange:
89
+ true` will cause this query to be aborted for any document
90
+ change.
91
+ */
92
+ addEventListener(type, listener, options) {
93
+ if (type == "abort" && this.abortListeners) {
94
+ this.abortListeners.push(listener);
95
+ if (options && options.onDocChange)
96
+ this.abortOnDocChange = true;
97
+ }
98
+ }
99
+ }
100
+ function toSet(chars) {
101
+ let flat = Object.keys(chars).join("");
102
+ let words = /\w/.test(flat);
103
+ if (words)
104
+ flat = flat.replace(/\w/g, "");
105
+ return `[${words ? "\\w" : ""}${flat.replace(/[^\w\s]/g, "\\$&")}]`;
106
+ }
107
+ function prefixMatch(options) {
108
+ let first = Object.create(null), rest = Object.create(null);
109
+ for (let { label } of options) {
110
+ first[label[0]] = true;
111
+ for (let i = 1; i < label.length; i++)
112
+ rest[label[i]] = true;
113
+ }
114
+ let source = toSet(first) + toSet(rest) + "*$";
115
+ return [new RegExp("^" + source), new RegExp(source)];
116
+ }
117
+ /**
118
+ Given a a fixed array of options, return an autocompleter that
119
+ completes them.
120
+ */
121
+ function completeFromList(list) {
122
+ let options = list.map(o => typeof o == "string" ? { label: o } : o);
123
+ let [validFor, match] = options.every(o => /^\w+$/.test(o.label)) ? [/\w*$/, /\w+$/] : prefixMatch(options);
124
+ return (context) => {
125
+ let token = context.matchBefore(match);
126
+ return token || context.explicit ? { from: token ? token.from : context.pos, options, validFor } : null;
127
+ };
128
+ }
129
+ class Option {
130
+ constructor(completion, source, match, score) {
131
+ this.completion = completion;
132
+ this.source = source;
133
+ this.match = match;
134
+ this.score = score;
135
+ }
136
+ }
137
+ function cur(state) { return state.selection.main.from; }
138
+ // Make sure the given regexp has a $ at its end and, if `start` is
139
+ // true, a ^ at its start.
140
+ function ensureAnchor(expr, start) {
141
+ var _a;
142
+ let { source } = expr;
143
+ let addStart = start && source[0] != "^", addEnd = source[source.length - 1] != "$";
144
+ if (!addStart && !addEnd)
145
+ return expr;
146
+ return new RegExp(`${addStart ? "^" : ""}(?:${source})${addEnd ? "$" : ""}`, (_a = expr.flags) !== null && _a !== void 0 ? _a : (expr.ignoreCase ? "i" : ""));
147
+ }
148
+ /**
149
+ This annotation is added to transactions that are produced by
150
+ picking a completion.
151
+ */
152
+ const pickedCompletion = /*@__PURE__*/Annotation.define();
153
+ /**
154
+ Helper function that returns a transaction spec which inserts a
155
+ completion's text in the main selection range, and any other
156
+ selection range that has the same text in front of it.
157
+ */
158
+ function insertCompletionText(state, text, from, to) {
159
+ let { main } = state.selection, fromOff = from - main.from, toOff = to - main.from;
160
+ return Object.assign(Object.assign({}, state.changeByRange(range => {
161
+ if (range != main && from != to &&
162
+ state.sliceDoc(range.from + fromOff, range.from + toOff) != state.sliceDoc(from, to))
163
+ return { range };
164
+ let lines = state.toText(text);
165
+ return {
166
+ changes: { from: range.from + fromOff, to: to == main.from ? range.to : range.from + toOff, insert: lines },
167
+ range: EditorSelection.cursor(range.from + fromOff + lines.length)
168
+ };
169
+ })), { scrollIntoView: true, userEvent: "input.complete" });
170
+ }
171
+ const SourceCache = /*@__PURE__*/new WeakMap();
172
+ function asSource(source) {
173
+ if (!Array.isArray(source))
174
+ return source;
175
+ let known = SourceCache.get(source);
176
+ if (!known)
177
+ SourceCache.set(source, known = completeFromList(source));
178
+ return known;
179
+ }
180
+ const startCompletionEffect = /*@__PURE__*/StateEffect.define();
181
+ const closeCompletionEffect = /*@__PURE__*/StateEffect.define();
182
+
183
+ // A pattern matcher for fuzzy completion matching. Create an instance
184
+ // once for a pattern, and then use that to match any number of
185
+ // completions.
186
+ class FuzzyMatcher {
187
+ constructor(pattern) {
188
+ this.pattern = pattern;
189
+ this.chars = [];
190
+ this.folded = [];
191
+ // Buffers reused by calls to `match` to track matched character
192
+ // positions.
193
+ this.any = [];
194
+ this.precise = [];
195
+ this.byWord = [];
196
+ this.score = 0;
197
+ this.matched = [];
198
+ for (let p = 0; p < pattern.length;) {
199
+ let char = codePointAt(pattern, p), size = codePointSize(char);
200
+ this.chars.push(char);
201
+ let part = pattern.slice(p, p + size), upper = part.toUpperCase();
202
+ this.folded.push(codePointAt(upper == part ? part.toLowerCase() : upper, 0));
203
+ p += size;
204
+ }
205
+ this.astral = pattern.length != this.chars.length;
206
+ }
207
+ ret(score, matched) {
208
+ this.score = score;
209
+ this.matched = matched;
210
+ return this;
211
+ }
212
+ // Matches a given word (completion) against the pattern (input).
213
+ // Will return a boolean indicating whether there was a match and,
214
+ // on success, set `this.score` to the score, `this.matched` to an
215
+ // array of `from, to` pairs indicating the matched parts of `word`.
216
+ //
217
+ // The score is a number that is more negative the worse the match
218
+ // is. See `Penalty` above.
219
+ match(word) {
220
+ if (this.pattern.length == 0)
221
+ return this.ret(-100 /* Penalty.NotFull */, []);
222
+ if (word.length < this.pattern.length)
223
+ return null;
224
+ let { chars, folded, any, precise, byWord } = this;
225
+ // For single-character queries, only match when they occur right
226
+ // at the start
227
+ if (chars.length == 1) {
228
+ let first = codePointAt(word, 0), firstSize = codePointSize(first);
229
+ let score = firstSize == word.length ? 0 : -100 /* Penalty.NotFull */;
230
+ if (first == chars[0]) ;
231
+ else if (first == folded[0])
232
+ score += -200 /* Penalty.CaseFold */;
233
+ else
234
+ return null;
235
+ return this.ret(score, [0, firstSize]);
236
+ }
237
+ let direct = word.indexOf(this.pattern);
238
+ if (direct == 0)
239
+ return this.ret(word.length == this.pattern.length ? 0 : -100 /* Penalty.NotFull */, [0, this.pattern.length]);
240
+ let len = chars.length, anyTo = 0;
241
+ if (direct < 0) {
242
+ for (let i = 0, e = Math.min(word.length, 200); i < e && anyTo < len;) {
243
+ let next = codePointAt(word, i);
244
+ if (next == chars[anyTo] || next == folded[anyTo])
245
+ any[anyTo++] = i;
246
+ i += codePointSize(next);
247
+ }
248
+ // No match, exit immediately
249
+ if (anyTo < len)
250
+ return null;
251
+ }
252
+ // This tracks the extent of the precise (non-folded, not
253
+ // necessarily adjacent) match
254
+ let preciseTo = 0;
255
+ // Tracks whether there is a match that hits only characters that
256
+ // appear to be starting words. `byWordFolded` is set to true when
257
+ // a case folded character is encountered in such a match
258
+ let byWordTo = 0, byWordFolded = false;
259
+ // If we've found a partial adjacent match, these track its state
260
+ let adjacentTo = 0, adjacentStart = -1, adjacentEnd = -1;
261
+ let hasLower = /[a-z]/.test(word), wordAdjacent = true;
262
+ // Go over the option's text, scanning for the various kinds of matches
263
+ for (let i = 0, e = Math.min(word.length, 200), prevType = 0 /* Tp.NonWord */; i < e && byWordTo < len;) {
264
+ let next = codePointAt(word, i);
265
+ if (direct < 0) {
266
+ if (preciseTo < len && next == chars[preciseTo])
267
+ precise[preciseTo++] = i;
268
+ if (adjacentTo < len) {
269
+ if (next == chars[adjacentTo] || next == folded[adjacentTo]) {
270
+ if (adjacentTo == 0)
271
+ adjacentStart = i;
272
+ adjacentEnd = i + 1;
273
+ adjacentTo++;
274
+ }
275
+ else {
276
+ adjacentTo = 0;
277
+ }
278
+ }
279
+ }
280
+ let ch, type = next < 0xff
281
+ ? (next >= 48 && next <= 57 || next >= 97 && next <= 122 ? 2 /* Tp.Lower */ : next >= 65 && next <= 90 ? 1 /* Tp.Upper */ : 0 /* Tp.NonWord */)
282
+ : ((ch = fromCodePoint(next)) != ch.toLowerCase() ? 1 /* Tp.Upper */ : ch != ch.toUpperCase() ? 2 /* Tp.Lower */ : 0 /* Tp.NonWord */);
283
+ if (!i || type == 1 /* Tp.Upper */ && hasLower || prevType == 0 /* Tp.NonWord */ && type != 0 /* Tp.NonWord */) {
284
+ if (chars[byWordTo] == next || (folded[byWordTo] == next && (byWordFolded = true)))
285
+ byWord[byWordTo++] = i;
286
+ else if (byWord.length)
287
+ wordAdjacent = false;
288
+ }
289
+ prevType = type;
290
+ i += codePointSize(next);
291
+ }
292
+ if (byWordTo == len && byWord[0] == 0 && wordAdjacent)
293
+ return this.result(-100 /* Penalty.ByWord */ + (byWordFolded ? -200 /* Penalty.CaseFold */ : 0), byWord, word);
294
+ if (adjacentTo == len && adjacentStart == 0)
295
+ return this.ret(-200 /* Penalty.CaseFold */ - word.length + (adjacentEnd == word.length ? 0 : -100 /* Penalty.NotFull */), [0, adjacentEnd]);
296
+ if (direct > -1)
297
+ return this.ret(-700 /* Penalty.NotStart */ - word.length, [direct, direct + this.pattern.length]);
298
+ if (adjacentTo == len)
299
+ return this.ret(-200 /* Penalty.CaseFold */ + -700 /* Penalty.NotStart */ - word.length, [adjacentStart, adjacentEnd]);
300
+ if (byWordTo == len)
301
+ return this.result(-100 /* Penalty.ByWord */ + (byWordFolded ? -200 /* Penalty.CaseFold */ : 0) + -700 /* Penalty.NotStart */ +
302
+ (wordAdjacent ? 0 : -1100 /* Penalty.Gap */), byWord, word);
303
+ return chars.length == 2 ? null
304
+ : this.result((any[0] ? -700 /* Penalty.NotStart */ : 0) + -200 /* Penalty.CaseFold */ + -1100 /* Penalty.Gap */, any, word);
305
+ }
306
+ result(score, positions, word) {
307
+ let result = [], i = 0;
308
+ for (let pos of positions) {
309
+ let to = pos + (this.astral ? codePointSize(codePointAt(word, pos)) : 1);
310
+ if (i && result[i - 1] == pos)
311
+ result[i - 1] = to;
312
+ else {
313
+ result[i++] = pos;
314
+ result[i++] = to;
315
+ }
316
+ }
317
+ return this.ret(score - word.length, result);
318
+ }
319
+ }
320
+ class StrictMatcher {
321
+ constructor(pattern) {
322
+ this.pattern = pattern;
323
+ this.matched = [];
324
+ this.score = 0;
325
+ this.folded = pattern.toLowerCase();
326
+ }
327
+ match(word) {
328
+ if (word.length < this.pattern.length)
329
+ return null;
330
+ let start = word.slice(0, this.pattern.length);
331
+ let match = start == this.pattern ? 0 : start.toLowerCase() == this.folded ? -200 /* Penalty.CaseFold */ : null;
332
+ if (match == null)
333
+ return null;
334
+ this.matched = [0, start.length];
335
+ this.score = match + (word.length == this.pattern.length ? 0 : -100 /* Penalty.NotFull */);
336
+ return this;
337
+ }
338
+ }
339
+
340
+ const completionConfig = /*@__PURE__*/Facet.define({
341
+ combine(configs) {
342
+ return combineConfig(configs, {
343
+ activateOnTyping: true,
344
+ activateOnCompletion: () => false,
345
+ activateOnTypingDelay: 100,
346
+ selectOnOpen: true,
347
+ override: null,
348
+ closeOnBlur: true,
349
+ maxRenderedOptions: 100,
350
+ defaultKeymap: true,
351
+ tooltipClass: () => "",
352
+ optionClass: () => "",
353
+ aboveCursor: false,
354
+ icons: true,
355
+ addToOptions: [],
356
+ positionInfo: defaultPositionInfo,
357
+ filterStrict: false,
358
+ compareCompletions: (a, b) => a.label.localeCompare(b.label),
359
+ interactionDelay: 75,
360
+ updateSyncTime: 100
361
+ }, {
362
+ defaultKeymap: (a, b) => a && b,
363
+ closeOnBlur: (a, b) => a && b,
364
+ icons: (a, b) => a && b,
365
+ tooltipClass: (a, b) => c => joinClass(a(c), b(c)),
366
+ optionClass: (a, b) => c => joinClass(a(c), b(c)),
367
+ addToOptions: (a, b) => a.concat(b),
368
+ filterStrict: (a, b) => a || b,
369
+ });
370
+ }
371
+ });
372
+ function joinClass(a, b) {
373
+ return a ? b ? a + " " + b : a : b;
374
+ }
375
+ function defaultPositionInfo(view, list, option, info, space, tooltip) {
376
+ let rtl = view.textDirection == Direction.RTL, left = rtl, narrow = false;
377
+ let side = "top", offset, maxWidth;
378
+ let spaceLeft = list.left - space.left, spaceRight = space.right - list.right;
379
+ let infoWidth = info.right - info.left, infoHeight = info.bottom - info.top;
380
+ if (left && spaceLeft < Math.min(infoWidth, spaceRight))
381
+ left = false;
382
+ else if (!left && spaceRight < Math.min(infoWidth, spaceLeft))
383
+ left = true;
384
+ if (infoWidth <= (left ? spaceLeft : spaceRight)) {
385
+ offset = Math.max(space.top, Math.min(option.top, space.bottom - infoHeight)) - list.top;
386
+ maxWidth = Math.min(400 /* Info.Width */, left ? spaceLeft : spaceRight);
387
+ }
388
+ else {
389
+ narrow = true;
390
+ maxWidth = Math.min(400 /* Info.Width */, (rtl ? list.right : space.right - list.left) - 30 /* Info.Margin */);
391
+ let spaceBelow = space.bottom - list.bottom;
392
+ if (spaceBelow >= infoHeight || spaceBelow > list.top) { // Below the completion
393
+ offset = option.bottom - list.top;
394
+ }
395
+ else { // Above it
396
+ side = "bottom";
397
+ offset = list.bottom - option.top;
398
+ }
399
+ }
400
+ let scaleY = (list.bottom - list.top) / tooltip.offsetHeight;
401
+ let scaleX = (list.right - list.left) / tooltip.offsetWidth;
402
+ return {
403
+ style: `${side}: ${offset / scaleY}px; max-width: ${maxWidth / scaleX}px`,
404
+ class: "cm-completionInfo-" + (narrow ? (rtl ? "left-narrow" : "right-narrow") : left ? "left" : "right")
405
+ };
406
+ }
407
+
408
+ function optionContent(config) {
409
+ let content = config.addToOptions.slice();
410
+ if (config.icons)
411
+ content.push({
412
+ render(completion) {
413
+ let icon = document.createElement("div");
414
+ icon.classList.add("cm-completionIcon");
415
+ if (completion.type)
416
+ icon.classList.add(...completion.type.split(/\s+/g).map(cls => "cm-completionIcon-" + cls));
417
+ icon.setAttribute("aria-hidden", "true");
418
+ return icon;
419
+ },
420
+ position: 20
421
+ });
422
+ content.push({
423
+ render(completion, _s, _v, match) {
424
+ let labelElt = document.createElement("span");
425
+ labelElt.className = "cm-completionLabel";
426
+ let label = completion.displayLabel || completion.label, off = 0;
427
+ for (let j = 0; j < match.length;) {
428
+ let from = match[j++], to = match[j++];
429
+ if (from > off)
430
+ labelElt.appendChild(document.createTextNode(label.slice(off, from)));
431
+ let span = labelElt.appendChild(document.createElement("span"));
432
+ span.appendChild(document.createTextNode(label.slice(from, to)));
433
+ span.className = "cm-completionMatchedText";
434
+ off = to;
435
+ }
436
+ if (off < label.length)
437
+ labelElt.appendChild(document.createTextNode(label.slice(off)));
438
+ return labelElt;
439
+ },
440
+ position: 50
441
+ }, {
442
+ render(completion) {
443
+ if (!completion.detail)
444
+ return null;
445
+ let detailElt = document.createElement("span");
446
+ detailElt.className = "cm-completionDetail";
447
+ detailElt.textContent = completion.detail;
448
+ return detailElt;
449
+ },
450
+ position: 80
451
+ });
452
+ return content.sort((a, b) => a.position - b.position).map(a => a.render);
453
+ }
454
+ function rangeAroundSelected(total, selected, max) {
455
+ if (total <= max)
456
+ return { from: 0, to: total };
457
+ if (selected < 0)
458
+ selected = 0;
459
+ if (selected <= (total >> 1)) {
460
+ let off = Math.floor(selected / max);
461
+ return { from: off * max, to: (off + 1) * max };
462
+ }
463
+ let off = Math.floor((total - selected) / max);
464
+ return { from: total - (off + 1) * max, to: total - off * max };
465
+ }
466
+ class CompletionTooltip {
467
+ constructor(view, stateField, applyCompletion) {
468
+ this.view = view;
469
+ this.stateField = stateField;
470
+ this.applyCompletion = applyCompletion;
471
+ this.info = null;
472
+ this.infoDestroy = null;
473
+ this.placeInfoReq = {
474
+ read: () => this.measureInfo(),
475
+ write: (pos) => this.placeInfo(pos),
476
+ key: this
477
+ };
478
+ this.space = null;
479
+ this.currentClass = "";
480
+ let cState = view.state.field(stateField);
481
+ let { options, selected } = cState.open;
482
+ let config = view.state.facet(completionConfig);
483
+ this.optionContent = optionContent(config);
484
+ this.optionClass = config.optionClass;
485
+ this.tooltipClass = config.tooltipClass;
486
+ this.range = rangeAroundSelected(options.length, selected, config.maxRenderedOptions);
487
+ this.dom = document.createElement("div");
488
+ this.dom.className = "cm-tooltip-autocomplete";
489
+ this.updateTooltipClass(view.state);
490
+ this.dom.addEventListener("mousedown", (e) => {
491
+ let { options } = view.state.field(stateField).open;
492
+ for (let dom = e.target, match; dom && dom != this.dom; dom = dom.parentNode) {
493
+ if (dom.nodeName == "LI" && (match = /-(\d+)$/.exec(dom.id)) && +match[1] < options.length) {
494
+ this.applyCompletion(view, options[+match[1]]);
495
+ e.preventDefault();
496
+ return;
497
+ }
498
+ }
499
+ });
500
+ this.dom.addEventListener("focusout", (e) => {
501
+ let state = view.state.field(this.stateField, false);
502
+ if (state && state.tooltip && view.state.facet(completionConfig).closeOnBlur &&
503
+ e.relatedTarget != view.contentDOM)
504
+ view.dispatch({ effects: closeCompletionEffect.of(null) });
505
+ });
506
+ this.showOptions(options, cState.id);
507
+ }
508
+ mount() { this.updateSel(); }
509
+ showOptions(options, id) {
510
+ if (this.list)
511
+ this.list.remove();
512
+ this.list = this.dom.appendChild(this.createListBox(options, id, this.range));
513
+ this.list.addEventListener("scroll", () => {
514
+ if (this.info)
515
+ this.view.requestMeasure(this.placeInfoReq);
516
+ });
517
+ }
518
+ update(update) {
519
+ var _a;
520
+ let cState = update.state.field(this.stateField);
521
+ let prevState = update.startState.field(this.stateField);
522
+ this.updateTooltipClass(update.state);
523
+ if (cState != prevState) {
524
+ let { options, selected, disabled } = cState.open;
525
+ if (!prevState.open || prevState.open.options != options) {
526
+ this.range = rangeAroundSelected(options.length, selected, update.state.facet(completionConfig).maxRenderedOptions);
527
+ this.showOptions(options, cState.id);
528
+ }
529
+ this.updateSel();
530
+ if (disabled != ((_a = prevState.open) === null || _a === void 0 ? void 0 : _a.disabled))
531
+ this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!disabled);
532
+ }
533
+ }
534
+ updateTooltipClass(state) {
535
+ let cls = this.tooltipClass(state);
536
+ if (cls != this.currentClass) {
537
+ for (let c of this.currentClass.split(" "))
538
+ if (c)
539
+ this.dom.classList.remove(c);
540
+ for (let c of cls.split(" "))
541
+ if (c)
542
+ this.dom.classList.add(c);
543
+ this.currentClass = cls;
544
+ }
545
+ }
546
+ positioned(space) {
547
+ this.space = space;
548
+ if (this.info)
549
+ this.view.requestMeasure(this.placeInfoReq);
550
+ }
551
+ updateSel() {
552
+ let cState = this.view.state.field(this.stateField), open = cState.open;
553
+ if (open.selected > -1 && open.selected < this.range.from || open.selected >= this.range.to) {
554
+ this.range = rangeAroundSelected(open.options.length, open.selected, this.view.state.facet(completionConfig).maxRenderedOptions);
555
+ this.showOptions(open.options, cState.id);
556
+ }
557
+ if (this.updateSelectedOption(open.selected)) {
558
+ this.destroyInfo();
559
+ let { completion } = open.options[open.selected];
560
+ let { info } = completion;
561
+ if (!info)
562
+ return;
563
+ let infoResult = typeof info === "string" ? document.createTextNode(info) : info(completion);
564
+ if (!infoResult)
565
+ return;
566
+ if ("then" in infoResult) {
567
+ infoResult.then(obj => {
568
+ if (obj && this.view.state.field(this.stateField, false) == cState)
569
+ this.addInfoPane(obj, completion);
570
+ }).catch(e => logException(this.view.state, e, "completion info"));
571
+ }
572
+ else {
573
+ this.addInfoPane(infoResult, completion);
574
+ }
575
+ }
576
+ }
577
+ addInfoPane(content, completion) {
578
+ this.destroyInfo();
579
+ let wrap = this.info = document.createElement("div");
580
+ wrap.className = "cm-tooltip cm-completionInfo";
581
+ if (content.nodeType != null) {
582
+ wrap.appendChild(content);
583
+ this.infoDestroy = null;
584
+ }
585
+ else {
586
+ let { dom, destroy } = content;
587
+ wrap.appendChild(dom);
588
+ this.infoDestroy = destroy || null;
589
+ }
590
+ this.dom.appendChild(wrap);
591
+ this.view.requestMeasure(this.placeInfoReq);
592
+ }
593
+ updateSelectedOption(selected) {
594
+ let set = null;
595
+ for (let opt = this.list.firstChild, i = this.range.from; opt; opt = opt.nextSibling, i++) {
596
+ if (opt.nodeName != "LI" || !opt.id) {
597
+ i--; // A section header
598
+ }
599
+ else if (i == selected) {
600
+ if (!opt.hasAttribute("aria-selected")) {
601
+ opt.setAttribute("aria-selected", "true");
602
+ set = opt;
603
+ }
604
+ }
605
+ else {
606
+ if (opt.hasAttribute("aria-selected"))
607
+ opt.removeAttribute("aria-selected");
608
+ }
609
+ }
610
+ if (set)
611
+ scrollIntoView(this.list, set);
612
+ return set;
613
+ }
614
+ measureInfo() {
615
+ let sel = this.dom.querySelector("[aria-selected]");
616
+ if (!sel || !this.info)
617
+ return null;
618
+ let listRect = this.dom.getBoundingClientRect();
619
+ let infoRect = this.info.getBoundingClientRect();
620
+ let selRect = sel.getBoundingClientRect();
621
+ let space = this.space;
622
+ if (!space) {
623
+ let docElt = this.dom.ownerDocument.documentElement;
624
+ space = { left: 0, top: 0, right: docElt.clientWidth, bottom: docElt.clientHeight };
625
+ }
626
+ if (selRect.top > Math.min(space.bottom, listRect.bottom) - 10 ||
627
+ selRect.bottom < Math.max(space.top, listRect.top) + 10)
628
+ return null;
629
+ return this.view.state.facet(completionConfig).positionInfo(this.view, listRect, selRect, infoRect, space, this.dom);
630
+ }
631
+ placeInfo(pos) {
632
+ if (this.info) {
633
+ if (pos) {
634
+ if (pos.style)
635
+ this.info.style.cssText = pos.style;
636
+ this.info.className = "cm-tooltip cm-completionInfo " + (pos.class || "");
637
+ }
638
+ else {
639
+ this.info.style.cssText = "top: -1e6px";
640
+ }
641
+ }
642
+ }
643
+ createListBox(options, id, range) {
644
+ const ul = document.createElement("ul");
645
+ ul.id = id;
646
+ ul.setAttribute("role", "listbox");
647
+ ul.setAttribute("aria-expanded", "true");
648
+ ul.setAttribute("aria-label", this.view.state.phrase("Completions"));
649
+ ul.addEventListener("mousedown", e => {
650
+ // Prevent focus change when clicking the scrollbar
651
+ if (e.target == ul)
652
+ e.preventDefault();
653
+ });
654
+ let curSection = null;
655
+ for (let i = range.from; i < range.to; i++) {
656
+ let { completion, match } = options[i], { section } = completion;
657
+ if (section) {
658
+ let name = typeof section == "string" ? section : section.name;
659
+ if (name != curSection && (i > range.from || range.from == 0)) {
660
+ curSection = name;
661
+ if (typeof section != "string" && section.header) {
662
+ ul.appendChild(section.header(section));
663
+ }
664
+ else {
665
+ let header = ul.appendChild(document.createElement("completion-section"));
666
+ header.textContent = name;
667
+ }
668
+ }
669
+ }
670
+ const li = ul.appendChild(document.createElement("li"));
671
+ li.id = id + "-" + i;
672
+ li.setAttribute("role", "option");
673
+ let cls = this.optionClass(completion);
674
+ if (cls)
675
+ li.className = cls;
676
+ for (let source of this.optionContent) {
677
+ let node = source(completion, this.view.state, this.view, match);
678
+ if (node)
679
+ li.appendChild(node);
680
+ }
681
+ }
682
+ if (range.from)
683
+ ul.classList.add("cm-completionListIncompleteTop");
684
+ if (range.to < options.length)
685
+ ul.classList.add("cm-completionListIncompleteBottom");
686
+ return ul;
687
+ }
688
+ destroyInfo() {
689
+ if (this.info) {
690
+ if (this.infoDestroy)
691
+ this.infoDestroy();
692
+ this.info.remove();
693
+ this.info = null;
694
+ }
695
+ }
696
+ destroy() {
697
+ this.destroyInfo();
698
+ }
699
+ }
700
+ function completionTooltip(stateField, applyCompletion) {
701
+ return (view) => new CompletionTooltip(view, stateField, applyCompletion);
702
+ }
703
+ function scrollIntoView(container, element) {
704
+ let parent = container.getBoundingClientRect();
705
+ let self = element.getBoundingClientRect();
706
+ let scaleY = parent.height / container.offsetHeight;
707
+ if (self.top < parent.top)
708
+ container.scrollTop -= (parent.top - self.top) / scaleY;
709
+ else if (self.bottom > parent.bottom)
710
+ container.scrollTop += (self.bottom - parent.bottom) / scaleY;
711
+ }
712
+
713
+ // Used to pick a preferred option when two options with the same
714
+ // label occur in the result.
715
+ function score(option) {
716
+ return (option.boost || 0) * 100 + (option.apply ? 10 : 0) + (option.info ? 5 : 0) +
717
+ (option.type ? 1 : 0);
718
+ }
719
+ function sortOptions(active, state) {
720
+ let options = [];
721
+ let sections = null;
722
+ let addOption = (option) => {
723
+ options.push(option);
724
+ let { section } = option.completion;
725
+ if (section) {
726
+ if (!sections)
727
+ sections = [];
728
+ let name = typeof section == "string" ? section : section.name;
729
+ if (!sections.some(s => s.name == name))
730
+ sections.push(typeof section == "string" ? { name } : section);
731
+ }
732
+ };
733
+ let conf = state.facet(completionConfig);
734
+ for (let a of active)
735
+ if (a.hasResult()) {
736
+ let getMatch = a.result.getMatch;
737
+ if (a.result.filter === false) {
738
+ for (let option of a.result.options) {
739
+ addOption(new Option(option, a.source, getMatch ? getMatch(option) : [], 1e9 - options.length));
740
+ }
741
+ }
742
+ else {
743
+ let pattern = state.sliceDoc(a.from, a.to), match;
744
+ let matcher = conf.filterStrict ? new StrictMatcher(pattern) : new FuzzyMatcher(pattern);
745
+ for (let option of a.result.options)
746
+ if (match = matcher.match(option.label)) {
747
+ let matched = !option.displayLabel ? match.matched : getMatch ? getMatch(option, match.matched) : [];
748
+ addOption(new Option(option, a.source, matched, match.score + (option.boost || 0)));
749
+ }
750
+ }
751
+ }
752
+ if (sections) {
753
+ let sectionOrder = Object.create(null), pos = 0;
754
+ let cmp = (a, b) => { var _a, _b; return ((_a = a.rank) !== null && _a !== void 0 ? _a : 1e9) - ((_b = b.rank) !== null && _b !== void 0 ? _b : 1e9) || (a.name < b.name ? -1 : 1); };
755
+ for (let s of sections.sort(cmp)) {
756
+ pos -= 1e5;
757
+ sectionOrder[s.name] = pos;
758
+ }
759
+ for (let option of options) {
760
+ let { section } = option.completion;
761
+ if (section)
762
+ option.score += sectionOrder[typeof section == "string" ? section : section.name];
763
+ }
764
+ }
765
+ let result = [], prev = null;
766
+ let compare = conf.compareCompletions;
767
+ for (let opt of options.sort((a, b) => (b.score - a.score) || compare(a.completion, b.completion))) {
768
+ let cur = opt.completion;
769
+ if (!prev || prev.label != cur.label || prev.detail != cur.detail ||
770
+ (prev.type != null && cur.type != null && prev.type != cur.type) ||
771
+ prev.apply != cur.apply || prev.boost != cur.boost)
772
+ result.push(opt);
773
+ else if (score(opt.completion) > score(prev))
774
+ result[result.length - 1] = opt;
775
+ prev = opt.completion;
776
+ }
777
+ return result;
778
+ }
779
+ class CompletionDialog {
780
+ constructor(options, attrs, tooltip, timestamp, selected, disabled) {
781
+ this.options = options;
782
+ this.attrs = attrs;
783
+ this.tooltip = tooltip;
784
+ this.timestamp = timestamp;
785
+ this.selected = selected;
786
+ this.disabled = disabled;
787
+ }
788
+ setSelected(selected, id) {
789
+ return selected == this.selected || selected >= this.options.length ? this
790
+ : new CompletionDialog(this.options, makeAttrs(id, selected), this.tooltip, this.timestamp, selected, this.disabled);
791
+ }
792
+ static build(active, state, id, prev, conf, didSetActive) {
793
+ if (prev && !didSetActive && active.some(s => s.isPending))
794
+ return prev.setDisabled();
795
+ let options = sortOptions(active, state);
796
+ if (!options.length)
797
+ return prev && active.some(a => a.isPending) ? prev.setDisabled() : null;
798
+ let selected = state.facet(completionConfig).selectOnOpen ? 0 : -1;
799
+ if (prev && prev.selected != selected && prev.selected != -1) {
800
+ let selectedValue = prev.options[prev.selected].completion;
801
+ for (let i = 0; i < options.length; i++)
802
+ if (options[i].completion == selectedValue) {
803
+ selected = i;
804
+ break;
805
+ }
806
+ }
807
+ return new CompletionDialog(options, makeAttrs(id, selected), {
808
+ pos: active.reduce((a, b) => b.hasResult() ? Math.min(a, b.from) : a, 1e8),
809
+ create: createTooltip,
810
+ above: conf.aboveCursor,
811
+ }, prev ? prev.timestamp : Date.now(), selected, false);
812
+ }
813
+ map(changes) {
814
+ return new CompletionDialog(this.options, this.attrs, Object.assign(Object.assign({}, this.tooltip), { pos: changes.mapPos(this.tooltip.pos) }), this.timestamp, this.selected, this.disabled);
815
+ }
816
+ setDisabled() {
817
+ return new CompletionDialog(this.options, this.attrs, this.tooltip, this.timestamp, this.selected, true);
818
+ }
819
+ }
820
+ class CompletionState {
821
+ constructor(active, id, open) {
822
+ this.active = active;
823
+ this.id = id;
824
+ this.open = open;
825
+ }
826
+ static start() {
827
+ return new CompletionState(none, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null);
828
+ }
829
+ update(tr) {
830
+ let { state } = tr, conf = state.facet(completionConfig);
831
+ let sources = conf.override ||
832
+ state.languageDataAt("autocomplete", cur(state)).map(asSource);
833
+ let active = sources.map(source => {
834
+ let value = this.active.find(s => s.source == source) ||
835
+ new ActiveSource(source, this.active.some(a => a.state != 0 /* State.Inactive */) ? 1 /* State.Pending */ : 0 /* State.Inactive */);
836
+ return value.update(tr, conf);
837
+ });
838
+ if (active.length == this.active.length && active.every((a, i) => a == this.active[i]))
839
+ active = this.active;
840
+ let open = this.open, didSet = tr.effects.some(e => e.is(setActiveEffect));
841
+ if (open && tr.docChanged)
842
+ open = open.map(tr.changes);
843
+ if (tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) ||
844
+ !sameResults(active, this.active) || didSet)
845
+ open = CompletionDialog.build(active, state, this.id, open, conf, didSet);
846
+ else if (open && open.disabled && !active.some(a => a.isPending))
847
+ open = null;
848
+ if (!open && active.every(a => !a.isPending) && active.some(a => a.hasResult()))
849
+ active = active.map(a => a.hasResult() ? new ActiveSource(a.source, 0 /* State.Inactive */) : a);
850
+ for (let effect of tr.effects)
851
+ if (effect.is(setSelectedEffect))
852
+ open = open && open.setSelected(effect.value, this.id);
853
+ return active == this.active && open == this.open ? this : new CompletionState(active, this.id, open);
854
+ }
855
+ get tooltip() { return this.open ? this.open.tooltip : null; }
856
+ get attrs() { return this.open ? this.open.attrs : this.active.length ? baseAttrs : noAttrs; }
857
+ }
858
+ function sameResults(a, b) {
859
+ if (a == b)
860
+ return true;
861
+ for (let iA = 0, iB = 0;;) {
862
+ while (iA < a.length && !a[iA].hasResult())
863
+ iA++;
864
+ while (iB < b.length && !b[iB].hasResult())
865
+ iB++;
866
+ let endA = iA == a.length, endB = iB == b.length;
867
+ if (endA || endB)
868
+ return endA == endB;
869
+ if (a[iA++].result != b[iB++].result)
870
+ return false;
871
+ }
872
+ }
873
+ const baseAttrs = {
874
+ "aria-autocomplete": "list"
875
+ };
876
+ const noAttrs = {};
877
+ function makeAttrs(id, selected) {
878
+ let result = {
879
+ "aria-autocomplete": "list",
880
+ "aria-haspopup": "listbox",
881
+ "aria-controls": id
882
+ };
883
+ if (selected > -1)
884
+ result["aria-activedescendant"] = id + "-" + selected;
885
+ return result;
886
+ }
887
+ const none = [];
888
+ function getUpdateType(tr, conf) {
889
+ if (tr.isUserEvent("input.complete")) {
890
+ let completion = tr.annotation(pickedCompletion);
891
+ if (completion && conf.activateOnCompletion(completion))
892
+ return 4 /* UpdateType.Activate */ | 8 /* UpdateType.Reset */;
893
+ }
894
+ let typing = tr.isUserEvent("input.type");
895
+ return typing && conf.activateOnTyping ? 4 /* UpdateType.Activate */ | 1 /* UpdateType.Typing */
896
+ : typing ? 1 /* UpdateType.Typing */
897
+ : tr.isUserEvent("delete.backward") ? 2 /* UpdateType.Backspacing */
898
+ : tr.selection ? 8 /* UpdateType.Reset */
899
+ : tr.docChanged ? 16 /* UpdateType.ResetIfTouching */ : 0 /* UpdateType.None */;
900
+ }
901
+ class ActiveSource {
902
+ constructor(source, state, explicit = false) {
903
+ this.source = source;
904
+ this.state = state;
905
+ this.explicit = explicit;
906
+ }
907
+ hasResult() { return false; }
908
+ get isPending() { return this.state == 1 /* State.Pending */; }
909
+ update(tr, conf) {
910
+ let type = getUpdateType(tr, conf), value = this;
911
+ if ((type & 8 /* UpdateType.Reset */) || (type & 16 /* UpdateType.ResetIfTouching */) && this.touches(tr))
912
+ value = new ActiveSource(value.source, 0 /* State.Inactive */);
913
+ if ((type & 4 /* UpdateType.Activate */) && value.state == 0 /* State.Inactive */)
914
+ value = new ActiveSource(this.source, 1 /* State.Pending */);
915
+ value = value.updateFor(tr, type);
916
+ for (let effect of tr.effects) {
917
+ if (effect.is(startCompletionEffect))
918
+ value = new ActiveSource(value.source, 1 /* State.Pending */, effect.value);
919
+ else if (effect.is(closeCompletionEffect))
920
+ value = new ActiveSource(value.source, 0 /* State.Inactive */);
921
+ else if (effect.is(setActiveEffect))
922
+ for (let active of effect.value)
923
+ if (active.source == value.source)
924
+ value = active;
925
+ }
926
+ return value;
927
+ }
928
+ updateFor(tr, type) { return this.map(tr.changes); }
929
+ map(changes) { return this; }
930
+ touches(tr) {
931
+ return tr.changes.touchesRange(cur(tr.state));
932
+ }
933
+ }
934
+ class ActiveResult extends ActiveSource {
935
+ constructor(source, explicit, limit, result, from, to) {
936
+ super(source, 3 /* State.Result */, explicit);
937
+ this.limit = limit;
938
+ this.result = result;
939
+ this.from = from;
940
+ this.to = to;
941
+ }
942
+ hasResult() { return true; }
943
+ updateFor(tr, type) {
944
+ var _a;
945
+ if (!(type & 3 /* UpdateType.SimpleInteraction */))
946
+ return this.map(tr.changes);
947
+ let result = this.result;
948
+ if (result.map && !tr.changes.empty)
949
+ result = result.map(result, tr.changes);
950
+ let from = tr.changes.mapPos(this.from), to = tr.changes.mapPos(this.to, 1);
951
+ let pos = cur(tr.state);
952
+ if (pos > to || !result ||
953
+ (type & 2 /* UpdateType.Backspacing */) && (cur(tr.startState) == this.from || pos < this.limit))
954
+ return new ActiveSource(this.source, type & 4 /* UpdateType.Activate */ ? 1 /* State.Pending */ : 0 /* State.Inactive */);
955
+ let limit = tr.changes.mapPos(this.limit);
956
+ if (checkValid(result.validFor, tr.state, from, to))
957
+ return new ActiveResult(this.source, this.explicit, limit, result, from, to);
958
+ if (result.update &&
959
+ (result = result.update(result, from, to, new CompletionContext(tr.state, pos, false))))
960
+ return new ActiveResult(this.source, this.explicit, limit, result, result.from, (_a = result.to) !== null && _a !== void 0 ? _a : cur(tr.state));
961
+ return new ActiveSource(this.source, 1 /* State.Pending */, this.explicit);
962
+ }
963
+ map(mapping) {
964
+ if (mapping.empty)
965
+ return this;
966
+ let result = this.result.map ? this.result.map(this.result, mapping) : this.result;
967
+ if (!result)
968
+ return new ActiveSource(this.source, 0 /* State.Inactive */);
969
+ return new ActiveResult(this.source, this.explicit, mapping.mapPos(this.limit), this.result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));
970
+ }
971
+ touches(tr) {
972
+ return tr.changes.touchesRange(this.from, this.to);
973
+ }
974
+ }
975
+ function checkValid(validFor, state, from, to) {
976
+ if (!validFor)
977
+ return false;
978
+ let text = state.sliceDoc(from, to);
979
+ return typeof validFor == "function" ? validFor(text, from, to, state) : ensureAnchor(validFor, true).test(text);
980
+ }
981
+ const setActiveEffect = /*@__PURE__*/StateEffect.define({
982
+ map(sources, mapping) { return sources.map(s => s.map(mapping)); }
983
+ });
984
+ const setSelectedEffect = /*@__PURE__*/StateEffect.define();
985
+ const completionState = /*@__PURE__*/StateField.define({
986
+ create() { return CompletionState.start(); },
987
+ update(value, tr) { return value.update(tr); },
988
+ provide: f => [
989
+ showTooltip.from(f, val => val.tooltip),
990
+ EditorView.contentAttributes.from(f, state => state.attrs)
991
+ ]
992
+ });
993
+ function applyCompletion(view, option) {
994
+ const apply = option.completion.apply || option.completion.label;
995
+ let result = view.state.field(completionState).active.find(a => a.source == option.source);
996
+ if (!(result instanceof ActiveResult))
997
+ return false;
998
+ if (typeof apply == "string")
999
+ view.dispatch(Object.assign(Object.assign({}, insertCompletionText(view.state, apply, result.from, result.to)), { annotations: pickedCompletion.of(option.completion) }));
1000
+ else
1001
+ apply(view, option.completion, result.from, result.to);
1002
+ return true;
1003
+ }
1004
+ const createTooltip = /*@__PURE__*/completionTooltip(completionState, applyCompletion);
1005
+
1006
+ /**
1007
+ Returns a command that moves the completion selection forward or
1008
+ backward by the given amount.
1009
+ */
1010
+ function moveCompletionSelection(forward, by = "option") {
1011
+ return (view) => {
1012
+ let cState = view.state.field(completionState, false);
1013
+ if (!cState || !cState.open || cState.open.disabled ||
1014
+ Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay)
1015
+ return false;
1016
+ let step = 1, tooltip;
1017
+ if (by == "page" && (tooltip = getTooltip(view, cState.open.tooltip)))
1018
+ step = Math.max(2, Math.floor(tooltip.dom.offsetHeight /
1019
+ tooltip.dom.querySelector("li").offsetHeight) - 1);
1020
+ let { length } = cState.open.options;
1021
+ let selected = cState.open.selected > -1 ? cState.open.selected + step * (forward ? 1 : -1) : forward ? 0 : length - 1;
1022
+ if (selected < 0)
1023
+ selected = by == "page" ? 0 : length - 1;
1024
+ else if (selected >= length)
1025
+ selected = by == "page" ? length - 1 : 0;
1026
+ view.dispatch({ effects: setSelectedEffect.of(selected) });
1027
+ return true;
1028
+ };
1029
+ }
1030
+ /**
1031
+ Accept the current completion.
1032
+ */
1033
+ const acceptCompletion = (view) => {
1034
+ let cState = view.state.field(completionState, false);
1035
+ if (view.state.readOnly || !cState || !cState.open || cState.open.selected < 0 || cState.open.disabled ||
1036
+ Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay)
1037
+ return false;
1038
+ return applyCompletion(view, cState.open.options[cState.open.selected]);
1039
+ };
1040
+ /**
1041
+ Explicitly start autocompletion.
1042
+ */
1043
+ const startCompletion = (view) => {
1044
+ let cState = view.state.field(completionState, false);
1045
+ if (!cState)
1046
+ return false;
1047
+ view.dispatch({ effects: startCompletionEffect.of(true) });
1048
+ return true;
1049
+ };
1050
+ /**
1051
+ Close the currently active completion.
1052
+ */
1053
+ const closeCompletion = (view) => {
1054
+ let cState = view.state.field(completionState, false);
1055
+ if (!cState || !cState.active.some(a => a.state != 0 /* State.Inactive */))
1056
+ return false;
1057
+ view.dispatch({ effects: closeCompletionEffect.of(null) });
1058
+ return true;
1059
+ };
1060
+ class RunningQuery {
1061
+ constructor(active, context) {
1062
+ this.active = active;
1063
+ this.context = context;
1064
+ this.time = Date.now();
1065
+ this.updates = [];
1066
+ // Note that 'undefined' means 'not done yet', whereas 'null' means
1067
+ // 'query returned null'.
1068
+ this.done = undefined;
1069
+ }
1070
+ }
1071
+ const MaxUpdateCount = 50, MinAbortTime = 1000;
1072
+ const completionPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
1073
+ constructor(view) {
1074
+ this.view = view;
1075
+ this.debounceUpdate = -1;
1076
+ this.running = [];
1077
+ this.debounceAccept = -1;
1078
+ this.pendingStart = false;
1079
+ this.composing = 0 /* CompositionState.None */;
1080
+ for (let active of view.state.field(completionState).active)
1081
+ if (active.isPending)
1082
+ this.startQuery(active);
1083
+ }
1084
+ update(update) {
1085
+ let cState = update.state.field(completionState);
1086
+ let conf = update.state.facet(completionConfig);
1087
+ if (!update.selectionSet && !update.docChanged && update.startState.field(completionState) == cState)
1088
+ return;
1089
+ let doesReset = update.transactions.some(tr => {
1090
+ let type = getUpdateType(tr, conf);
1091
+ return (type & 8 /* UpdateType.Reset */) || (tr.selection || tr.docChanged) && !(type & 3 /* UpdateType.SimpleInteraction */);
1092
+ });
1093
+ for (let i = 0; i < this.running.length; i++) {
1094
+ let query = this.running[i];
1095
+ if (doesReset ||
1096
+ query.context.abortOnDocChange && update.docChanged ||
1097
+ query.updates.length + update.transactions.length > MaxUpdateCount && Date.now() - query.time > MinAbortTime) {
1098
+ for (let handler of query.context.abortListeners) {
1099
+ try {
1100
+ handler();
1101
+ }
1102
+ catch (e) {
1103
+ logException(this.view.state, e);
1104
+ }
1105
+ }
1106
+ query.context.abortListeners = null;
1107
+ this.running.splice(i--, 1);
1108
+ }
1109
+ else {
1110
+ query.updates.push(...update.transactions);
1111
+ }
1112
+ }
1113
+ if (this.debounceUpdate > -1)
1114
+ clearTimeout(this.debounceUpdate);
1115
+ if (update.transactions.some(tr => tr.effects.some(e => e.is(startCompletionEffect))))
1116
+ this.pendingStart = true;
1117
+ let delay = this.pendingStart ? 50 : conf.activateOnTypingDelay;
1118
+ this.debounceUpdate = cState.active.some(a => a.isPending && !this.running.some(q => q.active.source == a.source))
1119
+ ? setTimeout(() => this.startUpdate(), delay) : -1;
1120
+ if (this.composing != 0 /* CompositionState.None */)
1121
+ for (let tr of update.transactions) {
1122
+ if (tr.isUserEvent("input.type"))
1123
+ this.composing = 2 /* CompositionState.Changed */;
1124
+ else if (this.composing == 2 /* CompositionState.Changed */ && tr.selection)
1125
+ this.composing = 3 /* CompositionState.ChangedAndMoved */;
1126
+ }
1127
+ }
1128
+ startUpdate() {
1129
+ this.debounceUpdate = -1;
1130
+ this.pendingStart = false;
1131
+ let { state } = this.view, cState = state.field(completionState);
1132
+ for (let active of cState.active) {
1133
+ if (active.isPending && !this.running.some(r => r.active.source == active.source))
1134
+ this.startQuery(active);
1135
+ }
1136
+ if (this.running.length && cState.open && cState.open.disabled)
1137
+ this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime);
1138
+ }
1139
+ startQuery(active) {
1140
+ let { state } = this.view, pos = cur(state);
1141
+ let context = new CompletionContext(state, pos, active.explicit, this.view);
1142
+ let pending = new RunningQuery(active, context);
1143
+ this.running.push(pending);
1144
+ Promise.resolve(active.source(context)).then(result => {
1145
+ if (!pending.context.aborted) {
1146
+ pending.done = result || null;
1147
+ this.scheduleAccept();
1148
+ }
1149
+ }, err => {
1150
+ this.view.dispatch({ effects: closeCompletionEffect.of(null) });
1151
+ logException(this.view.state, err);
1152
+ });
1153
+ }
1154
+ scheduleAccept() {
1155
+ if (this.running.every(q => q.done !== undefined))
1156
+ this.accept();
1157
+ else if (this.debounceAccept < 0)
1158
+ this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime);
1159
+ }
1160
+ // For each finished query in this.running, try to create a result
1161
+ // or, if appropriate, restart the query.
1162
+ accept() {
1163
+ var _a;
1164
+ if (this.debounceAccept > -1)
1165
+ clearTimeout(this.debounceAccept);
1166
+ this.debounceAccept = -1;
1167
+ let updated = [];
1168
+ let conf = this.view.state.facet(completionConfig), cState = this.view.state.field(completionState);
1169
+ for (let i = 0; i < this.running.length; i++) {
1170
+ let query = this.running[i];
1171
+ if (query.done === undefined)
1172
+ continue;
1173
+ this.running.splice(i--, 1);
1174
+ if (query.done) {
1175
+ let pos = cur(query.updates.length ? query.updates[0].startState : this.view.state);
1176
+ let limit = Math.min(pos, query.done.from + (query.active.explicit ? 0 : 1));
1177
+ let active = new ActiveResult(query.active.source, query.active.explicit, limit, query.done, query.done.from, (_a = query.done.to) !== null && _a !== void 0 ? _a : pos);
1178
+ // Replay the transactions that happened since the start of
1179
+ // the request and see if that preserves the result
1180
+ for (let tr of query.updates)
1181
+ active = active.update(tr, conf);
1182
+ if (active.hasResult()) {
1183
+ updated.push(active);
1184
+ continue;
1185
+ }
1186
+ }
1187
+ let current = cState.active.find(a => a.source == query.active.source);
1188
+ if (current && current.isPending) {
1189
+ if (query.done == null) {
1190
+ // Explicitly failed. Should clear the pending status if it
1191
+ // hasn't been re-set in the meantime.
1192
+ let active = new ActiveSource(query.active.source, 0 /* State.Inactive */);
1193
+ for (let tr of query.updates)
1194
+ active = active.update(tr, conf);
1195
+ if (!active.isPending)
1196
+ updated.push(active);
1197
+ }
1198
+ else {
1199
+ // Cleared by subsequent transactions. Restart.
1200
+ this.startQuery(current);
1201
+ }
1202
+ }
1203
+ }
1204
+ if (updated.length || cState.open && cState.open.disabled)
1205
+ this.view.dispatch({ effects: setActiveEffect.of(updated) });
1206
+ }
1207
+ }, {
1208
+ eventHandlers: {
1209
+ blur(event) {
1210
+ let state = this.view.state.field(completionState, false);
1211
+ if (state && state.tooltip && this.view.state.facet(completionConfig).closeOnBlur) {
1212
+ let dialog = state.open && getTooltip(this.view, state.open.tooltip);
1213
+ if (!dialog || !dialog.dom.contains(event.relatedTarget))
1214
+ setTimeout(() => this.view.dispatch({ effects: closeCompletionEffect.of(null) }), 10);
1215
+ }
1216
+ },
1217
+ compositionstart() {
1218
+ this.composing = 1 /* CompositionState.Started */;
1219
+ },
1220
+ compositionend() {
1221
+ if (this.composing == 3 /* CompositionState.ChangedAndMoved */) {
1222
+ // Safari fires compositionend events synchronously, possibly
1223
+ // from inside an update, so dispatch asynchronously to avoid reentrancy
1224
+ setTimeout(() => this.view.dispatch({ effects: startCompletionEffect.of(false) }), 20);
1225
+ }
1226
+ this.composing = 0 /* CompositionState.None */;
1227
+ }
1228
+ }
1229
+ });
1230
+ const windows = typeof navigator == "object" && /*@__PURE__*//Win/.test(navigator.platform);
1231
+ const commitCharacters = /*@__PURE__*/Prec.highest(/*@__PURE__*/EditorView.domEventHandlers({
1232
+ keydown(event, view) {
1233
+ let field = view.state.field(completionState, false);
1234
+ if (!field || !field.open || field.open.disabled || field.open.selected < 0 ||
1235
+ event.key.length > 1 || event.ctrlKey && !(windows && event.altKey) || event.metaKey)
1236
+ return false;
1237
+ let option = field.open.options[field.open.selected];
1238
+ let result = field.active.find(a => a.source == option.source);
1239
+ let commitChars = option.completion.commitCharacters || result.result.commitCharacters;
1240
+ if (commitChars && commitChars.indexOf(event.key) > -1)
1241
+ applyCompletion(view, option);
1242
+ return false;
1243
+ }
1244
+ }));
1245
+
1246
+ const baseTheme = /*@__PURE__*/EditorView.baseTheme({
1247
+ ".cm-tooltip.cm-tooltip-autocomplete": {
1248
+ "& > ul": {
1249
+ fontFamily: "monospace",
1250
+ whiteSpace: "nowrap",
1251
+ overflow: "hidden auto",
1252
+ maxWidth_fallback: "700px",
1253
+ maxWidth: "min(700px, 95vw)",
1254
+ minWidth: "250px",
1255
+ maxHeight: "10em",
1256
+ height: "100%",
1257
+ listStyle: "none",
1258
+ margin: 0,
1259
+ padding: 0,
1260
+ "& > li, & > completion-section": {
1261
+ padding: "1px 3px",
1262
+ lineHeight: 1.2
1263
+ },
1264
+ "& > li": {
1265
+ overflowX: "hidden",
1266
+ textOverflow: "ellipsis",
1267
+ cursor: "pointer"
1268
+ },
1269
+ "& > completion-section": {
1270
+ display: "list-item",
1271
+ borderBottom: "1px solid silver",
1272
+ paddingLeft: "0.5em",
1273
+ opacity: 0.7
1274
+ }
1275
+ }
1276
+ },
1277
+ "&light .cm-tooltip-autocomplete ul li[aria-selected]": {
1278
+ background: "#17c",
1279
+ color: "white",
1280
+ },
1281
+ "&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]": {
1282
+ background: "#777",
1283
+ },
1284
+ "&dark .cm-tooltip-autocomplete ul li[aria-selected]": {
1285
+ background: "#347",
1286
+ color: "white",
1287
+ },
1288
+ "&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]": {
1289
+ background: "#444",
1290
+ },
1291
+ ".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after": {
1292
+ content: '"···"',
1293
+ opacity: 0.5,
1294
+ display: "block",
1295
+ textAlign: "center"
1296
+ },
1297
+ ".cm-tooltip.cm-completionInfo": {
1298
+ position: "absolute",
1299
+ padding: "3px 9px",
1300
+ width: "max-content",
1301
+ maxWidth: `${400 /* Info.Width */}px`,
1302
+ boxSizing: "border-box",
1303
+ whiteSpace: "pre-line"
1304
+ },
1305
+ ".cm-completionInfo.cm-completionInfo-left": { right: "100%" },
1306
+ ".cm-completionInfo.cm-completionInfo-right": { left: "100%" },
1307
+ ".cm-completionInfo.cm-completionInfo-left-narrow": { right: `${30 /* Info.Margin */}px` },
1308
+ ".cm-completionInfo.cm-completionInfo-right-narrow": { left: `${30 /* Info.Margin */}px` },
1309
+ "&light .cm-snippetField": { backgroundColor: "#00000022" },
1310
+ "&dark .cm-snippetField": { backgroundColor: "#ffffff22" },
1311
+ ".cm-snippetFieldPosition": {
1312
+ verticalAlign: "text-top",
1313
+ width: 0,
1314
+ height: "1.15em",
1315
+ display: "inline-block",
1316
+ margin: "0 -0.7px -.7em",
1317
+ borderLeft: "1.4px dotted #888"
1318
+ },
1319
+ ".cm-completionMatchedText": {
1320
+ textDecoration: "underline"
1321
+ },
1322
+ ".cm-completionDetail": {
1323
+ marginLeft: "0.5em",
1324
+ fontStyle: "italic"
1325
+ },
1326
+ ".cm-completionIcon": {
1327
+ fontSize: "90%",
1328
+ width: ".8em",
1329
+ display: "inline-block",
1330
+ textAlign: "center",
1331
+ paddingRight: ".6em",
1332
+ opacity: "0.6",
1333
+ boxSizing: "content-box"
1334
+ },
1335
+ ".cm-completionIcon-function, .cm-completionIcon-method": {
1336
+ "&:after": { content: "'ƒ'" }
1337
+ },
1338
+ ".cm-completionIcon-class": {
1339
+ "&:after": { content: "'○'" }
1340
+ },
1341
+ ".cm-completionIcon-interface": {
1342
+ "&:after": { content: "'◌'" }
1343
+ },
1344
+ ".cm-completionIcon-variable": {
1345
+ "&:after": { content: "'𝑥'" }
1346
+ },
1347
+ ".cm-completionIcon-constant": {
1348
+ "&:after": { content: "'𝐶'" }
1349
+ },
1350
+ ".cm-completionIcon-type": {
1351
+ "&:after": { content: "'𝑡'" }
1352
+ },
1353
+ ".cm-completionIcon-enum": {
1354
+ "&:after": { content: "'∪'" }
1355
+ },
1356
+ ".cm-completionIcon-property": {
1357
+ "&:after": { content: "'□'" }
1358
+ },
1359
+ ".cm-completionIcon-keyword": {
1360
+ "&:after": { content: "'🔑\uFE0E'" } // Disable emoji rendering
1361
+ },
1362
+ ".cm-completionIcon-namespace": {
1363
+ "&:after": { content: "'▢'" }
1364
+ },
1365
+ ".cm-completionIcon-text": {
1366
+ "&:after": { content: "'abc'", fontSize: "50%", verticalAlign: "middle" }
1367
+ }
1368
+ });
1369
+
1370
+ const defaults = {
1371
+ brackets: ["(", "[", "{", "'", '"'],
1372
+ before: ")]}:;>",
1373
+ stringPrefixes: []
1374
+ };
1375
+ const closeBracketEffect = /*@__PURE__*/StateEffect.define({
1376
+ map(value, mapping) {
1377
+ let mapped = mapping.mapPos(value, -1, MapMode.TrackAfter);
1378
+ return mapped == null ? undefined : mapped;
1379
+ }
1380
+ });
1381
+ const closedBracket = /*@__PURE__*/new class extends RangeValue {
1382
+ };
1383
+ closedBracket.startSide = 1;
1384
+ closedBracket.endSide = -1;
1385
+ const bracketState = /*@__PURE__*/StateField.define({
1386
+ create() { return RangeSet.empty; },
1387
+ update(value, tr) {
1388
+ value = value.map(tr.changes);
1389
+ if (tr.selection) {
1390
+ let line = tr.state.doc.lineAt(tr.selection.main.head);
1391
+ value = value.update({ filter: from => from >= line.from && from <= line.to });
1392
+ }
1393
+ for (let effect of tr.effects)
1394
+ if (effect.is(closeBracketEffect))
1395
+ value = value.update({ add: [closedBracket.range(effect.value, effect.value + 1)] });
1396
+ return value;
1397
+ }
1398
+ });
1399
+ /**
1400
+ Extension to enable bracket-closing behavior. When a closeable
1401
+ bracket is typed, its closing bracket is immediately inserted
1402
+ after the cursor. When closing a bracket directly in front of a
1403
+ closing bracket inserted by the extension, the cursor moves over
1404
+ that bracket.
1405
+ */
1406
+ function closeBrackets() {
1407
+ return [inputHandler, bracketState];
1408
+ }
1409
+ const definedClosing = "()[]{}<>«»»«[]{}";
1410
+ function closing(ch) {
1411
+ for (let i = 0; i < definedClosing.length; i += 2)
1412
+ if (definedClosing.charCodeAt(i) == ch)
1413
+ return definedClosing.charAt(i + 1);
1414
+ return fromCodePoint(ch < 128 ? ch : ch + 1);
1415
+ }
1416
+ function config(state, pos) {
1417
+ return state.languageDataAt("closeBrackets", pos)[0] || defaults;
1418
+ }
1419
+ const android = typeof navigator == "object" && /*@__PURE__*//Android\b/.test(navigator.userAgent);
1420
+ const inputHandler = /*@__PURE__*/EditorView.inputHandler.of((view, from, to, insert) => {
1421
+ if ((android ? view.composing : view.compositionStarted) || view.state.readOnly)
1422
+ return false;
1423
+ let sel = view.state.selection.main;
1424
+ if (insert.length > 2 || insert.length == 2 && codePointSize(codePointAt(insert, 0)) == 1 ||
1425
+ from != sel.from || to != sel.to)
1426
+ return false;
1427
+ let tr = insertBracket(view.state, insert);
1428
+ if (!tr)
1429
+ return false;
1430
+ view.dispatch(tr);
1431
+ return true;
1432
+ });
1433
+ /**
1434
+ Command that implements deleting a pair of matching brackets when
1435
+ the cursor is between them.
1436
+ */
1437
+ const deleteBracketPair = ({ state, dispatch }) => {
1438
+ if (state.readOnly)
1439
+ return false;
1440
+ let conf = config(state, state.selection.main.head);
1441
+ let tokens = conf.brackets || defaults.brackets;
1442
+ let dont = null, changes = state.changeByRange(range => {
1443
+ if (range.empty) {
1444
+ let before = prevChar(state.doc, range.head);
1445
+ for (let token of tokens) {
1446
+ if (token == before && nextChar(state.doc, range.head) == closing(codePointAt(token, 0)))
1447
+ return { changes: { from: range.head - token.length, to: range.head + token.length },
1448
+ range: EditorSelection.cursor(range.head - token.length) };
1449
+ }
1450
+ }
1451
+ return { range: dont = range };
1452
+ });
1453
+ if (!dont)
1454
+ dispatch(state.update(changes, { scrollIntoView: true, userEvent: "delete.backward" }));
1455
+ return !dont;
1456
+ };
1457
+ /**
1458
+ Close-brackets related key bindings. Binds Backspace to
1459
+ [`deleteBracketPair`](https://codemirror.net/6/docs/ref/#autocomplete.deleteBracketPair).
1460
+ */
1461
+ const closeBracketsKeymap = [
1462
+ { key: "Backspace", run: deleteBracketPair }
1463
+ ];
1464
+ /**
1465
+ Implements the extension's behavior on text insertion. If the
1466
+ given string counts as a bracket in the language around the
1467
+ selection, and replacing the selection with it requires custom
1468
+ behavior (inserting a closing version or skipping past a
1469
+ previously-closed bracket), this function returns a transaction
1470
+ representing that custom behavior. (You only need this if you want
1471
+ to programmatically insert brackets—the
1472
+ [`closeBrackets`](https://codemirror.net/6/docs/ref/#autocomplete.closeBrackets) extension will
1473
+ take care of running this for user input.)
1474
+ */
1475
+ function insertBracket(state, bracket) {
1476
+ let conf = config(state, state.selection.main.head);
1477
+ let tokens = conf.brackets || defaults.brackets;
1478
+ for (let tok of tokens) {
1479
+ let closed = closing(codePointAt(tok, 0));
1480
+ if (bracket == tok)
1481
+ return closed == tok ? handleSame(state, tok, tokens.indexOf(tok + tok + tok) > -1, conf)
1482
+ : handleOpen(state, tok, closed, conf.before || defaults.before);
1483
+ if (bracket == closed && closedBracketAt(state, state.selection.main.from))
1484
+ return handleClose(state, tok, closed);
1485
+ }
1486
+ return null;
1487
+ }
1488
+ function closedBracketAt(state, pos) {
1489
+ let found = false;
1490
+ state.field(bracketState).between(0, state.doc.length, from => {
1491
+ if (from == pos)
1492
+ found = true;
1493
+ });
1494
+ return found;
1495
+ }
1496
+ function nextChar(doc, pos) {
1497
+ let next = doc.sliceString(pos, pos + 2);
1498
+ return next.slice(0, codePointSize(codePointAt(next, 0)));
1499
+ }
1500
+ function prevChar(doc, pos) {
1501
+ let prev = doc.sliceString(pos - 2, pos);
1502
+ return codePointSize(codePointAt(prev, 0)) == prev.length ? prev : prev.slice(1);
1503
+ }
1504
+ function handleOpen(state, open, close, closeBefore) {
1505
+ let dont = null, changes = state.changeByRange(range => {
1506
+ if (!range.empty)
1507
+ return { changes: [{ insert: open, from: range.from }, { insert: close, from: range.to }],
1508
+ effects: closeBracketEffect.of(range.to + open.length),
1509
+ range: EditorSelection.range(range.anchor + open.length, range.head + open.length) };
1510
+ let next = nextChar(state.doc, range.head);
1511
+ if (!next || /\s/.test(next) || closeBefore.indexOf(next) > -1)
1512
+ return { changes: { insert: open + close, from: range.head },
1513
+ effects: closeBracketEffect.of(range.head + open.length),
1514
+ range: EditorSelection.cursor(range.head + open.length) };
1515
+ return { range: dont = range };
1516
+ });
1517
+ return dont ? null : state.update(changes, {
1518
+ scrollIntoView: true,
1519
+ userEvent: "input.type"
1520
+ });
1521
+ }
1522
+ function handleClose(state, _open, close) {
1523
+ let dont = null, changes = state.changeByRange(range => {
1524
+ if (range.empty && nextChar(state.doc, range.head) == close)
1525
+ return { changes: { from: range.head, to: range.head + close.length, insert: close },
1526
+ range: EditorSelection.cursor(range.head + close.length) };
1527
+ return dont = { range };
1528
+ });
1529
+ return dont ? null : state.update(changes, {
1530
+ scrollIntoView: true,
1531
+ userEvent: "input.type"
1532
+ });
1533
+ }
1534
+ // Handles cases where the open and close token are the same, and
1535
+ // possibly triple quotes (as in `"""abc"""`-style quoting).
1536
+ function handleSame(state, token, allowTriple, config) {
1537
+ let stringPrefixes = config.stringPrefixes || defaults.stringPrefixes;
1538
+ let dont = null, changes = state.changeByRange(range => {
1539
+ if (!range.empty)
1540
+ return { changes: [{ insert: token, from: range.from }, { insert: token, from: range.to }],
1541
+ effects: closeBracketEffect.of(range.to + token.length),
1542
+ range: EditorSelection.range(range.anchor + token.length, range.head + token.length) };
1543
+ let pos = range.head, next = nextChar(state.doc, pos), start;
1544
+ if (next == token) {
1545
+ if (nodeStart(state, pos)) {
1546
+ return { changes: { insert: token + token, from: pos },
1547
+ effects: closeBracketEffect.of(pos + token.length),
1548
+ range: EditorSelection.cursor(pos + token.length) };
1549
+ }
1550
+ else if (closedBracketAt(state, pos)) {
1551
+ let isTriple = allowTriple && state.sliceDoc(pos, pos + token.length * 3) == token + token + token;
1552
+ let content = isTriple ? token + token + token : token;
1553
+ return { changes: { from: pos, to: pos + content.length, insert: content },
1554
+ range: EditorSelection.cursor(pos + content.length) };
1555
+ }
1556
+ }
1557
+ else if (allowTriple && state.sliceDoc(pos - 2 * token.length, pos) == token + token &&
1558
+ (start = canStartStringAt(state, pos - 2 * token.length, stringPrefixes)) > -1 &&
1559
+ nodeStart(state, start)) {
1560
+ return { changes: { insert: token + token + token + token, from: pos },
1561
+ effects: closeBracketEffect.of(pos + token.length),
1562
+ range: EditorSelection.cursor(pos + token.length) };
1563
+ }
1564
+ else if (state.charCategorizer(pos)(next) != CharCategory.Word) {
1565
+ if (canStartStringAt(state, pos, stringPrefixes) > -1 && !probablyInString(state, pos, token, stringPrefixes))
1566
+ return { changes: { insert: token + token, from: pos },
1567
+ effects: closeBracketEffect.of(pos + token.length),
1568
+ range: EditorSelection.cursor(pos + token.length) };
1569
+ }
1570
+ return { range: dont = range };
1571
+ });
1572
+ return dont ? null : state.update(changes, {
1573
+ scrollIntoView: true,
1574
+ userEvent: "input.type"
1575
+ });
1576
+ }
1577
+ function nodeStart(state, pos) {
1578
+ let tree = syntaxTree(state).resolveInner(pos + 1);
1579
+ return tree.parent && tree.from == pos;
1580
+ }
1581
+ function probablyInString(state, pos, quoteToken, prefixes) {
1582
+ let node = syntaxTree(state).resolveInner(pos, -1);
1583
+ let maxPrefix = prefixes.reduce((m, p) => Math.max(m, p.length), 0);
1584
+ for (let i = 0; i < 5; i++) {
1585
+ let start = state.sliceDoc(node.from, Math.min(node.to, node.from + quoteToken.length + maxPrefix));
1586
+ let quotePos = start.indexOf(quoteToken);
1587
+ if (!quotePos || quotePos > -1 && prefixes.indexOf(start.slice(0, quotePos)) > -1) {
1588
+ let first = node.firstChild;
1589
+ while (first && first.from == node.from && first.to - first.from > quoteToken.length + quotePos) {
1590
+ if (state.sliceDoc(first.to - quoteToken.length, first.to) == quoteToken)
1591
+ return false;
1592
+ first = first.firstChild;
1593
+ }
1594
+ return true;
1595
+ }
1596
+ let parent = node.to == pos && node.parent;
1597
+ if (!parent)
1598
+ break;
1599
+ node = parent;
1600
+ }
1601
+ return false;
1602
+ }
1603
+ function canStartStringAt(state, pos, prefixes) {
1604
+ let charCat = state.charCategorizer(pos);
1605
+ if (charCat(state.sliceDoc(pos - 1, pos)) != CharCategory.Word)
1606
+ return pos;
1607
+ for (let prefix of prefixes) {
1608
+ let start = pos - prefix.length;
1609
+ if (state.sliceDoc(start, pos) == prefix && charCat(state.sliceDoc(start - 1, start)) != CharCategory.Word)
1610
+ return start;
1611
+ }
1612
+ return -1;
1613
+ }
1614
+
1615
+ /**
1616
+ Returns an extension that enables autocompletion.
1617
+ */
1618
+ function autocompletion(config = {}) {
1619
+ return [
1620
+ commitCharacters,
1621
+ completionState,
1622
+ completionConfig.of(config),
1623
+ completionPlugin,
1624
+ completionKeymapExt,
1625
+ baseTheme
1626
+ ];
1627
+ }
1628
+ /**
1629
+ Basic keybindings for autocompletion.
1630
+
1631
+ - Ctrl-Space (and Alt-\` on macOS): [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)
1632
+ - Escape: [`closeCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.closeCompletion)
1633
+ - ArrowDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true)`
1634
+ - ArrowUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false)`
1635
+ - PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, "page")`
1636
+ - PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, "page")`
1637
+ - Enter: [`acceptCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.acceptCompletion)
1638
+ */
1639
+ const completionKeymap = [
1640
+ { key: "Ctrl-Space", run: startCompletion },
1641
+ { mac: "Alt-`", run: startCompletion },
1642
+ { key: "Escape", run: closeCompletion },
1643
+ { key: "ArrowDown", run: /*@__PURE__*/moveCompletionSelection(true) },
1644
+ { key: "ArrowUp", run: /*@__PURE__*/moveCompletionSelection(false) },
1645
+ { key: "PageDown", run: /*@__PURE__*/moveCompletionSelection(true, "page") },
1646
+ { key: "PageUp", run: /*@__PURE__*/moveCompletionSelection(false, "page") },
1647
+ { key: "Enter", run: acceptCompletion }
1648
+ ];
1649
+ const completionKeymapExt = /*@__PURE__*/Prec.highest(/*@__PURE__*/keymap.computeN([completionConfig], state => state.facet(completionConfig).defaultKeymap ? [completionKeymap] : []));
1650
+
1651
+ export { CompletionContext, acceptCompletion, autocompletion, closeBrackets, closeBracketsKeymap, closeCompletion, completeFromList, completionKeymap, deleteBracketPair, insertBracket, insertCompletionText, moveCompletionSelection, pickedCompletion, startCompletion };
1652
+ //# sourceMappingURL=index.js.map