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oBA,SAO1BpE,EAAAA,cAAC61B,EAAe,CAACzwB,YAAY,qBAAqBI,uBAAwBnB,KAI9E,gBG7yBO,SAASw3B,EAAuBt6B,GACtC,GAAIA,QACH,OAAO,KAGR,IACC,OAAO4L,KAAKe,MAAM3M,EACnB,CAAE,MAAA+J,GACD,OAAO,IACR,CACD","sources":["webpack://@logos/commerceweb-frontend/./Scripts/site/components/error-boundary/index.jsx","webpack://@logos/commerceweb-frontend/./Scripts/site/hooks/use-author.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/shared/books-by-author/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/hooks/use-publisher.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/content/section-content.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/clients/content-client.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/category-content.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/user-search-filter-context.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/accordion/accordion.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/search-resources.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/bounded-responses-cache.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/algolia-search-context.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/util.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/filters.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/refinements.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/hidden-facet-refinements.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/skeleton/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/shared/enhanced-for-logos-label/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/shared/enhanced-for-logos-with-tooltip/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/use-product-card.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/product-image.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/discount-badge.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/product-title.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/product-authors.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/product-pricing.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/algolia-grid-card.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/product-overview.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/algolia-list-card.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/products.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/radio-accordion.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/sort-by-accordion.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/hits-per-page-accordion.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/use-view-mode.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/routing.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/use-hydration-settled.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/hooks/use-search-impressions.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/hooks/use-search-analytics.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/util/safe-json-parse.ts"],"sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n\nclass ErrorBoundary extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\thasError: false,\n\t\t\terror: null,\n\t\t\terrorInfo: null,\n\t\t};\n\t}\n\n\tstatic getDerivedStateFromError(error) {\n\t\t// Update state so the next render will show the fallback UI\n\t\treturn { hasError: true };\n\t}\n\n\tcomponentDidCatch(error, errorInfo) {\n\t\t// Store error details in state\n\t\tthis.setState({\n\t\t\terror,\n\t\t\terrorInfo,\n\t\t});\n\n\t\t// Notify parent component about the error\n\t\tif (this.props.onError) {\n\t\t\tthis.props.onError(error, errorInfo);\n\t\t}\n\n\t\t// Log error to console or external service\n\t\tconsole.error('ErrorBoundary caught an error:', error, errorInfo);\n\t}\n\n\tresetErrorBoundary = () => {\n\t\tthis.setState({\n\t\t\thasError: false,\n\t\t\terror: null,\n\t\t\terrorInfo: null,\n\t\t});\n\n\t\t// Notify parent that error was reset\n\t\tif (this.props.onReset) {\n\t\t\tthis.props.onReset();\n\t\t}\n\t};\n\n\trender() {\n\t\tif (this.state.hasError) {\n\t\t\t// If custom error template is provided, use it\n\t\t\tif (this.props.fallback) {\n\t\t\t\tif (typeof this.props.fallback !== 'function') {\n\t\t\t\t\treturn this.fallback;\n\t\t\t\t}\n\n\t\t\t\t// Pass error details and reset function to custom template\n\t\t\t\treturn this.props.fallback({\n\t\t\t\t\terror: this.state.error,\n\t\t\t\t\terrorInfo: this.state.errorInfo,\n\t\t\t\t\tresetErrorBoundary: this.resetErrorBoundary,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// If fallbackComponent is provided as a React component\n\t\t\tif (this.props.fallbackComponent) {\n\t\t\t\tconst FallbackComponent = this.props.fallbackComponent;\n\t\t\t\treturn (\n\t\t\t\t\t<FallbackComponent\n\t\t\t\t\t\terror={this.state.error}\n\t\t\t\t\t\terrorInfo={this.state.errorInfo}\n\t\t\t\t\t\tresetErrorBoundary={this.resetErrorBoundary}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this.props.children;\n\t}\n}\n\nErrorBoundary.propTypes = {\n\tchildren: PropTypes.node.isRequired,\n\tfallback: PropTypes.func,\n\tfallbackComponent: PropTypes.elementType,\n\tonError: PropTypes.func,\n\tonReset: PropTypes.func,\n\tshowError: PropTypes.bool,\n};\n\nErrorBoundary.defaultProps = {\n\tshowError: false,\n};\n\nexport default ErrorBoundary;\n","import { createBatchContext } from './use-batch';\n\ninterface AuthorInfo {\n\tid: string;\n\tdisplayName: string;\n\timageUrlLarge?: string;\n\tlongDescription?: string;\n}\n\nexport const AuthorBatch = createBatchContext<string, AuthorInfo>(\n\tasync ids => {\n\t\tconst nonEmptyIds = ids.filter(id => id);\n\t\tif (nonEmptyIds.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tconst response = await fetch(`/api/authors?ids=${nonEmptyIds.join(',')}`);\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`HTTP error! status: ${response.status}`);\n\t\t}\n\n\t\treturn (await response.json()) as AuthorInfo[];\n\t},\n\t(id, data) => data.find(d => d.id === id)\n);\n\nexport function useAuthor(id: string) {\n\treturn AuthorBatch.useData(id);\n}\n","import React, { useState } from 'react';\nimport { IconButton, Typography } from '@faithlife/commerce-components';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport { useRefinementList } from 'react-instantsearch';\nimport { AuthorBio } from '../author-bio';\nimport { useAuthor } from '../../../hooks/use-author';\n\nconst useGetRefinedValues = (attribute: string) =>\n\tuseRefinementList({ attribute })\n\t\t.items.filter(item => item.isRefined)\n\t\t.map(item => item.value) ?? [];\n\ninterface BooksByAuthorProps {\n\tresources: {\n\t\tbooksBy: string;\n\t\tshowMore: string;\n\t\tshowLess: string;\n\t};\n}\n\nexport const BooksByAuthor = ({ resources }: BooksByAuthorProps) => {\n\tconst refinedAuthorIds = useGetRefinedValues('authorIds');\n\tconst authorId = refinedAuthorIds?.length === 1 ? refinedAuthorIds[0] : '';\n\tconst { data: author, isLoading } = useAuthor(authorId);\n\n\tconst [isCollapsed, setIsCollapsed] = useState(false);\n\n\tif (isLoading || !authorId || !author || !author.displayName || !author.longDescription) {\n\t\treturn <></>;\n\t}\n\n\treturn (\n\t\t<div className=\"bg-[#f2f2f2] border-t border-b border-[#b1b1b1] px-3 py-4 md:p-6\">\n\t\t\t<div className=\"flex justify-between\">\n\t\t\t\t<Typography variant=\"headingH6\">\n\t\t\t\t\t{resources.booksBy} {author?.displayName}\n\t\t\t\t</Typography>\n\t\t\t\t<IconButton aria-label=\"Toggle collapse\" scale=\"sm\" onClick={() => setIsCollapsed(!isCollapsed)}>\n\t\t\t\t\t{isCollapsed ? <ChevronDown /> : <ChevronUp />}\n\t\t\t\t</IconButton>\n\t\t\t</div>\n\t\t\t{!isCollapsed && (\n\t\t\t\t<AuthorBio\n\t\t\t\t\tclassName=\"mt-4 rounded-[3px] border border-[#d8d8d8] bg-white p-4 md:p-8\"\n\t\t\t\t\tresources={resources}\n\t\t\t\t\tdisplayName={author?.displayName}\n\t\t\t\t\timageUrl={author?.imageUrlLarge}\n\t\t\t\t\tbio={author?.longDescription}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n","import { createBatchContext } from './use-batch';\n\nexport interface PublisherInfo {\n\tid: string;\n\tdisplayName: string;\n}\n\nexport const PublisherBatch = createBatchContext<string, PublisherInfo>(\n\tasync ids => {\n\t\tconst nonEmptyIds = ids.filter(id => id);\n\t\tif (nonEmptyIds.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tconst response = await fetch(`/api/publisher?ids=${nonEmptyIds.join(',')}`);\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`HTTP error! status: ${response.status}`);\n\t\t}\n\n\t\treturn (await response.json()) as PublisherInfo[];\n\t},\n\t(id, data) => data.find(d => d.id === id)\n);\n\nexport function usePublisher(id: string) {\n\treturn PublisherBatch.useData(id);\n}\n","import React, { useEffect, useRef, useState } from 'react';\n\nimport { RenderBuilderContent } from '../builder';\nimport { getSections } from '../../clients/content-client';\nimport { useLocation } from '../../location';\nimport { useIsPreviewingThisBuilderModel, SectionContentViewModel, SectionKind } from '../../builder';\nimport { c_defaultUserInfo } from '../per-user-data/per-user-data-context';\nimport { notifyWarning } from '../notifications';\n\ninterface ContentChangeEvent {\n\thasContent: boolean;\n\tcontentKey: string;\n}\n\nconst builderIoModelNamesBySectionKindMap: Record<SectionKind, string> = {\n\tsearchResultsAbove: 'search-results-above',\n\tsearchResultsBelow: 'search-results-below',\n\tuniversalHeader: 'universal-header',\n\tuniversalFooter: 'universal-footer',\n\tsubscriptionChurnPrevention: 'subscription-churn-prevention',\n\tconfigurationWizardSubscriptionsBanner: 'configuration-wizard-subscriptions-banner',\n\tconfigurationWizardSubscriptionsContent: 'configuration-wizard-subscriptions-content',\n\tconfigurationWizardLibrariesBanner: 'configuration-wizard-libraries-banner',\n\torderSummary: 'order-summary',\n\torderSummaryFooter: 'order-summary-footer',\n\tproductPage: 'product-page',\n\tadzone: 'adzone',\n\tnotifications: 'notifications',\n};\n\nfunction getContentKey(sectionContents: SectionContentViewModel[]): string {\n\treturn sectionContents\n\t\t.filter(sc => !!sc)\n\t\t.map(sc => `${sc.sectionKind}:${sc.contentSourceKind}:${sc.contentId}`)\n\t\t.join('|');\n}\n\nconst SectionContent = ({\n\tsectionKind,\n\tinitialSectionContents,\n\tonContentChange,\n}: {\n\tsectionKind: SectionKind;\n\tinitialSectionContents?: SectionContentViewModel[];\n\tonContentChange?: (event: ContentChangeEvent) => void;\n}) => {\n\tconst [sectionContents, setSectionContents] = useState<SectionContentViewModel[]>(initialSectionContents ?? []);\n\tconst builderIoModel = builderIoModelNamesBySectionKindMap[sectionKind];\n\tconst isBuilderIoPreviewingThisModel = useIsPreviewingThisBuilderModel(builderIoModel);\n\tconst location = useLocation();\n\tconst lastRequestedLocationHref = useRef(initialSectionContents === undefined ? undefined : location.href);\n\n\tuseEffect(() => {\n\t\tconst fetchSections = async () => {\n\t\t\tconst sections = await getSections({\n\t\t\t\tkind: sectionKind,\n\t\t\t\turl: location.href,\n\t\t\t});\n\n\t\t\tsetSectionContents(sections);\n\n\t\t\tconst filteredSections = sections.filter(sc => !!sc);\n\t\t\tonContentChange?.({\n\t\t\t\thasContent: filteredSections.length > 0 || isBuilderIoPreviewingThisModel,\n\t\t\t\tcontentKey: getContentKey(filteredSections),\n\t\t\t});\n\t\t};\n\n\t\tif (!isBuilderIoPreviewingThisModel && location.href !== lastRequestedLocationHref.current) {\n\t\t\tlastRequestedLocationHref.current = location.href;\n\t\t\tfetchSections();\n\t\t}\n\t}, [sectionKind, location.href, onContentChange, isBuilderIoPreviewingThisModel, initialSectionContents]);\n\n\tuseEffect(() => {\n\t\tif (isBuilderIoPreviewingThisModel) {\n\t\t\tnotifyWarning(`You are previewing the \"${builderIoModel}\" Builder.io model.`);\n\t\t}\n\t}, [isBuilderIoPreviewingThisModel, builderIoModel]);\n\n\tif (isBuilderIoPreviewingThisModel) {\n\t\treturn (\n\t\t\t<RenderBuilderContent\n\t\t\t\tmodel={builderIoModel}\n\t\t\t\tstaticData={{\n\t\t\t\t\tstaticProductData: [],\n\t\t\t\t\tuserInfo: c_defaultUserInfo,\n\t\t\t\t}}\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst filteredContents = sectionContents.filter(sc => !!sc);\n\tconst hasContent = filteredContents.length > 0;\n\n\tif (!hasContent) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{filteredContents.map(sc =>\n\t\t\t\tsc.contentSourceKind === 'builderIo' ? <RenderBuilderContent key={sc.contentId} {...sc.builderIo} /> : null\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nexport default SectionContent;\n","import { fetch } from '../util/fetch';\nimport { SectionContentViewModel, SectionKind } from '../builder';\n\ninterface Params {\n\tkind: SectionKind;\n\turl: string;\n}\n\nexport async function getSections({ kind, url }: Params): Promise<SectionContentViewModel[]> {\n\ttry {\n\t\tconst response = await fetch.get({\n\t\t\turl: '/api/sections',\n\t\t\tparams: { kind, url },\n\t\t});\n\n\t\tconst results = await response.json();\n\t\treturn results as unknown as SectionContentViewModel[];\n\t} catch (error) {\n\t\treturn [];\n\t}\n}\n","import React, { useState, useCallback } from 'react';\n\nimport ReadMoreReadLess from '../read-more-read-less';\nimport { SectionContent } from '../content';\nimport ErrorBoundary from '../error-boundary';\nimport type { SectionContentViewModel, SectionKind } from '../../builder';\n\ninterface Props {\n\tsectionKind: SectionKind;\n\tinitialSectionContents?: SectionContentViewModel[];\n}\n\ninterface ContentChangeEvent {\n\thasContent: boolean;\n\tcontentKey: string;\n}\n\nconst CategoryContent = ({ sectionKind, initialSectionContents }: Props) => {\n\t// Merged into one state object so both values update in a single render,\n\t// avoiding separate re-renders that can cause SectionContent to remount.\n\tconst [{ hasContent, contentKey }, setContentState] = useState(() => {\n\t\tconst filteredSections = initialSectionContents?.filter(sc => !!sc) ?? [];\n\t\treturn {\n\t\t\thasContent: filteredSections.length > 0,\n\t\t\tcontentKey: filteredSections.map(sc => `${sc.sectionKind}:${sc.contentSourceKind}:${sc.contentId}`).join('|'),\n\t\t};\n\t});\n\n\tconst handleContentChange = useCallback((event: ContentChangeEvent) => {\n\t\tsetContentState(prev =>\n\t\t\tprev.hasContent === event.hasContent && prev.contentKey === event.contentKey\n\t\t\t\t? prev\n\t\t\t\t: { hasContent: event.hasContent, contentKey: event.contentKey }\n\t\t);\n\t}, []);\n\n\t// SectionContent always stays in the same tree position (inside ReadMoreReadLess).\n\t// Changing the parent conditionally would cause SectionContent to unmount/remount\n\t// and re-fire the sections AJAX on every hasContent or contentKey state change.\n\treturn (\n\t\t<ErrorBoundary>\n\t\t\t<div className={hasContent ? 'w-full' : 'hidden'}>\n\t\t\t\t<ReadMoreReadLess contentKey={contentKey}>\n\t\t\t\t\t<SectionContent\n\t\t\t\t\t\tsectionKind={sectionKind}\n\t\t\t\t\t\tinitialSectionContents={initialSectionContents}\n\t\t\t\t\t\tonContentChange={handleContentChange}\n\t\t\t\t\t/>\n\t\t\t\t</ReadMoreReadLess>\n\t\t\t</div>\n\t\t</ErrorBoundary>\n\t);\n};\n\nexport default CategoryContent;\n","import React, { createContext, useContext, useEffect, useMemo, useState } from 'react';\n\nimport { useLocation } from '../../location';\n\nexport interface UserSearchFilterOption {\n\tdisplayName: string;\n\tisDefault?: boolean;\n\talgoliaValue: string;\n\ttoken: string;\n}\n\nexport interface UserSearchFilter {\n\ttitle: string;\n\toptions: UserSearchFilterOption[];\n\ttoken: string;\n}\n\nexport interface UserSearchFilters {\n\tfilters: UserSearchFilter[];\n}\n\ninterface UserSearchFilterContextValue {\n\tselectedFilterOptions: Record<string, string>;\n\tsetSelectedFilterOption: (filterToken: string, optionToken: string) => void;\n\tuserSearchFilters: UserSearchFilter[];\n}\n\nconst UserSearchFilterContext = createContext<UserSearchFilterContextValue | null>(null);\n\nfunction getDefaultSelectedFilterOptions(userSearchFilters: UserSearchFilter[]) {\n\treturn userSearchFilters.reduce<Record<string, string>>((selectedOptions, filter) => {\n\t\tconst options = Array.isArray(filter?.options) ? filter.options : [];\n\t\tconst selectedOption = options.find(option => option?.isDefault) ?? options[0];\n\n\t\tif (selectedOption?.token) {\n\t\t\tselectedOptions[filter.token] = selectedOption.token;\n\t\t}\n\n\t\treturn selectedOptions;\n\t}, {});\n}\n\nfunction areSelectedFilterOptionsEqual(first: Record<string, string>, second: Record<string, string>): boolean {\n\tconst firstKeys = Object.keys(first);\n\tconst secondKeys = Object.keys(second);\n\n\treturn firstKeys.length === secondKeys.length && firstKeys.every(key => first[key] === second[key]);\n}\n\nfunction readUserFilterSelectionsFromUrl(\n\tuserSearchFilters: UserSearchFilter[],\n\tsearchParams: URLSearchParams\n): Record<string, string> {\n\tconst defaults = getDefaultSelectedFilterOptions(userSearchFilters);\n\n\treturn userSearchFilters.reduce<Record<string, string>>((selectedOptions, filter) => {\n\t\tconst options = Array.isArray(filter?.options) ? filter.options : [];\n\t\tconst urlValue = searchParams.get(filter.token);\n\t\tconst matchingOption = urlValue ? options.find(option => option?.token === urlValue) : undefined;\n\n\t\tconst resolved = matchingOption?.token ?? defaults[filter.token];\n\t\tif (resolved) {\n\t\t\tselectedOptions[filter.token] = resolved;\n\t\t}\n\n\t\treturn selectedOptions;\n\t}, {});\n}\n\nfunction writeUserFilterSelectionsToUrl(\n\tselectedFilterOptions: Record<string, string>,\n\tuserSearchFilters: UserSearchFilter[],\n\tsearch: string,\n\tpathname: string,\n\treplaceUrl: (url: string) => void\n) {\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(`https://placeholder${pathname}${search}`);\n\t} catch {\n\t\t// Malformed pathname/search — skip URL update rather than crash.\n\t\treturn;\n\t}\n\n\tfor (const filter of userSearchFilters) {\n\t\tconst selectedToken = selectedFilterOptions[filter.token];\n\n\t\tif (selectedToken) {\n\t\t\turl.searchParams.set(filter.token, selectedToken);\n\t\t} else {\n\t\t\turl.searchParams.delete(filter.token);\n\t\t}\n\t}\n\n\ttry {\n\t\treplaceUrl(`${url.pathname}${url.search}`);\n\t} catch {\n\t\t// History replacement can fail in some browsers / iframes.\n\t}\n}\n\nexport function useUserSearchFilterContext() {\n\tconst context = useContext(UserSearchFilterContext);\n\tif (!context) {\n\t\tthrow new Error('useUserSearchFilterContext must be used within UserSearchFilterProvider');\n\t}\n\treturn context;\n}\n\nexport function UserSearchFilterProvider({\n\tuserSearchFilters,\n\tinitialSelectedFilterOptions,\n\tsetSelectedFilterOptionsOverride,\n\tchildren,\n}: {\n\tuserSearchFilters: UserSearchFilter[];\n\tinitialSelectedFilterOptions?: Record<string, string>;\n\tsetSelectedFilterOptionsOverride?: () => Record<string, string>;\n\tchildren: React.ReactNode;\n}) {\n\tconst { search, pathname, replaceUrl } = useLocation();\n\tconst searchParams = useMemo(() => new URLSearchParams(search), [search]);\n\n\tconst [selectedFilterOptions, setSelectedFilterOptions] = useState<Record<string, string>>(() => {\n\t\tconst urlSelections = readUserFilterSelectionsFromUrl(userSearchFilters, searchParams);\n\n\t\treturn userSearchFilters.reduce<Record<string, string>>((selectedOptions, filter) => {\n\t\t\tconst initialSelection = initialSelectedFilterOptions?.[filter.token];\n\t\t\tconst isInitialSelectionValid = filter.options.some(option => option.token === initialSelection);\n\t\t\tconst selectedOption = isInitialSelectionValid ? initialSelection : urlSelections[filter.token];\n\n\t\t\tif (selectedOption) {\n\t\t\t\tselectedOptions[filter.token] = selectedOption;\n\t\t\t}\n\n\t\t\treturn selectedOptions;\n\t\t}, {});\n\t});\n\n\tuseEffect(() => {\n\t\tsetSelectedFilterOptions(prev => {\n\t\t\tlet next: Record<string, string>;\n\n\t\t\tif (setSelectedFilterOptionsOverride) {\n\t\t\t\tnext = setSelectedFilterOptionsOverride();\n\t\t\t} else {\n\t\t\t\tconst urlSelections = readUserFilterSelectionsFromUrl(userSearchFilters, searchParams);\n\n\t\t\t\t// Only reset if userSearchFilters changed (not a URL-driven update).\n\t\t\t\t// Preserve current selection if the option is still valid for the new filter set.\n\t\t\t\tnext = userSearchFilters.reduce<Record<string, string>>((selectedOptions, filter) => {\n\t\t\t\t\tconst currentSelection = prev[filter.token];\n\t\t\t\t\tconst isStillValid = filter.options.some(option => option.token === currentSelection);\n\t\t\t\t\tconst selectedOption = isStillValid ? currentSelection : urlSelections[filter.token];\n\n\t\t\t\t\tif (selectedOption) {\n\t\t\t\t\t\tselectedOptions[filter.token] = selectedOption;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn selectedOptions;\n\t\t\t\t}, {});\n\t\t\t}\n\n\t\t\treturn areSelectedFilterOptionsEqual(prev, next) ? prev : next;\n\t\t});\n\t}, [setSelectedFilterOptionsOverride, userSearchFilters, searchParams]);\n\n\tuseEffect(() => {\n\t\twriteUserFilterSelectionsToUrl(selectedFilterOptions, userSearchFilters, search, pathname, replaceUrl);\n\t}, [selectedFilterOptions, userSearchFilters, search, pathname, replaceUrl]);\n\n\tconst handleSetSelectedFilterOption = (filterToken: string, optionToken: string) => {\n\t\tsetSelectedFilterOptions(prev => ({\n\t\t\t...prev,\n\t\t\t[filterToken]: optionToken,\n\t\t}));\n\t};\n\n\tconst contextValue = useMemo(\n\t\t() => ({\n\t\t\tselectedFilterOptions,\n\t\t\tsetSelectedFilterOption: handleSetSelectedFilterOption,\n\t\t\tuserSearchFilters,\n\t\t}),\n\t\t[selectedFilterOptions, userSearchFilters]\n\t);\n\n\treturn <UserSearchFilterContext.Provider value={contextValue}>{children}</UserSearchFilterContext.Provider>;\n}\n","import * as React from 'react';\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { ChevronDown } from 'lucide-react';\n\nimport { cn } from '../../util/cn';\n\nconst Accordion = AccordionPrimitive.Root;\n\nconst AccordionItem = React.forwardRef<\n\tReact.ComponentRef<typeof AccordionPrimitive.Item>,\n\tReact.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(({ className, ...props }, ref) => <AccordionPrimitive.Item className={cn('', className)} ref={ref} {...props} />);\n\nAccordionItem.displayName = AccordionPrimitive.Item.displayName;\n\nconst AccordionTrigger = React.forwardRef<\n\tReact.ComponentRef<typeof AccordionPrimitive.Trigger>,\n\tReact.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n\t<AccordionPrimitive.Header className=\"flex\">\n\t\t<AccordionPrimitive.Trigger\n\t\t\tclassName={cn(\n\t\t\t\t'flex flex-1 items-center justify-between py-[9.5px] text-lg font-bold outline-hidden transition-all hover:text-secondary focus-visible:text-secondary [&[data-state=open]>svg]:rotate-180',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t{/* TODO: For the sake of moving fast we are leaving this in, but in the future we need to figure out how enable custom icons */}\n\t\t\t<ChevronDown className=\"h-6 w-6 shrink-0 transition-transform duration-200\" />\n\t\t</AccordionPrimitive.Trigger>\n\t</AccordionPrimitive.Header>\n));\n\nAccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;\n\nconst AccordionContent = React.forwardRef<\n\tReact.ComponentRef<typeof AccordionPrimitive.Content>,\n\tReact.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n\t<AccordionPrimitive.Content\n\t\tclassName={cn(\n\t\t\t'data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down mb-4 overflow-hidden transition-all',\n\t\t\tclassName\n\t\t)}\n\t\tref={ref}\n\t\t{...props}\n\t>\n\t\t{children}\n\t</AccordionPrimitive.Content>\n));\n\nAccordionContent.displayName = AccordionPrimitive.Content.displayName;\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent };\n","import { createContext, useContext } from 'react';\n\nexport const SearchResourcesContext = createContext<Record<string, string>>({});\n\nexport function useSearchResources(): Record<string, string> {\n\treturn useContext(SearchResourcesContext);\n}\n","import type { Cache, CacheEvents } from '@algolia/client-common';\n\n// Algolia's default `createMemoryCache` never evicts, so a long filtering session retains every\n// distinct search indefinitely. That is costly here because ownership-filtered searches carry a\n// `filters` string listing every owned productId, and it is stored twice: once as the cache key and\n// again inside the response, which echoes the request params back. Measured against a 20k-product\n// library, each cached search retained ~2.1MB (~1.0MB key, ~1.1MB value) against a ~0.15MB baseline,\n// and 14 cached searches held 26.6MB.\n//\n// Because entry size scales with the size of the user's library, the budget is in characters rather\n// than entries. This cache otherwise keeps `createMemoryCache`'s exact semantics -- same\n// `JSON.stringify` key, same serialized value, same miss handling -- and only adds eviction, so an\n// evicted entry behaves precisely like the cache miss that would have happened before it was ever\n// cached.\n\nconst defaultMaxCharacters = 8 * 1024 * 1024;\n\nfunction serializeKey(key: Record<string, any> | string): string {\n\treturn JSON.stringify(key);\n}\n\nexport function createBoundedResponsesCache(maxCharacters: number = defaultMaxCharacters): Cache {\n\tconst cache = new Map<string, string>();\n\tlet characters = 0;\n\n\tfunction evict() {\n\t\t// Always keep the most recently written entry, so a single oversized response still caches.\n\t\twhile (characters > maxCharacters && cache.size > 1) {\n\t\t\tconst oldestKey = cache.keys().next().value;\n\t\t\tif (oldestKey === undefined) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcharacters -= oldestKey.length + (cache.get(oldestKey)?.length ?? 0);\n\t\t\tcache.delete(oldestKey);\n\t\t}\n\t}\n\n\treturn {\n\t\tget<TValue>(\n\t\t\tkey: Record<string, any> | string,\n\t\t\tdefaultValue: () => Promise<TValue>,\n\t\t\tevents: CacheEvents<TValue> = { miss: () => Promise.resolve() }\n\t\t): Promise<TValue> {\n\t\t\tconst serializedKey = serializeKey(key);\n\t\t\tconst cached = cache.get(serializedKey);\n\n\t\t\tif (cached !== undefined) {\n\t\t\t\tcache.delete(serializedKey);\n\t\t\t\tcache.set(serializedKey, cached);\n\n\t\t\t\treturn Promise.resolve(JSON.parse(cached) as TValue);\n\t\t\t}\n\n\t\t\tconst promise = defaultValue();\n\n\t\t\treturn promise.then(value => events.miss(value)).then(() => promise);\n\t\t},\n\n\t\tset<TValue>(key: Record<string, any> | string, value: TValue): Promise<TValue> {\n\t\t\tconst serializedKey = serializeKey(key);\n\t\t\tconst serializedValue = JSON.stringify(value);\n\n\t\t\tconst existing = cache.get(serializedKey);\n\t\t\tif (existing !== undefined) {\n\t\t\t\tcharacters -= serializedKey.length + existing.length;\n\t\t\t\tcache.delete(serializedKey);\n\t\t\t}\n\n\t\t\tcache.set(serializedKey, serializedValue);\n\t\t\tcharacters += serializedKey.length + serializedValue.length;\n\t\t\tevict();\n\n\t\t\treturn Promise.resolve(value);\n\t\t},\n\n\t\tdelete(key: Record<string, any> | string): Promise<void> {\n\t\t\tconst serializedKey = serializeKey(key);\n\t\t\tconst existing = cache.get(serializedKey);\n\t\t\tif (existing !== undefined) {\n\t\t\t\tcharacters -= serializedKey.length + existing.length;\n\t\t\t\tcache.delete(serializedKey);\n\t\t\t}\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\n\t\tclear(): Promise<void> {\n\t\t\tcache.clear();\n\t\t\tcharacters = 0;\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t};\n}\n","import React, { createContext, useContext, useEffect, useMemo } from 'react';\nimport { algoliasearch } from 'algoliasearch';\nimport insightsClient from 'search-insights';\nimport { createBoundedResponsesCache } from './bounded-responses-cache';\n\n// ---------------------------------------------------------------------------\n// Algolia search context — provides the configured Algolia client\n// ---------------------------------------------------------------------------\n\ninterface AlgoliaSearchContextValue {\n\tclient: ReturnType<typeof algoliasearch>;\n\tindexName: string;\n\tstorefrontShortname: string;\n\tuserId: string | null;\n}\n\nconst AlgoliaSearchContext = createContext<AlgoliaSearchContextValue | null>(null);\n\ninterface AlgoliaSearchContextProviderProps {\n\tappId: string;\n\tappKey: string;\n\tindexName: string;\n\tstorefrontShortname: string;\n\tuserId?: string | null;\n\tchildren: React.ReactNode;\n}\n\nexport function AlgoliaSearchContextProvider({\n\tappId,\n\tappKey,\n\tindexName,\n\tstorefrontShortname,\n\tuserId = null,\n\tchildren,\n}: AlgoliaSearchContextProviderProps) {\n\tconst client = useMemo(\n\t\t() => algoliasearch(appId, appKey, { responsesCache: createBoundedResponsesCache() }),\n\t\t[appId, appKey]\n\t);\n\n\tuseEffect(() => {\n\t\tinsightsClient('init', { appId, apiKey: appKey });\n\t\tif (userId) {\n\t\t\tinsightsClient('setAuthenticatedUserToken', userId);\n\t\t}\n\t}, [appId, appKey, userId]);\n\n\tconst value = useMemo(\n\t\t() => ({ client, indexName, storefrontShortname, userId }),\n\t\t[client, indexName, storefrontShortname, userId]\n\t);\n\n\treturn <AlgoliaSearchContext.Provider value={value}>{children}</AlgoliaSearchContext.Provider>;\n}\n\nexport function useAlgoliaSearch(): AlgoliaSearchContextValue {\n\tconst context = useContext(AlgoliaSearchContext);\n\n\tif (!context) {\n\t\tthrow new Error('useAlgoliaSearch must be used within an AlgoliaSearchContextProvider');\n\t}\n\n\treturn context;\n}\n","import type { ProductPriceAmount } from '../per-user-data/per-user-data-context';\n\ninterface SavingsPrices {\n\tsalePrice?: Pick<ProductPriceAmount, 'amount'> | null;\n\tanchorPrice?: Pick<ProductPriceAmount, 'amount'> | null;\n}\n\n/**\n * Transliterates Unicode characters to their closest ASCII equivalents.\n * Approximates the behavior of the .NET Unidecode library used by SlugHelper on the server.\n */\nfunction unidecode(text: string): string {\n\t// Handle characters that don't decompose via NFD but have ASCII equivalents.\n\t// Order matters: apply multi-char replacements before NFD strips combining marks.\n\tconst result = text\n\t\t.replace(/ß/g, 'ss')\n\t\t.replace(/[æÆ]/g, 'ae')\n\t\t.replace(/[œŒ]/g, 'oe')\n\t\t.replace(/[øØ]/g, 'o')\n\t\t.replace(/[ðÐ]/g, 'd')\n\t\t.replace(/[þÞ]/g, 'th')\n\t\t.replace(/[łŁ]/g, 'l');\n\n\t// Strip combining diacritical marks from remaining Latin characters via NFD normalization.\n\treturn result.normalize('NFD').replace(/\\p{Mn}/gu, '');\n}\n\n/**\n * Converts a string to a URL-friendly slug.\n * Matches the server-side SlugHelper.Slugify method used to generate product URL slugs.\n */\nexport function slugify(value: string | undefined): string {\n\tif (!value) {\n\t\treturn '';\n\t}\n\n\t// Remove trademark/registered symbols\n\tlet input = value.replace(/®/g, '').replace(/™/g, '');\n\n\t// Transliterate Unicode → ASCII, then lowercase (matches .Unidecode().ToLowerInvariant())\n\tinput = unidecode(input).toLowerCase();\n\n\t// Remove trailing parenthetical and bracket blocks, e.g. \"Title (Subtitle) [Edition]\"\n\t// Matches s_parenBlocks = new Regex(\"(\\\\(.*\\\\))?(\\\\s*\\\\[.*\\\\])*$\")\n\tinput = input.replace(/(\\(.*\\))?(\\s*\\[.*\\])*$/g, '');\n\n\t// Strip HTML tags — matches s_htmlTags = new Regex(\"</?[^>]+>\")\n\tinput = input.replace(/<\\/?[^>]+>/g, '');\n\n\t// Expand ampersand\n\tinput = input.replace(/ & /g, ' and ');\n\n\t// Convert separating punctuation to spaces — matches s_punctuationForSpace = new Regex(\"[/\\\\-:_]\")\n\tinput = input.replace(/[/\\-:_]/g, ' ');\n\n\t// Remove all remaining non-alphanumeric, non-space characters — matches s_punctuationAndNonAlpha = new Regex(\"[^a-z0-9 ]\")\n\tinput = input.replace(/[^a-z0-9 ]/g, '');\n\n\t// Collapse whitespace runs to hyphens — matches s_excessWhitespace = new Regex(\"\\\\s+\")\n\treturn input.trim().replace(/\\s+/g, '-');\n}\n\nexport function getSavingsPercent(prices: SavingsPrices | null | undefined): number {\n\tconst anchor = prices?.anchorPrice?.amount;\n\tconst sale = prices?.salePrice?.amount;\n\tif (!anchor || !sale) {\n\t\treturn 0;\n\t}\n\tif (anchor <= 0) {\n\t\treturn 0;\n\t}\n\treturn ((anchor - sale) / anchor) * 100;\n}\n\n/**\n * Splits an author/publisher facet value of the form \"id:displayName\" into its parts.\n * Uses the first colon as the separator so display names that themselves contain colons\n * are preserved. When no colon is present, the whole value is treated as both id and name.\n */\nexport function parseFacetValue(value: string): { id: string; displayName: string } {\n\tconst separatorIndex = value.indexOf(':');\n\tif (separatorIndex === -1) {\n\t\treturn { id: value, displayName: value };\n\t}\n\treturn {\n\t\tid: value.substring(0, separatorIndex),\n\t\tdisplayName: value.substring(separatorIndex + 1),\n\t};\n}\n\nexport function safeUrl(input: string, base?: string): URL | null {\n\ttry {\n\t\treturn new URL(input, base);\n\t} catch {\n\t\treturn null;\n\t}\n}\n","import React, { useEffect, useRef, useState } from 'react';\nimport insightsClient from 'search-insights';\nimport { LinkButton, Typography } from '@faithlife/commerce-components';\nimport {\n\tRefinementListItem,\n\tRefinementListRenderState,\n} from 'instantsearch.js/es/connectors/refinement-list/connectRefinementList';\nimport { useRefinementList } from 'react-instantsearch';\nimport { cn } from '../../util/cn';\n\nimport { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '../accordion';\nimport { useSearchResources } from './search-resources';\nimport { UserSearchFilter, UserSearchFilterOption, useUserSearchFilterContext } from './user-search-filter-context';\nimport { useAlgoliaSearch } from './algolia-search-context';\nimport { parseFacetValue } from './util';\n\nfunction Check({ className, checked }: { className?: string; checked: boolean }) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={cn('inline', className)}\n\t\t\tfill=\"none\"\n\t\t\theight=\"14\"\n\t\t\tviewBox=\"0 0 13 14\"\n\t\t\twidth=\"13\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<rect\n\t\t\t\tfill={checked ? '#1E6AFE' : 'white'}\n\t\t\t\theight=\"13\"\n\t\t\t\trx=\"1\"\n\t\t\t\tstroke={checked ? undefined : '#C7C7C7'}\n\t\t\t\twidth=\"13\"\n\t\t\t\ty=\"0.5\"\n\t\t\t/>\n\t\t\t<path d=\"M3.28223 7.73706L5.2634 9.71824L9.71857 5.26308\" stroke=\"white\" strokeLinecap=\"round\" />\n\t\t</svg>\n\t);\n}\n\nconst c_statusLabelKeys: Record<string, string> = {\n\t'status > live': 'liveStatusText',\n\t'status > prepub': 'prepubStatusText',\n\t'status > prepub > gatheringinterest': 'gatheringInterestStatusText',\n\t'status > prepub > undercontract': 'underContractStatusText',\n\t'status > prepub > gatheringinterest > almostfunded': 'almostFundedStatusText',\n\t'status > prepub > undercontract > shippingsoon': 'shippingSoonStatusText',\n};\n\nfunction ShowMoreToggle({\n\tshowMore,\n\tattribute,\n\tsetShowMore,\n}: {\n\tshowMore: string | undefined;\n\tattribute: string;\n\tsetShowMore: (showMore: string | undefined) => void;\n}) {\n\tconst resources = useSearchResources();\n\tconst isShowingMore = showMore === attribute;\n\n\treturn (\n\t\t<LinkButton as=\"button\" onClick={() => setShowMore(isShowingMore ? undefined : attribute)} scale=\"sm\">\n\t\t\t{isShowingMore ? resources['showLess'] : resources['showMore']}\n\t\t</LinkButton>\n\t);\n}\n\nfunction countDepth(value: string) {\n\tlet index = value.indexOf('>');\n\tlet depth = 0;\n\n\twhile (index !== -1) {\n\t\tindex = value.indexOf('>', index + 1);\n\t\tdepth += 1;\n\t}\n\n\treturn depth;\n}\n\nexport interface RefinementItem {\n\trefinement: RefinementListRenderState;\n\titem: RefinementListItem;\n}\n\nfunction hasChildren(items: RefinementItem[], { item: parent }: RefinementItem) {\n\treturn items.some(({ item }) => parent !== item && item.value.startsWith(parent.value));\n}\n\nfunction getChildren(items: RefinementItem[], parent: RefinementItem) {\n\tconst depth = countDepth(parent.item.value);\n\n\treturn items.filter(({ item }) => countDepth(item.value) === depth + 1 && item.value.startsWith(parent.item.value));\n}\n\nexport function getAccordions(category: string, items: RefinementItem[]) {\n\tconst root = {\n\t\tkey: category,\n\t\tlabel: category,\n\t\titems: items.filter(({ item }) => countDepth(item.value) === 0),\n\t};\n\n\tconst subCategories = items\n\t\t.filter(({ item }) => item.isRefined)\n\t\t.filter(parent => hasChildren(items, parent))\n\t\t.map(c => ({\n\t\t\tkey: c.item.value,\n\t\t\tlabel: c.item.label.replace(/^((.*) > )*/, ''),\n\t\t\titems: getChildren(items, c),\n\t\t}));\n\n\treturn [root, ...subCategories];\n}\n\nfunction useRefinementLists(category: string, levels?: number) {\n\t// not neccessary, but let's avoid shooting ourselves in the foot, shall we?\n\tconst levelsRef = useRef(levels);\n\tconst items: RefinementItem[] = [];\n\n\tif (levelsRef.current !== undefined) {\n\t\tfor (let level = 0; level <= levelsRef.current; level += 1) {\n\t\t\tconst attribute = `${category}.lvl${level}`;\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tconst refinement = useRefinementList({ attribute, limit: 1000 }, { skipSuspense: level < levelsRef.current - 1 });\n\n\t\t\titems.push(...refinement.items.map(item => ({ item, refinement })));\n\t\t}\n\t} else {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst refinement = useRefinementList({ attribute: category, limit: 1000 });\n\n\t\titems.push(...refinement.items.map(item => ({ item, refinement })));\n\t}\n\n\treturn items;\n}\n\nfunction Category({\n\tcategory,\n\tsetExpandedFacets,\n\tsetShowMore,\n\tshowMore,\n\tmaxLevel,\n}: {\n\tcategory: string;\n\tsetExpandedFacets: (setState: (expandedFacets: string[]) => string[]) => void;\n\tsetShowMore: (showMore: string | undefined) => void;\n\tshowMore: string | undefined;\n\tmaxLevel?: number;\n}) {\n\tconst resources = useSearchResources();\n\tconst { indexName } = useAlgoliaSearch();\n\tconst items = useRefinementLists(category, maxLevel);\n\n\tif (!items?.length) {\n\t\treturn null;\n\t}\n\n\tconst accordions = getAccordions(category, items);\n\n\treturn accordions.map(accordion => (\n\t\t<AccordionItem key={accordion.key} value={accordion.key}>\n\t\t\t<AccordionTrigger className=\"border-t border-primary-100 p-4 lg:border-t-0 [&>svg]:text-primary\">\n\t\t\t\t<Typography className=\"text-primary-400\" variant=\"bodyRegular\" tag=\"div\">\n\t\t\t\t\t{resources[accordion.label] ?? accordion.label}\n\t\t\t\t</Typography>\n\t\t\t</AccordionTrigger>\n\t\t\t<AccordionContent className=\"m-0 bg-grey-200 p-4\">\n\t\t\t\t<div className=\"flex flex-col gap-y-4\">\n\t\t\t\t\t{(showMore === accordion.key ? accordion.items : accordion.items.slice(0, 7)).map(({ item, refinement }) => (\n\t\t\t\t\t\t<div key={item.value}>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'text-black-200 hover:text-secondary-200': !item.isRefined,\n\t\t\t\t\t\t\t\t\t\t'text-primary': item.isRefined,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t'bodySm w-full text-left capitalize'\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\trefinement.refine(item.value);\n\n\t\t\t\t\t\t\t\t\tinsightsClient('clickedFilters', {\n\t\t\t\t\t\t\t\t\t\tindex: indexName,\n\t\t\t\t\t\t\t\t\t\teventName: 'Clicked filter',\n\t\t\t\t\t\t\t\t\t\tfilters: [`${category}:${item.value}`],\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\tif (!item.isRefined) {\n\t\t\t\t\t\t\t\t\t\tsetExpandedFacets(old => [...old, item.value]);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\titems\n\t\t\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t\t\t({ item: child }) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\tchild.isRefined && child.value !== item.value && child.value.startsWith(item.value)\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t.forEach(({ item: child, refinement: childRefinement }) => {\n\t\t\t\t\t\t\t\t\t\t\t\tchildRefinement.refine(child.value);\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tsetExpandedFacets(old => old.filter(v => !v.startsWith(item.value)));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Check checked={item.isRefined} className=\"mr-3\" />\n\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t{`${\n\t\t\t\t\t\t\t\t\t\titem.label.lastIndexOf('>') === -1\n\t\t\t\t\t\t\t\t\t\t\t? item.label\n\t\t\t\t\t\t\t\t\t\t\t: item.label.substring(item.label.lastIndexOf('>') + 2)\n\t\t\t\t\t\t\t\t\t} `}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<span className=\"text-black-100\">\n\t\t\t\t\t\t\t\t\t{'('}\n\t\t\t\t\t\t\t\t\t{item.count}\n\t\t\t\t\t\t\t\t\t{')'}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t\t{accordion.items.length > 7 && (\n\t\t\t\t\t\t<ShowMoreToggle attribute={accordion.key} setShowMore={setShowMore} showMore={showMore} />\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</AccordionContent>\n\t\t</AccordionItem>\n\t));\n}\n\nfunction AuthorFacetItem({\n\tid,\n\tdisplayName,\n\tcount,\n\tisRefined,\n\tonRefine,\n}: {\n\tid: string;\n\tdisplayName: string;\n\tcount: number;\n\tisRefined: boolean;\n\tonRefine: (id: string) => void;\n}) {\n\treturn (\n\t\t<div>\n\t\t\t<button\n\t\t\t\tclassName={cn(\n\t\t\t\t\t{\n\t\t\t\t\t\t'text-black-200 hover:text-secondary-200': !isRefined,\n\t\t\t\t\t\t'text-primary': isRefined,\n\t\t\t\t\t},\n\t\t\t\t\t'bodySm w-full text-left capitalize'\n\t\t\t\t)}\n\t\t\t\tonClick={() => onRefine(id)}\n\t\t\t>\n\t\t\t\t{displayName}{' '}\n\t\t\t\t<span className=\"text-black-100\">\n\t\t\t\t\t{'('}\n\t\t\t\t\t{count}\n\t\t\t\t\t{')'}\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t);\n}\n\nfunction PublisherFacetItem({\n\tid,\n\tdisplayName,\n\tcount,\n\tisRefined,\n\tonRefine,\n}: {\n\tid: string;\n\tdisplayName: string;\n\tcount: number;\n\tisRefined: boolean;\n\tonRefine: (id: string) => void;\n}) {\n\treturn (\n\t\t<div>\n\t\t\t<button\n\t\t\t\tclassName={cn(\n\t\t\t\t\t{\n\t\t\t\t\t\t'text-black-200 hover:text-secondary-200': !isRefined,\n\t\t\t\t\t\t'text-primary': isRefined,\n\t\t\t\t\t},\n\t\t\t\t\t'bodySm w-full text-left capitalize'\n\t\t\t\t)}\n\t\t\t\tonClick={() => onRefine(id)}\n\t\t\t>\n\t\t\t\t{displayName}{' '}\n\t\t\t\t<span className=\"text-black-100\">\n\t\t\t\t\t{'('}\n\t\t\t\t\t{count}\n\t\t\t\t\t{')'}\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t);\n}\n\nfunction AuthorsOrPublishers({\n\tattribute,\n\tnameAttribute,\n\tsetShowMore,\n\tshowMore,\n}: {\n\tattribute: 'authorIds' | 'publisherIds';\n\tnameAttribute: 'authorFacets' | 'publisherFacets';\n\tshowMore: string | undefined;\n\tsetShowMore: (showMore: string | undefined) => void;\n}) {\n\tconst resources = useSearchResources();\n\tconst { indexName } = useAlgoliaSearch();\n\n\tconst { isShowingMore, items, canToggleShowMore, toggleShowMore } = useRefinementList({\n\t\tattribute: nameAttribute,\n\t\tlimit: 7,\n\t\tshowMore: true,\n\t});\n\tconst { items: idItems, refine } = useRefinementList({\n\t\tattribute,\n\t});\n\n\tuseEffect(() => {\n\t\tif ((showMore === attribute) !== isShowingMore) {\n\t\t\ttoggleShowMore();\n\t\t}\n\t}, [attribute, isShowingMore, showMore, toggleShowMore]);\n\n\tconst FacetItem = attribute === 'authorIds' ? AuthorFacetItem : PublisherFacetItem;\n\n\tconst facetItems = items.map(item => {\n\t\tconst { id, displayName } = parseFacetValue(item.value);\n\t\treturn {\n\t\t\tid,\n\t\t\tdisplayName,\n\t\t\tcount: item.count,\n\t\t\tisRefined: idItems.some(idItem => idItem.value === id && idItem.isRefined),\n\t\t};\n\t});\n\n\tfacetItems.sort((a, b) => {\n\t\tif (a.isRefined && !b.isRefined) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tif (!a.isRefined && b.isRefined) {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn b.count - a.count;\n\t});\n\n\treturn (\n\t\t<AccordionItem value={attribute}>\n\t\t\t<AccordionTrigger className=\"border-t border-primary-100 p-4 lg:border-t-0 [&>svg]:text-primary\">\n\t\t\t\t<Typography className=\"text-primary-400\" variant=\"bodyRegular\" tag=\"div\">\n\t\t\t\t\t{resources[attribute] ?? attribute}\n\t\t\t\t</Typography>\n\t\t\t</AccordionTrigger>\n\t\t\t<AccordionContent className=\"m-0 bg-grey-200 p-4\">\n\t\t\t\t<div className=\"flex flex-col gap-y-4\">\n\t\t\t\t\t{facetItems.map(i => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<FacetItem\n\t\t\t\t\t\t\t\tkey={i.id}\n\t\t\t\t\t\t\t\t{...i}\n\t\t\t\t\t\t\t\tonRefine={id => {\n\t\t\t\t\t\t\t\t\trefine(id);\n\t\t\t\t\t\t\t\t\tinsightsClient('clickedFilters', {\n\t\t\t\t\t\t\t\t\t\tindex: indexName,\n\t\t\t\t\t\t\t\t\t\teventName: 'Clicked filter',\n\t\t\t\t\t\t\t\t\t\tfilters: [`${attribute}:${id}`],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t})}\n\t\t\t\t\t{canToggleShowMore && <ShowMoreToggle attribute={attribute} setShowMore={setShowMore} showMore={showMore} />}\n\t\t\t\t</div>\n\t\t\t</AccordionContent>\n\t\t</AccordionItem>\n\t);\n}\n\nfunction Statuses({\n\tsetExpandedFacets,\n}: {\n\tsetExpandedFacets: (setState: (expandedFacets: string[]) => string[]) => void;\n}) {\n\tconst resources = useSearchResources();\n\tconst { indexName } = useAlgoliaSearch();\n\tconst level1 = useRefinementList({ attribute: 'categories.lvl1', limit: 100 }, { skipSuspense: true });\n\tconst level2 = useRefinementList({ attribute: 'categories.lvl2', limit: 1000 }, { skipSuspense: true });\n\tconst level3 = useRefinementList({ attribute: 'categories.lvl3', limit: 1000 }, { skipSuspense: true });\n\tconst level4 = useRefinementList({ attribute: 'categories.lvl4', limit: 1000 }, { skipSuspense: true });\n\n\tconst sections: {\n\t\tvalue: string;\n\t\trefinement: RefinementListRenderState;\n\t\titems: RefinementListItem[];\n\t}[] = [\n\t\t{\n\t\t\tvalue: 'status',\n\t\t\trefinement: level1,\n\t\t\titems: level1.items.filter(i => i.value.startsWith('status')),\n\t\t},\n\t\t...level1.items\n\t\t\t.filter(i => i.isRefined && i.value.startsWith('status'))\n\t\t\t.map(status => ({\n\t\t\t\tvalue: status.value,\n\t\t\t\trefinement: level2,\n\t\t\t\titems: level2.items.filter(i => i.value.startsWith(status.value)),\n\t\t\t})),\n\t\t...level2.items\n\t\t\t.filter(i => i.isRefined && i.value.startsWith('status'))\n\t\t\t.map(status => ({\n\t\t\t\tvalue: status.value,\n\t\t\t\trefinement: level3,\n\t\t\t\titems: level3.items.filter(i => i.value.startsWith(status.value)),\n\t\t\t})),\n\t\t...level3.items\n\t\t\t.filter(i => i.isRefined && i.value.startsWith('status'))\n\t\t\t.map(status => ({\n\t\t\t\tvalue: status.value,\n\t\t\t\trefinement: level4,\n\t\t\t\titems: level4.items.filter(i => i.value.startsWith(status.value)),\n\t\t\t})),\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t{sections.map(({ value, refinement, items }) =>\n\t\t\t\titems.length ? (\n\t\t\t\t\t<AccordionItem key={value} value={value}>\n\t\t\t\t\t\t<AccordionTrigger className=\"border-t border-primary-100 p-4 lg:border-t-0 [&>svg]:text-primary\">\n\t\t\t\t\t\t\t<Typography className=\"text-primary-400\" variant=\"bodyRegular\" tag=\"div\">\n\t\t\t\t\t\t\t\t{resources[c_statusLabelKeys[value] ?? value] ?? value}\n\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t</AccordionTrigger>\n\t\t\t\t\t\t<AccordionContent className=\"m-0 bg-grey-200 p-4\">\n\t\t\t\t\t\t\t<div className=\"flex flex-col gap-y-4\">\n\t\t\t\t\t\t\t\t{items.map(item => (\n\t\t\t\t\t\t\t\t\t<div key={item.value}>\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'text-black-200 hover:text-secondary-200': !item.isRefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t'text-primary': item.isRefined,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t'bodySm w-full text-left capitalize'\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\t\trefinement.refine(item.value);\n\n\t\t\t\t\t\t\t\t\t\t\t\tinsightsClient('clickedFilters', {\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex: indexName,\n\t\t\t\t\t\t\t\t\t\t\t\t\teventName: 'Clicked filter',\n\t\t\t\t\t\t\t\t\t\t\t\t\tfilters: [`categories:${item.value}`],\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t\t\t\tif (!item.isRefined) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetExpandedFacets(old => [...old, item.value]);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{resources[c_statusLabelKeys[item.value] ?? item.value] ?? item.value}{' '}\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"text-black-100\">\n\t\t\t\t\t\t\t\t\t\t\t\t{'('}\n\t\t\t\t\t\t\t\t\t\t\t\t{item.count}\n\t\t\t\t\t\t\t\t\t\t\t\t{')'}\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</AccordionContent>\n\t\t\t\t\t</AccordionItem>\n\t\t\t\t) : null\n\t\t\t)}\n\t\t</>\n\t);\n}\n\nexport function UserSearchFilterAccordionItem({ filter }: { filter: UserSearchFilter }) {\n\tconst { selectedFilterOptions, setSelectedFilterOption } = useUserSearchFilterContext();\n\tconst selectedFilterOption = selectedFilterOptions[filter.token];\n\tconst title = filter.title;\n\tconst options = (Array.isArray(filter.options) ? filter.options : []).filter(\n\t\t(option: { displayName: string }) => option && option.displayName !== ''\n\t);\n\n\tif (!title || options.length === 0) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<AccordionItem value={`user-filter-${title}`}>\n\t\t\t<AccordionTrigger className=\"border-t border-primary-100 p-4 lg:border-t-0 [&>svg]:text-primary\">\n\t\t\t\t<Typography className=\"text-primary-400\" variant=\"bodyRegular\" tag=\"div\">\n\t\t\t\t\t{title}\n\t\t\t\t</Typography>\n\t\t\t</AccordionTrigger>\n\t\t\t<AccordionContent className=\"m-0 bg-grey-200 p-4\">\n\t\t\t\t<div className=\"flex flex-col gap-y-4\">\n\t\t\t\t\t{options.map((option: UserSearchFilterOption) => {\n\t\t\t\t\t\tconst label = option.displayName;\n\t\t\t\t\t\tconst isSelected = selectedFilterOption === option.token;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Typography\n\t\t\t\t\t\t\t\tvariant=\"bodySmall\"\n\t\t\t\t\t\t\t\tclassName=\"flex cursor-pointer items-center text-black-200\"\n\t\t\t\t\t\t\t\tkey={label}\n\t\t\t\t\t\t\t\ttag=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\tchecked={isSelected}\n\t\t\t\t\t\t\t\t\tclassName=\"mr-3 h-[13px] w-[13px] border-grey-100 text-primary\"\n\t\t\t\t\t\t\t\t\tonChange={() => setSelectedFilterOption(filter.token, option.token)}\n\t\t\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t\t\tvalue={option.token}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<span className={cn(isSelected ? 'text-primary' : 'text-black-200 hover:text-secondary-200')}>\n\t\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t);\n\t\t\t\t\t})}\n\t\t\t\t</div>\n\t\t\t</AccordionContent>\n\t\t</AccordionItem>\n\t);\n}\n\nexport function Categories() {\n\tconst [expandedFacets, setExpandedFacets] = useState<string[]>([]);\n\tconst [showMore, setShowMore] = useState<string>();\n\tconst { userSearchFilters } = useUserSearchFilterContext();\n\n\treturn (\n\t\t<Accordion onValueChange={setExpandedFacets} type=\"multiple\" value={expandedFacets}>\n\t\t\t{userSearchFilters?.map((filter, index) => {\n\t\t\t\tconst key = `${filter.title}-${index}`;\n\n\t\t\t\treturn <UserSearchFilterAccordionItem filter={filter} key={key} />;\n\t\t\t})}\n\t\t\t<Category\n\t\t\t\tcategory=\"topic\"\n\t\t\t\tmaxLevel={3}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"resourceType\"\n\t\t\t\tmaxLevel={1}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<AuthorsOrPublishers\n\t\t\t\tattribute=\"authorIds\"\n\t\t\t\tnameAttribute=\"authorFacets\"\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Statuses setExpandedFacets={setExpandedFacets} />\n\t\t\t<Category\n\t\t\t\tcategory=\"specials\"\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"language\"\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"seriesSets\"\n\t\t\t\tmaxLevel={1}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<AuthorsOrPublishers\n\t\t\t\tattribute=\"publisherIds\"\n\t\t\t\tnameAttribute=\"publisherFacets\"\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"bibleAndApocrypha\"\n\t\t\t\tmaxLevel={3}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"containment\"\n\t\t\t\tmaxLevel={1}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category category=\"format\" setExpandedFacets={setExpandedFacets} setShowMore={setShowMore} showMore={showMore} />\n\t\t\t<Category\n\t\t\t\tcategory=\"genre\"\n\t\t\t\tmaxLevel={2}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"licensingMethod\"\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"religiousGroup\"\n\t\t\t\tmaxLevel={0}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t</Accordion>\n\t);\n}\n","import React, { useEffect, useRef } from 'react';\nimport {\n\tCurrentRefinementsConnectorParamsItem,\n\tCurrentRefinementsConnectorParamsRefinement,\n} from 'instantsearch.js/es/connectors/current-refinements/connectCurrentRefinements';\nimport { X } from 'lucide-react';\nimport { useCurrentRefinements, useRefinementList, useSearchBox } from 'react-instantsearch';\n\nimport { useLocation } from '../../location';\nimport { useAuthor } from '../../hooks/use-author';\nimport { usePublisher } from '../../hooks/use-publisher';\nimport { parseFacetValue } from './util';\n\n// ---------------------------------------------------------------------------\n// CurrentRefinements — chips for active facet refinements\n// ---------------------------------------------------------------------------\n\nfunction RefinementLabel({ attribute, value }: { attribute: string; value: string }) {\n\tconst stringValue = typeof value === 'string' ? value : String(value ?? '');\n\n\tif (attribute === 'authorIds') {\n\t\treturn <AuthorLabel value={stringValue} />;\n\t}\n\n\tif (attribute === 'publisherIds') {\n\t\treturn <PublisherLabel value={stringValue} />;\n\t}\n\n\treturn <span>{stringValue.replace(/^((.*) > )*/, '')}</span>;\n}\n\nfunction AuthorLabel({ value }: { value: string }) {\n\tconst { items } = useRefinementList({ attribute: 'authorFacets' });\n\n\tif (!items.length) {\n\t\treturn <span>{'…'}</span>;\n\t}\n\n\tconst item = items.find(i => i.value.startsWith(`${value}:`));\n\n\tif (item) {\n\t\tconst { displayName } = parseFacetValue(item.label);\n\t\treturn <span>{displayName}</span>;\n\t}\n\n\treturn <AuthorApiLabel value={value} />;\n}\n\nfunction AuthorApiLabel({ value }: { value: string }) {\n\tconst { data, isLoading } = useAuthor(value);\n\n\tif (isLoading) {\n\t\treturn <span>{'…'}</span>;\n\t}\n\n\tif (!data) {\n\t\treturn null;\n\t}\n\n\treturn <span>{data.displayName}</span>;\n}\n\nfunction PublisherLabel({ value }: { value: string }) {\n\tconst { items } = useRefinementList({ attribute: 'publisherFacets' });\n\n\tif (!items.length) {\n\t\treturn <span>{'…'}</span>;\n\t}\n\n\tconst item = items.find(i => i.value.startsWith(`${value}:`));\n\n\tif (item) {\n\t\tconst { displayName } = parseFacetValue(item.label);\n\t\treturn <span>{displayName}</span>;\n\t}\n\n\treturn <PublisherApiLabel value={value} />;\n}\n\nfunction PublisherApiLabel({ value }: { value: string }) {\n\tconst { data, isLoading } = usePublisher(value);\n\n\tif (isLoading) {\n\t\treturn <span>{'…'}</span>;\n\t}\n\n\tif (!data) {\n\t\treturn null;\n\t}\n\n\treturn <span>{data.displayName}</span>;\n}\n\nexport function CurrentRefinements() {\n\tconst currentRefinements = useCurrentRefinements();\n\tconst itemsByAttribute: Record<string, CurrentRefinementsConnectorParamsItem> = {};\n\tconst refinementList: CurrentRefinementsConnectorParamsRefinement[] = [];\n\n\tfor (const item of currentRefinements?.items ?? []) {\n\t\titemsByAttribute[item.attribute] = item;\n\n\t\tfor (const refinement of item.refinements ?? []) {\n\t\t\trefinementList.push(refinement);\n\t\t}\n\t}\n\n\treturn refinementList.map(item => {\n\t\tconst itemValue = item.value;\n\t\tconst itemAndChildren =\n\t\t\ttypeof itemValue === 'string'\n\t\t\t\t? refinementList.filter(r => typeof r.value === 'string' && r.value.startsWith(itemValue))\n\t\t\t\t: [item];\n\n\t\treturn (\n\t\t\t<RefinementChip\n\t\t\t\tattribute={item.attribute}\n\t\t\t\titemAndChildren={itemAndChildren}\n\t\t\t\titemsByAttribute={itemsByAttribute}\n\t\t\t\tkey={`${item.attribute}:${String(itemValue)}`}\n\t\t\t\tlabel={item.label}\n\t\t\t\tvalue={String(itemValue)}\n\t\t\t/>\n\t\t);\n\t});\n}\n\nfunction RefinementChip({\n\tattribute,\n\tvalue,\n\tlabel,\n\titemAndChildren,\n\titemsByAttribute,\n}: {\n\tattribute: string;\n\tvalue: string;\n\tlabel: string;\n\titemAndChildren: CurrentRefinementsConnectorParamsRefinement[];\n\titemsByAttribute: Record<string, CurrentRefinementsConnectorParamsItem>;\n}) {\n\treturn (\n\t\t<button\n\t\t\taria-label={`Remove ${label} from filters`}\n\t\t\tclassName=\"flex items-center gap-x-1 bg-grey-200 py-[6px] pl-3 pr-2 text-xs capitalize text-black-100\"\n\t\t\tonClick={() => itemAndChildren.forEach(i => itemsByAttribute[attribute]?.refine(i))}\n\t\t>\n\t\t\t<RefinementLabel attribute={attribute} value={value} />\n\t\t\t<X aria-hidden=\"true\" height={14} width={14} />\n\t\t</button>\n\t);\n}\n\n// ---------------------------------------------------------------------------\n// CurrentQueryRefinement — chip for the active search query\n// ---------------------------------------------------------------------------\n\nexport default function CurrentQueryRefinement() {\n\tconst { searchParams } = useLocation();\n\tconst urlQuery = searchParams.get('query')?.trim() ?? '';\n\n\tconst { query, refine, clear } = useSearchBox();\n\tconst queryRef = useRef(query);\n\tqueryRef.current = query;\n\n\tuseEffect(() => {\n\t\tif (urlQuery && queryRef.current !== urlQuery) {\n\t\t\trefine(urlQuery);\n\t\t}\n\t}, [urlQuery, refine]);\n\n\tconst removeQuery = () => {\n\t\tclear();\n\t};\n\n\treturn query ? (\n\t\t<button\n\t\t\taria-label=\"remove search term from filters\"\n\t\t\tclassName=\"flex items-center gap-x-1 bg-grey-200 py-[6px] pl-3 pr-2 text-xs capitalize text-black-100\"\n\t\t\tonClick={removeQuery}\n\t\t>\n\t\t\t<span>\n\t\t\t\t{'\"'}\n\t\t\t\t{query}\n\t\t\t\t{'\"'}\n\t\t\t</span>\n\t\t\t<X aria-hidden=\"true\" height={14} width={14} />\n\t\t</button>\n\t) : null;\n}\n","import React from 'react';\nimport { useRefinementList } from 'react-instantsearch';\n\nimport type { FacetConfiguration } from './routing';\n\n// Keeps a real refinementList widget mounted for each hidden facet attribute (and, for hierarchical facets,\n// each of its levels) so Algolia treats it as refinable, without rendering any UI. Filtering itself is driven\n// entirely by the URL via routing.ts.\n// skipSuspense avoids blocking rendering on data that is never displayed.\nfunction HiddenRefinementList({ attribute }: { attribute: string }) {\n\tuseRefinementList({ attribute }, { skipSuspense: true });\n\n\treturn null;\n}\n\nfunction getHiddenAlgoliaAttributes(config: FacetConfiguration): string[] {\n\tif (config.type === 'simple') {\n\t\treturn [config.algoliaAttribute];\n\t}\n\n\tconst attributes: string[] = [];\n\n\tfor (let level = config.minLevel; level <= config.maxLevel; level += 1) {\n\t\tattributes.push(`${config.algoliaAttributeBase}.lvl${level}`);\n\t}\n\n\treturn attributes;\n}\n\nexport default function HiddenFacetRefinements({ facetConfigurations }: { facetConfigurations: FacetConfiguration[] }) {\n\tconst attributes = facetConfigurations.filter(config => config.isHidden).flatMap(getHiddenAlgoliaAttributes);\n\n\treturn (\n\t\t<>\n\t\t\t{attributes.map(attribute => (\n\t\t\t\t<HiddenRefinementList attribute={attribute} key={attribute} />\n\t\t\t))}\n\t\t</>\n\t);\n}\n","import React, { ReactNode } from 'react';\nimport { cn } from '../../util/cn';\n\nfunction SkeletonRoot({\n\tclassName,\n\tchildren,\n\tpending = false,\n\thideOverflow = false,\n}: {\n\tclassName?: string;\n\tchildren?: React.ReactNode;\n\tpending?: boolean;\n\thideOverflow?: boolean;\n}) {\n\treturn (\n\t\t<div\n\t\t\tclassName={cn('@container', hideOverflow && 'overflow-hidden', className)}\n\t\t\tdata-pending={pending ? '' : undefined}\n\t\t\trole={pending ? 'status' : undefined}\n\t\t>\n\t\t\t{children}\n\t\t\t{pending && <span className=\"sr-only\">{'Loading...'}</span>}\n\t\t</div>\n\t);\n}\n\nfunction SkeletonBox({ className }: { className?: string }) {\n\treturn <div className={cn('rounded-lg bg-gray-300', className)} />;\n}\n\nfunction SkeletonText({ characterCount = 10, className }: { characterCount?: number | 'full'; className?: string }) {\n\treturn (\n\t\t<div className={cn('flex h-[1lh] items-center', className)}>\n\t\t\t<div\n\t\t\t\tclassName={cn(`h-[1ex] max-w-full rounded-[inherit] bg-gray-300`)}\n\t\t\t\tstyle={{ width: characterCount === 'full' ? '100%' : `${characterCount}ch` }}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction SkeletonIcon({ className, icon }: { className?: string; icon: ReactNode }) {\n\treturn <div className={cn('text-gray-300 opacity-25', className)}>{icon}</div>;\n}\n\nexport { SkeletonIcon as Icon, SkeletonRoot as Root, SkeletonBox as Box, SkeletonText as Text };\n","import React from 'react';\n\nimport { CommandSentence } from '@faithlife/command-sentence-control';\nimport { useLocalization } from '../../../localization';\nimport { useBrandName } from '../../../util/brand-name-context';\n\nexport default function EnhancedForLogosLabel() {\n\tconst resources = useLocalization('CommerceWeb.Resources.Search.DisplayTemplates.ProductSearchResultViewModel');\n\tconst logosOrVerbum = useBrandName();\n\tconst isVerbum = logosOrVerbum?.toLowerCase() === 'verbum';\n\treturn (\n\t\t<CommandSentence className=\"text-xs text-primary\" template={resources.EnhancedForLogos}>\n\t\t\t<CommandSentence.Field name=\"ICON\">\n\t\t\t\t<img\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tisVerbum\n\t\t\t\t\t\t\t? 'inline-block w-[17px] h-[12px] [vertical-align:-1.5px]'\n\t\t\t\t\t\t\t: 'inline-block w-[14px] h-[14px] [vertical-align:-2px] mx-px'\n\t\t\t\t\t}\n\t\t\t\t\talt={logosOrVerbum}\n\t\t\t\t\tsrc={\n\t\t\t\t\t\tisVerbum\n\t\t\t\t\t\t\t? 'https://files.logoscdn.com/v1/files/70496318/assets/14995970/content.svg?signature=SsnOeyt3lPzdfqreDLuA7km2gRs'\n\t\t\t\t\t\t\t: 'https://files.logoscdn.com/v1/files/71036773/assets/14991834/content.svg?signature=NlgSyNjXKmP7caOrWgZiZv5hSEE'\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</CommandSentence.Field>\n\t\t</CommandSentence>\n\t);\n}\n","import React from 'react';\nimport { CommandSentence } from '@faithlife/command-sentence-control';\n\nimport EnhancedForLogosLabel from '../enhanced-for-logos-label';\nimport Tooltip from '../tooltip';\nimport { InfoIconSvgUrl } from '../svgs';\n\nimport { useLocalization } from '../../../localization';\nimport { useBrandName } from '../../../util/brand-name-context';\n\nexport interface EnhancedForLogosWithTooltipProps {\n\tclassName?: string;\n}\n\nconst EnhancedForLogosWithTooltip = ({ className }: EnhancedForLogosWithTooltipProps) => {\n\tconst resources = useLocalization('CommerceWeb.Resources.Search.DisplayTemplates.ProductSearchResultViewModel');\n\n\tconst logosOrVerbum = useBrandName();\n\n\treturn (\n\t\t<Tooltip placement=\"bottom\" className={className} link={<EnhancedForLogosLabel />}>\n\t\t\t<div className={'w-[250px] text-start flex items-start gap-sp8'}>\n\t\t\t\t<div>\n\t\t\t\t\t<img className=\"max-w-none w-[20px] h-[20px]\" src={InfoIconSvgUrl} alt=\"\" />\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<CommandSentence className=\"text-xs\" template={resources.EnhancedForLogosTooltipContent}>\n\t\t\t\t\t\t<CommandSentence.Field name=\"LOGOSORVERBUM\">{logosOrVerbum}</CommandSentence.Field>\n\t\t\t\t\t</CommandSentence>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Tooltip>\n\t);\n};\n\nexport default EnhancedForLogosWithTooltip;\n","import { useCallback, useEffect, useRef, useState } from 'react';\nimport insightsClient from 'search-insights';\n\nimport { useCurrentUser, usePricing } from '../../per-user-data/per-user-data-context';\nimport type { ProductPrices } from '../../per-user-data/per-user-data-context';\nimport { detectIsAmberOptimizedUrl } from '../../shared/enhanced-image-tag/image';\nimport { getSavingsPercent, slugify } from '../util';\nimport { ProductHitResult } from '../types';\nimport { useSearchResources } from '../search-resources';\nimport { useAlgoliaSearch } from '../algolia-search-context';\n\nconst usdFormat = new Intl.NumberFormat('en-US', {\n\tstyle: 'currency',\n\tcurrency: 'USD',\n\tminimumFractionDigits: 2,\n\tmaximumFractionDigits: 2,\n});\n\nconst placeholderImage = 'https://files.logoscdn.com/v1/assets/15953102/optimized';\n\ninterface UseProductCardProps {\n\thit: ProductHitResult;\n\tqueryId?: string | null;\n\tposition?: number;\n}\n\nexport function useProductCard({ hit, queryId = null, position }: UseProductCardProps) {\n\tconst { data: pricingData } = usePricing(hit.productId);\n\tconst { preferredCurrency } = useCurrentUser();\n\tconst { indexName } = useAlgoliaSearch();\n\tconst hasGeoRestriction = pricingData?.isGeographicallyRestricted;\n\tconst [isAddingToCart, setIsAddingToCart] = useState(false);\n\tconst resources = useSearchResources();\n\tconst productId = hit?.productId;\n\tconst requestIdRef = useRef<string | null>(null);\n\n\t// Use API pricing when available, fall back to Algolia pricing\n\tconst prices: ProductPrices = pricingData?.primarySku?.prices ?? {\n\t\tsalePrice: {\n\t\t\tamount: hit.salePrice ?? 0,\n\t\t\tdisplayAmount: usdFormat.format(hit.salePrice ?? 0),\n\t\t\tdisplayAmountCurrencyCode: null,\n\t\t\tlocalizedDisplayAmount: null,\n\t\t\tcurrencyCode: 'USD',\n\t\t\tdisplayAmountByCurrency: null,\n\t\t},\n\t\tanchorPrice:\n\t\t\thit.salePrice !== hit.anchorPrice\n\t\t\t\t? {\n\t\t\t\t\t\tamount: hit.anchorPrice ?? 0,\n\t\t\t\t\t\tdisplayAmount: usdFormat.format(hit.anchorPrice ?? 0),\n\t\t\t\t\t\tdisplayAmountCurrencyCode: 'USD',\n\t\t\t\t\t\tlocalizedDisplayAmount: null,\n\t\t\t\t\t\tcurrencyCode: 'USD',\n\t\t\t\t\t\tdisplayAmountByCurrency: null,\n\t\t\t\t\t}\n\t\t\t\t: null,\n\t\tdiscountSavings: null,\n\t};\n\n\tconst accessKind = pricingData?.accessKind;\n\tconst isOwned = accessKind === 'Permanent' || accessKind === 'Temporary';\n\tconst hasPreorder = pricingData?.hasPreorder;\n\tconst isPrepubProduct = pricingData?.isPrepubProduct;\n\tconst prepubProductStatusSummary = pricingData?.prepubProductStatusSummary;\n\tconst skuId = pricingData?.primarySku?.skuId;\n\tconst isPurchasable = pricingData?.primarySku?.isPurchasable ?? undefined;\n\n\tuseEffect(() => {\n\t\tconst handleCartUpdated = (e: CustomEvent) => {\n\t\t\tif (e.detail.requestId === requestIdRef.current) {\n\t\t\t\tsetIsAddingToCart(false);\n\t\t\t}\n\t\t};\n\n\t\tconst handleCartUpdateError = (e: CustomEvent) => {\n\t\t\tif (e.detail.requestId === requestIdRef.current) {\n\t\t\t\tsetIsAddingToCart(false);\n\t\t\t}\n\t\t};\n\n\t\tdocument.addEventListener('faithlife.sites.cart.updated', handleCartUpdated as EventListener);\n\t\tdocument.addEventListener('faithlife.sites.cart.updateError', handleCartUpdateError as EventListener);\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('faithlife.sites.cart.updated', handleCartUpdated as EventListener);\n\t\t\tdocument.removeEventListener('faithlife.sites.cart.updateError', handleCartUpdateError as EventListener);\n\t\t};\n\t}, []);\n\n\tconst slug = slugify(hit.title);\n\tconst productPath = slug ? `/product/${productId}/${slug}` : `/product/${productId}`;\n\tconst productUrl = queryId ? `${productPath}?queryId=${encodeURIComponent(queryId)}` : productPath;\n\tconst productName = hit.title ?? '';\n\tconst regularPrice = prices?.anchorPrice?.displayAmount;\n\tconst salePrice = prices?.salePrice?.displayAmount;\n\tconst salePriceCurrency = preferredCurrency !== 'USD' ? 'USD' : undefined;\n\tconst localizedSalePrice = prices?.salePrice?.localizedDisplayAmount ?? undefined;\n\tconst discountPercentage = getSavingsPercent(prices);\n\tconst isDiscounted = !!pricingData?.primarySku?.prices?.discountSavings;\n\tconst productImageSrc = hit.primaryImageUri;\n\tconst imageSrc = detectIsAmberOptimizedUrl(productImageSrc ?? '') ? productImageSrc : placeholderImage;\n\tconst isLogosEdition = hit.isLogosEdition ?? false;\n\n\tconst handleProductClick = useCallback(() => {\n\t\tif (!productId) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (queryId && position) {\n\t\t\tinsightsClient('clickedObjectIDsAfterSearch', {\n\t\t\t\tindex: indexName,\n\t\t\t\teventName: `Clicked result on ${window.location.pathname}`.substring(0, 64),\n\t\t\t\tqueryID: queryId,\n\t\t\t\tobjectIDs: [productId],\n\t\t\t\tpositions: [position],\n\t\t\t});\n\t\t} else {\n\t\t\tinsightsClient('clickedObjectIDs', {\n\t\t\t\tindex: indexName,\n\t\t\t\teventName: `Clicked result on ${window.location.pathname}`.substring(0, 64),\n\t\t\t\tobjectIDs: [productId],\n\t\t\t});\n\t\t}\n\t}, [productId, queryId, position, indexName]);\n\n\tconst handleAddToCart = (e: React.MouseEvent<HTMLButtonElement>) => {\n\t\tif (!skuId || isAddingToCart) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Track add-to-cart with Algolia insights\n\t\tif (productId) {\n\t\t\tconst eventType = queryId ? 'addedToCartObjectIDsAfterSearch' : 'addedToCartObjectIDs';\n\t\t\tconst eventData: Record<string, any> = {\n\t\t\t\tindex: indexName,\n\t\t\t\teventName: `Added product to cart on ${window.location.pathname}`.substring(0, 64),\n\t\t\t\tobjectIDs: [productId],\n\t\t\t};\n\t\t\tif (queryId) {\n\t\t\t\teventData.queryID = queryId;\n\t\t\t}\n\t\t\tinsightsClient(eventType as any, eventData);\n\t\t}\n\n\t\tconst requestId = (requestIdRef.current = `${Date.now()}-${Math.random()}`);\n\n\t\tconst eventDetail: Record<string, any> = {\n\t\t\taddToCartUrl: pricingData?.primarySku?.routes?.AddToCartUrl,\n\t\t\tskuIds: [skuId],\n\t\t\tquantity: 1,\n\t\t\tpayInFull: true,\n\t\t\trequestId,\n\t\t};\n\n\t\t// Include searchData for Algolia purchase attribution\n\t\tif (queryId && productId) {\n\t\t\teventDetail.searchData = {\n\t\t\t\tqueryId,\n\t\t\t\tproductIds: [productId],\n\t\t\t};\n\t\t}\n\n\t\te.currentTarget.dispatchEvent(\n\t\t\tnew CustomEvent('faithlife.sites.addToCartButton.click', {\n\t\t\t\tbubbles: true,\n\t\t\t\tdetail: eventDetail,\n\t\t\t})\n\t\t);\n\n\t\tsetIsAddingToCart(true);\n\t};\n\n\treturn {\n\t\tresources,\n\t\tproductUrl,\n\t\tproductName,\n\t\timageSrc,\n\t\tisLogosEdition,\n\t\tregularPrice,\n\t\tsalePrice,\n\t\tsalePriceCurrency,\n\t\tlocalizedSalePrice,\n\t\tdiscountPercentage,\n\t\tisDiscounted,\n\t\taccessKind,\n\t\tisOwned,\n\t\thasGeoRestriction,\n\t\tisPurchasable,\n\t\thasPreorder,\n\t\tisPrepubProduct,\n\t\tprepubProductStatusSummary,\n\t\tskuId,\n\t\tisAddingToCart,\n\t\thandleProductClick,\n\t\thandleAddToCart,\n\t\thit,\n\t};\n}\n\nexport type ProductCardData = ReturnType<typeof useProductCard>;\n","import React from 'react';\n\nimport { Image } from '../../shared/enhanced-image-tag/image';\n\ninterface ProductImageProps {\n\tproductName: string;\n\timageSrc: string;\n\tproductUrl: string;\n\tpriority?: boolean;\n\thandleProductClick: () => void;\n}\n\nexport function ProductImage({ productName, imageSrc, productUrl, priority, handleProductClick }: ProductImageProps) {\n\treturn (\n\t\t<a\n\t\t\tclassName=\"flex aspect-[100/122] w-auto justify-center lg:aspect-[129/158]\"\n\t\t\thref={productUrl}\n\t\t\tonClick={handleProductClick}\n\t\t\tonAuxClick={handleProductClick}\n\t\t>\n\t\t\t<Image\n\t\t\t\talt={productName}\n\t\t\t\tbelowTheFold={!priority}\n\t\t\t\tclassName=\"w-[100px] h-[122px] object-contain lg:h-[158px] lg:w-[129px]\"\n\t\t\t\tsizes={{ mobile: '100vw', tablet: '50vw', desktop: 129 }}\n\t\t\t\tsrc={imageSrc}\n\t\t\t\ttargetAspectRatio={[129, 158]}\n\t\t\t/>\n\t\t</a>\n\t);\n}\n","import React from 'react';\nimport { Typography } from '@faithlife/commerce-components';\n\nimport { useSearchResources } from '../search-resources';\n\ninterface DiscountBadgeProps {\n\tdiscountPercentage: number;\n\tisDiscounted: boolean;\n\tclassName?: string;\n}\n\nexport function DiscountBadge({ discountPercentage, isDiscounted, className }: DiscountBadgeProps) {\n\tconst resources = useSearchResources();\n\n\tif (discountPercentage <= 1) {\n\t\treturn null;\n\t}\n\n\tconst badgeClassName = isDiscounted ? 'bg-red-300 text-white' : 'bg-primary-200 text-primary-400';\n\n\treturn (\n\t\t<Typography className={`rounded-full px-2 py-[2px] ${badgeClassName} ${className ?? ''}`} variant=\"finePrint\">\n\t\t\t{resources['discountFormat']?.replace('%DISCOUNT_PERCENTAGE%', discountPercentage.toFixed())}\n\t\t</Typography>\n\t);\n}\n","import React from 'react';\nimport { Typography } from '@faithlife/commerce-components';\n\nimport { cn } from '../../../util/cn';\n\ninterface ProductTitleProps {\n\tproductName: string;\n\tproductUrl: string;\n\thandleProductClick: () => void;\n\tclassName?: string;\n}\n\nexport function ProductTitle({ productName, productUrl, handleProductClick, className }: ProductTitleProps) {\n\treturn (\n\t\t<a href={productUrl} onAuxClick={handleProductClick} onClick={handleProductClick} title={productName}>\n\t\t\t<Typography\n\t\t\t\tclassName={cn('line-clamp-2 hover:underline focus-visible:underline', className)}\n\t\t\t\ttag=\"h3\"\n\t\t\t\tvariant=\"bodySmall\"\n\t\t\t>\n\t\t\t\t{productName}\n\t\t\t</Typography>\n\t\t</a>\n\t);\n}\n","import React from 'react';\nimport { Typography } from '@faithlife/commerce-components';\n\ninterface ProductAuthorsProps {\n\tauthors?: string[];\n}\n\nexport function ProductAuthors({ authors }: ProductAuthorsProps) {\n\treturn (\n\t\t<Typography className=\"bodyMd line-clamp-1 text-black\" variant=\"finePrint\">\n\t\t\t{authors?.join(', ')}\n\t\t</Typography>\n\t);\n}\n","import React from 'react';\nimport { Button, PriceLabel, Typography } from '@faithlife/commerce-components';\nimport type { buttonScaleOptions } from '@faithlife/commerce-components';\n\nimport { cn } from '../../../util/cn';\nimport * as Skeleton from '../../skeleton';\nimport { useSearchResources } from '../search-resources';\nimport { ProductCardData } from './use-product-card';\n\ntype ButtonScale = (typeof buttonScaleOptions)[number];\n\nconst ctaButtonScale: ButtonScale = 'medium';\nconst skeletonHeightByButtonScale = {\n\tsmall: 'h-8',\n\tmedium: 'h-12',\n\tlarge: 'h-[60px]',\n} satisfies Record<ButtonScale, string>;\n\ninterface ProductPricingProps {\n\tcardData: ProductCardData;\n\tbuttonLayoutClassName: string;\n}\n\nfunction getOwnershipLabel(\n\tresources: ReturnType<typeof useSearchResources>,\n\thasGeoRestriction: boolean | undefined,\n\taccessKind: string | undefined,\n\thasPreorder: boolean | undefined\n): string | null {\n\tif (hasGeoRestriction) {\n\t\treturn resources['geoRestrictionMessage'];\n\t}\n\tif (accessKind === 'Permanent') {\n\t\treturn resources['permanentOwnMessage'];\n\t}\n\tif (accessKind === 'Temporary') {\n\t\treturn resources['temporaryOwnMessage'];\n\t}\n\tif (hasPreorder) {\n\t\treturn resources['hasPreorderMessage'];\n\t}\n\treturn null;\n}\n\nexport function ProductPricing({ cardData, buttonLayoutClassName }: ProductPricingProps) {\n\treturn (\n\t\t<>\n\t\t\t<ProductPrice cardData={cardData} className=\"items-end\" />\n\t\t\t<ProductCta\n\t\t\t\tbuttonLayoutClassName={buttonLayoutClassName}\n\t\t\t\tcardData={cardData}\n\t\t\t\townershipLabelClassName=\"text-right\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n\ninterface ProductPriceProps {\n\tcardData: ProductCardData;\n\tclassName?: string;\n}\n\nexport function ProductPrice({ cardData, className }: ProductPriceProps) {\n\tconst { salePrice, salePriceCurrency, regularPrice, localizedSalePrice, isDiscounted, accessKind } = cardData;\n\n\tif (accessKind === 'Permanent' || accessKind === 'Temporary') {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PriceLabel\n\t\t\tvariant={isDiscounted ? 'sale' : 'value'}\n\t\t\tlayout=\"vertical\"\n\t\t\tsalePrice={salePrice ?? ''}\n\t\t\tsalePriceCurrency={salePriceCurrency ?? undefined}\n\t\t\tanchorPrice={regularPrice}\n\t\t\tlocalizedSalePrice={localizedSalePrice ?? undefined}\n\t\t\tclassName={cn(className)}\n\t\t/>\n\t);\n}\n\ninterface ProductCtaProps {\n\tcardData: ProductCardData;\n\tbuttonLayoutClassName: string;\n\townershipLabelClassName?: string;\n}\n\nexport function ProductCta({ cardData, buttonLayoutClassName, ownershipLabelClassName }: ProductCtaProps) {\n\tconst resources = useSearchResources();\n\tconst {\n\t\tisPurchasable,\n\t\thasGeoRestriction,\n\t\taccessKind,\n\t\thasPreorder,\n\t\tskuId,\n\t\tisAddingToCart,\n\t\tisPrepubProduct,\n\t\thandleAddToCart,\n\t} = cardData;\n\n\tlet purchaseStatusMessage = getOwnershipLabel(resources, hasGeoRestriction, accessKind, hasPreorder);\n\n\tif (isPurchasable !== undefined && !isPurchasable && !purchaseStatusMessage) {\n\t\tpurchaseStatusMessage = resources['UnavailableToPurchase'];\n\t}\n\n\tif (purchaseStatusMessage) {\n\t\treturn (\n\t\t\t<Typography\n\t\t\t\tvariant=\"bodyRegular\"\n\t\t\t\tclassName={cn('text-primary-500', ownershipLabelClassName ?? cn('text-center', !hasPreorder && 'md:pt-sp16'))}\n\t\t\t>\n\t\t\t\t{purchaseStatusMessage}\n\t\t\t</Typography>\n\t\t);\n\t}\n\n\tif (skuId) {\n\t\treturn (\n\t\t\t<div className={cn('inline-flex gap-2 lg:gap-3', buttonLayoutClassName)}>\n\t\t\t\t<Button\n\t\t\t\t\tdisabled={isAddingToCart}\n\t\t\t\t\tonClick={handleAddToCart}\n\t\t\t\t\tscale={ctaButtonScale}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t>\n\t\t\t\t\t{isAddingToCart\n\t\t\t\t\t\t? resources['addingToCart']\n\t\t\t\t\t\t: isPrepubProduct\n\t\t\t\t\t\t\t? resources['preorder']\n\t\t\t\t\t\t\t: resources['addToCart']}\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Skeleton.Root className={cn('animate-pulse inline-flex gap-2 lg:gap-3', buttonLayoutClassName)}>\n\t\t\t<Skeleton.Box className={cn('w-full', skeletonHeightByButtonScale[ctaButtonScale])} />\n\t\t</Skeleton.Root>\n\t);\n}\n","import React from 'react';\nimport { StarRating } from '@faithlife/commerce-components';\n\nimport { ProductHitResult } from '../types';\nimport { useProductInWishList } from '../../add-to-wish-list/hooks';\nimport { AddToWishListWithForm } from '../../add-to-wish-list';\nimport EnhancedForLogosWithTooltip from '../../shared/enhanced-for-logos-with-tooltip';\nimport { hasValidReviewData } from '../../shared/ratings/review-data';\nimport { PrepubProductStatusSummary } from '../../product/product-details-page/right-column/prepub-product-status-summary';\nimport { useProductCard } from './use-product-card';\nimport { ProductImage } from './product-image';\nimport { DiscountBadge } from './discount-badge';\nimport { ProductTitle } from './product-title';\nimport { ProductAuthors } from './product-authors';\nimport { ProductPrice, ProductCta } from './product-pricing';\n\ninterface AlgoliaGridCardProps {\n\thit: ProductHitResult;\n\tpriority?: boolean;\n\tqueryId?: string | null;\n\tposition?: number;\n}\n\nexport function AlgoliaGridCard({ hit, priority, queryId = null, position }: AlgoliaGridCardProps) {\n\tconst cardData = useProductCard({ hit, queryId, position });\n\tconst {\n\t\tproductUrl,\n\t\tproductName,\n\t\timageSrc,\n\t\tdiscountPercentage,\n\t\tisDiscounted,\n\t\thandleProductClick,\n\t\tskuId,\n\t\tisLogosEdition,\n\t\tprepubProductStatusSummary,\n\t\tisOwned,\n\t} = cardData;\n\tconst productInWishlist = useProductInWishList(hit.productId, skuId, !isOwned);\n\tconst averageRating = hit.averageRating ?? 0;\n\tconst reviewCount = hit.reviewCount ?? 0;\n\tconst hasReviewData = hasValidReviewData(averageRating, reviewCount);\n\n\treturn (\n\t\t<div className=\"grid gap-y-0 grid-rows-subgrid row-span-5 grid-cols-1\">\n\t\t\t{/* Row 1: Image — fixed aspect ratio, never grows */}\n\t\t\t<div className=\"relative flex flex-col items-center justify-start gap-sp12 pt-3 lg:pt-4\">\n\t\t\t\t<div className=\"flex h-43.5 w-full items-end justify-center\">\n\t\t\t\t\t<ProductImage\n\t\t\t\t\t\thandleProductClick={handleProductClick}\n\t\t\t\t\t\timageSrc={imageSrc}\n\t\t\t\t\t\tpriority={priority}\n\t\t\t\t\t\tproductName={productName}\n\t\t\t\t\t\tproductUrl={productUrl}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"h-4 text-center\">{isLogosEdition && <EnhancedForLogosWithTooltip />}</div>\n\t\t\t\t{!isOwned && (\n\t\t\t\t\t<DiscountBadge\n\t\t\t\t\t\tclassName=\"absolute top-2 left-2\"\n\t\t\t\t\t\tdiscountPercentage={discountPercentage}\n\t\t\t\t\t\tisDiscounted={isDiscounted}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t<AddToWishListWithForm {...productInWishlist} variant=\"icon\" isOwned={isOwned} />\n\t\t\t</div>\n\n\t\t\t{/* Row 2: Info — grows to absorb variable space */}\n\t\t\t<div className=\"px-2 pt-sp12 pb-1 lg:px-4 lg:pb-2\">\n\t\t\t\t<ProductTitle\n\t\t\t\t\tclassName=\"line-clamp-2\"\n\t\t\t\t\thandleProductClick={handleProductClick}\n\t\t\t\t\tproductName={productName}\n\t\t\t\t\tproductUrl={productUrl}\n\t\t\t\t/>\n\n\t\t\t\t<div className=\"mt-sp8\">\n\t\t\t\t\t<ProductAuthors authors={hit.authors} />\n\t\t\t\t</div>\n\n\t\t\t\t{hasReviewData && (\n\t\t\t\t\t<div className=\"mt-sp8\">\n\t\t\t\t\t\t<StarRating rating={averageRating} reviewCount={reviewCount} />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t{/* Row 3: Prepub summary — empty when not present */}\n\t\t\t<div className=\"px-2 lg:px-4\">\n\t\t\t\t{prepubProductStatusSummary && (\n\t\t\t\t\t<PrepubProductStatusSummary {...prepubProductStatusSummary} variant=\"search-grid\" />\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t{/* Row 4: Price — always aligned across cards */}\n\t\t\t<div className=\"flex items-end px-2 md:pb-1 lg:px-4\">\n\t\t\t\t<ProductPrice cardData={cardData} />\n\t\t\t</div>\n\n\t\t\t{/* Row 5: CTA — always aligned across cards */}\n\t\t\t<ProductCta buttonLayoutClassName=\"w-full flex-col px-2 pb-2 pt-2 lg:px-4 lg:pb-4\" cardData={cardData} />\n\t\t</div>\n\t);\n}\n","import React, { useEffect, useRef, useState } from 'react';\nimport { LinkButton } from '@faithlife/commerce-components';\n\nimport { cn } from '../../../util/cn';\nimport { useSearchResources } from '../search-resources';\n\ninterface ProductOverviewProps {\n\toverview?: string;\n}\n\nexport function ProductOverview({ overview }: ProductOverviewProps) {\n\tconst [isExpanded, setIsExpanded] = useState(false);\n\tconst [showButton, setShowButton] = useState(false);\n\tconst overviewRef = useRef<HTMLDivElement>(null);\n\tconst resources = useSearchResources();\n\n\tuseEffect(() => {\n\t\tconst element = overviewRef.current;\n\n\t\tif (element) {\n\t\t\ttry {\n\t\t\t\tconst height = element.scrollHeight;\n\t\t\t\tconst computedLineHeight = getComputedStyle(element).lineHeight;\n\t\t\t\tconst parsedLineHeight = parseInt(computedLineHeight, 10);\n\t\t\t\tconst lineHeight = Number.isFinite(parsedLineHeight) && parsedLineHeight > 0 ? parsedLineHeight : 20;\n\t\t\t\tconst maxHeight = lineHeight * 4;\n\t\t\t\tconst maxHeightMobile = lineHeight * 2;\n\n\t\t\t\tif (height > maxHeight || height > maxHeightMobile) {\n\t\t\t\t\tsetShowButton(true);\n\t\t\t\t} else {\n\t\t\t\t\tsetShowButton(false);\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\tsetShowButton(false);\n\t\t\t}\n\t\t}\n\t}, [overview]);\n\n\tconst toggleExpand = () => {\n\t\tsetIsExpanded(!isExpanded);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'hidden text-black [&>*:first-child]:mt-0',\n\t\t\t\t\t!isExpanded && 'md:line-clamp-2',\n\t\t\t\t\tisExpanded && 'md:line-clamp-none'\n\t\t\t\t)}\n\t\t\t\tdangerouslySetInnerHTML={{ __html: overview ?? '' }}\n\t\t\t\tref={overviewRef}\n\t\t\t/>\n\t\t\t{showButton && (\n\t\t\t\t<LinkButton\n\t\t\t\t\tas=\"button\"\n\t\t\t\t\tclassName=\"hidden md:inline-flex bodyMd !font-normal\"\n\t\t\t\t\tintent=\"none\"\n\t\t\t\t\tonClick={toggleExpand}\n\t\t\t\t\tscale=\"sm\"\n\t\t\t\t>\n\t\t\t\t\t{isExpanded ? resources['readLess'] : resources['readMore']}\n\t\t\t\t</LinkButton>\n\t\t\t)}\n\t\t</>\n\t);\n}\n","import React from 'react';\nimport { StarRating } from '@faithlife/commerce-components';\n\nimport { ProductHitResult } from '../types';\nimport { AddToWishListWithForm } from '../../add-to-wish-list';\nimport { useProductInWishList } from '../../add-to-wish-list/hooks';\nimport EnhancedForLogosWithTooltip from '../../shared/enhanced-for-logos-with-tooltip';\nimport { hasValidReviewData } from '../../shared/ratings/review-data';\nimport { PrepubProductStatusSummary } from '../../product/product-details-page/right-column/prepub-product-status-summary';\nimport { useProductCard } from './use-product-card';\nimport { DiscountBadge } from './discount-badge';\nimport { ProductTitle } from './product-title';\nimport { ProductAuthors } from './product-authors';\nimport { ProductOverview } from './product-overview';\nimport { ProductPricing } from './product-pricing';\nimport { ProductImage } from './product-image';\n\ninterface AlgoliaListCardProps {\n\thit: ProductHitResult;\n\tpriority?: boolean;\n\tqueryId?: string | null;\n\tposition?: number;\n}\n\nexport function AlgoliaListCard({ hit, priority, queryId = null, position }: AlgoliaListCardProps) {\n\tconst cardData = useProductCard({ hit, queryId, position });\n\tconst {\n\t\tproductUrl,\n\t\tproductName,\n\t\timageSrc,\n\t\tdiscountPercentage,\n\t\tisDiscounted,\n\t\thandleProductClick,\n\t\tskuId,\n\t\tisOwned,\n\t\tisLogosEdition,\n\t\tprepubProductStatusSummary,\n\t} = cardData;\n\tconst productInWishlist = useProductInWishList(hit.productId, skuId, !isOwned);\n\tconst averageRating = hit.averageRating ?? 0;\n\tconst reviewCount = hit.reviewCount ?? 0;\n\tconst hasReviewData = hasValidReviewData(averageRating, reviewCount);\n\n\treturn (\n\t\t<div className=\"grid grid-cols-[139px_auto] md:grid-cols-[190px_auto]\">\n\t\t\t<div className=\"relative col-span-1 flex w-full items-start justify-center\">\n\t\t\t\t<div className=\"flex w-auto flex-col gap-sp8 pt-2 pb-[43px] lg:pt-3 md:pb-9\">\n\t\t\t\t\t<div className=\"relative\">\n\t\t\t\t\t\t<ProductImage\n\t\t\t\t\t\t\thandleProductClick={handleProductClick}\n\t\t\t\t\t\t\timageSrc={imageSrc}\n\t\t\t\t\t\t\tpriority={priority}\n\t\t\t\t\t\t\tproductName={productName}\n\t\t\t\t\t\t\tproductUrl={productUrl}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{!isOwned && (\n\t\t\t\t\t\t\t<DiscountBadge\n\t\t\t\t\t\t\t\tclassName=\"absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none\"\n\t\t\t\t\t\t\t\tdiscountPercentage={discountPercentage}\n\t\t\t\t\t\t\t\tisDiscounted={isDiscounted}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{isLogosEdition && (\n\t\t\t\t\t\t<div className=\"text-center\">\n\t\t\t\t\t\t\t<EnhancedForLogosWithTooltip />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div className=\"grid p-2 pb-8 md:grid-cols-[auto_168px] md:gap-8 md:pb-2 lg:p-3\">\n\t\t\t\t<div className=\"flex-1\">\n\t\t\t\t\t<ProductTitle handleProductClick={handleProductClick} productName={productName} productUrl={productUrl} />\n\n\t\t\t\t\t<div className=\"mt-sp8\">\n\t\t\t\t\t\t<ProductAuthors authors={hit.authors} />\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{hasReviewData && (\n\t\t\t\t\t\t<div className=\"mt-sp8\">\n\t\t\t\t\t\t\t<StarRating rating={averageRating} reviewCount={reviewCount} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t<div className=\"mt-sp12\">\n\t\t\t\t\t\t<ProductOverview overview={hit.overview} />\n\t\t\t\t\t</div>\n\t\t\t\t\t{prepubProductStatusSummary && (\n\t\t\t\t\t\t<PrepubProductStatusSummary {...prepubProductStatusSummary} variant=\"search-list\" />\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"flex grow-0 flex-col gap-2 lg:gap-3 items-end\">\n\t\t\t\t\t<ProductPricing\n\t\t\t\t\t\tbuttonLayoutClassName=\"w-full flex-col xmd:flex-row md:flex-col max-w-[145px]\"\n\t\t\t\t\t\tcardData={cardData}\n\t\t\t\t\t/>\n\t\t\t\t\t<AddToWishListWithForm {...productInWishlist} variant=\"link\" isOwned={isOwned} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","import React, { useCallback } from 'react';\nimport { Hit } from 'instantsearch.js';\nimport { Hits, useInstantSearch } from 'react-instantsearch';\n\nimport { cn } from '../../util/cn';\nimport * as Skeleton from '../skeleton';\nimport { WishListProductBatchProvider } from '../add-to-wish-list/hooks';\nimport { ProductHit, ProductHitResult } from './types';\nimport { AlgoliaGridCard } from './product-card/algolia-grid-card';\nimport { AlgoliaListCard } from './product-card/algolia-list-card';\n\n// ---------------------------------------------------------------------------\n// ProductHits — grid/list of search result cards\n// ---------------------------------------------------------------------------\n\ninterface ProductHitsProps {\n\tlayoutType: 'grid' | 'list';\n\twishListsProductsUrl: string;\n\tcurrentHitsPerPage: number;\n}\n\nfunction SkeletonBlock({ className, rootClassName }: { className: string; rootClassName?: string }) {\n\treturn <Skeleton.Box className={cn(className, rootClassName)} />;\n}\n\nfunction SkeletonButton({ className }: { className: string }) {\n\treturn <Skeleton.Box className={cn('h-12 inline-flex gap-2 lg:gap-3', className)} />;\n}\n\nfunction ProductSkeleton({ layoutType }: { layoutType: 'grid' | 'list' }) {\n\tif (layoutType === 'list') {\n\t\treturn (\n\t\t\t<Skeleton.Root className=\"animate-pulse\">\n\t\t\t\t<div className=\"grid grid-cols-[139px_auto] md:grid-cols-[190px_auto]\">\n\t\t\t\t\t<div className=\"relative col-span-1 flex w-full items-start justify-center\">\n\t\t\t\t\t\t<div className=\"flex w-auto flex-col gap-sp8 pt-2 pb-[43px] lg:pt-3 md:pb-9\">\n\t\t\t\t\t\t\t<div className=\"relative\">\n\t\t\t\t\t\t\t\t<SkeletonBlock className=\"h-[122px] w-[122px] lg:h-[158px] lg:w-[158px]\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"text-center\">\n\t\t\t\t\t\t\t\t<SkeletonBlock className=\"h-4 w-20\" rootClassName=\"mx-auto h-4 w-20\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"grid gap-sp8 p-2 pb-8 md:grid-cols-[auto_168px] md:gap-8 md:pb-2 lg:p-3\">\n\t\t\t\t\t\t<div className=\"flex-1\">\n\t\t\t\t\t\t\t<SkeletonBlock className=\"h-12 w-full\" />\n\t\t\t\t\t\t\t<SkeletonBlock className=\"mt-sp8 h-4 w-3/5\" />\n\t\t\t\t\t\t\t<SkeletonBlock className=\"mt-sp8 h-5 w-2/5\" />\n\t\t\t\t\t\t\t<SkeletonBlock className=\"mt-sp12 h-16 w-full\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"flex flex-col items-end gap-2 lg:gap-3\">\n\t\t\t\t\t\t\t<div className=\"flex flex-col items-end gap-sp4\">\n\t\t\t\t\t\t\t\t<SkeletonBlock className=\"h-4 w-20\" />\n\t\t\t\t\t\t\t\t<SkeletonBlock className=\"h-7 w-24\" />\n\t\t\t\t\t\t\t\t<SkeletonBlock className=\"h-4 w-16\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<SkeletonButton className=\"w-full max-w-[145px]\" />\n\t\t\t\t\t\t\t<SkeletonBlock className=\"h-4 w-24\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</Skeleton.Root>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Skeleton.Root className=\"animate-pulse grid gap-y-0 grid-rows-subgrid row-span-5 grid-cols-1\">\n\t\t\t<div className=\"relative flex flex-col items-center justify-start gap-sp12 pt-3 lg:pt-4\">\n\t\t\t\t<div className=\"flex h-43.5 w-full items-end justify-center\">\n\t\t\t\t\t<SkeletonBlock\n\t\t\t\t\t\tclassName=\"h-[122px] w-[100px] lg:h-[158px] lg:w-[129px]\"\n\t\t\t\t\t\trootClassName=\"h-[122px] w-[100px] lg:h-[158px] lg:w-[129px]\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<SkeletonBlock className=\"h-4 w-20\" rootClassName=\"mx-auto h-4 w-20\" />\n\t\t\t</div>\n\t\t\t<div className=\"px-2 pt-sp12 pb-1 lg:px-4 lg:pb-2\">\n\t\t\t\t<SkeletonBlock className=\"h-12 w-full\" />\n\t\t\t\t<SkeletonBlock className=\"mt-sp8 h-4 w-3/5\" />\n\t\t\t\t<SkeletonBlock className=\"mt-sp8 h-5 w-2/5\" />\n\t\t\t</div>\n\t\t\t<div className=\"px-2 lg:px-4\" />\n\t\t\t<div className=\"flex items-end px-2 md:pb-1 lg:px-4\">\n\t\t\t\t<div className=\"flex w-full flex-col gap-sp4\">\n\t\t\t\t\t<SkeletonBlock className=\"h-4 w-3/5\" rootClassName=\"h-4 w-3/5\" />\n\t\t\t\t\t<SkeletonBlock className=\"h-7 w-4/5\" rootClassName=\"h-7 w-4/5\" />\n\t\t\t\t\t<SkeletonBlock className=\"h-4 w-2/5\" rootClassName=\"h-4 w-2/5\" />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div className=\"flex items-end justify-center px-2 pb-2 pt-2 lg:px-4 lg:pb-4\">\n\t\t\t\t<SkeletonButton className=\"w-full\" />\n\t\t\t</div>\n\t\t</Skeleton.Root>\n\t);\n}\n\nfunction ProductSkeletons({\n\tlayoutType,\n\tcurrentHitsPerPage,\n}: {\n\tlayoutType: 'grid' | 'list';\n\tcurrentHitsPerPage: number;\n}) {\n\treturn (\n\t\t<ol\n\t\t\taria-label=\"Loading search results\"\n\t\t\tclassName={cn(\n\t\t\t\t'grid grid-cols-1',\n\t\t\t\tlayoutType === 'grid' &&\n\t\t\t\t\t'auto-rows-[max-content_auto_max-content_max-content_max-content] grid-cols-2 gap-sp8 lg:grid-cols-3 lg:gap-sp16',\n\t\t\t\tlayoutType === 'list' && 'gap-6 md:gap-8'\n\t\t\t)}\n\t\t>\n\t\t\t{Array.from({ length: currentHitsPerPage }, (_, index) => (\n\t\t\t\t<li\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\tlayoutType === 'grid' &&\n\t\t\t\t\t\t\t'grid gap-y-0 grid-rows-subgrid row-span-5 grid-cols-1 outline outline-1 outline-grey',\n\t\t\t\t\t\tlayoutType === 'list' && 'first:border-t border-b border-grey-200 first:pt-6 first:md:pt-8'\n\t\t\t\t\t)}\n\t\t\t\t\tkey={index}\n\t\t\t\t>\n\t\t\t\t\t<ProductSkeleton layoutType={layoutType} />\n\t\t\t\t</li>\n\t\t\t))}\n\t\t</ol>\n\t);\n}\n\nfunction toProductHitResult(hit: Hit<ProductHit>): ProductHitResult {\n\treturn {\n\t\t...hit,\n\t\tproductId: hit.productId !== null && hit.productId !== undefined ? hit.productId.toString() : undefined,\n\t};\n}\n\nexport function ProductHits({ layoutType, wishListsProductsUrl, currentHitsPerPage }: ProductHitsProps) {\n\tconst Card = layoutType === 'list' ? AlgoliaListCard : AlgoliaGridCard;\n\tconst { status } = useInstantSearch();\n\tconst HitComponent = useCallback(\n\t\t({ hit }: { hit: Hit<ProductHit> }) => (\n\t\t\t<Card\n\t\t\t\thit={toProductHitResult(hit)}\n\t\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\t\tpriority={typeof hit.__position === 'number' && hit.__position <= 6}\n\t\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\t\tqueryId={(hit as any).__queryID ?? null}\n\t\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\t\tposition={hit.__position}\n\t\t\t/>\n\t\t),\n\t\t[Card]\n\t);\n\n\treturn (\n\t\t<WishListProductBatchProvider wishListsProductsUrl={wishListsProductsUrl}>\n\t\t\t<section aria-label=\"Search results\">\n\t\t\t\t{status === 'stalled' && (\n\t\t\t\t\t<div className=\"pt-4 pb-6 lg:px-4 lg:py-8\">\n\t\t\t\t\t\t<ProductSkeletons layoutType={layoutType} currentHitsPerPage={currentHitsPerPage} />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<Hits\n\t\t\t\t\tclassNames={{\n\t\t\t\t\t\troot: cn('pt-4 pb-6 lg:px-4 lg:py-8', status === 'stalled' && 'hidden'),\n\t\t\t\t\t\tlist: cn(\n\t\t\t\t\t\t\t'grid grid-cols-1',\n\t\t\t\t\t\t\tlayoutType === 'grid' &&\n\t\t\t\t\t\t\t\t'auto-rows-[max-content_auto_max-content_max-content_max-content] grid-cols-2 gap-sp8 lg:grid-cols-3 lg:gap-sp16',\n\t\t\t\t\t\t\tlayoutType === 'list' && 'gap-6 md:gap-8'\n\t\t\t\t\t\t),\n\t\t\t\t\t\titem: cn(\n\t\t\t\t\t\t\t/* the grid definition must match AlgoliaGridCard to pass subgrid tracks to it correctly */\n\t\t\t\t\t\t\tlayoutType === 'grid' &&\n\t\t\t\t\t\t\t\t'grid gap-y-0 grid-rows-subgrid row-span-5 grid-cols-1 outline outline-1 outline-grey',\n\t\t\t\t\t\t\t/* first:pt matches the gap-6/md:gap-8 list gutter so item 1's top spacing matches the gap preceding every other item */\n\t\t\t\t\t\t\tlayoutType === 'list' && 'first:border-t border-b border-grey-200 first:pt-6 first:md:pt-8'\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t\thitComponent={HitComponent}\n\t\t\t\t/>\n\t\t\t</section>\n\t\t</WishListProductBatchProvider>\n\t);\n}\n\nexport default ProductHits;\n","import React from 'react';\nimport { Typography } from '@faithlife/commerce-components';\n\nimport { cn } from '../../util/cn';\nimport { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '../accordion';\n\nexport interface RadioAccordionItem<TValue extends string | number> {\n\tchecked: boolean;\n\tlabel: string;\n\tvalue: TValue;\n}\n\ninterface RadioAccordionProps<TValue extends string | number> {\n\tradioGroupName: string;\n\titems: RadioAccordionItem<TValue>[];\n\tonSelect: (value: TValue) => void;\n\tprefixLabel: string;\n}\n\nexport default function RadioAccordion<TValue extends string | number>({\n\tradioGroupName,\n\titems,\n\tonSelect,\n\tprefixLabel,\n}: RadioAccordionProps<TValue>) {\n\tconst currentItem = items.find(item => item.checked);\n\n\treturn (\n\t\t<Accordion collapsible type=\"single\">\n\t\t\t<AccordionItem value={radioGroupName}>\n\t\t\t\t<AccordionTrigger className=\"border-t border-primary-100 p-4 lg:border-t-0 [&>svg]:text-primary\">\n\t\t\t\t\t<Typography className=\"text-primary-400\" variant=\"bodyRegular\">\n\t\t\t\t\t\t{prefixLabel} {}\n\t\t\t\t\t\t{currentItem && <span className=\"font-semibold\">{currentItem.label}</span>}\n\t\t\t\t\t</Typography>\n\t\t\t\t</AccordionTrigger>\n\t\t\t\t<AccordionContent className=\"m-0 bg-grey-200 p-4\">\n\t\t\t\t\t<div className=\"flex flex-col gap-y-4\">\n\t\t\t\t\t\t{items.map(item => (\n\t\t\t\t\t\t\t<label className=\"bodySm flex cursor-pointer items-center text-black-200\" key={item.value}>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\tchecked={item.checked}\n\t\t\t\t\t\t\t\t\tname={radioGroupName}\n\t\t\t\t\t\t\t\t\tclassName=\"mr-3 h-3.25 w-3.25 border-grey-100 text-primary\"\n\t\t\t\t\t\t\t\t\tonChange={() => onSelect(item.value)}\n\t\t\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t\t\tvalue={item.value}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<span className={cn(item.checked ? 'text-primary' : 'text-black-200 hover:text-secondary-200')}>\n\t\t\t\t\t\t\t\t\t{item.label}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t</AccordionContent>\n\t\t\t</AccordionItem>\n\t\t</Accordion>\n\t);\n}\n","import React from 'react';\nimport { useSortBy } from 'react-instantsearch';\n\nimport { useSearchResources } from './search-resources';\nimport RadioAccordion from './radio-accordion';\n\ninterface SortByItem {\n\tlabel: string;\n\tvalue: string;\n}\n\ninterface SortByAccordionProps {\n\titems: SortByItem[];\n}\n\nexport default function SortByAccordion({ items }: SortByAccordionProps) {\n\tconst resources = useSearchResources();\n\tconst { currentRefinement, refine } = useSortBy({ items });\n\n\treturn (\n\t\t<RadioAccordion\n\t\t\tradioGroupName=\"sort-by\"\n\t\t\titems={items.map(item => ({ ...item, checked: item.value === currentRefinement }))}\n\t\t\tonSelect={refine}\n\t\t\tprefixLabel={resources['sortBy']}\n\t\t/>\n\t);\n}\n","import React from 'react';\nimport { useHitsPerPage } from 'react-instantsearch';\n\nimport { useSearchResources } from './search-resources';\nimport RadioAccordion from './radio-accordion';\n\ninterface HitsPerPageItem {\n\tdefault?: boolean;\n\tlabel: string;\n\tvalue: number;\n}\n\ninterface HitsPerPageAccordionProps {\n\titems: HitsPerPageItem[];\n}\n\nexport default function HitsPerPageAccordion({ items }: HitsPerPageAccordionProps) {\n\tconst resources = useSearchResources();\n\tconst { items: showItems, refine } = useHitsPerPage({ items });\n\n\treturn (\n\t\t<RadioAccordion\n\t\t\tradioGroupName=\"hits-per-page\"\n\t\t\titems={showItems.map(item => ({ ...item, checked: item.isRefined }))}\n\t\t\tonSelect={refine}\n\t\t\tprefixLabel={resources['show']}\n\t\t/>\n\t);\n}\n","import React, { createContext, useContext, useEffect, useState } from 'react';\nimport Cookies from 'js-cookie';\nimport { safeUrl } from './util';\n\nexport enum ViewMode {\n\tgrid = 'grid',\n\tlist = 'list',\n}\n\ninterface ViewModeContextType {\n\tviewMode: ViewMode;\n\tsetViewMode: (mode: ViewMode) => void;\n}\n\nconst ViewModeContext = createContext<ViewModeContextType | null>(null);\n\nexport const viewModeKey = 'viewMode';\nconst viewModeValues = Object.values(ViewMode);\n\nconst getInitialViewMode = (): ViewMode => {\n\tconst url = typeof window !== 'undefined' ? safeUrl(window.location.href) : null;\n\n\tconst urlViewMode = url?.searchParams.get(viewModeKey);\n\tif (viewModeValues.includes(urlViewMode as ViewMode)) {\n\t\treturn urlViewMode as ViewMode;\n\t}\n\n\tconst cookieViewMode = Cookies.get(viewModeKey);\n\tif (viewModeValues.includes(cookieViewMode as ViewMode)) {\n\t\treturn cookieViewMode as ViewMode;\n\t}\n\n\treturn ViewMode.grid;\n};\n\nexport const ViewModeProvider = ({ children }: { children: React.ReactNode }) => {\n\tconst [viewMode, setViewMode] = useState<ViewMode>(() => getInitialViewMode());\n\n\tuseEffect(() => {\n\t\tconst url = typeof window !== 'undefined' ? safeUrl(window.location.href) : null;\n\t\tif (url) {\n\t\t\turl?.searchParams.set(viewModeKey, viewMode);\n\t\t\twindow.history.replaceState({}, '', url);\n\t\t}\n\t\tCookies.set(viewModeKey, viewMode);\n\t}, [viewMode]);\n\n\treturn <ViewModeContext.Provider value={{ viewMode, setViewMode }}>{children}</ViewModeContext.Provider>;\n};\n\nexport const useViewMode = () => {\n\tconst context = useContext(ViewModeContext);\n\n\tif (!context) {\n\t\tthrow new Error('useViewMode must be used within ViewModeProvider');\n\t}\n\n\treturn context;\n};\n","import { StateMapping, UiState } from 'instantsearch.js';\nimport history from 'instantsearch.js/es/lib/routers/history';\n\nimport { SearchCategory, SearchSortOrder } from './types';\nimport { UserSearchFilter } from './user-search-filter-context';\nimport { safeUrl } from './util';\nimport { viewModeKey } from './use-view-mode';\n\n// ---------------------------------------------------------------------------\n// Facet configuration\n// ---------------------------------------------------------------------------\n\nexport interface SimpleFacetConfiguration {\n\ttype: 'simple';\n\talgoliaAttribute: string;\n\trouteKey: string;\n\tisHidden?: boolean;\n}\n\nexport interface HierarchicalFacetConfiguration {\n\ttype: 'hierarchical';\n\talgoliaAttributeBase: string;\n\trouteKeyPrefix: string;\n\tminLevel: number;\n\tmaxLevel: number;\n\tcategoryToken?: string;\n\tisHidden?: boolean;\n}\n\nexport type FacetConfiguration = SimpleFacetConfiguration | HierarchicalFacetConfiguration;\n\n// ---------------------------------------------------------------------------\n// Route state types and helpers\n// ---------------------------------------------------------------------------\n\ntype RouteStateFacets = Record<string, string[]>;\ntype RouteStateFilters = Record<string, string>;\n\nfunction getAllFacetingKeys(facetConfigurations: FacetConfiguration[]): string[] {\n\treturn [\n\t\t...facetConfigurations\n\t\t\t.filter((config): config is SimpleFacetConfiguration => config.type === 'simple')\n\t\t\t.map(config => config.routeKey),\n\t\t...facetConfigurations\n\t\t\t.filter((config): config is HierarchicalFacetConfiguration => config.type === 'hierarchical')\n\t\t\t.flatMap(config => {\n\t\t\t\tconst keys: string[] = [];\n\n\t\t\t\tfor (let level = config.minLevel; level <= config.maxLevel; level += 1) {\n\t\t\t\t\tkeys.push(`${config.routeKeyPrefix}${level}`);\n\t\t\t\t}\n\n\t\t\t\treturn keys;\n\t\t\t}),\n\t];\n}\n\nexport interface RouteState {\n\tquery?: string;\n\n\tfacets?: RouteStateFacets;\n\tfilters?: RouteStateFilters;\n\n\tsortBy?: string;\n\tlimit?: number;\n\tpage?: number;\n}\n\nconst delimiter = '+';\n\nfunction arrayToQueryParam(array: string[] | undefined): string | undefined {\n\treturn array?.length ? array.join(delimiter) : undefined;\n}\n\nfunction emptyIfUndefined<T>(array: T[] | undefined): T[] {\n\treturn array && array.length > 0 ? array : [];\n}\n\nfunction getTrimmedOrUndefinedIfStringEmpty(value: string): string | undefined {\n\tconst trimmed = value.trim();\n\n\treturn trimmed.length > 0 ? trimmed : undefined;\n}\n\ninterface CategoryPageFacetConfiguration {\n\tqueryParamName: string;\n\tvalue: string;\n}\n\ninterface CategoryPageConfiguration {\n\tfacets: CategoryPageFacetConfiguration[];\n\tcategoryPageUrl: string;\n\tpageTitle: string;\n}\n\nfunction getMatchingCategoryPageFromRouteState(\n\trouteState: RouteState,\n\tcategoryPageConfigurations: CategoryPageConfiguration[],\n\tallFacetingKeys: string[]\n): CategoryPageConfiguration | null {\n\tconst facetKeys = new Set([...allFacetingKeys, ...Object.keys(routeState.facets ?? {})]);\n\tconst facets = [...facetKeys].map(key => ({\n\t\tkey,\n\t\tvalue: routeState.facets?.[key],\n\t}));\n\n\tfor (const categoryPageConfiguration of categoryPageConfigurations) {\n\t\tconst matches = checkCategoryPageConfigurationMatches(categoryPageConfiguration, facets);\n\n\t\tif (matches) {\n\t\t\treturn categoryPageConfiguration;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction preserveCustomQueryParams(sourceUrl: URL, targetUrl: URL, preserveKeys: Set<string>) {\n\tfor (const [key, value] of sourceUrl.searchParams.entries()) {\n\t\tif (preserveKeys.has(key)) {\n\t\t\ttargetUrl.searchParams.set(key, value);\n\t\t}\n\t}\n}\n\nfunction preserveNonSearchQueryParams(sourceUrl: URL, targetUrl: URL, searchParamKeys: Set<string>) {\n\tfor (const [key, value] of sourceUrl.searchParams.entries()) {\n\t\tif (!searchParamKeys.has(key)) {\n\t\t\ttargetUrl.searchParams.set(key, value);\n\t\t}\n\t}\n}\n\nfunction writeFacetsSearchParams(url: URL, facets?: RouteStateFacets, excludedKeys?: Set<string>) {\n\tif (!facets) {\n\t\treturn;\n\t}\n\n\tfor (const [key, value] of Object.entries(facets)) {\n\t\tif (excludedKeys?.has(key)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst candidateQueryParamValue = arrayToQueryParam(value);\n\n\t\tif (candidateQueryParamValue !== undefined) {\n\t\t\turl.searchParams.set(key, candidateQueryParamValue);\n\t\t}\n\t}\n}\n\nfunction writeUserFilterSearchParams(targetUrl: URL, userSearchFilters: UserSearchFilter[], sourceUrl: URL) {\n\tfor (const filter of userSearchFilters) {\n\t\tconst value = sourceUrl.searchParams.get(filter.token);\n\n\t\tif (value) {\n\t\t\ttargetUrl.searchParams.set(filter.token, value);\n\t\t}\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// State mapping — Algolia UI state ↔ route state\n// ---------------------------------------------------------------------------\n\nexport function makeStateMapping(\n\tindex: string,\n\tfacetConfigurations: FacetConfiguration[],\n\tsortOrders: SearchSortOrder[]\n): StateMapping<UiState, RouteState> {\n\treturn {\n\t\tstateToRoute: (uiState: UiState) => {\n\t\t\tconst indexUiState = uiState[index];\n\n\t\t\tif (!indexUiState) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst facets: RouteStateFacets = {};\n\n\t\t\tfor (const config of facetConfigurations) {\n\t\t\t\tif (config.type === 'simple') {\n\t\t\t\t\tconst facetValues = indexUiState.refinementList?.[config.algoliaAttribute];\n\n\t\t\t\t\tif (facetValues) {\n\t\t\t\t\t\tfacets[config.routeKey] = facetValues;\n\t\t\t\t\t}\n\t\t\t\t} else if (config.type === 'hierarchical') {\n\t\t\t\t\tfor (let level = config.minLevel; level <= config.maxLevel; level += 1) {\n\t\t\t\t\t\tconst routeKey = `${config.routeKeyPrefix}${level}`;\n\t\t\t\t\t\tconst algoliaAttribute = `${config.algoliaAttributeBase}.lvl${level}`;\n\n\t\t\t\t\t\tconst facetValues = indexUiState.refinementList?.[algoliaAttribute];\n\n\t\t\t\t\t\tif (facetValues) {\n\t\t\t\t\t\t\tfacets[routeKey] = facetValues;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst sortOrder = sortOrders.find(order => order.value === indexUiState.sortBy);\n\n\t\t\treturn {\n\t\t\t\tquery: indexUiState.query,\n\t\t\t\tfacets,\n\t\t\t\tsortBy: sortOrder?.routeValue ?? undefined,\n\t\t\t\tlimit: indexUiState.hitsPerPage,\n\t\t\t\tpage: indexUiState.page,\n\t\t\t} satisfies RouteState;\n\t\t},\n\t\trouteToState: (routeState: RouteState) => {\n\t\t\tconst refinementList: Record<string, string[]> = {};\n\n\t\t\tfor (const config of facetConfigurations) {\n\t\t\t\tif (config.type === 'simple') {\n\t\t\t\t\trefinementList[config.algoliaAttribute] = emptyIfUndefined(routeState.facets?.[config.routeKey]);\n\t\t\t\t} else if (config.type === 'hierarchical') {\n\t\t\t\t\tfor (let level = config.minLevel; level <= config.maxLevel; level += 1) {\n\t\t\t\t\t\tconst routeKey = `${config.routeKeyPrefix}${level}`;\n\n\t\t\t\t\t\tconst algoliaAttribute = `${config.algoliaAttributeBase}.lvl${level}`;\n\n\t\t\t\t\t\trefinementList[algoliaAttribute] = emptyIfUndefined(routeState.facets?.[routeKey]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst sortBy = routeState.sortBy\n\t\t\t\t? sortOrders.find(order => order.routeValue === routeState.sortBy)?.value\n\t\t\t\t: undefined;\n\n\t\t\treturn {\n\t\t\t\t[index]: {\n\t\t\t\t\tquery: routeState.query,\n\t\t\t\t\tsortBy,\n\t\t\t\t\thitsPerPage: routeState.limit,\n\t\t\t\t\trefinementList,\n\t\t\t\t\tpage: routeState.page,\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Category page configuration\n// ---------------------------------------------------------------------------\n\nfunction checkFacetValueConfigurationMatches(\n\tfacetValueConfiguration: string,\n\trouteStateFacetValue: string[] | undefined\n): boolean {\n\tif (routeStateFacetValue === undefined) {\n\t\treturn false;\n\t}\n\n\tif (routeStateFacetValue.length !== 1) {\n\t\treturn false;\n\t}\n\n\treturn facetValueConfiguration === routeStateFacetValue[0];\n}\n\nfunction checkCategoryPageConfigurationMatches(\n\tcategoryPageConfiguration: CategoryPageConfiguration,\n\trouteStateFacets: {\n\t\tkey: string;\n\t\tvalue: string[] | undefined;\n\t}[]\n): boolean {\n\tconst { facets: facetsConfiguration } = categoryPageConfiguration;\n\n\tlet matches = true;\n\n\tfor (const routeStateFacet of routeStateFacets) {\n\t\tconst facetConfiguration = facetsConfiguration.find(f => f.queryParamName === routeStateFacet.key);\n\n\t\tif (facetConfiguration) {\n\t\t\tif (!checkFacetValueConfigurationMatches(facetConfiguration.value, routeStateFacet.value)) {\n\t\t\t\tmatches = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else if (routeStateFacet.value !== undefined && routeStateFacet.value.length > 0) {\n\t\t\tmatches = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn matches;\n}\n\nfunction writeCommonSearchParams(url: URL, routeState: RouteState) {\n\tif (routeState.query) {\n\t\turl.searchParams.set('query', routeState.query);\n\t}\n\n\tif (routeState.sortBy) {\n\t\turl.searchParams.set('sortBy', routeState.sortBy);\n\t}\n\n\tif (routeState.limit !== undefined) {\n\t\turl.searchParams.set('limit', String(routeState.limit));\n\t}\n\n\tif (routeState.page !== undefined) {\n\t\turl.searchParams.set('page', String(routeState.page));\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Router — URL creation and parsing\n// ---------------------------------------------------------------------------\n\nexport function makeRouter(\n\tcategoryPageConfigurations: CategoryPageConfiguration[],\n\tfacetConfigurations: FacetConfiguration[],\n\tuserSearchFilters: UserSearchFilter[] = [],\n\tinitialUrl?: string\n) {\n\tconst allFacetingKeys = getAllFacetingKeys(facetConfigurations);\n\tconst allFacetingKeysSet = new Set<string>(allFacetingKeys);\n\tconst userFilterKeysSet = new Set<string>(userSearchFilters.map(f => f.token));\n\tconst preserveCustomKeysSet = new Set<string>([viewModeKey, 'ownership', 'geographicAvailability']);\n\tconst searchParamKeysSet = new Set<string>([\n\t\t'query',\n\t\t'sortBy',\n\t\t'limit',\n\t\t'page',\n\t\t...allFacetingKeys,\n\t\t...userFilterKeysSet,\n\t\t...preserveCustomKeysSet,\n\t]);\n\tconst categoryPagesByCategoryPageUrl: Map<string, CategoryPageConfiguration> = new Map<\n\t\tstring,\n\t\tCategoryPageConfiguration\n\t>();\n\n\tfor (const configuration of categoryPageConfigurations) {\n\t\tcategoryPagesByCategoryPageUrl.set(configuration.categoryPageUrl, configuration);\n\t}\n\n\treturn history<RouteState>({\n\t\tgetLocation: () => {\n\t\t\tif (typeof window !== 'undefined') {\n\t\t\t\treturn window.location;\n\t\t\t}\n\n\t\t\tconst location = safeUrl(initialUrl ?? '');\n\t\t\tif (!location) {\n\t\t\t\tthrow new Error('A valid initial URL is required to render search server-side.');\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tancestorOrigins: {\n\t\t\t\t\tcontains: () => false,\n\t\t\t\t\titem: () => null,\n\t\t\t\t\tlength: 0,\n\t\t\t\t\t[Symbol.iterator]: function (): IterableIterator<string> {\n\t\t\t\t\t\treturn [][Symbol.iterator]();\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tassign: () => {\n\t\t\t\t\tthrow new Error('Search routing cannot navigate while rendering server-side.');\n\t\t\t\t},\n\t\t\t\thash: location.hash,\n\t\t\t\thost: location.host,\n\t\t\t\thostname: location.hostname,\n\t\t\t\thref: location.href,\n\t\t\t\torigin: location.origin,\n\t\t\t\tpathname: location.pathname,\n\t\t\t\tport: location.port,\n\t\t\t\tprotocol: location.protocol,\n\t\t\t\treload: () => {\n\t\t\t\t\tthrow new Error('Search routing cannot reload while rendering server-side.');\n\t\t\t\t},\n\t\t\t\treplace: () => {\n\t\t\t\t\tthrow new Error('Search routing cannot navigate while rendering server-side.');\n\t\t\t\t},\n\t\t\t\tsearch: location.search,\n\t\t\t\ttoString: () => location.toString(),\n\t\t\t};\n\t\t},\n\t\tcleanUrlOnDispose: false,\n\t\tcreateURL({ location, routeState }: { location: { href: string }; routeState: RouteState }) {\n\t\t\ttry {\n\t\t\t\t// detect if we match a category page\n\t\t\t\tconst matchingCategoryPage = getMatchingCategoryPageFromRouteState(\n\t\t\t\t\trouteState,\n\t\t\t\t\tcategoryPageConfigurations,\n\t\t\t\t\tallFacetingKeys\n\t\t\t\t);\n\n\t\t\t\tconst currentUrl = safeUrl(location.href);\n\t\t\t\tif (!currentUrl) {\n\t\t\t\t\treturn location.href;\n\t\t\t\t}\n\n\t\t\t\tif (matchingCategoryPage) {\n\t\t\t\t\tconst categoryPageUrl = safeUrl(matchingCategoryPage.categoryPageUrl, location.href);\n\t\t\t\t\tif (categoryPageUrl) {\n\t\t\t\t\t\twriteCommonSearchParams(categoryPageUrl, routeState);\n\t\t\t\t\t\tconst categoryFacetKeys = new Set(\n\t\t\t\t\t\t\tmatchingCategoryPage.facets.map(facetConfiguration => facetConfiguration.queryParamName)\n\t\t\t\t\t\t);\n\t\t\t\t\t\twriteFacetsSearchParams(categoryPageUrl, routeState.facets, categoryFacetKeys);\n\t\t\t\t\t\twriteUserFilterSearchParams(categoryPageUrl, userSearchFilters, currentUrl);\n\t\t\t\t\t\tpreserveCustomQueryParams(currentUrl, categoryPageUrl, preserveCustomKeysSet);\n\t\t\t\t\t\tpreserveNonSearchQueryParams(currentUrl, categoryPageUrl, searchParamKeysSet);\n\n\t\t\t\t\t\treturn categoryPageUrl.href;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst url = safeUrl('/search', location.href);\n\t\t\t\tif (!url) {\n\t\t\t\t\treturn location.href;\n\t\t\t\t}\n\n\t\t\t\twriteCommonSearchParams(url, routeState);\n\t\t\t\twriteFacetsSearchParams(url, routeState.facets);\n\t\t\t\twriteUserFilterSearchParams(url, userSearchFilters, currentUrl);\n\t\t\t\tpreserveCustomQueryParams(currentUrl, url, preserveCustomKeysSet);\n\t\t\t\tpreserveNonSearchQueryParams(currentUrl, url, searchParamKeysSet);\n\n\t\t\t\treturn url.href;\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[search] router.createURL failed', err);\n\t\t\t\treturn location.href;\n\t\t\t}\n\t\t},\n\n\t\tparseURL({ location }: { location: { href: string } }) {\n\t\t\ttry {\n\t\t\t\tconst locationUrl = safeUrl(location.href);\n\t\t\t\tif (!locationUrl) {\n\t\t\t\t\treturn {};\n\t\t\t\t}\n\t\t\t\tconst locationPathname = locationUrl.pathname;\n\n\t\t\t\tconst matchingCategoryPage = categoryPagesByCategoryPageUrl.get(locationPathname);\n\n\t\t\t\tconst routeState: RouteState = {};\n\n\t\t\t\tconst addRouteStateFacetValues = (key: string, values: string[]) => {\n\t\t\t\t\tif (values.length === 0) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trouteState.facets ??= {};\n\t\t\t\t\trouteState.facets[key] ??= [];\n\n\t\t\t\t\tfor (const value of values) {\n\t\t\t\t\t\trouteState.facets[key].push(value);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tif (matchingCategoryPage) {\n\t\t\t\t\tfor (const facetConfiguration of matchingCategoryPage.facets) {\n\t\t\t\t\t\taddRouteStateFacetValues(facetConfiguration.queryParamName, [facetConfiguration.value]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst queryParams = locationUrl.searchParams;\n\n\t\t\t\tfor (const [paramName, paramValue] of queryParams.entries()) {\n\t\t\t\t\tif (allFacetingKeysSet.has(paramName)) {\n\t\t\t\t\t\tif (matchingCategoryPage?.facets.some(facet => facet.queryParamName === paramName)) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taddRouteStateFacetValues(\n\t\t\t\t\t\t\tparamName,\n\t\t\t\t\t\t\tparamValue\n\t\t\t\t\t\t\t\t.split(delimiter)\n\t\t\t\t\t\t\t\t.map(v => getTrimmedOrUndefinedIfStringEmpty(v))\n\t\t\t\t\t\t\t\t.filter((v): v is string => v !== undefined)\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (userFilterKeysSet.has(paramName)) {\n\t\t\t\t\t\trouteState.filters ??= {};\n\t\t\t\t\t\trouteState.filters[paramName] = paramValue;\n\t\t\t\t\t} else if (paramName === 'query') {\n\t\t\t\t\t\trouteState.query = getTrimmedOrUndefinedIfStringEmpty(paramValue);\n\t\t\t\t\t} else if (paramName === 'sortBy') {\n\t\t\t\t\t\trouteState.sortBy = paramValue;\n\t\t\t\t\t} else if (paramName === 'limit') {\n\t\t\t\t\t\tconst limit = parseInt(paramValue, 10);\n\n\t\t\t\t\t\tif (Number.isFinite(limit) && limit > 0) {\n\t\t\t\t\t\t\trouteState.limit = limit;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (paramName === 'page') {\n\t\t\t\t\t\tconst page = parseInt(paramValue, 10);\n\n\t\t\t\t\t\tif (Number.isFinite(page) && page >= 1) {\n\t\t\t\t\t\t\trouteState.page = page;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn routeState;\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[search] router.parseURL failed', err);\n\t\t\t\treturn {};\n\t\t\t}\n\t\t},\n\n\t\twindowTitle(routeState: RouteState) {\n\t\t\ttry {\n\t\t\t\tconst matchingCategoryPage = getMatchingCategoryPageFromRouteState(\n\t\t\t\t\trouteState,\n\t\t\t\t\tcategoryPageConfigurations,\n\t\t\t\t\tallFacetingKeys\n\t\t\t\t);\n\n\t\t\t\tif (matchingCategoryPage) {\n\t\t\t\t\treturn matchingCategoryPage.pageTitle;\n\t\t\t\t}\n\n\t\t\t\treturn 'Search';\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[search] router.windowTitle failed', err);\n\t\t\t\treturn 'Search';\n\t\t\t}\n\t\t},\n\t});\n}\n\n// ---------------------------------------------------------------------------\n// Convert search categories to category page configurations\n// ---------------------------------------------------------------------------\n\nexport function convertSearchCategoriesToCategoryPageConfiguration(\n\tcategories: SearchCategory[]\n): CategoryPageConfiguration[] {\n\treturn (categories ?? [])\n\t\t.map(category => {\n\t\t\tif (!category) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst categoryPageUrl = category.categoryPageUrl;\n\t\t\tif (!categoryPageUrl) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif (!category.facetRouteKey) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcategoryPageUrl,\n\t\t\t\tfacets: [\n\t\t\t\t\t{\n\t\t\t\t\t\tqueryParamName: category.facetRouteKey,\n\t\t\t\t\t\tvalue: category.displayName,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tpageTitle: category.pageTitle,\n\t\t\t} satisfies CategoryPageConfiguration;\n\t\t})\n\t\t.filter((x): x is CategoryPageConfiguration => x !== null);\n}\n","import { useEffect, useState } from 'react';\n\nexport const hydrationSettledAttribute = 'data-hydration-settled';\n\n/**\n * Reports when the calling component has stopped re-rendering after hydration.\n *\n * End-to-end tests need to know that no further widget can mount, because mounting one calls\n * `addWidgets`, which schedules a search once `ResetScheduleSearch` has restored `scheduleSearch`.\n * The timer is re-armed by every render and fires from a macrotask, so once it resolves any search\n * deferred to a microtask has already reached the network layer.\n *\n * The caller must subscribe to InstantSearch renders (via `useInstantSearch`) so that search\n * cycles re-arm the timer too.\n */\nexport default function useHydrationSettled(): boolean {\n\tconst [isSettled, setIsSettled] = useState(false);\n\n\tuseEffect(() => {\n\t\tconst timeoutId = window.setTimeout(() => setIsSettled(true), 0);\n\t\treturn () => window.clearTimeout(timeoutId);\n\t});\n\n\treturn isSettled;\n}\n","import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { CommandSentence } from '@faithlife/command-sentence-control';\nimport { Button, Typography } from '@faithlife/commerce-components';\nimport { ChevronDown } from 'lucide-react';\nimport { UiState } from 'instantsearch.js';\nimport type { InstantSearchServerState } from 'react-instantsearch-core';\nimport {\n\tConfigure,\n\tConfigureProps,\n\tInstantSearch,\n\tInstantSearchProps,\n\tInstantSearchSSRProvider,\n} from 'react-instantsearch';\nimport {\n\tPagination,\n\tuseHitsPerPage,\n\tuseInstantSearch,\n\tuseCurrentRefinements,\n\tusePagination,\n\tuseSearchBox,\n\tuseSortBy,\n} from 'react-instantsearch';\nimport Drawer from '../shared/drawer';\nimport {\n\tDropdownMenu,\n\tDropdownMenuContent,\n\tDropdownMenuRadioGroup,\n\tDropdownMenuRadioItem,\n\tDropdownMenuTrigger,\n} from '../shared/dropdown-menu';\nimport useScreensize from '../../util/hooks/use-screensize';\n\nimport { cn } from '../../util/cn';\nimport { PerUserDataContextProvider, useCurrentUser } from '../per-user-data/per-user-data-context';\n\nimport { safeJsonParse } from '../../util/safe-json-parse';\nimport { useLocalization } from '../../localization';\nimport { useLocation } from '../../location';\nimport ErrorBoundary from '../error-boundary';\nimport { BooksByAuthor } from '../shared/books-by-author';\nimport { AuthorBatch } from '../../hooks/use-author';\nimport { PublisherBatch } from '../../hooks/use-publisher';\nimport type { SectionContentViewModel } from '../../builder';\nimport CategoryContent from './category-content';\nimport {\n\tUserSearchFilter,\n\tUserSearchFilters,\n\tUserSearchFilterProvider,\n\tuseUserSearchFilterContext,\n} from './user-search-filter-context';\nimport { Categories } from './filters';\nimport CurrentQueryRefinement, { CurrentRefinements } from './refinements';\nimport HiddenFacetRefinements from './hidden-facet-refinements';\nimport ProductHits from './products';\nimport SortByAccordion from './sort-by-accordion';\nimport HitsPerPageAccordion from './hits-per-page-accordion';\nimport { SearchCategory, SearchSortOrder } from './types';\nimport { makeStateMapping, makeRouter, convertSearchCategoriesToCategoryPageConfiguration } from './routing';\nimport type { FacetConfiguration, RouteState } from './routing';\nexport { SearchResourcesContext, useSearchResources } from './search-resources';\nimport { SearchResourcesContext, useSearchResources } from './search-resources';\nimport { useSearchImpressions } from './hooks/use-search-impressions';\nimport { useSearchAnalytics } from './hooks/use-search-analytics';\nexport { AlgoliaSearchContextProvider, useAlgoliaSearch } from './algolia-search-context';\nimport { AlgoliaSearchContextProvider, useAlgoliaSearch } from './algolia-search-context';\nimport { useViewMode, ViewMode, ViewModeProvider } from './use-view-mode';\nimport useHydrationSettled, { hydrationSettledAttribute } from './use-hydration-settled';\n\n// ---------------------------------------------------------------------------\n// AlgoliaSSRProvider / AlgoliaProvider — InstantSearch + Configure wrappers\n// ---------------------------------------------------------------------------\n\ntype AlgoliaSearchParameters = Record<string, any>;\n\ntype ConfigurableConfigureProps = Pick<\n\tConfigureProps,\n\t'attributesToHighlight' | 'attributesToRetrieve' | 'queryType' | 'restrictSearchableAttributes'\n> & { searchParameters?: AlgoliaSearchParameters; userSearchFilters?: UserSearchFilter[] };\n\ntype AlgoliaProviderProps<TUiState extends UiState, TRouteState> = Pick<\n\tInstantSearchProps<TUiState, TRouteState>,\n\t'routing' | 'searchClient'\n> &\n\tConfigurableConfigureProps;\n\nfunction AlgoliaSSRProvider<TUiState extends UiState = UiState, TRouteState = TUiState>(\n\tprops: React.PropsWithChildren<AlgoliaProviderProps<TUiState, TRouteState>>\n) {\n\treturn <AlgoliaProvider {...props} />;\n}\n\nfunction AlgoliaProvider<TUiState extends UiState = UiState, TRouteState = TUiState>({\n\tattributesToHighlight,\n\tattributesToRetrieve,\n\tqueryType,\n\trestrictSearchableAttributes,\n\trouting,\n\tsearchClient,\n\tsearchParameters,\n\tchildren,\n}: React.PropsWithChildren<AlgoliaProviderProps<TUiState, TRouteState>>) {\n\tconst { indexName } = useAlgoliaSearch();\n\n\treturn (\n\t\t<ViewModeProvider>\n\t\t\t<InstantSearch\n\t\t\t\tfuture={{\n\t\t\t\t\tpreserveSharedStateOnUnmount: true,\n\t\t\t\t}}\n\t\t\t\tindexName={indexName}\n\t\t\t\tinsights\n\t\t\t\trouting={routing}\n\t\t\t\tsearchClient={searchClient}\n\t\t\t>\n\t\t\t\t<ConfigureCore\n\t\t\t\t\tattributesToHighlight={attributesToHighlight}\n\t\t\t\t\tattributesToRetrieve={attributesToRetrieve}\n\t\t\t\t\tqueryType={queryType}\n\t\t\t\t\trestrictSearchableAttributes={restrictSearchableAttributes}\n\t\t\t\t\tsearchParameters={searchParameters}\n\t\t\t\t/>\n\t\t\t\t{children}\n\t\t\t</InstantSearch>\n\t\t</ViewModeProvider>\n\t);\n}\n\nconst ParameterBlacklist = new Set(['facets']);\n\nfunction ConfigureCore({\n\tattributesToHighlight,\n\tattributesToRetrieve,\n\tqueryType,\n\trestrictSearchableAttributes,\n\tsearchParameters,\n}: ConfigurableConfigureProps) {\n\tconst { selectedFilterOptions, userSearchFilters } = useUserSearchFilterContext();\n\n\tconst props = useMemo(() => {\n\t\tconst mergedParams = { ...(searchParameters ?? {}) };\n\t\tconst userFilters = Array.isArray(userSearchFilters) ? userSearchFilters : [];\n\n\t\tconst selectedOptions = userFilters\n\t\t\t.map(uf => {\n\t\t\t\tconst selectedOptionToken = selectedFilterOptions[uf.token];\n\t\t\t\tif (!selectedOptionToken) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst selectedOption = uf.options?.find(o => o.token === selectedOptionToken);\n\t\t\t\tif (!selectedOption?.algoliaValue) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn selectedOption.algoliaValue;\n\t\t\t})\n\t\t\t.filter((o): o is string => typeof o === 'string' && o.length > 0);\n\n\t\tconst filterParts = [mergedParams.filters, ...selectedOptions].filter(\n\t\t\t(f): f is string => typeof f === 'string' && f.length > 0\n\t\t);\n\t\tif (filterParts.length > 0) {\n\t\t\tmergedParams.filters = filterParts.join(' AND ');\n\t\t} else {\n\t\t\tdelete mergedParams.filters;\n\t\t}\n\n\t\treturn Object.fromEntries(Object.entries(mergedParams).filter(([key]) => !ParameterBlacklist.has(key)));\n\t}, [searchParameters, userSearchFilters, selectedFilterOptions]);\n\n\treturn (\n\t\t<Configure\n\t\t\tattributesToHighlight={attributesToHighlight}\n\t\t\tattributesToRetrieve={attributesToRetrieve}\n\t\t\tdistinct\n\t\t\tqueryType={queryType}\n\t\t\trestrictSearchableAttributes={restrictSearchableAttributes}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n// ---------------------------------------------------------------------------\n// Icons\n// ---------------------------------------------------------------------------\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction CloseIcon({ className, fillColor: _fillColor, ...rest }: any) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={className}\n\t\t\tfill=\"none\"\n\t\t\theight=\"16\"\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\twidth=\"16\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t{...rest}\n\t\t>\n\t\t\t<path d=\"M12.5 3.5L3.5 12.5M3.5 3.5l9 9\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.5\" />\n\t\t</svg>\n\t);\n}\n\nfunction FilterIcon({ className, ...rest }: any) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={className}\n\t\t\tfill=\"none\"\n\t\t\theight=\"16\"\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\twidth=\"16\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t{...rest}\n\t\t>\n\t\t\t<path d=\"M2 4h12M4 8h8M6 12h4\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.5\" />\n\t\t</svg>\n\t);\n}\n\nfunction LayoutGridIcon({ className, ...rest }: any) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={className}\n\t\t\tfill=\"none\"\n\t\t\theight=\"16\"\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\twidth=\"16\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t{...rest}\n\t\t>\n\t\t\t<rect height=\"5\" rx=\"1\" stroke=\"currentColor\" width=\"5\" x=\"1.5\" y=\"1.5\" />\n\t\t\t<rect height=\"5\" rx=\"1\" stroke=\"currentColor\" width=\"5\" x=\"9.5\" y=\"1.5\" />\n\t\t\t<rect height=\"5\" rx=\"1\" stroke=\"currentColor\" width=\"5\" x=\"1.5\" y=\"9.5\" />\n\t\t\t<rect height=\"5\" rx=\"1\" stroke=\"currentColor\" width=\"5\" x=\"9.5\" y=\"9.5\" />\n\t\t</svg>\n\t);\n}\n\nfunction LayoutListIcon({ className, ...rest }: any) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={className}\n\t\t\tfill=\"none\"\n\t\t\theight=\"16\"\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\twidth=\"16\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t{...rest}\n\t\t>\n\t\t\t<rect height=\"3\" rx=\"1\" stroke=\"currentColor\" width=\"14\" x=\"1\" y=\"1.5\" />\n\t\t\t<rect height=\"3\" rx=\"1\" stroke=\"currentColor\" width=\"14\" x=\"1\" y=\"6.5\" />\n\t\t\t<rect height=\"3\" rx=\"1\" stroke=\"currentColor\" width=\"14\" x=\"1\" y=\"11.5\" />\n\t\t</svg>\n\t);\n}\n\n// ---------------------------------------------------------------------------\n// Layout buttons — grid/list toggle\n// ---------------------------------------------------------------------------\n\nconst LayoutButtonOptions = [\n\t{ label: 'Grid Layout', value: ViewMode.grid, icon: LayoutGridIcon, additionalClassNames: 'lg:p-[6px]' },\n\t{ label: 'List Layout', value: ViewMode.list, icon: LayoutListIcon, additionalClassNames: 'lg:px-[3px] lg:py-[6px]' },\n];\n\nfunction LayoutButtons({\n\tcurrentLayoutType,\n\tsetLayoutType,\n}: {\n\tcurrentLayoutType: ViewMode;\n\tsetLayoutType: (mode: ViewMode) => void;\n}) {\n\treturn (\n\t\t<div className=\"flex gap-[6px]\">\n\t\t\t{LayoutButtonOptions.map(option => {\n\t\t\t\tconst isSelected = currentLayoutType === option.value;\n\t\t\t\tconst IconComponent = option.icon;\n\n\t\t\t\treturn (\n\t\t\t\t\t<button\n\t\t\t\t\t\tkey={option.value}\n\t\t\t\t\t\taria-label={option.label}\n\t\t\t\t\t\taria-pressed={isSelected}\n\t\t\t\t\t\tonClick={() => setLayoutType(option.value)}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'px-sp16 py-sp16',\n\t\t\t\t\t\t\t'inline-flex items-center gap-sp8',\n\t\t\t\t\t\t\t'rounded-[4px] border border-primary-500 lg:border-0',\n\t\t\t\t\t\t\t'cursor-pointer',\n\t\t\t\t\t\t\t'text-black-100 aria-pressed:text-primary-400',\n\t\t\t\t\t\t\toption.additionalClassNames\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<IconComponent />\n\t\t\t\t\t</button>\n\t\t\t\t);\n\t\t\t})}\n\t\t</div>\n\t);\n}\n\n// ---------------------------------------------------------------------------\n// ScrollToTopOnPaginationChange\n// ---------------------------------------------------------------------------\n\nfunction DesktopSearchControl({\n\tprefixText,\n\tvalue,\n\titems,\n\tonChange,\n\ttestId,\n\tcontentClassName,\n}: {\n\tprefixText: string;\n\tvalue: string | number;\n\titems: { label: string; value: string | number }[];\n\tonChange: (value: string | number) => void;\n\ttestId: string;\n\tcontentClassName?: string;\n}) {\n\tconst selectedItem = useMemo(() => {\n\t\treturn items.find(item => item.value === value) ?? items[0];\n\t}, [items, value]);\n\n\tconst selectedLabel = selectedItem?.label ?? value.toString();\n\n\tconst handleValueChange = useCallback(\n\t\t(newValue: string) => {\n\t\t\tconst matchedItem = items.find(item => item.value.toString() === newValue);\n\t\t\tif (matchedItem) {\n\t\t\t\tonChange(matchedItem.value);\n\t\t\t}\n\t\t},\n\t\t[items, onChange]\n\t);\n\n\treturn (\n\t\t<DropdownMenu>\n\t\t\t<DropdownMenuTrigger\n\t\t\t\tclassName=\"inline-flex cursor-pointer items-center whitespace-nowrap border-0 bg-transparent p-0 text-black [&[data-state=open]>svg]:rotate-180\"\n\t\t\t\tdata-testid={testId}\n\t\t\t>\n\t\t\t\t<span className=\"mr-[3px] font-normal\">{prefixText}</span>\n\t\t\t\t<span className=\"font-semibold\">{selectedLabel}</span>\n\t\t\t\t<ChevronDown className=\"ml-[2px] h-4 w-4 transition-transform\" />\n\t\t\t</DropdownMenuTrigger>\n\t\t\t<DropdownMenuContent className={contentClassName}>\n\t\t\t\t<DropdownMenuRadioGroup onValueChange={handleValueChange} value={value.toString()}>\n\t\t\t\t\t{items.map(item => (\n\t\t\t\t\t\t<DropdownMenuRadioItem\n\t\t\t\t\t\t\tclassName=\"w-full data-[state=checked]:bg-primary-100 active:bg-secondary-100 focus-visible:ring-2 focus-visible:ring-primary\"\n\t\t\t\t\t\t\tkey={item.value.toString()}\n\t\t\t\t\t\t\tvalue={item.value.toString()}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{item.label}\n\t\t\t\t\t\t</DropdownMenuRadioItem>\n\t\t\t\t\t))}\n\t\t\t\t</DropdownMenuRadioGroup>\n\t\t\t</DropdownMenuContent>\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction ScrollToTopOnPaginationChange() {\n\tconst { currentRefinement } = usePagination();\n\n\tuseEffect(() => {\n\t\twindow.scrollTo({ top: 0, behavior: 'smooth' });\n\t}, [currentRefinement]);\n\n\treturn null;\n}\n\nfunction NoResultsState({ query }: { query: string }) {\n\tconst resources = useSearchResources();\n\tconst normalizedQuery = query.trim();\n\tconst noResultsMessageTemplate = resources['noResults'];\n\tconst searchTips = [resources['checkSpelling'], resources['differentKeywords'], resources['lessSpecific']];\n\n\treturn (\n\t\t<section className=\"my-sp60 mx-auto flex w-full max-w-[640px] flex-col items-start gap-sp48 rounded-md border border-grey-200 bg-grey-50 p-sp60 text-left shadow-sm\">\n\t\t\t<Typography className=\"break-words text-left font-semibold text-black\" tag=\"p\" variant=\"bodyLarge\">\n\t\t\t\t{normalizedQuery && (\n\t\t\t\t\t<CommandSentence Container={React.Fragment} template={noResultsMessageTemplate}>\n\t\t\t\t\t\t<CommandSentence.Field name=\"QUERY\">{normalizedQuery}</CommandSentence.Field>\n\t\t\t\t\t</CommandSentence>\n\t\t\t\t)}\n\t\t\t</Typography>\n\t\t\t<div className=\"flex flex-col items-start gap-sp8 text-left text-black\">\n\t\t\t\t<Typography className=\"font-semibold text-black\" tag=\"p\" variant=\"bodyRegular\">\n\t\t\t\t\t{resources['searchTips']}\n\t\t\t\t</Typography>\n\t\t\t\t<ul className=\"list-disc pl-5\">\n\t\t\t\t\t{searchTips.map(tip => (\n\t\t\t\t\t\t<li className=\"bodyMd\" key={tip}>\n\t\t\t\t\t\t\t{tip}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t))}\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t\t<Button onClick={() => window.location.assign('/search')} type=\"button\" variant=\"primary\">\n\t\t\t\t{resources['seeAllProducts']}\n\t\t\t</Button>\n\t\t</section>\n\t);\n}\n// ---------------------------------------------------------------------------\n// FilterSortLayout — main search page layout\n// ---------------------------------------------------------------------------\n\nconst FilterSortLayout = ({\n\twishListsProductsUrl,\n\tenableAuthorBioView,\n\tpageLimits,\n\tsortOrders,\n\tsearchResultsAbove,\n}: {\n\twishListsProductsUrl: string;\n\tenableAuthorBioView: boolean;\n\tpageLimits: number[];\n\tsortOrders: SearchSortOrder[];\n\tsearchResultsAbove?: SectionContentViewModel[];\n}) => {\n\tconst resources = useSearchResources();\n\tconst authorBioResources = useLocalization('CommerceWeb.Resources.Search.AuthorBio');\n\n\tconst [isMobileFilterOpen, setIsMobileFilterOpen] = useState(false);\n\n\tconst { viewMode, setViewMode } = useViewMode();\n\tconst { isMobile, isDesktop } = useScreensize();\n\tconst isHydrationSettled = useHydrationSettled();\n\n\tuseSearchImpressions();\n\tuseSearchAnalytics();\n\tconst { results } = useInstantSearch();\n\tconst { query } = useSearchBox();\n\tconst hasNoSearchResults = !results.__isArtificial && results.nbHits === 0;\n\tconst shouldShowResultsRoute = !hasNoSearchResults;\n\tconst { items: currentRefinements } = useCurrentRefinements();\n\n\tconst allSortItems = useMemo(\n\t\t() =>\n\t\t\tsortOrders.map(sortOrder => ({\n\t\t\t\tlabel: resources[sortOrder.label] ?? sortOrder.label,\n\t\t\t\tvalue: sortOrder.value,\n\t\t\t\tisPrepub: sortOrder.isPrepub,\n\t\t\t})),\n\t\t[resources, sortOrders]\n\t);\n\tconst { currentRefinement: currentSortBy, refine: refineSortBy } = useSortBy({ items: allSortItems });\n\tconst hasPrepubCategory = currentRefinements.some(\n\t\titem =>\n\t\t\titem.attribute === 'categories.lvl1' &&\n\t\t\titem.refinements?.some(refinement => refinement.value === 'status > prepub')\n\t);\n\tconst sortItems = useMemo(\n\t\t() => allSortItems.filter(item => !item.isPrepub || hasPrepubCategory || item.value === currentSortBy),\n\t\t[allSortItems, currentSortBy, hasPrepubCategory]\n\t);\n\n\tconst hitsPerPageItems = useMemo(\n\t\t() => pageLimits.map((pageLimit, index) => ({ default: index === 0, label: String(pageLimit), value: pageLimit })),\n\t\t[pageLimits]\n\t);\n\tconst { items: showItems, refine: refineHitsPerPage } = useHitsPerPage({\n\t\titems: hitsPerPageItems,\n\t});\n\tconst currentHitsPerPage = showItems.find(item => item.isRefined)?.value ?? hitsPerPageItems[0].value;\n\n\tconst closeFilter = useCallback(() => setIsMobileFilterOpen(false), []);\n\tconst toggleFilter = useCallback(() => setIsMobileFilterOpen(prev => !prev), []);\n\n\t// Close when resized to desktop\n\tuseEffect(() => {\n\t\tif (isDesktop) {\n\t\t\tcloseFilter();\n\t\t}\n\t}, [isDesktop, closeFilter]);\n\n\tuseEffect(() => {\n\t\tif (hasNoSearchResults) {\n\t\t\tcloseFilter();\n\t\t}\n\t}, [hasNoSearchResults, closeFilter]);\n\n\t// Shared filter panel content used in both mobile fullscreen and tablet drawer\n\tconst filterPanelContent = (\n\t\t<div className=\"isolate flex h-full flex-col\">\n\t\t\t{/* Sticky header — title + close button always visible */}\n\t\t\t<div className=\"sticky top-0 z-10 flex items-center justify-between bg-white py-4 pl-4 pr-5 shadow-sm\">\n\t\t\t\t<Typography className=\"!font-medium text-primary-400\" variant=\"bodyLarge\">\n\t\t\t\t\t{resources['filterAndSort']}\n\t\t\t\t</Typography>\n\t\t\t\t<button\n\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\tclassName=\"w-auto border-0 bg-transparent p-0 hover:bg-transparent\"\n\t\t\t\t\tonClick={closeFilter}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t>\n\t\t\t\t\t<CloseIcon className=\"h-4 w-4\" fillColor=\"fill-primary-400\" />\n\t\t\t\t</button>\n\t\t\t</div>\n\n\t\t\t{/* Scrollable body — active refinements, \"All filters\" label, sort, filter accordions, see results */}\n\t\t\t<div className=\"flex-1 overflow-y-auto\">\n\t\t\t\t<div className=\"px-4 pt-4\">\n\t\t\t\t\t<Typography className=\"mb-2 text-black\" variant=\"bodySmall\">\n\t\t\t\t\t\t{resources['allFilters']}\n\t\t\t\t\t</Typography>\n\t\t\t\t\t<div className=\"mb-4 flex flex-wrap gap-1\">\n\t\t\t\t\t\t<CurrentQueryRefinement />\n\t\t\t\t\t\t<CurrentRefinements />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<SortByAccordion items={sortItems} />\n\t\t\t\t<HitsPerPageAccordion items={hitsPerPageItems} />\n\t\t\t\t<Categories />\n\t\t\t\t<div className=\"border-t border-grey-200 p-4\">\n\t\t\t\t\t<Button className=\"w-full\" onClick={closeFilter} type=\"button\" variant=\"primary\">\n\t\t\t\t\t\t{resources['seeResults']}\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{/* Tablet & Mobile: left-side slide-in drawer with scrim via react-modern-drawer, full screen on mobile*/}\n\t\t\t{!isDesktop && shouldShowResultsRoute && (\n\t\t\t\t<Drawer\n\t\t\t\t\tid=\"search-filter-drawer\"\n\t\t\t\t\tisOpen={isMobileFilterOpen}\n\t\t\t\t\tonClose={closeFilter}\n\t\t\t\t\tplacement=\"left\"\n\t\t\t\t\tsize={isMobile ? '100vw' : '320px' /* isTablet */}\n\t\t\t\t\tzIndex={5000}\n\t\t\t\t>\n\t\t\t\t\t<div className=\"h-full bg-white\">{filterPanelContent}</div>\n\t\t\t\t</Drawer>\n\t\t\t)}\n\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'relative grid gap-8 px-4 md:px-6 lg:mx-auto lg:max-w-[1323px] xxlg:px-4',\n\t\t\t\t\tshouldShowResultsRoute ? 'lg:grid-cols-[300px_auto] xl:grid-cols-[375px_auto]' : 'lg:grid-cols-1'\n\t\t\t\t)}\n\t\t\t\t{...{ [hydrationSettledAttribute]: isHydrationSettled || undefined }}\n\t\t\t>\n\t\t\t\t<ScrollToTopOnPaginationChange />\n\n\t\t\t\t{/* Desktop: static sidebar (always visible in grid flow) */}\n\t\t\t\t{shouldShowResultsRoute && (\n\t\t\t\t\t<div className=\"mt-sp20 hidden self-start border-b border-primary-100 lg:block\">\n\t\t\t\t\t\t<Typography className=\"mb-8 text-black\" variant=\"bodyLarge\">\n\t\t\t\t\t\t\t{resources['allFilters']}\n\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t<Categories />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t<div>\n\t\t\t\t\t<div className=\"flex flex-col gap-8\">\n\t\t\t\t\t\t<CategoryContent sectionKind=\"searchResultsAbove\" initialSectionContents={searchResultsAbove} />\n\t\t\t\t\t\t{enableAuthorBioView && <BooksByAuthor resources={authorBioResources} />}\n\t\t\t\t\t\t{hasNoSearchResults ? (\n\t\t\t\t\t\t\t<NoResultsState query={query} />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div className=\"mt-sp20 -mx-4 flex flex-col-reverse justify-between px-4 md:-mx-6 md:px-6 lg:mx-0 lg:flex-row lg:items-start lg:px-0\">\n\t\t\t\t\t\t\t\t<div className=\"mt-4 flex flex-wrap items-center gap-1 lg:mt-0 lg:min-w-0 lg:flex-1\">\n\t\t\t\t\t\t\t\t\t<CurrentQueryRefinement />\n\t\t\t\t\t\t\t\t\t<CurrentRefinements />\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t<div className=\"flex shrink-0 gap-8\">\n\t\t\t\t\t\t\t\t\t<div className=\"mr-auto lg:hidden\">\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"inline-flex cursor-pointer items-center gap-sp8 rounded-[4px] border border-primary-500 px-sp16 py-sp16 text-primary-500 focus:outline-0 focus:ring-0\"\n\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"filter-and-sort-button\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={toggleFilter}\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<FilterIcon />\n\t\t\t\t\t\t\t\t\t\t\t<Typography className=\"text-primary-500 font-medium leading-[100%]\" variant=\"bodySmall\">\n\t\t\t\t\t\t\t\t\t\t\t\t{resources['filterAndSort']}\n\t\t\t\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<LayoutButtons currentLayoutType={viewMode} setLayoutType={setViewMode} />\n\t\t\t\t\t\t\t\t\t<div className=\"bodyMd hidden shrink-0 items-center text-black lg:flex\">\n\t\t\t\t\t\t\t\t\t\t<DesktopSearchControl\n\t\t\t\t\t\t\t\t\t\t\tonChange={newSortBy => refineSortBy(newSortBy.toString())}\n\t\t\t\t\t\t\t\t\t\t\titems={sortItems}\n\t\t\t\t\t\t\t\t\t\t\tprefixText={resources['sortBy']}\n\t\t\t\t\t\t\t\t\t\t\ttestId=\"sort-by-menu-button\"\n\t\t\t\t\t\t\t\t\t\t\tvalue={currentSortBy ?? sortItems[0].value}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"bodyMd hidden shrink-0 items-center text-black lg:flex\">\n\t\t\t\t\t\t\t\t\t\t<DesktopSearchControl\n\t\t\t\t\t\t\t\t\t\t\tcontentClassName=\"w-(--radix-popper-anchor-width) min-w-0\"\n\t\t\t\t\t\t\t\t\t\t\tonChange={newHitsPerPage => refineHitsPerPage(Number(newHitsPerPage))}\n\t\t\t\t\t\t\t\t\t\t\titems={showItems.map(item => ({\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: item.label,\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: item.value,\n\t\t\t\t\t\t\t\t\t\t\t}))}\n\t\t\t\t\t\t\t\t\t\t\tprefixText={resources['show']}\n\t\t\t\t\t\t\t\t\t\t\ttestId=\"hits-per-page-menu-button\"\n\t\t\t\t\t\t\t\t\t\t\tvalue={currentHitsPerPage ?? hitsPerPageItems[0].value}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t{shouldShowResultsRoute && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ProductHits\n\t\t\t\t\t\t\t\tlayoutType={viewMode}\n\t\t\t\t\t\t\t\twishListsProductsUrl={wishListsProductsUrl}\n\t\t\t\t\t\t\t\tcurrentHitsPerPage={currentHitsPerPage}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Pagination\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'[&>ul>li.previous-page-item>.ais-Pagination-link]:bodyLg',\n\t\t\t\t\t\t\t\t\t'[&>ul>li.next-page-item>.ais-Pagination-link]:bodyLg'\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\t\t\troot: 'py-4 lg:px-4 lg:py-8',\n\t\t\t\t\t\t\t\t\tnoRefinementRoot: 'hidden',\n\t\t\t\t\t\t\t\t\tlist: 'flex gap-[2px] items-center justify-center',\n\t\t\t\t\t\t\t\t\titem: 'bodySm text-black h-6 w-[23px]',\n\t\t\t\t\t\t\t\t\tpreviousPageItem: 'previous-page-item text-primary',\n\t\t\t\t\t\t\t\t\tpageItem: 'pageItem',\n\t\t\t\t\t\t\t\t\tselectedItem: 'bg-primary-100 text-primary',\n\t\t\t\t\t\t\t\t\tdisabledItem: 'opacity-25',\n\t\t\t\t\t\t\t\t\tnextPageItem: 'next-page-item text-primary',\n\t\t\t\t\t\t\t\t\tlink: 'flex items-center justify-center px-2 py-1 h-full w-full',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tshowFirst={false}\n\t\t\t\t\t\t\t\tshowLast={false}\n\t\t\t\t\t\t\t\tshowNext\n\t\t\t\t\t\t\t\tshowPrevious\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n};\n\n// ---------------------------------------------------------------------------\n// InstantSearchWrapper — wires up Algolia routing + providers\n// ---------------------------------------------------------------------------\n\nconst InstantSearchWrapper = ({\n\tcategories,\n\tfacetConfigurations,\n\tsearchParameters,\n\twishListsProductsUrl,\n\tenableAuthorBioView,\n\tpageLimits,\n\tsortOrders,\n\tattributesToRetrieve,\n\tsearchResultsAbove,\n}: {\n\tcategories: SearchCategory[];\n\tfacetConfigurations: FacetConfiguration[];\n\tsearchParameters: AlgoliaSearchParameters;\n\twishListsProductsUrl: string;\n\tenableAuthorBioView: boolean;\n\tpageLimits: number[];\n\tsortOrders: SearchSortOrder[];\n\tattributesToRetrieve: string[];\n\tsearchResultsAbove?: SectionContentViewModel[];\n}) => {\n\tconst { client: searchClient, indexName } = useAlgoliaSearch();\n\tconst { userSearchFilters } = useUserSearchFilterContext();\n\tconst { href } = useLocation();\n\tconst stateMapping = useMemo(\n\t\t() => makeStateMapping(indexName, facetConfigurations, sortOrders),\n\t\t[indexName, facetConfigurations, sortOrders]\n\t);\n\tconst categoryPageConfigurations = useMemo(\n\t\t() => convertSearchCategoriesToCategoryPageConfiguration(categories),\n\t\t[categories]\n\t);\n\tconst router = useMemo(\n\t\t() => makeRouter(categoryPageConfigurations, facetConfigurations, userSearchFilters, href),\n\t\t[categoryPageConfigurations, facetConfigurations, userSearchFilters, href]\n\t);\n\tconst routing = useMemo(() => ({ router, stateMapping }), [router, stateMapping]);\n\treturn (\n\t\t<AlgoliaSSRProvider<UiState, RouteState>\n\t\t\tattributesToRetrieve={attributesToRetrieve}\n\t\t\tqueryType=\"prefixNone\"\n\t\t\trouting={routing}\n\t\t\tsearchClient={searchClient}\n\t\t\tsearchParameters={searchParameters}\n\t\t>\n\t\t\t<HiddenFacetRefinements facetConfigurations={facetConfigurations} />\n\t\t\t<AuthorBatch.Provider>\n\t\t\t\t<PublisherBatch.Provider>\n\t\t\t\t\t<FilterSortLayout\n\t\t\t\t\t\tpageLimits={pageLimits}\n\t\t\t\t\t\tsortOrders={sortOrders}\n\t\t\t\t\t\twishListsProductsUrl={wishListsProductsUrl}\n\t\t\t\t\t\tenableAuthorBioView={enableAuthorBioView}\n\t\t\t\t\t\tsearchResultsAbove={searchResultsAbove}\n\t\t\t\t\t/>\n\t\t\t\t</PublisherBatch.Provider>\n\t\t\t</AuthorBatch.Provider>\n\t\t</AlgoliaSSRProvider>\n\t);\n};\n\n// ---------------------------------------------------------------------------\n// Search — top-level entry component (default export)\n// ---------------------------------------------------------------------------\n\ninterface SearchProps {\n\talgoliaAppId?: string;\n\talgoliaAppKey?: string;\n\talgoliaIndexName?: string;\n\tstorefrontShortname?: string;\n\talgoliaSearchParametersJson?: string;\n\tuserSearchFiltersJson?: string;\n\tinitialUserSearchFilterSelections?: Record<string, string>;\n\tfacetConfigurations?: FacetConfiguration[];\n\tsearchCategories?: SearchCategory[];\n\twishListsProductsUrl?: string;\n\tenableAuthorBioView?: boolean;\n\tsearchResultsAbove?: SectionContentViewModel[];\n\tsearchResultsBelow?: SectionContentViewModel[];\n\tpageLimits: number[];\n\tsortOrders: SearchSortOrder[];\n\tattributesToRetrieve: string[];\n\tserverState?: InstantSearchServerState;\n}\n\nexport default function Search({\n\talgoliaAppId = '',\n\talgoliaAppKey = '',\n\talgoliaIndexName = '',\n\tstorefrontShortname = '',\n\talgoliaSearchParametersJson,\n\tuserSearchFiltersJson,\n\tinitialUserSearchFilterSelections,\n\tfacetConfigurations = [],\n\tsearchCategories = [],\n\twishListsProductsUrl = '',\n\tenableAuthorBioView = false,\n\tpageLimits,\n\tsortOrders,\n\tattributesToRetrieve,\n\tserverState,\n\tsearchResultsAbove,\n\tsearchResultsBelow,\n}: SearchProps) {\n\tconst localizedResources = useLocalization('CommerceWeb.Resources.Search.Search');\n\tconst { userId } = useCurrentUser();\n\tconst searchParameters = useMemo(\n\t\t() => safeJsonParse(algoliaSearchParametersJson) ?? {},\n\t\t[algoliaSearchParametersJson]\n\t);\n\tconst userSearchFilters = useMemo((): UserSearchFilter[] => {\n\t\tconst parsedFilters = safeJsonParse<UserSearchFilters>(userSearchFiltersJson);\n\t\treturn (\n\t\t\tparsedFilters?.filters?.map(filter => ({\n\t\t\t\t...filter,\n\t\t\t\toptions: filter.options.map(option => ({ ...option, isSelected: option.isDefault })),\n\t\t\t})) ?? []\n\t\t);\n\t}, [userSearchFiltersJson]);\n\n\treturn (\n\t\t<div className=\"tw-preflight\">\n\t\t\t<PerUserDataContextProvider>\n\t\t\t\t<SearchResourcesContext.Provider value={localizedResources}>\n\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t<AlgoliaSearchContextProvider\n\t\t\t\t\t\t\tappId={algoliaAppId}\n\t\t\t\t\t\t\tappKey={algoliaAppKey}\n\t\t\t\t\t\t\tindexName={algoliaIndexName}\n\t\t\t\t\t\t\tstorefrontShortname={storefrontShortname}\n\t\t\t\t\t\t\tuserId={userId}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<UserSearchFilterProvider\n\t\t\t\t\t\t\t\tinitialSelectedFilterOptions={initialUserSearchFilterSelections}\n\t\t\t\t\t\t\t\tuserSearchFilters={userSearchFilters}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<InstantSearchSSRProvider initialResults={serverState?.initialResults}>\n\t\t\t\t\t\t\t\t\t<InstantSearchWrapper\n\t\t\t\t\t\t\t\t\t\tcategories={searchCategories}\n\t\t\t\t\t\t\t\t\t\tfacetConfigurations={facetConfigurations}\n\t\t\t\t\t\t\t\t\t\tsearchParameters={searchParameters}\n\t\t\t\t\t\t\t\t\t\twishListsProductsUrl={wishListsProductsUrl}\n\t\t\t\t\t\t\t\t\t\tenableAuthorBioView={enableAuthorBioView}\n\t\t\t\t\t\t\t\t\t\tpageLimits={pageLimits}\n\t\t\t\t\t\t\t\t\t\tsortOrders={sortOrders}\n\t\t\t\t\t\t\t\t\t\tattributesToRetrieve={attributesToRetrieve}\n\t\t\t\t\t\t\t\t\t\tsearchResultsAbove={searchResultsAbove}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</InstantSearchSSRProvider>\n\t\t\t\t\t\t\t</UserSearchFilterProvider>\n\t\t\t\t\t\t</AlgoliaSearchContextProvider>\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t</SearchResourcesContext.Provider>\n\t\t\t\t<CategoryContent sectionKind=\"searchResultsBelow\" initialSectionContents={searchResultsBelow} />\n\t\t\t</PerUserDataContextProvider>\n\t\t</div>\n\t);\n}\n","import { useEffect, useRef } from 'react';\nimport { useHits } from 'react-instantsearch';\n\nimport { ProductHit } from '../types';\n\n/**\n * Pushes UA Enhanced Ecommerce impression data to the dataLayer when search results change.\n * Matches the Skeletor pattern of `dataLayer.push({ ecommerce: { impressions: [...] } })`.\n */\nexport function useSearchImpressions() {\n\tconst { results } = useHits<ProductHit>();\n\tconst lastPushedQueryRef = useRef<string | null>(null);\n\n\tuseEffect(() => {\n\t\tif (!results?.hits?.length) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Deduplicate pushes by using the Algolia query ID (or query string + page as fallback)\n\t\tconst queryKey = (results as any).queryID ?? `${results.query ?? ''}_${results.page ?? 0}`;\n\t\tif (queryKey === lastPushedQueryRef.current) {\n\t\t\treturn;\n\t\t}\n\t\tlastPushedQueryRef.current = queryKey;\n\n\t\tconst impressions = results.hits.map((hit, index) => ({\n\t\t\tid: String(hit.productId),\n\t\t\tname: hit.title ?? '',\n\t\t\tprice: String(hit.salePrice ?? 0),\n\t\t\tlist: 'Search Results',\n\t\t\tposition: String(index),\n\t\t}));\n\n\t\t(window as any).dataLayer = (window as any).dataLayer || [];\n\t\t(window as any).dataLayer.push({\n\t\t\tecommerce: {\n\t\t\t\timpressions,\n\t\t\t},\n\t\t});\n\t}, [results]);\n}\n","import { useEffect, useRef } from 'react';\nimport { useInstantSearch } from 'react-instantsearch';\n\n/**\n * Pushes GTM dataLayer events when users interact with search facets, sort options,\n * and hits-per-page controls. Matches the Skeletor `facet_search` and `results_search` events.\n */\nexport function useSearchAnalytics() {\n\tconst { indexUiState } = useInstantSearch();\n\tconst previousStateRef = useRef<typeof indexUiState | null>(null);\n\n\tuseEffect(() => {\n\t\tconst prevState = previousStateRef.current;\n\t\tpreviousStateRef.current = indexUiState;\n\n\t\t// Skip the initial render — only track user-initiated changes\n\t\tif (!prevState) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst dataLayer = ((window as any).dataLayer = (window as any).dataLayer || []);\n\n\t\t// Track sort changes\n\t\tif (indexUiState.sortBy !== prevState.sortBy) {\n\t\t\tdataLayer.push({\n\t\t\t\tevent: 'results_search',\n\t\t\t\tselection: {\n\t\t\t\t\tgroup: 'Sort By',\n\t\t\t\t\toption: indexUiState.sortBy ?? 'default',\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Track hits-per-page changes\n\t\tif (indexUiState.hitsPerPage !== prevState.hitsPerPage) {\n\t\t\tdataLayer.push({\n\t\t\t\tevent: 'results_search',\n\t\t\t\tselection: {\n\t\t\t\t\tgroup: 'Show',\n\t\t\t\t\toption: String(indexUiState.hitsPerPage ?? 15),\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Track refinement list (facet) changes\n\t\tconst currentRefinements = indexUiState.refinementList ?? {};\n\t\tconst previousRefinements = prevState.refinementList ?? {};\n\n\t\tconst allFacetKeys = new Set([...Object.keys(currentRefinements), ...Object.keys(previousRefinements)]);\n\n\t\tfor (const facetKey of allFacetKeys) {\n\t\t\tconst currentValues = new Set(currentRefinements[facetKey] ?? []);\n\t\t\tconst previousValues = new Set(previousRefinements[facetKey] ?? []);\n\n\t\t\t// Find newly selected facets\n\t\t\tfor (const value of currentValues) {\n\t\t\t\tif (!previousValues.has(value)) {\n\t\t\t\t\tdataLayer.push({\n\t\t\t\t\t\tevent: 'facet_search',\n\t\t\t\t\t\tselection: {\n\t\t\t\t\t\t\tfacetGroup: facetKey,\n\t\t\t\t\t\t\tfacet: value,\n\t\t\t\t\t\t\tchecked: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Find deselected facets\n\t\t\tfor (const value of previousValues) {\n\t\t\t\tif (!currentValues.has(value)) {\n\t\t\t\t\tdataLayer.push({\n\t\t\t\t\t\tevent: 'facet_search',\n\t\t\t\t\t\tselection: {\n\t\t\t\t\t\t\tfacetGroup: facetKey,\n\t\t\t\t\t\t\tfacet: value,\n\t\t\t\t\t\t\tchecked: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Track page changes\n\t\tif (indexUiState.page !== prevState.page) {\n\t\t\tdataLayer.push({\n\t\t\t\tevent: 'results_search',\n\t\t\t\tselection: {\n\t\t\t\t\tgroup: 'Page',\n\t\t\t\t\toption: String(indexUiState.page ?? 1),\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}, [indexUiState]);\n}\n","export function safeJsonParse<T = any>(json: string | null | undefined): T | null {\n\tif (json === null || json === undefined) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\treturn JSON.parse(json) as T;\n\t} catch {\n\t\treturn null;\n\t}\n}\n"],"names":["ErrorBoundary","Component","constructor","props","super","_defineProperty","this","setState","hasError","error","errorInfo","onReset","state","getDerivedStateFromError","componentDidCatch","onError","console","render","fallback","resetErrorBoundary","fallbackComponent","FallbackComponent","React","children","propTypes","PropTypes","isRequired","showError","defaultProps","__WEBPACK_DEFAULT_EXPORT__","AuthorBatch","createBatchContext","async","nonEmptyIds","ids","filter","id","length","response","fetch","concat","join","ok","Error","status","json","data","find","d","useAuthor","useData","BooksByAuthor","_ref","resources","refinedAuthorIds","_useRefinementList$it","useRefinementList","attribute","items","item","isRefined","map","value","authorId","_useAuthor","author","isLoading","_useState","useState","_useState2","_slicedToArray","isCollapsed","setIsCollapsed","displayName","longDescription","className","Typography","variant","booksBy","IconButton","scale","onClick","ChevronDown","ChevronUp","AuthorBio","imageUrl","imageUrlLarge","bio","PublisherBatch","builderIoModelNamesBySectionKindMap","searchResultsAbove","searchResultsBelow","universalHeader","universalFooter","subscriptionChurnPrevention","configurationWizardSubscriptionsBanner","configurationWizardSubscriptionsContent","configurationWizardLibrariesBanner","orderSummary","orderSummaryFooter","productPage","adzone","notifications","getContentKey","sectionContents","sc","sectionKind","contentSourceKind","contentId","section_content","initialSectionContents","onContentChange","setSectionContents","builderIoModel","isBuilderIoPreviewingThisModel","useIsPreviewingThisBuilderModel","location","useLocation","lastRequestedLocationHref","useRef","undefined","href","useEffect","current","sections","kind","url","get","params","getSections","filteredSections","hasContent","contentKey","fetchSections","notifyWarning","RenderBuilderContent","model","staticData","staticProductData","userInfo","c_defaultUserInfo","filteredContents","_extends","key","builderIo","category_content","_initialSectionConten","_useState2$","setContentState","handleContentChange","useCallback","event","prev","ReadMoreReadLess","SectionContent","UserSearchFilterContext","createContext","readUserFilterSelectionsFromUrl","userSearchFilters","searchParams","defaults","reduce","selectedOptions","_options$find","options","Array","isArray","selectedOption","option","isDefault","token","getDefaultSelectedFilterOptions","_matchingOption$token","urlValue","matchingOption","resolved","useUserSearchFilterContext","context","useContext","UserSearchFilterProvider","initialSelectedFilterOptions","setSelectedFilterOptionsOverride","_useLocation","search","pathname","replaceUrl","useMemo","URLSearchParams","urlSelections","initialSelection","some","selectedFilterOptions","setSelectedFilterOptions","next","currentSelection","first","second","firstKeys","Object","keys","secondKeys","every","areSelectedFilterOptionsEqual","URL","_unused","selectedToken","set","delete","_unused2","writeUserFilterSelectionsToUrl","handleSetSelectedFilterOption","filterToken","optionToken","_objectSpread","contextValue","setSelectedFilterOption","Provider","Accordion","AccordionPrimitive","AccordionItem","ref","_objectWithoutProperties","_excluded","cn","AccordionTrigger","_ref2","_excluded2","AccordionContent","_ref3","_excluded3","SearchResourcesContext","useSearchResources","serializeKey","JSON","stringify","createBoundedResponsesCache","maxCharacters","arguments","cache","Map","characters","defaultValue","events","miss","Promise","resolve","serializedKey","cached","parse","promise","then","serializedValue","existing","size","_cache$get$length","_cache$get","oldestKey","evict","clear","AlgoliaSearchContext","AlgoliaSearchContextProvider","appId","appKey","indexName","storefrontShortname","_ref$userId","userId","client","algoliasearch","responsesCache","insightsClient","apiKey","useAlgoliaSearch","parseFacetValue","separatorIndex","indexOf","substring","safeUrl","input","base","Check","checked","fill","height","viewBox","width","xmlns","rx","stroke","y","strokeLinecap","c_statusLabelKeys","ShowMoreToggle","showMore","setShowMore","isShowingMore","LinkButton","as","countDepth","index","depth","getChildren","parent","_ref5","startsWith","Category","_ref8","category","setExpandedFacets","maxLevel","levels","levelsRef","level","refinement","limit","skipSuspense","push","useRefinementLists","accordions","root","label","_ref6","subCategories","_ref7","_ref4","hasChildren","c","replace","getAccordions","accordion","_resources$accordion$","tag","slice","_ref9","refine","eventName","filters","_ref0","child","forEach","_ref1","old","v","lastIndexOf","count","AuthorFacetItem","_ref10","onRefine","PublisherFacetItem","_ref11","AuthorsOrPublishers","_ref12","_resources$attribute","nameAttribute","_useRefinementList","canToggleShowMore","toggleShowMore","_useRefinementList2","idItems","FacetItem","facetItems","_parseFacetValue","idItem","sort","a","b","i","Statuses","_ref13","level1","level2","level3","level4","_ref14","_resources","_c_statusLabelKeys$va","_resources2","_c_statusLabelKeys$it","UserSearchFilterAccordionItem","_ref15","_useUserSearchFilterC","selectedFilterOption","title","isSelected","onChange","type","Categories","expandedFacets","_useState3","_useState4","onValueChange","RefinementLabel","stringValue","String","AuthorLabel","PublisherLabel","AuthorApiLabel","PublisherApiLabel","_usePublisher","CurrentRefinements","currentRefinements","useCurrentRefinements","itemsByAttribute","refinementList","_currentRefinements$i","_item$refinements","refinements","itemValue","itemAndChildren","r","RefinementChip","_itemsByAttribute$att","X","CurrentQueryRefinement","_searchParams$get$tri","_searchParams$get","urlQuery","trim","_useSearchBox","useSearchBox","query","queryRef","removeQuery","HiddenRefinementList","getHiddenAlgoliaAttributes","config","algoliaAttribute","attributes","minLevel","algoliaAttributeBase","HiddenFacetRefinements","facetConfigurations","isHidden","flatMap","SkeletonRoot","_ref$pending","pending","_ref$hideOverflow","hideOverflow","role","SkeletonBox","EnhancedForLogosLabel","useLocalization","logosOrVerbum","useBrandName","isVerbum","toLowerCase","CommandSentence","template","EnhancedForLogos","Field","name","alt","src","enhanced_for_logos_with_tooltip","Tooltip","placement","link","InfoIconSvgUrl","EnhancedForLogosTooltipContent","usdFormat","Intl","NumberFormat","style","currency","minimumFractionDigits","maximumFractionDigits","useProductCard","_pricingData$primaryS","_pricingData$primaryS2","_hit$salePrice","_hit$salePrice2","_hit$anchorPrice","_hit$anchorPrice2","_pricingData$primaryS3","_pricingData$primaryS4","_pricingData$primaryS5","_hit$title","_prices$anchorPrice","_prices$salePrice","_prices$salePrice$loc","_prices$salePrice2","_pricingData$primaryS6","_hit$isLogosEdition","hit","_ref$queryId","queryId","position","pricingData","usePricing","productId","preferredCurrency","useCurrentUser","hasGeoRestriction","isGeographicallyRestricted","isAddingToCart","setIsAddingToCart","requestIdRef","prices","primarySku","salePrice","amount","displayAmount","format","displayAmountCurrencyCode","localizedDisplayAmount","currencyCode","displayAmountByCurrency","anchorPrice","discountSavings","accessKind","isOwned","hasPreorder","isPrepubProduct","prepubProductStatusSummary","skuId","isPurchasable","handleCartUpdated","e","detail","requestId","handleCartUpdateError","document","addEventListener","removeEventListener","slug","text","normalize","slugify","productPath","productUrl","encodeURIComponent","productName","regularPrice","salePriceCurrency","localizedSalePrice","discountPercentage","anchor","sale","getSavingsPercent","isDiscounted","productImageSrc","primaryImageUri","imageSrc","detectIsAmberOptimizedUrl","isLogosEdition","handleProductClick","window","queryID","objectIDs","positions","handleAddToCart","_pricingData$primaryS7","eventType","eventData","Date","now","Math","random","eventDetail","addToCartUrl","routes","AddToCartUrl","skuIds","quantity","payInFull","searchData","productIds","currentTarget","dispatchEvent","CustomEvent","bubbles","ProductImage","priority","onAuxClick","Image","belowTheFold","sizes","mobile","tablet","desktop","targetAspectRatio","DiscountBadge","_resources$discountFo","badgeClassName","toFixed","ProductTitle","ProductAuthors","authors","ctaButtonScale","skeletonHeightByButtonScale","small","medium","large","ProductPricing","cardData","buttonLayoutClassName","ProductPrice","ProductCta","ownershipLabelClassName","PriceLabel","layout","purchaseStatusMessage","getOwnershipLabel","Button","disabled","Skeleton","AlgoliaGridCard","_hit$averageRating","_hit$reviewCount","productInWishlist","useProductInWishList","averageRating","reviewCount","hasReviewData","hasValidReviewData","EnhancedForLogosWithTooltip","AddToWishListWithForm","StarRating","rating","PrepubProductStatusSummary","ProductOverview","overview","isExpanded","setIsExpanded","showButton","setShowButton","overviewRef","element","scrollHeight","computedLineHeight","getComputedStyle","lineHeight","parsedLineHeight","parseInt","Number","isFinite","dangerouslySetInnerHTML","__html","intent","toggleExpand","AlgoliaListCard","SkeletonBlock","rootClassName","SkeletonButton","ProductSkeleton","layoutType","ProductSkeletons","currentHitsPerPage","from","_","toProductHitResult","toString","products","wishListsProductsUrl","Card","useInstantSearch","HitComponent","_queryID","__position","__queryID","WishListProductBatchProvider","Hits","classNames","list","hitComponent","RadioAccordion","radioGroupName","onSelect","prefixLabel","currentItem","collapsible","SortByAccordion","_useSortBy","useSortBy","currentRefinement","HitsPerPageAccordion","_useHitsPerPage","useHitsPerPage","showItems","ViewMode","ViewModeContext","viewModeKey","viewModeValues","values","ViewModeProvider","getInitialViewMode","urlViewMode","includes","cookieViewMode","Cookies","grid","viewMode","setViewMode","history","replaceState","arrayToQueryParam","array","emptyIfUndefined","getTrimmedOrUndefinedIfStringEmpty","trimmed","getMatchingCategoryPageFromRouteState","routeState","categoryPageConfigurations","allFacetingKeys","_routeState$facets","facets","Set","_routeState$facets2","categoryPageConfiguration","checkCategoryPageConfigurationMatches","preserveCustomQueryParams","sourceUrl","targetUrl","preserveKeys","entries","has","preserveNonSearchQueryParams","searchParamKeys","writeFacetsSearchParams","excludedKeys","candidateQueryParamValue","writeUserFilterSearchParams","checkFacetValueConfigurationMatches","facetValueConfiguration","routeStateFacetValue","routeStateFacets","facetsConfiguration","matches","routeStateFacet","facetConfiguration","f","queryParamName","writeCommonSearchParams","sortBy","page","hydrationSettledAttribute","AlgoliaSSRProvider","AlgoliaProvider","attributesToHighlight","attributesToRetrieve","queryType","restrictSearchableAttributes","routing","searchClient","searchParameters","InstantSearch","future","preserveSharedStateOnUnmount","insights","ConfigureCore","ParameterBlacklist","mergedParams","uf","_uf$options","selectedOptionToken","o","algoliaValue","filterParts","fromEntries","Configure","distinct","CloseIcon","rest","fillColor","strokeWidth","FilterIcon","LayoutButtonOptions","icon","x","additionalClassNames","_excluded4","LayoutButtons","currentLayoutType","setLayoutType","IconComponent","DesktopSearchControl","_selectedItem$label","prefixText","testId","contentClassName","selectedItem","_items$find","selectedLabel","handleValueChange","newValue","matchedItem","DropdownMenu","DropdownMenuTrigger","DropdownMenuContent","DropdownMenuRadioGroup","DropdownMenuRadioItem","ScrollToTopOnPaginationChange","usePagination","scrollTo","top","behavior","NoResultsState","normalizedQuery","noResultsMessageTemplate","searchTips","Container","tip","assign","FilterSortLayout","_showItems$find$value","_showItems$find","enableAuthorBioView","pageLimits","sortOrders","authorBioResources","isMobileFilterOpen","setIsMobileFilterOpen","_useViewMode","useViewMode","_useScreensize","useScreensize","isMobile","isDesktop","isHydrationSettled","isSettled","setIsSettled","timeoutId","setTimeout","clearTimeout","useHydrationSettled","results","useHits","lastPushedQueryRef","_results$hits","_results$query","_results$page","hits","queryKey","impressions","price","dataLayer","ecommerce","useSearchImpressions","indexUiState","previousStateRef","_indexUiState$refinem","_prevState$refinement","prevState","_indexUiState$sortBy","_indexUiState$hitsPer","selection","group","hitsPerPage","previousRefinements","allFacetKeys","facetKey","_currentRefinements$f","_previousRefinements$","currentValues","previousValues","facetGroup","facet","_indexUiState$page","useSearchAnalytics","hasNoSearchResults","__isArtificial","nbHits","shouldShowResultsRoute","allSortItems","sortOrder","_resources$sortOrder$","isPrepub","currentSortBy","refineSortBy","hasPrepubCategory","sortItems","hitsPerPageItems","pageLimit","default","refineHitsPerPage","closeFilter","toggleFilter","filterPanelContent","Drawer","isOpen","onClose","zIndex","CategoryContent","newSortBy","newHitsPerPage","ProductHits","Pagination","noRefinementRoot","previousPageItem","pageItem","disabledItem","nextPageItem","showFirst","showLast","showNext","showPrevious","InstantSearchWrapper","categories","_useAlgoliaSearch2","stateMapping","stateToRoute","uiState","_sortOrder$routeValue","facetValues","routeKey","_indexUiState$refinem2","routeKeyPrefix","order","routeValue","routeToState","_sortOrders$find","_routeState$facets3","_routeState$facets4","makeStateMapping","categoryPageUrl","facetRouteKey","pageTitle","convertSearchCategoriesToCategoryPageConfiguration","router","initialUrl","getAllFacetingKeys","allFacetingKeysSet","userFilterKeysSet","preserveCustomKeysSet","searchParamKeysSet","categoryPagesByCategoryPageUrl","configuration","getLocation","ancestorOrigins","contains","Symbol","iterator","hash","host","hostname","origin","port","protocol","reload","cleanUrlOnDispose","createURL","matchingCategoryPage","currentUrl","categoryFacetKeys","err","parseURL","locationUrl","locationPathname","addRouteStateFacetValues","_routeState$facets5","_routeState$facets6","_routeState$facets6$k","queryParams","paramName","paramValue","split","_routeState$filters","windowTitle","makeRouter","Search","_ref12$algoliaAppId","algoliaAppId","_ref12$algoliaAppKey","algoliaAppKey","_ref12$algoliaIndexNa","algoliaIndexName","_ref12$storefrontShor","algoliaSearchParametersJson","userSearchFiltersJson","initialUserSearchFilterSelections","_ref12$facetConfigura","_ref12$searchCategori","searchCategories","_ref12$wishListsProdu","_ref12$enableAuthorBi","serverState","localizedResources","_safeJsonParse","safeJsonParse","_parsedFilters$filter","_parsedFilters$filter2","parsedFilters","PerUserDataContextProvider","InstantSearchSSRProvider","initialResults"],"sourceRoot":""}