securemark 0.260.5 → 0.261.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +12 -12
  3. package/design.md +0 -4
  4. package/dist/index.js +199 -245
  5. package/markdown.d.ts +5 -32
  6. package/package.json +6 -6
  7. package/src/parser/api/parse.test.ts +1 -1
  8. package/src/parser/block/blockquote.test.ts +2 -2
  9. package/src/parser/block/dlist.test.ts +1 -1
  10. package/src/parser/block/extension/example.test.ts +1 -1
  11. package/src/parser/block/extension/fig.test.ts +1 -1
  12. package/src/parser/block/heading.test.ts +2 -2
  13. package/src/parser/block/paragraph.test.ts +1 -4
  14. package/src/parser/block/reply/cite.test.ts +5 -0
  15. package/src/parser/block/reply/cite.ts +5 -4
  16. package/src/parser/inline/autolink/anchor.test.ts +1 -0
  17. package/src/parser/inline/autolink/email.test.ts +3 -0
  18. package/src/parser/inline/autolink/email.ts +1 -1
  19. package/src/parser/inline/autolink/hashnum.test.ts +1 -2
  20. package/src/parser/inline/autolink/hashnum.ts +1 -1
  21. package/src/parser/inline/autolink/hashtag.test.ts +15 -12
  22. package/src/parser/inline/autolink/hashtag.ts +3 -3
  23. package/src/parser/inline/autolink/url.test.ts +1 -1
  24. package/src/parser/inline/autolink/url.ts +1 -1
  25. package/src/parser/inline/autolink.ts +13 -4
  26. package/src/parser/inline/deletion.test.ts +2 -2
  27. package/src/parser/inline/deletion.ts +1 -1
  28. package/src/parser/inline/emphasis.test.ts +26 -35
  29. package/src/parser/inline/emphasis.ts +5 -12
  30. package/src/parser/inline/extension/index.test.ts +2 -2
  31. package/src/parser/inline/insertion.test.ts +2 -2
  32. package/src/parser/inline/insertion.ts +1 -1
  33. package/src/parser/inline/link.test.ts +1 -1
  34. package/src/parser/inline/mark.test.ts +1 -1
  35. package/src/parser/inline/mark.ts +1 -1
  36. package/src/parser/inline/strong.test.ts +25 -32
  37. package/src/parser/inline/strong.ts +5 -9
  38. package/src/parser/inline.test.ts +18 -91
  39. package/src/parser/inline.ts +0 -6
  40. package/src/parser/locale/ja.ts +1 -9
  41. package/src/parser/locale.test.ts +1 -1
  42. package/src/parser/source/str.ts +4 -2
  43. package/src/parser/source/text.test.ts +9 -4
  44. package/src/parser/source/text.ts +9 -16
  45. package/src/parser/inline/emstrong.ts +0 -62
  46. package/src/parser/inline/escape.ts +0 -30
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.260.5 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.261.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("DOMPurify"), require("Prism"));
@@ -64,9 +64,9 @@ __exportStar(__webpack_require__(256), exports);
64
64
  Object.defineProperty(exports, "__esModule", ({
65
65
  value: true
66
66
  }));
67
- exports.ObjectSetPrototypeOf = exports.ObjectGetPrototypeOf = exports.ObjectCreate = exports.ObjectAssign = exports.toString = exports.isEnumerable = exports.isPrototypeOf = exports.hasOwnProperty = exports.isArray = exports.sign = exports.round = exports.random = exports.min = exports.max = exports.floor = exports.ceil = exports.abs = exports.parseInt = exports.parseFloat = exports.isSafeInteger = exports.isNaN = exports.isInteger = exports.isFinite = exports[NaN] = void 0;
67
+ exports.ObjectSetPrototypeOf = exports.ObjectGetPrototypeOf = exports.ObjectCreate = exports.ObjectAssign = exports.toString = exports.isEnumerable = exports.isPrototypeOf = exports.hasOwnProperty = exports.isArray = exports.sqrt = exports.log = exports.tan = exports.cos = exports.sign = exports.round = exports.random = exports.min = exports.max = exports.floor = exports.ceil = exports.abs = exports.parseInt = exports.parseFloat = exports.isSafeInteger = exports.isNaN = exports.isInteger = exports.isFinite = exports[NaN] = void 0;
68
68
  exports[NaN] = Number.NaN, exports.isFinite = Number.isFinite, exports.isInteger = Number.isInteger, exports.isNaN = Number.isNaN, exports.isSafeInteger = Number.isSafeInteger, exports.parseFloat = Number.parseFloat, exports.parseInt = Number.parseInt;
69
- exports.abs = Math.abs, exports.ceil = Math.ceil, exports.floor = Math.floor, exports.max = Math.max, exports.min = Math.min, exports.random = Math.random, exports.round = Math.round, exports.sign = Math.sign;
69
+ exports.abs = Math.abs, exports.ceil = Math.ceil, exports.floor = Math.floor, exports.max = Math.max, exports.min = Math.min, exports.random = Math.random, exports.round = Math.round, exports.sign = Math.sign, exports.cos = Math.cos, exports.tan = Math.tan, exports.log = Math.log, exports.sqrt = Math.sqrt;
70
70
  exports.isArray = Array.isArray;
71
71
  exports.hasOwnProperty = Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty);
72
72
  exports.isPrototypeOf = Object.prototype.isPrototypeOf.call.bind(Object.prototype.isPrototypeOf);
@@ -356,6 +356,8 @@ exports.Cache = void 0;
356
356
 
357
357
  const global_1 = __webpack_require__(4128);
358
358
 
359
+ const alias_1 = __webpack_require__(5406);
360
+
359
361
  const clock_1 = __webpack_require__(7681);
360
362
 
361
363
  const invlist_1 = __webpack_require__(7452);
@@ -364,20 +366,23 @@ const heap_1 = __webpack_require__(818);
364
366
 
365
367
  const assign_1 = __webpack_require__(4401);
366
368
 
367
- const tuple_1 = __webpack_require__(5341);
368
-
369
369
  class Cache {
370
370
  constructor(capacity, opts = {}) {
371
371
  this.settings = {
372
+ window: 0,
372
373
  capacity: 0,
373
374
  space: global_1.Infinity,
374
375
  age: global_1.Infinity,
375
376
  earlyExpiring: false,
376
- limit: 950,
377
377
  capture: {
378
378
  delete: true,
379
379
  clear: true
380
- }
380
+ },
381
+ resolution: 1,
382
+ offset: 0,
383
+ block: 20,
384
+ sweep: 10,
385
+ limit: 950
381
386
  };
382
387
  this.overlap = 0;
383
388
  this.SIZE = 0;
@@ -387,31 +392,8 @@ class Cache {
387
392
  LFU: new invlist_1.List()
388
393
  };
389
394
  this.expiries = new heap_1.Heap((a, b) => a.value.expiry - b.value.expiry);
390
- this.stats = {
391
- LRU: (0, tuple_1.tuple)(0, 0),
392
- LFU: (0, tuple_1.tuple)(0, 0),
393
-
394
- slide() {
395
- const {
396
- LRU,
397
- LFU
398
- } = this;
399
- LRU[1] = LRU[0];
400
- LRU[0] = 0;
401
- LFU[1] = LFU[0];
402
- LFU[0] = 0;
403
- },
404
-
405
- clear() {
406
- const {
407
- LRU,
408
- LFU
409
- } = this;
410
- LRU[0] = LRU[1] = 0;
411
- LFU[0] = LFU[1] = 0;
412
- }
413
-
414
- };
395
+ this.misses = 0;
396
+ this.sweep = 0;
415
397
  this.ratio = 500;
416
398
 
417
399
  if (typeof capacity === 'object') {
@@ -419,15 +401,19 @@ class Cache {
419
401
  capacity = opts.capacity ?? 0;
420
402
  }
421
403
 
422
- (0, assign_1.extend)(this.settings, opts, {
404
+ const settings = (0, assign_1.extend)(this.settings, opts, {
423
405
  capacity
424
406
  });
425
- this.capacity = this.settings.capacity;
407
+ this.capacity = settings.capacity;
426
408
  if (this.capacity >= 1 === false) throw new Error(`Spica: Cache: Capacity must be 1 or more.`);
427
- this.space = this.settings.space;
428
- this.limit = this.settings.limit;
429
- this.earlyExpiring = this.settings.earlyExpiring;
430
- this.disposer = this.settings.disposer;
409
+ this.window = settings.window || this.capacity;
410
+ if (this.window * 1000 < this.capacity) throw new Error(`Spica: Cache: Window must be 0.1% of capacity or more.`);
411
+ this.space = settings.space;
412
+ this.block = settings.block;
413
+ this.limit = settings.limit;
414
+ this.earlyExpiring = settings.earlyExpiring;
415
+ this.disposer = settings.disposer;
416
+ this.stats = new Stats(this.window, settings.resolution, settings.offset);
431
417
  }
432
418
 
433
419
  get length() {
@@ -452,7 +438,7 @@ class Cache {
452
438
 
453
439
  ensure(margin, skip) {
454
440
  let size = skip?.value.size ?? 0;
455
- if (margin - size <= 0) return;
441
+ if (margin - size <= 0) return true;
456
442
  const {
457
443
  LRU,
458
444
  LFU
@@ -474,7 +460,6 @@ class Cache {
474
460
  target = LFU.last !== skip ? LFU.last : LFU.length >= 2 ? LFU.last.prev : skip;
475
461
 
476
462
  if (target !== skip) {
477
- if (this.ratio > 500) break;
478
463
  LRU.unshiftNode(target);
479
464
  ++this.overlap;
480
465
  }
@@ -482,6 +467,18 @@ class Cache {
482
467
  // fallthrough
483
468
 
484
469
  default:
470
+ if (this.misses * 100 > LRU.length * this.block) {
471
+ this.sweep ||= LRU.length * this.settings.sweep / 100 + 1 | 0;
472
+
473
+ if (this.sweep > 0) {
474
+ LRU.head = LRU.head.next.next;
475
+ --this.sweep;
476
+ this.sweep ||= -(0, alias_1.round)(LRU.length * this.settings.sweep / 100 * 99 / 100);
477
+ } else {
478
+ ++this.sweep;
479
+ }
480
+ }
481
+
485
482
  target = LRU.last !== skip ? LRU.last : LRU.length >= 2 ? LRU.last.prev : LFU.last;
486
483
  }
487
484
 
@@ -489,6 +486,8 @@ class Cache {
489
486
  skip = skip?.list && skip;
490
487
  size = skip?.value.size ?? 0;
491
488
  }
489
+
490
+ return !!skip?.list;
492
491
  }
493
492
 
494
493
  put(key, value, {
@@ -503,10 +502,9 @@ class Cache {
503
502
  const expiry = age === global_1.Infinity ? global_1.Infinity : (0, clock_1.now)() + age;
504
503
  const node = this.memory.get(key);
505
504
 
506
- if (node) {
505
+ if (node && this.ensure(size, node)) {
507
506
  const val = node.value.value;
508
507
  const index = node.value;
509
- this.ensure(size, node);
510
508
  this.SIZE += size - index.size;
511
509
  index.size = size;
512
510
  index.expiry = expiry;
@@ -550,10 +548,16 @@ class Cache {
550
548
 
551
549
  get(key) {
552
550
  const node = this.memory.get(key);
553
- if (!node) return;
551
+
552
+ if (!node) {
553
+ ++this.misses;
554
+ return;
555
+ }
556
+
554
557
  const expiry = node.value.expiry;
555
558
 
556
559
  if (expiry !== global_1.Infinity && expiry < (0, clock_1.now)()) {
560
+ ++this.misses;
557
561
  this.evict(node, true);
558
562
  return;
559
563
  } // Optimization for memoize.
@@ -561,7 +565,9 @@ class Cache {
561
565
 
562
566
  if (this.capacity > 3 && node === node.list.head) return node.value.value;
563
567
  this.access(node);
564
- this.slide();
568
+ this.adjust();
569
+ this.misses &&= 0;
570
+ this.sweep = 0;
565
571
  return node.value.value;
566
572
  }
567
573
 
@@ -588,6 +594,8 @@ class Cache {
588
594
  }
589
595
 
590
596
  clear() {
597
+ this.misses = 0;
598
+ this.sweep = 0;
591
599
  this.overlap = 0;
592
600
  this.SIZE = 0;
593
601
  this.ratio = 500;
@@ -620,31 +628,26 @@ class Cache {
620
628
  return;
621
629
  }
622
630
 
623
- slide() {
624
- const {
625
- LRU,
626
- LFU
627
- } = this.stats;
631
+ adjust() {
628
632
  const {
629
633
  capacity,
630
634
  ratio,
631
635
  limit,
636
+ stats,
632
637
  indexes
633
638
  } = this;
634
- const window = capacity;
635
- const total = LRU[0] + LFU[0];
636
- total === window && this.stats.slide();
637
- if (total * 1000 % capacity || !LRU[1] || !LFU[1]) return;
639
+ if (stats.subtotal() * 1000 % capacity || !stats.full()) return;
638
640
  const lenR = indexes.LRU.length;
639
641
  const lenF = indexes.LFU.length;
640
- const lenV = this.overlap;
641
- const r = (lenF + lenV) * 1000 / (lenR + lenF || 1) | 0;
642
- const rateR0 = rate(window, LRU[0], LRU[0] + LFU[0], LRU[1], LRU[1] + LFU[1], 0) * r;
643
- const rateF0 = rate(window, LFU[0], LRU[0] + LFU[0], LFU[1], LRU[1] + LFU[1], 0) * (1000 - r);
644
- const rateF1 = rate(window, LFU[1], LRU[1] + LFU[1], LFU[0], LRU[0] + LFU[0], 5) * (1000 - r); // 操作頻度を超えてキャッシュ比率を増減させても余剰比率の消化が追いつかず無駄
642
+ const lenO = this.overlap;
643
+ const leverage = (lenF + lenO) * 1000 / (lenR + lenF) | 0;
644
+ const rateR0 = stats.rateLRU() * leverage;
645
+ const rateF0 = stats.rateLFU() * (1000 - leverage);
646
+ const rateF1 = stats.offset && stats.rateLFU(true) * (1000 - leverage); // 操作頻度を超えてキャッシュ比率を増減させても余剰比率の消化が追いつかず無駄
645
647
  // LRUの下限設定ではLRU拡大の要否を迅速に判定できないためLFUのヒット率低下の検出で代替する
646
648
 
647
- if (ratio > 0 && (rateR0 > rateF0 || rateF0 < rateF1 * 0.95)) {
649
+ if (ratio > 0 && (rateR0 > rateF0 || stats.offset && rateF0 * 100 < rateF1 * (100 - stats.offset))) {
650
+ //rateR0 <= rateF0 && rateF0 * 100 < rateF1 * (100 - stats.offset) && console.debug(0);
648
651
  if (lenR >= capacity * (1000 - ratio) / 1000) {
649
652
  //ratio % 100 || ratio === 1000 || console.debug('-', ratio, LRU, LFU);
650
653
  --this.ratio;
@@ -682,13 +685,100 @@ class Cache {
682
685
 
683
686
  exports.Cache = Cache;
684
687
 
685
- function rate(window, currHits, currTotal, prevHits, prevTotal, offset) {
686
- const prevRate = prevHits * 100 / prevTotal | 0;
687
- const currRatio = currTotal * 100 / window - offset | 0;
688
- if (currRatio <= 0) return prevRate * 100;
689
- const currRate = currHits * 100 / currTotal | 0;
690
- const prevRatio = 100 - currRatio;
691
- return currRate * currRatio + prevRate * prevRatio;
688
+ class Stats {
689
+ constructor(window, resolution, offset) {
690
+ this.window = window;
691
+ this.resolution = resolution;
692
+ this.offset = offset;
693
+ this.max = (0, alias_1.ceil)(this.resolution * (100 + this.offset) / 100) + 1;
694
+ this.LRU = [0];
695
+ this.LFU = [0];
696
+ }
697
+
698
+ get length() {
699
+ return this.LRU.length;
700
+ }
701
+
702
+ full() {
703
+ return this.length === this.max;
704
+ }
705
+
706
+ rateLRU(offset = false) {
707
+ return rate(this.window, this.LRU, this.LFU, +offset && this.offset);
708
+ }
709
+
710
+ rateLFU(offset = false) {
711
+ return rate(this.window, this.LFU, this.LRU, +offset && this.offset);
712
+ }
713
+
714
+ subtotal() {
715
+ const {
716
+ LRU,
717
+ LFU,
718
+ window,
719
+ resolution,
720
+ offset
721
+ } = this;
722
+
723
+ if (offset && LRU[0] + LFU[0] >= window * offset / 100) {
724
+ if (this.length === 1) {
725
+ this.slide();
726
+ } else {
727
+ LRU[1] += LRU[0];
728
+ LFU[1] += LFU[0];
729
+ LRU[0] = 0;
730
+ LFU[0] = 0;
731
+ }
732
+ }
733
+
734
+ const subtotal = LRU[+offset && 1] + LFU[+offset && 1] || 0;
735
+ subtotal >= window / resolution && this.slide();
736
+ return LRU[0] + LFU[0];
737
+ }
738
+
739
+ slide() {
740
+ const {
741
+ LRU,
742
+ LFU,
743
+ max
744
+ } = this;
745
+
746
+ if (LRU.length === max) {
747
+ LRU.pop();
748
+ LFU.pop();
749
+ }
750
+
751
+ LRU.unshift(0);
752
+ LFU.unshift(0);
753
+ }
754
+
755
+ clear() {
756
+ this.LRU = [0];
757
+ this.LFU = [0];
758
+ }
759
+
760
+ }
761
+
762
+ function rate(window, hits1, hits2, offset) {
763
+ let total = 0;
764
+ let hits = 0;
765
+ let ratio = 100;
766
+
767
+ for (let i = 0, len = hits1.length; i < len; ++i) {
768
+ const subtotal = hits1[i] + hits2[i];
769
+ if (subtotal === 0) continue;
770
+ offset = i + 1 === len ? 0 : offset;
771
+ const subratio = (0, alias_1.min)(subtotal * 100 / window, ratio) - offset;
772
+ offset = offset && subratio < 0 ? -subratio : 0;
773
+ if (subratio <= 0) continue;
774
+ const rate = window * subratio / subtotal;
775
+ total += subtotal * rate;
776
+ hits += hits1[i] * rate;
777
+ ratio -= subratio;
778
+ if (ratio <= 0) break;
779
+ }
780
+
781
+ return hits * 10000 / total | 0;
692
782
  }
693
783
 
694
784
  /***/ }),
@@ -1671,25 +1761,6 @@ function random(len) {
1671
1761
 
1672
1762
  /***/ }),
1673
1763
 
1674
- /***/ 5341:
1675
- /***/ ((__unused_webpack_module, exports) => {
1676
-
1677
- "use strict";
1678
-
1679
-
1680
- Object.defineProperty(exports, "__esModule", ({
1681
- value: true
1682
- }));
1683
- exports.tuple = void 0;
1684
-
1685
- function tuple(...as) {
1686
- return as;
1687
- }
1688
-
1689
- exports.tuple = tuple;
1690
-
1691
- /***/ }),
1692
-
1693
1764
  /***/ 5177:
1694
1765
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1695
1766
 
@@ -5502,15 +5573,16 @@ const source_1 = __webpack_require__(6743);
5502
5573
 
5503
5574
  const dom_1 = __webpack_require__(3252);
5504
5575
 
5505
- exports.cite = (0, combinator_1.creation)(1, false, (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.validate)('>>', (0, combinator_1.reverse)((0, combinator_1.tails)([(0, source_1.str)(/^>*(?=>>[^>\s]+[^\S\n]*(?:$|\n))/), (0, combinator_1.union)([anchor_1.anchor, // Subject page representation.
5576
+ exports.cite = (0, combinator_1.creation)(1, false, (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.validate)('>>', (0, combinator_1.reverse)((0, combinator_1.tails)([(0, source_1.str)(/^>*(?=>>[^>\s]+\s*$)/), (0, combinator_1.union)([anchor_1.anchor, // Subject page representation.
5506
5577
  // リンクの実装は後で検討
5507
- (0, combinator_1.focus)(/^>>\.[^\S\n]*(?:$|\n)/, () => [[(0, dom_1.html)('a', {
5578
+ (0, combinator_1.focus)(/^>>\.(?=\s*$)/, () => [[(0, dom_1.html)('a', {
5508
5579
  class: 'anchor'
5509
- }, '>>.')], '']), (0, combinator_1.focus)(/^>>#\S*[^\S\n]*(?:$|\n)/, ({
5580
+ }, '>>.')], '']), (0, combinator_1.focus)(/^>>#\S*(?=\s*$)/, ({
5510
5581
  source
5511
5582
  }) => [[(0, dom_1.html)('a', {
5512
5583
  class: 'anchor'
5513
- }, source)], '']), (0, combinator_1.focus)(/^>>https?:\/\/\w\S*[^\S\n]*(?:$|\n)/, ({
5584
+ }, source)], '']), // Support all domains, but don't support IP(v6) addresses.
5585
+ (0, combinator_1.focus)(/^>>https?:\/\/[^\p{C}\p{S}\p{P}\s]\S*(?=\s*$)/u, ({
5514
5586
  source
5515
5587
  }) => [[(0, dom_1.html)('a', {
5516
5588
  class: 'anchor',
@@ -5814,8 +5886,6 @@ exports.shortmedia = exports.media = exports.indexer = exports.indexee = exports
5814
5886
 
5815
5887
  const combinator_1 = __webpack_require__(2087);
5816
5888
 
5817
- const escape_1 = __webpack_require__(2778);
5818
-
5819
5889
  const annotation_1 = __webpack_require__(2736);
5820
5890
 
5821
5891
  const reference_1 = __webpack_require__(3555);
@@ -5840,8 +5910,6 @@ const deletion_1 = __webpack_require__(7501);
5840
5910
 
5841
5911
  const mark_1 = __webpack_require__(2480);
5842
5912
 
5843
- const emstrong_1 = __webpack_require__(6132);
5844
-
5845
5913
  const emphasis_1 = __webpack_require__(3867);
5846
5914
 
5847
5915
  const strong_1 = __webpack_require__(8072);
@@ -5860,7 +5928,7 @@ const bracket_1 = __webpack_require__(5196);
5860
5928
 
5861
5929
  const source_1 = __webpack_require__(6743);
5862
5930
 
5863
- exports.inline = (0, combinator_1.union)([escape_1.escape, annotation_1.annotation, reference_1.reference, template_1.template, comment_1.comment, math_1.math, extension_1.extension, ruby_1.ruby, link_1.link, media_1.media, html_1.html, insertion_1.insertion, deletion_1.deletion, mark_1.mark, emstrong_1.emstrong, strong_1.strong, emphasis_1.emphasis, code_1.code, htmlentity_1.htmlentity, shortmedia_1.shortmedia, autolink_1.autolink, bracket_1.bracket, source_1.text]);
5931
+ exports.inline = (0, combinator_1.union)([annotation_1.annotation, reference_1.reference, template_1.template, comment_1.comment, math_1.math, extension_1.extension, ruby_1.ruby, link_1.link, media_1.media, html_1.html, insertion_1.insertion, deletion_1.deletion, mark_1.mark, strong_1.strong, emphasis_1.emphasis, code_1.code, htmlentity_1.htmlentity, shortmedia_1.shortmedia, autolink_1.autolink, bracket_1.bracket, source_1.text]);
5864
5932
 
5865
5933
  var indexee_1 = __webpack_require__(1269);
5866
5934
 
@@ -5975,10 +6043,18 @@ exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-
5975
6043
  , 1, 1, ~1
5976
6044
  /* State.shortcut */
5977
6045
  , (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
5978
- (0, source_1.str)(/^[0-9a-z]+(?:[.+_-][0-9a-z]+)*(?:@(?:[0-9a-z]+(?:[.-][0-9a-z]+)*)?)*/i), channel_1.channel, account_1.account, // Escape unmatched account-like strings.
6046
+ (0, combinator_1.focus)(/^[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z])*(?:@(?:[0-9a-z]+(?:[.-][0-9a-z]+)*)?)*/i, ({
6047
+ source
6048
+ }) => {
6049
+ if (source.length > 255 || source.includes('@')) return [[source], ''];
6050
+ const i = source.indexOf('_');
6051
+ if (i === -1) return [[source], ''];
6052
+ return [[source.slice(0, i)], source.slice(i)];
6053
+ }), channel_1.channel, account_1.account, // Escape unmatched account-like strings.
5979
6054
  (0, source_1.str)(/^@+[0-9a-z]*(?:-[0-9a-z]+)*/i), // Escape invalid leading characters.
5980
- (0, source_1.str)(new RegExp(/^(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])(?=#)/u.source.replace('emoji', hashtag_1.emoji), 'u')), hashtag_1.hashtag, hashnum_1.hashnum, // Escape unmatched hashtag-like strings.
5981
- (0, source_1.str)(new RegExp(/^#+(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])*/u.source.replace('emoji', hashtag_1.emoji), 'u')), anchor_1.anchor]))))), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)]);
6055
+ (0, source_1.str)(new RegExp(/^(?:[^\p{C}\p{S}\p{P}\s]|emoji)(?=#)/u.source.replace('emoji', hashtag_1.emoji), 'u')), hashtag_1.hashtag, hashnum_1.hashnum, // Escape unmatched hashtag-like strings.
6056
+ (0, source_1.str)(new RegExp(/^#+(?:[^\p{C}\p{S}\p{P}\s]|emoji|')*/u.source.replace('emoji', hashtag_1.emoji), 'u')), // Escape invalid leading characters.
6057
+ (0, source_1.str)(/^[0-9\p{Sc}](?=>)/u), anchor_1.anchor]))))), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)]);
5982
6058
 
5983
6059
  /***/ }),
5984
6060
 
@@ -6094,7 +6170,7 @@ const source_1 = __webpack_require__(6743);
6094
6170
  const dom_1 = __webpack_require__(3252); // https://html.spec.whatwg.org/multipage/input.html
6095
6171
 
6096
6172
 
6097
- exports.email = (0, combinator_1.creation)((0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9a-z](?:[.+_-](?=[^\W_])|[0-9a-z]){0,255}@[0-9a-z](?:(?:[0-9a-z]|-(?=\w)){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=\w)){0,61}[0-9a-z])?)*(?![0-9a-z])/i), ([source]) => source.length <= 255), ({
6173
+ exports.email = (0, combinator_1.creation)((0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,255}@[0-9a-z](?:(?:[0-9a-z]|-(?=\w)){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=\w)){0,61}[0-9a-z])?)*(?![0-9a-z])/i), ([source]) => source.length <= 255), ({
6098
6174
  source
6099
6175
  }) => [[(0, dom_1.html)('a', {
6100
6176
  class: 'email',
@@ -6126,7 +6202,7 @@ const dom_1 = __webpack_require__(3252);
6126
6202
 
6127
6203
  exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.constraint)(1
6128
6204
  /* State.shortcut */
6129
- , false, (0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|emoji|['_])/u.source.replace(/emoji/, hashtag_1.emoji), 'u')))), (0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
6205
+ , false, (0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|emoji|')/u.source.replace(/emoji/, hashtag_1.emoji), 'u')))), (0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
6130
6206
  class: 'hashnum',
6131
6207
  href: null
6132
6208
  })]));
@@ -6157,7 +6233,7 @@ const dom_1 = __webpack_require__(3252); // https://example/hashtags/a must be a
6157
6233
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
6158
6234
  exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.constraint)(1
6159
6235
  /* State.shortcut */
6160
- , false, (0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9a-z](?:(?:[0-9a-z]|-(?=\w)){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=\w)){0,61}[0-9a-z])?)*\//i), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/^(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|_(?=[^\p{C}\p{S}\p{P}\s]|emoji)){1,128}/u.source, /(?!_?(?:[^\p{C}\p{S}\p{P}\s]|emoji)|')/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), ([source]) => source.length <= 128)]))), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/hashtags/')}` : `/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
6236
+ , false, (0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9a-z](?:(?:[0-9a-z]|-(?=\w)){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=\w)){0,61}[0-9a-z])?)*\//i), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/^(?=(?:[0-9]{1,127}_?)?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji|'))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|(?<!')'|_(?=[^\p{C}\p{S}\p{P}\s]|emoji|')){1,128}/u.source, /(?!_?(?:[^\p{C}\p{S}\p{P}\s]|emoji|(?<!')'))/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), ([source]) => source.length <= 128)]))), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/hashtags/')}` : `/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
6161
6237
  class: 'hashtag'
6162
6238
  }, el.innerText)]));
6163
6239
 
@@ -6180,7 +6256,7 @@ const link_1 = __webpack_require__(9628);
6180
6256
 
6181
6257
  const source_1 = __webpack_require__(6743);
6182
6258
 
6183
- const closer = /^[-+*=~^,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
6259
+ const closer = /^[-+*=~^_,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
6184
6260
  exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.unescsource, closer)])))), (0, combinator_1.convert)(url => `{ ${url} }`, (0, combinator_1.union)([link_1.unsafelink])))));
6185
6261
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.precedence)(2, (0, combinator_1.union)([(0, combinator_1.surround)('(', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), ')', true), (0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), ']', true), (0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), '}', true), (0, combinator_1.surround)('"', (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.unescsource, '"')), '"', true)]))));
6186
6262
 
@@ -6332,7 +6408,7 @@ const dom_1 = __webpack_require__(3252);
6332
6408
 
6333
6409
  const array_1 = __webpack_require__(8112);
6334
6410
 
6335
- exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.syntax)(0
6411
+ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('~~', '~'), (0, combinator_1.syntax)(0
6336
6412
  /* Syntax.none */
6337
6413
  , 1, 1, 0
6338
6414
  /* State.none */
@@ -6355,45 +6431,6 @@ const combinator_1 = __webpack_require__(2087);
6355
6431
 
6356
6432
  const inline_1 = __webpack_require__(1160);
6357
6433
 
6358
- const emstrong_1 = __webpack_require__(6132);
6359
-
6360
- const strong_1 = __webpack_require__(8072);
6361
-
6362
- const source_1 = __webpack_require__(6743);
6363
-
6364
- const visibility_1 = __webpack_require__(7618);
6365
-
6366
- const dom_1 = __webpack_require__(3252);
6367
-
6368
- const array_1 = __webpack_require__(8112);
6369
-
6370
- exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*'), (0, combinator_1.syntax)(0
6371
- /* Syntax.none */
6372
- , 1, 1, 0
6373
- /* State.none */
6374
- , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])), '*')), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6375
-
6376
- /***/ }),
6377
-
6378
- /***/ 6132:
6379
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6380
-
6381
- "use strict";
6382
-
6383
-
6384
- Object.defineProperty(exports, "__esModule", ({
6385
- value: true
6386
- }));
6387
- exports.emstrong = void 0;
6388
-
6389
- const combinator_1 = __webpack_require__(2087);
6390
-
6391
- const inline_1 = __webpack_require__(1160);
6392
-
6393
- const strong_1 = __webpack_require__(8072);
6394
-
6395
- const emphasis_1 = __webpack_require__(3867);
6396
-
6397
6434
  const source_1 = __webpack_require__(6743);
6398
6435
 
6399
6436
  const visibility_1 = __webpack_require__(7618);
@@ -6402,77 +6439,11 @@ const dom_1 = __webpack_require__(3252);
6402
6439
 
6403
6440
  const array_1 = __webpack_require__(8112);
6404
6441
 
6405
- const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong]))])));
6406
- const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
6407
- exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('***'), (0, combinator_1.syntax)(0
6442
+ exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('_', '_'), (0, combinator_1.syntax)(0
6408
6443
  /* Syntax.none */
6409
6444
  , 1, 1, 0
6410
6445
  /* State.none */
6411
- , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
6412
- switch (cs[0]) {
6413
- case '***':
6414
- return [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))])], rest];
6415
-
6416
- case '**':
6417
- return (0, combinator_1.bind)(subemphasis, (ds, rest) => rest.slice(0, 1) === '*' ? [[(0, dom_1.html)('em', (0, array_1.unshift)([(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds)))], rest.slice(1)] : [(0, array_1.unshift)(['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], ds), rest])({
6418
- source: rest,
6419
- context
6420
- }) ?? [['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest];
6421
-
6422
- case '*':
6423
- return (0, combinator_1.bind)(substrong, (ds, rest) => rest.slice(0, 2) === '**' ? [[(0, dom_1.html)('strong', (0, array_1.unshift)([(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds)))], rest.slice(2)] : [(0, array_1.unshift)(['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], ds), rest])({
6424
- source: rest,
6425
- context
6426
- }) ?? [['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest];
6427
- }
6428
- }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6429
-
6430
- /***/ }),
6431
-
6432
- /***/ 2778:
6433
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6434
-
6435
- "use strict";
6436
-
6437
-
6438
- Object.defineProperty(exports, "__esModule", ({
6439
- value: true
6440
- }));
6441
- exports.escape = void 0;
6442
-
6443
- const global_1 = __webpack_require__(4128);
6444
-
6445
- const combinator_1 = __webpack_require__(2087);
6446
-
6447
- const source_1 = __webpack_require__(6743);
6448
-
6449
- const repeat = (0, source_1.str)(/^(.)\1*/);
6450
- exports.escape = (0, combinator_1.union)([({
6451
- source,
6452
- context
6453
- }) => {
6454
- if (source.length < 3) return;
6455
-
6456
- switch (source[0]) {
6457
- case '*':
6458
- if (source.length < 4) return;
6459
- return source[3] === source[0] && source[2] === source[0] && source[1] === source[0] ? repeat({
6460
- source,
6461
- context
6462
- }) : global_1.undefined;
6463
-
6464
- case '+':
6465
- case '~':
6466
- case '=':
6467
- return source[2] === source[0] && source[1] === source[0] ? repeat({
6468
- source,
6469
- context
6470
- }) : global_1.undefined;
6471
-
6472
- default:
6473
- return;
6474
- }
6475
- }]);
6446
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('_')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '_'), exports.emphasis)])))), (0, source_1.str)('_'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6476
6447
 
6477
6448
  /***/ }),
6478
6449
 
@@ -6904,7 +6875,7 @@ const dom_1 = __webpack_require__(3252);
6904
6875
 
6905
6876
  const array_1 = __webpack_require__(8112);
6906
6877
 
6907
- exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.syntax)(0
6878
+ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('++', '+'), (0, combinator_1.syntax)(0
6908
6879
  /* Syntax.none */
6909
6880
  , 1, 1, 0
6910
6881
  /* State.none */
@@ -7110,7 +7081,7 @@ const dom_1 = __webpack_require__(3252);
7110
7081
 
7111
7082
  const array_1 = __webpack_require__(8112);
7112
7083
 
7113
- exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('=='), (0, combinator_1.syntax)(0
7084
+ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('==', '='), (0, combinator_1.syntax)(0
7114
7085
  /* Syntax.none */
7115
7086
  , 1, 1, 0
7116
7087
  /* State.none */
@@ -7490,8 +7461,6 @@ const combinator_1 = __webpack_require__(2087);
7490
7461
 
7491
7462
  const inline_1 = __webpack_require__(1160);
7492
7463
 
7493
- const emstrong_1 = __webpack_require__(6132);
7494
-
7495
7464
  const source_1 = __webpack_require__(6743);
7496
7465
 
7497
7466
  const visibility_1 = __webpack_require__(7618);
@@ -7500,11 +7469,11 @@ const dom_1 = __webpack_require__(3252);
7500
7469
 
7501
7470
  const array_1 = __webpack_require__(8112);
7502
7471
 
7503
- exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**'), (0, combinator_1.syntax)(0
7472
+ exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*', '*'), (0, combinator_1.syntax)(0
7504
7473
  /* Syntax.none */
7505
7474
  , 1, 1, 0
7506
7475
  /* State.none */
7507
- , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])), '*')), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
7476
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), exports.strong)])))), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
7508
7477
 
7509
7478
  /***/ }),
7510
7479
 
@@ -7630,16 +7599,7 @@ Object.defineProperty(exports, "__esModule", ({
7630
7599
  exports.japanese = void 0;
7631
7600
 
7632
7601
  function japanese(char) {
7633
- switch (char) {
7634
- case '、':
7635
- case '。':
7636
- case '!':
7637
- case '?':
7638
- return true;
7639
-
7640
- default:
7641
- return false;
7642
- }
7602
+ return /^[\p{Ideo}\p{scx=Hiragana}\p{scx=Katakana}~!?]/u.test(char);
7643
7603
  }
7644
7604
 
7645
7605
  exports.japanese = japanese;
@@ -8263,17 +8223,19 @@ const global_1 = __webpack_require__(4128);
8263
8223
 
8264
8224
  const combinator_1 = __webpack_require__(2087);
8265
8225
 
8266
- function str(pattern) {
8226
+ function str(pattern, not) {
8267
8227
  return typeof pattern === 'string' ? (0, combinator_1.creation)(1, false, ({
8268
8228
  source
8269
8229
  }) => {
8270
8230
  if (source === '') return;
8231
+ if (not && source.slice(pattern.length, pattern.length + not.length) === not) return;
8271
8232
  return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] : global_1.undefined;
8272
8233
  }) : (0, combinator_1.creation)(1, false, ({
8273
8234
  source
8274
8235
  }) => {
8275
8236
  if (source === '') return;
8276
8237
  const m = source.match(pattern);
8238
+ if (m && not && source.slice(m[0].length, m[0].length + not.length) === not) return;
8277
8239
  return m && m[0].length > 0 ? [[m[0]], source.slice(m[0].length)] : global_1.undefined;
8278
8240
  });
8279
8241
  }
@@ -8318,9 +8280,10 @@ const str_1 = __webpack_require__(2790);
8318
8280
 
8319
8281
  const dom_1 = __webpack_require__(3252);
8320
8282
 
8321
- exports.delimiter = /[\s\x00-\x7F]|\S[#>]|[()、。!?][^\S\n]*(?=\\\n)/;
8283
+ exports.delimiter = /[\s\x00-\x7F]|\S[#>]|[\p{Ideo}\p{scx=Hiragana}\p{scx=Katakana}~!?][^\S\n]*(?=\\\n)/u;
8322
8284
  exports.nonWhitespace = /[\S\n]|$/;
8323
8285
  exports.nonAlphanumeric = /[^0-9A-Za-z]|\S[#>]|$/;
8286
+ const nssb = /^[\p{Ideo}\p{scx=Hiragana}\p{scx=Katakana}~!?][^\S\n]*(?=\\\n)/u;
8324
8287
  const repeat = (0, str_1.str)(/^(.)\1*/);
8325
8288
  exports.text = (0, combinator_1.creation)(1, false, ({
8326
8289
  source,
@@ -8337,25 +8300,15 @@ exports.text = (0, combinator_1.creation)(1, false, ({
8337
8300
  switch (source[0]) {
8338
8301
  case '\x1B':
8339
8302
  case '\\':
8340
- switch (source[1]) {
8341
- case '、':
8342
- case '。':
8343
- case '!':
8344
- case '?':
8345
- return (0, exports.text)({
8346
- source: source.slice(1),
8347
- context
8348
- });
8349
- }
8350
-
8351
- break;
8303
+ if (!nssb.test(source.slice(1))) break;
8304
+ return (0, exports.text)({
8305
+ source: source.slice(1),
8306
+ context
8307
+ });
8352
8308
 
8353
- case '、':
8354
- case '。':
8355
- case '':
8356
- case '?':
8357
- const i = source.slice(1).search(exports.nonWhitespace) + 1;
8358
- if (i > 0 && source.slice(i, i + 2) === '\\\n') return [[source[0], (0, dom_1.html)('span', {
8309
+ default:
8310
+ const i = source.match(nssb)?.[0].length ?? -1;
8311
+ if (i !== -1) return [[source[0], (0, dom_1.html)('span', {
8359
8312
  class: 'linebreak'
8360
8313
  })], source.slice(i + 2)];
8361
8314
  }
@@ -8379,6 +8332,7 @@ exports.text = (0, combinator_1.creation)(1, false, ({
8379
8332
  case '\n':
8380
8333
  return [[(0, dom_1.html)('br')], source.slice(1)];
8381
8334
 
8335
+ case '_':
8382
8336
  case '*':
8383
8337
  case '+':
8384
8338
  case '~':