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AQ,OAAO,MAAM,KAAK,UAAU,CAAE,MAAO,aAAa,QAAQ,UAAY,EAAI,EAAE,iBAAc,EAAW,OAG7G,QAAQ,OAAO,MAAM,GAAG,aAAa,QAAQ,UACvC,WAAW,EAAE,aACb,EAAE,MACE,EAAE,MACF,OAAO,OAEzB,CA5BA,CA6BJ,CAEH,CAtCD,CAsCG,aAAe,WAAa,CAAC,IAChC,OAAO,QAAU","file":"/npm/cordova-res@0.15.4/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/cordova-res@0.15.4/dist/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","\"use strict\";\nconst tslib_1 = require(\"tslib\");\nconst utils_fs_1 = require(\"@ionic/utils-fs\");\nconst debug_1 = tslib_1.__importDefault(require(\"debug\"));\nconst path_1 = tslib_1.__importDefault(require(\"path\"));\nconst util_1 = tslib_1.__importDefault(require(\"util\"));\nconst cli_1 = require(\"./cli\");\nconst config_1 = require(\"./cordova/config\");\nconst error_1 = require(\"./error\");\nconst native_1 = require(\"./native\");\nconst platform_1 = require(\"./platform\");\nconst fn_1 = require(\"./utils/fn\");\nconst debug = debug_1.default('cordova-res');\nasync function CordovaRes(options = {}) {\n    const defaultOptions = cli_1.parseOptions([]);\n    const { directory, resourcesDirectory, logstream, errstream, platforms, projectConfig, skipConfig, copy, operations: { fit = 'cover', position = 'center', transform = (image, pipeline) => pipeline, }, } = { ...defaultOptions, ...options };\n    const configPath = config_1.getConfigPath(directory);\n    debug('Paths: (config: %O) (resources dir: %O)', configPath, resourcesDirectory);\n    let config;\n    const resources = [];\n    const sources = [];\n    if (!skipConfig) {\n        if (await utils_fs_1.pathWritable(configPath)) {\n            config = await config_1.read(configPath);\n        }\n        else {\n            errstream === null || errstream === void 0 ? void 0 : errstream.write(`WARN:\\tNo config.xml file in directory. Skipping config.\\n`);\n            debug('File missing/not writable: %O', configPath);\n        }\n    }\n    for (const platform of platform_1.PLATFORMS) {\n        const platformOptions = platforms[platform];\n        const nativeProject = projectConfig[platform];\n        if (platformOptions) {\n            const platformResult = await platform_1.run(platform, resourcesDirectory, platformOptions, { fit, position, transform }, errstream);\n            logstream === null || logstream === void 0 ? void 0 : logstream.write(util_1.default.format(`Generated %s resources for %s`, platformResult.resources.length, platform_1.prettyPlatform(platform)) + '\\n');\n            resources.push(...platformResult.resources);\n            sources.push(...platformResult.sources);\n            if (copy && nativeProject) {\n                const shouldCopyIcons = resources.findIndex(res => res.type === \"icon\" /* ICON */ ||\n                    res.type === \"adaptive-icon\" /* ADAPTIVE_ICON */) !== -1;\n                const shouldCopySplash = resources.findIndex(res => res.type === \"splash\" /* SPLASH */) !== -1;\n                await native_1.copyToNativeProject(platform, resourcesDirectory, nativeProject, shouldCopyIcons, shouldCopySplash, logstream, errstream);\n            }\n        }\n    }\n    if (config) {\n        await config_1.run(resourcesDirectory, config, sources, resources, errstream);\n        await config_1.write(configPath, config);\n        logstream === null || logstream === void 0 ? void 0 : logstream.write(`Wrote to config.xml\\n`);\n    }\n    return {\n        resources,\n        sources: sources.map(source => {\n            switch (source.type) {\n                case \"raster\" /* RASTER */:\n                    return {\n                        platform: source.platform,\n                        resource: source.resource,\n                        type: \"raster\" /* RASTER */,\n                        value: source.src,\n                    };\n                case \"color\" /* COLOR */:\n                    return {\n                        platform: source.platform,\n                        resource: source.resource,\n                        type: \"color\" /* COLOR */,\n                        value: source.color,\n                        name: source.name,\n                    };\n            }\n        }),\n    };\n}\n// eslint-disable-next-line @typescript-eslint/no-namespace\n(function (CordovaRes) {\n    CordovaRes.run = CordovaRes;\n    async function runCommandLine(args) {\n        if (args.includes('--version') || args.includes('-v')) {\n            const pkg = await Promise.resolve().then(() => tslib_1.__importStar(require(path_1.default.resolve(__dirname, '../package.json'))));\n            process.stdout.write(pkg.version + '\\n');\n            return;\n        }\n        if (args[0] === 'help' || args.includes('--help') || args.includes('-h')) {\n            const help = await Promise.resolve().then(() => tslib_1.__importStar(require('./help')));\n            return help.run();\n        }\n        try {\n            const directory = cli_1.getDirectory();\n            const configPath = config_1.getConfigPath(directory);\n            const config = await fn_1.tryFn(() => config_1.read(configPath));\n            const options = await cli_1.resolveOptions(args, config);\n            const result = await CordovaRes.run(options);\n            if (args.includes('--json')) {\n                process.stdout.write(JSON.stringify(result, undefined, '\\t'));\n            }\n        }\n        catch (e) {\n            debug('Caught fatal error: %O', e);\n            process.exitCode = 1;\n            if (args.includes('--json')) {\n                process.stdout.write(JSON.stringify({ error: e instanceof error_1.BaseError ? e : e.toString() }, undefined, '\\t'));\n            }\n            else {\n                process.stderr.write(`${e instanceof error_1.BaseError\n                    ? `ERROR:\\t${e.toString()}`\n                    : e.stack\n                        ? e.stack\n                        : String(e)}\\n`);\n            }\n        }\n    }\n    CordovaRes.runCommandLine = runCommandLine;\n})(CordovaRes || (CordovaRes = {}));\nmodule.exports = CordovaRes;\n"]}