'use client';
'use strict';

var _tslib = require('../_virtual/_tslib.js');
var index_module = require('../external/@radix-ui/react-dialog/dist/index.module.js');
var index = require('../external/classnames/index.js');
var React = require('react');
var dialog_module = require('./dialog.module.css.js');

var Root = React.forwardRef(function Dialog(_a, ref) {
    var className = _a.className, defaultOpen = _a.defaultOpen, open = _a.open, onOpenChange = _a.onOpenChange, modal = _a.modal, otherProps = _tslib.__rest(_a, ["className", "defaultOpen", "open", "onOpenChange", "modal"]);
    return (React.createElement(index_module.Root, { defaultOpen: defaultOpen, open: open, onOpenChange: onOpenChange, modal: modal },
        React.createElement(index_module.Portal, null,
            React.createElement(index_module.Overlay, _tslib.__assign({ ref: ref, asChild: true, className: index(className, dialog_module.root) }, otherProps)))));
});
var Content = React.forwardRef(function Content(_a, ref) {
    var onOpenAutoFocus = _a.onOpenAutoFocus, initialFocusRef = _a.initialFocusRef, otherProps = _tslib.__rest(_a, ["onOpenAutoFocus", "initialFocusRef"]);
    var onOpenAutoFocusCallback = React.useCallback(function (e) {
        var _a;
        if (initialFocusRef) {
            e.preventDefault();
            (_a = initialFocusRef.current) === null || _a === void 0 ? void 0 : _a.focus();
        }
        onOpenAutoFocus === null || onOpenAutoFocus === void 0 ? void 0 : onOpenAutoFocus(e);
    }, [initialFocusRef, onOpenAutoFocus]);
    return React.createElement(index_module.Content, _tslib.__assign({ ref: ref, asChild: true, onOpenAutoFocus: onOpenAutoFocusCallback }, otherProps));
});
var Dialog = { Root: Root, Content: Content };

exports.Content = Content;
exports.Dialog = Dialog;
exports.Root = Root;
//# sourceMappingURL=dialog.js.map
