"use strict";
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useModal = void 0;
var react_1 = require("react");
var useModal = function () {
    var _a = __read((0, react_1.useState)(false), 2), modal = _a[0], setModal = _a[1];
    var _b = __read((0, react_1.useState)(null), 2), content = _b[0], setContent = _b[1];
    var open = function (content) {
        if (!content)
            throw new Error('must specify context with useModal open()');
        setContent(content);
        setModal(true);
    };
    var close = function () { return setModal(false); };
    return { modal: modal, content: content, open: open, close: close };
};
exports.useModal = useModal;
//# sourceMappingURL=useModal.js.map