/**
 * Sandbox path helpers — pure string math, no IO. Mirrors the backend's
 * naming convention so derived output dirs line up.
 */
export function lowerExt(path) {
    const idx = path.lastIndexOf('.');
    if (idx < 0)
        return '';
    return path.slice(idx).toLowerCase();
}
export function baseName(path) {
    const withoutTrailing = path.replace(/\/+$/, '');
    const idx = withoutTrailing.lastIndexOf('/');
    return idx < 0 ? withoutTrailing : withoutTrailing.slice(idx + 1);
}
export function dirName(path) {
    const withoutTrailing = path.replace(/\/+$/, '');
    const idx = withoutTrailing.lastIndexOf('/');
    return idx <= 0 ? '' : withoutTrailing.slice(0, idx);
}
export function stem(path) {
    const base = baseName(path);
    const idx = base.lastIndexOf('.');
    return idx <= 0 ? base : base.slice(0, idx);
}
/** Returns `<parent>/<stem>` — the file's adjacent data directory. */
export function getFileDataDir(filePath) {
    const parent = dirName(filePath);
    const s = stem(filePath);
    return parent.length > 0 ? `${parent}/${s}` : s;
}
//# sourceMappingURL=sandbox-paths.js.map