/*---------------------------------------------------------------------------------------------
 * 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
 */
import { castDraft, produce } from "immer";
import { create } from "zustand";
import { BeEvent } from "@itwin/core-bentley";
/** @internal */
export const usePopoutsStore = create((set) => ({
    popouts: {},
    setPopout: (widgetId, container) => {
        set((state) => produce(state, (draft) => {
            if (!container) {
                delete draft.popouts[widgetId];
                return;
            }
            draft.popouts[widgetId] = castDraft(container);
        }));
    },
    onClosePopoutWidget: new BeEvent(),
}));
//# sourceMappingURL=usePopoutsStore.js.map