@digipair/skill-vespa 0.116.1 → 0.116.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/index.esm.js CHANGED
@@ -56696,6 +56696,7 @@ function _ts_generator(thisArg, body) {
56696
56696
  };
56697
56697
  }
56698
56698
  }
56699
+ //#region src/text_splitter.ts
56699
56700
  var TextSplitter = /*#__PURE__*/ function(BaseDocumentTransformer) {
56700
56701
  _inherits$l(TextSplitter, BaseDocumentTransformer);
56701
56702
  var _super = _create_super$l(TextSplitter);
@@ -56703,40 +56704,15 @@ var TextSplitter = /*#__PURE__*/ function(BaseDocumentTransformer) {
56703
56704
  _class_call_check$B(this, TextSplitter);
56704
56705
  var _this;
56705
56706
  _this = _super.call(this, fields);
56706
- Object.defineProperty(_assert_this_initialized$l(_this), "lc_namespace", {
56707
- enumerable: true,
56708
- configurable: true,
56709
- writable: true,
56710
- value: [
56711
- "langchain",
56712
- "document_transformers",
56713
- "text_splitters"
56714
- ]
56715
- });
56716
- Object.defineProperty(_assert_this_initialized$l(_this), "chunkSize", {
56717
- enumerable: true,
56718
- configurable: true,
56719
- writable: true,
56720
- value: 1000
56721
- });
56722
- Object.defineProperty(_assert_this_initialized$l(_this), "chunkOverlap", {
56723
- enumerable: true,
56724
- configurable: true,
56725
- writable: true,
56726
- value: 200
56727
- });
56728
- Object.defineProperty(_assert_this_initialized$l(_this), "keepSeparator", {
56729
- enumerable: true,
56730
- configurable: true,
56731
- writable: true,
56732
- value: false
56733
- });
56734
- Object.defineProperty(_assert_this_initialized$l(_this), "lengthFunction", {
56735
- enumerable: true,
56736
- configurable: true,
56737
- writable: true,
56738
- value: void 0
56739
- });
56707
+ _define_property$5(_assert_this_initialized$l(_this), "lc_namespace", [
56708
+ "langchain",
56709
+ "document_transformers",
56710
+ "text_splitters"
56711
+ ]);
56712
+ _define_property$5(_assert_this_initialized$l(_this), "chunkSize", 1e3);
56713
+ _define_property$5(_assert_this_initialized$l(_this), "chunkOverlap", 200);
56714
+ _define_property$5(_assert_this_initialized$l(_this), "keepSeparator", false);
56715
+ _define_property$5(_assert_this_initialized$l(_this), "lengthFunction", void 0);
56740
56716
  var _fields_chunkSize;
56741
56717
  _this.chunkSize = (_fields_chunkSize = fields === null || fields === void 0 ? void 0 : fields.chunkSize) !== null && _fields_chunkSize !== void 0 ? _fields_chunkSize : _this.chunkSize;
56742
56718
  var _fields_chunkOverlap;
@@ -56747,9 +56723,7 @@ var TextSplitter = /*#__PURE__*/ function(BaseDocumentTransformer) {
56747
56723
  _this.lengthFunction = (_fields_lengthFunction = fields === null || fields === void 0 ? void 0 : fields.lengthFunction) !== null && _fields_lengthFunction !== void 0 ? _fields_lengthFunction : function(text) {
56748
56724
  return text.length;
56749
56725
  };
56750
- if (_this.chunkOverlap >= _this.chunkSize) {
56751
- throw new Error("Cannot have chunkOverlap >= chunkSize");
56752
- }
56726
+ if (_this.chunkOverlap >= _this.chunkSize) throw new Error("Cannot have chunkOverlap >= chunkSize");
56753
56727
  return _this;
56754
56728
  }
56755
56729
  _create_class$w(TextSplitter, [
@@ -56772,16 +56746,11 @@ var TextSplitter = /*#__PURE__*/ function(BaseDocumentTransformer) {
56772
56746
  key: "splitOnSeparator",
56773
56747
  value: function splitOnSeparator(text, separator) {
56774
56748
  var splits;
56775
- if (separator) {
56776
- if (this.keepSeparator) {
56777
- var regexEscapedSeparator = separator.replace(/[/\-\\^$*+?.()|[\]{}]/g, "\\$&");
56778
- splits = text.split(new RegExp("(?=".concat(regexEscapedSeparator, ")")));
56779
- } else {
56780
- splits = text.split(separator);
56781
- }
56782
- } else {
56783
- splits = text.split("");
56784
- }
56749
+ if (separator) if (this.keepSeparator) {
56750
+ var regexEscapedSeparator = separator.replace(/[/\-\\^$*+?.()|[\]{}]/g, "\\$&");
56751
+ splits = text.split(/* @__PURE__ */ new RegExp("(?=".concat(regexEscapedSeparator, ")")));
56752
+ } else splits = text.split(separator);
56753
+ else splits = text.split("");
56785
56754
  return splits.filter(function(s) {
56786
56755
  return s !== "";
56787
56756
  });
@@ -56790,16 +56759,13 @@ var TextSplitter = /*#__PURE__*/ function(BaseDocumentTransformer) {
56790
56759
  {
56791
56760
  key: "createDocuments",
56792
56761
  value: function createDocuments(texts) {
56793
- var // eslint-disable-next-line @typescript-eslint/no-explicit-any
56794
- metadatas = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], chunkHeaderOptions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
56762
+ var metadatas = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], chunkHeaderOptions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
56795
56763
  var _this = this;
56796
56764
  return _async_to_generator(function() {
56797
56765
  var _metadatas, _chunkHeaderOptions_chunkHeader, chunkHeader, _chunkHeaderOptions_chunkOverlapHeader, chunkOverlapHeader, _chunkHeaderOptions_appendChunkOverlapHeader, appendChunkOverlapHeader, documents, i, text, lineCounterIndex, prevChunk, indexPrevChunk, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, pageContent, indexChunk, newLinesBeforeFirstChunk, indexEndPrevChunk, numberOfIntermediateNewLines, numberOfIntermediateNewLines1, newLinesCount, loc, metadataWithLinesNumber, err;
56798
56766
  return _ts_generator(this, function(_state) {
56799
56767
  switch(_state.label){
56800
56768
  case 0:
56801
- // if no metadata is provided, we create an empty one for each text
56802
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
56803
56769
  _metadatas = metadatas.length > 0 ? metadatas : _to_consumable_array$7(Array(texts.length)).map(function() {
56804
56770
  return {};
56805
56771
  });
@@ -56839,7 +56805,6 @@ var TextSplitter = /*#__PURE__*/ function(BaseDocumentTransformer) {
56839
56805
  ];
56840
56806
  chunk = _step.value;
56841
56807
  pageContent = chunkHeader;
56842
- // we need to count the \n that are in the text before getting removed by the splitting
56843
56808
  indexChunk = text.indexOf(chunk, indexPrevChunk + 1);
56844
56809
  if (!(prevChunk === null)) return [
56845
56810
  3,
@@ -56865,9 +56830,7 @@ var TextSplitter = /*#__PURE__*/ function(BaseDocumentTransformer) {
56865
56830
  numberOfIntermediateNewLines1 = _this.numberOfNewLines(text, indexChunk, indexEndPrevChunk);
56866
56831
  lineCounterIndex -= numberOfIntermediateNewLines1;
56867
56832
  }
56868
- if (appendChunkOverlapHeader) {
56869
- pageContent += chunkOverlapHeader;
56870
- }
56833
+ if (appendChunkOverlapHeader) pageContent += chunkOverlapHeader;
56871
56834
  _state.label = 7;
56872
56835
  case 7:
56873
56836
  newLinesCount = _this.numberOfNewLines(chunk);
@@ -56952,7 +56915,7 @@ var TextSplitter = /*#__PURE__*/ function(BaseDocumentTransformer) {
56952
56915
  var selectedDocuments, texts, metadatas;
56953
56916
  return _ts_generator(this, function(_state) {
56954
56917
  selectedDocuments = documents.filter(function(doc) {
56955
- return doc.pageContent !== undefined;
56918
+ return doc.pageContent !== void 0;
56956
56919
  });
56957
56920
  texts = selectedDocuments.map(function(doc) {
56958
56921
  return doc.pageContent;
@@ -56980,7 +56943,7 @@ var TextSplitter = /*#__PURE__*/ function(BaseDocumentTransformer) {
56980
56943
  value: function mergeSplits(splits, separator) {
56981
56944
  var _this = this;
56982
56945
  return _async_to_generator(function() {
56983
- var docs, currentDoc, total, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, d, _len, doc, err, doc1;
56946
+ var docs, currentDoc, total, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, d, _len, doc$1, err, doc;
56984
56947
  return _ts_generator(this, function(_state) {
56985
56948
  switch(_state.label){
56986
56949
  case 0:
@@ -57014,17 +56977,13 @@ var TextSplitter = /*#__PURE__*/ function(BaseDocumentTransformer) {
57014
56977
  3,
57015
56978
  6
57016
56979
  ];
57017
- if (total > _this.chunkSize) {
57018
- console.warn("Created a chunk of size ".concat(total, ", +\nwhich is longer than the specified ").concat(_this.chunkSize));
57019
- }
56980
+ if (total > _this.chunkSize) console.warn("Created a chunk of size ".concat(total, ", +\nwhich is longer than the specified ").concat(_this.chunkSize));
57020
56981
  if (!(currentDoc.length > 0)) return [
57021
56982
  3,
57022
56983
  6
57023
56984
  ];
57024
- doc = _this.joinDocs(currentDoc, separator);
57025
- if (doc !== null) {
57026
- docs.push(doc);
57027
- }
56985
+ doc$1 = _this.joinDocs(currentDoc, separator);
56986
+ if (doc$1 !== null) docs.push(doc$1);
57028
56987
  _state.label = 4;
57029
56988
  case 4:
57030
56989
  if (!(total > _this.chunkOverlap || total + _len + currentDoc.length * separator.length > _this.chunkSize && total > 0)) return [
@@ -57079,10 +57038,8 @@ var TextSplitter = /*#__PURE__*/ function(BaseDocumentTransformer) {
57079
57038
  7
57080
57039
  ];
57081
57040
  case 11:
57082
- doc1 = _this.joinDocs(currentDoc, separator);
57083
- if (doc1 !== null) {
57084
- docs.push(doc1);
57085
- }
57041
+ doc = _this.joinDocs(currentDoc, separator);
57042
+ if (doc !== null) docs.push(doc);
57086
57043
  return [
57087
57044
  2,
57088
57045
  docs
@@ -57102,17 +57059,12 @@ var RecursiveCharacterTextSplitter = /*#__PURE__*/ function(TextSplitter) {
57102
57059
  _class_call_check$B(this, RecursiveCharacterTextSplitter);
57103
57060
  var _this;
57104
57061
  _this = _super.call(this, fields);
57105
- Object.defineProperty(_assert_this_initialized$l(_this), "separators", {
57106
- enumerable: true,
57107
- configurable: true,
57108
- writable: true,
57109
- value: [
57110
- "\n\n",
57111
- "\n",
57112
- " ",
57113
- ""
57114
- ]
57115
- });
57062
+ _define_property$5(_assert_this_initialized$l(_this), "separators", [
57063
+ "\n\n",
57064
+ "\n",
57065
+ " ",
57066
+ ""
57067
+ ]);
57116
57068
  var _fields_separators;
57117
57069
  _this.separators = (_fields_separators = fields === null || fields === void 0 ? void 0 : fields.separators) !== null && _fields_separators !== void 0 ? _fields_separators : _this.separators;
57118
57070
  var _fields_keepSeparator;
@@ -57130,7 +57082,6 @@ var RecursiveCharacterTextSplitter = /*#__PURE__*/ function(TextSplitter) {
57130
57082
  switch(_state.label){
57131
57083
  case 0:
57132
57084
  finalChunks = [];
57133
- // Get appropriate separator to use
57134
57085
  separator = separators[separators.length - 1];
57135
57086
  for(i = 0; i < separators.length; i += 1){
57136
57087
  s = separators[i];
@@ -57144,9 +57095,7 @@ var RecursiveCharacterTextSplitter = /*#__PURE__*/ function(TextSplitter) {
57144
57095
  break;
57145
57096
  }
57146
57097
  }
57147
- // Now that we have the separator, split the text
57148
57098
  splits = _this.splitOnSeparator(text, separator);
57149
- // Now go merging things, recursively splitting longer texts.
57150
57099
  goodSplits = [];
57151
57100
  _separator = _this.keepSeparator ? "" : separator;
57152
57101
  _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
@@ -57300,349 +57249,267 @@ var RecursiveCharacterTextSplitter = /*#__PURE__*/ function(TextSplitter) {
57300
57249
  {
57301
57250
  key: "getSeparatorsForLanguage",
57302
57251
  value: function getSeparatorsForLanguage(language) {
57303
- if (language === "cpp") {
57304
- return [
57305
- // Split along class definitions
57306
- "\nclass ",
57307
- // Split along function definitions
57308
- "\nvoid ",
57309
- "\nint ",
57310
- "\nfloat ",
57311
- "\ndouble ",
57312
- // Split along control flow statements
57313
- "\nif ",
57314
- "\nfor ",
57315
- "\nwhile ",
57316
- "\nswitch ",
57317
- "\ncase ",
57318
- // Split by the normal type of lines
57319
- "\n\n",
57320
- "\n",
57321
- " ",
57322
- ""
57323
- ];
57324
- } else if (language === "go") {
57325
- return [
57326
- // Split along function definitions
57327
- "\nfunc ",
57328
- "\nvar ",
57329
- "\nconst ",
57330
- "\ntype ",
57331
- // Split along control flow statements
57332
- "\nif ",
57333
- "\nfor ",
57334
- "\nswitch ",
57335
- "\ncase ",
57336
- // Split by the normal type of lines
57337
- "\n\n",
57338
- "\n",
57339
- " ",
57340
- ""
57341
- ];
57342
- } else if (language === "java") {
57343
- return [
57344
- // Split along class definitions
57345
- "\nclass ",
57346
- // Split along method definitions
57347
- "\npublic ",
57348
- "\nprotected ",
57349
- "\nprivate ",
57350
- "\nstatic ",
57351
- // Split along control flow statements
57352
- "\nif ",
57353
- "\nfor ",
57354
- "\nwhile ",
57355
- "\nswitch ",
57356
- "\ncase ",
57357
- // Split by the normal type of lines
57358
- "\n\n",
57359
- "\n",
57360
- " ",
57361
- ""
57362
- ];
57363
- } else if (language === "js") {
57364
- return [
57365
- // Split along function definitions
57366
- "\nfunction ",
57367
- "\nconst ",
57368
- "\nlet ",
57369
- "\nvar ",
57370
- "\nclass ",
57371
- // Split along control flow statements
57372
- "\nif ",
57373
- "\nfor ",
57374
- "\nwhile ",
57375
- "\nswitch ",
57376
- "\ncase ",
57377
- "\ndefault ",
57378
- // Split by the normal type of lines
57379
- "\n\n",
57380
- "\n",
57381
- " ",
57382
- ""
57383
- ];
57384
- } else if (language === "php") {
57385
- return [
57386
- // Split along function definitions
57387
- "\nfunction ",
57388
- // Split along class definitions
57389
- "\nclass ",
57390
- // Split along control flow statements
57391
- "\nif ",
57392
- "\nforeach ",
57393
- "\nwhile ",
57394
- "\ndo ",
57395
- "\nswitch ",
57396
- "\ncase ",
57397
- // Split by the normal type of lines
57398
- "\n\n",
57399
- "\n",
57400
- " ",
57401
- ""
57402
- ];
57403
- } else if (language === "proto") {
57404
- return [
57405
- // Split along message definitions
57406
- "\nmessage ",
57407
- // Split along service definitions
57408
- "\nservice ",
57409
- // Split along enum definitions
57410
- "\nenum ",
57411
- // Split along option definitions
57412
- "\noption ",
57413
- // Split along import statements
57414
- "\nimport ",
57415
- // Split along syntax declarations
57416
- "\nsyntax ",
57417
- // Split by the normal type of lines
57418
- "\n\n",
57419
- "\n",
57420
- " ",
57421
- ""
57422
- ];
57423
- } else if (language === "python") {
57424
- return [
57425
- // First, try to split along class definitions
57426
- "\nclass ",
57427
- "\ndef ",
57428
- "\n\tdef ",
57429
- // Now split by the normal type of lines
57430
- "\n\n",
57431
- "\n",
57432
- " ",
57433
- ""
57434
- ];
57435
- } else if (language === "rst") {
57436
- return [
57437
- // Split along section titles
57438
- "\n===\n",
57439
- "\n---\n",
57440
- "\n***\n",
57441
- // Split along directive markers
57442
- "\n.. ",
57443
- // Split by the normal type of lines
57444
- "\n\n",
57445
- "\n",
57446
- " ",
57447
- ""
57448
- ];
57449
- } else if (language === "ruby") {
57450
- return [
57451
- // Split along method definitions
57452
- "\ndef ",
57453
- "\nclass ",
57454
- // Split along control flow statements
57455
- "\nif ",
57456
- "\nunless ",
57457
- "\nwhile ",
57458
- "\nfor ",
57459
- "\ndo ",
57460
- "\nbegin ",
57461
- "\nrescue ",
57462
- // Split by the normal type of lines
57463
- "\n\n",
57464
- "\n",
57465
- " ",
57466
- ""
57467
- ];
57468
- } else if (language === "rust") {
57469
- return [
57470
- // Split along function definitions
57471
- "\nfn ",
57472
- "\nconst ",
57473
- "\nlet ",
57474
- // Split along control flow statements
57475
- "\nif ",
57476
- "\nwhile ",
57477
- "\nfor ",
57478
- "\nloop ",
57479
- "\nmatch ",
57480
- "\nconst ",
57481
- // Split by the normal type of lines
57482
- "\n\n",
57483
- "\n",
57484
- " ",
57485
- ""
57486
- ];
57487
- } else if (language === "scala") {
57488
- return [
57489
- // Split along class definitions
57490
- "\nclass ",
57491
- "\nobject ",
57492
- // Split along method definitions
57493
- "\ndef ",
57494
- "\nval ",
57495
- "\nvar ",
57496
- // Split along control flow statements
57497
- "\nif ",
57498
- "\nfor ",
57499
- "\nwhile ",
57500
- "\nmatch ",
57501
- "\ncase ",
57502
- // Split by the normal type of lines
57503
- "\n\n",
57504
- "\n",
57505
- " ",
57506
- ""
57507
- ];
57508
- } else if (language === "swift") {
57509
- return [
57510
- // Split along function definitions
57511
- "\nfunc ",
57512
- // Split along class definitions
57513
- "\nclass ",
57514
- "\nstruct ",
57515
- "\nenum ",
57516
- // Split along control flow statements
57517
- "\nif ",
57518
- "\nfor ",
57519
- "\nwhile ",
57520
- "\ndo ",
57521
- "\nswitch ",
57522
- "\ncase ",
57523
- // Split by the normal type of lines
57524
- "\n\n",
57525
- "\n",
57526
- " ",
57527
- ""
57528
- ];
57529
- } else if (language === "markdown") {
57530
- return [
57531
- // First, try to split along Markdown headings (starting with level 2)
57532
- "\n## ",
57533
- "\n### ",
57534
- "\n#### ",
57535
- "\n##### ",
57536
- "\n###### ",
57537
- // Note the alternative syntax for headings (below) is not handled here
57538
- // Heading level 2
57539
- // ---------------
57540
- // End of code block
57541
- "```\n\n",
57542
- // Horizontal lines
57543
- "\n\n***\n\n",
57544
- "\n\n---\n\n",
57545
- "\n\n___\n\n",
57546
- // Note that this splitter doesn't handle horizontal lines defined
57547
- // by *three or more* of ***, ---, or ___, but this is not handled
57548
- "\n\n",
57549
- "\n",
57550
- " ",
57551
- ""
57552
- ];
57553
- } else if (language === "latex") {
57554
- return [
57555
- // First, try to split along Latex sections
57556
- "\n\\chapter{",
57557
- "\n\\section{",
57558
- "\n\\subsection{",
57559
- "\n\\subsubsection{",
57560
- // Now split by environments
57561
- "\n\\begin{enumerate}",
57562
- "\n\\begin{itemize}",
57563
- "\n\\begin{description}",
57564
- "\n\\begin{list}",
57565
- "\n\\begin{quote}",
57566
- "\n\\begin{quotation}",
57567
- "\n\\begin{verse}",
57568
- "\n\\begin{verbatim}",
57569
- // Now split by math environments
57570
- "\n\\begin{align}",
57571
- "$$",
57572
- "$",
57573
- // Now split by the normal type of lines
57574
- "\n\n",
57575
- "\n",
57576
- " ",
57577
- ""
57578
- ];
57579
- } else if (language === "html") {
57580
- return [
57581
- // First, try to split along HTML tags
57582
- "<body>",
57583
- "<div>",
57584
- "<p>",
57585
- "<br>",
57586
- "<li>",
57587
- "<h1>",
57588
- "<h2>",
57589
- "<h3>",
57590
- "<h4>",
57591
- "<h5>",
57592
- "<h6>",
57593
- "<span>",
57594
- "<table>",
57595
- "<tr>",
57596
- "<td>",
57597
- "<th>",
57598
- "<ul>",
57599
- "<ol>",
57600
- "<header>",
57601
- "<footer>",
57602
- "<nav>",
57603
- // Head
57604
- "<head>",
57605
- "<style>",
57606
- "<script>",
57607
- "<meta>",
57608
- "<title>",
57609
- // Normal type of lines
57610
- " ",
57611
- ""
57612
- ];
57613
- } else if (language === "sol") {
57614
- return [
57615
- // Split along compiler informations definitions
57616
- "\npragma ",
57617
- "\nusing ",
57618
- // Split along contract definitions
57619
- "\ncontract ",
57620
- "\ninterface ",
57621
- "\nlibrary ",
57622
- // Split along method definitions
57623
- "\nconstructor ",
57624
- "\ntype ",
57625
- "\nfunction ",
57626
- "\nevent ",
57627
- "\nmodifier ",
57628
- "\nerror ",
57629
- "\nstruct ",
57630
- "\nenum ",
57631
- // Split along control flow statements
57632
- "\nif ",
57633
- "\nfor ",
57634
- "\nwhile ",
57635
- "\ndo while ",
57636
- "\nassembly ",
57637
- // Split by the normal type of lines
57638
- "\n\n",
57639
- "\n",
57640
- " ",
57641
- ""
57642
- ];
57643
- } else {
57644
- throw new Error("Language ".concat(language, " is not supported."));
57645
- }
57252
+ if (language === "cpp") return [
57253
+ "\nclass ",
57254
+ "\nvoid ",
57255
+ "\nint ",
57256
+ "\nfloat ",
57257
+ "\ndouble ",
57258
+ "\nif ",
57259
+ "\nfor ",
57260
+ "\nwhile ",
57261
+ "\nswitch ",
57262
+ "\ncase ",
57263
+ "\n\n",
57264
+ "\n",
57265
+ " ",
57266
+ ""
57267
+ ];
57268
+ else if (language === "go") return [
57269
+ "\nfunc ",
57270
+ "\nvar ",
57271
+ "\nconst ",
57272
+ "\ntype ",
57273
+ "\nif ",
57274
+ "\nfor ",
57275
+ "\nswitch ",
57276
+ "\ncase ",
57277
+ "\n\n",
57278
+ "\n",
57279
+ " ",
57280
+ ""
57281
+ ];
57282
+ else if (language === "java") return [
57283
+ "\nclass ",
57284
+ "\npublic ",
57285
+ "\nprotected ",
57286
+ "\nprivate ",
57287
+ "\nstatic ",
57288
+ "\nif ",
57289
+ "\nfor ",
57290
+ "\nwhile ",
57291
+ "\nswitch ",
57292
+ "\ncase ",
57293
+ "\n\n",
57294
+ "\n",
57295
+ " ",
57296
+ ""
57297
+ ];
57298
+ else if (language === "js") return [
57299
+ "\nfunction ",
57300
+ "\nconst ",
57301
+ "\nlet ",
57302
+ "\nvar ",
57303
+ "\nclass ",
57304
+ "\nif ",
57305
+ "\nfor ",
57306
+ "\nwhile ",
57307
+ "\nswitch ",
57308
+ "\ncase ",
57309
+ "\ndefault ",
57310
+ "\n\n",
57311
+ "\n",
57312
+ " ",
57313
+ ""
57314
+ ];
57315
+ else if (language === "php") return [
57316
+ "\nfunction ",
57317
+ "\nclass ",
57318
+ "\nif ",
57319
+ "\nforeach ",
57320
+ "\nwhile ",
57321
+ "\ndo ",
57322
+ "\nswitch ",
57323
+ "\ncase ",
57324
+ "\n\n",
57325
+ "\n",
57326
+ " ",
57327
+ ""
57328
+ ];
57329
+ else if (language === "proto") return [
57330
+ "\nmessage ",
57331
+ "\nservice ",
57332
+ "\nenum ",
57333
+ "\noption ",
57334
+ "\nimport ",
57335
+ "\nsyntax ",
57336
+ "\n\n",
57337
+ "\n",
57338
+ " ",
57339
+ ""
57340
+ ];
57341
+ else if (language === "python") return [
57342
+ "\nclass ",
57343
+ "\ndef ",
57344
+ "\n def ",
57345
+ "\n\n",
57346
+ "\n",
57347
+ " ",
57348
+ ""
57349
+ ];
57350
+ else if (language === "rst") return [
57351
+ "\n===\n",
57352
+ "\n---\n",
57353
+ "\n***\n",
57354
+ "\n.. ",
57355
+ "\n\n",
57356
+ "\n",
57357
+ " ",
57358
+ ""
57359
+ ];
57360
+ else if (language === "ruby") return [
57361
+ "\ndef ",
57362
+ "\nclass ",
57363
+ "\nif ",
57364
+ "\nunless ",
57365
+ "\nwhile ",
57366
+ "\nfor ",
57367
+ "\ndo ",
57368
+ "\nbegin ",
57369
+ "\nrescue ",
57370
+ "\n\n",
57371
+ "\n",
57372
+ " ",
57373
+ ""
57374
+ ];
57375
+ else if (language === "rust") return [
57376
+ "\nfn ",
57377
+ "\nconst ",
57378
+ "\nlet ",
57379
+ "\nif ",
57380
+ "\nwhile ",
57381
+ "\nfor ",
57382
+ "\nloop ",
57383
+ "\nmatch ",
57384
+ "\nconst ",
57385
+ "\n\n",
57386
+ "\n",
57387
+ " ",
57388
+ ""
57389
+ ];
57390
+ else if (language === "scala") return [
57391
+ "\nclass ",
57392
+ "\nobject ",
57393
+ "\ndef ",
57394
+ "\nval ",
57395
+ "\nvar ",
57396
+ "\nif ",
57397
+ "\nfor ",
57398
+ "\nwhile ",
57399
+ "\nmatch ",
57400
+ "\ncase ",
57401
+ "\n\n",
57402
+ "\n",
57403
+ " ",
57404
+ ""
57405
+ ];
57406
+ else if (language === "swift") return [
57407
+ "\nfunc ",
57408
+ "\nclass ",
57409
+ "\nstruct ",
57410
+ "\nenum ",
57411
+ "\nif ",
57412
+ "\nfor ",
57413
+ "\nwhile ",
57414
+ "\ndo ",
57415
+ "\nswitch ",
57416
+ "\ncase ",
57417
+ "\n\n",
57418
+ "\n",
57419
+ " ",
57420
+ ""
57421
+ ];
57422
+ else if (language === "markdown") return [
57423
+ "\n## ",
57424
+ "\n### ",
57425
+ "\n#### ",
57426
+ "\n##### ",
57427
+ "\n###### ",
57428
+ "```\n\n",
57429
+ "\n\n***\n\n",
57430
+ "\n\n---\n\n",
57431
+ "\n\n___\n\n",
57432
+ "\n\n",
57433
+ "\n",
57434
+ " ",
57435
+ ""
57436
+ ];
57437
+ else if (language === "latex") return [
57438
+ "\n\\chapter{",
57439
+ "\n\\section{",
57440
+ "\n\\subsection{",
57441
+ "\n\\subsubsection{",
57442
+ "\n\\begin{enumerate}",
57443
+ "\n\\begin{itemize}",
57444
+ "\n\\begin{description}",
57445
+ "\n\\begin{list}",
57446
+ "\n\\begin{quote}",
57447
+ "\n\\begin{quotation}",
57448
+ "\n\\begin{verse}",
57449
+ "\n\\begin{verbatim}",
57450
+ "\n\\begin{align}",
57451
+ "$$",
57452
+ "$",
57453
+ "\n\n",
57454
+ "\n",
57455
+ " ",
57456
+ ""
57457
+ ];
57458
+ else if (language === "html") return [
57459
+ "<body>",
57460
+ "<div>",
57461
+ "<p>",
57462
+ "<br>",
57463
+ "<li>",
57464
+ "<h1>",
57465
+ "<h2>",
57466
+ "<h3>",
57467
+ "<h4>",
57468
+ "<h5>",
57469
+ "<h6>",
57470
+ "<span>",
57471
+ "<table>",
57472
+ "<tr>",
57473
+ "<td>",
57474
+ "<th>",
57475
+ "<ul>",
57476
+ "<ol>",
57477
+ "<header>",
57478
+ "<footer>",
57479
+ "<nav>",
57480
+ "<head>",
57481
+ "<style>",
57482
+ "<script>",
57483
+ "<meta>",
57484
+ "<title>",
57485
+ " ",
57486
+ ""
57487
+ ];
57488
+ else if (language === "sol") return [
57489
+ "\npragma ",
57490
+ "\nusing ",
57491
+ "\ncontract ",
57492
+ "\ninterface ",
57493
+ "\nlibrary ",
57494
+ "\nconstructor ",
57495
+ "\ntype ",
57496
+ "\nfunction ",
57497
+ "\nevent ",
57498
+ "\nmodifier ",
57499
+ "\nerror ",
57500
+ "\nstruct ",
57501
+ "\nenum ",
57502
+ "\nif ",
57503
+ "\nfor ",
57504
+ "\nwhile ",
57505
+ "\ndo while ",
57506
+ "\nassembly ",
57507
+ "\n\n",
57508
+ "\n",
57509
+ " ",
57510
+ ""
57511
+ ];
57512
+ else throw new Error("Language ".concat(language, " is not supported."));
57646
57513
  }
57647
57514
  }
57648
57515
  ]);