function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import React from 'react';
import { Tab, TabList, TabPanel, TabPanels, useTabs } from '@looker/components';
import { CollapserCard } from '@looker/run-it';
import { DocResponseTypes } from './DocResponseTypes';
import { buildResponseTree } from './utils';
export var DocResponses = _ref => {
  var {
    api,
    responses
  } = _ref;
  var tabs = useTabs();
  if (responses.length === 0) return React.createElement(React.Fragment, null);
  var responseTree = buildResponseTree(responses);
  return React.createElement(CollapserCard, {
    heading: "Response Models",
    id: "response models"
  }, React.createElement(React.Fragment, null, React.createElement(TabList, tabs, Object.keys(responseTree).map((statusCode, index) => React.createElement(Tab, {
    key: index
  }, statusCode))), React.createElement(TabPanels, _extends({}, tabs, {
    pt: "0"
  }), Object.values(responseTree).map((responses, index) => React.createElement(TabPanel, {
    key: index
  }, React.createElement(DocResponseTypes, {
    api: api,
    responses: responses
  }))))));
};
//# sourceMappingURL=DocResponses.js.map