"use client";
import {
  useDialogScopedContext
} from "./A62MDFCW.js";
import {
  useButton
} from "./HMKTUWOU.js";
import {
  createElement,
  createHook,
  forwardRef
} from "./GWSL6KNJ.js";
import {
  useEvent
} from "./KPHZR4MB.js";

// src/dialog/dialog-dismiss.tsx
import { useMemo } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
var TagName = "button";
var useDialogDismiss = createHook(
  function useDialogDismiss2({ store, ...props }) {
    const context = useDialogScopedContext();
    store = store || context;
    const onClickProp = props.onClick;
    const onClick = useEvent((event) => {
      onClickProp == null ? void 0 : onClickProp(event);
      if (event.defaultPrevented) return;
      store == null ? void 0 : store.hide();
    });
    const children = useMemo(
      () => /* @__PURE__ */ jsxs(
        "svg",
        {
          "aria-label": "Dismiss popup",
          display: "block",
          fill: "none",
          stroke: "currentColor",
          strokeLinecap: "round",
          strokeLinejoin: "round",
          strokeWidth: 1.5,
          viewBox: "0 0 16 16",
          height: "1em",
          width: "1em",
          children: [
            /* @__PURE__ */ jsx("line", { x1: "4", y1: "4", x2: "12", y2: "12" }),
            /* @__PURE__ */ jsx("line", { x1: "4", y1: "12", x2: "12", y2: "4" })
          ]
        }
      ),
      []
    );
    props = {
      "data-dialog-dismiss": "",
      children,
      ...props,
      onClick
    };
    props = useButton(props);
    return props;
  }
);
var DialogDismiss = forwardRef(function DialogDismiss2(props) {
  const htmlProps = useDialogDismiss(props);
  return createElement(TagName, htmlProps);
});

export {
  useDialogDismiss,
  DialogDismiss
};
