@searchcraft/javascript-sdk 0.13.2 → 0.14.0

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 (66) hide show
  1. package/README.md +5 -0
  2. package/dist/components/defineCustomElements.js +23 -23
  3. package/dist/components/html.js +1 -1
  4. package/dist/components/index.d.ts +191 -0
  5. package/dist/components/index.js +28 -30
  6. package/dist/components/index.js.map +1 -1
  7. package/dist/components/index2.js +12 -1
  8. package/dist/components/index2.js.map +1 -1
  9. package/dist/components/searchcraft-ad.js +1 -1
  10. package/dist/components/searchcraft-ad2.js +4 -4
  11. package/dist/components/searchcraft-button.js +1 -1
  12. package/dist/components/searchcraft-button2.js +2 -2
  13. package/dist/components/searchcraft-error-message.js +1 -1
  14. package/dist/components/searchcraft-error-message2.js +1 -1
  15. package/dist/components/searchcraft-facet-list.js +1 -1
  16. package/dist/components/searchcraft-facet-list2.js +59 -4
  17. package/dist/components/searchcraft-facet-list2.js.map +1 -1
  18. package/dist/components/searchcraft-filter-panel.js +47 -6
  19. package/dist/components/searchcraft-filter-panel.js.map +1 -1
  20. package/dist/components/searchcraft-input-form.js +1 -1
  21. package/dist/components/searchcraft-input-form2.js +6 -6
  22. package/dist/components/searchcraft-input-label.js +1 -1
  23. package/dist/components/searchcraft-input-label2.js +2 -2
  24. package/dist/components/searchcraft-loading.js +1 -1
  25. package/dist/components/searchcraft-loading2.js +5 -2
  26. package/dist/components/searchcraft-loading2.js.map +1 -1
  27. package/dist/components/searchcraft-pagination.js +137 -4
  28. package/dist/components/searchcraft-pagination.js.map +1 -1
  29. package/dist/components/searchcraft-popover-button.js +4 -4
  30. package/dist/components/searchcraft-popover-footer.js +1 -1
  31. package/dist/components/searchcraft-popover-footer2.js +52 -6
  32. package/dist/components/searchcraft-popover-footer2.js.map +1 -1
  33. package/dist/components/searchcraft-popover-form.js +96 -22
  34. package/dist/components/searchcraft-popover-form.js.map +1 -1
  35. package/dist/components/searchcraft-popover-list-item.js +1 -1
  36. package/dist/components/searchcraft-popover-list-item2.js +4 -4
  37. package/dist/components/searchcraft-popover-list-view.js +1 -1
  38. package/dist/components/searchcraft-popover-list-view2.js +4 -4
  39. package/dist/components/searchcraft-results-info.js +4 -4
  40. package/dist/components/searchcraft-search-result.js +1 -1
  41. package/dist/components/searchcraft-search-result2.js +3 -3
  42. package/dist/components/searchcraft-search-results-per-page.js +3 -3
  43. package/dist/components/searchcraft-search-results.js +5 -5
  44. package/dist/components/searchcraft-select.js +1 -1
  45. package/dist/components/searchcraft-select2.js +1 -1
  46. package/dist/components/searchcraft-slider.js +1 -1
  47. package/dist/components/searchcraft-slider2.js +5 -5
  48. package/dist/components/searchcraft-summary-box.js +1 -2256
  49. package/dist/components/searchcraft-summary-box.js.map +1 -1
  50. package/dist/components/searchcraft-summary-box2.js +2261 -0
  51. package/dist/components/searchcraft-summary-box2.js.map +1 -0
  52. package/dist/components/searchcraft-theme.js +3 -3
  53. package/dist/components/searchcraft-theme.js.map +1 -1
  54. package/dist/components/searchcraft-toggle-button.js +1 -1
  55. package/dist/components/searchcraft-toggle-button2.js +5 -5
  56. package/dist/hydrate/index.js +389 -19
  57. package/dist/hydrate/index.mjs +389 -19
  58. package/dist/themes/hologram.css +1 -1
  59. package/dist/themes/hologram.css.map +1 -1
  60. package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +47 -0
  61. package/dist/types/components/searchcraft-pagination/searchcraft-pagination.d.ts +37 -0
  62. package/dist/types/components/searchcraft-popover-footer/searchcraft-popover-footer.d.ts +15 -0
  63. package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +24 -0
  64. package/dist/types/components.d.ts +168 -0
  65. package/dist/types/types/sdk-types/searchcraft-filter-panel.types.d.ts +13 -0
  66. package/package.json +19 -2
@@ -1,2259 +1,4 @@
1
- import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?v=0.13.2';
2
- import { r as registry } from './CoreInstanceRegistry.js?v=0.13.2';
3
- import { p as purify } from './purify.es.js?v=0.13.2';
4
- import { d as defineCustomElement$2 } from './searchcraft-loading2.js?v=0.13.2';
5
-
6
- /**
7
- * marked v15.0.12 - a markdown parser
8
- * Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
9
- * https://github.com/markedjs/marked
10
- */
11
-
12
- /**
13
- * DO NOT EDIT THIS FILE
14
- * The code in this file is generated from files in ./src/
15
- */
16
-
17
-
18
- // src/defaults.ts
19
- function _getDefaults() {
20
- return {
21
- async: false,
22
- breaks: false,
23
- extensions: null,
24
- gfm: true,
25
- hooks: null,
26
- pedantic: false,
27
- renderer: null,
28
- silent: false,
29
- tokenizer: null,
30
- walkTokens: null
31
- };
32
- }
33
- var _defaults = _getDefaults();
34
- function changeDefaults(newDefaults) {
35
- _defaults = newDefaults;
36
- }
37
-
38
- // src/rules.ts
39
- var noopTest = { exec: () => null };
40
- function edit(regex, opt = "") {
41
- let source = typeof regex === "string" ? regex : regex.source;
42
- const obj = {
43
- replace: (name, val) => {
44
- let valSource = typeof val === "string" ? val : val.source;
45
- valSource = valSource.replace(other.caret, "$1");
46
- source = source.replace(name, valSource);
47
- return obj;
48
- },
49
- getRegex: () => {
50
- return new RegExp(source, opt);
51
- }
52
- };
53
- return obj;
54
- }
55
- var other = {
56
- codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
57
- outputLinkReplace: /\\([\[\]])/g,
58
- indentCodeCompensation: /^(\s+)(?:```)/,
59
- beginningSpace: /^\s+/,
60
- endingHash: /#$/,
61
- startingSpaceChar: /^ /,
62
- endingSpaceChar: / $/,
63
- nonSpaceChar: /[^ ]/,
64
- newLineCharGlobal: /\n/g,
65
- tabCharGlobal: /\t/g,
66
- multipleSpaceGlobal: /\s+/g,
67
- blankLine: /^[ \t]*$/,
68
- doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
69
- blockquoteStart: /^ {0,3}>/,
70
- blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
71
- blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
72
- listReplaceTabs: /^\t+/,
73
- listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
74
- listIsTask: /^\[[ xX]\] /,
75
- listReplaceTask: /^\[[ xX]\] +/,
76
- anyLine: /\n.*\n/,
77
- hrefBrackets: /^<(.*)>$/,
78
- tableDelimiter: /[:|]/,
79
- tableAlignChars: /^\||\| *$/g,
80
- tableRowBlankLine: /\n[ \t]*$/,
81
- tableAlignRight: /^ *-+: *$/,
82
- tableAlignCenter: /^ *:-+: *$/,
83
- tableAlignLeft: /^ *:-+ *$/,
84
- startATag: /^<a /i,
85
- endATag: /^<\/a>/i,
86
- startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
87
- endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
88
- startAngleBracket: /^</,
89
- endAngleBracket: />$/,
90
- pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
91
- unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
92
- escapeTest: /[&<>"']/,
93
- escapeReplace: /[&<>"']/g,
94
- escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
95
- escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
96
- unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
97
- caret: /(^|[^\[])\^/g,
98
- percentDecode: /%25/g,
99
- findPipe: /\|/g,
100
- splitPipe: / \|/,
101
- slashPipe: /\\\|/g,
102
- carriageReturn: /\r\n|\r/g,
103
- spaceLine: /^ +$/gm,
104
- notSpaceStart: /^\S*/,
105
- endingNewline: /\n$/,
106
- listItemRegex: (bull) => new RegExp(`^( {0,3}${bull})((?:[ ][^\\n]*)?(?:\\n|$))`),
107
- nextBulletRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
108
- hrRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
109
- fencesBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`),
110
- headingBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`),
111
- htmlBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}<(?:[a-z].*>|!--)`, "i")
112
- };
113
- var newline = /^(?:[ \t]*(?:\n|$))+/;
114
- var blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
115
- var fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
116
- var hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
117
- var heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
118
- var bullet = /(?:[*+-]|\d{1,9}[.)])/;
119
- var lheadingCore = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
120
- var lheading = edit(lheadingCore).replace(/bull/g, bullet).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
121
- var lheadingGfm = edit(lheadingCore).replace(/bull/g, bullet).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
122
- var _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
123
- var blockText = /^[^\n]+/;
124
- var _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
125
- var def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
126
- var list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
127
- var _tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
128
- var _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
129
- var html = edit(
130
- "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))",
131
- "i"
132
- ).replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
133
- var paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
134
- var blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
135
- var blockNormal = {
136
- blockquote,
137
- code: blockCode,
138
- def,
139
- fences,
140
- heading,
141
- hr,
142
- html,
143
- lheading,
144
- list,
145
- newline,
146
- paragraph,
147
- table: noopTest,
148
- text: blockText
149
- };
150
- var gfmTable = edit(
151
- "^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
152
- ).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
153
- var blockGfm = {
154
- ...blockNormal,
155
- lheading: lheadingGfm,
156
- table: gfmTable,
157
- paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex()
158
- };
159
- var blockPedantic = {
160
- ...blockNormal,
161
- html: edit(
162
- `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
163
- ).replace("comment", _comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
164
- def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
165
- heading: /^(#{1,6})(.*)(?:\n+|$)/,
166
- fences: noopTest,
167
- // fences not supported
168
- lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
169
- paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
170
- };
171
- var escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
172
- var inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
173
- var br = /^( {2,}|\\)\n(?!\s*$)/;
174
- var inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
175
- var _punctuation = /[\p{P}\p{S}]/u;
176
- var _punctuationOrSpace = /[\s\p{P}\p{S}]/u;
177
- var _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u;
178
- var punctuation = edit(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, _punctuationOrSpace).getRegex();
179
- var _punctuationGfmStrongEm = /(?!~)[\p{P}\p{S}]/u;
180
- var _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u;
181
- var _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u;
182
- var blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
183
- var emStrongLDelimCore = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
184
- var emStrongLDelim = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuation).getRegex();
185
- var emStrongLDelimGfm = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuationGfmStrongEm).getRegex();
186
- var emStrongRDelimAstCore = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
187
- var emStrongRDelimAst = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex();
188
- var emStrongRDelimAstGfm = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g, _punctuationOrSpaceGfmStrongEm).replace(/punct/g, _punctuationGfmStrongEm).getRegex();
189
- var emStrongRDelimUnd = edit(
190
- "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)",
191
- "gu"
192
- ).replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex();
193
- var anyPunctuation = edit(/\\(punct)/, "gu").replace(/punct/g, _punctuation).getRegex();
194
- var autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
195
- var _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex();
196
- var tag = edit(
197
- "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
198
- ).replace("comment", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
199
- var _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
200
- var link = edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
201
- var reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex();
202
- var nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex();
203
- var reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex();
204
- var inlineNormal = {
205
- _backpedal: noopTest,
206
- // only used for GFM url
207
- anyPunctuation,
208
- autolink,
209
- blockSkip,
210
- br,
211
- code: inlineCode,
212
- del: noopTest,
213
- emStrongLDelim,
214
- emStrongRDelimAst,
215
- emStrongRDelimUnd,
216
- escape,
217
- link,
218
- nolink,
219
- punctuation,
220
- reflink,
221
- reflinkSearch,
222
- tag,
223
- text: inlineText,
224
- url: noopTest
225
- };
226
- var inlinePedantic = {
227
- ...inlineNormal,
228
- link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
229
- reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
230
- };
231
- var inlineGfm = {
232
- ...inlineNormal,
233
- emStrongRDelimAst: emStrongRDelimAstGfm,
234
- emStrongLDelim: emStrongLDelimGfm,
235
- url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
236
- _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
237
- del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
238
- text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
239
- };
240
- var inlineBreaks = {
241
- ...inlineGfm,
242
- br: edit(br).replace("{2,}", "*").getRegex(),
243
- text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
244
- };
245
- var block = {
246
- normal: blockNormal,
247
- gfm: blockGfm,
248
- pedantic: blockPedantic
249
- };
250
- var inline = {
251
- normal: inlineNormal,
252
- gfm: inlineGfm,
253
- breaks: inlineBreaks,
254
- pedantic: inlinePedantic
255
- };
256
-
257
- // src/helpers.ts
258
- var escapeReplacements = {
259
- "&": "&amp;",
260
- "<": "&lt;",
261
- ">": "&gt;",
262
- '"': "&quot;",
263
- "'": "&#39;"
264
- };
265
- var getEscapeReplacement = (ch) => escapeReplacements[ch];
266
- function escape2(html2, encode) {
267
- if (encode) {
268
- if (other.escapeTest.test(html2)) {
269
- return html2.replace(other.escapeReplace, getEscapeReplacement);
270
- }
271
- } else {
272
- if (other.escapeTestNoEncode.test(html2)) {
273
- return html2.replace(other.escapeReplaceNoEncode, getEscapeReplacement);
274
- }
275
- }
276
- return html2;
277
- }
278
- function cleanUrl(href) {
279
- try {
280
- href = encodeURI(href).replace(other.percentDecode, "%");
281
- } catch {
282
- return null;
283
- }
284
- return href;
285
- }
286
- function splitCells(tableRow, count) {
287
- const row = tableRow.replace(other.findPipe, (match, offset, str) => {
288
- let escaped = false;
289
- let curr = offset;
290
- while (--curr >= 0 && str[curr] === "\\") escaped = !escaped;
291
- if (escaped) {
292
- return "|";
293
- } else {
294
- return " |";
295
- }
296
- }), cells = row.split(other.splitPipe);
297
- let i = 0;
298
- if (!cells[0].trim()) {
299
- cells.shift();
300
- }
301
- if (cells.length > 0 && !cells.at(-1)?.trim()) {
302
- cells.pop();
303
- }
304
- if (count) {
305
- if (cells.length > count) {
306
- cells.splice(count);
307
- } else {
308
- while (cells.length < count) cells.push("");
309
- }
310
- }
311
- for (; i < cells.length; i++) {
312
- cells[i] = cells[i].trim().replace(other.slashPipe, "|");
313
- }
314
- return cells;
315
- }
316
- function rtrim(str, c, invert) {
317
- const l = str.length;
318
- if (l === 0) {
319
- return "";
320
- }
321
- let suffLen = 0;
322
- while (suffLen < l) {
323
- const currChar = str.charAt(l - suffLen - 1);
324
- if (currChar === c && true) {
325
- suffLen++;
326
- } else {
327
- break;
328
- }
329
- }
330
- return str.slice(0, l - suffLen);
331
- }
332
- function findClosingBracket(str, b) {
333
- if (str.indexOf(b[1]) === -1) {
334
- return -1;
335
- }
336
- let level = 0;
337
- for (let i = 0; i < str.length; i++) {
338
- if (str[i] === "\\") {
339
- i++;
340
- } else if (str[i] === b[0]) {
341
- level++;
342
- } else if (str[i] === b[1]) {
343
- level--;
344
- if (level < 0) {
345
- return i;
346
- }
347
- }
348
- }
349
- if (level > 0) {
350
- return -2;
351
- }
352
- return -1;
353
- }
354
-
355
- // src/Tokenizer.ts
356
- function outputLink(cap, link2, raw, lexer2, rules) {
357
- const href = link2.href;
358
- const title = link2.title || null;
359
- const text = cap[1].replace(rules.other.outputLinkReplace, "$1");
360
- lexer2.state.inLink = true;
361
- const token = {
362
- type: cap[0].charAt(0) === "!" ? "image" : "link",
363
- raw,
364
- href,
365
- title,
366
- text,
367
- tokens: lexer2.inlineTokens(text)
368
- };
369
- lexer2.state.inLink = false;
370
- return token;
371
- }
372
- function indentCodeCompensation(raw, text, rules) {
373
- const matchIndentToCode = raw.match(rules.other.indentCodeCompensation);
374
- if (matchIndentToCode === null) {
375
- return text;
376
- }
377
- const indentToCode = matchIndentToCode[1];
378
- return text.split("\n").map((node) => {
379
- const matchIndentInNode = node.match(rules.other.beginningSpace);
380
- if (matchIndentInNode === null) {
381
- return node;
382
- }
383
- const [indentInNode] = matchIndentInNode;
384
- if (indentInNode.length >= indentToCode.length) {
385
- return node.slice(indentToCode.length);
386
- }
387
- return node;
388
- }).join("\n");
389
- }
390
- var _Tokenizer = class {
391
- options;
392
- rules;
393
- // set by the lexer
394
- lexer;
395
- // set by the lexer
396
- constructor(options2) {
397
- this.options = options2 || _defaults;
398
- }
399
- space(src) {
400
- const cap = this.rules.block.newline.exec(src);
401
- if (cap && cap[0].length > 0) {
402
- return {
403
- type: "space",
404
- raw: cap[0]
405
- };
406
- }
407
- }
408
- code(src) {
409
- const cap = this.rules.block.code.exec(src);
410
- if (cap) {
411
- const text = cap[0].replace(this.rules.other.codeRemoveIndent, "");
412
- return {
413
- type: "code",
414
- raw: cap[0],
415
- codeBlockStyle: "indented",
416
- text: !this.options.pedantic ? rtrim(text, "\n") : text
417
- };
418
- }
419
- }
420
- fences(src) {
421
- const cap = this.rules.block.fences.exec(src);
422
- if (cap) {
423
- const raw = cap[0];
424
- const text = indentCodeCompensation(raw, cap[3] || "", this.rules);
425
- return {
426
- type: "code",
427
- raw,
428
- lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2],
429
- text
430
- };
431
- }
432
- }
433
- heading(src) {
434
- const cap = this.rules.block.heading.exec(src);
435
- if (cap) {
436
- let text = cap[2].trim();
437
- if (this.rules.other.endingHash.test(text)) {
438
- const trimmed = rtrim(text, "#");
439
- if (this.options.pedantic) {
440
- text = trimmed.trim();
441
- } else if (!trimmed || this.rules.other.endingSpaceChar.test(trimmed)) {
442
- text = trimmed.trim();
443
- }
444
- }
445
- return {
446
- type: "heading",
447
- raw: cap[0],
448
- depth: cap[1].length,
449
- text,
450
- tokens: this.lexer.inline(text)
451
- };
452
- }
453
- }
454
- hr(src) {
455
- const cap = this.rules.block.hr.exec(src);
456
- if (cap) {
457
- return {
458
- type: "hr",
459
- raw: rtrim(cap[0], "\n")
460
- };
461
- }
462
- }
463
- blockquote(src) {
464
- const cap = this.rules.block.blockquote.exec(src);
465
- if (cap) {
466
- let lines = rtrim(cap[0], "\n").split("\n");
467
- let raw = "";
468
- let text = "";
469
- const tokens = [];
470
- while (lines.length > 0) {
471
- let inBlockquote = false;
472
- const currentLines = [];
473
- let i;
474
- for (i = 0; i < lines.length; i++) {
475
- if (this.rules.other.blockquoteStart.test(lines[i])) {
476
- currentLines.push(lines[i]);
477
- inBlockquote = true;
478
- } else if (!inBlockquote) {
479
- currentLines.push(lines[i]);
480
- } else {
481
- break;
482
- }
483
- }
484
- lines = lines.slice(i);
485
- const currentRaw = currentLines.join("\n");
486
- const currentText = currentRaw.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
487
- raw = raw ? `${raw}
488
- ${currentRaw}` : currentRaw;
489
- text = text ? `${text}
490
- ${currentText}` : currentText;
491
- const top = this.lexer.state.top;
492
- this.lexer.state.top = true;
493
- this.lexer.blockTokens(currentText, tokens, true);
494
- this.lexer.state.top = top;
495
- if (lines.length === 0) {
496
- break;
497
- }
498
- const lastToken = tokens.at(-1);
499
- if (lastToken?.type === "code") {
500
- break;
501
- } else if (lastToken?.type === "blockquote") {
502
- const oldToken = lastToken;
503
- const newText = oldToken.raw + "\n" + lines.join("\n");
504
- const newToken = this.blockquote(newText);
505
- tokens[tokens.length - 1] = newToken;
506
- raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
507
- text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
508
- break;
509
- } else if (lastToken?.type === "list") {
510
- const oldToken = lastToken;
511
- const newText = oldToken.raw + "\n" + lines.join("\n");
512
- const newToken = this.list(newText);
513
- tokens[tokens.length - 1] = newToken;
514
- raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
515
- text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
516
- lines = newText.substring(tokens.at(-1).raw.length).split("\n");
517
- continue;
518
- }
519
- }
520
- return {
521
- type: "blockquote",
522
- raw,
523
- tokens,
524
- text
525
- };
526
- }
527
- }
528
- list(src) {
529
- let cap = this.rules.block.list.exec(src);
530
- if (cap) {
531
- let bull = cap[1].trim();
532
- const isordered = bull.length > 1;
533
- const list2 = {
534
- type: "list",
535
- raw: "",
536
- ordered: isordered,
537
- start: isordered ? +bull.slice(0, -1) : "",
538
- loose: false,
539
- items: []
540
- };
541
- bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
542
- if (this.options.pedantic) {
543
- bull = isordered ? bull : "[*+-]";
544
- }
545
- const itemRegex = this.rules.other.listItemRegex(bull);
546
- let endsWithBlankLine = false;
547
- while (src) {
548
- let endEarly = false;
549
- let raw = "";
550
- let itemContents = "";
551
- if (!(cap = itemRegex.exec(src))) {
552
- break;
553
- }
554
- if (this.rules.block.hr.test(src)) {
555
- break;
556
- }
557
- raw = cap[0];
558
- src = src.substring(raw.length);
559
- let line = cap[2].split("\n", 1)[0].replace(this.rules.other.listReplaceTabs, (t) => " ".repeat(3 * t.length));
560
- let nextLine = src.split("\n", 1)[0];
561
- let blankLine = !line.trim();
562
- let indent = 0;
563
- if (this.options.pedantic) {
564
- indent = 2;
565
- itemContents = line.trimStart();
566
- } else if (blankLine) {
567
- indent = cap[1].length + 1;
568
- } else {
569
- indent = cap[2].search(this.rules.other.nonSpaceChar);
570
- indent = indent > 4 ? 1 : indent;
571
- itemContents = line.slice(indent);
572
- indent += cap[1].length;
573
- }
574
- if (blankLine && this.rules.other.blankLine.test(nextLine)) {
575
- raw += nextLine + "\n";
576
- src = src.substring(nextLine.length + 1);
577
- endEarly = true;
578
- }
579
- if (!endEarly) {
580
- const nextBulletRegex = this.rules.other.nextBulletRegex(indent);
581
- const hrRegex = this.rules.other.hrRegex(indent);
582
- const fencesBeginRegex = this.rules.other.fencesBeginRegex(indent);
583
- const headingBeginRegex = this.rules.other.headingBeginRegex(indent);
584
- const htmlBeginRegex = this.rules.other.htmlBeginRegex(indent);
585
- while (src) {
586
- const rawLine = src.split("\n", 1)[0];
587
- let nextLineWithoutTabs;
588
- nextLine = rawLine;
589
- if (this.options.pedantic) {
590
- nextLine = nextLine.replace(this.rules.other.listReplaceNesting, " ");
591
- nextLineWithoutTabs = nextLine;
592
- } else {
593
- nextLineWithoutTabs = nextLine.replace(this.rules.other.tabCharGlobal, " ");
594
- }
595
- if (fencesBeginRegex.test(nextLine)) {
596
- break;
597
- }
598
- if (headingBeginRegex.test(nextLine)) {
599
- break;
600
- }
601
- if (htmlBeginRegex.test(nextLine)) {
602
- break;
603
- }
604
- if (nextBulletRegex.test(nextLine)) {
605
- break;
606
- }
607
- if (hrRegex.test(nextLine)) {
608
- break;
609
- }
610
- if (nextLineWithoutTabs.search(this.rules.other.nonSpaceChar) >= indent || !nextLine.trim()) {
611
- itemContents += "\n" + nextLineWithoutTabs.slice(indent);
612
- } else {
613
- if (blankLine) {
614
- break;
615
- }
616
- if (line.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4) {
617
- break;
618
- }
619
- if (fencesBeginRegex.test(line)) {
620
- break;
621
- }
622
- if (headingBeginRegex.test(line)) {
623
- break;
624
- }
625
- if (hrRegex.test(line)) {
626
- break;
627
- }
628
- itemContents += "\n" + nextLine;
629
- }
630
- if (!blankLine && !nextLine.trim()) {
631
- blankLine = true;
632
- }
633
- raw += rawLine + "\n";
634
- src = src.substring(rawLine.length + 1);
635
- line = nextLineWithoutTabs.slice(indent);
636
- }
637
- }
638
- if (!list2.loose) {
639
- if (endsWithBlankLine) {
640
- list2.loose = true;
641
- } else if (this.rules.other.doubleBlankLine.test(raw)) {
642
- endsWithBlankLine = true;
643
- }
644
- }
645
- let istask = null;
646
- let ischecked;
647
- if (this.options.gfm) {
648
- istask = this.rules.other.listIsTask.exec(itemContents);
649
- if (istask) {
650
- ischecked = istask[0] !== "[ ] ";
651
- itemContents = itemContents.replace(this.rules.other.listReplaceTask, "");
652
- }
653
- }
654
- list2.items.push({
655
- type: "list_item",
656
- raw,
657
- task: !!istask,
658
- checked: ischecked,
659
- loose: false,
660
- text: itemContents,
661
- tokens: []
662
- });
663
- list2.raw += raw;
664
- }
665
- const lastItem = list2.items.at(-1);
666
- if (lastItem) {
667
- lastItem.raw = lastItem.raw.trimEnd();
668
- lastItem.text = lastItem.text.trimEnd();
669
- } else {
670
- return;
671
- }
672
- list2.raw = list2.raw.trimEnd();
673
- for (let i = 0; i < list2.items.length; i++) {
674
- this.lexer.state.top = false;
675
- list2.items[i].tokens = this.lexer.blockTokens(list2.items[i].text, []);
676
- if (!list2.loose) {
677
- const spacers = list2.items[i].tokens.filter((t) => t.type === "space");
678
- const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t) => this.rules.other.anyLine.test(t.raw));
679
- list2.loose = hasMultipleLineBreaks;
680
- }
681
- }
682
- if (list2.loose) {
683
- for (let i = 0; i < list2.items.length; i++) {
684
- list2.items[i].loose = true;
685
- }
686
- }
687
- return list2;
688
- }
689
- }
690
- html(src) {
691
- const cap = this.rules.block.html.exec(src);
692
- if (cap) {
693
- const token = {
694
- type: "html",
695
- block: true,
696
- raw: cap[0],
697
- pre: cap[1] === "pre" || cap[1] === "script" || cap[1] === "style",
698
- text: cap[0]
699
- };
700
- return token;
701
- }
702
- }
703
- def(src) {
704
- const cap = this.rules.block.def.exec(src);
705
- if (cap) {
706
- const tag2 = cap[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " ");
707
- const href = cap[2] ? cap[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "";
708
- const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
709
- return {
710
- type: "def",
711
- tag: tag2,
712
- raw: cap[0],
713
- href,
714
- title
715
- };
716
- }
717
- }
718
- table(src) {
719
- const cap = this.rules.block.table.exec(src);
720
- if (!cap) {
721
- return;
722
- }
723
- if (!this.rules.other.tableDelimiter.test(cap[2])) {
724
- return;
725
- }
726
- const headers = splitCells(cap[1]);
727
- const aligns = cap[2].replace(this.rules.other.tableAlignChars, "").split("|");
728
- const rows = cap[3]?.trim() ? cap[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [];
729
- const item = {
730
- type: "table",
731
- raw: cap[0],
732
- header: [],
733
- align: [],
734
- rows: []
735
- };
736
- if (headers.length !== aligns.length) {
737
- return;
738
- }
739
- for (const align of aligns) {
740
- if (this.rules.other.tableAlignRight.test(align)) {
741
- item.align.push("right");
742
- } else if (this.rules.other.tableAlignCenter.test(align)) {
743
- item.align.push("center");
744
- } else if (this.rules.other.tableAlignLeft.test(align)) {
745
- item.align.push("left");
746
- } else {
747
- item.align.push(null);
748
- }
749
- }
750
- for (let i = 0; i < headers.length; i++) {
751
- item.header.push({
752
- text: headers[i],
753
- tokens: this.lexer.inline(headers[i]),
754
- header: true,
755
- align: item.align[i]
756
- });
757
- }
758
- for (const row of rows) {
759
- item.rows.push(splitCells(row, item.header.length).map((cell, i) => {
760
- return {
761
- text: cell,
762
- tokens: this.lexer.inline(cell),
763
- header: false,
764
- align: item.align[i]
765
- };
766
- }));
767
- }
768
- return item;
769
- }
770
- lheading(src) {
771
- const cap = this.rules.block.lheading.exec(src);
772
- if (cap) {
773
- return {
774
- type: "heading",
775
- raw: cap[0],
776
- depth: cap[2].charAt(0) === "=" ? 1 : 2,
777
- text: cap[1],
778
- tokens: this.lexer.inline(cap[1])
779
- };
780
- }
781
- }
782
- paragraph(src) {
783
- const cap = this.rules.block.paragraph.exec(src);
784
- if (cap) {
785
- const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
786
- return {
787
- type: "paragraph",
788
- raw: cap[0],
789
- text,
790
- tokens: this.lexer.inline(text)
791
- };
792
- }
793
- }
794
- text(src) {
795
- const cap = this.rules.block.text.exec(src);
796
- if (cap) {
797
- return {
798
- type: "text",
799
- raw: cap[0],
800
- text: cap[0],
801
- tokens: this.lexer.inline(cap[0])
802
- };
803
- }
804
- }
805
- escape(src) {
806
- const cap = this.rules.inline.escape.exec(src);
807
- if (cap) {
808
- return {
809
- type: "escape",
810
- raw: cap[0],
811
- text: cap[1]
812
- };
813
- }
814
- }
815
- tag(src) {
816
- const cap = this.rules.inline.tag.exec(src);
817
- if (cap) {
818
- if (!this.lexer.state.inLink && this.rules.other.startATag.test(cap[0])) {
819
- this.lexer.state.inLink = true;
820
- } else if (this.lexer.state.inLink && this.rules.other.endATag.test(cap[0])) {
821
- this.lexer.state.inLink = false;
822
- }
823
- if (!this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(cap[0])) {
824
- this.lexer.state.inRawBlock = true;
825
- } else if (this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(cap[0])) {
826
- this.lexer.state.inRawBlock = false;
827
- }
828
- return {
829
- type: "html",
830
- raw: cap[0],
831
- inLink: this.lexer.state.inLink,
832
- inRawBlock: this.lexer.state.inRawBlock,
833
- block: false,
834
- text: cap[0]
835
- };
836
- }
837
- }
838
- link(src) {
839
- const cap = this.rules.inline.link.exec(src);
840
- if (cap) {
841
- const trimmedUrl = cap[2].trim();
842
- if (!this.options.pedantic && this.rules.other.startAngleBracket.test(trimmedUrl)) {
843
- if (!this.rules.other.endAngleBracket.test(trimmedUrl)) {
844
- return;
845
- }
846
- const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
847
- if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
848
- return;
849
- }
850
- } else {
851
- const lastParenIndex = findClosingBracket(cap[2], "()");
852
- if (lastParenIndex === -2) {
853
- return;
854
- }
855
- if (lastParenIndex > -1) {
856
- const start = cap[0].indexOf("!") === 0 ? 5 : 4;
857
- const linkLen = start + cap[1].length + lastParenIndex;
858
- cap[2] = cap[2].substring(0, lastParenIndex);
859
- cap[0] = cap[0].substring(0, linkLen).trim();
860
- cap[3] = "";
861
- }
862
- }
863
- let href = cap[2];
864
- let title = "";
865
- if (this.options.pedantic) {
866
- const link2 = this.rules.other.pedanticHrefTitle.exec(href);
867
- if (link2) {
868
- href = link2[1];
869
- title = link2[3];
870
- }
871
- } else {
872
- title = cap[3] ? cap[3].slice(1, -1) : "";
873
- }
874
- href = href.trim();
875
- if (this.rules.other.startAngleBracket.test(href)) {
876
- if (this.options.pedantic && !this.rules.other.endAngleBracket.test(trimmedUrl)) {
877
- href = href.slice(1);
878
- } else {
879
- href = href.slice(1, -1);
880
- }
881
- }
882
- return outputLink(cap, {
883
- href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
884
- title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
885
- }, cap[0], this.lexer, this.rules);
886
- }
887
- }
888
- reflink(src, links) {
889
- let cap;
890
- if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
891
- const linkString = (cap[2] || cap[1]).replace(this.rules.other.multipleSpaceGlobal, " ");
892
- const link2 = links[linkString.toLowerCase()];
893
- if (!link2) {
894
- const text = cap[0].charAt(0);
895
- return {
896
- type: "text",
897
- raw: text,
898
- text
899
- };
900
- }
901
- return outputLink(cap, link2, cap[0], this.lexer, this.rules);
902
- }
903
- }
904
- emStrong(src, maskedSrc, prevChar = "") {
905
- let match = this.rules.inline.emStrongLDelim.exec(src);
906
- if (!match) return;
907
- if (match[3] && prevChar.match(this.rules.other.unicodeAlphaNumeric)) return;
908
- const nextChar = match[1] || match[2] || "";
909
- if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
910
- const lLength = [...match[0]].length - 1;
911
- let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
912
- const endReg = match[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
913
- endReg.lastIndex = 0;
914
- maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
915
- while ((match = endReg.exec(maskedSrc)) != null) {
916
- rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
917
- if (!rDelim) continue;
918
- rLength = [...rDelim].length;
919
- if (match[3] || match[4]) {
920
- delimTotal += rLength;
921
- continue;
922
- } else if (match[5] || match[6]) {
923
- if (lLength % 3 && !((lLength + rLength) % 3)) {
924
- midDelimTotal += rLength;
925
- continue;
926
- }
927
- }
928
- delimTotal -= rLength;
929
- if (delimTotal > 0) continue;
930
- rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
931
- const lastCharLength = [...match[0]][0].length;
932
- const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
933
- if (Math.min(lLength, rLength) % 2) {
934
- const text2 = raw.slice(1, -1);
935
- return {
936
- type: "em",
937
- raw,
938
- text: text2,
939
- tokens: this.lexer.inlineTokens(text2)
940
- };
941
- }
942
- const text = raw.slice(2, -2);
943
- return {
944
- type: "strong",
945
- raw,
946
- text,
947
- tokens: this.lexer.inlineTokens(text)
948
- };
949
- }
950
- }
951
- }
952
- codespan(src) {
953
- const cap = this.rules.inline.code.exec(src);
954
- if (cap) {
955
- let text = cap[2].replace(this.rules.other.newLineCharGlobal, " ");
956
- const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text);
957
- const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
958
- if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
959
- text = text.substring(1, text.length - 1);
960
- }
961
- return {
962
- type: "codespan",
963
- raw: cap[0],
964
- text
965
- };
966
- }
967
- }
968
- br(src) {
969
- const cap = this.rules.inline.br.exec(src);
970
- if (cap) {
971
- return {
972
- type: "br",
973
- raw: cap[0]
974
- };
975
- }
976
- }
977
- del(src) {
978
- const cap = this.rules.inline.del.exec(src);
979
- if (cap) {
980
- return {
981
- type: "del",
982
- raw: cap[0],
983
- text: cap[2],
984
- tokens: this.lexer.inlineTokens(cap[2])
985
- };
986
- }
987
- }
988
- autolink(src) {
989
- const cap = this.rules.inline.autolink.exec(src);
990
- if (cap) {
991
- let text, href;
992
- if (cap[2] === "@") {
993
- text = cap[1];
994
- href = "mailto:" + text;
995
- } else {
996
- text = cap[1];
997
- href = text;
998
- }
999
- return {
1000
- type: "link",
1001
- raw: cap[0],
1002
- text,
1003
- href,
1004
- tokens: [
1005
- {
1006
- type: "text",
1007
- raw: text,
1008
- text
1009
- }
1010
- ]
1011
- };
1012
- }
1013
- }
1014
- url(src) {
1015
- let cap;
1016
- if (cap = this.rules.inline.url.exec(src)) {
1017
- let text, href;
1018
- if (cap[2] === "@") {
1019
- text = cap[0];
1020
- href = "mailto:" + text;
1021
- } else {
1022
- let prevCapZero;
1023
- do {
1024
- prevCapZero = cap[0];
1025
- cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? "";
1026
- } while (prevCapZero !== cap[0]);
1027
- text = cap[0];
1028
- if (cap[1] === "www.") {
1029
- href = "http://" + cap[0];
1030
- } else {
1031
- href = cap[0];
1032
- }
1033
- }
1034
- return {
1035
- type: "link",
1036
- raw: cap[0],
1037
- text,
1038
- href,
1039
- tokens: [
1040
- {
1041
- type: "text",
1042
- raw: text,
1043
- text
1044
- }
1045
- ]
1046
- };
1047
- }
1048
- }
1049
- inlineText(src) {
1050
- const cap = this.rules.inline.text.exec(src);
1051
- if (cap) {
1052
- const escaped = this.lexer.state.inRawBlock;
1053
- return {
1054
- type: "text",
1055
- raw: cap[0],
1056
- text: cap[0],
1057
- escaped
1058
- };
1059
- }
1060
- }
1061
- };
1062
-
1063
- // src/Lexer.ts
1064
- var _Lexer = class __Lexer {
1065
- tokens;
1066
- options;
1067
- state;
1068
- tokenizer;
1069
- inlineQueue;
1070
- constructor(options2) {
1071
- this.tokens = [];
1072
- this.tokens.links = /* @__PURE__ */ Object.create(null);
1073
- this.options = options2 || _defaults;
1074
- this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
1075
- this.tokenizer = this.options.tokenizer;
1076
- this.tokenizer.options = this.options;
1077
- this.tokenizer.lexer = this;
1078
- this.inlineQueue = [];
1079
- this.state = {
1080
- inLink: false,
1081
- inRawBlock: false,
1082
- top: true
1083
- };
1084
- const rules = {
1085
- other,
1086
- block: block.normal,
1087
- inline: inline.normal
1088
- };
1089
- if (this.options.pedantic) {
1090
- rules.block = block.pedantic;
1091
- rules.inline = inline.pedantic;
1092
- } else if (this.options.gfm) {
1093
- rules.block = block.gfm;
1094
- if (this.options.breaks) {
1095
- rules.inline = inline.breaks;
1096
- } else {
1097
- rules.inline = inline.gfm;
1098
- }
1099
- }
1100
- this.tokenizer.rules = rules;
1101
- }
1102
- /**
1103
- * Expose Rules
1104
- */
1105
- static get rules() {
1106
- return {
1107
- block,
1108
- inline
1109
- };
1110
- }
1111
- /**
1112
- * Static Lex Method
1113
- */
1114
- static lex(src, options2) {
1115
- const lexer2 = new __Lexer(options2);
1116
- return lexer2.lex(src);
1117
- }
1118
- /**
1119
- * Static Lex Inline Method
1120
- */
1121
- static lexInline(src, options2) {
1122
- const lexer2 = new __Lexer(options2);
1123
- return lexer2.inlineTokens(src);
1124
- }
1125
- /**
1126
- * Preprocessing
1127
- */
1128
- lex(src) {
1129
- src = src.replace(other.carriageReturn, "\n");
1130
- this.blockTokens(src, this.tokens);
1131
- for (let i = 0; i < this.inlineQueue.length; i++) {
1132
- const next = this.inlineQueue[i];
1133
- this.inlineTokens(next.src, next.tokens);
1134
- }
1135
- this.inlineQueue = [];
1136
- return this.tokens;
1137
- }
1138
- blockTokens(src, tokens = [], lastParagraphClipped = false) {
1139
- if (this.options.pedantic) {
1140
- src = src.replace(other.tabCharGlobal, " ").replace(other.spaceLine, "");
1141
- }
1142
- while (src) {
1143
- let token;
1144
- if (this.options.extensions?.block?.some((extTokenizer) => {
1145
- if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
1146
- src = src.substring(token.raw.length);
1147
- tokens.push(token);
1148
- return true;
1149
- }
1150
- return false;
1151
- })) {
1152
- continue;
1153
- }
1154
- if (token = this.tokenizer.space(src)) {
1155
- src = src.substring(token.raw.length);
1156
- const lastToken = tokens.at(-1);
1157
- if (token.raw.length === 1 && lastToken !== void 0) {
1158
- lastToken.raw += "\n";
1159
- } else {
1160
- tokens.push(token);
1161
- }
1162
- continue;
1163
- }
1164
- if (token = this.tokenizer.code(src)) {
1165
- src = src.substring(token.raw.length);
1166
- const lastToken = tokens.at(-1);
1167
- if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
1168
- lastToken.raw += "\n" + token.raw;
1169
- lastToken.text += "\n" + token.text;
1170
- this.inlineQueue.at(-1).src = lastToken.text;
1171
- } else {
1172
- tokens.push(token);
1173
- }
1174
- continue;
1175
- }
1176
- if (token = this.tokenizer.fences(src)) {
1177
- src = src.substring(token.raw.length);
1178
- tokens.push(token);
1179
- continue;
1180
- }
1181
- if (token = this.tokenizer.heading(src)) {
1182
- src = src.substring(token.raw.length);
1183
- tokens.push(token);
1184
- continue;
1185
- }
1186
- if (token = this.tokenizer.hr(src)) {
1187
- src = src.substring(token.raw.length);
1188
- tokens.push(token);
1189
- continue;
1190
- }
1191
- if (token = this.tokenizer.blockquote(src)) {
1192
- src = src.substring(token.raw.length);
1193
- tokens.push(token);
1194
- continue;
1195
- }
1196
- if (token = this.tokenizer.list(src)) {
1197
- src = src.substring(token.raw.length);
1198
- tokens.push(token);
1199
- continue;
1200
- }
1201
- if (token = this.tokenizer.html(src)) {
1202
- src = src.substring(token.raw.length);
1203
- tokens.push(token);
1204
- continue;
1205
- }
1206
- if (token = this.tokenizer.def(src)) {
1207
- src = src.substring(token.raw.length);
1208
- const lastToken = tokens.at(-1);
1209
- if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
1210
- lastToken.raw += "\n" + token.raw;
1211
- lastToken.text += "\n" + token.raw;
1212
- this.inlineQueue.at(-1).src = lastToken.text;
1213
- } else if (!this.tokens.links[token.tag]) {
1214
- this.tokens.links[token.tag] = {
1215
- href: token.href,
1216
- title: token.title
1217
- };
1218
- }
1219
- continue;
1220
- }
1221
- if (token = this.tokenizer.table(src)) {
1222
- src = src.substring(token.raw.length);
1223
- tokens.push(token);
1224
- continue;
1225
- }
1226
- if (token = this.tokenizer.lheading(src)) {
1227
- src = src.substring(token.raw.length);
1228
- tokens.push(token);
1229
- continue;
1230
- }
1231
- let cutSrc = src;
1232
- if (this.options.extensions?.startBlock) {
1233
- let startIndex = Infinity;
1234
- const tempSrc = src.slice(1);
1235
- let tempStart;
1236
- this.options.extensions.startBlock.forEach((getStartIndex) => {
1237
- tempStart = getStartIndex.call({ lexer: this }, tempSrc);
1238
- if (typeof tempStart === "number" && tempStart >= 0) {
1239
- startIndex = Math.min(startIndex, tempStart);
1240
- }
1241
- });
1242
- if (startIndex < Infinity && startIndex >= 0) {
1243
- cutSrc = src.substring(0, startIndex + 1);
1244
- }
1245
- }
1246
- if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
1247
- const lastToken = tokens.at(-1);
1248
- if (lastParagraphClipped && lastToken?.type === "paragraph") {
1249
- lastToken.raw += "\n" + token.raw;
1250
- lastToken.text += "\n" + token.text;
1251
- this.inlineQueue.pop();
1252
- this.inlineQueue.at(-1).src = lastToken.text;
1253
- } else {
1254
- tokens.push(token);
1255
- }
1256
- lastParagraphClipped = cutSrc.length !== src.length;
1257
- src = src.substring(token.raw.length);
1258
- continue;
1259
- }
1260
- if (token = this.tokenizer.text(src)) {
1261
- src = src.substring(token.raw.length);
1262
- const lastToken = tokens.at(-1);
1263
- if (lastToken?.type === "text") {
1264
- lastToken.raw += "\n" + token.raw;
1265
- lastToken.text += "\n" + token.text;
1266
- this.inlineQueue.pop();
1267
- this.inlineQueue.at(-1).src = lastToken.text;
1268
- } else {
1269
- tokens.push(token);
1270
- }
1271
- continue;
1272
- }
1273
- if (src) {
1274
- const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
1275
- if (this.options.silent) {
1276
- console.error(errMsg);
1277
- break;
1278
- } else {
1279
- throw new Error(errMsg);
1280
- }
1281
- }
1282
- }
1283
- this.state.top = true;
1284
- return tokens;
1285
- }
1286
- inline(src, tokens = []) {
1287
- this.inlineQueue.push({ src, tokens });
1288
- return tokens;
1289
- }
1290
- /**
1291
- * Lexing/Compiling
1292
- */
1293
- inlineTokens(src, tokens = []) {
1294
- let maskedSrc = src;
1295
- let match = null;
1296
- if (this.tokens.links) {
1297
- const links = Object.keys(this.tokens.links);
1298
- if (links.length > 0) {
1299
- while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
1300
- if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
1301
- maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
1302
- }
1303
- }
1304
- }
1305
- }
1306
- while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
1307
- maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1308
- }
1309
- while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
1310
- maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1311
- }
1312
- let keepPrevChar = false;
1313
- let prevChar = "";
1314
- while (src) {
1315
- if (!keepPrevChar) {
1316
- prevChar = "";
1317
- }
1318
- keepPrevChar = false;
1319
- let token;
1320
- if (this.options.extensions?.inline?.some((extTokenizer) => {
1321
- if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
1322
- src = src.substring(token.raw.length);
1323
- tokens.push(token);
1324
- return true;
1325
- }
1326
- return false;
1327
- })) {
1328
- continue;
1329
- }
1330
- if (token = this.tokenizer.escape(src)) {
1331
- src = src.substring(token.raw.length);
1332
- tokens.push(token);
1333
- continue;
1334
- }
1335
- if (token = this.tokenizer.tag(src)) {
1336
- src = src.substring(token.raw.length);
1337
- tokens.push(token);
1338
- continue;
1339
- }
1340
- if (token = this.tokenizer.link(src)) {
1341
- src = src.substring(token.raw.length);
1342
- tokens.push(token);
1343
- continue;
1344
- }
1345
- if (token = this.tokenizer.reflink(src, this.tokens.links)) {
1346
- src = src.substring(token.raw.length);
1347
- const lastToken = tokens.at(-1);
1348
- if (token.type === "text" && lastToken?.type === "text") {
1349
- lastToken.raw += token.raw;
1350
- lastToken.text += token.text;
1351
- } else {
1352
- tokens.push(token);
1353
- }
1354
- continue;
1355
- }
1356
- if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
1357
- src = src.substring(token.raw.length);
1358
- tokens.push(token);
1359
- continue;
1360
- }
1361
- if (token = this.tokenizer.codespan(src)) {
1362
- src = src.substring(token.raw.length);
1363
- tokens.push(token);
1364
- continue;
1365
- }
1366
- if (token = this.tokenizer.br(src)) {
1367
- src = src.substring(token.raw.length);
1368
- tokens.push(token);
1369
- continue;
1370
- }
1371
- if (token = this.tokenizer.del(src)) {
1372
- src = src.substring(token.raw.length);
1373
- tokens.push(token);
1374
- continue;
1375
- }
1376
- if (token = this.tokenizer.autolink(src)) {
1377
- src = src.substring(token.raw.length);
1378
- tokens.push(token);
1379
- continue;
1380
- }
1381
- if (!this.state.inLink && (token = this.tokenizer.url(src))) {
1382
- src = src.substring(token.raw.length);
1383
- tokens.push(token);
1384
- continue;
1385
- }
1386
- let cutSrc = src;
1387
- if (this.options.extensions?.startInline) {
1388
- let startIndex = Infinity;
1389
- const tempSrc = src.slice(1);
1390
- let tempStart;
1391
- this.options.extensions.startInline.forEach((getStartIndex) => {
1392
- tempStart = getStartIndex.call({ lexer: this }, tempSrc);
1393
- if (typeof tempStart === "number" && tempStart >= 0) {
1394
- startIndex = Math.min(startIndex, tempStart);
1395
- }
1396
- });
1397
- if (startIndex < Infinity && startIndex >= 0) {
1398
- cutSrc = src.substring(0, startIndex + 1);
1399
- }
1400
- }
1401
- if (token = this.tokenizer.inlineText(cutSrc)) {
1402
- src = src.substring(token.raw.length);
1403
- if (token.raw.slice(-1) !== "_") {
1404
- prevChar = token.raw.slice(-1);
1405
- }
1406
- keepPrevChar = true;
1407
- const lastToken = tokens.at(-1);
1408
- if (lastToken?.type === "text") {
1409
- lastToken.raw += token.raw;
1410
- lastToken.text += token.text;
1411
- } else {
1412
- tokens.push(token);
1413
- }
1414
- continue;
1415
- }
1416
- if (src) {
1417
- const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
1418
- if (this.options.silent) {
1419
- console.error(errMsg);
1420
- break;
1421
- } else {
1422
- throw new Error(errMsg);
1423
- }
1424
- }
1425
- }
1426
- return tokens;
1427
- }
1428
- };
1429
-
1430
- // src/Renderer.ts
1431
- var _Renderer = class {
1432
- options;
1433
- parser;
1434
- // set by the parser
1435
- constructor(options2) {
1436
- this.options = options2 || _defaults;
1437
- }
1438
- space(token) {
1439
- return "";
1440
- }
1441
- code({ text, lang, escaped }) {
1442
- const langString = (lang || "").match(other.notSpaceStart)?.[0];
1443
- const code = text.replace(other.endingNewline, "") + "\n";
1444
- if (!langString) {
1445
- return "<pre><code>" + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
1446
- }
1447
- return '<pre><code class="language-' + escape2(langString) + '">' + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
1448
- }
1449
- blockquote({ tokens }) {
1450
- const body = this.parser.parse(tokens);
1451
- return `<blockquote>
1452
- ${body}</blockquote>
1453
- `;
1454
- }
1455
- html({ text }) {
1456
- return text;
1457
- }
1458
- heading({ tokens, depth }) {
1459
- return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>
1460
- `;
1461
- }
1462
- hr(token) {
1463
- return "<hr>\n";
1464
- }
1465
- list(token) {
1466
- const ordered = token.ordered;
1467
- const start = token.start;
1468
- let body = "";
1469
- for (let j = 0; j < token.items.length; j++) {
1470
- const item = token.items[j];
1471
- body += this.listitem(item);
1472
- }
1473
- const type = ordered ? "ol" : "ul";
1474
- const startAttr = ordered && start !== 1 ? ' start="' + start + '"' : "";
1475
- return "<" + type + startAttr + ">\n" + body + "</" + type + ">\n";
1476
- }
1477
- listitem(item) {
1478
- let itemBody = "";
1479
- if (item.task) {
1480
- const checkbox = this.checkbox({ checked: !!item.checked });
1481
- if (item.loose) {
1482
- if (item.tokens[0]?.type === "paragraph") {
1483
- item.tokens[0].text = checkbox + " " + item.tokens[0].text;
1484
- if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
1485
- item.tokens[0].tokens[0].text = checkbox + " " + escape2(item.tokens[0].tokens[0].text);
1486
- item.tokens[0].tokens[0].escaped = true;
1487
- }
1488
- } else {
1489
- item.tokens.unshift({
1490
- type: "text",
1491
- raw: checkbox + " ",
1492
- text: checkbox + " ",
1493
- escaped: true
1494
- });
1495
- }
1496
- } else {
1497
- itemBody += checkbox + " ";
1498
- }
1499
- }
1500
- itemBody += this.parser.parse(item.tokens, !!item.loose);
1501
- return `<li>${itemBody}</li>
1502
- `;
1503
- }
1504
- checkbox({ checked }) {
1505
- return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
1506
- }
1507
- paragraph({ tokens }) {
1508
- return `<p>${this.parser.parseInline(tokens)}</p>
1509
- `;
1510
- }
1511
- table(token) {
1512
- let header = "";
1513
- let cell = "";
1514
- for (let j = 0; j < token.header.length; j++) {
1515
- cell += this.tablecell(token.header[j]);
1516
- }
1517
- header += this.tablerow({ text: cell });
1518
- let body = "";
1519
- for (let j = 0; j < token.rows.length; j++) {
1520
- const row = token.rows[j];
1521
- cell = "";
1522
- for (let k = 0; k < row.length; k++) {
1523
- cell += this.tablecell(row[k]);
1524
- }
1525
- body += this.tablerow({ text: cell });
1526
- }
1527
- if (body) body = `<tbody>${body}</tbody>`;
1528
- return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
1529
- }
1530
- tablerow({ text }) {
1531
- return `<tr>
1532
- ${text}</tr>
1533
- `;
1534
- }
1535
- tablecell(token) {
1536
- const content = this.parser.parseInline(token.tokens);
1537
- const type = token.header ? "th" : "td";
1538
- const tag2 = token.align ? `<${type} align="${token.align}">` : `<${type}>`;
1539
- return tag2 + content + `</${type}>
1540
- `;
1541
- }
1542
- /**
1543
- * span level renderer
1544
- */
1545
- strong({ tokens }) {
1546
- return `<strong>${this.parser.parseInline(tokens)}</strong>`;
1547
- }
1548
- em({ tokens }) {
1549
- return `<em>${this.parser.parseInline(tokens)}</em>`;
1550
- }
1551
- codespan({ text }) {
1552
- return `<code>${escape2(text, true)}</code>`;
1553
- }
1554
- br(token) {
1555
- return "<br>";
1556
- }
1557
- del({ tokens }) {
1558
- return `<del>${this.parser.parseInline(tokens)}</del>`;
1559
- }
1560
- link({ href, title, tokens }) {
1561
- const text = this.parser.parseInline(tokens);
1562
- const cleanHref = cleanUrl(href);
1563
- if (cleanHref === null) {
1564
- return text;
1565
- }
1566
- href = cleanHref;
1567
- let out = '<a href="' + href + '"';
1568
- if (title) {
1569
- out += ' title="' + escape2(title) + '"';
1570
- }
1571
- out += ">" + text + "</a>";
1572
- return out;
1573
- }
1574
- image({ href, title, text, tokens }) {
1575
- if (tokens) {
1576
- text = this.parser.parseInline(tokens, this.parser.textRenderer);
1577
- }
1578
- const cleanHref = cleanUrl(href);
1579
- if (cleanHref === null) {
1580
- return escape2(text);
1581
- }
1582
- href = cleanHref;
1583
- let out = `<img src="${href}" alt="${text}"`;
1584
- if (title) {
1585
- out += ` title="${escape2(title)}"`;
1586
- }
1587
- out += ">";
1588
- return out;
1589
- }
1590
- text(token) {
1591
- return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : "escaped" in token && token.escaped ? token.text : escape2(token.text);
1592
- }
1593
- };
1594
-
1595
- // src/TextRenderer.ts
1596
- var _TextRenderer = class {
1597
- // no need for block level renderers
1598
- strong({ text }) {
1599
- return text;
1600
- }
1601
- em({ text }) {
1602
- return text;
1603
- }
1604
- codespan({ text }) {
1605
- return text;
1606
- }
1607
- del({ text }) {
1608
- return text;
1609
- }
1610
- html({ text }) {
1611
- return text;
1612
- }
1613
- text({ text }) {
1614
- return text;
1615
- }
1616
- link({ text }) {
1617
- return "" + text;
1618
- }
1619
- image({ text }) {
1620
- return "" + text;
1621
- }
1622
- br() {
1623
- return "";
1624
- }
1625
- };
1626
-
1627
- // src/Parser.ts
1628
- var _Parser = class __Parser {
1629
- options;
1630
- renderer;
1631
- textRenderer;
1632
- constructor(options2) {
1633
- this.options = options2 || _defaults;
1634
- this.options.renderer = this.options.renderer || new _Renderer();
1635
- this.renderer = this.options.renderer;
1636
- this.renderer.options = this.options;
1637
- this.renderer.parser = this;
1638
- this.textRenderer = new _TextRenderer();
1639
- }
1640
- /**
1641
- * Static Parse Method
1642
- */
1643
- static parse(tokens, options2) {
1644
- const parser2 = new __Parser(options2);
1645
- return parser2.parse(tokens);
1646
- }
1647
- /**
1648
- * Static Parse Inline Method
1649
- */
1650
- static parseInline(tokens, options2) {
1651
- const parser2 = new __Parser(options2);
1652
- return parser2.parseInline(tokens);
1653
- }
1654
- /**
1655
- * Parse Loop
1656
- */
1657
- parse(tokens, top = true) {
1658
- let out = "";
1659
- for (let i = 0; i < tokens.length; i++) {
1660
- const anyToken = tokens[i];
1661
- if (this.options.extensions?.renderers?.[anyToken.type]) {
1662
- const genericToken = anyToken;
1663
- const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
1664
- if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
1665
- out += ret || "";
1666
- continue;
1667
- }
1668
- }
1669
- const token = anyToken;
1670
- switch (token.type) {
1671
- case "space": {
1672
- out += this.renderer.space(token);
1673
- continue;
1674
- }
1675
- case "hr": {
1676
- out += this.renderer.hr(token);
1677
- continue;
1678
- }
1679
- case "heading": {
1680
- out += this.renderer.heading(token);
1681
- continue;
1682
- }
1683
- case "code": {
1684
- out += this.renderer.code(token);
1685
- continue;
1686
- }
1687
- case "table": {
1688
- out += this.renderer.table(token);
1689
- continue;
1690
- }
1691
- case "blockquote": {
1692
- out += this.renderer.blockquote(token);
1693
- continue;
1694
- }
1695
- case "list": {
1696
- out += this.renderer.list(token);
1697
- continue;
1698
- }
1699
- case "html": {
1700
- out += this.renderer.html(token);
1701
- continue;
1702
- }
1703
- case "paragraph": {
1704
- out += this.renderer.paragraph(token);
1705
- continue;
1706
- }
1707
- case "text": {
1708
- let textToken = token;
1709
- let body = this.renderer.text(textToken);
1710
- while (i + 1 < tokens.length && tokens[i + 1].type === "text") {
1711
- textToken = tokens[++i];
1712
- body += "\n" + this.renderer.text(textToken);
1713
- }
1714
- if (top) {
1715
- out += this.renderer.paragraph({
1716
- type: "paragraph",
1717
- raw: body,
1718
- text: body,
1719
- tokens: [{ type: "text", raw: body, text: body, escaped: true }]
1720
- });
1721
- } else {
1722
- out += body;
1723
- }
1724
- continue;
1725
- }
1726
- default: {
1727
- const errMsg = 'Token with "' + token.type + '" type was not found.';
1728
- if (this.options.silent) {
1729
- console.error(errMsg);
1730
- return "";
1731
- } else {
1732
- throw new Error(errMsg);
1733
- }
1734
- }
1735
- }
1736
- }
1737
- return out;
1738
- }
1739
- /**
1740
- * Parse Inline Tokens
1741
- */
1742
- parseInline(tokens, renderer = this.renderer) {
1743
- let out = "";
1744
- for (let i = 0; i < tokens.length; i++) {
1745
- const anyToken = tokens[i];
1746
- if (this.options.extensions?.renderers?.[anyToken.type]) {
1747
- const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
1748
- if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
1749
- out += ret || "";
1750
- continue;
1751
- }
1752
- }
1753
- const token = anyToken;
1754
- switch (token.type) {
1755
- case "escape": {
1756
- out += renderer.text(token);
1757
- break;
1758
- }
1759
- case "html": {
1760
- out += renderer.html(token);
1761
- break;
1762
- }
1763
- case "link": {
1764
- out += renderer.link(token);
1765
- break;
1766
- }
1767
- case "image": {
1768
- out += renderer.image(token);
1769
- break;
1770
- }
1771
- case "strong": {
1772
- out += renderer.strong(token);
1773
- break;
1774
- }
1775
- case "em": {
1776
- out += renderer.em(token);
1777
- break;
1778
- }
1779
- case "codespan": {
1780
- out += renderer.codespan(token);
1781
- break;
1782
- }
1783
- case "br": {
1784
- out += renderer.br(token);
1785
- break;
1786
- }
1787
- case "del": {
1788
- out += renderer.del(token);
1789
- break;
1790
- }
1791
- case "text": {
1792
- out += renderer.text(token);
1793
- break;
1794
- }
1795
- default: {
1796
- const errMsg = 'Token with "' + token.type + '" type was not found.';
1797
- if (this.options.silent) {
1798
- console.error(errMsg);
1799
- return "";
1800
- } else {
1801
- throw new Error(errMsg);
1802
- }
1803
- }
1804
- }
1805
- }
1806
- return out;
1807
- }
1808
- };
1809
-
1810
- // src/Hooks.ts
1811
- var _Hooks = class {
1812
- options;
1813
- block;
1814
- constructor(options2) {
1815
- this.options = options2 || _defaults;
1816
- }
1817
- static passThroughHooks = /* @__PURE__ */ new Set([
1818
- "preprocess",
1819
- "postprocess",
1820
- "processAllTokens"
1821
- ]);
1822
- /**
1823
- * Process markdown before marked
1824
- */
1825
- preprocess(markdown) {
1826
- return markdown;
1827
- }
1828
- /**
1829
- * Process HTML after marked is finished
1830
- */
1831
- postprocess(html2) {
1832
- return html2;
1833
- }
1834
- /**
1835
- * Process all tokens before walk tokens
1836
- */
1837
- processAllTokens(tokens) {
1838
- return tokens;
1839
- }
1840
- /**
1841
- * Provide function to tokenize markdown
1842
- */
1843
- provideLexer() {
1844
- return this.block ? _Lexer.lex : _Lexer.lexInline;
1845
- }
1846
- /**
1847
- * Provide function to parse tokens
1848
- */
1849
- provideParser() {
1850
- return this.block ? _Parser.parse : _Parser.parseInline;
1851
- }
1852
- };
1853
-
1854
- // src/Instance.ts
1855
- var Marked = class {
1856
- defaults = _getDefaults();
1857
- options = this.setOptions;
1858
- parse = this.parseMarkdown(true);
1859
- parseInline = this.parseMarkdown(false);
1860
- Parser = _Parser;
1861
- Renderer = _Renderer;
1862
- TextRenderer = _TextRenderer;
1863
- Lexer = _Lexer;
1864
- Tokenizer = _Tokenizer;
1865
- Hooks = _Hooks;
1866
- constructor(...args) {
1867
- this.use(...args);
1868
- }
1869
- /**
1870
- * Run callback for every token
1871
- */
1872
- walkTokens(tokens, callback) {
1873
- let values = [];
1874
- for (const token of tokens) {
1875
- values = values.concat(callback.call(this, token));
1876
- switch (token.type) {
1877
- case "table": {
1878
- const tableToken = token;
1879
- for (const cell of tableToken.header) {
1880
- values = values.concat(this.walkTokens(cell.tokens, callback));
1881
- }
1882
- for (const row of tableToken.rows) {
1883
- for (const cell of row) {
1884
- values = values.concat(this.walkTokens(cell.tokens, callback));
1885
- }
1886
- }
1887
- break;
1888
- }
1889
- case "list": {
1890
- const listToken = token;
1891
- values = values.concat(this.walkTokens(listToken.items, callback));
1892
- break;
1893
- }
1894
- default: {
1895
- const genericToken = token;
1896
- if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
1897
- this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
1898
- const tokens2 = genericToken[childTokens].flat(Infinity);
1899
- values = values.concat(this.walkTokens(tokens2, callback));
1900
- });
1901
- } else if (genericToken.tokens) {
1902
- values = values.concat(this.walkTokens(genericToken.tokens, callback));
1903
- }
1904
- }
1905
- }
1906
- }
1907
- return values;
1908
- }
1909
- use(...args) {
1910
- const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
1911
- args.forEach((pack) => {
1912
- const opts = { ...pack };
1913
- opts.async = this.defaults.async || opts.async || false;
1914
- if (pack.extensions) {
1915
- pack.extensions.forEach((ext) => {
1916
- if (!ext.name) {
1917
- throw new Error("extension name required");
1918
- }
1919
- if ("renderer" in ext) {
1920
- const prevRenderer = extensions.renderers[ext.name];
1921
- if (prevRenderer) {
1922
- extensions.renderers[ext.name] = function(...args2) {
1923
- let ret = ext.renderer.apply(this, args2);
1924
- if (ret === false) {
1925
- ret = prevRenderer.apply(this, args2);
1926
- }
1927
- return ret;
1928
- };
1929
- } else {
1930
- extensions.renderers[ext.name] = ext.renderer;
1931
- }
1932
- }
1933
- if ("tokenizer" in ext) {
1934
- if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
1935
- throw new Error("extension level must be 'block' or 'inline'");
1936
- }
1937
- const extLevel = extensions[ext.level];
1938
- if (extLevel) {
1939
- extLevel.unshift(ext.tokenizer);
1940
- } else {
1941
- extensions[ext.level] = [ext.tokenizer];
1942
- }
1943
- if (ext.start) {
1944
- if (ext.level === "block") {
1945
- if (extensions.startBlock) {
1946
- extensions.startBlock.push(ext.start);
1947
- } else {
1948
- extensions.startBlock = [ext.start];
1949
- }
1950
- } else if (ext.level === "inline") {
1951
- if (extensions.startInline) {
1952
- extensions.startInline.push(ext.start);
1953
- } else {
1954
- extensions.startInline = [ext.start];
1955
- }
1956
- }
1957
- }
1958
- }
1959
- if ("childTokens" in ext && ext.childTokens) {
1960
- extensions.childTokens[ext.name] = ext.childTokens;
1961
- }
1962
- });
1963
- opts.extensions = extensions;
1964
- }
1965
- if (pack.renderer) {
1966
- const renderer = this.defaults.renderer || new _Renderer(this.defaults);
1967
- for (const prop in pack.renderer) {
1968
- if (!(prop in renderer)) {
1969
- throw new Error(`renderer '${prop}' does not exist`);
1970
- }
1971
- if (["options", "parser"].includes(prop)) {
1972
- continue;
1973
- }
1974
- const rendererProp = prop;
1975
- const rendererFunc = pack.renderer[rendererProp];
1976
- const prevRenderer = renderer[rendererProp];
1977
- renderer[rendererProp] = (...args2) => {
1978
- let ret = rendererFunc.apply(renderer, args2);
1979
- if (ret === false) {
1980
- ret = prevRenderer.apply(renderer, args2);
1981
- }
1982
- return ret || "";
1983
- };
1984
- }
1985
- opts.renderer = renderer;
1986
- }
1987
- if (pack.tokenizer) {
1988
- const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
1989
- for (const prop in pack.tokenizer) {
1990
- if (!(prop in tokenizer)) {
1991
- throw new Error(`tokenizer '${prop}' does not exist`);
1992
- }
1993
- if (["options", "rules", "lexer"].includes(prop)) {
1994
- continue;
1995
- }
1996
- const tokenizerProp = prop;
1997
- const tokenizerFunc = pack.tokenizer[tokenizerProp];
1998
- const prevTokenizer = tokenizer[tokenizerProp];
1999
- tokenizer[tokenizerProp] = (...args2) => {
2000
- let ret = tokenizerFunc.apply(tokenizer, args2);
2001
- if (ret === false) {
2002
- ret = prevTokenizer.apply(tokenizer, args2);
2003
- }
2004
- return ret;
2005
- };
2006
- }
2007
- opts.tokenizer = tokenizer;
2008
- }
2009
- if (pack.hooks) {
2010
- const hooks = this.defaults.hooks || new _Hooks();
2011
- for (const prop in pack.hooks) {
2012
- if (!(prop in hooks)) {
2013
- throw new Error(`hook '${prop}' does not exist`);
2014
- }
2015
- if (["options", "block"].includes(prop)) {
2016
- continue;
2017
- }
2018
- const hooksProp = prop;
2019
- const hooksFunc = pack.hooks[hooksProp];
2020
- const prevHook = hooks[hooksProp];
2021
- if (_Hooks.passThroughHooks.has(prop)) {
2022
- hooks[hooksProp] = (arg) => {
2023
- if (this.defaults.async) {
2024
- return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
2025
- return prevHook.call(hooks, ret2);
2026
- });
2027
- }
2028
- const ret = hooksFunc.call(hooks, arg);
2029
- return prevHook.call(hooks, ret);
2030
- };
2031
- } else {
2032
- hooks[hooksProp] = (...args2) => {
2033
- let ret = hooksFunc.apply(hooks, args2);
2034
- if (ret === false) {
2035
- ret = prevHook.apply(hooks, args2);
2036
- }
2037
- return ret;
2038
- };
2039
- }
2040
- }
2041
- opts.hooks = hooks;
2042
- }
2043
- if (pack.walkTokens) {
2044
- const walkTokens2 = this.defaults.walkTokens;
2045
- const packWalktokens = pack.walkTokens;
2046
- opts.walkTokens = function(token) {
2047
- let values = [];
2048
- values.push(packWalktokens.call(this, token));
2049
- if (walkTokens2) {
2050
- values = values.concat(walkTokens2.call(this, token));
2051
- }
2052
- return values;
2053
- };
2054
- }
2055
- this.defaults = { ...this.defaults, ...opts };
2056
- });
2057
- return this;
2058
- }
2059
- setOptions(opt) {
2060
- this.defaults = { ...this.defaults, ...opt };
2061
- return this;
2062
- }
2063
- lexer(src, options2) {
2064
- return _Lexer.lex(src, options2 ?? this.defaults);
2065
- }
2066
- parser(tokens, options2) {
2067
- return _Parser.parse(tokens, options2 ?? this.defaults);
2068
- }
2069
- parseMarkdown(blockType) {
2070
- const parse2 = (src, options2) => {
2071
- const origOpt = { ...options2 };
2072
- const opt = { ...this.defaults, ...origOpt };
2073
- const throwError = this.onError(!!opt.silent, !!opt.async);
2074
- if (this.defaults.async === true && origOpt.async === false) {
2075
- return throwError(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
2076
- }
2077
- if (typeof src === "undefined" || src === null) {
2078
- return throwError(new Error("marked(): input parameter is undefined or null"));
2079
- }
2080
- if (typeof src !== "string") {
2081
- return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
2082
- }
2083
- if (opt.hooks) {
2084
- opt.hooks.options = opt;
2085
- opt.hooks.block = blockType;
2086
- }
2087
- const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
2088
- const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
2089
- if (opt.async) {
2090
- return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
2091
- }
2092
- try {
2093
- if (opt.hooks) {
2094
- src = opt.hooks.preprocess(src);
2095
- }
2096
- let tokens = lexer2(src, opt);
2097
- if (opt.hooks) {
2098
- tokens = opt.hooks.processAllTokens(tokens);
2099
- }
2100
- if (opt.walkTokens) {
2101
- this.walkTokens(tokens, opt.walkTokens);
2102
- }
2103
- let html2 = parser2(tokens, opt);
2104
- if (opt.hooks) {
2105
- html2 = opt.hooks.postprocess(html2);
2106
- }
2107
- return html2;
2108
- } catch (e) {
2109
- return throwError(e);
2110
- }
2111
- };
2112
- return parse2;
2113
- }
2114
- onError(silent, async) {
2115
- return (e) => {
2116
- e.message += "\nPlease report this to https://github.com/markedjs/marked.";
2117
- if (silent) {
2118
- const msg = "<p>An error occurred:</p><pre>" + escape2(e.message + "", true) + "</pre>";
2119
- if (async) {
2120
- return Promise.resolve(msg);
2121
- }
2122
- return msg;
2123
- }
2124
- if (async) {
2125
- return Promise.reject(e);
2126
- }
2127
- throw e;
2128
- };
2129
- }
2130
- };
2131
-
2132
- // src/marked.ts
2133
- var markedInstance = new Marked();
2134
- function marked(src, opt) {
2135
- return markedInstance.parse(src, opt);
2136
- }
2137
- marked.options = marked.setOptions = function(options2) {
2138
- markedInstance.setOptions(options2);
2139
- marked.defaults = markedInstance.defaults;
2140
- changeDefaults(marked.defaults);
2141
- return marked;
2142
- };
2143
- marked.getDefaults = _getDefaults;
2144
- marked.defaults = _defaults;
2145
- marked.use = function(...args) {
2146
- markedInstance.use(...args);
2147
- marked.defaults = markedInstance.defaults;
2148
- changeDefaults(marked.defaults);
2149
- return marked;
2150
- };
2151
- marked.walkTokens = function(tokens, callback) {
2152
- return markedInstance.walkTokens(tokens, callback);
2153
- };
2154
- marked.parseInline = markedInstance.parseInline;
2155
- marked.Parser = _Parser;
2156
- marked.parser = _Parser.parse;
2157
- marked.Renderer = _Renderer;
2158
- marked.TextRenderer = _TextRenderer;
2159
- marked.Lexer = _Lexer;
2160
- marked.lexer = _Lexer.lex;
2161
- marked.Tokenizer = _Tokenizer;
2162
- marked.Hooks = _Hooks;
2163
- marked.parse = marked;
2164
-
2165
- const SearchcraftSummaryBox$1 = /*@__PURE__*/ proxyCustomElement(class SearchcraftSummaryBox extends H {
2166
- constructor(registerHost) {
2167
- super();
2168
- if (registerHost !== false) {
2169
- this.__registerHost();
2170
- }
2171
- }
2172
- /**
2173
- * The id of the Searchcraft instance that this component should use.
2174
- */
2175
- searchcraftId;
2176
- summary = '';
2177
- isLoading = false;
2178
- isSummaryNotEnabled = false;
2179
- get hostElement() { return this; }
2180
- unsubscribe;
2181
- cleanupCore;
2182
- onCoreAvailable(core) {
2183
- core.store.setState({ hasSummaryBox: true });
2184
- this.unsubscribe = core.store.subscribe(this.handleStateChange.bind(this));
2185
- }
2186
- connectedCallback() {
2187
- this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
2188
- }
2189
- disconnectedCallback() {
2190
- this.unsubscribe?.();
2191
- this.cleanupCore?.();
2192
- }
2193
- /**
2194
- * Handles state changes from the store and updates component state.
2195
- */
2196
- handleStateChange(state) {
2197
- this.isLoading = state.isSummaryLoading;
2198
- this.isSummaryNotEnabled = state.isSummaryNotEnabled;
2199
- this.summary = this.sanitizeMarkdown(state.summary);
2200
- // Update DOM directly for performance (avoids re-render)
2201
- this.updateContentElement(state.summary);
2202
- }
2203
- /**
2204
- * Sanitizes and converts markdown to HTML.
2205
- */
2206
- sanitizeMarkdown(markdown) {
2207
- return purify.sanitize(marked.parse(markdown));
2208
- }
2209
- /**
2210
- * Updates the content element directly without triggering a re-render.
2211
- */
2212
- updateContentElement(markdown) {
2213
- const contentElement = this.hostElement?.querySelector('.searchcraft-summary-box-content');
2214
- if (contentElement) {
2215
- contentElement.innerHTML = this.sanitizeMarkdown(markdown);
2216
- }
2217
- }
2218
- /**
2219
- * Renders the appropriate content based on current state.
2220
- */
2221
- renderContent() {
2222
- if (this.isLoading) {
2223
- return h("searchcraft-loading", { label: 'LOADING' });
2224
- }
2225
- if (this.isSummaryNotEnabled) {
2226
- return (h("div", { class: 'searchcraft-summary-box-content' }, "AI summaries are not enabled"));
2227
- }
2228
- return h("div", { class: 'searchcraft-summary-box-content' }, this.summary);
2229
- }
2230
- render() {
2231
- return h("div", { key: '94033d861f93036430eca149b3c017fb6099fb17', class: 'searchcraft-summary-box' }, this.renderContent());
2232
- }
2233
- }, [768, "searchcraft-summary-box", {
2234
- "searchcraftId": [1, "searchcraft-id"],
2235
- "summary": [32],
2236
- "isLoading": [32],
2237
- "isSummaryNotEnabled": [32]
2238
- }]);
2239
- function defineCustomElement$1() {
2240
- if (typeof customElements === "undefined") {
2241
- return;
2242
- }
2243
- const components = ["searchcraft-summary-box", "searchcraft-loading"];
2244
- components.forEach(tagName => { switch (tagName) {
2245
- case "searchcraft-summary-box":
2246
- if (!customElements.get(transformTag(tagName))) {
2247
- customElements.define(transformTag(tagName), SearchcraftSummaryBox$1);
2248
- }
2249
- break;
2250
- case "searchcraft-loading":
2251
- if (!customElements.get(transformTag(tagName))) {
2252
- defineCustomElement$2();
2253
- }
2254
- break;
2255
- } });
2256
- }
1
+ import { S as SearchcraftSummaryBox$1, d as defineCustomElement$1 } from './searchcraft-summary-box2.js?scv=0.14.0';
2257
2
 
2258
3
  const SearchcraftSummaryBox = SearchcraftSummaryBox$1;
2259
4
  const defineCustomElement = defineCustomElement$1;