/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
import { cx } from "../styles/styler.js";
import { Box } from "./Box.js";
import { Fragment } from "react";
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
//#region src/components/SvgFloatingOverlay.tsx
const SvgFloatingOverlay = ({ blurClassName, blurStyle, childTransitionStyle, svgPath, dimensions, shadows, svgClassNames, shadowFilterId, shadowPadding, arrowHeight, contentWrapperSlotProps, contentOverflow = "auto", children, borderRadius, svgBaseStyle, svgBorderStyle }) => {
	const svgSharedProps = {
		"aria-hidden": true,
		style: childTransitionStyle,
		viewBox: `0 0 ${dimensions.width} ${dimensions.height}`
	};
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(Box, {
			className: blurClassName,
			style: {
				...blurStyle,
				...childTransitionStyle
			}
		}),
		svgPath && /* @__PURE__ */ jsxs("svg", {
			...svgSharedProps,
			className: cx("absolute top-0 left-0 w-full h-full overflow-visible pointer-events-none", "z-[2]"),
			children: [
				shadows.length > 0 && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", {
					id: shadowFilterId,
					filterUnits: "userSpaceOnUse",
					x: -(shadowPadding + arrowHeight),
					y: -(shadowPadding + arrowHeight),
					width: dimensions.width + 2 * (shadowPadding + arrowHeight),
					height: dimensions.height + 2 * (shadowPadding + arrowHeight),
					colorInterpolationFilters: "sRGB",
					children: [
						shadows.map((shadow, i) => /* @__PURE__ */ jsxs(Fragment, { children: [
							shadow.spread !== 0 && /* @__PURE__ */ jsx("feMorphology", {
								in: "SourceAlpha",
								operator: shadow.spread > 0 ? "dilate" : "erode",
								radius: Math.abs(shadow.spread),
								result: `spread${i}`
							}),
							/* @__PURE__ */ jsx("feGaussianBlur", {
								in: shadow.spread !== 0 ? `spread${i}` : "SourceAlpha",
								stdDeviation: shadow.blur / 2,
								result: `blurred${i}`
							}),
							/* @__PURE__ */ jsx("feOffset", {
								in: `blurred${i}`,
								dx: shadow.x,
								dy: shadow.y,
								result: `offset${i}`
							}),
							/* @__PURE__ */ jsx("feFlood", {
								floodColor: shadow.color,
								result: `color${i}`
							}),
							/* @__PURE__ */ jsx("feComposite", {
								in: `color${i}`,
								in2: `offset${i}`,
								operator: "in",
								result: `shadow${i}`
							})
						] }, i)),
						/* @__PURE__ */ jsx("feMerge", {
							result: "mergedShadows",
							children: shadows.map((_, i) => /* @__PURE__ */ jsx("feMergeNode", { in: `shadow${i}` }, i))
						}),
						/* @__PURE__ */ jsx("feComposite", {
							in: "mergedShadows",
							in2: "SourceAlpha",
							operator: "out"
						})
					]
				}) }),
				shadows.length > 0 && /* @__PURE__ */ jsx("path", {
					d: svgPath,
					fill: "black",
					filter: `url(#${shadowFilterId})`
				}),
				/* @__PURE__ */ jsx("path", {
					d: svgPath,
					className: svgClassNames.base,
					style: svgBaseStyle
				})
			]
		}),
		/* @__PURE__ */ jsx(Box, {
			position: "relative",
			flexGrow: "1",
			overflow: "hidden",
			...contentWrapperSlotProps,
			className: cx("z-[3]", "max-h-full", "gap-[inherit]", contentWrapperSlotProps?.className),
			style: {
				...childTransitionStyle,
				borderRadius
			},
			children: /* @__PURE__ */ jsx(Box, {
				overflow: contentOverflow,
				flexGrow: "1",
				display: "block",
				className: "max-h-full gap-[inherit]",
				children
			})
		}),
		svgPath && svgClassNames.border && /* @__PURE__ */ jsx("svg", {
			...svgSharedProps,
			className: cx("absolute top-0 left-0 w-full h-full overflow-visible pointer-events-none", "z-[3]"),
			children: /* @__PURE__ */ jsx("path", {
				d: svgPath,
				className: svgClassNames.border,
				fill: "transparent",
				style: svgBorderStyle
			})
		})
	] });
};
SvgFloatingOverlay.displayName = "SvgFloatingOverlay";
//#endregion
export { SvgFloatingOverlay };
