prettier 3.6.2 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/doc.mjs CHANGED
@@ -12,22 +12,93 @@ __export(public_exports, {
12
12
  utils: () => utils
13
13
  });
14
14
 
15
- // src/document/constants.js
16
- var DOC_TYPE_STRING = "string";
17
- var DOC_TYPE_ARRAY = "array";
18
- var DOC_TYPE_CURSOR = "cursor";
19
- var DOC_TYPE_INDENT = "indent";
20
- var DOC_TYPE_ALIGN = "align";
21
- var DOC_TYPE_TRIM = "trim";
22
- var DOC_TYPE_GROUP = "group";
23
- var DOC_TYPE_FILL = "fill";
24
- var DOC_TYPE_IF_BREAK = "if-break";
25
- var DOC_TYPE_INDENT_IF_BREAK = "indent-if-break";
26
- var DOC_TYPE_LINE_SUFFIX = "line-suffix";
27
- var DOC_TYPE_LINE_SUFFIX_BOUNDARY = "line-suffix-boundary";
28
- var DOC_TYPE_LINE = "line";
29
- var DOC_TYPE_LABEL = "label";
30
- var DOC_TYPE_BREAK_PARENT = "break-parent";
15
+ // scripts/build/shims/shared.js
16
+ var OPTIONAL_OBJECT = 1;
17
+ var createMethodShim = (methodName, getImplementation) => (flags, object, ...arguments_) => {
18
+ if (flags | OPTIONAL_OBJECT && (object === void 0 || object === null)) {
19
+ return;
20
+ }
21
+ const implementation = getImplementation.call(object) ?? object[methodName];
22
+ return implementation.apply(object, arguments_);
23
+ };
24
+
25
+ // scripts/build/shims/method-at.js
26
+ function stringOrArrayAt(index) {
27
+ return this[index < 0 ? this.length + index : index];
28
+ }
29
+ var at = createMethodShim("at", function() {
30
+ if (Array.isArray(this) || typeof this === "string") {
31
+ return stringOrArrayAt;
32
+ }
33
+ });
34
+ var method_at_default = at;
35
+
36
+ // src/utils/noop.js
37
+ var noop = () => {
38
+ };
39
+ var noop_default = noop;
40
+
41
+ // src/document/builders/types.js
42
+ var DOC_TYPE_STRING = (
43
+ /** @type {const} */
44
+ "string"
45
+ );
46
+ var DOC_TYPE_ARRAY = (
47
+ /** @type {const} */
48
+ "array"
49
+ );
50
+ var DOC_TYPE_CURSOR = (
51
+ /** @type {const} */
52
+ "cursor"
53
+ );
54
+ var DOC_TYPE_INDENT = (
55
+ /** @type {const} */
56
+ "indent"
57
+ );
58
+ var DOC_TYPE_ALIGN = (
59
+ /** @type {const} */
60
+ "align"
61
+ );
62
+ var DOC_TYPE_TRIM = (
63
+ /** @type {const} */
64
+ "trim"
65
+ );
66
+ var DOC_TYPE_GROUP = (
67
+ /** @type {const} */
68
+ "group"
69
+ );
70
+ var DOC_TYPE_FILL = (
71
+ /** @type {const} */
72
+ "fill"
73
+ );
74
+ var DOC_TYPE_IF_BREAK = (
75
+ /** @type {const} */
76
+ "if-break"
77
+ );
78
+ var DOC_TYPE_INDENT_IF_BREAK = (
79
+ /** @type {const} */
80
+ "indent-if-break"
81
+ );
82
+ var DOC_TYPE_LINE_SUFFIX = (
83
+ /** @type {const} */
84
+ "line-suffix"
85
+ );
86
+ var DOC_TYPE_LINE_SUFFIX_BOUNDARY = (
87
+ /** @type {const} */
88
+ "line-suffix-boundary"
89
+ );
90
+ var DOC_TYPE_LINE = (
91
+ /** @type {const} */
92
+ "line"
93
+ );
94
+ var DOC_TYPE_LABEL = (
95
+ /** @type {const} */
96
+ "label"
97
+ );
98
+ var DOC_TYPE_BREAK_PARENT = (
99
+ /** @type {const} */
100
+ "break-parent"
101
+ );
31
102
  var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
32
103
  DOC_TYPE_CURSOR,
33
104
  DOC_TYPE_INDENT,
@@ -44,18 +115,6 @@ var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
44
115
  DOC_TYPE_BREAK_PARENT
45
116
  ]);
46
117
 
47
- // scripts/build/shims/at.js
48
- var at = (isOptionalObject, object, index) => {
49
- if (isOptionalObject && (object === void 0 || object === null)) {
50
- return;
51
- }
52
- if (Array.isArray(object) || typeof object === "string") {
53
- return object[index < 0 ? object.length + index : index];
54
- }
55
- return object.at(index);
56
- };
57
- var at_default = at;
58
-
59
118
  // node_modules/trim-newlines/index.js
60
119
  function trimNewlinesEnd(string) {
61
120
  let end = string.length;
@@ -65,7 +124,7 @@ function trimNewlinesEnd(string) {
65
124
  return end < string.length ? string.slice(0, end) : string;
66
125
  }
67
126
 
68
- // src/document/utils/get-doc-type.js
127
+ // src/document/utilities/get-doc-type.js
69
128
  function getDocType(doc) {
70
129
  if (typeof doc === "string") {
71
130
  return DOC_TYPE_STRING;
@@ -83,7 +142,7 @@ function getDocType(doc) {
83
142
  }
84
143
  var get_doc_type_default = getDocType;
85
144
 
86
- // src/document/invalid-doc-error.js
145
+ // src/document/utilities/invalid-doc-error.js
87
146
  var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
88
147
  function getDocErrorMessage(doc) {
89
148
  const type = doc === null ? "null" : typeof doc;
@@ -113,7 +172,7 @@ var InvalidDocError = class extends Error {
113
172
  };
114
173
  var invalid_doc_error_default = InvalidDocError;
115
174
 
116
- // src/document/utils/traverse-doc.js
175
+ // src/document/utilities/traverse-doc.js
117
176
  var traverseDocOnExitStackMarker = {};
118
177
  function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
119
178
  const docsStack = [doc];
@@ -130,7 +189,7 @@ function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
130
189
  if (!docType) {
131
190
  throw new invalid_doc_error_default(doc2);
132
191
  }
133
- if ((onEnter == null ? void 0 : onEnter(doc2)) === false) {
192
+ if (onEnter?.(doc2) === false) {
134
193
  continue;
135
194
  }
136
195
  switch (docType) {
@@ -175,7 +234,7 @@ function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
175
234
  }
176
235
  var traverse_doc_default = traverseDoc;
177
236
 
178
- // src/document/utils.js
237
+ // src/document/utilities/index.js
179
238
  function mapDoc(doc, cb) {
180
239
  if (typeof doc === "string") {
181
240
  return cb(doc);
@@ -195,7 +254,10 @@ function mapDoc(doc, cb) {
195
254
  case DOC_TYPE_ARRAY:
196
255
  return cb(doc2.map(rec));
197
256
  case DOC_TYPE_FILL:
198
- return cb({ ...doc2, parts: doc2.parts.map(rec) });
257
+ return cb({
258
+ ...doc2,
259
+ parts: doc2.parts.map(rec)
260
+ });
199
261
  case DOC_TYPE_IF_BREAK:
200
262
  return cb({
201
263
  ...doc2,
@@ -203,21 +265,31 @@ function mapDoc(doc, cb) {
203
265
  flatContents: rec(doc2.flatContents)
204
266
  });
205
267
  case DOC_TYPE_GROUP: {
206
- let { expandedStates, contents } = doc2;
268
+ let {
269
+ expandedStates,
270
+ contents
271
+ } = doc2;
207
272
  if (expandedStates) {
208
273
  expandedStates = expandedStates.map(rec);
209
274
  contents = expandedStates[0];
210
275
  } else {
211
276
  contents = rec(contents);
212
277
  }
213
- return cb({ ...doc2, contents, expandedStates });
278
+ return cb({
279
+ ...doc2,
280
+ contents,
281
+ expandedStates
282
+ });
214
283
  }
215
284
  case DOC_TYPE_ALIGN:
216
285
  case DOC_TYPE_INDENT:
217
286
  case DOC_TYPE_INDENT_IF_BREAK:
218
287
  case DOC_TYPE_LABEL:
219
288
  case DOC_TYPE_LINE_SUFFIX:
220
- return cb({ ...doc2, contents: rec(doc2.contents) });
289
+ return cb({
290
+ ...doc2,
291
+ contents: rec(doc2.contents)
292
+ });
221
293
  case DOC_TYPE_STRING:
222
294
  case DOC_TYPE_CURSOR:
223
295
  case DOC_TYPE_TRIM:
@@ -262,9 +334,9 @@ function willBreak(doc) {
262
334
  }
263
335
  function breakParentGroup(groupStack) {
264
336
  if (groupStack.length > 0) {
265
- const parentGroup = at_default(
266
- /* isOptionalObject */
267
- false,
337
+ const parentGroup = method_at_default(
338
+ /* OPTIONAL_OBJECT: false */
339
+ 0,
268
340
  groupStack,
269
341
  -1
270
342
  );
@@ -319,23 +391,23 @@ function removeLines(doc) {
319
391
  }
320
392
  function stripTrailingHardlineFromParts(parts) {
321
393
  parts = [...parts];
322
- while (parts.length >= 2 && at_default(
323
- /* isOptionalObject */
324
- false,
394
+ while (parts.length >= 2 && method_at_default(
395
+ /* OPTIONAL_OBJECT: false */
396
+ 0,
325
397
  parts,
326
398
  -2
327
- ).type === DOC_TYPE_LINE && at_default(
328
- /* isOptionalObject */
329
- false,
399
+ ).type === DOC_TYPE_LINE && method_at_default(
400
+ /* OPTIONAL_OBJECT: false */
401
+ 0,
330
402
  parts,
331
403
  -1
332
404
  ).type === DOC_TYPE_BREAK_PARENT) {
333
405
  parts.length -= 2;
334
406
  }
335
407
  if (parts.length > 0) {
336
- const lastPart = stripTrailingHardlineFromDoc(at_default(
337
- /* isOptionalObject */
338
- false,
408
+ const lastPart = stripTrailingHardlineFromDoc(method_at_default(
409
+ /* OPTIONAL_OBJECT: false */
410
+ 0,
339
411
  parts,
340
412
  -1
341
413
  ));
@@ -351,7 +423,10 @@ function stripTrailingHardlineFromDoc(doc) {
351
423
  case DOC_TYPE_LINE_SUFFIX:
352
424
  case DOC_TYPE_LABEL: {
353
425
  const contents = stripTrailingHardlineFromDoc(doc.contents);
354
- return { ...doc, contents };
426
+ return {
427
+ ...doc,
428
+ contents
429
+ };
355
430
  }
356
431
  case DOC_TYPE_IF_BREAK:
357
432
  return {
@@ -360,7 +435,10 @@ function stripTrailingHardlineFromDoc(doc) {
360
435
  flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
361
436
  };
362
437
  case DOC_TYPE_FILL:
363
- return { ...doc, parts: stripTrailingHardlineFromParts(doc.parts) };
438
+ return {
439
+ ...doc,
440
+ parts: stripTrailingHardlineFromParts(doc.parts)
441
+ };
364
442
  case DOC_TYPE_ARRAY:
365
443
  return stripTrailingHardlineFromParts(doc);
366
444
  case DOC_TYPE_STRING:
@@ -415,9 +493,9 @@ function cleanDocFn(doc) {
415
493
  continue;
416
494
  }
417
495
  const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
418
- if (typeof currentPart === "string" && typeof at_default(
419
- /* isOptionalObject */
420
- false,
496
+ if (typeof currentPart === "string" && typeof method_at_default(
497
+ /* OPTIONAL_OBJECT: false */
498
+ 0,
421
499
  parts,
422
500
  -1
423
501
  ) === "string") {
@@ -452,10 +530,7 @@ function cleanDoc(doc) {
452
530
  return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
453
531
  }
454
532
  function replaceEndOfLine(doc, replacement = literalline) {
455
- return mapDoc(
456
- doc,
457
- (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc
458
- );
533
+ return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc);
459
534
  }
460
535
  function canBreakFn(doc) {
461
536
  if (doc.type === DOC_TYPE_LINE) {
@@ -466,39 +541,46 @@ function canBreak(doc) {
466
541
  return findInDoc(doc, canBreakFn, false);
467
542
  }
468
543
 
469
- // src/document/utils/assert-doc.js
470
- var noop = () => {
471
- };
472
- var assertDoc = true ? noop : function(doc) {
473
- traverse_doc_default(doc, (doc2) => {
474
- if (checked.has(doc2)) {
475
- return false;
476
- }
477
- if (typeof doc2 !== "string") {
544
+ // src/document/utilities/assert-doc.js
545
+ var assertDoc = true ? noop_default : (
546
+ /**
547
+ @param {Doc} doc
548
+ */
549
+ function(doc) {
550
+ traverse_doc_default(doc, (doc2) => {
551
+ if (typeof doc2 === "string" || checked.has(doc2)) {
552
+ return false;
553
+ }
478
554
  checked.add(doc2);
479
- }
480
- });
481
- };
482
- var assertDocArray = true ? noop : function(docs, optional = false) {
483
- if (optional && !docs) {
484
- return;
485
- }
486
- if (!Array.isArray(docs)) {
487
- throw new TypeError("Unexpected doc array.");
555
+ });
488
556
  }
489
- for (const doc of docs) {
490
- assertDoc(doc);
557
+ );
558
+ var assertDocArray = true ? noop_default : (
559
+ /**
560
+ @param {readonly Doc[]} docs
561
+ @param {boolean} [optional = false]
562
+ */
563
+ function(docs, optional = false) {
564
+ if (optional && !docs) {
565
+ return;
566
+ }
567
+ if (!Array.isArray(docs)) {
568
+ throw new TypeError("Unexpected doc array.");
569
+ }
570
+ for (const doc of docs) {
571
+ assertDoc(doc);
572
+ }
491
573
  }
492
- };
493
- var assertDocFillParts = true ? noop : (
574
+ );
575
+ var assertDocFillParts = true ? noop_default : (
494
576
  /**
495
- * @param {Doc[]} parts
496
- */
577
+ @param {readonly Doc[]} parts
578
+ */
497
579
  function(parts) {
498
580
  assertDocArray(parts);
499
- if (parts.length > 1 && isEmptyDoc(at_default(
500
- /* isOptionalObject */
501
- false,
581
+ if (parts.length > 1 && isEmptyDoc(method_at_default(
582
+ /* OPTIONAL_OBJECT: false */
583
+ 0,
502
584
  parts,
503
585
  -1
504
586
  ))) {
@@ -507,37 +589,28 @@ var assertDocFillParts = true ? noop : (
507
589
  for (const [i, doc] of parts.entries()) {
508
590
  if (i % 2 === 1 && !isValidSeparator(doc)) {
509
591
  const type = get_doc_type_default(doc);
510
- throw new Error(
511
- `Unexpected non-line-break doc at ${i}. Doc type is ${type}.`
512
- );
592
+ throw new Error(`Unexpected non-line-break doc at ${i}. Doc type is ${type}.`);
513
593
  }
514
594
  }
515
595
  }
516
596
  );
597
+ var assertAlignType = true ? noop_default : function(alignType) {
598
+ if (!(typeof alignType === "number" || typeof alignType === "string" || alignType?.type === "root")) {
599
+ throw new TypeError(`Invalid alignType '${alignType}'.`);
600
+ }
601
+ };
517
602
 
518
- // src/document/builders.js
603
+ // src/document/builders/indent.js
519
604
  function indent(contents) {
520
605
  assertDoc(contents);
521
606
  return { type: DOC_TYPE_INDENT, contents };
522
607
  }
523
- function align(widthOrString, contents) {
524
- assertDoc(contents);
525
- return { type: DOC_TYPE_ALIGN, contents, n: widthOrString };
526
- }
527
- function group(contents, opts = {}) {
608
+
609
+ // src/document/builders/align.js
610
+ function align(alignType, contents) {
611
+ assertAlignType(alignType);
528
612
  assertDoc(contents);
529
- assertDocArray(
530
- opts.expandedStates,
531
- /* optional */
532
- true
533
- );
534
- return {
535
- type: DOC_TYPE_GROUP,
536
- id: opts.id,
537
- contents,
538
- break: Boolean(opts.shouldBreak),
539
- expandedStates: opts.expandedStates
540
- };
613
+ return { type: DOC_TYPE_ALIGN, contents, n: alignType };
541
614
  }
542
615
  function dedentToRoot(contents) {
543
616
  return align(Number.NEGATIVE_INFINITY, contents);
@@ -548,14 +621,53 @@ function markAsRoot(contents) {
548
621
  function dedent(contents) {
549
622
  return align(-1, contents);
550
623
  }
551
- function conditionalGroup(states, opts) {
552
- return group(states[0], { ...opts, expandedStates: states });
624
+ function addAlignmentToDoc(doc, size, tabWidth) {
625
+ assertDoc(doc);
626
+ let aligned = doc;
627
+ if (size > 0) {
628
+ for (let level = 0; level < Math.floor(size / tabWidth); ++level) {
629
+ aligned = indent(aligned);
630
+ }
631
+ aligned = align(size % tabWidth, aligned);
632
+ aligned = align(Number.NEGATIVE_INFINITY, aligned);
633
+ }
634
+ return aligned;
553
635
  }
636
+
637
+ // src/document/builders/break-parent.js
638
+ var breakParent = { type: DOC_TYPE_BREAK_PARENT };
639
+
640
+ // src/document/builders/cursor.js
641
+ var cursor = { type: DOC_TYPE_CURSOR };
642
+
643
+ // src/document/builders/fill.js
554
644
  function fill(parts) {
555
645
  assertDocFillParts(parts);
556
646
  return { type: DOC_TYPE_FILL, parts };
557
647
  }
558
- function ifBreak(breakContents, flatContents = "", opts = {}) {
648
+
649
+ // src/document/builders/group.js
650
+ function group(contents, options = {}) {
651
+ assertDoc(contents);
652
+ assertDocArray(
653
+ options.expandedStates,
654
+ /* optional */
655
+ true
656
+ );
657
+ return {
658
+ type: DOC_TYPE_GROUP,
659
+ id: options.id,
660
+ contents,
661
+ break: Boolean(options.shouldBreak),
662
+ expandedStates: options.expandedStates
663
+ };
664
+ }
665
+ function conditionalGroup(states, options) {
666
+ return group(states[0], { ...options, expandedStates: states });
667
+ }
668
+
669
+ // src/document/builders/if-break.js
670
+ function ifBreak(breakContents, flatContents = "", options = {}) {
559
671
  assertDoc(breakContents);
560
672
  if (flatContents !== "") {
561
673
  assertDoc(flatContents);
@@ -564,36 +676,22 @@ function ifBreak(breakContents, flatContents = "", opts = {}) {
564
676
  type: DOC_TYPE_IF_BREAK,
565
677
  breakContents,
566
678
  flatContents,
567
- groupId: opts.groupId
679
+ groupId: options.groupId
568
680
  };
569
681
  }
570
- function indentIfBreak(contents, opts) {
682
+
683
+ // src/document/builders/indent-if-break.js
684
+ function indentIfBreak(contents, options) {
571
685
  assertDoc(contents);
572
686
  return {
573
687
  type: DOC_TYPE_INDENT_IF_BREAK,
574
688
  contents,
575
- groupId: opts.groupId,
576
- negate: opts.negate
689
+ groupId: options.groupId,
690
+ negate: options.negate
577
691
  };
578
692
  }
579
- function lineSuffix(contents) {
580
- assertDoc(contents);
581
- return { type: DOC_TYPE_LINE_SUFFIX, contents };
582
- }
583
- var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
584
- var breakParent = { type: DOC_TYPE_BREAK_PARENT };
585
- var trim = { type: DOC_TYPE_TRIM };
586
- var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
587
- var literallineWithoutBreakParent = {
588
- type: DOC_TYPE_LINE,
589
- hard: true,
590
- literal: true
591
- };
592
- var line = { type: DOC_TYPE_LINE };
593
- var softline = { type: DOC_TYPE_LINE, soft: true };
594
- var hardline = [hardlineWithoutBreakParent, breakParent];
595
- var literalline = [literallineWithoutBreakParent, breakParent];
596
- var cursor = { type: DOC_TYPE_CURSOR };
693
+
694
+ // src/document/builders/join.js
597
695
  function join(separator, docs) {
598
696
  assertDoc(separator);
599
697
  assertDocArray(docs);
@@ -606,37 +704,50 @@ function join(separator, docs) {
606
704
  }
607
705
  return parts;
608
706
  }
609
- function addAlignmentToDoc(doc, size, tabWidth) {
610
- assertDoc(doc);
611
- let aligned = doc;
612
- if (size > 0) {
613
- for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
614
- aligned = indent(aligned);
615
- }
616
- aligned = align(size % tabWidth, aligned);
617
- aligned = align(Number.NEGATIVE_INFINITY, aligned);
618
- }
619
- return aligned;
620
- }
707
+
708
+ // src/document/builders/label.js
621
709
  function label(label2, contents) {
622
710
  assertDoc(contents);
623
711
  return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
624
712
  }
625
713
 
626
- // scripts/build/shims/string-replace-all.js
627
- var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
628
- if (isOptionalObject && (original === void 0 || original === null)) {
629
- return;
630
- }
631
- if (original.replaceAll) {
632
- return original.replaceAll(pattern, replacement);
633
- }
714
+ // src/document/builders/line.js
715
+ var line = { type: DOC_TYPE_LINE };
716
+ var softline = { type: DOC_TYPE_LINE, soft: true };
717
+ var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
718
+ var hardline = [hardlineWithoutBreakParent, breakParent];
719
+ var literallineWithoutBreakParent = {
720
+ type: DOC_TYPE_LINE,
721
+ hard: true,
722
+ literal: true
723
+ };
724
+ var literalline = [literallineWithoutBreakParent, breakParent];
725
+
726
+ // src/document/builders/line-suffix.js
727
+ function lineSuffix(contents) {
728
+ assertDoc(contents);
729
+ return { type: DOC_TYPE_LINE_SUFFIX, contents };
730
+ }
731
+
732
+ // src/document/builders/line-suffix-boundary.js
733
+ var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
734
+
735
+ // src/document/builders/trim.js
736
+ var trim = { type: DOC_TYPE_TRIM };
737
+
738
+ // scripts/build/shims/method-replace-all.js
739
+ var stringReplaceAll = String.prototype.replaceAll ?? function(pattern, replacement) {
634
740
  if (pattern.global) {
635
- return original.replace(pattern, replacement);
741
+ return this.replace(pattern, replacement);
636
742
  }
637
- return original.split(pattern).join(replacement);
743
+ return this.split(pattern).join(replacement);
638
744
  };
639
- var string_replace_all_default = stringReplaceAll;
745
+ var replaceAll = createMethodShim("replaceAll", function() {
746
+ if (typeof this === "string") {
747
+ return stringReplaceAll;
748
+ }
749
+ });
750
+ var method_replace_all_default = replaceAll;
640
751
 
641
752
  // src/common/end-of-line.js
642
753
  function convertEndOfLineToChars(value) {
@@ -652,7 +763,7 @@ function convertEndOfLineToChars(value) {
652
763
 
653
764
  // node_modules/emoji-regex/index.mjs
654
765
  var emoji_regex_default = () => {
655
- return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\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;
766
+ return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\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-\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-\uDED8\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\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]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\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]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\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\uDD3C-\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-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\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\uDE70]|\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\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]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\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;
656
767
  };
657
768
 
658
769
  // node_modules/get-east-asian-width/lookup.js
@@ -660,14 +771,15 @@ function isFullWidth(x) {
660
771
  return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
661
772
  }
662
773
  function isWide(x) {
663
- return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
774
+ return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x >= 94192 && x <= 94198 || x >= 94208 && x <= 101589 || x >= 101631 && x <= 101662 || x >= 101760 && x <= 101874 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128728 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129674 || x >= 129678 && x <= 129734 || x === 129736 || x >= 129741 && x <= 129756 || x >= 129759 && x <= 129770 || x >= 129775 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
664
775
  }
665
776
 
666
- // node_modules/get-east-asian-width/index.js
667
- var _isNarrowWidth = (codePoint) => !(isFullWidth(codePoint) || isWide(codePoint));
777
+ // src/utils/narrow-emojis.evaluate.js
778
+ var narrow_emojis_evaluate_default = "\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07";
668
779
 
669
780
  // src/utils/get-string-width.js
670
781
  var notAsciiRegex = /[^\x20-\x7F]/u;
782
+ var narrowEmojisSet = new Set(narrow_emojis_evaluate_default);
671
783
  function getStringWidth(text) {
672
784
  if (!text) {
673
785
  return 0;
@@ -675,7 +787,10 @@ function getStringWidth(text) {
675
787
  if (!notAsciiRegex.test(text)) {
676
788
  return text.length;
677
789
  }
678
- text = text.replace(emoji_regex_default(), " ");
790
+ text = text.replace(
791
+ emoji_regex_default(),
792
+ (match) => narrowEmojisSet.has(match) ? " " : " "
793
+ );
679
794
  let width = 0;
680
795
  for (const character of text) {
681
796
  const codePoint = character.codePointAt(0);
@@ -685,48 +800,39 @@ function getStringWidth(text) {
685
800
  if (codePoint >= 768 && codePoint <= 879) {
686
801
  continue;
687
802
  }
688
- width += _isNarrowWidth(codePoint) ? 1 : 2;
803
+ if (codePoint >= 65024 && codePoint <= 65039) {
804
+ continue;
805
+ }
806
+ width += isFullWidth(codePoint) || isWide(codePoint) ? 2 : 1;
689
807
  }
690
808
  return width;
691
809
  }
692
810
  var get_string_width_default = getStringWidth;
693
811
 
694
- // src/document/printer.js
695
- var MODE_BREAK = Symbol("MODE_BREAK");
696
- var MODE_FLAT = Symbol("MODE_FLAT");
697
- var CURSOR_PLACEHOLDER = Symbol("cursor");
698
- var DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
699
- function rootIndent() {
700
- return { value: "", length: 0, queue: [] };
701
- }
702
- function makeIndent(ind, options) {
703
- return generateInd(ind, { type: "indent" }, options);
704
- }
705
- function makeAlign(indent2, widthOrDoc, options) {
706
- if (widthOrDoc === Number.NEGATIVE_INFINITY) {
707
- return indent2.root || rootIndent();
708
- }
709
- if (widthOrDoc < 0) {
710
- return generateInd(indent2, { type: "dedent" }, options);
812
+ // src/document/printer/indent.js
813
+ var INDENT_COMMAND_TYPE_INDENT = 0;
814
+ var INDENT_COMMAND_TYPE_DEDENT = 1;
815
+ var INDENT_COMMAND_TYPE_WIDTH = 2;
816
+ var INDENT_COMMAND_TYPE_STRING = 3;
817
+ var INDENT_COMMAND_INDENT = { type: INDENT_COMMAND_TYPE_INDENT };
818
+ var INDENT_COMMAND_DEDENT = { type: INDENT_COMMAND_TYPE_DEDENT };
819
+ var ROOT_INDENT = {
820
+ value: "",
821
+ length: 0,
822
+ queue: [],
823
+ get root() {
824
+ return ROOT_INDENT;
711
825
  }
712
- if (!widthOrDoc) {
713
- return indent2;
714
- }
715
- if (widthOrDoc.type === "root") {
716
- return { ...indent2, root: indent2 };
717
- }
718
- const alignType = typeof widthOrDoc === "string" ? "stringAlign" : "numberAlign";
719
- return generateInd(indent2, { type: alignType, n: widthOrDoc }, options);
720
- }
721
- function generateInd(ind, newPart, options) {
722
- const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : [...ind.queue, newPart];
826
+ };
827
+ function generateIndent(indent2, command, options) {
828
+ const queue = command.type === INDENT_COMMAND_TYPE_DEDENT ? indent2.queue.slice(0, -1) : [...indent2.queue, command];
723
829
  let value = "";
724
830
  let length = 0;
725
831
  let lastTabs = 0;
726
832
  let lastSpaces = 0;
727
- for (const part of queue) {
728
- switch (part.type) {
729
- case "indent":
833
+ for (const command2 of queue) {
834
+ switch (command2.type) {
835
+ case INDENT_COMMAND_TYPE_INDENT:
730
836
  flush();
731
837
  if (options.useTabs) {
732
838
  addTabs(1);
@@ -734,21 +840,25 @@ function generateInd(ind, newPart, options) {
734
840
  addSpaces(options.tabWidth);
735
841
  }
736
842
  break;
737
- case "stringAlign":
843
+ case INDENT_COMMAND_TYPE_STRING: {
844
+ const { string } = command2;
738
845
  flush();
739
- value += part.n;
740
- length += part.n.length;
846
+ value += string;
847
+ length += string.length;
741
848
  break;
742
- case "numberAlign":
849
+ }
850
+ case INDENT_COMMAND_TYPE_WIDTH: {
851
+ const { width } = command2;
743
852
  lastTabs += 1;
744
- lastSpaces += part.n;
853
+ lastSpaces += width;
745
854
  break;
855
+ }
746
856
  default:
747
- throw new Error(`Unexpected type '${part.type}'`);
857
+ throw new Error(`Unexpected indent comment '${command2.type}'.`);
748
858
  }
749
859
  }
750
860
  flushSpaces();
751
- return { ...ind, value, length, queue };
861
+ return { ...indent2, value, length, queue };
752
862
  function addTabs(count) {
753
863
  value += " ".repeat(count);
754
864
  length += options.tabWidth * count;
@@ -781,65 +891,97 @@ function generateInd(ind, newPart, options) {
781
891
  lastSpaces = 0;
782
892
  }
783
893
  }
784
- function trim2(out) {
785
- let trimCount = 0;
786
- let cursorCount = 0;
787
- let outIndex = out.length;
788
- outer: while (outIndex--) {
789
- const last = out[outIndex];
790
- if (last === CURSOR_PLACEHOLDER) {
791
- cursorCount++;
792
- continue;
793
- }
794
- if (false) {
795
- throw new Error(`Unexpected value in trim: '${typeof last}'`);
796
- }
797
- for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) {
798
- const char = last[charIndex];
799
- if (char === " " || char === " ") {
800
- trimCount++;
801
- } else {
802
- out[outIndex] = last.slice(0, charIndex + 1);
803
- break outer;
804
- }
894
+ function makeAlign(indent2, indentOptions, options) {
895
+ if (!indentOptions) {
896
+ return indent2;
897
+ }
898
+ if (indentOptions.type === "root") {
899
+ return { ...indent2, root: indent2 };
900
+ }
901
+ if (indentOptions === Number.NEGATIVE_INFINITY) {
902
+ return indent2.root;
903
+ }
904
+ let command;
905
+ if (typeof indentOptions === "number") {
906
+ if (indentOptions < 0) {
907
+ command = INDENT_COMMAND_DEDENT;
908
+ } else {
909
+ command = { type: INDENT_COMMAND_TYPE_WIDTH, width: indentOptions };
805
910
  }
911
+ } else {
912
+ command = { type: INDENT_COMMAND_TYPE_STRING, string: indentOptions };
806
913
  }
807
- if (trimCount > 0 || cursorCount > 0) {
808
- out.length = outIndex + 1;
809
- while (cursorCount-- > 0) {
810
- out.push(CURSOR_PLACEHOLDER);
914
+ return generateIndent(indent2, command, options);
915
+ }
916
+ function makeIndent(indent2, options) {
917
+ return generateIndent(indent2, INDENT_COMMAND_INDENT, options);
918
+ }
919
+
920
+ // src/document/printer/trim-indentation.js
921
+ function getTrailingIndentionLength(text) {
922
+ let length = 0;
923
+ for (let index = text.length - 1; index >= 0; index--) {
924
+ const character = text[index];
925
+ if (character === " " || character === " ") {
926
+ length++;
927
+ } else {
928
+ break;
811
929
  }
812
930
  }
813
- return trimCount;
931
+ return length;
814
932
  }
815
- function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) {
816
- if (width === Number.POSITIVE_INFINITY) {
933
+ function trimIndentation(text) {
934
+ const length = getTrailingIndentionLength(text);
935
+ const trimmed = length === 0 ? text : text.slice(0, text.length - length);
936
+ return { text: trimmed, count: length };
937
+ }
938
+
939
+ // src/document/printer/printer.js
940
+ var MODE_BREAK = Symbol("MODE_BREAK");
941
+ var MODE_FLAT = Symbol("MODE_FLAT");
942
+ var DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
943
+ function fits(next, restCommands, remainingWidth, hasLineSuffix, groupModeMap, mustBeFlat) {
944
+ if (remainingWidth === Number.POSITIVE_INFINITY) {
817
945
  return true;
818
946
  }
819
- let restIdx = restCommands.length;
820
- const cmds = [next];
821
- const out = [];
822
- while (width >= 0) {
823
- if (cmds.length === 0) {
824
- if (restIdx === 0) {
947
+ let restCommandsIndex = restCommands.length;
948
+ let hasPendingSpace = false;
949
+ const commands = [next];
950
+ let output = "";
951
+ while (remainingWidth >= 0) {
952
+ if (commands.length === 0) {
953
+ if (restCommandsIndex === 0) {
825
954
  return true;
826
955
  }
827
- cmds.push(restCommands[--restIdx]);
956
+ commands.push(restCommands[--restCommandsIndex]);
828
957
  continue;
829
958
  }
830
- const { mode, doc } = cmds.pop();
959
+ const {
960
+ mode,
961
+ doc
962
+ } = commands.pop();
831
963
  const docType = get_doc_type_default(doc);
832
964
  switch (docType) {
833
965
  case DOC_TYPE_STRING:
834
- out.push(doc);
835
- width -= get_string_width_default(doc);
966
+ if (doc) {
967
+ if (hasPendingSpace) {
968
+ output += " ";
969
+ remainingWidth -= 1;
970
+ hasPendingSpace = false;
971
+ }
972
+ output += doc;
973
+ remainingWidth -= get_string_width_default(doc);
974
+ }
836
975
  break;
837
976
  case DOC_TYPE_ARRAY:
838
977
  case DOC_TYPE_FILL: {
839
978
  const parts = docType === DOC_TYPE_ARRAY ? doc : doc.parts;
840
979
  const end = doc[DOC_FILL_PRINTED_LENGTH] ?? 0;
841
- for (let i = parts.length - 1; i >= end; i--) {
842
- cmds.push({ mode, doc: parts[i] });
980
+ for (let index = parts.length - 1; index >= end; index--) {
981
+ commands.push({
982
+ mode,
983
+ doc: parts[index]
984
+ });
843
985
  }
844
986
  break;
845
987
  }
@@ -847,30 +989,45 @@ function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat
847
989
  case DOC_TYPE_ALIGN:
848
990
  case DOC_TYPE_INDENT_IF_BREAK:
849
991
  case DOC_TYPE_LABEL:
850
- cmds.push({ mode, doc: doc.contents });
992
+ commands.push({
993
+ mode,
994
+ doc: doc.contents
995
+ });
851
996
  break;
852
- case DOC_TYPE_TRIM:
853
- width += trim2(out);
997
+ case DOC_TYPE_TRIM: {
998
+ const {
999
+ text,
1000
+ count
1001
+ } = trimIndentation(output);
1002
+ output = text;
1003
+ remainingWidth += count;
854
1004
  break;
1005
+ }
855
1006
  case DOC_TYPE_GROUP: {
856
1007
  if (mustBeFlat && doc.break) {
857
1008
  return false;
858
1009
  }
859
1010
  const groupMode = doc.break ? MODE_BREAK : mode;
860
- const contents = doc.expandedStates && groupMode === MODE_BREAK ? at_default(
861
- /* isOptionalObject */
862
- false,
1011
+ const contents = doc.expandedStates && groupMode === MODE_BREAK ? method_at_default(
1012
+ /* OPTIONAL_OBJECT: false */
1013
+ 0,
863
1014
  doc.expandedStates,
864
1015
  -1
865
1016
  ) : doc.contents;
866
- cmds.push({ mode: groupMode, doc: contents });
1017
+ commands.push({
1018
+ mode: groupMode,
1019
+ doc: contents
1020
+ });
867
1021
  break;
868
1022
  }
869
1023
  case DOC_TYPE_IF_BREAK: {
870
1024
  const groupMode = doc.groupId ? groupModeMap[doc.groupId] || MODE_FLAT : mode;
871
1025
  const contents = groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents;
872
1026
  if (contents) {
873
- cmds.push({ mode, doc: contents });
1027
+ commands.push({
1028
+ mode,
1029
+ doc: contents
1030
+ });
874
1031
  }
875
1032
  break;
876
1033
  }
@@ -879,8 +1036,7 @@ function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat
879
1036
  return true;
880
1037
  }
881
1038
  if (!doc.soft) {
882
- out.push(" ");
883
- width--;
1039
+ hasPendingSpace = true;
884
1040
  }
885
1041
  break;
886
1042
  case DOC_TYPE_LINE_SUFFIX:
@@ -896,64 +1052,84 @@ function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat
896
1052
  return false;
897
1053
  }
898
1054
  function printDocToString(doc, options) {
899
- const groupModeMap = {};
1055
+ const groupModeMap = /* @__PURE__ */ Object.create(null);
900
1056
  const width = options.printWidth;
901
1057
  const newLine = convertEndOfLineToChars(options.endOfLine);
902
- let pos = 0;
903
- const cmds = [{ ind: rootIndent(), mode: MODE_BREAK, doc }];
904
- const out = [];
1058
+ let position = 0;
1059
+ const commands = [{
1060
+ indent: ROOT_INDENT,
1061
+ mode: MODE_BREAK,
1062
+ doc
1063
+ }];
1064
+ let output = "";
905
1065
  let shouldRemeasure = false;
906
1066
  const lineSuffix2 = [];
907
- let printedCursorCount = 0;
1067
+ const cursorPositions = [];
1068
+ const settledOutput = [];
1069
+ const settledCursorPositions = [];
1070
+ let settledTextLength = 0;
908
1071
  propagateBreaks(doc);
909
- while (cmds.length > 0) {
910
- const { ind, mode, doc: doc2 } = cmds.pop();
1072
+ while (commands.length > 0) {
1073
+ const {
1074
+ indent: indent2,
1075
+ mode,
1076
+ doc: doc2
1077
+ } = commands.pop();
911
1078
  switch (get_doc_type_default(doc2)) {
912
1079
  case DOC_TYPE_STRING: {
913
- const formatted = newLine !== "\n" ? string_replace_all_default(
914
- /* isOptionalObject */
915
- false,
1080
+ const formatted2 = newLine !== "\n" ? method_replace_all_default(
1081
+ /* OPTIONAL_OBJECT: false */
1082
+ 0,
916
1083
  doc2,
917
1084
  "\n",
918
1085
  newLine
919
1086
  ) : doc2;
920
- out.push(formatted);
921
- if (cmds.length > 0) {
922
- pos += get_string_width_default(formatted);
1087
+ if (formatted2) {
1088
+ output += formatted2;
1089
+ if (commands.length > 0) {
1090
+ position += get_string_width_default(formatted2);
1091
+ }
923
1092
  }
924
1093
  break;
925
1094
  }
926
1095
  case DOC_TYPE_ARRAY:
927
- for (let i = doc2.length - 1; i >= 0; i--) {
928
- cmds.push({ ind, mode, doc: doc2[i] });
1096
+ for (let index = doc2.length - 1; index >= 0; index--) {
1097
+ commands.push({
1098
+ indent: indent2,
1099
+ mode,
1100
+ doc: doc2[index]
1101
+ });
929
1102
  }
930
1103
  break;
931
1104
  case DOC_TYPE_CURSOR:
932
- if (printedCursorCount >= 2) {
1105
+ if (cursorPositions.length >= 2) {
933
1106
  throw new Error("There are too many 'cursor' in doc.");
934
1107
  }
935
- out.push(CURSOR_PLACEHOLDER);
936
- printedCursorCount++;
1108
+ cursorPositions.push(settledTextLength + output.length);
937
1109
  break;
938
1110
  case DOC_TYPE_INDENT:
939
- cmds.push({ ind: makeIndent(ind, options), mode, doc: doc2.contents });
1111
+ commands.push({
1112
+ indent: makeIndent(indent2, options),
1113
+ mode,
1114
+ doc: doc2.contents
1115
+ });
940
1116
  break;
941
1117
  case DOC_TYPE_ALIGN:
942
- cmds.push({
943
- ind: makeAlign(ind, doc2.n, options),
1118
+ commands.push({
1119
+ indent: makeAlign(indent2, doc2.n, options),
944
1120
  mode,
945
1121
  doc: doc2.contents
946
1122
  });
947
1123
  break;
948
1124
  case DOC_TYPE_TRIM:
949
- pos -= trim2(out);
1125
+ trim2();
950
1126
  break;
951
1127
  case DOC_TYPE_GROUP:
952
1128
  switch (mode) {
953
1129
  case MODE_FLAT:
954
1130
  if (!shouldRemeasure) {
955
- cmds.push({
956
- ind,
1131
+ commands.push({
1132
+ indent: indent2,
957
1133
  mode: doc2.break ? MODE_BREAK : MODE_FLAT,
958
1134
  doc: doc2.contents
959
1135
  });
@@ -962,49 +1138,69 @@ function printDocToString(doc, options) {
962
1138
  // fallthrough
963
1139
  case MODE_BREAK: {
964
1140
  shouldRemeasure = false;
965
- const next = { ind, mode: MODE_FLAT, doc: doc2.contents };
966
- const rem = width - pos;
1141
+ const next = {
1142
+ indent: indent2,
1143
+ mode: MODE_FLAT,
1144
+ doc: doc2.contents
1145
+ };
1146
+ const remainingWidth = width - position;
967
1147
  const hasLineSuffix = lineSuffix2.length > 0;
968
- if (!doc2.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) {
969
- cmds.push(next);
1148
+ if (!doc2.break && fits(next, commands, remainingWidth, hasLineSuffix, groupModeMap)) {
1149
+ commands.push(next);
970
1150
  } else {
971
1151
  if (doc2.expandedStates) {
972
- const mostExpanded = at_default(
973
- /* isOptionalObject */
974
- false,
1152
+ const mostExpanded = method_at_default(
1153
+ /* OPTIONAL_OBJECT: false */
1154
+ 0,
975
1155
  doc2.expandedStates,
976
1156
  -1
977
1157
  );
978
1158
  if (doc2.break) {
979
- cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded });
1159
+ commands.push({
1160
+ indent: indent2,
1161
+ mode: MODE_BREAK,
1162
+ doc: mostExpanded
1163
+ });
980
1164
  break;
981
1165
  } else {
982
- for (let i = 1; i < doc2.expandedStates.length + 1; i++) {
983
- if (i >= doc2.expandedStates.length) {
984
- cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded });
1166
+ for (let index = 1; index < doc2.expandedStates.length + 1; index++) {
1167
+ if (index >= doc2.expandedStates.length) {
1168
+ commands.push({
1169
+ indent: indent2,
1170
+ mode: MODE_BREAK,
1171
+ doc: mostExpanded
1172
+ });
985
1173
  break;
986
1174
  } else {
987
- const state = doc2.expandedStates[i];
988
- const cmd = { ind, mode: MODE_FLAT, doc: state };
989
- if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) {
990
- cmds.push(cmd);
1175
+ const state = doc2.expandedStates[index];
1176
+ const cmd = {
1177
+ indent: indent2,
1178
+ mode: MODE_FLAT,
1179
+ doc: state
1180
+ };
1181
+ if (fits(cmd, commands, remainingWidth, hasLineSuffix, groupModeMap)) {
1182
+ commands.push(cmd);
991
1183
  break;
992
1184
  }
993
1185
  }
994
1186
  }
995
1187
  }
996
1188
  } else {
997
- cmds.push({ ind, mode: MODE_BREAK, doc: doc2.contents });
1189
+ commands.push({
1190
+ indent: indent2,
1191
+ mode: MODE_BREAK,
1192
+ doc: doc2.contents
1193
+ });
998
1194
  }
999
1195
  }
1000
1196
  break;
1001
1197
  }
1002
1198
  }
1003
1199
  if (doc2.id) {
1004
- groupModeMap[doc2.id] = at_default(
1005
- /* isOptionalObject */
1006
- false,
1007
- cmds,
1200
+ groupModeMap[doc2.id] = method_at_default(
1201
+ /* OPTIONAL_OBJECT: false */
1202
+ 0,
1203
+ commands,
1008
1204
  -1
1009
1205
  ).mode;
1010
1206
  }
@@ -1030,68 +1226,76 @@ function printDocToString(doc, options) {
1030
1226
  // * Neither content item fits on the line without breaking
1031
1227
  // -> output the first content item and the whitespace with "break".
1032
1228
  case DOC_TYPE_FILL: {
1033
- const rem = width - pos;
1229
+ const remainingWidth = width - position;
1034
1230
  const offset = doc2[DOC_FILL_PRINTED_LENGTH] ?? 0;
1035
- const { parts } = doc2;
1231
+ const {
1232
+ parts
1233
+ } = doc2;
1036
1234
  const length = parts.length - offset;
1037
1235
  if (length === 0) {
1038
1236
  break;
1039
1237
  }
1040
1238
  const content = parts[offset + 0];
1041
1239
  const whitespace = parts[offset + 1];
1042
- const contentFlatCmd = { ind, mode: MODE_FLAT, doc: content };
1043
- const contentBreakCmd = { ind, mode: MODE_BREAK, doc: content };
1044
- const contentFits = fits(
1045
- contentFlatCmd,
1046
- [],
1047
- rem,
1048
- lineSuffix2.length > 0,
1049
- groupModeMap,
1050
- true
1051
- );
1240
+ const contentFlatCommand = {
1241
+ indent: indent2,
1242
+ mode: MODE_FLAT,
1243
+ doc: content
1244
+ };
1245
+ const contentBreakCommand = {
1246
+ indent: indent2,
1247
+ mode: MODE_BREAK,
1248
+ doc: content
1249
+ };
1250
+ const contentFits = fits(contentFlatCommand, [], remainingWidth, lineSuffix2.length > 0, groupModeMap, true);
1052
1251
  if (length === 1) {
1053
1252
  if (contentFits) {
1054
- cmds.push(contentFlatCmd);
1253
+ commands.push(contentFlatCommand);
1055
1254
  } else {
1056
- cmds.push(contentBreakCmd);
1255
+ commands.push(contentBreakCommand);
1057
1256
  }
1058
1257
  break;
1059
1258
  }
1060
- const whitespaceFlatCmd = { ind, mode: MODE_FLAT, doc: whitespace };
1061
- const whitespaceBreakCmd = { ind, mode: MODE_BREAK, doc: whitespace };
1259
+ const whitespaceFlatCommand = {
1260
+ indent: indent2,
1261
+ mode: MODE_FLAT,
1262
+ doc: whitespace
1263
+ };
1264
+ const whitespaceBreakCommand = {
1265
+ indent: indent2,
1266
+ mode: MODE_BREAK,
1267
+ doc: whitespace
1268
+ };
1062
1269
  if (length === 2) {
1063
1270
  if (contentFits) {
1064
- cmds.push(whitespaceFlatCmd, contentFlatCmd);
1271
+ commands.push(whitespaceFlatCommand, contentFlatCommand);
1065
1272
  } else {
1066
- cmds.push(whitespaceBreakCmd, contentBreakCmd);
1273
+ commands.push(whitespaceBreakCommand, contentBreakCommand);
1067
1274
  }
1068
1275
  break;
1069
1276
  }
1070
1277
  const secondContent = parts[offset + 2];
1071
- const remainingCmd = {
1072
- ind,
1278
+ const remainingCommand = {
1279
+ indent: indent2,
1073
1280
  mode,
1074
- doc: { ...doc2, [DOC_FILL_PRINTED_LENGTH]: offset + 2 }
1281
+ doc: {
1282
+ ...doc2,
1283
+ [DOC_FILL_PRINTED_LENGTH]: offset + 2
1284
+ }
1075
1285
  };
1076
- const firstAndSecondContentFlatCmd = {
1077
- ind,
1286
+ const firstAndSecondContentFlatCommand = {
1287
+ indent: indent2,
1078
1288
  mode: MODE_FLAT,
1079
1289
  doc: [content, whitespace, secondContent]
1080
1290
  };
1081
- const firstAndSecondContentFits = fits(
1082
- firstAndSecondContentFlatCmd,
1083
- [],
1084
- rem,
1085
- lineSuffix2.length > 0,
1086
- groupModeMap,
1087
- true
1088
- );
1291
+ const firstAndSecondContentFits = fits(firstAndSecondContentFlatCommand, [], remainingWidth, lineSuffix2.length > 0, groupModeMap, true);
1292
+ commands.push(remainingCommand);
1089
1293
  if (firstAndSecondContentFits) {
1090
- cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd);
1294
+ commands.push(whitespaceFlatCommand, contentFlatCommand);
1091
1295
  } else if (contentFits) {
1092
- cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd);
1296
+ commands.push(whitespaceBreakCommand, contentFlatCommand);
1093
1297
  } else {
1094
- cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd);
1298
+ commands.push(whitespaceBreakCommand, contentBreakCommand);
1095
1299
  }
1096
1300
  break;
1097
1301
  }
@@ -1101,23 +1305,39 @@ function printDocToString(doc, options) {
1101
1305
  if (groupMode === MODE_BREAK) {
1102
1306
  const breakContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.breakContents : doc2.negate ? doc2.contents : indent(doc2.contents);
1103
1307
  if (breakContents) {
1104
- cmds.push({ ind, mode, doc: breakContents });
1308
+ commands.push({
1309
+ indent: indent2,
1310
+ mode,
1311
+ doc: breakContents
1312
+ });
1105
1313
  }
1106
1314
  }
1107
1315
  if (groupMode === MODE_FLAT) {
1108
1316
  const flatContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.flatContents : doc2.negate ? indent(doc2.contents) : doc2.contents;
1109
1317
  if (flatContents) {
1110
- cmds.push({ ind, mode, doc: flatContents });
1318
+ commands.push({
1319
+ indent: indent2,
1320
+ mode,
1321
+ doc: flatContents
1322
+ });
1111
1323
  }
1112
1324
  }
1113
1325
  break;
1114
1326
  }
1115
1327
  case DOC_TYPE_LINE_SUFFIX:
1116
- lineSuffix2.push({ ind, mode, doc: doc2.contents });
1328
+ lineSuffix2.push({
1329
+ indent: indent2,
1330
+ mode,
1331
+ doc: doc2.contents
1332
+ });
1117
1333
  break;
1118
1334
  case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
1119
1335
  if (lineSuffix2.length > 0) {
1120
- cmds.push({ ind, mode, doc: hardlineWithoutBreakParent });
1336
+ commands.push({
1337
+ indent: indent2,
1338
+ mode,
1339
+ doc: hardlineWithoutBreakParent
1340
+ });
1121
1341
  }
1122
1342
  break;
1123
1343
  case DOC_TYPE_LINE:
@@ -1125,8 +1345,8 @@ function printDocToString(doc, options) {
1125
1345
  case MODE_FLAT:
1126
1346
  if (!doc2.hard) {
1127
1347
  if (!doc2.soft) {
1128
- out.push(" ");
1129
- pos += 1;
1348
+ output += " ";
1349
+ position += 1;
1130
1350
  }
1131
1351
  break;
1132
1352
  } else {
@@ -1135,60 +1355,82 @@ function printDocToString(doc, options) {
1135
1355
  // fallthrough
1136
1356
  case MODE_BREAK:
1137
1357
  if (lineSuffix2.length > 0) {
1138
- cmds.push({ ind, mode, doc: doc2 }, ...lineSuffix2.reverse());
1358
+ commands.push({
1359
+ indent: indent2,
1360
+ mode,
1361
+ doc: doc2
1362
+ }, ...lineSuffix2.reverse());
1139
1363
  lineSuffix2.length = 0;
1140
1364
  break;
1141
1365
  }
1142
1366
  if (doc2.literal) {
1143
- if (ind.root) {
1144
- out.push(newLine, ind.root.value);
1145
- pos = ind.root.length;
1146
- } else {
1147
- out.push(newLine);
1148
- pos = 0;
1367
+ output += newLine;
1368
+ position = 0;
1369
+ if (indent2.root) {
1370
+ if (indent2.root.value) {
1371
+ output += indent2.root.value;
1372
+ }
1373
+ position = indent2.root.length;
1149
1374
  }
1150
1375
  } else {
1151
- pos -= trim2(out);
1152
- out.push(newLine + ind.value);
1153
- pos = ind.length;
1376
+ trim2();
1377
+ output += newLine + indent2.value;
1378
+ position = indent2.length;
1154
1379
  }
1155
1380
  break;
1156
1381
  }
1157
1382
  break;
1158
1383
  case DOC_TYPE_LABEL:
1159
- cmds.push({ ind, mode, doc: doc2.contents });
1384
+ commands.push({
1385
+ indent: indent2,
1386
+ mode,
1387
+ doc: doc2.contents
1388
+ });
1160
1389
  break;
1161
1390
  case DOC_TYPE_BREAK_PARENT:
1162
1391
  break;
1163
1392
  default:
1164
1393
  throw new invalid_doc_error_default(doc2);
1165
1394
  }
1166
- if (cmds.length === 0 && lineSuffix2.length > 0) {
1167
- cmds.push(...lineSuffix2.reverse());
1395
+ if (commands.length === 0 && lineSuffix2.length > 0) {
1396
+ commands.push(...lineSuffix2.reverse());
1168
1397
  lineSuffix2.length = 0;
1169
1398
  }
1170
1399
  }
1171
- const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER);
1172
- if (cursorPlaceholderIndex !== -1) {
1173
- const otherCursorPlaceholderIndex = out.indexOf(
1174
- CURSOR_PLACEHOLDER,
1175
- cursorPlaceholderIndex + 1
1176
- );
1177
- if (otherCursorPlaceholderIndex === -1) {
1178
- return {
1179
- formatted: out.filter((char) => char !== CURSOR_PLACEHOLDER).join("")
1180
- };
1181
- }
1182
- const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
1183
- const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join("");
1184
- const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
1400
+ const formatted = settledOutput.join("") + output;
1401
+ const finalCursorPositions = [...settledCursorPositions, ...cursorPositions];
1402
+ if (finalCursorPositions.length !== 2) {
1185
1403
  return {
1186
- formatted: beforeCursor + aroundCursor + afterCursor,
1187
- cursorNodeStart: beforeCursor.length,
1188
- cursorNodeText: aroundCursor
1404
+ formatted
1189
1405
  };
1190
1406
  }
1191
- return { formatted: out.join("") };
1407
+ const cursorNodeStart = finalCursorPositions[0];
1408
+ return {
1409
+ formatted,
1410
+ cursorNodeStart,
1411
+ cursorNodeText: formatted.slice(cursorNodeStart, method_at_default(
1412
+ /* OPTIONAL_OBJECT: false */
1413
+ 0,
1414
+ finalCursorPositions,
1415
+ -1
1416
+ ))
1417
+ };
1418
+ function trim2() {
1419
+ const {
1420
+ text: trimmed,
1421
+ count
1422
+ } = trimIndentation(output);
1423
+ if (trimmed) {
1424
+ settledOutput.push(trimmed);
1425
+ settledTextLength += trimmed.length;
1426
+ }
1427
+ output = "";
1428
+ position -= count;
1429
+ if (cursorPositions.length > 0) {
1430
+ settledCursorPositions.push(...cursorPositions.map((position2) => Math.min(position2, settledTextLength)));
1431
+ cursorPositions.length = 0;
1432
+ }
1433
+ }
1192
1434
  }
1193
1435
 
1194
1436
  // src/document/public.js
@@ -1231,12 +1473,9 @@ var utils = {
1231
1473
  replaceEndOfLine,
1232
1474
  canBreak
1233
1475
  };
1234
-
1235
- // with-default-export:src/document/public.js
1236
- var public_default = public_exports;
1237
1476
  export {
1238
1477
  builders,
1239
- public_default as default,
1478
+ public_exports as default,
1240
1479
  printer,
1241
1480
  utils
1242
1481
  };