@aleph-alpha/chat-kit 5.13.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/dist/{CkHistory.vue_vue_type_script_setup_true_lang-BNcJURkq.js → CkHistory.vue_vue_type_script_setup_true_lang-Cr8vF94e.js} +221 -115
  2. package/dist/adapters/responses-api.d.ts +1 -1
  3. package/dist/adapters/responses-api.d.ts.map +1 -1
  4. package/dist/adapters/responses-api.js +9 -7
  5. package/dist/apl-fqmucPXA.js +140 -0
  6. package/dist/asciiarmor-DucZyvP0.js +56 -0
  7. package/dist/asn1-BnOEsgAm.js +144 -0
  8. package/dist/asterisk-QAlztEwS.js +345 -0
  9. package/dist/brainfuck-DZVCuF_t.js +53 -0
  10. package/dist/chat-kit.css +1177 -12
  11. package/dist/clike-CTYGlS6x.js +799 -0
  12. package/dist/clojure-BhXMqnxz.js +849 -0
  13. package/dist/cmake-BGaNd9E7.js +71 -0
  14. package/dist/cobol-4yqQntpt.js +120 -0
  15. package/dist/coffeescript-D2dXvhEc.js +308 -0
  16. package/dist/commonlisp-CF_VNHQR.js +130 -0
  17. package/dist/components/base/CkHistoryItem/CkHistoryItem.vue.d.ts.map +1 -1
  18. package/dist/components/base/CkHistoryWrapper/CkHistoryWrapper.vue.d.ts.map +1 -1
  19. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts.map +1 -1
  20. package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.stories.d.ts +41 -0
  21. package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.stories.d.ts.map +1 -0
  22. package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.vue.d.ts +26 -0
  23. package/dist/components/base/CkMilkdownEditor/CkMilkdownEditor.vue.d.ts.map +1 -0
  24. package/dist/components/base/CkMilkdownEditor/codeMirrorTheme.d.ts +20 -0
  25. package/dist/components/base/CkMilkdownEditor/codeMirrorTheme.d.ts.map +1 -0
  26. package/dist/components/base/CkMilkdownEditor/createCrepeEditor.d.ts +42 -0
  27. package/dist/components/base/CkMilkdownEditor/createCrepeEditor.d.ts.map +1 -0
  28. package/dist/components/base/CkMilkdownEditor/crepeIcons.d.ts +33 -0
  29. package/dist/components/base/CkMilkdownEditor/crepeIcons.d.ts.map +1 -0
  30. package/dist/components/base/CkMilkdownEditor/index.d.ts +3 -0
  31. package/dist/components/base/CkMilkdownEditor/index.d.ts.map +1 -0
  32. package/dist/components/base/CkMilkdownEditor/markdownClassAttrs.d.ts +16 -0
  33. package/dist/components/base/CkMilkdownEditor/markdownClassAttrs.d.ts.map +1 -0
  34. package/dist/components/base/CkMilkdownEditor/types.d.ts +98 -0
  35. package/dist/components/base/CkMilkdownEditor/types.d.ts.map +1 -0
  36. package/dist/components/base/index.d.ts +2 -0
  37. package/dist/components/base/index.d.ts.map +1 -1
  38. package/dist/components/index.d.ts +2 -2
  39. package/dist/components/index.d.ts.map +1 -1
  40. package/dist/components/index.js +12 -11
  41. package/dist/composables/fileUpload/useFileUpload.d.ts.map +1 -1
  42. package/dist/composables/index.js +1 -1
  43. package/dist/composables/useChat.d.ts.map +1 -1
  44. package/dist/composables/useConversations.d.ts.map +1 -1
  45. package/dist/createCrepeEditor-CFbvSH3s.js +74141 -0
  46. package/dist/crystal-DyuLTqLs.js +398 -0
  47. package/dist/css-DkSyTW67.js +1772 -0
  48. package/dist/cypher-Dlu_3r4V.js +121 -0
  49. package/dist/d-UURgV0Ux.js +179 -0
  50. package/dist/diff-B_Bi2Crb.js +25 -0
  51. package/dist/dockerfile-Bvk733Ga.js +201 -0
  52. package/dist/dtd-Dy74G54E.js +114 -0
  53. package/dist/dylan-TSb-Nfix.js +314 -0
  54. package/dist/ebnf-4fKAGW3a.js +140 -0
  55. package/dist/ecl-B59qGGVg.js +178 -0
  56. package/dist/eiffel-Dze7nlu3.js +134 -0
  57. package/dist/elm-DG7jkhNZ.js +176 -0
  58. package/dist/erlang-BO6gOnGA.js +674 -0
  59. package/dist/factor-CMxFHDqz.js +65 -0
  60. package/dist/fcl-CDDUNjTj.js +141 -0
  61. package/dist/forth-B9D2JCeE.js +116 -0
  62. package/dist/fortran-CAG2BFbe.js +467 -0
  63. package/dist/gas-0Aw8zDr5.js +293 -0
  64. package/dist/gherkin-DhZlEZiy.js +115 -0
  65. package/dist/groovy-CpwJiBl7.js +223 -0
  66. package/dist/handlers/index.js +1 -1
  67. package/dist/handlers/useChatKitLabels.d.ts +62 -1
  68. package/dist/handlers/useChatKitLabels.d.ts.map +1 -1
  69. package/dist/haskell-ySd-OUo8.js +459 -0
  70. package/dist/haxe-7MlzfeYV.js +514 -0
  71. package/dist/http-BqypyemW.js +79 -0
  72. package/dist/idl-4HIGJlDI.js +985 -0
  73. package/dist/index-A5rWjRtZ.js +689 -0
  74. package/dist/index-B0ldhzaj.js +385 -0
  75. package/dist/index-BVOjyn3y.js +2490 -0
  76. package/dist/index-BWvkps_G.js +309 -0
  77. package/dist/index-BaS8OW8V.js +151 -0
  78. package/dist/index-BlHHEbV-.js +406 -0
  79. package/dist/index-BoqzHVNB.js +82 -0
  80. package/dist/index-C6zYjwIQ.js +704 -0
  81. package/dist/{index-Dn4ctxk8.js → index-C72e57-5.js} +48 -24
  82. package/dist/index-CMJGuXap.js +330 -0
  83. package/dist/index-CRfGWVdQ.js +116 -0
  84. package/dist/index-C_gTb50u.js +81 -0
  85. package/dist/index-DSU7cBGz.js +178 -0
  86. package/dist/index-DSq3gvqU.js +1767 -0
  87. package/dist/index-Da3777l2.js +289 -0
  88. package/dist/index-DdlzabmR.js +1021 -0
  89. package/dist/index-DhY_9bdS.js +61 -0
  90. package/dist/index-Dm6C1blN.js +1052 -0
  91. package/dist/index-Tj3pzx-E.js +327 -0
  92. package/dist/index-ZeRS5rER.js +97 -0
  93. package/dist/index-gzleljO6.js +157 -0
  94. package/dist/index-naWlQpaL.js +642 -0
  95. package/dist/index-sKO1lHHC.js +312 -0
  96. package/dist/index.d.ts +2 -2
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +15 -14
  99. package/dist/javascript-Bt8B7yTi.js +992 -0
  100. package/dist/julia-Bs6JJhYG.js +407 -0
  101. package/dist/livescript-DmzgM3Yt.js +296 -0
  102. package/dist/lua-Cvg8VrAA.js +256 -0
  103. package/dist/mathematica-DNLOL9PQ.js +110 -0
  104. package/dist/mbox-Ga7d4MMN.js +117 -0
  105. package/dist/mirc-Dma3B8rS.js +107 -0
  106. package/dist/mllike-DHn7xckP.js +334 -0
  107. package/dist/modelica-0d55jYY0.js +147 -0
  108. package/dist/mscgen-DdqZYINH.js +135 -0
  109. package/dist/mumps-Btr8VblO.js +93 -0
  110. package/dist/nginx-DTDtBDVN.js +141 -0
  111. package/dist/nsis-CyKBdPWp.js +62 -0
  112. package/dist/ntriples-CvgOYMpL.js +153 -0
  113. package/dist/octave-DYBj3-tl.js +200 -0
  114. package/dist/oz-R_e8WMIi.js +231 -0
  115. package/dist/pascal-GD8iposT.js +105 -0
  116. package/dist/perl-DL9mHpoi.js +1105 -0
  117. package/dist/pig-C_4T4YIV.js +101 -0
  118. package/dist/powershell-B0suO7Vd.js +328 -0
  119. package/dist/properties-BR-vP1aU.js +58 -0
  120. package/dist/protobuf-BxgpyhoW.js +77 -0
  121. package/dist/pug-vHnWR0UE.js +405 -0
  122. package/dist/puppet-Bdao66PW.js +137 -0
  123. package/dist/python-BFGRmuZ9.js +426 -0
  124. package/dist/q-CrbCVq4a.js +131 -0
  125. package/dist/r-V7nswm59.js +170 -0
  126. package/dist/rpm-C-DLY-If.js +109 -0
  127. package/dist/ruby-CQTpZw6f.js +331 -0
  128. package/dist/sas-D2UG-yhZ.js +207 -0
  129. package/dist/scheme-BKzrkGJD.js +222 -0
  130. package/dist/shell-BlsXDxCn.js +222 -0
  131. package/dist/sieve-CjwBwOY5.js +135 -0
  132. package/dist/simple-mode-DMneyfDu.js +130 -0
  133. package/dist/smalltalk-BOIGQuhN.js +121 -0
  134. package/dist/solr-CwD7U71z.js +69 -0
  135. package/dist/sparql-DYskk2vE.js +249 -0
  136. package/dist/spreadsheet-Bgtt3oLP.js +87 -0
  137. package/dist/sql-Cei9CMfk.js +342 -0
  138. package/dist/stex-C1nZSzAw.js +230 -0
  139. package/dist/stylus-BkS-boTH.js +565 -0
  140. package/dist/swift-FRZi1uvB.js +291 -0
  141. package/dist/tcl-CUcaCdmq.js +114 -0
  142. package/dist/test-utils/createTextPlugin.d.ts +7 -1
  143. package/dist/test-utils/createTextPlugin.d.ts.map +1 -1
  144. package/dist/textile-BnFpjsrl.js +414 -0
  145. package/dist/tiddlywiki-CjprD-Qp.js +218 -0
  146. package/dist/tiki-DK9DOeWn.js +268 -0
  147. package/dist/toml-BOuWGMcf.js +76 -0
  148. package/dist/troff-E1bJ0PPL.js +61 -0
  149. package/dist/ttcn-cfg-Dc39-fIP.js +133 -0
  150. package/dist/ttcn-tKd4HLu4.js +192 -0
  151. package/dist/turtle-Dq7-1WAf.js +124 -0
  152. package/dist/{useChatKitLabels-CMOr3Kjq.js → useChatKitLabels-Ww1Q7xUr.js} +26 -3
  153. package/dist/vb-Dp90gtsv.js +196 -0
  154. package/dist/vbscript-Bfn8O8I7.js +478 -0
  155. package/dist/velocity-BwIZK1TH.js +149 -0
  156. package/dist/verilog-CnT9bMk0.js +429 -0
  157. package/dist/vhdl-DCkMIyT9.js +158 -0
  158. package/dist/webidl-BTLTThCm.js +204 -0
  159. package/dist/xquery-BrBUuxMR.js +525 -0
  160. package/dist/yacas-b5lAVEIl.js +130 -0
  161. package/dist/z80-ClgwfNdB.js +92 -0
  162. package/package.json +11 -5
  163. package/src/adapters/responses-api.spec.ts +86 -0
  164. package/src/adapters/responses-api.ts +13 -9
  165. package/src/components/base/CkCitationCard/CkCitationCard.vue +1 -1
  166. package/src/components/base/CkCitationLabel/CkCitationLabel.vue +1 -1
  167. package/src/components/base/CkConversationLayout/CkConversationLayout.spec.ts +1 -5
  168. package/src/components/base/CkCopyMessageButton/CkCopyMessageButton.spec.ts +1 -1
  169. package/src/components/base/CkFeedbackButton/CkFeedbackButton.vue +3 -3
  170. package/src/components/base/CkFeedbackDialog/CkFeedbackDialog.vue +9 -9
  171. package/src/components/base/CkHistoryItem/CkHistoryItem.vue +5 -7
  172. package/src/components/base/CkHistoryWrapper/CkHistoryWrapper.vue +2 -1
  173. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.ts +9 -4
  174. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue +1 -1
  175. package/src/components/base/CkMilkdownEditor/CkMilkdownEditor.spec.ts +221 -0
  176. package/src/components/base/CkMilkdownEditor/CkMilkdownEditor.stories.ts +274 -0
  177. package/src/components/base/CkMilkdownEditor/CkMilkdownEditor.vue +151 -0
  178. package/src/components/base/CkMilkdownEditor/codeMirrorTheme.ts +132 -0
  179. package/src/components/base/CkMilkdownEditor/createCrepeEditor.ts +192 -0
  180. package/src/components/base/CkMilkdownEditor/crepeIcons.ts +77 -0
  181. package/src/components/base/CkMilkdownEditor/index.ts +2 -0
  182. package/src/components/base/CkMilkdownEditor/markdownClassAttrs.ts +64 -0
  183. package/src/components/base/CkMilkdownEditor/milkdown-theme.css +441 -0
  184. package/src/components/base/CkMilkdownEditor/types.ts +100 -0
  185. package/src/components/base/CkModelSelector/CkModelSelector.vue +3 -3
  186. package/src/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.stories.ts +2 -2
  187. package/src/components/base/index.ts +6 -0
  188. package/src/components/index.ts +4 -0
  189. package/src/composables/fileUpload/useFileUpload.ts +45 -30
  190. package/src/composables/fileUpload/useFileUploadWrapper.spec.ts +1 -1
  191. package/src/composables/fileUpload/useFileUploadWrapper.ts +3 -3
  192. package/src/composables/useChat.ts +3 -1
  193. package/src/composables/useConversations.ts +8 -5
  194. package/src/handlers/useChatKitLabels.spec.ts +0 -1
  195. package/src/handlers/useChatKitLabels.ts +29 -2
  196. package/src/handlers/useMarkdownParser.ts +1 -1
  197. package/src/index.ts +4 -0
  198. package/src/test-setup.ts +3 -3
  199. package/src/test-utils/createTextPlugin.ts +11 -3
@@ -0,0 +1,405 @@
1
+ import { javascript } from "./javascript-Bt8B7yTi.js";
2
+ var ATTRS_NEST = {
3
+ "{": "}",
4
+ "(": ")",
5
+ "[": "]"
6
+ };
7
+ function defaultCopyState(state) {
8
+ if (typeof state != "object") return state;
9
+ let newState = {};
10
+ for (let prop in state) {
11
+ let val = state[prop];
12
+ newState[prop] = val instanceof Array ? val.slice() : val;
13
+ }
14
+ return newState;
15
+ }
16
+ class State {
17
+ constructor(indentUnit) {
18
+ this.indentUnit = indentUnit;
19
+ this.javaScriptLine = false;
20
+ this.javaScriptLineExcludesColon = false;
21
+ this.javaScriptArguments = false;
22
+ this.javaScriptArgumentsDepth = 0;
23
+ this.isInterpolating = false;
24
+ this.interpolationNesting = 0;
25
+ this.jsState = javascript.startState(indentUnit);
26
+ this.restOfLine = "";
27
+ this.isIncludeFiltered = false;
28
+ this.isEach = false;
29
+ this.lastTag = "";
30
+ this.isAttrs = false;
31
+ this.attrsNest = [];
32
+ this.inAttributeName = true;
33
+ this.attributeIsType = false;
34
+ this.attrValue = "";
35
+ this.indentOf = Infinity;
36
+ this.indentToken = "";
37
+ }
38
+ copy() {
39
+ var res = new State(this.indentUnit);
40
+ res.javaScriptLine = this.javaScriptLine;
41
+ res.javaScriptLineExcludesColon = this.javaScriptLineExcludesColon;
42
+ res.javaScriptArguments = this.javaScriptArguments;
43
+ res.javaScriptArgumentsDepth = this.javaScriptArgumentsDepth;
44
+ res.isInterpolating = this.isInterpolating;
45
+ res.interpolationNesting = this.interpolationNesting;
46
+ res.jsState = (javascript.copyState || defaultCopyState)(this.jsState);
47
+ res.restOfLine = this.restOfLine;
48
+ res.isIncludeFiltered = this.isIncludeFiltered;
49
+ res.isEach = this.isEach;
50
+ res.lastTag = this.lastTag;
51
+ res.isAttrs = this.isAttrs;
52
+ res.attrsNest = this.attrsNest.slice();
53
+ res.inAttributeName = this.inAttributeName;
54
+ res.attributeIsType = this.attributeIsType;
55
+ res.attrValue = this.attrValue;
56
+ res.indentOf = this.indentOf;
57
+ res.indentToken = this.indentToken;
58
+ return res;
59
+ }
60
+ }
61
+ function javaScript(stream, state) {
62
+ if (stream.sol()) {
63
+ state.javaScriptLine = false;
64
+ state.javaScriptLineExcludesColon = false;
65
+ }
66
+ if (state.javaScriptLine) {
67
+ if (state.javaScriptLineExcludesColon && stream.peek() === ":") {
68
+ state.javaScriptLine = false;
69
+ state.javaScriptLineExcludesColon = false;
70
+ return;
71
+ }
72
+ var tok = javascript.token(stream, state.jsState);
73
+ if (stream.eol()) state.javaScriptLine = false;
74
+ return tok || true;
75
+ }
76
+ }
77
+ function javaScriptArguments(stream, state) {
78
+ if (state.javaScriptArguments) {
79
+ if (state.javaScriptArgumentsDepth === 0 && stream.peek() !== "(") {
80
+ state.javaScriptArguments = false;
81
+ return;
82
+ }
83
+ if (stream.peek() === "(") {
84
+ state.javaScriptArgumentsDepth++;
85
+ } else if (stream.peek() === ")") {
86
+ state.javaScriptArgumentsDepth--;
87
+ }
88
+ if (state.javaScriptArgumentsDepth === 0) {
89
+ state.javaScriptArguments = false;
90
+ return;
91
+ }
92
+ var tok = javascript.token(stream, state.jsState);
93
+ return tok || true;
94
+ }
95
+ }
96
+ function yieldStatement(stream) {
97
+ if (stream.match(/^yield\b/)) {
98
+ return "keyword";
99
+ }
100
+ }
101
+ function doctype(stream) {
102
+ if (stream.match(/^(?:doctype) *([^\n]+)?/)) return "meta";
103
+ }
104
+ function interpolation(stream, state) {
105
+ if (stream.match("#{")) {
106
+ state.isInterpolating = true;
107
+ state.interpolationNesting = 0;
108
+ return "punctuation";
109
+ }
110
+ }
111
+ function interpolationContinued(stream, state) {
112
+ if (state.isInterpolating) {
113
+ if (stream.peek() === "}") {
114
+ state.interpolationNesting--;
115
+ if (state.interpolationNesting < 0) {
116
+ stream.next();
117
+ state.isInterpolating = false;
118
+ return "punctuation";
119
+ }
120
+ } else if (stream.peek() === "{") {
121
+ state.interpolationNesting++;
122
+ }
123
+ return javascript.token(stream, state.jsState) || true;
124
+ }
125
+ }
126
+ function caseStatement(stream, state) {
127
+ if (stream.match(/^case\b/)) {
128
+ state.javaScriptLine = true;
129
+ return "keyword";
130
+ }
131
+ }
132
+ function when(stream, state) {
133
+ if (stream.match(/^when\b/)) {
134
+ state.javaScriptLine = true;
135
+ state.javaScriptLineExcludesColon = true;
136
+ return "keyword";
137
+ }
138
+ }
139
+ function defaultStatement(stream) {
140
+ if (stream.match(/^default\b/)) {
141
+ return "keyword";
142
+ }
143
+ }
144
+ function extendsStatement(stream, state) {
145
+ if (stream.match(/^extends?\b/)) {
146
+ state.restOfLine = "string";
147
+ return "keyword";
148
+ }
149
+ }
150
+ function append(stream, state) {
151
+ if (stream.match(/^append\b/)) {
152
+ state.restOfLine = "variable";
153
+ return "keyword";
154
+ }
155
+ }
156
+ function prepend(stream, state) {
157
+ if (stream.match(/^prepend\b/)) {
158
+ state.restOfLine = "variable";
159
+ return "keyword";
160
+ }
161
+ }
162
+ function block(stream, state) {
163
+ if (stream.match(/^block\b *(?:(prepend|append)\b)?/)) {
164
+ state.restOfLine = "variable";
165
+ return "keyword";
166
+ }
167
+ }
168
+ function include(stream, state) {
169
+ if (stream.match(/^include\b/)) {
170
+ state.restOfLine = "string";
171
+ return "keyword";
172
+ }
173
+ }
174
+ function includeFiltered(stream, state) {
175
+ if (stream.match(/^include:([a-zA-Z0-9\-]+)/, false) && stream.match("include")) {
176
+ state.isIncludeFiltered = true;
177
+ return "keyword";
178
+ }
179
+ }
180
+ function includeFilteredContinued(stream, state) {
181
+ if (state.isIncludeFiltered) {
182
+ var tok = filter(stream, state);
183
+ state.isIncludeFiltered = false;
184
+ state.restOfLine = "string";
185
+ return tok;
186
+ }
187
+ }
188
+ function mixin(stream, state) {
189
+ if (stream.match(/^mixin\b/)) {
190
+ state.javaScriptLine = true;
191
+ return "keyword";
192
+ }
193
+ }
194
+ function call(stream, state) {
195
+ if (stream.match(/^\+([-\w]+)/)) {
196
+ if (!stream.match(/^\( *[-\w]+ *=/, false)) {
197
+ state.javaScriptArguments = true;
198
+ state.javaScriptArgumentsDepth = 0;
199
+ }
200
+ return "variable";
201
+ }
202
+ if (stream.match("+#{", false)) {
203
+ stream.next();
204
+ state.mixinCallAfter = true;
205
+ return interpolation(stream, state);
206
+ }
207
+ }
208
+ function callArguments(stream, state) {
209
+ if (state.mixinCallAfter) {
210
+ state.mixinCallAfter = false;
211
+ if (!stream.match(/^\( *[-\w]+ *=/, false)) {
212
+ state.javaScriptArguments = true;
213
+ state.javaScriptArgumentsDepth = 0;
214
+ }
215
+ return true;
216
+ }
217
+ }
218
+ function conditional(stream, state) {
219
+ if (stream.match(/^(if|unless|else if|else)\b/)) {
220
+ state.javaScriptLine = true;
221
+ return "keyword";
222
+ }
223
+ }
224
+ function each(stream, state) {
225
+ if (stream.match(/^(- *)?(each|for)\b/)) {
226
+ state.isEach = true;
227
+ return "keyword";
228
+ }
229
+ }
230
+ function eachContinued(stream, state) {
231
+ if (state.isEach) {
232
+ if (stream.match(/^ in\b/)) {
233
+ state.javaScriptLine = true;
234
+ state.isEach = false;
235
+ return "keyword";
236
+ } else if (stream.sol() || stream.eol()) {
237
+ state.isEach = false;
238
+ } else if (stream.next()) {
239
+ while (!stream.match(/^ in\b/, false) && stream.next()) {
240
+ }
241
+ return "variable";
242
+ }
243
+ }
244
+ }
245
+ function whileStatement(stream, state) {
246
+ if (stream.match(/^while\b/)) {
247
+ state.javaScriptLine = true;
248
+ return "keyword";
249
+ }
250
+ }
251
+ function tag(stream, state) {
252
+ var captures;
253
+ if (captures = stream.match(/^(\w(?:[-:\w]*\w)?)\/?/)) {
254
+ state.lastTag = captures[1].toLowerCase();
255
+ return "tag";
256
+ }
257
+ }
258
+ function filter(stream, state) {
259
+ if (stream.match(/^:([\w\-]+)/)) {
260
+ setStringMode(stream, state);
261
+ return "atom";
262
+ }
263
+ }
264
+ function code(stream, state) {
265
+ if (stream.match(/^(!?=|-)/)) {
266
+ state.javaScriptLine = true;
267
+ return "punctuation";
268
+ }
269
+ }
270
+ function id(stream) {
271
+ if (stream.match(/^#([\w-]+)/)) {
272
+ return "builtin";
273
+ }
274
+ }
275
+ function className(stream) {
276
+ if (stream.match(/^\.([\w-]+)/)) {
277
+ return "className";
278
+ }
279
+ }
280
+ function attrs(stream, state) {
281
+ if (stream.peek() == "(") {
282
+ stream.next();
283
+ state.isAttrs = true;
284
+ state.attrsNest = [];
285
+ state.inAttributeName = true;
286
+ state.attrValue = "";
287
+ state.attributeIsType = false;
288
+ return "punctuation";
289
+ }
290
+ }
291
+ function attrsContinued(stream, state) {
292
+ if (state.isAttrs) {
293
+ if (ATTRS_NEST[stream.peek()]) {
294
+ state.attrsNest.push(ATTRS_NEST[stream.peek()]);
295
+ }
296
+ if (state.attrsNest[state.attrsNest.length - 1] === stream.peek()) {
297
+ state.attrsNest.pop();
298
+ } else if (stream.eat(")")) {
299
+ state.isAttrs = false;
300
+ return "punctuation";
301
+ }
302
+ if (state.inAttributeName && stream.match(/^[^=,\)!]+/)) {
303
+ if (stream.peek() === "=" || stream.peek() === "!") {
304
+ state.inAttributeName = false;
305
+ state.jsState = javascript.startState(2);
306
+ if (state.lastTag === "script" && stream.current().trim().toLowerCase() === "type") {
307
+ state.attributeIsType = true;
308
+ } else {
309
+ state.attributeIsType = false;
310
+ }
311
+ }
312
+ return "attribute";
313
+ }
314
+ var tok = javascript.token(stream, state.jsState);
315
+ if (state.attrsNest.length === 0 && (tok === "string" || tok === "variable" || tok === "keyword")) {
316
+ try {
317
+ Function("", "var x " + state.attrValue.replace(/,\s*$/, "").replace(/^!/, ""));
318
+ state.inAttributeName = true;
319
+ state.attrValue = "";
320
+ stream.backUp(stream.current().length);
321
+ return attrsContinued(stream, state);
322
+ } catch (ex) {
323
+ }
324
+ }
325
+ state.attrValue += stream.current();
326
+ return tok || true;
327
+ }
328
+ }
329
+ function attributesBlock(stream, state) {
330
+ if (stream.match(/^&attributes\b/)) {
331
+ state.javaScriptArguments = true;
332
+ state.javaScriptArgumentsDepth = 0;
333
+ return "keyword";
334
+ }
335
+ }
336
+ function indent(stream) {
337
+ if (stream.sol() && stream.eatSpace()) {
338
+ return "indent";
339
+ }
340
+ }
341
+ function comment(stream, state) {
342
+ if (stream.match(/^ *\/\/(-)?([^\n]*)/)) {
343
+ state.indentOf = stream.indentation();
344
+ state.indentToken = "comment";
345
+ return "comment";
346
+ }
347
+ }
348
+ function colon(stream) {
349
+ if (stream.match(/^: */)) {
350
+ return "colon";
351
+ }
352
+ }
353
+ function text(stream, state) {
354
+ if (stream.match(/^(?:\| ?| )([^\n]+)/)) {
355
+ return "string";
356
+ }
357
+ if (stream.match(/^(<[^\n]*)/, false)) {
358
+ setStringMode(stream, state);
359
+ stream.skipToEnd();
360
+ return state.indentToken;
361
+ }
362
+ }
363
+ function dot(stream, state) {
364
+ if (stream.eat(".")) {
365
+ setStringMode(stream, state);
366
+ return "dot";
367
+ }
368
+ }
369
+ function fail(stream) {
370
+ stream.next();
371
+ return null;
372
+ }
373
+ function setStringMode(stream, state) {
374
+ state.indentOf = stream.indentation();
375
+ state.indentToken = "string";
376
+ }
377
+ function restOfLine(stream, state) {
378
+ if (stream.sol()) {
379
+ state.restOfLine = "";
380
+ }
381
+ if (state.restOfLine) {
382
+ stream.skipToEnd();
383
+ var tok = state.restOfLine;
384
+ state.restOfLine = "";
385
+ return tok;
386
+ }
387
+ }
388
+ function startState(indentUnit) {
389
+ return new State(indentUnit);
390
+ }
391
+ function copyState(state) {
392
+ return state.copy();
393
+ }
394
+ function nextToken(stream, state) {
395
+ var tok = restOfLine(stream, state) || interpolationContinued(stream, state) || includeFilteredContinued(stream, state) || eachContinued(stream, state) || attrsContinued(stream, state) || javaScript(stream, state) || javaScriptArguments(stream, state) || callArguments(stream, state) || yieldStatement(stream) || doctype(stream) || interpolation(stream, state) || caseStatement(stream, state) || when(stream, state) || defaultStatement(stream) || extendsStatement(stream, state) || append(stream, state) || prepend(stream, state) || block(stream, state) || include(stream, state) || includeFiltered(stream, state) || mixin(stream, state) || call(stream, state) || conditional(stream, state) || each(stream, state) || whileStatement(stream, state) || tag(stream, state) || filter(stream, state) || code(stream, state) || id(stream) || className(stream) || attrs(stream, state) || attributesBlock(stream, state) || indent(stream) || text(stream, state) || comment(stream, state) || colon(stream) || dot(stream, state) || fail(stream);
396
+ return tok === true ? null : tok;
397
+ }
398
+ const pug = {
399
+ startState,
400
+ copyState,
401
+ token: nextToken
402
+ };
403
+ export {
404
+ pug
405
+ };
@@ -0,0 +1,137 @@
1
+ var words = {};
2
+ var variable_regex = /({)?([a-z][a-z0-9_]*)?((::[a-z][a-z0-9_]*)*::)?[a-zA-Z0-9_]+(})?/;
3
+ function define(style, string) {
4
+ var split = string.split(" ");
5
+ for (var i = 0; i < split.length; i++) {
6
+ words[split[i]] = style;
7
+ }
8
+ }
9
+ define("keyword", "class define site node include import inherits");
10
+ define("keyword", "case if else in and elsif default or");
11
+ define("atom", "false true running present absent file directory undef");
12
+ define("builtin", "action augeas burst chain computer cron destination dport exec file filebucket group host icmp iniface interface jump k5login limit log_level log_prefix macauthorization mailalias maillist mcx mount nagios_command nagios_contact nagios_contactgroup nagios_host nagios_hostdependency nagios_hostescalation nagios_hostextinfo nagios_hostgroup nagios_service nagios_servicedependency nagios_serviceescalation nagios_serviceextinfo nagios_servicegroup nagios_timeperiod name notify outiface package proto reject resources router schedule scheduled_task selboolean selmodule service source sport ssh_authorized_key sshkey stage state table tidy todest toports tosource user vlan yumrepo zfs zone zpool");
13
+ function tokenString(stream, state) {
14
+ var current, prev, found_var = false;
15
+ while (!stream.eol() && (current = stream.next()) != state.pending) {
16
+ if (current === "$" && prev != "\\" && state.pending == '"') {
17
+ found_var = true;
18
+ break;
19
+ }
20
+ prev = current;
21
+ }
22
+ if (found_var) {
23
+ stream.backUp(1);
24
+ }
25
+ if (current == state.pending) {
26
+ state.continueString = false;
27
+ } else {
28
+ state.continueString = true;
29
+ }
30
+ return "string";
31
+ }
32
+ function tokenize(stream, state) {
33
+ var word = stream.match(/[\w]+/, false);
34
+ var attribute = stream.match(/(\s+)?\w+\s+=>.*/, false);
35
+ var resource = stream.match(/(\s+)?[\w:_]+(\s+)?{/, false);
36
+ var special_resource = stream.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/, false);
37
+ var ch = stream.next();
38
+ if (ch === "$") {
39
+ if (stream.match(variable_regex)) {
40
+ return state.continueString ? "variableName.special" : "variable";
41
+ }
42
+ return "error";
43
+ }
44
+ if (state.continueString) {
45
+ stream.backUp(1);
46
+ return tokenString(stream, state);
47
+ }
48
+ if (state.inDefinition) {
49
+ if (stream.match(/(\s+)?[\w:_]+(\s+)?/)) {
50
+ return "def";
51
+ }
52
+ stream.match(/\s+{/);
53
+ state.inDefinition = false;
54
+ }
55
+ if (state.inInclude) {
56
+ stream.match(/(\s+)?\S+(\s+)?/);
57
+ state.inInclude = false;
58
+ return "def";
59
+ }
60
+ if (stream.match(/(\s+)?\w+\(/)) {
61
+ stream.backUp(1);
62
+ return "def";
63
+ }
64
+ if (attribute) {
65
+ stream.match(/(\s+)?\w+/);
66
+ return "tag";
67
+ }
68
+ if (word && words.hasOwnProperty(word)) {
69
+ stream.backUp(1);
70
+ stream.match(/[\w]+/);
71
+ if (stream.match(/\s+\S+\s+{/, false)) {
72
+ state.inDefinition = true;
73
+ }
74
+ if (word == "include") {
75
+ state.inInclude = true;
76
+ }
77
+ return words[word];
78
+ }
79
+ if (/(^|\s+)[A-Z][\w:_]+/.test(word)) {
80
+ stream.backUp(1);
81
+ stream.match(/(^|\s+)[A-Z][\w:_]+/);
82
+ return "def";
83
+ }
84
+ if (resource) {
85
+ stream.match(/(\s+)?[\w:_]+/);
86
+ return "def";
87
+ }
88
+ if (special_resource) {
89
+ stream.match(/(\s+)?[@]{1,2}/);
90
+ return "atom";
91
+ }
92
+ if (ch == "#") {
93
+ stream.skipToEnd();
94
+ return "comment";
95
+ }
96
+ if (ch == "'" || ch == '"') {
97
+ state.pending = ch;
98
+ return tokenString(stream, state);
99
+ }
100
+ if (ch == "{" || ch == "}") {
101
+ return "bracket";
102
+ }
103
+ if (ch == "/") {
104
+ stream.match(/^[^\/]*\//);
105
+ return "string.special";
106
+ }
107
+ if (ch.match(/[0-9]/)) {
108
+ stream.eatWhile(/[0-9]+/);
109
+ return "number";
110
+ }
111
+ if (ch == "=") {
112
+ if (stream.peek() == ">") {
113
+ stream.next();
114
+ }
115
+ return "operator";
116
+ }
117
+ stream.eatWhile(/[\w-]/);
118
+ return null;
119
+ }
120
+ const puppet = {
121
+ name: "puppet",
122
+ startState: function() {
123
+ var state = {};
124
+ state.inDefinition = false;
125
+ state.inInclude = false;
126
+ state.continueString = false;
127
+ state.pending = false;
128
+ return state;
129
+ },
130
+ token: function(stream, state) {
131
+ if (stream.eatSpace()) return null;
132
+ return tokenize(stream, state);
133
+ }
134
+ };
135
+ export {
136
+ puppet
137
+ };