{"version":3,"sources":["jsdelivr-header.js","/npm/happo@6.10.2/src/config/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACuYO,SAAS,aAAa,GAC3B,OAAO,CACT,Q","file":"/npm/happo@6.10.2/dist/config/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/happo@6.10.2/dist/config/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","export interface StorybookIntegration {\n  type: 'storybook';\n\n  /**\n   * The directory containing the Storybook configuration\n   */\n  configDir?: string;\n\n  /**\n   * The directory containing the static files to serve\n   */\n  staticDir?: string;\n\n  /**\n   * The directory to output the static Storybook package to\n   */\n  outputDir?: string;\n\n  /**\n   * Whether to use a prebuilt Storybook package. If you use this option, make\n   * sure that files are built to the outputDir.\n   */\n  usePrebuiltPackage?: boolean;\n}\n\ninterface BaseE2EIntegration {\n  /**\n   * Whether to allow failures.\n   */\n  allowFailures?: boolean;\n\n  /**\n   * Whether to download and include all assets in the asset package. If false\n   * (default), only local assets will be included. When true, even external\n   * assets will be included.\n   */\n  downloadAllAssets?: boolean;\n\n  /**\n   * When set to `true`, Happo automatically detects elements that are in\n   * `:hover`, `:active`, or `:focus-visible` states at the moment a screenshot\n   * is taken and adds the corresponding `data-happo-hover`,\n   * `data-happo-active`, and `data-happo-focus-visible` attributes. It also\n   * improves focus handling by traversing into shadow DOM to find the deepest\n   * focused element so that `data-happo-focus` is applied reliably.\n   *\n   * Note: basic focus handling (`data-happo-focus` based on `activeElement`)\n   * is always applied regardless of this option.\n   *\n   * This lets you write tests naturally (e.g. hover or focus an element) and\n   * have Happo capture those states without any extra markup.\n   *\n   * Requires `applyPseudoClasses: true` on your targets for the attributes to\n   * be rendered as CSS pseudo-class styles on Happo workers.\n   */\n  autoApplyPseudoStateAttributes?: boolean;\n}\n\ninterface CypressIntegration extends BaseE2EIntegration {\n  type: 'cypress';\n}\n\ninterface PlaywrightIntegration extends BaseE2EIntegration {\n  type: 'playwright';\n}\n\nexport type E2EIntegration = CypressIntegration | PlaywrightIntegration;\n\ninterface CustomIntegration {\n  type: 'custom';\n\n  /**\n   * An async function that generates a custom package. Returns an object with\n   * the path to the folder containing the custom files and the path to the\n   * entry point file relative to the root directory.\n   *\n   * Optionally return `estimatedSnapsCount` to enable server-side auto-chunking,\n   * which parallelizes rendering across multiple workers.\n   *\n   * @example\n   * { rootDir: 'dist/custom', entryPoint: 'index.js', estimatedSnapsCount: 42 }\n   */\n  build: () => Promise<{\n    rootDir: string;\n    entryPoint: string;\n    estimatedSnapsCount?: number;\n  }>;\n}\n\nexport interface Page {\n  /**\n   * URL of the page to screenshot\n   *\n   * Note: The URLs to the website need to be publicly available, otherwise\n   * Happo workers won't be able to access the pages.\n   */\n  url: string;\n\n  /**\n   * Title of the page to screenshot\n   *\n   * This is used as the \"component\" identifier in Happo reports, so ensure\n   * it is unique for each page.\n   */\n  title: string;\n\n  /**\n   * Wait for the content to appear on the page before taking the screenshot.\n   */\n  waitForContent?: string;\n\n  /**\n   * Wait for a condition to be true before taking the screenshot.\n   */\n  waitForSelector?: string;\n}\n\ninterface PagesIntegration {\n  type: 'pages';\n\n  /**\n   * A list of pages to screenshot.\n   */\n  pages: Array<Page>;\n}\n\n/**\n * Settings for deep compare functionality\n */\nexport interface DeepCompareSettings {\n  /**\n   * Threshold for comparing images with the given diff algorithm (float between\n   * 0 and 1). 1 means all differences are allowed. 0 means no differences are\n   * allowed. A good starting value is 0.03 for color-delta and 0.01 for ssim.\n   */\n  compareThreshold: number;\n\n  /**\n   * Algorithm to use for diff comparison. Must be \"color-delta\" or \"ssim\".\n   * Defaults to \"color-delta\" if not provided. Note that \"ssim\" is experimental\n   * and may be removed in the future.\n   */\n  diffAlgorithm?: 'color-delta' | 'ssim';\n\n  /**\n   * Threshold for ignoring individual pixel differences, side-stepping the\n   * compare threshold. Used relatively to the image size. E.g. a value of 0.01\n   * means 1% of the pixels can be above the compare threshold. Use this option\n   * if your screenshots contain images or graphics with sharp noise. It is not\n   * recommended to use this option for other types of diffs. (float\n   * between 0 and 1).\n   */\n  ignoreThreshold?: number;\n\n  /**\n   * Whether to ignore whitespace in the diff. If true, whitespace differences\n   * will not be considered when comparing images. Whitespace is defined as a\n   * vertical section in a screenshot containing a single solid color.\n   */\n  ignoreWhitespace?: boolean;\n\n  /**\n   * Whether to apply blur to the diff. This can be used to smooth out subtle\n   * differences that would otherwise be above the compare threshold. This\n   * should mainly be used when your screenshots have a high contrast and you\n   * want to smooth out some of the sharpness that can otherwise cause flakiness.\n   */\n  applyBlur?: boolean;\n}\n\nexport interface Config {\n  /**\n   * Key used to authenticate with the Happo API. Never store this in plain\n   * text.\n   */\n  apiKey?: string;\n\n  /**\n   * Secret used to authenticate with the Happo API. Never store this in plain\n   * text.\n   */\n  apiSecret?: string;\n\n  /**\n   * The endpoint to use for the happo run. Defaults to `https://happo.io`\n   */\n  endpoint?: string;\n\n  /**\n   * The name of the project to associate the Happo run with. If not provided,\n   * the default project will be used.\n   */\n  project?: string;\n\n  /**\n   * Use this to post Happo statuses as comments to your PR. This can be useful\n   * if the Happo server doesn't have access to your GitHub repository.\n   *\n   * The default is `'https://api.github.com'`. If you are using GitHub\n   * Enterprise, enter the URL to your local GitHub API here, such as\n   * `'https://ghe.mycompany.zone/api/v3'` (the default for GHE installation is\n   * for the API to be located at `/api/v3`).\n   */\n  githubApiUrl?: string;\n\n  /**\n   * Browsers to use when generating snapshots\n   */\n  targets: Record<string, Target>;\n\n  /**\n   * Type of integration to use\n   *\n   * - 'storybook': Use Storybook to generate snapshots\n   * - 'e2e': Use Playwright or Cypress to generate snapshots\n   * - 'custom': Use a custom JS bundle to generate snapshots\n   *\n   * - 'pages': Use a list of pages to generate snapshots\n   */\n  integration?:\n    | StorybookIntegration\n    | CypressIntegration\n    | PlaywrightIntegration\n    | CustomIntegration\n    | PagesIntegration;\n\n  /**\n   * An object with settings for deep compare.\n   */\n  deepCompare?: DeepCompareSettings;\n}\n\ntype MobileSafariBrowserType = 'ios-safari' | 'ipad-safari';\ntype DesktopBrowserType = 'chrome' | 'firefox' | 'edge' | 'safari' | 'accessibility';\nexport type BrowserType = MobileSafariBrowserType | DesktopBrowserType;\n\ninterface BaseTarget {\n  type: BrowserType;\n\n  /**\n   * Split the target into chunks to be run on multiple workers in parallel\n   *\n   * This adds some overhead, so if your test suite isn't large, using more than\n   * one chunk might actually slow things down.\n   */\n  chunks?: number;\n\n  /**\n   * Override the default maximum height (5000px) used by Happo workers\n   *\n   * This is useful when taking screenshots of tall components or pages.\n   *\n   * Note: The maximum width defaults to the maximum height, so if you set\n   * `maxHeight`, you may also want to set `maxWidth` at the same time.\n   */\n  maxHeight?: number;\n\n  /**\n   * Override the default maximum width used by Happo workers (defaults to\n   * `maxHeight`, which defaults to 5000 pixels)\n   *\n   * This is useful when taking screenshots of wide components or pages.\n   */\n  maxWidth?: number;\n\n  /**\n   * Controls how Happo handles elements with the `data-happo-hide` attribute.\n   * By default, elements with this attribute are made invisible. Use the value\n   * `'ignore'` to make the content appear in screenshots but exclude it from\n   * comparison.\n   */\n  hideBehavior?: 'ignore';\n\n  /**\n   * When set to `true`, this option allows you to add `data-happo-hover`,\n   * `data-happo-focus`, and `data-happo-active` attributes to your DOM elements\n   * and have Happo apply the corresponding `:hover`, `:focus`, or `:active`\n   * styles.\n   *\n   * For example, if you have this markup:\n   *\n   * ```html\n   * <button>Hover me</button>\n   * <style>\n   *   button:hover {\n   *     background-color: blue;\n   *   }\n   * </style>\n   * ```\n   *\n   * To apply the hover style before taking the screenshot (making the button\n   * blue), change the markup to:\n   *\n   * ```html\n   * <button data-happo-hover>Hover me</button>\n   * <style>\n   *   button:hover {\n   *     background-color: blue;\n   *   }\n   * </style>\n   * ```\n   *\n   * Similarly, you can add focus to elements using `data-happo-focus`:\n   *\n   * ```html\n   * <input type=\"text\" data-happo-focus />\n   * ```\n   *\n   * And add `data-happo-active` to elements to simulate the `:active` state:\n   *\n   * ```html\n   * <button data-happo-active>Click me</button>\n   * <style>\n   *   button:active {\n   *     background-color: red;\n   *   }\n   * </style>\n   * ```\n   */\n  applyPseudoClasses?: boolean;\n\n  /**\n   * Set `prefersColorScheme: 'dark'` or `prefersColorScheme: 'light'` to set\n   * the color scheme preference in the browser.\n   */\n  prefersColorScheme?: 'light' | 'dark';\n\n  /**\n   * Controls whether pointer events are allowed in the browser. Defaults to\n   * `true`.\n   *\n   * When `true` (the default), Happo does not inject CSS to disable pointer\n   * events, which allows mouse interaction in your tests (e.g., when using\n   * Storybook interactive stories).\n   *\n   * Set `allowPointerEvents: false` to tell Happo to inject CSS that disables\n   * pointer events. This can prevent spurious hover effects caused by the\n   * system mouse pointer.\n   *\n   * If you're interested in testing `:hover`, `:focus`, and `:active` states\n   * with Happo, you may also want to use the `applyPseudoClasses` option.\n   */\n  allowPointerEvents?: boolean;\n\n  /**\n   * Set `freezeAnimations: 'last-frame'` to freeze the animations at the last\n   * frame. This is the default behavior.\n   *\n   * Set `freezeAnimations: 'first-frame'` to freeze the animations at the first\n   * frame.\n   */\n  freezeAnimations?: 'last-frame' | 'first-frame';\n}\n\ninterface MobileSafariTarget extends BaseTarget {\n  type: MobileSafariBrowserType;\n}\n\ninterface DesktopTarget extends BaseTarget {\n  type: DesktopBrowserType;\n\n  /**\n   * Set the viewport size for the browser\n   */\n  viewport: `${number}x${number}`;\n\n  /**\n   * By default, Happo makes the browser prefer reduced motion when rendering\n   * the UI. Set `prefersReducedMotion: false` to disable this behavior.\n   */\n  prefersReducedMotion?: boolean;\n\n  /**\n   * Add additional headers to the outgoing requests from the browser. This is\n   * useful if you for instance need to tell a CDN that the request originates\n   * from a Happo run.\n   */\n  outgoingRequestHeaders?: Array<{ name: string; value: string }>;\n}\n\nexport type Target = MobileSafariTarget | DesktopTarget;\n\nexport interface TargetWithDefaults extends BaseTarget {\n  viewport: `${number}x${number}`;\n  __dynamic: boolean;\n  prefersReducedMotion?: boolean;\n}\n\nexport interface ConfigWithDefaults extends Config {\n  apiKey: NonNullable<Config['apiKey']>;\n  apiSecret: NonNullable<Config['apiSecret']>;\n  integration: NonNullable<Config['integration']>;\n  endpoint: NonNullable<Config['endpoint']>;\n  githubApiUrl: NonNullable<Config['githubApiUrl']>;\n  targets: Record<string, TargetWithDefaults>;\n}\n\nexport function defineConfig(config: Config): Config {\n  return config;\n}\n"]}