import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import{memo}from"react";import merge from"deepmerge";import styled from"styled-components";import{Markdown}from"../Markdown";import{Example}from"./Example";import{ExampleSwitch,useExampleKey}from"../Samples";import{arrayMergeStrategy}from"../../services/utils";import{StyledCodeBlock}from"./styled";function MediaTypeSamplesComponent({mediaType:e,properties:r,onChange:a,onCopyClick:m}){const o=e.examples||e.formExamples||{},s=e.name,t=Object.keys(o),{exampleKey:p}=useExampleKey(e.operation,o),n=1===t.length?Object.values(o)[0]:o[p];if(!t.length)return _jsx(StyledCodeBlock,{lang:"clike",source:"No response example",header:{controls:!1}});const l=r?Object.assign(Object.assign({},n),{value:merge(n.value,r,{arrayMerge:arrayMergeStrategy})}):n,i=l.description;return _jsxs(_Fragment,{children:[_jsx(ExampleSwitch,{examples:o,exampleKey:p,onChange:a}),i&&_jsx(StyledMarkdown,{source:i}),_jsx(Example,{example:l,mimeType:s,onCopyClick:m})]})}const StyledMarkdown=styled(Markdown)`
  margin: 0 var(--spacing-md) var(--spacing-sm);
`;export const MediaTypeSamples=memo(MediaTypeSamplesComponent);
//# sourceMappingURL=MediaTypeSamples.js.map