prettier 4.0.0-alpha.12 → 4.0.0-alpha.13

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,19 +115,16 @@ 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;
118
+ // node_modules/trim-newlines/index.js
119
+ function trimNewlinesEnd(string) {
120
+ let end = string.length;
121
+ while (end > 0 && (string[end - 1] === "\r" || string[end - 1] === "\n")) {
122
+ end--;
51
123
  }
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;
124
+ return end < string.length ? string.slice(0, end) : string;
125
+ }
58
126
 
59
- // src/document/utils/get-doc-type.js
127
+ // src/document/utilities/get-doc-type.js
60
128
  function getDocType(doc) {
61
129
  if (typeof doc === "string") {
62
130
  return DOC_TYPE_STRING;
@@ -74,7 +142,7 @@ function getDocType(doc) {
74
142
  }
75
143
  var get_doc_type_default = getDocType;
76
144
 
77
- // src/document/invalid-doc-error.js
145
+ // src/document/utilities/invalid-doc-error.js
78
146
  var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
79
147
  function getDocErrorMessage(doc) {
80
148
  const type = doc === null ? "null" : typeof doc;
@@ -104,7 +172,7 @@ var InvalidDocError = class extends Error {
104
172
  };
105
173
  var invalid_doc_error_default = InvalidDocError;
106
174
 
107
- // src/document/utils/traverse-doc.js
175
+ // src/document/utilities/traverse-doc.js
108
176
  var traverseDocOnExitStackMarker = {};
109
177
  function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
110
178
  const docsStack = [doc];
@@ -121,7 +189,7 @@ function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
121
189
  if (!docType) {
122
190
  throw new invalid_doc_error_default(doc2);
123
191
  }
124
- if ((onEnter == null ? void 0 : onEnter(doc2)) === false) {
192
+ if (onEnter?.(doc2) === false) {
125
193
  continue;
126
194
  }
127
195
  switch (docType) {
@@ -166,7 +234,7 @@ function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
166
234
  }
167
235
  var traverse_doc_default = traverseDoc;
168
236
 
169
- // src/document/utils.js
237
+ // src/document/utilities/index.js
170
238
  function mapDoc(doc, cb) {
171
239
  if (typeof doc === "string") {
172
240
  return cb(doc);
@@ -186,7 +254,10 @@ function mapDoc(doc, cb) {
186
254
  case DOC_TYPE_ARRAY:
187
255
  return cb(doc2.map(rec));
188
256
  case DOC_TYPE_FILL:
189
- return cb({ ...doc2, parts: doc2.parts.map(rec) });
257
+ return cb({
258
+ ...doc2,
259
+ parts: doc2.parts.map(rec)
260
+ });
190
261
  case DOC_TYPE_IF_BREAK:
191
262
  return cb({
192
263
  ...doc2,
@@ -194,21 +265,31 @@ function mapDoc(doc, cb) {
194
265
  flatContents: rec(doc2.flatContents)
195
266
  });
196
267
  case DOC_TYPE_GROUP: {
197
- let { expandedStates, contents } = doc2;
268
+ let {
269
+ expandedStates,
270
+ contents
271
+ } = doc2;
198
272
  if (expandedStates) {
199
273
  expandedStates = expandedStates.map(rec);
200
274
  contents = expandedStates[0];
201
275
  } else {
202
276
  contents = rec(contents);
203
277
  }
204
- return cb({ ...doc2, contents, expandedStates });
278
+ return cb({
279
+ ...doc2,
280
+ contents,
281
+ expandedStates
282
+ });
205
283
  }
206
284
  case DOC_TYPE_ALIGN:
207
285
  case DOC_TYPE_INDENT:
208
286
  case DOC_TYPE_INDENT_IF_BREAK:
209
287
  case DOC_TYPE_LABEL:
210
288
  case DOC_TYPE_LINE_SUFFIX:
211
- return cb({ ...doc2, contents: rec(doc2.contents) });
289
+ return cb({
290
+ ...doc2,
291
+ contents: rec(doc2.contents)
292
+ });
212
293
  case DOC_TYPE_STRING:
213
294
  case DOC_TYPE_CURSOR:
214
295
  case DOC_TYPE_TRIM:
@@ -253,9 +334,9 @@ function willBreak(doc) {
253
334
  }
254
335
  function breakParentGroup(groupStack) {
255
336
  if (groupStack.length > 0) {
256
- const parentGroup = at_default(
257
- /* isOptionalObject */
258
- false,
337
+ const parentGroup = method_at_default(
338
+ /* OPTIONAL_OBJECT: false */
339
+ 0,
259
340
  groupStack,
260
341
  -1
261
342
  );
@@ -310,23 +391,23 @@ function removeLines(doc) {
310
391
  }
311
392
  function stripTrailingHardlineFromParts(parts) {
312
393
  parts = [...parts];
313
- while (parts.length >= 2 && at_default(
314
- /* isOptionalObject */
315
- false,
394
+ while (parts.length >= 2 && method_at_default(
395
+ /* OPTIONAL_OBJECT: false */
396
+ 0,
316
397
  parts,
317
398
  -2
318
- ).type === DOC_TYPE_LINE && at_default(
319
- /* isOptionalObject */
320
- false,
399
+ ).type === DOC_TYPE_LINE && method_at_default(
400
+ /* OPTIONAL_OBJECT: false */
401
+ 0,
321
402
  parts,
322
403
  -1
323
404
  ).type === DOC_TYPE_BREAK_PARENT) {
324
405
  parts.length -= 2;
325
406
  }
326
407
  if (parts.length > 0) {
327
- const lastPart = stripTrailingHardlineFromDoc(at_default(
328
- /* isOptionalObject */
329
- false,
408
+ const lastPart = stripTrailingHardlineFromDoc(method_at_default(
409
+ /* OPTIONAL_OBJECT: false */
410
+ 0,
330
411
  parts,
331
412
  -1
332
413
  ));
@@ -342,7 +423,10 @@ function stripTrailingHardlineFromDoc(doc) {
342
423
  case DOC_TYPE_LINE_SUFFIX:
343
424
  case DOC_TYPE_LABEL: {
344
425
  const contents = stripTrailingHardlineFromDoc(doc.contents);
345
- return { ...doc, contents };
426
+ return {
427
+ ...doc,
428
+ contents
429
+ };
346
430
  }
347
431
  case DOC_TYPE_IF_BREAK:
348
432
  return {
@@ -351,11 +435,14 @@ function stripTrailingHardlineFromDoc(doc) {
351
435
  flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
352
436
  };
353
437
  case DOC_TYPE_FILL:
354
- return { ...doc, parts: stripTrailingHardlineFromParts(doc.parts) };
438
+ return {
439
+ ...doc,
440
+ parts: stripTrailingHardlineFromParts(doc.parts)
441
+ };
355
442
  case DOC_TYPE_ARRAY:
356
443
  return stripTrailingHardlineFromParts(doc);
357
444
  case DOC_TYPE_STRING:
358
- return doc.replace(/[\n\r]*$/u, "");
445
+ return trimNewlinesEnd(doc);
359
446
  case DOC_TYPE_ALIGN:
360
447
  case DOC_TYPE_CURSOR:
361
448
  case DOC_TYPE_TRIM:
@@ -406,9 +493,9 @@ function cleanDocFn(doc) {
406
493
  continue;
407
494
  }
408
495
  const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
409
- if (typeof currentPart === "string" && typeof at_default(
410
- /* isOptionalObject */
411
- false,
496
+ if (typeof currentPart === "string" && typeof method_at_default(
497
+ /* OPTIONAL_OBJECT: false */
498
+ 0,
412
499
  parts,
413
500
  -1
414
501
  ) === "string") {
@@ -443,10 +530,7 @@ function cleanDoc(doc) {
443
530
  return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
444
531
  }
445
532
  function replaceEndOfLine(doc, replacement = literalline) {
446
- return mapDoc(
447
- doc,
448
- (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc
449
- );
533
+ return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc);
450
534
  }
451
535
  function canBreakFn(doc) {
452
536
  if (doc.type === DOC_TYPE_LINE) {
@@ -457,39 +541,46 @@ function canBreak(doc) {
457
541
  return findInDoc(doc, canBreakFn, false);
458
542
  }
459
543
 
460
- // src/document/utils/assert-doc.js
461
- var noop = () => {
462
- };
463
- var assertDoc = true ? noop : function(doc) {
464
- traverse_doc_default(doc, (doc2) => {
465
- if (checked.has(doc2)) {
466
- return false;
467
- }
468
- 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
+ }
469
554
  checked.add(doc2);
470
- }
471
- });
472
- };
473
- var assertDocArray = true ? noop : function(docs, optional = false) {
474
- if (optional && !docs) {
475
- return;
555
+ });
476
556
  }
477
- if (!Array.isArray(docs)) {
478
- throw new TypeError("Unexpected doc array.");
479
- }
480
- for (const doc of docs) {
481
- 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
+ }
482
573
  }
483
- };
484
- var assertDocFillParts = true ? noop : (
574
+ );
575
+ var assertDocFillParts = true ? noop_default : (
485
576
  /**
486
- * @param {Doc[]} parts
487
- */
577
+ @param {readonly Doc[]} parts
578
+ */
488
579
  function(parts) {
489
580
  assertDocArray(parts);
490
- if (parts.length > 1 && isEmptyDoc(at_default(
491
- /* isOptionalObject */
492
- false,
581
+ if (parts.length > 1 && isEmptyDoc(method_at_default(
582
+ /* OPTIONAL_OBJECT: false */
583
+ 0,
493
584
  parts,
494
585
  -1
495
586
  ))) {
@@ -498,37 +589,28 @@ var assertDocFillParts = true ? noop : (
498
589
  for (const [i, doc] of parts.entries()) {
499
590
  if (i % 2 === 1 && !isValidSeparator(doc)) {
500
591
  const type = get_doc_type_default(doc);
501
- throw new Error(
502
- `Unexpected non-line-break doc at ${i}. Doc type is ${type}.`
503
- );
592
+ throw new Error(`Unexpected non-line-break doc at ${i}. Doc type is ${type}.`);
504
593
  }
505
594
  }
506
595
  }
507
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
+ };
508
602
 
509
- // src/document/builders.js
603
+ // src/document/builders/indent.js
510
604
  function indent(contents) {
511
605
  assertDoc(contents);
512
606
  return { type: DOC_TYPE_INDENT, contents };
513
607
  }
514
- function align(widthOrString, contents) {
515
- assertDoc(contents);
516
- return { type: DOC_TYPE_ALIGN, contents, n: widthOrString };
517
- }
518
- function group(contents, opts = {}) {
608
+
609
+ // src/document/builders/align.js
610
+ function align(alignType, contents) {
611
+ assertAlignType(alignType);
519
612
  assertDoc(contents);
520
- assertDocArray(
521
- opts.expandedStates,
522
- /* optional */
523
- true
524
- );
525
- return {
526
- type: DOC_TYPE_GROUP,
527
- id: opts.id,
528
- contents,
529
- break: Boolean(opts.shouldBreak),
530
- expandedStates: opts.expandedStates
531
- };
613
+ return { type: DOC_TYPE_ALIGN, contents, n: alignType };
532
614
  }
533
615
  function dedentToRoot(contents) {
534
616
  return align(Number.NEGATIVE_INFINITY, contents);
@@ -539,14 +621,53 @@ function markAsRoot(contents) {
539
621
  function dedent(contents) {
540
622
  return align(-1, contents);
541
623
  }
542
- function conditionalGroup(states, opts) {
543
- 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;
544
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
545
644
  function fill(parts) {
546
645
  assertDocFillParts(parts);
547
646
  return { type: DOC_TYPE_FILL, parts };
548
647
  }
549
- 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 = {}) {
550
671
  assertDoc(breakContents);
551
672
  if (flatContents !== "") {
552
673
  assertDoc(flatContents);
@@ -555,36 +676,22 @@ function ifBreak(breakContents, flatContents = "", opts = {}) {
555
676
  type: DOC_TYPE_IF_BREAK,
556
677
  breakContents,
557
678
  flatContents,
558
- groupId: opts.groupId
679
+ groupId: options.groupId
559
680
  };
560
681
  }
561
- function indentIfBreak(contents, opts) {
682
+
683
+ // src/document/builders/indent-if-break.js
684
+ function indentIfBreak(contents, options) {
562
685
  assertDoc(contents);
563
686
  return {
564
687
  type: DOC_TYPE_INDENT_IF_BREAK,
565
688
  contents,
566
- groupId: opts.groupId,
567
- negate: opts.negate
689
+ groupId: options.groupId,
690
+ negate: options.negate
568
691
  };
569
692
  }
570
- function lineSuffix(contents) {
571
- assertDoc(contents);
572
- return { type: DOC_TYPE_LINE_SUFFIX, contents };
573
- }
574
- var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
575
- var breakParent = { type: DOC_TYPE_BREAK_PARENT };
576
- var trim = { type: DOC_TYPE_TRIM };
577
- var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
578
- var literallineWithoutBreakParent = {
579
- type: DOC_TYPE_LINE,
580
- hard: true,
581
- literal: true
582
- };
583
- var line = { type: DOC_TYPE_LINE };
584
- var softline = { type: DOC_TYPE_LINE, soft: true };
585
- var hardline = [hardlineWithoutBreakParent, breakParent];
586
- var literalline = [literallineWithoutBreakParent, breakParent];
587
- var cursor = { type: DOC_TYPE_CURSOR };
693
+
694
+ // src/document/builders/join.js
588
695
  function join(separator, docs) {
589
696
  assertDoc(separator);
590
697
  assertDocArray(docs);
@@ -597,37 +704,50 @@ function join(separator, docs) {
597
704
  }
598
705
  return parts;
599
706
  }
600
- function addAlignmentToDoc(doc, size, tabWidth) {
601
- assertDoc(doc);
602
- let aligned = doc;
603
- if (size > 0) {
604
- for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
605
- aligned = indent(aligned);
606
- }
607
- aligned = align(size % tabWidth, aligned);
608
- aligned = align(Number.NEGATIVE_INFINITY, aligned);
609
- }
610
- return aligned;
611
- }
707
+
708
+ // src/document/builders/label.js
612
709
  function label(label2, contents) {
613
710
  assertDoc(contents);
614
711
  return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
615
712
  }
616
713
 
617
- // scripts/build/shims/string-replace-all.js
618
- var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
619
- if (isOptionalObject && (original === void 0 || original === null)) {
620
- return;
621
- }
622
- if (original.replaceAll) {
623
- return original.replaceAll(pattern, replacement);
624
- }
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) {
625
740
  if (pattern.global) {
626
- return original.replace(pattern, replacement);
741
+ return this.replace(pattern, replacement);
627
742
  }
628
- return original.split(pattern).join(replacement);
743
+ return this.split(pattern).join(replacement);
629
744
  };
630
- 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;
631
751
 
632
752
  // src/common/end-of-line.js
633
753
  function convertEndOfLineToChars(value) {
@@ -643,7 +763,7 @@ function convertEndOfLineToChars(value) {
643
763
 
644
764
  // node_modules/emoji-regex/index.mjs
645
765
  var emoji_regex_default = () => {
646
- 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;
647
767
  };
648
768
 
649
769
  // node_modules/get-east-asian-width/lookup.js
@@ -651,14 +771,15 @@ function isFullWidth(x) {
651
771
  return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
652
772
  }
653
773
  function isWide(x) {
654
- 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;
655
775
  }
656
776
 
657
- // node_modules/get-east-asian-width/index.js
658
- 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";
659
779
 
660
780
  // src/utils/get-string-width.js
661
781
  var notAsciiRegex = /[^\x20-\x7F]/u;
782
+ var narrowEmojisSet = new Set(narrow_emojis_evaluate_default);
662
783
  function getStringWidth(text) {
663
784
  if (!text) {
664
785
  return 0;
@@ -666,7 +787,10 @@ function getStringWidth(text) {
666
787
  if (!notAsciiRegex.test(text)) {
667
788
  return text.length;
668
789
  }
669
- text = text.replace(emoji_regex_default(), " ");
790
+ text = text.replace(
791
+ emoji_regex_default(),
792
+ (match) => narrowEmojisSet.has(match) ? " " : " "
793
+ );
670
794
  let width = 0;
671
795
  for (const character of text) {
672
796
  const codePoint = character.codePointAt(0);
@@ -676,48 +800,39 @@ function getStringWidth(text) {
676
800
  if (codePoint >= 768 && codePoint <= 879) {
677
801
  continue;
678
802
  }
679
- width += _isNarrowWidth(codePoint) ? 1 : 2;
803
+ if (codePoint >= 65024 && codePoint <= 65039) {
804
+ continue;
805
+ }
806
+ width += isFullWidth(codePoint) || isWide(codePoint) ? 2 : 1;
680
807
  }
681
808
  return width;
682
809
  }
683
810
  var get_string_width_default = getStringWidth;
684
811
 
685
- // src/document/printer.js
686
- var MODE_BREAK = Symbol("MODE_BREAK");
687
- var MODE_FLAT = Symbol("MODE_FLAT");
688
- var CURSOR_PLACEHOLDER = Symbol("cursor");
689
- var DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
690
- function rootIndent() {
691
- return { value: "", length: 0, queue: [] };
692
- }
693
- function makeIndent(ind, options) {
694
- return generateInd(ind, { type: "indent" }, options);
695
- }
696
- function makeAlign(indent2, widthOrDoc, options) {
697
- if (widthOrDoc === Number.NEGATIVE_INFINITY) {
698
- return indent2.root || rootIndent();
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;
699
825
  }
700
- if (widthOrDoc < 0) {
701
- return generateInd(indent2, { type: "dedent" }, options);
702
- }
703
- if (!widthOrDoc) {
704
- return indent2;
705
- }
706
- if (widthOrDoc.type === "root") {
707
- return { ...indent2, root: indent2 };
708
- }
709
- const alignType = typeof widthOrDoc === "string" ? "stringAlign" : "numberAlign";
710
- return generateInd(indent2, { type: alignType, n: widthOrDoc }, options);
711
- }
712
- function generateInd(ind, newPart, options) {
713
- 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];
714
829
  let value = "";
715
830
  let length = 0;
716
831
  let lastTabs = 0;
717
832
  let lastSpaces = 0;
718
- for (const part of queue) {
719
- switch (part.type) {
720
- case "indent":
833
+ for (const command2 of queue) {
834
+ switch (command2.type) {
835
+ case INDENT_COMMAND_TYPE_INDENT:
721
836
  flush();
722
837
  if (options.useTabs) {
723
838
  addTabs(1);
@@ -725,21 +840,25 @@ function generateInd(ind, newPart, options) {
725
840
  addSpaces(options.tabWidth);
726
841
  }
727
842
  break;
728
- case "stringAlign":
843
+ case INDENT_COMMAND_TYPE_STRING: {
844
+ const { string } = command2;
729
845
  flush();
730
- value += part.n;
731
- length += part.n.length;
846
+ value += string;
847
+ length += string.length;
732
848
  break;
733
- case "numberAlign":
849
+ }
850
+ case INDENT_COMMAND_TYPE_WIDTH: {
851
+ const { width } = command2;
734
852
  lastTabs += 1;
735
- lastSpaces += part.n;
853
+ lastSpaces += width;
736
854
  break;
855
+ }
737
856
  default:
738
- throw new Error(`Unexpected type '${part.type}'`);
857
+ throw new Error(`Unexpected indent comment '${command2.type}'.`);
739
858
  }
740
859
  }
741
860
  flushSpaces();
742
- return { ...ind, value, length, queue };
861
+ return { ...indent2, value, length, queue };
743
862
  function addTabs(count) {
744
863
  value += " ".repeat(count);
745
864
  length += options.tabWidth * count;
@@ -772,65 +891,97 @@ function generateInd(ind, newPart, options) {
772
891
  lastSpaces = 0;
773
892
  }
774
893
  }
775
- function trim2(out) {
776
- let trimCount = 0;
777
- let cursorCount = 0;
778
- let outIndex = out.length;
779
- outer: while (outIndex--) {
780
- const last = out[outIndex];
781
- if (last === CURSOR_PLACEHOLDER) {
782
- cursorCount++;
783
- continue;
784
- }
785
- if (false) {
786
- throw new Error(`Unexpected value in trim: '${typeof last}'`);
787
- }
788
- for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) {
789
- const char = last[charIndex];
790
- if (char === " " || char === " ") {
791
- trimCount++;
792
- } else {
793
- out[outIndex] = last.slice(0, charIndex + 1);
794
- break outer;
795
- }
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 };
796
910
  }
911
+ } else {
912
+ command = { type: INDENT_COMMAND_TYPE_STRING, string: indentOptions };
797
913
  }
798
- if (trimCount > 0 || cursorCount > 0) {
799
- out.length = outIndex + 1;
800
- while (cursorCount-- > 0) {
801
- 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;
802
929
  }
803
930
  }
804
- return trimCount;
931
+ return length;
932
+ }
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 };
805
937
  }
806
- function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) {
807
- if (width === Number.POSITIVE_INFINITY) {
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) {
808
945
  return true;
809
946
  }
810
- let restIdx = restCommands.length;
811
- const cmds = [next];
812
- const out = [];
813
- while (width >= 0) {
814
- if (cmds.length === 0) {
815
- 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) {
816
954
  return true;
817
955
  }
818
- cmds.push(restCommands[--restIdx]);
956
+ commands.push(restCommands[--restCommandsIndex]);
819
957
  continue;
820
958
  }
821
- const { mode, doc } = cmds.pop();
959
+ const {
960
+ mode,
961
+ doc
962
+ } = commands.pop();
822
963
  const docType = get_doc_type_default(doc);
823
964
  switch (docType) {
824
965
  case DOC_TYPE_STRING:
825
- out.push(doc);
826
- 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
+ }
827
975
  break;
828
976
  case DOC_TYPE_ARRAY:
829
977
  case DOC_TYPE_FILL: {
830
978
  const parts = docType === DOC_TYPE_ARRAY ? doc : doc.parts;
831
979
  const end = doc[DOC_FILL_PRINTED_LENGTH] ?? 0;
832
- for (let i = parts.length - 1; i >= end; i--) {
833
- 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
+ });
834
985
  }
835
986
  break;
836
987
  }
@@ -838,30 +989,45 @@ function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat
838
989
  case DOC_TYPE_ALIGN:
839
990
  case DOC_TYPE_INDENT_IF_BREAK:
840
991
  case DOC_TYPE_LABEL:
841
- cmds.push({ mode, doc: doc.contents });
992
+ commands.push({
993
+ mode,
994
+ doc: doc.contents
995
+ });
842
996
  break;
843
- case DOC_TYPE_TRIM:
844
- width += trim2(out);
997
+ case DOC_TYPE_TRIM: {
998
+ const {
999
+ text,
1000
+ count
1001
+ } = trimIndentation(output);
1002
+ output = text;
1003
+ remainingWidth += count;
845
1004
  break;
1005
+ }
846
1006
  case DOC_TYPE_GROUP: {
847
1007
  if (mustBeFlat && doc.break) {
848
1008
  return false;
849
1009
  }
850
1010
  const groupMode = doc.break ? MODE_BREAK : mode;
851
- const contents = doc.expandedStates && groupMode === MODE_BREAK ? at_default(
852
- /* isOptionalObject */
853
- false,
1011
+ const contents = doc.expandedStates && groupMode === MODE_BREAK ? method_at_default(
1012
+ /* OPTIONAL_OBJECT: false */
1013
+ 0,
854
1014
  doc.expandedStates,
855
1015
  -1
856
1016
  ) : doc.contents;
857
- cmds.push({ mode: groupMode, doc: contents });
1017
+ commands.push({
1018
+ mode: groupMode,
1019
+ doc: contents
1020
+ });
858
1021
  break;
859
1022
  }
860
1023
  case DOC_TYPE_IF_BREAK: {
861
1024
  const groupMode = doc.groupId ? groupModeMap[doc.groupId] || MODE_FLAT : mode;
862
1025
  const contents = groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents;
863
1026
  if (contents) {
864
- cmds.push({ mode, doc: contents });
1027
+ commands.push({
1028
+ mode,
1029
+ doc: contents
1030
+ });
865
1031
  }
866
1032
  break;
867
1033
  }
@@ -870,8 +1036,7 @@ function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat
870
1036
  return true;
871
1037
  }
872
1038
  if (!doc.soft) {
873
- out.push(" ");
874
- width--;
1039
+ hasPendingSpace = true;
875
1040
  }
876
1041
  break;
877
1042
  case DOC_TYPE_LINE_SUFFIX:
@@ -887,64 +1052,84 @@ function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat
887
1052
  return false;
888
1053
  }
889
1054
  function printDocToString(doc, options) {
890
- const groupModeMap = {};
1055
+ const groupModeMap = /* @__PURE__ */ Object.create(null);
891
1056
  const width = options.printWidth;
892
1057
  const newLine = convertEndOfLineToChars(options.endOfLine);
893
- let pos = 0;
894
- const cmds = [{ ind: rootIndent(), mode: MODE_BREAK, doc }];
895
- const out = [];
1058
+ let position = 0;
1059
+ const commands = [{
1060
+ indent: ROOT_INDENT,
1061
+ mode: MODE_BREAK,
1062
+ doc
1063
+ }];
1064
+ let out = [];
896
1065
  let shouldRemeasure = false;
897
1066
  const lineSuffix2 = [];
898
- let printedCursorCount = 0;
1067
+ const cursorPositions = [];
899
1068
  propagateBreaks(doc);
900
- while (cmds.length > 0) {
901
- const { ind, mode, doc: doc2 } = cmds.pop();
1069
+ while (commands.length > 0) {
1070
+ const {
1071
+ indent: indent2,
1072
+ mode,
1073
+ doc: doc2
1074
+ } = commands.pop();
902
1075
  switch (get_doc_type_default(doc2)) {
903
1076
  case DOC_TYPE_STRING: {
904
- const formatted = newLine !== "\n" ? string_replace_all_default(
905
- /* isOptionalObject */
906
- false,
1077
+ const formatted2 = newLine !== "\n" ? method_replace_all_default(
1078
+ /* OPTIONAL_OBJECT: false */
1079
+ 0,
907
1080
  doc2,
908
1081
  "\n",
909
1082
  newLine
910
1083
  ) : doc2;
911
- out.push(formatted);
912
- if (cmds.length > 0) {
913
- pos += get_string_width_default(formatted);
1084
+ if (formatted2) {
1085
+ out.push(formatted2);
1086
+ if (commands.length > 0) {
1087
+ position += get_string_width_default(formatted2);
1088
+ }
914
1089
  }
915
1090
  break;
916
1091
  }
917
1092
  case DOC_TYPE_ARRAY:
918
- for (let i = doc2.length - 1; i >= 0; i--) {
919
- cmds.push({ ind, mode, doc: doc2[i] });
1093
+ for (let index = doc2.length - 1; index >= 0; index--) {
1094
+ commands.push({
1095
+ indent: indent2,
1096
+ mode,
1097
+ doc: doc2[index]
1098
+ });
920
1099
  }
921
1100
  break;
922
- case DOC_TYPE_CURSOR:
923
- if (printedCursorCount >= 2) {
1101
+ case DOC_TYPE_CURSOR: {
1102
+ if (cursorPositions.length >= 2) {
924
1103
  throw new Error("There are too many 'cursor' in doc.");
925
1104
  }
926
- out.push(CURSOR_PLACEHOLDER);
927
- printedCursorCount++;
1105
+ const text = out.join("");
1106
+ out = [text];
1107
+ cursorPositions.push(text.length - 1);
928
1108
  break;
1109
+ }
929
1110
  case DOC_TYPE_INDENT:
930
- 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
+ });
931
1116
  break;
932
1117
  case DOC_TYPE_ALIGN:
933
- cmds.push({
934
- ind: makeAlign(ind, doc2.n, options),
1118
+ commands.push({
1119
+ indent: makeAlign(indent2, doc2.n, options),
935
1120
  mode,
936
1121
  doc: doc2.contents
937
1122
  });
938
1123
  break;
939
1124
  case DOC_TYPE_TRIM:
940
- pos -= trim2(out);
1125
+ trim2();
941
1126
  break;
942
1127
  case DOC_TYPE_GROUP:
943
1128
  switch (mode) {
944
1129
  case MODE_FLAT:
945
1130
  if (!shouldRemeasure) {
946
- cmds.push({
947
- ind,
1131
+ commands.push({
1132
+ indent: indent2,
948
1133
  mode: doc2.break ? MODE_BREAK : MODE_FLAT,
949
1134
  doc: doc2.contents
950
1135
  });
@@ -953,49 +1138,69 @@ function printDocToString(doc, options) {
953
1138
  // fallthrough
954
1139
  case MODE_BREAK: {
955
1140
  shouldRemeasure = false;
956
- const next = { ind, mode: MODE_FLAT, doc: doc2.contents };
957
- const rem = width - pos;
1141
+ const next = {
1142
+ indent: indent2,
1143
+ mode: MODE_FLAT,
1144
+ doc: doc2.contents
1145
+ };
1146
+ const remainingWidth = width - position;
958
1147
  const hasLineSuffix = lineSuffix2.length > 0;
959
- if (!doc2.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) {
960
- cmds.push(next);
1148
+ if (!doc2.break && fits(next, commands, remainingWidth, hasLineSuffix, groupModeMap)) {
1149
+ commands.push(next);
961
1150
  } else {
962
1151
  if (doc2.expandedStates) {
963
- const mostExpanded = at_default(
964
- /* isOptionalObject */
965
- false,
1152
+ const mostExpanded = method_at_default(
1153
+ /* OPTIONAL_OBJECT: false */
1154
+ 0,
966
1155
  doc2.expandedStates,
967
1156
  -1
968
1157
  );
969
1158
  if (doc2.break) {
970
- cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded });
1159
+ commands.push({
1160
+ indent: indent2,
1161
+ mode: MODE_BREAK,
1162
+ doc: mostExpanded
1163
+ });
971
1164
  break;
972
1165
  } else {
973
- for (let i = 1; i < doc2.expandedStates.length + 1; i++) {
974
- if (i >= doc2.expandedStates.length) {
975
- 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
+ });
976
1173
  break;
977
1174
  } else {
978
- const state = doc2.expandedStates[i];
979
- const cmd = { ind, mode: MODE_FLAT, doc: state };
980
- if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) {
981
- 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);
982
1183
  break;
983
1184
  }
984
1185
  }
985
1186
  }
986
1187
  }
987
1188
  } else {
988
- cmds.push({ ind, mode: MODE_BREAK, doc: doc2.contents });
1189
+ commands.push({
1190
+ indent: indent2,
1191
+ mode: MODE_BREAK,
1192
+ doc: doc2.contents
1193
+ });
989
1194
  }
990
1195
  }
991
1196
  break;
992
1197
  }
993
1198
  }
994
1199
  if (doc2.id) {
995
- groupModeMap[doc2.id] = at_default(
996
- /* isOptionalObject */
997
- false,
998
- cmds,
1200
+ groupModeMap[doc2.id] = method_at_default(
1201
+ /* OPTIONAL_OBJECT: false */
1202
+ 0,
1203
+ commands,
999
1204
  -1
1000
1205
  ).mode;
1001
1206
  }
@@ -1021,68 +1226,76 @@ function printDocToString(doc, options) {
1021
1226
  // * Neither content item fits on the line without breaking
1022
1227
  // -> output the first content item and the whitespace with "break".
1023
1228
  case DOC_TYPE_FILL: {
1024
- const rem = width - pos;
1229
+ const remainingWidth = width - position;
1025
1230
  const offset = doc2[DOC_FILL_PRINTED_LENGTH] ?? 0;
1026
- const { parts } = doc2;
1231
+ const {
1232
+ parts
1233
+ } = doc2;
1027
1234
  const length = parts.length - offset;
1028
1235
  if (length === 0) {
1029
1236
  break;
1030
1237
  }
1031
1238
  const content = parts[offset + 0];
1032
1239
  const whitespace = parts[offset + 1];
1033
- const contentFlatCmd = { ind, mode: MODE_FLAT, doc: content };
1034
- const contentBreakCmd = { ind, mode: MODE_BREAK, doc: content };
1035
- const contentFits = fits(
1036
- contentFlatCmd,
1037
- [],
1038
- rem,
1039
- lineSuffix2.length > 0,
1040
- groupModeMap,
1041
- true
1042
- );
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);
1043
1251
  if (length === 1) {
1044
1252
  if (contentFits) {
1045
- cmds.push(contentFlatCmd);
1253
+ commands.push(contentFlatCommand);
1046
1254
  } else {
1047
- cmds.push(contentBreakCmd);
1255
+ commands.push(contentBreakCommand);
1048
1256
  }
1049
1257
  break;
1050
1258
  }
1051
- const whitespaceFlatCmd = { ind, mode: MODE_FLAT, doc: whitespace };
1052
- 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
+ };
1053
1269
  if (length === 2) {
1054
1270
  if (contentFits) {
1055
- cmds.push(whitespaceFlatCmd, contentFlatCmd);
1271
+ commands.push(whitespaceFlatCommand, contentFlatCommand);
1056
1272
  } else {
1057
- cmds.push(whitespaceBreakCmd, contentBreakCmd);
1273
+ commands.push(whitespaceBreakCommand, contentBreakCommand);
1058
1274
  }
1059
1275
  break;
1060
1276
  }
1061
1277
  const secondContent = parts[offset + 2];
1062
- const remainingCmd = {
1063
- ind,
1278
+ const remainingCommand = {
1279
+ indent: indent2,
1064
1280
  mode,
1065
- doc: { ...doc2, [DOC_FILL_PRINTED_LENGTH]: offset + 2 }
1281
+ doc: {
1282
+ ...doc2,
1283
+ [DOC_FILL_PRINTED_LENGTH]: offset + 2
1284
+ }
1066
1285
  };
1067
- const firstAndSecondContentFlatCmd = {
1068
- ind,
1286
+ const firstAndSecondContentFlatCommand = {
1287
+ indent: indent2,
1069
1288
  mode: MODE_FLAT,
1070
1289
  doc: [content, whitespace, secondContent]
1071
1290
  };
1072
- const firstAndSecondContentFits = fits(
1073
- firstAndSecondContentFlatCmd,
1074
- [],
1075
- rem,
1076
- lineSuffix2.length > 0,
1077
- groupModeMap,
1078
- true
1079
- );
1291
+ const firstAndSecondContentFits = fits(firstAndSecondContentFlatCommand, [], remainingWidth, lineSuffix2.length > 0, groupModeMap, true);
1292
+ commands.push(remainingCommand);
1080
1293
  if (firstAndSecondContentFits) {
1081
- cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd);
1294
+ commands.push(whitespaceFlatCommand, contentFlatCommand);
1082
1295
  } else if (contentFits) {
1083
- cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd);
1296
+ commands.push(whitespaceBreakCommand, contentFlatCommand);
1084
1297
  } else {
1085
- cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd);
1298
+ commands.push(whitespaceBreakCommand, contentBreakCommand);
1086
1299
  }
1087
1300
  break;
1088
1301
  }
@@ -1092,23 +1305,39 @@ function printDocToString(doc, options) {
1092
1305
  if (groupMode === MODE_BREAK) {
1093
1306
  const breakContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.breakContents : doc2.negate ? doc2.contents : indent(doc2.contents);
1094
1307
  if (breakContents) {
1095
- cmds.push({ ind, mode, doc: breakContents });
1308
+ commands.push({
1309
+ indent: indent2,
1310
+ mode,
1311
+ doc: breakContents
1312
+ });
1096
1313
  }
1097
1314
  }
1098
1315
  if (groupMode === MODE_FLAT) {
1099
1316
  const flatContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.flatContents : doc2.negate ? indent(doc2.contents) : doc2.contents;
1100
1317
  if (flatContents) {
1101
- cmds.push({ ind, mode, doc: flatContents });
1318
+ commands.push({
1319
+ indent: indent2,
1320
+ mode,
1321
+ doc: flatContents
1322
+ });
1102
1323
  }
1103
1324
  }
1104
1325
  break;
1105
1326
  }
1106
1327
  case DOC_TYPE_LINE_SUFFIX:
1107
- lineSuffix2.push({ ind, mode, doc: doc2.contents });
1328
+ lineSuffix2.push({
1329
+ indent: indent2,
1330
+ mode,
1331
+ doc: doc2.contents
1332
+ });
1108
1333
  break;
1109
1334
  case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
1110
1335
  if (lineSuffix2.length > 0) {
1111
- cmds.push({ ind, mode, doc: hardlineWithoutBreakParent });
1336
+ commands.push({
1337
+ indent: indent2,
1338
+ mode,
1339
+ doc: hardlineWithoutBreakParent
1340
+ });
1112
1341
  }
1113
1342
  break;
1114
1343
  case DOC_TYPE_LINE:
@@ -1117,7 +1346,7 @@ function printDocToString(doc, options) {
1117
1346
  if (!doc2.hard) {
1118
1347
  if (!doc2.soft) {
1119
1348
  out.push(" ");
1120
- pos += 1;
1349
+ position += 1;
1121
1350
  }
1122
1351
  break;
1123
1352
  } else {
@@ -1126,60 +1355,76 @@ function printDocToString(doc, options) {
1126
1355
  // fallthrough
1127
1356
  case MODE_BREAK:
1128
1357
  if (lineSuffix2.length > 0) {
1129
- cmds.push({ ind, mode, doc: doc2 }, ...lineSuffix2.reverse());
1358
+ commands.push({
1359
+ indent: indent2,
1360
+ mode,
1361
+ doc: doc2
1362
+ }, ...lineSuffix2.reverse());
1130
1363
  lineSuffix2.length = 0;
1131
1364
  break;
1132
1365
  }
1133
1366
  if (doc2.literal) {
1134
- if (ind.root) {
1135
- out.push(newLine, ind.root.value);
1136
- pos = ind.root.length;
1137
- } else {
1138
- out.push(newLine);
1139
- pos = 0;
1367
+ out.push(newLine);
1368
+ position = 0;
1369
+ if (indent2.root) {
1370
+ if (indent2.root.value) {
1371
+ out.push(indent2.root.value);
1372
+ }
1373
+ position = indent2.root.length;
1140
1374
  }
1141
1375
  } else {
1142
- pos -= trim2(out);
1143
- out.push(newLine + ind.value);
1144
- pos = ind.length;
1376
+ trim2();
1377
+ out.push(newLine + indent2.value);
1378
+ position = indent2.length;
1145
1379
  }
1146
1380
  break;
1147
1381
  }
1148
1382
  break;
1149
1383
  case DOC_TYPE_LABEL:
1150
- cmds.push({ ind, mode, doc: doc2.contents });
1384
+ commands.push({
1385
+ indent: indent2,
1386
+ mode,
1387
+ doc: doc2.contents
1388
+ });
1151
1389
  break;
1152
1390
  case DOC_TYPE_BREAK_PARENT:
1153
1391
  break;
1154
1392
  default:
1155
1393
  throw new invalid_doc_error_default(doc2);
1156
1394
  }
1157
- if (cmds.length === 0 && lineSuffix2.length > 0) {
1158
- cmds.push(...lineSuffix2.reverse());
1395
+ if (commands.length === 0 && lineSuffix2.length > 0) {
1396
+ commands.push(...lineSuffix2.reverse());
1159
1397
  lineSuffix2.length = 0;
1160
1398
  }
1161
1399
  }
1162
- const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER);
1163
- if (cursorPlaceholderIndex !== -1) {
1164
- const otherCursorPlaceholderIndex = out.indexOf(
1165
- CURSOR_PLACEHOLDER,
1166
- cursorPlaceholderIndex + 1
1167
- );
1168
- if (otherCursorPlaceholderIndex === -1) {
1169
- return {
1170
- formatted: out.filter((char) => char !== CURSOR_PLACEHOLDER).join("")
1171
- };
1172
- }
1173
- const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
1174
- const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join("");
1175
- const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
1400
+ const formatted = out.join("");
1401
+ if (cursorPositions.length !== 2) {
1176
1402
  return {
1177
- formatted: beforeCursor + aroundCursor + afterCursor,
1178
- cursorNodeStart: beforeCursor.length,
1179
- cursorNodeText: aroundCursor
1403
+ formatted
1180
1404
  };
1181
1405
  }
1182
- return { formatted: out.join("") };
1406
+ const cursorNodeStart = cursorPositions[0] + 1;
1407
+ return {
1408
+ formatted,
1409
+ cursorNodeStart,
1410
+ cursorNodeText: formatted.slice(cursorNodeStart, method_at_default(
1411
+ /* OPTIONAL_OBJECT: false */
1412
+ 0,
1413
+ cursorPositions,
1414
+ -1
1415
+ ) + 1)
1416
+ };
1417
+ function trim2() {
1418
+ const {
1419
+ text,
1420
+ count
1421
+ } = trimIndentation(out.join(""));
1422
+ out = [text];
1423
+ position -= count;
1424
+ for (let index = 0; index < cursorPositions.length; index++) {
1425
+ cursorPositions[index] = Math.min(cursorPositions[index], text.length - 1);
1426
+ }
1427
+ }
1183
1428
  }
1184
1429
 
1185
1430
  // src/document/public.js
@@ -1222,12 +1467,9 @@ var utils = {
1222
1467
  replaceEndOfLine,
1223
1468
  canBreak
1224
1469
  };
1225
-
1226
- // with-default-export:src/document/public.js
1227
- var public_default = public_exports;
1228
1470
  export {
1229
1471
  builders,
1230
- public_default as default,
1472
+ public_exports as default,
1231
1473
  printer,
1232
1474
  utils
1233
1475
  };