{"version":3,"sources":["jsdelivr-header.js","/npm/@jimp/plugin-threshold@1.6.0/dist/commonjs/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aACA,OAAO,eAAe,QAAS,aAAc,CAAE,OAAO,IACtD,QAAQ,aAAU,EAClB,MAAM,QAAU,QAAQ,eAClB,eAAiB,QAAQ,sBACzB,MAAQ,QAAQ,OAChB,uBAAyB,MAAM,EAAE,OAAO,CAE1C,IAAK,MAAM,EAAE,SAAS,IAAI,GAAG,IAAI,KAEjC,QAAS,MAAM,EAAE,SAAS,IAAI,GAAG,IAAI,KAAK,WAE1C,cAAe,MAAM,EAAE,UAAU,aAErC,QAAQ,QAAU,CAad,SAAA,CAAU,EAAO,GACb,IAAI,IAAE,EAAG,QAAE,EAAU,IAAG,cAExB,GAAgB,GAAU,uBAAuB,MAAM,GAYvD,OAXA,GAAM,EAAI,QAAQ,UAAU,GAC5B,GAAU,EAAI,QAAQ,UAAU,GAC5B,GACA,eAAe,QAAQ,UAAU,GAErC,EAAM,MAAK,CAAC,EAAG,EAAI,KACf,MAAM,EAAO,EAAM,OAAO,KAAK,GAAO,EAAM,EAAM,OAAO,KAAK,GAAO,EACrE,EAAM,OAAO,KAAK,GAAO,EACzB,EAAM,OAAO,KAAK,EAAM,GAAK,EAC7B,EAAM,OAAO,KAAK,EAAM,GAAK,CAAI,IAE9B,CACX","file":"/npm/@jimp/plugin-threshold@1.6.0/dist/commonjs/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.19.2.\n * Original file: /npm/@jimp/plugin-threshold@1.6.0/dist/commonjs/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\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.methods = void 0;\nconst utils_1 = require(\"@jimp/utils\");\nconst plugin_color_1 = require(\"@jimp/plugin-color\");\nconst zod_1 = require(\"zod\");\nconst ThresholdOptionsSchema = zod_1.z.object({\n    /** A number auto limited between 0 - 255 */\n    max: zod_1.z.number().min(0).max(255),\n    /** A number auto limited between 0 - 255 (default 255)  */\n    replace: zod_1.z.number().min(0).max(255).optional(),\n    /** A boolean whether to apply greyscale beforehand (default true)  */\n    autoGreyscale: zod_1.z.boolean().optional(),\n});\nexports.methods = {\n    /**\n     * Applies a minimum color threshold to a grayscale image.\n     * Converts image to grayscale by default.\n     * @example\n     * ```ts\n     * import { Jimp } from \"jimp\";\n     *\n     * const image = await Jimp.read(\"test/image.png\");\n     *\n     * image.threshold({ max: 150 });\n     * ```\n     */\n    threshold(image, options) {\n        let { max, replace = 255, \n        // eslint-disable-next-line prefer-const\n        autoGreyscale = true, } = ThresholdOptionsSchema.parse(options);\n        max = (0, utils_1.limit255)(max);\n        replace = (0, utils_1.limit255)(replace);\n        if (autoGreyscale) {\n            plugin_color_1.methods.greyscale(image);\n        }\n        image.scan((_, __, idx) => {\n            const grey = image.bitmap.data[idx] < max ? image.bitmap.data[idx] : replace;\n            image.bitmap.data[idx] = grey;\n            image.bitmap.data[idx + 1] = grey;\n            image.bitmap.data[idx + 2] = grey;\n        });\n        return image;\n    },\n};\n"]}