pretierr 3.3.3
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +4379 -0
- package/README.md +109 -0
- package/bin/prettier.cjs +64 -0
- package/doc.d.ts +243 -0
- package/doc.js +1319 -0
- package/doc.mjs +1291 -0
- package/index.cjs +648 -0
- package/index.d.ts +941 -0
- package/index.mjs +22795 -0
- package/internal/cli.mjs +3884 -0
- package/package.json +206 -0
- package/plugins/acorn.d.ts +6 -0
- package/plugins/acorn.js +15 -0
- package/plugins/acorn.mjs +15 -0
- package/plugins/angular.d.ts +8 -0
- package/plugins/angular.js +1 -0
- package/plugins/angular.mjs +1 -0
- package/plugins/babel.d.ts +18 -0
- package/plugins/babel.js +15 -0
- package/plugins/babel.mjs +15 -0
- package/plugins/estree.d.ts +1 -0
- package/plugins/estree.js +36 -0
- package/plugins/estree.mjs +36 -0
- package/plugins/flow.d.ts +5 -0
- package/plugins/flow.js +19 -0
- package/plugins/flow.mjs +19 -0
- package/plugins/glimmer.d.ts +5 -0
- package/plugins/glimmer.js +30 -0
- package/plugins/glimmer.mjs +30 -0
- package/plugins/graphql.d.ts +5 -0
- package/plugins/graphql.js +29 -0
- package/plugins/graphql.mjs +29 -0
- package/plugins/html.d.ts +8 -0
- package/plugins/html.js +22 -0
- package/plugins/html.mjs +22 -0
- package/plugins/markdown.d.ts +7 -0
- package/plugins/markdown.js +62 -0
- package/plugins/markdown.mjs +62 -0
- package/plugins/meriyah.d.ts +5 -0
- package/plugins/meriyah.js +4 -0
- package/plugins/meriyah.mjs +4 -0
- package/plugins/postcss.d.ts +7 -0
- package/plugins/postcss.js +52 -0
- package/plugins/postcss.mjs +52 -0
- package/plugins/typescript.d.ts +5 -0
- package/plugins/typescript.js +20 -0
- package/plugins/typescript.mjs +20 -0
- package/plugins/yaml.d.ts +5 -0
- package/plugins/yaml.js +161 -0
- package/plugins/yaml.mjs +161 -0
- package/standalone.d.ts +33 -0
- package/standalone.js +35 -0
- package/standalone.mjs +35 -0
- package/te24xjoq.cjs +1 -0
package/doc.js
ADDED
@@ -0,0 +1,1319 @@
|
|
1
|
+
(function (factory) {
|
2
|
+
function interopModuleDefault() {
|
3
|
+
var module = factory();
|
4
|
+
return module.default || module;
|
5
|
+
}
|
6
|
+
|
7
|
+
if (typeof exports === "object" && typeof module === "object") {
|
8
|
+
module.exports = interopModuleDefault();
|
9
|
+
} else if (typeof define === "function" && define.amd) {
|
10
|
+
define(interopModuleDefault);
|
11
|
+
} else {
|
12
|
+
var root =
|
13
|
+
typeof globalThis !== "undefined"
|
14
|
+
? globalThis
|
15
|
+
: typeof global !== "undefined"
|
16
|
+
? global
|
17
|
+
: typeof self !== "undefined"
|
18
|
+
? self
|
19
|
+
: this || {};
|
20
|
+
root.doc = interopModuleDefault();
|
21
|
+
}
|
22
|
+
})(function () {
|
23
|
+
"use strict";
|
24
|
+
var __defProp = Object.defineProperty;
|
25
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
26
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
27
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
28
|
+
var __export = (target, all) => {
|
29
|
+
for (var name in all)
|
30
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
31
|
+
};
|
32
|
+
var __copyProps = (to, from, except, desc) => {
|
33
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
34
|
+
for (let key of __getOwnPropNames(from))
|
35
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
36
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
37
|
+
}
|
38
|
+
return to;
|
39
|
+
};
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
41
|
+
|
42
|
+
// src/document/public.js
|
43
|
+
var public_exports = {};
|
44
|
+
__export(public_exports, {
|
45
|
+
builders: () => builders,
|
46
|
+
printer: () => printer,
|
47
|
+
utils: () => utils
|
48
|
+
});
|
49
|
+
|
50
|
+
// src/document/constants.js
|
51
|
+
var DOC_TYPE_STRING = "string";
|
52
|
+
var DOC_TYPE_ARRAY = "array";
|
53
|
+
var DOC_TYPE_CURSOR = "cursor";
|
54
|
+
var DOC_TYPE_INDENT = "indent";
|
55
|
+
var DOC_TYPE_ALIGN = "align";
|
56
|
+
var DOC_TYPE_TRIM = "trim";
|
57
|
+
var DOC_TYPE_GROUP = "group";
|
58
|
+
var DOC_TYPE_FILL = "fill";
|
59
|
+
var DOC_TYPE_IF_BREAK = "if-break";
|
60
|
+
var DOC_TYPE_INDENT_IF_BREAK = "indent-if-break";
|
61
|
+
var DOC_TYPE_LINE_SUFFIX = "line-suffix";
|
62
|
+
var DOC_TYPE_LINE_SUFFIX_BOUNDARY = "line-suffix-boundary";
|
63
|
+
var DOC_TYPE_LINE = "line";
|
64
|
+
var DOC_TYPE_LABEL = "label";
|
65
|
+
var DOC_TYPE_BREAK_PARENT = "break-parent";
|
66
|
+
var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
|
67
|
+
DOC_TYPE_CURSOR,
|
68
|
+
DOC_TYPE_INDENT,
|
69
|
+
DOC_TYPE_ALIGN,
|
70
|
+
DOC_TYPE_TRIM,
|
71
|
+
DOC_TYPE_GROUP,
|
72
|
+
DOC_TYPE_FILL,
|
73
|
+
DOC_TYPE_IF_BREAK,
|
74
|
+
DOC_TYPE_INDENT_IF_BREAK,
|
75
|
+
DOC_TYPE_LINE_SUFFIX,
|
76
|
+
DOC_TYPE_LINE_SUFFIX_BOUNDARY,
|
77
|
+
DOC_TYPE_LINE,
|
78
|
+
DOC_TYPE_LABEL,
|
79
|
+
DOC_TYPE_BREAK_PARENT
|
80
|
+
]);
|
81
|
+
|
82
|
+
// src/document/utils/get-doc-type.js
|
83
|
+
function getDocType(doc) {
|
84
|
+
if (typeof doc === "string") {
|
85
|
+
return DOC_TYPE_STRING;
|
86
|
+
}
|
87
|
+
if (Array.isArray(doc)) {
|
88
|
+
return DOC_TYPE_ARRAY;
|
89
|
+
}
|
90
|
+
if (!doc) {
|
91
|
+
return;
|
92
|
+
}
|
93
|
+
const { type } = doc;
|
94
|
+
if (VALID_OBJECT_DOC_TYPES.has(type)) {
|
95
|
+
return type;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
var get_doc_type_default = getDocType;
|
99
|
+
|
100
|
+
// src/document/invalid-doc-error.js
|
101
|
+
var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
|
102
|
+
function getDocErrorMessage(doc) {
|
103
|
+
const type = doc === null ? "null" : typeof doc;
|
104
|
+
if (type !== "string" && type !== "object") {
|
105
|
+
return `Unexpected doc '${type}',
|
106
|
+
Expected it to be 'string' or 'object'.`;
|
107
|
+
}
|
108
|
+
if (get_doc_type_default(doc)) {
|
109
|
+
throw new Error("doc is valid.");
|
110
|
+
}
|
111
|
+
const objectType = Object.prototype.toString.call(doc);
|
112
|
+
if (objectType !== "[object Object]") {
|
113
|
+
return `Unexpected doc '${objectType}'.`;
|
114
|
+
}
|
115
|
+
const EXPECTED_TYPE_VALUES = disjunctionListFormat(
|
116
|
+
[...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`)
|
117
|
+
);
|
118
|
+
return `Unexpected doc.type '${doc.type}'.
|
119
|
+
Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
120
|
+
}
|
121
|
+
var InvalidDocError = class extends Error {
|
122
|
+
name = "InvalidDocError";
|
123
|
+
constructor(doc) {
|
124
|
+
super(getDocErrorMessage(doc));
|
125
|
+
this.doc = doc;
|
126
|
+
}
|
127
|
+
};
|
128
|
+
var invalid_doc_error_default = InvalidDocError;
|
129
|
+
|
130
|
+
// src/document/utils/traverse-doc.js
|
131
|
+
var traverseDocOnExitStackMarker = {};
|
132
|
+
function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
|
133
|
+
const docsStack = [doc];
|
134
|
+
while (docsStack.length > 0) {
|
135
|
+
const doc2 = docsStack.pop();
|
136
|
+
if (doc2 === traverseDocOnExitStackMarker) {
|
137
|
+
onExit(docsStack.pop());
|
138
|
+
continue;
|
139
|
+
}
|
140
|
+
if (onExit) {
|
141
|
+
docsStack.push(doc2, traverseDocOnExitStackMarker);
|
142
|
+
}
|
143
|
+
const docType = get_doc_type_default(doc2);
|
144
|
+
if (!docType) {
|
145
|
+
throw new invalid_doc_error_default(doc2);
|
146
|
+
}
|
147
|
+
if ((onEnter == null ? void 0 : onEnter(doc2)) === false) {
|
148
|
+
continue;
|
149
|
+
}
|
150
|
+
switch (docType) {
|
151
|
+
case DOC_TYPE_ARRAY:
|
152
|
+
case DOC_TYPE_FILL: {
|
153
|
+
const parts = docType === DOC_TYPE_ARRAY ? doc2 : doc2.parts;
|
154
|
+
for (let ic = parts.length, i = ic - 1; i >= 0; --i) {
|
155
|
+
docsStack.push(parts[i]);
|
156
|
+
}
|
157
|
+
break;
|
158
|
+
}
|
159
|
+
case DOC_TYPE_IF_BREAK:
|
160
|
+
docsStack.push(doc2.flatContents, doc2.breakContents);
|
161
|
+
break;
|
162
|
+
case DOC_TYPE_GROUP:
|
163
|
+
if (shouldTraverseConditionalGroups && doc2.expandedStates) {
|
164
|
+
for (let ic = doc2.expandedStates.length, i = ic - 1; i >= 0; --i) {
|
165
|
+
docsStack.push(doc2.expandedStates[i]);
|
166
|
+
}
|
167
|
+
} else {
|
168
|
+
docsStack.push(doc2.contents);
|
169
|
+
}
|
170
|
+
break;
|
171
|
+
case DOC_TYPE_ALIGN:
|
172
|
+
case DOC_TYPE_INDENT:
|
173
|
+
case DOC_TYPE_INDENT_IF_BREAK:
|
174
|
+
case DOC_TYPE_LABEL:
|
175
|
+
case DOC_TYPE_LINE_SUFFIX:
|
176
|
+
docsStack.push(doc2.contents);
|
177
|
+
break;
|
178
|
+
case DOC_TYPE_STRING:
|
179
|
+
case DOC_TYPE_CURSOR:
|
180
|
+
case DOC_TYPE_TRIM:
|
181
|
+
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
182
|
+
case DOC_TYPE_LINE:
|
183
|
+
case DOC_TYPE_BREAK_PARENT:
|
184
|
+
break;
|
185
|
+
default:
|
186
|
+
throw new invalid_doc_error_default(doc2);
|
187
|
+
}
|
188
|
+
}
|
189
|
+
}
|
190
|
+
var traverse_doc_default = traverseDoc;
|
191
|
+
|
192
|
+
// src/document/utils/assert-doc.js
|
193
|
+
var noop = () => {
|
194
|
+
};
|
195
|
+
var assertDoc = true ? noop : function(doc) {
|
196
|
+
traverse_doc_default(doc, (doc2) => {
|
197
|
+
if (checked.has(doc2)) {
|
198
|
+
return false;
|
199
|
+
}
|
200
|
+
if (typeof doc2 !== "string") {
|
201
|
+
checked.add(doc2);
|
202
|
+
}
|
203
|
+
});
|
204
|
+
};
|
205
|
+
var assertDocArray = true ? noop : function(docs, optional = false) {
|
206
|
+
if (optional && !docs) {
|
207
|
+
return;
|
208
|
+
}
|
209
|
+
if (!Array.isArray(docs)) {
|
210
|
+
throw new TypeError("Unexpected doc array.");
|
211
|
+
}
|
212
|
+
for (const doc of docs) {
|
213
|
+
assertDoc(doc);
|
214
|
+
}
|
215
|
+
};
|
216
|
+
|
217
|
+
// src/document/builders.js
|
218
|
+
function indent(contents) {
|
219
|
+
assertDoc(contents);
|
220
|
+
return { type: DOC_TYPE_INDENT, contents };
|
221
|
+
}
|
222
|
+
function align(widthOrString, contents) {
|
223
|
+
assertDoc(contents);
|
224
|
+
return { type: DOC_TYPE_ALIGN, contents, n: widthOrString };
|
225
|
+
}
|
226
|
+
function group(contents, opts = {}) {
|
227
|
+
assertDoc(contents);
|
228
|
+
assertDocArray(
|
229
|
+
opts.expandedStates,
|
230
|
+
/* optional */
|
231
|
+
true
|
232
|
+
);
|
233
|
+
return {
|
234
|
+
type: DOC_TYPE_GROUP,
|
235
|
+
id: opts.id,
|
236
|
+
contents,
|
237
|
+
break: Boolean(opts.shouldBreak),
|
238
|
+
expandedStates: opts.expandedStates
|
239
|
+
};
|
240
|
+
}
|
241
|
+
function dedentToRoot(contents) {
|
242
|
+
return align(Number.NEGATIVE_INFINITY, contents);
|
243
|
+
}
|
244
|
+
function markAsRoot(contents) {
|
245
|
+
return align({ type: "root" }, contents);
|
246
|
+
}
|
247
|
+
function dedent(contents) {
|
248
|
+
return align(-1, contents);
|
249
|
+
}
|
250
|
+
function conditionalGroup(states, opts) {
|
251
|
+
return group(states[0], { ...opts, expandedStates: states });
|
252
|
+
}
|
253
|
+
function fill(parts) {
|
254
|
+
assertDocArray(parts);
|
255
|
+
return { type: DOC_TYPE_FILL, parts };
|
256
|
+
}
|
257
|
+
function ifBreak(breakContents, flatContents = "", opts = {}) {
|
258
|
+
assertDoc(breakContents);
|
259
|
+
if (flatContents !== "") {
|
260
|
+
assertDoc(flatContents);
|
261
|
+
}
|
262
|
+
return {
|
263
|
+
type: DOC_TYPE_IF_BREAK,
|
264
|
+
breakContents,
|
265
|
+
flatContents,
|
266
|
+
groupId: opts.groupId
|
267
|
+
};
|
268
|
+
}
|
269
|
+
function indentIfBreak(contents, opts) {
|
270
|
+
assertDoc(contents);
|
271
|
+
return {
|
272
|
+
type: DOC_TYPE_INDENT_IF_BREAK,
|
273
|
+
contents,
|
274
|
+
groupId: opts.groupId,
|
275
|
+
negate: opts.negate
|
276
|
+
};
|
277
|
+
}
|
278
|
+
function lineSuffix(contents) {
|
279
|
+
assertDoc(contents);
|
280
|
+
return { type: DOC_TYPE_LINE_SUFFIX, contents };
|
281
|
+
}
|
282
|
+
var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
|
283
|
+
var breakParent = { type: DOC_TYPE_BREAK_PARENT };
|
284
|
+
var trim = { type: DOC_TYPE_TRIM };
|
285
|
+
var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
|
286
|
+
var literallineWithoutBreakParent = {
|
287
|
+
type: DOC_TYPE_LINE,
|
288
|
+
hard: true,
|
289
|
+
literal: true
|
290
|
+
};
|
291
|
+
var line = { type: DOC_TYPE_LINE };
|
292
|
+
var softline = { type: DOC_TYPE_LINE, soft: true };
|
293
|
+
var hardline = [hardlineWithoutBreakParent, breakParent];
|
294
|
+
var literalline = [literallineWithoutBreakParent, breakParent];
|
295
|
+
var cursor = { type: DOC_TYPE_CURSOR };
|
296
|
+
function join(separator, docs) {
|
297
|
+
assertDoc(separator);
|
298
|
+
assertDocArray(docs);
|
299
|
+
const parts = [];
|
300
|
+
for (let i = 0; i < docs.length; i++) {
|
301
|
+
if (i !== 0) {
|
302
|
+
parts.push(separator);
|
303
|
+
}
|
304
|
+
parts.push(docs[i]);
|
305
|
+
}
|
306
|
+
return parts;
|
307
|
+
}
|
308
|
+
function addAlignmentToDoc(doc, size, tabWidth) {
|
309
|
+
assertDoc(doc);
|
310
|
+
let aligned = doc;
|
311
|
+
if (size > 0) {
|
312
|
+
for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
|
313
|
+
aligned = indent(aligned);
|
314
|
+
}
|
315
|
+
aligned = align(size % tabWidth, aligned);
|
316
|
+
aligned = align(Number.NEGATIVE_INFINITY, aligned);
|
317
|
+
}
|
318
|
+
return aligned;
|
319
|
+
}
|
320
|
+
function label(label2, contents) {
|
321
|
+
assertDoc(contents);
|
322
|
+
return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
|
323
|
+
}
|
324
|
+
|
325
|
+
// scripts/build/shims/at.js
|
326
|
+
var at = (isOptionalObject, object, index) => {
|
327
|
+
if (isOptionalObject && (object === void 0 || object === null)) {
|
328
|
+
return;
|
329
|
+
}
|
330
|
+
if (Array.isArray(object) || typeof object === "string") {
|
331
|
+
return object[index < 0 ? object.length + index : index];
|
332
|
+
}
|
333
|
+
return object.at(index);
|
334
|
+
};
|
335
|
+
var at_default = at;
|
336
|
+
|
337
|
+
// scripts/build/shims/string-replace-all.js
|
338
|
+
var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
|
339
|
+
if (isOptionalObject && (original === void 0 || original === null)) {
|
340
|
+
return;
|
341
|
+
}
|
342
|
+
if (original.replaceAll) {
|
343
|
+
return original.replaceAll(pattern, replacement);
|
344
|
+
}
|
345
|
+
if (pattern.global) {
|
346
|
+
return original.replace(pattern, replacement);
|
347
|
+
}
|
348
|
+
return original.split(pattern).join(replacement);
|
349
|
+
};
|
350
|
+
var string_replace_all_default = stringReplaceAll;
|
351
|
+
|
352
|
+
// src/common/end-of-line.js
|
353
|
+
function convertEndOfLineToChars(value) {
|
354
|
+
switch (value) {
|
355
|
+
case "cr":
|
356
|
+
return "\r";
|
357
|
+
case "crlf":
|
358
|
+
return "\r\n";
|
359
|
+
default:
|
360
|
+
return "\n";
|
361
|
+
}
|
362
|
+
}
|
363
|
+
|
364
|
+
// node_modules/emoji-regex/index.mjs
|
365
|
+
var emoji_regex_default = () => {
|
366
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
367
|
+
};
|
368
|
+
|
369
|
+
// node_modules/get-east-asian-width/lookup.js
|
370
|
+
function isFullWidth(x) {
|
371
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
372
|
+
}
|
373
|
+
function isWide(x) {
|
374
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
375
|
+
}
|
376
|
+
|
377
|
+
// node_modules/get-east-asian-width/index.js
|
378
|
+
var _isNarrowWidth = (codePoint) => !(isFullWidth(codePoint) || isWide(codePoint));
|
379
|
+
|
380
|
+
// src/utils/get-string-width.js
|
381
|
+
var notAsciiRegex = /[^\x20-\x7F]/u;
|
382
|
+
function getStringWidth(text) {
|
383
|
+
if (!text) {
|
384
|
+
return 0;
|
385
|
+
}
|
386
|
+
if (!notAsciiRegex.test(text)) {
|
387
|
+
return text.length;
|
388
|
+
}
|
389
|
+
text = text.replace(emoji_regex_default(), " ");
|
390
|
+
let width = 0;
|
391
|
+
for (const character of text) {
|
392
|
+
const codePoint = character.codePointAt(0);
|
393
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
394
|
+
continue;
|
395
|
+
}
|
396
|
+
if (codePoint >= 768 && codePoint <= 879) {
|
397
|
+
continue;
|
398
|
+
}
|
399
|
+
width += _isNarrowWidth(codePoint) ? 1 : 2;
|
400
|
+
}
|
401
|
+
return width;
|
402
|
+
}
|
403
|
+
var get_string_width_default = getStringWidth;
|
404
|
+
|
405
|
+
// src/document/utils.js
|
406
|
+
function mapDoc(doc, cb) {
|
407
|
+
if (typeof doc === "string") {
|
408
|
+
return cb(doc);
|
409
|
+
}
|
410
|
+
const mapped = /* @__PURE__ */ new Map();
|
411
|
+
return rec(doc);
|
412
|
+
function rec(doc2) {
|
413
|
+
if (mapped.has(doc2)) {
|
414
|
+
return mapped.get(doc2);
|
415
|
+
}
|
416
|
+
const result = process2(doc2);
|
417
|
+
mapped.set(doc2, result);
|
418
|
+
return result;
|
419
|
+
}
|
420
|
+
function process2(doc2) {
|
421
|
+
switch (get_doc_type_default(doc2)) {
|
422
|
+
case DOC_TYPE_ARRAY:
|
423
|
+
return cb(doc2.map(rec));
|
424
|
+
case DOC_TYPE_FILL:
|
425
|
+
return cb({
|
426
|
+
...doc2,
|
427
|
+
parts: doc2.parts.map(rec)
|
428
|
+
});
|
429
|
+
case DOC_TYPE_IF_BREAK:
|
430
|
+
return cb({
|
431
|
+
...doc2,
|
432
|
+
breakContents: rec(doc2.breakContents),
|
433
|
+
flatContents: rec(doc2.flatContents)
|
434
|
+
});
|
435
|
+
case DOC_TYPE_GROUP: {
|
436
|
+
let {
|
437
|
+
expandedStates,
|
438
|
+
contents
|
439
|
+
} = doc2;
|
440
|
+
if (expandedStates) {
|
441
|
+
expandedStates = expandedStates.map(rec);
|
442
|
+
contents = expandedStates[0];
|
443
|
+
} else {
|
444
|
+
contents = rec(contents);
|
445
|
+
}
|
446
|
+
return cb({
|
447
|
+
...doc2,
|
448
|
+
contents,
|
449
|
+
expandedStates
|
450
|
+
});
|
451
|
+
}
|
452
|
+
case DOC_TYPE_ALIGN:
|
453
|
+
case DOC_TYPE_INDENT:
|
454
|
+
case DOC_TYPE_INDENT_IF_BREAK:
|
455
|
+
case DOC_TYPE_LABEL:
|
456
|
+
case DOC_TYPE_LINE_SUFFIX:
|
457
|
+
return cb({
|
458
|
+
...doc2,
|
459
|
+
contents: rec(doc2.contents)
|
460
|
+
});
|
461
|
+
case DOC_TYPE_STRING:
|
462
|
+
case DOC_TYPE_CURSOR:
|
463
|
+
case DOC_TYPE_TRIM:
|
464
|
+
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
465
|
+
case DOC_TYPE_LINE:
|
466
|
+
case DOC_TYPE_BREAK_PARENT:
|
467
|
+
return cb(doc2);
|
468
|
+
default:
|
469
|
+
throw new invalid_doc_error_default(doc2);
|
470
|
+
}
|
471
|
+
}
|
472
|
+
}
|
473
|
+
function findInDoc(doc, fn, defaultValue) {
|
474
|
+
let result = defaultValue;
|
475
|
+
let shouldSkipFurtherProcessing = false;
|
476
|
+
function findInDocOnEnterFn(doc2) {
|
477
|
+
if (shouldSkipFurtherProcessing) {
|
478
|
+
return false;
|
479
|
+
}
|
480
|
+
const maybeResult = fn(doc2);
|
481
|
+
if (maybeResult !== void 0) {
|
482
|
+
shouldSkipFurtherProcessing = true;
|
483
|
+
result = maybeResult;
|
484
|
+
}
|
485
|
+
}
|
486
|
+
traverse_doc_default(doc, findInDocOnEnterFn);
|
487
|
+
return result;
|
488
|
+
}
|
489
|
+
function willBreakFn(doc) {
|
490
|
+
if (doc.type === DOC_TYPE_GROUP && doc.break) {
|
491
|
+
return true;
|
492
|
+
}
|
493
|
+
if (doc.type === DOC_TYPE_LINE && doc.hard) {
|
494
|
+
return true;
|
495
|
+
}
|
496
|
+
if (doc.type === DOC_TYPE_BREAK_PARENT) {
|
497
|
+
return true;
|
498
|
+
}
|
499
|
+
}
|
500
|
+
function willBreak(doc) {
|
501
|
+
return findInDoc(doc, willBreakFn, false);
|
502
|
+
}
|
503
|
+
function breakParentGroup(groupStack) {
|
504
|
+
if (groupStack.length > 0) {
|
505
|
+
const parentGroup = at_default(
|
506
|
+
/* isOptionalObject */
|
507
|
+
false,
|
508
|
+
groupStack,
|
509
|
+
-1
|
510
|
+
);
|
511
|
+
if (!parentGroup.expandedStates && !parentGroup.break) {
|
512
|
+
parentGroup.break = "propagated";
|
513
|
+
}
|
514
|
+
}
|
515
|
+
return null;
|
516
|
+
}
|
517
|
+
function propagateBreaks(doc) {
|
518
|
+
const alreadyVisitedSet = /* @__PURE__ */ new Set();
|
519
|
+
const groupStack = [];
|
520
|
+
function propagateBreaksOnEnterFn(doc2) {
|
521
|
+
if (doc2.type === DOC_TYPE_BREAK_PARENT) {
|
522
|
+
breakParentGroup(groupStack);
|
523
|
+
}
|
524
|
+
if (doc2.type === DOC_TYPE_GROUP) {
|
525
|
+
groupStack.push(doc2);
|
526
|
+
if (alreadyVisitedSet.has(doc2)) {
|
527
|
+
return false;
|
528
|
+
}
|
529
|
+
alreadyVisitedSet.add(doc2);
|
530
|
+
}
|
531
|
+
}
|
532
|
+
function propagateBreaksOnExitFn(doc2) {
|
533
|
+
if (doc2.type === DOC_TYPE_GROUP) {
|
534
|
+
const group2 = groupStack.pop();
|
535
|
+
if (group2.break) {
|
536
|
+
breakParentGroup(groupStack);
|
537
|
+
}
|
538
|
+
}
|
539
|
+
}
|
540
|
+
traverse_doc_default(
|
541
|
+
doc,
|
542
|
+
propagateBreaksOnEnterFn,
|
543
|
+
propagateBreaksOnExitFn,
|
544
|
+
/* shouldTraverseConditionalGroups */
|
545
|
+
true
|
546
|
+
);
|
547
|
+
}
|
548
|
+
function removeLinesFn(doc) {
|
549
|
+
if (doc.type === DOC_TYPE_LINE && !doc.hard) {
|
550
|
+
return doc.soft ? "" : " ";
|
551
|
+
}
|
552
|
+
if (doc.type === DOC_TYPE_IF_BREAK) {
|
553
|
+
return doc.flatContents;
|
554
|
+
}
|
555
|
+
return doc;
|
556
|
+
}
|
557
|
+
function removeLines(doc) {
|
558
|
+
return mapDoc(doc, removeLinesFn);
|
559
|
+
}
|
560
|
+
function stripTrailingHardlineFromParts(parts) {
|
561
|
+
parts = [...parts];
|
562
|
+
while (parts.length >= 2 && at_default(
|
563
|
+
/* isOptionalObject */
|
564
|
+
false,
|
565
|
+
parts,
|
566
|
+
-2
|
567
|
+
).type === DOC_TYPE_LINE && at_default(
|
568
|
+
/* isOptionalObject */
|
569
|
+
false,
|
570
|
+
parts,
|
571
|
+
-1
|
572
|
+
).type === DOC_TYPE_BREAK_PARENT) {
|
573
|
+
parts.length -= 2;
|
574
|
+
}
|
575
|
+
if (parts.length > 0) {
|
576
|
+
const lastPart = stripTrailingHardlineFromDoc(at_default(
|
577
|
+
/* isOptionalObject */
|
578
|
+
false,
|
579
|
+
parts,
|
580
|
+
-1
|
581
|
+
));
|
582
|
+
parts[parts.length - 1] = lastPart;
|
583
|
+
}
|
584
|
+
return parts;
|
585
|
+
}
|
586
|
+
function stripTrailingHardlineFromDoc(doc) {
|
587
|
+
switch (get_doc_type_default(doc)) {
|
588
|
+
case DOC_TYPE_INDENT:
|
589
|
+
case DOC_TYPE_INDENT_IF_BREAK:
|
590
|
+
case DOC_TYPE_GROUP:
|
591
|
+
case DOC_TYPE_LINE_SUFFIX:
|
592
|
+
case DOC_TYPE_LABEL: {
|
593
|
+
const contents = stripTrailingHardlineFromDoc(doc.contents);
|
594
|
+
return {
|
595
|
+
...doc,
|
596
|
+
contents
|
597
|
+
};
|
598
|
+
}
|
599
|
+
case DOC_TYPE_IF_BREAK:
|
600
|
+
return {
|
601
|
+
...doc,
|
602
|
+
breakContents: stripTrailingHardlineFromDoc(doc.breakContents),
|
603
|
+
flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
|
604
|
+
};
|
605
|
+
case DOC_TYPE_FILL:
|
606
|
+
return {
|
607
|
+
...doc,
|
608
|
+
parts: stripTrailingHardlineFromParts(doc.parts)
|
609
|
+
};
|
610
|
+
case DOC_TYPE_ARRAY:
|
611
|
+
return stripTrailingHardlineFromParts(doc);
|
612
|
+
case DOC_TYPE_STRING:
|
613
|
+
return doc.replace(/[\n\r]*$/u, "");
|
614
|
+
case DOC_TYPE_ALIGN:
|
615
|
+
case DOC_TYPE_CURSOR:
|
616
|
+
case DOC_TYPE_TRIM:
|
617
|
+
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
618
|
+
case DOC_TYPE_LINE:
|
619
|
+
case DOC_TYPE_BREAK_PARENT:
|
620
|
+
break;
|
621
|
+
default:
|
622
|
+
throw new invalid_doc_error_default(doc);
|
623
|
+
}
|
624
|
+
return doc;
|
625
|
+
}
|
626
|
+
function stripTrailingHardline(doc) {
|
627
|
+
return stripTrailingHardlineFromDoc(cleanDoc(doc));
|
628
|
+
}
|
629
|
+
function cleanDocFn(doc) {
|
630
|
+
switch (get_doc_type_default(doc)) {
|
631
|
+
case DOC_TYPE_FILL:
|
632
|
+
if (doc.parts.every((part) => part === "")) {
|
633
|
+
return "";
|
634
|
+
}
|
635
|
+
break;
|
636
|
+
case DOC_TYPE_GROUP:
|
637
|
+
if (!doc.contents && !doc.id && !doc.break && !doc.expandedStates) {
|
638
|
+
return "";
|
639
|
+
}
|
640
|
+
if (doc.contents.type === DOC_TYPE_GROUP && doc.contents.id === doc.id && doc.contents.break === doc.break && doc.contents.expandedStates === doc.expandedStates) {
|
641
|
+
return doc.contents;
|
642
|
+
}
|
643
|
+
break;
|
644
|
+
case DOC_TYPE_ALIGN:
|
645
|
+
case DOC_TYPE_INDENT:
|
646
|
+
case DOC_TYPE_INDENT_IF_BREAK:
|
647
|
+
case DOC_TYPE_LINE_SUFFIX:
|
648
|
+
if (!doc.contents) {
|
649
|
+
return "";
|
650
|
+
}
|
651
|
+
break;
|
652
|
+
case DOC_TYPE_IF_BREAK:
|
653
|
+
if (!doc.flatContents && !doc.breakContents) {
|
654
|
+
return "";
|
655
|
+
}
|
656
|
+
break;
|
657
|
+
case DOC_TYPE_ARRAY: {
|
658
|
+
const parts = [];
|
659
|
+
for (const part of doc) {
|
660
|
+
if (!part) {
|
661
|
+
continue;
|
662
|
+
}
|
663
|
+
const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
|
664
|
+
if (typeof currentPart === "string" && typeof at_default(
|
665
|
+
/* isOptionalObject */
|
666
|
+
false,
|
667
|
+
parts,
|
668
|
+
-1
|
669
|
+
) === "string") {
|
670
|
+
parts[parts.length - 1] += currentPart;
|
671
|
+
} else {
|
672
|
+
parts.push(currentPart);
|
673
|
+
}
|
674
|
+
parts.push(...restParts);
|
675
|
+
}
|
676
|
+
if (parts.length === 0) {
|
677
|
+
return "";
|
678
|
+
}
|
679
|
+
if (parts.length === 1) {
|
680
|
+
return parts[0];
|
681
|
+
}
|
682
|
+
return parts;
|
683
|
+
}
|
684
|
+
case DOC_TYPE_STRING:
|
685
|
+
case DOC_TYPE_CURSOR:
|
686
|
+
case DOC_TYPE_TRIM:
|
687
|
+
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
688
|
+
case DOC_TYPE_LINE:
|
689
|
+
case DOC_TYPE_LABEL:
|
690
|
+
case DOC_TYPE_BREAK_PARENT:
|
691
|
+
break;
|
692
|
+
default:
|
693
|
+
throw new invalid_doc_error_default(doc);
|
694
|
+
}
|
695
|
+
return doc;
|
696
|
+
}
|
697
|
+
function cleanDoc(doc) {
|
698
|
+
return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
|
699
|
+
}
|
700
|
+
function replaceEndOfLine(doc, replacement = literalline) {
|
701
|
+
return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc);
|
702
|
+
}
|
703
|
+
function canBreakFn(doc) {
|
704
|
+
if (doc.type === DOC_TYPE_LINE) {
|
705
|
+
return true;
|
706
|
+
}
|
707
|
+
}
|
708
|
+
function canBreak(doc) {
|
709
|
+
return findInDoc(doc, canBreakFn, false);
|
710
|
+
}
|
711
|
+
|
712
|
+
// src/document/printer.js
|
713
|
+
var MODE_BREAK = Symbol("MODE_BREAK");
|
714
|
+
var MODE_FLAT = Symbol("MODE_FLAT");
|
715
|
+
var CURSOR_PLACEHOLDER = Symbol("cursor");
|
716
|
+
function rootIndent() {
|
717
|
+
return {
|
718
|
+
value: "",
|
719
|
+
length: 0,
|
720
|
+
queue: []
|
721
|
+
};
|
722
|
+
}
|
723
|
+
function makeIndent(ind, options) {
|
724
|
+
return generateInd(ind, {
|
725
|
+
type: "indent"
|
726
|
+
}, options);
|
727
|
+
}
|
728
|
+
function makeAlign(indent2, widthOrDoc, options) {
|
729
|
+
if (widthOrDoc === Number.NEGATIVE_INFINITY) {
|
730
|
+
return indent2.root || rootIndent();
|
731
|
+
}
|
732
|
+
if (widthOrDoc < 0) {
|
733
|
+
return generateInd(indent2, {
|
734
|
+
type: "dedent"
|
735
|
+
}, options);
|
736
|
+
}
|
737
|
+
if (!widthOrDoc) {
|
738
|
+
return indent2;
|
739
|
+
}
|
740
|
+
if (widthOrDoc.type === "root") {
|
741
|
+
return {
|
742
|
+
...indent2,
|
743
|
+
root: indent2
|
744
|
+
};
|
745
|
+
}
|
746
|
+
const alignType = typeof widthOrDoc === "string" ? "stringAlign" : "numberAlign";
|
747
|
+
return generateInd(indent2, {
|
748
|
+
type: alignType,
|
749
|
+
n: widthOrDoc
|
750
|
+
}, options);
|
751
|
+
}
|
752
|
+
function generateInd(ind, newPart, options) {
|
753
|
+
const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : [...ind.queue, newPart];
|
754
|
+
let value = "";
|
755
|
+
let length = 0;
|
756
|
+
let lastTabs = 0;
|
757
|
+
let lastSpaces = 0;
|
758
|
+
for (const part of queue) {
|
759
|
+
switch (part.type) {
|
760
|
+
case "indent":
|
761
|
+
flush();
|
762
|
+
if (options.useTabs) {
|
763
|
+
addTabs(1);
|
764
|
+
} else {
|
765
|
+
addSpaces(options.tabWidth);
|
766
|
+
}
|
767
|
+
break;
|
768
|
+
case "stringAlign":
|
769
|
+
flush();
|
770
|
+
value += part.n;
|
771
|
+
length += part.n.length;
|
772
|
+
break;
|
773
|
+
case "numberAlign":
|
774
|
+
lastTabs += 1;
|
775
|
+
lastSpaces += part.n;
|
776
|
+
break;
|
777
|
+
default:
|
778
|
+
throw new Error(`Unexpected type '${part.type}'`);
|
779
|
+
}
|
780
|
+
}
|
781
|
+
flushSpaces();
|
782
|
+
return {
|
783
|
+
...ind,
|
784
|
+
value,
|
785
|
+
length,
|
786
|
+
queue
|
787
|
+
};
|
788
|
+
function addTabs(count) {
|
789
|
+
value += " ".repeat(count);
|
790
|
+
length += options.tabWidth * count;
|
791
|
+
}
|
792
|
+
function addSpaces(count) {
|
793
|
+
value += " ".repeat(count);
|
794
|
+
length += count;
|
795
|
+
}
|
796
|
+
function flush() {
|
797
|
+
if (options.useTabs) {
|
798
|
+
flushTabs();
|
799
|
+
} else {
|
800
|
+
flushSpaces();
|
801
|
+
}
|
802
|
+
}
|
803
|
+
function flushTabs() {
|
804
|
+
if (lastTabs > 0) {
|
805
|
+
addTabs(lastTabs);
|
806
|
+
}
|
807
|
+
resetLast();
|
808
|
+
}
|
809
|
+
function flushSpaces() {
|
810
|
+
if (lastSpaces > 0) {
|
811
|
+
addSpaces(lastSpaces);
|
812
|
+
}
|
813
|
+
resetLast();
|
814
|
+
}
|
815
|
+
function resetLast() {
|
816
|
+
lastTabs = 0;
|
817
|
+
lastSpaces = 0;
|
818
|
+
}
|
819
|
+
}
|
820
|
+
function trim2(out) {
|
821
|
+
let trimCount = 0;
|
822
|
+
let cursorCount = 0;
|
823
|
+
let outIndex = out.length;
|
824
|
+
outer: while (outIndex--) {
|
825
|
+
const last = out[outIndex];
|
826
|
+
if (last === CURSOR_PLACEHOLDER) {
|
827
|
+
cursorCount++;
|
828
|
+
continue;
|
829
|
+
}
|
830
|
+
if (false) {
|
831
|
+
throw new Error(`Unexpected value in trim: '${typeof last}'`);
|
832
|
+
}
|
833
|
+
for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) {
|
834
|
+
const char = last[charIndex];
|
835
|
+
if (char === " " || char === " ") {
|
836
|
+
trimCount++;
|
837
|
+
} else {
|
838
|
+
out[outIndex] = last.slice(0, charIndex + 1);
|
839
|
+
break outer;
|
840
|
+
}
|
841
|
+
}
|
842
|
+
}
|
843
|
+
if (trimCount > 0 || cursorCount > 0) {
|
844
|
+
out.length = outIndex + 1;
|
845
|
+
while (cursorCount-- > 0) {
|
846
|
+
out.push(CURSOR_PLACEHOLDER);
|
847
|
+
}
|
848
|
+
}
|
849
|
+
return trimCount;
|
850
|
+
}
|
851
|
+
function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) {
|
852
|
+
if (width === Number.POSITIVE_INFINITY) {
|
853
|
+
return true;
|
854
|
+
}
|
855
|
+
let restIdx = restCommands.length;
|
856
|
+
const cmds = [next];
|
857
|
+
const out = [];
|
858
|
+
while (width >= 0) {
|
859
|
+
if (cmds.length === 0) {
|
860
|
+
if (restIdx === 0) {
|
861
|
+
return true;
|
862
|
+
}
|
863
|
+
cmds.push(restCommands[--restIdx]);
|
864
|
+
continue;
|
865
|
+
}
|
866
|
+
const {
|
867
|
+
mode,
|
868
|
+
doc
|
869
|
+
} = cmds.pop();
|
870
|
+
const docType = get_doc_type_default(doc);
|
871
|
+
switch (docType) {
|
872
|
+
case DOC_TYPE_STRING:
|
873
|
+
out.push(doc);
|
874
|
+
width -= get_string_width_default(doc);
|
875
|
+
break;
|
876
|
+
case DOC_TYPE_ARRAY:
|
877
|
+
case DOC_TYPE_FILL: {
|
878
|
+
const parts = docType === DOC_TYPE_ARRAY ? doc : doc.parts;
|
879
|
+
for (let i = parts.length - 1; i >= 0; i--) {
|
880
|
+
cmds.push({
|
881
|
+
mode,
|
882
|
+
doc: parts[i]
|
883
|
+
});
|
884
|
+
}
|
885
|
+
break;
|
886
|
+
}
|
887
|
+
case DOC_TYPE_INDENT:
|
888
|
+
case DOC_TYPE_ALIGN:
|
889
|
+
case DOC_TYPE_INDENT_IF_BREAK:
|
890
|
+
case DOC_TYPE_LABEL:
|
891
|
+
cmds.push({
|
892
|
+
mode,
|
893
|
+
doc: doc.contents
|
894
|
+
});
|
895
|
+
break;
|
896
|
+
case DOC_TYPE_TRIM:
|
897
|
+
width += trim2(out);
|
898
|
+
break;
|
899
|
+
case DOC_TYPE_GROUP: {
|
900
|
+
if (mustBeFlat && doc.break) {
|
901
|
+
return false;
|
902
|
+
}
|
903
|
+
const groupMode = doc.break ? MODE_BREAK : mode;
|
904
|
+
const contents = doc.expandedStates && groupMode === MODE_BREAK ? at_default(
|
905
|
+
/* isOptionalObject */
|
906
|
+
false,
|
907
|
+
doc.expandedStates,
|
908
|
+
-1
|
909
|
+
) : doc.contents;
|
910
|
+
cmds.push({
|
911
|
+
mode: groupMode,
|
912
|
+
doc: contents
|
913
|
+
});
|
914
|
+
break;
|
915
|
+
}
|
916
|
+
case DOC_TYPE_IF_BREAK: {
|
917
|
+
const groupMode = doc.groupId ? groupModeMap[doc.groupId] || MODE_FLAT : mode;
|
918
|
+
const contents = groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents;
|
919
|
+
if (contents) {
|
920
|
+
cmds.push({
|
921
|
+
mode,
|
922
|
+
doc: contents
|
923
|
+
});
|
924
|
+
}
|
925
|
+
break;
|
926
|
+
}
|
927
|
+
case DOC_TYPE_LINE:
|
928
|
+
if (mode === MODE_BREAK || doc.hard) {
|
929
|
+
return true;
|
930
|
+
}
|
931
|
+
if (!doc.soft) {
|
932
|
+
out.push(" ");
|
933
|
+
width--;
|
934
|
+
}
|
935
|
+
break;
|
936
|
+
case DOC_TYPE_LINE_SUFFIX:
|
937
|
+
hasLineSuffix = true;
|
938
|
+
break;
|
939
|
+
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
940
|
+
if (hasLineSuffix) {
|
941
|
+
return false;
|
942
|
+
}
|
943
|
+
break;
|
944
|
+
}
|
945
|
+
}
|
946
|
+
return false;
|
947
|
+
}
|
948
|
+
function printDocToString(doc, options) {
|
949
|
+
const groupModeMap = {};
|
950
|
+
const width = options.printWidth;
|
951
|
+
const newLine = convertEndOfLineToChars(options.endOfLine);
|
952
|
+
let pos = 0;
|
953
|
+
const cmds = [{
|
954
|
+
ind: rootIndent(),
|
955
|
+
mode: MODE_BREAK,
|
956
|
+
doc
|
957
|
+
}];
|
958
|
+
const out = [];
|
959
|
+
let shouldRemeasure = false;
|
960
|
+
const lineSuffix2 = [];
|
961
|
+
let printedCursorCount = 0;
|
962
|
+
propagateBreaks(doc);
|
963
|
+
while (cmds.length > 0) {
|
964
|
+
const {
|
965
|
+
ind,
|
966
|
+
mode,
|
967
|
+
doc: doc2
|
968
|
+
} = cmds.pop();
|
969
|
+
switch (get_doc_type_default(doc2)) {
|
970
|
+
case DOC_TYPE_STRING: {
|
971
|
+
const formatted = newLine !== "\n" ? string_replace_all_default(
|
972
|
+
/* isOptionalObject */
|
973
|
+
false,
|
974
|
+
doc2,
|
975
|
+
"\n",
|
976
|
+
newLine
|
977
|
+
) : doc2;
|
978
|
+
out.push(formatted);
|
979
|
+
if (cmds.length > 0) {
|
980
|
+
pos += get_string_width_default(formatted);
|
981
|
+
}
|
982
|
+
break;
|
983
|
+
}
|
984
|
+
case DOC_TYPE_ARRAY:
|
985
|
+
for (let i = doc2.length - 1; i >= 0; i--) {
|
986
|
+
cmds.push({
|
987
|
+
ind,
|
988
|
+
mode,
|
989
|
+
doc: doc2[i]
|
990
|
+
});
|
991
|
+
}
|
992
|
+
break;
|
993
|
+
case DOC_TYPE_CURSOR:
|
994
|
+
if (printedCursorCount >= 2) {
|
995
|
+
throw new Error("There are too many 'cursor' in doc.");
|
996
|
+
}
|
997
|
+
out.push(CURSOR_PLACEHOLDER);
|
998
|
+
printedCursorCount++;
|
999
|
+
break;
|
1000
|
+
case DOC_TYPE_INDENT:
|
1001
|
+
cmds.push({
|
1002
|
+
ind: makeIndent(ind, options),
|
1003
|
+
mode,
|
1004
|
+
doc: doc2.contents
|
1005
|
+
});
|
1006
|
+
break;
|
1007
|
+
case DOC_TYPE_ALIGN:
|
1008
|
+
cmds.push({
|
1009
|
+
ind: makeAlign(ind, doc2.n, options),
|
1010
|
+
mode,
|
1011
|
+
doc: doc2.contents
|
1012
|
+
});
|
1013
|
+
break;
|
1014
|
+
case DOC_TYPE_TRIM:
|
1015
|
+
pos -= trim2(out);
|
1016
|
+
break;
|
1017
|
+
case DOC_TYPE_GROUP:
|
1018
|
+
switch (mode) {
|
1019
|
+
case MODE_FLAT:
|
1020
|
+
if (!shouldRemeasure) {
|
1021
|
+
cmds.push({
|
1022
|
+
ind,
|
1023
|
+
mode: doc2.break ? MODE_BREAK : MODE_FLAT,
|
1024
|
+
doc: doc2.contents
|
1025
|
+
});
|
1026
|
+
break;
|
1027
|
+
}
|
1028
|
+
case MODE_BREAK: {
|
1029
|
+
shouldRemeasure = false;
|
1030
|
+
const next = {
|
1031
|
+
ind,
|
1032
|
+
mode: MODE_FLAT,
|
1033
|
+
doc: doc2.contents
|
1034
|
+
};
|
1035
|
+
const rem = width - pos;
|
1036
|
+
const hasLineSuffix = lineSuffix2.length > 0;
|
1037
|
+
if (!doc2.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) {
|
1038
|
+
cmds.push(next);
|
1039
|
+
} else {
|
1040
|
+
if (doc2.expandedStates) {
|
1041
|
+
const mostExpanded = at_default(
|
1042
|
+
/* isOptionalObject */
|
1043
|
+
false,
|
1044
|
+
doc2.expandedStates,
|
1045
|
+
-1
|
1046
|
+
);
|
1047
|
+
if (doc2.break) {
|
1048
|
+
cmds.push({
|
1049
|
+
ind,
|
1050
|
+
mode: MODE_BREAK,
|
1051
|
+
doc: mostExpanded
|
1052
|
+
});
|
1053
|
+
break;
|
1054
|
+
} else {
|
1055
|
+
for (let i = 1; i < doc2.expandedStates.length + 1; i++) {
|
1056
|
+
if (i >= doc2.expandedStates.length) {
|
1057
|
+
cmds.push({
|
1058
|
+
ind,
|
1059
|
+
mode: MODE_BREAK,
|
1060
|
+
doc: mostExpanded
|
1061
|
+
});
|
1062
|
+
break;
|
1063
|
+
} else {
|
1064
|
+
const state = doc2.expandedStates[i];
|
1065
|
+
const cmd = {
|
1066
|
+
ind,
|
1067
|
+
mode: MODE_FLAT,
|
1068
|
+
doc: state
|
1069
|
+
};
|
1070
|
+
if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) {
|
1071
|
+
cmds.push(cmd);
|
1072
|
+
break;
|
1073
|
+
}
|
1074
|
+
}
|
1075
|
+
}
|
1076
|
+
}
|
1077
|
+
} else {
|
1078
|
+
cmds.push({
|
1079
|
+
ind,
|
1080
|
+
mode: MODE_BREAK,
|
1081
|
+
doc: doc2.contents
|
1082
|
+
});
|
1083
|
+
}
|
1084
|
+
}
|
1085
|
+
break;
|
1086
|
+
}
|
1087
|
+
}
|
1088
|
+
if (doc2.id) {
|
1089
|
+
groupModeMap[doc2.id] = at_default(
|
1090
|
+
/* isOptionalObject */
|
1091
|
+
false,
|
1092
|
+
cmds,
|
1093
|
+
-1
|
1094
|
+
).mode;
|
1095
|
+
}
|
1096
|
+
break;
|
1097
|
+
case DOC_TYPE_FILL: {
|
1098
|
+
const rem = width - pos;
|
1099
|
+
const {
|
1100
|
+
parts
|
1101
|
+
} = doc2;
|
1102
|
+
if (parts.length === 0) {
|
1103
|
+
break;
|
1104
|
+
}
|
1105
|
+
const [content, whitespace] = parts;
|
1106
|
+
const contentFlatCmd = {
|
1107
|
+
ind,
|
1108
|
+
mode: MODE_FLAT,
|
1109
|
+
doc: content
|
1110
|
+
};
|
1111
|
+
const contentBreakCmd = {
|
1112
|
+
ind,
|
1113
|
+
mode: MODE_BREAK,
|
1114
|
+
doc: content
|
1115
|
+
};
|
1116
|
+
const contentFits = fits(contentFlatCmd, [], rem, lineSuffix2.length > 0, groupModeMap, true);
|
1117
|
+
if (parts.length === 1) {
|
1118
|
+
if (contentFits) {
|
1119
|
+
cmds.push(contentFlatCmd);
|
1120
|
+
} else {
|
1121
|
+
cmds.push(contentBreakCmd);
|
1122
|
+
}
|
1123
|
+
break;
|
1124
|
+
}
|
1125
|
+
const whitespaceFlatCmd = {
|
1126
|
+
ind,
|
1127
|
+
mode: MODE_FLAT,
|
1128
|
+
doc: whitespace
|
1129
|
+
};
|
1130
|
+
const whitespaceBreakCmd = {
|
1131
|
+
ind,
|
1132
|
+
mode: MODE_BREAK,
|
1133
|
+
doc: whitespace
|
1134
|
+
};
|
1135
|
+
if (parts.length === 2) {
|
1136
|
+
if (contentFits) {
|
1137
|
+
cmds.push(whitespaceFlatCmd, contentFlatCmd);
|
1138
|
+
} else {
|
1139
|
+
cmds.push(whitespaceBreakCmd, contentBreakCmd);
|
1140
|
+
}
|
1141
|
+
break;
|
1142
|
+
}
|
1143
|
+
parts.splice(0, 2);
|
1144
|
+
const remainingCmd = {
|
1145
|
+
ind,
|
1146
|
+
mode,
|
1147
|
+
doc: fill(parts)
|
1148
|
+
};
|
1149
|
+
const secondContent = parts[0];
|
1150
|
+
const firstAndSecondContentFlatCmd = {
|
1151
|
+
ind,
|
1152
|
+
mode: MODE_FLAT,
|
1153
|
+
doc: [content, whitespace, secondContent]
|
1154
|
+
};
|
1155
|
+
const firstAndSecondContentFits = fits(firstAndSecondContentFlatCmd, [], rem, lineSuffix2.length > 0, groupModeMap, true);
|
1156
|
+
if (firstAndSecondContentFits) {
|
1157
|
+
cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd);
|
1158
|
+
} else if (contentFits) {
|
1159
|
+
cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd);
|
1160
|
+
} else {
|
1161
|
+
cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd);
|
1162
|
+
}
|
1163
|
+
break;
|
1164
|
+
}
|
1165
|
+
case DOC_TYPE_IF_BREAK:
|
1166
|
+
case DOC_TYPE_INDENT_IF_BREAK: {
|
1167
|
+
const groupMode = doc2.groupId ? groupModeMap[doc2.groupId] : mode;
|
1168
|
+
if (groupMode === MODE_BREAK) {
|
1169
|
+
const breakContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.breakContents : doc2.negate ? doc2.contents : indent(doc2.contents);
|
1170
|
+
if (breakContents) {
|
1171
|
+
cmds.push({
|
1172
|
+
ind,
|
1173
|
+
mode,
|
1174
|
+
doc: breakContents
|
1175
|
+
});
|
1176
|
+
}
|
1177
|
+
}
|
1178
|
+
if (groupMode === MODE_FLAT) {
|
1179
|
+
const flatContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.flatContents : doc2.negate ? indent(doc2.contents) : doc2.contents;
|
1180
|
+
if (flatContents) {
|
1181
|
+
cmds.push({
|
1182
|
+
ind,
|
1183
|
+
mode,
|
1184
|
+
doc: flatContents
|
1185
|
+
});
|
1186
|
+
}
|
1187
|
+
}
|
1188
|
+
break;
|
1189
|
+
}
|
1190
|
+
case DOC_TYPE_LINE_SUFFIX:
|
1191
|
+
lineSuffix2.push({
|
1192
|
+
ind,
|
1193
|
+
mode,
|
1194
|
+
doc: doc2.contents
|
1195
|
+
});
|
1196
|
+
break;
|
1197
|
+
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
1198
|
+
if (lineSuffix2.length > 0) {
|
1199
|
+
cmds.push({
|
1200
|
+
ind,
|
1201
|
+
mode,
|
1202
|
+
doc: hardlineWithoutBreakParent
|
1203
|
+
});
|
1204
|
+
}
|
1205
|
+
break;
|
1206
|
+
case DOC_TYPE_LINE:
|
1207
|
+
switch (mode) {
|
1208
|
+
case MODE_FLAT:
|
1209
|
+
if (!doc2.hard) {
|
1210
|
+
if (!doc2.soft) {
|
1211
|
+
out.push(" ");
|
1212
|
+
pos += 1;
|
1213
|
+
}
|
1214
|
+
break;
|
1215
|
+
} else {
|
1216
|
+
shouldRemeasure = true;
|
1217
|
+
}
|
1218
|
+
case MODE_BREAK:
|
1219
|
+
if (lineSuffix2.length > 0) {
|
1220
|
+
cmds.push({
|
1221
|
+
ind,
|
1222
|
+
mode,
|
1223
|
+
doc: doc2
|
1224
|
+
}, ...lineSuffix2.reverse());
|
1225
|
+
lineSuffix2.length = 0;
|
1226
|
+
break;
|
1227
|
+
}
|
1228
|
+
if (doc2.literal) {
|
1229
|
+
if (ind.root) {
|
1230
|
+
out.push(newLine, ind.root.value);
|
1231
|
+
pos = ind.root.length;
|
1232
|
+
} else {
|
1233
|
+
out.push(newLine);
|
1234
|
+
pos = 0;
|
1235
|
+
}
|
1236
|
+
} else {
|
1237
|
+
pos -= trim2(out);
|
1238
|
+
out.push(newLine + ind.value);
|
1239
|
+
pos = ind.length;
|
1240
|
+
}
|
1241
|
+
break;
|
1242
|
+
}
|
1243
|
+
break;
|
1244
|
+
case DOC_TYPE_LABEL:
|
1245
|
+
cmds.push({
|
1246
|
+
ind,
|
1247
|
+
mode,
|
1248
|
+
doc: doc2.contents
|
1249
|
+
});
|
1250
|
+
break;
|
1251
|
+
case DOC_TYPE_BREAK_PARENT:
|
1252
|
+
break;
|
1253
|
+
default:
|
1254
|
+
throw new invalid_doc_error_default(doc2);
|
1255
|
+
}
|
1256
|
+
if (cmds.length === 0 && lineSuffix2.length > 0) {
|
1257
|
+
cmds.push(...lineSuffix2.reverse());
|
1258
|
+
lineSuffix2.length = 0;
|
1259
|
+
}
|
1260
|
+
}
|
1261
|
+
const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER);
|
1262
|
+
if (cursorPlaceholderIndex !== -1) {
|
1263
|
+
const otherCursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER, cursorPlaceholderIndex + 1);
|
1264
|
+
const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
|
1265
|
+
const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join("");
|
1266
|
+
const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
|
1267
|
+
return {
|
1268
|
+
formatted: beforeCursor + aroundCursor + afterCursor,
|
1269
|
+
cursorNodeStart: beforeCursor.length,
|
1270
|
+
cursorNodeText: aroundCursor
|
1271
|
+
};
|
1272
|
+
}
|
1273
|
+
return {
|
1274
|
+
formatted: out.join("")
|
1275
|
+
};
|
1276
|
+
}
|
1277
|
+
|
1278
|
+
// src/document/public.js
|
1279
|
+
var builders = {
|
1280
|
+
join,
|
1281
|
+
line,
|
1282
|
+
softline,
|
1283
|
+
hardline,
|
1284
|
+
literalline,
|
1285
|
+
group,
|
1286
|
+
conditionalGroup,
|
1287
|
+
fill,
|
1288
|
+
lineSuffix,
|
1289
|
+
lineSuffixBoundary,
|
1290
|
+
cursor,
|
1291
|
+
breakParent,
|
1292
|
+
ifBreak,
|
1293
|
+
trim,
|
1294
|
+
indent,
|
1295
|
+
indentIfBreak,
|
1296
|
+
align,
|
1297
|
+
addAlignmentToDoc,
|
1298
|
+
markAsRoot,
|
1299
|
+
dedentToRoot,
|
1300
|
+
dedent,
|
1301
|
+
hardlineWithoutBreakParent,
|
1302
|
+
literallineWithoutBreakParent,
|
1303
|
+
label,
|
1304
|
+
// TODO: Remove this in v4
|
1305
|
+
concat: (parts) => parts
|
1306
|
+
};
|
1307
|
+
var printer = { printDocToString };
|
1308
|
+
var utils = {
|
1309
|
+
willBreak,
|
1310
|
+
traverseDoc: traverse_doc_default,
|
1311
|
+
findInDoc,
|
1312
|
+
mapDoc,
|
1313
|
+
removeLines,
|
1314
|
+
stripTrailingHardline,
|
1315
|
+
replaceEndOfLine,
|
1316
|
+
canBreak
|
1317
|
+
};
|
1318
|
+
return __toCommonJS(public_exports);
|
1319
|
+
});
|