@searchcraft/javascript-sdk 0.13.3 → 0.15.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.
- package/dist/components/defineCustomElements.js +25 -23
- package/dist/components/html.js +1 -1
- package/dist/components/index.d.ts +213 -5
- package/dist/components/index.js +245 -64
- package/dist/components/index.js.map +1 -1
- package/dist/components/marked.esm.js +2163 -0
- package/dist/components/marked.esm.js.map +1 -0
- package/dist/components/searchcraft-ad.js +1 -1
- package/dist/components/searchcraft-ad2.js +4 -4
- package/dist/components/searchcraft-button.js +1 -1
- package/dist/components/searchcraft-button2.js +2 -2
- package/dist/components/searchcraft-error-message.js +1 -1
- package/dist/components/searchcraft-error-message2.js +1 -1
- package/dist/components/searchcraft-facet-list.js +1 -1
- package/dist/components/searchcraft-facet-list2.js +2 -2
- package/dist/components/searchcraft-facet-list2.js.map +1 -1
- package/dist/components/searchcraft-filter-panel.js +18 -9
- package/dist/components/searchcraft-filter-panel.js.map +1 -1
- package/dist/components/searchcraft-input-form.js +1 -1
- package/dist/components/searchcraft-input-form2.js +6 -6
- package/dist/components/searchcraft-input-label.js +1 -1
- package/dist/components/searchcraft-input-label2.js +2 -2
- package/dist/components/searchcraft-loading.js +1 -1
- package/dist/components/searchcraft-loading2.js +5 -2
- package/dist/components/searchcraft-loading2.js.map +1 -1
- package/dist/components/searchcraft-pagination.js +96 -8
- package/dist/components/searchcraft-pagination.js.map +1 -1
- package/dist/components/searchcraft-popover-button.js +6 -4
- package/dist/components/searchcraft-popover-button.js.map +1 -1
- package/dist/components/searchcraft-popover-footer.js +1 -1
- package/dist/components/searchcraft-popover-footer2.js +51 -7
- package/dist/components/searchcraft-popover-footer2.js.map +1 -1
- package/dist/components/searchcraft-popover-form.js +96 -22
- package/dist/components/searchcraft-popover-form.js.map +1 -1
- package/dist/components/searchcraft-popover-list-item.js +1 -1
- package/dist/components/searchcraft-popover-list-item2.js +3 -3
- package/dist/components/searchcraft-popover-list-view.js +1 -1
- package/dist/components/searchcraft-popover-list-view2.js +4 -4
- package/dist/components/searchcraft-results-info.js +4 -4
- package/dist/components/searchcraft-results-summary.d.ts +11 -0
- package/dist/components/searchcraft-results-summary.js +9 -0
- package/dist/components/searchcraft-results-summary.js.map +1 -0
- package/dist/components/searchcraft-results-summary2.js +97 -0
- package/dist/components/searchcraft-results-summary2.js.map +1 -0
- package/dist/components/searchcraft-search-result.js +1 -1
- package/dist/components/searchcraft-search-result2.js +3 -3
- package/dist/components/searchcraft-search-results-per-page.js +3 -3
- package/dist/components/searchcraft-search-results.js +5 -5
- package/dist/components/searchcraft-select.js +1 -1
- package/dist/components/searchcraft-select2.js +1 -1
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/components/searchcraft-slider2.js +5 -5
- package/dist/components/searchcraft-summary-box.js +11 -2178
- package/dist/components/searchcraft-summary-box.js.map +1 -1
- package/dist/components/searchcraft-theme.js +3 -3
- package/dist/components/searchcraft-theme.js.map +1 -1
- package/dist/components/searchcraft-toggle-button.js +1 -1
- package/dist/components/searchcraft-toggle-button2.js +5 -5
- package/dist/hydrate/index.js +2294 -1985
- package/dist/hydrate/index.mjs +2294 -1985
- package/dist/themes/hologram.css +1 -1
- package/dist/themes/hologram.css.map +1 -1
- package/dist/types/clients/SummaryClient.d.ts +10 -1
- package/dist/types/components/searchcraft-pagination/searchcraft-pagination.d.ts +28 -0
- package/dist/types/components/searchcraft-popover-button/searchcraft-popover-button.d.ts +1 -1
- package/dist/types/components/searchcraft-popover-footer/searchcraft-popover-footer.d.ts +15 -0
- package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +24 -0
- package/dist/types/components/searchcraft-results-summary/searchcraft-results-summary.d.ts +65 -0
- package/dist/types/components/searchcraft-summary-box/searchcraft-summary-box.d.ts +5 -5
- package/dist/types/components.d.ts +191 -2
- package/dist/types/store/SearchcraftStore.types.d.ts +1 -0
- package/dist/types/types/core-types/SearchcraftConfig.types.d.ts +2 -2
- package/package.json +19 -2
package/dist/hydrate/index.mjs
CHANGED
|
@@ -5548,7 +5548,9 @@ class SearchcraftFilterPanel {
|
|
|
5548
5548
|
}
|
|
5549
5549
|
};
|
|
5550
5550
|
const handleToggle = async () => {
|
|
5551
|
-
if (facetListElement &&
|
|
5551
|
+
if (facetListElement &&
|
|
5552
|
+
'handleCollapseToggle' in facetListElement &&
|
|
5553
|
+
'getIsCollapsed' in facetListElement) {
|
|
5552
5554
|
await facetListElement.handleCollapseToggle();
|
|
5553
5555
|
const isCollapsed = await facetListElement.getIsCollapsed();
|
|
5554
5556
|
updateLabelAttributes(isCollapsed);
|
|
@@ -5557,12 +5559,19 @@ class SearchcraftFilterPanel {
|
|
|
5557
5559
|
// return "filters-list"
|
|
5558
5560
|
return (hAsync("div", { class: 'searchcraft-filter-panel-section' }, hAsync("p", { ref: (el) => {
|
|
5559
5561
|
labelElement = el || null;
|
|
5560
|
-
}, class: 'searchcraft-filter-panel-label', "data-toggle-facet-section": true, "data-facet-section-expanded": item.options.initialCollapseState !== 'closed'
|
|
5562
|
+
}, "aria-expanded": item.options.initialCollapseState !== 'closed', class: 'searchcraft-filter-panel-label', "data-toggle-facet-section": true, "data-facet-section-expanded": item.options.initialCollapseState !== 'closed'
|
|
5563
|
+
? ''
|
|
5564
|
+
: undefined, "data-facet-section-collapsed": item.options.initialCollapseState === 'closed'
|
|
5565
|
+
? ''
|
|
5566
|
+
: undefined, onClick: () => void handleToggle(), onKeyDown: (event) => {
|
|
5561
5567
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
5562
5568
|
event.preventDefault();
|
|
5563
|
-
|
|
5569
|
+
void handleToggle();
|
|
5564
5570
|
}
|
|
5565
|
-
},
|
|
5571
|
+
},
|
|
5572
|
+
/* biome-ignore lint/a11y/useSemanticElements: This label is intentionally a <p> for styling/layout; it behaves like a button. */
|
|
5573
|
+
/* biome-ignore lint/a11y/noNoninteractiveElementToInteractiveRole: This <p> is intentionally used as an interactive control. */
|
|
5574
|
+
role: 'button', tabIndex: 0 }, filterItem.label), hAsync("searchcraft-facet-list", { ref: (el) => {
|
|
5566
5575
|
facetListElement = el || null;
|
|
5567
5576
|
}, fieldName: item.fieldName, exclude: item.options.exclude, initialCollapseState: item.options.initialCollapseState, viewMoreThreshold: item.options.viewMoreThreshold, onFacetSelectionUpdated: (event) => {
|
|
5568
5577
|
this.handleFacetSelectionUpdated(item.fieldName, event.detail.paths);
|
|
@@ -5851,7 +5860,10 @@ class SearchcraftInputLabel {
|
|
|
5851
5860
|
}
|
|
5852
5861
|
label;
|
|
5853
5862
|
render() {
|
|
5854
|
-
|
|
5863
|
+
const accessibleLabel = this.label ?? 'Loading';
|
|
5864
|
+
return (hAsync("div", { key: 'd749250c5f56c703da7f1cba4a226a202ae269c0', class: 'searchcraft-loading',
|
|
5865
|
+
// biome-ignore lint/a11y/useSemanticElements: <output> is semantically incorrect for a loading indicator
|
|
5866
|
+
role: 'status', "aria-live": 'polite', "aria-label": accessibleLabel }, hAsync("div", { key: '0f834793686bcf8dff56769ad65311c1f591e8dd', class: 'searchcraft-loading-dots', "aria-hidden": 'true' }, hAsync("div", { key: '2174c333eecf0630ce984b2dece74675356259d9', class: 'searchcraft-loading-dot-1' }), hAsync("div", { key: '927fee69cd86dbd9ae57776c2a15fa6956707fac', class: 'searchcraft-loading-dot-2' }), hAsync("div", { key: 'cfd37c9a9a12dfc9963aa53c3979fb59dc7a132c', class: 'searchcraft-loading-dot-3' })), this.label ? (hAsync("p", { class: 'searchcraft-loading-label' }, this.label)) : null));
|
|
5855
5867
|
}
|
|
5856
5868
|
static get cmpMeta() { return {
|
|
5857
5869
|
"$flags$": 768,
|
|
@@ -5906,6 +5918,19 @@ class SearchcraftPagination {
|
|
|
5906
5918
|
* @default true
|
|
5907
5919
|
*/
|
|
5908
5920
|
scrollToTop = true;
|
|
5921
|
+
/**
|
|
5922
|
+
* The URL query string parameter name used to track the current page. When a user navigates
|
|
5923
|
+
* to a URL that contains this parameter, the pagination component will automatically navigate
|
|
5924
|
+
* to that page.
|
|
5925
|
+
* @default "p"
|
|
5926
|
+
*/
|
|
5927
|
+
pageQueryParam = 'p';
|
|
5928
|
+
/**
|
|
5929
|
+
* Whether to use a query string parameter to track and restore the current page.
|
|
5930
|
+
* Set to `false` to disable query string synchronisation entirely.
|
|
5931
|
+
* @default true
|
|
5932
|
+
*/
|
|
5933
|
+
usePageQueryParam = true;
|
|
5909
5934
|
// store vars
|
|
5910
5935
|
searchTerm;
|
|
5911
5936
|
searchResultsPerPage;
|
|
@@ -5920,6 +5945,7 @@ class SearchcraftPagination {
|
|
|
5920
5945
|
setSearchResultsPage = () => { };
|
|
5921
5946
|
unsubscribe = () => { };
|
|
5922
5947
|
cleanupCore;
|
|
5948
|
+
_initialPageApplied = false;
|
|
5923
5949
|
onCoreAvailable(core) {
|
|
5924
5950
|
this.unsubscribe = core.store.subscribe((state) => {
|
|
5925
5951
|
// store vars
|
|
@@ -5937,6 +5963,14 @@ class SearchcraftPagination {
|
|
|
5937
5963
|
this.searchResultsPerPage;
|
|
5938
5964
|
// store functions
|
|
5939
5965
|
this.setSearchResultsPage = state.setSearchResultsPage;
|
|
5966
|
+
// Apply initial page from URL query param (only once, on first subscription tick)
|
|
5967
|
+
if (!this._initialPageApplied) {
|
|
5968
|
+
this._initialPageApplied = true;
|
|
5969
|
+
const initialPage = this.getPageFromUrl();
|
|
5970
|
+
if (initialPage !== null && initialPage !== state.searchResultsPage) {
|
|
5971
|
+
state.setSearchResultsPage(initialPage);
|
|
5972
|
+
}
|
|
5973
|
+
}
|
|
5940
5974
|
});
|
|
5941
5975
|
}
|
|
5942
5976
|
connectedCallback() {
|
|
@@ -5949,6 +5983,7 @@ class SearchcraftPagination {
|
|
|
5949
5983
|
/**
|
|
5950
5984
|
* Smooth scroll to the top of the search results component
|
|
5951
5985
|
*/
|
|
5986
|
+
scrollAnimationId;
|
|
5952
5987
|
smoothScrollToSearchResults() {
|
|
5953
5988
|
if (!this.scrollToTop) {
|
|
5954
5989
|
return;
|
|
@@ -5957,14 +5992,17 @@ class SearchcraftPagination {
|
|
|
5957
5992
|
if (!searchResultsElement) {
|
|
5958
5993
|
return;
|
|
5959
5994
|
}
|
|
5995
|
+
// Cancel any in-flight scroll animation
|
|
5996
|
+
if (this.scrollAnimationId) {
|
|
5997
|
+
cancelAnimationFrame(this.scrollAnimationId);
|
|
5998
|
+
}
|
|
5960
5999
|
const elementRect = searchResultsElement.getBoundingClientRect();
|
|
5961
|
-
const scrollOffset = 200;
|
|
6000
|
+
const scrollOffset = 200;
|
|
5962
6001
|
const targetPosition = elementRect.top + window.scrollY - scrollOffset;
|
|
5963
6002
|
const startPosition = window.scrollY;
|
|
5964
6003
|
const distance = targetPosition - startPosition;
|
|
5965
6004
|
const duration = 1500;
|
|
5966
6005
|
let startTime = null;
|
|
5967
|
-
// smooth scrolling
|
|
5968
6006
|
const easeOutExpo = (t) => {
|
|
5969
6007
|
return t === 1 ? 1 : 1 - 2 ** (-10 * t);
|
|
5970
6008
|
};
|
|
@@ -5977,13 +6015,73 @@ class SearchcraftPagination {
|
|
|
5977
6015
|
const ease = easeOutExpo(progress);
|
|
5978
6016
|
window.scrollTo(0, startPosition + distance * ease);
|
|
5979
6017
|
if (progress < 1) {
|
|
5980
|
-
requestAnimationFrame(animation);
|
|
6018
|
+
this.scrollAnimationId = requestAnimationFrame(animation);
|
|
6019
|
+
}
|
|
6020
|
+
else {
|
|
6021
|
+
this.scrollAnimationId = undefined;
|
|
5981
6022
|
}
|
|
5982
6023
|
};
|
|
5983
|
-
requestAnimationFrame(animation);
|
|
6024
|
+
this.scrollAnimationId = requestAnimationFrame(animation);
|
|
6025
|
+
}
|
|
6026
|
+
/**
|
|
6027
|
+
* Returns the page number from the URL query string, or null if not present / disabled.
|
|
6028
|
+
* Reads from the top-level window when inside a same-origin iframe so that the
|
|
6029
|
+
* address-bar URL is the source of truth (consistent with updateUrlPage).
|
|
6030
|
+
*/
|
|
6031
|
+
getPageFromUrl() {
|
|
6032
|
+
if (!this.usePageQueryParam || typeof window === 'undefined') {
|
|
6033
|
+
return null;
|
|
6034
|
+
}
|
|
6035
|
+
let targetWindow = window;
|
|
6036
|
+
try {
|
|
6037
|
+
if (window.top && window.top !== window && window.top.location.href) {
|
|
6038
|
+
targetWindow = window.top;
|
|
6039
|
+
}
|
|
6040
|
+
}
|
|
6041
|
+
catch {
|
|
6042
|
+
// Cross-origin iframe — stay with the current window
|
|
6043
|
+
}
|
|
6044
|
+
const params = new URLSearchParams(targetWindow.location.search);
|
|
6045
|
+
const raw = params.get(this.pageQueryParam);
|
|
6046
|
+
if (raw === null) {
|
|
6047
|
+
return null;
|
|
6048
|
+
}
|
|
6049
|
+
const page = Number.parseInt(raw, 10);
|
|
6050
|
+
return Number.isNaN(page) || page < 1 ? null : page;
|
|
6051
|
+
}
|
|
6052
|
+
/**
|
|
6053
|
+
* Updates (or removes) the page query string parameter in the browser URL without
|
|
6054
|
+
* triggering a navigation/reload.
|
|
6055
|
+
* When running inside a same-origin iframe (e.g. Storybook), the top-level window's
|
|
6056
|
+
* URL is updated so the change is visible in the address bar.
|
|
6057
|
+
*/
|
|
6058
|
+
updateUrlPage(page) {
|
|
6059
|
+
if (!this.usePageQueryParam || typeof window === 'undefined') {
|
|
6060
|
+
return;
|
|
6061
|
+
}
|
|
6062
|
+
// Prefer the top-level window so the address bar updates even inside iframes
|
|
6063
|
+
// (e.g. Storybook). Falls back to the current window for cross-origin iframes.
|
|
6064
|
+
let targetWindow = window;
|
|
6065
|
+
try {
|
|
6066
|
+
if (window.top && window.top !== window && window.top.location.href) {
|
|
6067
|
+
targetWindow = window.top;
|
|
6068
|
+
}
|
|
6069
|
+
}
|
|
6070
|
+
catch {
|
|
6071
|
+
// Cross-origin iframe — stay with the current window
|
|
6072
|
+
}
|
|
6073
|
+
const url = new URL(targetWindow.location.href);
|
|
6074
|
+
if (page <= 1) {
|
|
6075
|
+
url.searchParams.delete(this.pageQueryParam);
|
|
6076
|
+
}
|
|
6077
|
+
else {
|
|
6078
|
+
url.searchParams.set(this.pageQueryParam, String(page));
|
|
6079
|
+
}
|
|
6080
|
+
targetWindow.history.replaceState(targetWindow.history.state, '', url.toString());
|
|
5984
6081
|
}
|
|
5985
6082
|
handleGoToPage(page) {
|
|
5986
6083
|
this.setSearchResultsPage(page);
|
|
6084
|
+
this.updateUrlPage(page);
|
|
5987
6085
|
if (this.scrollToTop) {
|
|
5988
6086
|
this.smoothScrollToSearchResults();
|
|
5989
6087
|
}
|
|
@@ -6046,6 +6144,8 @@ class SearchcraftPagination {
|
|
|
6046
6144
|
"$members$": {
|
|
6047
6145
|
"searchcraftId": [1, "searchcraft-id"],
|
|
6048
6146
|
"scrollToTop": [4, "scroll-to-top"],
|
|
6147
|
+
"pageQueryParam": [1, "page-query-param"],
|
|
6148
|
+
"usePageQueryParam": [4, "use-page-query-param"],
|
|
6049
6149
|
"searchTerm": [32],
|
|
6050
6150
|
"searchResultsPerPage": [32],
|
|
6051
6151
|
"searchResultsPage": [32],
|
|
@@ -6207,12 +6307,14 @@ class SearchcraftPopoverButton {
|
|
|
6207
6307
|
switch (this.type) {
|
|
6208
6308
|
case 'skeuomorphic':
|
|
6209
6309
|
return this.renderSkeuomorphicSlot();
|
|
6310
|
+
case 'magnifying-glass':
|
|
6311
|
+
return (hAsync("div", { class: 'searchcraft-popover-button-input' }, hAsync("svg", { class: 'searchcraft-popover-button-input-search-icon', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', version: '1.1', "aria-hidden": 'true' }, hAsync("path", { d: 'M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))));
|
|
6210
6312
|
default:
|
|
6211
6313
|
return (hAsync("div", null, hAsync("slot", null)));
|
|
6212
6314
|
}
|
|
6213
6315
|
}
|
|
6214
6316
|
render() {
|
|
6215
|
-
return (hAsync("button", { key: '
|
|
6317
|
+
return (hAsync("button", { key: '760f4f8d8daddaaadc0367e21b9efe23c4ef7c7d', "aria-label": this.type === 'magnifying-glass' ? 'Search' : undefined, class: `searchcraft-popover-button ${this.type ? ` searchcraft-popover-button-${this.type}` : ''}`, innerHTML: typeof this.template !== 'undefined'
|
|
6216
6318
|
? this.template({ isPopoverVisible: this.isPopoverVisible }, { html: html$1 })
|
|
6217
6319
|
: undefined, onClick: this.handleOnClick.bind(this), type: 'button' }, typeof this.template !== 'undefined'
|
|
6218
6320
|
? undefined
|
|
@@ -6239,6 +6341,8 @@ class SearchcraftPopoverButton {
|
|
|
6239
6341
|
}; }
|
|
6240
6342
|
}
|
|
6241
6343
|
|
|
6344
|
+
const version = "0.15.0";
|
|
6345
|
+
|
|
6242
6346
|
/**
|
|
6243
6347
|
* Renders the footer for the searchcraft-popover-form.
|
|
6244
6348
|
*
|
|
@@ -6252,6 +6356,20 @@ class SearchcraftPopoverFooter {
|
|
|
6252
6356
|
* The id of the Searchcraft instance that this component should use.
|
|
6253
6357
|
*/
|
|
6254
6358
|
searchcraftId;
|
|
6359
|
+
/**
|
|
6360
|
+
* The SDK variant used to render this component. Used for UTM attribution. This isn't exposed for developer consumption, it's set automatically.
|
|
6361
|
+
*
|
|
6362
|
+
* @internal
|
|
6363
|
+
*/
|
|
6364
|
+
sdkVariant = 'js';
|
|
6365
|
+
/**
|
|
6366
|
+
* Optional href for the "View all" button.
|
|
6367
|
+
*/
|
|
6368
|
+
viewAllResultsHref;
|
|
6369
|
+
/**
|
|
6370
|
+
* Optional label for the "View all" button.
|
|
6371
|
+
*/
|
|
6372
|
+
viewAllResultsLabel;
|
|
6255
6373
|
searchResultsCount;
|
|
6256
6374
|
unsubscribe = () => { };
|
|
6257
6375
|
cleanupCore;
|
|
@@ -6268,16 +6386,43 @@ class SearchcraftPopoverFooter {
|
|
|
6268
6386
|
this.unsubscribe?.();
|
|
6269
6387
|
this.cleanupCore?.();
|
|
6270
6388
|
}
|
|
6389
|
+
get safeViewAllHref() {
|
|
6390
|
+
const href = this.viewAllResultsHref;
|
|
6391
|
+
if (!href)
|
|
6392
|
+
return undefined;
|
|
6393
|
+
try {
|
|
6394
|
+
const url = new URL(href, window.location.href);
|
|
6395
|
+
return url.protocol === 'https:' || url.protocol === 'http:'
|
|
6396
|
+
? href
|
|
6397
|
+
: undefined;
|
|
6398
|
+
}
|
|
6399
|
+
catch {
|
|
6400
|
+
return undefined;
|
|
6401
|
+
}
|
|
6402
|
+
}
|
|
6271
6403
|
render() {
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
:
|
|
6404
|
+
const hostname = typeof window !== 'undefined' ? window.location.hostname : '';
|
|
6405
|
+
const utmParams = new URLSearchParams({
|
|
6406
|
+
utm_source: hostname,
|
|
6407
|
+
utm_medium: this.sdkVariant ?? 'js',
|
|
6408
|
+
utm_campaign: 'powered-by',
|
|
6409
|
+
utm_content: 'popover-footer',
|
|
6410
|
+
sc_sdk_version: version,
|
|
6411
|
+
});
|
|
6412
|
+
const href = `https://searchcraft.io/?${utmParams.toString()}`;
|
|
6413
|
+
const hasResults = typeof this.searchResultsCount === 'number' &&
|
|
6414
|
+
this.searchResultsCount > 0;
|
|
6415
|
+
const showViewAll = !!this.safeViewAllHref && hasResults;
|
|
6416
|
+
return (hAsync("footer", { key: '548704335f80a2b4bc7ebd4ea2d0a2eb73376fde', class: 'searchcraft-popover-footer' }, hAsync("a", { key: 'a10cbfd833ef0c6016932fede6ca3195eecdfaea', class: 'searchcraft-popover-footer-link', href: href, target: '_blank', rel: 'noreferrer' }, hAsync("span", { key: '6c6333a61ae282419e32721fc9760d3d237870df', class: 'searchcraft-popover-footer-link-prefix' }, "Powered by\u00A0"), " Searchcraft"), hAsync("div", { key: 'c35f7d6c5b16510fa58301b8fad070e6cd14d72f', class: 'searchcraft-popover-footer-results' }, hAsync("p", { key: 'e1576404d2d23a7b53e761e617720cc4fb45ea8d', class: 'searchcraft-popover-footer-results-info' }, hasResults ? (hAsync("span", null, formatNumberWithCommas(this.searchResultsCount), " Results", hAsync("span", { class: 'searchcraft-popover-footer-results-found' }, ' Found'))) : (' ')), showViewAll && (hAsync("a", { key: '6f5585d1a75ccc44174a22603d13f3604078ca63', class: 'searchcraft-popover-footer-view-all', href: this.safeViewAllHref }, hAsync("span", { key: '12d8202b01d4493700fafd61f81989458d7620c4', class: 'searchcraft-popover-footer-view-all-label' }, this.viewAllResultsLabel), hAsync("span", { key: '3b26ffdc731827612e789fdb38c751062c1077ff', class: 'searchcraft-popover-footer-view-all-shortcut', "aria-hidden": 'true' }, hAsync("kbd", { key: '6999416b99a6b4b5b24702597736846b9168b12d' }, "\u2318"), hAsync("kbd", { key: '8a7f8ee088d037e96102dab463eb93a9d27d85ea' }, "\u21B5")))))));
|
|
6275
6417
|
}
|
|
6276
6418
|
static get cmpMeta() { return {
|
|
6277
6419
|
"$flags$": 768,
|
|
6278
6420
|
"$tagName$": "searchcraft-popover-footer",
|
|
6279
6421
|
"$members$": {
|
|
6280
6422
|
"searchcraftId": [1, "searchcraft-id"],
|
|
6423
|
+
"sdkVariant": [1, "sdk-variant"],
|
|
6424
|
+
"viewAllResultsHref": [1, "view-all-results-href"],
|
|
6425
|
+
"viewAllResultsLabel": [1, "view-all-results-label"],
|
|
6281
6426
|
"searchResultsCount": [32]
|
|
6282
6427
|
},
|
|
6283
6428
|
"$listeners$": undefined,
|
|
@@ -6360,6 +6505,27 @@ class SearchcraftPopoverForm {
|
|
|
6360
6505
|
* 'hide-on-text-entered' - Only hide the placeholder when the input form has text entered into it.
|
|
6361
6506
|
*/
|
|
6362
6507
|
placeholderBehavior;
|
|
6508
|
+
/**
|
|
6509
|
+
* Base URL for the "View all" footer link. The current search term will be appended (URL encoded).
|
|
6510
|
+
*
|
|
6511
|
+
* For example, in a CMS-backed site you might set this to `/?s=` so the final URL becomes `/?s=<search-term>`.
|
|
6512
|
+
*/
|
|
6513
|
+
viewAllResultsBaseUrl;
|
|
6514
|
+
/**
|
|
6515
|
+
* Optional label for the "View All" footer button. Defaults to "View All".
|
|
6516
|
+
*/
|
|
6517
|
+
viewAllResultsLabel;
|
|
6518
|
+
/**
|
|
6519
|
+
* Whether to display the AI generative summary box before the search results.
|
|
6520
|
+
* NOTE: This requires the usage of a read key that has "SUMMARY" permissions and either a subscription to Searchcraft Cloud with AI features enabled or a self-hosted model connected.
|
|
6521
|
+
*/
|
|
6522
|
+
showSummaryBox = false;
|
|
6523
|
+
/**
|
|
6524
|
+
* The SDK variant used to render this component. Used for UTM attribution on the footer link.
|
|
6525
|
+
*
|
|
6526
|
+
* @internal
|
|
6527
|
+
*/
|
|
6528
|
+
sdkVariant = 'js';
|
|
6363
6529
|
isPopoverVisibleInState = false;
|
|
6364
6530
|
searchClientResponseItems = [];
|
|
6365
6531
|
adClientResponseItems = [];
|
|
@@ -6446,6 +6612,14 @@ class SearchcraftPopoverForm {
|
|
|
6446
6612
|
case 'Escape':
|
|
6447
6613
|
this.core?.store.getState().setPopoverVisibility(false);
|
|
6448
6614
|
break;
|
|
6615
|
+
case 'Enter':
|
|
6616
|
+
if ((event.metaKey || event.ctrlKey) &&
|
|
6617
|
+
this.viewAllResultsHref &&
|
|
6618
|
+
this.hasResultsToShow) {
|
|
6619
|
+
event.preventDefault();
|
|
6620
|
+
this.navigateToViewAllResults();
|
|
6621
|
+
}
|
|
6622
|
+
break;
|
|
6449
6623
|
default:
|
|
6450
6624
|
return;
|
|
6451
6625
|
}
|
|
@@ -6476,6 +6650,12 @@ class SearchcraftPopoverForm {
|
|
|
6476
6650
|
if (this.placeholderBehavior) {
|
|
6477
6651
|
this.modalElement.setAttribute('placeholder-behavior', this.placeholderBehavior);
|
|
6478
6652
|
}
|
|
6653
|
+
if (this.viewAllResultsBaseUrl) {
|
|
6654
|
+
this.modalElement.setAttribute('view-all-results-base-url', this.viewAllResultsBaseUrl);
|
|
6655
|
+
}
|
|
6656
|
+
if (this.viewAllResultsLabel) {
|
|
6657
|
+
this.modalElement.setAttribute('view-all-results-label', this.viewAllResultsLabel);
|
|
6658
|
+
}
|
|
6479
6659
|
document.body.appendChild(this.modalElement);
|
|
6480
6660
|
}
|
|
6481
6661
|
}
|
|
@@ -6539,24 +6719,47 @@ class SearchcraftPopoverForm {
|
|
|
6539
6719
|
this.searchTerm?.trim()?.length > 0 &&
|
|
6540
6720
|
this.searchClientResponseItems.length > 0);
|
|
6541
6721
|
}
|
|
6722
|
+
get viewAllResultsHref() {
|
|
6723
|
+
const baseUrl = this.viewAllResultsBaseUrl;
|
|
6724
|
+
if (!baseUrl) {
|
|
6725
|
+
return undefined;
|
|
6726
|
+
}
|
|
6727
|
+
const term = this.searchTerm?.trim();
|
|
6728
|
+
if (!term) {
|
|
6729
|
+
return baseUrl;
|
|
6730
|
+
}
|
|
6731
|
+
return `${baseUrl}${encodeURIComponent(term).replace(/%20/g, '+')}`;
|
|
6732
|
+
}
|
|
6733
|
+
get resolvedViewAllResultsLabel() {
|
|
6734
|
+
return this.viewAllResultsLabel ?? 'View All';
|
|
6735
|
+
}
|
|
6736
|
+
navigateToViewAllResults() {
|
|
6737
|
+
const href = this.viewAllResultsHref;
|
|
6738
|
+
if (!href || !this.hasResultsToShow) {
|
|
6739
|
+
return;
|
|
6740
|
+
}
|
|
6741
|
+
if (typeof window !== 'undefined') {
|
|
6742
|
+
window.location.href = href;
|
|
6743
|
+
}
|
|
6744
|
+
}
|
|
6542
6745
|
renderInlinePopover() {
|
|
6543
6746
|
const isListViewVisible = this.hasResultsToShow && this.isFocused;
|
|
6544
6747
|
return (hAsync("div", { class: classNames('searchcraft-popover-form searchcraft-popover-form-inline', {
|
|
6545
6748
|
'searchcraft-popover-form-active': isListViewVisible,
|
|
6546
|
-
}) }, hAsync("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-inline-input' }, hAsync("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior })), isListViewVisible && (hAsync("div", { class: 'searchcraft-popover-form-inline-wrapper' }, hAsync("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }), hAsync("searchcraft-popover-footer", { searchcraftId: this.searchcraftId })))));
|
|
6749
|
+
}) }, hAsync("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-inline-input' }, hAsync("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior })), isListViewVisible && (hAsync("div", { class: 'searchcraft-popover-form-inline-wrapper' }, this.showSummaryBox && (hAsync("searchcraft-results-summary", { searchcraftId: this.searchcraftId })), hAsync("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }), hAsync("searchcraft-popover-footer", { searchcraftId: this.searchcraftId, sdkVariant: this.sdkVariant, viewAllResultsHref: this.viewAllResultsHref, viewAllResultsLabel: this.resolvedViewAllResultsLabel })))));
|
|
6547
6750
|
}
|
|
6548
6751
|
renderModalPopover() {
|
|
6549
6752
|
if (this.isPopoverVisibleInState) {
|
|
6550
6753
|
return (hAsync("div", { class: classNames('searchcraft-popover-form searchcraft-popover-form-modal', {
|
|
6551
6754
|
'searchcraft-popover-form-active': this.hasResultsToShow,
|
|
6552
|
-
}) }, hAsync("div", { class: 'searchcraft-popover-form-modal-backdrop', onClick: this.handleModalBackdropClick }), hAsync("div", { class: 'searchcraft-popover-form-modal-wrapper' }, hAsync("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-modal-input' }, hAsync("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior }), hAsync("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button searchcraft-popover-form-modal-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), hAsync("div", { class: 'searchcraft-popover-form-modal-popover-list-view' }, this.hasResultsToShow && (hAsync("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }))), hAsync("searchcraft-popover-footer", { searchcraftId: this.searchcraftId }))));
|
|
6755
|
+
}) }, hAsync("div", { class: 'searchcraft-popover-form-modal-backdrop', onClick: this.handleModalBackdropClick }), hAsync("div", { class: 'searchcraft-popover-form-modal-wrapper' }, hAsync("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-modal-input' }, hAsync("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior }), hAsync("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button searchcraft-popover-form-modal-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), hAsync("div", { class: 'searchcraft-popover-form-modal-popover-list-view' }, this.showSummaryBox && this.hasResultsToShow && (hAsync("searchcraft-results-summary", { searchcraftId: this.searchcraftId })), this.hasResultsToShow && (hAsync("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }))), hAsync("searchcraft-popover-footer", { searchcraftId: this.searchcraftId, sdkVariant: this.sdkVariant, viewAllResultsHref: this.viewAllResultsHref, viewAllResultsLabel: this.resolvedViewAllResultsLabel }))));
|
|
6553
6756
|
}
|
|
6554
6757
|
}
|
|
6555
6758
|
renderFullscreenPopover() {
|
|
6556
6759
|
if (this.isPopoverVisibleInState) {
|
|
6557
6760
|
return (hAsync("div", { class: classNames('searchcraft-popover-form searchcraft-popover-form-fullscreen', {
|
|
6558
6761
|
'searchcraft-popover-form-active': this.hasResultsToShow,
|
|
6559
|
-
}) }, hAsync("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-fullscreen-input' }, hAsync("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior }), hAsync("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button searchcraft-popover-form-fullscreen-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), hAsync("div", { class: 'searchcraft-popover-form-fullscreen-popover-list-view' }, this.hasResultsToShow && (hAsync("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }))), hAsync("searchcraft-popover-footer", { searchcraftId: this.searchcraftId })));
|
|
6762
|
+
}) }, hAsync("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-fullscreen-input' }, hAsync("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior }), hAsync("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button searchcraft-popover-form-fullscreen-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), hAsync("div", { class: 'searchcraft-popover-form-fullscreen-popover-list-view' }, this.showSummaryBox && this.hasResultsToShow && (hAsync("searchcraft-results-summary", { searchcraftId: this.searchcraftId })), this.hasResultsToShow && (hAsync("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }))), hAsync("searchcraft-popover-footer", { searchcraftId: this.searchcraftId, sdkVariant: this.sdkVariant, viewAllResultsHref: this.viewAllResultsHref, viewAllResultsLabel: this.resolvedViewAllResultsLabel })));
|
|
6560
6763
|
}
|
|
6561
6764
|
}
|
|
6562
6765
|
render() {
|
|
@@ -6580,6 +6783,10 @@ class SearchcraftPopoverForm {
|
|
|
6580
6783
|
"searchcraftId": [1, "searchcraft-id"],
|
|
6581
6784
|
"placeholderValue": [1, "placeholder-value"],
|
|
6582
6785
|
"placeholderBehavior": [1, "placeholder-behavior"],
|
|
6786
|
+
"viewAllResultsBaseUrl": [1, "view-all-results-base-url"],
|
|
6787
|
+
"viewAllResultsLabel": [1, "view-all-results-label"],
|
|
6788
|
+
"showSummaryBox": [4, "show-summary-box"],
|
|
6789
|
+
"sdkVariant": [1, "sdk-variant"],
|
|
6583
6790
|
"isPopoverVisibleInState": [32],
|
|
6584
6791
|
"searchClientResponseItems": [32],
|
|
6585
6792
|
"adClientResponseItems": [32],
|
|
@@ -7162,726 +7369,14 @@ class SearchcraftResultsInfo {
|
|
|
7162
7369
|
}
|
|
7163
7370
|
|
|
7164
7371
|
/**
|
|
7165
|
-
*
|
|
7166
|
-
*
|
|
7167
|
-
*
|
|
7372
|
+
* marked v15.0.12 - a markdown parser
|
|
7373
|
+
* Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
|
|
7374
|
+
* https://github.com/markedjs/marked
|
|
7168
7375
|
*/
|
|
7169
|
-
class SearchcraftSearchResult {
|
|
7170
|
-
constructor(hostRef) {
|
|
7171
|
-
registerInstance(this, hostRef);
|
|
7172
|
-
}
|
|
7173
|
-
item;
|
|
7174
|
-
/**
|
|
7175
|
-
* The index.
|
|
7176
|
-
*/
|
|
7177
|
-
index;
|
|
7178
|
-
/**
|
|
7179
|
-
* The position in the document. Used with the "document_clicked" measure event.
|
|
7180
|
-
*/
|
|
7181
|
-
documentPosition = 0;
|
|
7182
|
-
/**
|
|
7183
|
-
* A callback function responsible for rendering a result.
|
|
7184
|
-
*/
|
|
7185
|
-
template;
|
|
7186
|
-
/**
|
|
7187
|
-
* The id of the Searchcraft instance that this component should use.
|
|
7188
|
-
*/
|
|
7189
|
-
searchcraftId;
|
|
7190
|
-
templateHtml;
|
|
7191
|
-
get hostElement() { return getElement(this); }
|
|
7192
|
-
core;
|
|
7193
|
-
cleanupCore;
|
|
7194
|
-
onCoreAvailable(core) {
|
|
7195
|
-
this.core = core;
|
|
7196
|
-
}
|
|
7197
|
-
connectedCallback() {
|
|
7198
|
-
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
7199
|
-
if (this.item) {
|
|
7200
|
-
try {
|
|
7201
|
-
this.templateHtml = this.template?.(this.item.document, this.index, {
|
|
7202
|
-
html: html$1,
|
|
7203
|
-
source_index: this.item.source_index,
|
|
7204
|
-
});
|
|
7205
|
-
}
|
|
7206
|
-
catch (error) {
|
|
7207
|
-
console.error('Invalid search result template:', error);
|
|
7208
|
-
}
|
|
7209
|
-
}
|
|
7210
|
-
}
|
|
7211
|
-
disconnectedCallback() {
|
|
7212
|
-
this.cleanupCore?.();
|
|
7213
|
-
}
|
|
7214
|
-
handleResultContainerClick = (event) => {
|
|
7215
|
-
if (!event.target) {
|
|
7216
|
-
return;
|
|
7217
|
-
}
|
|
7218
|
-
const target = event.target;
|
|
7219
|
-
const link = target.closest('a');
|
|
7220
|
-
if (!link ||
|
|
7221
|
-
!this.hostElement?.contains(link) ||
|
|
7222
|
-
!this.core ||
|
|
7223
|
-
!this.core.measureClient) {
|
|
7224
|
-
return;
|
|
7225
|
-
}
|
|
7226
|
-
const document_position = this.documentPosition;
|
|
7227
|
-
const search_term = this.core.store.getState().searchTerm;
|
|
7228
|
-
const number_of_documents = this.core.store.getState().searchClientResponseItems.length || 0;
|
|
7229
|
-
this.core.measureClient.sendMeasureEvent('document_clicked', {
|
|
7230
|
-
document_position,
|
|
7231
|
-
number_of_documents,
|
|
7232
|
-
search_term,
|
|
7233
|
-
});
|
|
7234
|
-
};
|
|
7235
|
-
handleKeyDown = () => { };
|
|
7236
|
-
render() {
|
|
7237
|
-
if (!this.item) {
|
|
7238
|
-
return;
|
|
7239
|
-
}
|
|
7240
|
-
if (typeof this.template === 'undefined') {
|
|
7241
|
-
return (hAsync("div", { class: 'searchcraft-search-result searchcraft-search-result-no-template', onClick: this.handleResultContainerClick, onKeyDown: this.handleKeyDown }, Object.entries(this.item.document).map(([key, value]) => (hAsync("p", { key: key }, hAsync("strong", null, key), ": ", value)))));
|
|
7242
|
-
}
|
|
7243
|
-
return (hAsync("div", { class: 'searchcraft-search-result', innerHTML: this.templateHtml, onClick: this.handleResultContainerClick, onKeyDown: this.handleKeyDown }));
|
|
7244
|
-
}
|
|
7245
|
-
static get cmpMeta() { return {
|
|
7246
|
-
"$flags$": 768,
|
|
7247
|
-
"$tagName$": "searchcraft-search-result",
|
|
7248
|
-
"$members$": {
|
|
7249
|
-
"item": [16],
|
|
7250
|
-
"index": [2],
|
|
7251
|
-
"documentPosition": [2, "document-position"],
|
|
7252
|
-
"template": [16],
|
|
7253
|
-
"searchcraftId": [1, "searchcraft-id"],
|
|
7254
|
-
"templateHtml": [32]
|
|
7255
|
-
},
|
|
7256
|
-
"$listeners$": undefined,
|
|
7257
|
-
"$lazyBundleId$": "-",
|
|
7258
|
-
"$attrsToReflect$": []
|
|
7259
|
-
}; }
|
|
7260
|
-
}
|
|
7261
7376
|
|
|
7262
7377
|
/**
|
|
7263
|
-
*
|
|
7264
|
-
*
|
|
7265
|
-
*
|
|
7266
|
-
* @react-import
|
|
7267
|
-
* ```jsx
|
|
7268
|
-
* import { SearchcraftSearchResults } from "@searchcraft/react-sdk";
|
|
7269
|
-
* ```
|
|
7270
|
-
*
|
|
7271
|
-
* @vue-import
|
|
7272
|
-
* ```jsx
|
|
7273
|
-
* import { SearchcraftSearchResults } from "@searchcraft/vue-sdk";
|
|
7274
|
-
* ```
|
|
7275
|
-
*
|
|
7276
|
-
* @js-example
|
|
7277
|
-
* ```html
|
|
7278
|
-
* <!-- index.html -->
|
|
7279
|
-
* <searchcraft-search-results
|
|
7280
|
-
* ad-interval="4"
|
|
7281
|
-
* place-ad-at-start="true"
|
|
7282
|
-
* />
|
|
7283
|
-
* ```
|
|
7284
|
-
*
|
|
7285
|
-
* ```js
|
|
7286
|
-
* // index.js
|
|
7287
|
-
* const searchResults = document.querySelector('searchcraft-search-results');
|
|
7288
|
-
*
|
|
7289
|
-
* searchResults.template = (item, index, { html }) => html`
|
|
7290
|
-
* <h2>${item.title}</h2>
|
|
7291
|
-
* `;
|
|
7292
|
-
* ```
|
|
7293
|
-
*
|
|
7294
|
-
* @react-example
|
|
7295
|
-
* ```jsx
|
|
7296
|
-
* <SearchcraftSearchResults
|
|
7297
|
-
* adInterval={4}
|
|
7298
|
-
* placeAdAtState={true}
|
|
7299
|
-
* template={(item, index, { html }) => html`
|
|
7300
|
-
* <h2>${item.title}</h2>
|
|
7301
|
-
* `}
|
|
7302
|
-
* />
|
|
7303
|
-
* ```
|
|
7304
|
-
*
|
|
7305
|
-
* @vue-example
|
|
7306
|
-
* ```jsx
|
|
7307
|
-
* <SearchcraftSearchResults
|
|
7308
|
-
* adInterval={4}
|
|
7309
|
-
* placeAdAtState={true}
|
|
7310
|
-
* :template={(item, index, { html }) => html`
|
|
7311
|
-
* <h2>${item.title}</h2>
|
|
7312
|
-
* `}
|
|
7313
|
-
* />
|
|
7314
|
-
* ```
|
|
7315
|
-
*/
|
|
7316
|
-
class SearchcraftSearchResults {
|
|
7317
|
-
constructor(hostRef) {
|
|
7318
|
-
registerInstance(this, hostRef);
|
|
7319
|
-
}
|
|
7320
|
-
/**
|
|
7321
|
-
* The id of the Searchcraft instance that this component should use.
|
|
7322
|
-
*/
|
|
7323
|
-
searchcraftId;
|
|
7324
|
-
/**
|
|
7325
|
-
* A query that will appears when the component initializes or the search term is ''..
|
|
7326
|
-
*/
|
|
7327
|
-
initialQuery;
|
|
7328
|
-
/**
|
|
7329
|
-
* A callback function responsible for rendering a result. Passed to `searchcraft-search-result`.
|
|
7330
|
-
*/
|
|
7331
|
-
template;
|
|
7332
|
-
adClientResponseItems = [];
|
|
7333
|
-
config;
|
|
7334
|
-
isSearchInProgress = true;
|
|
7335
|
-
searchClientResponseItems;
|
|
7336
|
-
searchResultsPage;
|
|
7337
|
-
searchResultsPerPage;
|
|
7338
|
-
searchTerm = '';
|
|
7339
|
-
unsubscribe;
|
|
7340
|
-
cleanupCore;
|
|
7341
|
-
onCoreAvailable(core) {
|
|
7342
|
-
const state = core.store.getState();
|
|
7343
|
-
this.handleStateChange(state);
|
|
7344
|
-
this.searchClientResponseItems = state.searchClientResponseItems;
|
|
7345
|
-
this.searchTerm = state.searchTerm;
|
|
7346
|
-
this.config = state.core?.config;
|
|
7347
|
-
this.unsubscribe = core.store.subscribe((state) => this.handleStateChange(state));
|
|
7348
|
-
}
|
|
7349
|
-
connectedCallback() {
|
|
7350
|
-
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
7351
|
-
}
|
|
7352
|
-
disconnectedCallback() {
|
|
7353
|
-
this.unsubscribe?.();
|
|
7354
|
-
this.cleanupCore?.();
|
|
7355
|
-
}
|
|
7356
|
-
handleStateChange(state) {
|
|
7357
|
-
this.adClientResponseItems = [...state.adClientResponseItems];
|
|
7358
|
-
this.config = state.core?.config;
|
|
7359
|
-
this.isSearchInProgress = state.isSearchInProgress;
|
|
7360
|
-
this.searchClientResponseItems = [...state.searchClientResponseItems];
|
|
7361
|
-
this.searchResultsPage = state.searchResultsPage;
|
|
7362
|
-
this.searchResultsPerPage = state.searchResultsPerPage;
|
|
7363
|
-
this.searchTerm = state.searchTerm;
|
|
7364
|
-
}
|
|
7365
|
-
renderEmptyState() {
|
|
7366
|
-
return (hAsync("div", { class: 'searchcraft-search-results-empty-state' }, hAsync("slot", { name: 'empty-search' })));
|
|
7367
|
-
}
|
|
7368
|
-
renderNoResultsFoundState() {
|
|
7369
|
-
return (hAsync("div", { class: 'searchcraft-search-results' }, hAsync("div", { class: 'searchcraft-search-results-error-message' }, hAsync("searchcraft-error-message", null, "No search results found for \"", this.searchTerm, "\" query."))));
|
|
7370
|
-
}
|
|
7371
|
-
renderWithADMAds() {
|
|
7372
|
-
const items = this.searchClientResponseItems || [];
|
|
7373
|
-
return (hAsync("div", { class: 'searchcraft-search-results' }, this.adClientResponseItems?.map((item) => (hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'adMarketplace', adClientResponseItem: item, key: item.id, renderPosition: 'top' }))), items.map((item, index) => (hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template })))));
|
|
7374
|
-
}
|
|
7375
|
-
renderWithCustomAds() {
|
|
7376
|
-
const itemsToRender = [];
|
|
7377
|
-
const interstitialInterval = this.config?.customAdConfig?.adInterstitialInterval || 0;
|
|
7378
|
-
const interstitialQuantity = this.config?.customAdConfig?.adInterstitialQuantity || 1;
|
|
7379
|
-
const adStartQuantity = this.config?.customAdConfig?.adStartQuantity || 0;
|
|
7380
|
-
const adEndQuantity = this.config?.customAdConfig?.adEndQuantity || 0;
|
|
7381
|
-
const items = this.searchClientResponseItems || [];
|
|
7382
|
-
// Renders ads at beginning
|
|
7383
|
-
for (let n = 0; n < adStartQuantity; n++) {
|
|
7384
|
-
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Custom', key: `${n}-ad`, renderPosition: 'top' }));
|
|
7385
|
-
}
|
|
7386
|
-
// Renders search results + interstitial ads
|
|
7387
|
-
items.forEach((item, index) => {
|
|
7388
|
-
if (interstitialInterval &&
|
|
7389
|
-
index % interstitialInterval === 0 &&
|
|
7390
|
-
index + interstitialInterval < items.length &&
|
|
7391
|
-
index >= interstitialInterval) {
|
|
7392
|
-
for (let n = 0; n < interstitialQuantity; n++) {
|
|
7393
|
-
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Custom', key: `${item.id}-ad-${n}`, renderPosition: 'interstitial' }));
|
|
7394
|
-
}
|
|
7395
|
-
}
|
|
7396
|
-
itemsToRender.push(hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template }));
|
|
7397
|
-
});
|
|
7398
|
-
// Renders ads at end
|
|
7399
|
-
for (let n = 0; n < adEndQuantity; n++) {
|
|
7400
|
-
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Custom', key: `${n}-ad`, renderPosition: 'bottom' }));
|
|
7401
|
-
}
|
|
7402
|
-
return hAsync("div", { class: 'searchcraft-search-results' }, itemsToRender);
|
|
7403
|
-
}
|
|
7404
|
-
renderWithNativoAds() {
|
|
7405
|
-
const itemsToRender = [];
|
|
7406
|
-
const interstitialStartIndex = this.config?.nativoConfig?.adInterstialStartIndex || 0;
|
|
7407
|
-
const interstitialInterval = this.config?.nativoConfig?.adInterstitialInterval || 0;
|
|
7408
|
-
const interstitialQuantity = this.config?.nativoConfig?.adInterstitialQuantity || 1;
|
|
7409
|
-
const adStartQuantity = this.config?.nativoConfig?.adStartQuantity || 0;
|
|
7410
|
-
const adEndQuantity = this.config?.nativoConfig?.adEndQuantity || 0;
|
|
7411
|
-
const items = this.searchClientResponseItems || [];
|
|
7412
|
-
// Renders ads at beginning
|
|
7413
|
-
for (let n = 0; n < adStartQuantity; n++) {
|
|
7414
|
-
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Nativo', key: `${n}-ad`, renderPosition: 'top' }));
|
|
7415
|
-
}
|
|
7416
|
-
// Renders search results + interstitial ads
|
|
7417
|
-
items.forEach((item, index) => {
|
|
7418
|
-
if (interstitialInterval &&
|
|
7419
|
-
(index + interstitialStartIndex) % interstitialInterval === 0 &&
|
|
7420
|
-
index + interstitialInterval < items.length &&
|
|
7421
|
-
index >= interstitialInterval) {
|
|
7422
|
-
for (let n = 0; n < interstitialQuantity; n++) {
|
|
7423
|
-
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Nativo', key: `${item.id}-ad-${n}`, renderPosition: 'interstitial' }));
|
|
7424
|
-
}
|
|
7425
|
-
}
|
|
7426
|
-
itemsToRender.push(hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template }));
|
|
7427
|
-
});
|
|
7428
|
-
// Renders ads at end
|
|
7429
|
-
for (let n = 0; n < adEndQuantity; n++) {
|
|
7430
|
-
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Nativo', key: `${n}-ad`, renderPosition: 'bottom' }));
|
|
7431
|
-
}
|
|
7432
|
-
return hAsync("div", { class: 'searchcraft-search-results' }, itemsToRender);
|
|
7433
|
-
}
|
|
7434
|
-
renderWithNoAds() {
|
|
7435
|
-
const items = this.searchClientResponseItems || [];
|
|
7436
|
-
return (hAsync("div", { class: 'searchcraft-search-results' }, items.map((item, index) => (hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template })))));
|
|
7437
|
-
}
|
|
7438
|
-
render() {
|
|
7439
|
-
const searchClientResponseItems = this.searchClientResponseItems || [];
|
|
7440
|
-
if (searchClientResponseItems.length === 0 && !this.isSearchInProgress) {
|
|
7441
|
-
return this.renderEmptyState();
|
|
7442
|
-
}
|
|
7443
|
-
if (this.searchTerm.length > 0 &&
|
|
7444
|
-
searchClientResponseItems.length === 0 &&
|
|
7445
|
-
!this.isSearchInProgress) {
|
|
7446
|
-
return this.renderNoResultsFoundState();
|
|
7447
|
-
}
|
|
7448
|
-
if (this.config?.customAdConfig) {
|
|
7449
|
-
return this.renderWithCustomAds();
|
|
7450
|
-
}
|
|
7451
|
-
if (this.config?.admAdConfig) {
|
|
7452
|
-
return this.renderWithNativoAds();
|
|
7453
|
-
}
|
|
7454
|
-
if (this.config?.nativoConfig) {
|
|
7455
|
-
return this.renderWithNativoAds();
|
|
7456
|
-
}
|
|
7457
|
-
return this.renderWithNoAds();
|
|
7458
|
-
}
|
|
7459
|
-
static get cmpMeta() { return {
|
|
7460
|
-
"$flags$": 772,
|
|
7461
|
-
"$tagName$": "searchcraft-search-results",
|
|
7462
|
-
"$members$": {
|
|
7463
|
-
"searchcraftId": [1, "searchcraft-id"],
|
|
7464
|
-
"initialQuery": [1, "initial-query"],
|
|
7465
|
-
"template": [16],
|
|
7466
|
-
"adClientResponseItems": [32],
|
|
7467
|
-
"config": [32],
|
|
7468
|
-
"isSearchInProgress": [32],
|
|
7469
|
-
"searchClientResponseItems": [32],
|
|
7470
|
-
"searchResultsPage": [32],
|
|
7471
|
-
"searchResultsPerPage": [32],
|
|
7472
|
-
"searchTerm": [32]
|
|
7473
|
-
},
|
|
7474
|
-
"$listeners$": undefined,
|
|
7475
|
-
"$lazyBundleId$": "-",
|
|
7476
|
-
"$attrsToReflect$": []
|
|
7477
|
-
}; }
|
|
7478
|
-
}
|
|
7479
|
-
|
|
7480
|
-
/**
|
|
7481
|
-
* This web component is designed to choose the number of search results displayed.
|
|
7482
|
-
*
|
|
7483
|
-
* @react-import
|
|
7484
|
-
* ```jsx
|
|
7485
|
-
* import { SearchcraftSearchResultsPerPage } from "@searchcraft/react-sdk";
|
|
7486
|
-
* ```
|
|
7487
|
-
*
|
|
7488
|
-
* @vue-import
|
|
7489
|
-
* ```jsx
|
|
7490
|
-
* import { SearchcraftSearchResultsPerPage } from "@searchcraft/vue-sdk";
|
|
7491
|
-
* ```
|
|
7492
|
-
*
|
|
7493
|
-
* @js-example
|
|
7494
|
-
* ```html
|
|
7495
|
-
* <!-- index.html -->
|
|
7496
|
-
* <searchcraft-search-results-per-page increment="20" />
|
|
7497
|
-
* ```
|
|
7498
|
-
*
|
|
7499
|
-
* @react-example
|
|
7500
|
-
* ```jsx
|
|
7501
|
-
* <SearchcraftSearchResultsPerPage increment={20} />
|
|
7502
|
-
* ```
|
|
7503
|
-
*
|
|
7504
|
-
* @vue-example
|
|
7505
|
-
* ```jsx
|
|
7506
|
-
* <SearchcraftSearchResultsPerPage increment="20" />
|
|
7507
|
-
* ```
|
|
7508
|
-
*/
|
|
7509
|
-
class SearchcraftSearchResultsPerPage {
|
|
7510
|
-
constructor(hostRef) {
|
|
7511
|
-
registerInstance(this, hostRef);
|
|
7512
|
-
}
|
|
7513
|
-
/**
|
|
7514
|
-
* The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]).
|
|
7515
|
-
* The base value is defined by the `searchResultsPerPage` option in the configuration.
|
|
7516
|
-
*/
|
|
7517
|
-
increment = 20;
|
|
7518
|
-
/**
|
|
7519
|
-
* The id of the Searchcraft instance that this component should use.
|
|
7520
|
-
*/
|
|
7521
|
-
searchcraftId;
|
|
7522
|
-
// store vars
|
|
7523
|
-
searchTerm;
|
|
7524
|
-
searchResultsPage;
|
|
7525
|
-
searchResultsPerPage;
|
|
7526
|
-
searchResultsCount;
|
|
7527
|
-
searchResultsPagesCount;
|
|
7528
|
-
searchClientRequestProperties;
|
|
7529
|
-
// local vars
|
|
7530
|
-
initialSearchResultsPerPage;
|
|
7531
|
-
// store functions
|
|
7532
|
-
setSearchResultsPerPage = () => { };
|
|
7533
|
-
setSearchResultsPage = () => { };
|
|
7534
|
-
unsubscribe = () => { };
|
|
7535
|
-
cleanupCore;
|
|
7536
|
-
onCoreAvailable(core) {
|
|
7537
|
-
this.unsubscribe = core.store.subscribe((state) => {
|
|
7538
|
-
// store vars
|
|
7539
|
-
this.searchTerm = state.searchTerm;
|
|
7540
|
-
this.searchResultsPerPage = state.searchResultsPerPage;
|
|
7541
|
-
this.searchResultsPage = state.searchResultsPage;
|
|
7542
|
-
this.searchResultsCount = state.searchResultsCount;
|
|
7543
|
-
this.searchClientRequestProperties = state.searchClientRequestProperties;
|
|
7544
|
-
// local vars
|
|
7545
|
-
this.searchResultsPagesCount = Math.ceil(this.searchResultsCount / this.searchResultsPerPage);
|
|
7546
|
-
// store functions
|
|
7547
|
-
this.setSearchResultsPage = state.setSearchResultsPage;
|
|
7548
|
-
this.setSearchResultsPerPage = state.setSearchResultsPerPage;
|
|
7549
|
-
});
|
|
7550
|
-
this.initialSearchResultsPerPage =
|
|
7551
|
-
core.store.getState().searchResultsPerPage;
|
|
7552
|
-
}
|
|
7553
|
-
connectedCallback() {
|
|
7554
|
-
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
7555
|
-
}
|
|
7556
|
-
disconnectedCallback() {
|
|
7557
|
-
this.unsubscribe?.();
|
|
7558
|
-
this.cleanupCore?.();
|
|
7559
|
-
}
|
|
7560
|
-
render() {
|
|
7561
|
-
// Check if this is an initialQuery case (string requestProperties with empty searchTerm)
|
|
7562
|
-
const isInitialQuery = typeof this.searchClientRequestProperties === 'string' &&
|
|
7563
|
-
this.searchTerm.trim() === '';
|
|
7564
|
-
// early return if there isn't a searchTerm (unless it's initialQuery) or there is 1 or fewer pages of results
|
|
7565
|
-
if ((!this.searchTerm && !isInitialQuery) ||
|
|
7566
|
-
this.searchResultsPagesCount <= 1) {
|
|
7567
|
-
return;
|
|
7568
|
-
}
|
|
7569
|
-
return (hAsync("div", { class: 'searchcraft-search-results-per-page' }, hAsync("div", { class: 'searchcraft-search-results-per-page-select' }, hAsync("label", { class: 'searchcraft-search-results-per-page-select-label', htmlFor: 'searchcraft-search-results-per-page-select-input' }, "Results Per Page"), hAsync("div", { class: 'searchcraft-search-results-per-page-select-input' }, hAsync("searchcraft-select", { inputId: 'searchcraft-search-results-per-page-select-input', name: 'results-per-page', options: [...Array(5)].map((_, index) => {
|
|
7570
|
-
const value = this.initialSearchResultsPerPage +
|
|
7571
|
-
Number(this.increment) * index;
|
|
7572
|
-
return {
|
|
7573
|
-
label: `${value}`,
|
|
7574
|
-
value,
|
|
7575
|
-
};
|
|
7576
|
-
}), onSelectChange: (event) => {
|
|
7577
|
-
this.setSearchResultsPerPage(Number(event.detail));
|
|
7578
|
-
this.setSearchResultsPage(1);
|
|
7579
|
-
} })))));
|
|
7580
|
-
}
|
|
7581
|
-
static get cmpMeta() { return {
|
|
7582
|
-
"$flags$": 768,
|
|
7583
|
-
"$tagName$": "searchcraft-search-results-per-page",
|
|
7584
|
-
"$members$": {
|
|
7585
|
-
"increment": [8],
|
|
7586
|
-
"searchcraftId": [1, "searchcraft-id"],
|
|
7587
|
-
"searchTerm": [32],
|
|
7588
|
-
"searchResultsPage": [32],
|
|
7589
|
-
"searchResultsPerPage": [32],
|
|
7590
|
-
"searchResultsCount": [32],
|
|
7591
|
-
"searchResultsPagesCount": [32],
|
|
7592
|
-
"searchClientRequestProperties": [32],
|
|
7593
|
-
"initialSearchResultsPerPage": [32],
|
|
7594
|
-
"setSearchResultsPerPage": [32],
|
|
7595
|
-
"setSearchResultsPage": [32]
|
|
7596
|
-
},
|
|
7597
|
-
"$listeners$": undefined,
|
|
7598
|
-
"$lazyBundleId$": "-",
|
|
7599
|
-
"$attrsToReflect$": []
|
|
7600
|
-
}; }
|
|
7601
|
-
}
|
|
7602
|
-
|
|
7603
|
-
/**
|
|
7604
|
-
* This web component is designed to allow users to select between a group of options.
|
|
7605
|
-
*
|
|
7606
|
-
* @js-example
|
|
7607
|
-
* ```html
|
|
7608
|
-
* <!-- index.html -->
|
|
7609
|
-
* <searchcraft-select
|
|
7610
|
-
* inputId="searchcraft-select"
|
|
7611
|
-
* name="searchcraft-select"
|
|
7612
|
-
* options="[{ label: 'label', value: 'value' }]"
|
|
7613
|
-
* />
|
|
7614
|
-
* ```
|
|
7615
|
-
*
|
|
7616
|
-
* @internal
|
|
7617
|
-
*/
|
|
7618
|
-
class SearchcraftSelect {
|
|
7619
|
-
constructor(hostRef) {
|
|
7620
|
-
registerInstance(this, hostRef);
|
|
7621
|
-
this.selectChange = createEvent(this, "selectChange");
|
|
7622
|
-
}
|
|
7623
|
-
/**
|
|
7624
|
-
* The caption displayed below the select input.
|
|
7625
|
-
*/
|
|
7626
|
-
caption;
|
|
7627
|
-
/**
|
|
7628
|
-
* Whether the select input is disabled.
|
|
7629
|
-
*/
|
|
7630
|
-
disabled = false;
|
|
7631
|
-
/**
|
|
7632
|
-
* The ID for the select input.
|
|
7633
|
-
*/
|
|
7634
|
-
inputId;
|
|
7635
|
-
/**
|
|
7636
|
-
* The label of the select input.
|
|
7637
|
-
*/
|
|
7638
|
-
label;
|
|
7639
|
-
/**
|
|
7640
|
-
* The ID for the label of the select input.
|
|
7641
|
-
*/
|
|
7642
|
-
labelId;
|
|
7643
|
-
/**
|
|
7644
|
-
* The name of the select input.
|
|
7645
|
-
*/
|
|
7646
|
-
name;
|
|
7647
|
-
/**
|
|
7648
|
-
* The options for the select input.
|
|
7649
|
-
*/
|
|
7650
|
-
options = [];
|
|
7651
|
-
/**
|
|
7652
|
-
* The event fired when the select is changed.
|
|
7653
|
-
*/
|
|
7654
|
-
selectChange;
|
|
7655
|
-
searchResultsPerPage;
|
|
7656
|
-
setSearchResultsPage = () => { };
|
|
7657
|
-
setSearchResultsPerPage = () => { };
|
|
7658
|
-
handleSelectChange = (event) => {
|
|
7659
|
-
this.selectChange.emit(event.target.value);
|
|
7660
|
-
};
|
|
7661
|
-
handleGoToPage(page) {
|
|
7662
|
-
this.setSearchResultsPage(page);
|
|
7663
|
-
}
|
|
7664
|
-
render() {
|
|
7665
|
-
return (hAsync("div", { key: '15ecbf48c824a161cd83bdab99dace8e44f1ab39', class: 'searchcraft-select' }, this.label && (hAsync("label", { key: 'aba433ae9c27c9405099cffcef923c3ad22d7fda', class: 'searchcraft-select-label', id: this.labelId || `${this.inputId}-label`, htmlFor: this.inputId }, this.label)), hAsync("div", { key: '8df8a2ff05924c9c55cdd6e3827cd927cddab82a', class: 'searchcraft-select-input-wrapper' }, hAsync("select", { key: '1d5f492c2255f8ca1b6ea5e04a2726dda2f2c52f', "aria-labelledby": this.label ? this.labelId || `${this.inputId}-label` : undefined, class: 'searchcraft-select-input', disabled: this.disabled, id: this.inputId, name: this.name, onChange: this.handleSelectChange }, (typeof this.options === 'string'
|
|
7666
|
-
? JSON.parse(this.options)
|
|
7667
|
-
: this.options).map(({ label, value, selected }) => {
|
|
7668
|
-
return (hAsync("option", { key: value, value: value, selected: selected }, label));
|
|
7669
|
-
})), hAsync("svg", { key: '0ec6892b529f2e70027aadea47208582a65a97b7', class: 'searchcraft-select-input-icon', width: '20', height: '20', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' }, hAsync("title", { key: 'bced6b62378491d1d1c629b602d7d033d912c761' }, "Select dropdown icon"), hAsync("path", { key: '659f8ebf9129e2e7941da949d29688c41c1472bb', d: 'M5 7.5L10 12.5L15 7.5', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))), this.caption && (hAsync("p", { key: '51217d926f68f79b6c3514f5fd769b56549fdce9', class: 'searchcraft-select-caption' }, this.caption))));
|
|
7670
|
-
}
|
|
7671
|
-
static get cmpMeta() { return {
|
|
7672
|
-
"$flags$": 768,
|
|
7673
|
-
"$tagName$": "searchcraft-select",
|
|
7674
|
-
"$members$": {
|
|
7675
|
-
"caption": [1],
|
|
7676
|
-
"disabled": [4],
|
|
7677
|
-
"inputId": [1, "input-id"],
|
|
7678
|
-
"label": [1],
|
|
7679
|
-
"labelId": [1, "label-id"],
|
|
7680
|
-
"name": [1],
|
|
7681
|
-
"options": [1],
|
|
7682
|
-
"searchResultsPerPage": [32],
|
|
7683
|
-
"setSearchResultsPage": [32],
|
|
7684
|
-
"setSearchResultsPerPage": [32]
|
|
7685
|
-
},
|
|
7686
|
-
"$listeners$": undefined,
|
|
7687
|
-
"$lazyBundleId$": "-",
|
|
7688
|
-
"$attrsToReflect$": []
|
|
7689
|
-
}; }
|
|
7690
|
-
}
|
|
7691
|
-
|
|
7692
|
-
/**
|
|
7693
|
-
* Creates a throttled version of the given function that only invokes
|
|
7694
|
-
* the original function at most once every specified number of milliseconds.
|
|
7695
|
-
*
|
|
7696
|
-
* The logic is written in a way that the last invocation is always called, after the
|
|
7697
|
-
* throttle cooldown period has ended.
|
|
7698
|
-
*
|
|
7699
|
-
* @template Arguments - The argument types for the function to throttle
|
|
7700
|
-
* @param callback - The function to throttle
|
|
7701
|
-
* @param delayInMilliseconds - The number of milliseconds to wait before allowing the next invocation
|
|
7702
|
-
* @returns A throttled version of the original function
|
|
7703
|
-
*/
|
|
7704
|
-
function throttle(callback, delayInMilliseconds) {
|
|
7705
|
-
let isThrottleOnCooldown = false;
|
|
7706
|
-
let trailingCallArgs = null;
|
|
7707
|
-
const invokeAction = (args) => {
|
|
7708
|
-
callback(...args);
|
|
7709
|
-
isThrottleOnCooldown = true;
|
|
7710
|
-
setTimeout(() => {
|
|
7711
|
-
isThrottleOnCooldown = false;
|
|
7712
|
-
if (trailingCallArgs) {
|
|
7713
|
-
const nextArgs = trailingCallArgs;
|
|
7714
|
-
trailingCallArgs = null;
|
|
7715
|
-
invokeAction(nextArgs);
|
|
7716
|
-
}
|
|
7717
|
-
}, delayInMilliseconds);
|
|
7718
|
-
};
|
|
7719
|
-
return (...args) => {
|
|
7720
|
-
if (!isThrottleOnCooldown) {
|
|
7721
|
-
invokeAction(args);
|
|
7722
|
-
}
|
|
7723
|
-
else {
|
|
7724
|
-
trailingCallArgs = args;
|
|
7725
|
-
}
|
|
7726
|
-
};
|
|
7727
|
-
}
|
|
7728
|
-
|
|
7729
|
-
/**
|
|
7730
|
-
* This web component is designed to allow users to select a value from a range defined by a minimum and maximum value. The component renders a slider interface, which can be used to visually choose a value between two boundaries.
|
|
7731
|
-
*
|
|
7732
|
-
* @internal
|
|
7733
|
-
*/
|
|
7734
|
-
class SearchcraftSlider {
|
|
7735
|
-
constructor(hostRef) {
|
|
7736
|
-
registerInstance(this, hostRef);
|
|
7737
|
-
this.rangeChanged = createEvent(this, "rangeChanged");
|
|
7738
|
-
}
|
|
7739
|
-
/**
|
|
7740
|
-
* The maximum value allowed.
|
|
7741
|
-
*/
|
|
7742
|
-
max = 100;
|
|
7743
|
-
/**
|
|
7744
|
-
* The minimum value allowed.
|
|
7745
|
-
*/
|
|
7746
|
-
min = 0;
|
|
7747
|
-
/**
|
|
7748
|
-
* The step amount for the slider inputs.
|
|
7749
|
-
*/
|
|
7750
|
-
step = 1;
|
|
7751
|
-
/** The type of data the sliders are using. */
|
|
7752
|
-
dataType = 'number';
|
|
7753
|
-
/** The date granularity to use. Used to format date labels. */
|
|
7754
|
-
dateGranularity;
|
|
7755
|
-
lowerBound = 0;
|
|
7756
|
-
upperBound = 1;
|
|
7757
|
-
endValue = 0;
|
|
7758
|
-
startValue = 0;
|
|
7759
|
-
lastFocusedHandle = 'max';
|
|
7760
|
-
throttledEmitUpdate = () => { };
|
|
7761
|
-
/**
|
|
7762
|
-
* When the range has changed.
|
|
7763
|
-
* */
|
|
7764
|
-
rangeChanged;
|
|
7765
|
-
connectedCallback() {
|
|
7766
|
-
switch (this.dataType) {
|
|
7767
|
-
case 'number':
|
|
7768
|
-
this.startValue = this.min;
|
|
7769
|
-
this.endValue = this.max;
|
|
7770
|
-
this.lowerBound = this.min;
|
|
7771
|
-
this.upperBound = this.max;
|
|
7772
|
-
break;
|
|
7773
|
-
case 'date': {
|
|
7774
|
-
this.startValue = 0;
|
|
7775
|
-
this.endValue = getDifferenceInUnits(this.dateGranularity || 'year', this.min, this.max);
|
|
7776
|
-
this.lowerBound = 0;
|
|
7777
|
-
this.upperBound = this.endValue;
|
|
7778
|
-
break;
|
|
7779
|
-
}
|
|
7780
|
-
}
|
|
7781
|
-
this.throttledEmitUpdate = throttle(this.emitUpdate, 120);
|
|
7782
|
-
}
|
|
7783
|
-
emitUpdate = async () => {
|
|
7784
|
-
switch (this.dataType) {
|
|
7785
|
-
case 'number':
|
|
7786
|
-
this.rangeChanged?.emit({
|
|
7787
|
-
startValue: this.startValue,
|
|
7788
|
-
endValue: this.endValue,
|
|
7789
|
-
});
|
|
7790
|
-
break;
|
|
7791
|
-
case 'date': {
|
|
7792
|
-
const granularity = this.dateGranularity || 'year';
|
|
7793
|
-
const startTimestamp = getStartOf(this.min, granularity, this.lowerBound + this.startValue);
|
|
7794
|
-
const endTimestamp = getStartOf(this.min, granularity, this.lowerBound + this.endValue + 1);
|
|
7795
|
-
this.rangeChanged?.emit({
|
|
7796
|
-
startValue: startTimestamp,
|
|
7797
|
-
endValue: endTimestamp,
|
|
7798
|
-
});
|
|
7799
|
-
break;
|
|
7800
|
-
}
|
|
7801
|
-
}
|
|
7802
|
-
};
|
|
7803
|
-
handleStartValueChange = (event) => {
|
|
7804
|
-
const inputElement = event.target;
|
|
7805
|
-
const value = Number.parseInt(inputElement.value, 10);
|
|
7806
|
-
this.lastFocusedHandle = 'min';
|
|
7807
|
-
if (value <= this.endValue) {
|
|
7808
|
-
this.startValue = value;
|
|
7809
|
-
this.throttledEmitUpdate();
|
|
7810
|
-
}
|
|
7811
|
-
else {
|
|
7812
|
-
this.startValue = this.endValue;
|
|
7813
|
-
inputElement.value = `${this.endValue}`;
|
|
7814
|
-
}
|
|
7815
|
-
};
|
|
7816
|
-
handleEndValueChange = (event) => {
|
|
7817
|
-
const inputElement = event.target;
|
|
7818
|
-
const value = Number.parseInt(inputElement.value, 10);
|
|
7819
|
-
this.lastFocusedHandle = 'max';
|
|
7820
|
-
if (value >= this.startValue) {
|
|
7821
|
-
this.endValue = value;
|
|
7822
|
-
this.throttledEmitUpdate();
|
|
7823
|
-
}
|
|
7824
|
-
else {
|
|
7825
|
-
this.endValue = this.startValue;
|
|
7826
|
-
inputElement.value = `${this.startValue}`;
|
|
7827
|
-
}
|
|
7828
|
-
};
|
|
7829
|
-
getLabel = (value) => {
|
|
7830
|
-
switch (this.dataType) {
|
|
7831
|
-
case 'number':
|
|
7832
|
-
return `${this.startValue}`;
|
|
7833
|
-
case 'date': {
|
|
7834
|
-
const granularity = this.dateGranularity || 'year';
|
|
7835
|
-
const dateOffset = this.lowerBound + value;
|
|
7836
|
-
const timestamp = getStartOf(this.min, granularity, dateOffset);
|
|
7837
|
-
return getFormattedDateString(this.dateGranularity || 'year', new Date(timestamp));
|
|
7838
|
-
}
|
|
7839
|
-
}
|
|
7840
|
-
};
|
|
7841
|
-
render() {
|
|
7842
|
-
const startPercent = ((this.startValue - this.lowerBound) /
|
|
7843
|
-
(this.upperBound - this.lowerBound)) *
|
|
7844
|
-
100;
|
|
7845
|
-
const endPercent = ((this.endValue - this.lowerBound) /
|
|
7846
|
-
(this.upperBound - this.lowerBound)) *
|
|
7847
|
-
100;
|
|
7848
|
-
const startLabel = this.getLabel(this.startValue);
|
|
7849
|
-
const endLabel = this.getLabel(this.endValue);
|
|
7850
|
-
return (hAsync("div", { key: 'd5035ed8bcbf95c0ef5b2a7a9ef471e318a9dc30', class: 'searchcraft-slider' }, hAsync("div", { key: 'f5f7bc48703250b4f6c75a1f07c921233bd957d5', class: 'searchcraft-slider-range' }, hAsync("div", { key: 'fc2ec9f9786986a7306ffe43b54c47c35a1f086a', class: 'searchcraft-slider-active-range', style: {
|
|
7851
|
-
left: `${startPercent}%`,
|
|
7852
|
-
width: `${endPercent - startPercent}%`,
|
|
7853
|
-
} }), hAsync("input", { key: '716316b5ce507c40db5b7bd408f47b3bece88494', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-min-handle'), max: this.upperBound, min: this.lowerBound, onInput: this.handleStartValueChange.bind(this), step: this.step, style: { zIndex: this.lastFocusedHandle === 'min' ? '2' : '1' }, type: 'range', value: this.startValue }), hAsync("input", { key: 'e2ad0d586136185faccb50d6d7fb113a64ddac42', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-max-handle'), max: this.upperBound, min: this.lowerBound, onInput: this.handleEndValueChange.bind(this), step: this.step, style: { zIndex: this.lastFocusedHandle === 'max' ? '2' : '1' }, type: 'range', value: this.endValue })), hAsync("div", { key: '7e9ab9fa9563cac6a1dfdd11910e04084ae5348d', class: 'searchcraft-slider-label' }, hAsync("span", { key: '0909279f460c4be84c1088c5981a5f5299e8e2a0', class: 'searchcraft-slider-start-label' }, startLabel), hAsync("span", { key: '4b610a68f97fcbc0aa1eda428dfa1e53b00efe43', class: 'searchcraft-slider-end-label' }, endLabel))));
|
|
7854
|
-
}
|
|
7855
|
-
static get cmpMeta() { return {
|
|
7856
|
-
"$flags$": 768,
|
|
7857
|
-
"$tagName$": "searchcraft-slider",
|
|
7858
|
-
"$members$": {
|
|
7859
|
-
"max": [2],
|
|
7860
|
-
"min": [2],
|
|
7861
|
-
"step": [2],
|
|
7862
|
-
"dataType": [1, "data-type"],
|
|
7863
|
-
"dateGranularity": [1, "date-granularity"],
|
|
7864
|
-
"lowerBound": [32],
|
|
7865
|
-
"upperBound": [32],
|
|
7866
|
-
"endValue": [32],
|
|
7867
|
-
"startValue": [32],
|
|
7868
|
-
"lastFocusedHandle": [32]
|
|
7869
|
-
},
|
|
7870
|
-
"$listeners$": undefined,
|
|
7871
|
-
"$lazyBundleId$": "-",
|
|
7872
|
-
"$attrsToReflect$": []
|
|
7873
|
-
}; }
|
|
7874
|
-
}
|
|
7875
|
-
|
|
7876
|
-
/**
|
|
7877
|
-
* marked v15.0.12 - a markdown parser
|
|
7878
|
-
* Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
|
|
7879
|
-
* https://github.com/markedjs/marked
|
|
7880
|
-
*/
|
|
7881
|
-
|
|
7882
|
-
/**
|
|
7883
|
-
* DO NOT EDIT THIS FILE
|
|
7884
|
-
* The code in this file is generated from files in ./src/
|
|
7378
|
+
* DO NOT EDIT THIS FILE
|
|
7379
|
+
* The code in this file is generated from files in ./src/
|
|
7885
7380
|
*/
|
|
7886
7381
|
|
|
7887
7382
|
|
|
@@ -8635,1404 +8130,2226 @@ ${currentText}` : currentText;
|
|
|
8635
8130
|
};
|
|
8636
8131
|
}));
|
|
8637
8132
|
}
|
|
8638
|
-
return item;
|
|
8133
|
+
return item;
|
|
8134
|
+
}
|
|
8135
|
+
lheading(src) {
|
|
8136
|
+
const cap = this.rules.block.lheading.exec(src);
|
|
8137
|
+
if (cap) {
|
|
8138
|
+
return {
|
|
8139
|
+
type: "heading",
|
|
8140
|
+
raw: cap[0],
|
|
8141
|
+
depth: cap[2].charAt(0) === "=" ? 1 : 2,
|
|
8142
|
+
text: cap[1],
|
|
8143
|
+
tokens: this.lexer.inline(cap[1])
|
|
8144
|
+
};
|
|
8145
|
+
}
|
|
8146
|
+
}
|
|
8147
|
+
paragraph(src) {
|
|
8148
|
+
const cap = this.rules.block.paragraph.exec(src);
|
|
8149
|
+
if (cap) {
|
|
8150
|
+
const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
|
|
8151
|
+
return {
|
|
8152
|
+
type: "paragraph",
|
|
8153
|
+
raw: cap[0],
|
|
8154
|
+
text,
|
|
8155
|
+
tokens: this.lexer.inline(text)
|
|
8156
|
+
};
|
|
8157
|
+
}
|
|
8158
|
+
}
|
|
8159
|
+
text(src) {
|
|
8160
|
+
const cap = this.rules.block.text.exec(src);
|
|
8161
|
+
if (cap) {
|
|
8162
|
+
return {
|
|
8163
|
+
type: "text",
|
|
8164
|
+
raw: cap[0],
|
|
8165
|
+
text: cap[0],
|
|
8166
|
+
tokens: this.lexer.inline(cap[0])
|
|
8167
|
+
};
|
|
8168
|
+
}
|
|
8169
|
+
}
|
|
8170
|
+
escape(src) {
|
|
8171
|
+
const cap = this.rules.inline.escape.exec(src);
|
|
8172
|
+
if (cap) {
|
|
8173
|
+
return {
|
|
8174
|
+
type: "escape",
|
|
8175
|
+
raw: cap[0],
|
|
8176
|
+
text: cap[1]
|
|
8177
|
+
};
|
|
8178
|
+
}
|
|
8179
|
+
}
|
|
8180
|
+
tag(src) {
|
|
8181
|
+
const cap = this.rules.inline.tag.exec(src);
|
|
8182
|
+
if (cap) {
|
|
8183
|
+
if (!this.lexer.state.inLink && this.rules.other.startATag.test(cap[0])) {
|
|
8184
|
+
this.lexer.state.inLink = true;
|
|
8185
|
+
} else if (this.lexer.state.inLink && this.rules.other.endATag.test(cap[0])) {
|
|
8186
|
+
this.lexer.state.inLink = false;
|
|
8187
|
+
}
|
|
8188
|
+
if (!this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(cap[0])) {
|
|
8189
|
+
this.lexer.state.inRawBlock = true;
|
|
8190
|
+
} else if (this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(cap[0])) {
|
|
8191
|
+
this.lexer.state.inRawBlock = false;
|
|
8192
|
+
}
|
|
8193
|
+
return {
|
|
8194
|
+
type: "html",
|
|
8195
|
+
raw: cap[0],
|
|
8196
|
+
inLink: this.lexer.state.inLink,
|
|
8197
|
+
inRawBlock: this.lexer.state.inRawBlock,
|
|
8198
|
+
block: false,
|
|
8199
|
+
text: cap[0]
|
|
8200
|
+
};
|
|
8201
|
+
}
|
|
8202
|
+
}
|
|
8203
|
+
link(src) {
|
|
8204
|
+
const cap = this.rules.inline.link.exec(src);
|
|
8205
|
+
if (cap) {
|
|
8206
|
+
const trimmedUrl = cap[2].trim();
|
|
8207
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(trimmedUrl)) {
|
|
8208
|
+
if (!this.rules.other.endAngleBracket.test(trimmedUrl)) {
|
|
8209
|
+
return;
|
|
8210
|
+
}
|
|
8211
|
+
const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
|
|
8212
|
+
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
|
8213
|
+
return;
|
|
8214
|
+
}
|
|
8215
|
+
} else {
|
|
8216
|
+
const lastParenIndex = findClosingBracket(cap[2], "()");
|
|
8217
|
+
if (lastParenIndex === -2) {
|
|
8218
|
+
return;
|
|
8219
|
+
}
|
|
8220
|
+
if (lastParenIndex > -1) {
|
|
8221
|
+
const start = cap[0].indexOf("!") === 0 ? 5 : 4;
|
|
8222
|
+
const linkLen = start + cap[1].length + lastParenIndex;
|
|
8223
|
+
cap[2] = cap[2].substring(0, lastParenIndex);
|
|
8224
|
+
cap[0] = cap[0].substring(0, linkLen).trim();
|
|
8225
|
+
cap[3] = "";
|
|
8226
|
+
}
|
|
8227
|
+
}
|
|
8228
|
+
let href = cap[2];
|
|
8229
|
+
let title = "";
|
|
8230
|
+
if (this.options.pedantic) {
|
|
8231
|
+
const link2 = this.rules.other.pedanticHrefTitle.exec(href);
|
|
8232
|
+
if (link2) {
|
|
8233
|
+
href = link2[1];
|
|
8234
|
+
title = link2[3];
|
|
8235
|
+
}
|
|
8236
|
+
} else {
|
|
8237
|
+
title = cap[3] ? cap[3].slice(1, -1) : "";
|
|
8238
|
+
}
|
|
8239
|
+
href = href.trim();
|
|
8240
|
+
if (this.rules.other.startAngleBracket.test(href)) {
|
|
8241
|
+
if (this.options.pedantic && !this.rules.other.endAngleBracket.test(trimmedUrl)) {
|
|
8242
|
+
href = href.slice(1);
|
|
8243
|
+
} else {
|
|
8244
|
+
href = href.slice(1, -1);
|
|
8245
|
+
}
|
|
8246
|
+
}
|
|
8247
|
+
return outputLink(cap, {
|
|
8248
|
+
href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
|
|
8249
|
+
title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
|
|
8250
|
+
}, cap[0], this.lexer, this.rules);
|
|
8251
|
+
}
|
|
8252
|
+
}
|
|
8253
|
+
reflink(src, links) {
|
|
8254
|
+
let cap;
|
|
8255
|
+
if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
|
|
8256
|
+
const linkString = (cap[2] || cap[1]).replace(this.rules.other.multipleSpaceGlobal, " ");
|
|
8257
|
+
const link2 = links[linkString.toLowerCase()];
|
|
8258
|
+
if (!link2) {
|
|
8259
|
+
const text = cap[0].charAt(0);
|
|
8260
|
+
return {
|
|
8261
|
+
type: "text",
|
|
8262
|
+
raw: text,
|
|
8263
|
+
text
|
|
8264
|
+
};
|
|
8265
|
+
}
|
|
8266
|
+
return outputLink(cap, link2, cap[0], this.lexer, this.rules);
|
|
8267
|
+
}
|
|
8268
|
+
}
|
|
8269
|
+
emStrong(src, maskedSrc, prevChar = "") {
|
|
8270
|
+
let match = this.rules.inline.emStrongLDelim.exec(src);
|
|
8271
|
+
if (!match) return;
|
|
8272
|
+
if (match[3] && prevChar.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
8273
|
+
const nextChar = match[1] || match[2] || "";
|
|
8274
|
+
if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
|
|
8275
|
+
const lLength = [...match[0]].length - 1;
|
|
8276
|
+
let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
|
|
8277
|
+
const endReg = match[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
8278
|
+
endReg.lastIndex = 0;
|
|
8279
|
+
maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
|
8280
|
+
while ((match = endReg.exec(maskedSrc)) != null) {
|
|
8281
|
+
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
|
8282
|
+
if (!rDelim) continue;
|
|
8283
|
+
rLength = [...rDelim].length;
|
|
8284
|
+
if (match[3] || match[4]) {
|
|
8285
|
+
delimTotal += rLength;
|
|
8286
|
+
continue;
|
|
8287
|
+
} else if (match[5] || match[6]) {
|
|
8288
|
+
if (lLength % 3 && !((lLength + rLength) % 3)) {
|
|
8289
|
+
midDelimTotal += rLength;
|
|
8290
|
+
continue;
|
|
8291
|
+
}
|
|
8292
|
+
}
|
|
8293
|
+
delimTotal -= rLength;
|
|
8294
|
+
if (delimTotal > 0) continue;
|
|
8295
|
+
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
|
8296
|
+
const lastCharLength = [...match[0]][0].length;
|
|
8297
|
+
const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
|
|
8298
|
+
if (Math.min(lLength, rLength) % 2) {
|
|
8299
|
+
const text2 = raw.slice(1, -1);
|
|
8300
|
+
return {
|
|
8301
|
+
type: "em",
|
|
8302
|
+
raw,
|
|
8303
|
+
text: text2,
|
|
8304
|
+
tokens: this.lexer.inlineTokens(text2)
|
|
8305
|
+
};
|
|
8306
|
+
}
|
|
8307
|
+
const text = raw.slice(2, -2);
|
|
8308
|
+
return {
|
|
8309
|
+
type: "strong",
|
|
8310
|
+
raw,
|
|
8311
|
+
text,
|
|
8312
|
+
tokens: this.lexer.inlineTokens(text)
|
|
8313
|
+
};
|
|
8314
|
+
}
|
|
8315
|
+
}
|
|
8316
|
+
}
|
|
8317
|
+
codespan(src) {
|
|
8318
|
+
const cap = this.rules.inline.code.exec(src);
|
|
8319
|
+
if (cap) {
|
|
8320
|
+
let text = cap[2].replace(this.rules.other.newLineCharGlobal, " ");
|
|
8321
|
+
const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text);
|
|
8322
|
+
const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
|
|
8323
|
+
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
8324
|
+
text = text.substring(1, text.length - 1);
|
|
8325
|
+
}
|
|
8326
|
+
return {
|
|
8327
|
+
type: "codespan",
|
|
8328
|
+
raw: cap[0],
|
|
8329
|
+
text
|
|
8330
|
+
};
|
|
8331
|
+
}
|
|
8639
8332
|
}
|
|
8640
|
-
|
|
8641
|
-
const cap = this.rules.
|
|
8333
|
+
br(src) {
|
|
8334
|
+
const cap = this.rules.inline.br.exec(src);
|
|
8642
8335
|
if (cap) {
|
|
8643
8336
|
return {
|
|
8644
|
-
type: "
|
|
8337
|
+
type: "br",
|
|
8338
|
+
raw: cap[0]
|
|
8339
|
+
};
|
|
8340
|
+
}
|
|
8341
|
+
}
|
|
8342
|
+
del(src) {
|
|
8343
|
+
const cap = this.rules.inline.del.exec(src);
|
|
8344
|
+
if (cap) {
|
|
8345
|
+
return {
|
|
8346
|
+
type: "del",
|
|
8645
8347
|
raw: cap[0],
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
tokens: this.lexer.inline(cap[1])
|
|
8348
|
+
text: cap[2],
|
|
8349
|
+
tokens: this.lexer.inlineTokens(cap[2])
|
|
8649
8350
|
};
|
|
8650
8351
|
}
|
|
8651
8352
|
}
|
|
8652
|
-
|
|
8653
|
-
const cap = this.rules.
|
|
8353
|
+
autolink(src) {
|
|
8354
|
+
const cap = this.rules.inline.autolink.exec(src);
|
|
8654
8355
|
if (cap) {
|
|
8655
|
-
|
|
8356
|
+
let text, href;
|
|
8357
|
+
if (cap[2] === "@") {
|
|
8358
|
+
text = cap[1];
|
|
8359
|
+
href = "mailto:" + text;
|
|
8360
|
+
} else {
|
|
8361
|
+
text = cap[1];
|
|
8362
|
+
href = text;
|
|
8363
|
+
}
|
|
8656
8364
|
return {
|
|
8657
|
-
type: "
|
|
8365
|
+
type: "link",
|
|
8658
8366
|
raw: cap[0],
|
|
8659
8367
|
text,
|
|
8660
|
-
|
|
8368
|
+
href,
|
|
8369
|
+
tokens: [
|
|
8370
|
+
{
|
|
8371
|
+
type: "text",
|
|
8372
|
+
raw: text,
|
|
8373
|
+
text
|
|
8374
|
+
}
|
|
8375
|
+
]
|
|
8661
8376
|
};
|
|
8662
8377
|
}
|
|
8663
8378
|
}
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
if (cap) {
|
|
8379
|
+
url(src) {
|
|
8380
|
+
let cap;
|
|
8381
|
+
if (cap = this.rules.inline.url.exec(src)) {
|
|
8382
|
+
let text, href;
|
|
8383
|
+
if (cap[2] === "@") {
|
|
8384
|
+
text = cap[0];
|
|
8385
|
+
href = "mailto:" + text;
|
|
8386
|
+
} else {
|
|
8387
|
+
let prevCapZero;
|
|
8388
|
+
do {
|
|
8389
|
+
prevCapZero = cap[0];
|
|
8390
|
+
cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? "";
|
|
8391
|
+
} while (prevCapZero !== cap[0]);
|
|
8392
|
+
text = cap[0];
|
|
8393
|
+
if (cap[1] === "www.") {
|
|
8394
|
+
href = "http://" + cap[0];
|
|
8395
|
+
} else {
|
|
8396
|
+
href = cap[0];
|
|
8397
|
+
}
|
|
8398
|
+
}
|
|
8667
8399
|
return {
|
|
8668
|
-
type: "
|
|
8400
|
+
type: "link",
|
|
8669
8401
|
raw: cap[0],
|
|
8670
|
-
text
|
|
8671
|
-
|
|
8402
|
+
text,
|
|
8403
|
+
href,
|
|
8404
|
+
tokens: [
|
|
8405
|
+
{
|
|
8406
|
+
type: "text",
|
|
8407
|
+
raw: text,
|
|
8408
|
+
text
|
|
8409
|
+
}
|
|
8410
|
+
]
|
|
8672
8411
|
};
|
|
8673
8412
|
}
|
|
8674
8413
|
}
|
|
8675
|
-
|
|
8676
|
-
const cap = this.rules.inline.
|
|
8414
|
+
inlineText(src) {
|
|
8415
|
+
const cap = this.rules.inline.text.exec(src);
|
|
8677
8416
|
if (cap) {
|
|
8417
|
+
const escaped = this.lexer.state.inRawBlock;
|
|
8678
8418
|
return {
|
|
8679
|
-
type: "
|
|
8419
|
+
type: "text",
|
|
8680
8420
|
raw: cap[0],
|
|
8681
|
-
text: cap[
|
|
8421
|
+
text: cap[0],
|
|
8422
|
+
escaped
|
|
8682
8423
|
};
|
|
8683
8424
|
}
|
|
8684
8425
|
}
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8426
|
+
};
|
|
8427
|
+
|
|
8428
|
+
// src/Lexer.ts
|
|
8429
|
+
var _Lexer = class __Lexer {
|
|
8430
|
+
tokens;
|
|
8431
|
+
options;
|
|
8432
|
+
state;
|
|
8433
|
+
tokenizer;
|
|
8434
|
+
inlineQueue;
|
|
8435
|
+
constructor(options2) {
|
|
8436
|
+
this.tokens = [];
|
|
8437
|
+
this.tokens.links = /* @__PURE__ */ Object.create(null);
|
|
8438
|
+
this.options = options2 || _defaults;
|
|
8439
|
+
this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
|
|
8440
|
+
this.tokenizer = this.options.tokenizer;
|
|
8441
|
+
this.tokenizer.options = this.options;
|
|
8442
|
+
this.tokenizer.lexer = this;
|
|
8443
|
+
this.inlineQueue = [];
|
|
8444
|
+
this.state = {
|
|
8445
|
+
inLink: false,
|
|
8446
|
+
inRawBlock: false,
|
|
8447
|
+
top: true
|
|
8448
|
+
};
|
|
8449
|
+
const rules = {
|
|
8450
|
+
other,
|
|
8451
|
+
block: block.normal,
|
|
8452
|
+
inline: inline.normal
|
|
8453
|
+
};
|
|
8454
|
+
if (this.options.pedantic) {
|
|
8455
|
+
rules.block = block.pedantic;
|
|
8456
|
+
rules.inline = inline.pedantic;
|
|
8457
|
+
} else if (this.options.gfm) {
|
|
8458
|
+
rules.block = block.gfm;
|
|
8459
|
+
if (this.options.breaks) {
|
|
8460
|
+
rules.inline = inline.breaks;
|
|
8461
|
+
} else {
|
|
8462
|
+
rules.inline = inline.gfm;
|
|
8463
|
+
}
|
|
8464
|
+
}
|
|
8465
|
+
this.tokenizer.rules = rules;
|
|
8466
|
+
}
|
|
8467
|
+
/**
|
|
8468
|
+
* Expose Rules
|
|
8469
|
+
*/
|
|
8470
|
+
static get rules() {
|
|
8471
|
+
return {
|
|
8472
|
+
block,
|
|
8473
|
+
inline
|
|
8474
|
+
};
|
|
8475
|
+
}
|
|
8476
|
+
/**
|
|
8477
|
+
* Static Lex Method
|
|
8478
|
+
*/
|
|
8479
|
+
static lex(src, options2) {
|
|
8480
|
+
const lexer2 = new __Lexer(options2);
|
|
8481
|
+
return lexer2.lex(src);
|
|
8482
|
+
}
|
|
8483
|
+
/**
|
|
8484
|
+
* Static Lex Inline Method
|
|
8485
|
+
*/
|
|
8486
|
+
static lexInline(src, options2) {
|
|
8487
|
+
const lexer2 = new __Lexer(options2);
|
|
8488
|
+
return lexer2.inlineTokens(src);
|
|
8489
|
+
}
|
|
8490
|
+
/**
|
|
8491
|
+
* Preprocessing
|
|
8492
|
+
*/
|
|
8493
|
+
lex(src) {
|
|
8494
|
+
src = src.replace(other.carriageReturn, "\n");
|
|
8495
|
+
this.blockTokens(src, this.tokens);
|
|
8496
|
+
for (let i = 0; i < this.inlineQueue.length; i++) {
|
|
8497
|
+
const next = this.inlineQueue[i];
|
|
8498
|
+
this.inlineTokens(next.src, next.tokens);
|
|
8499
|
+
}
|
|
8500
|
+
this.inlineQueue = [];
|
|
8501
|
+
return this.tokens;
|
|
8502
|
+
}
|
|
8503
|
+
blockTokens(src, tokens = [], lastParagraphClipped = false) {
|
|
8504
|
+
if (this.options.pedantic) {
|
|
8505
|
+
src = src.replace(other.tabCharGlobal, " ").replace(other.spaceLine, "");
|
|
8506
|
+
}
|
|
8507
|
+
while (src) {
|
|
8508
|
+
let token;
|
|
8509
|
+
if (this.options.extensions?.block?.some((extTokenizer) => {
|
|
8510
|
+
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
8511
|
+
src = src.substring(token.raw.length);
|
|
8512
|
+
tokens.push(token);
|
|
8513
|
+
return true;
|
|
8514
|
+
}
|
|
8515
|
+
return false;
|
|
8516
|
+
})) {
|
|
8517
|
+
continue;
|
|
8518
|
+
}
|
|
8519
|
+
if (token = this.tokenizer.space(src)) {
|
|
8520
|
+
src = src.substring(token.raw.length);
|
|
8521
|
+
const lastToken = tokens.at(-1);
|
|
8522
|
+
if (token.raw.length === 1 && lastToken !== void 0) {
|
|
8523
|
+
lastToken.raw += "\n";
|
|
8524
|
+
} else {
|
|
8525
|
+
tokens.push(token);
|
|
8526
|
+
}
|
|
8527
|
+
continue;
|
|
8528
|
+
}
|
|
8529
|
+
if (token = this.tokenizer.code(src)) {
|
|
8530
|
+
src = src.substring(token.raw.length);
|
|
8531
|
+
const lastToken = tokens.at(-1);
|
|
8532
|
+
if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
|
|
8533
|
+
lastToken.raw += "\n" + token.raw;
|
|
8534
|
+
lastToken.text += "\n" + token.text;
|
|
8535
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
8536
|
+
} else {
|
|
8537
|
+
tokens.push(token);
|
|
8538
|
+
}
|
|
8539
|
+
continue;
|
|
8540
|
+
}
|
|
8541
|
+
if (token = this.tokenizer.fences(src)) {
|
|
8542
|
+
src = src.substring(token.raw.length);
|
|
8543
|
+
tokens.push(token);
|
|
8544
|
+
continue;
|
|
8545
|
+
}
|
|
8546
|
+
if (token = this.tokenizer.heading(src)) {
|
|
8547
|
+
src = src.substring(token.raw.length);
|
|
8548
|
+
tokens.push(token);
|
|
8549
|
+
continue;
|
|
8550
|
+
}
|
|
8551
|
+
if (token = this.tokenizer.hr(src)) {
|
|
8552
|
+
src = src.substring(token.raw.length);
|
|
8553
|
+
tokens.push(token);
|
|
8554
|
+
continue;
|
|
8555
|
+
}
|
|
8556
|
+
if (token = this.tokenizer.blockquote(src)) {
|
|
8557
|
+
src = src.substring(token.raw.length);
|
|
8558
|
+
tokens.push(token);
|
|
8559
|
+
continue;
|
|
8560
|
+
}
|
|
8561
|
+
if (token = this.tokenizer.list(src)) {
|
|
8562
|
+
src = src.substring(token.raw.length);
|
|
8563
|
+
tokens.push(token);
|
|
8564
|
+
continue;
|
|
8565
|
+
}
|
|
8566
|
+
if (token = this.tokenizer.html(src)) {
|
|
8567
|
+
src = src.substring(token.raw.length);
|
|
8568
|
+
tokens.push(token);
|
|
8569
|
+
continue;
|
|
8570
|
+
}
|
|
8571
|
+
if (token = this.tokenizer.def(src)) {
|
|
8572
|
+
src = src.substring(token.raw.length);
|
|
8573
|
+
const lastToken = tokens.at(-1);
|
|
8574
|
+
if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
|
|
8575
|
+
lastToken.raw += "\n" + token.raw;
|
|
8576
|
+
lastToken.text += "\n" + token.raw;
|
|
8577
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
8578
|
+
} else if (!this.tokens.links[token.tag]) {
|
|
8579
|
+
this.tokens.links[token.tag] = {
|
|
8580
|
+
href: token.href,
|
|
8581
|
+
title: token.title
|
|
8582
|
+
};
|
|
8583
|
+
}
|
|
8584
|
+
continue;
|
|
8692
8585
|
}
|
|
8693
|
-
if (
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8586
|
+
if (token = this.tokenizer.table(src)) {
|
|
8587
|
+
src = src.substring(token.raw.length);
|
|
8588
|
+
tokens.push(token);
|
|
8589
|
+
continue;
|
|
8697
8590
|
}
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
|
|
8717
|
-
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
|
8718
|
-
return;
|
|
8719
|
-
}
|
|
8720
|
-
} else {
|
|
8721
|
-
const lastParenIndex = findClosingBracket(cap[2], "()");
|
|
8722
|
-
if (lastParenIndex === -2) {
|
|
8723
|
-
return;
|
|
8591
|
+
if (token = this.tokenizer.lheading(src)) {
|
|
8592
|
+
src = src.substring(token.raw.length);
|
|
8593
|
+
tokens.push(token);
|
|
8594
|
+
continue;
|
|
8595
|
+
}
|
|
8596
|
+
let cutSrc = src;
|
|
8597
|
+
if (this.options.extensions?.startBlock) {
|
|
8598
|
+
let startIndex = Infinity;
|
|
8599
|
+
const tempSrc = src.slice(1);
|
|
8600
|
+
let tempStart;
|
|
8601
|
+
this.options.extensions.startBlock.forEach((getStartIndex) => {
|
|
8602
|
+
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
8603
|
+
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
8604
|
+
startIndex = Math.min(startIndex, tempStart);
|
|
8605
|
+
}
|
|
8606
|
+
});
|
|
8607
|
+
if (startIndex < Infinity && startIndex >= 0) {
|
|
8608
|
+
cutSrc = src.substring(0, startIndex + 1);
|
|
8724
8609
|
}
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8610
|
+
}
|
|
8611
|
+
if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
|
8612
|
+
const lastToken = tokens.at(-1);
|
|
8613
|
+
if (lastParagraphClipped && lastToken?.type === "paragraph") {
|
|
8614
|
+
lastToken.raw += "\n" + token.raw;
|
|
8615
|
+
lastToken.text += "\n" + token.text;
|
|
8616
|
+
this.inlineQueue.pop();
|
|
8617
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
8618
|
+
} else {
|
|
8619
|
+
tokens.push(token);
|
|
8731
8620
|
}
|
|
8621
|
+
lastParagraphClipped = cutSrc.length !== src.length;
|
|
8622
|
+
src = src.substring(token.raw.length);
|
|
8623
|
+
continue;
|
|
8732
8624
|
}
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8625
|
+
if (token = this.tokenizer.text(src)) {
|
|
8626
|
+
src = src.substring(token.raw.length);
|
|
8627
|
+
const lastToken = tokens.at(-1);
|
|
8628
|
+
if (lastToken?.type === "text") {
|
|
8629
|
+
lastToken.raw += "\n" + token.raw;
|
|
8630
|
+
lastToken.text += "\n" + token.text;
|
|
8631
|
+
this.inlineQueue.pop();
|
|
8632
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
8633
|
+
} else {
|
|
8634
|
+
tokens.push(token);
|
|
8740
8635
|
}
|
|
8741
|
-
|
|
8742
|
-
title = cap[3] ? cap[3].slice(1, -1) : "";
|
|
8636
|
+
continue;
|
|
8743
8637
|
}
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
if (this.options.
|
|
8747
|
-
|
|
8638
|
+
if (src) {
|
|
8639
|
+
const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
8640
|
+
if (this.options.silent) {
|
|
8641
|
+
console.error(errMsg);
|
|
8642
|
+
break;
|
|
8748
8643
|
} else {
|
|
8749
|
-
|
|
8644
|
+
throw new Error(errMsg);
|
|
8750
8645
|
}
|
|
8751
8646
|
}
|
|
8752
|
-
return outputLink(cap, {
|
|
8753
|
-
href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
|
|
8754
|
-
title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
|
|
8755
|
-
}, cap[0], this.lexer, this.rules);
|
|
8756
8647
|
}
|
|
8648
|
+
this.state.top = true;
|
|
8649
|
+
return tokens;
|
|
8757
8650
|
}
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8651
|
+
inline(src, tokens = []) {
|
|
8652
|
+
this.inlineQueue.push({ src, tokens });
|
|
8653
|
+
return tokens;
|
|
8654
|
+
}
|
|
8655
|
+
/**
|
|
8656
|
+
* Lexing/Compiling
|
|
8657
|
+
*/
|
|
8658
|
+
inlineTokens(src, tokens = []) {
|
|
8659
|
+
let maskedSrc = src;
|
|
8660
|
+
let match = null;
|
|
8661
|
+
if (this.tokens.links) {
|
|
8662
|
+
const links = Object.keys(this.tokens.links);
|
|
8663
|
+
if (links.length > 0) {
|
|
8664
|
+
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
|
8665
|
+
if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
|
|
8666
|
+
maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
|
8667
|
+
}
|
|
8668
|
+
}
|
|
8770
8669
|
}
|
|
8771
|
-
return outputLink(cap, link2, cap[0], this.lexer, this.rules);
|
|
8772
8670
|
}
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
}
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8671
|
+
while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
|
|
8672
|
+
maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
8673
|
+
}
|
|
8674
|
+
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
|
8675
|
+
maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
8676
|
+
}
|
|
8677
|
+
let keepPrevChar = false;
|
|
8678
|
+
let prevChar = "";
|
|
8679
|
+
while (src) {
|
|
8680
|
+
if (!keepPrevChar) {
|
|
8681
|
+
prevChar = "";
|
|
8682
|
+
}
|
|
8683
|
+
keepPrevChar = false;
|
|
8684
|
+
let token;
|
|
8685
|
+
if (this.options.extensions?.inline?.some((extTokenizer) => {
|
|
8686
|
+
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
8687
|
+
src = src.substring(token.raw.length);
|
|
8688
|
+
tokens.push(token);
|
|
8689
|
+
return true;
|
|
8690
|
+
}
|
|
8691
|
+
return false;
|
|
8692
|
+
})) {
|
|
8693
|
+
continue;
|
|
8694
|
+
}
|
|
8695
|
+
if (token = this.tokenizer.escape(src)) {
|
|
8696
|
+
src = src.substring(token.raw.length);
|
|
8697
|
+
tokens.push(token);
|
|
8698
|
+
continue;
|
|
8699
|
+
}
|
|
8700
|
+
if (token = this.tokenizer.tag(src)) {
|
|
8701
|
+
src = src.substring(token.raw.length);
|
|
8702
|
+
tokens.push(token);
|
|
8703
|
+
continue;
|
|
8704
|
+
}
|
|
8705
|
+
if (token = this.tokenizer.link(src)) {
|
|
8706
|
+
src = src.substring(token.raw.length);
|
|
8707
|
+
tokens.push(token);
|
|
8708
|
+
continue;
|
|
8709
|
+
}
|
|
8710
|
+
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
|
8711
|
+
src = src.substring(token.raw.length);
|
|
8712
|
+
const lastToken = tokens.at(-1);
|
|
8713
|
+
if (token.type === "text" && lastToken?.type === "text") {
|
|
8714
|
+
lastToken.raw += token.raw;
|
|
8715
|
+
lastToken.text += token.text;
|
|
8716
|
+
} else {
|
|
8717
|
+
tokens.push(token);
|
|
8718
|
+
}
|
|
8719
|
+
continue;
|
|
8720
|
+
}
|
|
8721
|
+
if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
|
8722
|
+
src = src.substring(token.raw.length);
|
|
8723
|
+
tokens.push(token);
|
|
8724
|
+
continue;
|
|
8725
|
+
}
|
|
8726
|
+
if (token = this.tokenizer.codespan(src)) {
|
|
8727
|
+
src = src.substring(token.raw.length);
|
|
8728
|
+
tokens.push(token);
|
|
8729
|
+
continue;
|
|
8730
|
+
}
|
|
8731
|
+
if (token = this.tokenizer.br(src)) {
|
|
8732
|
+
src = src.substring(token.raw.length);
|
|
8733
|
+
tokens.push(token);
|
|
8734
|
+
continue;
|
|
8735
|
+
}
|
|
8736
|
+
if (token = this.tokenizer.del(src)) {
|
|
8737
|
+
src = src.substring(token.raw.length);
|
|
8738
|
+
tokens.push(token);
|
|
8739
|
+
continue;
|
|
8740
|
+
}
|
|
8741
|
+
if (token = this.tokenizer.autolink(src)) {
|
|
8742
|
+
src = src.substring(token.raw.length);
|
|
8743
|
+
tokens.push(token);
|
|
8744
|
+
continue;
|
|
8745
|
+
}
|
|
8746
|
+
if (!this.state.inLink && (token = this.tokenizer.url(src))) {
|
|
8747
|
+
src = src.substring(token.raw.length);
|
|
8748
|
+
tokens.push(token);
|
|
8749
|
+
continue;
|
|
8750
|
+
}
|
|
8751
|
+
let cutSrc = src;
|
|
8752
|
+
if (this.options.extensions?.startInline) {
|
|
8753
|
+
let startIndex = Infinity;
|
|
8754
|
+
const tempSrc = src.slice(1);
|
|
8755
|
+
let tempStart;
|
|
8756
|
+
this.options.extensions.startInline.forEach((getStartIndex) => {
|
|
8757
|
+
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
8758
|
+
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
8759
|
+
startIndex = Math.min(startIndex, tempStart);
|
|
8796
8760
|
}
|
|
8761
|
+
});
|
|
8762
|
+
if (startIndex < Infinity && startIndex >= 0) {
|
|
8763
|
+
cutSrc = src.substring(0, startIndex + 1);
|
|
8764
|
+
}
|
|
8765
|
+
}
|
|
8766
|
+
if (token = this.tokenizer.inlineText(cutSrc)) {
|
|
8767
|
+
src = src.substring(token.raw.length);
|
|
8768
|
+
if (token.raw.slice(-1) !== "_") {
|
|
8769
|
+
prevChar = token.raw.slice(-1);
|
|
8797
8770
|
}
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
return {
|
|
8806
|
-
type: "em",
|
|
8807
|
-
raw,
|
|
8808
|
-
text: text2,
|
|
8809
|
-
tokens: this.lexer.inlineTokens(text2)
|
|
8810
|
-
};
|
|
8771
|
+
keepPrevChar = true;
|
|
8772
|
+
const lastToken = tokens.at(-1);
|
|
8773
|
+
if (lastToken?.type === "text") {
|
|
8774
|
+
lastToken.raw += token.raw;
|
|
8775
|
+
lastToken.text += token.text;
|
|
8776
|
+
} else {
|
|
8777
|
+
tokens.push(token);
|
|
8811
8778
|
}
|
|
8812
|
-
|
|
8813
|
-
return {
|
|
8814
|
-
type: "strong",
|
|
8815
|
-
raw,
|
|
8816
|
-
text,
|
|
8817
|
-
tokens: this.lexer.inlineTokens(text)
|
|
8818
|
-
};
|
|
8779
|
+
continue;
|
|
8819
8780
|
}
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
8829
|
-
text = text.substring(1, text.length - 1);
|
|
8781
|
+
if (src) {
|
|
8782
|
+
const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
8783
|
+
if (this.options.silent) {
|
|
8784
|
+
console.error(errMsg);
|
|
8785
|
+
break;
|
|
8786
|
+
} else {
|
|
8787
|
+
throw new Error(errMsg);
|
|
8788
|
+
}
|
|
8830
8789
|
}
|
|
8831
|
-
return {
|
|
8832
|
-
type: "codespan",
|
|
8833
|
-
raw: cap[0],
|
|
8834
|
-
text
|
|
8835
|
-
};
|
|
8836
8790
|
}
|
|
8791
|
+
return tokens;
|
|
8837
8792
|
}
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8793
|
+
};
|
|
8794
|
+
|
|
8795
|
+
// src/Renderer.ts
|
|
8796
|
+
var _Renderer = class {
|
|
8797
|
+
options;
|
|
8798
|
+
parser;
|
|
8799
|
+
// set by the parser
|
|
8800
|
+
constructor(options2) {
|
|
8801
|
+
this.options = options2 || _defaults;
|
|
8802
|
+
}
|
|
8803
|
+
space(token) {
|
|
8804
|
+
return "";
|
|
8805
|
+
}
|
|
8806
|
+
code({ text, lang, escaped }) {
|
|
8807
|
+
const langString = (lang || "").match(other.notSpaceStart)?.[0];
|
|
8808
|
+
const code = text.replace(other.endingNewline, "") + "\n";
|
|
8809
|
+
if (!langString) {
|
|
8810
|
+
return "<pre><code>" + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
|
|
8845
8811
|
}
|
|
8812
|
+
return '<pre><code class="language-' + escape2(langString) + '">' + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
|
|
8846
8813
|
}
|
|
8847
|
-
|
|
8848
|
-
const
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8814
|
+
blockquote({ tokens }) {
|
|
8815
|
+
const body = this.parser.parse(tokens);
|
|
8816
|
+
return `<blockquote>
|
|
8817
|
+
${body}</blockquote>
|
|
8818
|
+
`;
|
|
8819
|
+
}
|
|
8820
|
+
html({ text }) {
|
|
8821
|
+
return text;
|
|
8822
|
+
}
|
|
8823
|
+
heading({ tokens, depth }) {
|
|
8824
|
+
return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>
|
|
8825
|
+
`;
|
|
8826
|
+
}
|
|
8827
|
+
hr(token) {
|
|
8828
|
+
return "<hr>\n";
|
|
8829
|
+
}
|
|
8830
|
+
list(token) {
|
|
8831
|
+
const ordered = token.ordered;
|
|
8832
|
+
const start = token.start;
|
|
8833
|
+
let body = "";
|
|
8834
|
+
for (let j = 0; j < token.items.length; j++) {
|
|
8835
|
+
const item = token.items[j];
|
|
8836
|
+
body += this.listitem(item);
|
|
8856
8837
|
}
|
|
8838
|
+
const type = ordered ? "ol" : "ul";
|
|
8839
|
+
const startAttr = ordered && start !== 1 ? ' start="' + start + '"' : "";
|
|
8840
|
+
return "<" + type + startAttr + ">\n" + body + "</" + type + ">\n";
|
|
8857
8841
|
}
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
if (
|
|
8861
|
-
|
|
8862
|
-
if (
|
|
8863
|
-
|
|
8864
|
-
|
|
8842
|
+
listitem(item) {
|
|
8843
|
+
let itemBody = "";
|
|
8844
|
+
if (item.task) {
|
|
8845
|
+
const checkbox = this.checkbox({ checked: !!item.checked });
|
|
8846
|
+
if (item.loose) {
|
|
8847
|
+
if (item.tokens[0]?.type === "paragraph") {
|
|
8848
|
+
item.tokens[0].text = checkbox + " " + item.tokens[0].text;
|
|
8849
|
+
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
|
|
8850
|
+
item.tokens[0].tokens[0].text = checkbox + " " + escape2(item.tokens[0].tokens[0].text);
|
|
8851
|
+
item.tokens[0].tokens[0].escaped = true;
|
|
8852
|
+
}
|
|
8853
|
+
} else {
|
|
8854
|
+
item.tokens.unshift({
|
|
8855
|
+
type: "text",
|
|
8856
|
+
raw: checkbox + " ",
|
|
8857
|
+
text: checkbox + " ",
|
|
8858
|
+
escaped: true
|
|
8859
|
+
});
|
|
8860
|
+
}
|
|
8865
8861
|
} else {
|
|
8866
|
-
|
|
8867
|
-
href = text;
|
|
8862
|
+
itemBody += checkbox + " ";
|
|
8868
8863
|
}
|
|
8869
|
-
return {
|
|
8870
|
-
type: "link",
|
|
8871
|
-
raw: cap[0],
|
|
8872
|
-
text,
|
|
8873
|
-
href,
|
|
8874
|
-
tokens: [
|
|
8875
|
-
{
|
|
8876
|
-
type: "text",
|
|
8877
|
-
raw: text,
|
|
8878
|
-
text
|
|
8879
|
-
}
|
|
8880
|
-
]
|
|
8881
|
-
};
|
|
8882
8864
|
}
|
|
8865
|
+
itemBody += this.parser.parse(item.tokens, !!item.loose);
|
|
8866
|
+
return `<li>${itemBody}</li>
|
|
8867
|
+
`;
|
|
8883
8868
|
}
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8869
|
+
checkbox({ checked }) {
|
|
8870
|
+
return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
|
|
8871
|
+
}
|
|
8872
|
+
paragraph({ tokens }) {
|
|
8873
|
+
return `<p>${this.parser.parseInline(tokens)}</p>
|
|
8874
|
+
`;
|
|
8875
|
+
}
|
|
8876
|
+
table(token) {
|
|
8877
|
+
let header = "";
|
|
8878
|
+
let cell = "";
|
|
8879
|
+
for (let j = 0; j < token.header.length; j++) {
|
|
8880
|
+
cell += this.tablecell(token.header[j]);
|
|
8881
|
+
}
|
|
8882
|
+
header += this.tablerow({ text: cell });
|
|
8883
|
+
let body = "";
|
|
8884
|
+
for (let j = 0; j < token.rows.length; j++) {
|
|
8885
|
+
const row = token.rows[j];
|
|
8886
|
+
cell = "";
|
|
8887
|
+
for (let k = 0; k < row.length; k++) {
|
|
8888
|
+
cell += this.tablecell(row[k]);
|
|
8903
8889
|
}
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8890
|
+
body += this.tablerow({ text: cell });
|
|
8891
|
+
}
|
|
8892
|
+
if (body) body = `<tbody>${body}</tbody>`;
|
|
8893
|
+
return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
|
|
8894
|
+
}
|
|
8895
|
+
tablerow({ text }) {
|
|
8896
|
+
return `<tr>
|
|
8897
|
+
${text}</tr>
|
|
8898
|
+
`;
|
|
8899
|
+
}
|
|
8900
|
+
tablecell(token) {
|
|
8901
|
+
const content = this.parser.parseInline(token.tokens);
|
|
8902
|
+
const type = token.header ? "th" : "td";
|
|
8903
|
+
const tag2 = token.align ? `<${type} align="${token.align}">` : `<${type}>`;
|
|
8904
|
+
return tag2 + content + `</${type}>
|
|
8905
|
+
`;
|
|
8906
|
+
}
|
|
8907
|
+
/**
|
|
8908
|
+
* span level renderer
|
|
8909
|
+
*/
|
|
8910
|
+
strong({ tokens }) {
|
|
8911
|
+
return `<strong>${this.parser.parseInline(tokens)}</strong>`;
|
|
8912
|
+
}
|
|
8913
|
+
em({ tokens }) {
|
|
8914
|
+
return `<em>${this.parser.parseInline(tokens)}</em>`;
|
|
8915
|
+
}
|
|
8916
|
+
codespan({ text }) {
|
|
8917
|
+
return `<code>${escape2(text, true)}</code>`;
|
|
8918
|
+
}
|
|
8919
|
+
br(token) {
|
|
8920
|
+
return "<br>";
|
|
8921
|
+
}
|
|
8922
|
+
del({ tokens }) {
|
|
8923
|
+
return `<del>${this.parser.parseInline(tokens)}</del>`;
|
|
8924
|
+
}
|
|
8925
|
+
link({ href, title, tokens }) {
|
|
8926
|
+
const text = this.parser.parseInline(tokens);
|
|
8927
|
+
const cleanHref = cleanUrl(href);
|
|
8928
|
+
if (cleanHref === null) {
|
|
8929
|
+
return text;
|
|
8930
|
+
}
|
|
8931
|
+
href = cleanHref;
|
|
8932
|
+
let out = '<a href="' + href + '"';
|
|
8933
|
+
if (title) {
|
|
8934
|
+
out += ' title="' + escape2(title) + '"';
|
|
8917
8935
|
}
|
|
8936
|
+
out += ">" + text + "</a>";
|
|
8937
|
+
return out;
|
|
8918
8938
|
}
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8939
|
+
image({ href, title, text, tokens }) {
|
|
8940
|
+
if (tokens) {
|
|
8941
|
+
text = this.parser.parseInline(tokens, this.parser.textRenderer);
|
|
8942
|
+
}
|
|
8943
|
+
const cleanHref = cleanUrl(href);
|
|
8944
|
+
if (cleanHref === null) {
|
|
8945
|
+
return escape2(text);
|
|
8946
|
+
}
|
|
8947
|
+
href = cleanHref;
|
|
8948
|
+
let out = `<img src="${href}" alt="${text}"`;
|
|
8949
|
+
if (title) {
|
|
8950
|
+
out += ` title="${escape2(title)}"`;
|
|
8929
8951
|
}
|
|
8952
|
+
out += ">";
|
|
8953
|
+
return out;
|
|
8954
|
+
}
|
|
8955
|
+
text(token) {
|
|
8956
|
+
return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : "escaped" in token && token.escaped ? token.text : escape2(token.text);
|
|
8930
8957
|
}
|
|
8931
8958
|
};
|
|
8932
8959
|
|
|
8933
|
-
// src/
|
|
8934
|
-
var
|
|
8935
|
-
|
|
8960
|
+
// src/TextRenderer.ts
|
|
8961
|
+
var _TextRenderer = class {
|
|
8962
|
+
// no need for block level renderers
|
|
8963
|
+
strong({ text }) {
|
|
8964
|
+
return text;
|
|
8965
|
+
}
|
|
8966
|
+
em({ text }) {
|
|
8967
|
+
return text;
|
|
8968
|
+
}
|
|
8969
|
+
codespan({ text }) {
|
|
8970
|
+
return text;
|
|
8971
|
+
}
|
|
8972
|
+
del({ text }) {
|
|
8973
|
+
return text;
|
|
8974
|
+
}
|
|
8975
|
+
html({ text }) {
|
|
8976
|
+
return text;
|
|
8977
|
+
}
|
|
8978
|
+
text({ text }) {
|
|
8979
|
+
return text;
|
|
8980
|
+
}
|
|
8981
|
+
link({ text }) {
|
|
8982
|
+
return "" + text;
|
|
8983
|
+
}
|
|
8984
|
+
image({ text }) {
|
|
8985
|
+
return "" + text;
|
|
8986
|
+
}
|
|
8987
|
+
br() {
|
|
8988
|
+
return "";
|
|
8989
|
+
}
|
|
8990
|
+
};
|
|
8991
|
+
|
|
8992
|
+
// src/Parser.ts
|
|
8993
|
+
var _Parser = class __Parser {
|
|
8936
8994
|
options;
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
inlineQueue;
|
|
8995
|
+
renderer;
|
|
8996
|
+
textRenderer;
|
|
8940
8997
|
constructor(options2) {
|
|
8941
|
-
this.tokens = [];
|
|
8942
|
-
this.tokens.links = /* @__PURE__ */ Object.create(null);
|
|
8943
8998
|
this.options = options2 || _defaults;
|
|
8944
|
-
this.options.
|
|
8945
|
-
this.
|
|
8946
|
-
this.
|
|
8947
|
-
this.
|
|
8948
|
-
this.
|
|
8949
|
-
this.state = {
|
|
8950
|
-
inLink: false,
|
|
8951
|
-
inRawBlock: false,
|
|
8952
|
-
top: true
|
|
8953
|
-
};
|
|
8954
|
-
const rules = {
|
|
8955
|
-
other,
|
|
8956
|
-
block: block.normal,
|
|
8957
|
-
inline: inline.normal
|
|
8958
|
-
};
|
|
8959
|
-
if (this.options.pedantic) {
|
|
8960
|
-
rules.block = block.pedantic;
|
|
8961
|
-
rules.inline = inline.pedantic;
|
|
8962
|
-
} else if (this.options.gfm) {
|
|
8963
|
-
rules.block = block.gfm;
|
|
8964
|
-
if (this.options.breaks) {
|
|
8965
|
-
rules.inline = inline.breaks;
|
|
8966
|
-
} else {
|
|
8967
|
-
rules.inline = inline.gfm;
|
|
8968
|
-
}
|
|
8969
|
-
}
|
|
8970
|
-
this.tokenizer.rules = rules;
|
|
8971
|
-
}
|
|
8972
|
-
/**
|
|
8973
|
-
* Expose Rules
|
|
8974
|
-
*/
|
|
8975
|
-
static get rules() {
|
|
8976
|
-
return {
|
|
8977
|
-
block,
|
|
8978
|
-
inline
|
|
8979
|
-
};
|
|
8999
|
+
this.options.renderer = this.options.renderer || new _Renderer();
|
|
9000
|
+
this.renderer = this.options.renderer;
|
|
9001
|
+
this.renderer.options = this.options;
|
|
9002
|
+
this.renderer.parser = this;
|
|
9003
|
+
this.textRenderer = new _TextRenderer();
|
|
8980
9004
|
}
|
|
8981
9005
|
/**
|
|
8982
|
-
* Static
|
|
9006
|
+
* Static Parse Method
|
|
8983
9007
|
*/
|
|
8984
|
-
static
|
|
8985
|
-
const
|
|
8986
|
-
return
|
|
9008
|
+
static parse(tokens, options2) {
|
|
9009
|
+
const parser2 = new __Parser(options2);
|
|
9010
|
+
return parser2.parse(tokens);
|
|
8987
9011
|
}
|
|
8988
9012
|
/**
|
|
8989
|
-
* Static
|
|
9013
|
+
* Static Parse Inline Method
|
|
8990
9014
|
*/
|
|
8991
|
-
static
|
|
8992
|
-
const
|
|
8993
|
-
return
|
|
9015
|
+
static parseInline(tokens, options2) {
|
|
9016
|
+
const parser2 = new __Parser(options2);
|
|
9017
|
+
return parser2.parseInline(tokens);
|
|
8994
9018
|
}
|
|
8995
9019
|
/**
|
|
8996
|
-
*
|
|
9020
|
+
* Parse Loop
|
|
8997
9021
|
*/
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
blockTokens(src, tokens = [], lastParagraphClipped = false) {
|
|
9009
|
-
if (this.options.pedantic) {
|
|
9010
|
-
src = src.replace(other.tabCharGlobal, " ").replace(other.spaceLine, "");
|
|
9011
|
-
}
|
|
9012
|
-
while (src) {
|
|
9013
|
-
let token;
|
|
9014
|
-
if (this.options.extensions?.block?.some((extTokenizer) => {
|
|
9015
|
-
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
9016
|
-
src = src.substring(token.raw.length);
|
|
9017
|
-
tokens.push(token);
|
|
9018
|
-
return true;
|
|
9022
|
+
parse(tokens, top = true) {
|
|
9023
|
+
let out = "";
|
|
9024
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
9025
|
+
const anyToken = tokens[i];
|
|
9026
|
+
if (this.options.extensions?.renderers?.[anyToken.type]) {
|
|
9027
|
+
const genericToken = anyToken;
|
|
9028
|
+
const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
|
|
9029
|
+
if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
|
|
9030
|
+
out += ret || "";
|
|
9031
|
+
continue;
|
|
9019
9032
|
}
|
|
9020
|
-
return false;
|
|
9021
|
-
})) {
|
|
9022
|
-
continue;
|
|
9023
9033
|
}
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
} else {
|
|
9030
|
-
tokens.push(token);
|
|
9034
|
+
const token = anyToken;
|
|
9035
|
+
switch (token.type) {
|
|
9036
|
+
case "space": {
|
|
9037
|
+
out += this.renderer.space(token);
|
|
9038
|
+
continue;
|
|
9031
9039
|
}
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
src = src.substring(token.raw.length);
|
|
9036
|
-
const lastToken = tokens.at(-1);
|
|
9037
|
-
if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
|
|
9038
|
-
lastToken.raw += "\n" + token.raw;
|
|
9039
|
-
lastToken.text += "\n" + token.text;
|
|
9040
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
9041
|
-
} else {
|
|
9042
|
-
tokens.push(token);
|
|
9040
|
+
case "hr": {
|
|
9041
|
+
out += this.renderer.hr(token);
|
|
9042
|
+
continue;
|
|
9043
9043
|
}
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
tokens.push(token);
|
|
9064
|
-
continue;
|
|
9065
|
-
}
|
|
9066
|
-
if (token = this.tokenizer.list(src)) {
|
|
9067
|
-
src = src.substring(token.raw.length);
|
|
9068
|
-
tokens.push(token);
|
|
9069
|
-
continue;
|
|
9070
|
-
}
|
|
9071
|
-
if (token = this.tokenizer.html(src)) {
|
|
9072
|
-
src = src.substring(token.raw.length);
|
|
9073
|
-
tokens.push(token);
|
|
9074
|
-
continue;
|
|
9075
|
-
}
|
|
9076
|
-
if (token = this.tokenizer.def(src)) {
|
|
9077
|
-
src = src.substring(token.raw.length);
|
|
9078
|
-
const lastToken = tokens.at(-1);
|
|
9079
|
-
if (lastToken?.type === "paragraph" || lastToken?.type === "text") {
|
|
9080
|
-
lastToken.raw += "\n" + token.raw;
|
|
9081
|
-
lastToken.text += "\n" + token.raw;
|
|
9082
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
9083
|
-
} else if (!this.tokens.links[token.tag]) {
|
|
9084
|
-
this.tokens.links[token.tag] = {
|
|
9085
|
-
href: token.href,
|
|
9086
|
-
title: token.title
|
|
9087
|
-
};
|
|
9044
|
+
case "heading": {
|
|
9045
|
+
out += this.renderer.heading(token);
|
|
9046
|
+
continue;
|
|
9047
|
+
}
|
|
9048
|
+
case "code": {
|
|
9049
|
+
out += this.renderer.code(token);
|
|
9050
|
+
continue;
|
|
9051
|
+
}
|
|
9052
|
+
case "table": {
|
|
9053
|
+
out += this.renderer.table(token);
|
|
9054
|
+
continue;
|
|
9055
|
+
}
|
|
9056
|
+
case "blockquote": {
|
|
9057
|
+
out += this.renderer.blockquote(token);
|
|
9058
|
+
continue;
|
|
9059
|
+
}
|
|
9060
|
+
case "list": {
|
|
9061
|
+
out += this.renderer.list(token);
|
|
9062
|
+
continue;
|
|
9088
9063
|
}
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
src = src.substring(token.raw.length);
|
|
9093
|
-
tokens.push(token);
|
|
9094
|
-
continue;
|
|
9095
|
-
}
|
|
9096
|
-
if (token = this.tokenizer.lheading(src)) {
|
|
9097
|
-
src = src.substring(token.raw.length);
|
|
9098
|
-
tokens.push(token);
|
|
9099
|
-
continue;
|
|
9100
|
-
}
|
|
9101
|
-
let cutSrc = src;
|
|
9102
|
-
if (this.options.extensions?.startBlock) {
|
|
9103
|
-
let startIndex = Infinity;
|
|
9104
|
-
const tempSrc = src.slice(1);
|
|
9105
|
-
let tempStart;
|
|
9106
|
-
this.options.extensions.startBlock.forEach((getStartIndex) => {
|
|
9107
|
-
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
9108
|
-
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
9109
|
-
startIndex = Math.min(startIndex, tempStart);
|
|
9110
|
-
}
|
|
9111
|
-
});
|
|
9112
|
-
if (startIndex < Infinity && startIndex >= 0) {
|
|
9113
|
-
cutSrc = src.substring(0, startIndex + 1);
|
|
9064
|
+
case "html": {
|
|
9065
|
+
out += this.renderer.html(token);
|
|
9066
|
+
continue;
|
|
9114
9067
|
}
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
|
-
if (lastParagraphClipped && lastToken?.type === "paragraph") {
|
|
9119
|
-
lastToken.raw += "\n" + token.raw;
|
|
9120
|
-
lastToken.text += "\n" + token.text;
|
|
9121
|
-
this.inlineQueue.pop();
|
|
9122
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
9123
|
-
} else {
|
|
9124
|
-
tokens.push(token);
|
|
9068
|
+
case "paragraph": {
|
|
9069
|
+
out += this.renderer.paragraph(token);
|
|
9070
|
+
continue;
|
|
9125
9071
|
}
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9072
|
+
case "text": {
|
|
9073
|
+
let textToken = token;
|
|
9074
|
+
let body = this.renderer.text(textToken);
|
|
9075
|
+
while (i + 1 < tokens.length && tokens[i + 1].type === "text") {
|
|
9076
|
+
textToken = tokens[++i];
|
|
9077
|
+
body += "\n" + this.renderer.text(textToken);
|
|
9078
|
+
}
|
|
9079
|
+
if (top) {
|
|
9080
|
+
out += this.renderer.paragraph({
|
|
9081
|
+
type: "paragraph",
|
|
9082
|
+
raw: body,
|
|
9083
|
+
text: body,
|
|
9084
|
+
tokens: [{ type: "text", raw: body, text: body, escaped: true }]
|
|
9085
|
+
});
|
|
9086
|
+
} else {
|
|
9087
|
+
out += body;
|
|
9088
|
+
}
|
|
9089
|
+
continue;
|
|
9140
9090
|
}
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
throw new Error(errMsg);
|
|
9091
|
+
default: {
|
|
9092
|
+
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
9093
|
+
if (this.options.silent) {
|
|
9094
|
+
console.error(errMsg);
|
|
9095
|
+
return "";
|
|
9096
|
+
} else {
|
|
9097
|
+
throw new Error(errMsg);
|
|
9098
|
+
}
|
|
9150
9099
|
}
|
|
9151
9100
|
}
|
|
9152
9101
|
}
|
|
9153
|
-
|
|
9154
|
-
return tokens;
|
|
9155
|
-
}
|
|
9156
|
-
inline(src, tokens = []) {
|
|
9157
|
-
this.inlineQueue.push({ src, tokens });
|
|
9158
|
-
return tokens;
|
|
9102
|
+
return out;
|
|
9159
9103
|
}
|
|
9160
9104
|
/**
|
|
9161
|
-
*
|
|
9105
|
+
* Parse Inline Tokens
|
|
9162
9106
|
*/
|
|
9163
|
-
|
|
9164
|
-
let
|
|
9165
|
-
let
|
|
9166
|
-
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
}
|
|
9107
|
+
parseInline(tokens, renderer = this.renderer) {
|
|
9108
|
+
let out = "";
|
|
9109
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
9110
|
+
const anyToken = tokens[i];
|
|
9111
|
+
if (this.options.extensions?.renderers?.[anyToken.type]) {
|
|
9112
|
+
const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
|
|
9113
|
+
if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
|
|
9114
|
+
out += ret || "";
|
|
9115
|
+
continue;
|
|
9173
9116
|
}
|
|
9174
9117
|
}
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
9181
|
-
}
|
|
9182
|
-
let keepPrevChar = false;
|
|
9183
|
-
let prevChar = "";
|
|
9184
|
-
while (src) {
|
|
9185
|
-
if (!keepPrevChar) {
|
|
9186
|
-
prevChar = "";
|
|
9187
|
-
}
|
|
9188
|
-
keepPrevChar = false;
|
|
9189
|
-
let token;
|
|
9190
|
-
if (this.options.extensions?.inline?.some((extTokenizer) => {
|
|
9191
|
-
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
9192
|
-
src = src.substring(token.raw.length);
|
|
9193
|
-
tokens.push(token);
|
|
9194
|
-
return true;
|
|
9118
|
+
const token = anyToken;
|
|
9119
|
+
switch (token.type) {
|
|
9120
|
+
case "escape": {
|
|
9121
|
+
out += renderer.text(token);
|
|
9122
|
+
break;
|
|
9195
9123
|
}
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
}
|
|
9200
|
-
if (token = this.tokenizer.escape(src)) {
|
|
9201
|
-
src = src.substring(token.raw.length);
|
|
9202
|
-
tokens.push(token);
|
|
9203
|
-
continue;
|
|
9204
|
-
}
|
|
9205
|
-
if (token = this.tokenizer.tag(src)) {
|
|
9206
|
-
src = src.substring(token.raw.length);
|
|
9207
|
-
tokens.push(token);
|
|
9208
|
-
continue;
|
|
9209
|
-
}
|
|
9210
|
-
if (token = this.tokenizer.link(src)) {
|
|
9211
|
-
src = src.substring(token.raw.length);
|
|
9212
|
-
tokens.push(token);
|
|
9213
|
-
continue;
|
|
9214
|
-
}
|
|
9215
|
-
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
|
9216
|
-
src = src.substring(token.raw.length);
|
|
9217
|
-
const lastToken = tokens.at(-1);
|
|
9218
|
-
if (token.type === "text" && lastToken?.type === "text") {
|
|
9219
|
-
lastToken.raw += token.raw;
|
|
9220
|
-
lastToken.text += token.text;
|
|
9221
|
-
} else {
|
|
9222
|
-
tokens.push(token);
|
|
9124
|
+
case "html": {
|
|
9125
|
+
out += renderer.html(token);
|
|
9126
|
+
break;
|
|
9223
9127
|
}
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
src = src.substring(token.raw.length);
|
|
9228
|
-
tokens.push(token);
|
|
9229
|
-
continue;
|
|
9230
|
-
}
|
|
9231
|
-
if (token = this.tokenizer.codespan(src)) {
|
|
9232
|
-
src = src.substring(token.raw.length);
|
|
9233
|
-
tokens.push(token);
|
|
9234
|
-
continue;
|
|
9235
|
-
}
|
|
9236
|
-
if (token = this.tokenizer.br(src)) {
|
|
9237
|
-
src = src.substring(token.raw.length);
|
|
9238
|
-
tokens.push(token);
|
|
9239
|
-
continue;
|
|
9240
|
-
}
|
|
9241
|
-
if (token = this.tokenizer.del(src)) {
|
|
9242
|
-
src = src.substring(token.raw.length);
|
|
9243
|
-
tokens.push(token);
|
|
9244
|
-
continue;
|
|
9245
|
-
}
|
|
9246
|
-
if (token = this.tokenizer.autolink(src)) {
|
|
9247
|
-
src = src.substring(token.raw.length);
|
|
9248
|
-
tokens.push(token);
|
|
9249
|
-
continue;
|
|
9250
|
-
}
|
|
9251
|
-
if (!this.state.inLink && (token = this.tokenizer.url(src))) {
|
|
9252
|
-
src = src.substring(token.raw.length);
|
|
9253
|
-
tokens.push(token);
|
|
9254
|
-
continue;
|
|
9255
|
-
}
|
|
9256
|
-
let cutSrc = src;
|
|
9257
|
-
if (this.options.extensions?.startInline) {
|
|
9258
|
-
let startIndex = Infinity;
|
|
9259
|
-
const tempSrc = src.slice(1);
|
|
9260
|
-
let tempStart;
|
|
9261
|
-
this.options.extensions.startInline.forEach((getStartIndex) => {
|
|
9262
|
-
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
9263
|
-
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
9264
|
-
startIndex = Math.min(startIndex, tempStart);
|
|
9265
|
-
}
|
|
9266
|
-
});
|
|
9267
|
-
if (startIndex < Infinity && startIndex >= 0) {
|
|
9268
|
-
cutSrc = src.substring(0, startIndex + 1);
|
|
9128
|
+
case "link": {
|
|
9129
|
+
out += renderer.link(token);
|
|
9130
|
+
break;
|
|
9269
9131
|
}
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
if (token.raw.slice(-1) !== "_") {
|
|
9274
|
-
prevChar = token.raw.slice(-1);
|
|
9132
|
+
case "image": {
|
|
9133
|
+
out += renderer.image(token);
|
|
9134
|
+
break;
|
|
9275
9135
|
}
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9136
|
+
case "strong": {
|
|
9137
|
+
out += renderer.strong(token);
|
|
9138
|
+
break;
|
|
9139
|
+
}
|
|
9140
|
+
case "em": {
|
|
9141
|
+
out += renderer.em(token);
|
|
9142
|
+
break;
|
|
9143
|
+
}
|
|
9144
|
+
case "codespan": {
|
|
9145
|
+
out += renderer.codespan(token);
|
|
9146
|
+
break;
|
|
9147
|
+
}
|
|
9148
|
+
case "br": {
|
|
9149
|
+
out += renderer.br(token);
|
|
9150
|
+
break;
|
|
9151
|
+
}
|
|
9152
|
+
case "del": {
|
|
9153
|
+
out += renderer.del(token);
|
|
9154
|
+
break;
|
|
9283
9155
|
}
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
if (src) {
|
|
9287
|
-
const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
9288
|
-
if (this.options.silent) {
|
|
9289
|
-
console.error(errMsg);
|
|
9156
|
+
case "text": {
|
|
9157
|
+
out += renderer.text(token);
|
|
9290
9158
|
break;
|
|
9291
|
-
}
|
|
9292
|
-
|
|
9159
|
+
}
|
|
9160
|
+
default: {
|
|
9161
|
+
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
9162
|
+
if (this.options.silent) {
|
|
9163
|
+
console.error(errMsg);
|
|
9164
|
+
return "";
|
|
9165
|
+
} else {
|
|
9166
|
+
throw new Error(errMsg);
|
|
9167
|
+
}
|
|
9293
9168
|
}
|
|
9294
9169
|
}
|
|
9295
9170
|
}
|
|
9296
|
-
return
|
|
9171
|
+
return out;
|
|
9297
9172
|
}
|
|
9298
9173
|
};
|
|
9299
9174
|
|
|
9300
|
-
// src/
|
|
9301
|
-
var
|
|
9175
|
+
// src/Hooks.ts
|
|
9176
|
+
var _Hooks = class {
|
|
9302
9177
|
options;
|
|
9303
|
-
|
|
9304
|
-
// set by the parser
|
|
9178
|
+
block;
|
|
9305
9179
|
constructor(options2) {
|
|
9306
9180
|
this.options = options2 || _defaults;
|
|
9307
9181
|
}
|
|
9308
|
-
|
|
9309
|
-
|
|
9182
|
+
static passThroughHooks = /* @__PURE__ */ new Set([
|
|
9183
|
+
"preprocess",
|
|
9184
|
+
"postprocess",
|
|
9185
|
+
"processAllTokens"
|
|
9186
|
+
]);
|
|
9187
|
+
/**
|
|
9188
|
+
* Process markdown before marked
|
|
9189
|
+
*/
|
|
9190
|
+
preprocess(markdown) {
|
|
9191
|
+
return markdown;
|
|
9310
9192
|
}
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
|
|
9316
|
-
}
|
|
9317
|
-
return '<pre><code class="language-' + escape2(langString) + '">' + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
|
|
9193
|
+
/**
|
|
9194
|
+
* Process HTML after marked is finished
|
|
9195
|
+
*/
|
|
9196
|
+
postprocess(html2) {
|
|
9197
|
+
return html2;
|
|
9318
9198
|
}
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9199
|
+
/**
|
|
9200
|
+
* Process all tokens before walk tokens
|
|
9201
|
+
*/
|
|
9202
|
+
processAllTokens(tokens) {
|
|
9203
|
+
return tokens;
|
|
9324
9204
|
}
|
|
9325
|
-
|
|
9326
|
-
|
|
9205
|
+
/**
|
|
9206
|
+
* Provide function to tokenize markdown
|
|
9207
|
+
*/
|
|
9208
|
+
provideLexer() {
|
|
9209
|
+
return this.block ? _Lexer.lex : _Lexer.lexInline;
|
|
9327
9210
|
}
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9211
|
+
/**
|
|
9212
|
+
* Provide function to parse tokens
|
|
9213
|
+
*/
|
|
9214
|
+
provideParser() {
|
|
9215
|
+
return this.block ? _Parser.parse : _Parser.parseInline;
|
|
9331
9216
|
}
|
|
9332
|
-
|
|
9333
|
-
|
|
9217
|
+
};
|
|
9218
|
+
|
|
9219
|
+
// src/Instance.ts
|
|
9220
|
+
var Marked = class {
|
|
9221
|
+
defaults = _getDefaults();
|
|
9222
|
+
options = this.setOptions;
|
|
9223
|
+
parse = this.parseMarkdown(true);
|
|
9224
|
+
parseInline = this.parseMarkdown(false);
|
|
9225
|
+
Parser = _Parser;
|
|
9226
|
+
Renderer = _Renderer;
|
|
9227
|
+
TextRenderer = _TextRenderer;
|
|
9228
|
+
Lexer = _Lexer;
|
|
9229
|
+
Tokenizer = _Tokenizer;
|
|
9230
|
+
Hooks = _Hooks;
|
|
9231
|
+
constructor(...args) {
|
|
9232
|
+
this.use(...args);
|
|
9334
9233
|
}
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9234
|
+
/**
|
|
9235
|
+
* Run callback for every token
|
|
9236
|
+
*/
|
|
9237
|
+
walkTokens(tokens, callback) {
|
|
9238
|
+
let values = [];
|
|
9239
|
+
for (const token of tokens) {
|
|
9240
|
+
values = values.concat(callback.call(this, token));
|
|
9241
|
+
switch (token.type) {
|
|
9242
|
+
case "table": {
|
|
9243
|
+
const tableToken = token;
|
|
9244
|
+
for (const cell of tableToken.header) {
|
|
9245
|
+
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
9246
|
+
}
|
|
9247
|
+
for (const row of tableToken.rows) {
|
|
9248
|
+
for (const cell of row) {
|
|
9249
|
+
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
9250
|
+
}
|
|
9251
|
+
}
|
|
9252
|
+
break;
|
|
9253
|
+
}
|
|
9254
|
+
case "list": {
|
|
9255
|
+
const listToken = token;
|
|
9256
|
+
values = values.concat(this.walkTokens(listToken.items, callback));
|
|
9257
|
+
break;
|
|
9258
|
+
}
|
|
9259
|
+
default: {
|
|
9260
|
+
const genericToken = token;
|
|
9261
|
+
if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
|
|
9262
|
+
this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
|
|
9263
|
+
const tokens2 = genericToken[childTokens].flat(Infinity);
|
|
9264
|
+
values = values.concat(this.walkTokens(tokens2, callback));
|
|
9265
|
+
});
|
|
9266
|
+
} else if (genericToken.tokens) {
|
|
9267
|
+
values = values.concat(this.walkTokens(genericToken.tokens, callback));
|
|
9268
|
+
}
|
|
9269
|
+
}
|
|
9270
|
+
}
|
|
9342
9271
|
}
|
|
9343
|
-
|
|
9344
|
-
const startAttr = ordered && start !== 1 ? ' start="' + start + '"' : "";
|
|
9345
|
-
return "<" + type + startAttr + ">\n" + body + "</" + type + ">\n";
|
|
9272
|
+
return values;
|
|
9346
9273
|
}
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
const
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
if (
|
|
9355
|
-
|
|
9356
|
-
|
|
9274
|
+
use(...args) {
|
|
9275
|
+
const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
9276
|
+
args.forEach((pack) => {
|
|
9277
|
+
const opts = { ...pack };
|
|
9278
|
+
opts.async = this.defaults.async || opts.async || false;
|
|
9279
|
+
if (pack.extensions) {
|
|
9280
|
+
pack.extensions.forEach((ext) => {
|
|
9281
|
+
if (!ext.name) {
|
|
9282
|
+
throw new Error("extension name required");
|
|
9283
|
+
}
|
|
9284
|
+
if ("renderer" in ext) {
|
|
9285
|
+
const prevRenderer = extensions.renderers[ext.name];
|
|
9286
|
+
if (prevRenderer) {
|
|
9287
|
+
extensions.renderers[ext.name] = function(...args2) {
|
|
9288
|
+
let ret = ext.renderer.apply(this, args2);
|
|
9289
|
+
if (ret === false) {
|
|
9290
|
+
ret = prevRenderer.apply(this, args2);
|
|
9291
|
+
}
|
|
9292
|
+
return ret;
|
|
9293
|
+
};
|
|
9294
|
+
} else {
|
|
9295
|
+
extensions.renderers[ext.name] = ext.renderer;
|
|
9296
|
+
}
|
|
9297
|
+
}
|
|
9298
|
+
if ("tokenizer" in ext) {
|
|
9299
|
+
if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
|
|
9300
|
+
throw new Error("extension level must be 'block' or 'inline'");
|
|
9301
|
+
}
|
|
9302
|
+
const extLevel = extensions[ext.level];
|
|
9303
|
+
if (extLevel) {
|
|
9304
|
+
extLevel.unshift(ext.tokenizer);
|
|
9305
|
+
} else {
|
|
9306
|
+
extensions[ext.level] = [ext.tokenizer];
|
|
9307
|
+
}
|
|
9308
|
+
if (ext.start) {
|
|
9309
|
+
if (ext.level === "block") {
|
|
9310
|
+
if (extensions.startBlock) {
|
|
9311
|
+
extensions.startBlock.push(ext.start);
|
|
9312
|
+
} else {
|
|
9313
|
+
extensions.startBlock = [ext.start];
|
|
9314
|
+
}
|
|
9315
|
+
} else if (ext.level === "inline") {
|
|
9316
|
+
if (extensions.startInline) {
|
|
9317
|
+
extensions.startInline.push(ext.start);
|
|
9318
|
+
} else {
|
|
9319
|
+
extensions.startInline = [ext.start];
|
|
9320
|
+
}
|
|
9321
|
+
}
|
|
9322
|
+
}
|
|
9323
|
+
}
|
|
9324
|
+
if ("childTokens" in ext && ext.childTokens) {
|
|
9325
|
+
extensions.childTokens[ext.name] = ext.childTokens;
|
|
9326
|
+
}
|
|
9327
|
+
});
|
|
9328
|
+
opts.extensions = extensions;
|
|
9329
|
+
}
|
|
9330
|
+
if (pack.renderer) {
|
|
9331
|
+
const renderer = this.defaults.renderer || new _Renderer(this.defaults);
|
|
9332
|
+
for (const prop in pack.renderer) {
|
|
9333
|
+
if (!(prop in renderer)) {
|
|
9334
|
+
throw new Error(`renderer '${prop}' does not exist`);
|
|
9335
|
+
}
|
|
9336
|
+
if (["options", "parser"].includes(prop)) {
|
|
9337
|
+
continue;
|
|
9338
|
+
}
|
|
9339
|
+
const rendererProp = prop;
|
|
9340
|
+
const rendererFunc = pack.renderer[rendererProp];
|
|
9341
|
+
const prevRenderer = renderer[rendererProp];
|
|
9342
|
+
renderer[rendererProp] = (...args2) => {
|
|
9343
|
+
let ret = rendererFunc.apply(renderer, args2);
|
|
9344
|
+
if (ret === false) {
|
|
9345
|
+
ret = prevRenderer.apply(renderer, args2);
|
|
9346
|
+
}
|
|
9347
|
+
return ret || "";
|
|
9348
|
+
};
|
|
9349
|
+
}
|
|
9350
|
+
opts.renderer = renderer;
|
|
9351
|
+
}
|
|
9352
|
+
if (pack.tokenizer) {
|
|
9353
|
+
const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
|
|
9354
|
+
for (const prop in pack.tokenizer) {
|
|
9355
|
+
if (!(prop in tokenizer)) {
|
|
9356
|
+
throw new Error(`tokenizer '${prop}' does not exist`);
|
|
9357
|
+
}
|
|
9358
|
+
if (["options", "rules", "lexer"].includes(prop)) {
|
|
9359
|
+
continue;
|
|
9360
|
+
}
|
|
9361
|
+
const tokenizerProp = prop;
|
|
9362
|
+
const tokenizerFunc = pack.tokenizer[tokenizerProp];
|
|
9363
|
+
const prevTokenizer = tokenizer[tokenizerProp];
|
|
9364
|
+
tokenizer[tokenizerProp] = (...args2) => {
|
|
9365
|
+
let ret = tokenizerFunc.apply(tokenizer, args2);
|
|
9366
|
+
if (ret === false) {
|
|
9367
|
+
ret = prevTokenizer.apply(tokenizer, args2);
|
|
9368
|
+
}
|
|
9369
|
+
return ret;
|
|
9370
|
+
};
|
|
9371
|
+
}
|
|
9372
|
+
opts.tokenizer = tokenizer;
|
|
9373
|
+
}
|
|
9374
|
+
if (pack.hooks) {
|
|
9375
|
+
const hooks = this.defaults.hooks || new _Hooks();
|
|
9376
|
+
for (const prop in pack.hooks) {
|
|
9377
|
+
if (!(prop in hooks)) {
|
|
9378
|
+
throw new Error(`hook '${prop}' does not exist`);
|
|
9379
|
+
}
|
|
9380
|
+
if (["options", "block"].includes(prop)) {
|
|
9381
|
+
continue;
|
|
9382
|
+
}
|
|
9383
|
+
const hooksProp = prop;
|
|
9384
|
+
const hooksFunc = pack.hooks[hooksProp];
|
|
9385
|
+
const prevHook = hooks[hooksProp];
|
|
9386
|
+
if (_Hooks.passThroughHooks.has(prop)) {
|
|
9387
|
+
hooks[hooksProp] = (arg) => {
|
|
9388
|
+
if (this.defaults.async) {
|
|
9389
|
+
return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
|
|
9390
|
+
return prevHook.call(hooks, ret2);
|
|
9391
|
+
});
|
|
9392
|
+
}
|
|
9393
|
+
const ret = hooksFunc.call(hooks, arg);
|
|
9394
|
+
return prevHook.call(hooks, ret);
|
|
9395
|
+
};
|
|
9396
|
+
} else {
|
|
9397
|
+
hooks[hooksProp] = (...args2) => {
|
|
9398
|
+
let ret = hooksFunc.apply(hooks, args2);
|
|
9399
|
+
if (ret === false) {
|
|
9400
|
+
ret = prevHook.apply(hooks, args2);
|
|
9401
|
+
}
|
|
9402
|
+
return ret;
|
|
9403
|
+
};
|
|
9357
9404
|
}
|
|
9358
|
-
} else {
|
|
9359
|
-
item.tokens.unshift({
|
|
9360
|
-
type: "text",
|
|
9361
|
-
raw: checkbox + " ",
|
|
9362
|
-
text: checkbox + " ",
|
|
9363
|
-
escaped: true
|
|
9364
|
-
});
|
|
9365
9405
|
}
|
|
9366
|
-
|
|
9367
|
-
itemBody += checkbox + " ";
|
|
9406
|
+
opts.hooks = hooks;
|
|
9368
9407
|
}
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
}
|
|
9381
|
-
table(token) {
|
|
9382
|
-
let header = "";
|
|
9383
|
-
let cell = "";
|
|
9384
|
-
for (let j = 0; j < token.header.length; j++) {
|
|
9385
|
-
cell += this.tablecell(token.header[j]);
|
|
9386
|
-
}
|
|
9387
|
-
header += this.tablerow({ text: cell });
|
|
9388
|
-
let body = "";
|
|
9389
|
-
for (let j = 0; j < token.rows.length; j++) {
|
|
9390
|
-
const row = token.rows[j];
|
|
9391
|
-
cell = "";
|
|
9392
|
-
for (let k = 0; k < row.length; k++) {
|
|
9393
|
-
cell += this.tablecell(row[k]);
|
|
9408
|
+
if (pack.walkTokens) {
|
|
9409
|
+
const walkTokens2 = this.defaults.walkTokens;
|
|
9410
|
+
const packWalktokens = pack.walkTokens;
|
|
9411
|
+
opts.walkTokens = function(token) {
|
|
9412
|
+
let values = [];
|
|
9413
|
+
values.push(packWalktokens.call(this, token));
|
|
9414
|
+
if (walkTokens2) {
|
|
9415
|
+
values = values.concat(walkTokens2.call(this, token));
|
|
9416
|
+
}
|
|
9417
|
+
return values;
|
|
9418
|
+
};
|
|
9394
9419
|
}
|
|
9395
|
-
|
|
9396
|
-
}
|
|
9397
|
-
|
|
9398
|
-
return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
|
|
9399
|
-
}
|
|
9400
|
-
tablerow({ text }) {
|
|
9401
|
-
return `<tr>
|
|
9402
|
-
${text}</tr>
|
|
9403
|
-
`;
|
|
9404
|
-
}
|
|
9405
|
-
tablecell(token) {
|
|
9406
|
-
const content = this.parser.parseInline(token.tokens);
|
|
9407
|
-
const type = token.header ? "th" : "td";
|
|
9408
|
-
const tag2 = token.align ? `<${type} align="${token.align}">` : `<${type}>`;
|
|
9409
|
-
return tag2 + content + `</${type}>
|
|
9410
|
-
`;
|
|
9411
|
-
}
|
|
9412
|
-
/**
|
|
9413
|
-
* span level renderer
|
|
9414
|
-
*/
|
|
9415
|
-
strong({ tokens }) {
|
|
9416
|
-
return `<strong>${this.parser.parseInline(tokens)}</strong>`;
|
|
9417
|
-
}
|
|
9418
|
-
em({ tokens }) {
|
|
9419
|
-
return `<em>${this.parser.parseInline(tokens)}</em>`;
|
|
9420
|
-
}
|
|
9421
|
-
codespan({ text }) {
|
|
9422
|
-
return `<code>${escape2(text, true)}</code>`;
|
|
9423
|
-
}
|
|
9424
|
-
br(token) {
|
|
9425
|
-
return "<br>";
|
|
9426
|
-
}
|
|
9427
|
-
del({ tokens }) {
|
|
9428
|
-
return `<del>${this.parser.parseInline(tokens)}</del>`;
|
|
9429
|
-
}
|
|
9430
|
-
link({ href, title, tokens }) {
|
|
9431
|
-
const text = this.parser.parseInline(tokens);
|
|
9432
|
-
const cleanHref = cleanUrl(href);
|
|
9433
|
-
if (cleanHref === null) {
|
|
9434
|
-
return text;
|
|
9435
|
-
}
|
|
9436
|
-
href = cleanHref;
|
|
9437
|
-
let out = '<a href="' + href + '"';
|
|
9438
|
-
if (title) {
|
|
9439
|
-
out += ' title="' + escape2(title) + '"';
|
|
9440
|
-
}
|
|
9441
|
-
out += ">" + text + "</a>";
|
|
9442
|
-
return out;
|
|
9443
|
-
}
|
|
9444
|
-
image({ href, title, text, tokens }) {
|
|
9445
|
-
if (tokens) {
|
|
9446
|
-
text = this.parser.parseInline(tokens, this.parser.textRenderer);
|
|
9447
|
-
}
|
|
9448
|
-
const cleanHref = cleanUrl(href);
|
|
9449
|
-
if (cleanHref === null) {
|
|
9450
|
-
return escape2(text);
|
|
9451
|
-
}
|
|
9452
|
-
href = cleanHref;
|
|
9453
|
-
let out = `<img src="${href}" alt="${text}"`;
|
|
9454
|
-
if (title) {
|
|
9455
|
-
out += ` title="${escape2(title)}"`;
|
|
9456
|
-
}
|
|
9457
|
-
out += ">";
|
|
9458
|
-
return out;
|
|
9459
|
-
}
|
|
9460
|
-
text(token) {
|
|
9461
|
-
return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : "escaped" in token && token.escaped ? token.text : escape2(token.text);
|
|
9462
|
-
}
|
|
9463
|
-
};
|
|
9464
|
-
|
|
9465
|
-
// src/TextRenderer.ts
|
|
9466
|
-
var _TextRenderer = class {
|
|
9467
|
-
// no need for block level renderers
|
|
9468
|
-
strong({ text }) {
|
|
9469
|
-
return text;
|
|
9470
|
-
}
|
|
9471
|
-
em({ text }) {
|
|
9472
|
-
return text;
|
|
9473
|
-
}
|
|
9474
|
-
codespan({ text }) {
|
|
9475
|
-
return text;
|
|
9476
|
-
}
|
|
9477
|
-
del({ text }) {
|
|
9478
|
-
return text;
|
|
9479
|
-
}
|
|
9480
|
-
html({ text }) {
|
|
9481
|
-
return text;
|
|
9482
|
-
}
|
|
9483
|
-
text({ text }) {
|
|
9484
|
-
return text;
|
|
9485
|
-
}
|
|
9486
|
-
link({ text }) {
|
|
9487
|
-
return "" + text;
|
|
9488
|
-
}
|
|
9489
|
-
image({ text }) {
|
|
9490
|
-
return "" + text;
|
|
9491
|
-
}
|
|
9492
|
-
br() {
|
|
9493
|
-
return "";
|
|
9420
|
+
this.defaults = { ...this.defaults, ...opts };
|
|
9421
|
+
});
|
|
9422
|
+
return this;
|
|
9494
9423
|
}
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
var _Parser = class __Parser {
|
|
9499
|
-
options;
|
|
9500
|
-
renderer;
|
|
9501
|
-
textRenderer;
|
|
9502
|
-
constructor(options2) {
|
|
9503
|
-
this.options = options2 || _defaults;
|
|
9504
|
-
this.options.renderer = this.options.renderer || new _Renderer();
|
|
9505
|
-
this.renderer = this.options.renderer;
|
|
9506
|
-
this.renderer.options = this.options;
|
|
9507
|
-
this.renderer.parser = this;
|
|
9508
|
-
this.textRenderer = new _TextRenderer();
|
|
9424
|
+
setOptions(opt) {
|
|
9425
|
+
this.defaults = { ...this.defaults, ...opt };
|
|
9426
|
+
return this;
|
|
9509
9427
|
}
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
*/
|
|
9513
|
-
static parse(tokens, options2) {
|
|
9514
|
-
const parser2 = new __Parser(options2);
|
|
9515
|
-
return parser2.parse(tokens);
|
|
9428
|
+
lexer(src, options2) {
|
|
9429
|
+
return _Lexer.lex(src, options2 ?? this.defaults);
|
|
9516
9430
|
}
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
*/
|
|
9520
|
-
static parseInline(tokens, options2) {
|
|
9521
|
-
const parser2 = new __Parser(options2);
|
|
9522
|
-
return parser2.parseInline(tokens);
|
|
9431
|
+
parser(tokens, options2) {
|
|
9432
|
+
return _Parser.parse(tokens, options2 ?? this.defaults);
|
|
9523
9433
|
}
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
if (this.options.extensions?.renderers?.[anyToken.type]) {
|
|
9532
|
-
const genericToken = anyToken;
|
|
9533
|
-
const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
|
|
9534
|
-
if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
|
|
9535
|
-
out += ret || "";
|
|
9536
|
-
continue;
|
|
9537
|
-
}
|
|
9434
|
+
parseMarkdown(blockType) {
|
|
9435
|
+
const parse2 = (src, options2) => {
|
|
9436
|
+
const origOpt = { ...options2 };
|
|
9437
|
+
const opt = { ...this.defaults, ...origOpt };
|
|
9438
|
+
const throwError = this.onError(!!opt.silent, !!opt.async);
|
|
9439
|
+
if (this.defaults.async === true && origOpt.async === false) {
|
|
9440
|
+
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."));
|
|
9538
9441
|
}
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9442
|
+
if (typeof src === "undefined" || src === null) {
|
|
9443
|
+
return throwError(new Error("marked(): input parameter is undefined or null"));
|
|
9444
|
+
}
|
|
9445
|
+
if (typeof src !== "string") {
|
|
9446
|
+
return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
|
|
9447
|
+
}
|
|
9448
|
+
if (opt.hooks) {
|
|
9449
|
+
opt.hooks.options = opt;
|
|
9450
|
+
opt.hooks.block = blockType;
|
|
9451
|
+
}
|
|
9452
|
+
const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
|
|
9453
|
+
const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
|
|
9454
|
+
if (opt.async) {
|
|
9455
|
+
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);
|
|
9456
|
+
}
|
|
9457
|
+
try {
|
|
9458
|
+
if (opt.hooks) {
|
|
9459
|
+
src = opt.hooks.preprocess(src);
|
|
9548
9460
|
}
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9461
|
+
let tokens = lexer2(src, opt);
|
|
9462
|
+
if (opt.hooks) {
|
|
9463
|
+
tokens = opt.hooks.processAllTokens(tokens);
|
|
9552
9464
|
}
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
continue;
|
|
9465
|
+
if (opt.walkTokens) {
|
|
9466
|
+
this.walkTokens(tokens, opt.walkTokens);
|
|
9556
9467
|
}
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9468
|
+
let html2 = parser2(tokens, opt);
|
|
9469
|
+
if (opt.hooks) {
|
|
9470
|
+
html2 = opt.hooks.postprocess(html2);
|
|
9560
9471
|
}
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9472
|
+
return html2;
|
|
9473
|
+
} catch (e) {
|
|
9474
|
+
return throwError(e);
|
|
9475
|
+
}
|
|
9476
|
+
};
|
|
9477
|
+
return parse2;
|
|
9478
|
+
}
|
|
9479
|
+
onError(silent, async) {
|
|
9480
|
+
return (e) => {
|
|
9481
|
+
e.message += "\nPlease report this to https://github.com/markedjs/marked.";
|
|
9482
|
+
if (silent) {
|
|
9483
|
+
const msg = "<p>An error occurred:</p><pre>" + escape2(e.message + "", true) + "</pre>";
|
|
9484
|
+
if (async) {
|
|
9485
|
+
return Promise.resolve(msg);
|
|
9564
9486
|
}
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9487
|
+
return msg;
|
|
9488
|
+
}
|
|
9489
|
+
if (async) {
|
|
9490
|
+
return Promise.reject(e);
|
|
9491
|
+
}
|
|
9492
|
+
throw e;
|
|
9493
|
+
};
|
|
9494
|
+
}
|
|
9495
|
+
};
|
|
9496
|
+
|
|
9497
|
+
// src/marked.ts
|
|
9498
|
+
var markedInstance = new Marked();
|
|
9499
|
+
function marked(src, opt) {
|
|
9500
|
+
return markedInstance.parse(src, opt);
|
|
9501
|
+
}
|
|
9502
|
+
marked.options = marked.setOptions = function(options2) {
|
|
9503
|
+
markedInstance.setOptions(options2);
|
|
9504
|
+
marked.defaults = markedInstance.defaults;
|
|
9505
|
+
changeDefaults(marked.defaults);
|
|
9506
|
+
return marked;
|
|
9507
|
+
};
|
|
9508
|
+
marked.getDefaults = _getDefaults;
|
|
9509
|
+
marked.defaults = _defaults;
|
|
9510
|
+
marked.use = function(...args) {
|
|
9511
|
+
markedInstance.use(...args);
|
|
9512
|
+
marked.defaults = markedInstance.defaults;
|
|
9513
|
+
changeDefaults(marked.defaults);
|
|
9514
|
+
return marked;
|
|
9515
|
+
};
|
|
9516
|
+
marked.walkTokens = function(tokens, callback) {
|
|
9517
|
+
return markedInstance.walkTokens(tokens, callback);
|
|
9518
|
+
};
|
|
9519
|
+
marked.parseInline = markedInstance.parseInline;
|
|
9520
|
+
marked.Parser = _Parser;
|
|
9521
|
+
marked.parser = _Parser.parse;
|
|
9522
|
+
marked.Renderer = _Renderer;
|
|
9523
|
+
marked.TextRenderer = _TextRenderer;
|
|
9524
|
+
marked.Lexer = _Lexer;
|
|
9525
|
+
marked.lexer = _Lexer.lex;
|
|
9526
|
+
marked.Tokenizer = _Tokenizer;
|
|
9527
|
+
marked.Hooks = _Hooks;
|
|
9528
|
+
marked.parse = marked;
|
|
9529
|
+
|
|
9530
|
+
/**
|
|
9531
|
+
* This component renders a results summary for RAG search result summaries.
|
|
9532
|
+
* When the user makes a search, a network call is made to retrieve the summary content, which is then
|
|
9533
|
+
* rendered in this box.
|
|
9534
|
+
*
|
|
9535
|
+
* NOTE: This component requires the usage of a read key that has "SUMMARY" permissions.
|
|
9536
|
+
*
|
|
9537
|
+
* @react-import
|
|
9538
|
+
* ```jsx
|
|
9539
|
+
* import { SearchcraftResultsSummary } from "@searchcraft/react-sdk";
|
|
9540
|
+
* ```
|
|
9541
|
+
*
|
|
9542
|
+
* @vue-import
|
|
9543
|
+
* ```ts
|
|
9544
|
+
* import { SearchcraftResultsSummary } from "@searchcraft/vue-sdk";
|
|
9545
|
+
* ```
|
|
9546
|
+
*
|
|
9547
|
+
* @js-example
|
|
9548
|
+
* ```html
|
|
9549
|
+
* <searchcraft-results-summary />
|
|
9550
|
+
* ```
|
|
9551
|
+
*
|
|
9552
|
+
* @react-example
|
|
9553
|
+
* ```jsx
|
|
9554
|
+
* <SearchcraftResultsSummary />
|
|
9555
|
+
* ```
|
|
9556
|
+
*
|
|
9557
|
+
* @vue-example
|
|
9558
|
+
* ```jsx
|
|
9559
|
+
* <SearchcraftResultsSummary />
|
|
9560
|
+
* ```
|
|
9561
|
+
*/
|
|
9562
|
+
class SearchcraftResultsSummary {
|
|
9563
|
+
constructor(hostRef) {
|
|
9564
|
+
registerInstance(this, hostRef);
|
|
9565
|
+
}
|
|
9566
|
+
/**
|
|
9567
|
+
* The id of the Searchcraft instance that this component should use.
|
|
9568
|
+
*/
|
|
9569
|
+
searchcraftId;
|
|
9570
|
+
summary = '';
|
|
9571
|
+
summaryErrorMessage = '';
|
|
9572
|
+
isLoading = false;
|
|
9573
|
+
isSummaryNotEnabled = false;
|
|
9574
|
+
unsubscribe;
|
|
9575
|
+
cleanupCore;
|
|
9576
|
+
/**
|
|
9577
|
+
* Callback invoked when the Searchcraft core instance is available.
|
|
9578
|
+
*/
|
|
9579
|
+
onCoreAvailable(core) {
|
|
9580
|
+
core.store.setState({ hasSummaryBox: true });
|
|
9581
|
+
this.unsubscribe = core.store.subscribe(this.handleStateChange.bind(this));
|
|
9582
|
+
}
|
|
9583
|
+
connectedCallback() {
|
|
9584
|
+
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
9585
|
+
}
|
|
9586
|
+
disconnectedCallback() {
|
|
9587
|
+
this.unsubscribe?.();
|
|
9588
|
+
this.cleanupCore?.();
|
|
9589
|
+
}
|
|
9590
|
+
/**
|
|
9591
|
+
* Handles state changes from the store and updates component state.
|
|
9592
|
+
*/
|
|
9593
|
+
handleStateChange(state) {
|
|
9594
|
+
this.isLoading = state.isSummaryLoading;
|
|
9595
|
+
this.isSummaryNotEnabled = state.isSummaryNotEnabled;
|
|
9596
|
+
this.summaryErrorMessage = state.summaryErrorMessage;
|
|
9597
|
+
this.summary = this.sanitizeMarkdown(state.summary);
|
|
9598
|
+
}
|
|
9599
|
+
/**
|
|
9600
|
+
* Sanitizes and converts markdown to HTML.
|
|
9601
|
+
*/
|
|
9602
|
+
sanitizeMarkdown(markdown) {
|
|
9603
|
+
return purify.sanitize(marked.parse(markdown));
|
|
9604
|
+
}
|
|
9605
|
+
/**
|
|
9606
|
+
* Renders the appropriate content based on current state.
|
|
9607
|
+
*/
|
|
9608
|
+
renderContent() {
|
|
9609
|
+
if (this.isLoading) {
|
|
9610
|
+
return hAsync("searchcraft-loading", { label: 'LOADING' });
|
|
9568
9611
|
}
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
continue;
|
|
9612
|
+
if (this.isSummaryNotEnabled) {
|
|
9613
|
+
return (hAsync("div", { class: 'searchcraft-results-summary-content' }, this.summaryErrorMessage || 'AI summaries are not enabled'));
|
|
9572
9614
|
}
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9615
|
+
return (hAsync("div", { class: 'searchcraft-results-summary-content', innerHTML: this.summary, "aria-live": "polite" }));
|
|
9616
|
+
}
|
|
9617
|
+
render() {
|
|
9618
|
+
return (hAsync("div", { key: '4fabef16a76b57d737aa47fcf106c7375d19a5bc', class: 'searchcraft-results-summary' }, this.renderContent()));
|
|
9619
|
+
}
|
|
9620
|
+
static get cmpMeta() { return {
|
|
9621
|
+
"$flags$": 768,
|
|
9622
|
+
"$tagName$": "searchcraft-results-summary",
|
|
9623
|
+
"$members$": {
|
|
9624
|
+
"searchcraftId": [1, "searchcraft-id"],
|
|
9625
|
+
"summary": [32],
|
|
9626
|
+
"summaryErrorMessage": [32],
|
|
9627
|
+
"isLoading": [32],
|
|
9628
|
+
"isSummaryNotEnabled": [32]
|
|
9629
|
+
},
|
|
9630
|
+
"$listeners$": undefined,
|
|
9631
|
+
"$lazyBundleId$": "-",
|
|
9632
|
+
"$attrsToReflect$": []
|
|
9633
|
+
}; }
|
|
9634
|
+
}
|
|
9635
|
+
|
|
9636
|
+
/**
|
|
9637
|
+
* This web component is designed to display detailed information for a single search result. Once a query is submitted, the component formats and presents the result.
|
|
9638
|
+
*
|
|
9639
|
+
* @internal
|
|
9640
|
+
*/
|
|
9641
|
+
class SearchcraftSearchResult {
|
|
9642
|
+
constructor(hostRef) {
|
|
9643
|
+
registerInstance(this, hostRef);
|
|
9644
|
+
}
|
|
9645
|
+
item;
|
|
9646
|
+
/**
|
|
9647
|
+
* The index.
|
|
9648
|
+
*/
|
|
9649
|
+
index;
|
|
9650
|
+
/**
|
|
9651
|
+
* The position in the document. Used with the "document_clicked" measure event.
|
|
9652
|
+
*/
|
|
9653
|
+
documentPosition = 0;
|
|
9654
|
+
/**
|
|
9655
|
+
* A callback function responsible for rendering a result.
|
|
9656
|
+
*/
|
|
9657
|
+
template;
|
|
9658
|
+
/**
|
|
9659
|
+
* The id of the Searchcraft instance that this component should use.
|
|
9660
|
+
*/
|
|
9661
|
+
searchcraftId;
|
|
9662
|
+
templateHtml;
|
|
9663
|
+
get hostElement() { return getElement(this); }
|
|
9664
|
+
core;
|
|
9665
|
+
cleanupCore;
|
|
9666
|
+
onCoreAvailable(core) {
|
|
9667
|
+
this.core = core;
|
|
9668
|
+
}
|
|
9669
|
+
connectedCallback() {
|
|
9670
|
+
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
9671
|
+
if (this.item) {
|
|
9672
|
+
try {
|
|
9673
|
+
this.templateHtml = this.template?.(this.item.document, this.index, {
|
|
9674
|
+
html: html$1,
|
|
9675
|
+
source_index: this.item.source_index,
|
|
9676
|
+
});
|
|
9677
|
+
}
|
|
9678
|
+
catch (error) {
|
|
9679
|
+
console.error('Invalid search result template:', error);
|
|
9680
|
+
}
|
|
9576
9681
|
}
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
if (top) {
|
|
9585
|
-
out += this.renderer.paragraph({
|
|
9586
|
-
type: "paragraph",
|
|
9587
|
-
raw: body,
|
|
9588
|
-
text: body,
|
|
9589
|
-
tokens: [{ type: "text", raw: body, text: body, escaped: true }]
|
|
9590
|
-
});
|
|
9591
|
-
} else {
|
|
9592
|
-
out += body;
|
|
9593
|
-
}
|
|
9594
|
-
continue;
|
|
9682
|
+
}
|
|
9683
|
+
disconnectedCallback() {
|
|
9684
|
+
this.cleanupCore?.();
|
|
9685
|
+
}
|
|
9686
|
+
handleResultContainerClick = (event) => {
|
|
9687
|
+
if (!event.target) {
|
|
9688
|
+
return;
|
|
9595
9689
|
}
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
}
|
|
9690
|
+
const target = event.target;
|
|
9691
|
+
const link = target.closest('a');
|
|
9692
|
+
if (!link ||
|
|
9693
|
+
!this.hostElement?.contains(link) ||
|
|
9694
|
+
!this.core ||
|
|
9695
|
+
!this.core.measureClient) {
|
|
9696
|
+
return;
|
|
9604
9697
|
}
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
|
|
9619
|
-
out += ret || "";
|
|
9620
|
-
continue;
|
|
9698
|
+
const document_position = this.documentPosition;
|
|
9699
|
+
const search_term = this.core.store.getState().searchTerm;
|
|
9700
|
+
const number_of_documents = this.core.store.getState().searchClientResponseItems.length || 0;
|
|
9701
|
+
this.core.measureClient.sendMeasureEvent('document_clicked', {
|
|
9702
|
+
document_position,
|
|
9703
|
+
number_of_documents,
|
|
9704
|
+
search_term,
|
|
9705
|
+
});
|
|
9706
|
+
};
|
|
9707
|
+
handleKeyDown = () => { };
|
|
9708
|
+
render() {
|
|
9709
|
+
if (!this.item) {
|
|
9710
|
+
return;
|
|
9621
9711
|
}
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
switch (token.type) {
|
|
9625
|
-
case "escape": {
|
|
9626
|
-
out += renderer.text(token);
|
|
9627
|
-
break;
|
|
9712
|
+
if (typeof this.template === 'undefined') {
|
|
9713
|
+
return (hAsync("div", { class: 'searchcraft-search-result searchcraft-search-result-no-template', onClick: this.handleResultContainerClick, onKeyDown: this.handleKeyDown }, Object.entries(this.item.document).map(([key, value]) => (hAsync("p", { key: key }, hAsync("strong", null, key), ": ", value)))));
|
|
9628
9714
|
}
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9715
|
+
return (hAsync("div", { class: 'searchcraft-search-result', innerHTML: this.templateHtml, onClick: this.handleResultContainerClick, onKeyDown: this.handleKeyDown }));
|
|
9716
|
+
}
|
|
9717
|
+
static get cmpMeta() { return {
|
|
9718
|
+
"$flags$": 768,
|
|
9719
|
+
"$tagName$": "searchcraft-search-result",
|
|
9720
|
+
"$members$": {
|
|
9721
|
+
"item": [16],
|
|
9722
|
+
"index": [2],
|
|
9723
|
+
"documentPosition": [2, "document-position"],
|
|
9724
|
+
"template": [16],
|
|
9725
|
+
"searchcraftId": [1, "searchcraft-id"],
|
|
9726
|
+
"templateHtml": [32]
|
|
9727
|
+
},
|
|
9728
|
+
"$listeners$": undefined,
|
|
9729
|
+
"$lazyBundleId$": "-",
|
|
9730
|
+
"$attrsToReflect$": []
|
|
9731
|
+
}; }
|
|
9732
|
+
}
|
|
9733
|
+
|
|
9734
|
+
/**
|
|
9735
|
+
* This web component is responsible for displaying the results of a search query. Once a query is submitted, the component formats and presents an ordered list of the results.
|
|
9736
|
+
*
|
|
9737
|
+
*
|
|
9738
|
+
* @react-import
|
|
9739
|
+
* ```jsx
|
|
9740
|
+
* import { SearchcraftSearchResults } from "@searchcraft/react-sdk";
|
|
9741
|
+
* ```
|
|
9742
|
+
*
|
|
9743
|
+
* @vue-import
|
|
9744
|
+
* ```jsx
|
|
9745
|
+
* import { SearchcraftSearchResults } from "@searchcraft/vue-sdk";
|
|
9746
|
+
* ```
|
|
9747
|
+
*
|
|
9748
|
+
* @js-example
|
|
9749
|
+
* ```html
|
|
9750
|
+
* <!-- index.html -->
|
|
9751
|
+
* <searchcraft-search-results
|
|
9752
|
+
* ad-interval="4"
|
|
9753
|
+
* place-ad-at-start="true"
|
|
9754
|
+
* />
|
|
9755
|
+
* ```
|
|
9756
|
+
*
|
|
9757
|
+
* ```js
|
|
9758
|
+
* // index.js
|
|
9759
|
+
* const searchResults = document.querySelector('searchcraft-search-results');
|
|
9760
|
+
*
|
|
9761
|
+
* searchResults.template = (item, index, { html }) => html`
|
|
9762
|
+
* <h2>${item.title}</h2>
|
|
9763
|
+
* `;
|
|
9764
|
+
* ```
|
|
9765
|
+
*
|
|
9766
|
+
* @react-example
|
|
9767
|
+
* ```jsx
|
|
9768
|
+
* <SearchcraftSearchResults
|
|
9769
|
+
* adInterval={4}
|
|
9770
|
+
* placeAdAtState={true}
|
|
9771
|
+
* template={(item, index, { html }) => html`
|
|
9772
|
+
* <h2>${item.title}</h2>
|
|
9773
|
+
* `}
|
|
9774
|
+
* />
|
|
9775
|
+
* ```
|
|
9776
|
+
*
|
|
9777
|
+
* @vue-example
|
|
9778
|
+
* ```jsx
|
|
9779
|
+
* <SearchcraftSearchResults
|
|
9780
|
+
* adInterval={4}
|
|
9781
|
+
* placeAdAtState={true}
|
|
9782
|
+
* :template={(item, index, { html }) => html`
|
|
9783
|
+
* <h2>${item.title}</h2>
|
|
9784
|
+
* `}
|
|
9785
|
+
* />
|
|
9786
|
+
* ```
|
|
9787
|
+
*/
|
|
9788
|
+
class SearchcraftSearchResults {
|
|
9789
|
+
constructor(hostRef) {
|
|
9790
|
+
registerInstance(this, hostRef);
|
|
9791
|
+
}
|
|
9792
|
+
/**
|
|
9793
|
+
* The id of the Searchcraft instance that this component should use.
|
|
9794
|
+
*/
|
|
9795
|
+
searchcraftId;
|
|
9796
|
+
/**
|
|
9797
|
+
* A query that will appears when the component initializes or the search term is ''..
|
|
9798
|
+
*/
|
|
9799
|
+
initialQuery;
|
|
9800
|
+
/**
|
|
9801
|
+
* A callback function responsible for rendering a result. Passed to `searchcraft-search-result`.
|
|
9802
|
+
*/
|
|
9803
|
+
template;
|
|
9804
|
+
adClientResponseItems = [];
|
|
9805
|
+
config;
|
|
9806
|
+
isSearchInProgress = true;
|
|
9807
|
+
searchClientResponseItems;
|
|
9808
|
+
searchResultsPage;
|
|
9809
|
+
searchResultsPerPage;
|
|
9810
|
+
searchTerm = '';
|
|
9811
|
+
unsubscribe;
|
|
9812
|
+
cleanupCore;
|
|
9813
|
+
onCoreAvailable(core) {
|
|
9814
|
+
const state = core.store.getState();
|
|
9815
|
+
this.handleStateChange(state);
|
|
9816
|
+
this.searchClientResponseItems = state.searchClientResponseItems;
|
|
9817
|
+
this.searchTerm = state.searchTerm;
|
|
9818
|
+
this.config = state.core?.config;
|
|
9819
|
+
this.unsubscribe = core.store.subscribe((state) => this.handleStateChange(state));
|
|
9820
|
+
}
|
|
9821
|
+
connectedCallback() {
|
|
9822
|
+
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
9823
|
+
}
|
|
9824
|
+
disconnectedCallback() {
|
|
9825
|
+
this.unsubscribe?.();
|
|
9826
|
+
this.cleanupCore?.();
|
|
9827
|
+
}
|
|
9828
|
+
handleStateChange(state) {
|
|
9829
|
+
this.adClientResponseItems = [...state.adClientResponseItems];
|
|
9830
|
+
this.config = state.core?.config;
|
|
9831
|
+
this.isSearchInProgress = state.isSearchInProgress;
|
|
9832
|
+
this.searchClientResponseItems = [...state.searchClientResponseItems];
|
|
9833
|
+
this.searchResultsPage = state.searchResultsPage;
|
|
9834
|
+
this.searchResultsPerPage = state.searchResultsPerPage;
|
|
9835
|
+
this.searchTerm = state.searchTerm;
|
|
9836
|
+
}
|
|
9837
|
+
renderEmptyState() {
|
|
9838
|
+
return (hAsync("div", { class: 'searchcraft-search-results-empty-state' }, hAsync("slot", { name: 'empty-search' })));
|
|
9839
|
+
}
|
|
9840
|
+
renderNoResultsFoundState() {
|
|
9841
|
+
return (hAsync("div", { class: 'searchcraft-search-results' }, hAsync("div", { class: 'searchcraft-search-results-error-message' }, hAsync("searchcraft-error-message", null, "No search results found for \"", this.searchTerm, "\" query."))));
|
|
9842
|
+
}
|
|
9843
|
+
renderWithADMAds() {
|
|
9844
|
+
const items = this.searchClientResponseItems || [];
|
|
9845
|
+
return (hAsync("div", { class: 'searchcraft-search-results' }, this.adClientResponseItems?.map((item) => (hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'adMarketplace', adClientResponseItem: item, key: item.id, renderPosition: 'top' }))), items.map((item, index) => (hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template })))));
|
|
9846
|
+
}
|
|
9847
|
+
renderWithCustomAds() {
|
|
9848
|
+
const itemsToRender = [];
|
|
9849
|
+
const interstitialInterval = this.config?.customAdConfig?.adInterstitialInterval || 0;
|
|
9850
|
+
const interstitialQuantity = this.config?.customAdConfig?.adInterstitialQuantity || 1;
|
|
9851
|
+
const adStartQuantity = this.config?.customAdConfig?.adStartQuantity || 0;
|
|
9852
|
+
const adEndQuantity = this.config?.customAdConfig?.adEndQuantity || 0;
|
|
9853
|
+
const items = this.searchClientResponseItems || [];
|
|
9854
|
+
// Renders ads at beginning
|
|
9855
|
+
for (let n = 0; n < adStartQuantity; n++) {
|
|
9856
|
+
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Custom', key: `${n}-ad`, renderPosition: 'top' }));
|
|
9632
9857
|
}
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9858
|
+
// Renders search results + interstitial ads
|
|
9859
|
+
items.forEach((item, index) => {
|
|
9860
|
+
if (interstitialInterval &&
|
|
9861
|
+
index % interstitialInterval === 0 &&
|
|
9862
|
+
index + interstitialInterval < items.length &&
|
|
9863
|
+
index >= interstitialInterval) {
|
|
9864
|
+
for (let n = 0; n < interstitialQuantity; n++) {
|
|
9865
|
+
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Custom', key: `${item.id}-ad-${n}`, renderPosition: 'interstitial' }));
|
|
9866
|
+
}
|
|
9867
|
+
}
|
|
9868
|
+
itemsToRender.push(hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template }));
|
|
9869
|
+
});
|
|
9870
|
+
// Renders ads at end
|
|
9871
|
+
for (let n = 0; n < adEndQuantity; n++) {
|
|
9872
|
+
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Custom', key: `${n}-ad`, renderPosition: 'bottom' }));
|
|
9636
9873
|
}
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9874
|
+
return hAsync("div", { class: 'searchcraft-search-results' }, itemsToRender);
|
|
9875
|
+
}
|
|
9876
|
+
renderWithNativoAds() {
|
|
9877
|
+
const itemsToRender = [];
|
|
9878
|
+
const interstitialStartIndex = this.config?.nativoConfig?.adInterstialStartIndex || 0;
|
|
9879
|
+
const interstitialInterval = this.config?.nativoConfig?.adInterstitialInterval || 0;
|
|
9880
|
+
const interstitialQuantity = this.config?.nativoConfig?.adInterstitialQuantity || 1;
|
|
9881
|
+
const adStartQuantity = this.config?.nativoConfig?.adStartQuantity || 0;
|
|
9882
|
+
const adEndQuantity = this.config?.nativoConfig?.adEndQuantity || 0;
|
|
9883
|
+
const items = this.searchClientResponseItems || [];
|
|
9884
|
+
// Renders ads at beginning
|
|
9885
|
+
for (let n = 0; n < adStartQuantity; n++) {
|
|
9886
|
+
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Nativo', key: `${n}-ad`, renderPosition: 'top' }));
|
|
9640
9887
|
}
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9888
|
+
// Renders search results + interstitial ads
|
|
9889
|
+
items.forEach((item, index) => {
|
|
9890
|
+
if (interstitialInterval &&
|
|
9891
|
+
(index + interstitialStartIndex) % interstitialInterval === 0 &&
|
|
9892
|
+
index + interstitialInterval < items.length &&
|
|
9893
|
+
index >= interstitialInterval) {
|
|
9894
|
+
for (let n = 0; n < interstitialQuantity; n++) {
|
|
9895
|
+
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Nativo', key: `${item.id}-ad-${n}`, renderPosition: 'interstitial' }));
|
|
9896
|
+
}
|
|
9897
|
+
}
|
|
9898
|
+
itemsToRender.push(hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template }));
|
|
9899
|
+
});
|
|
9900
|
+
// Renders ads at end
|
|
9901
|
+
for (let n = 0; n < adEndQuantity; n++) {
|
|
9902
|
+
itemsToRender.push(hAsync("searchcraft-ad", { "searchcraft-id": this.searchcraftId, adSource: 'Nativo', key: `${n}-ad`, renderPosition: 'bottom' }));
|
|
9644
9903
|
}
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9904
|
+
return hAsync("div", { class: 'searchcraft-search-results' }, itemsToRender);
|
|
9905
|
+
}
|
|
9906
|
+
renderWithNoAds() {
|
|
9907
|
+
const items = this.searchClientResponseItems || [];
|
|
9908
|
+
return (hAsync("div", { class: 'searchcraft-search-results' }, items.map((item, index) => (hAsync("searchcraft-search-result", { "searchcraft-id": this.searchcraftId, key: item.id, "document-position": this.searchResultsPerPage * (this.searchResultsPage - 1) + index, index: index, item: item, template: this.template })))));
|
|
9909
|
+
}
|
|
9910
|
+
render() {
|
|
9911
|
+
const searchClientResponseItems = this.searchClientResponseItems || [];
|
|
9912
|
+
if (searchClientResponseItems.length === 0 && !this.isSearchInProgress) {
|
|
9913
|
+
return this.renderEmptyState();
|
|
9648
9914
|
}
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9915
|
+
if (this.searchTerm.length > 0 &&
|
|
9916
|
+
searchClientResponseItems.length === 0 &&
|
|
9917
|
+
!this.isSearchInProgress) {
|
|
9918
|
+
return this.renderNoResultsFoundState();
|
|
9652
9919
|
}
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
break;
|
|
9920
|
+
if (this.config?.customAdConfig) {
|
|
9921
|
+
return this.renderWithCustomAds();
|
|
9656
9922
|
}
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
break;
|
|
9923
|
+
if (this.config?.admAdConfig) {
|
|
9924
|
+
return this.renderWithNativoAds();
|
|
9660
9925
|
}
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
break;
|
|
9926
|
+
if (this.config?.nativoConfig) {
|
|
9927
|
+
return this.renderWithNativoAds();
|
|
9664
9928
|
}
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9929
|
+
return this.renderWithNoAds();
|
|
9930
|
+
}
|
|
9931
|
+
static get cmpMeta() { return {
|
|
9932
|
+
"$flags$": 772,
|
|
9933
|
+
"$tagName$": "searchcraft-search-results",
|
|
9934
|
+
"$members$": {
|
|
9935
|
+
"searchcraftId": [1, "searchcraft-id"],
|
|
9936
|
+
"initialQuery": [1, "initial-query"],
|
|
9937
|
+
"template": [16],
|
|
9938
|
+
"adClientResponseItems": [32],
|
|
9939
|
+
"config": [32],
|
|
9940
|
+
"isSearchInProgress": [32],
|
|
9941
|
+
"searchClientResponseItems": [32],
|
|
9942
|
+
"searchResultsPage": [32],
|
|
9943
|
+
"searchResultsPerPage": [32],
|
|
9944
|
+
"searchTerm": [32]
|
|
9945
|
+
},
|
|
9946
|
+
"$listeners$": undefined,
|
|
9947
|
+
"$lazyBundleId$": "-",
|
|
9948
|
+
"$attrsToReflect$": []
|
|
9949
|
+
}; }
|
|
9950
|
+
}
|
|
9951
|
+
|
|
9952
|
+
/**
|
|
9953
|
+
* This web component is designed to choose the number of search results displayed.
|
|
9954
|
+
*
|
|
9955
|
+
* @react-import
|
|
9956
|
+
* ```jsx
|
|
9957
|
+
* import { SearchcraftSearchResultsPerPage } from "@searchcraft/react-sdk";
|
|
9958
|
+
* ```
|
|
9959
|
+
*
|
|
9960
|
+
* @vue-import
|
|
9961
|
+
* ```jsx
|
|
9962
|
+
* import { SearchcraftSearchResultsPerPage } from "@searchcraft/vue-sdk";
|
|
9963
|
+
* ```
|
|
9964
|
+
*
|
|
9965
|
+
* @js-example
|
|
9966
|
+
* ```html
|
|
9967
|
+
* <!-- index.html -->
|
|
9968
|
+
* <searchcraft-search-results-per-page increment="20" />
|
|
9969
|
+
* ```
|
|
9970
|
+
*
|
|
9971
|
+
* @react-example
|
|
9972
|
+
* ```jsx
|
|
9973
|
+
* <SearchcraftSearchResultsPerPage increment={20} />
|
|
9974
|
+
* ```
|
|
9975
|
+
*
|
|
9976
|
+
* @vue-example
|
|
9977
|
+
* ```jsx
|
|
9978
|
+
* <SearchcraftSearchResultsPerPage increment="20" />
|
|
9979
|
+
* ```
|
|
9980
|
+
*/
|
|
9981
|
+
class SearchcraftSearchResultsPerPage {
|
|
9982
|
+
constructor(hostRef) {
|
|
9983
|
+
registerInstance(this, hostRef);
|
|
9984
|
+
}
|
|
9985
|
+
/**
|
|
9986
|
+
* The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]).
|
|
9987
|
+
* The base value is defined by the `searchResultsPerPage` option in the configuration.
|
|
9988
|
+
*/
|
|
9989
|
+
increment = 20;
|
|
9990
|
+
/**
|
|
9991
|
+
* The id of the Searchcraft instance that this component should use.
|
|
9992
|
+
*/
|
|
9993
|
+
searchcraftId;
|
|
9994
|
+
// store vars
|
|
9995
|
+
searchTerm;
|
|
9996
|
+
searchResultsPage;
|
|
9997
|
+
searchResultsPerPage;
|
|
9998
|
+
searchResultsCount;
|
|
9999
|
+
searchResultsPagesCount;
|
|
10000
|
+
searchClientRequestProperties;
|
|
10001
|
+
// local vars
|
|
10002
|
+
initialSearchResultsPerPage;
|
|
10003
|
+
// store functions
|
|
10004
|
+
setSearchResultsPerPage = () => { };
|
|
10005
|
+
setSearchResultsPage = () => { };
|
|
10006
|
+
unsubscribe = () => { };
|
|
10007
|
+
cleanupCore;
|
|
10008
|
+
onCoreAvailable(core) {
|
|
10009
|
+
this.unsubscribe = core.store.subscribe((state) => {
|
|
10010
|
+
// store vars
|
|
10011
|
+
this.searchTerm = state.searchTerm;
|
|
10012
|
+
this.searchResultsPerPage = state.searchResultsPerPage;
|
|
10013
|
+
this.searchResultsPage = state.searchResultsPage;
|
|
10014
|
+
this.searchResultsCount = state.searchResultsCount;
|
|
10015
|
+
this.searchClientRequestProperties = state.searchClientRequestProperties;
|
|
10016
|
+
// local vars
|
|
10017
|
+
this.searchResultsPagesCount = Math.ceil(this.searchResultsCount / this.searchResultsPerPage);
|
|
10018
|
+
// store functions
|
|
10019
|
+
this.setSearchResultsPage = state.setSearchResultsPage;
|
|
10020
|
+
this.setSearchResultsPerPage = state.setSearchResultsPerPage;
|
|
10021
|
+
});
|
|
10022
|
+
this.initialSearchResultsPerPage =
|
|
10023
|
+
core.store.getState().searchResultsPerPage;
|
|
10024
|
+
}
|
|
10025
|
+
connectedCallback() {
|
|
10026
|
+
this.cleanupCore = registry.useCoreInstance(this.searchcraftId, this.onCoreAvailable.bind(this));
|
|
10027
|
+
}
|
|
10028
|
+
disconnectedCallback() {
|
|
10029
|
+
this.unsubscribe?.();
|
|
10030
|
+
this.cleanupCore?.();
|
|
10031
|
+
}
|
|
10032
|
+
render() {
|
|
10033
|
+
// Check if this is an initialQuery case (string requestProperties with empty searchTerm)
|
|
10034
|
+
const isInitialQuery = typeof this.searchClientRequestProperties === 'string' &&
|
|
10035
|
+
this.searchTerm.trim() === '';
|
|
10036
|
+
// early return if there isn't a searchTerm (unless it's initialQuery) or there is 1 or fewer pages of results
|
|
10037
|
+
if ((!this.searchTerm && !isInitialQuery) ||
|
|
10038
|
+
this.searchResultsPagesCount <= 1) {
|
|
10039
|
+
return;
|
|
9673
10040
|
}
|
|
9674
|
-
|
|
10041
|
+
return (hAsync("div", { class: 'searchcraft-search-results-per-page' }, hAsync("div", { class: 'searchcraft-search-results-per-page-select' }, hAsync("label", { class: 'searchcraft-search-results-per-page-select-label', htmlFor: 'searchcraft-search-results-per-page-select-input' }, "Results Per Page"), hAsync("div", { class: 'searchcraft-search-results-per-page-select-input' }, hAsync("searchcraft-select", { inputId: 'searchcraft-search-results-per-page-select-input', name: 'results-per-page', options: [...Array(5)].map((_, index) => {
|
|
10042
|
+
const value = this.initialSearchResultsPerPage +
|
|
10043
|
+
Number(this.increment) * index;
|
|
10044
|
+
return {
|
|
10045
|
+
label: `${value}`,
|
|
10046
|
+
value,
|
|
10047
|
+
};
|
|
10048
|
+
}), onSelectChange: (event) => {
|
|
10049
|
+
this.setSearchResultsPerPage(Number(event.detail));
|
|
10050
|
+
this.setSearchResultsPage(1);
|
|
10051
|
+
} })))));
|
|
9675
10052
|
}
|
|
9676
|
-
return
|
|
9677
|
-
|
|
9678
|
-
|
|
10053
|
+
static get cmpMeta() { return {
|
|
10054
|
+
"$flags$": 768,
|
|
10055
|
+
"$tagName$": "searchcraft-search-results-per-page",
|
|
10056
|
+
"$members$": {
|
|
10057
|
+
"increment": [8],
|
|
10058
|
+
"searchcraftId": [1, "searchcraft-id"],
|
|
10059
|
+
"searchTerm": [32],
|
|
10060
|
+
"searchResultsPage": [32],
|
|
10061
|
+
"searchResultsPerPage": [32],
|
|
10062
|
+
"searchResultsCount": [32],
|
|
10063
|
+
"searchResultsPagesCount": [32],
|
|
10064
|
+
"searchClientRequestProperties": [32],
|
|
10065
|
+
"initialSearchResultsPerPage": [32],
|
|
10066
|
+
"setSearchResultsPerPage": [32],
|
|
10067
|
+
"setSearchResultsPage": [32]
|
|
10068
|
+
},
|
|
10069
|
+
"$listeners$": undefined,
|
|
10070
|
+
"$lazyBundleId$": "-",
|
|
10071
|
+
"$attrsToReflect$": []
|
|
10072
|
+
}; }
|
|
10073
|
+
}
|
|
9679
10074
|
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
10075
|
+
/**
|
|
10076
|
+
* This web component is designed to allow users to select between a group of options.
|
|
10077
|
+
*
|
|
10078
|
+
* @js-example
|
|
10079
|
+
* ```html
|
|
10080
|
+
* <!-- index.html -->
|
|
10081
|
+
* <searchcraft-select
|
|
10082
|
+
* inputId="searchcraft-select"
|
|
10083
|
+
* name="searchcraft-select"
|
|
10084
|
+
* options="[{ label: 'label', value: 'value' }]"
|
|
10085
|
+
* />
|
|
10086
|
+
* ```
|
|
10087
|
+
*
|
|
10088
|
+
* @internal
|
|
10089
|
+
*/
|
|
10090
|
+
class SearchcraftSelect {
|
|
10091
|
+
constructor(hostRef) {
|
|
10092
|
+
registerInstance(this, hostRef);
|
|
10093
|
+
this.selectChange = createEvent(this, "selectChange");
|
|
10094
|
+
}
|
|
10095
|
+
/**
|
|
10096
|
+
* The caption displayed below the select input.
|
|
10097
|
+
*/
|
|
10098
|
+
caption;
|
|
10099
|
+
/**
|
|
10100
|
+
* Whether the select input is disabled.
|
|
10101
|
+
*/
|
|
10102
|
+
disabled = false;
|
|
10103
|
+
/**
|
|
10104
|
+
* The ID for the select input.
|
|
10105
|
+
*/
|
|
10106
|
+
inputId;
|
|
10107
|
+
/**
|
|
10108
|
+
* The label of the select input.
|
|
10109
|
+
*/
|
|
10110
|
+
label;
|
|
10111
|
+
/**
|
|
10112
|
+
* The ID for the label of the select input.
|
|
10113
|
+
*/
|
|
10114
|
+
labelId;
|
|
10115
|
+
/**
|
|
10116
|
+
* The name of the select input.
|
|
10117
|
+
*/
|
|
10118
|
+
name;
|
|
10119
|
+
/**
|
|
10120
|
+
* The options for the select input.
|
|
10121
|
+
*/
|
|
10122
|
+
options = [];
|
|
10123
|
+
/**
|
|
10124
|
+
* The event fired when the select is changed.
|
|
10125
|
+
*/
|
|
10126
|
+
selectChange;
|
|
10127
|
+
searchResultsPerPage;
|
|
10128
|
+
setSearchResultsPage = () => { };
|
|
10129
|
+
setSearchResultsPerPage = () => { };
|
|
10130
|
+
handleSelectChange = (event) => {
|
|
10131
|
+
this.selectChange.emit(event.target.value);
|
|
10132
|
+
};
|
|
10133
|
+
handleGoToPage(page) {
|
|
10134
|
+
this.setSearchResultsPage(page);
|
|
10135
|
+
}
|
|
10136
|
+
render() {
|
|
10137
|
+
return (hAsync("div", { key: '15ecbf48c824a161cd83bdab99dace8e44f1ab39', class: 'searchcraft-select' }, this.label && (hAsync("label", { key: 'aba433ae9c27c9405099cffcef923c3ad22d7fda', class: 'searchcraft-select-label', id: this.labelId || `${this.inputId}-label`, htmlFor: this.inputId }, this.label)), hAsync("div", { key: '8df8a2ff05924c9c55cdd6e3827cd927cddab82a', class: 'searchcraft-select-input-wrapper' }, hAsync("select", { key: '1d5f492c2255f8ca1b6ea5e04a2726dda2f2c52f', "aria-labelledby": this.label ? this.labelId || `${this.inputId}-label` : undefined, class: 'searchcraft-select-input', disabled: this.disabled, id: this.inputId, name: this.name, onChange: this.handleSelectChange }, (typeof this.options === 'string'
|
|
10138
|
+
? JSON.parse(this.options)
|
|
10139
|
+
: this.options).map(({ label, value, selected }) => {
|
|
10140
|
+
return (hAsync("option", { key: value, value: value, selected: selected }, label));
|
|
10141
|
+
})), hAsync("svg", { key: '0ec6892b529f2e70027aadea47208582a65a97b7', class: 'searchcraft-select-input-icon', width: '20', height: '20', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' }, hAsync("title", { key: 'bced6b62378491d1d1c629b602d7d033d912c761' }, "Select dropdown icon"), hAsync("path", { key: '659f8ebf9129e2e7941da949d29688c41c1472bb', d: 'M5 7.5L10 12.5L15 7.5', stroke: 'currentColor', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))), this.caption && (hAsync("p", { key: '51217d926f68f79b6c3514f5fd769b56549fdce9', class: 'searchcraft-select-caption' }, this.caption))));
|
|
10142
|
+
}
|
|
10143
|
+
static get cmpMeta() { return {
|
|
10144
|
+
"$flags$": 768,
|
|
10145
|
+
"$tagName$": "searchcraft-select",
|
|
10146
|
+
"$members$": {
|
|
10147
|
+
"caption": [1],
|
|
10148
|
+
"disabled": [4],
|
|
10149
|
+
"inputId": [1, "input-id"],
|
|
10150
|
+
"label": [1],
|
|
10151
|
+
"labelId": [1, "label-id"],
|
|
10152
|
+
"name": [1],
|
|
10153
|
+
"options": [1],
|
|
10154
|
+
"searchResultsPerPage": [32],
|
|
10155
|
+
"setSearchResultsPage": [32],
|
|
10156
|
+
"setSearchResultsPerPage": [32]
|
|
10157
|
+
},
|
|
10158
|
+
"$listeners$": undefined,
|
|
10159
|
+
"$lazyBundleId$": "-",
|
|
10160
|
+
"$attrsToReflect$": []
|
|
10161
|
+
}; }
|
|
10162
|
+
}
|
|
9723
10163
|
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
const tableToken = token;
|
|
9749
|
-
for (const cell of tableToken.header) {
|
|
9750
|
-
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
9751
|
-
}
|
|
9752
|
-
for (const row of tableToken.rows) {
|
|
9753
|
-
for (const cell of row) {
|
|
9754
|
-
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
10164
|
+
/**
|
|
10165
|
+
* Creates a throttled version of the given function that only invokes
|
|
10166
|
+
* the original function at most once every specified number of milliseconds.
|
|
10167
|
+
*
|
|
10168
|
+
* The logic is written in a way that the last invocation is always called, after the
|
|
10169
|
+
* throttle cooldown period has ended.
|
|
10170
|
+
*
|
|
10171
|
+
* @template Arguments - The argument types for the function to throttle
|
|
10172
|
+
* @param callback - The function to throttle
|
|
10173
|
+
* @param delayInMilliseconds - The number of milliseconds to wait before allowing the next invocation
|
|
10174
|
+
* @returns A throttled version of the original function
|
|
10175
|
+
*/
|
|
10176
|
+
function throttle(callback, delayInMilliseconds) {
|
|
10177
|
+
let isThrottleOnCooldown = false;
|
|
10178
|
+
let trailingCallArgs = null;
|
|
10179
|
+
const invokeAction = (args) => {
|
|
10180
|
+
callback(...args);
|
|
10181
|
+
isThrottleOnCooldown = true;
|
|
10182
|
+
setTimeout(() => {
|
|
10183
|
+
isThrottleOnCooldown = false;
|
|
10184
|
+
if (trailingCallArgs) {
|
|
10185
|
+
const nextArgs = trailingCallArgs;
|
|
10186
|
+
trailingCallArgs = null;
|
|
10187
|
+
invokeAction(nextArgs);
|
|
9755
10188
|
}
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
values = values.concat(this.walkTokens(listToken.items, callback));
|
|
9762
|
-
break;
|
|
10189
|
+
}, delayInMilliseconds);
|
|
10190
|
+
};
|
|
10191
|
+
return (...args) => {
|
|
10192
|
+
if (!isThrottleOnCooldown) {
|
|
10193
|
+
invokeAction(args);
|
|
9763
10194
|
}
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
|
|
9767
|
-
this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
|
|
9768
|
-
const tokens2 = genericToken[childTokens].flat(Infinity);
|
|
9769
|
-
values = values.concat(this.walkTokens(tokens2, callback));
|
|
9770
|
-
});
|
|
9771
|
-
} else if (genericToken.tokens) {
|
|
9772
|
-
values = values.concat(this.walkTokens(genericToken.tokens, callback));
|
|
9773
|
-
}
|
|
10195
|
+
else {
|
|
10196
|
+
trailingCallArgs = args;
|
|
9774
10197
|
}
|
|
9775
|
-
|
|
10198
|
+
};
|
|
10199
|
+
}
|
|
10200
|
+
|
|
10201
|
+
/**
|
|
10202
|
+
* This web component is designed to allow users to select a value from a range defined by a minimum and maximum value. The component renders a slider interface, which can be used to visually choose a value between two boundaries.
|
|
10203
|
+
*
|
|
10204
|
+
* @internal
|
|
10205
|
+
*/
|
|
10206
|
+
class SearchcraftSlider {
|
|
10207
|
+
constructor(hostRef) {
|
|
10208
|
+
registerInstance(this, hostRef);
|
|
10209
|
+
this.rangeChanged = createEvent(this, "rangeChanged");
|
|
9776
10210
|
}
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
} else {
|
|
9818
|
-
extensions.startBlock = [ext.start];
|
|
9819
|
-
}
|
|
9820
|
-
} else if (ext.level === "inline") {
|
|
9821
|
-
if (extensions.startInline) {
|
|
9822
|
-
extensions.startInline.push(ext.start);
|
|
9823
|
-
} else {
|
|
9824
|
-
extensions.startInline = [ext.start];
|
|
9825
|
-
}
|
|
9826
|
-
}
|
|
9827
|
-
}
|
|
9828
|
-
}
|
|
9829
|
-
if ("childTokens" in ext && ext.childTokens) {
|
|
9830
|
-
extensions.childTokens[ext.name] = ext.childTokens;
|
|
9831
|
-
}
|
|
9832
|
-
});
|
|
9833
|
-
opts.extensions = extensions;
|
|
9834
|
-
}
|
|
9835
|
-
if (pack.renderer) {
|
|
9836
|
-
const renderer = this.defaults.renderer || new _Renderer(this.defaults);
|
|
9837
|
-
for (const prop in pack.renderer) {
|
|
9838
|
-
if (!(prop in renderer)) {
|
|
9839
|
-
throw new Error(`renderer '${prop}' does not exist`);
|
|
9840
|
-
}
|
|
9841
|
-
if (["options", "parser"].includes(prop)) {
|
|
9842
|
-
continue;
|
|
9843
|
-
}
|
|
9844
|
-
const rendererProp = prop;
|
|
9845
|
-
const rendererFunc = pack.renderer[rendererProp];
|
|
9846
|
-
const prevRenderer = renderer[rendererProp];
|
|
9847
|
-
renderer[rendererProp] = (...args2) => {
|
|
9848
|
-
let ret = rendererFunc.apply(renderer, args2);
|
|
9849
|
-
if (ret === false) {
|
|
9850
|
-
ret = prevRenderer.apply(renderer, args2);
|
|
9851
|
-
}
|
|
9852
|
-
return ret || "";
|
|
9853
|
-
};
|
|
9854
|
-
}
|
|
9855
|
-
opts.renderer = renderer;
|
|
9856
|
-
}
|
|
9857
|
-
if (pack.tokenizer) {
|
|
9858
|
-
const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
|
|
9859
|
-
for (const prop in pack.tokenizer) {
|
|
9860
|
-
if (!(prop in tokenizer)) {
|
|
9861
|
-
throw new Error(`tokenizer '${prop}' does not exist`);
|
|
9862
|
-
}
|
|
9863
|
-
if (["options", "rules", "lexer"].includes(prop)) {
|
|
9864
|
-
continue;
|
|
9865
|
-
}
|
|
9866
|
-
const tokenizerProp = prop;
|
|
9867
|
-
const tokenizerFunc = pack.tokenizer[tokenizerProp];
|
|
9868
|
-
const prevTokenizer = tokenizer[tokenizerProp];
|
|
9869
|
-
tokenizer[tokenizerProp] = (...args2) => {
|
|
9870
|
-
let ret = tokenizerFunc.apply(tokenizer, args2);
|
|
9871
|
-
if (ret === false) {
|
|
9872
|
-
ret = prevTokenizer.apply(tokenizer, args2);
|
|
10211
|
+
/**
|
|
10212
|
+
* The maximum value allowed.
|
|
10213
|
+
*/
|
|
10214
|
+
max = 100;
|
|
10215
|
+
/**
|
|
10216
|
+
* The minimum value allowed.
|
|
10217
|
+
*/
|
|
10218
|
+
min = 0;
|
|
10219
|
+
/**
|
|
10220
|
+
* The step amount for the slider inputs.
|
|
10221
|
+
*/
|
|
10222
|
+
step = 1;
|
|
10223
|
+
/** The type of data the sliders are using. */
|
|
10224
|
+
dataType = 'number';
|
|
10225
|
+
/** The date granularity to use. Used to format date labels. */
|
|
10226
|
+
dateGranularity;
|
|
10227
|
+
lowerBound = 0;
|
|
10228
|
+
upperBound = 1;
|
|
10229
|
+
endValue = 0;
|
|
10230
|
+
startValue = 0;
|
|
10231
|
+
lastFocusedHandle = 'max';
|
|
10232
|
+
throttledEmitUpdate = () => { };
|
|
10233
|
+
/**
|
|
10234
|
+
* When the range has changed.
|
|
10235
|
+
* */
|
|
10236
|
+
rangeChanged;
|
|
10237
|
+
connectedCallback() {
|
|
10238
|
+
switch (this.dataType) {
|
|
10239
|
+
case 'number':
|
|
10240
|
+
this.startValue = this.min;
|
|
10241
|
+
this.endValue = this.max;
|
|
10242
|
+
this.lowerBound = this.min;
|
|
10243
|
+
this.upperBound = this.max;
|
|
10244
|
+
break;
|
|
10245
|
+
case 'date': {
|
|
10246
|
+
this.startValue = 0;
|
|
10247
|
+
this.endValue = getDifferenceInUnits(this.dateGranularity || 'year', this.min, this.max);
|
|
10248
|
+
this.lowerBound = 0;
|
|
10249
|
+
this.upperBound = this.endValue;
|
|
10250
|
+
break;
|
|
9873
10251
|
}
|
|
9874
|
-
return ret;
|
|
9875
|
-
};
|
|
9876
10252
|
}
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
if (["options", "block"].includes(prop)) {
|
|
9886
|
-
continue;
|
|
9887
|
-
}
|
|
9888
|
-
const hooksProp = prop;
|
|
9889
|
-
const hooksFunc = pack.hooks[hooksProp];
|
|
9890
|
-
const prevHook = hooks[hooksProp];
|
|
9891
|
-
if (_Hooks.passThroughHooks.has(prop)) {
|
|
9892
|
-
hooks[hooksProp] = (arg) => {
|
|
9893
|
-
if (this.defaults.async) {
|
|
9894
|
-
return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
|
|
9895
|
-
return prevHook.call(hooks, ret2);
|
|
10253
|
+
this.throttledEmitUpdate = throttle(this.emitUpdate, 120);
|
|
10254
|
+
}
|
|
10255
|
+
emitUpdate = async () => {
|
|
10256
|
+
switch (this.dataType) {
|
|
10257
|
+
case 'number':
|
|
10258
|
+
this.rangeChanged?.emit({
|
|
10259
|
+
startValue: this.startValue,
|
|
10260
|
+
endValue: this.endValue,
|
|
9896
10261
|
});
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
};
|
|
9909
|
-
}
|
|
10262
|
+
break;
|
|
10263
|
+
case 'date': {
|
|
10264
|
+
const granularity = this.dateGranularity || 'year';
|
|
10265
|
+
const startTimestamp = getStartOf(this.min, granularity, this.lowerBound + this.startValue);
|
|
10266
|
+
const endTimestamp = getStartOf(this.min, granularity, this.lowerBound + this.endValue + 1);
|
|
10267
|
+
this.rangeChanged?.emit({
|
|
10268
|
+
startValue: startTimestamp,
|
|
10269
|
+
endValue: endTimestamp,
|
|
10270
|
+
});
|
|
10271
|
+
break;
|
|
10272
|
+
}
|
|
9910
10273
|
}
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
const
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
if (walkTokens2) {
|
|
9920
|
-
values = values.concat(walkTokens2.call(this, token));
|
|
9921
|
-
}
|
|
9922
|
-
return values;
|
|
9923
|
-
};
|
|
9924
|
-
}
|
|
9925
|
-
this.defaults = { ...this.defaults, ...opts };
|
|
9926
|
-
});
|
|
9927
|
-
return this;
|
|
9928
|
-
}
|
|
9929
|
-
setOptions(opt) {
|
|
9930
|
-
this.defaults = { ...this.defaults, ...opt };
|
|
9931
|
-
return this;
|
|
9932
|
-
}
|
|
9933
|
-
lexer(src, options2) {
|
|
9934
|
-
return _Lexer.lex(src, options2 ?? this.defaults);
|
|
9935
|
-
}
|
|
9936
|
-
parser(tokens, options2) {
|
|
9937
|
-
return _Parser.parse(tokens, options2 ?? this.defaults);
|
|
9938
|
-
}
|
|
9939
|
-
parseMarkdown(blockType) {
|
|
9940
|
-
const parse2 = (src, options2) => {
|
|
9941
|
-
const origOpt = { ...options2 };
|
|
9942
|
-
const opt = { ...this.defaults, ...origOpt };
|
|
9943
|
-
const throwError = this.onError(!!opt.silent, !!opt.async);
|
|
9944
|
-
if (this.defaults.async === true && origOpt.async === false) {
|
|
9945
|
-
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."));
|
|
9946
|
-
}
|
|
9947
|
-
if (typeof src === "undefined" || src === null) {
|
|
9948
|
-
return throwError(new Error("marked(): input parameter is undefined or null"));
|
|
9949
|
-
}
|
|
9950
|
-
if (typeof src !== "string") {
|
|
9951
|
-
return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
|
|
9952
|
-
}
|
|
9953
|
-
if (opt.hooks) {
|
|
9954
|
-
opt.hooks.options = opt;
|
|
9955
|
-
opt.hooks.block = blockType;
|
|
9956
|
-
}
|
|
9957
|
-
const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
|
|
9958
|
-
const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
|
|
9959
|
-
if (opt.async) {
|
|
9960
|
-
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);
|
|
9961
|
-
}
|
|
9962
|
-
try {
|
|
9963
|
-
if (opt.hooks) {
|
|
9964
|
-
src = opt.hooks.preprocess(src);
|
|
10274
|
+
};
|
|
10275
|
+
handleStartValueChange = (event) => {
|
|
10276
|
+
const inputElement = event.target;
|
|
10277
|
+
const value = Number.parseInt(inputElement.value, 10);
|
|
10278
|
+
this.lastFocusedHandle = 'min';
|
|
10279
|
+
if (value <= this.endValue) {
|
|
10280
|
+
this.startValue = value;
|
|
10281
|
+
this.throttledEmitUpdate();
|
|
9965
10282
|
}
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
10283
|
+
else {
|
|
10284
|
+
this.startValue = this.endValue;
|
|
10285
|
+
inputElement.value = `${this.endValue}`;
|
|
9969
10286
|
}
|
|
9970
|
-
|
|
9971
|
-
|
|
10287
|
+
};
|
|
10288
|
+
handleEndValueChange = (event) => {
|
|
10289
|
+
const inputElement = event.target;
|
|
10290
|
+
const value = Number.parseInt(inputElement.value, 10);
|
|
10291
|
+
this.lastFocusedHandle = 'max';
|
|
10292
|
+
if (value >= this.startValue) {
|
|
10293
|
+
this.endValue = value;
|
|
10294
|
+
this.throttledEmitUpdate();
|
|
9972
10295
|
}
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
10296
|
+
else {
|
|
10297
|
+
this.endValue = this.startValue;
|
|
10298
|
+
inputElement.value = `${this.startValue}`;
|
|
9976
10299
|
}
|
|
9977
|
-
return html2;
|
|
9978
|
-
} catch (e) {
|
|
9979
|
-
return throwError(e);
|
|
9980
|
-
}
|
|
9981
10300
|
};
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
10301
|
+
getLabel = (value) => {
|
|
10302
|
+
switch (this.dataType) {
|
|
10303
|
+
case 'number':
|
|
10304
|
+
return `${this.startValue}`;
|
|
10305
|
+
case 'date': {
|
|
10306
|
+
const granularity = this.dateGranularity || 'year';
|
|
10307
|
+
const dateOffset = this.lowerBound + value;
|
|
10308
|
+
const timestamp = getStartOf(this.min, granularity, dateOffset);
|
|
10309
|
+
return getFormattedDateString(this.dateGranularity || 'year', new Date(timestamp));
|
|
10310
|
+
}
|
|
9991
10311
|
}
|
|
9992
|
-
return msg;
|
|
9993
|
-
}
|
|
9994
|
-
if (async) {
|
|
9995
|
-
return Promise.reject(e);
|
|
9996
|
-
}
|
|
9997
|
-
throw e;
|
|
9998
10312
|
};
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10313
|
+
render() {
|
|
10314
|
+
const startPercent = ((this.startValue - this.lowerBound) /
|
|
10315
|
+
(this.upperBound - this.lowerBound)) *
|
|
10316
|
+
100;
|
|
10317
|
+
const endPercent = ((this.endValue - this.lowerBound) /
|
|
10318
|
+
(this.upperBound - this.lowerBound)) *
|
|
10319
|
+
100;
|
|
10320
|
+
const startLabel = this.getLabel(this.startValue);
|
|
10321
|
+
const endLabel = this.getLabel(this.endValue);
|
|
10322
|
+
return (hAsync("div", { key: '2c72254f52151edd2e2fa89c092fc788db0b5562', class: 'searchcraft-slider' }, hAsync("div", { key: '98c25badf2c9386d7173ea552e510dcc168e7fc7', class: 'searchcraft-slider-range' }, hAsync("div", { key: '50774db2253e34b1bce68acc0a40b2706cab542d', class: 'searchcraft-slider-active-range', style: {
|
|
10323
|
+
left: `${startPercent}%`,
|
|
10324
|
+
width: `${endPercent - startPercent}%`,
|
|
10325
|
+
} }), hAsync("input", { key: '229afedc1318a63cbd75806805210cf4f5695e6e', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-min-handle'), max: this.upperBound, min: this.lowerBound, onInput: this.handleStartValueChange.bind(this), step: this.step, style: { zIndex: this.lastFocusedHandle === 'min' ? '2' : '1' }, type: 'range', value: this.startValue }), hAsync("input", { key: '6aa038b01daaba86f501ebbbec30fc6720b549b3', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-max-handle'), max: this.upperBound, min: this.lowerBound, onInput: this.handleEndValueChange.bind(this), step: this.step, style: { zIndex: this.lastFocusedHandle === 'max' ? '2' : '1' }, type: 'range', value: this.endValue })), hAsync("div", { key: 'f70501538635c3b08ad1e6ac101d0b3192ef8e04', class: 'searchcraft-slider-label' }, hAsync("span", { key: 'ddd539b86774f8900771d77d5ef7eb3a67c98d59', class: 'searchcraft-slider-start-label' }, startLabel), hAsync("span", { key: 'b754a9c8d284e0623032cee6b92f9df88873ec04', class: 'searchcraft-slider-end-label' }, endLabel))));
|
|
10326
|
+
}
|
|
10327
|
+
static get cmpMeta() { return {
|
|
10328
|
+
"$flags$": 768,
|
|
10329
|
+
"$tagName$": "searchcraft-slider",
|
|
10330
|
+
"$members$": {
|
|
10331
|
+
"max": [2],
|
|
10332
|
+
"min": [2],
|
|
10333
|
+
"step": [2],
|
|
10334
|
+
"dataType": [1, "data-type"],
|
|
10335
|
+
"dateGranularity": [1, "date-granularity"],
|
|
10336
|
+
"lowerBound": [32],
|
|
10337
|
+
"upperBound": [32],
|
|
10338
|
+
"endValue": [32],
|
|
10339
|
+
"startValue": [32],
|
|
10340
|
+
"lastFocusedHandle": [32]
|
|
10341
|
+
},
|
|
10342
|
+
"$listeners$": undefined,
|
|
10343
|
+
"$lazyBundleId$": "-",
|
|
10344
|
+
"$attrsToReflect$": []
|
|
10345
|
+
}; }
|
|
10006
10346
|
}
|
|
10007
|
-
marked.options = marked.setOptions = function(options2) {
|
|
10008
|
-
markedInstance.setOptions(options2);
|
|
10009
|
-
marked.defaults = markedInstance.defaults;
|
|
10010
|
-
changeDefaults(marked.defaults);
|
|
10011
|
-
return marked;
|
|
10012
|
-
};
|
|
10013
|
-
marked.getDefaults = _getDefaults;
|
|
10014
|
-
marked.defaults = _defaults;
|
|
10015
|
-
marked.use = function(...args) {
|
|
10016
|
-
markedInstance.use(...args);
|
|
10017
|
-
marked.defaults = markedInstance.defaults;
|
|
10018
|
-
changeDefaults(marked.defaults);
|
|
10019
|
-
return marked;
|
|
10020
|
-
};
|
|
10021
|
-
marked.walkTokens = function(tokens, callback) {
|
|
10022
|
-
return markedInstance.walkTokens(tokens, callback);
|
|
10023
|
-
};
|
|
10024
|
-
marked.parseInline = markedInstance.parseInline;
|
|
10025
|
-
marked.Parser = _Parser;
|
|
10026
|
-
marked.parser = _Parser.parse;
|
|
10027
|
-
marked.Renderer = _Renderer;
|
|
10028
|
-
marked.TextRenderer = _TextRenderer;
|
|
10029
|
-
marked.Lexer = _Lexer;
|
|
10030
|
-
marked.lexer = _Lexer.lex;
|
|
10031
|
-
marked.Tokenizer = _Tokenizer;
|
|
10032
|
-
marked.Hooks = _Hooks;
|
|
10033
|
-
marked.parse = marked;
|
|
10034
10347
|
|
|
10035
10348
|
/**
|
|
10349
|
+
* @deprecated Use `searchcraft-results-summary` instead.
|
|
10350
|
+
* This component is deprecated and will be removed in a future version.
|
|
10351
|
+
* Please update to use `searchcraft-results-summary` which has the same functionality.
|
|
10352
|
+
*
|
|
10036
10353
|
* This component renders a summary box for RAG search result summaries.
|
|
10037
10354
|
* When the user makes a search, a network call is made to retrieve the summary content, which is then
|
|
10038
10355
|
* rendered in this box.
|
|
@@ -10073,9 +10390,9 @@ class SearchcraftSummaryBox {
|
|
|
10073
10390
|
*/
|
|
10074
10391
|
searchcraftId;
|
|
10075
10392
|
summary = '';
|
|
10393
|
+
summaryErrorMessage = '';
|
|
10076
10394
|
isLoading = false;
|
|
10077
10395
|
isSummaryNotEnabled = false;
|
|
10078
|
-
get hostElement() { return getElement(this); }
|
|
10079
10396
|
unsubscribe;
|
|
10080
10397
|
cleanupCore;
|
|
10081
10398
|
onCoreAvailable(core) {
|
|
@@ -10095,9 +10412,8 @@ class SearchcraftSummaryBox {
|
|
|
10095
10412
|
handleStateChange(state) {
|
|
10096
10413
|
this.isLoading = state.isSummaryLoading;
|
|
10097
10414
|
this.isSummaryNotEnabled = state.isSummaryNotEnabled;
|
|
10415
|
+
this.summaryErrorMessage = state.summaryErrorMessage;
|
|
10098
10416
|
this.summary = this.sanitizeMarkdown(state.summary);
|
|
10099
|
-
// Update DOM directly for performance (avoids re-render)
|
|
10100
|
-
this.updateContentElement(state.summary);
|
|
10101
10417
|
}
|
|
10102
10418
|
/**
|
|
10103
10419
|
* Sanitizes and converts markdown to HTML.
|
|
@@ -10105,15 +10421,6 @@ class SearchcraftSummaryBox {
|
|
|
10105
10421
|
sanitizeMarkdown(markdown) {
|
|
10106
10422
|
return purify.sanitize(marked.parse(markdown));
|
|
10107
10423
|
}
|
|
10108
|
-
/**
|
|
10109
|
-
* Updates the content element directly without triggering a re-render.
|
|
10110
|
-
*/
|
|
10111
|
-
updateContentElement(markdown) {
|
|
10112
|
-
const contentElement = this.hostElement?.querySelector('.searchcraft-summary-box-content');
|
|
10113
|
-
if (contentElement) {
|
|
10114
|
-
contentElement.innerHTML = this.sanitizeMarkdown(markdown);
|
|
10115
|
-
}
|
|
10116
|
-
}
|
|
10117
10424
|
/**
|
|
10118
10425
|
* Renders the appropriate content based on current state.
|
|
10119
10426
|
*/
|
|
@@ -10122,12 +10429,12 @@ class SearchcraftSummaryBox {
|
|
|
10122
10429
|
return hAsync("searchcraft-loading", { label: 'LOADING' });
|
|
10123
10430
|
}
|
|
10124
10431
|
if (this.isSummaryNotEnabled) {
|
|
10125
|
-
return (hAsync("div", { class: 'searchcraft-summary-box-content' },
|
|
10432
|
+
return (hAsync("div", { class: 'searchcraft-summary-box-content' }, this.summaryErrorMessage || 'AI summaries are not enabled'));
|
|
10126
10433
|
}
|
|
10127
|
-
return hAsync("div", { class: 'searchcraft-summary-box-content'
|
|
10434
|
+
return (hAsync("div", { class: 'searchcraft-summary-box-content', innerHTML: this.summary }));
|
|
10128
10435
|
}
|
|
10129
10436
|
render() {
|
|
10130
|
-
return hAsync("div", { key: '
|
|
10437
|
+
return hAsync("div", { key: 'a33091962cfbbcf0399e9e15e8346590511090e1', class: 'searchcraft-summary-box' }, this.renderContent());
|
|
10131
10438
|
}
|
|
10132
10439
|
static get cmpMeta() { return {
|
|
10133
10440
|
"$flags$": 768,
|
|
@@ -10135,6 +10442,7 @@ class SearchcraftSummaryBox {
|
|
|
10135
10442
|
"$members$": {
|
|
10136
10443
|
"searchcraftId": [1, "searchcraft-id"],
|
|
10137
10444
|
"summary": [32],
|
|
10445
|
+
"summaryErrorMessage": [32],
|
|
10138
10446
|
"isLoading": [32],
|
|
10139
10447
|
"isSummaryNotEnabled": [32]
|
|
10140
10448
|
},
|
|
@@ -10144,7 +10452,7 @@ class SearchcraftSummaryBox {
|
|
|
10144
10452
|
}; }
|
|
10145
10453
|
}
|
|
10146
10454
|
|
|
10147
|
-
var styles = `[class*=searchcraft-],[class*=searchcraft-] *,[class*=searchcraft-]::before,[class*=searchcraft-]::after,[class*=searchcraft-] *,::before,[class*=searchcraft-] *,::after{box-sizing:border-box;padding:0;margin:0}:root{--sc-text-base-size: 1em;--sc-text-scale-ratio: 1.1;--sc-font-family: sans-serif;--sc-font-bold: 700;--sc-font-normal: 400;--sc-heading-1-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-2-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-3-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-4-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-5-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-6-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) );--sc-body-font-size: calc(var(--sc-text-base-size));--sc-body-small-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) )}:root{--sc-border-radius: 8px;--sc-border-radius-sm: calc(var(--sc-border-radius) / 2);--sc-border-radius-lg: calc(var(--sc-border-radius) * 2);--sc-border-radius-xl: calc(var(--sc-border-radius) * 3);--sc-border-radius-2xl: calc(var(--sc-border-radius) * 4);--sc-border-radius-full: 9999px}:root{--sc-breakpoint-sm: 576px;--sc-breakpoint-md: 768px;--sc-breakpoint-lg: 992px}:root{--sc-surface-neutral-primary: var(--sc-color-background, #ffffff);--sc-color-background-hover-computed: hsl( from var(--sc-color-background) h s clamp(10, calc(l + 5), 95) );--sc-surface-neutral-primary-hover: var( --sc-color-background-hover, var(--sc-color-background-hover-computed, #fafafa) );--sc-color-background-active-computed: hsl( from var(--sc-color-background) h s clamp(5, calc(l - 5), 90) );--sc-surface-neutral-primary-active: var( --sc-color-background-active, var(--sc-color-background-active-computed, #f7f7f7) );--sc-surface-neutral-secondary: var( --sc-color-background-secondary, var(--sc-color-background, #f3f3f3) );--sc-color-background-secondary-hover-computed: hsl( from var(--sc-color-background-secondary) h s clamp(10, calc(l + 5), 95) );--sc-surface-neutral-secondary-hover: var( --sc-color-background-hover, var(--sc-color-background-hover-computed, #e6e6e6) );--sc-color-background-secondary-active-computed: hsl( from var(--sc-color-background-secondary) h s clamp(5, calc(l - 5), 90) );--sc-surface-neutral-secondary-active: var( --sc-color-background-secondary-active, var(--sc-color-background-active-computed, #e0e0e0) );--sc-surface-neutral-light: #ffffff;--sc-content-neutral-primary: var(--sc-color-foreground, #292929);--sc-color-foreground-secondary-computed: hsl( from var(--sc-color-foreground) h s clamp(10, calc(l + 5), 90) );--sc-content-neutral-secondary: var( --sc-color-foreground-secondary, var(--sc-color-foreground-secondary-computed, #404040) );--sc-border-neutral: var(--sc-color-border, rgba(0, 0, 0, 0.1));--sc-surface-brand-primary: var(--sc-color-brand, #000000);--sc-color-brand-hover-computed: hsl( from var(--sc-color-brand) h s clamp(20, calc(l + 5), 95) );--sc-surface-brand-primary-hover: var( --sc-color-brand-hover, var(--sc-color-brand-hover-computed, #2e2e2e) );--sc-color-brand-active-computed: hsl( from var(--sc-color-brand) h s clamp(10, calc(l - 5), 85) );--sc-surface-brand-primary-active: var( --sc-color-brand-active, var(--sc-color-brand-active-computed, #292929) );--sc-surface-brand-secondary: var( --sc-color-brand-secondary, var(--sc-color-brand, #e6e6e6) );--sc-color-brand-secondary-hover-computed: hsl( from var(--sc-color-brand-secondary) h s clamp(10, calc(l + 5), 95) );--sc-surface-brand-secondary-hover: var( --sc-color-background-hover, var(--sc-color-background-hover-computed, #ebebeb) );--sc-color-brand-secondary-active-computed: hsl( from var(--sc-color-brand-secondary) h s clamp(5, calc(l - 5), 90) );--sc-surface-brand-secondary-active: var( --sc-color-brand-secondary-active, var(--sc-color-brand-active-computed, #e0e0e0) );--sc-content-brand: var( --sc-color-brand-text, var(--sc-surface-brand-primary) );--sc-content-brand-on-primary: #ffffff;--sc-border-brand: var(--sc-surface-brand-primary);--sc-surface-success-primary: var(--sc-color-success, #008000);--sc-color-success-primary-hover-computed: hsl( from var(--sc-color-success) h s 30 );--sc-surface-success-primary-hover: var( --sc-color-success-primary-hover, var(--sc-color-success-primary-hover-computed, #009900) );--sc-color-success-primary-active-computed: hsl( from var(--sc-color-success) h s 20 );--sc-surface-success-primary-active: var( --sc-color-success-primary-active, var(--sc-color-success-primary-active-computed, #006600) );--sc-color-success-secondary-computed: hsl( from var(--sc-color-success) h s 90 );--sc-surface-success-secondary: var( --sc-color-success-secondary, var(--sc-color-success-secondary-computed, #ccffcc) );--sc-color-success-secondary-hover-computed: hsl( from var(--sc-color-success-secondary) h s 95 );--sc-surface-success-secondary-hover: var( --sc-color-success-secondary-hover, var(--sc-color-success-secondary-hover-computed, #e6ffe6) );--sc-color-success-secondary-active-computed: hsl( from var(--sc-color-success-secondary) h s 85 );--sc-surface-success-secondary-active: var( --sc-color-success-secondary-active, var(--sc-color-success-secondary-active-computed, #b2ffb2) );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30) );--sc-content-success-on-primary: #ffffff;--sc-border-success: var(--sc-surface-success-primary);--sc-surface-caution-primary: var(--sc-color-caution, #cc6600);--sc-color-caution-primary-hover-computed: hsl( from var(--sc-color-caution) h s 30 );--sc-surface-caution-primary-hover: var( --sc-color-caution-primary-hover, var(--sc-color-caution-primary-hover-computed, #e57300) );--sc-color-caution-primary-active-computed: hsl( from var(--sc-color-caution) h s 20 );--sc-surface-caution-primary-active: var( --sc-color-caution-primary-active, var(--sc-color-caution-primary-active-computed, #b25a00) );--sc-color-caution-secondary-computed: hsl( from var(--sc-color-caution) h s 90 );--sc-surface-caution-secondary: var( --sc-color-caution-secondary, var(--sc-color-caution-secondary-computed, #ffd9b3) );--sc-color-caution-secondary-hover-computed: hsl( from var(--sc-color-caution-secondary) h s 95 );--sc-surface-caution-secondary-hover: var( --sc-color-caution-secondary-hover, var(--sc-color-caution-secondary-hover-computed, #ffe5cc) );--sc-color-caution-secondary-active-computed: hsl( from var(--sc-color-caution-secondary) h s 85 );--sc-surface-caution-secondary-active: var( --sc-color-caution-secondary-active, var(--sc-color-caution-secondary-active-computed, #ffcc99) );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30) );--sc-content-caution-on-primary: #ffffff;--sc-border-caution: var(--sc-surface-caution-primary);--sc-surface-danger-primary: var(--sc-color-danger, #cc0000);--sc-color-danger-primary-hover-computed: hsl( from var(--sc-color-danger) h s 30 );--sc-surface-danger-primary-hover: var( --sc-color-danger-primary-hover, var(--sc-color-danger-primary-hover-computed, #e50000) );--sc-color-danger-primary-active-computed: hsl( from var(--sc-color-danger) h s 20 );--sc-surface-danger-primary-active: var( --sc-color-danger-primary-active, var(--sc-color-danger-primary-active-computed, #b30000) );--sc-color-danger-secondary-computed: hsl(from var(--sc-color-danger) h s 90);--sc-surface-danger-secondary: var( --sc-color-danger-secondary, var(--sc-color-danger-secondary-computed, #ffcccc) );--sc-color-danger-secondary-hover-computed: hsl( from var(--sc-color-danger-secondary) h s 95 );--sc-surface-danger-secondary-hover: var( --sc-color-danger-secondary-hover, var(--sc-color-danger-secondary-hover-computed, #ffe7e7) );--sc-color-danger-secondary-active-computed: hsl( from var(--sc-color-danger-secondary) h s 85 );--sc-surface-danger-secondary-active: var( --sc-color-danger-secondary-active, var(--sc-color-danger-secondary-active-computed, #ffb3b3) );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30) );--sc-content-danger-on-primary: #ffffff;--sc-border-danger: var(--sc-surface-danger-primary);--sc-color-disabled: hsl(from var(--sc-color-page-primary) h s calc(l * 0.5));--sc-surface-disabled: var(--sc-color-disabled, #d9d9d9);--sc-color-disabled-text: hsl( from var(--sc-color-text-primary) h s calc(l * 0.5) );--sc-content-disabled: var(--sc-color-disabled-text, #737373);--sc-content-disabled-on-disabled: var(--sc-color-disabled-text, #737373)}@supports(hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none){:root{--sc-color-background-hover-computed: hsl( from var(--sc-color-background) h s clamp(10%, calc(l + 5%), 95%) );--sc-color-background-active-computed: hsl( from var(--sc-color-background) h s clamp(5%, calc(l - 5%), 90%) );--sc-color-foreground-secondary-computed: hsl( from var(--sc-color-foreground) h s clamp(10%, calc(l + 5%), 90%) );--sc-color-brand-hover-computed: hsl( from var(--sc-color-brand) h s clamp(20%, calc(l + 5%), 95%) );--sc-color-brand-active-computed: hsl( from var(--sc-color-brand) h s clamp(10%, calc(l - 5%), 85%) );--sc-color-success-primary-hover-computed: hsl( from var(--sc-color-success) h s 30% );--sc-color-success-primary-active-computed: hsl( from var(--sc-color-success) h s 20% );--sc-color-success-secondary-computed: hsl( from var(--sc-color-success) h s 90% );--sc-color-success-secondary-hover-computed: hsl( from var(--sc-color-success-secondary) h s 95% );--sc-color-success-secondary-active-computed: hsl( from var(--sc-color-success-secondary) h s 85% );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30%) );--sc-color-caution-primary-hover-computed: hsl( from var(--sc-color-caution) h s 30% );--sc-color-caution-primary-active-computed: hsl( from var(--sc-color-caution) h s 20% );--sc-color-caution-secondary-computed: hsl( from var(--sc-color-caution) h s 90% );--sc-color-caution-secondary-hover-computed: hsl( from var(--sc-color-caution-secondary) h s 95% );--sc-color-caution-secondary-active-computed: hsl( from var(--sc-color-caution-secondary) h s 85% );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30%) );--sc-color-danger-primary-hover-computed: hsl( from var(--sc-color-danger) h s 30% );--sc-color-danger-primary-active-computed: hsl( from var(--sc-color-danger) h s 20% );--sc-color-danger-secondary-computed: hsl( from var(--sc-color-danger) h s 90% );--sc-color-danger-secondary-hover-computed: hsl( from var(--sc-color-danger-secondary) h s 95% );--sc-color-danger-secondary-active-computed: hsl( from var(--sc-color-danger-secondary) h s 85% );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30%) )}}.searchcraft-ad{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased}.searchcraft-ad-no-template{display:flex;flex-direction:column;font-size:.875rem}.searchcraft-ad-no-template>p{margin:0}.searchcraft-adm-ad{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-search-result{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased}.searchcraft-search-result-no-template{display:flex;flex-direction:column;font-size:.875rem}.searchcraft-search-result-no-template>p{margin:0}.searchcraft-search-results{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-search-results-empty-state{text-align:center}.searchcraft-search-results-error-message{text-align:center}.searchcraft-button{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);background:none;border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;display:flex;gap:4px;padding:12px;position:relative}.searchcraft-button.searchcraft-button-disabled{cursor:not-allowed}.searchcraft-button-primary{background-color:var(--sc-surface-brand-primary);color:var(--sc-content-brand-on-primary);font-weight:var(--sc-font-bold)}.searchcraft-button-primary:hover{background-color:var(--sc-surface-brand-primary-hover)}.searchcraft-button-primary:focus{border-color:var(--sc-border-primary)}.searchcraft-button-primary:active{background-color:var(--sc-surface-brand-primary-active)}.searchcraft-button-primary.searchcraft-button-disabled,.searchcraft-button-primary.searchcraft-button-disabled:hover,.searchcraft-button-primary.searchcraft-button-disabled:focus,.searchcraft-button-primary.searchcraft-button-disabled:active{background-color:var(--sc-surface-disabled);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-tertiary{background-color:var(--sc-surface-neutral-primary);color:var(--sc-content-brand);font-weight:var(--sc-font-normal)}.searchcraft-button-tertiary:hover{background-color:var(--sc-surface-brand-secondary-hover)}.searchcraft-button-tertiary:focus{background-color:var(--sc-surface-neutral-light);border-color:var(--sc-border-primary)}.searchcraft-button-tertiary:active{background-color:var(--sc-surface-brand-secondary-active)}.searchcraft-button-tertiary.searchcraft-button-disabled,.searchcraft-button-tertiary.searchcraft-button-disabled:hover,.searchcraft-button-tertiary.searchcraft-button-disabled:focus,.searchcraft-button-tertiary.searchcraft-button-disabled:active{background-color:var(--sc-surface-neutral-light);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-icon{fill:none}.searchcraft-error-message{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-danger);margin:0}.searchcraft-facet-list{display:flex;flex-direction:column;gap:8px;width:100%}.searchcraft-facet-list-checkbox-label{align-items:center;color:var(--sc-content-neutral-primary);display:flex;font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);gap:8px;position:relative;-webkit-font-smoothing:antialiased}.searchcraft-facet-list-checkbox-input-wrapper{position:relative}.searchcraft-facet-list-checkbox-input{align-items:center;appearance:none;background-color:var(--sc-surface-neutral-secondary);border:1px solid var(--sc-surface-disabled);border-radius:var(--sc-border-radius);cursor:pointer;display:flex;height:24px;justify-content:center;width:24px;margin:0}.searchcraft-facet-list-checkbox-input:focus{outline:2px solid var(--sc-surface-brand-primary);outline-offset:2px}.searchcraft-facet-list-checkbox-input:checked{background-color:var(--sc-surface-brand-primary);position:relative}.searchcraft-facet-list-checkbox-input:checked+.searchcraft-facet-list-checkbox-input-check-icon{display:flex}.searchcraft-facet-list-checkbox-input:checked+.searchcraft-facet-list-checkbox-input-dash-icon{display:flex}.searchcraft-facet-child-list{display:flex;flex-direction:column;gap:6px}.searchcraft-facet-child-list-checkbox-label{margin-left:24px}.searchcraft-facet-child-list-checkbox-label:first-child{margin-top:6px}.searchcraft-facet-list-checkbox-input-check-icon{display:none;height:16px;left:50%;position:absolute;margin-top:2px;top:50%;transform:translate(-50%, -50%);width:16px}.searchcraft-facet-list-checkbox-input-dash-icon{display:none;height:3px;left:50%;position:absolute;top:50%;transform:translate(-50%, -50%);width:14px}.searchcraft-facet-list-message{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-disabled);text-align:center}.searchcraft-facet-list-wrapper{display:flex;flex-direction:column;width:100%;min-height:0}.searchcraft-facet-list-content{display:flex;flex-direction:column;gap:8px;min-height:0;flex-shrink:0}.searchcraft-facet-list-view-more{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);background:none;border:none;color:var(--sc-content-brand);cursor:pointer;padding:8px 0;text-align:left;text-decoration:underline}.searchcraft-facet-list-view-more:hover{color:var(--sc-surface-brand-primary-hover)}.searchcraft-facet-list-view-more:focus{outline:2px solid var(--sc-surface-brand-primary);outline-offset:2px}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);font-weight:var(--sc-font-bold)}[data-toggle-facet-section]{cursor:pointer;display:flex;align-items:center;justify-content:space-between;width:100%;position:relative}[data-toggle-facet-section]::after{content:"›";display:inline-block;font-size:1.5em;line-height:1;margin-left:auto;flex-shrink:0;transition:transform .2s ease;transform-origin:center}[data-toggle-facet-section][data-facet-section-collapsed]::after{transform:rotate(90deg)}[data-toggle-facet-section][data-facet-section-expanded]::after{transform:rotate(-90deg)}@media(max-width: 767px){[data-toggle-filter-panel]{cursor:pointer;display:flex !important;align-items:center;justify-content:space-between;width:100%}[data-toggle-filter-panel]::after{content:"›";display:inline-block;font-size:1.5em;line-height:1;margin-left:auto;flex-shrink:0;transition:transform .2s ease;transform-origin:center}[data-toggle-filter-panel][data-filter-panel-collapsed]::after{transform:rotate(90deg)}[data-toggle-filter-panel][data-filter-panel-expanded]::after{transform:rotate(-90deg)}}@media(min-width: 768px){[data-toggle-filter-panel]{cursor:default}[data-toggle-filter-panel]::after{display:none}}:root{--sc-input-form-border-radius: var(--sc-border-radius);--sc-input-form-search-icon-size: 20px;--sc-input-form-clear-icon-size: 20px}.searchcraft-input-form-grid{display:grid;gap:4px 8px}.searchcraft-input-form-grid-button-left{grid-template-rows:repeat(3, auto);grid-template-columns:auto 1fr}.searchcraft-input-form-grid-button-left .searchcraft-input-form-button{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-label{grid-column:2/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-error-message{grid-column:2/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-input-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-right{grid-template-rows:repeat(3, auto);grid-template-columns:1fr auto}.searchcraft-input-form-grid-button-right .searchcraft-input-form-button{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-label{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-error-message{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-none{grid-template-rows:repeat(3, auto);grid-template-columns:auto}.searchcraft-input-form-grid-button-none .searchcraft-input-form-button{display:none}.searchcraft-input-form-grid-button-none .searchcraft-input-form-label{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-none .searchcraft-input-form-error-message{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-none .searchcraft-input-form-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-input-wrapper{display:flex;position:relative}.searchcraft-input-form-input{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);background-color:var(--sc-surface-neutral-secondary);border-radius:var(--sc-input-form-border-radius);border:none;color:var(--sc-content-neutral-primary);flex:1;outline:none;padding:12px 44px}.searchcraft-input-form-input::placeholder{color:var(--sc-content-disabled)}.searchcraft-input-form-input:focus{outline:var(--sc-border-brand) solid 2px;outline-offset:-1px}.searchcraft-input-form-input.searchcraft-placeholder-hide-on-focus:focus::placeholder{opacity:0}.searchcraft-input-form-error{color:var(--sc-content-danger);outline:var(--sc-border-danger) solid 2px}.searchcraft-input-form-error:focus{outline:var(--sc-border-danger) solid 2px}.searchcraft-input-form-input-icon{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:absolute;pointer-events:none;top:0;width:44px}.searchcraft-input-form-input-search-icon{color:var(--sc-content-neutral-secondary);fill:none;height:var(--sc-input-form-search-icon-size);pointer-events:none;width:var(--sc-input-form-search-icon-size)}.searchcraft-input-form-clear-button{all:unset;align-items:center;bottom:0;border:none;cursor:pointer;display:flex;justify-content:center;outline:none;position:absolute;right:0;top:0;width:44px}.searchcraft-input-form-clear-icon{color:var(--sc-content-brand);fill:none;height:var(--sc-input-form-clear-icon-size);width:var(--sc-input-form-clear-icon-size)}.searchcraft-input-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-neutral-primary);font-weight:var(--sc-font-bold);margin-top:4px;margin-bottom:4px}:root{--sc-popover-button-border-radius: var(--sc-border-radius)}@media(min-width: 576px){:root{--sc-popover-button-border-radius: var(--sc-border-radius-lg)}}.searchcraft-popover-button{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);cursor:pointer}.searchcraft-popover-button-skeuomorphic{appearance:none;background:none;border:none;color:var(--sc-content-neutral-primary);display:block;width:100%}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-wrapper{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-popover-button-border-radius);box-shadow:0 1px 1px rgb(from var(--sc-content-neutral-secondary) r g b/10%) inset,0 2px 4px rgb(from var(--sc-content-neutral-secondary) r g b/5%) inset;display:flex;gap:24px;height:40px;justify-content:space-between;line-height:1;padding:4px 5px 4px 10px;background:var(--sc-surface-neutral-primary)}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-wrapper{box-shadow:0 1px 1px rgb(from var(--sc-content-neutral-secondary) r g b/10%) inset,0 2px 2px rgb(from var(--sc-content-neutral-secondary) r g b/5%) inset,0 4px 4px rgb(from var(--sc-content-neutral-secondary) r g b/5%) inset;height:63px;padding:8px 10px 8px 16px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input{align-items:center;display:flex;gap:4px}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input{gap:8px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps{color:var(--sc-content-neutral-secondary);display:flex;gap:4px;font-size:20px;font-weight:500}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps{gap:8px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap{border-radius:calc(var(--sc-popover-button-border-radius) - 3px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 3px);background-color:var(--sc-surface-neutral-primary);box-shadow:0 3px hsl(from var(--sc-surface-neutral-secondary) h s calc(l - 5)),0 1px 2px rgb(from var(--sc-content-neutral-secondary) r g b/10%),0 6px 4px rgb(from var(--sc-content-neutral-secondary) r g b/5%);height:calc(100% - 2px);position:relative}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap{border-radius:calc(var(--sc-popover-button-border-radius) - 8px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 8px);box-shadow:0 4px hsl(from var(--sc-surface-neutral-secondary) h s calc(l - 5)),0 1px 2px rgb(from var(--sc-content-neutral-secondary) r g b/15%),0 6px 1px rgb(from var(--sc-content-neutral-secondary) r g b/20%),0 7px 2px rgb(from var(--sc-content-neutral-secondary) r g b/15%),0 9px 4px rgb(from var(--sc-content-neutral-secondary) r g b/10%),0 13px 8px rgb(from var(--sc-content-neutral-secondary) r g b/5%);height:calc(100% - 5px)}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::before,.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::after{content:"";display:block}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::before{border-radius:calc(var(--sc-popover-button-border-radius) - 4px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 4px);background:linear-gradient(340deg, rgb(from var(--sc-surface-neutral-secondary) r g b/2%) 0%, var(--sc-surface-neutral-secondary) 100%);inset:2px;position:absolute}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::before{border-radius:calc(var(--sc-popover-button-border-radius) - 12px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 12px);inset:4px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::after{aspect-ratio:1/1;height:100%}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap>span{display:flex;line-height:1;left:50%;margin-top:2%;position:absolute;top:50%;transform:translate(-50%, -50%)}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input-search-icon{height:60%;width:auto}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input-search-icon{height:50%}}:root{--sc-popover-list-view-height: 600px;--sc-popover-modal-max-width: 800px}.searchcraft-popover-form{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);display:flex;flex:1;flex-direction:column}.searchcraft-popover-form searchcraft-input-form,.searchcraft-popover-form searchcraft-popover-footer{width:100%}.searchcraft-popover-form.searchcraft-popover-form-active .searchcraft-popover-form-input{padding-bottom:1px}.searchcraft-popover-form searchcraft-popover-list-view{flex-shrink:1;height:100%;min-height:0;overflow:auto;padding:0 24px}.searchcraft-popover-form-input{display:flex;flex-direction:row;gap:12px}.searchcraft-popover-form-input .searchcraft-input-form-input{background-color:var(--sc-surface-neutral-primary);border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius-lg);box-shadow:0 1px 1px rgb(from var(--sc-content-neutral-primary) r g b/10%) inset,0 2px 2px rgb(from var(--sc-content-neutral-primary) r g b/5%) inset,0 4px 4px rgb(from var(--sc-content-neutral-primary) r g b/5%) inset;width:0}.searchcraft-popover-form-cancel-button{background:none;border:none;cursor:pointer;font-size:14px}.searchcraft-popover-form-modal-input,.searchcraft-popover-form-fullscreen-input{padding:24px}.searchcraft-popover-form-modal-popover-list-view,.searchcraft-popover-form-fullscreen-popover-list-view{flex-grow:1;flex-shrink:1;min-height:0;overflow:auto;padding:0 24px}.searchcraft-popover-form-inline{background-color:var(--sc-surface-neutral-primary);border:1px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius-xl);padding:12px;position:relative}.searchcraft-popover-form-inline.searchcraft-popover-form-active{border:1px solid var(--sc-border-neutral);border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;padding-bottom:1px}.searchcraft-popover-form-inline searchcraft-popover-list-view{padding:0 12px}.searchcraft-popover-form-inline .searchcraft-input-form-input,.searchcraft-popover-form-inline .searchcraft-popover-list-item-link,.searchcraft-popover-form-inline .searchcraft-adm-ad-link{border-radius:calc(--sc-border-radius-xl - 12px);border-radius:calc(var(--sc-border-radius-xl) - 12px)}.searchcraft-popover-form-inline-wrapper{background-color:var(--sc-surface-neutral-primary);border:1px solid var(--sc-border-neutral);border-top:none;border-bottom-left-radius:var(--sc-border-radius-xl);border-bottom-right-radius:var(--sc-border-radius-xl);display:flex;flex-direction:column;left:-1px;max-height:var(--sc-popover-list-view-height);overflow:hidden;position:absolute;right:-1px;top:100%}.searchcraft-popover-form-modal{align-items:center;display:flex;inset:0;position:fixed;z-index:1000}.searchcraft-popover-form-modal .searchcraft-input-form-input,.searchcraft-popover-form-modal .searchcraft-popover-list-item-link,.searchcraft-popover-form-modal .searchcraft-adm-ad-link{border-radius:calc(--sc-border-radius-2xl - 20px);border-radius:calc(var(--sc-border-radius-2xl) - 20px)}.searchcraft-popover-form-modal-backdrop{background-color:rgb(from var(--sc-content-neutral-primary) r g b/50%);display:none;inset:0;position:fixed}@media(min-width: 576px){.searchcraft-popover-form-modal-backdrop{display:block}}.searchcraft-popover-form-modal-wrapper{background-color:var(--sc-surface-neutral-primary);box-shadow:1px 2px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 2px 4px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 4px 8px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 8px 16px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 16px 32px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 32px 64px rgb(from var(--sc-content-neutral-primary) r g b/7%);display:flex;flex-direction:column;inset:0;max-width:var(--sc-popover-modal-max-width);overflow:hidden;position:absolute;width:100%;z-index:1001}@media(min-width: 576px){.searchcraft-popover-form-modal-wrapper{border-radius:var(--sc-border-radius-2xl);inset:0;margin-top:100px;max-height:var(--sc-popover-list-view-height);max-width:var(--sc-popover-modal-max-width);position:relative}}.searchcraft-popover-form-modal-cancel-button{border-radius:calc(--sc-border-radius-2xl - 20px);border-radius:calc(var(--sc-border-radius-2xl) - 20px);padding:8px}@media(min-width: 576px){.searchcraft-popover-form-modal-cancel-button{padding:8px 12px}}.searchcraft-popover-form-fullscreen{background-color:var(--sc-surface-neutral-primary);display:flex;flex-direction:column;justify-content:space-between;inset:0;position:fixed;z-index:1000}.searchcraft-popover-form-fullscreen .searchcraft-popover-list-item-link,.searchcraft-popover-form-fullscreen .searchcraft-adm-ad-link{border-radius:var(--sc-border-radius-lg)}.searchcraft-popover-form-fullscreen-cancel-button{border-radius:var(--sc-border-radius-lg);padding:8px}@media(min-width: 576px){.searchcraft-popover-form-fullscreen-cancel-button{padding:8px 12px}}.searchcraft-popover-footer{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;background-color:var(--sc-surface-neutral-secondary);box-shadow:0 1px 1px rgb(from var(--sc-content-neutral-primary) r g b/10%) inset,0 2px 2px rgb(from var(--sc-content-neutral-primary) r g b/5%) inset,0 4px 4px rgb(from var(--sc-content-neutral-primary) r g b/5%) inset;display:flex;gap:8px;justify-content:space-between;line-height:1;padding:20px 24px}@media(min-width: 576px){.searchcraft-popover-footer{padding:20px 32px}}.searchcraft-popover-footer-results-info{margin:0}.searchcraft-popover-footer-link{color:var(--sc-content-neutral-primary);display:flex;max-width:160px;width:100%}:root{--sc-popover-list-item-image-fit: contain}.searchcraft-popover-list-item{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;border-bottom:1px solid var(--sc-border-neutral);padding:12px 0}searchcraft-popover-list-item:last-child .searchcraft-popover-list-item{border-bottom:none}.searchcraft-popover-list-item-link{align-items:flex-start;color:var(--sc-content-neutral-primary);display:flex;gap:24px;padding:12px;text-decoration:none}.searchcraft-popover-list-item-link:focus,.searchcraft-popover-list-item-link:active{background-color:var(--sc-surface-neutral-primary-active)}.searchcraft-popover-list-item-link:hover{background-color:var(--sc-surface-neutral-primary-hover)}.searchcraft-popover-list-item-image-wrapper{align-items:center;aspect-ratio:16/9;display:flex;flex-shrink:0;justify-content:center;width:160px}.searchcraft-popover-list-item-image{height:100%;object-fit:var(--sc-popover-list-item-image-fit);width:100%}.searchcraft-popover-list-item-content{display:flex;flex-direction:column;flex-grow:1;gap:4px;justify-content:center}.searchcraft-popover-list-item-content-title,.searchcraft-popover-list-item-content-subtitle{display:-webkit-box;line-clamp:2;margin:0;overflow:hidden;-webkit-line-clamp:2;-webkit-box-orient:vertical}.searchcraft-popover-list-item-content-title{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-heading-5-font-size);font-weight:var(--sc-font-bold)}.searchcraft-popover-list-item-content-subtitle{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-popover-list-view{display:flex;flex-direction:column}.searchcraft-results-info{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-primary);margin:0}.searchcraft-slider{align-items:center;display:flex;flex-direction:column;gap:10px;width:100%;margin-top:4px}.searchcraft-slider-range{align-items:center;background-color:var(--sc-surface-disabled);border-radius:999px;display:flex;position:relative;height:4px;width:100%}.searchcraft-slider-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-active-range{background-color:var(--sc-surface-brand-primary);border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.searchcraft-slider-range .searchcraft-slider-active-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-active-range::-moz-range-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-input{appearance:none;background:rgba(0,0,0,0);border-radius:2px;height:4px;margin:0;outline:none;pointer-events:none;position:absolute;width:100%;-webkit-appearance:none}.searchcraft-slider-range .searchcraft-slider-input::-webkit-slider-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:1px solid var(--sc-border-neutral);cursor:pointer;height:18px;pointer-events:all;width:18px;-webkit-appearance:none}.searchcraft-slider-range .searchcraft-slider-input::-moz-range-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:1px solid var(--sc-border-neutral);cursor:pointer;height:18px;pointer-events:all;width:18px}.searchcraft-slider-range .searchcraft-slider-input:focus::-webkit-slider-thumb{outline:2px solid var(--sc-surface-brand-primary)}.searchcraft-slider-range .searchcraft-slider-input:focus::-moz-range-thumb{outline:2px solid var(--sc-surface-brand-primary)}.searchcraft-slider-label{color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);justify-content:space-between;margin-top:4px;width:100%}.searchcraft-slider-start-label,.searchcraft-slider-end-label{min-width:30px;text-align:center}.searchcraft-toggle-button{align-items:flex-start;display:flex;gap:10px;justify-content:space-between}.searchcraft-toggle-button-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-neutral-primary);margin:0}.searchcraft-toggle-button-sub-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-neutral-secondary);margin:0}.searchcraft-toggle-button-background{background:var(--sc-surface-disabled);border-radius:var(--sc-border-radius-full);border:none;cursor:pointer;flex-shrink:0;height:26px;position:relative;transition:background-color .2s;width:44px}.searchcraft-toggle-button-handle{background:var(--sc-surface-neutral-light);border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform .3s ease;width:18px}.searchcraft-toggle-button-active .searchcraft-toggle-button-background{background:var(--sc-surface-brand-primary);box-shadow:0px 0px 0px 1px rgba(0,0,0,.05)}.searchcraft-toggle-button-active .searchcraft-toggle-button-handle{transform:translateX(16px)}.searchcraft-pagination{display:inline-grid;gap:16px;grid-template-columns:repeat(3, auto);grid-template-rows:1fr}.searchcraft-pagination-list{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius);display:flex;list-style-type:none;margin:0;overflow:hidden;padding:0;width:auto}.searchcraft-pagination-list li{border-right:1px solid var(--sc-border-neutral);height:100%;min-height:44px;width:44px}.searchcraft-pagination-list li:last-child{border-right:none}.searchcraft-pagination-item{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);align-items:center;background-color:var(--sc-surface-neutral-primary);border:none;display:flex;height:100%;justify-content:center;width:100%}.searchcraft-pagination-item-active{background-color:var(--sc-surface-brand-secondary);font-weight:var(--sc-font-bold)}.searchcraft-pagination-control{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius)}.searchcraft-pagination-range{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);align-items:center;display:flex}.searchcraft-select{display:flex;flex-direction:column;gap:4px}.searchcraft-select-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);font-weight:var(--sc-font-bold)}.searchcraft-select-input-wrapper{position:relative}.searchcraft-select-input{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);appearance:none;background-color:var(--sc-surface-neutral-secondary);border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;height:44px;padding:0 44px 0 16px;width:100%}.searchcraft-select-input:hover{background-color:var(--sc-surface-neutral-secondary-hover)}.searchcraft-select-input:active{background-color:var(--sc-surface-neutral-secondary-active)}.searchcraft-select-input:focus{border-color:var(--sc-border-brand);outline:none}.searchcraft-select-input-icon{fill:none;pointer-events:none;position:absolute;right:12px;top:50%;transform:translateY(-50%)}.searchcraft-select-caption{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal)}.searchcraft-search-results-per-page{display:flex}.searchcraft-search-results-per-page-select{align-items:center;display:flex;gap:12px}.searchcraft-search-results-per-page-select-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-search-results-per-page-select-input{min-width:120px}.searchcraft-summary-box{padding:20px;border-radius:var(--sc-border-radius);background-color:var(--sc-surface-neutral-secondary);position:relative;min-height:200px;color:var(--sc-content-neutral-primary);font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-summary-box h1,.searchcraft-summary-box h2,.searchcraft-summary-box h3,.searchcraft-summary-box h4,.searchcraft-summary-box h5{padding-top:10px;padding-bottom:10px}.searchcraft-summary-box p{padding-bottom:10px}.searchcraft-summary-box img{max-width:200px}.searchcraft-summary-box ol,.searchcraft-summary-box ul{padding-left:1em;padding-bottom:10px}.searchcraft-summary-box a{color:var(--sc-content-brand)}.searchcraft-loading-label{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);margin-top:40px;letter-spacing:2px;color:#828282;font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal)}.searchcraft-loading-bars{margin:0 auto;width:60px;height:50px;text-align:center;position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);display:flex;gap:2px}.searchcraft-loading-bars>div{height:100%;width:8px;-webkit-animation:delay .8s infinite ease-in-out;animation:delay .8s infinite ease-in-out;opacity:.2}.searchcraft-loading-bars .searchcraft-loading-bar-1{background-color:var(--sc-surface-brand-primary);opacity:.1}.searchcraft-loading-bars .searchcraft-loading-bar-2{background-color:var(--sc-surface-brand-primary);animation-delay:-0.7s;opacity:.2}.searchcraft-loading-bars .searchcraft-loading-bar-3{background-color:var(--sc-surface-brand-primary);animation-delay:-0.6s;opacity:.3}.searchcraft-loading-bars .searchcraft-loading-bar-4{background-color:var(--sc-surface-brand-primary);animation-delay:-0.5s;opacity:.4}.searchcraft-loading-bars .searchcraft-loading-bar-5{background-color:var(--sc-surface-brand-primary);animation-delay:-0.4s;opacity:.5}.searchcraft-loading-bars .searchcraft-loading-bar-6{background-color:var(--sc-surface-brand-primary);animation-delay:-0.3s;opacity:.6}@keyframes delay{0%,40%,100%{transform:scaleY(0.05)}20%{transform:scaleY(1)}}/*# sourceMappingURL=hologram.css.map */
|
|
10455
|
+
var styles = `[class*=searchcraft-],[class*=searchcraft-] *,[class*=searchcraft-]::before,[class*=searchcraft-]::after,[class*=searchcraft-] *,::before,[class*=searchcraft-] *,::after{box-sizing:border-box;padding:0;margin:0}:root{--sc-text-base-size: 1em;--sc-text-scale-ratio: 1.1;--sc-font-family: sans-serif;--sc-font-bold: 700;--sc-font-normal: 400;--sc-heading-1-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-2-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-3-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-4-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-5-font-size: calc( var(--sc-text-base-size) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) );--sc-heading-6-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) );--sc-body-font-size: calc(var(--sc-text-base-size));--sc-body-small-font-size: calc( var(--sc-text-base-size) / ( var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) * var(--sc-text-scale-ratio) ) )}:root{--sc-border-radius: 8px;--sc-border-radius-sm: calc(var(--sc-border-radius) / 2);--sc-border-radius-lg: calc(var(--sc-border-radius) * 2);--sc-border-radius-xl: calc(var(--sc-border-radius) * 3);--sc-border-radius-2xl: calc(var(--sc-border-radius) * 4);--sc-border-radius-full: 9999px}:root{--sc-breakpoint-sm: 576px;--sc-breakpoint-md: 768px;--sc-breakpoint-lg: 992px}:root{--sc-surface-neutral-primary: var(--sc-color-background, #ffffff);--sc-color-background-hover-computed: hsl( from var(--sc-color-background) h s clamp(10, calc(l + 5), 95) );--sc-surface-neutral-primary-hover: var( --sc-color-background-hover, var(--sc-color-background-hover-computed, #fafafa) );--sc-color-background-active-computed: hsl( from var(--sc-color-background) h s clamp(5, calc(l - 5), 90) );--sc-surface-neutral-primary-active: var( --sc-color-background-active, var(--sc-color-background-active-computed, #f7f7f7) );--sc-surface-neutral-secondary: var( --sc-color-background-secondary, var(--sc-color-background, #f3f3f3) );--sc-color-background-secondary-hover-computed: hsl( from var(--sc-color-background-secondary) h s clamp(10, calc(l + 5), 95) );--sc-surface-neutral-secondary-hover: var( --sc-color-background-hover, var(--sc-color-background-hover-computed, #e6e6e6) );--sc-color-background-secondary-active-computed: hsl( from var(--sc-color-background-secondary) h s clamp(5, calc(l - 5), 90) );--sc-surface-neutral-secondary-active: var( --sc-color-background-secondary-active, var(--sc-color-background-active-computed, #e0e0e0) );--sc-surface-neutral-light: #ffffff;--sc-content-neutral-primary: var(--sc-color-foreground, #292929);--sc-color-foreground-secondary-computed: hsl( from var(--sc-color-foreground) h s clamp(10, calc(l + 5), 90) );--sc-content-neutral-secondary: var( --sc-color-foreground-secondary, var(--sc-color-foreground-secondary-computed, #404040) );--sc-border-neutral: var(--sc-color-border, rgba(0, 0, 0, 0.1));--sc-surface-brand-primary: var(--sc-color-brand, #000000);--sc-color-brand-hover-computed: hsl( from var(--sc-color-brand) h s clamp(20, calc(l + 5), 95) );--sc-surface-brand-primary-hover: var( --sc-color-brand-hover, var(--sc-color-brand-hover-computed, #2e2e2e) );--sc-color-brand-active-computed: hsl( from var(--sc-color-brand) h s clamp(10, calc(l - 5), 85) );--sc-surface-brand-primary-active: var( --sc-color-brand-active, var(--sc-color-brand-active-computed, #292929) );--sc-surface-brand-secondary: var( --sc-color-brand-secondary, var(--sc-color-brand, #e6e6e6) );--sc-color-brand-secondary-hover-computed: hsl( from var(--sc-color-brand-secondary) h s clamp(10, calc(l + 5), 95) );--sc-surface-brand-secondary-hover: var( --sc-color-background-hover, var(--sc-color-background-hover-computed, #ebebeb) );--sc-color-brand-secondary-active-computed: hsl( from var(--sc-color-brand-secondary) h s clamp(5, calc(l - 5), 90) );--sc-surface-brand-secondary-active: var( --sc-color-brand-secondary-active, var(--sc-color-brand-active-computed, #e0e0e0) );--sc-content-brand: var( --sc-color-brand-text, var(--sc-surface-brand-primary) );--sc-content-brand-on-primary: #ffffff;--sc-border-brand: var(--sc-surface-brand-primary);--sc-surface-success-primary: var(--sc-color-success, #008000);--sc-color-success-primary-hover-computed: hsl( from var(--sc-color-success) h s 30 );--sc-surface-success-primary-hover: var( --sc-color-success-primary-hover, var(--sc-color-success-primary-hover-computed, #009900) );--sc-color-success-primary-active-computed: hsl( from var(--sc-color-success) h s 20 );--sc-surface-success-primary-active: var( --sc-color-success-primary-active, var(--sc-color-success-primary-active-computed, #006600) );--sc-color-success-secondary-computed: hsl( from var(--sc-color-success) h s 90 );--sc-surface-success-secondary: var( --sc-color-success-secondary, var(--sc-color-success-secondary-computed, #ccffcc) );--sc-color-success-secondary-hover-computed: hsl( from var(--sc-color-success-secondary) h s 95 );--sc-surface-success-secondary-hover: var( --sc-color-success-secondary-hover, var(--sc-color-success-secondary-hover-computed, #e6ffe6) );--sc-color-success-secondary-active-computed: hsl( from var(--sc-color-success-secondary) h s 85 );--sc-surface-success-secondary-active: var( --sc-color-success-secondary-active, var(--sc-color-success-secondary-active-computed, #b2ffb2) );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30) );--sc-content-success-on-primary: #ffffff;--sc-border-success: var(--sc-surface-success-primary);--sc-surface-caution-primary: var(--sc-color-caution, #cc6600);--sc-color-caution-primary-hover-computed: hsl( from var(--sc-color-caution) h s 30 );--sc-surface-caution-primary-hover: var( --sc-color-caution-primary-hover, var(--sc-color-caution-primary-hover-computed, #e57300) );--sc-color-caution-primary-active-computed: hsl( from var(--sc-color-caution) h s 20 );--sc-surface-caution-primary-active: var( --sc-color-caution-primary-active, var(--sc-color-caution-primary-active-computed, #b25a00) );--sc-color-caution-secondary-computed: hsl( from var(--sc-color-caution) h s 90 );--sc-surface-caution-secondary: var( --sc-color-caution-secondary, var(--sc-color-caution-secondary-computed, #ffd9b3) );--sc-color-caution-secondary-hover-computed: hsl( from var(--sc-color-caution-secondary) h s 95 );--sc-surface-caution-secondary-hover: var( --sc-color-caution-secondary-hover, var(--sc-color-caution-secondary-hover-computed, #ffe5cc) );--sc-color-caution-secondary-active-computed: hsl( from var(--sc-color-caution-secondary) h s 85 );--sc-surface-caution-secondary-active: var( --sc-color-caution-secondary-active, var(--sc-color-caution-secondary-active-computed, #ffcc99) );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30) );--sc-content-caution-on-primary: #ffffff;--sc-border-caution: var(--sc-surface-caution-primary);--sc-surface-danger-primary: var(--sc-color-danger, #cc0000);--sc-color-danger-primary-hover-computed: hsl( from var(--sc-color-danger) h s 30 );--sc-surface-danger-primary-hover: var( --sc-color-danger-primary-hover, var(--sc-color-danger-primary-hover-computed, #e50000) );--sc-color-danger-primary-active-computed: hsl( from var(--sc-color-danger) h s 20 );--sc-surface-danger-primary-active: var( --sc-color-danger-primary-active, var(--sc-color-danger-primary-active-computed, #b30000) );--sc-color-danger-secondary-computed: hsl(from var(--sc-color-danger) h s 90);--sc-surface-danger-secondary: var( --sc-color-danger-secondary, var(--sc-color-danger-secondary-computed, #ffcccc) );--sc-color-danger-secondary-hover-computed: hsl( from var(--sc-color-danger-secondary) h s 95 );--sc-surface-danger-secondary-hover: var( --sc-color-danger-secondary-hover, var(--sc-color-danger-secondary-hover-computed, #ffe7e7) );--sc-color-danger-secondary-active-computed: hsl( from var(--sc-color-danger-secondary) h s 85 );--sc-surface-danger-secondary-active: var( --sc-color-danger-secondary-active, var(--sc-color-danger-secondary-active-computed, #ffb3b3) );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30) );--sc-content-danger-on-primary: #ffffff;--sc-border-danger: var(--sc-surface-danger-primary);--sc-color-disabled: hsl(from var(--sc-color-page-primary) h s calc(l * 0.5));--sc-surface-disabled: var(--sc-color-disabled, #d9d9d9);--sc-color-disabled-text: hsl( from var(--sc-color-text-primary) h s calc(l * 0.5) );--sc-content-disabled: var(--sc-color-disabled-text, #737373);--sc-content-disabled-on-disabled: var(--sc-color-disabled-text, #737373)}@supports(hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none){:root{--sc-color-background-hover-computed: hsl( from var(--sc-color-background) h s clamp(10%, calc(l + 5%), 95%) );--sc-color-background-active-computed: hsl( from var(--sc-color-background) h s clamp(5%, calc(l - 5%), 90%) );--sc-color-foreground-secondary-computed: hsl( from var(--sc-color-foreground) h s clamp(10%, calc(l + 5%), 90%) );--sc-color-brand-hover-computed: hsl( from var(--sc-color-brand) h s clamp(20%, calc(l + 5%), 95%) );--sc-color-brand-active-computed: hsl( from var(--sc-color-brand) h s clamp(10%, calc(l - 5%), 85%) );--sc-color-success-primary-hover-computed: hsl( from var(--sc-color-success) h s 30% );--sc-color-success-primary-active-computed: hsl( from var(--sc-color-success) h s 20% );--sc-color-success-secondary-computed: hsl( from var(--sc-color-success) h s 90% );--sc-color-success-secondary-hover-computed: hsl( from var(--sc-color-success-secondary) h s 95% );--sc-color-success-secondary-active-computed: hsl( from var(--sc-color-success-secondary) h s 85% );--sc-content-success: var( --sc-color-brand-text, hsl(from var(--sc-surface-success-primary) h s 30%) );--sc-color-caution-primary-hover-computed: hsl( from var(--sc-color-caution) h s 30% );--sc-color-caution-primary-active-computed: hsl( from var(--sc-color-caution) h s 20% );--sc-color-caution-secondary-computed: hsl( from var(--sc-color-caution) h s 90% );--sc-color-caution-secondary-hover-computed: hsl( from var(--sc-color-caution-secondary) h s 95% );--sc-color-caution-secondary-active-computed: hsl( from var(--sc-color-caution-secondary) h s 85% );--sc-content-caution: var( --sc-color-caution-text, hsl(from var(--sc-surface-caution-primary) h s 30%) );--sc-color-danger-primary-hover-computed: hsl( from var(--sc-color-danger) h s 30% );--sc-color-danger-primary-active-computed: hsl( from var(--sc-color-danger) h s 20% );--sc-color-danger-secondary-computed: hsl( from var(--sc-color-danger) h s 90% );--sc-color-danger-secondary-hover-computed: hsl( from var(--sc-color-danger-secondary) h s 95% );--sc-color-danger-secondary-active-computed: hsl( from var(--sc-color-danger-secondary) h s 85% );--sc-content-danger: var( --sc-color-caution-text, hsl(from var(--sc-surface-danger-primary) h s 30%) )}}.searchcraft-ad{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased}.searchcraft-ad-no-template{display:flex;flex-direction:column;font-size:.875rem}.searchcraft-ad-no-template>p{margin:0}.searchcraft-adm-ad{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-search-result{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased}.searchcraft-search-result-no-template{display:flex;flex-direction:column;font-size:.875rem}.searchcraft-search-result-no-template>p{margin:0}.searchcraft-search-results{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-search-results-empty-state{text-align:center}.searchcraft-search-results-error-message{text-align:center}.searchcraft-button{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);background:none;border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;display:flex;gap:4px;padding:12px;position:relative}.searchcraft-button.searchcraft-button-disabled{cursor:not-allowed}.searchcraft-button-primary{background-color:var(--sc-surface-brand-primary);color:var(--sc-content-brand-on-primary);font-weight:var(--sc-font-bold)}.searchcraft-button-primary:hover{background-color:var(--sc-surface-brand-primary-hover)}.searchcraft-button-primary:focus{border-color:var(--sc-border-primary)}.searchcraft-button-primary:active{background-color:var(--sc-surface-brand-primary-active)}.searchcraft-button-primary.searchcraft-button-disabled,.searchcraft-button-primary.searchcraft-button-disabled:hover,.searchcraft-button-primary.searchcraft-button-disabled:focus,.searchcraft-button-primary.searchcraft-button-disabled:active{background-color:var(--sc-surface-disabled);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-tertiary{background-color:var(--sc-surface-neutral-primary);color:var(--sc-content-brand);font-weight:var(--sc-font-normal)}.searchcraft-button-tertiary:hover{background-color:var(--sc-surface-brand-secondary-hover)}.searchcraft-button-tertiary:focus{background-color:var(--sc-surface-neutral-light);border-color:var(--sc-border-primary)}.searchcraft-button-tertiary:active{background-color:var(--sc-surface-brand-secondary-active)}.searchcraft-button-tertiary.searchcraft-button-disabled,.searchcraft-button-tertiary.searchcraft-button-disabled:hover,.searchcraft-button-tertiary.searchcraft-button-disabled:focus,.searchcraft-button-tertiary.searchcraft-button-disabled:active{background-color:var(--sc-surface-neutral-light);border-color:rgba(0,0,0,0);color:var(--sc-content-disabled)}.searchcraft-button-icon{fill:none}.searchcraft-error-message{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-danger);margin:0}.searchcraft-facet-list{display:flex;flex-direction:column;gap:8px;width:100%}.searchcraft-facet-list-checkbox-label{align-items:center;color:var(--sc-content-neutral-primary);display:flex;font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);gap:8px;position:relative;-webkit-font-smoothing:antialiased}.searchcraft-facet-list-checkbox-input-wrapper{position:relative}.searchcraft-facet-list-checkbox-input{align-items:center;appearance:none;background-color:var(--sc-surface-neutral-secondary);border:1px solid var(--sc-surface-disabled);border-radius:var(--sc-border-radius);cursor:pointer;display:flex;height:24px;justify-content:center;width:24px;margin:0}.searchcraft-facet-list-checkbox-input:focus{outline:2px solid var(--sc-surface-brand-primary);outline-offset:2px}.searchcraft-facet-list-checkbox-input:checked{background-color:var(--sc-surface-brand-primary);position:relative}.searchcraft-facet-list-checkbox-input:checked+.searchcraft-facet-list-checkbox-input-check-icon{display:flex}.searchcraft-facet-list-checkbox-input:checked+.searchcraft-facet-list-checkbox-input-dash-icon{display:flex}.searchcraft-facet-child-list{display:flex;flex-direction:column;gap:6px}.searchcraft-facet-child-list-checkbox-label{margin-left:24px}.searchcraft-facet-child-list-checkbox-label:first-child{margin-top:6px}.searchcraft-facet-list-checkbox-input-check-icon{display:none;height:16px;left:50%;position:absolute;margin-top:2px;top:50%;transform:translate(-50%, -50%);width:16px}.searchcraft-facet-list-checkbox-input-dash-icon{display:none;height:3px;left:50%;position:absolute;top:50%;transform:translate(-50%, -50%);width:14px}.searchcraft-facet-list-message{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-disabled);text-align:center}.searchcraft-facet-list-wrapper{display:flex;flex-direction:column;width:100%;min-height:0}.searchcraft-facet-list-content{display:flex;flex-direction:column;gap:8px;min-height:0;flex-shrink:0}.searchcraft-facet-list-view-more{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);background:none;border:none;color:var(--sc-content-brand);cursor:pointer;padding:8px 0;text-align:left;text-decoration:underline}.searchcraft-facet-list-view-more:hover{color:var(--sc-surface-brand-primary-hover)}.searchcraft-facet-list-view-more:focus{outline:2px solid var(--sc-surface-brand-primary);outline-offset:2px}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);font-weight:var(--sc-font-bold)}[data-toggle-facet-section]{cursor:pointer;display:flex;align-items:center;justify-content:space-between;width:100%;position:relative}[data-toggle-facet-section]::after{content:"›";display:inline-block;font-size:1.5em;line-height:1;margin-left:auto;flex-shrink:0;transition:transform .2s ease;transform-origin:center}[data-toggle-facet-section][data-facet-section-collapsed]::after{transform:rotate(90deg)}[data-toggle-facet-section][data-facet-section-expanded]::after{transform:rotate(-90deg)}@media(max-width: 767px){[data-toggle-filter-panel]{cursor:pointer;display:flex !important;align-items:center;justify-content:space-between;width:100%}[data-toggle-filter-panel]::after{content:"›";display:inline-block;font-size:1.5em;line-height:1;margin-left:auto;flex-shrink:0;transition:transform .2s ease;transform-origin:center}[data-toggle-filter-panel][data-filter-panel-collapsed]::after{transform:rotate(90deg)}[data-toggle-filter-panel][data-filter-panel-expanded]::after{transform:rotate(-90deg)}}@media(min-width: 768px){[data-toggle-filter-panel]{cursor:default}[data-toggle-filter-panel]::after{display:none}}:root{--sc-input-form-border-radius: var(--sc-border-radius);--sc-input-form-search-icon-size: 20px;--sc-input-form-clear-icon-size: 20px}.searchcraft-input-form-grid{display:grid;gap:4px 8px}.searchcraft-input-form-grid-button-left{grid-template-rows:repeat(3, auto);grid-template-columns:auto 1fr}.searchcraft-input-form-grid-button-left .searchcraft-input-form-button{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-label{grid-column:2/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-error-message{grid-column:2/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-left .searchcraft-input-form-input-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-right{grid-template-rows:repeat(3, auto);grid-template-columns:1fr auto}.searchcraft-input-form-grid-button-right .searchcraft-input-form-button{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-label{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-error-message{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-right .searchcraft-input-form-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-grid-button-none{grid-template-rows:repeat(3, auto);grid-template-columns:auto}.searchcraft-input-form-grid-button-none .searchcraft-input-form-button{display:none}.searchcraft-input-form-grid-button-none .searchcraft-input-form-label{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-form-grid-button-none .searchcraft-input-form-error-message{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-form-grid-button-none .searchcraft-input-form-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-form-input-wrapper{display:flex;position:relative}.searchcraft-input-form-input{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);background-color:var(--sc-surface-neutral-secondary);border-radius:var(--sc-input-form-border-radius);border:none;color:var(--sc-content-neutral-primary);flex:1;outline:none;padding:12px 44px}.searchcraft-input-form-input::placeholder{color:var(--sc-content-disabled)}.searchcraft-input-form-input:focus{outline:var(--sc-border-brand) solid 2px;outline-offset:-1px}.searchcraft-input-form-input.searchcraft-placeholder-hide-on-focus:focus::placeholder{opacity:0}.searchcraft-input-form-error{color:var(--sc-content-danger);outline:var(--sc-border-danger) solid 2px}.searchcraft-input-form-error:focus{outline:var(--sc-border-danger) solid 2px}.searchcraft-input-form-input-icon{align-items:center;bottom:0;display:flex;justify-content:center;left:0;position:absolute;pointer-events:none;top:0;width:44px}.searchcraft-input-form-input-search-icon{color:var(--sc-content-neutral-secondary);fill:none;height:var(--sc-input-form-search-icon-size);pointer-events:none;width:var(--sc-input-form-search-icon-size)}.searchcraft-input-form-clear-button{all:unset;align-items:center;bottom:0;border:none;cursor:pointer;display:flex;justify-content:center;outline:none;position:absolute;right:0;top:0;width:44px}.searchcraft-input-form-clear-icon{color:var(--sc-content-brand);fill:none;height:var(--sc-input-form-clear-icon-size);width:var(--sc-input-form-clear-icon-size)}.searchcraft-input-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-neutral-primary);font-weight:var(--sc-font-bold);margin-top:4px;margin-bottom:4px}:root{--sc-popover-button-border-radius: var(--sc-border-radius)}@media(min-width: 576px){:root{--sc-popover-button-border-radius: var(--sc-border-radius-lg)}}.searchcraft-popover-button{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);cursor:pointer}.searchcraft-popover-button-skeuomorphic{appearance:none;background:none;border:none;color:var(--sc-content-neutral-primary);display:block;width:100%}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-wrapper{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-popover-button-border-radius);box-shadow:0 1px 1px rgb(from var(--sc-content-neutral-secondary) r g b/10%) inset,0 2px 4px rgb(from var(--sc-content-neutral-secondary) r g b/5%) inset;display:flex;gap:24px;height:40px;justify-content:space-between;line-height:1;padding:4px 5px 4px 10px;background:var(--sc-surface-neutral-primary)}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-wrapper{box-shadow:0 1px 1px rgb(from var(--sc-content-neutral-secondary) r g b/10%) inset,0 2px 2px rgb(from var(--sc-content-neutral-secondary) r g b/5%) inset,0 4px 4px rgb(from var(--sc-content-neutral-secondary) r g b/5%) inset;height:63px;padding:8px 10px 8px 16px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input{align-items:center;display:flex;gap:4px}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input{gap:8px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps{color:var(--sc-content-neutral-secondary);display:flex;gap:4px;font-size:20px;font-weight:500}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps{gap:8px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap{border-radius:calc(var(--sc-popover-button-border-radius) - 3px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 3px);background-color:var(--sc-surface-neutral-primary);box-shadow:0 3px hsl(from var(--sc-surface-neutral-secondary) h s calc(l - 5)),0 1px 2px rgb(from var(--sc-content-neutral-secondary) r g b/10%),0 6px 4px rgb(from var(--sc-content-neutral-secondary) r g b/5%);height:calc(100% - 2px);position:relative}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap{border-radius:calc(var(--sc-popover-button-border-radius) - 8px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 8px);box-shadow:0 4px hsl(from var(--sc-surface-neutral-secondary) h s calc(l - 5)),0 1px 2px rgb(from var(--sc-content-neutral-secondary) r g b/15%),0 6px 1px rgb(from var(--sc-content-neutral-secondary) r g b/20%),0 7px 2px rgb(from var(--sc-content-neutral-secondary) r g b/15%),0 9px 4px rgb(from var(--sc-content-neutral-secondary) r g b/10%),0 13px 8px rgb(from var(--sc-content-neutral-secondary) r g b/5%);height:calc(100% - 5px)}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::before,.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::after{content:"";display:block}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::before{border-radius:calc(var(--sc-popover-button-border-radius) - 4px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 4px);background:linear-gradient(340deg, rgb(from var(--sc-surface-neutral-secondary) r g b/2%) 0%, var(--sc-surface-neutral-secondary) 100%);inset:2px;position:absolute}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::before{border-radius:calc(var(--sc-popover-button-border-radius) - 12px);border-radius:calc(var(var(--sc-popover-button-border-radius)) - 12px);inset:4px}}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap::after{aspect-ratio:1/1;height:100%}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-keycaps-keycap>span{display:flex;line-height:1;left:50%;margin-top:2%;position:absolute;top:50%;transform:translate(-50%, -50%)}.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input-search-icon{height:60%;width:auto}@media(min-width: 576px){.searchcraft-popover-button-skeuomorphic .searchcraft-popover-button-input-search-icon{height:50%}}:root{--sc-popover-button-magnifying-glass-icon-size: 20px;--sc-popover-button-magnifying-glass-icon-color: var(--sc-content-neutral-secondary);--sc-popover-button-magnifying-glass-icon-color-hover: var(--sc-content-brand);--sc-popover-button-magnifying-glass-padding: 12px}@media(min-width: 576px){:root{--sc-popover-button-magnifying-glass-padding: 16px}}.searchcraft-popover-button-magnifying-glass{appearance:none;background:none;border:none;color:var(--sc-content-neutral-primary);cursor:pointer;display:flex;align-items:center;justify-content:center}.searchcraft-popover-button-magnifying-glass .searchcraft-popover-button-input{display:flex;align-items:center;justify-content:center;padding:var(--sc-popover-button-magnifying-glass-padding)}.searchcraft-popover-button-magnifying-glass .searchcraft-popover-button-input-search-icon{color:var(--sc-popover-button-magnifying-glass-icon-color);display:block;fill:none;stroke:currentcolor;stroke-width:1.5;width:var(--sc-popover-button-magnifying-glass-icon-size);height:var(--sc-popover-button-magnifying-glass-icon-size);transition:color .2s ease}.searchcraft-popover-button-magnifying-glass:hover .searchcraft-popover-button-input-search-icon{color:var(--sc-popover-button-magnifying-glass-icon-color-hover)}:root{--sc-popover-list-view-height: 600px;--sc-popover-modal-max-width: 800px}.searchcraft-popover-form{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);display:flex;flex:1;flex-direction:column}.searchcraft-popover-form searchcraft-input-form,.searchcraft-popover-form searchcraft-popover-footer{width:100%}.searchcraft-popover-form.searchcraft-popover-form-active .searchcraft-popover-form-input{padding-bottom:1px}.searchcraft-popover-form searchcraft-popover-list-view{flex-shrink:1;height:100%;min-height:0;overflow:auto;padding:0 24px}.searchcraft-popover-form searchcraft-results-summary,.searchcraft-popover-form searchcraft-summary-box{margin-bottom:16px}.searchcraft-popover-form-input{display:flex;flex-direction:row;gap:12px}.searchcraft-popover-form-input .searchcraft-input-form-input{background-color:var(--sc-surface-neutral-primary);border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius-lg);width:0}.searchcraft-popover-form-cancel-button{background:none;border:none;cursor:pointer;font-size:14px}.searchcraft-popover-form-modal-input,.searchcraft-popover-form-fullscreen-input{padding:24px}.searchcraft-popover-form-modal-popover-list-view,.searchcraft-popover-form-fullscreen-popover-list-view{flex-grow:1;flex-shrink:1;min-height:0;overflow:auto;padding:0 24px}.searchcraft-popover-form-modal-popover-list-view searchcraft-results-summary,.searchcraft-popover-form-modal-popover-list-view searchcraft-summary-box,.searchcraft-popover-form-fullscreen-popover-list-view searchcraft-results-summary,.searchcraft-popover-form-fullscreen-popover-list-view searchcraft-summary-box{padding:20px 0;margin-bottom:0;border-bottom:1px solid var(--sc-border-neutral-subtle)}.searchcraft-popover-form-inline{background-color:var(--sc-surface-neutral-primary);border:1px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius-xl);padding:12px;position:relative}.searchcraft-popover-form-inline.searchcraft-popover-form-active{border:1px solid var(--sc-border-neutral);border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;padding-bottom:1px}.searchcraft-popover-form-inline searchcraft-popover-list-view{padding:0 12px}.searchcraft-popover-form-inline .searchcraft-input-form-input,.searchcraft-popover-form-inline .searchcraft-popover-list-item-link,.searchcraft-popover-form-inline .searchcraft-adm-ad-link{border-radius:calc(--sc-border-radius-xl - 12px);border-radius:calc(var(--sc-border-radius-xl) - 12px)}.searchcraft-popover-form-inline-wrapper{background-color:var(--sc-surface-neutral-primary);border:1px solid var(--sc-border-neutral);border-top:none;border-bottom-left-radius:var(--sc-border-radius-xl);border-bottom-right-radius:var(--sc-border-radius-xl);display:flex;flex-direction:column;left:-1px;max-height:var(--sc-popover-list-view-height);overflow:hidden;position:absolute;right:-1px;top:100%}.searchcraft-popover-form-inline-wrapper searchcraft-results-summary,.searchcraft-popover-form-inline-wrapper searchcraft-summary-box{padding:16px 12px;margin-bottom:0;border-bottom:1px solid var(--sc-border-neutral-subtle)}.searchcraft-popover-form-modal{align-items:center;display:flex;inset:0;position:fixed;z-index:1000}.searchcraft-popover-form-modal .searchcraft-input-form-input,.searchcraft-popover-form-modal .searchcraft-popover-list-item-link,.searchcraft-popover-form-modal .searchcraft-adm-ad-link{border-radius:calc(--sc-border-radius-2xl - 20px);border-radius:calc(var(--sc-border-radius-2xl) - 20px)}.searchcraft-popover-form-modal-backdrop{background-color:rgb(from var(--sc-content-neutral-primary) r g b/50%);display:none;inset:0;position:fixed}@media(min-width: 576px){.searchcraft-popover-form-modal-backdrop{display:block}}.searchcraft-popover-form-modal-wrapper{background-color:var(--sc-surface-neutral-primary);box-shadow:1px 2px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 2px 4px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 4px 8px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 8px 16px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 16px 32px rgb(from var(--sc-content-neutral-primary) r g b/7%),0 32px 64px rgb(from var(--sc-content-neutral-primary) r g b/7%);display:flex;flex-direction:column;inset:0;max-width:var(--sc-popover-modal-max-width);overflow:hidden;position:absolute;width:100%;z-index:1001}@media(min-width: 576px){.searchcraft-popover-form-modal-wrapper{border-radius:var(--sc-border-radius-2xl);inset:0;margin-top:100px;max-height:var(--sc-popover-list-view-height);max-width:var(--sc-popover-modal-max-width);position:relative}}.searchcraft-popover-form-modal-cancel-button{border-radius:calc(--sc-border-radius-2xl - 20px);border-radius:calc(var(--sc-border-radius-2xl) - 20px);padding:8px}@media(min-width: 576px){.searchcraft-popover-form-modal-cancel-button{padding:8px 12px}}.searchcraft-popover-form-fullscreen{background-color:var(--sc-surface-neutral-primary);display:flex;flex-direction:column;justify-content:space-between;inset:0;position:fixed;z-index:1000}.searchcraft-popover-form-fullscreen .searchcraft-popover-list-item-link,.searchcraft-popover-form-fullscreen .searchcraft-adm-ad-link{border-radius:var(--sc-border-radius-lg)}.searchcraft-popover-form-fullscreen-cancel-button{border-radius:var(--sc-border-radius-lg);padding:8px}@media(min-width: 576px){.searchcraft-popover-form-fullscreen-cancel-button{padding:8px 12px}}.searchcraft-popover-footer{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;align-items:center;background-color:var(--sc-surface-neutral-secondary);display:flex;gap:.5rem;justify-content:space-between;line-height:1;padding:1.25rem 1.5rem}@media(min-width: 576px){.searchcraft-popover-footer{padding:1.25rem 2rem}}.searchcraft-popover-footer-results-info{margin:0}.searchcraft-popover-footer-results-found{display:none}@media(min-width: 576px){.searchcraft-popover-footer-results-found{display:inline}}.searchcraft-popover-footer-link{align-items:center;color:var(--sc-content-neutral-primary);display:flex;font-weight:var(--sc-font-bold);text-decoration:none;white-space:nowrap}.searchcraft-popover-footer-link-prefix{display:none;font-weight:var(--sc-font-normal)}@media(min-width: 576px){.searchcraft-popover-footer-link-prefix{display:inline}}.searchcraft-popover-footer-results{align-items:center;display:flex;gap:.5rem}.searchcraft-popover-footer-view-all{align-items:center;border-radius:999px;border:.0625rem solid var(--sc-border-neutral-strong);color:var(--sc-content-neutral-primary);display:inline-flex;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-bold);gap:.375rem;line-height:1;padding:.375rem .625rem;text-decoration:none}.searchcraft-popover-footer-view-all-shortcut{display:none}@media(min-width: 576px){.searchcraft-popover-footer-view-all-shortcut{display:inline-flex;gap:.125rem}.searchcraft-popover-footer-view-all-shortcut kbd{align-items:center;border-radius:.25rem;border:1px solid var(--sc-content-neutral-primary);display:flex;font-family:Helvetica,Arial,sans-serif;font-size:.75rem;font-style:normal;font-weight:400;height:1.5rem;justify-content:center;line-height:1rem;width:1.5rem}}:root{--sc-popover-list-item-image-fit: contain}.searchcraft-popover-list-item{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;border-bottom:1px solid var(--sc-border-neutral);padding:12px 0}searchcraft-popover-list-item:last-child .searchcraft-popover-list-item{border-bottom:none}.searchcraft-popover-list-item-link{align-items:flex-start;color:var(--sc-content-neutral-primary);display:flex;gap:24px;padding:12px;text-decoration:none}.searchcraft-popover-list-item-link:focus,.searchcraft-popover-list-item-link:active{background-color:var(--sc-surface-neutral-primary-active)}.searchcraft-popover-list-item-link:hover{background-color:var(--sc-surface-neutral-primary-hover)}.searchcraft-popover-list-item-image-wrapper{align-items:center;aspect-ratio:16/9;display:flex;flex-shrink:0;justify-content:center;width:160px}.searchcraft-popover-list-item-image{height:100%;object-fit:var(--sc-popover-list-item-image-fit);width:100%}.searchcraft-popover-list-item-content{display:flex;flex-direction:column;flex-grow:1;gap:4px;justify-content:center}.searchcraft-popover-list-item-content-title,.searchcraft-popover-list-item-content-subtitle{display:-webkit-box;line-clamp:2;margin:0;overflow:hidden;-webkit-line-clamp:2;-webkit-box-orient:vertical}.searchcraft-popover-list-item-content-title{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-heading-5-font-size);font-weight:var(--sc-font-bold)}.searchcraft-popover-list-item-content-subtitle{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-popover-list-view{display:flex;flex-direction:column}.searchcraft-results-info{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-primary);margin:0}.searchcraft-slider{align-items:center;display:flex;flex-direction:column;gap:10px;width:100%;margin-top:4px}.searchcraft-slider-range{align-items:center;background-color:var(--sc-surface-disabled);border-radius:999px;display:flex;position:relative;height:4px;width:100%}.searchcraft-slider-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-active-range{background-color:var(--sc-surface-brand-primary);border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.searchcraft-slider-range .searchcraft-slider-active-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-active-range::-moz-range-track{pointer-events:none}.searchcraft-slider-range .searchcraft-slider-input{appearance:none;background:rgba(0,0,0,0);border-radius:2px;height:4px;margin:0;outline:none;pointer-events:none;position:absolute;width:100%;-webkit-appearance:none}.searchcraft-slider-range .searchcraft-slider-input::-webkit-slider-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:1px solid var(--sc-border-neutral);cursor:pointer;height:18px;pointer-events:all;width:18px;-webkit-appearance:none}.searchcraft-slider-range .searchcraft-slider-input::-moz-range-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:1px solid var(--sc-border-neutral);cursor:pointer;height:18px;pointer-events:all;width:18px}.searchcraft-slider-range .searchcraft-slider-input:focus::-webkit-slider-thumb{outline:2px solid var(--sc-surface-brand-primary)}.searchcraft-slider-range .searchcraft-slider-input:focus::-moz-range-thumb{outline:2px solid var(--sc-surface-brand-primary)}.searchcraft-slider-label{color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);justify-content:space-between;margin-top:4px;width:100%}.searchcraft-slider-start-label,.searchcraft-slider-end-label{min-width:30px;text-align:center}.searchcraft-toggle-button{align-items:flex-start;display:flex;gap:10px;justify-content:space-between}.searchcraft-toggle-button-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-neutral-primary);margin:0}.searchcraft-toggle-button-sub-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);color:var(--sc-content-neutral-secondary);margin:0}.searchcraft-toggle-button-background{background:var(--sc-surface-disabled);border-radius:var(--sc-border-radius-full);border:none;cursor:pointer;flex-shrink:0;height:26px;position:relative;transition:background-color .2s;width:44px}.searchcraft-toggle-button-handle{background:var(--sc-surface-neutral-light);border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform .3s ease;width:18px}.searchcraft-toggle-button-active .searchcraft-toggle-button-background{background:var(--sc-surface-brand-primary);box-shadow:0px 0px 0px 1px rgba(0,0,0,.05)}.searchcraft-toggle-button-active .searchcraft-toggle-button-handle{transform:translateX(16px)}.searchcraft-pagination{display:inline-grid;gap:16px;grid-template-columns:repeat(3, auto);grid-template-rows:1fr}.searchcraft-pagination-list{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius);display:flex;list-style-type:none;margin:0;overflow:hidden;padding:0;width:auto}.searchcraft-pagination-list li{border-right:1px solid var(--sc-border-neutral);height:100%;min-height:44px;width:44px}.searchcraft-pagination-list li:last-child{border-right:none}.searchcraft-pagination-item{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);align-items:center;background-color:var(--sc-surface-neutral-primary);border:none;display:flex;height:100%;justify-content:center;width:100%}.searchcraft-pagination-item-active{background-color:var(--sc-surface-brand-secondary);font-weight:var(--sc-font-bold)}.searchcraft-pagination-control{border:1px solid var(--sc-border-neutral);border-radius:var(--sc-border-radius)}.searchcraft-pagination-range{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);align-items:center;display:flex}.searchcraft-select{display:flex;flex-direction:column;gap:4px}.searchcraft-select-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);font-weight:var(--sc-font-bold)}.searchcraft-select-input-wrapper{position:relative}.searchcraft-select-input{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal);appearance:none;background-color:var(--sc-surface-neutral-secondary);border:2px solid rgba(0,0,0,0);border-radius:var(--sc-border-radius);cursor:pointer;height:44px;padding:0 44px 0 16px;width:100%}.searchcraft-select-input:hover{background-color:var(--sc-surface-neutral-secondary-hover)}.searchcraft-select-input:active{background-color:var(--sc-surface-neutral-secondary-active)}.searchcraft-select-input:focus{border-color:var(--sc-border-brand);outline:none}.searchcraft-select-input-icon{fill:none;pointer-events:none;position:absolute;right:12px;top:50%;transform:translateY(-50%)}.searchcraft-select-caption{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal)}.searchcraft-search-results-per-page{display:flex}.searchcraft-search-results-per-page-select{align-items:center;display:flex;gap:12px}.searchcraft-search-results-per-page-select-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-search-results-per-page-select-input{min-width:120px}.searchcraft-results-summary{padding:20px;border-radius:var(--sc-border-radius);background-color:var(--sc-surface-neutral-secondary);position:relative;min-height:200px;color:var(--sc-content-neutral-primary);font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-results-summary h1,.searchcraft-results-summary h2,.searchcraft-results-summary h3,.searchcraft-results-summary h4,.searchcraft-results-summary h5{padding-top:10px;padding-bottom:10px}.searchcraft-results-summary p{padding-bottom:10px}.searchcraft-results-summary img{max-width:200px}.searchcraft-results-summary ol,.searchcraft-results-summary ul{padding-left:1em;padding-bottom:10px}.searchcraft-results-summary a{color:var(--sc-content-brand)}.searchcraft-summary-box{padding:20px;border-radius:var(--sc-border-radius);background-color:var(--sc-surface-neutral-secondary);position:relative;min-height:200px;color:var(--sc-content-neutral-primary);font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-font-normal)}.searchcraft-summary-box h1,.searchcraft-summary-box h2,.searchcraft-summary-box h3,.searchcraft-summary-box h4,.searchcraft-summary-box h5{padding-top:10px;padding-bottom:10px}.searchcraft-summary-box p{padding-bottom:10px}.searchcraft-summary-box img{max-width:200px}.searchcraft-summary-box ol,.searchcraft-summary-box ul{padding-left:1em;padding-bottom:10px}.searchcraft-summary-box a{color:var(--sc-content-brand)}.searchcraft-loading{display:flex;flex-direction:column;align-items:center;gap:12px;position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}.searchcraft-loading-dots{display:flex;gap:8px;align-items:center;height:40px}.searchcraft-loading-dots>div{width:10px;height:10px;border-radius:50%;background-color:var(--sc-surface-brand-primary);animation:searchcraft-jump .6s ease-in-out infinite}.searchcraft-loading-dots .searchcraft-loading-dot-2{animation-delay:.15s}.searchcraft-loading-dots .searchcraft-loading-dot-3{animation-delay:.3s}.searchcraft-loading-label{font-family:var(--sc-font-family);line-height:1.25;-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-font-normal);letter-spacing:2px;color:#828282;margin:0}@keyframes searchcraft-jump{0%{transform:translateY(0);animation-timing-function:cubic-bezier(0.33, 1, 0.68, 1)}50%{transform:translateY(-20px);animation-timing-function:cubic-bezier(0.32, 0, 0.67, 0)}100%{transform:translateY(0)}}/*# sourceMappingURL=hologram.css.map */
|
|
10148
10456
|
`;
|
|
10149
10457
|
|
|
10150
10458
|
/**
|
|
@@ -10180,7 +10488,7 @@ class SearchcraftTheme {
|
|
|
10180
10488
|
registerInstance(this, hostRef);
|
|
10181
10489
|
}
|
|
10182
10490
|
render() {
|
|
10183
|
-
return hAsync("style", { key: '
|
|
10491
|
+
return hAsync("style", { key: 'ef26626cdfa4fa98d516802d71443c49a9c6ecf9' }, styles);
|
|
10184
10492
|
}
|
|
10185
10493
|
static get cmpMeta() { return {
|
|
10186
10494
|
"$flags$": 256,
|
|
@@ -10244,9 +10552,9 @@ class SearchcraftToggleButton {
|
|
|
10244
10552
|
this.cleanupCore?.();
|
|
10245
10553
|
}
|
|
10246
10554
|
render() {
|
|
10247
|
-
return (hAsync("div", { key: '
|
|
10555
|
+
return (hAsync("div", { key: 'ab1d5ee21c7aaa28af1c405edc986556858366e8', class: classNames('searchcraft-toggle-button', {
|
|
10248
10556
|
'searchcraft-toggle-button-active': this.isActive,
|
|
10249
|
-
}) }, hAsync("div", { key: '
|
|
10557
|
+
}) }, hAsync("div", { key: '44f86a16d796d448bdb2fb3af72d4d8e1484364b' }, hAsync("p", { key: '9fedb38795d6379cae56dc005ab8e4a944b4261b', class: 'searchcraft-toggle-button-label' }, this.label), this.subLabel && (hAsync("p", { key: '44f3d17175184032275fec89a4cfe7f8266b7014', class: 'searchcraft-toggle-button-sub-label' }, this.subLabel))), hAsync("button", { key: '15fc18906ff2fb21fe646a4e3a8a2ace4a37cae2', class: 'searchcraft-toggle-button-background', onClick: this.handleToggle, type: 'button' }, hAsync("div", { key: '716d29c65a199f63f5fd294dc3e3ad2ea4d53aa3', class: 'searchcraft-toggle-button-handle' }))));
|
|
10250
10558
|
}
|
|
10251
10559
|
static get cmpMeta() { return {
|
|
10252
10560
|
"$flags$": 768,
|
|
@@ -10280,6 +10588,7 @@ registerComponents([
|
|
|
10280
10588
|
SearchcraftPopoverListItemAd,
|
|
10281
10589
|
SearchcraftPopoverListView,
|
|
10282
10590
|
SearchcraftResultsInfo,
|
|
10591
|
+
SearchcraftResultsSummary,
|
|
10283
10592
|
SearchcraftSearchResult,
|
|
10284
10593
|
SearchcraftSearchResults,
|
|
10285
10594
|
SearchcraftSearchResultsPerPage,
|