/**
 * DevExtreme (cjs/ui/html_editor/utils/templates_storage.js)
 * Version: 23.2.6 (build 24140-0112)
 * Build date: Sun May 19 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
exports.default = void 0;
var _type = require("../../../core/utils/type");
let TemplatesStorage = function() {
    function TemplatesStorage() {
        this._storage = {}
    }
    var _proto = TemplatesStorage.prototype;
    _proto.set = function(_ref, value) {
        var _this$_storage, _this$_storage$editor;
        let {
            editorKey: editorKey,
            marker: marker
        } = _ref;
        null !== (_this$_storage$editor = (_this$_storage = this._storage)[editorKey]) && void 0 !== _this$_storage$editor ? _this$_storage$editor : _this$_storage[editorKey] = {};
        this._storage[editorKey][marker] = value
    };
    _proto.get = function(_ref2) {
        var _Object$values$at, _this$_storage$editor2;
        let {
            editorKey: editorKey,
            marker: marker
        } = _ref2;
        const isQuillFormatCall = !(0, _type.isDefined)(editorKey);
        return isQuillFormatCall ? null === (_Object$values$at = Object.values(this._storage).at(-1)) || void 0 === _Object$values$at ? void 0 : _Object$values$at[marker] : null === (_this$_storage$editor2 = this._storage[editorKey]) || void 0 === _this$_storage$editor2 ? void 0 : _this$_storage$editor2[marker]
    };
    _proto.delete = function(_ref3) {
        let {
            editorKey: editorKey,
            marker: marker
        } = _ref3;
        if (!this._storage[editorKey]) {
            return
        }
        delete this._storage[editorKey][marker];
        if ((0, _type.isEmptyObject)(this._storage[editorKey])) {
            delete this._storage[editorKey]
        }
    };
    return TemplatesStorage
}();
exports.default = TemplatesStorage;
module.exports = exports.default;
module.exports.default = exports.default;
