/**
 * Copyright IBM Corp. 2020, 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

import { __toESM } from "../../../_virtual/_rolldown/runtime.js";
import { require_classnames } from "../../../node_modules/classnames/index.js";
import { blockClass } from "../PageHeaderUtils.js";
import React, { useEffect, useState } from "react";
import PropTypes from "prop-types";
import { AspectRatio } from "@carbon/react";
import { breakpoints } from "@carbon/layout";

//#region src/components/PageHeader/next/PageHeaderHeroImage.tsx
/**
* Copyright IBM Corp. 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
var import_classnames = /* @__PURE__ */ __toESM(require_classnames());
const PageHeaderHeroImage = ({ className, children, ...other }) => {
	const [lgBreakpoint, setLgBreakpoint] = useState(false);
	const classNames = (0, import_classnames.default)({ [`${blockClass}__hero-image`]: true }, className);
	const lgMediaQuery = `(min-width: ${breakpoints.lg.width})`;
	useEffect(() => {
		const listener = (event) => {
			setLgBreakpoint(event.matches);
		};
		const mediaQueryList = window.matchMedia(lgMediaQuery);
		mediaQueryList.addEventListener("change", listener);
		setLgBreakpoint(mediaQueryList.matches);
		return () => {
			mediaQueryList.removeEventListener("change", listener);
		};
	}, [lgMediaQuery]);
	return /* @__PURE__ */ React.createElement(AspectRatio, {
		className: classNames,
		...other,
		ratio: lgBreakpoint ? "2x1" : "3x2"
	}, children);
};
PageHeaderHeroImage.displayName = "PageHeaderHeroImage";
PageHeaderHeroImage.propTypes = {
	children: PropTypes.node,
	className: PropTypes.string
};

//#endregion
export { PageHeaderHeroImage };