import{buildSchema as d}from"graphql";import{MenuStore as f,AppStore as g}from"@redocly/graphql-docs";import u from"node:path";import{combineUrls as w}from"@redocly/theme/core/utils";import{GRAPHQL_SPEC_SLUG as S}from"../../../constants/common.js";import{deepMerge as b}from"../../../utils/object/deep-merge.js";import{reporter as h}from"../../tools/notifiers/reporter.js";import{getApiConfigByPath as q}from"../get-api-config.js";import{replaceFileExtension as x}from"../openapi-docs/store-definition-bundles.js";const G=async(o,{getConfig:i,fs:c})=>{const t=await i(),e=t?.graphql??{},n=await c.read(o),{graphql:s={},metadata:l}=q(t.apis,o),a=b(e||{},s,{feedback:e.feedback||t.feedback,downloadUrls:e.downloadUrls||[{url:w(S,`${x(o,u.posix.extname(o))}?download`)}]});let m,p;try{const r=d(n);p=new g(r),m=new f(r,a)}catch(r){h.panicOnBuild(r);return}return{menu:m,store:p,settings:a,metadata:l,content:n}};export{G as graphqlDocLoader};
