ct-rich-text-editor 1.3.2 → 1.3.4

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.
Files changed (43) hide show
  1. package/README.md +217 -217
  2. package/dist/assets/style.css +4101 -4085
  3. package/dist/{babel-d155920e.js → babel-d3085146.js} +3565 -3292
  4. package/dist/babel-d3085146.js.map +1 -0
  5. package/dist/{estree-b1fff53b.js → estree-164983f6.js} +1763 -1778
  6. package/dist/estree-164983f6.js.map +1 -0
  7. package/dist/hooks/useModal.d.ts +0 -1
  8. package/dist/{html-f95ee5dc.js → html-5586dbf6.js} +701 -656
  9. package/dist/html-5586dbf6.js.map +1 -0
  10. package/dist/{html2pdf.bundle-7d125fec.js → html2pdf.bundle-5c5747c7.js} +2 -2
  11. package/dist/html2pdf.bundle-5c5747c7.js.map +1 -0
  12. package/dist/{html2pdf.bundle.min-96e9ee6a.js → html2pdf.bundle.min-8fcf4f01.js} +2 -2
  13. package/dist/html2pdf.bundle.min-8fcf4f01.js.map +1 -0
  14. package/dist/{index-91e0322d.js → index-48519641.js} +2 -2
  15. package/dist/index-48519641.js.map +1 -0
  16. package/dist/{index-413952d9.js → index-db43388d.js} +378 -254
  17. package/dist/index-db43388d.js.map +1 -0
  18. package/dist/index.js +1 -1
  19. package/dist/{markdown-1d9e6c3f.js → markdown-d513479b.js} +1836 -1789
  20. package/dist/markdown-d513479b.js.map +1 -0
  21. package/dist/plugins/AutocompletePlugin.d.ts +0 -1
  22. package/dist/plugins/SignatureCanvasPlugin/SignatureCanvasPlugin.d.ts +0 -1
  23. package/dist/plugins/SlashCommandPlugin/index.d.ts +0 -1
  24. package/dist/{postcss-c2592f3f.js → postcss-f084f74d.js} +1378 -1357
  25. package/dist/postcss-f084f74d.js.map +1 -0
  26. package/dist/standalone-5a8c6b7e.js +2518 -0
  27. package/dist/standalone-5a8c6b7e.js.map +1 -0
  28. package/dist/typescript-b1005db4.js +13705 -0
  29. package/dist/typescript-b1005db4.js.map +1 -0
  30. package/package.json +126 -126
  31. package/dist/babel-d155920e.js.map +0 -1
  32. package/dist/estree-b1fff53b.js.map +0 -1
  33. package/dist/html-f95ee5dc.js.map +0 -1
  34. package/dist/html2pdf.bundle-7d125fec.js.map +0 -1
  35. package/dist/html2pdf.bundle.min-96e9ee6a.js.map +0 -1
  36. package/dist/index-413952d9.js.map +0 -1
  37. package/dist/index-91e0322d.js.map +0 -1
  38. package/dist/markdown-1d9e6c3f.js.map +0 -1
  39. package/dist/postcss-c2592f3f.js.map +0 -1
  40. package/dist/standalone-bcc7f37a.js +0 -2649
  41. package/dist/standalone-bcc7f37a.js.map +0 -1
  42. package/dist/typescript-48c10f50.js +0 -13601
  43. package/dist/typescript-48c10f50.js.map +0 -1
@@ -1,2649 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- var Au = Object.create;
8
- var At = Object.defineProperty;
9
- var vu = Object.getOwnPropertyDescriptor;
10
- var Bu = Object.getOwnPropertyNames;
11
- var wu = Object.getPrototypeOf, _u = Object.prototype.hasOwnProperty;
12
- var dr = (e) => {
13
- throw TypeError(e);
14
- };
15
- var pr = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), vt = (e, t) => {
16
- for (var r in t)
17
- At(e, r, { get: t[r], enumerable: true });
18
- }, xu = (e, t, r, n) => {
19
- if (t && typeof t == "object" || typeof t == "function")
20
- for (let u of Bu(t))
21
- !_u.call(e, u) && u !== r && At(e, u, { get: () => t[u], enumerable: !(n = vu(t, u)) || n.enumerable });
22
- return e;
23
- };
24
- var Me = (e, t, r) => (r = e != null ? Au(wu(e)) : {}, xu(t || !e || !e.__esModule ? At(r, "default", { value: e, enumerable: true }) : r, e));
25
- var bu = (e, t, r) => t.has(e) || dr("Cannot " + r);
26
- var Fr = (e, t, r) => t.has(e) ? dr("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r);
27
- var pe = (e, t, r) => (bu(e, t, "access private method"), r);
28
- var ot = pr((Da, mn) => {
29
- var Fn = new Proxy(String, { get: () => Fn });
30
- mn.exports = Fn;
31
- });
32
- var $n = pr((ur) => {
33
- Object.defineProperty(ur, "__esModule", { value: true });
34
- function wi() {
35
- return new Proxy({}, { get: () => (e) => e });
36
- }
37
- var Wn = /\r\n|[\n\r\u2028\u2029]/;
38
- function _i(e, t, r) {
39
- let n = Object.assign({ column: 0, line: -1 }, e.start), u = Object.assign({}, n, e.end), { linesAbove: i = 2, linesBelow: o = 3 } = r || {}, s = n.line, a = n.column, D = u.line, l = u.column, p = Math.max(s - (i + 1), 0), f = Math.min(t.length, D + o);
40
- s === -1 && (p = 0), D === -1 && (f = t.length);
41
- let d = D - s, c = {};
42
- if (d)
43
- for (let F = 0; F <= d; F++) {
44
- let m = F + s;
45
- if (!a)
46
- c[m] = true;
47
- else if (F === 0) {
48
- let h = t[m - 1].length;
49
- c[m] = [a, h - a + 1];
50
- } else if (F === d)
51
- c[m] = [0, l];
52
- else {
53
- let h = t[m - F].length;
54
- c[m] = [0, h];
55
- }
56
- }
57
- else
58
- a === l ? a ? c[s] = [a, 0] : c[s] = true : c[s] = [a, l - a];
59
- return { start: p, end: f, markerLines: c };
60
- }
61
- function xi(e, t, r = {}) {
62
- let u = wi(), i = e.split(Wn), { start: o, end: s, markerLines: a } = _i(t, i, r), D = t.start && typeof t.start.column == "number", l = String(s).length, f = e.split(Wn, s).slice(o, s).map((d, c) => {
63
- let F = o + 1 + c, h = ` ${` ${F}`.slice(-l)} |`, C = a[F], v = !a[F + 1];
64
- if (C) {
65
- let E = "";
66
- if (Array.isArray(C)) {
67
- let g = d.slice(0, Math.max(C[0] - 1, 0)).replace(/[^\t]/g, " "), j = C[1] || 1;
68
- E = [`
69
- `, u.gutter(h.replace(/\d/g, " ")), " ", g, u.marker("^").repeat(j)].join(""), v && r.message && (E += " " + u.message(r.message));
70
- }
71
- return [u.marker(">"), u.gutter(h), d.length > 0 ? ` ${d}` : "", E].join("");
72
- } else
73
- return ` ${u.gutter(h)}${d.length > 0 ? ` ${d}` : ""}`;
74
- }).join(`
75
- `);
76
- return r.message && !D && (f = `${" ".repeat(l + 1)}${r.message}
77
- ${f}`), f;
78
- }
79
- ur.codeFrameColumns = xi;
80
- });
81
- var fr = {};
82
- vt(fr, { __debug: () => lo, check: () => ao, doc: () => Dr, format: () => yu, formatWithCursor: () => gu, getSupportInfo: () => Do, util: () => cr, version: () => cu });
83
- var Nu = (e, t, r, n) => {
84
- if (!(e && t == null))
85
- return t.replaceAll ? t.replaceAll(r, n) : r.global ? t.replace(r, n) : t.split(r).join(n);
86
- }, ne = Nu;
87
- function U() {
88
- }
89
- U.prototype = { diff: function(t, r) {
90
- var n, u = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = u.callback;
91
- typeof u == "function" && (i = u, u = {});
92
- var o = this;
93
- function s(E) {
94
- return E = o.postProcess(E, u), i ? (setTimeout(function() {
95
- i(E);
96
- }, 0), true) : E;
97
- }
98
- t = this.castInput(t, u), r = this.castInput(r, u), t = this.removeEmpty(this.tokenize(t, u)), r = this.removeEmpty(this.tokenize(r, u));
99
- var a = r.length, D = t.length, l = 1, p = a + D;
100
- u.maxEditLength != null && (p = Math.min(p, u.maxEditLength));
101
- var f = (n = u.timeout) !== null && n !== void 0 ? n : 1 / 0, d = Date.now() + f, c = [{ oldPos: -1, lastComponent: void 0 }], F = this.extractCommon(c[0], r, t, 0, u);
102
- if (c[0].oldPos + 1 >= D && F + 1 >= a)
103
- return s(mr(o, c[0].lastComponent, r, t, o.useLongestToken));
104
- var m = -1 / 0, h = 1 / 0;
105
- function C() {
106
- for (var E = Math.max(m, -l); E <= Math.min(h, l); E += 2) {
107
- var g = void 0, j = c[E - 1], b = c[E + 1];
108
- j && (c[E - 1] = void 0);
109
- var X = false;
110
- if (b) {
111
- var ae = b.oldPos - E;
112
- X = b && 0 <= ae && ae < a;
113
- }
114
- var $e = j && j.oldPos + 1 < D;
115
- if (!X && !$e) {
116
- c[E] = void 0;
117
- continue;
118
- }
119
- if (!$e || X && j.oldPos < b.oldPos ? g = o.addToPath(b, true, false, 0, u) : g = o.addToPath(j, false, true, 1, u), F = o.extractCommon(g, r, t, E, u), g.oldPos + 1 >= D && F + 1 >= a)
120
- return s(mr(o, g.lastComponent, r, t, o.useLongestToken));
121
- c[E] = g, g.oldPos + 1 >= D && (h = Math.min(h, E - 1)), F + 1 >= a && (m = Math.max(m, E + 1));
122
- }
123
- l++;
124
- }
125
- if (i)
126
- (function E() {
127
- setTimeout(function() {
128
- if (l > p || Date.now() > d)
129
- return i();
130
- C() || E();
131
- }, 0);
132
- })();
133
- else
134
- for (; l <= p && Date.now() <= d; ) {
135
- var v = C();
136
- if (v)
137
- return v;
138
- }
139
- }, addToPath: function(t, r, n, u, i) {
140
- var o = t.lastComponent;
141
- return o && !i.oneChangePerToken && o.added === r && o.removed === n ? { oldPos: t.oldPos + u, lastComponent: { count: o.count + 1, added: r, removed: n, previousComponent: o.previousComponent } } : { oldPos: t.oldPos + u, lastComponent: { count: 1, added: r, removed: n, previousComponent: o } };
142
- }, extractCommon: function(t, r, n, u, i) {
143
- for (var o = r.length, s = n.length, a = t.oldPos, D = a - u, l = 0; D + 1 < o && a + 1 < s && this.equals(n[a + 1], r[D + 1], i); )
144
- D++, a++, l++, i.oneChangePerToken && (t.lastComponent = { count: 1, previousComponent: t.lastComponent, added: false, removed: false });
145
- return l && !i.oneChangePerToken && (t.lastComponent = { count: l, previousComponent: t.lastComponent, added: false, removed: false }), t.oldPos = a, D;
146
- }, equals: function(t, r, n) {
147
- return n.comparator ? n.comparator(t, r) : t === r || n.ignoreCase && t.toLowerCase() === r.toLowerCase();
148
- }, removeEmpty: function(t) {
149
- for (var r = [], n = 0; n < t.length; n++)
150
- t[n] && r.push(t[n]);
151
- return r;
152
- }, castInput: function(t) {
153
- return t;
154
- }, tokenize: function(t) {
155
- return Array.from(t);
156
- }, join: function(t) {
157
- return t.join("");
158
- }, postProcess: function(t) {
159
- return t;
160
- } };
161
- function mr(e, t, r, n, u) {
162
- for (var i = [], o; t; )
163
- i.push(t), o = t.previousComponent, delete t.previousComponent, t = o;
164
- i.reverse();
165
- for (var s = 0, a = i.length, D = 0, l = 0; s < a; s++) {
166
- var p = i[s];
167
- if (p.removed)
168
- p.value = e.join(n.slice(l, l + p.count)), l += p.count;
169
- else {
170
- if (!p.added && u) {
171
- var f = r.slice(D, D + p.count);
172
- f = f.map(function(d, c) {
173
- var F = n[l + c];
174
- return F.length > d.length ? F : d;
175
- }), p.value = e.join(f);
176
- } else
177
- p.value = e.join(r.slice(D, D + p.count));
178
- D += p.count, p.added || (l += p.count);
179
- }
180
- }
181
- return i;
182
- }
183
- function hr(e, t) {
184
- var r;
185
- for (r = 0; r < e.length && r < t.length; r++)
186
- if (e[r] != t[r])
187
- return e.slice(0, r);
188
- return e.slice(0, r);
189
- }
190
- function Er(e, t) {
191
- var r;
192
- if (!e || !t || e[e.length - 1] != t[t.length - 1])
193
- return "";
194
- for (r = 0; r < e.length && r < t.length; r++)
195
- if (e[e.length - (r + 1)] != t[t.length - (r + 1)])
196
- return e.slice(-r);
197
- return e.slice(-r);
198
- }
199
- function Bt(e, t, r) {
200
- if (e.slice(0, t.length) != t)
201
- throw Error("string ".concat(JSON.stringify(e), " doesn't start with prefix ").concat(JSON.stringify(t), "; this is a bug"));
202
- return r + e.slice(t.length);
203
- }
204
- function wt(e, t, r) {
205
- if (!t)
206
- return e + r;
207
- if (e.slice(-t.length) != t)
208
- throw Error("string ".concat(JSON.stringify(e), " doesn't end with suffix ").concat(JSON.stringify(t), "; this is a bug"));
209
- return e.slice(0, -t.length) + r;
210
- }
211
- function _e(e, t) {
212
- return Bt(e, t, "");
213
- }
214
- function Ve(e, t) {
215
- return wt(e, t, "");
216
- }
217
- function Cr(e, t) {
218
- return t.slice(0, Ou(e, t));
219
- }
220
- function Ou(e, t) {
221
- var r = 0;
222
- e.length > t.length && (r = e.length - t.length);
223
- var n = t.length;
224
- e.length < t.length && (n = e.length);
225
- var u = Array(n), i = 0;
226
- u[0] = 0;
227
- for (var o = 1; o < n; o++) {
228
- for (t[o] == t[i] ? u[o] = u[i] : u[o] = i; i > 0 && t[o] != t[i]; )
229
- i = u[i];
230
- t[o] == t[i] && i++;
231
- }
232
- i = 0;
233
- for (var s = r; s < e.length; s++) {
234
- for (; i > 0 && e[s] != t[i]; )
235
- i = u[i];
236
- e[s] == t[i] && i++;
237
- }
238
- return i;
239
- }
240
- var Ue = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}", Su = new RegExp("[".concat(Ue, "]+|\\s+|[^").concat(Ue, "]"), "ug"), Ge = new U();
241
- Ge.equals = function(e, t, r) {
242
- return r.ignoreCase && (e = e.toLowerCase(), t = t.toLowerCase()), e.trim() === t.trim();
243
- };
244
- Ge.tokenize = function(e) {
245
- var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r;
246
- if (t.intlSegmenter) {
247
- if (t.intlSegmenter.resolvedOptions().granularity != "word")
248
- throw new Error('The segmenter passed must have a granularity of "word"');
249
- r = Array.from(t.intlSegmenter.segment(e), function(i) {
250
- return i.segment;
251
- });
252
- } else
253
- r = e.match(Su) || [];
254
- var n = [], u = null;
255
- return r.forEach(function(i) {
256
- /\s/.test(i) ? u == null ? n.push(i) : n.push(n.pop() + i) : /\s/.test(u) ? n[n.length - 1] == u ? n.push(n.pop() + i) : n.push(u + i) : n.push(i), u = i;
257
- }), n;
258
- };
259
- Ge.join = function(e) {
260
- return e.map(function(t, r) {
261
- return r == 0 ? t : t.replace(/^\s+/, "");
262
- }).join("");
263
- };
264
- Ge.postProcess = function(e, t) {
265
- if (!e || t.oneChangePerToken)
266
- return e;
267
- var r = null, n = null, u = null;
268
- return e.forEach(function(i) {
269
- i.added ? n = i : i.removed ? u = i : ((n || u) && gr(r, u, n, i), r = i, n = null, u = null);
270
- }), (n || u) && gr(r, u, n, null), e;
271
- };
272
- function gr(e, t, r, n) {
273
- if (t && r) {
274
- var u = t.value.match(/^\s*/)[0], i = t.value.match(/\s*$/)[0], o = r.value.match(/^\s*/)[0], s = r.value.match(/\s*$/)[0];
275
- if (e) {
276
- var a = hr(u, o);
277
- e.value = wt(e.value, o, a), t.value = _e(t.value, a), r.value = _e(r.value, a);
278
- }
279
- if (n) {
280
- var D = Er(i, s);
281
- n.value = Bt(n.value, s, D), t.value = Ve(t.value, D), r.value = Ve(r.value, D);
282
- }
283
- } else if (r)
284
- e && (r.value = r.value.replace(/^\s*/, "")), n && (n.value = n.value.replace(/^\s*/, ""));
285
- else if (e && n) {
286
- var l = n.value.match(/^\s*/)[0], p = t.value.match(/^\s*/)[0], f = t.value.match(/\s*$/)[0], d = hr(l, p);
287
- t.value = _e(t.value, d);
288
- var c = Er(_e(l, d), f);
289
- t.value = Ve(t.value, c), n.value = Bt(n.value, l, c), e.value = wt(e.value, l, l.slice(0, l.length - c.length));
290
- } else if (n) {
291
- var F = n.value.match(/^\s*/)[0], m = t.value.match(/\s*$/)[0], h = Cr(m, F);
292
- t.value = Ve(t.value, h);
293
- } else if (e) {
294
- var C = e.value.match(/\s*$/)[0], v = t.value.match(/^\s*/)[0], E = Cr(C, v);
295
- t.value = _e(t.value, E);
296
- }
297
- }
298
- var Tu = new U();
299
- Tu.tokenize = function(e) {
300
- var t = new RegExp("(\\r?\\n)|[".concat(Ue, "]+|[^\\S\\n\\r]+|[^").concat(Ue, "]"), "ug");
301
- return e.match(t) || [];
302
- };
303
- var bt = new U();
304
- bt.tokenize = function(e, t) {
305
- t.stripTrailingCr && (e = e.replace(/\r\n/g, `
306
- `));
307
- var r = [], n = e.split(/(\n|\r\n)/);
308
- n[n.length - 1] || n.pop();
309
- for (var u = 0; u < n.length; u++) {
310
- var i = n[u];
311
- u % 2 && !t.newlineIsToken ? r[r.length - 1] += i : r.push(i);
312
- }
313
- return r;
314
- };
315
- bt.equals = function(e, t, r) {
316
- return r.ignoreWhitespace ? ((!r.newlineIsToken || !e.includes(`
317
- `)) && (e = e.trim()), (!r.newlineIsToken || !t.includes(`
318
- `)) && (t = t.trim())) : r.ignoreNewlineAtEof && !r.newlineIsToken && (e.endsWith(`
319
- `) && (e = e.slice(0, -1)), t.endsWith(`
320
- `) && (t = t.slice(0, -1))), U.prototype.equals.call(this, e, t, r);
321
- };
322
- var ku = new U();
323
- ku.tokenize = function(e) {
324
- return e.split(/(\S.+?[.!?])(?=\s+|$)/);
325
- };
326
- var Lu = new U();
327
- Lu.tokenize = function(e) {
328
- return e.split(/([{}:;,]|\s+)/);
329
- };
330
- function _t(e) {
331
- "@babel/helpers - typeof";
332
- return _t = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
333
- return typeof t;
334
- } : function(t) {
335
- return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
336
- }, _t(e);
337
- }
338
- var xe = new U();
339
- xe.useLongestToken = true;
340
- xe.tokenize = bt.tokenize;
341
- xe.castInput = function(e, t) {
342
- var r = t.undefinedReplacement, n = t.stringifyReplacer, u = n === void 0 ? function(i, o) {
343
- return typeof o > "u" ? r : o;
344
- } : n;
345
- return typeof e == "string" ? e : JSON.stringify(xt(e, null, null, u), u, " ");
346
- };
347
- xe.equals = function(e, t, r) {
348
- return U.prototype.equals.call(xe, e.replace(/,([\r\n])/g, "$1"), t.replace(/,([\r\n])/g, "$1"), r);
349
- };
350
- function xt(e, t, r, n, u) {
351
- t = t || [], r = r || [], n && (e = n(u, e));
352
- var i;
353
- for (i = 0; i < t.length; i += 1)
354
- if (t[i] === e)
355
- return r[i];
356
- var o;
357
- if (Object.prototype.toString.call(e) === "[object Array]") {
358
- for (t.push(e), o = new Array(e.length), r.push(o), i = 0; i < e.length; i += 1)
359
- o[i] = xt(e[i], t, r, n, u);
360
- return t.pop(), r.pop(), o;
361
- }
362
- if (e && e.toJSON && (e = e.toJSON()), _t(e) === "object" && e !== null) {
363
- t.push(e), o = {}, r.push(o);
364
- var s = [], a;
365
- for (a in e)
366
- Object.prototype.hasOwnProperty.call(e, a) && s.push(a);
367
- for (s.sort(), i = 0; i < s.length; i += 1)
368
- a = s[i], o[a] = xt(e[a], t, r, n, a);
369
- t.pop(), r.pop();
370
- } else
371
- o = e;
372
- return o;
373
- }
374
- var ze = new U();
375
- ze.tokenize = function(e) {
376
- return e.slice();
377
- };
378
- ze.join = ze.removeEmpty = function(e) {
379
- return e;
380
- };
381
- function yr(e, t, r) {
382
- return ze.diff(e, t, r);
383
- }
384
- function Ar(e) {
385
- let t = e.indexOf("\r");
386
- return t !== -1 ? e.charAt(t + 1) === `
387
- ` ? "crlf" : "cr" : "lf";
388
- }
389
- function be(e) {
390
- switch (e) {
391
- case "cr":
392
- return "\r";
393
- case "crlf":
394
- return `\r
395
- `;
396
- default:
397
- return `
398
- `;
399
- }
400
- }
401
- function Nt(e, t) {
402
- let r;
403
- switch (t) {
404
- case `
405
- `:
406
- r = /\n/gu;
407
- break;
408
- case "\r":
409
- r = /\r/gu;
410
- break;
411
- case `\r
412
- `:
413
- r = /\r\n/gu;
414
- break;
415
- default:
416
- throw new Error(`Unexpected "eol" ${JSON.stringify(t)}.`);
417
- }
418
- let n = e.match(r);
419
- return n ? n.length : 0;
420
- }
421
- function vr(e) {
422
- return ne(false, e, /\r\n?/gu, `
423
- `);
424
- }
425
- var $ = "string", H = "array", z = "cursor", T = "indent", k = "align", L = "trim", B = "group", N = "fill", w = "if-break", P = "indent-if-break", I = "line-suffix", R = "line-suffix-boundary", y = "line", O = "label", _ = "break-parent", Ke = /* @__PURE__ */ new Set([z, T, k, L, B, N, w, P, I, R, y, O, _]);
426
- var Pu = (e, t, r) => {
427
- if (!(e && t == null))
428
- return Array.isArray(t) || typeof t == "string" ? t[r < 0 ? t.length + r : r] : t.at(r);
429
- }, A = Pu;
430
- function Iu(e) {
431
- if (typeof e == "string")
432
- return $;
433
- if (Array.isArray(e))
434
- return H;
435
- if (!e)
436
- return;
437
- let { type: t } = e;
438
- if (Ke.has(t))
439
- return t;
440
- }
441
- var M = Iu;
442
- var Ru = (e) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(e);
443
- function Yu(e) {
444
- let t = e === null ? "null" : typeof e;
445
- if (t !== "string" && t !== "object")
446
- return `Unexpected doc '${t}',
447
- Expected it to be 'string' or 'object'.`;
448
- if (M(e))
449
- throw new Error("doc is valid.");
450
- let r = Object.prototype.toString.call(e);
451
- if (r !== "[object Object]")
452
- return `Unexpected doc '${r}'.`;
453
- let n = Ru([...Ke].map((u) => `'${u}'`));
454
- return `Unexpected doc.type '${e.type}'.
455
- Expected it to be ${n}.`;
456
- }
457
- var Ot = class extends Error {
458
- constructor(t) {
459
- super(Yu(t));
460
- __publicField(this, "name", "InvalidDocError");
461
- this.doc = t;
462
- }
463
- }, Q = Ot;
464
- var Br = {};
465
- function ju(e, t, r, n) {
466
- let u = [e];
467
- for (; u.length > 0; ) {
468
- let i = u.pop();
469
- if (i === Br) {
470
- r(u.pop());
471
- continue;
472
- }
473
- r && u.push(i, Br);
474
- let o = M(i);
475
- if (!o)
476
- throw new Q(i);
477
- if ((t == null ? void 0 : t(i)) !== false)
478
- switch (o) {
479
- case H:
480
- case N: {
481
- let s = o === H ? i : i.parts;
482
- for (let a = s.length, D = a - 1; D >= 0; --D)
483
- u.push(s[D]);
484
- break;
485
- }
486
- case w:
487
- u.push(i.flatContents, i.breakContents);
488
- break;
489
- case B:
490
- if (n && i.expandedStates)
491
- for (let s = i.expandedStates.length, a = s - 1; a >= 0; --a)
492
- u.push(i.expandedStates[a]);
493
- else
494
- u.push(i.contents);
495
- break;
496
- case k:
497
- case T:
498
- case P:
499
- case O:
500
- case I:
501
- u.push(i.contents);
502
- break;
503
- case $:
504
- case z:
505
- case L:
506
- case R:
507
- case y:
508
- case _:
509
- break;
510
- default:
511
- throw new Q(i);
512
- }
513
- }
514
- }
515
- var Fe = ju;
516
- function Oe(e, t) {
517
- if (typeof e == "string")
518
- return t(e);
519
- let r = /* @__PURE__ */ new Map();
520
- return n(e);
521
- function n(i) {
522
- if (r.has(i))
523
- return r.get(i);
524
- let o = u(i);
525
- return r.set(i, o), o;
526
- }
527
- function u(i) {
528
- switch (M(i)) {
529
- case H:
530
- return t(i.map(n));
531
- case N:
532
- return t({ ...i, parts: i.parts.map(n) });
533
- case w:
534
- return t({ ...i, breakContents: n(i.breakContents), flatContents: n(i.flatContents) });
535
- case B: {
536
- let { expandedStates: o, contents: s } = i;
537
- return o ? (o = o.map(n), s = o[0]) : s = n(s), t({ ...i, contents: s, expandedStates: o });
538
- }
539
- case k:
540
- case T:
541
- case P:
542
- case O:
543
- case I:
544
- return t({ ...i, contents: n(i.contents) });
545
- case $:
546
- case z:
547
- case L:
548
- case R:
549
- case y:
550
- case _:
551
- return t(i);
552
- default:
553
- throw new Q(i);
554
- }
555
- }
556
- }
557
- function Je(e, t, r) {
558
- let n = r, u = false;
559
- function i(o) {
560
- if (u)
561
- return false;
562
- let s = t(o);
563
- s !== void 0 && (u = true, n = s);
564
- }
565
- return Fe(e, i), n;
566
- }
567
- function Hu(e) {
568
- if (e.type === B && e.break || e.type === y && e.hard || e.type === _)
569
- return true;
570
- }
571
- function xr(e) {
572
- return Je(e, Hu, false);
573
- }
574
- function wr(e) {
575
- if (e.length > 0) {
576
- let t = A(false, e, -1);
577
- !t.expandedStates && !t.break && (t.break = "propagated");
578
- }
579
- return null;
580
- }
581
- function br(e) {
582
- let t = /* @__PURE__ */ new Set(), r = [];
583
- function n(i) {
584
- if (i.type === _ && wr(r), i.type === B) {
585
- if (r.push(i), t.has(i))
586
- return false;
587
- t.add(i);
588
- }
589
- }
590
- function u(i) {
591
- i.type === B && r.pop().break && wr(r);
592
- }
593
- Fe(e, n, u, true);
594
- }
595
- function Wu(e) {
596
- return e.type === y && !e.hard ? e.soft ? "" : " " : e.type === w ? e.flatContents : e;
597
- }
598
- function Nr(e) {
599
- return Oe(e, Wu);
600
- }
601
- function _r(e) {
602
- for (e = [...e]; e.length >= 2 && A(false, e, -2).type === y && A(false, e, -1).type === _; )
603
- e.length -= 2;
604
- if (e.length > 0) {
605
- let t = Ne(A(false, e, -1));
606
- e[e.length - 1] = t;
607
- }
608
- return e;
609
- }
610
- function Ne(e) {
611
- switch (M(e)) {
612
- case T:
613
- case P:
614
- case B:
615
- case I:
616
- case O: {
617
- let t = Ne(e.contents);
618
- return { ...e, contents: t };
619
- }
620
- case w:
621
- return { ...e, breakContents: Ne(e.breakContents), flatContents: Ne(e.flatContents) };
622
- case N:
623
- return { ...e, parts: _r(e.parts) };
624
- case H:
625
- return _r(e);
626
- case $:
627
- return e.replace(/[\n\r]*$/u, "");
628
- case k:
629
- case z:
630
- case L:
631
- case R:
632
- case y:
633
- case _:
634
- break;
635
- default:
636
- throw new Q(e);
637
- }
638
- return e;
639
- }
640
- function qe(e) {
641
- return Ne(Mu(e));
642
- }
643
- function $u(e) {
644
- switch (M(e)) {
645
- case N:
646
- if (e.parts.every((t) => t === ""))
647
- return "";
648
- break;
649
- case B:
650
- if (!e.contents && !e.id && !e.break && !e.expandedStates)
651
- return "";
652
- if (e.contents.type === B && e.contents.id === e.id && e.contents.break === e.break && e.contents.expandedStates === e.expandedStates)
653
- return e.contents;
654
- break;
655
- case k:
656
- case T:
657
- case P:
658
- case I:
659
- if (!e.contents)
660
- return "";
661
- break;
662
- case w:
663
- if (!e.flatContents && !e.breakContents)
664
- return "";
665
- break;
666
- case H: {
667
- let t = [];
668
- for (let r of e) {
669
- if (!r)
670
- continue;
671
- let [n, ...u] = Array.isArray(r) ? r : [r];
672
- typeof n == "string" && typeof A(false, t, -1) == "string" ? t[t.length - 1] += n : t.push(n), t.push(...u);
673
- }
674
- return t.length === 0 ? "" : t.length === 1 ? t[0] : t;
675
- }
676
- case $:
677
- case z:
678
- case L:
679
- case R:
680
- case y:
681
- case O:
682
- case _:
683
- break;
684
- default:
685
- throw new Q(e);
686
- }
687
- return e;
688
- }
689
- function Mu(e) {
690
- return Oe(e, (t) => $u(t));
691
- }
692
- function Or(e, t = Xe) {
693
- return Oe(e, (r) => typeof r == "string" ? Se(t, r.split(`
694
- `)) : r);
695
- }
696
- function Vu(e) {
697
- if (e.type === y)
698
- return true;
699
- }
700
- function Sr(e) {
701
- return Je(e, Vu, false);
702
- }
703
- function me(e, t) {
704
- return e.type === O ? { ...e, contents: t(e.contents) } : t(e);
705
- }
706
- var St = () => {
707
- }, Tt = St;
708
- function le(e) {
709
- return { type: T, contents: e };
710
- }
711
- function De(e, t) {
712
- return { type: k, contents: t, n: e };
713
- }
714
- function kt(e, t = {}) {
715
- return Tt(t.expandedStates), { type: B, id: t.id, contents: e, break: !!t.shouldBreak, expandedStates: t.expandedStates };
716
- }
717
- function kr(e) {
718
- return De(Number.NEGATIVE_INFINITY, e);
719
- }
720
- function Lr(e) {
721
- return De({ type: "root" }, e);
722
- }
723
- function Pr(e) {
724
- return De(-1, e);
725
- }
726
- function Ir(e, t) {
727
- return kt(e[0], { ...t, expandedStates: e });
728
- }
729
- function Rr(e) {
730
- return { type: N, parts: e };
731
- }
732
- function Yr(e, t = "", r = {}) {
733
- return { type: w, breakContents: e, flatContents: t, groupId: r.groupId };
734
- }
735
- function jr(e, t) {
736
- return { type: P, contents: e, groupId: t.groupId, negate: t.negate };
737
- }
738
- function Te(e) {
739
- return { type: I, contents: e };
740
- }
741
- var Hr = { type: R }, he = { type: _ }, Wr = { type: L }, ke = { type: y, hard: true }, Lt = { type: y, hard: true, literal: true }, Qe = { type: y }, $r = { type: y, soft: true }, K = [ke, he], Xe = [Lt, he], Z = { type: z };
742
- function Se(e, t) {
743
- let r = [];
744
- for (let n = 0; n < t.length; n++)
745
- n !== 0 && r.push(e), r.push(t[n]);
746
- return r;
747
- }
748
- function Ze(e, t, r) {
749
- let n = e;
750
- if (t > 0) {
751
- for (let u = 0; u < Math.floor(t / r); ++u)
752
- n = le(n);
753
- n = De(t % r, n), n = De(Number.NEGATIVE_INFINITY, n);
754
- }
755
- return n;
756
- }
757
- function Mr(e, t) {
758
- return e ? { type: O, label: e, contents: t } : t;
759
- }
760
- function ee(e) {
761
- var t;
762
- if (!e)
763
- return "";
764
- if (Array.isArray(e)) {
765
- let r = [];
766
- for (let n of e)
767
- if (Array.isArray(n))
768
- r.push(...ee(n));
769
- else {
770
- let u = ee(n);
771
- u !== "" && r.push(u);
772
- }
773
- return r;
774
- }
775
- return e.type === w ? { ...e, breakContents: ee(e.breakContents), flatContents: ee(e.flatContents) } : e.type === B ? { ...e, contents: ee(e.contents), expandedStates: (t = e.expandedStates) == null ? void 0 : t.map(ee) } : e.type === N ? { type: "fill", parts: e.parts.map(ee) } : e.contents ? { ...e, contents: ee(e.contents) } : e;
776
- }
777
- function Vr(e) {
778
- let t = /* @__PURE__ */ Object.create(null), r = /* @__PURE__ */ new Set();
779
- return n(ee(e));
780
- function n(i, o, s) {
781
- var a, D;
782
- if (typeof i == "string")
783
- return JSON.stringify(i);
784
- if (Array.isArray(i)) {
785
- let l = i.map(n).filter(Boolean);
786
- return l.length === 1 ? l[0] : `[${l.join(", ")}]`;
787
- }
788
- if (i.type === y) {
789
- let l = ((a = s == null ? void 0 : s[o + 1]) == null ? void 0 : a.type) === _;
790
- return i.literal ? l ? "literalline" : "literallineWithoutBreakParent" : i.hard ? l ? "hardline" : "hardlineWithoutBreakParent" : i.soft ? "softline" : "line";
791
- }
792
- if (i.type === _)
793
- return ((D = s == null ? void 0 : s[o - 1]) == null ? void 0 : D.type) === y && s[o - 1].hard ? void 0 : "breakParent";
794
- if (i.type === L)
795
- return "trim";
796
- if (i.type === T)
797
- return "indent(" + n(i.contents) + ")";
798
- if (i.type === k)
799
- return i.n === Number.NEGATIVE_INFINITY ? "dedentToRoot(" + n(i.contents) + ")" : i.n < 0 ? "dedent(" + n(i.contents) + ")" : i.n.type === "root" ? "markAsRoot(" + n(i.contents) + ")" : "align(" + JSON.stringify(i.n) + ", " + n(i.contents) + ")";
800
- if (i.type === w)
801
- return "ifBreak(" + n(i.breakContents) + (i.flatContents ? ", " + n(i.flatContents) : "") + (i.groupId ? (i.flatContents ? "" : ', ""') + `, { groupId: ${u(i.groupId)} }` : "") + ")";
802
- if (i.type === P) {
803
- let l = [];
804
- i.negate && l.push("negate: true"), i.groupId && l.push(`groupId: ${u(i.groupId)}`);
805
- let p = l.length > 0 ? `, { ${l.join(", ")} }` : "";
806
- return `indentIfBreak(${n(i.contents)}${p})`;
807
- }
808
- if (i.type === B) {
809
- let l = [];
810
- i.break && i.break !== "propagated" && l.push("shouldBreak: true"), i.id && l.push(`id: ${u(i.id)}`);
811
- let p = l.length > 0 ? `, { ${l.join(", ")} }` : "";
812
- return i.expandedStates ? `conditionalGroup([${i.expandedStates.map((f) => n(f)).join(",")}]${p})` : `group(${n(i.contents)}${p})`;
813
- }
814
- if (i.type === N)
815
- return `fill([${i.parts.map((l) => n(l)).join(", ")}])`;
816
- if (i.type === I)
817
- return "lineSuffix(" + n(i.contents) + ")";
818
- if (i.type === R)
819
- return "lineSuffixBoundary";
820
- if (i.type === O)
821
- return `label(${JSON.stringify(i.label)}, ${n(i.contents)})`;
822
- throw new Error("Unknown doc type " + i.type);
823
- }
824
- function u(i) {
825
- if (typeof i != "symbol")
826
- return JSON.stringify(String(i));
827
- if (i in t)
828
- return t[i];
829
- let o = i.description || "symbol";
830
- for (let s = 0; ; s++) {
831
- let a = o + (s > 0 ? ` #${s}` : "");
832
- if (!r.has(a))
833
- return r.add(a), t[i] = `Symbol.for(${JSON.stringify(a)})`;
834
- }
835
- }
836
- }
837
- var Ur = () => /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
838
- function zr(e) {
839
- return e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
840
- }
841
- function Gr(e) {
842
- return e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9776 && e <= 9783 || e >= 9800 && e <= 9811 || e === 9855 || e >= 9866 && e <= 9871 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12773 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101631 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e >= 119552 && e <= 119638 || e >= 119648 && e <= 119670 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129673 || e >= 129679 && e <= 129734 || e >= 129742 && e <= 129756 || e >= 129759 && e <= 129769 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
843
- }
844
- var Kr = (e) => !(zr(e) || Gr(e));
845
- var Uu = /[^\x20-\x7F]/u;
846
- function zu(e) {
847
- if (!e)
848
- return 0;
849
- if (!Uu.test(e))
850
- return e.length;
851
- e = e.replace(Ur(), " ");
852
- let t = 0;
853
- for (let r of e) {
854
- let n = r.codePointAt(0);
855
- n <= 31 || n >= 127 && n <= 159 || n >= 768 && n <= 879 || (t += Kr(n) ? 1 : 2);
856
- }
857
- return t;
858
- }
859
- var Le = zu;
860
- var Y = Symbol("MODE_BREAK"), J = Symbol("MODE_FLAT"), Ee = Symbol("cursor"), Pt = Symbol("DOC_FILL_PRINTED_LENGTH");
861
- function Jr() {
862
- return { value: "", length: 0, queue: [] };
863
- }
864
- function Gu(e, t) {
865
- return It(e, { type: "indent" }, t);
866
- }
867
- function Ku(e, t, r) {
868
- return t === Number.NEGATIVE_INFINITY ? e.root || Jr() : t < 0 ? It(e, { type: "dedent" }, r) : t ? t.type === "root" ? { ...e, root: e } : It(e, { type: typeof t == "string" ? "stringAlign" : "numberAlign", n: t }, r) : e;
869
- }
870
- function It(e, t, r) {
871
- let n = t.type === "dedent" ? e.queue.slice(0, -1) : [...e.queue, t], u = "", i = 0, o = 0, s = 0;
872
- for (let c of n)
873
- switch (c.type) {
874
- case "indent":
875
- l(), r.useTabs ? a(1) : D(r.tabWidth);
876
- break;
877
- case "stringAlign":
878
- l(), u += c.n, i += c.n.length;
879
- break;
880
- case "numberAlign":
881
- o += 1, s += c.n;
882
- break;
883
- default:
884
- throw new Error(`Unexpected type '${c.type}'`);
885
- }
886
- return f(), { ...e, value: u, length: i, queue: n };
887
- function a(c) {
888
- u += " ".repeat(c), i += r.tabWidth * c;
889
- }
890
- function D(c) {
891
- u += " ".repeat(c), i += c;
892
- }
893
- function l() {
894
- r.useTabs ? p() : f();
895
- }
896
- function p() {
897
- o > 0 && a(o), d();
898
- }
899
- function f() {
900
- s > 0 && D(s), d();
901
- }
902
- function d() {
903
- o = 0, s = 0;
904
- }
905
- }
906
- function Rt(e) {
907
- let t = 0, r = 0, n = e.length;
908
- e:
909
- for (; n--; ) {
910
- let u = e[n];
911
- if (u === Ee) {
912
- r++;
913
- continue;
914
- }
915
- for (let i = u.length - 1; i >= 0; i--) {
916
- let o = u[i];
917
- if (o === " " || o === " ")
918
- t++;
919
- else {
920
- e[n] = u.slice(0, i + 1);
921
- break e;
922
- }
923
- }
924
- }
925
- if (t > 0 || r > 0)
926
- for (e.length = n + 1; r-- > 0; )
927
- e.push(Ee);
928
- return t;
929
- }
930
- function et(e, t, r, n, u, i) {
931
- if (r === Number.POSITIVE_INFINITY)
932
- return true;
933
- let o = t.length, s = [e], a = [];
934
- for (; r >= 0; ) {
935
- if (s.length === 0) {
936
- if (o === 0)
937
- return true;
938
- s.push(t[--o]);
939
- continue;
940
- }
941
- let { mode: D, doc: l } = s.pop(), p = M(l);
942
- switch (p) {
943
- case $:
944
- a.push(l), r -= Le(l);
945
- break;
946
- case H:
947
- case N: {
948
- let f = p === H ? l : l.parts, d = l[Pt] ?? 0;
949
- for (let c = f.length - 1; c >= d; c--)
950
- s.push({ mode: D, doc: f[c] });
951
- break;
952
- }
953
- case T:
954
- case k:
955
- case P:
956
- case O:
957
- s.push({ mode: D, doc: l.contents });
958
- break;
959
- case L:
960
- r += Rt(a);
961
- break;
962
- case B: {
963
- if (i && l.break)
964
- return false;
965
- let f = l.break ? Y : D, d = l.expandedStates && f === Y ? A(false, l.expandedStates, -1) : l.contents;
966
- s.push({ mode: f, doc: d });
967
- break;
968
- }
969
- case w: {
970
- let d = (l.groupId ? u[l.groupId] || J : D) === Y ? l.breakContents : l.flatContents;
971
- d && s.push({ mode: D, doc: d });
972
- break;
973
- }
974
- case y:
975
- if (D === Y || l.hard)
976
- return true;
977
- l.soft || (a.push(" "), r--);
978
- break;
979
- case I:
980
- n = true;
981
- break;
982
- case R:
983
- if (n)
984
- return false;
985
- break;
986
- }
987
- }
988
- return false;
989
- }
990
- function Ce(e, t) {
991
- let r = {}, n = t.printWidth, u = be(t.endOfLine), i = 0, o = [{ ind: Jr(), mode: Y, doc: e }], s = [], a = false, D = [], l = 0;
992
- for (br(e); o.length > 0; ) {
993
- let { ind: f, mode: d, doc: c } = o.pop();
994
- switch (M(c)) {
995
- case $: {
996
- let F = u !== `
997
- ` ? ne(false, c, `
998
- `, u) : c;
999
- s.push(F), o.length > 0 && (i += Le(F));
1000
- break;
1001
- }
1002
- case H:
1003
- for (let F = c.length - 1; F >= 0; F--)
1004
- o.push({ ind: f, mode: d, doc: c[F] });
1005
- break;
1006
- case z:
1007
- if (l >= 2)
1008
- throw new Error("There are too many 'cursor' in doc.");
1009
- s.push(Ee), l++;
1010
- break;
1011
- case T:
1012
- o.push({ ind: Gu(f, t), mode: d, doc: c.contents });
1013
- break;
1014
- case k:
1015
- o.push({ ind: Ku(f, c.n, t), mode: d, doc: c.contents });
1016
- break;
1017
- case L:
1018
- i -= Rt(s);
1019
- break;
1020
- case B:
1021
- switch (d) {
1022
- case J:
1023
- if (!a) {
1024
- o.push({ ind: f, mode: c.break ? Y : J, doc: c.contents });
1025
- break;
1026
- }
1027
- case Y: {
1028
- a = false;
1029
- let F = { ind: f, mode: J, doc: c.contents }, m = n - i, h = D.length > 0;
1030
- if (!c.break && et(F, o, m, h, r))
1031
- o.push(F);
1032
- else if (c.expandedStates) {
1033
- let C = A(false, c.expandedStates, -1);
1034
- if (c.break) {
1035
- o.push({ ind: f, mode: Y, doc: C });
1036
- break;
1037
- } else
1038
- for (let v = 1; v < c.expandedStates.length + 1; v++)
1039
- if (v >= c.expandedStates.length) {
1040
- o.push({ ind: f, mode: Y, doc: C });
1041
- break;
1042
- } else {
1043
- let E = c.expandedStates[v], g = { ind: f, mode: J, doc: E };
1044
- if (et(g, o, m, h, r)) {
1045
- o.push(g);
1046
- break;
1047
- }
1048
- }
1049
- } else
1050
- o.push({ ind: f, mode: Y, doc: c.contents });
1051
- break;
1052
- }
1053
- }
1054
- c.id && (r[c.id] = A(false, o, -1).mode);
1055
- break;
1056
- case N: {
1057
- let F = n - i, m = c[Pt] ?? 0, { parts: h } = c, C = h.length - m;
1058
- if (C === 0)
1059
- break;
1060
- let v = h[m + 0], E = h[m + 1], g = { ind: f, mode: J, doc: v }, j = { ind: f, mode: Y, doc: v }, b = et(g, [], F, D.length > 0, r, true);
1061
- if (C === 1) {
1062
- b ? o.push(g) : o.push(j);
1063
- break;
1064
- }
1065
- let X = { ind: f, mode: J, doc: E }, ae = { ind: f, mode: Y, doc: E };
1066
- if (C === 2) {
1067
- b ? o.push(X, g) : o.push(ae, j);
1068
- break;
1069
- }
1070
- let $e = h[m + 2], yt = { ind: f, mode: d, doc: { ...c, [Pt]: m + 2 } };
1071
- et({ ind: f, mode: J, doc: [v, E, $e] }, [], F, D.length > 0, r, true) ? o.push(yt, X, g) : b ? o.push(yt, ae, g) : o.push(yt, ae, j);
1072
- break;
1073
- }
1074
- case w:
1075
- case P: {
1076
- let F = c.groupId ? r[c.groupId] : d;
1077
- if (F === Y) {
1078
- let m = c.type === w ? c.breakContents : c.negate ? c.contents : le(c.contents);
1079
- m && o.push({ ind: f, mode: d, doc: m });
1080
- }
1081
- if (F === J) {
1082
- let m = c.type === w ? c.flatContents : c.negate ? le(c.contents) : c.contents;
1083
- m && o.push({ ind: f, mode: d, doc: m });
1084
- }
1085
- break;
1086
- }
1087
- case I:
1088
- D.push({ ind: f, mode: d, doc: c.contents });
1089
- break;
1090
- case R:
1091
- D.length > 0 && o.push({ ind: f, mode: d, doc: ke });
1092
- break;
1093
- case y:
1094
- switch (d) {
1095
- case J:
1096
- if (c.hard)
1097
- a = true;
1098
- else {
1099
- c.soft || (s.push(" "), i += 1);
1100
- break;
1101
- }
1102
- case Y:
1103
- if (D.length > 0) {
1104
- o.push({ ind: f, mode: d, doc: c }, ...D.reverse()), D.length = 0;
1105
- break;
1106
- }
1107
- c.literal ? f.root ? (s.push(u, f.root.value), i = f.root.length) : (s.push(u), i = 0) : (i -= Rt(s), s.push(u + f.value), i = f.length);
1108
- break;
1109
- }
1110
- break;
1111
- case O:
1112
- o.push({ ind: f, mode: d, doc: c.contents });
1113
- break;
1114
- case _:
1115
- break;
1116
- default:
1117
- throw new Q(c);
1118
- }
1119
- o.length === 0 && D.length > 0 && (o.push(...D.reverse()), D.length = 0);
1120
- }
1121
- let p = s.indexOf(Ee);
1122
- if (p !== -1) {
1123
- let f = s.indexOf(Ee, p + 1);
1124
- if (f === -1)
1125
- return { formatted: s.filter((m) => m !== Ee).join("") };
1126
- let d = s.slice(0, p).join(""), c = s.slice(p + 1, f).join(""), F = s.slice(f + 1).join("");
1127
- return { formatted: d + c + F, cursorNodeStart: d.length, cursorNodeText: c };
1128
- }
1129
- return { formatted: s.join("") };
1130
- }
1131
- function Ju(e, t, r = 0) {
1132
- let n = 0;
1133
- for (let u = r; u < e.length; ++u)
1134
- e[u] === " " ? n = n + t - n % t : n++;
1135
- return n;
1136
- }
1137
- var ge = Ju;
1138
- var te, jt, tt, Yt = class {
1139
- constructor(t) {
1140
- Fr(this, te);
1141
- this.stack = [t];
1142
- }
1143
- get key() {
1144
- let { stack: t, siblings: r } = this;
1145
- return A(false, t, r === null ? -2 : -4) ?? null;
1146
- }
1147
- get index() {
1148
- return this.siblings === null ? null : A(false, this.stack, -2);
1149
- }
1150
- get node() {
1151
- return A(false, this.stack, -1);
1152
- }
1153
- get parent() {
1154
- return this.getNode(1);
1155
- }
1156
- get grandparent() {
1157
- return this.getNode(2);
1158
- }
1159
- get isInArray() {
1160
- return this.siblings !== null;
1161
- }
1162
- get siblings() {
1163
- let { stack: t } = this, r = A(false, t, -3);
1164
- return Array.isArray(r) ? r : null;
1165
- }
1166
- get next() {
1167
- let { siblings: t } = this;
1168
- return t === null ? null : t[this.index + 1];
1169
- }
1170
- get previous() {
1171
- let { siblings: t } = this;
1172
- return t === null ? null : t[this.index - 1];
1173
- }
1174
- get isFirst() {
1175
- return this.index === 0;
1176
- }
1177
- get isLast() {
1178
- let { siblings: t, index: r } = this;
1179
- return t !== null && r === t.length - 1;
1180
- }
1181
- get isRoot() {
1182
- return this.stack.length === 1;
1183
- }
1184
- get root() {
1185
- return this.stack[0];
1186
- }
1187
- get ancestors() {
1188
- return [...pe(this, te, tt).call(this)];
1189
- }
1190
- getName() {
1191
- let { stack: t } = this, { length: r } = t;
1192
- return r > 1 ? A(false, t, -2) : null;
1193
- }
1194
- getValue() {
1195
- return A(false, this.stack, -1);
1196
- }
1197
- getNode(t = 0) {
1198
- let r = pe(this, te, jt).call(this, t);
1199
- return r === -1 ? null : this.stack[r];
1200
- }
1201
- getParentNode(t = 0) {
1202
- return this.getNode(t + 1);
1203
- }
1204
- call(t, ...r) {
1205
- let { stack: n } = this, { length: u } = n, i = A(false, n, -1);
1206
- for (let o of r)
1207
- i = i[o], n.push(o, i);
1208
- try {
1209
- return t(this);
1210
- } finally {
1211
- n.length = u;
1212
- }
1213
- }
1214
- callParent(t, r = 0) {
1215
- let n = pe(this, te, jt).call(this, r + 1), u = this.stack.splice(n + 1);
1216
- try {
1217
- return t(this);
1218
- } finally {
1219
- this.stack.push(...u);
1220
- }
1221
- }
1222
- each(t, ...r) {
1223
- let { stack: n } = this, { length: u } = n, i = A(false, n, -1);
1224
- for (let o of r)
1225
- i = i[o], n.push(o, i);
1226
- try {
1227
- for (let o = 0; o < i.length; ++o)
1228
- n.push(o, i[o]), t(this, o, i), n.length -= 2;
1229
- } finally {
1230
- n.length = u;
1231
- }
1232
- }
1233
- map(t, ...r) {
1234
- let n = [];
1235
- return this.each((u, i, o) => {
1236
- n[i] = t(u, i, o);
1237
- }, ...r), n;
1238
- }
1239
- match(...t) {
1240
- let r = this.stack.length - 1, n = null, u = this.stack[r--];
1241
- for (let i of t) {
1242
- if (u === void 0)
1243
- return false;
1244
- let o = null;
1245
- if (typeof n == "number" && (o = n, n = this.stack[r--], u = this.stack[r--]), i && !i(u, n, o))
1246
- return false;
1247
- n = this.stack[r--], u = this.stack[r--];
1248
- }
1249
- return true;
1250
- }
1251
- findAncestor(t) {
1252
- for (let r of pe(this, te, tt).call(this))
1253
- if (t(r))
1254
- return r;
1255
- }
1256
- hasAncestor(t) {
1257
- for (let r of pe(this, te, tt).call(this))
1258
- if (t(r))
1259
- return true;
1260
- return false;
1261
- }
1262
- };
1263
- te = /* @__PURE__ */ new WeakSet(), jt = function(t) {
1264
- let { stack: r } = this;
1265
- for (let n = r.length - 1; n >= 0; n -= 2)
1266
- if (!Array.isArray(r[n]) && --t < 0)
1267
- return n;
1268
- return -1;
1269
- }, tt = function* () {
1270
- let { stack: t } = this;
1271
- for (let r = t.length - 3; r >= 0; r -= 2) {
1272
- let n = t[r];
1273
- Array.isArray(n) || (yield n);
1274
- }
1275
- };
1276
- var qr = Yt;
1277
- var Xr = new Proxy(() => {
1278
- }, { get: () => Xr }), Pe = Xr;
1279
- function qu(e) {
1280
- return e !== null && typeof e == "object";
1281
- }
1282
- var Qr = qu;
1283
- function* ye(e, t) {
1284
- let { getVisitorKeys: r, filter: n = () => true } = t, u = (i) => Qr(i) && n(i);
1285
- for (let i of r(e)) {
1286
- let o = e[i];
1287
- if (Array.isArray(o))
1288
- for (let s of o)
1289
- u(s) && (yield s);
1290
- else
1291
- u(o) && (yield o);
1292
- }
1293
- }
1294
- function* Zr(e, t) {
1295
- let r = [e];
1296
- for (let n = 0; n < r.length; n++) {
1297
- let u = r[n];
1298
- for (let i of ye(u, t))
1299
- yield i, r.push(i);
1300
- }
1301
- }
1302
- function en(e, t) {
1303
- return ye(e, t).next().done;
1304
- }
1305
- function Ae(e) {
1306
- return (t, r, n) => {
1307
- let u = !!(n != null && n.backwards);
1308
- if (r === false)
1309
- return false;
1310
- let { length: i } = t, o = r;
1311
- for (; o >= 0 && o < i; ) {
1312
- let s = t.charAt(o);
1313
- if (e instanceof RegExp) {
1314
- if (!e.test(s))
1315
- return o;
1316
- } else if (!e.includes(s))
1317
- return o;
1318
- u ? o-- : o++;
1319
- }
1320
- return o === -1 || o === i ? o : false;
1321
- };
1322
- }
1323
- var tn = Ae(/\s/u), S = Ae(" "), rt = Ae(",; "), nt = Ae(/[^\n\r]/u);
1324
- function Xu(e, t, r) {
1325
- let n = !!(r != null && r.backwards);
1326
- if (t === false)
1327
- return false;
1328
- let u = e.charAt(t);
1329
- if (n) {
1330
- if (e.charAt(t - 1) === "\r" && u === `
1331
- `)
1332
- return t - 2;
1333
- if (u === `
1334
- ` || u === "\r" || u === "\u2028" || u === "\u2029")
1335
- return t - 1;
1336
- } else {
1337
- if (u === "\r" && e.charAt(t + 1) === `
1338
- `)
1339
- return t + 2;
1340
- if (u === `
1341
- ` || u === "\r" || u === "\u2028" || u === "\u2029")
1342
- return t + 1;
1343
- }
1344
- return t;
1345
- }
1346
- var W = Xu;
1347
- function Qu(e, t, r = {}) {
1348
- let n = S(e, r.backwards ? t - 1 : t, r), u = W(e, n, r);
1349
- return n !== u;
1350
- }
1351
- var V = Qu;
1352
- function Zu(e) {
1353
- return Array.isArray(e) && e.length > 0;
1354
- }
1355
- var Ht = Zu;
1356
- var rn = /* @__PURE__ */ new Set(["tokens", "comments", "parent", "enclosingNode", "precedingNode", "followingNode"]), ei = (e) => Object.keys(e).filter((t) => !rn.has(t));
1357
- function ti(e) {
1358
- return e ? (t) => e(t, rn) : ei;
1359
- }
1360
- var q = ti;
1361
- function ri(e) {
1362
- let t = e.type || e.kind || "(unknown type)", r = String(e.name || e.id && (typeof e.id == "object" ? e.id.name : e.id) || e.key && (typeof e.key == "object" ? e.key.name : e.key) || e.value && (typeof e.value == "object" ? "" : String(e.value)) || e.operator || "");
1363
- return r.length > 20 && (r = r.slice(0, 19) + "…"), t + (r ? " " + r : "");
1364
- }
1365
- function Wt(e, t) {
1366
- (e.comments ?? (e.comments = [])).push(t), t.printed = false, t.nodeDescription = ri(e);
1367
- }
1368
- function ue(e, t) {
1369
- t.leading = true, t.trailing = false, Wt(e, t);
1370
- }
1371
- function re(e, t, r) {
1372
- t.leading = false, t.trailing = false, r && (t.marker = r), Wt(e, t);
1373
- }
1374
- function ie(e, t) {
1375
- t.leading = false, t.trailing = true, Wt(e, t);
1376
- }
1377
- var $t = /* @__PURE__ */ new WeakMap();
1378
- function ut(e, t) {
1379
- if ($t.has(e))
1380
- return $t.get(e);
1381
- let { printer: { getCommentChildNodes: r, canAttachComment: n, getVisitorKeys: u }, locStart: i, locEnd: o } = t;
1382
- if (!n)
1383
- return [];
1384
- let s = ((r == null ? void 0 : r(e, t)) ?? [...ye(e, { getVisitorKeys: q(u) })]).flatMap((a) => n(a) ? [a] : ut(a, t));
1385
- return s.sort((a, D) => i(a) - i(D) || o(a) - o(D)), $t.set(e, s), s;
1386
- }
1387
- function un(e, t, r, n) {
1388
- let { locStart: u, locEnd: i } = r, o = u(t), s = i(t), a = ut(e, r), D, l, p = 0, f = a.length;
1389
- for (; p < f; ) {
1390
- let d = p + f >> 1, c = a[d], F = u(c), m = i(c);
1391
- if (F <= o && s <= m)
1392
- return un(c, t, r, c);
1393
- if (m <= o) {
1394
- D = c, p = d + 1;
1395
- continue;
1396
- }
1397
- if (s <= F) {
1398
- l = c, f = d;
1399
- continue;
1400
- }
1401
- throw new Error("Comment location overlaps with node location");
1402
- }
1403
- if ((n == null ? void 0 : n.type) === "TemplateLiteral") {
1404
- let { quasis: d } = n, c = Vt(d, t, r);
1405
- D && Vt(d, D, r) !== c && (D = null), l && Vt(d, l, r) !== c && (l = null);
1406
- }
1407
- return { enclosingNode: n, precedingNode: D, followingNode: l };
1408
- }
1409
- var Mt = () => false;
1410
- function on(e, t) {
1411
- let { comments: r } = e;
1412
- if (delete e.comments, !Ht(r) || !t.printer.canAttachComment)
1413
- return;
1414
- let n = [], { locStart: u, locEnd: i, printer: { experimentalFeatures: { avoidAstMutation: o = false } = {}, handleComments: s = {} }, originalText: a } = t, { ownLine: D = Mt, endOfLine: l = Mt, remaining: p = Mt } = s, f = r.map((d, c) => ({ ...un(e, d, t), comment: d, text: a, options: t, ast: e, isLastComment: r.length - 1 === c }));
1415
- for (let [d, c] of f.entries()) {
1416
- let { comment: F, precedingNode: m, enclosingNode: h, followingNode: C, text: v, options: E, ast: g, isLastComment: j } = c;
1417
- if (E.parser === "json" || E.parser === "json5" || E.parser === "jsonc" || E.parser === "__js_expression" || E.parser === "__ts_expression" || E.parser === "__vue_expression" || E.parser === "__vue_ts_expression") {
1418
- if (u(F) - u(g) <= 0) {
1419
- ue(g, F);
1420
- continue;
1421
- }
1422
- if (i(F) - i(g) >= 0) {
1423
- ie(g, F);
1424
- continue;
1425
- }
1426
- }
1427
- let b;
1428
- if (o ? b = [c] : (F.enclosingNode = h, F.precedingNode = m, F.followingNode = C, b = [F, v, E, g, j]), ni(v, E, f, d))
1429
- F.placement = "ownLine", D(...b) || (C ? ue(C, F) : m ? ie(m, F) : h ? re(h, F) : re(g, F));
1430
- else if (ui(v, E, f, d))
1431
- F.placement = "endOfLine", l(...b) || (m ? ie(m, F) : C ? ue(C, F) : h ? re(h, F) : re(g, F));
1432
- else if (F.placement = "remaining", !p(...b))
1433
- if (m && C) {
1434
- let X = n.length;
1435
- X > 0 && n[X - 1].followingNode !== C && nn(n, E), n.push(c);
1436
- } else
1437
- m ? ie(m, F) : C ? ue(C, F) : h ? re(h, F) : re(g, F);
1438
- }
1439
- if (nn(n, t), !o)
1440
- for (let d of r)
1441
- delete d.precedingNode, delete d.enclosingNode, delete d.followingNode;
1442
- }
1443
- var sn = (e) => !/[\S\n\u2028\u2029]/u.test(e);
1444
- function ni(e, t, r, n) {
1445
- let { comment: u, precedingNode: i } = r[n], { locStart: o, locEnd: s } = t, a = o(u);
1446
- if (i)
1447
- for (let D = n - 1; D >= 0; D--) {
1448
- let { comment: l, precedingNode: p } = r[D];
1449
- if (p !== i || !sn(e.slice(s(l), a)))
1450
- break;
1451
- a = o(l);
1452
- }
1453
- return V(e, a, { backwards: true });
1454
- }
1455
- function ui(e, t, r, n) {
1456
- let { comment: u, followingNode: i } = r[n], { locStart: o, locEnd: s } = t, a = s(u);
1457
- if (i)
1458
- for (let D = n + 1; D < r.length; D++) {
1459
- let { comment: l, followingNode: p } = r[D];
1460
- if (p !== i || !sn(e.slice(a, o(l))))
1461
- break;
1462
- a = s(l);
1463
- }
1464
- return V(e, a);
1465
- }
1466
- function nn(e, t) {
1467
- var s, a;
1468
- let r = e.length;
1469
- if (r === 0)
1470
- return;
1471
- let { precedingNode: n, followingNode: u } = e[0], i = t.locStart(u), o;
1472
- for (o = r; o > 0; --o) {
1473
- let { comment: D, precedingNode: l, followingNode: p } = e[o - 1];
1474
- Pe.strictEqual(l, n), Pe.strictEqual(p, u);
1475
- let f = t.originalText.slice(t.locEnd(D), i);
1476
- if (((a = (s = t.printer).isGap) == null ? void 0 : a.call(s, f, t)) ?? /^[\s(]*$/u.test(f))
1477
- i = t.locStart(D);
1478
- else
1479
- break;
1480
- }
1481
- for (let [D, { comment: l }] of e.entries())
1482
- D < o ? ie(n, l) : ue(u, l);
1483
- for (let D of [n, u])
1484
- D.comments && D.comments.length > 1 && D.comments.sort((l, p) => t.locStart(l) - t.locStart(p));
1485
- e.length = 0;
1486
- }
1487
- function Vt(e, t, r) {
1488
- let n = r.locStart(t) - 1;
1489
- for (let u = 1; u < e.length; ++u)
1490
- if (n < r.locStart(e[u]))
1491
- return u - 1;
1492
- return 0;
1493
- }
1494
- function ii(e, t) {
1495
- let r = t - 1;
1496
- r = S(e, r, { backwards: true }), r = W(e, r, { backwards: true }), r = S(e, r, { backwards: true });
1497
- let n = W(e, r, { backwards: true });
1498
- return r !== n;
1499
- }
1500
- var Ie = ii;
1501
- function an(e, t) {
1502
- let r = e.node;
1503
- return r.printed = true, t.printer.printComment(e, t);
1504
- }
1505
- function oi(e, t) {
1506
- var l;
1507
- let r = e.node, n = [an(e, t)], { printer: u, originalText: i, locStart: o, locEnd: s } = t;
1508
- if ((l = u.isBlockComment) == null ? void 0 : l.call(u, r)) {
1509
- let p = V(i, s(r)) ? V(i, o(r), { backwards: true }) ? K : Qe : " ";
1510
- n.push(p);
1511
- } else
1512
- n.push(K);
1513
- let D = W(i, S(i, s(r)));
1514
- return D !== false && V(i, D) && n.push(K), n;
1515
- }
1516
- function si(e, t, r) {
1517
- var D;
1518
- let n = e.node, u = an(e, t), { printer: i, originalText: o, locStart: s } = t, a = (D = i.isBlockComment) == null ? void 0 : D.call(i, n);
1519
- if (r != null && r.hasLineSuffix && !(r != null && r.isBlock) || V(o, s(n), { backwards: true })) {
1520
- let l = Ie(o, s(n));
1521
- return { doc: Te([K, l ? K : "", u]), isBlock: a, hasLineSuffix: true };
1522
- }
1523
- return !a || r != null && r.hasLineSuffix ? { doc: [Te([" ", u]), he], isBlock: a, hasLineSuffix: true } : { doc: [" ", u], isBlock: a, hasLineSuffix: false };
1524
- }
1525
- function ai(e, t) {
1526
- let r = e.node;
1527
- if (!r)
1528
- return {};
1529
- let n = t[Symbol.for("printedComments")];
1530
- if ((r.comments || []).filter((a) => !n.has(a)).length === 0)
1531
- return { leading: "", trailing: "" };
1532
- let i = [], o = [], s;
1533
- return e.each(() => {
1534
- let a = e.node;
1535
- if (n != null && n.has(a))
1536
- return;
1537
- let { leading: D, trailing: l } = a;
1538
- D ? i.push(oi(e, t)) : l && (s = si(e, t, s), o.push(s.doc));
1539
- }, "comments"), { leading: i, trailing: o };
1540
- }
1541
- function Dn(e, t, r) {
1542
- let { leading: n, trailing: u } = ai(e, r);
1543
- return !n && !u ? t : me(t, (i) => [n, i, u]);
1544
- }
1545
- function ln(e) {
1546
- let { [Symbol.for("comments")]: t, [Symbol.for("printedComments")]: r } = e;
1547
- for (let n of t) {
1548
- if (!n.printed && !r.has(n))
1549
- throw new Error('Comment "' + n.value.trim() + '" was not printed. Please report this error!');
1550
- delete n.printed;
1551
- }
1552
- }
1553
- var Re = class extends Error {
1554
- constructor() {
1555
- super(...arguments);
1556
- __publicField(this, "name", "ConfigError");
1557
- }
1558
- }, Ye = class extends Error {
1559
- constructor() {
1560
- super(...arguments);
1561
- __publicField(this, "name", "UndefinedParserError");
1562
- }
1563
- };
1564
- var fn = { 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.", 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
1565
- (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: false, 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: (e) => typeof e == "string" || typeof e == "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: "jsonc", description: "JSON with Comments" }, { 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: true, default: [{ value: [] }], category: "Global", description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.", exception: (e) => typeof e == "string" || typeof e == "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).
1566
- The range will extend forwards to the end of the selected statement.`, 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.
1567
- The range will extend backwards to the start of the first line containing the selected statement.`, cliCategory: "Editor" }, requirePragma: { category: "Special", type: "boolean", default: false, description: `Require either '@prettier' or '@format' to be present in the file's first docblock comment
1568
- 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: false, 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." }] } };
1569
- function it({ plugins: e = [], showDeprecated: t = false } = {}) {
1570
- let r = e.flatMap((u) => u.languages ?? []), n = [];
1571
- for (let u of ci(Object.assign({}, ...e.map(({ options: i }) => i), fn)))
1572
- !t && u.deprecated || (Array.isArray(u.choices) && (t || (u.choices = u.choices.filter((i) => !i.deprecated)), u.name === "parser" && (u.choices = [...u.choices, ...li(u.choices, r, e)])), u.pluginDefaults = Object.fromEntries(e.filter((i) => {
1573
- var o;
1574
- return ((o = i.defaultOptions) == null ? void 0 : o[u.name]) !== void 0;
1575
- }).map((i) => [i.name, i.defaultOptions[u.name]])), n.push(u));
1576
- return { languages: r, options: n };
1577
- }
1578
- function* li(e, t, r) {
1579
- let n = new Set(e.map((u) => u.value));
1580
- for (let u of t)
1581
- if (u.parsers) {
1582
- for (let i of u.parsers)
1583
- if (!n.has(i)) {
1584
- n.add(i);
1585
- let o = r.find((a) => a.parsers && Object.prototype.hasOwnProperty.call(a.parsers, i)), s = u.name;
1586
- o != null && o.name && (s += ` (plugin: ${o.name})`), yield { value: i, description: s };
1587
- }
1588
- }
1589
- }
1590
- function ci(e) {
1591
- let t = [];
1592
- for (let [r, n] of Object.entries(e)) {
1593
- let u = { name: r, ...n };
1594
- Array.isArray(u.default) && (u.default = A(false, u.default, -1).value), t.push(u);
1595
- }
1596
- return t;
1597
- }
1598
- var fi = (e) => String(e).split(/[/\\]/u).pop();
1599
- function dn(e, t) {
1600
- if (!t)
1601
- return;
1602
- let r = fi(t).toLowerCase();
1603
- return e.find(({ filenames: n }) => n == null ? void 0 : n.some((u) => u.toLowerCase() === r)) ?? e.find(({ extensions: n }) => n == null ? void 0 : n.some((u) => r.endsWith(u)));
1604
- }
1605
- function di(e, t) {
1606
- if (t)
1607
- return e.find(({ name: r }) => r.toLowerCase() === t) ?? e.find(({ aliases: r }) => r == null ? void 0 : r.includes(t)) ?? e.find(({ extensions: r }) => r == null ? void 0 : r.includes(`.${t}`));
1608
- }
1609
- function pi(e, t) {
1610
- let r = e.plugins.flatMap((u) => u.languages ?? []), n = di(r, t.language) ?? dn(r, t.physicalFile) ?? dn(r, t.file) ?? (t.physicalFile, void 0);
1611
- return n == null ? void 0 : n.parsers[0];
1612
- }
1613
- var pn = pi;
1614
- var oe = { key: (e) => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(e) ? e : JSON.stringify(e), value(e) {
1615
- if (e === null || typeof e != "object")
1616
- return JSON.stringify(e);
1617
- if (Array.isArray(e))
1618
- return `[${e.map((r) => oe.value(r)).join(", ")}]`;
1619
- let t = Object.keys(e);
1620
- return t.length === 0 ? "{}" : `{ ${t.map((r) => `${oe.key(r)}: ${oe.value(e[r])}`).join(", ")} }`;
1621
- }, pair: ({ key: e, value: t }) => oe.value({ [e]: t }) };
1622
- var Ut = Me(ot(), 1), hn = (e, t, { descriptor: r }) => {
1623
- let n = [`${Ut.default.yellow(typeof e == "string" ? r.key(e) : r.pair(e))} is deprecated`];
1624
- return t && n.push(`we now treat it as ${Ut.default.blue(typeof t == "string" ? r.key(t) : r.pair(t))}`), n.join("; ") + ".";
1625
- };
1626
- var ce = Me(ot(), 1);
1627
- var st = Symbol.for("vnopts.VALUE_NOT_EXIST"), ve = Symbol.for("vnopts.VALUE_UNCHANGED");
1628
- var En = " ".repeat(2), gn = (e, t, r) => {
1629
- let { text: n, list: u } = r.normalizeExpectedResult(r.schemas[e].expected(r)), i = [];
1630
- return n && i.push(Cn(e, t, n, r.descriptor)), u && i.push([Cn(e, t, u.title, r.descriptor)].concat(u.values.map((o) => yn(o, r.loggerPrintWidth))).join(`
1631
- `)), An(i, r.loggerPrintWidth);
1632
- };
1633
- function Cn(e, t, r, n) {
1634
- return [`Invalid ${ce.default.red(n.key(e))} value.`, `Expected ${ce.default.blue(r)},`, `but received ${t === st ? ce.default.gray("nothing") : ce.default.red(n.value(t))}.`].join(" ");
1635
- }
1636
- function yn({ text: e, list: t }, r) {
1637
- let n = [];
1638
- return e && n.push(`- ${ce.default.blue(e)}`), t && n.push([`- ${ce.default.blue(t.title)}:`].concat(t.values.map((u) => yn(u, r - En.length).replace(/^|\n/g, `$&${En}`))).join(`
1639
- `)), An(n, r);
1640
- }
1641
- function An(e, t) {
1642
- if (e.length === 1)
1643
- return e[0];
1644
- let [r, n] = e, [u, i] = e.map((o) => o.split(`
1645
- `, 1)[0].length);
1646
- return u > t && u > i ? n : r;
1647
- }
1648
- var Kt = Me(ot(), 1);
1649
- var zt = [], vn = [];
1650
- function Gt(e, t) {
1651
- if (e === t)
1652
- return 0;
1653
- let r = e;
1654
- e.length > t.length && (e = t, t = r);
1655
- let n = e.length, u = t.length;
1656
- for (; n > 0 && e.charCodeAt(~-n) === t.charCodeAt(~-u); )
1657
- n--, u--;
1658
- let i = 0;
1659
- for (; i < n && e.charCodeAt(i) === t.charCodeAt(i); )
1660
- i++;
1661
- if (n -= i, u -= i, n === 0)
1662
- return u;
1663
- let o, s, a, D, l = 0, p = 0;
1664
- for (; l < n; )
1665
- vn[l] = e.charCodeAt(i + l), zt[l] = ++l;
1666
- for (; p < u; )
1667
- for (o = t.charCodeAt(i + p), a = p++, s = p, l = 0; l < n; l++)
1668
- D = o === vn[l] ? a : a + 1, a = zt[l], s = zt[l] = a > s ? D > s ? s + 1 : D : D > a ? a + 1 : D;
1669
- return s;
1670
- }
1671
- var at = (e, t, { descriptor: r, logger: n, schemas: u }) => {
1672
- let i = [`Ignored unknown option ${Kt.default.yellow(r.pair({ key: e, value: t }))}.`], o = Object.keys(u).sort().find((s) => Gt(e, s) < 3);
1673
- o && i.push(`Did you mean ${Kt.default.blue(r.key(o))}?`), n.warn(i.join(" "));
1674
- };
1675
- var Fi = ["default", "expected", "validate", "deprecated", "forward", "redirect", "overlap", "preprocess", "postprocess"];
1676
- function mi(e, t) {
1677
- let r = new e(t), n = Object.create(r);
1678
- for (let u of Fi)
1679
- u in t && (n[u] = hi(t[u], r, x.prototype[u].length));
1680
- return n;
1681
- }
1682
- var x = class {
1683
- static create(t) {
1684
- return mi(this, t);
1685
- }
1686
- constructor(t) {
1687
- this.name = t.name;
1688
- }
1689
- default(t) {
1690
- }
1691
- expected(t) {
1692
- return "nothing";
1693
- }
1694
- validate(t, r) {
1695
- return false;
1696
- }
1697
- deprecated(t, r) {
1698
- return false;
1699
- }
1700
- forward(t, r) {
1701
- }
1702
- redirect(t, r) {
1703
- }
1704
- overlap(t, r, n) {
1705
- return t;
1706
- }
1707
- preprocess(t, r) {
1708
- return t;
1709
- }
1710
- postprocess(t, r) {
1711
- return ve;
1712
- }
1713
- };
1714
- function hi(e, t, r) {
1715
- return typeof e == "function" ? (...n) => e(...n.slice(0, r - 1), t, ...n.slice(r - 1)) : () => e;
1716
- }
1717
- var Dt = class extends x {
1718
- constructor(t) {
1719
- super(t), this._sourceName = t.sourceName;
1720
- }
1721
- expected(t) {
1722
- return t.schemas[this._sourceName].expected(t);
1723
- }
1724
- validate(t, r) {
1725
- return r.schemas[this._sourceName].validate(t, r);
1726
- }
1727
- redirect(t, r) {
1728
- return this._sourceName;
1729
- }
1730
- };
1731
- var lt = class extends x {
1732
- expected() {
1733
- return "anything";
1734
- }
1735
- validate() {
1736
- return true;
1737
- }
1738
- };
1739
- var ct = class extends x {
1740
- constructor({ valueSchema: t, name: r = t.name, ...n }) {
1741
- super({ ...n, name: r }), this._valueSchema = t;
1742
- }
1743
- expected(t) {
1744
- let { text: r, list: n } = t.normalizeExpectedResult(this._valueSchema.expected(t));
1745
- return { text: r && `an array of ${r}`, list: n && { title: "an array of the following values", values: [{ list: n }] } };
1746
- }
1747
- validate(t, r) {
1748
- if (!Array.isArray(t))
1749
- return false;
1750
- let n = [];
1751
- for (let u of t) {
1752
- let i = r.normalizeValidateResult(this._valueSchema.validate(u, r), u);
1753
- i !== true && n.push(i.value);
1754
- }
1755
- return n.length === 0 ? true : { value: n };
1756
- }
1757
- deprecated(t, r) {
1758
- let n = [];
1759
- for (let u of t) {
1760
- let i = r.normalizeDeprecatedResult(this._valueSchema.deprecated(u, r), u);
1761
- i !== false && n.push(...i.map(({ value: o }) => ({ value: [o] })));
1762
- }
1763
- return n;
1764
- }
1765
- forward(t, r) {
1766
- let n = [];
1767
- for (let u of t) {
1768
- let i = r.normalizeForwardResult(this._valueSchema.forward(u, r), u);
1769
- n.push(...i.map(Bn));
1770
- }
1771
- return n;
1772
- }
1773
- redirect(t, r) {
1774
- let n = [], u = [];
1775
- for (let i of t) {
1776
- let o = r.normalizeRedirectResult(this._valueSchema.redirect(i, r), i);
1777
- "remain" in o && n.push(o.remain), u.push(...o.redirect.map(Bn));
1778
- }
1779
- return n.length === 0 ? { redirect: u } : { redirect: u, remain: n };
1780
- }
1781
- overlap(t, r) {
1782
- return t.concat(r);
1783
- }
1784
- };
1785
- function Bn({ from: e, to: t }) {
1786
- return { from: [e], to: t };
1787
- }
1788
- var ft = class extends x {
1789
- expected() {
1790
- return "true or false";
1791
- }
1792
- validate(t) {
1793
- return typeof t == "boolean";
1794
- }
1795
- };
1796
- function _n(e, t) {
1797
- let r = /* @__PURE__ */ Object.create(null);
1798
- for (let n of e) {
1799
- let u = n[t];
1800
- if (r[u])
1801
- throw new Error(`Duplicate ${t} ${JSON.stringify(u)}`);
1802
- r[u] = n;
1803
- }
1804
- return r;
1805
- }
1806
- function xn(e, t) {
1807
- let r = /* @__PURE__ */ new Map();
1808
- for (let n of e) {
1809
- let u = n[t];
1810
- if (r.has(u))
1811
- throw new Error(`Duplicate ${t} ${JSON.stringify(u)}`);
1812
- r.set(u, n);
1813
- }
1814
- return r;
1815
- }
1816
- function bn() {
1817
- let e = /* @__PURE__ */ Object.create(null);
1818
- return (t) => {
1819
- let r = JSON.stringify(t);
1820
- return e[r] ? true : (e[r] = true, false);
1821
- };
1822
- }
1823
- function Nn(e, t) {
1824
- let r = [], n = [];
1825
- for (let u of e)
1826
- t(u) ? r.push(u) : n.push(u);
1827
- return [r, n];
1828
- }
1829
- function On(e) {
1830
- return e === Math.floor(e);
1831
- }
1832
- function Sn(e, t) {
1833
- if (e === t)
1834
- return 0;
1835
- let r = typeof e, n = typeof t, u = ["undefined", "object", "boolean", "number", "string"];
1836
- return r !== n ? u.indexOf(r) - u.indexOf(n) : r !== "string" ? Number(e) - Number(t) : e.localeCompare(t);
1837
- }
1838
- function Tn(e) {
1839
- return (...t) => {
1840
- let r = e(...t);
1841
- return typeof r == "string" ? new Error(r) : r;
1842
- };
1843
- }
1844
- function Jt(e) {
1845
- return e === void 0 ? {} : e;
1846
- }
1847
- function qt(e) {
1848
- if (typeof e == "string")
1849
- return { text: e };
1850
- let { text: t, list: r } = e;
1851
- return Ei((t || r) !== void 0, "Unexpected `expected` result, there should be at least one field."), r ? { text: t, list: { title: r.title, values: r.values.map(qt) } } : { text: t };
1852
- }
1853
- function Xt(e, t) {
1854
- return e === true ? true : e === false ? { value: t } : e;
1855
- }
1856
- function Qt(e, t, r = false) {
1857
- return e === false ? false : e === true ? r ? true : [{ value: t }] : "value" in e ? [e] : e.length === 0 ? false : e;
1858
- }
1859
- function wn(e, t) {
1860
- return typeof e == "string" || "key" in e ? { from: t, to: e } : "from" in e ? { from: e.from, to: e.to } : { from: t, to: e.to };
1861
- }
1862
- function dt(e, t) {
1863
- return e === void 0 ? [] : Array.isArray(e) ? e.map((r) => wn(r, t)) : [wn(e, t)];
1864
- }
1865
- function Zt(e, t) {
1866
- let r = dt(typeof e == "object" && "redirect" in e ? e.redirect : e, t);
1867
- return r.length === 0 ? { remain: t, redirect: r } : typeof e == "object" && "remain" in e ? { remain: e.remain, redirect: r } : { redirect: r };
1868
- }
1869
- function Ei(e, t) {
1870
- if (!e)
1871
- throw new Error(t);
1872
- }
1873
- var pt = class extends x {
1874
- constructor(t) {
1875
- super(t), this._choices = xn(t.choices.map((r) => r && typeof r == "object" ? r : { value: r }), "value");
1876
- }
1877
- expected({ descriptor: t }) {
1878
- let r = Array.from(this._choices.keys()).map((o) => this._choices.get(o)).filter(({ hidden: o }) => !o).map((o) => o.value).sort(Sn).map(t.value), n = r.slice(0, -2), u = r.slice(-2);
1879
- return { text: n.concat(u.join(" or ")).join(", "), list: { title: "one of the following values", values: r } };
1880
- }
1881
- validate(t) {
1882
- return this._choices.has(t);
1883
- }
1884
- deprecated(t) {
1885
- let r = this._choices.get(t);
1886
- return r && r.deprecated ? { value: t } : false;
1887
- }
1888
- forward(t) {
1889
- let r = this._choices.get(t);
1890
- return r ? r.forward : void 0;
1891
- }
1892
- redirect(t) {
1893
- let r = this._choices.get(t);
1894
- return r ? r.redirect : void 0;
1895
- }
1896
- };
1897
- var Ft = class extends x {
1898
- expected() {
1899
- return "a number";
1900
- }
1901
- validate(t, r) {
1902
- return typeof t == "number";
1903
- }
1904
- };
1905
- var mt = class extends Ft {
1906
- expected() {
1907
- return "an integer";
1908
- }
1909
- validate(t, r) {
1910
- return r.normalizeValidateResult(super.validate(t, r), t) === true && On(t);
1911
- }
1912
- };
1913
- var je = class extends x {
1914
- expected() {
1915
- return "a string";
1916
- }
1917
- validate(t) {
1918
- return typeof t == "string";
1919
- }
1920
- };
1921
- var kn = oe, Ln = at, Pn = gn, In = hn;
1922
- var ht = class {
1923
- constructor(t, r) {
1924
- let { logger: n = console, loggerPrintWidth: u = 80, descriptor: i = kn, unknown: o = Ln, invalid: s = Pn, deprecated: a = In, missing: D = () => false, required: l = () => false, preprocess: p = (d) => d, postprocess: f = () => ve } = r || {};
1925
- this._utils = { descriptor: i, logger: n || { warn: () => {
1926
- } }, loggerPrintWidth: u, schemas: _n(t, "name"), normalizeDefaultResult: Jt, normalizeExpectedResult: qt, normalizeDeprecatedResult: Qt, normalizeForwardResult: dt, normalizeRedirectResult: Zt, normalizeValidateResult: Xt }, this._unknownHandler = o, this._invalidHandler = Tn(s), this._deprecatedHandler = a, this._identifyMissing = (d, c) => !(d in c) || D(d, c), this._identifyRequired = l, this._preprocess = p, this._postprocess = f, this.cleanHistory();
1927
- }
1928
- cleanHistory() {
1929
- this._hasDeprecationWarned = bn();
1930
- }
1931
- normalize(t) {
1932
- let r = {}, u = [this._preprocess(t, this._utils)], i = () => {
1933
- for (; u.length !== 0; ) {
1934
- let o = u.shift(), s = this._applyNormalization(o, r);
1935
- u.push(...s);
1936
- }
1937
- };
1938
- i();
1939
- for (let o of Object.keys(this._utils.schemas)) {
1940
- let s = this._utils.schemas[o];
1941
- if (!(o in r)) {
1942
- let a = Jt(s.default(this._utils));
1943
- "value" in a && u.push({ [o]: a.value });
1944
- }
1945
- }
1946
- i();
1947
- for (let o of Object.keys(this._utils.schemas)) {
1948
- if (!(o in r))
1949
- continue;
1950
- let s = this._utils.schemas[o], a = r[o], D = s.postprocess(a, this._utils);
1951
- D !== ve && (this._applyValidation(D, o, s), r[o] = D);
1952
- }
1953
- return this._applyPostprocess(r), this._applyRequiredCheck(r), r;
1954
- }
1955
- _applyNormalization(t, r) {
1956
- let n = [], { knownKeys: u, unknownKeys: i } = this._partitionOptionKeys(t);
1957
- for (let o of u) {
1958
- let s = this._utils.schemas[o], a = s.preprocess(t[o], this._utils);
1959
- this._applyValidation(a, o, s);
1960
- let D = ({ from: d, to: c }) => {
1961
- n.push(typeof c == "string" ? { [c]: d } : { [c.key]: c.value });
1962
- }, l = ({ value: d, redirectTo: c }) => {
1963
- let F = Qt(s.deprecated(d, this._utils), a, true);
1964
- if (F !== false)
1965
- if (F === true)
1966
- this._hasDeprecationWarned(o) || this._utils.logger.warn(this._deprecatedHandler(o, c, this._utils));
1967
- else
1968
- for (let { value: m } of F) {
1969
- let h = { key: o, value: m };
1970
- if (!this._hasDeprecationWarned(h)) {
1971
- let C = typeof c == "string" ? { key: c, value: m } : c;
1972
- this._utils.logger.warn(this._deprecatedHandler(h, C, this._utils));
1973
- }
1974
- }
1975
- };
1976
- dt(s.forward(a, this._utils), a).forEach(D);
1977
- let f = Zt(s.redirect(a, this._utils), a);
1978
- if (f.redirect.forEach(D), "remain" in f) {
1979
- let d = f.remain;
1980
- r[o] = o in r ? s.overlap(r[o], d, this._utils) : d, l({ value: d });
1981
- }
1982
- for (let { from: d, to: c } of f.redirect)
1983
- l({ value: d, redirectTo: c });
1984
- }
1985
- for (let o of i) {
1986
- let s = t[o];
1987
- this._applyUnknownHandler(o, s, r, (a, D) => {
1988
- n.push({ [a]: D });
1989
- });
1990
- }
1991
- return n;
1992
- }
1993
- _applyRequiredCheck(t) {
1994
- for (let r of Object.keys(this._utils.schemas))
1995
- if (this._identifyMissing(r, t) && this._identifyRequired(r))
1996
- throw this._invalidHandler(r, st, this._utils);
1997
- }
1998
- _partitionOptionKeys(t) {
1999
- let [r, n] = Nn(Object.keys(t).filter((u) => !this._identifyMissing(u, t)), (u) => u in this._utils.schemas);
2000
- return { knownKeys: r, unknownKeys: n };
2001
- }
2002
- _applyValidation(t, r, n) {
2003
- let u = Xt(n.validate(t, this._utils), t);
2004
- if (u !== true)
2005
- throw this._invalidHandler(r, u.value, this._utils);
2006
- }
2007
- _applyUnknownHandler(t, r, n, u) {
2008
- let i = this._unknownHandler(t, r, this._utils);
2009
- if (i)
2010
- for (let o of Object.keys(i)) {
2011
- if (this._identifyMissing(o, i))
2012
- continue;
2013
- let s = i[o];
2014
- o in this._utils.schemas ? u(o, s) : n[o] = s;
2015
- }
2016
- }
2017
- _applyPostprocess(t) {
2018
- let r = this._postprocess(t, this._utils);
2019
- if (r !== ve) {
2020
- if (r.delete)
2021
- for (let n of r.delete)
2022
- delete t[n];
2023
- if (r.override) {
2024
- let { knownKeys: n, unknownKeys: u } = this._partitionOptionKeys(r.override);
2025
- for (let i of n) {
2026
- let o = r.override[i];
2027
- this._applyValidation(o, i, this._utils.schemas[i]), t[i] = o;
2028
- }
2029
- for (let i of u) {
2030
- let o = r.override[i];
2031
- this._applyUnknownHandler(i, o, t, (s, a) => {
2032
- let D = this._utils.schemas[s];
2033
- this._applyValidation(a, s, D), t[s] = a;
2034
- });
2035
- }
2036
- }
2037
- }
2038
- }
2039
- };
2040
- var er;
2041
- function gi(e, t, { logger: r = false, isCLI: n = false, passThrough: u = false, FlagSchema: i, descriptor: o } = {}) {
2042
- if (n) {
2043
- if (!i)
2044
- throw new Error("'FlagSchema' option is required.");
2045
- if (!o)
2046
- throw new Error("'descriptor' option is required.");
2047
- } else
2048
- o = oe;
2049
- let s = u ? Array.isArray(u) ? (f, d) => u.includes(f) ? { [f]: d } : void 0 : (f, d) => ({ [f]: d }) : (f, d, c) => {
2050
- let { _: F, ...m } = c.schemas;
2051
- return at(f, d, { ...c, schemas: m });
2052
- }, a = yi(t, { isCLI: n, FlagSchema: i }), D = new ht(a, { logger: r, unknown: s, descriptor: o }), l = r !== false;
2053
- l && er && (D._hasDeprecationWarned = er);
2054
- let p = D.normalize(e);
2055
- return l && (er = D._hasDeprecationWarned), p;
2056
- }
2057
- function yi(e, { isCLI: t, FlagSchema: r }) {
2058
- let n = [];
2059
- t && n.push(lt.create({ name: "_" }));
2060
- for (let u of e)
2061
- n.push(Ai(u, { isCLI: t, optionInfos: e, FlagSchema: r })), u.alias && t && n.push(Dt.create({ name: u.alias, sourceName: u.name }));
2062
- return n;
2063
- }
2064
- function Ai(e, { isCLI: t, optionInfos: r, FlagSchema: n }) {
2065
- let { name: u } = e, i = { name: u }, o, s = {};
2066
- switch (e.type) {
2067
- case "int":
2068
- o = mt, t && (i.preprocess = Number);
2069
- break;
2070
- case "string":
2071
- o = je;
2072
- break;
2073
- case "choice":
2074
- o = pt, i.choices = e.choices.map((a) => a != null && a.redirect ? { ...a, redirect: { to: { key: e.name, value: a.redirect } } } : a);
2075
- break;
2076
- case "boolean":
2077
- o = ft;
2078
- break;
2079
- case "flag":
2080
- o = n, i.flags = r.flatMap((a) => [a.alias, a.description && a.name, a.oppositeDescription && `no-${a.name}`].filter(Boolean));
2081
- break;
2082
- case "path":
2083
- o = je;
2084
- break;
2085
- default:
2086
- throw new Error(`Unexpected type ${e.type}`);
2087
- }
2088
- if (e.exception ? i.validate = (a, D, l) => e.exception(a) || D.validate(a, l) : i.validate = (a, D, l) => a === void 0 || D.validate(a, l), e.redirect && (s.redirect = (a) => a ? { to: typeof e.redirect == "string" ? e.redirect : { key: e.redirect.option, value: e.redirect.value } } : void 0), e.deprecated && (s.deprecated = true), t && !e.array) {
2089
- let a = i.preprocess || ((D) => D);
2090
- i.preprocess = (D, l, p) => l.preprocess(a(Array.isArray(D) ? A(false, D, -1) : D), p);
2091
- }
2092
- return e.array ? ct.create({ ...t ? { preprocess: (a) => Array.isArray(a) ? a : [a] } : {}, ...s, valueSchema: o.create(i) }) : o.create({ ...i, ...s });
2093
- }
2094
- var Rn = gi;
2095
- var vi = (e, t, r) => {
2096
- if (!(e && t == null)) {
2097
- if (t.findLast)
2098
- return t.findLast(r);
2099
- for (let n = t.length - 1; n >= 0; n--) {
2100
- let u = t[n];
2101
- if (r(u, n, t))
2102
- return u;
2103
- }
2104
- }
2105
- }, tr = vi;
2106
- function rr(e, t) {
2107
- if (!t)
2108
- throw new Error("parserName is required.");
2109
- let r = tr(false, e, (u) => u.parsers && Object.prototype.hasOwnProperty.call(u.parsers, t));
2110
- if (r)
2111
- return r;
2112
- let n = `Couldn't resolve parser "${t}".`;
2113
- throw n += " Plugins must be explicitly added to the standalone bundle.", new Re(n);
2114
- }
2115
- function Yn(e, t) {
2116
- if (!t)
2117
- throw new Error("astFormat is required.");
2118
- let r = tr(false, e, (u) => u.printers && Object.prototype.hasOwnProperty.call(u.printers, t));
2119
- if (r)
2120
- return r;
2121
- let n = `Couldn't find plugin for AST format "${t}".`;
2122
- throw n += " Plugins must be explicitly added to the standalone bundle.", new Re(n);
2123
- }
2124
- function Et({ plugins: e, parser: t }) {
2125
- let r = rr(e, t);
2126
- return nr(r, t);
2127
- }
2128
- function nr(e, t) {
2129
- let r = e.parsers[t];
2130
- return typeof r == "function" ? r() : r;
2131
- }
2132
- function jn(e, t) {
2133
- let r = e.printers[t];
2134
- return typeof r == "function" ? r() : r;
2135
- }
2136
- var Hn = { astFormat: "estree", printer: {}, originalText: void 0, locStart: null, locEnd: null };
2137
- async function Bi(e, t = {}) {
2138
- var p;
2139
- let r = { ...e };
2140
- if (!r.parser)
2141
- if (r.filepath) {
2142
- if (r.parser = pn(r, { physicalFile: r.filepath }), !r.parser)
2143
- throw new Ye(`No parser could be inferred for file "${r.filepath}".`);
2144
- } else
2145
- throw new Ye("No parser and no file path given, couldn't infer a parser.");
2146
- let n = it({ plugins: e.plugins, showDeprecated: true }).options, u = { ...Hn, ...Object.fromEntries(n.filter((f) => f.default !== void 0).map((f) => [f.name, f.default])) }, i = rr(r.plugins, r.parser), o = await nr(i, r.parser);
2147
- r.astFormat = o.astFormat, r.locEnd = o.locEnd, r.locStart = o.locStart;
2148
- let s = (p = i.printers) != null && p[o.astFormat] ? i : Yn(r.plugins, o.astFormat), a = await jn(s, o.astFormat);
2149
- r.printer = a;
2150
- let D = s.defaultOptions ? Object.fromEntries(Object.entries(s.defaultOptions).filter(([, f]) => f !== void 0)) : {}, l = { ...u, ...D };
2151
- for (let [f, d] of Object.entries(l))
2152
- (r[f] === null || r[f] === void 0) && (r[f] = d);
2153
- return r.parser === "json" && (r.trailingComma = "none"), Rn(r, n, { passThrough: Object.keys(Hn), ...t });
2154
- }
2155
- var se = Bi;
2156
- var Mn = Me($n(), 1);
2157
- async function bi(e, t) {
2158
- let r = await Et(t), n = r.preprocess ? r.preprocess(e, t) : e;
2159
- t.originalText = n;
2160
- let u;
2161
- try {
2162
- u = await r.parse(n, t, t);
2163
- } catch (i) {
2164
- Ni(i, e);
2165
- }
2166
- return { text: n, ast: u };
2167
- }
2168
- function Ni(e, t) {
2169
- let { loc: r } = e;
2170
- if (r) {
2171
- let n = (0, Mn.codeFrameColumns)(t, r, { highlightCode: true });
2172
- throw e.message += `
2173
- ` + n, e.codeFrame = n, e;
2174
- }
2175
- throw e;
2176
- }
2177
- var fe = bi;
2178
- async function Vn(e, t, r, n, u) {
2179
- let { embeddedLanguageFormatting: i, printer: { embed: o, hasPrettierIgnore: s = () => false, getVisitorKeys: a } } = r;
2180
- if (!o || i !== "auto")
2181
- return;
2182
- if (o.length > 2)
2183
- throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed");
2184
- let D = q(o.getVisitorKeys ?? a), l = [];
2185
- d();
2186
- let p = e.stack;
2187
- for (let { print: c, node: F, pathStack: m } of l)
2188
- try {
2189
- e.stack = m;
2190
- let h = await c(f, t, e, r);
2191
- h && u.set(F, h);
2192
- } catch (h) {
2193
- if (globalThis.PRETTIER_DEBUG)
2194
- throw h;
2195
- }
2196
- e.stack = p;
2197
- function f(c, F) {
2198
- return Oi(c, F, r, n);
2199
- }
2200
- function d() {
2201
- let { node: c } = e;
2202
- if (c === null || typeof c != "object" || s(e))
2203
- return;
2204
- for (let m of D(c))
2205
- Array.isArray(c[m]) ? e.each(d, m) : e.call(d, m);
2206
- let F = o(e, r);
2207
- if (F) {
2208
- if (typeof F == "function") {
2209
- l.push({ print: F, node: c, pathStack: [...e.stack] });
2210
- return;
2211
- }
2212
- u.set(c, F);
2213
- }
2214
- }
2215
- }
2216
- async function Oi(e, t, r, n) {
2217
- let u = await se({ ...r, ...t, parentParser: r.parser, originalText: e }, { passThrough: true }), { ast: i } = await fe(e, u), o = await n(i, u);
2218
- return qe(o);
2219
- }
2220
- function Si(e, t) {
2221
- let { originalText: r, [Symbol.for("comments")]: n, locStart: u, locEnd: i, [Symbol.for("printedComments")]: o } = t, { node: s } = e, a = u(s), D = i(s);
2222
- for (let l of n)
2223
- u(l) >= a && i(l) <= D && o.add(l);
2224
- return r.slice(a, D);
2225
- }
2226
- var Un = Si;
2227
- async function He(e, t) {
2228
- ({ ast: e } = await ir(e, t));
2229
- let r = /* @__PURE__ */ new Map(), n = new qr(e), i = /* @__PURE__ */ new Map();
2230
- await Vn(n, s, t, He, i);
2231
- let o = await zn(n, t, s, void 0, i);
2232
- if (ln(t), t.nodeAfterCursor && !t.nodeBeforeCursor)
2233
- return [Z, o];
2234
- if (t.nodeBeforeCursor && !t.nodeAfterCursor)
2235
- return [o, Z];
2236
- return o;
2237
- function s(D, l) {
2238
- return D === void 0 || D === n ? a(l) : Array.isArray(D) ? n.call(() => a(l), ...D) : n.call(() => a(l), D);
2239
- }
2240
- function a(D) {
2241
- let l = n.node;
2242
- if (l == null)
2243
- return "";
2244
- let p = l && typeof l == "object" && D === void 0;
2245
- if (p && r.has(l))
2246
- return r.get(l);
2247
- let f = zn(n, t, s, D, i);
2248
- return p && r.set(l, f), f;
2249
- }
2250
- }
2251
- function zn(e, t, r, n, u) {
2252
- var a;
2253
- let { node: i } = e, { printer: o } = t, s;
2254
- switch ((a = o.hasPrettierIgnore) != null && a.call(o, e) ? s = Un(e, t) : u.has(i) ? s = u.get(i) : s = o.print(e, t, r, n), i) {
2255
- case t.cursorNode:
2256
- s = me(s, (D) => [Z, D, Z]);
2257
- break;
2258
- case t.nodeBeforeCursor:
2259
- s = me(s, (D) => [D, Z]);
2260
- break;
2261
- case t.nodeAfterCursor:
2262
- s = me(s, (D) => [Z, D]);
2263
- break;
2264
- }
2265
- return o.printComment && (!o.willPrintOwnComments || !o.willPrintOwnComments(e, t)) && (s = Dn(e, s, t)), s;
2266
- }
2267
- async function ir(e, t) {
2268
- let r = e.comments ?? [];
2269
- t[Symbol.for("comments")] = r, t[Symbol.for("tokens")] = e.tokens ?? [], t[Symbol.for("printedComments")] = /* @__PURE__ */ new Set(), on(e, t);
2270
- let { printer: { preprocess: n } } = t;
2271
- return e = n ? await n(e, t) : e, { ast: e, comments: r };
2272
- }
2273
- function Ti(e, t) {
2274
- let { cursorOffset: r, locStart: n, locEnd: u } = t, i = q(t.printer.getVisitorKeys), o = (d) => n(d) <= r && u(d) >= r, s = e, a = [e];
2275
- for (let d of Zr(e, { getVisitorKeys: i, filter: o }))
2276
- a.push(d), s = d;
2277
- if (en(s, { getVisitorKeys: i }))
2278
- return { cursorNode: s };
2279
- let D, l, p = -1, f = Number.POSITIVE_INFINITY;
2280
- for (; a.length > 0 && (D === void 0 || l === void 0); ) {
2281
- s = a.pop();
2282
- let d = D !== void 0, c = l !== void 0;
2283
- for (let F of ye(s, { getVisitorKeys: i })) {
2284
- if (!d) {
2285
- let m = u(F);
2286
- m <= r && m > p && (D = F, p = m);
2287
- }
2288
- if (!c) {
2289
- let m = n(F);
2290
- m >= r && m < f && (l = F, f = m);
2291
- }
2292
- }
2293
- }
2294
- return { nodeBeforeCursor: D, nodeAfterCursor: l };
2295
- }
2296
- var Gn = Ti;
2297
- function ki(e, t) {
2298
- let { printer: { massageAstNode: r, getVisitorKeys: n } } = t;
2299
- if (!r)
2300
- return e;
2301
- let u = q(n), i = r.ignoredProperties ?? /* @__PURE__ */ new Set();
2302
- return o(e);
2303
- function o(s, a) {
2304
- if (!(s !== null && typeof s == "object"))
2305
- return s;
2306
- if (Array.isArray(s))
2307
- return s.map((f) => o(f, a)).filter(Boolean);
2308
- let D = {}, l = new Set(u(s));
2309
- for (let f in s)
2310
- !Object.prototype.hasOwnProperty.call(s, f) || i.has(f) || (l.has(f) ? D[f] = o(s[f], s) : D[f] = s[f]);
2311
- let p = r(s, D, a);
2312
- if (p !== null)
2313
- return p ?? D;
2314
- }
2315
- }
2316
- var Kn = ki;
2317
- var Li = (e, t, r) => {
2318
- if (!(e && t == null)) {
2319
- if (t.findLastIndex)
2320
- return t.findLastIndex(r);
2321
- for (let n = t.length - 1; n >= 0; n--) {
2322
- let u = t[n];
2323
- if (r(u, n, t))
2324
- return n;
2325
- }
2326
- return -1;
2327
- }
2328
- }, Jn = Li;
2329
- var Pi = ({ parser: e }) => e === "json" || e === "json5" || e === "jsonc" || e === "json-stringify";
2330
- function Ii(e, t) {
2331
- let r = [e.node, ...e.parentNodes], n = /* @__PURE__ */ new Set([t.node, ...t.parentNodes]);
2332
- return r.find((u) => Qn.has(u.type) && n.has(u));
2333
- }
2334
- function qn(e) {
2335
- let t = Jn(false, e, (r) => r.type !== "Program" && r.type !== "File");
2336
- return t === -1 ? e : e.slice(0, t + 1);
2337
- }
2338
- function Ri(e, t, { locStart: r, locEnd: n }) {
2339
- let u = e.node, i = t.node;
2340
- if (u === i)
2341
- return { startNode: u, endNode: i };
2342
- let o = r(e.node);
2343
- for (let a of qn(t.parentNodes))
2344
- if (r(a) >= o)
2345
- i = a;
2346
- else
2347
- break;
2348
- let s = n(t.node);
2349
- for (let a of qn(e.parentNodes)) {
2350
- if (n(a) <= s)
2351
- u = a;
2352
- else
2353
- break;
2354
- if (u === i)
2355
- break;
2356
- }
2357
- return { startNode: u, endNode: i };
2358
- }
2359
- function or(e, t, r, n, u = [], i) {
2360
- let { locStart: o, locEnd: s } = r, a = o(e), D = s(e);
2361
- if (!(t > D || t < a || i === "rangeEnd" && t === a || i === "rangeStart" && t === D)) {
2362
- for (let l of ut(e, r)) {
2363
- let p = or(l, t, r, n, [e, ...u], i);
2364
- if (p)
2365
- return p;
2366
- }
2367
- if (!n || n(e, u[0]))
2368
- return { node: e, parentNodes: u };
2369
- }
2370
- }
2371
- function Yi(e, t) {
2372
- return t !== "DeclareExportDeclaration" && e !== "TypeParameterDeclaration" && (e === "Directive" || e === "TypeAlias" || e === "TSExportAssignment" || e.startsWith("Declare") || e.startsWith("TSDeclare") || e.endsWith("Statement") || e.endsWith("Declaration"));
2373
- }
2374
- var Qn = /* @__PURE__ */ new Set(["JsonRoot", "ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral", "UnaryExpression", "TemplateLiteral"]), ji = /* @__PURE__ */ new Set(["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]);
2375
- function Xn(e, t, r) {
2376
- if (!t)
2377
- return false;
2378
- switch (e.parser) {
2379
- case "flow":
2380
- case "babel":
2381
- case "babel-flow":
2382
- case "babel-ts":
2383
- case "typescript":
2384
- case "acorn":
2385
- case "espree":
2386
- case "meriyah":
2387
- case "__babel_estree":
2388
- return Yi(t.type, r == null ? void 0 : r.type);
2389
- case "json":
2390
- case "json5":
2391
- case "jsonc":
2392
- case "json-stringify":
2393
- return Qn.has(t.type);
2394
- case "graphql":
2395
- return ji.has(t.kind);
2396
- case "vue":
2397
- return t.tag !== "root";
2398
- }
2399
- return false;
2400
- }
2401
- function Zn(e, t, r) {
2402
- let { rangeStart: n, rangeEnd: u, locStart: i, locEnd: o } = t;
2403
- Pe.ok(u > n);
2404
- let s = e.slice(n, u).search(/\S/u), a = s === -1;
2405
- if (!a)
2406
- for (n += s; u > n && !/\S/u.test(e[u - 1]); --u)
2407
- ;
2408
- let D = or(r, n, t, (d, c) => Xn(t, d, c), [], "rangeStart"), l = a ? D : or(r, u, t, (d) => Xn(t, d), [], "rangeEnd");
2409
- if (!D || !l)
2410
- return { rangeStart: 0, rangeEnd: 0 };
2411
- let p, f;
2412
- if (Pi(t)) {
2413
- let d = Ii(D, l);
2414
- p = d, f = d;
2415
- } else
2416
- ({ startNode: p, endNode: f } = Ri(D, l, t));
2417
- return { rangeStart: Math.min(i(p), i(f)), rangeEnd: Math.max(o(p), o(f)) };
2418
- }
2419
- var nu = "\uFEFF", eu = Symbol("cursor");
2420
- async function uu(e, t, r = 0) {
2421
- if (!e || e.trim().length === 0)
2422
- return { formatted: "", cursorOffset: -1, comments: [] };
2423
- let { ast: n, text: u } = await fe(e, t);
2424
- t.cursorOffset >= 0 && (t = { ...t, ...Gn(n, t) });
2425
- let i = await He(n, t);
2426
- r > 0 && (i = Ze([K, i], r, t.tabWidth));
2427
- let o = Ce(i, t);
2428
- if (r > 0) {
2429
- let a = o.formatted.trim();
2430
- o.cursorNodeStart !== void 0 && (o.cursorNodeStart -= o.formatted.indexOf(a), o.cursorNodeStart < 0 && (o.cursorNodeStart = 0, o.cursorNodeText = o.cursorNodeText.trimStart()), o.cursorNodeStart + o.cursorNodeText.length > a.length && (o.cursorNodeText = o.cursorNodeText.trimEnd())), o.formatted = a + be(t.endOfLine);
2431
- }
2432
- let s = t[Symbol.for("comments")];
2433
- if (t.cursorOffset >= 0) {
2434
- let a, D, l, p;
2435
- if ((t.cursorNode || t.nodeBeforeCursor || t.nodeAfterCursor) && o.cursorNodeText)
2436
- if (l = o.cursorNodeStart, p = o.cursorNodeText, t.cursorNode)
2437
- a = t.locStart(t.cursorNode), D = u.slice(a, t.locEnd(t.cursorNode));
2438
- else {
2439
- if (!t.nodeBeforeCursor && !t.nodeAfterCursor)
2440
- throw new Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor");
2441
- a = t.nodeBeforeCursor ? t.locEnd(t.nodeBeforeCursor) : 0;
2442
- let h = t.nodeAfterCursor ? t.locStart(t.nodeAfterCursor) : u.length;
2443
- D = u.slice(a, h);
2444
- }
2445
- else
2446
- a = 0, D = u, l = 0, p = o.formatted;
2447
- let f = t.cursorOffset - a;
2448
- if (D === p)
2449
- return { formatted: o.formatted, cursorOffset: l + f, comments: s };
2450
- let d = D.split("");
2451
- d.splice(f, 0, eu);
2452
- let c = p.split(""), F = yr(d, c), m = l;
2453
- for (let h of F)
2454
- if (h.removed) {
2455
- if (h.value.includes(eu))
2456
- break;
2457
- } else
2458
- m += h.count;
2459
- return { formatted: o.formatted, cursorOffset: m, comments: s };
2460
- }
2461
- return { formatted: o.formatted, cursorOffset: -1, comments: s };
2462
- }
2463
- async function Hi(e, t) {
2464
- let { ast: r, text: n } = await fe(e, t), { rangeStart: u, rangeEnd: i } = Zn(n, t, r), o = n.slice(u, i), s = Math.min(u, n.lastIndexOf(`
2465
- `, u) + 1), a = n.slice(s, u).match(/^\s*/u)[0], D = ge(a, t.tabWidth), l = await uu(o, { ...t, rangeStart: 0, rangeEnd: Number.POSITIVE_INFINITY, cursorOffset: t.cursorOffset > u && t.cursorOffset <= i ? t.cursorOffset - u : -1, endOfLine: "lf" }, D), p = l.formatted.trimEnd(), { cursorOffset: f } = t;
2466
- f > i ? f += p.length - o.length : l.cursorOffset >= 0 && (f = l.cursorOffset + u);
2467
- let d = n.slice(0, u) + p + n.slice(i);
2468
- if (t.endOfLine !== "lf") {
2469
- let c = be(t.endOfLine);
2470
- f >= 0 && c === `\r
2471
- ` && (f += Nt(d.slice(0, f), `
2472
- `)), d = ne(false, d, `
2473
- `, c);
2474
- }
2475
- return { formatted: d, cursorOffset: f, comments: l.comments };
2476
- }
2477
- function sr(e, t, r) {
2478
- return typeof t != "number" || Number.isNaN(t) || t < 0 || t > e.length ? r : t;
2479
- }
2480
- function tu(e, t) {
2481
- let { cursorOffset: r, rangeStart: n, rangeEnd: u } = t;
2482
- return r = sr(e, r, -1), n = sr(e, n, 0), u = sr(e, u, e.length), { ...t, cursorOffset: r, rangeStart: n, rangeEnd: u };
2483
- }
2484
- function iu(e, t) {
2485
- let { cursorOffset: r, rangeStart: n, rangeEnd: u, endOfLine: i } = tu(e, t), o = e.charAt(0) === nu;
2486
- if (o && (e = e.slice(1), r--, n--, u--), i === "auto" && (i = Ar(e)), e.includes("\r")) {
2487
- let s = (a) => Nt(e.slice(0, Math.max(a, 0)), `\r
2488
- `);
2489
- r -= s(r), n -= s(n), u -= s(u), e = vr(e);
2490
- }
2491
- return { hasBOM: o, text: e, options: tu(e, { ...t, cursorOffset: r, rangeStart: n, rangeEnd: u, endOfLine: i }) };
2492
- }
2493
- async function ru(e, t) {
2494
- let r = await Et(t);
2495
- return !r.hasPragma || r.hasPragma(e);
2496
- }
2497
- async function ar(e, t) {
2498
- let { hasBOM: r, text: n, options: u } = iu(e, await se(t));
2499
- if (u.rangeStart >= u.rangeEnd && n !== "" || u.requirePragma && !await ru(n, u))
2500
- return { formatted: e, cursorOffset: t.cursorOffset, comments: [] };
2501
- let i;
2502
- return u.rangeStart > 0 || u.rangeEnd < n.length ? i = await Hi(n, u) : (!u.requirePragma && u.insertPragma && u.printer.insertPragma && !await ru(n, u) && (n = u.printer.insertPragma(n)), i = await uu(n, u)), r && (i.formatted = nu + i.formatted, i.cursorOffset >= 0 && i.cursorOffset++), i;
2503
- }
2504
- async function ou(e, t, r) {
2505
- let { text: n, options: u } = iu(e, await se(t)), i = await fe(n, u);
2506
- return r && (r.preprocessForPrint && (i.ast = await ir(i.ast, u)), r.massage && (i.ast = Kn(i.ast, u))), i;
2507
- }
2508
- async function su(e, t) {
2509
- t = await se(t);
2510
- let r = await He(e, t);
2511
- return Ce(r, t);
2512
- }
2513
- async function au(e, t) {
2514
- let r = Vr(e), { formatted: n } = await ar(r, { ...t, parser: "__js_expression" });
2515
- return n;
2516
- }
2517
- async function Du(e, t) {
2518
- t = await se(t);
2519
- let { ast: r } = await fe(e, t);
2520
- return He(r, t);
2521
- }
2522
- async function lu(e, t) {
2523
- return Ce(e, await se(t));
2524
- }
2525
- var Dr = {};
2526
- vt(Dr, { builders: () => $i, printer: () => Mi, utils: () => Vi });
2527
- var $i = { join: Se, line: Qe, softline: $r, hardline: K, literalline: Xe, group: kt, conditionalGroup: Ir, fill: Rr, lineSuffix: Te, lineSuffixBoundary: Hr, cursor: Z, breakParent: he, ifBreak: Yr, trim: Wr, indent: le, indentIfBreak: jr, align: De, addAlignmentToDoc: Ze, markAsRoot: Lr, dedentToRoot: kr, dedent: Pr, hardlineWithoutBreakParent: ke, literallineWithoutBreakParent: Lt, label: Mr, concat: (e) => e }, Mi = { printDocToString: Ce }, Vi = { willBreak: xr, traverseDoc: Fe, findInDoc: Je, mapDoc: Oe, removeLines: Nr, stripTrailingHardline: qe, replaceEndOfLine: Or, canBreak: Sr };
2528
- var cu = "3.5.3";
2529
- var cr = {};
2530
- vt(cr, { addDanglingComment: () => re, addLeadingComment: () => ue, addTrailingComment: () => ie, getAlignmentSize: () => ge, getIndentSize: () => fu, getMaxContinuousCount: () => du, getNextNonSpaceNonCommentCharacter: () => pu, getNextNonSpaceNonCommentCharacterIndex: () => no, getPreferredQuote: () => mu, getStringWidth: () => Le, hasNewline: () => V, hasNewlineInRange: () => hu, hasSpaces: () => Eu, isNextLineEmpty: () => so, isNextLineEmptyAfterIndex: () => Ct, isPreviousLineEmpty: () => io, makeString: () => Cu, skip: () => Ae, skipEverythingButNewLine: () => nt, skipInlineComment: () => Be, skipNewline: () => W, skipSpaces: () => S, skipToLineEnd: () => rt, skipTrailingComment: () => we, skipWhitespace: () => tn });
2531
- function Ui(e, t) {
2532
- if (t === false)
2533
- return false;
2534
- if (e.charAt(t) === "/" && e.charAt(t + 1) === "*") {
2535
- for (let r = t + 2; r < e.length; ++r)
2536
- if (e.charAt(r) === "*" && e.charAt(r + 1) === "/")
2537
- return r + 2;
2538
- }
2539
- return t;
2540
- }
2541
- var Be = Ui;
2542
- function zi(e, t) {
2543
- return t === false ? false : e.charAt(t) === "/" && e.charAt(t + 1) === "/" ? nt(e, t) : t;
2544
- }
2545
- var we = zi;
2546
- function Gi(e, t) {
2547
- let r = null, n = t;
2548
- for (; n !== r; )
2549
- r = n, n = S(e, n), n = Be(e, n), n = we(e, n), n = W(e, n);
2550
- return n;
2551
- }
2552
- var We = Gi;
2553
- function Ki(e, t) {
2554
- let r = null, n = t;
2555
- for (; n !== r; )
2556
- r = n, n = rt(e, n), n = Be(e, n), n = S(e, n);
2557
- return n = we(e, n), n = W(e, n), n !== false && V(e, n);
2558
- }
2559
- var Ct = Ki;
2560
- function Ji(e, t) {
2561
- let r = e.lastIndexOf(`
2562
- `);
2563
- return r === -1 ? 0 : ge(e.slice(r + 1).match(/^[\t ]*/u)[0], t);
2564
- }
2565
- var fu = Ji;
2566
- function lr(e) {
2567
- if (typeof e != "string")
2568
- throw new TypeError("Expected a string");
2569
- return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
2570
- }
2571
- function qi(e, t) {
2572
- let r = e.match(new RegExp(`(${lr(t)})+`, "gu"));
2573
- return r === null ? 0 : r.reduce((n, u) => Math.max(n, u.length / t.length), 0);
2574
- }
2575
- var du = qi;
2576
- function Xi(e, t) {
2577
- let r = We(e, t);
2578
- return r === false ? "" : e.charAt(r);
2579
- }
2580
- var pu = Xi;
2581
- var gt = "'", Fu = '"';
2582
- function Qi(e, t) {
2583
- let r = t === true || t === gt ? gt : Fu, n = r === gt ? Fu : gt, u = 0, i = 0;
2584
- for (let o of e)
2585
- o === r ? u++ : o === n && i++;
2586
- return u > i ? n : r;
2587
- }
2588
- var mu = Qi;
2589
- function Zi(e, t, r) {
2590
- for (let n = t; n < r; ++n)
2591
- if (e.charAt(n) === `
2592
- `)
2593
- return true;
2594
- return false;
2595
- }
2596
- var hu = Zi;
2597
- function eo(e, t, r = {}) {
2598
- return S(e, r.backwards ? t - 1 : t, r) !== t;
2599
- }
2600
- var Eu = eo;
2601
- function to(e, t, r) {
2602
- let n = t === '"' ? "'" : '"', i = ne(false, e, /\\(.)|(["'])/gsu, (o, s, a) => s === n ? s : a === t ? "\\" + a : a || (r && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s) ? s : "\\" + s));
2603
- return t + i + t;
2604
- }
2605
- var Cu = to;
2606
- function ro(e, t, r) {
2607
- return We(e, r(t));
2608
- }
2609
- function no(e, t) {
2610
- return arguments.length === 2 || typeof t == "number" ? We(e, t) : ro(...arguments);
2611
- }
2612
- function uo(e, t, r) {
2613
- return Ie(e, r(t));
2614
- }
2615
- function io(e, t) {
2616
- return arguments.length === 2 || typeof t == "number" ? Ie(e, t) : uo(...arguments);
2617
- }
2618
- function oo(e, t, r) {
2619
- return Ct(e, r(t));
2620
- }
2621
- function so(e, t) {
2622
- return arguments.length === 2 || typeof t == "number" ? Ct(e, t) : oo(...arguments);
2623
- }
2624
- function de(e, t = 1) {
2625
- return async (...r) => {
2626
- let n = r[t] ?? {}, u = n.plugins ?? [];
2627
- return r[t] = { ...n, plugins: Array.isArray(u) ? u : Object.values(u) }, e(...r);
2628
- };
2629
- }
2630
- var gu = de(ar);
2631
- async function yu(e, t) {
2632
- let { formatted: r } = await gu(e, { ...t, cursorOffset: -1 });
2633
- return r;
2634
- }
2635
- async function ao(e, t) {
2636
- return await yu(e, t) === e;
2637
- }
2638
- var Do = de(it, 0), lo = { parse: de(ou), formatAST: de(su), formatDoc: de(au), printToDoc: de(Du), printDocToString: de(lu) };
2639
- export {
2640
- lo as __debug,
2641
- ao as check,
2642
- Dr as doc,
2643
- yu as format,
2644
- gu as formatWithCursor,
2645
- Do as getSupportInfo,
2646
- cr as util,
2647
- cu as version
2648
- };
2649
- //# sourceMappingURL=standalone-bcc7f37a.js.map