/**
 * DevExtreme (cjs/__internal/ui/list/m_item.js)
 * Version: 24.1.7-build-24272-1937
 * Build date: Sat Sep 28 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 _renderer = _interopRequireDefault(require("../../../core/renderer"));
var _m_item = _interopRequireDefault(require("../../ui/collection/m_item"));

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    }
}
const LIST_ITEM_BADGE_CONTAINER_CLASS = "dx-list-item-badge-container";
const LIST_ITEM_BADGE_CLASS = "dx-list-item-badge";
const BADGE_CLASS = "dx-badge";
const LIST_ITEM_CHEVRON_CONTAINER_CLASS = "dx-list-item-chevron-container";
const LIST_ITEM_CHEVRON_CLASS = "dx-list-item-chevron";
const ListItem = _m_item.default.inherit({
    _renderWatchers() {
        this.callBase();
        this._startWatcher("badge", this._renderBadge.bind(this));
        this._startWatcher("showChevron", this._renderShowChevron.bind(this))
    },
    _renderBadge(badge) {
        this._$element.children(".dx-list-item-badge-container").remove();
        if (!badge) {
            return
        }
        const $badge = (0, _renderer.default)("<div>").addClass("dx-list-item-badge-container").append((0, _renderer.default)("<div>").addClass("dx-list-item-badge").addClass("dx-badge").text(badge));
        const $chevron = this._$element.children(".dx-list-item-chevron-container").first();
        $chevron.length > 0 ? $badge.insertBefore($chevron) : $badge.appendTo(this._$element)
    },
    _renderShowChevron(showChevron) {
        this._$element.children(".dx-list-item-chevron-container").remove();
        if (!showChevron) {
            return
        }
        const $chevronContainer = (0, _renderer.default)("<div>").addClass("dx-list-item-chevron-container");
        const $chevron = (0, _renderer.default)("<div>").addClass("dx-list-item-chevron");
        $chevronContainer.append($chevron).appendTo(this._$element)
    }
});
var _default = exports.default = ListItem;
