"use strict";
/**
 * CSS selectors and IDs used by the screenshot/unfurl service.
 * These are shared between the frontend (where elements are rendered) and backend (where Playwright waits for them).
 *
 * IMPORTANT: Changes to these constants must be coordinated between frontend and backend deployments.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.SCREENSHOT_SELECTORS = exports.LOGIN_PAGE_ID = exports.ERROR_BOUNDARY_ID = exports.DASHBOARD_GRID_CLASS = exports.MARKDOWN_TILE_CLASS = exports.LOADING_CHART_CLASS = exports.LOADING_CHART_OVERLAY_CLASS = exports.SCREENSHOT_PROGRESS_INDICATOR_ID = exports.SCREENSHOT_READY_INDICATOR_ID = void 0;
/**
 * ID of the element that signals when a dashboard/chart is ready for screenshot.
 * The UnfurlService waits for this element to appear before taking a screenshot.
 *
 * Usage:
 * - Frontend: Rendered by ScreenshotReadyIndicator component
 * - Backend: Waited for by UnfurlService.saveScreenshot()
 */
exports.SCREENSHOT_READY_INDICATOR_ID = 'lightdash-ready-indicator';
/**
 * ID of an element that is always mounted on minimal pages and exposes the
 * current screenshot progress: which tiles are expected, ready, and errored.
 *
 * Unlike SCREENSHOT_READY_INDICATOR_ID, this element exists from first paint
 * so the UnfurlService can read it on timeout to identify which tile UUIDs
 * are still unaccounted for.
 *
 * Data attributes:
 * - data-tiles-expected: JSON array of tile UUIDs expected to render
 * - data-tiles-ready:    JSON array of tile UUIDs that called markTileScreenshotReady
 * - data-tiles-errored:  JSON array of tile UUIDs that called markTileScreenshotErrored
 *
 * Usage:
 * - Frontend: Rendered by ScreenshotProgressIndicator on minimal pages
 * - Backend:  Read by UnfurlService when waitForSelector(READY_INDICATOR) times out
 */
exports.SCREENSHOT_PROGRESS_INDICATOR_ID = 'lightdash-screenshot-progress';
/**
 * Class name for tile loading skeleton overlays.
 * The UnfurlService waits for these elements to be hidden (loading complete).
 *
 * Usage:
 * - Frontend: Applied by TileBaseV2 LoadingSkeletonOverlay
 * - Backend: Waited for by UnfurlService.saveScreenshot()
 */
exports.LOADING_CHART_OVERLAY_CLASS = 'loading_chart_overlay';
/**
 * Class name for chart loading state.
 * The UnfurlService waits for these elements to be hidden (loading complete).
 *
 * Usage:
 * - Frontend: Applied by chart components during loading
 * - Backend: Waited for by UnfurlService.saveScreenshot()
 */
exports.LOADING_CHART_CLASS = 'loading_chart';
/**
 * Class name for markdown tile content.
 * The UnfurlService waits for these elements to be attached to the DOM.
 *
 * Usage:
 * - Frontend: Applied to MarkdownPreview in DashboardMarkdownTile
 * - Backend: Waited for by UnfurlService.saveScreenshot()
 */
exports.MARKDOWN_TILE_CLASS = 'markdown-tile';
/**
 * Class name for the dashboard screenshot/PDF target wrapper.
 * Wraps the dashboard's grid(s) so the backend can measure and screenshot a
 * single deterministic element. When a multi-tab PDF export is rendered we
 * stack one <ResponsiveGridLayout> per tab; this wrapper encompasses all of
 * them so getBoundingClientRect / locator.screenshot capture every tab.
 *
 * Note: do NOT use `react-grid-layout` here — that class is also applied by
 * the third-party grid library to every grid instance, so a multi-grid render
 * would yield multiple matches and the backend would only see the first one.
 *
 * Usage:
 * - Frontend: Applied to the wrapper <div> in MinimalDashboardContent
 * - Backend: Screenshot selector in UnfurlService.saveScreenshot()
 */
exports.DASHBOARD_GRID_CLASS = 'lightdash-dashboard-screenshot-target';
/**
 * ID of the element rendered by the error boundary fallback.
 * The UnfurlService checks for this element to detect when an error occurred.
 *
 * Usage:
 * - Frontend: Rendered by ErrorBoundary fallback component
 * - Backend: Checked by UnfurlService.saveScreenshot() to detect errors
 */
exports.ERROR_BOUNDARY_ID = 'lightdash-error-boundary';
/**
 * ID of the element rendered on the login page.
 * The UnfurlService checks for this element to detect when authentication failed
 * and the user was redirected to the login page instead of the requested content.
 *
 * Usage:
 * - Frontend: Rendered by LoginLanding Card component
 * - Backend: Checked by UnfurlService.saveScreenshot() to detect auth redirects
 */
exports.LOGIN_PAGE_ID = 'lightdash-login-page';
/**
 * CSS Selectors (with prefix for direct use in querySelector/CSS)
 */
exports.SCREENSHOT_SELECTORS = {
    /** ID selector: #lightdash-ready-indicator */
    READY_INDICATOR: `#${exports.SCREENSHOT_READY_INDICATOR_ID}`,
    /** ID selector: #lightdash-screenshot-progress */
    PROGRESS_INDICATOR: `#${exports.SCREENSHOT_PROGRESS_INDICATOR_ID}`,
    /** Class selector: .loading_chart_overlay */
    LOADING_OVERLAY: `.${exports.LOADING_CHART_OVERLAY_CLASS}`,
    /** Class selector: .loading_chart */
    LOADING_CHART: `.${exports.LOADING_CHART_CLASS}`,
    /** Class selector: .markdown-tile */
    MARKDOWN_TILE: `.${exports.MARKDOWN_TILE_CLASS}`,
    /** Class selector: .react-grid-layout */
    DASHBOARD_GRID: `.${exports.DASHBOARD_GRID_CLASS}`,
    /** ID selector: #lightdash-error-boundary */
    ERROR_BOUNDARY: `#${exports.ERROR_BOUNDARY_ID}`,
    /** ID selector: #lightdash-login-page */
    LOGIN_PAGE: `#${exports.LOGIN_PAGE_ID}`,
};
//# sourceMappingURL=screenshot.js.map