"use strict";
/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Widget
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.usePopoutsStore = void 0;
const immer_1 = require("immer");
const zustand_1 = require("zustand");
const core_bentley_1 = require("@itwin/core-bentley");
/** @internal */
exports.usePopoutsStore = (0, zustand_1.create)((set) => ({
    popouts: {},
    setPopout: (widgetId, container) => {
        set((state) => (0, immer_1.default)(state, (draft) => {
            if (!container) {
                delete draft.popouts[widgetId];
                return;
            }
            draft.popouts[widgetId] = (0, immer_1.castDraft)(container);
        }));
    },
    onClosePopoutWidget: new core_bentley_1.BeEvent(),
}));
//# sourceMappingURL=usePopoutsStore.js.map