/** * @module metatext-helpers * * Helper functions for target URL parsing, markdown link extraction, * and Ahead-Of-Time (AOT) index (`index/targets.json`) management. */ import { ParsedTargetUrl, TargetAnchorRecord, TargetsIndexData } from './metatext-types.mjs'; /** * Parses line range anchor from a URL hash (e.g. '#L12-L24', '#L12-24', '#L15'). */ export declare function parseLineRangeAnchor(hashOrAnchor?: string): [number, number] | undefined; /** * Parses an ibgib URL into its constituent cosmos, galaxy, branch, file path, and line range components. * Supports both https://ibgib.space/... URLs and ibgib://... protocol URIs. * * @example * parseTargetUrl('https://ibgib.space/@bill/cosmos-1/code-1/main/src/index.mts#L12-L24') * // returns { * // rawUrl: '...', * // userHandle: 'bill', * // cosmosName: 'cosmos-1', * // galaxyName: 'code-1', * // branchName: 'main', * // filePath: 'src/index.mts', * // lineRange: [12, 24], * // targetKey: 'code-1/src/index.mts' * // } */ export declare function parseTargetUrl(url: string): ParsedTargetUrl | undefined; /** * Extracts all valid code target URLs embedded in Markdown text (both [text](url) and bare URLs). */ export declare function extractTargetUrlsFromMarkdown(markdownText: string): ParsedTargetUrl[]; /** * Updates a TargetsIndexData object with target anchors parsed from a new or updated comment file. */ export declare function updateTargetsIndexData({ currentIndex, targetUrls, commentFilePath, author, authorKeystoneTjp, timestamp, }: { currentIndex?: TargetsIndexData | null; targetUrls: ParsedTargetUrl[]; commentFilePath: string; author?: string; authorKeystoneTjp?: string; timestamp?: string; }): TargetsIndexData; /** * Retrieves all target anchor records associated with a specific file in a galaxy. * Performs fast O(1) dictionary lookup. */ export declare function getTargetAnchorsForFile({ indexData, filePath, galaxyName, }: { indexData?: TargetsIndexData | null; filePath: string; galaxyName?: string; }): TargetAnchorRecord[]; /** * Serializes TargetsIndexData to formatted JSON string. */ export declare function serializeTargetsIndex(indexData: TargetsIndexData): string; /** * Safely deserializes a JSON string into a TargetsIndexData object. */ export declare function deserializeTargetsIndex(jsonString: string): TargetsIndexData; //# sourceMappingURL=metatext-helpers.d.mts.map