"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExpandAllButton=void 0;const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),styled_components_1=__importDefault(require("styled-components")),theme_1=require("@redocly/theme"),index_1=require("jotai/index"),operation_1=require("../../jotai/operation"),ExpandAllButton=({operationPointer:e,type:t})=>{const[n,o]=(0,index_1.useAtom)((0,operation_1.operationStore)(e)),i=(0,react_1.useMemo)((()=>Object.values(n[t].expandedFields).includes(!1)),[n,t]);if(!Object.keys(n[t].expandedFields).length)return null;return(0,jsx_runtime_1.jsxs)(StyledButton,{icon:(0,jsx_runtime_1.jsx)(theme_1.MaximizeIcon,{}),iconPosition:"right",size:"small",variant:"ghost",onClick:()=>{o((e=>{const n={};for(const o in e[t].expandedFields)n[o]=i;return Object.assign(Object.assign({},e),{[t]:{expandedFields:n}})}))},children:[i?"Expand":"Collapse"," all"]})};exports.ExpandAllButton=ExpandAllButton;const StyledButton=(0,styled_components_1.default)(theme_1.Button)`
  margin-left: auto;
`;
//# sourceMappingURL=ExpandAllButton.js.map