just-the-docs-peter 0.1.0 → 0.1.2

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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1508 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +110 -0
  5. data/Rakefile +1 -0
  6. data/_includes/components/aux_nav.html +15 -0
  7. data/_includes/components/breadcrumbs.html +43 -0
  8. data/_includes/components/children_nav.html +33 -0
  9. data/_includes/components/footer.html +34 -0
  10. data/_includes/components/header.html +11 -0
  11. data/_includes/components/mermaid.html +45 -0
  12. data/_includes/components/search_footer.html +7 -0
  13. data/_includes/components/search_header.html +9 -0
  14. data/_includes/components/sidebar.html +71 -0
  15. data/_includes/css/callouts.scss.liquid +93 -0
  16. data/_includes/css/custom.scss.liquid +1 -0
  17. data/_includes/css/just-the-docs.scss.liquid +12 -0
  18. data/_includes/fix_linenos.html +65 -0
  19. data/_includes/footer_custom.html +3 -0
  20. data/_includes/head.html +42 -0
  21. data/_includes/head_custom.html +0 -0
  22. data/_includes/header_custom.html +0 -0
  23. data/_includes/icons/code_copy.html +15 -0
  24. data/_includes/icons/document.html +6 -0
  25. data/_includes/icons/expand.html +6 -0
  26. data/_includes/icons/external_link.html +5 -0
  27. data/_includes/icons/icons.html +13 -0
  28. data/_includes/icons/link.html +6 -0
  29. data/_includes/icons/menu.html +6 -0
  30. data/_includes/icons/search.html +6 -0
  31. data/_includes/js/custom.js +0 -0
  32. data/_includes/lunr/custom-data.json +0 -0
  33. data/_includes/lunr/custom-index.js +0 -0
  34. data/_includes/mermaid_config.js +1 -0
  35. data/_includes/nav.html +106 -0
  36. data/_includes/nav_footer_custom.html +0 -0
  37. data/_includes/search_placeholder_custom.html +1 -0
  38. data/_includes/sorted_pages.html +95 -0
  39. data/_includes/title.html +5 -0
  40. data/_includes/toc_heading_custom.html +1 -0
  41. data/_includes/vendor/anchor_headings.html +172 -0
  42. data/_layouts/about.html +5 -0
  43. data/_layouts/default.html +41 -0
  44. data/_layouts/home.html +5 -0
  45. data/_layouts/minimal.html +34 -0
  46. data/_layouts/page.html +5 -0
  47. data/_layouts/post.html +5 -0
  48. data/_layouts/table_wrappers.html +7 -0
  49. data/_layouts/vendor/compress.html +10 -0
  50. data/_sass/base.scss +109 -0
  51. data/_sass/buttons.scss +123 -0
  52. data/_sass/code.scss +246 -0
  53. data/_sass/color_schemes/dark.scss +17 -0
  54. data/_sass/color_schemes/legacy_light.scss +208 -0
  55. data/_sass/color_schemes/light.scss +15 -0
  56. data/_sass/color_schemes/light_peter.scss +15 -0
  57. data/_sass/content.scss +239 -0
  58. data/_sass/custom/custom.scss +1 -0
  59. data/_sass/custom/setup.scss +1 -0
  60. data/_sass/labels.scss +33 -0
  61. data/_sass/layout.scss +209 -0
  62. data/_sass/modules.scss +17 -0
  63. data/_sass/navigation.scss +235 -0
  64. data/_sass/print.scss +40 -0
  65. data/_sass/search.scss +311 -0
  66. data/_sass/skiptomain.scss +30 -0
  67. data/_sass/support/_variables.scss +116 -0
  68. data/_sass/support/mixins/_buttons.scss +27 -0
  69. data/_sass/support/mixins/_layout.scss +33 -0
  70. data/_sass/support/mixins/_typography.scss +84 -0
  71. data/_sass/support/mixins/mixins.scss +3 -0
  72. data/_sass/support/support.scss +2 -0
  73. data/_sass/tables.scss +54 -0
  74. data/_sass/typography.scss +63 -0
  75. data/_sass/utilities/_colors.scss +237 -0
  76. data/_sass/utilities/_layout.scss +101 -0
  77. data/_sass/utilities/_lists.scss +15 -0
  78. data/_sass/utilities/_spacing.scss +162 -0
  79. data/_sass/utilities/_typography.scss +85 -0
  80. data/_sass/utilities/utilities.scss +5 -0
  81. data/_sass/vendor/OneDarkJekyll/LICENSE +21 -0
  82. data/_sass/vendor/OneDarkJekyll/syntax.scss +202 -0
  83. data/_sass/vendor/OneLightJekyll/LICENSE +65 -0
  84. data/_sass/vendor/OneLightJekyll/syntax.scss +208 -0
  85. data/_sass/vendor/normalize.scss/README.md +7 -0
  86. data/_sass/vendor/normalize.scss/normalize.scss +351 -0
  87. data/assets/css/just-the-docs-dark.scss +3 -0
  88. data/assets/css/just-the-docs-default.scss +8 -0
  89. data/assets/css/just-the-docs-light.scss +3 -0
  90. data/assets/js/just-the-docs.js +535 -0
  91. data/assets/js/vendor/lunr.min.js +61 -0
  92. data/assets/js/zzzz-search-data.json +74 -0
  93. data/bin/just-the-docs +16 -0
  94. data/favicon.ico +0 -0
  95. data/lib/tasks/search.rake +88 -0
  96. metadata +152 -11
@@ -0,0 +1,535 @@
1
+ ---
2
+ ---
3
+ (function (jtd, undefined) {
4
+
5
+ // Event handling
6
+
7
+ jtd.addEvent = function(el, type, handler) {
8
+ if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler);
9
+ }
10
+ jtd.removeEvent = function(el, type, handler) {
11
+ if (el.detachEvent) el.detachEvent('on'+type, handler); else el.removeEventListener(type, handler);
12
+ }
13
+ jtd.onReady = function(ready) {
14
+ // in case the document is already rendered
15
+ if (document.readyState!='loading') ready();
16
+ // modern browsers
17
+ else if (document.addEventListener) document.addEventListener('DOMContentLoaded', ready);
18
+ // IE <= 8
19
+ else document.attachEvent('onreadystatechange', function(){
20
+ if (document.readyState=='complete') ready();
21
+ });
22
+ }
23
+
24
+ // Show/hide mobile menu
25
+
26
+ function initNav() {
27
+ jtd.addEvent(document, 'click', function(e){
28
+ var target = e.target;
29
+ while (target && !(target.classList && target.classList.contains('nav-list-expander'))) {
30
+ target = target.parentNode;
31
+ }
32
+ if (target) {
33
+ e.preventDefault();
34
+ target.ariaPressed = target.parentNode.classList.toggle('active');
35
+ }
36
+ });
37
+
38
+ const siteNav = document.getElementById('site-nav');
39
+ const mainHeader = document.getElementById('main-header');
40
+ const menuButton = document.getElementById('menu-button');
41
+
42
+ jtd.addEvent(menuButton, 'click', function(e){
43
+ e.preventDefault();
44
+
45
+ if (menuButton.classList.toggle('nav-open')) {
46
+ siteNav.classList.add('nav-open');
47
+ mainHeader.classList.add('nav-open');
48
+ menuButton.ariaPressed = true;
49
+ } else {
50
+ siteNav.classList.remove('nav-open');
51
+ mainHeader.classList.remove('nav-open');
52
+ menuButton.ariaPressed = false;
53
+ }
54
+ });
55
+
56
+ {%- if site.search_enabled != false and site.search.button %}
57
+ const searchInput = document.getElementById('search-input');
58
+ const searchButton = document.getElementById('search-button');
59
+
60
+ jtd.addEvent(searchButton, 'click', function(e){
61
+ e.preventDefault();
62
+
63
+ mainHeader.classList.add('nav-open');
64
+ searchInput.focus();
65
+ });
66
+ {%- endif %}
67
+ }
68
+
69
+ {%- if site.search_enabled != false %}
70
+ // Site search
71
+
72
+ function initSearch() {
73
+ var request = new XMLHttpRequest();
74
+ request.open('GET', '{{ "assets/js/search-data.json" | relative_url }}', true);
75
+
76
+ request.onload = function(){
77
+ if (request.status >= 200 && request.status < 400) {
78
+ var docs = JSON.parse(request.responseText);
79
+
80
+ lunr.tokenizer.separator = {{ site.search.tokenizer_separator | default: site.search_tokenizer_separator | default: "/[\s\-/]+/" }}
81
+
82
+ var index = lunr(function(){
83
+ this.ref('id');
84
+ this.field('title', { boost: 200 });
85
+ this.field('content', { boost: 2 });
86
+ {%- if site.search.rel_url != false %}
87
+ this.field('relUrl');
88
+ {%- endif %}
89
+ this.metadataWhitelist = ['position']
90
+
91
+ for (var i in docs) {
92
+ {% include lunr/custom-index.js %}
93
+ this.add({
94
+ id: i,
95
+ title: docs[i].title,
96
+ content: docs[i].content,
97
+ {%- if site.search.rel_url != false %}
98
+ relUrl: docs[i].relUrl
99
+ {%- endif %}
100
+ });
101
+ }
102
+ });
103
+
104
+ searchLoaded(index, docs);
105
+ } else {
106
+ console.log('Error loading ajax request. Request status:' + request.status);
107
+ }
108
+ };
109
+
110
+ request.onerror = function(){
111
+ console.log('There was a connection error');
112
+ };
113
+
114
+ request.send();
115
+ }
116
+
117
+ function searchLoaded(index, docs) {
118
+ var index = index;
119
+ var docs = docs;
120
+ var searchInput = document.getElementById('search-input');
121
+ var searchResults = document.getElementById('search-results');
122
+ var mainHeader = document.getElementById('main-header');
123
+ var currentInput;
124
+ var currentSearchIndex = 0;
125
+
126
+ function showSearch() {
127
+ document.documentElement.classList.add('search-active');
128
+ }
129
+
130
+ function hideSearch() {
131
+ document.documentElement.classList.remove('search-active');
132
+ }
133
+
134
+ function update() {
135
+ currentSearchIndex++;
136
+
137
+ var input = searchInput.value;
138
+ if (input === '') {
139
+ hideSearch();
140
+ } else {
141
+ showSearch();
142
+ // scroll search input into view, workaround for iOS Safari
143
+ window.scroll(0, -1);
144
+ setTimeout(function(){ window.scroll(0, 0); }, 0);
145
+ }
146
+ if (input === currentInput) {
147
+ return;
148
+ }
149
+ currentInput = input;
150
+ searchResults.innerHTML = '';
151
+ if (input === '') {
152
+ return;
153
+ }
154
+
155
+ var results = index.query(function (query) {
156
+ var tokens = lunr.tokenizer(input)
157
+ query.term(tokens, {
158
+ boost: 10
159
+ });
160
+ query.term(tokens, {
161
+ wildcard: lunr.Query.wildcard.TRAILING
162
+ });
163
+ });
164
+
165
+ if ((results.length == 0) && (input.length > 2)) {
166
+ var tokens = lunr.tokenizer(input).filter(function(token, i) {
167
+ return token.str.length < 20;
168
+ })
169
+ if (tokens.length > 0) {
170
+ results = index.query(function (query) {
171
+ query.term(tokens, {
172
+ editDistance: Math.round(Math.sqrt(input.length / 2 - 1))
173
+ });
174
+ });
175
+ }
176
+ }
177
+
178
+ if (results.length == 0) {
179
+ var noResultsDiv = document.createElement('div');
180
+ noResultsDiv.classList.add('search-no-result');
181
+ noResultsDiv.innerText = 'No results found';
182
+ searchResults.appendChild(noResultsDiv);
183
+
184
+ } else {
185
+ var resultsList = document.createElement('ul');
186
+ resultsList.classList.add('search-results-list');
187
+ searchResults.appendChild(resultsList);
188
+
189
+ addResults(resultsList, results, 0, 10, 100, currentSearchIndex);
190
+ }
191
+
192
+ function addResults(resultsList, results, start, batchSize, batchMillis, searchIndex) {
193
+ if (searchIndex != currentSearchIndex) {
194
+ return;
195
+ }
196
+ for (var i = start; i < (start + batchSize); i++) {
197
+ if (i == results.length) {
198
+ return;
199
+ }
200
+ addResult(resultsList, results[i]);
201
+ }
202
+ setTimeout(function() {
203
+ addResults(resultsList, results, start + batchSize, batchSize, batchMillis, searchIndex);
204
+ }, batchMillis);
205
+ }
206
+
207
+ function addResult(resultsList, result) {
208
+ var doc = docs[result.ref];
209
+
210
+ var resultsListItem = document.createElement('li');
211
+ resultsListItem.classList.add('search-results-list-item');
212
+ resultsList.appendChild(resultsListItem);
213
+
214
+ var resultLink = document.createElement('a');
215
+ resultLink.classList.add('search-result');
216
+ resultLink.setAttribute('href', doc.url);
217
+ resultsListItem.appendChild(resultLink);
218
+
219
+ var resultTitle = document.createElement('div');
220
+ resultTitle.classList.add('search-result-title');
221
+ resultLink.appendChild(resultTitle);
222
+
223
+ // note: the SVG svg-doc is only loaded as a Jekyll include if site.search_enabled is true; see _includes/icons/icons.html
224
+ var resultDoc = document.createElement('div');
225
+ resultDoc.classList.add('search-result-doc');
226
+ resultDoc.innerHTML = '<svg viewBox="0 0 24 24" class="search-result-icon"><use xlink:href="#svg-doc"></use></svg>';
227
+ resultTitle.appendChild(resultDoc);
228
+
229
+ var resultDocTitle = document.createElement('div');
230
+ resultDocTitle.classList.add('search-result-doc-title');
231
+ resultDocTitle.innerHTML = doc.doc;
232
+ resultDoc.appendChild(resultDocTitle);
233
+ var resultDocOrSection = resultDocTitle;
234
+
235
+ if (doc.doc != doc.title) {
236
+ resultDoc.classList.add('search-result-doc-parent');
237
+ var resultSection = document.createElement('div');
238
+ resultSection.classList.add('search-result-section');
239
+ resultSection.innerHTML = doc.title;
240
+ resultTitle.appendChild(resultSection);
241
+ resultDocOrSection = resultSection;
242
+ }
243
+
244
+ var metadata = result.matchData.metadata;
245
+ var titlePositions = [];
246
+ var contentPositions = [];
247
+ for (var j in metadata) {
248
+ var meta = metadata[j];
249
+ if (meta.title) {
250
+ var positions = meta.title.position;
251
+ for (var k in positions) {
252
+ titlePositions.push(positions[k]);
253
+ }
254
+ }
255
+ if (meta.content) {
256
+ var positions = meta.content.position;
257
+ for (var k in positions) {
258
+ var position = positions[k];
259
+ var previewStart = position[0];
260
+ var previewEnd = position[0] + position[1];
261
+ var ellipsesBefore = true;
262
+ var ellipsesAfter = true;
263
+ for (var k = 0; k < {{ site.search.preview_words_before | default: 5 }}; k++) {
264
+ var nextSpace = doc.content.lastIndexOf(' ', previewStart - 2);
265
+ var nextDot = doc.content.lastIndexOf('. ', previewStart - 2);
266
+ if ((nextDot >= 0) && (nextDot > nextSpace)) {
267
+ previewStart = nextDot + 1;
268
+ ellipsesBefore = false;
269
+ break;
270
+ }
271
+ if (nextSpace < 0) {
272
+ previewStart = 0;
273
+ ellipsesBefore = false;
274
+ break;
275
+ }
276
+ previewStart = nextSpace + 1;
277
+ }
278
+ for (var k = 0; k < {{ site.search.preview_words_after | default: 10 }}; k++) {
279
+ var nextSpace = doc.content.indexOf(' ', previewEnd + 1);
280
+ var nextDot = doc.content.indexOf('. ', previewEnd + 1);
281
+ if ((nextDot >= 0) && (nextDot < nextSpace)) {
282
+ previewEnd = nextDot;
283
+ ellipsesAfter = false;
284
+ break;
285
+ }
286
+ if (nextSpace < 0) {
287
+ previewEnd = doc.content.length;
288
+ ellipsesAfter = false;
289
+ break;
290
+ }
291
+ previewEnd = nextSpace;
292
+ }
293
+ contentPositions.push({
294
+ highlight: position,
295
+ previewStart: previewStart, previewEnd: previewEnd,
296
+ ellipsesBefore: ellipsesBefore, ellipsesAfter: ellipsesAfter
297
+ });
298
+ }
299
+ }
300
+ }
301
+
302
+ if (titlePositions.length > 0) {
303
+ titlePositions.sort(function(p1, p2){ return p1[0] - p2[0] });
304
+ resultDocOrSection.innerHTML = '';
305
+ addHighlightedText(resultDocOrSection, doc.title, 0, doc.title.length, titlePositions);
306
+ }
307
+
308
+ if (contentPositions.length > 0) {
309
+ contentPositions.sort(function(p1, p2){ return p1.highlight[0] - p2.highlight[0] });
310
+ var contentPosition = contentPositions[0];
311
+ var previewPosition = {
312
+ highlight: [contentPosition.highlight],
313
+ previewStart: contentPosition.previewStart, previewEnd: contentPosition.previewEnd,
314
+ ellipsesBefore: contentPosition.ellipsesBefore, ellipsesAfter: contentPosition.ellipsesAfter
315
+ };
316
+ var previewPositions = [previewPosition];
317
+ for (var j = 1; j < contentPositions.length; j++) {
318
+ contentPosition = contentPositions[j];
319
+ if (previewPosition.previewEnd < contentPosition.previewStart) {
320
+ previewPosition = {
321
+ highlight: [contentPosition.highlight],
322
+ previewStart: contentPosition.previewStart, previewEnd: contentPosition.previewEnd,
323
+ ellipsesBefore: contentPosition.ellipsesBefore, ellipsesAfter: contentPosition.ellipsesAfter
324
+ }
325
+ previewPositions.push(previewPosition);
326
+ } else {
327
+ previewPosition.highlight.push(contentPosition.highlight);
328
+ previewPosition.previewEnd = contentPosition.previewEnd;
329
+ previewPosition.ellipsesAfter = contentPosition.ellipsesAfter;
330
+ }
331
+ }
332
+
333
+ var resultPreviews = document.createElement('div');
334
+ resultPreviews.classList.add('search-result-previews');
335
+ resultLink.appendChild(resultPreviews);
336
+
337
+ var content = doc.content;
338
+ for (var j = 0; j < Math.min(previewPositions.length, {{ site.search.previews | default: 3 }}); j++) {
339
+ var position = previewPositions[j];
340
+
341
+ var resultPreview = document.createElement('div');
342
+ resultPreview.classList.add('search-result-preview');
343
+ resultPreviews.appendChild(resultPreview);
344
+
345
+ if (position.ellipsesBefore) {
346
+ resultPreview.appendChild(document.createTextNode('... '));
347
+ }
348
+ addHighlightedText(resultPreview, content, position.previewStart, position.previewEnd, position.highlight);
349
+ if (position.ellipsesAfter) {
350
+ resultPreview.appendChild(document.createTextNode(' ...'));
351
+ }
352
+ }
353
+ }
354
+
355
+ {%- if site.search.rel_url != false %}
356
+ var resultRelUrl = document.createElement('span');
357
+ resultRelUrl.classList.add('search-result-rel-url');
358
+ resultRelUrl.innerText = doc.relUrl;
359
+ resultTitle.appendChild(resultRelUrl);
360
+ {%- endif %}
361
+ }
362
+
363
+ function addHighlightedText(parent, text, start, end, positions) {
364
+ var index = start;
365
+ for (var i in positions) {
366
+ var position = positions[i];
367
+ var span = document.createElement('span');
368
+ span.innerHTML = text.substring(index, position[0]);
369
+ parent.appendChild(span);
370
+ index = position[0] + position[1];
371
+ var highlight = document.createElement('span');
372
+ highlight.classList.add('search-result-highlight');
373
+ highlight.innerHTML = text.substring(position[0], index);
374
+ parent.appendChild(highlight);
375
+ }
376
+ var span = document.createElement('span');
377
+ span.innerHTML = text.substring(index, end);
378
+ parent.appendChild(span);
379
+ }
380
+ }
381
+
382
+ jtd.addEvent(searchInput, 'focus', function(){
383
+ setTimeout(update, 0);
384
+ });
385
+
386
+ jtd.addEvent(searchInput, 'keyup', function(e){
387
+ switch (e.keyCode) {
388
+ case 27: // When esc key is pressed, hide the results and clear the field
389
+ searchInput.value = '';
390
+ break;
391
+ case 38: // arrow up
392
+ case 40: // arrow down
393
+ case 13: // enter
394
+ e.preventDefault();
395
+ return;
396
+ }
397
+ update();
398
+ });
399
+
400
+ jtd.addEvent(searchInput, 'keydown', function(e){
401
+ switch (e.keyCode) {
402
+ case 38: // arrow up
403
+ e.preventDefault();
404
+ var active = document.querySelector('.search-result.active');
405
+ if (active) {
406
+ active.classList.remove('active');
407
+ if (active.parentElement.previousSibling) {
408
+ var previous = active.parentElement.previousSibling.querySelector('.search-result');
409
+ previous.classList.add('active');
410
+ }
411
+ }
412
+ return;
413
+ case 40: // arrow down
414
+ e.preventDefault();
415
+ var active = document.querySelector('.search-result.active');
416
+ if (active) {
417
+ if (active.parentElement.nextSibling) {
418
+ var next = active.parentElement.nextSibling.querySelector('.search-result');
419
+ active.classList.remove('active');
420
+ next.classList.add('active');
421
+ }
422
+ } else {
423
+ var next = document.querySelector('.search-result');
424
+ if (next) {
425
+ next.classList.add('active');
426
+ }
427
+ }
428
+ return;
429
+ case 13: // enter
430
+ e.preventDefault();
431
+ var active = document.querySelector('.search-result.active');
432
+ if (active) {
433
+ active.click();
434
+ } else {
435
+ var first = document.querySelector('.search-result');
436
+ if (first) {
437
+ first.click();
438
+ }
439
+ }
440
+ return;
441
+ }
442
+ });
443
+
444
+ jtd.addEvent(document, 'click', function(e){
445
+ if (e.target != searchInput) {
446
+ hideSearch();
447
+ }
448
+ });
449
+ }
450
+ {%- endif %}
451
+
452
+ // Switch theme
453
+
454
+ jtd.getTheme = function() {
455
+ var cssFileHref = document.querySelector('[rel="stylesheet"]').getAttribute('href');
456
+ return cssFileHref.substring(cssFileHref.lastIndexOf('-') + 1, cssFileHref.length - 4);
457
+ }
458
+
459
+ jtd.setTheme = function(theme) {
460
+ var cssFile = document.querySelector('[rel="stylesheet"]');
461
+ cssFile.setAttribute('href', '{{ "assets/css/just-the-docs-" | relative_url }}' + theme + '.css');
462
+ }
463
+
464
+ // Scroll site-nav to ensure the link to the current page is visible
465
+
466
+ function scrollNav() {
467
+ const href = document.location.pathname;
468
+ const siteNav = document.getElementById('site-nav');
469
+ const targetLink = siteNav.querySelector('a[href="' + href + '"], a[href="' + href + '/"]');
470
+ if(targetLink){
471
+ const rect = targetLink.getBoundingClientRect();
472
+ siteNav.scrollBy(0, rect.top - 3*rect.height);
473
+ }
474
+ }
475
+
476
+ // Document ready
477
+
478
+ jtd.onReady(function(){
479
+ initNav();
480
+ {%- if site.search_enabled != false %}
481
+ initSearch();
482
+ {%- endif %}
483
+ scrollNav();
484
+ });
485
+
486
+ // Copy button on code
487
+
488
+
489
+ {%- if site.enable_copy_code_button != false %}
490
+
491
+ jtd.onReady(function(){
492
+
493
+ if (!window.isSecureContext) {
494
+ console.log('Window does not have a secure context, therefore code clipboard copy functionality will not be available. For more details see https://web.dev/async-clipboard/#security-and-permissions');
495
+ return;
496
+ }
497
+
498
+ var codeBlocks = document.querySelectorAll('div.highlighter-rouge, div.listingblock > div.content, figure.highlight');
499
+
500
+ // note: the SVG svg-copied and svg-copy is only loaded as a Jekyll include if site.enable_copy_code_button is true; see _includes/icons/icons.html
501
+ var svgCopied = '<svg viewBox="0 0 24 24" class="copy-icon"><use xlink:href="#svg-copied"></use></svg>';
502
+ var svgCopy = '<svg viewBox="0 0 24 24" class="copy-icon"><use xlink:href="#svg-copy"></use></svg>';
503
+
504
+ codeBlocks.forEach(codeBlock => {
505
+ var copyButton = document.createElement('button');
506
+ var timeout = null;
507
+ copyButton.type = 'button';
508
+ copyButton.ariaLabel = 'Copy code to clipboard';
509
+ copyButton.innerHTML = svgCopy;
510
+ codeBlock.append(copyButton);
511
+
512
+ copyButton.addEventListener('click', function () {
513
+ if(timeout === null) {
514
+ var code = (codeBlock.querySelector('pre:not(.lineno, .highlight)') || codeBlock.querySelector('code')).innerText;
515
+ window.navigator.clipboard.writeText(code);
516
+
517
+ copyButton.innerHTML = svgCopied;
518
+
519
+ var timeoutSetting = 4000;
520
+
521
+ timeout = setTimeout(function () {
522
+ copyButton.innerHTML = svgCopy;
523
+ timeout = null;
524
+ }, timeoutSetting);
525
+ }
526
+ });
527
+ });
528
+
529
+ });
530
+
531
+ {%- endif %}
532
+
533
+ })(window.jtd = window.jtd || {});
534
+
535
+ {% include js/custom.js %}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9
3
+ * Copyright (C) 2020 Oliver Nightingale
4
+ * @license MIT
5
+ */
6
+ /**
7
+ * ORIGINAL MIT LICENSE
8
+ * Copyright (C) 2013 by Oliver Nightingale
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ */
16
+ !function(){var e,t,r,i,n,s,o,a,u,l,c,h,d,f,p,y,m,g,x,v,w,Q,k,S,E,L,b,P,T=function(e){var t=new T.Builder;return t.pipeline.add(T.trimmer,T.stopWordFilter,T.stemmer),t.searchPipeline.add(T.stemmer),e.call(t,t),t.build()};T.version="2.3.9"
17
+ /*!
18
+ * lunr.utils
19
+ * Copyright (C) 2020 Oliver Nightingale
20
+ */,T.utils={},T.utils.warn=(e=this,function(t){e.console&&console.warn&&console.warn(t)}),T.utils.asString=function(e){return null==e?"":e.toString()},T.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},T.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},T.FieldRef.joiner="/",T.FieldRef.fromString=function(e){var t=e.indexOf(T.FieldRef.joiner);if(-1===t)throw"malformed field ref string";var r=e.slice(0,t),i=e.slice(t+1);return new T.FieldRef(i,r,e)},T.FieldRef.prototype.toString=function(){return null==this._stringValue&&(this._stringValue=this.fieldName+T.FieldRef.joiner+this.docRef),this._stringValue}
21
+ /*!
22
+ * lunr.Set
23
+ * Copyright (C) 2020 Oliver Nightingale
24
+ */,T.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},T.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},T.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},T.Set.prototype.contains=function(e){return!!this.elements[e]},T.Set.prototype.intersect=function(e){var t,r,i,n=[];if(e===T.Set.complete)return this;if(e===T.Set.empty)return e;this.length<e.length?(t=this,r=e):(t=e,r=this),i=Object.keys(t.elements);for(var s=0;s<i.length;s++){var o=i[s];o in r.elements&&n.push(o)}return new T.Set(n)},T.Set.prototype.union=function(e){return e===T.Set.complete?T.Set.complete:e===T.Set.empty?this:new T.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},T.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},T.Token=function(e,t){this.str=e||"",this.metadata=t||{}},T.Token.prototype.toString=function(){return this.str},T.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},T.Token.prototype.clone=function(e){return e=e||function(e){return e},new T.Token(e(this.str,this.metadata),this.metadata)}
25
+ /*!
26
+ * lunr.tokenizer
27
+ * Copyright (C) 2020 Oliver Nightingale
28
+ */,T.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map((function(e){return new T.Token(T.utils.asString(e).toLowerCase(),T.utils.clone(t))}));for(var r=e.toString().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a=s-o;if(r.charAt(s).match(T.tokenizer.separator)||s==i){if(a>0){var u=T.utils.clone(t)||{};u.position=[o,a],u.index=n.length,n.push(new T.Token(r.slice(o,s),u))}o=s+1}}return n},T.tokenizer.separator=/[\s\-]+/
29
+ /*!
30
+ * lunr.Pipeline
31
+ * Copyright (C) 2020 Oliver Nightingale
32
+ */,T.Pipeline=function(){this._stack=[]},T.Pipeline.registeredFunctions=Object.create(null),T.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&T.utils.warn("Overwriting existing registered function: "+t),e.label=t,T.Pipeline.registeredFunctions[e.label]=e},T.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||T.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},T.Pipeline.load=function(e){var t=new T.Pipeline;return e.forEach((function(e){var r=T.Pipeline.registeredFunctions[e];if(!r)throw new Error("Cannot load unregistered function: "+e);t.add(r)})),t},T.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach((function(e){T.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},T.Pipeline.prototype.after=function(e,t){T.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},T.Pipeline.prototype.before=function(e,t){T.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},T.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},T.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(null!=o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},T.Pipeline.prototype.runString=function(e,t){var r=new T.Token(e,t);return this.run([r]).map((function(e){return e.toString()}))},T.Pipeline.prototype.reset=function(){this._stack=[]},T.Pipeline.prototype.toJSON=function(){return this._stack.map((function(e){return T.Pipeline.warnIfFunctionNotRegistered(e),e.label}))}
33
+ /*!
34
+ * lunr.Vector
35
+ * Copyright (C) 2020 Oliver Nightingale
36
+ */,T.Vector=function(e){this._magnitude=0,this.elements=e||[]},T.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,i=r-t,n=Math.floor(i/2),s=this.elements[2*n];i>1&&(s<e&&(t=n),s>e&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e||s>e?2*n:s<e?2*(n+1):void 0},T.Vector.prototype.insert=function(e,t){this.upsert(e,t,(function(){throw"duplicate index"}))},T.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],t):this.elements.splice(i,0,e,t)},T.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},T.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,i=e.elements,n=r.length,s=i.length,o=0,a=0,u=0,l=0;u<n&&l<s;)(o=r[u])<(a=i[l])?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},T.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},T.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},T.Vector.prototype.toJSON=function(){return this.elements}
37
+ /*!
38
+ * lunr.stemmer
39
+ * Copyright (C) 2020 Oliver Nightingale
40
+ * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
41
+ */,T.stemmer=(t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},r={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},i="[aeiouy]",n="[^aeiou][^aeiouy]*",s=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),o=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),a=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),u=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),l=/^(.+?)(ss|i)es$/,c=/^(.+?)([^s])s$/,h=/^(.+?)eed$/,d=/^(.+?)(ed|ing)$/,f=/.$/,p=/(at|bl|iz)$/,y=new RegExp("([^aeiouylsz])\\1$"),m=new RegExp("^"+n+i+"[^aeiouwxy]$"),g=/^(.+?[^aeiou])y$/,x=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,v=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,w=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,Q=/^(.+?)(s|t)(ion)$/,k=/^(.+?)e$/,S=/ll$/,E=new RegExp("^"+n+i+"[^aeiouwxy]$"),L=function(e){var i,n,L,b,P,T,O;if(e.length<3)return e;if("y"==(L=e.substr(0,1))&&(e=L.toUpperCase()+e.substr(1)),P=c,(b=l).test(e)?e=e.replace(b,"$1$2"):P.test(e)&&(e=e.replace(P,"$1$2")),P=d,(b=h).test(e)){var I=b.exec(e);(b=s).test(I[1])&&(b=f,e=e.replace(b,""))}else P.test(e)&&(i=(I=P.exec(e))[1],(P=u).test(i)&&(T=y,O=m,(P=p).test(e=i)?e+="e":T.test(e)?(b=f,e=e.replace(b,"")):O.test(e)&&(e+="e")));return(b=g).test(e)&&(e=(i=(I=b.exec(e))[1])+"i"),(b=x).test(e)&&(i=(I=b.exec(e))[1],n=I[2],(b=s).test(i)&&(e=i+t[n])),(b=v).test(e)&&(i=(I=b.exec(e))[1],n=I[2],(b=s).test(i)&&(e=i+r[n])),P=Q,(b=w).test(e)?(i=(I=b.exec(e))[1],(b=o).test(i)&&(e=i)):P.test(e)&&(i=(I=P.exec(e))[1]+I[2],(P=o).test(i)&&(e=i)),(b=k).test(e)&&(i=(I=b.exec(e))[1],P=a,T=E,((b=o).test(i)||P.test(i)&&!T.test(i))&&(e=i)),P=o,(b=S).test(e)&&P.test(e)&&(b=f,e=e.replace(b,"")),"y"==L&&(e=L.toLowerCase()+e.substr(1)),e},function(e){return e.update(L)}),T.Pipeline.registerFunction(T.stemmer,"stemmer")
42
+ /*!
43
+ * lunr.stopWordFilter
44
+ * Copyright (C) 2020 Oliver Nightingale
45
+ */,T.generateStopWordFilter=function(e){var t=e.reduce((function(e,t){return e[t]=t,e}),{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},T.stopWordFilter=T.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),T.Pipeline.registerFunction(T.stopWordFilter,"stopWordFilter")
46
+ /*!
47
+ * lunr.trimmer
48
+ * Copyright (C) 2020 Oliver Nightingale
49
+ */,T.trimmer=function(e){return e.update((function(e){return e.replace(/^\W+/,"").replace(/\W+$/,"")}))},T.Pipeline.registerFunction(T.trimmer,"trimmer")
50
+ /*!
51
+ * lunr.TokenSet
52
+ * Copyright (C) 2020 Oliver Nightingale
53
+ */,T.TokenSet=function(){this.final=!1,this.edges={},this.id=T.TokenSet._nextId,T.TokenSet._nextId+=1},T.TokenSet._nextId=1,T.TokenSet.fromArray=function(e){for(var t=new T.TokenSet.Builder,r=0,i=e.length;r<i;r++)t.insert(e[r]);return t.finish(),t.root},T.TokenSet.fromClause=function(e){return"editDistance"in e?T.TokenSet.fromFuzzyString(e.term,e.editDistance):T.TokenSet.fromString(e.term)},T.TokenSet.fromFuzzyString=function(e,t){for(var r=new T.TokenSet,i=[{node:r,editsRemaining:t,str:e}];i.length;){var n=i.pop();if(n.str.length>0){var s,o=n.str.charAt(0);o in n.node.edges?s=n.node.edges[o]:(s=new T.TokenSet,n.node.edges[o]=s),1==n.str.length&&(s.final=!0),i.push({node:s,editsRemaining:n.editsRemaining,str:n.str.slice(1)})}if(0!=n.editsRemaining){if("*"in n.node.edges)var a=n.node.edges["*"];else{a=new T.TokenSet;n.node.edges["*"]=a}if(0==n.str.length&&(a.final=!0),i.push({node:a,editsRemaining:n.editsRemaining-1,str:n.str}),n.str.length>1&&i.push({node:n.node,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)}),1==n.str.length&&(n.node.final=!0),n.str.length>=1){if("*"in n.node.edges)var u=n.node.edges["*"];else{u=new T.TokenSet;n.node.edges["*"]=u}1==n.str.length&&(u.final=!0),i.push({node:u,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)})}if(n.str.length>1){var l,c=n.str.charAt(0),h=n.str.charAt(1);h in n.node.edges?l=n.node.edges[h]:(l=new T.TokenSet,n.node.edges[h]=l),1==n.str.length&&(l.final=!0),i.push({node:l,editsRemaining:n.editsRemaining-1,str:c+n.str.slice(2)})}}}return r},T.TokenSet.fromString=function(e){for(var t=new T.TokenSet,r=t,i=0,n=e.length;i<n;i++){var s=e[i],o=i==n-1;if("*"==s)t.edges[s]=t,t.final=o;else{var a=new T.TokenSet;a.final=o,t.edges[s]=a,t=a}}return r},T.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),i=Object.keys(r.node.edges),n=i.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var s=0;s<n;s++){var o=i[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},T.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,i=0;i<r;i++){var n=t[i];e=e+n+this.edges[n].id}return e},T.TokenSet.prototype.intersect=function(e){for(var t=new T.TokenSet,r=void 0,i=[{qNode:e,output:t,node:this}];i.length;){r=i.pop();for(var n=Object.keys(r.qNode.edges),s=n.length,o=Object.keys(r.node.edges),a=o.length,u=0;u<s;u++)for(var l=n[u],c=0;c<a;c++){var h=o[c];if(h==l||"*"==l){var d=r.node.edges[h],f=r.qNode.edges[l],p=d.final&&f.final,y=void 0;h in r.output.edges?(y=r.output.edges[h]).final=y.final||p:((y=new T.TokenSet).final=p,r.output.edges[h]=y),i.push({qNode:f,output:y,node:d})}}}return t},T.TokenSet.Builder=function(){this.previousWord="",this.root=new T.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},T.TokenSet.Builder.prototype.insert=function(e){var t,r=0;if(e<this.previousWord)throw new Error("Out of order word insertion");for(var i=0;i<e.length&&i<this.previousWord.length&&e[i]==this.previousWord[i];i++)r++;this.minimize(r),t=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child;for(i=r;i<e.length;i++){var n=new T.TokenSet,s=e[i];t.edges[s]=n,this.uncheckedNodes.push({parent:t,char:s,child:n}),t=n}t.final=!0,this.previousWord=e},T.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},T.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}}
54
+ /*!
55
+ * lunr.Index
56
+ * Copyright (C) 2020 Oliver Nightingale
57
+ */,T.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},T.Index.prototype.search=function(e){return this.query((function(t){new T.QueryParser(e,t).parse()}))},T.Index.prototype.query=function(e){for(var t=new T.Query(this.fields),r=Object.create(null),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a<this.fields.length;a++)i[this.fields[a]]=new T.Vector;e.call(t,t);for(a=0;a<t.clauses.length;a++){var u=t.clauses[a],l=null,c=T.Set.empty;l=u.usePipeline?this.pipeline.runString(u.term,{fields:u.fields}):[u.term];for(var h=0;h<l.length;h++){var d=l[h];u.term=d;var f=T.TokenSet.fromClause(u),p=this.tokenSet.intersect(f).toArray();if(0===p.length&&u.presence===T.Query.presence.REQUIRED){for(var y=0;y<u.fields.length;y++){s[F=u.fields[y]]=T.Set.empty}break}for(var m=0;m<p.length;m++){var g=p[m],x=this.invertedIndex[g],v=x._index;for(y=0;y<u.fields.length;y++){var w=x[F=u.fields[y]],Q=Object.keys(w),k=g+"/"+F,S=new T.Set(Q);if(u.presence==T.Query.presence.REQUIRED&&(c=c.union(S),void 0===s[F]&&(s[F]=T.Set.complete)),u.presence!=T.Query.presence.PROHIBITED){if(i[F].upsert(v,u.boost,(function(e,t){return e+t})),!n[k]){for(var E=0;E<Q.length;E++){var L,b=Q[E],P=new T.FieldRef(b,F),O=w[b];void 0===(L=r[P])?r[P]=new T.MatchData(g,F,O):L.add(g,F,O)}n[k]=!0}}else void 0===o[F]&&(o[F]=T.Set.empty),o[F]=o[F].union(S)}}}if(u.presence===T.Query.presence.REQUIRED)for(y=0;y<u.fields.length;y++){s[F=u.fields[y]]=s[F].intersect(c)}}var I=T.Set.complete,R=T.Set.empty;for(a=0;a<this.fields.length;a++){var F;s[F=this.fields[a]]&&(I=I.intersect(s[F])),o[F]&&(R=R.union(o[F]))}var C=Object.keys(r),N=[],j=Object.create(null);if(t.isNegated()){C=Object.keys(this.fieldVectors);for(a=0;a<C.length;a++){P=C[a];var _=T.FieldRef.fromString(P);r[P]=new T.MatchData}}for(a=0;a<C.length;a++){var D=(_=T.FieldRef.fromString(C[a])).docRef;if(I.contains(D)&&!R.contains(D)){var A,B=this.fieldVectors[_],V=i[_.fieldName].similarity(B);if(void 0!==(A=j[D]))A.score+=V,A.matchData.combine(r[_]);else{var z={ref:D,score:V,matchData:r[_]};j[D]=z,N.push(z)}}}return N.sort((function(e,t){return t.score-e.score}))},T.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map((function(e){return[e,this.invertedIndex[e]]}),this),t=Object.keys(this.fieldVectors).map((function(e){return[e,this.fieldVectors[e].toJSON()]}),this);return{version:T.version,fields:this.fields,fieldVectors:t,invertedIndex:e,pipeline:this.pipeline.toJSON()}},T.Index.load=function(e){var t={},r={},i=e.fieldVectors,n=Object.create(null),s=e.invertedIndex,o=new T.TokenSet.Builder,a=T.Pipeline.load(e.pipeline);e.version!=T.version&&T.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+T.version+"' does not match serialized index '"+e.version+"'");for(var u=0;u<i.length;u++){var l=(h=i[u])[0],c=h[1];r[l]=new T.Vector(c)}for(u=0;u<s.length;u++){var h,d=(h=s[u])[0],f=h[1];o.insert(d),n[d]=f}return o.finish(),t.fields=e.fields,t.fieldVectors=r,t.invertedIndex=n,t.tokenSet=o.root,t.pipeline=a,new T.Index(t)}
58
+ /*!
59
+ * lunr.Builder
60
+ * Copyright (C) 2020 Oliver Nightingale
61
+ */,T.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=T.tokenizer,this.pipeline=new T.Pipeline,this.searchPipeline=new T.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},T.Builder.prototype.ref=function(e){this._ref=e},T.Builder.prototype.field=function(e,t){if(/\//.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=t||{}},T.Builder.prototype.b=function(e){this._b=e<0?0:e>1?1:e},T.Builder.prototype.k1=function(e){this._k1=e},T.Builder.prototype.add=function(e,t){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var n=0;n<i.length;n++){var s=i[n],o=this._fields[s].extractor,a=o?o(e):e[s],u=this.tokenizer(a,{fields:[s]}),l=this.pipeline.run(u),c=new T.FieldRef(r,s),h=Object.create(null);this.fieldTermFrequencies[c]=h,this.fieldLengths[c]=0,this.fieldLengths[c]+=l.length;for(var d=0;d<l.length;d++){var f=l[d];if(null==h[f]&&(h[f]=0),h[f]+=1,null==this.invertedIndex[f]){var p=Object.create(null);p._index=this.termIndex,this.termIndex+=1;for(var y=0;y<i.length;y++)p[i[y]]=Object.create(null);this.invertedIndex[f]=p}null==this.invertedIndex[f][s][r]&&(this.invertedIndex[f][s][r]=Object.create(null));for(var m=0;m<this.metadataWhitelist.length;m++){var g=this.metadataWhitelist[m],x=f.metadata[g];null==this.invertedIndex[f][s][r][g]&&(this.invertedIndex[f][s][r][g]=[]),this.invertedIndex[f][s][r][g].push(x)}}}},T.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),t=e.length,r={},i={},n=0;n<t;n++){var s=T.FieldRef.fromString(e[n]),o=s.fieldName;i[o]||(i[o]=0),i[o]+=1,r[o]||(r[o]=0),r[o]+=this.fieldLengths[s]}var a=Object.keys(this._fields);for(n=0;n<a.length;n++){var u=a[n];r[u]=r[u]/i[u]}this.averageFieldLength=r},T.Builder.prototype.createFieldVectors=function(){for(var e={},t=Object.keys(this.fieldTermFrequencies),r=t.length,i=Object.create(null),n=0;n<r;n++){for(var s=T.FieldRef.fromString(t[n]),o=s.fieldName,a=this.fieldLengths[s],u=new T.Vector,l=this.fieldTermFrequencies[s],c=Object.keys(l),h=c.length,d=this._fields[o].boost||1,f=this._documents[s.docRef].boost||1,p=0;p<h;p++){var y,m,g,x=c[p],v=l[x],w=this.invertedIndex[x]._index;void 0===i[x]?(y=T.idf(this.invertedIndex[x],this.documentCount),i[x]=y):y=i[x],m=y*((this._k1+1)*v)/(this._k1*(1-this._b+this._b*(a/this.averageFieldLength[o]))+v),m*=d,m*=f,g=Math.round(1e3*m)/1e3,u.insert(w,g)}e[s]=u}this.fieldVectors=e},T.Builder.prototype.createTokenSet=function(){this.tokenSet=T.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},T.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new T.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},T.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},T.MatchData=function(e,t,r){for(var i=Object.create(null),n=Object.keys(r||{}),s=0;s<n.length;s++){var o=n[s];i[o]=r[o].slice()}this.metadata=Object.create(null),void 0!==e&&(this.metadata[e]=Object.create(null),this.metadata[e][t]=i)},T.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var i=t[r],n=Object.keys(e.metadata[i]);null==this.metadata[i]&&(this.metadata[i]=Object.create(null));for(var s=0;s<n.length;s++){var o=n[s],a=Object.keys(e.metadata[i][o]);null==this.metadata[i][o]&&(this.metadata[i][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];null==this.metadata[i][o][l]?this.metadata[i][o][l]=e.metadata[i][o][l]:this.metadata[i][o][l]=this.metadata[i][o][l].concat(e.metadata[i][o][l])}}}},T.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(t in this.metadata[e])for(var i=Object.keys(r),n=0;n<i.length;n++){var s=i[n];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}else this.metadata[e][t]=r},T.Query=function(e){this.clauses=[],this.allFields=e},T.Query.wildcard=new String("*"),T.Query.wildcard.NONE=0,T.Query.wildcard.LEADING=1,T.Query.wildcard.TRAILING=2,T.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},T.Query.prototype.clause=function(e){return"fields"in e||(e.fields=this.allFields),"boost"in e||(e.boost=1),"usePipeline"in e||(e.usePipeline=!0),"wildcard"in e||(e.wildcard=T.Query.wildcard.NONE),e.wildcard&T.Query.wildcard.LEADING&&e.term.charAt(0)!=T.Query.wildcard&&(e.term="*"+e.term),e.wildcard&T.Query.wildcard.TRAILING&&e.term.slice(-1)!=T.Query.wildcard&&(e.term=e.term+"*"),"presence"in e||(e.presence=T.Query.presence.OPTIONAL),this.clauses.push(e),this},T.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=T.Query.presence.PROHIBITED)return!1;return!0},T.Query.prototype.term=function(e,t){if(Array.isArray(e))return e.forEach((function(e){this.term(e,T.utils.clone(t))}),this),this;var r=t||{};return r.term=e.toString(),this.clause(r),this},T.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},T.QueryParseError.prototype=new Error,T.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},T.QueryLexer.prototype.run=function(){for(var e=T.QueryLexer.lexText;e;)e=e(this)},T.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},T.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},T.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},T.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return T.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},T.QueryLexer.prototype.width=function(){return this.pos-this.start},T.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},T.QueryLexer.prototype.backup=function(){this.pos-=1},T.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=T.QueryLexer.EOS&&this.backup()},T.QueryLexer.prototype.more=function(){return this.pos<this.length},T.QueryLexer.EOS="EOS",T.QueryLexer.FIELD="FIELD",T.QueryLexer.TERM="TERM",T.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",T.QueryLexer.BOOST="BOOST",T.QueryLexer.PRESENCE="PRESENCE",T.QueryLexer.lexField=function(e){return e.backup(),e.emit(T.QueryLexer.FIELD),e.ignore(),T.QueryLexer.lexText},T.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(T.QueryLexer.TERM)),e.ignore(),e.more())return T.QueryLexer.lexText},T.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(T.QueryLexer.EDIT_DISTANCE),T.QueryLexer.lexText},T.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(T.QueryLexer.BOOST),T.QueryLexer.lexText},T.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(T.QueryLexer.TERM)},T.QueryLexer.termSeparator=T.tokenizer.separator,T.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==T.QueryLexer.EOS)return T.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return T.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(T.QueryLexer.TERM),T.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(T.QueryLexer.TERM),T.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(T.QueryLexer.PRESENCE),T.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(T.QueryLexer.PRESENCE),T.QueryLexer.lexText;if(t.match(T.QueryLexer.termSeparator))return T.QueryLexer.lexTerm}else e.escapeCharacter()}},T.QueryParser=function(e,t){this.lexer=new T.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},T.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=T.QueryParser.parseClause;e;)e=e(this);return this.query},T.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},T.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},T.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},T.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case T.QueryLexer.PRESENCE:return T.QueryParser.parsePresence;case T.QueryLexer.FIELD:return T.QueryParser.parseField;case T.QueryLexer.TERM:return T.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(r+=" with value '"+t.str+"'"),new T.QueryParseError(r,t.start,t.end)}},T.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=T.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=T.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+t.str+"'";throw new T.QueryParseError(r,t.start,t.end)}var i=e.peekLexeme();if(null==i){r="expecting term or field, found nothing";throw new T.QueryParseError(r,t.start,t.end)}switch(i.type){case T.QueryLexer.FIELD:return T.QueryParser.parseField;case T.QueryLexer.TERM:return T.QueryParser.parseTerm;default:r="expecting term or field, found '"+i.type+"'";throw new T.QueryParseError(r,i.start,i.end)}}},T.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var r=e.query.allFields.map((function(e){return"'"+e+"'"})).join(", "),i="unrecognised field '"+t.str+"', possible fields: "+r;throw new T.QueryParseError(i,t.start,t.end)}e.currentClause.fields=[t.str];var n=e.peekLexeme();if(null==n){i="expecting term, found nothing";throw new T.QueryParseError(i,t.start,t.end)}if(n.type===T.QueryLexer.TERM)return T.QueryParser.parseTerm;i="expecting term, found '"+n.type+"'";throw new T.QueryParseError(i,n.start,n.end)}},T.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(null!=r)switch(r.type){case T.QueryLexer.TERM:return e.nextClause(),T.QueryParser.parseTerm;case T.QueryLexer.FIELD:return e.nextClause(),T.QueryParser.parseField;case T.QueryLexer.EDIT_DISTANCE:return T.QueryParser.parseEditDistance;case T.QueryLexer.BOOST:return T.QueryParser.parseBoost;case T.QueryLexer.PRESENCE:return e.nextClause(),T.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new T.QueryParseError(i,r.start,r.end)}else e.nextClause()}},T.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new T.QueryParseError(i,t.start,t.end)}e.currentClause.editDistance=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case T.QueryLexer.TERM:return e.nextClause(),T.QueryParser.parseTerm;case T.QueryLexer.FIELD:return e.nextClause(),T.QueryParser.parseField;case T.QueryLexer.EDIT_DISTANCE:return T.QueryParser.parseEditDistance;case T.QueryLexer.BOOST:return T.QueryParser.parseBoost;case T.QueryLexer.PRESENCE:return e.nextClause(),T.QueryParser.parsePresence;default:i="Unexpected lexeme type '"+n.type+"'";throw new T.QueryParseError(i,n.start,n.end)}else e.nextClause()}},T.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="boost must be numeric";throw new T.QueryParseError(i,t.start,t.end)}e.currentClause.boost=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case T.QueryLexer.TERM:return e.nextClause(),T.QueryParser.parseTerm;case T.QueryLexer.FIELD:return e.nextClause(),T.QueryParser.parseField;case T.QueryLexer.EDIT_DISTANCE:return T.QueryParser.parseEditDistance;case T.QueryLexer.BOOST:return T.QueryParser.parseBoost;case T.QueryLexer.PRESENCE:return e.nextClause(),T.QueryParser.parsePresence;default:i="Unexpected lexeme type '"+n.type+"'";throw new T.QueryParseError(i,n.start,n.end)}else e.nextClause()}},b=this,P=function(){return T},"function"==typeof define&&define.amd?define(P):"object"==typeof exports?module.exports=P():b.lunr=P()}();