{"version":3,"sources":["jsdelivr-header.js","/npm/@rgba-image/create-image-browser@0.1.0/dist/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aACA,OAAO,eAAe,QAAS,aAAc,CAAE,OAAO,IACtD,MAAM,SAAW,EACjB,QAAQ,mBAAqB,CAAC,EAAO,CAAC,EAAG,EAAG,EAAG,MAC3C,KAAM,WAAY,IAAS,EAAK,OAFnB,EAGT,MAAM,UAAU,mDAGpB,MAAM,GADN,EAAO,IAAK,kBAAkB,GAAO,MAAM,EAL9B,IAMQ,OAAM,GAAW,IAAN,IAgChC,MA/BoB,CAAC,EAAO,EAAQ,KAChC,QAAc,IAAV,QAAkC,IAAX,EACvB,MAAM,UAAU,wBAIpB,GAFA,EAAQ,KAAK,MAAM,GACnB,EAAS,KAAK,MAAM,GAChB,MAAM,IAAU,EAAQ,GAAK,MAAM,IAAW,EAAS,EACvD,MAAM,UAAU,gEAEpB,MAAM,EAAS,EAAQ,EAhBd,EAoBT,QAHa,IAAT,IACA,EAAO,IAAI,kBAAkB,IAE7B,aAAgB,kBAAmB,CACnC,GAAI,EAAK,SAAW,EAChB,MAAM,UAAU,gEAEpB,IAAK,EACD,IAAK,IAAI,EAAI,EAAG,EAAI,EAAQ,IACxB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAO,IAAK,CAC5B,MAAM,EA3Bb,GA2BsB,EAAI,EAAQ,GAC3B,IAAK,IAAI,EAAI,EAAG,EA5BvB,EA4BqC,IAC1B,EAAK,EAAQ,GAAK,EAAK,EAE/B,CAGR,OAAO,IAAI,UAAU,EAAM,EAAO,EACtC,CACA,MAAM,UAAU,qDAAqD,CAEvD,EAEtB,QAAQ,YAAc,QAAQ","file":"/npm/@rgba-image/create-image-browser@0.1.0/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@rgba-image/create-image-browser@0.1.0/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\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst channels = 4;\nexports.CreateImageFactory = (fill = [0, 0, 0, 0]) => {\n    if (!('length' in fill) || fill.length < channels) {\n        throw TypeError(`fill should be iterable with at least ${channels} members`);\n    }\n    fill = (new Uint8ClampedArray(fill)).slice(0, channels);\n    const allZero = fill.every(v => v === 0);\n    const createImage = (width, height, data) => {\n        if (width === undefined || height === undefined) {\n            throw TypeError('Not enough arguments');\n        }\n        width = Math.floor(width);\n        height = Math.floor(height);\n        if (isNaN(width) || width < 1 || isNaN(height) || height < 1) {\n            throw TypeError('Index or size is negative or greater than the allowed amount');\n        }\n        const length = width * height * channels;\n        if (data === undefined) {\n            data = new Uint8ClampedArray(length);\n        }\n        if (data instanceof Uint8ClampedArray) {\n            if (data.length !== length) {\n                throw TypeError('Index or size is negative or greater than the allowed amount');\n            }\n            if (!allZero) {\n                for (let y = 0; y < height; y++) {\n                    for (let x = 0; x < width; x++) {\n                        const index = (y * width + x) * channels;\n                        for (let c = 0; c < channels; c++) {\n                            data[index + c] = fill[c];\n                        }\n                    }\n                }\n            }\n            return new ImageData(data, width, height);\n        }\n        throw TypeError('Expected data to be Uint8ClampedArray or undefined');\n    };\n    return createImage;\n};\nexports.createImage = exports.CreateImageFactory();\n"]}