import { getJsonAstNodeAtPath } from "./json-ast.js";
import * as monaco from "monaco-editor";
//#region src/v2/features/editor/helpers/json/get-json-ast-node-from-path.ts
/**
* Retrieves a JSON AST node from a Monaco editor model at the specified JSON path.
*
* Utilizes Monaco's JSON worker to parse the document and returns the AST node
* located at the given path, or null if not found.
*
* @param model - The Monaco editor text model representing the JSON document.
* @param path - The JSON path to locate the AST node.
* @returns A promise resolving to the AST node at the path, or null if not found.
*/
var getJsonAstNodeFromPath = async (model, path) => {
	const jsonDocument = await (await (await monaco.languages.json.getWorker())(model.uri)).parseJSONDocument(model.uri.toString());
	if (!jsonDocument?.root) return null;
	return getJsonAstNodeAtPath(jsonDocument.root, path) ?? null;
};
//#endregion
export { getJsonAstNodeFromPath };

//# sourceMappingURL=get-json-ast-node-from-path.js.map