@searchcraft/javascript-sdk 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +7 -0
  2. package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
  3. package/dist/cjs/index-5b0b9d4c.js +84 -0
  4. package/dist/cjs/index-5b0b9d4c.js.map +1 -0
  5. package/dist/cjs/index-6c5282a0.js +1279 -0
  6. package/dist/cjs/index-6c5282a0.js.map +1 -0
  7. package/dist/cjs/index.cjs.js +16 -0
  8. package/dist/cjs/index.cjs.js.map +1 -0
  9. package/dist/cjs/loader.cjs.js +17 -0
  10. package/dist/cjs/loader.cjs.js.map +1 -0
  11. package/dist/cjs/searchcraft-auto-search-form_19.cjs.entry.js +844 -0
  12. package/dist/cjs/searchcraft-auto-search-form_19.cjs.entry.js.map +1 -0
  13. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +64 -0
  14. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js.map +1 -0
  15. package/dist/cjs/searchcraft-button-icon.cjs.entry.js +18 -0
  16. package/dist/cjs/searchcraft-button-icon.cjs.entry.js.map +1 -0
  17. package/dist/cjs/searchcraft-button.cjs.entry.js +37 -0
  18. package/dist/cjs/searchcraft-button.cjs.entry.js.map +1 -0
  19. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +27 -0
  20. package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +1 -0
  21. package/dist/cjs/store-f3bec622.js +406 -0
  22. package/dist/cjs/store-f3bec622.js.map +1 -0
  23. package/dist/collection/assets/searchcraft-button-icons.js +9 -0
  24. package/dist/collection/assets/searchcraft-button-icons.js.map +1 -0
  25. package/dist/{searchcraft-javascript-sdk/searchcraft-check-icon.entry.js → collection/assets/searchcraft-check-icon.js} +6 -11
  26. package/dist/collection/assets/searchcraft-check-icon.js.map +1 -0
  27. package/dist/collection/assets/searchcraft-clear-icon-set.js +45 -0
  28. package/dist/collection/assets/searchcraft-clear-icon-set.js.map +1 -0
  29. package/dist/{searchcraft-javascript-sdk/searchcraft-dash-icon.entry.js → collection/assets/searchcraft-dash-icon.js} +6 -11
  30. package/dist/collection/assets/searchcraft-dash-icon.js.map +1 -0
  31. package/dist/collection/assets/searchcraft-search-icon-set.js +84 -0
  32. package/dist/collection/assets/searchcraft-search-icon-set.js.map +1 -0
  33. package/dist/collection/collection-manifest.json +33 -0
  34. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +379 -0
  35. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -0
  36. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.module.css +15 -0
  37. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js +168 -0
  38. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js.map +1 -0
  39. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.module.css +18 -0
  40. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +329 -0
  41. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -0
  42. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +224 -0
  43. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +268 -0
  44. package/dist/{searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js.map → collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map} +1 -1
  45. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +47 -0
  46. package/dist/collection/components/searchcraft-button/searchcraft-button.js +137 -0
  47. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -0
  48. package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +82 -0
  49. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js +95 -0
  50. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js.map +1 -0
  51. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.module.css +33 -0
  52. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +64 -0
  53. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -0
  54. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +21 -0
  55. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +174 -0
  56. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +1 -0
  57. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +107 -0
  58. package/dist/collection/components/searchcraft-input/searchcraft-input.js +352 -0
  59. package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +1 -0
  60. package/dist/collection/components/searchcraft-input/searchcraft-input.module.css +241 -0
  61. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js +122 -0
  62. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js.map +1 -0
  63. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.module.css +79 -0
  64. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js +109 -0
  65. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js.map +1 -0
  66. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.module.css +17 -0
  67. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +76 -0
  68. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -0
  69. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +21 -0
  70. package/dist/{searchcraft-javascript-sdk/searchcraft-results-info.entry.js → collection/components/searchcraft-results-info/searchcraft-results-info.js} +26 -16
  71. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -0
  72. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +15 -0
  73. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +128 -0
  74. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -0
  75. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +68 -0
  76. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js +19 -0
  77. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js.map +1 -0
  78. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.module.css +35 -0
  79. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js +19 -0
  80. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js.map +1 -0
  81. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.module.css +26 -0
  82. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +92 -0
  83. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -0
  84. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +31 -0
  85. package/dist/collection/index.js +12 -0
  86. package/dist/collection/index.js.map +1 -0
  87. package/dist/collection/provider/store.js +98 -0
  88. package/dist/collection/provider/store.js.map +1 -0
  89. package/dist/collection/utils/utils.js +85 -0
  90. package/dist/collection/utils/utils.js.map +1 -0
  91. package/dist/components/index.js +62 -0
  92. package/dist/components/index.js.map +1 -0
  93. package/dist/components/p-07edaa9b.js +67 -0
  94. package/dist/components/p-07edaa9b.js.map +1 -0
  95. package/dist/components/p-4468fba3.js +61 -0
  96. package/dist/components/p-4468fba3.js.map +1 -0
  97. package/dist/components/p-498c7ef9.js +40 -0
  98. package/dist/components/p-498c7ef9.js.map +1 -0
  99. package/dist/{searchcraft-javascript-sdk/index-d6567b9c.js → components/p-5cdc6210.js} +2 -10
  100. package/dist/components/p-5cdc6210.js.map +1 -0
  101. package/dist/{searchcraft-javascript-sdk/searchcraft-input-caption.entry.js → components/p-6237f03e.js} +31 -10
  102. package/dist/components/p-6237f03e.js.map +1 -0
  103. package/dist/{searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js → components/p-70722ab2.js} +24 -7
  104. package/dist/components/p-70722ab2.js.map +1 -0
  105. package/dist/components/p-7498e493.js +1113 -0
  106. package/dist/components/p-7498e493.js.map +1 -0
  107. package/dist/{searchcraft-javascript-sdk/utils-9f198636.js → components/p-7d1bcd2d.js} +2 -2
  108. package/dist/components/p-7d1bcd2d.js.map +1 -0
  109. package/dist/components/p-8c38185e.js +53 -0
  110. package/dist/components/p-8c38185e.js.map +1 -0
  111. package/dist/{searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js → components/p-a3bd1bc8.js} +26 -7
  112. package/dist/components/p-a3bd1bc8.js.map +1 -0
  113. package/dist/components/p-ae84b899.js +48 -0
  114. package/dist/components/p-ae84b899.js.map +1 -0
  115. package/dist/components/p-bc3f9025.js +33 -0
  116. package/dist/components/p-bc3f9025.js.map +1 -0
  117. package/dist/components/p-bfb22305.js +33 -0
  118. package/dist/components/p-bfb22305.js.map +1 -0
  119. package/dist/{searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js → components/p-c31274dd.js} +37 -8
  120. package/dist/components/p-c31274dd.js.map +1 -0
  121. package/dist/components/p-d3187f5a.js +29 -0
  122. package/dist/components/p-d3187f5a.js.map +1 -0
  123. package/dist/{searchcraft-javascript-sdk/searchcraft-input.entry.js → components/p-dd2a4022.js} +82 -11
  124. package/dist/components/p-dd2a4022.js.map +1 -0
  125. package/dist/components/p-e5471fcf.js +29 -0
  126. package/dist/components/p-e5471fcf.js.map +1 -0
  127. package/dist/components/p-ff049f0a.js +313 -0
  128. package/dist/components/p-ff049f0a.js.map +1 -0
  129. package/dist/{searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js → components/searchcraft-auto-search-form.js} +105 -11
  130. package/dist/components/searchcraft-auto-search-form.js.map +1 -0
  131. package/dist/components/searchcraft-base-search-form.js +152 -0
  132. package/dist/components/searchcraft-base-search-form.js.map +1 -0
  133. package/dist/components/searchcraft-base-search-result.js +8 -0
  134. package/dist/components/searchcraft-base-search-result.js.map +1 -0
  135. package/dist/{searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js → components/searchcraft-base-search-results.js} +53 -11
  136. package/dist/components/searchcraft-base-search-results.js.map +1 -0
  137. package/dist/components/searchcraft-button-icon.js +32 -0
  138. package/dist/components/searchcraft-button-icon.js.map +1 -0
  139. package/dist/components/searchcraft-button.js +8 -0
  140. package/dist/components/searchcraft-button.js.map +1 -0
  141. package/dist/components/searchcraft-check-icon.js +8 -0
  142. package/dist/components/searchcraft-check-icon.js.map +1 -0
  143. package/dist/components/searchcraft-clear-icon-set.js +8 -0
  144. package/dist/components/searchcraft-clear-icon-set.js.map +1 -0
  145. package/dist/components/searchcraft-clear-input-button.js +8 -0
  146. package/dist/components/searchcraft-clear-input-button.js.map +1 -0
  147. package/dist/components/searchcraft-dash-icon.js +8 -0
  148. package/dist/components/searchcraft-dash-icon.js.map +1 -0
  149. package/dist/components/searchcraft-error-message.js +8 -0
  150. package/dist/components/searchcraft-error-message.js.map +1 -0
  151. package/dist/{searchcraft-javascript-sdk/searchcraft-filters-list.entry.js → components/searchcraft-filters-list.js} +48 -11
  152. package/dist/components/searchcraft-filters-list.js.map +1 -0
  153. package/dist/components/searchcraft-input-caption.js +8 -0
  154. package/dist/components/searchcraft-input-caption.js.map +1 -0
  155. package/dist/components/searchcraft-input-icon.js +8 -0
  156. package/dist/components/searchcraft-input-icon.js.map +1 -0
  157. package/dist/components/searchcraft-input-label.js +8 -0
  158. package/dist/components/searchcraft-input-label.js.map +1 -0
  159. package/dist/components/searchcraft-input.js +8 -0
  160. package/dist/components/searchcraft-input.js.map +1 -0
  161. package/dist/components/searchcraft-results-info.js +63 -0
  162. package/dist/components/searchcraft-results-info.js.map +1 -0
  163. package/dist/components/searchcraft-search-icon-set.js +8 -0
  164. package/dist/components/searchcraft-search-icon-set.js.map +1 -0
  165. package/dist/{searchcraft-javascript-sdk/searchcraft-slider.entry.js → components/searchcraft-slider.js} +36 -11
  166. package/dist/components/searchcraft-slider.js.map +1 -0
  167. package/dist/components/searchcraft-spinner-dark.js +8 -0
  168. package/dist/components/searchcraft-spinner-dark.js.map +1 -0
  169. package/dist/components/searchcraft-spinner-light.js +8 -0
  170. package/dist/components/searchcraft-spinner-light.js.map +1 -0
  171. package/dist/{searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js → components/searchcraft-toggle-button.js} +33 -11
  172. package/dist/components/searchcraft-toggle-button.js.map +1 -0
  173. package/dist/esm/index-0ac5bb53.js +1251 -0
  174. package/dist/esm/index-0ac5bb53.js.map +1 -0
  175. package/dist/esm/index-72ac5051.js +82 -0
  176. package/dist/esm/index-72ac5051.js.map +1 -0
  177. package/dist/esm/index.js +3 -0
  178. package/dist/esm/index.js.map +1 -0
  179. package/dist/esm/loader.js +13 -0
  180. package/dist/esm/loader.js.map +1 -0
  181. package/dist/esm/searchcraft-auto-search-form_19.entry.js +822 -0
  182. package/dist/esm/searchcraft-auto-search-form_19.entry.js.map +1 -0
  183. package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-base-search-form.entry.js +4 -5
  184. package/dist/esm/searchcraft-base-search-form.entry.js.map +1 -0
  185. package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-button-icon.entry.js +1 -1
  186. package/dist/esm/searchcraft-button-icon.entry.js.map +1 -0
  187. package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-button.entry.js +4 -4
  188. package/dist/esm/searchcraft-button.entry.js.map +1 -0
  189. package/dist/esm/searchcraft-javascript-sdk.js +22 -0
  190. package/dist/esm/searchcraft-javascript-sdk.js.map +1 -0
  191. package/dist/esm/store-6af9ea01.js +396 -0
  192. package/dist/esm/store-6af9ea01.js.map +1 -0
  193. package/dist/index.cjs.js +1 -0
  194. package/dist/index.js +1 -0
  195. package/dist/loader/cdn.js +1 -0
  196. package/dist/loader/index.cjs.js +1 -0
  197. package/dist/loader/index.d.ts +24 -0
  198. package/dist/loader/index.es2017.js +1 -0
  199. package/dist/loader/index.js +2 -0
  200. package/dist/loader/package.json +11 -0
  201. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -14
  202. package/dist/searchcraft-javascript-sdk/index.esm.js.map +1 -1
  203. package/dist/searchcraft-javascript-sdk/p-05416a3e.entry.js +2 -0
  204. package/dist/searchcraft-javascript-sdk/p-05416a3e.entry.js.map +1 -0
  205. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js +3 -0
  206. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js.map +1 -0
  207. package/dist/searchcraft-javascript-sdk/p-1ab836bf.js +11 -0
  208. package/dist/searchcraft-javascript-sdk/p-1ab836bf.js.map +1 -0
  209. package/dist/searchcraft-javascript-sdk/p-3cb77ee1.entry.js +2 -0
  210. package/dist/searchcraft-javascript-sdk/p-3cb77ee1.entry.js.map +1 -0
  211. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js +7 -0
  212. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js.map +1 -0
  213. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js +2 -0
  214. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js.map +1 -0
  215. package/dist/searchcraft-javascript-sdk/p-6c007e2e.entry.js +2 -0
  216. package/dist/searchcraft-javascript-sdk/p-6c007e2e.entry.js.map +1 -0
  217. package/dist/searchcraft-javascript-sdk/p-e1255160.js +2 -0
  218. package/dist/searchcraft-javascript-sdk/p-e1255160.js.map +1 -0
  219. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -48
  220. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  221. package/package.json +1 -1
  222. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js +0 -34
  223. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js.map +0 -1
  224. package/dist/searchcraft-javascript-sdk/index-8211f330.js +0 -3043
  225. package/dist/searchcraft-javascript-sdk/index-8211f330.js.map +0 -1
  226. package/dist/searchcraft-javascript-sdk/index-d6567b9c.js.map +0 -1
  227. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js.map +0 -1
  228. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-form.entry.js.map +0 -1
  229. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js.map +0 -1
  230. package/dist/searchcraft-javascript-sdk/searchcraft-button-icon.entry.js.map +0 -1
  231. package/dist/searchcraft-javascript-sdk/searchcraft-button.entry.js.map +0 -1
  232. package/dist/searchcraft-javascript-sdk/searchcraft-check-icon.entry.js.map +0 -1
  233. package/dist/searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js.map +0 -1
  234. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js +0 -30
  235. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js.map +0 -1
  236. package/dist/searchcraft-javascript-sdk/searchcraft-dash-icon.entry.js.map +0 -1
  237. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js +0 -22
  238. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js.map +0 -1
  239. package/dist/searchcraft-javascript-sdk/searchcraft-filters-list.entry.js.map +0 -1
  240. package/dist/searchcraft-javascript-sdk/searchcraft-input-caption.entry.js.map +0 -1
  241. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js +0 -25
  242. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js.map +0 -1
  243. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js +0 -29
  244. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js.map +0 -1
  245. package/dist/searchcraft-javascript-sdk/searchcraft-input.entry.js.map +0 -1
  246. package/dist/searchcraft-javascript-sdk/searchcraft-results-info.entry.js.map +0 -1
  247. package/dist/searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js.map +0 -1
  248. package/dist/searchcraft-javascript-sdk/searchcraft-slider.entry.js.map +0 -1
  249. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js +0 -17
  250. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js.map +0 -1
  251. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js +0 -17
  252. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js.map +0 -1
  253. package/dist/searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js.map +0 -1
  254. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js +0 -334
  255. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js.map +0 -1
  256. package/dist/searchcraft-javascript-sdk/store-08ee97f6.js +0 -3073
  257. package/dist/searchcraft-javascript-sdk/store-08ee97f6.js.map +0 -1
  258. package/dist/searchcraft-javascript-sdk/utils-9f198636.js.map +0 -1
  259. /package/dist/{searchcraft-javascript-sdk → esm}/app-globals-0f993ce5.js +0 -0
  260. /package/dist/{searchcraft-javascript-sdk → esm}/app-globals-0f993ce5.js.map +0 -0
@@ -0,0 +1,822 @@
1
+ import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-0ac5bb53.js';
2
+ import { u as useSearchcraftStore, g, p as parseCustomStyles, a as parseSearchKeys, s as serializeStyles, e as extractDynamicProperties, c as getFormattedTimeFromNow, f as flattenFacets } from './store-6af9ea01.js';
3
+ import { c as classNames } from './index-72ac5051.js';
4
+
5
+ const searchcraftAutoSearchFormModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.formLTR{font-family:var(--font-stack);text-align:left;width:100%}.formRTL{font-family:var(--font-stack);text-align:right;width:100%}";
6
+ const SearchcraftAutoSearchFormStyle0 = searchcraftAutoSearchFormModuleCss;
7
+
8
+ const SearchcraftAutoSearchForm = class {
9
+ constructor(hostRef) {
10
+ registerInstance(this, hostRef);
11
+ this.inputClearedOrNoResults = createEvent(this, "inputClearedOrNoResults", 7);
12
+ this.querySubmit = createEvent(this, "querySubmit", 7);
13
+ this.debounceTimeout = null;
14
+ this.debounceDelay = 0;
15
+ this.searchStore = useSearchcraftStore.getState();
16
+ this.handleInputChange = (event) => {
17
+ this.query = event.detail;
18
+ this.searchStore.setQuery(this.query);
19
+ if (this.query.trim() === '') {
20
+ this.searchResults = null;
21
+ this.searchStore.setSearchResults(null);
22
+ }
23
+ else {
24
+ this.querySubmit.emit(this.query);
25
+ }
26
+ };
27
+ this.handleInputKeyUp = (event) => {
28
+ const target = event.detail;
29
+ if (target === this.query) {
30
+ return;
31
+ }
32
+ this.query = target;
33
+ if (this.debounceTimeout) {
34
+ clearTimeout(this.debounceTimeout);
35
+ }
36
+ this.debounceTimeout = setTimeout(() => {
37
+ if (this.query.trim() === '') {
38
+ this.searchResults = null;
39
+ this.searchStore.setSearchResults(null);
40
+ }
41
+ else {
42
+ this.searchStore.setQuery(this.query);
43
+ this.querySubmit.emit(this.query);
44
+ this.runSearch();
45
+ }
46
+ }, this.debounceDelay);
47
+ };
48
+ this.handleClearInput = () => {
49
+ this.query = '';
50
+ this.searchResults = null;
51
+ this.searchStore.setQuery('');
52
+ this.searchStore.setSearchResults(null);
53
+ if (typeof this.clearInput === 'function') {
54
+ this.clearInput();
55
+ }
56
+ if (this.debounceTimeout) {
57
+ clearTimeout(this.debounceTimeout);
58
+ }
59
+ this.error = false;
60
+ this.inputClearedOrNoResults.emit();
61
+ };
62
+ this.runSearch = async () => {
63
+ if (this.query.trim() === '') {
64
+ this.error = true;
65
+ this.inputClearedOrNoResults.emit();
66
+ }
67
+ else {
68
+ this.error = false;
69
+ this.searchStore.setQuery(this.query);
70
+ this.searchStore.setSelectedFilters([]);
71
+ try {
72
+ await this.searchStore.search();
73
+ }
74
+ catch (error) {
75
+ this.error = true;
76
+ this.inputClearedOrNoResults.emit();
77
+ }
78
+ }
79
+ };
80
+ this.handleFormSubmit = async (event) => {
81
+ event.preventDefault();
82
+ await this.runSearch();
83
+ };
84
+ this.autoSearchFormClass = '';
85
+ this.clearInput = () => { };
86
+ this.config = {
87
+ apiKey: '',
88
+ endpointURL: '',
89
+ index: [],
90
+ };
91
+ this.customStylesForInput = {};
92
+ this.inputCaptionValue = '';
93
+ this.inputIconHeight = 20;
94
+ this.inputIconWidth = 20;
95
+ this.labelForInput = '';
96
+ this.placeholderValue = 'Search here';
97
+ this.rightToLeftOrientation = false;
98
+ this.searchContainerClass = '';
99
+ this.error = false;
100
+ this.isRequesting = false;
101
+ this.query = '';
102
+ this.searchResults = null;
103
+ }
104
+ componentDidLoad() {
105
+ const searchcraft = new g(this.config);
106
+ this.searchStore.initialize(searchcraft, true);
107
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
108
+ this.isRequesting = state.isRequesting;
109
+ this.searchResults = Object.assign({}, state.searchResults);
110
+ });
111
+ }
112
+ disconnectedCallback() {
113
+ if (this.unsubscribe) {
114
+ this.unsubscribe();
115
+ }
116
+ }
117
+ render() {
118
+ const formClass = this.rightToLeftOrientation ? 'formRTL' : 'formLTR';
119
+ const parsedCustomStyles = parseCustomStyles(this.customStylesForInput);
120
+ return (h("form", { key: '2421495aa88b52a47658af9b682e172da7d23691', class: `${formClass}`, onSubmit: this.handleFormSubmit }, h("searchcraft-input-label", { key: '032e7e3a7f83af11422b64b023a38c2f433d3809', label: this.labelForInput }), h("searchcraft-input", { key: 'a3a286e6b5ade795a157a1a046278477731684b4', customStyles: parsedCustomStyles, "input-caption-value": this.inputCaptionValue, "input-icon-height": this.inputIconHeight, "input-icon-width": this.inputIconWidth, "is-requesting": this.isRequesting, onClearInput: this.handleClearInput, onInputKeyUp: this.handleInputKeyUp, onSearchInputChange: this.handleInputChange, "placeholder-value": this.placeholderValue, query: this.query, "right-to-left-orientation": this.rightToLeftOrientation }), this.error && (h("searchcraft-error-message", { key: '4588522cf331cc8165e789bb3d58f35ef5148f11', errorMessage: 'Please enter a search query.' }))));
121
+ }
122
+ };
123
+ SearchcraftAutoSearchForm.style = SearchcraftAutoSearchFormStyle0;
124
+
125
+ const searchcraftBaseSearchResultModuleCss = "@charset \"UTF-8\";:root{--font-stack:Helvetica, Arial, sans-serif}.interactiveResultContainerLight{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#FAFAFA}@media (min-width: 600px){.interactiveResultContainerLight{flex-direction:row}}.interactiveResultContainerDark{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#2E2E2E}@media (min-width: 600px){.interactiveResultContainerDark{flex-direction:row}}.resultContainer{align-items:flex-start;display:flex;flex-direction:column;gap:16px}@media (min-width: 600px){.resultContainer{flex-direction:row}}.interactiveIconLarge{display:inline-block;position:absolute;right:5px;top:8px}@media (max-width: 600px){.interactiveIconLarge{display:none}}.interactiveIconSmall{display:inline-block;position:absolute;right:5px;top:-2px}@media (min-width: 600px){.interactiveIconSmall{display:none}}.imageContainer{max-width:100%}.contentContainer{max-height:100%;max-width:100%}@media (min-width: 600px){.contentContainer{max-width:50%}}.secondaryContentContainer{display:flex}.imageLight{border-radius:8px;max-height:100%;max-width:100%;border:1px solid #D9D9D9}.imageDark{border-radius:8px;max-height:100%;max-width:100%;border:1px solid #333}.headingLight{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;-webkit-font-smoothing:antialiased;color:#292929}.headingDark{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;-webkit-font-smoothing:antialiased;color:#FFF}.subheadingLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#737373}.subheadingDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#404040}.secondaryContentLight::after{content:\"•\";color:#404040;font-size:1em;margin-left:5px;margin-right:5px}.secondaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#404040}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#E6E6E6}";
126
+ const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
127
+
128
+ const SearchcraftBaseSearchResult = class {
129
+ constructor(hostRef) {
130
+ registerInstance(this, hostRef);
131
+ this.buttonCallback = createEvent(this, "buttonCallback", 7);
132
+ this.keyDownCallback = createEvent(this, "keyDownCallback", 7);
133
+ this.resultCallback = createEvent(this, "resultCallback", 7);
134
+ this.buttonCallback = () => { }; // Callback for button click
135
+ this.keyDownCallback = () => { }; // Callback for key down event
136
+ this.resultCallback = () => { }; // Callback for result container click
137
+ this.handleButtonClick = () => {
138
+ this.buttonCallback();
139
+ };
140
+ this.handleContainerClick = () => {
141
+ if (this.isInteractive) {
142
+ this.resultCallback();
143
+ }
144
+ };
145
+ this.buttonText = '';
146
+ this.customStyles = '{}';
147
+ this.headingText = '';
148
+ this.imageDescription = '';
149
+ this.imageSource = '';
150
+ this.isInteractive = false;
151
+ this.primaryContent = '';
152
+ this.secondaryContent = '';
153
+ this.subheadingText = '';
154
+ this.tertiaryContent = '';
155
+ this.themeMode = 'light';
156
+ this.placeImageRight = false;
157
+ }
158
+ parseStyles() {
159
+ try {
160
+ return JSON.parse(this.customStyles);
161
+ }
162
+ catch (error) {
163
+ console.error('Error parsing custom styles:', error);
164
+ return {};
165
+ }
166
+ }
167
+ render() {
168
+ const isLightTheme = this.themeMode === 'light';
169
+ const styles = this.parseStyles();
170
+ const imageContainer = this.imageSource && (h("div", { key: '5446a636265cf330a7e67f7539dad7e25077ecda', class: 'imageContainer' }, h("img", { key: '59529cce35008eb171f4ee634ed94ff96e716dad', alt: this.imageDescription, class: isLightTheme ? 'imageLight' : 'imageDark', src: this.imageSource, style: styles.image || {} })));
171
+ const contentContainer = (h("div", { key: 'fd052ef1e3dedcf5b1467b6b0760d0be349c1faf', class: 'contentContainer' }, h("h2", { key: '1d1eca475651641b34d477ea7e2ea2f3eb7a2c49', class: isLightTheme ? 'headingLight' : 'headingDark', style: styles.heading || {} }, this.headingText), h("h3", { key: '9fcf054f634d088b72b67a2675b67a89f651285b', class: isLightTheme ? 'subheadingLight' : 'subheadingDark', style: styles.subheading || {} }, this.subheadingText), h("p", { key: '477078081008771a462abb042232b84f1e72ddd5', class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark', style: styles.primaryContent || {} }, this.primaryContent), h("div", { key: '716ea0fe1efbd18f0b6313baac80834fbab53001', class: 'secondaryContentContainer' }, h("p", { key: '340dad3f568e5cc2b0a1b412b92a335b9afb7a0f', class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark', style: styles.secondaryContent || {} }, this.secondaryContent), h("p", { key: 'b0c940aab4b48d4e560aabe7551b3c1a0a4ef3ae', class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark', style: styles.tertiaryContent || {} }, this.tertiaryContent)), this.buttonText && (h("button", { key: 'd9a08ff62c8bc7d2b13bb42872e2391290de0712', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText))));
172
+ return (h("div", { key: '310676a0e48c3a3d76559b3e3012db1681a55499', class: this.isInteractive
173
+ ? isLightTheme
174
+ ? 'interactiveResultContainerLight'
175
+ : 'interactiveResultContainerDark'
176
+ : 'resultContainer', onKeyDown: this.keyDownCallback, onClick: this.handleContainerClick, style: styles.container || {}, tabindex: '0' }, this.placeImageRight ? (h(Fragment, null, contentContainer, imageContainer)) : (h(Fragment, null, imageContainer, contentContainer))));
177
+ }
178
+ };
179
+ SearchcraftBaseSearchResult.style = SearchcraftBaseSearchResultStyle0;
180
+
181
+ const searchcraftBaseSearchResultsModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.resultsContainer{display:flex;flex-direction:column;justify-content:center;margin:16px 0}.resultsContainer>p{align-self:center}.resultsContainer>div{margin-bottom:20px}.resultsContainer>div img{height:300px;width:200px}.adSection{align-items:center;background-color:#F1F1F1;border:1px solid #DCDDDE;border-radius:16px;display:flex;flex-direction:column;font-size:16px;justify-content:center;margin:auto;min-height:150px;text-align:center;width:100%}.adSection p{margin-top:5px}.emptyState{text-align:center;width:100%}.errorMessageContainer{text-align:center}";
182
+ const SearchcraftBaseSearchResultsStyle0 = searchcraftBaseSearchResultsModuleCss;
183
+
184
+ const SearchcraftBaseSearchResults = class {
185
+ constructor(hostRef) {
186
+ registerInstance(this, hostRef);
187
+ this.adInterval = 4;
188
+ this.customStylesForResults = {};
189
+ this.documentAttributesForDisplay = '';
190
+ this.fallbackElement = null;
191
+ this.formatTime = true;
192
+ this.placeAdAtEnd = false;
193
+ this.placeAdAtStart = true;
194
+ this.placeResultImageRight = false;
195
+ this.hasSearched = false;
196
+ this.query = '';
197
+ this.searchResults = null;
198
+ }
199
+ componentDidLoad() {
200
+ if (!this.documentAttributesForDisplay ||
201
+ this.documentAttributesForDisplay.length === 0) {
202
+ console.warn('No document attributes provided; using empty keys array.');
203
+ this.documentAttributesForDisplay = '';
204
+ }
205
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
206
+ if (state.query.length > 0) {
207
+ this.hasSearched = true;
208
+ }
209
+ else {
210
+ this.hasSearched = false;
211
+ }
212
+ this.searchResults = Object.assign({}, state.searchResults);
213
+ this.query = state.query;
214
+ });
215
+ const { searchResults, query } = useSearchcraftStore.getState();
216
+ this.searchResults = searchResults;
217
+ this.query = query;
218
+ }
219
+ disconnectedCallback() {
220
+ if (this.unsubscribe) {
221
+ this.unsubscribe();
222
+ }
223
+ }
224
+ render() {
225
+ var _a, _b, _c, _d, _e, _f, _g;
226
+ if (!this.hasSearched) {
227
+ return (h("div", { class: 'emptyState' }, h("slot", { name: 'empty-search' })));
228
+ }
229
+ if (!((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data)) {
230
+ return;
231
+ }
232
+ const parsedSearchKeys = parseSearchKeys(this.documentAttributesForDisplay);
233
+ const serializedStyles = typeof this.customStylesForResults === 'string'
234
+ ? this.customStylesForResults
235
+ : serializeStyles(this.customStylesForResults);
236
+ const resultsComponents = (_d = (_c = (_b = this.searchResults) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.hits) === null || _d === void 0 ? void 0 : _d.map((document, index) => {
237
+ const { doc: result } = document;
238
+ const dynamicProperties = extractDynamicProperties(result, parsedSearchKeys);
239
+ if (this.formatTime) {
240
+ for (const key of parsedSearchKeys) {
241
+ if (dynamicProperties[key]) {
242
+ const value = dynamicProperties[key];
243
+ if (typeof value === 'string' &&
244
+ !Number.isNaN(Date.parse(value))) {
245
+ dynamicProperties[key] = getFormattedTimeFromNow(value);
246
+ }
247
+ }
248
+ }
249
+ }
250
+ return (h("searchcraft-base-search-result", { "button-callback": () => console.log('button callback'), "custom-styles": serializedStyles, "image-source": dynamicProperties[parsedSearchKeys[parsedSearchKeys.length - 1]], "is-interactive": true, key: `${document.document_id}-${index}`, "keydown-callback": () => console.log('keydown'), "heading-text": dynamicProperties[parsedSearchKeys[0]], "place-image-right": this.placeResultImageRight, "primary-content": dynamicProperties[parsedSearchKeys[2]], "result-callback": () => console.log('interactive element'), "secondary-content": dynamicProperties[parsedSearchKeys[3]], "subheading-text": dynamicProperties[parsedSearchKeys[1]], "tertiary-content": dynamicProperties[parsedSearchKeys[4]] }));
251
+ });
252
+ const finalComponents = [];
253
+ if (this.placeAdAtStart) {
254
+ finalComponents.push(h("div", { key: 'ad-section-start', class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
255
+ }
256
+ if (this.adInterval > 0) {
257
+ resultsComponents.forEach((component, index) => {
258
+ finalComponents.push(component);
259
+ if ((index + 1) % this.adInterval === 0) {
260
+ finalComponents.push(h("div", { key: `ad-section-${index + 1}`, class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
261
+ }
262
+ });
263
+ }
264
+ else {
265
+ finalComponents.push(...resultsComponents);
266
+ }
267
+ if (this.placeAdAtEnd) {
268
+ finalComponents.push(h("div", { key: 'ad-section-end', class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
269
+ }
270
+ return (h("div", { class: 'resultsContainer' }, finalComponents, this.query.length > 0 &&
271
+ ((_g = (_f = (_e = this.searchResults) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.hits) === null || _g === void 0 ? void 0 : _g.length) === 0 && (h("div", { class: 'errorMessageContainer' }, h("searchcraft-error-message", { "error-message": `No search results found for "${this.query}" query` })))));
272
+ }
273
+ };
274
+ SearchcraftBaseSearchResults.style = SearchcraftBaseSearchResultsStyle0;
275
+
276
+ const SearchcraftCheckIcon = class {
277
+ constructor(hostRef) {
278
+ registerInstance(this, hostRef);
279
+ }
280
+ render() {
281
+ return (h("svg", { key: '3db200942b79612a38293544a029c6854dfa4beb', width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none' }, h("title", { key: 'b7b6af8651edb5cc0e054ed775b9029c6c93535e' }, "Checkbox Check"), h("path", { key: '7c74edc45f007245e4c6e4fd5d37dbc6dad20de0', d: 'M13.9999 2L5.74988 10L1.99988 6.36364', stroke: 'white', "stroke-width": '3', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
282
+ }
283
+ };
284
+
285
+ const SearchcraftClearIconSet = class {
286
+ constructor(hostRef) {
287
+ registerInstance(this, hostRef);
288
+ this.type = 'clear-light';
289
+ }
290
+ render() {
291
+ switch (this.type) {
292
+ case 'clear-light':
293
+ return (h("svg", { width: '22', height: '22', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { id: 'icon-title' }, "Searchcraft Clear Input Icon Light"), h("path", { d: 'M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z', stroke: 'black', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
294
+ case 'clear-dark':
295
+ return (h("svg", { width: '22', height: '22', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { id: 'icon-title' }, "Searchcraft Clear Input Icon Dark"), h("path", { d: 'M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z', stroke: 'white', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
296
+ case 'arrow-light':
297
+ return (h("svg", { width: '20', height: '21', viewBox: '0 0 20 21', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { id: 'icon-title' }, "Searchcraft Arrow Right Icon Light"), h("path", { d: 'M7.5 15.0444L12.5 10.0444L7.5 5.04443', stroke: '#737373', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
298
+ case 'arrow-dark':
299
+ return (h("svg", { width: '8', height: '12', viewBox: '0 0 8 12', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { id: 'icon-title' }, "Searchcraft Arrow Right Icon Dark"), h("path", { d: 'M1.5 11L6.5 6L1.5 1', stroke: '#BFBFBF', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
300
+ default:
301
+ return null;
302
+ }
303
+ }
304
+ };
305
+
306
+ const searchcraftClearInputButtonModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputClearButtonLTR{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;padding:0;position:absolute;right:0;top:50%;transform:translateY(-50%);width:20px}.inputClearButtonRTL{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;left:0px;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:20px}";
307
+ const SearchcraftClearInputButtonStyle0 = searchcraftClearInputButtonModuleCss;
308
+
309
+ const SearchcraftClearInputButton = class {
310
+ constructor(hostRef) {
311
+ registerInstance(this, hostRef);
312
+ this.clearInput = createEvent(this, "clearInput", 7);
313
+ this.handleClearClick = (event) => {
314
+ event.preventDefault();
315
+ this.clearInput.emit();
316
+ };
317
+ this.isRequesting = false;
318
+ this.rightToLeftOrientation = false;
319
+ this.theme = 'light';
320
+ }
321
+ isLightTheme() {
322
+ return this.theme === 'light';
323
+ }
324
+ render() {
325
+ return this.rightToLeftOrientation ? (h("button", { class: classNames('inputClearButtonRTL', '.sc-clear-input-button-rtl'), onClick: this.handleClearClick, type: 'button' }, this.isRequesting ? (this.isLightTheme ? (h("searchcraft-spinner-light", null)) : (h("searchcraft-spinner-dark", null))) : this.isLightTheme ? (h("searchcraft-clear-icon-set", { type: 'clear-light' })) : (h("searchcraft-clear-icon-set", { type: 'clear-dark' })))) : (h("button", { class: classNames('inputClearButtonLTR', '.sc-clear-input-button-ltr'), onClick: this.handleClearClick, type: 'button' }, this.isRequesting ? (this.isLightTheme ? (h("searchcraft-spinner-light", null)) : (h("searchcraft-spinner-dark", null))) : this.isLightTheme ? (h("searchcraft-clear-icon-set", { type: 'clear-light' })) : (h("searchcraft-clear-icon-set", { type: 'clear-dark' }))));
326
+ }
327
+ };
328
+ SearchcraftClearInputButton.style = SearchcraftClearInputButtonStyle0;
329
+
330
+ const SearchcraftDashIcon = class {
331
+ constructor(hostRef) {
332
+ registerInstance(this, hostRef);
333
+ }
334
+ render() {
335
+ return (h("svg", { key: '4d0c3ab69a973ec8b1d89f52082e4b98ce17e39d', width: '14', height: '3', viewBox: '0 0 14 3', fill: 'none' }, h("title", { key: '99a099dcd6a163ba5b8c1f5b80f9ebfde2152778' }, "Checkbox Dash"), h("line", { key: '49f030f69ff1d37139f868ffb94b5f24442dce37', x1: '1.5', y1: '1.5', x2: '12.5', y2: '1.5', stroke: 'white', "stroke-width": '3', "stroke-linecap": 'round' })));
336
+ }
337
+ };
338
+
339
+ const searchcraftErrorMessageModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.errorMessageLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000}.errorMessageDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3}";
340
+ const SearchcraftErrorMessageStyle0 = searchcraftErrorMessageModuleCss;
341
+
342
+ const SearchcraftErrorMessage = class {
343
+ constructor(hostRef) {
344
+ registerInstance(this, hostRef);
345
+ this.errorMessage = undefined;
346
+ this.theme = 'light';
347
+ }
348
+ render() {
349
+ const errorMessageStyle = this.theme === 'light' ? 'errorMessageLight' : 'errorMessageDark';
350
+ return (h("p", { key: '7c26f9a1b2589d57a81f7909c456e712d9b7fe79', class: classNames(errorMessageStyle) }, this.errorMessage || 'Search term is required.'));
351
+ }
352
+ };
353
+ SearchcraftErrorMessage.style = SearchcraftErrorMessageStyle0;
354
+
355
+ const searchcraftFiltersListModuleCss = ".filtersList{width:100%}.checkboxLabel{align-items:center;color:#292929;display:flex;font-family:\"Source Sans Pro\";font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.checkboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:#EDEDED;border:1px solid #D9D9D9;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.checkboxLabel input[type=checkbox]:checked{background-color:#000;position:relative}.checkboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.checkboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.remainingFilterListCheckbox{margin-left:16px}.childCheckboxLabel{align-items:center;color:#292929;display:flex;font-family:\"Source Sans Pro\";font-size:14px;font-weight:600;gap:12px;position:relative}.childCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:#EDEDED;border:1px solid #D9D9D9;cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childCheckboxLabel input[type=checkbox]:checked{background-color:#000;position:relative}.childCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.childCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.checkContainer{display:none;height:16px;width:16px;position:absolute;top:10px;left:7px}.dashContainer{display:none;height:3px;width:14px;position:absolute;top:5px;left:9px}.loading{align-items:center;display:flex;justify-content:center;margin:100px}";
356
+ const SearchcraftFiltersListStyle0 = searchcraftFiltersListModuleCss;
357
+
358
+ const SearchcraftFiltersList = class {
359
+ constructor(hostRef) {
360
+ registerInstance(this, hostRef);
361
+ this.filtersUpdated = createEvent(this, "filtersUpdated", 7);
362
+ this.searchStore = useSearchcraftStore.getState();
363
+ this.autoSearchFormElement = null;
364
+ this.handleSearchRequest = () => {
365
+ this.selectedFilters = [];
366
+ this.searchStore.setSelectedFilters([]);
367
+ this.emitFiltersUpdate();
368
+ };
369
+ this.filters = [];
370
+ this.dynamicFilters = [];
371
+ this.selectedFilters = [];
372
+ this.query = '';
373
+ this.isRequesting = false;
374
+ this.resultsCount = 0;
375
+ }
376
+ connectedCallback() {
377
+ var _a;
378
+ const state = this.searchStore;
379
+ const facets = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data.facets;
380
+ if (facets) {
381
+ this.populateFiltersFromFacets(facets);
382
+ }
383
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
384
+ var _a, _b, _c, _d, _e;
385
+ const query = (_a = state.query) === null || _a === void 0 ? void 0 : _a.trim();
386
+ const facets = (_b = state.searchResults) === null || _b === void 0 ? void 0 : _b.data.facets;
387
+ this.query = query || '';
388
+ this.isRequesting = state.isRequesting;
389
+ this.resultsCount = ((_e = (_d = (_c = state.searchResults) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.hits) === null || _e === void 0 ? void 0 : _e.length) || 0;
390
+ if (facets && this.selectedFilters.length === 0) {
391
+ this.populateFiltersFromFacets(facets);
392
+ }
393
+ });
394
+ this.autoSearchFormElement = document.querySelector('searchcraft-auto-search-form');
395
+ if (this.autoSearchFormElement) {
396
+ this.autoSearchFormElement.addEventListener('querySubmit', this.handleSearchRequest);
397
+ }
398
+ }
399
+ disconnectedCallback() {
400
+ if (this.unsubscribe) {
401
+ this.unsubscribe();
402
+ }
403
+ if (this.autoSearchFormElement) {
404
+ this.autoSearchFormElement.removeEventListener('querySubmit', this.handleSearchRequest);
405
+ }
406
+ }
407
+ populateFiltersFromFacets(facets) {
408
+ var _a;
409
+ const flattened = flattenFacets(((_a = facets[0]) === null || _a === void 0 ? void 0 : _a.section) || []);
410
+ this.dynamicFilters = flattened.map((filter) => ({
411
+ label: filter.label,
412
+ value: filter.value,
413
+ count: filter.count,
414
+ children: filter.children || [],
415
+ }));
416
+ }
417
+ handleCheckboxChange(value, isChecked, isParent = false) {
418
+ var _a;
419
+ if (isParent) {
420
+ const parentFilter = this.dynamicFilters.find((filter) => filter.value === value);
421
+ const childValues = ((_a = parentFilter === null || parentFilter === void 0 ? void 0 : parentFilter.children) === null || _a === void 0 ? void 0 : _a.map((child) => child.value)) || [];
422
+ if (!isChecked) {
423
+ // Remove children from selectedFilters when parent is unchecked
424
+ this.selectedFilters = this.selectedFilters.filter((filter) => filter !== value && !childValues.includes(filter));
425
+ }
426
+ else {
427
+ // Add parent filter to selectedFilters
428
+ this.selectedFilters = [...this.selectedFilters, value];
429
+ }
430
+ }
431
+ else {
432
+ // Update selectedFilters for child filters
433
+ this.selectedFilters = isChecked
434
+ ? [...this.selectedFilters, value]
435
+ : this.selectedFilters.filter((filter) => filter !== value);
436
+ }
437
+ this.emitFiltersUpdate();
438
+ }
439
+ emitFiltersUpdate() {
440
+ this.filtersUpdated.emit(this.selectedFilters);
441
+ this.searchStore.setSelectedFilters(this.selectedFilters);
442
+ this.searchStore.search();
443
+ }
444
+ formatLabel(label, count) {
445
+ return `${label.replace(/-/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())} (${count})`;
446
+ }
447
+ render() {
448
+ if (!this.query || this.resultsCount === 0) {
449
+ return null;
450
+ }
451
+ return (h("div", { class: 'filtersList' }, this.dynamicFilters.map((filter) => {
452
+ const isChildSelected = filter.children
453
+ ? filter.children.some((child) => this.selectedFilters.includes(child.value))
454
+ : false;
455
+ return (h("div", { key: filter.value, class: 'filterItem' }, h("label", { class: 'checkboxLabel' }, h("input", { type: 'checkbox', checked: this.selectedFilters.includes(filter.value), onChange: (event) => this.handleCheckboxChange(filter.value, event.target.checked, true) }), isChildSelected ? (h("div", { class: 'dashContainer' }, h("searchcraft-dash-icon", null))) : (h("div", { class: 'checkContainer' }, h("searchcraft-check-icon", null))), this.formatLabel(filter.label, filter.count)), filter.children && filter.children.length > 0 && (h("div", { class: 'childrenContainer' }, filter.children.map((child) => (h("label", { key: child.value, class: 'childCheckboxLabel', style: {
456
+ marginLeft: '20px',
457
+ display: this.selectedFilters.includes(filter.value)
458
+ ? 'flex'
459
+ : 'none',
460
+ } }, h("input", { type: 'checkbox', checked: this.selectedFilters.includes(child.value), onChange: (event) => this.handleCheckboxChange(child.value, event.target.checked) }), h("div", { class: 'checkContainer' }, h("searchcraft-check-icon", null)), this.formatLabel(child.label.includes('/')
461
+ ? child.label.split('/').pop() || child.label
462
+ : child.label, child.count))))))));
463
+ })));
464
+ }
465
+ };
466
+ SearchcraftFiltersList.style = SearchcraftFiltersListStyle0;
467
+
468
+ const searchcraftInputModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputContainerLTR{position:relative;width:100%}.inputContainerRTL{position:relative;width:100%;margin-left:8px}.inputLightLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;margin-right:8px;padding-left:36px;padding-right:16px}.inputLightLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputLightLTR::placeholder{color:#737373}.inputLightLTR:focus{outline:2px solid #000}.inputDarkLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;margin-right:8px;padding-left:36px;padding-right:16px}.inputDarkLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputDarkLTR::placeholder{color:#BFBFBF}.inputDarkLTR:focus{outline:2px solid #FFF}.inputErrorLightLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;outline:2px solid #c00;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorLightLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorLightLTR::placeholder{color:#737373}.inputErrorLightLTR:focus{outline:2px solid #000}.inputErrorLightLTR:focus-visible{outline:2px solid #c00}.inputErrorDarkLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;outline:2px solid #FFB3B3;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorDarkLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorDarkLTR::placeholder{color:#BFBFBF}.inputErrorDarkLTR:focus{outline:2px solid #FFF}.inputErrorDarkLTR:focus-visible{outline:2px solid #FFB3B3}.inputLightRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputLightRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputLightRTL::placeholder{color:#737373}.inputLightRTL:focus{outline:2px solid #000}.inputDarkRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputDarkRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputDarkRTL::placeholder{color:#BFBFBF}.inputDarkRTL:focus{outline:2px solid #FFF}.inputErrorLightRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;outline:2px solid #c00;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorLightRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorLightRTL::placeholder{color:#737373}.inputErrorLightRTL:focus{outline:2px solid #000}.inputErrorLightRTL:focus-visible{outline:2px solid #c00}.inputErrorDarkRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;outline:2px solid #FFB3B3;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorDarkRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorDarkRTL::placeholder{color:#BFBFBF}.inputErrorDarkRTL:focus{outline:2px solid #FFF}.inputErrorDarkRTL:focus-visible{outline:2px solid #FFB3B3}.inputWrapper{align-items:center;display:flex;position:relative;width:100%}";
469
+ const SearchcraftInputStyle0 = searchcraftInputModuleCss;
470
+
471
+ const SearchcraftInput = class {
472
+ constructor(hostRef) {
473
+ registerInstance(this, hostRef);
474
+ this.clearInput = createEvent(this, "clearInput", 7);
475
+ this.searchInputChange = createEvent(this, "searchInputChange", 7);
476
+ this.inputKeyUp = createEvent(this, "inputKeyUp", 7);
477
+ this.customStyles = {};
478
+ this.error = false;
479
+ this.formClassName = '';
480
+ this.inputCaptionClassName = '';
481
+ this.inputCaptionValue = '';
482
+ this.inputClassName = '';
483
+ this.inputIconHeight = 20;
484
+ this.inputIconWidth = 20;
485
+ this.isRequesting = false;
486
+ this.placeholderValue = 'Enter Search';
487
+ this.rightToLeftOrientation = false;
488
+ this.query = '';
489
+ this.theme = 'light';
490
+ }
491
+ get isLightTheme() {
492
+ return this.theme === 'light';
493
+ }
494
+ handleInputChange(event) {
495
+ const input = event.target;
496
+ this.searchInputChange.emit(input.value);
497
+ }
498
+ handleInputKeyUp(event) {
499
+ const input = event.target;
500
+ this.inputKeyUp.emit(input.value);
501
+ }
502
+ handleClearInput() {
503
+ if (this.clearInput) {
504
+ this.clearInput.emit();
505
+ }
506
+ }
507
+ render() {
508
+ const containerClassName = this.rightToLeftOrientation
509
+ ? 'inputContainerRTL'
510
+ : 'inputContainerLTR';
511
+ const inputClassName = classNames(this.error
512
+ ? this.isLightTheme
513
+ ? 'inputErrorLightRTL'
514
+ : 'inputErrorDarkRTL'
515
+ : this.isLightTheme
516
+ ? 'inputLightLTR'
517
+ : 'inputDarkLTR', 'searchcraft-input');
518
+ const validatedCustomStyles = parseCustomStyles(this.customStyles);
519
+ const placeholderStyle = {
520
+ fontSize: validatedCustomStyles.placeholderFontSize || '16px',
521
+ };
522
+ return (h("div", { key: '0eea589d7f78b4ae830b1950ab193f9c72797625', class: classNames(containerClassName, this.formClassName, 'searchcraft-input-form') }, this.rightToLeftOrientation ? (h(Fragment, null, h("input", { autoComplete: 'off', class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), onKeyUp: this.handleInputKeyUp.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
523
+ #searchcraft-input-id::placeholder {
524
+ font-size: ${placeholderStyle.fontSize};
525
+ }
526
+ `), this.inputCaptionValue && (h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation })), h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }))) : (h(Fragment, null, h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }), h("input", { autoComplete: 'off', class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), onKeyUp: this.handleInputKeyUp.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
527
+ #searchcraft-input-id::placeholder {
528
+ font-size: ${placeholderStyle.fontSize};
529
+ }
530
+ `), this.inputCaptionValue && (h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation }))))));
531
+ }
532
+ };
533
+ SearchcraftInput.style = SearchcraftInputStyle0;
534
+
535
+ const searchcraftInputCaptionModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputCaptionLightLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#404040}.inputCaptionDarkLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#E6E6E6}.inputCaptionErrorLightLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000}.inputCaptionErrorDarkLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3}.inputCaptionLightRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#404040;text-align:right}.inputCaptionDarkRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#E6E6E6;text-align:right}.inputCaptionErrorLightRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000;text-align:right}.inputCaptionErrorDarkRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3;text-align:right}";
536
+ const SearchcraftInputCaptionStyle0 = searchcraftInputCaptionModuleCss;
537
+
538
+ const SearchcraftInputCaption = class {
539
+ constructor(hostRef) {
540
+ registerInstance(this, hostRef);
541
+ this.error = undefined;
542
+ this.inputCaptionClassName = '';
543
+ this.inputCaptionValue = 'Enter Search';
544
+ this.rightToLeftOrientation = false;
545
+ this.theme = 'light';
546
+ }
547
+ isLightTheme() {
548
+ return this.theme === 'light';
549
+ }
550
+ render() {
551
+ return this.rightToLeftOrientation ? (h("p", { class: classNames(this.error
552
+ ? this.isLightTheme
553
+ ? 'inputCaptionErrorLightRTL'
554
+ : 'inputCaptionErrorDarkRTL'
555
+ : this.isLightTheme
556
+ ? 'inputCaptionLightRTL'
557
+ : 'inputCaptionDarkRTL', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue)) : (h("p", { class: classNames(this.error
558
+ ? this.isLightTheme
559
+ ? 'inputCaptionErrorLightLTR'
560
+ : 'inputCaptionErrorDarkLTR'
561
+ : this.isLightTheme
562
+ ? 'inputCaptionLightLTR'
563
+ : 'inputCaptionDarkLTR', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue));
564
+ }
565
+ };
566
+ SearchcraftInputCaption.style = SearchcraftInputCaptionStyle0;
567
+
568
+ const searchcraftInputIconModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputIconLTR{left:15px;position:absolute;top:50%;transform:translateY(-50%)}.inputIconRTL{position:absolute;right:15px;top:50%;transform:translateY(-50%)}";
569
+ const SearchcraftInputIconStyle0 = searchcraftInputIconModuleCss;
570
+
571
+ const SearchcraftInputIcon = class {
572
+ constructor(hostRef) {
573
+ registerInstance(this, hostRef);
574
+ this.error = undefined;
575
+ this.height = 20;
576
+ this.rightToLeftOrientation = false;
577
+ this.width = 20;
578
+ this.theme = 'light';
579
+ }
580
+ isLightTheme() {
581
+ return this.theme === 'light';
582
+ }
583
+ render() {
584
+ return this.error ? (h("div", { class: this.rightToLeftOrientation ? 'inputIconRTL' : 'inputIconLTR' }, this.isLightTheme() ? (h("searchcraft-search-icon-set", { height: this.height, type: 'error-light', width: this.width })) : (h("searchcraft-search-icon-set", { height: this.height, type: 'error-dark', width: this.width })))) : (h("div", { class: this.rightToLeftOrientation ? 'inputIconRTL' : 'inputIconLTR' }, this.isLightTheme() ? (h("searchcraft-search-icon-set", { height: this.height, type: 'search-light', width: this.width })) : (h("searchcraft-search-icon-set", { height: this.height, type: 'search-dark', width: this.width }))));
585
+ }
586
+ };
587
+ SearchcraftInputIcon.style = SearchcraftInputIconStyle0;
588
+
589
+ const searchcraftInputLabelModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.labelLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#292929}.labelDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFF}";
590
+ const SearchcraftInputLabelStyle0 = searchcraftInputLabelModuleCss;
591
+
592
+ const SearchcraftInputLabel = class {
593
+ constructor(hostRef) {
594
+ registerInstance(this, hostRef);
595
+ this.inputLabelClassName = '';
596
+ this.label = undefined;
597
+ this.theme = 'light';
598
+ }
599
+ isLightTheme() {
600
+ return this.theme === 'light';
601
+ }
602
+ render() {
603
+ if (!this.label) {
604
+ return null;
605
+ }
606
+ const labelStyle = this.isLightTheme() ? 'labelLight' : 'labelDark';
607
+ return (h("label", { class: classNames(labelStyle, this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
608
+ }
609
+ };
610
+ SearchcraftInputLabel.style = SearchcraftInputLabelStyle0;
611
+
612
+ const searchcraftResultsInfoModuleCss = ".container{border-bottom:1px solid #D9D9D9;display:flex;justify-content:flex-start;width:100%}.resultsInfo{color:#292929;font-size:18px;font-weight:600;line-height:20px;margin:0;margin-bottom:8px}";
613
+ const SearchcraftResultsInfoStyle0 = searchcraftResultsInfoModuleCss;
614
+
615
+ const SearchcraftResultsInfo = class {
616
+ constructor(hostRef) {
617
+ registerInstance(this, hostRef);
618
+ this.isRequesting = false;
619
+ this.resultsCount = 0;
620
+ this.responseTime = '';
621
+ this.query = '';
622
+ }
623
+ connectedCallback() {
624
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
625
+ var _a, _b, _c, _d;
626
+ this.isRequesting = state.isRequesting;
627
+ this.resultsCount = ((_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.count) || 0;
628
+ this.responseTime = ((((_d = (_c = state.searchResults) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.time_taken) || 0) * 1000).toFixed(2);
629
+ this.query = state.query || ''; // Update query from store
630
+ });
631
+ }
632
+ disconnectedCallback() {
633
+ if (this.unsubscribe) {
634
+ this.unsubscribe();
635
+ }
636
+ }
637
+ render() {
638
+ if (!this.query || this.resultsCount === 0) {
639
+ return null;
640
+ }
641
+ return (h("div", { class: 'container' }, h("p", { class: 'resultsInfo' }, this.resultsCount, " results found in ", this.responseTime, "ms")));
642
+ }
643
+ };
644
+ SearchcraftResultsInfo.style = SearchcraftResultsInfoStyle0;
645
+
646
+ const SearchcraftSearchIconSet = class {
647
+ constructor(hostRef) {
648
+ registerInstance(this, hostRef);
649
+ this.type = 'search-dark';
650
+ this.width = 20;
651
+ this.height = 20;
652
+ }
653
+ render() {
654
+ const { width, height } = this;
655
+ switch (this.type) {
656
+ case 'search-light':
657
+ return (h("svg", { width: width, height: height, viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { id: 'searchcraft-title' }, "Searchcraft Search Icon Light"), h("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: '#404040', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
658
+ case 'search-dark':
659
+ return (h("svg", { width: width, height: height, viewBox: '0 0 18 18', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { id: 'searchcraft-title' }, "Searchcraft Search Icon Dark"), h("path", { d: 'M16.5 16.5L12.875 12.875M14.8333 8.16667C14.8333 11.8486 11.8486 14.8333 8.16667 14.8333C4.48477 14.8333 1.5 11.8486 1.5 8.16667C1.5 4.48477 4.48477 1.5 8.16667 1.5C11.8486 1.5 14.8333 4.48477 14.8333 8.16667Z', stroke: '#E6E6E6', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
660
+ case 'error-light':
661
+ return (h("svg", { width: width, height: height, viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { id: 'searchcraft-title' }, "Searchcraft Error Search Icon Light"), h("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: '#737373', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
662
+ case 'error-dark':
663
+ return (h("svg", { width: width, height: height, viewBox: '0 0 18 18', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { id: 'searchcraft-title' }, "Searchcraft Error Search Icon Dark"), h("path", { d: 'M16.5 16.5L12.875 12.875M14.8333 8.16667C14.8333 11.8486 11.8486 14.8333 8.16667 14.8333C4.48477 14.8333 1.5 11.8486 1.5 8.16667C1.5 4.48477 4.48477 1.5 8.16667 1.5C11.8486 1.5 14.8333 4.48477 14.8333 8.16667Z', stroke: '#BFBFBF', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
664
+ default:
665
+ return null;
666
+ }
667
+ }
668
+ };
669
+
670
+ const searchcraftSliderModuleCss = ".sliderContainer{display:flex;flex-direction:column;gap:10px;font-family:Arial, sans-serif;align-items:center;width:100%}.rangeContainer{display:flex;position:relative;width:100%;align-items:center}.rangeContainer .activeRange{position:absolute;top:50%;transform:translateY(-50%);height:4px;background:#007DB3;z-index:0;border-radius:2px}.rangeContainer .rangeSlider{width:100%;height:4px;background:transparent;border-radius:2px;outline:none;-webkit-appearance:none;appearance:none;position:absolute;margin:0}.rangeContainer .rangeSlider::-webkit-slider-thumb{-webkit-appearance:none;width:20px;height:20px;background-color:#FFF;border-radius:50%;border:2px solid #e6e6e6;cursor:pointer}.rangeContainer .rangeSlider::-moz-range-thumb{width:20px;height:20px;background-color:#FFF;border-radius:50%;border:2px solid #e6e6e6;cursor:pointer}.yearLabels{display:flex;justify-content:space-between;width:100%;margin-top:10px;font-size:15px;font-weight:600;font-family:\"Source Sans Pro\", sans-serif;color:#666}.yearLabel{min-width:30px;text-align:center}";
671
+ const SearchcraftSliderStyle0 = searchcraftSliderModuleCss;
672
+
673
+ const SearchcraftSlider = class {
674
+ constructor(hostRef) {
675
+ registerInstance(this, hostRef);
676
+ this.searchStore = useSearchcraftStore.getState();
677
+ this.updateYears = async () => {
678
+ this.searchStore.setYearsRange([this.startYear, this.endYear]);
679
+ try {
680
+ if (typeof this.query === 'string' && this.query.trim() !== '') {
681
+ await this.searchStore.search();
682
+ }
683
+ else {
684
+ console.warn('Query is missing or empty, skipping search request.');
685
+ }
686
+ }
687
+ catch (error) {
688
+ console.error('Search failed:', error);
689
+ }
690
+ };
691
+ this.handleStartYearChange = (event) => {
692
+ const value = Number.parseInt(event.target.value, 10);
693
+ this.startYear = Math.min(value, this.endYear);
694
+ this.updateYears();
695
+ };
696
+ this.handleEndYearChange = (event) => {
697
+ const value = Number.parseInt(event.target.value, 10);
698
+ this.endYear = Math.max(value, this.startYear);
699
+ this.updateYears();
700
+ };
701
+ this.maxYear = new Date().getFullYear();
702
+ this.minYear = 2014;
703
+ this.endYear = this.maxYear;
704
+ this.hasSearched = false;
705
+ this.query = '';
706
+ this.resultsCount = 0;
707
+ this.startYear = this.minYear;
708
+ }
709
+ componentDidLoad() {
710
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
711
+ var _a, _b, _c;
712
+ if (state.query.length > 0) {
713
+ this.hasSearched = true;
714
+ this.resultsCount = ((_c = (_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
715
+ }
716
+ this.query = state.query;
717
+ });
718
+ }
719
+ disconnectedCallback() {
720
+ if (this.unsubscribe) {
721
+ this.unsubscribe();
722
+ }
723
+ }
724
+ render() {
725
+ if (!this.query || this.resultsCount === 0) {
726
+ return null;
727
+ }
728
+ const rangeMin = this.minYear;
729
+ const rangeMax = this.maxYear;
730
+ const startPercent = ((this.startYear - rangeMin) / (rangeMax - rangeMin)) * 100;
731
+ const endPercent = ((this.endYear - rangeMin) / (rangeMax - rangeMin)) * 100;
732
+ return (h("div", { class: 'sliderContainer' }, h("div", { class: 'rangeContainer' }, h("div", { class: 'activeRange', style: {
733
+ left: `${startPercent}%`,
734
+ width: `${endPercent - startPercent}%`,
735
+ } }), h("input", { class: 'rangeSlider', max: this.maxYear, min: this.minYear, onInput: this.handleStartYearChange, step: '1', type: 'range', value: this.startYear }), h("input", { class: 'rangeSlider', max: this.maxYear, min: this.minYear, onInput: this.handleEndYearChange, step: '1', type: 'range', value: this.endYear })), h("div", { class: 'yearLabels' }, h("span", { class: 'yearLabel' }, this.startYear), h("span", { class: 'yearLabel' }, this.endYear))));
736
+ }
737
+ };
738
+ SearchcraftSlider.style = SearchcraftSliderStyle0;
739
+
740
+ const searchcraftSpinnerDarkModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.spinnerDark{animation:spinning 1s linear infinite;background:conic-gradient(#000 50%, #FFFFFF);clip-path:circle(50%);height:100%;mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);width:100%}.spinnerLight{animation:spinning 1s linear infinite;background:conic-gradient(#737373 50%, #FFFFFF);clip-path:circle(50%);height:100%;mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);width:100%}@keyframes spinning{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}";
741
+ const SearchcraftSpinnerDarkStyle0 = searchcraftSpinnerDarkModuleCss;
742
+
743
+ const SearchcraftSpinnerDark = class {
744
+ constructor(hostRef) {
745
+ registerInstance(this, hostRef);
746
+ }
747
+ render() {
748
+ return (h("div", { key: 'be34b9a3ecec05fdc169145a5db5a4f37bbd404b', class: 'spinnerContainer' }, h("div", { key: 'b59ffd2fe8dd3ac990003bff3085cb571c08730e', class: 'spinnerDark' })));
749
+ }
750
+ };
751
+ SearchcraftSpinnerDark.style = SearchcraftSpinnerDarkStyle0;
752
+
753
+ const searchcraftSpinnerLightModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.spinnerLight{animation:spinning 1s linear infinite;background:conic-gradient(#737373 50%, #FFFFFF);clip-path:circle(50%);height:100%;mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);width:100%}@keyframes spinning{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}";
754
+ const SearchcraftSpinnerLightStyle0 = searchcraftSpinnerLightModuleCss;
755
+
756
+ const SearchcraftSpinnerLight = class {
757
+ constructor(hostRef) {
758
+ registerInstance(this, hostRef);
759
+ }
760
+ render() {
761
+ return (h("div", { key: 'a4f73eee03d4d7253c04c47995315bd121e8ded3', class: 'spinnerContainer' }, h("div", { key: '53e3486ef7a2fa6029a6107bae2c0655b1608a12', class: 'spinnerLight' })));
762
+ }
763
+ };
764
+ SearchcraftSpinnerLight.style = SearchcraftSpinnerLightStyle0;
765
+
766
+ const searchcraftToggleButtonModuleCss = ".toggle-wrapper{background:#ddd;border:none;border-radius:16px;box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05);cursor:pointer;height:26px;margin-left:10px;position:relative;width:44px}.toggle-wrapper.active{background:#007DB3;box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05)}.toggle-wrapper .toggle-switch{background:#fff;border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform 0.3s ease;width:18px}.toggle-wrapper .toggle-switch.active{transform:translateX(16px)}";
767
+ const SearchcraftToggleButtonStyle0 = searchcraftToggleButtonModuleCss;
768
+
769
+ const SearchcraftToggleButton = class {
770
+ constructor(hostRef) {
771
+ registerInstance(this, hostRef);
772
+ this.searchStore = useSearchcraftStore.getState();
773
+ this.handleToggle = async () => {
774
+ this.isActive = !this.isActive;
775
+ if (this.type === 'mode') {
776
+ const mode = this.isActive ? 'normal' : 'fuzzy';
777
+ this.searchStore.setSearchParams({
778
+ mode,
779
+ });
780
+ }
781
+ else if (this.type === 'sort') {
782
+ const sort = this.isActive ? 'desc' : 'asc';
783
+ this.searchStore.setSearchParams({
784
+ sort,
785
+ });
786
+ }
787
+ try {
788
+ await this.searchStore.search();
789
+ }
790
+ catch (error) {
791
+ console.error('Search failed:', error);
792
+ }
793
+ };
794
+ this.type = 'mode';
795
+ this.isActive = false;
796
+ this.query = '';
797
+ this.resultsCount = 0;
798
+ }
799
+ componentDidLoad() {
800
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
801
+ var _a, _b, _c;
802
+ this.query = state.query || '';
803
+ this.resultsCount = ((_c = (_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
804
+ });
805
+ }
806
+ disconnectedCallback() {
807
+ if (this.unsubscribe) {
808
+ this.unsubscribe();
809
+ }
810
+ }
811
+ render() {
812
+ if (!this.query || this.resultsCount === 0) {
813
+ return null;
814
+ }
815
+ return (h("button", { class: `toggle-wrapper ${this.isActive ? 'active' : ''}`, onClick: this.handleToggle, type: 'button' }, h("div", { class: `toggle-switch ${this.isActive ? 'active' : ''}` })));
816
+ }
817
+ };
818
+ SearchcraftToggleButton.style = SearchcraftToggleButtonStyle0;
819
+
820
+ export { SearchcraftAutoSearchForm as searchcraft_auto_search_form, SearchcraftBaseSearchResult as searchcraft_base_search_result, SearchcraftBaseSearchResults as searchcraft_base_search_results, SearchcraftCheckIcon as searchcraft_check_icon, SearchcraftClearIconSet as searchcraft_clear_icon_set, SearchcraftClearInputButton as searchcraft_clear_input_button, SearchcraftDashIcon as searchcraft_dash_icon, SearchcraftErrorMessage as searchcraft_error_message, SearchcraftFiltersList as searchcraft_filters_list, SearchcraftInput as searchcraft_input, SearchcraftInputCaption as searchcraft_input_caption, SearchcraftInputIcon as searchcraft_input_icon, SearchcraftInputLabel as searchcraft_input_label, SearchcraftResultsInfo as searchcraft_results_info, SearchcraftSearchIconSet as searchcraft_search_icon_set, SearchcraftSlider as searchcraft_slider, SearchcraftSpinnerDark as searchcraft_spinner_dark, SearchcraftSpinnerLight as searchcraft_spinner_light, SearchcraftToggleButton as searchcraft_toggle_button };
821
+
822
+ //# sourceMappingURL=searchcraft-auto-search-form_19.entry.js.map