"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Provider = exports.ActiveInfoContext = exports.IconsContext = exports.InlineRefResolverContext = exports.ComponentsContext = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const urql_1 = require("urql");
const useComponents_1 = require("../hooks/useComponents");
const urql_2 = require("../utils/urql");
exports.ComponentsContext = createNamedContext('ComponentsContext', useComponents_1.defaultComponents);
exports.InlineRefResolverContext = React.createContext(void 0);
const defaultIcons = {};
exports.IconsContext = createNamedContext('IconsContext', defaultIcons);
const defaultInfo = {
    host: '',
    workspace: '',
    project: '',
    branch: '',
    node: '',
};
exports.ActiveInfoContext = createNamedContext('ActiveInfoContext', defaultInfo);
exports.Provider = ({ host, workspace, project, branch, node, urqlClient, components, children, }) => {
    const info = {
        host,
        workspace,
        project,
        branch,
        node,
    };
    const client = urql_2.getUrqlClient(`${host}/graphql`, urqlClient);
    return (React.createElement(urql_1.Provider, { value: client },
        React.createElement(exports.IconsContext.Provider, { value: defaultIcons },
            React.createElement(exports.ComponentsContext.Provider, { value: components },
                React.createElement(exports.ActiveInfoContext.Provider, { value: info }, children)))));
};
function createNamedContext(name, defaultValue) {
    const context = React.createContext(defaultValue);
    context.displayName = name;
    return context;
}
//# sourceMappingURL=Provider.js.map