"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RenderPeritext = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const Chrome_1 = require("./Chrome");
const context_1 = require("./context");
const state_1 = require("./state");
const RenderPeritext = ({ surface, opts, children }) => {
    const value = React.useMemo(() => ({ surface, toolbar: new state_1.ToolbarState(surface, opts) }), [surface, opts]);
    const toolbar = value.toolbar;
    React.useLayoutEffect(() => toolbar.start(), [toolbar]);
    return (React.createElement(context_1.context.Provider, { value: value },
        React.createElement(Chrome_1.Chrome, null, children)));
};
exports.RenderPeritext = RenderPeritext;
//# sourceMappingURL=RenderPeritext.js.map