@enmaq/mdgl 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/play.js ADDED
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ // Terminal playback over the pure evaluator (SPEC "Limits and API": play uses absolute
3
+ // elapsed time, dirty cells and DEC synchronized output 2026, stops its timer on finite
4
+ // completion or interrupt; redirected output and reduced motion use the fallback frame).
5
+ // No I/O of its own: the caller injects the writer, clock and interrupt source.
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.RESET = exports.SHOW_CURSOR = exports.HIDE_CURSOR = exports.SYNC_END = exports.SYNC_BEGIN = void 0;
8
+ exports.sanitizeRune = sanitizeRune;
9
+ exports.plainText = plainText;
10
+ exports.plainFallback = plainFallback;
11
+ exports.play = play;
12
+ const eval_1 = require("./eval");
13
+ exports.SYNC_BEGIN = '\x1b[?2026h';
14
+ exports.SYNC_END = '\x1b[?2026l';
15
+ exports.HIDE_CURSOR = '\x1b[?25l';
16
+ exports.SHOW_CURSOR = '\x1b[?25h';
17
+ exports.RESET = '\x1b[0m';
18
+ const FG = { black: 30, red: 31, green: 32, yellow: 33, blue: 34, magenta: 35, cyan: 36, white: 37, accent: 36 };
19
+ /** Never let a cell glyph act as a terminal escape: controls, DEL and C1 become a space. */
20
+ function sanitizeRune(r) {
21
+ const cp = r.codePointAt(0) ?? 32;
22
+ return cp < 0x20 || (cp >= 0x7f && cp <= 0x9f) || cp === 0x2028 || cp === 0x2029 ? ' ' : r;
23
+ }
24
+ function color(c, bg) {
25
+ if (c === '' || c === 'normal')
26
+ return bg ? '49' : '39';
27
+ if (c[0] === '#')
28
+ return `${bg ? 48 : 38};2;${parseInt(c.slice(1, 3), 16)};${parseInt(c.slice(3, 5), 16)};${parseInt(c.slice(5, 7), 16)}`;
29
+ return String((FG[c] ?? 37) + (bg ? 10 : 0));
30
+ }
31
+ const style = (c) => `\x1b[0;${color(c.fg, false)};${color(c.bg, true)}m`;
32
+ const same = (a, b) => a.r === b.r && a.fg === b.fg && a.bg === b.bg;
33
+ /** Plain text of a frame (one row per line, trailing newline); no ANSI. */
34
+ function plainText(cells) {
35
+ return cells.map((row) => row.map((c) => sanitizeRune(c.r)).join('')).join('\n') + '\n';
36
+ }
37
+ /** The fallback frame as plain text, for redirected output and reduced motion. */
38
+ function plainFallback(scene) { return plainText((0, eval_1.fallbackFrame)(scene).cells); }
39
+ /** First frame: all rows, each ended by CRLF, leaving the cursor at column 0 below the frame. */
40
+ function fullDraw(cells) {
41
+ let out = '';
42
+ for (const row of cells) {
43
+ let last = '';
44
+ for (const c of row) {
45
+ const s = style(c);
46
+ if (s !== last) {
47
+ out += s;
48
+ last = s;
49
+ }
50
+ out += sanitizeRune(c.r);
51
+ }
52
+ out += exports.RESET + '\r\n';
53
+ }
54
+ return out;
55
+ }
56
+ /** Changed cells only; the cursor is parked below the frame before and after. */
57
+ function diffDraw(prev, next) {
58
+ const h = next.length;
59
+ let out = '';
60
+ for (let r = 0; r < h; r++) {
61
+ const a = prev[r], b = next[r];
62
+ for (let c = 0; c < b.length;) {
63
+ if (same(a[c], b[c])) {
64
+ c++;
65
+ continue;
66
+ }
67
+ let e = c;
68
+ while (e < b.length && !same(a[e], b[e]))
69
+ e++;
70
+ const up = h - r;
71
+ out += `\x1b[${up}A\x1b[${c + 1}G`;
72
+ let last = '';
73
+ for (let i = c; i < e; i++) {
74
+ const s = style(b[i]);
75
+ if (s !== last) {
76
+ out += s;
77
+ last = s;
78
+ }
79
+ out += sanitizeRune(b[i].r);
80
+ }
81
+ out += exports.RESET + `\x1b[${up}B\r`;
82
+ c = e;
83
+ }
84
+ }
85
+ return out;
86
+ }
87
+ /**
88
+ * Start playback. Frame time is always computed from the monotonic clock (elapsed since start),
89
+ * never accumulated from tick counts, so late timers drop frames without changing state.
90
+ * Finite scenes stop when the evaluator reports done; every exit path clears the timer,
91
+ * unsubscribes listeners and restores the cursor and attributes exactly once.
92
+ */
93
+ function play(scene, deps) {
94
+ const frameMs = 1000 / scene.fps;
95
+ const t0 = deps.clock.now();
96
+ let timer;
97
+ let prev = null;
98
+ let finished = false;
99
+ const unsub = [];
100
+ let resolve;
101
+ const done = new Promise((res) => { resolve = res; });
102
+ const finish = (code, reason, error) => {
103
+ if (finished)
104
+ return;
105
+ finished = true;
106
+ if (timer !== undefined)
107
+ deps.clock.clearTimeout(timer);
108
+ timer = undefined;
109
+ for (const u of unsub.splice(0)) {
110
+ try {
111
+ u();
112
+ }
113
+ catch { /* ignore */ }
114
+ }
115
+ try {
116
+ deps.write(exports.RESET + exports.SHOW_CURSOR);
117
+ }
118
+ catch (e) {
119
+ if (error === undefined)
120
+ error = e;
121
+ }
122
+ resolve(error === undefined ? { code, reason } : { code, reason, error });
123
+ };
124
+ const tick = () => {
125
+ timer = undefined;
126
+ if (finished)
127
+ return;
128
+ const elapsed = deps.clock.now() - t0;
129
+ const f = (0, eval_1.frameNs)(scene, Math.floor(elapsed * 1e6));
130
+ try {
131
+ const body = prev === null ? fullDraw(f.cells) : diffDraw(prev, f.cells);
132
+ if (body !== '' || prev === null)
133
+ deps.write(prev === null ? exports.SYNC_BEGIN + exports.HIDE_CURSOR + body + exports.SYNC_END : exports.SYNC_BEGIN + body + exports.SYNC_END);
134
+ prev = f.cells;
135
+ }
136
+ catch (e) {
137
+ finish(1, 'write-error', e);
138
+ return;
139
+ }
140
+ if (f.done) {
141
+ finish(0, 'done');
142
+ return;
143
+ }
144
+ const next = (Math.floor(elapsed / frameMs) + 1) * frameMs;
145
+ timer = deps.clock.setTimeout(tick, Math.max(1, next - elapsed));
146
+ };
147
+ if (deps.onWriteError)
148
+ unsub.push(deps.onWriteError((e) => finish(1, 'write-error', e)));
149
+ if (deps.onInterrupt)
150
+ unsub.push(deps.onInterrupt((code) => finish(code, 'interrupt')));
151
+ tick();
152
+ return { done, stop: () => finish(0, 'stopped') };
153
+ }
@@ -0,0 +1,7 @@
1
+ export declare const GCB_NAMES: readonly ["Prepend", "CR", "LF", "Control", "Extend", "ZWJ", "Regional_Indicator", "SpacingMark", "L", "V", "T", "LV", "LVT"];
2
+ export declare const GCB: number[];
3
+ export declare const EXT_PICT: number[];
4
+ export declare const WIDE: number[];
5
+ export declare const MARK: number[];
6
+ export declare const IGNORABLE: number[];
7
+ export declare const VS16_BASE: number[];
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VS16_BASE = exports.IGNORABLE = exports.MARK = exports.WIDE = exports.EXT_PICT = exports.GCB = exports.GCB_NAMES = void 0;
4
+ // GENERATED by scripts/gen-unicode.js -- do not edit.
5
+ // Unicode 15.0.0 Character Database + Emoji 15.0 data, fetched from https://www.unicode.org/Public/15.0.0/ucd/.
6
+ // Inputs: GraphemeBreakProperty.txt sha256=5a0f8748575432f8ff95e1dd5bfaa27bda1a844809e17d6939ee912bba6568a1; EastAsianWidth.txt sha256=743e7bc435c04ab1a8459710b1c3cad56eedced5b806b4659b6e69b85d0adf2a; UnicodeData.txt sha256=806e9aed65037197f1ec85e12be6e8cd870fc5608b4de0fffd990f689f376a73; DerivedCoreProperties.txt sha256=d367290bc0867e6b484c68370530bdd1a08b6b32404601b8c7accaf83e05628d; emoji-data.txt sha256=29071dba22c72c27783a73016afb8ffaeb025866740791f9c2d0b55cc45a3470; emoji-variation-sequences.txt sha256=731a630518c4a51c480c407ec10f3476ebe0afc582c7c20c7304f966133cf118.
7
+ // Data (c) 1991-2022 Unicode, Inc. Unicode License V3 (https://www.unicode.org/license.txt); see ts/UNICODE-LICENSE.txt.
8
+ // Flat [start,end,class] triples.
9
+ exports.GCB_NAMES = ["Prepend", "CR", "LF", "Control", "Extend", "ZWJ", "Regional_Indicator", "SpacingMark", "L", "V", "T", "LV", "LVT"];
10
+ exports.GCB = [0, 9, 3, 10, 10, 2, 11, 12, 3, 13, 13, 1, 14, 31, 3, 127, 159, 3, 173, 173, 3, 768, 879, 4, 1155, 1161, 4, 1425, 1469, 4, 1471, 1471, 4, 1473, 1474, 4, 1476, 1477, 4, 1479, 1479, 4, 1536, 1541, 0, 1552, 1562, 4, 1564, 1564, 3, 1611, 1631, 4, 1648, 1648, 4, 1750, 1756, 4, 1757, 1757, 0, 1759, 1764, 4, 1767, 1768, 4, 1770, 1773, 4, 1807, 1807, 0, 1809, 1809, 4, 1840, 1866, 4, 1958, 1968, 4, 2027, 2035, 4, 2045, 2045, 4, 2070, 2073, 4, 2075, 2083, 4, 2085, 2087, 4, 2089, 2093, 4, 2137, 2139, 4, 2192, 2193, 0, 2200, 2207, 4, 2250, 2273, 4, 2274, 2274, 0, 2275, 2306, 4, 2307, 2307, 7, 2362, 2362, 4, 2363, 2363, 7, 2364, 2364, 4, 2366, 2368, 7, 2369, 2376, 4, 2377, 2380, 7, 2381, 2381, 4, 2382, 2383, 7, 2385, 2391, 4, 2402, 2403, 4, 2433, 2433, 4, 2434, 2435, 7, 2492, 2492, 4, 2494, 2494, 4, 2495, 2496, 7, 2497, 2500, 4, 2503, 2504, 7, 2507, 2508, 7, 2509, 2509, 4, 2519, 2519, 4, 2530, 2531, 4, 2558, 2558, 4, 2561, 2562, 4, 2563, 2563, 7, 2620, 2620, 4, 2622, 2624, 7, 2625, 2626, 4, 2631, 2632, 4, 2635, 2637, 4, 2641, 2641, 4, 2672, 2673, 4, 2677, 2677, 4, 2689, 2690, 4, 2691, 2691, 7, 2748, 2748, 4, 2750, 2752, 7, 2753, 2757, 4, 2759, 2760, 4, 2761, 2761, 7, 2763, 2764, 7, 2765, 2765, 4, 2786, 2787, 4, 2810, 2815, 4, 2817, 2817, 4, 2818, 2819, 7, 2876, 2876, 4, 2878, 2879, 4, 2880, 2880, 7, 2881, 2884, 4, 2887, 2888, 7, 2891, 2892, 7, 2893, 2893, 4, 2901, 2903, 4, 2914, 2915, 4, 2946, 2946, 4, 3006, 3006, 4, 3007, 3007, 7, 3008, 3008, 4, 3009, 3010, 7, 3014, 3016, 7, 3018, 3020, 7, 3021, 3021, 4, 3031, 3031, 4, 3072, 3072, 4, 3073, 3075, 7, 3076, 3076, 4, 3132, 3132, 4, 3134, 3136, 4, 3137, 3140, 7, 3142, 3144, 4, 3146, 3149, 4, 3157, 3158, 4, 3170, 3171, 4, 3201, 3201, 4, 3202, 3203, 7, 3260, 3260, 4, 3262, 3262, 7, 3263, 3263, 4, 3264, 3265, 7, 3266, 3266, 4, 3267, 3268, 7, 3270, 3270, 4, 3271, 3272, 7, 3274, 3275, 7, 3276, 3277, 4, 3285, 3286, 4, 3298, 3299, 4, 3315, 3315, 7, 3328, 3329, 4, 3330, 3331, 7, 3387, 3388, 4, 3390, 3390, 4, 3391, 3392, 7, 3393, 3396, 4, 3398, 3400, 7, 3402, 3404, 7, 3405, 3405, 4, 3406, 3406, 0, 3415, 3415, 4, 3426, 3427, 4, 3457, 3457, 4, 3458, 3459, 7, 3530, 3530, 4, 3535, 3535, 4, 3536, 3537, 7, 3538, 3540, 4, 3542, 3542, 4, 3544, 3550, 7, 3551, 3551, 4, 3570, 3571, 7, 3633, 3633, 4, 3635, 3635, 7, 3636, 3642, 4, 3655, 3662, 4, 3761, 3761, 4, 3763, 3763, 7, 3764, 3772, 4, 3784, 3790, 4, 3864, 3865, 4, 3893, 3893, 4, 3895, 3895, 4, 3897, 3897, 4, 3902, 3903, 7, 3953, 3966, 4, 3967, 3967, 7, 3968, 3972, 4, 3974, 3975, 4, 3981, 3991, 4, 3993, 4028, 4, 4038, 4038, 4, 4141, 4144, 4, 4145, 4145, 7, 4146, 4151, 4, 4153, 4154, 4, 4155, 4156, 7, 4157, 4158, 4, 4182, 4183, 7, 4184, 4185, 4, 4190, 4192, 4, 4209, 4212, 4, 4226, 4226, 4, 4228, 4228, 7, 4229, 4230, 4, 4237, 4237, 4, 4253, 4253, 4, 4352, 4447, 8, 4448, 4519, 9, 4520, 4607, 10, 4957, 4959, 4, 5906, 5908, 4, 5909, 5909, 7, 5938, 5939, 4, 5940, 5940, 7, 5970, 5971, 4, 6002, 6003, 4, 6068, 6069, 4, 6070, 6070, 7, 6071, 6077, 4, 6078, 6085, 7, 6086, 6086, 4, 6087, 6088, 7, 6089, 6099, 4, 6109, 6109, 4, 6155, 6157, 4, 6158, 6158, 3, 6159, 6159, 4, 6277, 6278, 4, 6313, 6313, 4, 6432, 6434, 4, 6435, 6438, 7, 6439, 6440, 4, 6441, 6443, 7, 6448, 6449, 7, 6450, 6450, 4, 6451, 6456, 7, 6457, 6459, 4, 6679, 6680, 4, 6681, 6682, 7, 6683, 6683, 4, 6741, 6741, 7, 6742, 6742, 4, 6743, 6743, 7, 6744, 6750, 4, 6752, 6752, 4, 6754, 6754, 4, 6757, 6764, 4, 6765, 6770, 7, 6771, 6780, 4, 6783, 6783, 4, 6832, 6862, 4, 6912, 6915, 4, 6916, 6916, 7, 6964, 6970, 4, 6971, 6971, 7, 6972, 6972, 4, 6973, 6977, 7, 6978, 6978, 4, 6979, 6980, 7, 7019, 7027, 4, 7040, 7041, 4, 7042, 7042, 7, 7073, 7073, 7, 7074, 7077, 4, 7078, 7079, 7, 7080, 7081, 4, 7082, 7082, 7, 7083, 7085, 4, 7142, 7142, 4, 7143, 7143, 7, 7144, 7145, 4, 7146, 7148, 7, 7149, 7149, 4, 7150, 7150, 7, 7151, 7153, 4, 7154, 7155, 7, 7204, 7211, 7, 7212, 7219, 4, 7220, 7221, 7, 7222, 7223, 4, 7376, 7378, 4, 7380, 7392, 4, 7393, 7393, 7, 7394, 7400, 4, 7405, 7405, 4, 7412, 7412, 4, 7415, 7415, 7, 7416, 7417, 4, 7616, 7679, 4, 8203, 8203, 3, 8204, 8204, 4, 8205, 8205, 5, 8206, 8207, 3, 8232, 8238, 3, 8288, 8303, 3, 8400, 8432, 4, 11503, 11505, 4, 11647, 11647, 4, 11744, 11775, 4, 12330, 12335, 4, 12441, 12442, 4, 42607, 42610, 4, 42612, 42621, 4, 42654, 42655, 4, 42736, 42737, 4, 43010, 43010, 4, 43014, 43014, 4, 43019, 43019, 4, 43043, 43044, 7, 43045, 43046, 4, 43047, 43047, 7, 43052, 43052, 4, 43136, 43137, 7, 43188, 43203, 7, 43204, 43205, 4, 43232, 43249, 4, 43263, 43263, 4, 43302, 43309, 4, 43335, 43345, 4, 43346, 43347, 7, 43360, 43388, 8, 43392, 43394, 4, 43395, 43395, 7, 43443, 43443, 4, 43444, 43445, 7, 43446, 43449, 4, 43450, 43451, 7, 43452, 43453, 4, 43454, 43456, 7, 43493, 43493, 4, 43561, 43566, 4, 43567, 43568, 7, 43569, 43570, 4, 43571, 43572, 7, 43573, 43574, 4, 43587, 43587, 4, 43596, 43596, 4, 43597, 43597, 7, 43644, 43644, 4, 43696, 43696, 4, 43698, 43700, 4, 43703, 43704, 4, 43710, 43711, 4, 43713, 43713, 4, 43755, 43755, 7, 43756, 43757, 4, 43758, 43759, 7, 43765, 43765, 7, 43766, 43766, 4, 44003, 44004, 7, 44005, 44005, 4, 44006, 44007, 7, 44008, 44008, 4, 44009, 44010, 7, 44012, 44012, 7, 44013, 44013, 4, 44032, 44032, 11, 44033, 44059, 12, 44060, 44060, 11, 44061, 44087, 12, 44088, 44088, 11, 44089, 44115, 12, 44116, 44116, 11, 44117, 44143, 12, 44144, 44144, 11, 44145, 44171, 12, 44172, 44172, 11, 44173, 44199, 12, 44200, 44200, 11, 44201, 44227, 12, 44228, 44228, 11, 44229, 44255, 12, 44256, 44256, 11, 44257, 44283, 12, 44284, 44284, 11, 44285, 44311, 12, 44312, 44312, 11, 44313, 44339, 12, 44340, 44340, 11, 44341, 44367, 12, 44368, 44368, 11, 44369, 44395, 12, 44396, 44396, 11, 44397, 44423, 12, 44424, 44424, 11, 44425, 44451, 12, 44452, 44452, 11, 44453, 44479, 12, 44480, 44480, 11, 44481, 44507, 12, 44508, 44508, 11, 44509, 44535, 12, 44536, 44536, 11, 44537, 44563, 12, 44564, 44564, 11, 44565, 44591, 12, 44592, 44592, 11, 44593, 44619, 12, 44620, 44620, 11, 44621, 44647, 12, 44648, 44648, 11, 44649, 44675, 12, 44676, 44676, 11, 44677, 44703, 12, 44704, 44704, 11, 44705, 44731, 12, 44732, 44732, 11, 44733, 44759, 12, 44760, 44760, 11, 44761, 44787, 12, 44788, 44788, 11, 44789, 44815, 12, 44816, 44816, 11, 44817, 44843, 12, 44844, 44844, 11, 44845, 44871, 12, 44872, 44872, 11, 44873, 44899, 12, 44900, 44900, 11, 44901, 44927, 12, 44928, 44928, 11, 44929, 44955, 12, 44956, 44956, 11, 44957, 44983, 12, 44984, 44984, 11, 44985, 45011, 12, 45012, 45012, 11, 45013, 45039, 12, 45040, 45040, 11, 45041, 45067, 12, 45068, 45068, 11, 45069, 45095, 12, 45096, 45096, 11, 45097, 45123, 12, 45124, 45124, 11, 45125, 45151, 12, 45152, 45152, 11, 45153, 45179, 12, 45180, 45180, 11, 45181, 45207, 12, 45208, 45208, 11, 45209, 45235, 12, 45236, 45236, 11, 45237, 45263, 12, 45264, 45264, 11, 45265, 45291, 12, 45292, 45292, 11, 45293, 45319, 12, 45320, 45320, 11, 45321, 45347, 12, 45348, 45348, 11, 45349, 45375, 12, 45376, 45376, 11, 45377, 45403, 12, 45404, 45404, 11, 45405, 45431, 12, 45432, 45432, 11, 45433, 45459, 12, 45460, 45460, 11, 45461, 45487, 12, 45488, 45488, 11, 45489, 45515, 12, 45516, 45516, 11, 45517, 45543, 12, 45544, 45544, 11, 45545, 45571, 12, 45572, 45572, 11, 45573, 45599, 12, 45600, 45600, 11, 45601, 45627, 12, 45628, 45628, 11, 45629, 45655, 12, 45656, 45656, 11, 45657, 45683, 12, 45684, 45684, 11, 45685, 45711, 12, 45712, 45712, 11, 45713, 45739, 12, 45740, 45740, 11, 45741, 45767, 12, 45768, 45768, 11, 45769, 45795, 12, 45796, 45796, 11, 45797, 45823, 12, 45824, 45824, 11, 45825, 45851, 12, 45852, 45852, 11, 45853, 45879, 12, 45880, 45880, 11, 45881, 45907, 12, 45908, 45908, 11, 45909, 45935, 12, 45936, 45936, 11, 45937, 45963, 12, 45964, 45964, 11, 45965, 45991, 12, 45992, 45992, 11, 45993, 46019, 12, 46020, 46020, 11, 46021, 46047, 12, 46048, 46048, 11, 46049, 46075, 12, 46076, 46076, 11, 46077, 46103, 12, 46104, 46104, 11, 46105, 46131, 12, 46132, 46132, 11, 46133, 46159, 12, 46160, 46160, 11, 46161, 46187, 12, 46188, 46188, 11, 46189, 46215, 12, 46216, 46216, 11, 46217, 46243, 12, 46244, 46244, 11, 46245, 46271, 12, 46272, 46272, 11, 46273, 46299, 12, 46300, 46300, 11, 46301, 46327, 12, 46328, 46328, 11, 46329, 46355, 12, 46356, 46356, 11, 46357, 46383, 12, 46384, 46384, 11, 46385, 46411, 12, 46412, 46412, 11, 46413, 46439, 12, 46440, 46440, 11, 46441, 46467, 12, 46468, 46468, 11, 46469, 46495, 12, 46496, 46496, 11, 46497, 46523, 12, 46524, 46524, 11, 46525, 46551, 12, 46552, 46552, 11, 46553, 46579, 12, 46580, 46580, 11, 46581, 46607, 12, 46608, 46608, 11, 46609, 46635, 12, 46636, 46636, 11, 46637, 46663, 12, 46664, 46664, 11, 46665, 46691, 12, 46692, 46692, 11, 46693, 46719, 12, 46720, 46720, 11, 46721, 46747, 12, 46748, 46748, 11, 46749, 46775, 12, 46776, 46776, 11, 46777, 46803, 12, 46804, 46804, 11, 46805, 46831, 12, 46832, 46832, 11, 46833, 46859, 12, 46860, 46860, 11, 46861, 46887, 12, 46888, 46888, 11, 46889, 46915, 12, 46916, 46916, 11, 46917, 46943, 12, 46944, 46944, 11, 46945, 46971, 12, 46972, 46972, 11, 46973, 46999, 12, 47000, 47000, 11, 47001, 47027, 12, 47028, 47028, 11, 47029, 47055, 12, 47056, 47056, 11, 47057, 47083, 12, 47084, 47084, 11, 47085, 47111, 12, 47112, 47112, 11, 47113, 47139, 12, 47140, 47140, 11, 47141, 47167, 12, 47168, 47168, 11, 47169, 47195, 12, 47196, 47196, 11, 47197, 47223, 12, 47224, 47224, 11, 47225, 47251, 12, 47252, 47252, 11, 47253, 47279, 12, 47280, 47280, 11, 47281, 47307, 12, 47308, 47308, 11, 47309, 47335, 12, 47336, 47336, 11, 47337, 47363, 12, 47364, 47364, 11, 47365, 47391, 12, 47392, 47392, 11, 47393, 47419, 12, 47420, 47420, 11, 47421, 47447, 12, 47448, 47448, 11, 47449, 47475, 12, 47476, 47476, 11, 47477, 47503, 12, 47504, 47504, 11, 47505, 47531, 12, 47532, 47532, 11, 47533, 47559, 12, 47560, 47560, 11, 47561, 47587, 12, 47588, 47588, 11, 47589, 47615, 12, 47616, 47616, 11, 47617, 47643, 12, 47644, 47644, 11, 47645, 47671, 12, 47672, 47672, 11, 47673, 47699, 12, 47700, 47700, 11, 47701, 47727, 12, 47728, 47728, 11, 47729, 47755, 12, 47756, 47756, 11, 47757, 47783, 12, 47784, 47784, 11, 47785, 47811, 12, 47812, 47812, 11, 47813, 47839, 12, 47840, 47840, 11, 47841, 47867, 12, 47868, 47868, 11, 47869, 47895, 12, 47896, 47896, 11, 47897, 47923, 12, 47924, 47924, 11, 47925, 47951, 12, 47952, 47952, 11, 47953, 47979, 12, 47980, 47980, 11, 47981, 48007, 12, 48008, 48008, 11, 48009, 48035, 12, 48036, 48036, 11, 48037, 48063, 12, 48064, 48064, 11, 48065, 48091, 12, 48092, 48092, 11, 48093, 48119, 12, 48120, 48120, 11, 48121, 48147, 12, 48148, 48148, 11, 48149, 48175, 12, 48176, 48176, 11, 48177, 48203, 12, 48204, 48204, 11, 48205, 48231, 12, 48232, 48232, 11, 48233, 48259, 12, 48260, 48260, 11, 48261, 48287, 12, 48288, 48288, 11, 48289, 48315, 12, 48316, 48316, 11, 48317, 48343, 12, 48344, 48344, 11, 48345, 48371, 12, 48372, 48372, 11, 48373, 48399, 12, 48400, 48400, 11, 48401, 48427, 12, 48428, 48428, 11, 48429, 48455, 12, 48456, 48456, 11, 48457, 48483, 12, 48484, 48484, 11, 48485, 48511, 12, 48512, 48512, 11, 48513, 48539, 12, 48540, 48540, 11, 48541, 48567, 12, 48568, 48568, 11, 48569, 48595, 12, 48596, 48596, 11, 48597, 48623, 12, 48624, 48624, 11, 48625, 48651, 12, 48652, 48652, 11, 48653, 48679, 12, 48680, 48680, 11, 48681, 48707, 12, 48708, 48708, 11, 48709, 48735, 12, 48736, 48736, 11, 48737, 48763, 12, 48764, 48764, 11, 48765, 48791, 12, 48792, 48792, 11, 48793, 48819, 12, 48820, 48820, 11, 48821, 48847, 12, 48848, 48848, 11, 48849, 48875, 12, 48876, 48876, 11, 48877, 48903, 12, 48904, 48904, 11, 48905, 48931, 12, 48932, 48932, 11, 48933, 48959, 12, 48960, 48960, 11, 48961, 48987, 12, 48988, 48988, 11, 48989, 49015, 12, 49016, 49016, 11, 49017, 49043, 12, 49044, 49044, 11, 49045, 49071, 12, 49072, 49072, 11, 49073, 49099, 12, 49100, 49100, 11, 49101, 49127, 12, 49128, 49128, 11, 49129, 49155, 12, 49156, 49156, 11, 49157, 49183, 12, 49184, 49184, 11, 49185, 49211, 12, 49212, 49212, 11, 49213, 49239, 12, 49240, 49240, 11, 49241, 49267, 12, 49268, 49268, 11, 49269, 49295, 12, 49296, 49296, 11, 49297, 49323, 12, 49324, 49324, 11, 49325, 49351, 12, 49352, 49352, 11, 49353, 49379, 12, 49380, 49380, 11, 49381, 49407, 12, 49408, 49408, 11, 49409, 49435, 12, 49436, 49436, 11, 49437, 49463, 12, 49464, 49464, 11, 49465, 49491, 12, 49492, 49492, 11, 49493, 49519, 12, 49520, 49520, 11, 49521, 49547, 12, 49548, 49548, 11, 49549, 49575, 12, 49576, 49576, 11, 49577, 49603, 12, 49604, 49604, 11, 49605, 49631, 12, 49632, 49632, 11, 49633, 49659, 12, 49660, 49660, 11, 49661, 49687, 12, 49688, 49688, 11, 49689, 49715, 12, 49716, 49716, 11, 49717, 49743, 12, 49744, 49744, 11, 49745, 49771, 12, 49772, 49772, 11, 49773, 49799, 12, 49800, 49800, 11, 49801, 49827, 12, 49828, 49828, 11, 49829, 49855, 12, 49856, 49856, 11, 49857, 49883, 12, 49884, 49884, 11, 49885, 49911, 12, 49912, 49912, 11, 49913, 49939, 12, 49940, 49940, 11, 49941, 49967, 12, 49968, 49968, 11, 49969, 49995, 12, 49996, 49996, 11, 49997, 50023, 12, 50024, 50024, 11, 50025, 50051, 12, 50052, 50052, 11, 50053, 50079, 12, 50080, 50080, 11, 50081, 50107, 12, 50108, 50108, 11, 50109, 50135, 12, 50136, 50136, 11, 50137, 50163, 12, 50164, 50164, 11, 50165, 50191, 12, 50192, 50192, 11, 50193, 50219, 12, 50220, 50220, 11, 50221, 50247, 12, 50248, 50248, 11, 50249, 50275, 12, 50276, 50276, 11, 50277, 50303, 12, 50304, 50304, 11, 50305, 50331, 12, 50332, 50332, 11, 50333, 50359, 12, 50360, 50360, 11, 50361, 50387, 12, 50388, 50388, 11, 50389, 50415, 12, 50416, 50416, 11, 50417, 50443, 12, 50444, 50444, 11, 50445, 50471, 12, 50472, 50472, 11, 50473, 50499, 12, 50500, 50500, 11, 50501, 50527, 12, 50528, 50528, 11, 50529, 50555, 12, 50556, 50556, 11, 50557, 50583, 12, 50584, 50584, 11, 50585, 50611, 12, 50612, 50612, 11, 50613, 50639, 12, 50640, 50640, 11, 50641, 50667, 12, 50668, 50668, 11, 50669, 50695, 12, 50696, 50696, 11, 50697, 50723, 12, 50724, 50724, 11, 50725, 50751, 12, 50752, 50752, 11, 50753, 50779, 12, 50780, 50780, 11, 50781, 50807, 12, 50808, 50808, 11, 50809, 50835, 12, 50836, 50836, 11, 50837, 50863, 12, 50864, 50864, 11, 50865, 50891, 12, 50892, 50892, 11, 50893, 50919, 12, 50920, 50920, 11, 50921, 50947, 12, 50948, 50948, 11, 50949, 50975, 12, 50976, 50976, 11, 50977, 51003, 12, 51004, 51004, 11, 51005, 51031, 12, 51032, 51032, 11, 51033, 51059, 12, 51060, 51060, 11, 51061, 51087, 12, 51088, 51088, 11, 51089, 51115, 12, 51116, 51116, 11, 51117, 51143, 12, 51144, 51144, 11, 51145, 51171, 12, 51172, 51172, 11, 51173, 51199, 12, 51200, 51200, 11, 51201, 51227, 12, 51228, 51228, 11, 51229, 51255, 12, 51256, 51256, 11, 51257, 51283, 12, 51284, 51284, 11, 51285, 51311, 12, 51312, 51312, 11, 51313, 51339, 12, 51340, 51340, 11, 51341, 51367, 12, 51368, 51368, 11, 51369, 51395, 12, 51396, 51396, 11, 51397, 51423, 12, 51424, 51424, 11, 51425, 51451, 12, 51452, 51452, 11, 51453, 51479, 12, 51480, 51480, 11, 51481, 51507, 12, 51508, 51508, 11, 51509, 51535, 12, 51536, 51536, 11, 51537, 51563, 12, 51564, 51564, 11, 51565, 51591, 12, 51592, 51592, 11, 51593, 51619, 12, 51620, 51620, 11, 51621, 51647, 12, 51648, 51648, 11, 51649, 51675, 12, 51676, 51676, 11, 51677, 51703, 12, 51704, 51704, 11, 51705, 51731, 12, 51732, 51732, 11, 51733, 51759, 12, 51760, 51760, 11, 51761, 51787, 12, 51788, 51788, 11, 51789, 51815, 12, 51816, 51816, 11, 51817, 51843, 12, 51844, 51844, 11, 51845, 51871, 12, 51872, 51872, 11, 51873, 51899, 12, 51900, 51900, 11, 51901, 51927, 12, 51928, 51928, 11, 51929, 51955, 12, 51956, 51956, 11, 51957, 51983, 12, 51984, 51984, 11, 51985, 52011, 12, 52012, 52012, 11, 52013, 52039, 12, 52040, 52040, 11, 52041, 52067, 12, 52068, 52068, 11, 52069, 52095, 12, 52096, 52096, 11, 52097, 52123, 12, 52124, 52124, 11, 52125, 52151, 12, 52152, 52152, 11, 52153, 52179, 12, 52180, 52180, 11, 52181, 52207, 12, 52208, 52208, 11, 52209, 52235, 12, 52236, 52236, 11, 52237, 52263, 12, 52264, 52264, 11, 52265, 52291, 12, 52292, 52292, 11, 52293, 52319, 12, 52320, 52320, 11, 52321, 52347, 12, 52348, 52348, 11, 52349, 52375, 12, 52376, 52376, 11, 52377, 52403, 12, 52404, 52404, 11, 52405, 52431, 12, 52432, 52432, 11, 52433, 52459, 12, 52460, 52460, 11, 52461, 52487, 12, 52488, 52488, 11, 52489, 52515, 12, 52516, 52516, 11, 52517, 52543, 12, 52544, 52544, 11, 52545, 52571, 12, 52572, 52572, 11, 52573, 52599, 12, 52600, 52600, 11, 52601, 52627, 12, 52628, 52628, 11, 52629, 52655, 12, 52656, 52656, 11, 52657, 52683, 12, 52684, 52684, 11, 52685, 52711, 12, 52712, 52712, 11, 52713, 52739, 12, 52740, 52740, 11, 52741, 52767, 12, 52768, 52768, 11, 52769, 52795, 12, 52796, 52796, 11, 52797, 52823, 12, 52824, 52824, 11, 52825, 52851, 12, 52852, 52852, 11, 52853, 52879, 12, 52880, 52880, 11, 52881, 52907, 12, 52908, 52908, 11, 52909, 52935, 12, 52936, 52936, 11, 52937, 52963, 12, 52964, 52964, 11, 52965, 52991, 12, 52992, 52992, 11, 52993, 53019, 12, 53020, 53020, 11, 53021, 53047, 12, 53048, 53048, 11, 53049, 53075, 12, 53076, 53076, 11, 53077, 53103, 12, 53104, 53104, 11, 53105, 53131, 12, 53132, 53132, 11, 53133, 53159, 12, 53160, 53160, 11, 53161, 53187, 12, 53188, 53188, 11, 53189, 53215, 12, 53216, 53216, 11, 53217, 53243, 12, 53244, 53244, 11, 53245, 53271, 12, 53272, 53272, 11, 53273, 53299, 12, 53300, 53300, 11, 53301, 53327, 12, 53328, 53328, 11, 53329, 53355, 12, 53356, 53356, 11, 53357, 53383, 12, 53384, 53384, 11, 53385, 53411, 12, 53412, 53412, 11, 53413, 53439, 12, 53440, 53440, 11, 53441, 53467, 12, 53468, 53468, 11, 53469, 53495, 12, 53496, 53496, 11, 53497, 53523, 12, 53524, 53524, 11, 53525, 53551, 12, 53552, 53552, 11, 53553, 53579, 12, 53580, 53580, 11, 53581, 53607, 12, 53608, 53608, 11, 53609, 53635, 12, 53636, 53636, 11, 53637, 53663, 12, 53664, 53664, 11, 53665, 53691, 12, 53692, 53692, 11, 53693, 53719, 12, 53720, 53720, 11, 53721, 53747, 12, 53748, 53748, 11, 53749, 53775, 12, 53776, 53776, 11, 53777, 53803, 12, 53804, 53804, 11, 53805, 53831, 12, 53832, 53832, 11, 53833, 53859, 12, 53860, 53860, 11, 53861, 53887, 12, 53888, 53888, 11, 53889, 53915, 12, 53916, 53916, 11, 53917, 53943, 12, 53944, 53944, 11, 53945, 53971, 12, 53972, 53972, 11, 53973, 53999, 12, 54000, 54000, 11, 54001, 54027, 12, 54028, 54028, 11, 54029, 54055, 12, 54056, 54056, 11, 54057, 54083, 12, 54084, 54084, 11, 54085, 54111, 12, 54112, 54112, 11, 54113, 54139, 12, 54140, 54140, 11, 54141, 54167, 12, 54168, 54168, 11, 54169, 54195, 12, 54196, 54196, 11, 54197, 54223, 12, 54224, 54224, 11, 54225, 54251, 12, 54252, 54252, 11, 54253, 54279, 12, 54280, 54280, 11, 54281, 54307, 12, 54308, 54308, 11, 54309, 54335, 12, 54336, 54336, 11, 54337, 54363, 12, 54364, 54364, 11, 54365, 54391, 12, 54392, 54392, 11, 54393, 54419, 12, 54420, 54420, 11, 54421, 54447, 12, 54448, 54448, 11, 54449, 54475, 12, 54476, 54476, 11, 54477, 54503, 12, 54504, 54504, 11, 54505, 54531, 12, 54532, 54532, 11, 54533, 54559, 12, 54560, 54560, 11, 54561, 54587, 12, 54588, 54588, 11, 54589, 54615, 12, 54616, 54616, 11, 54617, 54643, 12, 54644, 54644, 11, 54645, 54671, 12, 54672, 54672, 11, 54673, 54699, 12, 54700, 54700, 11, 54701, 54727, 12, 54728, 54728, 11, 54729, 54755, 12, 54756, 54756, 11, 54757, 54783, 12, 54784, 54784, 11, 54785, 54811, 12, 54812, 54812, 11, 54813, 54839, 12, 54840, 54840, 11, 54841, 54867, 12, 54868, 54868, 11, 54869, 54895, 12, 54896, 54896, 11, 54897, 54923, 12, 54924, 54924, 11, 54925, 54951, 12, 54952, 54952, 11, 54953, 54979, 12, 54980, 54980, 11, 54981, 55007, 12, 55008, 55008, 11, 55009, 55035, 12, 55036, 55036, 11, 55037, 55063, 12, 55064, 55064, 11, 55065, 55091, 12, 55092, 55092, 11, 55093, 55119, 12, 55120, 55120, 11, 55121, 55147, 12, 55148, 55148, 11, 55149, 55175, 12, 55176, 55176, 11, 55177, 55203, 12, 55216, 55238, 9, 55243, 55291, 10, 64286, 64286, 4, 65024, 65039, 4, 65056, 65071, 4, 65279, 65279, 3, 65438, 65439, 4, 65520, 65531, 3, 66045, 66045, 4, 66272, 66272, 4, 66422, 66426, 4, 68097, 68099, 4, 68101, 68102, 4, 68108, 68111, 4, 68152, 68154, 4, 68159, 68159, 4, 68325, 68326, 4, 68900, 68903, 4, 69291, 69292, 4, 69373, 69375, 4, 69446, 69456, 4, 69506, 69509, 4, 69632, 69632, 7, 69633, 69633, 4, 69634, 69634, 7, 69688, 69702, 4, 69744, 69744, 4, 69747, 69748, 4, 69759, 69761, 4, 69762, 69762, 7, 69808, 69810, 7, 69811, 69814, 4, 69815, 69816, 7, 69817, 69818, 4, 69821, 69821, 0, 69826, 69826, 4, 69837, 69837, 0, 69888, 69890, 4, 69927, 69931, 4, 69932, 69932, 7, 69933, 69940, 4, 69957, 69958, 7, 70003, 70003, 4, 70016, 70017, 4, 70018, 70018, 7, 70067, 70069, 7, 70070, 70078, 4, 70079, 70080, 7, 70082, 70083, 0, 70089, 70092, 4, 70094, 70094, 7, 70095, 70095, 4, 70188, 70190, 7, 70191, 70193, 4, 70194, 70195, 7, 70196, 70196, 4, 70197, 70197, 7, 70198, 70199, 4, 70206, 70206, 4, 70209, 70209, 4, 70367, 70367, 4, 70368, 70370, 7, 70371, 70378, 4, 70400, 70401, 4, 70402, 70403, 7, 70459, 70460, 4, 70462, 70462, 4, 70463, 70463, 7, 70464, 70464, 4, 70465, 70468, 7, 70471, 70472, 7, 70475, 70477, 7, 70487, 70487, 4, 70498, 70499, 7, 70502, 70508, 4, 70512, 70516, 4, 70709, 70711, 7, 70712, 70719, 4, 70720, 70721, 7, 70722, 70724, 4, 70725, 70725, 7, 70726, 70726, 4, 70750, 70750, 4, 70832, 70832, 4, 70833, 70834, 7, 70835, 70840, 4, 70841, 70841, 7, 70842, 70842, 4, 70843, 70844, 7, 70845, 70845, 4, 70846, 70846, 7, 70847, 70848, 4, 70849, 70849, 7, 70850, 70851, 4, 71087, 71087, 4, 71088, 71089, 7, 71090, 71093, 4, 71096, 71099, 7, 71100, 71101, 4, 71102, 71102, 7, 71103, 71104, 4, 71132, 71133, 4, 71216, 71218, 7, 71219, 71226, 4, 71227, 71228, 7, 71229, 71229, 4, 71230, 71230, 7, 71231, 71232, 4, 71339, 71339, 4, 71340, 71340, 7, 71341, 71341, 4, 71342, 71343, 7, 71344, 71349, 4, 71350, 71350, 7, 71351, 71351, 4, 71453, 71455, 4, 71458, 71461, 4, 71462, 71462, 7, 71463, 71467, 4, 71724, 71726, 7, 71727, 71735, 4, 71736, 71736, 7, 71737, 71738, 4, 71984, 71984, 4, 71985, 71989, 7, 71991, 71992, 7, 71995, 71996, 4, 71997, 71997, 7, 71998, 71998, 4, 71999, 71999, 0, 72000, 72000, 7, 72001, 72001, 0, 72002, 72002, 7, 72003, 72003, 4, 72145, 72147, 7, 72148, 72151, 4, 72154, 72155, 4, 72156, 72159, 7, 72160, 72160, 4, 72164, 72164, 7, 72193, 72202, 4, 72243, 72248, 4, 72249, 72249, 7, 72250, 72250, 0, 72251, 72254, 4, 72263, 72263, 4, 72273, 72278, 4, 72279, 72280, 7, 72281, 72283, 4, 72324, 72329, 0, 72330, 72342, 4, 72343, 72343, 7, 72344, 72345, 4, 72751, 72751, 7, 72752, 72758, 4, 72760, 72765, 4, 72766, 72766, 7, 72767, 72767, 4, 72850, 72871, 4, 72873, 72873, 7, 72874, 72880, 4, 72881, 72881, 7, 72882, 72883, 4, 72884, 72884, 7, 72885, 72886, 4, 73009, 73014, 4, 73018, 73018, 4, 73020, 73021, 4, 73023, 73029, 4, 73030, 73030, 0, 73031, 73031, 4, 73098, 73102, 7, 73104, 73105, 4, 73107, 73108, 7, 73109, 73109, 4, 73110, 73110, 7, 73111, 73111, 4, 73459, 73460, 4, 73461, 73462, 7, 73472, 73473, 4, 73474, 73474, 0, 73475, 73475, 7, 73524, 73525, 7, 73526, 73530, 4, 73534, 73535, 7, 73536, 73536, 4, 73537, 73537, 7, 73538, 73538, 4, 78896, 78911, 3, 78912, 78912, 4, 78919, 78933, 4, 92912, 92916, 4, 92976, 92982, 4, 94031, 94031, 4, 94033, 94087, 7, 94095, 94098, 4, 94180, 94180, 4, 94192, 94193, 7, 113821, 113822, 4, 113824, 113827, 3, 118528, 118573, 4, 118576, 118598, 4, 119141, 119141, 4, 119142, 119142, 7, 119143, 119145, 4, 119149, 119149, 7, 119150, 119154, 4, 119155, 119162, 3, 119163, 119170, 4, 119173, 119179, 4, 119210, 119213, 4, 119362, 119364, 4, 121344, 121398, 4, 121403, 121452, 4, 121461, 121461, 4, 121476, 121476, 4, 121499, 121503, 4, 121505, 121519, 4, 122880, 122886, 4, 122888, 122904, 4, 122907, 122913, 4, 122915, 122916, 4, 122918, 122922, 4, 123023, 123023, 4, 123184, 123190, 4, 123566, 123566, 4, 123628, 123631, 4, 124140, 124143, 4, 125136, 125142, 4, 125252, 125258, 4, 127462, 127487, 6, 127995, 127999, 4, 917504, 917535, 3, 917536, 917631, 4, 917632, 917759, 3, 917760, 917999, 4, 918000, 921599, 3];
11
+ exports.EXT_PICT = [169, 169, 0, 174, 174, 0, 8252, 8252, 0, 8265, 8265, 0, 8482, 8482, 0, 8505, 8505, 0, 8596, 8601, 0, 8617, 8618, 0, 8986, 8987, 0, 9000, 9000, 0, 9096, 9096, 0, 9167, 9167, 0, 9193, 9203, 0, 9208, 9210, 0, 9410, 9410, 0, 9642, 9643, 0, 9654, 9654, 0, 9664, 9664, 0, 9723, 9726, 0, 9728, 9733, 0, 9735, 9746, 0, 9748, 9861, 0, 9872, 9989, 0, 9992, 10002, 0, 10004, 10004, 0, 10006, 10006, 0, 10013, 10013, 0, 10017, 10017, 0, 10024, 10024, 0, 10035, 10036, 0, 10052, 10052, 0, 10055, 10055, 0, 10060, 10060, 0, 10062, 10062, 0, 10067, 10069, 0, 10071, 10071, 0, 10083, 10087, 0, 10133, 10135, 0, 10145, 10145, 0, 10160, 10160, 0, 10175, 10175, 0, 10548, 10549, 0, 11013, 11015, 0, 11035, 11036, 0, 11088, 11088, 0, 11093, 11093, 0, 12336, 12336, 0, 12349, 12349, 0, 12951, 12951, 0, 12953, 12953, 0, 126976, 127231, 0, 127245, 127247, 0, 127279, 127279, 0, 127340, 127345, 0, 127358, 127359, 0, 127374, 127374, 0, 127377, 127386, 0, 127405, 127461, 0, 127489, 127503, 0, 127514, 127514, 0, 127535, 127535, 0, 127538, 127546, 0, 127548, 127551, 0, 127561, 127994, 0, 128000, 128317, 0, 128326, 128591, 0, 128640, 128767, 0, 128884, 128895, 0, 128981, 129023, 0, 129036, 129039, 0, 129096, 129103, 0, 129114, 129119, 0, 129160, 129167, 0, 129198, 129279, 0, 129292, 129338, 0, 129340, 129349, 0, 129351, 129791, 0, 130048, 131069, 0];
12
+ exports.WIDE = [4352, 4447, 0, 8986, 8987, 0, 9001, 9002, 0, 9193, 9196, 0, 9200, 9200, 0, 9203, 9203, 0, 9725, 9726, 0, 9748, 9749, 0, 9800, 9811, 0, 9855, 9855, 0, 9875, 9875, 0, 9889, 9889, 0, 9898, 9899, 0, 9917, 9918, 0, 9924, 9925, 0, 9934, 9934, 0, 9940, 9940, 0, 9962, 9962, 0, 9970, 9971, 0, 9973, 9973, 0, 9978, 9978, 0, 9981, 9981, 0, 9989, 9989, 0, 9994, 9995, 0, 10024, 10024, 0, 10060, 10060, 0, 10062, 10062, 0, 10067, 10069, 0, 10071, 10071, 0, 10133, 10135, 0, 10160, 10160, 0, 10175, 10175, 0, 11035, 11036, 0, 11088, 11088, 0, 11093, 11093, 0, 11904, 11929, 0, 11931, 12019, 0, 12032, 12245, 0, 12272, 12283, 0, 12288, 12350, 0, 12353, 12438, 0, 12441, 12543, 0, 12549, 12591, 0, 12593, 12686, 0, 12688, 12771, 0, 12784, 12830, 0, 12832, 12871, 0, 12880, 19903, 0, 19968, 42124, 0, 42128, 42182, 0, 43360, 43388, 0, 44032, 55203, 0, 63744, 64255, 0, 65040, 65049, 0, 65072, 65106, 0, 65108, 65126, 0, 65128, 65131, 0, 65281, 65376, 0, 65504, 65510, 0, 94176, 94180, 0, 94192, 94193, 0, 94208, 100343, 0, 100352, 101589, 0, 101632, 101640, 0, 110576, 110579, 0, 110581, 110587, 0, 110589, 110590, 0, 110592, 110882, 0, 110898, 110898, 0, 110928, 110930, 0, 110933, 110933, 0, 110948, 110951, 0, 110960, 111355, 0, 126980, 126980, 0, 127183, 127183, 0, 127374, 127374, 0, 127377, 127386, 0, 127488, 127490, 0, 127504, 127547, 0, 127552, 127560, 0, 127568, 127569, 0, 127584, 127589, 0, 127744, 127776, 0, 127789, 127797, 0, 127799, 127868, 0, 127870, 127891, 0, 127904, 127946, 0, 127951, 127955, 0, 127968, 127984, 0, 127988, 127988, 0, 127992, 128062, 0, 128064, 128064, 0, 128066, 128252, 0, 128255, 128317, 0, 128331, 128334, 0, 128336, 128359, 0, 128378, 128378, 0, 128405, 128406, 0, 128420, 128420, 0, 128507, 128591, 0, 128640, 128709, 0, 128716, 128716, 0, 128720, 128722, 0, 128725, 128727, 0, 128732, 128735, 0, 128747, 128748, 0, 128756, 128764, 0, 128992, 129003, 0, 129008, 129008, 0, 129292, 129338, 0, 129340, 129349, 0, 129351, 129535, 0, 129648, 129660, 0, 129664, 129672, 0, 129680, 129725, 0, 129727, 129733, 0, 129742, 129755, 0, 129760, 129768, 0, 129776, 129784, 0, 131072, 196605, 0, 196608, 262141, 0];
13
+ exports.MARK = [768, 879, 0, 1155, 1161, 0, 1425, 1469, 0, 1471, 1471, 0, 1473, 1474, 0, 1476, 1477, 0, 1479, 1479, 0, 1552, 1562, 0, 1611, 1631, 0, 1648, 1648, 0, 1750, 1756, 0, 1759, 1764, 0, 1767, 1768, 0, 1770, 1773, 0, 1809, 1809, 0, 1840, 1866, 0, 1958, 1968, 0, 2027, 2035, 0, 2045, 2045, 0, 2070, 2073, 0, 2075, 2083, 0, 2085, 2087, 0, 2089, 2093, 0, 2137, 2139, 0, 2200, 2207, 0, 2250, 2273, 0, 2275, 2307, 0, 2362, 2364, 0, 2366, 2383, 0, 2385, 2391, 0, 2402, 2403, 0, 2433, 2435, 0, 2492, 2492, 0, 2494, 2500, 0, 2503, 2504, 0, 2507, 2509, 0, 2519, 2519, 0, 2530, 2531, 0, 2558, 2558, 0, 2561, 2563, 0, 2620, 2620, 0, 2622, 2626, 0, 2631, 2632, 0, 2635, 2637, 0, 2641, 2641, 0, 2672, 2673, 0, 2677, 2677, 0, 2689, 2691, 0, 2748, 2748, 0, 2750, 2757, 0, 2759, 2761, 0, 2763, 2765, 0, 2786, 2787, 0, 2810, 2815, 0, 2817, 2819, 0, 2876, 2876, 0, 2878, 2884, 0, 2887, 2888, 0, 2891, 2893, 0, 2901, 2903, 0, 2914, 2915, 0, 2946, 2946, 0, 3006, 3010, 0, 3014, 3016, 0, 3018, 3021, 0, 3031, 3031, 0, 3072, 3076, 0, 3132, 3132, 0, 3134, 3140, 0, 3142, 3144, 0, 3146, 3149, 0, 3157, 3158, 0, 3170, 3171, 0, 3201, 3203, 0, 3260, 3260, 0, 3262, 3268, 0, 3270, 3272, 0, 3274, 3277, 0, 3285, 3286, 0, 3298, 3299, 0, 3315, 3315, 0, 3328, 3331, 0, 3387, 3388, 0, 3390, 3396, 0, 3398, 3400, 0, 3402, 3405, 0, 3415, 3415, 0, 3426, 3427, 0, 3457, 3459, 0, 3530, 3530, 0, 3535, 3540, 0, 3542, 3542, 0, 3544, 3551, 0, 3570, 3571, 0, 3633, 3633, 0, 3636, 3642, 0, 3655, 3662, 0, 3761, 3761, 0, 3764, 3772, 0, 3784, 3790, 0, 3864, 3865, 0, 3893, 3893, 0, 3895, 3895, 0, 3897, 3897, 0, 3902, 3903, 0, 3953, 3972, 0, 3974, 3975, 0, 3981, 3991, 0, 3993, 4028, 0, 4038, 4038, 0, 4139, 4158, 0, 4182, 4185, 0, 4190, 4192, 0, 4194, 4196, 0, 4199, 4205, 0, 4209, 4212, 0, 4226, 4237, 0, 4239, 4239, 0, 4250, 4253, 0, 4957, 4959, 0, 5906, 5909, 0, 5938, 5940, 0, 5970, 5971, 0, 6002, 6003, 0, 6068, 6099, 0, 6109, 6109, 0, 6155, 6157, 0, 6159, 6159, 0, 6277, 6278, 0, 6313, 6313, 0, 6432, 6443, 0, 6448, 6459, 0, 6679, 6683, 0, 6741, 6750, 0, 6752, 6780, 0, 6783, 6783, 0, 6832, 6862, 0, 6912, 6916, 0, 6964, 6980, 0, 7019, 7027, 0, 7040, 7042, 0, 7073, 7085, 0, 7142, 7155, 0, 7204, 7223, 0, 7376, 7378, 0, 7380, 7400, 0, 7405, 7405, 0, 7412, 7412, 0, 7415, 7417, 0, 7616, 7679, 0, 8400, 8432, 0, 11503, 11505, 0, 11647, 11647, 0, 11744, 11775, 0, 12330, 12335, 0, 12441, 12442, 0, 42607, 42610, 0, 42612, 42621, 0, 42654, 42655, 0, 42736, 42737, 0, 43010, 43010, 0, 43014, 43014, 0, 43019, 43019, 0, 43043, 43047, 0, 43052, 43052, 0, 43136, 43137, 0, 43188, 43205, 0, 43232, 43249, 0, 43263, 43263, 0, 43302, 43309, 0, 43335, 43347, 0, 43392, 43395, 0, 43443, 43456, 0, 43493, 43493, 0, 43561, 43574, 0, 43587, 43587, 0, 43596, 43597, 0, 43643, 43645, 0, 43696, 43696, 0, 43698, 43700, 0, 43703, 43704, 0, 43710, 43711, 0, 43713, 43713, 0, 43755, 43759, 0, 43765, 43766, 0, 44003, 44010, 0, 44012, 44013, 0, 64286, 64286, 0, 65024, 65039, 0, 65056, 65071, 0, 66045, 66045, 0, 66272, 66272, 0, 66422, 66426, 0, 68097, 68099, 0, 68101, 68102, 0, 68108, 68111, 0, 68152, 68154, 0, 68159, 68159, 0, 68325, 68326, 0, 68900, 68903, 0, 69291, 69292, 0, 69373, 69375, 0, 69446, 69456, 0, 69506, 69509, 0, 69632, 69634, 0, 69688, 69702, 0, 69744, 69744, 0, 69747, 69748, 0, 69759, 69762, 0, 69808, 69818, 0, 69826, 69826, 0, 69888, 69890, 0, 69927, 69940, 0, 69957, 69958, 0, 70003, 70003, 0, 70016, 70018, 0, 70067, 70080, 0, 70089, 70092, 0, 70094, 70095, 0, 70188, 70199, 0, 70206, 70206, 0, 70209, 70209, 0, 70367, 70378, 0, 70400, 70403, 0, 70459, 70460, 0, 70462, 70468, 0, 70471, 70472, 0, 70475, 70477, 0, 70487, 70487, 0, 70498, 70499, 0, 70502, 70508, 0, 70512, 70516, 0, 70709, 70726, 0, 70750, 70750, 0, 70832, 70851, 0, 71087, 71093, 0, 71096, 71104, 0, 71132, 71133, 0, 71216, 71232, 0, 71339, 71351, 0, 71453, 71467, 0, 71724, 71738, 0, 71984, 71989, 0, 71991, 71992, 0, 71995, 71998, 0, 72000, 72000, 0, 72002, 72003, 0, 72145, 72151, 0, 72154, 72160, 0, 72164, 72164, 0, 72193, 72202, 0, 72243, 72249, 0, 72251, 72254, 0, 72263, 72263, 0, 72273, 72283, 0, 72330, 72345, 0, 72751, 72758, 0, 72760, 72767, 0, 72850, 72871, 0, 72873, 72886, 0, 73009, 73014, 0, 73018, 73018, 0, 73020, 73021, 0, 73023, 73029, 0, 73031, 73031, 0, 73098, 73102, 0, 73104, 73105, 0, 73107, 73111, 0, 73459, 73462, 0, 73472, 73473, 0, 73475, 73475, 0, 73524, 73530, 0, 73534, 73538, 0, 78912, 78912, 0, 78919, 78933, 0, 92912, 92916, 0, 92976, 92982, 0, 94031, 94031, 0, 94033, 94087, 0, 94095, 94098, 0, 94180, 94180, 0, 94192, 94193, 0, 113821, 113822, 0, 118528, 118573, 0, 118576, 118598, 0, 119141, 119145, 0, 119149, 119154, 0, 119163, 119170, 0, 119173, 119179, 0, 119210, 119213, 0, 119362, 119364, 0, 121344, 121398, 0, 121403, 121452, 0, 121461, 121461, 0, 121476, 121476, 0, 121499, 121503, 0, 121505, 121519, 0, 122880, 122886, 0, 122888, 122904, 0, 122907, 122913, 0, 122915, 122916, 0, 122918, 122922, 0, 123023, 123023, 0, 123184, 123190, 0, 123566, 123566, 0, 123628, 123631, 0, 124140, 124143, 0, 125136, 125142, 0, 125252, 125258, 0, 917760, 917999, 0];
14
+ exports.IGNORABLE = [173, 173, 0, 847, 847, 0, 1564, 1564, 0, 4447, 4448, 0, 6068, 6069, 0, 6155, 6159, 0, 8203, 8207, 0, 8234, 8238, 0, 8288, 8303, 0, 12644, 12644, 0, 65024, 65039, 0, 65279, 65279, 0, 65440, 65440, 0, 65520, 65528, 0, 113824, 113827, 0, 119155, 119162, 0, 917504, 921599, 0];
15
+ exports.VS16_BASE = [35, 35, 0, 42, 42, 0, 48, 57, 0, 169, 169, 0, 174, 174, 0, 8252, 8252, 0, 8265, 8265, 0, 8482, 8482, 0, 8505, 8505, 0, 8596, 8601, 0, 8617, 8618, 0, 8986, 8987, 0, 9000, 9000, 0, 9167, 9167, 0, 9193, 9194, 0, 9197, 9199, 0, 9201, 9203, 0, 9208, 9210, 0, 9410, 9410, 0, 9642, 9643, 0, 9654, 9654, 0, 9664, 9664, 0, 9723, 9726, 0, 9728, 9732, 0, 9742, 9742, 0, 9745, 9745, 0, 9748, 9749, 0, 9752, 9752, 0, 9757, 9757, 0, 9760, 9760, 0, 9762, 9763, 0, 9766, 9766, 0, 9770, 9770, 0, 9774, 9775, 0, 9784, 9786, 0, 9792, 9792, 0, 9794, 9794, 0, 9800, 9811, 0, 9823, 9824, 0, 9827, 9827, 0, 9829, 9830, 0, 9832, 9832, 0, 9851, 9851, 0, 9854, 9855, 0, 9874, 9879, 0, 9881, 9881, 0, 9883, 9884, 0, 9888, 9889, 0, 9895, 9895, 0, 9898, 9899, 0, 9904, 9905, 0, 9917, 9918, 0, 9924, 9925, 0, 9928, 9928, 0, 9935, 9935, 0, 9937, 9937, 0, 9939, 9940, 0, 9961, 9962, 0, 9968, 9973, 0, 9975, 9978, 0, 9981, 9981, 0, 9986, 9986, 0, 9992, 9993, 0, 9996, 9997, 0, 9999, 9999, 0, 10002, 10002, 0, 10004, 10004, 0, 10006, 10006, 0, 10013, 10013, 0, 10017, 10017, 0, 10035, 10036, 0, 10052, 10052, 0, 10055, 10055, 0, 10067, 10067, 0, 10071, 10071, 0, 10083, 10084, 0, 10145, 10145, 0, 10548, 10549, 0, 11013, 11015, 0, 11035, 11036, 0, 11088, 11088, 0, 11093, 11093, 0, 12336, 12336, 0, 12349, 12349, 0, 12951, 12951, 0, 12953, 12953, 0, 126980, 126980, 0, 127344, 127345, 0, 127358, 127359, 0, 127490, 127490, 0, 127514, 127514, 0, 127535, 127535, 0, 127543, 127543, 0, 127757, 127759, 0, 127765, 127765, 0, 127772, 127772, 0, 127777, 127777, 0, 127780, 127788, 0, 127798, 127798, 0, 127864, 127864, 0, 127869, 127869, 0, 127891, 127891, 0, 127894, 127895, 0, 127897, 127899, 0, 127902, 127903, 0, 127911, 127911, 0, 127916, 127918, 0, 127938, 127938, 0, 127940, 127940, 0, 127942, 127942, 0, 127946, 127950, 0, 127956, 127968, 0, 127981, 127981, 0, 127987, 127987, 0, 127989, 127989, 0, 127991, 127991, 0, 128008, 128008, 0, 128021, 128021, 0, 128031, 128031, 0, 128038, 128038, 0, 128063, 128063, 0, 128065, 128066, 0, 128070, 128073, 0, 128077, 128078, 0, 128083, 128083, 0, 128106, 128106, 0, 128125, 128125, 0, 128163, 128163, 0, 128176, 128176, 0, 128179, 128179, 0, 128187, 128187, 0, 128191, 128191, 0, 128203, 128203, 0, 128218, 128218, 0, 128223, 128223, 0, 128228, 128230, 0, 128234, 128237, 0, 128247, 128247, 0, 128249, 128251, 0, 128253, 128253, 0, 128264, 128264, 0, 128269, 128269, 0, 128274, 128275, 0, 128329, 128330, 0, 128336, 128359, 0, 128367, 128368, 0, 128371, 128377, 0, 128391, 128391, 0, 128394, 128397, 0, 128400, 128400, 0, 128421, 128421, 0, 128424, 128424, 0, 128433, 128434, 0, 128444, 128444, 0, 128450, 128452, 0, 128465, 128467, 0, 128476, 128478, 0, 128481, 128481, 0, 128483, 128483, 0, 128488, 128488, 0, 128495, 128495, 0, 128499, 128499, 0, 128506, 128506, 0, 128528, 128528, 0, 128647, 128647, 0, 128653, 128653, 0, 128657, 128657, 0, 128660, 128660, 0, 128664, 128664, 0, 128685, 128685, 0, 128690, 128690, 0, 128697, 128698, 0, 128700, 128700, 0, 128715, 128715, 0, 128717, 128719, 0, 128736, 128741, 0, 128745, 128745, 0, 128752, 128752, 0, 128755, 128755, 0];
@@ -0,0 +1,12 @@
1
+ export declare const UNICODE_VERSION = "15.0.0";
2
+ /** Cluster boundaries as UTF-16 index pairs [start, end). */
3
+ export declare function graphemeRanges(s: string): Array<[number, number]>;
4
+ export declare function graphemes(s: string): string[];
5
+ export declare function graphemeCount(s: string): number;
6
+ export declare const isMark: (cp: number) => boolean;
7
+ export declare const isWide: (cp: number) => boolean;
8
+ export declare const isIgnorable: (cp: number) => boolean;
9
+ /** Terminal width of one cluster: 0 (only marks / default-ignorable / format characters), 2 (first non-mark rune East Asian W/F or a regional indicator, or an emoji-style VS16/keycap sequence), else 1. */
10
+ export declare function clusterWidth(cluster: string): 0 | 1 | 2;
11
+ /** SPEC Cells: the first non-mark rune of a cluster (even if zero-width Cf/default-ignorable); U+FFFD when the cluster is wider than one cell; a blank only for an all-mark cluster. Every cluster consumes exactly one cell, so later cells never shift. */
12
+ export declare function cellRune(cluster: string): string;
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isIgnorable = exports.isWide = exports.isMark = exports.UNICODE_VERSION = void 0;
4
+ exports.graphemeRanges = graphemeRanges;
5
+ exports.graphemes = graphemes;
6
+ exports.graphemeCount = graphemeCount;
7
+ exports.clusterWidth = clusterWidth;
8
+ exports.cellRune = cellRune;
9
+ // Pinned Unicode compatibility profile (NOT a normative MDGL rule): UAX #29 extended
10
+ // grapheme clusters, Unicode 15.0.0 (no GB9c), from the generated tables in
11
+ // unicode-tables.ts (scripts/gen-unicode.js). No runtime Intl dependency.
12
+ const unicode_tables_1 = require("./unicode-tables");
13
+ exports.UNICODE_VERSION = '15.0.0';
14
+ /** Class of `cp` in a flat [start,end,class] triple table, or -1. */
15
+ function lookup(t, cp) {
16
+ let lo = 0, hi = t.length / 3 - 1;
17
+ while (lo <= hi) {
18
+ const m = (lo + hi) >> 1, s = t[3 * m];
19
+ if (cp < s)
20
+ hi = m - 1;
21
+ else if (cp > t[3 * m + 1])
22
+ lo = m + 1;
23
+ else
24
+ return t[3 * m + 2];
25
+ }
26
+ return -1;
27
+ }
28
+ const [PREPEND, CR, LF, CONTROL, EXTEND, ZWJ, RI, SPACING, L, V, T, LV, LVT] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
29
+ const OTHER = 13;
30
+ /** Cluster boundaries as UTF-16 index pairs [start, end). */
31
+ function graphemeRanges(s) {
32
+ const out = [];
33
+ let start = 0, prev = -1, ri = 0, pict = 0 /* 0 none, 1 ExtPict Extend*, 2 +ZWJ */;
34
+ for (let i = 0; i < s.length;) {
35
+ const cp = s.codePointAt(i);
36
+ const n = cp > 0xffff ? 2 : 1;
37
+ const g0 = lookup(unicode_tables_1.GCB, cp), g = g0 < 0 ? OTHER : g0, ep = lookup(unicode_tables_1.EXT_PICT, cp) >= 0;
38
+ if (prev >= 0) {
39
+ let brk;
40
+ if (prev === CR && g === LF)
41
+ brk = false;
42
+ else if (prev === CONTROL || prev === CR || prev === LF || g === CONTROL || g === CR || g === LF)
43
+ brk = true;
44
+ else if (prev === L && (g === L || g === V || g === LV || g === LVT))
45
+ brk = false;
46
+ else if ((prev === LV || prev === V) && (g === V || g === T))
47
+ brk = false;
48
+ else if ((prev === LVT || prev === T) && g === T)
49
+ brk = false;
50
+ else if (g === EXTEND || g === ZWJ || g === SPACING || prev === PREPEND)
51
+ brk = false;
52
+ else if (pict === 2 && ep)
53
+ brk = false;
54
+ else if (prev === RI && g === RI)
55
+ brk = ri % 2 === 0;
56
+ else
57
+ brk = true;
58
+ if (brk) {
59
+ out.push([start, i]);
60
+ start = i;
61
+ }
62
+ }
63
+ // state for the next boundary decision
64
+ if (prev < 0 || start === i) {
65
+ ri = 0;
66
+ pict = 0;
67
+ }
68
+ ri = g === RI ? ri + 1 : 0;
69
+ pict = ep ? 1 : g === EXTEND && pict === 1 ? 1 : g === ZWJ && pict === 1 ? 2 : 0;
70
+ prev = g;
71
+ i += n;
72
+ }
73
+ if (s.length)
74
+ out.push([start, s.length]);
75
+ return out;
76
+ }
77
+ function graphemes(s) { return graphemeRanges(s).map(([a, b]) => s.slice(a, b)); }
78
+ function graphemeCount(s) { return graphemeRanges(s).length; }
79
+ const isMark = (cp) => lookup(unicode_tables_1.MARK, cp) >= 0;
80
+ exports.isMark = isMark;
81
+ const isWide = (cp) => lookup(unicode_tables_1.WIDE, cp) >= 0;
82
+ exports.isWide = isWide;
83
+ const isIgnorable = (cp) => lookup(unicode_tables_1.IGNORABLE, cp) >= 0;
84
+ exports.isIgnorable = isIgnorable;
85
+ const CF = /^\p{Cf}$/u;
86
+ const first = (cluster) => {
87
+ const cps = Array.from(cluster);
88
+ return cps.find((c) => !(0, exports.isMark)(c.codePointAt(0))) ?? cps[0];
89
+ };
90
+ /** Terminal width of one cluster: 0 (only marks / default-ignorable / format characters), 2 (first non-mark rune East Asian W/F or a regional indicator, or an emoji-style VS16/keycap sequence), else 1. */
91
+ function clusterWidth(cluster) {
92
+ const cps = Array.from(cluster, (c) => c.codePointAt(0));
93
+ if (cps.every((c) => (0, exports.isMark)(c) || (0, exports.isIgnorable)(c) || CF.test(String.fromCodePoint(c))))
94
+ return 0;
95
+ const f = first(cluster).codePointAt(0);
96
+ if ((0, exports.isWide)(f) || lookup(unicode_tables_1.GCB, f) === RI)
97
+ return 2; // RI: single and paired flag clusters are width 2 (reference contract)
98
+ const i = cps.indexOf(f);
99
+ if (cps[i + 1] === 0xfe0f && lookup(unicode_tables_1.VS16_BASE, f) >= 0)
100
+ return 2;
101
+ return 1;
102
+ }
103
+ /** SPEC Cells: the first non-mark rune of a cluster (even if zero-width Cf/default-ignorable); U+FFFD when the cluster is wider than one cell; a blank only for an all-mark cluster. Every cluster consumes exactly one cell, so later cells never shift. */
104
+ function cellRune(cluster) {
105
+ if (clusterWidth(cluster) === 2)
106
+ return '�';
107
+ const r = Array.from(cluster).find((c) => !(0, exports.isMark)(c.codePointAt(0)));
108
+ return r ?? ' ';
109
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@enmaq/mdgl",
3
- "version": "0.2.0",
4
- "description": "MarkdownGL 0.0.1 subset checker (input/line/actor/action limits and scene header only). Not a conformant implementation.",
3
+ "version": "0.3.0",
4
+ "description": "MDGL 0.1 parser, checker, evaluator, terminal-cell renderer and terminal player.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -16,15 +16,19 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
+ "bin",
19
20
  "README.md",
20
21
  "LICENSE-MIT",
21
- "LICENSE-APACHE"
22
+ "LICENSE-APACHE",
23
+ "UNICODE-LICENSE.txt"
22
24
  ],
23
25
  "scripts": {
24
26
  "build": "tsc -p .",
25
27
  "prepack": "npm run build",
26
28
  "test:types": "tsc -p test/consumer",
27
- "test": "npm run build && npm run test:types && node --test test/*.test.js"
29
+ "test": "npm run build && npm run test:types && node --test test/*.test.js",
30
+ "example:js": "npm run build && node examples/render.mjs",
31
+ "example:ts": "npm run build && tsc -p examples && node .examples/render.js"
28
32
  },
29
33
  "repository": {
30
34
  "type": "git",
@@ -45,5 +49,9 @@
45
49
  "license": "MIT OR Apache-2.0",
46
50
  "devDependencies": {
47
51
  "typescript": "5.9.3"
52
+ },
53
+ "bin": {
54
+ "mdgl": "bin/mdgl.js",
55
+ "mdgl-adapter": "bin/mdgl-adapter.js"
48
56
  }
49
57
  }