"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    restoreImageReferences: ()=>restoreImageReferences
});
function restoreImageReferences(data, resolveImage) {
    if ('string' == typeof data) return data;
    if (Array.isArray(data)) return data.map((item)=>restoreImageReferences(item, resolveImage));
    if ('object' == typeof data && null !== data) {
        if ('$screenshot' in data) {
            const screenshotData = data;
            const id = screenshotData.$screenshot;
            const capturedAt = 'number' == typeof screenshotData.capturedAt ? screenshotData.capturedAt : void 0;
            if ('string' == typeof id) {
                if (id.startsWith('data:image/') || id.startsWith('./') || id.startsWith('/')) return {
                    base64: id,
                    capturedAt
                };
                let resolved = null;
                const lazy = Object.defineProperties({}, {
                    base64: {
                        get () {
                            if (null === resolved) resolved = resolveImage(id);
                            return resolved;
                        },
                        enumerable: true
                    },
                    capturedAt: {
                        value: capturedAt,
                        enumerable: true
                    }
                });
                return lazy;
            }
            console.warn('Invalid $screenshot value type:', typeof id);
            return {
                base64: ''
            };
        }
        const result = {};
        for (const [key, value] of Object.entries(data))result[key] = restoreImageReferences(value, resolveImage);
        return result;
    }
    return data;
}
exports.restoreImageReferences = __webpack_exports__.restoreImageReferences;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "restoreImageReferences"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});

//# sourceMappingURL=image-restoration.js.map