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