import { createContext, useCallback, useContext } from "react";
import { normalizeSandboxPaths } from "./sandbox-path-normalizer";
const DEFAULT_VALUE = {
    sandboxWorkspaceRoot: "",
};
export const SandboxContext = createContext(DEFAULT_VALUE);
/**
 * Returns a stable normalizer function that replaces absolute sandbox
 * paths in the given text with workspace-relative display paths.
 *
 * When `sandboxWorkspaceRoot` is empty (no provider or local mode),
 * returns the identity function — zero overhead.
 *
 * @example
 * ```tsx
 * function ShellCommand({ command }: { command: string }) {
 *   const normalize = useSandboxNormalize();
 *   return <code>{normalize(command)}</code>;
 * }
 * ```
 */
export function useSandboxNormalize() {
    const { sandboxWorkspaceRoot } = useContext(SandboxContext);
    return useCallback((text) => normalizeSandboxPaths(text, sandboxWorkspaceRoot), [sandboxWorkspaceRoot]);
}
//# sourceMappingURL=SandboxContext.js.map