Brunobkr commited on
Commit
b3efa5d
·
verified ·
1 Parent(s): 981058a

Upload folder using huggingface_hub (part 43)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. tools/ui/node_modules/loupe/lib/promise.d.ts +5 -0
  2. tools/ui/node_modules/loupe/lib/promise.d.ts.map +1 -0
  3. tools/ui/node_modules/loupe/lib/promise.js +2 -0
  4. tools/ui/node_modules/loupe/lib/regexp.d.ts +3 -0
  5. tools/ui/node_modules/loupe/lib/regexp.d.ts.map +1 -0
  6. tools/ui/node_modules/loupe/lib/regexp.js +7 -0
  7. tools/ui/node_modules/loupe/lib/set.d.ts +3 -0
  8. tools/ui/node_modules/loupe/lib/set.d.ts.map +1 -0
  9. tools/ui/node_modules/loupe/lib/set.js +15 -0
  10. tools/ui/node_modules/loupe/lib/string.d.ts +3 -0
  11. tools/ui/node_modules/loupe/lib/string.d.ts.map +1 -0
  12. tools/ui/node_modules/loupe/lib/string.js +24 -0
  13. tools/ui/node_modules/loupe/lib/symbol.d.ts +2 -0
  14. tools/ui/node_modules/loupe/lib/symbol.d.ts.map +1 -0
  15. tools/ui/node_modules/loupe/lib/symbol.js +6 -0
  16. tools/ui/node_modules/loupe/lib/typedarray.d.ts +5 -0
  17. tools/ui/node_modules/loupe/lib/typedarray.d.ts.map +1 -0
  18. tools/ui/node_modules/loupe/lib/typedarray.js +38 -0
  19. tools/ui/node_modules/loupe/lib/types.d.ts +15 -0
  20. tools/ui/node_modules/loupe/lib/types.d.ts.map +1 -0
  21. tools/ui/node_modules/loupe/lib/types.js +1 -0
  22. tools/ui/node_modules/loupe/loupe.js +622 -0
  23. tools/ui/node_modules/loupe/package.json +73 -0
  24. tools/ui/node_modules/lowlight/index.d.ts +22 -0
  25. tools/ui/node_modules/lowlight/index.js +4 -0
  26. tools/ui/node_modules/lowlight/lib/all.d.ts +8 -0
  27. tools/ui/node_modules/lowlight/lib/all.d.ts.map +1 -0
  28. tools/ui/node_modules/lowlight/lib/all.js +324 -0
  29. tools/ui/node_modules/lowlight/lib/common.d.ts +8 -0
  30. tools/ui/node_modules/lowlight/lib/common.d.ts.map +1 -0
  31. tools/ui/node_modules/lowlight/lib/common.js +86 -0
  32. tools/ui/node_modules/lowlight/lib/index.d.ts +197 -0
  33. tools/ui/node_modules/lowlight/lib/index.d.ts.map +1 -0
  34. tools/ui/node_modules/lowlight/lib/index.js +482 -0
  35. tools/ui/node_modules/lowlight/license +22 -0
  36. tools/ui/node_modules/lowlight/package.json +114 -0
  37. tools/ui/node_modules/lowlight/readme.md +786 -0
  38. tools/ui/node_modules/lz-string/LICENSE +21 -0
  39. tools/ui/node_modules/lz-string/README.md +45 -0
  40. tools/ui/node_modules/lz-string/bin/bin.js +13 -0
  41. tools/ui/node_modules/lz-string/bower.json +11 -0
  42. tools/ui/node_modules/lz-string/libs/base64-string.js +285 -0
  43. tools/ui/node_modules/lz-string/libs/lz-string.js +506 -0
  44. tools/ui/node_modules/lz-string/libs/lz-string.min.js +1 -0
  45. tools/ui/node_modules/lz-string/package.json +42 -0
  46. tools/ui/node_modules/lz-string/reference/lz-string-1.0.2.js +204 -0
  47. tools/ui/node_modules/lz-string/tests/SpecRunner.html +51 -0
  48. tools/ui/node_modules/lz-string/tests/lib/jasmine-1.3.1/MIT.LICENSE +20 -0
  49. tools/ui/node_modules/lz-string/tests/lib/jasmine-1.3.1/jasmine-html.js +681 -0
  50. tools/ui/node_modules/lz-string/tests/lib/jasmine-1.3.1/jasmine.css +82 -0
tools/ui/node_modules/loupe/lib/promise.d.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import type { Options } from './types.js';
2
+ type GetPromiseValue = (value: Promise<unknown>, options: Options) => string;
3
+ declare const getPromiseValue: GetPromiseValue;
4
+ export default getPromiseValue;
5
+ //# sourceMappingURL=promise.d.ts.map
tools/ui/node_modules/loupe/lib/promise.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../src/promise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,KAAK,eAAe,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM,CAAA;AAC5E,QAAA,MAAM,eAAe,EAAE,eAAoC,CAAA;AAC3D,eAAe,eAAe,CAAA"}
tools/ui/node_modules/loupe/lib/promise.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ const getPromiseValue = () => 'Promise{…}';
2
+ export default getPromiseValue;
tools/ui/node_modules/loupe/lib/regexp.d.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ import type { Options } from './types.js';
2
+ export default function inspectRegExp(value: RegExp, options: Options): string;
3
+ //# sourceMappingURL=regexp.d.ts.map
tools/ui/node_modules/loupe/lib/regexp.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"regexp.d.ts","sourceRoot":"","sources":["../src/regexp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEzC,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAK7E"}
tools/ui/node_modules/loupe/lib/regexp.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ import { truncate } from './helpers.js';
2
+ export default function inspectRegExp(value, options) {
3
+ const flags = value.toString().split('/')[2];
4
+ const sourceLength = options.truncate - (2 + flags.length);
5
+ const source = value.source;
6
+ return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, 'regexp');
7
+ }
tools/ui/node_modules/loupe/lib/set.d.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ import type { Options } from './types.js';
2
+ export default function inspectSet(set: Set<unknown>, options: Options): string;
3
+ //# sourceMappingURL=set.d.ts.map
tools/ui/node_modules/loupe/lib/set.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../src/set.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAWzC,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAI9E"}
tools/ui/node_modules/loupe/lib/set.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { inspectList } from './helpers.js';
2
+ // IE11 doesn't support `Array.from(set)`
3
+ function arrayFromSet(set) {
4
+ const values = [];
5
+ set.forEach(value => {
6
+ values.push(value);
7
+ });
8
+ return values;
9
+ }
10
+ export default function inspectSet(set, options) {
11
+ if (set.size === 0)
12
+ return 'Set{}';
13
+ options.truncate -= 7;
14
+ return `Set{ ${inspectList(arrayFromSet(set), options)} }`;
15
+ }
tools/ui/node_modules/loupe/lib/string.d.ts ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ import type { Options } from './types.js';
2
+ export default function inspectString(string: string, options: Options): string;
3
+ //# sourceMappingURL=string.d.ts.map
tools/ui/node_modules/loupe/lib/string.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AA2BzC,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAK9E"}
tools/ui/node_modules/loupe/lib/string.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { truncate } from './helpers.js';
2
+ const stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5" +
3
+ '\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]', 'g');
4
+ const escapeCharacters = {
5
+ '\b': '\\b',
6
+ '\t': '\\t',
7
+ '\n': '\\n',
8
+ '\f': '\\f',
9
+ '\r': '\\r',
10
+ "'": "\\'",
11
+ '\\': '\\\\',
12
+ };
13
+ const hex = 16;
14
+ const unicodeLength = 4;
15
+ function escape(char) {
16
+ return (escapeCharacters[char] ||
17
+ `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-unicodeLength)}`);
18
+ }
19
+ export default function inspectString(string, options) {
20
+ if (stringEscapeChars.test(string)) {
21
+ string = string.replace(stringEscapeChars, escape);
22
+ }
23
+ return options.stylize(`'${truncate(string, options.truncate - 2)}'`, 'string');
24
+ }
tools/ui/node_modules/loupe/lib/symbol.d.ts ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ export default function inspectSymbol(value: Symbol): string;
2
+ //# sourceMappingURL=symbol.d.ts.map
tools/ui/node_modules/loupe/lib/symbol.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"symbol.d.ts","sourceRoot":"","sources":["../src/symbol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK3D"}
tools/ui/node_modules/loupe/lib/symbol.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ export default function inspectSymbol(value) {
2
+ if ('description' in Symbol.prototype) {
3
+ return value.description ? `Symbol(${value.description})` : 'Symbol()';
4
+ }
5
+ return value.toString();
6
+ }
tools/ui/node_modules/loupe/lib/typedarray.d.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import type { Options } from './types.js';
2
+ type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
3
+ export default function inspectTypedArray(array: TypedArray, options: Options): string;
4
+ export {};
5
+ //# sourceMappingURL=typedarray.d.ts.map
tools/ui/node_modules/loupe/lib/typedarray.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"typedarray.d.ts","sourceRoot":"","sources":["../src/typedarray.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAW,OAAO,EAAE,MAAM,YAAY,CAAA;AAElD,KAAK,UAAU,GACX,SAAS,GACT,UAAU,GACV,iBAAiB,GACjB,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,YAAY,GACZ,YAAY,CAAA;AAchB,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CA8BrF"}
tools/ui/node_modules/loupe/lib/typedarray.js ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { inspectList, inspectProperty, truncate, truncator } from './helpers.js';
2
+ const getArrayName = (array) => {
3
+ // We need to special case Node.js' Buffers, which report to be Uint8Array
4
+ // @ts-ignore
5
+ if (typeof Buffer === 'function' && array instanceof Buffer) {
6
+ return 'Buffer';
7
+ }
8
+ if (array[Symbol.toStringTag]) {
9
+ return array[Symbol.toStringTag];
10
+ }
11
+ return array.constructor.name;
12
+ };
13
+ export default function inspectTypedArray(array, options) {
14
+ const name = getArrayName(array);
15
+ options.truncate -= name.length + 4;
16
+ // Object.keys will always output the Array indices first, so we can slice by
17
+ // `array.length` to get non-index properties
18
+ const nonIndexProperties = Object.keys(array).slice(array.length);
19
+ if (!array.length && !nonIndexProperties.length)
20
+ return `${name}[]`;
21
+ // As we know TypedArrays only contain Unsigned Integers, we can skip inspecting each one and simply
22
+ // stylise the toString() value of them
23
+ let output = '';
24
+ for (let i = 0; i < array.length; i++) {
25
+ const string = `${options.stylize(truncate(array[i], options.truncate), 'number')}${i === array.length - 1 ? '' : ', '}`;
26
+ options.truncate -= string.length;
27
+ if (array[i] !== array.length && options.truncate <= 3) {
28
+ output += `${truncator}(${array.length - array[i] + 1})`;
29
+ break;
30
+ }
31
+ output += string;
32
+ }
33
+ let propertyContents = '';
34
+ if (nonIndexProperties.length) {
35
+ propertyContents = inspectList(nonIndexProperties.map(key => [key, array[key]]), options, inspectProperty);
36
+ }
37
+ return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ''} ]`;
38
+ }
tools/ui/node_modules/loupe/lib/types.d.ts ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export type Inspect = (value: unknown, options: Options) => string;
2
+ export interface Options {
3
+ showHidden: boolean;
4
+ depth: number;
5
+ colors: boolean;
6
+ customInspect: boolean;
7
+ showProxy: boolean;
8
+ maxArrayLength: number;
9
+ breakLength: number;
10
+ truncate: number;
11
+ seen: unknown[];
12
+ inspect: Inspect;
13
+ stylize: (value: string, styleType: string) => string;
14
+ }
15
+ //# sourceMappingURL=types.d.ts.map
tools/ui/node_modules/loupe/lib/types.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM,CAAA;AAElE,MAAM,WAAW,OAAO;IACtB,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,OAAO,CAAA;IACf,aAAa,EAAE,OAAO,CAAA;IACtB,SAAS,EAAE,OAAO,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,OAAO,EAAE,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAA;CACtD"}
tools/ui/node_modules/loupe/lib/types.js ADDED
@@ -0,0 +1 @@
 
 
1
+ export {};
tools/ui/node_modules/loupe/loupe.js ADDED
@@ -0,0 +1,622 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ custom: () => custom,
24
+ default: () => index_default,
25
+ inspect: () => inspect,
26
+ registerConstructor: () => registerConstructor,
27
+ registerStringTag: () => registerStringTag
28
+ });
29
+ module.exports = __toCommonJS(index_exports);
30
+
31
+ // src/helpers.ts
32
+ var ansiColors = {
33
+ bold: ["1", "22"],
34
+ dim: ["2", "22"],
35
+ italic: ["3", "23"],
36
+ underline: ["4", "24"],
37
+ // 5 & 6 are blinking
38
+ inverse: ["7", "27"],
39
+ hidden: ["8", "28"],
40
+ strike: ["9", "29"],
41
+ // 10-20 are fonts
42
+ // 21-29 are resets for 1-9
43
+ black: ["30", "39"],
44
+ red: ["31", "39"],
45
+ green: ["32", "39"],
46
+ yellow: ["33", "39"],
47
+ blue: ["34", "39"],
48
+ magenta: ["35", "39"],
49
+ cyan: ["36", "39"],
50
+ white: ["37", "39"],
51
+ brightblack: ["30;1", "39"],
52
+ brightred: ["31;1", "39"],
53
+ brightgreen: ["32;1", "39"],
54
+ brightyellow: ["33;1", "39"],
55
+ brightblue: ["34;1", "39"],
56
+ brightmagenta: ["35;1", "39"],
57
+ brightcyan: ["36;1", "39"],
58
+ brightwhite: ["37;1", "39"],
59
+ grey: ["90", "39"]
60
+ };
61
+ var styles = {
62
+ special: "cyan",
63
+ number: "yellow",
64
+ bigint: "yellow",
65
+ boolean: "yellow",
66
+ undefined: "grey",
67
+ null: "bold",
68
+ string: "green",
69
+ symbol: "green",
70
+ date: "magenta",
71
+ regexp: "red"
72
+ };
73
+ var truncator = "\u2026";
74
+ function colorise(value, styleType) {
75
+ const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
76
+ if (!color) {
77
+ return String(value);
78
+ }
79
+ return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`;
80
+ }
81
+ function normaliseOptions({
82
+ showHidden = false,
83
+ depth = 2,
84
+ colors = false,
85
+ customInspect = true,
86
+ showProxy = false,
87
+ maxArrayLength = Infinity,
88
+ breakLength = Infinity,
89
+ seen = [],
90
+ // eslint-disable-next-line no-shadow
91
+ truncate: truncate2 = Infinity,
92
+ stylize = String
93
+ } = {}, inspect2) {
94
+ const options = {
95
+ showHidden: Boolean(showHidden),
96
+ depth: Number(depth),
97
+ colors: Boolean(colors),
98
+ customInspect: Boolean(customInspect),
99
+ showProxy: Boolean(showProxy),
100
+ maxArrayLength: Number(maxArrayLength),
101
+ breakLength: Number(breakLength),
102
+ truncate: Number(truncate2),
103
+ seen,
104
+ inspect: inspect2,
105
+ stylize
106
+ };
107
+ if (options.colors) {
108
+ options.stylize = colorise;
109
+ }
110
+ return options;
111
+ }
112
+ function isHighSurrogate(char) {
113
+ return char >= "\uD800" && char <= "\uDBFF";
114
+ }
115
+ function truncate(string, length, tail = truncator) {
116
+ string = String(string);
117
+ const tailLength = tail.length;
118
+ const stringLength = string.length;
119
+ if (tailLength > length && stringLength > tailLength) {
120
+ return tail;
121
+ }
122
+ if (stringLength > length && stringLength > tailLength) {
123
+ let end = length - tailLength;
124
+ if (end > 0 && isHighSurrogate(string[end - 1])) {
125
+ end = end - 1;
126
+ }
127
+ return `${string.slice(0, end)}${tail}`;
128
+ }
129
+ return string;
130
+ }
131
+ function inspectList(list, options, inspectItem, separator = ", ") {
132
+ inspectItem = inspectItem || options.inspect;
133
+ const size = list.length;
134
+ if (size === 0) return "";
135
+ const originalLength = options.truncate;
136
+ let output = "";
137
+ let peek = "";
138
+ let truncated = "";
139
+ for (let i = 0; i < size; i += 1) {
140
+ const last = i + 1 === list.length;
141
+ const secondToLast = i + 2 === list.length;
142
+ truncated = `${truncator}(${list.length - i})`;
143
+ const value = list[i];
144
+ options.truncate = originalLength - output.length - (last ? 0 : separator.length);
145
+ const string = peek || inspectItem(value, options) + (last ? "" : separator);
146
+ const nextLength = output.length + string.length;
147
+ const truncatedLength = nextLength + truncated.length;
148
+ if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
149
+ break;
150
+ }
151
+ if (!last && !secondToLast && truncatedLength > originalLength) {
152
+ break;
153
+ }
154
+ peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
155
+ if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
156
+ break;
157
+ }
158
+ output += string;
159
+ if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
160
+ truncated = `${truncator}(${list.length - i - 1})`;
161
+ break;
162
+ }
163
+ truncated = "";
164
+ }
165
+ return `${output}${truncated}`;
166
+ }
167
+ function quoteComplexKey(key) {
168
+ if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
169
+ return key;
170
+ }
171
+ return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
172
+ }
173
+ function inspectProperty([key, value], options) {
174
+ options.truncate -= 2;
175
+ if (typeof key === "string") {
176
+ key = quoteComplexKey(key);
177
+ } else if (typeof key !== "number") {
178
+ key = `[${options.inspect(key, options)}]`;
179
+ }
180
+ options.truncate -= key.length;
181
+ value = options.inspect(value, options);
182
+ return `${key}: ${value}`;
183
+ }
184
+
185
+ // src/array.ts
186
+ function inspectArray(array, options) {
187
+ const nonIndexProperties = Object.keys(array).slice(array.length);
188
+ if (!array.length && !nonIndexProperties.length) return "[]";
189
+ options.truncate -= 4;
190
+ const listContents = inspectList(array, options);
191
+ options.truncate -= listContents.length;
192
+ let propertyContents = "";
193
+ if (nonIndexProperties.length) {
194
+ propertyContents = inspectList(
195
+ nonIndexProperties.map((key) => [key, array[key]]),
196
+ options,
197
+ inspectProperty
198
+ );
199
+ }
200
+ return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
201
+ }
202
+
203
+ // src/typedarray.ts
204
+ var getArrayName = (array) => {
205
+ if (typeof Buffer === "function" && array instanceof Buffer) {
206
+ return "Buffer";
207
+ }
208
+ if (array[Symbol.toStringTag]) {
209
+ return array[Symbol.toStringTag];
210
+ }
211
+ return array.constructor.name;
212
+ };
213
+ function inspectTypedArray(array, options) {
214
+ const name = getArrayName(array);
215
+ options.truncate -= name.length + 4;
216
+ const nonIndexProperties = Object.keys(array).slice(array.length);
217
+ if (!array.length && !nonIndexProperties.length) return `${name}[]`;
218
+ let output = "";
219
+ for (let i = 0; i < array.length; i++) {
220
+ const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`;
221
+ options.truncate -= string.length;
222
+ if (array[i] !== array.length && options.truncate <= 3) {
223
+ output += `${truncator}(${array.length - array[i] + 1})`;
224
+ break;
225
+ }
226
+ output += string;
227
+ }
228
+ let propertyContents = "";
229
+ if (nonIndexProperties.length) {
230
+ propertyContents = inspectList(
231
+ nonIndexProperties.map((key) => [key, array[key]]),
232
+ options,
233
+ inspectProperty
234
+ );
235
+ }
236
+ return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
237
+ }
238
+
239
+ // src/date.ts
240
+ function inspectDate(dateObject, options) {
241
+ const stringRepresentation = dateObject.toJSON();
242
+ if (stringRepresentation === null) {
243
+ return "Invalid Date";
244
+ }
245
+ const split = stringRepresentation.split("T");
246
+ const date = split[0];
247
+ return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
248
+ }
249
+
250
+ // src/function.ts
251
+ function inspectFunction(func, options) {
252
+ const functionType = func[Symbol.toStringTag] || "Function";
253
+ const name = func.name;
254
+ if (!name) {
255
+ return options.stylize(`[${functionType}]`, "special");
256
+ }
257
+ return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
258
+ }
259
+
260
+ // src/map.ts
261
+ function inspectMapEntry([key, value], options) {
262
+ options.truncate -= 4;
263
+ key = options.inspect(key, options);
264
+ options.truncate -= key.length;
265
+ value = options.inspect(value, options);
266
+ return `${key} => ${value}`;
267
+ }
268
+ function mapToEntries(map) {
269
+ const entries = [];
270
+ map.forEach((value, key) => {
271
+ entries.push([key, value]);
272
+ });
273
+ return entries;
274
+ }
275
+ function inspectMap(map, options) {
276
+ if (map.size === 0) return "Map{}";
277
+ options.truncate -= 7;
278
+ return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
279
+ }
280
+
281
+ // src/number.ts
282
+ var isNaN = Number.isNaN || ((i) => i !== i);
283
+ function inspectNumber(number, options) {
284
+ if (isNaN(number)) {
285
+ return options.stylize("NaN", "number");
286
+ }
287
+ if (number === Infinity) {
288
+ return options.stylize("Infinity", "number");
289
+ }
290
+ if (number === -Infinity) {
291
+ return options.stylize("-Infinity", "number");
292
+ }
293
+ if (number === 0) {
294
+ return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
295
+ }
296
+ return options.stylize(truncate(String(number), options.truncate), "number");
297
+ }
298
+
299
+ // src/bigint.ts
300
+ function inspectBigInt(number, options) {
301
+ let nums = truncate(number.toString(), options.truncate - 1);
302
+ if (nums !== truncator) nums += "n";
303
+ return options.stylize(nums, "bigint");
304
+ }
305
+
306
+ // src/regexp.ts
307
+ function inspectRegExp(value, options) {
308
+ const flags = value.toString().split("/")[2];
309
+ const sourceLength = options.truncate - (2 + flags.length);
310
+ const source = value.source;
311
+ return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
312
+ }
313
+
314
+ // src/set.ts
315
+ function arrayFromSet(set) {
316
+ const values = [];
317
+ set.forEach((value) => {
318
+ values.push(value);
319
+ });
320
+ return values;
321
+ }
322
+ function inspectSet(set, options) {
323
+ if (set.size === 0) return "Set{}";
324
+ options.truncate -= 7;
325
+ return `Set{ ${inspectList(arrayFromSet(set), options)} }`;
326
+ }
327
+
328
+ // src/string.ts
329
+ var stringEscapeChars = new RegExp(
330
+ "['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]",
331
+ "g"
332
+ );
333
+ var escapeCharacters = {
334
+ "\b": "\\b",
335
+ " ": "\\t",
336
+ "\n": "\\n",
337
+ "\f": "\\f",
338
+ "\r": "\\r",
339
+ "'": "\\'",
340
+ "\\": "\\\\"
341
+ };
342
+ var hex = 16;
343
+ var unicodeLength = 4;
344
+ function escape(char) {
345
+ return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-unicodeLength)}`;
346
+ }
347
+ function inspectString(string, options) {
348
+ if (stringEscapeChars.test(string)) {
349
+ string = string.replace(stringEscapeChars, escape);
350
+ }
351
+ return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
352
+ }
353
+
354
+ // src/symbol.ts
355
+ function inspectSymbol(value) {
356
+ if ("description" in Symbol.prototype) {
357
+ return value.description ? `Symbol(${value.description})` : "Symbol()";
358
+ }
359
+ return value.toString();
360
+ }
361
+
362
+ // src/promise.ts
363
+ var getPromiseValue = () => "Promise{\u2026}";
364
+ var promise_default = getPromiseValue;
365
+
366
+ // src/object.ts
367
+ function inspectObject(object, options) {
368
+ const properties = Object.getOwnPropertyNames(object);
369
+ const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
370
+ if (properties.length === 0 && symbols.length === 0) {
371
+ return "{}";
372
+ }
373
+ options.truncate -= 4;
374
+ options.seen = options.seen || [];
375
+ if (options.seen.includes(object)) {
376
+ return "[Circular]";
377
+ }
378
+ options.seen.push(object);
379
+ const propertyContents = inspectList(
380
+ properties.map((key) => [key, object[key]]),
381
+ options,
382
+ inspectProperty
383
+ );
384
+ const symbolContents = inspectList(
385
+ symbols.map((key) => [key, object[key]]),
386
+ options,
387
+ inspectProperty
388
+ );
389
+ options.seen.pop();
390
+ let sep = "";
391
+ if (propertyContents && symbolContents) {
392
+ sep = ", ";
393
+ }
394
+ return `{ ${propertyContents}${sep}${symbolContents} }`;
395
+ }
396
+
397
+ // src/class.ts
398
+ var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
399
+ function inspectClass(value, options) {
400
+ let name = "";
401
+ if (toStringTag && toStringTag in value) {
402
+ name = value[toStringTag];
403
+ }
404
+ name = name || value.constructor.name;
405
+ if (!name || name === "_class") {
406
+ name = "<Anonymous Class>";
407
+ }
408
+ options.truncate -= name.length;
409
+ return `${name}${inspectObject(value, options)}`;
410
+ }
411
+
412
+ // src/arguments.ts
413
+ function inspectArguments(args, options) {
414
+ if (args.length === 0) return "Arguments[]";
415
+ options.truncate -= 13;
416
+ return `Arguments[ ${inspectList(args, options)} ]`;
417
+ }
418
+
419
+ // src/error.ts
420
+ var errorKeys = [
421
+ "stack",
422
+ "line",
423
+ "column",
424
+ "name",
425
+ "message",
426
+ "fileName",
427
+ "lineNumber",
428
+ "columnNumber",
429
+ "number",
430
+ "description",
431
+ "cause"
432
+ ];
433
+ function inspectObject2(error, options) {
434
+ const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
435
+ const name = error.name;
436
+ options.truncate -= name.length;
437
+ let message = "";
438
+ if (typeof error.message === "string") {
439
+ message = truncate(error.message, options.truncate);
440
+ } else {
441
+ properties.unshift("message");
442
+ }
443
+ message = message ? `: ${message}` : "";
444
+ options.truncate -= message.length + 5;
445
+ options.seen = options.seen || [];
446
+ if (options.seen.includes(error)) {
447
+ return "[Circular]";
448
+ }
449
+ options.seen.push(error);
450
+ const propertyContents = inspectList(
451
+ properties.map((key) => [key, error[key]]),
452
+ options,
453
+ inspectProperty
454
+ );
455
+ return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
456
+ }
457
+
458
+ // src/html.ts
459
+ function inspectAttribute([key, value], options) {
460
+ options.truncate -= 3;
461
+ if (!value) {
462
+ return `${options.stylize(String(key), "yellow")}`;
463
+ }
464
+ return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
465
+ }
466
+ function inspectNodeCollection(collection, options) {
467
+ return inspectList(collection, options, inspectNode, "\n");
468
+ }
469
+ function inspectNode(node, options) {
470
+ switch (node.nodeType) {
471
+ case 1:
472
+ return inspectHTML(node, options);
473
+ case 3:
474
+ return options.inspect(node.data, options);
475
+ default:
476
+ return options.inspect(node, options);
477
+ }
478
+ }
479
+ function inspectHTML(element, options) {
480
+ const properties = element.getAttributeNames();
481
+ const name = element.tagName.toLowerCase();
482
+ const head = options.stylize(`<${name}`, "special");
483
+ const headClose = options.stylize(`>`, "special");
484
+ const tail = options.stylize(`</${name}>`, "special");
485
+ options.truncate -= name.length * 2 + 5;
486
+ let propertyContents = "";
487
+ if (properties.length > 0) {
488
+ propertyContents += " ";
489
+ propertyContents += inspectList(
490
+ properties.map((key) => [key, element.getAttribute(key)]),
491
+ options,
492
+ inspectAttribute,
493
+ " "
494
+ );
495
+ }
496
+ options.truncate -= propertyContents.length;
497
+ const truncate2 = options.truncate;
498
+ let children = inspectNodeCollection(element.children, options);
499
+ if (children && children.length > truncate2) {
500
+ children = `${truncator}(${element.children.length})`;
501
+ }
502
+ return `${head}${propertyContents}${headClose}${children}${tail}`;
503
+ }
504
+
505
+ // src/index.ts
506
+ var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
507
+ var chaiInspect = symbolsSupported ? Symbol.for("chai/inspect") : "@@chai/inspect";
508
+ var nodeInspect = Symbol.for("nodejs.util.inspect.custom");
509
+ var constructorMap = /* @__PURE__ */ new WeakMap();
510
+ var stringTagMap = {};
511
+ var baseTypesMap = {
512
+ undefined: (value, options) => options.stylize("undefined", "undefined"),
513
+ null: (value, options) => options.stylize("null", "null"),
514
+ boolean: (value, options) => options.stylize(String(value), "boolean"),
515
+ Boolean: (value, options) => options.stylize(String(value), "boolean"),
516
+ number: inspectNumber,
517
+ Number: inspectNumber,
518
+ bigint: inspectBigInt,
519
+ BigInt: inspectBigInt,
520
+ string: inspectString,
521
+ String: inspectString,
522
+ function: inspectFunction,
523
+ Function: inspectFunction,
524
+ symbol: inspectSymbol,
525
+ // A Symbol polyfill will return `Symbol` not `symbol` from typedetect
526
+ Symbol: inspectSymbol,
527
+ Array: inspectArray,
528
+ Date: inspectDate,
529
+ Map: inspectMap,
530
+ Set: inspectSet,
531
+ RegExp: inspectRegExp,
532
+ Promise: promise_default,
533
+ // WeakSet, WeakMap are totally opaque to us
534
+ WeakSet: (value, options) => options.stylize("WeakSet{\u2026}", "special"),
535
+ WeakMap: (value, options) => options.stylize("WeakMap{\u2026}", "special"),
536
+ Arguments: inspectArguments,
537
+ Int8Array: inspectTypedArray,
538
+ Uint8Array: inspectTypedArray,
539
+ Uint8ClampedArray: inspectTypedArray,
540
+ Int16Array: inspectTypedArray,
541
+ Uint16Array: inspectTypedArray,
542
+ Int32Array: inspectTypedArray,
543
+ Uint32Array: inspectTypedArray,
544
+ Float32Array: inspectTypedArray,
545
+ Float64Array: inspectTypedArray,
546
+ Generator: () => "",
547
+ DataView: () => "",
548
+ ArrayBuffer: () => "",
549
+ Error: inspectObject2,
550
+ HTMLCollection: inspectNodeCollection,
551
+ NodeList: inspectNodeCollection
552
+ };
553
+ var inspectCustom = (value, options, type, inspectFn) => {
554
+ if (chaiInspect in value && typeof value[chaiInspect] === "function") {
555
+ return value[chaiInspect](options);
556
+ }
557
+ if (nodeInspect in value && typeof value[nodeInspect] === "function") {
558
+ return value[nodeInspect](options.depth, options, inspectFn);
559
+ }
560
+ if ("inspect" in value && typeof value.inspect === "function") {
561
+ return value.inspect(options.depth, options);
562
+ }
563
+ if ("constructor" in value && constructorMap.has(value.constructor)) {
564
+ return constructorMap.get(value.constructor)(value, options);
565
+ }
566
+ if (stringTagMap[type]) {
567
+ return stringTagMap[type](value, options);
568
+ }
569
+ return "";
570
+ };
571
+ var toString = Object.prototype.toString;
572
+ function inspect(value, opts = {}) {
573
+ const options = normaliseOptions(opts, inspect);
574
+ const { customInspect } = options;
575
+ let type = value === null ? "null" : typeof value;
576
+ if (type === "object") {
577
+ type = toString.call(value).slice(8, -1);
578
+ }
579
+ if (type in baseTypesMap) {
580
+ return baseTypesMap[type](value, options);
581
+ }
582
+ if (customInspect && value) {
583
+ const output = inspectCustom(value, options, type, inspect);
584
+ if (output) {
585
+ if (typeof output === "string") return output;
586
+ return inspect(output, options);
587
+ }
588
+ }
589
+ const proto = value ? Object.getPrototypeOf(value) : false;
590
+ if (proto === Object.prototype || proto === null) {
591
+ return inspectObject(value, options);
592
+ }
593
+ if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) {
594
+ return inspectHTML(value, options);
595
+ }
596
+ if ("constructor" in value) {
597
+ if (value.constructor !== Object) {
598
+ return inspectClass(value, options);
599
+ }
600
+ return inspectObject(value, options);
601
+ }
602
+ if (value === Object(value)) {
603
+ return inspectObject(value, options);
604
+ }
605
+ return options.stylize(String(value), type);
606
+ }
607
+ function registerConstructor(constructor, inspector) {
608
+ if (constructorMap.has(constructor)) {
609
+ return false;
610
+ }
611
+ constructorMap.set(constructor, inspector);
612
+ return true;
613
+ }
614
+ function registerStringTag(stringTag, inspector) {
615
+ if (stringTag in stringTagMap) {
616
+ return false;
617
+ }
618
+ stringTagMap[stringTag] = inspector;
619
+ return true;
620
+ }
621
+ var custom = chaiInspect;
622
+ var index_default = inspect;
tools/ui/node_modules/loupe/package.json ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loupe",
3
+ "version": "3.2.1",
4
+ "description": "Inspect utility for Node.js and browsers",
5
+ "homepage": "https://github.com/chaijs/loupe",
6
+ "license": "MIT",
7
+ "author": "Veselin Todorov <hi@vesln.com>",
8
+ "contributors": [
9
+ "Keith Cirkel (https://github.com/keithamus)"
10
+ ],
11
+ "type": "module",
12
+ "main": "./lib/index.js",
13
+ "module": "./lib/index.js",
14
+ "browser": {
15
+ "./index.js": "./loupe.js",
16
+ "util": false
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/chaijs/loupe"
21
+ },
22
+ "files": [
23
+ "loupe.js",
24
+ "lib/*"
25
+ ],
26
+ "scripts": {
27
+ "bench": "node bench",
28
+ "lint": "eslint .",
29
+ "semantic-release": "semantic-release pre && npm publish && semantic-release post",
30
+ "test": "npm run test:node && npm run test:browser",
31
+ "pretest:browser": "npx playwright install-deps && npx playwright install && npm run build",
32
+ "test:browser": "wtr",
33
+ "pretest:node": "npm run build",
34
+ "test:node": "mocha",
35
+ "build": "npm run build:lib && npm run build:esm-bundle && npm run build:cjs-bundle",
36
+ "build:lib": "tsc",
37
+ "build:esm-bundle": "esbuild --bundle src/index.ts --outfile=loupe.js --format=esm",
38
+ "build:cjs-bundle": "esbuild --bundle src/index.ts --outfile=loupe.js --format=cjs",
39
+ "upload-coverage": "codecov"
40
+ },
41
+ "prettier": {
42
+ "printWidth": 120,
43
+ "tabWidth": 2,
44
+ "useTabs": false,
45
+ "semi": false,
46
+ "singleQuote": true,
47
+ "trailingComma": "es5",
48
+ "arrowParens": "avoid",
49
+ "bracketSpacing": true
50
+ },
51
+ "devDependencies": {
52
+ "@web/dev-server-esbuild": "^1.0.3",
53
+ "@web/test-runner": "^0.19.0",
54
+ "@web/test-runner-playwright": "^0.11.0",
55
+ "benchmark": "^2.1.4",
56
+ "chai": "^5.0.0-alpha.0",
57
+ "codecov": "^3.8.3",
58
+ "core-js": "^3.8.3",
59
+ "cross-env": "^7.0.3",
60
+ "esbuild": "^0.24.2",
61
+ "eslint": "^9.19.0",
62
+ "eslint-config-prettier": "^10.0.1",
63
+ "eslint-config-strict": "^14.0.1",
64
+ "eslint-plugin-filenames": "^1.3.2",
65
+ "eslint-plugin-prettier": "^5.2.3",
66
+ "husky": "^9.1.7",
67
+ "mocha": "^11.1.0",
68
+ "nyc": "^17.1.0",
69
+ "prettier": "^3.0.0",
70
+ "simple-assert": "^2.0.0",
71
+ "typescript": "^5.0.0-beta"
72
+ }
73
+ }
tools/ui/node_modules/lowlight/index.d.ts ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export type {LanguageFn} from 'highlight.js'
2
+ export type {AutoOptions, Options} from './lib/index.js'
3
+ export {grammars as all} from './lib/all.js'
4
+ export {grammars as common} from './lib/common.js'
5
+ export {createLowlight} from './lib/index.js'
6
+
7
+ // Register data on hast.
8
+ declare module 'hast' {
9
+ interface RootData {
10
+ /**
11
+ * Field exposed by `lowlight` to contain the detected programming language
12
+ * name.
13
+ */
14
+ language?: string | undefined
15
+
16
+ /**
17
+ * Field exposed by `lowlight` to contain a relevance: how sure `lowlight`
18
+ * is that the given code is in the language.
19
+ */
20
+ relevance?: number | undefined
21
+ }
22
+ }
tools/ui/node_modules/lowlight/index.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ // Note: types exposed from `index.d.ts`.
2
+ export {grammars as all} from './lib/all.js'
3
+ export {grammars as common} from './lib/common.js'
4
+ export {createLowlight} from './lib/index.js'
tools/ui/node_modules/lowlight/lib/all.d.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Map of grammars.
3
+ *
4
+ * @type {Record<string, LanguageFn>}
5
+ */
6
+ export const grammars: Record<string, LanguageFn>;
7
+ import type { LanguageFn } from 'highlight.js';
8
+ //# sourceMappingURL=all.d.ts.map
tools/ui/node_modules/lowlight/lib/all.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"all.d.ts","sourceRoot":"","sources":["all.js"],"names":[],"mappings":"AAkKA;;;;GAIG;AACH,uBAFU,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CA+JnC;gCAnU4B,cAAc"}
tools/ui/node_modules/lowlight/lib/all.js ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @import {LanguageFn} from 'highlight.js'
3
+ */
4
+
5
+ import $1c from 'highlight.js/lib/languages/1c'
6
+ import abnf from 'highlight.js/lib/languages/abnf'
7
+ import accesslog from 'highlight.js/lib/languages/accesslog'
8
+ import actionscript from 'highlight.js/lib/languages/actionscript'
9
+ import ada from 'highlight.js/lib/languages/ada'
10
+ import angelscript from 'highlight.js/lib/languages/angelscript'
11
+ import apache from 'highlight.js/lib/languages/apache'
12
+ import applescript from 'highlight.js/lib/languages/applescript'
13
+ import arcade from 'highlight.js/lib/languages/arcade'
14
+ import armasm from 'highlight.js/lib/languages/armasm'
15
+ import asciidoc from 'highlight.js/lib/languages/asciidoc'
16
+ import aspectj from 'highlight.js/lib/languages/aspectj'
17
+ import autohotkey from 'highlight.js/lib/languages/autohotkey'
18
+ import autoit from 'highlight.js/lib/languages/autoit'
19
+ import avrasm from 'highlight.js/lib/languages/avrasm'
20
+ import awk from 'highlight.js/lib/languages/awk'
21
+ import axapta from 'highlight.js/lib/languages/axapta'
22
+ import basic from 'highlight.js/lib/languages/basic'
23
+ import bnf from 'highlight.js/lib/languages/bnf'
24
+ import brainfuck from 'highlight.js/lib/languages/brainfuck'
25
+ import cal from 'highlight.js/lib/languages/cal'
26
+ import capnproto from 'highlight.js/lib/languages/capnproto'
27
+ import ceylon from 'highlight.js/lib/languages/ceylon'
28
+ import clean from 'highlight.js/lib/languages/clean'
29
+ import clojure from 'highlight.js/lib/languages/clojure'
30
+ import clojureRepl from 'highlight.js/lib/languages/clojure-repl'
31
+ import cmake from 'highlight.js/lib/languages/cmake'
32
+ import coffeescript from 'highlight.js/lib/languages/coffeescript'
33
+ import coq from 'highlight.js/lib/languages/coq'
34
+ import cos from 'highlight.js/lib/languages/cos'
35
+ import crmsh from 'highlight.js/lib/languages/crmsh'
36
+ import crystal from 'highlight.js/lib/languages/crystal'
37
+ import csp from 'highlight.js/lib/languages/csp'
38
+ import d from 'highlight.js/lib/languages/d'
39
+ import dart from 'highlight.js/lib/languages/dart'
40
+ import delphi from 'highlight.js/lib/languages/delphi'
41
+ import django from 'highlight.js/lib/languages/django'
42
+ import dns from 'highlight.js/lib/languages/dns'
43
+ import dockerfile from 'highlight.js/lib/languages/dockerfile'
44
+ import dos from 'highlight.js/lib/languages/dos'
45
+ import dsconfig from 'highlight.js/lib/languages/dsconfig'
46
+ import dts from 'highlight.js/lib/languages/dts'
47
+ import dust from 'highlight.js/lib/languages/dust'
48
+ import ebnf from 'highlight.js/lib/languages/ebnf'
49
+ import elixir from 'highlight.js/lib/languages/elixir'
50
+ import elm from 'highlight.js/lib/languages/elm'
51
+ import erb from 'highlight.js/lib/languages/erb'
52
+ import erlang from 'highlight.js/lib/languages/erlang'
53
+ import erlangRepl from 'highlight.js/lib/languages/erlang-repl'
54
+ import excel from 'highlight.js/lib/languages/excel'
55
+ import fix from 'highlight.js/lib/languages/fix'
56
+ import flix from 'highlight.js/lib/languages/flix'
57
+ import fortran from 'highlight.js/lib/languages/fortran'
58
+ import fsharp from 'highlight.js/lib/languages/fsharp'
59
+ import gams from 'highlight.js/lib/languages/gams'
60
+ import gauss from 'highlight.js/lib/languages/gauss'
61
+ import gcode from 'highlight.js/lib/languages/gcode'
62
+ import gherkin from 'highlight.js/lib/languages/gherkin'
63
+ import glsl from 'highlight.js/lib/languages/glsl'
64
+ import gml from 'highlight.js/lib/languages/gml'
65
+ import golo from 'highlight.js/lib/languages/golo'
66
+ import gradle from 'highlight.js/lib/languages/gradle'
67
+ import groovy from 'highlight.js/lib/languages/groovy'
68
+ import haml from 'highlight.js/lib/languages/haml'
69
+ import handlebars from 'highlight.js/lib/languages/handlebars'
70
+ import haskell from 'highlight.js/lib/languages/haskell'
71
+ import haxe from 'highlight.js/lib/languages/haxe'
72
+ import hsp from 'highlight.js/lib/languages/hsp'
73
+ import http from 'highlight.js/lib/languages/http'
74
+ import hy from 'highlight.js/lib/languages/hy'
75
+ import inform7 from 'highlight.js/lib/languages/inform7'
76
+ import irpf90 from 'highlight.js/lib/languages/irpf90'
77
+ import isbl from 'highlight.js/lib/languages/isbl'
78
+ import jbossCli from 'highlight.js/lib/languages/jboss-cli'
79
+ import julia from 'highlight.js/lib/languages/julia'
80
+ import juliaRepl from 'highlight.js/lib/languages/julia-repl'
81
+ import lasso from 'highlight.js/lib/languages/lasso'
82
+ import latex from 'highlight.js/lib/languages/latex'
83
+ import ldif from 'highlight.js/lib/languages/ldif'
84
+ import leaf from 'highlight.js/lib/languages/leaf'
85
+ import lisp from 'highlight.js/lib/languages/lisp'
86
+ import livecodeserver from 'highlight.js/lib/languages/livecodeserver'
87
+ import livescript from 'highlight.js/lib/languages/livescript'
88
+ import llvm from 'highlight.js/lib/languages/llvm'
89
+ import lsl from 'highlight.js/lib/languages/lsl'
90
+ import mathematica from 'highlight.js/lib/languages/mathematica'
91
+ import matlab from 'highlight.js/lib/languages/matlab'
92
+ import maxima from 'highlight.js/lib/languages/maxima'
93
+ import mel from 'highlight.js/lib/languages/mel'
94
+ import mercury from 'highlight.js/lib/languages/mercury'
95
+ import mipsasm from 'highlight.js/lib/languages/mipsasm'
96
+ import mizar from 'highlight.js/lib/languages/mizar'
97
+ import mojolicious from 'highlight.js/lib/languages/mojolicious'
98
+ import monkey from 'highlight.js/lib/languages/monkey'
99
+ import moonscript from 'highlight.js/lib/languages/moonscript'
100
+ import n1ql from 'highlight.js/lib/languages/n1ql'
101
+ import nestedtext from 'highlight.js/lib/languages/nestedtext'
102
+ import nginx from 'highlight.js/lib/languages/nginx'
103
+ import nim from 'highlight.js/lib/languages/nim'
104
+ import nix from 'highlight.js/lib/languages/nix'
105
+ import nodeRepl from 'highlight.js/lib/languages/node-repl'
106
+ import nsis from 'highlight.js/lib/languages/nsis'
107
+ import ocaml from 'highlight.js/lib/languages/ocaml'
108
+ import openscad from 'highlight.js/lib/languages/openscad'
109
+ import oxygene from 'highlight.js/lib/languages/oxygene'
110
+ import parser3 from 'highlight.js/lib/languages/parser3'
111
+ import pf from 'highlight.js/lib/languages/pf'
112
+ import pgsql from 'highlight.js/lib/languages/pgsql'
113
+ import pony from 'highlight.js/lib/languages/pony'
114
+ import powershell from 'highlight.js/lib/languages/powershell'
115
+ import processing from 'highlight.js/lib/languages/processing'
116
+ import profile from 'highlight.js/lib/languages/profile'
117
+ import prolog from 'highlight.js/lib/languages/prolog'
118
+ import properties from 'highlight.js/lib/languages/properties'
119
+ import protobuf from 'highlight.js/lib/languages/protobuf'
120
+ import puppet from 'highlight.js/lib/languages/puppet'
121
+ import purebasic from 'highlight.js/lib/languages/purebasic'
122
+ import q from 'highlight.js/lib/languages/q'
123
+ import qml from 'highlight.js/lib/languages/qml'
124
+ import reasonml from 'highlight.js/lib/languages/reasonml'
125
+ import rib from 'highlight.js/lib/languages/rib'
126
+ import roboconf from 'highlight.js/lib/languages/roboconf'
127
+ import routeros from 'highlight.js/lib/languages/routeros'
128
+ import rsl from 'highlight.js/lib/languages/rsl'
129
+ import ruleslanguage from 'highlight.js/lib/languages/ruleslanguage'
130
+ import sas from 'highlight.js/lib/languages/sas'
131
+ import scala from 'highlight.js/lib/languages/scala'
132
+ import scheme from 'highlight.js/lib/languages/scheme'
133
+ import scilab from 'highlight.js/lib/languages/scilab'
134
+ import smali from 'highlight.js/lib/languages/smali'
135
+ import smalltalk from 'highlight.js/lib/languages/smalltalk'
136
+ import sml from 'highlight.js/lib/languages/sml'
137
+ import sqf from 'highlight.js/lib/languages/sqf'
138
+ import stan from 'highlight.js/lib/languages/stan'
139
+ import stata from 'highlight.js/lib/languages/stata'
140
+ import step21 from 'highlight.js/lib/languages/step21'
141
+ import stylus from 'highlight.js/lib/languages/stylus'
142
+ import subunit from 'highlight.js/lib/languages/subunit'
143
+ import taggerscript from 'highlight.js/lib/languages/taggerscript'
144
+ import tap from 'highlight.js/lib/languages/tap'
145
+ import tcl from 'highlight.js/lib/languages/tcl'
146
+ import thrift from 'highlight.js/lib/languages/thrift'
147
+ import tp from 'highlight.js/lib/languages/tp'
148
+ import twig from 'highlight.js/lib/languages/twig'
149
+ import vala from 'highlight.js/lib/languages/vala'
150
+ import vbscript from 'highlight.js/lib/languages/vbscript'
151
+ import vbscriptHtml from 'highlight.js/lib/languages/vbscript-html'
152
+ import verilog from 'highlight.js/lib/languages/verilog'
153
+ import vhdl from 'highlight.js/lib/languages/vhdl'
154
+ import vim from 'highlight.js/lib/languages/vim'
155
+ import wren from 'highlight.js/lib/languages/wren'
156
+ import x86asm from 'highlight.js/lib/languages/x86asm'
157
+ import xl from 'highlight.js/lib/languages/xl'
158
+ import xquery from 'highlight.js/lib/languages/xquery'
159
+ import zephir from 'highlight.js/lib/languages/zephir'
160
+ import {grammars as base} from './common.js'
161
+
162
+ /**
163
+ * Map of grammars.
164
+ *
165
+ * @type {Record<string, LanguageFn>}
166
+ */
167
+ export const grammars = {
168
+ ...base,
169
+ '1c': $1c,
170
+ abnf,
171
+ accesslog,
172
+ actionscript,
173
+ ada,
174
+ angelscript,
175
+ apache,
176
+ applescript,
177
+ arcade,
178
+ armasm,
179
+ asciidoc,
180
+ aspectj,
181
+ autohotkey,
182
+ autoit,
183
+ avrasm,
184
+ awk,
185
+ axapta,
186
+ basic,
187
+ bnf,
188
+ brainfuck,
189
+ cal,
190
+ capnproto,
191
+ ceylon,
192
+ clean,
193
+ clojure,
194
+ 'clojure-repl': clojureRepl,
195
+ cmake,
196
+ coffeescript,
197
+ coq,
198
+ cos,
199
+ crmsh,
200
+ crystal,
201
+ csp,
202
+ d,
203
+ dart,
204
+ delphi,
205
+ django,
206
+ dns,
207
+ dockerfile,
208
+ dos,
209
+ dsconfig,
210
+ dts,
211
+ dust,
212
+ ebnf,
213
+ elixir,
214
+ elm,
215
+ erb,
216
+ erlang,
217
+ 'erlang-repl': erlangRepl,
218
+ excel,
219
+ fix,
220
+ flix,
221
+ fortran,
222
+ fsharp,
223
+ gams,
224
+ gauss,
225
+ gcode,
226
+ gherkin,
227
+ glsl,
228
+ gml,
229
+ golo,
230
+ gradle,
231
+ groovy,
232
+ haml,
233
+ handlebars,
234
+ haskell,
235
+ haxe,
236
+ hsp,
237
+ http,
238
+ hy,
239
+ inform7,
240
+ irpf90,
241
+ isbl,
242
+ 'jboss-cli': jbossCli,
243
+ julia,
244
+ 'julia-repl': juliaRepl,
245
+ lasso,
246
+ latex,
247
+ ldif,
248
+ leaf,
249
+ lisp,
250
+ livecodeserver,
251
+ livescript,
252
+ llvm,
253
+ lsl,
254
+ mathematica,
255
+ matlab,
256
+ maxima,
257
+ mel,
258
+ mercury,
259
+ mipsasm,
260
+ mizar,
261
+ mojolicious,
262
+ monkey,
263
+ moonscript,
264
+ n1ql,
265
+ nestedtext,
266
+ nginx,
267
+ nim,
268
+ nix,
269
+ 'node-repl': nodeRepl,
270
+ nsis,
271
+ ocaml,
272
+ openscad,
273
+ oxygene,
274
+ parser3,
275
+ pf,
276
+ pgsql,
277
+ pony,
278
+ powershell,
279
+ processing,
280
+ profile,
281
+ prolog,
282
+ properties,
283
+ protobuf,
284
+ puppet,
285
+ purebasic,
286
+ q,
287
+ qml,
288
+ reasonml,
289
+ rib,
290
+ roboconf,
291
+ routeros,
292
+ rsl,
293
+ ruleslanguage,
294
+ sas,
295
+ scala,
296
+ scheme,
297
+ scilab,
298
+ smali,
299
+ smalltalk,
300
+ sml,
301
+ sqf,
302
+ stan,
303
+ stata,
304
+ step21,
305
+ stylus,
306
+ subunit,
307
+ taggerscript,
308
+ tap,
309
+ tcl,
310
+ thrift,
311
+ tp,
312
+ twig,
313
+ vala,
314
+ vbscript,
315
+ 'vbscript-html': vbscriptHtml,
316
+ verilog,
317
+ vhdl,
318
+ vim,
319
+ wren,
320
+ x86asm,
321
+ xl,
322
+ xquery,
323
+ zephir
324
+ }
tools/ui/node_modules/lowlight/lib/common.d.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Map of grammars.
3
+ *
4
+ * @type {Record<string, LanguageFn>}
5
+ */
6
+ export const grammars: Record<string, LanguageFn>;
7
+ import type { LanguageFn } from 'highlight.js';
8
+ //# sourceMappingURL=common.d.ts.map
tools/ui/node_modules/lowlight/lib/common.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["common.js"],"names":[],"mappings":"AA2CA;;;;GAIG;AACH,uBAFU,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAwCnC;gCArF4B,cAAc"}
tools/ui/node_modules/lowlight/lib/common.js ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @import {LanguageFn} from 'highlight.js'
3
+ */
4
+
5
+ import arduino from 'highlight.js/lib/languages/arduino'
6
+ import bash from 'highlight.js/lib/languages/bash'
7
+ import c from 'highlight.js/lib/languages/c'
8
+ import cpp from 'highlight.js/lib/languages/cpp'
9
+ import csharp from 'highlight.js/lib/languages/csharp'
10
+ import css from 'highlight.js/lib/languages/css'
11
+ import diff from 'highlight.js/lib/languages/diff'
12
+ import go from 'highlight.js/lib/languages/go'
13
+ import graphql from 'highlight.js/lib/languages/graphql'
14
+ import ini from 'highlight.js/lib/languages/ini'
15
+ import java from 'highlight.js/lib/languages/java'
16
+ import javascript from 'highlight.js/lib/languages/javascript'
17
+ import json from 'highlight.js/lib/languages/json'
18
+ import kotlin from 'highlight.js/lib/languages/kotlin'
19
+ import less from 'highlight.js/lib/languages/less'
20
+ import lua from 'highlight.js/lib/languages/lua'
21
+ import makefile from 'highlight.js/lib/languages/makefile'
22
+ import markdown from 'highlight.js/lib/languages/markdown'
23
+ import objectivec from 'highlight.js/lib/languages/objectivec'
24
+ import perl from 'highlight.js/lib/languages/perl'
25
+ import php from 'highlight.js/lib/languages/php'
26
+ import phpTemplate from 'highlight.js/lib/languages/php-template'
27
+ import plaintext from 'highlight.js/lib/languages/plaintext'
28
+ import python from 'highlight.js/lib/languages/python'
29
+ import pythonRepl from 'highlight.js/lib/languages/python-repl'
30
+ import r from 'highlight.js/lib/languages/r'
31
+ import ruby from 'highlight.js/lib/languages/ruby'
32
+ import rust from 'highlight.js/lib/languages/rust'
33
+ import scss from 'highlight.js/lib/languages/scss'
34
+ import shell from 'highlight.js/lib/languages/shell'
35
+ import sql from 'highlight.js/lib/languages/sql'
36
+ import swift from 'highlight.js/lib/languages/swift'
37
+ import typescript from 'highlight.js/lib/languages/typescript'
38
+ import vbnet from 'highlight.js/lib/languages/vbnet'
39
+ import wasm from 'highlight.js/lib/languages/wasm'
40
+ import xml from 'highlight.js/lib/languages/xml'
41
+ import yaml from 'highlight.js/lib/languages/yaml'
42
+
43
+ /**
44
+ * Map of grammars.
45
+ *
46
+ * @type {Record<string, LanguageFn>}
47
+ */
48
+ export const grammars = {
49
+ arduino,
50
+ bash,
51
+ c,
52
+ cpp,
53
+ csharp,
54
+ css,
55
+ diff,
56
+ go,
57
+ graphql,
58
+ ini,
59
+ java,
60
+ javascript,
61
+ json,
62
+ kotlin,
63
+ less,
64
+ lua,
65
+ makefile,
66
+ markdown,
67
+ objectivec,
68
+ perl,
69
+ php,
70
+ 'php-template': phpTemplate,
71
+ plaintext,
72
+ python,
73
+ 'python-repl': pythonRepl,
74
+ r,
75
+ ruby,
76
+ rust,
77
+ scss,
78
+ shell,
79
+ sql,
80
+ swift,
81
+ typescript,
82
+ vbnet,
83
+ wasm,
84
+ xml,
85
+ yaml
86
+ }
tools/ui/node_modules/lowlight/lib/index.d.ts ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Create a `lowlight` instance.
3
+ *
4
+ * @param {Readonly<Record<string, LanguageFn>> | null | undefined} [grammars]
5
+ * Grammars to add (optional).
6
+ * @returns
7
+ * Lowlight.
8
+ */
9
+ export function createLowlight(grammars?: Readonly<Record<string, LanguageFn>> | null | undefined): {
10
+ highlight: (language: string, value: string, options?: Readonly<Options> | null | undefined) => Root;
11
+ highlightAuto: (value: string, options?: Readonly<AutoOptions> | null | undefined) => Root;
12
+ listLanguages: () => Array<string>;
13
+ register: {
14
+ /**
15
+ * Register languages.
16
+ *
17
+ * @example
18
+ * ```js
19
+ * import {createLowlight} from 'lowlight'
20
+ * import xml from 'highlight.js/lib/languages/xml'
21
+ *
22
+ * const lowlight = createLowlight()
23
+ *
24
+ * lowlight.register({xml})
25
+ *
26
+ * // Note: `html` is an alias for `xml`.
27
+ * console.log(lowlight.highlight('html', '<em>Emphasis</em>'))
28
+ * ```
29
+ *
30
+ * Yields:
31
+ *
32
+ * ```js
33
+ * {type: 'root', children: [Array], data: {language: 'html', relevance: 2}}
34
+ * ```
35
+ *
36
+ * @overload
37
+ * @param {Readonly<Record<string, LanguageFn>>} grammars
38
+ * @returns {undefined}
39
+ *
40
+ * @overload
41
+ * @param {string} name
42
+ * @param {LanguageFn} grammar
43
+ * @returns {undefined}
44
+ *
45
+ * @param {Readonly<Record<string, LanguageFn>> | string} grammarsOrName
46
+ * Grammars or programming language name.
47
+ * @param {LanguageFn | undefined} [grammar]
48
+ * Grammar, if with name.
49
+ * @returns {undefined}
50
+ * Nothing.
51
+ */
52
+ (grammars: Readonly<Record<string, LanguageFn>>): undefined;
53
+ /**
54
+ * Register languages.
55
+ *
56
+ * @example
57
+ * ```js
58
+ * import {createLowlight} from 'lowlight'
59
+ * import xml from 'highlight.js/lib/languages/xml'
60
+ *
61
+ * const lowlight = createLowlight()
62
+ *
63
+ * lowlight.register({xml})
64
+ *
65
+ * // Note: `html` is an alias for `xml`.
66
+ * console.log(lowlight.highlight('html', '<em>Emphasis</em>'))
67
+ * ```
68
+ *
69
+ * Yields:
70
+ *
71
+ * ```js
72
+ * {type: 'root', children: [Array], data: {language: 'html', relevance: 2}}
73
+ * ```
74
+ *
75
+ * @overload
76
+ * @param {Readonly<Record<string, LanguageFn>>} grammars
77
+ * @returns {undefined}
78
+ *
79
+ * @overload
80
+ * @param {string} name
81
+ * @param {LanguageFn} grammar
82
+ * @returns {undefined}
83
+ *
84
+ * @param {Readonly<Record<string, LanguageFn>> | string} grammarsOrName
85
+ * Grammars or programming language name.
86
+ * @param {LanguageFn | undefined} [grammar]
87
+ * Grammar, if with name.
88
+ * @returns {undefined}
89
+ * Nothing.
90
+ */
91
+ (name: string, grammar: LanguageFn): undefined;
92
+ };
93
+ registerAlias: {
94
+ /**
95
+ * Register aliases.
96
+ *
97
+ * @example
98
+ * ```js
99
+ * import {createLowlight} from 'lowlight'
100
+ * import markdown from 'highlight.js/lib/languages/markdown'
101
+ *
102
+ * const lowlight = createLowlight()
103
+ *
104
+ * lowlight.register({markdown})
105
+ *
106
+ * // lowlight.highlight('mdown', '<em>Emphasis</em>')
107
+ * // ^ would throw: Error: Unknown language: `mdown` is not registered
108
+ *
109
+ * lowlight.registerAlias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})
110
+ * lowlight.highlight('mdown', '<em>Emphasis</em>')
111
+ * // ^ Works!
112
+ * ```
113
+ *
114
+ * @overload
115
+ * @param {Readonly<Record<string, ReadonlyArray<string> | string>>} aliases
116
+ * @returns {undefined}
117
+ *
118
+ * @overload
119
+ * @param {string} language
120
+ * @param {ReadonlyArray<string> | string} alias
121
+ * @returns {undefined}
122
+ *
123
+ * @param {Readonly<Record<string, ReadonlyArray<string> | string>> | string} aliasesOrName
124
+ * Map of programming language names to one or more aliases, or programming
125
+ * language name.
126
+ * @param {ReadonlyArray<string> | string | undefined} [alias]
127
+ * One or more aliases for the programming language, if with `name`.
128
+ * @returns {undefined}
129
+ * Nothing.
130
+ */
131
+ (aliases: Readonly<Record<string, ReadonlyArray<string> | string>>): undefined;
132
+ /**
133
+ * Register aliases.
134
+ *
135
+ * @example
136
+ * ```js
137
+ * import {createLowlight} from 'lowlight'
138
+ * import markdown from 'highlight.js/lib/languages/markdown'
139
+ *
140
+ * const lowlight = createLowlight()
141
+ *
142
+ * lowlight.register({markdown})
143
+ *
144
+ * // lowlight.highlight('mdown', '<em>Emphasis</em>')
145
+ * // ^ would throw: Error: Unknown language: `mdown` is not registered
146
+ *
147
+ * lowlight.registerAlias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})
148
+ * lowlight.highlight('mdown', '<em>Emphasis</em>')
149
+ * // ^ Works!
150
+ * ```
151
+ *
152
+ * @overload
153
+ * @param {Readonly<Record<string, ReadonlyArray<string> | string>>} aliases
154
+ * @returns {undefined}
155
+ *
156
+ * @overload
157
+ * @param {string} language
158
+ * @param {ReadonlyArray<string> | string} alias
159
+ * @returns {undefined}
160
+ *
161
+ * @param {Readonly<Record<string, ReadonlyArray<string> | string>> | string} aliasesOrName
162
+ * Map of programming language names to one or more aliases, or programming
163
+ * language name.
164
+ * @param {ReadonlyArray<string> | string | undefined} [alias]
165
+ * One or more aliases for the programming language, if with `name`.
166
+ * @returns {undefined}
167
+ * Nothing.
168
+ */
169
+ (language: string, alias: ReadonlyArray<string> | string): undefined;
170
+ };
171
+ registered: (aliasOrName: string) => boolean;
172
+ };
173
+ /**
174
+ * Extra fields.
175
+ */
176
+ export type ExtraOptions = {
177
+ /**
178
+ * List of allowed languages (default: all registered languages).
179
+ */
180
+ subset?: ReadonlyArray<string> | null | undefined;
181
+ };
182
+ /**
183
+ * Configuration for `highlight`.
184
+ */
185
+ export type Options = {
186
+ /**
187
+ * Class prefix (default: `'hljs-'`).
188
+ */
189
+ prefix?: string | null | undefined;
190
+ };
191
+ /**
192
+ * Configuration for `highlightAuto`.
193
+ */
194
+ export type AutoOptions = Options & ExtraOptions;
195
+ import type { LanguageFn } from 'highlight.js';
196
+ import type { Root } from 'hast';
197
+ //# sourceMappingURL=index.d.ts.map
tools/ui/node_modules/lowlight/lib/index.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA4BA;;;;;;;GAOG;AACH,0CALW,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS;0BAuCrD,MAAM,SAEN,MAAM,YAEN,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,KAElC,IAAI;2BA6DN,MAAM,YAEN,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,KAEtC,IAAI;yBA0DJ,KAAK,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA8Bf,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAClC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAGX,MAAM,WACN,UAAU,GACR,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA8CX,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,GACtD,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAGX,MAAM,SACN,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,GAC5B,SAAS;;8BAmDX,MAAM,KAEJ,OAAO;EAMrB;;;;;;;;aAlVa,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS;;;;;;;;;aAKxC,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;0BAG1B,OAAO,GAAG,YAAY;gCAdgD,cAAc;0BADvC,MAAM"}
tools/ui/node_modules/lowlight/lib/index.js ADDED
@@ -0,0 +1,482 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @import {ElementContent, Element, RootData, Root} from 'hast'
3
+ * @import {Emitter, HLJSOptions as HljsOptions, HighlightResult, LanguageFn} from 'highlight.js'
4
+ */
5
+
6
+ /**
7
+ * @typedef {Object} ExtraOptions
8
+ * Extra fields.
9
+ * @property {ReadonlyArray<string> | null | undefined} [subset]
10
+ * List of allowed languages (default: all registered languages).
11
+ *
12
+ * @typedef Options
13
+ * Configuration for `highlight`.
14
+ * @property {string | null | undefined} [prefix='hljs-']
15
+ * Class prefix (default: `'hljs-'`).
16
+ *
17
+ * @typedef {Options & ExtraOptions} AutoOptions
18
+ * Configuration for `highlightAuto`.
19
+ */
20
+
21
+ import {ok as assert} from 'devlop'
22
+ import HighlightJs from 'highlight.js/lib/core'
23
+
24
+ /** @type {AutoOptions} */
25
+ const emptyOptions = {}
26
+
27
+ const defaultPrefix = 'hljs-'
28
+
29
+ /**
30
+ * Create a `lowlight` instance.
31
+ *
32
+ * @param {Readonly<Record<string, LanguageFn>> | null | undefined} [grammars]
33
+ * Grammars to add (optional).
34
+ * @returns
35
+ * Lowlight.
36
+ */
37
+ export function createLowlight(grammars) {
38
+ const high = HighlightJs.newInstance()
39
+
40
+ if (grammars) {
41
+ register(grammars)
42
+ }
43
+
44
+ return {
45
+ highlight,
46
+ highlightAuto,
47
+ listLanguages,
48
+ register,
49
+ registerAlias,
50
+ registered
51
+ }
52
+
53
+ /**
54
+ * Highlight `value` (code) as `language` (name).
55
+ *
56
+ * @example
57
+ * ```js
58
+ * import {common, createLowlight} from 'lowlight'
59
+ *
60
+ * const lowlight = createLowlight(common)
61
+ *
62
+ * console.log(lowlight.highlight('css', 'em { color: red }'))
63
+ * ```
64
+ *
65
+ * Yields:
66
+ *
67
+ * ```js
68
+ * {type: 'root', children: [Array], data: {language: 'css', relevance: 3}}
69
+ * ```
70
+ *
71
+ * @param {string} language
72
+ * Programming language name.
73
+ * @param {string} value
74
+ * Code to highlight.
75
+ * @param {Readonly<Options> | null | undefined} [options={}]
76
+ * Configuration (optional).
77
+ * @returns {Root}
78
+ * Tree; with the following `data` fields: `language` (`string`), detected
79
+ * programming language name; `relevance` (`number`), how sure lowlight is
80
+ * that the given code is in the language.
81
+ */
82
+ function highlight(language, value, options) {
83
+ assert(typeof language === 'string', 'expected `string` as `name`')
84
+ assert(typeof value === 'string', 'expected `string` as `value`')
85
+ const settings = options || emptyOptions
86
+ const prefix =
87
+ typeof settings.prefix === 'string' ? settings.prefix : defaultPrefix
88
+
89
+ if (!high.getLanguage(language)) {
90
+ throw new Error('Unknown language: `' + language + '` is not registered')
91
+ }
92
+
93
+ // See: <https://github.com/highlightjs/highlight.js/issues/3621#issuecomment-1528841888>
94
+ high.configure({__emitter: HastEmitter, classPrefix: prefix})
95
+
96
+ const result = /** @type {HighlightResult & {_emitter: HastEmitter}} */ (
97
+ high.highlight(value, {ignoreIllegals: true, language})
98
+ )
99
+
100
+ // `highlight.js` seems to use this (currently) for broken grammars, so let’s
101
+ // keep it in there just to be sure.
102
+ /* c8 ignore next 5 */
103
+ if (result.errorRaised) {
104
+ throw new Error('Could not highlight with `Highlight.js`', {
105
+ cause: result.errorRaised
106
+ })
107
+ }
108
+
109
+ const root = result._emitter.root
110
+
111
+ // Cast because it is always defined.
112
+ const data = /** @type {RootData} */ (root.data)
113
+
114
+ data.language = result.language
115
+ data.relevance = result.relevance
116
+
117
+ return root
118
+ }
119
+
120
+ /**
121
+ * Highlight `value` (code) and guess its programming language.
122
+ *
123
+ * @example
124
+ * ```js
125
+ * import {common, createLowlight} from 'lowlight'
126
+ *
127
+ * const lowlight = createLowlight(common)
128
+ *
129
+ * console.log(lowlight.highlightAuto('"hello, " + name + "!"'))
130
+ * ```
131
+ *
132
+ * Yields:
133
+ *
134
+ * ```js
135
+ * {type: 'root', children: [Array], data: {language: 'arduino', relevance: 2}}
136
+ * ```
137
+ *
138
+ * @param {string} value
139
+ * Code to highlight.
140
+ * @param {Readonly<AutoOptions> | null | undefined} [options={}]
141
+ * Configuration (optional).
142
+ * @returns {Root}
143
+ * Tree; with the following `data` fields: `language` (`string`), detected
144
+ * programming language name; `relevance` (`number`), how sure lowlight is
145
+ * that the given code is in the language.
146
+ */
147
+ function highlightAuto(value, options) {
148
+ assert(typeof value === 'string', 'expected `string` as `value`')
149
+ const settings = options || emptyOptions
150
+ const subset = settings.subset || listLanguages()
151
+
152
+ let index = -1
153
+ let relevance = 0
154
+ /** @type {Root | undefined} */
155
+ let result
156
+
157
+ while (++index < subset.length) {
158
+ const name = subset[index]
159
+
160
+ if (!high.getLanguage(name)) continue
161
+
162
+ const current = highlight(name, value, options)
163
+
164
+ if (
165
+ current.data &&
166
+ current.data.relevance !== undefined &&
167
+ current.data.relevance > relevance
168
+ ) {
169
+ relevance = current.data.relevance
170
+ result = current
171
+ }
172
+ }
173
+
174
+ return (
175
+ result || {
176
+ type: 'root',
177
+ children: [],
178
+ data: {language: undefined, relevance}
179
+ }
180
+ )
181
+ }
182
+
183
+ /**
184
+ * List registered languages.
185
+ *
186
+ * @example
187
+ * ```js
188
+ * import {createLowlight} from 'lowlight'
189
+ * import markdown from 'highlight.js/lib/languages/markdown'
190
+ *
191
+ * const lowlight = createLowlight()
192
+ *
193
+ * console.log(lowlight.listLanguages()) // => []
194
+ *
195
+ * lowlight.register({markdown})
196
+ *
197
+ * console.log(lowlight.listLanguages()) // => ['markdown']
198
+ * ```
199
+ *
200
+ * @returns {Array<string>}
201
+ * Names of registered language.
202
+ */
203
+ function listLanguages() {
204
+ return high.listLanguages()
205
+ }
206
+
207
+ /**
208
+ * Register languages.
209
+ *
210
+ * @example
211
+ * ```js
212
+ * import {createLowlight} from 'lowlight'
213
+ * import xml from 'highlight.js/lib/languages/xml'
214
+ *
215
+ * const lowlight = createLowlight()
216
+ *
217
+ * lowlight.register({xml})
218
+ *
219
+ * // Note: `html` is an alias for `xml`.
220
+ * console.log(lowlight.highlight('html', '<em>Emphasis</em>'))
221
+ * ```
222
+ *
223
+ * Yields:
224
+ *
225
+ * ```js
226
+ * {type: 'root', children: [Array], data: {language: 'html', relevance: 2}}
227
+ * ```
228
+ *
229
+ * @overload
230
+ * @param {Readonly<Record<string, LanguageFn>>} grammars
231
+ * @returns {undefined}
232
+ *
233
+ * @overload
234
+ * @param {string} name
235
+ * @param {LanguageFn} grammar
236
+ * @returns {undefined}
237
+ *
238
+ * @param {Readonly<Record<string, LanguageFn>> | string} grammarsOrName
239
+ * Grammars or programming language name.
240
+ * @param {LanguageFn | undefined} [grammar]
241
+ * Grammar, if with name.
242
+ * @returns {undefined}
243
+ * Nothing.
244
+ */
245
+ function register(grammarsOrName, grammar) {
246
+ if (typeof grammarsOrName === 'string') {
247
+ assert(grammar !== undefined, 'expected `grammar`')
248
+ high.registerLanguage(grammarsOrName, grammar)
249
+ } else {
250
+ /** @type {string} */
251
+ let name
252
+
253
+ for (name in grammarsOrName) {
254
+ if (Object.hasOwn(grammarsOrName, name)) {
255
+ high.registerLanguage(name, grammarsOrName[name])
256
+ }
257
+ }
258
+ }
259
+ }
260
+
261
+ /**
262
+ * Register aliases.
263
+ *
264
+ * @example
265
+ * ```js
266
+ * import {createLowlight} from 'lowlight'
267
+ * import markdown from 'highlight.js/lib/languages/markdown'
268
+ *
269
+ * const lowlight = createLowlight()
270
+ *
271
+ * lowlight.register({markdown})
272
+ *
273
+ * // lowlight.highlight('mdown', '<em>Emphasis</em>')
274
+ * // ^ would throw: Error: Unknown language: `mdown` is not registered
275
+ *
276
+ * lowlight.registerAlias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})
277
+ * lowlight.highlight('mdown', '<em>Emphasis</em>')
278
+ * // ^ Works!
279
+ * ```
280
+ *
281
+ * @overload
282
+ * @param {Readonly<Record<string, ReadonlyArray<string> | string>>} aliases
283
+ * @returns {undefined}
284
+ *
285
+ * @overload
286
+ * @param {string} language
287
+ * @param {ReadonlyArray<string> | string} alias
288
+ * @returns {undefined}
289
+ *
290
+ * @param {Readonly<Record<string, ReadonlyArray<string> | string>> | string} aliasesOrName
291
+ * Map of programming language names to one or more aliases, or programming
292
+ * language name.
293
+ * @param {ReadonlyArray<string> | string | undefined} [alias]
294
+ * One or more aliases for the programming language, if with `name`.
295
+ * @returns {undefined}
296
+ * Nothing.
297
+ */
298
+ function registerAlias(aliasesOrName, alias) {
299
+ if (typeof aliasesOrName === 'string') {
300
+ assert(alias !== undefined)
301
+ high.registerAliases(
302
+ // Note: copy needed because hljs doesn’t accept readonly arrays yet.
303
+ typeof alias === 'string' ? alias : [...alias],
304
+ {languageName: aliasesOrName}
305
+ )
306
+ } else {
307
+ /** @type {string} */
308
+ let key
309
+
310
+ for (key in aliasesOrName) {
311
+ if (Object.hasOwn(aliasesOrName, key)) {
312
+ const aliases = aliasesOrName[key]
313
+ high.registerAliases(
314
+ // Note: copy needed because hljs doesn’t accept readonly arrays yet.
315
+ typeof aliases === 'string' ? aliases : [...aliases],
316
+ {languageName: key}
317
+ )
318
+ }
319
+ }
320
+ }
321
+ }
322
+
323
+ /**
324
+ * Check whether an alias or name is registered.
325
+ *
326
+ * @example
327
+ * ```js
328
+ * import {createLowlight} from 'lowlight'
329
+ * import javascript from 'highlight.js/lib/languages/javascript'
330
+ *
331
+ * const lowlight = createLowlight({javascript})
332
+ *
333
+ * console.log(lowlight.registered('funkyscript')) // => `false`
334
+ *
335
+ * lowlight.registerAlias({javascript: 'funkyscript'})
336
+ * console.log(lowlight.registered('funkyscript')) // => `true`
337
+ * ```
338
+ *
339
+ * @param {string} aliasOrName
340
+ * Name of a language or alias for one.
341
+ * @returns {boolean}
342
+ * Whether `aliasOrName` is registered.
343
+ */
344
+ function registered(aliasOrName) {
345
+ return Boolean(high.getLanguage(aliasOrName))
346
+ }
347
+ }
348
+
349
+ /** @type {Emitter} */
350
+ class HastEmitter {
351
+ /**
352
+ * @param {Readonly<HljsOptions>} options
353
+ * Configuration.
354
+ * @returns
355
+ * Instance.
356
+ */
357
+ constructor(options) {
358
+ /** @type {HljsOptions} */
359
+ this.options = options
360
+ /** @type {Root} */
361
+ this.root = {
362
+ type: 'root',
363
+ children: [],
364
+ data: {language: undefined, relevance: 0}
365
+ }
366
+ /** @type {[Root, ...Array<Element>]} */
367
+ this.stack = [this.root]
368
+ }
369
+
370
+ /**
371
+ * @param {string} value
372
+ * Text to add.
373
+ * @returns {undefined}
374
+ * Nothing.
375
+ *
376
+ */
377
+ addText(value) {
378
+ if (value === '') return
379
+
380
+ const current = this.stack[this.stack.length - 1]
381
+ const tail = current.children[current.children.length - 1]
382
+
383
+ if (tail && tail.type === 'text') {
384
+ tail.value += value
385
+ } else {
386
+ current.children.push({type: 'text', value})
387
+ }
388
+ }
389
+
390
+ /**
391
+ *
392
+ * @param {unknown} rawName
393
+ * Name to add.
394
+ * @returns {undefined}
395
+ * Nothing.
396
+ */
397
+ startScope(rawName) {
398
+ this.openNode(String(rawName))
399
+ }
400
+
401
+ /**
402
+ * @returns {undefined}
403
+ * Nothing.
404
+ */
405
+ endScope() {
406
+ this.closeNode()
407
+ }
408
+
409
+ /**
410
+ * @param {HastEmitter} other
411
+ * Other emitter.
412
+ * @param {string} name
413
+ * Name of the sublanguage.
414
+ * @returns {undefined}
415
+ * Nothing.
416
+ */
417
+ __addSublanguage(other, name) {
418
+ const current = this.stack[this.stack.length - 1]
419
+ // Assume only element content.
420
+ const results = /** @type {Array<ElementContent>} */ (other.root.children)
421
+
422
+ if (name) {
423
+ current.children.push({
424
+ type: 'element',
425
+ tagName: 'span',
426
+ properties: {className: [name]},
427
+ children: results
428
+ })
429
+ } else {
430
+ current.children.push(...results)
431
+ }
432
+ }
433
+
434
+ /**
435
+ * @param {string} name
436
+ * Name to add.
437
+ * @returns {undefined}
438
+ * Nothing.
439
+ */
440
+ openNode(name) {
441
+ const self = this
442
+ // First “class” gets the prefix. Rest gets a repeated underscore suffix.
443
+ // See: <https://github.com/highlightjs/highlight.js/commit/51806aa>
444
+ // See: <https://github.com/wooorm/lowlight/issues/43>
445
+ const className = name.split('.').map(function (d, i) {
446
+ return i ? d + '_'.repeat(i) : self.options.classPrefix + d
447
+ })
448
+ const current = this.stack[this.stack.length - 1]
449
+ /** @type {Element} */
450
+ const child = {
451
+ type: 'element',
452
+ tagName: 'span',
453
+ properties: {className},
454
+ children: []
455
+ }
456
+
457
+ current.children.push(child)
458
+ this.stack.push(child)
459
+ }
460
+
461
+ /**
462
+ * @returns {undefined}
463
+ * Nothing.
464
+ */
465
+ closeNode() {
466
+ this.stack.pop()
467
+ }
468
+
469
+ /**
470
+ * @returns {undefined}
471
+ * Nothing.
472
+ */
473
+ finalize() {}
474
+
475
+ /**
476
+ * @returns {string}
477
+ * Nothing.
478
+ */
479
+ toHTML() {
480
+ return ''
481
+ }
482
+ }
tools/ui/node_modules/lowlight/license ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (The MIT License)
2
+
3
+ Copyright (c) Titus Wormer <tituswormer@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tools/ui/node_modules/lowlight/package.json ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "lowlight",
3
+ "version": "3.3.0",
4
+ "description": "Virtual syntax highlighting for virtual DOMs and non-HTML things",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "syntax",
8
+ "code",
9
+ "ast",
10
+ "virtual",
11
+ "dom",
12
+ "highlight",
13
+ "highlighting"
14
+ ],
15
+ "repository": "wooorm/lowlight",
16
+ "bugs": "https://github.com/wooorm/lowlight/issues",
17
+ "funding": {
18
+ "type": "github",
19
+ "url": "https://github.com/sponsors/wooorm"
20
+ },
21
+ "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
22
+ "contributors": [
23
+ "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
24
+ "Ezra Lalonde <ezra@usefuliftrue.com>",
25
+ "Shu Uesugi <shu@chibicode.com>"
26
+ ],
27
+ "sideEffects": false,
28
+ "type": "module",
29
+ "exports": "./index.js",
30
+ "files": [
31
+ "lib/",
32
+ "index.d.ts",
33
+ "index.js"
34
+ ],
35
+ "dependencies": {
36
+ "@types/hast": "^3.0.0",
37
+ "devlop": "^1.0.0",
38
+ "highlight.js": "~11.11.0"
39
+ },
40
+ "devDependencies": {
41
+ "@types/mdast": "^4.0.0",
42
+ "@types/node": "^22.0.0",
43
+ "@types/unist": "^3.0.0",
44
+ "c8": "^10.0.0",
45
+ "chalk": "^5.0.0",
46
+ "estree-util-is-identifier-name": "^3.0.0",
47
+ "hast-util-to-html": "^9.0.0",
48
+ "mdast-zone": "^6.0.0",
49
+ "prettier": "^3.0.0",
50
+ "remark-cli": "^12.0.0",
51
+ "remark-preset-wooorm": "^10.0.0",
52
+ "type-coverage": "^2.0.0",
53
+ "typescript": "^5.0.0",
54
+ "unified": "^11.0.0",
55
+ "xo": "^0.60.0"
56
+ },
57
+ "scripts": {
58
+ "build": "tsc --build --clean && tsc --build && type-coverage",
59
+ "format": "remark . --frail --output --quiet && prettier . --log-level warn --write && xo --fix",
60
+ "generate": "node --conditions development script/build-registry.js",
61
+ "prepack": "npm run generate && npm run build && npm run format",
62
+ "test": "npm run generate && npm run build && npm run format && npm run test-coverage",
63
+ "test-api": "node --conditions development test/index.js",
64
+ "test-coverage": "c8 --100 --check-coverage --reporter lcov npm run test-api"
65
+ },
66
+ "prettier": {
67
+ "bracketSpacing": false,
68
+ "singleQuote": true,
69
+ "semi": false,
70
+ "tabWidth": 2,
71
+ "trailingComma": "none",
72
+ "useTabs": false
73
+ },
74
+ "remarkConfig": {
75
+ "plugins": [
76
+ "remark-preset-wooorm",
77
+ "./script/support.js"
78
+ ]
79
+ },
80
+ "typeCoverage": {
81
+ "atLeast": 100,
82
+ "detail": true,
83
+ "ignoreCatch": true,
84
+ "strict": true
85
+ },
86
+ "xo": {
87
+ "overrides": [
88
+ {
89
+ "files": [
90
+ "**/*.ts"
91
+ ],
92
+ "rules": {
93
+ "@typescript-eslint/consistent-type-definitions": "off"
94
+ }
95
+ },
96
+ {
97
+ "files": [
98
+ "script/**/*.js",
99
+ "test/**/*.js"
100
+ ],
101
+ "rules": {
102
+ "no-await-in-loop": "off"
103
+ }
104
+ }
105
+ ],
106
+ "prettier": true,
107
+ "rules": {
108
+ "n/file-extension-in-import": "off",
109
+ "unicorn/no-this-assignment": "off",
110
+ "unicorn/prefer-at": "off",
111
+ "unicorn/prefer-type-error": "off"
112
+ }
113
+ }
114
+ }
tools/ui/node_modules/lowlight/readme.md ADDED
@@ -0,0 +1,786 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--lint disable no-html-->
2
+
3
+ # lowlight
4
+
5
+ [![Build][build-badge]][build]
6
+ [![Coverage][coverage-badge]][coverage]
7
+ [![Downloads][downloads-badge]][downloads]
8
+ [![Size][size-badge]][size]
9
+
10
+ Virtual syntax highlighting for virtual DOMs and non-HTML things based on
11
+ [`highlight.js`][highlight-js].
12
+
13
+ ## Contents
14
+
15
+ * [What is this?](#what-is-this)
16
+ * [When should I use this?](#when-should-i-use-this)
17
+ * [Install](#install)
18
+ * [Use](#use)
19
+ * [API](#api)
20
+ * [`all`](#all)
21
+ * [`common`](#common)
22
+ * [`createLowlight([grammars])`](#createlowlightgrammars)
23
+ * [`lowlight.highlight(language, value[, options])`](#lowlighthighlightlanguage-value-options)
24
+ * [`lowlight.highlightAuto(value[, options])`](#lowlighthighlightautovalue-options)
25
+ * [`lowlight.listLanguages()`](#lowlightlistlanguages)
26
+ * [`lowlight.register(grammars)`](#lowlightregistergrammars)
27
+ * [`lowlight.registerAlias(aliases)`](#lowlightregisteraliasaliases)
28
+ * [`lowlight.registered(aliasOrlanguage)`](#lowlightregisteredaliasorlanguage)
29
+ * [`AutoOptions`](#autooptions)
30
+ * [`LanguageFn`](#languagefn)
31
+ * [`Options`](#options)
32
+ * [Examples](#examples)
33
+ * [Example: serializing hast as html](#example-serializing-hast-as-html)
34
+ * [Example: turning hast into preact, react, etc](#example-turning-hast-into-preact-react-etc)
35
+ * [Types](#types)
36
+ * [Data](#data)
37
+ * [CSS](#css)
38
+ * [Compatibility](#compatibility)
39
+ * [Security](#security)
40
+ * [Related](#related)
41
+ * [Projects](#projects)
42
+ * [Contribute](#contribute)
43
+ * [License](#license)
44
+
45
+ ## What is this?
46
+
47
+ This package uses [`highlight.js`][highlight-js] for syntax highlighting and
48
+ outputs objects (ASTs) instead of a string of HTML.
49
+ It can support 190+ programming languages.
50
+
51
+ ## When should I use this?
52
+
53
+ This package is useful when you want to perform syntax highlighting in a place
54
+ where serialized HTML wouldn’t work or wouldn’t work well.
55
+ For example, you can use lowlight when you want to show code in a CLI by
56
+ rendering to ANSI sequences, when you’re using virtual DOM frameworks (such as
57
+ React or Preact) so that diffing can be performant, or when you’re working with
58
+ ASTs (rehype).
59
+
60
+ You can use the similar [`refractor`][refractor] if you want to use [Prism][]
61
+ grammars instead.
62
+ If you’re looking for a *really good* (but rather heavy) alternative, use
63
+ [`starry-night`][starry-night].
64
+
65
+ ## Install
66
+
67
+ This package is [ESM only][esm].
68
+ In Node.js (version 16+), install with [npm][]:
69
+
70
+ ```sh
71
+ npm install lowlight
72
+ ```
73
+
74
+ In Deno with [`esm.sh`][esmsh]:
75
+
76
+ ```js
77
+ import {all, common, createLowlight} from 'https://esm.sh/lowlight@3'
78
+ ```
79
+
80
+ In browsers with [`esm.sh`][esmsh]:
81
+
82
+ ```html
83
+ <script type="module">
84
+ import {all, common, createLowlight} from 'https://esm.sh/lowlight@3?bundle'
85
+ </script>
86
+ ```
87
+
88
+ ## Use
89
+
90
+ ```js
91
+ import {common, createLowlight} from 'lowlight'
92
+
93
+ const lowlight = createLowlight(common)
94
+
95
+ const tree = lowlight.highlight('js', '"use strict";')
96
+
97
+ console.dir(tree, {depth: undefined})
98
+ ```
99
+
100
+ Yields:
101
+
102
+ ```js
103
+ {
104
+ type: 'root',
105
+ children: [
106
+ {
107
+ type: 'element',
108
+ tagName: 'span',
109
+ properties: {className: ['hljs-meta']},
110
+ children: [{type: 'text', value: '"use strict"'}]
111
+ },
112
+ {type: 'text', value: ';'}
113
+ ],
114
+ data: {language: 'js', relevance: 10}
115
+ }
116
+ ```
117
+
118
+ ## API
119
+
120
+ This package exports the identifiers [`all`][api-all],
121
+ [`common`][api-common], and
122
+ [`createLowlight`][api-create-lowlight].
123
+ There is no default export.
124
+
125
+ ### `all`
126
+
127
+ Map of all (±190) grammars ([`Record<string, LanguageFn>`][api-language-fn]).
128
+
129
+ ### `common`
130
+
131
+ Map of common (37) grammars ([`Record<string, LanguageFn>`][api-language-fn]).
132
+
133
+ ### `createLowlight([grammars])`
134
+
135
+ Create a `lowlight` instance.
136
+
137
+ ###### Parameters
138
+
139
+ * `grammars` ([`Record<string, LanguageFn>`][api-language-fn], optional)
140
+ — grammars to add
141
+
142
+ ###### Returns
143
+
144
+ Lowlight (`Lowlight`).
145
+
146
+ ### `lowlight.highlight(language, value[, options])`
147
+
148
+ Highlight `value` (code) as `language` (name).
149
+
150
+ ###### Parameters
151
+
152
+ * `language` (`string`)
153
+ — programming language [name][names]
154
+ * `value` (`string`)
155
+ — code to highlight
156
+ * `options` ([`Options`][api-options], optional)
157
+ — configuration
158
+
159
+ ###### Returns
160
+
161
+ Tree ([`Root`][hast-root]); with the following `data` fields: `language`
162
+ (`string`), detected programming language name; `relevance` (`number`), how
163
+ sure lowlight is that the given code is in the language.
164
+
165
+ ###### Example
166
+
167
+ ```js
168
+ import {common, createLowlight} from 'lowlight'
169
+
170
+ const lowlight = createLowlight(common)
171
+
172
+ console.log(lowlight.highlight('css', 'em { color: red }'))
173
+ ```
174
+
175
+ Yields:
176
+
177
+ ```js
178
+ {type: 'root', children: [Array], data: {language: 'css', relevance: 3}}
179
+ ```
180
+
181
+ ### `lowlight.highlightAuto(value[, options])`
182
+
183
+ Highlight `value` (code) and guess its programming language.
184
+
185
+ ###### Parameters
186
+
187
+ * `value` (`string`)
188
+ — code to highlight
189
+ * `options` ([`AutoOptions`][api-auto-options], optional)
190
+ — configuration
191
+
192
+ ###### Returns
193
+
194
+ Tree ([`Root`][hast-root]); with the following `data` fields: `language`
195
+ (`string`), detected programming language name; `relevance` (`number`), how
196
+ sure lowlight is that the given code is in the language.
197
+
198
+ ###### Example
199
+
200
+ ```js
201
+ import {common, createLowlight} from 'lowlight'
202
+
203
+ const lowlight = createLowlight(common)
204
+
205
+ console.log(lowlight.highlightAuto('"hello, " + name + "!"'))
206
+ ```
207
+
208
+ Yields:
209
+
210
+ ```js
211
+ {type: 'root', children: [Array], data: {language: 'arduino', relevance: 2}}
212
+ ```
213
+
214
+ ### `lowlight.listLanguages()`
215
+
216
+ List registered languages.
217
+
218
+ ###### Returns
219
+
220
+ [Names][] of registered language (`Array<string>`).
221
+
222
+ ###### Example
223
+
224
+ ```js
225
+ import {createLowlight} from 'lowlight'
226
+ import markdown from 'highlight.js/lib/languages/markdown'
227
+
228
+ const lowlight = createLowlight()
229
+
230
+ console.log(lowlight.listLanguages()) // => []
231
+
232
+ lowlight.register({markdown})
233
+
234
+ console.log(lowlight.listLanguages()) // => ['markdown']
235
+ ```
236
+
237
+ ### `lowlight.register(grammars)`
238
+
239
+ Register languages.
240
+
241
+ ###### Signatures
242
+
243
+ * `register(name, grammar)`
244
+ * `register(grammars)`
245
+
246
+ ###### Parameters
247
+
248
+ * `name` (`string`)
249
+ — programming language [name][names]
250
+ * `grammar` ([`LanguageFn`][api-language-fn])
251
+ — grammar
252
+ * `grammars` ([`Record<string, LanguageFn>`][api-language-fn], optional)
253
+ — grammars
254
+
255
+ ###### Returns
256
+
257
+ Nothing (`undefined`).
258
+
259
+ ###### Example
260
+
261
+ ```js
262
+ import {createLowlight} from 'lowlight'
263
+ import xml from 'highlight.js/lib/languages/xml'
264
+
265
+ const lowlight = createLowlight()
266
+
267
+ lowlight.register({xml})
268
+
269
+ // Note: `html` is an alias for `xml`.
270
+ console.log(lowlight.highlight('html', '<em>Emphasis</em>'))
271
+ ```
272
+
273
+ Yields:
274
+
275
+ ```js
276
+ {type: 'root', children: [Array], data: {language: 'html', relevance: 2}}
277
+ ```
278
+
279
+ ### `lowlight.registerAlias(aliases)`
280
+
281
+ Register aliases.
282
+
283
+ ###### Signatures
284
+
285
+ * `registerAlias(aliases)`
286
+ * `registerAlias(name, alias)`
287
+
288
+ ###### Parameters
289
+
290
+ * `aliases` (`Record<string, Array<string> | string>`)
291
+ — map of programming language [names][] to one or more aliases
292
+ * `name` (`string`)
293
+ — programming language [name][names]
294
+ * `alias` (`Array<string> | string`)
295
+ — one or more aliases for the programming language
296
+
297
+ ###### Returns
298
+
299
+ Nothing (`undefined`).
300
+
301
+ ###### Example
302
+
303
+ ```js
304
+ import {createLowlight} from 'lowlight'
305
+ import markdown from 'highlight.js/lib/languages/markdown'
306
+
307
+ const lowlight = createLowlight()
308
+
309
+ lowlight.register({markdown})
310
+
311
+ // lowlight.highlight('mdown', '<em>Emphasis</em>')
312
+ // ^ would throw: Error: Unknown language: `mdown` is not registered
313
+
314
+ lowlight.registerAlias({markdown: ['mdown', 'mkdn', 'mdwn', 'ron']})
315
+ lowlight.highlight('mdown', '<em>Emphasis</em>')
316
+ // ^ Works!
317
+ ```
318
+
319
+ ### `lowlight.registered(aliasOrlanguage)`
320
+
321
+ Check whether an alias or name is registered.
322
+
323
+ ###### Parameters
324
+
325
+ * `aliasOrlanguage` (`string`)
326
+ — [name][names] of a language or alias for one
327
+
328
+ ###### Returns
329
+
330
+ Whether `aliasOrName` is registered (`boolean`).
331
+
332
+ ###### Example
333
+
334
+ ```js
335
+ import {createLowlight} from 'lowlight'
336
+ import javascript from 'highlight.js/lib/languages/javascript'
337
+
338
+ const lowlight = createLowlight({javascript})
339
+
340
+ console.log(lowlight.registered('funkyscript')) // => `false`
341
+
342
+ lowlight.registerAlias({javascript: 'funkyscript'})
343
+ console.log(lowlight.registered('funkyscript')) // => `true`
344
+ ```
345
+
346
+ ### `AutoOptions`
347
+
348
+ Configuration for `highlightAuto` (TypeScript type).
349
+
350
+ ###### Fields
351
+
352
+ * `prefix` (`string`, default: `'hljs-'`)
353
+ — class prefix
354
+ * `subset` (`Array<string>`, default: all registered languages)
355
+ — list of allowed languages
356
+
357
+ ### `LanguageFn`
358
+
359
+ Highlight.js grammar (TypeScript type).
360
+
361
+ ###### Type
362
+
363
+ ```ts
364
+ type {LanguageFn} from 'highlight.js'
365
+ ```
366
+
367
+ ### `Options`
368
+
369
+ Configuration for `highlight` (TypeScript type).
370
+
371
+ ###### Fields
372
+
373
+ * `prefix` (`string`, default: `'hljs-'`)
374
+ — class prefix
375
+
376
+ ## Examples
377
+
378
+ ### Example: serializing hast as html
379
+
380
+ hast trees as returned by lowlight can be serialized with
381
+ [`hast-util-to-html`][hast-util-to-html]:
382
+
383
+ ```js
384
+ import {common, createLowlight} from 'lowlight'
385
+ import {toHtml} from 'hast-util-to-html'
386
+
387
+ const lowlight = createLowlight(common)
388
+
389
+ const tree = lowlight.highlight('js', '"use strict";')
390
+
391
+ console.log(toHtml(tree))
392
+ ```
393
+
394
+ Yields:
395
+
396
+ ```html
397
+ <span class="hljs-meta">"use strict"</span>;
398
+ ```
399
+
400
+ ### Example: turning hast into preact, react, etc
401
+
402
+ hast trees as returned by lowlight can be turned into nodes of any framework
403
+ that supports JSX, such as preact, react, solid, svelte, vue, and more, with
404
+ [`hast-util-to-jsx-runtime`][hast-util-to-jsx-runtime]:
405
+
406
+ ```js
407
+ import {toJsxRuntime} from 'hast-util-to-jsx-runtime'
408
+ // @ts-expect-error: react types don’t type these.
409
+ import {Fragment, jsx, jsxs} from 'react/jsx-runtime'
410
+ import {common, createLowlight} from 'lowlight'
411
+
412
+ const lowlight = createLowlight(common)
413
+
414
+ const tree = lowlight.highlight('js', '"use strict";')
415
+
416
+ console.log(toJsxRuntime(tree, {Fragment, jsx, jsxs}))
417
+ ```
418
+
419
+ Yields:
420
+
421
+ ```js
422
+ {
423
+ $$typeof: Symbol(react.element),
424
+ type: Symbol(react.fragment),
425
+ key: null,
426
+ ref: null,
427
+ props: {children: [[Object], ';']},
428
+ _owner: null,
429
+ _store: {}
430
+ }
431
+ ```
432
+
433
+ ## Types
434
+
435
+ This package is fully typed with [TypeScript][].
436
+ It exports the additional types
437
+ [`AutoOptions`][api-auto-options],
438
+ [`LanguageFn`][api-language-fn], and
439
+ [`Options`][api-options].
440
+
441
+ It also registers `root.data` with `@types/hast`.
442
+ If you’re working with the data fields, make sure to import this package
443
+ somewhere in your types, as that registers the new fields on the file.
444
+
445
+ ```js
446
+ /**
447
+ * @import {Root} from 'hast'
448
+ * @import {} from 'lowlight'
449
+ */
450
+
451
+ import {VFile} from 'vfile'
452
+
453
+ /** @type {Root} */
454
+ const root = {type: 'root', children: []}
455
+
456
+ console.log(root.data?.language) //=> TS now knows that this is a `string?`.
457
+ ```
458
+
459
+ <!--Old name of the following section:-->
460
+
461
+ <a name="syntaxes"></a>
462
+
463
+ ## Data
464
+
465
+ If you’re using `createLowlight()`, no syntaxes are included yet.
466
+ You can import `all` or `common` and pass them, such as with
467
+ `createLowlight(all)`.
468
+ Checked syntaxes are included in `common`.
469
+ All syntaxes are included in `all`.
470
+
471
+ You can also manually import syntaxes from `highlight.js/lib/languages/xxx`,
472
+ where `xxx` is the name, such as `'highlight.js/lib/languages/wasm'`.
473
+
474
+ <!--support start-->
475
+
476
+ * [ ] `1c` — 1C:Enterprise
477
+ * [ ] `abnf` — Augmented Backus-Naur Form
478
+ * [ ] `accesslog` — Apache Access Log
479
+ * [ ] `actionscript` (`as`) — ActionScript
480
+ * [ ] `ada` — Ada
481
+ * [ ] `angelscript` (`asc`) — AngelScript
482
+ * [ ] `apache` (`apacheconf`) — Apache config
483
+ * [ ] `applescript` (`osascript`) — AppleScript
484
+ * [ ] `arcade` — ArcGIS Arcade
485
+ * [x] `arduino` (`ino`) — Arduino
486
+ * [ ] `armasm` (`arm`) — ARM Assembly
487
+ * [ ] `asciidoc` (`adoc`) — AsciiDoc
488
+ * [ ] `aspectj` — AspectJ
489
+ * [ ] `autohotkey` (`ahk`) — AutoHotkey
490
+ * [ ] `autoit` — AutoIt
491
+ * [ ] `avrasm` — AVR Assembly
492
+ * [ ] `awk` — Awk
493
+ * [ ] `axapta` (`x++`) — X++
494
+ * [x] `bash` (`sh`, `zsh`) — Bash
495
+ * [ ] `basic` — BASIC
496
+ * [ ] `bnf` — Backus–Naur Form
497
+ * [ ] `brainfuck` (`bf`) — Brainfuck
498
+ * [x] `c` (`h`) — C
499
+ * [ ] `cal` — C/AL
500
+ * [ ] `capnproto` (`capnp`) — Cap’n Proto
501
+ * [ ] `ceylon` — Ceylon
502
+ * [ ] `clean` (`icl`, `dcl`) — Clean
503
+ * [ ] `clojure` (`clj`, `edn`) — Clojure
504
+ * [ ] `clojure-repl` — Clojure REPL
505
+ * [ ] `cmake` (`cmake.in`) — CMake
506
+ * [ ] `coffeescript` (`coffee`, `cson`, `iced`) — CoffeeScript
507
+ * [ ] `coq` — Coq
508
+ * [ ] `cos` (`cls`) — Caché Object Script
509
+ * [x] `cpp` (`cc`, `c++`, `h++`, `hpp`, `hh`, `hxx`, `cxx`) — C++
510
+ * [ ] `crmsh` (`crm`, `pcmk`) — crmsh
511
+ * [ ] `crystal` (`cr`) — Crystal
512
+ * [x] `csharp` (`cs`, `c#`) — C#
513
+ * [ ] `csp` — CSP
514
+ * [x] `css` — CSS
515
+ * [ ] `d` — D
516
+ * [ ] `dart` — Dart
517
+ * [ ] `delphi` (`dpr`, `dfm`, `pas`, `pascal`) — Delphi
518
+ * [x] `diff` (`patch`) — Diff
519
+ * [ ] `django` (`jinja`) — Django
520
+ * [ ] `dns` (`bind`, `zone`) — DNS Zone
521
+ * [ ] `dockerfile` (`docker`) — Dockerfile
522
+ * [ ] `dos` (`bat`, `cmd`) — Batch file (DOS)
523
+ * [ ] `dsconfig` — undefined
524
+ * [ ] `dts` — Device Tree
525
+ * [ ] `dust` (`dst`) — Dust
526
+ * [ ] `ebnf` — Extended Backus-Naur Form
527
+ * [ ] `elixir` (`ex`, `exs`) — Elixir
528
+ * [ ] `elm` — Elm
529
+ * [ ] `erb` — ERB
530
+ * [ ] `erlang` (`erl`) — Erlang
531
+ * [ ] `erlang-repl` — Erlang REPL
532
+ * [ ] `excel` (`xlsx`, `xls`) — Excel formulae
533
+ * [ ] `fix` — FIX
534
+ * [ ] `flix` — Flix
535
+ * [ ] `fortran` (`f90`, `f95`) — Fortran
536
+ * [ ] `fsharp` (`fs`, `f#`) — F#
537
+ * [ ] `gams` (`gms`) — GAMS
538
+ * [ ] `gauss` (`gss`) — GAUSS
539
+ * [ ] `gcode` (`nc`) — G-code (ISO 6983)
540
+ * [ ] `gherkin` (`feature`) — Gherkin
541
+ * [ ] `glsl` — GLSL
542
+ * [ ] `gml` — GML
543
+ * [x] `go` (`golang`) — Go
544
+ * [ ] `golo` — Golo
545
+ * [ ] `gradle` — Gradle
546
+ * [x] `graphql` (`gql`) — GraphQL
547
+ * [ ] `groovy` — Groovy
548
+ * [ ] `haml` — HAML
549
+ * [ ] `handlebars` (`hbs`, `html.hbs`, `html.handlebars`, `htmlbars`) — Handlebars
550
+ * [ ] `haskell` (`hs`) — Haskell
551
+ * [ ] `haxe` (`hx`) — Haxe
552
+ * [ ] `hsp` — HSP
553
+ * [ ] `http` (`https`) — HTTP
554
+ * [ ] `hy` (`hylang`) — Hy
555
+ * [ ] `inform7` (`i7`) — Inform 7
556
+ * [x] `ini` (`toml`) — TOML, also INI
557
+ * [ ] `irpf90` — IRPF90
558
+ * [ ] `isbl` — ISBL
559
+ * [x] `java` (`jsp`) — Java
560
+ * [x] `javascript` (`js`, `jsx`, `mjs`, `cjs`) — JavaScript
561
+ * [ ] `jboss-cli` (`wildfly-cli`) — JBoss CLI
562
+ * [x] `json` (`jsonc`) — JSON
563
+ * [ ] `julia` — Julia
564
+ * [ ] `julia-repl` (`jldoctest`) — Julia REPL
565
+ * [x] `kotlin` (`kt`, `kts`) — Kotlin
566
+ * [ ] `lasso` (`ls`, `lassoscript`) — Lasso
567
+ * [ ] `latex` (`tex`) — LaTeX
568
+ * [ ] `ldif` — LDIF
569
+ * [ ] `leaf` — Leaf
570
+ * [x] `less` — Less
571
+ * [ ] `lisp` — Lisp
572
+ * [ ] `livecodeserver` — LiveCode
573
+ * [ ] `livescript` (`ls`) — LiveScript
574
+ * [ ] `llvm` — LLVM IR
575
+ * [ ] `lsl` — LSL (Linden Scripting Language)
576
+ * [x] `lua` (`pluto`) — Lua
577
+ * [x] `makefile` (`mk`, `mak`, `make`) — Makefile
578
+ * [x] `markdown` (`md`, `mkdown`, `mkd`) — Markdown
579
+ * [ ] `mathematica` (`mma`, `wl`) — Mathematica
580
+ * [ ] `matlab` — Matlab
581
+ * [ ] `maxima` — Maxima
582
+ * [ ] `mel` — MEL
583
+ * [ ] `mercury` (`m`, `moo`) — Mercury
584
+ * [ ] `mipsasm` (`mips`) — MIPS Assembly
585
+ * [ ] `mizar` — Mizar
586
+ * [ ] `mojolicious` — Mojolicious
587
+ * [ ] `monkey` — Monkey
588
+ * [ ] `moonscript` (`moon`) — MoonScript
589
+ * [ ] `n1ql` — N1QL
590
+ * [ ] `nestedtext` (`nt`) — Nested Text
591
+ * [ ] `nginx` (`nginxconf`) — Nginx config
592
+ * [ ] `nim` — Nim
593
+ * [ ] `nix` (`nixos`) — Nix
594
+ * [ ] `node-repl` — Node REPL
595
+ * [ ] `nsis` — NSIS
596
+ * [x] `objectivec` (`mm`, `objc`, `obj-c`, `obj-c++`, `objective-c++`) — Objective-C
597
+ * [ ] `ocaml` (`ml`) — OCaml
598
+ * [ ] `openscad` (`scad`) — OpenSCAD
599
+ * [ ] `oxygene` — Oxygene
600
+ * [ ] `parser3` — Parser3
601
+ * [x] `perl` (`pl`, `pm`) — Perl
602
+ * [ ] `pf` (`pf.conf`) — Packet Filter config
603
+ * [ ] `pgsql` (`postgres`, `postgresql`) — PostgreSQL
604
+ * [x] `php` — undefined
605
+ * [x] `php-template` — PHP template
606
+ * [x] `plaintext` (`text`, `txt`) — Plain text
607
+ * [ ] `pony` — Pony
608
+ * [ ] `powershell` (`pwsh`, `ps`, `ps1`) — PowerShell
609
+ * [ ] `processing` (`pde`) — Processing
610
+ * [ ] `profile` — Python profiler
611
+ * [ ] `prolog` — Prolog
612
+ * [ ] `properties` — .properties
613
+ * [ ] `protobuf` (`proto`) — Protocol Buffers
614
+ * [ ] `puppet` (`pp`) — Puppet
615
+ * [ ] `purebasic` (`pb`, `pbi`) — PureBASIC
616
+ * [x] `python` (`py`, `gyp`, `ipython`) — Python
617
+ * [x] `python-repl` (`pycon`) — undefined
618
+ * [ ] `q` (`k`, `kdb`) — Q
619
+ * [ ] `qml` (`qt`) — QML
620
+ * [x] `r` — R
621
+ * [ ] `reasonml` (`re`) — ReasonML
622
+ * [ ] `rib` — RenderMan RIB
623
+ * [ ] `roboconf` (`graph`, `instances`) — Roboconf
624
+ * [ ] `routeros` (`mikrotik`) — MikroTik RouterOS script
625
+ * [ ] `rsl` — RenderMan RSL
626
+ * [x] `ruby` (`rb`, `gemspec`, `podspec`, `thor`, `irb`) — Ruby
627
+ * [ ] `ruleslanguage` — Oracle Rules Language
628
+ * [x] `rust` (`rs`) — Rust
629
+ * [ ] `sas` — SAS
630
+ * [ ] `scala` — Scala
631
+ * [ ] `scheme` (`scm`) — Scheme
632
+ * [ ] `scilab` (`sci`) — Scilab
633
+ * [x] `scss` — SCSS
634
+ * [x] `shell` (`console`, `shellsession`) — Shell Session
635
+ * [ ] `smali` — Smali
636
+ * [ ] `smalltalk` (`st`) — Smalltalk
637
+ * [ ] `sml` (`ml`) — SML (Standard ML)
638
+ * [ ] `sqf` — SQF
639
+ * [x] `sql` — SQL
640
+ * [ ] `stan` (`stanfuncs`) — Stan
641
+ * [ ] `stata` (`do`, `ado`) — Stata
642
+ * [ ] `step21` (`p21`, `step`, `stp`) — STEP Part 21
643
+ * [ ] `stylus` (`styl`) — Stylus
644
+ * [ ] `subunit` — SubUnit
645
+ * [x] `swift` — Swift
646
+ * [ ] `taggerscript` — Tagger Script
647
+ * [ ] `tap` — Test Anything Protocol
648
+ * [ ] `tcl` (`tk`) — Tcl
649
+ * [ ] `thrift` — Thrift
650
+ * [ ] `tp` — TP
651
+ * [ ] `twig` (`craftcms`) — Twig
652
+ * [x] `typescript` (`ts`, `tsx`, `mts`, `cts`) — TypeScript
653
+ * [ ] `vala` — Vala
654
+ * [x] `vbnet` (`vb`) — Visual Basic .NET
655
+ * [ ] `vbscript` (`vbs`) — VBScript
656
+ * [ ] `vbscript-html` — VBScript in HTML
657
+ * [ ] `verilog` (`v`, `sv`, `svh`) — Verilog
658
+ * [ ] `vhdl` — VHDL
659
+ * [ ] `vim` — Vim Script
660
+ * [x] `wasm` — WebAssembly
661
+ * [ ] `wren` — Wren
662
+ * [ ] `x86asm` — Intel x86 Assembly
663
+ * [ ] `xl` (`tao`) — XL
664
+ * [x] `xml` (`html`, `xhtml`, `rss`, `atom`, `xjb`, `xsd`, `xsl`, `plist`, `wsf`, `svg`) — HTML, XML
665
+ * [ ] `xquery` (`xpath`, `xq`, `xqm`) — XQuery
666
+ * [x] `yaml` (`yml`) — YAML
667
+ * [ ] `zephir` (`zep`) — Zephir
668
+
669
+ <!--support end-->
670
+
671
+ ## CSS
672
+
673
+ `lowlight` does not inject CSS for the syntax highlighted code (because well,
674
+ lowlight doesn’t have to be turned into HTML and might not run in a browser!).
675
+ If you are in a browser, you can use any `highlight.js` theme.
676
+ For example, to get GitHub Dark from cdnjs:
677
+
678
+ ```html
679
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.0/styles/github-dark.min.css">
680
+ ```
681
+
682
+ ## Compatibility
683
+
684
+ This package is compatible with maintained versions of Node.js.
685
+
686
+ When we cut a new major release, we drop support for unmaintained versions of
687
+ Node.
688
+ This means we try to keep the current release line,
689
+ `lowlight@^3`, compatible with Node.js 16.
690
+
691
+ ## Security
692
+
693
+ This package is safe.
694
+
695
+ ## Related
696
+
697
+ * [`refractor`][refractor]
698
+ — the same as lowlight but with [Prism][]
699
+ * [`starry-night`][starry-night]
700
+ — similar but like GitHub and really good
701
+
702
+ ## Projects
703
+
704
+ * [`emphasize`](https://github.com/wooorm/emphasize)
705
+ — syntax highlighting in ANSI (for the terminal)
706
+ * [`react-lowlight`](https://github.com/rexxars/react-lowlight)
707
+ — syntax highlighter for [React][]
708
+ * [`react-syntax-highlighter`](https://github.com/conorhastings/react-syntax-highlighter)
709
+ — [React][] component for syntax highlighting
710
+ * [`rehype-highlight`](https://github.com/rehypejs/rehype-highlight)
711
+ — [**rehype**](https://github.com/rehypejs/rehype) plugin to highlight code
712
+ blocks
713
+ * [`jstransformer-lowlight`](https://github.com/ai/jstransformer-lowlight)
714
+ — syntax highlighting for [JSTransformers](https://github.com/jstransformers)
715
+ and [Pug](https://pugjs.org/language/filters.html)
716
+
717
+ ## Contribute
718
+
719
+ Yes please!
720
+ See [How to Contribute to Open Source][contribute].
721
+
722
+ ## License
723
+
724
+ [MIT][license] © [Titus Wormer][author]
725
+
726
+ <!-- Definitions -->
727
+
728
+ [build-badge]: https://github.com/wooorm/lowlight/workflows/main/badge.svg
729
+
730
+ [build]: https://github.com/wooorm/lowlight/actions
731
+
732
+ [coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/lowlight.svg
733
+
734
+ [coverage]: https://codecov.io/github/wooorm/lowlight
735
+
736
+ [downloads-badge]: https://img.shields.io/npm/dm/lowlight.svg
737
+
738
+ [downloads]: https://www.npmjs.com/package/lowlight
739
+
740
+ [size-badge]: https://img.shields.io/bundlephobia/minzip/lowlight.svg
741
+
742
+ [size]: https://bundlephobia.com/result?p=lowlight
743
+
744
+ [npm]: https://docs.npmjs.com/cli/install
745
+
746
+ [esmsh]: https://esm.sh
747
+
748
+ [license]: license
749
+
750
+ [author]: https://wooorm.com
751
+
752
+ [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
753
+
754
+ [typescript]: https://www.typescriptlang.org
755
+
756
+ [contribute]: https://opensource.guide/how-to-contribute/
757
+
758
+ [hast-root]: https://github.com/syntax-tree/hast#root
759
+
760
+ [highlight-js]: https://github.com/highlightjs/highlight.js
761
+
762
+ [names]: https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md
763
+
764
+ [react]: https://facebook.github.io/react/
765
+
766
+ [prism]: https://github.com/PrismJS/prism
767
+
768
+ [refractor]: https://github.com/wooorm/refractor
769
+
770
+ [starry-night]: https://github.com/wooorm/starry-night
771
+
772
+ [hast-util-to-html]: https://github.com/syntax-tree/hast-util-to-html
773
+
774
+ [hast-util-to-jsx-runtime]: https://github.com/syntax-tree/hast-util-to-jsx-runtime
775
+
776
+ [api-all]: #all
777
+
778
+ [api-auto-options]: #autooptions
779
+
780
+ [api-common]: #common
781
+
782
+ [api-create-lowlight]: #createlowlightgrammars
783
+
784
+ [api-language-fn]: #languagefn
785
+
786
+ [api-options]: #options
tools/ui/node_modules/lz-string/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2013 pieroxy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
tools/ui/node_modules/lz-string/README.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ lz-string
2
+ =========
3
+ LZ-based compression algorithm for JavaScript
4
+
5
+ ## Warning (migrating from version 1.3.4 - nov 2014)
6
+ Files have changed locations and name since a recent release. The new release file is in `libs/lz-string.min.js` (or in `libs/lz-string.js` if you don't care for the minified version)
7
+
8
+ Sorry about the mess in other repos. This will not happen again.
9
+
10
+ ## Note on server side
11
+
12
+ If you are using one of the ports of lz-string to decode on the server what was encoded in the browser, you might want to use version 1.3.7 as the version 1.3.8 introduced a slight change in the encoding. While the JS versions are completely cross-compatible, the PHP, Go, ... versions might not be as forgiving.
13
+
14
+ ## Install via [npm](https://npmjs.org/)
15
+
16
+ ```shell
17
+ $ npm install -g lz-string
18
+ $ lz-string input.js > output.txt
19
+ ```
20
+
21
+ ## Home page
22
+ Home page for this program with examples, documentation and a live demo: http://pieroxy.net/blog/pages/lz-string/index.html
23
+
24
+ ## Other languages
25
+ This lib has numerous ports to other languages, for server side processing, mostly. Here they are:
26
+
27
+
28
+ * **Java:** [by Diogo Duailibe](https://github.com/diogoduailibe/lzstring4j)
29
+ * **Java:** [by rufushuang, with base64 support and better performances](https://github.com/rufushuang/lz-string4java)
30
+ * **C#:** [by Jawa-the-Hutt](https://github.com/jawa-the-hutt/lz-string-csharp)
31
+ * **C#:** [by kreudom, another implementation in C#, more up to date](https://github.com/kreudom/lz-string-csharp)
32
+ * **PHP:** [by nullpunkt](https://github.com/nullpunkt/lz-string-php)
33
+ * **Python3:** [by eduardtomasek](https://github.com/eduardtomasek/lz-string-python)
34
+ * **Another Python:** [by marcel-dancak](https://github.com/marcel-dancak/lz-string-python)
35
+ * **Go** [I helped a friend to write a Go implementation of the decompression algorithm](https://github.com/pieroxy/lz-string-go)
36
+ * **Go** [Austin wrote the decompression part as well](https://github.com/Lazarus/lz-string-go)
37
+ * **Elixir** [by Michael Shapiro](https://github.com/koudelka/elixir-lz-string)
38
+ * **C++/QT** [by AmiArt](https://github.com/AmiArt/qt-lzstring)
39
+ * **C++** [by Andrey Krasnov, another implementation in C++11](https://github.com/andykras/lz-string-cpp)
40
+ * **VB.NET** [by gsemac](https://github.com/gsemac/lz-string-vb)
41
+ * **Salesforce Apex** (Java like language): [bilal did the port](https://github.com/bilalfastian/LZ4String)
42
+ * **Kotlin:** [from Zen Liu](https://github.com/ZenLiuCN/lz-string4k)
43
+ * **Dart:** [from skipness](https://github.com/skipness/lzstring-dart)
44
+ * **Haxe:** [from markknol](https://github.com/markknol/hx-lzstring)
45
+ * **Rust:** [from adumbidiot](https://github.com/adumbidiot/lz-str-rs)
tools/ui/node_modules/lz-string/bin/bin.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /usr/bin/env node
2
+ var lzString = require('../libs/lz-string.js');
3
+ var fs = require('fs');
4
+
5
+ if (process.argv.length < 3) {
6
+ console.error('Usage: lz-string <input_file>');
7
+ process.exit(1);
8
+ }
9
+
10
+ console.log(lzString.compress(fs.readFileSync(process.argv[2], {
11
+ encoding: 'utf8',
12
+ })));
13
+
tools/ui/node_modules/lz-string/bower.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "lz-string",
3
+ "version": "1.4.5",
4
+ "main": "libs/lz-string.min.js",
5
+ "ignore": [
6
+ "bin/",
7
+ "reference/",
8
+ "tests/"
9
+ ],
10
+ "keywords": ["compression", "lzw", "string"]
11
+ }
tools/ui/node_modules/lz-string/libs/base64-string.js ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2013 Pieroxy <pieroxy@pieroxy.net>
2
+ // This work is free. You can redistribute it and/or modify it
3
+ // under the terms of the WTFPL, Version 2
4
+ // For more information see LICENSE.txt or http://www.wtfpl.net/
5
+ //
6
+ // This lib is part of the lz-string project.
7
+ // For more information, the home page:
8
+ // http://pieroxy.net/blog/pages/lz-string/index.html
9
+ //
10
+ // Base64 compression / decompression for already compressed content (gif, png, jpg, mp3, ...)
11
+ // version 1.4.1
12
+ var Base64String = {
13
+
14
+ compressToUTF16 : function (input) {
15
+ var output = [],
16
+ i,c,
17
+ current,
18
+ status = 0;
19
+
20
+ input = this.compress(input);
21
+
22
+ for (i=0 ; i<input.length ; i++) {
23
+ c = input.charCodeAt(i);
24
+ switch (status++) {
25
+ case 0:
26
+ output.push(String.fromCharCode((c >> 1)+32));
27
+ current = (c & 1) << 14;
28
+ break;
29
+ case 1:
30
+ output.push(String.fromCharCode((current + (c >> 2))+32));
31
+ current = (c & 3) << 13;
32
+ break;
33
+ case 2:
34
+ output.push(String.fromCharCode((current + (c >> 3))+32));
35
+ current = (c & 7) << 12;
36
+ break;
37
+ case 3:
38
+ output.push(String.fromCharCode((current + (c >> 4))+32));
39
+ current = (c & 15) << 11;
40
+ break;
41
+ case 4:
42
+ output.push(String.fromCharCode((current + (c >> 5))+32));
43
+ current = (c & 31) << 10;
44
+ break;
45
+ case 5:
46
+ output.push(String.fromCharCode((current + (c >> 6))+32));
47
+ current = (c & 63) << 9;
48
+ break;
49
+ case 6:
50
+ output.push(String.fromCharCode((current + (c >> 7))+32));
51
+ current = (c & 127) << 8;
52
+ break;
53
+ case 7:
54
+ output.push(String.fromCharCode((current + (c >> 8))+32));
55
+ current = (c & 255) << 7;
56
+ break;
57
+ case 8:
58
+ output.push(String.fromCharCode((current + (c >> 9))+32));
59
+ current = (c & 511) << 6;
60
+ break;
61
+ case 9:
62
+ output.push(String.fromCharCode((current + (c >> 10))+32));
63
+ current = (c & 1023) << 5;
64
+ break;
65
+ case 10:
66
+ output.push(String.fromCharCode((current + (c >> 11))+32));
67
+ current = (c & 2047) << 4;
68
+ break;
69
+ case 11:
70
+ output.push(String.fromCharCode((current + (c >> 12))+32));
71
+ current = (c & 4095) << 3;
72
+ break;
73
+ case 12:
74
+ output.push(String.fromCharCode((current + (c >> 13))+32));
75
+ current = (c & 8191) << 2;
76
+ break;
77
+ case 13:
78
+ output.push(String.fromCharCode((current + (c >> 14))+32));
79
+ current = (c & 16383) << 1;
80
+ break;
81
+ case 14:
82
+ output.push(String.fromCharCode((current + (c >> 15))+32, (c & 32767)+32));
83
+ status = 0;
84
+ break;
85
+ }
86
+ }
87
+ output.push(String.fromCharCode(current + 32));
88
+ return output.join('');
89
+ },
90
+
91
+
92
+ decompressFromUTF16 : function (input) {
93
+ var output = [],
94
+ current,c,
95
+ status=0,
96
+ i = 0;
97
+
98
+ while (i < input.length) {
99
+ c = input.charCodeAt(i) - 32;
100
+
101
+ switch (status++) {
102
+ case 0:
103
+ current = c << 1;
104
+ break;
105
+ case 1:
106
+ output.push(String.fromCharCode(current | (c >> 14)));
107
+ current = (c&16383) << 2;
108
+ break;
109
+ case 2:
110
+ output.push(String.fromCharCode(current | (c >> 13)));
111
+ current = (c&8191) << 3;
112
+ break;
113
+ case 3:
114
+ output.push(String.fromCharCode(current | (c >> 12)));
115
+ current = (c&4095) << 4;
116
+ break;
117
+ case 4:
118
+ output.push(String.fromCharCode(current | (c >> 11)));
119
+ current = (c&2047) << 5;
120
+ break;
121
+ case 5:
122
+ output.push(String.fromCharCode(current | (c >> 10)));
123
+ current = (c&1023) << 6;
124
+ break;
125
+ case 6:
126
+ output.push(String.fromCharCode(current | (c >> 9)));
127
+ current = (c&511) << 7;
128
+ break;
129
+ case 7:
130
+ output.push(String.fromCharCode(current | (c >> 8)));
131
+ current = (c&255) << 8;
132
+ break;
133
+ case 8:
134
+ output.push(String.fromCharCode(current | (c >> 7)));
135
+ current = (c&127) << 9;
136
+ break;
137
+ case 9:
138
+ output.push(String.fromCharCode(current | (c >> 6)));
139
+ current = (c&63) << 10;
140
+ break;
141
+ case 10:
142
+ output.push(String.fromCharCode(current | (c >> 5)));
143
+ current = (c&31) << 11;
144
+ break;
145
+ case 11:
146
+ output.push(String.fromCharCode(current | (c >> 4)));
147
+ current = (c&15) << 12;
148
+ break;
149
+ case 12:
150
+ output.push(String.fromCharCode(current | (c >> 3)));
151
+ current = (c&7) << 13;
152
+ break;
153
+ case 13:
154
+ output.push(String.fromCharCode(current | (c >> 2)));
155
+ current = (c&3) << 14;
156
+ break;
157
+ case 14:
158
+ output.push(String.fromCharCode(current | (c >> 1)));
159
+ current = (c&1) << 15;
160
+ break;
161
+ case 15:
162
+ output.push(String.fromCharCode(current | c));
163
+ status=0;
164
+ break;
165
+ }
166
+
167
+
168
+ i++;
169
+ }
170
+
171
+ return this.decompress(output.join(''));
172
+ //return output;
173
+
174
+ },
175
+
176
+
177
+ // private property
178
+ _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
179
+
180
+ decompress : function (input) {
181
+ var output = [];
182
+ var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
183
+ var i = 1;
184
+ var odd = input.charCodeAt(0) >> 8;
185
+
186
+ while (i < input.length*2 && (i < input.length*2-1 || odd==0)) {
187
+
188
+ if (i%2==0) {
189
+ chr1 = input.charCodeAt(i/2) >> 8;
190
+ chr2 = input.charCodeAt(i/2) & 255;
191
+ if (i/2+1 < input.length)
192
+ chr3 = input.charCodeAt(i/2+1) >> 8;
193
+ else
194
+ chr3 = NaN;
195
+ } else {
196
+ chr1 = input.charCodeAt((i-1)/2) & 255;
197
+ if ((i+1)/2 < input.length) {
198
+ chr2 = input.charCodeAt((i+1)/2) >> 8;
199
+ chr3 = input.charCodeAt((i+1)/2) & 255;
200
+ } else
201
+ chr2=chr3=NaN;
202
+ }
203
+ i+=3;
204
+
205
+ enc1 = chr1 >> 2;
206
+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
207
+ enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
208
+ enc4 = chr3 & 63;
209
+
210
+ if (isNaN(chr2) || (i==input.length*2+1 && odd)) {
211
+ enc3 = enc4 = 64;
212
+ } else if (isNaN(chr3) || (i==input.length*2 && odd)) {
213
+ enc4 = 64;
214
+ }
215
+
216
+ output.push(this._keyStr.charAt(enc1));
217
+ output.push(this._keyStr.charAt(enc2));
218
+ output.push(this._keyStr.charAt(enc3));
219
+ output.push(this._keyStr.charAt(enc4));
220
+ }
221
+
222
+ return output.join('');
223
+ },
224
+
225
+ compress : function (input) {
226
+ var output = [],
227
+ ol = 1,
228
+ output_,
229
+ chr1, chr2, chr3,
230
+ enc1, enc2, enc3, enc4,
231
+ i = 0, flush=false;
232
+
233
+ input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
234
+
235
+ while (i < input.length) {
236
+
237
+ enc1 = this._keyStr.indexOf(input.charAt(i++));
238
+ enc2 = this._keyStr.indexOf(input.charAt(i++));
239
+ enc3 = this._keyStr.indexOf(input.charAt(i++));
240
+ enc4 = this._keyStr.indexOf(input.charAt(i++));
241
+
242
+ chr1 = (enc1 << 2) | (enc2 >> 4);
243
+ chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
244
+ chr3 = ((enc3 & 3) << 6) | enc4;
245
+
246
+ if (ol%2==0) {
247
+ output_ = chr1 << 8;
248
+ flush = true;
249
+
250
+ if (enc3 != 64) {
251
+ output.push(String.fromCharCode(output_ | chr2));
252
+ flush = false;
253
+ }
254
+ if (enc4 != 64) {
255
+ output_ = chr3 << 8;
256
+ flush = true;
257
+ }
258
+ } else {
259
+ output.push(String.fromCharCode(output_ | chr1));
260
+ flush = false;
261
+
262
+ if (enc3 != 64) {
263
+ output_ = chr2 << 8;
264
+ flush = true;
265
+ }
266
+ if (enc4 != 64) {
267
+ output.push(String.fromCharCode(output_ | chr3));
268
+ flush = false;
269
+ }
270
+ }
271
+ ol+=3;
272
+ }
273
+
274
+ if (flush) {
275
+ output.push(String.fromCharCode(output_));
276
+ output = output.join('');
277
+ output = String.fromCharCode(output.charCodeAt(0)|256) + output.substring(1);
278
+ } else {
279
+ output = output.join('');
280
+ }
281
+
282
+ return output;
283
+
284
+ }
285
+ }
tools/ui/node_modules/lz-string/libs/lz-string.js ADDED
@@ -0,0 +1,506 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright (c) 2013 Pieroxy <pieroxy@pieroxy.net>
2
+ // This work is free. You can redistribute it and/or modify it
3
+ // under the terms of the WTFPL, Version 2
4
+ // For more information see LICENSE.txt or http://www.wtfpl.net/
5
+ //
6
+ // For more information, the home page:
7
+ // http://pieroxy.net/blog/pages/lz-string/testing.html
8
+ //
9
+ // LZ-based compression algorithm, version 1.4.5
10
+ var LZString = (function() {
11
+
12
+ // private property
13
+ var f = String.fromCharCode;
14
+ var keyStrBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
15
+ var keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
16
+ var baseReverseDic = {};
17
+
18
+ function getBaseValue(alphabet, character) {
19
+ if (!baseReverseDic[alphabet]) {
20
+ baseReverseDic[alphabet] = {};
21
+ for (var i=0 ; i<alphabet.length ; i++) {
22
+ baseReverseDic[alphabet][alphabet.charAt(i)] = i;
23
+ }
24
+ }
25
+ return baseReverseDic[alphabet][character];
26
+ }
27
+
28
+ var LZString = {
29
+ compressToBase64 : function (input) {
30
+ if (input == null) return "";
31
+ var res = LZString._compress(input, 6, function(a){return keyStrBase64.charAt(a);});
32
+ switch (res.length % 4) { // To produce valid Base64
33
+ default: // When could this happen ?
34
+ case 0 : return res;
35
+ case 1 : return res+"===";
36
+ case 2 : return res+"==";
37
+ case 3 : return res+"=";
38
+ }
39
+ },
40
+
41
+ decompressFromBase64 : function (input) {
42
+ if (input == null) return "";
43
+ if (input == "") return null;
44
+ return LZString._decompress(input.length, 32, function(index) { return getBaseValue(keyStrBase64, input.charAt(index)); });
45
+ },
46
+
47
+ compressToUTF16 : function (input) {
48
+ if (input == null) return "";
49
+ return LZString._compress(input, 15, function(a){return f(a+32);}) + " ";
50
+ },
51
+
52
+ decompressFromUTF16: function (compressed) {
53
+ if (compressed == null) return "";
54
+ if (compressed == "") return null;
55
+ return LZString._decompress(compressed.length, 16384, function(index) { return compressed.charCodeAt(index) - 32; });
56
+ },
57
+
58
+ //compress into uint8array (UCS-2 big endian format)
59
+ compressToUint8Array: function (uncompressed) {
60
+ var compressed = LZString.compress(uncompressed);
61
+ var buf=new Uint8Array(compressed.length*2); // 2 bytes per character
62
+
63
+ for (var i=0, TotalLen=compressed.length; i<TotalLen; i++) {
64
+ var current_value = compressed.charCodeAt(i);
65
+ buf[i*2] = current_value >>> 8;
66
+ buf[i*2+1] = current_value % 256;
67
+ }
68
+ return buf;
69
+ },
70
+
71
+ //decompress from uint8array (UCS-2 big endian format)
72
+ decompressFromUint8Array:function (compressed) {
73
+ if (compressed===null || compressed===undefined){
74
+ return LZString.decompress(compressed);
75
+ } else {
76
+ var buf=new Array(compressed.length/2); // 2 bytes per character
77
+ for (var i=0, TotalLen=buf.length; i<TotalLen; i++) {
78
+ buf[i]=compressed[i*2]*256+compressed[i*2+1];
79
+ }
80
+
81
+ var result = [];
82
+ buf.forEach(function (c) {
83
+ result.push(f(c));
84
+ });
85
+ return LZString.decompress(result.join(''));
86
+
87
+ }
88
+
89
+ },
90
+
91
+
92
+ //compress into a string that is already URI encoded
93
+ compressToEncodedURIComponent: function (input) {
94
+ if (input == null) return "";
95
+ return LZString._compress(input, 6, function(a){return keyStrUriSafe.charAt(a);});
96
+ },
97
+
98
+ //decompress from an output of compressToEncodedURIComponent
99
+ decompressFromEncodedURIComponent:function (input) {
100
+ if (input == null) return "";
101
+ if (input == "") return null;
102
+ input = input.replace(/ /g, "+");
103
+ return LZString._decompress(input.length, 32, function(index) { return getBaseValue(keyStrUriSafe, input.charAt(index)); });
104
+ },
105
+
106
+ compress: function (uncompressed) {
107
+ return LZString._compress(uncompressed, 16, function(a){return f(a);});
108
+ },
109
+ _compress: function (uncompressed, bitsPerChar, getCharFromInt) {
110
+ if (uncompressed == null) return "";
111
+ var i, value,
112
+ context_dictionary= {},
113
+ context_dictionaryToCreate= {},
114
+ context_c="",
115
+ context_wc="",
116
+ context_w="",
117
+ context_enlargeIn= 2, // Compensate for the first entry which should not count
118
+ context_dictSize= 3,
119
+ context_numBits= 2,
120
+ context_data=[],
121
+ context_data_val=0,
122
+ context_data_position=0,
123
+ ii;
124
+
125
+ for (ii = 0; ii < uncompressed.length; ii += 1) {
126
+ context_c = uncompressed.charAt(ii);
127
+ if (!Object.prototype.hasOwnProperty.call(context_dictionary,context_c)) {
128
+ context_dictionary[context_c] = context_dictSize++;
129
+ context_dictionaryToCreate[context_c] = true;
130
+ }
131
+
132
+ context_wc = context_w + context_c;
133
+ if (Object.prototype.hasOwnProperty.call(context_dictionary,context_wc)) {
134
+ context_w = context_wc;
135
+ } else {
136
+ if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate,context_w)) {
137
+ if (context_w.charCodeAt(0)<256) {
138
+ for (i=0 ; i<context_numBits ; i++) {
139
+ context_data_val = (context_data_val << 1);
140
+ if (context_data_position == bitsPerChar-1) {
141
+ context_data_position = 0;
142
+ context_data.push(getCharFromInt(context_data_val));
143
+ context_data_val = 0;
144
+ } else {
145
+ context_data_position++;
146
+ }
147
+ }
148
+ value = context_w.charCodeAt(0);
149
+ for (i=0 ; i<8 ; i++) {
150
+ context_data_val = (context_data_val << 1) | (value&1);
151
+ if (context_data_position == bitsPerChar-1) {
152
+ context_data_position = 0;
153
+ context_data.push(getCharFromInt(context_data_val));
154
+ context_data_val = 0;
155
+ } else {
156
+ context_data_position++;
157
+ }
158
+ value = value >> 1;
159
+ }
160
+ } else {
161
+ value = 1;
162
+ for (i=0 ; i<context_numBits ; i++) {
163
+ context_data_val = (context_data_val << 1) | value;
164
+ if (context_data_position ==bitsPerChar-1) {
165
+ context_data_position = 0;
166
+ context_data.push(getCharFromInt(context_data_val));
167
+ context_data_val = 0;
168
+ } else {
169
+ context_data_position++;
170
+ }
171
+ value = 0;
172
+ }
173
+ value = context_w.charCodeAt(0);
174
+ for (i=0 ; i<16 ; i++) {
175
+ context_data_val = (context_data_val << 1) | (value&1);
176
+ if (context_data_position == bitsPerChar-1) {
177
+ context_data_position = 0;
178
+ context_data.push(getCharFromInt(context_data_val));
179
+ context_data_val = 0;
180
+ } else {
181
+ context_data_position++;
182
+ }
183
+ value = value >> 1;
184
+ }
185
+ }
186
+ context_enlargeIn--;
187
+ if (context_enlargeIn == 0) {
188
+ context_enlargeIn = Math.pow(2, context_numBits);
189
+ context_numBits++;
190
+ }
191
+ delete context_dictionaryToCreate[context_w];
192
+ } else {
193
+ value = context_dictionary[context_w];
194
+ for (i=0 ; i<context_numBits ; i++) {
195
+ context_data_val = (context_data_val << 1) | (value&1);
196
+ if (context_data_position == bitsPerChar-1) {
197
+ context_data_position = 0;
198
+ context_data.push(getCharFromInt(context_data_val));
199
+ context_data_val = 0;
200
+ } else {
201
+ context_data_position++;
202
+ }
203
+ value = value >> 1;
204
+ }
205
+
206
+
207
+ }
208
+ context_enlargeIn--;
209
+ if (context_enlargeIn == 0) {
210
+ context_enlargeIn = Math.pow(2, context_numBits);
211
+ context_numBits++;
212
+ }
213
+ // Add wc to the dictionary.
214
+ context_dictionary[context_wc] = context_dictSize++;
215
+ context_w = String(context_c);
216
+ }
217
+ }
218
+
219
+ // Output the code for w.
220
+ if (context_w !== "") {
221
+ if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate,context_w)) {
222
+ if (context_w.charCodeAt(0)<256) {
223
+ for (i=0 ; i<context_numBits ; i++) {
224
+ context_data_val = (context_data_val << 1);
225
+ if (context_data_position == bitsPerChar-1) {
226
+ context_data_position = 0;
227
+ context_data.push(getCharFromInt(context_data_val));
228
+ context_data_val = 0;
229
+ } else {
230
+ context_data_position++;
231
+ }
232
+ }
233
+ value = context_w.charCodeAt(0);
234
+ for (i=0 ; i<8 ; i++) {
235
+ context_data_val = (context_data_val << 1) | (value&1);
236
+ if (context_data_position == bitsPerChar-1) {
237
+ context_data_position = 0;
238
+ context_data.push(getCharFromInt(context_data_val));
239
+ context_data_val = 0;
240
+ } else {
241
+ context_data_position++;
242
+ }
243
+ value = value >> 1;
244
+ }
245
+ } else {
246
+ value = 1;
247
+ for (i=0 ; i<context_numBits ; i++) {
248
+ context_data_val = (context_data_val << 1) | value;
249
+ if (context_data_position == bitsPerChar-1) {
250
+ context_data_position = 0;
251
+ context_data.push(getCharFromInt(context_data_val));
252
+ context_data_val = 0;
253
+ } else {
254
+ context_data_position++;
255
+ }
256
+ value = 0;
257
+ }
258
+ value = context_w.charCodeAt(0);
259
+ for (i=0 ; i<16 ; i++) {
260
+ context_data_val = (context_data_val << 1) | (value&1);
261
+ if (context_data_position == bitsPerChar-1) {
262
+ context_data_position = 0;
263
+ context_data.push(getCharFromInt(context_data_val));
264
+ context_data_val = 0;
265
+ } else {
266
+ context_data_position++;
267
+ }
268
+ value = value >> 1;
269
+ }
270
+ }
271
+ context_enlargeIn--;
272
+ if (context_enlargeIn == 0) {
273
+ context_enlargeIn = Math.pow(2, context_numBits);
274
+ context_numBits++;
275
+ }
276
+ delete context_dictionaryToCreate[context_w];
277
+ } else {
278
+ value = context_dictionary[context_w];
279
+ for (i=0 ; i<context_numBits ; i++) {
280
+ context_data_val = (context_data_val << 1) | (value&1);
281
+ if (context_data_position == bitsPerChar-1) {
282
+ context_data_position = 0;
283
+ context_data.push(getCharFromInt(context_data_val));
284
+ context_data_val = 0;
285
+ } else {
286
+ context_data_position++;
287
+ }
288
+ value = value >> 1;
289
+ }
290
+
291
+
292
+ }
293
+ context_enlargeIn--;
294
+ if (context_enlargeIn == 0) {
295
+ context_enlargeIn = Math.pow(2, context_numBits);
296
+ context_numBits++;
297
+ }
298
+ }
299
+
300
+ // Mark the end of the stream
301
+ value = 2;
302
+ for (i=0 ; i<context_numBits ; i++) {
303
+ context_data_val = (context_data_val << 1) | (value&1);
304
+ if (context_data_position == bitsPerChar-1) {
305
+ context_data_position = 0;
306
+ context_data.push(getCharFromInt(context_data_val));
307
+ context_data_val = 0;
308
+ } else {
309
+ context_data_position++;
310
+ }
311
+ value = value >> 1;
312
+ }
313
+
314
+ // Flush the last char
315
+ while (true) {
316
+ context_data_val = (context_data_val << 1);
317
+ if (context_data_position == bitsPerChar-1) {
318
+ context_data.push(getCharFromInt(context_data_val));
319
+ break;
320
+ }
321
+ else context_data_position++;
322
+ }
323
+ return context_data.join('');
324
+ },
325
+
326
+ decompress: function (compressed) {
327
+ if (compressed == null) return "";
328
+ if (compressed == "") return null;
329
+ return LZString._decompress(compressed.length, 32768, function(index) { return compressed.charCodeAt(index); });
330
+ },
331
+
332
+ _decompress: function (length, resetValue, getNextValue) {
333
+ var dictionary = [],
334
+ next,
335
+ enlargeIn = 4,
336
+ dictSize = 4,
337
+ numBits = 3,
338
+ entry = "",
339
+ result = [],
340
+ i,
341
+ w,
342
+ bits, resb, maxpower, power,
343
+ c,
344
+ data = {val:getNextValue(0), position:resetValue, index:1};
345
+
346
+ for (i = 0; i < 3; i += 1) {
347
+ dictionary[i] = i;
348
+ }
349
+
350
+ bits = 0;
351
+ maxpower = Math.pow(2,2);
352
+ power=1;
353
+ while (power!=maxpower) {
354
+ resb = data.val & data.position;
355
+ data.position >>= 1;
356
+ if (data.position == 0) {
357
+ data.position = resetValue;
358
+ data.val = getNextValue(data.index++);
359
+ }
360
+ bits |= (resb>0 ? 1 : 0) * power;
361
+ power <<= 1;
362
+ }
363
+
364
+ switch (next = bits) {
365
+ case 0:
366
+ bits = 0;
367
+ maxpower = Math.pow(2,8);
368
+ power=1;
369
+ while (power!=maxpower) {
370
+ resb = data.val & data.position;
371
+ data.position >>= 1;
372
+ if (data.position == 0) {
373
+ data.position = resetValue;
374
+ data.val = getNextValue(data.index++);
375
+ }
376
+ bits |= (resb>0 ? 1 : 0) * power;
377
+ power <<= 1;
378
+ }
379
+ c = f(bits);
380
+ break;
381
+ case 1:
382
+ bits = 0;
383
+ maxpower = Math.pow(2,16);
384
+ power=1;
385
+ while (power!=maxpower) {
386
+ resb = data.val & data.position;
387
+ data.position >>= 1;
388
+ if (data.position == 0) {
389
+ data.position = resetValue;
390
+ data.val = getNextValue(data.index++);
391
+ }
392
+ bits |= (resb>0 ? 1 : 0) * power;
393
+ power <<= 1;
394
+ }
395
+ c = f(bits);
396
+ break;
397
+ case 2:
398
+ return "";
399
+ }
400
+ dictionary[3] = c;
401
+ w = c;
402
+ result.push(c);
403
+ while (true) {
404
+ if (data.index > length) {
405
+ return "";
406
+ }
407
+
408
+ bits = 0;
409
+ maxpower = Math.pow(2,numBits);
410
+ power=1;
411
+ while (power!=maxpower) {
412
+ resb = data.val & data.position;
413
+ data.position >>= 1;
414
+ if (data.position == 0) {
415
+ data.position = resetValue;
416
+ data.val = getNextValue(data.index++);
417
+ }
418
+ bits |= (resb>0 ? 1 : 0) * power;
419
+ power <<= 1;
420
+ }
421
+
422
+ switch (c = bits) {
423
+ case 0:
424
+ bits = 0;
425
+ maxpower = Math.pow(2,8);
426
+ power=1;
427
+ while (power!=maxpower) {
428
+ resb = data.val & data.position;
429
+ data.position >>= 1;
430
+ if (data.position == 0) {
431
+ data.position = resetValue;
432
+ data.val = getNextValue(data.index++);
433
+ }
434
+ bits |= (resb>0 ? 1 : 0) * power;
435
+ power <<= 1;
436
+ }
437
+
438
+ dictionary[dictSize++] = f(bits);
439
+ c = dictSize-1;
440
+ enlargeIn--;
441
+ break;
442
+ case 1:
443
+ bits = 0;
444
+ maxpower = Math.pow(2,16);
445
+ power=1;
446
+ while (power!=maxpower) {
447
+ resb = data.val & data.position;
448
+ data.position >>= 1;
449
+ if (data.position == 0) {
450
+ data.position = resetValue;
451
+ data.val = getNextValue(data.index++);
452
+ }
453
+ bits |= (resb>0 ? 1 : 0) * power;
454
+ power <<= 1;
455
+ }
456
+ dictionary[dictSize++] = f(bits);
457
+ c = dictSize-1;
458
+ enlargeIn--;
459
+ break;
460
+ case 2:
461
+ return result.join('');
462
+ }
463
+
464
+ if (enlargeIn == 0) {
465
+ enlargeIn = Math.pow(2, numBits);
466
+ numBits++;
467
+ }
468
+
469
+ if (dictionary[c]) {
470
+ entry = dictionary[c];
471
+ } else {
472
+ if (c === dictSize) {
473
+ entry = w + w.charAt(0);
474
+ } else {
475
+ return null;
476
+ }
477
+ }
478
+ result.push(entry);
479
+
480
+ // Add w+entry[0] to the dictionary.
481
+ dictionary[dictSize++] = w + entry.charAt(0);
482
+ enlargeIn--;
483
+
484
+ w = entry;
485
+
486
+ if (enlargeIn == 0) {
487
+ enlargeIn = Math.pow(2, numBits);
488
+ numBits++;
489
+ }
490
+
491
+ }
492
+ }
493
+ };
494
+ return LZString;
495
+ })();
496
+
497
+ if (typeof define === 'function' && define.amd) {
498
+ define(function () { return LZString; });
499
+ } else if( typeof module !== 'undefined' && module != null ) {
500
+ module.exports = LZString
501
+ } else if( typeof angular !== 'undefined' && angular != null ) {
502
+ angular.module('LZString', [])
503
+ .factory('LZString', function () {
504
+ return LZString;
505
+ });
506
+ }
tools/ui/node_modules/lz-string/libs/lz-string.min.js ADDED
@@ -0,0 +1 @@
 
 
1
+ var LZString=function(){var r=String.fromCharCode,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",e={};function t(r,o){if(!e[r]){e[r]={};for(var n=0;n<r.length;n++)e[r][r.charAt(n)]=n}return e[r][o]}var i={compressToBase64:function(r){if(null==r)return"";var n=i._compress(r,6,function(r){return o.charAt(r)});switch(n.length%4){default:case 0:return n;case 1:return n+"===";case 2:return n+"==";case 3:return n+"="}},decompressFromBase64:function(r){return null==r?"":""==r?null:i._decompress(r.length,32,function(n){return t(o,r.charAt(n))})},compressToUTF16:function(o){return null==o?"":i._compress(o,15,function(o){return r(o+32)})+" "},decompressFromUTF16:function(r){return null==r?"":""==r?null:i._decompress(r.length,16384,function(o){return r.charCodeAt(o)-32})},compressToUint8Array:function(r){for(var o=i.compress(r),n=new Uint8Array(2*o.length),e=0,t=o.length;e<t;e++){var s=o.charCodeAt(e);n[2*e]=s>>>8,n[2*e+1]=s%256}return n},decompressFromUint8Array:function(o){if(null==o)return i.decompress(o);for(var n=new Array(o.length/2),e=0,t=n.length;e<t;e++)n[e]=256*o[2*e]+o[2*e+1];var s=[];return n.forEach(function(o){s.push(r(o))}),i.decompress(s.join(""))},compressToEncodedURIComponent:function(r){return null==r?"":i._compress(r,6,function(r){return n.charAt(r)})},decompressFromEncodedURIComponent:function(r){return null==r?"":""==r?null:(r=r.replace(/ /g,"+"),i._decompress(r.length,32,function(o){return t(n,r.charAt(o))}))},compress:function(o){return i._compress(o,16,function(o){return r(o)})},_compress:function(r,o,n){if(null==r)return"";var e,t,i,s={},u={},a="",p="",c="",l=2,f=3,h=2,d=[],m=0,v=0;for(i=0;i<r.length;i+=1)if(a=r.charAt(i),Object.prototype.hasOwnProperty.call(s,a)||(s[a]=f++,u[a]=!0),p=c+a,Object.prototype.hasOwnProperty.call(s,p))c=p;else{if(Object.prototype.hasOwnProperty.call(u,c)){if(c.charCodeAt(0)<256){for(e=0;e<h;e++)m<<=1,v==o-1?(v=0,d.push(n(m)),m=0):v++;for(t=c.charCodeAt(0),e=0;e<8;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;e<h;e++)m=m<<1|t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=c.charCodeAt(0),e=0;e<16;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete u[c]}else for(t=s[c],e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++),s[p]=f++,c=String(a)}if(""!==c){if(Object.prototype.hasOwnProperty.call(u,c)){if(c.charCodeAt(0)<256){for(e=0;e<h;e++)m<<=1,v==o-1?(v=0,d.push(n(m)),m=0):v++;for(t=c.charCodeAt(0),e=0;e<8;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;e<h;e++)m=m<<1|t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=c.charCodeAt(0),e=0;e<16;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}0==--l&&(l=Math.pow(2,h),h++),delete u[c]}else for(t=s[c],e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;0==--l&&(l=Math.pow(2,h),h++)}for(t=2,e=0;e<h;e++)m=m<<1|1&t,v==o-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==o-1){d.push(n(m));break}v++}return d.join("")},decompress:function(r){return null==r?"":""==r?null:i._decompress(r.length,32768,function(o){return r.charCodeAt(o)})},_decompress:function(o,n,e){var t,i,s,u,a,p,c,l=[],f=4,h=4,d=3,m="",v=[],g={val:e(0),position:n,index:1};for(t=0;t<3;t+=1)l[t]=t;for(s=0,a=Math.pow(2,2),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;switch(s){case 0:for(s=0,a=Math.pow(2,8),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;c=r(s);break;case 1:for(s=0,a=Math.pow(2,16),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;c=r(s);break;case 2:return""}for(l[3]=c,i=c,v.push(c);;){if(g.index>o)return"";for(s=0,a=Math.pow(2,d),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;switch(c=s){case 0:for(s=0,a=Math.pow(2,8),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;l[h++]=r(s),c=h-1,f--;break;case 1:for(s=0,a=Math.pow(2,16),p=1;p!=a;)u=g.val&g.position,g.position>>=1,0==g.position&&(g.position=n,g.val=e(g.index++)),s|=(u>0?1:0)*p,p<<=1;l[h++]=r(s),c=h-1,f--;break;case 2:return v.join("")}if(0==f&&(f=Math.pow(2,d),d++),l[c])m=l[c];else{if(c!==h)return null;m=i+i.charAt(0)}v.push(m),l[h++]=i+m.charAt(0),i=m,0==--f&&(f=Math.pow(2,d),d++)}}};return i}();"function"==typeof define&&define.amd?define(function(){return LZString}):"undefined"!=typeof module&&null!=module?module.exports=LZString:"undefined"!=typeof angular&&null!=angular&&angular.module("LZString",[]).factory("LZString",function(){return LZString});
tools/ui/node_modules/lz-string/package.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "lz-string",
3
+ "version": "1.5.0",
4
+ "license": "MIT",
5
+ "filename": "lz-string.js",
6
+ "description": "LZ-based compression algorithm",
7
+ "homepage": "http://pieroxy.net/blog/pages/lz-string/index.html",
8
+ "keywords": [
9
+ "lz",
10
+ "compression",
11
+ "string"
12
+ ],
13
+ "main": "libs/lz-string.js",
14
+ "typings": "typings/lz-string.d.ts",
15
+ "bin": {
16
+ "lz-string": "bin/bin.js"
17
+ },
18
+ "scripts": {},
19
+ "dependencies": {},
20
+ "devDependencies": {},
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/pieroxy/lz-string.git"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/pieroxy/lz-string/issues"
27
+ },
28
+ "directories": {
29
+ "test": "tests"
30
+ },
31
+ "author": "pieroxy <pieroxy@pieroxy.net>",
32
+ "autoupdate": {
33
+ "source": "git",
34
+ "target": "git://github.com/pieroxy/lz-string.git",
35
+ "basePath": "libs/",
36
+ "files": [
37
+ "lz-string.js",
38
+ "lz-string.min.js",
39
+ "base64-string.js"
40
+ ]
41
+ }
42
+ }
tools/ui/node_modules/lz-string/reference/lz-string-1.0.2.js ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright © 2013 Pieroxy <pieroxy@pieroxy.net>
2
+ // This work is free. You can redistribute it and/or modify it
3
+ // under the terms of the WTFPL, Version 2
4
+ // For more information see LICENSE.txt or http://www.wtfpl.net/
5
+ //
6
+ // LZ-based compression algorithm, version 1.0.2-rc1
7
+ var LZString = {
8
+
9
+ writeBit : function(value, data) {
10
+ data.val = (data.val << 1) | value;
11
+ if (data.position == 15) {
12
+ data.position = 0;
13
+ data.string += String.fromCharCode(data.val);
14
+ data.val = 0;
15
+ } else {
16
+ data.position++;
17
+ }
18
+ },
19
+
20
+ writeBits : function(numBits, value, data) {
21
+ if (typeof(value)=="string")
22
+ value = value.charCodeAt(0);
23
+ for (var i=0 ; i<numBits ; i++) {
24
+ this.writeBit(value&1, data);
25
+ value = value >> 1;
26
+ }
27
+ },
28
+
29
+ produceW : function (context) {
30
+ if (Object.prototype.hasOwnProperty.call(context.dictionaryToCreate,context.w)) {
31
+ if (context.w.charCodeAt(0)<256) {
32
+ this.writeBits(context.numBits, 0, context.data);
33
+ this.writeBits(8, context.w, context.data);
34
+ } else {
35
+ this.writeBits(context.numBits, 1, context.data);
36
+ this.writeBits(16, context.w, context.data);
37
+ }
38
+ this.decrementEnlargeIn(context);
39
+ delete context.dictionaryToCreate[context.w];
40
+ } else {
41
+ this.writeBits(context.numBits, context.dictionary[context.w], context.data);
42
+ }
43
+ this.decrementEnlargeIn(context);
44
+ },
45
+
46
+ decrementEnlargeIn : function(context) {
47
+ context.enlargeIn--;
48
+ if (context.enlargeIn == 0) {
49
+ context.enlargeIn = Math.pow(2, context.numBits);
50
+ context.numBits++;
51
+ }
52
+ },
53
+
54
+ compress: function (uncompressed) {
55
+ var context = {
56
+ dictionary: {},
57
+ dictionaryToCreate: {},
58
+ c:"",
59
+ wc:"",
60
+ w:"",
61
+ enlargeIn: 2, // Compensate for the first entry which should not count
62
+ dictSize: 3,
63
+ numBits: 2,
64
+ result: "",
65
+ data: {string:"", val:0, position:0}
66
+ }, i;
67
+
68
+ for (i = 0; i < uncompressed.length; i += 1) {
69
+ context.c = uncompressed.charAt(i);
70
+ if (!Object.prototype.hasOwnProperty.call(context.dictionary,context.c)) {
71
+ context.dictionary[context.c] = context.dictSize++;
72
+ context.dictionaryToCreate[context.c] = true;
73
+ }
74
+
75
+ context.wc = context.w + context.c;
76
+ if (Object.prototype.hasOwnProperty.call(context.dictionary,context.wc)) {
77
+ context.w = context.wc;
78
+ } else {
79
+ this.produceW(context);
80
+ // Add wc to the dictionary.
81
+ context.dictionary[context.wc] = context.dictSize++;
82
+ context.w = String(context.c);
83
+ }
84
+ }
85
+
86
+ // Output the code for w.
87
+ if (context.w !== "") {
88
+ this.produceW(context);
89
+ }
90
+
91
+ // Mark the end of the stream
92
+ this.writeBits(context.numBits, 2, context.data);
93
+
94
+ // Flush the last char
95
+ while (context.data.val>0) this.writeBit(0,context.data)
96
+ return context.data.string;
97
+ },
98
+
99
+ readBit : function(data) {
100
+ var res = data.val & data.position;
101
+ data.position >>= 1;
102
+ if (data.position == 0) {
103
+ data.position = 32768;
104
+ data.val = data.string.charCodeAt(data.index++);
105
+ }
106
+ //data.val = (data.val << 1);
107
+ return res>0 ? 1 : 0;
108
+ },
109
+
110
+ readBits : function(numBits, data) {
111
+ var res = 0;
112
+ var maxpower = Math.pow(2,numBits);
113
+ var power=1;
114
+ while (power!=maxpower) {
115
+ res |= this.readBit(data) * power;
116
+ power <<= 1;
117
+ }
118
+ return res;
119
+ },
120
+
121
+ decompress: function (compressed) {
122
+ var dictionary = {},
123
+ next,
124
+ enlargeIn = 4,
125
+ dictSize = 4,
126
+ numBits = 3,
127
+ entry = "",
128
+ result = "",
129
+ i,
130
+ w,
131
+ c,
132
+ errorCount=0,
133
+ literal,
134
+ data = {string:compressed, val:compressed.charCodeAt(0), position:32768, index:1};
135
+
136
+ for (i = 0; i < 3; i += 1) {
137
+ dictionary[i] = i;
138
+ }
139
+
140
+ next = this.readBits(2, data);
141
+ switch (next) {
142
+ case 0:
143
+ c = String.fromCharCode(this.readBits(8, data));
144
+ break;
145
+ case 1:
146
+ c = String.fromCharCode(this.readBits(16, data));
147
+ break;
148
+ case 2:
149
+ return "";
150
+ }
151
+ dictionary[3] = c;
152
+ w = result = c;
153
+ while (true) {
154
+ c = this.readBits(numBits, data);
155
+
156
+ switch (c) {
157
+ case 0:
158
+ if (errorCount++ > 10000) return "Error";
159
+ c = String.fromCharCode(this.readBits(8, data));
160
+ dictionary[dictSize++] = c;
161
+ c = dictSize-1;
162
+ enlargeIn--;
163
+ break;
164
+ case 1:
165
+ c = String.fromCharCode(this.readBits(16, data));
166
+ dictionary[dictSize++] = c;
167
+ c = dictSize-1;
168
+ enlargeIn--;
169
+ break;
170
+ case 2:
171
+ return result;
172
+ }
173
+
174
+ if (enlargeIn == 0) {
175
+ enlargeIn = Math.pow(2, numBits);
176
+ numBits++;
177
+ }
178
+
179
+ if (dictionary[c]) {
180
+ entry = dictionary[c];
181
+ } else {
182
+ if (c === dictSize) {
183
+ entry = w + w.charAt(0);
184
+ } else {
185
+ return null;
186
+ }
187
+ }
188
+ result += entry;
189
+
190
+ // Add w+entry[0] to the dictionary.
191
+ dictionary[dictSize++] = w + entry.charAt(0);
192
+ enlargeIn--;
193
+
194
+ w = entry;
195
+
196
+ if (enlargeIn == 0) {
197
+ enlargeIn = Math.pow(2, numBits);
198
+ numBits++;
199
+ }
200
+
201
+ }
202
+ return result;
203
+ }
204
+ };
tools/ui/node_modules/lz-string/tests/SpecRunner.html ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <head>
5
+ <title>LZString tests</title>
6
+
7
+ <link rel="shortcut icon" type="image/png" href="lib/jasmine-1.3.1/jasmine_favicon.png">
8
+ <link rel="stylesheet" type="text/css" href="lib/jasmine-1.3.1/jasmine.css">
9
+ <script type="text/javascript" src="lib/jasmine-1.3.1/jasmine.js"></script>
10
+ <script type="text/javascript" src="lib/jasmine-1.3.1/jasmine-html.js"></script>
11
+
12
+ <!-- include source files here... -->
13
+ <script type="text/javascript" src="../libs/lz-string.js"></script>
14
+
15
+ <!-- include spec files here... -->
16
+ <script type="text/javascript" src="lz-string-spec.js"></script>
17
+
18
+ <script type="text/javascript">
19
+ (function() {
20
+ var jasmineEnv = jasmine.getEnv();
21
+ jasmineEnv.updateInterval = 1000;
22
+
23
+ var htmlReporter = new jasmine.HtmlReporter();
24
+
25
+ jasmineEnv.addReporter(htmlReporter);
26
+
27
+ jasmineEnv.specFilter = function(spec) {
28
+ return htmlReporter.specFilter(spec);
29
+ };
30
+
31
+ var currentWindowOnload = window.onload;
32
+
33
+ window.onload = function() {
34
+ if (currentWindowOnload) {
35
+ currentWindowOnload();
36
+ }
37
+ execJasmine();
38
+ };
39
+
40
+ function execJasmine() {
41
+ jasmineEnv.execute();
42
+ }
43
+
44
+ })();
45
+ </script>
46
+
47
+ </head>
48
+
49
+ <body>
50
+ </body>
51
+ </html>
tools/ui/node_modules/lz-string/tests/lib/jasmine-1.3.1/MIT.LICENSE ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2008-2011 Pivotal Labs
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tools/ui/node_modules/lz-string/tests/lib/jasmine-1.3.1/jasmine-html.js ADDED
@@ -0,0 +1,681 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jasmine.HtmlReporterHelpers = {};
2
+
3
+ jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) {
4
+ var el = document.createElement(type);
5
+
6
+ for (var i = 2; i < arguments.length; i++) {
7
+ var child = arguments[i];
8
+
9
+ if (typeof child === 'string') {
10
+ el.appendChild(document.createTextNode(child));
11
+ } else {
12
+ if (child) {
13
+ el.appendChild(child);
14
+ }
15
+ }
16
+ }
17
+
18
+ for (var attr in attrs) {
19
+ if (attr == "className") {
20
+ el[attr] = attrs[attr];
21
+ } else {
22
+ el.setAttribute(attr, attrs[attr]);
23
+ }
24
+ }
25
+
26
+ return el;
27
+ };
28
+
29
+ jasmine.HtmlReporterHelpers.getSpecStatus = function(child) {
30
+ var results = child.results();
31
+ var status = results.passed() ? 'passed' : 'failed';
32
+ if (results.skipped) {
33
+ status = 'skipped';
34
+ }
35
+
36
+ return status;
37
+ };
38
+
39
+ jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) {
40
+ var parentDiv = this.dom.summary;
41
+ var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite';
42
+ var parent = child[parentSuite];
43
+
44
+ if (parent) {
45
+ if (typeof this.views.suites[parent.id] == 'undefined') {
46
+ this.views.suites[parent.id] = new jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views);
47
+ }
48
+ parentDiv = this.views.suites[parent.id].element;
49
+ }
50
+
51
+ parentDiv.appendChild(childElement);
52
+ };
53
+
54
+
55
+ jasmine.HtmlReporterHelpers.addHelpers = function(ctor) {
56
+ for(var fn in jasmine.HtmlReporterHelpers) {
57
+ ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn];
58
+ }
59
+ };
60
+
61
+ jasmine.HtmlReporter = function(_doc) {
62
+ var self = this;
63
+ var doc = _doc || window.document;
64
+
65
+ var reporterView;
66
+
67
+ var dom = {};
68
+
69
+ // Jasmine Reporter Public Interface
70
+ self.logRunningSpecs = false;
71
+
72
+ self.reportRunnerStarting = function(runner) {
73
+ var specs = runner.specs() || [];
74
+
75
+ if (specs.length == 0) {
76
+ return;
77
+ }
78
+
79
+ createReporterDom(runner.env.versionString());
80
+ doc.body.appendChild(dom.reporter);
81
+ setExceptionHandling();
82
+
83
+ reporterView = new jasmine.HtmlReporter.ReporterView(dom);
84
+ reporterView.addSpecs(specs, self.specFilter);
85
+ };
86
+
87
+ self.reportRunnerResults = function(runner) {
88
+ reporterView && reporterView.complete();
89
+ };
90
+
91
+ self.reportSuiteResults = function(suite) {
92
+ reporterView.suiteComplete(suite);
93
+ };
94
+
95
+ self.reportSpecStarting = function(spec) {
96
+ if (self.logRunningSpecs) {
97
+ self.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
98
+ }
99
+ };
100
+
101
+ self.reportSpecResults = function(spec) {
102
+ reporterView.specComplete(spec);
103
+ };
104
+
105
+ self.log = function() {
106
+ var console = jasmine.getGlobal().console;
107
+ if (console && console.log) {
108
+ if (console.log.apply) {
109
+ console.log.apply(console, arguments);
110
+ } else {
111
+ console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
112
+ }
113
+ }
114
+ };
115
+
116
+ self.specFilter = function(spec) {
117
+ if (!focusedSpecName()) {
118
+ return true;
119
+ }
120
+
121
+ return spec.getFullName().indexOf(focusedSpecName()) === 0;
122
+ };
123
+
124
+ return self;
125
+
126
+ function focusedSpecName() {
127
+ var specName;
128
+
129
+ (function memoizeFocusedSpec() {
130
+ if (specName) {
131
+ return;
132
+ }
133
+
134
+ var paramMap = [];
135
+ var params = jasmine.HtmlReporter.parameters(doc);
136
+
137
+ for (var i = 0; i < params.length; i++) {
138
+ var p = params[i].split('=');
139
+ paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
140
+ }
141
+
142
+ specName = paramMap.spec;
143
+ })();
144
+
145
+ return specName;
146
+ }
147
+
148
+ function createReporterDom(version) {
149
+ dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' },
150
+ dom.banner = self.createDom('div', { className: 'banner' },
151
+ self.createDom('span', { className: 'title' }, "Jasmine "),
152
+ self.createDom('span', { className: 'version' }, version)),
153
+
154
+ dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),
155
+ dom.alert = self.createDom('div', {className: 'alert'},
156
+ self.createDom('span', { className: 'exceptions' },
157
+ self.createDom('label', { className: 'label', 'for': 'no_try_catch' }, 'No try/catch'),
158
+ self.createDom('input', { id: 'no_try_catch', type: 'checkbox' }))),
159
+ dom.results = self.createDom('div', {className: 'results'},
160
+ dom.summary = self.createDom('div', { className: 'summary' }),
161
+ dom.details = self.createDom('div', { id: 'details' }))
162
+ );
163
+ }
164
+
165
+ function noTryCatch() {
166
+ return window.location.search.match(/catch=false/);
167
+ }
168
+
169
+ function searchWithCatch() {
170
+ var params = jasmine.HtmlReporter.parameters(window.document);
171
+ var removed = false;
172
+ var i = 0;
173
+
174
+ while (!removed && i < params.length) {
175
+ if (params[i].match(/catch=/)) {
176
+ params.splice(i, 1);
177
+ removed = true;
178
+ }
179
+ i++;
180
+ }
181
+ if (jasmine.CATCH_EXCEPTIONS) {
182
+ params.push("catch=false");
183
+ }
184
+
185
+ return params.join("&");
186
+ }
187
+
188
+ function setExceptionHandling() {
189
+ var chxCatch = document.getElementById('no_try_catch');
190
+
191
+ if (noTryCatch()) {
192
+ chxCatch.setAttribute('checked', true);
193
+ jasmine.CATCH_EXCEPTIONS = false;
194
+ }
195
+ chxCatch.onclick = function() {
196
+ window.location.search = searchWithCatch();
197
+ };
198
+ }
199
+ };
200
+ jasmine.HtmlReporter.parameters = function(doc) {
201
+ var paramStr = doc.location.search.substring(1);
202
+ var params = [];
203
+
204
+ if (paramStr.length > 0) {
205
+ params = paramStr.split('&');
206
+ }
207
+ return params;
208
+ }
209
+ jasmine.HtmlReporter.sectionLink = function(sectionName) {
210
+ var link = '?';
211
+ var params = [];
212
+
213
+ if (sectionName) {
214
+ params.push('spec=' + encodeURIComponent(sectionName));
215
+ }
216
+ if (!jasmine.CATCH_EXCEPTIONS) {
217
+ params.push("catch=false");
218
+ }
219
+ if (params.length > 0) {
220
+ link += params.join("&");
221
+ }
222
+
223
+ return link;
224
+ };
225
+ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);
226
+ jasmine.HtmlReporter.ReporterView = function(dom) {
227
+ this.startedAt = new Date();
228
+ this.runningSpecCount = 0;
229
+ this.completeSpecCount = 0;
230
+ this.passedCount = 0;
231
+ this.failedCount = 0;
232
+ this.skippedCount = 0;
233
+
234
+ this.createResultsMenu = function() {
235
+ this.resultsMenu = this.createDom('span', {className: 'resultsMenu bar'},
236
+ this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: "#"}, '0 specs'),
237
+ ' | ',
238
+ this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: "#"}, '0 failing'));
239
+
240
+ this.summaryMenuItem.onclick = function() {
241
+ dom.reporter.className = dom.reporter.className.replace(/ showDetails/g, '');
242
+ };
243
+
244
+ this.detailsMenuItem.onclick = function() {
245
+ showDetails();
246
+ };
247
+ };
248
+
249
+ this.addSpecs = function(specs, specFilter) {
250
+ this.totalSpecCount = specs.length;
251
+
252
+ this.views = {
253
+ specs: {},
254
+ suites: {}
255
+ };
256
+
257
+ for (var i = 0; i < specs.length; i++) {
258
+ var spec = specs[i];
259
+ this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom, this.views);
260
+ if (specFilter(spec)) {
261
+ this.runningSpecCount++;
262
+ }
263
+ }
264
+ };
265
+
266
+ this.specComplete = function(spec) {
267
+ this.completeSpecCount++;
268
+
269
+ if (isUndefined(this.views.specs[spec.id])) {
270
+ this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom);
271
+ }
272
+
273
+ var specView = this.views.specs[spec.id];
274
+
275
+ switch (specView.status()) {
276
+ case 'passed':
277
+ this.passedCount++;
278
+ break;
279
+
280
+ case 'failed':
281
+ this.failedCount++;
282
+ break;
283
+
284
+ case 'skipped':
285
+ this.skippedCount++;
286
+ break;
287
+ }
288
+
289
+ specView.refresh();
290
+ this.refresh();
291
+ };
292
+
293
+ this.suiteComplete = function(suite) {
294
+ var suiteView = this.views.suites[suite.id];
295
+ if (isUndefined(suiteView)) {
296
+ return;
297
+ }
298
+ suiteView.refresh();
299
+ };
300
+
301
+ this.refresh = function() {
302
+
303
+ if (isUndefined(this.resultsMenu)) {
304
+ this.createResultsMenu();
305
+ }
306
+
307
+ // currently running UI
308
+ if (isUndefined(this.runningAlert)) {
309
+ this.runningAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "runningAlert bar" });
310
+ dom.alert.appendChild(this.runningAlert);
311
+ }
312
+ this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount);
313
+
314
+ // skipped specs UI
315
+ if (isUndefined(this.skippedAlert)) {
316
+ this.skippedAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "skippedAlert bar" });
317
+ }
318
+
319
+ this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
320
+
321
+ if (this.skippedCount === 1 && isDefined(dom.alert)) {
322
+ dom.alert.appendChild(this.skippedAlert);
323
+ }
324
+
325
+ // passing specs UI
326
+ if (isUndefined(this.passedAlert)) {
327
+ this.passedAlert = this.createDom('span', { href: jasmine.HtmlReporter.sectionLink(), className: "passingAlert bar" });
328
+ }
329
+ this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount);
330
+
331
+ // failing specs UI
332
+ if (isUndefined(this.failedAlert)) {
333
+ this.failedAlert = this.createDom('span', {href: "?", className: "failingAlert bar"});
334
+ }
335
+ this.failedAlert.innerHTML = "Failing " + specPluralizedFor(this.failedCount);
336
+
337
+ if (this.failedCount === 1 && isDefined(dom.alert)) {
338
+ dom.alert.appendChild(this.failedAlert);
339
+ dom.alert.appendChild(this.resultsMenu);
340
+ }
341
+
342
+ // summary info
343
+ this.summaryMenuItem.innerHTML = "" + specPluralizedFor(this.runningSpecCount);
344
+ this.detailsMenuItem.innerHTML = "" + this.failedCount + " failing";
345
+ };
346
+
347
+ this.complete = function() {
348
+ dom.alert.removeChild(this.runningAlert);
349
+
350
+ this.skippedAlert.innerHTML = "Ran " + this.runningSpecCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
351
+
352
+ if (this.failedCount === 0) {
353
+ dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, "Passing " + specPluralizedFor(this.passedCount)));
354
+ } else {
355
+ showDetails();
356
+ }
357
+
358
+ dom.banner.appendChild(this.createDom('span', {className: 'duration'}, "finished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"));
359
+ };
360
+
361
+ return this;
362
+
363
+ function showDetails() {
364
+ if (dom.reporter.className.search(/showDetails/) === -1) {
365
+ dom.reporter.className += " showDetails";
366
+ }
367
+ }
368
+
369
+ function isUndefined(obj) {
370
+ return typeof obj === 'undefined';
371
+ }
372
+
373
+ function isDefined(obj) {
374
+ return !isUndefined(obj);
375
+ }
376
+
377
+ function specPluralizedFor(count) {
378
+ var str = count + " spec";
379
+ if (count > 1) {
380
+ str += "s"
381
+ }
382
+ return str;
383
+ }
384
+
385
+ };
386
+
387
+ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.ReporterView);
388
+
389
+
390
+ jasmine.HtmlReporter.SpecView = function(spec, dom, views) {
391
+ this.spec = spec;
392
+ this.dom = dom;
393
+ this.views = views;
394
+
395
+ this.symbol = this.createDom('li', { className: 'pending' });
396
+ this.dom.symbolSummary.appendChild(this.symbol);
397
+
398
+ this.summary = this.createDom('div', { className: 'specSummary' },
399
+ this.createDom('a', {
400
+ className: 'description',
401
+ href: jasmine.HtmlReporter.sectionLink(this.spec.getFullName()),
402
+ title: this.spec.getFullName()
403
+ }, this.spec.description)
404
+ );
405
+
406
+ this.detail = this.createDom('div', { className: 'specDetail' },
407
+ this.createDom('a', {
408
+ className: 'description',
409
+ href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
410
+ title: this.spec.getFullName()
411
+ }, this.spec.getFullName())
412
+ );
413
+ };
414
+
415
+ jasmine.HtmlReporter.SpecView.prototype.status = function() {
416
+ return this.getSpecStatus(this.spec);
417
+ };
418
+
419
+ jasmine.HtmlReporter.SpecView.prototype.refresh = function() {
420
+ this.symbol.className = this.status();
421
+
422
+ switch (this.status()) {
423
+ case 'skipped':
424
+ break;
425
+
426
+ case 'passed':
427
+ this.appendSummaryToSuiteDiv();
428
+ break;
429
+
430
+ case 'failed':
431
+ this.appendSummaryToSuiteDiv();
432
+ this.appendFailureDetail();
433
+ break;
434
+ }
435
+ };
436
+
437
+ jasmine.HtmlReporter.SpecView.prototype.appendSummaryToSuiteDiv = function() {
438
+ this.summary.className += ' ' + this.status();
439
+ this.appendToSummary(this.spec, this.summary);
440
+ };
441
+
442
+ jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() {
443
+ this.detail.className += ' ' + this.status();
444
+
445
+ var resultItems = this.spec.results().getItems();
446
+ var messagesDiv = this.createDom('div', { className: 'messages' });
447
+
448
+ for (var i = 0; i < resultItems.length; i++) {
449
+ var result = resultItems[i];
450
+
451
+ if (result.type == 'log') {
452
+ messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
453
+ } else if (result.type == 'expect' && result.passed && !result.passed()) {
454
+ messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
455
+
456
+ if (result.trace.stack) {
457
+ messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
458
+ }
459
+ }
460
+ }
461
+
462
+ if (messagesDiv.childNodes.length > 0) {
463
+ this.detail.appendChild(messagesDiv);
464
+ this.dom.details.appendChild(this.detail);
465
+ }
466
+ };
467
+
468
+ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.HtmlReporter.SuiteView = function(suite, dom, views) {
469
+ this.suite = suite;
470
+ this.dom = dom;
471
+ this.views = views;
472
+
473
+ this.element = this.createDom('div', { className: 'suite' },
474
+ this.createDom('a', { className: 'description', href: jasmine.HtmlReporter.sectionLink(this.suite.getFullName()) }, this.suite.description)
475
+ );
476
+
477
+ this.appendToSummary(this.suite, this.element);
478
+ };
479
+
480
+ jasmine.HtmlReporter.SuiteView.prototype.status = function() {
481
+ return this.getSpecStatus(this.suite);
482
+ };
483
+
484
+ jasmine.HtmlReporter.SuiteView.prototype.refresh = function() {
485
+ this.element.className += " " + this.status();
486
+ };
487
+
488
+ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SuiteView);
489
+
490
+ /* @deprecated Use jasmine.HtmlReporter instead
491
+ */
492
+ jasmine.TrivialReporter = function(doc) {
493
+ this.document = doc || document;
494
+ this.suiteDivs = {};
495
+ this.logRunningSpecs = false;
496
+ };
497
+
498
+ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
499
+ var el = document.createElement(type);
500
+
501
+ for (var i = 2; i < arguments.length; i++) {
502
+ var child = arguments[i];
503
+
504
+ if (typeof child === 'string') {
505
+ el.appendChild(document.createTextNode(child));
506
+ } else {
507
+ if (child) { el.appendChild(child); }
508
+ }
509
+ }
510
+
511
+ for (var attr in attrs) {
512
+ if (attr == "className") {
513
+ el[attr] = attrs[attr];
514
+ } else {
515
+ el.setAttribute(attr, attrs[attr]);
516
+ }
517
+ }
518
+
519
+ return el;
520
+ };
521
+
522
+ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
523
+ var showPassed, showSkipped;
524
+
525
+ this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' },
526
+ this.createDom('div', { className: 'banner' },
527
+ this.createDom('div', { className: 'logo' },
528
+ this.createDom('span', { className: 'title' }, "Jasmine"),
529
+ this.createDom('span', { className: 'version' }, runner.env.versionString())),
530
+ this.createDom('div', { className: 'options' },
531
+ "Show ",
532
+ showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
533
+ this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
534
+ showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
535
+ this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
536
+ )
537
+ ),
538
+
539
+ this.runnerDiv = this.createDom('div', { className: 'runner running' },
540
+ this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
541
+ this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
542
+ this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
543
+ );
544
+
545
+ this.document.body.appendChild(this.outerDiv);
546
+
547
+ var suites = runner.suites();
548
+ for (var i = 0; i < suites.length; i++) {
549
+ var suite = suites[i];
550
+ var suiteDiv = this.createDom('div', { className: 'suite' },
551
+ this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
552
+ this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
553
+ this.suiteDivs[suite.id] = suiteDiv;
554
+ var parentDiv = this.outerDiv;
555
+ if (suite.parentSuite) {
556
+ parentDiv = this.suiteDivs[suite.parentSuite.id];
557
+ }
558
+ parentDiv.appendChild(suiteDiv);
559
+ }
560
+
561
+ this.startedAt = new Date();
562
+
563
+ var self = this;
564
+ showPassed.onclick = function(evt) {
565
+ if (showPassed.checked) {
566
+ self.outerDiv.className += ' show-passed';
567
+ } else {
568
+ self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
569
+ }
570
+ };
571
+
572
+ showSkipped.onclick = function(evt) {
573
+ if (showSkipped.checked) {
574
+ self.outerDiv.className += ' show-skipped';
575
+ } else {
576
+ self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
577
+ }
578
+ };
579
+ };
580
+
581
+ jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
582
+ var results = runner.results();
583
+ var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
584
+ this.runnerDiv.setAttribute("class", className);
585
+ //do it twice for IE
586
+ this.runnerDiv.setAttribute("className", className);
587
+ var specs = runner.specs();
588
+ var specCount = 0;
589
+ for (var i = 0; i < specs.length; i++) {
590
+ if (this.specFilter(specs[i])) {
591
+ specCount++;
592
+ }
593
+ }
594
+ var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
595
+ message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
596
+ this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
597
+
598
+ this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
599
+ };
600
+
601
+ jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
602
+ var results = suite.results();
603
+ var status = results.passed() ? 'passed' : 'failed';
604
+ if (results.totalCount === 0) { // todo: change this to check results.skipped
605
+ status = 'skipped';
606
+ }
607
+ this.suiteDivs[suite.id].className += " " + status;
608
+ };
609
+
610
+ jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {
611
+ if (this.logRunningSpecs) {
612
+ this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
613
+ }
614
+ };
615
+
616
+ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
617
+ var results = spec.results();
618
+ var status = results.passed() ? 'passed' : 'failed';
619
+ if (results.skipped) {
620
+ status = 'skipped';
621
+ }
622
+ var specDiv = this.createDom('div', { className: 'spec ' + status },
623
+ this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
624
+ this.createDom('a', {
625
+ className: 'description',
626
+ href: '?spec=' + encodeURIComponent(spec.getFullName()),
627
+ title: spec.getFullName()
628
+ }, spec.description));
629
+
630
+
631
+ var resultItems = results.getItems();
632
+ var messagesDiv = this.createDom('div', { className: 'messages' });
633
+ for (var i = 0; i < resultItems.length; i++) {
634
+ var result = resultItems[i];
635
+
636
+ if (result.type == 'log') {
637
+ messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
638
+ } else if (result.type == 'expect' && result.passed && !result.passed()) {
639
+ messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
640
+
641
+ if (result.trace.stack) {
642
+ messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
643
+ }
644
+ }
645
+ }
646
+
647
+ if (messagesDiv.childNodes.length > 0) {
648
+ specDiv.appendChild(messagesDiv);
649
+ }
650
+
651
+ this.suiteDivs[spec.suite.id].appendChild(specDiv);
652
+ };
653
+
654
+ jasmine.TrivialReporter.prototype.log = function() {
655
+ var console = jasmine.getGlobal().console;
656
+ if (console && console.log) {
657
+ if (console.log.apply) {
658
+ console.log.apply(console, arguments);
659
+ } else {
660
+ console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
661
+ }
662
+ }
663
+ };
664
+
665
+ jasmine.TrivialReporter.prototype.getLocation = function() {
666
+ return this.document.location;
667
+ };
668
+
669
+ jasmine.TrivialReporter.prototype.specFilter = function(spec) {
670
+ var paramMap = {};
671
+ var params = this.getLocation().search.substring(1).split('&');
672
+ for (var i = 0; i < params.length; i++) {
673
+ var p = params[i].split('=');
674
+ paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
675
+ }
676
+
677
+ if (!paramMap.spec) {
678
+ return true;
679
+ }
680
+ return spec.getFullName().indexOf(paramMap.spec) === 0;
681
+ };
tools/ui/node_modules/lz-string/tests/lib/jasmine-1.3.1/jasmine.css ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }
2
+
3
+ #HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
4
+ #HTMLReporter a { text-decoration: none; }
5
+ #HTMLReporter a:hover { text-decoration: underline; }
6
+ #HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 { margin: 0; line-height: 14px; }
7
+ #HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace { padding-left: 9px; padding-right: 9px; }
8
+ #HTMLReporter #jasmine_content { position: fixed; right: 100%; }
9
+ #HTMLReporter .version { color: #aaaaaa; }
10
+ #HTMLReporter .banner { margin-top: 14px; }
11
+ #HTMLReporter .duration { color: #aaaaaa; float: right; }
12
+ #HTMLReporter .symbolSummary { overflow: hidden; *zoom: 1; margin: 14px 0; }
13
+ #HTMLReporter .symbolSummary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; }
14
+ #HTMLReporter .symbolSummary li.passed { font-size: 14px; }
15
+ #HTMLReporter .symbolSummary li.passed:before { color: #5e7d00; content: "\02022"; }
16
+ #HTMLReporter .symbolSummary li.failed { line-height: 9px; }
17
+ #HTMLReporter .symbolSummary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; }
18
+ #HTMLReporter .symbolSummary li.skipped { font-size: 14px; }
19
+ #HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; }
20
+ #HTMLReporter .symbolSummary li.pending { line-height: 11px; }
21
+ #HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; }
22
+ #HTMLReporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; }
23
+ #HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
24
+ #HTMLReporter .runningAlert { background-color: #666666; }
25
+ #HTMLReporter .skippedAlert { background-color: #aaaaaa; }
26
+ #HTMLReporter .skippedAlert:first-child { background-color: #333333; }
27
+ #HTMLReporter .skippedAlert:hover { text-decoration: none; color: white; text-decoration: underline; }
28
+ #HTMLReporter .passingAlert { background-color: #a6b779; }
29
+ #HTMLReporter .passingAlert:first-child { background-color: #5e7d00; }
30
+ #HTMLReporter .failingAlert { background-color: #cf867e; }
31
+ #HTMLReporter .failingAlert:first-child { background-color: #b03911; }
32
+ #HTMLReporter .results { margin-top: 14px; }
33
+ #HTMLReporter #details { display: none; }
34
+ #HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a { background-color: #fff; color: #333333; }
35
+ #HTMLReporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
36
+ #HTMLReporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
37
+ #HTMLReporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
38
+ #HTMLReporter.showDetails .summary { display: none; }
39
+ #HTMLReporter.showDetails #details { display: block; }
40
+ #HTMLReporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
41
+ #HTMLReporter .summary { margin-top: 14px; }
42
+ #HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary { margin-left: 14px; }
43
+ #HTMLReporter .summary .specSummary.passed a { color: #5e7d00; }
44
+ #HTMLReporter .summary .specSummary.failed a { color: #b03911; }
45
+ #HTMLReporter .description + .suite { margin-top: 0; }
46
+ #HTMLReporter .suite { margin-top: 14px; }
47
+ #HTMLReporter .suite a { color: #333333; }
48
+ #HTMLReporter #details .specDetail { margin-bottom: 28px; }
49
+ #HTMLReporter #details .specDetail .description { display: block; color: white; background-color: #b03911; }
50
+ #HTMLReporter .resultMessage { padding-top: 14px; color: #333333; }
51
+ #HTMLReporter .resultMessage span.result { display: block; }
52
+ #HTMLReporter .stackTrace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; }
53
+
54
+ #TrivialReporter { padding: 8px 13px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: scroll; background-color: white; font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/ /*white-space: pre;*/ /*}*/ }
55
+ #TrivialReporter a:visited, #TrivialReporter a { color: #303; }
56
+ #TrivialReporter a:hover, #TrivialReporter a:active { color: blue; }
57
+ #TrivialReporter .run_spec { float: right; padding-right: 5px; font-size: .8em; text-decoration: none; }
58
+ #TrivialReporter .banner { color: #303; background-color: #fef; padding: 5px; }
59
+ #TrivialReporter .logo { float: left; font-size: 1.1em; padding-left: 5px; }
60
+ #TrivialReporter .logo .version { font-size: .6em; padding-left: 1em; }
61
+ #TrivialReporter .runner.running { background-color: yellow; }
62
+ #TrivialReporter .options { text-align: right; font-size: .8em; }
63
+ #TrivialReporter .suite { border: 1px outset gray; margin: 5px 0; padding-left: 1em; }
64
+ #TrivialReporter .suite .suite { margin: 5px; }
65
+ #TrivialReporter .suite.passed { background-color: #dfd; }
66
+ #TrivialReporter .suite.failed { background-color: #fdd; }
67
+ #TrivialReporter .spec { margin: 5px; padding-left: 1em; clear: both; }
68
+ #TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped { padding-bottom: 5px; border: 1px solid gray; }
69
+ #TrivialReporter .spec.failed { background-color: #fbb; border-color: red; }
70
+ #TrivialReporter .spec.passed { background-color: #bfb; border-color: green; }
71
+ #TrivialReporter .spec.skipped { background-color: #bbb; }
72
+ #TrivialReporter .messages { border-left: 1px dashed gray; padding-left: 1em; padding-right: 1em; }
73
+ #TrivialReporter .passed { background-color: #cfc; display: none; }
74
+ #TrivialReporter .failed { background-color: #fbb; }
75
+ #TrivialReporter .skipped { color: #777; background-color: #eee; display: none; }
76
+ #TrivialReporter .resultMessage span.result { display: block; line-height: 2em; color: black; }
77
+ #TrivialReporter .resultMessage .mismatch { color: black; }
78
+ #TrivialReporter .stackTrace { white-space: pre; font-size: .8em; margin-left: 10px; max-height: 5em; overflow: auto; border: 1px inset red; padding: 1em; background: #eef; }
79
+ #TrivialReporter .finished-at { padding-left: 1em; font-size: .6em; }
80
+ #TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped { display: block; }
81
+ #TrivialReporter #jasmine_content { position: fixed; right: 100%; }
82
+ #TrivialReporter .runner { border: 1px solid gray; display: block; margin: 5px 0; padding: 2px 0 2px 10px; }