@searchcraft/javascript-sdk 0.10.4 → 0.10.6
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/index.d.ts +52 -20
- package/dist/components/index.js +4 -4
- package/dist/components/{p-9d2e55a7.js → p-2735dceb.js} +3 -3
- package/dist/components/{p-9d2e55a7.js.map → p-2735dceb.js.map} +1 -1
- package/dist/components/p-4dd1995c.js +193 -0
- package/dist/components/p-4dd1995c.js.map +1 -0
- package/dist/components/{p-35ee16e2.js → p-6e5ed641.js} +2 -2
- package/dist/components/{p-35ee16e2.js.map → p-6e5ed641.js.map} +1 -1
- package/dist/components/{p-4c610bc4.js → p-75134ca7.js} +2 -2
- package/dist/components/{p-4c610bc4.js.map → p-75134ca7.js.map} +1 -1
- package/dist/components/{p-eb633481.js → p-9f4c50ed.js} +3 -3
- package/dist/components/{p-eb633481.js.map → p-9f4c50ed.js.map} +1 -1
- package/dist/components/{p-6065aee1.js → p-a7d611cd.js} +17 -12
- package/dist/components/p-a7d611cd.js.map +1 -0
- package/dist/components/{p-6ed5cca1.js → p-aba24c85.js} +4 -4
- package/dist/components/{p-6ed5cca1.js.map → p-aba24c85.js.map} +1 -1
- package/dist/components/p-b194d081.js +406 -0
- package/dist/components/p-b194d081.js.map +1 -0
- package/dist/components/{p-60fd824d.js → p-b54873ff.js} +371 -348
- package/dist/components/p-b54873ff.js.map +1 -0
- package/dist/components/p-d54771ef.js +182 -0
- package/dist/components/p-d54771ef.js.map +1 -0
- package/dist/components/{p-2d975f19.js → p-f2976b33.js} +2 -2
- package/dist/components/{p-2d975f19.js.map → p-f2976b33.js.map} +1 -1
- package/dist/components/searchcraft-ad.js +1 -1
- package/dist/components/searchcraft-facet-list.js +1 -1
- package/dist/components/searchcraft-filter-panel.js +13 -18
- package/dist/components/searchcraft-filter-panel.js.map +1 -1
- package/dist/components/searchcraft-input-form.js +1 -1
- package/dist/components/searchcraft-pagination.js +1 -1
- package/dist/components/searchcraft-popover-button.js +1 -1
- package/dist/components/searchcraft-popover-footer.js +1 -1
- package/dist/components/searchcraft-popover-form.js +6 -6
- package/dist/components/searchcraft-popover-list-item.js +1 -1
- package/dist/components/searchcraft-popover-list-view.js +1 -1
- package/dist/components/searchcraft-results-info.js +2 -2
- package/dist/components/searchcraft-search-result.js +1 -1
- package/dist/components/searchcraft-search-results-per-page.js +1 -1
- package/dist/components/searchcraft-search-results.js +3 -3
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/components/searchcraft-theme.js +1 -1
- package/dist/components/searchcraft-theme.js.map +1 -1
- package/dist/components/searchcraft-toggle-button.js +1 -1
- package/dist/hydrate/index.js +710 -434
- package/dist/hydrate/index.mjs +710 -434
- package/dist/themes/hologram.css +1 -1
- package/dist/themes/hologram.css.map +1 -1
- package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +33 -14
- package/dist/types/components/searchcraft-filter-panel/searchcraft-filter-panel.d.ts +2 -2
- package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +6 -0
- package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +10 -4
- package/dist/types/components.d.ts +23 -7
- package/dist/types/store/SearchcraftStore.types.d.ts +5 -3
- package/dist/types/utils/facets.d.ts +30 -3
- package/dist/types/utils/throttle.d.ts +14 -0
- package/dist/types/utils/units.d.ts +33 -0
- package/package.json +3 -3
- package/dist/components/p-163402fb.js +0 -291
- package/dist/components/p-163402fb.js.map +0 -1
- package/dist/components/p-4d37616e.js +0 -105
- package/dist/components/p-4d37616e.js.map +0 -1
- package/dist/components/p-6065aee1.js.map +0 -1
- package/dist/components/p-60fd824d.js.map +0 -1
- package/dist/components/p-7c650118.js +0 -110
- package/dist/components/p-7c650118.js.map +0 -1
|
@@ -277,21 +277,33 @@ export interface ADMAd {
|
|
|
277
277
|
sale_price?: number;
|
|
278
278
|
term: string;
|
|
279
279
|
}
|
|
280
|
+
export type Facet = {
|
|
281
|
+
/**
|
|
282
|
+
* The path of the facet. The path represents where in the facet tree structure
|
|
283
|
+
* this facet exists. There is an arbitrary number of levels in a facet tree.
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
*
|
|
287
|
+
* '/sports/college' - Represents that this is the facet node exists at [root] -> [sports] -> [college] in the facet tree.
|
|
288
|
+
* '/weather' - Represents that this facet exists at [root] -> [weather] in the facet tree
|
|
289
|
+
* '/news/local' - [root] -> [news] -> [local]
|
|
290
|
+
*/
|
|
291
|
+
path: string;
|
|
292
|
+
/**
|
|
293
|
+
* The count value just represents an arbitrary `count` metadata for this facet node.
|
|
294
|
+
*/
|
|
295
|
+
count: number;
|
|
296
|
+
};
|
|
297
|
+
export type FacetWithChildrenArray = Facet & {
|
|
298
|
+
children: FacetWithChildrenArray[] | null | undefined;
|
|
299
|
+
};
|
|
280
300
|
/**
|
|
281
301
|
* A Facet object returned in a search response.
|
|
282
302
|
*/
|
|
283
303
|
export type FacetRoot = {
|
|
284
|
-
[key: string]:
|
|
304
|
+
[key: string]: FacetWithChildrenArray[];
|
|
285
305
|
};
|
|
286
306
|
export type FacetPrime = FacetRoot[];
|
|
287
|
-
/**
|
|
288
|
-
* Represents the structure of facets, which group search results into categories.
|
|
289
|
-
*/
|
|
290
|
-
export interface FacetChild {
|
|
291
|
-
count: number;
|
|
292
|
-
path: string;
|
|
293
|
-
children?: FacetChild[];
|
|
294
|
-
}
|
|
295
307
|
/**
|
|
296
308
|
* Types of measure requests that can be sent to the /measure/event endpoint.
|
|
297
309
|
*/
|
|
@@ -530,6 +542,7 @@ declare class SearchClient {
|
|
|
530
542
|
private userId;
|
|
531
543
|
private parent;
|
|
532
544
|
private searchCompletedEventTimeout;
|
|
545
|
+
private abortController;
|
|
533
546
|
constructor(parent: SearchcraftCore, config: SearchcraftConfig, userId: string);
|
|
534
547
|
/**
|
|
535
548
|
* Getter for the base url used by the /search endpoint.
|
|
@@ -538,9 +551,10 @@ declare class SearchClient {
|
|
|
538
551
|
/**
|
|
539
552
|
* Make the request to get the search results.
|
|
540
553
|
* @param {properties} properties - The properties for the search.
|
|
554
|
+
* @param sendTelemetry - Whether or not to emit measure and subscription events for this search.
|
|
541
555
|
* @returns
|
|
542
556
|
*/
|
|
543
|
-
getSearchResponseItems: (properties: SearchClientRequestProperties | string) => Promise<SearchcraftResponse>;
|
|
557
|
+
getSearchResponseItems: (properties: SearchClientRequestProperties | string, sendTelemetry?: boolean) => Promise<SearchcraftResponse>;
|
|
544
558
|
private handleGetSearchResponseItemsWithString;
|
|
545
559
|
private handleGetSearchResponseItemsWithObject;
|
|
546
560
|
/**
|
|
@@ -592,7 +606,7 @@ export declare class SearchcraftCore {
|
|
|
592
606
|
* Perform various actions when the input is cleared
|
|
593
607
|
*/
|
|
594
608
|
handleInputCleared(): void;
|
|
595
|
-
getResponseItems: (properties: SearchClientRequestProperties | string, searchCallback: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void, adCallback: (items: AdClientResponseItem[]) => void) => void;
|
|
609
|
+
getResponseItems: (properties: SearchClientRequestProperties | string, searchCallback: (request: SearchClientRequestProperties | string, response: SearchcraftResponse, items: SearchClientResponseItem[], supplementalResponse: SearchcraftResponse | undefined) => void, adCallback: (items: AdClientResponseItem[]) => void) => void;
|
|
596
610
|
}
|
|
597
611
|
/**
|
|
598
612
|
* Callable functions made available by the SearchcraftStore.
|
|
@@ -608,8 +622,8 @@ export interface SearchcraftStateFunctions {
|
|
|
608
622
|
search: () => Promise<void>;
|
|
609
623
|
set: (state: Partial<SearchcraftState> | ((state: SearchcraftState) => Partial<SearchcraftState>)) => SearchcraftState;
|
|
610
624
|
setAdClientResponseItems: (items: AdClientResponseItem[]) => void;
|
|
611
|
-
setSearchClientResponseItemsFromResponse: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void;
|
|
612
|
-
setInitialSearchClientResponseItemsFromResponse: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void;
|
|
625
|
+
setSearchClientResponseItemsFromResponse: (request: SearchClientRequestProperties | string, response: SearchcraftResponse, items: SearchClientResponseItem[], supplementalResponse: SearchcraftResponse | undefined) => void;
|
|
626
|
+
setInitialSearchClientResponseItemsFromResponse: (request: SearchClientRequestProperties | string, response: SearchcraftResponse, items: SearchClientResponseItem[]) => void;
|
|
613
627
|
setInitialQuery: (query: string) => void;
|
|
614
628
|
setPopoverVisibility: (isVisible: boolean) => void;
|
|
615
629
|
setSearchResultsCount: (count: number) => void;
|
|
@@ -640,9 +654,11 @@ export interface SearchcraftStateValues {
|
|
|
640
654
|
isSearchInProgress: boolean;
|
|
641
655
|
rangeValueForIndexFields: Record<string, RangeValueForIndexField>;
|
|
642
656
|
searchMode: "fuzzy" | "exact";
|
|
657
|
+
searchClientRequest: SearchClientRequestProperties | string | undefined | null;
|
|
643
658
|
searchClientResponseItems: SearchClientResponseItem[];
|
|
644
659
|
searchResponseTimeTaken: number | undefined;
|
|
645
660
|
searchResponseFacetPrime: FacetPrime | undefined | null;
|
|
661
|
+
supplementalFacetPrime: FacetPrime | undefined | null;
|
|
646
662
|
searchResultsCount: number;
|
|
647
663
|
searchResultsPage: number;
|
|
648
664
|
searchResultsPerPage: number;
|
|
@@ -802,6 +818,10 @@ export namespace Components {
|
|
|
802
818
|
* The label rendered above the input.
|
|
803
819
|
*/
|
|
804
820
|
"inputLabel"?: string;
|
|
821
|
+
/**
|
|
822
|
+
* The placeholder's render behavior. 'hide-on-focus' - Hide the placeholder text immediately when the input form gains focus. 'hide-on-text-entered' - Only hide the placeholder when the input form has text entered into it.
|
|
823
|
+
*/
|
|
824
|
+
"placeholderBehavior"?: "hide-on-focus" | "hide-on-text-entered";
|
|
805
825
|
/**
|
|
806
826
|
* The input element's placeholder value.
|
|
807
827
|
*/
|
|
@@ -1148,13 +1168,13 @@ export namespace Components {
|
|
|
1148
1168
|
*/
|
|
1149
1169
|
interface SearchcraftSlider {
|
|
1150
1170
|
/**
|
|
1151
|
-
* The type of data
|
|
1171
|
+
* The type of data the sliders are using.
|
|
1152
1172
|
*/
|
|
1153
1173
|
"dataType": "number" | "date";
|
|
1154
1174
|
/**
|
|
1155
|
-
* The granularity
|
|
1175
|
+
* The date granularity to use. Used to format date labels.
|
|
1156
1176
|
*/
|
|
1157
|
-
"
|
|
1177
|
+
"dateGranularity"?: "year" | "month" | "day" | "hour";
|
|
1158
1178
|
/**
|
|
1159
1179
|
* The maximum value allowed.
|
|
1160
1180
|
*/
|
|
@@ -1163,6 +1183,10 @@ export namespace Components {
|
|
|
1163
1183
|
* The minimum value allowed.
|
|
1164
1184
|
*/
|
|
1165
1185
|
"min": number;
|
|
1186
|
+
/**
|
|
1187
|
+
* The step amount for the slider inputs.
|
|
1188
|
+
*/
|
|
1189
|
+
"step": number;
|
|
1166
1190
|
}
|
|
1167
1191
|
/**
|
|
1168
1192
|
* This web component adds Searchcraft's built-in css theme to your page. It does not render anything visible, its only function is to manage the css styles on the page.'
|
|
@@ -1829,7 +1853,7 @@ declare namespace LocalJSX {
|
|
|
1829
1853
|
*/
|
|
1830
1854
|
"fieldName"?: string;
|
|
1831
1855
|
/**
|
|
1832
|
-
*
|
|
1856
|
+
* Emitted when the facets are updated.
|
|
1833
1857
|
*/
|
|
1834
1858
|
"onFacetSelectionUpdated"?: (event: SearchcraftFacetListCustomEvent<{
|
|
1835
1859
|
paths: string[];
|
|
@@ -1916,6 +1940,10 @@ declare namespace LocalJSX {
|
|
|
1916
1940
|
* Event emitted when input initializes.
|
|
1917
1941
|
*/
|
|
1918
1942
|
"onInputInit"?: (event: SearchcraftInputFormCustomEvent<void>) => void;
|
|
1943
|
+
/**
|
|
1944
|
+
* The placeholder's render behavior. 'hide-on-focus' - Hide the placeholder text immediately when the input form gains focus. 'hide-on-text-entered' - Only hide the placeholder when the input form has text entered into it.
|
|
1945
|
+
*/
|
|
1946
|
+
"placeholderBehavior"?: "hide-on-focus" | "hide-on-text-entered";
|
|
1919
1947
|
/**
|
|
1920
1948
|
* The input element's placeholder value.
|
|
1921
1949
|
*/
|
|
@@ -2266,13 +2294,13 @@ declare namespace LocalJSX {
|
|
|
2266
2294
|
*/
|
|
2267
2295
|
interface SearchcraftSlider {
|
|
2268
2296
|
/**
|
|
2269
|
-
* The type of data
|
|
2297
|
+
* The type of data the sliders are using.
|
|
2270
2298
|
*/
|
|
2271
2299
|
"dataType"?: "number" | "date";
|
|
2272
2300
|
/**
|
|
2273
|
-
* The granularity
|
|
2301
|
+
* The date granularity to use. Used to format date labels.
|
|
2274
2302
|
*/
|
|
2275
|
-
"
|
|
2303
|
+
"dateGranularity"?: "year" | "month" | "day" | "hour";
|
|
2276
2304
|
/**
|
|
2277
2305
|
* The maximum value allowed.
|
|
2278
2306
|
*/
|
|
@@ -2285,6 +2313,10 @@ declare namespace LocalJSX {
|
|
|
2285
2313
|
* When the range has changed.
|
|
2286
2314
|
*/
|
|
2287
2315
|
"onRangeChanged"?: (event: SearchcraftSliderCustomEvent<any>) => void;
|
|
2316
|
+
/**
|
|
2317
|
+
* The step amount for the slider inputs.
|
|
2318
|
+
*/
|
|
2319
|
+
"step"?: number;
|
|
2288
2320
|
}
|
|
2289
2321
|
/**
|
|
2290
2322
|
* This web component adds Searchcraft's built-in css theme to your page. It does not render anything visible, its only function is to manage the css styles on the page.'
|
package/dist/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-5365011f.js';
|
|
2
|
-
import { v as ve } from './p-
|
|
3
|
-
export { v as SearchcraftCore, s as searchcraftStore } from './p-
|
|
2
|
+
import { v as ve } from './p-b54873ff.js';
|
|
3
|
+
export { v as SearchcraftCore, s as searchcraftStore } from './p-b54873ff.js';
|
|
4
4
|
export { SearchcraftAd, defineCustomElement as defineCustomElementSearchcraftAd } from './searchcraft-ad.js';
|
|
5
5
|
export { SearchcraftButton, defineCustomElement as defineCustomElementSearchcraftButton } from './searchcraft-button.js';
|
|
6
6
|
export { SearchcraftErrorMessage, defineCustomElement as defineCustomElementSearchcraftErrorMessage } from './searchcraft-error-message.js';
|
|
@@ -24,7 +24,7 @@ export { SearchcraftTheme, defineCustomElement as defineCustomElementSearchcraft
|
|
|
24
24
|
export { SearchcraftToggleButton, defineCustomElement as defineCustomElementSearchcraftToggleButton } from './searchcraft-toggle-button.js';
|
|
25
25
|
|
|
26
26
|
const name = "@searchcraft/javascript-sdk";
|
|
27
|
-
const version = "0.10.
|
|
27
|
+
const version = "0.10.6";
|
|
28
28
|
const description = "Searchcraft Javascript SDK";
|
|
29
29
|
const author = "Searchcraft Inc.";
|
|
30
30
|
const license = "Apache-2.0";
|
|
@@ -67,7 +67,7 @@ const dependencies = {
|
|
|
67
67
|
nanoid: "^5.0.9"
|
|
68
68
|
};
|
|
69
69
|
const devDependencies = {
|
|
70
|
-
"@searchcraft/core": "^0.10.
|
|
70
|
+
"@searchcraft/core": "^0.10.6",
|
|
71
71
|
"@stencil/core": "^4.7.0",
|
|
72
72
|
"@stencil/react-output-target": "^0.8.2",
|
|
73
73
|
"@stencil/sass": "^3.0.12",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-5365011f.js';
|
|
2
|
-
import { s as searchcraftStore } from './p-
|
|
3
|
-
import {
|
|
2
|
+
import { s as searchcraftStore } from './p-b54873ff.js';
|
|
3
|
+
import { g as getDocumentValueFromSearchResultMapping } from './p-d54771ef.js';
|
|
4
4
|
import './p-a64b4cba.js';
|
|
5
5
|
|
|
6
6
|
const SearchcraftPopoverListItem = /*@__PURE__*/ proxyCustomElement(class SearchcraftPopoverListItem extends H {
|
|
@@ -73,4 +73,4 @@ function defineCustomElement() {
|
|
|
73
73
|
|
|
74
74
|
export { SearchcraftPopoverListItem as S, defineCustomElement as d };
|
|
75
75
|
|
|
76
|
-
//# sourceMappingURL=p-
|
|
76
|
+
//# sourceMappingURL=p-2735dceb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-2735dceb.js","mappings":";;;;;MAkBa,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Aa,EAAE,gBAAgB,CAAC,kBAAkB,EAAE;gBACvD,iBAAiB;gBACjB,mBAAmB;gBACnB,WAAW;aACZ,CAAC,CAAC;SACJ;KACF,CAAC;IAEF,MAAM;QACJ,QACE,4DAAK,KAAK,EAAC,+BAA+B,IACxC,0DACE,KAAK,EAAC,oCAAoC,EAC1C,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAEvC,IAAI,CAAC,WAAW,KACf,4DAAK,KAAK,EAAC,6CAA6C,IACtD,4DACE,GAAG,EAAE,IAAI,CAAC,QAAQ,EAClB,GAAG,EAAE,IAAI,CAAC,WAAW,EACrB,KAAK,EAAC,qCAAqC,GAC3C,CACE,CACP,EACD,4DAAK,KAAK,EAAC,uCAAuC,IAC/C,IAAI,CAAC,KAAK,KACT,0DAAG,KAAK,EAAC,6CAA6C,IACnD,IAAI,CAAC,KAAK,CACT,CACL,EACA,IAAI,CAAC,QAAQ,KACZ,0DAAG,KAAK,EAAC,gDAAgD,IACtD,IAAI,CAAC,QAAQ,CACZ,CACL,CACG,CACJ,CACA,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-popover-list-item/searchcraft-popover-list-item.tsx"],"sourcesContent":["import { searchcraftStore } from '@store';\nimport type {\n SearchDocument,\n SearchClientResponseItem,\n PopoverResultMappings,\n} from '@searchcraft/core';\nimport { Component, h, Prop, State } from '@stencil/core';\nimport { getDocumentValueFromSearchResultMapping } from '@utils';\n\n/**\n * A single list item rendered in a searchcraft-popover-list-view.\n *\n * @internal\n */\n@Component({\n tag: 'searchcraft-popover-list-item',\n shadow: false,\n})\nexport class SearchcraftPopoverListItem {\n @Prop() item: SearchClientResponseItem | undefined;\n @Prop() popoverResultMappings: PopoverResultMappings | undefined;\n /** The document position relative to the search results (For Measure) */\n @Prop() documentPosition = 0;\n\n @State() title?: string;\n @State() subtitle?: string;\n @State() href?: string;\n @State() imageSource?: string;\n @State() imageAlt?: string;\n\n mapValuesFromDocument(document: SearchDocument) {\n this.title = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.title,\n );\n this.subtitle = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.subtitle,\n );\n this.href = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.href,\n );\n this.imageSource = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.imageSource,\n );\n this.imageAlt = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.imageAlt,\n );\n }\n\n connectedCallback() {\n if (this.item) {\n this.mapValuesFromDocument(this.item.document);\n }\n }\n\n disconnectedCallback() {}\n\n handleLinkClick = () => {\n const state = searchcraftStore.getState();\n const core = state.getSearchcraftCore();\n\n if (core) {\n const document_position = this.documentPosition;\n const search_term = state.searchTerm;\n const number_of_documents = state.searchClientResponseItems.length || 0;\n\n core.measureClient?.sendMeasureEvent('document_clicked', {\n document_position,\n number_of_documents,\n search_term,\n });\n }\n };\n\n render() {\n return (\n <div class='searchcraft-popover-list-item'>\n <a\n class='searchcraft-popover-list-item-link'\n href={this.href}\n onClick={this.handleLinkClick.bind(this)}\n >\n {this.imageSource && (\n <div class='searchcraft-popover-list-item-image-wrapper'>\n <img\n alt={this.imageAlt}\n src={this.imageSource}\n class='searchcraft-popover-list-item-image'\n />\n </div>\n )}\n <div class='searchcraft-popover-list-item-content'>\n {this.title && (\n <p class='searchcraft-popover-list-item-content-title'>\n {this.title}\n </p>\n )}\n {this.subtitle && (\n <p class='searchcraft-popover-list-item-content-subtitle'>\n {this.subtitle}\n </p>\n )}\n </div>\n </a>\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h } from './p-5365011f.js';
|
|
2
|
+
import { a as getDifferenceInUnits, b as getStartOf, c as getFormattedDateString } from './p-d54771ef.js';
|
|
3
|
+
import './p-a64b4cba.js';
|
|
4
|
+
import { c as classNames } from './p-5cdc6210.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a throttled version of the given function that only invokes
|
|
8
|
+
* the original function at most once every specified number of milliseconds.
|
|
9
|
+
*
|
|
10
|
+
* The logic is written in a way that the last invocation is always called, after the
|
|
11
|
+
* throttle cooldown period has ended.
|
|
12
|
+
*
|
|
13
|
+
* @template Arguments - The argument types for the function to throttle
|
|
14
|
+
* @param callback - The function to throttle
|
|
15
|
+
* @param delayInMilliseconds - The number of milliseconds to wait before allowing the next invocation
|
|
16
|
+
* @returns A throttled version of the original function
|
|
17
|
+
*/
|
|
18
|
+
function throttle(callback, delayInMilliseconds) {
|
|
19
|
+
let isThrottleOnCooldown = false;
|
|
20
|
+
let trailingCallArgs = null;
|
|
21
|
+
const invokeAction = (args) => {
|
|
22
|
+
callback(...args);
|
|
23
|
+
isThrottleOnCooldown = true;
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
isThrottleOnCooldown = false;
|
|
26
|
+
if (trailingCallArgs) {
|
|
27
|
+
const nextArgs = trailingCallArgs;
|
|
28
|
+
trailingCallArgs = null;
|
|
29
|
+
invokeAction(nextArgs);
|
|
30
|
+
}
|
|
31
|
+
}, delayInMilliseconds);
|
|
32
|
+
};
|
|
33
|
+
return (...args) => {
|
|
34
|
+
if (!isThrottleOnCooldown) {
|
|
35
|
+
invokeAction(args);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
trailingCallArgs = args;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const SearchcraftSlider = /*@__PURE__*/ proxyCustomElement(class SearchcraftSlider extends H {
|
|
44
|
+
constructor() {
|
|
45
|
+
super();
|
|
46
|
+
this.__registerHost();
|
|
47
|
+
this.rangeChanged = createEvent(this, "rangeChanged", 7);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The maximum value allowed.
|
|
51
|
+
*/
|
|
52
|
+
max = 100;
|
|
53
|
+
/**
|
|
54
|
+
* The minimum value allowed.
|
|
55
|
+
*/
|
|
56
|
+
min = 0;
|
|
57
|
+
/**
|
|
58
|
+
* The step amount for the slider inputs.
|
|
59
|
+
*/
|
|
60
|
+
step = 1;
|
|
61
|
+
/** The type of data the sliders are using. */
|
|
62
|
+
dataType = 'number';
|
|
63
|
+
/** The date granularity to use. Used to format date labels. */
|
|
64
|
+
dateGranularity;
|
|
65
|
+
lowerBound = 0;
|
|
66
|
+
upperBound = 1;
|
|
67
|
+
endValue = 0;
|
|
68
|
+
startValue = 0;
|
|
69
|
+
lastFocusedHandle = 'max';
|
|
70
|
+
throttledEmitUpdate = () => { };
|
|
71
|
+
/**
|
|
72
|
+
* When the range has changed.
|
|
73
|
+
* */
|
|
74
|
+
rangeChanged;
|
|
75
|
+
connectedCallback() {
|
|
76
|
+
switch (this.dataType) {
|
|
77
|
+
case 'number':
|
|
78
|
+
this.startValue = this.min;
|
|
79
|
+
this.endValue = this.max;
|
|
80
|
+
this.lowerBound = this.min;
|
|
81
|
+
this.upperBound = this.max;
|
|
82
|
+
break;
|
|
83
|
+
case 'date': {
|
|
84
|
+
this.startValue = 0;
|
|
85
|
+
this.endValue = getDifferenceInUnits(this.dateGranularity || 'year', this.min, this.max);
|
|
86
|
+
this.lowerBound = 0;
|
|
87
|
+
this.upperBound = this.endValue;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
this.throttledEmitUpdate = throttle(this.emitUpdate, 120);
|
|
92
|
+
}
|
|
93
|
+
emitUpdate = async () => {
|
|
94
|
+
switch (this.dataType) {
|
|
95
|
+
case 'number':
|
|
96
|
+
this.rangeChanged?.emit({
|
|
97
|
+
startValue: this.startValue,
|
|
98
|
+
endValue: this.endValue,
|
|
99
|
+
});
|
|
100
|
+
break;
|
|
101
|
+
case 'date': {
|
|
102
|
+
const granularity = this.dateGranularity || 'year';
|
|
103
|
+
const startTimestamp = getStartOf(this.min, granularity, this.lowerBound + this.startValue);
|
|
104
|
+
const endTimestamp = getStartOf(this.min, granularity, this.lowerBound + this.endValue + 1);
|
|
105
|
+
this.rangeChanged?.emit({
|
|
106
|
+
startValue: startTimestamp,
|
|
107
|
+
endValue: endTimestamp,
|
|
108
|
+
});
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
handleStartValueChange = (event) => {
|
|
114
|
+
const inputElement = event.target;
|
|
115
|
+
const value = Number.parseInt(inputElement.value, 10);
|
|
116
|
+
this.lastFocusedHandle = 'min';
|
|
117
|
+
if (value <= this.endValue) {
|
|
118
|
+
this.startValue = value;
|
|
119
|
+
this.throttledEmitUpdate();
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.startValue = this.endValue;
|
|
123
|
+
inputElement.value = `${this.endValue}`;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
handleEndValueChange = (event) => {
|
|
127
|
+
const inputElement = event.target;
|
|
128
|
+
const value = Number.parseInt(inputElement.value, 10);
|
|
129
|
+
this.lastFocusedHandle = 'max';
|
|
130
|
+
if (value >= this.startValue) {
|
|
131
|
+
this.endValue = value;
|
|
132
|
+
this.throttledEmitUpdate();
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
this.endValue = this.startValue;
|
|
136
|
+
inputElement.value = `${this.startValue}`;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
getLabel = (value) => {
|
|
140
|
+
switch (this.dataType) {
|
|
141
|
+
case 'number':
|
|
142
|
+
return `${this.startValue}`;
|
|
143
|
+
case 'date': {
|
|
144
|
+
const granularity = this.dateGranularity || 'year';
|
|
145
|
+
const dateOffset = this.lowerBound + value;
|
|
146
|
+
const timestamp = getStartOf(this.min, granularity, dateOffset);
|
|
147
|
+
return getFormattedDateString(this.dateGranularity || 'year', new Date(timestamp));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
render() {
|
|
152
|
+
const startPercent = ((this.startValue - this.lowerBound) /
|
|
153
|
+
(this.upperBound - this.lowerBound)) *
|
|
154
|
+
100;
|
|
155
|
+
const endPercent = ((this.endValue - this.lowerBound) /
|
|
156
|
+
(this.upperBound - this.lowerBound)) *
|
|
157
|
+
100;
|
|
158
|
+
const startLabel = this.getLabel(this.startValue);
|
|
159
|
+
const endLabel = this.getLabel(this.endValue);
|
|
160
|
+
return (h("div", { key: '3b2e8576d64826f123d40deff3b0df9316649a03', class: 'searchcraft-slider' }, h("div", { key: 'ecaa546b96855aad4e839c5e34e995da0925e0b6', class: 'searchcraft-slider-range' }, h("div", { key: 'f37fc0329249857a29f77d9e3739d10f05f6bf62', class: 'searchcraft-slider-active-range', style: {
|
|
161
|
+
left: `${startPercent}%`,
|
|
162
|
+
width: `${endPercent - startPercent}%`,
|
|
163
|
+
} }), h("input", { key: '7b5e6f3983b7c109ea0a3f2b248c35d0e225400b', 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 }), h("input", { key: 'b5bb628b73c8b582a31453e73cb3ef38579eeea5', 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 })), h("div", { key: 'ecb379babd244e3205f30d45628506566fbeff3c', class: 'searchcraft-slider-label' }, h("span", { key: '2be886d05c323f7da1059be88c0cb8ede2e1e98b', class: 'searchcraft-slider-start-label' }, startLabel), h("span", { key: 'bf66fcab3fae565980a4637cb13b14589ffcb5ba', class: 'searchcraft-slider-end-label' }, endLabel))));
|
|
164
|
+
}
|
|
165
|
+
}, [0, "searchcraft-slider", {
|
|
166
|
+
"max": [2],
|
|
167
|
+
"min": [2],
|
|
168
|
+
"step": [2],
|
|
169
|
+
"dataType": [1, "data-type"],
|
|
170
|
+
"dateGranularity": [1, "date-granularity"],
|
|
171
|
+
"lowerBound": [32],
|
|
172
|
+
"upperBound": [32],
|
|
173
|
+
"endValue": [32],
|
|
174
|
+
"startValue": [32],
|
|
175
|
+
"lastFocusedHandle": [32]
|
|
176
|
+
}]);
|
|
177
|
+
function defineCustomElement() {
|
|
178
|
+
if (typeof customElements === "undefined") {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const components = ["searchcraft-slider"];
|
|
182
|
+
components.forEach(tagName => { switch (tagName) {
|
|
183
|
+
case "searchcraft-slider":
|
|
184
|
+
if (!customElements.get(tagName)) {
|
|
185
|
+
customElements.define(tagName, SearchcraftSlider);
|
|
186
|
+
}
|
|
187
|
+
break;
|
|
188
|
+
} });
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export { SearchcraftSlider as S, defineCustomElement as d };
|
|
192
|
+
|
|
193
|
+
//# sourceMappingURL=p-4dd1995c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-4dd1995c.js","mappings":";;;;;AAAA;;;;;;;;;;;;SAYgB,QAAQ,CAItB,QAAsC,EACtC,mBAA2B;IAE3B,IAAI,oBAAoB,GAAG,KAAK,CAAC;IACjC,IAAI,gBAAgB,GAAqB,IAAI,CAAC;IAE9C,MAAM,YAAY,GAAG,CAAC,IAAe;QACnC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QAClB,oBAAoB,GAAG,IAAI,CAAC;QAC5B,UAAU,CAAC;YACT,oBAAoB,GAAG,KAAK,CAAC;YAC7B,IAAI,gBAAgB,EAAE;gBACpB,MAAM,QAAQ,GAAG,gBAAgB,CAAC;gBAClC,gBAAgB,GAAG,IAAI,CAAC;gBACxB,YAAY,CAAC,QAAQ,CAAC,CAAC;aACxB;SACF,EAAE,mBAAmB,CAAC,CAAC;KACzB,CAAC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AG,EAAE,EAC/D,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,IAAI,CAAC,QAAQ,GACpB,CACE,EACN,4DAAK,KAAK,EAAC,0BAA0B,IACnC,6DAAM,KAAK,EAAC,gCAAgC,IAAE,UAAU,CAAQ,EAChE,6DAAM,KAAK,EAAC,8BAA8B,IAAE,QAAQ,CAAQ,CACxD,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/utils/throttle.ts","src/components/searchcraft-slider/searchcraft-slider.tsx"],"sourcesContent":["/**\n * Creates a throttled version of the given function that only invokes\n * the original function at most once every specified number of milliseconds.\n *\n * The logic is written in a way that the last invocation is always called, after the\n * throttle cooldown period has ended.\n *\n * @template Arguments - The argument types for the function to throttle\n * @param callback - The function to throttle\n * @param delayInMilliseconds - The number of milliseconds to wait before allowing the next invocation\n * @returns A throttled version of the original function\n */\nexport function throttle<\n // biome-ignore lint/suspicious/noExplicitAny: To be an effective util, this needs to be flexibile enough allow any type of arguments.\n Arguments extends any[],\n>(\n callback: (...args: Arguments) => void,\n delayInMilliseconds: number,\n): (...args: Arguments) => void {\n let isThrottleOnCooldown = false;\n let trailingCallArgs: Arguments | null = null;\n\n const invokeAction = (args: Arguments) => {\n callback(...args);\n isThrottleOnCooldown = true;\n setTimeout(() => {\n isThrottleOnCooldown = false;\n if (trailingCallArgs) {\n const nextArgs = trailingCallArgs;\n trailingCallArgs = null;\n invokeAction(nextArgs);\n }\n }, delayInMilliseconds);\n };\n\n return (...args: Arguments) => {\n if (!isThrottleOnCooldown) {\n invokeAction(args);\n } else {\n trailingCallArgs = args;\n }\n };\n}\n","import {\n Component,\n Event,\n type EventEmitter,\n h,\n State,\n Prop,\n} from '@stencil/core';\nimport {\n getDifferenceInUnits,\n getFormattedDateString,\n getStartOf,\n} from '@utils';\nimport { throttle } from '@utils/throttle';\nimport classNames from 'classnames';\n\n/**\n * 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.\n *\n * @internal\n */\n@Component({\n tag: 'searchcraft-slider',\n shadow: false,\n})\nexport class SearchcraftSlider {\n /**\n * The maximum value allowed.\n */\n @Prop() max = 100;\n /**\n * The minimum value allowed.\n */\n @Prop() min = 0;\n /**\n * The step amount for the slider inputs.\n */\n @Prop() step = 1;\n /** The type of data the sliders are using. */\n @Prop() dataType: 'number' | 'date' = 'number';\n /** The date granularity to use. Used to format date labels. */\n @Prop() dateGranularity?: 'year' | 'month' | 'day' | 'hour';\n\n @State() lowerBound = 0;\n @State() upperBound = 1;\n @State() endValue = 0;\n @State() startValue = 0;\n @State() lastFocusedHandle: 'min' | 'max' = 'max';\n\n throttledEmitUpdate: () => void = () => {};\n\n /**\n * When the range has changed.\n * */\n @Event() rangeChanged:\n | EventEmitter<{ startValue: number; endValue: number }>\n | undefined;\n\n connectedCallback() {\n switch (this.dataType) {\n case 'number':\n this.startValue = this.min;\n this.endValue = this.max;\n this.lowerBound = this.min;\n this.upperBound = this.max;\n break;\n case 'date': {\n this.startValue = 0;\n this.endValue = getDifferenceInUnits(\n this.dateGranularity || 'year',\n this.min,\n this.max,\n );\n this.lowerBound = 0;\n this.upperBound = this.endValue;\n\n break;\n }\n }\n\n this.throttledEmitUpdate = throttle(this.emitUpdate, 120);\n }\n\n private emitUpdate = async () => {\n switch (this.dataType) {\n case 'number':\n this.rangeChanged?.emit({\n startValue: this.startValue,\n endValue: this.endValue,\n });\n break;\n case 'date': {\n const granularity = this.dateGranularity || 'year';\n const startTimestamp = getStartOf(\n this.min,\n granularity,\n this.lowerBound + this.startValue,\n );\n const endTimestamp = getStartOf(\n this.min,\n granularity,\n this.lowerBound + this.endValue + 1,\n );\n this.rangeChanged?.emit({\n startValue: startTimestamp,\n endValue: endTimestamp,\n });\n break;\n }\n }\n };\n\n private handleStartValueChange = (event: InputEvent) => {\n const inputElement = event.target as HTMLInputElement;\n const value = Number.parseInt(inputElement.value, 10);\n this.lastFocusedHandle = 'min';\n\n if (value <= this.endValue) {\n this.startValue = value;\n this.throttledEmitUpdate();\n } else {\n this.startValue = this.endValue;\n inputElement.value = `${this.endValue}`;\n }\n };\n\n private handleEndValueChange = (event: InputEvent) => {\n const inputElement = event.target as HTMLInputElement;\n const value = Number.parseInt(inputElement.value, 10);\n this.lastFocusedHandle = 'max';\n\n if (value >= this.startValue) {\n this.endValue = value;\n this.throttledEmitUpdate();\n } else {\n this.endValue = this.startValue;\n inputElement.value = `${this.startValue}`;\n }\n };\n\n private getLabel = (value): string => {\n switch (this.dataType) {\n case 'number':\n return `${this.startValue}`;\n case 'date': {\n const granularity = this.dateGranularity || 'year';\n const dateOffset = this.lowerBound + value;\n const timestamp = getStartOf(this.min, granularity, dateOffset);\n\n return getFormattedDateString(\n this.dateGranularity || 'year',\n new Date(timestamp),\n );\n }\n }\n };\n\n render() {\n const startPercent =\n ((this.startValue - this.lowerBound) /\n (this.upperBound - this.lowerBound)) *\n 100;\n const endPercent =\n ((this.endValue - this.lowerBound) /\n (this.upperBound - this.lowerBound)) *\n 100;\n\n const startLabel = this.getLabel(this.startValue);\n const endLabel = this.getLabel(this.endValue);\n\n return (\n <div class='searchcraft-slider'>\n <div class='searchcraft-slider-range'>\n <div\n class='searchcraft-slider-active-range'\n style={{\n left: `${startPercent}%`,\n width: `${endPercent - startPercent}%`,\n }}\n />\n <input\n class={classNames(\n 'searchcraft-slider-input',\n 'searchcraft-slider-input-min-handle',\n )}\n max={this.upperBound}\n min={this.lowerBound}\n onInput={this.handleStartValueChange.bind(this)}\n step={this.step}\n style={{ zIndex: this.lastFocusedHandle === 'min' ? '2' : '1' }}\n type='range'\n value={this.startValue}\n />\n <input\n class={classNames(\n 'searchcraft-slider-input',\n 'searchcraft-slider-input-max-handle',\n )}\n max={this.upperBound}\n min={this.lowerBound}\n onInput={this.handleEndValueChange.bind(this)}\n step={this.step}\n style={{ zIndex: this.lastFocusedHandle === 'max' ? '2' : '1' }}\n type='range'\n value={this.endValue}\n />\n </div>\n <div class='searchcraft-slider-label'>\n <span class='searchcraft-slider-start-label'>{startLabel}</span>\n <span class='searchcraft-slider-end-label'>{endLabel}</span>\n </div>\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-5365011f.js';
|
|
2
2
|
import { c as classNames } from './p-5cdc6210.js';
|
|
3
|
-
import { s as searchcraftStore } from './p-
|
|
3
|
+
import { s as searchcraftStore } from './p-b54873ff.js';
|
|
4
4
|
import { h as html } from './p-810a7850.js';
|
|
5
5
|
|
|
6
6
|
const urlAlphabet =
|
|
@@ -149,4 +149,4 @@ function defineCustomElement() {
|
|
|
149
149
|
|
|
150
150
|
export { SearchcraftPopoverListItemAd as S, defineCustomElement as d, nanoid as n };
|
|
151
151
|
|
|
152
|
-
//# sourceMappingURL=p-
|
|
152
|
+
//# sourceMappingURL=p-6e5ed641.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-6e5ed641.js","mappings":";;;;;AAAO,MAAM,WAAW;AACxB,EAAE;;ACmBQ,IAAC,MAAM,GAAG,CAAC,IAAI,GAAG,EAAE,KAAK;AACnC,EAAE,IAAI,EAAE,GAAG,GAAE;AACb,EAAE,IAAI,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,EAAE,IAAI,IAAI,CAAC,EAAE,EAAC;AACjE,EAAE,OAAO,IAAI,EAAE,EAAE;AACjB,IAAI,EAAE,IAAIA,WAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,EAAC;AAC7C,GAAG;AACH,EAAE,OAAO,EAAE;AACX;;MCJa,4BAA4B;;;;;IAC/B,QAAQ,GAAwB,QAAQ,CAAC;IACzC,oBAAoB,CAAwB;IAC5C,aAAa,GAAW,MAAM,EAAE,CAAC;IAEhC,UAAU,CAAU;IACpB,kBAAkB,GAAG,KAAK,CAAC;;IAG5B,IAAI,CAAmB;IAEvB,oB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AAI,CAAC,aAAa,EAAE,EACjD,KAAK,EAAE,UAAU,CAAC,gBAAgB,EAAE,eAAe,CAAC,sCAClB,IAAI,CAAC,aAAa,GACpD,EACF;KACH;IAED,MAAM;;QAEJ,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC3B,OAAO;SACR;;;;;;QAQD,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC7B,YAAY,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YAC9C,IAAI,CAAC,0BAA0B,GAAG,UAAU,CAAC;gBAC3C,IAAI,CAAC,IAAI,EAAE,yBAAyB,CAAC;oBACnC,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;oBAC/C,aAAa,EAAE,IAAI,CAAC,aAAa;oBACjC,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,EAAE;iBAClC,CAAC,CAAC;aACJ,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,gCAAgC,IAAI,GAAG,CAAC,CAAC;SAChE;QAED,QAAQ,IAAI,CAAC,QAAQ;YACnB,KAAK,eAAe;gBAClB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;YAC5B,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;YAC/B,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;YAC/B;gBACE,OAAO;SACV;KACF;;;;;;;;;;;;;;;;;;;;;;;;","names":["scopedUrlAlphabet"],"sources":["../../node_modules/nanoid/url-alphabet/index.js","../../node_modules/nanoid/index.browser.js","src/components/searchcraft-ad/searchcraft-ad.tsx"],"sourcesContent":["export const urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\n","import { urlAlphabet as scopedUrlAlphabet } from './url-alphabet/index.js'\nexport { urlAlphabet } from './url-alphabet/index.js'\nexport let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nexport let customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << Math.log2(alphabet.length - 1)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step | 0\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length >= size) return id\n }\n }\n }\n}\nexport let customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size | 0, random)\nexport let nanoid = (size = 21) => {\n let id = ''\n let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))\n while (size--) {\n id += scopedUrlAlphabet[bytes[size] & 63]\n }\n return id\n}\n","import type {\n AdClientResponseItem,\n ADMClientResponseItem,\n SearchcraftCore,\n SearchcraftAdSource,\n} from '@searchcraft/core';\nimport { Component, Element, h, Prop, State } from '@stencil/core';\nimport { nanoid } from 'nanoid';\nimport classNames from 'classnames';\n\nimport { searchcraftStore } from '@store';\n\nimport { html } from '@utils';\n\n/**\n * An inline ad meant to be rendered in a list of search results.\n *\n * @internal\n */\n@Component({\n tag: 'searchcraft-ad',\n shadow: false,\n})\nexport class SearchcraftPopoverListItemAd {\n @Prop() adSource: SearchcraftAdSource = 'Custom';\n @Prop() adClientResponseItem?: AdClientResponseItem;\n @Prop() adContainerId: string = nanoid();\n\n @State() searchTerm?: string;\n @State() isSearchInProgress = false;\n @Element() hostElement?: HTMLElement;\n\n private core?: SearchcraftCore;\n\n private intersectionObserver?: IntersectionObserver;\n private storeUnsubscribe?: () => void;\n private adContainerRenderedTimeout?: NodeJS.Timeout;\n private isComponentConnected = true;\n\n connectedCallback() {\n const currentState = searchcraftStore.getState();\n\n this.core = currentState.core;\n this.searchTerm = currentState.searchTerm;\n this.isSearchInProgress = currentState.isSearchInProgress;\n\n // Subscribes to store changes (for search term).\n this.storeUnsubscribe = searchcraftStore.subscribe((state) => {\n this.searchTerm = state.searchTerm;\n this.isSearchInProgress = state.isSearchInProgress;\n });\n }\n\n componentDidLoad() {\n /**\n * Handles when an ad container is viewable within the document,\n * Core emits an ad_container_viewed event and performs ad client side effects\n */\n if (this.hostElement) {\n this.intersectionObserver = new IntersectionObserver(\n ([entry]) => {\n if (entry?.isIntersecting && !this.isSearchInProgress) {\n this.core?.handleAdContainerViewed({\n adClientResponseItem: this.adClientResponseItem,\n adContainerId: this.adContainerId,\n adSource: this.adSource,\n searchTerm: this.searchTerm || '',\n });\n }\n },\n { threshold: 0 },\n );\n\n this.intersectionObserver.observe(this.hostElement);\n }\n }\n\n disconnectedCallback() {\n this.storeUnsubscribe?.();\n this.intersectionObserver?.disconnect();\n this.isComponentConnected = false;\n clearTimeout(this.adContainerRenderedTimeout);\n }\n\n renderADMAd() {\n const item = this.adClientResponseItem as ADMClientResponseItem;\n\n if (!item.admAd) {\n return;\n }\n\n let templateHtml = '<p>Ad Marketplace Ad Placeholder</p>';\n\n if (this.core?.config?.admAdTemplate) {\n templateHtml = this.core?.config?.admAdTemplate(item.admAd, { html });\n }\n\n return (\n <div\n class='searchcraft-ad searchcraft-adm-ad'\n data-searchcraft-ad-container-id={this.adContainerId}\n id={`searchcraft-adm-ad-${this.adContainerId}`}\n innerHTML={templateHtml}\n />\n );\n }\n\n renderCustomAd() {\n const templateRenderFunction = this.core?.config?.customAdTemplate;\n const containerId = `searchcraft-custom-ad-${this.adContainerId}`;\n let templateHtml = '<p>Custom Ad Placeholder</p>';\n\n if (templateRenderFunction) {\n templateHtml = templateRenderFunction(\n {\n searchTerm: this.searchTerm || '',\n adContainerId: this.adContainerId,\n },\n { html },\n );\n }\n\n return (\n <div\n class='searchcraft-ad searchcraft-custom-ad'\n id={containerId}\n data-searchcraft-ad-container-id={this.adContainerId}\n innerHTML={templateHtml}\n />\n );\n }\n\n renderNativoAd() {\n const nativoClassName = this.core?.config.nativoAdClassName || 'ntv-item';\n return (\n <div\n id={`searchcraft-native-ad-${this.adContainerId}`}\n class={classNames('searchcraft-ad', nativoClassName)}\n data-searchcraft-ad-container-id={this.adContainerId}\n />\n );\n }\n\n render() {\n // Don't render ads while search is in progress\n if (this.isSearchInProgress) {\n return;\n }\n\n /**\n * Handles when an ad container is first rendered.\n * Core emits an ad_container_rendered event and performs ad client side effects\n *\n */\n\n if (this.isComponentConnected) {\n clearTimeout(this.adContainerRenderedTimeout);\n this.adContainerRenderedTimeout = setTimeout(() => {\n this.core?.handleAdContainerRendered({\n adClientResponseItem: this.adClientResponseItem,\n adContainerId: this.adContainerId,\n adSource: this.adSource,\n searchTerm: this.searchTerm || '',\n });\n }, this.core?.config?.adContainerRenderedDebounceDelay || 500);\n }\n\n switch (this.adSource) {\n case 'adMarketplace':\n return this.renderADMAd();\n case 'Custom':\n return this.renderCustomAd();\n case 'Nativo':\n return this.renderNativoAd();\n default:\n return;\n }\n }\n}\n"],"version":3}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h } from './p-5365011f.js';
|
|
2
|
-
import { s as searchcraftStore } from './p-
|
|
2
|
+
import { s as searchcraftStore } from './p-b54873ff.js';
|
|
3
3
|
import { c as classNames } from './p-5cdc6210.js';
|
|
4
4
|
|
|
5
5
|
const SearchcraftToggleButton = /*@__PURE__*/ proxyCustomElement(class SearchcraftToggleButton extends H {
|
|
@@ -68,4 +68,4 @@ function defineCustomElement() {
|
|
|
68
68
|
|
|
69
69
|
export { SearchcraftToggleButton as S, defineCustomElement as d };
|
|
70
70
|
|
|
71
|
-
//# sourceMappingURL=p-
|
|
71
|
+
//# sourceMappingURL=p-75134ca7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-75134ca7.js","mappings":";;;;MAoBa,uBAAuB;;;;;;;;;IAI1B,KAAK,GAAG,QAAQ,CAAC;;;;IAIjB,QAAQ,CAAqB;;;;IAK5B,aAAa,CAAyB;IAEtC,QAAQ,GAAG,KAAK,CAAC;IACjB,WAAW,CAA2B;IACtC,cAAc,CAAqB;IAEpC,YAAY,GAAG;QACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KACzC,CAAC;IAEF,iBAAiB;;QAEf,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,KAAK;YAClD,IACE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC,cAAc;gBACxC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EACpC;gBACA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;aACvB;YACD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,UAAU,CAAC;SACxC,CAAC,CAAC;KACJ;IAED,oBAAoB;QAClB,IAAI,CAAC,WAAW,IAAI,CAAC;KACtB;IAED,MAAM;QACJ,QACE,4DACE,KAAK,EAAE,UAAU,CAAC,2BAA2B,EAAE;gBAC7C,kCAAkC,EAAE,IAAI,CAAC,QAAQ;aAClD,CAAC,IAEF,8DACE,0DAAG,KAAK,EAAC,iCAAiC,IAAE,IAAI,CAAC,KAAK,CAAK,EAC1D,IAAI,CAAC,QAAQ,KACZ,0DAAG,KAAK,EAAC,qCAAqC,IAAE,IAAI,CAAC,QAAQ,CAAK,CACnE,CACG,EACN,+DACE,KAAK,EAAC,sCAAsC,EAC5C,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,IAAI,EAAC,QAAQ,IAEb,4DAAK,KAAK,EAAC,kCAAkC,GAAG,CACzC,CACL,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-toggle-button/searchcraft-toggle-button.tsx"],"sourcesContent":["import { searchcraftStore } from '@store';\nimport {\n Component,\n Event,\n h,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.\n *\n * @internal\n */\n@Component({\n tag: 'searchcraft-toggle-button',\n shadow: false,\n})\nexport class SearchcraftToggleButton {\n /**\n * The label.\n */\n @Prop() label = 'Toggle';\n /**\n * The secondary label displayed below the main label.\n */\n @Prop() subLabel: string | undefined;\n\n /**\n * When the toggle element is changed.\n */\n @Event() toggleUpdated?: EventEmitter<boolean>;\n\n @State() isActive = false;\n @State() unsubscribe: (() => void) | undefined;\n @State() lastSearchTerm: string | undefined;\n\n private handleToggle = async () => {\n this.isActive = !this.isActive;\n this.toggleUpdated?.emit(this.isActive);\n };\n\n connectedCallback() {\n /** When the query changes, sets toggle button state back to inactive. */\n this.unsubscribe = searchcraftStore.subscribe((state) => {\n if (\n state.searchTerm !== this.lastSearchTerm &&\n state.searchTerm.trim().length === 0\n ) {\n this.isActive = false;\n }\n this.lastSearchTerm = state.searchTerm;\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n render() {\n return (\n <div\n class={classNames('searchcraft-toggle-button', {\n 'searchcraft-toggle-button-active': this.isActive,\n })}\n >\n <div>\n <p class='searchcraft-toggle-button-label'>{this.label}</p>\n {this.subLabel && (\n <p class='searchcraft-toggle-button-sub-label'>{this.subLabel}</p>\n )}\n </div>\n <button\n class='searchcraft-toggle-button-background'\n onClick={this.handleToggle}\n type='button'\n >\n <div class='searchcraft-toggle-button-handle' />\n </button>\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-5365011f.js';
|
|
2
|
-
import { s as searchcraftStore } from './p-
|
|
3
|
-
import { f as formatNumberWithCommas } from './p-
|
|
2
|
+
import { s as searchcraftStore } from './p-b54873ff.js';
|
|
3
|
+
import { f as formatNumberWithCommas } from './p-d54771ef.js';
|
|
4
4
|
import './p-a64b4cba.js';
|
|
5
5
|
|
|
6
6
|
const SearchcraftPopoverFooter = /*@__PURE__*/ proxyCustomElement(class SearchcraftPopoverFooter extends H {
|
|
@@ -43,4 +43,4 @@ function defineCustomElement() {
|
|
|
43
43
|
|
|
44
44
|
export { SearchcraftPopoverFooter as S, defineCustomElement as d };
|
|
45
45
|
|
|
46
|
-
//# sourceMappingURL=p-
|
|
46
|
+
//# sourceMappingURL=p-9f4c50ed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-
|
|
1
|
+
{"file":"p-9f4c50ed.js","mappings":";;;;;MAca,wBAAwB;;;;;IAC1B,kBAAkB,CAAC;IAEpB,WAAW,GAAe,SAAQ,CAAC;IAE3C,gBAAgB;QACd,IAAI,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,QAAQ,EAAE,CAAC,kBAAkB,CAAC;QAEzE,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,KAAK;YAClD,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,CAAC;SACpD,CAAC,CAAC;KACJ;IAED,oBAAoB;QAClB,IAAI,CAAC,WAAW,IAAI,CAAC;KACtB;IAED,MAAM;QACJ,QACE,+DAAQ,KAAK,EAAC,4BAA4B,IACxC,0DAAG,KAAK,EAAC,yCAAyC,IAC/C,IAAI,CAAC,kBAAkB;cACpB,GAAG,sBAAsB,CAAC,IAAI,CAAC,kBAAkB,CAAC,gBAAgB;cAClE,GAAG,CACL,EACJ,0DACE,KAAK,EAAC,iCAAiC,EACvC,IAAI,EAAC,yBAAyB,EAC9B,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,YAAY,IAEhB,4DACE,KAAK,EAAC,uCAAuC,EAC7C,KAAK,EAAC,KAAK,EACX,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,YAAY,EACpB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,IAElC,yFAAqC,EACrC,6DACE,CAAC,EAAC,kmOAAkmO,EACpmO,IAAI,EAAC,cAAc,GACnB,CACE,CACJ,CACG,EACT;KACH;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-popover-footer/searchcraft-popover-footer.tsx"],"sourcesContent":["import { searchcraftStore } from '@store';\nimport { Component, h, State } from '@stencil/core';\n\nimport { formatNumberWithCommas } from '@utils';\n\n/**\n * Renders the footer for the searchcraft-popover-form.\n *\n * @internal\n */\n@Component({\n tag: 'searchcraft-popover-footer',\n shadow: false,\n})\nexport class SearchcraftPopoverFooter {\n @State() searchResultsCount;\n\n private unsubscribe: () => void = () => {};\n\n componentDidLoad() {\n this.searchResultsCount = searchcraftStore.getState().searchResultsCount;\n\n this.unsubscribe = searchcraftStore.subscribe((state) => {\n this.searchResultsCount = state.searchResultsCount;\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n render() {\n return (\n <footer class='searchcraft-popover-footer'>\n <p class='searchcraft-popover-footer-results-info'>\n {this.searchResultsCount\n ? `${formatNumberWithCommas(this.searchResultsCount)} Results Found`\n : ' '}\n </p>\n <a\n class='searchcraft-popover-footer-link'\n href='https://searchcraft.io/'\n target='_blank'\n rel='noreferrer'\n >\n <svg\n class='searchcraft-popover-footer-link-image'\n width='169'\n height='16'\n viewBox='0 0 169 16'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n >\n <title>Powered by Searchcraft</title>\n <path\n d='M5.07288 0.608C7.60088 0.608 8.84888 2.064 8.84888 4.112C8.84888 6.16 7.60088 7.616 5.07288 7.616H1.68088V12H0.336875V0.608H5.07288ZM5.07288 6.4C6.67288 6.4 7.45688 5.552 7.45688 4.112C7.45688 2.672 6.67288 1.824 5.07288 1.824H1.68088V6.4H5.07288ZM13.31 12.192C10.99 12.192 9.31 10.512 9.31 7.872C9.31 5.232 10.99 3.552 13.31 3.552C15.63 3.552 17.31 5.232 17.31 7.872C17.31 10.512 15.63 12.192 13.31 12.192ZM13.31 11.04C14.91 11.04 15.966 9.872 15.966 7.872C15.966 5.872 14.91 4.704 13.31 4.704C11.71 4.704 10.654 5.872 10.654 7.872C10.654 9.872 11.71 11.04 13.31 11.04ZM28.3826 3.744H29.7586L27.0066 12H25.6626L24.4466 8.176C24.1586 7.264 23.8706 6.304 23.6146 5.376C23.3426 6.304 23.0546 7.264 22.7666 8.176L21.5666 12H20.2226L17.4706 3.744H18.8466L20.0146 7.472C20.3346 8.48 20.6226 9.472 20.9106 10.48C21.1826 9.472 21.4706 8.48 21.7906 7.472L22.9426 3.744H24.2866L25.4386 7.472C25.7426 8.464 26.0466 9.456 26.3346 10.448C26.6066 9.456 26.9106 8.464 27.2146 7.472L28.3826 3.744ZM37.5194 7.872V8.32H31.2474C31.3754 10.176 32.3514 11.024 33.7914 11.024C34.9594 11.024 35.6954 10.416 35.9834 9.488H37.3114C36.9114 11.04 35.7274 12.192 33.7594 12.192C31.5034 12.192 29.9194 10.544 29.9194 7.872C29.9194 5.28 31.4394 3.552 33.7274 3.552C36.1914 3.552 37.5194 5.504 37.5194 7.872ZM33.7274 4.72C32.4314 4.72 31.4874 5.536 31.2794 7.168H36.1434C36.0154 5.808 35.1994 4.72 33.7274 4.72ZM42.9101 3.616C43.0381 3.616 43.1661 3.616 43.3421 3.632V4.864H43.0221C41.3741 4.864 40.3181 5.696 40.3181 7.296V12H39.0381V3.744H40.2541V5.2C40.7181 4.336 41.5661 3.616 42.9101 3.616ZM51.2538 7.872V8.32H44.9818C45.1098 10.176 46.0858 11.024 47.5258 11.024C48.6938 11.024 49.4298 10.416 49.7178 9.488H51.0458C50.6458 11.04 49.4618 12.192 47.4938 12.192C45.2378 12.192 43.6538 10.544 43.6538 7.872C43.6538 5.28 45.1738 3.552 47.4618 3.552C49.9258 3.552 51.2538 5.504 51.2538 7.872ZM47.4618 4.72C46.1658 4.72 45.2218 5.536 45.0138 7.168H49.8778C49.7498 5.808 48.9338 4.72 47.4618 4.72ZM58.9805 0.608H60.2605V12H59.0445V10.72C58.4205 11.664 57.4445 12.192 56.2125 12.192C53.8925 12.192 52.3725 10.512 52.3725 7.872C52.3725 5.232 53.8925 3.552 56.2125 3.552C57.4125 3.552 58.3565 4.048 58.9805 4.928V0.608ZM56.3725 11.04C57.9725 11.04 59.0285 9.872 59.0285 7.872C59.0285 5.872 57.9725 4.704 56.3725 4.704C54.7725 4.704 53.7165 5.936 53.7165 7.936C53.7165 9.936 54.7725 11.04 56.3725 11.04ZM69.2736 3.552C71.5936 3.552 73.1136 5.232 73.1136 7.872C73.1136 10.512 71.5936 12.192 69.2736 12.192C68.0416 12.192 67.0656 11.664 66.4416 10.72V12H65.2256V0.608H66.5056V4.928C67.1296 4.048 68.0736 3.552 69.2736 3.552ZM69.1136 11.04C70.7136 11.04 71.7696 9.808 71.7696 7.808C71.7696 5.808 70.7136 4.704 69.1136 4.704C67.5136 4.704 66.4576 5.872 66.4576 7.872C66.4576 9.872 67.5136 11.04 69.1136 11.04ZM79.3795 3.744H80.7715L77.2835 13.296C76.7555 14.752 75.9075 15.184 74.5955 15.184C74.3395 15.184 74.0995 15.168 73.8275 15.136V14.064H74.5795C75.3955 14.064 75.8275 13.696 76.0835 13.04C76.1795 12.8 76.2755 12.528 76.3715 12.272L73.2675 3.744H74.6755L75.8435 7.184C76.2595 8.384 76.6435 9.568 77.0275 10.752C77.3955 9.568 77.7955 8.368 78.2115 7.168L79.3795 3.744ZM89.1546 12.256C86.1146 12.256 84.2906 10.864 84.2746 8.24H86.4026C86.4346 10.032 87.6346 10.512 89.2186 10.512C90.7066 10.512 91.5226 9.936 91.5226 8.864C91.5226 7.968 90.9306 7.568 89.1866 7.216L88.2266 7.024C86.0186 6.608 84.5626 5.632 84.5626 3.568C84.5626 1.68 86.0506 0.351999 88.7866 0.351999C91.9866 0.351999 93.3466 1.856 93.4266 4H91.3306C91.2506 2.784 90.6266 2.096 88.8186 2.096C87.4426 2.096 86.7706 2.64 86.7706 3.504C86.7706 4.416 87.2986 4.832 88.9946 5.184L89.9866 5.376C92.6746 5.904 93.7626 6.944 93.7626 8.752C93.7626 11.008 92.0026 12.256 89.1546 12.256ZM102.952 8.016V8.496H96.7758C96.9198 9.968 97.7518 10.624 98.9198 10.624C99.8798 10.624 100.504 10.176 100.808 9.44H102.744C102.328 11.12 100.888 12.192 98.9038 12.192C96.4718 12.192 94.7918 10.512 94.7918 7.872C94.7918 5.28 96.4238 3.552 98.8718 3.552C101.4 3.552 102.952 5.392 102.952 8.016ZM98.8558 5.12C97.7838 5.12 96.9838 5.728 96.7918 7.088H100.936C100.776 5.92 100.056 5.12 98.8558 5.12ZM111.599 12H109.583C109.455 11.776 109.391 11.392 109.359 10.992C108.815 11.76 107.919 12.192 106.703 12.192C104.943 12.192 103.727 11.312 103.727 9.712C103.727 8.336 104.559 7.36 106.895 7.136L108.143 7.024C108.911 6.928 109.311 6.688 109.311 6.08C109.311 5.44 108.975 5.056 107.807 5.056C106.655 5.056 106.175 5.36 106.095 6.368H104.111C104.223 4.624 105.247 3.552 107.823 3.552C110.287 3.552 111.263 4.544 111.263 6.032V10.432C111.263 11.024 111.375 11.68 111.599 12ZM107.183 10.752C108.255 10.752 109.311 10.176 109.311 8.736V7.984C109.103 8.176 108.799 8.272 108.367 8.32L107.279 8.448C106.159 8.576 105.791 8.976 105.791 9.632C105.791 10.32 106.255 10.752 107.183 10.752ZM117.216 3.616C117.392 3.616 117.536 3.616 117.712 3.648V5.504H117.2C115.712 5.504 114.816 6.24 114.816 7.808V12H112.8V3.744H114.752V5.216C115.152 4.288 115.936 3.616 117.216 3.616ZM122.137 12.192C119.689 12.192 118.057 10.512 118.057 7.872C118.057 5.232 119.673 3.552 122.137 3.552C124.297 3.552 125.737 4.784 125.977 6.72H123.961C123.769 5.696 123.033 5.232 122.137 5.232C120.937 5.232 120.121 6.064 120.121 7.872C120.121 9.68 120.969 10.512 122.137 10.512C123.049 10.512 123.833 10.016 123.993 8.928H126.009C125.785 10.944 124.249 12.192 122.137 12.192ZM131.641 3.552C133.369 3.552 134.537 4.56 134.537 6.528V12H132.521V6.864C132.521 5.808 131.993 5.296 130.969 5.296C130.089 5.296 129.129 5.904 129.129 7.376V12H127.113V0.608H129.129V4.848C129.673 4.096 130.521 3.552 131.641 3.552ZM139.887 12.192C137.439 12.192 135.807 10.512 135.807 7.872C135.807 5.232 137.423 3.552 139.887 3.552C142.047 3.552 143.487 4.784 143.727 6.72H141.711C141.519 5.696 140.783 5.232 139.887 5.232C138.687 5.232 137.871 6.064 137.871 7.872C137.871 9.68 138.719 10.512 139.887 10.512C140.799 10.512 141.583 10.016 141.743 8.928H143.759C143.535 10.944 141.999 12.192 139.887 12.192ZM149.279 3.616C149.455 3.616 149.599 3.616 149.775 3.648V5.504H149.263C147.775 5.504 146.879 6.24 146.879 7.808V12H144.863V3.744H146.815V5.216C147.215 4.288 147.999 3.616 149.279 3.616ZM157.803 12H155.787C155.659 11.776 155.595 11.392 155.563 10.992C155.019 11.76 154.123 12.192 152.907 12.192C151.147 12.192 149.931 11.312 149.931 9.712C149.931 8.336 150.763 7.36 153.099 7.136L154.347 7.024C155.115 6.928 155.515 6.688 155.515 6.08C155.515 5.44 155.179 5.056 154.011 5.056C152.859 5.056 152.379 5.36 152.299 6.368H150.315C150.427 4.624 151.451 3.552 154.027 3.552C156.491 3.552 157.467 4.544 157.467 6.032V10.432C157.467 11.024 157.579 11.68 157.803 12ZM153.387 10.752C154.459 10.752 155.515 10.176 155.515 8.736V7.984C155.307 8.176 155.003 8.272 154.571 8.32L153.483 8.448C152.363 8.576 151.995 8.976 151.995 9.632C151.995 10.32 152.459 10.752 153.387 10.752ZM162.466 2.16C161.746 2.16 161.426 2.512 161.426 3.152V3.744H163.122V5.28H161.426V12H159.426V5.28H158.146V3.744H159.426V3.12C159.426 1.664 160.146 0.559999 162.13 0.559999C162.45 0.559999 162.882 0.575999 163.17 0.608V2.16H162.466ZM168.636 5.28H167.004V9.744C167.004 10.288 167.276 10.464 167.948 10.464H168.636V12C168.268 12.032 167.9 12.064 167.58 12.064C165.836 12.064 165.004 11.472 165.004 9.952V5.28H163.724V3.744H165.004V1.344H167.004V3.744H168.636V5.28Z'\n fill='currentColor'\n />\n </svg>\n </a>\n </footer>\n );\n }\n}\n"],"version":3}
|