const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/swagger-ui-react-DYDvjlmJ.js","assets/vendor-react-Vbe32VU9.js","assets/rolldown-runtime-FhOqtrmT.js","assets/vendor-datadog-DVU9bdcc.js","assets/vendor-misc-D7UZlQZq.js","assets/vendor-markdown-C_pbQ5C-.js","assets/vendor-html-VZf1YLCF.js","assets/vendor-core-CvqwRnws.js","assets/vendor-monaco-B3gKcUcU.js","assets/vendor-charts-B7HJAEn1.js","assets/vendor-react-Bh0DbzfM.css"])))=>i.map(i=>d[i]);
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{Ki as t,Qi as n,br as r,ea as i,ia as a,ra as o,zi as s}from"./vendor-react-Vbe32VU9.js";import{t as c}from"./button-BxVMmVxn.js";import{i as l,l as u,n as d,p as f,r as p,t as m,u as h}from"./getRegistrationInfo-LbRH9o_1.js";import{r as g}from"./useInstanceClient-B-0rgxDK.js";import{i as _}from"./vendor-datadog-DVU9bdcc.js";var v=[{fn:{requestSnippetGenerator_fetch:e=>{let t=new URL(e.get(`url`)),n=!1,r=e.get(`headers`);r&&r.size&&r.map((e,t)=>{n||=/^content-type$/i.test(t)&&/^multipart\/form-data$/i.test(e)});let i=e.get(`body`),a=e.get(`method`);if(i){if(n&&[`POST`,`PUT`,`PATCH`].includes(a))return`throw new Error("Currently unsupported content-type: /^multipart\\/form-data$/i");`;typeof i!=`string`&&(i=JSON.stringify(i,null,`	`))}else !i&&a===`POST`&&(i=``);let o="`"+(i||``).replace(/\\n/g,`
`).replace(/`/g,"\\`")+"`";return`const response = await fetch("${t.toString()}", {
\tmethod: "${e.get(`method`)}",${r&&r.size?`
\theaders: {
\t\t${r.map((e,t)=>`"${t}": "${e}"`).valueSeq().join(`,
		`)}
\t},`:``}${i?`
\tbody: ${o},`:``}
});
const data = await response.json();
console.log(data);
`}}}],y={generators:{fetch:{title:`Fetch`,syntax:`javascript`}}};function b({entityId:e,instanceClient:t}){return n({queryKey:[e,`OpenAPI`],queryFn:async()=>{let{data:e}=await t.get(`/api/openapi/rest`);return e}})}var x=e(a(),1),S=o(),C=(0,x.lazy)(()=>_(()=>import(`./swagger-ui-react-DYDvjlmJ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])));function w(){let{instanceId:e,clusterId:n}=t({strict:!1}),a=g(),{data:o,isLoading:s}=i(d(a)),{data:_,isLoading:w}=i(m(a)),T=l(),{data:E,isLoading:D,error:O}=i(b(a));E?.servers?.length&&(E.servers[0].url=T);let k=o?.http,A=``,j=k?.cors===!1,M=k?.corsAccessList?.length!==void 0&&!k.corsAccessList.includes(`*`)&&!k.corsAccessList.includes(`null`)&&!k.corsAccessList.includes(window.location.origin);j?A=`This ${n&&!e?`cluster`:`instance`} has CORS disabled currently, so you won't be able to execute API requests from the browser.`:M&&(A=`This ${n&&!e?`cluster`:`instance`} has CORS enabled, but ${window.location.origin} is not allowed, so you won't be able to execute API requests from the browser.`);let{onConfigUpdate:N,isPending:P}=p(),F=(0,x.useCallback)(()=>{N({...j?{http_cors:!0}:{},...M?{http_corsAccessList:[...k?.corsAccessList??[],window.location.origin]}:{}})},[j,k?.corsAccessList,M,N]);if(s||w||D)return(0,S.jsx)(h,{centered:!0,text:`Looking up your instance configuration, one moment.`});if(O){let e;return e=_?.version&&!u(`4.7.0-beta.7`,_?.version)?`API Docs are only available starting in version '4.7.0-beta.7' of Harper, please update your version ${_.version}!`:`We weren't able to look up your docs. Please check the Network tab of your developer tools to see why the docs were not accessible to Studio.`,(0,S.jsx)(f,{title:`API Docs Unavailable`,error:{message:e},showReturnToHome:!1})}return(0,S.jsxs)(S.Fragment,{children:[A&&(0,S.jsx)(f,{title:`CORS Disabled: HTTP API Not Accessible`,className:`mt-0 mx-4 m-0 border-yellow text-yellow`,error:{message:A},showReturnToHome:!1,children:(0,S.jsxs)(c,{disabled:P,variant:`warning`,className:`rounded-full`,onClick:F,children:[(0,S.jsx)(r,{}),P?`Enabling CORS...`:`Enable CORS for ${window.location.origin}`]})}),(0,S.jsx)(x.Suspense,{fallback:(0,S.jsx)(h,{centered:!0,text:`Loading API documentation...`}),children:(0,S.jsx)(C,{spec:E,persistAuthorization:!0,withCredentials:!0,requestSnippetsEnabled:!0,defaultModelRendering:`model`,requestSnippets:y,plugins:v,tryItOutEnabled:!0})})]})}var T=s(`/apis`)({component:w});export{T as route};
//# sourceMappingURL=index.lazy-JvCzgHOj.js.map