"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
function paperBackground(root) {
    return __awaiter(this, void 0, void 0, function* () {
        const black = new Uint8ClampedArray([0, 0, 0, 32]);
        const white = new Uint8ClampedArray([255, 255, 255, 0]);
        const size = 64;
        const data = new Uint8ClampedArray(size * size * 4);
        for (let y = 0; y < size; y++) {
            for (let x = 0; x < size; x++) {
                data.set(Math.random() > 0.9 ? white : black, (y * size + x) * 4);
            }
        }
        const canvas = document.createElement('canvas');
        canvas.width = canvas.height = size;
        const ctx = canvas.getContext('2d');
        ctx.putImageData(new ImageData(data, size, size), 0, 0);
        const png = yield new Promise((resolve) => canvas.toBlob(resolve, 'image/png'));
        const url = URL.createObjectURL(png);
        root.style.backgroundImage = `url(${url})`;
    });
}
exports.default = paperBackground;
//# sourceMappingURL=paperBackground.js.map