        // Debug: confirm function entry and log variables
        // try {
        //     console.log('Entered displayResults');
        //     console.log('searchData:', searchData);
        //     console.log('results:', results);
        // } catch (e) {
        //     console.warn('Debug logging error in displayResults:', e);
        // }
        // // Debug: log raw API response and filtered results
        // try {
        //     console.log('DisplayResults: raw API response', searchData);
        //     console.log('DisplayResults: filtered results', results);
        // } catch (e) {
        //     console.warn('Debug logging error in displayResults:', e);
        // }
/**
 * Server-Side Search Integration for Landing Pages
 * Connects to Elasticsearch via FastAPI for enhanced search capabilities
 * Version: 1.0.0
 */

class ServerSideSearch {
    constructor() {
        // Configuration
        this.apiBaseUrl = this.getApiBaseUrl();
        this.currentProduct = this.detectProduct();
        this.isServiceAvailable = true;
        
        // DOM elements will be set after initialization
        this.searchForm = null;
        this.searchInput = null;
        this.resultsContainer = null;
        
        // Initialize when DOM is ready
        if (document.readyState === 'loading') {
            document.addEventListener('DOMContentLoaded', () => this.init());
        } else {
            this.init();
        }
    }

    /**
     * Determine API base URL based on environment
     */
    getApiBaseUrl() {
        return '/search-api';
    }

    /**
     * Detect current product based on URL path
     */
    detectProduct() {
        const path = window.location.pathname;
        
        const productMapping = {
            '/CompliEditor/': 'CompliEditor',
            '/Expere/Authoring/': 'Expere Authoring Tools',
            '/Expere/Engine/': 'Expere Engine',
            '/DGS/': 'Document Generation Services',
            '/I-32/': 'I-32',
            '/Expere-document-preparation-integration/': 'Wolters Kluwer Expere Document Preparation Integration',
            '/WK-Hosted-Expere/': 'Wolters Kluwer Hosted Expere',
            '/WK-IntegratedSolutions/': 'Wolters Kluwer Integrated Solutions'
        };

        for (const [urlPath, productName] of Object.entries(productMapping)) {
            if (path.includes(urlPath)) {
                return {
                    name: productName,
                    path: urlPath,
                    isIntegratedSolutions: productName === 'Wolters Kluwer Integrated Solutions'
                };
            }
        }

        return {
            name: 'Unknown Product',
            path: '/',
            isIntegratedSolutions: false
        };
    }

    /**
     * Get products to search for current context
     */
    getSearchProducts() {
        if (this.currentProduct.isIntegratedSolutions) {
                // Integrated Solutions searches across all relevant products
                return [
                    'Expere Authoring Tools',
                    'Expere Engine',
                    'Wolters Kluwer Hosted Expere',
                    'Document Generation Services (DGS)',
                    'CompliEditor',
                    'I-32'
                ];
        }
        
        return [this.currentProduct.name];
    }

    /**
     * Initialize the search functionality
     */
    init() {
        this.createSearchInterface();
        this.bindEvents();
        this.testApiConnection();
    }

    /**
     * Create the server-side search interface HTML
     */
    createSearchInterface() {
        const existingSearchForm = document.getElementById('searchForm');
        if (!existingSearchForm) {
            console.error('Existing search form not found');
            return;
        }

        // Create server-side search form HTML
        const serverSearchHTML = `
            <form id="serverSearchForm" class="form-inline search-form server-search-form">
                <!--<div class="server-search-label">
                    <label for="serverSearchInput">Enhanced Search:</label>
                </div>-->
                <div class="input-group">
                    <input type="text" class="form-control" id="serverSearchInput" name="serverSearchTerm" 
                           placeholder="Search across all product documents">
                    <button type="button" class="btn btn-outline-secondary" id="clearServerSearchBtn">
                        <span class="bi bi-x-square"></span>
                    </button>
                    <button type="submit" class="btn btn-primary" id="serverSearchSubmitBtn">
                        <span class="bi bi-search"></span>
                    </button>
                </div>
                <div id="serverSearchStatus" class="search-status"></div>
                <div id="serverSearchWaitMsg" class="search-wait-msg" style="display: none;">
                    <div class="d-flex align-items-center">
                        <div class="spinner-border text-primary mr-2" role="status"></div>
                        <p class="mb-0">Searching with enhanced capabilities...</p>
                    </div>
                </div>
            </form>
        `;

        // Insert server search form after existing search form
        existingSearchForm.insertAdjacentHTML('afterend', serverSearchHTML);

        // Store references to DOM elements
        this.searchForm = document.getElementById('serverSearchForm');
        this.searchInput = document.getElementById('serverSearchInput');
        this.clearBtn = document.getElementById('clearServerSearchBtn');
        this.waitMsg = document.getElementById('serverSearchWaitMsg');
        this.statusDiv = document.getElementById('serverSearchStatus');
        
        this.createResultsContainer();
    }

    /**
     * Create results container for server-side search
     */
    createResultsContainer() {
        const existingResultsDiv = document.getElementById('searchResultsDiv');
        if (!existingResultsDiv) {
            console.error('Existing search results div not found');
            return;
        }

        // Create server search results HTML with static pagination controls
        const serverResultsHTML = `
            <style>
                body.light-mode #serverSearchResultsDiv .search-results-header h2 {
                    color: #fff !important;
                    text-shadow: 0 1px 4px rgba(0,0,0,0.18);
                }
            </style>
            <div id="serverSearchResultsDiv" class="search-results-div server-search-results" style="display: none;">
                <div class="search-results-header">
                    <h2>Enhanced Search Results</h2>
                    <button id="closeServerResultsBtn" class="close-results-btn btn btn-link" aria-label="Close">
                        <i class="bi bi-box-arrow-right"></i>
                    </button>
                </div>
                <div id="serverSearchResultsContainer" class="search-results-container">
                    <!-- Results will be dynamically loaded here -->
                </div>
                <div id="serverSearchInfo" class="search-info">
                    <small class="text-muted">
                        Searching in: <strong>${this.currentProduct.name}</strong>
                    </small>
                    <div id="paginationFooter" class="pagination-footer modern-pagination" style="display:inline-flex; align-items:center; gap:0.5rem; margin-left:1rem;">
                        <button type="button" class="page-btn modern-btn" id="prevPageBtn" disabled aria-label="Previous page">&#8592;</button>
                        <select id="pageDropdown" class="modern-dropdown"></select>
                        <button type="button" class="page-btn modern-btn" id="nextPageBtn" disabled aria-label="Next page">&#8594;</button>
                    </div>
                </div>
            </div>
        `;

        // Insert server results after existing results
        existingResultsDiv.insertAdjacentHTML('afterend', serverResultsHTML);
        
        this.resultsContainer = document.getElementById('serverSearchResultsDiv');
        this.resultsContent = document.getElementById('serverSearchResultsContainer');
    }

    /**
     * Bind event listeners
     */
    bindEvents() {
        // Search form submission (handles Enter key)
        this.searchForm.addEventListener('submit', (e) => {
            e.preventDefault();
            const searchTerm = this.searchInput.value.trim();
            if (searchTerm) {
                this.performSearch(searchTerm, 1, 20, false);
            } else {
                this.updateStatus('Please enter a search term.', true);
            }
        });

        // Server-side search submit button click
        const submitBtn = document.getElementById('serverSearchSubmitBtn');
        if (submitBtn) {
            submitBtn.addEventListener('click', (e) => {
                e.preventDefault();
                const searchTerm = this.searchInput.value.trim();
                if (searchTerm) {
                    this.performSearch(searchTerm, 1, 20, false);
                } else {
                    this.updateStatus('Please enter a search term.', true);
                }
            });
        }

        // Clear button
        this.clearBtn.addEventListener('click', () => {
            this.clearSearch();
        });

        // Close results
        const closeBtn = document.getElementById('closeServerResultsBtn');
        if (closeBtn) {
            closeBtn.addEventListener('click', () => {
                this.hideResults();
            });
        }

        // Enter key support
        this.searchInput.addEventListener('keypress', (e) => {
            if (e.key === 'Enter') {
                e.preventDefault();
                this.performSearch(null, 1, 20, false);
            }
        });
    }

    /**
     * Test API connection and update status
     */
    async testApiConnection() {
        // Try the extensionless health endpoint first, then fall back to health.aspx
        const tryFetch = async (url) => {
            return fetch(url, {
                method: 'GET',
                headers: { 'Content-Type': 'application/json' },
                signal: AbortSignal.timeout(5000)
            });
        };

        const primaryUrl = `${this.apiBaseUrl}/health`;
        const altUrl = `${this.apiBaseUrl}/health.aspx`;

        try {
            console.log('ServerSideSearch: testing health URL', primaryUrl);
            let response;

            try {
                response = await tryFetch(primaryUrl);
            } catch (firstErr) {
                console.warn('ServerSideSearch: primary health fetch failed, will try fallback', firstErr && firstErr.message);
                // Attempt the .aspx fallback when the first network attempt fails
                response = await tryFetch(altUrl);
            }

            if (response && response.ok) {
                const data = await response.json();
                this.isServiceAvailable = data.status === 'ok';
                this.updateStatus(this.isServiceAvailable ? 'Connected to enhanced search' : 'Service unavailable');
                return;
            }

            // If primary returned 404 (or other non-ok) but we haven't tried the alt yet, try it
            if (response && response.status === 404) {
                console.log('ServerSideSearch: primary health returned 404, trying', altUrl);
                const altResp = await tryFetch(altUrl);
                if (altResp && altResp.ok) {
                    const data = await altResp.json();
                    this.isServiceAvailable = data.status === 'ok';
                    this.updateStatus(this.isServiceAvailable ? 'Connected to enhanced search' : 'Service unavailable');
                    return;
                }
                throw new Error(`HTTP ${altResp ? altResp.status : 'no response'}`);
            }

            throw new Error(`HTTP ${response ? response.status : 'no response'}`);
        } catch (error) {
            console.warn('Server-side search service unavailable:', error && error.message);
            this.isServiceAvailable = false;
            this.updateStatus('Enhanced search unavailable - using fallback');
        }
    }

    /**
     * Update status message
     */
    updateStatus(message, isError = false) {
        if (this.statusDiv) {
            this.statusDiv.textContent = message;
            this.statusDiv.className = `search-status ${isError ? 'error' : 'info'}`;
        }
    }

    /**
     * Perform server-side search
     * @param {string|null} searchTerm - The search term
     * @param {number} page - Page number
     * @param {number} size - Page size
     * @param {boolean} suppressStatus - If true, do not show loading/status (for pagination)
     */
    async performSearch(searchTerm = null, page = 1, size = 20, suppressStatus = false) {
        if (!searchTerm) {
            searchTerm = this.searchInput.value.trim();
        }
        if (!searchTerm) {
            if (!suppressStatus) this.updateStatus('Please enter a search term', true);
            return;
        }

        if (!suppressStatus) {
            this.showLoading();
            this.updateStatus('Searching...');
        }

        try {
            // If service is unavailable, fall back to client-side search
            if (!this.isServiceAvailable) {
                this.fallbackToClientSearch(searchTerm);
                return;
            }

            console.log('ServerSideSearch: performSearch', { searchTerm, page, size });
            const searchResults = await this.callSearchAPI(searchTerm, page, size);
            console.log('ServerSideSearch: performSearch received', searchResults && (searchResults.pagination || {}).total);
            this.displayResults(searchResults, searchTerm, suppressStatus);
        } catch (error) {
            console.error('Search error:', error);
            if (!suppressStatus) this.updateStatus('Search failed - trying fallback method', true);
            this.fallbackToClientSearch(searchTerm, error && (error.message || String(error)));
        } finally {
            if (!suppressStatus) this.hideLoading();
        }
    }

    /**
     * Call the FastAPI search endpoint
     */
    async callSearchAPI(searchTerm, page = 1, size = 20) {
            console.log('callSearchAPI: data.data length before filtering', Array.isArray(data.data) ? data.data.length : 'not an array');
            console.log('callSearchAPI: data.data before filtering', data.data);
            // Log product_name and product for each result before filtering
            data.data.forEach((result, idx) => {
                console.log(`callSearchAPI: result[${idx}] product_name=`, result.product_name, 'product=', result.product);
            });
    // Debug: log raw API response before filtering
    console.log('callSearchAPI: raw API response', data);
        const searchProducts = this.getSearchProducts();
        const params = new URLSearchParams({
            q: searchTerm,
            page: page,
            size: size
        });

        // Add product filter for single-product searches
        if (searchProducts.length === 1) {
            params.append('product', searchProducts[0]);
        }

        const response = await fetch(`${this.apiBaseUrl}/search?${params}`, {
            method: 'GET',
            headers: {
                'Content-Type': 'application/json',
            },
            signal: AbortSignal.timeout(30000) // 30 second timeout
        });

        if (!response.ok) {
            throw new Error(`Search API error: ${response.status} ${response.statusText}`);
        }

        const data = await response.json();

        // Debug: log raw API response and allowed product names
        console.log('Raw API response:', data);
        if (searchProducts.length > 1) {
            const allowed = searchProducts.map(p => p.toLowerCase());
            console.log('Allowed product names:', allowed);
            data.data = data.data.filter(result => {
                const prod = (result.product_name || result.product || '').toLowerCase();
                if (!allowed.includes(prod)) {
                    console.log('Filtered out result:', result);
                }
                return allowed.includes(prod);
            });
        }

        return data;
    }

    /**
     * Display search results
     * @param {object} searchData - The search results data
     * @param {string} searchTerm - The search term
     * @param {boolean} suppressStatus - If true, do not update status (for pagination)
     */
    displayResults(searchData, searchTerm, suppressStatus = false) {
        // Log before rendering
        // console.log('displayResults: results', searchData.data || []);
        // console.log('displayResults: about to render, results.length =', (searchData.data || []).length);
        // console.log('displayResults: resultsContent', this.resultsContent);
        if (!this.resultsContent) {
            console.error('displayResults: resultsContent is not defined!');
        }
        // Debug: check resultsContent before rendering
        // console.log('displayResults: resultsContent', this.resultsContent);
        if (!this.resultsContent) {
            console.error('displayResults: resultsContent is not defined!');
        }
        const results = searchData.data || [];
        const total = searchData.pagination?.total || 0;
        const page = searchData.pagination?.page || 1;
        const size = searchData.pagination?.size || 20;
        const totalPages = Math.ceil(total / size);

        // Find max score for normalization
        const maxScore = results.length > 0 ? Math.max(...results.map(r => r.score || 0)) : 1;

        let html = '';

        if (results.length === 0) {
            html = `
                <div class="no-results">
                    <h4>No results found</h4>
                    <p>Try different keywords.</p>
                </div>
            `;
        } else {
            html = `
                <div class="results-summary">
                    <p><strong>${total}</strong> results found for "${searchTerm}"</p>
                </div>
                <div class="results-list">
                    ${results.map(result => this.formatResult(result, searchTerm, maxScore)).join('')}
                </div>
            `;
        }

        this.resultsContent.innerHTML = html;
        this.showResults();
        if (!suppressStatus) this.updateStatus(`Found ${total} results`);

        // Always update pagination controls after rendering results, using latest page/totalPages
        setTimeout(() => {
            this.updatePaginationControls(page, totalPages, searchTerm, size, suppressStatus);
        }, 0);
    }

    /**
     * Update pagination controls
     * @param {number} currentPage
     * @param {number} totalPages
     * @param {string} searchTerm
     * @param {number} size
     * @param {boolean} suppressStatus - If true, pass to performSearch for pagination
     */
    updatePaginationControls(currentPage, totalPages, searchTerm, size, suppressStatus = false) {
        const prevBtn = document.getElementById('prevPageBtn');
        const nextBtn = document.getElementById('nextPageBtn');
        const dropdown = document.getElementById('pageDropdown');
        if (!prevBtn || !nextBtn || !dropdown) return;

        // Remove all options
        dropdown.innerHTML = '';
        for (let i = 1; i <= totalPages; i++) {
            const opt = document.createElement('option');
            opt.value = i;
            opt.textContent = `Page ${i} of ${totalPages}`;
            dropdown.appendChild(opt);
        }
        dropdown.value = String(currentPage);

        prevBtn.disabled = currentPage === 1;
        nextBtn.disabled = currentPage === totalPages;

        // Remove all previous event listeners by replacing with new element and copying attributes
        const prevBtnClone = prevBtn.cloneNode(true);
        prevBtn.parentNode.replaceChild(prevBtnClone, prevBtn);
        const nextBtnClone = nextBtn.cloneNode(true);
        nextBtn.parentNode.replaceChild(nextBtnClone, nextBtn);
        const dropdownClone = dropdown.cloneNode(true);
        dropdown.parentNode.replaceChild(dropdownClone, dropdown);

        // Set dropdown value again after cloning
        dropdownClone.value = String(currentPage);

        prevBtnClone.disabled = currentPage === 1;
        nextBtnClone.disabled = currentPage === totalPages;

        prevBtnClone.addEventListener('click', (e) => {
            e.preventDefault();
            if (currentPage > 1) this.performSearch(searchTerm, currentPage - 1, size, true);
        });
        nextBtnClone.addEventListener('click', (e) => {
            e.preventDefault();
            if (currentPage < totalPages) this.performSearch(searchTerm, currentPage + 1, size, true);
        });
        dropdownClone.addEventListener('change', (e) => {
            e.preventDefault();
            const selectedPage = parseInt(e.target.value);
            if (!isNaN(selectedPage)) this.performSearch(searchTerm, selectedPage, size, true);
        });
    }

    renderStickyPaginationFooter(currentPage, totalPages, searchTerm, size) {
        // Remove existing footer if present
        let footer = document.getElementById('paginationFooter');
        if (footer) footer.remove();

        if (totalPages <= 1) return;

        // Build dropdown options
        let options = '';
        for (let i = 1; i <= totalPages; i++) {
            options += `<option value="${i}"${i === currentPage ? ' selected' : ''}>Page ${i} of ${totalPages}</option>`;
        }

        // Build footer HTML
        const footerHtml = `
            <div id="paginationFooter" class="pagination-footer sticky-footer">
                <button class="page-btn" id="prevPageBtn" ${currentPage === 1 ? 'disabled' : ''}>Previous</button>
                <select id="pageDropdown">${options}</select>
                <button class="page-btn" id="nextPageBtn" ${currentPage === totalPages ? 'disabled' : ''}>Next</button>
            </div>
        `;

        // Insert footer after results container
        this.resultsContainer.insertAdjacentHTML('beforeend', footerHtml);

        // Add event listeners
        document.getElementById('prevPageBtn').addEventListener('click', () => {
            e.preventDefault();
            if (currentPage > 1) this.performSearch(searchTerm, currentPage - 1, size);
        });
        document.getElementById('nextPageBtn').addEventListener('click', () => {
            e.preventDefault();
            if (currentPage < totalPages) this.performSearch(searchTerm, currentPage + 1, size);
        });
        document.getElementById('pageDropdown').addEventListener('change', (e) => {
            e.preventDefault();
            const selectedPage = parseInt(e.target.value);
            if (!isNaN(selectedPage)) this.performSearch(searchTerm, selectedPage, size);
        });
    }


    // Update callSearchAPI to accept page and size
    async callSearchAPI(searchTerm, page = 1, size = 20) {
        const searchProducts = this.getSearchProducts();
        const params = new URLSearchParams({
            q: searchTerm,
            page: page,
            size: size
        });

        // Add product filter for single-product searches
        if (searchProducts.length === 1) {
            params.append('product', searchProducts[0]);
        }

        const response = await fetch(`${this.apiBaseUrl}/search?${params}`, {
            method: 'GET',
            headers: {
                'Content-Type': 'application/json',
            },
            signal: AbortSignal.timeout(30000) // 30 second timeout
        });

        if (!response.ok) {
            throw new Error(`Search API error: ${response.status} ${response.statusText}`);
        }

        // Try to parse JSON; if the API returns HTML or text, log it for debugging
        let data;
        try {
            data = await response.json();
        } catch (parseErr) {
            const text = await response.text();
            console.warn('callSearchAPI: Response was not JSON. Response text:', text.substring(0, 200));
            throw new Error('Search API returned non-JSON response');
        }

        // For multi-product searches, filter results by allowed products
        if (searchProducts.length > 1) {
            console.log('callSearchAPI: filtering for products', searchProducts);
            // Log product_name and product for each result before filtering
            data.data.forEach((result, idx) => {
                console.log(`callSearchAPI: result[${idx}] product_name=`, result.product_name, 'product=', result.product);
            });
            const allowed = searchProducts.map(p => p.toLowerCase().trim());
            data.data = data.data.filter(result => {
                const prod = ((result.product_name || result.product) || '').toLowerCase().trim();
                const match = allowed.includes(prod);
                if (!match) {
                    console.log('callSearchAPI: filtered out', prod, 'allowed:', allowed);
                }
                return match;
            });
            console.log('callSearchAPI: filtered results', data.data);
        }

        return data;
    }

    /**
     * Format individual search result
     */
    formatResult(result, searchTerm, maxScore = 1) {
        // Debug: log the result object and key fields
        // console.log('formatResult: result object', result);
    const docTitle = result.title || 'Untitled Document';
    const sectionTitle = result.section_name || '';
    const content = result.content || '';
    const productName = result.product_name || result.product || '';
    const sectionName = result.section_name || '';
    const score = result.score || 0;
    const url = result.url || ('/' + result.file_path) || '#';

        // Create snippet with highlighting
        const snippet = this.createSnippet(content, searchTerm, 200);
        // Normalize score to percentage
        const scorePercent = maxScore > 0 ? Math.round((score / maxScore) * 100) : 0;

        return `
            <div class="search-result-item">
                <div class="result-header">
                    <h5 class="result-title">
                        <a href="${url}" target="_blank">${this.highlightText(docTitle, searchTerm)}</a>
                    </h5>
                    ${sectionTitle ? `<div class="section-title" style="font-size:0.95em;font-style:italic;opacity:0.85;">${sectionTitle}</div>` : ''}
                    <div class="result-meta">
                        <span class="product-badge">${productName}</span>
                        ${sectionTitle ? `<span class="section-badge">${sectionTitle}</span>` : ''}
                        <span class="score-badge">${scorePercent}% match</span>
                    </div>
                </div>
                <div class="result-content">
                    <p>${snippet}</p>
                </div>
            </div>
        `;
    }

    /**
     * Create content snippet with highlighting
     */
    createSnippet(content, searchTerm, maxLength = 200) {
        if (!content) return '';
        
        const cleanContent = content.replace(/<[^>]*>/g, ''); // Strip HTML
        const searchIndex = cleanContent.toLowerCase().indexOf(searchTerm.toLowerCase());
        
        if (searchIndex === -1) {
            // Term not found, return beginning of content
            const snippet = cleanContent.substring(0, maxLength);
            return snippet.length < cleanContent.length ? snippet + '...' : snippet;
        }
        
        // Extract around the search term
        const start = Math.max(0, searchIndex - 100);
        const end = Math.min(cleanContent.length, searchIndex + searchTerm.length + 100);
        let snippet = cleanContent.substring(start, end);
        
        if (start > 0) snippet = '...' + snippet;
        if (end < cleanContent.length) snippet = snippet + '...';
        
        return this.highlightText(snippet, searchTerm);
    }

    /**
     * Highlight search terms in text
     */
    highlightText(text, searchTerm) {
        if (!searchTerm) return text;
        
        const regex = new RegExp(`(${searchTerm})`, 'gi');
        return text.replace(regex, '<mark class="search-highlight">$1</mark>');
    }

    /**
     * Fallback to client-side search (temporarily disabled)
     */
    fallbackToClientSearch(searchTerm) {
        // Disabled: No fallback logic while server-side search is being restored
        this.updateStatus('No enhanced results found. Fallback search is currently disabled.');
    }

    /**
     * Show/hide loading state
     */
    showLoading() {
        if (this.waitMsg) this.waitMsg.style.display = 'block';
    }

    hideLoading() {
        if (this.waitMsg) this.waitMsg.style.display = 'none';
    }

    /**
     * Show/hide results
     */
    showResults() {
        if (this.resultsContainer) {
            this.resultsContainer.style.display = 'block';
            // Hide existing results if both are shown
            const existingResults = document.getElementById('searchResultsDiv');
            if (existingResults && existingResults.style.display === 'block') {
                existingResults.style.display = 'none';
            }
        }
    }

    hideResults() {
        if (this.resultsContainer) {
            this.resultsContainer.style.display = 'none';
        }
    }

    /**
     * Clear search
     */
    clearSearch() {
        this.searchInput.value = '';
        this.hideResults();
        this.updateStatus('Connected to enhanced search');
    }
}

// Initialize when script loads
window.ServerSideSearch = ServerSideSearch;

// Auto-initialize if DOM is ready
if (document.readyState !== 'loading') {
    window.serverSideSearch = new ServerSideSearch();
} else {
    document.addEventListener('DOMContentLoaded', () => {
        window.serverSideSearch = new ServerSideSearch();
    });
}