import { LangiumGrammarAstReflection as e } from "../languages/generated/ast.js";
import { URI as t } from "../../../vscode-uri/lib/esm/index.js";
import { createDefaultCoreModule as n, createDefaultSharedCoreModule as r } from "../default-module.js";
import { inject as i } from "../dependency-injection.js";
import { EmptyFileSystem as a } from "../workspace/file-system-provider.js";
//#region ../../node_modules/langium/lib/utils/grammar-loader.js
var o = {
	Grammar: () => void 0,
	LanguageMetaData: () => ({
		caseInsensitive: !1,
		fileExtensions: [".langium"],
		languageId: "langium"
	})
}, s = { AstReflection: () => new e() };
function c() {
	let e = i(r(a), s), t = i(n({ shared: e }), o);
	return e.ServiceRegistry.register(t), t;
}
function l(e) {
	let n = c(), r = n.serializer.JsonSerializer.deserialize(e);
	return n.shared.workspace.LangiumDocumentFactory.fromModel(r, t.parse(`memory:/${r.name ?? "grammar"}.langium`)), r;
}
//#endregion
export { l as loadGrammarFromJson };
