@typespec/prettier-plugin-typespec 0.47.0-dev.0 → 0.47.0-dev.1

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/index.js CHANGED
@@ -1,934 +1,321 @@
1
1
  'use strict';
2
2
 
3
- var prettier = require('prettier');
3
+ /**
4
+ * AST types
5
+ */
6
+ var SyntaxKind;
7
+ (function (SyntaxKind) {
8
+ SyntaxKind[SyntaxKind["TypeSpecScript"] = 0] = "TypeSpecScript";
9
+ /** @deprecated Use TypeSpecScript */
10
+ SyntaxKind[SyntaxKind["CadlScript"] = 0] = "CadlScript";
11
+ SyntaxKind[SyntaxKind["JsSourceFile"] = 1] = "JsSourceFile";
12
+ SyntaxKind[SyntaxKind["ImportStatement"] = 2] = "ImportStatement";
13
+ SyntaxKind[SyntaxKind["Identifier"] = 3] = "Identifier";
14
+ SyntaxKind[SyntaxKind["AugmentDecoratorStatement"] = 4] = "AugmentDecoratorStatement";
15
+ SyntaxKind[SyntaxKind["DecoratorExpression"] = 5] = "DecoratorExpression";
16
+ SyntaxKind[SyntaxKind["DirectiveExpression"] = 6] = "DirectiveExpression";
17
+ SyntaxKind[SyntaxKind["MemberExpression"] = 7] = "MemberExpression";
18
+ SyntaxKind[SyntaxKind["NamespaceStatement"] = 8] = "NamespaceStatement";
19
+ SyntaxKind[SyntaxKind["UsingStatement"] = 9] = "UsingStatement";
20
+ SyntaxKind[SyntaxKind["OperationStatement"] = 10] = "OperationStatement";
21
+ SyntaxKind[SyntaxKind["OperationSignatureDeclaration"] = 11] = "OperationSignatureDeclaration";
22
+ SyntaxKind[SyntaxKind["OperationSignatureReference"] = 12] = "OperationSignatureReference";
23
+ SyntaxKind[SyntaxKind["ModelStatement"] = 13] = "ModelStatement";
24
+ SyntaxKind[SyntaxKind["ModelExpression"] = 14] = "ModelExpression";
25
+ SyntaxKind[SyntaxKind["ModelProperty"] = 15] = "ModelProperty";
26
+ SyntaxKind[SyntaxKind["ModelSpreadProperty"] = 16] = "ModelSpreadProperty";
27
+ SyntaxKind[SyntaxKind["ScalarStatement"] = 17] = "ScalarStatement";
28
+ SyntaxKind[SyntaxKind["InterfaceStatement"] = 18] = "InterfaceStatement";
29
+ SyntaxKind[SyntaxKind["UnionStatement"] = 19] = "UnionStatement";
30
+ SyntaxKind[SyntaxKind["UnionVariant"] = 20] = "UnionVariant";
31
+ SyntaxKind[SyntaxKind["EnumStatement"] = 21] = "EnumStatement";
32
+ SyntaxKind[SyntaxKind["EnumMember"] = 22] = "EnumMember";
33
+ SyntaxKind[SyntaxKind["EnumSpreadMember"] = 23] = "EnumSpreadMember";
34
+ SyntaxKind[SyntaxKind["AliasStatement"] = 24] = "AliasStatement";
35
+ SyntaxKind[SyntaxKind["DecoratorDeclarationStatement"] = 25] = "DecoratorDeclarationStatement";
36
+ SyntaxKind[SyntaxKind["FunctionDeclarationStatement"] = 26] = "FunctionDeclarationStatement";
37
+ SyntaxKind[SyntaxKind["FunctionParameter"] = 27] = "FunctionParameter";
38
+ SyntaxKind[SyntaxKind["UnionExpression"] = 28] = "UnionExpression";
39
+ SyntaxKind[SyntaxKind["IntersectionExpression"] = 29] = "IntersectionExpression";
40
+ SyntaxKind[SyntaxKind["TupleExpression"] = 30] = "TupleExpression";
41
+ SyntaxKind[SyntaxKind["ArrayExpression"] = 31] = "ArrayExpression";
42
+ SyntaxKind[SyntaxKind["StringLiteral"] = 32] = "StringLiteral";
43
+ SyntaxKind[SyntaxKind["NumericLiteral"] = 33] = "NumericLiteral";
44
+ SyntaxKind[SyntaxKind["BooleanLiteral"] = 34] = "BooleanLiteral";
45
+ SyntaxKind[SyntaxKind["ExternKeyword"] = 35] = "ExternKeyword";
46
+ SyntaxKind[SyntaxKind["VoidKeyword"] = 36] = "VoidKeyword";
47
+ SyntaxKind[SyntaxKind["NeverKeyword"] = 37] = "NeverKeyword";
48
+ SyntaxKind[SyntaxKind["UnknownKeyword"] = 38] = "UnknownKeyword";
49
+ SyntaxKind[SyntaxKind["ValueOfExpression"] = 39] = "ValueOfExpression";
50
+ SyntaxKind[SyntaxKind["TypeReference"] = 40] = "TypeReference";
51
+ SyntaxKind[SyntaxKind["ProjectionReference"] = 41] = "ProjectionReference";
52
+ SyntaxKind[SyntaxKind["TemplateParameterDeclaration"] = 42] = "TemplateParameterDeclaration";
53
+ SyntaxKind[SyntaxKind["EmptyStatement"] = 43] = "EmptyStatement";
54
+ SyntaxKind[SyntaxKind["InvalidStatement"] = 44] = "InvalidStatement";
55
+ SyntaxKind[SyntaxKind["LineComment"] = 45] = "LineComment";
56
+ SyntaxKind[SyntaxKind["BlockComment"] = 46] = "BlockComment";
57
+ SyntaxKind[SyntaxKind["Doc"] = 47] = "Doc";
58
+ SyntaxKind[SyntaxKind["DocText"] = 48] = "DocText";
59
+ SyntaxKind[SyntaxKind["DocParamTag"] = 49] = "DocParamTag";
60
+ SyntaxKind[SyntaxKind["DocReturnsTag"] = 50] = "DocReturnsTag";
61
+ SyntaxKind[SyntaxKind["DocTemplateTag"] = 51] = "DocTemplateTag";
62
+ SyntaxKind[SyntaxKind["DocUnknownTag"] = 52] = "DocUnknownTag";
63
+ SyntaxKind[SyntaxKind["Projection"] = 53] = "Projection";
64
+ SyntaxKind[SyntaxKind["ProjectionParameterDeclaration"] = 54] = "ProjectionParameterDeclaration";
65
+ SyntaxKind[SyntaxKind["ProjectionModelSelector"] = 55] = "ProjectionModelSelector";
66
+ SyntaxKind[SyntaxKind["ProjectionModelPropertySelector"] = 56] = "ProjectionModelPropertySelector";
67
+ SyntaxKind[SyntaxKind["ProjectionOperationSelector"] = 57] = "ProjectionOperationSelector";
68
+ SyntaxKind[SyntaxKind["ProjectionUnionSelector"] = 58] = "ProjectionUnionSelector";
69
+ SyntaxKind[SyntaxKind["ProjectionUnionVariantSelector"] = 59] = "ProjectionUnionVariantSelector";
70
+ SyntaxKind[SyntaxKind["ProjectionInterfaceSelector"] = 60] = "ProjectionInterfaceSelector";
71
+ SyntaxKind[SyntaxKind["ProjectionEnumSelector"] = 61] = "ProjectionEnumSelector";
72
+ SyntaxKind[SyntaxKind["ProjectionEnumMemberSelector"] = 62] = "ProjectionEnumMemberSelector";
73
+ SyntaxKind[SyntaxKind["ProjectionExpressionStatement"] = 63] = "ProjectionExpressionStatement";
74
+ SyntaxKind[SyntaxKind["ProjectionIfExpression"] = 64] = "ProjectionIfExpression";
75
+ SyntaxKind[SyntaxKind["ProjectionBlockExpression"] = 65] = "ProjectionBlockExpression";
76
+ SyntaxKind[SyntaxKind["ProjectionMemberExpression"] = 66] = "ProjectionMemberExpression";
77
+ SyntaxKind[SyntaxKind["ProjectionLogicalExpression"] = 67] = "ProjectionLogicalExpression";
78
+ SyntaxKind[SyntaxKind["ProjectionEqualityExpression"] = 68] = "ProjectionEqualityExpression";
79
+ SyntaxKind[SyntaxKind["ProjectionUnaryExpression"] = 69] = "ProjectionUnaryExpression";
80
+ SyntaxKind[SyntaxKind["ProjectionRelationalExpression"] = 70] = "ProjectionRelationalExpression";
81
+ SyntaxKind[SyntaxKind["ProjectionArithmeticExpression"] = 71] = "ProjectionArithmeticExpression";
82
+ SyntaxKind[SyntaxKind["ProjectionCallExpression"] = 72] = "ProjectionCallExpression";
83
+ SyntaxKind[SyntaxKind["ProjectionLambdaExpression"] = 73] = "ProjectionLambdaExpression";
84
+ SyntaxKind[SyntaxKind["ProjectionLambdaParameterDeclaration"] = 74] = "ProjectionLambdaParameterDeclaration";
85
+ SyntaxKind[SyntaxKind["ProjectionModelExpression"] = 75] = "ProjectionModelExpression";
86
+ SyntaxKind[SyntaxKind["ProjectionModelProperty"] = 76] = "ProjectionModelProperty";
87
+ SyntaxKind[SyntaxKind["ProjectionModelSpreadProperty"] = 77] = "ProjectionModelSpreadProperty";
88
+ SyntaxKind[SyntaxKind["ProjectionSpreadProperty"] = 78] = "ProjectionSpreadProperty";
89
+ SyntaxKind[SyntaxKind["ProjectionTupleExpression"] = 79] = "ProjectionTupleExpression";
90
+ SyntaxKind[SyntaxKind["ProjectionStatement"] = 80] = "ProjectionStatement";
91
+ SyntaxKind[SyntaxKind["ProjectionDecoratorReferenceExpression"] = 81] = "ProjectionDecoratorReferenceExpression";
92
+ SyntaxKind[SyntaxKind["Return"] = 82] = "Return";
93
+ })(SyntaxKind || (SyntaxKind = {}));
94
+ var IdentifierKind;
95
+ (function (IdentifierKind) {
96
+ IdentifierKind[IdentifierKind["TypeReference"] = 0] = "TypeReference";
97
+ IdentifierKind[IdentifierKind["Decorator"] = 1] = "Decorator";
98
+ IdentifierKind[IdentifierKind["Function"] = 2] = "Function";
99
+ IdentifierKind[IdentifierKind["Using"] = 3] = "Using";
100
+ IdentifierKind[IdentifierKind["Declaration"] = 4] = "Declaration";
101
+ IdentifierKind[IdentifierKind["Other"] = 5] = "Other";
102
+ })(IdentifierKind || (IdentifierKind = {}));
103
+ const NoTarget = Symbol.for("NoTarget");
104
+ var ListenerFlow;
105
+ (function (ListenerFlow) {
106
+ /**
107
+ * Do not navigate any containing or referenced type.
108
+ */
109
+ ListenerFlow[ListenerFlow["NoRecursion"] = 1] = "NoRecursion";
110
+ })(ListenerFlow || (ListenerFlow = {}));
4
111
 
5
- //
6
- // Generated by scripts/regen-nonascii-map.js
7
- // on node v18.16.0 with unicode 15.0.
8
- //
9
112
  /**
10
- * @internal
113
+ * Create a new diagnostics creator.
114
+ * @param diagnostics Map of the potential diagnostics.
115
+ * @param libraryName Optional name of the library if in the scope of a library.
116
+ * @returns @see DiagnosticCreator
117
+ */
118
+ function createDiagnosticCreator(diagnostics, libraryName) {
119
+ const errorMessage = libraryName
120
+ ? `It must match one of the code defined in the library '${libraryName}'`
121
+ : "It must match one of the code defined in the compiler.";
122
+ function createDiagnostic(diagnostic) {
123
+ var _a;
124
+ const diagnosticDef = diagnostics[diagnostic.code];
125
+ if (!diagnosticDef) {
126
+ const codeStr = Object.keys(diagnostics)
127
+ .map((x) => ` - ${x}`)
128
+ .join("\n");
129
+ const code = String(diagnostic.code);
130
+ throw new Error(`Unexpected diagnostic code '${code}'. ${errorMessage}. Defined codes:\n${codeStr}`);
131
+ }
132
+ const message = diagnosticDef.messages[(_a = diagnostic.messageId) !== null && _a !== void 0 ? _a : "default"];
133
+ if (!message) {
134
+ const codeStr = Object.keys(diagnosticDef.messages)
135
+ .map((x) => ` - ${x}`)
136
+ .join("\n");
137
+ const messageId = String(diagnostic.messageId);
138
+ const code = String(diagnostic.code);
139
+ throw new Error(`Unexpected message id '${messageId}'. ${errorMessage} for code '${code}'. Defined codes:\n${codeStr}`);
140
+ }
141
+ const messageStr = typeof message === "string" ? message : message(diagnostic.format);
142
+ return {
143
+ code: libraryName ? `${libraryName}/${String(diagnostic.code)}` : diagnostic.code.toString(),
144
+ severity: diagnosticDef.severity,
145
+ message: messageStr,
146
+ target: diagnostic.target,
147
+ };
148
+ }
149
+ function reportDiagnostic(program, diagnostic) {
150
+ const diag = createDiagnostic(diagnostic);
151
+ program.reportDiagnostic(diag);
152
+ }
153
+ return {
154
+ diagnostics,
155
+ createDiagnostic,
156
+ reportDiagnostic,
157
+ };
158
+ }
159
+ function createSourceFile(text, path) {
160
+ let lineStarts = undefined;
161
+ return {
162
+ text,
163
+ path,
164
+ getLineStarts,
165
+ getLineAndCharacterOfPosition,
166
+ };
167
+ function getLineStarts() {
168
+ return (lineStarts = lineStarts !== null && lineStarts !== void 0 ? lineStarts : scanLineStarts(text));
169
+ }
170
+ function getLineAndCharacterOfPosition(position) {
171
+ const starts = getLineStarts();
172
+ let line = binarySearch(starts, position);
173
+ // When binarySearch returns < 0 indicating that the value was not found, it
174
+ // returns the bitwise complement of the index where the value would need to
175
+ // be inserted to keep the array sorted. So flipping the bits back to this
176
+ // positive index tells us what the line number would be if we were to
177
+ // create a new line starting at the given position, and subtracting 1 from
178
+ // that therefore gives us the line number we're after.
179
+ if (line < 0) {
180
+ line = ~line - 1;
181
+ }
182
+ return {
183
+ line,
184
+ character: position - starts[line],
185
+ };
186
+ }
187
+ }
188
+ function getSourceLocation(target) {
189
+ if (target === NoTarget || target === undefined) {
190
+ return undefined;
191
+ }
192
+ if ("file" in target) {
193
+ return target;
194
+ }
195
+ if (!("kind" in target)) {
196
+ // symbol
197
+ if (target.flags & 524288 /* SymbolFlags.Using */) {
198
+ target = target.symbolSource;
199
+ }
200
+ if (!target.declarations[0]) {
201
+ return createSyntheticSourceLocation();
202
+ }
203
+ return getSourceLocationOfNode(target.declarations[0]);
204
+ }
205
+ else if (typeof target.kind === "number") {
206
+ // node
207
+ return getSourceLocationOfNode(target);
208
+ }
209
+ else {
210
+ // type
211
+ const targetNode = target.node;
212
+ if (targetNode) {
213
+ return getSourceLocationOfNode(targetNode);
214
+ }
215
+ return createSyntheticSourceLocation();
216
+ }
217
+ }
218
+ function createSyntheticSourceLocation(loc = "<unknown location>") {
219
+ return {
220
+ file: createSourceFile("", loc),
221
+ pos: 0,
222
+ end: 0,
223
+ isSynthetic: true,
224
+ };
225
+ }
226
+ function getSourceLocationOfNode(node) {
227
+ let root = node;
228
+ while (root.parent !== undefined) {
229
+ root = root.parent;
230
+ }
231
+ if (root.kind !== SyntaxKind.TypeSpecScript && root.kind !== SyntaxKind.JsSourceFile) {
232
+ return createSyntheticSourceLocation(node.flags & 8 /* NodeFlags.Synthetic */
233
+ ? undefined
234
+ : "<unknown location - cannot obtain source location of unbound node - file bug at https://github.com/microsoft/typespec>");
235
+ }
236
+ return {
237
+ file: root.file,
238
+ pos: node.pos,
239
+ end: node.end,
240
+ };
241
+ }
242
+ /**
243
+ * Use this to report bugs in the compiler, and not errors in the source code
244
+ * being compiled.
11
245
  *
12
- * Map of non-ascii characters that are valid in an identifier. Each pair of
13
- * numbers represents an inclusive range of code points.
246
+ * @param condition Throw if this is not true.
247
+ *
248
+ * @param message Error message.
249
+ *
250
+ * @param target Optional location in source code that might give a clue about
251
+ * what got the compiler off track.
14
252
  */
15
- //prettier-ignore
16
- const nonAsciiIdentifierMap = [
17
- 0xa0, 0x377,
18
- 0x37a, 0x37f,
19
- 0x384, 0x38a,
20
- 0x38c, 0x38c,
21
- 0x38e, 0x3a1,
22
- 0x3a3, 0x52f,
23
- 0x531, 0x556,
24
- 0x559, 0x58a,
25
- 0x58d, 0x58f,
26
- 0x591, 0x5c7,
27
- 0x5d0, 0x5ea,
28
- 0x5ef, 0x5f4,
29
- 0x600, 0x70d,
30
- 0x70f, 0x74a,
31
- 0x74d, 0x7b1,
32
- 0x7c0, 0x7fa,
33
- 0x7fd, 0x82d,
34
- 0x830, 0x83e,
35
- 0x840, 0x85b,
36
- 0x85e, 0x85e,
37
- 0x860, 0x86a,
38
- 0x870, 0x88e,
39
- 0x890, 0x891,
40
- 0x898, 0x983,
41
- 0x985, 0x98c,
42
- 0x98f, 0x990,
43
- 0x993, 0x9a8,
44
- 0x9aa, 0x9b0,
45
- 0x9b2, 0x9b2,
46
- 0x9b6, 0x9b9,
47
- 0x9bc, 0x9c4,
48
- 0x9c7, 0x9c8,
49
- 0x9cb, 0x9ce,
50
- 0x9d7, 0x9d7,
51
- 0x9dc, 0x9dd,
52
- 0x9df, 0x9e3,
53
- 0x9e6, 0x9fe,
54
- 0xa01, 0xa03,
55
- 0xa05, 0xa0a,
56
- 0xa0f, 0xa10,
57
- 0xa13, 0xa28,
58
- 0xa2a, 0xa30,
59
- 0xa32, 0xa33,
60
- 0xa35, 0xa36,
61
- 0xa38, 0xa39,
62
- 0xa3c, 0xa3c,
63
- 0xa3e, 0xa42,
64
- 0xa47, 0xa48,
65
- 0xa4b, 0xa4d,
66
- 0xa51, 0xa51,
67
- 0xa59, 0xa5c,
68
- 0xa5e, 0xa5e,
69
- 0xa66, 0xa76,
70
- 0xa81, 0xa83,
71
- 0xa85, 0xa8d,
72
- 0xa8f, 0xa91,
73
- 0xa93, 0xaa8,
74
- 0xaaa, 0xab0,
75
- 0xab2, 0xab3,
76
- 0xab5, 0xab9,
77
- 0xabc, 0xac5,
78
- 0xac7, 0xac9,
79
- 0xacb, 0xacd,
80
- 0xad0, 0xad0,
81
- 0xae0, 0xae3,
82
- 0xae6, 0xaf1,
83
- 0xaf9, 0xaff,
84
- 0xb01, 0xb03,
85
- 0xb05, 0xb0c,
86
- 0xb0f, 0xb10,
87
- 0xb13, 0xb28,
88
- 0xb2a, 0xb30,
89
- 0xb32, 0xb33,
90
- 0xb35, 0xb39,
91
- 0xb3c, 0xb44,
92
- 0xb47, 0xb48,
93
- 0xb4b, 0xb4d,
94
- 0xb55, 0xb57,
95
- 0xb5c, 0xb5d,
96
- 0xb5f, 0xb63,
97
- 0xb66, 0xb77,
98
- 0xb82, 0xb83,
99
- 0xb85, 0xb8a,
100
- 0xb8e, 0xb90,
101
- 0xb92, 0xb95,
102
- 0xb99, 0xb9a,
103
- 0xb9c, 0xb9c,
104
- 0xb9e, 0xb9f,
105
- 0xba3, 0xba4,
106
- 0xba8, 0xbaa,
107
- 0xbae, 0xbb9,
108
- 0xbbe, 0xbc2,
109
- 0xbc6, 0xbc8,
110
- 0xbca, 0xbcd,
111
- 0xbd0, 0xbd0,
112
- 0xbd7, 0xbd7,
113
- 0xbe6, 0xbfa,
114
- 0xc00, 0xc0c,
115
- 0xc0e, 0xc10,
116
- 0xc12, 0xc28,
117
- 0xc2a, 0xc39,
118
- 0xc3c, 0xc44,
119
- 0xc46, 0xc48,
120
- 0xc4a, 0xc4d,
121
- 0xc55, 0xc56,
122
- 0xc58, 0xc5a,
123
- 0xc5d, 0xc5d,
124
- 0xc60, 0xc63,
125
- 0xc66, 0xc6f,
126
- 0xc77, 0xc8c,
127
- 0xc8e, 0xc90,
128
- 0xc92, 0xca8,
129
- 0xcaa, 0xcb3,
130
- 0xcb5, 0xcb9,
131
- 0xcbc, 0xcc4,
132
- 0xcc6, 0xcc8,
133
- 0xcca, 0xccd,
134
- 0xcd5, 0xcd6,
135
- 0xcdd, 0xcde,
136
- 0xce0, 0xce3,
137
- 0xce6, 0xcef,
138
- 0xcf1, 0xcf3,
139
- 0xd00, 0xd0c,
140
- 0xd0e, 0xd10,
141
- 0xd12, 0xd44,
142
- 0xd46, 0xd48,
143
- 0xd4a, 0xd4f,
144
- 0xd54, 0xd63,
145
- 0xd66, 0xd7f,
146
- 0xd81, 0xd83,
147
- 0xd85, 0xd96,
148
- 0xd9a, 0xdb1,
149
- 0xdb3, 0xdbb,
150
- 0xdbd, 0xdbd,
151
- 0xdc0, 0xdc6,
152
- 0xdca, 0xdca,
153
- 0xdcf, 0xdd4,
154
- 0xdd6, 0xdd6,
155
- 0xdd8, 0xddf,
156
- 0xde6, 0xdef,
157
- 0xdf2, 0xdf4,
158
- 0xe01, 0xe3a,
159
- 0xe3f, 0xe5b,
160
- 0xe81, 0xe82,
161
- 0xe84, 0xe84,
162
- 0xe86, 0xe8a,
163
- 0xe8c, 0xea3,
164
- 0xea5, 0xea5,
165
- 0xea7, 0xebd,
166
- 0xec0, 0xec4,
167
- 0xec6, 0xec6,
168
- 0xec8, 0xece,
169
- 0xed0, 0xed9,
170
- 0xedc, 0xedf,
171
- 0xf00, 0xf47,
172
- 0xf49, 0xf6c,
173
- 0xf71, 0xf97,
174
- 0xf99, 0xfbc,
175
- 0xfbe, 0xfcc,
176
- 0xfce, 0xfda,
177
- 0x1000, 0x10c5,
178
- 0x10c7, 0x10c7,
179
- 0x10cd, 0x10cd,
180
- 0x10d0, 0x1248,
181
- 0x124a, 0x124d,
182
- 0x1250, 0x1256,
183
- 0x1258, 0x1258,
184
- 0x125a, 0x125d,
185
- 0x1260, 0x1288,
186
- 0x128a, 0x128d,
187
- 0x1290, 0x12b0,
188
- 0x12b2, 0x12b5,
189
- 0x12b8, 0x12be,
190
- 0x12c0, 0x12c0,
191
- 0x12c2, 0x12c5,
192
- 0x12c8, 0x12d6,
193
- 0x12d8, 0x1310,
194
- 0x1312, 0x1315,
195
- 0x1318, 0x135a,
196
- 0x135d, 0x137c,
197
- 0x1380, 0x1399,
198
- 0x13a0, 0x13f5,
199
- 0x13f8, 0x13fd,
200
- 0x1400, 0x169c,
201
- 0x16a0, 0x16f8,
202
- 0x1700, 0x1715,
203
- 0x171f, 0x1736,
204
- 0x1740, 0x1753,
205
- 0x1760, 0x176c,
206
- 0x176e, 0x1770,
207
- 0x1772, 0x1773,
208
- 0x1780, 0x17dd,
209
- 0x17e0, 0x17e9,
210
- 0x17f0, 0x17f9,
211
- 0x1800, 0x1819,
212
- 0x1820, 0x1878,
213
- 0x1880, 0x18aa,
214
- 0x18b0, 0x18f5,
215
- 0x1900, 0x191e,
216
- 0x1920, 0x192b,
217
- 0x1930, 0x193b,
218
- 0x1940, 0x1940,
219
- 0x1944, 0x196d,
220
- 0x1970, 0x1974,
221
- 0x1980, 0x19ab,
222
- 0x19b0, 0x19c9,
223
- 0x19d0, 0x19da,
224
- 0x19de, 0x1a1b,
225
- 0x1a1e, 0x1a5e,
226
- 0x1a60, 0x1a7c,
227
- 0x1a7f, 0x1a89,
228
- 0x1a90, 0x1a99,
229
- 0x1aa0, 0x1aad,
230
- 0x1ab0, 0x1ace,
231
- 0x1b00, 0x1b4c,
232
- 0x1b50, 0x1b7e,
233
- 0x1b80, 0x1bf3,
234
- 0x1bfc, 0x1c37,
235
- 0x1c3b, 0x1c49,
236
- 0x1c4d, 0x1c88,
237
- 0x1c90, 0x1cba,
238
- 0x1cbd, 0x1cc7,
239
- 0x1cd0, 0x1cfa,
240
- 0x1d00, 0x1f15,
241
- 0x1f18, 0x1f1d,
242
- 0x1f20, 0x1f45,
243
- 0x1f48, 0x1f4d,
244
- 0x1f50, 0x1f57,
245
- 0x1f59, 0x1f59,
246
- 0x1f5b, 0x1f5b,
247
- 0x1f5d, 0x1f5d,
248
- 0x1f5f, 0x1f7d,
249
- 0x1f80, 0x1fb4,
250
- 0x1fb6, 0x1fc4,
251
- 0x1fc6, 0x1fd3,
252
- 0x1fd6, 0x1fdb,
253
- 0x1fdd, 0x1fef,
254
- 0x1ff2, 0x1ff4,
255
- 0x1ff6, 0x1ffe,
256
- 0x2000, 0x200d,
257
- 0x2010, 0x2027,
258
- 0x202a, 0x2064,
259
- 0x2066, 0x2071,
260
- 0x2074, 0x208e,
261
- 0x2090, 0x209c,
262
- 0x20a0, 0x20c0,
263
- 0x20d0, 0x20f0,
264
- 0x2100, 0x218b,
265
- 0x2190, 0x2426,
266
- 0x2440, 0x244a,
267
- 0x2460, 0x2b73,
268
- 0x2b76, 0x2b95,
269
- 0x2b97, 0x2cf3,
270
- 0x2cf9, 0x2d25,
271
- 0x2d27, 0x2d27,
272
- 0x2d2d, 0x2d2d,
273
- 0x2d30, 0x2d67,
274
- 0x2d6f, 0x2d70,
275
- 0x2d7f, 0x2d96,
276
- 0x2da0, 0x2da6,
277
- 0x2da8, 0x2dae,
278
- 0x2db0, 0x2db6,
279
- 0x2db8, 0x2dbe,
280
- 0x2dc0, 0x2dc6,
281
- 0x2dc8, 0x2dce,
282
- 0x2dd0, 0x2dd6,
283
- 0x2dd8, 0x2dde,
284
- 0x2de0, 0x2e5d,
285
- 0x2e80, 0x2e99,
286
- 0x2e9b, 0x2ef3,
287
- 0x2f00, 0x2fd5,
288
- 0x2ff0, 0x2ffb,
289
- 0x3000, 0x303f,
290
- 0x3041, 0x3096,
291
- 0x3099, 0x30ff,
292
- 0x3105, 0x312f,
293
- 0x3131, 0x318e,
294
- 0x3190, 0x31e3,
295
- 0x31f0, 0x321e,
296
- 0x3220, 0xa48c,
297
- 0xa490, 0xa4c6,
298
- 0xa4d0, 0xa62b,
299
- 0xa640, 0xa6f7,
300
- 0xa700, 0xa7ca,
301
- 0xa7d0, 0xa7d1,
302
- 0xa7d3, 0xa7d3,
303
- 0xa7d5, 0xa7d9,
304
- 0xa7f2, 0xa82c,
305
- 0xa830, 0xa839,
306
- 0xa840, 0xa877,
307
- 0xa880, 0xa8c5,
308
- 0xa8ce, 0xa8d9,
309
- 0xa8e0, 0xa953,
310
- 0xa95f, 0xa97c,
311
- 0xa980, 0xa9cd,
312
- 0xa9cf, 0xa9d9,
313
- 0xa9de, 0xa9fe,
314
- 0xaa00, 0xaa36,
315
- 0xaa40, 0xaa4d,
316
- 0xaa50, 0xaa59,
317
- 0xaa5c, 0xaac2,
318
- 0xaadb, 0xaaf6,
319
- 0xab01, 0xab06,
320
- 0xab09, 0xab0e,
321
- 0xab11, 0xab16,
322
- 0xab20, 0xab26,
323
- 0xab28, 0xab2e,
324
- 0xab30, 0xab6b,
325
- 0xab70, 0xabed,
326
- 0xabf0, 0xabf9,
327
- 0xac00, 0xd7a3,
328
- 0xd7b0, 0xd7c6,
329
- 0xd7cb, 0xd7fb,
330
- 0xf900, 0xfa6d,
331
- 0xfa70, 0xfad9,
332
- 0xfb00, 0xfb06,
333
- 0xfb13, 0xfb17,
334
- 0xfb1d, 0xfb36,
335
- 0xfb38, 0xfb3c,
336
- 0xfb3e, 0xfb3e,
337
- 0xfb40, 0xfb41,
338
- 0xfb43, 0xfb44,
339
- 0xfb46, 0xfbc2,
340
- 0xfbd3, 0xfd8f,
341
- 0xfd92, 0xfdc7,
342
- 0xfdcf, 0xfdcf,
343
- 0xfdf0, 0xfe19,
344
- 0xfe20, 0xfe52,
345
- 0xfe54, 0xfe66,
346
- 0xfe68, 0xfe6b,
347
- 0xfe70, 0xfe74,
348
- 0xfe76, 0xfefc,
349
- 0xfeff, 0xfeff,
350
- 0xff01, 0xffbe,
351
- 0xffc2, 0xffc7,
352
- 0xffca, 0xffcf,
353
- 0xffd2, 0xffd7,
354
- 0xffda, 0xffdc,
355
- 0xffe0, 0xffe6,
356
- 0xffe8, 0xffee,
357
- 0xfff9, 0xfffc,
358
- 0x10000, 0x1000b,
359
- 0x1000d, 0x10026,
360
- 0x10028, 0x1003a,
361
- 0x1003c, 0x1003d,
362
- 0x1003f, 0x1004d,
363
- 0x10050, 0x1005d,
364
- 0x10080, 0x100fa,
365
- 0x10100, 0x10102,
366
- 0x10107, 0x10133,
367
- 0x10137, 0x1018e,
368
- 0x10190, 0x1019c,
369
- 0x101a0, 0x101a0,
370
- 0x101d0, 0x101fd,
371
- 0x10280, 0x1029c,
372
- 0x102a0, 0x102d0,
373
- 0x102e0, 0x102fb,
374
- 0x10300, 0x10323,
375
- 0x1032d, 0x1034a,
376
- 0x10350, 0x1037a,
377
- 0x10380, 0x1039d,
378
- 0x1039f, 0x103c3,
379
- 0x103c8, 0x103d5,
380
- 0x10400, 0x1049d,
381
- 0x104a0, 0x104a9,
382
- 0x104b0, 0x104d3,
383
- 0x104d8, 0x104fb,
384
- 0x10500, 0x10527,
385
- 0x10530, 0x10563,
386
- 0x1056f, 0x1057a,
387
- 0x1057c, 0x1058a,
388
- 0x1058c, 0x10592,
389
- 0x10594, 0x10595,
390
- 0x10597, 0x105a1,
391
- 0x105a3, 0x105b1,
392
- 0x105b3, 0x105b9,
393
- 0x105bb, 0x105bc,
394
- 0x10600, 0x10736,
395
- 0x10740, 0x10755,
396
- 0x10760, 0x10767,
397
- 0x10780, 0x10785,
398
- 0x10787, 0x107b0,
399
- 0x107b2, 0x107ba,
400
- 0x10800, 0x10805,
401
- 0x10808, 0x10808,
402
- 0x1080a, 0x10835,
403
- 0x10837, 0x10838,
404
- 0x1083c, 0x1083c,
405
- 0x1083f, 0x10855,
406
- 0x10857, 0x1089e,
407
- 0x108a7, 0x108af,
408
- 0x108e0, 0x108f2,
409
- 0x108f4, 0x108f5,
410
- 0x108fb, 0x1091b,
411
- 0x1091f, 0x10939,
412
- 0x1093f, 0x1093f,
413
- 0x10980, 0x109b7,
414
- 0x109bc, 0x109cf,
415
- 0x109d2, 0x10a03,
416
- 0x10a05, 0x10a06,
417
- 0x10a0c, 0x10a13,
418
- 0x10a15, 0x10a17,
419
- 0x10a19, 0x10a35,
420
- 0x10a38, 0x10a3a,
421
- 0x10a3f, 0x10a48,
422
- 0x10a50, 0x10a58,
423
- 0x10a60, 0x10a9f,
424
- 0x10ac0, 0x10ae6,
425
- 0x10aeb, 0x10af6,
426
- 0x10b00, 0x10b35,
427
- 0x10b39, 0x10b55,
428
- 0x10b58, 0x10b72,
429
- 0x10b78, 0x10b91,
430
- 0x10b99, 0x10b9c,
431
- 0x10ba9, 0x10baf,
432
- 0x10c00, 0x10c48,
433
- 0x10c80, 0x10cb2,
434
- 0x10cc0, 0x10cf2,
435
- 0x10cfa, 0x10d27,
436
- 0x10d30, 0x10d39,
437
- 0x10e60, 0x10e7e,
438
- 0x10e80, 0x10ea9,
439
- 0x10eab, 0x10ead,
440
- 0x10eb0, 0x10eb1,
441
- 0x10efd, 0x10f27,
442
- 0x10f30, 0x10f59,
443
- 0x10f70, 0x10f89,
444
- 0x10fb0, 0x10fcb,
445
- 0x10fe0, 0x10ff6,
446
- 0x11000, 0x1104d,
447
- 0x11052, 0x11075,
448
- 0x1107f, 0x110c2,
449
- 0x110cd, 0x110cd,
450
- 0x110d0, 0x110e8,
451
- 0x110f0, 0x110f9,
452
- 0x11100, 0x11134,
453
- 0x11136, 0x11147,
454
- 0x11150, 0x11176,
455
- 0x11180, 0x111df,
456
- 0x111e1, 0x111f4,
457
- 0x11200, 0x11211,
458
- 0x11213, 0x11241,
459
- 0x11280, 0x11286,
460
- 0x11288, 0x11288,
461
- 0x1128a, 0x1128d,
462
- 0x1128f, 0x1129d,
463
- 0x1129f, 0x112a9,
464
- 0x112b0, 0x112ea,
465
- 0x112f0, 0x112f9,
466
- 0x11300, 0x11303,
467
- 0x11305, 0x1130c,
468
- 0x1130f, 0x11310,
469
- 0x11313, 0x11328,
470
- 0x1132a, 0x11330,
471
- 0x11332, 0x11333,
472
- 0x11335, 0x11339,
473
- 0x1133b, 0x11344,
474
- 0x11347, 0x11348,
475
- 0x1134b, 0x1134d,
476
- 0x11350, 0x11350,
477
- 0x11357, 0x11357,
478
- 0x1135d, 0x11363,
479
- 0x11366, 0x1136c,
480
- 0x11370, 0x11374,
481
- 0x11400, 0x1145b,
482
- 0x1145d, 0x11461,
483
- 0x11480, 0x114c7,
484
- 0x114d0, 0x114d9,
485
- 0x11580, 0x115b5,
486
- 0x115b8, 0x115dd,
487
- 0x11600, 0x11644,
488
- 0x11650, 0x11659,
489
- 0x11660, 0x1166c,
490
- 0x11680, 0x116b9,
491
- 0x116c0, 0x116c9,
492
- 0x11700, 0x1171a,
493
- 0x1171d, 0x1172b,
494
- 0x11730, 0x11746,
495
- 0x11800, 0x1183b,
496
- 0x118a0, 0x118f2,
497
- 0x118ff, 0x11906,
498
- 0x11909, 0x11909,
499
- 0x1190c, 0x11913,
500
- 0x11915, 0x11916,
501
- 0x11918, 0x11935,
502
- 0x11937, 0x11938,
503
- 0x1193b, 0x11946,
504
- 0x11950, 0x11959,
505
- 0x119a0, 0x119a7,
506
- 0x119aa, 0x119d7,
507
- 0x119da, 0x119e4,
508
- 0x11a00, 0x11a47,
509
- 0x11a50, 0x11aa2,
510
- 0x11ab0, 0x11af8,
511
- 0x11b00, 0x11b09,
512
- 0x11c00, 0x11c08,
513
- 0x11c0a, 0x11c36,
514
- 0x11c38, 0x11c45,
515
- 0x11c50, 0x11c6c,
516
- 0x11c70, 0x11c8f,
517
- 0x11c92, 0x11ca7,
518
- 0x11ca9, 0x11cb6,
519
- 0x11d00, 0x11d06,
520
- 0x11d08, 0x11d09,
521
- 0x11d0b, 0x11d36,
522
- 0x11d3a, 0x11d3a,
523
- 0x11d3c, 0x11d3d,
524
- 0x11d3f, 0x11d47,
525
- 0x11d50, 0x11d59,
526
- 0x11d60, 0x11d65,
527
- 0x11d67, 0x11d68,
528
- 0x11d6a, 0x11d8e,
529
- 0x11d90, 0x11d91,
530
- 0x11d93, 0x11d98,
531
- 0x11da0, 0x11da9,
532
- 0x11ee0, 0x11ef8,
533
- 0x11f00, 0x11f10,
534
- 0x11f12, 0x11f3a,
535
- 0x11f3e, 0x11f59,
536
- 0x11fb0, 0x11fb0,
537
- 0x11fc0, 0x11ff1,
538
- 0x11fff, 0x12399,
539
- 0x12400, 0x1246e,
540
- 0x12470, 0x12474,
541
- 0x12480, 0x12543,
542
- 0x12f90, 0x12ff2,
543
- 0x13000, 0x13455,
544
- 0x14400, 0x14646,
545
- 0x16800, 0x16a38,
546
- 0x16a40, 0x16a5e,
547
- 0x16a60, 0x16a69,
548
- 0x16a6e, 0x16abe,
549
- 0x16ac0, 0x16ac9,
550
- 0x16ad0, 0x16aed,
551
- 0x16af0, 0x16af5,
552
- 0x16b00, 0x16b45,
553
- 0x16b50, 0x16b59,
554
- 0x16b5b, 0x16b61,
555
- 0x16b63, 0x16b77,
556
- 0x16b7d, 0x16b8f,
557
- 0x16e40, 0x16e9a,
558
- 0x16f00, 0x16f4a,
559
- 0x16f4f, 0x16f87,
560
- 0x16f8f, 0x16f9f,
561
- 0x16fe0, 0x16fe4,
562
- 0x16ff0, 0x16ff1,
563
- 0x17000, 0x187f7,
564
- 0x18800, 0x18cd5,
565
- 0x18d00, 0x18d08,
566
- 0x1aff0, 0x1aff3,
567
- 0x1aff5, 0x1affb,
568
- 0x1affd, 0x1affe,
569
- 0x1b000, 0x1b122,
570
- 0x1b132, 0x1b132,
571
- 0x1b150, 0x1b152,
572
- 0x1b155, 0x1b155,
573
- 0x1b164, 0x1b167,
574
- 0x1b170, 0x1b2fb,
575
- 0x1bc00, 0x1bc6a,
576
- 0x1bc70, 0x1bc7c,
577
- 0x1bc80, 0x1bc88,
578
- 0x1bc90, 0x1bc99,
579
- 0x1bc9c, 0x1bca3,
580
- 0x1cf00, 0x1cf2d,
581
- 0x1cf30, 0x1cf46,
582
- 0x1cf50, 0x1cfc3,
583
- 0x1d000, 0x1d0f5,
584
- 0x1d100, 0x1d126,
585
- 0x1d129, 0x1d1ea,
586
- 0x1d200, 0x1d245,
587
- 0x1d2c0, 0x1d2d3,
588
- 0x1d2e0, 0x1d2f3,
589
- 0x1d300, 0x1d356,
590
- 0x1d360, 0x1d378,
591
- 0x1d400, 0x1d454,
592
- 0x1d456, 0x1d49c,
593
- 0x1d49e, 0x1d49f,
594
- 0x1d4a2, 0x1d4a2,
595
- 0x1d4a5, 0x1d4a6,
596
- 0x1d4a9, 0x1d4ac,
597
- 0x1d4ae, 0x1d4b9,
598
- 0x1d4bb, 0x1d4bb,
599
- 0x1d4bd, 0x1d4c3,
600
- 0x1d4c5, 0x1d505,
601
- 0x1d507, 0x1d50a,
602
- 0x1d50d, 0x1d514,
603
- 0x1d516, 0x1d51c,
604
- 0x1d51e, 0x1d539,
605
- 0x1d53b, 0x1d53e,
606
- 0x1d540, 0x1d544,
607
- 0x1d546, 0x1d546,
608
- 0x1d54a, 0x1d550,
609
- 0x1d552, 0x1d6a5,
610
- 0x1d6a8, 0x1d7cb,
611
- 0x1d7ce, 0x1da8b,
612
- 0x1da9b, 0x1da9f,
613
- 0x1daa1, 0x1daaf,
614
- 0x1df00, 0x1df1e,
615
- 0x1df25, 0x1df2a,
616
- 0x1e000, 0x1e006,
617
- 0x1e008, 0x1e018,
618
- 0x1e01b, 0x1e021,
619
- 0x1e023, 0x1e024,
620
- 0x1e026, 0x1e02a,
621
- 0x1e030, 0x1e06d,
622
- 0x1e08f, 0x1e08f,
623
- 0x1e100, 0x1e12c,
624
- 0x1e130, 0x1e13d,
625
- 0x1e140, 0x1e149,
626
- 0x1e14e, 0x1e14f,
627
- 0x1e290, 0x1e2ae,
628
- 0x1e2c0, 0x1e2f9,
629
- 0x1e2ff, 0x1e2ff,
630
- 0x1e4d0, 0x1e4f9,
631
- 0x1e7e0, 0x1e7e6,
632
- 0x1e7e8, 0x1e7eb,
633
- 0x1e7ed, 0x1e7ee,
634
- 0x1e7f0, 0x1e7fe,
635
- 0x1e800, 0x1e8c4,
636
- 0x1e8c7, 0x1e8d6,
637
- 0x1e900, 0x1e94b,
638
- 0x1e950, 0x1e959,
639
- 0x1e95e, 0x1e95f,
640
- 0x1ec71, 0x1ecb4,
641
- 0x1ed01, 0x1ed3d,
642
- 0x1ee00, 0x1ee03,
643
- 0x1ee05, 0x1ee1f,
644
- 0x1ee21, 0x1ee22,
645
- 0x1ee24, 0x1ee24,
646
- 0x1ee27, 0x1ee27,
647
- 0x1ee29, 0x1ee32,
648
- 0x1ee34, 0x1ee37,
649
- 0x1ee39, 0x1ee39,
650
- 0x1ee3b, 0x1ee3b,
651
- 0x1ee42, 0x1ee42,
652
- 0x1ee47, 0x1ee47,
653
- 0x1ee49, 0x1ee49,
654
- 0x1ee4b, 0x1ee4b,
655
- 0x1ee4d, 0x1ee4f,
656
- 0x1ee51, 0x1ee52,
657
- 0x1ee54, 0x1ee54,
658
- 0x1ee57, 0x1ee57,
659
- 0x1ee59, 0x1ee59,
660
- 0x1ee5b, 0x1ee5b,
661
- 0x1ee5d, 0x1ee5d,
662
- 0x1ee5f, 0x1ee5f,
663
- 0x1ee61, 0x1ee62,
664
- 0x1ee64, 0x1ee64,
665
- 0x1ee67, 0x1ee6a,
666
- 0x1ee6c, 0x1ee72,
667
- 0x1ee74, 0x1ee77,
668
- 0x1ee79, 0x1ee7c,
669
- 0x1ee7e, 0x1ee7e,
670
- 0x1ee80, 0x1ee89,
671
- 0x1ee8b, 0x1ee9b,
672
- 0x1eea1, 0x1eea3,
673
- 0x1eea5, 0x1eea9,
674
- 0x1eeab, 0x1eebb,
675
- 0x1eef0, 0x1eef1,
676
- 0x1f000, 0x1f02b,
677
- 0x1f030, 0x1f093,
678
- 0x1f0a0, 0x1f0ae,
679
- 0x1f0b1, 0x1f0bf,
680
- 0x1f0c1, 0x1f0cf,
681
- 0x1f0d1, 0x1f0f5,
682
- 0x1f100, 0x1f1ad,
683
- 0x1f1e6, 0x1f202,
684
- 0x1f210, 0x1f23b,
685
- 0x1f240, 0x1f248,
686
- 0x1f250, 0x1f251,
687
- 0x1f260, 0x1f265,
688
- 0x1f300, 0x1f6d7,
689
- 0x1f6dc, 0x1f6ec,
690
- 0x1f6f0, 0x1f6fc,
691
- 0x1f700, 0x1f776,
692
- 0x1f77b, 0x1f7d9,
693
- 0x1f7e0, 0x1f7eb,
694
- 0x1f7f0, 0x1f7f0,
695
- 0x1f800, 0x1f80b,
696
- 0x1f810, 0x1f847,
697
- 0x1f850, 0x1f859,
698
- 0x1f860, 0x1f887,
699
- 0x1f890, 0x1f8ad,
700
- 0x1f8b0, 0x1f8b1,
701
- 0x1f900, 0x1fa53,
702
- 0x1fa60, 0x1fa6d,
703
- 0x1fa70, 0x1fa7c,
704
- 0x1fa80, 0x1fa88,
705
- 0x1fa90, 0x1fabd,
706
- 0x1fabf, 0x1fac5,
707
- 0x1face, 0x1fadb,
708
- 0x1fae0, 0x1fae8,
709
- 0x1faf0, 0x1faf8,
710
- 0x1fb00, 0x1fb92,
711
- 0x1fb94, 0x1fbca,
712
- 0x1fbf0, 0x1fbf9,
713
- 0x20000, 0x2a6df,
714
- 0x2a700, 0x2b739,
715
- 0x2b740, 0x2b81d,
716
- 0x2b820, 0x2cea1,
717
- 0x2ceb0, 0x2ebe0,
718
- 0x2f800, 0x2fa1d,
719
- 0x30000, 0x3134a,
720
- 0x31350, 0x323af,
721
- 0xe0001, 0xe0001,
722
- 0xe0020, 0xe007f,
723
- 0xe0100, 0xe01ef,
724
- ];
725
-
726
- function utf16CodeUnits(codePoint) {
727
- return codePoint >= 0x10000 ? 2 : 1;
728
- }
729
- function isLineBreak(ch) {
730
- return ch === 10 /* CharCode.LineFeed */ || ch === 13 /* CharCode.CarriageReturn */;
731
- }
732
- function isAsciiWhiteSpaceSingleLine(ch) {
733
- return (ch === 32 /* CharCode.Space */ ||
734
- ch === 9 /* CharCode.Tab */ ||
735
- ch === 11 /* CharCode.VerticalTab */ ||
736
- ch === 12 /* CharCode.FormFeed */);
737
- }
738
- function isNonAsciiWhiteSpaceSingleLine(ch) {
739
- return (ch === 133 /* CharCode.NextLine */ || // not considered a line break
740
- ch === 8206 /* CharCode.LeftToRightMark */ ||
741
- ch === 8207 /* CharCode.RightToLeftMark */ ||
742
- ch === 8232 /* CharCode.LineSeparator */ ||
743
- ch === 8233 /* CharCode.ParagraphSeparator */);
744
- }
745
- function isWhiteSpace(ch) {
746
- return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);
747
- }
748
- function isWhiteSpaceSingleLine(ch) {
749
- return (isAsciiWhiteSpaceSingleLine(ch) ||
750
- (ch > 127 /* CharCode.MaxAscii */ && isNonAsciiWhiteSpaceSingleLine(ch)));
751
- }
752
- function trim(str) {
753
- let start = 0;
754
- let end = str.length - 1;
755
- if (!isWhiteSpace(str.charCodeAt(start)) && !isWhiteSpace(str.charCodeAt(end))) {
756
- return str;
757
- }
758
- while (isWhiteSpace(str.charCodeAt(start))) {
759
- start++;
760
- }
761
- while (isWhiteSpace(str.charCodeAt(end))) {
762
- end--;
763
- }
764
- return str.substring(start, end + 1);
765
- }
766
- function isDigit(ch) {
767
- return ch >= 48 /* CharCode._0 */ && ch <= 57 /* CharCode._9 */;
768
- }
769
- function isHexDigit(ch) {
770
- return (isDigit(ch) || (ch >= 65 /* CharCode.A */ && ch <= 70 /* CharCode.F */) || (ch >= 97 /* CharCode.a */ && ch <= 102 /* CharCode.f */));
771
- }
772
- function isBinaryDigit(ch) {
773
- return ch === 48 /* CharCode._0 */ || ch === 49 /* CharCode._1 */;
774
- }
775
- function isLowercaseAsciiLetter(ch) {
776
- return ch >= 97 /* CharCode.a */ && ch <= 122 /* CharCode.z */;
777
- }
778
- function isAsciiIdentifierStart(ch) {
779
- return ((ch >= 65 /* CharCode.A */ && ch <= 90 /* CharCode.Z */) ||
780
- (ch >= 97 /* CharCode.a */ && ch <= 122 /* CharCode.z */) ||
781
- ch === 36 /* CharCode.$ */ ||
782
- ch === 95 /* CharCode._ */);
783
- }
784
- function isAsciiIdentifierContinue(ch) {
785
- return ((ch >= 65 /* CharCode.A */ && ch <= 90 /* CharCode.Z */) ||
786
- (ch >= 97 /* CharCode.a */ && ch <= 122 /* CharCode.z */) ||
787
- (ch >= 48 /* CharCode._0 */ && ch <= 57 /* CharCode._9 */) ||
788
- ch === 36 /* CharCode.$ */ ||
789
- ch === 95 /* CharCode._ */);
790
- }
791
- function isIdentifierStart(codePoint) {
792
- return (isAsciiIdentifierStart(codePoint) ||
793
- (codePoint > 127 /* CharCode.MaxAscii */ && isNonAsciiIdentifierCharacter(codePoint)));
794
- }
795
- function isIdentifierContinue(codePoint) {
796
- return (isAsciiIdentifierContinue(codePoint) ||
797
- (codePoint > 127 /* CharCode.MaxAscii */ && isNonAsciiIdentifierCharacter(codePoint)));
798
- }
799
- function isNonAsciiIdentifierCharacter(codePoint) {
800
- return lookupInNonAsciiMap(codePoint, nonAsciiIdentifierMap);
801
- }
802
- function lookupInNonAsciiMap(codePoint, map) {
803
- // Perform binary search in one of the Unicode range maps
804
- let lo = 0;
805
- let hi = map.length;
806
- let mid;
807
- while (lo + 1 < hi) {
808
- mid = lo + (hi - lo) / 2;
809
- // mid has to be even to catch a range's beginning
810
- mid -= mid % 2;
811
- if (map[mid] <= codePoint && codePoint <= map[mid + 1]) {
812
- return true;
813
- }
814
- if (codePoint < map[mid]) {
815
- hi = mid;
816
- }
817
- else {
818
- lo = mid + 2;
819
- }
820
- }
821
- return false;
822
- }
823
-
824
- /**
825
- * AST types
826
- */
827
- var SyntaxKind;
828
- (function (SyntaxKind) {
829
- SyntaxKind[SyntaxKind["TypeSpecScript"] = 0] = "TypeSpecScript";
830
- /** @deprecated Use TypeSpecScript */
831
- SyntaxKind[SyntaxKind["CadlScript"] = 0] = "CadlScript";
832
- SyntaxKind[SyntaxKind["JsSourceFile"] = 1] = "JsSourceFile";
833
- SyntaxKind[SyntaxKind["ImportStatement"] = 2] = "ImportStatement";
834
- SyntaxKind[SyntaxKind["Identifier"] = 3] = "Identifier";
835
- SyntaxKind[SyntaxKind["AugmentDecoratorStatement"] = 4] = "AugmentDecoratorStatement";
836
- SyntaxKind[SyntaxKind["DecoratorExpression"] = 5] = "DecoratorExpression";
837
- SyntaxKind[SyntaxKind["DirectiveExpression"] = 6] = "DirectiveExpression";
838
- SyntaxKind[SyntaxKind["MemberExpression"] = 7] = "MemberExpression";
839
- SyntaxKind[SyntaxKind["NamespaceStatement"] = 8] = "NamespaceStatement";
840
- SyntaxKind[SyntaxKind["UsingStatement"] = 9] = "UsingStatement";
841
- SyntaxKind[SyntaxKind["OperationStatement"] = 10] = "OperationStatement";
842
- SyntaxKind[SyntaxKind["OperationSignatureDeclaration"] = 11] = "OperationSignatureDeclaration";
843
- SyntaxKind[SyntaxKind["OperationSignatureReference"] = 12] = "OperationSignatureReference";
844
- SyntaxKind[SyntaxKind["ModelStatement"] = 13] = "ModelStatement";
845
- SyntaxKind[SyntaxKind["ModelExpression"] = 14] = "ModelExpression";
846
- SyntaxKind[SyntaxKind["ModelProperty"] = 15] = "ModelProperty";
847
- SyntaxKind[SyntaxKind["ModelSpreadProperty"] = 16] = "ModelSpreadProperty";
848
- SyntaxKind[SyntaxKind["ScalarStatement"] = 17] = "ScalarStatement";
849
- SyntaxKind[SyntaxKind["InterfaceStatement"] = 18] = "InterfaceStatement";
850
- SyntaxKind[SyntaxKind["UnionStatement"] = 19] = "UnionStatement";
851
- SyntaxKind[SyntaxKind["UnionVariant"] = 20] = "UnionVariant";
852
- SyntaxKind[SyntaxKind["EnumStatement"] = 21] = "EnumStatement";
853
- SyntaxKind[SyntaxKind["EnumMember"] = 22] = "EnumMember";
854
- SyntaxKind[SyntaxKind["EnumSpreadMember"] = 23] = "EnumSpreadMember";
855
- SyntaxKind[SyntaxKind["AliasStatement"] = 24] = "AliasStatement";
856
- SyntaxKind[SyntaxKind["DecoratorDeclarationStatement"] = 25] = "DecoratorDeclarationStatement";
857
- SyntaxKind[SyntaxKind["FunctionDeclarationStatement"] = 26] = "FunctionDeclarationStatement";
858
- SyntaxKind[SyntaxKind["FunctionParameter"] = 27] = "FunctionParameter";
859
- SyntaxKind[SyntaxKind["UnionExpression"] = 28] = "UnionExpression";
860
- SyntaxKind[SyntaxKind["IntersectionExpression"] = 29] = "IntersectionExpression";
861
- SyntaxKind[SyntaxKind["TupleExpression"] = 30] = "TupleExpression";
862
- SyntaxKind[SyntaxKind["ArrayExpression"] = 31] = "ArrayExpression";
863
- SyntaxKind[SyntaxKind["StringLiteral"] = 32] = "StringLiteral";
864
- SyntaxKind[SyntaxKind["NumericLiteral"] = 33] = "NumericLiteral";
865
- SyntaxKind[SyntaxKind["BooleanLiteral"] = 34] = "BooleanLiteral";
866
- SyntaxKind[SyntaxKind["ExternKeyword"] = 35] = "ExternKeyword";
867
- SyntaxKind[SyntaxKind["VoidKeyword"] = 36] = "VoidKeyword";
868
- SyntaxKind[SyntaxKind["NeverKeyword"] = 37] = "NeverKeyword";
869
- SyntaxKind[SyntaxKind["UnknownKeyword"] = 38] = "UnknownKeyword";
870
- SyntaxKind[SyntaxKind["ValueOfExpression"] = 39] = "ValueOfExpression";
871
- SyntaxKind[SyntaxKind["TypeReference"] = 40] = "TypeReference";
872
- SyntaxKind[SyntaxKind["ProjectionReference"] = 41] = "ProjectionReference";
873
- SyntaxKind[SyntaxKind["TemplateParameterDeclaration"] = 42] = "TemplateParameterDeclaration";
874
- SyntaxKind[SyntaxKind["EmptyStatement"] = 43] = "EmptyStatement";
875
- SyntaxKind[SyntaxKind["InvalidStatement"] = 44] = "InvalidStatement";
876
- SyntaxKind[SyntaxKind["LineComment"] = 45] = "LineComment";
877
- SyntaxKind[SyntaxKind["BlockComment"] = 46] = "BlockComment";
878
- SyntaxKind[SyntaxKind["Doc"] = 47] = "Doc";
879
- SyntaxKind[SyntaxKind["DocText"] = 48] = "DocText";
880
- SyntaxKind[SyntaxKind["DocParamTag"] = 49] = "DocParamTag";
881
- SyntaxKind[SyntaxKind["DocReturnsTag"] = 50] = "DocReturnsTag";
882
- SyntaxKind[SyntaxKind["DocTemplateTag"] = 51] = "DocTemplateTag";
883
- SyntaxKind[SyntaxKind["DocUnknownTag"] = 52] = "DocUnknownTag";
884
- SyntaxKind[SyntaxKind["Projection"] = 53] = "Projection";
885
- SyntaxKind[SyntaxKind["ProjectionParameterDeclaration"] = 54] = "ProjectionParameterDeclaration";
886
- SyntaxKind[SyntaxKind["ProjectionModelSelector"] = 55] = "ProjectionModelSelector";
887
- SyntaxKind[SyntaxKind["ProjectionModelPropertySelector"] = 56] = "ProjectionModelPropertySelector";
888
- SyntaxKind[SyntaxKind["ProjectionOperationSelector"] = 57] = "ProjectionOperationSelector";
889
- SyntaxKind[SyntaxKind["ProjectionUnionSelector"] = 58] = "ProjectionUnionSelector";
890
- SyntaxKind[SyntaxKind["ProjectionUnionVariantSelector"] = 59] = "ProjectionUnionVariantSelector";
891
- SyntaxKind[SyntaxKind["ProjectionInterfaceSelector"] = 60] = "ProjectionInterfaceSelector";
892
- SyntaxKind[SyntaxKind["ProjectionEnumSelector"] = 61] = "ProjectionEnumSelector";
893
- SyntaxKind[SyntaxKind["ProjectionEnumMemberSelector"] = 62] = "ProjectionEnumMemberSelector";
894
- SyntaxKind[SyntaxKind["ProjectionExpressionStatement"] = 63] = "ProjectionExpressionStatement";
895
- SyntaxKind[SyntaxKind["ProjectionIfExpression"] = 64] = "ProjectionIfExpression";
896
- SyntaxKind[SyntaxKind["ProjectionBlockExpression"] = 65] = "ProjectionBlockExpression";
897
- SyntaxKind[SyntaxKind["ProjectionMemberExpression"] = 66] = "ProjectionMemberExpression";
898
- SyntaxKind[SyntaxKind["ProjectionLogicalExpression"] = 67] = "ProjectionLogicalExpression";
899
- SyntaxKind[SyntaxKind["ProjectionEqualityExpression"] = 68] = "ProjectionEqualityExpression";
900
- SyntaxKind[SyntaxKind["ProjectionUnaryExpression"] = 69] = "ProjectionUnaryExpression";
901
- SyntaxKind[SyntaxKind["ProjectionRelationalExpression"] = 70] = "ProjectionRelationalExpression";
902
- SyntaxKind[SyntaxKind["ProjectionArithmeticExpression"] = 71] = "ProjectionArithmeticExpression";
903
- SyntaxKind[SyntaxKind["ProjectionCallExpression"] = 72] = "ProjectionCallExpression";
904
- SyntaxKind[SyntaxKind["ProjectionLambdaExpression"] = 73] = "ProjectionLambdaExpression";
905
- SyntaxKind[SyntaxKind["ProjectionLambdaParameterDeclaration"] = 74] = "ProjectionLambdaParameterDeclaration";
906
- SyntaxKind[SyntaxKind["ProjectionModelExpression"] = 75] = "ProjectionModelExpression";
907
- SyntaxKind[SyntaxKind["ProjectionModelProperty"] = 76] = "ProjectionModelProperty";
908
- SyntaxKind[SyntaxKind["ProjectionModelSpreadProperty"] = 77] = "ProjectionModelSpreadProperty";
909
- SyntaxKind[SyntaxKind["ProjectionSpreadProperty"] = 78] = "ProjectionSpreadProperty";
910
- SyntaxKind[SyntaxKind["ProjectionTupleExpression"] = 79] = "ProjectionTupleExpression";
911
- SyntaxKind[SyntaxKind["ProjectionStatement"] = 80] = "ProjectionStatement";
912
- SyntaxKind[SyntaxKind["ProjectionDecoratorReferenceExpression"] = 81] = "ProjectionDecoratorReferenceExpression";
913
- SyntaxKind[SyntaxKind["Return"] = 82] = "Return";
914
- })(SyntaxKind || (SyntaxKind = {}));
915
- var IdentifierKind;
916
- (function (IdentifierKind) {
917
- IdentifierKind[IdentifierKind["TypeReference"] = 0] = "TypeReference";
918
- IdentifierKind[IdentifierKind["Decorator"] = 1] = "Decorator";
919
- IdentifierKind[IdentifierKind["Function"] = 2] = "Function";
920
- IdentifierKind[IdentifierKind["Using"] = 3] = "Using";
921
- IdentifierKind[IdentifierKind["Declaration"] = 4] = "Declaration";
922
- IdentifierKind[IdentifierKind["Other"] = 5] = "Other";
923
- })(IdentifierKind || (IdentifierKind = {}));
924
- const NoTarget = Symbol.for("NoTarget");
925
- var ListenerFlow;
926
- (function (ListenerFlow) {
927
- /**
928
- * Do not navigate any containing or referenced type.
929
- */
930
- ListenerFlow[ListenerFlow["NoRecursion"] = 1] = "NoRecursion";
931
- })(ListenerFlow || (ListenerFlow = {}));
253
+ function compilerAssert(condition, message, target) {
254
+ if (condition) {
255
+ return;
256
+ }
257
+ if (target) {
258
+ let location;
259
+ try {
260
+ location = getSourceLocation(target);
261
+ }
262
+ catch (err) { }
263
+ if (location) {
264
+ const pos = location.file.getLineAndCharacterOfPosition(location.pos);
265
+ const file = location.file.path;
266
+ const line = pos.line + 1;
267
+ const col = pos.character + 1;
268
+ message += `\nOccurred while compiling code in ${file} near line ${line}, column ${col}`;
269
+ }
270
+ }
271
+ throw new Error(message);
272
+ }
273
+ function scanLineStarts(text) {
274
+ const starts = [];
275
+ let start = 0;
276
+ let pos = 0;
277
+ while (pos < text.length) {
278
+ const ch = text.charCodeAt(pos);
279
+ pos++;
280
+ switch (ch) {
281
+ case 13 /* CharCode.CarriageReturn */:
282
+ if (text.charCodeAt(pos) === 10 /* CharCode.LineFeed */) {
283
+ pos++;
284
+ }
285
+ // fallthrough
286
+ case 10 /* CharCode.LineFeed */:
287
+ starts.push(start);
288
+ start = pos;
289
+ break;
290
+ }
291
+ }
292
+ starts.push(start);
293
+ return starts;
294
+ }
295
+ /**
296
+ * Search sorted array of numbers for the given value. If found, return index
297
+ * in array where value was found. If not found, return a negative number that
298
+ * is the bitwise complement of the index where value would need to be inserted
299
+ * to keep the array sorted.
300
+ */
301
+ function binarySearch(array, value) {
302
+ let low = 0;
303
+ let high = array.length - 1;
304
+ while (low <= high) {
305
+ const middle = low + ((high - low) >> 1);
306
+ const v = array[middle];
307
+ if (v < value) {
308
+ low = middle + 1;
309
+ }
310
+ else if (v > value) {
311
+ high = middle - 1;
312
+ }
313
+ else {
314
+ return middle;
315
+ }
316
+ }
317
+ return ~low;
318
+ }
932
319
 
933
320
  const globalLibraryUrlsLoadedSym = Symbol.for("TYPESPEC_LIBRARY_URLS_LOADED");
934
321
  if (globalThis[globalLibraryUrlsLoadedSym] === undefined) {
@@ -1257,6 +644,7 @@ const diagnostics = {
1257
644
  inDecorator: paramMessage `Cannot resolve ${"id"} in decorator`,
1258
645
  underNamespace: paramMessage `Namespace ${"namespace"} doesn't have member ${"id"}`,
1259
646
  underContainer: paramMessage `${"kind"} doesn't have member ${"id"}`,
647
+ metaProperty: paramMessage `${"kind"} doesn't have meta property ${"id"}`,
1260
648
  node: paramMessage `Cannot resolve '${"id"}' in node ${"nodeName"} since it has no members. Did you mean to use "::" instead of "."?`,
1261
649
  },
1262
650
  },
@@ -1414,6 +802,18 @@ const diagnostics = {
1414
802
  default: paramMessage `Shadowing parent template parmaeter with the same name "${"name"}"`,
1415
803
  },
1416
804
  },
805
+ "invalid-deprecation-argument": {
806
+ severity: "error",
807
+ messages: {
808
+ default: "Invalid deprecation argument",
809
+ },
810
+ },
811
+ "duplicate-deprecation": {
812
+ severity: "warning",
813
+ messages: {
814
+ default: "The #deprecated directive cannot be used more than once on the same declaration.",
815
+ },
816
+ },
1417
817
  /**
1418
818
  * Configuration
1419
819
  */
@@ -1732,215 +1132,2140 @@ const diagnostics = {
1732
1132
  default: "Conflict marker encountered.",
1733
1133
  },
1734
1134
  },
1135
+ // #region CLI
1136
+ "no-compatible-vs-installed": {
1137
+ severity: "error",
1138
+ messages: {
1139
+ default: "No compatible version of Visual Studio found.",
1140
+ },
1141
+ },
1142
+ "vs-extension-windows-only": {
1143
+ severity: "error",
1144
+ messages: {
1145
+ default: "Visual Studio extension is not supported on non-Windows.",
1146
+ },
1147
+ },
1148
+ "vscode-in-path": {
1149
+ severity: "error",
1150
+ messages: {
1151
+ default: "Couldn't find VS Code 'code' command in PATH. Make sure you have the VS Code executable added to the system PATH.",
1152
+ osx: "Couldn't find VS Code 'code' command in PATH. Make sure you have the VS Code executable added to the system PATH.\nSee instruction for Mac OS here https://code.visualstudio.com/docs/setup/mac",
1153
+ },
1154
+ },
1155
+ // #endregion CLI
1735
1156
  };
1736
1157
  const { createDiagnostic, reportDiagnostic } = createDiagnosticCreator(diagnostics);
1737
1158
 
1159
+ (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1160
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1161
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1162
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1163
+ };
1164
+ (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1165
+ if (kind === "m") throw new TypeError("Private method is not writable");
1166
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1167
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1168
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1169
+ };
1738
1170
  /**
1739
- * Create a new diagnostics creator.
1740
- * @param diagnostics Map of the potential diagnostics.
1741
- * @param libraryName Optional name of the library if in the scope of a library.
1742
- * @returns @see DiagnosticCreator
1171
+ * A specially typed version of `Array.isArray` to work around [this issue](https://github.com/microsoft/TypeScript/issues/17002).
1743
1172
  */
1744
- function createDiagnosticCreator(diagnostics, libraryName) {
1745
- const errorMessage = libraryName
1746
- ? `It must match one of the code defined in the library '${libraryName}'`
1747
- : "It must match one of the code defined in the compiler.";
1748
- function createDiagnostic(diagnostic) {
1749
- var _a;
1750
- const diagnosticDef = diagnostics[diagnostic.code];
1751
- if (!diagnosticDef) {
1752
- const codeStr = Object.keys(diagnostics)
1753
- .map((x) => ` - ${x}`)
1754
- .join("\n");
1755
- const code = String(diagnostic.code);
1756
- throw new Error(`Unexpected diagnostic code '${code}'. ${errorMessage}. Defined codes:\n${codeStr}`);
1757
- }
1758
- const message = diagnosticDef.messages[(_a = diagnostic.messageId) !== null && _a !== void 0 ? _a : "default"];
1759
- if (!message) {
1760
- const codeStr = Object.keys(diagnosticDef.messages)
1761
- .map((x) => ` - ${x}`)
1762
- .join("\n");
1763
- const messageId = String(diagnostic.messageId);
1764
- const code = String(diagnostic.code);
1765
- throw new Error(`Unexpected message id '${messageId}'. ${errorMessage} for code '${code}'. Defined codes:\n${codeStr}`);
1766
- }
1767
- const messageStr = typeof message === "string" ? message : message(diagnostic.format);
1768
- return {
1769
- code: libraryName ? `${libraryName}/${String(diagnostic.code)}` : diagnostic.code.toString(),
1770
- severity: diagnosticDef.severity,
1771
- message: messageStr,
1772
- target: diagnostic.target,
1173
+ function isArray(
1174
+ // eslint-disable-next-line @typescript-eslint/ban-types
1175
+ arg) {
1176
+ return Array.isArray(arg);
1177
+ }
1178
+ /**
1179
+ * Casts away readonly typing.
1180
+ *
1181
+ * Use it like this when it is safe to override readonly typing:
1182
+ * mutate(item).prop = value;
1183
+ */
1184
+ function mutate(value) {
1185
+ return value;
1186
+ }
1187
+
1188
+ var __defProp = Object.defineProperty;
1189
+ var __export = (target, all) => {
1190
+ for (var name in all)
1191
+ __defProp(target, name, { get: all[name], enumerable: true });
1192
+ };
1193
+
1194
+ // src/document/public.js
1195
+ var public_exports = {};
1196
+ __export(public_exports, {
1197
+ builders: () => builders,
1198
+ printer: () => printer,
1199
+ utils: () => utils
1200
+ });
1201
+
1202
+ // src/document/constants.js
1203
+ var DOC_TYPE_STRING = "string";
1204
+ var DOC_TYPE_ARRAY = "array";
1205
+ var DOC_TYPE_CURSOR = "cursor";
1206
+ var DOC_TYPE_INDENT = "indent";
1207
+ var DOC_TYPE_ALIGN = "align";
1208
+ var DOC_TYPE_TRIM = "trim";
1209
+ var DOC_TYPE_GROUP = "group";
1210
+ var DOC_TYPE_FILL = "fill";
1211
+ var DOC_TYPE_IF_BREAK = "if-break";
1212
+ var DOC_TYPE_INDENT_IF_BREAK = "indent-if-break";
1213
+ var DOC_TYPE_LINE_SUFFIX = "line-suffix";
1214
+ var DOC_TYPE_LINE_SUFFIX_BOUNDARY = "line-suffix-boundary";
1215
+ var DOC_TYPE_LINE = "line";
1216
+ var DOC_TYPE_LABEL = "label";
1217
+ var DOC_TYPE_BREAK_PARENT = "break-parent";
1218
+ var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
1219
+ DOC_TYPE_CURSOR,
1220
+ DOC_TYPE_INDENT,
1221
+ DOC_TYPE_ALIGN,
1222
+ DOC_TYPE_TRIM,
1223
+ DOC_TYPE_GROUP,
1224
+ DOC_TYPE_FILL,
1225
+ DOC_TYPE_IF_BREAK,
1226
+ DOC_TYPE_INDENT_IF_BREAK,
1227
+ DOC_TYPE_LINE_SUFFIX,
1228
+ DOC_TYPE_LINE_SUFFIX_BOUNDARY,
1229
+ DOC_TYPE_LINE,
1230
+ DOC_TYPE_LABEL,
1231
+ DOC_TYPE_BREAK_PARENT
1232
+ ]);
1233
+
1234
+ // src/document/utils/get-doc-type.js
1235
+ function getDocType(doc) {
1236
+ if (typeof doc === "string") {
1237
+ return DOC_TYPE_STRING;
1238
+ }
1239
+ if (Array.isArray(doc)) {
1240
+ return DOC_TYPE_ARRAY;
1241
+ }
1242
+ if (!doc) {
1243
+ return;
1244
+ }
1245
+ const { type } = doc;
1246
+ if (VALID_OBJECT_DOC_TYPES.has(type)) {
1247
+ return type;
1248
+ }
1249
+ }
1250
+ var get_doc_type_default = getDocType;
1251
+
1252
+ // src/document/invalid-doc-error.js
1253
+ var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
1254
+ function getDocErrorMessage(doc) {
1255
+ const type = doc === null ? "null" : typeof doc;
1256
+ if (type !== "string" && type !== "object") {
1257
+ return `Unexpected doc '${type}',
1258
+ Expected it to be 'string' or 'object'.`;
1259
+ }
1260
+ if (get_doc_type_default(doc)) {
1261
+ throw new Error("doc is valid.");
1262
+ }
1263
+ const objectType = Object.prototype.toString.call(doc);
1264
+ if (objectType !== "[object Object]") {
1265
+ return `Unexpected doc '${objectType}'.`;
1266
+ }
1267
+ const EXPECTED_TYPE_VALUES = disjunctionListFormat(
1268
+ [...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`)
1269
+ );
1270
+ return `Unexpected doc.type '${doc.type}'.
1271
+ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
1272
+ }
1273
+ var InvalidDocError = class extends Error {
1274
+ name = "InvalidDocError";
1275
+ constructor(doc) {
1276
+ super(getDocErrorMessage(doc));
1277
+ this.doc = doc;
1278
+ }
1279
+ };
1280
+ var invalid_doc_error_default = InvalidDocError;
1281
+
1282
+ // src/document/utils/traverse-doc.js
1283
+ var traverseDocOnExitStackMarker = {};
1284
+ function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
1285
+ const docsStack = [doc];
1286
+ while (docsStack.length > 0) {
1287
+ const doc2 = docsStack.pop();
1288
+ if (doc2 === traverseDocOnExitStackMarker) {
1289
+ onExit(docsStack.pop());
1290
+ continue;
1291
+ }
1292
+ if (onExit) {
1293
+ docsStack.push(doc2, traverseDocOnExitStackMarker);
1294
+ }
1295
+ const docType = get_doc_type_default(doc2);
1296
+ if (!docType) {
1297
+ throw new invalid_doc_error_default(doc2);
1298
+ }
1299
+ if ((onEnter == null ? void 0 : onEnter(doc2)) === false) {
1300
+ continue;
1301
+ }
1302
+ switch (docType) {
1303
+ case DOC_TYPE_ARRAY:
1304
+ case DOC_TYPE_FILL: {
1305
+ const parts = docType === DOC_TYPE_ARRAY ? doc2 : doc2.parts;
1306
+ for (let ic = parts.length, i = ic - 1; i >= 0; --i) {
1307
+ docsStack.push(parts[i]);
1308
+ }
1309
+ break;
1310
+ }
1311
+ case DOC_TYPE_IF_BREAK:
1312
+ docsStack.push(doc2.flatContents, doc2.breakContents);
1313
+ break;
1314
+ case DOC_TYPE_GROUP:
1315
+ if (shouldTraverseConditionalGroups && doc2.expandedStates) {
1316
+ for (let ic = doc2.expandedStates.length, i = ic - 1; i >= 0; --i) {
1317
+ docsStack.push(doc2.expandedStates[i]);
1318
+ }
1319
+ } else {
1320
+ docsStack.push(doc2.contents);
1321
+ }
1322
+ break;
1323
+ case DOC_TYPE_ALIGN:
1324
+ case DOC_TYPE_INDENT:
1325
+ case DOC_TYPE_INDENT_IF_BREAK:
1326
+ case DOC_TYPE_LABEL:
1327
+ case DOC_TYPE_LINE_SUFFIX:
1328
+ docsStack.push(doc2.contents);
1329
+ break;
1330
+ case DOC_TYPE_STRING:
1331
+ case DOC_TYPE_CURSOR:
1332
+ case DOC_TYPE_TRIM:
1333
+ case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
1334
+ case DOC_TYPE_LINE:
1335
+ case DOC_TYPE_BREAK_PARENT:
1336
+ break;
1337
+ default:
1338
+ throw new invalid_doc_error_default(doc2);
1339
+ }
1340
+ }
1341
+ }
1342
+ var traverse_doc_default = traverseDoc;
1343
+
1344
+ // src/document/utils/assert-doc.js
1345
+ var noop = () => {
1346
+ };
1347
+ var assertDocArray = noop ;
1348
+
1349
+ // src/document/builders.js
1350
+ function indent$1(contents) {
1351
+ return { type: DOC_TYPE_INDENT, contents };
1352
+ }
1353
+ function align$1(widthOrString, contents) {
1354
+ return { type: DOC_TYPE_ALIGN, contents, n: widthOrString };
1355
+ }
1356
+ function group$1(contents, opts = {}) {
1357
+ assertDocArray(
1358
+ opts.expandedStates);
1359
+ return {
1360
+ type: DOC_TYPE_GROUP,
1361
+ id: opts.id,
1362
+ contents,
1363
+ break: Boolean(opts.shouldBreak),
1364
+ expandedStates: opts.expandedStates
1365
+ };
1366
+ }
1367
+ function dedentToRoot(contents) {
1368
+ return align$1(Number.NEGATIVE_INFINITY, contents);
1369
+ }
1370
+ function markAsRoot(contents) {
1371
+ return align$1({ type: "root" }, contents);
1372
+ }
1373
+ function dedent(contents) {
1374
+ return align$1(-1, contents);
1375
+ }
1376
+ function conditionalGroup(states, opts) {
1377
+ return group$1(states[0], { ...opts, expandedStates: states });
1378
+ }
1379
+ function fill(parts) {
1380
+ return { type: DOC_TYPE_FILL, parts };
1381
+ }
1382
+ function ifBreak$1(breakContents, flatContents = "", opts = {}) {
1383
+ return {
1384
+ type: DOC_TYPE_IF_BREAK,
1385
+ breakContents,
1386
+ flatContents,
1387
+ groupId: opts.groupId
1388
+ };
1389
+ }
1390
+ function indentIfBreak(contents, opts) {
1391
+ return {
1392
+ type: DOC_TYPE_INDENT_IF_BREAK,
1393
+ contents,
1394
+ groupId: opts.groupId,
1395
+ negate: opts.negate
1396
+ };
1397
+ }
1398
+ function lineSuffix(contents) {
1399
+ return { type: DOC_TYPE_LINE_SUFFIX, contents };
1400
+ }
1401
+ var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
1402
+ var breakParent$1 = { type: DOC_TYPE_BREAK_PARENT };
1403
+ var trim$1 = { type: DOC_TYPE_TRIM };
1404
+ var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
1405
+ var literallineWithoutBreakParent = {
1406
+ type: DOC_TYPE_LINE,
1407
+ hard: true,
1408
+ literal: true
1409
+ };
1410
+ var line$1 = { type: DOC_TYPE_LINE };
1411
+ var softline$1 = { type: DOC_TYPE_LINE, soft: true };
1412
+ var hardline$1 = [hardlineWithoutBreakParent, breakParent$1];
1413
+ var literalline = [literallineWithoutBreakParent, breakParent$1];
1414
+ var cursor = { type: DOC_TYPE_CURSOR };
1415
+ function join$1(separator, docs) {
1416
+ const parts = [];
1417
+ for (let i = 0; i < docs.length; i++) {
1418
+ if (i !== 0) {
1419
+ parts.push(separator);
1420
+ }
1421
+ parts.push(docs[i]);
1422
+ }
1423
+ return parts;
1424
+ }
1425
+ function addAlignmentToDoc(doc, size, tabWidth) {
1426
+ let aligned = doc;
1427
+ if (size > 0) {
1428
+ for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
1429
+ aligned = indent$1(aligned);
1430
+ }
1431
+ aligned = align$1(size % tabWidth, aligned);
1432
+ aligned = align$1(Number.NEGATIVE_INFINITY, aligned);
1433
+ }
1434
+ return aligned;
1435
+ }
1436
+ function label(label2, contents) {
1437
+ return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
1438
+ }
1439
+
1440
+ // scripts/build/shims/at.js
1441
+ var at$1 = (isOptionalObject, object, index) => {
1442
+ if (isOptionalObject && (object === void 0 || object === null)) {
1443
+ return;
1444
+ }
1445
+ if (Array.isArray(object) || typeof object === "string") {
1446
+ return object[index < 0 ? object.length + index : index];
1447
+ }
1448
+ return object.at(index);
1449
+ };
1450
+ var at_default = at$1;
1451
+
1452
+ // scripts/build/shims/string-replace-all.js
1453
+ var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
1454
+ if (isOptionalObject && (original === void 0 || original === null)) {
1455
+ return;
1456
+ }
1457
+ if (original.replaceAll) {
1458
+ return original.replaceAll(pattern, replacement);
1459
+ }
1460
+ if (pattern.global) {
1461
+ return original.replace(pattern, replacement);
1462
+ }
1463
+ return original.split(pattern).join(replacement);
1464
+ };
1465
+ var string_replace_all_default = stringReplaceAll;
1466
+
1467
+ // src/common/end-of-line.js
1468
+ function convertEndOfLineToChars(value) {
1469
+ switch (value) {
1470
+ case "cr":
1471
+ return "\r";
1472
+ case "crlf":
1473
+ return "\r\n";
1474
+ default:
1475
+ return "\n";
1476
+ }
1477
+ }
1478
+
1479
+ // node_modules/emoji-regex/index.mjs
1480
+ var emoji_regex_default = () => {
1481
+ 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\u26D3\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]|\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])?|[\uDFC3\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-\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]|\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(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\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-\uDEB6](?:\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\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-\uDDB3\uDDBC\uDDBD])|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD])|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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?)?)|\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])?|\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-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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;
1482
+ };
1483
+
1484
+ // node_modules/eastasianwidth/eastasianwidth.js
1485
+ var eastasianwidth_default = {
1486
+ eastAsianWidth(character) {
1487
+ var x = character.charCodeAt(0);
1488
+ var y = character.length == 2 ? character.charCodeAt(1) : 0;
1489
+ var codePoint = x;
1490
+ if (55296 <= x && x <= 56319 && 56320 <= y && y <= 57343) {
1491
+ x &= 1023;
1492
+ y &= 1023;
1493
+ codePoint = x << 10 | y;
1494
+ codePoint += 65536;
1495
+ }
1496
+ if (12288 == codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510) {
1497
+ return "F";
1498
+ }
1499
+ if (4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141) {
1500
+ return "W";
1501
+ }
1502
+ return "N";
1503
+ }
1504
+ };
1505
+
1506
+ // src/utils/get-string-width.js
1507
+ var notAsciiRegex = /[^\x20-\x7F]/;
1508
+ function getStringWidth(text) {
1509
+ if (!text) {
1510
+ return 0;
1511
+ }
1512
+ if (!notAsciiRegex.test(text)) {
1513
+ return text.length;
1514
+ }
1515
+ text = text.replace(emoji_regex_default(), " ");
1516
+ let width = 0;
1517
+ for (const character of text) {
1518
+ const codePoint = character.codePointAt(0);
1519
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
1520
+ continue;
1521
+ }
1522
+ if (codePoint >= 768 && codePoint <= 879) {
1523
+ continue;
1524
+ }
1525
+ const code = eastasianwidth_default.eastAsianWidth(character);
1526
+ width += code === "F" || code === "W" ? 2 : 1;
1527
+ }
1528
+ return width;
1529
+ }
1530
+ var get_string_width_default = getStringWidth;
1531
+
1532
+ // src/document/utils.js
1533
+ var getDocParts = (doc) => {
1534
+ if (Array.isArray(doc)) {
1535
+ return doc;
1536
+ }
1537
+ if (doc.type !== DOC_TYPE_FILL) {
1538
+ throw new Error(`Expect doc to be 'array' or '${DOC_TYPE_FILL}'.`);
1539
+ }
1540
+ return doc.parts;
1541
+ };
1542
+ function mapDoc(doc, cb) {
1543
+ if (typeof doc === "string") {
1544
+ return cb(doc);
1545
+ }
1546
+ const mapped = /* @__PURE__ */ new Map();
1547
+ return rec(doc);
1548
+ function rec(doc2) {
1549
+ if (mapped.has(doc2)) {
1550
+ return mapped.get(doc2);
1551
+ }
1552
+ const result = process2(doc2);
1553
+ mapped.set(doc2, result);
1554
+ return result;
1555
+ }
1556
+ function process2(doc2) {
1557
+ switch (get_doc_type_default(doc2)) {
1558
+ case DOC_TYPE_ARRAY:
1559
+ return cb(doc2.map(rec));
1560
+ case DOC_TYPE_FILL:
1561
+ return cb({
1562
+ ...doc2,
1563
+ parts: doc2.parts.map(rec)
1564
+ });
1565
+ case DOC_TYPE_IF_BREAK:
1566
+ return cb({
1567
+ ...doc2,
1568
+ breakContents: rec(doc2.breakContents),
1569
+ flatContents: rec(doc2.flatContents)
1570
+ });
1571
+ case DOC_TYPE_GROUP: {
1572
+ let {
1573
+ expandedStates,
1574
+ contents
1575
+ } = doc2;
1576
+ if (expandedStates) {
1577
+ expandedStates = expandedStates.map(rec);
1578
+ contents = expandedStates[0];
1579
+ } else {
1580
+ contents = rec(contents);
1581
+ }
1582
+ return cb({
1583
+ ...doc2,
1584
+ contents,
1585
+ expandedStates
1586
+ });
1587
+ }
1588
+ case DOC_TYPE_ALIGN:
1589
+ case DOC_TYPE_INDENT:
1590
+ case DOC_TYPE_INDENT_IF_BREAK:
1591
+ case DOC_TYPE_LABEL:
1592
+ case DOC_TYPE_LINE_SUFFIX:
1593
+ return cb({
1594
+ ...doc2,
1595
+ contents: rec(doc2.contents)
1596
+ });
1597
+ case DOC_TYPE_STRING:
1598
+ case DOC_TYPE_CURSOR:
1599
+ case DOC_TYPE_TRIM:
1600
+ case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
1601
+ case DOC_TYPE_LINE:
1602
+ case DOC_TYPE_BREAK_PARENT:
1603
+ return cb(doc2);
1604
+ default:
1605
+ throw new invalid_doc_error_default(doc2);
1606
+ }
1607
+ }
1608
+ }
1609
+ function findInDoc(doc, fn, defaultValue) {
1610
+ let result = defaultValue;
1611
+ let shouldSkipFurtherProcessing = false;
1612
+ function findInDocOnEnterFn(doc2) {
1613
+ if (shouldSkipFurtherProcessing) {
1614
+ return false;
1615
+ }
1616
+ const maybeResult = fn(doc2);
1617
+ if (maybeResult !== void 0) {
1618
+ shouldSkipFurtherProcessing = true;
1619
+ result = maybeResult;
1620
+ }
1621
+ }
1622
+ traverse_doc_default(doc, findInDocOnEnterFn);
1623
+ return result;
1624
+ }
1625
+ function willBreakFn(doc) {
1626
+ if (doc.type === DOC_TYPE_GROUP && doc.break) {
1627
+ return true;
1628
+ }
1629
+ if (doc.type === DOC_TYPE_LINE && doc.hard) {
1630
+ return true;
1631
+ }
1632
+ if (doc.type === DOC_TYPE_BREAK_PARENT) {
1633
+ return true;
1634
+ }
1635
+ }
1636
+ function willBreak(doc) {
1637
+ return findInDoc(doc, willBreakFn, false);
1638
+ }
1639
+ function breakParentGroup(groupStack) {
1640
+ if (groupStack.length > 0) {
1641
+ const parentGroup = at_default(
1642
+ /* isOptionalObject*/
1643
+ false,
1644
+ groupStack,
1645
+ -1
1646
+ );
1647
+ if (!parentGroup.expandedStates && !parentGroup.break) {
1648
+ parentGroup.break = "propagated";
1649
+ }
1650
+ }
1651
+ return null;
1652
+ }
1653
+ function propagateBreaks(doc) {
1654
+ const alreadyVisitedSet = /* @__PURE__ */ new Set();
1655
+ const groupStack = [];
1656
+ function propagateBreaksOnEnterFn(doc2) {
1657
+ if (doc2.type === DOC_TYPE_BREAK_PARENT) {
1658
+ breakParentGroup(groupStack);
1659
+ }
1660
+ if (doc2.type === DOC_TYPE_GROUP) {
1661
+ groupStack.push(doc2);
1662
+ if (alreadyVisitedSet.has(doc2)) {
1663
+ return false;
1664
+ }
1665
+ alreadyVisitedSet.add(doc2);
1666
+ }
1667
+ }
1668
+ function propagateBreaksOnExitFn(doc2) {
1669
+ if (doc2.type === DOC_TYPE_GROUP) {
1670
+ const group2 = groupStack.pop();
1671
+ if (group2.break) {
1672
+ breakParentGroup(groupStack);
1673
+ }
1674
+ }
1675
+ }
1676
+ traverse_doc_default(
1677
+ doc,
1678
+ propagateBreaksOnEnterFn,
1679
+ propagateBreaksOnExitFn,
1680
+ /* shouldTraverseConditionalGroups */
1681
+ true
1682
+ );
1683
+ }
1684
+ function removeLinesFn(doc) {
1685
+ if (doc.type === DOC_TYPE_LINE && !doc.hard) {
1686
+ return doc.soft ? "" : " ";
1687
+ }
1688
+ if (doc.type === DOC_TYPE_IF_BREAK) {
1689
+ return doc.flatContents;
1690
+ }
1691
+ return doc;
1692
+ }
1693
+ function removeLines(doc) {
1694
+ return mapDoc(doc, removeLinesFn);
1695
+ }
1696
+ function stripTrailingHardlineFromParts(parts) {
1697
+ parts = [...parts];
1698
+ while (parts.length >= 2 && at_default(
1699
+ /* isOptionalObject*/
1700
+ false,
1701
+ parts,
1702
+ -2
1703
+ ).type === DOC_TYPE_LINE && at_default(
1704
+ /* isOptionalObject*/
1705
+ false,
1706
+ parts,
1707
+ -1
1708
+ ).type === DOC_TYPE_BREAK_PARENT) {
1709
+ parts.length -= 2;
1710
+ }
1711
+ if (parts.length > 0) {
1712
+ const lastPart = stripTrailingHardlineFromDoc(at_default(
1713
+ /* isOptionalObject*/
1714
+ false,
1715
+ parts,
1716
+ -1
1717
+ ));
1718
+ parts[parts.length - 1] = lastPart;
1719
+ }
1720
+ return parts;
1721
+ }
1722
+ function stripTrailingHardlineFromDoc(doc) {
1723
+ switch (get_doc_type_default(doc)) {
1724
+ case DOC_TYPE_ALIGN:
1725
+ case DOC_TYPE_INDENT:
1726
+ case DOC_TYPE_INDENT_IF_BREAK:
1727
+ case DOC_TYPE_GROUP:
1728
+ case DOC_TYPE_LINE_SUFFIX:
1729
+ case DOC_TYPE_LABEL: {
1730
+ const contents = stripTrailingHardlineFromDoc(doc.contents);
1731
+ return {
1732
+ ...doc,
1733
+ contents
1734
+ };
1735
+ }
1736
+ case DOC_TYPE_IF_BREAK:
1737
+ return {
1738
+ ...doc,
1739
+ breakContents: stripTrailingHardlineFromDoc(doc.breakContents),
1740
+ flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
1741
+ };
1742
+ case DOC_TYPE_FILL:
1743
+ return {
1744
+ ...doc,
1745
+ parts: stripTrailingHardlineFromParts(doc.parts)
1746
+ };
1747
+ case DOC_TYPE_ARRAY:
1748
+ return stripTrailingHardlineFromParts(doc);
1749
+ case DOC_TYPE_STRING:
1750
+ return doc.replace(/[\n\r]*$/, "");
1751
+ case DOC_TYPE_CURSOR:
1752
+ case DOC_TYPE_TRIM:
1753
+ case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
1754
+ case DOC_TYPE_LINE:
1755
+ case DOC_TYPE_BREAK_PARENT:
1756
+ break;
1757
+ default:
1758
+ throw new invalid_doc_error_default(doc);
1759
+ }
1760
+ return doc;
1761
+ }
1762
+ function stripTrailingHardline(doc) {
1763
+ return stripTrailingHardlineFromDoc(cleanDoc(doc));
1764
+ }
1765
+ function cleanDocFn(doc) {
1766
+ switch (get_doc_type_default(doc)) {
1767
+ case DOC_TYPE_FILL:
1768
+ if (doc.parts.every((part) => part === "")) {
1769
+ return "";
1770
+ }
1771
+ break;
1772
+ case DOC_TYPE_GROUP:
1773
+ if (!doc.contents && !doc.id && !doc.break && !doc.expandedStates) {
1774
+ return "";
1775
+ }
1776
+ if (doc.contents.type === DOC_TYPE_GROUP && doc.contents.id === doc.id && doc.contents.break === doc.break && doc.contents.expandedStates === doc.expandedStates) {
1777
+ return doc.contents;
1778
+ }
1779
+ break;
1780
+ case DOC_TYPE_ALIGN:
1781
+ case DOC_TYPE_INDENT:
1782
+ case DOC_TYPE_INDENT_IF_BREAK:
1783
+ case DOC_TYPE_LINE_SUFFIX:
1784
+ if (!doc.contents) {
1785
+ return "";
1786
+ }
1787
+ break;
1788
+ case DOC_TYPE_IF_BREAK:
1789
+ if (!doc.flatContents && !doc.breakContents) {
1790
+ return "";
1791
+ }
1792
+ break;
1793
+ case DOC_TYPE_ARRAY: {
1794
+ const parts = [];
1795
+ for (const part of doc) {
1796
+ if (!part) {
1797
+ continue;
1798
+ }
1799
+ const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
1800
+ if (typeof currentPart === "string" && typeof at_default(
1801
+ /* isOptionalObject*/
1802
+ false,
1803
+ parts,
1804
+ -1
1805
+ ) === "string") {
1806
+ parts[parts.length - 1] += currentPart;
1807
+ } else {
1808
+ parts.push(currentPart);
1809
+ }
1810
+ parts.push(...restParts);
1811
+ }
1812
+ if (parts.length === 0) {
1813
+ return "";
1814
+ }
1815
+ if (parts.length === 1) {
1816
+ return parts[0];
1817
+ }
1818
+ return parts;
1819
+ }
1820
+ case DOC_TYPE_STRING:
1821
+ case DOC_TYPE_CURSOR:
1822
+ case DOC_TYPE_TRIM:
1823
+ case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
1824
+ case DOC_TYPE_LINE:
1825
+ case DOC_TYPE_LABEL:
1826
+ case DOC_TYPE_BREAK_PARENT:
1827
+ break;
1828
+ default:
1829
+ throw new invalid_doc_error_default(doc);
1830
+ }
1831
+ return doc;
1832
+ }
1833
+ function cleanDoc(doc) {
1834
+ return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
1835
+ }
1836
+ function replaceEndOfLine(doc, replacement = literalline) {
1837
+ return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join$1(replacement, currentDoc.split("\n")) : currentDoc);
1838
+ }
1839
+ function canBreakFn(doc) {
1840
+ if (doc.type === DOC_TYPE_LINE) {
1841
+ return true;
1842
+ }
1843
+ }
1844
+ function canBreak(doc) {
1845
+ return findInDoc(doc, canBreakFn, false);
1846
+ }
1847
+
1848
+ // src/document/printer.js
1849
+ var MODE_BREAK = Symbol("MODE_BREAK");
1850
+ var MODE_FLAT = Symbol("MODE_FLAT");
1851
+ var CURSOR_PLACEHOLDER = Symbol("cursor");
1852
+ function rootIndent() {
1853
+ return {
1854
+ value: "",
1855
+ length: 0,
1856
+ queue: []
1857
+ };
1858
+ }
1859
+ function makeIndent(ind, options) {
1860
+ return generateInd(ind, {
1861
+ type: "indent"
1862
+ }, options);
1863
+ }
1864
+ function makeAlign(indent2, widthOrDoc, options) {
1865
+ if (widthOrDoc === Number.NEGATIVE_INFINITY) {
1866
+ return indent2.root || rootIndent();
1867
+ }
1868
+ if (widthOrDoc < 0) {
1869
+ return generateInd(indent2, {
1870
+ type: "dedent"
1871
+ }, options);
1872
+ }
1873
+ if (!widthOrDoc) {
1874
+ return indent2;
1875
+ }
1876
+ if (widthOrDoc.type === "root") {
1877
+ return {
1878
+ ...indent2,
1879
+ root: indent2
1880
+ };
1881
+ }
1882
+ const alignType = typeof widthOrDoc === "string" ? "stringAlign" : "numberAlign";
1883
+ return generateInd(indent2, {
1884
+ type: alignType,
1885
+ n: widthOrDoc
1886
+ }, options);
1887
+ }
1888
+ function generateInd(ind, newPart, options) {
1889
+ const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : [...ind.queue, newPart];
1890
+ let value = "";
1891
+ let length = 0;
1892
+ let lastTabs = 0;
1893
+ let lastSpaces = 0;
1894
+ for (const part of queue) {
1895
+ switch (part.type) {
1896
+ case "indent":
1897
+ flush();
1898
+ if (options.useTabs) {
1899
+ addTabs(1);
1900
+ } else {
1901
+ addSpaces(options.tabWidth);
1902
+ }
1903
+ break;
1904
+ case "stringAlign":
1905
+ flush();
1906
+ value += part.n;
1907
+ length += part.n.length;
1908
+ break;
1909
+ case "numberAlign":
1910
+ lastTabs += 1;
1911
+ lastSpaces += part.n;
1912
+ break;
1913
+ default:
1914
+ throw new Error(`Unexpected type '${part.type}'`);
1915
+ }
1916
+ }
1917
+ flushSpaces();
1918
+ return {
1919
+ ...ind,
1920
+ value,
1921
+ length,
1922
+ queue
1923
+ };
1924
+ function addTabs(count) {
1925
+ value += " ".repeat(count);
1926
+ length += options.tabWidth * count;
1927
+ }
1928
+ function addSpaces(count) {
1929
+ value += " ".repeat(count);
1930
+ length += count;
1931
+ }
1932
+ function flush() {
1933
+ if (options.useTabs) {
1934
+ flushTabs();
1935
+ } else {
1936
+ flushSpaces();
1937
+ }
1938
+ }
1939
+ function flushTabs() {
1940
+ if (lastTabs > 0) {
1941
+ addTabs(lastTabs);
1942
+ }
1943
+ resetLast();
1944
+ }
1945
+ function flushSpaces() {
1946
+ if (lastSpaces > 0) {
1947
+ addSpaces(lastSpaces);
1948
+ }
1949
+ resetLast();
1950
+ }
1951
+ function resetLast() {
1952
+ lastTabs = 0;
1953
+ lastSpaces = 0;
1954
+ }
1955
+ }
1956
+ function trim2(out) {
1957
+ let trimCount = 0;
1958
+ let cursorCount = 0;
1959
+ let outIndex = out.length;
1960
+ outer:
1961
+ while (outIndex--) {
1962
+ const last = out[outIndex];
1963
+ if (last === CURSOR_PLACEHOLDER) {
1964
+ cursorCount++;
1965
+ continue;
1966
+ }
1967
+ for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) {
1968
+ const char = last[charIndex];
1969
+ if (char === " " || char === " ") {
1970
+ trimCount++;
1971
+ } else {
1972
+ out[outIndex] = last.slice(0, charIndex + 1);
1973
+ break outer;
1974
+ }
1975
+ }
1976
+ }
1977
+ if (trimCount > 0 || cursorCount > 0) {
1978
+ out.length = outIndex + 1;
1979
+ while (cursorCount-- > 0) {
1980
+ out.push(CURSOR_PLACEHOLDER);
1981
+ }
1982
+ }
1983
+ return trimCount;
1984
+ }
1985
+ function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) {
1986
+ if (width === Number.POSITIVE_INFINITY) {
1987
+ return true;
1988
+ }
1989
+ let restIdx = restCommands.length;
1990
+ const cmds = [next];
1991
+ const out = [];
1992
+ while (width >= 0) {
1993
+ if (cmds.length === 0) {
1994
+ if (restIdx === 0) {
1995
+ return true;
1996
+ }
1997
+ cmds.push(restCommands[--restIdx]);
1998
+ continue;
1999
+ }
2000
+ const {
2001
+ mode,
2002
+ doc
2003
+ } = cmds.pop();
2004
+ switch (get_doc_type_default(doc)) {
2005
+ case DOC_TYPE_STRING:
2006
+ out.push(doc);
2007
+ width -= get_string_width_default(doc);
2008
+ break;
2009
+ case DOC_TYPE_ARRAY:
2010
+ case DOC_TYPE_FILL: {
2011
+ const parts = getDocParts(doc);
2012
+ for (let i = parts.length - 1; i >= 0; i--) {
2013
+ cmds.push({
2014
+ mode,
2015
+ doc: parts[i]
2016
+ });
2017
+ }
2018
+ break;
2019
+ }
2020
+ case DOC_TYPE_INDENT:
2021
+ case DOC_TYPE_ALIGN:
2022
+ case DOC_TYPE_INDENT_IF_BREAK:
2023
+ case DOC_TYPE_LABEL:
2024
+ cmds.push({
2025
+ mode,
2026
+ doc: doc.contents
2027
+ });
2028
+ break;
2029
+ case DOC_TYPE_TRIM:
2030
+ width += trim2(out);
2031
+ break;
2032
+ case DOC_TYPE_GROUP: {
2033
+ if (mustBeFlat && doc.break) {
2034
+ return false;
2035
+ }
2036
+ const groupMode = doc.break ? MODE_BREAK : mode;
2037
+ const contents = doc.expandedStates && groupMode === MODE_BREAK ? at_default(
2038
+ /* isOptionalObject*/
2039
+ false,
2040
+ doc.expandedStates,
2041
+ -1
2042
+ ) : doc.contents;
2043
+ cmds.push({
2044
+ mode: groupMode,
2045
+ doc: contents
2046
+ });
2047
+ break;
2048
+ }
2049
+ case DOC_TYPE_IF_BREAK: {
2050
+ const groupMode = doc.groupId ? groupModeMap[doc.groupId] || MODE_FLAT : mode;
2051
+ const contents = groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents;
2052
+ if (contents) {
2053
+ cmds.push({
2054
+ mode,
2055
+ doc: contents
2056
+ });
2057
+ }
2058
+ break;
2059
+ }
2060
+ case DOC_TYPE_LINE:
2061
+ if (mode === MODE_BREAK || doc.hard) {
2062
+ return true;
2063
+ }
2064
+ if (!doc.soft) {
2065
+ out.push(" ");
2066
+ width--;
2067
+ }
2068
+ break;
2069
+ case DOC_TYPE_LINE_SUFFIX:
2070
+ hasLineSuffix = true;
2071
+ break;
2072
+ case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
2073
+ if (hasLineSuffix) {
2074
+ return false;
2075
+ }
2076
+ break;
2077
+ }
2078
+ }
2079
+ return false;
2080
+ }
2081
+ function printDocToString(doc, options) {
2082
+ const groupModeMap = {};
2083
+ const width = options.printWidth;
2084
+ const newLine = convertEndOfLineToChars(options.endOfLine);
2085
+ let pos = 0;
2086
+ const cmds = [{
2087
+ ind: rootIndent(),
2088
+ mode: MODE_BREAK,
2089
+ doc
2090
+ }];
2091
+ const out = [];
2092
+ let shouldRemeasure = false;
2093
+ const lineSuffix2 = [];
2094
+ let printedCursorCount = 0;
2095
+ propagateBreaks(doc);
2096
+ while (cmds.length > 0) {
2097
+ const {
2098
+ ind,
2099
+ mode,
2100
+ doc: doc2
2101
+ } = cmds.pop();
2102
+ switch (get_doc_type_default(doc2)) {
2103
+ case DOC_TYPE_STRING: {
2104
+ const formatted = newLine !== "\n" ? string_replace_all_default(
2105
+ /* isOptionalObject*/
2106
+ false,
2107
+ doc2,
2108
+ "\n",
2109
+ newLine
2110
+ ) : doc2;
2111
+ out.push(formatted);
2112
+ if (cmds.length > 0) {
2113
+ pos += get_string_width_default(formatted);
2114
+ }
2115
+ break;
2116
+ }
2117
+ case DOC_TYPE_ARRAY:
2118
+ for (let i = doc2.length - 1; i >= 0; i--) {
2119
+ cmds.push({
2120
+ ind,
2121
+ mode,
2122
+ doc: doc2[i]
2123
+ });
2124
+ }
2125
+ break;
2126
+ case DOC_TYPE_CURSOR:
2127
+ if (printedCursorCount >= 2) {
2128
+ throw new Error("There are too many 'cursor' in doc.");
2129
+ }
2130
+ out.push(CURSOR_PLACEHOLDER);
2131
+ printedCursorCount++;
2132
+ break;
2133
+ case DOC_TYPE_INDENT:
2134
+ cmds.push({
2135
+ ind: makeIndent(ind, options),
2136
+ mode,
2137
+ doc: doc2.contents
2138
+ });
2139
+ break;
2140
+ case DOC_TYPE_ALIGN:
2141
+ cmds.push({
2142
+ ind: makeAlign(ind, doc2.n, options),
2143
+ mode,
2144
+ doc: doc2.contents
2145
+ });
2146
+ break;
2147
+ case DOC_TYPE_TRIM:
2148
+ pos -= trim2(out);
2149
+ break;
2150
+ case DOC_TYPE_GROUP:
2151
+ switch (mode) {
2152
+ case MODE_FLAT:
2153
+ if (!shouldRemeasure) {
2154
+ cmds.push({
2155
+ ind,
2156
+ mode: doc2.break ? MODE_BREAK : MODE_FLAT,
2157
+ doc: doc2.contents
2158
+ });
2159
+ break;
2160
+ }
2161
+ case MODE_BREAK: {
2162
+ shouldRemeasure = false;
2163
+ const next = {
2164
+ ind,
2165
+ mode: MODE_FLAT,
2166
+ doc: doc2.contents
2167
+ };
2168
+ const rem = width - pos;
2169
+ const hasLineSuffix = lineSuffix2.length > 0;
2170
+ if (!doc2.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) {
2171
+ cmds.push(next);
2172
+ } else {
2173
+ if (doc2.expandedStates) {
2174
+ const mostExpanded = at_default(
2175
+ /* isOptionalObject*/
2176
+ false,
2177
+ doc2.expandedStates,
2178
+ -1
2179
+ );
2180
+ if (doc2.break) {
2181
+ cmds.push({
2182
+ ind,
2183
+ mode: MODE_BREAK,
2184
+ doc: mostExpanded
2185
+ });
2186
+ break;
2187
+ } else {
2188
+ for (let i = 1; i < doc2.expandedStates.length + 1; i++) {
2189
+ if (i >= doc2.expandedStates.length) {
2190
+ cmds.push({
2191
+ ind,
2192
+ mode: MODE_BREAK,
2193
+ doc: mostExpanded
2194
+ });
2195
+ break;
2196
+ } else {
2197
+ const state = doc2.expandedStates[i];
2198
+ const cmd = {
2199
+ ind,
2200
+ mode: MODE_FLAT,
2201
+ doc: state
2202
+ };
2203
+ if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) {
2204
+ cmds.push(cmd);
2205
+ break;
2206
+ }
2207
+ }
2208
+ }
2209
+ }
2210
+ } else {
2211
+ cmds.push({
2212
+ ind,
2213
+ mode: MODE_BREAK,
2214
+ doc: doc2.contents
2215
+ });
2216
+ }
2217
+ }
2218
+ break;
2219
+ }
2220
+ }
2221
+ if (doc2.id) {
2222
+ groupModeMap[doc2.id] = at_default(
2223
+ /* isOptionalObject*/
2224
+ false,
2225
+ cmds,
2226
+ -1
2227
+ ).mode;
2228
+ }
2229
+ break;
2230
+ case DOC_TYPE_FILL: {
2231
+ const rem = width - pos;
2232
+ const {
2233
+ parts
2234
+ } = doc2;
2235
+ if (parts.length === 0) {
2236
+ break;
2237
+ }
2238
+ const [content, whitespace] = parts;
2239
+ const contentFlatCmd = {
2240
+ ind,
2241
+ mode: MODE_FLAT,
2242
+ doc: content
2243
+ };
2244
+ const contentBreakCmd = {
2245
+ ind,
2246
+ mode: MODE_BREAK,
2247
+ doc: content
2248
+ };
2249
+ const contentFits = fits(contentFlatCmd, [], rem, lineSuffix2.length > 0, groupModeMap, true);
2250
+ if (parts.length === 1) {
2251
+ if (contentFits) {
2252
+ cmds.push(contentFlatCmd);
2253
+ } else {
2254
+ cmds.push(contentBreakCmd);
2255
+ }
2256
+ break;
2257
+ }
2258
+ const whitespaceFlatCmd = {
2259
+ ind,
2260
+ mode: MODE_FLAT,
2261
+ doc: whitespace
1773
2262
  };
1774
- }
1775
- function reportDiagnostic(program, diagnostic) {
1776
- const diag = createDiagnostic(diagnostic);
1777
- program.reportDiagnostic(diag);
1778
- }
2263
+ const whitespaceBreakCmd = {
2264
+ ind,
2265
+ mode: MODE_BREAK,
2266
+ doc: whitespace
2267
+ };
2268
+ if (parts.length === 2) {
2269
+ if (contentFits) {
2270
+ cmds.push(whitespaceFlatCmd, contentFlatCmd);
2271
+ } else {
2272
+ cmds.push(whitespaceBreakCmd, contentBreakCmd);
2273
+ }
2274
+ break;
2275
+ }
2276
+ parts.splice(0, 2);
2277
+ const remainingCmd = {
2278
+ ind,
2279
+ mode,
2280
+ doc: fill(parts)
2281
+ };
2282
+ const secondContent = parts[0];
2283
+ const firstAndSecondContentFlatCmd = {
2284
+ ind,
2285
+ mode: MODE_FLAT,
2286
+ doc: [content, whitespace, secondContent]
2287
+ };
2288
+ const firstAndSecondContentFits = fits(firstAndSecondContentFlatCmd, [], rem, lineSuffix2.length > 0, groupModeMap, true);
2289
+ if (firstAndSecondContentFits) {
2290
+ cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd);
2291
+ } else if (contentFits) {
2292
+ cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd);
2293
+ } else {
2294
+ cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd);
2295
+ }
2296
+ break;
2297
+ }
2298
+ case DOC_TYPE_IF_BREAK:
2299
+ case DOC_TYPE_INDENT_IF_BREAK: {
2300
+ const groupMode = doc2.groupId ? groupModeMap[doc2.groupId] : mode;
2301
+ if (groupMode === MODE_BREAK) {
2302
+ const breakContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.breakContents : doc2.negate ? doc2.contents : indent$1(doc2.contents);
2303
+ if (breakContents) {
2304
+ cmds.push({
2305
+ ind,
2306
+ mode,
2307
+ doc: breakContents
2308
+ });
2309
+ }
2310
+ }
2311
+ if (groupMode === MODE_FLAT) {
2312
+ const flatContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.flatContents : doc2.negate ? indent$1(doc2.contents) : doc2.contents;
2313
+ if (flatContents) {
2314
+ cmds.push({
2315
+ ind,
2316
+ mode,
2317
+ doc: flatContents
2318
+ });
2319
+ }
2320
+ }
2321
+ break;
2322
+ }
2323
+ case DOC_TYPE_LINE_SUFFIX:
2324
+ lineSuffix2.push({
2325
+ ind,
2326
+ mode,
2327
+ doc: doc2.contents
2328
+ });
2329
+ break;
2330
+ case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
2331
+ if (lineSuffix2.length > 0) {
2332
+ cmds.push({
2333
+ ind,
2334
+ mode,
2335
+ doc: hardlineWithoutBreakParent
2336
+ });
2337
+ }
2338
+ break;
2339
+ case DOC_TYPE_LINE:
2340
+ switch (mode) {
2341
+ case MODE_FLAT:
2342
+ if (!doc2.hard) {
2343
+ if (!doc2.soft) {
2344
+ out.push(" ");
2345
+ pos += 1;
2346
+ }
2347
+ break;
2348
+ } else {
2349
+ shouldRemeasure = true;
2350
+ }
2351
+ case MODE_BREAK:
2352
+ if (lineSuffix2.length > 0) {
2353
+ cmds.push({
2354
+ ind,
2355
+ mode,
2356
+ doc: doc2
2357
+ }, ...lineSuffix2.reverse());
2358
+ lineSuffix2.length = 0;
2359
+ break;
2360
+ }
2361
+ if (doc2.literal) {
2362
+ if (ind.root) {
2363
+ out.push(newLine, ind.root.value);
2364
+ pos = ind.root.length;
2365
+ } else {
2366
+ out.push(newLine);
2367
+ pos = 0;
2368
+ }
2369
+ } else {
2370
+ pos -= trim2(out);
2371
+ out.push(newLine + ind.value);
2372
+ pos = ind.length;
2373
+ }
2374
+ break;
2375
+ }
2376
+ break;
2377
+ case DOC_TYPE_LABEL:
2378
+ cmds.push({
2379
+ ind,
2380
+ mode,
2381
+ doc: doc2.contents
2382
+ });
2383
+ break;
2384
+ case DOC_TYPE_BREAK_PARENT:
2385
+ break;
2386
+ default:
2387
+ throw new invalid_doc_error_default(doc2);
2388
+ }
2389
+ if (cmds.length === 0 && lineSuffix2.length > 0) {
2390
+ cmds.push(...lineSuffix2.reverse());
2391
+ lineSuffix2.length = 0;
2392
+ }
2393
+ }
2394
+ const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER);
2395
+ if (cursorPlaceholderIndex !== -1) {
2396
+ const otherCursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER, cursorPlaceholderIndex + 1);
2397
+ const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
2398
+ const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join("");
2399
+ const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
1779
2400
  return {
1780
- diagnostics,
1781
- createDiagnostic,
1782
- reportDiagnostic,
2401
+ formatted: beforeCursor + aroundCursor + afterCursor,
2402
+ cursorNodeStart: beforeCursor.length,
2403
+ cursorNodeText: aroundCursor
1783
2404
  };
2405
+ }
2406
+ return {
2407
+ formatted: out.join("")
2408
+ };
1784
2409
  }
1785
- function createSourceFile(text, path) {
1786
- let lineStarts = undefined;
1787
- return {
1788
- text,
1789
- path,
1790
- getLineStarts,
1791
- getLineAndCharacterOfPosition,
1792
- };
1793
- function getLineStarts() {
1794
- return (lineStarts = lineStarts !== null && lineStarts !== void 0 ? lineStarts : scanLineStarts(text));
1795
- }
1796
- function getLineAndCharacterOfPosition(position) {
1797
- const starts = getLineStarts();
1798
- let line = binarySearch(starts, position);
1799
- // When binarySearch returns < 0 indicating that the value was not found, it
1800
- // returns the bitwise complement of the index where the value would need to
1801
- // be inserted to keep the array sorted. So flipping the bits back to this
1802
- // positive index tells us what the line number would be if we were to
1803
- // create a new line starting at the given position, and subtracting 1 from
1804
- // that therefore gives us the line number we're after.
1805
- if (line < 0) {
1806
- line = ~line - 1;
1807
- }
1808
- return {
1809
- line,
1810
- character: position - starts[line],
1811
- };
1812
- }
2410
+
2411
+ // src/document/public.js
2412
+ var builders = {
2413
+ join: join$1,
2414
+ line: line$1,
2415
+ softline: softline$1,
2416
+ hardline: hardline$1,
2417
+ literalline,
2418
+ group: group$1,
2419
+ conditionalGroup,
2420
+ fill,
2421
+ lineSuffix,
2422
+ lineSuffixBoundary,
2423
+ cursor,
2424
+ breakParent: breakParent$1,
2425
+ ifBreak: ifBreak$1,
2426
+ trim: trim$1,
2427
+ indent: indent$1,
2428
+ indentIfBreak,
2429
+ align: align$1,
2430
+ addAlignmentToDoc,
2431
+ markAsRoot,
2432
+ dedentToRoot,
2433
+ dedent,
2434
+ hardlineWithoutBreakParent,
2435
+ literallineWithoutBreakParent,
2436
+ label,
2437
+ // TODO: Remove this in v4
2438
+ concat: (parts) => parts
2439
+ };
2440
+ var printer = { printDocToString };
2441
+ var utils = {
2442
+ willBreak,
2443
+ traverseDoc: traverse_doc_default,
2444
+ findInDoc,
2445
+ mapDoc,
2446
+ removeLines,
2447
+ stripTrailingHardline,
2448
+ replaceEndOfLine,
2449
+ canBreak
2450
+ };
2451
+
2452
+ //
2453
+ // Generated by scripts/regen-nonascii-map.js
2454
+ // on node v18.16.0 with unicode 15.0.
2455
+ //
2456
+ /**
2457
+ * @internal
2458
+ *
2459
+ * Map of non-ascii characters that are valid in an identifier. Each pair of
2460
+ * numbers represents an inclusive range of code points.
2461
+ */
2462
+ //prettier-ignore
2463
+ const nonAsciiIdentifierMap = [
2464
+ 0xa0, 0x377,
2465
+ 0x37a, 0x37f,
2466
+ 0x384, 0x38a,
2467
+ 0x38c, 0x38c,
2468
+ 0x38e, 0x3a1,
2469
+ 0x3a3, 0x52f,
2470
+ 0x531, 0x556,
2471
+ 0x559, 0x58a,
2472
+ 0x58d, 0x58f,
2473
+ 0x591, 0x5c7,
2474
+ 0x5d0, 0x5ea,
2475
+ 0x5ef, 0x5f4,
2476
+ 0x600, 0x70d,
2477
+ 0x70f, 0x74a,
2478
+ 0x74d, 0x7b1,
2479
+ 0x7c0, 0x7fa,
2480
+ 0x7fd, 0x82d,
2481
+ 0x830, 0x83e,
2482
+ 0x840, 0x85b,
2483
+ 0x85e, 0x85e,
2484
+ 0x860, 0x86a,
2485
+ 0x870, 0x88e,
2486
+ 0x890, 0x891,
2487
+ 0x898, 0x983,
2488
+ 0x985, 0x98c,
2489
+ 0x98f, 0x990,
2490
+ 0x993, 0x9a8,
2491
+ 0x9aa, 0x9b0,
2492
+ 0x9b2, 0x9b2,
2493
+ 0x9b6, 0x9b9,
2494
+ 0x9bc, 0x9c4,
2495
+ 0x9c7, 0x9c8,
2496
+ 0x9cb, 0x9ce,
2497
+ 0x9d7, 0x9d7,
2498
+ 0x9dc, 0x9dd,
2499
+ 0x9df, 0x9e3,
2500
+ 0x9e6, 0x9fe,
2501
+ 0xa01, 0xa03,
2502
+ 0xa05, 0xa0a,
2503
+ 0xa0f, 0xa10,
2504
+ 0xa13, 0xa28,
2505
+ 0xa2a, 0xa30,
2506
+ 0xa32, 0xa33,
2507
+ 0xa35, 0xa36,
2508
+ 0xa38, 0xa39,
2509
+ 0xa3c, 0xa3c,
2510
+ 0xa3e, 0xa42,
2511
+ 0xa47, 0xa48,
2512
+ 0xa4b, 0xa4d,
2513
+ 0xa51, 0xa51,
2514
+ 0xa59, 0xa5c,
2515
+ 0xa5e, 0xa5e,
2516
+ 0xa66, 0xa76,
2517
+ 0xa81, 0xa83,
2518
+ 0xa85, 0xa8d,
2519
+ 0xa8f, 0xa91,
2520
+ 0xa93, 0xaa8,
2521
+ 0xaaa, 0xab0,
2522
+ 0xab2, 0xab3,
2523
+ 0xab5, 0xab9,
2524
+ 0xabc, 0xac5,
2525
+ 0xac7, 0xac9,
2526
+ 0xacb, 0xacd,
2527
+ 0xad0, 0xad0,
2528
+ 0xae0, 0xae3,
2529
+ 0xae6, 0xaf1,
2530
+ 0xaf9, 0xaff,
2531
+ 0xb01, 0xb03,
2532
+ 0xb05, 0xb0c,
2533
+ 0xb0f, 0xb10,
2534
+ 0xb13, 0xb28,
2535
+ 0xb2a, 0xb30,
2536
+ 0xb32, 0xb33,
2537
+ 0xb35, 0xb39,
2538
+ 0xb3c, 0xb44,
2539
+ 0xb47, 0xb48,
2540
+ 0xb4b, 0xb4d,
2541
+ 0xb55, 0xb57,
2542
+ 0xb5c, 0xb5d,
2543
+ 0xb5f, 0xb63,
2544
+ 0xb66, 0xb77,
2545
+ 0xb82, 0xb83,
2546
+ 0xb85, 0xb8a,
2547
+ 0xb8e, 0xb90,
2548
+ 0xb92, 0xb95,
2549
+ 0xb99, 0xb9a,
2550
+ 0xb9c, 0xb9c,
2551
+ 0xb9e, 0xb9f,
2552
+ 0xba3, 0xba4,
2553
+ 0xba8, 0xbaa,
2554
+ 0xbae, 0xbb9,
2555
+ 0xbbe, 0xbc2,
2556
+ 0xbc6, 0xbc8,
2557
+ 0xbca, 0xbcd,
2558
+ 0xbd0, 0xbd0,
2559
+ 0xbd7, 0xbd7,
2560
+ 0xbe6, 0xbfa,
2561
+ 0xc00, 0xc0c,
2562
+ 0xc0e, 0xc10,
2563
+ 0xc12, 0xc28,
2564
+ 0xc2a, 0xc39,
2565
+ 0xc3c, 0xc44,
2566
+ 0xc46, 0xc48,
2567
+ 0xc4a, 0xc4d,
2568
+ 0xc55, 0xc56,
2569
+ 0xc58, 0xc5a,
2570
+ 0xc5d, 0xc5d,
2571
+ 0xc60, 0xc63,
2572
+ 0xc66, 0xc6f,
2573
+ 0xc77, 0xc8c,
2574
+ 0xc8e, 0xc90,
2575
+ 0xc92, 0xca8,
2576
+ 0xcaa, 0xcb3,
2577
+ 0xcb5, 0xcb9,
2578
+ 0xcbc, 0xcc4,
2579
+ 0xcc6, 0xcc8,
2580
+ 0xcca, 0xccd,
2581
+ 0xcd5, 0xcd6,
2582
+ 0xcdd, 0xcde,
2583
+ 0xce0, 0xce3,
2584
+ 0xce6, 0xcef,
2585
+ 0xcf1, 0xcf3,
2586
+ 0xd00, 0xd0c,
2587
+ 0xd0e, 0xd10,
2588
+ 0xd12, 0xd44,
2589
+ 0xd46, 0xd48,
2590
+ 0xd4a, 0xd4f,
2591
+ 0xd54, 0xd63,
2592
+ 0xd66, 0xd7f,
2593
+ 0xd81, 0xd83,
2594
+ 0xd85, 0xd96,
2595
+ 0xd9a, 0xdb1,
2596
+ 0xdb3, 0xdbb,
2597
+ 0xdbd, 0xdbd,
2598
+ 0xdc0, 0xdc6,
2599
+ 0xdca, 0xdca,
2600
+ 0xdcf, 0xdd4,
2601
+ 0xdd6, 0xdd6,
2602
+ 0xdd8, 0xddf,
2603
+ 0xde6, 0xdef,
2604
+ 0xdf2, 0xdf4,
2605
+ 0xe01, 0xe3a,
2606
+ 0xe3f, 0xe5b,
2607
+ 0xe81, 0xe82,
2608
+ 0xe84, 0xe84,
2609
+ 0xe86, 0xe8a,
2610
+ 0xe8c, 0xea3,
2611
+ 0xea5, 0xea5,
2612
+ 0xea7, 0xebd,
2613
+ 0xec0, 0xec4,
2614
+ 0xec6, 0xec6,
2615
+ 0xec8, 0xece,
2616
+ 0xed0, 0xed9,
2617
+ 0xedc, 0xedf,
2618
+ 0xf00, 0xf47,
2619
+ 0xf49, 0xf6c,
2620
+ 0xf71, 0xf97,
2621
+ 0xf99, 0xfbc,
2622
+ 0xfbe, 0xfcc,
2623
+ 0xfce, 0xfda,
2624
+ 0x1000, 0x10c5,
2625
+ 0x10c7, 0x10c7,
2626
+ 0x10cd, 0x10cd,
2627
+ 0x10d0, 0x1248,
2628
+ 0x124a, 0x124d,
2629
+ 0x1250, 0x1256,
2630
+ 0x1258, 0x1258,
2631
+ 0x125a, 0x125d,
2632
+ 0x1260, 0x1288,
2633
+ 0x128a, 0x128d,
2634
+ 0x1290, 0x12b0,
2635
+ 0x12b2, 0x12b5,
2636
+ 0x12b8, 0x12be,
2637
+ 0x12c0, 0x12c0,
2638
+ 0x12c2, 0x12c5,
2639
+ 0x12c8, 0x12d6,
2640
+ 0x12d8, 0x1310,
2641
+ 0x1312, 0x1315,
2642
+ 0x1318, 0x135a,
2643
+ 0x135d, 0x137c,
2644
+ 0x1380, 0x1399,
2645
+ 0x13a0, 0x13f5,
2646
+ 0x13f8, 0x13fd,
2647
+ 0x1400, 0x169c,
2648
+ 0x16a0, 0x16f8,
2649
+ 0x1700, 0x1715,
2650
+ 0x171f, 0x1736,
2651
+ 0x1740, 0x1753,
2652
+ 0x1760, 0x176c,
2653
+ 0x176e, 0x1770,
2654
+ 0x1772, 0x1773,
2655
+ 0x1780, 0x17dd,
2656
+ 0x17e0, 0x17e9,
2657
+ 0x17f0, 0x17f9,
2658
+ 0x1800, 0x1819,
2659
+ 0x1820, 0x1878,
2660
+ 0x1880, 0x18aa,
2661
+ 0x18b0, 0x18f5,
2662
+ 0x1900, 0x191e,
2663
+ 0x1920, 0x192b,
2664
+ 0x1930, 0x193b,
2665
+ 0x1940, 0x1940,
2666
+ 0x1944, 0x196d,
2667
+ 0x1970, 0x1974,
2668
+ 0x1980, 0x19ab,
2669
+ 0x19b0, 0x19c9,
2670
+ 0x19d0, 0x19da,
2671
+ 0x19de, 0x1a1b,
2672
+ 0x1a1e, 0x1a5e,
2673
+ 0x1a60, 0x1a7c,
2674
+ 0x1a7f, 0x1a89,
2675
+ 0x1a90, 0x1a99,
2676
+ 0x1aa0, 0x1aad,
2677
+ 0x1ab0, 0x1ace,
2678
+ 0x1b00, 0x1b4c,
2679
+ 0x1b50, 0x1b7e,
2680
+ 0x1b80, 0x1bf3,
2681
+ 0x1bfc, 0x1c37,
2682
+ 0x1c3b, 0x1c49,
2683
+ 0x1c4d, 0x1c88,
2684
+ 0x1c90, 0x1cba,
2685
+ 0x1cbd, 0x1cc7,
2686
+ 0x1cd0, 0x1cfa,
2687
+ 0x1d00, 0x1f15,
2688
+ 0x1f18, 0x1f1d,
2689
+ 0x1f20, 0x1f45,
2690
+ 0x1f48, 0x1f4d,
2691
+ 0x1f50, 0x1f57,
2692
+ 0x1f59, 0x1f59,
2693
+ 0x1f5b, 0x1f5b,
2694
+ 0x1f5d, 0x1f5d,
2695
+ 0x1f5f, 0x1f7d,
2696
+ 0x1f80, 0x1fb4,
2697
+ 0x1fb6, 0x1fc4,
2698
+ 0x1fc6, 0x1fd3,
2699
+ 0x1fd6, 0x1fdb,
2700
+ 0x1fdd, 0x1fef,
2701
+ 0x1ff2, 0x1ff4,
2702
+ 0x1ff6, 0x1ffe,
2703
+ 0x2000, 0x200d,
2704
+ 0x2010, 0x2027,
2705
+ 0x202a, 0x2064,
2706
+ 0x2066, 0x2071,
2707
+ 0x2074, 0x208e,
2708
+ 0x2090, 0x209c,
2709
+ 0x20a0, 0x20c0,
2710
+ 0x20d0, 0x20f0,
2711
+ 0x2100, 0x218b,
2712
+ 0x2190, 0x2426,
2713
+ 0x2440, 0x244a,
2714
+ 0x2460, 0x2b73,
2715
+ 0x2b76, 0x2b95,
2716
+ 0x2b97, 0x2cf3,
2717
+ 0x2cf9, 0x2d25,
2718
+ 0x2d27, 0x2d27,
2719
+ 0x2d2d, 0x2d2d,
2720
+ 0x2d30, 0x2d67,
2721
+ 0x2d6f, 0x2d70,
2722
+ 0x2d7f, 0x2d96,
2723
+ 0x2da0, 0x2da6,
2724
+ 0x2da8, 0x2dae,
2725
+ 0x2db0, 0x2db6,
2726
+ 0x2db8, 0x2dbe,
2727
+ 0x2dc0, 0x2dc6,
2728
+ 0x2dc8, 0x2dce,
2729
+ 0x2dd0, 0x2dd6,
2730
+ 0x2dd8, 0x2dde,
2731
+ 0x2de0, 0x2e5d,
2732
+ 0x2e80, 0x2e99,
2733
+ 0x2e9b, 0x2ef3,
2734
+ 0x2f00, 0x2fd5,
2735
+ 0x2ff0, 0x2ffb,
2736
+ 0x3000, 0x303f,
2737
+ 0x3041, 0x3096,
2738
+ 0x3099, 0x30ff,
2739
+ 0x3105, 0x312f,
2740
+ 0x3131, 0x318e,
2741
+ 0x3190, 0x31e3,
2742
+ 0x31f0, 0x321e,
2743
+ 0x3220, 0xa48c,
2744
+ 0xa490, 0xa4c6,
2745
+ 0xa4d0, 0xa62b,
2746
+ 0xa640, 0xa6f7,
2747
+ 0xa700, 0xa7ca,
2748
+ 0xa7d0, 0xa7d1,
2749
+ 0xa7d3, 0xa7d3,
2750
+ 0xa7d5, 0xa7d9,
2751
+ 0xa7f2, 0xa82c,
2752
+ 0xa830, 0xa839,
2753
+ 0xa840, 0xa877,
2754
+ 0xa880, 0xa8c5,
2755
+ 0xa8ce, 0xa8d9,
2756
+ 0xa8e0, 0xa953,
2757
+ 0xa95f, 0xa97c,
2758
+ 0xa980, 0xa9cd,
2759
+ 0xa9cf, 0xa9d9,
2760
+ 0xa9de, 0xa9fe,
2761
+ 0xaa00, 0xaa36,
2762
+ 0xaa40, 0xaa4d,
2763
+ 0xaa50, 0xaa59,
2764
+ 0xaa5c, 0xaac2,
2765
+ 0xaadb, 0xaaf6,
2766
+ 0xab01, 0xab06,
2767
+ 0xab09, 0xab0e,
2768
+ 0xab11, 0xab16,
2769
+ 0xab20, 0xab26,
2770
+ 0xab28, 0xab2e,
2771
+ 0xab30, 0xab6b,
2772
+ 0xab70, 0xabed,
2773
+ 0xabf0, 0xabf9,
2774
+ 0xac00, 0xd7a3,
2775
+ 0xd7b0, 0xd7c6,
2776
+ 0xd7cb, 0xd7fb,
2777
+ 0xf900, 0xfa6d,
2778
+ 0xfa70, 0xfad9,
2779
+ 0xfb00, 0xfb06,
2780
+ 0xfb13, 0xfb17,
2781
+ 0xfb1d, 0xfb36,
2782
+ 0xfb38, 0xfb3c,
2783
+ 0xfb3e, 0xfb3e,
2784
+ 0xfb40, 0xfb41,
2785
+ 0xfb43, 0xfb44,
2786
+ 0xfb46, 0xfbc2,
2787
+ 0xfbd3, 0xfd8f,
2788
+ 0xfd92, 0xfdc7,
2789
+ 0xfdcf, 0xfdcf,
2790
+ 0xfdf0, 0xfe19,
2791
+ 0xfe20, 0xfe52,
2792
+ 0xfe54, 0xfe66,
2793
+ 0xfe68, 0xfe6b,
2794
+ 0xfe70, 0xfe74,
2795
+ 0xfe76, 0xfefc,
2796
+ 0xfeff, 0xfeff,
2797
+ 0xff01, 0xffbe,
2798
+ 0xffc2, 0xffc7,
2799
+ 0xffca, 0xffcf,
2800
+ 0xffd2, 0xffd7,
2801
+ 0xffda, 0xffdc,
2802
+ 0xffe0, 0xffe6,
2803
+ 0xffe8, 0xffee,
2804
+ 0xfff9, 0xfffc,
2805
+ 0x10000, 0x1000b,
2806
+ 0x1000d, 0x10026,
2807
+ 0x10028, 0x1003a,
2808
+ 0x1003c, 0x1003d,
2809
+ 0x1003f, 0x1004d,
2810
+ 0x10050, 0x1005d,
2811
+ 0x10080, 0x100fa,
2812
+ 0x10100, 0x10102,
2813
+ 0x10107, 0x10133,
2814
+ 0x10137, 0x1018e,
2815
+ 0x10190, 0x1019c,
2816
+ 0x101a0, 0x101a0,
2817
+ 0x101d0, 0x101fd,
2818
+ 0x10280, 0x1029c,
2819
+ 0x102a0, 0x102d0,
2820
+ 0x102e0, 0x102fb,
2821
+ 0x10300, 0x10323,
2822
+ 0x1032d, 0x1034a,
2823
+ 0x10350, 0x1037a,
2824
+ 0x10380, 0x1039d,
2825
+ 0x1039f, 0x103c3,
2826
+ 0x103c8, 0x103d5,
2827
+ 0x10400, 0x1049d,
2828
+ 0x104a0, 0x104a9,
2829
+ 0x104b0, 0x104d3,
2830
+ 0x104d8, 0x104fb,
2831
+ 0x10500, 0x10527,
2832
+ 0x10530, 0x10563,
2833
+ 0x1056f, 0x1057a,
2834
+ 0x1057c, 0x1058a,
2835
+ 0x1058c, 0x10592,
2836
+ 0x10594, 0x10595,
2837
+ 0x10597, 0x105a1,
2838
+ 0x105a3, 0x105b1,
2839
+ 0x105b3, 0x105b9,
2840
+ 0x105bb, 0x105bc,
2841
+ 0x10600, 0x10736,
2842
+ 0x10740, 0x10755,
2843
+ 0x10760, 0x10767,
2844
+ 0x10780, 0x10785,
2845
+ 0x10787, 0x107b0,
2846
+ 0x107b2, 0x107ba,
2847
+ 0x10800, 0x10805,
2848
+ 0x10808, 0x10808,
2849
+ 0x1080a, 0x10835,
2850
+ 0x10837, 0x10838,
2851
+ 0x1083c, 0x1083c,
2852
+ 0x1083f, 0x10855,
2853
+ 0x10857, 0x1089e,
2854
+ 0x108a7, 0x108af,
2855
+ 0x108e0, 0x108f2,
2856
+ 0x108f4, 0x108f5,
2857
+ 0x108fb, 0x1091b,
2858
+ 0x1091f, 0x10939,
2859
+ 0x1093f, 0x1093f,
2860
+ 0x10980, 0x109b7,
2861
+ 0x109bc, 0x109cf,
2862
+ 0x109d2, 0x10a03,
2863
+ 0x10a05, 0x10a06,
2864
+ 0x10a0c, 0x10a13,
2865
+ 0x10a15, 0x10a17,
2866
+ 0x10a19, 0x10a35,
2867
+ 0x10a38, 0x10a3a,
2868
+ 0x10a3f, 0x10a48,
2869
+ 0x10a50, 0x10a58,
2870
+ 0x10a60, 0x10a9f,
2871
+ 0x10ac0, 0x10ae6,
2872
+ 0x10aeb, 0x10af6,
2873
+ 0x10b00, 0x10b35,
2874
+ 0x10b39, 0x10b55,
2875
+ 0x10b58, 0x10b72,
2876
+ 0x10b78, 0x10b91,
2877
+ 0x10b99, 0x10b9c,
2878
+ 0x10ba9, 0x10baf,
2879
+ 0x10c00, 0x10c48,
2880
+ 0x10c80, 0x10cb2,
2881
+ 0x10cc0, 0x10cf2,
2882
+ 0x10cfa, 0x10d27,
2883
+ 0x10d30, 0x10d39,
2884
+ 0x10e60, 0x10e7e,
2885
+ 0x10e80, 0x10ea9,
2886
+ 0x10eab, 0x10ead,
2887
+ 0x10eb0, 0x10eb1,
2888
+ 0x10efd, 0x10f27,
2889
+ 0x10f30, 0x10f59,
2890
+ 0x10f70, 0x10f89,
2891
+ 0x10fb0, 0x10fcb,
2892
+ 0x10fe0, 0x10ff6,
2893
+ 0x11000, 0x1104d,
2894
+ 0x11052, 0x11075,
2895
+ 0x1107f, 0x110c2,
2896
+ 0x110cd, 0x110cd,
2897
+ 0x110d0, 0x110e8,
2898
+ 0x110f0, 0x110f9,
2899
+ 0x11100, 0x11134,
2900
+ 0x11136, 0x11147,
2901
+ 0x11150, 0x11176,
2902
+ 0x11180, 0x111df,
2903
+ 0x111e1, 0x111f4,
2904
+ 0x11200, 0x11211,
2905
+ 0x11213, 0x11241,
2906
+ 0x11280, 0x11286,
2907
+ 0x11288, 0x11288,
2908
+ 0x1128a, 0x1128d,
2909
+ 0x1128f, 0x1129d,
2910
+ 0x1129f, 0x112a9,
2911
+ 0x112b0, 0x112ea,
2912
+ 0x112f0, 0x112f9,
2913
+ 0x11300, 0x11303,
2914
+ 0x11305, 0x1130c,
2915
+ 0x1130f, 0x11310,
2916
+ 0x11313, 0x11328,
2917
+ 0x1132a, 0x11330,
2918
+ 0x11332, 0x11333,
2919
+ 0x11335, 0x11339,
2920
+ 0x1133b, 0x11344,
2921
+ 0x11347, 0x11348,
2922
+ 0x1134b, 0x1134d,
2923
+ 0x11350, 0x11350,
2924
+ 0x11357, 0x11357,
2925
+ 0x1135d, 0x11363,
2926
+ 0x11366, 0x1136c,
2927
+ 0x11370, 0x11374,
2928
+ 0x11400, 0x1145b,
2929
+ 0x1145d, 0x11461,
2930
+ 0x11480, 0x114c7,
2931
+ 0x114d0, 0x114d9,
2932
+ 0x11580, 0x115b5,
2933
+ 0x115b8, 0x115dd,
2934
+ 0x11600, 0x11644,
2935
+ 0x11650, 0x11659,
2936
+ 0x11660, 0x1166c,
2937
+ 0x11680, 0x116b9,
2938
+ 0x116c0, 0x116c9,
2939
+ 0x11700, 0x1171a,
2940
+ 0x1171d, 0x1172b,
2941
+ 0x11730, 0x11746,
2942
+ 0x11800, 0x1183b,
2943
+ 0x118a0, 0x118f2,
2944
+ 0x118ff, 0x11906,
2945
+ 0x11909, 0x11909,
2946
+ 0x1190c, 0x11913,
2947
+ 0x11915, 0x11916,
2948
+ 0x11918, 0x11935,
2949
+ 0x11937, 0x11938,
2950
+ 0x1193b, 0x11946,
2951
+ 0x11950, 0x11959,
2952
+ 0x119a0, 0x119a7,
2953
+ 0x119aa, 0x119d7,
2954
+ 0x119da, 0x119e4,
2955
+ 0x11a00, 0x11a47,
2956
+ 0x11a50, 0x11aa2,
2957
+ 0x11ab0, 0x11af8,
2958
+ 0x11b00, 0x11b09,
2959
+ 0x11c00, 0x11c08,
2960
+ 0x11c0a, 0x11c36,
2961
+ 0x11c38, 0x11c45,
2962
+ 0x11c50, 0x11c6c,
2963
+ 0x11c70, 0x11c8f,
2964
+ 0x11c92, 0x11ca7,
2965
+ 0x11ca9, 0x11cb6,
2966
+ 0x11d00, 0x11d06,
2967
+ 0x11d08, 0x11d09,
2968
+ 0x11d0b, 0x11d36,
2969
+ 0x11d3a, 0x11d3a,
2970
+ 0x11d3c, 0x11d3d,
2971
+ 0x11d3f, 0x11d47,
2972
+ 0x11d50, 0x11d59,
2973
+ 0x11d60, 0x11d65,
2974
+ 0x11d67, 0x11d68,
2975
+ 0x11d6a, 0x11d8e,
2976
+ 0x11d90, 0x11d91,
2977
+ 0x11d93, 0x11d98,
2978
+ 0x11da0, 0x11da9,
2979
+ 0x11ee0, 0x11ef8,
2980
+ 0x11f00, 0x11f10,
2981
+ 0x11f12, 0x11f3a,
2982
+ 0x11f3e, 0x11f59,
2983
+ 0x11fb0, 0x11fb0,
2984
+ 0x11fc0, 0x11ff1,
2985
+ 0x11fff, 0x12399,
2986
+ 0x12400, 0x1246e,
2987
+ 0x12470, 0x12474,
2988
+ 0x12480, 0x12543,
2989
+ 0x12f90, 0x12ff2,
2990
+ 0x13000, 0x13455,
2991
+ 0x14400, 0x14646,
2992
+ 0x16800, 0x16a38,
2993
+ 0x16a40, 0x16a5e,
2994
+ 0x16a60, 0x16a69,
2995
+ 0x16a6e, 0x16abe,
2996
+ 0x16ac0, 0x16ac9,
2997
+ 0x16ad0, 0x16aed,
2998
+ 0x16af0, 0x16af5,
2999
+ 0x16b00, 0x16b45,
3000
+ 0x16b50, 0x16b59,
3001
+ 0x16b5b, 0x16b61,
3002
+ 0x16b63, 0x16b77,
3003
+ 0x16b7d, 0x16b8f,
3004
+ 0x16e40, 0x16e9a,
3005
+ 0x16f00, 0x16f4a,
3006
+ 0x16f4f, 0x16f87,
3007
+ 0x16f8f, 0x16f9f,
3008
+ 0x16fe0, 0x16fe4,
3009
+ 0x16ff0, 0x16ff1,
3010
+ 0x17000, 0x187f7,
3011
+ 0x18800, 0x18cd5,
3012
+ 0x18d00, 0x18d08,
3013
+ 0x1aff0, 0x1aff3,
3014
+ 0x1aff5, 0x1affb,
3015
+ 0x1affd, 0x1affe,
3016
+ 0x1b000, 0x1b122,
3017
+ 0x1b132, 0x1b132,
3018
+ 0x1b150, 0x1b152,
3019
+ 0x1b155, 0x1b155,
3020
+ 0x1b164, 0x1b167,
3021
+ 0x1b170, 0x1b2fb,
3022
+ 0x1bc00, 0x1bc6a,
3023
+ 0x1bc70, 0x1bc7c,
3024
+ 0x1bc80, 0x1bc88,
3025
+ 0x1bc90, 0x1bc99,
3026
+ 0x1bc9c, 0x1bca3,
3027
+ 0x1cf00, 0x1cf2d,
3028
+ 0x1cf30, 0x1cf46,
3029
+ 0x1cf50, 0x1cfc3,
3030
+ 0x1d000, 0x1d0f5,
3031
+ 0x1d100, 0x1d126,
3032
+ 0x1d129, 0x1d1ea,
3033
+ 0x1d200, 0x1d245,
3034
+ 0x1d2c0, 0x1d2d3,
3035
+ 0x1d2e0, 0x1d2f3,
3036
+ 0x1d300, 0x1d356,
3037
+ 0x1d360, 0x1d378,
3038
+ 0x1d400, 0x1d454,
3039
+ 0x1d456, 0x1d49c,
3040
+ 0x1d49e, 0x1d49f,
3041
+ 0x1d4a2, 0x1d4a2,
3042
+ 0x1d4a5, 0x1d4a6,
3043
+ 0x1d4a9, 0x1d4ac,
3044
+ 0x1d4ae, 0x1d4b9,
3045
+ 0x1d4bb, 0x1d4bb,
3046
+ 0x1d4bd, 0x1d4c3,
3047
+ 0x1d4c5, 0x1d505,
3048
+ 0x1d507, 0x1d50a,
3049
+ 0x1d50d, 0x1d514,
3050
+ 0x1d516, 0x1d51c,
3051
+ 0x1d51e, 0x1d539,
3052
+ 0x1d53b, 0x1d53e,
3053
+ 0x1d540, 0x1d544,
3054
+ 0x1d546, 0x1d546,
3055
+ 0x1d54a, 0x1d550,
3056
+ 0x1d552, 0x1d6a5,
3057
+ 0x1d6a8, 0x1d7cb,
3058
+ 0x1d7ce, 0x1da8b,
3059
+ 0x1da9b, 0x1da9f,
3060
+ 0x1daa1, 0x1daaf,
3061
+ 0x1df00, 0x1df1e,
3062
+ 0x1df25, 0x1df2a,
3063
+ 0x1e000, 0x1e006,
3064
+ 0x1e008, 0x1e018,
3065
+ 0x1e01b, 0x1e021,
3066
+ 0x1e023, 0x1e024,
3067
+ 0x1e026, 0x1e02a,
3068
+ 0x1e030, 0x1e06d,
3069
+ 0x1e08f, 0x1e08f,
3070
+ 0x1e100, 0x1e12c,
3071
+ 0x1e130, 0x1e13d,
3072
+ 0x1e140, 0x1e149,
3073
+ 0x1e14e, 0x1e14f,
3074
+ 0x1e290, 0x1e2ae,
3075
+ 0x1e2c0, 0x1e2f9,
3076
+ 0x1e2ff, 0x1e2ff,
3077
+ 0x1e4d0, 0x1e4f9,
3078
+ 0x1e7e0, 0x1e7e6,
3079
+ 0x1e7e8, 0x1e7eb,
3080
+ 0x1e7ed, 0x1e7ee,
3081
+ 0x1e7f0, 0x1e7fe,
3082
+ 0x1e800, 0x1e8c4,
3083
+ 0x1e8c7, 0x1e8d6,
3084
+ 0x1e900, 0x1e94b,
3085
+ 0x1e950, 0x1e959,
3086
+ 0x1e95e, 0x1e95f,
3087
+ 0x1ec71, 0x1ecb4,
3088
+ 0x1ed01, 0x1ed3d,
3089
+ 0x1ee00, 0x1ee03,
3090
+ 0x1ee05, 0x1ee1f,
3091
+ 0x1ee21, 0x1ee22,
3092
+ 0x1ee24, 0x1ee24,
3093
+ 0x1ee27, 0x1ee27,
3094
+ 0x1ee29, 0x1ee32,
3095
+ 0x1ee34, 0x1ee37,
3096
+ 0x1ee39, 0x1ee39,
3097
+ 0x1ee3b, 0x1ee3b,
3098
+ 0x1ee42, 0x1ee42,
3099
+ 0x1ee47, 0x1ee47,
3100
+ 0x1ee49, 0x1ee49,
3101
+ 0x1ee4b, 0x1ee4b,
3102
+ 0x1ee4d, 0x1ee4f,
3103
+ 0x1ee51, 0x1ee52,
3104
+ 0x1ee54, 0x1ee54,
3105
+ 0x1ee57, 0x1ee57,
3106
+ 0x1ee59, 0x1ee59,
3107
+ 0x1ee5b, 0x1ee5b,
3108
+ 0x1ee5d, 0x1ee5d,
3109
+ 0x1ee5f, 0x1ee5f,
3110
+ 0x1ee61, 0x1ee62,
3111
+ 0x1ee64, 0x1ee64,
3112
+ 0x1ee67, 0x1ee6a,
3113
+ 0x1ee6c, 0x1ee72,
3114
+ 0x1ee74, 0x1ee77,
3115
+ 0x1ee79, 0x1ee7c,
3116
+ 0x1ee7e, 0x1ee7e,
3117
+ 0x1ee80, 0x1ee89,
3118
+ 0x1ee8b, 0x1ee9b,
3119
+ 0x1eea1, 0x1eea3,
3120
+ 0x1eea5, 0x1eea9,
3121
+ 0x1eeab, 0x1eebb,
3122
+ 0x1eef0, 0x1eef1,
3123
+ 0x1f000, 0x1f02b,
3124
+ 0x1f030, 0x1f093,
3125
+ 0x1f0a0, 0x1f0ae,
3126
+ 0x1f0b1, 0x1f0bf,
3127
+ 0x1f0c1, 0x1f0cf,
3128
+ 0x1f0d1, 0x1f0f5,
3129
+ 0x1f100, 0x1f1ad,
3130
+ 0x1f1e6, 0x1f202,
3131
+ 0x1f210, 0x1f23b,
3132
+ 0x1f240, 0x1f248,
3133
+ 0x1f250, 0x1f251,
3134
+ 0x1f260, 0x1f265,
3135
+ 0x1f300, 0x1f6d7,
3136
+ 0x1f6dc, 0x1f6ec,
3137
+ 0x1f6f0, 0x1f6fc,
3138
+ 0x1f700, 0x1f776,
3139
+ 0x1f77b, 0x1f7d9,
3140
+ 0x1f7e0, 0x1f7eb,
3141
+ 0x1f7f0, 0x1f7f0,
3142
+ 0x1f800, 0x1f80b,
3143
+ 0x1f810, 0x1f847,
3144
+ 0x1f850, 0x1f859,
3145
+ 0x1f860, 0x1f887,
3146
+ 0x1f890, 0x1f8ad,
3147
+ 0x1f8b0, 0x1f8b1,
3148
+ 0x1f900, 0x1fa53,
3149
+ 0x1fa60, 0x1fa6d,
3150
+ 0x1fa70, 0x1fa7c,
3151
+ 0x1fa80, 0x1fa88,
3152
+ 0x1fa90, 0x1fabd,
3153
+ 0x1fabf, 0x1fac5,
3154
+ 0x1face, 0x1fadb,
3155
+ 0x1fae0, 0x1fae8,
3156
+ 0x1faf0, 0x1faf8,
3157
+ 0x1fb00, 0x1fb92,
3158
+ 0x1fb94, 0x1fbca,
3159
+ 0x1fbf0, 0x1fbf9,
3160
+ 0x20000, 0x2a6df,
3161
+ 0x2a700, 0x2b739,
3162
+ 0x2b740, 0x2b81d,
3163
+ 0x2b820, 0x2cea1,
3164
+ 0x2ceb0, 0x2ebe0,
3165
+ 0x2f800, 0x2fa1d,
3166
+ 0x30000, 0x3134a,
3167
+ 0x31350, 0x323af,
3168
+ 0xe0001, 0xe0001,
3169
+ 0xe0020, 0xe007f,
3170
+ 0xe0100, 0xe01ef,
3171
+ ];
3172
+
3173
+ function utf16CodeUnits(codePoint) {
3174
+ return codePoint >= 0x10000 ? 2 : 1;
1813
3175
  }
1814
- function getSourceLocation(target) {
1815
- if (target === NoTarget || target === undefined) {
1816
- return undefined;
1817
- }
1818
- if ("file" in target) {
1819
- return target;
1820
- }
1821
- if (!("kind" in target)) {
1822
- // symbol
1823
- if (target.flags & 524288 /* SymbolFlags.Using */) {
1824
- target = target.symbolSource;
1825
- }
1826
- if (!target.declarations[0]) {
1827
- return createSyntheticSourceLocation();
1828
- }
1829
- return getSourceLocationOfNode(target.declarations[0]);
3176
+ function isLineBreak(ch) {
3177
+ return ch === 10 /* CharCode.LineFeed */ || ch === 13 /* CharCode.CarriageReturn */;
3178
+ }
3179
+ function isAsciiWhiteSpaceSingleLine(ch) {
3180
+ return (ch === 32 /* CharCode.Space */ ||
3181
+ ch === 9 /* CharCode.Tab */ ||
3182
+ ch === 11 /* CharCode.VerticalTab */ ||
3183
+ ch === 12 /* CharCode.FormFeed */);
3184
+ }
3185
+ function isNonAsciiWhiteSpaceSingleLine(ch) {
3186
+ return (ch === 133 /* CharCode.NextLine */ || // not considered a line break
3187
+ ch === 8206 /* CharCode.LeftToRightMark */ ||
3188
+ ch === 8207 /* CharCode.RightToLeftMark */ ||
3189
+ ch === 8232 /* CharCode.LineSeparator */ ||
3190
+ ch === 8233 /* CharCode.ParagraphSeparator */);
3191
+ }
3192
+ function isWhiteSpace(ch) {
3193
+ return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);
3194
+ }
3195
+ function isWhiteSpaceSingleLine(ch) {
3196
+ return (isAsciiWhiteSpaceSingleLine(ch) ||
3197
+ (ch > 127 /* CharCode.MaxAscii */ && isNonAsciiWhiteSpaceSingleLine(ch)));
3198
+ }
3199
+ function trim(str) {
3200
+ let start = 0;
3201
+ let end = str.length - 1;
3202
+ if (!isWhiteSpace(str.charCodeAt(start)) && !isWhiteSpace(str.charCodeAt(end))) {
3203
+ return str;
1830
3204
  }
1831
- else if (typeof target.kind === "number") {
1832
- // node
1833
- return getSourceLocationOfNode(target);
3205
+ while (isWhiteSpace(str.charCodeAt(start))) {
3206
+ start++;
1834
3207
  }
1835
- else {
1836
- // type
1837
- const targetNode = target.node;
1838
- if (targetNode) {
1839
- return getSourceLocationOfNode(targetNode);
1840
- }
1841
- return createSyntheticSourceLocation();
3208
+ while (isWhiteSpace(str.charCodeAt(end))) {
3209
+ end--;
1842
3210
  }
3211
+ return str.substring(start, end + 1);
1843
3212
  }
1844
- function createSyntheticSourceLocation(loc = "<unknown location>") {
1845
- return {
1846
- file: createSourceFile("", loc),
1847
- pos: 0,
1848
- end: 0,
1849
- isSynthetic: true,
1850
- };
3213
+ function isDigit(ch) {
3214
+ return ch >= 48 /* CharCode._0 */ && ch <= 57 /* CharCode._9 */;
1851
3215
  }
1852
- function getSourceLocationOfNode(node) {
1853
- let root = node;
1854
- while (root.parent !== undefined) {
1855
- root = root.parent;
1856
- }
1857
- if (root.kind !== SyntaxKind.TypeSpecScript && root.kind !== SyntaxKind.JsSourceFile) {
1858
- return createSyntheticSourceLocation(node.flags & 8 /* NodeFlags.Synthetic */
1859
- ? undefined
1860
- : "<unknown location - cannot obtain source location of unbound node - file bug at https://github.com/microsoft/typespec>");
1861
- }
1862
- return {
1863
- file: root.file,
1864
- pos: node.pos,
1865
- end: node.end,
1866
- };
3216
+ function isHexDigit(ch) {
3217
+ return (isDigit(ch) || (ch >= 65 /* CharCode.A */ && ch <= 70 /* CharCode.F */) || (ch >= 97 /* CharCode.a */ && ch <= 102 /* CharCode.f */));
1867
3218
  }
1868
- /**
1869
- * Use this to report bugs in the compiler, and not errors in the source code
1870
- * being compiled.
1871
- *
1872
- * @param condition Throw if this is not true.
1873
- *
1874
- * @param message Error message.
1875
- *
1876
- * @param target Optional location in source code that might give a clue about
1877
- * what got the compiler off track.
1878
- */
1879
- function compilerAssert(condition, message, target) {
1880
- if (condition) {
1881
- return;
1882
- }
1883
- if (target) {
1884
- let location;
1885
- try {
1886
- location = getSourceLocation(target);
1887
- }
1888
- catch (err) { }
1889
- if (location) {
1890
- const pos = location.file.getLineAndCharacterOfPosition(location.pos);
1891
- const file = location.file.path;
1892
- const line = pos.line + 1;
1893
- const col = pos.character + 1;
1894
- message += `\nOccurred while compiling code in ${file} near line ${line}, column ${col}`;
1895
- }
1896
- }
1897
- throw new Error(message);
3219
+ function isBinaryDigit(ch) {
3220
+ return ch === 48 /* CharCode._0 */ || ch === 49 /* CharCode._1 */;
1898
3221
  }
1899
- function scanLineStarts(text) {
1900
- const starts = [];
1901
- let start = 0;
1902
- let pos = 0;
1903
- while (pos < text.length) {
1904
- const ch = text.charCodeAt(pos);
1905
- pos++;
1906
- switch (ch) {
1907
- case 13 /* CharCode.CarriageReturn */:
1908
- if (text.charCodeAt(pos) === 10 /* CharCode.LineFeed */) {
1909
- pos++;
1910
- }
1911
- // fallthrough
1912
- case 10 /* CharCode.LineFeed */:
1913
- starts.push(start);
1914
- start = pos;
1915
- break;
1916
- }
1917
- }
1918
- starts.push(start);
1919
- return starts;
3222
+ function isLowercaseAsciiLetter(ch) {
3223
+ return ch >= 97 /* CharCode.a */ && ch <= 122 /* CharCode.z */;
1920
3224
  }
1921
- /**
1922
- * Search sorted array of numbers for the given value. If found, return index
1923
- * in array where value was found. If not found, return a negative number that
1924
- * is the bitwise complement of the index where value would need to be inserted
1925
- * to keep the array sorted.
1926
- */
1927
- function binarySearch(array, value) {
1928
- let low = 0;
1929
- let high = array.length - 1;
1930
- while (low <= high) {
1931
- const middle = low + ((high - low) >> 1);
1932
- const v = array[middle];
1933
- if (v < value) {
1934
- low = middle + 1;
3225
+ function isAsciiIdentifierStart(ch) {
3226
+ return ((ch >= 65 /* CharCode.A */ && ch <= 90 /* CharCode.Z */) ||
3227
+ (ch >= 97 /* CharCode.a */ && ch <= 122 /* CharCode.z */) ||
3228
+ ch === 36 /* CharCode.$ */ ||
3229
+ ch === 95 /* CharCode._ */);
3230
+ }
3231
+ function isAsciiIdentifierContinue(ch) {
3232
+ return ((ch >= 65 /* CharCode.A */ && ch <= 90 /* CharCode.Z */) ||
3233
+ (ch >= 97 /* CharCode.a */ && ch <= 122 /* CharCode.z */) ||
3234
+ (ch >= 48 /* CharCode._0 */ && ch <= 57 /* CharCode._9 */) ||
3235
+ ch === 36 /* CharCode.$ */ ||
3236
+ ch === 95 /* CharCode._ */);
3237
+ }
3238
+ function isIdentifierStart(codePoint) {
3239
+ return (isAsciiIdentifierStart(codePoint) ||
3240
+ (codePoint > 127 /* CharCode.MaxAscii */ && isNonAsciiIdentifierCharacter(codePoint)));
3241
+ }
3242
+ function isIdentifierContinue(codePoint) {
3243
+ return (isAsciiIdentifierContinue(codePoint) ||
3244
+ (codePoint > 127 /* CharCode.MaxAscii */ && isNonAsciiIdentifierCharacter(codePoint)));
3245
+ }
3246
+ function isNonAsciiIdentifierCharacter(codePoint) {
3247
+ return lookupInNonAsciiMap(codePoint, nonAsciiIdentifierMap);
3248
+ }
3249
+ function lookupInNonAsciiMap(codePoint, map) {
3250
+ // Perform binary search in one of the Unicode range maps
3251
+ let lo = 0;
3252
+ let hi = map.length;
3253
+ let mid;
3254
+ while (lo + 1 < hi) {
3255
+ mid = lo + (hi - lo) / 2;
3256
+ // mid has to be even to catch a range's beginning
3257
+ mid -= mid % 2;
3258
+ if (map[mid] <= codePoint && codePoint <= map[mid + 1]) {
3259
+ return true;
1935
3260
  }
1936
- else if (v > value) {
1937
- high = middle - 1;
3261
+ if (codePoint < map[mid]) {
3262
+ hi = mid;
1938
3263
  }
1939
3264
  else {
1940
- return middle;
3265
+ lo = mid + 2;
1941
3266
  }
1942
3267
  }
1943
- return ~low;
3268
+ return false;
1944
3269
  }
1945
3270
 
1946
3271
  // All conflict markers consist of the same character repeated seven times. If it is
@@ -2921,7 +4246,46 @@ function getTokenDisplayTable(entries) {
2921
4246
  return table;
2922
4247
  }
2923
4248
 
2924
- const { util } = prettier;
4249
+ var uu=Object.create;var Ue=Object.defineProperty;var ou=Object.getOwnPropertyDescriptor;var iu=Object.getOwnPropertyNames;var su=Object.getPrototypeOf,au=Object.prototype.hasOwnProperty;var rr=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ct=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Me=(t,e)=>{for(var r in e)Ue(t,r,{get:e[r],enumerable:!0});},nr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of iu(e))!au.call(t,o)&&o!==r&&Ue(t,o,{get:()=>e[o],enumerable:!(n=ou(e,o))||n.enumerable});return t};var ur=(t,e,r)=>(r=t!=null?uu(su(t)):{},nr(e||!t||!t.__esModule?Ue(r,"default",{value:t,enumerable:!0}):r,t)),Du=t=>nr(Ue({},"__esModule",{value:!0}),t);var cu=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var gt=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r);};var le=(t,e,r)=>(cu(t,e,"access private method"),r);var ir=Ct(yt=>{Object.defineProperty(yt,"__esModule",{value:!0});yt.default=or;function or(){}or.prototype={diff:function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=n.callback;typeof n=="function"&&(o=n,n={}),this.options=n;var u=this;function i(p){return o?(setTimeout(function(){o(void 0,p);},0),!0):p}e=this.castInput(e),r=this.castInput(r),e=this.removeEmpty(this.tokenize(e)),r=this.removeEmpty(this.tokenize(r));var s=r.length,a=e.length,D=1,c=s+a;n.maxEditLength&&(c=Math.min(c,n.maxEditLength));var F=[{newPos:-1,components:[]}],f=this.extractCommon(F[0],r,e,0);if(F[0].newPos+1>=s&&f+1>=a)return i([{value:this.join(r),count:r.length}]);function d(){for(var p=-1*D;p<=D;p+=2){var m=void 0,E=F[p-1],h=F[p+1],g=(h?h.newPos:0)-p;E&&(F[p-1]=void 0);var C=E&&E.newPos+1<s,_=h&&0<=g&&g<a;if(!C&&!_){F[p]=void 0;continue}if(!C||_&&E.newPos<h.newPos?(m=pu(h),u.pushComponent(m.components,void 0,!0)):(m=E,m.newPos++,u.pushComponent(m.components,!0,void 0)),g=u.extractCommon(m,r,e,p),m.newPos+1>=s&&g+1>=a)return i(fu(u,m.components,r,e,u.useLongestToken));F[p]=m;}D++;}if(o)(function p(){setTimeout(function(){if(D>c)return o();d()||p();},0);})();else for(;D<=c;){var l=d();if(l)return l}},pushComponent:function(e,r,n){var o=e[e.length-1];o&&o.added===r&&o.removed===n?e[e.length-1]={count:o.count+1,added:r,removed:n}:e.push({count:1,added:r,removed:n});},extractCommon:function(e,r,n,o){for(var u=r.length,i=n.length,s=e.newPos,a=s-o,D=0;s+1<u&&a+1<i&&this.equals(r[s+1],n[a+1]);)s++,a++,D++;return D&&e.components.push({count:D}),e.newPos=s,a},equals:function(e,r){return this.options.comparator?this.options.comparator(e,r):e===r||this.options.ignoreCase&&e.toLowerCase()===r.toLowerCase()},removeEmpty:function(e){for(var r=[],n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};function fu(t,e,r,n,o){for(var u=0,i=e.length,s=0,a=0;u<i;u++){var D=e[u];if(D.removed){if(D.value=t.join(n.slice(a,a+D.count)),a+=D.count,u&&e[u-1].added){var F=e[u-1];e[u-1]=e[u],e[u]=F;}}else {if(!D.added&&o){var c=r.slice(s,s+D.count);c=c.map(function(d,l){var p=n[a+l];return p.length>d.length?p:d}),D.value=t.join(c);}else D.value=t.join(r.slice(s,s+D.count));s+=D.count,D.added||(a+=D.count);}}var f=e[i-1];return i>1&&typeof f.value=="string"&&(f.added||f.removed)&&t.equals("",f.value)&&(e[i-2].value+=f.value,e.pop()),e}function pu(t){return {newPos:t.newPos,components:t.components.slice(0)}}});var sr=Ct(ye=>{Object.defineProperty(ye,"__esModule",{value:!0});ye.diffArrays=mu;ye.arrayDiff=void 0;var du=Fu(ir());function Fu(t){return t&&t.__esModule?t:{default:t}}var ge=new du.default;ye.arrayDiff=ge;ge.tokenize=function(t){return t.slice()};ge.join=ge.removeEmpty=function(t){return t};function mu(t,e,r){return ge.diff(t,e,r)}});var j,N,Pe=rr(()=>{j=t=>t;j.grey=j;j.red=j;j.bold=j;j.yellow=j;j.blue=j;j.default=j;N=j;});var cn={};Me(cn,{getChalk:()=>Ju,shouldHighlight:()=>qu});var qu,Ju,ln=rr(()=>{Pe();qu=()=>!1,Ju=()=>N;});var Fn=Ct(pt=>{Object.defineProperty(pt,"__esModule",{value:!0});pt.codeFrameColumns=dn;pt.default=Qu;var Yt=(ln(),Du(cn)),fn=!1;function Xu(t){return {gutter:t.grey,marker:t.red.bold,message:t.red.bold}}var pn=/\r\n|[\n\r\u2028\u2029]/;function Zu(t,e,r){let n=Object.assign({column:0,line:-1},t.start),o=Object.assign({},n,t.end),{linesAbove:u=2,linesBelow:i=3}=r||{},s=n.line,a=n.column,D=o.line,c=o.column,F=Math.max(s-(u+1),0),f=Math.min(e.length,D+i);s===-1&&(F=0),D===-1&&(f=e.length);let d=D-s,l={};if(d)for(let p=0;p<=d;p++){let m=p+s;if(!a)l[m]=!0;else if(p===0){let E=e[m-1].length;l[m]=[a,E-a+1];}else if(p===d)l[m]=[0,c];else {let E=e[m-p].length;l[m]=[0,E];}}else a===c?a?l[s]=[a,0]:l[s]=!0:l[s]=[a,c-a];return {start:F,end:f,markerLines:l}}function dn(t,e,r={}){let n=(r.highlightCode||r.forceColor)&&(0, Yt.shouldHighlight)(r),o=(0, Yt.getChalk)(r),u=Xu(o),i=(p,m)=>n?p(m):m,s=t.split(pn),{start:a,end:D,markerLines:c}=Zu(e,s,r),F=e.start&&typeof e.start.column=="number",f=String(D).length,l=(n?(0, Yt.default)(t,r):t).split(pn,D).slice(a,D).map((p,m)=>{let E=a+1+m,g=` ${` ${E}`.slice(-f)} |`,C=c[E],_=!c[E+1];if(C){let ee="";if(Array.isArray(C)){let M=p.slice(0,Math.max(C[0]-1,0)).replace(/[^\t]/g," "),te=C[1]||1;ee=[`
4250
+ `,i(u.gutter,g.replace(/\d/g," "))," ",M,i(u.marker,"^").repeat(te)].join(""),_&&r.message&&(ee+=" "+i(u.message,r.message));}return [i(u.marker,">"),i(u.gutter,g),p.length>0?` ${p}`:"",ee].join("")}else return ` ${i(u.gutter,g)}${p.length>0?` ${p}`:""}`}).join(`
4251
+ `);return r.message&&!F&&(l=`${" ".repeat(f+1)}${r.message}
4252
+ ${l}`),n?o.reset(l):l}function Qu(t,e,r,n={}){if(!fn){fn=!0;let u="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";{let i=new Error(u);i.name="DeprecationWarning",console.warn(new Error(u));}}return r=Math.max(r,0),dn(t,{start:{column:r,line:e}},n)}});var er={};Me(er,{__debug:()=>Go,check:()=>Wo,doc:()=>Qt,format:()=>nu,formatWithCursor:()=>ru,getSupportInfo:()=>zo,util:()=>Zt,version:()=>tu});var lu=(t,e,r,n)=>{if(!(t&&e==null))return e.replaceAll?e.replaceAll(r,n):r.global?e.replace(r,n):e.split(r).join(n)},re=lu;var Vn=ur(sr(),1);var W="string",$="array",z="cursor",S="indent",v="align",P="trim",A="group",k="fill",B="if-break",L="indent-if-break",I="line-suffix",R="line-suffix-boundary",x="line",O="label",b="break-parent",We=new Set([z,S,v,P,A,k,B,L,I,R,x,O,b]);function Eu(t){if(typeof t=="string")return W;if(Array.isArray(t))return $;if(!t)return;let{type:e}=t;if(We.has(e))return e}var G=Eu;var hu=t=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(t);function Cu(t){let e=t===null?"null":typeof t;if(e!=="string"&&e!=="object")return `Unexpected doc '${e}',
4253
+ Expected it to be 'string' or 'object'.`;if(G(t))throw new Error("doc is valid.");let r=Object.prototype.toString.call(t);if(r!=="[object Object]")return `Unexpected doc '${r}'.`;let n=hu([...We].map(o=>`'${o}'`));return `Unexpected doc.type '${t.type}'.
4254
+ Expected it to be ${n}.`}var xt=class extends Error{name="InvalidDocError";constructor(e){super(Cu(e)),this.doc=e;}},X=xt;var ar={};function gu(t,e,r,n){let o=[t];for(;o.length>0;){let u=o.pop();if(u===ar){r(o.pop());continue}r&&o.push(u,ar);let i=G(u);if(!i)throw new X(u);if((e==null?void 0:e(u))!==!1)switch(i){case $:case k:{let s=i===$?u:u.parts;for(let a=s.length,D=a-1;D>=0;--D)o.push(s[D]);break}case B:o.push(u.flatContents,u.breakContents);break;case A:if(n&&u.expandedStates)for(let s=u.expandedStates.length,a=s-1;a>=0;--a)o.push(u.expandedStates[a]);else o.push(u.contents);break;case v:case S:case L:case O:case I:o.push(u.contents);break;case W:case z:case P:case R:case x:case b:break;default:throw new X(u)}}}var xe=gu;var Dr=()=>{},ze=Dr;function ae(t){return {type:S,contents:t}}function se(t,e){return {type:v,contents:e,n:t}}function _t(t,e={}){return ze(e.expandedStates),{type:A,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function cr(t){return se(Number.NEGATIVE_INFINITY,t)}function lr(t){return se({type:"root"},t)}function fr(t){return se(-1,t)}function pr(t,e){return _t(t[0],{...e,expandedStates:t})}function Ge(t){return {type:k,parts:t}}function dr(t,e="",r={}){return {type:B,breakContents:t,flatContents:e,groupId:r.groupId}}function Fr(t,e){return {type:L,contents:t,groupId:e.groupId,negate:e.negate}}function _e(t){return {type:I,contents:t}}var mr={type:R},fe={type:b},Er={type:P},Ae={type:x,hard:!0},At={type:x,hard:!0,literal:!0},Ke={type:x},hr={type:x,soft:!0},H=[Ae,fe],He=[At,fe],Be={type:z};function ke(t,e){let r=[];for(let n=0;n<e.length;n++)n!==0&&r.push(t),r.push(e[n]);return r}function qe(t,e,r){let n=t;if(e>0){for(let o=0;o<Math.floor(e/r);++o)n=ae(n);n=se(e%r,n),n=se(Number.NEGATIVE_INFINITY,n);}return n}function Cr(t,e){return t?{type:O,label:t,contents:e}:e}var yu=(t,e,r)=>{if(!(t&&e==null))return Array.isArray(e)||typeof e=="string"?e[r<0?e.length+r:r]:e.at(r)},y=yu;function gr(t){let e=t.indexOf("\r");return e>=0?t.charAt(e+1)===`
4255
+ `?"crlf":"cr":"lf"}function be(t){switch(t){case"cr":return "\r";case"crlf":return `\r
4256
+ `;default:return `
4257
+ `}}function Bt(t,e){let r;switch(e){case`
4258
+ `:r=/\n/g;break;case"\r":r=/\r/g;break;case`\r
4259
+ `:r=/\r\n/g;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(e)}.`)}let n=t.match(r);return n?n.length:0}function yr(t){return re(!1,t,/\r\n?/g,`
4260
+ `)}var xr=()=>/[#*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\u26D3\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]|\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])?|[\uDFC3\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-\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]|\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(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\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-\uDEB6](?:\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\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-\uDDB3\uDDBC\uDDBD])|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD])|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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?)?)|\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])?|\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-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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;var _r={eastAsianWidth(t){var e=t.charCodeAt(0),r=t.length==2?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=r&&r<=57343&&(e&=1023,r&=1023,n=e<<10|r,n+=65536),n==12288||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":"N"}};var xu=/[^\x20-\x7F]/;function _u(t){if(!t)return 0;if(!xu.test(t))return t.length;t=t.replace(xr()," ");let e=0;for(let r of t){let n=r.codePointAt(0);if(n<=31||n>=127&&n<=159||n>=768&&n<=879)continue;let o=_r.eastAsianWidth(r);e+=o==="F"||o==="W"?2:1;}return e}var we=_u;var kr=t=>{if(Array.isArray(t))return t;if(t.type!==k)throw new Error(`Expect doc to be 'array' or '${k}'.`);return t.parts};function Ne(t,e){if(typeof t=="string")return e(t);let r=new Map;return n(t);function n(u){if(r.has(u))return r.get(u);let i=o(u);return r.set(u,i),i}function o(u){switch(G(u)){case $:return e(u.map(n));case k:return e({...u,parts:u.parts.map(n)});case B:return e({...u,breakContents:n(u.breakContents),flatContents:n(u.flatContents)});case A:{let{expandedStates:i,contents:s}=u;return i?(i=i.map(n),s=i[0]):s=n(s),e({...u,contents:s,expandedStates:i})}case v:case S:case L:case O:case I:return e({...u,contents:n(u.contents)});case W:case z:case P:case R:case x:case b:return e(u);default:throw new X(u)}}}function Je(t,e,r){let n=r,o=!1;function u(i){if(o)return !1;let s=e(i);s!==void 0&&(o=!0,n=s);}return xe(t,u),n}function Au(t){if(t.type===A&&t.break||t.type===x&&t.hard||t.type===b)return !0}function br(t){return Je(t,Au,!1)}function Ar(t){if(t.length>0){let e=y(!1,t,-1);!e.expandedStates&&!e.break&&(e.break="propagated");}return null}function wr(t){let e=new Set,r=[];function n(u){if(u.type===b&&Ar(r),u.type===A){if(r.push(u),e.has(u))return !1;e.add(u);}}function o(u){u.type===A&&r.pop().break&&Ar(r);}xe(t,n,o,!0);}function Bu(t){return t.type===x&&!t.hard?t.soft?"":" ":t.type===B?t.flatContents:t}function Or(t){return Ne(t,Bu)}function Br(t){for(t=[...t];t.length>=2&&y(!1,t,-2).type===x&&y(!1,t,-1).type===b;)t.length-=2;if(t.length>0){let e=Oe(y(!1,t,-1));t[t.length-1]=e;}return t}function Oe(t){switch(G(t)){case v:case S:case L:case A:case I:case O:{let e=Oe(t.contents);return {...t,contents:e}}case B:return {...t,breakContents:Oe(t.breakContents),flatContents:Oe(t.flatContents)};case k:return {...t,parts:Br(t.parts)};case $:return Br(t);case W:return t.replace(/[\n\r]*$/,"");case z:case P:case R:case x:case b:break;default:throw new X(t)}return t}function Xe(t){return Oe(bu(t))}function ku(t){switch(G(t)){case k:if(t.parts.every(e=>e===""))return "";break;case A:if(!t.contents&&!t.id&&!t.break&&!t.expandedStates)return "";if(t.contents.type===A&&t.contents.id===t.id&&t.contents.break===t.break&&t.contents.expandedStates===t.expandedStates)return t.contents;break;case v:case S:case L:case I:if(!t.contents)return "";break;case B:if(!t.flatContents&&!t.breakContents)return "";break;case $:{let e=[];for(let r of t){if(!r)continue;let[n,...o]=Array.isArray(r)?r:[r];typeof n=="string"&&typeof y(!1,e,-1)=="string"?e[e.length-1]+=n:e.push(n),e.push(...o);}return e.length===0?"":e.length===1?e[0]:e}case W:case z:case P:case R:case x:case O:case b:break;default:throw new X(t)}return t}function bu(t){return Ne(t,e=>ku(e))}function Nr(t,e=He){return Ne(t,r=>typeof r=="string"?ke(e,r.split(`
4261
+ `)):r)}function wu(t){if(t.type===x)return !0}function Tr(t){return Je(t,wu,!1)}function Ze(t,e){return t.type===O?{...t,contents:e(t.contents)}:e(t)}var Y=Symbol("MODE_BREAK"),q=Symbol("MODE_FLAT"),Te=Symbol("cursor");function Sr(){return {value:"",length:0,queue:[]}}function Ou(t,e){return kt(t,{type:"indent"},e)}function Nu(t,e,r){return e===Number.NEGATIVE_INFINITY?t.root||Sr():e<0?kt(t,{type:"dedent"},r):e?e.type==="root"?{...t,root:t}:kt(t,{type:typeof e=="string"?"stringAlign":"numberAlign",n:e},r):t}function kt(t,e,r){let n=e.type==="dedent"?t.queue.slice(0,-1):[...t.queue,e],o="",u=0,i=0,s=0;for(let l of n)switch(l.type){case"indent":c(),r.useTabs?a(1):D(r.tabWidth);break;case"stringAlign":c(),o+=l.n,u+=l.n.length;break;case"numberAlign":i+=1,s+=l.n;break;default:throw new Error(`Unexpected type '${l.type}'`)}return f(),{...t,value:o,length:u,queue:n};function a(l){o+=" ".repeat(l),u+=r.tabWidth*l;}function D(l){o+=" ".repeat(l),u+=l;}function c(){r.useTabs?F():f();}function F(){i>0&&a(i),d();}function f(){s>0&&D(s),d();}function d(){i=0,s=0;}}function bt(t){let e=0,r=0,n=t.length;e:for(;n--;){let o=t[n];if(o===Te){r++;continue}for(let u=o.length-1;u>=0;u--){let i=o[u];if(i===" "||i===" ")e++;else {t[n]=o.slice(0,u+1);break e}}}if(e>0||r>0)for(t.length=n+1;r-- >0;)t.push(Te);return e}function Qe(t,e,r,n,o,u){if(r===Number.POSITIVE_INFINITY)return !0;let i=e.length,s=[t],a=[];for(;r>=0;){if(s.length===0){if(i===0)return !0;s.push(e[--i]);continue}let{mode:D,doc:c}=s.pop();switch(G(c)){case W:a.push(c),r-=we(c);break;case $:case k:{let F=kr(c);for(let f=F.length-1;f>=0;f--)s.push({mode:D,doc:F[f]});break}case S:case v:case L:case O:s.push({mode:D,doc:c.contents});break;case P:r+=bt(a);break;case A:{if(u&&c.break)return !1;let F=c.break?Y:D,f=c.expandedStates&&F===Y?y(!1,c.expandedStates,-1):c.contents;s.push({mode:F,doc:f});break}case B:{let f=(c.groupId?o[c.groupId]||q:D)===Y?c.breakContents:c.flatContents;f&&s.push({mode:D,doc:f});break}case x:if(D===Y||c.hard)return !0;c.soft||(a.push(" "),r--);break;case I:n=!0;break;case R:if(n)return !1;break}}return !1}function pe(t,e){let r={},n=e.printWidth,o=be(e.endOfLine),u=0,i=[{ind:Sr(),mode:Y,doc:t}],s=[],a=!1,D=[],c=0;for(wr(t);i.length>0;){let{ind:f,mode:d,doc:l}=i.pop();switch(G(l)){case W:{let p=o!==`
4262
+ `?re(!1,l,`
4263
+ `,o):l;s.push(p),i.length>0&&(u+=we(p));break}case $:for(let p=l.length-1;p>=0;p--)i.push({ind:f,mode:d,doc:l[p]});break;case z:if(c>=2)throw new Error("There are too many 'cursor' in doc.");s.push(Te),c++;break;case S:i.push({ind:Ou(f,e),mode:d,doc:l.contents});break;case v:i.push({ind:Nu(f,l.n,e),mode:d,doc:l.contents});break;case P:u-=bt(s);break;case A:switch(d){case q:if(!a){i.push({ind:f,mode:l.break?Y:q,doc:l.contents});break}case Y:{a=!1;let p={ind:f,mode:q,doc:l.contents},m=n-u,E=D.length>0;if(!l.break&&Qe(p,i,m,E,r))i.push(p);else if(l.expandedStates){let h=y(!1,l.expandedStates,-1);if(l.break){i.push({ind:f,mode:Y,doc:h});break}else for(let g=1;g<l.expandedStates.length+1;g++)if(g>=l.expandedStates.length){i.push({ind:f,mode:Y,doc:h});break}else {let C=l.expandedStates[g],_={ind:f,mode:q,doc:C};if(Qe(_,i,m,E,r)){i.push(_);break}}}else i.push({ind:f,mode:Y,doc:l.contents});break}}l.id&&(r[l.id]=y(!1,i,-1).mode);break;case k:{let p=n-u,{parts:m}=l;if(m.length===0)break;let[E,h]=m,g={ind:f,mode:q,doc:E},C={ind:f,mode:Y,doc:E},_=Qe(g,[],p,D.length>0,r,!0);if(m.length===1){_?i.push(g):i.push(C);break}let ee={ind:f,mode:q,doc:h},M={ind:f,mode:Y,doc:h};if(m.length===2){_?i.push(ee,g):i.push(M,C);break}m.splice(0,2);let te={ind:f,mode:d,doc:Ge(m)},tr=m[0];Qe({ind:f,mode:q,doc:[E,h,tr]},[],p,D.length>0,r,!0)?i.push(te,ee,g):_?i.push(te,M,g):i.push(te,M,C);break}case B:case L:{let p=l.groupId?r[l.groupId]:d;if(p===Y){let m=l.type===B?l.breakContents:l.negate?l.contents:ae(l.contents);m&&i.push({ind:f,mode:d,doc:m});}if(p===q){let m=l.type===B?l.flatContents:l.negate?ae(l.contents):l.contents;m&&i.push({ind:f,mode:d,doc:m});}break}case I:D.push({ind:f,mode:d,doc:l.contents});break;case R:D.length>0&&i.push({ind:f,mode:d,doc:Ae});break;case x:switch(d){case q:if(l.hard)a=!0;else {l.soft||(s.push(" "),u+=1);break}case Y:if(D.length>0){i.push({ind:f,mode:d,doc:l},...D.reverse()),D.length=0;break}l.literal?f.root?(s.push(o,f.root.value),u=f.root.length):(s.push(o),u=0):(u-=bt(s),s.push(o+f.value),u=f.length);break}break;case O:i.push({ind:f,mode:d,doc:l.contents});break;case b:break;default:throw new X(l)}i.length===0&&D.length>0&&(i.push(...D.reverse()),D.length=0);}let F=s.indexOf(Te);if(F!==-1){let f=s.indexOf(Te,F+1),d=s.slice(0,F).join(""),l=s.slice(F+1,f).join(""),p=s.slice(f+1).join("");return {formatted:d+l+p,cursorNodeStart:d.length,cursorNodeText:l}}return {formatted:s.join("")}}function Z(t){var e;if(!t)return "";if(Array.isArray(t)){let r=[];for(let n of t)if(Array.isArray(n))r.push(...Z(n));else {let o=Z(n);o!==""&&r.push(o);}return r}return t.type===B?{...t,breakContents:Z(t.breakContents),flatContents:Z(t.flatContents)}:t.type===A?{...t,contents:Z(t.contents),expandedStates:(e=t.expandedStates)==null?void 0:e.map(Z)}:t.type===k?{type:"fill",parts:t.parts.map(Z)}:t.contents?{...t,contents:Z(t.contents)}:t}function vr(t){let e=Object.create(null),r=new Set;return n(Z(t));function n(u,i,s){var a,D;if(typeof u=="string")return JSON.stringify(u);if(Array.isArray(u)){let c=u.map(n).filter(Boolean);return c.length===1?c[0]:`[${c.join(", ")}]`}if(u.type===x){let c=((a=s==null?void 0:s[i+1])==null?void 0:a.type)===b;return u.literal?c?"literalline":"literallineWithoutBreakParent":u.hard?c?"hardline":"hardlineWithoutBreakParent":u.soft?"softline":"line"}if(u.type===b)return ((D=s==null?void 0:s[i-1])==null?void 0:D.type)===x&&s[i-1].hard?void 0:"breakParent";if(u.type===P)return "trim";if(u.type===S)return "indent("+n(u.contents)+")";if(u.type===v)return u.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+n(u.contents)+")":u.n<0?"dedent("+n(u.contents)+")":u.n.type==="root"?"markAsRoot("+n(u.contents)+")":"align("+JSON.stringify(u.n)+", "+n(u.contents)+")";if(u.type===B)return "ifBreak("+n(u.breakContents)+(u.flatContents?", "+n(u.flatContents):"")+(u.groupId?(u.flatContents?"":', ""')+`, { groupId: ${o(u.groupId)} }`:"")+")";if(u.type===L){let c=[];u.negate&&c.push("negate: true"),u.groupId&&c.push(`groupId: ${o(u.groupId)}`);let F=c.length>0?`, { ${c.join(", ")} }`:"";return `indentIfBreak(${n(u.contents)}${F})`}if(u.type===A){let c=[];u.break&&u.break!=="propagated"&&c.push("shouldBreak: true"),u.id&&c.push(`id: ${o(u.id)}`);let F=c.length>0?`, { ${c.join(", ")} }`:"";return u.expandedStates?`conditionalGroup([${u.expandedStates.map(f=>n(f)).join(",")}]${F})`:`group(${n(u.contents)}${F})`}if(u.type===k)return `fill([${u.parts.map(c=>n(c)).join(", ")}])`;if(u.type===I)return "lineSuffix("+n(u.contents)+")";if(u.type===R)return "lineSuffixBoundary";if(u.type===O)return `label(${JSON.stringify(u.label)}, ${n(u.contents)})`;throw new Error("Unknown doc type "+u.type)}function o(u){if(typeof u!="symbol")return JSON.stringify(String(u));if(u in e)return e[u];let i=u.description||"symbol";for(let s=0;;s++){let a=i+(s>0?` #${s}`:"");if(!r.has(a))return r.add(a),e[u]=`Symbol.for(${JSON.stringify(a)})`}}}function Tu(t,e,r=0){let n=0;for(let o=r;o<t.length;++o)t[o]===" "?n=n+e-n%e:n++;return n}var de=Tu;var Se=class extends Error{name="ConfigError"},ve=class extends Error{name="UndefinedParserError"};var Pr={cursorOffset:{category:"Special",type:"int",default:-1,range:{start:-1,end:1/0,step:1},description:`Print (to stderr) where a cursor at the given position would move to after formatting.
4264
+ This option cannot be used with --range-start and --range-end.`,cliCategory:"Editor"},endOfLine:{category:"Global",type:"choice",default:"lf",description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:`Maintain existing
4265
+ (mixed values within one file are normalised by looking at what's used after the first line)`}]},filepath:{category:"Special",type:"path",description:"Specify the input filepath. This will be used to do parser inference.",cliName:"stdin-filepath",cliCategory:"Other",cliDescription:"Path to the file to pretend that stdin comes from."},insertPragma:{category:"Special",type:"boolean",default:!1,description:"Insert @format pragma into file's first docblock comment.",cliCategory:"Other"},parser:{category:"Global",type:"choice",default:void 0,description:"Which parser to use.",exception:t=>typeof t=="string"||typeof t=="function",choices:[{value:"flow",description:"Flow"},{value:"babel",description:"JavaScript"},{value:"babel-flow",description:"Flow"},{value:"babel-ts",description:"TypeScript"},{value:"typescript",description:"TypeScript"},{value:"acorn",description:"JavaScript"},{value:"espree",description:"JavaScript"},{value:"meriyah",description:"JavaScript"},{value:"css",description:"CSS"},{value:"less",description:"Less"},{value:"scss",description:"SCSS"},{value:"json",description:"JSON"},{value:"json5",description:"JSON5"},{value:"json-stringify",description:"JSON.stringify"},{value:"graphql",description:"GraphQL"},{value:"markdown",description:"Markdown"},{value:"mdx",description:"MDX"},{value:"vue",description:"Vue"},{value:"yaml",description:"YAML"},{value:"glimmer",description:"Ember / Handlebars"},{value:"html",description:"HTML"},{value:"angular",description:"Angular"},{value:"lwc",description:"Lightning Web Components"}]},plugins:{type:"path",array:!0,default:[{value:[]}],category:"Global",description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:t=>typeof t=="string"||typeof t=="object",cliName:"plugin",cliCategory:"Config"},printWidth:{category:"Global",type:"int",default:80,description:"The line length where Prettier will try wrap.",range:{start:0,end:1/0,step:1}},rangeEnd:{category:"Special",type:"int",default:1/0,range:{start:0,end:1/0,step:1},description:`Format code ending at a given character offset (exclusive).
4266
+ The range will extend forwards to the end of the selected statement.
4267
+ This option cannot be used with --cursor-offset.`,cliCategory:"Editor"},rangeStart:{category:"Special",type:"int",default:0,range:{start:0,end:1/0,step:1},description:`Format code starting at a given character offset.
4268
+ The range will extend backwards to the start of the first line containing the selected statement.
4269
+ This option cannot be used with --cursor-offset.`,cliCategory:"Editor"},requirePragma:{category:"Special",type:"boolean",default:!1,description:`Require either '@prettier' or '@format' to be present in the file's first docblock comment
4270
+ in order for it to be formatted.`,cliCategory:"Other"},tabWidth:{type:"int",category:"Global",default:2,description:"Number of spaces per indentation level.",range:{start:0,end:1/0,step:1}},useTabs:{category:"Global",type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{category:"Global",type:"choice",default:"auto",description:"Control how Prettier formats quoted code embedded in the file.",choices:[{value:"auto",description:"Format embedded code if Prettier can automatically identify it."},{value:"off",description:"Never automatically format embedded code."}]}};function et({plugins:t=[],showDeprecated:e=!1}={}){let r=t.flatMap(o=>o.languages??[]),n=[];for(let o of vu(Object.assign({},...t.map(({options:u})=>u),Pr)))!e&&o.deprecated||(Array.isArray(o.choices)&&(e||(o.choices=o.choices.filter(u=>!u.deprecated)),o.name==="parser"&&(o.choices=[...o.choices,...Su(o.choices,r,t)])),o.pluginDefaults=Object.fromEntries(t.filter(u=>{var i;return ((i=u.defaultOptions)==null?void 0:i[o.name])!==void 0}).map(u=>[u.name,u.defaultOptions[o.name]])),n.push(o));return {languages:r,options:n}}function*Su(t,e,r){let n=new Set(t.map(o=>o.value));for(let o of e)if(o.parsers){for(let u of o.parsers)if(!n.has(u)){n.add(u);let i=r.find(a=>a.parsers&&Object.prototype.hasOwnProperty.call(a.parsers,u)),s=o.name;i!=null&&i.name&&(s+=` (plugin: ${i.name})`),yield {value:u,description:s};}}}function vu(t){let e=[];for(let[r,n]of Object.entries(t)){let o={name:r,...n};Array.isArray(o.default)&&(o.default=y(!1,o.default,-1).value),e.push(o);}return e}var Pu=t=>t.split(/[/\\]/).pop();function Lr(t,e){if(!e)return;let r=Pu(e).toLowerCase();return t.find(n=>{var o,u;return ((o=n.extensions)==null?void 0:o.some(i=>r.endsWith(i)))||((u=n.filenames)==null?void 0:u.some(i=>i.toLowerCase()===r))})}function Lu(t,e){if(e)return t.find(({name:r})=>r.toLowerCase()===e)??t.find(({aliases:r})=>r==null?void 0:r.includes(e))??t.find(({extensions:r})=>r==null?void 0:r.includes(`.${e}`))}function Iu(t,e){let r=t.plugins.flatMap(o=>o.languages??[]),n=Lu(r,e.language)??Lr(r,e.physicalFile)??Lr(r,e.file)??(e.physicalFile,void 0);return n==null?void 0:n.parsers[0]}var Ir=Iu;var ne={key:t=>/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(t)?t:JSON.stringify(t),value(t){if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return `[${t.map(r=>ne.value(r)).join(", ")}]`;let e=Object.keys(t);return e.length===0?"{}":`{ ${e.map(r=>`${ne.key(r)}: ${ne.value(t[r])}`).join(", ")} }`},pair:({key:t,value:e})=>ne.value({[t]:e})};Pe();var Rr=(t,e,{descriptor:r})=>{let n=[`${N.yellow(typeof t=="string"?r.key(t):r.pair(t))} is deprecated`];return e&&n.push(`we now treat it as ${N.blue(typeof e=="string"?r.key(e):r.pair(e))}`),n.join("; ")+"."};Pe();var tt=Symbol.for("vnopts.VALUE_NOT_EXIST"),Fe=Symbol.for("vnopts.VALUE_UNCHANGED");var Yr=" ".repeat(2),Vr=(t,e,r)=>{let{text:n,list:o}=r.normalizeExpectedResult(r.schemas[t].expected(r)),u=[];return n&&u.push(jr(t,e,n,r.descriptor)),o&&u.push([jr(t,e,o.title,r.descriptor)].concat(o.values.map(i=>$r(i,r.loggerPrintWidth))).join(`
4271
+ `)),Ur(u,r.loggerPrintWidth)};function jr(t,e,r,n){return [`Invalid ${N.red(n.key(t))} value.`,`Expected ${N.blue(r)},`,`but received ${e===tt?N.gray("nothing"):N.red(n.value(e))}.`].join(" ")}function $r({text:t,list:e},r){let n=[];return t&&n.push(`- ${N.blue(t)}`),e&&n.push([`- ${N.blue(e.title)}:`].concat(e.values.map(o=>$r(o,r-Yr.length).replace(/^|\n/g,`$&${Yr}`))).join(`
4272
+ `)),Ur(n,r)}function Ur(t,e){if(t.length===1)return t[0];let[r,n]=t,[o,u]=t.map(i=>i.split(`
4273
+ `,1)[0].length);return o>e&&o>u?n:r}Pe();var wt=[],Mr=[];function Ot(t,e){if(t===e)return 0;let r=t;t.length>e.length&&(t=e,e=r);let n=t.length,o=e.length;for(;n>0&&t.charCodeAt(~-n)===e.charCodeAt(~-o);)n--,o--;let u=0;for(;u<n&&t.charCodeAt(u)===e.charCodeAt(u);)u++;if(n-=u,o-=u,n===0)return o;let i,s,a,D,c=0,F=0;for(;c<n;)Mr[c]=t.charCodeAt(u+c),wt[c]=++c;for(;F<o;)for(i=e.charCodeAt(u+F),a=F++,s=F,c=0;c<n;c++)D=i===Mr[c]?a:a+1,a=wt[c],s=wt[c]=a>s?D>s?s+1:D:D>a?a+1:D;return s}var rt=(t,e,{descriptor:r,logger:n,schemas:o})=>{let u=[`Ignored unknown option ${N.yellow(r.pair({key:t,value:e}))}.`],i=Object.keys(o).sort().find(s=>Ot(t,s)<3);i&&u.push(`Did you mean ${N.blue(r.key(i))}?`),n.warn(u.join(" "));};var Ru=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function Yu(t,e){let r=new t(e),n=Object.create(r);for(let o of Ru)o in e&&(n[o]=ju(e[o],r,w.prototype[o].length));return n}var w=class{static create(e){return Yu(this,e)}constructor(e){this.name=e.name;}default(e){}expected(e){return "nothing"}validate(e,r){return !1}deprecated(e,r){return !1}forward(e,r){}redirect(e,r){}overlap(e,r,n){return e}preprocess(e,r){return e}postprocess(e,r){return Fe}};function ju(t,e,r){return typeof t=="function"?(...n)=>t(...n.slice(0,r-1),e,...n.slice(r-1)):()=>t}var nt=class extends w{constructor(e){super(e),this._sourceName=e.sourceName;}expected(e){return e.schemas[this._sourceName].expected(e)}validate(e,r){return r.schemas[this._sourceName].validate(e,r)}redirect(e,r){return this._sourceName}};var ut=class extends w{expected(){return "anything"}validate(){return !0}};var ot=class extends w{constructor({valueSchema:e,name:r=e.name,...n}){super({...n,name:r}),this._valueSchema=e;}expected(e){let{text:r,list:n}=e.normalizeExpectedResult(this._valueSchema.expected(e));return {text:r&&`an array of ${r}`,list:n&&{title:"an array of the following values",values:[{list:n}]}}}validate(e,r){if(!Array.isArray(e))return !1;let n=[];for(let o of e){let u=r.normalizeValidateResult(this._valueSchema.validate(o,r),o);u!==!0&&n.push(u.value);}return n.length===0?!0:{value:n}}deprecated(e,r){let n=[];for(let o of e){let u=r.normalizeDeprecatedResult(this._valueSchema.deprecated(o,r),o);u!==!1&&n.push(...u.map(({value:i})=>({value:[i]})));}return n}forward(e,r){let n=[];for(let o of e){let u=r.normalizeForwardResult(this._valueSchema.forward(o,r),o);n.push(...u.map(Wr));}return n}redirect(e,r){let n=[],o=[];for(let u of e){let i=r.normalizeRedirectResult(this._valueSchema.redirect(u,r),u);"remain"in i&&n.push(i.remain),o.push(...i.redirect.map(Wr));}return n.length===0?{redirect:o}:{redirect:o,remain:n}}overlap(e,r){return e.concat(r)}};function Wr({from:t,to:e}){return {from:[t],to:e}}var it=class extends w{expected(){return "true or false"}validate(e){return typeof e=="boolean"}};function Gr(t,e){let r=Object.create(null);for(let n of t){let o=n[e];if(r[o])throw new Error(`Duplicate ${e} ${JSON.stringify(o)}`);r[o]=n;}return r}function Kr(t,e){let r=new Map;for(let n of t){let o=n[e];if(r.has(o))throw new Error(`Duplicate ${e} ${JSON.stringify(o)}`);r.set(o,n);}return r}function Hr(){let t=Object.create(null);return e=>{let r=JSON.stringify(e);return t[r]?!0:(t[r]=!0,!1)}}function qr(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return [r,n]}function Jr(t){return t===Math.floor(t)}function Xr(t,e){if(t===e)return 0;let r=typeof t,n=typeof e,o=["undefined","object","boolean","number","string"];return r!==n?o.indexOf(r)-o.indexOf(n):r!=="string"?Number(t)-Number(e):t.localeCompare(e)}function Zr(t){return (...e)=>{let r=t(...e);return typeof r=="string"?new Error(r):r}}function Nt(t){return t===void 0?{}:t}function Tt(t){if(typeof t=="string")return {text:t};let{text:e,list:r}=t;return Vu((e||r)!==void 0,"Unexpected `expected` result, there should be at least one field."),r?{text:e,list:{title:r.title,values:r.values.map(Tt)}}:{text:e}}function St(t,e){return t===!0?!0:t===!1?{value:e}:t}function vt(t,e,r=!1){return t===!1?!1:t===!0?r?!0:[{value:e}]:"value"in t?[t]:t.length===0?!1:t}function zr(t,e){return typeof t=="string"||"key"in t?{from:e,to:t}:"from"in t?{from:t.from,to:t.to}:{from:e,to:t.to}}function st(t,e){return t===void 0?[]:Array.isArray(t)?t.map(r=>zr(r,e)):[zr(t,e)]}function Pt(t,e){let r=st(typeof t=="object"&&"redirect"in t?t.redirect:t,e);return r.length===0?{remain:e,redirect:r}:typeof t=="object"&&"remain"in t?{remain:t.remain,redirect:r}:{redirect:r}}function Vu(t,e){if(!t)throw new Error(e)}var at=class extends w{constructor(e){super(e),this._choices=Kr(e.choices.map(r=>r&&typeof r=="object"?r:{value:r}),"value");}expected({descriptor:e}){let r=Array.from(this._choices.keys()).map(i=>this._choices.get(i)).filter(({hidden:i})=>!i).map(i=>i.value).sort(Xr).map(e.value),n=r.slice(0,-2),o=r.slice(-2);return {text:n.concat(o.join(" or ")).join(", "),list:{title:"one of the following values",values:r}}}validate(e){return this._choices.has(e)}deprecated(e){let r=this._choices.get(e);return r&&r.deprecated?{value:e}:!1}forward(e){let r=this._choices.get(e);return r?r.forward:void 0}redirect(e){let r=this._choices.get(e);return r?r.redirect:void 0}};var Dt=class extends w{expected(){return "a number"}validate(e,r){return typeof e=="number"}};var ct=class extends Dt{expected(){return "an integer"}validate(e,r){return r.normalizeValidateResult(super.validate(e,r),e)===!0&&Jr(e)}};var Le=class extends w{expected(){return "a string"}validate(e){return typeof e=="string"}};var Qr=ne,en=rt,tn=Vr,rn=Rr;var lt=class{constructor(e,r){let{logger:n=console,loggerPrintWidth:o=80,descriptor:u=Qr,unknown:i=en,invalid:s=tn,deprecated:a=rn,missing:D=()=>!1,required:c=()=>!1,preprocess:F=d=>d,postprocess:f=()=>Fe}=r||{};this._utils={descriptor:u,logger:n||{warn:()=>{}},loggerPrintWidth:o,schemas:Gr(e,"name"),normalizeDefaultResult:Nt,normalizeExpectedResult:Tt,normalizeDeprecatedResult:vt,normalizeForwardResult:st,normalizeRedirectResult:Pt,normalizeValidateResult:St},this._unknownHandler=i,this._invalidHandler=Zr(s),this._deprecatedHandler=a,this._identifyMissing=(d,l)=>!(d in l)||D(d,l),this._identifyRequired=c,this._preprocess=F,this._postprocess=f,this.cleanHistory();}cleanHistory(){this._hasDeprecationWarned=Hr();}normalize(e){let r={},o=[this._preprocess(e,this._utils)],u=()=>{for(;o.length!==0;){let i=o.shift(),s=this._applyNormalization(i,r);o.push(...s);}};u();for(let i of Object.keys(this._utils.schemas)){let s=this._utils.schemas[i];if(!(i in r)){let a=Nt(s.default(this._utils));"value"in a&&o.push({[i]:a.value});}}u();for(let i of Object.keys(this._utils.schemas)){if(!(i in r))continue;let s=this._utils.schemas[i],a=r[i],D=s.postprocess(a,this._utils);D!==Fe&&(this._applyValidation(D,i,s),r[i]=D);}return this._applyPostprocess(r),this._applyRequiredCheck(r),r}_applyNormalization(e,r){let n=[],{knownKeys:o,unknownKeys:u}=this._partitionOptionKeys(e);for(let i of o){let s=this._utils.schemas[i],a=s.preprocess(e[i],this._utils);this._applyValidation(a,i,s);let D=({from:d,to:l})=>{n.push(typeof l=="string"?{[l]:d}:{[l.key]:l.value});},c=({value:d,redirectTo:l})=>{let p=vt(s.deprecated(d,this._utils),a,!0);if(p!==!1)if(p===!0)this._hasDeprecationWarned(i)||this._utils.logger.warn(this._deprecatedHandler(i,l,this._utils));else for(let{value:m}of p){let E={key:i,value:m};if(!this._hasDeprecationWarned(E)){let h=typeof l=="string"?{key:l,value:m}:l;this._utils.logger.warn(this._deprecatedHandler(E,h,this._utils));}}};st(s.forward(a,this._utils),a).forEach(D);let f=Pt(s.redirect(a,this._utils),a);if(f.redirect.forEach(D),"remain"in f){let d=f.remain;r[i]=i in r?s.overlap(r[i],d,this._utils):d,c({value:d});}for(let{from:d,to:l}of f.redirect)c({value:d,redirectTo:l});}for(let i of u){let s=e[i];this._applyUnknownHandler(i,s,r,(a,D)=>{n.push({[a]:D});});}return n}_applyRequiredCheck(e){for(let r of Object.keys(this._utils.schemas))if(this._identifyMissing(r,e)&&this._identifyRequired(r))throw this._invalidHandler(r,tt,this._utils)}_partitionOptionKeys(e){let[r,n]=qr(Object.keys(e).filter(o=>!this._identifyMissing(o,e)),o=>o in this._utils.schemas);return {knownKeys:r,unknownKeys:n}}_applyValidation(e,r,n){let o=St(n.validate(e,this._utils),e);if(o!==!0)throw this._invalidHandler(r,o.value,this._utils)}_applyUnknownHandler(e,r,n,o){let u=this._unknownHandler(e,r,this._utils);if(u)for(let i of Object.keys(u)){if(this._identifyMissing(i,u))continue;let s=u[i];i in this._utils.schemas?o(i,s):n[i]=s;}}_applyPostprocess(e){let r=this._postprocess(e,this._utils);if(r!==Fe){if(r.delete)for(let n of r.delete)delete e[n];if(r.override){let{knownKeys:n,unknownKeys:o}=this._partitionOptionKeys(r.override);for(let u of n){let i=r.override[u];this._applyValidation(i,u,this._utils.schemas[u]),e[u]=i;}for(let u of o){let i=r.override[u];this._applyUnknownHandler(u,i,e,(s,a)=>{let D=this._utils.schemas[s];this._applyValidation(a,s,D),e[s]=a;});}}}}};var Lt;function Uu(t,e,{logger:r=!1,isCLI:n=!1,passThrough:o=!1,FlagSchema:u,descriptor:i}={}){if(n){if(!u)throw new Error("'FlagSchema' option is required.");if(!i)throw new Error("'descriptor' option is required.")}else i=ne;let s=o?Array.isArray(o)?(f,d)=>o.includes(f)?{[f]:d}:void 0:(f,d)=>({[f]:d}):(f,d,l)=>{let{_:p,...m}=l.schemas;return rt(f,d,{...l,schemas:m})},a=Mu(e,{isCLI:n,FlagSchema:u}),D=new lt(a,{logger:r,unknown:s,descriptor:i}),c=r!==!1;c&&Lt&&(D._hasDeprecationWarned=Lt);let F=D.normalize(t);return c&&(Lt=D._hasDeprecationWarned),F}function Mu(t,{isCLI:e,FlagSchema:r}){let n=[];e&&n.push(ut.create({name:"_"}));for(let o of t)n.push(Wu(o,{isCLI:e,optionInfos:t,FlagSchema:r})),o.alias&&e&&n.push(nt.create({name:o.alias,sourceName:o.name}));return n}function Wu(t,{isCLI:e,optionInfos:r,FlagSchema:n}){let{name:o}=t,u={name:o},i,s={};switch(t.type){case"int":i=ct,e&&(u.preprocess=Number);break;case"string":i=Le;break;case"choice":i=at,u.choices=t.choices.map(a=>a!=null&&a.redirect?{...a,redirect:{to:{key:t.name,value:a.redirect}}}:a);break;case"boolean":i=it;break;case"flag":i=n,u.flags=r.flatMap(a=>[a.alias,a.description&&a.name,a.oppositeDescription&&`no-${a.name}`].filter(Boolean));break;case"path":i=Le;break;default:throw new Error(`Unexpected type ${t.type}`)}if(t.exception?u.validate=(a,D,c)=>t.exception(a)||D.validate(a,c):u.validate=(a,D,c)=>a===void 0||D.validate(a,c),t.redirect&&(s.redirect=a=>a?{to:{key:t.redirect.option,value:t.redirect.value}}:void 0),t.deprecated&&(s.deprecated=!0),e&&!t.array){let a=u.preprocess||(D=>D);u.preprocess=(D,c,F)=>c.preprocess(a(Array.isArray(D)?y(!1,D,-1):D),F);}return t.array?ot.create({...e?{preprocess:a=>Array.isArray(a)?a:[a]}:{},...s,valueSchema:i.create(u)}):i.create({...u,...s})}var nn=Uu;function It(t,e){if(!e)throw new Error("parserName is required.");for(let n=t.length-1;n>=0;n--){let o=t[n];if(o.parsers&&Object.prototype.hasOwnProperty.call(o.parsers,e))return o}let r=`Couldn't resolve parser "${e}".`;throw r+=" Plugins must be explicitly added to the standalone bundle.",new Se(r)}function un(t,e){if(!e)throw new Error("astFormat is required.");for(let n=t.length-1;n>=0;n--){let o=t[n];if(o.printers&&Object.prototype.hasOwnProperty.call(o.printers,e))return o}let r=`Couldn't find plugin for AST format "${e}".`;throw r+=" Plugins must be explicitly added to the standalone bundle.",new Se(r)}function ft({plugins:t,parser:e}){let r=It(t,e);return Rt(r,e)}function Rt(t,e){let r=t.parsers[e];return typeof r=="function"?r():r}function on(t,e){let r=t.printers[e];return typeof r=="function"?r():r}var sn={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null};async function zu(t,e={}){var F;let r={...t};if(!r.parser)if(r.filepath){if(r.parser=Ir(r,{physicalFile:r.filepath}),!r.parser)throw new ve(`No parser could be inferred for file "${r.filepath}".`)}else throw new ve("No parser and no file path given, couldn't infer a parser.");let n=et({plugins:t.plugins,showDeprecated:!0}).options,o={...sn,...Object.fromEntries(n.filter(f=>f.default!==void 0).map(f=>[f.name,f.default]))},u=It(r.plugins,r.parser),i=await Rt(u,r.parser);r.astFormat=i.astFormat,r.locEnd=i.locEnd,r.locStart=i.locStart;let s=(F=u.printers)!=null&&F[i.astFormat]?u:un(r.plugins,i.astFormat),a=await on(s,i.astFormat);r.printer=a;let D=s.defaultOptions?Object.fromEntries(Object.entries(s.defaultOptions).filter(([,f])=>f!==void 0)):{},c={...o,...D};for(let[f,d]of Object.entries(c))(r[f]===null||r[f]===void 0)&&(r[f]=d);return r.parser==="json"&&(r.trailingComma="none"),nn(r,n,{passThrough:Object.keys(sn),...e})}var ue=zu;var an=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),Gu=t=>Object.keys(t).filter(e=>!an.has(e));function Ku(t){return t?e=>t(e,an):Gu}var J=Ku;function Hu(t,e){let{printer:{massageAstNode:r,getVisitorKeys:n}}=e;if(!r)return t;let o=J(n),u=r.ignoredProperties??new Set;return i(t);function i(s,a){if(!(s!==null&&typeof s=="object"))return s;if(Array.isArray(s))return s.map(f=>i(f,a)).filter(Boolean);let D={},c=new Set(o(s));for(let f in s)!Object.prototype.hasOwnProperty.call(s,f)||u.has(f)||(c.has(f)?D[f]=i(s[f],s):D[f]=s[f]);let F=r(s,D,a);if(F!==null)return F??D}}var Dn=Hu;var mn=ur(Fn(),1);async function eo(t,e){let r=await ft(e),n=r.preprocess?r.preprocess(t,e):t;e.originalText=n;let o;try{o=await r.parse(n,e,e);}catch(u){to(u,t);}return {text:n,ast:o}}function to(t,e){let{loc:r}=t;if(r){let n=(0, mn.codeFrameColumns)(e,r,{highlightCode:!0});throw t.message+=`
4274
+ `+n,t.codeFrame=n,t}throw t}var De=eo;var Ie,Vt,me,dt,jt=class{constructor(e){gt(this,Ie);gt(this,me);this.stack=[e];}get key(){let{stack:e,siblings:r}=this;return y(!1,e,r===null?-2:-4)??null}get index(){return this.siblings===null?null:y(!1,this.stack,-2)}get node(){return y(!1,this.stack,-1)}get parent(){return this.getNode(1)}get grandparent(){return this.getNode(2)}get isInArray(){return this.siblings!==null}get siblings(){let{stack:e}=this,r=y(!1,e,-3);return Array.isArray(r)?r:null}get next(){let{siblings:e}=this;return e===null?null:e[this.index+1]}get previous(){let{siblings:e}=this;return e===null?null:e[this.index-1]}get isFirst(){return this.index===0}get isLast(){let{siblings:e,index:r}=this;return e!==null&&r===e.length-1}get isRoot(){return this.stack.length===1}get root(){return this.stack[0]}get ancestors(){return [...le(this,me,dt).call(this)]}getName(){let{stack:e}=this,{length:r}=e;return r>1?y(!1,e,-2):null}getValue(){return y(!1,this.stack,-1)}getNode(e=0){let r=le(this,Ie,Vt).call(this,e);return r===-1?null:this.stack[r]}getParentNode(e=0){return this.getNode(e+1)}call(e,...r){let{stack:n}=this,{length:o}=n,u=y(!1,n,-1);for(let i of r)u=u[i],n.push(i,u);try{return e(this)}finally{n.length=o;}}callParent(e,r=0){let n=le(this,Ie,Vt).call(this,r+1),o=this.stack.splice(n+1);try{return e(this)}finally{this.stack.push(...o);}}each(e,...r){let{stack:n}=this,{length:o}=n,u=y(!1,n,-1);for(let i of r)u=u[i],n.push(i,u);try{for(let i=0;i<u.length;++i)n.push(i,u[i]),e(this,i,u),n.length-=2;}finally{n.length=o;}}map(e,...r){let n=[];return this.each((o,u,i)=>{n[u]=e(o,u,i);},...r),n}match(...e){let r=this.stack.length-1,n=null,o=this.stack[r--];for(let u of e){if(o===void 0)return !1;let i=null;if(typeof n=="number"&&(i=n,n=this.stack[r--],o=this.stack[r--]),u&&!u(o,n,i))return !1;n=this.stack[r--],o=this.stack[r--];}return !0}findAncestor(e){for(let r of le(this,me,dt).call(this))if(e(r))return r}hasAncestor(e){for(let r of le(this,me,dt).call(this))if(e(r))return !0;return !1}};Ie=new WeakSet,Vt=function(e){let{stack:r}=this;for(let n=r.length-1;n>=0;n-=2)if(!Array.isArray(r[n])&&--e<0)return n;return -1},me=new WeakSet,dt=function*(){let{stack:e}=this;for(let r=e.length-3;r>=0;r-=2){let n=e[r];Array.isArray(n)||(yield n);}};var En=jt;var Re=()=>{};Re.ok=Re;Re.strictEqual=Re;var Ye=Re;function Ee(t){return (e,r,n)=>{let o=!!(n!=null&&n.backwards);if(r===!1)return !1;let{length:u}=e,i=r;for(;i>=0&&i<u;){let s=e.charAt(i);if(t instanceof RegExp){if(!t.test(s))return i}else if(!t.includes(s))return i;o?i--:i++;}return i===-1||i===u?i:!1}}var hn=Ee(/\s/),T=Ee(" "),Ft=Ee(",; "),mt=Ee(/[^\n\r]/);function ro(t,e,r){let n=!!(r!=null&&r.backwards);if(e===!1)return !1;let o=t.charAt(e);if(n){if(t.charAt(e-1)==="\r"&&o===`
4275
+ `)return e-2;if(o===`
4276
+ `||o==="\r"||o==="\u2028"||o==="\u2029")return e-1}else {if(o==="\r"&&t.charAt(e+1)===`
4277
+ `)return e+2;if(o===`
4278
+ `||o==="\r"||o==="\u2028"||o==="\u2029")return e+1}return e}var V=ro;function no(t,e,r={}){let n=T(t,r.backwards?e-1:e,r),o=V(t,n,r);return n!==o}var U=no;function uo(t){return Array.isArray(t)&&t.length>0}var $t=uo;function oo(t){return t!==null&&typeof t=="object"}var Cn=oo;function*Ut(t,e){let{getVisitorKeys:r,filter:n=()=>!0}=e,o=u=>Cn(u)&&n(u);for(let u of r(t)){let i=t[u];if(Array.isArray(i))for(let s of i)o(s)&&(yield s);else o(i)&&(yield i);}}function*gn(t,e){let r=[t];for(let n=0;n<r.length;n++){let o=r[n];for(let u of Ut(o,e))yield u,r.push(u);}}function io(t){let e=t.type||t.kind||"(unknown type)",r=String(t.name||t.id&&(typeof t.id=="object"?t.id.name:t.id)||t.key&&(typeof t.key=="object"?t.key.name:t.key)||t.value&&(typeof t.value=="object"?"":String(t.value))||t.operator||"");return r.length>20&&(r=r.slice(0,19)+"\u2026"),e+(r?" "+r:"")}function Mt(t,e){(t.comments??(t.comments=[])).push(e),e.printed=!1,e.nodeDescription=io(t);}function oe(t,e){e.leading=!0,e.trailing=!1,Mt(t,e);}function Q(t,e,r){e.leading=!1,e.trailing=!1,r&&(e.marker=r),Mt(t,e);}function ie(t,e){e.leading=!1,e.trailing=!0,Mt(t,e);}var Wt=new WeakMap;function Et(t,e){if(Wt.has(t))return Wt.get(t);let{printer:{getCommentChildNodes:r,canAttachComment:n,getVisitorKeys:o},locStart:u,locEnd:i}=e;if(!n)return [];let s=((r==null?void 0:r(t,e))??[...Ut(t,{getVisitorKeys:J(o)})]).flatMap(a=>n(a)?[a]:Et(a,e));return s.sort((a,D)=>u(a)-u(D)||i(a)-i(D)),Wt.set(t,s),s}function xn(t,e,r,n){let{locStart:o,locEnd:u}=r,i=o(e),s=u(e),a=Et(t,r),D,c,F=0,f=a.length;for(;F<f;){let d=F+f>>1,l=a[d],p=o(l),m=u(l);if(p<=i&&s<=m)return xn(l,e,r,l);if(m<=i){D=l,F=d+1;continue}if(s<=p){c=l,f=d;continue}throw new Error("Comment location overlaps with node location")}if((n==null?void 0:n.type)==="TemplateLiteral"){let{quasis:d}=n,l=Gt(d,e,r);D&&Gt(d,D,r)!==l&&(D=null),c&&Gt(d,c,r)!==l&&(c=null);}return {enclosingNode:n,precedingNode:D,followingNode:c}}var zt=()=>!1;function _n(t,e){let{comments:r}=t;if(delete t.comments,!$t(r)||!e.printer.canAttachComment)return;let n=[],{locStart:o,locEnd:u,printer:{experimentalFeatures:{avoidAstMutation:i=!1}={},handleComments:s={}},originalText:a}=e,{ownLine:D=zt,endOfLine:c=zt,remaining:F=zt}=s,f=r.map((d,l)=>({...xn(t,d,e),comment:d,text:a,options:e,ast:t,isLastComment:r.length-1===l}));for(let[d,l]of f.entries()){let{comment:p,precedingNode:m,enclosingNode:E,followingNode:h,text:g,options:C,ast:_,isLastComment:ee}=l;if(C.parser==="json"||C.parser==="json5"||C.parser==="__js_expression"||C.parser==="__ts_expression"||C.parser==="__vue_expression"||C.parser==="__vue_ts_expression"){if(o(p)-o(_)<=0){oe(_,p);continue}if(u(p)-u(_)>=0){ie(_,p);continue}}let M;if(i?M=[l]:(p.enclosingNode=E,p.precedingNode=m,p.followingNode=h,M=[p,g,C,_,ee]),so(g,C,f,d))p.placement="ownLine",D(...M)||(h?oe(h,p):m?ie(m,p):E?Q(E,p):Q(_,p));else if(ao(g,C,f,d))p.placement="endOfLine",c(...M)||(m?ie(m,p):h?oe(h,p):E?Q(E,p):Q(_,p));else if(p.placement="remaining",!F(...M))if(m&&h){let te=n.length;te>0&&n[te-1].followingNode!==h&&yn(n,C),n.push(l);}else m?ie(m,p):h?oe(h,p):E?Q(E,p):Q(_,p);}if(yn(n,e),!i)for(let d of r)delete d.precedingNode,delete d.enclosingNode,delete d.followingNode;}var An=t=>!/[\S\n\u2028\u2029]/.test(t);function so(t,e,r,n){let{comment:o,precedingNode:u}=r[n],{locStart:i,locEnd:s}=e,a=i(o);if(u)for(let D=n-1;D>=0;D--){let{comment:c,precedingNode:F}=r[D];if(F!==u||!An(t.slice(s(c),a)))break;a=i(c);}return U(t,a,{backwards:!0})}function ao(t,e,r,n){let{comment:o,followingNode:u}=r[n],{locStart:i,locEnd:s}=e,a=s(o);if(u)for(let D=n+1;D<r.length;D++){let{comment:c,followingNode:F}=r[D];if(F!==u||!An(t.slice(a,i(c))))break;a=s(c);}return U(t,a)}function yn(t,e){var s,a;let r=t.length;if(r===0)return;let{precedingNode:n,followingNode:o}=t[0],u=e.locStart(o),i;for(i=r;i>0;--i){let{comment:D,precedingNode:c,followingNode:F}=t[i-1];Ye.strictEqual(c,n),Ye.strictEqual(F,o);let f=e.originalText.slice(e.locEnd(D),u);if(((a=(s=e.printer).isGap)==null?void 0:a.call(s,f,e))??/^[\s(]*$/.test(f))u=e.locStart(D);else break}for(let[D,{comment:c}]of t.entries())D<i?ie(n,c):oe(o,c);for(let D of [n,o])D.comments&&D.comments.length>1&&D.comments.sort((c,F)=>e.locStart(c)-e.locStart(F));t.length=0;}function Gt(t,e,r){let n=r.locStart(e)-1;for(let o=1;o<t.length;++o)if(n<r.locStart(t[o]))return o-1;return 0}function Do(t,e){let r=e-1;r=T(t,r,{backwards:!0}),r=V(t,r,{backwards:!0}),r=T(t,r,{backwards:!0});let n=V(t,r,{backwards:!0});return r!==n}var je=Do;function Bn(t,e){let r=t.node;return r.printed=!0,e.printer.printComment(t,e)}function co(t,e){var c;let r=t.node,n=[Bn(t,e)],{printer:o,originalText:u,locStart:i,locEnd:s}=e;if((c=o.isBlockComment)==null?void 0:c.call(o,r)){let F=U(u,s(r))?U(u,i(r),{backwards:!0})?H:Ke:" ";n.push(F);}else n.push(H);let D=V(u,T(u,s(r)));return D!==!1&&U(u,D)&&n.push(H),n}function lo(t,e,r){var D;let n=t.node,o=Bn(t,e),{printer:u,originalText:i,locStart:s}=e,a=(D=u.isBlockComment)==null?void 0:D.call(u,n);if(r!=null&&r.hasLineSuffix&&!(r!=null&&r.isBlock)||U(i,s(n),{backwards:!0})){let c=je(i,s(n));return {doc:_e([H,c?H:"",o]),isBlock:a,hasLineSuffix:!0}}return !a||r!=null&&r.hasLineSuffix?{doc:[_e([" ",o]),fe],isBlock:a,hasLineSuffix:!0}:{doc:[" ",o],isBlock:a,hasLineSuffix:!1}}function fo(t,e){let r=t.node;if(!r)return {};let n=e[Symbol.for("printedComments")];if((r.comments||[]).filter(a=>!n.has(a)).length===0)return {leading:"",trailing:""};let u=[],i=[],s;return t.each(()=>{let a=t.node;if(n!=null&&n.has(a))return;let{leading:D,trailing:c}=a;D?u.push(co(t,e)):c&&(s=lo(t,e,s),i.push(s.doc));},"comments"),{leading:u,trailing:i}}function kn(t,e,r){let{leading:n,trailing:o}=fo(t,r);return !n&&!o?e:Ze(e,u=>[n,u,o])}function bn(t){let{[Symbol.for("comments")]:e,[Symbol.for("printedComments")]:r}=t;for(let n of e){if(!n.printed&&!r.has(n))throw new Error('Comment "'+n.value.trim()+'" was not printed. Please report this error!');delete n.printed;}}async function wn(t,e,r,n,o){let{embeddedLanguageFormatting:u,printer:{embed:i,hasPrettierIgnore:s=()=>!1,getVisitorKeys:a}}=r;if(!i||u!=="auto")return;if(i.length>2)throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/en/plugins.html#optional-embed");let D=J(i.getVisitorKeys??a),c=[];d();let F=t.stack;for(let{print:l,node:p,pathStack:m}of c)try{t.stack=m;let E=await l(f,e,t,r);E&&o.set(p,E);}catch(E){if(globalThis.PRETTIER_DEBUG)throw E}t.stack=F;function f(l,p){return po(l,p,r,n)}function d(){let{node:l}=t;if(l===null||typeof l!="object"||s(t))return;for(let m of D(l))Array.isArray(l[m])?t.each(d,m):t.call(d,m);let p=i(t,r);if(p){if(typeof p=="function"){c.push({print:p,node:l,pathStack:[...t.stack]});return}o.set(l,p);}}}async function po(t,e,r,n){let o=await ue({...r,...e,parentParser:r.parser,originalText:t},{passThrough:!0}),{ast:u}=await De(t,o),i=await n(u,o);return Xe(i)}function mo(t,e){let{originalText:r,[Symbol.for("comments")]:n,locStart:o,locEnd:u,[Symbol.for("printedComments")]:i}=e,{node:s}=t,a=o(s),D=u(s);for(let c of n)o(c)>=a&&u(c)<=D&&i.add(c);return r.slice(a,D)}var Nn=mo;async function Ve(t,e){({ast:t}=await Kt(t,e));let r=new Map,n=new En(t),u=new Map;await wn(n,s,e,Ve,u);let i=await Tn(n,e,s,void 0,u);return bn(e),i;function s(D,c){return D===void 0||D===n?a(c):Array.isArray(D)?n.call(()=>a(c),...D):n.call(()=>a(c),D)}function a(D){let c=n.node;if(c==null)return "";let F=c&&typeof c=="object"&&D===void 0;if(F&&r.has(c))return r.get(c);let f=Tn(n,e,s,D,u);return F&&r.set(c,f),f}}function Tn(t,e,r,n,o){var a;let{node:u}=t,{printer:i}=e,s;return (a=i.hasPrettierIgnore)!=null&&a.call(i,t)?s=Nn(t,e):o.has(u)?s=o.get(u):s=i.print(t,e,r,n),u===e.cursorNode&&(s=Ze(s,D=>[Be,D,Be])),i.printComment&&(!i.willPrintOwnComments||!i.willPrintOwnComments(t,e))&&(s=kn(t,s,e)),s}async function Kt(t,e){let r=t.comments??[];e[Symbol.for("comments")]=r,e[Symbol.for("tokens")]=t.tokens??[],e[Symbol.for("printedComments")]=new Set,_n(t,e);let{printer:{preprocess:n}}=e;return t=n?await n(t,e):t,{ast:t,comments:r}}var Eo=({parser:t})=>t==="json"||t==="json5"||t==="json-stringify";function ho(t,e){let r=[t.node,...t.parentNodes],n=new Set([e.node,...e.parentNodes]);return r.find(o=>Pn.has(o.type)&&n.has(o))}function Sn(t){let e=t.length-1;for(;;){let r=t[e];if((r==null?void 0:r.type)==="Program"||(r==null?void 0:r.type)==="File")e--;else break}return t.slice(0,e+1)}function Co(t,e,{locStart:r,locEnd:n}){let o=t.node,u=e.node;if(o===u)return {startNode:o,endNode:u};let i=r(t.node);for(let a of Sn(e.parentNodes))if(r(a)>=i)u=a;else break;let s=n(e.node);for(let a of Sn(t.parentNodes)){if(n(a)<=s)o=a;else break;if(o===u)break}return {startNode:o,endNode:u}}function Ht(t,e,r,n,o=[],u){let{locStart:i,locEnd:s}=r,a=i(t),D=s(t);if(!(e>D||e<a||u==="rangeEnd"&&e===a||u==="rangeStart"&&e===D)){for(let c of Et(t,r)){let F=Ht(c,e,r,n,[t,...o],u);if(F)return F}if(!n||n(t,o[0]))return {node:t,parentNodes:o}}}function go(t,e){return e!=="DeclareExportDeclaration"&&t!=="TypeParameterDeclaration"&&(t==="Directive"||t==="TypeAlias"||t==="TSExportAssignment"||t.startsWith("Declare")||t.startsWith("TSDeclare")||t.endsWith("Statement")||t.endsWith("Declaration"))}var Pn=new Set(["JsonRoot","ObjectExpression","ArrayExpression","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral","UnaryExpression","TemplateLiteral"]),yo=new Set(["OperationDefinition","FragmentDefinition","VariableDefinition","TypeExtensionDefinition","ObjectTypeDefinition","FieldDefinition","DirectiveDefinition","EnumTypeDefinition","EnumValueDefinition","InputValueDefinition","InputObjectTypeDefinition","SchemaDefinition","OperationTypeDefinition","InterfaceTypeDefinition","UnionTypeDefinition","ScalarTypeDefinition"]);function vn(t,e,r){if(!e)return !1;switch(t.parser){case"flow":case"babel":case"babel-flow":case"babel-ts":case"typescript":case"acorn":case"espree":case"meriyah":case"__babel_estree":return go(e.type,r==null?void 0:r.type);case"json":case"json5":case"json-stringify":return Pn.has(e.type);case"graphql":return yo.has(e.kind);case"vue":return e.tag!=="root"}return !1}function Ln(t,e,r){let{rangeStart:n,rangeEnd:o,locStart:u,locEnd:i}=e;Ye.ok(o>n);let s=t.slice(n,o).search(/\S/),a=s===-1;if(!a)for(n+=s;o>n&&!/\S/.test(t[o-1]);--o);let D=Ht(r,n,e,(d,l)=>vn(e,d,l),[],"rangeStart"),c=a?D:Ht(r,o,e,d=>vn(e,d),[],"rangeEnd");if(!D||!c)return {rangeStart:0,rangeEnd:0};let F,f;if(Eo(e)){let d=ho(D,c);F=d,f=d;}else ({startNode:F,endNode:f}=Co(D,c,e));return {rangeStart:Math.min(u(F),u(f)),rangeEnd:Math.max(i(F),i(f))}}function xo(t,e){let{cursorOffset:r,locStart:n,locEnd:o}=e,u=J(e.printer.getVisitorKeys),i=a=>n(a)<=r&&o(a)>=r,s=t;for(let a of gn(t,{getVisitorKeys:u,filter:i}))s=a;return s}var In=xo;var $n="\uFEFF",Rn=Symbol("cursor");async function Un(t,e,r=0){if(!t||t.trim().length===0)return {formatted:"",cursorOffset:-1,comments:[]};let{ast:n,text:o}=await De(t,e);e.cursorOffset>=0&&(e.cursorNode=In(n,e));let u=await Ve(n,e);r>0&&(u=qe([H,u],r,e.tabWidth));let i=pe(u,e);if(r>0){let a=i.formatted.trim();i.cursorNodeStart!==void 0&&(i.cursorNodeStart-=i.formatted.indexOf(a)),i.formatted=a+be(e.endOfLine);}let s=e[Symbol.for("comments")];if(e.cursorOffset>=0){let a,D,c,F,f;if(e.cursorNode&&i.cursorNodeText?(a=e.locStart(e.cursorNode),D=o.slice(a,e.locEnd(e.cursorNode)),c=e.cursorOffset-a,F=i.cursorNodeStart,f=i.cursorNodeText):(a=0,D=o,c=e.cursorOffset,F=0,f=i.formatted),D===f)return {formatted:i.formatted,cursorOffset:F+c,comments:s};let d=D.split("");d.splice(c,0,Rn);let l=f.split(""),p=(0, Vn.diffArrays)(d,l),m=F;for(let E of p)if(E.removed){if(E.value.includes(Rn))break}else m+=E.count;return {formatted:i.formatted,cursorOffset:m,comments:s}}return {formatted:i.formatted,cursorOffset:-1,comments:s}}async function _o(t,e){let{ast:r,text:n}=await De(t,e),{rangeStart:o,rangeEnd:u}=Ln(n,e,r),i=n.slice(o,u),s=Math.min(o,n.lastIndexOf(`
4279
+ `,o)+1),a=n.slice(s,o).match(/^\s*/)[0],D=de(a,e.tabWidth),c=await Un(i,{...e,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:e.cursorOffset>o&&e.cursorOffset<=u?e.cursorOffset-o:-1,endOfLine:"lf"},D),F=c.formatted.trimEnd(),{cursorOffset:f}=e;f>u?f+=F.length-i.length:c.cursorOffset>=0&&(f=c.cursorOffset+o);let d=n.slice(0,o)+F+n.slice(u);if(e.endOfLine!=="lf"){let l=be(e.endOfLine);f>=0&&l===`\r
4280
+ `&&(f+=Bt(d.slice(0,f),`
4281
+ `)),d=re(!1,d,`
4282
+ `,l);}return {formatted:d,cursorOffset:f,comments:c.comments}}function qt(t,e,r){return typeof e!="number"||Number.isNaN(e)||e<0||e>t.length?r:e}function Yn(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:o}=e;return r=qt(t,r,-1),n=qt(t,n,0),o=qt(t,o,t.length),{...e,cursorOffset:r,rangeStart:n,rangeEnd:o}}function Mn(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:o,endOfLine:u}=Yn(t,e),i=t.charAt(0)===$n;if(i&&(t=t.slice(1),r--,n--,o--),u==="auto"&&(u=gr(t)),t.includes("\r")){let s=a=>Bt(t.slice(0,Math.max(a,0)),`\r
4283
+ `);r-=s(r),n-=s(n),o-=s(o),t=yr(t);}return {hasBOM:i,text:t,options:Yn(t,{...e,cursorOffset:r,rangeStart:n,rangeEnd:o,endOfLine:u})}}async function jn(t,e){let r=await ft(e);return !r.hasPragma||r.hasPragma(t)}async function Jt(t,e){let{hasBOM:r,text:n,options:o}=Mn(t,await ue(e));if(o.rangeStart>=o.rangeEnd&&n!==""||o.requirePragma&&!await jn(n,o))return {formatted:t,cursorOffset:e.cursorOffset,comments:[]};let u;return o.rangeStart>0||o.rangeEnd<n.length?u=await _o(n,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await jn(n,o)&&(n=o.printer.insertPragma(n)),u=await Un(n,o)),r&&(u.formatted=$n+u.formatted,u.cursorOffset>=0&&u.cursorOffset++),u}async function Wn(t,e,r){let{text:n,options:o}=Mn(t,await ue(e)),u=await De(n,o);return r&&(r.preprocessForPrint&&(u.ast=await Kt(u.ast,o)),r.massage&&(u.ast=Dn(u.ast,o))),u}async function zn(t,e){e=await ue(e);let r=await Ve(t,e);return pe(r,e)}async function Gn(t,e){let r=vr(t),{formatted:n}=await Jt(r,{...e,parser:"__js_expression"});return n}async function Kn(t,e){e=await ue(e);let{ast:r}=await De(t,e);return Ve(r,e)}async function Hn(t,e){return pe(t,await ue(e))}var Zt={};Me(Zt,{addDanglingComment:()=>Q,addLeadingComment:()=>oe,addTrailingComment:()=>ie,getAlignmentSize:()=>de,getIndentSize:()=>Jn,getMaxContinuousCount:()=>qn,getNextNonSpaceNonCommentCharacter:()=>Qn,getNextNonSpaceNonCommentCharacterIndex:()=>Io,getStringWidth:()=>we,hasNewline:()=>U,hasNewlineInRange:()=>Xn,hasSpaces:()=>Zn,isNextLineEmpty:()=>Vo,isNextLineEmptyAfterIndex:()=>ht,isPreviousLineEmpty:()=>Yo,makeString:()=>eu,skip:()=>Ee,skipEverythingButNewLine:()=>mt,skipInlineComment:()=>he,skipNewline:()=>V,skipSpaces:()=>T,skipToLineEnd:()=>Ft,skipTrailingComment:()=>Ce,skipWhitespace:()=>hn});function Bo(t,e){if(e===!1)return !1;if(t.charAt(e)==="/"&&t.charAt(e+1)==="*"){for(let r=e+2;r<t.length;++r)if(t.charAt(r)==="*"&&t.charAt(r+1)==="/")return r+2}return e}var he=Bo;function ko(t,e){return e===!1?!1:t.charAt(e)==="/"&&t.charAt(e+1)==="/"?mt(t,e):e}var Ce=ko;function bo(t,e){let r=null,n=e;for(;n!==r;)r=n,n=T(t,n),n=he(t,n),n=Ce(t,n),n=V(t,n);return n}var $e=bo;function wo(t,e){let r=null,n=e;for(;n!==r;)r=n,n=Ft(t,n),n=he(t,n),n=T(t,n);return n=Ce(t,n),n=V(t,n),n!==!1&&U(t,n)}var ht=wo;function Xt(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Oo(t,e){let r=t.match(new RegExp(`(${Xt(e)})+`,"g"));return r===null?0:r.reduce((n,o)=>Math.max(n,o.length/e.length),0)}var qn=Oo;function No(t,e){let r=t.lastIndexOf(`
4284
+ `);return r===-1?0:de(t.slice(r+1).match(/^[\t ]*/)[0],e)}var Jn=No;function To(t,e,r){for(let n=e;n<r;++n)if(t.charAt(n)===`
4285
+ `)return !0;return !1}var Xn=To;function So(t,e,r={}){return T(t,r.backwards?e-1:e,r)!==e}var Zn=So;function vo(t,e){let r=$e(t,e);return r===!1?"":t.charAt(r)}var Qn=vo;function Po(t,e,r){let n=e==='"'?"'":'"',u=re(!1,t,/\\(.)|(["'])/gs,(i,s,a)=>s===n?s:a===e?"\\"+a:a||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(s)?s:"\\"+s));return e+u+e}var eu=Po;function Lo(t,e,r){return $e(t,r(e))}function Io(t,e){return arguments.length===2||typeof e=="number"?$e(t,e):Lo(...arguments)}function Ro(t,e,r){return je(t,r(e))}function Yo(t,e){return arguments.length===2||typeof e=="number"?je(t,e):Ro(...arguments)}function jo(t,e,r){return ht(t,r(e))}function Vo(t,e){return arguments.length===2||typeof e=="number"?ht(t,e):jo(...arguments)}var Qt={};Me(Qt,{builders:()=>$o,printer:()=>Uo,utils:()=>Mo});var $o={join:ke,line:Ke,softline:hr,hardline:H,literalline:He,group:_t,conditionalGroup:pr,fill:Ge,lineSuffix:_e,lineSuffixBoundary:mr,cursor:Be,breakParent:fe,ifBreak:dr,trim:Er,indent:ae,indentIfBreak:Fr,align:se,addAlignmentToDoc:qe,markAsRoot:lr,dedentToRoot:cr,dedent:fr,hardlineWithoutBreakParent:Ae,literallineWithoutBreakParent:At,label:Cr,concat:t=>t},Uo={printDocToString:pe},Mo={willBreak:br,traverseDoc:xe,findInDoc:Je,mapDoc:Ne,removeLines:Or,stripTrailingHardline:Xe,replaceEndOfLine:Nr,canBreak:Tr};var tu="3.0.1";function ce(t,e=1){return async(...r)=>{let n=r[e]??{},o=n.plugins??[];return r[e]={...n,plugins:Array.isArray(o)?o:Object.values(o)},t(...r)}}var ru=ce(Jt);async function nu(t,e){let{formatted:r}=await ru(t,{...e,cursorOffset:-1});return r}async function Wo(t,e){return await nu(t,e)===t}var zo=ce(et,0),Go={parse:ce(Wn),formatAST:ce(zn),formatDoc:ce(Gn),printToDoc:ce(Kn),printDocToString:ce(Hn)};
4286
+
4287
+ const util = Zt;
4288
+
2925
4289
  /**
2926
4290
  * Override the default behavior to attach comments to syntax node.
2927
4291
  */
@@ -3043,6 +4407,7 @@ function needsParens(path, options) {
3043
4407
  if (!parent) {
3044
4408
  return false;
3045
4409
  }
4410
+ // eslint-disable-next-line deprecation/deprecation
3046
4411
  const node = path.getValue();
3047
4412
  switch (node.kind) {
3048
4413
  case SyntaxKind.IntersectionExpression:
@@ -3059,8 +4424,8 @@ function needsParens(path, options) {
3059
4424
  }
3060
4425
  }
3061
4426
 
3062
- const { align, breakParent, group, hardline, ifBreak, indent, join, line, softline } = prettier.doc.builders;
3063
- const { isNextLineEmpty } = prettier.util;
4427
+ const { align, breakParent, group, hardline, ifBreak, indent, join, line, softline } = builders;
4428
+ const { isNextLineEmpty } = util;
3064
4429
  /**
3065
4430
  * If the decorators for that node should try to be kept inline.
3066
4431
  */
@@ -3071,6 +4436,7 @@ const DecoratorsTryInline = {
3071
4436
  };
3072
4437
  const typespecPrinter = {
3073
4438
  print: printTypeSpec,
4439
+ isBlockComment: (node) => isBlockComment(node),
3074
4440
  canAttachComment: canAttachComment,
3075
4441
  printComment: printComment,
3076
4442
  handleComments: commentHandler,
@@ -3372,7 +4738,7 @@ function shouldDecoratorBreakLine(path, options, { tryInline }) {
3372
4738
  * Check if there is already new lines in between the decorators of the node.
3373
4739
  */
3374
4740
  function hasNewlineBetweenOrAfterDecorators(node, options) {
3375
- return node.decorators.some((decorator) => prettier.util.hasNewline(options.originalText, decorator.end));
4741
+ return node.decorators.some((decorator) => util.hasNewline(options.originalText, decorator.end));
3376
4742
  }
3377
4743
  function printDecorator(path, options, print) {
3378
4744
  const args = printDecoratorArgs(path, options, print);
@@ -4166,35 +5532,6 @@ function isLineComment(comment) {
4166
5532
  return comment.kind === SyntaxKind.BlockComment;
4167
5533
  }
4168
5534
 
4169
- (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4170
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4171
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4172
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4173
- };
4174
- (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
4175
- if (kind === "m") throw new TypeError("Private method is not writable");
4176
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4177
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
4178
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
4179
- };
4180
- /**
4181
- * A specially typed version of `Array.isArray` to work around [this issue](https://github.com/microsoft/TypeScript/issues/17002).
4182
- */
4183
- function isArray(
4184
- // eslint-disable-next-line @typescript-eslint/ban-types
4185
- arg) {
4186
- return Array.isArray(arg);
4187
- }
4188
- /**
4189
- * Casts away readonly typing.
4190
- *
4191
- * Use it like this when it is safe to override readonly typing:
4192
- * mutate(item).prop = value;
4193
- */
4194
- function mutate(value) {
4195
- return value;
4196
- }
4197
-
4198
5535
  /**
4199
5536
  * The fixed set of options for each of the kinds of delimited lists in TypeSpec.
4200
5537
  */
@@ -4645,16 +5982,43 @@ function createParser(code, options = {}) {
4645
5982
  };
4646
5983
  }
4647
5984
  function parseUnionVariant(pos, decorators) {
4648
- const id = parseIdentifier({
4649
- message: "property",
4650
- allowStringLiteral: true,
4651
- });
4652
- parseExpected(Token.Colon);
4653
- const value = parseExpression();
5985
+ const idOrExpr = parseExpression();
5986
+ if (parseOptional(Token.Colon)) {
5987
+ let id = undefined;
5988
+ if (idOrExpr.kind !== SyntaxKind.TypeReference &&
5989
+ idOrExpr.kind !== SyntaxKind.StringLiteral) {
5990
+ error({ code: "token-expected", messageId: "identifier" });
5991
+ }
5992
+ else if (idOrExpr.kind === SyntaxKind.StringLiteral) {
5993
+ // convert string literal node to identifier node (back compat for string literal quoted properties)
5994
+ id = {
5995
+ kind: SyntaxKind.Identifier,
5996
+ sv: idOrExpr.value,
5997
+ ...finishNode(idOrExpr.pos),
5998
+ };
5999
+ }
6000
+ else {
6001
+ const target = idOrExpr.target;
6002
+ if (target.kind === SyntaxKind.Identifier) {
6003
+ id = target;
6004
+ }
6005
+ else {
6006
+ error({ code: "token-expected", messageId: "identifier" });
6007
+ }
6008
+ }
6009
+ const value = parseExpression();
6010
+ return {
6011
+ kind: SyntaxKind.UnionVariant,
6012
+ id,
6013
+ value,
6014
+ decorators,
6015
+ ...finishNode(pos),
6016
+ };
6017
+ }
4654
6018
  return {
4655
6019
  kind: SyntaxKind.UnionVariant,
4656
- id,
4657
- value,
6020
+ id: undefined,
6021
+ value: idOrExpr,
4658
6022
  decorators,
4659
6023
  ...finishNode(pos),
4660
6024
  };
@@ -5066,7 +6430,7 @@ function createParser(code, options = {}) {
5066
6430
  const pos = tokenPos();
5067
6431
  parseExpected(Token.Hash);
5068
6432
  const target = parseIdentifier();
5069
- if (target.sv !== "suppress") {
6433
+ if (target.sv !== "suppress" && target.sv !== "deprecated") {
5070
6434
  error({
5071
6435
  code: "unknown-directive",
5072
6436
  format: { id: target.sv },
@@ -6729,7 +8093,7 @@ function isBlocklessNamespace(node) {
6729
8093
  return node.statements === undefined;
6730
8094
  }
6731
8095
 
6732
- function parse(text, parsers, opts) {
8096
+ function parse(text, options) {
6733
8097
  const result = parse$1(text, { comments: true, docs: true });
6734
8098
  flattenNamespaces(result);
6735
8099
  const errors = result.parseDiagnostics.filter((x) => x.severity === "error");