@seekora-ai/ui-sdk-react 1.0.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 (169) hide show
  1. package/dist/components/Breadcrumb.d.ts +43 -0
  2. package/dist/components/Breadcrumb.d.ts.map +1 -0
  3. package/dist/components/Breadcrumb.js +119 -0
  4. package/dist/components/ClearRefinements.d.ts +42 -0
  5. package/dist/components/ClearRefinements.d.ts.map +1 -0
  6. package/dist/components/ClearRefinements.js +80 -0
  7. package/dist/components/CurrentRefinements.d.ts +41 -0
  8. package/dist/components/CurrentRefinements.d.ts.map +1 -0
  9. package/dist/components/CurrentRefinements.js +83 -0
  10. package/dist/components/Facets.d.ts +53 -0
  11. package/dist/components/Facets.d.ts.map +1 -0
  12. package/dist/components/Facets.js +195 -0
  13. package/dist/components/FederatedDropdown.d.ts +92 -0
  14. package/dist/components/FederatedDropdown.d.ts.map +1 -0
  15. package/dist/components/FederatedDropdown.js +510 -0
  16. package/dist/components/HierarchicalMenu.d.ts +55 -0
  17. package/dist/components/HierarchicalMenu.d.ts.map +1 -0
  18. package/dist/components/HierarchicalMenu.js +168 -0
  19. package/dist/components/Highlight.d.ts +51 -0
  20. package/dist/components/Highlight.d.ts.map +1 -0
  21. package/dist/components/Highlight.js +155 -0
  22. package/dist/components/HitsPerPage.d.ts +41 -0
  23. package/dist/components/HitsPerPage.d.ts.map +1 -0
  24. package/dist/components/HitsPerPage.js +72 -0
  25. package/dist/components/InfiniteHits.d.ts +56 -0
  26. package/dist/components/InfiniteHits.d.ts.map +1 -0
  27. package/dist/components/InfiniteHits.js +181 -0
  28. package/dist/components/MobileFilters.d.ts +71 -0
  29. package/dist/components/MobileFilters.d.ts.map +1 -0
  30. package/dist/components/MobileFilters.js +242 -0
  31. package/dist/components/Pagination.d.ts +44 -0
  32. package/dist/components/Pagination.d.ts.map +1 -0
  33. package/dist/components/Pagination.js +142 -0
  34. package/dist/components/QuerySuggestions.d.ts +38 -0
  35. package/dist/components/QuerySuggestions.d.ts.map +1 -0
  36. package/dist/components/QuerySuggestions.js +86 -0
  37. package/dist/components/QuerySuggestionsDropdown.d.ts +86 -0
  38. package/dist/components/QuerySuggestionsDropdown.d.ts.map +1 -0
  39. package/dist/components/QuerySuggestionsDropdown.js +395 -0
  40. package/dist/components/RangeInput.d.ts +58 -0
  41. package/dist/components/RangeInput.d.ts.map +1 -0
  42. package/dist/components/RangeInput.js +203 -0
  43. package/dist/components/RangeSlider.d.ts +51 -0
  44. package/dist/components/RangeSlider.d.ts.map +1 -0
  45. package/dist/components/RangeSlider.js +193 -0
  46. package/dist/components/Recommendations.d.ts +90 -0
  47. package/dist/components/Recommendations.d.ts.map +1 -0
  48. package/dist/components/Recommendations.js +270 -0
  49. package/dist/components/RichQuerySuggestions.d.ts +77 -0
  50. package/dist/components/RichQuerySuggestions.d.ts.map +1 -0
  51. package/dist/components/RichQuerySuggestions.js +492 -0
  52. package/dist/components/SearchBar.d.ts +40 -0
  53. package/dist/components/SearchBar.d.ts.map +1 -0
  54. package/dist/components/SearchBar.js +217 -0
  55. package/dist/components/SearchBarWithSuggestions.d.ts +99 -0
  56. package/dist/components/SearchBarWithSuggestions.d.ts.map +1 -0
  57. package/dist/components/SearchBarWithSuggestions.js +275 -0
  58. package/dist/components/SearchLayout.d.ts +35 -0
  59. package/dist/components/SearchLayout.d.ts.map +1 -0
  60. package/dist/components/SearchLayout.js +56 -0
  61. package/dist/components/SearchProvider.d.ts +28 -0
  62. package/dist/components/SearchProvider.d.ts.map +1 -0
  63. package/dist/components/SearchProvider.js +43 -0
  64. package/dist/components/SearchResults.d.ts +51 -0
  65. package/dist/components/SearchResults.d.ts.map +1 -0
  66. package/dist/components/SearchResults.js +485 -0
  67. package/dist/components/SortBy.d.ts +44 -0
  68. package/dist/components/SortBy.d.ts.map +1 -0
  69. package/dist/components/SortBy.js +61 -0
  70. package/dist/components/Stats.d.ts +37 -0
  71. package/dist/components/Stats.d.ts.map +1 -0
  72. package/dist/components/Stats.js +52 -0
  73. package/dist/components/suggestions/AmazonDropdown.d.ts +30 -0
  74. package/dist/components/suggestions/AmazonDropdown.d.ts.map +1 -0
  75. package/dist/components/suggestions/AmazonDropdown.js +529 -0
  76. package/dist/components/suggestions/GoogleDropdown.d.ts +31 -0
  77. package/dist/components/suggestions/GoogleDropdown.d.ts.map +1 -0
  78. package/dist/components/suggestions/GoogleDropdown.js +370 -0
  79. package/dist/components/suggestions/MinimalDropdown.d.ts +24 -0
  80. package/dist/components/suggestions/MinimalDropdown.d.ts.map +1 -0
  81. package/dist/components/suggestions/MinimalDropdown.js +314 -0
  82. package/dist/components/suggestions/MobileSheetDropdown.d.ts +31 -0
  83. package/dist/components/suggestions/MobileSheetDropdown.d.ts.map +1 -0
  84. package/dist/components/suggestions/MobileSheetDropdown.js +485 -0
  85. package/dist/components/suggestions/PinterestDropdown.d.ts +29 -0
  86. package/dist/components/suggestions/PinterestDropdown.d.ts.map +1 -0
  87. package/dist/components/suggestions/PinterestDropdown.js +450 -0
  88. package/dist/components/suggestions/ShopifyDropdown.d.ts +27 -0
  89. package/dist/components/suggestions/ShopifyDropdown.d.ts.map +1 -0
  90. package/dist/components/suggestions/ShopifyDropdown.js +451 -0
  91. package/dist/components/suggestions/SpotlightDropdown.d.ts +33 -0
  92. package/dist/components/suggestions/SpotlightDropdown.d.ts.map +1 -0
  93. package/dist/components/suggestions/SpotlightDropdown.js +547 -0
  94. package/dist/components/suggestions/SuggestionSearchBar.d.ts +123 -0
  95. package/dist/components/suggestions/SuggestionSearchBar.d.ts.map +1 -0
  96. package/dist/components/suggestions/SuggestionSearchBar.js +652 -0
  97. package/dist/components/suggestions/index.d.ts +37 -0
  98. package/dist/components/suggestions/index.d.ts.map +1 -0
  99. package/dist/components/suggestions/index.js +59 -0
  100. package/dist/components/suggestions/styles/index.d.ts +11 -0
  101. package/dist/components/suggestions/styles/index.d.ts.map +1 -0
  102. package/dist/components/suggestions/styles/index.js +289 -0
  103. package/dist/components/suggestions/styles/responsive.d.ts +107 -0
  104. package/dist/components/suggestions/styles/responsive.d.ts.map +1 -0
  105. package/dist/components/suggestions/styles/responsive.js +237 -0
  106. package/dist/components/suggestions/types.d.ts +489 -0
  107. package/dist/components/suggestions/types.d.ts.map +1 -0
  108. package/dist/components/suggestions/types.js +6 -0
  109. package/dist/components/suggestions/utils.d.ts +213 -0
  110. package/dist/components/suggestions/utils.d.ts.map +1 -0
  111. package/dist/components/suggestions/utils.js +514 -0
  112. package/dist/hooks/useAnalytics.d.ts +20 -0
  113. package/dist/hooks/useAnalytics.d.ts.map +1 -0
  114. package/dist/hooks/useAnalytics.js +62 -0
  115. package/dist/hooks/useNaturalLanguageFilters.d.ts +48 -0
  116. package/dist/hooks/useNaturalLanguageFilters.d.ts.map +1 -0
  117. package/dist/hooks/useNaturalLanguageFilters.js +221 -0
  118. package/dist/hooks/useQuerySuggestions.d.ts +21 -0
  119. package/dist/hooks/useQuerySuggestions.d.ts.map +1 -0
  120. package/dist/hooks/useQuerySuggestions.js +68 -0
  121. package/dist/hooks/useQuerySuggestionsEnhanced.d.ts +114 -0
  122. package/dist/hooks/useQuerySuggestionsEnhanced.d.ts.map +1 -0
  123. package/dist/hooks/useQuerySuggestionsEnhanced.js +376 -0
  124. package/dist/hooks/useSearchState.d.ts +35 -0
  125. package/dist/hooks/useSearchState.d.ts.map +1 -0
  126. package/dist/hooks/useSearchState.js +68 -0
  127. package/dist/hooks/useSeekoraSearch.d.ts +20 -0
  128. package/dist/hooks/useSeekoraSearch.d.ts.map +1 -0
  129. package/dist/hooks/useSeekoraSearch.js +63 -0
  130. package/dist/hooks/useSmartSuggestions.d.ts +55 -0
  131. package/dist/hooks/useSmartSuggestions.d.ts.map +1 -0
  132. package/dist/hooks/useSmartSuggestions.js +236 -0
  133. package/dist/hooks/useSuggestionsAnalytics.d.ts +91 -0
  134. package/dist/hooks/useSuggestionsAnalytics.d.ts.map +1 -0
  135. package/dist/hooks/useSuggestionsAnalytics.js +226 -0
  136. package/dist/index.d.ts +80 -0
  137. package/dist/index.d.ts.map +1 -0
  138. package/dist/index.js +86 -0
  139. package/dist/index.umd.js +1 -0
  140. package/dist/src/index.d.ts +2849 -0
  141. package/dist/src/index.esm.js +11679 -0
  142. package/dist/src/index.esm.js.map +1 -0
  143. package/dist/src/index.js +11761 -0
  144. package/dist/src/index.js.map +1 -0
  145. package/dist/themes/createTheme.d.ts +8 -0
  146. package/dist/themes/createTheme.d.ts.map +1 -0
  147. package/dist/themes/createTheme.js +10 -0
  148. package/dist/themes/dark.d.ts +6 -0
  149. package/dist/themes/dark.d.ts.map +1 -0
  150. package/dist/themes/dark.js +34 -0
  151. package/dist/themes/default.d.ts +6 -0
  152. package/dist/themes/default.d.ts.map +1 -0
  153. package/dist/themes/default.js +71 -0
  154. package/dist/themes/mergeThemes.d.ts +7 -0
  155. package/dist/themes/mergeThemes.d.ts.map +1 -0
  156. package/dist/themes/mergeThemes.js +6 -0
  157. package/dist/themes/minimal.d.ts +6 -0
  158. package/dist/themes/minimal.d.ts.map +1 -0
  159. package/dist/themes/minimal.js +34 -0
  160. package/dist/themes/suggestions.d.ts +216 -0
  161. package/dist/themes/suggestions.d.ts.map +1 -0
  162. package/dist/themes/suggestions.js +546 -0
  163. package/dist/themes/types.d.ts +7 -0
  164. package/dist/themes/types.d.ts.map +1 -0
  165. package/dist/themes/types.js +6 -0
  166. package/dist/types/index.d.ts +33 -0
  167. package/dist/types/index.d.ts.map +1 -0
  168. package/dist/types/index.js +4 -0
  169. package/package.json +65 -0
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SeekoraUI={},e.React)}(this,function(e,t){"use strict";var r;!function(e){e[e.VERBOSE=0]="VERBOSE",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.SILENT=4]="SILENT"}(r||(r={}));class o{constructor(e={}){this.level=e.level??this.getDefaultLevel(),this.prefix=e.prefix??"[Seekora UI SDK]",this.enableTimestamp=e.enableTimestamp??!1}getDefaultLevel(){switch(void 0){case"VERBOSE":return r.VERBOSE;case"INFO":return r.INFO;case"WARN":return r.WARN;case"ERROR":return r.ERROR;case"SILENT":return r.SILENT}return"undefined"!=typeof window&&window.__SEEKORA_DEBUG__?r.VERBOSE:r.INFO}formatMessage(e,...t){const r=[];return this.enableTimestamp&&r.push(`[${(new Date).toISOString()}]`),r.push(this.prefix,`[${e}]`),[...r,...t]}verbose(...e){this.level<=r.VERBOSE&&console.log(...this.formatMessage("VERBOSE",...e))}info(...e){this.level<=r.INFO&&console.info(...this.formatMessage("INFO",...e))}warn(...e){this.level<=r.WARN&&console.warn(...this.formatMessage("WARN",...e))}error(...e){this.level<=r.ERROR&&console.error(...this.formatMessage("ERROR",...e))}setLevel(e){this.level=e}getLevel(){return this.level}setPrefix(e){this.prefix=e}setTimestamp(e){this.enableTimestamp=e}}let a=null;function n(){return a||(a=function(e={}){return new o(e)}()),a}const s=(...e)=>n().verbose(...e),i=(...e)=>n().info(...e),l=(...e)=>n().warn(...e),c=(...e)=>n().error(...e);function d(e){const{attribute:t,hit:r,preTag:o="<mark>",postTag:a="</mark>",fallback:n}=e,s=r._highlightResult?.[t]?.value||r.highlight_result?.[t]?.value||r._highlight?.[t]||r.highlight?.[t];if(s)return s.replace(/<em>/g,o).replace(/<\/em>/g,a).replace(/<mark>/g,o).replace(/<\/mark>/g,a);const i=(l=r,t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,l));var l;return void 0!==i?String(i):n||""}function u(e,t="<mark>",r="</mark>"){const o=[];let a=e;for(;a.length>0;){const e=a.indexOf(t);if(-1===e){a.length>0&&o.push({value:a,isHighlighted:!1});break}e>0&&o.push({value:a.substring(0,e),isHighlighted:!1});const n=a.substring(e+t.length),s=n.indexOf(r);if(-1===s){o.push({value:a.substring(e),isHighlighted:!1});break}o.push({value:n.substring(0,s),isHighlighted:!0}),a=n.substring(s+r.length)}return o}function p(e,t,r=!1){if(!t||!e)return[{value:e,isHighlighted:!1}];const o=[],a=r?"g":"gi",n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp(n,a);let i,l=0;for(;null!==(i=s.exec(e));)i.index>l&&o.push({value:e.substring(l,i.index),isHighlighted:!1}),o.push({value:i[0],isHighlighted:!0}),l=s.lastIndex;return l<e.length&&o.push({value:e.substring(l),isHighlighted:!1}),o.length>0?o:[{value:e,isHighlighted:!1}]}n();class m{constructor(e){this.listeners=[],this.debounceTimer=null,this.client=e.client,this.autoSearch=!1!==e.autoSearch,this.debounceMs=e.debounceMs||300,this.defaultSearchOptions=e.defaultSearchOptions||{widget_mode:!0},this.state={query:e.initialQuery||"",refinements:[],currentPage:1,itemsPerPage:e.itemsPerPage||10,sortBy:void 0,results:null,loading:!1,error:null},i("SearchStateManager: Initialized",{autoSearch:this.autoSearch,debounceMs:this.debounceMs})}getState(){return{...this.state}}getQuery(){return this.state.query}getRefinements(){return[...this.state.refinements]}getCurrentPage(){return this.state.currentPage}getResults(){return this.state.results}getLoading(){return this.state.loading}getError(){return this.state.error}setQuery(e,t=!0){if(this.state.query===e)return s("SearchStateManager: Query unchanged, skipping update",{query:e}),void(t&&this.autoSearch&&(s("SearchStateManager: Query unchanged but triggerSearch=true, triggering search"),this.debouncedSearch()));this.state.query=e,this.state.currentPage=1,s("SearchStateManager: Query updated",{query:e,triggerSearch:t,autoSearch:this.autoSearch}),this.notifyListeners(),this.autoSearch&&t?(s("SearchStateManager: Triggering debounced search"),this.debouncedSearch()):s("SearchStateManager: Search not triggered",{autoSearch:this.autoSearch,triggerSearch:t})}addRefinement(e,t,r=!0){const o=this.state.refinements.some(r=>r.field===e&&r.value===t);o||(this.state.refinements.push({field:e,value:t}),this.state.currentPage=1,s("SearchStateManager: Refinement added",{field:e,value:t}),this.notifyListeners(),this.autoSearch&&r&&this.debouncedSearch())}removeRefinement(e,t,r=!0){const o=this.state.refinements.findIndex(r=>r.field===e&&r.value===t);-1!==o&&(this.state.refinements.splice(o,1),this.state.currentPage=1,s("SearchStateManager: Refinement removed",{field:e,value:t}),this.notifyListeners(),this.autoSearch&&r&&this.debouncedSearch())}clearRefinements(e=!0){0!==this.state.refinements.length&&(this.state.refinements=[],this.state.currentPage=1,s("SearchStateManager: Refinements cleared"),this.notifyListeners(),this.autoSearch&&e&&this.debouncedSearch())}setPage(e,t=!0){this.state.currentPage!==e&&(this.state.currentPage=e,s("SearchStateManager: Page updated",{page:e}),this.notifyListeners(),this.autoSearch&&t&&this.debouncedSearch())}setSortBy(e,t=!0){this.state.sortBy!==e&&(this.state.sortBy=e,this.state.currentPage=1,s("SearchStateManager: Sort updated",{sortBy:e}),this.notifyListeners(),this.autoSearch&&t&&this.debouncedSearch())}setItemsPerPage(e,t=!0){this.state.itemsPerPage!==e&&(this.state.itemsPerPage=e,this.state.currentPage=1,s("SearchStateManager: Items per page updated",{itemsPerPage:e}),this.notifyListeners(),this.autoSearch&&t&&this.debouncedSearch())}async search(e){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.setState({loading:!0,error:null});try{const t=this.buildSearchOptions(e);s("SearchStateManager: Performing search",{query:this.state.query,refinementsCount:this.state.refinements.length,currentPage:this.state.currentPage,sortBy:this.state.sortBy,filter_by:t.filter_by});const r=await this.client.search(this.state.query,t);return this.setState({results:r,loading:!1,error:null}),i("SearchStateManager: Search completed",{query:this.state.query,resultsCount:r?.results?.length||0,totalResults:r?.totalResults||0}),r}catch(e){const t=e instanceof Error?e:new Error(String(e));return this.setState({results:null,loading:!1,error:t}),c("SearchStateManager: Search failed",{query:this.state.query,error:t.message}),null}}buildSearchOptions(e){const t={...this.defaultSearchOptions,page:this.state.currentPage,per_page:this.state.itemsPerPage,...e};if(this.state.sortBy&&"relevance"!==this.state.sortBy&&(t.sort_by=this.state.sortBy),this.state.refinements.length>0){const e={};this.state.refinements.forEach(t=>{e[t.field]||(e[t.field]=[]),e[t.field].push(t.value)});const r=[];Object.entries(e).forEach(([e,t])=>{t.forEach(t=>{r.push(`${e}:${t}`)})}),r.length>0&&(t.filter_by=r.join(" && "))}return t}debouncedSearch(){this.debounceTimer&&clearTimeout(this.debounceTimer),s("SearchStateManager: Scheduling debounced search",{debounceMs:this.debounceMs}),this.debounceTimer=setTimeout(()=>{s("SearchStateManager: Debounce timer fired, calling search()"),this.search()},this.debounceMs)}subscribe(e){return this.listeners.push(e),e(this.getState()),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}setState(e){this.state={...this.state,...e},this.notifyListeners()}notifyListeners(){const e=this.getState();this.listeners.forEach(t=>{try{t(e)}catch(e){const t=e instanceof Error?e:new Error(String(e));c("SearchStateManager: Error in listener",{error:t.message})}})}clear(){this.state={query:"",refinements:[],currentPage:1,itemsPerPage:this.state.itemsPerPage,sortBy:void 0,results:null,loading:!1,error:null},this.notifyListeners()}}const g={colors:{primary:"#007bff",secondary:"#6c757d",background:"#ffffff",surface:"#f8f9fa",text:"#212529",textSecondary:"#6c757d",border:"#dee2e6",hover:"#f8f9fa",focus:"#007bff",error:"#dc3545",success:"#28a745",warning:"#ffc107"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',fontSize:{small:"0.875rem",medium:"1rem",large:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{small:"0.5rem",medium:"1rem",large:"1.5rem"},borderRadius:{none:"0",small:"0.25rem",medium:"0.375rem",large:"0.5rem",full:"9999px"},shadows:{small:"0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)",medium:"0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)",large:"0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23)"},transitions:{fast:"150ms ease-in-out",normal:"250ms ease-in-out",slow:"350ms ease-in-out"},breakpoints:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},zIndex:{dropdown:1e3,modal:2e3,tooltip:3e3}},f=e=>((e,t)=>({colors:{...t.colors,...e.colors},typography:{...t.typography,...e.typography,fontSize:{...t.typography.fontSize,...e.typography?.fontSize}},spacing:{...t.spacing,...e.spacing},borderRadius:e.borderRadius??t.borderRadius,shadows:{...t.shadows,...e.shadows},transitions:{...t.transitions,...e.transitions},breakpoints:{...t.breakpoints,...e.breakpoints},zIndex:{...t.zIndex,...e.zIndex}}))(e,g),h=t.createContext(null),y=()=>{const e=t.useContext(h);if(!e){const e=new Error("useSearchContext must be used within a SearchProvider");throw c("SearchProvider: Context not available",{error:e.message}),e}return e},x=()=>{const{stateManager:e}=y(),[r,o]=t.useState(e.getState());t.useEffect(()=>e.subscribe(e=>{o(e)}),[e]);const a=t.useCallback((t,r=!0)=>{e.setQuery(t,r)},[e]),n=t.useCallback((t,r,o=!0)=>{e.addRefinement(t,r,o)},[e]),s=t.useCallback((t,r,o=!0)=>{e.removeRefinement(t,r,o)},[e]),i=t.useCallback((t=!0)=>{e.clearRefinements(t)},[e]),l=t.useCallback((t,r=!0)=>{e.setPage(t,r)},[e]),c=t.useCallback((t,r=!0)=>{e.setSortBy(t,r)},[e]),d=t.useCallback(t=>e.search(t),[e]),u=t.useCallback(()=>{e.clear()},[e]);return{query:r.query,refinements:r.refinements,currentPage:r.currentPage,itemsPerPage:r.itemsPerPage,sortBy:r.sortBy,results:r.results,loading:r.loading,error:r.error,setQuery:a,addRefinement:n,removeRefinement:s,clearRefinements:i,setPage:l,setSortBy:c,search:d,clear:u}},b=({client:e,query:r,enabled:o=!0,debounceMs:a=300,maxSuggestions:n=10})=>{const[s,i]=t.useState([]),[l,d]=t.useState(!1),[u,p]=t.useState(null),m=t.useRef(null);return t.useEffect(()=>(m.current&&clearTimeout(m.current),o&&r.trim()?(d(!0),p(null),m.current=setTimeout(async()=>{try{const t=await(e.getSuggestions?.(r,n)),o=(Array.isArray(t)?t:[]).map(e=>{const t=e.query||e.text||e,r=void 0!==e.popularity?e.popularity:void 0!==e.count?e.count:void 0;return{query:"string"==typeof t?t:String(t),count:"number"==typeof r?r:void 0,metadata:e}});i(o)}catch(e){const t=e instanceof Error?e:new Error(String(e));c("Error in useQuerySuggestions:",t),p(t),i([])}finally{d(!1)}},a),()=>{m.current&&clearTimeout(m.current)}):(i([]),d(!1),void p(null))),[e,r,o,a,n]),{suggestions:s,loading:l,error:u}};function v(e){var t,r,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=v(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function k(){for(var e,t,r=0,o="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=v(e))&&(o&&(o+=" "),o+=t);return o}const S=({title:e,items:r,renderItem:o,onItemClick:a,className:n,style:s,theme:i,layout:l="horizontal",currencySymbol:c="$"})=>{const{theme:d}=y(),u=i||{},p=()=>{switch(l){case"horizontal":return{flexShrink:0,width:"150px",scrollSnapAlign:"start"};case"grid":default:return{};case"list":return{display:"flex",gap:d.spacing.medium,padding:d.spacing.small,borderBottom:`1px solid ${d.colors.border}`}}};return t.createElement("div",{className:k(u.root,n),style:s},e&&t.createElement("h3",{className:u.title,style:{margin:`0 0 ${d.spacing.medium} 0`,fontSize:d.typography.fontSize.large,fontWeight:d.typography.fontWeight?.semibold||600,color:d.colors.text}},e),t.createElement("div",{className:u.list,style:(()=>{switch(l){case"horizontal":return{display:"flex",gap:d.spacing.medium,overflowX:"auto",scrollSnapType:"x mandatory",paddingBottom:d.spacing.small};case"grid":return{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:d.spacing.medium};case"list":return{display:"flex",flexDirection:"column",gap:d.spacing.small};default:return{}}})()},r.map((e,r)=>t.createElement("div",{key:e.id||r,className:u.item,onClick:()=>a?.(e,r),style:{...p(),cursor:a?"pointer":"default"}},o?o(e,r):t.createElement(E,{item:e,theme:u,currencySymbol:c,layout:l})))))},E=({item:e,theme:r,currencySymbol:o,layout:a})=>{const{theme:n}=y(),s=e.image||e.imageUrl||"",i=e.title||e.name||"",l=e.price,c="list"===a?"60px":"100%";return t.createElement(t.Fragment,null,s&&t.createElement("img",{src:s,alt:i,className:r.image,style:{width:c,height:"list"===a?"60px":"120px",objectFit:"cover",borderRadius:"string"==typeof n.borderRadius?n.borderRadius:n.borderRadius.small}}),t.createElement("div",{className:r.content,style:{flex:"list"===a?1:void 0}},t.createElement("div",{className:r.name,style:{marginTop:"list"===a?0:n.spacing.small,fontSize:n.typography.fontSize.small,fontWeight:n.typography.fontWeight?.medium||500,color:n.colors.text,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"}},i),void 0!==l&&t.createElement("div",{className:r.price,style:{marginTop:n.spacing.small,fontSize:n.typography.fontSize.small,fontWeight:n.typography.fontWeight?.bold||700,color:n.colors.primary}},o,"number"==typeof l?l.toFixed(2):l)))};function w(e){return{padding:e.spacing.large,textAlign:"center",color:e.colors.textSecondary}}const C="seekora_recent_searches",R=10;function I(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,JSON.stringify(t))}catch(e){l("Failed to save recent searches to localStorage",{error:e})}}function z(e){const t=e.query||e.text||String(e),r=e._highlightResult?.query?.value;return{query:t,popularity:e.popularity,count:e.instant_search?.exact_nb_hits??e.popularity??e.count,objectID:e.objectID,highlightedQuery:r?T(r):void 0,categories:e.categories?.map(e=>({value:e.value||e.name,count:e.count,path:e.path})),facets:e.instant_search?.facets||e.facets,metadata:e}}function T(e){return e.replace(/__ais-highlight__/g,"<mark>").replace(/__\/ais-highlight__/g,"</mark>")}function N(e){return{id:e.id||e.objectID,objectID:e.objectID||e.id,title:e.title||e.name||e.productName,name:e.name||e.title,image:e.image||e.imageUrl||e.metadata?.image,price:e.price||e.sellPrice||e.metadata?.sellPrice,currency:e.currency||e.metadata?.currency||"",url:e.url||e.productId||e.metadata?.url,clicks:e.clicks,conversions:e.conversions,revenue:e.revenue,trend_score:e.trend_score,metadata:e.metadata||e}}function A(e){return{id:e.id,label:e.label,filter:e.filter,products:e.products?.map(N)||[],nb_hits:e.nb_hits,processing_time_ms:e.processing_time_ms}}function M(e){const{client:r,query:o,enabled:a=!0,debounceMs:n=200,maxSuggestions:i=10,minQueryLength:l=1,includeDropdownRecommendations:d=!1,includeCategories:u=!1,includeFacets:p=!1,maxCategories:m=3,maxFacets:g=5,filteredTabs:f,minPopularity:h,timeRange:y,disableTypoTolerance:x,analyticsTags:b,enableRecentSearches:v=!0,maxRecentSearches:k=R,recentSearchesKey:S=C,onSuggestionsLoaded:E,onError:w}=e,[T,M]=t.useState([]),[P,_]=t.useState(!1),[B,$]=t.useState(null),[L,W]=t.useState(null),[q,F]=t.useState([]),[H,D]=t.useState(null),[O,j]=t.useState(0),[Q,V]=t.useState(0),[Y,U]=t.useState(0),[K,X]=t.useState(""),G=t.useRef(null),J=t.useRef(null),Z=t.useRef(!0);t.useEffect(()=>{if(v){const e=function(e){if("undefined"==typeof window)return[];try{const t=localStorage.getItem(e);return t?JSON.parse(t):[]}catch{return[]}}(S);F(e.slice(0,k))}return()=>{Z.current=!1}},[v,S,k]);const ee=t.useCallback(async e=>{if(!r||!e.trim())return M([]),void W(null);J.current&&J.current.abort(),J.current=new AbortController,_(!0),$(null);try{const t=await(r.getSuggestions?.(e,{hitsPerPage:i,include_dropdown_recommendations:d||f&&f.length>0,include_categories:u,include_facets:p,max_categories:m,max_facets:g,filtered_tabs:f,min_popularity:h,time_range:y,disable_typo_tolerance:x,analytics_tags:b,returnFullResponse:!0}));if(!Z.current)return;const o=(t.suggestions||[]).map(z);M(o);const a=t.extensions||{},n={trending_searches:Array.isArray(a.trending_searches)?a.trending_searches:[],top_searches:Array.isArray(a.top_searches)?a.top_searches:[],related_searches:Array.isArray(a.related_searches)?a.related_searches:[],trending_products:Array.isArray(a.trending_products)?a.trending_products.map(N):[],item_recommendations:Array.isArray(a.item_recommendations)?a.item_recommendations.map(N):[],popular_brands:Array.isArray(a.popular_brands)?a.popular_brands:[],filtered_tabs:Array.isArray(a.filtered_tabs)?a.filtered_tabs.map(A):[],processing_time_ms:"number"==typeof a.processing_time_ms?a.processing_time_ms:void 0,cached_at:"string"==typeof a.cached_at?a.cached_at:void 0};W(n);const l=t.raw,c=l?.results,v=c?.[0]??l??{},k=e=>"number"!=typeof e||Number.isNaN(e)?0:e,S=e=>"string"==typeof e?e:"";D("number"==typeof v.processingTimeMS?v.processingTimeMS:null),j(k(v.nbHits)||o.length),V(k(v.page)||0),U(k(v.nbPages)||1),X(S(v.query)||e),E&&E({suggestions:o,nbHits:k(v.nbHits)||o.length,page:k(v.page)||0,nbPages:k(v.nbPages)||1,hitsPerPage:k(v.hitsPerPage)||i,processingTimeMS:"number"==typeof v.processingTimeMS?v.processingTimeMS:void 0,query:S(v.query)||e,dropdownRecommendations:n,results:Array.isArray(t.results)?t.results:void 0,extensions:a}),s("Query suggestions loaded",{query:e,suggestionsCount:o.length,hasRecommendations:Object.keys(n).some(e=>Array.isArray(n[e])&&n[e].length>0)})}catch(t){if(!Z.current)return;const r=t instanceof Error?t:new Error(String(t));if("AbortError"===r.name)return;c("Failed to fetch query suggestions",{query:e,error:r.message}),$(r),M([]),W(null),w&&w(r)}finally{Z.current&&_(!1)}},[r,i,d,u,p,m,g,f,h,y,x,b,E,w]);t.useEffect(()=>(G.current&&clearTimeout(G.current),!a||o.length<l?(M([]),_(!1),void $(null)):(_(!0),G.current=setTimeout(()=>{ee(o)},n),()=>{G.current&&clearTimeout(G.current)})),[o,a,l,n,ee]);const te=t.useCallback((e,t)=>{v&&e.trim()&&F(r=>{const o=r.filter(t=>t.query.toLowerCase()!==e.toLowerCase()),a=[{query:e.trim(),timestamp:Date.now(),resultsCount:t},...o].slice(0,k);return I(S,a),a})},[v,k,S]),re=t.useCallback(e=>{F(t=>{const r=t.filter(t=>t.query!==e);return I(S,r),r})},[S]),oe=t.useCallback(()=>{F([]),I(S,[])},[S]),ae=t.useCallback(async()=>{o.length>=l&&await ee(o)},[o,l,ee]),ne=L?.trending_searches||[],se=L?.top_searches||[],ie=L?.related_searches||[],le=L?.popular_brands||[],ce=L?.filtered_tabs||[],de=L?.trending_products||[],ue=t.useMemo(()=>T.length>0||q.length>0||ne.length>0||se.length>0||ie.length>0||le.length>0||ce.length>0||de.length>0,[T,q,ne,se,ie,le,ce,de]),pe=t.useCallback(()=>{const e=[];let t=0;return 0===o.length&&q.length>0&&q.forEach(r=>{e.push({type:"recent",index:t++,data:r})}),T.forEach(r=>{e.push({type:"suggestion",index:t++,data:r})}),ne.forEach(r=>{e.push({type:"trending",index:t++,data:r})}),de.forEach(r=>{e.push({type:"product",index:t++,data:r})}),le.forEach(r=>{e.push({type:"brand",index:t++,data:r})}),e},[o,q,T,ne,de,le]);return{suggestions:T,loading:P,error:B,dropdownRecommendations:L,trendingSearches:ne,topSearches:se,relatedSearches:ie,popularBrands:le,filteredTabs:ce,trendingProducts:de,recentSearches:q,processingTimeMs:H,totalHits:O,currentPage:Q,totalPages:Y,originalQuery:K,addRecentSearch:te,removeRecentSearch:re,clearRecentSearches:oe,refetch:ae,hasContent:ue,getAllNavigableItems:pe}}const P={container:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius, 8px)",boxShadow:"var(--seekora-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))",maxHeight:"400px",overflowY:"auto",overflowX:"hidden"},sectionTitle:{fontSize:"12px",fontWeight:600,color:"var(--seekora-text-secondary, #6b7280)",textTransform:"uppercase",letterSpacing:"0.05em",padding:"8px 16px 4px",margin:0},suggestionItem:{display:"flex",alignItems:"center",padding:"10px 16px",cursor:"pointer",transition:"background-color 150ms ease",fontSize:"14px",color:"var(--seekora-text-primary, #111827)",gap:"12px"},suggestionItemActive:{backgroundColor:"var(--seekora-bg-hover, #f3f4f6)"},suggestionQuery:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},suggestionCount:{fontSize:"12px",color:"var(--seekora-text-secondary, #9ca3af)",marginLeft:"auto",flexShrink:0},highlight:{fontWeight:600,color:"var(--seekora-text-primary, #111827)",backgroundColor:"var(--seekora-highlight-bg, #fef3c7)",padding:"0 2px",borderRadius:"2px"},recentIcon:{width:"16px",height:"16px",color:"var(--seekora-text-secondary, #9ca3af)",flexShrink:0},removeButton:{padding:"4px",borderRadius:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--seekora-text-secondary, #9ca3af)",opacity:0,transition:"opacity 150ms ease, color 150ms ease"},removeButtonVisible:{opacity:1},loadingState:{display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 16px",color:"var(--seekora-text-secondary, #6b7280)",fontSize:"14px",gap:"8px"},emptyState:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px 16px",color:"var(--seekora-text-secondary, #6b7280)",fontSize:"14px",textAlign:"center"},divider:{height:"1px",backgroundColor:"var(--seekora-border-color, #e5e7eb)",margin:"4px 0"},footer:{borderTop:"1px solid var(--seekora-border-color, #e5e7eb)",padding:"8px 16px",fontSize:"12px",color:"var(--seekora-text-secondary, #6b7280)",display:"flex",alignItems:"center",justifyContent:"space-between"},keyboardHint:{display:"flex",alignItems:"center",gap:"8px",fontSize:"11px"},keyboardKey:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"20px",height:"18px",padding:"0 4px",borderRadius:"3px",backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)",border:"1px solid var(--seekora-border-color, #e5e7eb)",fontSize:"10px",fontWeight:500}},_=({className:e,style:r})=>t.createElement("svg",{className:e,style:r,viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),B=({className:e,style:r})=>t.createElement("svg",{className:e,style:r,viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),$=({className:e,style:r})=>t.createElement("svg",{className:e,style:r,viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})),L=({style:e})=>t.createElement("svg",{style:{animation:"spin 1s linear infinite",...e},viewBox:"0 0 24 24",width:"20",height:"20"},t.createElement("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",fill:"none",opacity:"0.25"}),t.createElement("path",{fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})),W=t.forwardRef(function(e,r){const{query:o,isOpen:a=!0,maxSuggestions:n=8,minQueryLength:s=1,debounceMs:i=200,showRecentSearches:l=!0,maxRecentSearches:c=5,showCounts:d=!0,showLoading:u=!0,showEmptyState:p=!0,highlight:m={enabled:!0,preTag:"<mark>",postTag:"</mark>"},keyboardNav:g={enabled:!0},animation:f={enabled:!0,duration:150,entrance:"fade"},classNames:h={},style:x,renderSuggestion:b,renderRecentSearch:v,renderLoading:S,renderEmpty:E,footer:w,position:C="absolute",width:R="100%",zIndex:I=1e3,closeOnClickOutside:z=!0,closeOnEscape:T=!0,ariaLabel:N="Search suggestions",onSuggestionSelect:A,onRecentSearchClick:W,onRecentSearchRemove:q,onOpen:F,onClose:H,onNavigate:D}=e,{client:O,theme:j}=y(),Q=t.useRef(null),[V,Y]=t.useState(-1),[U,K]=t.useState(!1),{suggestions:X,loading:G,error:J,recentSearches:Z,addRecentSearch:ee,removeRecentSearch:te,hasContent:re}=M({client:O,query:o,enabled:a&&o.length>=s,debounceMs:i,maxSuggestions:n,minQueryLength:s,enableRecentSearches:l,maxRecentSearches:c}),oe=t.useMemo(()=>{const e=[];return l&&0===o.length&&Z.length>0&&Z.slice(0,c).forEach(t=>{e.push({type:"recent",data:t})}),X.forEach(t=>{e.push({type:"suggestion",data:t})}),e},[X,Z,o,l,c]);t.useEffect(()=>{if(a&&(re||G))K(!0),F?.();else{if(f.enabled){const e=setTimeout(()=>K(!1),f.duration);return()=>clearTimeout(e)}K(!1),H?.()}},[a,re,G,f.enabled,f.duration,F,H]),t.useEffect(()=>{Y(-1)},[oe.length]);const ae=t.useCallback(()=>{g.enabled&&Y(e=>{const t=e<oe.length-1?e+1:0;return D?.("down",t),t})},[g.enabled,oe.length,D]),ne=t.useCallback(()=>{g.enabled&&Y(e=>{const t=e>0?e-1:oe.length-1;return D?.("up",t),t})},[g.enabled,oe.length,D]),se=t.useCallback(()=>{if(V<0||V>=oe.length)return;const e=oe[V];if("recent"===e.type){const t=e.data;W?.(t)}else{const t=e.data;A?.(t),ee(t.query,t.count)}},[V,oe,W,A,ee]),ie=t.useCallback(()=>{Y(-1)},[]);t.useImperativeHandle(r,()=>({selectActive:se,navigateNext:ae,navigatePrevious:ne,resetSelection:ie,getActiveIndex:()=>V,getTotalItems:()=>oe.length}),[se,ae,ne,ie,V,oe.length]),t.useEffect(()=>{if(!z||!a)return;const e=e=>{Q.current&&!Q.current.contains(e.target)&&H?.()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[z,a,H]);const le=t.useCallback((e,r)=>{if(!m.enabled||!r)return e;return e.split(new RegExp(`(${r})`,"gi")).map((e,o)=>e.toLowerCase()===r.toLowerCase()?t.createElement("mark",{key:o,className:h.suggestionItemHighlight,style:P.highlight},e):e)},[m.enabled,h.suggestionItemHighlight]),ce=t.useCallback(e=>e.highlightedQuery&&m.enabled?t.createElement("span",{dangerouslySetInnerHTML:{__html:e.highlightedQuery},style:{display:"inline"}}):le(e.query,o),[m.enabled,le,o]);if(!U&&!a)return null;const de=l&&0===o.length&&Z.length>0,ue=X.length>0,pe=p&&!G&&!de&&!ue&&o.length>=s,me=f.enabled?{opacity:a?1:0,transform:a?"translateY(0)":"translateY(-8px)",transition:`opacity ${f.duration}ms ease, transform ${f.duration}ms ease`}:{};return t.createElement("div",{ref:Q,role:"listbox","aria-label":N,"aria-expanded":a,className:k("seekora-suggestions-dropdown",h.root,h.container),style:{position:C,width:R,zIndex:I,...P.container,...me,...x}},G&&u&&t.createElement("div",{className:h.loadingState,style:P.loadingState},S?S():t.createElement(t.Fragment,null,t.createElement(L,null),t.createElement("span",null,"Searching..."))),!G&&de&&t.createElement("div",{className:k("seekora-suggestions-section",h.section,h.recentSearches)},t.createElement("div",{className:h.sectionTitle,style:P.sectionTitle},"Recent Searches"),Z.slice(0,c).map((e,r)=>{const o=V===r;return t.createElement("div",{key:`recent-${e.query}-${r}`,role:"option","aria-selected":o,className:k(h.recentItem,o&&h.suggestionItemActive),onClick:()=>{W?.(e)},onMouseEnter:()=>Y(r)},((e,r,o)=>v?v(e,r,o):t.createElement("div",{style:{...P.suggestionItem,...o?P.suggestionItemActive:{}}},t.createElement(B,{style:P.recentIcon}),t.createElement("span",{style:P.suggestionQuery},e.query),t.createElement("button",{type:"button",onClick:t=>{t.stopPropagation(),te(e.query),q?.(e)},style:{...P.removeButton,...o?P.removeButtonVisible:{}},"aria-label":`Remove ${e.query} from recent searches`},t.createElement($,null))))(e,r,o))})),!G&&de&&ue&&t.createElement("div",{style:P.divider}),!G&&ue&&t.createElement("div",{className:k("seekora-suggestions-section",h.section,h.suggestionsList)},o.length>0&&t.createElement("div",{className:h.sectionTitle,style:P.sectionTitle},"Suggestions"),X.map((e,r)=>{const a=de?Z.length+r:r,n=V===a;return t.createElement("div",{key:e.objectID||`suggestion-${r}`,role:"option","aria-selected":n,className:k(h.suggestionItem,n&&h.suggestionItemActive),onClick:()=>{A?.(e),ee(e.query,e.count)},onMouseEnter:()=>Y(a)},((e,r,a)=>b?b(e,r,a,e=>le(e,o)):t.createElement("div",{style:{...P.suggestionItem,...a?P.suggestionItemActive:{}}},t.createElement(_,{style:P.recentIcon}),t.createElement("span",{style:P.suggestionQuery},ce(e)),d&&void 0!==e.count&&t.createElement("span",{style:P.suggestionCount},e.count.toLocaleString())))(e,r,n))})),pe&&t.createElement("div",{className:h.emptyState,style:P.emptyState},E?E():t.createElement(t.Fragment,null,t.createElement(_,{style:{width:24,height:24,marginBottom:8,opacity:.5}}),t.createElement("span",null,'No suggestions found for "',o,'"'))),w||g.enabled&&oe.length>0?t.createElement("div",{className:h.footer,style:P.footer},w||t.createElement("div",{style:P.keyboardHint},t.createElement("span",{style:P.keyboardKey},"↑"),t.createElement("span",{style:P.keyboardKey},"↓"),t.createElement("span",null,"to navigate"),t.createElement("span",{style:P.keyboardKey},"↵"),t.createElement("span",null,"to select"),t.createElement("span",{style:P.keyboardKey},"esc"),t.createElement("span",null,"to close"))):null,t.createElement("style",null,'\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n .seekora-suggestions-dropdown mark {\n background-color: var(--seekora-highlight-bg, #fef3c7);\n font-weight: 600;\n padding: 0 2px;\n border-radius: 2px;\n }\n .seekora-suggestions-dropdown [role="option"]:hover button {\n opacity: 1;\n }\n '))}),q=[{id:"recent",title:"Recent Searches",maxItems:5,enabled:!0,order:1},{id:"suggestions",title:"Suggestions",maxItems:8,enabled:!0,order:2},{id:"trending",title:"Trending",maxItems:5,enabled:!0,order:3},{id:"categories",title:"Categories",maxItems:6,enabled:!1,order:4}],F={container:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius-lg, 12px)",boxShadow:"var(--seekora-shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04))",overflow:"hidden"},header:{padding:"12px 16px",borderBottom:"1px solid var(--seekora-border-color, #e5e7eb)",backgroundColor:"var(--seekora-bg-secondary, #f9fafb)"},content:{overflowY:"auto",overflowX:"hidden"},sectionHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px 4px"},sectionTitle:{fontSize:"11px",fontWeight:600,color:"var(--seekora-text-tertiary, #9ca3af)",textTransform:"uppercase",letterSpacing:"0.05em",margin:0},sectionAction:{fontSize:"12px",color:"var(--seekora-primary, #3b82f6)",cursor:"pointer",textDecoration:"none",fontWeight:500},item:{display:"flex",alignItems:"flex-start",padding:"10px 16px",cursor:"pointer",transition:"background-color 100ms ease",gap:"12px"},itemActive:{backgroundColor:"var(--seekora-bg-hover, #f3f4f6)"},itemIcon:{width:"18px",height:"18px",color:"var(--seekora-text-secondary, #6b7280)",flexShrink:0,marginTop:"2px"},itemContent:{flex:1,minWidth:0},itemQuery:{fontSize:"14px",color:"var(--seekora-text-primary, #111827)",fontWeight:500,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},itemCount:{fontSize:"12px",color:"var(--seekora-text-tertiary, #9ca3af)",flexShrink:0},categoriesContainer:{display:"flex",flexWrap:"wrap",gap:"6px",marginTop:"6px"},categoryPill:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"3px 8px",fontSize:"11px",fontWeight:500,color:"var(--seekora-text-secondary, #6b7280)",backgroundColor:"var(--seekora-bg-tertiary, #f3f4f6)",borderRadius:"12px",cursor:"pointer",transition:"all 100ms ease"},categoryPillHover:{backgroundColor:"var(--seekora-primary-light, #dbeafe)",color:"var(--seekora-primary, #3b82f6)"},categoryCount:{color:"var(--seekora-text-tertiary, #9ca3af)"},trendingList:{display:"flex",flexWrap:"wrap",gap:"8px",padding:"8px 16px"},trendingChip:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #374151)",backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"20px",cursor:"pointer",transition:"all 150ms ease"},trendingChipHover:{borderColor:"var(--seekora-primary, #3b82f6)",backgroundColor:"var(--seekora-primary-light, #eff6ff)"},trendingIcon:{width:"14px",height:"14px",color:"var(--seekora-success, #10b981)"},trendingRank:{width:"18px",height:"18px",borderRadius:"50%",backgroundColor:"var(--seekora-primary, #3b82f6)",color:"white",fontSize:"10px",fontWeight:600,display:"flex",alignItems:"center",justifyContent:"center"},removeButton:{padding:"4px",marginLeft:"auto",borderRadius:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--seekora-text-tertiary, #9ca3af)",opacity:0,transition:"opacity 100ms ease"},divider:{height:"1px",backgroundColor:"var(--seekora-border-color, #e5e7eb)",margin:"4px 16px"},footer:{padding:"12px 16px",borderTop:"1px solid var(--seekora-border-color, #e5e7eb)",backgroundColor:"var(--seekora-bg-secondary, #f9fafb)",fontSize:"12px",color:"var(--seekora-text-secondary, #6b7280)"},loadingOverlay:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.8)"},emptyState:{padding:"32px 16px",textAlign:"center",color:"var(--seekora-text-secondary, #6b7280)"},highlight:{backgroundColor:"var(--seekora-highlight-bg, #fef9c3)",fontWeight:600,borderRadius:"2px",padding:"0 1px"}},H=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:F.itemIcon},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),D=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:F.itemIcon},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),O=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:F.trendingIcon},t.createElement("path",{fillRule:"evenodd",d:"M12 7a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0V8.414l-4.293 4.293a1 1 0 01-1.414 0L8 10.414l-4.293 4.293a1 1 0 01-1.414-1.414l5-5a1 1 0 011.414 0L11 10.586 14.586 7H12z",clipRule:"evenodd"})),j=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{width:14,height:14}},t.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})),Q=t.forwardRef(function(e,r){const{query:o,isOpen:a=!0,sections:n=q,maxSuggestionsPerSection:s=8,minQueryLength:i=0,debounceMs:l=200,includeDropdownRecommendations:c=!0,includeCategories:d=!0,maxCategories:u=3,showCounts:p=!0,showCategoryCounts:m=!0,showSectionHeaders:g=!0,classNames:f={},style:h,renderSuggestion:x,renderCategory:b,renderTrendingItem:v,renderRecentItem:S,header:E,footer:w,width:C="100%",maxHeight:R="480px",zIndex:I=1e3,ariaLabel:z="Search suggestions",analyticsTags:T,onSuggestionSelect:N,onCategoryClick:A,onRecentSearchClick:P,onRecentSearchRemove:_,onViewAllClick:B,onOpen:$,onClose:L}=e,{client:W}=y(),Q=t.useRef(null),[V,Y]=t.useState(-1),[U,K]=t.useState(null),{suggestions:X,loading:G,trendingSearches:J,topSearches:Z,recentSearches:ee,addRecentSearch:te,removeRecentSearch:re,hasContent:oe}=M({client:W,query:o,enabled:a,debounceMs:l,maxSuggestions:s,minQueryLength:i,includeDropdownRecommendations:c,includeCategories:d,maxCategories:u,analyticsTags:T,enableRecentSearches:!0}),ae=t.useMemo(()=>n.filter(e=>!1!==e.enabled).sort((e,t)=>(e.order||0)-(t.order||0)),[n]),ne=e=>ae.find(t=>t.id===e),se=t.useMemo(()=>{const e=[];return ae.forEach((t,r)=>{switch(t.id){case"recent":0===o.length&&ee.slice(0,t.maxItems||5).forEach(t=>{e.push({type:"recent",data:t,sectionIndex:r})});break;case"suggestions":X.slice(0,t.maxItems||s).forEach(t=>{e.push({type:"suggestion",data:t,sectionIndex:r})});break;case"trending":0===o.length&&(J.length>0?J:Z).slice(0,t.maxItems||5).forEach(t=>{e.push({type:"trending",data:t,sectionIndex:r})})}}),e},[ae,o,ee,X,J,Z,s]),ie=t.useCallback(()=>{Y(e=>e<se.length-1?e+1:0)},[se.length]),le=t.useCallback(()=>{Y(e=>e>0?e-1:se.length-1)},[se.length]),ce=t.useCallback(()=>{if(V<0||V>=se.length)return;const e=se[V];switch(e.type){case"recent":P?.(e.data);break;case"suggestion":N?.(e.data),te(e.data.query,e.data.count);break;case"trending":N?.({query:e.data.query,count:e.data.count}),te(e.data.query)}},[V,se,P,N,te]);t.useImperativeHandle(r,()=>({getActiveIndex:()=>V,setActiveIndex:Y,selectActive:ce,navigateNext:ie,navigatePrevious:le,getTotalItems:()=>se.length}),[V,ce,ie,le,se.length]);const de=()=>{const e=ne("recent");return!e||o.length>0||0===ee.length?null:t.createElement("div",{className:k("seekora-section","seekora-section-recent",f.section)},g&&t.createElement("div",{style:F.sectionHeader},t.createElement("h3",{style:F.sectionTitle},e.title||"Recent Searches"),ee.length>(e.maxItems||5)&&t.createElement("button",{style:F.sectionAction,onClick:()=>B?.("recent")},"View all")),ee.slice(0,e.maxItems||5).map((e,r)=>{const o=((e,t)=>{let r=0;for(const o of se){if(ae[o.sectionIndex].id===e)return r+t;o.sectionIndex<ae.findIndex(t=>t.id===e)&&r++}return r+t})("recent",r),a=V===o;return t.createElement("div",{key:`recent-${e.query}`,role:"option","aria-selected":a,style:{...F.item,...a?F.itemActive:{}},onClick:()=>{P?.(e)},onMouseEnter:()=>Y(o),className:k(f.recentItem,a&&f.suggestionItemActive)},S?S(e):t.createElement(t.Fragment,null,t.createElement(D,null),t.createElement("div",{style:F.itemContent},t.createElement("p",{style:F.itemQuery},e.query)),t.createElement("button",{style:F.removeButton,onClick:t=>{t.stopPropagation(),re(e.query),_?.(e)},"aria-label":"Remove"},t.createElement(j,null))))}))},ue=()=>{const e=ne("suggestions");return e&&0!==X.length?t.createElement("div",{className:k("seekora-section","seekora-section-suggestions",f.section)},g&&o.length>0&&t.createElement("div",{style:F.sectionHeader},t.createElement("h3",{style:F.sectionTitle},e.title||"Suggestions")),X.slice(0,e.maxItems||s).map((e,r)=>{const a=se.findIndex((e,t)=>"suggestion"===e.type&&se.slice(0,t).filter(e=>"suggestion"===e.type).length===r),n=V===a;return t.createElement("div",{key:e.objectID||`suggestion-${r}`,role:"option","aria-selected":n,style:{...F.item,...n?F.itemActive:{}},onClick:()=>{N?.(e),te(e.query,e.count)},onMouseEnter:()=>Y(a),className:k(f.suggestionItem,n&&f.suggestionItemActive)},x?x(e,n):t.createElement(t.Fragment,null,t.createElement(H,null),t.createElement("div",{style:F.itemContent},t.createElement("p",{style:F.itemQuery},(s=e.query,o?s.split(new RegExp(`(${o})`,"gi")).map((e,r)=>e.toLowerCase()===o.toLowerCase()?t.createElement("span",{key:r,style:F.highlight},e):e):s)),d&&e.categories&&e.categories.length>0&&t.createElement("div",{style:F.categoriesContainer},e.categories.slice(0,u).map((e,r)=>b?b(e):t.createElement("span",{key:`cat-${r}`,style:{...F.categoryPill,...U===e.value?F.categoryPillHover:{}},onClick:t=>{t.stopPropagation(),A?.(e)},onMouseEnter:()=>K(e.value),onMouseLeave:()=>K(null)},e.value,m&&void 0!==e.count&&t.createElement("span",{style:F.categoryCount},"(",e.count,")"))))),p&&void 0!==e.count&&t.createElement("span",{style:F.itemCount},e.count.toLocaleString())));var s})):null};if(!a)return null;return oe||G||0===o.length?t.createElement("div",{ref:Q,role:"listbox","aria-label":z,className:k("seekora-rich-suggestions",f.root,f.container),style:{position:"absolute",width:C,zIndex:I,...F.container,...h}},E&&t.createElement("div",{style:F.header},E),t.createElement("div",{style:{...F.content,maxHeight:R}},G&&t.createElement("div",{style:F.loadingOverlay},t.createElement("span",null,"Loading...")),ae.map((e,r)=>{let a=null;switch(e.id){case"recent":a=de();break;case"suggestions":a=ue();break;case"trending":a=(()=>{const e=ne("trending"),r=J.length>0?J:Z;return!e||o.length>0||0===r.length?null:t.createElement("div",{className:k("seekora-section","seekora-section-trending",f.section)},g&&t.createElement("div",{style:F.sectionHeader},t.createElement("h3",{style:F.sectionTitle},e.title||"Trending")),t.createElement("div",{style:F.trendingList},r.slice(0,e.maxItems||5).map((e,r)=>{const o=se.findIndex((e,t)=>"trending"===e.type&&se.slice(0,t).filter(e=>"trending"===e.type).length===r),a=V===o;return v?v(e,r):t.createElement("button",{key:`trending-${e.query}`,style:{...F.trendingChip,...a?F.trendingChipHover:{}},onClick:()=>{N?.({query:e.query,count:e.count}),te(e.query)},onMouseEnter:()=>Y(o),className:k(f.trendingItem,a&&f.suggestionItemActive)},t.createElement("span",{style:F.trendingRank},r+1),t.createElement("span",null,e.query),t.createElement(O,null))})))})()}return a?t.createElement(t.Fragment,{key:e.id},r>0&&t.createElement("div",{style:F.divider}),a):null}),!G&&o.length>0&&0===X.length&&t.createElement("div",{style:F.emptyState},t.createElement("p",null,'No suggestions found for "',o,'"'))),w&&t.createElement("div",{style:F.footer},w),t.createElement("style",null,'\n .seekora-rich-suggestions [role="option"]:hover button {\n opacity: 1;\n }\n .seekora-rich-suggestions mark {\n background-color: var(--seekora-highlight-bg, #fef9c3);\n font-weight: 600;\n border-radius: 2px;\n padding: 0 1px;\n }\n ')):null}),V={container:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius-lg, 12px)",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",overflow:"hidden"},header:{padding:"12px 20px",borderBottom:"1px solid var(--seekora-border-color, #e5e7eb)",backgroundColor:"var(--seekora-bg-secondary, #f9fafb)"},content:{display:"flex",overflowY:"auto"},contentStacked:{flexDirection:"column"},suggestionsColumn:{borderRight:"1px solid var(--seekora-border-color, #e5e7eb)",overflowY:"auto"},productsColumn:{flex:1,overflowY:"auto",backgroundColor:"var(--seekora-bg-secondary, #fafafa)"},section:{padding:"12px 0"},sectionHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 20px 8px"},sectionTitle:{fontSize:"11px",fontWeight:700,color:"var(--seekora-text-tertiary, #9ca3af)",textTransform:"uppercase",letterSpacing:"0.08em",margin:0},viewAllLink:{fontSize:"12px",color:"var(--seekora-primary, #3b82f6)",textDecoration:"none",fontWeight:600,cursor:"pointer"},suggestionItem:{display:"flex",alignItems:"center",padding:"10px 20px",cursor:"pointer",transition:"background-color 100ms ease",gap:"12px"},suggestionItemActive:{backgroundColor:"var(--seekora-bg-hover, #f3f4f6)"},suggestionIcon:{width:"16px",height:"16px",color:"var(--seekora-text-secondary, #6b7280)",flexShrink:0},suggestionText:{flex:1,fontSize:"14px",color:"var(--seekora-text-primary, #111827)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},suggestionArrow:{width:"16px",height:"16px",color:"var(--seekora-text-tertiary, #d1d5db)",opacity:0,transition:"opacity 100ms ease"},suggestionArrowVisible:{opacity:1},suggestionCount:{fontSize:"12px",color:"var(--seekora-text-tertiary, #9ca3af)"},tabsContainer:{display:"flex",gap:"4px",padding:"12px 20px",borderBottom:"1px solid var(--seekora-border-color, #e5e7eb)",overflowX:"auto"},tab:{display:"flex",alignItems:"center",gap:"6px",padding:"8px 16px",fontSize:"13px",fontWeight:500,color:"var(--seekora-text-secondary, #6b7280)",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:"20px",cursor:"pointer",whiteSpace:"nowrap",transition:"all 150ms ease"},tabActive:{color:"var(--seekora-primary, #3b82f6)",backgroundColor:"var(--seekora-primary-light, #eff6ff)",borderColor:"var(--seekora-primary, #3b82f6)"},tabCount:{fontSize:"11px",fontWeight:600,padding:"2px 6px",borderRadius:"10px",backgroundColor:"var(--seekora-bg-tertiary, #e5e7eb)"},tabCountActive:{backgroundColor:"var(--seekora-primary, #3b82f6)",color:"white"},productsGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(140px, 1fr))",gap:"16px",padding:"16px 20px"},productCard:{display:"flex",flexDirection:"column",backgroundColor:"var(--seekora-bg-surface, #ffffff)",borderRadius:"8px",overflow:"hidden",cursor:"pointer",transition:"transform 150ms ease, box-shadow 150ms ease",border:"1px solid var(--seekora-border-color, #e5e7eb)"},productCardHover:{transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)"},productImage:{width:"100%",aspectRatio:"1",objectFit:"cover",backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)"},productInfo:{padding:"10px"},productTitle:{fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #111827)",margin:0,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",lineHeight:1.3},productPrice:{fontSize:"14px",fontWeight:700,color:"var(--seekora-primary, #3b82f6)",marginTop:"4px"},brandsGrid:{display:"flex",flexWrap:"wrap",gap:"8px",padding:"8px 20px 16px"},brandChip:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"8px 14px",fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #374151)",backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"8px",cursor:"pointer",transition:"all 150ms ease"},brandChipHover:{borderColor:"var(--seekora-primary, #3b82f6)",backgroundColor:"var(--seekora-primary-light, #eff6ff)"},brandLogo:{width:"20px",height:"20px",borderRadius:"4px",objectFit:"contain",backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)"},footer:{padding:"12px 20px",borderTop:"1px solid var(--seekora-border-color, #e5e7eb)",backgroundColor:"var(--seekora-bg-secondary, #f9fafb)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"12px",color:"var(--seekora-text-secondary, #6b7280)"},highlight:{backgroundColor:"var(--seekora-highlight-bg, #fef9c3)",fontWeight:600,padding:"0 2px",borderRadius:"2px"}},Y=({style:e})=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{...V.suggestionIcon,...e}},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),U=({style:e})=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{...V.suggestionIcon,...e}},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),K=({style:e})=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{...V.suggestionArrow,...e}},t.createElement("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})),X=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",style:{width:"40%",height:"40%",color:"#d1d5db"}},t.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2",strokeWidth:"2"}),t.createElement("circle",{cx:"8.5",cy:"8.5",r:"1.5",strokeWidth:"2"}),t.createElement("polyline",{points:"21 15 16 10 5 21",strokeWidth:"2"})),G=t.forwardRef(function(e,r){const{query:o,isOpen:a=!0,maxSuggestions:n=8,maxProducts:s=8,maxBrands:i=8,minQueryLength:l=0,debounceMs:c=200,filteredTabs:d,showProducts:u=!0,showBrands:p=!0,showFilteredTabs:m=!0,showRecentSearches:g=!0,layout:f="side-by-side",productsColumnWidth:h="60%",suggestionsColumnWidth:x="40%",showPrices:b=!0,currencySymbol:v="$",classNames:S={},style:E,renderProduct:w,renderSuggestion:C,renderBrand:R,renderTab:I,header:z,footer:T,viewAllProductsLink:N,width:A="800px",maxHeight:P="600px",zIndex:_=1e3,analyticsTags:B,onSuggestionSelect:$,onProductClick:L,onBrandClick:W,onTabSelect:q,onRecentSearchClick:F,onRecentSearchRemove:H,onViewAllClick:D,onOpen:O,onClose:j}=e,{client:Q}=y(),G=t.useRef(null),[J,Z]=t.useState(-1),[ee,te]=t.useState("all"),[re,oe]=t.useState(null),[ae,ne]=t.useState(null),{suggestions:se,loading:ie,filteredTabs:le,trendingProducts:ce,popularBrands:de,recentSearches:ue,addRecentSearch:pe,removeRecentSearch:me,hasContent:ge}=M({client:Q,query:o,enabled:a,debounceMs:c,maxSuggestions:n,minQueryLength:l,includeDropdownRecommendations:!0,filteredTabs:d,analyticsTags:B,enableRecentSearches:g}),fe=t.useMemo(()=>{if("all"===ee){const e=[...ce];return le.forEach(t=>{t.products&&t.products.forEach(t=>{e.find(e=>e.id===t.id)||e.push(t)})}),e.slice(0,s)}const e=le.find(e=>e.id===ee);return e?.products?.slice(0,s)||[]},[ee,le,ce,s]),he=t.useMemo(()=>{const e=[];return 0===o.length&&g&&ue.slice(0,5).forEach(t=>{e.push({type:"recent",data:t})}),se.forEach(t=>{e.push({type:"suggestion",data:t})}),e},[o,g,ue,se]),ye=t.useCallback(()=>{Z(e=>e<he.length-1?e+1:0)},[he.length]),xe=t.useCallback(()=>{Z(e=>e>0?e-1:he.length-1)},[he.length]),be=t.useCallback(()=>{if(J<0||J>=he.length)return;const e=he[J];"recent"===e.type?F?.(e.data):"suggestion"===e.type&&($?.(e.data),pe(e.data.query))},[J,he,F,$,pe]);t.useImperativeHandle(r,()=>({getActiveIndex:()=>J,setActiveIndex:Z,selectActive:be,navigateNext:ye,navigatePrevious:xe,getActiveTab:()=>ee,setActiveTab:te}),[J,be,ye,xe,ee]);const ve=e=>{te(e);const t=le.find(t=>t.id===e);t&&q?.(t)};if(!a)return null;const ke=m&&(le.length>0||ce.length>0),Se=u&&fe.length>0,Ee=p&&de.length>0,we=g&&0===o.length&&ue.length>0,Ce=se.length>0,Re="stacked"===f||"full-width"===f;return t.createElement("div",{ref:G,role:"listbox","aria-label":"Search suggestions and products",className:k("seekora-federated-dropdown",S.root,S.container),style:{position:"absolute",width:A,zIndex:_,...V.container,...E}},z&&t.createElement("div",{style:V.header},z),ke&&t.createElement("div",{style:V.tabsContainer,className:S.tabsList},t.createElement("button",{style:{...V.tab,..."all"===ee?V.tabActive:{}},onClick:()=>ve("all"),className:k(S.tabItem,"all"===ee&&S.tabActive)},"All Results",ce.length>0&&t.createElement("span",{style:{...V.tabCount,..."all"===ee?V.tabCountActive:{}}},ce.length,"+")),le.map(e=>I?I(e,ee===e.id):t.createElement("button",{key:e.id,style:{...V.tab,...ee===e.id?V.tabActive:{}},onClick:()=>ve(e.id),className:k(S.tabItem,ee===e.id&&S.tabActive)},e.label,void 0!==e.nb_hits&&t.createElement("span",{style:{...V.tabCount,...ee===e.id?V.tabCountActive:{}}},e.nb_hits)))),t.createElement("div",{style:{...V.content,...Re?V.contentStacked:{},maxHeight:P}},t.createElement("div",{style:{...V.suggestionsColumn,width:Re?"100%":x,minWidth:Re?void 0:"280px",borderRight:Re?"none":V.suggestionsColumn.borderRight}},we&&t.createElement("div",{style:V.section,className:S.recentSearches},t.createElement("div",{style:V.sectionHeader},t.createElement("h3",{style:V.sectionTitle},"Recent Searches")),ue.slice(0,5).map((e,r)=>{const o=J===r;return t.createElement("div",{key:`recent-${e.query}`,role:"option","aria-selected":o,style:{...V.suggestionItem,...o?V.suggestionItemActive:{}},onClick:()=>F?.(e),onMouseEnter:()=>Z(r),className:k(S.recentItem,o&&S.suggestionItemActive)},t.createElement(U,null),t.createElement("span",{style:V.suggestionText},e.query),t.createElement(K,{style:o?V.suggestionArrowVisible:{}}))})),Ce&&t.createElement("div",{style:V.section,className:S.suggestionsList},t.createElement("div",{style:V.sectionHeader},t.createElement("h3",{style:V.sectionTitle},o?"Suggestions":"Popular Searches")),se.slice(0,n).map((e,r)=>{const a=we?ue.length+r:r,n=J===a;return C?C(e,r,n):t.createElement("div",{key:e.objectID||`suggestion-${r}`,role:"option","aria-selected":n,style:{...V.suggestionItem,...n?V.suggestionItemActive:{}},onClick:()=>{$?.(e),pe(e.query)},onMouseEnter:()=>Z(a),className:k(S.suggestionItem,n&&S.suggestionItemActive)},t.createElement(Y,null),t.createElement("span",{style:V.suggestionText},(s=e.query,o?s.split(new RegExp(`(${o})`,"gi")).map((e,r)=>e.toLowerCase()===o.toLowerCase()?t.createElement("span",{key:r,style:V.highlight},e):e):s)),void 0!==e.count&&t.createElement("span",{style:V.suggestionCount},e.count.toLocaleString()),t.createElement(K,{style:n?V.suggestionArrowVisible:{}}));var s})),Ee&&t.createElement("div",{style:V.section,className:S.brandsList},t.createElement("div",{style:V.sectionHeader},t.createElement("h3",{style:V.sectionTitle},"Popular Brands")),t.createElement("div",{style:V.brandsGrid},de.slice(0,i).map((e,r)=>R?R(e,r):t.createElement("button",{key:`brand-${e.name}`,style:{...V.brandChip,...ae===e.name?V.brandChipHover:{}},onClick:()=>W?.(e),onMouseEnter:()=>ne(e.name),onMouseLeave:()=>ne(null),className:S.brandItem},e.logo&&t.createElement("img",{src:e.logo,alt:e.name,style:V.brandLogo,onError:e=>{e.target.style.display="none"}}),t.createElement("span",null,e.name)))))),Se&&!Re&&t.createElement("div",{style:{...V.productsColumn,width:h}},t.createElement("div",{style:V.section},t.createElement("div",{style:V.sectionHeader},t.createElement("h3",{style:V.sectionTitle},"all"===ee?"Trending Products":`Products in ${le.find(e=>e.id===ee)?.label||ee}`),N&&t.createElement("a",{href:N,style:V.viewAllLink,onClick:e=>{e.preventDefault(),D?.("products")}},"View all")),t.createElement("div",{style:V.productsGrid,className:S.productsList},fe.map((e,r)=>{return w?w(e,r):t.createElement("div",{key:e.id||e.objectID,style:{...V.productCard,...re===e.id?V.productCardHover:{}},onClick:()=>L?.(e),onMouseEnter:()=>oe(e.id),onMouseLeave:()=>oe(null),className:S.productItem},e.image?t.createElement("img",{src:e.image,alt:e.title||e.name||"",style:V.productImage,onError:e=>{e.target.style.display="none"}}):t.createElement("div",{style:{...V.productImage,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement(X,null)),t.createElement("div",{style:V.productInfo},t.createElement("h4",{style:V.productTitle},e.title||e.name),b&&void 0!==e.price&&t.createElement("p",{style:V.productPrice},(o=e.price,a=e.currency,void 0===o?"":`${a||v}${o.toLocaleString()}`))));var o,a}))))),T?t.createElement("div",{style:V.footer},T):t.createElement("div",{style:V.footer},t.createElement("span",null,"Press ↵ to search, ↑↓ to navigate"),o&&t.createElement("button",{style:{...V.viewAllLink,background:"none",border:"none"},onClick:()=>D?.("suggestions")},'See all results for "',o,'"')),t.createElement("style",null,'\n .seekora-federated-dropdown mark {\n background-color: var(--seekora-highlight-bg, #fef9c3);\n font-weight: 600;\n border-radius: 2px;\n padding: 0 2px;\n }\n .seekora-federated-dropdown [role="option"]:hover svg:last-child {\n opacity: 1;\n }\n '))}),J="suggestions.click",Z="suggestions.impression",ee="suggestions.product_click",te="suggestions.category_click",re="suggestions.brand_click",oe="suggestions.tab_select",ae="suggestions.recent_click",ne="suggestions.trending_click",se="suggestions.search_submit",ie="suggestions.dropdown_open",le="suggestions.dropdown_close";function ce(e){const{client:r,enabled:o=!0,analyticsTags:a=[],impressionDebounce:n=500,trackImpressions:i=!0,trackClicks:c=!0}=e,d=t.useRef(null),u=t.useRef(null),p=t.useRef(null);t.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const m=t.useCallback(async(e,t)=>{if(o&&r)try{await(r.trackEvent?.({event_name:e,analytics_tags:a,metadata:{...t,timestamp:Date.now(),source:"suggestions_dropdown"}})),s(`Analytics: ${e}`,t)}catch(t){l(`Failed to track ${e}`,{error:t})}},[r,o,a]);return{trackSuggestionClick:t.useCallback(e=>{c&&m(J,{suggestion_query:e.suggestion.query,suggestion_id:e.suggestion.objectID,suggestion_popularity:e.suggestion.popularity,position:e.position,section:e.section||"suggestions",original_query:e.query,total_suggestions:e.totalSuggestions})},[m,c]),trackProductClick:t.useCallback(e=>{c&&(m(ee,{product_id:e.product.id||e.product.objectID,product_title:e.product.title||e.product.name,product_price:e.product.price,position:e.position,section:e.section||"products",tab_id:e.tabId,original_query:e.query}),r&&Promise.resolve(r.trackClick?.(e.product.id||e.product.objectID||"",e.position+1)).catch(()=>{}))},[r,m,c]),trackCategoryClick:t.useCallback((e,t)=>{c&&m(te,{category_value:e.value,category_count:e.count,category_path:e.path,original_query:t})},[m,c]),trackBrandClick:t.useCallback((e,t)=>{c&&m(re,{brand_name:e.name,brand_count:e.count,original_query:t})},[m,c]),trackTabSelect:t.useCallback((e,t)=>{m(oe,{tab_id:e.id,tab_label:e.label,tab_filter:e.filter,products_count:e.products?.length||0,nb_hits:e.nb_hits,original_query:t})},[m]),trackRecentSearchClick:t.useCallback(e=>{c&&m(ae,{query:e.query,original_timestamp:e.timestamp,results_count:e.resultsCount})},[m,c]),trackTrendingClick:t.useCallback((e,t)=>{c&&m(ne,{query:e.query,count:e.count,trend_score:e.trend_score,position:t})},[m,c]),trackImpression:t.useCallback(e=>{if(!i)return;const t=`${e.query}:${e.suggestions.length}:${e.products?.length||0}`;t!==u.current&&(d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{u.current=t,m(Z,{query:e.query,suggestions_count:e.suggestions.length,suggestions:e.suggestions.slice(0,10).map((e,t)=>({query:e.query,position:t,popularity:e.popularity})),products_count:e.products?.length||0,categories_count:e.categories?.length||0,brands_count:e.brands?.length||0,impression_timestamp:e.timestamp})},n))},[m,i,n]),trackSearchSubmit:t.useCallback((e,t,r)=>{m(se,{query:e,from_suggestion:t,suggestion_query:r?.query,suggestion_id:r?.objectID,suggestion_popularity:r?.popularity})},[m]),trackDropdownOpen:t.useCallback(e=>{p.current=Date.now(),m(ie,{query:e,has_query:e.length>0})},[m]),trackDropdownClose:t.useCallback((e,t)=>{const r=p.current?Date.now()-p.current:null;m(le,{query:e,selected_suggestion:t,had_selection:!!t,duration_ms:r}),p.current=null},[m])}}const de={wrapper:{position:"relative",width:"100%"},inputWrapper:{display:"flex",alignItems:"center",backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius-lg, 8px)",overflow:"hidden",transition:"border-color 150ms ease, box-shadow 150ms ease"},inputWrapperFocused:{borderColor:"var(--seekora-primary, #3b82f6)",boxShadow:"0 0 0 3px var(--seekora-primary-light, rgba(59, 130, 246, 0.1))"},input:{flex:1,padding:"12px 16px",fontSize:"16px",border:"none",outline:"none",backgroundColor:"transparent",color:"var(--seekora-text-primary, #111827)",fontFamily:"inherit"},searchIcon:{width:"20px",height:"20px",color:"var(--seekora-text-secondary, #9ca3af)",marginLeft:"12px",flexShrink:0},clearButton:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",marginRight:"4px",padding:0,border:"none",backgroundColor:"transparent",color:"var(--seekora-text-secondary, #9ca3af)",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms ease, color 150ms ease"},searchButton:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"12px 20px",margin:"4px",border:"none",backgroundColor:"var(--seekora-primary, #3b82f6)",color:"white",borderRadius:"var(--seekora-border-radius, 6px)",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"background-color 150ms ease"}},ue=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:de.searchIcon},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),pe=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{width:16,height:16}},t.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})),me=t.forwardRef(function(e,r){const{variant:o="classic",placeholder:a="Search...",initialQuery:n="",value:s,onQueryChange:i,onSearch:l,onSuggestionSelect:c,onProductClick:d,showSearchButton:u=!1,searchButtonText:p="Search",showClearButton:m=!0,autoFocus:g=!1,minQueryLength:f=1,maxSuggestions:h=8,debounceMs:x=200,showRecentSearches:b=!0,showTrendingOnEmpty:v=!0,includeDropdownRecommendations:S=!1,filteredTabs:E,enableAnalytics:w=!0,analyticsTags:C,dropdownWidth:R,dropdownMaxHeight:I,classNames:z={},style:T,inputStyle:N,ariaLabel:A="Search"}=e,{client:M}=y(),P=t.useRef(null),_=t.useRef(null),[B,$]=t.useState(s??n),[L,q]=t.useState(!1),[F,H]=t.useState(!1),D=ce({client:M,enabled:w,analyticsTags:C});t.useEffect(()=>{void 0!==s&&s!==B&&$(s)},[s]);const O=t.useCallback(e=>{const t=e.target.value;$(t),i?.(t),(t.length>=f||v&&0===t.length)&&H(!0)},[i,f,v]),j=t.useCallback(e=>{e?.preventDefault(),B.trim()&&(l?.(B.trim()),D.trackSearchSubmit(B.trim(),!1),H(!1))},[B,l,D]),V=t.useCallback(e=>{$(e.query),i?.(e.query),c?.(e),D.trackSuggestionClick({suggestion:e,position:0,query:B}),H(!1),l?.(e.query)},[B,i,c,l,D]),Y=t.useCallback(e=>{d?.(e),D.trackProductClick({product:e,position:0,query:B}),H(!1)},[B,d,D]),U=t.useCallback(e=>{$(e.query),i?.(e.query),D.trackRecentSearchClick(e),H(!1),l?.(e.query)},[i,l,D]),K=t.useCallback(()=>{q(!0),H(!0),D.trackDropdownOpen(B)},[B,D]),X=t.useCallback(()=>{q(!1),setTimeout(()=>{H(!1),D.trackDropdownClose(B)},200)},[B,D]),J=t.useCallback(()=>{$(""),i?.(""),P.current?.focus()},[i]),Z=t.useCallback(e=>{if(F)switch(e.key){case"ArrowDown":e.preventDefault(),_.current?.navigateNext?.();break;case"ArrowUp":e.preventDefault(),_.current?.navigatePrevious?.();break;case"Enter":e.preventDefault(),(_.current?.getActiveIndex?.()??-1)>=0?_.current?.selectActive?.():j();break;case"Escape":e.preventDefault(),H(!1),P.current?.blur()}else"ArrowDown"!==e.key&&"ArrowUp"!==e.key||H(!0)},[F,j]);t.useImperativeHandle(r,()=>({focus:()=>P.current?.focus(),blur:()=>P.current?.blur(),clear:J,getQuery:()=>B,setQuery:e=>{$(e),i?.(e)},openDropdown:()=>H(!0),closeDropdown:()=>H(!1),navigateNext:()=>_.current?.navigateNext?.(),navigatePrevious:()=>_.current?.navigatePrevious?.(),selectCurrent:()=>_.current?.selectActive?.()}),[B,J,i]);return t.createElement("div",{className:k("seekora-search-bar-with-suggestions",z.wrapper),style:{...de.wrapper,...T}},t.createElement("form",{onSubmit:j},t.createElement("div",{style:{...de.inputWrapper,...L?de.inputWrapperFocused:{}}},t.createElement(ue,null),t.createElement("input",{ref:P,type:"text",value:B,onChange:O,onFocus:K,onBlur:X,onKeyDown:Z,placeholder:a,autoFocus:g,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":A,"aria-expanded":F,"aria-haspopup":"listbox","aria-autocomplete":"list",role:"combobox",className:z.input,style:{...de.input,...N}}),m&&B&&t.createElement("button",{type:"button",onClick:J,className:z.clearButton,style:de.clearButton,"aria-label":"Clear search"},t.createElement(pe,null)),u&&t.createElement("button",{type:"submit",className:z.button,style:de.searchButton},p))),t.createElement("div",{className:z.dropdown},(()=>{const e={query:B,isOpen:F,maxSuggestions:h,minQueryLength:f,debounceMs:x,showRecentSearches:b,classNames:z,onSuggestionSelect:V,onRecentSearchClick:U,onClose:()=>H(!1),analyticsTags:C};switch(o){case"rich":return t.createElement(Q,{ref:_,...e,includeDropdownRecommendations:S,includeCategories:!0,width:R||"100%",maxHeight:I||"480px"});case"federated":return t.createElement(G,{ref:_,...e,filteredTabs:E,showProducts:!0,showBrands:!0,showFilteredTabs:!!E,onProductClick:Y,width:R||"800px",maxHeight:I||"600px"});case"compact":return t.createElement(W,{ref:_,...e,maxSuggestions:5,showCounts:!1,width:R||"100%"});default:return t.createElement(W,{ref:_,...e,width:R||"100%"})}})()))}),ge=(e,t)=>{if(e&&t)return t.split(".").reduce((e,t)=>{if(null!=e)return e[t]},e)},fe=(e,t={query:"query"})=>({query:ge(e,t.query)??"",count:t.count?ge(e,t.count):void 0,id:t.id?ge(e,t.id):e?.objectID||e?.id,categories:t.categories?ge(e,t.categories):void 0,highlighted:t.highlighted?ge(e,t.highlighted):void 0,_raw:e}),he=(e,t={id:"id",title:"title"})=>({id:ge(e,t.id)??e?.objectID??e?.id,title:ge(e,t.title)??"",image:t.image?ge(e,t.image):void 0,price:t.price?ge(e,t.price):void 0,comparePrice:t.comparePrice?ge(e,t.comparePrice):void 0,url:t.url?ge(e,t.url):void 0,brand:t.brand?ge(e,t.brand):void 0,category:t.category?ge(e,t.category):void 0,rating:t.rating?ge(e,t.rating):void 0,reviewCount:t.reviewCount?ge(e,t.reviewCount):void 0,discount:t.discount?ge(e,t.discount):void 0,inStock:t.inStock?ge(e,t.inStock):void 0,currency:t.currency?ge(e,t.currency):void 0,_raw:e}),ye=(e,t={id:"id",label:"label"})=>({id:ge(e,t.id)??e?.id,label:ge(e,t.label)??"",count:t.count?ge(e,t.count):void 0,icon:t.icon?ge(e,t.icon):void 0,image:t.image?ge(e,t.image):void 0,_raw:e}),xe=(e,t={})=>{if(null==e)return"";const{currency:r="$",currencyPosition:o="before",priceDecimals:a=2}=t,n="string"==typeof e?parseFloat(e):e;if(isNaN(n))return String(e);const s=n.toLocaleString(void 0,{minimumFractionDigits:a,maximumFractionDigits:a});return"before"===o?`${r}${s}`:`${s}${r}`},be=e=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return e.replace(/[&<>"']/g,e=>t[e])},ve=(e,t,r={})=>{if(!t||!e)return be(e);const{tag:o="mark",className:a="",style:n}=r,s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=n?` style="${Object.entries(n).map(([e,t])=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${t}`).join(";")}"`:"",l=a?` class="${a}"`:"";return be(e).replace(new RegExp(`(${be(s)})`,"gi"),`<${o}${l}${i}>$1</${o}>`)},ke=(e,t="seekora")=>{const r={};return e.primaryColor&&(r[`--${t}-primary`]=e.primaryColor),e.backgroundColor&&(r[`--${t}-bg-surface`]=e.backgroundColor),e.surfaceColor&&(r[`--${t}-bg-secondary`]=e.surfaceColor),e.textColor&&(r[`--${t}-text-primary`]=e.textColor),e.textSecondaryColor&&(r[`--${t}-text-secondary`]=e.textSecondaryColor),e.borderColor&&(r[`--${t}-border-color`]=e.borderColor),e.hoverColor&&(r[`--${t}-bg-hover`]=e.hoverColor),e.highlightColor&&(r[`--${t}-highlight-bg`]=e.highlightColor),e.successColor&&(r[`--${t}-success`]=e.successColor),e.errorColor&&(r[`--${t}-error`]=e.errorColor),e.fontFamily&&(r[`--${t}-font-family`]=e.fontFamily),e.fontSize&&(r[`--${t}-font-size`]="number"==typeof e.fontSize?`${e.fontSize}px`:e.fontSize),e.borderRadius&&(r[`--${t}-border-radius`]="number"==typeof e.borderRadius?`${e.borderRadius}px`:e.borderRadius),e.boxShadow&&(r[`--${t}-box-shadow`]=e.boxShadow),e.cssVariables&&Object.entries(e.cssVariables).forEach(([e,t])=>{r[e.startsWith("--")?e:`--${e}`]=t}),r},Se=(...e)=>e.filter(Boolean).join(" "),Ee=(...e)=>Object.assign({},...e.filter(Boolean)),we="seekora_recent_searches",Ce=e=>{try{const t=e?`${we}_${e}`:we,r=localStorage.getItem(t);return r?JSON.parse(r):[]}catch{return[]}},Re=(e,t)=>{try{const r=t?`${we}_${t}`:we;let o=Ce(t);return o=o.filter(t=>t!==e),o.unshift(e),o=o.slice(0,10),localStorage.setItem(r,JSON.stringify(o)),o}catch{return[]}},Ie=(e,t)=>{try{const r=t?`${we}_${t}`:we;let o=Ce(t);return o=o.filter(t=>t!==e),localStorage.setItem(r,JSON.stringify(o)),o}catch{return[]}},ze=(e,t)=>{const r=e.getBoundingClientRect(),o=t.getBoundingClientRect();r.top<o.top?e.scrollIntoView({block:"start",behavior:"smooth"}):r.bottom>o.bottom&&e.scrollIntoView({block:"end",behavior:"smooth"})};class Te{constructor(e={}){this.cache=new Map,this.maxSize=e.maxSize??100,this.defaultTtl=e.defaultTtlMs??3e4}generateKey(e,t){const r=e.toLowerCase().trim();if(!t)return r;const o=Object.keys(t).sort().filter(e=>void 0!==t[e]&&null!==t[e]).map(e=>`${e}:${JSON.stringify(t[e])}`).join("|");return o?`${r}::${o}`:r}get(e){const t=this.cache.get(e);if(!t)return null;return Date.now()-t.timestamp>t.ttl?(this.cache.delete(e),null):t.data}set(e,t,r){if(this.cache.size>=this.maxSize){const e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(e,{data:t,timestamp:Date.now(),ttl:r??this.defaultTtl})}has(e){return null!==this.get(e)}clear(){this.cache.clear()}cleanup(){const e=Date.now();for(const[t,r]of this.cache.entries())e-r.timestamp>r.ttl&&this.cache.delete(t)}getStats(){return{size:this.cache.size,maxSize:this.maxSize}}}let Ne=null;const Ae=e=>(Ne||(Ne=new Te(e)),Ne),Me={xs:0,sm:480,md:768,lg:1024,xl:1280},Pe={xs:`@media (max-width: ${Me.sm-1}px)`,sm:`@media (min-width: ${Me.sm}px) and (max-width: ${Me.md-1}px)`,md:`@media (min-width: ${Me.md}px) and (max-width: ${Me.lg-1}px)`,lg:`@media (min-width: ${Me.lg}px) and (max-width: ${Me.xl-1}px)`,xl:`@media (min-width: ${Me.xl}px)`,mobile:`@media (max-width: ${Me.md-1}px)`,tablet:`@media (min-width: ${Me.md}px) and (max-width: ${Me.lg-1}px)`,desktop:`@media (min-width: ${Me.lg}px)`,touch:"@media (hover: none) and (pointer: coarse)",mouse:"@media (hover: hover) and (pointer: fine)"},_e={minimum:44,comfortable:48,large:56},Be=()=>{const[e,r]=t.useState({isMobile:!1,isTablet:!1,isDesktop:!0,isTouch:!1,width:"undefined"!=typeof window?window.innerWidth:1024,height:"undefined"!=typeof window?window.innerHeight:768,breakpoint:"lg"});return t.useEffect(()=>{if("undefined"==typeof window)return;const e=()=>{const e=window.innerWidth,t=window.innerHeight,o=(e=>e<Me.sm?"xs":e<Me.md?"sm":e<Me.lg?"md":e<Me.xl?"lg":"xl")(e),a="ontouchstart"in window||navigator.maxTouchPoints>0;r({isMobile:e<Me.md,isTablet:e>=Me.md&&e<Me.lg,isDesktop:e>=Me.lg,isTouch:a,width:e,height:t,breakpoint:o})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e};let $e=!1;const Le=()=>{if($e)return;if("undefined"==typeof document)return;const e="seekora-dropdown-responsive-global";if(document.getElementById(e))return void($e=!0);const t=document.createElement("style");t.id=e,t.textContent='\n/* ============================================\n SEEKORA DROPDOWN - RESPONSIVE STYLES\n ============================================ */\n\n/* CSS Variables for responsiveness */\n:root {\n --seekora-touch-target-min: 44px;\n --seekora-touch-target-comfortable: 48px;\n --seekora-mobile-padding: 16px;\n --seekora-desktop-padding: 20px;\n}\n\n/* Base responsive rules for all dropdowns */\n[class*="seekora-"][class*="-dropdown"] {\n box-sizing: border-box;\n}\n\n[class*="seekora-"][class*="-dropdown"] * {\n box-sizing: border-box;\n}\n\n/* ============================================\n MOBILE STYLES (< 768px)\n ============================================ */\n@media (max-width: 767px) {\n /* Full-width dropdowns on mobile */\n [class*="seekora-"][class*="-dropdown"]:not(.seekora-mobile-sheet):not(.seekora-spotlight-dropdown) {\n width: 100% !important;\n max-width: 100vw !important;\n left: 0 !important;\n right: 0 !important;\n border-radius: 0 !important;\n margin: 0 !important;\n }\n\n /* Touch-friendly item sizes */\n [class*="seekora-"][class*="-dropdown"] [role="option"],\n [class*="seekora-"][class*="-dropdown"] [data-item],\n [class*="seekora-"][class*="-dropdown"] .suggestion-item,\n [class*="seekora-"][class*="-dropdown"] .product-card {\n min-height: var(--seekora-touch-target-min);\n }\n\n /* Larger padding on mobile */\n [class*="seekora-"][class*="-dropdown"] [role="option"],\n [class*="seekora-"][class*="-dropdown"] [data-item] {\n padding: 14px var(--seekora-mobile-padding) !important;\n }\n\n /* Larger fonts on mobile for readability */\n [class*="seekora-"][class*="-dropdown"] {\n font-size: 16px !important;\n }\n\n /* Stack columns on mobile */\n [class*="seekora-"][class*="-dropdown"] .dropdown-content,\n [class*="seekora-"][class*="-dropdown"] [style*="display: flex"][style*="flex-direction"] {\n flex-direction: column !important;\n }\n\n /* Full-width columns on mobile */\n [class*="seekora-"][class*="-dropdown"] [style*="width: 40%"],\n [class*="seekora-"][class*="-dropdown"] [style*="width: 45%"],\n [class*="seekora-"][class*="-dropdown"] [style*="width: 50%"],\n [class*="seekora-"][class*="-dropdown"] [style*="width: 55%"],\n [class*="seekora-"][class*="-dropdown"] [style*="width: 60%"] {\n width: 100% !important;\n flex: none !important;\n }\n\n /* Product grid adjustments */\n [class*="seekora-"][class*="-dropdown"] .products-grid,\n [class*="seekora-"][class*="-dropdown"] [style*="grid-template-columns"] {\n grid-template-columns: repeat(2, 1fr) !important;\n gap: 12px !important;\n }\n\n /* Horizontal scroll for products on mobile */\n [class*="seekora-"][class*="-dropdown"] .products-scroll {\n display: flex !important;\n overflow-x: auto !important;\n scroll-snap-type: x mandatory !important;\n -webkit-overflow-scrolling: touch !important;\n padding-bottom: 8px !important;\n }\n\n [class*="seekora-"][class*="-dropdown"] .products-scroll > * {\n scroll-snap-align: start !important;\n flex-shrink: 0 !important;\n }\n\n /* Hide keyboard hints on mobile */\n [class*="seekora-"][class*="-dropdown"] .keyboard-hint,\n [class*="seekora-"][class*="-dropdown"] [class*="keyboard"],\n [class*="seekora-"][class*="-dropdown"] kbd,\n [class*="seekora-"][class*="-dropdown"] .kbd {\n display: none !important;\n }\n\n /* Safe area padding for notched devices */\n [class*="seekora-"][class*="-dropdown"] [style*="padding-bottom"] {\n padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px) !important;\n }\n}\n\n/* ============================================\n TOUCH DEVICE STYLES\n ============================================ */\n@media (hover: none) and (pointer: coarse) {\n /* Active state instead of hover for touch */\n [class*="seekora-"][class*="-dropdown"] [role="option"]:active,\n [class*="seekora-"][class*="-dropdown"] [data-item]:active,\n [class*="seekora-"][class*="-dropdown"] button:active {\n background-color: var(--seekora-bg-hover, rgba(0,0,0,0.05)) !important;\n transform: scale(0.98);\n }\n\n /* Disable hover effects on touch */\n [class*="seekora-"][class*="-dropdown"] [role="option"]:hover,\n [class*="seekora-"][class*="-dropdown"] [data-item]:hover {\n background-color: transparent;\n }\n\n /* Larger touch targets */\n [class*="seekora-"][class*="-dropdown"] button,\n [class*="seekora-"][class*="-dropdown"] [role="button"] {\n min-height: var(--seekora-touch-target-min);\n min-width: var(--seekora-touch-target-min);\n }\n\n /* No text selection on touch */\n [class*="seekora-"][class*="-dropdown"] {\n -webkit-user-select: none;\n user-select: none;\n }\n}\n\n/* ============================================\n TABLET STYLES (768px - 1023px)\n ============================================ */\n@media (min-width: 768px) and (max-width: 1023px) {\n [class*="seekora-"][class*="-dropdown"]:not(.seekora-mobile-sheet) {\n max-width: 90vw !important;\n margin-left: auto !important;\n margin-right: auto !important;\n }\n\n /* 3-column product grid on tablet */\n [class*="seekora-"][class*="-dropdown"] .products-grid {\n grid-template-columns: repeat(3, 1fr) !important;\n }\n}\n\n/* ============================================\n DESKTOP STYLES (>= 1024px)\n ============================================ */\n@media (min-width: 1024px) {\n [class*="seekora-"][class*="-dropdown"] [role="option"],\n [class*="seekora-"][class*="-dropdown"] [data-item] {\n min-height: 40px;\n }\n\n /* Hover effects only on desktop */\n [class*="seekora-"][class*="-dropdown"] [role="option"]:hover,\n [class*="seekora-"][class*="-dropdown"] [data-item]:hover {\n background-color: var(--seekora-bg-hover, rgba(0,0,0,0.04));\n }\n}\n\n/* ============================================\n ANIMATION & TRANSITIONS\n ============================================ */\n@keyframes seekora-dropdown-enter {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes seekora-dropdown-enter-mobile {\n from {\n opacity: 0;\n transform: translateY(100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes seekora-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n[class*="seekora-"][class*="-dropdown"].entering {\n animation: seekora-dropdown-enter 200ms ease-out;\n}\n\n@media (max-width: 767px) {\n [class*="seekora-"][class*="-dropdown"].entering {\n animation: seekora-dropdown-enter-mobile 300ms ease-out;\n }\n}\n\n/* ============================================\n ACCESSIBILITY\n ============================================ */\n@media (prefers-reduced-motion: reduce) {\n [class*="seekora-"][class*="-dropdown"],\n [class*="seekora-"][class*="-dropdown"] * {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n }\n}\n\n/* Focus visible styles */\n[class*="seekora-"][class*="-dropdown"] [role="option"]:focus-visible,\n[class*="seekora-"][class*="-dropdown"] button:focus-visible {\n outline: 2px solid var(--seekora-primary, #007aff);\n outline-offset: -2px;\n}\n\n/* High contrast mode */\n@media (prefers-contrast: high) {\n [class*="seekora-"][class*="-dropdown"] {\n border: 2px solid currentColor !important;\n }\n\n [class*="seekora-"][class*="-dropdown"] [role="option"][aria-selected="true"] {\n outline: 2px solid currentColor;\n }\n}\n\n/* Dark mode adjustments */\n@media (prefers-color-scheme: dark) {\n [class*="seekora-"][class*="-dropdown"] {\n --seekora-bg-surface: #1c1c1e;\n --seekora-bg-secondary: #2c2c2e;\n --seekora-bg-hover: #3a3a3c;\n --seekora-text-primary: #ffffff;\n --seekora-text-secondary: #8e8e93;\n --seekora-border-color: #38383a;\n }\n}\n',document.head.appendChild(t),$e=!0},We=()=>{t.useEffect(()=>{Le()},[])},qe=(e={},t=!1)=>({root:{position:"absolute",top:"100%",left:0,right:0,marginTop:"8px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #0f1111)",borderRadius:t?"12px":"16px",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1), 0 10px 40px -5px rgba(0,0,0,0.15)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"14px",zIndex:1e3,...t&&{position:"fixed",top:"60px",bottom:0,left:"8px",right:"8px",margin:0,borderRadius:"16px 16px 0 0"}},content:{display:"flex",flexDirection:t?"column":"row",maxHeight:t?"calc(100vh - 140px)":"480px",overflowY:"auto"},leftColumn:{flex:t?"none":"0 0 55%",borderRight:t?"none":"1px solid var(--seekora-border-color, #e8e8e8)",borderBottom:t?"1px solid var(--seekora-border-color, #e8e8e8)":"none",overflowY:"auto",padding:"8px 0"},rightColumn:{flex:t?"none":"0 0 45%",backgroundColor:"var(--seekora-bg-secondary, #fafafa)",overflowY:"auto",padding:"8px 0"},section:{padding:"4px 0"},sectionHeader:{padding:"8px 16px 6px",fontSize:"11px",fontWeight:600,color:"var(--seekora-text-secondary, #6b6b6b)",textTransform:"uppercase",letterSpacing:"0.05em"},suggestionItem:{display:"flex",alignItems:"center",padding:t?"12px 16px":"10px 16px",cursor:"pointer",transition:"all 150ms ease",gap:t?"12px":"10px",minHeight:t?`${_e.minimum}px`:"40px",borderRadius:"8px",margin:"2px 8px",color:"var(--seekora-text-primary, #0f1111)"},suggestionItemActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #0f1111)"},suggestionIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-tertiary, #6b6b6b)",flexShrink:0},suggestionContent:{flex:1,minWidth:0},suggestionQuery:{fontSize:"14px",color:"var(--seekora-text-primary, #0f1111)",fontWeight:400,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},suggestionContext:{fontSize:"12px",color:"var(--seekora-text-secondary, #565959)",marginTop:"2px"},suggestionDepartment:{color:"var(--seekora-primary-dark, #c45500)",fontStyle:"italic"},categoryScoped:{backgroundColor:"var(--seekora-primary-light, #fef8f0)",borderRadius:"3px",padding:"0 4px",marginLeft:"4px",fontSize:"11px",color:"var(--seekora-primary-dark, #c45500)"},productsHeader:{padding:"12px 16px 8px",display:"flex",alignItems:"center",justifyContent:"space-between"},productsTitle:{fontSize:"13px",fontWeight:700,color:"var(--seekora-text-primary, #0f1111)"},viewAll:{fontSize:"12px",color:"var(--seekora-link, #007185)",textDecoration:"none",cursor:"pointer","&:hover":{color:"var(--seekora-link-hover, #c45500)",textDecoration:"underline"}},productsGrid:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"12px",padding:"12px 16px 16px"},productCard:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",borderRadius:"12px",padding:"10px",cursor:"pointer",transition:"all 200ms ease",boxShadow:"0 1px 3px rgba(0,0,0,0.06)"},productCardHover:{boxShadow:"0 4px 12px rgba(0,0,0,0.12)",transform:"translateY(-2px)"},productImage:{width:"100%",aspectRatio:"1",objectFit:"contain",backgroundColor:"var(--seekora-bg-tertiary, #f8f8f8)",borderRadius:"8px",marginBottom:"10px"},productTitle:{fontSize:"12px",color:"var(--seekora-link, #007185)",lineHeight:1.3,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",marginBottom:"4px"},productPrice:{fontSize:"14px",fontWeight:500,color:"var(--seekora-text-primary, #0f1111)"},productPriceSymbol:{fontSize:"11px",verticalAlign:"top"},productRating:{display:"flex",alignItems:"center",gap:"4px",marginTop:"4px"},stars:{color:"var(--seekora-rating, #de7921)",fontSize:"12px"},reviewCount:{fontSize:"11px",color:"var(--seekora-link, #007185)"},prime:{height:"16px",marginTop:"4px"},recentHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px"},clearRecent:{fontSize:"12px",color:"var(--seekora-link, #007185)",cursor:"pointer",background:"none",border:"none",padding:0},highlight:{fontWeight:700,color:"var(--seekora-text-primary, #0f1111)"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"var(--seekora-text-secondary, #565959)",gap:"10px"},spinner:{width:"20px",height:"20px",border:"2px solid var(--seekora-border-color, #ddd)",borderTopColor:"var(--seekora-primary, #f90)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"40px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #565959)"},footer:{padding:"10px 16px",borderTop:"1px solid var(--seekora-border-color, #e7e7e7)",backgroundColor:"var(--seekora-bg-secondary, #f7f7f7)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"12px",color:"var(--seekora-text-tertiary, #767676)"},keyboard:{display:"flex",alignItems:"center",gap:"8px"},key:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"20px",height:"18px",padding:"0 4px",backgroundColor:"var(--seekora-bg-surface, #fff)",border:"1px solid var(--seekora-border-color, #ccc)",borderRadius:"3px",fontSize:"10px",fontFamily:"monospace"}}),Fe=()=>t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("circle",{cx:"11",cy:"11",r:"8"}),t.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),He=()=>t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("circle",{cx:"12",cy:"12",r:"10"}),t.createElement("polyline",{points:"12 6 12 12 16 14"})),De=()=>t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),t.createElement("polyline",{points:"17 6 23 6 23 12"})),Oe=({rating:e,count:r})=>{const o=Math.floor(e),a=e%1>=.5;return t.createElement("div",{style:qe().productRating},t.createElement("div",{style:qe().stars},"★".repeat(o),a&&"½","☆".repeat(5-o-(a?1:0))),void 0!==r&&t.createElement("span",{style:qe().reviewCount},"(",r.toLocaleString(),")"))},je=t.forwardRef(function(e,r){const{query:o,isOpen:a=!0,loading:n=!1,suggestions:s=[],products:i=[],categories:l=[],recentSearches:c=[],trendingSearches:d=[],filteredTabs:u=[],activeTab:p="all",suggestionFields:m={query:"query"},productFields:g={id:"id",title:"title"},categoryFields:f={id:"id",label:"label"},productDisplay:h={},theme:y={},showDepartments:x=!0,currentDepartment:b,departments:v=[],showPrime:k=!1,width:S="700px",maxHeight:E="500px",zIndex:w=1e3,className:C,style:R,classNames:I={},onSuggestionSelect:z,onProductClick:T,onCategoryClick:N,onTabChange:A,onRecentClick:M,onRecentRemove:P,onRecentClearAll:_,onViewAll:B,onClose:$,header:L,footer:W,renderLoading:q,renderEmpty:F}=e;We();const H=Be(),{isMobile:D,isTablet:O}=H,j=t.useMemo(()=>qe(y,D),[y,D]),Q=t.useRef(null),[V,Y]=t.useState(-1),[U,K]=t.useState(null),X=t.useMemo(()=>s.map(e=>fe(e,m)),[s,m]),G=t.useMemo(()=>{if("all"===p||0===u.length)return i;const e=u.find(e=>e.id===p);return e?.products||i},[p,u,i]),J=t.useMemo(()=>G.map(e=>he(e,g)),[G,g]);t.useMemo(()=>l.map(e=>ye(e,f)),[l,f]);const Z=t.useMemo(()=>c.map(e=>"string"==typeof e?e:e.query),[c]),ee=t.useMemo(()=>{const e=[];let t=0;return 0===o.length&&Z.slice(0,5).forEach(r=>{e.push({type:"recent",data:r,index:t++})}),X.forEach(r=>{e.push({type:"suggestion",data:r,index:t++})}),e},[o,Z,X]),te=t.useCallback(()=>{Y(e=>Math.min(e+1,ee.length-1))},[ee.length]),re=t.useCallback(()=>{Y(e=>Math.max(e-1,-1))},[]),oe=t.useCallback(()=>{if(V<0||V>=ee.length)return;const e=ee[V];"recent"===e.type?M?.(e.data):"suggestion"===e.type&&z?.(e.data._raw,e.index)},[V,ee,M,z]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>V,setActiveIndex:Y,selectActive:oe,navigateNext:te,navigatePrevious:re,focus:()=>Q.current?.focus(),close:()=>$?.()}),[V,oe,te,re,$]),t.useEffect(()=>{if(V>=0&&Q.current){const e=Q.current.querySelector(`[data-index="${V}"]`);e&&ze(e,Q.current)}},[V]),!a)return null;const ae=ke(y),ne=0===o.length&&Z.length>0,se=0===o.length&&d.length>0,ie=J.length>0;return t.createElement("div",{ref:Q,role:"listbox","aria-label":"Search suggestions",className:Se("seekora-amazon-dropdown",C,I.root),style:Ee(j.root,{width:D?"100%":S,maxHeight:D?"100vh":E,zIndex:w},ae,R),tabIndex:-1},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n .seekora-amazon-dropdown mark {\n background: transparent;\n font-weight: 700;\n color: inherit;\n }\n "),L,n?q?q():t.createElement("div",{style:j.loading},t.createElement("div",{style:j.spinner}),t.createElement("span",null,"Searching...")):t.createElement(t.Fragment,null,u.length>0&&t.createElement("div",{style:{display:"flex",gap:"8px",padding:D?"12px":"12px 16px",overflowX:"auto",borderBottomWidth:"1px",borderBottomStyle:"solid",borderBottomColor:"var(--seekora-border-color, #e7e7e7)",background:"var(--seekora-bg-secondary, #f5f5f5)",WebkitOverflowScrolling:"touch"}},t.createElement("button",{onClick:()=>A?.("all"),style:{padding:"8px 16px",borderWidth:0,borderStyle:"none",background:"all"===p?"var(--seekora-text-primary, #232f3e)":"var(--seekora-bg-surface, #ffffff)",color:"all"===p?"var(--seekora-bg-surface, #ffffff)":"var(--seekora-text-primary, #0f1111)",borderRadius:"20px",fontSize:"13px",fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",minHeight:"36px",boxShadow:"all"===p?"none":"0 1px 3px rgba(0,0,0,0.1)",transition:"all 150ms ease"}},"All"),u.slice(0,6).map(e=>t.createElement("button",{key:e.id,onClick:()=>A?.(e.id),style:{padding:"8px 16px",borderWidth:0,borderStyle:"none",background:p===e.id?"var(--seekora-primary, #ff9900)":"var(--seekora-bg-surface, #ffffff)",color:p===e.id?"var(--seekora-text-on-primary, #0f1111)":"var(--seekora-text-primary, #0f1111)",borderRadius:"20px",fontSize:"13px",fontWeight:p===e.id?700:500,cursor:"pointer",whiteSpace:"nowrap",minHeight:"36px",boxShadow:p===e.id?"0 2px 4px rgba(255,153,0,0.3)":"0 1px 3px rgba(0,0,0,0.1)",transition:"all 150ms ease"}},e.label," ",e.nb_hits?`(${e.nb_hits})`:""))),t.createElement("div",{style:j.content},t.createElement("div",{style:j.leftColumn},ne&&t.createElement("div",{style:j.section},t.createElement("div",{style:j.recentHeader},t.createElement("span",{style:j.sectionHeader},"Recent Searches"),t.createElement("button",{style:j.clearRecent,onClick:_},"Clear all")),Z.slice(0,5).map((e,r)=>{const o=V===r;return t.createElement("div",{key:`recent-${e}`,"data-index":r,role:"option","aria-selected":o,style:Ee(j.suggestionItem,o?j.suggestionItemActive:void 0),onClick:()=>M?.(e),onMouseEnter:()=>Y(r)},t.createElement(He,null),t.createElement("div",{style:j.suggestionContent},t.createElement("div",{style:j.suggestionQuery},e)))})),se&&t.createElement("div",{style:j.section},t.createElement("div",{style:j.sectionHeader},"Trending Searches"),d.slice(0,5).map((e,r)=>{const o="string"==typeof e?e:e.query,a=Z.length+r,n=V===a;return t.createElement("div",{key:`trending-${o}`,"data-index":a,role:"option","aria-selected":n,style:Ee(j.suggestionItem,n?j.suggestionItemActive:void 0),onClick:()=>z?.({query:o},r),onMouseEnter:()=>Y(a)},t.createElement(De,null),t.createElement("div",{style:j.suggestionContent},t.createElement("div",{style:j.suggestionQuery},o)))})),X.length>0&&t.createElement("div",{style:j.section},o&&t.createElement("div",{style:j.sectionHeader},"Suggestions"),X.map((e,r)=>{const a=ne?Z.length+r:r,n=V===a,s=(e.categories||[])[0];return t.createElement("div",{key:e.id||`suggestion-${r}`,"data-index":a,role:"option","aria-selected":n,style:Ee(j.suggestionItem,n?j.suggestionItemActive:void 0),onClick:()=>z?.(e._raw,r),onMouseEnter:()=>Y(a)},t.createElement("div",{style:j.suggestionIcon},t.createElement(Fe,null)),t.createElement("div",{style:j.suggestionContent},t.createElement("div",{style:j.suggestionQuery,dangerouslySetInnerHTML:{__html:ve(e.query,o,{className:"highlight"})}}),x&&s&&t.createElement("div",{style:j.suggestionContext},t.createElement("span",{style:j.suggestionDepartment},"in ","string"==typeof s?s:s.value||s.label))),e.count&&t.createElement("span",{style:j.categoryScoped},e.count.toLocaleString()))})),o&&0===X.length&&!n&&(F?F(o):t.createElement("div",{style:j.empty},'No suggestions found for "',o,'"'))),ie&&t.createElement("div",{style:j.rightColumn},t.createElement("div",{style:j.productsHeader},t.createElement("span",{style:j.productsTitle},"Suggested Products"),t.createElement("a",{style:j.viewAll,onClick:()=>B?.("products")},"View all")),t.createElement("div",{style:j.productsGrid},J.slice(0,4).map((e,r)=>t.createElement("div",{key:e.id,style:Ee(j.productCard,U===e.id?j.productCardHover:void 0),onClick:()=>T?.(e._raw,r),onMouseEnter:()=>K(e.id),onMouseLeave:()=>K(null)},e.image?t.createElement("img",{src:e.image,alt:e.title,style:j.productImage,loading:"lazy"}):t.createElement("div",{style:{...j.productImage,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement("span",{style:{color:"var(--seekora-text-tertiary, #999)",fontSize:"32px"}},"📷")),t.createElement("div",{style:j.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:j.productPrice},t.createElement("span",{style:j.productPriceSymbol},h.currency||"$"),xe(e.price,{currency:"",priceDecimals:h.priceDecimals})),e.rating&&t.createElement(Oe,{rating:parseFloat(String(e.rating)),count:e.reviewCount?parseInt(String(e.reviewCount)):void 0}))))))),void 0!==W?W:t.createElement("div",{style:j.footer},t.createElement("div",{style:j.keyboard},t.createElement("span",{style:j.key},"↑"),t.createElement("span",{style:j.key},"↓"),t.createElement("span",null,"to navigate"),t.createElement("span",{style:j.key},"↵"),t.createElement("span",null,"to select"),t.createElement("span",{style:j.key},"esc"),t.createElement("span",null,"to close")),X.length>0&&t.createElement("span",null,X.length," suggestions")))}),Qe=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},t.createElement("path",{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z",fill:"currentColor"})),Ve=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},t.createElement("path",{d:"M13 3a9 9 0 00-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.954 8.954 0 0013 21a9 9 0 000-18zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z",fill:"currentColor"})),Ye=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},t.createElement("path",{d:"M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z",fill:"currentColor"})),Ue=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",width:"20",height:"20"},t.createElement("path",{d:"M9 5l-4 4 4 4",stroke:"currentColor",strokeWidth:"2",fill:"none",transform:"rotate(-90 12 12)"})),Ke=t.forwardRef(function(e,r){const{query:o,isOpen:a=!0,loading:n=!1,suggestions:s=[],recentSearches:i=[],trendingSearches:l=[],suggestionFields:c={query:"query"},theme:d={},showFeelingLucky:u=!0,feelingLuckyText:p="I'm Feeling Lucky",showRemoveRecent:m=!0,showVoiceSearch:g=!1,showTrendingIndicator:f=!0,width:h="100%",maxHeight:y="400px",zIndex:x=1e3,className:b,style:v,classNames:k={},onSuggestionSelect:S,onRecentClick:E,onRecentRemove:w,onVoiceSearch:C,onFeelingLucky:R,onClose:I,onSearchSubmit:z,header:T,footer:N,renderLoading:A,renderEmpty:M}=e;We();const P=Be(),{isMobile:_}=P,B=t.useMemo(()=>((e=!1)=>({root:{position:e?"fixed":"absolute",top:e?0:"100%",left:0,right:0,bottom:e?0:"auto",marginTop:e?0:"4px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #202124)",borderRadius:e?"0":"24px",boxShadow:e?"none":"0 4px 20px rgba(0,0,0,0.12)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:e?"17px":"15px",display:"flex",flexDirection:"column"},list:{listStyle:"none",margin:0,padding:"8px",flex:1,overflowY:"auto"},item:{display:"flex",alignItems:"center",padding:e?"12px 14px":"10px 14px",cursor:"pointer",transition:"all 100ms ease",gap:"12px",minHeight:"44px",borderRadius:"12px",margin:"2px 0",color:"var(--seekora-text-primary, #202124)"},itemActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #202124)"},itemIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-tertiary, #9aa0a6)",flexShrink:0},itemContent:{flex:1,display:"flex",alignItems:"center",justifyContent:"space-between",minWidth:0},itemText:{fontSize:"16px",color:"var(--seekora-text-primary, #202124)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},itemTextBold:{fontWeight:400},itemMatch:{fontWeight:700},itemAction:{fontSize:"14px",color:"var(--seekora-link, #1a73e8)",marginLeft:"16px",opacity:0,transition:"opacity 100ms",whiteSpace:"nowrap"},itemActionVisible:{opacity:1},removeBtn:{padding:"4px 8px",background:"none",border:"none",color:"var(--seekora-link, #1a73e8)",cursor:"pointer",fontSize:"13px",borderRadius:"4px",opacity:0,transition:"opacity 100ms, background 100ms"},removeBtnVisible:{opacity:1},removeBtnHover:{backgroundColor:"var(--seekora-bg-hover, #e8f0fe)",color:"var(--seekora-text-primary, #202124)"},divider:{height:"1px",backgroundColor:"var(--seekora-border-color, #e8eaed)",margin:"8px 0"},sectionTitle:{padding:"12px 16px 8px",fontSize:"12px",fontWeight:500,color:"var(--seekora-text-secondary, #5f6368)",textTransform:"uppercase",letterSpacing:"0.8px"},trending:{display:"flex",alignItems:"center",gap:"8px",color:"var(--seekora-success, #1e8e3e)",fontSize:"12px",marginLeft:"auto"},trendingIcon:{width:"12px",height:"12px"},footer:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px 16px",borderTop:"1px solid var(--seekora-border-color, #e8eaed)",gap:"24px",backgroundColor:"var(--seekora-bg-secondary, #f8f9fa)"},footerButton:{padding:"8px 16px",backgroundColor:"var(--seekora-bg-tertiary, #f1f3f4)",border:"1px solid var(--seekora-border-color, #f1f3f4)",borderRadius:"4px",fontSize:"14px",color:"var(--seekora-text-secondary, #3c4043)",cursor:"pointer",transition:"border-color 100ms, box-shadow 100ms"},footerButtonHover:{borderColor:"var(--seekora-border-color-dark, #dadce0)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},voiceBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",borderRadius:"50%",background:"none",border:"none",cursor:"pointer",color:"var(--seekora-primary, #4285f4)",transition:"background 100ms"},voiceBtnHover:{backgroundColor:"var(--seekora-bg-hover, #f1f3f4)",color:"var(--seekora-text-primary, #202124)"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",color:"var(--seekora-text-secondary, #5f6368)",gap:"12px"},spinner:{width:"24px",height:"24px",border:"3px solid var(--seekora-border-color, #e8eaed)",borderTopColor:"var(--seekora-primary, #4285f4)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"24px",textAlign:"center",color:"var(--seekora-text-secondary, #5f6368)",fontSize:"14px"}}))(_),[_]),$=t.useRef(null),[L,W]=t.useState(-1),[q,F]=t.useState(-1),[H,D]=t.useState(null),O=t.useMemo(()=>s.map(e=>fe(e,c)),[s,c]),j=t.useMemo(()=>i.map(e=>"string"==typeof e?e:e.query).slice(0,5),[i]),Q=t.useMemo(()=>l.map(e=>"string"==typeof e?e:e.query).slice(0,5),[l]),V=t.useMemo(()=>{const e=[];return 0===o.length?(j.forEach(t=>e.push({type:"recent",query:t})),Q.forEach(t=>e.push({type:"trending",query:t}))):O.forEach(t=>e.push({type:"suggestion",query:t.query,data:t})),e},[o,j,Q,O]),Y=t.useCallback(()=>{W(e=>Math.min(e+1,V.length-1))},[V.length]),U=t.useCallback(()=>{W(e=>Math.max(e-1,-1))},[]),K=t.useCallback(()=>{if(L<0)return void(o&&z?.(o));const e=V[L];"recent"===e.type||"trending"===e.type?E?.(e.query):S?.(e.data?._raw||{query:e.query},L)},[L,V,o,z,E,S]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>L,setActiveIndex:W,selectActive:K,navigateNext:Y,navigatePrevious:U,focus:()=>$.current?.focus(),close:()=>I?.()}),[L,K,Y,U,I]),t.useEffect(()=>{W(-1)},[o]),t.useEffect(()=>{if(L>=0&&$.current){const e=$.current.querySelector(`[data-index="${L}"]`);e&&ze(e,$.current)}},[L]),!a)return null;const X=ke(d),G=0===o.length&&j.length>0,J=0===o.length&&Q.length>0,Z=(e,r,a)=>{const n=L===a,s=q===a,i=n||s;return t.createElement("li",{key:`${e.type}-${e.query}-${r}`,"data-index":a,role:"option","aria-selected":n,style:Ee(B.item,n||s?B.itemActive:void 0),onClick:()=>{"recent"===e.type||"trending"===e.type?E?.(e.query):S?.(e.data?._raw||{query:e.query},r)},onMouseEnter:()=>{F(a),W(a)},onMouseLeave:()=>F(-1)},t.createElement("div",{style:B.itemIcon},"recent"===e.type?t.createElement(Ve,null):"trending"===e.type?t.createElement(Ye,null):t.createElement(Qe,null)),t.createElement("div",{style:B.itemContent},t.createElement("span",{style:B.itemText,dangerouslySetInnerHTML:{__html:o?ve(e.query,o,{tag:"b"}):e.query}}),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},"trending"===e.type&&f&&t.createElement("span",{style:B.trending},t.createElement(Ye,null),"Trending"),"recent"===e.type&&m&&t.createElement("button",{style:Ee(B.removeBtn,i?B.removeBtnVisible:void 0),onClick:t=>{t.stopPropagation(),w?.(e.query)},"aria-label":`Remove ${e.query}`},"Remove"),t.createElement("span",{style:Ee(B.itemAction,i?B.itemActionVisible:void 0)},t.createElement(Ue,null)))))};let ee=0;return t.createElement("div",{ref:$,role:"listbox","aria-label":"Search suggestions",className:Se("seekora-google-dropdown",b,k.root),style:Ee(B.root,{width:h,maxHeight:"none",zIndex:x},X,v),tabIndex:-1},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n "),T,n?A?A():t.createElement("div",{style:B.loading},t.createElement("div",{style:B.spinner})):t.createElement(t.Fragment,null,t.createElement("ul",{style:B.list},G&&t.createElement(t.Fragment,null,j.map((e,t)=>{const r=Z({type:"recent",query:e},t,ee);return ee++,r}),J&&t.createElement("div",{style:B.divider})),J&&t.createElement(t.Fragment,null,!G&&t.createElement("div",{style:B.sectionTitle},"Trending searches"),Q.map((e,t)=>{const r=Z({type:"trending",query:e},t,ee);return ee++,r})),o&&O.length>0&&O.map((e,t)=>{const r={type:"suggestion",query:e.query,data:e},o=Z(r,t,ee);return ee++,o}),o&&0===O.length&&!n&&(M?M(o):t.createElement("li",{style:B.empty},'No suggestions for "',o,'"'))),(u||g)&&t.createElement("div",{style:B.footer},u&&t.createElement(t.Fragment,null,t.createElement("button",{style:Ee(B.footerButton,"search"===H?B.footerButtonHover:void 0),onMouseEnter:()=>D("search"),onMouseLeave:()=>D(null),onClick:()=>z?.(o||(L>=0?V[L]?.query:""))},"Search"),t.createElement("button",{style:Ee(B.footerButton,"lucky"===H?B.footerButtonHover:void 0),onMouseEnter:()=>D("lucky"),onMouseLeave:()=>D(null),onClick:()=>R?.(o||(L>=0?V[L]?.query:""))},p)))),N)}),Xe=()=>t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},t.createElement("path",{d:"M10 16c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6m13.12 2.88l-4.26-4.26A9.842 9.842 0 0020 10c0-5.52-4.48-10-10-10S0 4.48 0 10s4.48 10 10 10c1.67 0 3.24-.41 4.62-1.14l4.26 4.26a3 3 0 004.24-4.24z"})),Ge=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"18",height:"18"},t.createElement("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})),Je=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"18",height:"18"},t.createElement("path",{d:"M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"})),Ze=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",width:"48",height:"48"},t.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.createElement("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.createElement("polyline",{points:"21 15 16 10 5 21"})),et=t.forwardRef(function(e,r){const{query:o,isOpen:a=!0,loading:n=!1,suggestions:s=[],products:i=[],categories:l=[],suggestionFields:c={query:"query"},productFields:d={id:"id",title:"title"},categoryFields:u={id:"id",label:"label"},productDisplay:p={},theme:m={},showSaveButton:g=!0,activeCategory:f,activeTab:h,showPriceOverlay:y=!0,gridColumns:x=4,width:b="800px",maxHeight:v="600px",zIndex:k=1e3,className:S,style:E,classNames:w={},onSuggestionSelect:C,onProductClick:R,onCategoryClick:I,onTabChange:z,onSaveProduct:T,onViewAll:N,onClose:A,header:M,footer:P,renderLoading:_,renderEmpty:B}=e;We();const $=Be(),{isMobile:L}=$,W=t.useMemo(()=>({root:{position:"absolute",top:"100%",left:0,right:0,marginTop:"8px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #111111)",borderRadius:"20px",boxShadow:"0 4px 30px rgba(0,0,0,0.12)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"15px"},header:{padding:"16px 20px 14px",borderBottom:"1px solid var(--seekora-border-color, #e8e8e8)"},searchInfo:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"14px"},searchQuery:{fontSize:"16px",fontWeight:600,color:"#111111"},searchCount:{fontSize:"13px",color:"#767676"},categoriesScroll:{display:"flex",gap:"8px",overflowX:"auto",paddingBottom:"4px",scrollbarWidth:"none",msOverflowStyle:"none"},categoryChip:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",backgroundColor:"var(--seekora-bg-secondary, #f0f0f0)",borderRadius:"20px",fontSize:"13px",fontWeight:500,color:"#111111",cursor:"pointer",transition:"all 150ms ease",whiteSpace:"nowrap",borderWidth:0,borderStyle:"none"},categoryChipActive:{backgroundColor:"var(--seekora-primary, #e60023)",color:"var(--seekora-bg-surface, #ffffff)"},categoryChipHover:{backgroundColor:"var(--seekora-bg-hover, #e0e0e0)",color:"var(--seekora-text-primary, #111111)"},categoryIcon:{width:"16px",height:"16px",borderRadius:"4px",objectFit:"cover"},content:{padding:"16px",overflowY:"auto"},suggestionsRow:{display:"flex",gap:"8px",marginBottom:"16px",flexWrap:"wrap"},suggestionPill:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",borderRadius:"20px",fontSize:"13px",fontWeight:500,color:"#111111",cursor:"pointer",transition:"all 150ms ease",borderWidth:0,borderStyle:"none"},suggestionPillActive:{backgroundColor:"var(--seekora-text-primary, #111111)",color:"var(--seekora-bg-surface, #ffffff)"},suggestionPillHover:{backgroundColor:"var(--seekora-bg-hover, #e8e8e8)",color:"var(--seekora-text-primary, #111111)"},suggestionIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"#767676",flexShrink:0},productsGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:"16px"},productCard:{position:"relative",borderRadius:"16px",overflow:"hidden",cursor:"pointer",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",transition:"transform 150ms, box-shadow 150ms"},productCardHover:{transform:"scale(1.02)",boxShadow:"0 4px 20px rgba(0,0,0,0.15)"},productImageContainer:{position:"relative",paddingBottom:"133%",overflow:"hidden"},productImage:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover"},productImagePlaceholder:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--seekora-bg-tertiary, #e9e9e9)",color:"var(--seekora-text-tertiary, #aaa)"},productOverlay:{position:"absolute",bottom:0,left:0,right:0,padding:"40px 12px 12px",background:"linear-gradient(to top, rgba(0,0,0,0.7), transparent)",opacity:0,transition:"opacity 200ms"},productOverlayVisible:{opacity:1},productInfo:{padding:"12px"},productTitle:{fontSize:"14px",fontWeight:600,color:"var(--seekora-text-primary, #111)",lineHeight:1.3,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",marginBottom:"4px"},productTitleOverlay:{color:"var(--seekora-text-inverse, #ffffff)",marginBottom:"4px"},productPrice:{fontSize:"14px",fontWeight:600,color:"var(--seekora-text-primary, #111)"},productPriceOverlay:{color:"var(--seekora-text-inverse, #ffffff)"},productSaveBtn:{position:"absolute",top:"12px",right:"12px",width:"36px",height:"36px",borderRadius:"50%",backgroundColor:"var(--seekora-primary, #e60023)",color:"var(--seekora-text-inverse, #ffffff)",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",opacity:0,transform:"scale(0.8)",transition:"all 150ms"},productSaveBtnVisible:{opacity:1,transform:"scale(1)"},sectionTitle:{fontSize:"18px",fontWeight:700,color:"var(--seekora-text-primary, #111)",marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"60px",color:"var(--seekora-text-secondary, #767676)"},spinner:{width:"32px",height:"32px",border:"3px solid var(--seekora-border-color, #efefef)",borderTopColor:"var(--seekora-primary, #e60023)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"60px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #767676)"},emptyIcon:{width:"64px",height:"64px",margin:"0 auto 16px",color:"var(--seekora-text-tertiary, #8c8c8c)"},footer:{padding:"16px 20px",borderTop:"1px solid var(--seekora-border-color, #efefef)",display:"flex",alignItems:"center",justifyContent:"space-between"},viewAllBtn:{padding:"12px 20px",backgroundColor:"var(--seekora-primary, #e60023)",color:"var(--seekora-text-inverse, #ffffff)",border:"none",borderRadius:"24px",fontSize:"15px",fontWeight:600,cursor:"pointer",transition:"background 150ms"},viewAllBtnHover:{backgroundColor:"var(--seekora-primary-dark, #ad081b)"}}),[]),q=t.useRef(null),[F,H]=t.useState(-1),[D,O]=t.useState(null),[j,Q]=t.useState(null),[V,Y]=t.useState(-1),[U,K]=t.useState(f||null),[X,G]=t.useState(!1);t.useEffect(()=>{const e=h??f;void 0!==e&&K("all"===e?null:e)},[h,f]);const J=t.useMemo(()=>s.map(e=>fe(e,c)),[s,c]),Z=t.useMemo(()=>i.map(e=>he(e,d)),[i,d]),ee=t.useMemo(()=>l.map(e=>ye(e,u)),[l,u]),te=t.useCallback(()=>{H(e=>Math.min(e+1,J.length-1))},[J.length]),re=t.useCallback(()=>{H(e=>Math.max(e-1,-1))},[]),oe=t.useCallback(()=>{F>=0&&J[F]&&C?.(J[F]._raw,F)},[F,J,C]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>F,setActiveIndex:H,selectActive:oe,navigateNext:te,navigatePrevious:re,focus:()=>q.current?.focus(),close:()=>A?.()}),[F,oe,te,re,A]),t.useEffect(()=>{if(F>=0&&q.current){const e=q.current.querySelector(`[data-index="${F}"]`);e&&ze(e,q.current)}},[F]),!a)return null;const ae=ke(m),ne=ee.length>0,se=Z;return t.createElement("div",{ref:q,role:"listbox","aria-label":"Search suggestions",className:Se("seekora-pinterest-dropdown",S,w.root),style:Ee(W.root,{width:b,zIndex:k},ae,E),tabIndex:-1},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n .seekora-pinterest-dropdown .categories-scroll::-webkit-scrollbar {\n display: none;\n }\n "),M||o&&t.createElement("div",{style:W.header},t.createElement("div",{style:W.searchInfo},t.createElement("span",{style:W.searchQuery},o?`"${o}"`:"Explore"),Z.length>0&&t.createElement("span",{style:W.searchCount},Z.length,"+ ideas")),ne&&t.createElement("div",{style:W.categoriesScroll,className:"categories-scroll"},t.createElement("button",{style:Ee(W.categoryChip,U?void 0:W.categoryChipActive,"all"===j&&U?W.categoryChipHover:void 0),onClick:()=>{K(null),z?.("all")},onMouseEnter:()=>Q("all"),onMouseLeave:()=>Q(null)},"All"),ee.map(e=>t.createElement("button",{key:e.id,style:Ee(W.categoryChip,U===e.id?W.categoryChipActive:void 0,j===e.id&&U!==e.id?W.categoryChipHover:void 0),onClick:()=>{K(e.id),z?.(e.id)},onMouseEnter:()=>Q(e.id),onMouseLeave:()=>Q(null)},e.icon&&t.createElement("img",{src:e.icon,alt:"",style:W.categoryIcon}),e.label,e.count&&t.createElement("span",null,"(",e.count,")"))))),t.createElement("div",{style:{...W.content,maxHeight:v}},n?_?_():t.createElement("div",{style:W.loading},t.createElement("div",{style:W.spinner})):t.createElement(t.Fragment,null,J.length>0&&t.createElement("div",{style:W.suggestionsRow},J.slice(0,8).map((e,r)=>t.createElement("button",{key:e.id||r,"data-index":r,style:Ee(W.suggestionPill,F===r?W.suggestionPillActive:void 0,V===r&&F!==r?W.suggestionPillHover:void 0),onClick:()=>C?.(e._raw,r),onMouseEnter:()=>{Y(r),H(r)},onMouseLeave:()=>Y(-1)},t.createElement("span",{style:W.suggestionIcon,dangerouslySetInnerHTML:{__html:o?ve(e.query,o,{tag:"strong"}):e.query}})))),se.length>0&&t.createElement(t.Fragment,null,t.createElement("div",{style:W.sectionTitle},t.createElement(Je,null),"Ideas for you"),t.createElement("div",{style:{...W.productsGrid,gridTemplateColumns:`repeat(${x}, 1fr)`}},se.slice(0,12).map((e,r)=>t.createElement("div",{key:e.id,style:Ee(W.productCard,D===e.id?W.productCardHover:void 0),onClick:()=>R?.(e._raw,r),onMouseEnter:()=>O(e.id),onMouseLeave:()=>O(null)},t.createElement("div",{style:W.productImageContainer},e.image?t.createElement("img",{src:e.image,alt:e.title,style:W.productImage,loading:"lazy"}):t.createElement("div",{style:W.productImagePlaceholder},t.createElement(Ze,null)),g&&t.createElement("button",{style:Ee(W.productSaveBtn,D===e.id?W.productSaveBtnVisible:void 0),onClick:t=>{t.stopPropagation(),T?.(e._raw)},"aria-label":"Save"},t.createElement(Ge,null)),y&&void 0!==e.price&&t.createElement("div",{style:Ee(W.productOverlay,D===e.id?W.productOverlayVisible:void 0)},t.createElement("div",{style:W.productTitleOverlay},e.title),t.createElement("div",{style:W.productPriceOverlay},xe(e.price,{currency:p.currency||e.currency||"$"})))),!y&&t.createElement("div",{style:W.productInfo},t.createElement("div",{style:W.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:W.productPrice},xe(e.price,{currency:p.currency||e.currency||"$"}))))))),!n&&0===se.length&&0===J.length&&(B?B(o):t.createElement("div",{style:W.empty},t.createElement("div",{style:W.emptyIcon},t.createElement(Xe,null)),t.createElement("p",null,'No ideas found for "',o,'"'),t.createElement("p",{style:{fontSize:"14px",marginTop:"8px"}},"Try searching for something else"))))),void 0!==P?P:se.length>0&&t.createElement("div",{style:W.footer},t.createElement("span",{style:{color:"var(--seekora-text-secondary, #767676)",fontSize:"14px"}},se.length,"+ more ideas"),t.createElement("button",{style:Ee(W.viewAllBtn,X?W.viewAllBtnHover:void 0),onClick:()=>N?.("products"),onMouseEnter:()=>G(!0),onMouseLeave:()=>G(!1)},"Explore all")))}),tt=()=>t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"currentColor"},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),rt=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z",clipRule:"evenodd"})),ot=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{d:"M10 2a4 4 0 00-4 4v1H5a1 1 0 00-.994.89l-1 9A1 1 0 004 18h12a1 1 0 00.994-1.11l-1-9A1 1 0 0015 7h-1V6a4 4 0 00-4-4zm2 5V6a2 2 0 10-4 0v1h4zm-6 3a1 1 0 112 0 1 1 0 01-2 0zm7-1a1 1 0 100 2 1 1 0 000-2z"})),at=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),nt=t.forwardRef(function(e,r){const{query:o,isOpen:a=!0,loading:n=!1,suggestions:s=[],products:i=[],recentSearches:l=[],suggestionFields:c={query:"query"},productFields:d={id:"id",title:"title"},productDisplay:u={},theme:p={},showPreview:m=!0,asOverlay:g=!0,placeholder:f="Search...",showShortcuts:h=!0,actions:y=[],width:x="680px",maxHeight:b="500px",zIndex:v=9999,className:k,style:S,classNames:E={},inputRef:w,onSuggestionSelect:C,onProductClick:R,onRecentClick:I,onClose:z,onSearchSubmit:T,header:N,footer:A,renderLoading:M,renderEmpty:P}=e;We();const _=Be(),{isMobile:B}=_,$=t.useMemo(()=>({overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"15vh",zIndex:9999},root:{backgroundColor:"var(--seekora-bg-surface, rgba(255, 255, 255, 0.95))",borderRadius:"var(--seekora-border-radius, 12px)",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.1)",overflow:"hidden",fontFamily:'var(--seekora-font-family, -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif)',fontSize:"var(--seekora-font-size, 14px)",backdropFilter:"blur(20px)"},searchContainer:{display:"flex",alignItems:"center",padding:"12px 16px",gap:"12px",borderBottom:"1px solid var(--seekora-border-color, rgba(0,0,0,0.1))"},searchIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-tertiary, #86868b)",flexShrink:0},searchInput:{flex:1,border:"none",background:"transparent",fontSize:"17px",fontWeight:300,color:"var(--seekora-text-primary, #1d1d1f)",outline:"none",fontFamily:"inherit"},shortcut:{display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",color:"var(--seekora-text-tertiary, #86868b)"},kbd:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"20px",height:"20px",padding:"0 4px",backgroundColor:"var(--seekora-bg-tertiary, rgba(0,0,0,0.05))",borderRadius:"4px",fontSize:"11px",fontFamily:"SF Mono, Monaco, monospace"},content:{display:"flex",maxHeight:"400px"},resultsColumn:{flex:1,overflowY:"auto",minWidth:"300px"},previewColumn:{width:"280px",borderLeft:"1px solid var(--seekora-border-color, rgba(0,0,0,0.1))",backgroundColor:"var(--seekora-bg-secondary, rgba(0,0,0,0.02))",display:"flex",flexDirection:"column"},section:{padding:"8px 0"},sectionTitle:{padding:"8px 16px 6px",fontSize:"11px",fontWeight:600,color:"var(--seekora-text-tertiary, #86868b)",textTransform:"uppercase",letterSpacing:"0.5px"},item:{display:"flex",alignItems:"center",padding:"8px 16px",gap:"12px",cursor:"pointer",transition:"background-color 50ms",margin:"0 8px",borderRadius:"6px"},itemActive:{backgroundColor:"var(--seekora-primary, #007aff)",color:"var(--seekora-text-inverse, #ffffff)"},itemIcon:{width:"32px",height:"32px",borderRadius:"6px",backgroundColor:"var(--seekora-bg-tertiary, #f5f5f7)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-secondary, #515154)",flexShrink:0},itemIconActive:{backgroundColor:"rgba(255,255,255,0.2)",color:"var(--seekora-text-inverse, #ffffff)"},itemIconImage:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"6px"},itemContent:{flex:1,minWidth:0},itemTitle:{fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #1d1d1f)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},itemTitleActive:{color:"var(--seekora-text-inverse, #ffffff)"},itemSubtitle:{fontSize:"11px",color:"var(--seekora-text-secondary, #86868b)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:"2px"},itemSubtitleActive:{color:"var(--seekora-text-inverse, #ffffff)",opacity:.9},itemAction:{fontSize:"11px",color:"var(--seekora-text-tertiary, #86868b)",opacity:0,transition:"opacity 100ms"},itemActionVisible:{opacity:1},itemActionActive:{color:"var(--seekora-text-inverse, #ffffff)",opacity:.8},previewContent:{flex:1,padding:"16px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},previewImage:{width:"160px",height:"160px",objectFit:"contain",borderRadius:"8px",marginBottom:"16px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},previewTitle:{fontSize:"14px",fontWeight:600,color:"var(--seekora-text-primary, #1d1d1f)",textAlign:"center",marginBottom:"4px"},previewSubtitle:{fontSize:"12px",color:"var(--seekora-text-secondary, #86868b)",textAlign:"center",marginBottom:"8px"},previewPrice:{fontSize:"18px",fontWeight:700,color:"var(--seekora-primary, #007aff)"},previewActions:{display:"flex",gap:"8px",marginTop:"16px"},previewAction:{padding:"6px 12px",fontSize:"12px",fontWeight:500,borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 100ms"},previewActionPrimary:{backgroundColor:"var(--seekora-primary, #007aff)",color:"var(--seekora-text-inverse, #ffffff)"},previewActionSecondary:{backgroundColor:"var(--seekora-bg-tertiary, #f5f5f7)",color:"var(--seekora-text-primary, #1d1d1f)"},footer:{padding:"8px 16px",borderTop:"1px solid var(--seekora-border-color, rgba(0,0,0,0.1))",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"var(--seekora-bg-secondary, rgba(0,0,0,0.02))",fontSize:"11px",color:"var(--seekora-text-tertiary, #86868b)"},footerActions:{display:"flex",alignItems:"center",gap:"16px"},footerAction:{display:"flex",alignItems:"center",gap:"4px"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"var(--seekora-text-secondary, #86868b)"},spinner:{width:"24px",height:"24px",border:"2px solid var(--seekora-border-color, #e5e5e5)",borderTopColor:"var(--seekora-primary, #007aff)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"40px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #86868b)"}}),[]),L=t.useRef(null),W=t.useRef(null),[q,F]=t.useState(-1),H=t.useMemo(()=>s.map(e=>fe(e,c)),[s,c]),D=t.useMemo(()=>i.map(e=>he(e,d)),[i,d]),O=t.useMemo(()=>l.map(e=>"string"==typeof e?e:e.query).slice(0,3),[l]),j=t.useMemo(()=>{const e=[];return y.forEach(t=>{e.push({type:"action",id:t.id,title:t.label,icon:t.icon,data:t})}),!o&&O.length>0&&O.forEach((r,o)=>{e.push({type:"recent",id:`recent-${o}`,title:r,icon:t.createElement(at,null),data:r})}),H.forEach((r,o)=>{e.push({type:"suggestion",id:r.id||`suggestion-${o}`,title:r.query,icon:t.createElement(rt,null),data:r})}),D.forEach((r,o)=>{e.push({type:"product",id:r.id,title:r.title,subtitle:r.brand,icon:t.createElement(ot,null),image:r.image,price:r.price,data:r})}),e},[y,o,O,H,D]),Q=t.useCallback(()=>{F(e=>Math.min(e+1,j.length-1))},[j.length]),V=t.useCallback(()=>{F(e=>Math.max(e-1,-1))},[]),Y=t.useCallback(()=>{if(q<0)return void(o.trim()&&T?.(o.trim()));const e=j[q];if(e)switch(e.type){case"action":e.data.onAction?.();break;case"recent":I?.(e.data);break;case"suggestion":C?.(e.data._raw,q);break;case"product":R?.(e.data._raw,q)}},[q,j,o,T,I,C,R]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>q,setActiveIndex:F,selectActive:Y,navigateNext:Q,navigatePrevious:V,focus:()=>w?.current?.focus(),close:()=>z?.()}),[q,Y,Q,V,w,z]),t.useEffect(()=>{if(W.current&&q>=0){const e=W.current.querySelector(`[data-index="${q}"]`);e&&ze(e,W.current)}},[q]),t.useEffect(()=>{F(-1)},[o]),!a)return null;const U=ke(p),K=j[q],X=t.createElement("div",{ref:L,className:Se("seekora-spotlight-dropdown",k,E.root),style:Ee($.root,{width:x,zIndex:g?void 0:v},U,S)},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n "),t.createElement("div",{style:$.searchContainer},t.createElement("div",{style:$.searchIcon},t.createElement(tt,null)),t.createElement("input",{ref:w,type:"text",placeholder:f,defaultValue:o,style:$.searchInput,onChange:e=>T?.(e.target.value),onKeyDown:e=>{"ArrowDown"===e.key?(e.preventDefault(),Q()):"ArrowUp"===e.key?(e.preventDefault(),V()):"Enter"===e.key?(e.preventDefault(),Y()):"Escape"===e.key&&z?.()},autoFocus:!0}),h&&t.createElement("div",{style:$.shortcut},t.createElement("span",{style:$.kbd},"⌘"),t.createElement("span",{style:$.kbd},"K"))),N,t.createElement("div",{style:$.content},t.createElement("div",{ref:W,style:{...$.resultsColumn,maxHeight:b}},n?M?M():t.createElement("div",{style:$.loading},t.createElement("div",{style:$.spinner})):0===j.length?P?P(o):t.createElement("div",{style:$.empty},'No results for "',o,'"'):t.createElement(t.Fragment,null,y.length>0&&t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionTitle},"Actions"),j.filter(e=>"action"===e.type).map(e=>{const r=j.indexOf(e),o=q===r;return t.createElement("div",{key:e.id,"data-index":r,style:Ee($.item,o?$.itemActive:void 0),onClick:()=>{F(r),Y()},onMouseEnter:()=>F(r)},t.createElement("div",{style:Ee($.itemIcon,o?$.itemIconActive:void 0)},e.icon),t.createElement("div",{style:$.itemContent},t.createElement("div",{style:Ee($.itemTitle,o?$.itemTitleActive:void 0)},e.title)))})),O.length>0&&!o&&t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionTitle},"Recent"),j.filter(e=>"recent"===e.type).map(e=>{const r=j.indexOf(e),o=q===r;return t.createElement("div",{key:e.id,"data-index":r,style:Ee($.item,o?$.itemActive:void 0),onClick:()=>{F(r),I?.(e.data)},onMouseEnter:()=>F(r)},t.createElement("div",{style:Ee($.itemIcon,o?$.itemIconActive:void 0)},e.icon),t.createElement("div",{style:$.itemContent},t.createElement("div",{style:Ee($.itemTitle,o?$.itemTitleActive:void 0)},e.title)))})),H.length>0&&t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionTitle},"Suggestions"),j.filter(e=>"suggestion"===e.type).map(e=>{const r=j.indexOf(e),a=q===r;return t.createElement("div",{key:e.id,"data-index":r,style:Ee($.item,a?$.itemActive:void 0),onClick:()=>{F(r),C?.(e.data._raw,r)},onMouseEnter:()=>F(r)},t.createElement("div",{style:Ee($.itemIcon,a?$.itemIconActive:void 0)},e.icon),t.createElement("div",{style:$.itemContent},t.createElement("div",{style:Ee($.itemTitle,a?$.itemTitleActive:void 0),dangerouslySetInnerHTML:{__html:ve(e.title,o,{tag:"strong"})}})))})),D.length>0&&t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionTitle},"Products"),j.filter(e=>"product"===e.type).map(e=>{const r=j.indexOf(e),o=q===r;return t.createElement("div",{key:e.id,"data-index":r,style:Ee($.item,o?$.itemActive:void 0),onClick:()=>{F(r),R?.(e.data._raw,r)},onMouseEnter:()=>F(r)},t.createElement("div",{style:Ee($.itemIcon,o?$.itemIconActive:void 0)},e.image?t.createElement("img",{src:e.image,alt:"",style:$.itemIconImage}):e.icon),t.createElement("div",{style:$.itemContent},t.createElement("div",{style:Ee($.itemTitle,o?$.itemTitleActive:void 0)},e.title),e.subtitle&&t.createElement("div",{style:Ee($.itemSubtitle,o?$.itemSubtitleActive:void 0)},e.subtitle)),void 0!==e.price&&t.createElement("span",{style:Ee($.itemAction,$.itemActionVisible,o?$.itemActionActive:void 0)},xe(e.price,{currency:u.currency})))})))),m&&K&&"product"===K.type&&t.createElement("div",{style:$.previewColumn},t.createElement("div",{style:$.previewContent},K.image&&t.createElement("img",{src:K.image,alt:"",style:$.previewImage}),t.createElement("div",{style:$.previewTitle},K.title),K.subtitle&&t.createElement("div",{style:$.previewSubtitle},K.subtitle),void 0!==K.price&&t.createElement("div",{style:$.previewPrice},xe(K.price,{currency:u.currency})),t.createElement("div",{style:$.previewActions},t.createElement("button",{style:{...$.previewAction,...$.previewActionPrimary},onClick:()=>R?.(K.data._raw,q)},"View Product"))))),void 0!==A?A:t.createElement("div",{style:$.footer},t.createElement("div",{style:$.footerActions},t.createElement("span",{style:$.footerAction},t.createElement("span",{style:$.kbd},"↑"),t.createElement("span",{style:$.kbd},"↓"),"navigate"),t.createElement("span",{style:$.footerAction},t.createElement("span",{style:$.kbd},"↵"),"select"),t.createElement("span",{style:$.footerAction},t.createElement("span",{style:$.kbd},"esc"),"close")),t.createElement("span",null,j.length," results")));return g?t.createElement("div",{style:{...$.overlay,zIndex:v},onClick:e=>{e.target===e.currentTarget&&z?.()}},X):X}),st=()=>t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},t.createElement("path",{d:"M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z"})),it=()=>t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"currentColor"},t.createElement("path",{fillRule:"evenodd",d:"M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z",clipRule:"evenodd"})),lt=t.forwardRef(function(e,r){const{query:o,isOpen:a=!0,loading:n=!1,suggestions:s=[],products:i=[],categories:l=[],suggestionFields:c={query:"query"},productFields:d={id:"id",title:"title"},categoryFields:u={id:"id",label:"label"},productDisplay:p={},theme:m={},showHeroProduct:g=!0,showCollections:f=!0,showAddToCart:h=!0,addToCartText:y="Quick Add",showComparePrice:x=!0,width:b="100%",maxHeight:v="500px",zIndex:k=1e3,className:S,style:E,classNames:w={},onSuggestionSelect:C,onProductClick:R,onCategoryClick:I,onTabChange:z,onAddToCart:T,onViewAll:N,onClose:A,header:M,footer:P,renderLoading:_,renderEmpty:B}=e;We();const $=Be(),{isMobile:L}=$,W=t.useMemo(()=>((e=!1)=>({root:{position:e?"fixed":"absolute",top:e?0:"100%",left:0,right:0,bottom:e?0:"auto",marginTop:e?0:"8px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #121212)",borderRadius:e?0:"16px",boxShadow:e?"none":"0 4px 30px rgba(0, 0, 0, 0.12)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:e?"16px":"14px",display:"flex",flexDirection:"column"},layout:{display:e?"flex":"grid",flexDirection:"column",gridTemplateColumns:e?"1fr":"1fr 1fr",minHeight:e?"auto":"400px",flex:1,overflowY:"auto"},leftPanel:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",borderRight:e?"none":"1px solid var(--seekora-border-color, #e8e8e1)",borderBottom:e?"1px solid var(--seekora-border-color, #e8e8e1)":"none",display:"flex",flexDirection:"column"},rightPanel:{backgroundColor:"var(--seekora-bg-secondary, #fafafa)",padding:e?"16px":"24px",display:"flex",flexDirection:"column",overflow:"hidden"},section:{flex:1,overflowY:"auto"},sectionHeader:{padding:"16px 20px 12px",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid var(--seekora-border-color, #e8e8e1)"},sectionTitle:{fontSize:"11px",fontWeight:600,color:"var(--seekora-text-secondary, #666)",textTransform:"uppercase",letterSpacing:"0.1em"},viewAllLink:{fontSize:"12px",color:"var(--seekora-text-primary, #121212)",textDecoration:"underline",cursor:"pointer"},suggestionItem:{display:"flex",alignItems:"center",padding:e?"14px 16px":"12px 16px",gap:"12px",cursor:"pointer",transition:"all 150ms ease",minHeight:"48px",margin:"4px 8px",borderRadius:"10px",color:"var(--seekora-text-primary, #121212)"},suggestionItemActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #121212)"},suggestionIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-tertiary, #999999)",flexShrink:0},suggestionContent:{flex:1,minWidth:0},suggestionQuery:{fontSize:"14px",color:"var(--seekora-text-primary, #121212)",fontWeight:400},suggestionMeta:{fontSize:"12px",color:"var(--seekora-text-secondary, #666)",marginTop:"2px"},suggestionArrow:{width:"16px",height:"16px",color:"var(--seekora-text-tertiary, #ccc)",transform:"rotate(-45deg)",opacity:0,transition:"opacity 150ms"},suggestionArrowVisible:{opacity:1},collectionsGrid:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"1px",backgroundColor:"var(--seekora-border-color, #e8e8e1)",borderTop:"1px solid var(--seekora-border-color, #e8e8e1)"},collectionItem:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #121212)",padding:"16px 20px",cursor:"pointer",transition:"background-color 150ms"},collectionItemHover:{backgroundColor:"var(--seekora-bg-hover, #f0f0f0)",color:"var(--seekora-text-primary, #121212)"},collectionName:{fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #121212)",marginBottom:"4px"},collectionCount:{fontSize:"11px",color:"var(--seekora-text-secondary, #666)"},heroProduct:{marginBottom:"24px"},heroImage:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:"2px",marginBottom:"16px",backgroundColor:"var(--seekora-bg-tertiary, #f5f5f5)"},heroTitle:{fontSize:"16px",fontWeight:500,color:"var(--seekora-text-primary, #121212)",marginBottom:"8px",lineHeight:1.3},heroBrand:{fontSize:"12px",color:"var(--seekora-text-secondary, #666)",marginBottom:"12px",textTransform:"uppercase",letterSpacing:"0.05em"},heroPricing:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"16px"},heroPrice:{fontSize:"18px",fontWeight:500,color:"var(--seekora-text-primary, #121212)"},heroComparePrice:{fontSize:"14px",color:"var(--seekora-text-tertiary, #999)",textDecoration:"line-through"},heroDiscount:{fontSize:"12px",fontWeight:600,color:"var(--seekora-error, #d02e2e)",backgroundColor:"var(--seekora-error-light, #fdf2f2)",padding:"2px 8px",borderRadius:"2px"},heroButton:{width:"100%",padding:"14px 20px",backgroundColor:"var(--seekora-text-primary, #121212)",color:"var(--seekora-bg-surface, #ffffff)",border:"none",borderRadius:"2px",fontSize:"13px",fontWeight:500,textTransform:"uppercase",letterSpacing:"0.1em",cursor:"pointer",transition:"background-color 150ms"},heroButtonHover:{backgroundColor:"var(--seekora-text-secondary, #666666)",color:"var(--seekora-bg-surface, #ffffff)"},productsScroll:{flex:1,overflowX:"auto",overflowY:"hidden",display:"flex",gap:"16px",paddingBottom:"8px",scrollbarWidth:"thin"},productCard:{flex:"0 0 140px",cursor:"pointer",transition:"opacity 150ms"},productCardHover:{opacity:.7},productImage:{width:"140px",height:"175px",objectFit:"cover",backgroundColor:"var(--seekora-bg-tertiary, #f5f5f5)",marginBottom:"10px"},productTitle:{fontSize:"12px",color:"var(--seekora-text-primary, #121212)",marginBottom:"4px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},productPrice:{fontSize:"12px",fontWeight:500,color:"var(--seekora-text-primary, #121212)"},footer:{padding:"12px 20px",borderTop:"1px solid var(--seekora-border-color, #e8e8e1)",backgroundColor:"var(--seekora-bg-secondary, #fafafa)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"11px",color:"var(--seekora-text-secondary, #666)"},footerLink:{color:"var(--seekora-text-primary, #121212)",textDecoration:"underline",cursor:"pointer"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"60px",color:"var(--seekora-text-secondary, #666)"},spinner:{width:"24px",height:"24px",border:"2px solid var(--seekora-border-color, #e8e8e1)",borderTopColor:"var(--seekora-text-primary, #121212)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"60px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #666)"},highlight:{fontWeight:600,textDecoration:"underline",textDecorationColor:"var(--seekora-text-primary, #121212)"}}))(L),[L]),q=t.useRef(null),[F,H]=t.useState(-1),[D,O]=t.useState(null),[j,Q]=t.useState(null),[V,Y]=t.useState(!1),U=t.useMemo(()=>s.map(e=>fe(e,c)),[s,c]),K=t.useMemo(()=>i.map(e=>he(e,d)),[i,d]),X=t.useMemo(()=>l.map(e=>ye(e,u)),[l,u]),G=K[0],J=K.slice(1,7),Z=t.useCallback(()=>{H(e=>Math.min(e+1,U.length-1))},[U.length]),ee=t.useCallback(()=>{H(e=>Math.max(e-1,-1))},[]),te=t.useCallback(()=>{F>=0&&U[F]&&C?.(U[F]._raw,F)},[F,U,C]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>F,setActiveIndex:H,selectActive:te,navigateNext:Z,navigatePrevious:ee,focus:()=>q.current?.focus(),close:()=>A?.()}),[F,te,Z,ee,A]),t.useEffect(()=>{if(F>=0&&q.current){const e=q.current.querySelector(`[data-index="${F}"]`);e&&ze(e,q.current)}},[F]),!a)return null;const re=ke(m),oe=G?((e,t)=>{if(e&&t&&!(t<=e))return Math.round((t-e)/t*100)})(G.price,G.comparePrice):void 0;return t.createElement("div",{ref:q,role:"listbox","aria-label":"Search suggestions",className:Se("seekora-shopify-dropdown",S,w.root),style:Ee(W.root,{width:L?"100%":b,maxHeight:L?"100vh":v,zIndex:k},re,E),tabIndex:-1},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n .seekora-shopify-dropdown mark {\n background: transparent;\n text-decoration: underline;\n font-weight: 600;\n }\n "),M,n?_?_():t.createElement("div",{style:W.loading},t.createElement("div",{style:W.spinner})):t.createElement("div",{style:W.layout},t.createElement("div",{style:W.leftPanel},t.createElement("div",{style:W.section},t.createElement("div",{style:W.sectionHeader},t.createElement("span",{style:W.sectionTitle},"Suggestions"),U.length>5&&t.createElement("span",{style:W.viewAllLink,onClick:()=>N?.("suggestions")},"View all")),U.slice(0,5).map((e,r)=>{const a=F===r;return t.createElement("div",{key:e.id||r,"data-index":r,role:"option","aria-selected":a,style:Ee(W.suggestionItem,a?W.suggestionItemActive:void 0),onClick:()=>C?.(e._raw,r),onMouseEnter:()=>H(r)},t.createElement("div",{style:W.suggestionIcon},t.createElement(st,null)),t.createElement("div",{style:W.suggestionContent},t.createElement("div",{style:W.suggestionQuery,dangerouslySetInnerHTML:{__html:ve(e.query,o,{tag:"mark"})}}),e.count&&t.createElement("div",{style:W.suggestionMeta},e.count," results")),t.createElement("div",{style:Ee(W.suggestionArrow,a?W.suggestionArrowVisible:void 0)},t.createElement(it,null)))}),0===U.length&&o&&(B?B(o):t.createElement("div",{style:{padding:"20px",textAlign:"center",color:"#666"}},'No suggestions for "',o,'"'))),f&&X.length>0&&t.createElement(t.Fragment,null,t.createElement("div",{style:W.sectionHeader},t.createElement("span",{style:W.sectionTitle},"Collections")),t.createElement("div",{style:W.collectionsGrid},X.slice(0,4).map(e=>t.createElement("div",{key:e.id,style:Ee(W.collectionItem,j===e.id?W.collectionItemHover:void 0),onClick:()=>z?.(e.id),onMouseEnter:()=>Q(e.id),onMouseLeave:()=>Q(null)},t.createElement("div",{style:W.collectionName},e.label),e.count&&t.createElement("div",{style:W.collectionCount},e.count," products")))))),t.createElement("div",{style:W.rightPanel},g&&G&&t.createElement("div",{style:W.heroProduct},G.image&&t.createElement("img",{src:G.image,alt:G.title,style:W.heroImage,loading:"lazy"}),G.brand&&t.createElement("div",{style:W.heroBrand},G.brand),t.createElement("div",{style:W.heroTitle},G.title),t.createElement("div",{style:W.heroPricing},t.createElement("span",{style:W.heroPrice},xe(G.price,{currency:p.currency||G.currency||"$"})),x&&G.comparePrice&&t.createElement("span",{style:W.heroComparePrice},xe(G.comparePrice,{currency:p.currency||G.currency||"$"})),oe&&t.createElement("span",{style:W.heroDiscount},"-",oe,"%")),h&&t.createElement("button",{style:Ee(W.heroButton,V?W.heroButtonHover:void 0),onClick:()=>T?.(G._raw),onMouseEnter:()=>Y(!0),onMouseLeave:()=>Y(!1)},y)),J.length>0&&t.createElement(t.Fragment,null,t.createElement("div",{style:{...W.sectionTitle,marginBottom:"12px"}},"More Products"),t.createElement("div",{style:W.productsScroll},J.map((e,r)=>t.createElement("div",{key:e.id,style:Ee(W.productCard,D===e.id?W.productCardHover:void 0),onClick:()=>R?.(e._raw,r+1),onMouseEnter:()=>O(e.id),onMouseLeave:()=>O(null)},e.image?t.createElement("img",{src:e.image,alt:e.title,style:W.productImage,loading:"lazy"}):t.createElement("div",{style:W.productImage}),t.createElement("div",{style:W.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:W.productPrice},xe(e.price,{currency:p.currency||e.currency||"$"})))))))),void 0!==P?P:t.createElement("div",{style:W.footer},t.createElement("span",null,"Press ",t.createElement("strong",null,"Enter")," to search, ",t.createElement("strong",null,"↑↓")," to navigate"),t.createElement("span",{style:W.footerLink,onClick:()=>N?.("products")},"View all results")))}),ct=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},t.createElement("circle",{cx:"11",cy:"11",r:"7"}),t.createElement("path",{d:"M21 21l-4.35-4.35"})),dt=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},t.createElement("circle",{cx:"12",cy:"12",r:"10"}),t.createElement("polyline",{points:"12 6 12 12 16 14"})),ut=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},t.createElement("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),t.createElement("polyline",{points:"17 6 23 6 23 12"})),pt=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",width:"20",height:"20"},t.createElement("polyline",{points:"9 18 15 12 9 6"})),mt=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",width:"20",height:"20"},t.createElement("path",{d:"M7 17l5-5-5-5M13 17l5-5-5-5"})),gt=t.forwardRef(function(e,r){const{query:o,isOpen:a=!0,loading:n=!1,suggestions:s=[],products:i=[],recentSearches:l=[],trendingSearches:c=[],suggestionFields:d={query:"query"},productFields:u={id:"id",title:"title"},productDisplay:p={},theme:m={},showSearchInput:g=!0,showCancel:f=!0,cancelText:h="Cancel",showDragHandle:y=!0,swipeToDismiss:x=!0,footerButtonText:b="Search",showFooterButton:v=!0,width:k="100%",maxHeight:S="85vh",zIndex:E=9999,className:w,style:C,classNames:R={},inputRef:I,onSuggestionSelect:z,onProductClick:T,onRecentClick:N,onRecentClearAll:A,onSearchSubmit:M,onClose:P,header:_,footer:B,renderLoading:$,renderEmpty:L}=e;We();const W=t.useMemo(()=>({overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:9998,transition:"opacity 200ms ease"},root:{position:"fixed",left:0,right:0,bottom:0,backgroundColor:"var(--seekora-bg-surface, #fff)",borderRadius:"16px 16px 0 0",boxShadow:"0 -4px 20px rgba(0, 0, 0, 0.15)",fontFamily:'var(--seekora-font-family, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif)',fontSize:"var(--seekora-font-size, 16px)",zIndex:9999,transform:"translateY(0)",transition:"transform 300ms cubic-bezier(0.32, 0.72, 0, 1)",maxHeight:"90vh",display:"flex",flexDirection:"column"},rootHidden:{transform:"translateY(100%)"},dragHandle:{display:"flex",justifyContent:"center",padding:"12px",cursor:"grab"},dragBar:{width:"36px",height:"5px",backgroundColor:"var(--seekora-border-color, #e0e0e0)",borderRadius:"3px"},header:{padding:"0 16px 16px",borderBottom:"1px solid var(--seekora-border-color, #f0f0f0)"},searchContainer:{display:"flex",alignItems:"center",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",borderRadius:"12px",padding:"12px 16px",gap:"12px"},searchIcon:{width:"20px",height:"20px",color:"var(--seekora-text-tertiary, #8e8e93)",flexShrink:0},searchInput:{flex:1,border:"none",background:"transparent",fontSize:"17px",color:"var(--seekora-text-primary, #000)",outline:"none"},cancelBtn:{padding:"8px",background:"none",border:"none",color:"var(--seekora-primary, #007aff)",fontSize:"17px",cursor:"pointer"},content:{flex:1,overflowY:"auto",overscrollBehavior:"contain",WebkitOverflowScrolling:"touch"},section:{padding:"8px 0"},sectionHeader:{padding:"16px 16px 8px",display:"flex",alignItems:"center",justifyContent:"space-between"},sectionTitle:{fontSize:"13px",fontWeight:600,color:"var(--seekora-text-secondary, #8e8e93)",textTransform:"uppercase",letterSpacing:"0.5px"},clearBtn:{fontSize:"15px",color:"var(--seekora-primary, #007aff)",background:"none",border:"none",cursor:"pointer"},item:{display:"flex",alignItems:"center",padding:"14px 16px",gap:"14px",cursor:"pointer",transition:"background-color 100ms",minHeight:"56px",color:"var(--seekora-text-primary, #000)"},itemActive:{backgroundColor:"var(--seekora-bg-hover, #f2f2f7)",color:"var(--seekora-text-primary, #000)"},itemIcon:{width:"24px",height:"24px",color:"var(--seekora-text-tertiary, #8e8e93)",flexShrink:0},itemImage:{width:"48px",height:"48px",borderRadius:"8px",objectFit:"cover",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",flexShrink:0},itemContent:{flex:1,minWidth:0},itemTitle:{fontSize:"17px",color:"var(--seekora-text-primary, #000)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},itemSubtitle:{fontSize:"15px",color:"var(--seekora-text-secondary, #8e8e93)",marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},itemAction:{color:"var(--seekora-text-tertiary, #c7c7cc)",flexShrink:0},productsScroll:{display:"flex",gap:"12px",padding:"0 16px 16px",overflowX:"auto",scrollSnapType:"x mandatory",WebkitOverflowScrolling:"touch"},productCard:{flex:"0 0 140px",scrollSnapAlign:"start",cursor:"pointer"},productImage:{width:"140px",height:"140px",borderRadius:"12px",objectFit:"cover",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",marginBottom:"8px"},productTitle:{fontSize:"15px",color:"var(--seekora-text-primary, #000)",marginBottom:"4px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},productPrice:{fontSize:"15px",fontWeight:600,color:"var(--seekora-text-primary, #000)"},footer:{padding:"12px 16px",paddingBottom:"calc(12px + env(safe-area-inset-bottom, 0px))",borderTop:"1px solid var(--seekora-border-color, #f0f0f0)",backgroundColor:"var(--seekora-bg-secondary, #f8f8f8)"},footerBtn:{width:"100%",padding:"16px",backgroundColor:"var(--seekora-primary, #007aff)",color:"var(--seekora-text-inverse, #ffffff)",border:"none",borderRadius:"12px",fontSize:"17px",fontWeight:600,cursor:"pointer"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"60px",color:"var(--seekora-text-secondary, #8e8e93)"},spinner:{width:"28px",height:"28px",border:"3px solid var(--seekora-border-color, #e5e5ea)",borderTopColor:"var(--seekora-primary, #007aff)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"60px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #8e8e93)",fontSize:"17px"},emptyIcon:{width:"48px",height:"48px",margin:"0 auto 16px",color:"var(--seekora-text-tertiary, #c7c7cc)"}}),[]),q=t.useRef(null),[F,H]=t.useState(-1),[D,O]=t.useState(o),[j,Q]=t.useState(0),[V,Y]=t.useState(!1),U=t.useRef(0),K=t.useMemo(()=>s.map(e=>fe(e,d)),[s,d]),X=t.useMemo(()=>i.map(e=>he(e,u)),[i,u]),G=t.useMemo(()=>l.map(e=>"string"==typeof e?e:e.query).slice(0,5),[l]),J=t.useMemo(()=>c.map(e=>"string"==typeof e?e:e.query).slice(0,5),[c]),Z=t.useMemo(()=>{const e=[];return G.forEach(t=>e.push({type:"recent",data:t})),J.forEach(t=>e.push({type:"trending",data:t})),K.forEach(t=>e.push({type:"suggestion",data:t})),e},[G,J,K]),ee=t.useCallback(()=>{H(e=>Math.min(e+1,Z.length-1))},[Z.length]),te=t.useCallback(()=>{H(e=>Math.max(e-1,-1))},[]),re=t.useCallback(()=>{if(F<0||F>=Z.length)return void(D.trim()&&M?.(D.trim()));const e=Z[F];"recent"===e.type||"trending"===e.type?N?.(e.data):"suggestion"===e.type&&z?.(e.data._raw,F)},[F,Z,D,M,N,z]);t.useImperativeHandle(r,()=>({getActiveIndex:()=>F,setActiveIndex:H,selectActive:re,navigateNext:ee,navigatePrevious:te,focus:()=>I?.current?.focus(),close:()=>P?.()}),[F,re,ee,te,I,P]),t.useEffect(()=>{if(F>=0&&q.current){const e=q.current.querySelector(`[data-index="${F}"]`);e&&ze(e,q.current)}},[F]);if(t.useEffect(()=>{O(o)},[o]),!a)return null;const oe=ke(m),ae=!D&&G.length>0,ne=!D&&J.length>0,se=X.length>0;return t.createElement(t.Fragment,null,t.createElement("div",{style:{...W.overlay,opacity:V?1-j/300:1},onClick:P}),t.createElement("div",{ref:q,className:Se("seekora-mobile-sheet",w,R.root),style:Ee(W.root,{maxHeight:S,zIndex:E,transform:V?`translateY(${j}px)`:"translateY(0)"},oe,C),onTouchStart:e=>{x&&(Y(!0),U.current=e.touches[0].clientY)},onTouchMove:e=>{if(!V)return;const t=e.touches[0].clientY-U.current;t>0&&Q(t)},onTouchEnd:()=>{V&&(Y(!1),j>150&&P?.(),Q(0))}},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n "),y&&t.createElement("div",{style:W.dragHandle},t.createElement("div",{style:W.dragBar})),(g||_)&&t.createElement("div",{style:W.header},_||t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},t.createElement("div",{style:W.searchContainer},t.createElement("div",{style:W.searchIcon},t.createElement(ct,null)),t.createElement("input",{ref:I,type:"text",placeholder:"Search...",value:D,onChange:e=>O(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),F>=0?re():D.trim()&&M?.(D.trim())):"ArrowDown"===e.key?(e.preventDefault(),ee()):"ArrowUp"===e.key?(e.preventDefault(),te()):"Escape"===e.key&&P?.()},style:W.searchInput,autoFocus:!0})),f&&t.createElement("button",{style:W.cancelBtn,onClick:P},h))),t.createElement("div",{style:W.content},n?$?$():t.createElement("div",{style:W.loading},t.createElement("div",{style:W.spinner})):t.createElement(t.Fragment,null,ae&&t.createElement("div",{style:W.section},t.createElement("div",{style:W.sectionHeader},t.createElement("span",{style:W.sectionTitle},"Recent"),t.createElement("button",{style:W.clearBtn,onClick:A},"Clear")),G.map((e,r)=>t.createElement("div",{key:`recent-${e}`,"data-index":r,style:Ee(W.item,F===r?W.itemActive:void 0),onClick:()=>{N?.(e),O(e)},onMouseEnter:()=>H(r)},t.createElement("div",{style:W.itemIcon},t.createElement(dt,null)),t.createElement("div",{style:W.itemContent},t.createElement("div",{style:W.itemTitle},e)),t.createElement("div",{style:W.itemAction},t.createElement(mt,null))))),ne&&t.createElement("div",{style:W.section},t.createElement("div",{style:W.sectionHeader},t.createElement("span",{style:W.sectionTitle},"Trending")),J.map((e,r)=>{const o=G.length+r;return t.createElement("div",{key:`trending-${e}`,"data-index":o,style:Ee(W.item,F===o?W.itemActive:void 0),onClick:()=>{N?.(e),O(e)},onMouseEnter:()=>H(o)},t.createElement("div",{style:W.itemIcon},t.createElement(ut,null)),t.createElement("div",{style:W.itemContent},t.createElement("div",{style:W.itemTitle},e)),t.createElement("div",{style:W.itemAction},t.createElement(pt,null)))})),D&&K.length>0&&t.createElement("div",{style:W.section},t.createElement("div",{style:W.sectionHeader},t.createElement("span",{style:W.sectionTitle},"Suggestions")),K.map((e,r)=>{const o=G.length+J.length+r;return t.createElement("div",{key:e.id||r,"data-index":o,style:Ee(W.item,F===o?W.itemActive:void 0),onClick:()=>z?.(e._raw,r),onMouseEnter:()=>H(o)},t.createElement("div",{style:W.itemIcon},t.createElement(ct,null)),t.createElement("div",{style:W.itemContent},t.createElement("div",{style:W.itemTitle,dangerouslySetInnerHTML:{__html:ve(e.query,D,{tag:"strong"})}}),e.count&&t.createElement("div",{style:W.itemSubtitle},e.count," results")),t.createElement("div",{style:W.itemAction},t.createElement(pt,null)))})),se&&t.createElement("div",{style:W.section},t.createElement("div",{style:W.sectionHeader},t.createElement("span",{style:W.sectionTitle},"Products")),t.createElement("div",{style:W.productsScroll},X.slice(0,8).map((e,r)=>t.createElement("div",{key:e.id,style:W.productCard,onClick:()=>T?.(e._raw,r)},e.image?t.createElement("img",{src:e.image,alt:e.title,style:W.productImage,loading:"lazy"}):t.createElement("div",{style:W.productImage}),t.createElement("div",{style:W.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:W.productPrice},xe(e.price,{currency:p.currency||e.currency||"$"})))))),D&&0===K.length&&!n&&(L?L(D):t.createElement("div",{style:W.empty},t.createElement("div",{style:W.emptyIcon},t.createElement(ct,null)),t.createElement("p",null,'No results for "',D,'"'))))),void 0!==B?B:v&&D&&t.createElement("div",{style:W.footer},t.createElement("button",{style:W.footerBtn,onClick:()=>M?.(D)},b,' "',D,'"'))))}),ft=t.forwardRef(function(e,r){const{query:o,isOpen:a=!0,loading:n=!1,suggestions:s=[],products:i=[],recentSearches:l=[],suggestionFields:c={query:"query"},productFields:d={id:"id",title:"title"},productDisplay:u={},theme:p={},showIndices:m=!1,showTypeLabels:g=!1,showSectionDividers:f=!0,width:h="100%",maxHeight:y="400px",zIndex:x=1e3,className:b,style:v,classNames:k={},onSuggestionSelect:S,onProductClick:E,onRecentClick:w,onClose:C,onSearchSubmit:R,header:I,footer:z,renderLoading:T,renderEmpty:N}=e;We();const A=Be(),{isMobile:M}=A,P=t.useMemo(()=>({root:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e5e5)",fontFamily:'var(--seekora-font-family, "Inter", -apple-system, sans-serif)',fontSize:"var(--seekora-font-size, 15px)",letterSpacing:"-0.01em"},item:{display:"flex",alignItems:"center",padding:"16px 20px",cursor:"pointer",transition:"background-color 150ms ease, padding-left 150ms ease",borderBottom:"1px solid var(--seekora-border-color, #e8e8e8)",gap:"16px",color:"var(--seekora-text-primary, #111)"},itemLast:{borderBottom:"none"},itemActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #111)",paddingLeft:"24px"},itemIndex:{fontSize:"11px",fontWeight:500,color:"var(--seekora-text-tertiary, #999)",fontFamily:"monospace",minWidth:"20px"},itemContent:{flex:1,minWidth:0},itemQuery:{fontSize:"15px",fontWeight:500,color:"var(--seekora-text-primary, #111)"},itemMeta:{fontSize:"13px",color:"var(--seekora-text-secondary, #666)",marginTop:"4px",fontWeight:400},itemType:{fontSize:"10px",fontWeight:600,color:"var(--seekora-text-tertiary, #999)",textTransform:"uppercase",letterSpacing:"0.1em",padding:"4px 8px",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)"},productRow:{display:"flex",alignItems:"center",padding:"16px 20px",cursor:"pointer",transition:"background-color 150ms ease",borderBottom:"1px solid var(--seekora-border-color, #e8e8e8)",gap:"16px",color:"var(--seekora-text-primary, #111)"},productRowActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #111)"},productImage:{width:"56px",height:"56px",objectFit:"cover",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",flexShrink:0},productContent:{flex:1,minWidth:0},productTitle:{fontSize:"14px",fontWeight:500,color:"var(--seekora-text-primary, #111)",marginBottom:"4px"},productPrice:{fontSize:"14px",color:"var(--seekora-text-secondary, #666)"},divider:{padding:"12px 20px 8px",fontSize:"10px",fontWeight:600,color:"var(--seekora-text-tertiary, #999)",textTransform:"uppercase",letterSpacing:"0.15em",backgroundColor:"var(--seekora-bg-surface, #ffffff)",borderBottom:"1px solid var(--seekora-border-color, #f0f0f0)"},footer:{padding:"12px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"var(--seekora-bg-secondary, #fafafa)",fontSize:"12px",color:"var(--seekora-text-tertiary, #999)",borderTop:"1px solid var(--seekora-border-color, #e5e5e5)"},footerHint:{display:"flex",alignItems:"center",gap:"12px"},kbd:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"2px 6px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #ddd)",fontSize:"10px",fontFamily:"monospace"},loading:{padding:"40px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #666)",fontSize:"14px"},empty:{padding:"40px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #666)",fontSize:"14px"},highlight:{backgroundColor:"var(--seekora-highlight-bg, #fff3cd)",padding:"0 2px"}}),[]),_=t.useRef(null),B=t.useRef(null),[$,L]=t.useState(-1),W=t.useMemo(()=>s.map(e=>fe(e,c)),[s,c]),q=t.useMemo(()=>i.map(e=>he(e,d)),[i,d]),F=t.useMemo(()=>l.map(e=>"string"==typeof e?e:e.query).slice(0,3),[l]),H=t.useMemo(()=>{const e=[];return!o&&F.length>0&&F.forEach(t=>e.push({type:"recent",data:t})),W.forEach(t=>e.push({type:"suggestion",data:t})),q.forEach(t=>e.push({type:"product",data:t})),e},[o,F,W,q]),D=t.useCallback(()=>{L(e=>Math.min(e+1,H.length-1))},[H.length]),O=t.useCallback(()=>{L(e=>Math.max(e-1,-1))},[]),j=t.useCallback(()=>{const e=H[$];if(e)switch(e.type){case"recent":w?.(e.data);break;case"suggestion":S?.(e.data._raw,$);break;case"product":E?.(e.data._raw,$)}else o&&R?.(o)},[$,H,o,R,w,S,E]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>$,setActiveIndex:L,selectActive:j,navigateNext:D,navigatePrevious:O,focus:()=>_.current?.focus(),close:()=>C?.()}),[$,j,D,O,C]),t.useEffect(()=>{if(B.current&&$>=0){const e=B.current.querySelector(`[data-index="${$}"]`);e&&ze(e,B.current)}},[$]),t.useEffect(()=>{L(-1)},[o]),!a)return null;const Q=ke(p),V=!o&&F.length>0;let Y=0;return t.createElement("div",{ref:_,role:"listbox","aria-label":"Search suggestions",className:Se("seekora-minimal-dropdown",b,k.root),style:Ee(P.root,{width:h,zIndex:x},Q,v),tabIndex:-1},t.createElement("style",null,"\n .seekora-minimal-dropdown mark {\n background-color: var(--seekora-highlight-bg, #fff3cd);\n padding: 0 2px;\n }\n "),I,t.createElement("div",{ref:B,style:{maxHeight:y,overflowY:"auto"}},n?T?T():t.createElement("div",{style:P.loading},"Loading..."):0===H.length?N?N(o):t.createElement("div",{style:P.empty},o?`No results for "${o}"`:"Start typing to search"):t.createElement(t.Fragment,null,V&&t.createElement(t.Fragment,null,f&&t.createElement("div",{style:P.divider},"Recent"),F.map((e,r)=>{const o=Y++,a=$===o,n=r===F.length-1&&!W.length&&!q.length;return t.createElement("div",{key:`recent-${e}`,"data-index":o,style:Ee(P.item,a?P.itemActive:void 0,n?P.itemLast:void 0),onClick:()=>w?.(e),onMouseEnter:()=>L(o)},m&&t.createElement("span",{style:P.itemIndex},o+1),t.createElement("div",{style:P.itemContent},t.createElement("div",{style:P.itemQuery},e)),g&&t.createElement("span",{style:P.itemType},"Recent"))})),W.length>0&&t.createElement(t.Fragment,null,f&&(V||!1)&&t.createElement("div",{style:P.divider},"Suggestions"),W.map((e,r)=>{const a=Y++,n=$===a,s=r===W.length-1&&!q.length;return t.createElement("div",{key:e.id||`suggestion-${r}`,"data-index":a,style:Ee(P.item,n?P.itemActive:void 0,s?P.itemLast:void 0),onClick:()=>S?.(e._raw,r),onMouseEnter:()=>L(a)},m&&t.createElement("span",{style:P.itemIndex},a+1),t.createElement("div",{style:P.itemContent},t.createElement("div",{style:P.itemQuery,dangerouslySetInnerHTML:{__html:ve(e.query,o,{tag:"mark"})}}),e.count&&t.createElement("div",{style:P.itemMeta},e.count.toLocaleString()," results")),g&&t.createElement("span",{style:P.itemType},"Search"))})),q.length>0&&t.createElement(t.Fragment,null,f&&t.createElement("div",{style:P.divider},"Products"),q.slice(0,4).map((e,r)=>{const o=Y++,a=$===o;return t.createElement("div",{key:e.id,"data-index":o,style:Ee(P.productRow,a?P.productRowActive:void 0),onClick:()=>E?.(e._raw,r),onMouseEnter:()=>L(o)},e.image&&t.createElement("img",{src:e.image,alt:e.title,style:P.productImage,loading:"lazy"}),t.createElement("div",{style:P.productContent},t.createElement("div",{style:P.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:P.productPrice},xe(e.price,{currency:u.currency||e.currency||"$"}))),g&&t.createElement("span",{style:P.itemType},"Product"))})))),void 0!==z?z:t.createElement("div",{style:P.footer},t.createElement("div",{style:P.footerHint},t.createElement("span",null,t.createElement("span",{style:P.kbd},"↑")," ",t.createElement("span",{style:P.kbd},"↓")," navigate"),t.createElement("span",null,t.createElement("span",{style:P.kbd},"↵")," select"),t.createElement("span",null,t.createElement("span",{style:P.kbd},"esc")," close")),t.createElement("span",null,H.length," results")))});function ht(e){if(!e)return;const t=e,r=t.colors??{};return{backgroundColor:t.backgroundColor??r.background,textColor:t.textColor??r.text,surfaceColor:t.surfaceColor??r.hover,borderColor:t.borderColor??r.border,hoverColor:t.hoverColor??r.hover,primaryColor:t.primaryColor??r.primary,textSecondaryColor:t.textSecondaryColor??r.text,fontFamily:t.fontFamily}}const yt={amazon:je,google:Ke,pinterest:et,spotlight:nt,shopify:lt,"mobile-sheet":gt,minimal:ft},xt=t.forwardRef(function(e,r){const{client:o,variant:a="amazon",autoMobileVariant:n=!0,placeholder:s="Search...",defaultQuery:i="",value:l,minQueryLength:c=1,maxSuggestions:d=8,debounceMs:u=200,includeDropdownRecommendations:p=!0,includeCategories:m=!0,filteredTabs:g,analyticsTags:f,enableRecentSearches:h=!0,maxRecentSearches:x=10,showProducts:b=!0,showTrendingOnEmpty:v=!0,enableAnalytics:k=!0,analyticsConfig:S,suggestionFields:E,productFields:w,theme:C,onSearch:R,onQueryChange:I,onSuggestionSelect:z,onProductClick:T,onCategoryClick:N,onTabChange:A,className:M,style:P,inputClassName:_,dropdownWidth:B,dropdownMaxHeight:$="500px",zIndex:L=1e3,enableCache:W=!0,cacheTtlMs:q=3e4,cacheMaxSize:F=100}=e,H=y(),D=C??H.theme,O=ce({client:o,enabled:k,analyticsTags:S?.tags??f,trackImpressions:S?.trackImpressions??!0,trackClicks:S?.trackSuggestionClicks??!0});We(),t.useEffect(()=>{const e=document.documentElement,t=function(e){if(!e)return{"--seekora-bg-surface":"#ffffff","--seekora-bg-secondary":"#f7f7f7","--seekora-bg-tertiary":"#f0f0f0","--seekora-bg-hover":"#f5f5f5","--seekora-text-primary":"#0f1111","--seekora-text-secondary":"#565959","--seekora-text-tertiary":"#767676","--seekora-border-color":"#e7e7e7","--seekora-primary":"#f90","--seekora-text-on-primary":"#0f1111","--seekora-text-inverse":"#ffffff","--seekora-link":"#007185","--seekora-font-family":'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'};const t=e,r=t.colors??{};return{"--seekora-bg-surface":t.backgroundColor??r.background??"#ffffff","--seekora-bg-secondary":t.surfaceColor??r.hover??"#f7f7f7","--seekora-bg-tertiary":t.hoverColor??r.hover??"#f0f0f0","--seekora-bg-hover":t.hoverColor??r.hover??"#f5f5f5","--seekora-text-primary":t.textColor??r.text??"#0f1111","--seekora-text-secondary":t.textSecondaryColor??r.text??"#565959","--seekora-text-tertiary":t.textSecondaryColor??"#767676","--seekora-border-color":t.borderColor??r.border??"#e7e7e7","--seekora-primary":t.primaryColor??r.primary??"#f90","--seekora-text-on-primary":t.textOnPrimaryColor??"#0f1111","--seekora-text-inverse":t.textInverseColor??"#ffffff","--seekora-link":t.primaryColor??r.primary??"#007185","--seekora-font-family":t.fontFamily??'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'}}(D);Object.entries(t).forEach(([t,r])=>{e.style.setProperty(t,r)})},[D]);const j=Be(),{isMobile:Q}=j,V=t.useMemo(()=>n&&Q&&"mobile-sheet"!==a&&"spotlight"!==a?"mobile-sheet":a,[a,Q,n]),[Y,U]=t.useState(i),[K,X]=t.useState(!1),[G,J]=t.useState(!1),[Z,ee]=t.useState(!1),[te,re]=t.useState([]),[oe,ae]=t.useState([]),[ne,se]=t.useState([]),[ie,le]=t.useState([]),[de,ue]=t.useState([]),[pe,me]=t.useState([]),[ge,fe]=t.useState("all"),he=t.useRef(null),ye=t.useRef(null),xe=t.useRef(null),be=t.useRef(null),ve=t.useMemo(()=>W?Ae({maxSize:F,defaultTtlMs:q}):null,[W,F,q]),ke=void 0!==l?l:Y,we=t.useMemo(()=>(e=>({container:{position:"relative",width:"100%",fontFamily:'var(--seekora-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif)'},inputWrapper:{display:"flex",alignItems:"center",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #111827)",borderWidth:"2px",borderStyle:"solid",borderColor:"var(--seekora-border-color, #d1d5db)",borderRadius:e?"8px":"24px",overflow:"hidden",transition:"border-color 150ms, box-shadow 150ms",boxShadow:"0 1px 3px rgba(0,0,0,0.05)"},inputWrapperFocused:{borderColor:"var(--seekora-primary, #f90)",boxShadow:"0 0 0 3px rgba(255, 153, 0, 0.15), 0 2px 8px rgba(0,0,0,0.1)"},searchIcon:{padding:e?"0 10px 0 14px":"0 12px 0 18px",color:"var(--seekora-text-secondary, #6b7280)",display:"flex",alignItems:"center",flexShrink:0},input:{flex:1,padding:e?"12px 8px 12px 0":"14px 12px 14px 0",fontSize:e?"16px":"15px",borderWidth:0,borderStyle:"none",outline:"none",backgroundColor:"transparent",color:"var(--seekora-text-primary, #0f1111)",fontFamily:"inherit",minWidth:0,WebkitAppearance:"none"},clearButton:{padding:"8px 14px",background:"none",borderWidth:0,borderStyle:"none",cursor:"pointer",color:"var(--seekora-text-tertiary, #9ca3af)",fontSize:"18px",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"color 150ms"},loadingSpinner:{width:"18px",height:"18px",borderWidth:"2px",borderStyle:"solid",borderColor:"#e5e7eb",borderTopColor:"#f90",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite",marginRight:"12px",flexShrink:0}}))(Q),[Q]);t.useEffect(()=>{if(h){const e=Ce();me(e.slice(0,x))}},[h,x]);const ze=t.useCallback(async e=>{if(!o)return;if(e.length>0&&e.length<c)return re([]),ae([]),void le([]);const t={maxSuggestions:d,includeDropdownRecommendations:p,includeCategories:m,filteredTabs:g?.map(e=>e.filter).join(",")},r=ve?.generateKey(e,t);if(ve&&r){const t=ve.get(r);if(t)return console.log("Seekora: Cache hit for query:",e),void Te(t)}ee(!0);try{const t=await(o.getSuggestions?.(e,{hitsPerPage:d,include_dropdown_recommendations:p,include_categories:m,filtered_tabs:g,analytics_tags:f,returnFullResponse:!0}));if(ve&&r&&t&&(ve.set(r,t),console.log("Seekora: Cached response for query:",e)),Te(t),k&&t&&!Array.isArray(t)){const r=t;O.trackImpression({suggestions:(r.suggestions||[]).map(e=>({query:e.query||e.text||"",objectID:e.objectID||e.id,popularity:e.popularity})),products:r.extensions?.trending_products||r.extensions?.item_recommendations||[],categories:r.extensions?.popular_categories||[],brands:r.extensions?.popular_brands||[],query:e,timestamp:Date.now()})}}catch(e){console.error("Seekora: Failed to fetch suggestions",e),re([]),ae([]),le([])}finally{ee(!1)}},[o,c,d,p,m,g,f,k,O,ve]),Te=t.useCallback(e=>{let t=[],r={};if(console.log("Seekora: Raw response structure",{hasSuggestions:!!e?.suggestions,hasResults:!!e?.results,hasExtensions:!!e?.extensions,hasData:!!e?.data}),e?.suggestions&&e?.extensions)t=e.suggestions||[],r=e.extensions||{};else if(e?.results&&Array.isArray(e.results)){const o=e.results[0]||{},a=e.results[1]||{};t=o.hits||o.suggestions||[],r=o.extensions||a.extensions||{}}else e?.data?(t=e.data.hits||[],r=e.data.extensions||e.data.dropdown_recommendations||{}):e?.hits?(t=e.hits||[],r=e.extensions||e.dropdown_recommendations||{}):Array.isArray(e)&&(t=e);re(t);const o=r.filtered_tabs||[];le(o),o.length>0&&o[0].products?ae(o[0].products):ae(r.trending_products||r.item_recommendations||[]),se(r.popular_categories||[]),ue(r.trending_searches||r.top_searches||[]),console.log("Seekora: Parsed response",{suggestions:t.length,tabs:o.length,products:o[0]?.products?.length||0,extensionKeys:Object.keys(r)})},[]),Ne=t.useCallback(e=>{const t=e.target.value;void 0===l&&U(t),I?.(t),fe("all"),xe.current&&clearTimeout(xe.current),t.length>=c?(X(!0),xe.current=setTimeout(()=>{ze(t)},u)):0===t.length&&(h||v)?(X(!0),re([])):X(!1)},[l,I,c,u,ze,h,v]),Me=t.useCallback(()=>{J(!0),X(!0),k&&O.trackDropdownOpen(ke),ke.length>=c?0===te.length&&ze(ke):ze("")},[ke,c,te.length,ze,k,O]),Pe=t.useCallback(()=>{J(!1),setTimeout(()=>{be.current?.contains(document.activeElement)||X(!1)},150)},[]),_e=t.useCallback(e=>{if("Escape"===e.key)X(!1),he.current?.blur();else if("Enter"===e.key){e.preventDefault();(ye.current?.getActiveIndex?.()??-1)>=0&&K?ye.current?.selectActive?.():ke.trim()&&(R?.(ke.trim()),h&&(Re(ke.trim()),me(Ce().slice(0,x))),k&&O.trackSearchSubmit(ke.trim(),!1),X(!1))}else"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),!K&&(te.length>0||pe.length>0)&&X(!0),"ArrowDown"===e.key?ye.current?.navigateNext?.():ye.current?.navigatePrevious?.())},[ke,R,h,x,K,te.length,pe.length,k,O]),$e=t.useCallback((e,t)=>{const r=e.query||e.text||e.objectID||"";void 0===l&&U(r),I?.(r),z?.(e,t),h&&r&&(Re(r),me(Ce().slice(0,x))),k&&(O.trackSuggestionClick({suggestion:{query:r,objectID:e.objectID||e.id,popularity:e.popularity},position:t,section:"suggestions",query:ke,totalSuggestions:te.length}),O.trackSearchSubmit(r,!0,e)),R?.(r),X(!1)},[l,I,z,h,x,k,R,O,ke,te.length]),Le=t.useCallback((e,t)=>{T?.(e,t),k&&O.trackProductClick({product:{id:e.id||e.objectID,objectID:e.objectID||e.id,title:e.title||e.name,image:e.image,price:e.price},position:t,section:"all"!==ge?"filtered_tab":"products",tabId:"all"!==ge?ge:void 0,query:ke})},[T,k,O,ge,ke]),qe=t.useCallback((e,t)=>{N?.(e,t),k&&O.trackCategoryClick({value:e.label||e.value||e.id,count:e.count,path:e.path},ke)},[N,k,O,ke]),Fe=t.useCallback(e=>{if(console.log("Seekora: Tab changed to",e),fe(e),A?.(e),k){const t=ie.find(t=>t.id===e);t&&O.trackTabSelect({id:t.id,label:t.label,filter:t.filter,products:t.products,nb_hits:t.nb_hits},ke)}},[A,k,O,ie,ke]),He=t.useCallback(e=>{void 0===l&&U(e),I?.(e),ze(e),k&&O.trackRecentSearchClick({query:e,timestamp:Date.now()})},[l,I,ze,k,O]),De=t.useCallback(e=>{Ie(e),me(Ce().slice(0,x))},[x]),Oe=t.useCallback(()=>{void 0===l&&U(""),I?.(""),re([]),ae([]),le([]),he.current?.focus()},[l,I]),Qe=t.useCallback(()=>{X(!1),k&&O.trackDropdownClose(ke)},[k,O,ke]);t.useImperativeHandle(r,()=>({focus:()=>he.current?.focus(),blur:()=>he.current?.blur(),clear:Oe,getQuery:()=>ke,setQuery:e=>{void 0===l&&U(e),I?.(e)},openDropdown:()=>X(!0),closeDropdown:()=>X(!1),refresh:()=>ze(ke),clearCache:()=>ve?.clear(),getCacheStats:()=>ve?.getStats()??null}),[ke,l,I,Oe,ze,ve]);const Ve=yt[V]||je,Ye=t.useMemo(()=>{if(console.log("Seekora: Computing products for tab",ge,"from",ie.length,"tabs"),0===ie.length)return oe;if("all"===ge){const e=ie[0]?.products||[];return e.length>0?e:oe}const e=ie.find(e=>e.id===ge);return e?.products&&e.products.length>0?(console.log("Seekora: Found",e.products.length,"products for tab",ge),e.products):oe},[ge,ie,oe]);return t.createElement("div",{ref:be,className:Se("seekora-suggestion-search",M),style:Ee(we.container,P)},t.createElement("div",{style:Ee(we.inputWrapper,G?we.inputWrapperFocused:void 0)},t.createElement("div",{style:we.searchIcon},t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"20",height:"20"},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"}))),t.createElement("input",{ref:he,type:"text",value:ke,onChange:Ne,onFocus:Me,onBlur:Pe,onKeyDown:_e,placeholder:s,className:_,style:we.input,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":"Search","aria-expanded":K,"aria-haspopup":"listbox"}),Z&&t.createElement("div",{style:we.loadingSpinner}),ke&&!Z&&t.createElement("button",{type:"button",onClick:Oe,style:we.clearButton,"aria-label":"Clear search"},"×")),K&&t.createElement(Ve,{query:ke,isOpen:K,loading:Z,suggestions:te,products:Ye,categories:ie.map(e=>({id:e.id,label:e.label,count:e.nb_hits})),recentSearches:pe.map(e=>"string"==typeof e?e:e.query),trendingSearches:de,filteredTabs:ie,activeTab:ge,suggestionFields:E,productFields:w,theme:ht(D)??D,width:B||"100%",maxHeight:$,zIndex:L,analytics:{enabled:k,trackSuggestionClicks:S?.trackSuggestionClicks??!0,trackProductClicks:S?.trackProductClicks??!0,trackImpressions:S?.trackImpressions??!0,trackCategoryClicks:S?.trackCategoryClicks??!0,trackBrandClicks:S?.trackBrandClicks??!0,trackSearchSubmit:S?.trackSearchSubmit??!0,tags:S?.tags??f},onSuggestionSelect:$e,onProductClick:Le,onCategoryClick:qe,onTabChange:Fe,onRecentClick:He,onRecentRemove:De,onClose:Qe}))}),bt={amazon:je,google:Ke,pinterest:et,spotlight:nt,shopify:lt,"mobile-sheet":gt,minimal:ft};function vt(e,t,r=2){const o=e.toLowerCase().split(/\s+/),a=[];return o.forEach(o=>{o.length<3||t.forEach(t=>{const n=function(e,t){const r=[];for(let e=0;e<=t.length;e++)r[e]=[e];for(let t=0;t<=e.length;t++)r[0][t]=t;for(let o=1;o<=t.length;o++)for(let a=1;a<=e.length;a++)t.charAt(o-1)===e.charAt(a-1)?r[o][a]=r[o-1][a-1]:r[o][a]=Math.min(r[o-1][a-1]+1,r[o][a-1]+1,r[o-1][a]+1);return r[t.length][e.length]}(o,t.toLowerCase());if(n>0&&n<=r&&n<o.length/2){const r=e.replace(new RegExp(o,"gi"),t);a.includes(r)||a.push(r)}})}),a.slice(0,3)}const kt={price:[{pattern:/under\s*\$?(\d+(?:\.\d{2})?)/i,operator:"<=",field:"price"},{pattern:/less than\s*\$?(\d+(?:\.\d{2})?)/i,operator:"<",field:"price"},{pattern:/over\s*\$?(\d+(?:\.\d{2})?)/i,operator:">=",field:"price"},{pattern:/more than\s*\$?(\d+(?:\.\d{2})?)/i,operator:">",field:"price"},{pattern:/\$(\d+(?:\.\d{2})?)\s*-\s*\$?(\d+(?:\.\d{2})?)/i,operator:"range",field:"price"},{pattern:/between\s*\$?(\d+(?:\.\d{2})?)\s*and\s*\$?(\d+(?:\.\d{2})?)/i,operator:"range",field:"price"},{pattern:/\$(\d+(?:\.\d{2})?)/i,operator:"<=",field:"price"}],colors:["red","blue","green","black","white","pink","purple","yellow","orange","brown","gray","grey","navy","beige","gold","silver"],sizes:{"extra small":"XS",xs:"XS",small:"S",s:"S",medium:"M",m:"M",large:"L",l:"L","extra large":"XL",xl:"XL",xxl:"XXL","2xl":"XXL",xxxl:"XXXL","3xl":"XXXL"},brandIndicators:["by","from","brand"],ratings:[{pattern:/(\d+)\s*\+?\s*stars?/i,field:"rating",operator:">="},{pattern:/rated\s*(\d+)/i,field:"rating",operator:">="},{pattern:/top\s*rated/i,field:"rating",value:"4",operator:">="}],availability:[{pattern:/in\s*stock/i,field:"inStock",value:"true"},{pattern:/available/i,field:"inStock",value:"true"},{pattern:/on\s*sale/i,field:"onSale",value:"true"}]};const St={"--seekora-bg-surface":"#ffffff","--seekora-bg-secondary":"#f9fafb","--seekora-bg-tertiary":"#f3f4f6","--seekora-bg-hover":"#f3f4f6","--seekora-text-primary":"#111827","--seekora-text-secondary":"#6b7280","--seekora-text-tertiary":"#9ca3af","--seekora-border-color":"#e5e7eb","--seekora-primary":"#3b82f6","--seekora-primary-light":"#eff6ff","--seekora-primary-dark":"#1d4ed8","--seekora-highlight-bg":"#fef3c7","--seekora-success":"#10b981","--seekora-warning":"#f59e0b","--seekora-error":"#ef4444","--seekora-font-family":'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',"--seekora-font-size-xs":"11px","--seekora-font-size-sm":"12px","--seekora-font-size-base":"14px","--seekora-font-size-lg":"16px","--seekora-font-weight-normal":"400","--seekora-font-weight-medium":"500","--seekora-font-weight-semibold":"600","--seekora-font-weight-bold":"700","--seekora-line-height-tight":"1.25","--seekora-line-height-normal":"1.5","--seekora-line-height-relaxed":"1.75","--seekora-spacing-xs":"4px","--seekora-spacing-sm":"8px","--seekora-spacing-md":"12px","--seekora-spacing-lg":"16px","--seekora-spacing-xl":"24px","--seekora-border-radius-sm":"4px","--seekora-border-radius":"6px","--seekora-border-radius-lg":"8px","--seekora-border-radius-xl":"12px","--seekora-border-radius-full":"9999px","--seekora-shadow-sm":"0 1px 2px 0 rgba(0, 0, 0, 0.05)","--seekora-shadow":"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)","--seekora-shadow-md":"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)","--seekora-shadow-lg":"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)","--seekora-shadow-xl":"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","--seekora-transition-fast":"100ms ease","--seekora-transition-normal":"150ms ease","--seekora-transition-slow":"300ms ease","--seekora-z-dropdown":"1000","--seekora-z-modal":"1100","--seekora-z-tooltip":"1200"},Et={...St,"--seekora-bg-surface":"#1f2937","--seekora-bg-secondary":"#111827","--seekora-bg-tertiary":"#374151","--seekora-bg-hover":"#374151","--seekora-text-primary":"#f9fafb","--seekora-text-secondary":"#d1d5db","--seekora-text-tertiary":"#9ca3af","--seekora-border-color":"#4b5563","--seekora-primary":"#60a5fa","--seekora-primary-light":"#1e3a5f","--seekora-primary-dark":"#93c5fd","--seekora-highlight-bg":"#854d0e","--seekora-shadow-sm":"0 1px 2px 0 rgba(0, 0, 0, 0.3)","--seekora-shadow":"0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3)","--seekora-shadow-md":"0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3)","--seekora-shadow-lg":"0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3)","--seekora-shadow-xl":"0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4)"},wt={...St,"--seekora-border-color":"#f3f4f6","--seekora-shadow-sm":"none","--seekora-shadow":"0 1px 2px 0 rgba(0, 0, 0, 0.03)","--seekora-shadow-md":"0 2px 4px 0 rgba(0, 0, 0, 0.05)","--seekora-shadow-lg":"0 4px 8px 0 rgba(0, 0, 0, 0.08)","--seekora-shadow-xl":"0 8px 16px 0 rgba(0, 0, 0, 0.1)","--seekora-border-radius-sm":"2px","--seekora-border-radius":"4px","--seekora-border-radius-lg":"6px","--seekora-border-radius-xl":"8px"},Ct={blue:{"--seekora-primary":"#3b82f6","--seekora-primary-light":"#eff6ff","--seekora-primary-dark":"#1d4ed8"},green:{"--seekora-primary":"#10b981","--seekora-primary-light":"#ecfdf5","--seekora-primary-dark":"#059669"},purple:{"--seekora-primary":"#8b5cf6","--seekora-primary-light":"#f5f3ff","--seekora-primary-dark":"#7c3aed"},red:{"--seekora-primary":"#ef4444","--seekora-primary-light":"#fef2f2","--seekora-primary-dark":"#dc2626"},orange:{"--seekora-primary":"#f97316","--seekora-primary-light":"#fff7ed","--seekora-primary-dark":"#ea580c"},teal:{"--seekora-primary":"#14b8a6","--seekora-primary-light":"#f0fdfa","--seekora-primary-dark":"#0d9488"},pink:{"--seekora-primary":"#ec4899","--seekora-primary-light":"#fdf2f8","--seekora-primary-dark":"#db2777"}};function Rt(e=St){return`\n /* Seekora Query Suggestions Styles */\n .seekora-suggestions {\n ${t=e,Object.entries(t).map(([e,t])=>`${e}: ${t};`).join("\n")}\n }\n\n /* Container */\n .seekora-suggestions-container {\n background-color: var(--seekora-bg-surface);\n border: 1px solid var(--seekora-border-color);\n border-radius: var(--seekora-border-radius-lg);\n box-shadow: var(--seekora-shadow-xl);\n font-family: var(--seekora-font-family);\n font-size: var(--seekora-font-size-base);\n color: var(--seekora-text-primary);\n overflow: hidden;\n }\n\n /* Section */\n .seekora-suggestions-section {\n padding: var(--seekora-spacing-sm) 0;\n }\n\n .seekora-suggestions-section-title {\n font-size: var(--seekora-font-size-xs);\n font-weight: var(--seekora-font-weight-bold);\n color: var(--seekora-text-tertiary);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n padding: var(--seekora-spacing-sm) var(--seekora-spacing-lg) var(--seekora-spacing-xs);\n margin: 0;\n }\n\n /* Item */\n .seekora-suggestions-item {\n display: flex;\n align-items: center;\n gap: var(--seekora-spacing-md);\n padding: var(--seekora-spacing-md) var(--seekora-spacing-lg);\n cursor: pointer;\n transition: background-color var(--seekora-transition-fast);\n }\n\n .seekora-suggestions-item:hover,\n .seekora-suggestions-item--active {\n background-color: var(--seekora-bg-hover);\n }\n\n .seekora-suggestions-item-icon {\n width: 16px;\n height: 16px;\n color: var(--seekora-text-secondary);\n flex-shrink: 0;\n }\n\n .seekora-suggestions-item-text {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .seekora-suggestions-item-count {\n font-size: var(--seekora-font-size-sm);\n color: var(--seekora-text-tertiary);\n }\n\n /* Highlight */\n .seekora-suggestions mark,\n .seekora-suggestions-highlight {\n background-color: var(--seekora-highlight-bg);\n font-weight: var(--seekora-font-weight-semibold);\n padding: 0 2px;\n border-radius: 2px;\n }\n\n /* Product Card */\n .seekora-product-card {\n background-color: var(--seekora-bg-surface);\n border: 1px solid var(--seekora-border-color);\n border-radius: var(--seekora-border-radius-lg);\n overflow: hidden;\n cursor: pointer;\n transition: transform var(--seekora-transition-normal), box-shadow var(--seekora-transition-normal);\n }\n\n .seekora-product-card:hover {\n transform: translateY(-2px);\n box-shadow: var(--seekora-shadow-md);\n }\n\n .seekora-product-card-image {\n width: 100%;\n aspect-ratio: 1;\n object-fit: cover;\n background-color: var(--seekora-bg-secondary);\n }\n\n .seekora-product-card-info {\n padding: var(--seekora-spacing-md);\n }\n\n .seekora-product-card-title {\n font-size: var(--seekora-font-size-sm);\n font-weight: var(--seekora-font-weight-medium);\n color: var(--seekora-text-primary);\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n }\n\n .seekora-product-card-price {\n font-size: var(--seekora-font-size-base);\n font-weight: var(--seekora-font-weight-bold);\n color: var(--seekora-primary);\n margin-top: var(--seekora-spacing-xs);\n }\n\n /* Tabs */\n .seekora-suggestions-tabs {\n display: flex;\n gap: var(--seekora-spacing-xs);\n padding: var(--seekora-spacing-md) var(--seekora-spacing-lg);\n border-bottom: 1px solid var(--seekora-border-color);\n overflow-x: auto;\n }\n\n .seekora-suggestions-tab {\n display: inline-flex;\n align-items: center;\n gap: var(--seekora-spacing-sm);\n padding: var(--seekora-spacing-sm) var(--seekora-spacing-md);\n font-size: var(--seekora-font-size-sm);\n font-weight: var(--seekora-font-weight-medium);\n color: var(--seekora-text-secondary);\n background-color: transparent;\n border: 1px solid transparent;\n border-radius: var(--seekora-border-radius-full);\n cursor: pointer;\n white-space: nowrap;\n transition: all var(--seekora-transition-fast);\n }\n\n .seekora-suggestions-tab:hover {\n background-color: var(--seekora-bg-hover);\n }\n\n .seekora-suggestions-tab--active {\n color: var(--seekora-primary);\n background-color: var(--seekora-primary-light);\n border-color: var(--seekora-primary);\n }\n\n /* Brand chip */\n .seekora-brand-chip {\n display: inline-flex;\n align-items: center;\n gap: var(--seekora-spacing-sm);\n padding: var(--seekora-spacing-sm) var(--seekora-spacing-md);\n font-size: var(--seekora-font-size-sm);\n font-weight: var(--seekora-font-weight-medium);\n color: var(--seekora-text-primary);\n background-color: var(--seekora-bg-surface);\n border: 1px solid var(--seekora-border-color);\n border-radius: var(--seekora-border-radius-lg);\n cursor: pointer;\n transition: all var(--seekora-transition-fast);\n }\n\n .seekora-brand-chip:hover {\n border-color: var(--seekora-primary);\n background-color: var(--seekora-primary-light);\n }\n\n /* Category pill */\n .seekora-category-pill {\n display: inline-flex;\n align-items: center;\n gap: var(--seekora-spacing-xs);\n padding: 3px var(--seekora-spacing-sm);\n font-size: var(--seekora-font-size-xs);\n font-weight: var(--seekora-font-weight-medium);\n color: var(--seekora-text-secondary);\n background-color: var(--seekora-bg-tertiary);\n border-radius: var(--seekora-border-radius-full);\n cursor: pointer;\n transition: all var(--seekora-transition-fast);\n }\n\n .seekora-category-pill:hover {\n background-color: var(--seekora-primary-light);\n color: var(--seekora-primary);\n }\n\n /* Loading */\n .seekora-suggestions-loading {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: var(--seekora-spacing-xl);\n color: var(--seekora-text-secondary);\n }\n\n /* Empty state */\n .seekora-suggestions-empty {\n padding: var(--seekora-spacing-xl);\n text-align: center;\n color: var(--seekora-text-secondary);\n }\n\n /* Footer */\n .seekora-suggestions-footer {\n padding: var(--seekora-spacing-md) var(--seekora-spacing-lg);\n border-top: 1px solid var(--seekora-border-color);\n background-color: var(--seekora-bg-secondary);\n font-size: var(--seekora-font-size-sm);\n color: var(--seekora-text-secondary);\n }\n\n /* Keyboard hint */\n .seekora-keyboard-key {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n height: 18px;\n padding: 0 4px;\n border-radius: 3px;\n background-color: var(--seekora-bg-secondary);\n border: 1px solid var(--seekora-border-color);\n font-size: 10px;\n font-weight: var(--seekora-font-weight-medium);\n }\n\n /* Animations */\n @keyframes seekora-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n\n @keyframes seekora-fade-in {\n from { opacity: 0; transform: translateY(-8px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n @keyframes seekora-fade-out {\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(-8px); }\n }\n\n .seekora-suggestions--entering {\n animation: seekora-fade-in var(--seekora-transition-normal) ease-out;\n }\n\n .seekora-suggestions--exiting {\n animation: seekora-fade-out var(--seekora-transition-normal) ease-in;\n }\n `;var t}let It=!1;function zt(e=St,t=!1){if("undefined"==typeof document)return;if(It&&!t)return;const r="seekora-suggestions-styles";let o=document.getElementById(r);o||(o=document.createElement("style"),o.id=r,o.type="text/css",document.head.appendChild(o)),o.textContent=Rt(e),It=!0}e.AmazonDropdown=je,e.Breadcrumb=({attributes:e,separator:r=" > ",rootLabel:o="Home",renderItem:a,renderSeparator:n,onNavigate:s,className:i,style:l,theme:c,items:d})=>{const{theme:u,stateManager:p}=y(),{refinements:m,removeRefinement:g,clearRefinements:f}=x(),h=c||{},b=t.useMemo(()=>{if(d)return d;const t=[];return e.forEach((e,o)=>{const a=m.find(t=>t.field===e);if(a){const e=a.value.split(r);e.forEach((o,a)=>{const n=e.slice(0,a+1).join(r);t.some(e=>e.value===n)||t.push({label:o,value:n})})}}),t},[e,m,r,d]),v=t.useCallback((t,r)=>{if(null===t)e.forEach(e=>{m.filter(t=>t.field===e).forEach(e=>g(e.field,e.value,!1))}),p.search();else{const r=b.findIndex(e=>e.value===t.value);e.forEach((e,o)=>{m.filter(t=>t.field===e).forEach(e=>{(o>r||o===r&&e.value!==t.value)&&g(e.field,e.value,!1)})}),p.search()}s&&s(t,r)},[e,m,g,p,b,s]);return 0===b.length?null:t.createElement("nav",{className:k(h.root,i),style:l,"aria-label":"Breadcrumb"},t.createElement("ol",{className:h.list,style:{display:"flex",flexWrap:"wrap",alignItems:"center",listStyle:"none",margin:0,padding:0,fontSize:u.typography.fontSize.small}},t.createElement("li",{className:h.item},t.createElement("button",{type:"button",onClick:()=>v(null,-1),className:h.link,style:{padding:0,background:"none",border:"none",cursor:"pointer",color:u.colors.primary,fontFamily:"inherit",fontSize:"inherit",textDecoration:"none"}},o)),b.map((e,r)=>{const o=r===b.length-1;return t.createElement(t.Fragment,{key:e.value},n?n():t.createElement("span",{className:h.separator,style:{margin:`0 ${u.spacing.small}`,color:u.colors.textSecondary},"aria-hidden":"true"},"›"),t.createElement("li",{className:k(h.item,o&&h.current)},a?a(e,r,o):o?t.createElement("span",{style:{color:u.colors.text,fontWeight:u.typography.fontWeight?.medium||500},"aria-current":"page"},e.label):t.createElement("button",{type:"button",onClick:()=>v(e,r),className:h.link,style:{padding:0,background:"none",border:"none",cursor:"pointer",color:u.colors.primary,fontFamily:"inherit",fontSize:"inherit",textDecoration:"none"}},e.label)))})))},e.ClearRefinements=({clearsQuery:e=!1,resetLabel:r="Clear all filters",disabledLabel:o="No filters applied",includedFields:a,excludedFields:n=[],onClear:s,renderButton:i,className:l,style:c,theme:d,hideWhenEmpty:u=!1})=>{const{theme:p}=y(),{query:m,refinements:g,clearRefinements:f,setQuery:h,removeRefinement:b}=x(),v=d||{},S=t.useMemo(()=>g.filter(e=>!n.includes(e.field)&&!(a&&!a.includes(e.field))),[g,a,n]),E=S.length>0||e&&m.length>0,w=()=>{E&&(a||n.length>0?(S.forEach(e=>{b(e.field,e.value,!1)}),S.length>0&&f(!1)):f(!e),e&&m.length>0&&h("",!0),s&&s())};return u&&!E?null:i?t.createElement("div",{className:k(v.root,l),style:c},i({canClear:E,onClick:w,disabled:!E})):t.createElement("div",{className:k(v.root,l),style:c},t.createElement("button",{type:"button",onClick:w,disabled:!E,className:k(v.button,!E&&v.buttonDisabled),style:{padding:`${p.spacing.small} ${p.spacing.medium}`,fontSize:p.typography.fontSize.medium,fontWeight:p.typography.fontWeight?.medium||500,backgroundColor:E?p.colors.primary:p.colors.hover,color:E?"#ffffff":p.colors.textSecondary,border:"none",borderRadius:"string"==typeof p.borderRadius?p.borderRadius:p.borderRadius.medium,cursor:E?"pointer":"not-allowed",opacity:E?1:.6,transition:p.transitions?.fast||"150ms ease-in-out"},"aria-label":E?r:o},E?r:o))},e.CurrentRefinements=({refinements:e=[],onRefinementClear:r,onClearAll:o,renderRefinement:a,showClearAll:n=!0,className:s,style:i,theme:l})=>{const{theme:c}=y(),d=l||{},u=(e,o)=>t.createElement("div",{key:`${e.field}-${e.value}-${o}`,className:d.item,style:{display:"inline-flex",alignItems:"center",padding:`${c.spacing.small} ${c.spacing.medium}`,margin:`0 ${c.spacing.small} ${c.spacing.small} 0`,backgroundColor:c.colors.hover,border:`1px solid ${c.colors.border}`,borderRadius:"string"==typeof c.borderRadius?c.borderRadius:c.borderRadius.medium,fontSize:c.typography.fontSize.small}},t.createElement("span",{className:d.label,style:{marginRight:c.spacing.small,color:c.colors.text,fontWeight:"500"}},e.label||e.field,":"),t.createElement("span",{className:d.value,style:{marginRight:c.spacing.small,color:c.colors.text}},e.displayValue||e.value),t.createElement("button",{type:"button",onClick:()=>{return t=e.field,o=e.value,void(r&&r(t,o));var t,o},className:d.clearButton,style:{border:"none",backgroundColor:"transparent",color:c.colors.text,cursor:"pointer",fontSize:c.typography.fontSize.medium,padding:0,marginLeft:c.spacing.small,width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",transition:c.transitions?.fast||"150ms ease-in-out"},"aria-label":`Clear ${e.label||e.field}: ${e.value}`},"×"));return 0===e.length?null:t.createElement("div",{className:k(d.container,s),style:i},t.createElement("div",{className:d.list,style:{display:"flex",flexWrap:"wrap",alignItems:"center",marginBottom:n?c.spacing.medium:0}},e.map((e,t)=>a?a(e,t):u(e,t))),n&&e.length>1&&t.createElement("button",{type:"button",onClick:()=>{o&&o()},className:d.clearAllButton,style:{padding:`${c.spacing.small} ${c.spacing.medium}`,border:`1px solid ${c.colors.border}`,borderRadius:"string"==typeof c.borderRadius?c.borderRadius:c.borderRadius.medium,backgroundColor:c.colors.background,color:c.colors.text,cursor:"pointer",fontSize:c.typography.fontSize.small,textDecoration:"underline"}},"Clear all filters"))},e.Facets=({results:e,facets:r,onFacetChange:o,renderFacet:a,renderFacetItem:n,maxItems:i=10,showMore:l=!0,className:d,style:u,theme:p})=>{const{theme:m}=y(),{results:g,refinements:f,addRefinement:h,removeRefinement:b}=x(),v=p||{},[S,E]=t.useState({}),w=e||g,C=(()=>{if(r)return r;const e=w?.data?.facets||w?.facets||w?.data?.data?.facets||null;if(s("Facets: Extracting facets",{hasResults:!!w,hasData:!!w?.data,rawFacets:e?Array.isArray(e)?e.length:"not array":null,resultsKeys:w?Object.keys(w):[],dataKeys:w?.data?Object.keys(w.data):[],sampleFacet:e&&Array.isArray(e)&&e.length>0?e[0]:null}),!e||!Array.isArray(e))return s("Facets: No facets found in response",{rawFacetsType:e?typeof e:"null",isArray:Array.isArray(e),resultsStructure:w?JSON.stringify(Object.keys(w)):"null",dataStructure:w?.data?JSON.stringify(Object.keys(w.data)):"null"}),[];const t=e.map(e=>{const t=e.field_name||e.field;return{field:t,label:e.label||t,items:Array.isArray(e.counts)?e.counts.map(e=>({value:e.value,count:e.count,selected:f.some(r=>r.field===t&&r.value===e.value)})):[]}});return s("Facets: Extracted facets",{count:t.length,facets:t.map(e=>({field:e.field,itemsCount:e.items.length}))}),t})(),R=(e,t,r)=>{const a=!r;if(s("Facets: Facet toggled",{field:e,value:t,selected:a}),a?h(e,t):b(e,t),o)try{o(e,t,a)}catch(r){const o=r instanceof Error?r:new Error(String(r));c("Facets: Error in onFacetChange callback",{field:e,value:t,selected:a,error:o.message})}},I=e=>{E(t=>({...t,[e]:!t[e]}))},z=(e,r)=>{const o=S[e.field]||!1,a=o?e.items:e.items.slice(0,i),s=e.items.length>i;return t.createElement("div",{key:e.field,className:v.facet,style:{marginBottom:m.spacing.large,padding:m.spacing.medium,backgroundColor:m.colors.background,border:`1px solid ${m.colors.border}`,borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium}},t.createElement("h3",{className:v.facetTitle,style:{fontSize:m.typography.fontSize.large,fontWeight:"bold",margin:0,marginBottom:m.spacing.medium,color:m.colors.text}},e.label||e.field),t.createElement("div",{className:v.facetList},a.map((r,o)=>{const a=o;return n?n(r,e,a):((e,r,o)=>!(S[r.field]||o<i)&&o>=i?null:t.createElement("div",{key:`${r.field}-${e.value}`,className:k(v.facetItem,(f.some(t=>t.field===r.field&&t.value===e.value)||e.selected)&&v.facetItemActive),onClick:()=>R(r.field,e.value,e.selected||!1),style:{display:"flex",alignItems:"center",padding:m.spacing.small,cursor:"pointer",borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium,marginBottom:m.spacing.small,backgroundColor:f.some(t=>t.field===r.field&&t.value===e.value)||e.selected?m.colors.hover:"transparent",transition:"background-color 0.2s ease"}},t.createElement("input",{type:"checkbox",checked:f.some(t=>t.field===r.field&&t.value===e.value)||e.selected||!1,onChange:()=>R(r.field,e.value,e.selected||!1),className:v.checkbox,style:{marginRight:m.spacing.small,cursor:"pointer"},"aria-label":`Filter by ${e.value}`}),t.createElement("span",{className:v.facetItemLabel,style:{flex:1,fontSize:m.typography.fontSize.medium,color:m.colors.text}},e.value),t.createElement("span",{className:v.facetItemCount,style:{fontSize:m.typography.fontSize.small,color:m.colors.textSecondary||m.colors.text,opacity:.7,marginLeft:m.spacing.small}},"(",e.count,")")))(r,e,a)})),l&&s&&!o&&t.createElement("button",{type:"button",onClick:()=>I(e.field),style:{marginTop:m.spacing.small,padding:m.spacing.small,border:"none",backgroundColor:"transparent",color:m.colors.primary,cursor:"pointer",fontSize:m.typography.fontSize.small,textDecoration:"underline"}},"Show more (",e.items.length-i," more)"),o&&s&&t.createElement("button",{type:"button",onClick:()=>I(e.field),style:{marginTop:m.spacing.small,padding:m.spacing.small,border:"none",backgroundColor:"transparent",color:m.colors.primary,cursor:"pointer",fontSize:m.typography.fontSize.small,textDecoration:"underline"}},"Show less"))};return 0===C.length?(s("Facets: No facets to display",{hasResults:!!w,resultsType:w?typeof w:"null"}),null):t.createElement("div",{className:k(v.container,d),style:u},C.map((e,t)=>a?a(e,t):z(e)))},e.FederatedDropdown=G,e.FrequentlyBoughtTogether=({productId:e,items:r,loading:o=!1,title:a="Frequently Bought Together",maxItems:n=4,renderItem:s,onItemClick:i,className:l,style:c,theme:d,layout:u="horizontal",currencySymbol:p="$",showAddAllButton:m=!0,onAddAll:g})=>{const{theme:f}=y(),h=d||{},x=r?.slice(0,n)||[],b=o,v=t.useMemo(()=>x.reduce((e,t)=>{const r=t.price;return e+("number"==typeof r?r:parseFloat(String(r))||0)},0),[x]);return b?t.createElement("div",{className:k(h.root,l),style:c},t.createElement("div",{className:h.loading,style:w(f)},"Loading recommendations...")):0===x.length?null:t.createElement("div",{className:k(h.root,l),style:c},a&&t.createElement("h3",{className:h.title,style:{margin:`0 0 ${f.spacing.medium} 0`,fontSize:f.typography.fontSize.large,fontWeight:f.typography.fontWeight?.semibold||600,color:f.colors.text}},a),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:f.spacing.medium,flexWrap:"wrap"}},x.map((e,r)=>t.createElement(t.Fragment,{key:e.id||r},r>0&&t.createElement("span",{style:{fontSize:"1.5rem",color:f.colors.textSecondary}},"+"),t.createElement("div",{onClick:()=>i?.(e,r),style:{cursor:i?"pointer":"default",textAlign:"center"}},s?s(e,r):t.createElement(t.Fragment,null,t.createElement("img",{src:e.image||e.imageUrl||"",alt:e.title||e.name||"",style:{width:"80px",height:"80px",objectFit:"cover",borderRadius:"string"==typeof f.borderRadius?f.borderRadius:f.borderRadius.small,border:`1px solid ${f.colors.border}`}}),t.createElement("div",{style:{marginTop:f.spacing.small,fontSize:f.typography.fontSize.small,color:f.colors.text}},p,"number"==typeof e.price?e.price.toFixed(2):e.price))))),m&&x.length>0&&t.createElement("div",{style:{marginLeft:"auto",textAlign:"center"}},t.createElement("div",{style:{fontSize:f.typography.fontSize.large,fontWeight:f.typography.fontWeight?.bold||700,color:f.colors.text,marginBottom:f.spacing.small}},"Total: ",p,v.toFixed(2)),t.createElement("button",{type:"button",onClick:()=>g?.(x),style:{padding:`${f.spacing.small} ${f.spacing.medium}`,fontSize:f.typography.fontSize.medium,fontWeight:f.typography.fontWeight?.medium||500,color:"#ffffff",backgroundColor:f.colors.primary,border:"none",borderRadius:"string"==typeof f.borderRadius?f.borderRadius:f.borderRadius.medium,cursor:"pointer"}},"Add all to cart"))))},e.GoogleDropdown=Ke,e.HierarchicalMenu=({attributes:e,separator:r=" > ",limit:o=10,showMore:a=!0,showMoreLimit:n=20,renderItem:s,onSelect:i,className:l,style:c,theme:d,rootPath:u=null,sortBy:p="name",items:m})=>{const{theme:g,stateManager:f}=y(),{results:h,refinements:b,addRefinement:v,removeRefinement:S}=x(),E=d||{},[w,C]=t.useState({}),R=t.useCallback(()=>{if(m)return m;if(!h)return[];const t=h.facets||h.facet_counts||{},r=e[0],o=t[r]||{},a=[];return Object.entries(o).forEach(([e,t])=>{const o=b.some(t=>t.field===r&&t.value===e);a.push({label:e,value:e,count:t,isRefined:o,data:I(e,1)})}),a},[h,e,b,m]),I=t.useCallback((t,o)=>{if(o>=e.length)return[];if(!h)return[];const a=h.facets||h.facet_counts||{},n=e[o],s=a[n]||{},i=[];return Object.entries(s).forEach(([e,a])=>{if(e.startsWith(t+r)){const s=e.replace(t+r,"").split(r)[0],l=b.some(t=>t.field===n&&t.value===e);e.replace(t+r,"").includes(r)||i.push({label:s,value:e,count:a,isRefined:l,data:I(e,o+1)})}}),i},[h,e,r,b]),z=t.useMemo(()=>{let e=R();return e=[...e].sort((e,t)=>{if("count"===p)return(t.count||0)-(e.count||0);if("isRefined"===p){if(e.isRefined&&!t.isRefined)return-1;if(!e.isRefined&&t.isRefined)return 1}return e.label.localeCompare(t.label)}),e},[R,p]),T=t.useCallback((t,r)=>{const o=e[r]||e[0];t.isRefined?(e.slice(r).forEach(e=>{b.filter(r=>r.field===e&&r.value.startsWith(t.value)).forEach(e=>S(e.field,e.value,!1))}),f.search()):(b.filter(e=>e.field===o&&e.value!==t.value).forEach(e=>S(e.field,e.value,!1)),v(o,t.value,!0)),i&&i(t.value,r)},[e,b,v,S,f,i]),N=(e,r)=>{if(!e||0===e.length)return null;const i=w[r]||!1,l=i?n:o,c=e.slice(0,l),d=e.length>l;return t.createElement("ul",{className:E.list,style:{listStyle:"none",margin:0,padding:r>0?`0 0 0 ${g.spacing.medium}`:0}},c.map((e,o)=>t.createElement("li",{key:e.value,className:k(E.item,e.isRefined&&E.itemSelected,e.data&&e.data.length>0&&E.itemParent),style:{padding:`${g.spacing.small} 0`}},s?s(e,r):t.createElement(t.Fragment,null,t.createElement("button",{type:"button",onClick:()=>T(e,r),className:E.link,style:{display:"flex",alignItems:"center",gap:g.spacing.small,width:"100%",padding:0,background:"none",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"inherit",fontSize:g.typography.fontSize.small,color:e.isRefined?g.colors.primary:g.colors.text,fontWeight:e.isRefined?600:400}},t.createElement("span",{className:E.label,style:{flex:1}},e.label),void 0!==e.count&&t.createElement("span",{className:E.count,style:{color:g.colors.textSecondary,fontSize:g.typography.fontSize.small}},e.count)),e.isRefined&&e.data&&e.data.length>0&&N(e.data,r+1)))),a&&d&&t.createElement("li",null,t.createElement("button",{type:"button",onClick:()=>(e=>{C(t=>({...t,[e]:!t[e]}))})(r),className:E.showMore,style:{padding:`${g.spacing.small} 0`,background:"none",border:"none",cursor:"pointer",fontSize:g.typography.fontSize.small,color:g.colors.primary,textDecoration:"underline"}},i?"Show less":`Show ${e.length-l} more`)))};return 0===z.length?null:t.createElement("div",{className:k(E.root,l),style:c},N(z,0))},e.Highlight=({hit:e,attribute:r,className:o,style:a,theme:n,tagName:s="span",renderHighlighted:i,renderNonHighlighted:l,query:c})=>{const{theme:m}=y(),g=n||{},f=t.useMemo(()=>d({hit:e,attribute:r,preTag:"<mark>",postTag:"</mark>"}),[e,r]),h=t.useMemo(()=>{const t=u(f,"<mark>","</mark>");if(t.every(e=>!e.isHighlighted)&&c){const t=e[r]||f;return p(String(t),c)}return t},[f,c,e,r]),x={backgroundColor:m.colors.warning||"#fff59d",fontWeight:m.typography.fontWeight?.semibold||600,padding:"0 2px",borderRadius:"2px"},b=h.map((e,r)=>e.isHighlighted?i?t.createElement(t.Fragment,{key:r},i(e,r)):t.createElement("mark",{key:r,className:g.highlighted,style:x},e.value):l?t.createElement(t.Fragment,{key:r},l(e,r)):t.createElement("span",{key:r,className:g.nonHighlighted},e.value));return t.createElement(s,{className:o||g.root,style:a},b)},e.HitsPerPage=({items:e,onHitsPerPageChange:r,renderSelect:o,className:a,style:n,theme:s,label:i="Show",syncWithState:l=!0})=>{const{theme:c}=y(),{itemsPerPage:d,setPage:u}=x(),{stateManager:p}=y(),m=s||{},g=e.find(e=>e.default)||e[0],[f,h]=t.useState(g?.value||10);t.useEffect(()=>{l&&g&&d!==g.value&&p.setItemsPerPage(g.value,!1)},[]);const b=l?d:f,v=e=>{const t=parseInt(e.target.value,10);h(t),l&&(p.setItemsPerPage(t,!1),u(1,!0)),r&&r(t)};return o?t.createElement("div",{className:k(m.root,a),style:n},o({value:b,onChange:v,items:e})):t.createElement("div",{className:k(m.root,a),style:{display:"flex",alignItems:"center",gap:c.spacing.small,...n}},i&&t.createElement("label",{style:{fontSize:c.typography.fontSize.medium,color:c.colors.text}},i),t.createElement("select",{value:b,onChange:v,className:m.select,style:{padding:c.spacing.small,paddingRight:c.spacing.medium,fontSize:c.typography.fontSize.medium,border:`1px solid ${c.colors.border}`,borderRadius:"string"==typeof c.borderRadius?c.borderRadius:c.borderRadius.medium,backgroundColor:c.colors.background,color:c.colors.text,cursor:"pointer",outline:"none"},"aria-label":"Results per page"},e.map(e=>t.createElement("option",{key:e.value,value:e.value,className:m.option},e.label))))},e.InfiniteHits=({renderHit:e,renderEmpty:r,renderLoading:o,renderShowMore:a,showMoreButton:n=!0,useInfiniteScroll:s=!1,scrollThreshold:i=.1,fieldMapping:l,showMoreLabel:c="Show more",loadingLabel:d="Loading...",onHitClick:u,className:p,style:m,theme:g,syncWithState:f=!0})=>{const{theme:h,stateManager:b}=y(),{results:v,loading:S,currentPage:E,setPage:w}=x(),C=g||{},[R,I]=t.useState([]),[z,T]=t.useState(!1),N=t.useRef(null),A=t.useRef(E),M=t.useCallback(e=>e?e.results?e.results:e.hits?e.hits:Array.isArray(e)?e:[]:[],[]),P=t.useMemo(()=>M(v),[v,M]),_=v?.totalResults||v?.found||0,B=b.getState().itemsPerPage||10,$=Math.ceil(_/B),L=E>=$;t.useEffect(()=>{P.length&&(1===E?I(P):E>A.current&&I(e=>[...e,...P]),A.current=E,T(!1))},[P,E]),t.useEffect(()=>{1===E&&(I(P),A.current=1)},[v]);const W=t.useCallback(()=>{L||S||z||(T(!0),f&&w(E+1))},[L,S,z,f,w,E]);t.useEffect(()=>{if(!s||!N.current)return;const e=new IntersectionObserver(e=>{!e[0].isIntersecting||L||S||z||W()},{threshold:i});return e.observe(N.current),()=>e.disconnect()},[s,i,L,S,z,W]);const q=(e,t)=>{if(!l||!l[t])return e[t]||"";return e[l[t]]||""},F=()=>t.createElement("div",{className:C.loading,style:{padding:h.spacing.medium,textAlign:"center",color:h.colors.textSecondary}},d);return S&&0===R.length?t.createElement("div",{className:k(C.root,p),style:m},o?o():F()):S||0!==R.length?t.createElement("div",{className:k(C.root,p),style:m},t.createElement("div",{className:C.list},R.map((r,o)=>e?e(r,o):((e,r)=>{const o=q(e,"title")||e.title||"",a=q(e,"description")||e.description||"",n=q(e,"image")||e.image||e.imageUrl||"",s=q(e,"price")||e.price;return t.createElement("div",{key:e.id||r,className:C.item,style:{display:"flex",gap:h.spacing.medium,padding:h.spacing.medium,borderBottom:`1px solid ${h.colors.border}`,cursor:u?"pointer":"default",transition:h.transitions?.fast||"150ms ease-in-out"},onClick:()=>u?.(e,r),role:u?"button":void 0,tabIndex:u?0:void 0},n&&t.createElement("img",{src:n,alt:o,style:{width:"80px",height:"80px",objectFit:"cover",borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.small}}),t.createElement("div",{style:{flex:1}},t.createElement("h3",{style:{margin:0,marginBottom:h.spacing.small,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.semibold||600,color:h.colors.text}},o),a&&t.createElement("p",{style:{margin:0,fontSize:h.typography.fontSize.small,color:h.colors.textSecondary,lineHeight:h.typography.lineHeight?.normal||1.5}},a),s&&t.createElement("span",{style:{display:"inline-block",marginTop:h.spacing.small,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.bold||700,color:h.colors.primary}},"$","number"==typeof s?s.toFixed(2):s)))})(r,o))),n&&!s&&!L&&(a?a({isLoading:z,isLastPage:L,onClick:W}):t.createElement("button",{type:"button",onClick:W,disabled:L||z,className:k(C.loadMore,(L||z)&&C.loadMoreDisabled),style:{display:"block",width:"100%",padding:h.spacing.medium,marginTop:h.spacing.medium,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.medium||500,backgroundColor:L||z?h.colors.hover:h.colors.primary,color:L||z?h.colors.textSecondary:"#ffffff",border:"none",borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:L||z?"not-allowed":"pointer",transition:h.transitions?.fast||"150ms ease-in-out"}},z?d:L?"No more results":c)),z&&(o?o():F()),s&&!L&&t.createElement("div",{ref:N,className:C.sentinel,style:{height:"1px",visibility:"hidden"},"aria-hidden":"true"})):t.createElement("div",{className:k(C.root,p),style:m},r?r():t.createElement("div",{className:C.empty,style:{padding:h.spacing.large,textAlign:"center",color:h.colors.textSecondary}},"No results found"))},e.MinimalDropdown=ft,e.MobileFilters=({isOpen:e,onClose:r,onApply:o,title:a="Filters",applyButtonText:n="Apply",clearButtonText:s="Clear all",position:i="right",children:l,className:c,theme:d,showHeader:u=!0,showFooter:p=!0,showFilterCount:m=!0,closeOnBackdropClick:g=!0,closeOnEscape:f=!0})=>{const{theme:h}=y(),{refinements:b,clearRefinements:v}=x(),S=d||{},E=t.useRef(null);t.useEffect(()=>(document.body.style.overflow=e?"hidden":"",()=>{document.body.style.overflow=""}),[e]),t.useEffect(()=>{if(!f)return;const t=t=>{"Escape"===t.key&&e&&r()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e,r,f]),t.useEffect(()=>{if(e&&E.current){const e=E.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),t=e[0],r=e[e.length-1],o=e=>{"Tab"===e.key&&(e.shiftKey?document.activeElement===t&&(e.preventDefault(),r?.focus()):document.activeElement===r&&(e.preventDefault(),t?.focus()))};return document.addEventListener("keydown",o),t?.focus(),()=>document.removeEventListener("keydown",o)}},[e]);const w=t.useCallback(()=>{g&&r()},[g,r]),C=t.useCallback(()=>{o&&o(),r()},[o,r]),R=t.useCallback(()=>{v(!0)},[v]),I=e=>{if(e)return"translate(0, 0)";switch(i){case"left":return"translateX(-100%)";case"right":default:return"translateX(100%)";case"bottom":return"translateY(100%)"}};return e?t.createElement(t.Fragment,null,t.createElement("div",{className:S.overlay,onClick:w,style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:h.zIndex?.modal||1050,opacity:e?1:0,transition:"opacity 300ms ease-in-out"},"aria-hidden":"true"}),t.createElement("div",{ref:E,className:k(S.drawer,c),style:(()=>{const t={position:"fixed",backgroundColor:h.colors.background,display:"flex",flexDirection:"column",transition:"transform 300ms ease-in-out",transform:I(e),zIndex:(h.zIndex?.modal||1050)+1};switch(i){case"left":return{...t,top:0,left:0,bottom:0,width:"80%",maxWidth:"320px"};case"right":return{...t,top:0,right:0,bottom:0,width:"80%",maxWidth:"320px"};case"bottom":return{...t,left:0,right:0,bottom:0,maxHeight:"80vh",borderTopLeftRadius:"16px",borderTopRightRadius:"16px"};default:return t}})(),role:"dialog","aria-modal":"true","aria-label":a},u&&t.createElement("div",{className:S.header,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:h.spacing.medium,borderBottom:`1px solid ${h.colors.border}`}},t.createElement("div",{style:{display:"flex",alignItems:"center",gap:h.spacing.small}},t.createElement("h2",{className:S.title,style:{margin:0,fontSize:h.typography.fontSize.large,fontWeight:h.typography.fontWeight?.semibold||600,color:h.colors.text}},a),m&&b.length>0&&t.createElement("span",{className:S.filterCount,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"24px",height:"24px",padding:"0 6px",fontSize:h.typography.fontSize.small,fontWeight:h.typography.fontWeight?.bold||700,color:"#ffffff",backgroundColor:h.colors.primary,borderRadius:"12px"}},b.length)),t.createElement("button",{type:"button",onClick:r,className:S.closeButton,style:{padding:h.spacing.small,background:"none",border:"none",cursor:"pointer",fontSize:"1.5rem",color:h.colors.text},"aria-label":"Close filters"},"×")),t.createElement("div",{className:S.content,style:{flex:1,overflow:"auto",padding:h.spacing.medium}},l),p&&t.createElement("div",{className:S.footer,style:{display:"flex",gap:h.spacing.small,padding:h.spacing.medium,borderTop:`1px solid ${h.colors.border}`}},t.createElement("button",{type:"button",onClick:R,className:S.clearButton,style:{flex:1,padding:h.spacing.medium,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.medium||500,color:h.colors.text,backgroundColor:"transparent",border:`1px solid ${h.colors.border}`,borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:"pointer"}},s),t.createElement("button",{type:"button",onClick:C,className:S.applyButton,style:{flex:2,padding:h.spacing.medium,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.medium||500,color:"#ffffff",backgroundColor:h.colors.primary,border:"none",borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:"pointer"}},n,m&&b.length>0&&` (${b.length})`)))):null},e.MobileFiltersButton=({onClick:e,text:r="Filters",showCount:o=!0,className:a,style:n})=>{const{theme:s}=y(),{refinements:i}=x();return t.createElement("button",{type:"button",onClick:e,className:a,style:{display:"inline-flex",alignItems:"center",gap:s.spacing.small,padding:`${s.spacing.small} ${s.spacing.medium}`,fontSize:s.typography.fontSize.medium,fontWeight:s.typography.fontWeight?.medium||500,color:s.colors.text,backgroundColor:s.colors.background,border:`1px solid ${s.colors.border}`,borderRadius:"string"==typeof s.borderRadius?s.borderRadius:s.borderRadius.medium,cursor:"pointer",...n}},t.createElement("span",null,"☰"),t.createElement("span",null,r),o&&i.length>0&&t.createElement("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"20px",height:"20px",padding:"0 4px",fontSize:s.typography.fontSize.small,fontWeight:s.typography.fontWeight?.bold||700,color:"#ffffff",backgroundColor:s.colors.primary,borderRadius:"10px"}},i.length))},e.MobileSheetDropdown=gt,e.Pagination=({results:e,currentPage:r,itemsPerPage:o,totalPages:a,onPageChange:n,maxPages:s=7,showFirstLast:i=!0,showPrevNext:l=!0,renderPageButton:c,className:d,style:u,theme:p})=>{const{theme:m}=y(),{results:g,currentPage:f,setPage:h}=x(),b=p||{},v=r||f,S=e||g,E=o||S?.perPage||S?.data?.per_page||S?.data?.data?.per_page||20,w=S?.totalResults||S?.data?.total_results||S?.data?.data?.total_results||0,C=a||S?.totalPages||S?.data?.total_pages||S?.data?.data?.total_pages||Math.ceil(w/E),R=e=>{e<1||e>C||e===v||(h(e),n&&n(e))};if(C<=1)return null;const I=(()=>{const e=[],t=Math.floor(s/2);let r=Math.max(1,v-t),o=Math.min(C,v+t);v<=t&&(o=Math.min(s,C)),v>=C-t&&(r=Math.max(1,C-s+1)),i&&r>1&&(e.push(1),r>2&&e.push("ellipsis"));for(let t=r;t<=o;t++)e.push(t);return i&&o<C&&(o<C-1&&e.push("ellipsis"),e.push(C)),e})();return t.createElement("nav",{className:k(b.container,d),style:u,"aria-label":"Pagination"},t.createElement("ul",{className:b.list,style:{listStyle:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0,flexWrap:"wrap"}},l&&t.createElement("li",null,t.createElement("button",{type:"button",disabled:1===v,onClick:()=>R(v-1),className:k(b.item,1===v&&b.itemDisabled),style:{padding:m.spacing.small,margin:`0 ${m.spacing.small}`,border:`1px solid ${m.colors.border}`,borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium,backgroundColor:m.colors.background,color:m.colors.text,cursor:1===v?"not-allowed":"pointer",opacity:1===v?.5:1,fontSize:m.typography.fontSize.medium},"aria-label":"Previous page"},"Previous")),I.map((e,r)=>{if("ellipsis"===e)return t.createElement("li",{key:`ellipsis-${r}`},t.createElement("span",{className:b.ellipsis,style:{padding:m.spacing.small,margin:`0 ${m.spacing.small}`,color:m.colors.text,fontSize:m.typography.fontSize.medium}},"..."));const o=e===v,a=!1;return t.createElement("li",{key:e},c?c(e,o,a):((e,r,o)=>t.createElement("button",{type:"button",disabled:o,onClick:()=>R(e),className:k(b.item,r&&b.itemActive,o),style:{padding:m.spacing.small,margin:`0 ${m.spacing.small}`,border:`1px solid ${m.colors.border}`,borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium,backgroundColor:r?m.colors.primary:m.colors.background,color:r?"#fff":m.colors.text,cursor:"pointer",opacity:1,fontSize:m.typography.fontSize.medium,minWidth:"40px",...r&&{fontWeight:"bold"}}},e))(e,o,a))}),l&&t.createElement("li",null,t.createElement("button",{type:"button",disabled:v===C,onClick:()=>R(v+1),className:k(b.item,v===C&&b.itemDisabled),style:{padding:m.spacing.small,margin:`0 ${m.spacing.small}`,border:`1px solid ${m.colors.border}`,borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium,backgroundColor:m.colors.background,color:m.colors.text,cursor:v===C?"not-allowed":"pointer",opacity:v===C?.5:1,fontSize:m.typography.fontSize.medium},"aria-label":"Next page"},"Next"))))},e.PinterestDropdown=et,e.QuerySuggestions=({query:e="",maxSuggestions:r=10,debounceMs:o=300,minQueryLength:a=2,onSuggestionClick:n,renderSuggestion:s,renderLoading:i,renderEmpty:l,showTitle:c=!1,title:d="Suggestions",className:u,style:p,theme:m})=>{const{client:g,theme:f}=y(),[h,x]=t.useState(-1),{suggestions:v,loading:S,error:E}=b({client:g,query:e,enabled:e.length>=a,debounceMs:o,maxSuggestions:r}),w=v.slice(0,r),C=m||{};if(e.length<a)return null;if(S)return t.createElement("div",{className:k(C.container,u),style:p},c&&t.createElement("div",{className:C.title,style:{fontSize:f.typography.fontSize.large,fontWeight:"bold",marginBottom:f.spacing.medium,color:f.colors.text}},d),i?i():t.createElement("div",{style:{padding:f.spacing.medium,textAlign:"center",color:f.colors.text}},"Loading suggestions..."));if(E||0===w.length)return t.createElement("div",{className:k(C.container,u),style:p},c&&t.createElement("div",{className:C.title,style:{fontSize:f.typography.fontSize.large,fontWeight:"bold",marginBottom:f.spacing.medium,color:f.colors.text}},d),l?l():t.createElement("div",{style:{padding:f.spacing.medium,textAlign:"center",color:f.colors.text,opacity:.6}},"No suggestions available"));const R=s||((e,r)=>t.createElement("div",{key:r},t.createElement("span",null,e.query),void 0!==e.count&&t.createElement("span",{style:{opacity:.6,marginLeft:f.spacing.small}},"(",e.count,")")));return t.createElement("div",{className:k(C.container,u),style:p},c&&t.createElement("div",{className:C.title,style:{fontSize:f.typography.fontSize.large,fontWeight:"bold",marginBottom:f.spacing.medium,color:f.colors.text}},d),t.createElement("div",{className:C.suggestionsList},w.map((e,r)=>{const o=r===h;return t.createElement("div",{key:r,className:k(C.suggestionItem,o&&C.suggestionItemActive),onClick:()=>(e=>{n&&n(e.query)})(e),onMouseEnter:()=>x(r),onMouseLeave:()=>x(-1),style:{padding:f.spacing.medium,cursor:"pointer",borderRadius:"string"==typeof f.borderRadius?f.borderRadius:f.borderRadius.medium,transition:"background-color 0.2s ease",backgroundColor:o?f.colors.hover:"transparent",marginBottom:r<w.length-1?f.spacing.small:0}},R(e,r))})))},e.QuerySuggestionsDropdown=W,e.RangeInput=({field:e,label:r,min:o,max:a,currentMin:n,currentMax:s,step:i=1,onRangeChange:l,renderRangeInput:c,className:d,style:u,theme:p,showApplyButton:m=!0,placeholder:g={min:"Min",max:"Max"},syncWithState:f=!0})=>{const{theme:h}=y(),{refinements:b,addRefinement:v,removeRefinement:S}=x(),E=p||{},w=t.useMemo(()=>f?((e,t)=>{let r,o;return e.forEach(e=>{if(e.field===t){const t=e.value.match(/^>=(\d+(?:\.\d+)?)$/);t&&(r=parseFloat(t[1]));const a=e.value.match(/^<=(\d+(?:\.\d+)?)$/);a&&(o=parseFloat(a[1]))}}),{min:r,max:o}})(b,e):{min:void 0,max:void 0},[f,b,e]),[C,R]=t.useState(n??w.min),[I,z]=t.useState(s??w.max),[T,N]=t.useState(n??w.min),[A,M]=t.useState(s??w.max);t.useEffect(()=>{f&&(w.min===T&&w.max===A||(R(w.min),z(w.max),N(w.min),M(w.max)))},[f,w.min,w.max]);const P=void 0!==n?n:C,_=void 0!==s?s:I,B=t.useCallback((t,r)=>{f&&(b.forEach(t=>{t.field===e&&S(e,t.value,!1)}),void 0!==t&&v(e,`>=${t}`,!1),void 0!==r?v(e,`<=${r}`,!0):void 0!==t&&v(e,`>=${t}`,!0))},[f,e,b,v,S]),$=t.useCallback(e=>{const t=""===e.target.value?void 0:parseFloat(e.target.value);R(t),m||(B(t,_),l&&l(t,_))},[_,m,l,B]),L=t.useCallback(e=>{const t=""===e.target.value?void 0:parseFloat(e.target.value);z(t),m||(B(P,t),l&&l(P,t))},[P,m,l,B]),W=t.useCallback(()=>{N(C),M(I),B(C,I),l&&l(C,I)},[C,I,l,B]),q=t.useCallback(()=>{R(void 0),z(void 0),N(void 0),M(void 0),f&&b.forEach(t=>{t.field===e&&S(e,t.value,!0)}),l&&l(void 0,void 0)},[f,e,b,S,l]);return c?t.createElement("div",{className:k(E.container,d),style:u},c({min:P,max:_,onMinChange:e=>{R(e),!m&&l&&l(e,_)},onMaxChange:e=>{z(e),!m&&l&&l(P,e)},onApply:W})):t.createElement("div",{className:k(E.container,d),style:u},r&&t.createElement("label",{className:E.label,style:{display:"block",fontSize:h.typography.fontSize.medium,fontWeight:"bold",marginBottom:h.spacing.small,color:h.colors.text}},r),t.createElement("div",{className:E.inputGroup,style:{display:"flex",alignItems:"center",gap:h.spacing.small}},t.createElement("input",{type:"number",min:o,max:a,step:i,value:void 0!==P?P:"",onChange:$,placeholder:g.min,className:k(E.input),style:{flex:1,padding:h.spacing.small,fontSize:h.typography.fontSize.medium,backgroundColor:h.colors.background,color:h.colors.text,border:`1px solid ${h.colors.border}`,borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,outline:"none"}}),t.createElement("span",{className:E.separator,style:{color:h.colors.text,opacity:.7}},"to"),t.createElement("input",{type:"number",min:o,max:a,step:i,value:void 0!==_?_:"",onChange:L,placeholder:g.max,className:k(E.input),style:{flex:1,padding:h.spacing.small,fontSize:h.typography.fontSize.medium,backgroundColor:h.colors.background,color:h.colors.text,border:`1px solid ${h.colors.border}`,borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,outline:"none"}}),m&&t.createElement("button",{type:"button",onClick:W,className:E.button,style:{padding:`${h.spacing.small} ${h.spacing.medium}`,backgroundColor:h.colors.primary,color:"#fff",border:"none",borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:"pointer",fontSize:h.typography.fontSize.small,fontWeight:"500"}},"Apply"),(void 0!==T||void 0!==A||void 0!==P||void 0!==_)&&t.createElement("button",{type:"button",onClick:q,style:{padding:`${h.spacing.small} ${h.spacing.medium}`,backgroundColor:"transparent",color:h.colors.text,border:`1px solid ${h.colors.border}`,borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:"pointer",fontSize:h.typography.fontSize.small}},"Reset")))},e.RangeSlider=({field:e,label:r,min:o,max:a,step:n=1,currentMin:s,currentMax:i,onRangeChange:l,formatValue:c=e=>e.toString(),className:d,style:u,theme:p,showValues:m=!0,syncWithState:g=!0,debounceMs:f=300})=>{const{theme:h}=y(),{refinements:b,addRefinement:v,removeRefinement:S}=x(),E=p||{},w=t.useMemo(()=>{if(!g)return{min:void 0,max:void 0};let t,r;return b.forEach(o=>{if(o.field===e){const e=o.value.match(/^>=(\d+(?:\.\d+)?)$/);e&&(t=parseFloat(e[1]));const a=o.value.match(/^<=(\d+(?:\.\d+)?)$/);a&&(r=parseFloat(a[1]))}}),{min:t,max:r}},[g,b,e]),[C,R]=t.useState(s??w.min??o),[I,z]=t.useState(i??w.max??a),[T,N]=t.useState(!1),A=t.useRef(null);t.useEffect(()=>{g&&!T&&(void 0!==w.min?R(w.min):R(o),void 0!==w.max?z(w.max):z(a))},[g,w.min,w.max,T,o,a]);const M=t.useCallback((t,r)=>{g&&(b.forEach(t=>{t.field===e&&S(e,t.value,!1)}),t>o&&v(e,`>=${t}`,!1),r<a&&v(e,`<=${r}`,t<=o),t>o&&r>=a&&v(e,`>=${t}`,!0))},[g,e,b,v,S,o,a]),P=t.useCallback((e,t)=>{A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{M(e,t),l&&l(e,t)},f)},[M,l,f]),_=()=>{N(!1)},B=(C-o)/(a-o)*100,$=(I-o)/(a-o)*100;return t.createElement("div",{className:k(E.root,d),style:{fontFamily:"inherit",...u}},r&&t.createElement("label",{className:E.label,style:{display:"block",marginBottom:h.spacing.small,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.medium||500,color:h.colors.text}},r),t.createElement("div",{className:E.slider,style:{position:"relative",height:"40px",display:"flex",alignItems:"center"}},t.createElement("div",{className:E.track,style:{position:"absolute",width:"100%",height:"4px",backgroundColor:h.colors.border,borderRadius:"2px"}}),t.createElement("div",{className:E.trackFilled,style:{position:"absolute",left:`${B}%`,width:$-B+"%",height:"4px",backgroundColor:h.colors.primary,borderRadius:"2px"}}),t.createElement("input",{type:"range",min:o,max:a,step:n,value:C,onChange:e=>{const t=Math.min(Number(e.target.value),I-n);R(t),N(!0),P(t,I)},onMouseUp:_,onTouchEnd:_,className:E.thumb,style:{position:"absolute",width:"100%",height:"4px",background:"transparent",WebkitAppearance:"none",appearance:"none",cursor:"pointer",pointerEvents:"none"},"aria-label":`Minimum ${r||e}`}),t.createElement("input",{type:"range",min:o,max:a,step:n,value:I,onChange:e=>{const t=Math.max(Number(e.target.value),C+n);z(t),N(!0),P(C,t)},onMouseUp:_,onTouchEnd:_,className:E.thumb,style:{position:"absolute",width:"100%",height:"4px",background:"transparent",WebkitAppearance:"none",appearance:"none",cursor:"pointer",pointerEvents:"none"},"aria-label":`Maximum ${r||e}`})),m&&t.createElement("div",{className:E.values,style:{display:"flex",justifyContent:"space-between",marginTop:h.spacing.small,fontSize:h.typography.fontSize.small,color:h.colors.textSecondary}},t.createElement("span",{className:E.value},c(C)),t.createElement("span",{className:E.value},c(I))),t.createElement("style",null,`\n .${E.thumb||"seekora-range-slider__thumb"}::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n background: ${h.colors.primary};\n border-radius: 50%;\n cursor: pointer;\n pointer-events: all;\n box-shadow: 0 2px 4px rgba(0,0,0,0.2);\n }\n .${E.thumb||"seekora-range-slider__thumb"}::-moz-range-thumb {\n width: 20px;\n height: 20px;\n background: ${h.colors.primary};\n border-radius: 50%;\n cursor: pointer;\n pointer-events: all;\n border: none;\n box-shadow: 0 2px 4px rgba(0,0,0,0.2);\n }\n `))},e.RecentlyViewed=({storageKey:e="seekora_recently_viewed",items:r,title:o="Recently Viewed",maxItems:a=6,renderItem:n,onItemClick:s,className:i,style:l,theme:c,layout:d="horizontal",currencySymbol:u="$"})=>{const[p,m]=t.useState([]);t.useEffect(()=>{if(!r)try{const t=localStorage.getItem(e);t&&m(JSON.parse(t))}catch(e){}},[e,r]);const g=(r||p).slice(0,a);return 0===g.length?null:t.createElement(S,{title:o,items:g,renderItem:n,onItemClick:s,className:i,style:l,theme:c,layout:d,currencySymbol:u})},e.RelatedProducts=({productId:e,items:r,loading:o=!1,title:a="Related Products",maxItems:n=6,renderItem:s,onItemClick:i,className:l,style:c,theme:d,layout:u="horizontal",currencySymbol:p="$"})=>{const{theme:m}=y(),g=d||{},f=r?.slice(0,n)||[];return o?t.createElement("div",{className:k(g.root,l),style:c},t.createElement("div",{className:g.loading,style:w(m)},"Loading related products...")):0===f.length?null:t.createElement(S,{title:a,items:f,renderItem:s,onItemClick:i,className:l,style:c,theme:d,layout:u,currencySymbol:p})},e.RichQuerySuggestions=Q,e.SearchBar=({placeholder:e="Search...",showSuggestions:r=!0,debounceMs:o=300,minQueryLength:a=2,maxSuggestions:n=10,onSearch:l,onQueryChange:c,onSuggestionSelect:d,onSearchStateChange:u,searchOptions:p,className:m,style:g,theme:f,renderSuggestion:h,renderLoading:v})=>{const{client:S,theme:E,enableAnalytics:w,autoTrackSearch:C}=y(),{query:R,setQuery:I,search:z,results:T,loading:N,error:A}=x(),[M,P]=t.useState(!1),[_,B]=t.useState(-1),$=t.useRef(null),L=t.useRef(null),W=t.useRef(!1),{suggestions:q,loading:F}=b({client:S,query:R,enabled:r&&R.length>=a,debounceMs:o,maxSuggestions:n}),H=q.slice(0,n);t.useEffect(()=>{u&&u({results:T,loading:N,error:A})},[T,N,A,u]),t.useEffect(()=>{T&&l&&l(R,T)},[T,R,l]),t.useEffect(()=>{c&&c(R)},[R,c]);const D=t.useCallback(async e=>{const t=e.trim();i("SearchBar: Triggering search",{query:t,originalQuery:e,isEmpty:!t}),W.current=!0,P(!1),B(-1),I(t,!1),i("SearchBar: Calling search() directly"),await z(),setTimeout(()=>{$.current?.blur(),setTimeout(()=>{W.current=!1},50)},100)},[I,z]),O=t.useCallback(e=>{s("SearchBar: Suggestion selected",{suggestion:e}),B(-1),P(!1),$.current?.blur(),d&&d(e),I(e)},[d,I]),j=t.useCallback(e=>{const t=e.target.value;I(t,!1),B(-1)},[I]),Q=t.useCallback(e=>{switch(e.key){case"ArrowDown":r&&H.length>0&&(e.preventDefault(),B(e=>e<H.length-1?e+1:e));break;case"ArrowUp":r&&H.length>0&&(e.preventDefault(),B(e=>e>0?e-1:-1));break;case"Enter":if(e.preventDefault(),e.stopPropagation(),r&&H.length>0&&_>=0&&_<H.length)O(H[_].query);else{const e=$.current?.value||R;D(e)}break;case"Escape":P(!1),$.current?.blur()}},[H,_,R,r,D,O]),V=t.useCallback(()=>{P(!0)},[]),Y=t.useCallback(e=>{W.current||setTimeout(()=>{L.current?.contains(document.activeElement)||(P(!1),B(-1))},200)},[]),U=(e,r)=>t.createElement("div",{key:r},e),K=f||{},X=F||N,G=H.length>0,J=M&&r&&R.length>=a&&(G||X),Z=T,ee=Z?.processingTimeMS||Z?.data?.processingTimeMS||Z?.data?.data?.processingTimeMS;return t.createElement("div",{ref:L,className:k(K.container,m),style:{position:"relative",display:"flex",alignItems:"center",...g}},t.createElement("input",{ref:$,type:"text",value:R,onChange:j,onKeyDown:Q,onFocus:V,onBlur:Y,placeholder:e,className:k(K.input,M&&K.inputFocused),style:{flex:1,padding:E.spacing.medium,fontSize:E.typography.fontSize.medium,fontFamily:E.typography.fontFamily,backgroundColor:E.colors.background,color:E.colors.text,borderWidth:"1px",borderStyle:"solid",borderColor:M?E.colors.focus:E.colors.border,borderRadius:"string"==typeof E.borderRadius?E.borderRadius:E.borderRadius.medium,outline:"none",...M&&{boxShadow:E.shadows.small}}}),void 0!==ee&&t.createElement("span",{style:{marginLeft:E.spacing.small,fontSize:E.typography.fontSize.small,color:E.colors.text,opacity:.7,whiteSpace:"nowrap"}},ee,"ms"),J&&t.createElement("div",{className:K.suggestionsContainer,style:{position:"absolute",top:"100%",left:0,right:0,marginTop:E.spacing.small,backgroundColor:E.colors.background,border:`1px solid ${E.colors.border}`,borderRadius:"string"==typeof E.borderRadius?E.borderRadius:E.borderRadius.medium,boxShadow:E.shadows.medium,maxHeight:"400px",overflowY:"auto",zIndex:1e3}},X&&(v?v():t.createElement("div",{style:{padding:E.spacing.medium,textAlign:"center"}},"Loading suggestions...")),!X&&H.length>0&&t.createElement(t.Fragment,null,H.map((e,r)=>{const o=r===_,a=h||U;return t.createElement("div",{key:r,className:k(K.suggestionItem,o&&K.suggestionItemActive),onClick:()=>O(e.query),onMouseEnter:()=>B(r),style:{padding:E.spacing.medium,cursor:"pointer",backgroundColor:o?E.colors.hover:"transparent",color:E.colors.text,transition:E.transitions?.fast||"150ms ease-in-out"}},a(e.query,r))})),!X&&0===H.length&&R.length>=a&&t.createElement("div",{style:{padding:E.spacing.medium,textAlign:"center",color:E.colors.textSecondary}},"No suggestions found")))},e.SearchBarWithSuggestions=me,e.SearchLayout=({sidebar:e,children:r,header:o,footer:a,sidebarWidth:n="300px",className:s,style:i,theme:l,showSidebarOnMobile:c=!1})=>{const{theme:d}=y(),u=l||{},[p,m]=t.useState(!1);return t.useEffect(()=>{const e=()=>{m(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t.createElement("div",{className:k(u.container,s),style:{display:"flex",flexDirection:"column",minHeight:"100vh",backgroundColor:d.colors.background,...i}},o&&t.createElement("header",{className:u.header,style:{padding:d.spacing.medium,borderBottom:`1px solid ${d.colors.border}`,backgroundColor:d.colors.background}},o),t.createElement("div",{style:{display:"flex",flex:1,gap:d.spacing.large,padding:d.spacing.medium,backgroundColor:d.colors.background,color:d.colors.text}},e&&(!p||c)&&t.createElement("aside",{className:u.sidebar,style:{width:n,minWidth:n}},e),t.createElement("main",{className:u.main,style:{flex:1,minWidth:0,backgroundColor:d.colors.background,color:d.colors.text}},r)),a&&t.createElement("footer",{className:u.footer,style:{padding:d.spacing.medium,borderTop:`1px solid ${d.colors.border}`,backgroundColor:d.colors.background}},a))},e.SearchProvider=({client:e,theme:r,enableAnalytics:o=!0,autoTrackSearch:a=!0,stateManager:n,children:s})=>{const i=t.useMemo(()=>r?f(r):g,[r]),l=t.useMemo(()=>new m({client:e,autoSearch:!0,debounceMs:300,itemsPerPage:10,defaultSearchOptions:{widget_mode:!0},...n}),[e,n]),c=t.useMemo(()=>({client:e,theme:i,enableAnalytics:o,autoTrackSearch:a,stateManager:l}),[e,i,o,a,l]);return t.createElement(h.Provider,{value:c},s)},e.SearchResults=({results:e,loading:r,error:o,onResultClick:a,renderResult:n,renderEmpty:i,renderLoading:d,renderError:u,className:p,style:m,theme:g,itemsPerPage:f=20,showPagination:h=!1,viewMode:b="list",fieldMapping:v,extractResults:S,enableKeyboardNavigation:E=!0,autoFocus:w=!1})=>{const{theme:C,client:R,enableAnalytics:I}=y(),{results:z,loading:T,error:N,currentPage:A,itemsPerPage:M}=x(),P=g||{},[_,B]=t.useState(-1),$=t.useRef(null),L=void 0!==e?e:z,W=void 0!==r?r:T,q=void 0!==o?o:N;t.useEffect(()=>{B(-1)},[L]),t.useEffect(()=>{if(_>=0&&$.current&&E){const e=$.current.querySelector(`[data-result-index="${_}"]`);e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}},[_,E]);const F=t.useCallback(e=>{if(!E)return;const t=$.current?.querySelectorAll("[data-result-index]"),r=t?t.length-1:-1;switch(e.key){case"ArrowDown":e.preventDefault(),B(e=>Math.min(e+1,r));break;case"ArrowUp":e.preventDefault(),B(e=>Math.max(e-1,-1));break;case"Enter":if(e.preventDefault(),_>=0){const e=$.current?.querySelector(`[data-result-index="${_}"]`);e&&e.click()}break;case"Escape":B(-1),$.current?.blur();break;case"Home":e.preventDefault(),B(0);break;case"End":e.preventDefault(),B(r)}},[E,_]),H="card"===b||"grid"===b?(r,o,n=!1)=>{const s=r.primaryText||r.title,i=r.secondaryText||r.description,l=r.tertiaryText||r.price,c=r.imageUrl||r.image;return t.createElement("div",{key:r.id||o,"data-result-index":o,className:k(P.resultItem,n&&P.resultItemHover),onClick:async()=>{if(I&&r.id)try{const t=e||z,a={currentPage:A,itemsPerPage:M},n=(a.currentPage-1)*a.itemsPerPage+o+1,s=t?.context||(t?{query:"",page:a.currentPage}:void 0);console.log("🔵 SearchResults: Tracking analytics event",{resultId:r.id,resultIndex:o,absolutePosition:n,currentPage:a.currentPage,itemsPerPage:a.itemsPerPage,hasContext:!!s}),await(R.trackEvent?.({event_name:"product_click",clicked_item_id:r.id,metadata:{result:r,position:n}},s)),console.log("🟢 SearchResults: Analytics event tracked successfully",{resultId:r.id,position:n})}catch(e){const t=e instanceof Error?e:new Error(String(e));console.error("SearchResults: Error tracking analytics event",{resultId:r.id,error:t.message})}a&&a(r,o)},onMouseEnter:()=>E&&B(o),style:{border:`1px solid ${n?C.colors.primary:C.colors.border}`,borderRadius:"string"==typeof C.borderRadius?C.borderRadius:C.borderRadius.medium,overflow:"hidden",cursor:a?"pointer":"default",transition:C.transitions?.normal||"250ms ease-in-out",backgroundColor:n?C.colors.hover:C.colors.background,display:"flex",flexDirection:"column",padding:C.spacing.medium,boxShadow:n?C.shadows.medium:C.shadows.small,outline:n?`2px solid ${C.colors.primary}`:"none",outlineOffset:"-2px"}},c&&t.createElement("div",{style:{width:"100%",aspectRatio:"16/9",overflow:"hidden",backgroundColor:C.colors.hover}},t.createElement("img",{src:c,alt:s,style:{width:"100%",height:"100%",objectFit:"cover"}})),t.createElement("div",{style:{padding:C.spacing.medium}},s&&t.createElement("h3",{className:P.resultTitle,style:{fontSize:C.typography.fontSize.large,fontWeight:"bold",margin:0,marginBottom:C.spacing.small,color:C.colors.text}},s),i&&t.createElement("p",{className:P.resultDescription,style:{fontSize:C.typography.fontSize.medium,color:C.colors.text,margin:0,marginBottom:C.spacing.small,opacity:.8,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"}},i),l&&t.createElement("div",{className:P.resultPrice,style:{fontSize:C.typography.fontSize.medium,fontWeight:"bold",color:C.colors.primary,marginTop:"auto"}},l)))}:(r,o,n=!1)=>t.createElement("div",{key:r.id||o,"data-result-index":o,className:k(P.resultItem,n&&P.resultItemHover),onClick:async()=>{if(I&&r.id)try{const t=e||z,a={currentPage:A,itemsPerPage:M},n=(a.currentPage-1)*a.itemsPerPage+o+1,s=t?.context||(t?{query:"",page:a.currentPage}:void 0);console.log("🔵 SearchResults: Tracking analytics event",{resultId:r.id,resultIndex:o,absolutePosition:n,currentPage:a.currentPage,itemsPerPage:a.itemsPerPage,hasContext:!!s}),await(R.trackEvent?.({event_name:"product_click",clicked_item_id:r.id,metadata:{result:r,position:n}},s)),console.log("🟢 SearchResults: Analytics event tracked successfully",{resultId:r.id,position:n})}catch(e){const t=e instanceof Error?e:new Error(String(e));console.error("SearchResults: Error tracking analytics event",{resultId:r.id,error:t.message})}a&&a(r,o)},onMouseEnter:()=>E&&B(o),style:{padding:C.spacing.medium,border:`1px solid ${C.colors.border}`,borderBottom:`1px solid ${C.colors.border}`,borderRadius:0,marginBottom:0,cursor:a?"pointer":"default",transition:C.transitions?.normal||"250ms ease-in-out",backgroundColor:n?C.colors.hover:C.colors.background,display:"flex",alignItems:"flex-start",gap:C.spacing.medium,outline:n?`2px solid ${C.colors.primary}`:"none",outlineOffset:"-2px"}},r.image&&t.createElement("img",{src:r.image,alt:r.title,className:P.resultImage,style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"string"==typeof C.borderRadius?C.borderRadius:C.borderRadius.medium,flexShrink:0}}),t.createElement("div",{style:{flex:1,minWidth:0}},t.createElement("h3",{className:P.resultTitle,style:{fontSize:C.typography.fontSize.large,fontWeight:"bold",margin:0,marginBottom:C.spacing.small,color:C.colors.text}},r.title),r.description&&t.createElement("p",{className:P.resultDescription,style:{fontSize:C.typography.fontSize.medium,color:C.colors.text,margin:0,marginBottom:C.spacing.small,opacity:.8}},r.description),r.price&&t.createElement("div",{className:P.resultPrice,style:{fontSize:C.typography.fontSize.medium,fontWeight:"bold",color:C.colors.primary}},r.price)));let D=[];if(S)D=S(L)||[];else if(L){const e=L;Array.isArray(e.results)&&e.results.length>0?D=e.results:e.data&&Array.isArray(e.data.results)&&e.data.results.length>0?D=e.data.results:e.data?.data&&Array.isArray(e.data.data.results)&&e.data.data.results.length>0?D=e.data.data.results:Array.isArray(L)?D=L:Array.isArray(e.results)&&(D=e.results)}const O={title:"document.productName",description:"document.brandDesc",image:"document.image",price:"document.mrp",url:"document.url",id:"id",...v},j=(e,t)=>{if(t)return((e,t)=>{if(t)return t.split(".").reduce((e,t)=>e?.[t],e)})(e,t)},Q=D.map((e,t)=>{try{const r=j(e,O.primaryText),o=j(e,O.secondaryText),a=j(e,O.tertiaryText),n=j(e,O.imageUrl),s=j(e,O.title)||r||"Untitled",i=j(e,O.description)||o,l=j(e,O.image)||n,c=j(e,O.price)||a,d=j(e,O.url),u=j(e,O.id)||String(t),p=void 0!==c?((e,t="₹")=>{if(null!=e){if("number"==typeof e)return`${t}${e}`;if("string"==typeof e){const r=parseFloat(e);return isNaN(r)?e:`${t}${r}`}return String(e)}})(c):void 0,m={};O.custom&&Object.entries(O.custom).forEach(([t,r])=>{m[t]=j(e,r)});return{id:u,title:s,description:i,url:d,image:l,price:p,metadata:e,...m,...r&&{primaryText:r},...o&&{secondaryText:o},...a&&{tertiaryText:a},...n&&{imageUrl:n},_raw:e}}catch(r){const o=r instanceof Error?r:new Error(String(r));return l("SearchResults: Error extracting result item",{index:t,error:o.message,item:e?.id||"unknown"}),{id:String(t),title:"Error loading result",metadata:e}}}),V={...m},Y={..."grid"===b&&{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:C.spacing.medium},..."card"===b&&{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:C.spacing.medium}};if(s("SearchResults: Extracted results",{rawResultsCount:D.length,resultItemsCount:Q.length,viewMode:b,hasError:!!q,isLoading:W}),W)return s("SearchResults: Rendering loading state"),t.createElement("div",{className:k(P.container,p),style:m},d?d():t.createElement("div",{className:P.loadingState,style:{padding:C.spacing.large,textAlign:"center",color:C.colors.text}},"Loading results..."));if(q)return c("SearchResults: Rendering error state",{error:q.message,stack:q.stack}),t.createElement("div",{className:k(P.container,p),style:m},u?u(q):(U=q,t.createElement("div",{className:P.errorState,style:{padding:C.spacing.large,textAlign:"center",color:C.colors.error}},"Error: ",U.message)));var U;if(!L||0===Q.length)return s("SearchResults: No results to display"),t.createElement("div",{className:k(P.container,p),style:m},i?i():t.createElement("div",{className:P.emptyState,style:{padding:C.spacing.large,textAlign:"center",color:C.colors.text}},"No results found"));const K=n||H;return t.createElement("div",{ref:$,className:k(P.container,p),style:V,tabIndex:E?0:void 0,onKeyDown:F,role:"listbox","aria-label":"Search results","aria-activedescendant":_>=0?`result-${_}`:void 0},(void 0!==L?.totalResults||void 0!==L?.data?.total_results)&&Q.length>0&&t.createElement("div",{className:P.header,style:{marginBottom:C.spacing.medium,fontSize:C.typography.fontSize.medium,color:C.colors.text}},"Found ",L?.totalResults||L?.data?.total_results||0," result",1!==(L?.totalResults||L?.data?.total_results||0)?"s":""),E&&Q.length>0&&t.createElement("div",{style:{fontSize:"12px",color:C.colors.text,opacity:.6,marginBottom:C.spacing.small,display:"flex",gap:"8px",alignItems:"center"}},t.createElement("span",{style:{display:"inline-flex",gap:"4px",padding:"2px 6px",backgroundColor:C.colors.hover,borderRadius:"4px",fontSize:"11px"}},"↑↓ navigate"),t.createElement("span",{style:{display:"inline-flex",gap:"4px",padding:"2px 6px",backgroundColor:C.colors.hover,borderRadius:"4px",fontSize:"11px"}},"↵ select")),t.createElement("div",{className:P.resultsList,style:Y},Q.map((e,t)=>K(e,t,t===_))))},e.ShopifyDropdown=lt,e.Snippet=({hit:e,attribute:r,maxLength:o=100,ellipsis:a="...",className:n,style:s,theme:i,tagName:l="span",renderHighlighted:c,renderNonHighlighted:m,query:g})=>{const{theme:f}=y(),h=i||{},x=t.useMemo(()=>{const t=e._snippetResult?.[r]?.value||e.snippet_result?.[r]?.value||e._snippet?.[r]||e.snippet?.[r];if(t)return t.replace(/<em>/g,"<mark>").replace(/<\/em>/g,"</mark>");let n=d({hit:e,attribute:r,preTag:"<mark>",postTag:"</mark>"});if(n.replace(/<\/?mark>/g,"").length>o){const e=function(e,t){let r=0,o="",a=!1;for(let n=0;n<e.length;n++){const s=e[n];if("<"===s)a=!0,o+=s;else if(">"===s)a=!1,o+=s;else if(a)o+=s;else{if(r>=t)break;o+=s,r++}}const n=o.match(/<mark>/g)?.length||0,s=o.match(/<\/mark>/g)?.length||0;for(let e=0;e<n-s;e++)o+="</mark>";return o}(n,o);return e+a}return n},[e,r,o,a]),b=t.useMemo(()=>{const t=u(x,"<mark>","</mark>");if(t.every(e=>!e.isHighlighted)&&g){const t=e[r]||x;let n=String(t);return n.length>o&&(n=n.substring(0,o)+a),p(n,g)}return t},[x,g,e,r,o,a]),v={backgroundColor:f.colors.warning||"#fff59d",fontWeight:f.typography.fontWeight?.semibold||600,padding:"0 2px",borderRadius:"2px"},k=b.map((e,r)=>e.isHighlighted?c?t.createElement(t.Fragment,{key:r},c(e,r)):t.createElement("mark",{key:r,className:h.highlighted,style:v},e.value):m?t.createElement(t.Fragment,{key:r},m(e,r)):t.createElement("span",{key:r,className:h.nonHighlighted},e.value));return t.createElement(l,{className:n||h.root,style:s},k)},e.SortBy=({options:e,value:r,defaultValue:o,onSortChange:a,renderSelect:n,className:s,style:i,theme:l,placeholder:c="Sort by...",syncWithState:d=!0})=>{const{theme:u}=y(),{sortBy:p,setSortBy:m}=x(),g=l||{},[f,h]=t.useState(o||e[0]?.value||"");t.useEffect(()=>{d&&o&&!p&&m(o,!1)},[]);const b=void 0!==r?r:d&&p?p:f,v=e=>{const t=e.target.value;h(t),d&&m(t),a&&a(t)};return n?t.createElement("div",{className:k(g.container,s),style:i},n({value:b,onChange:v,options:e})):t.createElement("select",{value:b,onChange:v,className:k(g.select,s),style:{padding:u.spacing.small,paddingRight:u.spacing.medium,fontSize:u.typography.fontSize.medium,border:`1px solid ${u.colors.border}`,borderRadius:"string"==typeof u.borderRadius?u.borderRadius:u.borderRadius.medium,backgroundColor:u.colors.background,color:u.colors.text,cursor:"pointer",outline:"none",...i},"aria-label":"Sort results"},e.map(e=>t.createElement("option",{key:e.value,value:e.value,className:g.option},e.label)))},e.SpotlightDropdown=nt,e.Stats=({results:e,renderStats:r,className:o,style:a,theme:n,showProcessingTime:s=!1,showQuery:i=!1,separator:l=" • "})=>{const{theme:c}=y(),d=n||{},u=e,p=u?.totalResults||u?.data?.total_results||u?.data?.data?.total_results||0,m=u?.processingTimeMS||u?.data?.processingTimeMS||u?.data?.data?.processingTimeMS,g=u?.query??"";return r?t.createElement("div",{className:k(d.container,o),style:a},r({totalResults:p,processingTime:m,query:g})):(()=>{const e=[];return p>0?e.push(`${p.toLocaleString()} result${1!==p?"s":""}`):e.push("No results"),s&&void 0!==m&&e.push(`${m}ms`),i&&g&&e.push(`for "${g}"`),t.createElement("div",{className:k(d.container,o),style:{fontSize:c.typography.fontSize.medium,color:c.colors.text,...a}},e.map((e,r)=>t.createElement("span",{key:r},r>0&&t.createElement("span",{className:d.separator,style:{margin:`0 ${c.spacing.small}`}},l),t.createElement("span",{className:d.text},e))))})()},e.SuggestionDropdownVariants=bt,e.SuggestionSearchBar=xt,e.TrendingItems=({items:e,loading:r=!1,title:o="Trending Now",maxItems:a=8,renderItem:n,onItemClick:s,className:i,style:l,theme:c,layout:d="horizontal",currencySymbol:u="$"})=>{const{theme:p}=y(),m=c||{},g=e?.slice(0,a)||[];return r?t.createElement("div",{className:k(m.root,i),style:l},t.createElement("div",{className:m.loading,style:w(p)},"Loading trending items...")):0===g.length?null:t.createElement(S,{title:o,items:g,renderItem:n,onItemClick:s,className:i,style:l,theme:c,layout:d,currencySymbol:u})},e.addRecentSearch=Re,e.addToRecentlyViewed=function(e,t="seekora_recently_viewed",r=20){if("undefined"!=typeof localStorage)try{const o=localStorage.getItem(t);let a=o?JSON.parse(o):[];a=a.filter(t=>t.id!==e.id),a.unshift(e),a=a.slice(0,r),localStorage.setItem(t,JSON.stringify(a))}catch(e){}},e.brandPresets=Ct,e.breakpoints=Me,e.clearRecentSearches=e=>{try{const t=e?`${we}_${e}`:we;localStorage.removeItem(t)}catch{}},e.clearSuggestionsCache=()=>{Ne?.clear()},e.createSuggestionsCache=e=>new Te(e),e.createSuggestionsTheme=function(e="light",t={},r){return{...{light:St,dark:Et,minimal:wt}[e],...r?Ct[r]:{},...t}},e.createTheme=f,e.darkTheme={colors:{primary:"#0d6efd",secondary:"#6c757d",background:"#1a1a1a",text:"#ffffff",border:"#333333",hover:"#2a2a2a",focus:"#0d6efd",error:"#dc3545"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',fontSize:{small:"0.875rem",medium:"1rem",large:"1.25rem"}},spacing:{small:"0.5rem",medium:"1rem",large:"1.5rem"},borderRadius:"0.25rem",shadows:{small:"0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.7)",medium:"0 3px 6px rgba(0, 0, 0, 0.6), 0 3px 6px rgba(0, 0, 0, 0.8)",large:"0 10px 20px rgba(0, 0, 0, 0.7), 0 6px 6px rgba(0, 0, 0, 0.9)"}},e.darkThemeVariables=Et,e.defaultTheme=g,e.extractBrand=(e,t={name:"name"})=>({id:t.id?ge(e,t.id):e?.id,name:ge(e,t.name)??"",logo:t.logo?ge(e,t.logo):void 0,count:t.count?ge(e,t.count):void 0,_raw:e}),e.extractCategory=ye,e.extractProduct=he,e.extractSuggestion=fe,e.formatParsedFilters=function(e){return e.map(e=>`${e.field}: ${e.value}`).join(", ")},e.formatSuggestionPrice=xe,e.generateSuggestionsStylesheet=Rt,e.getRecentSearches=Ce,e.getSuggestionsCache=Ae,e.highlightText=ve,e.injectGlobalResponsiveStyles=Le,e.injectSuggestionsStyles=zt,e.lightThemeVariables=St,e.mediaQueries=Pe,e.mergeThemes=(e,...t)=>t.reduce((e,t)=>({colors:{...e.colors,...t.colors},typography:{...e.typography,...t.typography,fontSize:{...e.typography?.fontSize,...t.typography?.fontSize}},spacing:{...e.spacing,...t.spacing},borderRadius:t.borderRadius??e.borderRadius,shadows:{...e.shadows,...t.shadows},transitions:{...e.transitions,...t.transitions},breakpoints:{...e.breakpoints,...t.breakpoints},zIndex:{...e.zIndex,...t.zIndex}}),e),e.minimalTheme={colors:{primary:"#000000",secondary:"#666666",background:"#ffffff",text:"#000000",border:"#e0e0e0",hover:"#f5f5f5",focus:"#000000",error:"#cc0000"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',fontSize:{small:"0.875rem",medium:"1rem",large:"1.125rem"}},spacing:{small:"0.5rem",medium:"0.75rem",large:"1rem"},borderRadius:"0",shadows:{small:"none",medium:"none",large:"none"}},e.minimalThemeVariables=wt,e.removeRecentSearch=Ie,e.touchTargets=_e,e.updateSuggestionsStyles=function(e){zt(e,!0)},e.useAnalytics=({client:e,enabled:r=!0})=>{const o=t.useCallback(async(t,o,a)=>{if(r)try{const r={event_name:t,...o};await(e.trackEvent?.(r,a))}catch(e){c("Failed to track event:",e)}},[e,r]),a=t.useCallback(async(e,t,a,n)=>{r&&await o("product_click",{clicked_item_id:e,metadata:{result:t,...void 0!==n&&{position:n}}},a)},[o,r]),n=t.useCallback(async(e,t,a,n,s)=>{r&&await o("conversion",{clicked_item_id:e,value:a,currency:n,metadata:{result:t}},s)},[o,r]),s=t.useCallback(async(t,o)=>{if(r&&0!==t.length)try{await(e.trackEvents?.(t,o))}catch(e){c("Failed to track batch events:",e)}},[e,r]);return{trackEvent:o,trackClick:a,trackConversion:n,trackBatch:s}},e.useInjectResponsiveStyles=We,e.useNaturalLanguageFilters=function(e={}){const{fieldMappings:r={},valueMappings:o={},autoApply:a=!1,currencySymbol:n="$"}=e,{addRefinement:s,removeRefinement:i,clearRefinements:l,setQuery:c}=x(),d=t.useMemo(()=>({...kt,colors:[...kt.colors,...o.color?Object.keys(o.color):[]],sizes:{...kt.sizes,...o.size||{}}}),[o]),u=t.useCallback(e=>{const t=[];let a=e;for(const o of d.price){const n=e.match(o.pattern);if(n){"range"===o.operator&&n[2]?(t.push({field:r.price||"price",value:`>=${n[1]}`,operator:">=",confidence:.95,matchedText:n[0]}),t.push({field:r.price||"price",value:`<=${n[2]}`,operator:"<=",confidence:.95,matchedText:n[0]})):n[1]&&t.push({field:r.price||"price",value:`${o.operator}${n[1]}`,operator:o.operator,confidence:.95,matchedText:n[0]}),a=a.replace(n[0]," ");break}}const n=new RegExp(`\\b(${d.colors.join("|")})\\b`,"gi"),s=e.match(n);s&&s.forEach(e=>{const n=o.color?.[e.toLowerCase()]||e.toLowerCase();t.push({field:r.color||"color",value:n,operator:"=",confidence:.9,matchedText:e}),a=a.replace(new RegExp(`\\b${e}\\b`,"gi")," ")});const i=Object.entries(d.sizes);for(const[o,n]of i){const s=new RegExp(`\\b${o}\\b`,"gi");if(s.test(e)){t.push({field:r.size||"size",value:n,operator:"=",confidence:.85,matchedText:o}),a=a.replace(s," ");break}}for(const o of d.ratings)if("value"in o)o.pattern.test(e)&&(t.push({field:r.rating||o.field,value:`${o.operator}${o.value}`,operator:o.operator,confidence:.8,matchedText:e.match(o.pattern)?.[0]||""}),a=a.replace(o.pattern," "));else{const n=e.match(o.pattern);n&&n[1]&&(t.push({field:r.rating||o.field,value:`${o.operator}${n[1]}`,operator:o.operator,confidence:.85,matchedText:n[0]}),a=a.replace(n[0]," "))}for(const o of d.availability)o.pattern.test(e)&&(t.push({field:r[o.field]||o.field,value:o.value,operator:"=",confidence:.9,matchedText:e.match(o.pattern)?.[0]||""}),a=a.replace(o.pattern," "));return a=a.replace(/\s+/g," ").trim(),{cleanedQuery:a,filters:t,originalQuery:e,hasFilters:t.length>0}},[d,r,o]),p=t.useCallback(e=>{e.forEach(e=>{s(e.field,e.value,!1)}),e.length},[s]),m=t.useCallback(e=>{const t=u(e);return t.hasFilters&&(p(t.filters),t.cleanedQuery!==e&&c(t.cleanedQuery,!0)),t},[u,p,c]);return{parse:u,applyFilters:p,parseAndApply:m}},e.useQuerySuggestions=b,e.useQuerySuggestionsEnhanced=M,e.useResponsive=Be,e.useSearchContext=y,e.useSearchState=x,e.useSeekoraSearch=({client:e,autoTrack:r=!0})=>{const[o,a]=t.useState(null),[n,l]=t.useState(!1),[d,u]=t.useState(null),[p,m]=t.useState(null),g=t.useCallback(async t=>{l(!0),u(null);const r=t.q||"";s("useSeekoraSearch: Starting search",{query:r,options:t});try{const{q:r,...o}=t,n="string"==typeof r?r:"",s=await e.search(n,o);return i("useSeekoraSearch: Search completed",{query:n,resultsCount:Array.isArray(s?.results)?s.results.length:0,hasContext:!!s?.context}),a(s),null!=s.context&&m(s.context),s}catch(e){const t=e instanceof Error?e:new Error(String(e));return c("useSeekoraSearch: Search failed",{query:r,error:t.message,stack:t.stack}),u(t),a(null),m(null),null}finally{l(!1)}},[e]);return{search:g,results:o,loading:n,error:d,context:p,clearResults:t.useCallback(()=>{a(null),u(null),m(null)},[])}},e.useSmartSuggestions=function(e,r={}){const{minQueryLength:o=1,maxSuggestions:a=10,debounceMs:n=200,enableSpellCorrection:s=!0,enableQueryExpansion:i=!0,enableIntentDetection:l=!0,includeTrending:c=!0,userContext:d}=r,{stateManager:u}=y(),[p,m]=t.useState([]),[g,f]=t.useState(!1),[h,x]=t.useState(null),[b,v]=t.useState(null),[k,S]=t.useState([]),[E,w]=t.useState([]),C=t.useRef(null),R=t.useMemo(()=>["phone","laptop","computer","tablet","headphones","camera","television","speaker","watch","keyboard","mouse","monitor","shirt","pants","shoes","jacket","dress","skirt","sweater","electronics","clothing","accessories","furniture","appliances"],[]),I=t.useCallback(async e=>{const t=[];if(l){const t=function(e){const t=[{pattern:/^(buy|purchase|order|get)\s+/i,intent:"purchase"},{pattern:/^(find|search|looking for|where)\s+/i,intent:"search"},{pattern:/^(compare|vs|versus)\s+/i,intent:"compare"},{pattern:/^(how (to|do)|what is|why)\s+/i,intent:"informational"},{pattern:/under\s*\$?\d+|less than\s*\$?\d+|cheap|affordable/i,intent:"price_sensitive"},{pattern:/best|top|recommended|popular/i,intent:"recommendation"},{pattern:/\d+\s*(gb|tb|inch|cm|mm|kg|lb)/i,intent:"specification"},{pattern:/(red|blue|green|black|white|pink|purple|yellow)\s+/i,intent:"color_preference"},{pattern:/(size|small|medium|large|xl|xxl)\s+/i,intent:"size_preference"}];for(const{pattern:r,intent:o}of t)if(r.test(e))return{intent:o,confidence:.8};return null}(e);v(t?t.intent:null)}if(s&&e.length>=3){const r=vt(e,R);S(r),r.forEach(r=>{t.push({text:r,type:"correction",confidence:.9,metadata:{correctedFrom:e}})})}if(i){const r=function(e){const t=e.toLowerCase(),r=[];return Object.entries({phone:["smartphone","mobile","cellphone"],laptop:["notebook","computer","pc"],tv:["television","smart tv","monitor"],headphones:["earbuds","earphones","headset"],shoes:["footwear","sneakers","boots"],shirt:["top","blouse","tee"],pants:["trousers","jeans","bottoms"],cheap:["affordable","budget","inexpensive"],best:["top-rated","popular","recommended"]}).forEach(([o,a])=>{t.includes(o)&&a.forEach(t=>{const a=e.replace(new RegExp(o,"gi"),t);r.includes(a)||r.push(a)})}),r.slice(0,3)}(e);w(r),r.forEach(e=>{t.push({text:e,type:"expansion",confidence:.7,metadata:{expandedTo:[e]}})})}return t.unshift({text:e,type:"query",confidence:1}),d?.recentSearches&&d.recentSearches.filter(t=>t.toLowerCase().includes(e.toLowerCase())&&t!==e).slice(0,2).forEach(e=>{t.push({text:e,type:"related",confidence:.6})}),t.slice(0,a)},[R,l,s,i,a,d]),z=t.useCallback(async e=>e.length<o?[]:I(e),[o,I]);return t.useEffect(()=>(C.current&&clearTimeout(C.current),e.length<o?(m([]),S([]),w([]),void v(null)):(f(!0),C.current=setTimeout(async()=>{try{const t=await I(e);m(t),x(null)}catch(e){x(e instanceof Error?e:new Error(String(e))),m([])}finally{f(!1)}},n),()=>{C.current&&clearTimeout(C.current)})),[e,o,n,I]),{suggestions:p,loading:g,error:h,detectedIntent:b,corrections:k,expansions:E,getSuggestions:z,clear:t.useCallback(()=>{m([]),S([]),w([]),v(null),x(null)},[])}},e.useSuggestionsAnalytics=ce});