"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TryIt = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const urql_1 = require("urql");
const Skeleton_1 = require("../components/Docs/Skeleton");
const TryIt_1 = require("../components/TryIt");
const BranchNodeBySlug_1 = require("../graphql/BranchNodeBySlug");
const Provider_1 = require("./Provider");
exports.TryIt = ({ className, node }) => {
    const info = React.useContext(Provider_1.ActiveInfoContext);
    const [{ data: result, fetching }] = urql_1.useQuery({
        query: BranchNodeBySlug_1.bundledBranchNode,
        variables: {
            workspaceSlug: info.workspace,
            projectSlug: info.project,
            branchSlug: info.branch,
            uri: node || info.node,
        },
    });
    if (fetching || !result) {
        return React.createElement(Skeleton_1.DocsSkeleton, null);
    }
    return React.createElement(TryIt_1.TryIt, { className: className, nodeType: result.type, nodeData: result.data });
};
//# sourceMappingURL=TryIt.js.map