"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ExampleValue=void 0;const jsx_runtime_1=require("react/jsx-runtime"),jotai_1=require("jotai"),theme_1=require("@redocly/theme"),utils_1=require("../../utils"),store_1=require("../../jotai/store"),styled_1=require("./styled");function ExampleValue({value:e,mimeType:o,encoding:t,onCopyClick:l}){const{jsonSamplesExpandLevel:r}=(0,jotai_1.useAtomValue)(store_1.globalOptionsAtom);return(0,utils_1.isJsonLike)(o)?(0,jsx_runtime_1.jsx)(theme_1.JsonViewer,{data:e,expandLevel:r,onCopyClick:l}):("object"==typeof e&&(e=(0,utils_1.isFormUrlEncoded)(o)?(0,utils_1.urlFormEncodePayload)(e,t):JSON.stringify(e,null,2)),(0,jsx_runtime_1.jsx)(styled_1.StyledCodeBlock,{lang:(0,utils_1.langFromMime)(o),source:e,header:{className:"code-block-header",controls:{copy:{onClick:l}}}}))}exports.ExampleValue=ExampleValue;
//# sourceMappingURL=ExampleValue.js.map