@searchcraft/javascript-sdk 0.2.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) 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 +861 -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/{searchcraft-javascript-sdk/searchcraft-filters-list.entry.js → collection/components/searchcraft-filters-list/searchcraft-filters-list.js} +72 -20
  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 +110 -0
  58. package/dist/collection/components/searchcraft-input/searchcraft-input.js +356 -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 +249 -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 +107 -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-27a6ca57.js +149 -0
  96. package/dist/components/p-27a6ca57.js.map +1 -0
  97. package/dist/components/p-4468fba3.js +61 -0
  98. package/dist/components/p-4468fba3.js.map +1 -0
  99. package/dist/components/p-498c7ef9.js +40 -0
  100. package/dist/components/p-498c7ef9.js.map +1 -0
  101. package/dist/{searchcraft-javascript-sdk/index-d6567b9c.js → components/p-5cdc6210.js} +2 -10
  102. package/dist/components/p-5cdc6210.js.map +1 -0
  103. package/dist/{searchcraft-javascript-sdk/searchcraft-input-caption.entry.js → components/p-6237f03e.js} +31 -10
  104. package/dist/components/p-6237f03e.js.map +1 -0
  105. package/dist/{searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js → components/p-70722ab2.js} +24 -7
  106. package/dist/components/p-70722ab2.js.map +1 -0
  107. package/dist/components/p-7498e493.js +1113 -0
  108. package/dist/components/p-7498e493.js.map +1 -0
  109. package/dist/{searchcraft-javascript-sdk/utils-9f198636.js → components/p-7d1bcd2d.js} +2 -2
  110. package/dist/components/p-7d1bcd2d.js.map +1 -0
  111. package/dist/components/p-8c38185e.js +53 -0
  112. package/dist/components/p-8c38185e.js.map +1 -0
  113. package/dist/{searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js → components/p-a3bd1bc8.js} +26 -7
  114. package/dist/components/p-a3bd1bc8.js.map +1 -0
  115. package/dist/components/p-ae84b899.js +48 -0
  116. package/dist/components/p-ae84b899.js.map +1 -0
  117. package/dist/components/p-bc3f9025.js +33 -0
  118. package/dist/components/p-bc3f9025.js.map +1 -0
  119. package/dist/components/p-bfb22305.js +33 -0
  120. package/dist/components/p-bfb22305.js.map +1 -0
  121. package/dist/{searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js → components/p-c31274dd.js} +37 -8
  122. package/dist/components/p-c31274dd.js.map +1 -0
  123. package/dist/components/p-d3187f5a.js +29 -0
  124. package/dist/components/p-d3187f5a.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/components/searchcraft-auto-search-form.js +221 -0
  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/components/searchcraft-filters-list.js +155 -0
  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} +37 -12
  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} +48 -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 +839 -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-72382d90.entry.js +2 -0
  216. package/dist/searchcraft-javascript-sdk/p-72382d90.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/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +3 -1
  222. package/package.json +1 -1
  223. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js +0 -34
  224. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js.map +0 -1
  225. package/dist/searchcraft-javascript-sdk/index-8211f330.js +0 -3043
  226. package/dist/searchcraft-javascript-sdk/index-8211f330.js.map +0 -1
  227. package/dist/searchcraft-javascript-sdk/index-d6567b9c.js.map +0 -1
  228. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js +0 -127
  229. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js.map +0 -1
  230. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-form.entry.js.map +0 -1
  231. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js.map +0 -1
  232. package/dist/searchcraft-javascript-sdk/searchcraft-button-icon.entry.js.map +0 -1
  233. package/dist/searchcraft-javascript-sdk/searchcraft-button.entry.js.map +0 -1
  234. package/dist/searchcraft-javascript-sdk/searchcraft-check-icon.entry.js.map +0 -1
  235. package/dist/searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js.map +0 -1
  236. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js +0 -30
  237. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js.map +0 -1
  238. package/dist/searchcraft-javascript-sdk/searchcraft-dash-icon.entry.js.map +0 -1
  239. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js +0 -22
  240. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js.map +0 -1
  241. package/dist/searchcraft-javascript-sdk/searchcraft-filters-list.entry.js.map +0 -1
  242. package/dist/searchcraft-javascript-sdk/searchcraft-input-caption.entry.js.map +0 -1
  243. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js +0 -25
  244. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js.map +0 -1
  245. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js +0 -29
  246. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js.map +0 -1
  247. package/dist/searchcraft-javascript-sdk/searchcraft-input.entry.js +0 -74
  248. package/dist/searchcraft-javascript-sdk/searchcraft-input.entry.js.map +0 -1
  249. package/dist/searchcraft-javascript-sdk/searchcraft-results-info.entry.js.map +0 -1
  250. package/dist/searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js.map +0 -1
  251. package/dist/searchcraft-javascript-sdk/searchcraft-slider.entry.js.map +0 -1
  252. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js +0 -17
  253. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js.map +0 -1
  254. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js +0 -17
  255. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js.map +0 -1
  256. package/dist/searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js.map +0 -1
  257. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js +0 -334
  258. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js.map +0 -1
  259. package/dist/searchcraft-javascript-sdk/store-08ee97f6.js +0 -3073
  260. package/dist/searchcraft-javascript-sdk/store-08ee97f6.js.map +0 -1
  261. package/dist/searchcraft-javascript-sdk/utils-9f198636.js.map +0 -1
  262. /package/dist/{searchcraft-javascript-sdk → esm}/app-globals-0f993ce5.js +0 -0
  263. /package/dist/{searchcraft-javascript-sdk → esm}/app-globals-0f993ce5.js.map +0 -0
@@ -0,0 +1,861 @@
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
+ };
28
+ this.handleInputKeyUp = (event) => {
29
+ const target = event.detail;
30
+ if (target === this.query) {
31
+ return;
32
+ }
33
+ this.query = target;
34
+ if (this.debounceTimeout) {
35
+ clearTimeout(this.debounceTimeout);
36
+ }
37
+ this.debounceTimeout = setTimeout(() => {
38
+ if (this.query.trim() === '') {
39
+ this.searchResults = null;
40
+ this.searchStore.setSearchResults(null);
41
+ }
42
+ else {
43
+ this.searchStore.setQuery(this.query);
44
+ this.querySubmit.emit(this.query);
45
+ this.runSearch();
46
+ }
47
+ }, this.debounceDelay);
48
+ };
49
+ this.handleClearInput = () => {
50
+ if (this.query === '' && !this.searchResults) {
51
+ return;
52
+ }
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: '6f59f4b7d525c62fce6b21712519e3880c6756a2', class: `${formClass}`, onSubmit: this.handleFormSubmit }, index.h("searchcraft-input-label", { key: 'cbaa772a365131dbfcffec9e2a28438f1c978efe', label: this.labelForInput }), index.h("searchcraft-input", { key: '70a4933978df3878720e1189a15481123e12eba5', 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: 'd665a04dcc8999a09afa47f1a20156f12db6600c', 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;border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.checkboxLabel input[type=checkbox]:focus{outline:2px solid #007DB3}.checkboxLabel input[type=checkbox]:checked{background-color:#007DB3;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;border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childCheckboxLabel input[type=checkbox]:focus{outline:2px solid #007DB3}.childCheckboxLabel input[type=checkbox]:checked{background-color:#007DB3;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:9px;left:8px}.dashContainer{display:none;height:3px;width:14px;position:absolute;top:3px;left:9px}";
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
+ this.selectedFilters = [...this.selectedFilters, value];
432
+ }
433
+ }
434
+ else {
435
+ this.selectedFilters = isChecked
436
+ ? [...this.selectedFilters, value]
437
+ : this.selectedFilters.filter((filter) => filter !== value);
438
+ }
439
+ this.emitFiltersUpdate();
440
+ }
441
+ emitFiltersUpdate() {
442
+ this.filtersUpdated.emit(this.selectedFilters);
443
+ this.searchStore.setSelectedFilters(this.selectedFilters);
444
+ this.searchStore.search();
445
+ }
446
+ formatLabel(label, count) {
447
+ return `${label.replace(/-/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())} (${count})`;
448
+ }
449
+ render() {
450
+ if (!this.query || this.resultsCount === 0) {
451
+ return null;
452
+ }
453
+ return (index.h("div", { class: 'filtersList' }, this.dynamicFilters.map((filter) => {
454
+ const isChildSelected = filter.children
455
+ ? filter.children.some((child) => this.selectedFilters.includes(child.value))
456
+ : false;
457
+ return (index.h("div", { key: filter.value, class: 'filterItem' }, index.h("label", { class: 'checkboxLabel' }, index.h("input", { checked: this.selectedFilters.includes(filter.value), onChange: (event) => this.handleCheckboxChange(filter.value, event.target.checked, true), type: 'checkbox' }), 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: {
458
+ marginLeft: '20px',
459
+ display: this.selectedFilters.includes(filter.value)
460
+ ? 'flex'
461
+ : 'none',
462
+ } }, 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('/')
463
+ ? child.label.split('/').pop() || child.label
464
+ : child.label, child.count))))))));
465
+ })));
466
+ }
467
+ };
468
+ SearchcraftFiltersList.style = SearchcraftFiltersListStyle0;
469
+
470
+ 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:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.inputLightLTR::placeholder{color:#737373}.inputLightLTR:focus{outline:2px solid #000}.inputDarkLTR{border:none;border-radius:8px;font-family:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.inputDarkLTR::placeholder{color:#BFBFBF}.inputDarkLTR:focus{outline:2px solid #FFF}.inputErrorLightLTR{border:none;border-radius:8px;font-family:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.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:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.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:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.inputLightRTL::placeholder{color:#737373}.inputLightRTL:focus{outline:2px solid #000}.inputDarkRTL{border:none;border-radius:8px;font-family:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.inputDarkRTL::placeholder{color:#BFBFBF}.inputDarkRTL:focus{outline:2px solid #FFF}.inputErrorLightRTL{border:none;border-radius:8px;font-family:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.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:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.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%}";
471
+ const SearchcraftInputStyle0 = searchcraftInputModuleCss;
472
+
473
+ const SearchcraftInput = class {
474
+ constructor(hostRef) {
475
+ index.registerInstance(this, hostRef);
476
+ this.clearInput = index.createEvent(this, "clearInput", 7);
477
+ this.searchInputChange = index.createEvent(this, "searchInputChange", 7);
478
+ this.inputKeyUp = index.createEvent(this, "inputKeyUp", 7);
479
+ this.customStyles = {};
480
+ this.error = false;
481
+ this.formClassName = '';
482
+ this.inputCaptionClassName = '';
483
+ this.inputCaptionValue = '';
484
+ this.inputClassName = '';
485
+ this.inputIconHeight = 20;
486
+ this.inputIconWidth = 20;
487
+ this.isRequesting = false;
488
+ this.placeholderValue = 'Enter Search';
489
+ this.rightToLeftOrientation = false;
490
+ this.query = '';
491
+ this.theme = 'light';
492
+ }
493
+ get isLightTheme() {
494
+ return this.theme === 'light';
495
+ }
496
+ handleInputChange(event) {
497
+ const input = event.target;
498
+ this.searchInputChange.emit(input.value);
499
+ }
500
+ handleInputKeyUp(event) {
501
+ const input = event.target;
502
+ this.inputKeyUp.emit(input.value);
503
+ }
504
+ handleClearInput() {
505
+ if (this.query === '') {
506
+ return;
507
+ }
508
+ this.query = '';
509
+ if (this.clearInput) {
510
+ this.clearInput.emit();
511
+ }
512
+ }
513
+ render() {
514
+ const containerClassName = this.rightToLeftOrientation
515
+ ? 'inputContainerRTL'
516
+ : 'inputContainerLTR';
517
+ const inputClassName = index$1.classNames(this.error
518
+ ? this.isLightTheme
519
+ ? 'inputErrorLightRTL'
520
+ : 'inputErrorDarkRTL'
521
+ : this.isLightTheme
522
+ ? 'inputLightLTR'
523
+ : 'inputDarkLTR', 'searchcraft-input');
524
+ const validatedCustomStyles = store.parseCustomStyles(this.customStyles);
525
+ const placeholderStyle = {
526
+ fontSize: validatedCustomStyles.placeholderFontSize || '16px',
527
+ };
528
+ return (index.h("div", { key: '7047cbe1692a4c8f11232d7f65e00824703d8b50', 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, `
529
+ #searchcraft-input-id::placeholder {
530
+ font-size: ${placeholderStyle.fontSize};
531
+ }
532
+ `), 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, `
533
+ #searchcraft-input-id::placeholder {
534
+ font-size: ${placeholderStyle.fontSize};
535
+ }
536
+ `), 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 }))))));
537
+ }
538
+ };
539
+ SearchcraftInput.style = SearchcraftInputStyle0;
540
+
541
+ 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}";
542
+ const SearchcraftInputCaptionStyle0 = searchcraftInputCaptionModuleCss;
543
+
544
+ const SearchcraftInputCaption = class {
545
+ constructor(hostRef) {
546
+ index.registerInstance(this, hostRef);
547
+ this.error = undefined;
548
+ this.inputCaptionClassName = '';
549
+ this.inputCaptionValue = 'Enter Search';
550
+ this.rightToLeftOrientation = false;
551
+ this.theme = 'light';
552
+ }
553
+ isLightTheme() {
554
+ return this.theme === 'light';
555
+ }
556
+ render() {
557
+ return this.rightToLeftOrientation ? (index.h("p", { class: index$1.classNames(this.error
558
+ ? this.isLightTheme
559
+ ? 'inputCaptionErrorLightRTL'
560
+ : 'inputCaptionErrorDarkRTL'
561
+ : this.isLightTheme
562
+ ? 'inputCaptionLightRTL'
563
+ : 'inputCaptionDarkRTL', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue)) : (index.h("p", { class: index$1.classNames(this.error
564
+ ? this.isLightTheme
565
+ ? 'inputCaptionErrorLightLTR'
566
+ : 'inputCaptionErrorDarkLTR'
567
+ : this.isLightTheme
568
+ ? 'inputCaptionLightLTR'
569
+ : 'inputCaptionDarkLTR', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue));
570
+ }
571
+ };
572
+ SearchcraftInputCaption.style = SearchcraftInputCaptionStyle0;
573
+
574
+ 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%)}";
575
+ const SearchcraftInputIconStyle0 = searchcraftInputIconModuleCss;
576
+
577
+ const SearchcraftInputIcon = class {
578
+ constructor(hostRef) {
579
+ index.registerInstance(this, hostRef);
580
+ this.error = undefined;
581
+ this.height = 20;
582
+ this.rightToLeftOrientation = false;
583
+ this.width = 20;
584
+ this.theme = 'light';
585
+ }
586
+ isLightTheme() {
587
+ return this.theme === 'light';
588
+ }
589
+ render() {
590
+ 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 }))));
591
+ }
592
+ };
593
+ SearchcraftInputIcon.style = SearchcraftInputIconStyle0;
594
+
595
+ 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}";
596
+ const SearchcraftInputLabelStyle0 = searchcraftInputLabelModuleCss;
597
+
598
+ const SearchcraftInputLabel = class {
599
+ constructor(hostRef) {
600
+ index.registerInstance(this, hostRef);
601
+ this.inputLabelClassName = '';
602
+ this.label = undefined;
603
+ this.theme = 'light';
604
+ }
605
+ isLightTheme() {
606
+ return this.theme === 'light';
607
+ }
608
+ render() {
609
+ if (!this.label) {
610
+ return null;
611
+ }
612
+ const labelStyle = this.isLightTheme() ? 'labelLight' : 'labelDark';
613
+ return (index.h("label", { class: index$1.classNames(labelStyle, this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
614
+ }
615
+ };
616
+ SearchcraftInputLabel.style = SearchcraftInputLabelStyle0;
617
+
618
+ 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}";
619
+ const SearchcraftResultsInfoStyle0 = searchcraftResultsInfoModuleCss;
620
+
621
+ const SearchcraftResultsInfo = class {
622
+ constructor(hostRef) {
623
+ index.registerInstance(this, hostRef);
624
+ this.isRequesting = false;
625
+ this.resultsCount = 0;
626
+ this.responseTime = '';
627
+ this.query = '';
628
+ }
629
+ connectedCallback() {
630
+ this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
631
+ var _a, _b, _c, _d;
632
+ this.isRequesting = state.isRequesting;
633
+ this.resultsCount = ((_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.count) || 0;
634
+ 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);
635
+ this.query = state.query || ''; // Update query from store
636
+ });
637
+ }
638
+ disconnectedCallback() {
639
+ if (this.unsubscribe) {
640
+ this.unsubscribe();
641
+ }
642
+ }
643
+ render() {
644
+ if (!this.query || this.resultsCount === 0) {
645
+ return null;
646
+ }
647
+ return (index.h("div", { class: 'container' }, index.h("p", { class: 'resultsInfo' }, this.resultsCount, " results found in ", this.responseTime, "ms")));
648
+ }
649
+ };
650
+ SearchcraftResultsInfo.style = SearchcraftResultsInfoStyle0;
651
+
652
+ const SearchcraftSearchIconSet = class {
653
+ constructor(hostRef) {
654
+ index.registerInstance(this, hostRef);
655
+ this.type = 'search-dark';
656
+ this.width = 20;
657
+ this.height = 20;
658
+ }
659
+ render() {
660
+ const { width, height } = this;
661
+ switch (this.type) {
662
+ case 'search-light':
663
+ 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' })));
664
+ case 'search-dark':
665
+ 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' })));
666
+ case 'error-light':
667
+ 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' })));
668
+ case 'error-dark':
669
+ 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' })));
670
+ default:
671
+ return null;
672
+ }
673
+ }
674
+ };
675
+
676
+ 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{background:#007DB3;border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.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}";
677
+ const SearchcraftSliderStyle0 = searchcraftSliderModuleCss;
678
+
679
+ const SearchcraftSlider = class {
680
+ constructor(hostRef) {
681
+ index.registerInstance(this, hostRef);
682
+ this.searchStore = store.useSearchcraftStore.getState();
683
+ this.updateYears = async () => {
684
+ this.searchStore.setYearsRange([this.startYear, this.endYear]);
685
+ try {
686
+ if (typeof this.query === 'string' && this.query.trim() !== '') {
687
+ await this.searchStore.search();
688
+ }
689
+ else {
690
+ console.warn('Query is missing or empty, skipping search request.');
691
+ }
692
+ }
693
+ catch (error) {
694
+ console.error('Search failed:', error);
695
+ }
696
+ };
697
+ this.handleStartYearChange = (event) => {
698
+ const value = Number.parseInt(event.target.value, 10);
699
+ this.startYear = Math.min(value, this.endYear);
700
+ this.updateYears();
701
+ };
702
+ this.handleEndYearChange = (event) => {
703
+ const value = Number.parseInt(event.target.value, 10);
704
+ this.endYear = Math.max(value, this.startYear);
705
+ this.updateYears();
706
+ };
707
+ this.maxYear = new Date().getFullYear();
708
+ this.minYear = 2014;
709
+ this.endYear = this.maxYear;
710
+ this.hasSearched = false;
711
+ this.query = '';
712
+ this.resultsCount = 0;
713
+ this.startYear = this.minYear;
714
+ }
715
+ componentDidLoad() {
716
+ this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
717
+ var _a, _b, _c;
718
+ if (state.query.length > 0) {
719
+ this.hasSearched = true;
720
+ 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;
721
+ }
722
+ this.query = state.query;
723
+ });
724
+ }
725
+ disconnectedCallback() {
726
+ if (this.unsubscribe) {
727
+ this.unsubscribe();
728
+ }
729
+ }
730
+ render() {
731
+ if (!this.query || this.resultsCount === 0) {
732
+ return null;
733
+ }
734
+ const rangeMin = this.minYear;
735
+ const rangeMax = this.maxYear;
736
+ const startPercent = ((this.startYear - rangeMin) / (rangeMax - rangeMin)) * 100;
737
+ const endPercent = ((this.endYear - rangeMin) / (rangeMax - rangeMin)) * 100;
738
+ return (index.h("div", { class: 'sliderContainer' }, index.h("div", { class: 'rangeContainer' }, index.h("div", { class: 'activeRange', style: {
739
+ left: `${startPercent}%`,
740
+ width: `${endPercent - startPercent}%`,
741
+ } }), 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))));
742
+ }
743
+ };
744
+ SearchcraftSlider.style = SearchcraftSliderStyle0;
745
+
746
+ 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)}}";
747
+ const SearchcraftSpinnerDarkStyle0 = searchcraftSpinnerDarkModuleCss;
748
+
749
+ const SearchcraftSpinnerDark = class {
750
+ constructor(hostRef) {
751
+ index.registerInstance(this, hostRef);
752
+ }
753
+ render() {
754
+ return (index.h("div", { key: 'be34b9a3ecec05fdc169145a5db5a4f37bbd404b', class: 'spinnerContainer' }, index.h("div", { key: 'b59ffd2fe8dd3ac990003bff3085cb571c08730e', class: 'spinnerDark' })));
755
+ }
756
+ };
757
+ SearchcraftSpinnerDark.style = SearchcraftSpinnerDarkStyle0;
758
+
759
+ 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)}}";
760
+ const SearchcraftSpinnerLightStyle0 = searchcraftSpinnerLightModuleCss;
761
+
762
+ const SearchcraftSpinnerLight = class {
763
+ constructor(hostRef) {
764
+ index.registerInstance(this, hostRef);
765
+ }
766
+ render() {
767
+ return (index.h("div", { key: 'a4f73eee03d4d7253c04c47995315bd121e8ded3', class: 'spinnerContainer' }, index.h("div", { key: '53e3486ef7a2fa6029a6107bae2c0655b1608a12', class: 'spinnerLight' })));
768
+ }
769
+ };
770
+ SearchcraftSpinnerLight.style = SearchcraftSpinnerLightStyle0;
771
+
772
+ 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)}";
773
+ const SearchcraftToggleButtonStyle0 = searchcraftToggleButtonModuleCss;
774
+
775
+ const SearchcraftToggleButton = class {
776
+ constructor(hostRef) {
777
+ index.registerInstance(this, hostRef);
778
+ this.autoSearchFormElement = null;
779
+ this.searchStore = store.useSearchcraftStore.getState();
780
+ this.handleSearchRequest = () => {
781
+ this.isActive = false;
782
+ this.searchStore.setSearchParams({
783
+ mode: 'fuzzy',
784
+ sort: 'asc',
785
+ });
786
+ };
787
+ this.handleToggle = async () => {
788
+ this.isActive = !this.isActive;
789
+ if (this.type === 'mode') {
790
+ const mode = this.isActive ? 'normal' : 'fuzzy';
791
+ this.searchStore.setSearchParams({
792
+ mode,
793
+ });
794
+ }
795
+ else if (this.type === 'sort') {
796
+ const sort = this.isActive ? 'desc' : 'asc';
797
+ this.searchStore.setSearchParams({
798
+ sort,
799
+ });
800
+ }
801
+ try {
802
+ await this.searchStore.search();
803
+ }
804
+ catch (error) {
805
+ console.error('Search failed:', error);
806
+ }
807
+ };
808
+ this.type = 'mode';
809
+ this.isActive = false;
810
+ this.query = '';
811
+ this.resultsCount = 0;
812
+ }
813
+ componentDidLoad() {
814
+ this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
815
+ var _a, _b, _c;
816
+ this.query = state.query || '';
817
+ 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;
818
+ });
819
+ this.autoSearchFormElement = document.querySelector('searchcraft-auto-search-form');
820
+ if (this.autoSearchFormElement) {
821
+ this.autoSearchFormElement.addEventListener('querySubmit', this.handleSearchRequest);
822
+ }
823
+ }
824
+ disconnectedCallback() {
825
+ if (this.unsubscribe) {
826
+ this.unsubscribe();
827
+ }
828
+ if (this.autoSearchFormElement) {
829
+ this.autoSearchFormElement.addEventListener('querySubmit', this.handleSearchRequest);
830
+ }
831
+ }
832
+ render() {
833
+ if (!this.query || this.resultsCount === 0) {
834
+ return null;
835
+ }
836
+ return (index.h("button", { class: `toggle-wrapper ${this.isActive ? 'active' : ''}`, onClick: this.handleToggle, type: 'button' }, index.h("div", { class: `toggle-switch ${this.isActive ? 'active' : ''}` })));
837
+ }
838
+ };
839
+ SearchcraftToggleButton.style = SearchcraftToggleButtonStyle0;
840
+
841
+ exports.searchcraft_auto_search_form = SearchcraftAutoSearchForm;
842
+ exports.searchcraft_base_search_result = SearchcraftBaseSearchResult;
843
+ exports.searchcraft_base_search_results = SearchcraftBaseSearchResults;
844
+ exports.searchcraft_check_icon = SearchcraftCheckIcon;
845
+ exports.searchcraft_clear_icon_set = SearchcraftClearIconSet;
846
+ exports.searchcraft_clear_input_button = SearchcraftClearInputButton;
847
+ exports.searchcraft_dash_icon = SearchcraftDashIcon;
848
+ exports.searchcraft_error_message = SearchcraftErrorMessage;
849
+ exports.searchcraft_filters_list = SearchcraftFiltersList;
850
+ exports.searchcraft_input = SearchcraftInput;
851
+ exports.searchcraft_input_caption = SearchcraftInputCaption;
852
+ exports.searchcraft_input_icon = SearchcraftInputIcon;
853
+ exports.searchcraft_input_label = SearchcraftInputLabel;
854
+ exports.searchcraft_results_info = SearchcraftResultsInfo;
855
+ exports.searchcraft_search_icon_set = SearchcraftSearchIconSet;
856
+ exports.searchcraft_slider = SearchcraftSlider;
857
+ exports.searchcraft_spinner_dark = SearchcraftSpinnerDark;
858
+ exports.searchcraft_spinner_light = SearchcraftSpinnerLight;
859
+ exports.searchcraft_toggle_button = SearchcraftToggleButton;
860
+
861
+ //# sourceMappingURL=searchcraft-auto-search-form_19.cjs.entry.js.map