import openapi_3_1_schema_default from "../schemas/openapi-3.1-schema.json.js";
import * as monaco from "monaco-editor/esm/vs/editor/editor.api.js";
import { configureMonacoYaml } from "monaco-yaml";
//#region src/v2/features/editor/helpers/configure-language-support.ts
var OPENAPI_JSON_SCHEMA_URI = "inmemory://model/scalar/openapi-json-schema";
/**
* Configures JSON language support for the given model URI
*
* @param globPattern - The glob pattern to match the files to configure language support for
*/
var configureJson = (globPattern) => {
	const defaults = monaco.languages.json.jsonDefaults;
	const current = defaults.diagnosticsOptions;
	const schemas = [...(current.schemas ?? []).filter((s) => s.uri !== OPENAPI_JSON_SCHEMA_URI), {
		uri: OPENAPI_JSON_SCHEMA_URI,
		fileMatch: [globPattern],
		schema: openapi_3_1_schema_default
	}];
	defaults.setDiagnosticsOptions({
		...current,
		validate: true,
		enableSchemaRequest: false,
		schemas
	});
};
/**
* Configures YAML language support for the given model URI
*
* @param globPattern - The glob pattern to match the files to configure language support for
*/
var configureYaml = (globPattern) => {
	configureMonacoYaml(monaco, {
		enableSchemaRequest: false,
		validate: true,
		format: true,
		completion: true,
		hover: true,
		schemas: [{
			fileMatch: [globPattern],
			schema: openapi_3_1_schema_default,
			uri: OPENAPI_JSON_SCHEMA_URI
		}]
	});
};
//#endregion
export { configureJson, configureYaml };

//# sourceMappingURL=configure-language-support.js.map