@d-i-t-a/reader 2.0.6-beta.2 → 2.0.6-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -2471,13 +2471,13 @@ var require_common = __commonJS({
2471
2471
  createDebug.names = [];
2472
2472
  createDebug.skips = [];
2473
2473
  let i;
2474
- const split2 = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
2475
- const len = split2.length;
2474
+ const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
2475
+ const len = split.length;
2476
2476
  for (i = 0; i < len; i++) {
2477
- if (!split2[i]) {
2477
+ if (!split[i]) {
2478
2478
  continue;
2479
2479
  }
2480
- namespaces = split2[i].replace(/\*/g, ".*?");
2480
+ namespaces = split[i].replace(/\*/g, ".*?");
2481
2481
  if (namespaces[0] === "-") {
2482
2482
  createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
2483
2483
  } else {
@@ -11626,7 +11626,7 @@ var require_list = __commonJS({
11626
11626
  split(string, separators, last) {
11627
11627
  let array = [];
11628
11628
  let current = "";
11629
- let split2 = false;
11629
+ let split = false;
11630
11630
  let func = 0;
11631
11631
  let quote = false;
11632
11632
  let escape2 = false;
@@ -11648,13 +11648,13 @@ var require_list = __commonJS({
11648
11648
  func -= 1;
11649
11649
  } else if (func === 0) {
11650
11650
  if (separators.includes(letter))
11651
- split2 = true;
11651
+ split = true;
11652
11652
  }
11653
- if (split2) {
11653
+ if (split) {
11654
11654
  if (current !== "")
11655
11655
  array.push(current.trim());
11656
11656
  current = "";
11657
- split2 = false;
11657
+ split = false;
11658
11658
  } else {
11659
11659
  current += letter;
11660
11660
  }
@@ -18371,7 +18371,7 @@ var require_lodash = __commonJS({
18371
18371
  var snakeCase = createCompounder(function(result2, word, index2) {
18372
18372
  return result2 + (index2 ? "_" : "") + word.toLowerCase();
18373
18373
  });
18374
- function split2(string, separator, limit) {
18374
+ function split(string, separator, limit) {
18375
18375
  if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
18376
18376
  separator = limit = undefined2;
18377
18377
  }
@@ -18853,7 +18853,7 @@ var require_lodash = __commonJS({
18853
18853
  lodash4.sortBy = sortBy;
18854
18854
  lodash4.sortedUniq = sortedUniq;
18855
18855
  lodash4.sortedUniqBy = sortedUniqBy;
18856
- lodash4.split = split2;
18856
+ lodash4.split = split;
18857
18857
  lodash4.spread = spread;
18858
18858
  lodash4.tail = tail;
18859
18859
  lodash4.take = take;
@@ -29652,14 +29652,14 @@ var require_lib7 = __commonJS({
29652
29652
  return regExpStr;
29653
29653
  }
29654
29654
  function semverify(version) {
29655
- const split2 = Array.isArray(version) ? version : version.toString().split(".");
29656
- if (isAllVersion(split2[0])) {
29657
- return [split2[0], 0, 0];
29655
+ const split = Array.isArray(version) ? version : version.toString().split(".");
29656
+ if (isAllVersion(split[0])) {
29657
+ return [split[0], 0, 0];
29658
29658
  }
29659
- while (split2.length < 3) {
29660
- split2.push("0");
29659
+ while (split.length < 3) {
29660
+ split.push("0");
29661
29661
  }
29662
- return split2.map((_) => {
29662
+ return split.map((_) => {
29663
29663
  const num = typeof _ === "number" ? _ : parseInt(_, 10);
29664
29664
  return isNaN(num) ? 0 : num;
29665
29665
  });
@@ -33574,1201 +33574,6 @@ var require_eventemitter3 = __commonJS({
33574
33574
  }
33575
33575
  });
33576
33576
 
33577
- // node_modules/@textlint/ast-node-types/lib/index.js
33578
- var require_lib8 = __commonJS({
33579
- "node_modules/@textlint/ast-node-types/lib/index.js"(exports) {
33580
- init_polyfills();
33581
- "use strict";
33582
- Object.defineProperty(exports, "__esModule", { value: true });
33583
- exports.ASTNodeTypes = void 0;
33584
- var ASTNodeTypes;
33585
- (function(ASTNodeTypes2) {
33586
- ASTNodeTypes2["Document"] = "Document";
33587
- ASTNodeTypes2["DocumentExit"] = "Document:exit";
33588
- ASTNodeTypes2["Paragraph"] = "Paragraph";
33589
- ASTNodeTypes2["ParagraphExit"] = "Paragraph:exit";
33590
- ASTNodeTypes2["BlockQuote"] = "BlockQuote";
33591
- ASTNodeTypes2["BlockQuoteExit"] = "BlockQuote:exit";
33592
- ASTNodeTypes2["ListItem"] = "ListItem";
33593
- ASTNodeTypes2["ListItemExit"] = "ListItem:exit";
33594
- ASTNodeTypes2["List"] = "List";
33595
- ASTNodeTypes2["ListExit"] = "List:exit";
33596
- ASTNodeTypes2["Header"] = "Header";
33597
- ASTNodeTypes2["HeaderExit"] = "Header:exit";
33598
- ASTNodeTypes2["CodeBlock"] = "CodeBlock";
33599
- ASTNodeTypes2["CodeBlockExit"] = "CodeBlock:exit";
33600
- ASTNodeTypes2["HtmlBlock"] = "HtmlBlock";
33601
- ASTNodeTypes2["HtmlBlockExit"] = "HtmlBlock:exit";
33602
- ASTNodeTypes2["HorizontalRule"] = "HorizontalRule";
33603
- ASTNodeTypes2["HorizontalRuleExit"] = "HorizontalRule:exit";
33604
- ASTNodeTypes2["Comment"] = "Comment";
33605
- ASTNodeTypes2["CommentExit"] = "Comment:exit";
33606
- ASTNodeTypes2["ReferenceDef"] = "ReferenceDef";
33607
- ASTNodeTypes2["ReferenceDefExit"] = "ReferenceDef:exit";
33608
- ASTNodeTypes2["Str"] = "Str";
33609
- ASTNodeTypes2["StrExit"] = "Str:exit";
33610
- ASTNodeTypes2["Break"] = "Break";
33611
- ASTNodeTypes2["BreakExit"] = "Break:exit";
33612
- ASTNodeTypes2["Emphasis"] = "Emphasis";
33613
- ASTNodeTypes2["EmphasisExit"] = "Emphasis:exit";
33614
- ASTNodeTypes2["Strong"] = "Strong";
33615
- ASTNodeTypes2["StrongExit"] = "Strong:exit";
33616
- ASTNodeTypes2["Html"] = "Html";
33617
- ASTNodeTypes2["HtmlExit"] = "Html:exit";
33618
- ASTNodeTypes2["Link"] = "Link";
33619
- ASTNodeTypes2["LinkExit"] = "Link:exit";
33620
- ASTNodeTypes2["Image"] = "Image";
33621
- ASTNodeTypes2["ImageExit"] = "Image:exit";
33622
- ASTNodeTypes2["Code"] = "Code";
33623
- ASTNodeTypes2["CodeExit"] = "Code:exit";
33624
- ASTNodeTypes2["Delete"] = "Delete";
33625
- ASTNodeTypes2["DeleteExit"] = "Delete:exit";
33626
- })(ASTNodeTypes = exports.ASTNodeTypes || (exports.ASTNodeTypes = {}));
33627
- }
33628
- });
33629
-
33630
- // node_modules/boundary/lib/index.js
33631
- var require_lib9 = __commonJS({
33632
- "node_modules/boundary/lib/index.js"(exports) {
33633
- init_polyfills();
33634
- "use strict";
33635
- function compare(v1, v2) {
33636
- return v1 < v2;
33637
- }
33638
- function upperBound(array, value, comp) {
33639
- if (comp === void 0)
33640
- comp = compare;
33641
- return function() {
33642
- var len = array.length;
33643
- var i = 0;
33644
- while (len) {
33645
- var diff = len >>> 1;
33646
- var cursor = i + diff;
33647
- if (comp(value, array[cursor])) {
33648
- len = diff;
33649
- } else {
33650
- i = cursor + 1;
33651
- len -= diff + 1;
33652
- }
33653
- }
33654
- return i;
33655
- }();
33656
- }
33657
- function lowerBound(array, value, comp) {
33658
- if (comp === void 0)
33659
- comp = compare;
33660
- return function() {
33661
- var len = array.length;
33662
- var i = 0;
33663
- while (len) {
33664
- var diff = len >>> 1;
33665
- var cursor = i + diff;
33666
- if (comp(array[cursor], value)) {
33667
- i = cursor + 1;
33668
- len -= diff + 1;
33669
- } else {
33670
- len = diff;
33671
- }
33672
- }
33673
- return i;
33674
- }();
33675
- }
33676
- function binarySearch(array, value, comp) {
33677
- if (comp === void 0)
33678
- comp = compare;
33679
- return function() {
33680
- var cursor = lowerBound(array, value, comp);
33681
- return cursor !== array.length && !comp(value, array[cursor]);
33682
- }();
33683
- }
33684
- exports.compare = compare;
33685
- exports.lowerBound = lowerBound;
33686
- exports.upperBound = upperBound;
33687
- exports.binarySearch = binarySearch;
33688
- }
33689
- });
33690
-
33691
- // node_modules/structured-source/lib/structured-source.js
33692
- var require_structured_source = __commonJS({
33693
- "node_modules/structured-source/lib/structured-source.js"(exports) {
33694
- init_polyfills();
33695
- "use strict";
33696
- var _classProps = function(child, staticProps, instanceProps) {
33697
- if (staticProps)
33698
- Object.defineProperties(child, staticProps);
33699
- if (instanceProps)
33700
- Object.defineProperties(child.prototype, instanceProps);
33701
- };
33702
- var upperBound = require_lib9().upperBound;
33703
- var Position = function Position2(line, column) {
33704
- this.line = line;
33705
- this.column = column;
33706
- };
33707
- exports.Position = Position;
33708
- var SourceLocation = function SourceLocation2(start, end) {
33709
- this.start = start;
33710
- this.end = end;
33711
- };
33712
- exports.SourceLocation = SourceLocation;
33713
- var StructuredSource = function() {
33714
- var StructuredSource2 = function StructuredSource3(source) {
33715
- this.indice = [0];
33716
- var regexp = /[\r\n\u2028\u2029]/g;
33717
- var length = source.length;
33718
- regexp.lastIndex = 0;
33719
- while (true) {
33720
- var result = regexp.exec(source);
33721
- if (!result) {
33722
- break;
33723
- }
33724
- var index2 = result.index;
33725
- if (source.charCodeAt(index2) === 13 && source.charCodeAt(index2 + 1) === 10) {
33726
- index2 += 1;
33727
- }
33728
- var nextIndex = index2 + 1;
33729
- if (length < nextIndex) {
33730
- break;
33731
- }
33732
- this.indice.push(nextIndex);
33733
- regexp.lastIndex = nextIndex;
33734
- }
33735
- };
33736
- StructuredSource2.prototype.locationToRange = function(loc) {
33737
- return [this.positionToIndex(loc.start), this.positionToIndex(loc.end)];
33738
- };
33739
- StructuredSource2.prototype.rangeToLocation = function(range) {
33740
- return new SourceLocation(this.indexToPosition(range[0]), this.indexToPosition(range[1]));
33741
- };
33742
- StructuredSource2.prototype.positionToIndex = function(pos) {
33743
- var start = this.indice[pos.line - 1];
33744
- return start + pos.column;
33745
- };
33746
- StructuredSource2.prototype.indexToPosition = function(index2) {
33747
- var startLine = upperBound(this.indice, index2);
33748
- return new Position(startLine, index2 - this.indice[startLine - 1]);
33749
- };
33750
- _classProps(StructuredSource2, null, {
33751
- line: {
33752
- get: function() {
33753
- return this.indice.length;
33754
- }
33755
- }
33756
- });
33757
- return StructuredSource2;
33758
- }();
33759
- exports["default"] = StructuredSource;
33760
- }
33761
- });
33762
-
33763
- // node_modules/structured-source/lib/index.js
33764
- var require_lib10 = __commonJS({
33765
- "node_modules/structured-source/lib/index.js"(exports, module) {
33766
- init_polyfills();
33767
- "use strict";
33768
- var StructuredSource = require_structured_source()["default"];
33769
- module.exports = StructuredSource;
33770
- }
33771
- });
33772
-
33773
- // node_modules/sentence-splitter/lib/parser/SourceCode.js
33774
- var require_SourceCode = __commonJS({
33775
- "node_modules/sentence-splitter/lib/parser/SourceCode.js"(exports) {
33776
- init_polyfills();
33777
- "use strict";
33778
- var __importDefault = exports && exports.__importDefault || function(mod) {
33779
- return mod && mod.__esModule ? mod : { "default": mod };
33780
- };
33781
- Object.defineProperty(exports, "__esModule", { value: true });
33782
- exports.SourceCode = void 0;
33783
- var structured_source_1 = __importDefault(require_lib10());
33784
- var SourceCode = function() {
33785
- function SourceCode2(input) {
33786
- this.index = 0;
33787
- this.contexts = [];
33788
- this.contextRanges = [];
33789
- if (typeof input === "string") {
33790
- this.textCharacters = input.split("");
33791
- this.source = new structured_source_1.default(input);
33792
- this.startOffset = 0;
33793
- this.firstChildPadding = 0;
33794
- } else {
33795
- this.sourceNode = input;
33796
- this.startOffset = this.sourceNode.range[0];
33797
- this.index = this.startOffset;
33798
- var lineBreaks = Array.from(new Array(this.sourceNode.loc.start.line - 1)).fill("\n");
33799
- var offset = Array.from(new Array(this.startOffset - lineBreaks.length)).fill("\u222F");
33800
- this.textCharacters = offset.concat(lineBreaks, input.raw.split(""));
33801
- this.source = new structured_source_1.default(this.textCharacters.join(""));
33802
- if (this.sourceNode.children[0]) {
33803
- this.firstChildPadding = this.sourceNode.children[0].range[0] - this.startOffset;
33804
- } else {
33805
- this.firstChildPadding = 0;
33806
- }
33807
- }
33808
- }
33809
- SourceCode2.prototype.markContextRange = function(range) {
33810
- this.contextRanges.push(range);
33811
- };
33812
- SourceCode2.prototype.isInContextRange = function() {
33813
- var offset = this.offset;
33814
- return this.contextRanges.some(function(range) {
33815
- return range[0] <= offset && offset < range[1];
33816
- });
33817
- };
33818
- SourceCode2.prototype.enterContext = function(context) {
33819
- this.contexts.push(context);
33820
- };
33821
- SourceCode2.prototype.isInContext = function(context) {
33822
- if (!context) {
33823
- return this.contexts.length > 0;
33824
- }
33825
- return this.contexts.some(function(targetContext) {
33826
- return targetContext === context;
33827
- });
33828
- };
33829
- SourceCode2.prototype.leaveContext = function(context) {
33830
- var index2 = this.contexts.lastIndexOf(context);
33831
- if (index2 !== -1) {
33832
- this.contexts.splice(index2, 1);
33833
- }
33834
- };
33835
- Object.defineProperty(SourceCode2.prototype, "offset", {
33836
- get: function() {
33837
- return this.index + this.firstChildPadding;
33838
- },
33839
- enumerable: false,
33840
- configurable: true
33841
- });
33842
- SourceCode2.prototype.now = function() {
33843
- var indexWithChildrenOffset = this.offset;
33844
- var position = this.source.indexToPosition(indexWithChildrenOffset);
33845
- return {
33846
- line: position.line,
33847
- column: position.column,
33848
- offset: indexWithChildrenOffset
33849
- };
33850
- };
33851
- Object.defineProperty(SourceCode2.prototype, "hasEnd", {
33852
- get: function() {
33853
- return this.read() === false;
33854
- },
33855
- enumerable: false,
33856
- configurable: true
33857
- });
33858
- SourceCode2.prototype.read = function(over) {
33859
- if (over === void 0) {
33860
- over = 0;
33861
- }
33862
- var index2 = this.offset + over;
33863
- if (index2 < this.startOffset) {
33864
- return false;
33865
- }
33866
- if (0 <= index2 && index2 < this.textCharacters.length) {
33867
- return this.textCharacters[index2];
33868
- }
33869
- return false;
33870
- };
33871
- SourceCode2.prototype.readNode = function(over) {
33872
- if (over === void 0) {
33873
- over = 0;
33874
- }
33875
- if (!this.sourceNode) {
33876
- return false;
33877
- }
33878
- var index2 = this.offset + over;
33879
- if (index2 < this.startOffset) {
33880
- return false;
33881
- }
33882
- var matchNodeList = this.sourceNode.children.filter(function(node) {
33883
- return node.range[0] <= index2 && index2 < node.range[1];
33884
- });
33885
- if (matchNodeList.length > 0) {
33886
- return matchNodeList[matchNodeList.length - 1];
33887
- }
33888
- return false;
33889
- };
33890
- SourceCode2.prototype.peek = function() {
33891
- this.index += 1;
33892
- };
33893
- SourceCode2.prototype.peekNode = function(node) {
33894
- this.index += node.range[1] - node.range[0];
33895
- };
33896
- SourceCode2.prototype.seekNext = function(parser) {
33897
- var startPosition = this.now();
33898
- parser.seek(this);
33899
- var endPosition = this.now();
33900
- var value = this.sliceRange(startPosition.offset, endPosition.offset);
33901
- return {
33902
- value,
33903
- startPosition,
33904
- endPosition
33905
- };
33906
- };
33907
- SourceCode2.prototype.sliceRange = function(start, end) {
33908
- return this.textCharacters.slice(start, end).join("");
33909
- };
33910
- return SourceCode2;
33911
- }();
33912
- exports.SourceCode = SourceCode;
33913
- }
33914
- });
33915
-
33916
- // node_modules/sentence-splitter/lib/parser/NewLineParser.js
33917
- var require_NewLineParser = __commonJS({
33918
- "node_modules/sentence-splitter/lib/parser/NewLineParser.js"(exports) {
33919
- init_polyfills();
33920
- "use strict";
33921
- Object.defineProperty(exports, "__esModule", { value: true });
33922
- exports.NewLineParser = void 0;
33923
- var NewLineParser = function() {
33924
- function NewLineParser2() {
33925
- }
33926
- NewLineParser2.prototype.test = function(sourceCode) {
33927
- var string = sourceCode.read();
33928
- if (!string) {
33929
- return false;
33930
- }
33931
- return /[\r\n]/.test(string);
33932
- };
33933
- NewLineParser2.prototype.seek = function(sourceCode) {
33934
- while (this.test(sourceCode)) {
33935
- sourceCode.peek();
33936
- }
33937
- };
33938
- return NewLineParser2;
33939
- }();
33940
- exports.NewLineParser = NewLineParser;
33941
- }
33942
- });
33943
-
33944
- // node_modules/sentence-splitter/lib/parser/SpaceParser.js
33945
- var require_SpaceParser = __commonJS({
33946
- "node_modules/sentence-splitter/lib/parser/SpaceParser.js"(exports) {
33947
- init_polyfills();
33948
- "use strict";
33949
- Object.defineProperty(exports, "__esModule", { value: true });
33950
- exports.SpaceParser = void 0;
33951
- var SpaceParser = function() {
33952
- function SpaceParser2() {
33953
- }
33954
- SpaceParser2.prototype.test = function(sourceCode) {
33955
- var string = sourceCode.read();
33956
- if (!string) {
33957
- return false;
33958
- }
33959
- return /\s/.test(string);
33960
- };
33961
- SpaceParser2.prototype.seek = function(sourceCode) {
33962
- while (this.test(sourceCode)) {
33963
- sourceCode.peek();
33964
- }
33965
- };
33966
- return SpaceParser2;
33967
- }();
33968
- exports.SpaceParser = SpaceParser;
33969
- }
33970
- });
33971
-
33972
- // node_modules/sentence-splitter/lib/parser/SeparatorParser.js
33973
- var require_SeparatorParser = __commonJS({
33974
- "node_modules/sentence-splitter/lib/parser/SeparatorParser.js"(exports) {
33975
- init_polyfills();
33976
- "use strict";
33977
- Object.defineProperty(exports, "__esModule", { value: true });
33978
- exports.SeparatorParser = exports.DefaultOptions = void 0;
33979
- exports.DefaultOptions = {
33980
- separatorCharacters: [
33981
- ".",
33982
- "\uFF0E",
33983
- "\u3002",
33984
- "?",
33985
- "!",
33986
- "\uFF1F",
33987
- "\uFF01"
33988
- ]
33989
- };
33990
- var SeparatorParser = function() {
33991
- function SeparatorParser2(options) {
33992
- this.options = options;
33993
- this.separatorCharacters = options && options.separatorCharacters ? options.separatorCharacters : exports.DefaultOptions.separatorCharacters;
33994
- }
33995
- SeparatorParser2.prototype.test = function(sourceCode) {
33996
- if (sourceCode.isInContext()) {
33997
- return false;
33998
- }
33999
- if (sourceCode.isInContextRange()) {
34000
- return false;
34001
- }
34002
- var firstChar = sourceCode.read();
34003
- var nextChar = sourceCode.read(1);
34004
- if (!firstChar) {
34005
- return false;
34006
- }
34007
- if (!this.separatorCharacters.includes(firstChar)) {
34008
- return false;
34009
- }
34010
- if (firstChar === ".") {
34011
- if (nextChar) {
34012
- return /[\s\t\r\n]/.test(nextChar);
34013
- } else {
34014
- return true;
34015
- }
34016
- }
34017
- return true;
34018
- };
34019
- SeparatorParser2.prototype.seek = function(sourceCode) {
34020
- while (this.test(sourceCode)) {
34021
- sourceCode.peek();
34022
- }
34023
- };
34024
- return SeparatorParser2;
34025
- }();
34026
- exports.SeparatorParser = SeparatorParser;
34027
- }
34028
- });
34029
-
34030
- // node_modules/sentence-splitter/lib/parser/AnyValueParser.js
34031
- var require_AnyValueParser = __commonJS({
34032
- "node_modules/sentence-splitter/lib/parser/AnyValueParser.js"(exports) {
34033
- init_polyfills();
34034
- "use strict";
34035
- Object.defineProperty(exports, "__esModule", { value: true });
34036
- exports.AnyValueParser = void 0;
34037
- var AnyValueParser = function() {
34038
- function AnyValueParser2(options) {
34039
- this.parsers = options.parsers;
34040
- this.markers = options.markers;
34041
- }
34042
- AnyValueParser2.prototype.test = function(sourceCode) {
34043
- if (sourceCode.hasEnd) {
34044
- return false;
34045
- }
34046
- return this.parsers.every(function(parser) {
34047
- return !parser.test(sourceCode);
34048
- });
34049
- };
34050
- AnyValueParser2.prototype.seek = function(sourceCode) {
34051
- var currentNode = sourceCode.readNode();
34052
- if (!currentNode) {
34053
- while (this.test(sourceCode)) {
34054
- this.markers.forEach(function(marker) {
34055
- return marker.mark(sourceCode);
34056
- });
34057
- sourceCode.peek();
34058
- }
34059
- return;
34060
- }
34061
- var isInCurrentNode = function() {
34062
- var currentOffset = sourceCode.offset;
34063
- return currentNode.range[0] <= currentOffset && currentOffset < currentNode.range[1];
34064
- };
34065
- while (isInCurrentNode() && this.test(sourceCode)) {
34066
- this.markers.forEach(function(marker) {
34067
- return marker.mark(sourceCode);
34068
- });
34069
- sourceCode.peek();
34070
- }
34071
- };
34072
- return AnyValueParser2;
34073
- }();
34074
- exports.AnyValueParser = AnyValueParser;
34075
- }
34076
- });
34077
-
34078
- // node_modules/sentence-splitter/lib/parser/lang/English.js
34079
- var require_English = __commonJS({
34080
- "node_modules/sentence-splitter/lib/parser/lang/English.js"(exports) {
34081
- init_polyfills();
34082
- "use strict";
34083
- Object.defineProperty(exports, "__esModule", { value: true });
34084
- exports.English = void 0;
34085
- exports.English = {
34086
- ABBREVIATIONS: [
34087
- "Adj.",
34088
- "Adm.",
34089
- "Adv.",
34090
- "Al.",
34091
- "Ala.",
34092
- "Alta.",
34093
- "Apr.",
34094
- "Arc.",
34095
- "Ariz.",
34096
- "Ark.",
34097
- "Art.",
34098
- "Assn.",
34099
- "Asst.",
34100
- "Attys.",
34101
- "Aug.",
34102
- "Ave.",
34103
- "Bart.",
34104
- "Bld.",
34105
- "Bldg.",
34106
- "Blvd.",
34107
- "Brig.",
34108
- "Bros.",
34109
- "Btw.",
34110
- "Cal.",
34111
- "Calif.",
34112
- "Capt.",
34113
- "Cl.",
34114
- "Cmdr.",
34115
- "Co.",
34116
- "Col.",
34117
- "Colo.",
34118
- "Comdr.",
34119
- "Con.",
34120
- "Conn.",
34121
- "Corp.",
34122
- "Cpl.",
34123
- "Cres.",
34124
- "Ct.",
34125
- "D.phil.",
34126
- "Dak.",
34127
- "Dec.",
34128
- "Del.",
34129
- "Dept.",
34130
- "Det.",
34131
- "Dist.",
34132
- "Dr.",
34133
- "Dr.phil.",
34134
- "Dr.philos.",
34135
- "Drs.",
34136
- "E.g.",
34137
- "Ens.",
34138
- "Esp.",
34139
- "Esq.",
34140
- "Etc.",
34141
- "Exp.",
34142
- "Expy.",
34143
- "Ext.",
34144
- "Feb.",
34145
- "Fed.",
34146
- "Fla.",
34147
- "Ft.",
34148
- "Fwy.",
34149
- "Fy.",
34150
- "Ga.",
34151
- "Gen.",
34152
- "Gov.",
34153
- "Hon.",
34154
- "Hosp.",
34155
- "Hr.",
34156
- "Hway.",
34157
- "Hwy.",
34158
- "I.e.",
34159
- "Ia.",
34160
- "Id.",
34161
- "Ida.",
34162
- "Ill.",
34163
- "Inc.",
34164
- "Ind.",
34165
- "Ing.",
34166
- "Insp.",
34167
- "Is.",
34168
- "Jan.",
34169
- "Jr.",
34170
- "Jul.",
34171
- "Jun.",
34172
- "Kan.",
34173
- "Kans.",
34174
- "Ken.",
34175
- "Ky.",
34176
- "La.",
34177
- "Lt.",
34178
- "Ltd.",
34179
- "Maj.",
34180
- "Man.",
34181
- "Mar.",
34182
- "Mass.",
34183
- "May.",
34184
- "Md.",
34185
- "Me.",
34186
- "Med.",
34187
- "Messrs.",
34188
- "Mex.",
34189
- "Mfg.",
34190
- "Mich.",
34191
- "Min.",
34192
- "Minn.",
34193
- "Miss.",
34194
- "Mlle.",
34195
- "Mm.",
34196
- "Mme.",
34197
- "Mo.",
34198
- "Mont.",
34199
- "Mr.",
34200
- "Mrs.",
34201
- "Ms.",
34202
- "Msgr.",
34203
- "Mssrs.",
34204
- "Mt.",
34205
- "Mtn.",
34206
- "Neb.",
34207
- "Nebr.",
34208
- "Nev.",
34209
- "No.",
34210
- "Nos.",
34211
- "Nov.",
34212
- "Nr.",
34213
- "Oct.",
34214
- "Ok.",
34215
- "Okla.",
34216
- "Ont.",
34217
- "Op.",
34218
- "Ord.",
34219
- "Ore.",
34220
- "P.",
34221
- "Pa.",
34222
- "Pd.",
34223
- "Pde.",
34224
- "Penn.",
34225
- "Penna.",
34226
- "Pfc.",
34227
- "Ph.",
34228
- "Ph.d.",
34229
- "Pl.",
34230
- "Plz.",
34231
- "Pp.",
34232
- "Prof.",
34233
- "Pvt.",
34234
- "Que.",
34235
- "Rd.",
34236
- "Rs.",
34237
- "Ref.",
34238
- "Rep.",
34239
- "Reps.",
34240
- "Res.",
34241
- "Rev.",
34242
- "Rt.",
34243
- "Sask.",
34244
- "Sec.",
34245
- "Sen.",
34246
- "Sens.",
34247
- "Sep.",
34248
- "Sept.",
34249
- "Sfc.",
34250
- "Sgt.",
34251
- "Sr.",
34252
- "St.",
34253
- "Supt.",
34254
- "Surg.",
34255
- "Tce.",
34256
- "Tenn.",
34257
- "Tex.",
34258
- "Univ.",
34259
- "Usafa.",
34260
- "U.S.",
34261
- "Ut.",
34262
- "Va.",
34263
- "V.",
34264
- "Ver.",
34265
- "Vs.",
34266
- "Vt.",
34267
- "Wash.",
34268
- "Wis.",
34269
- "Wisc.",
34270
- "Wy.",
34271
- "Wyo.",
34272
- "Yuk."
34273
- ],
34274
- PREPOSITIVE_ABBREVIATIONS: [
34275
- "Adm.",
34276
- "Attys.",
34277
- "Brig.",
34278
- "Capt.",
34279
- "Cmdr.",
34280
- "Col.",
34281
- "Cpl.",
34282
- "Det.",
34283
- "Dr.",
34284
- "Gen.",
34285
- "Gov.",
34286
- "Ing.",
34287
- "Lt.",
34288
- "Maj.",
34289
- "Mr.",
34290
- "Mrs.",
34291
- "Ms.",
34292
- "Mt.",
34293
- "Messrs.",
34294
- "Mssrs.",
34295
- "Prof.",
34296
- "Ph.",
34297
- "Rep.",
34298
- "Reps.",
34299
- "Rev.",
34300
- "Sen.",
34301
- "Sens.",
34302
- "Sgt.",
34303
- "St.",
34304
- "Supt.",
34305
- "V.",
34306
- "Vs."
34307
- ],
34308
- EXCALAMATION_WORDS: [
34309
- "!X\u0169",
34310
- "!Kung",
34311
- "\u01C3\u02BCO\u01C3Kung",
34312
- "!Xuun",
34313
- "!Kung-Ekoka",
34314
- "\u01C3Hu",
34315
- "\u01C3Khung",
34316
- "\u01C3Ku",
34317
- "\u01C3ung",
34318
- "\u01C3Xo",
34319
- "\u01C3X\xFB",
34320
- "\u01C3Xung",
34321
- "\u01C3X\u0169",
34322
- "!Xun",
34323
- "Yahoo!",
34324
- "Y!J",
34325
- "Yum!"
34326
- ]
34327
- };
34328
- }
34329
- });
34330
-
34331
- // node_modules/sentence-splitter/lib/parser/AbbrMarker.js
34332
- var require_AbbrMarker = __commonJS({
34333
- "node_modules/sentence-splitter/lib/parser/AbbrMarker.js"(exports) {
34334
- init_polyfills();
34335
- "use strict";
34336
- Object.defineProperty(exports, "__esModule", { value: true });
34337
- exports.AbbrMarker = void 0;
34338
- var English_1 = require_English();
34339
- var isCapitalized = function(text) {
34340
- if (!text || text.length === 0) {
34341
- return false;
34342
- }
34343
- return /^[A-Z]/.test(text);
34344
- };
34345
- var compareNoCaseSensitive = function(a, b) {
34346
- return a.toLowerCase() === b.toLowerCase();
34347
- };
34348
- var AbbrMarker = function() {
34349
- function AbbrMarker2(lang) {
34350
- if (lang === void 0) {
34351
- lang = English_1.English;
34352
- }
34353
- this.lang = lang;
34354
- }
34355
- AbbrMarker2.prototype.getWord = function(sourceCode, startIndex) {
34356
- if (startIndex === void 0) {
34357
- startIndex = 0;
34358
- }
34359
- var whiteSpace = /\s/;
34360
- var prevChar = sourceCode.read(-1);
34361
- if (prevChar && !whiteSpace.test(prevChar)) {
34362
- return "";
34363
- }
34364
- var word = "";
34365
- var count = startIndex;
34366
- var char = "";
34367
- while (char = sourceCode.read(count)) {
34368
- if (whiteSpace.test(char)) {
34369
- break;
34370
- }
34371
- word += char;
34372
- count++;
34373
- }
34374
- return word;
34375
- };
34376
- AbbrMarker2.prototype.getPrevWord = function(sourceCode) {
34377
- var whiteSpace = /\s/;
34378
- var count = -1;
34379
- var char = "";
34380
- while (char = sourceCode.read(count)) {
34381
- if (!whiteSpace.test(char)) {
34382
- break;
34383
- }
34384
- count--;
34385
- }
34386
- while (char = sourceCode.read(count)) {
34387
- if (whiteSpace.test(char)) {
34388
- break;
34389
- }
34390
- count--;
34391
- }
34392
- return this.getWord(sourceCode, count + 1);
34393
- };
34394
- AbbrMarker2.prototype.mark = function(sourceCode) {
34395
- if (sourceCode.isInContextRange()) {
34396
- return;
34397
- }
34398
- var currentWord = this.getWord(sourceCode);
34399
- if (currentWord.length === 0) {
34400
- return;
34401
- }
34402
- if (/^([a-zA-Z]\.){3,}$/.test(currentWord)) {
34403
- return sourceCode.markContextRange([sourceCode.offset, sourceCode.offset + currentWord.length]);
34404
- }
34405
- var isMatchedEXCALAMATION_WORDS = this.lang.EXCALAMATION_WORDS.some(function(abbr) {
34406
- return compareNoCaseSensitive(abbr, currentWord);
34407
- });
34408
- if (isMatchedEXCALAMATION_WORDS) {
34409
- return sourceCode.markContextRange([sourceCode.offset, sourceCode.offset + currentWord.length]);
34410
- }
34411
- var isMatchedPREPOSITIVE_ABBREVIATIONS = this.lang.PREPOSITIVE_ABBREVIATIONS.some(function(abbr) {
34412
- return compareNoCaseSensitive(abbr, currentWord);
34413
- });
34414
- if (isMatchedPREPOSITIVE_ABBREVIATIONS) {
34415
- return sourceCode.markContextRange([sourceCode.offset, sourceCode.offset + currentWord.length]);
34416
- }
34417
- var isMatched = this.lang.ABBREVIATIONS.some(function(abbr) {
34418
- return compareNoCaseSensitive(abbr, currentWord);
34419
- });
34420
- var prevWord = this.getPrevWord(sourceCode);
34421
- var nextWord = this.getWord(sourceCode, currentWord.length + 1);
34422
- if (isCapitalized(prevWord) && /[A-Z]\./.test(currentWord) && isCapitalized(nextWord)) {
34423
- sourceCode.markContextRange([sourceCode.offset, sourceCode.offset + currentWord.length]);
34424
- } else if (isMatched && !isCapitalized(nextWord)) {
34425
- sourceCode.markContextRange([sourceCode.offset, sourceCode.offset + currentWord.length]);
34426
- }
34427
- };
34428
- return AbbrMarker2;
34429
- }();
34430
- exports.AbbrMarker = AbbrMarker;
34431
- }
34432
- });
34433
-
34434
- // node_modules/sentence-splitter/lib/logger.js
34435
- var require_logger = __commonJS({
34436
- "node_modules/sentence-splitter/lib/logger.js"(exports) {
34437
- init_polyfills();
34438
- "use strict";
34439
- var __spreadArray = exports && exports.__spreadArray || function(to, from) {
34440
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
34441
- to[j] = from[i];
34442
- return to;
34443
- };
34444
- Object.defineProperty(exports, "__esModule", { value: true });
34445
- exports.debugLog = void 0;
34446
- function debugLog() {
34447
- var args = [];
34448
- for (var _i = 0; _i < arguments.length; _i++) {
34449
- args[_i] = arguments[_i];
34450
- }
34451
- if (process.env.DEBUG !== "sentence-splitter") {
34452
- return;
34453
- }
34454
- console.log.apply(console, __spreadArray(["sentence-splitter: "], args));
34455
- }
34456
- exports.debugLog = debugLog;
34457
- }
34458
- });
34459
-
34460
- // node_modules/object_values/index.js
34461
- var require_object_values = __commonJS({
34462
- "node_modules/object_values/index.js"(exports, module) {
34463
- init_polyfills();
34464
- Object.values = Object.values ? Object.values : function(obj) {
34465
- var allowedTypes = ["[object String]", "[object Object]", "[object Array]", "[object Function]"];
34466
- var objType = Object.prototype.toString.call(obj);
34467
- if (obj === null || typeof obj === "undefined") {
34468
- throw new TypeError("Cannot convert undefined or null to object");
34469
- } else if (!~allowedTypes.indexOf(objType)) {
34470
- return [];
34471
- } else {
34472
- if (Object.keys) {
34473
- return Object.keys(obj).map(function(key) {
34474
- return obj[key];
34475
- });
34476
- }
34477
- var result = [];
34478
- for (var prop in obj) {
34479
- if (obj.hasOwnProperty(prop)) {
34480
- result.push(obj[prop]);
34481
- }
34482
- }
34483
- return result;
34484
- }
34485
- };
34486
- if (typeof module !== "undefined" && module.exports) {
34487
- module.exports = Object.values;
34488
- }
34489
- }
34490
- });
34491
-
34492
- // node_modules/sentence-splitter/lib/parser/PairMaker.js
34493
- var require_PairMaker = __commonJS({
34494
- "node_modules/sentence-splitter/lib/parser/PairMaker.js"(exports) {
34495
- init_polyfills();
34496
- "use strict";
34497
- var __importDefault = exports && exports.__importDefault || function(mod) {
34498
- return mod && mod.__esModule ? mod : { "default": mod };
34499
- };
34500
- Object.defineProperty(exports, "__esModule", { value: true });
34501
- exports.PairMaker = void 0;
34502
- var logger_1 = require_logger();
34503
- var object_values_1 = __importDefault(require_object_values());
34504
- var PairMaker = function() {
34505
- function PairMaker2() {
34506
- var _a;
34507
- this.pairs = (_a = {}, _a['"'] = '"', _a["\u300C"] = "\u300D", _a["\uFF08"] = "\uFF09", _a["("] = ")", _a["\u300E"] = "\u300F", _a["\u3010"] = "\u3011", _a["\u300A"] = "\u300B", _a);
34508
- this.pairKeys = Object.keys(this.pairs);
34509
- this.pairValues = object_values_1.default(this.pairs);
34510
- }
34511
- PairMaker2.prototype.mark = function(sourceCode) {
34512
- var string = sourceCode.read();
34513
- if (!string) {
34514
- return;
34515
- }
34516
- if (!sourceCode.isInContext()) {
34517
- var keyIndex = this.pairKeys.indexOf(string);
34518
- if (keyIndex !== -1) {
34519
- var key = this.pairKeys[keyIndex];
34520
- logger_1.debugLog("PairMaker -> enterContext: " + key);
34521
- sourceCode.enterContext(key);
34522
- }
34523
- } else {
34524
- var valueIndex = this.pairValues.indexOf(string);
34525
- if (valueIndex !== -1) {
34526
- var key = this.pairKeys[valueIndex];
34527
- logger_1.debugLog("PairMaker -> leaveContext: " + this.pairValues[valueIndex]);
34528
- sourceCode.leaveContext(key);
34529
- }
34530
- }
34531
- };
34532
- return PairMaker2;
34533
- }();
34534
- exports.PairMaker = PairMaker;
34535
- }
34536
- });
34537
-
34538
- // node_modules/sentence-splitter/lib/sentence-splitter.js
34539
- var require_sentence_splitter = __commonJS({
34540
- "node_modules/sentence-splitter/lib/sentence-splitter.js"(exports) {
34541
- init_polyfills();
34542
- "use strict";
34543
- var __assign = exports && exports.__assign || function() {
34544
- __assign = Object.assign || function(t) {
34545
- for (var s, i = 1, n = arguments.length; i < n; i++) {
34546
- s = arguments[i];
34547
- for (var p in s)
34548
- if (Object.prototype.hasOwnProperty.call(s, p))
34549
- t[p] = s[p];
34550
- }
34551
- return t;
34552
- };
34553
- return __assign.apply(this, arguments);
34554
- };
34555
- Object.defineProperty(exports, "__esModule", { value: true });
34556
- exports.createNode = exports.createEmptySentenceNode = exports.createTextNode = exports.createPunctuationNode = exports.createWhiteSpaceNode = exports.splitAST = exports.split = exports.SplitParser = exports.Syntax = void 0;
34557
- var ast_node_types_1 = require_lib8();
34558
- var SourceCode_1 = require_SourceCode();
34559
- var NewLineParser_1 = require_NewLineParser();
34560
- var SpaceParser_1 = require_SpaceParser();
34561
- var SeparatorParser_1 = require_SeparatorParser();
34562
- var AnyValueParser_1 = require_AnyValueParser();
34563
- var AbbrMarker_1 = require_AbbrMarker();
34564
- var PairMaker_1 = require_PairMaker();
34565
- var logger_1 = require_logger();
34566
- exports.Syntax = {
34567
- WhiteSpace: "WhiteSpace",
34568
- Punctuation: "Punctuation",
34569
- Sentence: "Sentence",
34570
- Str: "Str"
34571
- };
34572
- var SplitParser = function() {
34573
- function SplitParser2(text) {
34574
- this.nodeList = [];
34575
- this.results = [];
34576
- this.source = new SourceCode_1.SourceCode(text);
34577
- }
34578
- Object.defineProperty(SplitParser2.prototype, "current", {
34579
- get: function() {
34580
- return this.nodeList[this.nodeList.length - 1];
34581
- },
34582
- enumerable: false,
34583
- configurable: true
34584
- });
34585
- SplitParser2.prototype.pushNodeToCurrent = function(node) {
34586
- var current = this.current;
34587
- if (current) {
34588
- current.children.push(node);
34589
- } else {
34590
- this.results.push(node);
34591
- }
34592
- };
34593
- SplitParser2.prototype.open = function(parentNode) {
34594
- this.nodeList.push(parentNode);
34595
- };
34596
- SplitParser2.prototype.isOpened = function() {
34597
- return this.nodeList.length > 0;
34598
- };
34599
- SplitParser2.prototype.nextLine = function(parser) {
34600
- var _a = this.source.seekNext(parser), value = _a.value, startPosition = _a.startPosition, endPosition = _a.endPosition;
34601
- this.pushNodeToCurrent(createWhiteSpaceNode(value, startPosition, endPosition));
34602
- return endPosition;
34603
- };
34604
- SplitParser2.prototype.nextSpace = function(parser) {
34605
- var _a = this.source.seekNext(parser), value = _a.value, startPosition = _a.startPosition, endPosition = _a.endPosition;
34606
- this.pushNodeToCurrent(createNode("WhiteSpace", value, startPosition, endPosition));
34607
- };
34608
- SplitParser2.prototype.nextValue = function(parser) {
34609
- var _a = this.source.seekNext(parser), value = _a.value, startPosition = _a.startPosition, endPosition = _a.endPosition;
34610
- this.pushNodeToCurrent(createTextNode(value, startPosition, endPosition));
34611
- };
34612
- SplitParser2.prototype.close = function(parser) {
34613
- var _a = this.source.seekNext(parser), value = _a.value, startPosition = _a.startPosition, endPosition = _a.endPosition;
34614
- if (startPosition.offset !== endPosition.offset) {
34615
- this.pushNodeToCurrent(createPunctuationNode(value, startPosition, endPosition));
34616
- }
34617
- var currentNode = this.nodeList.pop();
34618
- if (!currentNode) {
34619
- return;
34620
- }
34621
- if (currentNode.children.length === 0) {
34622
- return;
34623
- }
34624
- var firstChildNode = currentNode.children[0];
34625
- var endNow = this.source.now();
34626
- currentNode.loc = {
34627
- start: firstChildNode.loc.start,
34628
- end: nowToLoc(endNow)
34629
- };
34630
- var rawValue = this.source.sliceRange(firstChildNode.range[0], endNow.offset);
34631
- currentNode.range = [firstChildNode.range[0], endNow.offset];
34632
- currentNode.raw = rawValue;
34633
- this.results.push(currentNode);
34634
- };
34635
- SplitParser2.prototype.toList = function() {
34636
- return this.results;
34637
- };
34638
- return SplitParser2;
34639
- }();
34640
- exports.SplitParser = SplitParser;
34641
- var createParsers = function(options) {
34642
- if (options === void 0) {
34643
- options = {};
34644
- }
34645
- var newLine = new NewLineParser_1.NewLineParser();
34646
- var space = new SpaceParser_1.SpaceParser();
34647
- var separator = new SeparatorParser_1.SeparatorParser(options.SeparatorParser);
34648
- var abbrMarker = new AbbrMarker_1.AbbrMarker();
34649
- var pairMaker = new PairMaker_1.PairMaker();
34650
- var anyValueParser = new AnyValueParser_1.AnyValueParser({
34651
- parsers: [newLine, separator],
34652
- markers: [abbrMarker, pairMaker]
34653
- });
34654
- return {
34655
- newLine,
34656
- space,
34657
- separator,
34658
- abbrMarker,
34659
- anyValueParser
34660
- };
34661
- };
34662
- function split2(text, options) {
34663
- var _a = createParsers(options), newLine = _a.newLine, space = _a.space, separator = _a.separator, anyValueParser = _a.anyValueParser;
34664
- var splitParser = new SplitParser(text);
34665
- var sourceCode = splitParser.source;
34666
- while (!sourceCode.hasEnd) {
34667
- if (newLine.test(sourceCode)) {
34668
- splitParser.nextLine(newLine);
34669
- } else if (space.test(sourceCode)) {
34670
- splitParser.nextSpace(space);
34671
- } else if (separator.test(sourceCode)) {
34672
- splitParser.close(separator);
34673
- } else {
34674
- if (!splitParser.isOpened()) {
34675
- splitParser.open(createEmptySentenceNode());
34676
- }
34677
- splitParser.nextValue(anyValueParser);
34678
- }
34679
- }
34680
- splitParser.close(space);
34681
- return splitParser.toList();
34682
- }
34683
- exports.split = split2;
34684
- function splitAST(paragraphNode, options) {
34685
- var _a = createParsers(options), newLine = _a.newLine, space = _a.space, separator = _a.separator, anyValueParser = _a.anyValueParser;
34686
- var splitParser = new SplitParser(paragraphNode);
34687
- var sourceCode = splitParser.source;
34688
- while (!sourceCode.hasEnd) {
34689
- var currentNode = sourceCode.readNode();
34690
- if (!currentNode) {
34691
- break;
34692
- }
34693
- if (currentNode.type === ast_node_types_1.ASTNodeTypes.Str) {
34694
- if (space.test(sourceCode)) {
34695
- logger_1.debugLog("space");
34696
- splitParser.nextSpace(space);
34697
- } else if (separator.test(sourceCode)) {
34698
- logger_1.debugLog("separator");
34699
- splitParser.close(separator);
34700
- } else if (newLine.test(sourceCode)) {
34701
- logger_1.debugLog("newline");
34702
- splitParser.nextLine(newLine);
34703
- } else {
34704
- if (!splitParser.isOpened()) {
34705
- logger_1.debugLog("open -> createEmptySentenceNode()");
34706
- splitParser.open(createEmptySentenceNode());
34707
- }
34708
- splitParser.nextValue(anyValueParser);
34709
- }
34710
- } else if (currentNode.type === ast_node_types_1.ASTNodeTypes.Break) {
34711
- splitParser.pushNodeToCurrent(currentNode);
34712
- sourceCode.peekNode(currentNode);
34713
- } else {
34714
- if (!splitParser.isOpened()) {
34715
- splitParser.open(createEmptySentenceNode());
34716
- }
34717
- splitParser.pushNodeToCurrent(currentNode);
34718
- sourceCode.peekNode(currentNode);
34719
- }
34720
- }
34721
- splitParser.close(space);
34722
- return __assign(__assign({}, paragraphNode), { children: splitParser.toList() });
34723
- }
34724
- exports.splitAST = splitAST;
34725
- function createWhiteSpaceNode(text, startPosition, endPosition) {
34726
- return createNode("WhiteSpace", text, startPosition, endPosition);
34727
- }
34728
- exports.createWhiteSpaceNode = createWhiteSpaceNode;
34729
- function createPunctuationNode(text, startPosition, endPosition) {
34730
- return createNode("Punctuation", text, startPosition, endPosition);
34731
- }
34732
- exports.createPunctuationNode = createPunctuationNode;
34733
- function createTextNode(text, startPosition, endPosition) {
34734
- return createNode("Str", text, startPosition, endPosition);
34735
- }
34736
- exports.createTextNode = createTextNode;
34737
- function createEmptySentenceNode() {
34738
- return {
34739
- type: "Sentence",
34740
- raw: "",
34741
- loc: {
34742
- start: { column: NaN, line: NaN },
34743
- end: { column: NaN, line: NaN }
34744
- },
34745
- range: [NaN, NaN],
34746
- children: []
34747
- };
34748
- }
34749
- exports.createEmptySentenceNode = createEmptySentenceNode;
34750
- function createNode(type, text, startPosition, endPosition) {
34751
- return {
34752
- type,
34753
- raw: text,
34754
- value: text,
34755
- loc: {
34756
- start: nowToLoc(startPosition),
34757
- end: nowToLoc(endPosition)
34758
- },
34759
- range: [startPosition.offset, endPosition.offset]
34760
- };
34761
- }
34762
- exports.createNode = createNode;
34763
- function nowToLoc(now) {
34764
- return {
34765
- line: now.line,
34766
- column: now.column
34767
- };
34768
- }
34769
- }
34770
- });
34771
-
34772
33577
  // src/index.ts
34773
33578
  init_polyfills();
34774
33579
 
@@ -46882,7 +45687,6 @@ var PageBreakModule = class {
46882
45687
  init_polyfills();
46883
45688
  var import_sanitize_html2 = __toModule(require_sanitize_html());
46884
45689
  var import_debounce6 = __toModule(require_debounce());
46885
- var import_sentence_splitter = __toModule(require_sentence_splitter());
46886
45690
  var TTSModule2 = class {
46887
45691
  constructor(delegate, tts, rights, highlighter, properties, api, headerMenu) {
46888
45692
  this.voices = [];
@@ -46974,7 +45778,7 @@ var TTSModule2 = class {
46974
45778
  let iframe = document.querySelector("main#iframe-wrapper iframe");
46975
45779
  let rootEl = iframe.contentWindow?.document.body;
46976
45780
  if (this.ttsQueue && rootEl) {
46977
- const idx = this.findTtsQueueItemIndex(this.ttsQueue, selection.anchorNode, selection.focusNode, selection.focusOffset, rootEl);
45781
+ const idx = this.findTtsQueueItemIndex(this.ttsQueue, selection.anchorNode, selection.anchorNode, selection.anchorOffset, rootEl);
46978
45782
  selection.removeAllRanges();
46979
45783
  if (idx >= 0) {
46980
45784
  window.speechSynthesis.cancel();
@@ -47056,18 +45860,44 @@ var TTSModule2 = class {
47056
45860
  if (doc) {
47057
45861
  const selection = this.highlighter.dom(doc.body).getSelection();
47058
45862
  if (rootEl) {
47059
- const ttsQueue = this.generateTtsQueue(rootEl, true);
45863
+ var ttsQueue = this.generateTtsQueue(rootEl);
47060
45864
  if (!ttsQueue.length) {
47061
45865
  return;
47062
45866
  }
47063
- const idx = this.findTtsQueueItemIndex(ttsQueue, selection.anchorNode, selection.focusNode, selection.focusOffset, rootEl);
45867
+ var idx = this.findTtsQueueItemIndex(ttsQueue, selection.anchorNode, selection.anchorNode, selection.anchorOffset, rootEl);
47064
45868
  const ttsQueueItem = getTtsQueueItemRef(ttsQueue, idx);
45869
+ var idxEnd = this.findTtsQueueItemIndex(ttsQueue, selection.focusNode, selection.focusNode, selection.focusOffset, rootEl);
45870
+ const ttsQueueItemEnd = getTtsQueueItemRef(ttsQueue, idxEnd);
45871
+ var restOfTheText;
47065
45872
  if (ttsQueueItem && selectionInfo && selectionInfo.cleanText) {
47066
45873
  const sentence = getTtsQueueItemRefText(ttsQueueItem);
47067
- const startIndex = sentence.indexOf(selectionInfo.cleanText);
47068
- utterance = new SpeechSynthesisUtterance(selectionInfo.cleanText);
45874
+ let startIndex = sentence.indexOf(selectionInfo.cleanText);
45875
+ let textToBeSpoken = selectionInfo.cleanText;
45876
+ if (ttsQueueItemEnd && idx + 1 === idxEnd) {
45877
+ const sentenceEnd = getTtsQueueItemRefText(ttsQueueItemEnd);
45878
+ startIndex = (sentence + " " + sentenceEnd).indexOf(selectionInfo.cleanText);
45879
+ textToBeSpoken = sentence.slice(startIndex, sentence.length);
45880
+ restOfTheText = selectionInfo.cleanText.replace(textToBeSpoken, "");
45881
+ } else if (idxEnd > idx) {
45882
+ let mergedSentenses = "";
45883
+ for (let i = idx + 1; i < idxEnd; i++) {
45884
+ const ttsQueueItemInBetween = getTtsQueueItemRef(ttsQueue, i);
45885
+ if (ttsQueueItemInBetween) {
45886
+ const sentenceInBetween = getTtsQueueItemRefText(ttsQueueItemInBetween);
45887
+ mergedSentenses += sentenceInBetween;
45888
+ restOfTheText = selectionInfo.cleanText.replace(sentenceInBetween, "");
45889
+ }
45890
+ }
45891
+ if (ttsQueueItemEnd) {
45892
+ const sentenceEnd = getTtsQueueItemRefText(ttsQueueItemEnd);
45893
+ mergedSentenses += " " + sentenceEnd;
45894
+ }
45895
+ startIndex = (sentence + " " + mergedSentenses).indexOf(selectionInfo.cleanText);
45896
+ textToBeSpoken = sentence.slice(startIndex, sentence.length);
45897
+ restOfTheText = restOfTheText.replace(textToBeSpoken, "").trim();
45898
+ }
45899
+ utterance = new SpeechSynthesisUtterance(textToBeSpoken);
47069
45900
  utterance.onboundary = (ev) => {
47070
- console.log(ev);
47071
45901
  this.updateTTSInfo(ttsQueueItem, ev.charIndex + startIndex, ev.charLength, utterance.text);
47072
45902
  };
47073
45903
  }
@@ -47177,13 +46007,53 @@ var TTSModule2 = class {
47177
46007
  window.speechSynthesis.speak(utterance);
47178
46008
  }, 0);
47179
46009
  this.index = 0;
47180
- utterance.onend = function() {
47181
- if (IS_DEV)
47182
- console.log("utterance ended");
47183
- self2.highlighter.doneSpeaking();
47184
- self2.api?.finished();
47185
- self2.delegate.emit("readaloud.finished", "finished");
47186
- };
46010
+ function onend() {
46011
+ utterance.onend = function() {
46012
+ if (idxEnd > idx) {
46013
+ idx = idx + 1;
46014
+ if (idx !== idxEnd) {
46015
+ const ttsQueueItem = getTtsQueueItemRef(ttsQueue, idx);
46016
+ if (ttsQueueItem) {
46017
+ const sentence = getTtsQueueItemRefText(ttsQueueItem);
46018
+ utterance = new SpeechSynthesisUtterance(sentence);
46019
+ utterance.onboundary = (ev) => {
46020
+ self2.updateTTSInfo(ttsQueueItem, ev.charIndex, ev.charLength, utterance.text);
46021
+ };
46022
+ setTimeout(() => {
46023
+ window.speechSynthesis.speak(utterance);
46024
+ }, 0);
46025
+ onend();
46026
+ }
46027
+ } else {
46028
+ const ttsQueueItem = getTtsQueueItemRef(ttsQueue, idx);
46029
+ if (ttsQueueItem) {
46030
+ utterance = new SpeechSynthesisUtterance(restOfTheText);
46031
+ utterance.onboundary = (ev) => {
46032
+ self2.updateTTSInfo(ttsQueueItem, ev.charIndex, ev.charLength, utterance.text);
46033
+ };
46034
+ setTimeout(() => {
46035
+ window.speechSynthesis.speak(utterance);
46036
+ }, 0);
46037
+ onend();
46038
+ }
46039
+ if (idx > idxEnd) {
46040
+ if (IS_DEV)
46041
+ console.log("utterance ended");
46042
+ self2.highlighter.doneSpeaking();
46043
+ self2.api?.finished();
46044
+ self2.delegate.emit("readaloud.finished", "finished");
46045
+ }
46046
+ }
46047
+ } else {
46048
+ if (IS_DEV)
46049
+ console.log("utterance ended");
46050
+ self2.highlighter.doneSpeaking();
46051
+ self2.api?.finished();
46052
+ self2.delegate.emit("readaloud.finished", "finished");
46053
+ }
46054
+ };
46055
+ }
46056
+ onend();
47187
46057
  callback();
47188
46058
  }
47189
46059
  speakPlay() {
@@ -47215,7 +46085,7 @@ var TTSModule2 = class {
47215
46085
  selection.extend(endNode, endOffset);
47216
46086
  selection.collapse(selection.anchorNode, selection.anchorOffset);
47217
46087
  if (rootEl) {
47218
- const idx = self2.findTtsQueueItemIndex(ttsQueue, selection.anchorNode, selection.focusNode, selection.focusOffset, rootEl);
46088
+ const idx = self2.findTtsQueueItemIndex(ttsQueue, selection.anchorNode, selection.anchorNode, selection.anchorOffset, rootEl);
47219
46089
  if (idx >= 0) {
47220
46090
  ttsQueueIndex = idx;
47221
46091
  }
@@ -47223,7 +46093,7 @@ var TTSModule2 = class {
47223
46093
  selection.removeAllRanges();
47224
46094
  }
47225
46095
  };
47226
- const ttsQueue = this.generateTtsQueue(rootEl, true);
46096
+ const ttsQueue = this.generateTtsQueue(rootEl);
47227
46097
  if (!ttsQueue.length) {
47228
46098
  return;
47229
46099
  }
@@ -47302,7 +46172,7 @@ var TTSModule2 = class {
47302
46172
  removeEventListenerOptional(this.delegate.iframes[0].contentDocument, "keydown", this.wheel.bind(this));
47303
46173
  removeEventListenerOptional(this.body, "click", this.click.bind(this));
47304
46174
  }
47305
- generateTtsQueue(rootElement, splitSentences) {
46175
+ generateTtsQueue(rootElement) {
47306
46176
  const ttsQueue = [];
47307
46177
  const elementStack = [];
47308
46178
  function processTextNode(textNode) {
@@ -47322,9 +46192,6 @@ var TTSModule2 = class {
47322
46192
  if (!current || current.parentElement !== parentElement || current.lang !== lang || current.dir !== dir) {
47323
46193
  current = {
47324
46194
  combinedText: "",
47325
- combinedTextSentences: void 0,
47326
- combinedTextSentencesRangeBegin: void 0,
47327
- combinedTextSentencesRangeEnd: void 0,
47328
46195
  dir,
47329
46196
  lang,
47330
46197
  parentElement,
@@ -47360,9 +46227,6 @@ var TTSModule2 = class {
47360
46227
  const dir = void 0;
47361
46228
  ttsQueue.push({
47362
46229
  combinedText: txt,
47363
- combinedTextSentences: void 0,
47364
- combinedTextSentencesRangeBegin: void 0,
47365
- combinedTextSentencesRangeEnd: void 0,
47366
46230
  dir,
47367
46231
  lang,
47368
46232
  parentElement: childElement,
@@ -47391,48 +46255,19 @@ var TTSModule2 = class {
47391
46255
  if (!ttsQueueItem.combinedText || !ttsQueueItem.combinedText.length) {
47392
46256
  ttsQueueItem.combinedText = "";
47393
46257
  }
47394
- ttsQueueItem.combinedTextSentences = void 0;
47395
46258
  return;
47396
46259
  }
47397
46260
  ttsQueueItem.combinedText = combineTextNodes(ttsQueueItem.textNodes, true).replace(/[\r\n]/g, " ");
47398
- let skipSplitSentences = false;
47399
46261
  let parent = ttsQueueItem.parentElement;
47400
46262
  while (parent) {
47401
46263
  if (parent.tagName) {
47402
46264
  const tag = parent.tagName.toLowerCase();
47403
46265
  if (tag === "pre" || tag === "code" || tag === "video" || tag === "audio") {
47404
- skipSplitSentences = true;
47405
46266
  break;
47406
46267
  }
47407
46268
  }
47408
46269
  parent = parent.parentElement;
47409
46270
  }
47410
- if (splitSentences && !skipSplitSentences) {
47411
- try {
47412
- const txt = ttsQueueItem.combinedText;
47413
- ttsQueueItem.combinedTextSentences = void 0;
47414
- const sentences = (0, import_sentence_splitter.split)(txt);
47415
- ttsQueueItem.combinedTextSentences = [];
47416
- ttsQueueItem.combinedTextSentencesRangeBegin = [];
47417
- ttsQueueItem.combinedTextSentencesRangeEnd = [];
47418
- for (const sentence of sentences) {
47419
- if (sentence.type === "Sentence") {
47420
- ttsQueueItem.combinedTextSentences.push(sentence.raw);
47421
- ttsQueueItem.combinedTextSentencesRangeBegin.push(sentence.range[0]);
47422
- ttsQueueItem.combinedTextSentencesRangeEnd.push(sentence.range[1]);
47423
- }
47424
- }
47425
- if (ttsQueueItem.combinedTextSentences.length === 0 || ttsQueueItem.combinedTextSentences.length === 1) {
47426
- ttsQueueItem.combinedTextSentences = void 0;
47427
- } else {
47428
- }
47429
- } catch (err) {
47430
- console.log(err);
47431
- ttsQueueItem.combinedTextSentences = void 0;
47432
- }
47433
- } else {
47434
- ttsQueueItem.combinedTextSentences = void 0;
47435
- }
47436
46271
  }
47437
46272
  for (const ttsQueueItem of ttsQueue) {
47438
46273
  finalizeTextNodes(ttsQueueItem);
@@ -47444,39 +46279,12 @@ var TTSModule2 = class {
47444
46279
  for (const ttsQueueItem of ttsQueue) {
47445
46280
  if (startTextNode && ttsQueueItem.textNodes) {
47446
46281
  if (ttsQueueItem.textNodes.includes(startTextNode)) {
47447
- if (ttsQueueItem.combinedTextSentences && ttsQueueItem.combinedTextSentencesRangeBegin && ttsQueueItem.combinedTextSentencesRangeEnd) {
47448
- let offset = 0;
47449
- for (const txtNode of ttsQueueItem.textNodes) {
47450
- if (!txtNode.nodeValue && txtNode.nodeValue !== "") {
47451
- continue;
47452
- }
47453
- if (txtNode === startTextNode) {
47454
- offset += startTextNodeOffset;
47455
- break;
47456
- }
47457
- offset += txtNode.nodeValue.length;
47458
- }
47459
- let j = i - 1;
47460
- for (const end of ttsQueueItem.combinedTextSentencesRangeEnd) {
47461
- j++;
47462
- if (end < offset) {
47463
- continue;
47464
- }
47465
- return j;
47466
- }
47467
- return i;
47468
- } else {
47469
- return i;
47470
- }
46282
+ return i;
47471
46283
  }
47472
46284
  } else if (element === ttsQueueItem.parentElement || ttsQueueItem.parentElement !== element.ownerDocument.body && ttsQueueItem.parentElement !== rootElem && ttsQueueItem.parentElement.contains(element) || element.contains(ttsQueueItem.parentElement)) {
47473
46285
  return i;
47474
46286
  }
47475
- if (ttsQueueItem.combinedTextSentences) {
47476
- i += ttsQueueItem.combinedTextSentences.length;
47477
- } else {
47478
- i++;
47479
- }
46287
+ i++;
47480
46288
  }
47481
46289
  return -1;
47482
46290
  }
@@ -47655,11 +46463,6 @@ var TTSModule2 = class {
47655
46463
  const ttsQueueItem = ttsQueueItemRef.item;
47656
46464
  let txtToCheck = ttsQueueItemRef.item.combinedText;
47657
46465
  let charIndexAdjusted = charIndex;
47658
- if (ttsQueueItem.combinedTextSentences && ttsQueueItem.combinedTextSentencesRangeBegin && ttsQueueItem.combinedTextSentencesRangeEnd && ttsQueueItemRef.iSentence >= 0) {
47659
- const sentOffset = ttsQueueItem.combinedTextSentencesRangeBegin[ttsQueueItemRef.iSentence];
47660
- charIndexAdjusted += sentOffset;
47661
- txtToCheck = ttsQueueItem.combinedTextSentences[ttsQueueItemRef.iSentence];
47662
- }
47663
46466
  if (IS_DEV) {
47664
46467
  if (utteranceText !== txtToCheck) {
47665
46468
  console.log("TTS utteranceText DIFF?? ", `[[${utteranceText}]]`, `[[${txtToCheck}]]`);
@@ -47798,32 +46601,15 @@ function getTtsQueueItemRef(items, index2) {
47798
46601
  let k = -1;
47799
46602
  for (const it of items) {
47800
46603
  k++;
47801
- if (it.combinedTextSentences) {
47802
- let j = -1;
47803
- for (const _sent of it.combinedTextSentences) {
47804
- j++;
47805
- i++;
47806
- if (index2 === i) {
47807
- return { item: it, iArray: k, iGlobal: i, iSentence: j };
47808
- }
47809
- }
47810
- } else {
47811
- i++;
47812
- if (index2 === i) {
47813
- return { item: it, iArray: k, iGlobal: i, iSentence: -1 };
47814
- }
46604
+ i++;
46605
+ if (index2 === i) {
46606
+ return { item: it, iArray: k, iGlobal: i, iSentence: -1 };
47815
46607
  }
47816
46608
  }
47817
46609
  return void 0;
47818
46610
  }
47819
46611
  function getTtsQueueItemRefText(obj) {
47820
- if (obj.iSentence === -1) {
47821
- return obj.item.combinedText;
47822
- }
47823
- if (obj.item.combinedTextSentences) {
47824
- return obj.item.combinedTextSentences[obj.iSentence];
47825
- }
47826
- return "";
46612
+ return obj.item.combinedText;
47827
46613
  }
47828
46614
 
47829
46615
  // src/modules/search/DefinitionsModule.ts