import{jsx as r}from"react/jsx-runtime";import{memo as d,useCallback as l}from"react";import{CodeBlock as i}from"@redocly/theme/components/CodeBlock/CodeBlock";import{SelectOrLabel as s}from"../SelectOrLabel/index.js";import{MediaTypesSwitch as u}from"../MediaTypeSwitch/index.js";import{SelectWrapper as S}from"../PayloadSamples/index.js";import{Example as h}from"./Example.js";import{MimeLabel as f,Select as b}from"../common/index.js";import{styled as g}from"../../styled-components.js";function p({onCopyClick:o,...e}){const t=e.operation.requestBody?.content,c=l(a=>(t?.mediaTypes?.length??0)>1?r(S,{children:r(s,{Label:f,Select:b,variant:"dark",fullWidth:!0,...a})}):null,[t]),n=l(a=>e.source?r(m,{lang:e.lang,source:e.source,header:{className:"code-block-header",controls:{copy:{onClick:o}}}}):r(m,{lang:e.lang,externalSource:{sample:e.externalSample,exampleName:a,operation:e.operation,pathParams:e.pathParams,properties:e.properties},header:{className:"code-block-header",controls:{copy:{onClick:o}}}}),[o,e.externalSample,e.lang,e.operation,e.pathParams,e.properties,e.source]);return t===void 0||e.source!=null?n():r(u,{content:t,renderSelect:c,children:a=>r(h,{mediaType:a,mediaContent:t,renderSample:n})})}const M=d(p),m=g(i)`
  border: none;
  margin: 0;

  .code-block-header {
    border-bottom: 0;
    padding-right: var(--spacing-sm);
  }
`;export{M as CodeSample};
