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B,EAAW,iDAC5C,IACA,EAAG,GAAG,UAAU,WACZ,GAAG,WAAW,GACd,GAAG,WAAW,EAAO,OAAQ,GAC7B,QAAQ,IAAI,cAAgB,EAAW,wBAC3C,GACJ,EACA,EAAS,UAAU,YAAc,SAAU,EAAM,GAC7C,IAAI,EAAQ,KACZ,gBAAgB,SAAS,QAAS,CAAC,EAAO,EAAO,OAAS,MAAO,MAAO,QAAQ,SAAU,GAClF,GACA,QAAQ,IAAI,eAAiB,EAAW,kDACpC,EAAM,OAAO,cACb,QAAQ,IAAI,yBAA2B,KAI3C,GAAG,WAAW,GACd,GAAG,WAAW,EAAO,OAAQ,GAC7B,QAAQ,IAAI,cAAgB,EAAW,yBAE/C,GACJ,EACO,CACX,CAhJe,GAiJf,QAAQ,SAAW","file":"/npm/ionic-minify@2.0.10/lib/minifier.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/ionic-minify@2.0.10/lib/minifier.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\";\nvar fs = require(\"fs\");\nvar path = require(\"path\");\nvar child_process_1 = require(\"child_process\");\nvar ngAnnotate = require(\"ng-annotate\");\nvar UglifyJS = require(\"uglify-js\");\nvar CleanCss = require(\"clean-css\");\nvar mozjpeg = require(\"mozjpeg-stream\");\nvar optipng = require(\"pngout-bin\").path;\nvar Minifier = (function () {\n    function Minifier(hookConf, platforms, basePath) {\n        this.platformPaths = [];\n        this.config = hookConf;\n        this.platforms = platforms;\n        this.basePath = basePath;\n        this.cssMinifer = new CleanCss(this.config.cssOptions);\n        this.setPlatformPaths();\n    }\n    Minifier.prototype.isHiddenFile = function (source) {\n        return (/(^|\\/)\\.[^\\/\\.]/g).test(source);\n    };\n    Minifier.prototype.run = function () {\n        var _this = this;\n        this.platformPaths.forEach(function (platform) {\n            _this.config.foldersToProcess.forEach(function (folder) {\n                _this.processFiles(path.join(platform, folder));\n            });\n        });\n    };\n    Minifier.prototype.setPlatformPaths = function () {\n        var _this = this;\n        this.platforms.forEach(function (platform) {\n            switch (platform) {\n                case \"android\":\n                    _this.platformPaths.push(path.join(_this.basePath, platform, \"assets\", \"www\"));\n                    break;\n                case \"ios\":\n                case \"wp8\":\n                case \"browser\":\n                    _this.platformPaths.push(path.join(_this.basePath, platform, \"www\"));\n                    break;\n                default:\n                    console.log(\"Ionic minify supports Android, iOS, Windows Phone 8 and Browser only.\");\n                    break;\n            }\n        });\n    };\n    Minifier.prototype.processFiles = function (dir) {\n        var _this = this;\n        fs.readdir(dir, function (error, list) {\n            if (error) {\n                console.log(\"An error ocurred while reading directories: \\n \" + error);\n                return;\n            }\n            else {\n                list.forEach(function (file) {\n                    file = path.join(dir, file);\n                    fs.stat(file, function (err, stat) {\n                        if (stat.isDirectory()) {\n                            _this.processFiles(file);\n                        }\n                        else {\n                            if (_this.isHiddenFile(file)) {\n                                console.log(\"Not processing hidden file: \" + file);\n                            }\n                            else {\n                                _this.compress(file);\n                            }\n                        }\n                    });\n                });\n            }\n        });\n    };\n    Minifier.prototype.compress = function (file) {\n        var extension = path.extname(file);\n        var fileName = path.basename(file);\n        if (fileName.indexOf(\".min.\") > -1) {\n            extension = \".min\" + extension;\n        }\n        try {\n            var ext = extension.split('.')[1].toUpperCase();\n            console.log(\"Compressing \" + ext + \" file: \" + fileName);\n            switch (extension) {\n                case \".js\":\n                    this.compressJS(file, fileName);\n                    break;\n                case \".css\":\n                    this.compressCSS(file, fileName);\n                    break;\n                case \".jpg\":\n                case \".jpeg\":\n                    this.compressJPG(file, fileName);\n                    break;\n                case \".png\":\n                    this.compressPNG(file, fileName);\n                    break;\n                default:\n                    break;\n            }\n        }\n        catch (err) {\n            console.log(\"Compressing/Minifying \" + fileName + \" resulted in an error and won't be compressed/minified.\");\n            if (this.config.showErrStack) {\n                console.log(err.stack);\n            }\n        }\n    };\n    Minifier.prototype.compressJS = function (file, fileName) {\n        var src = fs.readFileSync(file, \"utf8\");\n        var ngSafeFile = ngAnnotate(src, { add: true });\n        var result = UglifyJS.minify(ngSafeFile.src, this.config.jsOptions);\n        fs.writeFileSync(file, result.code, \"utf8\");\n        console.log(\"JS file: \" + fileName + \" has been minified!\");\n    };\n    Minifier.prototype.compressCSS = function (file, fileName) {\n        var src = fs.readFileSync(file, \"utf8\");\n        var css = this.cssMinifer.minify(src);\n        css = (css.styles) ? css.styles : css;\n        fs.writeFileSync(file, css, \"utf8\");\n        console.log(\"CSS file: \" + fileName + \" has been minified!\");\n    };\n    Minifier.prototype.compressJPG = function (file, fileName) {\n        var ws;\n        fs.createReadStream(file)\n            .pipe(mozjpeg(this.config.jpgOptions))\n            .pipe(ws = fs.createWriteStream(file + \".jpg\"));\n        ws.on(\"error\", function (err) {\n            console.log(\"Compressing \" + fileName + \" resulted in an error and won't be compressed.\");\n        });\n        ws.on(\"finish\", function () {\n            fs.unlinkSync(file);\n            fs.renameSync(file + \".jpg\", file);\n            console.log(\"JPG image: \" + fileName + \" has been compressed!\");\n        });\n    };\n    Minifier.prototype.compressPNG = function (file, fileName) {\n        var _this = this;\n        child_process_1.execFile(optipng, [file, (file + \".png\"), \"-s0\", \"-k0\", \"-f0\"], function (err) {\n            if (err) {\n                console.log(\"Compressing \" + fileName + \" resulted in an error and won't be compressed.\");\n                if (_this.config.showErrStack) {\n                    console.log(\"An error has ocurred: \" + err);\n                }\n            }\n            else {\n                fs.unlinkSync(file);\n                fs.renameSync(file + \".png\", file);\n                console.log(\"PNG image: \" + fileName + \" has been compressed!\");\n            }\n        });\n    };\n    return Minifier;\n}());\nexports.Minifier = Minifier;\n"]}