import { a as __awaiter } from './tslib.es6-ab63fd84.js';
import { useState, useEffect, useCallback } from 'react';
import { getDynamicHealthToolWithCache } from './miscGetDynamicHealthTool.js';

const useHealthToolsCache = (locale) => {
    const [allTools, setAllTools] = useState([]);
    useEffect(() => {
        (() => __awaiter(void 0, void 0, void 0, function* () {
            const allHealthTools = yield getDynamicHealthToolWithCache(locale);
            setAllTools(allHealthTools);
        }))();
    }, [getDynamicHealthToolWithCache, locale]);
    const getHealthToolLink = useCallback((type) => { var _a; return ((_a = allTools.find((tool) => tool.template === type)) === null || _a === void 0 ? void 0 : _a.link) || ''; }, [allTools]);
    return { allTools, getHealthToolLink };
};

export { useHealthToolsCache as u };
