import{jsxs as _jsxs,jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{ExampleValue,FieldLabel}from"../common";import{tryDecodeURIComponent,normalizeText,serializeParameterValue}from"../../utils";import{ExampleWrap,ExamplesList,ExampleSummary}from"./styled";import{useTranslate}from"../../hooks";import{Markdown}from"../Markdown";export function Examples({field:e}){const r=useTranslate();return e.examples?_jsxs(_Fragment,{children:[_jsxs(FieldLabel,{children:[" ",r("openapi.examples","Examples"),": "]}),_jsx(ExamplesList,{children:Object.entries(e.examples).map((([r,a])=>{const m=normalizeText(a.description);return _jsxs(ExampleWrap,{children:[_jsxs(ExampleSummary,{children:[normalizeText(a.summary)||r," "]}),m&&_jsx(Markdown,{source:m}),_jsx(ExampleValue,{children:getSerializedValue(e,a.value)})]},r)}))})]}):null}export function getSerializedValue(e,r){return e.in?tryDecodeURIComponent(serializeParameterValue(e,r)):r}
//# sourceMappingURL=Examples.js.map