export declare class SearchBarSnippet extends HTMLElement {
private shadow;
private client;
private stats;
private container;
private inputElement;
private resultsContainer;
private searchButton;
private debouncedSearch;
private currentSearchController;
private loadingMessageInterval;
private loadingMessageIndex;
private translationsOverride;
private resolvedTranslations;
private lastSearchQuery;
private lastSearchTotal;
private handleInputChange;
private handleInputKeydownEnter;
private handleInputKeydownEscape;
private handleSearchButtonClick;
private handleResultClick;
private handleSeeMoreClick;
static get observedAttributes(): readonly ["api-url", "placeholder", "max-results", "max-render-results", "debounce-ms", "theme", "hide-branding", "show-url", "show-date", "hide-thumbnails", "see-more", "disable-analytics", "request-options", "translations"];
constructor();
connectedCallback(): void;
disconnectedCallback(): void;
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
/**
* Get the current translations object. Mirrors the property getter.
*/
get translations(): Translations | null;
/**
* Override any user-facing string. Omitted keys fall back to English defaults.
*/
set translations(value: Translations | null | undefined);
/**
* Re-render preserving the current query and re-running the search so
* results remain visible after a translations change at runtime.
*/
private rerender;
private syncTranslationsFromAttribute;
private getProps;
private getRequestOptions;
private initializeClient;
private destroyStatsClient;
private render;
private attachEventListeners;
private performSearch;
private displayResults;
private renderResult;
private renderResultImage;
private attachResultHandlers;
private detachResultTrackingHandlers;
private showLoadingState;
private startLoadingInterval;
private clearLoadingInterval;
private showEmptyState;
private showNoResultsState;
private showErrorState;
private showMissingApiUrlError;
private updateTheme;
private cleanup;
search(query: string): Promise;
}
export declare class SearchModalSnippet extends HTMLElement {
private shadow;
private client;
private stats;
private backdrop;
private modal;
private inputElement;
private resultsContainer;
private footerCount;
private isOpen;
private results;
private favoriteResults;
private activeIndex;
private debouncedSearch;
private currentSearchController;
private loadingMessageInterval;
private loadingMessageIndex;
private translationsOverride;
private resolvedTranslations;
private lastSearchQuery;
private lastSearchTotal;
private handleGlobalKeydown;
private handleInputChange;
private handleInputKeydown;
private handleBackdropClick;
private handleResultsContainerClick;
private savedBodyStyles;
private savedHtmlOverflow;
static get observedAttributes(): readonly ["api-url", "placeholder", "max-results", "max-render-results", "theme", "shortcut", "use-meta-key", "debounce-ms", "hide-branding", "show-url", "show-date", "hide-thumbnails", "see-more", "disable-analytics", "request-options", "translations"];
constructor();
connectedCallback(): void;
disconnectedCallback(): void;
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
/**
* Get the current translations object.
*/
get translations(): Translations | null;
/**
* Override any user-facing string. Omitted keys fall back to English defaults.
*/
set translations(value: Translations | null | undefined);
/**
* Re-render while preserving open state and the current query. Results are
* re-fetched so the list reflects the updated translation strings around
* them (counts, footer hints, etc.). Selection resets to none — the same
* behavior as the immediate post-search state.
*/
private rerender;
private syncTranslationsFromAttribute;
private getProps;
private getRequestOptions;
private initializeClient;
private destroyStatsClient;
private render;
private attachGlobalKeyboardShortcut;
private attachEventListeners;
private navigateResults;
private updateActiveResult;
private selectActiveResult;
private performSearch;
private displayResults;
private renderResult;
private renderResultImage;
private attachResultHandlers;
private detachResultsContainerClick;
private renderEmptyState;
private renderInitialSection;
private showEmptyState;
private showLoadingState;
private startLoadingInterval;
private clearLoadingInterval;
private showNoResultsState;
private showErrorState;
private showMissingApiUrlError;
private updateTheme;
private lockBodyScroll;
private unlockBodyScroll;
private cleanup;
/**
* Open the search modal
*/
open(): void;
/**
* Close the search modal
*/
close(): void;
/**
* Toggle the search modal open/closed
*/
toggle(): void;
/**
* Perform a search programmatically
*/
search(query: string): Promise;
/**
* Get current search results
*/
getResults(): SearchResult[];
/**
* Check if modal is currently open
*/
isModalOpen(): boolean;
}
/**
* Search result item structure
*/
declare interface SearchResult {
id: string;
title: string;
description: string;
timestamp?: number;
url?: string;
image?: string;
metadata?: Record;
type: 'result';
}
/**
* Translation utilities for component user-facing strings.
*
* Users override any subset of translations via the `translations` attribute
* (JSON string) or property (plain object). Missing keys fall back to the
* built-in English defaults.
*
* @example
* ```html
*
* ```
*
* @example
* ```ts
* element.translations = { placeholder: 'Busca aquí...' };
* ```
*/
/**
* All user-facing strings rendered by the snippet components.
*
* All keys are optional; unspecified keys fall back to English defaults.
* Strings can contain `{name}` tokens that are interpolated at render time.
*/
declare interface Translations {
/** Aria label for loading spinners. Default: "Loading" */
loadingAriaLabel?: string;
/** Bold prefix for error messages. Default: "Error:" */
errorPrefix?: string;
/** Message shown when the `api-url` attribute is missing. */
missingApiUrlError?: string;
/** Branding prefix before the product link. Default: "Powered by" */
poweredBy?: string;
/** Branding link label. Default: "Cloudflare AI Search" */
poweredByLinkLabel?: string;
/** Search input placeholder text. */
placeholder?: string;
/** Search submit button text and aria-label. */
searchButtonLabel?: string;
/** Aria-label for the search input on the bar variant. */
searchInputAriaLabel?: string;
/** Aria-label for the modal results list. */
searchResultsAriaLabel?: string;
/** Title shown before a user enters a query (bar variant). */
emptyStateTitle?: string;
/** Description shown before a user enters a query (bar variant). */
emptyStateDescription?: string;
/** Description shown before a user enters a query (modal variant). */
modalEmptyStateDescription?: string;
/** Title shown when a search returns no results (bar variant). */
noResultsTitle?: string;
/** Description shown when a search returns no results (bar variant). Supports `{query}`. */
noResultsDescription?: string;
/** Title shown when a search returns no results (modal variant). */
modalNoResultsTitle?: string;
/** Description shown when a search returns no results (modal variant). Supports `{query}`. */
modalNoResultsDescription?: string;
/** Bar results count when exactly 1 result. Supports `{n}`. */
resultsCount?: string;
/** Bar results count when multiple results. Supports `{n}`. */
resultsCountPlural?: string;
/** Bar/modal results count when truncated. Supports `{n}` and `{total}`. */
resultsCountOverflow?: string;
/** Modal footer results count when exactly 1 result. Supports `{n}`. */
modalResultsCount?: string;
/** Modal footer results count when multiple results. Supports `{n}`. */
modalResultsCountPlural?: string;
/** Modal footer count shown with the zero-results state. */
modalResultsCountZero?: string;
/** Modal footer text shown with the error state. */
modalResultsCountError?: string;
/** Label for the "see more" link when `see-more` is configured. */
seeMoreResults?: string;
/** Group header label for results missing the `group-by` metadata field. Default: "Other" */
groupOther?: string;
/** Heading above favorite results in the initial modal. */
favoriteResults?: string;
/** Heading above results recently opened from the modal. */
recentResults?: string;
/** Accessible label for a result's favorite button. */
addFavorite?: string;
/** Accessible label for a favorited result's remove button. */
removeFavorite?: string;
/** Modal footer hint next to the ↑ ↓ keys. */
navigateHint?: string;
/** Modal footer hint next to the ↵ key. */
selectHint?: string;
/** Modal footer hint next to the Esc key. */
closeHint?: string;
/** Chat header title. */
chatTitle?: string;
/** Chat input placeholder text. */
chatPlaceholder?: string;
/** Aria-label for the chat textarea. */
chatInputAriaLabel?: string;
/** Chat send button text. */
sendButtonLabel?: string;
/** Chat send button aria-label. */
sendButtonAriaLabel?: string;
/** Empty chat state title. */
chatEmptyTitle?: string;
/** Empty chat state description. */
chatEmptyDescription?: string;
/** User message avatar text. Default: "U" */
userAvatar?: string;
/** Assistant message avatar text. Default: "AI" */
assistantAvatar?: string;
/** Fallback for chat errors with no message. */
unknownError?: string;
/** Aria-label for the floating chat bubble button. */
openChatAriaLabel?: string;
/** Aria-label for the clear-history icon button. */
clearHistoryAriaLabel?: string;
/** Aria-label for the minimize icon button. */
minimizeAriaLabel?: string;
/** Aria-label for the close icon button. */
closeAriaLabel?: string;
/** Sidebar heading on the chat-page variant. */
historyTitle?: string;
/** New-chat button label. */
newChatButton?: string;
/** Clear-chat header button label. */
clearChatButton?: string;
/** Tooltip for the sidebar toggle button. */
toggleSidebarTitle?: string;
/** Tooltip for a per-session delete button. */
deleteChatTitle?: string;
/** Empty sessions list message. */
noChatsYet?: string;
/** Label for "one day ago" in the sessions list. */
yesterday?: string;
/** Relative timestamp for < 1 minute ago. */
justNow?: string;
/** Relative timestamp for exactly 1 minute ago. Supports `{n}`. */
minuteAgo?: string;
/** Relative timestamp for 2-59 minutes ago. Supports `{n}`. */
minutesAgo?: string;
/** Relative timestamp for exactly 1 hour ago. Supports `{n}`. */
hourAgo?: string;
/** Relative timestamp for 2-23 hours ago. Supports `{n}`. */
hoursAgo?: string;
/** Cycling loading messages shown during search/streaming. Provide the full array to override. */
loadingMessages?: string[];
}
export { }