var __awaiter=this&&this.__awaiter||function(e,o,t,r){return new(t||(t=Promise))((function(n,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function p(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var o;e.done?n(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(i,p)}s((r=r.apply(e,o||[])).next())}))};import{jsx as _jsx}from"react/jsx-runtime";import{Suspense,lazy,memo,useEffect,useState}from"react";import styled from"styled-components";import{useAtomValue}from"jotai";import{globalOptionsAtom}from"../../jotai/store";import{appStore,environmentsAtom}from"../../jotai/app";import{useTranslate}from"../../hooks";import{convertOperationToReplayValue}from"./utils";const EmbeddedReplayOrig=lazy((()=>__awaiter(void 0,void 0,void 0,(function*(){return import("@redocly/replay").then((e=>({default:e.EmbeddedReplay})))}))));function EmbeddedReplayComponent({activeOperationId:e,corsProxyUrl:o,fullOpenApi:t}){const r=useTranslate(),{mockServer:n}=useAtomValue(globalOptionsAtom),a=useAtomValue(appStore),i=useAtomValue(environmentsAtom),[p,s]=useState(!1);return useEffect((()=>{s(!0)}),[]),_jsx(CompactWrapper,{children:p?_jsx(Suspense,{fallback:_jsx(LoadingWrapper,{children:r("openapi.loading","Loading...")}),children:_jsx(EmbeddedReplayOrig,{activeOperationId:e,source:{data:t,type:"openapi"},settings:{environment:a.environment,predefinedEnvValues:i,corsProxyUrl:o,mockServer:n,disableCollectionsTab:!0,convertOperationToReplayValue:convertOperationToReplayValue}})}):_jsx(LoadingWrapper,{children:r("openapi.loading","Loading...")})})}export const EmbeddedReplay=memo(EmbeddedReplayComponent);const LoadingWrapper=styled.div`
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100px;
`,CompactWrapper=styled.div`
  border: 1px solid var(--border-color-primary);
  border-radius: var(--border-radius-lg);
  padding: 0;
`;
//# sourceMappingURL=EmbeddedReplay.js.map