"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 Hooks
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.useAvailableUiItemsProviders = void 0;
const react_1 = require("react");
const UiItemsManager_1 = require("../ui-items-provider/UiItemsManager");
/** React hook that maintains the number of available UiItemsProviders. This allows components to use it to refresh when a
 * UiItemsProviders is added or removed allowing the ui component to be re-rendered.
 * @internal
 */
function useAvailableUiItemsProviders() {
    const [uiItemsProviderIds, setUiItemsProviderIds] = (0, react_1.useState)(UiItemsManager_1.UiItemsManager.registeredProviderIds);
    (0, react_1.useEffect)(() => {
        return UiItemsManager_1.UiItemsManager.onUiProviderRegisteredEvent.addListener(() => {
            setUiItemsProviderIds(UiItemsManager_1.UiItemsManager.registeredProviderIds);
        });
    }, []);
    return uiItemsProviderIds;
}
exports.useAvailableUiItemsProviders = useAvailableUiItemsProviders;
//# sourceMappingURL=useAvailableUiItemsProviders.js.map