@searchcraft/javascript-sdk 0.2.3 → 0.2.5

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 (269) 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 +17 -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_17.cjs.entry.js +809 -0
  12. package/dist/cjs/searchcraft-auto-search-form_17.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-c44c58ab.js +314 -0
  22. package/dist/cjs/store-c44c58ab.js.map +1 -0
  23. package/dist/{searchcraft-javascript-sdk/utils-6d98c145.js → cjs/utils-2dc6115c.js} +22 -5
  24. package/dist/cjs/utils-2dc6115c.js.map +1 -0
  25. package/dist/collection/assets/searchcraft-button-icons.js +9 -0
  26. package/dist/collection/assets/searchcraft-button-icons.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/collection/assets/searchcraft-search-icon-set.js +84 -0
  30. package/dist/collection/assets/searchcraft-search-icon-set.js.map +1 -0
  31. package/dist/collection/collection-manifest.json +31 -0
  32. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +365 -0
  33. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -0
  34. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.module.css +15 -0
  35. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js +168 -0
  36. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js.map +1 -0
  37. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.module.css +18 -0
  38. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +329 -0
  39. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -0
  40. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +214 -0
  41. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +270 -0
  42. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -0
  43. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +47 -0
  44. package/dist/collection/components/searchcraft-button/searchcraft-button.js +137 -0
  45. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -0
  46. package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +82 -0
  47. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js +95 -0
  48. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js.map +1 -0
  49. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.module.css +33 -0
  50. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +64 -0
  51. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -0
  52. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +21 -0
  53. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +170 -0
  54. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +1 -0
  55. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +70 -0
  56. package/dist/collection/components/searchcraft-input/searchcraft-input.js +352 -0
  57. package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +1 -0
  58. package/dist/collection/components/searchcraft-input/searchcraft-input.module.css +241 -0
  59. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js +122 -0
  60. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js.map +1 -0
  61. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.module.css +79 -0
  62. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js +109 -0
  63. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js.map +1 -0
  64. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.module.css +17 -0
  65. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +76 -0
  66. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -0
  67. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +21 -0
  68. package/dist/{searchcraft-javascript-sdk/searchcraft-results-info.entry.js → collection/components/searchcraft-results-info/searchcraft-results-info.js} +26 -15
  69. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -0
  70. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +15 -0
  71. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +128 -0
  72. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -0
  73. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +68 -0
  74. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js +19 -0
  75. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js.map +1 -0
  76. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.module.css +35 -0
  77. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js +19 -0
  78. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js.map +1 -0
  79. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.module.css +26 -0
  80. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +92 -0
  81. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -0
  82. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +31 -0
  83. package/dist/collection/index.js +12 -0
  84. package/dist/collection/index.js.map +1 -0
  85. package/dist/collection/provider/store.js +96 -0
  86. package/dist/collection/provider/store.js.map +1 -0
  87. package/dist/collection/utils/utils.js +74 -0
  88. package/dist/collection/utils/utils.js.map +1 -0
  89. package/dist/components/index.js +58 -0
  90. package/dist/components/index.js.map +1 -0
  91. package/dist/components/p-157e5b1a.js +310 -0
  92. package/dist/components/p-157e5b1a.js.map +1 -0
  93. package/dist/components/p-1c377190.js +67 -0
  94. package/dist/components/p-1c377190.js.map +1 -0
  95. package/dist/components/p-25f18f2e.js +33 -0
  96. package/dist/components/p-25f18f2e.js.map +1 -0
  97. package/dist/{searchcraft-javascript-sdk/utils-dbb6302b.js → components/p-2bda632c.js} +13 -2
  98. package/dist/components/p-2bda632c.js.map +1 -0
  99. package/dist/components/p-3fece4e2.js +33 -0
  100. package/dist/components/p-3fece4e2.js.map +1 -0
  101. package/dist/components/p-576f0d2b.js +61 -0
  102. package/dist/components/p-576f0d2b.js.map +1 -0
  103. package/dist/{searchcraft-javascript-sdk/index-d6567b9c.js → components/p-5cdc6210.js} +2 -10
  104. package/dist/components/p-5cdc6210.js.map +1 -0
  105. package/dist/{searchcraft-javascript-sdk/searchcraft-input-caption.entry.js → components/p-6237f03e.js} +31 -10
  106. package/dist/components/p-6237f03e.js.map +1 -0
  107. package/dist/{searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js → components/p-70722ab2.js} +24 -7
  108. package/dist/components/p-70722ab2.js.map +1 -0
  109. package/dist/components/p-7498e493.js +1113 -0
  110. package/dist/components/p-7498e493.js.map +1 -0
  111. package/dist/components/p-848301b7.js +40 -0
  112. package/dist/components/p-848301b7.js.map +1 -0
  113. package/dist/components/p-8c38185e.js +53 -0
  114. package/dist/components/p-8c38185e.js.map +1 -0
  115. package/dist/{searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js → components/p-a3bd1bc8.js} +26 -7
  116. package/dist/components/p-a3bd1bc8.js.map +1 -0
  117. package/dist/components/p-ae84b899.js +48 -0
  118. package/dist/components/p-ae84b899.js.map +1 -0
  119. package/dist/{searchcraft-javascript-sdk/searchcraft-input.entry.js → components/p-b5f97e04.js} +83 -12
  120. package/dist/components/p-b5f97e04.js.map +1 -0
  121. package/dist/components/p-bdf281cc.js +89 -0
  122. package/dist/components/p-bdf281cc.js.map +1 -0
  123. package/dist/components/searchcraft-auto-search-form.js +207 -0
  124. package/dist/components/searchcraft-auto-search-form.js.map +1 -0
  125. package/dist/components/searchcraft-base-search-form.js +152 -0
  126. package/dist/components/searchcraft-base-search-form.js.map +1 -0
  127. package/dist/components/searchcraft-base-search-result.js +8 -0
  128. package/dist/components/searchcraft-base-search-result.js.map +1 -0
  129. package/dist/{searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js → components/searchcraft-base-search-results.js} +55 -12
  130. package/dist/components/searchcraft-base-search-results.js.map +1 -0
  131. package/dist/components/searchcraft-button-icon.js +32 -0
  132. package/dist/components/searchcraft-button-icon.js.map +1 -0
  133. package/dist/components/searchcraft-button.js +8 -0
  134. package/dist/components/searchcraft-button.js.map +1 -0
  135. package/dist/components/searchcraft-clear-icon-set.js +8 -0
  136. package/dist/components/searchcraft-clear-icon-set.js.map +1 -0
  137. package/dist/components/searchcraft-clear-input-button.js +8 -0
  138. package/dist/components/searchcraft-clear-input-button.js.map +1 -0
  139. package/dist/components/searchcraft-error-message.js +8 -0
  140. package/dist/components/searchcraft-error-message.js.map +1 -0
  141. package/dist/components/searchcraft-filters-list.js +141 -0
  142. package/dist/components/searchcraft-filters-list.js.map +1 -0
  143. package/dist/components/searchcraft-input-caption.js +8 -0
  144. package/dist/components/searchcraft-input-caption.js.map +1 -0
  145. package/dist/components/searchcraft-input-icon.js +8 -0
  146. package/dist/components/searchcraft-input-icon.js.map +1 -0
  147. package/dist/components/searchcraft-input-label.js +8 -0
  148. package/dist/components/searchcraft-input-label.js.map +1 -0
  149. package/dist/components/searchcraft-input.js +8 -0
  150. package/dist/components/searchcraft-input.js.map +1 -0
  151. package/dist/components/searchcraft-results-info.js +63 -0
  152. package/dist/components/searchcraft-results-info.js.map +1 -0
  153. package/dist/components/searchcraft-search-icon-set.js +8 -0
  154. package/dist/components/searchcraft-search-icon-set.js.map +1 -0
  155. package/dist/{searchcraft-javascript-sdk/searchcraft-slider.entry.js → components/searchcraft-slider.js} +36 -10
  156. package/dist/components/searchcraft-slider.js.map +1 -0
  157. package/dist/components/searchcraft-spinner-dark.js +8 -0
  158. package/dist/components/searchcraft-spinner-dark.js.map +1 -0
  159. package/dist/components/searchcraft-spinner-light.js +8 -0
  160. package/dist/components/searchcraft-spinner-light.js.map +1 -0
  161. package/dist/{searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js → components/searchcraft-toggle-button.js} +33 -10
  162. package/dist/components/searchcraft-toggle-button.js.map +1 -0
  163. package/dist/esm/index-0ac5bb53.js +1251 -0
  164. package/dist/esm/index-0ac5bb53.js.map +1 -0
  165. package/dist/esm/index-72ac5051.js +82 -0
  166. package/dist/esm/index-72ac5051.js.map +1 -0
  167. package/dist/esm/index.js +4 -0
  168. package/dist/esm/index.js.map +1 -0
  169. package/dist/esm/loader.js +13 -0
  170. package/dist/esm/loader.js.map +1 -0
  171. package/dist/esm/searchcraft-auto-search-form_17.entry.js +789 -0
  172. package/dist/esm/searchcraft-auto-search-form_17.entry.js.map +1 -0
  173. package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-base-search-form.entry.js +5 -5
  174. package/dist/esm/searchcraft-base-search-form.entry.js.map +1 -0
  175. package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-button-icon.entry.js +1 -1
  176. package/dist/esm/searchcraft-button-icon.entry.js.map +1 -0
  177. package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-button.entry.js +4 -4
  178. package/dist/esm/searchcraft-button.entry.js.map +1 -0
  179. package/dist/esm/searchcraft-javascript-sdk.js +22 -0
  180. package/dist/esm/searchcraft-javascript-sdk.js.map +1 -0
  181. package/dist/esm/store-9e0b0710.js +310 -0
  182. package/dist/esm/store-9e0b0710.js.map +1 -0
  183. package/dist/{searchcraft-javascript-sdk/utils-d88ac15c.js → esm/utils-a3373179.js} +14 -3
  184. package/dist/esm/utils-a3373179.js.map +1 -0
  185. package/dist/index.cjs.js +1 -0
  186. package/dist/index.js +1 -0
  187. package/dist/loader/cdn.js +1 -0
  188. package/dist/loader/index.cjs.js +1 -0
  189. package/dist/loader/index.d.ts +24 -0
  190. package/dist/loader/index.es2017.js +1 -0
  191. package/dist/loader/index.js +2 -0
  192. package/dist/loader/package.json +11 -0
  193. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -14
  194. package/dist/searchcraft-javascript-sdk/index.esm.js.map +1 -1
  195. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js +3 -0
  196. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js.map +1 -0
  197. package/dist/searchcraft-javascript-sdk/p-2bda632c.js +2 -0
  198. package/dist/searchcraft-javascript-sdk/p-2bda632c.js.map +1 -0
  199. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js +7 -0
  200. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js.map +1 -0
  201. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js +2 -0
  202. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js.map +1 -0
  203. package/dist/searchcraft-javascript-sdk/p-63b3b565.entry.js +2 -0
  204. package/dist/searchcraft-javascript-sdk/p-63b3b565.entry.js.map +1 -0
  205. package/dist/searchcraft-javascript-sdk/p-901fee50.js +11 -0
  206. package/dist/searchcraft-javascript-sdk/p-901fee50.js.map +1 -0
  207. package/dist/searchcraft-javascript-sdk/p-cc454542.entry.js +2 -0
  208. package/dist/searchcraft-javascript-sdk/p-cc454542.entry.js.map +1 -0
  209. package/dist/searchcraft-javascript-sdk/p-cc9a02ef.entry.js +2 -0
  210. package/dist/searchcraft-javascript-sdk/p-cc9a02ef.entry.js.map +1 -0
  211. package/dist/searchcraft-javascript-sdk/p-e1255160.js +2 -0
  212. package/dist/searchcraft-javascript-sdk/p-e1255160.js.map +1 -0
  213. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -48
  214. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  215. package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +1 -0
  216. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +1 -0
  217. package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +1 -5
  218. package/dist/types/components.d.ts +4 -0
  219. package/dist/types/utils/utils.d.ts +11 -0
  220. package/package.json +1 -1
  221. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js +0 -34
  222. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js.map +0 -1
  223. package/dist/searchcraft-javascript-sdk/index-8211f330.js +0 -3043
  224. package/dist/searchcraft-javascript-sdk/index-8211f330.js.map +0 -1
  225. package/dist/searchcraft-javascript-sdk/index-d6567b9c.js.map +0 -1
  226. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js +0 -113
  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 +0 -57
  230. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js.map +0 -1
  231. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-results.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-clear-icon-set.entry.js.map +0 -1
  235. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js +0 -30
  236. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.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 +0 -99
  240. package/dist/searchcraft-javascript-sdk/searchcraft-filters-list.entry.js.map +0 -1
  241. package/dist/searchcraft-javascript-sdk/searchcraft-input-caption.entry.js.map +0 -1
  242. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js +0 -25
  243. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js.map +0 -1
  244. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js +0 -29
  245. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js.map +0 -1
  246. package/dist/searchcraft-javascript-sdk/searchcraft-input.entry.js.map +0 -1
  247. package/dist/searchcraft-javascript-sdk/searchcraft-results-info.entry.js.map +0 -1
  248. package/dist/searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js.map +0 -1
  249. package/dist/searchcraft-javascript-sdk/searchcraft-slider.entry.js.map +0 -1
  250. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js +0 -17
  251. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js.map +0 -1
  252. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js +0 -17
  253. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js.map +0 -1
  254. package/dist/searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js.map +0 -1
  255. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js +0 -334
  256. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js.map +0 -1
  257. package/dist/searchcraft-javascript-sdk/store-0451a982.js +0 -3070
  258. package/dist/searchcraft-javascript-sdk/store-0451a982.js.map +0 -1
  259. package/dist/searchcraft-javascript-sdk/store-18b7e3ea.js +0 -3071
  260. package/dist/searchcraft-javascript-sdk/store-18b7e3ea.js.map +0 -1
  261. package/dist/searchcraft-javascript-sdk/store-910b9836.js +0 -3071
  262. package/dist/searchcraft-javascript-sdk/store-910b9836.js.map +0 -1
  263. package/dist/searchcraft-javascript-sdk/store-935525f8.js +0 -3071
  264. package/dist/searchcraft-javascript-sdk/store-935525f8.js.map +0 -1
  265. package/dist/searchcraft-javascript-sdk/utils-6d98c145.js.map +0 -1
  266. package/dist/searchcraft-javascript-sdk/utils-d88ac15c.js.map +0 -1
  267. package/dist/searchcraft-javascript-sdk/utils-dbb6302b.js.map +0 -1
  268. /package/dist/{searchcraft-javascript-sdk → esm}/app-globals-0f993ce5.js +0 -0
  269. /package/dist/{searchcraft-javascript-sdk → esm}/app-globals-0f993ce5.js.map +0 -0
@@ -0,0 +1,809 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-6c5282a0.js');
6
+ const store = require('./store-c44c58ab.js');
7
+ const utils = require('./utils-2dc6115c.js');
8
+ const index$1 = require('./index-5b0b9d4c.js');
9
+
10
+ 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%}";
11
+ const SearchcraftAutoSearchFormStyle0 = searchcraftAutoSearchFormModuleCss;
12
+
13
+ const SearchcraftAutoSearchForm = class {
14
+ constructor(hostRef) {
15
+ index.registerInstance(this, hostRef);
16
+ this.inputClearedOrNoResults = index.createEvent(this, "inputClearedOrNoResults", 7);
17
+ this.querySubmit = index.createEvent(this, "querySubmit", 7);
18
+ this.debounceTimeout = null;
19
+ this.debounceDelay = 0;
20
+ this.searchStore = store.useSearchcraftStore.getState();
21
+ this.handleInputChange = (event) => {
22
+ this.query = event.detail;
23
+ this.searchStore.setQuery(this.query);
24
+ this.querySubmit.emit(this.query);
25
+ };
26
+ this.handleInputKeyUp = (event) => {
27
+ const target = event.detail;
28
+ this.query = target;
29
+ this.searchStore.setQuery(this.query);
30
+ this.querySubmit.emit(this.query);
31
+ if (this.debounceTimeout) {
32
+ clearTimeout(this.debounceTimeout);
33
+ }
34
+ this.debounceTimeout = setTimeout(() => {
35
+ this.query.trim() !== '' && this.runSearch();
36
+ }, this.debounceDelay);
37
+ };
38
+ this.handleClearInput = () => {
39
+ this.query = '';
40
+ this.searchStore.setQuery('');
41
+ if (typeof this.clearInput === 'function') {
42
+ this.clearInput();
43
+ }
44
+ if (this.debounceTimeout) {
45
+ clearTimeout(this.debounceTimeout);
46
+ }
47
+ this.error = false;
48
+ this.inputClearedOrNoResults.emit();
49
+ };
50
+ this.runSearch = async () => {
51
+ if (this.query.trim() === '') {
52
+ this.error = true;
53
+ this.inputClearedOrNoResults.emit();
54
+ }
55
+ else {
56
+ this.error = false;
57
+ this.searchStore.setQuery(this.query);
58
+ try {
59
+ await this.searchStore.search();
60
+ }
61
+ catch (error) {
62
+ this.error = true;
63
+ this.inputClearedOrNoResults.emit();
64
+ }
65
+ }
66
+ };
67
+ this.handleFormSubmit = async (event) => {
68
+ event.preventDefault();
69
+ await this.runSearch();
70
+ };
71
+ this.autoSearchFormClass = '';
72
+ this.clearInput = () => { };
73
+ this.config = {
74
+ apiKey: '',
75
+ endpointURL: '',
76
+ index: [],
77
+ };
78
+ this.customStylesForInput = {};
79
+ this.inputCaptionValue = '';
80
+ this.inputIconHeight = 20;
81
+ this.inputIconWidth = 20;
82
+ this.labelForInput = '';
83
+ this.placeholderValue = 'Search here';
84
+ this.rightToLeftOrientation = false;
85
+ this.searchContainerClass = '';
86
+ this.error = false;
87
+ this.isRequesting = false;
88
+ this.query = '';
89
+ this.searchResults = null;
90
+ }
91
+ componentDidLoad() {
92
+ const searchcraft = new store.g(this.config);
93
+ this.searchStore.initialize(searchcraft, true);
94
+ this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
95
+ this.isRequesting = state.isRequesting;
96
+ this.searchResults = Object.assign({}, state.searchResults);
97
+ });
98
+ }
99
+ disconnectedCallback() {
100
+ if (this.unsubscribe) {
101
+ this.unsubscribe();
102
+ }
103
+ }
104
+ render() {
105
+ var _a, _b, _c;
106
+ const formClass = this.rightToLeftOrientation ? 'formRTL' : 'formLTR';
107
+ const parsedCustomStyles = utils.parseCustomStyles(this.customStylesForInput);
108
+ if (this.query.length > 0 && ((_c = (_b = (_a = this.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) {
109
+ this.inputClearedOrNoResults.emit();
110
+ }
111
+ return (index.h("form", { key: '1ecc90be4b39c7fbfff4a3c89c319343f6478a1e', class: `${formClass}`, onSubmit: this.handleFormSubmit }, index.h("searchcraft-input-label", { key: '82ee01912536de6a11e20f7df533856a41ebc343', label: this.labelForInput }), index.h("searchcraft-input", { key: 'ad00322933a20db2865cd79241056f7b0ee84a15', 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: '588a134a1130d3c4e4fc921b09450268057b8217', errorMessage: 'Please enter a search query.' }))));
112
+ }
113
+ };
114
+ SearchcraftAutoSearchForm.style = SearchcraftAutoSearchFormStyle0;
115
+
116
+ 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;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;color:#FFF}.subheadingLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#737373}.subheadingDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;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;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}";
117
+ const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
118
+
119
+ const SearchcraftBaseSearchResult = class {
120
+ constructor(hostRef) {
121
+ index.registerInstance(this, hostRef);
122
+ this.buttonCallback = index.createEvent(this, "buttonCallback", 7);
123
+ this.keyDownCallback = index.createEvent(this, "keyDownCallback", 7);
124
+ this.resultCallback = index.createEvent(this, "resultCallback", 7);
125
+ this.buttonCallback = () => { }; // Callback for button click
126
+ this.keyDownCallback = () => { }; // Callback for key down event
127
+ this.resultCallback = () => { }; // Callback for result container click
128
+ this.handleButtonClick = () => {
129
+ this.buttonCallback();
130
+ };
131
+ this.handleContainerClick = () => {
132
+ if (this.isInteractive) {
133
+ this.resultCallback();
134
+ }
135
+ };
136
+ this.buttonText = '';
137
+ this.customStyles = '{}';
138
+ this.headingText = '';
139
+ this.imageDescription = '';
140
+ this.imageSource = '';
141
+ this.isInteractive = false;
142
+ this.primaryContent = '';
143
+ this.secondaryContent = '';
144
+ this.subheadingText = '';
145
+ this.tertiaryContent = '';
146
+ this.themeMode = 'light';
147
+ this.placeImageRight = false;
148
+ }
149
+ parseStyles() {
150
+ try {
151
+ return JSON.parse(this.customStyles);
152
+ }
153
+ catch (error) {
154
+ console.error('Error parsing custom styles:', error);
155
+ return {};
156
+ }
157
+ }
158
+ render() {
159
+ const isLightTheme = this.themeMode === 'light';
160
+ const styles = this.parseStyles();
161
+ const imageContainer = (index.h("div", { key: '83bd0ac730469f4004ac4024c749cd66edfbf7c7', class: 'imageContainer' }, index.h("img", { key: 'e379c01b45808499d6ac78557294e9c408b1734f', alt: this.imageDescription, class: isLightTheme ? 'imageLight' : 'imageDark', src: this.imageSource, style: styles.image || {} })));
162
+ const contentContainer = (index.h("div", { key: '1847892cef75ecb2179178ec17217376c523b1b2', class: 'contentContainer' }, index.h("h2", { key: '16f6c8dac748fa2b99575eb4b8bcf217a7452ea0', class: isLightTheme ? 'headingLight' : 'headingDark', style: styles.heading || {} }, this.headingText), index.h("h3", { key: '3539e9fc9b2e567d5cb088b4ae77307f03fb47d1', class: isLightTheme ? 'subheadingLight' : 'subheadingDark', style: styles.subheading || {} }, this.subheadingText), index.h("p", { key: '20beff8ed55ca1c18cef587f4306b50829c81775', class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark', style: styles.primaryContent || {} }, this.primaryContent), index.h("div", { key: 'd79107bd79de978f64906db23aa14c533132f369', class: 'secondaryContentContainer' }, index.h("p", { key: '978f7176d8fa3372a1360a516640d8334ffe9612', class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark', style: styles.secondaryContent || {} }, this.secondaryContent), index.h("p", { key: '08e70740d73f78ef10769f882ac4ddf80545fac2', class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark', style: styles.tertiaryContent || {} }, this.tertiaryContent)), this.buttonText && (index.h("button", { key: '3f3bfe27e824829e86764445ad9c0cd66bfeae92', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText))));
163
+ return (index.h("div", { key: 'f6dc4ad85634cef131ffc85d574ef35a862f9d77', class: this.isInteractive
164
+ ? isLightTheme
165
+ ? 'interactiveResultContainerLight'
166
+ : 'interactiveResultContainerDark'
167
+ : '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))));
168
+ }
169
+ };
170
+ SearchcraftBaseSearchResult.style = SearchcraftBaseSearchResultStyle0;
171
+
172
+ 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}";
173
+ const SearchcraftBaseSearchResultsStyle0 = searchcraftBaseSearchResultsModuleCss;
174
+
175
+ const SearchcraftBaseSearchResults = class {
176
+ constructor(hostRef) {
177
+ index.registerInstance(this, hostRef);
178
+ this.adInterval = 4;
179
+ this.customStylesForResults = {};
180
+ this.documentAttributesForDisplay = '';
181
+ this.fallbackElement = null;
182
+ this.formatTime = true;
183
+ this.placeAdAtEnd = false;
184
+ this.placeAdAtStart = true;
185
+ this.placeResultImageRight = false;
186
+ this.hasSearched = false;
187
+ this.query = '';
188
+ this.searchResults = null;
189
+ }
190
+ componentDidLoad() {
191
+ if (!this.documentAttributesForDisplay ||
192
+ this.documentAttributesForDisplay.length === 0) {
193
+ console.warn('No document attributes provided; using empty keys array.');
194
+ this.documentAttributesForDisplay = '';
195
+ }
196
+ this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
197
+ if (state.query.length > 0) {
198
+ this.hasSearched = true;
199
+ }
200
+ else {
201
+ this.hasSearched = false;
202
+ }
203
+ this.searchResults = Object.assign({}, state.searchResults);
204
+ this.query = state.query;
205
+ });
206
+ const { searchResults, query } = store.useSearchcraftStore.getState();
207
+ this.searchResults = searchResults;
208
+ this.query = query;
209
+ }
210
+ disconnectedCallback() {
211
+ if (this.unsubscribe) {
212
+ this.unsubscribe();
213
+ }
214
+ }
215
+ render() {
216
+ var _a, _b, _c, _d, _e, _f, _g;
217
+ if (!this.hasSearched) {
218
+ return (index.h("div", { class: 'emptyState' }, index.h("slot", { name: 'empty-search' })));
219
+ }
220
+ if (!((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data)) {
221
+ console.warn('No search results data available');
222
+ return index.h("div", { class: 'emptyState' }, "No results to display.");
223
+ }
224
+ const parsedSearchKeys = utils.parseSearchKeys(this.documentAttributesForDisplay);
225
+ const serializedStyles = typeof this.customStylesForResults === 'string'
226
+ ? this.customStylesForResults
227
+ : utils.serializeStyles(this.customStylesForResults);
228
+ 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) => {
229
+ const { doc: result } = document;
230
+ const dynamicProperties = utils.extractDynamicProperties(result, parsedSearchKeys);
231
+ if (this.formatTime) {
232
+ for (const key of parsedSearchKeys) {
233
+ if (dynamicProperties[key]) {
234
+ const value = dynamicProperties[key];
235
+ // Check if the value is a valid ISO timestamp
236
+ if (typeof value === 'string' &&
237
+ !Number.isNaN(Date.parse(value))) {
238
+ dynamicProperties[key] = utils.getFormattedTimeFromNow(value);
239
+ }
240
+ }
241
+ }
242
+ }
243
+ 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]] }));
244
+ });
245
+ const finalComponents = [];
246
+ if (this.placeAdAtStart) {
247
+ finalComponents.push(index.h("div", { key: 'ad-section-start', class: 'adSection' }, index.h("span", null, "##"), index.h("p", null, " Ad Impressions")));
248
+ }
249
+ if (this.adInterval > 0) {
250
+ resultsComponents.forEach((component, index$1) => {
251
+ finalComponents.push(component);
252
+ if ((index$1 + 1) % this.adInterval === 0) {
253
+ finalComponents.push(index.h("div", { key: `ad-section-${index$1 + 1}`, class: 'adSection' }, index.h("span", null, "##"), index.h("p", null, " Ad Impressions")));
254
+ }
255
+ });
256
+ }
257
+ else {
258
+ finalComponents.push(...resultsComponents);
259
+ }
260
+ if (this.placeAdAtEnd) {
261
+ finalComponents.push(index.h("div", { key: 'ad-section-end', class: 'adSection' }, index.h("span", null, "##"), index.h("p", null, " Ad Impressions")));
262
+ }
263
+ return (index.h("div", { class: 'resultsContainer' }, finalComponents, this.query.length > 0 &&
264
+ ((_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` })))));
265
+ }
266
+ };
267
+ SearchcraftBaseSearchResults.style = SearchcraftBaseSearchResultsStyle0;
268
+
269
+ const SearchcraftClearIconSet = class {
270
+ constructor(hostRef) {
271
+ index.registerInstance(this, hostRef);
272
+ this.type = 'clear-light';
273
+ }
274
+ render() {
275
+ switch (this.type) {
276
+ case 'clear-light':
277
+ 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' })));
278
+ case 'clear-dark':
279
+ 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' })));
280
+ case 'arrow-light':
281
+ 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' })));
282
+ case 'arrow-dark':
283
+ 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' })));
284
+ default:
285
+ return null;
286
+ }
287
+ }
288
+ };
289
+
290
+ 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}";
291
+ const SearchcraftClearInputButtonStyle0 = searchcraftClearInputButtonModuleCss;
292
+
293
+ const SearchcraftClearInputButton = class {
294
+ constructor(hostRef) {
295
+ index.registerInstance(this, hostRef);
296
+ this.clearInput = index.createEvent(this, "clearInput", 7);
297
+ this.handleClearClick = (event) => {
298
+ event.preventDefault();
299
+ this.clearInput.emit();
300
+ };
301
+ this.isRequesting = false;
302
+ this.rightToLeftOrientation = false;
303
+ this.theme = 'light';
304
+ }
305
+ isLightTheme() {
306
+ return this.theme === 'light';
307
+ }
308
+ render() {
309
+ 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' }))));
310
+ }
311
+ };
312
+ SearchcraftClearInputButton.style = SearchcraftClearInputButtonStyle0;
313
+
314
+ 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}";
315
+ const SearchcraftErrorMessageStyle0 = searchcraftErrorMessageModuleCss;
316
+
317
+ const SearchcraftErrorMessage = class {
318
+ constructor(hostRef) {
319
+ index.registerInstance(this, hostRef);
320
+ this.errorMessage = undefined;
321
+ this.theme = 'light';
322
+ }
323
+ render() {
324
+ const errorMessageStyle = this.theme === 'light' ? 'errorMessageLight' : 'errorMessageDark';
325
+ return (index.h("p", { key: '544903d700810ed5d6efdefedab646cafed2376d', class: index$1.classNames(errorMessageStyle) }, this.errorMessage || 'Search term is required.'));
326
+ }
327
+ };
328
+ SearchcraftErrorMessage.style = SearchcraftErrorMessageStyle0;
329
+
330
+ const searchcraftFiltersListModuleCss = "@charset \"UTF-8\";.filtersList{width:100%}.checkboxLabel{align-items:center;color:#292929;display:flex;font-family:\"Source Sans Pro\";font-size:14px;font-weight:600;gap:14px}.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}.checkboxLabel input[type=checkbox]:checked::before{color:#fff;content:\"✔\"}.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}.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;width:24px}.childCheckboxLabel input[type=checkbox]:checked{background-color:#000}.childCheckboxLabel input[type=checkbox]:checked::before{color:#fff;content:\"✔\"}";
331
+ const SearchcraftFiltersListStyle0 = searchcraftFiltersListModuleCss;
332
+
333
+ const SearchcraftFiltersList = class {
334
+ constructor(hostRef) {
335
+ index.registerInstance(this, hostRef);
336
+ this.filtersUpdated = index.createEvent(this, "filtersUpdated", 7);
337
+ this.searchStore = store.useSearchcraftStore.getState();
338
+ this.handleFilterChange = (value, checked) => {
339
+ if (checked) {
340
+ this.selectedFilters.add(value);
341
+ }
342
+ else {
343
+ this.selectedFilters.delete(value);
344
+ }
345
+ const deduplicatedFilters = this.deduplicatePaths(Array.from(this.selectedFilters));
346
+ this.filtersUpdated.emit(deduplicatedFilters);
347
+ this.searchStore.setSelectedFilters(deduplicatedFilters);
348
+ this.searchStore.search();
349
+ };
350
+ this.filters = [];
351
+ this.dynamicFilters = [];
352
+ this.isRequesting = false;
353
+ this.query = '';
354
+ this.resultsCount = 0;
355
+ this.selectedFilters = new Set();
356
+ }
357
+ connectedCallback() {
358
+ var _a;
359
+ const state = this.searchStore; // Fetch the initial state
360
+ // Initial population of facets if available
361
+ if ((_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data.facets) {
362
+ this.populateFiltersFromFacets(state.searchResults.data.facets);
363
+ }
364
+ this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
365
+ var _a, _b, _c, _d;
366
+ if (!state.query || state.query.trim().length === 0) {
367
+ if (this.selectedFilters.size > 0) {
368
+ this.selectedFilters.clear();
369
+ this.filtersUpdated.emit([]);
370
+ if (this.searchStore.selectedFilters.length > 0) {
371
+ this.searchStore.setSelectedFilters([]);
372
+ }
373
+ }
374
+ }
375
+ this.query = state.query || '';
376
+ this.isRequesting = state.isRequesting;
377
+ 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;
378
+ // Populate filters when facets are updated
379
+ if ((_d = state.searchResults) === null || _d === void 0 ? void 0 : _d.data.facets) {
380
+ this.populateFiltersFromFacets(state.searchResults.data.facets);
381
+ }
382
+ });
383
+ }
384
+ disconnectedCallback() {
385
+ if (this.unsubscribe) {
386
+ this.unsubscribe();
387
+ }
388
+ }
389
+ populateFiltersFromFacets(facets) {
390
+ var _a;
391
+ const newFilters = utils.flattenFacets(((_a = facets[0]) === null || _a === void 0 ? void 0 : _a.section) || []);
392
+ const filtersMap = new Map();
393
+ newFilters.forEach((filter) => {
394
+ const key = filter.value.split('/').pop() || '';
395
+ const existingFilter = filtersMap.get(key);
396
+ if (!existingFilter ||
397
+ filter.value.length < existingFilter.value.length) {
398
+ filtersMap.set(key, filter);
399
+ }
400
+ });
401
+ this.dynamicFilters = Array.from(filtersMap.values());
402
+ }
403
+ deduplicatePaths(filters) {
404
+ const pathMap = new Map();
405
+ filters.forEach((path) => {
406
+ const key = path.split('/').pop() || '';
407
+ const existingPath = pathMap.get(key);
408
+ if (!existingPath || path.length < existingPath.length) {
409
+ pathMap.set(key, path);
410
+ }
411
+ });
412
+ return Array.from(pathMap.values());
413
+ }
414
+ formatLabel(label) {
415
+ return label
416
+ .replace(/-/g, ' ')
417
+ .split(' ')
418
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
419
+ .join(' ');
420
+ }
421
+ render() {
422
+ if (!this.query || this.resultsCount === 0) {
423
+ return null;
424
+ }
425
+ const filtersToRender = this.dynamicFilters.filter((filter) => !filter.value.includes('/', filter.value.indexOf('/') + 1));
426
+ return (index.h("div", { class: 'filtersList' }, filtersToRender.map((filter) => {
427
+ const isChecked = this.selectedFilters.has(filter.value);
428
+ const children = this.dynamicFilters.filter((child) => child.value.startsWith(`${filter.value}/`) &&
429
+ child.value !== filter.value);
430
+ return (index.h("div", { key: filter.value }, index.h("label", { class: 'checkboxLabel' }, index.h("input", { class: 'filterCheckbox', checked: isChecked, onChange: (event) => this.handleFilterChange(filter.value, event.target.checked), type: 'checkbox' }), this.formatLabel(filter.label)), children.map((child) => {
431
+ const isChildChecked = this.selectedFilters.has(child.value);
432
+ return (index.h("label", { class: 'childCheckboxLabel', key: child.value, style: { marginLeft: '20px' } }, index.h("input", { class: 'childFilterCheckbox', checked: isChildChecked, onChange: (event) => this.handleFilterChange(child.value, event.target.checked), type: 'checkbox' }), this.formatLabel(child.label.split('/').pop() || '')));
433
+ })));
434
+ })));
435
+ }
436
+ };
437
+ SearchcraftFiltersList.style = SearchcraftFiltersListStyle0;
438
+
439
+ 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%}";
440
+ const SearchcraftInputStyle0 = searchcraftInputModuleCss;
441
+
442
+ const SearchcraftInput = class {
443
+ constructor(hostRef) {
444
+ index.registerInstance(this, hostRef);
445
+ this.clearInput = index.createEvent(this, "clearInput", 7);
446
+ this.searchInputChange = index.createEvent(this, "searchInputChange", 7);
447
+ this.inputKeyUp = index.createEvent(this, "inputKeyUp", 7);
448
+ this.customStyles = {};
449
+ this.error = false;
450
+ this.formClassName = '';
451
+ this.inputCaptionClassName = '';
452
+ this.inputCaptionValue = '';
453
+ this.inputClassName = '';
454
+ this.inputIconHeight = 20;
455
+ this.inputIconWidth = 20;
456
+ this.isRequesting = false;
457
+ this.placeholderValue = 'Enter Search';
458
+ this.rightToLeftOrientation = false;
459
+ this.query = '';
460
+ this.theme = 'light';
461
+ }
462
+ get isLightTheme() {
463
+ return this.theme === 'light';
464
+ }
465
+ handleInputChange(event) {
466
+ const input = event.target;
467
+ this.searchInputChange.emit(input.value);
468
+ }
469
+ handleInputKeyUp(event) {
470
+ const input = event.target;
471
+ this.inputKeyUp.emit(input.value);
472
+ }
473
+ handleClearInput() {
474
+ if (this.clearInput) {
475
+ this.clearInput.emit();
476
+ }
477
+ }
478
+ render() {
479
+ const containerClassName = this.rightToLeftOrientation
480
+ ? 'inputContainerRTL'
481
+ : 'inputContainerLTR';
482
+ const inputClassName = index$1.classNames(this.error
483
+ ? this.isLightTheme
484
+ ? 'inputErrorLightRTL'
485
+ : 'inputErrorDarkRTL'
486
+ : this.isLightTheme
487
+ ? 'inputLightLTR'
488
+ : 'inputDarkLTR', 'searchcraft-input');
489
+ const validatedCustomStyles = utils.parseCustomStyles(this.customStyles);
490
+ const placeholderStyle = {
491
+ fontSize: validatedCustomStyles.placeholderFontSize || '16px',
492
+ };
493
+ return (index.h("div", { key: 'ca2698b808ef606d890817f6b8c133503663570e', 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, `
494
+ #searchcraft-input-id::placeholder {
495
+ font-size: ${placeholderStyle.fontSize};
496
+ }
497
+ `), 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, `
498
+ #searchcraft-input-id::placeholder {
499
+ font-size: ${placeholderStyle.fontSize};
500
+ }
501
+ `), 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 }))))));
502
+ }
503
+ };
504
+ SearchcraftInput.style = SearchcraftInputStyle0;
505
+
506
+ 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}";
507
+ const SearchcraftInputCaptionStyle0 = searchcraftInputCaptionModuleCss;
508
+
509
+ const SearchcraftInputCaption = class {
510
+ constructor(hostRef) {
511
+ index.registerInstance(this, hostRef);
512
+ this.error = undefined;
513
+ this.inputCaptionClassName = '';
514
+ this.inputCaptionValue = 'Enter Search';
515
+ this.rightToLeftOrientation = false;
516
+ this.theme = 'light';
517
+ }
518
+ isLightTheme() {
519
+ return this.theme === 'light';
520
+ }
521
+ render() {
522
+ return this.rightToLeftOrientation ? (index.h("p", { class: index$1.classNames(this.error
523
+ ? this.isLightTheme
524
+ ? 'inputCaptionErrorLightRTL'
525
+ : 'inputCaptionErrorDarkRTL'
526
+ : this.isLightTheme
527
+ ? 'inputCaptionLightRTL'
528
+ : 'inputCaptionDarkRTL', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue)) : (index.h("p", { class: index$1.classNames(this.error
529
+ ? this.isLightTheme
530
+ ? 'inputCaptionErrorLightLTR'
531
+ : 'inputCaptionErrorDarkLTR'
532
+ : this.isLightTheme
533
+ ? 'inputCaptionLightLTR'
534
+ : 'inputCaptionDarkLTR', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue));
535
+ }
536
+ };
537
+ SearchcraftInputCaption.style = SearchcraftInputCaptionStyle0;
538
+
539
+ 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%)}";
540
+ const SearchcraftInputIconStyle0 = searchcraftInputIconModuleCss;
541
+
542
+ const SearchcraftInputIcon = class {
543
+ constructor(hostRef) {
544
+ index.registerInstance(this, hostRef);
545
+ this.error = undefined;
546
+ this.height = 20;
547
+ this.rightToLeftOrientation = false;
548
+ this.width = 20;
549
+ this.theme = 'light';
550
+ }
551
+ isLightTheme() {
552
+ return this.theme === 'light';
553
+ }
554
+ render() {
555
+ 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 }))));
556
+ }
557
+ };
558
+ SearchcraftInputIcon.style = SearchcraftInputIconStyle0;
559
+
560
+ 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}";
561
+ const SearchcraftInputLabelStyle0 = searchcraftInputLabelModuleCss;
562
+
563
+ const SearchcraftInputLabel = class {
564
+ constructor(hostRef) {
565
+ index.registerInstance(this, hostRef);
566
+ this.inputLabelClassName = '';
567
+ this.label = undefined;
568
+ this.theme = 'light';
569
+ }
570
+ isLightTheme() {
571
+ return this.theme === 'light';
572
+ }
573
+ render() {
574
+ if (!this.label) {
575
+ return null;
576
+ }
577
+ const labelStyle = this.isLightTheme() ? 'labelLight' : 'labelDark';
578
+ return (index.h("label", { class: index$1.classNames(labelStyle, this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
579
+ }
580
+ };
581
+ SearchcraftInputLabel.style = SearchcraftInputLabelStyle0;
582
+
583
+ 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}";
584
+ const SearchcraftResultsInfoStyle0 = searchcraftResultsInfoModuleCss;
585
+
586
+ const SearchcraftResultsInfo = class {
587
+ constructor(hostRef) {
588
+ index.registerInstance(this, hostRef);
589
+ this.isRequesting = false;
590
+ this.resultsCount = 0;
591
+ this.responseTime = '';
592
+ this.query = '';
593
+ }
594
+ connectedCallback() {
595
+ this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
596
+ var _a, _b, _c, _d;
597
+ this.isRequesting = state.isRequesting;
598
+ this.resultsCount = ((_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.count) || 0;
599
+ 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);
600
+ this.query = state.query || ''; // Update query from store
601
+ });
602
+ }
603
+ disconnectedCallback() {
604
+ if (this.unsubscribe) {
605
+ this.unsubscribe();
606
+ }
607
+ }
608
+ render() {
609
+ if (!this.query || this.resultsCount === 0) {
610
+ return null;
611
+ }
612
+ return (index.h("div", { class: 'container' }, index.h("p", { class: 'resultsInfo' }, this.resultsCount, " results found in ", this.responseTime, "ms")));
613
+ }
614
+ };
615
+ SearchcraftResultsInfo.style = SearchcraftResultsInfoStyle0;
616
+
617
+ const SearchcraftSearchIconSet = class {
618
+ constructor(hostRef) {
619
+ index.registerInstance(this, hostRef);
620
+ this.type = 'search-dark';
621
+ this.width = 20;
622
+ this.height = 20;
623
+ }
624
+ render() {
625
+ const { width, height } = this;
626
+ switch (this.type) {
627
+ case 'search-light':
628
+ 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' })));
629
+ case 'search-dark':
630
+ 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' })));
631
+ case 'error-light':
632
+ 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' })));
633
+ case 'error-dark':
634
+ 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' })));
635
+ default:
636
+ return null;
637
+ }
638
+ }
639
+ };
640
+
641
+ 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}";
642
+ const SearchcraftSliderStyle0 = searchcraftSliderModuleCss;
643
+
644
+ const SearchcraftSlider = class {
645
+ constructor(hostRef) {
646
+ index.registerInstance(this, hostRef);
647
+ this.searchStore = store.useSearchcraftStore.getState();
648
+ this.updateYears = async () => {
649
+ this.searchStore.setYearsRange([this.startYear, this.endYear]);
650
+ try {
651
+ if (typeof this.query === 'string' && this.query.trim() !== '') {
652
+ await this.searchStore.search();
653
+ }
654
+ else {
655
+ console.warn('Query is missing or empty, skipping search request.');
656
+ }
657
+ }
658
+ catch (error) {
659
+ console.error('Search failed:', error);
660
+ }
661
+ };
662
+ this.handleStartYearChange = (event) => {
663
+ const value = Number.parseInt(event.target.value, 10);
664
+ this.startYear = Math.min(value, this.endYear);
665
+ this.updateYears();
666
+ };
667
+ this.handleEndYearChange = (event) => {
668
+ const value = Number.parseInt(event.target.value, 10);
669
+ this.endYear = Math.max(value, this.startYear);
670
+ this.updateYears();
671
+ };
672
+ this.maxYear = new Date().getFullYear();
673
+ this.minYear = 2014;
674
+ this.endYear = this.maxYear;
675
+ this.hasSearched = false;
676
+ this.query = '';
677
+ this.resultsCount = 0;
678
+ this.startYear = this.minYear;
679
+ }
680
+ componentDidLoad() {
681
+ this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
682
+ var _a, _b, _c;
683
+ if (state.query.length > 0) {
684
+ this.hasSearched = true;
685
+ 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;
686
+ }
687
+ this.query = state.query;
688
+ });
689
+ }
690
+ disconnectedCallback() {
691
+ if (this.unsubscribe) {
692
+ this.unsubscribe();
693
+ }
694
+ }
695
+ render() {
696
+ if (!this.query || this.resultsCount === 0) {
697
+ return null;
698
+ }
699
+ const rangeMin = this.minYear;
700
+ const rangeMax = this.maxYear;
701
+ const startPercent = ((this.startYear - rangeMin) / (rangeMax - rangeMin)) * 100;
702
+ const endPercent = ((this.endYear - rangeMin) / (rangeMax - rangeMin)) * 100;
703
+ return (index.h("div", { class: 'sliderContainer' }, index.h("div", { class: 'rangeContainer' }, index.h("div", { class: 'activeRange', style: {
704
+ left: `${startPercent}%`,
705
+ width: `${endPercent - startPercent}%`,
706
+ } }), 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))));
707
+ }
708
+ };
709
+ SearchcraftSlider.style = SearchcraftSliderStyle0;
710
+
711
+ 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)}}";
712
+ const SearchcraftSpinnerDarkStyle0 = searchcraftSpinnerDarkModuleCss;
713
+
714
+ const SearchcraftSpinnerDark = class {
715
+ constructor(hostRef) {
716
+ index.registerInstance(this, hostRef);
717
+ }
718
+ render() {
719
+ return (index.h("div", { key: '60b629930c2e2795236f6768b40c95ce9390e882', class: 'spinnerContainer' }, index.h("div", { key: 'bfef3329f2e81ecf6538738ac0213da6259dd1c3', class: 'spinnerDark' })));
720
+ }
721
+ };
722
+ SearchcraftSpinnerDark.style = SearchcraftSpinnerDarkStyle0;
723
+
724
+ 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)}}";
725
+ const SearchcraftSpinnerLightStyle0 = searchcraftSpinnerLightModuleCss;
726
+
727
+ const SearchcraftSpinnerLight = class {
728
+ constructor(hostRef) {
729
+ index.registerInstance(this, hostRef);
730
+ }
731
+ render() {
732
+ return (index.h("div", { key: 'ad5224c97faf7e329d2a8904488c17dfd7414b9e', class: 'spinnerContainer' }, index.h("div", { key: '6336ce7737af65eedac46ee290b20291ce5b6096', class: 'spinnerLight' })));
733
+ }
734
+ };
735
+ SearchcraftSpinnerLight.style = SearchcraftSpinnerLightStyle0;
736
+
737
+ 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)}";
738
+ const SearchcraftToggleButtonStyle0 = searchcraftToggleButtonModuleCss;
739
+
740
+ const SearchcraftToggleButton = class {
741
+ constructor(hostRef) {
742
+ index.registerInstance(this, hostRef);
743
+ this.searchStore = store.useSearchcraftStore.getState();
744
+ this.handleToggle = async () => {
745
+ this.isActive = !this.isActive;
746
+ if (this.type === 'mode') {
747
+ const mode = this.isActive ? 'normal' : 'fuzzy';
748
+ this.searchStore.setSearchParams({
749
+ mode,
750
+ });
751
+ }
752
+ else if (this.type === 'sort') {
753
+ const sort = this.isActive ? 'desc' : 'asc';
754
+ this.searchStore.setSearchParams({
755
+ sort,
756
+ });
757
+ }
758
+ try {
759
+ await this.searchStore.search();
760
+ }
761
+ catch (error) {
762
+ console.error('Search failed:', error);
763
+ }
764
+ };
765
+ this.type = 'mode';
766
+ this.isActive = false;
767
+ this.query = '';
768
+ this.resultsCount = 0;
769
+ }
770
+ componentDidLoad() {
771
+ this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
772
+ var _a, _b, _c;
773
+ this.query = state.query || '';
774
+ 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;
775
+ });
776
+ }
777
+ disconnectedCallback() {
778
+ if (this.unsubscribe) {
779
+ this.unsubscribe();
780
+ }
781
+ }
782
+ render() {
783
+ if (!this.query || this.resultsCount === 0) {
784
+ return null;
785
+ }
786
+ return (index.h("button", { class: `toggle-wrapper ${this.isActive ? 'active' : ''}`, onClick: this.handleToggle, type: 'button' }, index.h("div", { class: `toggle-switch ${this.isActive ? 'active' : ''}` })));
787
+ }
788
+ };
789
+ SearchcraftToggleButton.style = SearchcraftToggleButtonStyle0;
790
+
791
+ exports.searchcraft_auto_search_form = SearchcraftAutoSearchForm;
792
+ exports.searchcraft_base_search_result = SearchcraftBaseSearchResult;
793
+ exports.searchcraft_base_search_results = SearchcraftBaseSearchResults;
794
+ exports.searchcraft_clear_icon_set = SearchcraftClearIconSet;
795
+ exports.searchcraft_clear_input_button = SearchcraftClearInputButton;
796
+ exports.searchcraft_error_message = SearchcraftErrorMessage;
797
+ exports.searchcraft_filters_list = SearchcraftFiltersList;
798
+ exports.searchcraft_input = SearchcraftInput;
799
+ exports.searchcraft_input_caption = SearchcraftInputCaption;
800
+ exports.searchcraft_input_icon = SearchcraftInputIcon;
801
+ exports.searchcraft_input_label = SearchcraftInputLabel;
802
+ exports.searchcraft_results_info = SearchcraftResultsInfo;
803
+ exports.searchcraft_search_icon_set = SearchcraftSearchIconSet;
804
+ exports.searchcraft_slider = SearchcraftSlider;
805
+ exports.searchcraft_spinner_dark = SearchcraftSpinnerDark;
806
+ exports.searchcraft_spinner_light = SearchcraftSpinnerLight;
807
+ exports.searchcraft_toggle_button = SearchcraftToggleButton;
808
+
809
+ //# sourceMappingURL=searchcraft-auto-search-form_17.cjs.entry.js.map