/**
 * DevExtreme (cjs/__internal/ui/html_editor/utils/m_templates_storage.js)
 * Version: 23.2.9 (build 24294-0112)
 * Build date: Sun Oct 20 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
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) {
        let {
            editorKey: editorKey,
            marker: marker
        } = _ref;
        var _a;
        var _b;
        null !== (_a = (_b = this._storage)[editorKey]) && void 0 !== _a ? _a : _b[editorKey] = {};
        this._storage[editorKey][marker] = value
    };
    _proto.get = function(_ref2) {
        let {
            editorKey: editorKey,
            marker: marker
        } = _ref2;
        var _a, _b;
        const isQuillFormatCall = !(0, _type.isDefined)(editorKey);
        return isQuillFormatCall ? null === (_a = Object.values(this._storage).at(-1)) || void 0 === _a ? void 0 : _a[marker] : null === (_b = this._storage[editorKey]) || void 0 === _b ? void 0 : _b[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;
