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","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/gmbuilder@1.0.6/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","let JavaScriptObfuscator = require('javascript-obfuscator');\r\nlet glob = require(\"glob\").glob;\r\nlet SourceCodeFileUtils = require(\"./src/sourceCodeFileUtils.js\").SourceCodeFileUtils;\r\nlet ObfuscatedCodeFileUtils = require(\"./src/ObfuscatedCodeFileUtils.js\").ObfuscatedCodeFileUtils;\r\nlet IdentifierNamesCacheFileUtils = require(\"./src/IdentifierNamesCacheFileUtils.js\").IdentifierNamesCacheFileUtils;\r\nlet exec    = require(\"./lib-es5/index.js\").exec;\r\nlet path = require(\"path\");\r\nlet child_process = require('child_process');\r\n\r\nlet fs = require(\"fs\");\r\nlet identifierNamesCacheFileUtils;\r\nlet obfuscatedCodeFileUtils\r\n\r\nfunction processSourceCode(sourceCode, filePath, outputCodePath, index) {\r\n    const options = {\r\n        compact: true,\r\n        controlFlowFlattening: true,\r\n        controlFlowFlatteningThreshold: 1,\r\n        deadCodeInjection: true,\r\n        deadCodeInjectionThreshold: 1,\r\n        disableConsoleOutput:false,\r\n        identifierNamesGenerator: 'hexadecimal',\r\n        log:false,\r\n        numbersToExpressions: true,\r\n        renameGlobals:true,\r\n        selfDefending:true,\r\n        simplify: true,\r\n        splitStrings: true,\r\n        splitStringsChunkLength: 5,\r\n        stringArray:true,\r\n        stringArrayCallsTransform:true,\r\n        stringArrayEncoding: [\r\n            'none',\r\n            'base64',\r\n            'rc4'\r\n        ],\r\n        tringArrayIndexShift: true,\r\n        stringArrayRotate:true,\r\n        stringArrayShuffle: true,\r\n        stringArrayWrappersCount:10,\r\n        stringArrayWrappersChainedCalls:true,\r\n        stringArrayWrappersParametersMaxCount:5,\r\n        stringArrayWrappersType: 'function',\r\n        stringArrayThreshold: 1,\r\n        unicodeEscapeSequence:true,\r\n        transformObjectKeys:true,\r\n        target : 'node',\r\n        identifierNamesCache: {},//identifierNamesCacheFileUtils.readFile(),\r\n        inputFileName: path.basename(filePath),\r\n        seed:1,\r\n        // sourceMap:true,\r\n        // sourceMapMode: 'separate',\r\n        // ...index!=null && {\r\n        //     identifiersPrefix: getIdentifiersPrefixForMultipleSources(\"build-\",index)\r\n        // }\r\n    }\r\n\r\n    if(options.sourceMap) {\r\n        processSourceCodeWithSourceMap(sourceCode, outputCodePath, options);\r\n    }else{\r\n        processSourceCodeWithoutSourceMap(sourceCode, outputCodePath, options);\r\n    }\r\n\r\n}\r\n\r\nfunction processSourceCodeWithoutSourceMap(sourceCode, outputCodePath, options) {\r\n    // console.log(options);\r\n    const obfuscationResult = JavaScriptObfuscator.obfuscate(sourceCode, options);\r\n \r\n    obfuscatedCodeFileUtils.writeFile(outputCodePath, obfuscationResult.getObfuscatedCode());\r\n    identifierNamesCacheFileUtils.writeFile(obfuscationResult.getIdentifierNamesCache());\r\n}\r\n\r\nfunction processSourceCodeWithSourceMap(sourceCode, outputCodePath, options) {\r\n    const outputSourceMapPath = this.obfuscatedCodeFileUtils.getOutputSourceMapPath(\r\n        outputCodePath,\r\n        options.sourceMapFileName ?? ''\r\n    );\r\n\r\n    options = {\r\n        ...options,\r\n        sourceMapFileName: path.basename(outputSourceMapPath)\r\n    };\r\n\r\n    const obfuscationResult = JavaScriptObfuscator.obfuscate(sourceCode, options);\r\n\r\n    obfuscatedCodeFileUtils.writeFile(outputCodePath, obfuscationResult.getObfuscatedCode());\r\n    identifierNamesCacheFileUtils.writeFile(obfuscationResult.getIdentifierNamesCache());\r\n\r\n    if (options.sourceMapMode === SourceMapMode.Separate && obfuscationResult.getSourceMap()) {\r\n        obfuscatedCodeFileUtils.writeFile(outputSourceMapPath, obfuscationResult.getSourceMap());\r\n    }\r\n}\r\n\r\nfunction getIdentifiersPrefixForMultipleSources (\r\n    identifiersPrefix,\r\n    sourceCodeIndex\r\n) {\r\n    const baseIdentifiersPrefix = !!identifiersPrefix\r\n        ? identifiersPrefix\r\n        : \"a\";\r\n\r\n    return `${baseIdentifiersPrefix}${sourceCodeIndex}`;\r\n}\r\n\r\nlet run = async function(args) {\r\n    if(fs.existsSync(\"./dist\")) {\r\n        fs.rmdirSync(\"./dist\", { recursive: true });\r\n    }\r\n    let skmn = new SourceCodeFileUtils(\r\n        args[2],\r\n        {\r\n            exclude:[\"dist\",\".git\",\"node_modules\"],\r\n        }\r\n    )\r\n    let files = skmn.readDirectoryRecursiveLocal(args[2]);\r\n    // console.log(files.length);\r\n    obfuscatedCodeFileUtils11 = new ObfuscatedCodeFileUtils(\r\n        args[2],\r\n        {\r\n            output: \"./dist\"\r\n        }\r\n    )\r\n    for(let i in files){\r\n        const outputCodePath = obfuscatedCodeFileUtils11.getOutputCodePath(files[i].filePath);\r\n        // console.log(files[i].filePath);\r\n        // console.log(skmn.readFile(files[i].filePath));\r\n        obfuscatedCodeFileUtils11.writeFile(outputCodePath,skmn.readFile(files[i].filePath).content);\r\n    }\r\n\r\n    identifierNamesCacheFileUtils = new IdentifierNamesCacheFileUtils();\r\n\r\n    sourceCodeFileUtils = new SourceCodeFileUtils(\r\n        \"./dist/\",\r\n        {\r\n            exclude:[\"node_modules\",\"public\",\"dist1\",\".git\"],\r\n        }\r\n    )\r\n\r\n    obfuscatedCodeFileUtils = new ObfuscatedCodeFileUtils(\r\n        \"./dist/\",\r\n        {\r\n            output: \".\",\r\n        }\r\n    )\r\n\r\n    let filesData = sourceCodeFileUtils.readSourceCode();\r\n    // console.log(filesData);\r\n    filesData.forEach(({ filePath, content }, index) => {\r\n        const outputCodePath = obfuscatedCodeFileUtils.getOutputCodePath(filePath);\r\n\r\n        try {\r\n            processSourceCode(content, filePath, outputCodePath, index);\r\n        } catch (error) {\r\n            throw error;\r\n        }\r\n    });\r\n    let preInstall = \"cd dist && npm install\";\r\n    let pkgPreInstall = path.join(args[2],\"package.json\");\r\n    let jsonInput = JSON.parse(fs.readFileSync(pkgPreInstall).toString());\r\n    if(jsonInput.hasOwnProperty(\"pkg\")){\r\n       if(jsonInput.pkg.hasOwnProperty(\"preInstall\")){\r\n           preInstall += \" && node \"+ jsonInput.pkg.preInstall;\r\n       }\r\n    }\r\n\r\n    child_process.execSync(preInstall,{stdio:[0,1,2]});\r\n\r\n    await exec([\"dist\"]);\r\n}\r\n\r\nmodule.exports = { run }"]}