import { parseJsonPointerSegments } from "@scalar/helpers/json/parse-json-pointer-segments";
//#region src/v2/features/editor/helpers/json/json-pointer-path.ts
var extractPointer = (input) => {
	const trimmed = input.trim();
	if (trimmed.startsWith("/")) return trimmed;
	if (trimmed.startsWith("#")) {
		const fragment = trimmed.slice(1);
		return fragment.startsWith("/") ? fragment : null;
	}
	const hashIndex = trimmed.indexOf("#");
	if (hashIndex === -1) return null;
	const fragment = trimmed.slice(hashIndex + 1);
	return fragment.startsWith("/") ? fragment : null;
};
/**
* Parses a JSON Pointer (RFC 6901) and returns a "JSON path" compatible with this editor.
* Supports raw pointers ("/paths/...") and URI fragments ("#/paths/...").
*/
var parseJsonPointerPath = (pointer) => {
	const extracted = extractPointer(pointer);
	if (!extracted) return null;
	return parseJsonPointerSegments(extracted);
};
//#endregion
export { parseJsonPointerPath };

//# sourceMappingURL=json-pointer-path.js.map