/*
 * SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software. 
 * This class is generated using the converter UniSharping (www.unisharping.ru) from Pullenti C# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */


const TextHelper = require("./../../../util/TextHelper");
const GeneralBitFlags = require("./GeneralBitFlags");
const MiscHelper = require("./../../../util/MiscHelper");

// This class contains constants used for Zip format files
class ZipConstants {
    
    static convertToString(data, count) {
        if (data === null) 
            return "";
        let tmp = TextHelper.readStringFromBytes(data, false, false);
        return tmp;
    }
    
    static convertToString0(data) {
        if (data === null) 
            return "";
        return ZipConstants.convertToString(data, data.length);
    }
    
    static convertToStringExt(flags, data, count) {
        if (data === null) 
            return "";
        if (((flags & (GeneralBitFlags.UNICODETEXT.value()))) !== 0) 
            return MiscHelper.decodeStringUtf8(data, 0, count);
        else 
            return ZipConstants.convertToString(data, count);
    }
    
    static convertToStringExt0(flags, data) {
        if (data === null) 
            return "";
        if (((flags & (GeneralBitFlags.UNICODETEXT.value()))) !== 0) 
            return MiscHelper.decodeStringUtf8(data, 0, data.length);
        else 
            return ZipConstants.convertToString(data, data.length);
    }
    
    static convertToArrayStr(str) {
        if (str === null) 
            return new Uint8Array(0);
        return MiscHelper.encodeStringUtf8(str, false);
    }
    
    static convertToArray(flags, str) {
        if (str === null) 
            return new Uint8Array(0);
        if (((flags & (GeneralBitFlags.UNICODETEXT.value()))) !== 0) 
            return MiscHelper.encodeStringUtf8(str, false);
        else 
            return ZipConstants.convertToArrayStr(str);
    }
    
    constructor() {
        
    }
    
    static static_constructor() {
        ZipConstants.VERSION_MADE_BY = 51;
        ZipConstants.VERSION_STRONG_ENCRYPTION = 50;
        ZipConstants.VERSION_AES = 51;
        ZipConstants.VERSION_ZIP64 = 45;
        ZipConstants.LOCAL_HEADER_BASE_SIZE = 30;
        ZipConstants.ZIP64DATA_DESCRIPTOR_SIZE = 24;
        ZipConstants.DATA_DESCRIPTOR_SIZE = 16;
        ZipConstants.CENTRAL_HEADER_BASE_SIZE = 46;
        ZipConstants.END_OF_CENTRAL_RECORD_BASE_SIZE = 22;
        ZipConstants.CRYPTO_HEADER_SIZE = 12;
        ZipConstants.LOCAL_HEADER_SIGNATURE = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (3 << 16)) | (4 << 24);
        ZipConstants.LOCSIG = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (3 << 16)) | (4 << 24);
        ZipConstants.SPANNING_SIGNATURE = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (7 << 16)) | (8 << 24);
        ZipConstants.SPANNINGSIG = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (7 << 16)) | (8 << 24);
        ZipConstants.SPANNING_TEMP_SIGNATURE = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (('0'.charCodeAt(0)) << 16)) | (('0'.charCodeAt(0)) << 24);
        ZipConstants.SPANTEMPSIG = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (('0'.charCodeAt(0)) << 16)) | (('0'.charCodeAt(0)) << 24);
        ZipConstants.DATA_DESCRIPTOR_SIGNATURE = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (7 << 16)) | (8 << 24);
        ZipConstants.EXTSIG = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (7 << 16)) | (8 << 24);
        ZipConstants.CENSIG = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (1 << 16)) | (2 << 24);
        ZipConstants.CENTRAL_HEADER_SIGNATURE = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (1 << 16)) | (2 << 24);
        ZipConstants.ZIP64CENTRAL_FILE_HEADER_SIGNATURE = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (6 << 16)) | (6 << 24);
        ZipConstants.CENSIG64 = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (6 << 16)) | (6 << 24);
        ZipConstants.ZIP64CENTRAL_DIR_LOCATOR_SIGNATURE = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (6 << 16)) | (7 << 24);
        ZipConstants.ARCHIVE_EXTRA_DATA_SIGNATURE = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (6 << 16)) | (7 << 24);
        ZipConstants.CENTRAL_HEADER_DIGITAL_SIGNATURE = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (5 << 16)) | (5 << 24);
        ZipConstants.CENDIGITALSIG = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (5 << 16)) | (5 << 24);
        ZipConstants.END_OF_CENTRAL_DIRECTORY_SIGNATURE = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (5 << 16)) | (6 << 24);
        ZipConstants.ENDSIG = (('P'.charCodeAt(0)) | (('K'.charCodeAt(0)) << 8) | (5 << 16)) | (6 << 24);
    }
}


ZipConstants.static_constructor();

module.exports = ZipConstants