import { IModelNative } from "../internal/NativePlatform";
import { IModelJsFs } from "../IModelJsFs";
export class RevisionUtility {
    static DEFAULT = {
        algo: 1,
        blockSize: 67108864,
        btMode: 1,
        dictSize: 16777216,
        fb: 64,
        lc: 3,
        level: 7,
        lp: 0,
        mc: 48,
        numBlockThreads: 4,
        numHashBytes: 4,
        numThreads: 2,
        numTotalThreads: 8,
        pb: 2,
        writeEndMark: 0,
    };
    static recompressRevision(sourceFile, targetFile, lzmaProps) {
        if (!IModelJsFs.existsSync(sourceFile))
            throw new Error("SourceFile does not exists");
        return IModelNative.platform.RevisionUtility.recompressRevision(sourceFile, targetFile, lzmaProps ? JSON.stringify(lzmaProps) : undefined);
    }
    static disassembleRevision(sourceFile, targetDir) {
        if (!IModelJsFs.existsSync(sourceFile))
            throw new Error("SourceFile does not exists");
        return IModelNative.platform.RevisionUtility.disassembleRevision(sourceFile, targetDir);
    }
    static assembleRevision(targetFile, rawChangesetFile, prefixFile, lzmaProps) {
        if (!IModelJsFs.existsSync(rawChangesetFile))
            throw new Error("RawChangesetFile does not exists");
        if (prefixFile && !IModelJsFs.existsSync(prefixFile))
            throw new Error("prefixFile does not exists");
        return IModelNative.platform.RevisionUtility.assembleRevision(targetFile, rawChangesetFile, prefixFile, lzmaProps ? JSON.stringify(lzmaProps) : undefined);
    }
    static normalizeLzmaParams(lzmaProps) {
        return JSON.parse(IModelNative.platform.RevisionUtility.normalizeLzmaParams(lzmaProps ? JSON.stringify(lzmaProps) : undefined));
    }
    static computeStatistics(sourceFile, addPrefix = true) {
        if (!IModelJsFs.existsSync(sourceFile))
            throw new Error("SourceFile does not exists");
        return JSON.parse(IModelNative.platform.RevisionUtility.computeStatistics(sourceFile, addPrefix));
    }
    static getUncompressSize(sourceFile) {
        if (!IModelJsFs.existsSync(sourceFile))
            throw new Error("SourceFile does not exists");
        return JSON.parse(IModelNative.platform.RevisionUtility.getUncompressSize(sourceFile));
    }
}
//# sourceMappingURL=RevisionUtility.js.map