PageSourceSearch

https://evoml.ai/assets/monaco/dev/vs/basic-languages/handlebars/handlebars.js

js evoml.ai collected 2026-10-05 12:07:11 UTC 14,478 bytes, 481 lines download raw bytes

1/*!-----------------------------------------------------------------------------
2 * Copyright (c) Microsoft Corporation. All rights reserved.
3 * Version: 0.52.0(f6dc0eb8fce67e57f6036f4769d92c1666cdf546)
4 * Released under the MIT license
5 * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
6 *-----------------------------------------------------------------------------*/
7define("vs/basic-languages/handlebars/handlebars", ["require"],(require)=>{
8"use strict";
9var moduleExports = (() => {
10  var __create = Object.create;
11  var __defProp = Object.defineProperty;
12  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13  var __getOwnPropNames = Object.getOwnPropertyNames;
14  var __getProtoOf = Object.getPrototypeOf;
15  var __hasOwnProp = Object.prototype.hasOwnProperty;
16  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
17    get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
18  }) : x)(function(x) {
19    if (typeof require !== "undefined")
20      return require.apply(this, arguments);
21    throw Error('Dynamic require of "' + x + '" is not supported');
22  });
23  var __commonJS = (cb, mod) => function __require2() {
24    return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
25  };
26  var __export = (target, all) => {
27    for (var name in all)
28      __defProp(target, name, { get: all[name], enumerable: true });
29  };
30  var __copyProps = (to, from, except, desc) => {
31    if (from && typeof from === "object" || typeof from === "function") {
32      for (let key of __getOwnPropNames(from))
33        if (!__hasOwnProp.call(to, key) && key !== except)
34          __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
35    }
36    return to;
37  };
38  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
39  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
40    // If the importer is in node compatibility mode or this is not an ESM
41    // file that has been converted to a CommonJS file using a Babel-
42    // compatible transform (i.e. "__esModule" has not been set), then set
43    // "default" to the CommonJS "module.exports" for node compatibility.
44    isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
45    mod
46  ));
47  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
48
49  
49// src/fillers/monaco-editor-core-amd.ts
50  var require_monaco_editor_core_amd = __commonJS({
51    "src/fillers/monaco-editor-core-amd.ts"(exports, module) {
52      var api = __toESM(__require("vs/editor/editor.api"));
53      module.exports = api;
54    }
55  });
56
57  
57// src/basic-languages/handlebars/handlebars.ts
58  var handlebars_exports = {};
59  __export(handlebars_exports, {
60    conf: () => conf,
61    language: () => language
62  });
63
64  
64// src/fillers/monaco-editor-core.ts
65  var monaco_editor_core_exports = {};
66  __reExport(monaco_editor_core_exports, __toESM(require_monaco_editor_core_amd()));
67
68  
vendor: 11,242 bytes, lines 68-481
68// src/basic-languages/handlebars/handlebars.ts
69  var EMPTY_ELEMENTS = [
70    "area",
71    "base",
72    "br",
73    "col",
74    "embed",
75    "hr",
76    "img",
77    "input",
78    "keygen",
79    "link",
80    "menuitem",
81    "meta",
82    "param",
83    "source",
84    "track",
85    "wbr"
86  ];
87  var conf = {
88    wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
89    comments: {
90      blockComment: ["{{!--", "--}}"]
91    },
92    brackets: [
93      ["<!--", "-->"],
94      ["<", ">"],
95      ["{{", "}}"],
96      ["{", "}"],
97      ["(", ")"]
98    ],
99    autoClosingPairs: [
100      { open: "{", close: "}" },
101      { open: "[", close: "]" },
102      { open: "(", close: ")" },
103      { open: '"', close: '"' },
104      { open: "'", close: "'" }
105    ],
106    surroundingPairs: [
107      { open: "<", close: ">" },
108      { open: '"', close: '"' },
109      { open: "'", close: "'" }
110    ],
111    onEnterRules: [
112      {
113        beforeText: new RegExp(
114          `<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
115          "i"
116        ),
117        afterText: /^<\/(\w[\w\d]*)\s*>$/i,
118        action: {
119          indentAction: monaco_editor_core_exports.languages.IndentAction.IndentOutdent
120        }
121      },
122      {
123        beforeText: new RegExp(
124          `<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
125          "i"
126        ),
127        action: { indentAction: monaco_editor_core_exports.languages.IndentAction.Indent }
128      }
129    ]
130  };
131  var language = {
132    defaultToken: "",
133    tokenPostfix: "",
134    // ignoreCase: true,
135    // The main tokenizer for our languages
136    tokenizer: {
137      root: [
138        [/\{\{!--/, "comment.block.start.handlebars", "@commentBlock"],
139        [/\{\{!/, "comment.start.handlebars", "@comment"],
140        [/\{\{/, { token: "@rematch", switchTo: "@handlebarsInSimpleState.root" }],
141        [/<!DOCTYPE/, "metatag.html", "@doctype"],
142        [/<!--/, "comment.html", "@commentHtml"],
143        [/(<)(\w+)(\/>)/, ["delimiter.html", "tag.html", "delimiter.html"]],
144        [/(<)(script)/, ["delimiter.html", { token: "tag.html", next: "@script" }]],
145        [/(<)(style)/, ["delimiter.html", { token: "tag.html", next: "@style" }]],
146        [/(<)([:\w]+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]],
147        [/(<\/)(\w+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]],
148        [/</, "delimiter.html"],
149        [/\{/, "delimiter.html"],
150        [/[^<{]+/]
151        // text
152      ],
153      doctype: [
154        [
155          /\{\{/,
156          {
157            token: "@rematch",
158            switchTo: "@handlebarsInSimpleState.comment"
159          }
160        ],
161        [/[^>]+/, "metatag.content.html"],
162        [/>/, "metatag.html", "@pop"]
163      ],
164      comment: [
165        [/\}\}/, "comment.end.handlebars", "@pop"],
166        [/./, "comment.content.handlebars"]
167      ],
168      commentBlock: [
169        [/--\}\}/, "comment.block.end.handlebars", "@pop"],
170        [/./, "comment.content.handlebars"]
171      ],
172      commentHtml: [
173        [
174          /\{\{/,
175          {
176            token: "@rematch",
177            switchTo: "@handlebarsInSimpleState.comment"
178          }
179        ],
180        [/-->/, "comment.html", "@pop"],
181        [/[^-]+/, "comment.content.html"],
182        [/./, "comment.content.html"]
183      ],
184      otherTag: [
185        [
186          /\{\{/,
187          {
188            token: "@rematch",
189            switchTo: "@handlebarsInSimpleState.otherTag"
190          }
191        ],
192        [/\/?>/, "delimiter.html", "@pop"],
193        [/"([^"]*)"/, "attribute.value"],
194        [/'([^']*)'/, "attribute.value"],
195        [/[\w\-]+/, "attribute.name"],
196        [/=/, "delimiter"],
197        [/[ \t\r\n]+/]
198        // whitespace
199      ],
200      // -- BEGIN <script> tags handling
201      // After <script
202      script: [
203        [
204          /\{\{/,
205          {
206            token: "@rematch",
207            switchTo: "@handlebarsInSimpleState.script"
208          }
209        ],
210        [/type/, "attribute.name", "@scriptAfterType"],
211        [/"([^"]*)"/, "attribute.value"],
212        [/'([^']*)'/, "attribute.value"],
213        [/[\w\-]+/, "attribute.name"],
214        [/=/, "delimiter"],
215        [
216          />/,
217          {
218            token: "delimiter.html",
219            next: "@scriptEmbedded.text/javascript",
220            nextEmbedded: "text/javascript"
221          }
222        ],
223        [/[ \t\r\n]+/],
224        // whitespace
225        [
226          /(<\/)(script\s*)(>)/,
227          ["delimiter.html", "tag.html", { token: "delimiter.html", next: "@pop" }]
228        ]
229      ],
230      // After <script ... type
231      scriptAfterType: [
232        [
233          /\{\{/,
234          {
235            token: "@rematch",
236            switchTo: "@handlebarsInSimpleState.scriptAfterType"
237          }
238        ],
239        [/=/, "delimiter", "@scriptAfterTypeEquals"],
240        [
241          />/,
242          {
243            token: "delimiter.html",
244            next: "@scriptEmbedded.text/javascript",
245            nextEmbedded: "text/javascript"
246          }
247        ],
248        // cover invalid e.g. <script type>
249        [/[ \t\r\n]+/],
250        // whitespace
251        [/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
252      ],
253      // After <script ... type =
254      scriptAfterTypeEquals: [
255        [
256          /\{\{/,
257          {
258            token: "@rematch",
259            switchTo: "@handlebarsInSimpleState.scriptAfterTypeEquals"
260          }
261        ],
262        [
263          /"([^"]*)"/,
264          {
265            token: "attribute.value",
266            switchTo: "@scriptWithCustomType.$1"
267          }
268        ],
269        [
270          /'([^']*)'/,
271          {
272            token: "attribute.value",
273            switchTo: "@scriptWithCustomType.$1"
274          }
275        ],
276        [
277          />/,
278          {
279            token: "delimiter.html",
280            next: "@scriptEmbedded.text/javascript",
281            nextEmbedded: "text/javascript"
282          }
283        ],
284        // cover invalid e.g. <script type=>
285        [/[ \t\r\n]+/],
286        // whitespace
287        [/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
288      ],
289      // After <script ... type = $S2
290      scriptWithCustomType: [
291        [
292          /\{\{/,
293          {
294            token: "@rematch",
295            switchTo: "@handlebarsInSimpleState.scriptWithCustomType.$S2"
296          }
297        ],
298        [
299          />/,
300          {
301            token: "delimiter.html",
302            next: "@scriptEmbedded.$S2",
303            nextEmbedded: "$S2"
304          }
305        ],
306        [/"([^"]*)"/, "attribute.value"],
307        [/'([^']*)'/, "attribute.value"],
308        [/[\w\-]+/, "attribute.name"],
309        [/=/, "delimiter"],
310        [/[ \t\r\n]+/],
311        // whitespace
312        [/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
313      ],
314      scriptEmbedded: [
315        [
316          /\{\{/,
317          {
318            token: "@rematch",
319            switchTo: "@handlebarsInEmbeddedState.scriptEmbedded.$S2",
320            nextEmbedded: "@pop"
321          }
322        ],
323        [/<\/script/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }]
324      ],
325      // -- END <script> tags handling
326      // -- BEGIN <style> tags handling
327      // After <style
328      style: [
329        [
330          /\{\{/,
331          {
332            token: "@rematch",
333            switchTo: "@handlebarsInSimpleState.style"
334          }
335        ],
336        [/type/, "attribute.name", "@styleAfterType"],
337        [/"([^"]*)"/, "attribute.value"],
338        [/'([^']*)'/, "attribute.value"],
339        [/[\w\-]+/, "attribute.name"],
340        [/=/, "delimiter"],
341        [
342          />/,
343          {
344            token: "delimiter.html",
345            next: "@styleEmbedded.text/css",
346            nextEmbedded: "text/css"
347          }
348        ],
349        [/[ \t\r\n]+/],
350        // whitespace
351        [
352          /(<\/)(style\s*)(>)/,
353          ["delimiter.html", "tag.html", { token: "delimiter.html", next: "@pop" }]
354        ]
355      ],
356      // After <style ... type
357      styleAfterType: [
358        [
359          /\{\{/,
360          {
361            token: "@rematch",
362            switchTo: "@handlebarsInSimpleState.styleAfterType"
363          }
364        ],
365        [/=/, "delimiter", "@styleAfterTypeEquals"],
366        [
367          />/,
368          {
369            token: "delimiter.html",
370            next: "@styleEmbedded.text/css",
371            nextEmbedded: "text/css"
372          }
373        ],
374        // cover invalid e.g. <style type>
375        [/[ \t\r\n]+/],
376        // whitespace
377        [/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
378      ],
379      // After <style ... type =
380      styleAfterTypeEquals: [
381        [
382          /\{\{/,
383          {
384            token: "@rematch",
385            switchTo: "@handlebarsInSimpleState.styleAfterTypeEquals"
386          }
387        ],
388        [
389          /"([^"]*)"/,
390          {
391            token: "attribute.value",
392            switchTo: "@styleWithCustomType.$1"
393          }
394        ],
395        [
396          /'([^']*)'/,
397          {
398            token: "attribute.value",
399            switchTo: "@styleWithCustomType.$1"
400          }
401        ],
402        [
403          />/,
404          {
405            token: "delimiter.html",
406            next: "@styleEmbedded.text/css",
407            nextEmbedded: "text/css"
408          }
409        ],
410        // cover invalid e.g. <style type=>
411        [/[ \t\r\n]+/],
412        // whitespace
413        [/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
414      ],
415      // After <style ... type = $S2
416      styleWithCustomType: [
417        [
418          /\{\{/,
419          {
420            token: "@rematch",
421            switchTo: "@handlebarsInSimpleState.styleWithCustomType.$S2"
422          }
423        ],
424        [
425          />/,
426          {
427            token: "delimiter.html",
428            next: "@styleEmbedded.$S2",
429            nextEmbedded: "$S2"
430          }
431        ],
432        [/"([^"]*)"/, "attribute.value"],
433        [/'([^']*)'/, "attribute.value"],
434        [/[\w\-]+/, "attribute.name"],
435        [/=/, "delimiter"],
436        [/[ \t\r\n]+/],
437        // whitespace
438        [/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
439      ],
440      styleEmbedded: [
441        [
442          /\{\{/,
443          {
444            token: "@rematch",
445            switchTo: "@handlebarsInEmbeddedState.styleEmbedded.$S2",
446            nextEmbedded: "@pop"
447          }
448        ],
449        [/<\/style/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }]
450      ],
451      // -- END <style> tags handling
452      handlebarsInSimpleState: [
453        [/\{\{\{?/, "delimiter.handlebars"],
454        [/\}\}\}?/, { token: "delimiter.handlebars", switchTo: "@$S2.$S3" }],
455        { include: "handlebarsRoot" }
456      ],
457      handlebarsInEmbeddedState: [
458        [/\{\{\{?/, "delimiter.handlebars"],
459        [
460          /\}\}\}?/,
461          {
462            token: "delimiter.handlebars",
463            switchTo: "@$S2.$S3",
464            nextEmbedded: "$S3"
465          }
466        ],
467        { include: "handlebarsRoot" }
468      ],
469      handlebarsRoot: [
470        [/"[^"]*"/, "string.handlebars"],
471        [/[#/][^\s}]+/, "keyword.helper.handlebars"],
472        [/else\b/, "keyword.helper.handlebars"],
473        [/[\s]+/],
474        [/[^}]/, "variable.parameter.handlebars"]
475      ]
476    }
477  };
478  return __toCommonJS(handlebars_exports);
479})();
480return moduleExports;
481});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.