{"version":3,"sources":["jsdelivr-header.js","/npm/compress-images-with-sharp@1.3.3/dist/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCNS,kBAAqB,wBACrB,aAAgB,YAChB,SAAY,cACd,UAAW,eACT,YAAe,6BACjB,sBAAuB,8CACvB,yBAA0B,wCAC1B,gBAAiB,yBACxB,eAAe,SAAS,EAAS,EAAW,EAAO,cAAc,MAC7D,MAAM,EAAa,IAAI,qBAAqB,GAAM,GAC5C,QAAc,KAAK,GAAG,SAAiB,WAC7C,IAAK,MAAM,KAAQ,EACf,IACI,MAAM,QAAsB,SAAS,KAAK,GAC1C,GAAI,kBAAkB,YAAY,EAAe,GAAO,CACpD,MAAM,QAAuB,EAAW,SAAS,GACjD,IAAK,MAAM,KAAiB,EAAgB,CACxC,MAAM,EAAa,OAAO,WAAW,EAAc,QAC/C,EAAc,KAAO,EAAa,SAC5B,EAAW,sBAAsB,GAE3C,YAAY,MAAM,EAAc,KAAM,EAAY,EACtD,CACJ,CACJ,CACA,MAAO,GACH,QAAQ,MAAM,MAAM,OAAO,GAC/B,CAEJ,QAAQ,IAAI,MAAM,QAAQ,uBAAuB,YAAY,aACjE,QACS,SAAU","file":"/npm/compress-images-with-sharp@1.3.3/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/compress-images-with-sharp@1.3.3/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","import { COMPRESS_TYPE } from './types/all.js';\nimport { promises } from 'fs';\nimport { glob } from 'glob';\nimport chalk from 'chalk';\nimport { endings } from './core/constants.js';\nimport ValidationService from './core/services/ValidationService.js';\nimport CompressorsContainer from './core/CompressorsContainer.js';\nimport SizeCounter from './utils/SizeCounter.js';\nasync function Compress(quality, directory, type = COMPRESS_TYPE.WEBP) {\n    const compressor = new CompressorsContainer[type](quality);\n    const files = await glob(`${directory}/**/*${endings}`);\n    for (const file of files) {\n        try {\n            const originalStats = await promises.stat(file);\n            if (ValidationService.isFileValid(originalStats, file)) {\n                const compressedDTOs = await compressor.compress(file);\n                for (const compressedDTO of compressedDTOs) {\n                    const outputSize = Buffer.byteLength(compressedDTO.buffer);\n                    if (originalStats.size - outputSize > 0) {\n                        await compressor.writingCompressedFile(compressedDTO);\n                    }\n                    SizeCounter.count(originalStats.size, outputSize, file);\n                }\n            }\n        }\n        catch (e) {\n            console.error(chalk.yellow(e));\n        }\n    }\n    console.log(chalk.magenta(`[Total compressed]: ${SizeCounter.getSize()}`));\n}\nexport { Compress, COMPRESS_TYPE };\n"]}